First commit

This commit is contained in:
2025-06-18 10:24:27 +08:00
commit ebc39cd5dd
3873 changed files with 412712 additions and 0 deletions

View File

@@ -0,0 +1,744 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_ajax.php 36278 2016-12-09 07:52:35Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
if(!in_array($_GET['action'], array('checkusername', 'checkemail', 'checkinvitecode', 'checkuserexists', 'quickclear', 'setnav')) && !$_G['setting']['forumstatus']) {
showmessage('forum_status_off');
}
if($_GET['action'] == 'checkusername') {
$username = trim($_GET['username']);
$usernamelen = dstrlen($username);
if($usernamelen < 3) {
showmessage('profile_username_tooshort', '', array(), array('handle' => false));
} elseif($usernamelen > 15) {
showmessage('profile_username_toolong', '', array(), array('handle' => false));
}
loaducenter();
$ucresult = uc_user_checkname($username);
if($ucresult == -1) {
showmessage('profile_username_illegal', '', array(), array('handle' => false));
} elseif($ucresult == -2) {
showmessage('profile_username_protect', '', array(), array('handle' => false));
} elseif($ucresult == -3) {
if(C::t('common_member')->fetch_by_username($username) || C::t('common_member_archive')->fetch_by_username($username)) {
showmessage('register_check_found', '', array(), array('handle' => false));
} else {
showmessage('register_activation', '', array(), array('handle' => false));
}
}
$censorexp = '/^('.str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote(($_G['setting']['censoruser'] = trim($_G['setting']['censoruser'])), '/')).')$/i';
if($_G['setting']['censoruser'] && @preg_match($censorexp, $username)) {
showmessage('profile_username_protect', '', array(), array('handle' => false));
}
} elseif($_GET['action'] == 'checkemail') {
require_once libfile('function/member');
checkemail($_GET['email']);
} elseif($_GET['action'] == 'checkinvitecode') {
$invitecode = trim($_GET['invitecode']);
if(!$invitecode) {
showmessage('no_invitation_code', '', array(), array('handle' => false));
}
$result = array();
if($invite = C::t('common_invite')->fetch_by_code($invitecode)) {
if(empty($invite['fuid']) && (empty($invite['endtime']) || $_G['timestamp'] < $invite['endtime'])) {
$result['uid'] = $invite['uid'];
$result['id'] = $invite['id'];
}
}
if(empty($result)) {
showmessage('wrong_invitation_code', '', array(), array('handle' => false));
}
} elseif($_GET['action'] == 'checkuserexists') {
if(C::t('common_member')->fetch_by_username(trim($_GET['username'])) || C::t('common_member_archive')->fetch_by_username(trim($_GET['username']))) {
showmessage('<img src="'.$_G['style']['imgdir'].'/check_right.gif" width="13" height="13">', '', array(), array('msgtype' => 3));
} else {
showmessage('username_nonexistence', '', array(), array('msgtype' => 3));
}
} elseif($_GET['action'] == 'attachlist') {
require_once libfile('function/post');
loadcache('groupreadaccess');
$attachlist = getattach($_GET['pid'], intval($_GET['posttime']), $_GET['aids']);
$attachlist = $attachlist['attachs']['unused'];
$_G['group']['maxprice'] = isset($_G['setting']['extcredits'][$_G['setting']['creditstrans']]) ? $_G['group']['maxprice'] : 0;
include template('common/header_ajax');
include template('forum/ajax_attachlist');
include template('common/footer_ajax');
dexit();
} elseif($_GET['action'] == 'imagelist') {
require_once libfile('function/post');
$attachlist = getattach($_GET['pid'], intval($_GET['posttime']), $_GET['aids']);
$imagelist = $attachlist['imgattachs']['unused'];
include template('common/header_ajax');
include template('forum/ajax_imagelist');
include template('common/footer_ajax');
dexit();
} elseif($_GET['action'] == 'get_rushreply_membernum') {
$tid = intval($_GET['tid']);
if($tid) {
$membernum = C::t('forum_post')->count_author_by_tid($tid);
showmessage('thread_reshreply_membernum', '', array('membernum' => intval($membernum - 1)), array('alert' => 'info'));
}
dexit();
} elseif($_GET['action'] == 'deleteattach') {
$count = 0;
if(isset($_GET['aids']) && isset($_GET['formhash']) && formhash() == $_GET['formhash']) {
foreach($_GET['aids'] as $aid) {
$attach = C::t('forum_attachment_n')->fetch_attachment('aid:'.$aid, $aid);
if($attach && ($attach['pid'] && $attach['pid'] == $_GET['pid'] && $_G['uid'] == $attach['uid'])) {
updatecreditbyaction('postattach', $attach['uid'], array(), '', -1, 1, $_G['fid']);
}
if($attach && ($attach['pid'] && $attach['pid'] == $_GET['pid'] && $_G['uid'] == $attach['uid'] || $_G['forum']['ismoderator'] || !$attach['pid'] && $_G['uid'] == $attach['uid'])) {
C::t('forum_attachment_n')->delete_attachment('aid:'.$aid, $aid);
C::t('forum_attachment')->delete($aid);
dunlink($attach);
$count++;
}
}
}
include template('common/header_ajax');
echo $count;
include template('common/footer_ajax');
dexit();
} elseif($_GET['action'] == 'secondgroup') {
require_once libfile('function/group');
$groupselect = get_groupselect($_GET['fupid'], $_GET['groupid']);
include template('common/header_ajax');
include template('forum/ajax_secondgroup');
include template('common/footer_ajax');
dexit();
} elseif($_GET['action'] == 'displaysearch_adv') {
$display = $_GET['display'] == 1 ? 1 : '';
dsetcookie('displaysearch_adv', $display);
} elseif($_GET['action'] == 'checkgroupname') {
$groupname = trim($_GET['groupname']);
if(empty($groupname)) {
showmessage('group_name_empty', '', array(), array('msgtype' => 3));
}
$tmpname = cutstr($groupname, 20, '');
if($tmpname != $groupname) {
showmessage('group_name_oversize', '', array(), array('msgtype' => 3));
}
if(C::t('forum_forum')->fetch_fid_by_name($groupname)) {
showmessage('group_name_exist', '', array(), array('msgtype' => 3));
}
showmessage('', '', array(), array('msgtype' => 3));
include template('common/header_ajax');
include template('common/footer_ajax');
dexit();
} elseif($_GET['action'] == 'getthreadtypes') {
include template('common/header_ajax');
if(empty($_GET['selectname'])) $_GET['selectname'] = 'threadtypeid';
echo '<select name="'.$_GET['selectname'].'" '.($_GET['selectclass'] ? 'class="'.$_GET['selectclass'].'"' : '').'>';
if(!empty($_G['forum']['threadtypes']['types'])) {
if(!$_G['forum']['threadtypes']['required']) {
echo '<option value="0"></option>';
}
foreach($_G['forum']['threadtypes']['types'] as $typeid => $typename) {
if($_G['forum']['threadtypes']['moderators'][$typeid] && $_G['forum'] && !$_G['forum']['ismoderator']) {
continue;
}
echo '<option value="'.$typeid.'">'.$typename.'</option>';
}
} else {
echo '<option value="0" /></option>';
}
echo '</select>';
include template('common/footer_ajax');
} elseif($_GET['action'] == 'getimage') {
$_GET['aid'] = intval($_GET['aid']);
$image = C::t('forum_attachment_n')->fetch_attachment('aid:'.$_GET['aid'], $_GET['aid'], 1);
include template('common/header_ajax');
if($image['aid']) {
echo '<img src="'.getforumimg($image['aid'], 1, 300, 300, 'fixnone').'" id="image_'.$image['aid'].'" onclick="insertAttachimgTag(\''.$image['aid'].'\')" width="'.($image['width'] < 110 ? $image['width'] : 110).'" cwidth="'.($image['width'] < 300 ? $image['width'] : 300).'" />';
}
include template('common/footer_ajax');
dexit();
} elseif($_GET['action'] == 'setthreadcover') {
$aid = intval($_GET['aid']);
$imgurl = $_GET['imgurl'];
require_once libfile('function/post');
if($_G['forum'] && ($aid || $imgurl)) {
if($imgurl) {
$tid = intval($_GET['tid']);
$pid = intval($_GET['pid']);
} else {
$threadimage = C::t('forum_attachment_n')->fetch_attachment('aid:'.$aid, $aid);
$tid = $threadimage['tid'];
$pid = $threadimage['pid'];
}
if($tid && $pid) {
$thread =get_thread_by_tid($tid);
} else {
$thread = array();
}
if(empty($thread) || (!$_G['forum']['ismoderator'] && $_G['uid'] != $thread['authorid'])) {
if($_GET['newthread']) {
showmessage('set_cover_faild', '', array(), array('msgtype' => 3));
} else {
showmessage('set_cover_faild', '', array(), array('closetime' => 3));
}
}
if(setthreadcover($pid, $tid, $aid, 0, $imgurl)) {
if(empty($imgurl)) {
C::t('forum_threadimage')->delete_by_tid($threadimage['tid']);
C::t('forum_threadimage')->insert(array(
'tid' => $threadimage['tid'],
'attachment' => $threadimage['attachment'],
'remote' => $threadimage['remote'],
));
}
if($_GET['newthread']) {
showmessage('set_cover_succeed', '', array(), array('msgtype' => 3));
} else {
showmessage('set_cover_succeed', '', array(), array('alert' => 'right', 'closetime' => 1));
}
}
}
if($_GET['newthread']) {
showmessage('set_cover_faild', '', array(), array('msgtype' => 3));
} else {
showmessage('set_cover_faild', '', array(), array('closetime' => 3));
}
} elseif($_GET['action'] == 'updateattachlimit') {
$_G['forum']['allowpostattach'] = isset($_G['forum']['allowpostattach']) ? $_G['forum']['allowpostattach'] : '';
$_G['group']['allowpostattach'] = $_G['forum']['allowpostattach'] != -1 && ($_G['forum']['allowpostattach'] == 1 || (!$_G['forum']['postattachperm'] && $_G['group']['allowpostattach']) || ($_G['forum']['postattachperm'] && forumperm($_G['forum']['postattachperm'])));
$_G['forum']['allowpostimage'] = isset($_G['forum']['allowpostimage']) ? $_G['forum']['allowpostimage'] : '';
$_G['group']['allowpostimage'] = $_G['forum']['allowpostimage'] != -1 && ($_G['forum']['allowpostimage'] == 1 || (!$_G['forum']['postimageperm'] && $_G['group']['allowpostimage']) || ($_G['forum']['postimageperm'] && forumperm($_G['forum']['postimageperm'])));
$allowuploadnum = $allowuploadtoday = TRUE;
if($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) {
if($_G['group']['maxattachnum']) {
$allowuploadnum = $_G['group']['maxattachnum'] - getuserprofile('todayattachs');
$allowuploadnum = $allowuploadnum < 0 ? 0 : $allowuploadnum;
if(!$allowuploadnum) {
$allowuploadtoday = false;
}
}
if($_G['group']['maxsizeperday']) {
$allowuploadsize = $_G['group']['maxsizeperday'] - getuserprofile('todayattachsize');
$allowuploadsize = $allowuploadsize < 0 ? 0 : $allowuploadsize;
if(!$allowuploadsize) {
$allowuploadtoday = false;
}
$allowuploadsize = $allowuploadsize / 1048576 >= 1 ? round(($allowuploadsize / 1048576), 1).'MB' : round(($allowuploadsize / 1024)).'KB';
}
}
include template('common/header_ajax');
include template('forum/post_attachlimit');
include template('common/footer_ajax');
exit;
} elseif($_GET['action'] == 'forumchecknew' && !empty($_GET['fid']) && !empty($_GET['time'])) {
$fid = intval($_GET['fid']);
$time = intval($_GET['time']);
if(!getgpc('uncheck')) {
$foruminfo = C::t('forum_forum')->fetch($fid);
$lastpost_str = $foruminfo['lastpost'];
if($lastpost_str) {
$lastpost = explode("\t", $lastpost_str);
unset($lastpost_str);
}
include template('common/header_ajax');
echo $lastpost['2'] > $time ? 1 : 0 ;
include template('common/footer_ajax');
exit;
} else {
$_G['forum_colorarray'] = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282');
$query = C::t('forum_forumfield')->fetch($fid);
$forum_field['threadtypes'] = dunserialize($query['threadtypes']);
$forum_field['threadsorts'] = dunserialize($query['threadsorts']);
if($forum_field['threadtypes']['types']) {
safefilter($forum_field['threadtypes']['types']);
}
if($forum_field['threadtypes']['options']['name']) {
safefilter($forum_field['threadtypes']['options']['name']);
}
if($forum_field['threadsorts']['types']) {
safefilter($forum_field['threadsorts']['types']);
}
unset($query);
$forum_field = daddslashes($forum_field);
$todaytime = strtotime(dgmdate(TIMESTAMP, 'Ymd'));
foreach(C::t('forum_thread')->fetch_all_by_fid_lastpost($fid, $time, TIMESTAMP) as $thread) {
$thread['icontid'] = $thread['forumstick'] || !$thread['moved'] && $thread['isgroup'] != 1 ? $thread['tid'] : $thread['closed'];
if(!$thread['forumstick'] && ($thread['isgroup'] == 1 || $thread['fid'] != $_G['fid'])) {
$thread['icontid'] = $thread['closed'] > 1 ? $thread['closed'] : $thread['tid'];
}
list($thread['subject'], $thread['author'], $thread['lastposter']) = daddslashes(array($thread['subject'], $thread['author'], $thread['lastposter']));
$thread['dateline'] = $thread['dateline'] > $todaytime ? "<span class=\"xi1\">".dgmdate($thread['dateline'], 'd')."</span>" : "<span>".dgmdate($thread['dateline'], 'd')."</span>";
$thread['lastpost'] = dgmdate($thread['lastpost']);
if(isset($forum_field['threadtypes']['prefix'])) {
if($forum_field['threadtypes']['prefix'] == 1) {
$thread['threadtype'] = $forum_field['threadtypes']['types'][$thread['typeid']] ? '<em>[<a href="forum.php?mod=forumdisplay&fid='.$fid.'&filter=typeid&typeid='.$thread['typeid'].'">'.$forum_field['threadtypes']['types'][$thread['typeid']].'</a>]</em> ' : '' ;
} elseif($forum_field['threadtypes']['prefix'] == 2) {
$thread['threadtype'] = $forum_field['threadtypes']['icons'][$thread['typeid']] ? '<em><a href="forum.php?mod=forumdisplay&fid='.$fid.'&filter=typeid&typeid='.$thread['typeid'].'"><img src="'.$forum_field['threadtypes']['icons'][$thread['typeid']].'"/></a></em> ' : '' ;
}
}
if(isset($forum_field['threadsorts']['prefix'])) {
$thread['threadsort'] = $forum_field['threadsorts']['types'][$thread['sortid']] ? '<em>[<a href="forum.php?mod=forumdisplay&fid='.$fid.'&filter=sortid&typeid='.$thread['sortid'].'">'.$forum_field['threadsorts']['types'][$thread['sortid']].'</a>]</em>' : '' ;
}
if($thread['highlight']) {
$string = sprintf('%02d', $thread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$thread['highlight'] = ' style="';
$thread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$thread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$thread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$thread['highlight'] .= $string[1] ? 'color: '.$_G['forum_colorarray'][$string[1]].';' : '';
if($thread['bgcolor']) {
$thread['highlight'] .= "background-color: $thread[bgcolor];";
}
$thread['highlight'] .= '"';
} else {
$thread['highlight'] = '';
}
$target = $thread['isgroup'] == 1 || $thread['forumstick'] ? ' target="_blank"' : ' onclick="atarget(this)"';
if(is_array($_G['setting']['rewritestatus']) && in_array('forum_viewthread', $_G['setting']['rewritestatus'])) {
$thread['threadurl'] = '<a href="'.rewriteoutput('forum_viewthread', 1, '', $thread['tid'], 1, '', '').'"'.$thread['highlight'].$target.'class="s xst">'.$thread['subject'].'</a>';
} else {
$thread['threadurl'] = '<a href="forum.php?mod=viewthread&amp;tid='.$thread['tid'].'"'.$thread['highlight'].$target.'class="s xst">'.$thread['subject'].'</a>';
}
if(is_array($_G['setting']['rewritestatus']) && in_array($thread['displayorder'], array(1, 2, 3, 4))) {
$thread['id'] = 'stickthread_'.$thread['tid'];
} else {
$thread['id'] = 'normalthread_'.$thread['tid'];
}
$thread['threadurl'] = $thread['threadtype'].$thread['threadsort'].$thread['threadurl'];
if(is_array($_G['setting']['rewritestatus']) && in_array('home_space', $_G['setting']['rewritestatus'])) {
$thread['authorurl'] = '<a href="'.rewriteoutput('home_space', 1, '', $thread['authorid'], '', '').'">'.$thread['author'].'</a>';
$thread['lastposterurl'] = '<a href="'.rewriteoutput('home_space', 1, '', '', rawurlencode($thread['lastposter']), '').'">'.$thread['lastposter'].'</a>';
} else {
$thread['authorurl'] = '<a href="home.php?mod=space&uid='.$thread['authorid'].'">'.$thread['author'].'</a>';
$thread['lastposterurl'] = '<a href="home.php?mod=space&username='.rawurlencode($thread['lastposter']).'">'.$thread['lastposter'].'</a>';
}
$threadlist[] = $thread;
}
if($threadlist) {
krsort($threadlist);
}
include template('forum/ajax_threadlist');
}
} elseif($_GET['action'] == 'downremoteimg') {
if(!$_G['group']['allowdownremoteimg']) {
dexit();
}
$_GET['message'] = str_replace(array("\r", "\n"), array($_GET['wysiwyg'] ? '<br />' : '', "\\n"), $_GET['message']);
preg_match_all("/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]|\[img=\d{1,4}[x|\,]\d{1,4}\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/is", $_GET['message'], $image1, PREG_SET_ORDER);
preg_match_all("/\<img.+\bsrc\b\s*=('|\"|)(.*)('|\"|)([\s].*)?\>/ismU", $_GET['message'], $image2, PREG_SET_ORDER);
$temp = $aids = $existentimg = array();
if(is_array($image1) && !empty($image1)) {
foreach($image1 as $value) {
$temp[] = array(
'0' => $value[0],
'1' => trim(!empty($value[1]) ? $value[1] : $value[2])
);
}
}
if(is_array($image2) && !empty($image2)) {
foreach($image2 as $value) {
$temp[] = array(
'0' => $value[0],
'1' => trim($value[2])
);
}
}
require_once libfile('class/image');
if(is_array($temp) && !empty($temp)) {
$upload = new discuz_upload();
$attachaids = array();
foreach($temp as $value) {
$imageurl = $value[1];
$hash = md5($imageurl);
if(strlen($imageurl)) {
$imagereplace['oldimageurl'][] = $value[0];
if(!isset($existentimg[$hash])) {
$existentimg[$hash] = $imageurl;
$attach['ext'] = $upload->fileext($imageurl);
if(!$upload->is_image_ext($attach['ext'])) {
continue;
}
$content = '';
if(preg_match('/^(http(s?):\/\/|\.)/i', $imageurl)) {
$content = dfsockopen($imageurl);
} elseif(preg_match('/^('.preg_quote(getglobal('setting/attachurl'), '/').')/i', $imageurl)) {
$imagereplace['newimageurl'][] = $value[0];
}
if(empty($content)) continue;
$patharr = explode('/', $imageurl);
$attach['name'] = trim($patharr[count($patharr)-1]);
$attach['thumb'] = '';
$attach['isimage'] = $upload -> is_image_ext($attach['ext']);
$attach['extension'] = $upload -> get_target_extension($attach['ext']);
$attach['attachdir'] = $upload -> get_target_dir('forum');
$attach['attachment'] = $attach['attachdir'] . $upload->get_target_filename('forum').'.'.$attach['extension'];
$attach['target'] = getglobal('setting/attachdir').'./forum/'.$attach['attachment'];
if(!@$fp = fopen($attach['target'], 'wb')) {
continue;
} else {
flock($fp, 2);
fwrite($fp, $content);
fclose($fp);
}
if(!$upload->get_image_info($attach['target'])) {
@unlink($attach['target']);
continue;
}
$attach['size'] = filesize($attach['target']);
$upload->attach = $attach;
$thumb = $width = $height = 0;
if($upload->attach['isimage']) {
if($_G['setting']['thumbsource'] && $_G['setting']['sourcewidth'] && $_G['setting']['sourceheight']) {
$image = new image();
$thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['sourcewidth'], $_G['setting']['sourceheight'], 1, 1) ? 1 : 0;
$width = $image->imginfo['width'];
$height = $image->imginfo['height'];
$upload->attach['size'] = $image->imginfo['size'];
}
if($_G['setting']['thumbstatus']) {
$image = new image();
$thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['thumbwidth'], $_G['setting']['thumbheight'], $_G['setting']['thumbstatus'], 0) ? 1 : 0;
$width = $image->imginfo['width'];
$height = $image->imginfo['height'];
}
if($_G['setting']['thumbsource'] || !$_G['setting']['thumbstatus']) {
list($width, $height) = @getimagesize($upload->attach['target']);
}
if($_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark'])) {
$image = new image();
$image->Watermark($attach['target'], '', 'forum');
$upload->attach['size'] = $image->imginfo['size'];
}
}
$aids[] = $aid = getattachnewaid();
$setarr = array(
'aid' => $aid,
'dateline' => $_G['timestamp'],
'filename' => strip_tags(str_replace('"', '', $upload->attach['name'])),
'filesize' => $upload->attach['size'],
'attachment' => $upload->attach['attachment'],
'isimage' => $upload->attach['isimage'],
'uid' => $_G['uid'],
'thumb' => $thumb,
'remote' => '0',
'width' => $width,
'height' => $height
);
C::t("forum_attachment_unused")->insert($setarr);
$attachaids[$hash] = $imagereplace['newimageurl'][] = '[attachimg]'.$aid.'[/attachimg]';
} else {
$imagereplace['newimageurl'][] = $attachaids[$hash];
}
}
}
if(!empty($aids)) {
require_once libfile('function/post');
}
$_GET['message'] = str_replace($imagereplace['oldimageurl'], $imagereplace['newimageurl'], $_GET['message']);
}
$_GET['message'] = addcslashes($_GET['message'], '/"\'');
print <<<EOF
<script type="text/javascript">
parent.ATTACHORIMAGE = 1;
parent.updateDownImageList('{$_GET['message']}');
</script>
EOF;
dexit();
} elseif($_GET['action'] == 'exif') {
$exif = C::t('forum_attachment_exif')->fetch($_GET['aid']);
$s = $exif['exif'];
if(!$s) {
require_once libfile('function/attachment');
$s = getattachexif($_GET['aid']);
C::t('forum_attachment_exif')->insert_exif($_GET['aid'], $s);
}
include template('common/header_ajax');
echo $s;
include template('common/footer_ajax');
exit;
} elseif($_GET['action'] == 'getthreadclass') {
$fid = intval($_GET['fid']);
$threadclass = '';
if($fid) {
$option = array();
$forumfield = C::t('forum_forumfield')->fetch($fid);
if(!empty($forumfield['threadtypes'])) {
foreach(C::t('forum_threadclass')->fetch_all_by_fid($fid) as $tc) {
$option[] = '<option value="'.$tc['typeid'].'">'.$tc['name'].'</option>';
}
if(!empty($option)) {
$threadclass .= '<option value="">'.lang('forum/template', 'modcp_select_threadclass').'</option>';
$threadclass .= implode('', $option);
}
}
}
if(!empty($threadclass)) {
$threadclass = '<select name="typeid" id="typeid" width="168" class="ps">'.$threadclass.'</select>';
}
include template('common/header_ajax');
echo $threadclass;
include template('common/footer_ajax');
exit;
} elseif($_GET['action'] == 'forumjump') {
require_once libfile('function/forumlist');
$favforums = C::t('home_favorite')->fetch_all_by_uid_idtype($_G['uid'], 'fid');
$visitedforums = array();
if($_G['cookie']['visitedfid']) {
loadcache('forums');
foreach(explode('D', $_G['cookie']['visitedfid']) as $fid) {
$fid = intval($fid);
$visitedforums[$fid] = $_G['cache']['forums'][$fid]['name'];
}
}
$forumlist = forumselect(FALSE, 1);
include template('forum/ajax_forumlist');
} elseif($_GET['action'] == 'quickreply') {
$tid = intval($_GET['tid']);
$fid = intval($_GET['fid']);
if($tid) {
$thread = C::t('forum_thread')->fetch_thread($tid);
if($thread && !getstatus($thread['status'], 2)) {
$list = C::t('forum_post')->fetch_all_by_tid('tid:'.$tid, $tid, true, 'DESC', 0, 10, null, 0);
loadcache('smilies');
foreach($list as $pid => $post) {
if($post['first']) {
unset($list[$pid]);
} else {
$post['message'] = preg_replace($_G['cache']['smilies']['searcharray'], '', $post['message']);
$post['message'] = preg_replace("/\{\:soso_((e\d+)|(_\d+_\d))\:\}/", '', $post['message']);
$list[$pid]['message'] = cutstr(preg_replace("/\[.+?\]/is", '', dhtmlspecialchars($post['message'])), 300) ;
}
}
krsort($list);
}
}
list($seccodecheck, $secqaacheck) = seccheck('post', 'reply');
include template('forum/ajax_quickreply');
} elseif($_GET['action'] == 'getpost') {
$tid = intval($_GET['tid']);
$fid = intval($_GET['fid']);
$pid = intval($_GET['pid']);
$thread = C::t('forum_thread')->fetch_thread($tid);
$post = C::t('forum_post')->fetch_post($thread['posttableid'], $pid);
if($_G['uid'] != $post['authorid']) {
showmessage('quickclear_noperm');
}
include template('forum/ajax_followpost');
} elseif($_GET['action'] == 'quickclear') {
$uid = intval($_GET['uid']);
if($_G['adminid'] != 1) {
showmessage('quickclear_noperm');
}
include_once libfile('function/misc');
include_once libfile('function/member');
if(!submitcheck('qclearsubmit')) {
$crimenum_avatar = crime('getcount', $uid, 'crime_avatar');
$crimenum_sightml = crime('getcount', $uid, 'crime_sightml');
$crimenum_customstatus = crime('getcount', $uid, 'crime_customstatus');
$crimeauthor = getuserbyuid($uid);
$crimeauthor = $crimeauthor['username'];
include template('forum/ajax');
} else {
if(empty($_GET['operations'])) {
showmessage('quickclear_need_operation');
}
$reason = checkreasonpm();
$allowop = array('avatar', 'sightml', 'customstatus');
$cleartype = array();
if(in_array('avatar', $_GET['operations'])) {
C::t('common_member')->update($uid, array('avatarstatus'=>0));
loaducenter();
uc_user_deleteavatar($uid);
$cleartype[] = lang('forum/misc', 'avatar');
crime('recordaction', $uid, 'crime_avatar', lang('forum/misc', 'crime_reason', array('reason' => $reason)));
}
if(in_array('sightml', $_GET['operations'])) {
C::t('common_member_field_forum')->update($uid, array('sightml' => ''), 'UNBUFFERED');
$cleartype[] = lang('forum/misc', 'signature');
crime('recordaction', $uid, 'crime_sightml', lang('forum/misc', 'crime_reason', array('reason' => $reason)));
}
if(in_array('customstatus', $_GET['operations'])) {
C::t('common_member_field_forum')->update($uid, array('customstatus' => ''), 'UNBUFFERED');
$cleartype[] = lang('forum/misc', 'custom_title');
crime('recordaction', $uid, 'crime_customstatus', lang('forum/misc', 'crime_reason', array('reason' => $reason)));
}
if(($_G['group']['reasonpm'] == 2 || $_G['group']['reasonpm'] == 3) || !empty($_GET['sendreasonpm'])) {
sendreasonpm(array('authorid' => $uid), 'reason_quickclear', array(
'cleartype' => implode(',', $cleartype),
'reason' => $reason,
'from_id' => 0,
'from_idtype' => 'quickclear'
));
}
showmessage('quickclear_success', $_POST['redirect'], array(), array('showdialog'=>1, 'closetime' => true, 'msgtype' => 2, 'locationtime' => 1));
}
} elseif($_GET['action'] == 'getpostfeed') {
if(!$_G['setting']['followstatus']) {
showmessage('follow_status_off');
}
$tid = intval($_GET['tid']);
$pid = intval($_GET['pid']);
$flag = intval($_GET['flag']);
$feed = $thread = array();
if($tid) {
$thread = C::t('forum_thread')->fetch_thread($tid);
if(empty($_G['setting']['followforumid']) || $thread['fid'] != $_G['setting']['followforumid']) {
$flag = 0;
}
if($flag) {
$post = C::t('forum_post')->fetch_post($thread['posttableid'], $pid);
if($thread['tid'] != $post['tid']) {
showmessage('quickclear_noperm');
}
require_once libfile('function/discuzcode');
require_once libfile('function/followcode');
$post['message'] = followcode($post['message'], $tid, $pid);
} else {
if(!isset($_G['cache']['forums'])) {
loadcache('forums');
}
$feedid = intval($_GET['feedid']);
$feed = C::t('forum_threadpreview')->fetch($tid);
if($feedid) {
$feed = array_merge($feed, C::t('home_follow_feed')->fetch_by_feedid($feedid));
}
$post['message'] = $feed['content'];
}
}
include template('forum/ajax_followpost');
} elseif($_GET['action'] == 'setnav') {
if($_G['adminid'] != 1) {
showmessage('quickclear_noperm');
}
$allowfuntype = array('portal', 'forum', 'friend', 'group', 'follow', 'collection', 'guide', 'feed', 'blog', 'doing', 'album', 'share', 'wall', 'homepage', 'ranklist', 'medal', 'task', 'magic', 'favorite');
$type = in_array($_GET['type'], $allowfuntype) ? trim($_GET['type']) : '';
$do = in_array($_GET['do'], array('open', 'close')) ? $_GET['do'] : 'close';
if(!submitcheck('funcsubmit')) {
$navtitle = lang('spacecp', $do == 'open' ? 'select_the_navigation_position' : 'close_module', array('type' => lang('spacecp', $type)));
$closeprompt = lang('spacecp', 'close_module', array('type' => lang('spacecp', $type)));
include template('forum/ajax');
} else {
if(!empty($type)) {
$funkey = $type.'status';
$funstatus = $do == 'open' ? 1 : 0;
if($type != 'homepage') {
$identifier = array('portal' => 1, 'forum' => 2, 'group' => 3, 'feed' => 4, 'ranklist' => 8, 'follow' => 9, 'guide' => 10, 'collection' => 11, 'blog' => 12, 'album' => 13, 'share' => 14, 'doing' => 15, 'friend' => 26, 'favorite' => 27, 'medal' => 29, 'task' => 30, 'magic' => 31);
$navdata = array('available' => -1);
$navtype = $do == 'open' ? array() : array(0, 3);
if(in_array($type, array('blog', 'album', 'share', 'doing', 'follow', 'friend', 'favorite', 'medal', 'task', 'magic'))) {
$navtype[] = 2;
}
if($do == 'close' && $type == 'medal') {
if(intval(C::t('forum_medal')->count_by_available()) > 0) {
showmessage('medals_existence', dreferer(), array(), array('showdialog' => true, 'locationtime' => true));
exit;
}
}
if($do == 'close' && $type == 'forum') {
if($_G['setting']['groupstatus'] || $_G['setting']['guidestatus'] || $_G['setting']['collectionstatus'] || $_G['setting']['followstatus']) {
showmessage('close_ggcf_before_close_forum', dreferer(), array(), array('showdialog' => true, 'locationtime' => true));
exit;
}
}
if($do == 'open' && in_array($type, array('group', 'guide', 'collection', 'follow'))) {
if(!$_G['setting']['forumstatus']) {
showmessage('open_forum_before_open_ggcf', dreferer(), array(), array('showdialog' => true, 'locationtime' => true));
exit;
}
}
if($do == 'open') {
if($_GET['location']['header']) {
$navtype[] = 0;
$navdata['available'] = 1;
}
if($_GET['location']['quick']) {
$navtype[] = 3;
$navdata['available'] = 1;
}
$navdata['available'] = $navdata['available'] == 1 ? 1 : 0;
if(empty($_GET['location']['header']) || empty($_GET['location']['quick'])) {
C::t('common_nav')->update_by_navtype_type_identifier(array(0, 2, 3), 0, array("$type", "$identifier[$type]"), array('available' => 0));
}
}
if($navtype) {
C::t('common_nav')->update_by_navtype_type_identifier($navtype, 0, array("$type", "$identifier[$type]"), $navdata);
if(in_array($type, array('blog', 'album', 'share', 'doing', 'follow')) && !$navdata['available']) {
C::t('common_nav')->update_by_navtype_type_identifier(array(2), 0, array("$type"), array('available' => 1));
}
}
}
C::t('common_setting')->update_setting($funkey, $funstatus);
$setting[$funkey] = $funstatus;
if(!function_exists('updatecache')) {
include libfile('function/cache');
}
updatecache('setting');
}
showmessage('do_success', dreferer(), array(), array('showdialog' => true, 'locationtime' => true));
}
exit;
} elseif($_GET['action'] == 'checkpostrule') {
require_once libfile('function/post');
include template('common/header_ajax');
$_POST = array('action' => $_GET['ac']);
list($seccodecheck, $secqaacheck) = seccheck('post', $_GET['ac']);
if($seccodecheck || $secqaacheck) {
include template('forum/seccheck_post');
}
include template('common/footer_ajax');
exit;
}
showmessage('succeed', '', array(), array('handle' => false));
?>

