fix setup

This commit is contained in:
printempw 2016-09-25 09:35:10 +08:00
parent 5861b6f03b
commit 6f7e6534ba
6 changed files with 32 additions and 19 deletions

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-07-29 11:53:11
* @Last Modified by: printempw
* @Last Modified time: 2016-08-28 21:40:27
* @Last Modified time: 2016-09-25 09:32:25
*/
return [
@ -15,7 +15,7 @@ return [
'api_type' => '0',
'announcement' => '欢迎使用 Blessing Skin Server {version}',
'color_scheme' => 'skin-blue',
'home_pic_url' => './assets/images/bg.jpg',
'home_pic_url' => './resources/assets/images/bg.jpg',
'custom_css' => '',
'custom_js' => '',
'allow_chinese_playername' => '1',

View File

@ -5,8 +5,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<title>Blessing Skin Server 安装程序</title>
<link rel="shortcut icon" href="../assets/images/favicon.ico">
<link rel="stylesheet" type="text/css" href="../assets/css/install.css">
<link rel="shortcut icon" href="../resources/assets/images/favicon.ico">
<link rel="stylesheet" type="text/css" href="../resources/assets/dist/css/install.css">
</head>
<body class="container">

View File

@ -5,8 +5,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<title>Blessing Skin Server 数据迁移</title>
<link rel="shortcut icon" href="../../assets/images/favicon.ico">
<link rel="stylesheet" type="text/css" href="../../assets/css/install.css">
<link rel="shortcut icon" href="../../resources/assets/images/favicon.ico">
<link rel="stylesheet" type="text/css" href="../../resources/assets/dist/css/install.css">
<style>
.container a.button {

View File

@ -5,8 +5,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<title>Blessing Skin Server 升级程序</title>
<link rel="shortcut icon" href="../assets/images/favicon.ico">
<link rel="stylesheet" type="text/css" href="../assets/css/install.css">
<link rel="shortcut icon" href="../resources/assets/images/favicon.ico">
<link rel="stylesheet" type="text/css" href="../resources/assets/dist/css/install.css">
</head>
<body class="container">

View File

@ -10,7 +10,16 @@ define('BASE_DIR', dirname(dirname(__DIR__)));
ini_set('display_errors', 'on');
// Register Composer Auto Loader
require BASE_DIR.'/vendor/autoload.php';
if (file_exists(BASE_DIR.'/vendor')) {
require BASE_DIR.'/vendor/autoload.php';
} else {
exit('错误:/vendor 文件夹不存在');
}
// Check integrity of vendor
if (!class_exists('Illuminate\Foundation\Application')) {
exit('错误:/vendor 文件夹不完整,请仔细阅读安装教程并下载完整的 vendor 包');
}
// Load dotenv Configuration
if (file_exists(BASE_DIR."/.env")) {
@ -20,6 +29,10 @@ if (file_exists(BASE_DIR."/.env")) {
exit('错误:.env 配置文件不存在');
}
if (!isset($_ENV['APP_KEY'])) {
exit('错误:.env 已过期,请重新复制一份 .env.example 并修改配置');
}
// Register Error Hanlders
$whoops = new \Whoops\Run;
$handler = new \Whoops\Handler\PrettyPageHandler;
@ -55,12 +68,9 @@ $request = (new Illuminate\Http\Request)->duplicate(
$request->cookies->all(), $request->files->all(), array_replace($request->server->all(), ['REQUEST_URI' => ''])
);
// Enable URL generator
$app->bind('url', function ($app) {
$routes = $app['router']->getRoutes();
// The URL generator needs the route collection that exists on the router.
// Keep in mind this is an object, so we're passing by references here
// and all the registered routes will be available to the generator.
$app->instance('routes', $routes);
$url = new Illuminate\Routing\UrlGenerator(
@ -78,7 +88,6 @@ $app->singleton('option', App\Services\OptionRepository::class);
require BASE_DIR.'/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php';
require __DIR__."/helpers.php";
View::addExtension('tpl', 'blade');
$db_config = get_db_config();
@ -97,5 +106,9 @@ session_start();
// start laravel session
$encrypter = $app->make('Illuminate\Contracts\Encryption\Encrypter');
$session = $app->make('session')->driver();
$session->setId($encrypter->decrypt($_COOKIE['bs_session']));
if (isset($_COOKIE['bs_session'])) {
$session->setId($encrypter->decrypt($_COOKIE['bs_session']));
}
$session->start();

View File

@ -53,12 +53,12 @@ switch ($step) {
}
// create tables
require BASE_DIR."/includes/setup/tables.php";
require BASE_DIR."/setup/includes/tables.php";
// import options
$options = require BASE_DIR."/config/options.php";
$options['site_name'] = $_POST['sitename'];
$options['site_url'] = Http::getBaseUrl();
$options['site_url'] = url('/');
$options['version'] = config('app.version');
$options['announcement'] = str_replace('{version}', $options['version'], $options['announcement']);
@ -68,12 +68,12 @@ switch ($step) {
// register super admin
$user = new App\Models\User(null, ['email' => $_POST['email']]);
$user->register($_POST['password'], Http::getRealIP());
$user->register($_POST['password'], get_real_ip());
$user->setPermission('2');
if (!is_dir(BASE_DIR.'/storage/textures/')) {
if (!mkdir(BASE_DIR.'/storage/textures/'))
throw new App\Exceptions\PrettyPageException('textures 文件夹创建失败,请确认目录权限是否正确,或者手动放置一个。', -1);
throw new App\Exceptions\PrettyPageException('/storage/textures 文件夹创建失败,请检查目录权限是否正确,或者手动放置一个。', -1);
}
echo View::make('setup.steps.3')->with('email', $_POST['email'])->with('password', $_POST['password']);