'' ); foreach ($core->blog->getAllCommentStatus() as $k => $v) { $status_combo[$v] = (string) $k; } $type_combo = array( '-' => '', __('comment') => 'co', __('trackback') => 'tb' ); $sortby_combo = array( __('Date') => 'comment_dt', __('Entry title') => 'post_title', __('Author') => 'comment_author', __('Status') => 'comment_status' ); $order_combo = array( __('Descending') => 'desc', __('Ascending') => 'asc' ); /* Get comments -------------------------------------------------------- */ $author = isset($_GET['author']) ? $_GET['author'] : ''; $status = isset($_GET['status']) ? $_GET['status'] : ''; $type = !empty($_GET['type']) ? $_GET['type'] : ''; $sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : 'comment_dt'; $order = !empty($_GET['order']) ? $_GET['order'] : 'desc'; $ip = !empty($_GET['ip']) ? $_GET['ip'] : ''; $with_spam = $author || $status || $type || $sortby != 'comment_dt' || $order != 'desc' || $ip; $show_filters = false; $page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1; $nb_per_page = 30; if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) { if ($nb_per_page != $_GET['nb']) { $show_filters = true; } $nb_per_page = (integer) $_GET['nb']; } $params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page); $params['no_content'] = true; # Author filter if ($author !== '') { $params['q_author'] = $author; $show_filters = true; } # - Type filter if ($type == 'tb' || $type == 'co') { $params['comment_trackback'] = ($type == 'tb'); $show_filters = true; } # - Status filter if ($status !== '' && in_array($status,$status_combo)) { $params['comment_status'] = $status; $show_filters = true; } elseif (!$with_spam) { $params['comment_status_not'] = -2; } # - IP filter if ($ip) { $params['comment_ip'] = $ip; $show_filters = true; } # Sortby and order filter if ($sortby !== '' && in_array($sortby,$sortby_combo)) { if ($order !== '' && in_array($order,$order_combo)) { $params['order'] = $sortby.' '.$order; } if ($sortby != 'comment_dt' || $order != 'desc') { $show_filters = true; } } # Actions combo box $combo_action = array(); if ($core->auth->check('publish,contentadmin',$core->blog->id)) { $combo_action[__('publish')] = 'publish'; $combo_action[__('unpublish')] = 'unpublish'; $combo_action[__('mark as pending')] = 'pending'; $combo_action[__('mark as junk')] = 'junk'; } if ($core->auth->check('delete,contentadmin',$core->blog->id)) { $combo_action[__('delete')] = 'delete'; } # --BEHAVIOR-- adminCommentsActionsCombo $core->callBehavior('adminCommentsActionsCombo',array(&$combo_action)); /* Get comments -------------------------------------------------------- */ try { $comments = $core->blog->getComments($params); $counter = $core->blog->getComments($params,true); $comment_list = new adminCommentList($core,$comments,$counter->f(0)); } catch (Exception $e) { $core->error->add($e->getMessage()); } /* DISPLAY -------------------------------------------------------- */ $starting_script = dcPage::jsLoad('js/_comments.js'); if (!$show_filters) { $starting_script .= dcPage::jsLoad('js/filter-controls.js'); } # --BEHAVIOR-- adminCommentsHeaders $starting_script .= $core->callBehavior('adminCommentsHeaders'); dcPage::open(__('Comments and trackbacks'),$starting_script); echo '

'.html::escapeHTML($core->blog->name).' › '.__('Comments and trackbacks').'

'; if (!$core->error->flag()) { # Filters if (!$show_filters) { echo '

'. __('Filters').'

'; } echo '
'. '
'.__('Filters').''. '
'. '
'. ' '. ''. '
'. '
'. '

'. '

'. '

'. '
'. '
'. '

'. '

'. '

'. '
'. '
'. '
'. //Opera sucks '
'. '
'; if (!$with_spam) { $spam_count = $core->blog->getComments(array('comment_status'=>-2),true)->f(0); if ($spam_count == 1) { echo '

'.sprintf(__('You have one spam comments.'),''.$spam_count.'').' '. ''.__('Show it.').'

'; } elseif ($spam_count > 1) { echo '

'.sprintf(__('You have %s spam comments.'),''.$spam_count.'').' '. ''.__('Show them.').'

'; } } # Show comments $comment_list->display($page,$nb_per_page, '
'. '%s'. '
'. '

'. '

'. form::combo('action',$combo_action,'','','','','title="'.__('action: ').'"'). $core->formNonce(). '

'. form::hidden(array('type'),$type). form::hidden(array('sortby'),$sortby). form::hidden(array('order'),$order). form::hidden(array('author'),preg_replace('/%/','%%',$author)). form::hidden(array('status'),$status). form::hidden(array('ip'),preg_replace('/%/','%%',$ip)). form::hidden(array('page'),$page). form::hidden(array('nb'),$nb_per_page). '
'. '
' ); } dcPage::helpBlock('core_comments'); dcPage::close(); ?>