View File

@@ -0,0 +1,40 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_announcement.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('function/discuzcode');
$announcedata = C::t('forum_announcement')->fetch_all_by_date($_G['timestamp']);
if(!count($announcedata)) {
showmessage('announcement_nonexistence');
}
$announcelist = array();
foreach ($announcedata as $announce) {
$announce['authorenc'] = rawurlencode($announce['author']);
$tmp = explode('.', dgmdate($announce['starttime'], 'Y.m'));
$months[$tmp[0].$tmp[1]] = $tmp;
if(!empty($_GET['m']) && $_GET['m'] != dgmdate($announce['starttime'], 'Ym')) {
continue;
}
$announce['starttime'] = dgmdate($announce['starttime'], 'd');
$announce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : '';
$announce['message'] = $announce['type'] == 1 ? "[url]{$announce['message']}[/url]" : $announce['message'];
$announce['message'] = nl2br(discuzcode($announce['message'], 0, 0, 1, 1, 1, 1, 1));
$announcelist[] = $announce;
}
$annid = isset($_GET['id']) ? intval($_GET['id']) : 0;
include template('forum/announcement');
?>

View File

@@ -0,0 +1,395 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_attachment.php 34304 2014-01-15 11:11:23Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
@list($_GET['aid'], $_GET['k'], $_GET['t'], $_GET['uid'], $_GET['tableid']) = daddslashes(explode('|', base64_decode($_GET['aid'])));
$requestmode = !empty($_GET['request']) && empty($_GET['uid']);
$aid = intval($_GET['aid']);
$k = $_GET['k'];
$t = $_GET['t'];
$authk = !$requestmode ? substr(md5($aid.md5($_G['config']['security']['authkey']).$t.$_GET['uid']), 0, 8) : md5($aid.md5($_G['config']['security']['authkey']).$t);
$sameuser = !empty($_GET['uid']) && $_GET['uid'] == $_G['uid'];
if($k !== $authk || $t > TIMESTAMP + 3600) {
if(!$requestmode) {
showmessage('attachment_nonexistence');
} else {
exit;
}
}
if(!empty($_GET['findpost']) && ($attach = C::t('forum_attachment')->fetch($aid))) {
dheader('location: forum.php?mod=redirect&goto=findpost&pid='.$attach['pid'].'&ptid='.$attach['tid']);
}
if($_GET['uid'] != $_G['uid'] && $_GET['uid']) {
$_G['uid'] = $_GET['uid'] = intval($_GET['uid']);
$member = getuserbyuid($_GET['uid']);
loadcache('usergroup_'.$member['groupid']);
$_G['group'] = $_G['cache']['usergroup_'.$member['groupid']];
$_G['group']['grouptitle'] = $_G['cache']['usergroup_'.$_G['groupid']]['grouptitle'];
$_G['group']['color'] = $_G['cache']['usergroup_'.$_G['groupid']]['color'];
}
$tableid = 'aid:'.$aid;
if($_G['setting']['attachexpire']) {
if(TIMESTAMP - $t > $_G['setting']['attachexpire'] * 3600) {
$aid = intval($aid);
if($attach = C::t('forum_attachment_n')->fetch_attachment($tableid, $aid)) {
if($attach['isimage']) {
dheader('location: '.$_G['siteurl'].'static/image/common/none.gif');
} else {
if(!$requestmode) {
if($sameuser) {
showmessage('attachment_expired', '', array('aid' => aidencode($aid, 0, $attach['tid']), 'pid' => $attach['pid'], 'tid' => $attach['tid']));
} else {
showmessage('attachment_expired_nosession', '', array('pid' => $attach['pid'], 'tid' => $attach['tid']));
}
} else {
exit;
}
}
} else {
if(!$requestmode) {
showmessage('attachment_nonexistence');
} else {
exit;
}
}
}
}
$readmod = getglobal('config/download/readmod');
$readmod = $readmod > 0 && $readmod < 5 ? $readmod : 2;
$refererhost = parse_url($_SERVER['HTTP_REFERER']);
$serverhost = $_SERVER['HTTP_HOST'];
if(($pos = strpos($serverhost, ':')) !== FALSE) {
$serverhost = substr($serverhost, 0, $pos);
}
if(!$requestmode && $_G['setting']['attachrefcheck'] && $_SERVER['HTTP_REFERER'] && !($refererhost['host'] == $serverhost)) {
showmessage('attachment_referer_invalid', NULL);
}
periodscheck('attachbanperiods');
loadcache('threadtableids');
$threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array();
if(!in_array(0, $threadtableids)) {
$threadtableids = array_merge(array(0), $threadtableids);
}
$archiveid = in_array($_GET['archiveid'], $threadtableids) ? intval($_GET['archiveid']) : 0;
$attachexists = FALSE;
if(!empty($aid) && is_numeric($aid)) {
$attach = C::t('forum_attachment_n')->fetch_attachment($tableid, $aid);
$thread = C::t('forum_thread')->fetch_by_tid_displayorder($attach['tid'], 0, '>=', null, $archiveid);
if($_G['uid'] && $attach['uid'] != $_G['uid']) {
if($attach) {
$attachpost = C::t('forum_post')->fetch_post($thread['posttableid'], $attach['pid'], false);
$attach['invisible'] = $attachpost['invisible'];
unset($attachpost);
}
if($attach && $attach['invisible'] == 0) {
$thread && $attachexists = TRUE;
}
} else {
$attachexists = TRUE;
}
}
if(!$attachexists) {
if(!$requestmode) {
showmessage('attachment_nonexistence');
} else {
exit;
}
}
if(!$requestmode) {
$forum = C::t('forum_forumfield')->fetch_info_for_attach($thread['fid'], $_G['uid']);
$_GET['fid'] = $forum['fid'];
if($attach['isimage']) {
$allowgetattach = ($_G['uid'] == $attach['uid']) ? true : ((!empty($forum['allowgetimage'])) ? ($forum['allowgetimage'] == 1 ? true : false) : ($forum['getattachperm'] ? forumperm($forum['getattachperm']) : $_G['group']['allowgetimage']));
} else {
$allowgetattach = ($_G['uid'] == $attach['uid']) ? true : ((!empty($forum['allowgetattach'])) ? ($forum['allowgetattach'] == 1 ? true : false) : ($forum['getattachperm'] ? forumperm($forum['getattachperm']) : $_G['group']['allowgetattach']));
}
if(($attach['readperm'] && $attach['readperm'] > $_G['group']['readaccess']) && $_G['adminid'] <= 0 && !($_G['uid'] && $_G['uid'] == $attach['uid'])) {
$allowgetattach = FALSE;
showmessage('attachment_forum_nopermission', NULL, array(), array('login' => 1));
}
$ismoderator = in_array($_G['adminid'], array(1, 2)) ? 1 : ($_G['adminid'] == 3 ? C::t('forum_moderator')->fetch_uid_by_tid($attach['tid'], $_G['uid'], $archiveid) : 0);
$ispaid = FALSE;
$exemptvalue = $ismoderator ? 128 : 16;
if(!$thread['special'] && $thread['price'] > 0 && (!$_G['uid'] || ($_G['uid'] != $attach['uid'] && !($_G['group']['exempt'] & $exemptvalue)))) {
if(!$_G['uid'] || $_G['uid'] && !($ispaid = C::t('common_credit_log')->count_by_uid_operation_relatedid($_G['uid'], 'BTC', $attach['tid']))) {
showmessage('attachment_payto', 'forum.php?mod=viewthread&tid='.$attach['tid']);
}
}
$exemptvalue = $ismoderator ? 64 : 8;
if($attach['price'] && (!$_G['uid'] || ($_G['uid'] != $attach['uid'] && !($_G['group']['exempt'] & $exemptvalue)))) {
$payrequired = $_G['uid'] ? !C::t('common_credit_log')->count_by_uid_operation_relatedid($_G['uid'], 'BAC', $attach['aid']) : 1;
$payrequired && showmessage('attachement_payto_attach', 'forum.php?mod=misc&action=attachpay&aid='.$attach['aid'].'&tid='.$attach['tid']);
}
if(!$ispaid && !$allowgetattach) {
if(($forum['getattachperm'] && !forumperm($forum['getattachperm'])) || ($forum['viewperm'] && !forumperm($forum['viewperm']))) {
showmessagenoperm('getattachperm', $forum['fid']);
} else {
showmessage('getattachperm_none_nopermission', NULL, array(), array('login' => 1));
}
}
}
$isimage = $attach['isimage'];
$_G['setting']['ftp']['hideurl'] = $_G['setting']['ftp']['hideurl'] || ($isimage && !empty($_GET['noupdate']) && $_G['setting']['attachimgpost'] && strtolower(substr($_G['setting']['ftp']['attachurl'], 0, 3)) == 'ftp');
if(empty($_GET['nothumb']) && $attach['isimage'] && $attach['thumb']) {
$db = DB::object();
$db->close();
!$_G['config']['output']['gzip'] && ob_end_clean();
dheader('Content-Disposition: inline; filename='.getimgthumbname($attach['filename']));
dheader('Content-Type: image/pjpeg');
if($attach['remote']) {
$_G['setting']['ftp']['hideurl'] ? getremotefile(getimgthumbname($attach['attachment'])) : dheader('location:'.$_G['setting']['ftp']['attachurl'].'forum/'.getimgthumbname($attach['attachment']));
} else {
getlocalfile($_G['setting']['attachdir'].'/forum/'.getimgthumbname($attach['attachment']));
}
exit();
}
$filename = $_G['setting']['attachdir'].'/forum/'.$attach['attachment'];
if(!$attach['remote'] && !is_readable($filename)) {
if(!$requestmode) {
showmessage('attachment_nonexistence');
} else {
exit;
}
}
if(!$requestmode) {
$exemptvalue = $ismoderator ? 32 : 4;
if(!$isimage && !($_G['group']['exempt'] & $exemptvalue)) {
$creditlog = updatecreditbyaction('getattach', $_G['uid'], array(), '', 1, 0, $thread['fid']);
if($creditlog['updatecredit']) {
if($_G['uid']) {
$k = $_GET['ck'];
$t = $_GET['t'];
if(empty($k) || empty($t) || $k != substr(md5($aid.$t.md5($_G['config']['security']['authkey'])), 0, 8) || TIMESTAMP - $t > 3600) {
dheader('location: forum.php?mod=misc&action=attachcredit&aid='.$attach['aid'].'&formhash='.FORMHASH);
exit();
}
} else {
showmessage('attachment_forum_nopermission', NULL, array(), array('login' => 1));
}
}
}
}
$range_start = 0;
$range_end = 0;
$has_range_header = false;
if(($readmod == 4 || $readmod == 1) && !empty($_SERVER['HTTP_RANGE'])) {
$has_range_header = true;
list($range_start, $range_end) = explode('-',(str_replace('bytes=', '', $_SERVER['HTTP_RANGE'])));
}
if(!$requestmode && !$has_range_header && empty($_GET['noupdate'])) {
if($_G['setting']['delayviewcount']) {
$_G['forum_logfile'] = './data/cache/forum_attachviews_'.intval(getglobal('config/server/id')).'.log';
if(substr(TIMESTAMP, -1) == '0') {
attachment_updateviews($_G['forum_logfile']);
}
if(file_put_contents(DISCUZ_ROOT.$_G['forum_logfile'], "$aid\n", FILE_APPEND) === false) {
if($_G['adminid'] == 1) {
showmessage('view_log_invalid', '', array('logfile' => $_G['forum_logfile']));
}
C::t('forum_attachment')->update_download($aid);
}
} else {
C::t('forum_attachment')->update_download($aid);
}
}
$db = DB::object();
$db->close();
!$_G['config']['output']['gzip'] && ob_end_clean();
if($attach['remote'] && !$_G['setting']['ftp']['hideurl'] && $isimage) {
dheader('location:'.$_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment']);
}
$mimetype = ext_to_mimetype($attach['filename']);
$filesize = !$attach['remote'] ? filesize($filename) : $attach['filesize'];
if ($has_range_header && !$range_end) $range_end = $filesize - 1;
$filenameencode = strtolower(CHARSET) == 'utf-8' ? rawurlencode($attach['filename']) : rawurlencode(diconv($attach['filename'], CHARSET, 'UTF-8'));
$rfc6266blacklist = strexists($_SERVER['HTTP_USER_AGENT'], 'UCBrowser') || strexists($_SERVER['HTTP_USER_AGENT'], 'Quark') || strexists($_SERVER['HTTP_USER_AGENT'], 'SogouM') || strexists($_SERVER['HTTP_USER_AGENT'], 'baidu');
dheader('Date: '.gmdate('D, d M Y H:i:s', $attach['dateline']).' GMT');
dheader('Last-Modified: '.gmdate('D, d M Y H:i:s', $attach['dateline']).' GMT');
dheader('Content-Encoding: none');
if($isimage && !empty($_GET['noupdate']) || !empty($_GET['request'])) {
$cdtype = 'inline';
} else {
$cdtype = 'attachment';
}
dheader('Content-Disposition: '.$cdtype.'; '.'filename="'.$filenameencode.'"'.(($attach['filename'] == $filenameencode || $rfc6266blacklist) ? '' : '; filename*=utf-8\'\''.$filenameencode));
if($isimage) {
dheader('Content-Type: image');
} else {
dheader('Content-Type: ' . $mimetype);
}
dheader('Content-Length: '.$filesize);
if(!$attach['remote']) {
$xsendfile = getglobal('config/download/xsendfile');
if(!empty($xsendfile)) {
$type = intval($xsendfile['type']);
if($isimage){
$type = 0;
}
$cmd = '';
switch ($type) {
case 1: $cmd = 'X-Accel-Redirect'; $url = $xsendfile['dir'].$attach['attachment']; break;
case 2: $cmd = $_SERVER['SERVER_SOFTWARE'] <'lighttpd/1.5' ? 'X-LIGHTTPD-send-file' : 'X-Sendfile'; $url = $filename; break;
case 3: $cmd = 'X-Sendfile'; $url = $filename; break;
}
if($cmd) {
dheader("$cmd: $url");
exit();
}
}
if (($readmod == 4) || ($readmod == 1)) {
dheader('Accept-Ranges: bytes');
if($has_range_header) {
$rangesize = ($range_end - $range_start) >= 0 ? ($range_end - $range_start) + 1 : 0;
dheader('Content-Length: '.$rangesize);
dheader('HTTP/1.1 206 Partial Content');
dheader('Content-Range: bytes '.$range_start.'-'.$range_end.'/'.($filesize));
}
}
}
$attach['remote'] ? getremotefile($attach['attachment']) : getlocalfile($filename, $readmod, $range_start, $range_end);
function getremotefile($file) {
global $_G;
@set_time_limit(0);
if(!@readfile($_G['setting']['ftp']['attachurl'].'forum/'.$file)) {
$ftp = ftpcmd('object');
$tmpfile = @tempnam($_G['setting']['attachdir'], '');
if(is_object($ftp) && $ftp->ftp_get($tmpfile, 'forum/'.$file, FTP_BINARY)) {
@readfile($tmpfile);
@unlink($tmpfile);
} else {
@unlink($tmpfile);
return FALSE;
}
}
return TRUE;
}
function getlocalfile($filename, $readmod = 2, $range_start = 0, $range_end = 0) {
if($readmod == 1 || $readmod == 3 || $readmod == 4) {
if($fp = @fopen($filename, 'rb')) {
@fseek($fp, $range_start);
if(function_exists('fpassthru') && ($readmod == 3 || $readmod == 4) && ($range_end <= 0)) {
@fpassthru($fp);
} else {
if ($range_end > 0) {
send_file_by_chunk($fp, $range_end - $range_start + 1);
} else {
send_file_by_chunk($fp);
}
}
}
@fclose($fp);
} else {
@readfile($filename);
}
@flush(); @ob_flush();
}
function send_file_by_chunk($fp, $limit = PHP_INT_MAX) {
static $CHUNK_SIZE = 65536;
$count = 0;
while (!feof($fp)) {
$size_to_read = $CHUNK_SIZE;
if ($count + $size_to_read > $limit) $size_to_read = $limit - $count;
$buf = fread($fp, $size_to_read);
echo $buf;
flush();
ob_flush();
$count += strlen($buf);
if ($count >= $limit) break;
}
}
function attachment_updateviews($logfile) {
$viewlog = $viewarray = array();
$newlog = DISCUZ_ROOT.$logfile.random(6);
if(@rename(DISCUZ_ROOT.$logfile, $newlog)) {
$viewlog = file($newlog);
unlink($newlog);
if(is_array($viewlog) && !empty($viewlog)) {
$viewlog = array_count_values($viewlog);
foreach($viewlog as $id => $views) {
if($id > 0) {
$viewarray[$views][] = intval($id);
}
}
foreach($viewarray as $views => $ids) {
C::t('forum_attachment')->update_download($ids, $views);
}
}
}
}
function ext_to_mimetype($path) {
$ext = pathinfo($path, PATHINFO_EXTENSION);
$map = array(
'aac' => 'audio/aac',
'flac' => 'audio/flac',
'mp3' => 'audio/mpeg',
'm4a' => 'audio/mp4',
'wav' => 'audio/wav',
'ogg' => 'audio/ogg',
'weba' => 'audio/webm',
'flv' => 'video/x-flv',
'mp4' => 'video/mp4',
'm4v' => 'video/mp4',
'3gp' => 'video/3gpp',
'ogv' => 'video/ogg',
'webm' => 'video/webm'
);
$mime = $map[$ext];
if (!$mime) $mime = "application/octet-stream";
return $mime;
}
?>

View File

@@ -0,0 +1,44 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_collection.php 28448 2012-03-01 03:27:53Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['setting']['collectionstatus']) {
showmessage('collection_status_off');
}
require_once libfile('function/collection');
$tpp = $_G['setting']['topicperpage']; //per page
$maxteamworkers = $_G['setting']['collectionteamworkernum'];
$action = trim($_GET['action']);
$ctid = $_GET['ctid'];
$page = $_GET['page'];
$tid = intval($_GET['tid']);
$op = trim($_GET['op']);
$page = $page ? $page : 1;
if(!is_array($ctid)) {
$ctid = intval($ctid);
$_G['collection'] = C::t('forum_collection')->fetch($ctid);
}
$allowaction = array('index', 'view', 'edit', 'follow', 'comment', 'mycollection', 'all');
if(!in_array($action, $allowaction)) {
$action = 'index';
}
require_once libfile('collection/'.$action, 'include');
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,748 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_group.php 33695 2013-08-03 04:39:22Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['setting']['groupstatus']) {
showmessage('group_module_status_off');
}
require_once libfile('function/group');
$_G['action']['action'] = 3;
$_G['action']['fid'] = $_G['fid'];
$_G['basescript'] = 'group';
$actionarray = array('join', 'out', 'create', 'viewmember', 'manage', 'index', 'memberlist', 'recommend');
$action = getgpc('action') && in_array($_GET['action'], $actionarray) ? $_GET['action'] : 'index';
if(in_array($action, array('join', 'out', 'create', 'manage', 'recommend'))) {
if(empty($_G['uid'])) {
showmessage('not_loggedin', '', '', array('login' => 1));
}
}
if(empty($_G['fid']) && $action != 'create') {
showmessage('group_rediret_now', 'group.php');
}
$first = &$_G['cache']['grouptype']['first'];
$second = &$_G['cache']['grouptype']['second'];
$rssauth = $_G['rssauth'];
$rsshead = $_G['setting']['rssstatus'] ? ('<link rel="alternate" type="application/rss+xml" title="'.$_G['setting']['bbname'].' - '.$navtitle.'" href="'.$_G['siteurl'].'forum.php?mod=rss&fid='.$_G['fid'].'&amp;auth='.$rssauth."\" />\n") : '';
if($_G['fid']) {
if($_G['forum']['status'] != 3) {
showmessage('forum_not_group', 'group.php');
} elseif($_G['forum']['level'] == -1) {
showmessage('group_verify', '', array(), array('alert' => 'info'));
} elseif($_G['forum']['jointype'] < 0 && !$_G['forum']['ismoderator']) {
showmessage('forum_group_status_off', 'group.php');
}
$groupcache = getgroupcache($_G['fid'], array('replies', 'views', 'digest', 'lastpost', 'ranking', 'activityuser', 'newuserlist'), 604800);
$_G['forum']['icon'] = get_groupimg($_G['forum']['icon'], 'icon');
$_G['forum']['banner'] = get_groupimg($_G['forum']['banner']);
$_G['forum']['dateline'] = dgmdate($_G['forum']['dateline'], 'd');
$_G['forum']['posts'] = intval($_G['forum']['posts']);
$_G['grouptypeid'] = $_G['forum']['fup'];
$groupuser = C::t('forum_groupuser')->fetch_userinfo($_G['uid'], $_G['fid']);
$onlinemember = grouponline($_G['fid'], 1);
$groupmanagers = $_G['forum']['moderators'];
$nav = get_groupnav($_G['forum']);
$groupnav = $nav['nav'];
$seodata = array('forum' => $_G['forum']['name'], 'first' => $nav['first']['name'], 'second' => $nav['second']['name'], 'gdes' => $_G['forum']['description']);
list($navtitle, $metadescription, $metakeywords) = get_seosetting('grouppage', $seodata);
if(!$navtitle) {
$navtitle = helper_seo::get_title_page($_G['forum']['name'], $_G['page']).' - '.$_G['setting']['navs'][3]['navname'];
$nobbname = false;
} else {
$nobbname = true;
}
if(!$metakeywords) {
$metakeywords = $_G['forum']['name'];
}
if(!$metadescription) {
$metadescription = $_G['forum']['name'];
}
$_G['seokeywords'] = $_G['setting']['seokeywords']['group'];
$_G['seodescription'] = $_G['setting']['seodescription']['group'];
}
if(in_array($action, array('out', 'viewmember', 'manage', 'index', 'memberlist'))) {
$status = groupperm($_G['forum'], $_G['uid'], $action, $groupuser);
if($status == -1) {
showmessage('forum_not_group', 'group.php');
} elseif($status == 1) {
showmessage('forum_group_status_off');
}
if($action != 'index') {
if($status == 2) {
showmessage('forum_group_noallowed', "forum.php?mod=group&fid={$_G['fid']}");
} elseif($status == 3) {
showmessage('forum_group_moderated', "forum.php?mod=group&fid={$_G['fid']}");
}
}
}
if(in_array($action, array('index')) && $status != 2) {
$newuserlist = $activityuserlist = array();
foreach($groupcache['newuserlist']['data'] as $user) {
$newuserlist[$user['uid']] = $user;
$newuserlist[$user['uid']]['online'] = !empty($onlinemember['list']) && is_array($onlinemember['list']) && !empty($onlinemember['list'][$user['uid']]) ? 1 : 0;
}
$activityuser = array_slice($groupcache['activityuser']['data'], 0, 8);
foreach($activityuser as $user) {
$activityuserlist[$user['uid']] = $user;
$activityuserlist[$user['uid']]['online'] = !empty($onlinemember['list']) && is_array($onlinemember['list']) && !empty($onlinemember['list'][$user['uid']]) ? 1 : 0;
}
$groupviewed_list = get_viewedgroup();
}
$showpoll = $showtrade = $showreward = $showactivity = $showdebate = 0;
if($_G['forum']['allowpostspecial']) {
$showpoll = $_G['forum']['allowpostspecial'] & 1;
$showtrade = $_G['forum']['allowpostspecial'] & 2;
$showreward = isset($_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]) && ($_G['forum']['allowpostspecial'] & 4);
$showactivity = $_G['forum']['allowpostspecial'] & 8;
$showdebate = $_G['forum']['allowpostspecial'] & 16;
}
if($_G['group']['allowpost']) {
$_G['group']['allowpostpoll'] = $_G['group']['allowpostpoll'] && $showpoll;
$_G['group']['allowposttrade'] = $_G['group']['allowposttrade'] && $showtrade;
$_G['group']['allowpostreward'] = $_G['group']['allowpostreward'] && $showreward;
$_G['group']['allowpostactivity'] = $_G['group']['allowpostactivity'] && $showactivity;
$_G['group']['allowpostdebate'] = $_G['group']['allowpostdebate'] && $showdebate;
}
if($action == 'index') {
$newthreadlist = $livethread = array();
if($status != 2) {
loadcache('forumstick');
$forumstickytids = '';
if(isset($_G['cache']['forumstick'][$_G['forum']['fup']])) {
$forumstickytids = $_G['cache']['forumstick'][$_G['forum']['fup']];
}
require_once libfile('function/feed');
if($forumstickytids) {
foreach(C::t('forum_thread')->fetch_all_by_tid_or_fid($_G['fid'], $forumstickytids) as $row) {
$row['dateline'] = dgmdate($row['dateline'], 'd');
$row['lastpost'] = dgmdate($row['lastpost'], 'u');
$row['allreplies'] = $row['replies'] + $row['comments'];
$row['lastposterenc'] = rawurlencode($row['lastposter']);
$stickythread[$row['tid']] = $row;
}
}
$newthreadlist = getgroupcache($_G['fid'], array('dateline'), 0, 10, 0, 1);
foreach($newthreadlist['dateline']['data'] as $key => $thread) {
if(!empty($stickythread) && $stickythread[$thread['tid']]) {
unset($newthreadlist['dateline']['data'][$key]);
continue;
}
$newthreadlist['dateline']['data'][$key]['allreplies'] = $newthreadlist['dateline']['data'][$key]['replies'] + $newthreadlist['dateline']['data'][$key]['comments'];
if($thread['closed'] == 1) {
$newthreadlist['dateline']['data'][$key]['folder'] = 'lock';
} elseif(empty($_G['cookie']['oldtopics']) || strpos($_G['cookie']['oldtopics'], 'D'.$thread['tid'].'D') === FALSE) {
$newthreadlist['dateline']['data'][$key]['folder'] = 'new';
} else {
$newthreadlist['dateline']['data'][$key]['folder'] = 'common';
}
}
if($stickythread) {
$newthreadlist['dateline']['data'] = array_merge($stickythread, $newthreadlist['dateline']['data']);
}
$groupfeedlist = array();
if(!IS_ROBOT) {
$activityuser = array_keys($groupcache['activityuser']['data']);
if($activityuser) {
$query = C::t('home_feed')->fetch_all_by_uid_dateline($activityuser);
foreach($query as $feed) {
if($feed['friend'] == 0) {
$groupfeedlist[] = mkfeed($feed);
}
}
}
}
if($_G['forum']['livetid']) {
include_once libfile('function/post');
$livethread = C::t('forum_thread')->fetch_thread($_G['forum']['livetid']);
$livepost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['forum']['livetid']);
$livemessage = threadmessagecutstr($livethread, $livepost['message'], 200);
$liveallowpostreply = $groupuser['uid'] && $groupuser['level'] ? true : false;
list($seccodecheck, $secqaacheck) = seccheck('post', 'newthread');
}
} else {
$newuserlist = $activityuserlist = array();
$newuserlist = array_slice($groupcache['newuserlist']['data'], 0, 4);
foreach($newuserlist as $user) {
$newuserlist[$user['uid']] = $user;
$newuserlist[$user['uid']]['online'] = !empty($onlinemember['list']) && is_array($onlinemember['list']) && !empty($onlinemember['list'][$user['uid']]) ? 1 : 0;
}
}
write_groupviewed($_G['fid']);
include template('diy:group/group:'.$_G['fid']);
} elseif($action == 'memberlist') {
$oparray = array('card', 'address', 'alluser');
$op = getgpc('op') && in_array($_GET['op'], $oparray) ? $_GET['op'] : 'alluser';
$page = intval(getgpc('page')) ? intval($_GET['page']) : 1;
$perpage = 50;
$start = ($page - 1) * $perpage;
$alluserlist = $adminuserlist = array();
$staruserlist = $page < 2 ? C::t('forum_groupuser')->groupuserlist($_G['fid'], 'lastupdate', 0, 0, array('level' => '3'), array('uid', 'username', 'level', 'joindateline', 'lastupdate')) : '';
$adminlist = $groupmanagers && $page < 2 ? $groupmanagers : array();
if($op == 'alluser') {
$alluserlist = C::t('forum_groupuser')->groupuserlist($_G['fid'], 'lastupdate', $perpage, $start, "AND level='4'", '', $onlinemember['list']);
$multipage = multi($_G['forum']['membernum'], $perpage, $page, 'forum.php?mod=group&action=memberlist&op=alluser&fid='.$_G['fid']);
if($adminlist) {
foreach($adminlist as $user) {
$adminuserlist[$user['uid']] = $user;
$adminuserlist[$user['uid']]['online'] = $onlinemember['list'] && is_array($onlinemember['list']) && $onlinemember['list'][$user['uid']] ? 1 : 0;
}
}
}
include template('diy:group/group:'.$_G['fid']);
} elseif($action == 'join') {
if(!submitcheck('groupjoin')) {
dheader('location: '.$_G['siteurl']."forum.php?mod=forumdisplay&fid={$_G['fid']}&extra=join");
}
$inviteuid = 0;
$membermaximum = $_G['current_grouplevel']['specialswitch']['membermaximum'];
if(!empty($membermaximum)) {
$curnum = C::t('forum_groupuser')->fetch_count_by_fid($_G['fid']);
if($curnum >= $membermaximum) {
showmessage('group_member_maximum', '', array('membermaximum' => $membermaximum));
}
}
if($groupuser['uid']) {
showmessage('group_has_joined', "forum.php?mod=group&fid={$_G['fid']}");
} else {
$modmember = 4;
$showmessage = 'group_join_succeed';
$confirmjoin = TRUE;
$inviteuid = C::t('forum_groupinvite')->fetch_uid_by_inviteuid($_G['fid'], $_G['uid']);
if($_G['forum']['jointype'] == 1) {
if(!$inviteuid) {
$confirmjoin = FALSE;
$showmessage = 'group_join_need_invite';
}
} elseif($_G['forum']['jointype'] == 2) {
$modmember = !empty($groupmanagers[$inviteuid]) || $_G['adminid'] == 1 ? 4 : 0;
!empty($groupmanagers[$inviteuid]) && $showmessage = 'group_join_apply_succeed';
}
if($confirmjoin) {
C::t('forum_groupuser')->insert($_G['fid'], $_G['uid'], $_G['username'], $modmember, TIMESTAMP, TIMESTAMP);
if($_G['forum']['jointype'] == 2 && (empty($inviteuid) || empty($groupmanagers[$inviteuid]))) {
foreach($groupmanagers as $manage) {
notification_add($manage['uid'], 'group', 'group_member_join', array('fid' => $_G['fid'], 'groupname' => $_G['forum']['name'], 'url' => $_G['siteurl'].'forum.php?mod=group&action=manage&op=checkuser&fid='.$_G['fid']), 1);
}
} else {
}
if($inviteuid) {
C::t('forum_groupinvite')->delete_by_inviteuid($_G['fid'], $_G['uid']);
}
if($modmember == 4) {
C::t('forum_forumfield')->update_membernum($_G['fid']);
}
C::t('forum_forumfield')->update($_G['fid'], array('lastupdate' => TIMESTAMP));
}
include_once libfile('function/stat');
updatestat('groupjoin');
delgroupcache($_G['fid'], array('activityuser', 'newuserlist'));
showmessage($showmessage, "forum.php?mod=group&fid={$_G['fid']}");
}
} elseif($action == 'out') {
if(!submitcheck('groupexit')) {
showmessage('undefined_action');
}
if($_G['uid'] == $_G['forum']['founderuid']) {
showmessage('group_exit_founder');
}
$showmessage = 'group_exit_succeed';
C::t('forum_groupuser')->delete_by_fid($_G['fid'], $_G['uid']);
C::t('forum_forumfield')->update_membernum($_G['fid'], -1);
update_groupmoderators($_G['fid']);
delgroupcache($_G['fid'], array('activityuser', 'newuserlist'));
showmessage($showmessage, "forum.php?mod=forumdisplay&fid={$_G['fid']}");
} elseif($action == 'create') {
if(!$_G['group']['allowbuildgroup']) {
showmessage('group_create_usergroup_failed', "group.php");
}
$creditstransextra = $_G['setting']['creditstransextra']['12'] ? $_G['setting']['creditstransextra']['12'] : $_G['setting']['creditstrans'];
if($_G['group']['buildgroupcredits']) {
if(empty($creditstransextra)) {
$_G['group']['buildgroupcredits'] = 0;
} else {
getuserprofile('extcredits'.$creditstransextra);
if($_G['member']['extcredits'.$creditstransextra] < $_G['group']['buildgroupcredits']) {
showmessage('group_create_usergroup_credits_failed', '', array('buildgroupcredits' => $_G['group']['buildgroupcredits']. $_G['setting']['extcredits'][$creditstransextra]['unit'].$_G['setting']['extcredits'][$creditstransextra]['title']));
}
}
}
$groupnum = C::t('forum_forumfield')->fetch_groupnum_by_founderuid($_G['uid']);
$allowbuildgroup = $_G['group']['allowbuildgroup'] - $groupnum;
if($allowbuildgroup < 1) {
showmessage('group_create_max_failed');
}
$_GET['fupid'] = intval($_GET['fupid']);
$_GET['groupid'] = intval($_GET['groupid']);
if(!submitcheck('createsubmit')) {
$groupselect = get_groupselect(getgpc('fupid'), getgpc('groupid'));
} else {
$parentid = intval($_GET['parentid']);
$fup = intval($_GET['fup']);
$name = censor(dhtmlspecialchars(cutstr(trim($_GET['name']), 20, '')), NULL, FALSE, FALSE);
$censormod = censormod($name);
if(empty($name)) {
showmessage('group_name_empty');
} elseif($censormod) {
showmessage('group_name_failed');
} elseif(empty($parentid) && empty($fup)) {
showmessage('group_category_empty');
}
if(empty($_G['cache']['grouptype']['first'][$parentid]) && empty($_G['cache']['grouptype']['second'][$fup])
|| $_G['cache']['grouptype']['first'][$parentid]['secondlist'] && !in_array($_G['cache']['grouptype']['second'][$fup]['fid'], $_G['cache']['grouptype']['first'][$parentid]['secondlist'])) {
showmessage('group_category_error');
}
if(empty($fup)) {
$fup = $parentid;
}
if(C::t('forum_forum')->fetch_fid_by_name($name)) {
showmessage('group_name_exist');
}
require_once libfile('function/discuzcode');
$descriptionnew = discuzcode(dhtmlspecialchars(censor(trim($_GET['descriptionnew']), NULL, FALSE, FALSE)), 0, 0, 0, 0, 1, 1, 0, 0, 1);
$censormod = censormod($descriptionnew);
if($censormod) {
showmessage('group_description_failed');
}
if(empty($_G['setting']['groupmod']) || $_G['adminid'] == 1) {
$levelinfo = C::t('forum_grouplevel')->fetch_by_credits();
$levelid = $levelinfo['levelid'];
} else {
$levelid = -1;
}
$newfid = C::t('forum_forum')->insert_group($fup, 'sub', $name, '3', $levelid);
if($newfid) {
$jointype = intval($_GET['jointype']);
$gviewperm = intval($_GET['gviewperm']);
$fieldarray = array('fid' => $newfid, 'description' => $descriptionnew, 'jointype' => $jointype, 'gviewperm' => $gviewperm, 'dateline' => TIMESTAMP, 'founderuid' => $_G['uid'], 'foundername' => $_G['username'], 'membernum' => 1);
C::t('forum_forumfield')->insert($fieldarray);
C::t('forum_forumfield')->update_groupnum($fup, 1);
C::t('forum_groupuser')->insert($newfid, $_G['uid'], $_G['username'], 1, TIMESTAMP);
require_once libfile('function/cache');
updatecache('grouptype');
}
if($creditstransextra && $_G['group']['buildgroupcredits']) {
updatemembercount($_G['uid'], array($creditstransextra => -$_G['group']['buildgroupcredits']), 1, 'BGR', $newfid);
}
include_once libfile('function/stat');
updatestat('group');
if($levelid == -1) {
showmessage('group_create_mod_succeed', "group.php?mod=my&view=manager", array(), array('alert' => 'right', 'showdialog' => 1, 'showmsg' => true, 'locationtime' => true));
}
showmessage('group_create_succeed', "forum.php?mod=group&action=manage&fid=$newfid", array(), array('showdialog' => 1, 'showmsg' => true, 'locationtime' => true));
}
include template('diy:group/group:'.$_G['fid']);
} elseif($action == 'manage'){
if(!$_G['forum']['ismoderator']) {
showmessage('group_admin_noallowed');
}
$specialswitch = $_G['current_grouplevel']['specialswitch'];
$oparray = array('group', 'checkuser', 'manageuser', 'threadtype', 'demise');
$_GET['op'] = getgpc('op') && in_array($_GET['op'], $oparray) ? $_GET['op'] : 'group';
if(empty($groupmanagers[$_G['uid']]) && !in_array($_GET['op'], array('group', 'threadtype', 'demise')) && $_G['adminid'] != 1) {
showmessage('group_admin_noallowed');
}
$page = intval(getgpc('page')) ? intval($_GET['page']) : 1;
$perpage = 50;
$start = ($page - 1) * $perpage;
$url = 'forum.php?mod=group&action=manage&op='.$_GET['op'].'&fid='.$_G['fid'];
if($_GET['op'] == 'group') {
$domainlength = checkperm('domainlength');
if(submitcheck('groupmanage')) {
$forumarr = array();
if(isset($_GET['domain']) && $_G['forum']['domain'] != $_GET['domain']) {
$domain = strtolower(trim($_GET['domain']));
if($_G['setting']['allowgroupdomain'] && !empty($_G['setting']['domain']['root']['group']) && $domainlength) {
checklowerlimit('modifydomain');
}
require_once libfile('function/delete');
if(empty($domainlength) || empty($domain)) {
$domain = '';
deletedomain($_G['fid'], 'group');
} else {
require_once libfile('function/domain');
if(domaincheck($domain, $_G['setting']['domain']['root']['group'], $domainlength)) {
deletedomain($_G['fid'], 'group');
C::t('common_domain')->insert(array('domain' => $domain, 'domainroot' => $_G['setting']['domain']['root']['group'], 'id' => $_G['fid'], 'idtype' => 'group'));
}
}
$forumarr['domain'] = $domain;
updatecreditbyaction('modifydomain');
}
if(($_GET['name'] && !empty($specialswitch['allowchangename'])) || ($_GET['fup'] && !empty($specialswitch['allowchangetype']))) {
if($_G['uid'] != $_G['forum']['founderuid'] && $_G['adminid'] != 1) {
showmessage('group_edit_only_founder');
}
$fup = intval($_GET['fup']);
$parentid = intval($_GET['parentid']);
if(isset($_GET['name'])) {
$_GET['name'] = censor(dhtmlspecialchars(cutstr(trim($_GET['name']), 20, '')), NULL, FALSE, FALSE);
if(empty($_GET['name'])) {
showmessage('group_name_empty');
}
$censormod = censormod($_GET['name']);
if($censormod) {
showmessage('group_name_failed');
}
} elseif(isset($_GET['parentid']) && empty($parentid) && empty($fup)) {
showmessage('group_category_empty');
}
if(!empty($_GET['name']) && $_GET['name'] != $_G['forum']['name']) {
if(C::t('forum_forum')->fetch_fid_by_name($_GET['name'])) {
showmessage('group_name_exist', $url);
}
$forumarr['name'] = $_GET['name'];
}
if(empty($fup)) {
$fup = $parentid;
}
if(isset($_GET['parentid']) && $fup != $_G['forum']['fup']) {
$forumarr['fup'] = $fup;
}
}
if($forumarr) {
C::t('forum_forum')->update($_G['fid'], $forumarr);
if($forumarr['fup']) {
C::t('forum_forumfield')->update_groupnum($forumarr['fup'], 1);
C::t('forum_forumfield')->update_groupnum($_G['forum']['fup'], -1);
require_once libfile('function/cache');
updatecache('grouptype');
}
}
$setarr = array();
$deletebanner = $_GET['deletebanner'];
$iconnew = upload_icon_banner($_G['forum'], $_FILES['iconnew'], 'icon');
$bannernew = upload_icon_banner($_G['forum'], $_FILES['bannernew'], 'banner');
if($iconnew) {
$setarr['icon'] = $iconnew;
$group_recommend = dunserialize($_G['setting']['group_recommend']);
if($group_recommend[$_G['fid']]) {
$group_recommend[$_G['fid']]['icon'] = get_groupimg($iconnew);
C::t('common_setting')->update_setting('group_recommend', $group_recommend);
include libfile('function/cache');
updatecache('setting');
}
}
if($bannernew && empty($deletebanner)) {
$setarr['banner'] = $bannernew;
} elseif($deletebanner) {
$setarr['banner'] = '';
@unlink($_G['forum']['banner']);
}
require_once libfile('function/discuzcode');
$_GET['descriptionnew'] = discuzcode(censor(trim($_GET['descriptionnew']), NULL, FALSE, FALSE), 0, 0, 0, 0, 1, 1, 0, 0, 1);
$censormod = censormod($_GET['descriptionnew']);
if($censormod) {
showmessage('group_description_failed');
}
$_GET['jointypenew'] = intval($_GET['jointypenew']);
if($_GET['jointypenew'] == '-1' && $_G['uid'] != $_G['forum']['founderuid']) {
showmessage('group_close_only_founder');
}
$_GET['gviewpermnew'] = intval($_GET['gviewpermnew']);
$setarr['description'] = $_GET['descriptionnew'];
$setarr['jointype'] = $_GET['jointypenew'];
$setarr['gviewperm'] = $_GET['gviewpermnew'];
C::t('forum_forumfield')->update($_G['fid'], $setarr);
showmessage('group_setup_succeed', $url);
} else {
$firstgid = $_G['cache']['grouptype']['second'][$_G['forum']['fup']]['fup'];
$groupselect = get_groupselect($firstgid ? $firstgid : $_G['forum']['fup'], $_G['forum']['fup']);
$gviewpermselect = $jointypeselect = array('','','');
require_once libfile('function/editor');
$_G['forum']['descriptionnew'] = html2bbcode($_G['forum']['description']);
$jointypeselect[$_G['forum']['jointype']] = 'checked="checked"';
$gviewpermselect[$_G['forum']['gviewperm']] = 'checked="checked"';
if($_G['setting']['allowgroupdomain'] && !empty($_G['setting']['domain']['root']['group']) && $domainlength) {
loadcache('creditrule');
getuserprofile('extcredits1');
$rule = $_G['cache']['creditrule']['modifydomain'];
$credits = $consume = $common = '';
for($i = 1; $i <= 8; $i++) {
if($_G['setting']['extcredits'][$i] && $rule['extcredits'.$i]) {
$consume .= $common.$_G['setting']['extcredits'][$i]['title'].$rule['extcredits'.$i].$_G['setting']['extcredits'][$i]['unit'];
$credits .= $common.$_G['setting']['extcredits'][$i]['title'].$_G['member']['extcredits'.$i].$_G['setting']['extcredits'][$i]['unit'];
$common = ',';
}
}
}
}
} elseif($_GET['op'] == 'checkuser') {
$checktype = 0;
$checkusers = array();
if(!empty($_GET['uid'])) {
$checkusers = array($_GET['uid']);
$checktype = intval($_GET['checktype']);
} elseif(getgpc('checkall') == 1 || getgpc('checkall') == 2) {
$checktype = $_GET['checkall'];
$query = C::t('forum_groupuser')->fetch_all_by_fid($_G['fid'], 1);
foreach($query as $row) {
$checkusers[] = $row['uid'];
}
}
if($checkusers) {
foreach($checkusers as $uid) {
$notification = $checktype == 1 ? 'group_member_check' : 'group_member_check_failed';
notification_add($uid, 'group', $notification, array('fid' => $_G['fid'], 'groupname' => $_G['forum']['name'], 'url' => $_G['siteurl'].'forum.php?mod=group&fid='.$_G['fid']), 1);
}
if($checktype == 1) {
C::t('forum_groupuser')->update_for_user($checkusers, $_G['fid'], null, null, 4);
C::t('forum_forumfield')->update_membernum($_G['fid'], count($checkusers));
} elseif($checktype == 2) {
C::t('forum_groupuser')->delete_by_fid($_G['fid'], $checkusers);
}
if($checktype == 1) {
showmessage('group_moderate_succeed', $url);
} else {
showmessage('group_moderate_failed', $url);
}
} else {
$checkusers = array();
$userlist = C::t('forum_groupuser')->groupuserlist($_G['fid'], 'joindateline', $perpage, $start, array('level' => 0));
$checknum = C::t('forum_groupuser')->fetch_count_by_fid($_G['fid'], 1);
$multipage = multi($checknum, $perpage, $page, $url);
foreach($userlist as $user) {
$user['joindateline'] = date('Y-m-d H:i', $user['joindateline']);
$checkusers[$user['uid']] = $user;
}
}
} elseif($_GET['op'] == 'manageuser') {
$mtype = array(1 => lang('group/template', 'group_moderator'), 2 => lang('group/template', 'group_moderator_vice'), 3 => lang('group/template', 'group_star_member_title'), 4 => lang('group/misc', 'group_normal_member'), 5 => lang('group/misc', 'group_goaway'));
if(!submitcheck('manageuser')) {
$userlist = array();
if(empty($_GET['srchuser'])) {
$staruserlist = $page < 2 ? C::t('forum_groupuser')->groupuserlist($_G['fid'], '', 0, 0, array('level' => '3'), array('uid', 'username', 'level', 'joindateline', 'lastupdate')) : '';
$adminuserlist = $groupmanagers && $page < 2 ? $groupmanagers : array();
$multipage = multi($_G['forum']['membernum'], $perpage, $page, $url);
} else {
$start = 0;
}
$userlist = C::t('forum_groupuser')->groupuserlist($_G['fid'], '', $perpage, $start, $_GET['srchuser'] ? "AND username like '".addslashes($_GET['srchuser'])."%'" : "AND level='4'");
} else {
$muser = getgpc('muid');
$targetlevel = $_GET['targetlevel'];
if($muser && is_array($muser)) {
foreach($muser as $muid => $mlevel) {
if($_G['adminid'] != 1 && $_G['forum']['founderuid'] != $_G['uid'] && $groupmanagers[$muid] && $groupmanagers[$muid]['level'] <= $groupuser['level']) {
showmessage('group_member_level_admin_noallowed.', $url);
}
if($_G['adminid'] == 1 || ($muid != $_G['uid'] && ($_G['forum']['founderuid'] == $_G['uid'] || !$groupmanagers[$muid] || $groupmanagers[$muid]['level'] > $groupuser['level']))) {
if($targetlevel != 5) {
C::t('forum_groupuser')->update_for_user($muid, $_G['fid'], null, null, $targetlevel);
} else {
if(!$groupmanagers[$muid] || count($groupmanagers) > 1) {
C::t('forum_groupuser')->delete_by_fid($_G['fid'], $muid);
C::t('forum_forumfield')->update_membernum($_G['fid'], -1);
} else {
showmessage('group_only_one_moderator', $url);
}
}
}
}
update_groupmoderators($_G['fid']);
showmessage('group_setup_succeed', $url.'&page='.$page);
} else {
showmessage('group_choose_member', $url);
}
}
} elseif($_GET['op'] == 'threadtype') {
if(empty($specialswitch['allowthreadtype'])) {
showmessage('group_level_cannot_do');
}
if($_G['uid'] != $_G['forum']['founderuid'] && $_G['adminid'] != 1) {
showmessage('group_threadtype_only_founder');
}
$typenumlimit = 20;
if(!submitcheck('groupthreadtype')) {
$threadtypes = $checkeds = array();
if(empty($_G['forum']['threadtypes'])) {
$checkeds['status'][0] = 'checked';
$display = 'none';
} else {
$display = '';
$_G['forum']['threadtypes']['status'] = 1;
foreach($_G['forum']['threadtypes'] as $key => $val) {
$val = intval($val);
$checkeds[$key][$val] = 'checked';
}
}
foreach(C::t('forum_threadclass')->fetch_all_by_fid($_G['fid']) as $type) {
$type['enablechecked'] = isset($_G['forum']['threadtypes']['types'][$type['typeid']]) ? ' checked="checked"' : '';
$type['name'] = dhtmlspecialchars($type['name']);
$threadtypes[] = $type;
}
} else {
$threadtypesnew = $_GET['threadtypesnew'];
$threadtypesnew['types'] = $threadtypes['special'] = $threadtypes['show'] = array();
if(is_array($_GET['newname']) && $_GET['newname']) {
$newname = array_unique($_GET['newname']);
if($newname) {
foreach($newname as $key => $val) {
$val = dhtmlspecialchars(censor(cutstr(trim($val), 16, '')));
if($_GET['newenable'][$key] && $val) {
$newtype = C::t('forum_threadclass')->fetch_by_fid_name($_G['fid'], $val);
$newtypeid = $newtype['typeid'];
if(!$newtypeid) {
$typenum = C::t('forum_threadclass')->count_by_fid($_G['fid']);
if($typenum < $typenumlimit) {
$threadtypes_newdisplayorder = intval($_GET['newdisplayorder'][$key]);
$newtypeid = C::t('forum_threadclass')->insert(array('fid' => $_G['fid'], 'name' => $val, 'displayorder' => $threadtypes_newdisplayorder), true);
}
}
if($newtypeid) {
$threadtypesnew['options']['name'][$newtypeid] = $val;
$threadtypesnew['options']['displayorder'][$newtypeid] = $threadtypes_newdisplayorder;
$threadtypesnew['options']['enable'][$newtypeid] = 1;
}
}
}
}
$threadtypesnew['status'] = 1;
} else {
$newname = array();
}
if($threadtypesnew['status']) {
if(is_array($threadtypesnew['options']) && $threadtypesnew['options']) {
if(!empty($threadtypesnew['options']['enable'])) {
$typeids = array_keys($threadtypesnew['options']['enable']);
} else {
$typeids = array(0);
}
if(!empty($threadtypesnew['options']['delete'])) {
C::t('forum_threadclass')->delete_by_typeid_fid($threadtypesnew['options']['delete'], $_G['fid']);
}
foreach(C::t('forum_threadclass')->fetch_all_by_typeid_fid($typeids, $_G['fid']) as $type) {
if($threadtypesnew['options']['name'][$type['typeid']] != $type['name'] || $threadtypesnew['options']['displayorder'][$type['typeid']] != $type['displayorder']) {
$threadtypesnew['options']['name'][$type['typeid']] = dhtmlspecialchars(censor(cutstr(trim($threadtypesnew['options']['name'][$type['typeid']]), 16, '')));
$threadtypesnew['options']['displayorder'][$type['typeid']] = intval($threadtypesnew['options']['displayorder'][$type['typeid']]);
C::t('forum_threadclass')->update_by_typeid_fid($type['typeid'], $_G['fid'], array(
'name' => $threadtypesnew['options']['name'][$type['typeid']],
'displayorder' => $threadtypesnew['options']['displayorder'][$type['typeid']],
));
}
}
}
if($threadtypesnew && $typeids) {
foreach(C::t('forum_threadclass')->fetch_all_by_typeid($typeids) as $type) {
if($threadtypesnew['options']['enable'][$type['typeid']]) {
$threadtypesnew['types'][$type['typeid']] = $threadtypesnew['options']['name'][$type['typeid']];
}
}
}
$threadtypesnew = !empty($threadtypesnew) ? serialize($threadtypesnew) : '';
} else {
$threadtypesnew = '';
}
C::t('forum_forumfield')->update($_G['fid'], array('threadtypes' => $threadtypesnew));
showmessage('group_threadtype_edit_succeed', $url);
}
} elseif($_GET['op'] == 'demise') {
if((!empty($_G['forum']['founderuid']) && $_G['forum']['founderuid'] == $_G['uid']) || $_G['adminid'] == 1) {
$ucresult = $allowbuildgroup = $groupnum = 0;
if(count($groupmanagers) <= 1) {
showmessage('group_cannot_demise');
}
if(submitcheck('groupdemise')) {
$suid = intval($_GET['suid']);
if(empty($suid)) {
showmessage('group_demise_choose_receiver');
}
if(empty($_GET['grouppwd'])) {
showmessage('group_demise_password');
}
loaducenter();
$ucresult = uc_user_login($_G['uid'], $_GET['grouppwd'], 1);
if(!is_array($ucresult) || $ucresult[0] < 1) {
showmessage('group_demise_password_error');
}
$user = getuserbyuid($suid);
loadcache('usergroup_'.$user['groupid']);
$allowbuildgroup = $_G['cache']['usergroup_'.$user['groupid']]['allowbuildgroup'];
if($allowbuildgroup > 0) {
$groupnum = C::t('forum_forumfield')->fetch_groupnum_by_founderuid($suid);
}
if(empty($allowbuildgroup) || $allowbuildgroup - $groupnum < 1) {
showmessage('group_demise_receiver_cannot_do');
}
C::t('forum_forumfield')->update($_G['fid'], array('founderuid' => $suid, 'foundername' => $user['username']));
C::t('forum_groupuser')->update_for_user($suid, $_G['fid'], NULL, NULL, 1);
update_groupmoderators($_G['fid']);
sendpm($suid, lang('group/misc', 'group_demise_message_title', array('forum' => $_G['forum']['name'])), lang('group/misc', 'group_demise_message_body', array('forum' => $_G['forum']['name'], 'siteurl' => $_G['siteurl'], 'fid' => $_G['fid'])), $_G['uid']);
showmessage('group_demise_succeed', 'forum.php?mod=group&action=manage&fid='.$_G['fid']);
}
} else {
showmessage('group_demise_founder_only');
}
} else {
showmessage('undefined_action');
}
include template('diy:group/group:'.$_G['fid']);
} elseif($action == 'recommend') {
if(!$_G['forum']['ismoderator'] || !in_array($_G['adminid'], array(1,2))) {
showmessage('group_admin_noallowed');
}
if(submitcheck('grouprecommend')) {
if($_GET['recommend'] != $_G['forum']['recommend']) {
C::t('forum_forum')->update($_G['fid'], array('recommend' => intval($_GET['recommend'])));
require_once libfile('function/cache');
updatecache('forumrecommend');
}
showmessage('grouprecommend_succeed', '', array(), array('alert' => 'right', 'closetime' => true, 'showdialog' => 1));
} else {
require_once libfile('function/forumlist');
$forumselect = forumselect(FALSE, 0, $_G['forum']['recommend']);
}
include template('group/group_recommend');
}
?>

