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); # 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') 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') 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') 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); $h2 = '

'.L_COMMENTS_ALL_LIST.'

'; } elseif($comSel=='online') { $comSelMotif = '/^[0-9]{4}.(.*).xml$/'; $_SESSION['selCom'] = 'online'; $nbComPagination=$plxAdmin->nbComments('online'); $h2 = '

'.L_COMMENTS_ONLINE_LIST.'

'; } elseif($comSel=='offline') { $comSelMotif = '/^_[0-9]{4}.(.*).xml$/'; $_SESSION['selCom'] = 'offline'; $nbComPagination=$plxAdmin->nbComments('offline'); $h2 = '

'.L_COMMENTS_OFFLINE_LIST.'

'; } elseif($comSel=='all') { // all $comSelMotif = '/^[[:punct:]]?[0-9]{4}.(.*).xml$/'; $_SESSION['selCom'] = 'all'; $nbComPagination=$plxAdmin->nbComments('all'); $h2 = '

'.L_COMMENTS_ALL_LIST.'

'; } if($portee!='') { $h3 = '

'.$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,'no-margin',$id); elseif($comSel=='offline') plxUtils::printSelect('selection[]', array(''=> L_FOR_SELECTION, 'online' => L_COMMENT_SET_ONLINE, '-'=>'-----', 'delete' => L_COMMENT_DELETE), '', false,'no-margin',$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,'no-margin',$id); return ob_get_clean(); } $selector1=selector($comSel, 'id_selection1'); ?> 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 = ''.($status==''?L_COMMENT_ONLINE:L_COMMENT_OFFLINE).' - '.$content; } # 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.'

    plxPlugins->callHook('AdminCommentsPagination')); # Affichage de la pagination if($coms) { # Si on a des commentaires (hors page) # Calcul des pages $last_page = ceil($nbComPagination/$plxAdmin->aConf['bypage_admin_coms']); if($plxAdmin->page > $last_page) $plxAdmin->page = $last_page; $prev_page = $plxAdmin->page - 1; $next_page = $plxAdmin->page + 1; # Generation des URLs $p_url = 'comments.php?page='.$prev_page.'&sel='.$_SESSION['selCom'].(!empty($_GET['a'])?'&a='.$_GET['a']:''); # Page precedente $n_url = 'comments.php?page='.$next_page.'&sel='.$_SESSION['selCom'].(!empty($_GET['a'])?'&a='.$_GET['a']:''); # Page suivante $l_url = 'comments.php?page='.$last_page.'&sel='.$_SESSION['selCom'].(!empty($_GET['a'])?'&a='.$_GET['a']:''); # Derniere page $f_url = 'comments.php?page=1'.'&sel='.$_SESSION['selCom'].(!empty($_GET['a'])?'&a='.$_GET['a']:''); # Premiere page # On effectue l'affichage if($plxAdmin->page > 2) # Si la page active > 2 on affiche un lien 1ere page echo ''.L_PAGINATION_FIRST.''; if($plxAdmin->page > 1) # Si la page active > 1 on affiche un lien page precedente echo ''.L_PAGINATION_PREVIOUS.''; # Affichage de la page courante printf(''.L_PAGINATION.'',$plxAdmin->page,$last_page); if($plxAdmin->page < $last_page) # Si la page active < derniere page on affiche un lien page suivante echo ''.L_PAGINATION_NEXT.''; if(($plxAdmin->page + 1) < $last_page) # Si la page active++ < derniere page on affiche un lien derniere page echo ''.L_PAGINATION_LAST.''; } ?>

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