First commit
This commit is contained in:
0
source/include/modcp/index.htm
Normal file
0
source/include/modcp/index.htm
Normal file
161
source/include/modcp/modcp_announcement.php
Normal file
161
source/include/modcp/modcp_announcement.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_announcement.php 29236 2012-03-30 05:34:47Z chenmengshu $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$annlist = null;
|
||||
$add_successed = $edit_successed = false;
|
||||
$op = empty($_GET['op']) ? 'add' : $_GET['op'];
|
||||
|
||||
$announce = array('subject' => '', 'message' => '', 'starttime' => '', 'endtime' => '');
|
||||
$announce['checked'] = array('selected="selected"', '');
|
||||
|
||||
switch($op) {
|
||||
|
||||
case 'add':
|
||||
|
||||
$announce['starttime'] = dgmdate(TIMESTAMP, 'd');
|
||||
$announce['endtime'] = dgmdate(TIMESTAMP + 86400 * 30, 'd');
|
||||
if(submitcheck('submit')) {
|
||||
$message = is_array($_GET['message']) ? $_GET['message'][$_GET['type']] : '';
|
||||
save_announce(0, $_GET['starttime'], $_GET['endtime'], $_GET['subject'], $_GET['type'], $message, 0);
|
||||
$add_successed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'manage':
|
||||
|
||||
$annlist = get_annlist();
|
||||
|
||||
if(submitcheck('submit')) {
|
||||
$delids = array();
|
||||
if(!empty($_GET['delete']) && is_array($_GET['delete'])) {
|
||||
foreach($_GET['delete'] as $id) {
|
||||
$id = intval($id);
|
||||
if(isset($annlist[$id])) {
|
||||
unset($annlist[$id]);
|
||||
$delids[] = $id;
|
||||
}
|
||||
}
|
||||
if($delids) {
|
||||
C::t('forum_announcement')->delete_by_id_username($delids, $_G['username']);
|
||||
}
|
||||
}
|
||||
|
||||
$updateorder = false;
|
||||
if(!empty($_GET['order']) && is_array($_GET['order'])) {
|
||||
foreach ($_GET['order'] as $id => $val) {
|
||||
$val = intval($val);
|
||||
if(isset($annlist[$id]) && $annlist[$id]['displayorder'] != $val) {
|
||||
$annlist[$id]['displayorder'] = $val;
|
||||
C::t('forum_announcement')->update_displayorder_by_id_username($id, $val, $_G['username']);
|
||||
$updateorder = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($delids || $updateorder) {
|
||||
update_announcecache();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$id = intval($_GET['id']);
|
||||
$announce = C::t('forum_announcement')->fetch_by_id_username($id, $_G['username']);
|
||||
if(!count($announce)) {
|
||||
showmessage('modcp_ann_nofound');
|
||||
}
|
||||
|
||||
if(!submitcheck('submit')) {
|
||||
$announce['starttime'] = $announce['starttime'] ? dgmdate($announce['starttime'], 'd') : '';
|
||||
$announce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : '';
|
||||
$announce['subject'] = strip_tags($announce['subject']);
|
||||
$announce['message'] = $announce['type'] != 1 ? dhtmlspecialchars($announce['message']) : $announce['message'];
|
||||
$announce['checked'] = $announce['type'] != 1 ? array('selected="selected"', '') : array('', 'selected="selected"');
|
||||
} else {
|
||||
$announce['starttime'] = $_GET['starttime'];
|
||||
$announce['endtime'] = $_GET['endtime'];
|
||||
$announce['checked'] = $_GET['type'] != 1 ? array('selected="selected"', '') : array('', 'selected="selected"');
|
||||
$message = $_GET['message'][$_GET['type']];
|
||||
save_announce($id, $_GET['starttime'], $_GET['endtime'], $_GET['subject'], $_GET['type'], $message, $_GET['displayorder']);
|
||||
$announce['subject'] = dhtmlspecialchars(trim($_GET['subject']));
|
||||
if(intval($_GET['type']) == 1) {
|
||||
list($message) = explode("\n", trim($message));
|
||||
$announce['message'] = dhtmlspecialchars($message);
|
||||
} else {
|
||||
$announce['message'] = dhtmlspecialchars(trim($message));
|
||||
}
|
||||
$edit_successed = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$annlist = get_annlist();
|
||||
|
||||
function get_annlist() {
|
||||
global $_G;
|
||||
$annlist = C::t('forum_announcement')->fetch_all_by_displayorder();
|
||||
foreach ($annlist as $announce) {
|
||||
$announce['disabled'] = $announce['author'] != $_G['member']['username'] ? 'disabled' : '';
|
||||
$announce['starttime'] = $announce['starttime'] ? dgmdate($announce['starttime'], 'd') : '-';
|
||||
$announce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : '-';
|
||||
$annlist[$announce['id']] = $announce;
|
||||
}
|
||||
return $annlist;
|
||||
}
|
||||
|
||||
function update_announcecache() {
|
||||
require_once libfile('function/cache');
|
||||
updatecache(array('announcements', 'announcements_forum'));
|
||||
}
|
||||
|
||||
function save_announce($id, $starttime, $endtime, $subject, $type, $message, $displayorder = 0) {
|
||||
global $_G;
|
||||
|
||||
$displayorder = intval($displayorder);
|
||||
$type = intval($type);
|
||||
|
||||
$starttime = empty($starttime) || strtotime($starttime) < TIMESTAMP ? TIMESTAMP : strtotime($starttime);
|
||||
$endtime = empty($endtime) ? 0 : (strtotime($endtime) < $starttime ? ($starttime + 86400 * 30) : strtotime($endtime));
|
||||
|
||||
$subject = dhtmlspecialchars(trim($subject));
|
||||
|
||||
if($type == 1) {
|
||||
list($message) = explode("\n", trim($message));
|
||||
$message = dhtmlspecialchars($message);
|
||||
} else {
|
||||
$type = 0;
|
||||
$message = trim($message);
|
||||
}
|
||||
|
||||
if(empty($subject) || empty($message)) {
|
||||
acpmsg('modcp_ann_empty');
|
||||
} elseif($type == 1 && !preg_match('/^https?:\/\//is', $message)) {
|
||||
acpmsg('modcp_ann_urlerror');
|
||||
} else {
|
||||
$data = array('author'=>$_G['username'], 'subject'=>$subject, 'type'=>$type, 'starttime'=>$starttime, 'endtime'=>$endtime,
|
||||
'message'=>$message, 'displayorder'=>$displayorder);
|
||||
|
||||
if(empty($id)) {
|
||||
C::t('forum_announcement')->insert($data);
|
||||
} else {
|
||||
C::t('forum_announcement')->update($id, $data, true);
|
||||
}
|
||||
update_announcecache();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
128
source/include/modcp/modcp_forum.php
Normal file
128
source/include/modcp/modcp_forum.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_forum.php 32563 2013-02-21 03:38:50Z zhangguosheng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$forumupdate = $listupdate = false;
|
||||
|
||||
$op = !in_array($op , array('editforum', 'recommend')) ? 'editforum' : $op;
|
||||
|
||||
if(empty($_G['fid'])) {
|
||||
if(!empty($_G['cookie']['modcpfid'])) {
|
||||
$fid = $_G['cookie']['modcpfid'];
|
||||
} else {
|
||||
list($fid) = array_keys($modforums['list']);
|
||||
}
|
||||
dheader("Location: {$cpscript}?mod=modcp&action={$_GET['action']}&op=$op&fid=$fid");
|
||||
}
|
||||
|
||||
if($_G['fid'] && $_G['forum']['ismoderator']) {
|
||||
|
||||
if($op == 'editforum') {
|
||||
|
||||
require_once libfile('function/editor');
|
||||
|
||||
$alloweditrules = $_G['adminid'] == 1 || $_G['forum']['alloweditrules'] ? true : false;
|
||||
|
||||
if(!submitcheck('editsubmit')) {
|
||||
$_G['forum']['rules'] = html2bbcode($_G['forum']['rules']);
|
||||
} else {
|
||||
|
||||
require_once libfile('function/discuzcode');
|
||||
$forumupdate = true;
|
||||
$rulesnew = $alloweditrules ? preg_replace('/on(mousewheel|mouseover|click|load|onload|submit|focus|blur)="[^"]*"/i', '', discuzcode($_GET['rulesnew'], 1, 0, 0, 0, 1, 1, 0, 0, 1)) : $_G['forum']['rules'];
|
||||
C::t('forum_forumfield')->update($_G['fid'], array('rules' => $rulesnew));
|
||||
|
||||
$_G['forum']['description'] = html2bbcode($descnew);
|
||||
$_G['forum']['rules'] = html2bbcode($rulesnew);
|
||||
|
||||
}
|
||||
|
||||
} elseif($op == 'recommend') {
|
||||
|
||||
$useradd = 0;
|
||||
|
||||
if($_G['adminid'] == 3) {
|
||||
$useradd = $_G['uid'];
|
||||
}
|
||||
$ordernew = !empty($_GET['ordernew']) && is_array($_GET['ordernew']) ? $_GET['ordernew'] : array();
|
||||
|
||||
if(submitcheck('editsubmit') && $_G['forum']['modrecommend']['sort'] != 1) {
|
||||
$threads = array();
|
||||
foreach($_GET['order'] as $id => $position) {
|
||||
$threads[$id]['order'] = $position;
|
||||
}
|
||||
foreach($_GET['subject'] as $id => $title) {
|
||||
$threads[$id]['subject'] = $title;
|
||||
}
|
||||
foreach($_GET['expirationrecommend'] as $id => $expiration) {
|
||||
$expiration = trim($expiration);
|
||||
if(!empty($expiration)) {
|
||||
if(!preg_match('/^\d{4}-\d{1,2}-\d{1,2} +\d{1,2}:\d{1,2}$/', $expiration)) {
|
||||
showmessage('recommend_expiration_invalid');
|
||||
}
|
||||
list($expiration_date, $expiration_time) = explode(' ', $expiration);
|
||||
list($expiration_year, $expiration_month, $expiration_day) = explode('-', $expiration_date);
|
||||
list($expiration_hour, $expiration_min) = explode(':', $expiration_time);
|
||||
$expiration_sec = 0;
|
||||
|
||||
$expiration_timestamp = mktime($expiration_hour, $expiration_min, $expiration_sec, $expiration_month, $expiration_day, $expiration_year);
|
||||
} else {
|
||||
$expiration_timestamp = 0;
|
||||
}
|
||||
$threads[$id]['expiration'] = $expiration_timestamp;
|
||||
}
|
||||
if($_GET['delete']) {
|
||||
$listupdate = true;
|
||||
C::t('forum_forumrecommend')->delete($_GET['delete']);
|
||||
}
|
||||
if(!empty($_GET['delete']) && is_array($_GET['delete'])) {
|
||||
foreach($_GET['delete'] as $id) {
|
||||
$threads[$id]['delete'] = true;
|
||||
unset($threads[$id]);
|
||||
}
|
||||
}
|
||||
foreach($threads as $id => $item) {
|
||||
$item['displayorder'] = intval($item['order']);
|
||||
$item['subject'] = dhtmlspecialchars($item['subject']);
|
||||
C::t('forum_forumrecommend')->update($id, array(
|
||||
'subject' => $item['subject'],
|
||||
'displayorder' => $item['displayorder'],
|
||||
'expiration' => $item['expiration']
|
||||
));
|
||||
}
|
||||
$listupdate = true;
|
||||
}
|
||||
|
||||
$page = max(1, intval($_G['page']));
|
||||
$start_limit = ($page - 1) * $_G['tpp'];
|
||||
|
||||
$threadcount = C::t('forum_forumrecommend')->count_by_fid($_G['fid']);
|
||||
$multipage = multi($threadcount, $_G['tpp'], $page, "$cpscript?action={$_GET['action']}&fid={$_G['fid']}&page=$page");
|
||||
|
||||
$threadlist = $moderatormembers = array();
|
||||
$moderatorids = array();
|
||||
foreach(C::t('forum_forumrecommend')->fetch_all_by_fid($_G['fid'], false, $useradd, $start_limit, $_G['tpp']) as $thread) {
|
||||
if($thread['moderatorid']) {
|
||||
$moderatorids[$thread['moderatorid']] = $thread['moderatorid'];
|
||||
}
|
||||
$thread['authorlink'] = $thread['authorid'] ? "<a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">{$thread['author']}</a>" : 'Guest';
|
||||
$thread['expiration'] = $thread['expiration'] ? dgmdate($thread['expiration']) : '';
|
||||
$threadlist[] = $thread;
|
||||
}
|
||||
if($moderatorids) {
|
||||
$moderatormembers = C::t('common_member')->fetch_all($moderatorids, false, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
168
source/include/modcp/modcp_forumaccess.php
Normal file
168
source/include/modcp/modcp_forumaccess.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_forumaccess.php 26544 2011-12-15 02:19:09Z chenmengshu $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$list = $logids = array();
|
||||
|
||||
include_once(libfile('function/forumlist'));
|
||||
$forumlistall = forumselect(false, false, $_G['fid']);
|
||||
|
||||
$adderror = $successed = 0;
|
||||
$new_user = isset($_GET['new_user']) ? trim($_GET['new_user']) : '';
|
||||
|
||||
if($_G['fid'] && $_G['forum']['ismoderator'] && $new_user != '' && submitcheck('addsubmit')) {
|
||||
$deleteaccess = isset($_GET['deleteaccess']) ? 1 : 0;
|
||||
foreach (array('view', 'post', 'reply', 'getattach', 'getimage', 'postattach', 'postimage') as $key) {
|
||||
${'new_'.$key} = isset($_GET['new_'.$key]) ? intval($_GET['new_'.$key]) : '';
|
||||
}
|
||||
|
||||
if($new_user != '') {
|
||||
|
||||
$user = C::t('common_member')->fetch_by_username($new_user);
|
||||
$uid = $user['uid'];
|
||||
|
||||
if(empty($user)) {
|
||||
$adderror = 1;
|
||||
} elseif($user['adminid'] && $_G['adminid'] != 1) {
|
||||
$adderror = 2;
|
||||
} else {
|
||||
|
||||
$access = C::t('forum_access')->fetch_all_by_fid_uid($_G['fid'], $uid);
|
||||
$access = $access[0];
|
||||
|
||||
if($deleteaccess) {
|
||||
|
||||
if($access && $_G['adminid'] != 1 && inwhitelist($access)) {
|
||||
$adderror = 3;
|
||||
} else {
|
||||
$successed = true;
|
||||
$access && delete_access($uid, $_G['fid']);
|
||||
}
|
||||
|
||||
} elseif($new_view || $new_post || $new_reply || $new_getattach || $new_getimage || $new_postattach || $new_postimage) {
|
||||
|
||||
if($new_view == -1) {
|
||||
$new_view = $new_post = $new_reply = $new_getattach = $new_getimage = $new_postattach = $new_postimage = -1;
|
||||
} else {
|
||||
$new_view = 0;
|
||||
$new_post = $new_post ? -1 : 0;
|
||||
$new_reply = $new_reply ? -1 : 0;
|
||||
$new_getattach = $new_getattach ? -1 : 0;
|
||||
$new_getimage = $new_getimage ? -1 : 0;
|
||||
$new_postattach = $new_postattach ? -1 : 0;
|
||||
$new_postimage = $new_postimage ? -1 : 0;
|
||||
}
|
||||
|
||||
if(empty($access)) {
|
||||
$successed = true;
|
||||
$data = array('uid' => $uid, 'fid' => $_G['fid'], 'allowview' => $new_view, 'allowpost' => $new_post, 'allowreply' => $new_reply,
|
||||
'allowgetattach' => $new_getattach, 'allowgetimage' => $new_getimage,
|
||||
'allowpostattach' => $new_postattach, 'allowpostimage' => $new_postimage,
|
||||
'adminuser' => $_G['uid'], 'dateline' => $_G['timestamp']);
|
||||
C::t('forum_access')->insert($data);
|
||||
C::t('common_member')->update($uid, array('accessmasks' => 1), 'UNBUFFERED');
|
||||
|
||||
} elseif($new_view == -1 && $access['allowview'] == 1 && $_G['adminid'] != 1) {
|
||||
$adderror = 3;
|
||||
} else {
|
||||
if($_G['adminid'] > 1) {
|
||||
$new_view = $access['allowview'] == 1 ? 1 : $new_view;
|
||||
$new_post = $access['allowpost'] == 1 ? 1 : $new_post;
|
||||
$new_reply = $access['allowreply'] == 1 ? 1 : $new_reply;
|
||||
$new_getattach = $access['allowgetattach'] == 1 ? 1 : $new_getattach;
|
||||
$new_getimage = $access['allowgetimage'] == 1 ? 1 : $new_getimage;
|
||||
$new_postattach = $access['postattach'] == 1 ? 1 : $new_postattach;
|
||||
$new_postimage = $access['postimage'] == 1 ? 1 : $new_postimage;
|
||||
}
|
||||
$successed = true;
|
||||
$data = array('allowview' => $new_view, 'allowpost' => $new_post, 'allowreply' => $new_reply,
|
||||
'allowgetattach' => $new_getattach, 'allowgetimage' => $new_getimage,
|
||||
'allowpostattach' => $new_postattach, 'allowpostimage' => $new_postimage,
|
||||
'adminuser' => $_G['uid'], 'dateline' => $_G['timestamp']);
|
||||
C::t('forum_access')->update_for_uid($uid, $_G['fid'], $data);
|
||||
C::t('common_member')->update($uid, array('accessmasks' => 1), 'UNBUFFERED');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$new_user = $adderror ? $new_user : '';
|
||||
}
|
||||
|
||||
$new_user = dhtmlspecialchars($new_user);
|
||||
$suser = isset($_GET['suser']) ? trim($_GET['suser']) : '';
|
||||
if(submitcheck('searchsubmit')) {
|
||||
if($suser != '') {
|
||||
$suid = C::t('common_member')->fetch_uid_by_username($suser);
|
||||
}
|
||||
}
|
||||
$suser = dhtmlspecialchars($suser);
|
||||
|
||||
$page = max(1, intval($_G['page']));
|
||||
$ppp = 10;
|
||||
$list = array('pagelink' => '', 'data' => array());
|
||||
|
||||
if($num = C::t('forum_access')->fetch_all_by_fid_uid($_G['fid'], $suid, 1)) {
|
||||
|
||||
$page = $page > ceil($num / $ppp) ? ceil($num / $ppp) : $page;
|
||||
$start_limit = ($page - 1) * $ppp;
|
||||
$list['pagelink'] = multi($num, $ppp, $page, "forum.php?mod=modcp&fid={$_G['fid']}&action={$_GET['action']}");
|
||||
|
||||
$query = C::t('forum_access')->fetch_all_by_fid_uid($_G['fid'], $suid, 0, $start_limit, $ppp);
|
||||
$uidarray = array();
|
||||
foreach($query as $access) {
|
||||
$uidarray[$access['uid']] = $access['uid'];
|
||||
$uidarray[$access['adminuser']] = $access['adminuser'];
|
||||
$access['allowview'] = accessimg($access['allowview']);
|
||||
$access['allowpost'] = accessimg($access['allowpost']);
|
||||
$access['allowreply'] = accessimg($access['allowreply']);
|
||||
$access['allowpostattach'] = accessimg($access['allowpostattach']);
|
||||
$access['allowgetattach'] = accessimg($access['allowgetattach']);
|
||||
$access['allowgetimage'] = accessimg($access['allowgetimage']);
|
||||
$access['allowpostimage'] = accessimg($access['allowpostimage']);
|
||||
$access['dateline'] = dgmdate($access['dateline'], 'd');
|
||||
$access['forum'] = '<a href="forum.php?mod=forumdisplay&fid='.$access['fid'].'" target="_blank">'.strip_tags($_G['cache']['forums'][$access['fid']]['name']).'</a>';
|
||||
$list['data'][] = $access;
|
||||
}
|
||||
|
||||
$users = array();
|
||||
if($uids = dimplode($uidarray)) {
|
||||
$users = C::t('common_member')->fetch_all_username_by_uid($uidarray);
|
||||
}
|
||||
}
|
||||
|
||||
function delete_access($uid, $fid) {
|
||||
C::t('forum_access')->delete_by_fid($fid, $uid);
|
||||
$mask = C::t('forum_access')->count_by_uid($uid);
|
||||
if(!$mask) {
|
||||
C::t('common_member')->update($uid, array('accessmasks' => ''), 'UNBUFFERED');
|
||||
}
|
||||
}
|
||||
|
||||
function accessimg($access) {
|
||||
return $access == -1 ? '<i class="fico-remove_circle fc-i"></i>' :
|
||||
($access == 1 ? '<i class="fico-check_right fc-v"></i>' : '<i class="fico-stars fc-p"></i>');
|
||||
}
|
||||
|
||||
function inwhitelist($access) {
|
||||
$return = false;
|
||||
foreach (array('allowview', 'allowpost', 'allowreply', 'allowpostattach', 'allowgetattach', 'allowgetimage') as $key) {
|
||||
if($access[$key] == 1) {
|
||||
$return = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
?>
|
56
source/include/modcp/modcp_home.php
Normal file
56
source/include/modcp/modcp_home.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_home.php 25246 2011-11-02 03:34:53Z zhangguosheng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
|
||||
if($op == 'addnote' && submitcheck('submit')) {
|
||||
$newaccess = 4 + ($_GET['newaccess'][2] << 1) + $_GET['newaccess'][3];
|
||||
$newexpiration = TIMESTAMP + (intval($_GET['newexpiration']) > 0 ? intval($_GET['newexpiration']) : 30) * 86400;
|
||||
$newmessage = nl2br(dhtmlspecialchars(trim($_GET['newmessage'])));
|
||||
if($newmessage != '') {
|
||||
C::t('common_adminnote')->insert(array(
|
||||
'admin' => $_G['username'],
|
||||
'access' => $newaccess,
|
||||
'adminid' => $_G['adminid'],
|
||||
'dateline' => $_G['timestamp'],
|
||||
'expiration' => $newexpiration,
|
||||
'message' => $newmessage,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if($op == 'delete' && submitcheck('notlistsubmit')) {
|
||||
if(is_array($_GET['delete']) && $deleteids = dimplode($_GET['delete'])) {
|
||||
C::t('common_adminnote')->delete_note($_GET['delete'], ($_G['adminid'] == 1 ? '' : $_G['username']));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
$notelist = array();
|
||||
foreach(C::t('common_adminnote')->fetch_all_by_access(explode(',', $access)) as $note) {
|
||||
if($note['expiration'] < TIMESTAMP) {
|
||||
C::t('common_adminnote')->delete_note($note['id']);
|
||||
} else {
|
||||
$note['expiration'] = ceil(($note['expiration'] - $note['dateline']) / 86400);
|
||||
$note['dateline'] = dgmdate($note['dateline']);
|
||||
$note['checkbox'] = '<input type="checkbox" name="delete[]" class="pc" '.($note['admin'] == $_G['member']['username'] || $_G['adminid'] == 1 ? "value=\"{$note['id']}\"" : 'disabled').'>';
|
||||
$note['admin'] = '<a href="home.php?mod=space&username='.rawurlencode($note['admin']).'" target="_blank">'.$note['admin'].'</a>';
|
||||
$notelist[] = $note;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
97
source/include/modcp/modcp_log.php
Normal file
97
source/include/modcp/modcp_log.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_log.php 25246 2011-11-02 03:34:53Z zhangguosheng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
if(!isset($_G['cache']['forums'])) {
|
||||
loadcache('forums');
|
||||
}
|
||||
|
||||
$language = lang('forum/misc');
|
||||
$lpp = empty($_GET['lpp']) ? 20 : intval($_GET['lpp']);
|
||||
$lpp = min(200, max(5, $lpp));
|
||||
$logdir = DISCUZ_ROOT.'./data/log/';
|
||||
$logfiles = get_log_files($logdir, 'modcp');
|
||||
|
||||
$logs = array();
|
||||
foreach($logfiles as $logfile) {
|
||||
$logs = array_merge($logs, file($logdir.$logfile));
|
||||
}
|
||||
|
||||
$page = max(1, intval($_G['page']));
|
||||
$start = ($page - 1) * $lpp;
|
||||
$logs = array_reverse($logs);
|
||||
|
||||
if(!empty($_GET['keyword'])) {
|
||||
foreach($logs as $key => $value) {
|
||||
if(strpos($value, $_GET['keyword']) === FALSE) {
|
||||
unset($logs[$key]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$_GET['keyword'] = '';
|
||||
}
|
||||
|
||||
$num = count($logs);
|
||||
$multipage = multi($num, $lpp, $page, "$cpscript?mod=modcp&action=log&lpp=$lpp&keyword=".rawurlencode($_GET['keyword']));
|
||||
$logs = array_slice($logs, $start, $lpp);
|
||||
$keyword = isset($_GET['keyword']) ? dhtmlspecialchars($_GET['keyword']) : '';
|
||||
|
||||
$usergroup = array();
|
||||
|
||||
$filters = '';
|
||||
|
||||
$loglist = array();
|
||||
|
||||
foreach($logs as $logrow) {
|
||||
$log = explode("\t", $logrow);
|
||||
if(empty($log[1])) {
|
||||
continue;
|
||||
}
|
||||
$log[1] = dgmdate($log[1], 'y-n-j H:i');
|
||||
if(strtolower($log[2]) == strtolower($_G['member']['username'])) {
|
||||
$log[2] = '<a href="home.php?mod=space&username='.rawurlencode($log[2]).'" target="_blank"><b>'.$log[2].'</b></a>';
|
||||
}
|
||||
|
||||
$log[5] = trim($log[5]);
|
||||
$check = 'modcp_logs_action_'.$log[5];
|
||||
$log[5] = isset($language[$check]) ? $language[$check] : $log[5];
|
||||
|
||||
$log[7] = intval($log[7]);
|
||||
$log[7] = !empty($log[7]) ? '<a href="forum.php?mod=forumdisplay&fid='.$log[7].'" target="_blank">'.strip_tags("{$_G['cache']['forums'][$log[7]]['name']}").'</a>' : '';
|
||||
|
||||
$log[8] = str_replace(array('GET={};', 'POST={};', 'mod=modcp;', 'action='.$log[5].';', 'diy=;', 'op='.$log[6].';'), '', $log[8]);
|
||||
$log[8] = cutstr($log['8'], 60);
|
||||
|
||||
$loglist[] = $log;
|
||||
}
|
||||
|
||||
function get_log_files($logdir='', $action='action') {
|
||||
$dir = opendir($logdir);
|
||||
$files = array();
|
||||
while($entry = readdir($dir)) {
|
||||
$files[] = $entry;
|
||||
}
|
||||
closedir($dir);
|
||||
|
||||
sort($files);
|
||||
$logfile = $action;
|
||||
$logfiles = array();
|
||||
foreach($files as $file) {
|
||||
if(strpos($file, $logfile) !== FALSE) {
|
||||
$logfiles[] = $file;
|
||||
}
|
||||
}
|
||||
$logfiles = array_slice($logfiles, -2, 2);
|
||||
return $logfiles;
|
||||
}
|
||||
|
||||
?>
|
15
source/include/modcp/modcp_login.php
Normal file
15
source/include/modcp/modcp_login.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_login.php 6752 2010-03-25 08:47:54Z cnteacher $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
|
||||
?>
|
303
source/include/modcp/modcp_member.php
Normal file
303
source/include/modcp/modcp_member.php
Normal file
@@ -0,0 +1,303 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_member.php 33701 2013-08-06 05:04:36Z nemohou $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
if($op == 'edit') {
|
||||
|
||||
$_GET['uid'] = isset($_GET['uid']) ? intval($_GET['uid']) : '';
|
||||
$_GET['username'] = isset($_GET['username']) ? trim($_GET['username']) : '';
|
||||
|
||||
$member = loadmember($_GET['uid'], $_GET['username'], $error);
|
||||
$usernameenc = $member ? rawurlencode($member['username']) : '';
|
||||
|
||||
if($member && submitcheck('editsubmit') && !$error) {
|
||||
|
||||
if($_G['group']['allowedituser']) {
|
||||
|
||||
if(!empty($_GET['clearavatar'])) {
|
||||
loaducenter();
|
||||
uc_user_deleteavatar($member['uid']);
|
||||
}
|
||||
|
||||
require_once libfile('function/discuzcode');
|
||||
|
||||
if($_GET['bionew']) {
|
||||
$biohtmlnew = nl2br(dhtmlspecialchars($_GET['bionew']));
|
||||
} else {
|
||||
$biohtmlnew = '';
|
||||
}
|
||||
|
||||
if($_GET['signaturenew']) {
|
||||
$signaturenew = censor($_GET['signaturenew']);
|
||||
$sightmlnew = discuzcode($signaturenew, 1, 0, 0, 0, $member['allowsigbbcode'], $member['allowsigimgcode'], 0, 0, 1);
|
||||
} else {
|
||||
$sightmlnew = $signaturenew = '';
|
||||
}
|
||||
|
||||
!empty($_GET['locationnew']) && $locationnew = dhtmlspecialchars($_GET['locationnew']);
|
||||
|
||||
if($_G['setting']['profilehistory']) {
|
||||
C::t('common_member_profile_history')->insert(array_merge(C::t('common_member_profile')->fetch(intval($member['uid'])), array('dateline' => time())));
|
||||
}
|
||||
C::t('common_member_profile')->update($member['uid'], array('bio' => $biohtmlnew));
|
||||
C::t('common_member_field_forum')->update($member['uid'], array('sightml' => $sightmlnew));
|
||||
}
|
||||
acpmsg('members_edit_succeed', "$cpscript?mod=modcp&action={$_GET['action']}&op=$op");
|
||||
|
||||
} elseif($member) {
|
||||
|
||||
require_once libfile('function/editor');
|
||||
$bio = explode("\t\t\t", $member['bio']);
|
||||
$member['bio'] = html2bbcode($bio[0]);
|
||||
$member['biotrade'] = !empty($bio[1]) ? html2bbcode($bio[1]) : '';
|
||||
$member['signature'] = html2bbcode($member['sightml']);
|
||||
$username = !empty($_GET['username']) ? $member['username'] : '';
|
||||
|
||||
}
|
||||
|
||||
} elseif($op == 'ban' && ($_G['group']['allowbanuser'] || $_G['group']['allowbanvisituser'])) {
|
||||
|
||||
$_GET['uid'] = isset($_GET['uid']) ? intval($_GET['uid']) : '';
|
||||
$_GET['username'] = isset($_GET['username']) ? trim($_GET['username']) : '';
|
||||
$member = loadmember($_GET['uid'], $_GET['username'], $error);
|
||||
$usernameenc = $member ? rawurlencode($member['username']) : '';
|
||||
|
||||
include_once libfile('function/member');
|
||||
$clist = crime('getactionlist', $member['uid']);
|
||||
|
||||
if(($member['type'] == 'system' && in_array($member['groupid'], array(1, 2, 3, 6, 7, 8))) || $member['type'] == 'special') {
|
||||
acpmsg('modcp_member_ban_illegal');
|
||||
}
|
||||
|
||||
if($member && submitcheck('bansubmit') && !$error) {
|
||||
$setarr = array();
|
||||
$reason = dhtmlspecialchars(trim($_GET['reason']));
|
||||
if(!$reason && ($_G['group']['reasonpm'] == 1 || $_G['group']['reasonpm'] == 3)) {
|
||||
acpmsg('admin_reason_invalid');
|
||||
}
|
||||
|
||||
if($_GET['bannew'] == 4 || $_GET['bannew'] == 5) {
|
||||
if($_GET['bannew'] == 4 && !$_G['group']['allowbanuser'] || $_GET['bannew'] == 5 && !$_G['group']['allowbanvisituser']) {
|
||||
acpmsg('admin_nopermission');
|
||||
}
|
||||
$groupidnew = $_GET['bannew'];
|
||||
$banexpirynew = !empty($_GET['banexpirynew']) ? TIMESTAMP + $_GET['banexpirynew'] * 86400 : 0;
|
||||
$banexpirynew = $banexpirynew > TIMESTAMP ? $banexpirynew : 0;
|
||||
if($banexpirynew) {
|
||||
$member['groupterms'] = $member['groupterms'] && is_array($member['groupterms']) ? $member['groupterms'] : array();
|
||||
if($member['groupid'] == 4 || $member['groupid'] == 5) {
|
||||
$member['groupterms']['main']['time'] = $banexpirynew;
|
||||
if (empty($member['groupterms']['main']['groupid'])) {
|
||||
$groupnew = C::t('common_usergroup')->fetch_by_credits($member['credits']);
|
||||
$member['groupterms']['main']['groupid'] = $groupnew['groupid'];
|
||||
}
|
||||
if (!isset($member['groupterms']['main']['adminid'])) {
|
||||
$member['groupterms']['main']['adminid'] = $member['adminid'];
|
||||
}
|
||||
}else{
|
||||
$member['groupterms']['main'] = array('time' => $banexpirynew, 'adminid' => $member['adminid'], 'groupid' => $member['groupid']);
|
||||
}
|
||||
$member['groupterms']['ext'][$groupidnew] = $banexpirynew;
|
||||
$setarr['groupexpiry'] = groupexpiry($member['groupterms']);
|
||||
} else {
|
||||
$setarr['groupexpiry'] = 0;
|
||||
}
|
||||
if(in_array($member['adminid'], array(0, -1))) {
|
||||
$member_status = C::t('common_member_status')->fetch($member['uid']);
|
||||
}
|
||||
$adminidnew = -1;
|
||||
C::t('forum_postcomment')->delete_by_authorid($member['uid'], false, true);
|
||||
} elseif($member['groupid'] == 4 || $member['groupid'] == 5) {
|
||||
if(!empty($member['groupterms']['main']['groupid'])) {
|
||||
$groupidnew = $member['groupterms']['main']['groupid'];
|
||||
$adminidnew = $member['groupterms']['main']['adminid'];
|
||||
unset($member['groupterms']['main']);
|
||||
unset($member['groupterms']['ext'][$member['groupid']]);
|
||||
$setarr['groupexpiry'] = groupexpiry($member['groupterms']);
|
||||
} else {
|
||||
$usergroup = C::t('common_usergroup')->fetch_by_credits($member['credits']);
|
||||
$groupidnew = $usergroup['groupid'];
|
||||
$adminidnew = 0;
|
||||
}
|
||||
} else {
|
||||
$groupidnew = $member['groupid'];
|
||||
$adminidnew = $member['adminid'];
|
||||
}
|
||||
|
||||
$setarr['adminid'] = $adminidnew;
|
||||
$setarr['groupid'] = $groupidnew;
|
||||
C::t('common_member')->update($member['uid'], $setarr);
|
||||
|
||||
if(DB::affected_rows()) {
|
||||
savebanlog($member['username'], $member['groupid'], $groupidnew, $banexpirynew, $reason);
|
||||
}
|
||||
|
||||
C::t('common_member_field_forum')->update($member['uid'], array('groupterms' => serialize($member['groupterms'])));
|
||||
if($_GET['bannew'] == 4) {
|
||||
$notearr = array(
|
||||
'user' => "<a href=\"home.php?mod=space&uid={$_G['uid']}\">{$_G['username']}</a>",
|
||||
'day' => $_GET['banexpirynew'],
|
||||
'reason' => $reason,
|
||||
'from_id' => 0,
|
||||
'from_idtype' => 'banspeak'
|
||||
);
|
||||
notification_add($member['uid'], 'system', 'member_ban_speak', $notearr, 1);
|
||||
}
|
||||
if($_GET['bannew'] == 5) {
|
||||
$notearr = array(
|
||||
'user' => "<a href=\"home.php?mod=space&uid={$_G['uid']}\">{$_G['username']}</a>",
|
||||
'day' => $_GET['banexpirynew'],
|
||||
'reason' => $reason,
|
||||
'from_id' => 0,
|
||||
'from_idtype' => 'banvisit'
|
||||
);
|
||||
notification_add($member['uid'], 'system', 'member_ban_visit', $notearr, 1);
|
||||
}
|
||||
|
||||
if($_GET['bannew'] == 4 || $_GET['bannew'] == 5) {
|
||||
crime('recordaction', $member['uid'], ($_GET['bannew'] == 4 ? 'crime_banspeak' : 'crime_banvisit'), $reason);
|
||||
}
|
||||
|
||||
acpmsg('modcp_member_ban_succeed', "$cpscript?mod=modcp&action={$_GET['action']}&op=$op");
|
||||
|
||||
}
|
||||
|
||||
} elseif($op == 'ipban' && $_G['group']['allowbanip']) {
|
||||
|
||||
if (array_key_exists('security', $_G['config']) && array_key_exists('useipban', $_G['config']['security']) && $_G['config']['security']['useipban'] == 0) {
|
||||
acpmsg('admin_nopermission');
|
||||
}
|
||||
|
||||
require_once libfile('function/misc');
|
||||
$iptoban = getgpc('ip') ? dhtmlspecialchars(getgpc('ip')) : '';
|
||||
$updatecheck = $addcheck = $deletecheck = $adderror = 0;
|
||||
|
||||
if(submitcheck('ipbansubmit')) {
|
||||
$_GET['delete'] = isset($_GET['delete']) ? $_GET['delete'] : '';
|
||||
if($_GET['delete']) {
|
||||
$deletecheck = C::t('common_banned')->delete_by_id($_GET['delete'], $_G['adminid'], $_G['username']);
|
||||
}
|
||||
if($_GET['ipnew']) {
|
||||
$addcheck = ipbanadd($_GET['ipnew'], $_GET['validitynew'], $adderror);
|
||||
if(!$addcheck) {
|
||||
$iptoban = $_GET['ipnew'];
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_GET['expirationnew']) && is_array($_GET['expirationnew'])) {
|
||||
foreach($_GET['expirationnew'] as $id => $expiration) {
|
||||
if($expiration === intval($expiration)) {
|
||||
$expiration = $expiration > 1 ? (TIMESTAMP + $expiration * 86400) : TIMESTAMP + 86400;
|
||||
$updatecheck = C::t('common_banned')->update_expiration_by_id($id, $expiration, $_G['adminid'], $_G['username']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$iplist = array();
|
||||
foreach(C::t('common_banned')->fetch_all_order_dateline() as $banned) {
|
||||
for($i = 1; $i <= 4; $i++) {
|
||||
if($banned["ip$i"] == -1) {
|
||||
$banned["ip$i"] = '*';
|
||||
}
|
||||
}
|
||||
$banned['disabled'] = $_G['adminid'] != 1 && $banned['admin'] != $_G['member']['username'] ? 'disabled' : '';
|
||||
$banned['dateline'] = dgmdate($banned['dateline'], 'd');
|
||||
$banned['expiration'] = dgmdate($banned['expiration'], 'd');
|
||||
$banned['theip'] = $banned['ip'];
|
||||
$banned['location'] = convertip($banned['theip']);
|
||||
$iplist[$banned['id']] = $banned;
|
||||
}
|
||||
|
||||
} else {
|
||||
showmessage('undefined_action');
|
||||
}
|
||||
|
||||
function loadmember(&$uid, &$username, &$error) {
|
||||
global $_G;
|
||||
|
||||
$uid = !empty($_GET['uid']) && is_numeric($_GET['uid']) && $_GET['uid'] > 0 ? $_GET['uid'] : '';
|
||||
$username = isset($_GET['username']) && $_GET['username'] != '' ? dhtmlspecialchars(trim($_GET['username'])) : '';
|
||||
|
||||
$member = array();
|
||||
|
||||
if($uid || $username != '') {
|
||||
|
||||
$member = $uid ? getuserbyuid($uid) : C::t('common_member')->fetch_by_username($username);
|
||||
if($member) {
|
||||
$uid = $member['uid'];
|
||||
$member = array_merge($member, C::t('common_member_field_forum')->fetch($uid), C::t('common_member_profile')->fetch($uid),
|
||||
C::t('common_usergroup')->fetch($member['groupid']), C::t('common_usergroup_field')->fetch($member['groupid']));
|
||||
}
|
||||
if(!$member) {
|
||||
$error = 2;
|
||||
} elseif(($member['grouptype'] == 'system' && in_array($member['groupid'], array(1, 2, 3, 6, 7, 8))) || in_array($member['adminid'], array(1,2,3))) {
|
||||
$error = 3;
|
||||
} else {
|
||||
$member['groupterms'] = dunserialize($member['groupterms']);
|
||||
$member['banexpiry'] = !empty($member['groupterms']['main']['time']) && ($member['groupid'] == 4 || $member['groupid'] == 5) ? dgmdate($member['groupterms']['main']['time'], 'Y-n-j') : '';
|
||||
$error = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
$error = 1;
|
||||
}
|
||||
return $member;
|
||||
}
|
||||
|
||||
function ipbanadd($ipnew, $validitynew, &$error) {
|
||||
global $_G;
|
||||
|
||||
if($ipnew != '') {
|
||||
$ipnew = ip::to_ip($ipnew);
|
||||
$is_cidr = ip::validate_cidr($ipnew, $ipnew);
|
||||
if (!ip::validate_ip($ipnew) && !$is_cidr) {
|
||||
$error = 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if($_G['adminid'] != 1 && $is_cidr) {
|
||||
$error = 2;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(ip::check_ip($_G['clientip'], $ipnew)) {
|
||||
$error = 3;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if($banned = C::t('common_banned')->fetch_by_ip($ipnew)) {
|
||||
$error = 3;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$expiration = $validitynew > 1 ? (TIMESTAMP + $validitynew * 86400) : TIMESTAMP + 86400;
|
||||
list($lower, $upper) = ip::calc_cidr_range($ipnew, true);
|
||||
$data = array(
|
||||
'ip' => $ipnew,
|
||||
'lowerip' => $lower,
|
||||
'upperip' => $upper,
|
||||
'admin' => $_G['username'],
|
||||
'dateline' => $_G['timestamp'],
|
||||
'expiration' => $expiration
|
||||
);
|
||||
C::t('common_banned')->insert($data);
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
?>
|
673
source/include/modcp/modcp_moderate.php
Normal file
673
source/include/modcp/modcp_moderate.php
Normal file
@@ -0,0 +1,673 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_moderate.php 32077 2012-11-07 04:38:04Z liulanbo $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
if(!$_G['setting']['forumstatus'] && $op != 'members') {
|
||||
showmessage('forum_status_off');
|
||||
}
|
||||
|
||||
$modact = empty($_GET['modact']) || !in_array($_GET['modact'] , array('delete', 'ignore', 'validate')) ? 'ignore' : $_GET['modact'];
|
||||
|
||||
if($op == 'members') {
|
||||
|
||||
$filter = isset($_GET['filter']) ? intval($_GET['filter']) : 0;
|
||||
$filtercheck = array('', '', '');
|
||||
$filtercheck[$filter] = 'selected';
|
||||
|
||||
if(submitcheck('dosubmit', 1) || submitcheck('modsubmit')) {
|
||||
|
||||
if(empty($modact) || !in_array($modact, array('ignore', 'validate', 'delete'))) {
|
||||
showmessage('modcp_noaction');
|
||||
}
|
||||
|
||||
$list = array();
|
||||
if($_GET['moderate'] && is_array($_GET['moderate'])) {
|
||||
foreach($_GET['moderate'] as $val) {
|
||||
if(is_numeric($val) && $val) {
|
||||
$list[] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(submitcheck('dosubmit', 1)) {
|
||||
|
||||
$_GET['handlekey'] = 'mods';
|
||||
include template('forum/modcp_moderate_float');
|
||||
dexit();
|
||||
|
||||
} elseif ($uids = $list) {
|
||||
|
||||
$members = $uidarray = array();
|
||||
|
||||
|
||||
$member_validate = C::t('common_member_validate')->fetch_all($uids);
|
||||
foreach(C::t('common_member')->fetch_all($uids, false, 0) as $uid => $member) {
|
||||
if(($member['groupid'] == 8 || (in_array($member['freeze'], array(-1, 2)) && $modact != 'delete')) && $member['status'] == $filter) {
|
||||
$members[$uid] = array_merge((array)$member_validate[$uid], $member);
|
||||
}
|
||||
}
|
||||
if(($uids = array_keys($members))) {
|
||||
|
||||
$reason = dhtmlspecialchars(trim($_GET['reason']));
|
||||
|
||||
if($_GET['modact'] == 'delete') {
|
||||
C::t('common_member')->delete_no_validate($uids);
|
||||
}
|
||||
|
||||
if($_GET['modact'] == 'validate') {
|
||||
C::t('common_member')->update($uids, array('adminid' => '0', 'groupid' => $_G['setting']['newusergroupid'], 'freeze' => 0));
|
||||
C::t('common_member_validate')->delete($uids);
|
||||
}
|
||||
|
||||
if($_GET['modact'] == 'ignore') {
|
||||
C::t('common_member_validate')->update($uids, array('moddate' => $_G['timestamp'], 'admin' => $_G['username'], 'status' => '1', 'remark' => $reason));
|
||||
}
|
||||
|
||||
$sendemail = isset($_GET['sendemail']) ? $_GET['sendemail'] : 0;
|
||||
if($sendemail) {
|
||||
if(!function_exists('sendmail')) {
|
||||
include libfile('function/mail');
|
||||
}
|
||||
foreach($members as $uid => $member) {
|
||||
$member['regdate'] = dgmdate($member['regdate']);
|
||||
$member['submitdate'] = dgmdate($member['submitdate']);
|
||||
$member['moddate'] = dgmdate(TIMESTAMP);
|
||||
$member['operation'] = $_GET['modact'];
|
||||
$member['remark'] = $reason ? $reason : 'N/A';
|
||||
$moderate_member_message = array(
|
||||
'tpl' => 'moderate_member',
|
||||
'var' => array(
|
||||
'username' => $member['username'],
|
||||
'bbname' => $_G['setting']['bbname'],
|
||||
'regdate' => $member['regdate'],
|
||||
'submitdate' => $member['submitdate'],
|
||||
'submittimes' => $member['submittimes'],
|
||||
'message' => $member['message'],
|
||||
'modresult' => lang('email', 'moderate_member_'.$member['operation']),
|
||||
'moddate' => $member['moddate'],
|
||||
'adminusername' => $_G['member']['username'],
|
||||
'remark' => $member['remark'],
|
||||
'siteurl' => $_G['siteurl'],
|
||||
)
|
||||
);
|
||||
if(!sendmail("{$member['username']} <{$member['email']}>", $moderate_member_message)) {
|
||||
runlog('sendmail', "{$member['email']} sendmail failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
showmessage('modcp_moduser_invalid');
|
||||
}
|
||||
|
||||
showmessage('modcp_mod_succeed', "{$cpscript}?mod=modcp&action={$_GET['action']}&op=$op&filter=$filter");
|
||||
|
||||
} else {
|
||||
showmessage('modcp_moduser_invalid');
|
||||
}
|
||||
|
||||
} else {
|
||||
$count = C::t('common_member_validate')->fetch_all_status_by_count();
|
||||
|
||||
$page = max(1, intval($_G['page']));
|
||||
$_G['setting']['memberperpage'] = 20;
|
||||
$start_limit = ($page - 1) * $_G['setting']['memberperpage'];
|
||||
|
||||
$multipage = multi($count[$filter], $_G['setting']['memberperpage'], $page, "{$cpscript}?mod=modcp&action={$_GET['action']}&op=$op&fid={$_G['fid']}&filter=$filter");
|
||||
|
||||
$vuids = array();
|
||||
$memberlist = $member_validate = $common_member = $member_status = array();
|
||||
if(($member_validate = C::t('common_member_validate')->fetch_all_by_status($filter, $start_limit, $_G['setting']['memberperpage']))) {
|
||||
$uids = array_keys($member_validate);
|
||||
$common_member = C::t('common_member')->fetch_all($uids, false, 0);
|
||||
$member_status = C::t('common_member_status')->fetch_all($uids, false, 0);
|
||||
}
|
||||
foreach($member_validate as $uid => $member) {
|
||||
$member = array_merge($member, (array)$common_member[$uid], (array)$member_status[$uid]);
|
||||
if($member['groupid'] != 8 && !in_array($member['freeze'], array(-1, 2))) {
|
||||
$vuids[] = $member['uid'];
|
||||
continue;
|
||||
}
|
||||
$member['regdate'] = dgmdate($member['regdate']);
|
||||
$member['submitdate'] = dgmdate($member['submitdate']);
|
||||
$member['moddate'] = $member['moddate'] ? dgmdate($member['moddate']) : $lang['none'];
|
||||
$member['message'] = dhtmlspecialchars($member['message']);
|
||||
$member['admin'] = $member['admin'] ? "<a href=\"home.php?mod=space&username=".rawurlencode($member['admin'])."\" target=\"_blank\">{$member['admin']}</a>" : $lang['none'];
|
||||
$memberlist[] = $member;
|
||||
}
|
||||
if($vuids) {
|
||||
C::t('common_member_validate')->delete($vuids, 'UNBUFFERED');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($modforums['fids'])) {
|
||||
return false;
|
||||
} elseif($_G['fid'] && ($_G['forum']['type'] == 'group' || !$_G['forum']['ismoderator'])) {
|
||||
return false;
|
||||
} else {
|
||||
$modfids = "";
|
||||
if($_G['fid']) {
|
||||
$modfids = $_G['fid'];
|
||||
$modfidsadd = "fid='{$_G['fid']}'";
|
||||
} elseif($_G['adminid'] == 1) {
|
||||
$modfidsadd = "";
|
||||
} else {
|
||||
$modfids = $modforums['fids'];
|
||||
$modfidsadd = "fid in ({$modforums['fids']})";
|
||||
}
|
||||
}
|
||||
|
||||
$updatestat = false;
|
||||
|
||||
$op = !in_array($op , array('replies', 'threads')) ? 'threads' : $op;
|
||||
|
||||
$filter = !empty($_GET['filter']) ? -3 : 0;
|
||||
$filtercheck = array(0 => '', '-3' => '');
|
||||
$filtercheck[$filter] = 'selected="selected"';
|
||||
|
||||
$pstat = $filter == -3 ? -3 : -2;
|
||||
$moderatestatus = $filter == -3 ? 1 : 0;
|
||||
|
||||
$tpp = 10;
|
||||
$page = max(1, intval($_G['page']));
|
||||
$start_limit = ($page - 1) * $tpp;
|
||||
|
||||
$postlist = array();
|
||||
$posttableselect = '';
|
||||
|
||||
$modpost = array('validate' => 0, 'delete' => 0, 'ignore' => 0);
|
||||
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
|
||||
|
||||
require_once libfile('function/post');
|
||||
|
||||
if(submitcheck('dosubmit', 1) || submitcheck('modsubmit')) {
|
||||
|
||||
$list = array();
|
||||
if($_GET['moderate'] && is_array($_GET['moderate'])) {
|
||||
foreach($_GET['moderate'] as $val) {
|
||||
if(is_numeric($val) && $val) {
|
||||
$moderation[$modact][] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(submitcheck('modsubmit')) {
|
||||
|
||||
$updatestat = $op == 'replies' ? 1 : 2;
|
||||
$modpost = array(
|
||||
'ignore' => count($moderation['ignore']),
|
||||
'delete' => count($moderation['delete']),
|
||||
'validate' => count($moderation['validate'])
|
||||
);
|
||||
} elseif(submitcheck('dosubmit', 1)) {
|
||||
$_GET['handlekey'] = 'mods';
|
||||
$list = $moderation[$modact];
|
||||
include template('forum/modcp_moderate_float');
|
||||
dexit();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if($op == 'replies') {
|
||||
$posttableid = intval($_GET['posttableid']);
|
||||
$posttable = getposttable($posttableid);
|
||||
|
||||
$posttableselect = getposttableselect();
|
||||
|
||||
if(submitcheck('modsubmit')) {
|
||||
|
||||
$pmlist = array();
|
||||
if($ignorepids = dimplode($moderation['ignore'])) {
|
||||
C::t('forum_post')->update_post($posttableid, $moderation['ignore'], array('invisible' => -3), true, false, 0, -2, ($modfids ? explode(',', $modfids) : null));
|
||||
updatemoderate('pid', $moderation['ignore'], 1);
|
||||
}
|
||||
|
||||
if($deletepids = dimplode($moderation['delete'])) {
|
||||
$deleteauthorids = array();
|
||||
$recyclebinpids = array();
|
||||
$pids = array();
|
||||
foreach(C::t('forum_post')->fetch_all_post($posttableid, $moderation['delete']) as $post) {
|
||||
if($post['invisible'] != $pstat || $post['first'] != 0 || ($modfids ? !in_array($post['fid'], explode(',', $modfids)) : 0)) {
|
||||
continue;
|
||||
}
|
||||
if($modforums['recyclebins'][$post['fid']]) {
|
||||
$recyclebinpids[] = $post['pid'];
|
||||
} else {
|
||||
$pids[] = $post['pid'];
|
||||
}
|
||||
if($post['authorid'] && $post['authorid'] != $_G['uid']) {
|
||||
$pmlist[] = array(
|
||||
'act' => $_GET['reason'] ? 'modreplies_delete_reason' : 'modreplies_delete',
|
||||
'notevar' => array('modusername' => ($_G['setting']['moduser_public'] ? $_G['username'] : ''), 'reason' => dhtmlspecialchars($_GET['reason']), 'post' => messagecutstr($post['message'], 30)),
|
||||
'authorid' => $post['authorid'],
|
||||
);
|
||||
}
|
||||
if($_GET['crimerecord']) {
|
||||
require_once libfile('function/member');
|
||||
crime('recordaction', $post['authorid'], 'crime_delpost', lang('forum/misc', 'crime_postreason', array('reason' => dhtmlspecialchars($_GET['reason']), 'tid' => $post['tid'], 'pid' => $post['pid'])));
|
||||
}
|
||||
$deleteauthorids[$post['authorid']] = $post['authorid'];
|
||||
}
|
||||
|
||||
if($recyclebinpids) {
|
||||
C::t('forum_post')->update_post($posttableid, $recyclebinpids, array('invisible' => '-5'), true);
|
||||
}
|
||||
|
||||
if($pids) {
|
||||
require_once libfile('function/delete');
|
||||
deletepost($pids, 'pid', false, $posttableid);
|
||||
}
|
||||
|
||||
if($_G['group']['allowbanuser'] && ($_GET['banuser'] || $_GET['userdelpost']) && $deleteauthorids) {
|
||||
$members = C::t('common_member')->fetch_all($deleteauthorids);
|
||||
$banuins = array();
|
||||
foreach($members as $member) {
|
||||
if(($_G['cache']['usergroups'][$member['groupid']]['type'] == 'system' &&
|
||||
in_array($member['groupid'], array(1, 2, 3, 6, 7, 8))) || $_G['cache']['usergroups'][$member['groupid']]['type'] == 'special') {
|
||||
continue;
|
||||
}
|
||||
$banuins[$member['uid']] = $member['uid'];
|
||||
}
|
||||
|
||||
if($banuins) {
|
||||
if($_GET['banuser']) {
|
||||
C::t('common_member')->update($banuins, array('groupid' => 4));
|
||||
}
|
||||
|
||||
if($_GET['userdelpost']) {
|
||||
require_once libfile('function/delete');
|
||||
deletememberpost($banuins);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updatemodworks('DLP', count($moderation['delete']));
|
||||
updatemoderate('pid', $moderation['delete'], 2);
|
||||
}
|
||||
|
||||
$repliesmod = 0;
|
||||
if($validatepids = dimplode($moderation['validate'])) {
|
||||
|
||||
$threads = $lastpost = $attachments = $pidarray = array();
|
||||
$postlist = $tids = array();
|
||||
foreach(C::t('forum_post')->fetch_all_post($posttableid, $moderation['validate']) as $post) {
|
||||
if($post['invisible'] != $pstat || $post['first'] != '0' || ($modfids ? !in_array($post['fid'], explode(',', $modfids)) : 0)) {
|
||||
continue;
|
||||
}
|
||||
$tids[$post['tid']] = $post['tid'];
|
||||
$postlist[] = $post;
|
||||
}
|
||||
$threadlist = C::t('forum_thread')->fetch_all($tids);
|
||||
foreach($postlist as $post) {
|
||||
$post['lastpost'] = $threadlist[$post['tid']]['lastpost'];
|
||||
$repliesmod ++;
|
||||
$pidarray[] = $post['pid'];
|
||||
if(getstatus($post['status'], 3) == 0) {
|
||||
updatepostcredits('+', $post['authorid'], 'reply', $post['fid']);
|
||||
$attachcount = C::t('forum_attachment_n')->count_by_id('tid:'.$post['tid'], 'pid', $post['pid']);
|
||||
updatecreditbyaction('postattach', $post['authorid'], array(), '', $attachcount, 1, $post['fid']);
|
||||
}
|
||||
|
||||
$threads[$post['tid']]['posts']++;
|
||||
|
||||
if($post['dateline'] > $post['lastpost'] && $post['dateline'] > $lastpost[$post['tid']]) {
|
||||
$threads[$post['tid']]['lastpost'] = $post['dateline'];
|
||||
$threads[$post['tid']]['lastposter'] = $post['anonymous'] && $post['dateline'] != $post['lastpost'] ? '' : addslashes($post['author']);
|
||||
}
|
||||
if($threads[$post['tid']]['attachadd'] || $post['attachment']) {
|
||||
$threads[$post['tid']]['attachment'] = 1;
|
||||
}
|
||||
|
||||
$pm = 'pm_'.$post['pid'];
|
||||
if($post['authorid'] && $post['authorid'] != $_G['uid']) {
|
||||
$pmlist[] = array(
|
||||
'act' => 'modreplies_validate',
|
||||
'notevar' => array('modusername' => ($_G['setting']['moduser_public'] ? $_G['username'] : ''), 'reason' => dhtmlspecialchars($_GET['reason']), 'pid' => $post['pid'], 'tid' => $post['tid'], 'post' => messagecutstr($post['message'], 30), 'from_id' => 0, 'from_idtype' => 'modreplies'),
|
||||
'authorid' => $post['authorid'],
|
||||
);
|
||||
}
|
||||
}
|
||||
unset($postlist, $tids, $threadlist);
|
||||
foreach($threads as $tid => $thread) {
|
||||
$updatedata = array('replies'=>$thread['posts']);
|
||||
if(isset($thread['lastpost'])) {
|
||||
$updatedata['lastpost'] = array($thread['lastpost']);
|
||||
$updatedata['lastposter'] = array($thread['lastposter']);
|
||||
}
|
||||
if(isset($thread['attachment'])) {
|
||||
$updatedata['attachment'] = $thread['attachment'];
|
||||
}
|
||||
C::t('forum_thread')->increase($tid, $updatedata);
|
||||
}
|
||||
if($_G['fid']) {
|
||||
updateforumcount($_G['fid']);
|
||||
} else {
|
||||
$fids = array_keys($modforums['list']);
|
||||
foreach($fids as $f) {
|
||||
updateforumcount($f);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($pidarray)) {
|
||||
$pidarray[] = 0;
|
||||
$repliesmod = C::t('forum_post')->update_post($posttableid, $pidarray, array('invisible' => '0'), true);
|
||||
updatemodworks('MOD', $repliesmod);
|
||||
updatemoderate('pid', $pidarray, 2);
|
||||
} else {
|
||||
updatemodworks('MOD', 1);
|
||||
}
|
||||
}
|
||||
|
||||
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={$_GET['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 = C::t('common_moderate')->count_by_search_for_post($posttable, $moderatestatus, 0, ($modfids ? explode(',', $modfids) : null));
|
||||
$multipage = multi($modcount, $ppp, $page, "{$cpscript}?mod=modcp&action={$_GET['action']}&op=$op&filter=$filter&fid={$_G['fid']}&showcensor={$_GET['showcensor']}");
|
||||
|
||||
if($modcount) {
|
||||
|
||||
$attachtablearr = array();
|
||||
$_fids = array();
|
||||
foreach(C::t('common_moderate')->fetch_all_by_search_for_post($posttable, $moderatestatus, 0, ($modfids ? explode(',', $modfids) : null), null, null, null, $start_limit, $ppp) as $post) {
|
||||
$_fids[$post['fid']] = $post['fid'];
|
||||
$_tids[$post['tid']] = $post['tid'];
|
||||
$post['id'] = $post['pid'];
|
||||
$post['dateline'] = dgmdate($post['dateline']);
|
||||
$post['subject'] = $post['subject'] ? '<b>'.$post['subject'].'</b>' : '';
|
||||
$post['message'] = nl2br(dhtmlspecialchars($post['message']));
|
||||
|
||||
if(!empty($_GET['showcensor'])) {
|
||||
$censor = & discuz_censor::instance();
|
||||
$censor->highlight = '#FF0000';
|
||||
$censor->check($post['subject']);
|
||||
$censor->check($post['message']);
|
||||
$censor_words = $censor->words_found;
|
||||
if(count($censor_words) > 3) {
|
||||
$censor_words = array_slice($censor_words, 0, 3);
|
||||
}
|
||||
$post['censorwords'] = implode(', ', $censor_words);
|
||||
}
|
||||
|
||||
if($post['attachment']) {
|
||||
$attachtable = getattachtableid($post['tid']);
|
||||
$attachtablearr[$attachtable][$post['pid']] = $post['pid'];
|
||||
}
|
||||
$postlist[$post['pid']] = $post;
|
||||
}
|
||||
$_threads = $_forums = array();
|
||||
if($_fids) {
|
||||
$_forums = C::t('forum_forum')->fetch_all($_fids);
|
||||
foreach($postlist as &$_post) {
|
||||
$_forum = $_forums[$_post['fid']];
|
||||
$_arr = array(
|
||||
'forumname' => $_forum['name'],
|
||||
'allowsmilies' => $_forum['allowsmilies'],
|
||||
'allowhtml' => $_forum['allowhtml'],
|
||||
'allowbbcode' => $_forum['allowbbcode'],
|
||||
'allowimgcode' => $_forum['allowimgcode'],
|
||||
);
|
||||
$_post = array_merge($_post, $_arr);
|
||||
}
|
||||
}
|
||||
if($_tids) {
|
||||
$_threads = C::t('forum_thread')->fetch_all($_tids);
|
||||
foreach($postlist as &$_post) {
|
||||
$_post['tsubject'] = $_threads[$_post['tid']]['subject'];
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($attachtablearr)) {
|
||||
foreach($attachtablearr as $attachtable => $pids) {
|
||||
foreach(C::t('forum_attachment_n')->fetch_all_by_id($attachtable, 'pid', $pids) as $attach) {
|
||||
$_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 > 100) {this.resized=true; this.width=100;}\">"
|
||||
: "<a href=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (".sizecount($attach['filesize']).")";
|
||||
$postlist[$attach['pid']]['message'] .= "<br /><br />File: ".attachtype(fileext($attach['filename'])."\t").$attach['url'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if(submitcheck('modsubmit')) {
|
||||
if(!empty($moderation['ignore'])) {
|
||||
C::t('forum_thread')->update_by_tid_displayorder($moderation['ignore'], -2, array('displayorder'=>-3), ($modfids ? explode(',', $modfids) : null));
|
||||
updatemoderate('tid', $moderation['ignore'], 1);
|
||||
}
|
||||
$threadsmod = 0;
|
||||
$pmlist = array();
|
||||
$reason = trim($_GET['reason']);
|
||||
|
||||
if(!empty($moderation['delete'])) {
|
||||
$deleteauthorids = array();
|
||||
$deletetids = array();
|
||||
$recyclebintids = '0';
|
||||
foreach(C::t('forum_thread')->fetch_all_by_tid_displayorder($moderation['delete'], $pstat, '=', ($modfids ? explode(',', $modfids) : null)) as $thread) {
|
||||
if($modforums['recyclebins'][$thread['fid']]) {
|
||||
$recyclebintids .= ','.$thread['tid'];
|
||||
} else {
|
||||
$deletetids[] = $thread['tid'];
|
||||
}
|
||||
|
||||
if($thread['authorid'] && $thread['authorid'] != $_G['uid']) {
|
||||
$pmlist[] = array(
|
||||
'act' => $_GET['reason'] ? 'modthreads_delete_reason' : 'modthreads_delete',
|
||||
'notevar' => array('reason' => dhtmlspecialchars($_GET['reason']), 'threadsubject' => $thread['subject']),
|
||||
'authorid' => $thread['authorid'],
|
||||
);
|
||||
}
|
||||
|
||||
if($_GET['crimerecord']) {
|
||||
require_once libfile('function/member');
|
||||
crime('recordaction', $thread['authorid'], 'crime_delpost', lang('forum/misc', 'crime_postreason', array('reason' => dhtmlspecialchars($_GET['reason']), 'tid' => $thread['tid'], 'pid' => $thread['pid'])));
|
||||
}
|
||||
|
||||
$deleteauthorids[$thread['authorid']] = $thread['authorid'];
|
||||
|
||||
}
|
||||
|
||||
if($recyclebintids) {
|
||||
$rows = C::t('forum_thread')->update(explode(',', $recyclebintids), array('displayorder' => -1, 'moderated' => 1));
|
||||
updatemodworks('MOD', $rows);
|
||||
|
||||
C::t('forum_post')->update_by_tid(0, explode(',', $recyclebintids), array('invisible' => -1), true);
|
||||
updatemodlog($recyclebintids, 'DEL');
|
||||
}
|
||||
|
||||
require_once libfile('function/delete');
|
||||
deletethread($deletetids);
|
||||
|
||||
if($_G['group']['allowbanuser'] && ($_GET['banuser'] || $_GET['userdelpost']) && $deleteauthorids) {
|
||||
$members = C::t('common_member')->fetch_all($deleteauthorids);
|
||||
$banuins = array();
|
||||
foreach($members as $member) {
|
||||
if(($_G['cache']['usergroups'][$member['groupid']]['type'] == 'system' &&
|
||||
in_array($member['groupid'], array(1, 2, 3, 6, 7, 8))) || $_G['cache']['usergroups'][$member['groupid']]['type'] == 'special') {
|
||||
continue;
|
||||
}
|
||||
$banuins[$member['uid']] = $member['uid'];
|
||||
}
|
||||
if($banuins) {
|
||||
if($_GET['banuser']) {
|
||||
C::t('common_member')->update($banuins, array('groupid' => 4));
|
||||
}
|
||||
|
||||
if($_GET['userdelpost']) {
|
||||
deletememberpost($banuins);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updatemoderate('tid', $moderation['delete'], 2);
|
||||
}
|
||||
|
||||
if($validatetids = dimplode($moderation['validate'])) {
|
||||
|
||||
$tids = $moderatedthread = array();
|
||||
foreach(C::t('forum_thread')->fetch_all_by_tid_displayorder($moderation['validate'], $pstat, '=', ($modfids ? explode(',', $modfids) : null)) as $thread) {
|
||||
$tids[] = $thread['tid'];
|
||||
$poststatus = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
|
||||
$poststatus = $poststatus['status'];
|
||||
if(getstatus($poststatus, 3) == 0) {
|
||||
updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']);
|
||||
$attachcount = C::t('forum_attachment_n')->count_by_id('tid:'.$thread['tid'], 'tid', $thread['tid']);
|
||||
updatecreditbyaction('postattach', $thread['authorid'], array(), '', $attachcount, 1, $thread['fid']);
|
||||
}
|
||||
$validatedthreads[] = $thread;
|
||||
|
||||
if($thread['authorid'] && $thread['authorid'] != $_G['uid']) {
|
||||
$pmlist[] = array(
|
||||
'act' => 'modthreads_validate',
|
||||
'notevar' => array('reason' => dhtmlspecialchars($_GET['reason']), 'tid' => $thread['tid'], 'threadsubject' => $thread['subject'], 'from_id' => 0, 'from_idtype' => 'modthreads'),
|
||||
'authorid' => $thread['authorid'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if($tids) {
|
||||
|
||||
$tidstr = dimplode($tids);
|
||||
C::t('forum_post')->update_by_tid(0, $tids, array('invisible' => 0), true, false, 1);
|
||||
C::t('forum_thread')->update($tids, array('displayorder'=>0, 'moderated'=>1));
|
||||
$threadsmod = DB::affected_rows();
|
||||
|
||||
if($_G['fid']) {
|
||||
updateforumcount($_G['fid']);
|
||||
} else {
|
||||
$fids = array_keys($modforums['list']);
|
||||
foreach($fids as $f) {
|
||||
updateforumcount($f);
|
||||
}
|
||||
}
|
||||
updatemodworks('MOD', $threadsmod);
|
||||
updatemodlog($tidstr, 'MOD');
|
||||
updatemoderate('tid', $tids, 2);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if($pmlist) {
|
||||
foreach($pmlist as $pm) {
|
||||
$threadsubject = $pm['thread'];
|
||||
$_G['tid'] = intval($pm['tid']);
|
||||
notification_add($pm['authorid'], 'system', $pm['act'], $pm['notevar'], 1);
|
||||
}
|
||||
}
|
||||
|
||||
showmessage('modcp_mod_succeed', "{$cpscript}?mod=modcp&action={$_GET['action']}&op=$op&filter=$filter&fid={$_G['fid']}");
|
||||
|
||||
}
|
||||
|
||||
$modcount = C::t('common_moderate')->count_by_seach_for_thread($moderatestatus, ($modfids ? explode(',', $modfids) : null));
|
||||
$multipage = multi($modcount, $_G['tpp'], $page, "{$cpscript}?mod=modcp&action={$_GET['action']}&op=$op&filter=$filter&fid={$_G['fid']}&showcensor={$_GET['showcensor']}");
|
||||
|
||||
if($modcount) {
|
||||
$posttablearr = array();
|
||||
|
||||
foreach(C::t('common_moderate')->fetch_all_by_search_for_thread($moderatestatus, ($modfids ? explode(',', $modfids) : null), $start_limit, $_G['tpp']) as $thread) {
|
||||
|
||||
$thread['id'] = $thread['tid'];
|
||||
|
||||
if($thread['authorid'] && $thread['author'] != '') {
|
||||
$thread['author'] = "<a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">{$thread['author']}</a>";
|
||||
} elseif($thread['authorid']) {
|
||||
$thread['author'] = "<a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">UID {$thread['uid']}</a>";
|
||||
} else {
|
||||
$thread['author'] = 'guest';
|
||||
}
|
||||
|
||||
$thread['dateline'] = dgmdate($thread['dateline']);
|
||||
$posttable = $thread['posttableid'] ? (string)$thread['posttableid'] : '0';
|
||||
$posttablearr[$posttable][$thread['tid']] = $thread['tid'];
|
||||
$postlist[$thread['tid']] = $thread;
|
||||
}
|
||||
|
||||
$attachtablearr = array();
|
||||
|
||||
foreach($posttablearr as $posttable => $tids) {
|
||||
foreach(C::t('forum_post')->fetch_all_by_tid($posttable, $tids, true, '', 0, 0, 1) as $post) {
|
||||
$thread = $postlist[$post['tid']] + $post;
|
||||
$thread['message'] = nl2br(dhtmlspecialchars($thread['message']));
|
||||
|
||||
if(!empty($_GET['showcensor'])) {
|
||||
$censor = & discuz_censor::instance();
|
||||
$censor->highlight = '#FF0000';
|
||||
$censor->check($thread['subject']);
|
||||
$censor->check($thread['message']);
|
||||
$censor_words = $censor->words_found;
|
||||
if(count($censor_words) > 3) {
|
||||
$censor_words = array_slice($censor_words, 0, 3);
|
||||
}
|
||||
$thread['censorwords'] = implode(', ', $censor_words);
|
||||
}
|
||||
|
||||
if($thread['attachment']) {
|
||||
$attachtable = getattachtableid($thread['tid']);
|
||||
$attachtablearr[$attachtable][$thread['tid']] = $thread['tid'];
|
||||
} else {
|
||||
$thread['attach'] = '';
|
||||
}
|
||||
|
||||
if($thread['sortid']) {
|
||||
require_once libfile('function/threadsort');
|
||||
$threadsortshow = threadsortshow($thread['sortid'], $thread['tid']);
|
||||
|
||||
foreach($threadsortshow['optionlist'] as $option) {
|
||||
$thread['sortinfo'] .= $option['title'].' '.$option['value']."<br />";
|
||||
}
|
||||
} else {
|
||||
$thread['sortinfo'] = '';
|
||||
}
|
||||
|
||||
$postlist[$post['tid']] = $thread;
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($attachtablearr)) {
|
||||
require_once libfile('function/attachment');
|
||||
foreach($attachtablearr as $attachtable => $tids) {
|
||||
foreach(C::t('forum_attachment_n')->fetch_all_by_id($attachtable, 'tid', $tids) as $attach) {
|
||||
$tid = $attach['tid'];
|
||||
$_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 > 100) {this.resized=true; this.width=100;}\">"
|
||||
: "<a href=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (".sizecount($attach['filesize']).")";
|
||||
$postlist[$tid]['attach'] .= "<br /><br />{$lang['attachment']}: ".attachtype(fileext($attach['filename'])."\t").$attach['url'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
15
source/include/modcp/modcp_noperm.php
Normal file
15
source/include/modcp/modcp_noperm.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_noperm.php 6752 2010-03-25 08:47:54Z cnteacher $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
|
||||
?>
|
18
source/include/modcp/modcp_plugin.php
Normal file
18
source/include/modcp/modcp_plugin.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_plugin.php 25246 2011-11-02 03:34:53Z zhangguosheng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$modtpl = $_GET['id'];
|
||||
|
||||
include pluginmodule($_GET['id'], 'modcp_'.$op);
|
||||
|
||||
?>
|
210
source/include/modcp/modcp_recyclebin.php
Normal file
210
source/include/modcp/modcp_recyclebin.php
Normal file
@@ -0,0 +1,210 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_recyclebin.php 27222 2012-01-11 08:01:39Z monkey $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
|
||||
$op = !in_array($op , array('list', 'delete', 'search', 'restore')) ? 'list' : $op;
|
||||
$do = !empty($_GET['do']) ? dhtmlspecialchars($_GET['do']) : '';
|
||||
|
||||
$tidarray = array();
|
||||
$action = $_GET['action'];
|
||||
|
||||
$result = array();
|
||||
foreach (array('threadoption', 'viewsless', 'viewsmore', 'repliesless', 'repliesmore', 'noreplydays', 'typeid') as $key) {
|
||||
$$key = isset($_GET[''.$key]) && is_numeric($_GET[''.$key]) ? intval($_GET[''.$key]) : '';
|
||||
$result[$key] = $$key;
|
||||
}
|
||||
|
||||
foreach (array('starttime', 'endtime', 'keywords', 'users') as $key) {
|
||||
$$key = isset($_GET[''.$key]) ? trim($_GET[''.$key]) : '';
|
||||
$result[$key] = isset($_GET[''.$key]) ? dhtmlspecialchars($_GET[''.$key]) : '';
|
||||
}
|
||||
|
||||
$threadoptionselect = array('','','','','','', '', '', '', '', 999=>'', 888=>'');
|
||||
$threadoptionselect[$threadoption] = 'selected';
|
||||
|
||||
$postlist = array();
|
||||
|
||||
$total = $multipage = '';
|
||||
|
||||
$cachekey = 'srchresult_recycle_thread'.$_G['fid'];
|
||||
if($_G['fid'] && $_G['forum']['ismoderator'] && !empty($modforums['recyclebins'][$_G['fid']])) {
|
||||
|
||||
$srchupdate = false;
|
||||
|
||||
if(in_array($_G['adminid'], array(1, 2, 3)) && ($op == 'delete' || $op == 'restore') && submitcheck('dosubmit')) {
|
||||
if(!empty($_GET['moderate'])) {
|
||||
foreach(C::t('forum_thread')->fetch_all_by_tid_displayorder($_GET['moderate'], -1, '=', $_G['fid']) as $tid) {
|
||||
$tidarray[] = $tid['tid'];
|
||||
}
|
||||
|
||||
if($tidarray) {
|
||||
if($op == 'delete' && $_G['group']['allowclearrecycle']) {
|
||||
require_once libfile('function/delete');
|
||||
deletethread($tidarray);
|
||||
}
|
||||
if($op == 'restore') {
|
||||
require_once libfile('function/post');
|
||||
undeletethreads($tidarray);
|
||||
}
|
||||
|
||||
if($_GET['oldop'] == 'search') {
|
||||
$srchupdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$op = dhtmlspecialchars($_GET['oldop']);
|
||||
|
||||
showmessage('modcp_recyclebin_'.$op.'_succeed', '', array(), array('break' => 1));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($op == 'search' && submitcheck('searchsubmit')) {
|
||||
|
||||
$conditions = array();
|
||||
|
||||
if($threadoption > 0 && $threadoption < 255) {
|
||||
$conditions['specialthread'] = 1;
|
||||
$conditions['special'] = $threadoption;
|
||||
} elseif($threadoption == 999) {
|
||||
$conditions['digest'] = array(1,2,3);
|
||||
} elseif($threadoption == 888) {
|
||||
$conditions['sticky'] = 1;
|
||||
}
|
||||
|
||||
|
||||
$viewsless !== ''? $conditions['viewsless'] = $viewsless : '';
|
||||
$viewsmore !== ''? $conditions['viewsmore'] = $viewsmore : '';
|
||||
$repliesless !== ''? $conditions['repliesless'] = $repliesless : '';
|
||||
$repliesmore !== ''? $conditions['repliesmore'] = $repliesmore : '';
|
||||
$noreplydays !== ''? $conditions['noreplydays'] = $noreplydays : '';
|
||||
$starttime != '' ? $conditions['starttime'] = $starttime : '';
|
||||
$endtime != '' ? $conditions['endtime'] = $endtime : '';
|
||||
|
||||
if(trim($keywords)) {
|
||||
$conditions['keywords'] = $keywords;
|
||||
|
||||
}
|
||||
|
||||
if(trim($users)) {
|
||||
$conditions['users'] = trim($users);
|
||||
}
|
||||
|
||||
if($_GET['typeid']) {
|
||||
$conditions['intype'] = $_GET['typeid'];
|
||||
|
||||
}
|
||||
|
||||
if(!empty($conditions)) {
|
||||
|
||||
$tids = $comma = '';
|
||||
$count = 0;
|
||||
$conditions['fid'] = $_G['fid'];
|
||||
$conditions['sticky'] = 3;
|
||||
foreach(C::t('forum_thread')->fetch_all_search($conditions, 0, 0, 1000, 'lastpost') as $thread) {
|
||||
$tids .= $comma.$thread['tid'];
|
||||
$comma = ',';
|
||||
$count ++;
|
||||
}
|
||||
|
||||
$result['tids'] = $tids;
|
||||
$result['count'] = $count;
|
||||
$result['fid'] = $_G['fid'];
|
||||
|
||||
$modsession->set($cachekey, $result, true);
|
||||
|
||||
unset($result, $tids);
|
||||
$page = 1;
|
||||
|
||||
} else {
|
||||
$op = 'list';
|
||||
}
|
||||
}
|
||||
|
||||
$page = max(1, intval($_G['page']));
|
||||
$total = 0;
|
||||
$query = $multipage = '';
|
||||
|
||||
if($op == 'list') {
|
||||
$total = C::t('forum_thread')->count_by_fid_typeid_displayorder($_G['fid'], $_GET['typeid'], -1);
|
||||
$tpage = ceil($total / $_G['tpp']);
|
||||
$page = min($tpage, $page);
|
||||
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&action=$action&op=$op&fid={$_G['fid']}&do=$do");
|
||||
if($total) {
|
||||
$start = ($page - 1) * $_G['tpp'];
|
||||
$threads = C::t('forum_thread')->fetch_all_by_fid_typeid_displayorder($_G['fid'], $_GET['typeid'], -1, '=', $start, $_G['tpp']);
|
||||
}
|
||||
}
|
||||
|
||||
if($op == 'search') {
|
||||
|
||||
$result = $modsession->get($cachekey);
|
||||
|
||||
if($result) {
|
||||
|
||||
if($srchupdate && $result['count'] && $tidarray) {
|
||||
$td = explode(',', $result['tids']);
|
||||
$newtids = $comma = $newcount = '';
|
||||
if(is_array($td)) {
|
||||
foreach ($td as $v) {
|
||||
$v = intval($v);
|
||||
if(!in_array($v, $tidarray)) {
|
||||
$newcount ++;
|
||||
$newtids .= $comma.$v;
|
||||
$comma = ',';
|
||||
}
|
||||
}
|
||||
$result['count'] = $newcount;
|
||||
$result['tids'] = $newtids;
|
||||
$modsession->set($cachekey, $result, true);
|
||||
}
|
||||
}
|
||||
|
||||
$threadoptionselect[$result['threadoption']] = 'selected';
|
||||
|
||||
$total = $result['count'];
|
||||
$tpage = ceil($total / $_G['tpp']);
|
||||
$page = min($tpage, $page);
|
||||
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&action=$action&op=$op&fid={$_G['fid']}&do=$do");
|
||||
if($total) {
|
||||
$start = ($page - 1) * $_G['tpp'];
|
||||
$threads = C::t('forum_thread')->fetch_all_by_tid_fid_displayorder(explode(',', $result['tids']), $_G['fid'], -1, 'lastpost', $start, $_G['tpp']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$postlist = array();
|
||||
if($threads) {
|
||||
require_once libfile('function/misc');
|
||||
foreach($threads as $thread) {
|
||||
$post = procthread($thread);
|
||||
$post['modthreadkey'] = modauthkey($post['tid']);
|
||||
$postlist[$post['tid']] = $post;
|
||||
}
|
||||
if($postlist) {
|
||||
$tids = array_keys($postlist);
|
||||
foreach(C::t('forum_threadmod')->fetch_all_by_tid($tids) as $row) {
|
||||
if(empty($postlist[$row['tid']]['reason'])) {
|
||||
$postlist[$row['tid']]['reason'] = $row['reason'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
165
source/include/modcp/modcp_recyclebinpost.php
Normal file
165
source/include/modcp/modcp_recyclebinpost.php
Normal file
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_recyclebinpost.php 27222 2012-01-11 08:01:39Z monkey $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
|
||||
$op = !in_array($op , array('list', 'delete', 'search', 'restore')) ? 'list' : $op;
|
||||
$do = !empty($_GET['do']) ? dhtmlspecialchars($_GET['do']) : '';
|
||||
|
||||
$pidarray = array();
|
||||
$action = $_GET['action'];
|
||||
|
||||
$result = array();
|
||||
|
||||
foreach (array('starttime', 'endtime', 'keywords', 'users') as $key) {
|
||||
$$key = isset($_GET[''.$key]) ? trim($_GET[''.$key]) : '';
|
||||
$result[$key] = isset($_GET[''.$key]) ? dhtmlspecialchars($_GET[''.$key]) : '';
|
||||
}
|
||||
|
||||
$postlist = array();
|
||||
$total = $multipage = '';
|
||||
|
||||
$posttableid = intval(getgpc('posttableid'));
|
||||
$posttableselect = getposttableselect();
|
||||
|
||||
$cachekey = 'srchresult_recycle_post_'.$posttableid.'_'.$_G['fid'];
|
||||
|
||||
if($_G['fid'] && $_G['forum']['ismoderator'] && !empty($modforums['recyclebins'][$_G['fid']])) {
|
||||
|
||||
$srchupdate = false;
|
||||
|
||||
if(in_array($_G['adminid'], array(1, 2, 3)) && ($op == 'delete' || $op == 'restore') && submitcheck('dosubmit')) {
|
||||
if($ids = dimplode($_GET['moderate'])) {
|
||||
$pidarray = array();
|
||||
foreach(C::t('forum_post')->fetch_all_post($posttableid, $_GET['moderate'], false) as $post) {
|
||||
if($post['fid'] != $_G['fid'] || $post['invisible'] != '-5') {
|
||||
continue;
|
||||
}
|
||||
$pidarray[] = $post['pid'];
|
||||
}
|
||||
if($pidarray) {
|
||||
require_once libfile('function/misc');
|
||||
if ($op == 'delete' && $_G['group']['allowclearrecycle']){
|
||||
recyclebinpostdelete($pidarray, $posttableid);
|
||||
}
|
||||
if ($op == 'restore') {
|
||||
recyclebinpostundelete($pidarray, $posttableid);
|
||||
}
|
||||
|
||||
if($_GET['oldop'] == 'search') {
|
||||
$srchupdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$op = dhtmlspecialchars($_GET['oldop']);
|
||||
|
||||
showmessage('modcp_recyclebinpost_'.$op.'_succeed', '', array(), array('break' => 1));
|
||||
|
||||
}
|
||||
|
||||
if($op == 'search' && submitcheck('searchsubmit')) {
|
||||
|
||||
|
||||
if($starttime || $endtime || trim($keywords) || trim($users)) {
|
||||
|
||||
$pids = array();
|
||||
|
||||
foreach(C::t('forum_post')->fetch_all_by_search($posttableid, null, $keywords, -5, null, null, ($users ? explode(',', str_replace(' ', '', trim($users))) : null), strtotime($starttime), strtotime($endtime), null, null, 0, 1000) as $value) {
|
||||
$postlist[] = $value;
|
||||
$pids[] = $value['pid'];
|
||||
}
|
||||
|
||||
$result['pids'] = implode(',', $pids);
|
||||
$result['count'] = count($pids);
|
||||
$result['fid'] = $_G['fid'];
|
||||
$result['posttableid'] = $posttableid;
|
||||
|
||||
$modsession->set($cachekey, $result, true);
|
||||
|
||||
unset($result, $pids);
|
||||
$page = 1;
|
||||
|
||||
} else {
|
||||
$op = 'list';
|
||||
}
|
||||
}
|
||||
|
||||
$page = max(1, intval($_G['page']));
|
||||
$total = 0;
|
||||
$query = $multipage = '';
|
||||
$fields = 'message, useip, attachment, htmlon, smileyoff, bbcodeoff, pid, tid, fid, author, dateline, subject, authorid, anonymous';
|
||||
|
||||
if($op == 'list') {
|
||||
$total = C::t('forum_post')->count_by_fid_invisible($posttableid, $_G['fid'], '-5');
|
||||
$tpage = ceil($total / $_G['tpp']);
|
||||
$page = min($tpage, $page);
|
||||
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&action=$action&op=$op&fid={$_G['fid']}&do=$do");
|
||||
if($total) {
|
||||
$start = ($page - 1) * $_G['tpp'];
|
||||
foreach(C::t('forum_post')->fetch_all_by_fid($posttableid, $_G['fid'], true, 'DESC', $start, $_G['tpp'], null, '-5') as $value) {
|
||||
$postlist[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($op == 'search') {
|
||||
|
||||
$result = $modsession->get($cachekey);
|
||||
|
||||
if($result) {
|
||||
|
||||
if($srchupdate && $result['count'] && $pidarray) {
|
||||
$pd = explode(',', $result['pids']);
|
||||
$newpids = $comma = $newcount = '';
|
||||
if(is_array($pd)) {
|
||||
foreach ($pd as $v) {
|
||||
$v = intval($v);
|
||||
if(!in_array($v, $pidarray)) {
|
||||
$newcount ++;
|
||||
$newpids .= $comma.$v; $comma = ',';
|
||||
}
|
||||
}
|
||||
$result['count'] = $newcount;
|
||||
$result['pids'] = $newpids;
|
||||
$modsession->set($cachekey, $result, true);
|
||||
}
|
||||
}
|
||||
|
||||
$total = $result['count'];
|
||||
$tpage = ceil($total / $_G['tpp']);
|
||||
$page = min($tpage, $page);
|
||||
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&action=$action&op=$op&fid={$_G['fid']}&do=$do");
|
||||
if($total) {
|
||||
$start = ($page - 1) * $_G['tpp'];
|
||||
$postlist = C::t('forum_post')->fetch_all_by_pid($posttableid, explode(',', $result['pids']), true, 'DESC', $start, $_G['tpp'], $_G['fid'], -5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($postlist) {
|
||||
require_once libfile('function/misc');
|
||||
require_once libfile('function/post');
|
||||
require_once libfile('function/discuzcode');
|
||||
foreach($postlist as $key => $post) {
|
||||
$post['modthreadkey'] = modauthkey($post['tid']);
|
||||
$post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $_G['forum']['allowsmilies'], $_G['forum']['allowbbcode'], $_G['forum']['allowimgcode'], $_G['forum']['allowhtml']);
|
||||
$post['message'] = preg_replace('/<a[^>]*>(.*?)<\/a>/i', '$1', $post['message']);
|
||||
$post['dateline'] = dgmdate($post['dateline'], 'Y-m-d H:i:s');
|
||||
$postlist[$key] = $post;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
68
source/include/modcp/modcp_report.php
Normal file
68
source/include/modcp/modcp_report.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_report.php 29666 2012-04-24 08:07:56Z zhengqingpeng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
if(!empty($_G['fid'])) {
|
||||
$curcredits = $_G['setting']['creditstransextra'][8] ? $_G['setting']['creditstransextra'][8] : $_G['setting']['creditstrans'];
|
||||
$report_reward = dunserialize($_G['setting']['report_reward']);
|
||||
if(submitcheck('reportsubmit')) {
|
||||
if($_GET['reportids']) {
|
||||
foreach($_GET['reportids'] as $reportid) {
|
||||
if(C::t('common_report')->fetch_count(0, $reportid)) {
|
||||
$creditchange = '';
|
||||
$uid = $_GET['reportuids'][$reportid];
|
||||
if($uid != $_G['uid']) {
|
||||
$msg = !empty($_GET['msg'][$reportid]) ? '<br />'.dhtmlspecialchars($_GET['msg'][$reportid]) : '';
|
||||
if(!empty($_GET['creditsvalue'][$reportid])) {
|
||||
$credittag = $_GET['creditsvalue'][$reportid] > 0 ? '+' : '';
|
||||
if($report_reward['max'] < $_GET['creditsvalue'][$reportid] || $_GET['creditsvalue'][$reportid] < $report_reward['min']) {
|
||||
showmessage('quickclear_noperm', "$cpscript?mod=modcp&action=report&fid={$_G['fid']}");
|
||||
}
|
||||
$creditchange = '<br />'.lang('forum/misc', 'report_msg_your').$_G['setting']['extcredits'][$curcredits]['title'].' '.$credittag.$_GET['creditsvalue'][$reportid];
|
||||
updatemembercount($uid, array($curcredits => intval($_GET['creditsvalue'][$reportid])), true, 'RPC', $reportid);
|
||||
}
|
||||
if($creditchange || $msg) {
|
||||
notification_add($uid, 'report', 'report_change_credits', array('creditchange' => $creditchange, 'msg' => $msg), 1);
|
||||
}
|
||||
}
|
||||
$opresult = !empty($_GET['creditsvalue'][$reportid])? $curcredits."\t".intval($_GET['creditsvalue'][$reportid]) : 'ignore';
|
||||
C::t('common_report')->update($reportid, array('opuid' => $_G['uid'], 'opname' => $_G['username'], 'optime' => TIMESTAMP, 'opresult' => $opresult));
|
||||
}
|
||||
}
|
||||
showmessage('modcp_report_success', "$cpscript?mod=modcp&action=report&fid={$_G['fid']}&lpp=$lpp");
|
||||
}
|
||||
}
|
||||
$rewardlist = '';
|
||||
$offset = abs(ceil(($report_reward['max'] - $report_reward['min']) / 10));
|
||||
if($report_reward['max'] > $report_reward['min']) {
|
||||
for($vote = $report_reward['max']; $vote >= $report_reward['min']; $vote -= $offset) {
|
||||
if($vote != 0) {
|
||||
$rewardlist .= $vote ? '<option value="'.$vote.'">'.($vote > 0 ? '+'.$vote : $vote).'</option>' : '';
|
||||
} else {
|
||||
$rewardlist .= '<option value="0" selected>'.lang('forum/misc', 'report_noreward').'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$reportlist = array();
|
||||
$lpp = empty($_GET['lpp']) ? 20 : intval($_GET['lpp']);
|
||||
$lpp = min(200, max(5, $lpp));
|
||||
$page = max(1, intval($_G['page']));
|
||||
$start = ($page - 1) * $lpp;
|
||||
|
||||
$reportcount = C::t('common_report')->fetch_count(0, 0, $_G['fid']);
|
||||
$query = C::t('common_report')->fetch_all_report($start, $lpp, 0, $_G['fid']);
|
||||
foreach($query as $row) {
|
||||
$row['dateline'] = dgmdate($row['dateline']);
|
||||
$reportlist[] = $row;
|
||||
}
|
||||
$multipage = multi($reportcount, $lpp, $page, "$cpscript?mod=modcp&action=report&fid={$_G['fid']}&lpp=$lpp");
|
||||
}
|
||||
?>
|
377
source/include/modcp/modcp_thread.php
Normal file
377
source/include/modcp/modcp_thread.php
Normal file
@@ -0,0 +1,377 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: modcp_thread.php 28845 2012-03-15 00:59:32Z monkey $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$op = !in_array($op , array('thread', 'post')) ? 'thread' : $op;
|
||||
$do = getgpc('do') ? dhtmlspecialchars(getgpc('do')) : '';
|
||||
|
||||
$modtpl = $op == 'post' ? 'modcp_post' : 'modcp_thread';
|
||||
$modtpl = 'forum/'.$modtpl;
|
||||
|
||||
$threadoptionselect = array('','','','','','', '', '', '', '', 999=>'', 888=>'');
|
||||
$threadoptionselect[getgpc('threadoption')] = 'selected';
|
||||
|
||||
|
||||
if($op == 'thread') {
|
||||
|
||||
$result = array();
|
||||
|
||||
foreach (array('threadoption', 'viewsless', 'viewsmore', 'repliesless', 'repliesmore', 'noreplydays', 'typeid') as $key) {
|
||||
$_GET[''.$key] = isset($_GET[''.$key]) && is_numeric($_GET[''.$key]) ? intval($_GET[''.$key]) : '';
|
||||
$result[$key] = $_GET[''.$key];
|
||||
}
|
||||
|
||||
foreach (array('starttime', 'endtime', 'keywords', 'users') as $key) {
|
||||
$result[$key] = isset($_GET[''.$key]) ? dhtmlspecialchars($_GET[''.$key]) : '';
|
||||
}
|
||||
|
||||
if($_G['fid'] && $_G['forum']['ismoderator']) {
|
||||
|
||||
if($do == 'search' && submitcheck('submit', 1)) {
|
||||
|
||||
$conditions = array();
|
||||
if($_GET['threadoption'] > 0 && $_GET['threadoption'] < 255) {
|
||||
$conditions['specialthread'] = 1;
|
||||
$conditions['special'] = $_GET['threadoption'];
|
||||
} elseif($_GET['threadoption'] == 999) {
|
||||
$conditions['digest'] = array(1,2,3);
|
||||
} elseif($_GET['threadoption'] == 888) {
|
||||
$conditions['sticky'] = 1;
|
||||
}
|
||||
|
||||
|
||||
$_GET['viewsless'] !== ''? $conditions['viewsless'] = $_GET['viewsless'] : '';
|
||||
$_GET['viewsmore'] !== ''? $conditions['viewsmore'] = $_GET['viewsmore'] : '';
|
||||
$_GET['repliesless'] !== ''? $conditions['repliesless'] = $_GET['repliesless'] : '';
|
||||
$_GET['repliesmore'] !== ''? $conditions['repliesmore'] = $_GET['repliesmore'] : '';
|
||||
$_GET['noreplydays'] !== ''? $conditions['noreplydays'] = $_GET['noreplydays'] : '';
|
||||
$_GET['starttime'] != '' ? $conditions['starttime'] = $_GET['starttime'] : '';
|
||||
$_GET['endtime'] != '' ? $conditions['endtime'] = $_GET['endtime'] : '';
|
||||
|
||||
if(trim($_GET['keywords'])) {
|
||||
|
||||
$conditions['keywords'] = $_GET['keywords'];
|
||||
}
|
||||
|
||||
if(trim($_GET['users'])) {
|
||||
$conditions['users'] = trim($_GET['users']);
|
||||
}
|
||||
|
||||
if($_GET['typeid']) {
|
||||
$conditions['intype'] = $_GET['typeid'];
|
||||
}
|
||||
|
||||
if(!empty($conditions)) {
|
||||
$conditions['inforum'] = $_G['fid'];
|
||||
if(!isset($conditions['sticky'])) $conditions['sticky'] = 0;
|
||||
$tids = $comma = '';
|
||||
$count = 0;
|
||||
foreach(C::t('forum_thread')->fetch_all_search($conditions, 0, 0, 1000, 'displayorder DESC, lastpost') as $thread) {
|
||||
$tids .= $comma.$thread['tid'];
|
||||
$comma = ',';
|
||||
$count ++;
|
||||
}
|
||||
|
||||
$result['tids'] = $tids;
|
||||
$result['count'] = $count;
|
||||
$result['fid'] = $_G['fid'];
|
||||
|
||||
$modsession->set('srchresult', $result, true);
|
||||
|
||||
unset($result, $tids);
|
||||
$do = 'list';
|
||||
$page = 1;
|
||||
|
||||
} else {
|
||||
$do = '';
|
||||
}
|
||||
}
|
||||
|
||||
$page = $_G['page'];
|
||||
$total = 0;
|
||||
$query = $multipage = '';
|
||||
|
||||
if(empty($do)) {
|
||||
|
||||
$total = C::t('forum_thread')->count_by_fid_typeid_displayorder($_G['fid'], $_GET['typeid'], 0, '>=');
|
||||
$tpage = ceil($total / $_G['tpp']);
|
||||
$page = min($tpage, $page);
|
||||
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&action={$_GET['action']}&op=$op&fid={$_G['fid']}&do=$do&posttableid=".(isset($posttableid) ? $posttableid : ''));
|
||||
if($total) {
|
||||
$start = ($page - 1) * $_G['tpp'];
|
||||
$threads = C::t('forum_thread')->fetch_all_by_fid_typeid_displayorder($_G['fid'], $_GET['typeid'], 0, '>=', $start, $_G['tpp']);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$result = $modsession->get('srchresult');
|
||||
$threadoptionselect[$result['threadoption']] = 'selected';
|
||||
|
||||
if($result['fid'] == $_G['fid']) {
|
||||
$total = $result['count'];
|
||||
$tpage = ceil($total / $_G['tpp']);
|
||||
$page = min($tpage, $page);
|
||||
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&action={$_GET['action']}&op=$op&fid={$_G['fid']}&do=$do&posttableid=$posttableid");
|
||||
if($total) {
|
||||
$start = ($page - 1) * $_G['tpp'];
|
||||
$threads = C::t('forum_thread')->fetch_all_by_tid_fid_displayorder(explode(',', $result['tids']), null, null, 'lastpost', $start, $_G['tpp']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$postlist = array();
|
||||
if(!empty($threads)) {
|
||||
require_once libfile('function/misc');
|
||||
foreach($threads as $thread) {
|
||||
$postlist[] = procthread($thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if($op == 'post') {
|
||||
|
||||
$error = 0;
|
||||
|
||||
$result = array();
|
||||
|
||||
$_GET['starttime'] = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", getgpc('starttime')) ? dgmdate(TIMESTAMP - 86400 * ($_G['adminid'] == 2 ? 13 : ($_G['adminid'] == 3 ? 6 : 60)), 'Y-m-d') : getgpc('starttime');
|
||||
$_GET['endtime'] = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", getgpc('endtime')) ? dgmdate(TIMESTAMP, 'Y-m-d') : getgpc('endtime');
|
||||
|
||||
foreach (array('threadoption', 'starttime', 'endtime', 'keywords', 'users', 'useip') as $key) {
|
||||
$$key = isset($_GET[''.$key]) ? trim($_GET[''.$key]) : '';
|
||||
$result[$key] = dhtmlspecialchars($$key);
|
||||
}
|
||||
|
||||
$threadoptionselect = range(1, 3);
|
||||
|
||||
$posttableid = intval(getgpc('posttableid'));
|
||||
$posttableselect = getposttableselect();
|
||||
|
||||
$cachekey = 'srchresult_p_'.$posttableid.'_'.$_G['fid'];
|
||||
$fidadd = '';
|
||||
$fidaddarr = array();
|
||||
if($_G['fid'] && !empty($modforums['list'][$_G['fid']])) {
|
||||
$fidaddarr = array($_G['fid']);
|
||||
$fidadd = "AND fid='{$_G['fid']}'";
|
||||
} else {
|
||||
if($_G['adminid'] == 1 && $_G['adminid'] == $_G['groupid']) {
|
||||
$fidadd = '';
|
||||
} elseif(!$modforums['fids']) {
|
||||
$fidaddarr = array(0);
|
||||
$fidadd = 'AND 0 ';
|
||||
} else {
|
||||
$fidaddarr = explode(',', $modforums['fids']);
|
||||
$fidadd = "AND fid in({$modforums['fids']})";
|
||||
}
|
||||
}
|
||||
|
||||
if($do == 'delete' && submitcheck('deletesubmit')) {
|
||||
|
||||
if(!$_G['group']['allowmassprune']) {
|
||||
$error = 4;
|
||||
return;
|
||||
}
|
||||
|
||||
$pidsdelete = $tidsdelete = array();
|
||||
$prune = array('forums' => array(), 'thread' => array());
|
||||
|
||||
if($pids = dimplode($_GET['delete'])) {
|
||||
$result = $modsession->get($cachekey);
|
||||
$result['pids'] = explode(',', $result['pids']);
|
||||
$keys = array_flip($result['pids']);
|
||||
foreach(C::t('forum_post')->fetch_all_post($posttableid, $_GET['delete'], false) as $post) {
|
||||
if($fidaddarr && !in_array($post['fid'], $fidaddarr)) {
|
||||
continue;
|
||||
}
|
||||
$prune['forums'][$post['fid']] = $post['fid'];
|
||||
$pidsdelete[$post['fid']][$post['pid']] = $post['pid'];
|
||||
$pids_tids[$post['pid']] = $post['tid'];
|
||||
if($post['first']) {
|
||||
$tidsdelete[$post['pid']] = $post['tid'];
|
||||
} else {
|
||||
@$prune['thread'][$post['tid']]++;
|
||||
}
|
||||
$key = $keys[$post['pid']];
|
||||
unset($result['pids'][$key]);
|
||||
}
|
||||
$result['count'] = count($result['pids']);
|
||||
$result['pids'] = implode(',', $result['pids']);
|
||||
$modsession->set($cachekey, $result, true);
|
||||
unset($result);
|
||||
}
|
||||
|
||||
if($pidsdelete) {
|
||||
require_once libfile('function/post');
|
||||
require_once libfile('function/delete');
|
||||
$forums = C::t('forum_forum')->fetch_all($prune['forums']);
|
||||
foreach($pidsdelete as $fid => $pids) {
|
||||
foreach($pids as $pid) {
|
||||
if(!$tidsdelete[$pid]) {
|
||||
$deletedposts = deletepost(array($pid), 'pid', !getgpc('nocredit'), $posttableid, $forums[$fid]['recyclebin']);
|
||||
updatemodlog($pids_tids[$pid], 'DLP');
|
||||
} else {
|
||||
$deletedthreads = deletethread(array($tidsdelete[$pid]), false, !getgpc('nocredit'), $forums[$fid]['recyclebin']);
|
||||
updatemodlog($tidsdelete[$pid], 'DEL');
|
||||
}
|
||||
}
|
||||
}
|
||||
if(count($prune['thread']) < 50) {
|
||||
foreach($prune['thread'] as $tid => $decrease) {
|
||||
updatethreadcount($tid);
|
||||
}
|
||||
} else {
|
||||
$repliesarray = array();
|
||||
foreach($prune['thread'] as $tid => $decrease) {
|
||||
$repliesarray[$decrease][] = $tid;
|
||||
}
|
||||
foreach($repliesarray as $decrease => $tidarray) {
|
||||
C::t('forum_thread')->increase($tidarray, array('replies'=>-$decrease));
|
||||
}
|
||||
}
|
||||
|
||||
foreach(array_unique($prune['forums']) as $id) {
|
||||
updateforumcount($id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$do = 'list';
|
||||
|
||||
showmessage('modcp_thread_delete_succeed', '', array(), array('break' => 1));
|
||||
}
|
||||
|
||||
if($do == 'search' && submitcheck('searchsubmit', 1)) {
|
||||
|
||||
if(($starttime == '0' && $endtime == '0') || ($keywords == '' && $useip == '' && $users == '')) {
|
||||
$error = 1;
|
||||
return ;
|
||||
}
|
||||
|
||||
$sql = '';
|
||||
|
||||
if($threadoption == 1) {
|
||||
$first = 1;
|
||||
} elseif($threadoption == 2) {
|
||||
$first = 0;
|
||||
}
|
||||
|
||||
if($starttime != '0') {
|
||||
$starttime = strtotime($starttime);
|
||||
}
|
||||
|
||||
if($_G['adminid'] == 1 && $endtime != dgmdate(TIMESTAMP, 'Y-m-d')) {
|
||||
if($endtime != '0') {
|
||||
$endtime = strtotime($endtime);
|
||||
}
|
||||
} else {
|
||||
$endtime = TIMESTAMP;
|
||||
}
|
||||
|
||||
if(($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 14) || ($_G['adminid'] == 3 && $endtime - $starttime > 86400 * 7)) {
|
||||
$error = '2';
|
||||
return;
|
||||
}
|
||||
|
||||
if($users != '') {
|
||||
$uids = C::t('common_member')->fetch_all_uid_by_username(array_map('trim', explode(',', $users)));
|
||||
if(!$uids) {
|
||||
$uids = array(0);
|
||||
}
|
||||
}
|
||||
|
||||
if(trim($keywords)) {
|
||||
foreach(explode(',', str_replace(' ', '', $keywords)) as $value) {
|
||||
if(strlen($value) <= 3) {
|
||||
$error = 3;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$useip = trim($useip);
|
||||
if($useip != '') {
|
||||
$useip = str_replace('*', '%', $useip);
|
||||
}
|
||||
|
||||
if($uids || $keywords || $useip) {
|
||||
|
||||
$pids = array();
|
||||
foreach(C::t('forum_post')->fetch_all_by_search($posttableid, null, $keywords, 0, $fidaddarr, $uids, null, $starttime, $endtime, $useip, $first, 0, 1000) as $post) {
|
||||
$pids[] = $post['pid'];
|
||||
}
|
||||
|
||||
$result['pids'] = implode(',', $pids);
|
||||
$result['count'] = count($pids);
|
||||
$result['fid'] = $_G['fid'];
|
||||
$result['posttableid'] = $posttableid;
|
||||
|
||||
$modsession->set($cachekey, $result, true);
|
||||
|
||||
unset($result, $pids);
|
||||
$do = 'list';
|
||||
$page = 1;
|
||||
|
||||
} else {
|
||||
$do = '';
|
||||
}
|
||||
}
|
||||
|
||||
$page = max(1, intval($_G['page']));
|
||||
$total = 0;
|
||||
$query = $multipage = '';
|
||||
|
||||
if($do == 'list') {
|
||||
$postarray = array();
|
||||
$result = $modsession->get($cachekey);
|
||||
$threadoptionselect[$result['threadoption']] = 'selected';
|
||||
|
||||
if($result['fid'] == $_G['fid']) {
|
||||
$total = $result['count'];
|
||||
$tpage = ceil($total / $_G['tpp']);
|
||||
$page = min($tpage, $page);
|
||||
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&action={$_GET['action']}&op=$op&fid={$_G['fid']}&do=$do&posttableid=$posttableid");
|
||||
if($total && $result['pids']) {
|
||||
$start = ($page - 1) * $_G['tpp'];
|
||||
$tids = array();
|
||||
$postlist = C::t('forum_post')->fetch_all_by_pid($result['posttableid'], explode(',', $result['pids']), true, 'DESC', $start, $_G['tpp']);
|
||||
foreach($postlist as $post) {
|
||||
$tids[$post['tid']] = $post['tid'];
|
||||
}
|
||||
$threadlist = C::t('forum_thread')->fetch_all($tids);
|
||||
foreach($postlist as $post) {
|
||||
$post['tsubject'] = $threadlist[$post['tid']]['subject'];
|
||||
$postarray[] = $post;
|
||||
}
|
||||
unset($threadlist, $postlist, $tids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$postlist = array();
|
||||
|
||||
if(!empty($postarray)) {
|
||||
require_once libfile('function/post');
|
||||
foreach($postarray as $post) {
|
||||
$post['dateline'] = dgmdate($post['dateline']);
|
||||
$post['message'] = messagecutstr($post['message'], 200);
|
||||
$post['forum'] = $modforums['list'][$post['fid']];
|
||||
$post['modthreadkey'] = modauthkey($post['tid']);
|
||||
$postlist[] = $post;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user