View File

@@ -0,0 +1,485 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_guide.php 34066 2013-09-27 08:36:09Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['setting']['guidestatus']) {
showmessage('guide_status_off');
}
$view = $_GET['view'];
loadcache('forum_guide');
require_once libfile('function/forumlist');
$setting_guide = dunserialize($_G['setting']['guide']);
$setting_guide['index'] = $setting_guide['index'] ? $setting_guide['index'] : 'hot';
if(!in_array($view, array('hot', 'digest', 'new', 'my', 'newthread', 'sofa', 'index'))) {
$view = $setting_guide['index'];
}
$lang = lang('forum/template');
$navtitle = $lang['guide'].'-'.$lang['guide_'.$view];
$perpage = 50;
$start = $perpage * ($_G['page'] - 1);
$data = array();
if($_GET['rss'] == 1) {
if(!$_G['setting']['rssstatus']) {
exit('RSS Disabled');
}
if($view == 'index' || $view == 'my') {
showmessage('URL_ERROR');
}
$ttl = 30;
$charset = $_G['config']['output']['charset'];
dheader("Content-type: application/xml");
echo "<?xml version=\"1.0\" encoding=\"".$charset."\"?>\n".
"<rss version=\"2.0\">\n".
" <channel>\n".
" <title>{$_G['setting']['bbname']} - {$lang['guide']} - ".$lang['guide_'.$view]."</title>\n".
" <link>{$_G['siteurl']}forum.php?mod=guide&amp;view=$view</link>\n".
" <description>".$lang['guide_'.$view]."</description>\n".
" <copyright>Copyright(C) {$_G['setting']['bbname']}</copyright>\n".
" <generator>Discuz! Board by Comsenz Inc.</generator>\n".
" <lastBuildDate>".gmdate('r', TIMESTAMP)."</lastBuildDate>\n".
" <ttl>$ttl</ttl>\n".
" <image>\n".
" <url>{$_G['siteurl']}static/image/common/logo_88_31.gif</url>\n".
" <title>{$_G['setting']['bbname']}</title>\n".
" <link>{$_G['siteurl']}</link>\n".
" </image>\n";
$info = C::t('forum_rsscache')->fetch_all_by_guidetype($view, $perpage);
if(empty($info) || (TIMESTAMP - $info[0]['lastupdate'] > $ttl * 60)) {
update_guide_rsscache($view, $perpage);
}
foreach($info as $thread) {
list($thread['description'], $attachremote, $attachfile, $attachsize) = explode("\t", $thread['description']);
if($attachfile) {
if($attachremote) {
$filename = $_G['setting']['ftp']['attachurl'].'forum/'.$attachfile;
} else {
$filename = $_G['siteurl'].$_G['setting']['attachurl'].'forum/'.$attachfile;
}
}
echo " <item>\n".
" <title>".$thread['subject']."</title>\n".
" <link>{$_G['siteurl']}".($trewriteflag ? rewriteoutput('forum_viewthread', 1, '', $thread['tid']) : "forum.php?mod=viewthread&amp;tid={$thread['tid']}")."</link>\n".
" <description><![CDATA[".dhtmlspecialchars($thread['description'])."]]></description>\n".
" <category>".dhtmlspecialchars($thread['forum'])."</category>\n".
" <author>".dhtmlspecialchars($thread['author'])."</author>\n".
($attachfile ? '<enclosure url="'.$filename.'" length="'.$attachsize.'" type="image/jpeg" />' : '').
" <pubDate>".gmdate('r', $thread['dateline'])."</pubDate>\n".
" </item>\n";
}
echo " </channel>\n".
"</rss>";
exit();
}
if($view != 'index') {
$theurl = 'forum.php?mod=guide&view='.$view;
if($view == 'my') {
if(!$_G['uid']) {
showmessage('to_login', '', array(), array('login' => 1));
}
$lang = lang('forum/template');
$filter_array = array( 'common' => $lang['have_posted'], 'save' => $lang['guide_draft'], 'close' => $lang['close'], 'aduit' => $lang['pending'], 'ignored' => $lang['have_ignored'], 'recyclebin' => $lang['forum_recyclebin']);
$viewtype = in_array($_GET['type'], array('reply', 'thread', 'postcomment')) ? $_GET['type'] : 'thread';
if($searchkey = stripsearchkey($_GET['searchkey'])) {
$searchkey = dhtmlspecialchars($searchkey);
}
$theurl .= '&type='.$viewtype;
$filter = in_array($_GET['filter'], array_keys($filter_array)) ? $_GET['filter'] : '';
$searchbody = 0;
if($filter) {
$theurl .= '&filter='.$filter;
$searchbody = 1;
}
if($_GET['fid']) {
$theurl .= '&fid='.intval($_GET['fid']);
$searchbody = 1;
}
if($searchkey) {
$theurl .= '&searchkey='.$searchkey;
$searchbody = 1;
}
require_once libfile('function/forumlist');
$orderactives[$viewtype] = 'class="a"';
$forumlist = forumselect(FALSE, 0, intval($_GET['fid']));
$data['my'] = get_my_threads($viewtype, $_GET['fid'], $filter, $searchkey, $start, $perpage, $theurl);
$tids = $data['my']['tids'];
$posts = $data['my']['posts'];
} else {
$data[$view] = get_guide_list($view, $start, $perpage);
}
if(empty($data['my']['multi'])) {
$multipage = multi($data[$view]['threadcount'], $perpage, $_G['page'], $theurl, $_G['setting']['threadmaxpages']);
} else {
$multipage = $data['my']['multi'];
}
} else {
$data['hot'] = get_guide_list('hot', 0, 30);
$data['digest'] = get_guide_list('digest', 0, 30);
$data['new'] = get_guide_list('new', 0, 30);
$data['newthread'] = get_guide_list('newthread', 0, 30);
}
loadcache('stamps');
$currentview[$view] = 'class="xw1 a"';
$navigation = $view != 'index' ? ' <em>&rsaquo;</em> <a href="forum.php?mod=guide&view='.$view.'">'.$lang['guide_'.$view].'</a>' : '';
include template('diy:forum/guide');
function get_guide_list($view, $start = 0, $num = 50, $again = 0) {
global $_G;
$setting_guide = dunserialize($_G['setting']['guide']);
if(!in_array($view, array('hot', 'digest', 'new', 'newthread', 'sofa'))) {
return array();
}
loadcache('forums');
$cachetimelimit = ($view != 'sofa') ? 900 : 60;
$cache = $_G['cache']['forum_guide'][$view.($view=='sofa' && $_G['fid'] ? $_G['fid'] : '')];
$notsofatids = array();
if($cache && (TIMESTAMP - $cache['cachetime']) < $cachetimelimit) {
$tids = is_array($cache['data']) ? $cache['data'] : array();
$threadcount = count($tids);
$tids = array_slice($tids, $start, $num, true);
$updatecache = false;
if(empty($tids)) {
return array();
}
} else {
$dateline = 0;
$maxnum = 50000;
if($setting_guide[$view.'dt']) {
$dateline = time() - intval($setting_guide[$view.'dt']);
}
if($view != 'sofa') {
$maxtid = C::t('forum_thread')->fetch_max_tid();
$limittid = max(0,($maxtid - $maxnum));
if($again) {
$limittid = max(0,($limittid - $maxnum));
}
$tids = array();
}
foreach($_G['cache']['forums'] as $fid => $forum) {
if($forum['type'] != 'group' && $forum['status'] > 0 && !$forum['viewperm'] && !$forum['havepassword']) {
$fids[$fid] = $fid;
}
}
if(empty($fids)) {
return array();
}
if($view == 'sofa') {
$sofa = C::t('forum_sofa')->fetch_all_by_fid($fids, $start, $num);
$tids = array_keys($sofa);
}
$updatecache = true;
}
$query = C::t('forum_thread')->fetch_all_for_guide($view, $limittid, $tids, $_G['setting']['heatthread']['guidelimit'], $dateline);
$list = array();
$n = 0;
foreach($query as $thread) {
if(empty($tids) && ($thread['isgroup'] || !in_array($thread['fid'], $fids))) {
continue;
}
if($thread['displayorder'] < 0) {
continue;
}
if($view == 'sofa' && $thread['replies'] > 0) {
$notsofatids[] = $thread['tid'];
continue;
}
$thread = guide_procthread($thread);
$threadids[] = $thread['tid'];
if($tids || ($n >= $start && $n < ($start + $num))) {
$list[$thread['tid']] = $thread;
$fids[$thread['fid']] = $thread['fid'];
}
$n ++;
}
if($limittid > $maxnum && !$again && count($list) < 50) {
return get_guide_list($view, $start, $num, 1);
}
$forumnames = array();
if($fids) {
$forumnames = C::t('forum_forum')->fetch_all_name_by_fid($fids);
}
$threadlist = array();
if($tids) {
$threadids = array();
foreach($tids as $key => $tid) {
if($list[$tid]) {
$threadlist[$key] = $list[$tid];
$threadids[] = $tid;
}
}
} else {
$threadlist = $list;
}
unset($list);
if($updatecache) {
$threadids = is_array($threadids) ? $threadids : array();
$threadcount = count($threadids);
$data = array('cachetime' => TIMESTAMP, 'data' => $threadids);
$_G['cache']['forum_guide'][$view.($view=='sofa' && $_G['fid'] ? $_G['fid'] : '')] = $data;
savecache('forum_guide', $_G['cache']['forum_guide']);
if(!empty($notsofatids)) {
C::t('forum_sofa')->delete($notsofatids);
}
}
return array('forumnames' => $forumnames, 'threadcount' => $threadcount, 'threadlist' => $threadlist);
}
function get_my_threads($viewtype, $fid = 0, $filter = '', $searchkey = '', $start = 0, $perpage = 20, $theurl = '') {
global $_G;
$fid = $fid ? intval($fid) : null;
loadcache('forums');
$dglue = '=';
if($viewtype == 'thread') {
$authorid = $_G['uid'];
$dglue = '=';
if($filter == 'recyclebin') {
$displayorder = -1;
} elseif($filter == 'aduit') {
$displayorder = -2;
} elseif($filter == 'ignored') {
$displayorder = -3;
} elseif($filter == 'save') {
$displayorder = -4;
} elseif($filter == 'close') {
$closed = 1;
} elseif($filter == 'common') {
$closed = 0;
$displayorder = 0;
$dglue = '>=';
}
$gids = $fids = $forums = $list = array();
foreach(C::t('forum_thread')->fetch_all_by_authorid_displayorder($authorid, $displayorder, $dglue, $closed, $searchkey, $start, $perpage, null, $fid) as $tid => $value) {
if(!isset($_G['cache']['forums'][$value['fid']])) {
$gids[$value['fid']] = $value['fid'];
} else {
$forumnames[$value['fid']] = array('fid'=> $value['fid'], 'name' => $_G['cache']['forums'][$value['fid']]['name']);
}
$list[$value['tid']] = guide_procthread($value);
}
if(!empty($gids)) {
$gforumnames = C::t('forum_forum')->fetch_all_name_by_fid($gids);
foreach($gforumnames as $fid => $val) {
$forumnames[$fid] = $val;
}
}
$listcount = count($list);
} elseif($viewtype == 'postcomment') {
require_once libfile('function/post');
$pids = $tids = array();
$postcommentarr = C::t('forum_postcomment')->fetch_all_by_authorid($_G['uid'], $start, $perpage);
foreach($postcommentarr as $value) {
$pids[] = $value['pid'];
$tids[] = $value['tid'];
}
$pids = C::t('forum_post')->fetch_all_post(0, $pids);
$tids = C::t('forum_thread')->fetch_all($tids);
$list = $fids = array();
foreach($postcommentarr as $value) {
$value['authorid'] = $pids[$value['pid']]['authorid'];
$value['fid'] = $pids[$value['pid']]['fid'];
$value['invisible'] = $pids[$value['pid']]['invisible'];
$value['dateline'] = $pids[$value['pid']]['dateline'];
$value['message'] = $pids[$value['pid']]['message'];
$value['special'] = $tids[$value['tid']]['special'];
$value['status'] = $tids[$value['tid']]['status'];
$value['subject'] = $tids[$value['tid']]['subject'];
$value['digest'] = $tids[$value['tid']]['digest'];
$value['attachment'] = $tids[$value['tid']]['attachment'];
$value['replies'] = $tids[$value['tid']]['replies'];
$value['views'] = $tids[$value['tid']]['views'];
$value['lastposter'] = $tids[$value['tid']]['lastposter'];
$value['lastpost'] = $tids[$value['tid']]['lastpost'];
$value['icon'] = $tids[$value['tid']]['icon'];
$value['tid'] = $pids[$value['pid']]['tid'];
$fids[] = $value['fid'];
$value['comment'] = messagecutstr($value['comment'], 100);
$list[] = guide_procthread($value);
}
unset($pids, $tids, $postcommentarr);
if($fids) {
$fids = array_unique($fids);
$forumnames = C::t('forum_forum')->fetch_all_name_by_fid($fids);
}
$listcount = count($list);
} else {
$invisible = null;
if($filter == 'recyclebin') {
$invisible = -5;
} elseif($filter == 'aduit') {
$invisible = -2;
} elseif($filter == 'save' || $filter == 'ignored') {
$invisible = -3;
$displayorder = -4;
} elseif($filter == 'close') {
$closed = 1;
} elseif($filter == 'common') {
$invisible = 0;
$displayorder = 0;
$dglue = '>=';
$closed = 0;
}
require_once libfile('function/post');
$followfid = getglobal('setting/followforumid');
$posts = C::t('forum_post')->fetch_all_by_authorid(0, $_G['uid'], true, 'DESC', $start, $perpage, null, $invisible, $fid, $followfid);
$listcount = count($posts);
foreach($posts as $pid => $post) {
$tids[$post['tid']][] = $pid;
$post['message'] = $post['status'] & 1 && $_G['adminid'] != 1 ? '' : (!getstatus($post['status'], 2) || $post['authorid'] == $_G['uid'] ? messagecutstr($post['message'], 100) : '');
$posts[$pid] = $post;
}
if(!empty($tids)) {
$threads = C::t('forum_thread')->fetch_all_by_tid_displayorder(array_keys($tids), $displayorder, $dglue, array(), $closed);
foreach($threads as $tid => $thread) {
if(!isset($_G['cache']['forums'][$thread['fid']])) {
$gids[$thread['fid']] = $thread['fid'];
} else {
$forumnames[$thread['fid']] = array('fid' => $thread['fid'], 'name' => $_G['cache']['forums'][$thread['fid']]['name']);
}
$threads[$tid] = guide_procthread($thread);
}
if(!empty($gids)) {
$groupforums = C::t('forum_forum')->fetch_all_name_by_fid($gids);
foreach($groupforums as $fid => $val) {
$forumnames[$fid] = $val;
}
}
$list = array();
foreach($tids as $key => $val) {
$list[$key] = $threads[$key];
}
unset($threads);
}
}
$multi = simplepage($listcount, $perpage, $_G['page'], $theurl);
return array('forumnames' => $forumnames, 'threadcount' => $listcount, 'threadlist' => $list, 'multi' => $multi, 'tids' => $tids, 'posts' => $posts);
}
function guide_procthread($thread) {
global $_G;
$todaytime = strtotime(dgmdate(TIMESTAMP, 'Ymd'));
$thread['lastposterenc'] = rawurlencode($thread['lastposter']);
$thread['multipage'] = '';
$topicposts = $thread['special'] ? $thread['replies'] : $thread['replies'] + 1;
if($topicposts > $_G['ppp']) {
$pagelinks = '';
$thread['pages'] = ceil($topicposts / $_G['ppp']);
for($i = 2; $i <= 6 && $i <= $thread['pages']; $i++) {
$pagelinks .= "<a href=\"forum.php?mod=viewthread&tid={$thread['tid']}&amp;extra=$extra&amp;page=$i\">$i</a>";
}
if($thread['pages'] > 6) {
$pagelinks .= "..<a href=\"forum.php?mod=viewthread&tid={$thread['tid']}&amp;extra=$extra&amp;page={$thread['pages']}\">{$thread['pages']}</a>";
}
$thread['multipage'] = '&nbsp;...'.$pagelinks;
}
if($thread['highlight']) {
$_G['forum_colorarray'] = $_G['forum_colorarray'] ? $_G['forum_colorarray'] : array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282');
$string = sprintf('%02d', $thread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$thread['highlight'] = ' style="';
$thread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$thread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$thread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$thread['highlight'] .= $string[1] ? 'color: '.$_G['forum_colorarray'][$string[1]].';' : '';
$thread['highlight'] .= '"';
} else {
$thread['highlight'] = '';
}
$thread['recommendicon'] = '';
if(!empty($_G['setting']['recommendthread']['status']) && $thread['recommends']) {
foreach($_G['setting']['recommendthread']['iconlevels'] as $k => $i) {
if($thread['recommends'] > $i) {
$thread['recommendicon'] = $k+1;
break;
}
}
}
$thread['moved'] = $thread['heatlevel'] = $thread['new'] = 0;
$thread['icontid'] = $thread['forumstick'] || !$thread['moved'] && $thread['isgroup'] != 1 ? $thread['tid'] : $thread['closed'];
$thread['folder'] = 'common';
$thread['dbdateline'] = $thread['dateline'];
$thread['weeknew'] = TIMESTAMP - 604800 <= $thread['dbdateline'];
if($thread['replies'] > $thread['views']) {
$thread['views'] = $thread['replies'];
}
if($_G['setting']['heatthread']['iconlevels']) {
foreach($_G['setting']['heatthread']['iconlevels'] as $k => $i) {
if($thread['heats'] > $i) {
$thread['heatlevel'] = $k + 1;
break;
}
}
}
$thread['istoday'] = $thread['dateline'] > $todaytime ? 1 : 0;
$thread['dateline'] = dgmdate($thread['dateline'], 'u', '9999', getglobal('setting/dateformat'));
$thread['dblastpost'] = $thread['lastpost'];
$thread['lastpost'] = dgmdate($thread['lastpost'], 'u');
if(in_array($thread['displayorder'], array(1, 2, 3, 4))) {
$thread['id'] = 'stickthread_'.$thread['tid'];
} else {
$thread['id'] = 'normalthread_'.$thread['tid'];
}
$thread['rushreply'] = getstatus($thread['status'], 3);
return $thread;
}
function update_guide_rsscache($type, $perpage) {
global $_G;
$processname = 'guide_rss_cache';
if(discuz_process::islocked($processname, 600)) {
return false;
}
C::t('forum_rsscache')->delete_by_guidetype($type);
require_once libfile('function/post');
$data = get_guide_list($type, 0, $perpage);
foreach($data['threadlist'] as $thread) {
$thread['author'] = $thread['author'] != '' ? addslashes($thread['author']) : 'Anonymous';
$thread['subject'] = addslashes($thread['subject']);
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
$attachdata = '';
if($post['attachment'] == 2) {
$attach = C::t('forum_attachment_n')->fetch_max_image('tid:'.$thread['tid'], 'pid', $post['pid']);
$attachdata = "\t".$attach['remote']."\t".$attach['attachment']."\t".$attach['filesize'];
}
$thread['message'] = $post['message'];
$thread['status'] = $post['status'];
$thread['description'] = $thread['readperm'] > 0 || $thread['price'] > 0 || $thread['status'] & 1 ? '' : addslashes(messagecutstr($thread['message'], 250 - strlen($attachdata)).$attachdata);
C::t('forum_rsscache')->insert(array(
'lastupdate'=>$_G['timestamp'],
'fid'=>$thread['fid'],
'tid'=>$thread['tid'],
'dateline'=>$thread['dbdateline'],
'forum'=>strip_tags($data['forumnames'][$thread['fid']]['name']),
'author'=>$thread['author'],
'subject'=>$thread['subject'],
'description'=>$thread['description'],
'guidetype'=>$type
), false, true);
}
discuz_process::unlock($processname);
return true;
}
?>

View File

@@ -0,0 +1,61 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_image.php 32531 2013-02-06 10:15:19Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || empty($_GET['aid']) || empty($_GET['size']) || empty($_GET['key'])) {
header('location: '.$_G['siteurl'].'static/image/common/none.gif');
exit;
}
$nocache = !empty($_GET['nocache']) ? 1 : 0;
$daid = intval($_GET['aid']);
$type = !empty($_GET['type']) ? $_GET['type'] : 'fixwr';
list($w, $h) = explode('x', $_GET['size']);
$dw = intval($w);
$dh = intval($h);
$thumbfile = 'image/'.helper_attach::makethumbpath($daid, $dw, $dh);$attachurl = helper_attach::attachpreurl();
if(!$nocache) {
if(file_exists($_G['setting']['attachdir'].$thumbfile)) {
dheader('location: '.$attachurl.$thumbfile);
}
}
define('NOROBOT', TRUE);
$id = !empty($_GET['atid']) ? $_GET['atid'] : $daid;
if(dsign($id.'|'.$dw.'|'.$dh) != $_GET['key']) {
dheader('location: '.$_G['siteurl'].'static/image/common/none.gif');
}
if($attach = C::t('forum_attachment_n')->fetch_attachment('aid:'.$daid, $daid, array(1, -1))) {
if(!$dw && !$dh && $attach['tid'] != $id) {
dheader('location: '.$_G['siteurl'].'static/image/common/none.gif');
}
dheader('Expires: '.gmdate('D, d M Y H:i:s', TIMESTAMP + 3600).' GMT');
if($attach['remote']) {
$filename = $_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment'];
} else {
$filename = $_G['setting']['attachdir'].'forum/'.$attach['attachment'];
}
require_once libfile('class/image');
$img = new image;
if($img->Thumb($filename, $thumbfile, $w, $h, $type)) {
if($nocache) {
dheader('Content-Type: image');
@readfile($_G['setting']['attachdir'].$thumbfile);
@unlink($_G['setting']['attachdir'].$thumbfile);
} else {
dheader('location: '.$attachurl.$thumbfile);
}
} else {
dheader('Content-Type: image');
@readfile($filename);
}
}
?>

