function csc($task = array()) { global $_G; $taskvars = array('num' => 0); $query = DB::query("SELECT variable, value FROM " . DB::table('common_taskvar') . " WHERE taskid='{$task['taskid']}'"); while ($taskvar = DB::fetch($query)) { if ($taskvar['value']) { $taskvars[$taskvar['variable']] = $taskvar['value']; } } $tbladd = $sqladd = ''; if ($taskvars['threadid']) { $sqladd .= " AND p.tid='{$taskvars['threadid']}'"; } else { if ($taskvars['forumid']) { $sqladd .= " AND p.fid='{$taskvars['forumid']}'"; } if ($taskvars['author']) { $taskvars['authorid'] = DB::result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE username='******'author']) . "'"); $tbladd .= ", " . DB::table('forum_thread') . " t"; $sqladd .= " AND p.tid=t.tid AND t.authorid='{$taskvars['authorid']}'"; } } if ($taskvars['act']) { if ($taskvars['act'] == 'newthread') { $sqladd .= " AND p.first='1'"; } elseif ($taskvars['act'] == 'newreply') { $sqladd .= " AND p.first='0'"; } } $sqladd .= ($taskvars['time'] = floatval($taskvars['time'])) ? " AND p.dateline BETWEEN {$task['applytime']} AND {$task['applytime']}+3600*{$taskvars['time']}" : " AND p.dateline>{$task['applytime']}"; $num = getcountofposts(DB::table('forum_post') . " p {$tbladd}", "p.authorid='{$_G['uid']}' {$sqladd}"); if ($num && $num >= $taskvars['num']) { return TRUE; } elseif ($taskvars['time'] && TIMESTAMP >= $task['applytime'] + 3600 * $taskvars['time'] && (!$num || $num < $taskvars['num'])) { return FALSE; } else { return array('csc' => $num > 0 && $taskvars['num'] ? sprintf("%01.2f", $num / $taskvars['num'] * 100) : 0, 'remaintime' => $taskvars['time'] ? $task['applytime'] + $taskvars['time'] * 3600 - TIMESTAMP : 0); } }
$modtpl = 'modcp_home'; } $script = empty($script) ? 'noperm' : $script; $modtpl = empty($modtpl) ? !empty($script) ? 'modcp_' . $script : '' : $modtpl; $modtpl = 'forum/' . $modtpl; $op = isset($op) ? trim($op) : ''; if ($script != 'log') { include libfile('function/misc'); $extra = implodearray(array('GET' => $_GET, 'POST' => $_POST), array('cppwd', 'formhash', 'submit', 'addsubmit')); $modcplog = array(TIMESTAMP, $_G['username'], $_G['adminid'], $_G['clientip'], $_G['gp_action'], $op, $_G['fid'], $extra); writelog('modcp', implode("\t", clearlogstring($modcplog))); } require DISCUZ_ROOT . './source/include/modcp/modcp_' . $script . '.php'; $reportnum = $modpostnum = $modthreadnum = $modforumnum = 0; $modforumnum = count($modforums['list']); if ($modforumnum) { $modnum = ($_G['group']['allowmodpost'] ? getcountofposts(DB::table('forum_post'), "invisible='-2' AND first='0' and fid IN({$modforums['fids']})") + DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_thread') . " WHERE fid IN({$modforums['fids']}) AND displayorder='-2'") : 0) + ($_G['group']['allowmoduser'] ? DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_member_validate') . " WHERE status='0'") : 0); } switch ($_G['adminid']) { case 1: $access = '1,2,3,4,5,6,7'; break; case 2: $access = '2,3,6,7'; break; default: $access = '1,3,5,7'; break; } $notenum = DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_adminnote') . " WHERE access IN ({$access})"); include template('forum/modcp');
$fileupload = '<font color="red">' . $lang['no'] . '</font>'; } $dbsize = 0; $query = DB::query("SHOW TABLE STATUS LIKE '{$_G['config']['db'][1]['tablepre']}%'", 'SILENT'); while ($table = DB::fetch($query)) { $dbsize += $table['Data_length'] + $table['Index_length']; } $dbsize = $dbsize ? sizecount($dbsize) : $lang['unknown']; if (isset($_G['gp_attachsize'])) { $attachsize = DB::result(DB::query("SELECT SUM(filesize) FROM " . DB::table('forum_attachment') . ""), 0); $attachsize = is_numeric($attachsize) ? sizecount($attachsize) : $lang['unknown']; } else { $attachsize = '<a href="' . ADMINSCRIPT . '?action=index&attachsize">[ ' . $lang['detail'] . ' ]</a>'; } $membersmod = DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_member_validate') . " WHERE status='0'"); $postsmod = getcountofposts(DB::table('forum_post'), "first='0' AND invisible='-2'"); $threadsdel = $threadsmod = 0; $query = DB::query("SELECT displayorder FROM " . DB::table('forum_thread') . " WHERE displayorder<'0'"); while ($thread = DB::fetch($query)) { if ($thread['displayorder'] == -1) { $threadsdel++; } elseif ($thread['displayorder'] == -2) { $threadsmod++; } } $blogsmod = DB::result_first("SELECT COUNT(*) FROM " . DB::table('home_blog') . " WHERE status='1'"); $doingsmod = DB::result_first("SELECT COUNT(*) FROM " . DB::table('home_doing') . " WHERE status='1'"); $picturesmod = DB::result_first("SELECT COUNT(*) FROM " . DB::table('home_pic') . " WHERE status='1'"); $sharesmod = DB::result_first("SELECT COUNT(*) FROM " . DB::table('home_share') . " WHERE status='1'"); $commentsmod = DB::result_first("SELECT COUNT(*) FROM " . DB::table('home_comment') . " WHERE status='1'"); $articlesmod = DB::result_first("SELECT COUNT(*) FROM " . DB::table('portal_article_title') . " WHERE status='1'");
function checkflood() { global $_G; if (!$_G['group']['disablepostctrl'] && $_G['uid']) { $floodmsg = $_G['setting']['floodctrl'] && TIMESTAMP - $_G['setting']['floodctrl'] <= getuserprofile('lastpost') ? 'post_flood_ctrl' : ''; if (empty($floodmsg) && $_G['group']['maxpostsperhour']) { $userposts = getcountofposts(DB::table('forum_post'), "authorid='{$_G['uid']}' AND dateline>{$_G['timestamp']}-3600"); $floodmsg = $userposts && $userposts >= $_G['group']['maxpostsperhour'] ? 'thread_maxpostsperhour_invalid' : ''; } if (empty($floodmsg)) { return FALSE; } elseif (CURMODULE != 'wap') { showmessage($floodmsg, '', array('maxpostsperhour' => $_G['group']['maxpostsperhour'], 'floodctrl' => $_G['setting']['floodctrl'])); } else { wapmsg($floodmsg); } } return FALSE; }
foreach ($validatedthreads as $thread) { showtablerow('', '', array($thread['tid'], '<a href="forum.php?mod=viewthread&tid=' . $thread['tid'] . '&modthreadkey=' . modthreadkey($thread['tid']) . '" target="_blank">' . $thread['subject'] . '</a>', '<a href="home.php?mod=space&uid=' . $thread['authorid'] . '" target="_blank">' . $thread['author'] . '</a>', dgmdate($thread['dateline']))); } } showtablefooter(); showformfooter(); } else { cpmsg('moderate_threads_succeed', 'action=moderate&operation=threads', 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'recycles' => $recycles, 'deletes' => $deletes)); } } } elseif ($operation == 'replies') { if (!submitcheck('modsubmit')) { require_once libfile('function/discuzcode'); $ppp = 10; $start_limit = ($page - 1) * $ppp; $modcount = getcountofposts(DB::table('forum_post'), "invisible='{$displayorder}' AND first='0' {$fidadd['and']}{$fidadd['fids']}"); $multipage = multi($modcount, $ppp, $page, ADMINSCRIPT . "?action=moderate&operation=replies&filter={$filter}&modfid={$modfid}"); shownav('topic', $lang['moderate_replies']); showsubmenu('nav_moderate_posts', array(array('nav_moderate_threads', 'moderate&operation=threads', 0), array('nav_moderate_replies', 'moderate&operation=replies', 1))); showformheader("moderate&operation=replies&page={$page}"); showhiddenfields(array('filter' => $filter, 'modfid' => $modfid)); showtableheader("{$lang['select']}: <select style=\"margin: 0px;\" onchange=\"if(this.options[this.selectedIndex].value != '') {window.location='" . ADMINSCRIPT . "?action=moderate&operation=replies&modfid={$modfid}&filter='+this.options[this.selectedIndex].value;}\">{$filteroptions}</select> <select style=\"margin: 0px;\" onchange=\"if(this.options[this.selectedIndex].value != '') {window.location='" . ADMINSCRIPT . "?action=moderate&operation=replies&filter={$filter}&modfid='+this.options[this.selectedIndex].value;}\">{$forumoptions}</select>"); $postarray = getallwithposts(array('select' => 'f.name AS forumname, f.allowsmilies, f.allowhtml, f.allowbbcode, f.allowimgcode, p.pid, p.fid, p.tid, p.author, p.authorid, p.subject, p.dateline, p.message, p.useip, p.attachment, p.htmlon, p.smileyoff, p.bbcodeoff, t.subject AS tsubject', 'from' => DB::table('forum_post') . " p LEFT JOIN " . DB::table('forum_thread') . " t ON t.tid=p.tid LEFT JOIN " . DB::table('forum_forum') . " f ON f.fid=p.fid", 'where' => "p.invisible='{$displayorder}' AND p.first='0' {$fidadd['and']}{$fidadd['p']}{$fidadd['fids']}", 'order' => "p.dateline DESC", 'limit' => "{$start_limit}, {$ppp}")); foreach ($postarray as $post) { $post['dateline'] = dgmdate($post['dateline']); $post['subject'] = $post['subject'] ? '<b>' . $post['subject'] . '</b>' : '<i>' . $lang['nosubject'] . '</i>'; $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $post['allowsmilies'], $post['allowbbcode'], $post['allowimgcode'], $post['allowhtml']); $post['modthreadkey'] = modthreadkey($post['tid']); if ($post['attachment']) { require_once libfile('function/attachment'); $queryattach = DB::query("SELECT aid, filename, filetype, filesize, attachment, isimage, remote FROM " . DB::table('forum_attachment') . " WHERE pid='{$post['pid']}'");
function checkmaxpostsperhour() { global $_G; $morepostsperhour = false; if (!$_G['group']['disablepostctrl'] && $_G['uid']) { if ($_G['group']['maxpostsperhour']) { $userposts = getcountofposts(DB::table('forum_post'), "authorid='{$_G['uid']}' AND dateline>{$_G['timestamp']}-3600"); $isflood = $userposts && $userposts >= $_G['group']['maxpostsperhour']; if ($isflood) { $morepostsperhour = true; } } } return $morepostsperhour; }
} $cursort++; $changesort = 1; } $nextlink = "action=counter&changesort={$changesort}&cursort={$cursort}&specialarrange=yes"; if ($processed) { cpmsg('counter_special_arrange', $nextlink, 'loading', array('cursort' => $cursort, 'sortids' => count($sortids))); } else { cpmsg('counter_special_arrange_succeed', 'action=counter', 'succeed'); } $nextlink = "action=counter¤t={$next}&pertask={$pertask}&membersubmit=yes"; $processed = 0; $queryt = DB::query("SELECT uid FROM " . DB::table('common_member') . " LIMIT {$current}, {$pertask}"); while ($mem = DB::fetch($queryt)) { $processed = 1; $postcount = getcountofposts(DB::table('forum_post'), "authorid='{$mem['uid']}' AND invisible='0'"); $query_threads = DB::query("SELECT COUNT(*) FROM " . DB::table('forum_thread') . " WHERE authorid='{$mem['uid']}'"); DB::query("UPDATE " . DB::table('common_member_count') . " SET posts='" . $postcount . "', threads='" . DB::result($query_threads, 0) . "' WHERE uid='{$mem['uid']}'"); } if ($processed) { cpmsg("{$lang['counter_member']}: " . cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading'); } else { cpmsg('counter_member_succeed', 'action=counter', 'succeed'); } } elseif (submitcheck('groupmembernum', 1)) { $nextlink = "action=counter¤t={$next}&pertask={$pertask}&groupmembernum=yes"; $processed = 0; $query = DB::query("SELECT fid FROM " . DB::table('forum_forum') . " WHERE status='3' AND type='sub' LIMIT {$current}, {$pertask}"); while ($group = DB::fetch($query)) { $processed = 1; $membernum = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_groupuser') . " WHERE fid='{$group['fid']}' AND level>'0'");
} elseif ($_G['forum']['password'] != $_G['cookie']['fidpw' . $_G['fid']]) { include template('forum/forumdisplay_passwd'); exit; } } $sdb = loadmultiserver(); if (!isset($_G['cookie']['collapse']) || strpos($_G['cookie']['collapse'], 'forum_rules') === FALSE) { $collapse['forum_rules'] = ''; } else { $collapse['forum_rules'] = 'display: none'; } $threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array(); $threadtable = $_G['gp_archiveid'] && in_array($_G['gp_archiveid'], $threadtableids) ? "forum_thread_{$_G['gp_archiveid']}" : 'forum_thread'; if ($_G['forum']['modworks'] || $_G['forum']['modnewposts']) { $_G['forum']['modnewposts'] && ($_G['forum']['modworks'] = 1); $modnum = $_G['group']['allowmodpost'] ? getcountofposts(DB::table('forum_post'), "invisible='-2' AND first='0' and fid={$_G['fid']}") + $_G['forum']['modnewposts'] : 0; $modusernum = $_G['group']['allowmoduser'] ? DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_member_validate') . " WHERE status='0'") : 0; } $optionadd = $filterurladd = $searchsorton = ''; if (!empty($_G['forum']['threadsorts']['types'])) { require_once libfile('function/threadsort'); $showpic = intval($_G['gp_showpic']); $templatearray = $sortoptionarray = array(); foreach ($_G['forum']['threadsorts']['types'] as $stid => $sortname) { loadcache(array('threadsort_option_' . $stid, 'threadsort_template_' . $stid)); $templatearray[$stid] = $_G['cache']['threadsort_template_' . $stid]['subject']; $sortoptionarray[$stid] = $_G['cache']['threadsort_option_' . $stid]; } if (!empty($_G['forum']['threadsorts']['defaultshow']) && empty($_G['gp_sortid']) && empty($_G['gp_sortall'])) { $_G['gp_sortid'] = $_G['forum']['threadsorts']['defaultshow']; $filterurladd = '&filter=sort';
if ($pmlist) { foreach ($pmlist as $pm) { $post = $pm['post']; $_G['tid'] = intval($pm['tid']); notification_add($pm['authorid'], 'system', $pm['act'], $pm['notevar'], 1); } } showmessage('modcp_mod_succeed', "{$cpscript}?action={$_G['gp_action']}&op={$op}&filter={$filter}&fid={$_G['fid']}"); } $attachlist = array(); require_once libfile('function/discuzcode'); require_once libfile('function/attachment'); $ppp = 10; $page = max(1, intval($_G['page'])); $start_limit = ($page - 1) * $ppp; $modcount = getcountofposts(DB::table('forum_post'), "invisible='{$pstat}' AND first='0' AND " . ($modfidsadd ? $modfidsadd : '1')); $multipage = multi($modcount, $ppp, $page, "{$cpscript}?action={$_G['gp_action']}&op={$op}&filter={$filter}&fid={$_G['fid']}"); if ($modcount) { $postarray = getallwithposts(array('select' => 'f.name AS forumname, f.allowsmilies, f.allowhtml, f.allowbbcode, f.allowimgcode, p.pid, p.fid, p.tid, p.authorid, p.authorid, p.subject, p.dateline, p.message, p.useip, p.attachment, p.htmlon, p.smileyoff, p.bbcodeoff, t.subject AS tsubject', 'from' => DB::table('forum_post') . " p LEFT JOIN " . DB::table('forum_thread') . " t ON t.tid=p.tid LEFT JOIN " . DB::table('forum_forum') . " f ON f.fid=p.fid", 'where' => "p.invisible='{$pstat}' AND p.first='0' AND " . ($modfidsadd ? "p.{$modfidsadd}" : '1'), 'order' => 'p.dateline DESC', 'limit' => "{$start_limit}, {$ppp}")); foreach ($postarray as $post) { $post['id'] = $post['pid']; $post['dateline'] = dgmdate($post['dateline']); $post['subject'] = $post['subject'] ? '<b>' . $post['subject'] . '</b>' : '<i>' . $lang['nosubject'] . '</i>'; $post['message'] = nl2br(dhtmlspecialchars($post['message'])); if ($post['attachment']) { $queryattach = DB::query("SELECT aid, filename, filetype, filesize, attachment, isimage, remote FROM " . DB::table('forum_attachment') . " WHERE pid='{$post['pid']}'"); while ($attach = DB::fetch($queryattach)) { $_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']; $attach['url'] = $attach['isimage'] ? " {$attach['filename']} (" . sizecount($attach['filesize']) . ")<br /><br /><img src=\"{$_G[setting][attachurl]}/attach[attachment]\" onload=\"if(this.width > 400) {this.resized=true; this.width=400;}\">" : "<a href=\"" . $_G['setting']['attachurl'] . "/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (" . sizecount($attach['filesize']) . ")"; $post['message'] .= "<br /><br />File: " . attachtype(fileext($attach['filename']) . "\t" . $attach['filetype']) . $attach['url']; }
} if (!isset($_G['cookie']['collapse']) || strpos($_G['cookie']['collapse'], 'forum_rules_' . $_G['fid']) === FALSE) { $collapse['forum_rules'] = ''; $collapse['forum_rulesimg'] = 'no'; } else { $collapse['forum_rules'] = 'display: none'; $collapse['forum_rulesimg'] = 'yes'; } $threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array(); $threadtable = $_G['gp_archiveid'] && in_array($_G['gp_archiveid'], $threadtableids) ? "forum_thread_{$_G['gp_archiveid']}" : 'forum_thread'; if ($_G['setting']['allowmoderatingthread'] && $_G['uid']) { $threadmodcount = DB::result_first("SELECT COUNT(*) FROM " . DB::table($threadtable) . " WHERE fid='{$_G['fid']}' AND displayorder='-2' AND authorid='{$_G['uid']}'"); } if ($_G['forum']['modworks'] || $_G['forum']['modnewposts']) { $_G['forum']['modnewposts'] && ($_G['forum']['modworks'] = 1); $modnum = $_G['group']['allowmodpost'] ? getcountofposts(DB::table('forum_post'), "invisible='-2' AND fid='{$_G['fid']}'") : 0; $modusernum = $_G['group']['allowmoduser'] ? DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_member_validate') . " WHERE status='0'") : 0; } $optionadd = $filterurladd = $searchsorton = ''; $quicksearchlist = array(); if (!empty($_G['forum']['threadsorts']['types'])) { require_once libfile('function/threadsort'); $showpic = intval($_G['gp_showpic']); $templatearray = $sortoptionarray = array(); foreach ($_G['forum']['threadsorts']['types'] as $stid => $sortname) { loadcache(array('threadsort_option_' . $stid, 'threadsort_template_' . $stid)); $templatearray[$stid] = $_G['cache']['threadsort_template_' . $stid]['subject']; $sortoptionarray[$stid] = $_G['cache']['threadsort_option_' . $stid]; } if (!empty($_G['forum']['threadsorts']['defaultshow']) && empty($_G['gp_sortid']) && empty($_G['gp_sortall'])) { $_G['gp_sortid'] = $_G['forum']['threadsorts']['defaultshow'];
} if (!$error) { if ($_G['gp_detail']) { $pagetmp = $page; do { $postarray = getallwithposts(array('select' => 'p.fid, p.tid, p.pid, p.author, p.authorid, p.dateline, t.subject, p.message', 'from' => DB::table('forum_post') . " p LEFT JOIN " . DB::table('forum_thread') . " t USING(tid)", 'where' => "t.digest>=0 {$sql}", 'limit' => ($pagetmp - 1) * $_G['setting']['postperpage'] . ", {$_G['setting']['postperpage']}")); $pagetmp--; } while (!count($postarray) && $pagetmp); $posts = ''; foreach ($postarray as $post) { $post['dateline'] = dgmdate($post['dateline']); $post['subject'] = cutstr($post['subject'], 30); $post['message'] = dhtmlspecialchars(cutstr($post['message'], 50)); $posts .= showtablerow('', '', array("<input class=\"checkbox\" type=\"checkbox\" name=\"pidarray[]\" value=\"{$post['pid']}\" checked />", "<a href=\"forum.php?mod=redirect&goto=findpost&pid={$post['pid']}&ptid={$post['tid']}\" target=\"_blank\">{$post['subject']}</a>", $post['message'], "<a href=\"forum.php?mod=forumdisplay&fid={$post['fid']}\" target=\"_blank\">{$_G['cache'][forums][$post[fid]][name]}</a>", "<a href=\"home.php?mod=space&uid={$post['authorid']}\" target=\"_blank\">{$post['author']}</a>", $post['dateline']), TRUE); } $postcount = getcountofposts(DB::table('forum_post') . " p LEFT JOIN " . DB::table('forum_thread') . " t USING(tid)", "t.digest>=0 {$sql}"); $multi = multi($postcount, $_G['setting']['postperpage'], $page, ADMINSCRIPT . "?action=prune"); $multi = preg_replace("/href=\"" . ADMINSCRIPT . "\\?action=prune&page=(\\d+)\"/", "href=\"javascript:page(\\1)\"", $multi); $multi = str_replace("window.location='" . ADMINSCRIPT . "?action=prune&page='+this.value", "page(this.value)", $multi); } else { $postcount = 0; $postarray = getallwithposts(array('select' => 'pid', 'from' => DB::table('forum_post') . " p LEFT JOIN " . DB::table('forum_thread') . " t USING(tid)", 'where' => "t.digest>=0 {$sql}")); foreach ($postarray as $post) { $pids .= ',' . $post['pid']; $postcount++; } $multi = ''; } if (!$postcount) { $error = 'prune_post_nonexistence'; }
$attachment['url'] = $_G['setting']['attachurl'] . 'forum/'; } else { @set_time_limit(0); if (@fclose(@fopen($_G['setting']['ftp']['attachurl'] . '/' . $attachment['attachment'], 'r'))) { $matched = ''; } else { $matched = cplang('attach_lost'); } $attachment['url'] = $_G['setting']['ftp']['attachurl'] . '/forum/'; } $attachsize = sizecount($attachment['filesize']); if (!$_G['gp_nomatched'] || $_G['gp_nomatched'] && $matched) { $attachments .= showtablerow('', array('class="td25"', 'title="' . $attachment['description'] . '" class="td21"'), array("<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$attachment['aid']}\" />", $attachment['remote'] ? "<span class=\"diffcolor3\">{$attachment['filename']}" : $attachment['filename'], "<a href=\"{$attachment['url']}/{$attachment['attachment']}\" class=\"smalltxt\" target=\"_blank\">" . cutstr($attachment['attachment'], 30) . "</a>", $attachment['author'], "<a href=\"forum.php?mod=viewthread&tid={$attachment['tid']}\" target=\"_blank\">" . cutstr($attachment['subject'], 20) . "</a>", $attachsize, $attachment['downloads'], $matched ? "<em class=\"error\">{$matched}<em>" : "<a href=\"forum.php?mod=attachment&aid=" . aidencode($attachment['aid']) . "&noupdate=yes\" target=\"_blank\" class=\"act nomargin\">{$lang['download']}</a>"), TRUE); } } $attachmentcount = getcountofposts(DB::table('forum_attachment') . " a LEFT JOIN " . DB::table('forum_attachmentfield') . " af ON a.aid=af.aid, " . DB::table('forum_post') . " p, " . DB::table('forum_thread') . " t, " . DB::table('forum_forum') . " f", "t.tid=a.tid ANd f.fid=p.fid ANd t.displayorder>='0' ANd p.invisible='0' AND {$sql}"); $multipage = multi($attachmentcount, $ppp, $page, ADMINSCRIPT . "?action=attachments"); $multipage = preg_replace("/href=\"" . ADMINSCRIPT . "\\?action=attachments&page=(\\d+)\"/", "href=\"javascript:page(\\1)\"", $multipage); $multipage = str_replace("window.location='" . ADMINSCRIPT . "?action=attachments&page='+this.value", "page(this.value)", $multipage); echo <<<EOT <script type="text/JavaScript"> \tfunction page(number) { \t\t\$('attachmentforum').page.value=number; \t\t\$('attachmentforum').searchsubmit.click(); \t} </script> EOT; showtagheader('div', 'admin', $searchsubmit); showformheader('attach', '', 'attachmentforum'); showhiddenfields(array('page' => $page, 'nomatched' => $_G['gp_nomatched'], 'inforum' => $_G['gp_inforum'], 'sizeless' => $_G['gp_sizeless'], 'sizemore' => $_G['gp_sizemore'], 'dlcountless' => $_G['gp_dlcountless'], 'dlcountmore' => $_G['gp_dlcountmore'], 'daysold' => $_G['gp_daysold'], 'filename' => $_G['gp_filename'], 'keywords' => $_G['gp_keywords'], 'author' => $_G['gp_author'])); echo '<input type="submit" name="searchsubmit" value="' . cplang('submit') . '" class="btn" style="display: none" />';
if ($pmlist) { foreach ($pmlist as $pm) { $post = $pm['post']; $_G['tid'] = intval($pm['tid']); notification_add($pm['authorid'], 'system', $pm['act'], $pm['notevar'], 1); } } showmessage('modcp_mod_succeed', "{$cpscript}?mod=modcp&action={$_G['gp_action']}&op={$op}&filter={$filter}&fid={$_G['fid']}"); } $attachlist = array(); require_once libfile('function/discuzcode'); require_once libfile('function/attachment'); $ppp = 10; $page = max(1, intval($_G['page'])); $start_limit = ($page - 1) * $ppp; $modcount = getcountofposts(DB::table('forum_post') . ' p INNER JOIN ' . DB::table('forum_thread') . ' t ON p.tid=t.tid', "p.invisible='{$pstat}' AND p.first='0' AND t.displayorder>='0' AND " . ($modfidsadd ? 'p.' . $modfidsadd : '1')); $multipage = multi($modcount, $ppp, $page, "{$cpscript}?mod=modcp&action={$_G['gp_action']}&op={$op}&filter={$filter}&fid={$_G['fid']}"); if ($modcount) { $postarray = getallwithposts(array('select' => 'f.name AS forumname, f.allowsmilies, f.allowhtml, f.allowbbcode, f.allowimgcode, p.pid, p.fid, p.tid, p.authorid, p.author, p.subject, p.dateline, p.message, p.useip, p.attachment, p.htmlon, p.smileyoff, p.bbcodeoff, t.subject AS tsubject', 'from' => DB::table('forum_post') . " p LEFT JOIN " . DB::table('forum_thread') . " t ON t.tid=p.tid LEFT JOIN " . DB::table('forum_forum') . " f ON f.fid=p.fid", 'where' => "p.invisible='{$pstat}' AND p.first='0' AND t.displayorder>='0' AND " . ($modfidsadd ? "p.{$modfidsadd}" : '1'), 'order' => 'p.dateline DESC', 'limit' => "{$start_limit}, {$ppp}")); foreach ($postarray as $post) { $post['id'] = $post['pid']; $post['dateline'] = dgmdate($post['dateline']); $post['subject'] = $post['subject'] ? '<b>' . $post['subject'] . '</b>' : '<i>' . $lang['nosubject'] . '</i>'; $post['message'] = nl2br(dhtmlspecialchars($post['message'])); if ($post['attachment']) { $queryattach = DB::query("SELECT aid, filename, filetype, filesize, attachment, isimage, remote FROM " . DB::table('forum_attachment') . " WHERE pid='{$post['pid']}'"); while ($attach = DB::fetch($queryattach)) { $_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']; $attach['url'] = $attach['isimage'] ? " {$attach['filename']} (" . sizecount($attach['filesize']) . ")<br /><br /><img src=\"{$_G[setting][attachurl]}forum/{$attach['attachment']}\" onload=\"if(this.width > 400) {this.resized=true; this.width=400;}\">" : "<a href=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (" . sizecount($attach['filesize']) . ")"; $post['message'] .= "<br /><br />File: " . attachtype(fileext($attach['filename']) . "\t" . $attach['filetype']) . $attach['url']; }
showtableheader(); $sqlwhere = ''; if (!empty($_G['gp_username'])) { $sqlwhere .= " AND p.author='{$_G['gp_username']}'"; } if (!empty($dateline) && $dateline != 'all') { $sqlwhere .= " AND p.dateline>'" . (TIMESTAMP - $dateline) . "'"; } if (!empty($_G['gp_title'])) { $sqlwhere .= " AND t.subject LIKE '%{$_G['gp_title']}%'"; } if ($modfid > 0) { $fidadd['and'] = ' AND'; $fidadd['fids'] = " p.fid='{$modfid}'"; } $modcount = getcountofposts(DB::table('forum_post') . ' p INNER JOIN ' . DB::table('forum_thread') . ' t ON p.tid=t.tid', "p.invisible='{$displayorder}' AND p.first='0' AND t.displayorder>='0' {$fidadd['and']}{$fidadd['fids']}" . ($modfid == -1 ? " AND t.isgroup='1'" : '') . " {$sqlwhere}"); $start_limit = ($page - 1) * $ppp; $postarray = getallwithposts(array('select' => 'f.name AS forumname, f.allowsmilies, f.allowhtml, f.allowbbcode, f.allowimgcode, p.pid, p.fid, p.tid, p.author, p.authorid, p.subject, p.dateline, p.message, p.useip, p.attachment, p.htmlon, p.smileyoff, p.bbcodeoff, t.subject AS tsubject', 'from' => DB::table('forum_post') . " p LEFT JOIN " . DB::table('forum_thread') . " t ON t.tid=p.tid LEFT JOIN " . DB::table('forum_forum') . " f ON f.fid=p.fid", 'where' => "p.invisible='{$displayorder}' AND p.first='0' AND t.displayorder>='0' {$fidadd['and']}{$fidadd['fids']}" . ($modfid == -1 ? " AND t.isgroup='1'" : '') . " {$sqlwhere}", 'order' => 'p.dateline DESC', 'limit' => "{$start_limit}, {$ppp}")); $multipage = multi($modcount, $ppp, $page, ADMINSCRIPT . "?action=moderate&operation=replies&filter={$filter}&modfid={$modfid}&dateline={$_G['gp_dateline']}&username={$_G['gp_username']}&title={$_G['gp_title']}&ppp={$ppp}"); echo '<p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">' . cplang('moderate_all_expand') . '</a> <a href="javascript:;" onclick="foldall();">' . cplang('moderate_all_fold') . '</a><p>'; require_once libfile('class/censor'); $censor =& discuz_censor::instance(); $censor->highlight = '#FF0000'; require_once libfile('function/misc'); foreach ($postarray as $post) { $post['dateline'] = dgmdate($post['dateline']); $post['subject'] = $post['subject'] ? '<b>' . $post['subject'] . '</b>' : '<i>' . $lang['nosubject'] . '</i>'; $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $post['allowsmilies'], $post['allowbbcode'], $post['allowimgcode'], $post['allowhtml']); $censor->check($post['tsubject']); $censor->check($post['message']); $post_censor_words = $censor->words_found;