Discuz!7.2 common.inc.php 学习
<?php
error_reporting(0); //禁用错误报告
//set_magic_quotes_runtime:所有的溢出字符,当遇到反斜杆、单引号,将会自动加上一个反斜杆,保护系统和数据库的安全。
//set_magic_quotes_runtime(0) 为关闭。
set_magic_quotes_runtime(0);
//获取时间戳数组
$mtime = explode(' ', microtime());
$discuz_starttime = $mtime[1] + $mtime[0];
define('SYS_DEBUG', FALSE);//调试?
define('IN_DISCUZ', TRUE);//未知
define('DISCUZ_ROOT', substr(dirname(__FILE__), 0, -7));//当前目录 -7是为了扣除当前文件夹/include
define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());//检测是否开启set_magic_quotes_runtime
//!defined('CURSCRIPT') && define('CURSCRIPT', '');
//$_GET 等是在4.0后才有
if(PHP_VERSION $_value) {
$_key{0} != '_' && $$_key = daddslashes($_value);
}
}
if (!MAGIC_QUOTES_GPC && $_FILES) {
$_FILES = daddslashes($_FILES);
}
$charset = $dbs = $dbcharset = $forumfounders = $metakeywords = $extrahead = $seodescription = $mnid = '';
$plugins
= $admincp = $scriptlang = $forum = $thread = $language = $jsmenu =
$actioncode = $modactioncode = $pluginclasses = $hooks = $lang =
array();
$_DCOOKIE = $_DSESSION = $_DCACHE = $_DPLUGIN = $advlist = array();
//配置信息
require_once DISCUZ_ROOT.'./config.inc.php';
// 论坛访问页面防御开关,可避免用户通过非法的url地址对本站用户造成危害,建议打开。1=打开 0关闭
//过滤<和“?貌似能用html编码绕过吧
if($urlxssdefend && !empty($_SERVER['REQUEST_URI'])) {
$temp = urldecode($_SERVER['REQUEST_URI']);
if(strpos($temp, ' $val) {
if(substr($key, 0, $prelength) == $cookiepre) {
$_DCOOKIE[(substr($key, $prelength))] = MAGIC_QUOTES_GPC ? $val : daddslashes($val);
}
}
unset($prelength, $_request, $_key, $_value);
/*
* 这段不明真相
*/
$inajax = !empty($inajax);
$handlekey = !empty($handlekey) ? htmlspecialchars($handlekey) : '';
$timestamp = time();
/*论坛防御级别,可防止大量的非正常请求造成的拒绝服务攻击
防护大量非正常请求造成的拒绝服务攻击,
0=关闭, 1=cookie 刷新限制, 2=限制代理访问, 4=二次请求, 8=回答问题(第一次访问时需要回答问题)
组合为: 1|2, 1|4, 2|8, 1|2|4...
*/
if($attackevasive && (!define('CURSCRIPT') || CURSCRIPT != 'seccode')) {
require_once DISCUZ_ROOT.'./include/security.inc.php';
}
//这样会不会被注入?
require_once DISCUZ_ROOT.'./include/db_'.$database.'.class.php';
//当前运行程序或者脚本
$PHP_SELF = dhtmlspecialchars($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);
//当前文件
$BASESCRIPT = basename($PHP_SELF);
list($BASEFILENAME) = explode('.', $BASESCRIPT);
//路径
$boardurl
=
htmlspecialchars('http://'.$_SERVER['HTTP_HOST'].preg_replace("//+(api|archiver|wap)?/*$/i",
'', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))).'/');
//获取真实IP
if(getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) {
$onlineip = getenv('HTTP_CLIENT_IP');
} elseif(getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown')) {
$onlineip = getenv('HTTP_X_FORWARDED_FOR');
} elseif(getenv('REMOTE_ADDR') && strcasecmp(getenv('REMOTE_ADDR'), 'unknown')) {
$onlineip = getenv('REMOTE_ADDR');
}
elseif(isset($_SERVER['REMOTE_ADDR']) &&
$_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'],
'unknown')) {
$onlineip = $_SERVER['REMOTE_ADDR'];
}
preg_match("/[d.]{7,15}/", $onlineip, $onlineipmatches);
$onlineip = $onlineipmatches[0] ? $onlineipmatches[0] : 'unknown';
unset($onlineipmatches);
//缓存
$cachelost = (@include DISCUZ_ROOT.'./forumdata/cache/cache_settings.php') ? ' : 'settings';
@extract($_DCACHE['settings']);
/*看晕了。
*BINDDOMAIN在Index.php中设置为index
*$cachelost为是否有缓存。$binddomains和$forumdomains是神马东西?//应该是从cache_settiongs.php获取
*个人猜测:可能是解决cookie中的域名和现在域名不同出现的问题吧
*/
if(defined('BINDDOMAIN') && BINDDOMAIN && !$cachelost && $binddomains && $forumdomains) {
//继续不明真相
$loadforum = isset($binddomains[$_SERVER['HTTP_HOST']]) ? max(0, intval($binddomains[$_SERVER['HTTP_HOST']])) : 0;
if($loadforum) {
if(BINDDOMAIN == 'forumdisplay' && $loadforum == $fid) {
header("HTTP/1.1 301 Moved Permanently");
$query_string = preg_replace('/??fid='.$fid.'&?/is', '', $_SERVER['QUERY_STRING']);
//重定向到什么地方?
dheader("Location: http://$_SERVER[HTTP_HOST]/{$indexname}".($query_string ? "?{$query_string}" : '));
}
if(BINDDOMAIN == 'index') {
$fid = $_GET['fid'] = $_REQUEST['fid'] = $loadforum;
define('CURSCRIPT', 'forumdisplay');
}
} else {
if(BINDDOMAIN == 'forumdisplay' && isset($forumdomains[$fid])) {
$host = $forumdomains[$fid];
header("HTTP/1.1 301 Moved Permanently");
dheader("Location: http://{$host}/{$indexname}");
}
define('CURSCRIPT', BINDDOMAIN);
}
}
//仍然不明真相
if(!defined('CURSCRIPT')) {
define('CURSCRIPT', defined('BINDDOMAIN') ? BINDDOMAIN : ');
}
if(!defined('STAT_ID') && isset($statdisable) && empty($statdisable)) {
define('STAT_ID', $_DCACHE['settings']['statid']);
define('STAT_KEY', $_DCACHE['settings']['statkey']);
}
//开启gzip压缩
if($gzipcompress
&& function_exists('ob_gzhandler') &&
!in_array(CURSCRIPT, array('attachment', 'wap')) && !$inajax) {
ob_start('ob_gzhandler');
} else {
$gzipcompress = 0;
ob_start();
}
if(!empty($loadctrl) && substr(PHP_OS, 0, 3) != 'WIN') {
//非win系统下的负载
if($fp = @fopen('/proc/loadavg', 'r')) {
list($loadaverage) = explode(' ', fread($fp, 6));
fclose($fp);
//如果大于负载
if($loadaverage > $loadctrl) {
header("HTTP/1.0 503 Service Unavailable");
include DISCUZ_ROOT.'./include/serverbusy.htm';
exit();
}
}
}
//看是否能引用缓存页面。如果不行就把CURSCRIPT加到$cachelost中
if(in_array(CURSCRIPT, array('index', 'forumdisplay', 'viewthread', 'post', 'topicadmin', 'register', 'archiver'))) {
$cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/cache_'.CURSCRIPT.'.php') ? ' ': ' '.CURSCRIPT;
}
//实例化数据库(为什么数据库的类文件这么早引入现在才实例化)
$db = new dbstuff;
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset);
$dbuser = $dbpw = $pconnect = $sdb = NULL;
//获取sid
$sid = daddslashes(($transsidstatus || CURSCRIPT == 'wap') && (isset($_GET['sid']) || isset($_POST['sid'])) ?
(isset($_GET['sid']) ? $_GET['sid'] : $_POST['sid']) :
(isset($_DCOOKIE['sid']) ? $_DCOOKIE['sid'] : '));
//如果CURSCRIPT是attachment 就用GET获取sid(authcode解密)
CURSCRIPT
== 'attachment' && isset($_GET['sid']) && $sid =
addslashes(authcode($_GET['sid'], 'DECODE',
$_DCACHE['settings']['authkey']));
//访问者信息加密
$discuz_auth_key = md5($_DCACHE['settings']['authkey'].$_SERVER['HTTP_USER_AGENT']);
//又是这种风格。多几行代码会死人啊?
//cookie中的auth值按t分割,分别赋给为$discuz_pw, $discuz_secques, $discuz_uid
list($discuz_pw,
$discuz_secques, $discuz_uid) = empty($_DCOOKIE['auth']) ? array('',
'', 0) : daddslashes(explode("t", authcode($_DCOOKIE['auth'],
'DECODE')), 1);
$prompt = $sessionexists = $seccode = 0;
//M.M 下面这段我理解成一条SQL语句的一段。ORZ
$membertablefields = 'm.uid AS discuz_uid, m.username AS discuz_user, m.password AS discuz_pw, m.secques AS discuz_secques,
m.adminid, m.groupid, m.groupexpiry, m.extgroupids, m.email, m.timeoffset, m.tpp, m.ppp, m.posts, m.threads, m.digestposts,
m.oltime, m.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5,
m.extcredits6, m.extcredits7, m.extcredits8, m.timeformat, m.dateformat, m.pmsound, m.sigstatus, m.invisible,
m.lastvisit, m.lastactivity, m.lastpost, m.prompt, m.accessmasks,
m.editormode, m.customshow, m.customaddfeed, m.newbietaskid';
if($sid) {//有sid
if($discuz_uid) {//cookid中有值
//联合查询 session 和 members
//上面那串莫名字符派上用场了。果然是sql语句的一段。
$query = $db->query("SELECT s.sid, s.styleid, s.groupid='6' AS
ipbanned, s.pageviews AS spageviews, s.lastolupdate, s.seccode,
$membertablefields
FROM {$tablepre}sessions s, {$tablepre}members m
WHERE m.uid=s.uid AND s.sid='$sid' AND CONCAT_WS('.',s.ip1,s.ip2,s.ip3,s.ip4)='$onlineip' AND m.uid='$discuz_uid'
AND m.password='$discuz_pw' AND m.secques='$discuz_secques'");
} else {
//cookie中没有的话只用sessions
$query = $db->query("SELECT sid, uid AS sessionuid, groupid,
groupid='6' AS ipbanned, pageviews AS spageviews, styleid, lastolupdate,
seccode
FROM {$tablepre}sessions WHERE sid='$sid' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='$onlineip'");
}
//数据放入_DSESSION
if($_DSESSION = $db->fetch_array($query)) {
//这个变量应该是指代是否在线吧。。
$sessionexists = 1;
if(!empty($_DSESSION['sessionuid'])) {
//查询members得到一堆值也放入$_DSESSION
$_DSESSION = array_merge($_DSESSION, $db->fetch_first("SELECT $membertablefields
FROM {$tablepre}members m WHERE uid='$_DSESSION[sessionuid]'"));
}
} else {
//上面的上面的SQL语句查询失败。则按照无cookie重新查询
//清除COOKIE(应该是防止伪造cookie吧)
if($_DSESSION = $db->fetch_first("SELECT sid, groupid,
groupid='6' AS ipbanned, pageviews AS spageviews, styleid, lastolupdate,
seccode
FROM {$tablepre}sessions WHERE sid='$sid' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='$onlineip'")) {
clearcookies();
$sessionexists = 1;
}
}
}
//不在线
if(!$sessionexists) {
if($discuz_uid) {//但是cookie存在
//cookie无法登陆。系伪造。清除cookie
if(!($_DSESSION = $db->fetch_first("SELECT $membertablefields, m.styleid
FROM {$tablepre}members m WHERE m.uid='$discuz_uid' AND
m.password='$discuz_pw' AND m.secques='$discuz_secques'"))) {
clearcookies();
}
}
//判断是否该IP不允许登陆
if(ipbanned($onlineip)) $_DSESSION['ipbanned'] = 1;
//重新生成sid
$_DSESSION['sid'] = random(6);
$_DSESSION['seccode'] = random(6, 1);
}
//这三行表示看不懂
$_DSESSION['dateformat']
= empty($_DSESSION['dateformat']) ||
empty($_DCACHE['settings']['userdateformat'][$_DSESSION['dateformat']
-1])? $_DCACHE['settings']['dateformat'] :
$_DCACHE['settings']['userdateformat'][$_DSESSION['dateformat'] -1];
$_DSESSION['timeformat']
= empty($_DSESSION['timeformat']) ? $_DCACHE['settings']['timeformat'] :
($_DSESSION['timeformat'] == 1 ? 'h:i A' : 'H:i');
$_DSESSION['timeoffset']
= isset($_DSESSION['timeoffset']) && $_DSESSION['timeoffset']
!= 9999 ? $_DSESSION['timeoffset'] : $_DCACHE['settings']['timeoffset'];
//清空
$membertablefields = '';
@extract($_DSESSION);
$disableprompt = !empty($_DCOOKIE['disableprompt']) ? explode('|', $_DCOOKIE['disableprompt']) : array();
//这个是上面定义的变量,用途未知
//补:$prompt是members表中字段。不过这段代码作用仍然不知
if($prompt) {
if($taskon && ($prompt & 8)) {
$prompts['newbietask'] = 1;
$disallowfloat = str_replace('task','', $disallowfloat);
$disallowfloat .= '|newthread|reply';
$editormode = 0;
}
$prompt = 0;
$query = $db->query("SELECT typeid, number FROM {$tablepre}prompt WHERE uid='$discuz_uid'");
while($promptrow = $db->fetch_array($query)) {
if($disableprompt && in_array($promptkeys[$promptrow['typeid']], $disableprompt)) {
continue;
}
$prompt = $promptrow['number'] ? 1 : $prompt;
$prompts[$promptkeys[$promptrow['typeid']]]['new'] = $promptrow['number'];
}
}
if($announcepm && !in_array('announcepm', $disableprompt)) {
$prompts['announcepm']['new'] = $announcepm;
}
//$lastvisit也在member表中,应该是上次访问时间。-86400应该是24小时前吧
$lastvisit = empty($lastvisit) ? $timestamp - 86400 : $lastvisit;
//这句没看懂
$timenow = array('time' => gmdate("$dateformat $timeformat", $timestamp + 3600 * $timeoffset),
'offset' => ($timeoffset >= 0 ? ($timeoffset == 0 ? ' : '+'.$timeoffset) : $timeoffset));
if(PHP_VERSION > '5.1') {
//date_default_timezone_set()函数的作用是:设定用于一个脚本中所有日期时间函数的默认时区。
@date_default_timezone_set('Etc/GMT'.($timeoffset > 0 ? '-' : '+').(abs($timeoffset)));
}
$accessadd1 = $accessadd2 = $modadd1 = $modadd2 = $metadescription = $hookscriptmessage = ';
if(empty($discuz_uid) || empty($discuz_user)) {
//未登录用户初始化
$discuz_user = $extgroupids = '';
$discuz_uid = $adminid = $posts = $digestposts = $pageviews = $oltime = $invisible
= $credits = $extcredits1 = $extcredits2 = $extcredits3 = $extcredits4
= $extcredits5 = $extcredits6 = $extcredits7 = $extcredits8 = 0;
$groupid = empty($groupid) || $groupid != 6 ? 7 : 6;
} else {
//以登陆用户
$discuz_userss = $discuz_user;
$discuz_user = addslashes($discuz_user);
//这个也是Member表的数据。作用不明
//组合sql语句
if($accessmasks) {
$accessadd1 = ', a.allowview, a.allowpost, a.allowreply, a.allowgetattach, a.allowpostattach';
$accessadd2 = "LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid";
}
//这个也是member的数据。字面理解应该是管理员ID之类的吧
if($adminid == 3) {
$modadd1 = ', m.uid AS ismoderator';
$modadd2 = "LEFT JOIN {$tablepre}moderators m ON m.uid='$discuz_uid' AND m.fid=f.fid";
}
}
//这句不明真相
if($errorreport == 2 || ($errorreport == 1 && $adminid > 0)) {
error_reporting(E_ERROR | E_WARNING | E_PARSE);
}
//获得一个拼装值。
define('FORMHASH', formhash());
//statstatus在cache_setting.php中。
//后面引用的是网站统计。这个变量应该是标记是否统计流量等信息吧
$statstatus && !$inajax && require_once DISCUZ_ROOT.'./include/counter.inc.php';
//$extra该参数作用不明
$extra = isset($extra) && @preg_match("/^[&=;a-z0-9]+$/i", $extra) ? $extra : ';
$rsshead = $navtitle = $navigation = '';
//字面理解 groupid应该和权限有关系
$_DSESSION['groupid'] = $groupid = empty($ipbanned) ? (empty($groupid) ? 7 : intval($groupid)) : 6;
//如果文件中没有就到数据库里查找
if(!@include DISCUZ_ROOT.'./forumdata/cache/usergroup_'.$groupid.'.php') {
$grouptype = $db->result_first("SELECT type FROM {$tablepre}usergroups WHERE groupid='$groupid'");
if(!empty($grouptype)) {
$cachelost .= ' usergroup_'.$groupid;
} else {
$grouptype = 'member';
}
}
/*
$link_login = 'logging.php?action=login';
$link_logout = 'logging.php?action=logout&formhash='.FORMHASH;
$link_register = $regname;
*/
//有登陆的用户
if($discuz_uid && $_DSESSION) {
//用处不明。$groupexpiry在members中。过期用户?
if(!empty($groupexpiry) && $groupexpiry $grouptype,
'creditshigher' => $groupcreditshigher,
'creditslower' => $groupcreditslower
), $_DSESSION)) {
//又一个extract。我的神
@extract($_DSESSION);
$cachelost .= (@include
DISCUZ_ROOT.'./forumdata/cache/usergroup_'.intval($groupid).'.php') ? ' :
' usergroup_'.$groupid;
}
}
//值不是1、2、3的管理员帐户,将各个参数置零
if(!in_array($adminid, array(1, 2, 3))) {
$alloweditpost = $alloweditpoll = $allowstickthread = $allowmodpost = $allowdelpost = $allowmassprune
= $allowrefund = $allowcensorword = $allowviewip = $allowbanip = $allowedituser = $allowmoduser
= $allowbanuser = $allowpostannounce = $allowviewlog = $disablepostctrl = 0;
} elseif(isset($radminid) && $adminid != $radminid && $adminid != $groupid) {
//管理员引入管理员缓存页面
$cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/admingroup_'.intval($adminid).'.php') ? ' : ' admingroup_'.$groupid;
}
//应该是页数文章ID、主题ID、类别ID。后面两个不知道是啥
$page = isset($page) ? max(1, intval($page)) : 1;
$tid = isset($tid) && is_numeric($tid) ? $tid : 0;
$fid = isset($fid) && is_numeric($fid) ? $fid : 0;
$typeid = isset($typeid) ? intval($typeid) : 0;
$tpp = intval(empty($_DSESSION['tpp']) ? $topicperpage : $_DSESSION['tpp']);
$ppp = intval(empty($_DSESSION['ppp']) ? $postperpage : $_DSESSION['ppp']);
$modthreadkey = isset($modthreadkey) && $modthreadkey == modthreadkey($tid) ? $modthreadkey : '';
$auditstatuson = $modthreadkey ? true : false;
//主题和文章都不为空
if(!empty($tid) || !empty($fid)) {
//组合sql语句。字面理解可能也是权限相关
if(empty($tid)) {
$forum = $db->fetch_first("SELECT f.fid, f.*, ff.* $accessadd1 $modadd1, f.fid AS fid
FROM {$tablepre}forums f
LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid $accessadd2 $modadd2
WHERE f.fid='$fid'");
} else {
//这个应该是具体的文章了。
$forum = $db->fetch_first("SELECT t.tid,
t.closed,".(defined('SQL_ADD_THREAD') ? SQL_ADD_THREAD : ')." f.*, ff.*
$accessadd1 $modadd1, f.fid AS fid
FROM {$tablepre}threads t
INNER JOIN {$tablepre}forums f ON f.fid=t.fid
LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid $accessadd2 $modadd2
WHERE t.tid='$tid'".($auditstatuson ? ' : " AND t.displayorder>='0'")." LIMIT 1");
$tid = $forum['tid'];
}
//这个也不明白
if($forum) {
$fid = $forum['fid'];
$forum['ismoderator'] = !empty($forum['ismoderator']) || $adminid == 1 || $adminid == 2 ? 1 : 0;
foreach(array('postcredits', 'replycredits', 'threadtypes',
'threadsorts', 'digestcredits', 'postattachcredits', 'getattachcredits',
'modrecommend') as $key) {
$forum[$key] = !empty($forum[$key]) ? unserialize($forum[$key]) : array();
}
} else {
$fid = 0;
}
}
//敢不敢不要写那么长!
//不知道什么意思。
$styleid = intval(!empty($_GET['styleid']) ? $_GET['styleid'] :
(!empty($_POST['styleid']) ? $_POST['styleid'] :
(!empty($_DSESSION['styleid']) ? $_DSESSION['styleid'] :
$_DCACHE['settings']['styleid'])));
//我的神……又赋了个值
//既然上一句都那么长了,这句干嘛不和上句连一起?
$styleid = intval(isset($styles[$styleid]) ? $styleid : $_DCACHE['settings']['styleid']);
//继续缓存页面。界面主题?
if(@!include DISCUZ_ROOT.'./forumdata/cache/style_'.intval(!empty($forum['styleid']) ? $forum['styleid'] : $styleid).'.php') {
$cachelost .= (@include
DISCUZ_ROOT.'./forumdata/cache/style_'.($styleid =
$_DCACHE['settings']['styleid']).'.php') ? ' : ' style_'.$styleid;
}
//没有缓存,则更新缓存。
if($cachelost) {
require_once DISCUZ_ROOT.'./include/cache.func.php';
updatecache();
exit('Cache List: '.$cachelost.'<br />Caches successfully created, please refresh.');
}
//非手机页面
if(CURSCRIPT != 'wap') {
//不晓得那里的变量。字面理解应该是判断是否设置缓存
if($nocacheheaders) {
@dheader("Expires: 0");
@dheader("Cache-Control: private, post-check=0, pre-check=0, max-age=0", FALSE);
@dheader("Pragma: no-cache");
}
// $headercharset在config.inc.php上。
//强制论坛页面使用默认字符集,可避免部分服务器空间页面出现乱码,一般无需开启。 0=关闭 1= 开启
if($headercharset) {
@dheader('Content-Type: text/html; charset='.$charset);
}
if(empty($_DCOOKIE['sid']) || $sid != $_DCOOKIE['sid']) {
dsetcookie('sid', $sid, 604800, 1, true);
}
}
//作者对三元运算符情有独钟。
$_DCOOKIE['loginuser'] = !empty($_DCOOKIE['loginuser']) ? substr(htmlspecialchars($_DCOOKIE['loginuser']), 0, 15) : '';
//该参数也是在cache_setting.php上。
//定时清空数据。
if($cronnextrun && $cronnextrun $include) {
if(!$include['adminid'] || ($include['adminid'] &&
$adminid > 0 && $include['adminid'] >= $adminid)) {
if(@in_array($pluginid, $pluginlangs)) {
@include_once DISCUZ_ROOT.'./forumdata/cache/cache_scriptlang.php';
}
@include_once DISCUZ_ROOT.'./plugins/'.$include['script'].'.inc.php';
}
}
}
//字面理解应该是是否有权限进入。
//不知道这个变量那里来的。
if(isset($allowvisit)
&& $allowvisit == 0 && !(CURSCRIPT == 'member'
&& ($action == 'groupexpiry' || $action == 'activate'))) {
showmessage('user_banned', NULL, 'HALTED');
} elseif(!(in_array(CURSCRIPT, array('logging', 'wap', 'seccode', 'ajax')) || $adminid == 1)) {
//这个变量也是未知/
if($bbclosed) {
clearcookies();
$closedreason = $db->result_first("SELECT value FROM {$tablepre}settings WHERE variable='closedreason'");
showmessage($closedreason ? $closedreason : 'board_closed', NULL, 'NOPERM');
}
//函数在global.func.php中。不明真相
periodscheck('visitbanperiods');
}
//这句也看不懂。
if((!empty($fromuid)
|| !empty($fromuser)) && ($creditspolicy['promotion_visit'] ||
$creditspolicy['promotion_register'])) {
require_once DISCUZ_ROOT.'/include/promotion.inc.php';
}
//uchome数组也找不到出处。
if($uchome['addfeed']) {
$customaddfeed = $customaddfeed == '-1' ? 0 : ($customaddfeed == 0 ? $uchome['addfeed'] : intval($customaddfeed));
} else {
$customaddfeed = 0;
}
//又是三句神句。
$rssauth
= $rssstatus && $discuz_uid ?
rawurlencode(authcode("$discuz_uidt".($fid ? $fid :
')."t".substr(md5($discuz_pw.$discuz_secques), 0, 8), 'ENCODE',
md5($_DCACHE['settings']['authkey']))) : '0';
$transferstatus = $transferstatus && $allowtransfer;
$feedpostnum = $feedpostnum && $uchomeurl ? intval($feedpostnum) : 0;
$pluginhooks = array();//这个是做啥的?
//脚本关联?应该是和加载插件有关。
if(isset($hookscript[CURSCRIPT]['module'])) {
hookscript(CURSCRIPT);
}
//这段估计也和一些二次开发相关。该页面和函数暂时没看懂。
if($discuz_uid && $newbietaskupdate && $lastactivity