$template->set_template_file(VIVVO_FS_ROOT . 'installer/templates/frame.xml'); $installer_lang = $sm->get_lang(); if (isset($_POST['installer_lang'])) { setcookie('installer_lang', $_POST['installer_lang']); $_COOKIE['installer_lang'] = $_POST['installer_lang']; } if (isset($_COOKIE['installer_lang'])) { $installer_lang->load_lang($_COOKIE['installer_lang'], 'installer/lang/', 'installer'); } else { $installer_lang->load_lang($_COOKIE['installer_lang'] = 'vietnamese', 'installer/lang/', 'installer'); } define('VIVVO_INSTALLER_LANG', $_COOKIE['installer_lang']); $um = $sm->get_url_manager(); $lang = $sm->get_lang(); if ($um->get_param('step') == 2) { step2($template, $dm, $lang); } elseif ($um->get_param('step') == 3) { step3($template, $dm, $lang); } elseif ($um->get_param('step') == 4) { step4($template, $dm, $lang); } elseif ($um->get_param('step') == 5) { step5($template, $dm, $lang); } elseif ($um->get_param('step') == 6) { step6($template, $dm, $lang); vivvo_cache::get_instance()->delete_all(); } else { step1($template, $dm, $lang); } $template->assign('DUMP_MESSAGES', $dm->_dump_pool); echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n"; echo $sm->get_output();
function step7() { $user_name = trim($_REQUEST['user_name']); $password = trim($_REQUEST['password']); $confirmpassword = trim($_REQUEST['confirmpassword']); if (!$user_name) { $message = '请设置用户名'; step6($message); } if (!$password || $confirmpassword != $password) { $message = '未设置密码或两次密码不一致'; step6($message); } $app = file_get_contents(CACHE_DIR . 'app.tmp'); $app = json_decode($app, 1); $db = file_get_contents(CACHE_DIR . 'db.tmp'); $db = json_decode($db, 1); $auth = @file_get_contents(CACHE_DIR . 'auth.tmp'); $auth = json_decode($auth, 1); $socket = new hgSocket(); $con = $socket->connect($app['ip'], $app['port']); if (!intval($con)) { step6('安装无法完成,服务器无法连接,请确认服务器ip是否正确或服务程序hogeMonitor.py是否监听在' . $app['ip'] . ':' . $app['port'] . '上'); } $socket->close(); $password = md5($password); $content = get_serv_file($app, $app['dir'] . 'conf/config.php'); $string = "\$gGlobalConfig['admin_user'] = array(\n'{$user_name}' => '{$password}',\n);"; $content = preg_replace("/\\?>/is", "\n{$string}\n?>", $content); write_serv_file($app, $app['dir'] . 'conf/config.php', $content, 'utf8'); hg_run_cmd($app, 'runcmd', 'chmod -Rf 777 ' . $app['dir'] . 'cache/ ' . $app['dir'] . 'conf/config.php'); if ($db) { $pass = hg_encript_str($db['pass'], false, $auth['appkey']); $link = mysql_connect($db['host'], $db['user'], $pass); mysql_query("SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary", $link); mysql_select_db($db['database'], $link); $db_data = json_encode($db); $app_data = json_encode($app); $sql = 'INSERT INTO ' . $db['dbprefix'] . "server (name, brief, ip, outip, type, more_data,create_time) VALUES \n\t\t\t\t('app数据库服务器', '', '{$db['host']}', '', 'db', '{$db_data}', " . time() . ");\n\t\t\t\t"; mysql_query($sql, $link); $sql = 'INSERT INTO ' . $db['dbprefix'] . "server (name, brief, ip, outip, type, more_data,create_time) VALUES \n\t\t\t\t('app服务器', '', '{$app['ip']}', '{$app['outip']}', 'app', '{$app_data}', " . time() . ");\n\t\t\t\t"; mysql_query($sql, $link); $server_id = mysql_insert_id(); $sql = 'INSERT INTO ' . $db['dbprefix'] . "server_domain (server_id, domain, dir, create_time) VALUES \n\t\t\t\t('{$server_id}', '{$app['domain']}', '{$app['dir']}', " . time() . ");\n\t\t\t\t"; mysql_query($sql, $link); } $appstore = new curl('appstore.hogesoft.com:233', ''); $appstore->mAutoInput = false; $appstore->setClient(CUSTOM_APPID, CUSTOM_APPKEY); $appstore->initPostData(); $appstore->addRequestData('a', 'installed'); $appstore->addRequestData('app', 'livworkbench'); $appstore->request('index.php'); header('Location:' . '?action=complete'); }
break; case 'step3': // Step 3: Check read/write access to DB configuration file step3(); break; case 'step4': // Step 4: Get DB Type step4(); break; case 'step5': // Step 5: Get DB Parameters step5(); break; case 'step6': //Step 6: Check read/write access to DB step6(); break; case 'step7': // Step 7: Review setup before commit step7(); break; case 'step8': // Step 8: Write main configuration file and DB configuration file step8(); break; case 'step9': // Step 9: Install DB Tables and default data step9(); break; case 'step10': // Step 10: Check site security
if(isset($_GET["popup"])){popup();exit;} if(isset($_POST["eth"])){step0_save();exit;} if(isset($_POST["ucarp_vid"])){step0_save();exit;} if(isset($_POST["second_ipaddr"])){step0_save();exit;} if(isset($_POST["SLAVE"])){step0_save();exit;} if(isset($_GET["tabs"])){tabs();exit;} if(isset($_GET["status"])){status();exit;} if(isset($_GET["step1"])){step1();exit;} if(isset($_GET["step2"])){step2();exit;} if(isset($_GET["step3"])){step3();exit;} if(isset($_GET["step4"])){step4();exit;} if(isset($_GET["step5"])){step5();exit;} if(isset($_GET["step6"])){step6();exit;} if(isset($_GET["step7"])){step7();exit;} if(isset($_GET["step8"])){step8();exit;} if(isset($_GET["unlink-js"])){unlink_js();exit;} if(isset($_GET["unlink-step1"])){unlink_setp1();exit;} if(isset($_GET["unlink-step2"])){unlink_setp2();exit;} if(isset($_GET["unlink-notify-slave"])){unlink_notify_slave();exit;} if(isset($_GET["unlink-reconfigure"])){unlink_reconfigure();exit;} if(isset($_GET["unlink-step3"])){unlink_setp3();exit;} if(isset($_POST["StepR1"])){die();} js(); function js(){ header("content-type: application/x-javascript");