EOF; $html_footer = <<<EOF <div class="footer"> <h6><a href="http://www.33hao.com" target="_blank">程序来源于 bbs.33hao.com</a></h6> </div> EOF; require './include/function.php'; if (!in_array($_GET['step'], array(1, 2, 3, 4, 5))) { $_GET['step'] = 0; } switch ($_GET['step']) { case 1: require './include/var.php'; env_check($env_items); dirfile_check($dirfile_items); function_check($func_items); break; case 3: $install_error = ''; $install_recover = ''; $demo_data = file_exists('./data/utf8_add.sql') ? true : false; step3($install_error, $install_recover); break; case 4: step4(); break; case 5: $sitepath = strtolower(substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'))); $sitepath = str_replace('/shop/install', "", $sitepath); $auto_site_url = strtolower('http://' . $_SERVER['HTTP_HOST'] . $sitepath); break;
function location_to_latlng($device) { global $config; if (function_check('curl_version') !== true) { d_echo("Curl support for PHP not enabled\n"); return false; } $bad_loc = false; $device_location = $device['location']; if (!empty($device_location)) { $new_device_location = preg_replace("/ /", "+", $device_location); // We have a location string for the device. $loc = parse_location($device_location); if (!is_array($loc)) { $loc = dbFetchRow("SELECT `lat`,`lng` FROM `locations` WHERE `location`=? LIMIT 1", array($device_location)); } if (is_array($loc) === false) { // Grab data from which ever Geocode service we use. switch ($config['geoloc']['engine']) { case "google": default: d_echo("Google geocode engine being used\n"); $api_key = $config['geoloc']['api_key']; if (!empty($api_key)) { d_echo("Use Google API key: {$api_key}\n"); $api_url = "https://maps.googleapis.com/maps/api/geocode/json?address={$new_device_location}&key={$api_key}"; } else { $api_url = "https://maps.googleapis.com/maps/api/geocode/json?address={$new_device_location}"; } break; } $curl_init = curl_init($api_url); set_curl_proxy($curl_init); curl_setopt($curl_init, CURLOPT_RETURNTRANSFER, true); $data = json_decode(curl_exec($curl_init), true); // Parse the data from the specific Geocode services. switch ($config['geoloc']['engine']) { case "google": default: if ($data['status'] == 'OK') { $loc = $data['results'][0]['geometry']['location']; } else { $bad_loc = true; } break; } if ($bad_loc === true) { d_echo("Bad lat / lng received\n"); } else { $loc['timestamp'] = array('NOW()'); $loc['location'] = $device_location; if (dbInsert($loc, 'locations')) { d_echo("Device lat/lng created\n"); } else { d_echo("Device lat/lng could not be created\n"); } } } else { d_echo("Using cached lat/lng from other device\n"); } } }
$ectemplates->templatesDIR = ''; $step = intval(accept('step', 'R')) ? intval(accept('step', 'R')) : 0; $ectemplates->assign('step', $step); $ectemplates->assign('LAN', $LAN); if ($step == 3) { header("Location:../admin/"); } if (file_exists($installlock)) { message($LAN['install_errno_1000'], $LAN['install_errno_1045'], 0, 1); } if ($step == 0) { $ectemplates->display('step'); } elseif ($step == 1) { $ectemplates->assign('cp_items', syscheck($cp_items)); $ectemplates->assign('dir_items', dircheck($dir_items)); $ectemplates->assign('func_items', function_check($func_items)); $ectemplates->display('step'); } elseif ($step == 2) { @(include CONFIG); $dbclass = intval(accept('dbclass', 'R')) ? intval(accept('dbclass', 'R')) : 0; if ($dbclass == 0) { $ectemplates->assign('domain', admin_URL); $ectemplates->assign('app_items', $func_app); $ectemplates->display('step'); } elseif ($dbclass == 1) { $dbhost = accept('dbhost', 'R'); $dbname = accept('dbname', 'R'); $dbuser = accept('dbuser', 'R'); $dbpw = accept('dbpw', 'R'); $tablepre = accept('tablepre', 'R'); $username = accept('username', 'R');
} if (empty($method)) { show_msg('method_undefined', $method, 0); } if (file_exists($lockfile) && $method != 'ext_info') { show_msg('install_locked', '', 0); } elseif (!class_exists('dbstuff')) { show_msg('database_nonexistence', '', 0); } timezone_set(); $uchidden = getgpc('uchidden'); if ($method == 'show_license') { transfer_ucinfo($_POST); show_license(); } elseif ($method == 'env_check') { VIEW_OFF && function_check($func_items); env_check($env_items); dirfile_check($dirfile_items); show_env_result($env_items, $dirfile_items, $func_items); } elseif ($method == 'app_reg') { @(include ROOT_PATH . CONFIG); @(include ROOT_PATH . CONFIG_UC); if (!defined('UC_API')) { define('UC_API', ''); } if (getgpc('install_ucenter') == 'yes') { header("Location: index.php?step=3&install_ucenter=yes"); die; } $submit = true; $error_msg = array();
if (file_exists($copyFile)) { $cmsinfo = (include_once $copyFile); $CMSName = $cmsinfo['CMSNameNo']; $CompanyFullName = $cmsinfo['CompanyFullName']; $CompanyUrl = $cmsinfo['CompanyUrl']; } switch ($Step) { case '1': //第一步:检查系统配置 //name项目, r系统所需配置, b最佳配置, current当前配置 $cp_items = array(0 => array('name' => '操作系统', 'list' => 'os', 'c' => 'PHP_OS', 'r' => '不限', 'b' => 'Linux'), 1 => array('name' => 'PHP', 'list' => 'php', 'c' => 'PHP_VERSION', 'r' => '5.2', 'b' => '5.2'), 2 => array('name' => '上传配置', 'list' => 'upload', 'r' => '不限', 'b' => '5M'), 3 => array('name' => 'GD库', 'list' => 'gdversion', 'r' => '2.0', 'b' => '2.0'), 4 => array('name' => '磁盘空间', 'list' => 'disk', 'r' => '20M', 'b' => '不限')); $dir_items = array(0 => array('type' => 'file', 'path' => '../Upload/'), 1 => array('type' => 'file', 'path' => '../App/Conf'), 2 => array('type' => 'file', 'path' => '../App/Runtime')); $func_items = array(0 => array('name' => 'mysql_connect'), 1 => array('name' => 'mb_strlen'), 2 => array('name' => 'fsockopen'), 3 => array('name' => 'xml_parser_create'), 4 => array('name' => 'simplexml_load_file')); $SystemInfo = syscheck($cp_items); $DirInfo = dircheck($dir_items); $FunctionInfo = function_check($func_items); include_once "./Tpl/step1.html"; ob_flush(); flush(); foreach ($DirInfo as $d) { if ($d['status'] != 1) { echo '<script type="text/javascript">DisableNext();</script>'; ob_flush(); flush(); break; } } //函数有效性检查 foreach ($FunctionInfo as $s) { if ($s['status'] != true) { echo '<script type="text/javascript">DisableNext();</script>';