View File

@@ -0,0 +1,550 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_index.php 36265 2016-11-04 07:10:47Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('function/forumlist');
$gid = intval(getgpc('gid'));
$showoldetails = get_index_online_details();
if(!$_G['uid'] && !$gid && $_G['setting']['cacheindexlife'] && !defined('IN_ARCHIVER') && !defined('IN_MOBILE') && !IS_ROBOT) {
get_index_page_guest_cache();
}
$newthreads = round((TIMESTAMP - $_G['member']['lastvisit'] + 600) / 1000) * 1000;
$catlist = $forumlist = $sublist = $forumname = $collapse = $favforumlist = array();
$threads = $posts = $todayposts = $announcepm = 0;
$postdata = $_G['cache']['historyposts'] ? explode("\t", $_G['cache']['historyposts']) : array(0,0);
$postdata[0] = intval($postdata[0]);
$postdata[1] = intval($postdata[1]);
list($navtitle, $metadescription, $metakeywords) = get_seosetting('forum');
if(!$navtitle) {
$navtitle = $_G['setting']['navs'][2]['navname'];
$nobbname = false;
} else {
$nobbname = true;
}
if(!$metadescription) {
$metadescription = $navtitle;
}
if(!$metakeywords) {
$metakeywords = $navtitle;
}
if($_G['setting']['indexhot']['status'] && $_G['cache']['heats']['expiration'] < TIMESTAMP) {
require_once libfile('function/cache');
updatecache('heats');
}
if($_G['uid'] && empty($_G['cookie']['nofavfid'])) {
$favfids = array();
$forum_favlist = C::t('home_favorite')->fetch_all_by_uid_idtype($_G['uid'], 'fid');
if(!$forum_favlist) {
dsetcookie('nofavfid', 1, 31536000);
}
foreach($forum_favlist as $key => $favorite) {
if(defined('IN_MOBILE')) {
$forum_favlist[$key]['title'] = strip_tags($favorite['title']);
}
$favfids[] = $favorite['id'];
}
if($favfids) {
$favforumlist = C::t('forum_forum')->fetch_all($favfids);
$favforumlist_fields = C::t('forum_forumfield')->fetch_all($favfids);
foreach($favforumlist as $id => $forum) {
if($favforumlist_fields[$forum['fid']]['fid']) {
$favforumlist[$id] = array_merge($forum, $favforumlist_fields[$forum['fid']]);
}
$favforumlist[$id]['extra'] = empty($favforumlist[$id]['extra']) ? array() : dunserialize($favforumlist[$id]['extra']);
if(!is_array($favforumlist[$id]['extra'])) {
$favforumlist[$id]['extra'] = array();
}
forum($favforumlist[$id]);
}
}
}
if(!$gid && $_G['setting']['collectionstatus'] && ($_G['setting']['collectionrecommendnum'] || !$_G['setting']['hidefollowcollection'])) {
require_once libfile('function/cache');
loadcache('collection_index');
$collectionrecommend = dunserialize($_G['setting']['collectionrecommend']);
if(TIMESTAMP - $_G['cache']['collection_index']['dateline'] > 3600 * 4) {
$collectiondata = $followdata = array();
if($_G['setting']['collectionrecommendnum']) {
if($collectionrecommend['ctids']) {
$collectionrecommend['ctidsKey'] = array_keys($collectionrecommend['ctids']);
$tmpcollection = C::t('forum_collection')->fetch_all($collectionrecommend['ctidsKey']);
foreach($collectionrecommend['ctids'] as $ctid=>$setcollection) {
if($tmpcollection[$ctid]) {
$collectiondata[$ctid] = $tmpcollection[$ctid];
}
}
unset($tmpcollection, $ctid, $setcollection);
}
if($collectionrecommend['autorecommend']) {
require_once libfile('function/collection');
$autorecommenddata = getHotCollection(500);
}
}
savecache('collection_index', array('dateline' => TIMESTAMP, 'data' => $collectiondata, 'auto' => $autorecommenddata));
$collectiondata = array('data' => $collectiondata, 'auto' => $autorecommenddata);
} else {
$collectiondata = &$_G['cache']['collection_index'];
}
if($_G['setting']['showfollowcollection']) {
$followcollections = $_G['uid'] ? C::t('forum_collectionfollow')->fetch_all_by_uid($_G['uid']) : array();;
if($followcollections) {
$collectiondata['follows'] = C::t('forum_collection')->fetch_all(array_keys($followcollections), 'dateline', 'DESC', 0, $_G['setting']['showfollowcollection']);
}
}
if($collectionrecommend['autorecommend'] && $collectiondata['auto']) {
$randrecommend = array_rand($collectiondata['auto'], min($collectionrecommend['autorecommend'], count($collectiondata['auto'])));
if($randrecommend && !is_array($randrecommend)) {
$collectiondata['data'][$randrecommend] = $collectiondata['auto'][$randrecommend];
} else {
foreach($randrecommend as $ctid) {
$collectiondata['data'][$ctid] = $collectiondata['auto'][$ctid];
}
}
}
if($collectiondata['data']) {
$collectiondata['data'] = array_slice($collectiondata['data'], 0, $collectionrecommend['autorecommend'], true);
}
}
if(empty($gid) && empty($_G['member']['accessmasks']) && empty($showoldetails) && !IS_ROBOT) {
$memindex = get_index_memory_by_groupid($_G['member']['groupid']);
extract($memindex);
if(defined('FORUM_INDEX_PAGE_MEMORY') && FORUM_INDEX_PAGE_MEMORY) {
categorycollapse();
if(!defined('IN_ARCHIVER')) {
include template('diy:forum/discuz');
} else {
include loadarchiver('forum/discuz');
}
dexit();
}
}
$grids = array();
if($_G['setting']['grid']['showgrid']) {
loadcache('grids');
$cachelife = $_G['setting']['grid']['cachelife'] ? $_G['setting']['grid']['cachelife'] : 600;
$now = dgmdate(TIMESTAMP, lang('forum/misc', 'y_m_d')).' '.lang('forum/misc', 'week_'.dgmdate(TIMESTAMP, 'w'));
if(TIMESTAMP - $_G['cache']['grids']['cachetime'] < $cachelife) {
$grids = $_G['cache']['grids'];
} else {
$images = array();
$_G['setting']['grid']['fids'] = in_array(0, $_G['setting']['grid']['fids']) ? 0 : $_G['setting']['grid']['fids'];
if($_G['setting']['grid']['gridtype']) {
$grids['digest'] = C::t('forum_thread')->fetch_all_for_guide('digest', 0, array(), 3, 0, 0, 10, $_G['setting']['grid']['fids']);
} else {
$images = C::t('forum_threadimage')->fetch_all_order_by_tid_for_guide(10, 0, $_G['setting']['grid']['fids']);
foreach($images as $key => $value) {
$tids[$value['tid']] = $value['tid'];
}
$grids['image'] = C::t('forum_thread')->fetch_all_by_tid($tids);
}
$grids['newthread'] = C::t('forum_thread')->fetch_all_for_guide('newthread', 0, array(), 0, 0, 0, 10, $_G['setting']['grid']['fids']);
$grids['newreply'] = C::t('forum_thread')->fetch_all_for_guide('reply', 0, array(), 0, 0, 0, 10, $_G['setting']['grid']['fids']);
$grids['hot'] = C::t('forum_thread')->fetch_all_for_guide('hot', 0, array(), 3, 0, 0, 10, $_G['setting']['grid']['fids']);
$_G['forum_colorarray'] = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282');
foreach($grids as $type => $gridthreads) {
foreach($gridthreads as $key => $gridthread) {
$gridthread['dateline'] = str_replace('"', '\'', dgmdate($gridthread['dateline'], 'u', '9999', getglobal('setting/dateformat')));
$gridthread['lastpost'] = str_replace('"', '\'', dgmdate($gridthread['lastpost'], 'u', '9999', getglobal('setting/dateformat')));
if($gridthread['highlight'] && $_G['setting']['grid']['highlight']) {
$string = sprintf('%02d', $gridthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$gridthread['highlight'] = ' style="';
$gridthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$gridthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$gridthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$gridthread['highlight'] .= $string[1] ? 'color: '.$_G['forum_colorarray'][$string[1]] : '';
$gridthread['highlight'] .= '"';
} else {
$gridthread['highlight'] = '';
}
if($_G['setting']['grid']['textleng']) {
$gridthread['oldsubject'] = dhtmlspecialchars($gridthread['subject']);
$gridthread['subject'] = cutstr($gridthread['subject'], $_G['setting']['grid']['textleng']);
}
$grids[$type][$key] = $gridthread;
}
}
if(!$_G['setting']['grid']['gridtype']) {
$grids['slide'] = $focuspic = $focusurl = $focustext = array();
$grids['focus'] = 'config=5|0xffffff|0x0099ff|50|0xffffff|0x0099ff|0x000000';
foreach($grids['image'] as $ithread) {
if($ithread['displayorder'] < 0) {
continue;
}
if($images[$ithread['tid']]['remote']) {
$imageurl = $_G['setting']['ftp']['attachurl'].'forum/'.$images[$ithread['tid']]['attachment'];
} else {
$imageurl = $_G['setting']['attachurl'].'forum/'.$images[$ithread['tid']]['attachment'];
}
$grids['slide'][$ithread['tid']] = array(
'image' => $imageurl,
'url' => 'forum.php?mod=viewthread&tid='.$ithread['tid'],
'subject' => addslashes($ithread['subject'])
);
}
$grids['slide'] = array_reverse($grids['slide'], true);
}
$grids['cachetime'] = TIMESTAMP;
savecache('grids', $grids);
}
}
if(!$gid && (!defined('FORUM_INDEX_PAGE_MEMORY') || !FORUM_INDEX_PAGE_MEMORY)) {
$announcements = get_index_announcements();
$forums = C::t('forum_forum')->fetch_all_by_status(1);
$fids = array();
foreach($forums as $forum) {
$fids[$forum['fid']] = $forum['fid'];
}
$forum_access = array();
if(!empty($_G['member']['accessmasks'])) {
$forum_access = C::t('forum_access')->fetch_all_by_fid_uid($fids, $_G['uid']);
}
$forum_fields = C::t('forum_forumfield')->fetch_all($fids);
foreach($forums as $forum) {
if($forum_fields[$forum['fid']]['fid']) {
$forum = (array_key_exists('fid', $forum) && array_key_exists($forum['fid'], $forum_fields)) ? array_merge($forum, $forum_fields[$forum['fid']]) : $forum;
}
if(!empty($forum_access['fid'])) {
$forum = (array_key_exists('fid', $forum) && array_key_exists($forum['fid'], $forum_access)) ? array_merge($forum, $forum_access[$forum['fid']]) : $forum;
}
$forumname[$forum['fid']] = strip_tags($forum['name']);
$forum['extra'] = empty($forum['extra']) ? array() : dunserialize($forum['extra']);
if(!is_array($forum['extra'])) {
$forum['extra'] = array();
}
if($forum['type'] != 'group') {
$threads += $forum['threads'];
$posts += $forum['posts'];
$todayposts += $forum['todayposts'];
if($forum['type'] == 'forum' && isset($catlist[$forum['fup']])) {
if(forum($forum)) {
$catlist[$forum['fup']]['forums'][] = $forum['fid'];
$forum['orderid'] = $catlist[$forum['fup']]['forumscount']++;
$forum['subforums'] = '';
$forumlist[$forum['fid']] = $forum;
}
} elseif(isset($forumlist[$forum['fup']])) {
$forumlist[$forum['fup']]['threads'] += $forum['threads'];
$forumlist[$forum['fup']]['posts'] += $forum['posts'];
$forumlist[$forum['fup']]['todayposts'] += $forum['todayposts'];
if($_G['setting']['subforumsindex'] && $forumlist[$forum['fup']]['permission'] == 2 && !($forumlist[$forum['fup']]['simple'] & 16) || ($forumlist[$forum['fup']]['simple'] & 8)) {
$forumurl = !empty($forum['domain']) && !empty($_G['setting']['domain']['root']['forum']) ? $_G['scheme'].'://'.$forum['domain'].'.'.$_G['setting']['domain']['root']['forum'] : 'forum.php?mod=forumdisplay&fid='.$forum['fid'];
$forumlist[$forum['fup']]['subforums'] .= (empty($forumlist[$forum['fup']]['subforums']) ? '' : ', ').'<a href="'.$forumurl.'" '.(!empty($forum['extra']['namecolor']) ? ' style="color: ' . $forum['extra']['namecolor'].';"' : '') . '>'.$forum['name'].'</a>';
}
}
} else {
if($forum['moderators']) {
$forum['moderators'] = moddisplay($forum['moderators'], 'flat');
}
$forum['forumscount'] = 0;
$catlist[$forum['fid']] = $forum;
}
}
unset($forum_access, $forum_fields);
foreach($catlist as $catid => $category) {
$catlist[$catid]['collapseimg'] = 'collapsed_no.gif';
$catlist[$catid]['collapseicon'] = '_no';
if($catlist[$catid]['forumscount'] && $category['forumcolumns']) {
$catlist[$catid]['forumcolwidth'] = (floor(100 / $category['forumcolumns']) - 0.1).'%';
$catlist[$catid]['endrows'] = '';
if($colspan = $category['forumscount'] % $category['forumcolumns']) {
while(($category['forumcolumns'] - $colspan) > 0) {
$catlist[$catid]['endrows'] .= '<td width="'.$catlist[$catid]['forumcolwidth'].'">&nbsp;</td>';
$colspan ++;
}
}
} elseif(empty($category['forumscount'])) {
unset($catlist[$catid]);
}
}
unset($catid, $category);
if(isset($catlist[0]) && $catlist[0]['forumscount']) {
$catlist[0]['fid'] = 0;
$catlist[0]['type'] = 'group';
$catlist[0]['name'] = $_G['setting']['bbname'];
$catlist[0]['collapseimg'] = 'collapsed_no.gif';
$catlist[0]['collapseicon'] = '_no';
} else {
unset($catlist[0]);
}
if(!IS_ROBOT && ($_G['setting']['whosonlinestatus'] == 1 || $_G['setting']['whosonlinestatus'] == 3)) {
$_G['setting']['whosonlinestatus'] = 1;
$onlineinfo = explode("\t", $_G['cache']['onlinerecord']);
if(empty($_G['cookie']['onlineusernum'])) {
$onlinenum = C::app()->session->count();
if($onlinenum > $onlineinfo[0]) {
$onlinerecord = "$onlinenum\t".TIMESTAMP;
C::t('common_setting')->update_setting('onlinerecord', $onlinerecord);
savecache('onlinerecord', $onlinerecord);
$onlineinfo = array($onlinenum, TIMESTAMP);
}
dsetcookie('onlineusernum', intval($onlinenum), 300);
} else {
$onlinenum = intval($_G['cookie']['onlineusernum']);
}
$onlineinfo[1] = dgmdate($onlineinfo[1], 'd');
$detailstatus = $showoldetails == 'yes' || (((!isset($_G['cookie']['onlineindex']) && !$_G['setting']['whosonline_contract']) || $_G['cookie']['onlineindex']) && $onlinenum < 500 && !$showoldetails);
$guestcount = $membercount = $invisiblecount = 0;
if(!empty($_G['setting']['sessionclose'])) {
$detailstatus = false;
$membercount = C::app()->session->count(1);
$guestcount = $onlinenum - $membercount;
}
if($detailstatus) {
$actioncode = lang('action');
$_G['uid'] && updatesession();
$whosonline = array();
$_G['setting']['maxonlinelist'] = $_G['setting']['maxonlinelist'] ? $_G['setting']['maxonlinelist'] : 500;
foreach(C::app()->session->fetch_member(1, 0, $_G['setting']['maxonlinelist']) as $online){
$membercount ++;
if($online['invisible']) {
$invisiblecount++;
continue;
} else {
$online['icon'] = !empty($_G['cache']['onlinelist'][$online['groupid']]) ? $_G['cache']['onlinelist'][$online['groupid']] : $_G['cache']['onlinelist'][0];
}
$online['lastactivity'] = dgmdate($online['lastactivity'], 't');
$whosonline[] = $online;
}
if(isset($_G['cache']['onlinelist'][7]) && $_G['setting']['maxonlinelist'] > $membercount) {
foreach(C::app()->session->fetch_member(2, 0, $_G['setting']['maxonlinelist'] - $membercount) as $online){
$online['icon'] = $_G['cache']['onlinelist'][7];
$online['username'] = $_G['cache']['onlinelist']['guest'];
$online['lastactivity'] = dgmdate($online['lastactivity'], 't');
$whosonline[] = $online;
}
}
unset($actioncode, $online);
if($onlinenum > $_G['setting']['maxonlinelist']) {
$membercount = C::app()->session->count(1);
$invisiblecount = C::app()->session->count_invisible();
}
if($onlinenum < $membercount) {
$onlinenum = C::app()->session->count();
dsetcookie('onlineusernum', intval($onlinenum), 300);
}
$invisiblecount = intval($invisiblecount);
$guestcount = $onlinenum - $membercount;
unset($online);
}
} else {
$_G['setting']['whosonlinestatus'] = 0;
}
if(defined('FORUM_INDEX_PAGE_MEMORY') && !FORUM_INDEX_PAGE_MEMORY) {
$key = !IS_ROBOT ? $_G['member']['groupid'] : 'for_robot';
memory('set', 'forum_index_page_'.$key, array(
'catlist' => $catlist,
'forumlist' => $forumlist,
'sublist' => $sublist,
'whosonline' => $whosonline,
'onlinenum' => $onlinenum,
'membercount' => $membercount,
'guestcount' => $guestcount,
'grids' => $grids,
'announcements' => $announcements,
'threads' => $threads,
'posts' => $posts,
'todayposts' => $todayposts,
'onlineinfo' => $onlineinfo,
'announcepm' => $announcepm), getglobal('setting/memory/forumindex'));
}
} else {
require_once DISCUZ_ROOT.'./source/include/misc/misc_category.php';
}
if(defined('IN_ARCHIVER')) {
include loadarchiver('forum/discuz');
exit();
}
categorycollapse();
if($gid && !empty($catlist)) {
$_G['category'] = $catlist[$gid];
$forumseoset = array(
'seotitle' => $catlist[$gid]['seotitle'],
'seokeywords' => $catlist[$gid]['keywords'],
'seodescription' => $catlist[$gid]['seodescription']
);
$seodata = array('fgroup' => $catlist[$gid]['name']);
list($navtitle, $metadescription, $metakeywords) = get_seosetting('threadlist', $seodata, $forumseoset);
if(empty($navtitle)) {
$navtitle = $navtitle_g;
$nobbname = false;
} else {
$nobbname = true;
}
$_G['fid'] = $gid;
}
include template('diy:forum/discuz:'.$gid);
function get_index_announcements() {
global $_G;
$announcements = '';
if($_G['cache']['announcements']) {
$readapmids = !empty($_G['cookie']['readapmid']) ? explode('D', $_G['cookie']['readapmid']) : array();
foreach($_G['cache']['announcements'] as $announcement) {
if(!$announcement['endtime'] || $announcement['endtime'] > TIMESTAMP && (empty($announcement['groups']) || in_array($_G['member']['groupid'], $announcement['groups']))) {
if(empty($announcement['type'])) {
$announcements .= '<li><span><a href="forum.php?mod=announcement&id='.$announcement['id'].'" target="_blank" class="xi2">'.$announcement['subject'].
'</a></span><em>('.dgmdate($announcement['starttime'], 'd').')</em></li>';
} elseif($announcement['type'] == 1) {
$announcements .= '<li><span><a href="'.$announcement['message'].'" target="_blank" class="xi2">'.$announcement['subject'].
'</a></span><em>('.dgmdate($announcement['starttime'], 'd').')</em></li>';
}
}
}
}
return $announcements;
}
function get_index_page_guest_cache() {
global $_G;
$indexcache = getcacheinfo(0);
if(TIMESTAMP - $indexcache['filemtime'] > $_G['setting']['cacheindexlife']) {
@unlink($indexcache['filename']);
define('CACHE_FILE', $indexcache['filename']);
} elseif($indexcache['filename']) {
$start_time = microtime(TRUE);
$filemtime = $indexcache['filemtime'];
ob_start(function($input) use (&$filemtime) {
return replace_formhash($filemtime, $input);
});
readfile($indexcache['filename']);
$updatetime = dgmdate($filemtime, 'Y-m-d H:i:s');
$debuginfo = ", Updated at $updatetime";
if(getglobal('setting/debug')) {
$gzip = $_G['gzipcompress'] ? ', Gzip On' : '';
$debuginfo .= ', Processed in '.sprintf("%0.6f", microtime(TRUE) - $start_time).' second(s)'.$gzip;
}
echo '<script type="text/javascript">$("debuginfo") ? $("debuginfo").innerHTML = "'.$debuginfo.'." : "";</script></body></html>';
ob_end_flush();
exit();
}
}
function get_index_memory_by_groupid($key) {
$enable = getglobal('setting/memory/forumindex');
if($enable !== null && memory('check')) {
if(IS_ROBOT) {
$key = 'for_robot';
}
$ret = memory('get', 'forum_index_page_'.$key);
define('FORUM_INDEX_PAGE_MEMORY', $ret ? 1 : 0);
if($ret) {
return $ret;
}
}
return array('none' => null);
}
function get_index_online_details() {
$showoldetails = getgpc('showoldetails');
switch($showoldetails) {
case 'no': dsetcookie('onlineindex', ''); break;
case 'yes': dsetcookie('onlineindex', 1, 86400 * 365); break;
}
return $showoldetails;
}
function do_forum_bind_domains() {
global $_G;
if($_G['setting']['binddomains'] && $_G['setting']['forumdomains']) {
$loadforum = isset($_G['setting']['binddomains'][$_SERVER['HTTP_HOST']]) ? max(0, intval($_G['setting']['binddomains'][$_SERVER['HTTP_HOST']])) : 0;
if($loadforum) {
dheader('Location: '.$_G['setting']['siteurl'].'/forum.php?mod=forumdisplay&fid='.$loadforum);
}
}
}
function categorycollapse() {
global $_G, $collapse, $catlist;
if(!$_G['uid']) {
return;
}
foreach($catlist as $fid => $forum) {
if(!isset($_G['cookie']['collapse']) || strpos($_G['cookie']['collapse'], '_category_'.$fid.'_') === FALSE) {
$catlist[$fid]['collapseimg'] = 'collapsed_no.gif';
$catlist[$fid]['collapseicon'] = '_no';
$collapse['category_'.$fid] = '';
} else {
$catlist[$fid]['collapseimg'] = 'collapsed_yes.gif';
$catlist[$fid]['collapseicon'] = '_yes';
$collapse['category_'.$fid] = 'display: none';
}
}
for($i = -2; $i <= 0; $i++) {
if(!isset($_G['cookie']['collapse']) || strpos($_G['cookie']['collapse'], '_category_'.$i.'_') === FALSE) {
$collapse['collapseimg_'.$i] = 'collapsed_no.gif';
$collapse['collapseicon_'.$i] = '_no';
$collapse['category_'.$i] = '';
} else {
$collapse['collapseimg_'.$i] = 'collapsed_yes.gif';
$collapse['collapseicon_'.$i] = '_yes';
$collapse['category_'.$i] = 'display: none';
}
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,205 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_modcp.php 28867 2012-03-16 02:27:08Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('IN_MODCP', true);
if(!$_G['setting']['forumstatus'] && !in_array($_GET['action'], array('', 'home', 'moderate', 'ban', 'ipban', 'member', 'log', 'login', 'logout'))) {
showmessage('forum_status_off');
} else if(!$_G['setting']['forumstatus']) {
unset($_G['fid'], $_GET['fid'], $_POST['fid']);
}
$cpscript = basename($_G['PHP_SELF']);
if(!empty($_G['forum']) && $_G['forum']['status'] == 3) {
showmessage('group_admin_enter_panel', 'forum.php?mod=group&action=manage&fid='.$_G['fid']);
}
$modsession = new discuz_panel(MODCP_PANEL);
if(getgpc('login_panel') && getgpc('cppwd') && submitcheck('submit')) {
$modsession->dologin($_G['uid'], getgpc('cppwd'), true);
}
if(!$modsession->islogin) {
$_GET['action'] = 'login';
}
if(getgpc('action') == 'logout') {
$modsession->dologout();
showmessage('modcp_logout_succeed', 'forum.php');
}
$modforums = $modsession->get('modforums');
$_GET['action'] = empty($_GET['action']) ? (($_G['setting']['forumstatus'] && $_G['fid']) ? 'thread' : 'home') : $_GET['action'];
$op = getgpc('op');
if($modforums === null) {
$modforums = array('fids' => '', 'list' => array(), 'recyclebins' => array());
$comma = '';
if($_G['adminid'] == 3) {
foreach(C::t('forum_moderator')->fetch_all_by_uid_forum($_G['uid']) as $tforum) {
$modforums['fids'] .= $comma.$tforum['fid']; $comma = ',';
$modforums['recyclebins'][$tforum['fid']] = $tforum['recyclebin'];
$modforums['list'][$tforum['fid']] = strip_tags($tforum['name']);
}
} else {
$query = C::t('forum_forum')->fetch_all_info_by_fids(0, 1, 0, 0, 0, 1, 1);
if(!empty($_G['member']['accessmasks'])) {
$fids = array_keys($query);
$accesslist = C::t('forum_access')->fetch_all_by_fid_uid($fids, $_G['uid']);
foreach($query as $key => $val) {
$query[$key]['allowview'] = $accesslist[$key];
}
}
foreach($query as $tforum) {
$tforum['allowview'] = !isset($tforum['allowview']) ? 0 : $tforum['allowview'];
if($tforum['allowview'] == 1 || ($tforum['allowview'] == 0 && ((!$tforum['viewperm'] && $_G['group']['readaccess']) || ($tforum['viewperm'] && forumperm($tforum['viewperm']))))) {
$modforums['fids'] .= $comma.$tforum['fid']; $comma = ',';
$modforums['recyclebins'][$tforum['fid']] = $tforum['recyclebin'];
$modforums['list'][$tforum['fid']] = strip_tags($tforum['name']);
}
}
}
$modsession->set('modforums', $modforums, true);
}
$threadclasslist = array();
if($_G['fid'] && in_array($_G['fid'], explode(',', $modforums['fids']))) {
foreach(C::t('forum_threadclass')->fetch_all_by_fid($_G['fid']) as $tc) {
$threadclasslist[] = $tc;
}
}
if($_G['fid'] && $_G['forum']['ismoderator']) {
dsetcookie('modcpfid', $_G['fid']);
$forcefid = "&amp;fid={$_G['fid']}";
} elseif(!empty($modforums) && count($modforums['list']) == 1) {
$forcefid = "&amp;fid={$modforums['fids']}";
} else {
$forcefid = '';
}
$script = $modtpl = '';
switch ($_GET['action']) {
case 'announcement':
$_G['group']['allowpostannounce'] && $script = 'announcement';
break;
case 'member':
$op == 'edit' && $_G['group']['allowedituser'] && $script = 'member';
$op == 'ban' && ($_G['group']['allowbanuser'] || $_G['group']['allowbanvisituser']) && $script = 'member';
$op == 'ipban' && $_G['group']['allowbanip'] && $script = 'member';
break;
case 'moderate':
($op == 'threads' || $op == 'replies') && $_G['group']['allowmodpost'] && $script = 'moderate';
$op == 'members' && $_G['group']['allowmoduser'] && $script = 'moderate';
break;
case 'forum':
$op == 'editforum' && $_G['group']['alloweditforum'] && $script = 'forum';
$op == 'recommend' && $_G['group']['allowrecommendthread'] && $script = 'forum';
break;
case 'forumaccess':
$_G['group']['allowedituser'] && $script = 'forumaccess';
break;
case 'log':
$_G['group']['allowviewlog'] && $script = 'log';
break;
case 'login':
$script = $modsession->islogin ? 'home' : 'login';
break;
case 'thread':
$script = 'thread';
break;
case 'recyclebin':
$script = 'recyclebin';
break;
case 'recyclebinpost':
$script = 'recyclebinpost';
break;
case 'plugin':
$script = 'plugin';
break;
case 'report':
$script = 'report';
break;
default:
$_GET['action'] = $script = 'home';
$modtpl = 'modcp_home';
}
$script = empty($script) ? 'noperm' : $script;
$modtpl = empty($modtpl) ? (!empty($script) ? 'modcp_'.$script : '') : $modtpl;
$modtpl = 'forum/' . $modtpl;
$op = isset($op) ? trim($op) : '';
if($script != 'log') {
require_once libfile('function/misc');
$extra = implodearray(array('GET' => $_GET, 'POST' => $_POST), array('cppwd', 'formhash', 'submit', 'addsubmit'));
$modcplog = array(TIMESTAMP, $_G['username'], $_G['adminid'], $_G['clientip'], $_GET['action'], $op, $_G['fid'], $extra);
writelog('modcp', implode("\t", clearlogstring($modcplog)));
}
require DISCUZ_ROOT.'./source/include/modcp/modcp_'.$script.'.php';
$reportnum = $modpostnum = $modthreadnum = $modforumnum = 0;
$modforumnum = count($modforums['list']);
$modnum = '';
if($modforumnum) {
if(!empty($_G['setting']['moddetail'])) {
if($_G['group']['allowmodpost']) {
$modnum = C::t('common_moderate')->count_by_idtype_status_fid('tid', 0, explode(',', $modforums['fids']));
$modnum += C::t('common_moderate')->count_by_idtype_status_fid('pid', 0, explode(',', $modforums['fids']));
}
if($_G['group']['allowmoduser']) {
$modnum += C::t('common_member_validate')->count_by_status(0);
}
}
}
switch($_G['adminid']) {
case 1: $access = '1,2,3,4,5,6,7'; break;
case 2: $access = '2,3,6,7'; break;
default: $access = '1,3,5,7'; break;
}
$notenum = C::t('common_adminnote')->count_by_access(explode(',', $access));
include template('forum/modcp');
function getposttableselect() {
global $_G;
loadcache('posttable_info');
if(!empty($_G['cache']['posttable_info']) && is_array($_G['cache']['posttable_info'])) {
$posttableselect = '<select name="posttableid" id="posttableid" class="ps">';
foreach($_G['cache']['posttable_info'] as $posttableid => $data) {
$posttableselect .= '<option value="'.$posttableid.'"'.($_GET['posttableid'] == $posttableid ? ' selected="selected"' : '').'>'.($data['memo'] ? $data['memo'] : 'post_'.$posttableid).'</option>';
}
$posttableselect .= '</select>';
} else {
$posttableselect = '';
}
return $posttableselect;
}
?>

View File

@@ -0,0 +1,400 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_post.php 36293 2016-12-14 02:50:56Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
cknewuser();
require_once libfile('class/credit');
require_once libfile('function/post');
require_once libfile('function/forumlist');
$pid = intval(getgpc('pid'));
$sortid = intval(getgpc('sortid'));
$typeid = intval(getgpc('typeid'));
$special = intval(getgpc('special'));
parse_str(getgpc('extra'), $_GET['extra']);
$_GET['extra'] = http_build_query($_GET['extra']);
$postinfo = array('subject' => '');
$thread = array('readperm' => '', 'pricedisplay' => '', 'hiddenreplies' => '');
$_G['forum_dtype'] = $_G['forum_checkoption'] = $_G['forum_optionlist'] = $tagarray = $_G['forum_typetemplate'] = array();
if($sortid) {
require_once libfile('post/threadsorts', 'include');
}
if($_G['forum']['status'] == 3) {
if(!helper_access::check_module('group')) {
showmessage('group_status_off');
}
require_once libfile('function/group');
$status = groupperm($_G['forum'], $_G['uid'], 'post');
if($status == -1) {
showmessage('forum_not_group', 'index.php');
} elseif($status == 1) {
showmessage('forum_group_status_off');
} elseif($status == 2) {
showmessage('forum_group_noallowed', "forum.php?mod=group&fid={$_G['fid']}");
} elseif($status == 3) {
showmessage('forum_group_moderated');
} elseif($status == 4) {
if($_G['uid']) {
showmessage('forum_group_not_groupmember', "", array('fid' => $_G['fid']), array('showmsg' => 1));
} else {
showmessage('forum_group_not_groupmember_guest', "", array('fid' => $_G['fid']), array('showmsg' => 1, 'login' => 1));
}
} elseif($status == 5) {
showmessage('forum_group_moderated', "", array('fid' => $_G['fid']), array('showmsg' => 1));
}
}
if(empty($_GET['action'])) {
showmessage('undefined_action', NULL);
} elseif($_GET['action'] == 'albumphoto') {
require libfile('post/albumphoto', 'include');
} elseif(($_G['forum']['simple'] & 1) || $_G['forum']['redirect']) {
showmessage('forum_disablepost');
}
require_once libfile('function/discuzcode');
$space = array();
space_merge($space, 'field_home');
if($_GET['action'] == 'reply') {
$addfeedcheck = !empty($space['privacy']['feed']['newreply']) ? 'checked="checked"': '';
} else {
$addfeedcheck = !empty($space['privacy']['feed']['newthread']) ? 'checked="checked"': '';
}
$navigation = $navtitle = '';
if(!empty($_GET['cedit'])) {
unset($_G['inajax'], $_GET['infloat'], $_GET['ajaxtarget'], $_GET['handlekey']);
}
if($_GET['action'] == 'edit' || $_GET['action'] == 'reply') {
$thread = C::t('forum_thread')->fetch_thread($_G['tid']);
if(!$_G['forum_auditstatuson'] && !($thread['displayorder']>=0 || (in_array($thread['displayorder'], array(-4, -2)) && $thread['authorid']==$_G['uid']))) {
$thread = array();
}
if(!empty($thread)) {
if($thread['readperm'] && $thread['readperm'] > $_G['group']['readaccess'] && !$_G['forum']['ismoderator'] && $thread['authorid'] != $_G['uid']) {
showmessage('thread_nopermission', NULL, array('readperm' => $thread['readperm']), array('login' => 1));
}
$_G['fid'] = $thread['fid'];
$special = $thread['special'];
} else {
showmessage('thread_nonexistence');
}
if($thread['closed'] == 1 && !$_G['forum']['ismoderator']) {
showmessage('post_thread_closed');
}
if(!$thread['isgroup'] && $post_autoclose = checkautoclose($thread)) {
showmessage($post_autoclose, '', array('autoclose' => $_G['forum']['autoclose']));
}
}
if($_G['forum']['status'] == 3) {
$returnurl = 'forum.php?mod=forumdisplay&fid='.$_G['fid'].(!empty($_GET['extra']) ? '&action=list&'.preg_replace("/^(&)*/", '', $_GET['extra']) : '').'#groupnav';
$nav = get_groupnav($_G['forum']);
$navigation = ' <em>&rsaquo;</em> <a href="group.php">'.$_G['setting']['navs'][3]['navname'].'</a> '.$nav['nav'];
} else {
loadcache('forums');
$returnurl = 'forum.php?mod=forumdisplay&fid='.$_G['fid'].(!empty($_GET['extra']) ? '&'.preg_replace("/^(&)*/", '', $_GET['extra']) : '');
$navigation = ' <em>&rsaquo;</em> <a href="forum.php">'.$_G['setting']['navs'][2]['navname'].'</a>';
if($_G['forum']['type'] == 'sub') {
$fup = $_G['cache']['forums'][$_G['forum']['fup']]['fup'];
$t_link = $_G['cache']['forums'][$fup]['type'] == 'group' ? 'forum.php?gid='.$fup : 'forum.php?mod=forumdisplay&fid='.$fup;
$navigation .= ' <em>&rsaquo;</em> <a href="'.$t_link.'">'.($_G['cache']['forums'][$fup]['name']).'</a>';
}
if($_G['forum']['fup']) {
$fup = $_G['forum']['fup'];
$t_link = $_G['cache']['forums'][$fup]['type'] == 'group' ? 'forum.php?gid='.$fup : 'forum.php?mod=forumdisplay&fid='.$fup;
$navigation .= ' <em>&rsaquo;</em> <a href="'.$t_link.'">'.($_G['cache']['forums'][$fup]['name']).'</a>';
}
$t_link = 'forum.php?mod=forumdisplay&fid='.$_G['fid'].($_GET['extra'] && !IS_ROBOT ? '&'.$_GET['extra'] : '');
$navigation .= ' <em>&rsaquo;</em> <a href="'.$t_link.'">'.($_G['forum']['name']).'</a>';
unset($t_link, $t_name);
}
periodscheck('postbanperiods');
if($_G['forum']['password'] && $_G['forum']['password'] != $_G['cookie']['fidpw'.$_G['fid']]) {
showmessage('forum_passwd', "forum.php?mod=forumdisplay&fid={$_G['fid']}");
}
if(empty($_G['forum']['allowview'])) {
if(!$_G['forum']['viewperm'] && !$_G['group']['readaccess']) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
} elseif($_G['forum']['viewperm'] && !forumperm($_G['forum']['viewperm'])) {
showmessagenoperm('viewperm', $_G['fid']);
}
} elseif($_G['forum']['allowview'] == -1) {
showmessage('forum_access_view_disallow');
}
formulaperm($_G['forum']['formulaperm']);
if(in_array($_G['adminid'], array(0, -1)) && $_G['setting']['newbiespan'] && (!getuserprofile('lastpost') || TIMESTAMP - getuserprofile('lastpost') < $_G['setting']['newbiespan'] * 60) && TIMESTAMP - getglobal('member/regdate') < $_G['setting']['newbiespan'] * 60) {
showmessage('post_newbie_span', '', array('newbiespan' => $_G['setting']['newbiespan']));
}
$special = $special > 0 && $special < 7 || $special == 127 ? intval($special) : 0;
$_G['forum']['allowpostattach'] = isset($_G['forum']['allowpostattach']) ? $_G['forum']['allowpostattach'] : '';
$_G['group']['allowpostattach'] = $_G['forum']['allowpostattach'] != -1 && ($_G['forum']['allowpostattach'] == 1 || (!$_G['forum']['postattachperm'] && $_G['group']['allowpostattach']) || ($_G['forum']['postattachperm'] && forumperm($_G['forum']['postattachperm'])));
$_G['forum']['allowpostimage'] = isset($_G['forum']['allowpostimage']) ? $_G['forum']['allowpostimage'] : '';
$_G['group']['allowpostimage'] = $_G['forum']['allowpostimage'] != -1 && ($_G['forum']['allowpostimage'] == 1 || (!$_G['forum']['postimageperm'] && $_G['group']['allowpostimage']) || ($_G['forum']['postimageperm'] && forumperm($_G['forum']['postimageperm'])));
$_G['group']['attachextensions'] = $_G['forum']['attachextensions'] ? $_G['forum']['attachextensions'] : $_G['group']['attachextensions'];
require_once libfile('function/upload');
$swfconfig = getuploadconfig($_G['uid'], $_G['fid']);
$imgexts = str_replace(array(';', '*.'), array(', ', ''), $swfconfig['imageexts']['ext']);
$allowuploadnum = $allowuploadtoday = TRUE;
if($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) {
if($_G['group']['maxattachnum']) {
$allowuploadnum = $_G['group']['maxattachnum'] - getuserprofile('todayattachs');
$allowuploadnum = $allowuploadnum < 0 ? 0 : $allowuploadnum;
if(!$allowuploadnum) {
$allowuploadtoday = false;
}
}
if($_G['group']['maxsizeperday']) {
$allowuploadsize = $_G['group']['maxsizeperday'] - getuserprofile('todayattachsize');
$allowuploadsize = $allowuploadsize < 0 ? 0 : $allowuploadsize;
if(!$allowuploadsize) {
$allowuploadtoday = false;
}
$allowuploadsize = $allowuploadsize / 1048576 >= 1 ? round(($allowuploadsize / 1048576), 1).'MB' : round(($allowuploadsize / 1024)).'KB';
}
}
$allowpostimg = $_G['group']['allowpostimage'] && $imgexts;
$enctype = ($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) ? 'enctype="multipart/form-data"' : '';
$maxattachsize_mb = $_G['group']['maxattachsize'] / 1048576 >= 1 ? round(($_G['group']['maxattachsize'] / 1048576), 1).'MB' : round(($_G['group']['maxattachsize'] / 1024)).'KB';
$_G['group']['maxprice'] = isset($_G['setting']['extcredits'][$_G['setting']['creditstrans']]) ? $_G['group']['maxprice'] : 0;
$extra = !empty($_GET['extra']) ? rawurlencode($_GET['extra']) : '';
$notifycheck = empty($emailnotify) ? '' : 'checked="checked"';
$stickcheck = empty($sticktopic) ? '' : 'checked="checked"';
$digestcheck = empty($addtodigest) ? '' : 'checked="checked"';
$subject = isset($_GET['subject']) ? dhtmlspecialchars(censor(trim($_GET['subject']), NULL, FALSE, FALSE)) : '';
$subject = !empty($subject) ? str_replace("\t", ' ', $subject) : $subject;
$message = isset($_GET['message']) ? censor($_GET['message'], NULL, FALSE, FALSE) : '';
$polloptions = isset($polloptions) ? censor(trim($polloptions)) : '';
$readperm = isset($_GET['readperm']) ? intval($_GET['readperm']) : 0;
$price = isset($_GET['price']) ? intval($_GET['price']) : 0;
if(empty($bbcodeoff) && !$_G['group']['allowhidecode'] && !empty($message) && preg_match("/\[hide=?d?\d*,?\d*\].*?\[\/hide\]/is", preg_replace("/(\[code\](.+?)\[\/code\])/is", ' ', $message))) {
showmessage('post_hide_nopermission');
}
$urloffcheck = $usesigcheck = $smileyoffcheck = $codeoffcheck = $htmloncheck = $emailcheck = '';
list($seccodecheck, $secqaacheck) = seccheck('post', $_GET['action']);
$_G['group']['allowpostpoll'] = $_G['group']['allowpost'] && $_G['group']['allowpostpoll'] && ($_G['forum']['allowpostspecial'] & 1);
$_G['group']['allowposttrade'] = $_G['group']['allowpost'] && $_G['group']['allowposttrade'] && ($_G['forum']['allowpostspecial'] & 2);
$_G['group']['allowpostreward'] = $_G['group']['allowpost'] && $_G['group']['allowpostreward'] && ($_G['forum']['allowpostspecial'] & 4);
$_G['group']['allowpostactivity'] = $_G['group']['allowpost'] && $_G['group']['allowpostactivity'] && ($_G['forum']['allowpostspecial'] & 8);
$_G['group']['allowpostdebate'] = $_G['group']['allowpost'] && $_G['group']['allowpostdebate'] && ($_G['forum']['allowpostspecial'] & 16);
$usesigcheck = $_G['uid'] && $_G['group']['maxsigsize'] ? 'checked="checked"' : '';
$ordertypecheck = !empty($thread['tid']) && getstatus($thread['status'], 4) ? 'checked="checked"' : '';
$imgcontentcheck = !empty($thread['tid']) && getstatus($thread['status'], 15) ? 'checked="checked"' : '';
$specialextra = !empty($_GET['specialextra']) ? $_GET['specialextra'] : '';
$_G['forum']['threadplugin'] = dunserialize($_G['forum']['threadplugin']);
if($specialextra && $_G['group']['allowpost'] && $_G['setting']['threadplugins'] &&
(!array_key_exists($specialextra, $_G['setting']['threadplugins']) ||
!in_array($specialextra, is_array($_G['forum']['threadplugin']) ? $_G['forum']['threadplugin'] : (is_array(dunserialize($_G['forum']['threadplugin'])) ? dunserialize($_G['forum']['threadplugin']) : array())) ||
(is_array($_G['group']['allowthreadplugin']) && !in_array($specialextra, $_G['group']['allowthreadplugin'])))) {
$specialextra = '';
}
if($special == 3 && !isset($_G['setting']['extcredits'][$_G['setting']['creditstrans']])) {
showmessage('reward_credits_closed');
}
$_G['group']['allowanonymous'] = $_G['forum']['allowanonymous'] || $_G['group']['allowanonymous'] ? 1 : 0;
if($_GET['action'] == 'newthread' && $_G['forum']['allowspecialonly'] && !$special) {
if($_G['group']['allowpostpoll']) {
$special = 1;
} elseif($_G['group']['allowposttrade']) {
$special = 2;
} elseif($_G['group']['allowpostreward']) {
$special = 3;
} elseif($_G['group']['allowpostactivity']) {
$special = 4;
} elseif($_G['group']['allowpostdebate']) {
$special = 5;
} elseif($_G['group']['allowpost'] && $_G['setting']['threadplugins'] && $_G['group']['allowthreadplugin']) {
if(empty($_GET['specialextra'])) {
foreach($_G['forum']['threadplugin'] as $tpid) {
if(array_key_exists($tpid, $_G['setting']['threadplugins']) && is_array($_G['group']['allowthreadplugin']) && in_array($tpid, $_G['group']['allowthreadplugin'])){
$specialextra=$tpid;
break;
}
}
}
$threadpluginary = array_intersect($_G['forum']['threadplugin'], $_G['group']['allowthreadplugin']);
$specialextra = in_array($specialextra, $threadpluginary) ? $specialextra : '';
}
if(!$special && !$specialextra) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
}
if(!$sortid && !$specialextra) {
$postspecialcheck[$special] = ' class="a"';
}
$editorid = 'e';
$_G['setting']['editoroptions'] = str_pad(decbin($_G['setting']['editoroptions']), 3, 0, STR_PAD_LEFT);
$editormode = $_G['setting']['editoroptions'][0];
$allowswitcheditor = $_G['setting']['editoroptions'][1];
$editor = array(
'editormode' => $editormode,
'allowswitcheditor' => $allowswitcheditor,
'allowhtml' => $_G['forum']['allowhtml'],
'allowsmilies' => $_G['forum']['allowsmilies'],
'allowbbcode' => $_G['forum']['allowbbcode'],
'allowimgcode' => $_G['forum']['allowimgcode'],
'allowresize' => 1,
'allowchecklength' => 1,
'allowtopicreset' => 1,
'textarea' => 'message',
'simplemode' => !isset($_G['cookie']['editormode_'.$editorid]) ? !$_G['setting']['editoroptions'][2] : $_G['cookie']['editormode_'.$editorid],
);
if($specialextra) {
$special = 127;
}
if($_GET['action'] == 'newthread') {
$policykey = 'post';
} elseif($_GET['action'] == 'reply') {
$policykey = 'reply';
} else {
$policykey = '';
}
$policykeys = array('postattach', $policykey);
loadcache('creditrule');
foreach ($policykeys as $key) {
if($key && is_array($_G['cache']['creditrule'][$key])) {
$data = array();
$creditrule = $_G['cache']['creditrule'][$key];
for($i = 1; $i <= 8; $i++) {
if($creditrule['extcredits'.$i]) {
$data[$i] = $creditrule['extcredits'.$i];
}
}
$_G['setting']['creditspolicy'][$key] = $data;
}
}
$postattachcredits = !empty($_G['forum']['postattachcredits']) ? $_G['forum']['postattachcredits'] : $_G['setting']['creditspolicy']['postattach'];
if($policykey) {
$postcredits = getglobal('forum/'.$policykey.'credits') ? getglobal('forum/'.$policykey.'credits') : $_G['setting']['creditspolicy'][$policykey];
}
$albumlist = array();
if(helper_access::check_module('album') && $_G['group']['allowupload'] && $_G['uid']) {
$query = C::t('home_album')->fetch_all_by_uid($_G['uid'], 'updatetime');
foreach($query as $value) {
if($value['picnum']) {
$albumlist[] = $value;
}
}
}
$posturl = "action={$_GET['action']}&fid={$_G['fid']}".
(!empty($_G['tid']) ? "&tid={$_G['tid']}" : '').
(!empty($pid) ? "&pid=$pid" : '').
(!empty($special) ? "&special=$special" : '').
(!empty($sortid) ? "&sortid=$sortid" : '').
(!empty($typeid) ? "&typeid=$typeid" : '').
(!empty($_GET['firstpid']) ? "&firstpid=".$_GET['firstpid'] : '').
(!empty($_GET['addtrade']) ? "&addtrade=".$_GET['addtrade'] : '');
if($_GET['action'] == 'reply') {
check_allow_action('allowreply');
} else {
check_allow_action('allowpost');
}
if($special == 4) {
$_G['setting']['activityfield'] = $_G['setting']['activityfield'] ? dunserialize($_G['setting']['activityfield']) : array();
}
if(helper_access::check_module('album') && $_G['group']['allowupload'] && $_G['setting']['albumcategorystat'] && !empty($_G['cache']['albumcategory'])) {
require_once libfile('function/portalcp');
}
$navtitle = lang('core', 'title_'.$_GET['action'].'_post');
list($modnewthreads, $modnewreplies) = threadmodstatus('');
if($_GET['action'] == 'newthread' || $_GET['action'] == 'newtrade') {
loadcache('groupreadaccess');
$navtitle .= ' - '.$_G['forum']['name'];
require_once libfile('post/newthread', 'include');
} elseif($_GET['action'] == 'reply') {
$navtitle .= ' - '.$thread['subject'].' - '.$_G['forum']['name'];
require_once libfile('post/newreply', 'include');
} elseif($_GET['action'] == 'edit') {
loadcache('groupreadaccess');
$navtitle .= ' - '.$thread['subject'].' - '.$_G['forum']['name'];
require_once libfile('post/editpost', 'include');
}
function check_allow_action($action = 'allowpost') {
global $_G;
if(isset($_G['forum'][$action]) && $_G['forum'][$action] == -1) {
showmessage('forum_access_disallow');
}
}
function recent_use_tag() {
$tagarray = $stringarray = array();
$string = '';
$i = 0;
$query = C::t('common_tagitem')->select(0, 0, 'tid', 'itemid', 'DESC', 10);
foreach($query as $result) {
if($i > 4) {
break;
}
if($tagarray[$result['tagid']] == '') {
$i++;
}
$tagarray[$result['tagid']] = 1;
}
if($tagarray) {
$query = C::t('common_tag')->fetch_all(array_keys($tagarray));
foreach($query as $result) {
$tagarray[$result['tagid']] = $result['tagname'];
}
}
return $tagarray;
}
?>

View File

@@ -0,0 +1,151 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_redirect.php 28464 2012-03-01 06:35:27Z liulanbo $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
foreach(array('pid', 'ptid', 'authorid', 'ordertype', 'postno') as $k) {
$$k = !empty($_GET[$k]) ? intval($_GET[$k]) : 0;
}
if(empty($_GET['goto']) && $ptid) {
$_GET['goto'] = 'findpost';
}
if($_GET['goto'] == 'findpost') {
$post = $thread = array();
if($ptid) {
$thread = get_thread_by_tid($ptid);
}
if($pid) {
if($thread) {
$post = C::t('forum_post')->fetch_post($thread['posttableid'], $pid);
} else {
$post = get_post_by_pid($pid);
}
if($post && empty($thread)) {
$thread = get_thread_by_tid($post['tid']);
}
}
if(empty($thread)) {
showmessage('thread_nonexistence');
} else {
$tid = $thread['tid'];
}
if(empty($pid)) {
if($postno) {
if(getstatus($thread['status'], 3)) {
$rowarr = C::t('forum_post')->fetch_all_by_tid_position($thread['posttableid'], $ptid, $postno);
$pid = $rowarr[0]['pid'];
}
if($pid) {
$post = C::t('forum_post')->fetch_post($thread['posttableid'], $pid);
if($post['invisible'] != 0) {
$post = array();
}
} else {
$postno = $postno > 1 ? $postno - 1 : 0;
$post = C::t('forum_post')->fetch_visiblepost_by_tid($thread['posttableid'], $ptid, $postno);
}
}
}
if(empty($post)) {
if($ptid) {
header("HTTP/1.1 301 Moved Permanently");
dheader("Location: forum.php?mod=viewthread&tid=$ptid");
} else {
showmessage('post_check', NULL, array('tid' => $ptid));
}
} else {
$pid = $post['pid'];
}
$ordertype = !isset($_GET['ordertype']) && getstatus($thread['status'], 4) ? 1 : $ordertype;
if($thread['special'] == 2 || C::t('forum_threaddisablepos')->fetch($tid)) {
$curpostnum = C::t('forum_post')->count_by_tid_dateline($thread['posttableid'], $tid, $post['dateline']);
} else {
if($thread['maxposition']) {
$maxposition = $thread['maxposition'];
} else {
$maxposition = C::t('forum_post')->fetch_maxposition_by_tid($thread['posttableid'], $tid);
}
$thread['replies'] = $maxposition;
$curpostnum = $post['position'];
}
if($ordertype != 1) {
$page = ceil($curpostnum / $_G['ppp']);
} elseif($curpostnum > 1) {
$page = ceil(($thread['replies'] - $curpostnum + 3) / $_G['ppp']);
} else {
$page = 1;
}
if($thread['special'] == 2 && C::t('forum_trade')->check_goods($pid)) {
header("HTTP/1.1 301 Moved Permanently");
dheader("Location: forum.php?mod=viewthread&do=tradeinfo&tid=$tid&pid=$pid");
}
$authoridurl = $authorid ? '&authorid='.$authorid : '';
$ordertypeurl = $ordertype ? '&ordertype='.$ordertype : '';
header("HTTP/1.1 301 Moved Permanently");
dheader("Location: forum.php?mod=viewthread&tid=$tid&page=$page$authoridurl$ordertypeurl".(isset($_GET['modthreadkey']) && ($modthreadkey = modauthkey($tid)) ? "&modthreadkey=$modthreadkey": '')."#pid$pid");
}
if(empty($_G['thread'])) {
showmessage('thread_nonexistence');
}
if($_GET['goto'] == 'lastpost') {
$pageadd = '';
if(!getstatus($_G['thread'], 4)) {
$page = ceil(($_G['thread']['special'] ? $_G['thread']['replies'] : $_G['thread']['replies'] + 1) / $_G['ppp']);
$pageadd = $page > 1 ? '&page='.$page : '';
}
dheader('Location: forum.php?mod=viewthread&tid='.$_G['tid'].$pageadd.'#lastpost');
} elseif($_GET['goto'] == 'nextnewset' || $_GET['goto'] == 'nextoldset') {
$lastpost = $_G['thread']['lastpost'];
$glue = '<';
$sort = 'DESC';
if($_GET['goto'] == 'nextnewset') {
$glue = '>';
$sort = 'ASC';
}
$next = C::t('forum_thread')->fetch_next_tid_by_fid_lastpost($_G['fid'], $lastpost, $glue, $sort, $_G['thread']['threadtableid']);
if($next) {
dheader("Location: forum.php?mod=viewthread&tid=$next");
} elseif($_GET['goto'] == 'nextnewset') {
showmessage('redirect_nextnewset_nonexistence');
} else {
showmessage('redirect_nextoldset_nonexistence');
}
} else {
showmessage('undefined_action', NULL);
}
?>

View File

@@ -0,0 +1,161 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_rss.php 33056 2013-04-15 06:44:56Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
error_reporting(0);
define('IN_DISCUZ', TRUE);
define('DISCUZ_ROOT', '');
loadcache('forums');
if(!$_G['setting']['rssstatus']) {
exit('RSS Disabled');
}
$ttl = $_G['setting']['rssttl'] ? $_G['setting']['rssttl']: 30;
$num = 20;
$_G['groupid'] = 7;
$_G['uid'] = 0;
$_G['username'] = $_G['member']['password'] = '';
$rssfid = empty($_GET['fid']) ? 0 : intval($_GET['fid']);
$forumname = '';
if(empty($rssfid)) {
foreach($_G['cache']['forums'] as $fid => $forum) {
if(rssforumperm($forum)) {
$fidarray[] = $fid;
}
}
} else {
$forum = isset($_G['cache']['forums'][$rssfid]) && $_G['cache']['forums'][$rssfid]['type'] != 'group' ? $_G['cache']['forums'][$rssfid] : array();
if(!isset($_G['cache']['forums'][$rssfid])) {
$forum = $_G['cache']['forums'][$rssfid] = array();
$subforum = C::t('forum_forum')->fetch_info_by_fid($rssfid);
if($subforum['type'] == 'sub') {
$forum = $_G['cache']['forums'][$rssfid] = $subforum;
}
}
if($forum && rssforumperm($forum)) {
$fidarray = array($rssfid);
$forumname = dhtmlspecialchars($_G['cache']['forums'][$rssfid]['name']);
} else {
exit('Specified forum not found');
}
}
$frewriteflag = $trewriteflag = 0;
$havedomain = implode('', $_G['setting']['domain']['app']);
if(is_array($_G['setting']['rewritestatus']) && in_array('forum_forumdisplay', $_G['setting']['rewritestatus'])) {
$frewriteflag = 1;
}
if(is_array($_G['setting']['rewritestatus']) && in_array('forum_viewthread', $_G['setting']['rewritestatus'])) {
$trewriteflag = 1;
}
$charset = $_G['config']['output']['charset'];
dheader("Content-type: application/xml");
echo "<?xml version=\"1.0\" encoding=\"".$charset."\"?>\n".
"<rss version=\"2.0\">\n".
" <channel>\n".
(count($fidarray) > 1 ?
" <title>{$_G['setting']['bbname']}</title>\n".
" <link>{$_G['siteurl']}forum.php</link>\n".
" <description>Latest $num threads of all forums</description>\n"
:
" <title>{$_G['setting']['bbname']} - $forumname</title>\n".
" <link>{$_G['siteurl']}".($frewriteflag ? rewriteoutput('forum_forumdisplay', 1, '', $rssfid) : "forum.php?mod=forumdisplay&amp;fid=$rssfid")."</link>\n".
" <description>Latest $num threads of $forumname</description>\n"
).
" <copyright>Copyright(C) {$_G['setting']['bbname']}</copyright>\n".
" <generator>Discuz! Board by Comsenz Inc.</generator>\n".
" <lastBuildDate>".gmdate('r', TIMESTAMP)."</lastBuildDate>\n".
" <ttl>$ttl</ttl>\n".
" <image>\n".
" <url>{$_G['siteurl']}static/image/common/logo_88_31.gif</url>\n".
" <title>{$_G['setting']['bbname']}</title>\n".
" <link>{$_G['siteurl']}</link>\n".
" </image>\n";
if($fidarray) {
$alldata = C::t('forum_rsscache')->fetch_all_by_fid($fidarray, $num);
if($alldata) {
foreach($alldata as $thread) {
if(TIMESTAMP - $thread['lastupdate'] > $ttl * 60) {
updatersscache($num);
break;
} else {
list($thread['description'], $attachremote, $attachfile, $attachsize) = explode("\t", $thread['description']);
if($attachfile) {
if($attachremote) {
$filename = $_G['setting']['ftp']['attachurl'].'forum/'.$attachfile;
} else {
$filename = (!strstr($_G['setting']['attachurl'], '://') ? $_G['siteurl'] : '').$_G['setting']['attachurl'].'forum/'.$attachfile;
}
}
echo " <item>\n".
" <title>".$thread['subject']."</title>\n".
" <link>{$_G['siteurl']}".($trewriteflag ? rewriteoutput('forum_viewthread', 1, '', $thread['tid']) : "forum.php?mod=viewthread&amp;tid={$thread['tid']}")."</link>\n".
" <description><![CDATA[".dhtmlspecialchars($thread['description'])."]]></description>\n".
" <category>".dhtmlspecialchars($thread['forum'])."</category>\n".
" <author>".dhtmlspecialchars($thread['author'])."</author>\n".
($attachfile ? '<enclosure url="'.$filename.'" length="'.$attachsize.'" type="image/jpeg" />' : '').
" <pubDate>".gmdate('r', $thread['dateline'])."</pubDate>\n".
" </item>\n";
}
}
} else {
updatersscache($num);
}
}
echo " </channel>\n".
"</rss>";
function updatersscache($num) {
global $_G;
$processname = 'forum_rss_cache';
if(discuz_process::islocked($processname, 600)) {
return false;
}
C::t('forum_rsscache')->truncate();
require_once libfile('function/post');
foreach($_G['cache']['forums'] as $fid => $forum) {
if($forum['type'] != 'group') {
$forum['name'] = addslashes($forum['name']);
foreach(C::t('forum_thread')->fetch_all_by_fid_displayorder($fid, 0, null, null, 0, $num, 'tid') as $thread) {
$thread['author'] = $thread['author'] != '' ? addslashes($thread['author']) : 'Anonymous';
$thread['subject'] = addslashes($thread['subject']);
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
$attachdata = '';
$thread['message'] = $post['message'];
$thread['status'] = $post['status'];
$thread['description'] = $thread['readperm'] > 0 || $thread['price'] > 0 || $thread['status'] & 1 ? '' : addslashes(threadmessagecutstr($thread, $thread['message'], 250 - strlen($attachdata)).$attachdata);
C::t('forum_rsscache')->insert(array(
'lastupdate'=>$_G['timestamp'],
'fid'=>$fid,
'tid'=>$thread['tid'],
'dateline'=>$thread['dateline'],
'forum'=>$forum['name'],
'author'=>$thread['author'],
'subject'=>$thread['subject'],
'description'=>$thread['description']
), false, true);
}
}
}
discuz_process::unlock($processname);
return true;
}
?>

View File

@@ -0,0 +1,69 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
*
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
global $_G;
$op = in_array($_GET['op'], array('search', 'manage', 'set')) ? $_GET['op'] : '';
$taglist = array();
$thread = & $_G['thread'];
if($op == 'search') {
$searchkey = stripsearchkey($_GET['searchkey']);
$query = C::t('common_tag')->fetch_all_by_status(0, $searchkey, 50, 0);
foreach($query as $value) {
$taglist[] = $value;
}
$searchkey = dhtmlspecialchars($searchkey);
} elseif($op == 'manage') {
if($_G['tid']) {
$tagarray_all = $array_temp = $threadtag_array = array();
$tags = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['tid']);
$tags = $tags['tags'];
$tagarray_all = explode("\t", $tags);
if($tagarray_all) {
foreach($tagarray_all as $var) {
if($var) {
$array_temp = explode(',', $var);
$threadtag_array[] = $array_temp['1'];
}
}
}
$tags = implode(',', $threadtag_array);
$recent_use_tag = array();
$i = 0;
$query = C::t('common_tagitem')->select(0, 0, 'tid', 'itemid', 'DESC', 10);
foreach($query as $result) {
if($i > 4) {
break;
}
if($recent_use_tag[$result['tagid']] == '') {
$i++;
}
$recent_use_tag[$result['tagid']] = 1;
}
if($recent_use_tag) {
$query = C::t('common_tag')->fetch_all(array_keys($recent_use_tag));
foreach($query as $result) {
$recent_use_tag[$result['tagid']] = $result['tagname'];
}
}
}
} elseif($op == 'set' && $_GET['formhash'] == FORMHASH && $_G['group']['allowmanagetag']) {
$class_tag = new tag();
$tagstr = $class_tag->update_field($_GET['tags'], $_G['tid'], 'tid', $_G['thread']);
C::t('forum_post')->update_by_tid('tid:'.$_G['tid'], $_G['tid'], array('tags' => $tagstr), false, false, 1);
}
include_once template("forum/tag");
?>

View File

@@ -0,0 +1,102 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_topicadmin.php 30872 2012-06-27 10:11:44Z liulanbo $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
$_G['inajax'] = 1;
$_GET['topiclist'] = !empty($_GET['topiclist']) ? (is_array($_GET['topiclist']) ? array_unique($_GET['topiclist']) : $_GET['topiclist']) : array();
loadcache(array('modreasons', 'stamptypeid', 'threadtableids'));
require_once libfile('function/post');
require_once libfile('function/misc');
$modpostsnum = 0;
$resultarray = $thread = array();
$threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array();
$specialperm = $_GET['action'] == 'stickreply' && $_G['thread']['authorid'] == $_G['uid'];
if(!$specialperm && (!$_G['uid'] || !$_G['forum']['ismoderator'])) {
showmessage('admin_nopermission', NULL);
}
$frommodcp = !empty($_GET['frommodcp']) ? intval($_GET['frommodcp']) : 0;
$navigation = $navtitle = '';
if(!empty($_G['tid'])) {
$_GET['archiveid'] = intval($_GET['archiveid']);
$archiveid = 0;
if(!empty($_GET['archiveid']) && in_array($_GET['archiveid'], $threadtableids)) {
$archiveid = $_GET['archiveid'];
}
$displayorder = !$_G['forum_auditstatuson'] ? 0 : null;
$thread = C::t('forum_thread')->fetch_by_tid_fid_displayorder($_G['tid'], $_G['fid'], $displayorder, $archiveid);
if(!$thread) {
showmessage('thread_nonexistence');
}
$navigation .= " &raquo; <a href=\"forum.php?mod=viewthread&tid={$_G['tid']}\">{$thread['subject']}</a> ";
$navtitle .= ' - '.$thread['subject'].' - ';
if($thread['special'] && in_array($_GET['action'], array('copy', 'split', 'merge'))) {
showmessage('special_noaction');
}
}
if(($_G['group']['reasonpm'] == 2 || $_G['group']['reasonpm'] == 3) || !empty($_GET['sendreasonpm'])) {
$forumname = strip_tags($_G['forum']['name']);
$sendreasonpm = 1;
} else {
$sendreasonpm = 0;
}
$_GET['handlekey'] = 'mods';
if(preg_match('/^\w+$/', $_GET['action']) && file_exists($topicadminfile = libfile('topicadmin/'.$_GET['action'], 'include'))) {
require_once $topicadminfile;
} else {
showmessage('undefined_action', NULL);
}
if($resultarray) {
if($resultarray['modtids']) {
updatemodlog($resultarray['modtids'], $modaction, $resultarray['expiration']);
}
updatemodworks($modaction, $modpostsnum);
if(is_array($resultarray['modlog'])) {
if(isset($resultarray['modlog']['tid'])) {
modlog($resultarray['modlog'], $modaction);
} else {
foreach($resultarray['modlog'] as $thread) {
modlog($thread, $modaction);
}
}
}
if($resultarray['reasonpm']) {
$modactioncode = lang('forum/modaction');
$modaction = $modactioncode[$modaction];
foreach($resultarray['reasonpm']['data'] as $var) {
sendreasonpm($var, $resultarray['reasonpm']['item'], $resultarray['reasonvar'], $resultarray['reasonpm']['notictype']);
}
}
showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'), $resultarray['redirect']);
}
?>

View File

@@ -0,0 +1,377 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_trade.php 27054 2011-12-31 06:04:21Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
$apitype = $_GET['apitype'];
if(!$_G['uid']) {
showmessage('not_loggedin', NULL, array(), array('login' => 1));
}
$page = max(1, intval($_GET['page']));
$orderid = $_GET['orderid'];
if(!empty($orderid) && empty($_GET['apitype'])) {
$orderinfo = C::t('forum_tradelog')->fetch($orderid);
$paytype = $orderinfo['paytype'];
if($paytype == 1) {
$apitype = 'alipay';
}
if($paytype == 2) {
$apitype = 'tenpay';
}
}
require_once libfile('function/trade');
if(!empty($orderid)) {
$language = lang('forum/misc');
$tradelog = C::t('forum_tradelog')->fetch($orderid);
if(!$_G['forum_auditstatuson'] && (empty($tradelog) || $_G['uid'] != $tradelog['sellerid'] && $_G['uid'] != $tradelog['buyerid'])) {
showmessage('undefined_action', NULL);
}
$limit = 6;
$query = C::t('forum_trade')->fetch_all_for_seller($tradelog['sellerid'], $limit);
$usertrades = array();
$usertradecount = 0;
foreach($query as $usertrade) {
$usertradecount++;
$usertrades[] = $usertrade;
}
$trade_message = '';
$currentcredit = $_G['setting']['creditstrans'] ? getuserprofile('extcredits'.$_G['setting']['creditstrans']) : 0;
$discountprice = $tradelog['baseprice'] * $tradelog['number'];
if(!empty($_GET['pay']) && !$tradelog['offline'] && $tradelog['status'] == 0 && $tradelog['buyerid'] == $_G['uid']) {
if($_G['setting']['creditstransextra'][5] != -1 && $tradelog['credit']) {
if($tradelog['credit'] > getuserprofile('extcredits'.$_G['setting']['creditstransextra'][5])) {
showmessage('trade_credit_lack');
}
updatemembercount($tradelog['buyerid'], array($_G['setting']['creditstransextra'][5] => -$tradelog['credit']));
}
$trade = C::t('forum_trade')->fetch_goods($tradelog['tid'], $tradelog['pid']);
if($_G['uid'] && $currentcredit < $discountcredit && $tradelog['discount']) {
showmessage('trade_credits_no_enough', '', array('credittitle' => $_G['setting']['extcredits'][$_G['setting']['creditstrans']]['title']));
}
$pay = array();
$pay['commision'] = 0;
$transport = $tradelog['transport'];
$transportfee = 0;
trade_setprice(array('fee' => $fee, 'trade' => $trade, 'transport' => $transport), $price, $pay, $transportfee);
$payurl = trade_payurl($pay, $trade, $tradelog);
$paytype = 0;
if($apitype == 'alipay') {
$paytype = 1;
} elseif($apitype == 'tenpay') {
$paytype = 2;
}
C::t('forum_tradelog')->update($orderid, array('paytype' => $paytype));
showmessage('trade_directtopay', $payurl);
}
if(submitcheck('offlinesubmit') && in_array($_GET['offlinestatus'], trade_offline($tradelog, 0))) {
loaducenter();
$ucresult = uc_user_login($_G['username'], $_GET['password']);
list($tmp['uid']) = daddslashes($ucresult);
if($tmp['uid'] <= 0) {
showmessage('trade_password_error', 'forum.php?mod=trade&orderid='.$orderid);
}
if($_GET['offlinestatus'] == 4) {
if($_G['setting']['creditstransextra'][5] != -1 && $tradelog['credit']) {
if($tradelog['credit'] > getuserprofile('extcredits'.$_G['setting']['creditstransextra'][5])) {
showmessage('trade_credit_lack');
}
updatemembercount($tradelog['buyerid'], array($_G['setting']['creditstransextra'][5] => -$tradelog['credit']));
}
$trade = C::t('forum_trade')->fetch_goods($tradelog['tid'], $tradelog['pid']);
notification_add($tradelog['sellerid'], 'goods', 'trade_seller_send', array(
'buyerid' => $tradelog['buyerid'],
'buyer' => $tradelog['buyer'],
'orderid' => $orderid,
'subject' => $tradelog['subject']
));
} elseif($_GET['offlinestatus'] == 5) {
notification_add($tradelog['buyerid'], 'goods', 'trade_buyer_confirm', array(
'sellerid' => $tradelog['sellerid'],
'seller' => $tradelog['seller'],
'orderid' => $orderid,
'subject' => $tradelog['subject']
));
} elseif($_GET['offlinestatus'] == 7) {
if($_G['setting']['creditstransextra'][5] != -1 && $tradelog['basecredit']) {
$netcredit = round($tradelog['number'] * $tradelog['basecredit'] * (1 - $_G['setting']['creditstax']));
updatemembercount($tradelog['sellerid'], array($_G['setting']['creditstransextra'][5] => $netcredit));
} else {
$netcredit = 0;
}
$data = array('lastbuyer' => $tradelog['buyer'], 'lastupdate' => $_G['timestamp']);
C::t('forum_trade')->update_trade($tradelog['tid'], $tradelog['pid'], $data);
C::t('forum_trade')->update_counter($tradelog['tid'], $tradelog['pid'], $tradelog['number'], $tradelog['price'], $netcredit);
notification_add($tradelog['sellerid'], 'goods', 'trade_success', array(
'orderid' => $orderid,
'subject' => $tradelog['subject']
));
notification_add($tradelog['buyerid'], 'goods', 'trade_success', array(
'orderid' => $orderid,
'subject' => $tradelog['subject']
));
} elseif($_GET['offlinestatus'] == 17) {
C::t('forum_trade')->update_counter($tradelog['tid'], $tradelog['pid'], 0, 0, 0, $tradelog['number']);
notification_add($tradelog['sellerid'], 'goods', 'trade_fefund_success', array(
'orderid' => $orderid,
'subject' => $tradelog['subject']
));
notification_add($tradelog['buyerid'], 'goods', 'trade_fefund_success', array(
'orderid' => $orderid,
'subject' => $tradelog['subject']
));
if($_G['setting']['creditstransextra'][5] != -1 && $tradelog['basecredit']) {
updatemembercount($tradelog['buyerid'], array($_G['setting']['creditstransextra'][5] => $tradelog['number'] * $tradelog['basecredit']));
}
}
$_GET['message'] = trim($_GET['message']);
if($_GET['message']) {
$_GET['message'] = $tradelog['message']."\t\t\t".$_G['uid']."\t".$_G['member']['username']."\t".TIMESTAMP."\t".nl2br(strip_tags(substr($_GET['message'], 0, 200)));
} else {
$_GET['message'] = $tradelog['message'];
}
C::t('forum_tradelog')->update($orderid, array(
'status' => $_GET['offlinestatus'],
'lastupdate' => $_G['timestamp'],
'message' => $_GET['message']
));
showmessage('trade_orderstatus_updated', 'forum.php?mod=trade&orderid='.$orderid);
}
if(submitcheck('tradesubmit')) {
if($tradelog['status'] == 0) {
$update = array();
$oldbasecredit = $tradelog['basecredit'];
$oldnumber = $tradelog['number'];
if($tradelog['sellerid'] == $_G['uid']) {
$tradelog['baseprice'] = floatval($_GET['newprice']);
$tradelog['basecredit'] = intval($_GET['newcredit']);
if(!$tradelog['baseprice'] < 0 || $tradelog['basecredit'] < 0) {
showmessage('trade_pricecredit_error');
}
$tradelog['transportfee'] = intval($_GET['newfee']);
$newnumber = $tradelog['number'];
$update = array(
'baseprice' => $tradelog['baseprice'],
'basecredit' => $tradelog['basecredit'],
'transportfee' => $tradelog['transportfee']
);
notification_add($tradelog['buyerid'], 'goods', 'trade_order_update_sellerid', array(
'seller' => $tradelog['seller'],
'sellerid' => $tradelog['sellerid'],
'orderid' => $orderid,
'subject' => $tradelog['subject']
));
}
if($tradelog['buyerid'] == $_G['uid']) {
$newnumber = intval($_GET['newnumber']);
if($newnumber <= 0) {
showmessage('trade_input_no');
}
$trade = C::t('forum_trade')->fetch_goods($tradelog['tid'], $tradelog['pid']);
if($newnumber > $trade['amount'] + $tradelog['number']) {
showmessage('trade_lack');
}
$amount = $trade['amount'] + $tradelog['number'] - $newnumber;
C::t('forum_trade')->update_trade($tradelog['tid'], $tradelog['pid'], array('amount' => $amount));
$tradelog['number'] = $newnumber;
$update = array(
'number' => $tradelog['number'],
'discount' => 0,
'buyername' => dhtmlspecialchars($_GET['newbuyername']),
'buyercontact' => dhtmlspecialchars($_GET['newbuyercontact']),
'buyerzip' => dhtmlspecialchars($_GET['newbuyerzip']),
'buyerphone' => dhtmlspecialchars($_GET['newbuyerphone']),
'buyermobile' => dhtmlspecialchars($_GET['newbuyermobile']),
'buyermsg' => dhtmlspecialchars($_GET['newbuyermsg'])
);
notification_add($tradelog['sellerid'], 'goods', 'trade_order_update_buyerid', array(
'buyer' => $tradelog['buyer'],
'buyerid' => $tradelog['buyerid'],
'orderid' => $orderid,
'subject' => $tradelog['subject']
));
}
if($update) {
if($tradelog['discount']) {
$tradelog['baseprice'] = $tradelog['baseprice'] - $tax;
$price = $tradelog['baseprice'] * $tradelog['number'];
} else {
$price = $tradelog['baseprice'] * $tradelog['number'];
}
if($_G['setting']['creditstransextra'][5] != -1 && ($oldnumber != $newnumber || $oldbasecredit != $tradelog['basecredit'])) {
$tradelog['credit'] = $newnumber * $tradelog['basecredit'];
$update['credit'] = $tradelog['credit'];
}
$update['price'] = $price + ($tradelog['transport'] == 2 ? $tradelog['transportfee'] : 0);
C::t('forum_tradelog')->update($orderid, $update);
$tradelog = C::t('forum_tradelog')->fetch($orderid);
}
}
}
$tradelog['lastupdate'] = dgmdate($tradelog['lastupdate'], 'u');
$tradelog['statusview'] = trade_getstatus($tradelog['status']);
$messagelist = array();
if($tradelog['offline']) {
$offlinenext = trade_offline($tradelog, 1, $trade_message);
$message = explode("\t\t\t", $tradelog['message']);
foreach($message as $row) {
$row = explode("\t", $row);
$row[2] = dgmdate($row[2], 'u');
$row[0] && $messagelist[] = $row;
}
} else {
$loginurl = trade_getorderurl($tradelog['tradeno']);
}
$trade = C::t('forum_trade')->fetch_goods($tradelog['tid'], $tradelog['pid']);
include template('forum/trade_view');
} else {
if(empty($_GET['pid'])) {
$pid = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['tid']);
$pid = $pid['pid'];
} else {
$pid = $_GET['pid'];
}
$thread = C::t('forum_thread')->fetch_thread($_G['tid']);
if($thread['closed']) {
showmessage('trade_closed', 'forum.php?mod=viewthread&tid='.$_G['tid'].'&page='.$page);
}
$trade = C::t('forum_trade')->fetch_goods($_G['tid'], $pid);
if(empty($trade)) {
showmessage('trade_not_found');
}
$fromcode = false;
if($trade['closed']) {
showmessage('trade_closed', 'forum.php?mod=viewthread&tid='.$_G['tid'].'&page='.$page);
}
if($trade['price'] <= 0 && $trade['credit'] <= 0) {
showmessage('trade_invalid', 'forum.php?mod=viewthread&tid='.$_G['tid'].'&page='.$page);
}
if($trade['credit'] > 0 && $_G['setting']['creditstransextra'][5] == -1) {
showmessage('trade_credit_invalid', 'forum.php?mod=viewthread&tid='.$_G['tid'].'&page='.$page);
}
$limit = 6;
$query = C::t('forum_trade')->fetch_all_for_seller($trade['sellerid'], $limit);
$usertrades = array();
$usertradecount = 0;
foreach($query as $usertrade) {
$usertradecount++;
$usertrades[] = $usertrade;
}
if($_GET['action'] != 'trade' && !submitcheck('tradesubmit')) {
$lastbuyerinfo = dhtmlspecialchars(C::t('forum_tradelog')->fetch_last($_G['uid']));
$extra = rawurlencode($extra);
include template('forum/trade');
} else {
if($trade['sellerid'] == $_G['uid']) {
showmessage('trade_by_myself');
} elseif($_GET['number'] <= 0) {
showmessage('trade_input_no');
} elseif(!$fromcode && $_GET['number'] > $trade['amount']) {
showmessage('trade_lack');
}
$pay['number'] = $_GET['number'];
$pay['price'] = $trade['price'];
$credit = 0;
if($_G['setting']['creditstransextra'][5] != -1 && $trade['credit']) {
$credit = $_GET['number'] * $trade['credit'];
}
$price = $pay['price'] * $pay['number'];
$buyercredits = 0;
$pay['commision'] = 0;
$orderid = $pay['orderid'] = dgmdate(TIMESTAMP, 'YmdHis').random(18);
$transportfee = 0;
trade_setprice(array('fee' => $fee, 'trade' => $trade, 'transport' => $_GET['transport']), $price, $pay, $transportfee);
$buyerid = $_G['uid'] ? $_G['uid'] : 0;
$_G['username'] = $_G['username'] ? $_G['username'] : $guestuser;
$trade = daddslashes($trade, 1);
$buyermsg = dhtmlspecialchars($_GET['buyermsg']);
$buyerzip = dhtmlspecialchars($_GET['buyerzip']);
$buyerphone = dhtmlspecialchars($_GET['buyerphone']);
$buyermobile = dhtmlspecialchars($_GET['buyermobile']);
$buyername = dhtmlspecialchars($_GET['buyername']);
$buyercontact = dhtmlspecialchars($_GET['buyercontact']);
$offline = !empty($_GET['offline']) ? 1 : 0;
C::t('forum_tradelog')->insert(array(
'tid' => $trade['tid'],
'pid' => $trade['pid'],
'orderid' => $orderid,
'subject' => $trade['subject'],
'price' => $price,
'quality' => $trade['quality'],
'itemtype' => $trade['itemtype'],
'number' => $_GET['number'],
'tax' => $tax,
'locus' => $trade['locus'],
'sellerid' => $trade['sellerid'],
'seller' => $trade['seller'],
'selleraccount' => $trade['account'],
'tenpayaccount' => $trade['tenpayaccount'],
'buyerid' => $_G['uid'],
'buyer' => $_G['username'],
'buyercontact' => $buyercontact,
'buyercredits' => 0,
'buyermsg' => $buyermsg,
'lastupdate' => $_G['timestamp'],
'offline' => $offline,
'buyerzip' => $buyerzip,
'buyerphone' => $buyerphone,
'buyermobile' => $buyermobile,
'buyername' => $buyername,
'transport' => $_GET['transport'],
'transportfee' => $transportfee,
'baseprice' => $trade['price'],
'discount' => 0,
'credit' => $credit,
'basecredit' => $trade['credit']
));
C::t('forum_trade')->update_counter($trade['tid'], $trade['pid'], 0, 0, 0, '-'.$_GET['number']);
showmessage('trade_order_created', 'forum.php?mod=trade&orderid='.$orderid);
}
}
?>

File diff suppressed because it is too large Load Diff

View File