Class_core.php module function White Paper source/class/class_core.php is Discuz! General initialization module program, which is referenced by almost all external code. Before you start plug-in design, you can first understand the general functions of this module. Class_core.php mainly completed the following tasks: functional white paper for different PHP class_core.php modules
Source/class/class_core.php is Discuz! General initialization module program, which is referenced by almost all external code. Before you start plug-in design, you can first understand the general functions of this module. Class_core.php has completed the following tasks:
- Different PHP and operating system environments are judged and compatible, so that Discuz! It can run in a variety of server environments with different configurations.
- The initialization constant IN_DISCUZ is TRUE, which is used to judge the Future program of include or require to prevent other programs from being illegally referenced.
- Read the absolute path of the community program and store it in the constant DISCUZ_ROOT.
- Load the required basic function library source/function/function_core.php.
- Use the database account information provided in config/config_global.php to establish a database connection. Discuz! The table prefix is supported. to obtain the full name of a table, you can use "DB: table ('tablename.
- Determine whether a user logs on. for example, if $ _ G ['uid'] is not 0, add $ _ G ['username'] (the user name of addslashes is added, can be used to insert a database without modification), $ _ G ['member'] ['username'] (original user name, which can be used for display on the page), $ _ G ['member'] ['password'] (MD5 string of the user's password) and other user information assignment, other user information is stored in $ _ G ['member']. For more information, see "getuserprofile.
- Determine the user management permission and set $ _ G ['adminid'] to 1 ~ 3. 0 stands for normal users; 1 stands for forum administrators; 2 stands for Super moderators; 3 stands for forum moderators. Mark user permissions as $ _ G ['groupid'] based on the ID of the user group to which the user belongs. the related permissions are read from the system cache corresponding to $ _ G ['groupid'] and stored in $ _ G ['group'].
- Preset read various setting variables for each module.