zencart全解析(三)

来源:互联网 发布:java nginx文件上传 编辑:程序博客网 时间:2024/04/28 20:29

init vars:

 

begin processing page-specific actions

 

if (!isset($_GET['main_page']) || !zen_not_null($_GET['main_page'])) $_GET['main_page'] = 'index';

如果没有设置main_page 并且main_page是空的, $_GET['main_page'] = 'index';

 

require($language_page_directory . $current_page . '.php');

require('includes/languages/' . $language . '.php');

includes/languages/english/index.php   defining language components for the page

includes/languages/english.php        defining language components for the page

require($page_directory . '/header_php.php');

require(DIR_WS_INSTALL_TEMPLATE . 'common/html_header.php');

require(DIR_WS_INSTALL_TEMPLATE . 'common/main_template_vars.php');

require(DIR_WS_INSTALL_TEMPLATE . 'common/tpl_main_page.php');

includes/modules/pages/index/header_php.php

  Nothing special to do here.

includes/templates/template_default/common/html_header.php  <head> 

includes/templates/template_default/common/main_template_vars.php

  $body_code = DIR_WS_INSTALL_TEMPLATE . 'templates/' . $current_page . '_default.php';

  includes/templates/template_default/templates/index_default.php

includes/templates/template_default/common/tpl_main_page.php

 require($body_code);  Includes/templates/template_default/templates/index_default.php

 if ($zc_install->error) include(DIR_WS_INSTALL_TEMPLATE . 'templates/display_errors.php');

 <iframe src="includes/templates/template_default/templates/about_zencart.html"></iframe>

Welcome To Zen Cart&trade;

navigation

 require(DIR_WS_INSTALL_TEMPLATE . "sideboxes/navigation.php");

 includes/templates/template_default/sideboxes/navigation.php

footer   Copyright

index.php?main_page=license

includes/languages/english/license.php

includes/languages/english.php

includes/modules/pages/ license /header_php.php

 

if (isset($_POST['submit'])) {

    if (isset($_POST['license_consent']) && $_POST['license_consent'] == 'agree') {

      header('location: index.php?main_page=inspect' . zcInstallAddSID() );

      exit;

    }

    if (isset($_POST['license_consent']) && $_POST['license_consent'] == 'disagree') {

      header('location: index.php' . zcInstallAddSID() );

      exit;

    }

  }

 

$body_code = DIR_WS_INSTALL_TEMPLATE . 'templates/' . $current_page . '_default.php';      

includes/templates/template_default/templates/license_default.php

<iframe src="includes/templates/template_default/templates/gpl_license.html"></iframe>

  <input type="radio" name="license_consent"

index.php?main_page=inspect

includes/languages/english/inspect.php

includes/languages/english.php

includes/modules/pages/inspect/header_php.php

 

includes/templates/template_default/templates/inspect_default.php

 

if (file_exists('../includes/configure.php'))

read the existing configure.php file(s) to get values and guess whether it looks like a valid prior install

read the configure.php file and look for hints that it's just a copy of dist-configure.php

 

PHP file() 函数把整个文件读入一个数组中。与 file_get_contents() 类似,不同的是 file() 将文件作为一个数组返回。数组中的每个单元都是文件中相应的一行,包括换行符在内。如果失败,则返回 false

substr_count — 计算字串出现的次数

now check database connectivity

require('../includes/' . 'classes/db/' . $zdb_type . '/query_factory.php');

  //reset error-check class after connection attempt

 

Run System Pre-Flight Check:

WebServer OS as reported by env check

$dir_fs_www_root = $zc_install->detectDocumentRoot();

LABEL_WEBSERVER   //WebServer OS as reported by env check

LABEL_HTTP_HOST    //General info

LABEL_PATH_TRANLSATED

LABEL_REALPATH

//get list of disabled functions

  $disabled_funcs = ini_get("disable_functions");

  strstr($disabled_funcs,'disk_free_space')  // get free space on disk

  LABEL_DISK_FREE_SPACE

LABEL_PHP_OS    // Operating System as reported by PHP:

LABEL_PHP_API_MODE  apache2handler  //PHP mode (module, cgi, etc)

//Set Time Limit setting

LABEL_SET_TIME_LIMIT

//get list of disabled functions

  if (!zen_not_null($disabled_funcs)) $disabled_funcs = ini_get("disable_functions");

else  WARN

Check Register Globals     LABEL_REGISTER_GLOBALS

//Check MySQL version    LABEL_MYSQL_AVAILABLE

