| | All rights reserved. | +-----------------------------------------------------------------------------+ | PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" | | FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE | | AT THE FOLLOWING URL: http://www.x-cart.com/license.php | | | | THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE | | THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. | | FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING | | AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). | | PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT | | CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, | | COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY | | (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS | | LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS | | AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND | | OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS | | AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE | | THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.| | THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2008 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # X-Cart installation wizard # # $Id: install.php,v 1.183.2.37 2008/04/25 07:00:33 max Exp $ # include "./top.inc.php"; require_once $xcart_dir."/include/func/func.core.php"; if (!defined('XCART_SESSION_START')) define('XCART_SESSION_START',1); if (!defined('XCART_START')) define('XCART_START',1); define("XCART_EXT_ENV", true); # # Predefined common variables # $min_ver = "4.0.6"; $directories_to_create = array("files", "catalog", "images", "var", "var/log", "var/cache", "var/tmp", "var/templates_c", "var/upgrade"); $directories_to_create[] = "files/admin"; $directories_to_create[] = "files/provider"; $directories_to_create[] = "files/root"; $init_blowfish_key = "8d5db63ada15e11643a0b1c3477c2c5c"; $files_to_create = array( "catalog/.htaccess" => "\nDeny from all\n\n\nDeny from all\n\nAllow from all", "images/.htaccess" => "\nDeny from all\n\n\nDeny from all\n\nAllow from all", "files/.htaccess" => "Deny from all", "var/.htaccess" => "Deny from all", "var/cache/.htaccess" => "\nAllow from all\n", ); $installation_product = "X-Cart"; # Check integrity of these files. $check_files = array( 'include/func/func.backoffice.php' => '78b4e61cec34d4621d7f6a656d4db95a', 'include/func/func.cart.php' => '5e3a10d369ae63fdef4a70c646bd6d2f', 'include/func/func.category.php' => '7a0cc227afac3acc364c30298b75f388', 'include/func/func.core.php' => 'e695a82c2766f3bb9ff13e2f99544ab9', 'include/func/func.crypt.php' => 'f82f6e16988ddf03116462b645bab8a0', 'include/func/func.db.php' => 'd9a899505ff0132d93074123ba5875f7', 'include/func/func.debug.php' => 'e7d4205c8579b74eb61e65f3e673543e', 'include/func/func.export.php' => '0ed63ca82b91a8833dd7cb380df250c0', 'include/func/func.files.php' => 'b3223f8a7eda8ba2524b3272da24a0b0', 'include/func/func.http.php' => '8f07f516ed0af362fca2c94599a87a1f', 'include/func/func.https_curl.php' => 'b2f9b1aa7b14e8c983f5c301ec687d3f', 'include/func/func.https_httpscli.php' => 'e4f319adc75947af2be1491350179556', 'include/func/func.https_libcurl.php' => '7cfd3437427930ea29d6544f8aa26f90', 'include/func/func.https_openssl.php' => '1a2ca6597d96732d9604b85c3221910f', 'include/func/func.https_ssleay.php' => '5243f7a156beb3ded3baff7eb04b636f', 'include/func/func.image.php' => '0fbf6720fe49d1d613e4347fae4af21a', 'include/func/func.import.php' => '8e42f153b2acb3dd84c5ed1db305d7f7', 'include/func/func.mail.php' => 'be3205307ebcde9d5203ffb95e3148a4', 'include/func/func.order.php' => 'eeed36cde4acae12c96a03f2241a5e54', 'include/func/func.payment.php' => '89d5bc1519eea11ba56b757f57a7c6b5', 'include/func/func.paypal.php' => '659baf69850fc31c87ac0f1dd6c35e00', 'include/func/func.product.php' => 'a5f97625365434b14157c69a96fc26e0', 'include/func/func.snapshots.php' => 'e226a61e0f04673defe8d574d4e83643', 'include/func/func.taxes.php' => 'f8114a792060b8482b4fa4e91c7e7228', 'include/func/func.templater.php' => '2f1b0161b3043a23721cccefa5b74768', 'include/func/func.tests.php' => '80ad9053e6fda0f14d64dc451ba434f9', 'include/func/func.user.php' => 'b908571bebf4f02b4814bbe2889ba5cc', 'include/func/func.xml.php' => '078e21bee3dc14e577ae0c1bdd985290' ); # Check if we got called from x-cart trial/demo version script. if (base64_encode($installation_product) == 'WC1DYXJ0IERlbW8=') { define("XCART_TRIAL", 1); } # Technical problems report constants. define("X_REPORT_PRODUCT_TYPE", "XC"); if (defined("XCART_TRIAL")) { define("X_REPORT_URL", 'https://secure.qualiteam.biz/service.php?target=install_feedback_report'); } else { define("X_REPORT_URL", 'https://secure.qualiteam.biz/customer.php?target=customer_info&action=install_feedback_report'); } $required_functions = array("popen", "exec", "pclose", "ini_set", "fsockopen"); # # Modules definition # used in include/install.php (install subsystem) # # This array describes what to do at the current step of installation: # - key in $modules - number of step # - $modules[$step]["name"] - suffix of function name # (e.g. module_language for "language") # - $modules[$step]["comment"] - name of language variable that # content will appears at page (see include/install_lng_*.php) # # Each module function should accept at least one argument: $params # Expected return value of module function: # - false on success # - true on failure (and set up global variable $error) # $modules = array ( 0 => array( "name" => "language", "comment" => "mod_language" ), 1 => array( "name" => "default", "comment" => "mod_license", "js_next" => 1 ), 2 => array( "name" => "check_cfg", "comment" => "mod_check_cfg" ), 3 => array( "name" => "cfg_install_db", "comment" => "mod_cfg_install_db", "js_next" => 1 ), 4 => array( "name" => "install_db", "comment" => "mod_install_db" ), 5 => array( "name" => "cfg_install_dirs", "comment" => "mod_cfg_install_dirs" ), 6 => array( "name" => "install_dirs", "comment" => "mod_install_dirs" ), 7 => array( "name" => "cfg_enable_paypal", "comment" => "mod_cfg_enable_paypal" ), 8 => array( "name" => "enable_paypal", "comment" => "mod_enable_paypal" ), 9 => array( "name" => "generate_snapshot", "comment" => "mod_generate_snapshot" ), 10 => array( "name" => "install_done", "comment" => "mod_install_done", "param" => "func_success" ) ); ################################################################ # # Common functions goes here # ################################################################ # # Wrapper for version_compare() function # if (!function_exists("func_version_compare")) { function func_version_compare($ver1, $ver2) { if (function_exists("version_compare")) return version_compare($ver1, $ver2); $ver1 = str_replace("..", ".", preg_replace("/([^\d\.]+)/S", ".\\1.", str_replace(array("_", "-", "+"), array(".", ".", "."), $ver1))); $ver2 = str_replace("..", ".", preg_replace("/([^\d\.]+)/S", ".\\1.", str_replace(array("_", "-", "+"), array(".", ".", "."), $ver2))); $ver1 = (array)explode(".", $ver1); $ver2 = (array)explode(".", $ver2); $ratings = array( "/^dev$/i" => -100, "/^alpha$/i" => -90, "/^a$/i" => -90, "/^beta$/i" => -80, "/^b$/i" => -80, "/^RC$/i" => -70, "/^pl$/i" => -60 ); foreach ($ver1 as $k => $v) { if (!is_numeric($v)) $v = preg_replace(array_keys($ratings), array_values($ratings), $v); if (!is_numeric($ver2[$k])) $ver2[$k] = preg_replace(array_keys($ratings), array_values($ratings), $ver2[$k]); $r = strcmp($v, $ver2[$k]); if ($r != 0) return $r; } return 0; } } function change_config($params, $force_blowfish_key = false) { global $installation_auth_code; $current_directory = str_replace("\\", "/", realpath(".")); $allfile = ""; // Write data to config.php if (!($fp = fopen("config.php", "r+"))) return false; while (!feof($fp)) { $buffer = fgets($fp, 4096); if (ereg('^\$sql_host *=', $buffer)) $buffer = ereg_replace('=.*;', "='".addslashes($params["mysqlhost"])."';", $buffer); if (ereg('^\$sql_user *=', $buffer)) $buffer = ereg_replace('=.*;', "='".addslashes($params["mysqluser"])."';", $buffer); if (ereg('^\$sql_db *=', $buffer)) $buffer = ereg_replace('=.*;', "='".addslashes($params["mysqlbase"])."';", $buffer); if (ereg('^\$sql_password *=', $buffer)) $buffer = ereg_replace('=.*;', "='".addslashes($params["mysqlpass"])."';", $buffer); if (ereg('^\$xcart_http_host *= *"', $buffer)) $buffer = ereg_replace('=.*;', "=\"".addslashes($params["xcart_http_host"])."\";", $buffer); if (ereg('^\$xcart_https_host *= *"', $buffer)) $buffer = ereg_replace('=.*;', "=\"".addslashes($params["xcart_https_host"])."\";", $buffer); if (ereg('^\$xcart_web_dir *= *"', $buffer)) $buffer = ereg_replace('=.*;', "=\"".addslashes($params["xcart_web_dir"])."\";", $buffer); if (ereg('^\$license *=', $buffer)) $buffer = ereg_replace('=.*;', "='".$installation_auth_code."';", $buffer); /* When the option "Update config.php only" is enabled, Blowfish key is not regenerated (This is not done intentionally, because, if the Blowfish key gets regenerated, the new key will be different from the key that was used to encrypt all the data, and the data will not be able to be decrypted). */ if ((empty($params["config_only"]) || $force_blowfish_key) && ereg('^\$blowfish_key *=', $buffer)) $buffer = ereg_replace('=.*;', "='".$params["blowfish_key"]."';", $buffer); $allfile .= $buffer; } ftruncate($fp, 0); rewind($fp); fwrite($fp, $allfile); fclose($fp); return true; } # # Recrypt all encrypted data # function recrypt_data(&$params) { global $bf_crypted_tables, $blowfish; if (!$blowfish) return false; $tbls = mysql_query("SHOW TABLES"); if (!$tbls) return false; while ($tbl = mysql_fetch_row($tbls)) { $tbl = preg_replace("/^xcart_/S", "", $tbl[0]); if (!isset($bf_crypted_tables[$tbl])) continue; $data = mysql_query("SELECT ".$bf_crypted_tables[$tbl]['key'].", ".implode(", ", $bf_crypted_tables[$tbl]['fields'])." FROM xcart_".$tbl." WHERE 1 ".$bf_crypted_tables[$tbl]['where']); if (!$data) continue; while ($row = mysql_fetch_assoc($data)) { $key = array_shift($row); if (empty($row) || empty($key)) continue; $update = array(); foreach ($row as $fname => $fvalue) { if (substr($fvalue, 0, 1) == "B") $update[] = $fname.' = "'.addslashes(recrypt_field($fvalue, $params)).'"'; } if (!empty($update)) { mysql_query("UPDATE xcart_$tbl SET ".implode(", ", $update)." WHERE ".$bf_crypted_tables[$tbl]['key']." = '".addslashes($key)."'"); } } mysql_free_result($data); } mysql_free_result($tbls); return true; } # # Recrypt field # function recrypt_field($field, &$params) { global $init_blowfish_key; if (empty($init_blowfish_key) || empty($params['blowfish_key']) || strlen($field) < 3 || substr($field, 0, 1) != 'B') return $field; if (substr($field, 1, 1) == '-') { $field = trim(func_bf_decrypt(substr($field, 2), $init_blowfish_key)); $init_crc32 = substr($field, -8); $field = substr($field, 0, -8); } else { $init_crc32 = substr($field, 1, 8); $field = trim(func_bf_decrypt(substr($field, 9), $init_blowfish_key)); } $crc32 = crc32(md5($field)); if (crc32("test") != -662733300 && $crc32 > 2147483647) $crc32 -= 4294967296; $crc32 = dechex(abs($crc32)); $crc32 = str_repeat("0", 8-strlen($crc32)).$crc32; return "B-".func_bf_crypt($field.$crc32, $params['blowfish_key']); } # # Check all encrypted data # function check_crypted_data($current_blowfish_key) { global $xcart_dir, $bf_crypted_tables, $blowfish; include $xcart_dir."/init.php"; x_load('crypt'); if ($current_blowfish_key !== false) $blowfish_key = $current_blowfish_key; if (empty($bf_crypted_tables) || empty($blowfish) || empty($blowfish_key)) return false; $tbls = mysql_query("SHOW TABLES"); if (!$tbls) return false; $i = 0; while ($tbl = mysql_fetch_row($tbls)) { $tbl = preg_replace("/^xcart_/S", "", $tbl[0]); if (!isset($bf_crypted_tables[$tbl])) continue; $data = mysql_query("SELECT ".$bf_crypted_tables[$tbl]['key'].", ".implode(", ", $bf_crypted_tables[$tbl]['fields'])." FROM xcart_".$tbl." WHERE 1 ".$bf_crypted_tables[$tbl]['where']); if (!$data) continue; while ($row = mysql_fetch_assoc($data)) { $key = array_shift($row); if (empty($row) || empty($key)) continue; foreach ($row as $fname => $field) { if (substr($field, 0, 1) != "B") continue; if (substr($field, 1, 1) == '-') { $field = trim(func_bf_decrypt(substr($field, 2), $blowfish_key)); $init_crc32 = substr($field, -8); $field = substr($field, 0, -8); $crc32 = func_crc32(md5($field)); } else { $init_crc32 = substr($field, 1, 8); $field = trim(func_bf_decrypt(substr($field, 9), $blowfish_key)); $crc32 = func_crc32($field); } if ($init_crc32 != $crc32) return false; if (++$i % 10 == 0) { echo ". "; flush(); } } } mysql_free_result($data); } mysql_free_result($tbls); return true; } function config_get($dir) { static $var_defs = array ( 'sql_host', 'sql_user', 'sql_db', 'sql_password', 'xcart_http_host', 'xcart_https_host', 'xcart_web_dir', 'license' ); static $config_files = array ( 'config.php', 'config.local.php' ); $cnf = false; foreach ($config_files as $f) { $file = $dir.'/'.$f; $fp = @fopen($file, "r"); if (!$fp) continue; $buffer = fread($fp, filesize($file)); fclose($fp); foreach ($var_defs as $var) { $regexp = '!^\s*\$'.preg_quote($var).'\s*=\s*[\'"](.+)[\'"];!'; if (preg_match($regexp, $buffer, $matches)) { $cnf[$var] = $matches[1]; } } } return $cnf; } ################################################################ # # Modules goes here # ################################################################ # # start: Default module # Shows Terms & Conditions # function module_default(&$params) { global $error, $templates_directory; global $installation_auth_code; global $installation_product; global $install_lng; ?>



:




function step_next() { if (document.getElementById('agree').checked) { return true; } else { alert(""); } return false; }
 
... -
 
 
... -
... -
... -
... -
... -
... -
... -
 
 
... -
... -
... -
... -
> error' . lng_get("env_checks_failed") . ":\n
    \n"; foreach ($check_errors['env'] as $name => $value) { if (is_array($value)) { $value = func_get_check_error_value($name, $value); } func_show_check_err($name, $value); } echo "
\n"; } if (isset($check_errors['critical']) && !empty($check_errors['critical'])) { echo '

error' . lng_get("critical_deps_failed") . ":

\n
    \n"; foreach ($check_errors['critical'] as $name => $value) { func_show_check_err($name, $value); } echo "
\n"; } if (isset($check_errors['noncritical']) && !empty($check_errors['noncritical'])) { echo '

warning' . lng_get("non_critical_deps_failed") . ":

\n
    \n"; foreach ($check_errors['noncritical'] as $name => $value) { func_show_check_err($name, $value); } echo "
\n"; } if ($check_failed) { echo '
warning'.lng_get("test_found_errors").'
'."\n"; } ?>


> chmod 777 .
> chmod 666 config.php
> chmod 755 admin/newsletter.sh
> chmod 755 payment/*.pl


:

" />
" />
" />


1) { $country_preconf[''] = ''; # no preconfiguration by default asort($country_preconf); } ?>


function step_next() { for (var i = 0; i < document.ifrm.elements.length; i++) { if (document.ifrm.elements[i].name.search("mysqlhost") != -1) { if (document.ifrm.elements[i].value == "") { alert (""); return false; } } if (document.ifrm.elements[i].name.search("mysqluser") != -1) { if (document.ifrm.elements[i].value == "") { alert (""); return false; } } if (document.ifrm.elements[i].name.search("mysqlbase") != -1) { if (document.ifrm.elements[i].value == "") { alert (""); return false; } } } return true; } ".lng_get("check_crypted_data")."
\n"; flush(); $res = check_crypted_data(empty($params['previous_blowfish_key']) ? false : $params['previous_blowfish_key']); echo status($res)."
\n"; if (!$res) { fatal_error(lng_get(empty($params['previous_blowfish_key']) ? "check_crypted_data_failed" : "check_w_oldkey_crypted_data_failed")); } elseif (!empty($params['previous_blowfish_key'])) { $blowfish_key = $params['previous_blowfish_key']; } $ck_res = $ck_res && $res; if ($ck_res) echo "




"; } if ($ck_res) { # Generate new Blowfish key mt_srand(time()); $params['blowfish_key'] = md5(mt_rand(0, time())); # Updating config.php file echo "
".lng_get("updating_config_file")."
\n"; flush(); $res = change_config($params); echo status($res)."
\n"; if (!$res) fatal_error(lng_get("error_cannot_open_config")); $ck_res = $ck_res && $res; if (empty($params["config_only"])) { $ck_res = $ck_res && do_install_db($params); } } } ?>


".lng_get("creating_tables")."
\n"; $ck_res = true; if ($ck_res) $ck_res = query_upload("sql/dbclear.sql"); if ($ck_res) $ck_res = query_upload("sql/xcart_tables.sql"); if ($ck_res) echo "
".lng_get("importing_data")."
\n"; flush(); if ($ck_res) $ck_res = query_upload("sql/xcart_data.sql"); # # Importing languages # if ($ck_res) { if (empty($params["languages"])) $params["languages"] = array($params['lngcode']); echo "
".lng_get("importing_languages")."
\n"; flush(); if (is_array($params["languages"])) { foreach ($params["languages"] as $_k=>$lng_code) if ($ck_res) $ck_res = query_upload("sql/xcart_language_".$lng_code.".sql"); } } # # Importing states # if ($ck_res && !empty($params["states"])) { echo "
".lng_get("importing_states")."
\n"; flush(); if (is_array($params["states"])) { foreach($params["states"] as $_k=>$country_code) { if ($ck_res) $ck_res = query_upload("sql/states_".$country_code.".sql"); } } } # # Importing sample data # if ($ck_res && $params["demo"] == 1) { echo "
".lng_get("importing_demodata")."
\n"; flush(); $demo_files = array("sql/xcart_demo.sql","sql/xcart_demo_".$params["conf"].".sql"); foreach ($demo_files as $_file) { if (!file_exists($xcart_dir."/".$_file)) continue; $ck_res = $ck_res && query_upload($_file); if (!$ck_res) break; } } # # Apply pre-configured settings to selected country # if ($ck_res && !empty($params["conf"])) { echo "
".lng_get("importing_data")."
\n"; flush(); $ck_res = $ck_res && query_upload("sql/xcart_conf_".$params["conf"].".sql"); } if ($ck_res && !empty($params["company_email"])) { $ck_res = $ck_res && runquery("UPDATE xcart_config SET value='$params[company_email]' WHERE name in ('orders_department','support_department','newsletter_email','users_department','site_administrator')"); $ck_res = $ck_res && runquery("UPDATE xcart_customers SET email='$params[company_email]'"); } # # Move images to the file system # if ($ck_res && $params['images_location'] == "FS") { echo "
".lng_get("moving_images_to_fs")."
\n"; flush(); include $xcart_dir."/init.php"; x_load('backoffice','image'); # process N images per pass $images_step = 50; foreach (array_keys($config['available_images']) as $avail_type) { $str_out = ""; $moved = func_move_images($avail_type, array("location" => "FS")); if (!$moved) { $ck_res = false; break; } } runquery("UPDATE xcart_setup_images SET location='FS'"); func_build_quick_flags(); func_data_cache_get("setup_images", array(), true); } if (!$ck_res) fatal_error(lng_get("fatal_error_install_db")); else { recrypt_data($params); @mysql_query("INSERT INTO xcart_config VALUES ('license','License','$installation_auth_code','',0,'text')"); } if ($ck_res) $params['db_is_installed'] = 'Y'; return $ck_res; } # # end: Install_db module # # # start: Cfg_install_dirs module # Get color/layout settings # function module_cfg_install_dirs(&$params) { global $error, $schemes_repository; $skin_descr = read_skin_descr(); ?>

:



".lng_get("creating_directories")."
\n"; $ck_res = $ck_res && create_dirs($directories_to_create); $ck_res = $ck_res && create_files($files_to_create); if ($ck_res && !file_exists($xcart_dir.DIRECTORY_SEPARATOR.".pgp") && file_exists($xcart_dir.DIRECTORY_SEPARATOR.".pgp.def")) { $ck_res = copy_files_sub(".pgp.def", ".pgp"); } } if($ck_res) { echo "
".lng_get("copying_templates")."
\n"; $ck_res = copy_files($templates_repository); } if($ck_res && !empty($params["color"])) { echo "
".lng_get("copying_color_scheme")."
\n"; $ck_res = copy_files($schemes_repository."/colors/".$params["color"]); } if($ck_res && !empty($params["dingbats"])) { echo "
".lng_get("copying_dingbats")."
\n"; $ck_res = copy_files($schemes_repository."/dingbats/".$params["dingbats"]); } if($ck_res && !empty($params["layout"])) { echo "
".lng_get("creating_layout")."
\n"; $ck_res = copy_files($schemes_repository."/templates/".$params["layout"]); } if ($ck_res) { $data = sprintf("layout=%s\ncolor=%s\ndingbats=%s", $params["layout"], $params["color"], $params["dingbats"]); $file = $xcart_dir.DIRECTORY_SEPARATOR.$templates_directory.DIRECTORY_SEPARATOR.'.skin_descr'; $fp = fopen($file,"w"); $ck_res = ($fp !==false); if ($ck_res) { fwrite($fp, $data); fclose($fp); } else warning_error(lng_get("warn_file_create_failed", "file", $file)); } if (!$ck_res) { fatal_error(lng_get("error_creating_directories")); } else { # Clean var/templates_c and var/cache directories $clean_dirs = array( "./var/templates_c", "./var/cache" ); foreach($clean_dirs as $cd) { if (!is_dir($cd) || !file_exists($cd)) continue; $d = @opendir($cd); if (!$d) continue; while ($f = readdir($d)) { if ($f == '.' || $f == '..') continue; @unlink($cd."/".$f); } closedir($d); } $cnf = config_get($xcart_dir); $location = 'home.php'; if (!empty($cnf['xcart_web_dir'])) $location = $cnf['xcart_web_dir'].DIR_CUSTOMER."/home.php"; ?>

()







"; echo_lng("err_".$result["errordescr"]); echo ""; } else { $config_snapshots[] = array("time"=>$current_time, "descr"=>lng_get("installation_snapshot")); f_update_snapshots($config_snapshots); echo "
"; echo_lng("msg_snapshot_generated"); if (!empty($result["unprocessed_files"])) echo_lng("txt_N_unprocessed_files_in_snapshot", "unproc", $result["unprocessed_files"], "total", $result["total_files"]); } echo "

"; ?> !Si'; else $pattern = '!!Si'; if (preg_match($pattern, $php_info, $m)) { $php_ini_path = trim(strip_tags($m[1])); } $php_ini_path = ($php_ini_path ? (($ver < "5.0.0") ? $php_ini_path.DIRECTORY_SEPARATOR.'php.ini' : $php_ini_path) : 'php.ini'); return $php_ini_path; } # # Output a check error description. # function func_show_check_err($name, $value) { $php_ini_path = func_get_php_ini_path(); echo '
  • ' . lng_get($name.'_title', 'value', $value, 'php_ini_path', $php_ini_path).'
    '; echo ''.lng_get('click_to_open').''; echo ' '; echo ''.lng_get('err_show_details').'
    '."\n"; echo '\n"; echo "
  • \n"; } # # Prepare a error value # function func_get_check_error_value($error, $value) { switch ($error) { case 'int_check_files': $val = ''; if (is_array($value) && !empty($value)) { $val = ""; } return $val; default: return 'UNKNOWN ERROR CODE'; } } # # Show environment/server check error. # function module_check_error(&$params) { global $HTTP_GET_VARS; $php_ini_path = func_get_php_ini_path(); $check_errors = func_get_env_srv_state(); $found_error = false; $value = null; foreach (array("env", "critical", "noncritical") as $type) { if (isset($check_errors[$type][$HTTP_GET_VARS['error']])) { $found_error = true; $value = $check_errors[$type][$HTTP_GET_VARS['error']]; if (is_array($value)) { $value = func_get_check_error_value($HTTP_GET_VARS['error'], $value); } break; } } if (!$found_error) { echo "

    ".lng_get("err_unknown_check_error")."

    \n"; return; } $err_title = lng_get($HTTP_GET_VARS['error'].'_title', 'value', $value); $err_descr = lng_get($HTTP_GET_VARS['error'].'_descr', 'php_ini_path', $php_ini_path, 'value', $value); echo '





    'PayPal', 'payment_script' => 'payment_cc.php', 'payment_template' => $template, 'active' => 'N', 'orderby' => '999', 'processor_file' => $processor ); $paymentid = func_array2insert('payment_methods', $insert_params); db_query("UPDATE $sql_tbl[ccprocessors] SET paymentid='".$paymentid."', param01='".$paypal_account."', param02='".addslashes($config['Company']['company_name'])."', param03='USD' WHERE processor='".$processor."'"); $tmp = func_query_first("SELECT * from $sql_tbl[ccprocessors] WHERE processor='ps_paypal_pro.php'"); $cc_processor = $tmp["module_name"]; // PayPal ExpressCheckout $insert_params['payment_method'] = $cc_processor.': '.$tmp['param08']; $insert_params['processor_file'] = 'ps_paypal_pro.php'; $paymentid = func_array2insert('payment_methods', $insert_params); db_query("UPDATE $sql_tbl[ccprocessors] SET paymentid='".$paymentid."' WHERE processor='ps_paypal_pro.php'"); // PayPal DirectPayment $insert_params['payment_template'] = 'customer/main/payment_cc.tpl'; $insert_params['payment_method'] = $cc_processor.': '.$tmp['param09']; func_array2insert('payment_methods', $insert_params); } else { db_query("UPDATE $sql_tbl[ccprocessors] SET paymentid='".$paymentid."', param01='".$paypal_account."' WHERE processor='".$processor."'"); db_query("UPDATE $sql_tbl[payment_methods] SET active='N' WHERE paymentid='".$paymentid."'"); } $mail_smarty->assign("paypal_enable_id", $paypal_enable_id); func_send_mail($paypal_account, 'mail/paypal_enable_subj.tpl', 'mail/paypal_enable.tpl', $config["Company"]["site_administrator"], true); } ob_start(); ?>

    1. : admin
      : admin

    2. :
      :

      : root
      : root

    ".lng_get("install_paypal_mail_note")."
    "; if (empty($params['flags']['noinfomail']) && !empty($params['company_email'])) { $lend = (X_DEF_OS_WINDOWS?"\r\n":"\n"); if (X_DEF_OS_WINDOWS) $message = preg_replace("/(? $email_message


    $install_wiz EOT; $headers = "From: \"$install_wiz\" <$params[company_email]>" . $lend . "X-Mailer: PHP/" . phpversion() . $lend . "MIME-Version: 1.0" . $lend . "Content-Type: text/html; charset=" . $install_language_charset . $lend; if (preg_match('/([^ @,;<>]+@[^ @,;<>]+)/S', $params['company_email'], $m)) { @mail($params['company_email'], lng_get("install_complete"), $email_message, $headers, "-f".$m[1]); } else { @mail($params['company_email'], lng_get("install_complete"), $email_message, $headers); } } return false; } # # end: Install_done module # function func_get_disabled_funcs() { $disabled_functions = split('[, ]', ini_get("disable_functions")); if (!empty($disabled_functions) && is_array($disabled_functions)) { $tmp = array(); foreach ($disabled_functions as $f) { if (!empty($f)) { $tmp[] = $f; } } $disabled_functions = $tmp; } else { $disabled_functions = array(); } return $disabled_functions; } # # Check environment and server configuration. # function func_get_env_srv_state() { global $min_ver, $required_functions, $check_files; $check_errors = array('env' => array(), 'critical' => array(), 'noncritical' => array()); if (!empty($check_files) && is_array($check_files)) { $integrity_check_result = array(); $status = true; foreach ($check_files as $file => $md5) { if (!@file_exists($file)) { $status = false; $integrity_check_result[$file] = 'int_check_file_not_found'; continue; } if (!@is_readable($file)) { $status = false; $integrity_check_result[$file] = 'int_check_not_readable'; continue; } if (md5(join("", file($file))) != $md5) { $status = false; $integrity_check_result[$file] = 'int_check_md5_nok'; continue; } #$integrity_check_result[$file] = 'int_check_ok'; } if ($status == false) { $check_errors['env']['int_check_files'] = $integrity_check_result; } } # Detect the list of disabled functions. $disabled_functions = func_get_disabled_funcs(); # Check PHP version. $ver = phpversion(); $status = ($min_ver > $ver ? 0 : 1); if (!$status) { $check_errors['critical']['dep_php_ver'] = $ver; } # Check PCRE extension presence. $status = function_exists('preg_match') ? 1 : 0; if (!$status) { $check_errors['critical']['dep_pcre'] = on_off($status); } # Check if Safe mode is enabled. $res = bool_get("safe_mode"); $status = (!empty($res) ? 0 : 1); if (!$status) { $check_errors['critical']['dep_safe_mode'] = on_off(!$status); } # ini_set must be allowed. $status = !in_array("ini_set", $disabled_functions) && is_callable("ini_set"); if (!$status) { $check_errors['critical']['dep_ini_set'] = join(", ", $disabled_functions); } # File uploads must be On. $res = bool_get("file_uploads"); $status = (!empty($res) ? 1 : 0); if (!$status) { $check_errors['critical']['dep_uploads'] = on_off($status); } # MySQL functions must present. $status = function_exists('mysql_connect'); if (!$status) { $check_errors['critical']['dep_mysql'] = lng_get("bool_off"); } # Register long arrays (PHP 5) must be On. $ver = phpversion(); $res = ($ver >= "5.0.0" ? bool_get("register_long_arrays") : 1); $status = (empty($res) ? 0 : 1); if (!$status) { $check_errors['critical']['dep_long_arrays'] = on_off($status); } # Disabled functions list should not include required functions. if (is_array($disabled_functions) && !empty($disabled_functions)) { $tmp = array_intersect($disabled_functions, $required_functions); if (count($tmp) > 0) { $check_errors['noncritical']['dep_disable_funcs'] = join(", ", $tmp); } } # Check maximum allowed size of an uploaded file. $res = ini_get("upload_max_filesize"); if (!$res) { $check_errors['noncritical']['dep_upl_max'] = $res; } # Check if fopen can open URLs. $res = bool_get("allow_url_fopen"); $status = (!empty($res) ? 1 : 0); if (!$status) { $check_errors['noncritical']['dep_fopen'] = on_off($res); } # Check blowfish encryption mode. $res = false; if (defined("BF_MODE")) { $res = constant("BF_MODE"); } else if (include_once "./include/blowfish.php") { $blowfish = new ctBlowfish(); func_bf_check_env(); $res = constant("BF_MODE"); } if (empty($res) || $res == 3) { $check_errors['noncritical']['dep_blowfish'] = $res ? 'bitwise emulation' : 'unknown blowfish encryption mode'; } return $check_errors; } # # Generate server check report in text format. # function func_generate_check_report() { global $installation_product; global $install_language_code; global $HTTP_SERVER_VARS; $check_errors = func_get_env_srv_state(); $old_install_language_code = $install_language_code; $install_language_code = 'US'; $delimiter = str_repeat("-", 80)."\n"; $xcart_version = 'unknown'; if (@file_exists("VERSION")) { $xcart_version = trim(join("", file("VERSION"))); } $report = $installation_product . ' version: '.$xcart_version."\n".$delimiter; $report .= "Report time: " . date("r")."\n".$delimiter; if (isset($HTTP_SERVER_VARS['HTTP_REFERER']) && !empty($HTTP_SERVER_VARS['HTTP_REFERER'])) { $report .= "HTTP_REFERER: " . $HTTP_SERVER_VARS['HTTP_REFERER']."\n".$delimiter; } # Environment checks. if (!empty($check_errors['env'])) { $report .= "ENVIRONMENT CHECK ERRORS:"."\n".$delimiter; foreach ($check_errors['env'] as $k => $v) { if (is_array($v)) { $v = func_get_check_error_value($k, $v); } $report .= "- " . strip_tags(lng_get($k."_title", "value", $v))."\n[CHECK RESULT]:\n" . strip_tags($v) . "\n"; } $report .= $delimiter; } # Server checks. foreach (array("critical", "noncritical") as $type) { if (!empty($check_errors[$type])) { $report .= strtoupper($type)." ERRORS:"."\n".$delimiter; foreach ($check_errors[$type] as $k => $v) { $report .= "- " . strip_tags(lng_get($k."_title", "value", $v))." [CHECK RESULT: ".strip_tags($v)."]\n"; } $report .= $delimiter; } } # PHP info $report .= "\n============================= PHP INFO =============================\n"; $disabled_functions = func_get_disabled_funcs(); if (is_array($disabled_functions) && in_array("phpinfo", $disabled_functions)) { $phpinfo = "phpinfo() disabled.\n"; } else { ob_start(); phpinfo(); $phpinfo = ob_get_contents(); ob_end_clean(); # prepare phpinfo $phpinfo = preg_replace("/]*>/iU", " | ", $phpinfo); $phpinfo = preg_replace("/<[^>]+>/iU", "", $phpinfo); $phpinfo = preg_replace("/(?:<)((?!>).)*?>/i", "", $phpinfo); $pos = strpos($phpinfo, "PHP Version"); if ($pos !== false) { $phpinfo = substr($phpinfo, $pos); } $pos = strpos($phpinfo, "PHP License"); if ($pos !== false) { $phpinfo = substr($phpinfo, 0, $pos); } $phpinfo = preg_replace("/ {2,}/mS", " ", $phpinfo); } $report .= $phpinfo; $install_language_code = $old_install_language_code; return $report; } # # Detects php.ini file location. # function func_get_php_ini_path() { static $php_ini_path; if (isset($php_ini_path)) { return $php_ini_path; } ob_start(); phpinfo(INFO_GENERAL); $php_info = ob_get_contents(); ob_end_clean(); $ver = phpversion(); if ($ver >= "5.0.0") $pattern = '!
    Loaded Configuration File ([^<]*)
    Configuration File[^<]+([^<]*)
    '; if (!empty($err_title) && !empty($err_descr)) { echo '

    '.$err_title."

    \n"; echo $err_descr; } else { echo "

    ".lng_get("err_unknown_check_error")."

    \n"; } echo "
    \n"; return false; } # # Prepare "Technical problems report" form. # function module_send_problem_report(&$params) { $check_errors = func_get_env_srv_state(); if (empty($check_errors['env']) && empty($check_errors['critical']) && empty($check_errors['noncritical'])) { echo '

    '.lng_get("techrep_no_errors").'

    '; return false; } echo '
    '; echo "

    ".lng_get("technical_problems_report")."

    \n"; echo lng_get("techrep_intro")."\n"; echo '
    '; echo ''."\n"; if (defined("XCART_TRIAL")) { echo ''.lng_get('techrep_your_email').':

    '."\n"; } echo ''.lng_get("technical_problems_report").':
    '."\n"; echo '

    '."\n"; echo ''.lng_get("techrep_user_note").':
    '."\n"; echo '

    '."\n"; echo '

    '."\n"; if (!defined("XCART_TRIAL")) { echo lng_get("techrep_send_note")."\n"; } echo "
    \n"; echo "
    \n"; return false; } # If we got called in "show_check_error" mode, show check error on the only installation step. if (isset($HTTP_GET_VARS['mode']) && $HTTP_GET_VARS['mode'] == 'show_check_error' && !empty($HTTP_GET_VARS['error'])) { $HTTP_POST_VARS['current'] = 0; $modules = array ( 0 => array( "name" => "check_error", "comment" => "mod_check_error" ), 1 => array( "name" => "check_error", "comment" => "mod_check_error" ) ); define("XCART_SKIP_INSTALLER_FORM", 1); } # If customer pressed on "Send report" button at "Checking PHP configuration" step, then show # a technical problem report page. if (isset($HTTP_POST_VARS['send_problem_report'])) { $HTTP_POST_VARS['current'] = 0; $modules = array ( 0 => array( "name" => "send_problem_report", "comment" => "mod_send_problem_report" ), 1 => array( "name" => "send_problem_report", "comment" => "mod_send_problem_report" ), ); # Tech report page does not require standard installer form. define("XCART_SKIP_INSTALLER_FORM", 1); } $use_sessions_type = 99; include "./include/install.php"; ?>