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 ?>

getPage(); $start = $plxAdmin->aConf['bypage_admin_coms']*($plxAdmin->page-1); $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 = $content.' - '.($status==''?L_COMMENT_ONLINE:L_COMMENT_OFFLINE).'
'; } # On génère notre ligne echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } } else { # Pas de commentaires echo ''; } ?>
'.plxDate::formatDate($plxAdmin->plxRecord_coms->f('date')).' '.$content.' '.plxUtils::strCut($plxAdmin->plxRecord_coms->f('author'),30).' '; echo ''.L_COMMENT_ANSWER.' | '; echo ''.L_COMMENT_EDIT.' | '; echo ''.L_COMMENT_ARTICLE_LINKED.''; echo '
'.L_NO_COMMENT.'

aConf['clef'])) : ?>

:

plxPlugins->callHook('AdminCommentsFoot')); # On inclut le footer include(dirname(__FILE__).'/foot.php'); ?>