Пример #1
0
 /**
  * Méthode qui affiche le flux RSS des commentaires du site pour l'administration
  *
  * @return	flux sur stdout
  * @author	Florent MONTHEL, Amaury GRAILLAT
  **/
 public function getAdminComments()
 {
     # Traitement initial
     $last_updated = '197001010100';
     $entry = '';
     if ($this->cible == '_') {
         # Commentaires hors ligne
         $link = $this->racine . 'core/admin/comments.php?sel=offline&page=1';
         $title = $this->aConf['title'] . ' - ' . L_FEED_OFFLINE_COMMENTS;
         $link_feed = $this->racine . 'feed.php?admin' . $this->clef . '/commentaires/hors-ligne';
     } else {
         # Commentaires en ligne
         $link = $this->racine . 'core/admin/comments.php?sel=online&page=1';
         $title = $this->aConf['title'] . ' - ' . L_FEED_ONLINE_COMMENTS;
         $link_feed = $this->racine . 'feed.php?admin' . $this->clef . '/commentaires/en-ligne';
     }
     # On va boucler sur les commentaires (s'il y en a)
     if ($this->plxRecord_coms) {
         while ($this->plxRecord_coms->loop()) {
             $artId = $this->plxRecord_coms->f('article') + 0;
             $comId = $this->cible . $this->plxRecord_coms->f('article') . '.' . $this->plxRecord_coms->f('numero');
             $title_com = $this->plxRecord_coms->f('author') . ' @ ';
             $title_com .= plxDate::formatDate($this->plxRecord_coms->f('date'), '#day #num_day #month #num_year(4), #hour:#minute');
             $link_com = $this->racine . 'core/admin/comment.php?c=' . $comId;
             # On vérifie la date de publication
             if ($this->plxRecord_coms->f('date') > $last_updated) {
                 $last_updated = $this->plxRecord_coms->f('date');
             }
             # On affiche le flux dans un buffer
             $entry .= "\t<item>\n";
             $entry .= "\t\t" . '<title>' . strip_tags(html_entity_decode($title_com, ENT_QUOTES, PLX_CHARSET)) . '</title> ' . "\n";
             $entry .= "\t\t" . '<link>' . $link_com . '</link>' . "\n";
             $entry .= "\t\t" . '<guid>' . $link_com . '</guid>' . "\n";
             $entry .= "\t\t" . '<description>' . plxUtils::strCheck(strip_tags($this->plxRecord_coms->f('content'))) . '</description>' . "\n";
             $entry .= "\t\t" . '<pubDate>' . plxDate::dateIso2rfc822($this->plxRecord_coms->f('date')) . '</pubDate>' . "\n";
             $entry .= "\t\t" . '<dc:creator>' . plxUtils::strCheck($this->plxRecord_coms->f('author')) . '</dc:creator>' . "\n";
             # Hook plugins
             eval($this->plxPlugins->callHook('plxFeedAdminCommentsXml'));
             $entry .= "\t</item>\n";
         }
     }
     # On affiche le flux
     header('Content-Type: text/xml; charset=' . PLX_CHARSET);
     echo '<?xml version="1.0" encoding="' . PLX_CHARSET . '" ?>' . "\n";
     echo '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">' . "\n";
     echo '<channel>' . "\n";
     echo "\t" . '<title>' . plxUtils::strCheck($title) . '</title>' . "\n";
     echo "\t" . '<description>' . plxUtils::strCheck($this->aConf['description']) . '</description>' . "\n";
     echo "\t" . '<link>' . $link . '</link>' . "\n";
     echo "\t" . '<language>' . $this->aConf['default_lang'] . '</language>' . "\n";
     echo '<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="' . $link_feed . '" />' . "\n";
     $last_updated = plxDate::dateIso2rfc822($last_updated);
     echo "\t" . '<lastBuildDate>' . $last_updated . '</lastBuildDate>' . "\n";
     echo "\t" . '<generator>PluXml</generator>' . "\n";
     echo $entry;
     echo '</channel>' . "\n";
     echo '</rss>';
 }