[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
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 4707 2006-10-08 08:52:12Z drbyte $ 9 */ 10 11 // check to see if we're upgrading 12 $is_upgrade = (isset($_GET['is_upgrade'])) ? $_GET['is_upgrade'] :''; 13 $redetect_requested = (isset($_POST['rediscover'])) ? $_POST['rediscover'] :''; 14 if (!empty($redetect_requested)) $_POST = ''; 15 if (!empty($redetect_requested)) $is_upgrade = ''; 16 17 // init some vars: 18 $enable_ssl = ''; 19 $enable_ssl_admin = ''; 20 21 /* 22 * read existing settings instead of trying to detect from first install 23 */ 24 if ($is_upgrade) { 25 $http_server = zen_read_config_value('HTTP_SERVER'); 26 $http_catalog = zen_read_config_value('DIR_WS_CATALOG'); 27 $virtual_path = str_replace('http://','',$http_server) . $http_catalog; 28 $virtual_https_server = str_replace('https://','',zen_read_config_value('HTTPS_SERVER')); 29 $virtual_https_path = $virtual_https_server . zen_read_config_value('DIR_WS_HTTPS_CATALOG'); 30 $enable_ssl = zen_read_config_value('ENABLE_SSL'); 31 $enable_ssl_admin = zen_read_config_value('ENABLE_SSL_ADMIN'); 32 $dir_fs_www_root = zen_read_config_value('DIR_FS_CATALOG'); 33 $https_catalog = zen_read_config_value('DIR_WS_HTTPS_CATALOG'); 34 35 $http_server = (substr($http_server,-1)=='/') ? substr($http_server,0,(strlen($http_server)-1)) : $http_server; 36 $http_catalog = (substr($http_catalog,-1)=='/') ? substr($http_catalog,0,(strlen($http_catalog)-1)) : $http_catalog; 37 $virtual_path = (substr($virtual_path,-1)=='/') ? substr($virtual_path,0,(strlen($virtual_path)-1)) : $virtual_path; 38 $virtual_https_server = (substr($virtual_https_server,-1)=='/') ? substr($virtual_https_server,0,(strlen($virtual_https_server)-1)) : $virtual_https_server; 39 $virtual_https_path = (substr($virtual_https_path,-1)=='/') ? substr($virtual_https_path,0,(strlen($virtual_https_path)-1)) : $virtual_https_path; 40 $dir_fs_www_root = (substr($dir_fs_www_root,-1)=='/') ? substr($dir_fs_www_root,0,(strlen($dir_fs_www_root)-1)) : $dir_fs_www_root; 41 $https_catalog = (substr($https_catalog,-1)=='/') ? substr($https_catalog,0,(strlen($https_catalog)-1)) : $https_catalog; 42 43 44 } else { //fresh install, so do auto-detect of several settings 45 // Determine Document Root 46 $script_filename = $_SERVER['PATH_TRANSLATED']; 47 if (empty($script_filename)) { 48 $script_filename = $_SERVER['SCRIPT_FILENAME']; 49 } 50 $script_filename = str_replace(array('\\','//'), '/', $script_filename); 51 52 $dir_fs_www_root_array = explode('/', dirname($script_filename)); 53 $dir_fs_www_root_tmp = array(); 54 for ($i=0, $n=sizeof($dir_fs_www_root_array)-1; $i<$n; $i++) { 55 $dir_fs_www_root_tmp[] = $dir_fs_www_root_array[$i]; 56 } 57 $dir_fs_www_root = implode('/', $dir_fs_www_root_tmp); 58 59 // Determine http path 60 $virtual_path = $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; 61 $virtual_path = substr($virtual_path, 0, strpos($virtual_path, '/zc_install')); 62 63 // Determine the https directory. This is a best-guess since we're not likely installing over SSL connection: 64 $virtual_https_server = getenv('HTTP_HOST'); 65 $virtual_https_path = $virtual_path; 66 67 } //endif $is_upgradable 68 69 // Yahoo hosting and others may use / for physical path ... so instead of leaving it blank, offer '/' 70 if ($dir_fs_www_root == '') $dir_fs_www_root = '/'; 71 72 73 // Set form input values 74 if (!isset($_POST['physical_path'])) $_POST['physical_path']=$dir_fs_www_root; 75 if (!isset($_POST['virtual_http_path'])) $_POST['virtual_http_path']= 'http://' . $virtual_path; 76 if (!isset($_POST['virtual_https_path'])) $_POST['virtual_https_path']='https://' . $virtual_https_path; 77 if (!isset($_POST['virtual_https_server'])) $_POST['virtual_https_server']='https://' . $virtual_https_server; 78 if (!isset($_POST['enable_ssl'])) $_POST['enable_ssl']=$enable_ssl; 79 if (!isset($_POST['enable_ssl_admin'])) $_POST['enable_ssl_admin']=$enable_ssl_admin; 80 81 82 setInputValue($_POST['physical_path'], 'PHYSICAL_PATH_VALUE', $dir_fs_www_root); 83 setInputValue($_POST['virtual_http_path'], 'VIRTUAL_HTTP_PATH_VALUE', 'http://' . $virtual_path); 84 setInputValue($_POST['virtual_https_path'], 'VIRTUAL_HTTPS_PATH_VALUE', 'https://' . $virtual_https_path); 85 setInputValue($_POST['virtual_https_server'], 'VIRTUAL_HTTPS_SERVER_VALUE', 'https://' . $virtual_https_server); 86 setRadioChecked($_POST['enable_ssl'], 'ENABLE_SSL', $enable_ssl); 87 setRadioChecked($_POST['enable_ssl_admin'], 'ENABLE_SSL_ADMIN', $enable_ssl_admin); 88 89 $zc_install->error = false; 90 $zc_install->fatal_error = false; 91 $zc_install->error_list = array(); 92 93 if (isset($_POST['submit'])) { 94 $zc_install->isEmpty($_POST['physical_path'], ERROR_TEXT_PHYSICAL_PATH_ISEMPTY, ERROR_CODE_PHYSICAL_PATH_ISEMPTY); 95 $zc_install->fileExists($_POST['physical_path'], ERROR_TEXT_PHYSICAL_PATH_INCORRECT, ERROR_CODE_PHYSICAL_PATH_INCORRECT); 96 $zc_install->isEmpty($_POST['virtual_http_path'], ERROR_TEXT_VIRTUAL_HTTP_ISEMPTY, ERROR_CODE_VIRTUAL_HTTP_ISEMPTY); 97 if ($_POST['enable_ssl'] == 'true' || $_POST['enable_ssl_admin'] == 'true') { 98 $zc_install->isEmpty($_POST['virtual_https_path'], ERROR_TEXT_VIRTUAL_HTTPS_ISEMPTY, ERROR_CODE_VIRTUAL_HTTPS_ISEMPTY); 99 $zc_install->isEmpty($_POST['virtual_https_server'], ERROR_TEXT_VIRTUAL_HTTPS_SERVER_ISEMPTY, ERROR_CODE_VIRTUAL_HTTPS_SERVER_ISEMPTY); 100 } 101 102 if (!$zc_install->fatal_error) { 103 header('location: index.php?main_page=phpbb_setup&language=' . $language . '&physical_path='.$_POST['physical_path'].'&virtual_http_path='.$_POST['virtual_http_path'].'&virtual_https_path='.$_POST['virtual_https_path'].'&virtual_https_server='.$_POST['virtual_https_server'].'&enable_ssl='.$_POST['enable_ssl'].'&enable_ssl_admin='.$_POST['enable_ssl_admin'].'&sql_cache='.$_GET['sql_cache'].'&is_upgrade='.$_GET['is_upgrade']); 104 exit; 105 } 106 } 107 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |