/**
* [WeEngine System] Copyright (c) 2014 WE7.CC
* WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
*/
ini_set('display_errors', '1');
error_reporting(E_ALL ^ E_NOTICE);
set_time_limit(0);
ob_start();
define('IA_ROOT', str_replace("\\",'/', dirname(__FILE__)));
define('APP_URL', 'http://v2.addons.we7.cc/web/');
define('APP_STORE_URL', 'http://v2.addons.we7.cc/web');
define('APP_STORE_API', 'http://v2.addons.we7.cc/api.php');
if($_GET['res']) {
$res = $_GET['res'];
$reses = tpl_resources();
if(array_key_exists($res, $reses)) {
if($res == 'css') {
header('content-type:text/css');
} else {
header('content-type:image/png');
}
echo base64_decode($reses[$res]);
exit();
}
}
// $actions = array('license', 'env', 'db', 'cloud', 'upgrade', 'finish');
$actions = array('license', 'env', 'db', 'finish');
$action = !empty($_GET['step']) ? $_GET['step'] : $_COOKIE['action'];
$action = in_array($action, $actions) ? $action : 'license';
$ispost = strtolower($_SERVER['REQUEST_METHOD']) == 'post';
if(file_exists(IA_ROOT . '/data/install.lock') && $action != 'finish' && $action != 'cloud' && $action != 'upgrade') {
header('location: ./index.php');
exit;
}
header('content-type: text/html; charset=utf-8');
if($action == 'license') {
if($ispost) {
setcookie('action', 'env');
header('location: ?refresh');
exit;
}
tpl_install_license();
}
if($action == 'env') {
if($ispost) {
setcookie('action', $_POST['do'] == 'continue' ? 'db' : 'license');
header('location: ?refresh');
exit;
}
$ret = array();
$ret['server']['os']['value'] = php_uname();
if(PHP_SHLIB_SUFFIX == 'dll') {
$ret['server']['os']['remark'] = '建议使用 Linux 系统以提升程序性能';
$ret['server']['os']['class'] = 'warning';
}
$ret['server']['sapi']['value'] = $_SERVER['SERVER_SOFTWARE'];
if(PHP_SAPI == 'isapi') {
$ret['server']['sapi']['remark'] = '建议使用 Apache 或 Nginx 以提升程序性能';
$ret['server']['sapi']['class'] = 'warning';
}
$ret['server']['php']['value'] = PHP_VERSION;
$ret['server']['dir']['value'] = IA_ROOT;
if(function_exists('disk_free_space')) {
$ret['server']['disk']['value'] = floor(disk_free_space(IA_ROOT) / (1024*1024)).'M';
} else {
$ret['server']['disk']['value'] = 'unknow';
}
$ret['server']['upload']['value'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknow';
$ret['php']['version']['value'] = PHP_VERSION;
$ret['php']['version']['class'] = 'success';
if(version_compare(PHP_VERSION, '5.3.0') == -1) {
$ret['php']['version']['class'] = 'danger';
$ret['php']['version']['failed'] = true;
$ret['php']['version']['remark'] = 'PHP版本必须为 5.3.0 以上. 详情';
}
$ret['php']['pdo']['ok'] = extension_loaded('pdo') && extension_loaded('pdo_mysql');
if($ret['php']['pdo']['ok']) {
$ret['php']['pdo']['value'] = '';
$ret['php']['pdo']['class'] = 'success';
} else {
$ret['php']['pdo']['failed'] = true;
$ret['php']['pdo']['value'] = '';
$ret['php']['pdo']['class'] = 'warning';
$ret['php']['pdo']['remark'] = '您的PHP环境不支持PDO, 请开启此扩展. 详情';
}
$ret['php']['fopen']['ok'] = @ini_get('allow_url_fopen') && function_exists('fsockopen');
if($ret['php']['fopen']['ok']) {
$ret['php']['fopen']['value'] = '';
} else {
$ret['php']['fopen']['value'] = '';
}
$ret['php']['curl']['ok'] = extension_loaded('curl') && function_exists('curl_init');
if($ret['php']['curl']['ok']) {
$ret['php']['curl']['value'] = '';
$ret['php']['curl']['class'] = 'success';
} else {
$ret['php']['curl']['value'] = '';
$ret['php']['curl']['class'] = 'danger';
$ret['php']['curl']['remark'] = '您的PHP环境不支持cURL, 也不支持 allow_url_fopen, 系统无法正常运行. 详情';
$ret['php']['curl']['failed'] = true;
}
$ret['php']['ssl']['ok'] = extension_loaded('openssl');
if($ret['php']['ssl']['ok']) {
$ret['php']['ssl']['value'] = '';
$ret['php']['ssl']['class'] = 'success';
} else {
$ret['php']['ssl']['value'] = '';
$ret['php']['ssl']['class'] = 'danger';
$ret['php']['ssl']['failed'] = true;
$ret['php']['ssl']['remark'] = '没有启用OpenSSL, 将无法访问公众平台的接口, 系统无法正常运行. 详情';
}
$ret['php']['gd']['ok'] = extension_loaded('gd');
if($ret['php']['gd']['ok']) {
$ret['php']['gd']['value'] = '';
$ret['php']['gd']['class'] = 'success';
} else {
$ret['php']['gd']['value'] = '';
$ret['php']['gd']['class'] = 'danger';
$ret['php']['gd']['failed'] = true;
$ret['php']['gd']['remark'] = '没有启用GD, 将无法正常上传和压缩图片, 系统无法正常运行. 详情';
}
$ret['php']['dom']['ok'] = class_exists('DOMDocument');
if($ret['php']['dom']['ok']) {
$ret['php']['dom']['value'] = '';
$ret['php']['dom']['class'] = 'success';
} else {
$ret['php']['dom']['value'] = '';
$ret['php']['dom']['class'] = 'danger';
$ret['php']['dom']['failed'] = true;
$ret['php']['dom']['remark'] = '没有启用DOMDocument, 将无法正常安装使用模块, 系统无法正常运行. 详情';
}
$ret['php']['session']['ok'] = ini_get('session.auto_start');
if($ret['php']['session']['ok'] == 0 || strtolower($ret['php']['session']['ok']) == 'off') {
$ret['php']['session']['value'] = '';
$ret['php']['session']['class'] = 'success';
} else {
$ret['php']['session']['value'] = '';
$ret['php']['session']['class'] = 'danger';
$ret['php']['session']['failed'] = true;
$ret['php']['session']['remark'] = '系统session.auto_start开启, 将无法正常注册会员, 系统无法正常运行. 详情';
}
$ret['php']['asp_tags']['ok'] = ini_get('asp_tags');
if(empty($ret['php']['asp_tags']['ok']) || strtolower($ret['php']['asp_tags']['ok']) == 'off') {
$ret['php']['asp_tags']['value'] = '';
$ret['php']['asp_tags']['class'] = 'success';
} else {
$ret['php']['asp_tags']['value'] = '';
$ret['php']['asp_tags']['class'] = 'danger';
$ret['php']['asp_tags']['failed'] = true;
$ret['php']['asp_tags']['remark'] = '请禁用可以使用ASP 风格的标志,配置php.ini中asp_tags = Off';
}
$ret['write']['root']['ok'] = local_writeable(IA_ROOT . '/');
if($ret['write']['root']['ok']) {
$ret['write']['root']['value'] = '';
$ret['write']['root']['class'] = 'success';
} else {
$ret['write']['root']['value'] = '';
$ret['write']['root']['class'] = 'danger';
$ret['write']['root']['failed'] = true;
$ret['write']['root']['remark'] = '本地目录无法写入, 将无法使用自动更新功能, 系统无法正常运行. 详情';
}
$ret['write']['data']['ok'] = local_writeable(IA_ROOT . '/data');
if($ret['write']['data']['ok']) {
$ret['write']['data']['value'] = '';
$ret['write']['data']['class'] = 'success';
} else {
$ret['write']['data']['value'] = '';
$ret['write']['data']['class'] = 'danger';
$ret['write']['data']['failed'] = true;
$ret['write']['data']['remark'] = 'data目录无法写入, 将无法写入配置文件, 系统无法正常安装. ';
}
$ret['continue'] = true;
foreach($ret['php'] as $opt) {
if($opt['failed']) {
$ret['continue'] = false;
break;
}
}
if($ret['write']['failed']) {
$ret['continue'] = false;
}
tpl_install_env($ret);
}
if($action == 'db') {
if($ispost) {
if($_POST['do'] != 'continue') {
setcookie('action', 'env');
header('location: ?refresh');
exit();
}
$family = $_POST['family'] == 'x' ? 'x' : 'v';
$db = $_POST['db'];
$user = $_POST['user'];
try {
$pieces = explode(':', $db['server']);
$db['server'] = $pieces[0];
$db['port'] = !empty($pieces[1]) ? $pieces[1] : '3306';
$link = new PDO("mysql:host={$db['server']};port={$db['port']}", $db['username'], $db['password']); // dns可以没有dbname
$link->exec("SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary");
$link->exec("SET sql_mode=''");
if ($link->errorCode() != '00000') {
$errorInfo = $link->errorInfo();
$error = $errorInfo[2];
} else {
$statement = $link->query("SHOW DATABASES LIKE '{$db['name']}';");
$fetch = $statement->fetch();
if (empty($fetch)){
if (substr($link->getAttribute(PDO::ATTR_SERVER_VERSION), 0, 3) > '4.1') {
$link->query("CREATE DATABASE IF NOT EXISTS `{$db['name']}` DEFAULT CHARACTER SET utf8");
} else {
$link->query("CREATE DATABASE IF NOT EXISTS `{$db['name']}`");
}
}
$statement = $link->query("SHOW DATABASES LIKE '{$db['name']}';");
$fetch = $statement->fetch();
if (empty($fetch)) {
$error .= "数据库不存在且创建数据库失败.
";
}
if ($link->errorCode() != '00000') {
$errorInfo = $link->errorInfo();
$error .= $errorInfo[2];
}
}
} catch (PDOException $e) {
$error = $e->getMessage();
if (strpos($error, 'Access denied for user') !== false) {
$error = '您的数据库访问用户名或是密码错误.
';
} else {
$error = iconv('gbk', 'utf8', $error);
}
}
if(empty($error)) {
$link->exec("USE {$db['name']}");
$statement = $link->query("SHOW TABLES LIKE '{$db['prefix']}%';");
if ($statement->fetch()) {
$error = '您的数据库不为空,请重新建立数据库或是清空该数据库或更改表前缀!';
}
}
if(empty($error)) {
$config = local_config();
$cookiepre = local_salt(4) . '_';
$authkey = local_salt(8);
$config = str_replace(array(
'{db-server}', '{db-username}', '{db-password}', '{db-port}', '{db-name}', '{db-tablepre}', '{cookiepre}', '{authkey}', '{attachdir}'
), array(
$db['server'], $db['username'], $db['password'], $db['port'], $db['name'], $db['prefix'], $cookiepre, $authkey, 'attachment'
), $config);
$verfile = IA_ROOT . '/framework/version.inc.php';
$dbfile = IA_ROOT . '/data/db.php';
if($_POST['type'] == 'remote') {
$link = NULL;
$ins = remote_install();
if(empty($ins)) {
die('');
}
if($ins == 'error') {
die('');
}
$link = new PDO("mysql:dbname={$db['name']};host={$db['server']};port={$db['port']}", $db['username'], $db['password']);
$link->exec("SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary");
$link->exec("SET sql_mode=''");
$tmpfile = IA_ROOT . '/we7source.tmp';
file_put_contents($tmpfile, $ins);
$zip = new ZipArchive;
$res = $zip->open($tmpfile);
if ($res === TRUE) {
$zip->extractTo(IA_ROOT);
$zip->close();
} else {
die('');
}
unlink($tmpfile);
}
if(file_exists(IA_ROOT . '/index.php') && is_dir(IA_ROOT . '/web') && file_exists($verfile) && file_exists($dbfile)) {
$dat = require $dbfile;
if(empty($dat) || !is_array($dat)) {
die('');
}
foreach($dat['schemas'] as $schema) {
$sql = local_create_sql($schema);
local_run($sql);
}
foreach($dat['datas'] as $data) {
local_run($data);
}
} else {
die('');
}
$salt = local_salt(8);
$password = sha1("{$user['password']}-{$salt}-{$authkey}");
$link->exec("INSERT INTO {$db['prefix']}users (username, password, salt, joindate, groupid) VALUES('{$user['username']}', '{$password}', '{$salt}', '" . time() . "', 1)");
$cookie = array('lastvisit' => '', 'lastip' => '');
$cookie['uid'] = $link->lastInsertId();
$cookie['hash'] = md5($password . $salt);
$session = install_authcode(json_encode($cookie), 'encode', $authkey);
setcookie("{$cookiepre}__session", $session);
local_mkdirs(IA_ROOT . '/data');
file_put_contents(IA_ROOT . '/data/config.php', $config);
touch(IA_ROOT . '/data/install.lock');
// setcookie('action', 'cloud');
setcookie('action', 'finish');
header('location: ?refresh');
exit();
}
}
tpl_install_db($error);
}
if ($action == 'cloud') {
if($ispost) {
setcookie('action', $_POST['do'] == 'continue' ? 'upgrade' : 'db');
header('location: ?refresh');
exit;
}
if (!file_exists(IA_ROOT . '/framework/bootstrap.inc.php')) {
setcookie('action', '');
header('location: ?refresh');
exit;
}
define('IN_SYS', true);
require IA_ROOT . '/framework/bootstrap.inc.php';
require IA_ROOT . '/web/common/bootstrap.sys.inc.php';
load()->model('cloud');
$iframe = cloud_auth_url('profile');
$title = '注册站点';
tpl_install_cloud($iframe . '&' . '__session=' . urlencode($_COOKIE['session']) . '&r=' . time());
}
if ($action == 'upgrade') {
setcookie('action', 'upgrade');
define('IN_SYS', true);
if (!file_exists(IA_ROOT . '/framework/bootstrap.inc.php')) {
setcookie('action', '');
header('location: ?refresh');
exit;
}
require IA_ROOT . '/framework/bootstrap.inc.php';
require IA_ROOT . '/web/common/bootstrap.sys.inc.php';
load()->model('cloud');
if (!empty($_GPC['path']) && $_W['ispost']) {
$ret = cloud_download($_GPC['path'], $_GPC['type']);
if (!is_error($ret)) {
exit('success');
}
exit($ret['message']);
}
if (!empty($_GPC['fname']) && $_W['ispost']) {
$fname = trim($_GPC['fname']);
$entry = IA_ROOT . '/data/update/' . $fname;
if (is_file($entry) && preg_match('/^update\(\d{12}\-\d{12}\)\.php$/', $fname)) {
$evalret = include $entry;
if (!empty($evalret)) {
cache_build_users_struct();
cache_build_setting();
@unlink($entry);
exit('success');
}
}
exit('failed');
}
$m = '';
$packet = cloud_build();
if (empty($packet)) {
$packet = array(
'files' => array(),
'task' => 1,
);
}
$schemas = $packet['schemas'];
$packet['schemas'] = array();
if (!empty($schemas)) {
foreach ($schemas as $schema) {
$packet['schemas'][] = substr($schema['tablename'], 4);
}
}
$scripts = array();
$updatefiles = array();
if (!empty($packet['scripts']) && empty($packet['type'])) {
$updatedir = IA_ROOT . '/data/update/';
load()->func('file');
rmdirs($updatedir, true);
mkdirs($updatedir);
$cversion = IMS_VERSION;
$crelease = IMS_RELEASE_DATE;
foreach ($packet['scripts'] as $script) {
if ($script['release'] <= $crelease) {
continue;
}
$fname = "update({$crelease}-{$script['release']}).php";
$crelease = $script['release'];
$script['script'] = @base64_decode($script['script']);
if (empty($script['script'])) {
$script['script'] = <<
load()->model('setting');
setting_upgrade_version('{$packet['family']}', '{$script['version']}', '{$script['release']}');
return true;
DAT;
}
$updatefile = $updatedir . $fname;
file_put_contents($updatefile, $script['script']);
$updatefiles[] = $updatefile;
$s = array_elements(array('message', 'release', 'version'), $script);
$s['fname'] = $fname;
$scripts[] = $s;
}
}
if (!empty($_POST['table']) && $_W['ispost']) {
$tablename = $_POST['table'];
foreach ($schemas as $schema) {
if (substr($schema['tablename'], 4) == $tablename) {
$remote = $schema;
break;
}
}
if (!empty($remote)) {
load()->func('db');
$local = db_table_schema(pdo(), $tablename);
$sqls = db_table_fix_sql($local, $remote);
$error = false;
foreach ($sqls as $sql) {
if (pdo_query($sql) === false) {
$error = true;
$errormsg .= pdo_debug(false);
break;
}
}
if (!$error) {
exit('success');
}
}
exit;
}
tpl_install_upgrade();
exit;
}
if($action == 'finish') {
setcookie('action', '', -10);
$dbfile = IA_ROOT . '/data/db.php';
@unlink($dbfile);
define('IN_SYS', true);
require IA_ROOT . '/framework/bootstrap.inc.php';
require IA_ROOT . '/web/common/bootstrap.sys.inc.php';
$_W['uid'] = $_W['isfounder'] = 1;
load()->web('common');
load()->web('template');
load()->model('setting');
load()->model('cache');
cache_build_frame_menu();
cache_build_setting();
cache_build_users_struct();
cache_build_module_subscribe_type();
tpl_install_finish();
}
function local_writeable($dir) {
$writeable = 0;
if(!is_dir($dir)) {
@mkdir($dir, 0777);
}
if(is_dir($dir)) {
if($fp = fopen("$dir/test.txt", 'w')) {
fclose($fp);
unlink("$dir/test.txt");
$writeable = 1;
} else {
$writeable = 0;
}
}
return $writeable;
}
function local_salt($length = 8) {
$result = '';
while(strlen($result) < $length) {
$result .= sha1(uniqid('', true));
}
return substr($result, 0, $length);
}
function local_config() {
$cfg = <<
defined('IN_IA') or exit('Access Denied');
\$config = array();
\$config['db']['master']['host'] = '{db-server}';
\$config['db']['master']['username'] = '{db-username}';
\$config['db']['master']['password'] = '{db-password}';
\$config['db']['master']['port'] = '{db-port}';
\$config['db']['master']['database'] = '{db-name}';
\$config['db']['master']['charset'] = 'utf8';
\$config['db']['master']['pconnect'] = 0;
\$config['db']['master']['tablepre'] = '{db-tablepre}';
\$config['db']['slave_status'] = false;
\$config['db']['slave']['1']['host'] = '';
\$config['db']['slave']['1']['username'] = '';
\$config['db']['slave']['1']['password'] = '';
\$config['db']['slave']['1']['port'] = '3307';
\$config['db']['slave']['1']['database'] = '';
\$config['db']['slave']['1']['charset'] = 'utf8';
\$config['db']['slave']['1']['pconnect'] = 0;
\$config['db']['slave']['1']['tablepre'] = 'ims_';
\$config['db']['slave']['1']['weight'] = 0;
\$config['db']['common']['slave_except_table'] = array('core_sessions');
// -------------------------- CONFIG COOKIE --------------------------- //
\$config['cookie']['pre'] = '{cookiepre}';
\$config['cookie']['domain'] = '';
\$config['cookie']['path'] = '/';
// -------------------------- CONFIG SETTING --------------------------- //
\$config['setting']['charset'] = 'utf-8';
\$config['setting']['cache'] = 'mysql';
\$config['setting']['timezone'] = 'Asia/Shanghai';
\$config['setting']['memory_limit'] = '256M';
\$config['setting']['filemode'] = 0644;
\$config['setting']['authkey'] = '{authkey}';
\$config['setting']['founder'] = '1';
\$config['setting']['development'] = 0;
\$config['setting']['referrer'] = 0;
// -------------------------- CONFIG UPLOAD --------------------------- //
\$config['upload']['image']['extentions'] = array('gif', 'jpg', 'jpeg', 'png');
\$config['upload']['image']['limit'] = 5000;
\$config['upload']['attachdir'] = '{attachdir}';
\$config['upload']['audio']['extentions'] = array('mp3');
\$config['upload']['audio']['limit'] = 5000;
// -------------------------- CONFIG MEMCACHE --------------------------- //
\$config['setting']['memcache']['server'] = '';
\$config['setting']['memcache']['port'] = 11211;
\$config['setting']['memcache']['pconnect'] = 1;
\$config['setting']['memcache']['timeout'] = 30;
\$config['setting']['memcache']['session'] = 1;
// -------------------------- CONFIG PROXY --------------------------- //
\$config['setting']['proxy']['host'] = '';
\$config['setting']['proxy']['auth'] = '';
EOF;
return trim($cfg);
}
function local_mkdirs($path) {
if(!is_dir($path)) {
local_mkdirs(dirname($path));
mkdir($path);
}
return is_dir($path);
}
function local_run($sql) {
global $link, $db;
if(!isset($sql) || empty($sql)) return;
$sql = str_replace("\r", "\n", str_replace(' ims_', ' '.$db['prefix'], $sql));
$sql = str_replace("\r", "\n", str_replace(' `ims_', ' `'.$db['prefix'], $sql));
$ret = array();
$num = 0;
foreach(explode(";\n", trim($sql)) as $query) {
$ret[$num] = '';
$queries = explode("\n", trim($query));
foreach($queries as $query) {
$ret[$num] .= (isset($query[0]) && $query[0] == '#') || (isset($query[1]) && isset($query[1]) && $query[0].$query[1] == '--') ? '' : $query;
}
$num++;
}
unset($sql);
foreach($ret as $query) {
$query = trim($query);
if($query) {
$link->exec($query);
if($link->errorCode() != '00000') {
$errorInfo = $link->errorInfo();
echo $errorInfo[0] . ": " . $errorInfo[2] . "
";
exit($query);
}
}
}
}
function local_create_sql($schema) {
$pieces = explode('_', $schema['charset']);
$charset = $pieces[0];
$engine = $schema['engine'];
$sql = "CREATE TABLE IF NOT EXISTS `{$schema['tablename']}` (\n";
foreach ($schema['fields'] as $value) {
if(!empty($value['length'])) {
$length = "({$value['length']})";
} else {
$length = '';
}
$signed = empty($value['signed']) ? ' unsigned' : '';
if(empty($value['null'])) {
$null = ' NOT NULL';
} else {
$null = '';
}
if(isset($value['default'])) {
$default = " DEFAULT '" . $value['default'] . "'";
} else {
$default = '';
}
if($value['increment']) {
$increment = ' AUTO_INCREMENT';
} else {
$increment = '';
}
$sql .= "`{$value['name']}` {$value['type']}{$length}{$signed}{$null}{$default}{$increment},\n";
}
foreach ($schema['indexes'] as $value) {
$fields = implode('`,`', $value['fields']);
if($value['type'] == 'index') {
$sql .= "KEY `{$value['name']}` (`{$fields}`),\n";
}
if($value['type'] == 'unique') {
$sql .= "UNIQUE KEY `{$value['name']}` (`{$fields}`),\n";
}
if($value['type'] == 'primary') {
$sql .= "PRIMARY KEY (`{$fields}`),\n";
}
}
$sql = rtrim($sql);
$sql = rtrim($sql, ',');
$sql .= "\n) ENGINE=$engine DEFAULT CHARSET=$charset;\n\n";
return $sql;
}
function remote_install() {
global $family;
$token = '';
$pars = array();
$pars['host'] = $_SERVER['HTTP_HOST'];
$pars['version'] = '1.0';
$pars['type'] = 'install';
$pars['method'] = 'application.install';
$url = 'http://v2.addons.we7.cc/gateway.php';
$urlset = parse_url($url);
$cloudip = gethostbyname($urlset['host']);
$headers[] = "Host: {$urlset['host']}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $urlset['scheme'] . '://' . $cloudip . $urlset['path']);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($pars, '', '&'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$content = curl_exec($ch);
curl_close($ch);
if (empty($content)) {
return showerror(-1, '获取安装信息失败,可能是由于网络不稳定,请重试。');
}
return $content;
}
function tpl_frame() {
global $action, $actions;
$action = $_COOKIE['action'];
$step = array_search($action, $actions);
$steps = array();
for($i = 0; $i <= $step; $i++) {
if($i == $step) {
$steps[$i] = ' list-group-item-info';
} else {
$steps[$i] = ' list-group-item-success';
}
}
$progress = $step * 25 + 25;
$content = ob_get_contents();
ob_clean();
$tpl = <<
安装系统 - 微擎 - 公众平台自助开源引擎html,body{font-size:13px;font-family:"Microsoft YaHei UI", "微软雅黑", "宋体";}
.pager li.previous a{margin-right:10px;}
.header a{color:#FFF;}
.header a:hover{color:#428bca;}
.footer{padding:10px;}
.footer a,.footer{color:#eee;font-size:14px;line-height:25px;}
EOF;
echo trim($tpl);
}
function tpl_install_license() {
echo <<
版权所有 (c)2014,微擎团队保留所有权利。
感谢您选择微擎 - 微信公众平台自助开源引擎(以下简称WE7,WE7基于 PHP + MySQL的技术开发,全部源码开放。
为了使你正确并合法的使用本软件,请你在使用前务必阅读清楚下面的协议条款:
一、本授权协议适用且仅适用于微擎系统(We7, MicroEngine. 以下简称微擎)任何版本,微擎官方对本授权协议的最终解释权。
二、协议许可的权利
- 您可以在完全遵守本最终用户授权协议的基础上,将本软件应用于非商业用途,而不必支付软件版权授权费用。
- 您可以在协议规定的约束和限制范围内修改微擎源代码或界面风格以适应您的网站要求。
- 您拥有使用本软件构建的网站全部内容所有权,并独立承担与这些内容的相关法律义务。
- 获得商业授权之后,您可以将本软件应用于商业用途,同时依据所购买的授权类型中确定的技术支持内容,自购买时刻起,在技术支持期限内拥有通过指定的方式获得指定范围内的技术支持服务。商业授权用户享有反映和提出意见的权力,相关意见将被作为首要考虑,但没有一定被采纳的承诺或保证。
三、协议规定的约束和限制
- 未获商业授权之前,不得将本软件用于商业用途(包括但不限于企业网站、经营性网站、以营利为目的或实现盈利的网站)。
- 未经官方许可,不得对本软件或与之关联的商业授权进行出租、出售、抵押或发放子许可证。
- 未经官方许可,禁止在微擎的整体或任何部分基础上以发展任何派生版本、修改版本或第三方版本用于重新分发。
- 如果您未能遵守本协议的条款,您的授权将被终止,所被许可的权利将被收回,并承担相应法律责任。
四、有限担保和免责声明
- 本软件及所附带的文件是作为不提供任何明确的或隐含的赔偿或担保的形式提供的。
- 用户出于自愿而使用本软件,您必须了解使用本软件的风险,在尚未购买产品技术服务之前,我们不承诺对免费用户提供任何形式的技术支持、使用担保,也不承担任何因使用本软件而产生问题的相关责任。
- 电子文本形式的授权协议如同双方书面签署的协议一样,具有完全的和等同的法律效力。您一旦开始确认本协议并安装 WE7,即被视为完全理解并接受本协议的各项条款,在享有上述条款授予的权力的同时,受到相关的约束和限制。协议许可范围以外的行为,将直接违反本授权协议并构成侵权,我们有权随时终止授权,责令停止损害,并保留追究相关责任的权力。
- 如果本软件带有其它软件的整合API示范例子包,这些文件版权不属于本软件官方,并且这些文件是没经过授权发布的,请参考相关软件的使用许可合法的使用。
-
我已经阅读并同意此协议
- 继续
EOF;
tpl_frame();
}
function tpl_install_env($ret = array()) {
if(empty($ret['continue'])) {
$continue = '
请先解决环境问题后继续';} else {
$continue = '
继续 ';}
echo <<
参数 | 值 | |
---|---|---|
服务器操作系统 | {$ret['server']['os']['value']} | {$ret['server']['os']['remark']} |
Web服务器环境 | {$ret['server']['sapi']['value']} | {$ret['server']['sapi']['remark']} |
PHP版本 | {$ret['server']['php']['value']} | {$ret['server']['php']['remark']} |
程序安装目录 | {$ret['server']['dir']['value']} | {$ret['server']['dir']['remark']} |
磁盘空间 | {$ret['server']['disk']['value']} | {$ret['server']['disk']['remark']} |
上传限制 | {$ret['server']['upload']['value']} | {$ret['server']['upload']['remark']} |
选项 | 要求 | 状态 | 说明及帮助 |
---|---|---|---|
PHP版本 | 5.3或者5.3以上 | {$ret['php']['version']['value']} | {$ret['php']['version']['remark']} |
cURL | 支持 | {$ret['php']['curl']['value']} | {$ret['php']['curl']['remark']} |
PDO | 支持 | {$ret['php']['pdo']['value']} | {$ret['php']['pdo']['remark']} |
openSSL | 支持 | {$ret['php']['ssl']['value']} | {$ret['php']['ssl']['remark']} |
GD2 | 支持 | {$ret['php']['gd']['value']} | {$ret['php']['gd']['remark']} |
DOM | 支持 | {$ret['php']['dom']['value']} | {$ret['php']['dom']['remark']} |
session.auto_start | 关闭 | {$ret['php']['session']['value']} | {$ret['php']['session']['remark']} |
asp_tags | 关闭 | {$ret['php']['asp_tags']['value']} | {$ret['php']['asp_tags']['remark']} |
目录 | 要求 | 状态 | 说明及帮助 |
---|---|---|---|
/ | 整目录可写 | {$ret['write']['root']['value']} | {$ret['write']['root']['remark']} |
/ | data目录可写 | {$ret['write']['data']['value']} | {$ret['write']['data']['remark']} |
- 返回
{$continue}
EOF;
tpl_frame();
}
function tpl_install_db($error = '') {
if(!empty($error)) {
$message = '
}
$insTypes = array();
if(file_exists(IA_ROOT . '/index.php') && is_dir(IA_ROOT . '/app') && is_dir(IA_ROOT . '/web')) {
$insTypes['local'] = ' checked="checked"';
} else {
$insTypes['remote'] = ' checked="checked"';
}
if (!empty($_POST['type'])) {
$insTypes = array();
$insTypes[$_POST['type']] = ' checked="checked"';
}
$disabled = empty($insTypes['local']) ? ' disabled="disabled"' : '';
echo <<
{$message}
安装方式
在线安装
离线安装
数据库主机
数据库用户
数据库密码
表前缀
数据库名称
管理员账号
管理员密码
确认密码
- 返回
- 继续
var lock = false;
function check(obj) {
if(lock) {
return;
}
$('.form-control').parent().parent().removeClass('has-error');
var error = false;
$('.form-control').each(function(){
if($(this).val() == '') {
$(this).parent().parent().addClass('has-error');
this.focus();
error = true;
}
});
if(error) {
alert('请检查未填项');
return false;
}
if($(':password').eq(0).val() != $(':password').eq(1).val()) {
$(':password').parent().parent().addClass('has-error');
alert('确认密码不正确.');
return false;
}
lock = true;
$(obj).parent().addClass('disabled');
$(obj).html('正在执行安装');
return true;
}
EOF;
tpl_frame();
}
function tpl_install_cloud($iframe) {
echo <<
- 继续
EOF;
tpl_frame();
}
function tpl_install_upgrade($iframe) {
global $packet, $scripts;
echo <<
window.sysinfo = {
'siteroot': '{$_W['siteroot']}',
'siteurl': '{$_W['siteurl']}',
'cookie' : {'pre': '{$_W['config']['cookie']['pre']}'},
'server' : {'php' : ''},
};
EOF;
?>
if (empty($_GET['type']) || $_GET['type'] == 'files') {
echo <<
正在更新系统文件, 请不要关闭窗口.
如果下载文件失败,可能造成的原因:写入失败,请仔细检查写入权限是否正确。
-
整体进度
- {{pragress}} 正在下载文件
- {{file}}
-
下载失败的文件
-
{{file}}
angular.module('cloudApp').value('config', {
files : packet['files'],
type : '{$type}',
account_type : "{$_GPC['account_type']}",
tasknum : '{$packet['task']}',
});
angular.bootstrap($('.js-processor'), ['cloudApp']);
EOF;
} elseif ($_GET['type'] == 'schemas') {
echo <<
正在更新数据库, 请不要关闭窗口.
-
整体进度
- {{pragress}} 正在处理数据表
- {{schema}}
-
处理失败的数据表
-
{{schema}}
angular.module('cloudApp').value('config', {
schemas : packet['schemas'],
});
angular.bootstrap($('.js-processor'), ['cloudApp']);
EOF;
} elseif ($_GET['type'] == 'scripts') {
echo <<
正在数据迁移及清理操作, 请不要关闭窗口.
-
整体进度
- {{pragress}} 正在处理
-
{{script}}
{{message}}
-
处理失败的操作
-
{{script}}
angular.bootstrap($('.js-processor'), ['cloudApp']);
EOF;
}
tpl_frame();
}
function tpl_install_finish() {
$modules = get_store_module();
$themes = get_store_theme();
echo <<
安装完成
恭喜您!已成功安装“微擎 - 公众平台自助开源引擎”系统,您现在可以: 访问网站首页
EOF;
tpl_frame();
}
function tpl_resources() {
static $res = array(
'logo' => 'iVBORw0KGgoAAAANSUhEUgAAAaQAAABfCAYAAACnbrNbAAAACXBIWXMAAC4jAAAuIwF4pT92AAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJk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wbwJfBzNs9hng5D/dZg3gbwVq2F7u2h9sFu9iqr+pCfW1GMuvFpAwQe1F2yxQXm2DmXx7JYV8eH/O89BhWEhAE+SjNB9gdZm3R/Vzube5LF8KEcttWbx8cnFg1XU+7+H3dArM85CIWhCmhvovLaYwqF4HUN0N3R0+P1iq5O/KFQSXNcYIVtQLRXGXFMBN7r8Dsb3Iu3Fkn4lIem/1VEz7fkOF15rFQupaPthEttM9hAh9eh3FRZsuDMJGQv+EOWTPBupoUsF5cATOzcPCcTByaC3W4HnKqfptvAFzKdXsrC6ioyY4XWEqbNM9rR8V1EMp8Yv3dEe4I2QVIxi3dEG6X4EZEy6+4g/vySG475yTclzMRuoWWst7QIZC28dhwPYzL/RZWQv5gKbKzYdJv2QKpBPJmpU1hNvY7isfm8QjPmF/h8HWAAm70+yyJS5AX8NV1lE+hbKSPzdGB8unnsVPLFwll3o4hOL5ga6sHzGrjZjC+2MoojcyhiNfLZ61tao7fTx5MtOEyS5PN404cJw/bHpi9d55lheA81p7rsZZdzJ1pGYAPWZmYl4PfNQtmgrcpa49n8Puow9ph5QzfR1pDnBBoXysCbphKiJcfTxJIy/m9kNVnXkN0dypgFnimM0CfATNZ3YQHnsqOPloJxlVsZ8UOto/1gfbRMlAmxX/bymU9ob4+zPD3SDRjQU1WfVVCaWbsqHzORyuYebFT2EopQtmIWcqgj21CZvOKM1Aa+fsVj0cbA4rcL2DmiM5mhXhK4HdeB3l+0EUvmGCtFLfhwTgMSRERFEVRFOVQk6dVoCiKoqhAUhRFURQVSIqiKIoKJEVRFEVRgaQoiqKoQFIURVEUFUiKoiiKCiRFURRFUYGkKIqiqEBSFEVRFBVIiqIoigokRVEURVGBpCiKoqhAUhRFURQVSIqiKIoKJEVRFEVRgaQoiqIcDvzfAOi6dmYBSbinAAAAAElFTkSuQmCC',
);
return $res;
}
function showerror($errno, $message = '') {
return array(
'errno' => $errno,
'error' => $message,
);
}
function get_store_module() {
load()->func('communication');
$response = ihttp_request(APP_STORE_API, array('controller' => 'store', 'action' => 'api', 'do' => 'module'));
$response = json_decode($response['content'], true);
$modules = '';
foreach ($response['message'] as $key => $module) {
if ($key % 3 < 1) {
$modules .= '
';}
$module['detail_link'] = APP_STORE_URL . trim($module['detail_link'], '.');
$modules .= '
';$modules .= '
';$modules .= '
$modules .= '
';$modules .= '
安装量:' . $module['purchases'] . '
';$modules .= '
$modules .= '
';}
$modules = substr($modules, 5) . '
';return $modules;
}
function get_store_theme() {
load()->func('communication');
$response = ihttp_request(APP_STORE_API, array('controller' => 'store', 'action' => 'api', 'do' => 'theme'));
$response = json_decode($response['content'], true);
$themes = '
';$themes .= '
foreach ($response['message'] as $key => $theme) {
$theme['detail_link'] = APP_STORE_URL . trim($theme['detail_link'], '.');
$themes .= '
';}
$themes .= '
return $themes;
}
function install_authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
$ckey_length = 4;
$key = md5($key != '' ? $key : $GLOBALS['_W']['config']['setting']['authkey']);
$keya = md5(substr($key, 0, 16));
$keyb = md5(substr($key, 16, 16));
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length) : substr(md5(microtime()), -$ckey_length)) : '';
$cryptkey = $keya . md5($keya . $keyc);
$key_length = strlen($cryptkey);
$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $keyb), 0, 16) . $string;
$string_length = strlen($string);
$result = '';
$box = range(0, 255);
$rndkey = array();
for ($i = 0; $i <= 255; $i++) {
$rndkey[$i] = ord($cryptkey[$i % $key_length]);
}
for ($j = $i = 0; $i < 256; $i++) {
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
$tmp = $box[$i];
$box[$i] = $box[$j];
$box[$j] = $tmp;
}
for ($a = $j = $i = 0; $i < $string_length; $i++) {
$a = ($a + 1) % 256;
$j = ($j + $box[$a]) % 256;
$tmp = $box[$a];
$box[$a] = $box[$j];
$box[$j] = $tmp;
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
}
if ($operation == 'DECODE') {
if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16)) {
return substr($result, 26);
} else {
return '';
}
} else {
return $keyc . str_replace('=', '', base64_encode($result));
}
}
一键复制
编辑
Web IDE
原始数据
按行查看
历史