The best in history: Discuz! Source code analysis series (1) --./include/common. inc. php

Source: Internet
Author: User

Transferred from http://www.cnblogs.com/redfox241/admin/www.discuz.net by Guo Xin

Reprint address: http://www.discuz.net/viewthread.php? Tid = 611716 & highlight = % 2B % CA % B7 % C9 % CF % B5 % DA % D2 % BB % C7 % BF % A3 % BADiscuz % 21

 

// Define some PHP Environments
Error_reporting (0 );
Set_magic_quotes_runtime (0 );

// Set the start time of Discuz
$ Mtime = explode ('', microtime ());
$ Discuz_starttime = $ mtime [1] + $ mtime [0];

// Define some constants
Define ('sys _ debug', FALSE );
Define ('in _ DISCUZ ', TRUE );
Define ('discuz _ root', substr (dirname (_ FILE _), 0,-7); // obtain the absolute directory

// Versatility
If (PHP_VERSION <'4. 1.0 '){
$ _ GET = & $ HTTP_GET_VARS;
$ _ POST = & $ HTTP_POST_VARS;
$ _ COOKIE = & $ HTTP_COOKIE_VARS;
$ _ SERVER = & $ HTTP_SERVER_VARS;
$ _ ENV = & $ HTTP_ENV_VARS;
$ _ FILES = & $ HTTP_POST_FILES;
}

 

This section basically sets an error report, closes the sick guy magic_quotes, and sets a start time, in this way, the Process Time we see at the bottom of the Forum is calculated based on the difference between the start Time and the end Time, and then defines an IN_DISCUZ as true, the IN_DISCUZ constant is used to prevent unauthorized reference in other include files such as inc. If this constant is not present, the word "Access Denied" appears and exits. Then obtain the absolute directory where Discuz runs. The next step is to determine whether the PHP version is earlier than 4.1 or above, because PHP uses 4.1 as a demarcation line, get the GET value in the way of $ HTTP_GET_VARS ['xx'] below 4.1, and get the get value using $ _ GET later, the purpose of this operation is to use $ _ GET in whatever PHP version. It is universal ~!

Require_once DISCUZ_ROOT. './include/global. func. php ';

Reference include/global. inc. php. This file is the core function file of Discuz. It contains many common functions used by Discuz.

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.