您现在的位置是:首页 > cms教程 > Discuz教程Discuz教程

discuz代码分析论坛入口文件

觅波2025-07-13Discuz教程已有人查阅

导读只是大致分析下执行流程,主要就是取得mod参数的值,根据取值加载控制器,控制器位置在之后一行指定了。1 )定义应用名称,加载两个必要文件

只是大致分析下执行流程,主要就是取得mod参数的值,根据取值加载控制器,控制器位置在之后一行指定了。
1 )定义应用名称,加载两个必要文件
define('APPTYPEID', 2);
define('CURSCRIPT', 'forum');
require './source/class/class_core.php';//核心类
require './source/function/function_forum.php';//论坛函数库
2 )modarray数组限定了mod取值范围
$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'),
);
3 )如果mod参数为空或者不合法都会让表达式为真,导致值为index
$mod = !in_array(C::app()->var['mod'], $modarray) ? 'index' : C::app()->var['mod'];
4 )做初始化
define('CURMODULE', $mod);
//var_dump(CURMODULE);
$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 = $cachelist;
C::app()->init();//初始化
loadforum();
set_rssauth();
runhooks();
5 )加载控制器
$navtitle = str_replace('{bbname}', $_G['setting']['bbname'], $_G['setting']['seotitle']['forum']);
$_G['setting']['threadhidethreshold'] = 1;
//var_dump($mod);
require DISCUZ_ROOT.'./source/module/forum/forum_'.$mod.'.php';

本文标签:

很赞哦! ()

相关源码

  • pbootcms模板(PC+WAP)火锅加盟餐饮美食类带留言源码基于PbootCMS内核深度开发,为火锅、餐饮品牌打造的营销型解决方案。采用红色主题传递行业活力,实现PC与WAP端适配。查看源码
  • (自适应)橙色家政服务清洁保洁服务pbootcms网站模板源码下载模板核心价值:基于PbootCMS内核开发的家政服务类网站模板,通过模块化设计展现服务项目、团队风采、服务案例等核心板块,突出时效预约、服务标准化展示等家政行业特性。查看源码
  • (自适应)五金配件机械蓝色营销型pbootcms模板免费下载基于PbootCMS的工业配件展示系统,精简DIV+CSS架构确保响应速度,自适应设计呈现参数表格,支持后台实时更新产品规格、在线留言等内容。查看源码
  • (自适应)蓝色厨卫厨房水龙头阀门水槽设备源码下载基于PbootCMS内核开发,深度适配厨卫设备行业特性。通过精准的产品展示模块与水效标识专区设计,有效呈现五金件工艺细节。响应式布局确保从手机到平板都能展示金属质感与水流动态效果。查看源码
  • (自适应响应式)水墨风白酒酿制酒业酒文化酒类产品网站源码下载本模板基于PbootCMS内核开发,为酒类企业打造的水墨风响应式网站解决方案。采用传统东方美学设计语言,呈现白酒文化底蕴,自适应移动端展示效果,数据实时同步更新,助力酒企建立专业数字化形象。查看源码
  • 帝国cms淘宝客京东联盟网站整站源码下载本模板基于帝国CMS内核深度开发,为淘宝客行业量身定制。随着腾讯微信与淘宝生态的互联互通,淘宝客链接现可在微信、QQ等平台直接分享,为推广带来更多便利。模板特别优化了店铺推广功能,有效避免商品下架导致的链接失效问题,同时支持京东联盟等多平台商品推广。查看源码
分享笔记 (共有 篇笔记)
验证码:

本栏推荐