Exemplo n.º 1
2
}
if ($allow_list[0] != "all") {
    $join = "LEFT JOIN " . PREFIX . "_post ON " . PREFIX . "_comments.post_id=" . PREFIX . "_post.id ";
    if ($config['allow_multi_category']) {
        $where[] = PREFIX . "_post.category regexp '[[:<:]](" . implode('|', $allow_list) . ")[[:>:]]'";
    } else {
        $where[] = PREFIX . "_post.category IN ('" . implode("','", $allow_list) . "')";
    }
} else {
    $join = "";
}
if ($config['allow_cmod']) {
    $where[] = PREFIX . "_comments.approve=1";
}
if (count($where)) {
    $where = implode(" AND ", $where);
    $where = "WHERE " . $where;
} else {
    $where = "";
}
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_comments " . $join . $where;
$row_count = $db->super_query($sql_count);
if ($row_count['count']) {
    include_once ENGINE_DIR . '/classes/comments.class.php';
    $comments = new DLE_Comments($db, $row_count['count'], intval($config['comm_nummers']));
    $comments->query = "SELECT " . PREFIX . "_comments.id, post_id, " . PREFIX . "_comments.user_id, " . PREFIX . "_comments.date, " . PREFIX . "_comments.autor as gast_name, " . PREFIX . "_comments.email as gast_email, text, ip, is_register, name, " . USERPREFIX . "_users.email, news_num, " . USERPREFIX . "_users.comm_num, user_group, lastdate, reg_date, signature, foto, fullname, land, icq, " . USERPREFIX . "_users.xfields, " . PREFIX . "_post.title, " . PREFIX . "_post.date as newsdate, " . PREFIX . "_post.alt_name, " . PREFIX . "_post.category FROM " . PREFIX . "_comments LEFT JOIN " . PREFIX . "_post ON " . PREFIX . "_comments.post_id=" . PREFIX . "_post.id LEFT JOIN " . USERPREFIX . "_users ON " . PREFIX . "_comments.user_id=" . USERPREFIX . "_users.user_id " . $where . " ORDER BY id desc";
    $comments->build_comments('comments.tpl', 'lastcomments');
    $comments->build_navigation('navigation.tpl', false, $user_query);
} else {
    msgbox($lang['all_info'], $lang['err_last']);
}
Exemplo n.º 2
1
         $where_approve = "";
     }
     $comments->query = "SELECT " . PREFIX . "_comments.id, post_id, " . PREFIX . "_comments.user_id, date, autor as gast_name, " . PREFIX . "_comments.email as gast_email, text, ip, is_register, " . PREFIX . "_comments.rating, " . PREFIX . "_comments.vote_num, " . PREFIX . "_comments.parent, name, " . USERPREFIX . "_users.email, news_num, comm_num, user_group, lastdate, reg_date, signature, foto, fullname, land, xfields FROM " . PREFIX . "_comments LEFT JOIN " . USERPREFIX . "_users ON " . PREFIX . "_comments.user_id=" . USERPREFIX . "_users.user_id WHERE " . PREFIX . "_comments.post_id = '{$news_id}'" . $where_approve . " ORDER BY " . PREFIX . "_comments.id " . $comm_msort;
     if ($allow_full_cache and $config['allow_comments_cache']) {
         $allow_full_cache = $news_id;
     } else {
         $allow_full_cache = false;
     }
     $comments->build_comments('comments.tpl', 'news', $allow_full_cache, $full_link);
     unset($tpl->result['comments']);
     if (isset($_GET['news_page']) and $_GET['news_page']) {
         $user_query = "newsid=" . $newsid . "&amp;news_page=" . intval($_GET['news_page']);
     } else {
         $user_query = "newsid=" . $newsid;
     }
     $comments->build_navigation('navigation.tpl', $link_page . "{page}," . $news_name . ".html#comment", $user_query, $full_link);
     unset($comments);
     unset($tpl->result['commentsnavigation']);
 }
 if ($is_logged and $config['comments_restricted'] and $_TIME - $member_id['reg_date'] < $config['comments_restricted'] * 86400) {
     $lang['news_info_6'] = str_replace('{days}', intval($config['comments_restricted']), $lang['news_info_8']);
     $allow_add = false;
 }
 if (!isset($member_id['restricted'])) {
     $member_id['restricted'] = false;
 }
 if ($member_id['restricted'] and $member_id['restricted_days'] and $member_id['restricted_date'] < $_TIME) {
     $member_id['restricted'] = 0;
     $db->query("UPDATE LOW_PRIORITY " . USERPREFIX . "_users SET restricted='0', restricted_days='0', restricted_date='' WHERE user_id='{$member_id['user_id']}'");
 }
 if ($user_group[$member_id['user_group']]['allow_addc'] and $config['allow_comments'] and $allow_add and ($member_id['restricted'] != 2 and $member_id['restricted'] != 3)) {