discuz X3.4是否值得升级?是否6s有必要升级ios10吗到X3.4

如何升级到Discuz!X3.2教程!Discuz!X3.2正式发布!附升级简单教程 - 无忧主机
自始至终,以提供稳定、高性能的美国、香港免备案php虚拟主机产品为己任,以用户极高满意为生存价值,以产品的可靠性为生命线,以网络零中断为终身奋斗目标
相信大家都不陌生了,无忧主机小编也分享过很多关于该版本的教程。最近,万众瞩目的discuz!X3.2又和大家见面了。该版本最重要的一个更新就是添加了微信登陆功能、微社区等功能,当然安全性和功能性也得到了一定的优化。接下来无忧主机小编就给大家简单的介绍一下最新版本的升级方法。
首先附上最新版本程序下载地址:
Discuz!X3.2简体中文GBK版本:
/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip
Discuz!X3.2简体中文UTF-8版本:
/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip
最新版本的升级分为两种情况:
情况一、DiscuzX版本程序(discuzX1.0 1.5 2.0 2.5Beta 2.5RC 2.5 3.0)升级方法:
1)备份数据库
2)建立文件夹 old,旧程序除了 data , config, uc_client, uc_server 目录以外的程序移动进入 old目录中
3) 上传 3.2 程序(压缩包中 upload 目录中的文件), 如上传时候提示覆盖目录,请选择“是”
4)上传安装包 utility 目录中的 update.php 到论坛 install 目录,删除 install 目录中的index.php
执行 http://你的域名/论坛路径/install/update.php
参照提示进行升级即可。升级时间随着数据的大小和服务器性能而变。
升级完毕,进入后台,更新缓存,并测试功能。
升级成功后,old目录中的文件可以删除了。
情况二、Discuz!7.2或者以下版本的程序升级方法:
1)首先参看我们的转换教程, 将程序转换到 X2.0
2)上传 3.2 程序
3)上传 utility 目录中的 update.php 到 install 目录,删除目录中的index.php
执行 http://你的域名/论坛路径/install/update.php
以上就是两种情况的大致升级方法,无忧主机今后还会分享更多的关于discuz的教程回报各位站长朋友。有问题欢迎咨询右边的企业QQ。
无忧主机相关文章推荐阅读:
本文地址:/discuz/14708.html
喜欢本文或觉得本文对您有帮助,请分享给您的朋友 ^_^
无忧主机资质:(十三年旗舰品牌)
相关技术帮助文档
技术帮助文档分类Discuz!(135)
网站运营(124)
Discuz!有个外部数据调用的功能,可以把论坛的数据按一定的规则在其他网站调用使用,但是外部调用的帖子不能显示伪静态,让很多站长苦恼。
解决方法:
找到论坛目录下source\class\block\forum\block_thread.php
'url' =& 'forum.php?mod=viewthread&tid='.$data['tid'].($viewmod ? '&from=portal' : ''),
'url' =& 'thread-'.$data['tid'].'-1-1.html',
这里的伪静态根据自身设置调整!
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:351994次
积分:4175
积分:4175
排名:第7789名
原创:148篇
转载:13篇
评论:27条
文章:133篇
阅读:271262
(5)(12)(2)(2)(34)(90)(16)
(window.slotbydup = window.slotbydup || []).push({
id: '4740881',
container: s,
size: '200,200',
display: 'inlay-fix'私信发送成功
检测到您已登录开源中国,是否
捐赠收入将将全数捐赠给腾讯公益,让我们“爱·在一起”
感谢您的开源项目!
Fork 该项目?
使用 fork 功能将在后台会为你创建一个与该项目内容一样的同名项目,你可以在这个新项目里自由的修改内容。
建议只在有意向参与改进该项目时使用 fork 功能。
升级X3.4以后,Discuz!
InnoDB数据库补丁中的discuz_database_ext.php的某个地方需要修改,否则更新数据库缓存会报错
这个是官方的数据库补丁,X3.4之前一直可以正常使用

升级3.4以后,论坛的某些操作,例如插件,更新缓存等,会出现
Discuz! System Error
Call to undefined function mysql_query()
经过排查,发现是extend/class/discuz/discuz_database_ext.php 这个文件的问题,求大神修改
创建了 任务
希望可以直接官方支持 innodb
Discuz! System Error Call to undefined function mysql_query()
是不是不支持mysql_query,改成mysqli_query试试
$count = self::$db-&result(mysqli_query(self::$db-&curlink, "SELECT TABLE_ROWS FROM `TABLES` WHERE TABLE_SCHEMA = '$dbname' AND TABLE_NAME = '$table'"));

没有 discuz_database_ext 这个文件,php7 已经是 mysqli 了
说的不就是扩展补丁插件吗,DZ本身是没有这个文件的。

这里有人给了解决办法
后才可以发表评论拒绝访问 |
| 百度云加速
请打开cookies.
此网站 () 的管理员禁止了您的访问。原因是您的访问包含了非浏览器特征(3af5-ua98).
重新安装浏览器,或使用别的浏览器Discuz! X3.3-3.4 正式版论坛与群组接口
检查接口说明
1、接口文件名etchk_bbs.php,为保密,请自行修改文件名; 2、本接口文件请复制在网站根目录下使用; 3、主要参数  &&subject &&文章标题;   fid   &&论坛版块ID,用于限定检查范围,可不填;   vercode  请自行设定,并在检查接口文件开始处修改vercode使其一致; 4、发布配置-文章检查网址处,可以如下填写:   http://您的网址/etchk_bbs.php?vercode=&fid=&subject=&%title%&   注:使用大小写敏感的服务器的用户请注意网址大小写和网站文件一致 5、接口文件无须任何改动即可使用,如果你希望增加校验或其他功能,请仔细修改; &
检查接口代码
@$vercode=''; //此处取值请自行修改
if(isset($_POST['vercode'])){
if ($_POST['vercode']!=$vercode){
echo(&[err]invalid vercode[/err]&);
define('APPTYPEID', 0);
define('CURSCRIPT', 'search');
define('DISABLEXSSCHECK', true);
require './source/class/class_core.php';
$discuz = C::app();
$modarray = array('my', 'user', 'curforum', 'newthread');
$cachelist = $slist = array();
//$mod = '';
$mod = 'curforum'; //zzcity add
$discuz-&cachelist = $
$discuz-&init();
if(in_array($discuz-&var['mod'], $modarray) || !empty($_G['setting']['search'][$discuz-&var['mod']]['status'])) {
$mod = $discuz-&var['mod'];
foreach($_G['setting']['search'] as $mod =& $value) {
if(!empty($value['status'])) {
//runhooks();
require_once libfile('function/search');
$navtitle = lang('core', 'title_search');
if($mod == 'curforum') {
$mod = 'forum';
$_GET['srchfid'] = array($_GET['srhfid']);
} elseif($mod == 'forum') {
$_GET['srhfid'] = 0;
//require DISCUZ_ROOT.'./source/module/search/search_'.$mod.'.php';
[Discuz!] (C) Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: search_portal.php -21 05:25:03Z monkey $
//if(!defined('IN_DISCUZ')) {
exit('Access Denied');
define('NOROBOT', TRUE);
//if(!$_G['setting']['search']['forum']['status']) {
showmessage('search_forum_closed');
//if(!$_G['adminid'] && !($_G['group']['allowsearch'] & 2)) {
showmessage('group_nopermission', NULL, array('grouptitle' =& $_G['group']['grouptitle']), array('login' =& 1));
$_G['setting']['search']['forum']['searchctrl'] = intval($_G['setting']['search']['forum']['searchctrl']);
require_once libfile('function/forumlist');
require_once libfile('function/forum');
require_once libfile('function/post');
function charcovert($string) {
if(!get_magic_quotes_gpc()) {
$string = str_replace('\'', '\\\'', $string);
$string = str_replace('\&', '&', $string);
$srchtxt = trim($_GET['subject']);
$srchtxt = isset($srchtxt) ? dhtmlspecialchars($srchtxt) : '';
$fid = $_GET['fid'];
$fid=$fid ?
if (empty($srchtxt)){
exit('[err]no subject[/err]');
$srchtxtsql=addslashes($srchtxt);
$wherestr= $fid ? & and fid=$fid & : &&;
$query =DB::fetch_first(&SELECT tid FROM &.DB::table('forum_thread').& WHERE subject = '$srchtxtsql' $wherestr LIMIT 1&);
if(!$query) {
echo('[no]');
echo('[yes]');
发布接口说明
1、接口文件名etpost_bbs.php,为保密,请自行修改文件名; 2、本接口文件请复制在网站根目录下使用; 注:以下参数名后“=”号为示范取值而用,参数名本身不含“=”号; 固定取值的参数,可以在发布规则-参数取值中设置; &   采集取值的参数项,请在发布规则-发布项中添加; &
3、主要参数   username   会员名参数名   password   密码参数名   subject   主题标题参数名   message   内容参数名   etattachs   文件列表参数名
4、附加参数   fid   论坛版块编号(取值为您要发布的版面FID号)&   vercode   安全校验码,请自行设定,并须与发布接口文件开始处vercode值一致,本项用以防止接口被他人利用,如果需要进行更多校验,请自行填加相关代码。   ashowurl=   BBS文件显示URL,默认值“/data/attachment/forum”,通过本参数可支持更改默认附件目录,取值应与发布配置-文件显示URL相同;   tags   标签,多个请以空格或英文逗号分隔,不能使用方括号; 5、可选参数   typeid=   主题分类(如论坛未设必选主题分类,可以不用)   sortid   分类信息分类ID,若发布分类信息,此参数必须设置;   adddynamic=   是否转播给听众,默认留空,留空时只转播主题,为1时主题和回帖都转播,为0时不转播。   tagauto=1   是否启用自动获取标签,1为启用,当启用本项功能时,tags将不生效。   addfeed=1   启用发送动态,&1为启用   zzhour=1   拟真时间,发帖时间倒退小时数,默认为1,回复时间将自动间隔5-9分钟;   maxclick=200   最大随机点击数;   parseurloff=   禁用&URL&识别,0或留空为允许,1为禁止   bbcodeoff=   禁用&Discuz&代码,0或留空为允许,1为禁止   smileyoff=   禁用表情,0或留空为允许,1为禁止   isanonymous=0   使用匿名发帖,&1为启用   Usesig=1   使用个人签名,&1为启用   Readperm=   文章所需阅读权限      price=   文章售价   ordertype=   倒序看帖,&1为启用   Hiddenreplies=   回帖仅作者可见,&1为启用   allownoticeauthor   接收回复通知,&1为启用   htmlon=1   启用HTML代码,默认1,1为允许,0为禁止,当版块允许HTML时,如果本参数取值0,则帖子内容仍无法正常显示HTML代码;   save=   是否草稿,1为启用,DISUCZ!&X不允许回复草稿,所以当启用草稿状态时,回复不能成功。 &&&&6、定时发布参数   cronpublish=0   是否启用定时发布(预发布,需要该账号用户组有此权限),0或留空为禁止,1为使用;   cronpublishhour=0   推迟发布时间参数,为0表示不推迟,大于0时,表示推迟几个小时定时发布,如果当前时间分钟小于30,则在几小时后整点定时发布,如果当前时间分钟大于等于30,则在几小时30分定时发布。   当cronpublishhour大于0时,cronpublishdate无效;当cronpublishhour=0时,使用cronpublishdate设置的定时时间。   cronpublishdate   定时发布时间参数,标准时间格式“年-月-日&时:分”,其中分&必须为00或30;例如:&&12:30&。
&&&&7、回帖奖励参数 &&&&&&&&发布账号必须有足够的奖励。   replycredit_extcredits=0   每次回帖奖励多少,0或留空为不奖励;   replycredit_times=1   奖励多少次,最小取值1次;   replycredit_membertimes   每人最多可获得多少次,最小取值1次;   replycredit_random=100   中奖率百分比,取值范围10&C&100,10的倍数。 8、抢楼参数   rushreply   是否启用抢楼,1为是,必须有相关权限;   rushreplyfrom   抢楼起始时间,可以留空,标准长时间格式,例如“&17:47”;   rushreplyto   抢楼结束时间,可以留空,标准长时间格式,例如“&17:47”;   rewardfloor   奖励楼层,多个以英文逗号分隔;      stopfloor   截止楼层号,可留空;      replylimit   回帖限制数量,每个用户回帖次数上限,可留空;   creditlimit   积分下限,总积分大于此设置才能参与抢楼,可不填; &9、分类信息 &&&&本接口支持分类信息发布,分类信息参数名格式为&typeoption[字段1变量名]&,对应采集规则的分类信息数据项,如图: &   发布分类信息时,具体有哪些参数,请查看网站分类信息发帖网页源码的form表单内容。   多选类型字段的参数名格式,则为&typeoption[字段1变量名][]&;   发布分类信息时,必须设置分类信息分类ID参数&sortid;   本接口不支持“上传图片”类型的字段,建议以文本字段发布图片网址,并设置模板显示图片; 10、内容格式   当该版块允许HTML时,可发布HTML代码格式文章,此时Htmlon参数应设1或不填;   当该版块禁用HTML时,只能发布UBB代码格式文章,应在发布规则中勾选“使用UBB代码格式”和“保留换行符”;   由于UBB不能完整替代HTML,如果需要发布包含HTML代码的文章,应在网站管理中心-编辑版块-帖子选项中选择“允许使用HTML代码”;   要使用UBB发布如FLASH、视频等内容时,请使用采集规则将FLASH、视频等地址整理为Discuz&代码格式;   关于attach://aid格式:   DZX3默认不支持播放上传的媒体文件,用户需要到论坛管理面板“全局-上传设置”开启“附件&URL&地址、媒体附件播放”功能,并允许发布帐号权限,才能使用attach://aid的链接格式,如图: &   开启后,可以使用如&[audio]attach://音乐文件地址[/audio]、[flash]attach://动画文件地址[/flash]&等媒体UBB代码,将媒体文件在帖子内播放。
  注:使用这类UBB代码,设置的发布用户必须有相关权限,否则会被过滤;   用户可自行使用论坛支持的各种UBB功能代码,例如回复可见的代码是“[hide]内容[/hide]”,更多UBB功能代码请参考论坛发帖界面; 11、附件   如果要使用使用ET发布下载的附件,请在制定方案中,选择发布顺序为“先上传文件”;   附件入库,必须设置文件列表参数名etattachs,否则附件无法入库。   附加参数ashowurl(即BBS文件显示URL)的值应与“发布规则-基本设置-文件显示URL”相同;   文件显示URL的值,应与用户网站后台-上传设置-基本设置-附件&URL&地址对应,默认值是“http://您的dzx网站/data/attachment/forum”;   当网站更改了上传设置-附件&URL&地址时,该值应等于“附件&URL&地址”+“/forum”;   注意:部分用户的DZX网站程序并不是网站主程序,而是放在网站下的子目录,遇到这种情况时,应正确设置ashowurl&和&文件显示URL,加上子目录(例如&/bbs/&data/attachment/forum)或使用完整网址格式(例如&http://网站域名/DZX目录/&data/attachment/forum)。   本接口支持DZX远程附件功能,用户只需在DZX后台-上传设置开启远程附件,ET发布配置和不启用远程附件时完全相同(包括FTP的上传位置也是DZX的本地附件目录),接口会按照DZX后台设置自动将附件上传到远程空间,不须另作任何设置;    12、发布配置-文章发布网址处,可以如下填写:   http://您的网址/etpost_bbs.php   注:使用大小写敏感的服务器的用户请注意网址大小写和网站文件一致 13、接口文件无须任何改动即可使用,如果你希望增加校验或其他功能,请仔细修改;&& &
发布接口代码
@$vercode=''; //此处取值请自行修改
if(!empty($vercode)){
if ($_POST['vercode']!=$vercode){
echo(&[err]invalid vercode[/err]&);
foreach($_POST as $key=&$value){
$_GET[$key]=$
$_GET['mod']='post'; //zzcityadd
$_GET['action']='newthread'; //zzcityadd
if(isset($_GET['adddynamic'])){
$_POST['adddynamic'] =$_GET['adddynamic'] = trim($_GET['adddynamic'])=='' ? '1' : $_GET['adddynamic']; //zzcity add 如果未设置则默认转播
$_POST['adddynamic'] =$_GET['adddynamic']='1';
if(isset($_GET['cronpublish'])){
$_POST['cronpublish'] =$_GET['cronpublish'] = trim($_GET['cronpublish'])=='' ? '0' : $_GET['cronpublish']; //zzcity add 如果未设置则默认不预发布
$_POST['cronpublish'] =$_GET['cronpublish']='0';
if($_GET['cronpublish']='1'){
if(isset($_GET['cronpublishhour'])){
$_GET['cronpublishhour']=empty($_GET['cronpublishhour']) ? 0 :intval($_GET['cronpublishhour']);
$_GET['cronpublishhour']=0;
if ($_GET['cronpublishhour']&0){
$zzcrontime=time()+3600*$_GET['cronpublishhour'];
$zzcron=getdate($zzcrontime);
if($zzcron['minutes']&=30){
$_POST['cronpublishdate']=$_GET['cronpublishdate']=date(&Y-m-d H:30&);
$_POST['cronpublishdate']=$_GET['cronpublishdate']=date(&Y-m-d H:00&);
if(isset($_GET['cronpublishdate'])){
$_POST['cronpublishdate'] =$_GET['cronpublishdate'] = trim($_GET['cronpublishdate'])=='' ? '' : $_GET['cronpublishdate']; //zzcity add 如果未设置则默认不预发布
$_POST['cronpublishdate'] =$_GET['cronpublishdate']='';
if($_POST['cronpublishdate']&&''){
if (trim($_POST['cronpublishdate'])&&''){
$_POST['cronpublishdate']=str_replace(array('年', '月'), '-',$_POST['cronpublishdate']);
$_POST['cronpublishdate']=str_replace(array('日'), '',$_POST['cronpublishdate']);
if ($_POST['cronpublishdate'] && strlen(trim( $_POST['cronpublishdate'] )) &= 10) {
$_POST['cronpublishdate'] .= date('H:i');
if (strtotime($_POST['cronpublishdate'])==false||strtotime($_POST['cronpublishdate'])==-1){
echo(&[err]定时时间格式错误[/err]&);
$_GET['cronpublishdate'] =$_POST['cronpublishdate'];
if($_GET['rushreply']='1'){
$_GET['rushreplyfrom'] = strtotime($_GET['rushreplyfrom']);
$_GET['rushreplyto'] = strtotime($_GET['rushreplyto']);
$_GET['rewardfloor'] = trim($_GET['rewardfloor']);
$_GET['stopfloor'] = intval($_GET['stopfloor']);
$_GET['replylimit'] = intval($_GET['replylimit']);
$_GET['creditlimit'] = $_GET['creditlimit'] == '' ? '-996' : intval($_GET['creditlimit']);
if(isset($_GET['cronpublishdate'])){
$_POST['cronpublishdate'] =$_GET['cronpublishdate'] = trim($_GET['cronpublishdate'])=='' ? '' : $_GET['cronpublishdate']; //zzcity add 如果未设置则默认不预发布
$_POST['cronpublishdate'] =$_GET['cronpublishdate']='';
if($_POST['cronpublishdate']&&''){
if (trim($_POST['cronpublishdate'])&&''){
$_POST['cronpublishdate']=str_replace(array('年', '月'), '-',$_POST['cronpublishdate']);
$_POST['cronpublishdate']=str_replace(array('日'), '',$_POST['cronpublishdate']);
if ($_POST['cronpublishdate'] && strlen(trim( $_POST['cronpublishdate'] )) &= 10) {
$_POST['cronpublishdate'] .= date('H:i');
if (strtotime($_POST['cronpublishdate'])==false||strtotime($_POST['cronpublishdate'])==-1){
echo(&[err]定时时间格式错误[/err]&);
$_GET['cronpublishdate'] =$_POST['cronpublishdate'];
define('APPTYPEID', 2);
define('CURSCRIPT', 'forum');
define('DISABLEXSSCHECK', true);
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(
=& 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'),
=& array('bbcodes_display', 'bbcodes', 'smileycodes', 'smilies', 'smileytypes',
'domainwhitelist', 'albumcategory'),
=& array('fields_required', 'fields_optional', 'custominfo'),
=& 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];
$cachelist[] = 'plugin';
$cachelist[] = 'pluginlanguage_system';
if(C::app()-&var['mod'] == 'group') {
$_G['basescript'] = 'group';
C::app()-&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'] = $
loadcache('usergroup_'.$_G['groupid']);
C::app()-&session-&isnew =
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'];
loadforum();
//zzcityadd
$_G['group']['allowhtml']=$_G['gp_htmlon'];
$_G['forum']['allowhtml']=$_G['gp_htmlon'];
$zzhour = !isset($_G['gp_zzhour']) ? '1' : intval($_G['gp_zzhour']); //zzcity add
$zztimestamp =$_G['timestamp']=time()-$zzhour*60*60; //zzcity add
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]');
//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'];
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 = ' &em&&&/em& &a href=&group.php&&'.$_G['setting']['navs'][3]['navname'].'&/a& '.$nav['nav'];
loadcache('forums');
$returnurl = 'forum.php?mod=forumdisplay&fid='.$_G['fid'].(!empty($_GET['extra']) ? '&'.preg_replace(&/^(&)*/&, '', $_GET['extra']) : '');
$navigation = ' &em&&&/em& &a href=&forum.php&&'.$_G['setting']['navs'][2]['navname'].'&/a&';
if($_G['forum']['type'] == 'sub') {
$fup = $_G['cache']['forums'][$_G['forum']['fup']]['fup'];
$t_link = $_G['cache']['forums'][$fup]['type'] == 'group' ? 'forum.php?gid='.$fup : 'forum.php?mod=forumdisplay&fid='.$
$navigation .= ' &em&&&/em& &a href=&'.$t_link.'&&'.($_G['cache']['forums'][$fup]['name']).'&/a&';
if($_G['forum']['fup']) {
$fup = $_G['forum']['fup'];
$t_link = $_G['cache']['forums'][$fup]['type'] == 'group' ? 'forum.php?gid='.$fup : 'forum.php?mod=forumdisplay&fid='.$
$navigation .= ' &em&&&/em& &a href=&'.$t_link.'&&'.($_G['cache']['forums'][$fup]['name']).'&/a&';
$t_link = 'forum.php?mod=forumdisplay&fid='.$_G['fid'].($_GET['extra'] && !IS_ROBOT ? '&'.$_GET['extra'] : '');
$navigation .= ' &em&&&/em& &a href=&'.$t_link.'&&'.($_G['forum']['name']).'&/a&';
unset($t_link, $t_name);
periodscheck('postbanperiods');
//if($_G['forum']['password'] && $_G['forum']['password'] != $_G['cookie']['fidpw'.$_G['fid']]) {
// showmessage('forum_passwd', &forum.php?mod=forumdisplay&fid=$_G[fid]&);
if(empty($_G['forum']['allowview'])) {
if(!$_G['forum']['viewperm'] && !$_G['group']['readaccess']) {
showmessage('group_nopermission', NULL, array('grouptitle' =& $_G['group']['grouptitle']), array('login' =& 1));
} elseif($_G['forum']['viewperm'] && !forumperm($_G['forum']['viewperm'])) {
showmessagenoperm('viewperm', $_G['fid']);
} elseif($_G['forum']['allowview'] == -1) {
showmessage('forum_access_view_disallow');
formulaperm($_G['forum']['formulaperm']);
if(!$_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 : $
if(!$allowuploadnum) {
$allowuploadtoday =
if($_G['group']['maxsizeperday']) {
$allowuploadsize = $_G['group']['maxsizeperday'] - getuserprofile('todayattachsize');
$allowuploadsize = $allowuploadsize & 0 ? 0 : $
if(!$allowuploadsize) {
$allowuploadtoday =
$allowuploadsize = $allowuploadsize / 1048576 &= 1 ? round(($allowuploadsize / 1048576), 1).'MB' : round(($allowuploadsize / 1024)).'KB';
$allowpostimg = $_G['group']['allowpostimage'] && $
$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) : $
$message = isset($_GET['message']) ? censor($_GET['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');
$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&' : '';
$imgcontentcheck = !empty($thread['tid']) && getstatus($thread['status'], 15) ? 'checked=&checked&' : '';
$specialextra = !empty($_GET['specialextra']) ? $_GET['specialextra'] : '';
$_G['forum']['threadplugin'] = dunserialize($_G['forum']['threadplugin']);
if($specialextra && $_G['group']['allowpost'] && $_G['setting']['threadplugins'] &&
(!array_key_exists($specialextra, $_G['setting']['threadplugins']) ||
!@in_array($specialextra, is_array($_G['forum']['threadplugin']) ? $_G['forum']['threadplugin'] : 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']) {
if(empty($_GET['specialextra'])) {
foreach($_G['forum']['threadplugin'] as $tpid) {
if(array_key_exists($tpid, $_G['setting']['threadplugins']) && @in_array($tpid, $_G['group']['allowthreadplugin'])){
$specialextra=$
$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';
$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[] = $
$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');
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' || $_GET['action'] == 'newtrade') {
loadcache('groupreadaccess');
$navtitle .= ' - '.$_G['forum']['name'];
require_once libfile('post/newthread', 'include');
} elseif($_GET['action'] == 'reply') {
$navtitle .= ' - '.$thread['subject'].' - '.$_G['forum']['name'];
require_once libfile('post/newreply', 'include');
} elseif($_GET['action'] == 'edit') {
loadcache('groupreadaccess');
$navtitle .= ' - '.$thread['subject'].' - '.$_G['forum']['name'];
require_once libfile('post/editpost', 'include');
//require_once libfile('post/newthread', 'include');替换开始
//if(!defined('IN_DISCUZ')) {
// exit('Access Denied');
if(empty($_G['forum']['fid']) || $_G['forum']['type'] == 'group') {
// showmessage('forum_nonexistence');
exit('[err]'.lang('message', 'forum_nonexistence').'[/err]');
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));
exit('[err]'.lang('message', 'group_nopermission',array('grouptitle' =& $_G['group']['grouptitle'])).'[/err]');
/*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));
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_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)) {
$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[] = $
$savethreadothers[] = $
$savethreadcount = count($savethreads);
$savethreadothercount = count($savethreadothers);
if($savethreadothercount) {
loadcache('forums');
$savecount = $savethreadcount + $
unset($savethread);
$isfirstpost = 1;
$allownoticeauthor = 1;
$tagoffcheck = '';
$showthreadsorts = !empty($sortid) || $_G['forum']['threadsorts']['required'] && empty($special);
if(empty($sortid) && empty($special) && $_G['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 =
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 $
$classname = 'threadplugin_'.$
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'newthread')) {
$threadplughtml = $threadpluginclass-&newthread($_G['fid']);
$buttontext = lang('plugin/'.$specialextra, $threadpluginclass-&buttontext);
$iconfile = $threadpluginclass-&
$iconsflip = array_flip($_G['cache']['icons']);
$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');
//model_forum_thread.php开始
class model_zz_forum_thread extends discuz_model
public $feed = array();
public function __construct($fid = null) {
parent::__construct();
if($fid) {
include_once libfile('function/forum');
loadforum($fid);
$this-&forum = &$this-&app-&var['forum'];
public function newthread($parameters) {
require_once libfile('function/post');
$this-&tid = $this-&pid = 0;
$this-&_init_parameters($parameters);
if(trim($this-&param['subject']) == '') {
return $this-&showmessage('post_sm_isnull');
exit('[err]'.lang('message', 'post_sm_isnull').'[/err]');
if(!$this-&param['sortid'] && !$this-&param['special'] && trim($this-&param['message']) == '') {
return $this-&showmessage('post_sm_isnull');
exit('[err]'.lang('message', 'post_sm_isnull').'[/err]');
list($this-&param['modnewthreads'], $this-&param['modnewreplies']) = threadmodstatus($this-&param['subject'].&\t&.$this-&param['message'].$this-&param['extramessage']);
if(($post_invalid = checkpost($this-&param['subject'], $this-&param['message'], ($this-&param['special'] || $this-&param['sortid'])))) {
return $this-&showmessage($post_invalid, '', array('minpostsize' =& $this-&setting['minpostsize'], 'maxpostsize' =& $this-&setting['maxpostsize']));
exit('[err]'.lang('message',$post_invalid, array('minpostsize' =& $this-&setting['minpostsize'], 'maxpostsize' =& $this-&setting['maxpostsize'])).'[/err]');
if(checkflood()) {
return $this-&showmessage('post_flood_ctrl', '', array('floodctrl' =& $this-&setting['floodctrl']));
} elseif(checkmaxperhour('tid')) {
return $this-&showmessage('thread_flood_ctrl_threads_per_hour', '', array('threads_per_hour' =& $this-&group['maxthreadsperhour']));
$this-&param['save'] = $this-&member['uid'] ? $this-&param['save'] : 0;
$this-&param['typeid'] = isset($this-&param['typeid']) && isset($this-&forum['threadtypes']['types'][$this-&param['typeid']]) && (!$this-&forum['threadtypes']['moderators'][$this-&param['typeid']] || $this-&forum['ismoderator']) ? $this-&param['typeid'] : 0;
$this-&param['displayorder'] = $this-&param['modnewthreads'] ? -2 : (($this-&forum['ismoderator'] && $this-&group['allowstickthread'] && !empty($this-&param['sticktopic'])) ? 1 : (empty($this-&param['save']) ? 0 : -4));
if($this-&param['displayorder'] == -2) {
C::t('forum_forum')-&update($this-&forum['fid'], array('modworks' =& '1'));
$this-&param['digest'] = $this-&forum['ismoderator'] && $this-&group['allowdigestthread'] && !empty($this-&param['digest']) ? 1 : 0;
$this-&param['readperm'] = $this-&group['allowsetreadperm'] ? $this-&param['readperm'] : 0;
$this-&param['isanonymous'] = $this-&group['allowanonymous'] && $this-&param['isanonymous'] ? 1 : 0;
$this-&param['price'] = intval($this-&param['price']);
if(!$this-&param['special']) {
$this-&param['price'] = $this-&group['maxprice'] ? ($this-&param['price'] &= $this-&group['maxprice'] ? $this-&param['price'] : $this-&group['maxprice']) : 0;
if(!$this-&param['typeid'] && $this-&forum['threadtypes']['required'] && !$this-&param['special']) {
return $this-&showmessage('post_type_isnull');
exit('[err]'.lang('message', 'post_type_isnull').'[/err]');
if(!$this-&param['sortid'] && $this-&forum['threadsorts']['required'] && !$this-&param['special']) {
return $this-&showmessage('post_sort_isnull');
exit('[err]'.lang('message', 'post_sort_isnull').'[/err]');
if(!$this-&param['special'] && $this-&param['price'] & 0 && floor($this-&param['price'] * (1 - $this-&setting['creditstax'])) == 0) {
return $this-&showmessage('post_net_price_iszero');
exit('[err]'.lang('message', 'post_net_price_iszero').'[/err]');
$this-&param['sortid'] = $this-&param['special'] && $this-&forum['threadsorts']['types'][$this-&param['sortid']] ? 0 : $this-&param['sortid'];
$this-&param['typeexpiration'] = intval($this-&param['typeexpiration']);
if($this-&forum['threadsorts']['expiration'][$this-&param['typeid']] && !$this-&param['typeexpiration']) {
return $this-&showmessage('threadtype_expiration_invalid');
exit('[err]'.lang('message', 'threadtype_expiration_invalid').'[/err]');
$author = !$this-&param['isanonymous'] ? $this-&member['username'] : '';
$this-&param['moderated'] = $this-&param['digest'] || $this-&param['displayorder'] & 0 ? 1 : 0;
$this-&param['ordertype'] && $this-&param['tstatus'] = setstatus(4, 1, $this-&param['tstatus']);
$this-&param['imgcontent'] && $this-&param['tstatus'] = setstatus(15, $this-&param['imgcontent'], $this-&param['tstatus']);
$this-&param['hiddenreplies'] && $this-&param['tstatus'] = setstatus(2, 1, $this-&param['tstatus']);
$this-&param['allownoticeauthor'] && $this-&param['tstatus'] = setstatus(6, 1, $this-&param['tstatus']);
$this-&param['isgroup'] = $this-&forum['status'] == 3 ? 1 : 0;
$newthread = array(
'fid' =& $this-&forum['fid'],
'posttableid' =& 0,
'readperm' =& $this-&param['readperm'],
'price' =& $this-&param['price'],
'typeid' =& $this-&param['typeid'],
'sortid' =& $this-&param['sortid'],
'author' =& $author,
'authorid' =& $this-&member['uid'],
'subject' =& $this-&param['subject'],
'dateline' =& $this-&param['publishdate'],
'lastpost' =& $this-&param['publishdate'],
'lastposter' =& $author,
'displayorder' =& $this-&param['displayorder'],
'digest' =& $this-&param['digest'],
'special' =& $this-&param['special'],
'attachment' =& 0,
'moderated' =& $this-&param['moderated'],
'status' =& $this-&param['tstatus'],
'isgroup' =& $this-&param['isgroup'],
'replycredit' =& $this-&param['replycredit'],
'closed' =& $this-&param['closed'] ? 1 : 0,
'views' =& $this-&param['views']
$this-&tid = C::t('forum_thread')-&insert($newthread, true);
C::t('forum_newthread')-&insert(array(
'tid' =& $this-&tid,
'fid' =& $this-&forum['fid'],
'dateline' =& $this-&param['publishdate'],
useractionlog($this-&member['uid'], 'tid');
if(!getuserprofile('threads') && $this-&setting['newbie']) {
C::t('forum_thread')-&update($this-&tid, array('icon' =& $this-&setting['newbie']));
if ($this-&param['publishdate'] != TIMESTAMP) {
$cron_publish_ids = dunserialize($this-&cache('cronpublish'));
$cron_publish_ids[$this-&tid] = $this-&
$cron_publish_ids = serialize($cron_publish_ids);
savecache('cronpublish', $cron_publish_ids);
if(!$this-&param['isanonymous']) {
C::t('common_member_field_home')-&update($this-&member['uid'], array('recentnote'=&$this-&param['subject']));
if($this-&param['moderated']) {
updatemodlog($this-&tid, ($this-&param['displayorder'] & 0 ? 'STK' : 'DIG'));
updatemodworks(($this-&param['displayorder'] & 0 ? 'STK' : 'DIG'), 1);
$this-&param['bbcodeoff'] = checkbbcodes($this-&param['message'], !empty($this-&param['bbcodeoff']));
$this-&param['smileyoff'] = checksmilies($this-&param['message'], !empty($this-&param['smileyoff']));
$this-&param['parseurloff'] = !empty($this-&param['parseurloff']);
$this-&param['htmlon'] = $this-&group['allowhtml'] && !empty($this-&param['htmlon']) ? 1 : 0;
$this-&param['usesig'] = !empty($this-&param['usesig']) && $this-&group['maxsigsize'] ? 1 : 0;
$class_tag = new tag();
$this-&param['tagstr'] = $class_tag-&add_tag($this-&param['tags'], $this-&tid, 'tid');
$this-&param['pinvisible'] = $this-&param['modnewthreads'] ? -2 : (empty($this-&param['save']) ? 0 : -3);
$this-&param['message'] = preg_replace('/\[attachimg\](\d+)\[\/attachimg\]/is', '[attach]\1[/attach]', $this-&param['message']);
$this-&param['pstatus'] = intval($this-&param['pstatus']);
defined('IN_MOBILE') && $this-&param['pstatus'] = setstatus(4, 1, $this-&param['pstatus']);
if($this-&param['imgcontent']) {
stringtopic($this-&param['message'], $this-&tid, true, $this-&param['imgcontentwidth']);
$this-&pid = insertpost(array(
'fid' =& $this-&forum['fid'],
'tid' =& $this-&tid,
'first' =& '1',
'author' =& $this-&member['username'],
'authorid' =& $this-&member['uid'],
'subject' =& $this-&param['subject'],
'dateline' =& $this-&param['publishdate'],
'message' =& $this-&param['message'],
'useip' =& $this-&param['clientip'] ? $this-&param['clientip'] : getglobal('clientip'),
'invisible' =& $this-&param['pinvisible'],
'anonymous' =& $this-&param['isanonymous'],
'usesig' =& $this-&param['usesig'],
'htmlon' =& $this-&param['htmlon'],
'bbcodeoff' =& $this-&param['bbcodeoff'],
'smileyoff' =& $this-&param['smileyoff'],
'parseurloff' =& $this-&param['parseurloff'],
'attachment' =& '0',
'tags' =& $this-&param['tagstr'],
'replycredit' =& 0,
'status' =& $this-&param['pstatus']
$statarr = array(0 =& 'thread', 1 =& 'poll', 2 =& 'trade', 3 =& 'reward', 4 =& 'activity', 5 =& 'debate', 127 =& 'thread');
include_once libfile('function/stat');
updatestat($this-&param['isgroup'] ? 'groupthread' : $statarr[$this-&param['special']]);
if($this-&param['geoloc'] && IN_MOBILE == 2) {
list($mapx, $mapy, $location) = explode('|', $this-&param['geoloc']);
if($mapx && $mapy && $location) {
C::t('forum_post_location')-&insert(array(
'pid' =& $this-&pid,
'tid' =& $this-&tid,
'uid' =& $this-&member['uid'],
'mapx' =& $mapx,
'mapy' =& $mapy,
'location' =& $location,
if($this-&param['modnewthreads']) {
updatemoderate('tid', $this-&tid);
C::t('forum_forum')-&update_forum_counter($this-&forum['fid'], 0, 0, 1);
manage_addnotify('verifythread');
return 'post_newthread_mod_succeed';
if($this-&param['displayorder'] != -4) {
if($this-&param['digest']) {
updatepostcredits('+',
$this-&member['uid'], 'digest', $this-&forum['fid']);
updatepostcredits('+',
$this-&member['uid'], 'post', $this-&forum['fid']);
if($this-&param['isgroup']) {
C::t('forum_groupuser')-&update_counter_for_user($this-&member['uid'], $this-&forum['fid'], 1);
$subject = str_replace(&\t&, ' ', $this-&param['subject']);
$lastpost = &$this-&tid\t&.$subject.&\t&.TIMESTAMP.&\t$author&;
C::t('forum_forum')-&update($this-&forum['fid'], array('lastpost' =& $lastpost));
C::t('forum_forum')-&update_forum_counter($this-&forum['fid'], 1, 1, 1);
if($this-&forum['type'] == 'sub') {
C::t('forum_forum')-&update($this-&forum['fup'], array('lastpost' =& $lastpost));
if($this-&param['isgroup']) {
C::t('forum_forumfield')-&update($this-&forum['fid'], array('lastupdate' =& TIMESTAMP));
require_once libfile('function/grouplog');
updategroupcreditlog($this-&forum['fid'], $this-&member['uid']);
C::t('forum_sofa')-&insert(array('tid' =& $this-&tid,'fid' =& $this-&forum['fid']));
return 'post_newthread_succeed';
public function feed() {
if($this-&forum('allowfeed') && !$this-&param['isanonymous']) {
if(empty($this-&feed)) {
$this-&feed = array(
'icon' =& '',
'title_template' =& '',
'title_data' =& array(),
'body_template' =& '',
'body_data' =& array(),
'title_data' =& array(),
'images' =& array()
$message = !$this-&param['price'] && !$this-&param['readperm'] ? $this-&param['message'] : '';
$message = messagesafeclear($message);
$this-&feed['icon'] = 'thread';
$this-&feed['title_template'] = 'feed_thread_title';
$this-&feed['body_template'] = 'feed_thread_message';
$this-&feed['body_data'] = array(
'subject' =& &&a href=\&forum.php?mod=viewthread&tid={$this-&tid}\&&{$this-&param['subject']}&/a&&,
'message' =& messagecutstr($message, 150)
if(getglobal('forum_attachexist')) {//
$firstaid = DB::result_first(&SELECT aid FROM &.DB::table(getattachtablebytid($tid)).& WHERE pid='$pid' AND dateline&'0' AND isimage='1' ORDER BY dateline LIMIT 1&);
$imgattach = C::t('forum_attachment_n')-&fetch_max_image('tid:'.$this-&tid, 'pid', $this-&pid);
$firstaid = $imgattach['aid'];
unset($imgattach);
if($firstaid) {
$this-&feed['images'] = array(getforumimg($firstaid));
$this-&feed['image_links'] = array(&forum.php?mod=viewthread&do=tradeinfo&tid={$this-&tid}&pid={$this-&pid}&);
$this-&feed['title_data']['hash_data'] = 'tid'.$this-&
$this-&feed['id'] = $this-&
$this-&feed['idtype'] = 'tid';
if($this-&feed['icon']) {
postfeed($this-&feed);
protected function _init_parameters($parameters){
$varname = array(
'member', 'group', 'forum', 'extramessage',
'subject', 'sticktopic', 'save', 'ordertype', 'hiddenreplies',
'allownoticeauthor', 'readperm', 'price', 'typeid', 'sortid',
'publishdate', 'digest', 'moderated', 'tstatus', 'isgroup', 'imgcontent', 'imgcontentwidth',
'replycredit', 'closed', 'special', 'tags',
'message','clientip', 'invisible', 'isanonymous', 'usesig',
'htmlon', 'bbcodeoff', 'smileyoff', 'parseurloff', 'pstatus', 'geoloc','views'
foreach($varname as $name) {
if(!isset($this-&param[$name]) && isset($parameters[$name])) {
$this-&param[$name] = $parameters[$name];
public function forum($name = null, $val = null) {
if(isset($val)) {
return $this-&setvar($this-&forum, $name, $val);
return $this-&getvar($this-&forum, $name);
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]';
C::t('forum_forum')-&update_commoncredits(intval($mygroupid[0]));
$modthread = C::m('zz_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;
$publishdate = $_G['timestamp'];
$publishdate = $_G['timestamp'];
$params['publishdate'] = $
$params['save'] = $_GET['save'];
$params['sticktopic'] = $_GET['sticktopic'];
$params['digest'] = $_GET['addtodigest'];
$params['readperm'] = $
$params['isanonymous'] = $_GET['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 == 2) {
$modthread-&attach_before_method('feed', array('class' =& $specials[$special], 'method' =& 'before_replyfeed'));
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_'.$
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).$
$params['typeexpiration'] = $_GET['typeexpiration'];
$params['ordertype'] = $_GET['ordertype'];
$params['hiddenreplies'] = $_GET['hiddenreplies'];
$params['allownoticeauthor'] = $_GET['allownoticeauthor'];
//自动标签
if ($_GET['tagauto']==1){
$subjectenc = rawurlencode(strip_tags($subject));
$messageenc =messagecutstr($message, 400);
$messageenc = rawurlencode(strip_tags(preg_replace(&/\[.+?\]/U&, '', $messageenc)));
$data = @implode('', file(&/related_kw.html?ics=&.CHARSET.&&ocs=&.CHARSET.&&title=$subjectenc&content=$messageenc&));
if($data) {
if(PHP_VERSION & '5' && CHARSET != 'utf-8') {
require_once libfile('class/chinese');
$chs = new Chinese('utf-8', CHARSET);
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $data, $values, $index);
xml_parser_free($parser);
$kws = array();
foreach($values as $valuearray) {
if($valuearray['tag'] == 'kw' || $valuearray['tag'] == 'ekw') {
$kws[] = !empty($chs) ? $chs-&convert(trim($valuearray['value'])) : trim($valuearray['value']);
$zztags = '';
if($kws) {
foreach($kws as $kw) {
$kw = dhtmlspecialchars($kw);
$zztags .= $kw.' ';
$_GET['tags']
= dhtmlspecialchars($zztags);
$params['tags'] = $_GET['tags'];
$params['bbcodeoff'] = $_GET['bbcodeoff'];
$params['smileyoff'] = $_GET['smileyoff'];
$params['parseurloff'] = $_GET['parseurloff'];
$params['usesig'] = $_GET['usesig'];
$params['htmlon'] = $_GET['htmlon'];
$views=rand(30,$_GET['maxclick']);
$params['views'] =$
if($_G['group']['allowimgcontent']) {
$params['imgcontent'] = $_GET['imgcontent'];
$params['imgcontentwidth'] = $_G['setting']['imgcontentwidth'] ? intval($_G['setting']['imgcontentwidth']) : 100;
$params['geoloc'] = diconv($_GET['geoloc'], 'UTF-8');
if($_GET['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);
//zzcity add
function zzfileext($filename) {
return strtolower(substr(strrchr($filename, '.'), 1, 10));
$attachlist=explode(',',$_POST['etattachs']);
$curattachs='';
foreach ($attachlist as $key =& $value) {
$value=trim($value);
if(empty($value))
if (preg_match(&/&.preg_quote($value,&/&).&/i&,$message)){
$message=preg_replace(&/&a([^&]*?)&.preg_quote($value,&/&).&([^&]*?)&img([^&]*?)&.preg_quote($value,&/&).&([^&]*?)&\/(.*?)&/i&,'[attachimg]'.$value.'[/attachimg]',$message);
$message=preg_replace(&/&img([^&]*?)&.preg_quote($value,&/&).&([^&]*?)&/i&,'[attachimg]'.$value.'[/attachimg]',$message);
$message=preg_replace(&/\[img([^\]]*?)\]&.preg_quote($value,&/&).&\[\/img\]/i&,'[attachimg]'.$value.'[/attachimg]',$message);
$message=preg_replace(&/&a([^&]*?)&.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($value),array(&wma&,&mp3&,&ra&,&rm&))) {
$message=preg_replace(&/&embed([^&]*?)&.preg_quote($value,&/&).&([^&]*?)&\/embed&/i&,'[audio=1]'.$value.'[/audio]',$message);
$message=preg_replace(&/&embed([^&]*?)&.preg_quote($value,&/&).&([^&]*?)&/i&,'[audio=1]'.$value.'[/audio]',$message);
(in_array(zzfileext($value), array('wmv','rmvb','avi','mov'))){
$message=preg_replace(&/&embed([^&]*?)&.preg_quote($value,&/&).&([^&]*?)&\/embed&/i&,'[media='.zzfileext($value).',500,375,1]'.$value.'[/media]',$message);
$message=preg_replace(&/&embed([^&]*?)&.preg_quote($value,&/&).&([^&]*?)&/i&,'[media='.zzfileext($value).',500,375,1]'.$value.'[/media]',$message);
(in_array(zzfileext($value), array('swf','flv'))){
$message=preg_replace(&/&embed([^&]*?)&.preg_quote($value,&/&).&([^&]*?)&\/embed&/i&,'[flash]'.$value.'[/flash]',$message);
$message=preg_replace(&/&embed([^&]*?)&.preg_quote($value,&/&).&([^&]*?)&/i&,'[flash]'.$value.'[/flash]',$message);
$curattachs.= empty($curattachs) ? $value:','.$
$message = preg_replace('/\[attachimg\](.+?)\[\/attachimg\]/is', '[attach]\1[/attach]', $message);
$params['message'] =$
//zzcity close
$return = $modthread-&newthread($params);
$tid = $modthread-&
$pid = $modthread-& //zzcity
//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);
$zzattachtype=0;
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,$
$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-&
$thistype='forum';
$attach=array();
if (strpos($filename,'/')){
$attach['name'] =
trim(substr(strrchr($filename,'/'),1));
$attach['name'] =
trim($filename);
$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'] = $
$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');
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')&);
$this-&uploadmsg(0);
foreach ($curalist as $key =& $value) {
$oldvalue=$
$value=str_replace($ashowurl,'',$value);
$aid=zzforum_upload($value);
$message=str_replace(']'.$oldvalue.'[',']'.$aid.'[',$message);
$message=str_replace(&attach://&.$oldvalue,'attach://'.$aid.'.'.zzfileext($oldvalue),$message);
C::t('forum_thread')-&update($tid, array('attachment'=&$zzattachtype));
C::t('forum_post')-&update('tid:'.$tid, $pid, array('message' =& $message,'attachment' =& $zzattachtype), true);
foreach($aids as $key =& $value){
convertunusedattach($value,$tid,$pid);
if(getglobal('setting/ftp/on')){
ftpupload($aids,intval($_G['uid']));
//zzcity add attachment close
$threadimageaid = 0;
$threadimage = array();
if($special == 4 && $_GET['activityaid']) {
$threadimageaid = $_GET['activityaid'];
convertunusedattach($_GET['activityaid'], $tid, $pid);
if($_G['forum']['threadsorts']['types'][$sortid] && !empty($_G['forum_optiondata']) && is_array($_G['forum_optiondata']) && $sortaids) {
foreach($sortaids as $sortaid) {
convertunusedattach($sortaid, $tid, $pid);
// if(($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) && ($_GET['attachnew'] || $sortid || !empty($_GET['activityaid']))) {
if($attachnum){
updateattach($displayorder == -4 || $modnewthreads, $tid, $pid, $_GET['attachnew']);
if(!$threadimageaid) {
$threadimage = C::t('forum_attachment_n')-&fetch_max_image('tid:'.$tid, 'tid', $tid);
$threadimageaid = $threadimage['aid'];
$values = array('fid' =& $_G['fid'], 'tid' =& $tid, 'pid' =& $pid, 'coverimg' =& '');
$param = array();
if($_G['forum']['picstyle']) {
if(!setthreadcover($pid, 0, $threadimageaid)) {
preg_match_all(&/(\[img\]|\[img=\d{1,4}[x|\,]\d{1,4}\])\s*([^\[\&\r\n]+?)\s*\[\/img\]/is&, $message, $imglist, PREG_SET_ORDER);
$values['coverimg'] = &&p id=\&showsetcover\&&&.lang('message', '

我要回帖

更多关于 显卡有必要升级吗 的文章

 

随机推荐