A free, self-hostable news aggregator…
Export des flux au format RSS pleinement supporté (voir issue #34) - possibilité de les filtrer comme pour la vue principale
Marien Fressinaudc2bf3ead8ae1
diff --git a/app/controllers/indexController.php b/app/controllers/indexController.phpindex 1eba7231f..a11c26044 100755--- a/app/controllers/indexController.php+++ b/app/controllers/indexController.php@@ -38,6 +38,9 @@ class indexController extends ActionController {} elseif ($this->get['type'] == 'favoris') {$entries = $entryDAO->listFavorites ($this->mode, $search, $order);View::prependTitle ('Vos favoris - ');+ } elseif ($this->get['type'] == 'public') {+ $entries = $entryDAO->listPublic ($this->mode, $search, $order);+ View::prependTitle ('Public - ');} elseif ($this->get != false) {if ($this->get['type'] == 'c') {$cat = $catDAO->searchById ($this->get['filter']);@@ -81,6 +84,10 @@ class indexController extends ActionController {$this->view->cat_aside = $catDAO->listCategories ();$this->view->nb_favorites = $entryDAO->countFavorites ();$this->view->nb_total = $entryDAO->count ();++ if (Request::param ('output', '') == 'rss') {+ $this->view->_useLayout (false);+ }}}@@ -157,6 +164,13 @@ class indexController extends ActionController {if ($get == 'favoris') {$this->view->get_c = $get;+ $this->get = array (+ 'type' => $get,+ 'filter' => $get+ );+ } elseif ($get == 'public') {+ $this->view->get_c = $get;+$this->get = array ('type' => $get,'filter' => $getdiff --git a/app/controllers/rssController.php b/app/controllers/rssController.phpdeleted file mode 100755index 1f66f4517..000000000--- a/app/controllers/rssController.php+++ /dev/null@@ -1,35 +0,0 @@-<?php--class rssController extends ActionController {- public function firstAction() {- header('Content-Type: text/xml');- header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');- header('Pragma: public');-- $this->view->_useLayout (false);- }-- public function publicAction () {- $entryDAO = new EntryDAO ();- $entryDAO->_nbItemsPerPage (-1);-- $items = $entryDAO->listPublic ('low_to_high');-- try {- $page = Request::param('page', 1);- $nb = Request::param('nb', 15);- $this->view->itemPaginator = new Paginator($items);- $this->view->itemPaginator->_nbItemsPerPage($nb);- $this->view->itemPaginator->_currentPage($page);- } catch(CurrentPagePaginationException $e) {- Error::error(- 404,- array('error' => array('La page que vous cherchez n\'existe pas'))- );- }- }-- public function getNbNotReadAction() {- }-}diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtmlindex 90fe4aea1..71a5bd11e 100644--- a/app/layout/nav_menu.phtml+++ b/app/layout/nav_menu.phtml@@ -62,4 +62,23 @@</li></ul></div>++ <?php+ $get = Request::param ('get', '');+ $search = Request::param ('search', '');+ $url = array (+ 'c' => 'index',+ 'a' => 'index',+ 'params' => array (+ 'output' => 'rss'+ )+ );+ if ($get != '') {+ $url['params']['get'] = $get;+ }+ if ($search != '') {+ $url['params']['search'] = $search;+ }+ ?>+ <a class="btn" href="<?php echo Url::display ($url); ?>"><i class="icon i_rss"></i></a></div>diff --git a/app/models/Entry.php b/app/models/Entry.phpindex b9b6d30db..230b457bf 100755--- a/app/models/Entry.php+++ b/app/models/Entry.php@@ -422,7 +422,7 @@ class EntryDAO extends Model_pdo {$values = array();if ($search) {$values[] = '%'.$search.'%';- $where = ' AND title LIKE ?';+ $where .= ' AND title LIKE ?';}if ($order == 'low_to_high') {@@ -455,8 +455,17 @@ class EntryDAO extends Model_pdo {return HelperEntry::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC));}- public function listPublic ($order = 'high_to_low') {+ public function listPublic ($mode, $search = false, $order = 'high_to_low') {$where = ' WHERE is_public=1';+ if ($mode == 'not_read') {+ $where .= ' AND is_read=0';+ }++ $values = array();+ if ($search) {+ $values[] = '%'.$search.'%';+ $where .= ' AND title LIKE ?';+ }if ($order == 'low_to_high') {$order = ' DESC';@@ -464,10 +473,26 @@ class EntryDAO extends Model_pdo {$order = '';}- $sql = 'SELECT * FROM entry' . $where . ' ORDER BY date' . $order;+ $sql = 'SELECT COUNT(*) AS count FROM entry' . $where;+ $stm = $this->bd->prepare ($sql);+ $stm->execute ($values);+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);+ $this->nbItems = $res[0]['count'];+ if($this->nbItemsPerPage < 0) {+ $sql = 'SELECT * FROM entry' . $where+ . ' ORDER BY date' . $order;+ } else {+ $deb = ($this->currentPage () - 1) * $this->nbItemsPerPage;+ $fin = $this->nbItemsPerPage;++ $sql = 'SELECT * FROM entry' . $where+ . ' ORDER BY date' . $order+ . ' LIMIT ' . $deb . ', ' . $fin;+ }$stm = $this->bd->prepare ($sql);- $stm->execute ();++ $stm->execute ($values);return HelperEntry::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC));}@@ -481,7 +506,7 @@ class EntryDAO extends Model_pdo {$values = array ($cat);if ($search) {$values[] = '%'.$search.'%';- $where = ' AND title LIKE ?';+ $where .= ' AND title LIKE ?';}if ($order == 'low_to_high') {@@ -515,10 +540,10 @@ class EntryDAO extends Model_pdo {$where .= ' AND is_read=0';}- $values = array();+ $values = array($feed);if ($search) {$values[] = '%'.$search.'%';- $where = ' AND title LIKE ?';+ $where .= ' AND title LIKE ?';}if ($order == 'low_to_high') {@@ -529,7 +554,6 @@ class EntryDAO extends Model_pdo {$sql = 'SELECT COUNT(*) AS count FROM entry' . $where;$stm = $this->bd->prepare ($sql);- $values = array ($feed);$stm->execute ($values);$res = $stm->fetchAll (PDO::FETCH_ASSOC);$this->nbItems = $res[0]['count'];@@ -542,8 +566,6 @@ class EntryDAO extends Model_pdo {$stm = $this->bd->prepare ($sql);- $values = array ($feed);-$stm->execute ($values);return HelperEntry::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC));diff --git a/app/views/rss/public.phtml b/app/views/helpers/rss.phtmlsimilarity index 75%rename from app/views/rss/public.phtmlrename to app/views/helpers/rss.phtmlindex 04a035699..b75e6d3bc 100755--- a/app/views/rss/public.phtml+++ b/app/views/helpers/rss.phtml@@ -3,13 +3,12 @@<channel><title><?php echo View::title(); ?></title><link><?php echo Url::display(); ?></link>- <description>Flux public de <?php echo View::title(); ?></description>- <language>fr</language>+ <description>Flux RSS de <?php echo View::title(); ?></description><pubDate><?php echo date('D, d M Y H:i:s O'); ?></pubDate><lastBuildDate><?php echo gmdate('D, d M Y H:i:s'); ?> GMT</lastBuildDate>- <atom:link href="<?php echo Url::display(array('a' => 'rss')); ?>" rel="self" type="application/rss+xml" />+ <atom:link href="<?php echo _url ('index', 'index', 'output', 'rss'); ?>" rel="self" type="application/rss+xml" /><?php-$items = $this->itemPaginator->items ();+$items = $this->entryPaginator->items ();foreach ($items as $item) {?><item>@@ -20,7 +19,7 @@ foreach ($items as $item) {<dc:creator><?php echo $author; ?></dc:creator><?php } ?><description><![CDATA[<?php- echo html_entity_decode($item->notes (false, false));+ echo $item->content ();?>]]></description><pubDate><?php echo date('D, d M Y H:i:s O', $item->date (true)); ?></pubDate><guid><?php echo $item->guid (); ?></guid>diff --git a/app/views/index/index.phtml b/app/views/index/index.phtmlindex f9e953858..cd0ff0504 100644--- a/app/views/index/index.phtml+++ b/app/views/index/index.phtml@@ -1,3 +1,10 @@+<?php+if (Request::param ('output', '') == 'rss') {+ $this->renderHelper ('rss');+ return;+}+?>+<?php $this->partial ('aside_flux'); ?><?php $this->partial ('nav_menu'); ?>@@ -67,7 +74,7 @@ if (isset ($this->entryPaginator)) {<li class="item"><div class="dropdown"><div id="dropdown-share-<?php echo $item->id ();?>" class="dropdown-target"></div>- <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id ();?>">Partager</a>+ <i class="icon i_share"></i> <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id ();?>">Partager</a><ul class="dropdown-menu"><li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li>diff --git a/public/theme/global.css b/public/theme/global.cssindex f4466cec1..e44cda059 100644--- a/public/theme/global.css+++ b/public/theme/global.css@@ -471,3 +471,9 @@ input, select, textarea {.icon.i_category {background-image: url("icons/category.svg");}+ .icon.i_rss {+ background-image: url("icons/rss.svg");+ }+ .icon.i_share {+ background-image: url("icons/share.svg");+ }diff --git a/public/theme/icons/rss.svg b/public/theme/icons/rss.svgnew file mode 100644index 000000000..fe588c2cf--- /dev/null+++ b/public/theme/icons/rss.svg@@ -0,0 +1,32 @@+<?xml version='1.0' encoding='UTF-8' standalone='no'?>+<!-- Created with Inkscape (http://www.inkscape.org/) -->++<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:dc='http://purl.org/dc/elements/1.1/' sodipodi:docname='application-rss+xml-symbolic.svg' height='16' id='svg7384' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:svg='http://www.w3.org/2000/svg' inkscape:version='0.48.3.1 r9886' version='1.1' width='16' xmlns='http://www.w3.org/2000/svg'>+ <metadata id='metadata90'>+ <rdf:RDF>+ <cc:Work rdf:about=''>+ <dc:format>image/svg+xml</dc:format>+ <dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/>+ <dc:title>Gnome Symbolic Icon Theme</dc:title>+ </cc:Work>+ </rdf:RDF>+ </metadata>+ <sodipodi:namedview inkscape:bbox-paths='false' bordercolor='#666666' borderopacity='1' inkscape:current-layer='layer14' inkscape:cx='27.01134' inkscape:cy='1.367038' gridtolerance='10' inkscape:guide-bbox='true' guidetolerance='10' id='namedview88' inkscape:object-nodes='false' inkscape:object-paths='false' objecttolerance='10' pagecolor='#3a3b39' inkscape:pageopacity='1' inkscape:pageshadow='2' showborder='false' showgrid='false' showguides='true' inkscape:snap-bbox='true' inkscape:snap-bbox-midpoints='false' inkscape:snap-global='true' inkscape:snap-grids='true' inkscape:snap-nodes='false' inkscape:snap-others='false' inkscape:snap-to-guides='true' inkscape:window-height='709' inkscape:window-maximized='1' inkscape:window-width='1366' inkscape:window-x='0' inkscape:window-y='27' inkscape:zoom='1'>+ <inkscape:grid empspacing='2' enabled='true' id='grid4866' originx='-319.9998px' originy='84.00012px' snapvisiblegridlinesonly='true' spacingx='1px' spacingy='1px' type='xygrid' visible='true'/>+ </sodipodi:namedview>+ <title id='title9167'>Gnome Symbolic Icon Theme</title>+ <defs id='defs7386'/>+ <g inkscape:groupmode='layer' id='layer9' inkscape:label='status' style='display:inline' transform='translate(-561,-301.00012)'/>+ <g inkscape:groupmode='layer' id='layer10' inkscape:label='devices' transform='translate(-561,-301.00012)'/>+ <g inkscape:groupmode='layer' id='layer11' inkscape:label='apps' transform='translate(-561,-301.00012)'/>+ <g inkscape:groupmode='layer' id='layer13' inkscape:label='places' transform='translate(-561,-301.00012)'/>+ <g inkscape:groupmode='layer' id='layer14' inkscape:label='mimetypes' transform='translate(-561,-301.00012)'>++ <path sodipodi:cx='323.0625' sodipodi:cy='97.1875' d='m 325.0625,97.1875 a 2,3.236068 0 1 1 -4,0 2,3.236068 0 1 1 4,0 z' id='path4983' sodipodi:rx='2' sodipodi:ry='3.236068' style='color:#000000;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.69602728;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new' transform='matrix(1.0000007,0,0,0.61803426,241.93747,252.93479)' sodipodi:type='arc'/>+ <path inkscape:connector-curvature='0' d='m 563.0002,303 0,1 c 0,0.55016 0.45347,1 1,1 4.97056,0 9,4.02944 9,9 0,0.55016 0.45347,1 1,1 l 1,0 0,-1 c 0,-6.07513 -4.92487,-11 -11,-11 l -1,0 z m 0,4 0,1 c 0,0.55016 0.45347,1 1,1 2.76143,0 5,2.23857 5,5 0,0.55016 0.45347,1 1,1 l 1,0 0,-1 c 0,-3.866 -3.134,-7 -7,-7 l -1,0 z' id='path5814' style='color:#000000;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.33333492;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new'/>+ </g>+ <g inkscape:groupmode='layer' id='layer15' inkscape:label='emblems' style='display:inline' transform='translate(-561,-301.00012)'/>+ <g inkscape:groupmode='layer' id='g71291' inkscape:label='emotes' style='display:inline' transform='translate(-561,-301.00012)'/>+ <g inkscape:groupmode='layer' id='g4953' inkscape:label='categories' style='display:inline' transform='translate(-561,-301.00012)'/>+ <g inkscape:groupmode='layer' id='layer12' inkscape:label='actions' style='display:inline' transform='translate(-561,-301.00012)'/>+</svg>diff --git a/public/theme/icons/share.svg b/public/theme/icons/share.svgnew file mode 100644index 000000000..443321882--- /dev/null+++ b/public/theme/icons/share.svg@@ -0,0 +1,34 @@+<?xml version='1.0' encoding='UTF-8' standalone='no'?>+<!-- Created with Inkscape (http://www.inkscape.org/) -->++<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:dc='http://purl.org/dc/elements/1.1/' sodipodi:docname='folder-publicshare-symbolic.svg' height='16' id='svg7384' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:svg='http://www.w3.org/2000/svg' inkscape:version='0.48.3.1 r9886' version='1.1' width='16' xmlns='http://www.w3.org/2000/svg'>+ <metadata id='metadata90'>+ <rdf:RDF>+ <cc:Work rdf:about=''>+ <dc:format>image/svg+xml</dc:format>+ <dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/>+ <dc:title>Gnome Symbolic Icon Theme</dc:title>+ </cc:Work>+ </rdf:RDF>+ </metadata>+ <sodipodi:namedview inkscape:bbox-paths='false' bordercolor='#666666' borderopacity='1' inkscape:current-layer='layer13' inkscape:cx='-55.50224' inkscape:cy='-178.38158' gridtolerance='10' inkscape:guide-bbox='true' guidetolerance='10' id='namedview88' inkscape:object-nodes='false' inkscape:object-paths='false' objecttolerance='10' pagecolor='#3a3b39' inkscape:pageopacity='1' inkscape:pageshadow='2' showborder='false' showgrid='false' showguides='true' inkscape:snap-bbox='true' inkscape:snap-bbox-midpoints='false' inkscape:snap-global='true' inkscape:snap-grids='true' inkscape:snap-nodes='false' inkscape:snap-others='false' inkscape:snap-to-guides='true' inkscape:window-height='1381' inkscape:window-maximized='1' inkscape:window-width='2560' inkscape:window-x='1600' inkscape:window-y='27' inkscape:zoom='1'>+ <inkscape:grid empspacing='2' enabled='true' id='grid4866' originx='-340px' originy='-20.999999px' snapvisiblegridlinesonly='true' spacingx='1px' spacingy='1px' type='xygrid' visible='true'/>+ </sodipodi:namedview>+ <title id='title9167'>Gnome Symbolic Icon Theme</title>+ <defs id='defs7386'/>+ <g inkscape:groupmode='layer' id='layer9' inkscape:label='status' style='display:inline' transform='translate(-581.0002,-196)'/>+ <g inkscape:groupmode='layer' id='layer10' inkscape:label='devices' transform='translate(-581.0002,-196)'/>+ <g inkscape:groupmode='layer' id='layer11' inkscape:label='apps' transform='translate(-581.0002,-196)'/>+ <g inkscape:groupmode='layer' id='layer13' inkscape:label='places' transform='translate(-581.0002,-196)'>++ <path sodipodi:cx='289.03125' sodipodi:cy='178.03125' d='m 291,178.03125 a 1.96875,1.96875 0 1 1 -3.9375,0 1.96875,1.96875 0 1 1 3.9375,0 z' id='path8192' sodipodi:rx='1.96875' sodipodi:ry='1.96875' style='color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999994;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new' transform='matrix(1.5079365,0,0,1.5079365,148.15963,-64.49107)' sodipodi:type='arc'/>+ <path sodipodi:cx='289.03125' sodipodi:cy='178.03125' d='m 291,178.03125 a 1.96875,1.96875 0 1 1 -3.9375,0 1.96875,1.96875 0 1 1 3.9375,0 z' id='path8194' sodipodi:rx='1.96875' sodipodi:ry='1.96875' style='color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999994;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new' transform='matrix(1.5079365,0,0,1.5079365,158.12818,-59.49107)' sodipodi:type='arc'/>+ <path sodipodi:cx='289.03125' sodipodi:cy='178.03125' d='m 291,178.03125 a 1.96875,1.96875 0 1 1 -3.9375,0 1.96875,1.96875 0 1 1 3.9375,0 z' id='path8196' sodipodi:rx='1.96875' sodipodi:ry='1.96875' style='color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999994;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new' transform='matrix(1.5079365,0,0,1.5079365,158.12818,-69.49107)' sodipodi:type='arc'/>+ <path inkscape:connector-curvature='0' d='m 593.625,198.15625 -10.0625,4.875 -1.8125,0.90625 1.8125,0.90625 10.03125,5.0625 0.90625,-1.8125 -8.21875,-4.15625 8.21875,-4 -0.875,-1.78125 z' id='path8198' style='font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans'/>+ </g>+ <g inkscape:groupmode='layer' id='layer14' inkscape:label='mimetypes' transform='translate(-581.0002,-196)'/>+ <g inkscape:groupmode='layer' id='layer15' inkscape:label='emblems' style='display:inline' transform='translate(-581.0002,-196)'/>+ <g inkscape:groupmode='layer' id='g71291' inkscape:label='emotes' style='display:inline' transform='translate(-581.0002,-196)'/>+ <g inkscape:groupmode='layer' id='g4953' inkscape:label='categories' style='display:inline' transform='translate(-581.0002,-196)'/>+ <g inkscape:groupmode='layer' id='layer12' inkscape:label='actions' style='display:inline' transform='translate(-581.0002,-196)'/>+</svg>