The/control/admin/frame.php process structure is similar to the following:/control/admin/frame.php---calls the constructor of the parent class Adminbase (/model/adminbase instance)-- The constructor of the >adminbase class, calling the constructor of the parent class base class (/model/base.php), is actually working on the constructor of the base class, so we can see directly what the constructor of the base class implements.
constructor function
function __construct () {
$this->base ();
}
Base function
function Base () {
Call an intrinsic function,
$this->init_var ();
Initializing database and connecting database information
$this->init_db ();
Introduce//data/cache files below and load all application information
$this->init_cache ();
The app ID used to initialize
$this->init_app ();
Initializing user Information
$this->init_user ();
$this->init_template ();
Send notification function
$this->init_note ();
$this->init_mail ();
$this->cron ();
}
As you can see, base dry words are:
- Initialize member variable Onlineip,lang
- Establishing a database connection
- Write the information in the required data table to the/data/cache corresponding file, and you can say that what you see under the/data/cache/directory is the data in the corresponding table, so you can improve your code efficiency. No need to read and write databases repeatedly
- Read the corresponding AppID content from the/data/cache/apps.php file in the previous step
- Read the browser's cookie, use the/data/cache/apps.php file to read out the corresponding AppID key, decrypt the cookie, and then solve the Userid,username
- Set the default theme
- Use Fsock () to notify individual apps
- Email occurred
This is the function of the constructor of the base, the Adminbase class calls the constructor of the parent class, executes the page load, we can see the code:
function Adminbase () {
Calling the constructor of the parent class
Parent::__construct ();
$this->cookie_status = isset ($_cookie[' Sid ')? 1:0;
$sid = $this->cookie_status? GETGPC (' Sid ', ' C '): Rawurlencode (GETGPC (' Sid ', ' R '));
$this->view->sid = $sid;
$this->view->assign (' Sid ', $this->view->sid);
$this->view->assign (' iframe ', GETGPC (' iframe '));
$a = GETGPC (' a ');
if (GETGPC (' m ')! = ' user ' && $a! = ' login ' && $a! = ' logout ') {
$this->check_priv ();
}
}
Executes the constructor of the parent class, executes its own check_priv (), and the function Code of Check_prive () is as follows:
$username = $this->sid_decode ($this->view->sid);
if (empty ($username)) {
Header (' Location: '. Uc_api. ' /admin.php?m=user&a=login&iframe= '. GETGPC (' iframe ', ' G '). ($this->cookie_status? ': ' &sid= '. $this->view->sid));
Exit
This is part of the code, so the first time into the Ucenter appeared in the landing interface, is this function implementation. We look at the url:http://ucenter.xadieu.com/admin.php?m=user&a=login&iframe=&sid= in the Address bar.
is not the same. So, we see the landing screen. Next, we will make a detailed introduction to the Base.php constructor.
Ucenter Source code parsing--frame.php