First commit
This commit is contained in:
0
source/include/post/index.htm
Normal file
0
source/include/post/index.htm
Normal file
37
source/include/post/post_albumphoto.php
Normal file
37
source/include/post/post_albumphoto.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: post_albumphoto.php 25246 2011-11-02 03:34:53Z zhangguosheng $
|
||||
*/
|
||||
if (!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
include_once libfile('function/home');
|
||||
$perpage = 8;
|
||||
$page = max(1, $_GET['page']);
|
||||
$start_limit = ($page - 1) * $perpage;
|
||||
$aid = intval($_GET['aid']);
|
||||
$photolist = array();
|
||||
$query = C::t('home_album')->fetch_all_by_uid($_G['uid'], false, 0, 0, $aid);
|
||||
$count = $query[0]['picnum'];
|
||||
$albuminfo = C::t('home_album')->fetch_album($aid, $_G['uid']);
|
||||
if(empty($albuminfo)) {
|
||||
showmessage('to_view_the_photo_does_not_exist');
|
||||
}
|
||||
$query = C::t('home_pic')->fetch_all_by_albumid($aid, $start_limit, $perpage, 0, 0, 1);
|
||||
foreach($query as $value) {
|
||||
$value['bigpic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote'], 0);
|
||||
$value['pic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']);
|
||||
$value['count'] = $count;
|
||||
$value['url'] = (preg_match('/^https?:\/\//is', $value['bigpic']) ? '' : $_G['siteurl']) . $value['bigpic'];
|
||||
$value['thumburl'] = (preg_match('/^https?:\/\//is', $value['pic']) ? '' : $_G['siteurl']) . $value['pic'];
|
||||
$photolist[] = $value;
|
||||
}
|
||||
$_GET['ajaxtarget'] = 'albumphoto';
|
||||
$multi = multi($count, $perpage, $page, "forum.php?mod=post&action=albumphoto&aid=$aid");
|
||||
include template('forum/ajax_albumlist');
|
||||
exit;
|
530
source/include/post/post_editpost.php
Normal file
530
source/include/post/post_editpost.php
Normal file
@@ -0,0 +1,530 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: post_editpost.php 36284 2016-12-12 00:47:50Z nemohou $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$orig = get_post_by_tid_pid($_G['tid'], $pid);
|
||||
$isfirstpost = $orig['first'] ? 1 : 0;
|
||||
|
||||
if($isfirstpost && (($special == 1 && !$_G['group']['allowpostpoll']) || ($special == 2 && !$_G['group']['allowposttrade']) || ($special == 3 && !$_G['group']['allowpostreward']) || ($special == 4 && !$_G['group']['allowpostactivity']) || ($special == 5 && !$_G['group']['allowpostdebate']))) {
|
||||
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
|
||||
}
|
||||
|
||||
if($_G['setting']['magicstatus']) {
|
||||
$magiclog = C::t('forum_threadmod')->fetch_by_tid_magicid($_G['tid'], 10);
|
||||
$magicid = $magiclog['magicid'];
|
||||
$_G['group']['allowanonymous'] = $_G['group']['allowanonymous'] || $magicid ? 1 : $_G['group']['allowanonymous'];
|
||||
}
|
||||
|
||||
$isorigauthor = $_G['uid'] && $_G['uid'] == $orig['authorid'];
|
||||
$isanonymous = ($_G['group']['allowanonymous'] || $orig['anonymous']) && getgpc('isanonymous') ? 1 : 0;
|
||||
$audit = $orig['invisible'] == -2 || $thread['displayorder'] == -2 ? $_GET['audit'] : 0;
|
||||
|
||||
if(empty($orig)) {
|
||||
showmessage('post_nonexistence');
|
||||
} elseif((!$_G['forum']['ismoderator'] || !$_G['group']['alloweditpost'] || (in_array($orig['adminid'], array(1, 2, 3)) && $_G['adminid'] > $orig['adminid'])) && !(($_G['forum']['alloweditpost'] || $orig['invisible'] == -3)&& $isorigauthor)) {
|
||||
showmessage('post_edit_nopermission', NULL);
|
||||
} elseif($isorigauthor && !$_G['forum']['ismoderator'] && $orig['invisible'] != -3) {
|
||||
$alloweditpost_status = getstatus($_G['setting']['alloweditpost'], $special + 1);
|
||||
if(!$alloweditpost_status && $_G['group']['edittimelimit'] && TIMESTAMP - $orig['dateline'] > $_G['group']['edittimelimit'] * 60) {
|
||||
showmessage('post_edit_timelimit', NULL, array('edittimelimit' => $_G['group']['edittimelimit']));
|
||||
}
|
||||
}
|
||||
|
||||
$thread['pricedisplay'] = $thread['price'] == -1 ? 0 : $thread['price'];
|
||||
|
||||
if($special == 5) {
|
||||
$debate = array_merge($thread, daddslashes(C::t('forum_debate')->fetch($_G['tid'])));
|
||||
$firststand = C::t('forum_debatepost')->get_firststand($_G['tid'], $_G['uid']);
|
||||
|
||||
if(!$isfirstpost && $debate['endtime'] && $debate['endtime'] < TIMESTAMP && !$_G['forum']['ismoderator']) {
|
||||
showmessage('debate_end');
|
||||
}
|
||||
if($isfirstpost && $debate['umpirepoint'] && !$_G['forum']['ismoderator']) {
|
||||
showmessage('debate_umpire_comment_invalid');
|
||||
}
|
||||
}
|
||||
|
||||
$rushreply = getstatus($thread['status'], 3);
|
||||
|
||||
|
||||
if($isfirstpost && $isorigauthor && $_G['group']['allowreplycredit']) {
|
||||
if($replycredit_rule = C::t('forum_replycredit')->fetch($_G['tid'])) {
|
||||
if($thread['replycredit']) {
|
||||
$replycredit_rule['lasttimes'] = $thread['replycredit'] / $replycredit_rule['extcredits'];
|
||||
}
|
||||
$replycredit_rule['extcreditstype'] = $replycredit_rule['extcreditstype'] ? $replycredit_rule['extcreditstype'] : $_G['setting']['creditstransextra'][10];
|
||||
}
|
||||
}
|
||||
|
||||
if(!submitcheck('editsubmit')) {
|
||||
|
||||
$thread['hiddenreplies'] = getstatus($thread['status'], 2);
|
||||
|
||||
|
||||
$postinfo = C::t('forum_post')->fetch_post('tid:'.$_G['tid'], $pid);
|
||||
if($postinfo['fid'] != $_G['fid'] || $postinfo['tid'] != $_G['tid']) {
|
||||
$postinfo = array();
|
||||
}
|
||||
|
||||
$usesigcheck = $postinfo['usesig'] ? 'checked="checked"' : '';
|
||||
$urloffcheck = $postinfo['parseurloff'] ? 'checked="checked"' : '';
|
||||
$smileyoffcheck = $postinfo['smileyoff'] == 1 ? 'checked="checked"' : '';
|
||||
$codeoffcheck = $postinfo['bbcodeoff'] == 1 ? 'checked="checked"' : '';
|
||||
$tagoffcheck = $postinfo['htmlon'] & 2 ? 'checked="checked"' : '';
|
||||
$htmloncheck = $postinfo['htmlon'] & 1 ? 'checked="checked"' : '';
|
||||
if(!$isfirstpost) {
|
||||
$_G['group']['allowimgcontent'] = 0;
|
||||
}
|
||||
if($isfirstpost && $imgcontentcheck && $_G['group']['allowimgcontent']) {
|
||||
$editor['editormode'] = 0;
|
||||
}
|
||||
if($htmloncheck) {
|
||||
$editor['editormode'] = 0;
|
||||
$editor['allowswitcheditor'] = 1;
|
||||
}
|
||||
$showthreadsorts = ($thread['sortid'] || !empty($sortid)) && $isfirstpost;
|
||||
$sortid = empty($sortid) ? $thread['sortid'] : $sortid;
|
||||
|
||||
$poll = $temppoll = array();
|
||||
if($isfirstpost) {
|
||||
if($postinfo['tags']) {
|
||||
$tagarray_all = $array_temp = $threadtag_array = array();
|
||||
$tagarray_all = explode("\t", $postinfo['tags']);
|
||||
if($tagarray_all) {
|
||||
foreach($tagarray_all as $var) {
|
||||
if($var) {
|
||||
$array_temp = explode(',', $var);
|
||||
$threadtag_array[] = $array_temp['1'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$postinfo['tag'] = implode(',', $threadtag_array);
|
||||
}
|
||||
$allownoticeauthor = getstatus($thread['status'], 6);
|
||||
|
||||
if($rushreply) {
|
||||
$postinfo['rush'] = C::t('forum_threadrush')->fetch($_G['tid']);
|
||||
if($postinfo['rush']['creditlimit'] == -996) {
|
||||
$postinfo['rush']['creditlimit'] = '';
|
||||
}
|
||||
$postinfo['rush']['stopfloor'] = $postinfo['rush']['stopfloor'] ? $postinfo['rush']['stopfloor'] : '';
|
||||
$postinfo['rush']['starttimefrom'] = $postinfo['rush']['starttimefrom'] ? dgmdate($postinfo['rush']['starttimefrom'], 'Y-m-d H:i') : '';
|
||||
$postinfo['rush']['starttimeto'] = $postinfo['rush']['starttimeto'] ? dgmdate($postinfo['rush']['starttimeto'], 'Y-m-d H:i') : '';
|
||||
}
|
||||
|
||||
if($special == 127) {
|
||||
$sppos = strpos($postinfo['message'], chr(0).chr(0).chr(0));
|
||||
$specialextra = substr($postinfo['message'], $sppos + 3);
|
||||
if($specialextra && array_key_exists($specialextra, $_G['setting']['threadplugins']) && in_array($specialextra, $_G['forum']['threadplugin']) && in_array($specialextra, $_G['group']['allowthreadplugin'])) {
|
||||
$postinfo['message'] = substr($postinfo['message'], 0, $sppos);
|
||||
} else {
|
||||
showmessage('post_edit_nopermission_threadplign');
|
||||
$special = 0;
|
||||
$specialextra = '';
|
||||
}
|
||||
}
|
||||
$thread['freecharge'] = $_G['setting']['maxchargespan'] && TIMESTAMP - $thread['dateline'] >= $_G['setting']['maxchargespan'] * 3600 ? 1 : 0;
|
||||
$freechargehours = !$thread['freecharge'] ? $_G['setting']['maxchargespan'] - intval((TIMESTAMP - $thread['dateline']) / 3600) : 0;
|
||||
if($thread['special'] == 1 && ($_G['group']['alloweditpoll'] || $thread['authorid'] == $_G['uid'])) {
|
||||
$pollinfo = C::t('forum_poll')->fetch($_G['tid']);
|
||||
if($pollinfo['isimage']) {
|
||||
$pollimages = C::t('forum_polloption_image')->fetch_all_by_tid($_G['tid']);
|
||||
require_once libfile('function/home');
|
||||
}
|
||||
$query = C::t('forum_polloption')->fetch_all_by_tid($_G['tid']);
|
||||
foreach($query as $temppoll) {
|
||||
$poll['multiple'] = $pollinfo['multiple'];
|
||||
$poll['visible'] = $pollinfo['visible'];
|
||||
$poll['maxchoices'] = $pollinfo['maxchoices'];
|
||||
$poll['expiration'] = $pollinfo['expiration'];
|
||||
$poll['overt'] = $pollinfo['overt'];
|
||||
$poll['isimage'] = $pollinfo['isimage'];
|
||||
$poll['polloptionid'][] = $temppoll['polloptionid'];
|
||||
$poll['displayorder'][] = $temppoll['displayorder'];
|
||||
$poll['polloption'][] = $temppoll['polloption'];
|
||||
$attach = array();
|
||||
if($pollinfo['isimage'] && $pollimages[$temppoll['polloptionid']]) {
|
||||
$attach = $pollimages[$temppoll['polloptionid']];
|
||||
$attach['small'] = pic_get($attach['attachment'], 'forum', $attach['thumb'], $attach['remote']);
|
||||
$attach['big'] = pic_get($attach['attachment'], 'forum', 0, $attach['remote']);
|
||||
$poll['imginfo'][$temppoll['polloptionid']] = $attach;
|
||||
}
|
||||
|
||||
}
|
||||
} elseif($thread['special'] == 3) {
|
||||
$rewardprice = $thread['price'];
|
||||
} elseif($thread['special'] == 4) {
|
||||
$activitytypelist = $_G['setting']['activitytype'] ? explode("\n", trim($_G['setting']['activitytype'])) : '';
|
||||
$activity = C::t('forum_activity')->fetch($_G['tid']);
|
||||
$activity['starttimefrom'] = dgmdate($activity['starttimefrom'], 'Y-m-d H:i');
|
||||
$activity['starttimeto'] = $activity['starttimeto'] ? dgmdate($activity['starttimeto'], 'Y-m-d H:i') : '';
|
||||
$activity['expiration'] = $activity['expiration'] ? dgmdate($activity['expiration'], 'Y-m-d H:i') : '';
|
||||
$activity['ufield'] = $activity['ufield'] ? dunserialize($activity['ufield']) : array();
|
||||
if($activity['ufield']['extfield']) {
|
||||
$activity['ufield']['extfield'] = implode("\n", $activity['ufield']['extfield']);
|
||||
}
|
||||
} elseif($thread['special'] == 5 ) {
|
||||
$debate['endtime'] = $debate['endtime'] ? dgmdate($debate['endtime'], 'Y-m-d H:i') : '';
|
||||
}
|
||||
if ($_G['group']['allowsetpublishdate']) {
|
||||
loadcache('cronpublish');
|
||||
$cron_publish_ids = getglobal('cache/cronpublish');
|
||||
if (in_array($_G['tid'], (array)$cron_publish_ids)) {
|
||||
$cronpublish = 1;
|
||||
$cronpublishdate = dgmdate($thread['dateline'], "dt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($thread['special'] == 2 && ($thread['authorid'] == $_G['uid'] && $_G['group']['allowposttrade'] || $_G['group']['allowedittrade'])) {
|
||||
$trade = C::t('forum_trade')->fetch_goods(0, $pid);
|
||||
if($trade) {
|
||||
$trade['expiration'] = $trade['expiration'] ? date('Y-m-d', $trade['expiration']) : '';
|
||||
$trade['costprice'] = $trade['costprice'] > 0 ? $trade['costprice'] : '';
|
||||
$trade['message'] = dhtmlspecialchars($trade['message']);
|
||||
$expiration_7days = date('Y-m-d', TIMESTAMP + 86400 * 7);
|
||||
$expiration_14days = date('Y-m-d', TIMESTAMP + 86400 * 14);
|
||||
$expiration_month = date('Y-m-d', mktime(0, 0, 0, date('m')+1, date('d'), date('Y')));
|
||||
$expiration_3months = date('Y-m-d', mktime(0, 0, 0, date('m')+3, date('d'), date('Y')));
|
||||
$expiration_halfyear = date('Y-m-d', mktime(0, 0, 0, date('m')+6, date('d'), date('Y')));
|
||||
$expiration_year = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y')+1));
|
||||
} else {
|
||||
$special = 0;
|
||||
$trade = array();
|
||||
}
|
||||
}
|
||||
|
||||
if($isfirstpost && $specialextra) {
|
||||
@include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
|
||||
$classname = 'threadplugin_'.$specialextra;
|
||||
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'editpost')) {
|
||||
$threadplughtml = $threadpluginclass->editpost($_G['fid'], $_G['tid']);
|
||||
}
|
||||
}
|
||||
|
||||
$postinfo['subject'] = str_replace('"', '"', $postinfo['subject']);
|
||||
$postinfo['message'] = dhtmlspecialchars($postinfo['message']);
|
||||
$selectgroupid = 0;
|
||||
if($postinfo['first'] == 1) {
|
||||
preg_match("/(\[groupid=(\d+)\].*\[\/groupid\])/i", $postinfo['message'], $matchs);
|
||||
if($matchs) {
|
||||
$postinfo['message'] = str_replace($matchs[1], '', $postinfo['message']);
|
||||
$selectgroupid = $matchs[2];
|
||||
}
|
||||
|
||||
if(helper_access::check_module('group')) {
|
||||
$mygroups = $groupids = array();
|
||||
$groupids = C::t('forum_groupuser')->fetch_all_fid_by_uids($_G['uid']);
|
||||
array_slice($groupids, 0, 20);
|
||||
$query = C::t('forum_forum')->fetch_all_info_by_fids($groupids);
|
||||
foreach($query as $group) {
|
||||
$mygroups[$group['fid']] = $group['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$language = lang('forum/misc');
|
||||
$postinfo['message'] = preg_replace($postinfo['htmlon'] ? $language['post_edithtml_regexp'] : (!$_G['forum']['allowbbcode'] || $postinfo['bbcodeoff'] ? $language['post_editnobbcode_regexp'] : $language['post_edit_regexp']), '', $postinfo['message']);
|
||||
|
||||
if($special == 5) {
|
||||
$standselected = array($firststand => 'selected="selected"');
|
||||
}
|
||||
|
||||
if($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) {
|
||||
$attachlist = getattach($pid);
|
||||
$attachs = $attachlist['attachs'];
|
||||
$imgattachs = $attachlist['imgattachs'];
|
||||
unset($attachlist);
|
||||
$attachfind = $attachreplace = array();
|
||||
if(!empty($attachs['used'])) {
|
||||
foreach($attachs['used'] as $attach) {
|
||||
if($attach['isimage']) {
|
||||
$attachfind[] = "/\[attach\]{$attach['aid']}\[\/attach\]/i";
|
||||
$attachreplace[] = '[attachimg]'.$attach['aid'].'[/attachimg]';
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!empty($imgattachs['used'])) {
|
||||
foreach($imgattachs['used'] as $attach) {
|
||||
$attachfind[] = "/\[attach\]{$attach['aid']}\[\/attach\]/i";
|
||||
$attachreplace[] = '[attachimg]'.$attach['aid'].'[/attachimg]';
|
||||
}
|
||||
}
|
||||
$attachfind && $postinfo['message'] = preg_replace($attachfind, $attachreplace, $postinfo['message']);
|
||||
}
|
||||
if($special == 2 && $trade['aid'] && !empty($imgattachs['used']) && is_array($imgattachs['used'])) {
|
||||
foreach($imgattachs['used'] as $k => $tradeattach) {
|
||||
if($tradeattach['aid'] == $trade['aid']) {
|
||||
unset($imgattachs['used'][$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($special == 4 && $activity['aid'] && !empty($imgattachs['used']) && is_array($imgattachs['used'])) {
|
||||
foreach($imgattachs['used'] as $k => $activityattach) {
|
||||
if($activityattach['aid'] == $activity['aid']) {
|
||||
unset($imgattachs['used'][$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($sortid) {
|
||||
require_once libfile('post/threadsorts', 'include');
|
||||
foreach($_G['forum_optionlist'] as $option) {
|
||||
if($option['type'] == 'image') {
|
||||
foreach($imgattachs['used'] as $k => $sortattach) {
|
||||
if($sortattach['aid'] == $option['value']['aid']) {
|
||||
unset($imgattachs['used'][$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$imgattachs['unused'] = !$sortid ? (isset($imgattachs['unused']) ? $imgattachs['unused'] : '') : '';
|
||||
|
||||
include template('forum/post');
|
||||
|
||||
} else {
|
||||
if($_GET['mygroupid']) {
|
||||
$mygroupid = explode('__', $_GET['mygroupid']);
|
||||
$mygid = intval($mygroupid[0]);
|
||||
if($mygid) {
|
||||
$mygname = $mygroupid[1];
|
||||
if(count($mygroupid) > 2) {
|
||||
unset($mygroupid[0]);
|
||||
$mygname = implode('__', $mygroupid);
|
||||
}
|
||||
$message .= '[groupid='.intval($mygid).']'.$mygname.'[/groupid]';
|
||||
}
|
||||
}
|
||||
$modpost = C::m('forum_post', $_G['tid'], $pid);
|
||||
|
||||
$modpost->param('redirecturl', "forum.php?mod=viewthread&tid={$_G['tid']}&page={$_GET['page']}&extra=$extra".($vid && $isfirstpost ? "&vid=$vid" : '')."#pid$pid");
|
||||
|
||||
if(empty($_GET['delete'])) {
|
||||
|
||||
|
||||
if($isfirstpost) {
|
||||
|
||||
|
||||
if($thread['special'] == 1 && ($_G['group']['alloweditpoll'] || $isorigauthor) && !empty($_GET['polls'])) {
|
||||
|
||||
} elseif($thread['special'] == 3 && $isorigauthor) {
|
||||
|
||||
|
||||
} elseif($thread['special'] == 4 && $_G['group']['allowpostactivity']) {
|
||||
|
||||
|
||||
} elseif($thread['special'] == 5 && $_G['group']['allowpostdebate']) {
|
||||
|
||||
|
||||
} elseif($specialextra) {
|
||||
|
||||
@include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
|
||||
$classname = 'threadplugin_'.$specialextra;
|
||||
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'editpost_submit')) {
|
||||
$threadpluginclass->editpost_submit($_G['fid'], $_G['tid']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$feed = array();
|
||||
if($isfirstpost && $special == 127) {
|
||||
$message .= chr(0).chr(0).chr(0).$specialextra;
|
||||
}
|
||||
|
||||
|
||||
if($isfirstpost) {
|
||||
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_sort', 'method' => 'before_editpost'));
|
||||
if($thread['special'] == 3) {
|
||||
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_reward', 'method' => 'before_editpost'));
|
||||
}
|
||||
if($thread['special'] == 1) {
|
||||
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_poll', 'method' => 'before_editpost'));
|
||||
}
|
||||
if($thread['special'] == 4 && $_G['group']['allowpostactivity']) {
|
||||
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_activity', 'method' => 'before_editpost'));
|
||||
}
|
||||
if($thread['special'] == 5 && $_G['group']['allowpostdebate']) {
|
||||
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_debate', 'method' => 'before_editpost'));
|
||||
}
|
||||
if($_G['group']['allowreplycredit']) {
|
||||
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_replycredit', 'method' => 'before_editpost'));
|
||||
}
|
||||
if($rushreply) {
|
||||
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_rushreply', 'method' => 'before_editpost'));
|
||||
}
|
||||
$modpost->attach_after_method('editpost', array('class' => 'extend_thread_follow', 'method' => 'after_editpost'));
|
||||
}
|
||||
|
||||
if($_G['group']['allowat']) {
|
||||
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_allowat', 'method' => 'before_editpost'));
|
||||
$modpost->attach_after_method('editpost', array('class' => 'extend_thread_allowat', 'method' => 'after_editpost'));
|
||||
}
|
||||
|
||||
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_image', 'method' => 'before_editpost'));
|
||||
|
||||
if($special == '2' && $_G['group']['allowposttrade']) {
|
||||
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_trade', 'method' => 'before_editpost'));
|
||||
}
|
||||
|
||||
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_filter', 'method' => 'before_editpost'));
|
||||
$modpost->attach_after_method('editpost', array('class' => 'extend_thread_filter', 'method' => 'after_editpost'));
|
||||
|
||||
$param = array(
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
'special' => $special,
|
||||
'sortid' => $sortid,
|
||||
'typeid' => $typeid,
|
||||
'isanonymous' => $isanonymous,
|
||||
|
||||
'cronpublish' => $_GET['cronpublish'],
|
||||
'cronpublishdate' => $_GET['cronpublishdate'],
|
||||
'save' => $_GET['save'],
|
||||
|
||||
'readperm' => $readperm,
|
||||
'price' => $_GET['price'],
|
||||
|
||||
'ordertype' => $_GET['ordertype'],
|
||||
'hiddenreplies' => $_GET['hiddenreplies'],
|
||||
'allownoticeauthor' => $_GET['allownoticeauthor'],
|
||||
|
||||
'audit' => $_GET['audit'],
|
||||
|
||||
'tags' => $_GET['tags'],
|
||||
|
||||
'bbcodeoff' => $_GET['bbcodeoff'],
|
||||
'smileyoff' => $_GET['smileyoff'],
|
||||
'parseurloff' => $_GET['parseurloff'],
|
||||
'usesig' => $_GET['usesig'],
|
||||
'htmlon' => $_GET['htmlon'],
|
||||
|
||||
'extramessage' => $extramessage,
|
||||
);
|
||||
|
||||
if($_G['group']['allowimgcontent']) {
|
||||
$param['imgcontent'] = $_GET['imgcontent'];
|
||||
$param['imgcontentwidth'] = $_G['setting']['imgcontentwidth'] ? intval($_G['setting']['imgcontentwidth']) : 100;
|
||||
}
|
||||
if($isfirstpost && $isorigauthor && $_G['group']['allowreplycredit']) {
|
||||
$param['replycredit_rule'] = $replycredit_rule;
|
||||
}
|
||||
|
||||
$modpost->editpost($param);
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if($thread['special'] == 3) {
|
||||
$modpost->attach_before_method('deletepost', array('class' => 'extend_thread_reward', 'method' => 'before_deletepost'));
|
||||
}
|
||||
if($rushreply) {
|
||||
$modpost->attach_before_method('deletepost', array('class' => 'extend_thread_rushreply', 'method' => 'before_deletepost'));
|
||||
}
|
||||
if($thread['replycredit'] && $isfirstpost) {
|
||||
$modpost->attach_before_method('deletepost', array('class' => 'extend_thread_replycredit', 'method' => 'before_deletepost'));
|
||||
}
|
||||
|
||||
$modpost->attach_before_method('deletepost', array('class' => 'extend_thread_image', 'method' => 'before_deletepost'));
|
||||
|
||||
if($thread['special'] == 2) {
|
||||
$modpost->attach_after_method('deletepost', array('class' => 'extend_thread_trade', 'method' => 'after_deletepost'));
|
||||
}
|
||||
if($isfirstpost) {
|
||||
$modpost->attach_after_method('deletepost', array('class' => 'extend_thread_sort', 'method' => 'after_deletepost'));
|
||||
}
|
||||
|
||||
$modpost->attach_after_method('deletepost', array('class' => 'extend_thread_filter', 'method' => 'after_deletepost'));
|
||||
|
||||
$param = array(
|
||||
'special' => $special,
|
||||
'isanonymous' => $isanonymous,
|
||||
);
|
||||
|
||||
$modpost->deletepost($param);
|
||||
}
|
||||
|
||||
if($specialextra) {
|
||||
|
||||
@include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
|
||||
$classname = 'threadplugin_'.$specialextra;
|
||||
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'editpost_submit_end')) {
|
||||
$threadpluginclass->editpost_submit_end($_G['fid'], $_G['tid']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($_G['forum']['threadcaches']) {
|
||||
deletethreadcaches($_G['tid']);
|
||||
}
|
||||
|
||||
$param = array('fid' => $_G['fid'], 'tid' => $_G['tid'], 'pid' => $pid);
|
||||
|
||||
dsetcookie('clearUserdata', 'forum');
|
||||
|
||||
if($_G['forum_auditstatuson']) {
|
||||
if($audit == 1) {
|
||||
updatemoderate($isfirstpost ? 'tid' : 'pid', $isfirstpost ? $_G['tid'] : $pid, '2');
|
||||
showmessage('auditstatuson_succeed', $modpost->param('redirecturl'), $param);
|
||||
} else {
|
||||
updatemoderate($isfirstpost ? 'tid' : 'pid', $isfirstpost ? $_G['tid'] : $pid);
|
||||
showmessage('audit_edit_succeed', '', $param, array('alert' => 'right'));
|
||||
}
|
||||
} else {
|
||||
if(!empty($_GET['delete']) && $isfirstpost) {
|
||||
showmessage('post_edit_delete_succeed', "forum.php?mod=forumdisplay&fid={$_G['fid']}", $param);
|
||||
} elseif(!empty($_GET['delete'])) {
|
||||
showmessage('post_edit_delete_succeed', "forum.php?mod=viewthread&tid={$_G['tid']}&page={$_GET['page']}&extra=$extra".($vid && $isfirstpost ? "&vid=$vid" : ''), $param);
|
||||
} else {
|
||||
if($isfirstpost && $modpost->param('modnewthreads')) {
|
||||
C::t('forum_post')->update_post($thread['posttableid'], $pid, array('status' => 4), false, false, null, -2, null, 0);
|
||||
updatemoderate('tid', $_G['tid']);
|
||||
showmessage('edit_newthread_mod_succeed', $modpost->param('redirecturl'), $param);
|
||||
} elseif(!$isfirstpost && $modpost->param('modnewreplies')) {
|
||||
C::t('forum_post')->update_post($thread['posttableid'], $pid, array('status' => 4), false, false, null, -2, null, 0);
|
||||
updatemoderate('pid', $pid);
|
||||
showmessage('edit_reply_mod_succeed', "forum.php?mod=forumdisplay&fid={$_G['fid']}", $param);
|
||||
} else {
|
||||
showmessage('post_edit_succeed', $modpost->param('redirecturl'), $param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
464
source/include/post/post_newreply.php
Normal file
464
source/include/post/post_newreply.php
Normal file
@@ -0,0 +1,464 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: post_newreply.php 33709 2013-08-06 09:06:56Z andyzheng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
require_once libfile('function/forumlist');
|
||||
|
||||
$isfirstpost = 0;
|
||||
$_G['group']['allowimgcontent'] = 0;
|
||||
$showthreadsorts = 0;
|
||||
$quotemessage = '';
|
||||
|
||||
if($special == 5) {
|
||||
$debate = array_merge($thread, daddslashes(C::t('forum_debate')->fetch($_G['tid'])));
|
||||
$firststand = C::t('forum_debatepost')->get_firststand($_G['tid'], $_G['uid']);
|
||||
$stand = $firststand ? $firststand : intval($_GET['stand']);
|
||||
|
||||
if($debate['endtime'] && $debate['endtime'] < TIMESTAMP) {
|
||||
showmessage('debate_end');
|
||||
}
|
||||
}
|
||||
|
||||
if(!$_G['uid'] && !((!$_G['forum']['replyperm'] && $_G['group']['allowreply']) || ($_G['forum']['replyperm'] && forumperm($_G['forum']['replyperm'])))) {
|
||||
showmessage('replyperm_login_nopermission', NULL, array(), array('login' => 1));
|
||||
} elseif(empty($_G['forum']['allowreply'])) {
|
||||
if(!$_G['forum']['replyperm'] && !$_G['group']['allowreply']) {
|
||||
showmessage('replyperm_none_nopermission', NULL, array(), array('login' => 1));
|
||||
} elseif($_G['forum']['replyperm'] && !forumperm($_G['forum']['replyperm'])) {
|
||||
showmessagenoperm('replyperm', $_G['forum']['fid']);
|
||||
}
|
||||
} elseif($_G['forum']['allowreply'] == -1) {
|
||||
showmessage('post_forum_newreply_nopermission', NULL);
|
||||
}
|
||||
|
||||
if(!$_G['uid'] && ($_G['setting']['need_avatar'] || $_G['setting']['need_secmobile'] || $_G['setting']['need_email'] || $_G['setting']['need_friendnum'])) {
|
||||
showmessage('replyperm_login_nopermission', NULL, array(), array('login' => 1));
|
||||
}
|
||||
|
||||
if(empty($thread)) {
|
||||
showmessage('thread_nonexistence');
|
||||
} elseif($thread['price'] > 0 && $thread['special'] == 0 && !$_G['uid']) {
|
||||
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
|
||||
} elseif($thread['readperm'] && $thread['readperm'] > $_G['group']['readaccess'] && $thread['authorid'] != $_G['uid']){ //readperm verify, thread poster excluded
|
||||
showmessagenoperm('replyperm', $_G['forum']['fid']);
|
||||
}
|
||||
|
||||
checklowerlimit('reply', 0, 1, $_G['forum']['fid']);
|
||||
|
||||
if($_G['setting']['commentnumber'] && !empty($_GET['comment'])) {
|
||||
if(!submitcheck('commentsubmit', 0, $seccodecheck, $secqaacheck)) {
|
||||
showmessage('submitcheck_error', NULL);
|
||||
}
|
||||
$post = C::t('forum_post')->fetch_post('tid:'.$_G['tid'], $_GET['pid']);
|
||||
if(!$post || !($_G['setting']['commentpostself'] || $post['authorid'] != $_G['uid']) || !(($post['first'] && $_G['setting']['commentfirstpost'] && in_array($_G['group']['allowcommentpost'], array(1, 3)) || (!$post['first'] && in_array($_G['group']['allowcommentpost'], array(2, 3)))))) {
|
||||
showmessage('postcomment_error');
|
||||
}
|
||||
if($thread['closed'] && !$_G['forum']['ismoderator'] && !$thread['isgroup']) {
|
||||
showmessage('post_thread_closed');
|
||||
} elseif(!$thread['isgroup'] && $post_autoclose = checkautoclose($thread)) {
|
||||
showmessage($post_autoclose, '', array('autoclose' => $_G['forum']['autoclose']));
|
||||
} elseif(checkflood()) {
|
||||
showmessage('post_flood_ctrl', '', array('floodctrl' => $_G['setting']['floodctrl']));
|
||||
} elseif(checkmaxperhour('pid')) {
|
||||
showmessage('post_flood_ctrl_posts_per_hour', '', array('posts_per_hour' => $_G['group']['maxpostsperhour']));
|
||||
}
|
||||
$commentscore = '';
|
||||
if(!empty($_GET['commentitem']) && !empty($_G['uid']) && $post['authorid'] != $_G['uid']) {
|
||||
foreach($_GET['commentitem'] as $itemk => $itemv) {
|
||||
if($itemv !== '') {
|
||||
$commentscore .= strip_tags(trim($itemk)).': <i>'.intval($itemv).'</i> ';
|
||||
}
|
||||
}
|
||||
}
|
||||
$comment = cutstr(($commentscore ? $commentscore.'<br />' : '').censor(trim(dhtmlspecialchars($_GET['message'])), '***'), 200, ' ');
|
||||
if(!$comment) {
|
||||
showmessage('post_sm_isnull');
|
||||
}
|
||||
$pcid = C::t('forum_postcomment')->insert(array(
|
||||
'tid' => $post['tid'],
|
||||
'pid' => $post['pid'],
|
||||
'author' => $_G['username'],
|
||||
'authorid' => $_G['uid'],
|
||||
'dateline' => TIMESTAMP,
|
||||
'comment' => $comment,
|
||||
'score' => $commentscore ? 1 : 0,
|
||||
'useip' => $_G['clientip'],
|
||||
'port'=> $_G['remoteport']
|
||||
), true);
|
||||
C::t('forum_post')->update_post('tid:'.$_G['tid'], $_GET['pid'], array('comment' => 1));
|
||||
|
||||
$comments = $thread['comments'] ? $thread['comments'] + 1 : C::t('forum_postcomment')->count_by_tid($_G['tid']);
|
||||
C::t('forum_thread')->update($_G['tid'], array('comments' => $comments));
|
||||
!empty($_G['uid']) && $thread['displayorder'] != -4 && updatepostcredits('+', $_G['uid'], 'reply', $_G['fid']);
|
||||
if(!empty($_G['uid']) && $_G['uid'] != $post['authorid']) {
|
||||
notification_add($post['authorid'], 'pcomment', 'comment_add', array(
|
||||
'tid' => $_G['tid'],
|
||||
'pid' => $_GET['pid'],
|
||||
'subject' => $thread['subject'],
|
||||
'from_id' => $_G['tid'],
|
||||
'from_idtype' => 'pcomment',
|
||||
'commentmsg' => cutstr(str_replace(array('[b]', '[/b]', '[/color]'), '', preg_replace("/\[color=([#\w]+?)\]/i", "", $comment)), 200)
|
||||
));
|
||||
}
|
||||
update_threadpartake($post['tid']);
|
||||
$pcid = C::t('forum_postcomment')->fetch_standpoint_by_pid($_GET['pid']);
|
||||
$pcid = $pcid['id'];
|
||||
if(!empty($_G['uid']) && $_GET['commentitem']) {
|
||||
$totalcomment = array();
|
||||
foreach(C::t('forum_postcomment')->fetch_all_by_pid_score($_GET['pid'], 1) as $comment) {
|
||||
$comment['comment'] = addslashes($comment['comment']);
|
||||
if(strexists($comment['comment'], '<br />')) {
|
||||
if(preg_match_all("/([^:]+?):\s<i>(\d+)<\/i>/", $comment['comment'], $a)) {
|
||||
foreach($a[1] as $k => $itemk) {
|
||||
$totalcomment[trim($itemk)][] = $a[2][$k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$totalv = '';
|
||||
foreach($totalcomment as $itemk => $itemv) {
|
||||
$totalv .= strip_tags(trim($itemk)).': <i>'.(floatval(sprintf('%1.1f', array_sum($itemv) / count($itemv)))).'</i> ';
|
||||
}
|
||||
|
||||
if($pcid) {
|
||||
C::t('forum_postcomment')->update($pcid, array('comment' => $totalv, 'dateline' => TIMESTAMP + 1));
|
||||
} else {
|
||||
C::t('forum_postcomment')->insert(array(
|
||||
'tid' => $post['tid'],
|
||||
'pid' => $post['pid'],
|
||||
'author' => '',
|
||||
'authorid' => '-1',
|
||||
'dateline' => TIMESTAMP + 1,
|
||||
'comment' => $totalv
|
||||
));
|
||||
}
|
||||
}
|
||||
C::t('forum_postcache')->delete($post['pid']);
|
||||
showmessage('comment_add_succeed', "forum.php?mod=viewthread&tid={$post['tid']}&pid={$post['pid']}&page={$_GET['page']}&extra=$extra#pid{$post['pid']}", array('tid' => $post['tid'], 'pid' => $post['pid']));
|
||||
}
|
||||
|
||||
if($special == 127) {
|
||||
$postinfo = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['tid']);
|
||||
$sppos = strrpos($postinfo['message'], chr(0).chr(0).chr(0));
|
||||
$specialextra = substr($postinfo['message'], $sppos + 3);
|
||||
}
|
||||
if(getstatus($thread['status'], 3)) {
|
||||
$rushinfo = C::t('forum_threadrush')->fetch($_G['tid']);
|
||||
if($rushinfo['creditlimit'] != -996) {
|
||||
$checkcreditsvalue = $_G['setting']['creditstransextra'][11] ? getuserprofile('extcredits'.$_G['setting']['creditstransextra'][11]) : $_G['member']['credits'];
|
||||
if($checkcreditsvalue < $rushinfo['creditlimit']) {
|
||||
$creditlimit_title = $_G['setting']['creditstransextra'][11] ? $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][11]]['title'] : lang('forum/misc', 'credit_total');
|
||||
showmessage('post_rushreply_creditlimit', '', array('creditlimit_title' => $creditlimit_title, 'creditlimit' => $rushinfo['creditlimit']));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!submitcheck('replysubmit', 0, $seccodecheck, $secqaacheck)) {
|
||||
|
||||
$st_p = $_G['uid'].'|'.TIMESTAMP;
|
||||
dsetcookie('st_p', $st_p.'|'.md5($st_p.$_G['config']['security']['authkey']));
|
||||
|
||||
if($thread['special'] == 2 && ((!isset($_GET['addtrade']) || $thread['authorid'] != $_G['uid']) && !$tradenum = C::t('forum_trade')->fetch_counter_thread_goods($_G['tid']))) {
|
||||
showmessage('trade_newreply_nopermission', NULL);
|
||||
}
|
||||
|
||||
$language = lang('forum/misc');
|
||||
$noticeauthor = $noticetrimstr = '';
|
||||
if(isset($_GET['repquote']) && $_GET['repquote'] = intval($_GET['repquote'])) {
|
||||
$thaquote = C::t('forum_post')->fetch_post('tid:'.$_G['tid'], $_GET['repquote']);
|
||||
if(!($thaquote && ($thaquote['invisible'] == 0 || $thaquote['authorid'] == $_G['uid'] && $thaquote['invisible'] == -2))) {
|
||||
$thaquote = array();
|
||||
}
|
||||
if($thaquote['tid'] != $_G['tid']) {
|
||||
showmessage('reply_quotepost_error', NULL);
|
||||
}
|
||||
|
||||
if(getstatus($thread['status'], 2) && $thaquote['authorid'] != $_G['uid'] && $_G['uid'] != $thread['authorid'] && $thaquote['first'] != 1 && !$_G['forum']['ismoderator']) {
|
||||
showmessage('reply_quotepost_error', NULL);
|
||||
}
|
||||
|
||||
if(!($thread['price'] && !$thread['special'] && $thaquote['first'])) {
|
||||
$quotefid = $thaquote['fid'];
|
||||
$message = $thaquote['message'];
|
||||
|
||||
if(strpos($message, '[/password]') !== FALSE) {
|
||||
$message = '';
|
||||
}
|
||||
|
||||
if($_G['setting']['bannedmessages'] && $thaquote['authorid']) {
|
||||
$author = getuserbyuid($thaquote['authorid']);
|
||||
if(!$author['groupid'] || $author['groupid'] == 4 || $author['groupid'] == 5) {
|
||||
$message = $language['post_banned'];
|
||||
} elseif($thaquote['status'] & 1) {
|
||||
$message = $language['post_single_banned'];
|
||||
}
|
||||
}
|
||||
|
||||
$time = dgmdate($thaquote['dateline']);
|
||||
$message = messagecutstr($message, 100);
|
||||
$message = implode("\n", array_slice(explode("\n", $message), 0, 3));
|
||||
|
||||
$thaquote['useip'] = substr($thaquote['useip'], 0, strrpos($thaquote['useip'], '.')).'.x';
|
||||
if($thaquote['author'] && $thaquote['anonymous']) {
|
||||
$thaquote['author'] = lang('forum/misc', 'anonymoususer');
|
||||
} elseif(!$thaquote['author']) {
|
||||
$thaquote['author'] = lang('forum/misc', 'guestuser').' '.$thaquote['useip'];
|
||||
} else {
|
||||
$thaquote['author'] = $thaquote['author'];
|
||||
}
|
||||
|
||||
$post_reply_quote = lang('forum/misc', 'post_reply_quote', array('author' => $thaquote['author'], 'time' => $time));
|
||||
$noticeauthormsg = dhtmlspecialchars($message);
|
||||
if(!defined('IN_MOBILE')) {
|
||||
$message = "[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid={$_GET['repquote']}&ptid={$_G['tid']}][color=#999999]{$post_reply_quote}[/color][/url][/size]\n{$message}[/quote]";
|
||||
} else {
|
||||
$message = "[quote][color=#999999]{$post_reply_quote}[/color]\n[color=#999999]{$message}[/color][/quote]";
|
||||
}
|
||||
$quotemessage = discuzcode($message, 0, 0);
|
||||
$noticeauthor = dhtmlspecialchars(authcode('q|'.$thaquote['authorid'], 'ENCODE'));
|
||||
$noticetrimstr = dhtmlspecialchars($message);
|
||||
$message = '';
|
||||
}
|
||||
$reppid = $_GET['repquote'];
|
||||
|
||||
} elseif(isset($_GET['reppost']) && $_GET['reppost'] = intval($_GET['reppost'])) {
|
||||
$thapost = C::t('forum_post')->fetch_post('tid:'.$_G['tid'], $_GET['reppost']);
|
||||
if(!($thapost && ($thapost['invisible'] == 0 || $thapost['authorid'] == $_G['uid'] && $thapost['invisible'] == -2))) {
|
||||
$thapost = array();
|
||||
}
|
||||
if($thapost['tid'] != $_G['tid']) {
|
||||
showmessage('targetpost_donotbelongto_thisthread', NULL);
|
||||
}
|
||||
|
||||
$thapost['useip'] = substr($thapost['useip'], 0, strrpos($thapost['useip'], '.')).'.x';
|
||||
if($thapost['author'] && $thapost['anonymous']) {
|
||||
$thapost['author'] = '[color=Olive]'.lang('forum/misc', 'anonymoususer').'[/color]';
|
||||
} elseif(!$thapost['author']) {
|
||||
$thapost['author'] = '[color=Olive]'.lang('forum/misc', 'guestuser').'[/color] '.$thapost['useip'];
|
||||
} else {
|
||||
$thapost['author'] = '[color=Olive]'.$thapost['author'].'[/color]';
|
||||
}
|
||||
$quotemessage = discuzcode($message, 0, 0);
|
||||
$noticeauthormsg = dhtmlspecialchars(messagecutstr($thapost['message'], 100));
|
||||
$noticeauthor = dhtmlspecialchars(authcode('r|'.$thapost['authorid'], 'ENCODE'));
|
||||
$noticetrimstr = dhtmlspecialchars($message);
|
||||
$message = '';
|
||||
$reppid = $_GET['reppost'];
|
||||
}
|
||||
|
||||
if(isset($_GET['addtrade']) && $thread['special'] == 2 && $_G['group']['allowposttrade'] && $thread['authorid'] == $_G['uid']) {
|
||||
$expiration_7days = date('Y-m-d', TIMESTAMP + 86400 * 7);
|
||||
$expiration_14days = date('Y-m-d', TIMESTAMP + 86400 * 14);
|
||||
$trade['expiration'] = $expiration_month = date('Y-m-d', mktime(0, 0, 0, date('m')+1, date('d'), date('Y')));
|
||||
$expiration_3months = date('Y-m-d', mktime(0, 0, 0, date('m')+3, date('d'), date('Y')));
|
||||
$expiration_halfyear = date('Y-m-d', mktime(0, 0, 0, date('m')+6, date('d'), date('Y')));
|
||||
$expiration_year = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y')+1));
|
||||
}
|
||||
|
||||
if($thread['replies'] <= $_G['ppp']) {
|
||||
$postlist = array();
|
||||
if($thread['price'] > 0 && $thread['special'] == 0) {
|
||||
$postlist = C::t('forum_post')->fetch_all_by_tid('tid:'.$_G['tid'], $_G['tid'], true, 'DESC', 0, 0, 0, 0);
|
||||
} else {
|
||||
$postlist = C::t('forum_post')->fetch_all_by_tid('tid:'.$_G['tid'], $_G['tid'], true, 'DESC', 0, 0, null, 0);
|
||||
}
|
||||
if($_G['setting']['bannedmessages']) {
|
||||
$uids = array();
|
||||
foreach($postlist as $post) {
|
||||
$uids[] = $post['authorid'];
|
||||
}
|
||||
$users = C::t('common_member')->fetch_all($uids);
|
||||
}
|
||||
foreach($postlist as $k => $post) {
|
||||
|
||||
$post['dateline'] = dgmdate($post['dateline'], 'u');
|
||||
|
||||
if($_G['setting']['bannedmessages'] && ($post['authorid'] && (empty($post['groupid']) || $post['groupid'] == 4 || $post['groupid'] == 5))) {
|
||||
$post['message'] = $language['post_banned'];
|
||||
} elseif($post['status'] & 1) {
|
||||
$post['message'] = $language['post_single_banned'];
|
||||
} else {
|
||||
$post['message'] = preg_replace("/\[hide=?\d*\](.*?)\[\/hide\]/is", "[b]{$language['post_hidden']}[/b]", $post['message']);
|
||||
$post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $_G['forum']['allowsmilies'], $_G['forum']['allowbbcode'], $_G['forum']['allowimgcode'], $_G['forum']['allowhtml'], $_G['forum']['jammer']);
|
||||
}
|
||||
|
||||
if($_G['setting']['bannedmessages']) {
|
||||
$post['groupid'] = $users[$post['authorid']]['groupid'];
|
||||
}
|
||||
|
||||
$postlist[$k] = $post;
|
||||
}
|
||||
}
|
||||
unset($uids, $users);
|
||||
|
||||
if($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) {
|
||||
$attachlist = getattach(0);
|
||||
$attachs = $attachlist['attachs'];
|
||||
$imgattachs = $attachlist['imgattachs'];
|
||||
unset($attachlist);
|
||||
}
|
||||
|
||||
getgpc('infloat') ? include template('forum/post_infloat') : include template('forum/post');
|
||||
|
||||
} else {
|
||||
|
||||
$modpost = C::m('forum_post', $_G['tid']);
|
||||
$bfmethods = $afmethods = array();
|
||||
|
||||
|
||||
$params = array(
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
'special' => $special,
|
||||
'extramessage' => isset($extramessage) ? $extramessage : '',
|
||||
'bbcodeoff' => getgpc('bbcodeoff'),
|
||||
'smileyoff' => getgpc('smileyoff'),
|
||||
'htmlon' => getgpc('htmlon'),
|
||||
'parseurloff' => getgpc('parseurloff'),
|
||||
'usesig' => getgpc('usesig'),
|
||||
'isanonymous' => getgpc('isanonymous'),
|
||||
'noticetrimstr' => getgpc('noticetrimstr'),
|
||||
'noticeauthor' => getgpc('noticeauthor'),
|
||||
'from' => getgpc('from'),
|
||||
'sechash' => getgpc('sechash'),
|
||||
'geoloc' => diconv(getgpc('geoloc'), 'UTF-8'),
|
||||
);
|
||||
|
||||
|
||||
if(!empty($_GET['trade']) && $thread['special'] == 2 && $_G['group']['allowposttrade']) {
|
||||
$bfmethods[] = array('class' => 'extend_thread_trade', 'method' => 'before_newreply');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$attentionon = empty($_GET['attention_add']) ? 0 : 1;
|
||||
$attentionoff = empty($attention_remove) ? 0 : 1;
|
||||
$bfmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'before_newreply');
|
||||
if($_G['group']['allowat']) {
|
||||
$bfmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'before_newreply');
|
||||
}
|
||||
|
||||
$bfmethods[] = array('class' => 'extend_thread_comment', 'method' => 'before_newreply');
|
||||
$modpost->attach_before_method('newreply', array('class' => 'extend_thread_filter', 'method' => 'before_newreply'));
|
||||
|
||||
|
||||
|
||||
if($_G['group']['allowat']) {
|
||||
$afmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'after_newreply');
|
||||
}
|
||||
|
||||
|
||||
$afmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'after_newreply');
|
||||
|
||||
|
||||
|
||||
$afmethods[] = array('class' => 'extend_thread_comment', 'method' => 'after_newreply');
|
||||
|
||||
|
||||
|
||||
if(helper_access::check_module('follow') && !empty($_GET['adddynamic'])) {
|
||||
$afmethods[] = array('class' => 'extend_thread_follow', 'method' => 'after_newreply');
|
||||
}
|
||||
|
||||
|
||||
if($thread['replycredit'] > 0 && $thread['authorid'] != $_G['uid'] && $_G['uid']) {
|
||||
$afmethods[] = array('class' => 'extend_thread_replycredit', 'method' => 'after_newreply');
|
||||
}
|
||||
|
||||
|
||||
if($special == 5) {
|
||||
$afmethods[] = array('class' => 'extend_thread_debate', 'method' => 'after_newreply');
|
||||
}
|
||||
|
||||
|
||||
|
||||
$afmethods[] = array('class' => 'extend_thread_image', 'method' => 'after_newreply');
|
||||
|
||||
|
||||
|
||||
if($special == 2 && $_G['group']['allowposttrade'] && $thread['authorid'] == $_G['uid']) {
|
||||
$afmethods[] = array('class' => 'extend_thread_trade', 'method' => 'after_newreply');
|
||||
}
|
||||
$afmethods[] = array('class' => 'extend_thread_filter', 'method' => 'after_newreply');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if($_G['forum']['allowfeed']) {
|
||||
if($special == 2 && !empty($_GET['trade'])) {
|
||||
$modpost->attach_before_method('replyfeed', array('class' => 'extend_thread_trade', 'method' => 'before_replyfeed'));
|
||||
$modpost->attach_after_method('replyfeed', array('class' => 'extend_thread_trade', 'method' => 'after_replyfeed'));
|
||||
} elseif($special == 3 && $thread['authorid'] != $_G['uid']) {
|
||||
$modpost->attach_before_method('replyfeed', array('class' => 'extend_thread_reward', 'method' => 'before_replyfeed'));
|
||||
} elseif($special == 5 && $thread['authorid'] != $_G['uid']) {
|
||||
$modpost->attach_before_method('replyfeed', array('class' => 'extend_thread_debate', 'method' => 'before_replyfeed'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(!isset($_GET['addfeed'])) {
|
||||
$space = array();
|
||||
space_merge($space, 'field_home');
|
||||
$_GET['addfeed'] = isset($space['privacy']['feed']['newreply']) ? $space['privacy']['feed']['newreply'] : null;
|
||||
}
|
||||
|
||||
$modpost->attach_before_methods('newreply', $bfmethods);
|
||||
$modpost->attach_after_methods('newreply', $afmethods);
|
||||
|
||||
$return = $modpost->newreply($params);
|
||||
$pid = $modpost->pid;
|
||||
|
||||
if($specialextra) {
|
||||
|
||||
@include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
|
||||
$classname = 'threadplugin_'.$specialextra;
|
||||
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'newreply_submit_end')) {
|
||||
$threadpluginclass->newreply_submit_end($_G['fid'], $_G['tid']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($modpost->pid && !$modpost->param('modnewreplies')) {
|
||||
|
||||
if(!empty($_GET['addfeed'])) {
|
||||
$modpost->replyfeed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($modpost->param('modnewreplies')) {
|
||||
$url = "forum.php?mod=viewthread&tid=".$_G['tid'];
|
||||
} else {
|
||||
|
||||
$antitheft = '';
|
||||
if(!empty($_G['setting']['antitheft']['allow']) && empty($_G['setting']['antitheft']['disable']['thread']) && empty($_G['forum']['noantitheft'])) {
|
||||
$sign = helper_antitheft::get_sign($_G['tid'], 'tid');
|
||||
if($sign) {
|
||||
$antitheft = '&_dsign='.$sign;
|
||||
}
|
||||
}
|
||||
|
||||
$url = "forum.php?mod=viewthread&tid=".$_G['tid']."&pid=".$modpost->pid."&page=".$modpost->param('page')."$antitheft&extra=".$extra."#pid".$modpost->pid;
|
||||
}
|
||||
|
||||
if(!isset($inspacecpshare)) {
|
||||
showmessage($return , $url, $modpost->param('showmsgparam'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
312
source/include/post/post_newthread.php
Normal file
312
source/include/post/post_newthread.php
Normal file
@@ -0,0 +1,312 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: post_newthread.php 33695 2013-08-03 04:39:22Z nemohou $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
if(empty($_G['forum']['fid']) || $_G['forum']['type'] == 'group') {
|
||||
showmessage('forum_nonexistence');
|
||||
}
|
||||
|
||||
if(($special == 1 && !$_G['group']['allowpostpoll']) || ($special == 2 && !$_G['group']['allowposttrade']) || ($special == 3 && !$_G['group']['allowpostreward']) || ($special == 4 && !$_G['group']['allowpostactivity']) || ($special == 5 && !$_G['group']['allowpostdebate'])) {
|
||||
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
|
||||
}
|
||||
|
||||
if(getglobal('setting/connect/allow') && $_G['setting']['accountguard']['postqqonly'] && !$_G['member']['conisbind']) {
|
||||
showmessage('postperm_qqonly_nopermission');
|
||||
}
|
||||
|
||||
if(!$_G['uid'] && !((!$_G['forum']['postperm'] && $_G['group']['allowpost']) || ($_G['forum']['postperm'] && forumperm($_G['forum']['postperm'])))) {
|
||||
if(!defined('IN_MOBILE')) {
|
||||
showmessage('postperm_login_nopermission', NULL, array(), array('login' => 1));
|
||||
} else {
|
||||
showmessage('postperm_login_nopermission_mobile', NULL, array('referer' => rawurlencode(dreferer())), array('login' => 1));
|
||||
}
|
||||
} elseif(empty($_G['forum']['allowpost'])) {
|
||||
if(!$_G['forum']['postperm'] && !$_G['group']['allowpost']) {
|
||||
showmessage('postperm_none_nopermission', NULL, array(), array('login' => 1));
|
||||
} elseif($_G['forum']['postperm'] && !forumperm($_G['forum']['postperm'])) {
|
||||
showmessagenoperm('postperm', $_G['fid'], $_G['forum']['formulaperm']);
|
||||
}
|
||||
} elseif($_G['forum']['allowpost'] == -1) {
|
||||
showmessage('post_forum_newthread_nopermission', NULL);
|
||||
}
|
||||
|
||||
if(!$_G['uid'] && ($_G['setting']['need_avatar'] || $_G['setting']['need_secmobile'] || $_G['setting']['need_email'] || $_G['setting']['need_friendnum'])) {
|
||||
showmessage('postperm_login_nopermission', NULL, array(), array('login' => 1));
|
||||
}
|
||||
|
||||
checklowerlimit('post', 0, 1, $_G['forum']['fid']);
|
||||
|
||||
if(!submitcheck('topicsubmit', 0, $seccodecheck, $secqaacheck)) {
|
||||
|
||||
$st_t = $_G['uid'].'|'.TIMESTAMP;
|
||||
dsetcookie('st_t', $st_t.'|'.md5($st_t.$_G['config']['security']['authkey']));
|
||||
|
||||
if(helper_access::check_module('group')) {
|
||||
$mygroups = $groupids = array();
|
||||
$groupids = C::t('forum_groupuser')->fetch_all_fid_by_uids($_G['uid']);
|
||||
array_slice($groupids, 0, 20);
|
||||
$query = C::t('forum_forum')->fetch_all_info_by_fids($groupids);
|
||||
foreach($query as $group) {
|
||||
$mygroups[$group['fid']] = $group['name'];
|
||||
}
|
||||
}
|
||||
|
||||
$savethreads = array();
|
||||
$savethreadothers = array();
|
||||
foreach(C::t('forum_post')->fetch_all_by_authorid(0, $_G['uid'], false, '', 0, 20, 1, -3) as $savethread) {
|
||||
$savethread['dateline'] = dgmdate($savethread['dateline'], 'u');
|
||||
if($_G['fid'] == $savethread['fid']) {
|
||||
$savethreads[] = $savethread;
|
||||
} else {
|
||||
$savethreadothers[] = $savethread;
|
||||
}
|
||||
}
|
||||
$savethreadcount = count($savethreads);
|
||||
$savethreadothercount = count($savethreadothers);
|
||||
if($savethreadothercount) {
|
||||
loadcache('forums');
|
||||
}
|
||||
$savecount = $savethreadcount + $savethreadothercount;
|
||||
unset($savethread);
|
||||
|
||||
$isfirstpost = 1;
|
||||
$allownoticeauthor = 1;
|
||||
$tagoffcheck = '';
|
||||
$showthreadsorts = !empty($sortid) || getglobal('forum/threadsorts/required') && empty($special);
|
||||
if(empty($sortid) && empty($special) && getglobal('forum/threadsorts/required') && $_G['forum']['threadsorts']['types']) {
|
||||
$tmp = array_keys($_G['forum']['threadsorts']['types']);
|
||||
$sortid = $tmp[0];
|
||||
|
||||
require_once libfile('post/threadsorts', 'include');
|
||||
}
|
||||
|
||||
if($special == 2 && $_G['group']['allowposttrade']) {
|
||||
|
||||
$expiration_7days = date('Y-m-d', TIMESTAMP + 86400 * 7);
|
||||
$expiration_14days = date('Y-m-d', TIMESTAMP + 86400 * 14);
|
||||
$trade['expiration'] = $expiration_month = date('Y-m-d', mktime(0, 0, 0, date('m')+1, date('d'), date('Y')));
|
||||
$expiration_3months = date('Y-m-d', mktime(0, 0, 0, date('m')+3, date('d'), date('Y')));
|
||||
$expiration_halfyear = date('Y-m-d', mktime(0, 0, 0, date('m')+6, date('d'), date('Y')));
|
||||
$expiration_year = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y')+1));
|
||||
|
||||
} elseif($specialextra) {
|
||||
|
||||
$threadpluginclass = null;
|
||||
if(isset($_G['setting']['threadplugins'][$specialextra]['module'])) {
|
||||
$threadpluginfile = DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
|
||||
if(file_exists($threadpluginfile)) {
|
||||
@include_once $threadpluginfile;
|
||||
$classname = 'threadplugin_'.$specialextra;
|
||||
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'newthread')) {
|
||||
$threadplughtml = $threadpluginclass->newthread($_G['fid']);
|
||||
$pluginlang = lang('plugin/'.$specialextra);
|
||||
$buttontext = property_exists($threadpluginclass, 'buttontext') ? (isset($pluginlang[$threadpluginclass->buttontext]) ? $pluginlang[$threadpluginclass->buttontext] : $threadpluginclass->buttontext) : '';
|
||||
$iconfile = $threadpluginclass->iconfile;
|
||||
$iconsflip = $_G['cache']['icons'] ? array_flip($_G['cache']['icons']) : array();
|
||||
$thread['iconid'] = $iconsflip[$iconfile];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_object($threadpluginclass)) {
|
||||
$specialextra = '';
|
||||
}
|
||||
}
|
||||
|
||||
if($special == 4) {
|
||||
$activity = array('starttimeto' => '', 'starttimefrom' => '', 'place' => '', 'class' => '', 'cost' => '', 'number' => '', 'gender' => '', 'expiration' => '');
|
||||
$activitytypelist = $_G['setting']['activitytype'] ? explode("\n", trim($_G['setting']['activitytype'])) : '';
|
||||
}
|
||||
|
||||
if($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) {
|
||||
$attachlist = getattach(0);
|
||||
$attachs = $attachlist['attachs'];
|
||||
$imgattachs = $attachlist['imgattachs'];
|
||||
unset($attachlist);
|
||||
}
|
||||
|
||||
!isset($attachs['unused']) && $attachs['unused'] = array();
|
||||
!isset($imgattachs['unused']) && $imgattachs['unused'] = array();
|
||||
|
||||
getgpc('infloat') ? include template('forum/post_infloat') : include template('forum/post');
|
||||
|
||||
} else {
|
||||
if(getgpc('mygroupid')) {
|
||||
$mygroupid = explode('__', $_GET['mygroupid']);
|
||||
$mygid = intval($mygroupid[0]);
|
||||
if($mygid) {
|
||||
$mygname = $mygroupid[1];
|
||||
if(count($mygroupid) > 2) {
|
||||
unset($mygroupid[0]);
|
||||
$mygname = implode('__', $mygroupid);
|
||||
}
|
||||
$message .= '[groupid='.intval($mygid).']'.$mygname.'[/groupid]';
|
||||
C::t('forum_forum')->update_commoncredits(intval($mygroupid[0]));
|
||||
}
|
||||
}
|
||||
$modthread = C::m('forum_thread');
|
||||
$bfmethods = $afmethods = array();
|
||||
|
||||
$params = array(
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
'typeid' => $typeid,
|
||||
'sortid' => $sortid,
|
||||
'special' => $special,
|
||||
);
|
||||
|
||||
$_GET['save'] = $_G['uid'] ? $_GET['save'] : 0;
|
||||
|
||||
if ($_G['group']['allowsetpublishdate'] && $_GET['cronpublish'] && $_GET['cronpublishdate']) {
|
||||
$publishdate = strtotime($_GET['cronpublishdate']);
|
||||
if ($publishdate > $_G['timestamp']) {
|
||||
$_GET['save'] = 1;
|
||||
} else {
|
||||
$publishdate = $_G['timestamp'];
|
||||
}
|
||||
} else {
|
||||
$publishdate = $_G['timestamp'];
|
||||
}
|
||||
$params['publishdate'] = $publishdate;
|
||||
$params['save'] = $_GET['save'];
|
||||
|
||||
$params['sticktopic'] = getgpc('sticktopic');
|
||||
|
||||
$params['digest'] = getgpc('addtodigest');
|
||||
$params['readperm'] = $readperm;
|
||||
$params['isanonymous'] = getgpc('isanonymous');
|
||||
$params['price'] = $_GET['price'];
|
||||
|
||||
|
||||
if(in_array($special, array(1, 2, 3, 4, 5))) {
|
||||
$specials = array(
|
||||
1 => 'extend_thread_poll',
|
||||
2 => 'extend_thread_trade',
|
||||
3 => 'extend_thread_reward',
|
||||
4 => 'extend_thread_activity',
|
||||
5 => 'extend_thread_debate'
|
||||
);
|
||||
$bfmethods[] = array('class' => $specials[$special], 'method' => 'before_newthread');
|
||||
$afmethods[] = array('class' => $specials[$special], 'method' => 'after_newthread');
|
||||
|
||||
if(!empty($_GET['addfeed'])) {
|
||||
$modthread->attach_before_method('feed', array('class' => $specials[$special], 'method' => 'before_feed'));
|
||||
}
|
||||
}
|
||||
|
||||
if($special == 1) {
|
||||
|
||||
|
||||
} elseif($special == 3) {
|
||||
|
||||
|
||||
} elseif($special == 4) {
|
||||
} elseif($special == 5) {
|
||||
|
||||
|
||||
} elseif($specialextra) {
|
||||
|
||||
@include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
|
||||
$classname = 'threadplugin_'.$specialextra;
|
||||
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'newthread_submit')) {
|
||||
$threadpluginclass->newthread_submit($_G['fid']);
|
||||
}
|
||||
$special = 127;
|
||||
$params['special'] = 127;
|
||||
$params['message'] .= chr(0).chr(0).chr(0).$specialextra;
|
||||
|
||||
}
|
||||
|
||||
$params['typeexpiration'] = getgpc('typeexpiration');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$params['ordertype'] = getgpc('ordertype');
|
||||
|
||||
$params['hiddenreplies'] = getgpc('hiddenreplies');
|
||||
|
||||
$params['allownoticeauthor'] = $_GET['allownoticeauthor'];
|
||||
$params['tags'] = $_GET['tags'];
|
||||
$params['bbcodeoff'] = getgpc('bbcodeoff');
|
||||
$params['smileyoff'] = getgpc('smileyoff');
|
||||
$params['parseurloff'] = getgpc('parseurloff');
|
||||
$params['usesig'] = $_GET['usesig'];
|
||||
$params['htmlon'] = getgpc('htmlon');
|
||||
if($_G['group']['allowimgcontent']) {
|
||||
$params['imgcontent'] = $_GET['imgcontent'];
|
||||
$params['imgcontentwidth'] = $_G['setting']['imgcontentwidth'] ? intval($_G['setting']['imgcontentwidth']) : 100;
|
||||
}
|
||||
|
||||
$params['geoloc'] = diconv(getgpc('geoloc'), 'UTF-8');
|
||||
|
||||
if(getgpc('rushreply')) {
|
||||
$bfmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'before_newthread');
|
||||
$afmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'after_newthread');
|
||||
}
|
||||
|
||||
$bfmethods[] = array('class' => 'extend_thread_replycredit', 'method' => 'before_newthread');
|
||||
$afmethods[] = array('class' => 'extend_thread_replycredit', 'method' => 'after_newthread');
|
||||
|
||||
if($sortid) {
|
||||
$bfmethods[] = array('class' => 'extend_thread_sort', 'method' => 'before_newthread');
|
||||
$afmethods[] = array('class' => 'extend_thread_sort', 'method' => 'after_newthread');
|
||||
}
|
||||
$bfmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'before_newthread');
|
||||
$afmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'after_newthread');
|
||||
$afmethods[] = array('class' => 'extend_thread_image', 'method' => 'after_newthread');
|
||||
|
||||
if(!empty($_GET['adddynamic'])) {
|
||||
$afmethods[] = array('class' => 'extend_thread_follow', 'method' => 'after_newthread');
|
||||
}
|
||||
|
||||
$modthread->attach_before_methods('newthread', $bfmethods);
|
||||
$modthread->attach_after_methods('newthread', $afmethods);
|
||||
|
||||
$return = $modthread->newthread($params);
|
||||
$tid = $modthread->tid;
|
||||
$pid = $modthread->pid;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dsetcookie('clearUserdata', 'forum');
|
||||
if($specialextra) {
|
||||
$classname = 'threadplugin_'.$specialextra;
|
||||
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'newthread_submit_end')) {
|
||||
$threadpluginclass->newthread_submit_end($_G['fid'], $modthread->tid);
|
||||
}
|
||||
}
|
||||
if(!$modthread->param('modnewthreads') && !empty($_GET['addfeed'])) {
|
||||
$modthread->feed();
|
||||
}
|
||||
|
||||
if(!empty($_G['setting']['rewriterule']['forum_viewthread']) && is_array($_G['setting']['rewritestatus']) && in_array('forum_viewthread', $_G['setting']['rewritestatus'])) {
|
||||
$returnurl = rewriteoutput('forum_viewthread', 1, '', $modthread->tid, 1, '', $extra);
|
||||
} else {
|
||||
$returnurl = "forum.php?mod=viewthread&tid={$modthread->tid}&extra=$extra";
|
||||
}
|
||||
$values = array('fid' => $modthread->forum('fid'), 'tid' => $modthread->tid, 'pid' => $modthread->pid, 'coverimg' => '', 'sechash' => !empty($_GET['sechash']) ? $_GET['sechash'] : '');
|
||||
showmessage($return, $returnurl, array_merge($values, (array)$modthread->param('values')), $modthread->param('param'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
38
source/include/post/post_threadsorts.php
Normal file
38
source/include/post/post_threadsorts.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: post_threadsorts.php 23995 2011-08-18 09:41:27Z zhangguosheng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
require_once libfile('function/threadsort');
|
||||
|
||||
threadsort_checkoption($sortid);
|
||||
$forum_optionlist = getsortedoptionlist();
|
||||
|
||||
loadcache(array('threadsort_option_'.$sortid, 'threadsort_template_'.$sortid));
|
||||
$sqlarr = array();
|
||||
foreach($_G['cache']['threadsort_option_'.$sortid] AS $key => $val) {
|
||||
if($val['profile']) {
|
||||
$sqlarr[] = $val['profile'];
|
||||
}
|
||||
}
|
||||
if($sqlarr) {
|
||||
$member_profile = array();
|
||||
$_member_profile = C::t('common_member_profile')->fetch($_G['uid']);
|
||||
foreach($sqlarr as $val) {
|
||||
$member_profile[$val] = $_member_profile[$val];
|
||||
}
|
||||
unset($_member_profile);
|
||||
}
|
||||
threadsort_optiondata($pid, $sortid, $_G['cache']['threadsort_option_'.$sortid], $_G['cache']['threadsort_template_'.$sortid]);
|
||||
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user