Press "Enter" to skip to content

对Discuz批量发帖的分析

第一步先测试无附件发帖
正常发帖流程分析
表单forum.php?mod=post&action=newthread&fid=3&extra=&topicsubmit=yes
表单提交按钮名 :topicsubmit
代码寻找
upload\source\module\forum\forum_post.php
206行对获取主题和内容的处理:
$subject = isset($_GET[‘subject’]) ? dhtmlspecialchars(censor(trim($_GET[‘subject’]), NULL, FALSE, FALSE)) : ”;
$subject = !empty($subject) ? str_replace(“\t”, ‘ ‘, $subject) : $subject;
$message = isset($_GET[‘message’]) ? censor($_GET[‘message’], NULL, FALSE, FALSE) : ”;
$sortid = intval(getgpc(‘sortid’));

316行:

require_once libfile(‘post/newthread’, ‘include’);

upload\source\include\post\post_newthread.php
142行开始查看提交后处理=======================================================
160行注意组装存储对象
$params = array(
‘subject’ => $subject, //标题
‘message’ => $message, // 内容
‘typeid’ => $typeid,
‘sortid’ => $sortid, //分类id 如果帖子是分类信息型帖子
‘special’ => $special, //特殊主题~~如投票或自定义
);

180行对$params补充了:
$params[‘publishdate’] = $publishdate;//发布时间
$params[‘save’] = $_GET[‘save’];
$params[‘sticktopic’] = getgpc(‘sticktopic’);
$params[‘digest’] = getgpc(‘addtodigest’);
$params[‘readperm’] = $readperm;
$params[‘isanonymous’] = getgpc(‘isanonymous’);
$params[‘price’] = $_GET[‘price’];

231行对$params补充了:
$params[‘typeexpiration’] = getgpc(‘typeexpiration’);
$params[‘ordertype’] = getgpc(‘ordertype’);
$params[‘hiddenreplies’] = getgpc(‘hiddenreplies’);
$params[‘allownoticeauthor’] = $_GET[‘allownoticeauthor’];
$params[‘tags’] = $_GET[‘tags’];
$params[‘bbcodeoff’] = getgpc(‘bbcodeoff’);
$params[‘smileyoff’] = getgpc(‘smileyoff’);
$params[‘parseurloff’] = getgpc(‘parseurloff’);
$params[‘usesig’] = $_GET[‘usesig’];
$params[‘htmlon’] = getgpc(‘htmlon’);

276和277行:
$modthread->attach_before_methods(‘newthread’, $bfmethods);
$modthread->attach_after_methods(‘newthread’, $afmethods);
$return = $modthread->newthread($params);

模型类:source/class/model/model_forum_thread.php
38行public function newthread($parameters)
61行防灌水需要打掉
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’]));
}

86行:

//主题分类
if(!$this->param['typeid'] && !empty($this->forum['threadtypes']['required']) && !$this->param['special']) {
return $this->showmessage('post_type_isnull');
}    
//分类信息
    if(!$this->param['sortid'] && !empty($this->forum['threadsorts']['required']) && !$this->param['special']) {
        return $this->showmessage('post_sort_isnull');
    }

    //特殊主题
    if(!$this->param['special'] && $this->param['price'] > 0 && floor($this->param['price'] * (1 - $this->setting['creditstax'])) == 0) {
        return $this->showmessage('post_net_price_iszero');
    }

240行由于是新帖只会进if不会进else:
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’;
}

第二步、附件和图片内容
附件和图片内容的猜测:
先上传上传完成返回附件id 图片id, 然后组装内容,然后走发帖流程

关于webupload.js中console.log(22) 输出导致SWFUpload 对象错误的判断

当我以if(2){ alert(2)} 这样的格式做输出诊断的时候以上错误消失了,那么我判断应该是console.log(3) 导致js对象格式错了,而if(3){dddd}这样的格式刚好适应js对象格式

发表评论