[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/zc_install/includes/modules/pages/inspect/ -> header_php.php (source)

   1  <?php
   2  /**

   3   * @package Installer

   4   * @access private

   5   * @copyright Copyright 2003-2006 Zen Cart Development Team

   6   * @copyright Portions Copyright 2003 osCommerce

   7   * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

   8   * @version $Id: header_php.php 5354 2006-12-23 01:55:47Z drbyte $

   9   */
  10  
  11    if (!isset($_GET['debug'])  && !zen_not_null($_POST['debug']))  define('ZC_UPG_DEBUG',false);
  12    if (!isset($_GET['debug2']) && !zen_not_null($_POST['debug2'])) define('ZC_UPG_DEBUG2',false);
  13    if (!isset($_GET['debug3']) && !zen_not_null($_POST['debug3'])) define('ZC_UPG_DEBUG3',false);
  14    $advanced_mode = (isset($_GET['adv'])) ? true : false;
  15    //////if (isset($_POST['submit']) || isset($_POST['submit'])  ) define('ZC_UPG_DEBUG',false);

  16  
  17    $zc_install->error = false;
  18    $zc_install->fatal_error = false;
  19    $zc_install->error_list = array();
  20    
  21    $zen_cart_previous_version_installed = false;
  22    if (file_exists('../includes/configure.php')) {
  23      // read the existing configure.php file(s) to get values and guess whether it looks like a valid prior install

  24      if (zen_read_config_value('HTTP_SERVER')      == 'http://localhost') $zen_cart_previous_version_installed = 'maybe';
  25      if (zen_read_config_value('DIR_FS_CATALOG')   == '/var/www/html/') $zen_cart_previous_version_installed = 'maybe';
  26      if (zen_read_config_value('HTTP_SERVER')      != '' ) $zen_cart_previous_version_installed = true;
  27      if (zen_read_config_value('DIR_WS_CLASSES')   != '' ) $zen_cart_previous_version_installed = true;
  28      if (zen_read_config_value('DIR_FS_CATALOG')   != '' ) $zen_cart_previous_version_installed = true;
  29      if (strpos(zen_read_config_value('DIR_FS_SQL_CACHE'),'/path/to/')>0) $zen_cart_previous_version_installed = false;
  30      if (zen_read_config_value('DB_DATABASE')      == '' ) $zen_cart_previous_version_installed = false;
  31    
  32      //read the configure.php file and look for hints that it's just a copy of dist-configure.php

  33      $lines = file('../includes/configure.php');
  34      foreach ($lines as $line) {
  35        if (substr_count($line,'dist-configure.php') > 0) $zen_cart_previous_version_installed = false;
  36      } //end foreach

  37    
  38      $zdb_type     = zen_read_config_value('DB_TYPE');
  39      $zdb_prefix   = zen_read_config_value('DB_PREFIX');
  40      $zdb_server   = zen_read_config_value('DB_SERVER');
  41      $zdb_user     = zen_read_config_value('DB_SERVER_USERNAME');
  42      $zdb_pwd      = zen_read_config_value('DB_SERVER_PASSWORD');
  43      $zdb_name     = zen_read_config_value('DB_DATABASE');
  44      $zdb_sql_cache= zen_read_config_value('DIR_FS_SQL_CACHE');
  45      if (strpos($zdb_sql_cache,'/path/to/')>0) $zdb_sql_cache=''; // /path/to/ comes from dist-configure.php. Invalid, thus make null.

  46    
  47      if (ZC_UPG_DEBUG==true) {
  48        echo 'db-type=' . $zdb_type . '<br>';
  49        echo 'db-prefix=' . $zdb_prefix . '<br>';
  50        echo 'db-host=' . $zdb_server . '<br>';
  51        echo 'db-name=' . $zdb_name . '<br>';
  52        echo 'db-user=' . $zdb_user . '<br>';
  53        echo 'cache_folder=' . $zdb_sql_cache . '<br>';
  54      }
  55    
  56      define('DIR_FS_CATALOG', '../');
  57      define('DB_TYPE', 'mysql');
  58      define('SQL_CACHE_METHOD', 'none');
  59      if ($zdb_type!='' && $zdb_name !='') {
  60        // now check database connectivity

  61        require('../includes/' . 'classes/db/' . $zdb_type . '/query_factory.php');
  62    
  63        $zc_install->functionExists($zdb_type, '', '');
  64        $zc_install->dbConnect($zdb_type, $zdb_server, $zdb_name, $zdb_user, $zdb_pwd, '', '');
  65        if ($zc_install->error == false) $zen_cart_database_connect_OK = true;
  66        if ($zc_install->error == true) { 
  67          $zen_cart_previous_version_installed = false;
  68          if (ZC_UPG_DEBUG==true) echo 'db-connection failed using the credentials supplied';
  69        }
  70  
  71        //reset error-check class after connection attempt

  72        $zc_install->error = false;
  73        $zc_install->fatal_error = false;
  74        $zc_install->error_list = array();
  75      } //endif check for db_type and db_name defined

  76    
  77      if ($zen_cart_database_connect_OK) { #1
  78        //open database connection to run queries against it

  79        $db_test = new queryFactory;
  80        $db_test->Connect($zdb_server, $zdb_user, $zdb_pwd, $zdb_name) or $zen_cart_database_connect_OK = false;
  81    
  82        if ($zen_cart_database_connect_OK) { //#2  This check is done again just in case connect fails on previous line
  83          //set database table prefix

  84          define('DB_PREFIX',$zdb_prefix);
  85          // Now check the database for what version it's at, if found

  86          require('includes/classes/class.installer_version_manager.php');
  87          $dbinfo = new versionManager;
  88        } //endif $zen_cart_database_connect_OK #2

  89      } //endif $zen_cart_database_connect_OK

  90    } else {
  91      $zen_cart_previous_version_installed = false;
  92      if (ZC_UPG_DEBUG==true) echo 'NOTE: Did not find existing configure.php file. Assuming fresh install.';
  93    } //endif exists configure.php

  94    
  95  //  if ($check_count > 1) $zen_cart_version_already_installed = false; // if more than one test failed, it must be a fresh install

  96    
  97    if ($zen_cart_previous_version_installed == true && $zen_cart_database_connect_OK == true) {
  98      $is_upgradable = true;
  99    
 100      if ($dbinfo->zdb_configuration_table_found) {
 101        $zdb_version_message = sprintf(LABEL_PREVIOUS_VERSION_NUMBER, $dbinfo->found_version);
 102      } else {
 103        $zdb_version_message = LABEL_PREVIOUS_VERSION_NUMBER_UNKNOWN;
 104      }
 105    }
 106  // Check to see whether we should offer the option to upgrade "database only", rather than rebuild configure.php files too.

 107  // For v1.2.1, the only check we need is whether we're at v1.2.0 already or not.

 108  // Future versions may require more extensive checking if the core configure.php files change.

 109  // NOTE: This flag is also used to determine whether or not we prevent moving to next screen if the configure.php files are not writable

 110    if ($dbinfo->found_version >= '1.2.0') {
 111      $zen_cart_allow_database_upgrade=true;
 112    }
 113    
 114    
 115    
 116    
 117    
 118  ///////////////////////////////////

 119  // Run System Pre-Flight Check:

 120  ///////////////////////////////////

 121    $status_check = array();
 122    $status_check2 = array();
 123    //Structure is this:

 124    //$status_check[] = array('Importance' => '', 'Title' => '', 'Status' => '', 'Class' => '', 'HelpURL' =>'', 'HelpLabel'=>'');

 125    
 126    //WebServer OS as reported by env check

 127    $status_check[] = array('Importance' => 'Info', 'Title' => LABEL_WEBSERVER, 'Status' => getenv("SERVER_SOFTWARE"), 'Class' => 'NA', 'HelpURL' =>'', 'HelpLabel'=>'');
 128    
 129    //General info

 130    $status_check[] = array('Importance' => 'Info', 'Title' => LABEL_HTTP_HOST, 'Status' => $_SERVER['HTTP_HOST'], 'Class' => 'NA', 'HelpURL' =>'', 'HelpLabel'=>'');
 131    $path_trans=$_SERVER['PATH_TRANSLATED'];
 132    $path_trans_display=$_SERVER['PATH_TRANSLATED'];
 133    if (empty($path_trans)) {
 134      $path_trans_display = $_SERVER['SCRIPT_FILENAME'] . '(SCRIPT_FILENAME)';
 135      $path_trans = $_SERVER['SCRIPT_FILENAME'];
 136    }
 137    $status_check[] = array('Importance' => 'Info', 'Title' => LABEL_PATH_TRANLSATED, 'Status' => $path_trans_display, 'Class' => 'NA', 'HelpURL' =>'', 'HelpLabel'=>'');
 138    
 139    //get list of disabled functions

 140    $disabled_funcs = ini_get("disable_functions");
 141    if (!strstr($disabled_funcs,'diskfreespace')) {
 142      // get free space on disk

 143      $disk_freespaceGB=round(@diskfreespace($path_trans)/1024/1024/1024,2);
 144      $disk_freespaceMB=round(@diskfreespace($path_trans)/1024/1024,2);
 145      if ($disk_freespaceGB !=0) $status_check[] = array('Importance' => 'Info', 'Title' => LABEL_DISK_FREE_SPACE, 'Status' => $disk_freespaceGB . ' GB' . (($disk_freespaceGB==0) ? ' (can be ignored)' : ''), 'Class' => ($disk_freespaceMB<1000)?'FAIL':'NA', 'HelpURL' =>'', 'HelpLabel'=>'');
 146    }
 147  
 148    // Operating System as reported by PHP:

 149    $status_check[] = array('Importance' => 'Optional', 'Title' => LABEL_PHP_OS, 'Status' => PHP_OS, 'Class' => 'NA', 'HelpURL' =>'', 'HelpLabel'=>'');
 150    
 151    //PHP mode (module, cgi, etc)

 152    $status_check[] = array('Importance' => 'Info', 'Title' => LABEL_PHP_API_MODE, 'Status' => @php_sapi_name(), 'Class' => (@strstr(php_sapi_name(),'cgi') ? 'WARN' : 'NA'), 'HelpURL' =>ERROR_CODE_PHP_AS_CGI, 'HelpLabel'=>ERROR_TEXT_PHP_AS_CGI);
 153    
 154    //Set Time Limit setting

 155    $set_time_limit = ini_get("max_execution_time");
 156    $status_check[] = array('Importance' => 'Info', 'Title' => LABEL_SET_TIME_LIMIT, 'Status' => $set_time_limit, 'Class' => 'NA', 'HelpURL' =>'', 'HelpLabel'=>'');
 157    
 158    //get list of disabled functions

 159    if (!zen_not_null($disabled_funcs)) $disabled_funcs = ini_get("disable_functions");
 160    if (zen_not_null($disabled_funcs)) $status_check[] = array('Importance' => 'Recommended', 'Title' => LABEL_DISABLED_FUNCTIONS, 'Status' => $disabled_funcs, 'Class' => (@substr_count($disabled_funcs,'set_time_limit') ? 'WARN' : 'NA'), 'HelpURL' =>ERROR_CODE_DISABLE_FUNCTIONS, ERROR_TEXT_DISABLE_FUNCTIONS);
 161    
 162    // Check Register Globals

 163    $register_globals = ini_get("register_globals");
 164    if ($register_globals == '' || $register_globals =='0' || strtoupper($register_globals) =='OFF') {
 165      $register_globals = OFF; // Having register globals "off" is more secure

 166      $this_class='OK';
 167    } else {
 168      $register_globals = "<span class='errors'>".ON.'</span>';
 169      $this_class='WARN';
 170    }
 171    $status_check[] = array('Importance' => 'Info', 'Title' => LABEL_REGISTER_GLOBALS, 'Status' => $register_globals, 'Class' => $this_class, 'HelpURL' =>ERROR_CODE_REGISTER_GLOBALS_ON, 'HelpLabel'=>ERROR_TEXT_REGISTER_GLOBALS_ON);
 172    
 173    //Check MySQL version

 174    $mysql_support = (function_exists( 'mysql_connect' )) ? ON : OFF;
 175    $mysql_version = (function_exists('mysql_get_server_info')) ? @mysql_get_server_info() : UNKNOWN;
 176    $mysql_version = ($mysql_version == '') ? UNKNOWN : $mysql_version ;
 177    //if (is_object($db_test)) $mysql_qry=$db_test->get_server_info();

 178    $mysql_ver_class = ($mysql_version<'3.23.00') ? 'FAIL' : 'OK';
 179    $mysql_ver_class = ($mysql_version == UNKNOWN || $mysql_version > '5.0') ? 'WARN' : $mysql_ver_class;
 180    
 181    $status_check[] = array('Importance' => 'Critical', 'Title' => LABEL_MYSQL_AVAILABLE, 'Status' => $mysql_support, 'Class' => ($mysql_support==ON) ? 'OK' : 'FAIL', 'HelpURL' =>ERROR_CODE_DB_NOTSUPPORTED, 'HelpLabel'=>ERROR_TEXT_DB_NOTSUPPORTED);
 182    if ($mysql_version != UNKNOWN || ($mysql_version == UNKNOWN && $advanced_mode)) $status_check[] = array('Importance' => 'Info', 'Title' => LABEL_MYSQL_VER, 'Status' => $mysql_version, 'Class' => $mysql_ver_class, 'HelpURL' =>($mysql_version > '5.0' ? ERROR_CODE_DB_MYSQL5 : ERROR_CODE_DB_VER_UNKNOWN), 'HelpLabel'=>($mysql_version > '5.0' ? ERROR_TEXT_DB_MYSQL5 : ERROR_TEXT_DB_VER_UNKNOWN) );
 183    
 184    //DB Privileges

 185  if (false) { // DISABLED THIS CODEBLOCK FOR NOW....
 186    if ($zen_cart_database_connect_OK) {
 187      $zdb_privs_list = zen_check_database_privs('','',true);
 188      $privs_array = explode('|||',$zdb_privs_list);
 189      $db_priv_ok = $privs_array[0];
 190      $zdb_privs =  $privs_array[1];
 191      if (ZC_UPG_DEBUG==true) echo 'privs_list_to_parse='.$db_priv_ok.'|||'.$zdb_privs;
 192      //  $granted_db = str_replace('`','',substr($zdb_privs,strpos($zdb_privs,' ON ')+4) );

 193      //  $db_priv_ok = ($granted_db == '*.*' || $granted_db==DB_DATABASE.'.*' || $granted_db==DB_DATABASE.'.'.$table) ? true : false;

 194      //  $zdb_privs = substr($zdb_privs,0,strpos($zdb_privs,' ON ')); //remove the "ON..." portion

 195      $zdb_privs_class='FAIL';
 196      $privs_matched=0;
 197      if (substr_count($zdb_privs,'ALL PRIVILEGES')>0) $zdb_privs_class='OK';
 198      foreach(array('SELECT','INSERT','UPDATE','DELETE','CREATE','ALTER','INDEX','DROP') as $value) {
 199        if (in_array($value,explode(', ',$zdb_privs))) {
 200          $privs_matched++;
 201          $privs_found_text .= $value .', ';
 202        }
 203      }
 204      if ($privs_matched==8 && $db_priv_ok) $zdb_privs_class='OK';
 205      if (substr_count($zdb_privs,'USAGE') >0) $zdb_privs_class='NA';
 206      if (!zen_not_null($zdb_privs)) {
 207        $privs_found_text = UNKNOWN;
 208        $zdb_privs_class='NA';
 209      }
 210      if ($privs_found_text=='') $privs_found_text = $zdb_privs;
 211      if ($zdb_privs == 'Not Checked') {
 212        $privs_found_text = $zdb_privs;
 213        $zdb_privs_class='NA';
 214      }
 215      $status_check[] = array('Importance' => 'Critical', 'Title' => LABEL_DB_PRIVS, 'Status' => str_replace(',  ',' ',$privs_found_text.' '), 'Class' => $zdb_privs_class, 'HelpURL' =>ERROR_CODE_DB_PRIVS, 'HelpLabel'=>ERROR_TEXT_DB_PRIVS);
 216    }
 217  }
 218    
 219    //PHP Version Check

 220    $err_text = '';
 221    $err_code = '';
 222    $php_ver = '';
 223  
 224    if ($zc_install->test_php_version('<', "4.3.2", ERROR_TEXT_PHP_OLD_VERSION, ERROR_CODE_PHP_OLD_VERSION, ($zen_cart_allow_database_upgrade == false) )) {
 225      if ($zen_cart_allow_database_upgrade == false) {
 226        $php_ver = '<span class="errors">'.$zc_install->php_version.' {*** '. MUST_UPGRADE . ' ***}</span>';
 227        $this_class = 'FAIL';
 228      } else {
 229        $php_ver = '<span class="errors">'.$zc_install->php_version.' {*** '. SHOULD_UPGRADE . ' ***}</span>';
 230        $this_class = 'WARN';
 231      }
 232    } else {
 233      $php_ver = $zc_install->php_version;
 234      $this_class = 'OK';
 235    }
 236    $status_check[] = array('Importance' => 'Critical', 'Title' => LABEL_PHP_VER, 'Status' => $php_ver, 'Class' => $this_class, 'HelpURL' =>$err_code, 'HelpLabel'=>$err_text);
 237    
 238    // SAFE MODE check

 239    $safe_mode = (ini_get("safe_mode")) ? "<span class='errors'>" . ON . '</span>' : OFF;
 240    $status_check[] = array('Importance' => 'Critical', 'Title' => LABEL_SAFE_MODE, 'Status' => $safe_mode, 'Class' => ($safe_mode==OFF) ? 'OK' : 'FAIL', 'HelpURL' =>ERROR_CODE_SAFE_MODE_ON, 'HelpLabel'=>ERROR_TEXT_SAFE_MODE_ON);
 241    
 242    //PHP support for Sessions check

 243    $php_ext_sessions = (@extension_loaded('session')) ? ON : OFF;
 244    $status_check[] = array('Importance' => 'Critical', 'Title' => LABEL_PHP_EXT_SESSIONS, 'Status' => $php_ext_sessions, 'Class' => ($php_ext_sessions==ON) ? 'OK' : 'FAIL', 'HelpURL' =>ERROR_CODE_PHP_SESSION_SUPPORT, 'HelpLabel'=>ERROR_TEXT_PHP_SESSION_SUPPORT);
 245    
 246    //session.auto_start check

 247    $php_session_auto = (ini_get('session.auto_start')) ? ON : OFF;
 248    $status_check[] = array('Importance' => 'Recommended', 'Title' => LABEL_PHP_SESSION_AUTOSTART, 'Status' => $php_session_auto, 'Class' => ($php_session_auto==ON)?'WARN':'OK', 'HelpURL' =>ERROR_CODE_PHP_SESSION_AUTOSTART, 'HelpLabel'=>ERROR_TEXT_PHP_SESSION_AUTOSTART);
 249    
 250    //session.trans_sid check

 251    $php_session_trans_sid = (ini_get('session.use_trans_sid')) ? ON : OFF;
 252    $status_check[] = array('Importance' => 'Recommended', 'Title' => LABEL_PHP_SESSION_TRANS_SID, 'Status' => $php_session_trans_sid, 'Class' => ($php_session_trans_sid==ON)?'WARN':'OK', 'HelpURL' =>ERROR_CODE_PHP_SESSION_TRANS_SID, 'HelpLabel'=>ERROR_TEXT_PHP_SESSION_TRANS_SID);
 253    
 254    // Check for 'tmp' folder for file-based caching. This checks numerous places, and tests actual writing of a file to those folders.

 255    $script_filename = $_SERVER['PATH_TRANSLATED'];
 256    if (empty($script_filename)) {
 257      $script_filename = $_SERVER['SCRIPT_FILENAME'];
 258    }
 259    
 260    $script_filename = str_replace('\\', '/', $script_filename);
 261    $script_filename = str_replace('//', '/', $script_filename);
 262    
 263    $dir_fs_www_root_array = explode('/', dirname($script_filename));
 264    $dir_fs_www_root = array();
 265    for ($i=0, $n=sizeof($dir_fs_www_root_array)-1; $i<$n; $i++) {
 266      $dir_fs_www_root[] = $dir_fs_www_root_array[$i];
 267    }
 268    $dir_fs_www_root = implode('/', $dir_fs_www_root);
 269    
 270    $session_save_path = (@ini_get('session.save_path')) ? ini_get('session.save_path') : UNKNOWN;
 271    $session_save_path_writable = (@is_writable( $session_save_path )) ? WRITABLE : UNWRITABLE ;
 272    $status_check2[3] = array('Importance' => 'Optional', 'Title' => LABEL_PHP_EXT_SAVE_PATH, 'Status' => $session_save_path . ($session_save_path != UNKNOWN ? '&nbsp;&nbsp;-->' . $session_save_path_writable : ''), 'Class' => ($session_save_path_writable ==WRITABLE || $session_save_path == UNKNOWN) ? 'OK' : 'WARN', 'HelpURL' =>ERROR_CODE_SESSION_SAVE_PATH, 'HelpLabel'=>ERROR_TEXT_SESSION_SAVE_PATH);
 273    
 274    //check various options for cache storage:

 275    //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) {

 276    foreach (array($dir_fs_www_root . '/cache') as $cache_test) {
 277      if (is_dir($cache_test) && @is_writable($cache_test) ) {  // does it exist?  Is is writable?
 278        $filename = $cache_test . '/zentest.tst';
 279        $fp = @fopen($filename,"w");  // if this fails, then the file is not really writable

 280        @fwrite($fp,'cache test');
 281        @fclose($fp);
 282        $fp = @fopen($filename,"rb");  // read it back to be sure it's ok

 283        $contents = @fread($fp, filesize($filename));
 284        @fclose($fp);
 285        @unlink($filename);
 286        if ($contents == 'cache test') {
 287          $suggested_cache=$cache_test;  // if contents were read ok, then path is OK

 288          break;
 289        }
 290      }
 291    }
 292    $sugg_cache_class = 'OK'; //default

 293    $sugg_cache_code = '';
 294    $sugg_cache_text = '';
 295    if ($suggested_cache == '') {
 296      $suggested_cache = $dir_fs_www_root . '/cache';  //suggest to use catalog path if no alternative was found usable

 297      $sugg_cache_class = 'WARN';
 298      $sugg_cache_code = ERROR_CODE_CACHE_CUSTOM_NEEDED;
 299      $sugg_cache_text = '<br />'.ERROR_TEXT_CACHE_CUSTOM_NEEDED; // the <br> tag is for line-wrap for a long message displayed

 300    } elseif (!is_dir($suggested_cache)) {
 301      $sugg_cache_code = ERROR_CODE_CACHE_DIR_ISDIR;
 302      $sugg_cache_text = ERROR_TEXT_CACHE_DIR_ISDIR;
 303      $sugg_cache_class = 'WARN';
 304    } elseif (!@is_writable($suggested_cache)) {
 305      $sugg_cache_code = ERROR_CODE_CACHE_DIR_ISWRITABLE;
 306      $sugg_cache_text = ERROR_TEXT_CACHE_DIR_ISWRITABLE;
 307      $sugg_cache_class = 'WARN';
 308    }//endif $suggested_cache

 309    $zdb_sql_cache_writable = (@is_writable($zdb_sql_cache)) ? WRITABLE : UNWRITABLE;
 310    if ($zdb_sql_cache != '') $status_check[] = array('Importance' => 'Recommended', 'Title' => LABEL_CURRENT_CACHE_PATH, 'Status' => $zdb_sql_cache . '&nbsp;&nbsp;-->' . $zdb_sql_cache_writable , 'Class' => ($zdb_sql_cache_writable ==WRITABLE) ? 'OK' : 'WARN', 'HelpURL' =>ERROR_CODE_CACHE_DIR_ISWRITEABLE, 'HelpLabel'=>ERROR_TEXT_CACHE_DIR_ISWRITEABLE);
 311    $status_check[] = array('Importance' => 'Recommended', 'Title' => LABEL_SUGGESTED_CACHE_PATH, 'Status' => $suggested_cache, 'Class' => $sugg_cache_class, 'HelpURL' =>$sugg_cache_code, 'HelpLabel'=>$sugg_cache_text);
 312    
 313    //PHP MagicQuotesRuntime

 314    $php_magic_quotes_runtime = (@get_magic_quotes_runtime() > 0) ? ON : OFF;
 315    $status_check[] = array('Importance' => 'Recommended', 'Title' => LABEL_PHP_MAG_QT_RUN, 'Status' => $php_magic_quotes_runtime , 'Class' => ($php_magic_quotes_runtime==OFF)?'OK':'FAIL', 'HelpURL' =>ERROR_CODE_MAGIC_QUOTES_RUNTIME, 'HelpLabel'=>ERROR_TEXT_MAGIC_QUOTES_RUNTIME);
 316    
 317    //PHP GD support check

 318    $php_ext_gd =       (@extension_loaded('gd'))      ? ON : OFF;
 319    $status_check[] = array('Importance' => 'Optional', 'Title' => LABEL_PHP_EXT_GD, 'Status' => $php_ext_gd , 'Class' => ($php_ext_gd==ON)?'OK':'WARN', 'HelpURL' =>ERROR_CODE_GD_SUPPORT, 'HelpLabel'=>ERROR_TEXT_GD_SUPPORT);
 320    if (function_exists('gd_info')) $gd_info = @gd_info();
 321    $gd_ver = 'GD ' . $gd_info['GD Version'];
 322    $status_check[] = array('Importance' => 'Optional', 'Title' => LABEL_GD_VER, 'Status' => $gd_ver , 'Class' => ($php_ext_gd==ON && strstr($gd_ver,'2.') )?'OK':'WARN', 'HelpURL' =>ERROR_CODE_GD_SUPPORT, 'HelpLabel'=>ERROR_TEXT_GD_SUPPORT);
 323    
 324    //check for zLib Compression Support

 325    $php_ext_zlib =     (@extension_loaded('zlib'))    ? ON : OFF;
 326    $status_check[] = array('Importance' => '', 'Title' => LABEL_PHP_EXT_ZLIB, 'Status' => $php_ext_zlib, 'Class' => ($php_ext_zlib==ON)?'OK':'WARN', 'HelpURL' =>'', 'HelpLabel'=>'');
 327    
 328    //Check for OpenSSL support (only relevant for Apache)

 329    $php_ext_openssl =  (@extension_loaded('openssl')) ? ON : OFF;
 330    if ($php_ext_openssl == ON) $status_check[] = array('Importance' => 'Optional', 'Title' => LABEL_PHP_EXT_OPENSSL, 'Status' => $php_ext_openssl, 'Class' => ($php_ext_openssl==ON)?'OK':'WARN', 'HelpURL' =>ERROR_CODE_OPENSSL_WARN, 'HelpLabel'=>ERROR_TEXT_OPENSSL_WARN);
 331  
 332    //Check for cURL support (ie: for payment/shipping gateways)

 333    // could also check for (function_exists('curl_init'))

 334    $php_ext_curl =     (@extension_loaded('curl'))    ? ON : OFF;
 335    $status_check[] = array('Importance' => 'Optional', 'Title' => LABEL_PHP_EXT_CURL, 'Status' => $php_ext_curl, 'Class' => ($php_ext_curl==ON)?'OK':'WARN', 'HelpURL' =>ERROR_CODE_CURL_SUPPORT, 'HelpLabel'=>ERROR_TEXT_CURL_SUPPORT);
 336    
 337    //Check for upload support built in to PHP

 338    $php_uploads =      (@ini_get('file_uploads')) ? ON : OFF;
 339    $status_check[] = array('Importance' => 'Optional', 'Title' => LABEL_PHP_UPLOAD_STATUS, 'Status' => $php_uploads . sprintf('&nbsp;&nbsp;upload_max_filesize=%s;&nbsp;&nbsp;post_max_size=%s',@ini_get('upload_max_filesize'), @ini_get('post_max_size')) , 'Class' => ($php_uploads==ON)?'OK':'WARN', 'HelpURL' =>ERROR_CODE_UPLOADS_DISABLED, 'HelpLabel'=>ERROR_TEXT_UPLOADS_DISABLED);
 340    
 341    //Upload TMP dir setting

 342    $upload_tmp_dir = ini_get("upload_tmp_dir");
 343    $status_check[] = array('Importance' => 'Info', 'Title' => LABEL_UPLOAD_TMP_DIR, 'Status' => $upload_tmp_dir, 'Class' => 'OK', 'HelpURL' =>'', 'HelpLabel'=>'');
 344    
 345    //Check for XML Support

 346    $xml_support = function_exists('xml_parser_create') ? ON : OFF;
 347    $status_check2[] = array('Importance' => 'Optional', 'Title' => LABEL_XML_SUPPORT, 'Status' => $xml_support, 'Class' => ($xml_support==ON)?'OK':'WARN', 'HelpURL' =>'', 'HelpLabel'=>'');
 348    
 349    //Check for FTP support built in to PHP (for manual sending of configure.php files to server if applicable)

 350    $php_ext_ftp =      (@extension_loaded('ftp'))     ? ON : OFF;
 351    if ($php_ext_ftp == ON) $status_check2[] = array('Importance' => 'Optional', 'Title' => LABEL_PHP_EXT_FTP, 'Status' => $php_ext_ftp, 'Class' => ($php_ext_ftp==ON)?'OK':'WARN', 'HelpURL' =>'', 'HelpLabel'=>'');
 352    
 353    //Check for pfpro support in PHP for Verisign Payflow Pro payment gateway (Verisign SDK required)

 354    $php_ext_pfpro =    (@extension_loaded('pfpro'))   ? ON : OFF;
 355    if ($php_ext_pfpro==ON) $status_check2[] = array('Importance' => 'Optional', 'Title' => LABEL_PHP_EXT_PFPRO, 'Status' => $php_ext_pfpro, 'Class' => ($php_ext_pfpro==ON)?'OK':'WARN', 'HelpURL' =>'', 'HelpLabel'=>'');
 356    
 357    // PHP output buffering (GZip) (PHP configuration)

 358    $php_buffer = (@ini_get("output_buffering"))   ? ON : OFF;
 359    $status_check2[] = array('Importance' => 'Optional', 'Title' => LABEL_GZIP, 'Status' => $php_buffer, 'Class' => ($php_buffer==ON)?'OK':'WARN', 'HelpURL' =>'', 'HelpLabel'=>'');
 360    
 361    //Check PostgreSQL availability

 362    $pg_support = (function_exists( 'pg_connect' )) ? ON : OFF;
 363    // turn off display of Postgres status until we support it again

 364    //$status_check2[] = array('Importance' => 'Optional', 'Title' => LABEL_POSTGRES_AVAILABLE, 'Status' => $pg_support, 'Class' => ($pg_support==ON) ? 'OK' : 'WARN', 'HelpURL' =>ERROR_CODE_DB_NOTSUPPORTED, 'HelpLabel'=>ERROR_TEXT_DB_NOTSUPPORTED);

 365    
 366  
 367    //OpenBaseDir setting

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

 369    $script_filename = str_replace(array('\\','//'), '/', $path_trans);
 370    $dir_fs_www_root_array = explode('/', dirname($script_filename));
 371    $dir_fs_www_root_tmp = array();
 372    for ($i=0, $n=sizeof($dir_fs_www_root_array)-1; $i<$n; $i++) {
 373      $dir_fs_www_root_tmp[] = $dir_fs_www_root_array[$i];
 374    }
 375    $dir_fs_www_root = implode('/', $dir_fs_www_root_tmp);
 376    $this_class = 'OK';
 377  
 378    if ($open_basedir = ini_get('open_basedir')) {
 379      $found_basedir = false;
 380      // if anything is found for open_basedir, set to warning:

 381      if ($open_basedir)   $this_class = 'WARN';
 382      // expand based on : symbol, or ; for windows

 383      $basedir_check_array = explode(':',$open_basedir);
 384      if (!is_array($basedir_check_array)) $basedir_check_array = explode(';',$open_basedir);
 385      // now loop thru paths in the open_basedir settings to find a match to our site. If not found, issue warning.

 386      if (is_array($basedir_check_array) && $dir_fs_www_root !='') {
 387        foreach($basedir_check_array as $basedir_check) {
 388  //        echo 'www-root: ' . $dir_fs_www_root . '<br /> basedir: ' . $basedir_check . '<br /><br />';

 389          if ($basedir_check !='' && strstr($dir_fs_www_root, $basedir_check)) {
 390                    //echo 'FOUND<br /><br />';

 391                      $found_basedir=true;
 392                  }
 393        }
 394      }
 395      if (!$found_basedir) $this_class = 'FAIL';
 396    }
 397    $status_check2[] = array('Importance' => 'Recommended', 'Title' => LABEL_OPEN_BASEDIR, 'Status' => $open_basedir, 'Class' => $this_class, 'HelpURL' =>'', 'HelpLabel'=>'Could have problems uploading files or doing backups');
 398  
 399    //Sendmail-From setting (PHP configuration)

 400    $sendmail_from = @ini_get("sendmail_from");
 401    $status_check2[] = array('Importance' => 'Info', 'Title' => LABEL_SENDMAIL_FROM, 'Status' => $sendmail_from, 'Class' => 'NA', 'HelpURL' =>'', 'HelpLabel'=>'');
 402    
 403    //Sendmail Path setting (PHP configuration)

 404    $sendmail_path = @ini_get("sendmail_path");
 405    $status_check2[] = array('Importance' => 'Info', 'Title' => LABEL_SENDMAIL_PATH, 'Status' => $sendmail_path, 'Class' => 'NA', 'HelpURL' =>'', 'HelpLabel'=>'');
 406    
 407    //SMTP (vs sendmail) setting (PHP configuration)

 408    $smtp = @ini_get("SMTP");
 409    $status_check2[] = array('Importance' => 'Info', 'Title' => LABEL_SMTP_MAIL, 'Status' => $smtp, 'Class' => 'NA', 'HelpURL' =>'', 'HelpLabel'=>'');
 410  
 411    //include_path (PHP configuration)

 412    $includePath = @ini_get("include_path");
 413    $status_check2[] = array('Importance' => 'Info', 'Title' => LABEL_INCLUDE_PATH, 'Status' => $includePath, 'Class' => 'NA', 'HelpURL' =>'', 'HelpLabel'=>'');
 414  
 415  
 416  
 417  // reverse the order for slightly more pleasant display

 418    $status_check2 = array_reverse($status_check2);
 419  
 420  // error-condition-detection

 421    $php_extensions = get_loaded_extensions();
 422    $admin_config_exists = $zc_install->test_admin_configure(ERROR_TEXT_ADMIN_CONFIGURE,ERROR_CODE_ADMIN_CONFIGURE, ($zen_cart_previous_version_installed && $zen_cart_database_connect_OK ? false : true));
 423    $store_config_exists = $zc_install->test_store_configure(ERROR_TEXT_STORE_CONFIGURE,ERROR_CODE_STORE_CONFIGURE);
 424    if ($php_ext_sessions=="OFF") {$zc_install->setError(ERROR_TEXT_PHP_SESSION_SUPPORT, ERROR_CODE_PHP_SESSION_SUPPORT, true);}
 425    
 426    // don't restrict ability to proceed with installation if upgrading the database w/o touching configure.php files is a suitable option

 427    $zen_cart_allow_database_upgrade_button_disable = $zc_install->fatal_error;
 428    // now check for writability of the configure.php files (after capturing fatal_error status above).

 429    if ($admin_config_exists) $admin_config_writable = $zc_install->test_admin_configure_write(ERROR_TEXT_ADMIN_CONFIGURE_WRITE,ERROR_CODE_ADMIN_CONFIGURE_WRITE);
 430    if ($store_config_exists) $store_config_writable = $zc_install->test_store_configure_write(ERROR_TEXT_STORE_CONFIGURE_WRITE,ERROR_CODE_STORE_CONFIGURE_WRITE);
 431    
 432    foreach (array('includes/configure.php', 'admin/includes/configure.php') as $file) {
 433      $this_writable='';
 434      $this_exists='';
 435      if (file_exists('../' . $file)) {
 436        $this_exists='';
 437        if ($zc_install->isWriteable('../' . $file)) {
 438          $this_class = 'OK';
 439          $this_writable=WRITABLE;
 440        } else {
 441          $this_class = 'FAIL';
 442          $this_writable=UNWRITABLE;
 443        }
 444      } else {
 445        $this_exists=NOT_EXIST;
 446        $this_class='FAIL';
 447      }
 448      $file_status[]=array('file'=>$file, 'exists'=>$this_exists, 'writable'=>$this_writable, 'class'=> $this_class);
 449    }
 450    
 451    
 452    
 453    
 454    //check folders status

 455    foreach (array('cache'=>'777 read/write/execute',
 456                   'images'=>'777 read/write/execute (INCLUDE SUBDIRECTORIES TOO)',
 457                   'includes/languages/english/html_includes'=>'777 read/write (INCLUDE SUBDIRECTORIES TOO)',
 458                   'media'=>'777 read/write/execute',
 459                   'pub'=>'777 read/write/execute',
 460                   'admin/backups'=>'777 read/write',
 461                   'admin/images/graphs'=>'777 read/write/execute'
 462                   ) as $folder=>$chmod) {
 463      $folder_status[]=array('folder'=>$folder, 'writable'=>(@is_writable('../'.$folder)) ? OK : UNWRITABLE, 'class'=> (@is_writable('../'.$folder)) ? 'OK' : 'WARN', 'chmod'=>$chmod);
 464    }
 465    
 466    
 467  // disable Install/Upgrade buttons if fatal error discovered

 468    $button_status = ($zc_install->fatal_error && !isset($_GET['ignorefatal'])) ? 'disabled="disabled"' : '';  
 469    $button_status_upg = ($zen_cart_allow_database_upgrade_button_disable && !isset($_GET['ignorefatal'])) ? 'disabled="disabled"' : '';  
 470  
 471  
 472    
 473    // PROCESS TEMPLATE BUTTONS, IF CLICKED

 474    if (isset($_POST['submit'])) {
 475      if (!$zc_install->fatal_error) {
 476        header('location: index.php?main_page=system_setup&language=' . $language . '&sql_cache='.$suggested_cache);
 477        exit;
 478      }
 479    }
 480    if (isset($_POST['upgrade'])) {
 481      if (!$zc_install->fatal_error) {
 482        header('location: index.php?main_page=system_setup&language=' . $language . '&sql_cache='.$suggested_cache . '&is_upgrade=1');
 483        exit;
 484      }
 485    }
 486    if (isset($_POST['db_upgrade'])) {
 487      if (!$zen_cart_allow_database_upgrade_button_disable) {
 488        header('location: index.php?main_page=database_upgrade&language=' . $language . '&is_upgrade=1');
 489        exit;
 490      }
 491    }
 492    if (isset($_POST['refresh'])) {
 493      header('location: index.php?main_page=inspect&language=' . $language . '&sql_cache='.$suggested_cache);
 494      exit;
 495    }
 496  ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics