Ucenter Source code parsing--frame.php

Source: Internet
Author: User

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

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.