对discuz的代码分析学习(四)论坛入口文件,discuz论坛入口
对discuz的代码分析学习(四)论坛入口文件,discuz论坛入口
只是大致分析下执行流程,主要就是取得mod参数的值,根据取值加载控制器,控制器位置在最后一行指定了。
1 )定义应用名称,加载两个必要文件
<span>define</span>('APPTYPEID', 2<span>); </span><span>define</span>('CURSCRIPT', 'forum'<span>); </span><span>require</span> './source/class/class_core.php';<span>//</span><span>核心类</span> <span>require</span> './source/function/function_forum.php';<span>//</span><span>论坛函数库</span>
2 )modarray数组限定了mod取值范围
<span>$modarray</span> = <span>array</span>('ajax','announcement','attachment','forumdisplay', 'group','image','index','medal','misc','modcp','notice','post','redirect', 'relatekw','relatethread','rss','topicadmin','trade','viewthread','tag','collection','guide'<span> ); </span><span>//</span><span>模块缓存列表,各个子数组分别表示各个模块要缓存的缓存项</span> <span>$modcachelist</span> = <span>array</span><span>( </span>'index' => <span>array</span>('announcements', 'onlinelist', 'forumlinks', 'heats', 'historyposts', 'onlinerecord', 'userstats', 'diytemplatenameforum'), 'forumdisplay' => <span>array</span>('smilies', 'announcements_forum', 'globalstick', 'forums', 'onlinelist', 'forumstick', 'threadtable_info', 'threadtableids', 'stamps', 'diytemplatenameforum'), 'viewthread' => <span>array</span>('smilies', 'smileytypes', 'forums', 'usergroups', 'stamps', 'bbcodes', 'smilies', 'custominfo', 'groupicon', 'stamps', 'threadtableids', 'threadtable_info', 'posttable_info', 'diytemplatenameforum'), 'redirect' => <span>array</span>('threadtableids', 'threadtable_info', 'posttable_info'), 'post' => <span>array</span>('bbcodes_display', 'bbcodes', 'smileycodes', 'smilies', 'smileytypes', 'domainwhitelist', 'albumcategory'), 'space' => <span>array</span>('fields_required', 'fields_optional', 'custominfo'), 'group' => <span>array</span>('grouptype', 'diytemplatenamegroup'),<span> );</span>
3 )如果mod参数为空或者不合法都会让表达式为真,导致值为index
<span>$mod</span> = !<span>in_array</span>(C::app()-><span>var</span>['mod'], <span>$modarray</span>) ? 'index' : C::app()-><span>var</span>['mod'];
4 )做初始化
<span>define</span>('CURMODULE', <span>$mod</span><span>); </span><span>//</span><span>var_dump(CURMODULE);</span> <span>$cachelist</span> = <span>array</span><span>(); </span><span>if</span>(<span>isset</span>(<span>$modcachelist</span>[CURMODULE])) {<span>//</span><span>如果当前缓存项存在的话,</span> <span>$cachelist</span> = <span>$modcachelist</span>[CURMODULE];<span>//</span><span>获取当前缓存组的缓存列表项</span> <span>$cachelist</span>[] = 'plugin'<span>; </span><span>$cachelist</span>[] = 'pluginlanguage_system'<span>; } </span><span>if</span>(C::app()-><span>var</span>['mod'] == 'group'<span>) { </span><span>$_G</span>['basescript'] = 'group'<span>; } C</span>::app()->cachelist = <span>$cachelist</span><span>; C</span>::app()->init();<span>//</span><span>初始化</span> <span> loadforum(); set_rssauth(); runhooks();</span>
5 )加载控制器
<span>$navtitle</span> = <span>str_replace</span>('{bbname}', <span>$_G</span>['setting']['bbname'], <span>$_G</span>['setting']['seotitle']['forum'<span>]); </span><span>$_G</span>['setting']['threadhidethreshold'] = 1<span>; </span><span>//</span><span>var_dump($mod);</span> <span>require</span> DISCUZ_ROOT.'./source/module/forum/forum_'.<span>$mod</span>.'.php';

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The solution to the Discuz background login problem is revealed. Specific code examples are needed. With the rapid development of the Internet, website construction has become more and more common, and Discuz, as a commonly used forum website building system, has been favored by many webmasters. However, precisely because of its powerful functions, sometimes we encounter some problems when using Discuz, such as background login problems. Today, we will reveal the solution to the Discuz background login problem and provide specific code examples. We hope to help those in need.

"Exploring Discuz: Definition, Functions and Code Examples" With the rapid development of the Internet, community forums have become an important platform for people to obtain information and exchange opinions. Among the many community forum systems, Discuz, as a well-known open source forum software in China, is favored by the majority of website developers and administrators. So, what is Discuz? What functions does it have, and how can it help our website? This article will introduce Discuz in detail and attach specific code examples to help readers learn more about it.

A must-have for Discuz users! Comprehensive analysis of renaming props! In the Discuz forum, the name change function has always received much attention and demand from users. For some users who need to change their name, name change props can easily modify the user name, and this is also an interesting way of interaction. Let’s take an in-depth look at the renaming props in Discuz, including how to obtain them, how to use them, and solutions to some common problems. 1. Obtain name-changing props in Discuz. Name-changing props are usually purchased through points or the administrator

What should I do if I encounter an incorrect Discuz password? Quick solution sharing! Discuz! It is a very popular forum program that provides users with a platform for convenient communication. Using Discuz! When accessing a forum, sometimes you may encounter an incorrect password, which may cause users to be unable to log in and use the forum normally. Well, meet Discuz! When the password is wrong, how should we quickly solve the problem? Some solutions will be shared below, with specific code examples provided for reference. 1. Check whether the password

Discuz background login failed? Teach you how to solve it easily! As Discuz, as a popular forum platform, is widely used in website construction and management, sometimes you will encounter backend login failures, which is troubling. Today we will discuss the issues that may cause Discuz backend login failure, provide some solutions, and attach specific code examples. I hope this article can help webmasters and developers who encounter similar problems. 1. Troubleshooting is to solve the problem of Discuz background login failure.

"Detailed Explanation of Discuz Registration Process: Allowing you to easily modify personal information, specific code examples are required" Discuz is a powerful community forum program that is widely used in various websites. It provides a wealth of user registration and personal information modification. functions and interfaces. This article will introduce you to Discuz's registration process in detail and provide specific code examples to help you easily customize and modify your personal information. 1. User registration process In Discuz, user registration is one of the important functions of the site. The smoothness of the registration process and

Title: To solve the problem that Discuz WeChat shares cannot be displayed, specific code examples are needed. With the development of the mobile Internet, WeChat has become an indispensable part of people's daily lives. In website development, in order to improve user experience and expand website exposure, many websites will integrate WeChat sharing functions, allowing users to easily share website content to Moments or WeChat groups. However, sometimes when using open source forum systems such as Discuz, you will encounter the problem that WeChat shares cannot be displayed, which brings certain difficulties to the user experience.

Detailed explanation of the steps to modify the Discuz domain name. Specific code examples are required. With the development and operation of the website, sometimes we need to modify the domain name of the Discuz forum. This may be due to brand change, website SEO optimization, or other reasons. No matter what the reason is, modifying the Discuz domain name is a process that requires careful operation. Today we will introduce the steps of modifying the Discuz domain name in detail and provide specific code examples. Step 1: Back up data. Before modifying the domain name, you must first ensure that the website
