blog->delJunkComments(); $_SESSION['comments_del_spam'] = true; http::redirect($core->adminurl->get("admin.comments")); } catch (Exception $e) { $core->error->add($e->getMessage()); } } # Creating filter combo boxes # Filter form we'll put in html_block $status_combo = array_merge( array('-' => ''), dcAdminCombos::getCommentStatusescombo() ); $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']) ? max(1,(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; } else { $author=''; } # - Type filter if ($type == 'tb' || $type == 'co') { $params['comment_trackback'] = ($type == 'tb'); $show_filters = true; } else { $type=''; } # - Status filter if ($status !== '' && in_array($status,$status_combo)) { $params['comment_status'] = $status; $show_filters = true; } elseif (!$with_spam) { $params['comment_status_not'] = -2; $status=''; } else { $status=''; } # - 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; } else { $order = 'desc'; } if ($sortby != 'comment_dt' || $order != 'desc') { $show_filters = true; } } else { $sortby = 'comment_dt'; $order = 'desc'; } # Actions combo box $combo_action = array(); $default = ''; if ($core->auth->check('delete,contentadmin',$core->blog->id) && $status == -2) { $default = 'delete'; } $comments_actions_page = new dcCommentsActionsPage($core,$core->adminurl->get("admin.comments")); if ($comments_actions_page->process()) { return; } /* 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 -------------------------------------------------------- */ $form_filter_title = __('Show filters and display options'); $starting_script = dcPage::jsLoad('js/_comments.js'); $starting_script .= dcPage::jsLoad('js/filter-controls.js'); $starting_script .= '"; dcPage::open(__('Comments and trackbacks'),$starting_script, dcPage::breadcrumb( array( html::escapeHTML($core->blog->name) => '', __('Comments and trackbacks') => '' )) ); if (!empty($_GET['upd'])) { dcPage::success(__('Selected comments have been successfully updated.')); } elseif (!empty($_GET['del'])) { dcPage::success(__('Selected comments have been successfully deleted.')); } if (!$core->error->flag()) { if (isset($_SESSION['comments_del_spam'])) { dcPage::message(__('Spam comments have been successfully deleted.')); unset($_SESSION['comments_del_spam']); } $spam_count = $core->blog->getComments(array('comment_status'=>-2),true)->f(0); if ($spam_count > 0) { echo '
'; if (!$with_spam || ($status != -2)) { if ($spam_count == 1) { echo '

'.sprintf(__('You have one spam comment.'),''.$spam_count.'').' '. ' -2)).'">'.__('Show it.').'.

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

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

'; } } echo '

'. $core->formNonce(). '

'; # --BEHAVIOR-- adminCommentsSpamForm $core->callBehavior('adminCommentsSpamForm',$core); echo '
'; } echo '
'. ''. '
'. '
'. '

'.__('Filters').'

'. '

'. form::combo('type',$type_combo,$type).'

'. '

'. form::combo('status',$status_combo,$status).'

'. '
'. '
'. '

'. form::field('author',20,255,html::escapeHTML($author)).'

'. '

'. form::field('ip',20,39,html::escapeHTML($ip)).'

'. '
'. '
'. '

'.__('Display options').'

'. '

'. form::combo('sortby',$sortby_combo,$sortby).'

'. '

'. form::combo('order',$order_combo,$order).'

'. '

Afficher

'. '
'. '
'. '

'. '

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

'. '

'. form::combo('action',$comments_actions_page->getCombo(),$default,'','','','title="'.__('Actions').'"'). $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). '
'. '
', $show_filters ); } dcPage::helpBlock('core_comments'); dcPage::close();