values[0]); $params[$this->request_param]=$val; } } # Creating filter combo boxes # Filter form we'll put in html_block $status_combo = array(); foreach ($core->blog->getAllCommentStatus() as $k => $v) { $status_combo[$v] = (string) $k; } $type_combo = array( __('comment') => '0', __('trackback') => '1' ); $comment_list = new adminCommentList($core); $params = new ArrayObject(); $params['no_content'] = true; # - Limit, sortby and order filter # 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)); $filterSet = new dcFilterSet('comments','comments.php'); $authorFilter = new authorFilter( 'author',__('Author'), __('Author'),'comment_author',20,255); $filterSet ->addFilter(new comboFilter( 'status',__('Status'), __('Status'), 'comment_status', $status_combo)) ->addFilter(new booleanFilter( 'type',__('Type'), __('Type'), 'comment_trackback', $type_combo)) ->addFilter($authorFilter) ->addFilter(new textFilter( 'ip',__('IP address'), __('IP address'), 'comment_ip',20,39)); $core->callBehavior('adminCommentsFilters',$filterSet); $filterSet->setExtra($comment_list); $filterSet->setup($_GET,$_POST); if (isset($_GET['author'])) { $authorFilter->add(); $authorFilter->setValue($_GET['author']); } /* Get comments -------------------------------------------------------- */ try { $nfparams = $params->getArrayCopy(); $filtered = $filterSet->applyFilters($params); $core->callBehavior('adminCommentsParams',$params); $comments = $core->blog->getComments($params); $counter = $core->blog->getComments($params,true); if ($filtered) { $totalcounter = $core->blog->getComments($nfparams,true); $page_title = sprintf(__('Comments and Trackacks / %s filtered out of %s'),$counter->f(0),$totalcounter->f(0)); } else { $page_title = __('Comments and Trackacks'); } $comment_list->setItems($comments,$counter->f(0)); } catch (Exception $e) { $core->error->add($e->getMessage()); } /* DISPLAY -------------------------------------------------------- */ $starting_script = dcPage::jsLoad('js/_comments.js').$filterSet->header(); # --BEHAVIOR-- adminCommentsHeaders $starting_script .= $core->callBehavior('adminCommentsHeaders'); dcPage::open(__('Comments and trackbacks'),$starting_script); 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('' ); } dcPage::helpBlock('core_comments'); dcPage::close(); ?>