Who has the complete Discuz7 Source Code Analysis (Directory, file structure, functions of each file, template structure, more complete code comments, etc ?, PHPcode & lt ;? Php/* [Discuz!] (C) 2001-2009ComsenzInc.ThisisNOT Discuz7 php source code
Who has complete Discuz7 Source Code Analysis (Directory, file structure, functions of each file, template structure, more complete code comments, etc.), the more comprehensive the better, thank you?
PHP code
$ _ Value) {$ _ key {0 }! = '_' & $ _ Key = daddslashes ($ _ value) ;}// filter $ _ FILES, that is, add reference if (! MAGIC_QUOTES_GPC & $ _ FILES) {$ _ FILES = daddslashes ($ _ FILES );} // initialize some variables $ charset = $ dbs = $ dbcharset = $ forumfounders = $ metakeywords = $ extrahead = $ seodescription = $ mnid = ''; $ plugins = $ hooks = $ admincp = $ jsmenu = $ forum = $ thread = $ language = $ actioncode = $ modactioncode = $ lang = array (); $ _ DCOOKIE =$ _ DSESSION =$ _ DCACHE =$ _ DPLUGIN = $ advlist = array (); // contains the Forum configuration file require_once DISCUZ_ROOT. '. /Config. inc. php'; // $ urlxssdefend is a protection switch for forum access pages, which can prevent users from harming users on this site through illegal url addresses. if ($ urlxssdefend &&! Empty ($ _ SERVER ['request _ URI ']) {$ temp = urldecode ($ _ SERVER ['request _ URI']); if (strpos ($ temp, '<')! = False | strpos ($ temp ,'"')! = False) exit ('request Bad URL ');} // $ prelength indicates the length of the cookie prefix. // Check the variable with the configured prefix in $ _ COOKIE cyclically, enter $ _ DCOOKIE with a prefix without a prefix. // The last filter value $ prelength = strlen ($ cookiepre ); foreach ($ _ COOKIE as $ key => $ val) {if (substr ($ key, 0, $ prelength) = $ cookiepre) {$ _ DCOOKIE [(substr ($ key, $ prelength)] = MAGIC_QUOTES_GPC? $ Val: daddslashes ($ val) ;}// destroy these variables. all these variables are unset ($ prelength, $ _ request, $ _ key, $ _ value); // $ inajax =! Empty ($ inajax); $ handlekey =! Empty ($ handlekey )? Htmlspecialchars ($ handlekey): ''; $ timestamp = time (); // $ attackevasive Forum defense level, it can prevent DoS attacks caused by a large number of abnormal requests. if ($ attackevasive & CURSCRIPT! = 'Seccode') {require_once DISCUZ_ROOT. '. /include/security. inc. php ';} // file containing the database class require_once DISCUZ_ROOT. '. /include/db _'. $ database. '. class. php '; // $ PHP_SELF indicates the path of the script of the current activity to the home directory of the website // $ BASESCRIPT indicates the name of the script file of the current activity with the extension // $ BASEFILENAME indicates that the name of the script file of the current activity is not remove the following file name from the full website path with the extension // $ boardurl for the current active script, if there is an api | archiver | wap folder, remove it... $ 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 ,'/'))). '/'); // Obtain the current viewer's IPif (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 '), 'unknon') {$ onlineip = getenv ('http _ X_FORWARDED_FOR ');} elseif (getenv ('remote _ ADDR') & strcasecmp (getenv ('remote _ ADDR' ), 'Unknon') {$ 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); // include settings cache and give the array to extract. read this function explanation if you do not understand it... i'm not arrogant anymore... $ cachelost = (@ include DISCUZ_ROOT. '. /forumdata/cache/cache_settings.php ')? '': 'Settings'; @ extract ($ _ DCACHE ['Settings']); // If GZIP compression is enabled and the server has this function // if the current script is not wap and attachment // and inajax is FLASE //, ob_start ('OB _ gzhandler ') otherwise, ob_start (); if ($ gzipcompress & function_exists ('OB _ gzhandler ')&&! In_array (CURSCRIPT, array ('attachment ', 'wap '))&&! $ Inajax) {ob_start ('OB _ gzhandler');} else {$ gzipcompress = 0; ob_start () ;}// used to balance loads, $ loadctrl I don't know where it is .. khan one if (! Empty ($ loadctrl) & substr (PHP_ OS, 0, 3 )! = '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 () ;}}// contains other cached files if (in_array (CURSCRIPT, array ('index', 'forumdisplay', 'viewthread ', 'POST', 'topicadmin', 'register ', 'archiveer') {$ cachelost. = (@ include D ISCUZ_ROOT. './forumdata/cache _'. CURSCRIPT. '. php ')? '':''. CURSCRIPT;} // connect to the database. Then, set these values to NULL $ db = new dbstuff; $ db-> connect ($ dbhost, $ dbuser, $ dbpw, $ dbname, $ pconnect, true, $ dbcharset); $ dbuser = $ dbpw = $ pconnect = $ sdb = NULL; // messy, anyway, I found the desired sid and filtered it out. $ transsidstatus. I didn't find the desired sid either. // check if the ID transmitted through sid is set in the background, and whether the ID is accessed through wap, // whether there is sid or not. if the result is true for $ _ GET or $ _ POST, obtain the sid from GET, if it is not valid, it is obtained from $ _ DCOOKIE. $ Sid = daddslashes ($ transsidstatus | CURSCRIPT = 'wap ') & (isset ($ _ GET ['Sid']) | isset ($ _ POST ['Sid '])? (Isset ($ _ GET ['Sid '])? $ _ GET ['Sid ']: $ _ POST ['Sid']) :( isset ($ _ DCOOKIE ['Sid '])? $ _ DCOOKIE ['Sid ']: ''); // if the current script is an attachment sid, it is encrypted in GET mode and then filtered out. CURSCRIPT = 'attachment' & isset ($ _ GET ['Sid']) & $ sid = addslashes (authcode ($ _ GET ['Sid '], 'Decode', $ _ DCACHE ['Settings'] ['authkey']); // set a $ discuz_auth_key and md5 encryption .. $ Discuz_auth_key = md5 ($ _ DCACHE ['Settings'] ['authkey']. $ _ SERVER ['http _ USER_AGENT ']); // get the three variables $ discuz_pw, $ discuz_secques, and $ discuz_uid, which correspond to the password, prompting the problem and uid. // Forcibly filter the list ($ discuz_pw, $ discuz_secques, $ discuz_uid) = empty ($ _ DCOOKIE ['auth']) of these three values? Array ('','', 0): daddslashes (explode ("\ t", authcode ($ _ DCOOKIE ['auth'], 'decode'), 1 ); // The first line is used to initialize the variable (initialization should be considered whenever the variable is used, otherwise the security is not worth mentioning) // The next step is to determine whether there is a sid, if yes, it will be obtained from the cdb_session table, and then connected to the cdb_members table to retrieve things. // The $ membertablefields variable has been fully written out. // A sessionexist variable is marked, indicates that this member is online. $ Prompt = $ sessionexists = $ seccode = 0; $ 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. digestposts, m. oltime, m. pageviews, m. credits, m. extcredits1, m. extcredits2, m. extcredits3, m. extcredits4, m. extcredits5, m. extcredits6, m. e Xtcredits7, 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 '; if ($ sid) {if ($ discuz_uid) {$ 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 {$ 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 CO NCAT_WS ('. ', ip1, ip2, ip3, ip4) =' $ onlineip '");} if ($ _ DSESSION = $ db-> fetch_array ($ query )) {$ sessionexists = 1; if (! Empty ($ _ DSESSION ['sessionuid']) {$ _ DSESSION = array_merge ($ _ DSESSION, $ db-> fetch_first ("SELECT $ membertablefields FROM {$ tablepre} members m WHERE uid = '$ _ DSESSION [sessionuid]'");} else {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, ip 4) = '$ onlineip' ") {clearcookies (); $ sessionexists = 1 ;}}} // if the COOKIE is not executed online // clear the COOKIE if it is incorrect // if the IP address is set, it will be executed (marked) // write a random value to SID SECCODEif (! $ Sessionexists) {if ($ discuz_uid) {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 ();}}