From e2171de4e6b090fbbad07d8852a068ec7ca050c0 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 11 Apr 2013 21:27:29 +0200 Subject: Fix issue #37 : possibilité de sortir un site du flux principal (utile pour les sites qui publient beaucoup) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/configureController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/controllers/configureController.php') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 243c155f9..01ed4d414 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -88,10 +88,12 @@ class configureController extends ActionController { if (Request::isPost () && $this->view->flux) { $cat = Request::param ('category', 0); $path = Request::param ('path_entries', ''); + $priority = Request::param ('priority', 0); $values = array ( 'category' => $cat, - 'pathEntries' => $path + 'pathEntries' => $path, + 'priority' => $priority ); if ($feedDAO->updateFeed ($id, $values)) { -- cgit v1.2.3 From cd979d30e1b7f60faeb90dfdad58c67b4f3a01f5 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 14 Apr 2013 20:12:07 +0200 Subject: Ajout partage Shaarli : fix issue #34 --- app/controllers/configureController.php | 3 +++ app/models/RSSConfiguration.php | 19 +++++++++++++++++-- app/views/configure/display.phtml | 8 ++++++++ app/views/index/index.phtml | 6 ++++++ public/install.php | 27 ++++----------------------- 5 files changed, 38 insertions(+), 25 deletions(-) (limited to 'app/controllers/configureController.php') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 01ed4d414..428768b9b 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -132,6 +132,7 @@ class configureController extends ActionController { $openArticle = Request::param ('mark_open_article', 'no'); $openSite = Request::param ('mark_open_site', 'no'); $openPage = Request::param ('mark_open_page', 'no'); + $urlShaarli = Request::param ('shaarli', ''); $this->view->conf->_postsPerPage (intval ($nb)); $this->view->conf->_defaultView ($view); @@ -144,6 +145,7 @@ class configureController extends ActionController { 'site' => $openSite, 'page' => $openPage, )); + $this->view->conf->_urlShaarli ($urlShaarli); $values = array ( 'posts_per_page' => $this->view->conf->postsPerPage (), @@ -153,6 +155,7 @@ class configureController extends ActionController { 'old_entries' => $this->view->conf->oldEntries (), 'mail_login' => $this->view->conf->mailLogin (), 'mark_when' => $this->view->conf->markWhen (), + 'url_shaarli' => $this->view->conf->urlShaarli (), ); $confDAO = new RSSConfigurationDAO (); diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php index 270ec2ce1..ca56ec3a8 100755 --- a/app/models/RSSConfiguration.php +++ b/app/models/RSSConfiguration.php @@ -9,6 +9,7 @@ class RSSConfiguration extends Model { private $shortcuts = array (); private $mail_login = ''; private $mark_when = array (); + private $url_shaarli = ''; public function __construct () { $confDAO = new RSSConfigurationDAO (); @@ -20,6 +21,7 @@ class RSSConfiguration extends Model { $this->_shortcuts ($confDAO->shortcuts); $this->_mailLogin ($confDAO->mail_login); $this->_markWhen ($confDAO->mark_when); + $this->_urlShaarli ($confDAO->url_shaarli); } public function postsPerPage () { @@ -55,6 +57,9 @@ class RSSConfiguration extends Model { public function markWhenPage () { return $this->mark_when['page']; } + public function urlShaarli () { + return $this->url_shaarli; + } public function _postsPerPage ($value) { if (is_int (intval ($value))) { @@ -108,11 +113,17 @@ class RSSConfiguration extends Model { $this->mark_when['site'] = $values['site']; $this->mark_when['page'] = $values['page']; } + public function _urlShaarli ($value) { + $this->url_shaarli = ''; + if (filter_var ($value, FILTER_VALIDATE_URL)) { + $this->url_shaarli = $value; + } + } } class RSSConfigurationDAO extends Model_array { - public $posts_per_page = 10; - public $default_view = 'all'; + public $posts_per_page = 20; + public $default_view = 'not_read'; public $display_posts = 'no'; public $sort_order = 'low_to_high'; public $old_entries = 3; @@ -131,6 +142,7 @@ class RSSConfigurationDAO extends Model_array { 'site' => 'yes', 'page' => 'no' ); + public $url_shaarli = ''; public function __construct () { parent::__construct (PUBLIC_PATH . '/data/Configuration.array.php'); @@ -159,6 +171,9 @@ class RSSConfigurationDAO extends Model_array { if (isset ($this->array['mark_when'])) { $this->mark_when = $this->array['mark_when']; } + if (isset ($this->array['url_shaarli'])) { + $this->url_shaarli = $this->array['url_shaarli']; + } } public function update ($values) { diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 240428493..79fa4b43c 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -87,6 +87,14 @@ + Partage +
+ +
+ +
+
+
diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index cd0ff0504..6889a8b51 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -80,6 +80,12 @@ if (isset ($this->entryPaginator)) {
  • Par mail
  • + conf->urlShaarli (); + if ($shaarli) { + ?> +
  • Shaarli
  • +
    diff --git a/public/install.php b/public/install.php index fca4ff38e..7065e3a77 100644 --- a/public/install.php +++ b/public/install.php @@ -91,32 +91,13 @@ function saveStep2 () { $file_data = PUBLIC_PATH . '/data/Configuration.array.php'; - $conf = array ( - 'posts_per_page' => 20, - 'default_view' => 'not_read', - 'display_posts' => 'no', - 'sort_order' => 'low_to_high', - 'old_entries' => $_SESSION['old_entries'], - 'mail_login' => $_SESSION['mail_login'], - 'shortcuts' => array ( - 'mark_read' => 'r', - 'mark_favorite' => 'f', - 'go_website' => 'space', - 'next_entry' => 'j', - 'prev_entry' => 'k', - 'next_page' => 'right', - 'prev_page' => 'left', - ), - 'mark_when' => array ( - 'article' => 'yes', - 'site' => 'yes', - 'page' => 'no', - ), - ); $f = fopen ($file_data, 'w'); writeLine ($f, ' $_SESSION['old_entries'], + 'mail_login' => $_SESSION['mail_login'] + )); writeLine ($f, ');'); fclose ($f); -- cgit v1.2.3 From 392672ab2771c6d22f55017c4ed64a0e00945b23 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 17 Apr 2013 19:05:53 +0200 Subject: Fix issue #58 : possibilité de vider une catégorie MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/configureController.php | 1 + app/controllers/feedController.php | 38 +++++++++++++++++++++++++++------ app/models/Category.php | 14 ++++++++++++ app/models/Feed.php | 14 ++++++++++++ app/views/configure/categorize.phtml | 11 +++++++--- 5 files changed, 68 insertions(+), 10 deletions(-) (limited to 'app/controllers/configureController.php') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 428768b9b..9f4a8b24a 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -56,6 +56,7 @@ class configureController extends ActionController { } $this->view->categories = $catDAO->listCategories (); + $this->view->defaultCategory = $catDAO->getDefault (); View::prependTitle ('Gestion des catégories - '); } diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index fb0f790fd..7a34430ea 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -228,19 +228,43 @@ class feedController extends ActionController { array ('error' => array ('Vous n\'avez pas le droit d\'accéder à cette page')) ); } else { + $type = Request::param ('type', 'feed'); $id = Request::param ('id'); $feedDAO = new FeedDAO (); - $feedDAO->deleteFeed ($id); + if ($type == 'category') { + if ($feedDAO->deleteFeedByCategory ($id)) { + $notif = array ( + 'type' => 'good', + 'content' => 'La catégorie a été vidée' + ); + } else { + $notif = array ( + 'type' => 'bad', + 'content' => 'Un problème est survenu' + ); + } + } else { + if ($feedDAO->deleteFeed ($id)) { + $notif = array ( + 'type' => 'good', + 'content' => 'Le flux a été supprimé' + ); + } else { + $notif = array ( + 'type' => 'bad', + 'content' => 'Un problème est survenu' + ); + } + } - // notif - $notif = array ( - 'type' => 'good', - 'content' => 'Le flux a été supprimé' - ); Session::_param ('notification', $notif); - Request::forward (array ('c' => 'configure', 'a' => 'feed'), true); + if ($type == 'category') { + Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true); + } else { + Request::forward (array ('c' => 'configure', 'a' => 'feed'), true); + } } } diff --git a/app/models/Category.php b/app/models/Category.php index ae803591f..7ce572e71 100755 --- a/app/models/Category.php +++ b/app/models/Category.php @@ -158,6 +158,20 @@ class CategoryDAO extends Model_pdo { return HelperCategory::daoToCategory ($stm->fetchAll (PDO::FETCH_ASSOC)); } + public function getDefault () { + $sql = 'SELECT * FROM category WHERE id="000000"'; + $stm = $this->bd->prepare ($sql); + + $stm->execute (); + $res = $stm->fetchAll (PDO::FETCH_ASSOC); + $cat = HelperCategory::daoToCategory ($res); + + if (isset ($cat[0])) { + return $cat[0]; + } else { + return false; + } + } public function checkDefault () { $def_cat = $this->searchById ('000000'); diff --git a/app/models/Feed.php b/app/models/Feed.php index 070f044a9..222e22256 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -283,6 +283,20 @@ class FeedDAO extends Model_pdo { return false; } } + public function deleteFeedByCategory ($id) { + $sql = 'DELETE FROM feed WHERE category=?'; + $stm = $this->bd->prepare ($sql); + + $values = array ($id); + + if ($stm && $stm->execute ($values)) { + return true; + } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); + return false; + } + } public function searchById ($id) { $sql = 'SELECT * FROM feed WHERE id=?'; diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml index 943dd489e..660ddef20 100644 --- a/app/views/configure/categorize.phtml +++ b/app/views/configure/categorize.phtml @@ -6,13 +6,18 @@
    Gestion des catégories - gestion des flux +

    Lors de la suppression d'une catégorie, ses flux seront automatiquement classés dans defaultCategory->name (); ?>.

    + categories as $cat) { $i++; ?>
    - +
    - id () == '000000') { ?> - ne peut pas être supprimé + Vider ? (nbFeed (); ?> flux) + id () == $this->defaultCategory->id ()) { ?> + ne peut pas être supprimée
    -- cgit v1.2.3 From a2b5e8f3ce597fbcec0c25b68c551a526d2bf3ec Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 17 Apr 2013 19:31:20 +0200 Subject: Fix issue #60 : export OPML dans un fichier téléchargeable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/configureController.php | 3 ++- app/views/configure/importExport.phtml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'app/controllers/configureController.php') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 9f4a8b24a..18a56c066 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -184,7 +184,8 @@ class configureController extends ActionController { View::_title ('feeds_opml.xml'); $this->view->_useLayout (false); - header('Content-type: text/xml'); + header('Content-Type: text/xml; charset=utf-8'); + header('Content-disposition: attachment; filename=feeds_opml.xml'); $feedDAO = new FeedDAO (); $catDAO = new CategoryDAO (); diff --git a/app/views/configure/importExport.phtml b/app/views/configure/importExport.phtml index cd677c1eb..34bee4a07 100644 --- a/app/views/configure/importExport.phtml +++ b/app/views/configure/importExport.phtml @@ -29,7 +29,7 @@
    ou - + Exporter
    -- cgit v1.2.3