/** * M�thode qui convertit une date ISO au format humain en tenant compte du formatage pass� en param�tre * * @param date date au format AAAAMMJJ * @param format format de la date de sortie (variable: #minute,#hour,#day,#month,#num_day,#num_month,#num_year(2),#num_year(4)) * @return date date format�e au format humain **/ public static function dateIsoToHum($date, $format = '#day #num_day #month #num_year(4)') { # On decoupe notre date $year4 = substr($date, 0, 4); $year2 = substr($date, 2, 2); $month = substr($date, 5, 2); $day = substr($date, 8, 2); $day_num = @date('w', @mktime(0, 0, 0, $month, $day, $year4)); $hour = substr($date, 11, 2); $minute = substr($date, 14, 2); # On retourne notre date au format humain $format = str_replace('#minute', $minute, $format); $format = str_replace('#hour', $hour, $format); $format = str_replace('#day', plxDate::getCalendar('day', $day_num), $format); $format = str_replace('#month', plxDate::getCalendar('month', $month), $format); $format = str_replace('#num_day', $day, $format); $format = str_replace('#num_month', $month, $format); $format = str_replace('#num_year(2)', $year2, $format); $format = str_replace('#num_year(4)', $year4, $format); return $format; }
if (!isset($plxAdmin->aStats[$id])) { plxMsg::Error(L_STATIC_UNKNOWN_PAGE); header('Location: statiques.php'); exit; } # On récupère le contenu $content = trim($plxAdmin->getFileStatique($id)); $title = $plxAdmin->aStats[$id]['name']; $url = $plxAdmin->aStats[$id]['url']; $active = $plxAdmin->aStats[$id]['active']; $title_htmltag = $plxAdmin->aStats[$id]['title_htmltag']; $meta_description = $plxAdmin->aStats[$id]['meta_description']; $meta_keywords = $plxAdmin->aStats[$id]['meta_keywords']; $template = $plxAdmin->aStats[$id]['template']; $date_creation = plxDate::date2Array($plxAdmin->aStats[$id]['date_creation']); $date_update = plxDate::date2Array($plxAdmin->aStats[$id]['date_update']); } else { # Sinon, on redirige header('Location: statiques.php'); exit; } # On récupère les templates des pages statiques $aTemplates = array(); $files = plxGlob::getInstance(PLX_ROOT . $plxAdmin->aConf['racine_themes'] . $plxAdmin->aConf['style']); if ($array = $files->query('/^static(-[a-z0-9-_]+)?.php$/')) { foreach ($array as $k => $v) { $aTemplates[$v] = $v; } } if (empty($aTemplates)) { $aTemplates[''] = L_NONE1;
} } else { $libCats = L_UNCLASSIFIED; } } # en attente de validation ? $idArt = $plxAdmin->plxRecord_arts->f('numero'); $awaiting = $idArt[0] == '_' ? ' - <strong>' . L_AWAITING . '</strong>' : ''; # Commentaires $nbComsToValidate = $plxAdmin->getNbCommentaires('/^_' . $idArt . '.(.*).xml$/', 'all'); $nbComsValidated = $plxAdmin->getNbCommentaires('/^' . $idArt . '.(.*).xml$/', 'all'); # On affiche la ligne echo '<tr>'; echo '<td><input type="checkbox" name="idArt[]" value="' . $idArt . '" /></td>'; echo '<td>' . $idArt . '</td>'; echo '<td>' . plxDate::formatDate($plxAdmin->plxRecord_arts->f('date')) . ' </td>'; echo '<td class="wrap"><a href="article.php?a=' . $idArt . '" title="' . L_ARTICLE_EDIT_TITLE . '">' . plxUtils::strCheck($plxAdmin->plxRecord_arts->f('title')) . '</a>' . $draft . $awaiting . ' </td>'; echo '<td>' . $libCats . ' </td>'; echo '<td><a title="' . L_NEW_COMMENTS_TITLE . '" href="comments.php?sel=offline&a=' . $plxAdmin->plxRecord_arts->f('numero') . '&page=1">' . $nbComsToValidate . '</a> / <a title="' . L_VALIDATED_COMMENTS_TITLE . '" href="comments.php?sel=online&a=' . $plxAdmin->plxRecord_arts->f('numero') . '&page=1">' . $nbComsValidated . '</a> </td>'; echo '<td>' . plxUtils::strCheck($author) . ' </td>'; echo '<td>'; echo '<a href="article.php?a=' . $idArt . '" title="' . L_ARTICLE_EDIT_TITLE . '">' . L_ARTICLE_EDIT . '</a>'; if ($publi and $draft == '') { # Si l'article est publié echo ' | <a href="' . PLX_ROOT . '?article' . intval($idArt) . '/' . $plxAdmin->plxRecord_arts->f('url') . '" title="' . L_ARTICLE_VIEW_TITLE . '">' . L_ARTICLE_VIEW . '</a>'; } echo " </td>"; echo "</tr>"; } } else { # Pas d'article
# On va rechercher notre article if (($aFile = $plxAdmin->plxGlob_arts->query('/^' . $_GET['a'] . '.(.+).xml$/')) == false) { # Article inexistant plxMsg::Error(L_ERR_UNKNOWN_ARTICLE); header('Location: index.php'); exit; } # On parse et alimente nos variables $result = $plxAdmin->parseArticle(PLX_ROOT . $plxAdmin->aConf['racine_articles'] . $aFile['0']); $title = trim($result['title']); $chapo = trim($result['chapo']); $content = trim($result['content']); $tags = trim($result['tags']); $author = $result['author']; $url = $result['url']; $date = plxDate::date2Array($result['date']); $catId = explode(',', $result['categorie']); $artId = $result['numero']; $allow_com = $result['allow_com']; $template = $result['template']; $meta_description = $result['meta_description']; $meta_keywords = $result['meta_keywords']; $title_htmltag = $result['title_htmltag']; if ($author != $_SESSION['user'] and $_SESSION['profil'] == PROFIL_WRITER) { plxMsg::Error(L_ERR_FORBIDDEN_ARTICLE); header('Location: index.php'); exit; } # Hook Plugins eval($plxAdmin->plxPlugins->callHook('AdminArticleParseData')); } else {
/** * Méthode qui affiche la date de la dernière modification du produit selon le format choisi * * @param format format du texte de la date (variable: #minute, #hour, #day, #month, #num_day, #num_month, #num_year(4), #num_year(2)) * @return stdout * @scope product * @author David.L **/ public function productDate($format = '#day #num_day #month #num_year(4)') { # On genere le nom du fichier dont on veux récupérer la date $file = PLX_ROOT . 'data/products/' . $this->productNumber(); $file .= '.' . $this->aProds[$this->productNumber()]['url'] . '.php'; # Test de l'existence du fichier if (!is_file($file)) { return; } # On récupère la date de la dernière modification du fichier qu'on formate echo plxDate::formatDate(date('YmdHi', filemtime($file)), $format); }
/** * Méthode qui affiche le flux atom des commentaires du site pour l'administration * * @return flux sur stdout * @author Florent MONTHEL **/ public function getAdminCommentaires() { # Traitement initial $last_updated = ''; $entry = ''; if ($this->cible == '_') { # Commentaires hors ligne $link = $this->racine . 'core/admin/commentaires_offline.php?page=1'; $title = $this->aConf['title'] . ' - Commentaires hors ligne'; $link_feed = $this->racine . 'feed.php?admin' . $this->clef . '/commentaires/hors-ligne'; } else { # Commentaires en ligne $link = $this->racine . 'core/admin/commentaires_online.php?page=1'; $title = $this->aConf['title'] . ' - Commentaires en ligne'; $link_feed = $this->racine . 'feed.php?admin' . $this->clef . '/commentaires/en-ligne'; } # On va boucler sur les commentaires (si 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') . ' le '; $title_com .= plxDate::dateIsoToHum($this->plxRecord_coms->f('date'), '#day #num_day #month #num_year(4), #hour:#minute'); $link_com = $this->racine . 'core/admin/commentaire.php?c=' . $comId; # On check 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 .= '<entry>' . "\n"; $entry .= "\t" . '<title type="html">' . plxUtils::strCheck($title_com) . '</title> ' . "\n"; $entry .= "\t" . '<link href="' . $link_com . '"/>' . "\n"; $entry .= "\t" . '<id>urn:md5:' . md5($link_com) . '</id>' . "\n"; $entry .= "\t" . '<updated>' . $this->plxRecord_coms->f('date') . '</updated>' . "\n"; $entry .= "\t" . '<author><name>' . plxUtils::strCheck($this->plxRecord_coms->f('author')) . '</name></author>' . "\n"; $entry .= "\t" . '<content type="html">' . plxUtils::strCheck($this->plxRecord_coms->f('content')) . '</content>' . "\n"; $entry .= '</entry>' . "\n"; } } # On affiche le flux header('Content-Type: text/xml; charset=' . PLX_CHARSET); echo '<?xml version="1.0" encoding="' . PLX_CHARSET . '" ?>' . "\n"; echo '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">' . "\n"; echo '<title type="html">' . plxUtils::strCheck($title) . '</title>' . "\n"; echo '<subtitle type="html">' . plxUtils::strCheck($this->aConf['description']) . '</subtitle>' . "\n"; echo '<link href="' . $link_feed . '" rel="self" type="application/atom+xml"/>' . "\n"; echo '<link href="' . $link . '" rel="alternate" type="text/html"/>' . "\n"; echo '<updated>' . $last_updated . '</updated>' . "\n"; echo '<id>urn:md5:' . md5($link) . '</id>' . "\n"; echo '<generator uri="http://pluxml.org/">PluXml ' . $this->version . '</generator>' . "\n"; echo $entry; echo '</feed>'; }
/** * Fonction de conversion de date ISO en format RFC822 * * @param date date à convertir * @return string date au format iso. * @author Amaury GRAILLAT **/ public static function dateIso2rfc822($date) { $tmpDate = plxDate::date2Array($date); return date(DATE_RSS, mktime(substr($tmpDate['time'], 0, 2), substr($tmpDate['time'], 3, 2), 0, $tmpDate['month'], $tmpDate['day'], $tmpDate['year'])); }
/** * Méthode qui effectue une mise a jour d'un commentaire * * @param content données du commentaire à mettre à jour * @param id identifiant du commentaire * @return string * @author Stephane F. et Florent MONTHEL **/ public function editCommentaire($content, &$id) { # Vérification de la validité de la date de publication if (!plxDate::checkDate($content['day'], $content['month'], $content['year'], $content['time'])) { return plxMsg::Error(L_ERR_INVALID_PUBLISHING_DATE); } $comment = array(); # Génération du nom du fichier $comment['filename'] = $id . '.xml'; if (!file_exists(PLX_ROOT . $this->aConf['racine_commentaires'] . $comment['filename'])) { # Commentaire inexistant return plxMsg::Error(L_ERR_UNKNOWN_COMMENT); } # Contrôle des saisies if (trim($content['mail']) != '' and !plxUtils::checkMail(trim($content['mail']))) { return plxMsg::Error(L_ERR_INVALID_EMAIL); } if (trim($content['site']) != '' and !plxUtils::checkSite($content['site'])) { return plxMsg::Error(L_ERR_INVALID_SITE); } # On récupère les infos du commentaire $com = $this->parseCommentaire(PLX_ROOT . $this->aConf['racine_commentaires'] . $comment['filename']); # Formatage des données $comment['author'] = plxUtils::strCheck(trim($content['author'])); $comment['site'] = plxUtils::strCheck(trim($content['site'])); if ($com['type'] != 'admin') { $comment['content'] = plxUtils::strCheck(trim($content['content'])); } else { $comment['content'] = strip_tags(trim($content['content']), '<a>,<strong>'); } $comment['ip'] = $com['ip']; $comment['type'] = $com['type']; $comment['mail'] = $content['mail']; $comment['site'] = $content['site']; $comment['parent'] = $com['parent']; # Génération du nouveau nom du fichier $time = explode(':', $content['time']); $newtimestamp = mktime($time[0], $time[1], 0, $content['month'], $content['day'], $content['year']); $com = $this->comInfoFromFilename($id . '.xml'); $newid = $com['comStatus'] . $com['artId'] . '.' . $newtimestamp . '-' . $com['comIdx']; $comment['filename'] = $newid . '.xml'; # Suppression de l'ancien commentaire $this->delCommentaire($id); # Création du nouveau commentaire $id = $newid; if ($this->addCommentaire($comment)) { return plxMsg::Info(L_COMMENT_SAVE_SUCCESSFUL); } else { return plxMsg::Error(L_COMMENT_UPDATE_ERR); } }
<?php include dirname(__FILE__) . '/header.php'; ?> <section class="archives"> <div id="container"> <div class="width-sidebar"> <p class="directory"> <strong><?php echo plxDate::formatDate($plxShow->plxMotor->cible, $plxShow->lang('ARCHIVES') . ": " . ' #month #num_year(4)'); ?> </strong> </p> <?php while ($plxShow->plxMotor->plxRecord_arts->loop()) { ?> <article role="article" id="post-<?php echo $plxShow->artId(); ?> "> <header> <h1> <?php $plxShow->artTitle('link');
/** * Méthode qui affiche la liste des archives * * @param format format du texte pour l'affichage (variable : #archives_id, #archives_status, #archives_nbart, #archives_url, #archives_name, #archives_month, #archives_year) * @return stdout * @scope global * @author Stephane F **/ public function archList($format = '<li id="#archives_id"><a class="#archives_status" href="#archives_url" title="#archives_name">#archives_name</a></li>') { # Hook Plugins if (eval($this->plxMotor->plxPlugins->callHook('plxShowArchList'))) { return; } $curYear = date('Y'); $array = array(); $plxGlob_arts = clone $this->plxMotor->plxGlob_arts; if ($files = $plxGlob_arts->query('/^[0-9]{4}.(?:[0-9]|home|,)*(?:' . $this->plxMotor->activeCats . '|home)(?:[0-9]|home|,)*.[0-9]{3}.[0-9]{12}.[a-z0-9-]+.xml$/', 'art', 'rsort', 0, false, 'before')) { foreach ($files as $id => $filename) { if (preg_match('/([0-9]{4}).((?:[0-9]|home|,)*(?:' . $this->plxMotor->activeCats . '|home)(?:[0-9]|home|,)*).[0-9]{3}.([0-9]{4})([0-9]{2})([0-9]{6}).([a-z0-9-]+).xml$/', $filename, $capture)) { if ($capture[3] == $curYear) { if (!isset($array[$capture[3]][$capture[4]])) { $array[$capture[3]][$capture[4]] = 1; } else { $array[$capture[3]][$capture[4]]++; } } else { if (!isset($array[$capture[3]])) { $array[$capture[3]] = 1; } else { $array[$capture[3]]++; } } } } krsort($array); # Affichage pour l'année en cours if (isset($array[$curYear])) { foreach ($array[$curYear] as $month => $nbarts) { $name = str_replace('#archives_id', 'archives-' . $curYear . $month, $format); $name = str_replace('#archives_name', plxDate::getCalendar('month', $month) . ' ' . $curYear, $name); $name = str_replace('#archives_year', $curYear, $name); $name = str_replace('#archives_month', plxDate::getCalendar('month', $month), $name); $name = str_replace('#archives_url', $this->plxMotor->urlRewrite('?archives/' . $curYear . '/' . $month), $name); $name = str_replace('#archives_nbart', $nbarts, $name); $name = str_replace('#archives_status', ($this->plxMotor->mode == "archives" and $this->plxMotor->cible == $curYear . $month) ? 'active' : 'noactive', $name); echo $name; } } # Affichage pour les années précédentes unset($array[$curYear]); foreach ($array as $year => $nbarts) { $name = str_replace('#archives_id', 'archives-' . $year, $format); $name = str_replace('#archives_name', $year, $name); $name = str_replace('#archives_year', $year, $name); $name = str_replace('#archives_month', $year, $name); $name = str_replace('#archives_url', $this->plxMotor->urlRewrite('?archives/' . $year), $name); $name = str_replace('#archives_nbart', $nbarts, $name); $name = str_replace('#archives_status', ($this->plxMotor->mode == "archives" and $this->plxMotor->cible == $year) ? 'active' : 'noactive', $name); echo $name; } } }
$coms = $plxAdmin->getCommentaires($comSelMotif, 'rsort', $start, $plxAdmin->aConf['bypage_admin_coms'], 'all'); if ($coms) { $num = 0; while ($plxAdmin->plxRecord_coms->loop()) { # On boucle $artId = $plxAdmin->plxRecord_coms->f('article'); $status = $plxAdmin->plxRecord_coms->f('status'); $id = $status . $artId . '.' . $plxAdmin->plxRecord_coms->f('numero'); $content = nl2br($plxAdmin->plxRecord_coms->f('content')); if ($_SESSION['selCom'] == 'all') { $content = '<strong>' . ($status == '' ? L_COMMENT_ONLINE : L_COMMENT_OFFLINE) . '</strong> - ' . $content; } # On génère notre ligne echo '<tr class="line-' . ++$num % 2 . ' top type-' . $plxAdmin->plxRecord_coms->f('type') . '">'; echo '<td><input type="checkbox" name="idCom[]" value="' . $id . '" /></td>'; echo '<td class="datetime">' . plxDate::formatDate($plxAdmin->plxRecord_coms->f('date')) . ' </td>'; echo '<td class="wrap">' . $content . ' </td>'; echo '<td>' . plxUtils::strCut($plxAdmin->plxRecord_coms->f('author'), 30) . ' </td>'; echo '<td class="action">'; echo '<a href="comment_new.php?c=' . $id . (!empty($_GET['a']) ? '&a=' . $_GET['a'] : '') . '" title="' . L_COMMENT_ANSWER . '">' . L_COMMENT_ANSWER . '</a> '; echo '<a href="comment.php?c=' . $id . (!empty($_GET['a']) ? '&a=' . $_GET['a'] : '') . '" title="' . L_COMMENT_EDIT_TITLE . '">' . L_COMMENT_EDIT . '</a> '; echo '<a href="article.php?a=' . $artId . '" title="' . L_COMMENT_ARTICLE_LINKED_TITLE . '">' . L_COMMENT_ARTICLE_LINKED . '</a>'; echo '</td></tr>'; } } else { # Pas de commentaires echo '<tr><td colspan="5" class="center">' . L_NO_COMMENT . '</td></tr>'; } ?> </tbody> </table>
/** * 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>'; }
$plxRecord_arts = false; $array = array(); foreach ($aFiles as $k => $v) { # On parcourt tous les fichiers $array[$k] = $plxMotor->parseArticle(PLX_ROOT . $plxMotor->aConf['racine_articles'] . $v); } # On stocke les enregistrements dans un objet plxRecord $plxRecord_arts = new plxRecord($array); if ($plxRecord_arts) { # On boucle sur nos articles while ($plxRecord_arts->loop()) { $num = intval($plxRecord_arts->f('numero')); echo "\n"; echo "\t<url>\n"; echo "\t\t<loc>" . $plxMotor->urlRewrite("?article" . $num . "/" . plxUtils::strCheck($plxRecord_arts->f('url'))) . "</loc>\n"; echo "\t\t<lastmod>" . plxDate::formatDate($plxRecord_arts->f('date'), '#num_year(4)-#num_month-#num_day') . "</lastmod>\n"; echo "\t\t<changefreq>monthly</changefreq>\n"; echo "\t\t<priority>0.5</priority>\n"; echo "\t</url>\n"; } } } eval($plxMotor->plxPlugins->callHook('SitemapArticles')); ?> </urlset> <?php # Récuperation de la bufférisation $output = ob_get_clean(); # Hook Plugins eval($plxMotor->plxPlugins->callHook('SitemapEnd')); # Restitution écran
/** * Méthode qui parse le commentaire du fichier $filename * * @param filename fichier du commentaire à parser * @return array * @author Florent MONTHEL **/ public function parseCommentaire($filename) { # Mise en place du parseur XML $data = implode('', file($filename)); $parser = xml_parser_create(PLX_CHARSET); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); xml_parse_into_struct($parser, $data, $values, $iTags); xml_parser_free($parser); # Recuperation des valeurs de nos champs XML $com['author'] = trim($values[$iTags['author'][0]]['value']); $com['type'] = isset($values[$iTags['type'][0]]['value']) ? trim($values[$iTags['type'][0]]['value']) : 'normal'; $com['ip'] = isset($values[$iTags['ip'][0]]['value']) ? trim($values[$iTags['ip'][0]]['value']) : ''; $com['mail'] = isset($values[$iTags['mail'][0]]['value']) ? trim($values[$iTags['mail'][0]]['value']) : ''; $com['site'] = isset($values[$iTags['site'][0]]['value']) ? trim($values[$iTags['site'][0]]['value']) : ''; $com['content'] = trim($values[$iTags['content'][0]]['value']); # Informations obtenues en analysant le nom du fichier $tmp = $this->comInfoFromFilename($filename); $com['numero'] = $tmp['comId']; $com['article'] = $tmp['artId']; $com['date'] = plxDate::timestampToIso($tmp['comDate'], $this->aConf['delta']); # On retourne le tableau return $com; }
} echo '</td>'; echo '<td>'; echo '<a onclick="this.target=\'_blank\';return true;" title="' . plxUtils::strCheck($v['name']) . '" href="' . $v['path'] . '">' . plxUtils::strCheck($v['name']) . '</a><br />'; if ($isImage and is_file(plxUtils::thumbName($v['path']))) { echo '<a onclick="this.target=\'_blank\';return true;" title="' . L_MEDIAS_THUMB . ' : ' . plxUtils::strCheck($v['name']) . '" href="' . plxUtils::thumbName($v['path']) . '">' . L_MEDIAS_THUMB . '</a> : ' . $v['thumb']['infos'][0] . ' x ' . $v['thumb']['infos'][1] . ' (' . plxUtils::formatFilesize($v['thumb']['filesize']) . ')'; } echo '</td>'; echo '<td>' . strtoupper($v['extension']) . '</td>'; echo '<td>' . plxUtils::formatFilesize($v['filesize']) . '</td>'; $dimensions = ' '; if ($isImage and (isset($v['infos']) and isset($v['infos'][0]) and isset($v['infos'][1]))) { $dimensions = $v['infos'][0] . ' x ' . $v['infos'][1]; } echo '<td>' . $dimensions . '</td>'; echo '<td>' . plxDate::formatDate(plxDate::timestamp2Date($v['date'])) . '</td>'; echo '</tr>'; } } else { echo '<tr><td colspan="7" class="center">' . L_MEDIAS_NO_FILE . '</td></tr>'; } ?> </tbody> </table> </div> </div> </form> <form action="medias.php" method="post" id="form_uploader" class="form_uploader" enctype="multipart/form-data"> <div id="files_uploader" style="display:none">
/** * Méthode qui retourne les informations $output en analysant * le nom du fichier du commentaire $filename * * @param filename fichier du commentaire à traiter * @return array information à récupérer * @author Stephane F **/ public function comInfoFromFilename($filename) { # On effectue notre capture d'informations if (preg_match('/([[:punct:]]?)([0-9]{4}).([0-9]{10})-([0-9]+).xml$/', $filename, $capture)) { return array('comStatus' => $capture[1], 'artId' => $capture[2], 'comDate' => plxDate::timestamp2Date($capture[3]), 'comId' => $capture[3] . '-' . $capture[4], 'comIdx' => $capture[4]); } return false; }
$art = $plxMotor->parseArticle(PLX_ROOT . $plxMotor->aConf['racine_articles'] . $v); $tags = implode(" ", array_map("trim", explode(',', strtolower($art['tags'])))); $searchstring = strtolower(plxUtils::strRevCheck($art['title'] . $art['chapo'] . $art['content']) . $tags); $searchstring = plxUtils::unSlash($searchstring); $searchok = false; foreach ($searchwords as $word) { if (strpos($searchstring, $word) !== false) { $searchok = true; } } if ($searchok) { $searchresults = true; $art_num = intval($art['numero']); $art_url = $art['url']; $art_title = plxUtils::strCheck($art['title']); $art_date = plxDate::formatDate($art['date'], $format_date); echo '<li>' . $art_date . ': <a href="' . $plxMotor->urlRewrite('?article' . $art_num . '/' . $art_url) . '">' . $art_title . '</a></li>'; } } } # recherche dans les pages statiques if ($plxMotor->aStats) { foreach ($plxMotor->aStats as $k => $v) { if ($v['active'] == 1 and $v['url'] != $plxMotor->mode) { # si la page est bien active $filename = PLX_ROOT . $plxMotor->aConf['racine_statiques'] . $k . '.' . $v['url'] . '.php'; if (file_exists($filename)) { $searchstring = strtolower(plxUtils::strRevCheck(file_get_contents($filename))); $searchstring = plxUtils::unSlash($searchstring); $searchok = false; foreach ($searchwords as $word) {
?> <div class="comment type-<?php echo $plxAdmin->plxRecord_coms->f('type'); echo $_GET['c'] == $comId ? ' current' : ''; ?> " id="c<?php echo $plxAdmin->plxRecord_coms->f('numero'); ?> "> <div class="info_comment"> <p>Par <strong><?php echo $plxAdmin->plxRecord_coms->f('author'); ?> </strong> le <?php echo plxDate::dateIsoToHum($plxAdmin->plxRecord_coms->f('date'), '#day #num_day #month #num_year(4) à #hour:#minute'); ?> - <a href="commentaire.php<?php echo !empty($_GET['a']) ? '?c=' . $comId . '&a=' . $_GET['a'] : '?c=' . $comId; ?> " title="Éditer ce commentaire">éditer</a> - <a href="javascript:answerCom('content','<?php echo $plxAdmin->plxRecord_coms->f('numero'); ?> ','<?php echo plxUtils::strCheck($plxAdmin->plxRecord_coms->f('author')); ?> ');" title="RÉpondre à ce commentaire">répondre</a> </p> </div> <blockquote><p><?php
# On va rechercher notre article if (($aFile = $plxAdmin->plxGlob_arts->query('/^' . $_GET['a'] . '.(.+).xml$/', '', 'sort', 0, 1)) == false) { # Article inexistant plxMsg::Error('L\'article demandé n\'existe pas ou n\'existe plus !'); header('Location: index.php'); exit; } # On parse et alimente nos variables $result = $plxAdmin->parseArticle(PLX_ROOT . $plxAdmin->aConf['racine_articles'] . $aFile['0']); $title = trim($result['title']); $chapo = trim($result['chapo']); $content = trim($result['content']); $tags = trim($result['tags']); $author = $result['author']; $url = $result['url']; $date = plxDate::dateIso2Admin($result['date']); $catId = explode(',', $result['categorie']); $artId = $result['numero']; $allow_com = $result['allow_com']; $template = $result['template']; if ($author != $_SESSION['user'] and $_SESSION['profil'] == PROFIL_WRITER) { plxMsg::Error('Vous n\'avez pas les droits pour accéder à cet article !'); header('Location: index.php'); exit; } } else { # On a rien validé, c'est pour la création d'un article $title = 'Nouvel article'; $chapo = $url = ''; $content = ''; $tags = '';
</tr> </thead> <tbody> <?php # On va lister les articles if ($plxAdmin->plxGlob_arts->count and $plxAdmin->plxRecord_arts->size) { # On a des articles while ($plxAdmin->plxRecord_arts->loop()) { # Pour chaque article $author = $plxAdmin->aUsers[$plxAdmin->plxRecord_arts->f('author')]['name']; # Date $year = substr($plxAdmin->plxRecord_arts->f('date'), 0, 4); $month = substr($plxAdmin->plxRecord_arts->f('date'), 5, 2); $day = substr($plxAdmin->plxRecord_arts->f('date'), 8, 2); $publi = $plxAdmin->plxRecord_arts->f('date') > plxDate::timestampToIso(time(), $plxAdmin->aConf['delta']) ? false : true; # Catégories : liste des libellelés toutes les categories $draft = ''; $libCats = ''; $catIds = explode(',', $plxAdmin->plxRecord_arts->f('categorie')); if (sizeof($catIds) > 0) { $catsName = array(); foreach ($catIds as $catId) { if ($catId == 'home') { $catsName[] = 'Accueil'; } elseif ($catId == 'draft') { $draft = ' - <strong>Brouillon</strong>'; } elseif (!isset($plxAdmin->aCats[$catId])) { $catsName[] = 'Non classé'; } else { $catsName[] = plxUtils::strCheck($plxAdmin->aCats[$catId]['name']);
# On génère notre lien $article = '<a href="' . $plxAdmin->aConf['racine'] . 'index.php?article' . intval($result['numero']) . '/' . $result['url'] . '" title="' . L_COMMENT_ARTICLE_LINKED_TITLE . '">'; $article .= plxUtils::strCheck($result['title']); $article .= '</a>'; } # Statut du commentaire $com = $plxAdmin->comInfoFromFilename($_GET['c'] . '.xml'); if ($com['comStatus'] == '_') { $statut = '<strong>' . L_COMMENT_OFFLINE . '</strong>'; } elseif ($com['comStatus'] == '') { $statut = '<a href="' . PLX_ROOT . '?article' . intval($plxAdmin->plxRecord_coms->f('article')) . '/#c' . $plxAdmin->plxRecord_coms->f('index') . '" title="' . L_COMMENT_ONLINE_TITLE . '">' . L_COMMENT_ONLINE . '</a>'; } else { $statut = ''; } # Date du commentaire $date = plxDate::date2Array($plxAdmin->plxRecord_coms->f('date')); # On inclut le header include dirname(__FILE__) . '/top.php'; ?> <form action="comment.php<?php echo !empty($_GET['a']) ? '?a=' . plxUtils::strCheck($_GET['a']) : ''; ?> " method="post" id="form_comment"> <div class="inline-form action-bar"> <h2><?php echo L_COMMENT_EDITING; ?> </h2> <?php