Code Analysis for Discuz Study (iv) Forum entry document, Discuz forum entrance
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 $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$cachelist; C:: App ()->init (); // Initialize Loadforum (); 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 ';
http://www.bkjia.com/PHPjc/966826.html www.bkjia.com true http://www.bkjia.com/PHPjc/966826.html techarticle Study on Discuz Code Analysis (iv) Forum entry file, Discuz forum entrance is just a rough analysis of the execution process, mainly to get mod parameter values, load the controller according to the value, control ...