$value){ $_GET[$key]=$value; } $_GET['mod']='post'; //zzcityadd $_GET['action']='reply'; //zzcityadd if(isset($_GET['adddynamic'])){ $_POST['adddynamic'] =$_GET['adddynamic'] = trim($_GET['adddynamic'])=='' ? '' : $_GET['adddynamic']; //zzcity add 如果未设置则默认回复不转播 }else{ $_POST['adddynamic'] =$_GET['adddynamic']=''; } define('APPTYPEID', 2); define('CURSCRIPT', 'forum'); require './source/class/class_core.php'; require './source/function/function_forum.php'; $modarray = array('ajax','announcement','attachment','forumdisplay', 'group','image','index','medal','misc','modcp','notice','post','redirect', 'relatekw','relatethread','rss','topicadmin','trade','viewthread','tag','collection','guide' ); $modcachelist = array( 'index' => array('announcements', 'onlinelist', 'forumlinks', 'heats', 'historyposts', 'onlinerecord', 'userstats', 'diytemplatenameforum'), 'forumdisplay' => array('smilies', 'announcements_forum', 'globalstick', 'forums', 'onlinelist', 'forumstick', 'threadtable_info', 'threadtableids', 'stamps', 'diytemplatenameforum'), 'viewthread' => array('smilies', 'smileytypes', 'forums', 'usergroups', 'stamps', 'bbcodes', 'smilies', 'custominfo', 'groupicon', 'stamps', 'threadtableids', 'threadtable_info', 'posttable_info', 'diytemplatenameforum'), 'redirect' => array('threadtableids', 'threadtable_info', 'posttable_info'), 'post' => array('bbcodes_display', 'bbcodes', 'smileycodes', 'smilies', 'smileytypes', 'domainwhitelist', 'albumcategory'), 'space' => array('fields_required', 'fields_optional', 'custominfo'), 'group' => array('grouptype', 'diytemplatenamegroup'), ); $mod = !in_array(C::app()->var['mod'], $modarray) ? 'index' : C::app()->var['mod']; define('CURMODULE', $mod); $cachelist = array(); if(isset($modcachelist[CURMODULE])) { $cachelist = $modcachelist[CURMODULE]; } if(C::app()->var['mod'] == 'group') { $_G['basescript'] = 'group'; } C::app()->cachelist = $cachelist; C::app()->init(); //zzcity add $member = array(); $member = c::t('common_member')->fetch_by_username($_POST['username']); $cookietime=$_G['gp_cookietime'] ? 2592000 : 0; $_G['uid'] = $member['uid']; $_G['username'] = $member['username']; $_G['adminid'] = $member['adminid']; $_G['groupid'] = $member['groupid']; $_G['formhash'] = formhash(); $_G['session']['invisible'] = getuserprofile('invisible'); $_G['member'] = $member; loadcache('usergroup_'.$_G['groupid']); C::app()->session->isnew = true; C::app()->session->updatesession(); dsetcookie('auth', authcode("{$member['password']}\t{$member['uid']}", 'ENCODE'), $cookietime, 1, true); dsetcookie('loginuser'); dsetcookie('activationauth'); dsetcookie('pmnum'); include_once libfile('function/stat'); updatestat('login', 1); if(defined('IN_MOBILE')) { updatestat('mobilelogin', 1); } if($_G['setting']['connect']['allow'] && $_G['member']['conisbind']) { updatestat('connectlogin', 1); } $rule = updatecreditbyaction('daylogin', $_G['uid']); if(!$rule['updatecredit']) { checkusergroup($_G['uid']); } $_G['gp_htmlon']=$_GET['htmlon'] = trim($_GET['htmlon'])=='' ? '1' : $_GET['htmlon']; //zzcity loadforum(); //zzcityadd $_G['tid']=$_POST['tid']; $_G['group']['allowhtml']=$_G['gp_htmlon']; $_G['forum']['allowhtml']=$_G['gp_htmlon']; $zzhour =!isset($_G['gp_zzhour']) ? '1' : intval($_G['gp_zzhour']); //zzcity add $replyno =!isset($_G['gp_replyno']) ? '1' : intval($_G['gp_replyno']); //zzcity add $zztimestamp =time()-$zzhour*60*60; //zzcity add $zztimestamp =$_G['timestamp']= $zztimestamp+$replyno*5*60+rand(0,4)*60; //zzcity add //zzcity set_rssauth(); //runhooks(); $navtitle = str_replace('{bbname}', $_G['setting']['bbname'], $_G['setting']['seotitle']['forum']); //require DISCUZ_ROOT.'./source/module/forum/forum_'.$mod.'.php';替换开始 if(!defined('IN_DISCUZ')) { exit('Access Denied'); } define('NOROBOT', TRUE); cknewuser(); require_once libfile('class/credit'); require_once libfile('function/post'); $pid = intval(getgpc('pid')); $sortid = intval(getgpc('sortid')); $typeid = intval(getgpc('typeid')); $special = intval(getgpc('special')); $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'); exit('[err]该版块不是群组[/err]'); } elseif($status == 1) { //showmessage('forum_group_status_off'); exit('[err]该群组已经关闭[/err]'); } elseif($status == 2) { //showmessage('forum_group_noallowed', "forum.php?mod=group&fid=$_G[fid]"); exit('[err]您没有权限访问该群组[/err]'); } elseif($status == 3) { //showmessage('forum_group_moderated', "forum.php?mod=group&fid=$_G[fid]"); exit('[err]请等待群主审核[/err]'); } elseif($status == 4) { if($_G['uid']) { //showmessage('forum_group_not_groupmember', "", array('fid' => $_G['fid']), array('showmsg' => 1)); exit('[err]非本群组成员不能发帖[/err]'); } else { //showmessage('forum_group_not_groupmember_guest', "", array('fid' => $_G['fid']), array('showmsg' => 1, 'login' => 1)); exit('[err]非本群组成员不能发帖[/err]'); } } elseif($status == 5) { //showmessage('forum_group_moderated', "", array('fid' => $_G['fid']), array('showmsg' => 1)); exit('[err]请等待群主审核[/err]'); } } /* 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($_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)); exit('[err]'.lang('message', 'thread_nopermission',array('readperm' => $thread['readperm']), array('login' => 1)).'[/err]'); } $_G['fid'] = $thread['fid']; $special = $thread['special']; } else { // showmessage('thread_nonexistence'); exit('[err]'.lang('message', 'thread_nonexistence').'[/err]'); } if($thread['closed'] == 1 && !$_G['forum']['ismoderator']) { // showmessage('post_thread_closed'); exit('[err]'.lang('message', 'post_thread_closed').'[/err]'); } } 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 = ' '.$_G['setting']['navs'][3]['navname'].' '.$nav['nav']; } else { loadcache('forums'); $returnurl = 'forum.php?mod=forumdisplay&fid='.$_G['fid'].(!empty($_GET['extra']) ? '&'.preg_replace("/^(&)*/", '', $_GET['extra']) : ''); $navigation = ' '.$_G['setting']['navs'][2]['navname'].''; 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 .= ' '.($_G['cache']['forums'][$fup]['name']).''; } 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 .= ' '.($_G['cache']['forums'][$fup]['name']).''; } $t_link = 'forum.php?mod=forumdisplay&fid='.$_G['fid'].($_GET['extra'] && !IS_ROBOT ? '&'.$_GET['extra'] : ''); $navigation .= ' '.($_G['forum']['name']).''; 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(!$_G['adminid'] && $_G['setting']['newbiespan'] && (!getuserprofile('lastpost') || TIMESTAMP - getuserprofile('lastpost') < $_G['setting']['newbiespan'] * 60) && TIMESTAMP - $_G['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']))) : ''; $subject = !empty($subject) ? str_replace("\t", ' ', $subject) : $subject; $message = isset($_GET['message']) ? censor($_GET['message']) : ''; $message=addslashes($message); $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*\].+?\[\/hide\]/is", preg_replace("/(\[code\](.+?)\[\/code\])/is", ' ', $message))) { showmessage('post_hide_nopermission'); } */ $modnewthreads = $modnewreplies = 0; if(($subject || $message) && empty($_GET['save'])) { $extramessage = ($special == 5 ? "\t".$_GET['affirmpoint']."\t".$_GET['negapoint'] : ''). ($special == 4 ? "\t".$_GET['activityplace']."\t".$_GET['activitycity']."\t".$_GET['activityclass'] : ''). ($special == 2 ? "\t".$_GET['item_name']."\t".$_GET['item_locus'] : ''). ($_GET['typeoption'] ? "\t".implode("\t", $_GET['typeoption']) : ''). ($_GET['polloptions'] || $_GET['polloption'] ? ("\t".implode("\t", $_GET['tpolloption'] == 2 ? explode("\n", $_GET['polloptions']) : $_GET['polloption'])) : ''); list($modnewthreads, $modnewreplies) = threadmodstatus($subject."\t".$message.$extramessage); unset($extramessage); } $urloffcheck = $usesigcheck = $smileyoffcheck = $codeoffcheck = $htmloncheck = $emailcheck = ''; $seccodecheck = ($_G['setting']['seccodestatus'] & 4) && (!$_G['setting']['seccodedata']['minposts'] || getuserprofile('posts') < $_G['setting']['seccodedata']['minposts']); $secqaacheck = $_G['setting']['secqaa']['status'] & 2 && (!$_G['setting']['secqaa']['minposts'] || getuserprofile('posts') < $_G['setting']['secqaa']['minposts']); $_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"' : ''; $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'] : dunserialize($_G['forum']['threadplugin'])) || !@in_array($specialextra, $_G['group']['allowthreadplugin']))) { $specialextra = ''; } if($special == 3 && !isset($_G['setting']['extcredits'][$_G['setting']['creditstrans']])) { //showmessage('reward_credits_closed'); exit('[err]交易积分被关闭,请联系管理员[/err]'); } $_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']) { $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)); exit('[err]您所在的用户组无法进行此操作[/err]'); } } 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 = ''; } if($policykey) { $postcredits = $_G['forum'][$policykey.'credits'] ? $_G['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=$firstpid" : ''). (!empty($_GET['addtrade']) ? "&addtrade=$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'); /* if($_GET['action'] == 'newthread') { 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'); } elseif($_GET['action'] == 'newtrade') { $navtitle .= ' - '.$_G['forum']['name']; require_once libfile('post/newtrade', 'include'); } */ //require_once libfile('post/newreply', 'include');替换开始 //if(!defined('IN_DISCUZ')) { // exit('Access Denied'); //} require_once libfile('function/forumlist'); $isfirstpost = 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_email'] || $_G['setting']['need_friendnum'])) { showmessage('replyperm_login_nopermission', NULL, array(), array('login' => 1)); } */ if(empty($thread)) { // showmessage('thread_nonexistence'); exit('[err]'.lang('message', 'thread_nonexistence').'[/err]'); } elseif($thread['price'] > 0 && $thread['special'] == 0 && !$_G['uid']) { // showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1)); exit('[err]'.lang('message', 'group_nopermission',array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1)).'[/err]'); } //checklowerlimit('reply', 0, 1, $_G['forum']['fid']); if($_G['setting']['commentnumber'] && !empty($_GET['comment'])) { if(!submitcheck('commentsubmit', 0, $seccodecheck, $secqaacheck)) { // showmessage('submitcheck_error', NULL); exit('[err]'.lang('message', 'submitcheck_error').'[/err]'); } $post = C::t('forum_post')->fetch('tid:'.$_G['tid'], $_GET['pid']); if(!$post) { // showmessage('post_nonexistence', NULL); exit('[err]'.lang('message', 'post_nonexistence').'[/err]'); } /* 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)).': '.intval($itemv).' '; } } } $comment = cutstr(($commentscore ? $commentscore.'
' : '').censor(trim(dhtmlspecialchars($_GET['message'])), '***'), 200, ' '); if(!$comment) { // showmessage('post_sm_isnull'); exit('[err]'.lang('message', 'post_sm_isnull').'[/err]'); } C::t('forum_postcomment')->insert(array( 'tid' => $post['tid'], 'pid' => $post['pid'], 'author' => $_G['username'], 'authorid' => $_G['uid'], 'dateline' => $zztimestamp, 'comment' => $comment, 'score' => $commentscore ? 1 : 0, 'useip' => $_G['clientip'], )); C::t('forum_post')->update('tid:'.$_G['tid'], $_GET['pid'], array('comment' => 1)); !empty($_G['uid']) && 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'], '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'], '
')) { if(preg_match_all("/([^:]+?):\s(\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)).': '.(floatval(sprintf('%1.1f', array_sum($itemv) / count($itemv)))).' '; } 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' => $zztimestamp + 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=$_G[gp_page]&extra=$extra#pid$post[pid]", array('tid' => $post['tid'], 'pid' => $post['pid'])); exit('[err]'.lang('message', 'comment_add_succeed').'[/err]'); } 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'])); exit('[err]'.lang('message', 'post_rushreply_creditlimit',array('creditlimit_title' => $creditlimit_title, 'creditlimit' => $rushinfo['creditlimit'])).'[/err]'); } } } /* if(!submitcheck('replysubmit', 0, $seccodecheck, $secqaacheck)) { 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('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($_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][color=#999999]{$post_reply_quote}[/color] [url=forum.php?mod=redirect&goto=findpost&pid=$_GET[repquote]&ptid={$_G['tid']}][img]static/image/common/back.gif[/img][/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('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'] && (!$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 { */ // 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'])); // } if(trim($subject) == '' && trim($message) == '' && $thread['special'] != 2) { // showmessage('post_sm_isnull'); exit('[err]'.lang('message', 'post_sm_isnull').'[/err]'); } elseif($post_invalid = checkpost($subject, $message, $special == 2 && $_G['group']['allowposttrade'])) { // showmessage($post_invalid, '', array('minpostsize' => $_G['setting']['minpostsize'], 'maxpostsize' => $_G['setting']['maxpostsize'])); exit('[err]'.lang('message', $post_invalid,array('minpostsize' => $_G['setting']['minpostsize'], 'maxpostsize' => $_G['setting']['maxpostsize'])).'[/err]'); // } 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'])); } /* if(!empty($_GET['trade']) && $thread['special'] == 2 && $_G['group']['allowposttrade']) { $item_price = floatval($_GET['item_price']); $item_credit = intval($_GET['item_credit']); if(!trim($_GET['item_name'])) { showmessage('trade_please_name'); } elseif($_G['group']['maxtradeprice'] && $item_price > 0 && ($_G['group']['mintradeprice'] > $item_price || $_G['group']['maxtradeprice'] < $item_price)) { showmessage('trade_price_between', '', array('mintradeprice' => $_G['group']['mintradeprice'], 'maxtradeprice' => $_G['group']['maxtradeprice'])); } elseif($_G['group']['maxtradeprice'] && $item_credit > 0 && ($_G['group']['mintradeprice'] > $item_credit || $_G['group']['maxtradeprice'] < $item_credit)) { showmessage('trade_credit_between', '', array('mintradeprice' => $_G['group']['mintradeprice'], 'maxtradeprice' => $_G['group']['maxtradeprice'])); } elseif(!$_G['group']['maxtradeprice'] && $item_price > 0 && $_G['group']['mintradeprice'] > $item_price) { showmessage('trade_price_more_than', '', array('mintradeprice' => $_G['group']['mintradeprice'])); } elseif(!$_G['group']['maxtradeprice'] && $item_credit > 0 && $_G['group']['mintradeprice'] > $item_credit) { showmessage('trade_credit_more_than', '', array('mintradeprice' => $_G['group']['mintradeprice'])); } elseif($item_price <= 0 && $item_credit <= 0) { showmessage('trade_pricecredit_need'); } elseif($_GET['item_number'] < 1) { showmessage('tread_please_number'); } } */ $attentionon = empty($_GET['attention_add']) ? 0 : 1; $attentionoff = empty($attention_remove) ? 0 : 1; $heatthreadset = update_threadpartake($_G['tid'], true); if($_G['group']['allowat']) { $atlist = $atlist_tmp = $ateduids = array(); preg_match_all("/@([^\r\n]*?)\s/i", $message.' ', $atlist_tmp); $atlist_tmp = array_slice(array_unique($atlist_tmp[1]), 0, $_G['group']['allowat']); $atnum = $maxselect = 0; foreach(C::t('home_notification')->fetch_all_by_authorid_fromid($_G['uid'], $_G['tid'], 'at') as $row) { $atnum ++; $ateduids[$row[uid]] = $row['uid']; } $maxselect = $_G['group']['allowat'] - $atnum; if($maxselect > 0 && !empty($atlist_tmp)) { if(empty($_G['setting']['at_anyone'])) { foreach(C::t('home_follow')->fetch_all_by_uid_fusername($_G['uid'], $atlist_tmp) as $row) { if(!in_array($row['followuid'], $ateduids)) { $atlist[$row[followuid]] = $row['fusername']; } if(count($atlist) == $maxselect) { break; } } if(count($atlist) < $maxselect) { $query = C::t('home_friend')->fetch_all_by_uid_username($_G['uid'], $atlist_tmp); foreach($query as $row) { if(!in_array($row['followuid'], $ateduids)) { $atlist[$row[fuid]] = $row['fusername']; } } } } else { foreach(C::t('common_member')->fetch_all_by_username($atlist_tmp) as $row) { if(!in_array($row['uid'], $ateduids)) { $atlist[$row[uid]] = $row['username']; } if(count($atlist) == $maxselect) { break; } } } } if($atlist) { foreach($atlist as $atuid => $atusername) { $atsearch[] = "/@$atusername /i"; $atreplace[] = "[url=home.php?mod=space&uid=$atuid]@{$atusername}[/url] "; } $message = preg_replace($atsearch, $atreplace, $message.' ', 1); } } $bbcodeoff = checkbbcodes($message, !empty($_GET['bbcodeoff'])); $smileyoff = checksmilies($message, !empty($_GET['smileyoff'])); $parseurloff = !empty($_GET['parseurloff']); $htmlon = $_G['group']['allowhtml'] && !empty($_GET['htmlon']) ? 1 : 0; $usesig = !empty($_GET['usesig']) && $_G['group']['maxsigsize'] ? 1 : 0; $isanonymous = $_G['group']['allowanonymous'] && !empty($_GET['isanonymous'])? 1 : 0; $author = empty($isanonymous) ? $_G['username'] : ''; if($thread['displayorder'] == -4) { $modnewreplies = 0; } $pinvisible = $modnewreplies ? -2 : ($thread['displayorder'] == -4 ? -3 : 0); //zzcity add // function zzfileext($filename) { return strtolower(substr(strrchr($filename, '.'), 1, 10)); } $attachlist=explode(',',$_POST['etattachs']); $curattachs=''; $message=preg_replace("/\[img([^\]]*?)\]/i",'[img]',$message); foreach ($attachlist as $key => $value) { $value=trim($value); if(empty($value))continue; if (preg_match("/".preg_quote($value,"/")."/i",$message)){ $message=preg_replace("/]*?)".preg_quote($value,"/")."([^<]*?)]*?)".preg_quote($value,"/")."([^<]*?)<\/(.*?)>/i",'[attachimg]'.$value.'[/attachimg]',$message); $message=preg_replace("/]*?)".preg_quote($value,"/")."([^>]*?)>/i",'[attachimg]'.$value.'[/attachimg]',$message); $message=preg_replace("/\[img([^\]]*?)\]".preg_quote($value,"/")."\[\/img\]/i",'[attachimg]'.$value.'[/attachimg]',$message); $message=preg_replace("/]*?)".preg_quote($value,"/")."([^>]*?)>([^<]+?)<\/a(.*?)>/i",'[attach]'.$value.'[/attach]',$message); $message=preg_replace("/\[url=".preg_quote($value,"/")."(.*?)\[\/url\]/i",'[attach]'.$value.'[/attach]',$message); if (in_array(zzfileext('ext'),array("wma","mp3","ra","rm"))) { $message=preg_replace("//i",'[audio=1]'.$value.'[/audio]',$message); $message=preg_replace("//i",'[audio=1]'.$value.'[/audio]',$message); }elseif (in_array(zzfileext('ext'), array('wmv','rmvb','avi','mov'))){ $message=preg_replace("//i",'[media='.zzfileext('ext').',500,375,1]'.$value.'[/media]',$message); $message=preg_replace("//i",'[media='.zzfileext('ext').',500,375,1]'.$value.'[/media]',$message); }elseif (in_array(zzfileext('ext'), array('swf','flv'))){ $message=preg_replace("//i",'[flash]'.$value.'[/flash]',$message); $message=preg_replace("//i",'[flash]'.$value.'[/flash]',$message);} $curattachs.= empty($curattachs) ? $value:','.$value; } } $message = preg_replace('/\[attachimg\](.+?)\[\/attachimg\]/is', '[attach]\1[/attach]', $message); //zzcity close // $message = preg_replace('/\[attachimg\](\d+)\[\/attachimg\]/is', '[attach]\1[/attach]', $message); $postcomment = in_array(2, $_G['setting']['allowpostcomment']) && $_G['group']['allowcommentreply'] && !$pinvisible && !empty($_GET['reppid']) && ($nauthorid != $_G['uid'] || $_G['setting']['commentpostself']) ? messagecutstr($message, 200, ' ') : ''; if(!empty($_GET['noticetrimstr'])) { $message = $_GET['noticetrimstr']."\n\n".$message; $bbcodeoff = false; } $subject=''; $pid = insertpost(array( 'fid' => $_G['fid'], 'tid' => $_G['tid'], 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $_G['timestamp'], 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => $pinvisible, 'anonymous' => $isanonymous, 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'status' => (defined('IN_MOBILE') ? 8 : 0), )); if($_G['group']['allowat'] && $atlist) { foreach($atlist as $atuid => $atusername) { notification_add($atuid, 'at', 'at_message', array('from_id' => $_G['tid'], 'from_idtype' => 'thread', 'buyerid' => $_G['uid'], 'buyer' => $_G['username'], 'tid' => $_G['tid'], 'subject' => $thread['subject'], 'pid' => $pid, 'message' => messagecutstr($message, 150))); } set_atlist_cookie(array_keys($atlist)); } $updatethreaddata = $heatthreadset ? $heatthreadset : array(); $postionid = C::t('forum_post')->fetch_maxposition_by_tid($thread['posttableid'], $_G['tid']); $updatethreaddata[] = DB::field('maxposition', $postionid); if(getstatus($thread['status'], 3) && $postionid) { $rushstopfloor = $rushinfo['stopfloor']; if($rushstopfloor > 0 && $thread['closed'] == 0 && $postionid >= $rushstopfloor) { $updatethreaddata[] = 'closed=1'; } } useractionlog($_G['uid'], 'pid'); //zzcity add attachment $ashowurl = empty($_POST['ashowurl']) ? "/data/attachment/forum" : trim($_POST['ashowurl']); $ashowurl = substr($ashowurl,-1)=="/" ? $ashowurl: $ashowurl.'/'; $curalist=explode(',',$curattachs); $attachnum = empty($curattachs) ? 0 :count($curalist); if ($attachnum){ $zzattachtype=1; // function zzis_image_ext($ext) { static $imgext = array('jpg', 'jpeg', 'gif', 'png', 'bmp'); return in_array($ext, $imgext) ? 1 : 0; } // function zzget_target_extension($ext) { static $safeext = array('attach', 'jpg', 'jpeg', 'gif', 'png', 'swf', 'bmp', 'txt', 'zip', 'rar', 'mp3'); return strtolower(!in_array(strtolower($ext), $safeext) ? 'attach' : $ext); } function zzforum_upload($filename) { global $_G,$zzattachtype; $zzuid = intval($_G['uid']); // $swfhash = md5(substr(md5($_G['config']['security']['authkey']), 8).$this->uid); $zzaid = 0; // $zzsimple = !empty($_G['gp_simple']) ? $_G['gp_simple'] : 0; // $_G['groupid'] = intval(DB::result_first("SELECT groupid FROM ".DB::table('common_member')." WHERE uid='".$this->uid."'")); // loadcache('usergroup_'.$_G['groupid']); // $_G['group'] = $_G['cache']['usergroup_'.$_G['groupid']]; // $upload = new discuz_upload(); // $upload->init($_FILES['Filedata'], 'forum'); // $this->attach = &$upload->attach; $thistype='forum'; $attach=array(); $attach['name'] = trim(substr(strrchr($filename,'/'),1)); $attach['thumb'] = ''; $attach['name'] = dhtmlspecialchars($attach['name'], ENT_QUOTES); if(strlen($attach['name']) > 90) { $attach['name'] = cutstr($attach['name'], 90, '').'.'.$attach['ext']; } $attach['ext'] = zzfileext($attach['name']); $attach['isimage'] = zzis_image_ext($attach['ext']); $attach['extension'] = zzget_target_extension($attach['ext']); // $attach['attachdir'] = $this->get_target_dir($thistype, $extid); // $attach['attachment'] = $attach['attachdir'].$this->get_target_filename($this->type, $this->extid, $this->forcename).'.'.$attach['extension']; $attach['attachment'] = $filename; $attach['target'] = getglobal('setting/attachdir').'./'.$thistype.'/'.$attach['attachment']; $attach['size'] = intval(filesize($attach['target'])); // if($upload->error()) { // $this->uploadmsg(2); // } // // $allowupload = !$_G['group']['maxattachnum'] || $_G['group']['maxattachnum'] && $_G['group']['maxattachnum'] > DB::result_first("SELECT count(*) FROM ".DB::table('forum_attachment')." WHERE uid='$_G[uid]' AND dateline>'$_G[timestamp]'-86400"); // if(!$allowupload) { // $this->uploadmsg(9); // } // if($_G['group']['attachextensions'] && (!preg_match("/(^|\s|,)".preg_quote($upload->attach['ext'], '/')."($|\s|,)/i", $_G['group']['attachextensions']) || !$upload->attach['ext'])) { // $this->uploadmsg(1); // } // if(empty($upload->attach['size'])) { // $this->uploadmsg(2); // } // if($_G['group']['maxattachsize'] && $upload->attach['size'] > $_G['group']['maxattachsize']) { // $this->uploadmsg(3); // } // // if($type = DB::fetch_first("SELECT maxsize FROM ".DB::table('forum_attachtype')." WHERE extension='".addslashes($upload->attach['ext'])."'")) { // if($type['maxsize'] == 0) { // $this->uploadmsg(4); // } elseif($upload->attach['size'] > $type['maxsize']) { // $this->uploadmsg(5); // } // } // if($upload->attach['size'] && $_G['group']['maxsizeperday']) { // $todaysize = intval(DB::result_first("SELECT SUM(filesize) FROM ".DB::table('forum_attachment')." WHERE uid='$_G[uid]' AND dateline>'$_G[timestamp]'-86400")); // $todaysize += $upload->attach['size']; // if($todaysize >= $_G['group']['maxsizeperday']) { // $this->uploadmsg(6); // } // } // $upload->save(); // if($upload->error() == -103) { // $this->uploadmsg(8); // } elseif($upload->error()) { // $this->uploadmsg(9); // } $thumb = $remote = $width = 0; if($attach['isimage']) { $zzattachtype=2; require_once libfile('class/image'); $image = new image; if($_G['setting']['thumbstatus']) { //$thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['thumbwidth'], $_G['setting']['thumbheight'], $_G['setting']['thumbstatus'], $_G['setting']['thumbsource']) ? 1 : 0; $thumb = $image->Thumb($attach['target'], '', $_G['setting']['thumbwidth'], $_G['setting']['thumbheight'], $_G['setting']['thumbstatus'], $_G['setting']['thumbsource']) ? 1 : 0; } if($_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark'])) { $image->Watermark($attach['target']); } $width = $image->imginfo['width']; if($_G['setting']['thumbsource'] || !$_G['setting']['thumbstatus']) { list($width) = @getimagesize($attach['target']); } } // if(!$zzsimple) { // $attach['name'] = diconv($attach['name'], 'utf-8'); // } // if($_G['gp_type'] != 'image' && $attach['isimage']) { // $attach['isimage'] = -1; // } $zzaid=getattachnewaid($zzuid); DB::query("INSERT INTO ".DB::table('forum_attachment_unused')." (aid, dateline, filename, filesize, attachment, isimage, uid, thumb, remote, width) VALUES ('$zzaid', '$_G[timestamp]', '".$attach['name']."', '".$attach['size']."', '".$attach['attachment']."', '".$attach['isimage']."', '".$zzuid."', '$thumb', '$remote', '$width')"); return $zzaid; // $this->uploadmsg(0); } foreach ($curalist as $key => $value) { $oldvalue=$value; $value=str_replace($ashowurl,'',$value); $aid=zzforum_upload($value); $message=str_replace($oldvalue,$aid,$message); $aids[]=$aid; } //DB::query('UPDATE '.DB::table('forum_thread').' SET attachment='.$zzattachtype.' WHERE tid = '.$_G['tid']); $posttable = getposttablebytid($_G['tid']); DB::query("UPDATE ".DB::table($posttable)." SET message='$message',attachment=$attachnum WHERE pid=$pid"); foreach($aids as $key => $value){ convertunusedattach($value,$_G['tid'],$pid); } if(getglobal('setting/ftp/on')){ ftpupload($aids,intval($_G['uid'])); } } //zzcity add attachment close $nauthorid = 0; if(!empty($_GET['noticeauthor']) && !$isanonymous && !$modnewreplies) { list($ac, $nauthorid) = explode('|', authcode($_GET['noticeauthor'], 'DECODE')); if($nauthorid != $_G['uid']) { if($ac == 'q') { notification_add($nauthorid, 'post', 'reppost_noticeauthor', array( 'tid' => $thread['tid'], 'subject' => $thread['subject'], 'fid' => $_G['fid'], 'pid' => $pid, )); } elseif($ac == 'r') { notification_add($nauthorid, 'post', 'reppost_noticeauthor', array( 'tid' => $thread['tid'], 'subject' => $thread['subject'], 'fid' => $_G['fid'], 'pid' => $pid, 'from_id' => $thread['tid'], 'from_idtype' => 'post', )); } } if($postcomment) { $rpid = intval($_GET['reppid']); if($rpost = C::t('forum_post')->fetch('tid:'.$thread['tid'], $rpid)) { if(!$rpost['first']) { C::t('forum_postcomment')->insert(array( 'tid' => $thread['tid'], 'pid' => $rpid, 'rpid' => $pid, 'author' => $_G['username'], 'authorid' => $_G['uid'], 'dateline' => $_G['timestamp'], 'comment' => $postcomment, 'score' => 0, 'useip' => $_G['clientip'], )); C::t('forum_post')->update('tid:'.$thread['tid'], $rpid, array('comment' => 1)); } } unset($postcomment); } } if($thread['authorid'] != $_G['uid'] && getstatus($thread['status'], 6) && empty($_GET['noticeauthor']) && !$isanonymous && !$modnewreplies) { $thapost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['tid'], 0); notification_add($thapost['authorid'], 'post', 'reppost_noticeauthor', array( 'tid' => $thread['tid'], 'subject' => $thread['subject'], 'fid' => $_G['fid'], 'pid' => $pid, 'from_id' => $thread['tid'], 'from_idtype' => 'post', )); } $feedid = 0; if(helper_access::check_module('follow') && !empty($_GET['adddynamic']) && !$isanonymous) { require_once libfile('function/discuzcode'); require_once libfile('function/followcode'); $feedcontent = C::t('forum_threadpreview')->count_by_tid($thread['tid']); $firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']); if(empty($feedcontent)) { $feedcontent = array( 'tid' => $thread['tid'], 'content' => followcode($firstpost['message'], $thread['tid'], $pid, 1000), ); C::t('forum_threadpreview')->insert($feedcontent); C::t('forum_thread')->update_status_by_tid($thread['tid'], '512'); } else { C::t('forum_threadpreview')->update_relay_by_tid($thread['tid'], 1); } $notemsg = cutstr($message, 140); $followfeed = array( 'uid' => $_G['uid'], 'username' => $_G['username'], 'tid' => $thread['tid'], 'note' => followcode($notemsg, $thread['tid'], $pid, 0, false), 'dateline' => $_G['timestamp'] ); $feedid = C::t('home_follow_feed')->insert($followfeed, true); C::t('common_member_count')->increase($_G['uid'], array('feeds'=>1)); } if($thread['replycredit'] > 0 && !$modnewreplies && $thread['authorid'] != $_G['uid'] && $_G['uid']) { $replycredit_rule = C::t('forum_replycredit')->fetch($_G['tid']); if(!empty($replycredit_rule['times'])) { $have_replycredit = C::t('common_credit_log')->count_by_uid_operation_relatedid($_G['uid'], 'RCA', $_G['tid']); if($replycredit_rule['membertimes'] - $have_replycredit > 0 && $thread['replycredit'] - $replycredit_rule['extcredits'] >= 0) { $replycredit_rule['extcreditstype'] = $replycredit_rule['extcreditstype'] ? $replycredit_rule['extcreditstype'] : $_G['setting']['creditstransextra'][10]; if($replycredit_rule['random'] > 0) { $rand = rand(1, 100); $rand_replycredit = $rand <= $replycredit_rule['random'] ? true : false ; } else { $rand_replycredit = true; } if($rand_replycredit) { updatemembercount($_G['uid'], array($replycredit_rule['extcreditstype'] => $replycredit_rule['extcredits']), 1, 'RCA', $_G[tid]); C::t('forum_post')->update('tid:'.$_G['tid'], $pid, array('replycredit' => $replycredit_rule['extcredits'])); $updatethreaddata[] = DB::field('replycredit', $thread['replycredit'] - $replycredit_rule['extcredits']); } } } } /* if($special == 5) { if(!$firststand) { C::t('forum_debate')->update_debaters($_G['tid'], $stand); } else { $stand = $firststand; } C::t('forum_debate')->update_replies($_G['tid'], $stand); C::t('forum_debatepost')->insert(array( 'tid' => $_G['tid'], 'pid' => $pid, 'uid' => $_G['uid'], 'dateline' => $_G['timestamp'], 'stand' => $stand, 'voters' => 0, 'voterids' => '', )); } */ ($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) && ($_GET['attachnew'] || $special == 2 && $_GET['tradeaid']) && updateattach($thread['displayorder'] == -4 || $modnewreplies, $_G['tid'], $pid, $_GET['attachnew']); $replymessage = 'post_reply_succeed'; /* if($special == 2 && $_G['group']['allowposttrade'] && $thread['authorid'] == $_G['uid'] && !empty($_GET['trade']) && !empty($_GET['item_name'])) { require_once libfile('function/trade'); trade_create(array( 'tid' => $_G['tid'], 'pid' => $pid, 'aid' => $_GET['tradeaid'], 'item_expiration' => $_GET['item_expiration'], 'thread' => $thread, 'discuz_uid' => $_G['uid'], 'author' => $author, 'seller' => empty($_GET['paymethod']) && $_GET['seller'] ? dhtmlspecialchars(trim($_GET['seller'])) : '', 'item_name' => $_GET['item_name'], 'item_price' => $_GET['item_price'], 'item_number' => $_GET['item_number'], 'item_quality' => $_GET['item_quality'], 'item_locus' => $_GET['item_locus'], 'transport' => $_GET['transport'], 'postage_mail' => $_GET['postage_mail'], 'postage_express' => $_GET['postage_express'], 'postage_ems' => $_GET['postage_ems'], 'item_type' => $_GET['item_type'], 'item_costprice' => $_GET['item_costprice'], 'item_credit' => $_GET['item_credit'], 'item_costcredit' => $_GET['item_costcredit'] )); $replymessage = 'trade_add_succeed'; if(!empty($_GET['tradeaid'])) { convertunusedattach($_GET['tradeaid'], $_G['tid'], $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']); } } $_G['forum']['threadcaches'] && deletethreadcaches($_G['tid']); include_once libfile('function/stat'); updatestat($thread['isgroup'] ? 'grouppost' : 'post'); $param = array('fid' => $_G['fid'], 'tid' => $_G['tid'], 'pid' => $pid, 'from' => $_GET['from'], 'sechash' => !empty($_GET['sechash']) ? $_GET['sechash'] : ''); if($feedid) { $param['feedid'] = $feedid; } dsetcookie('clearUserdata', 'forum'); if($modnewreplies) { updatemoderate('pid', $pid); unset($param['pid']); if($updatethreaddata) { C::t('forum_thread')->update($_G['tid'], $updatethreaddata, false, false, 0, true); } C::t('forum_forum')->update_forum_counter($_G['fid'], 0, 0, 1, 1); // $url = empty($_POST['portal_referer']) ? ("forum.php?mod=viewthread&tid={$thread[tid]}") : $_POST['portal_referer']; // manage_addnotify('verifypost'); // if(!isset($inspacecpshare)) { // showmessage('post_reply_mod_succeed', $url, $param); // } } else { $fieldarr = array( 'lastposter' => array($author), 'replies' => 1 ); if($thread['lastpost'] < $_G['timestamp']) { $fieldarr['lastpost'] = array($_G['timestamp']); } $row = C::t('forum_threadaddviews')->fetch($_G['tid']); if(!empty($row)) { C::t('forum_threadaddviews')->update($_G['tid'], array('addviews' => 0)); $fieldarr['views'] = $row['addviews']; } $updatethreaddata = array_merge($updatethreaddata, C::t('forum_thread')->increase($_G['tid'], $fieldarr, false, 0, true)); if($thread['displayorder'] != -4) { updatepostcredits('+', $_G['uid'], 'reply', $_G['fid']); if($_G['forum']['status'] == 3) { if($_G['forum']['closed'] > 1) { C::t('forum_thread')->increase($_G['forum']['closed'], $fieldarr, true); } C::t('forum_groupuser')->update_counter_for_user($_G['uid'], $_G['fid'], 0, 1); C::t('forum_forumfield')->update($_G['fid'], array('lastupdate' => $_G['timestamp'])); require_once libfile('function/grouplog'); updategroupcreditlog($_G['fid'], $_G['uid']); } $lastpost = "$thread[tid]\t$thread[subject]\t$_G[timestamp]\t$author"; C::t('forum_forum')->update($_G['fid'], array('lastpost' => $lastpost)); C::t('forum_forum')->update_forum_counter($_G['fid'], 0, 1, 1); if($_G['forum']['type'] == 'sub') { C::t('forum_forum')->update($_G['forum']['fup'], array('lastpost' => $lastpost)); } } $feed = array(); if(!isset($_GET['addfeed'])) { $space = array(); space_merge($space, 'field_home'); $_GET['addfeed'] = $space['privacy']['feed']['newreply']; } if(!empty($_GET['addfeed']) && $_G['forum']['allowfeed'] && !$isanonymous) { if($special == 2 && !empty($_GET['trade'])) { $feed['icon'] = 'goods'; $feed['title_template'] = 'feed_thread_goods_title'; if($_GET['item_price'] > 0) { if($_G['setting']['creditstransextra'][5] != -1 && $_GET['item_credit']) { $feed['body_template'] = 'feed_thread_goods_message_1'; } else { $feed['body_template'] = 'feed_thread_goods_message_2'; } } else { $feed['body_template'] = 'feed_thread_goods_message_3'; } $feed['body_data'] = array( 'itemname'=> "$_GET[item_name]", 'itemprice'=> $_GET['item_price'], 'itemcredit'=> $_GET['item_credit'], 'creditunit'=> $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['unit'].$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['title'], ); if($_GET['tradeaid']) { $feed['images'] = array(getforumimg($_GET['tradeaid'])); $feed['image_links'] = array("forum.php?mod=viewthread&do=tradeinfo&tid=$_G[tid]&pid=$pid"); } } elseif($special == 3 && $thread['authorid'] != $_G['uid']) { $feed['icon'] = 'reward'; $feed['title_template'] = 'feed_reply_reward_title'; $feed['title_data'] = array( 'subject' => "$thread[subject]", 'author' => "$thread[author]" ); } elseif($special == 5 && $thread['authorid'] != $_G['uid']) { $feed['icon'] = 'debate'; if($stand == 1) { $feed['title_template'] = 'feed_thread_debatevote_title_1'; } elseif($stand == 2) { $feed['title_template'] = 'feed_thread_debatevote_title_2'; } else { $feed['title_template'] = 'feed_thread_debatevote_title_3'; } $feed['title_data'] = array( 'subject' => "$thread[subject]", 'author' => "$thread[author]" ); } elseif($thread['authorid'] != $_G['uid']) { $post_url = "forum.php?mod=redirect&goto=findpost&pid=$pid&ptid=$_G[tid]"; $feed['icon'] = 'post'; $feed['title_template'] = !empty($thread['author']) ? 'feed_reply_title' : 'feed_reply_title_anonymous'; $feed['title_data'] = array( 'subject' => "$thread[subject]", 'author' => "$thread[author]" ); if(!empty($_G['forum_attachexist'])) { $imgattach = C::t('forum_attachment_n')->fetch_max_image('tid:'.$_G['tid'], 'pid', $pid); $firstaid = $imgattach['aid']; unset($imgattach); if($firstaid) { $feed['images'] = array(getforumimg($firstaid)); $feed['image_links'] = array($post_url); } } } $feed['title_data']['hash_data'] = "tid{$_G[tid]}"; $feed['id'] = $pid; $feed['idtype'] = 'pid'; if($feed['icon']) { postfeed($feed); } } // $page = getstatus($thread['status'], 4) ? 1 : @ceil(($thread['special'] ? $thread['replies'] + 1 : $thread['replies'] + 2) / $_G['ppp']); if($updatethreaddata) { C::t('forum_thread')->update($_G['tid'], $updatethreaddata, false, false, 0, true); } /* if($special == 2 && !empty($_GET['continueadd'])) { dheader("location: forum.php?mod=post&action=reply&fid={$_G[forum][fid]}&firstpid=$pid&tid={$thread[tid]}&addtrade=yes"); } else { $url = empty($_POST['portal_referer']) ? "forum.php?mod=viewthread&tid={$thread[tid]}&pid=$pid&page=$page&extra=$extra#pid$pid" : $_POST['portal_referer']; } if(!isset($inspacecpshare)) { showmessage($replymessage, $url, $param); } */ } //} exit('[ok]replyno='.$_G['gp_replyno']); //zzcityadd //require_once libfile('post/newreply', '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; } //require DISCUZ_ROOT.'./source/module/forum/forum_'.$mod.'.php';替换结束 ?>