zencart全解析(二)

 

假如命令行的地址是:http://www.baidu.com/index.php

 

那么:

$_SERVER['HTTP_HOST']=='www.baidu.com'

$_SERVER['PHP_SELF']=='/index.php'

明白了吧,一个是主机地址,一个是脚本文件的相对路径

require('../includes/classes/class.base.php');

File contains just the base class

abstract class base

any class that wants to notify or listen for events must extend this base class

method used to an attach an observer to the notifier object

 

NB. We have to get a little sneaky here to stop session based classes adding events ad infinitum  To do this we first concatenate the class name with the event id, as a class is only ever going to attach to an   event id once, this provides a unique key. To ensure there are no naming problems with the array key, we md5 the unique  name to provide a unique hashed key

注。我们要得到一点偷偷摸摸来阻止会议添加事件无休止的阶级要做到这一点,我们首先串连与事件ID类名,作为一类是只将要附加到事件ID一次,这提供了一个独特关键。为了确保有没有命名与阵列的关键问题,我们MD5的唯一的名称提供一个独特的散列键。

param object Reference to the observer class. 参数对象的引用类的观察员

param array An array of eventId's to observe 参数数组的事件ID数组的观察

function attach(&$observer, $eventIDArray) {

    foreach($eventIDArray as $eventID) {

      $nameHash = md5(get_class($observer).$eventID);

      base::setStaticObserver($nameHash, array('obs'=>&$observer, 'eventID'=>$eventID));

    }

  }

method used to detach an observer from the notifier object   方法用于从分离对象观察员通知

function detach($observer, $eventIDArray) {

    foreach($eventIDArray as $eventID) {   

      $nameHash = md5(get_class($observer).$eventID);

      base::unsetStaticObserver($nameHash);

    }

  }

method to notify observers that an event as occurred in the notifier object 方法通知观察家认为,如事件发生的通知对象

param string The event ID to notify for param array paramters to pass to the observer, useful for passing stuff which is outside of the 'scope' of the observed class. 参数字符串中的事件ID为参数数组参数研究通知传递给观察员,传递有用的东西是'范围'课堂之外的观察

function notify($eventID, $paramArray = array()) {

    $observers = & base::getStaticObserver();

    if (!is_null($observers))

    {

      foreach($observers as $key=>$obs) {

        if ($obs['eventID'] == $eventID) {

          $obs['obs']->update($this, $eventID, $paramArray);

        }

      }

    }

  }

function & getStaticProperty($var)

  {

    static $staticProperty;

    return $staticProperty;

  }

  function & getStaticObserver() {

    return base::getStaticProperty('observer');

  }

  function & setStaticObserver($element, $value)

  {

    $observer =  & base::getStaticObserver();

    $observer[$element] = $value;

  }

  function & unsetStaticObserver($element)

  {

    $observer =  & base::getStaticObserver();

    unset($observer[$element]);

  }

& base::getStaticObserver();取的是$staticProperty的变量地址,
$observer[$element] = $value;
就是对$staticProperty进行赋值。

 

require('../includes/classes/class.notifier.php');

class notifier is a concrete implemetation of the abstract base class it can be used in procedural (non OOP) code to set up an observer see the observer/notifier tutorial for more details.

class notifier extends base {

}

require('includes/functions/general.php');

function  zen_not_null($value)   非空

strtolower() 函数把字符串转换为小写。

function zen_output_string($string, $translate = false, $protected = false)

htmlspecialchars() 函数把一些预定义的字符转换为 HTML 实体。

预定义的字符是:

& (和号) 成为 &

" (双引号) 成为 "

' (单引号) 成为 '

< (小于) 成为 &lt;

> (大于) 成为 &gt;

function zen_db_input($string)

addslashes() 函数在指定的预定义字符前添加反斜杠。

这些预定义字符是:

单引号 (')

双引号 (")

反斜杠 (/)

NULL

function zen_parse_input_field_data($data, $parse)

strtr() 函数转换字符串中特定的字符。

function setInputValue($input, $constant, $default)

function setRadioChecked($input, $constant, $default)

function setSelected($input, $selected)

function executeSql($sql_file, $database, $table_prefix = '', $isupgrade=false)

function zen_db_prepare_input($string)

function zen_sanitize_string($string)

返回一个出于安全考虑而转换的字符串  

@参数:字符串,将被解析的字符串

function zen_encrypt_password($plain)

function zen_rand($min = null, $max = null)

function zen_read_config_value($value)

   '../includes/configure.php';

    @dir('../includes/' . 'extra_configures')

This is for debug purposes to run installer from command line. Set to true to enable it

function zen_table_exists($tablename, $pre_install=false)

function zen_check_database_privs($priv='',$table='',$show_privs=false)

function zen_drop_index_command($param)

function zen_create_index_command($param)

function zen_check_alter_command($param)

function zen_check_config_key($line)

function zen_check_product_type_layout_key($line)

function zen_check_cfggroup_key($line)

function zen_write_to_upgrade_exceptions_table($line, $reason, $sql_file)

function zen_purge_exceptions_table()

function zen_create_exceptions_table()

function zen_check_exceptions($result, $line)

function zcInstallAddSID($connection = '')

 

//return zc_install/includes/application_top.php

require the session handling functions

require('includes/functions/sessions.php');

session-related functions used by installer

if (STORE_SESSIONS == 'db')

get_cfg_var('session.gc_maxlifetime')

function _sess_open($save_path, $session_name)

function _sess_close()

function _sess_read($key)

function _sess_write($key, $val)

function _sess_destroy($key)

function _sess_gc($maxlifetime)

}

function zen_session_start()

function zen_session_register($variable)

function zen_session_is_registered($variable)

function zen_session_unregister($variable)

function zen_session_id($sessid = '')

function zen_session_name($name = '')

function zen_session_close()

function zen_session_destroy()

function zen_session_save_path($path = '')

function zen_session_recreate()

function zen_session_set_save_handler ($open, $close, $read, $write, $destroy, $gc)

 

set the session name and save path

set the session cookie parameters

set the session ID if it exists

initialize the message stack for message alerts

require('includes/classes/message_stack.php');

$messageStack = new messageStack;

messageStack Class.

This class is used to manage messageStack alerts

 

activate installer

require('includes/classes/installer.php');

$zc_install = new installer;

installer Class.

This class is used during the installation and upgrade processes

PHP touch() 函数设置指定文件的访问和修改时间。

 

check validity of session data

language determination

if ($language == '') $language = 'english';

file_exists('includes/languages/' . $language . '.php'

template determination

define('DIR_WS_INSTALL_TEMPLATE', 'includes/templates/template_default/');

 

//retrun    zc_install/index.php

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值