Code Analysis for Discuz Study (iv) Forum entry document

Source: Internet
Author: User

Just a rough analysis of the execution process, mainly to obtain the MoD parameter value, according to the value of loading the controller, the controller position is specified in the last line.

1) define the application name and load two necessary files

Define (' Apptypeid ', 2); Define (' Curscript ', ' Forum '); require './source/class/class_core.php '; // Core Class require './source/function/function_forum.php '; // Forum Function Library

2) Modarray array limits the range of mod values

$modarray=Array(' Ajax ', ' announcement ', ' attachment ', ' forumdisplay ', ' group ', ' image ', ' Index ', ' Medal ', ' Misc ', ' MODCP ', ' notice ', ' Post ', ' redirect ', ' relatekw ', ' relatethread ', ' rss ', ' topicadmin ', ' Trade ', ' viewthread ', ' tags ', ' collection ', ' Guide ');//a list of module caches, each of which represents the cache entries to be cached by each module$modcachelist=Array(    ' Index ' =Array(' Announcements ', ' onlinelist ', ' forumlinks ', ' heats ', ' historyposts ', ' Onlinerecord ', ' userstats ', ' Diytemplat ' Enameforum '), ' forumdisplay ' =Array(' Smilies ', ' announcements_forum ', ' globalstick ', ' forums ', ' onlinelist ', ' Forumstick ', ' threadtable_info ', ' th Readtableids ', ' 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) If the MoD parameter is empty or illegal, it will make the expression true, resulting in a value of index

$mod =! In_array (C::app ()var$modarray)? ' Index ': C::app ()var[' MoD '];

4) Do initialization

Define(' Curmodule ',$mod);//Var_dump (curmodule);$cachelist=Array();if(isset($modcachelist[Curmodule])) {//if the current cache entry exists,    $cachelist=$modcachelist[Curmodule];//Gets the cache list item for the current cache group    $cachelist[] = ' plugin '; $cachelist[] = ' Pluginlanguage_system ';}if(C::app ()var[' mod '] = = ' Group ') {    $_g[' basescript '] = ' group ';} C:: App ()->cachelist =$cachelist; C:: App ()->init ();//InitializeLoadforum (); Set_rssauth (); Runhooks ();

5) Load Controller

$navtitle Str_replace $_g $_g [' Setting '] [' Seotitle '] [' Forum ']); $_g [' Setting '] [' threadhidethreshold '] = 1; // Var_dump ($mod); require Discuz_root. '. /source/module/forum/forum_ '. $mod. " PHP ';

Code Analysis for Discuz Study (iv) Forum entry document

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.