Esempio n. 1
0
#
# -- END LICENSE BLOCK -----------------------------------------
require dirname(__FILE__) . '/../inc/admin/prepend.php';
dcPage::check('usage,contentadmin');
if (!empty($_POST['delete_all_spam'])) {
    try {
        $core->blog->delJunkComments();
        $_SESSION['comments_del_spam'] = true;
        $core->adminurl->redirect("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, (int) $_GET['page']) : 1;
$nb_per_page = 30;
Esempio n. 2
0
# -- END LICENSE BLOCK -----------------------------------------
require dirname(__FILE__) . '/../inc/admin/prepend.php';
dcPage::check('usage,contentadmin');
$comment_id = null;
$comment_dt = '';
$comment_author = '';
$comment_email = '';
$comment_site = '';
$comment_content = '';
$comment_ip = '';
$comment_status = '';
$comment_trackback = 0;
$comment_spam_status = '';
$comment_editor = $core->auth->getOption('editor');
# Status combo
$status_combo = dcAdminCombos::getCommentStatusescombo();
# Adding comment
if (!empty($_POST['add']) && !empty($_POST['post_id'])) {
    try {
        $rs = $core->blog->getPosts(array('post_id' => $_POST['post_id'], 'post_type' => ''));
        if ($rs->isEmpty()) {
            throw new Exception(__('Entry does not exist.'));
        }
        $cur = $core->con->openCursor($core->prefix . 'comment');
        $cur->comment_author = $_POST['comment_author'];
        $cur->comment_email = html::clean($_POST['comment_email']);
        $cur->comment_site = html::clean($_POST['comment_site']);
        $cur->comment_content = $core->HTMLfilter($_POST['comment_content']);
        $cur->post_id = (int) $_POST['post_id'];
        # --BEHAVIOR-- adminBeforeCommentCreate
        $core->callBehavior('adminBeforeCommentCreate', $cur);