diff --git a/src/config.php b/src/config.php
new file mode 100644
index 0000000..6344ccc
--- /dev/null
+++ b/src/config.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/src/core/.htaccess b/src/core/.htaccess
new file mode 100644
index 0000000..45552cb
--- /dev/null
+++ b/src/core/.htaccess
@@ -0,0 +1 @@
+Options -Indexes
\ No newline at end of file
diff --git a/src/core/admin/article.php b/src/core/admin/article.php
new file mode 100644
index 0000000..85d92fa
--- /dev/null
+++ b/src/core/admin/article.php
@@ -0,0 +1,426 @@
+plxPlugins->callHook('AdminArticlePrepend'));
+
+# validation de l'id de l'article si passé en parametre
+if(isset($_GET['a']) AND !preg_match('/^_?[0-9]{4}$/',$_GET['a'])) {
+ plxMsg::Error(L_ERR_UNKNOWN_ARTICLE); # Article inexistant
+ header('Location: index.php');
+ exit;
+}
+
+# Formulaire validé
+if(!empty($_POST)) { # Création, mise à jour, suppression ou aperçu
+
+ if(!isset($_POST['catId'])) $_POST['catId']=array();
+ # Titre par défaut si titre vide
+ if(trim($_POST['title'])=='') $_POST['title'] = L_DEFAULT_NEW_ARTICLE_TITLE;
+ # Si demande d'enregistrement en brouillon on ajoute la categorie draft à la liste et on retire la demande de validation
+ if(isset($_POST['draft']) AND !in_array('draft',$_POST['catId'])) array_unshift($_POST['catId'], 'draft');
+ # si aucune catégorie sélectionnée on place l'article dans la catégorie "non classé"
+ if(sizeof($_POST['catId'])==1 AND $_POST['catId'][0]=='draft') $_POST['catId'][]='000';
+ else $_POST['catId'] = array_filter($_POST['catId'], create_function('$a', 'return $a!="000";'));
+ # Si demande de publication ou demande de validation, on supprime la catégorie draft si elle existe
+ if((isset($_POST['update']) OR isset($_POST['publish']) OR isset($_POST['moderate'])) AND isset($_POST['catId'])) $_POST['catId'] = array_filter($_POST['catId'], create_function('$a', 'return $a!="draft";'));
+ # Si profil PROFIL_WRITER on vérifie l'id du rédacteur connecté et celui de l'article
+ if($_SESSION['profil']==PROFIL_WRITER AND isset($_POST['author']) AND $_SESSION['user']!=$_POST['author']) $_POST['author']=$_SESSION['user'];
+ # Si profil PROFIL_WRITER on vérifie que l'article n'est pas celui d'un autre utilisateur
+ if($_SESSION['profil']==PROFIL_WRITER AND isset($_POST['artId']) AND $_POST['artId']!='0000') {
+ # On valide l'article
+ if(($aFile = $plxAdmin->plxGlob_arts->query('/^'.$_POST['artId'].'.([home[draft|0-9,]*).'.$_SESSION['user'].'.(.+).xml$/')) == false) { # Article inexistant
+ plxMsg::Error(L_ERR_UNKNOWN_ARTICLE);
+ header('Location: index.php');
+ exit;
+ }
+ }
+ # Previsualisation d'un article
+ if(!empty($_POST['preview'])) {
+ $art=array();
+ $art['title'] = trim($_POST['title']);
+ $art['allow_com'] = $_POST['allow_com'];
+ $art['template'] = basename($_POST['template']);
+ $art['chapo'] = trim($_POST['chapo']);
+ $art['content'] = trim($_POST['content']);
+ $art['tags'] = trim($_POST['tags']);
+ $art['meta_description'] = $_POST['meta_description'];
+ $art['meta_keywords'] = $_POST['meta_keywords'];
+ $art['title_htmltag'] = $_POST['title_htmltag'];
+ $art['filename'] = '';
+ $art['numero'] = $_POST['artId'];
+ $art['author'] = $_POST['author'];
+ $art['categorie'] = '';
+ if(!empty($_POST['catId'])) {
+ $array=array();
+ foreach($_POST['catId'] as $k => $v) {
+ if($v!='draft') $array[]=$v;
+ }
+ $art['categorie']=implode(',',$array);
+ }
+ $art['date'] = $_POST['year'].$_POST['month'].$_POST['day'].substr(str_replace(':','',$_POST['time']),0,4);
+ $art['nb_com'] = 0;
+ if(trim($_POST['url']) == '')
+ $art['url'] = plxUtils::title2url($_POST['title']);
+ else
+ $art['url'] = plxUtils::title2url($_POST['url']);
+ if($art['url'] == '') $art['url'] = L_DEFAULT_NEW_ARTICLE_URL;
+
+ # Hook Plugins
+ eval($plxAdmin->plxPlugins->callHook('AdminArticlePreview'));
+
+ $article[0] = $art;
+ $_SESSION['preview'] = $article;
+ header('Location: '.PLX_ROOT.'index.php?preview');
+ exit;
+ }
+ # Suppression d'un article
+ if(isset($_POST['delete'])) {
+ $plxAdmin->delArticle($_POST['artId']);
+ header('Location: index.php');
+ exit;
+ }
+ # Mode création ou maj
+ if(isset($_POST['update']) OR isset($_POST['publish']) OR isset($_POST['moderate']) OR isset($_POST['draft'])) {
+
+ $valid = true;
+ # Vérification de l'unicité de l'url
+ $_POST['url'] = plxUtils::title2url(trim($_POST['url'])==''?$_POST['title']:$_POST['url']);
+ foreach($plxAdmin->plxGlob_arts->aFiles as $numart => $filename) {
+ if(preg_match("/^_?[0-9]{4}.([0-9,|home|draft]*).[0-9]{3}.[0-9]{12}.".$_POST["url"].".xml$/", $filename)) {
+ if($numart!=str_replace('_', '',$_POST['artId'])) {
+ $valid = plxMsg::Error(L_ERR_URL_ALREADY_EXISTS." : ".plxUtils::strCheck($_POST["url"])) AND $valid;
+ }
+ }
+ }
+ # Vérification de la validité de la date de publication
+ if(!plxDate::checkDate($_POST['day'],$_POST['month'],$_POST['year'],$_POST['time'])) {
+ $valid = plxMsg::Error(L_ERR_INVALID_PUBLISHING_DATE) AND $valid;
+ }
+ if($valid) {
+ $plxAdmin->editArticle($_POST,$_POST['artId']);
+ header('Location: article.php?a='.$_POST['artId']);
+ exit;
+ }
+
+ }
+ # Ajout d'une catégorie
+ if(isset($_POST['new_category'])) {
+ # Ajout de la nouvelle catégorie
+ $plxAdmin->editCategories($_POST);
+ # On recharge la nouvelle liste
+ $plxAdmin->getCategories(path('XMLFILE_CATEGORIES'));
+ $_GET['a']=$_POST['artId'];
+ }
+ # Alimentation des variables
+ $artId = $_POST['artId'];
+ $title = trim($_POST['title']);
+ $author = $_POST['author'];
+ $catId = isset($_POST['catId'])?$_POST['catId']:array();
+ $date['day'] = $_POST['day'];
+ $date['month'] = $_POST['month'];
+ $date['year'] = $_POST['year'];
+ $date['time'] = $_POST['time'];
+ $chapo = trim($_POST['chapo']);
+ $content = trim($_POST['content']);
+ $tags = trim($_POST['tags']);
+ $url = $_POST['url'];
+ $allow_com = $_POST['allow_com'];
+ $template = $_POST['template'];
+ $meta_description = $_POST['meta_description'];
+ $meta_keywords = $_POST['meta_keywords'];
+ $title_htmltag = $_POST['title_htmltag'];
+ # Hook Plugins
+ eval($plxAdmin->plxPlugins->callHook('AdminArticlePostData'));
+} elseif(!empty($_GET['a'])) { # On n'a rien validé, c'est pour l'édition d'un 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 { # On a rien validé, c'est pour la création d'un article
+ $title = plxUtils::strRevCheck(L_DEFAULT_NEW_ARTICLE_TITLE);
+ $chapo = $url = '';
+ $content = '';
+ $tags = '';
+ $author = $_SESSION['user'];
+ $date = array ('year' => date('Y'),'month' => date('m'),'day' => date('d'),'time' => date('H:i'));
+ $catId = array('draft');
+ $artId = '0000';
+ $allow_com = $plxAdmin->aConf['allow_com'];
+ $template = 'article.php';
+ $meta_description=$meta_keywords=$title_htmltag='';
+ # Hook Plugins
+ eval($plxAdmin->plxPlugins->callHook('AdminArticleInitData'));
+}
+
+# On inclut le header
+include(dirname(__FILE__).'/top.php');
+
+# On construit la liste des utilisateurs
+foreach($plxAdmin->aUsers as $_userid => $_user) {
+ if($_user['active'] AND !$_user['delete'] ) {
+ if($_user['profil']==PROFIL_ADMIN)
+ $_users[L_PROFIL_ADMIN][$_userid] = plxUtils::strCheck($_user['name']);
+ elseif($_user['profil']==PROFIL_MANAGER)
+ $_users[L_PROFIL_MANAGER][$_userid] = plxUtils::strCheck($_user['name']);
+ elseif($_user['profil']==PROFIL_MODERATOR)
+ $_users[L_PROFIL_MODERATOR][$_userid] = plxUtils::strCheck($_user['name']);
+ elseif($_user['profil']==PROFIL_EDITOR)
+ $_users[L_PROFIL_EDITOR][$_userid] = plxUtils::strCheck($_user['name']);
+ else
+ $_users[L_PROFIL_WRITER][$_userid] = plxUtils::strCheck($_user['name']);
+ }
+}
+
+# On récupère les templates des articles
+$files = plxGlob::getInstance(PLX_ROOT.$plxAdmin->aConf['racine_themes'].$plxAdmin->aConf['style']);
+if ($array = $files->query('/^article(-[a-z0-9-_]+)?.php$/')) {
+ foreach($array as $k=>$v)
+ $aTemplates[$v] = $v;
+}
+$cat_id='000';
+?>
+
+
+plxPlugins->callHook('AdminArticleFoot'));
+# On inclut le footer
+include(dirname(__FILE__).'/foot.php');
+?>
diff --git a/src/core/admin/auth.php b/src/core/admin/auth.php
new file mode 100644
index 0000000..17c0ad2
--- /dev/null
+++ b/src/core/admin/auth.php
@@ -0,0 +1,116 @@
+plxPlugins->callHook('AdminAuthPrepend'));
+
+# Initialisation variable erreur
+$error = '';
+$msg = '';
+
+# Control et filtrage du parametre $_GET['p']
+$redirect=$plxAdmin->aConf['racine'].'core/admin/';
+if(!empty($_GET['p'])) {
+ $racine = parse_url($plxAdmin->aConf['racine']);
+ $get_p = parse_url(urldecode($_GET['p']));
+ $error = (!$get_p OR (isset($get_p['host']) AND $racine['host']!=$get_p['host']));
+ if(!$error AND !empty($get_p['path']) AND file_exists(PLX_ROOT.'core/admin/'.basename($get_p['path']))) {
+ # filtrage des parametres de l'url
+ $query='';
+ if(isset($get_p['query'])) {
+ $query=strtok($get_p['query'],'=');
+ $query=($query[0]!='d'?'?'.$get_p['query']:'');
+ }
+ # url de redirection
+ $redirect=$get_p['path'].$query;
+ }
+}
+
+# Déconnexion
+if(!empty($_GET['d']) AND $_GET['d']==1) {
+
+ $_SESSION = array();
+ session_destroy();
+ header('Location: auth.php');
+ exit;
+
+ $formtoken = $_SESSION['formtoken']; # sauvegarde du token du formulaire
+ $_SESSION = array();
+ session_destroy();
+ session_start();
+ $msg = L_LOGOUT_SUCCESSFUL;
+ $_GET['p']='';
+ $_SESSION['formtoken']=$formtoken; # restauration du token du formulaire
+ unset($formtoken);
+}
+
+# Authentification
+if(!empty($_POST['login']) AND !empty($_POST['password'])) {
+ $connected = false;
+ foreach($plxAdmin->aUsers as $userid => $user) {
+ if ($_POST['login']==$user['login'] AND sha1($user['salt'].md5($_POST['password']))==$user['password'] AND $user['active'] AND !$user['delete']) {
+ $_SESSION['user'] = $userid;
+ $_SESSION['profil'] = $user['profil'];
+ $_SESSION['hash'] = plxUtils::charAleatoire(10);
+ $_SESSION['domain'] = $session_domain;
+ $_SESSION['lang'] = $user['lang'];
+ $connected = true;
+ }
+ }
+ if($connected) {
+ header('Location: '.htmlentities($redirect));
+ exit;
+ } else {
+ $msg = L_ERR_WRONG_PASSWORD;
+ $error = 'error';
+ }
+}
+plxUtils::cleanHeaders();
+?>
+
+
+
+
+ PluXml -
+
+
+
+ plxPlugins->callHook('AdminAuthEndHead')) ?>
+
+
+
+
+ plxPlugins->callHook('AdminAuthTop')) ?>
+
+
|
+
+plxPlugins->callHook('AdminAuthEndBody')) ?>
+
+
\ No newline at end of file
diff --git a/src/core/admin/categorie.php b/src/core/admin/categorie.php
new file mode 100644
index 0000000..3ec2c38
--- /dev/null
+++ b/src/core/admin/categorie.php
@@ -0,0 +1,84 @@
+plxPlugins->callHook('AdminCategoryPrepend'));
+
+# Control de l'accès à la page en fonction du profil de l'utilisateur connecté
+$plxAdmin->checkProfil(PROFIL_ADMIN, PROFIL_MANAGER, PROFIL_MODERATOR, PROFIL_EDITOR);
+
+# On édite la catégorie
+if(!empty($_POST) AND isset($plxAdmin->aCats[ $_POST['id'] ])) {
+ $plxAdmin->editCategorie($_POST);
+ header('Location: categorie.php?p='.$_POST['id']);
+ exit;
+}
+elseif(!empty($_GET['p'])) { # On vérifie l'existence de la catégorie
+ $id = plxUtils::strCheck($_GET['p']);
+ if(!isset($plxAdmin->aCats[ $id ])) {
+ plxMsg::Error(L_CAT_UNKNOWN);
+ header('Location: categorie.php');
+ exit;
+ }
+} else { # Sinon, on redirige
+ header('Location: categories.php');
+ exit;
+}
+
+# On récupère les templates des categories
+$files = plxGlob::getInstance(PLX_ROOT.$plxAdmin->aConf['racine_themes'].$plxAdmin->aConf['style']);
+if ($array = $files->query('/^categorie(-[a-z0-9-_]+)?.php$/')) {
+ foreach($array as $k=>$v)
+ $aTemplates[$v] = $v;
+}
+
+# On inclut le header
+include(dirname(__FILE__).'/top.php');
+?>
+
+
+
+ "aCats[$id]['name']); ?>"
+
+plxPlugins->callHook('AdminCategoryTop')) # Hook Plugins ?>
+
+
+
+plxPlugins->callHook('AdminCategoryFoot'));
+# On inclut le footer
+include(dirname(__FILE__).'/foot.php');
+?>
\ No newline at end of file
diff --git a/src/core/admin/categories.php b/src/core/admin/categories.php
new file mode 100644
index 0000000..9e6e75f
--- /dev/null
+++ b/src/core/admin/categories.php
@@ -0,0 +1,132 @@
+plxPlugins->callHook('AdminCategoriesPrepend'));
+
+# Control de l'accès à la page en fonction du profil de l'utilisateur connecté
+$plxAdmin->checkProfil(PROFIL_ADMIN, PROFIL_MANAGER, PROFIL_MODERATOR, PROFIL_EDITOR);
+
+# On édite les catégories
+if(!empty($_POST)) {
+ $plxAdmin->editCategories($_POST);
+ header('Location: categories.php');
+ exit;
+}
+
+# Tableau du tri
+$aTri = array('desc'=>L_SORT_DESCENDING_DATE, 'asc'=>L_SORT_ASCENDING_DATE, 'alpha'=>L_SORT_ALPHABETICAL);
+
+# On inclut le header
+include(dirname(__FILE__).'/top.php');
+?>
+
+
+
+plxPlugins->callHook('AdminCategoriesTop')) # Hook Plugins ?>
+
+
+
+plxPlugins->callHook('AdminCategoriesFoot'));
+# On inclut le footer
+include(dirname(__FILE__).'/foot.php');
+?>
diff --git a/src/core/admin/comment.php b/src/core/admin/comment.php
new file mode 100644
index 0000000..699c81d
--- /dev/null
+++ b/src/core/admin/comment.php
@@ -0,0 +1,183 @@
+plxPlugins->callHook('AdminCommentPrepend'));
+
+# Control de l'accès à la page en fonction du profil de l'utilisateur connecté
+$plxAdmin->checkProfil(PROFIL_ADMIN, PROFIL_MANAGER, PROFIL_MODERATOR);
+
+# Interdire de l'accès à la page si les commentaires sont désactivés
+if(!$plxAdmin->aConf['allow_com']) {
+ header('Location: index.php');
+ exit;
+}
+
+# validation de l'id de l'article si passé en parametre
+if(isset($_GET['a']) AND !preg_match('/^_?[0-9]{4}$/',$_GET['a'])) {
+ plxMsg::Error(L_ERR_UNKNOWN_ARTICLE); # Article inexistant
+ header('Location: index.php');
+ exit;
+}
+
+# On édite, supprime ou valide notre commentaire
+if(!empty($_POST) AND !empty($_POST['comId'])) {
+
+ # validation du numero de commentaire
+ if(!preg_match('/[[:punct:]]?[0-9]{4}.[0-9]{10}-[0-9]+$/', $_POST['comId'])) {
+ plxMsg::Error(L_ERR_UNKNOWN_COMMENT);
+ header('Location: comments.php');
+ exit;
+ }
+
+ # Suppression, on redirige
+ if(isset($_POST['delete'])) {
+ $plxAdmin->delCommentaire($_POST['comId']);
+ header('Location: comments.php');
+ exit;
+ }
+ # Commentaire en ligne
+ if(isset($_POST['online'])) {
+ $plxAdmin->editCommentaire($_POST,$_POST['comId']);
+ $plxAdmin->modCommentaire($_POST['comId'],'online');
+ header('Location: comment.php?c='.$_POST['comId'].(!empty($_GET['a'])?'&a='.$_GET['a']:''));
+ exit;
+ }
+ # Commentaire hors-ligne
+ if(isset($_POST['offline'])) {
+ $plxAdmin->editCommentaire($_POST,$_POST['comId']);
+ $plxAdmin->modCommentaire($_POST['comId'],'offline');
+ header('Location: comment.php?c='.$_POST['comId'].(!empty($_GET['a'])?'&a='.$_GET['a']:''));
+ exit;
+ }
+ # Répondre au commentaire
+ if(isset($_POST['answer'])) {
+ header('Location: comment_new.php?c='.$_POST['comId']).(!empty($_GET['a'])?'&a='.$_GET['a']:'');
+ exit;
+ }
+ # Edition
+ $plxAdmin->editCommentaire($_POST,$_POST['comId']);
+ header('Location: comment.php?c='.$_POST['comId'].(!empty($_GET['a'])?'&a='.$_GET['a']:''));
+ exit;
+}
+
+# On va récupérer les infos sur le commentaire
+if(!$plxAdmin->getCommentaires('/^'.plxUtils::nullbyteRemove($_GET['c']).'.xml$/','',0,1,'all')) {
+ # Commentaire inexistant, on redirige
+ plxMsg::Error(L_ERR_UNKNOWN_COMMENT);
+ header('Location: comments.php');
+ exit;
+}
+
+# On va récupérer les infos sur l'article
+$artId = $plxAdmin->plxRecord_coms->f('article');
+# On va rechercher notre article
+if(($aFile = $plxAdmin->plxGlob_arts->query('/^'.$artId.'.(.+).xml$/','','sort',0,1)) == false) {
+ # On indique que le commentaire est attaché à aucun article
+ $article = ''.L_COMMENT_ORPHAN.'';
+ # Statut du commentaire
+ $statut = ''.L_COMMENT_ORPHAN_STATUS.'';
+} else {
+ $result = $plxAdmin->parseArticle(PLX_ROOT.$plxAdmin->aConf['racine_articles'].$aFile['0']);
+ # On génère notre lien
+ $article = '';
+ $article .= plxUtils::strCheck($result['title']);
+ $article .= '';
+}
+
+# Statut du commentaire
+$com=$plxAdmin->comInfoFromFilename($_GET['c'].'.xml');
+if($com['comStatus']=='_')
+ $statut = ''.L_COMMENT_OFFLINE.'';
+elseif($com['comStatus']=='')
+ $statut = ''.L_COMMENT_ONLINE.'';
+else
+ $statut = '';
+
+# Date du commentaire
+$date = plxDate::date2Array($plxAdmin->plxRecord_coms->f('date'));
+
+# On inclut le header
+include(dirname(__FILE__).'/top.php');
+
+?>
+
+
+
+
+
+
+
+
+
+plxPlugins->callHook('AdminCommentTop')) # Hook Plugins ?>
+
+
+ - : plxRecord_coms->f('ip'); ?>
+ - :
+ - : plxRecord_coms->f('type'); ?>
+ - :
+
+
+
+plxPlugins->callHook('AdminCommentFoot'));
+# On inclut le footer
+include(dirname(__FILE__).'/foot.php');
+?>
diff --git a/src/core/admin/comment_new.php b/src/core/admin/comment_new.php
new file mode 100644
index 0000000..bafab7a
--- /dev/null
+++ b/src/core/admin/comment_new.php
@@ -0,0 +1,163 @@
+plxPlugins->callHook('AdminCommentNewPrepend'));
+
+# Control de l'accès à la page en fonction du profil de l'utilisateur connecté
+$plxAdmin->checkProfil(PROFIL_ADMIN, PROFIL_MANAGER, PROFIL_MODERATOR);
+
+# Interdire de l'accès à la page si les commentaires sont désactivés
+if(!$plxAdmin->aConf['allow_com']) {
+ header('Location: index.php');
+ exit;
+}
+
+# validation de l'id de l'article si passé en parametre
+if(isset($_GET['a']) AND !preg_match('/^_?[0-9]{4}$/',$_GET['a'])) {
+ plxMsg::Error(L_ERR_UNKNOWN_ARTICLE); # Article inexistant
+ header('Location: index.php');
+ exit;
+}
+
+# On va checker le mode (répondre ou écrire)
+if(!empty($_GET['c'])) { # Mode "answer"
+ # On check que le commentaire existe et est "online"
+// if(!$plxAdmin->getCommentaires('/^'.plxUtils::nullbyteRemove($_GET['c']).'.xml$/','')) { # Commentaire inexistant
+ if(!$plxAdmin->getCommentaires('/^'.plxUtils::nullbyteRemove($_GET['c']).'.xml$/','',0,1,'all')) {
+ # On redirige
+ plxMsg::Error(L_ERR_ANSWER_UNKNOWN_COMMENT);
+ header('Location: comments.php'.(!empty($_GET['a'])?'?a='.$_GET['a']:''));
+ exit;
+ }
+ # Commentaire offline
+ if(preg_match('/^_/',$_GET['c'])) {
+ # On redirige
+ plxMsg::Error(L_ERR_ANSWER_OFFLINE_COMMENT);
+ header('Location: comments.php'.(!empty($_GET['a'])?'?a='.$_GET['a']:''));
+ exit;
+ }
+ # On va rechercher notre article
+ if(($aFile = $plxAdmin->plxGlob_arts->query('/^'.$plxAdmin->plxRecord_coms->f('article').'.(.+).xml$/','','sort',0,1)) == false) { # Article inexistant
+ plxMsg::Error(L_ERR_COMMENT_UNKNOWN_ARTICLE);
+ header('Location: index.php');
+ exit;
+ }
+ # Variables de traitement
+ $artId = $plxAdmin->plxRecord_coms->f('article');
+ if(!empty($_GET['a'])) $get = 'c='.$_GET['c'].'&a='.$_GET['a'];
+ else $get = 'c='.$_GET['c'];
+ $aArt = $plxAdmin->parseArticle(PLX_ROOT.$plxAdmin->aConf['racine_articles'].$aFile['0']);
+ # Variable du formulaire
+ $content = '@'.$plxAdmin->plxRecord_coms->f('author')." :\n";
+ $article = '';
+ $article .= plxUtils::strCheck($aArt['title']);
+ $article .= '';
+ # Ok, on récupère les commentaires de l'article
+ $plxAdmin->getCommentaires('/^'.str_replace('_','',$artId).'.(.*).xml$/','rsort');
+} elseif(!empty($_GET['a'])) { # Mode "new"
+ # On check l'article si il existe bien
+ if(($aFile = $plxAdmin->plxGlob_arts->query('/^'.$_GET['a'].'.(.+).xml$/','','sort',0,1)) == false) {
+ plxMsg::Error(L_ERR_COMMENT_UNEXISTENT_ARTICLE);
+ header('Location: index.php');
+ exit;
+ }
+ # Variables de traitement
+ $artId = $_GET['a'];
+ $get = 'a='.$_GET['a'];
+ $aArt = $plxAdmin->parseArticle(PLX_ROOT.$plxAdmin->aConf['racine_articles'].$aFile['0']);
+ # Variable du formulaire
+ $content = '';
+ $article = '';
+ $article .= plxUtils::strCheck($aArt['title']);
+ $article .= '';
+ # Ok, on récupère les commentaires de l'article
+ $plxAdmin->getCommentaires('/^'.str_replace('_','',$artId).'.(.*).xml$/','rsort');
+} else { # Mode inconnu
+ header('Location: .index.php');
+ exit;
+}
+
+# On a validé le formulaire
+if(!empty($_POST) AND !empty($_POST['content'])) {
+ # Création du commentaire
+ if(!$plxAdmin->newCommentaire(str_replace('_','',$artId),$_POST['content'])) { # Erreur
+ plxMsg::Error(L_ERR_CREATING_COMMENT);
+ } else { # Ok
+ plxMsg::Info(L_CREATING_COMMENT_SUCCESSFUL);
+ }
+ header('Location: comment_new.php?a='.$artId);
+ exit;
+}
+
+# On inclut le header
+include(dirname(__FILE__).'/top.php');
+?>
+
+
+
+
+
+
+
+
+ «»
+
+plxPlugins->callHook('AdminCommentNewTop')) # Hook Plugins ?>
+
+
+
+
+
+plxRecord_coms)) : # On a des commentaires ?>
+
+
+
+
+plxPlugins->callHook('AdminCommentNewFoot'));
+# On inclut le footer
+include(dirname(__FILE__).'/foot.php');
+?>
diff --git a/src/core/admin/comments.php b/src/core/admin/comments.php
new file mode 100644
index 0000000..f92853a
--- /dev/null
+++ b/src/core/admin/comments.php
@@ -0,0 +1,239 @@
+plxPlugins->callHook('AdminCommentsPrepend'));
+
+# Control de l'accès à la page en fonction du profil de l'utilisateur connecté
+$plxAdmin->checkProfil(PROFIL_ADMIN, PROFIL_MANAGER, PROFIL_MODERATOR);
+
+# Interdire de l'accès à la page si les commentaires sont désactivés
+if(!$plxAdmin->aConf['allow_com']) {
+ header('Location: index.php');
+ exit;
+}
+
+# validation de l'id de l'article si passé en parametre
+if(isset($_GET['a']) AND !preg_match('/^_?[0-9]{4}$/',$_GET['a'])) {
+ plxMsg::Error(L_ERR_UNKNOWN_ARTICLE); # Article inexistant
+ header('Location: index.php');
+ exit;
+}
+
+# Suppression des commentaires selectionnes
+if(isset($_POST['selection']) AND ((!empty($_POST['btn_ok1']) AND $_POST['selection'][0]=='delete') OR (!empty($_POST['btn_ok2']) AND $_POST['selection'][1]=='delete')) AND isset($_POST['idCom'])) {
+ foreach ($_POST['idCom'] as $k => $v) $plxAdmin->delCommentaire($v);
+ header('Location: comments.php'.(!empty($_GET['a'])?'?a='.$_GET['a']:''));
+ exit;
+}
+# Validation des commentaires selectionnes
+elseif(isset($_POST['selection']) AND (!empty($_POST['btn_ok1']) AND ($_POST['selection'][0]=='online') OR (!empty($_POST['btn_ok2']) AND $_POST['selection'][1]=='online')) AND isset($_POST['idCom'])) {
+ foreach ($_POST['idCom'] as $k => $v) $plxAdmin->modCommentaire($v, 'online');
+ header('Location: comments.php'.(!empty($_GET['a'])?'?a='.$_GET['a']:''));
+ exit;
+}
+# Mise hors-ligne des commentaires selectionnes
+elseif (isset($_POST['selection']) AND ((!empty($_POST['btn_ok1']) AND $_POST['selection'][0]=='offline') OR (!empty($_POST['btn_ok2']) AND $_POST['selection'][1]=='offline')) AND isset($_POST['idCom'])) {
+ foreach ($_POST['idCom'] as $k => $v) $plxAdmin->modCommentaire($v, 'offline');
+ header('Location: comments.php'.(!empty($_GET['a'])?'?a='.$_GET['a']:''));
+ exit;
+}
+
+# Récuperation des infos sur l'article attaché au commentaire si passé en paramètre
+if(!empty($_GET['a'])) {
+ # Infos sur notre article
+ if(!$globArt = $plxAdmin->plxGlob_arts->query('/^'.$_GET['a'].'.(.*).xml$/','','sort',0,1)) {
+ plxMsg::Error(L_ERR_UNKNOWN_ARTICLE); # Article inexistant
+ header('Location: index.php');
+ exit;
+ }
+ # Infos sur l'article
+ $aArt = $plxAdmin->parseArticle(PLX_ROOT.$plxAdmin->aConf['racine_articles'].$globArt['0']);
+ $portee = L_COMMENTS_ARTICLE_SCOPE.' «'.$aArt['title'].'»';
+} else { # Commentaires globaux
+ $portee = '';
+}
+
+# On inclut le header
+include(dirname(__FILE__).'/top.php');
+
+# Récuperation du type de commentaire à afficher
+$_GET['sel'] = !empty($_GET['sel']) ? $_GET['sel'] : '';
+if(in_array($_GET['sel'], array('online', 'offline', 'all')))
+ $comSel = plxUtils::nullbyteRemove($_GET['sel']);
+else
+ $comSel = ((isset($_SESSION['selCom']) AND !empty($_SESSION['selCom'])) ? $_SESSION['selCom'] : 'all');
+
+if(!empty($_GET['a'])) {
+ $comSelMotif = '/^[[:punct:]]?'.str_replace('_','',$_GET['a']).'.(.*).xml$/';
+ $_SESSION['selCom'] = 'all';
+ $nbComPagination=$plxAdmin->nbComments($comSelMotif);
+ echo ''.L_COMMENTS_ALL_LIST.'
';
+}
+elseif($comSel=='online') {
+ $comSelMotif = '/^[0-9]{4}.(.*).xml$/';
+ $_SESSION['selCom'] = 'online';
+ $nbComPagination=$plxAdmin->nbComments('online');
+ echo ''.L_COMMENTS_ONLINE_LIST.'
';
+}
+elseif($comSel=='offline') {
+ $comSelMotif = '/^_[0-9]{4}.(.*).xml$/';
+ $_SESSION['selCom'] = 'offline';
+ $nbComPagination=$plxAdmin->nbComments('offline');
+ echo ''.L_COMMENTS_OFFLINE_LIST.'
';
+}
+elseif($comSel=='all') { // all
+ $comSelMotif = '/^[[:punct:]]?[0-9]{4}.(.*).xml$/';
+ $_SESSION['selCom'] = 'all';
+ $nbComPagination=$plxAdmin->nbComments('all');
+ echo ''.L_COMMENTS_ALL_LIST.'
';
+}
+
+if($portee!='') {
+ echo ''.$portee.'
';
+}
+
+$breadcrumbs = array();
+$breadcrumbs[] = ''.L_ALL.' ('.$plxAdmin->nbComments('all').')';
+$breadcrumbs[] = ''.L_COMMENT_ONLINE.' ('.$plxAdmin->nbComments('online').')';
+$breadcrumbs[] = ''.L_COMMENT_OFFLINE.' ('.$plxAdmin->nbComments('offline').')';
+if(!empty($_GET['a'])) {
+ $breadcrumbs[] = ''.L_COMMENT_NEW_COMMENT.'';
+}
+
+function selector($comSel, $id) {
+ ob_start();
+ if($comSel=='online')
+ plxUtils::printSelect('selection[]', array(''=> L_FOR_SELECTION, 'offline' => L_COMMENT_SET_OFFLINE, '-'=>'-----', 'delete' => L_COMMENT_DELETE), '', false,'',$id);
+ elseif($comSel=='offline')
+ plxUtils::printSelect('selection[]', array(''=> L_FOR_SELECTION, 'online' => L_COMMENT_SET_ONLINE, '-'=>'-----', 'delete' => L_COMMENT_DELETE), '', false,'',$id);
+ elseif($comSel=='all')
+ plxUtils::printSelect('selection[]', array(''=> L_FOR_SELECTION, 'online' => L_COMMENT_SET_ONLINE, 'offline' => L_COMMENT_SET_OFFLINE, '-'=>'-----','delete' => L_COMMENT_DELETE), '', false,'',$id);
+ return ob_get_clean();
+}
+
+$selector1=selector($comSel, 'id_selection1');
+$selector2=selector($comSel, 'id_selection2');
+?>
+
+plxPlugins->callHook('AdminCommentsTop')) # Hook Plugins ?>
+
+
+
+
+
+aConf['clef'])) : ?>
+
+
:
+
+ racine.'feed.php?admin'.$plxAdmin->aConf['clef'].'/commentaires/hors-ligne'; ?>
+
+ racine.'feed.php?admin'.$plxAdmin->aConf['clef'].'/commentaires/en-ligne'; ?>
+
+
+
+
+
+plxPlugins->callHook('AdminCommentsFoot'));
+# On inclut le footer
+include(dirname(__FILE__).'/foot.php');
+?>
diff --git a/src/core/admin/foot.php b/src/core/admin/foot.php
new file mode 100644
index 0000000..c8fb341
--- /dev/null
+++ b/src/core/admin/foot.php
@@ -0,0 +1,12 @@
+
+
+
+
+plxPlugins->callHook('AdminFootEndBody')) ?>
+
+
+
+
plxRecord_coms->f('author'); ?> + @ plxRecord_coms->f('date'), '#day #num_day #month #num_year(4) à #hour:#minute'); ?> + - + - +
+