class_core.php 模块效能白皮书

WBOY
Release: 2016-06-13 10:30:25
Original
840 people have browsed it

class_core.php 模块功能白皮书

source/class/class_core.php 是 Discuz! 的通用初始化模块程序,其几乎被所有的外部代码所引用,在您开始插件设计之前,可以先对该模块的大致功能做一定的了解。class_core.php 主要完成了以下任务:

  • 对不同 PHP 及操作系统环境做了判断和兼容性处理,使得 Discuz! 可以运行于各种不同配置的服务器环境下。
  • 初始化常量 IN_DISCUZ 为 TRUE,用于 include 或 require 后续程序的判断,避免其他程序被非法引用。
  • 读取社区程序所在绝对路径,存放于常量 DISCUZ_ROOT 中。
  • 加载所需的基本函数库 source/function/function_core.php。
  • 通过 config/config_global.php 中提供的数据库账号信息,建立数据库连接。Discuz! 支持数据表的前缀,如需获得表的全名,可使用“DB::table('tablename')”方式。
  • 判断用户是否登录,如登录标记 $_G['uid'] 为非 0,同时将 $_G['username'](加了 addslashes 的用户名,可用于不加修改的插入数据库)、 $_G['member']['username'](原始的用户名,可用于页面显示)、$_G['member']['password'](用户密码的MD5串)等相应用户信息赋值,其他用户信息存放于 $_G['member'],更多信息可通过“getuserprofile()”获取。
  • 判断用户管理权限,将管理权限标记 $_G['adminid'] 为 1~3 中间的值。0 代表普通用户;1 代表论坛管理员;2 代表超级版主;3 代表论坛版主。 将用户权限按照其所在的主用户组 ID 标记为 $_G['groupid'],相关权限从该 $_G['groupid'] 所对应的系统缓存中读出,存放于 $_G['group']。
  • 预置读入了每个模块的各种设置变量。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!