//DB Privileges

if (false) { // DISABLED THIS CODEBLOCK FOR NOW....

//PHP Version Check   LABEL_PHP_VER

// SAFE MODE check   LABEL_SAFE_MODE

//PHP support for Sessions check  LABEL_PHP_EXT_SESSIONS

//session.auto_start check     LABEL_PHP_SESSION_AUTOSTART

//session.trans_sid check     LABEL_PHP_SESSION_TRANS_SID

// Check for 'tmp' folder for file-based caching. This checks numerous places, and tests actual writing of a file to those folders.

LABEL_PHP_EXT_SAVE_PATH

//check various options for cache storage:

  //foreach (array(@ini_get("session.save_path"), '/tmp', '/var/lib/php/session', $dir_fs_www_root . '/tmp', $dir_fs_www_root . '/cache', 'c:/php/tmp', 'c:/php/sessiondata', 'c:/windows/temp', 'c:/temp') as $cache_test) {

$zc_install->setConfigKey('DIR_FS_SQL_CACHE', $suggested_cache);

LABEL_CURRENT_CACHE_PATH

//PHP MagicQuotesRuntime   LABEL_PHP_MAG_QT_RUN

//PHP MagicQuotesSybase   LABEL_PHP_MAG_QT_SYBASE

//PHP GD support check     LABEL_PHP_EXT_GD

//check for zLib Compression Support   LABEL_PHP_EXT_ZLIB

//Check for OpenSSL support (only relevant for Apache)  LABEL_PHP_EXT_OPENSSL

//Check for CURL support (ie: for payment/shipping gateways)   LABEL_PHP_EXT_CURL

// check for actual CURL operation

  $curl_nonssl_test = $zc_install->test_curl('NONSSL');

  $curl_ssl_test = $zc_install->test_curl('SSL');

Test CURL communications    returns string

function test_curl($mode='NONSSL', $proxy = false, $proxyAddress = '')

      $url = ($mode == 'NONSSL') ? "http://www.zen-cart.com/testcurl.php" : "https://www.zen-cart.com/testcurl.php";

 www.zen-cart.com 网站打不开,

return OKAY;

       // return ($mode == 'NONSSL' ? ERROR_TEXT_CURL_PROBLEM_GENERAL : ERROR_TEXT_CURL_SSL_PROBLEM) . ' ' . $response;

//Check for upload support built in to PHP    LABEL_PHP_UPLOAD_STATUS

//Upload TMP dir setting     LABEL_UPLOAD_TMP_DIR

//Check for XML Support    LABEL_XML_SUPPORT

// PHP output buffering (GZip) (PHP configuration)   LABEL_GZIP

//Check PostgreSQL availability  注释掉了

 

//OpenBaseDir setting

  // read restrictions, and check whether the working folder falls within the list of restricted areas

LABEL_OPEN_BASEDIR

//Sendmail-From setting (PHP configuration)    LABEL_SENDMAIL_FROM

 //Sendmail Path setting (PHP configuration)   LABEL_SENDMAIL_PATH

//SMTP (vs sendmail) setting (PHP configuration)  LABEL_SMTP_MAIL

//include_path (PHP configuration)        LABEL_INCLUDE_PATH

 

// reverse the order for slightly more pleasant display

  $status_check2 = array_reverse($status_check2);

array_reverse -- 返回一个单元顺序相反的数组

// error-condition-detection

  $php_extensions = get_loaded_extensions();

get_loaded_extensions — Returns an array with the names of all modules compiled and loaded

<?php
print_r ( get_loaded_extensions ());
?>

上例的输出类似于:

Array

(

   [0] => xml

   [1] => wddx

   [2] => standard

   [3] => session

   [4] => posix

   [5] => pgsql

   [6] => pcre

   [7] => gd

   [8] => ftp

   [9] => db

   [10] => calendar

   [11] => bcmath

)

$admin_config_exists = $zc_install->test_admin_configure

$store_config_exists = $zc_install->test_store_configure

  // don't restrict ability to proceed with installation if upgrading the database w/o touching configure.php files is a suitable option

// do we override the fatal error caused by configure.php files not being writable?  Automatic for Windows hosts, due to the complexities of permissions on Windoze

// now check for writability of the configure.php files (after capturing fatal_error status above).

//check folders status

// disable Install/Upgrade buttons if fatal error discovered

// record system inspection results

$data = substr($data, 0, -2); // remove trailing comma

原创粉丝点击