🎉 install laravel framework.

This commit is contained in:
WispX 2021-12-10 09:11:15 +08:00
parent 82988ebe2e
commit 9800d5df07
5898 changed files with 10839 additions and 909744 deletions

View File

@ -8,8 +8,11 @@ indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.{html, less, js}]
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_size = 4

View File

@ -1,18 +1,52 @@
[app]
debug = false
trace = false
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
[database]
hostname = '{hostname}'
database = '{database}'
username = '{username}'
password = '{password}'
hostport = '{hostport}'
charset = utf8mb4
prefix = lsky_
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
[system]
single_user_mode = false
intercept_salacity = false
url_query = ''
watermark = false
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=lsky
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

5
.gitattributes vendored Normal file
View File

@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore

48
.gitignore vendored
View File

@ -1,35 +1,15 @@
# General
.DS_Store
.AppleDouble
.LSOverride
.idea
.vscode
*.iml
runtime/.tmp
/public/20*
/application/install.lock
backups
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
.env.backup
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.idea
/.vscode

14
.styleci.yml Normal file
View File

@ -0,0 +1,14 @@
php:
preset: laravel
version: 8
disabled:
- no_unused_imports
finder:
not-name:
- index.php
- server.php
js:
finder:
not-name:
- webpack.mix.js
css: true

View File

@ -1,10 +1,10 @@
<img align="right" width="100" src="./public/static/app/images/icon.png" alt="Lsky Pro Logo"/>
<img align="right" width="100" src="https://raw.githubusercontent.com/wisp-x/lsky-pro/82988ebe2edd32264d609b26bf9132b3dce7c39e/public/static/app/images/icon.png" alt="Lsky Pro Logo"/>
<h1 align="left"><a href="https://www.lsky.pro">Lsky Pro</a></h1>
☁ Your photo album on the cloud.
[![PHP](https://img.shields.io/badge/PHP->=5.6-orange.svg)](http://php.net)
[![PHP](https://img.shields.io/badge/PHP->=8.0-orange.svg)](http://php.net)
[![Release](https://img.shields.io/github/v/release/wisp-x/lsky-pro)](https://github.com/wisp-x/lsky-pro/releases)
[![Issues](https://img.shields.io/github/issues/wisp-x/lsky-pro)](https://github.com/wisp-x/lsky-pro/issues)
[![Code size](https://img.shields.io/github/languages/code-size/wisp-x/lsky-pro?color=blueviolet)](https://github.com/wisp-x/lsky-pro)
@ -14,64 +14,10 @@
[文档](https://www.kancloud.cn/wispx/lsky-pro) &nbsp;
[演示](https://pic.iqy.ink) &nbsp;
[Chrome 拓展](https://github.com/wisp-x/lsky-pro-chrome-extension) &nbsp;
[Telegram 群组](https://t.me/lsky_pro)
> 下载稳定版请点击[这里](https://github.com/wisp-x/lsky-pro/releases),发现 bug 可发送邮件至邮箱i@wispx.cn或提交 [issues](https://github.com/wisp-x/lsky-pro/issues)
![homepage.png](./public/static/app/images/demo/1.png)
![homepage.png](./public/static/app/images/demo/2.png)
### 📌 TODO
* [x] 支持第三方云储存,本地、阿里云 OSS、腾讯云 COS、七牛云、又拍云、FTP
* [x] 多图上传、拖拽上传、粘贴上传、上传预览、全屏预览、页面响应式布局
* [x] 简洁的图片管理功能,支持鼠标右键、单选多选、重命名等操作
* [x] 全局配置用户初始剩余储存空间、设置指定用户剩余储存空间
* [x] 一键复制图片外链、二维码扫描链接、图片鉴黄功能
* [x] 设置上传文件、文件夹路径命名规则、文件夹分类功能
* [x] 接口上传、图片软删除
* [x] OTA 在线升级系统
* [x] (Dark)暗黑主题
* [x] IP 封禁功能(支持通配符)
* [x] 自定义链接参数
* [x] 单用户模式
* [x] 图片广场(画廊)
* [x] 上传图片自动增加水印(支持图片或文字)
### 🛠 安装要求
* PHP 版本 &ge; 5.6
* mysql 版本 &ge; 5.5
* PDO 拓展
* ZipArchive 支持
* fileinfo 拓展
* curl 拓展
注:如果使用 FTP 功能,需要开启 PHP 的 FTP 拓展
### 🔍 安装教程
1. 下载兰空,上传至 web 运行环境,解压。
2. 设置运行目录为 public。
3. 配置 Rewrite 规则:
##### Nginx
```
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
```
##### Apache:
Apache 直接使用 .htaccess 即可
4. 访问首页,未安装自动跳转至安装页面,根据页面提示安装即可。
5. 安装完成以后请设置 runtime 目录 0755 权限如果你使用本地存储public 目录也需要设置为 0755 权限
### ☁️ 一键部署
兰空图床支持一键部署至 [腾讯云云开发](https://docs.cloudbase.net/) 详细配置可参考[文档](https://github.com/Handsomedoggy/lsky-pro/blob/master/cloudbase/tcb_doc.md)
[![](https://main.qcloudimg.com/raw/67f5a389f1ac6f3b4d04c7256438e44f.svg)](https://console.cloud.tencent.com/tcb/env/index?action=CreateAndDeployCloudBaseProject&appUrl=https%3A%2F%2Fgithub.com%2FHandsomedoggy%2Flsky-pro&branch=master)
> ⚠️ 当前分支为 2.0 版本开发分支,[查看 2.0 版本详细说明](https://github.com/wisp-x/lsky-pro/issues/281)
> 历史版本请点击[这里](https://github.com/wisp-x/lsky-pro/releases) ,发现 bug 可发送邮件至邮箱i@wispx.cn或提交 [issues](https://github.com/wisp-x/lsky-pro/issues)
### 📧 联系我
- Email: i@wispx.cn
@ -84,19 +30,11 @@ Lsky Pro 的开发和更新等,都是作者在空余时间独立开发,并
<th>微信</th>
</tr>
<tr>
<td><img src="./public/static/app/images/demo/alipay.png?t=201911251121"></td>
<td><img src="./public/static/app/images/demo/wechat.jpeg?t=201911251121"></td>
<td><img src="https://raw.githubusercontent.com/wisp-x/lsky-pro/82988ebe2edd32264d609b26bf9132b3dce7c39e/public/static/app/images/demo/alipay.png"></td>
<td><img src="https://raw.githubusercontent.com/wisp-x/lsky-pro/82988ebe2edd32264d609b26bf9132b3dce7c39e/public/static/app/images/demo/wechat.jpeg"></td>
</tr>
</table>
### 😋 鸣谢
- ThinkPHP
- Jquery
- BootStrap
- Mdui
- viewer.js
- context.js
### 📃 开源许可
[GPL 3.0](https://opensource.org/licenses/GPL-3.0)

32
app/Console/Kernel.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<Throwable>>
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}

67
app/Http/Kernel.php Normal file
View File

@ -0,0 +1,67 @@
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array<int, class-string|string>
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>>
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array<string, class-string|string>
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array<int, string>
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array<int, string>
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @param string|null ...$guards
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array<int, string>
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
];
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array<int, string|null>
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array<int, string>|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array<int, string>
*/
protected $except = [
//
];
}

44
app/Models/User.php Normal file
View File

@ -0,0 +1,44 @@
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
//
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* This is used by Laravel authentication to redirect users after login.
*
* @var string
*/
public const HOME = '/home';
/**
* The controller namespace for the application.
*
* When present, controller route declarations will automatically be prefixed with this namespace.
*
* @var string|null
*/
// protected $namespace = 'App\\Http\\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}
}

View File

@ -1 +0,0 @@
deny from all

View File

@ -1,11 +0,0 @@
<?php
namespace app\api\controller;
use app\common\traits\Core;
use think\Controller;
class Base extends Controller
{
use Core;
}

View File

@ -1,70 +0,0 @@
<?php
/**
* Created by WispX.
* User: WispX <1591788658@qq.com>
* Date: 2019/10/31
* Time: 11:10 上午
* Link: https://github.com/wisp-x
*/
namespace app\api\controller;
use app\common\model\Images;
use app\index\controller\User;
class Image extends Base
{
private $model;
public function initialize()
{
parent::initialize();
$user = request()->user;
$this->model = new Images();
$this->model = $this->model->where('user_id', $user->id)->field(['user_id', 'folder_id'], true);
}
public function find()
{
$id = $this->request->post('id');
if (!$image = $this->model->where('id', $id)->find()) {
$this->response(lang('The picture data was not found'), [], 500);
}
$this->response('success', $this->parseData($image));
}
public function items()
{
$page = $this->request->request('page', 1);
$rows = $this->request->request('rows', 20);
$images = $this->model->paginate(null, false, [
'page' => $page,
'list_rows' => $rows,
])->each(function ($item) {
$item = $this->parseData($item);
unset($item['create_time']);
return $item;
});
$this->response('success', $images);
}
public function delete()
{
$user = new User();
$data = str_replace('', ',', $this->request->request('id'));
if (strpos($data, ',') !== false) {
$data = explode(',', $data);
}
if ($user->deleteImages($data)) {
$this->response(lang('Delete succeeded!'));
}
$this->response(lang('Deletion failed!'), [], 500);
}
private function parseData($data)
{
$data['upload_time'] = $data->getData('create_time');
$data['upload_date'] = $data->create_time;
return $data;
}
}

View File

@ -1,37 +0,0 @@
<?php
namespace app\api\controller;
use app\common\model\Users;
use think\Exception;
class Token extends Base
{
/**
* @param null $email 邮箱
* @param null $password 密码
* @param bool $refresh 是否刷新token
*/
public function index($email = null, $password = null, $refresh = false)
{
$user = null;
try {
if (!$user = Users::get(['email' => $email])) {
throw new Exception(lang('Account does not exist'));
}
if ($user->password != md5($password)) {
throw new Exception(lang('Account password error'));
}
if ('true' == $refresh) {
$token = make_token();
$user->token = $token;
if (!$user->save()) {
throw new Exception(lang('Token refresh failed'));
}
}
} catch (Exception $e) {
$this->response($e->getMessage(), null, 500);
}
$this->response('success', ['token' => $user->token]);
}
}

View File

@ -1,51 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018-12-05
* Time: 16:33
* Link: https://github.com/wisp-x
*/
namespace app\api\controller;
use think\Db;
use think\Exception;
use think\exception\ErrorException;
class Upload extends Base
{
public function initialize()
{
parent::initialize();
// 是否允许游客上传
if (!$this->getConfig('allowed_tourist_upload') && !request()->user) {
$this->response(lang('The administrator closed the tourist upload channel'));
}
}
/**
* 上传
*/
public function index()
{
$data = null;
Db::startTrans();
try {
$data = (new \app\common\controller\Upload)->exec();
Db::commit();
} catch (Exception $e) {
Db::rollback();
$this->response($e->getMessage(), [], 500);
} catch (ErrorException $e) {
Db::rollback();
$this->response($e->getMessage(), [], 500);
} catch (\Throwable $e) {
Db::rollback();
$this->response($e->getMessage(), [], 500);
}
$this->response('success', $data);
}
}

View File

@ -1,12 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
return [];

View File

@ -1,157 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------
// 应用公共文件
/**
* 转换文件大小单位
*
* @param $size
* @param $array
*
* @return string|array
*/
function format_size($size, $array = false)
{
if (0 == $size) {
return "0.00 Bytes";
}
$unit = ['', 'K', 'M', 'G', 'T', 'P'];
$base = 1024;
$i = floor(log($size, $base));
$n = count($unit);
if ($i >= $n) {
$i = $n - 1;
}
if ($array) {
return [sprintf("%.2f", $size / pow($base, $i)), $unit[$i] . 'B'];
}
return sprintf("%.2f", $size / pow($base, $i)) . ' ' . $unit[$i] . 'B';
}
/**
* 格式化友好时间戳
*
* @return false|string
*/
function format_time($remote, $local = null)
{
$timediff = (is_null($local) || $local ? time() : $local) - $remote;
$chunks = array(
array(60 * 60 * 24 * 365, 'year'),
array(60 * 60 * 24 * 30, 'month'),
array(60 * 60 * 24 * 7, 'week'),
array(60 * 60 * 24, 'day'),
array(60 * 60, 'hour'),
array(60, 'minute'),
array(1, 'second')
);
$name = $count ='';
for ($i = 0, $j = count($chunks); $i < $j; $i++) {
$seconds = $chunks[$i][0];
$name = $chunks[$i][1];
if (($count = floor($timediff / $seconds)) != 0) {
break;
}
}
return lang("%s {$name}%s ago", [$count, ($count > 1 ? 's' : '')]);
}
/**
* 过滤逗号(去除字符串两边的逗号,并将中文逗号转换成英文逗号)
*
* @param string $str 字符串
*
* @return string
*/
function filter_comma($str)
{
return trim(str_replace("", ",", $str), ",");
}
/**
* 获取文件后缀
*
* @param string $name 文件名
*
* @return mixed
*/
function get_file_ext($name)
{
return pathinfo($name, PATHINFO_EXTENSION);
}
/**
* 随机字符串
*
* @param int $length
* @param string $char
* @return bool|string
*/
function str_rand($length = 16, $char = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
{
$string = '';
for ($i = $length; $i > 0; $i--) {
$string .= $char[mt_rand(0, strlen($char) - 1)];
}
return $string;
}
/**
* Make Token
*
* @param bool $recursion 是否递归检测 Token
* @return string
*/
function make_token($recursion = true)
{
$token = md5('LSKY PRO' . uniqid() . time());
if ($recursion) {
if (\app\common\model\Users::where('token', $token)->count()) {
return make_token(true);
}
}
return $token;
}
/**
* Make Url
*
* @param $domain
* @param null $pathname
* @return mixed
*/
function make_url($domain, $pathname = null)
{
$domain = rtrim($domain, '/');
if (false === strpos($domain, 'https://') && false === strpos($domain, 'http://')) {
$domain = 'http://' . $domain;
}
$query = \think\facade\Config::get('system.url_query');
$url = str_replace('\\', '/', $domain . ($pathname ? '/' . $pathname : null));
if ($query) $url = $url . $query;
return $url;
}
/**
* @param int $length
* @return int
*/
function generate_code($length = 5)
{
$min = pow(10, ($length - 1));
$max = pow(10, $length) - 1;
return rand($min, $max);
}

View File

@ -1,302 +0,0 @@
<?php
/**
* Created by Wisp X
* User: Wisp X
* Date: 2020/3/17
* Time: 9:01
*/
namespace app\common\controller;
use app\common\model\Group;
use app\common\model\Images;
use app\common\traits\Core;
use GuzzleHttp\Client;
use think\Controller;
use think\Exception;
use think\facade\Config;
use think\Image;
class Upload extends Controller
{
use Core;
/**
* 当前登录用户
*
* @var
*/
private $user;
/**
* 当前应该使用的用户组
*
* @var
*/
private $group;
/**
* 当前应该使用的储存对象实例
*
* @var
*/
private $strategy;
protected function initialize()
{
parent::initialize();
$this->user = request()->user;
$this->configs = $this->getConfig();
// 角色组
if ($this->user) $this->group = $this->user->role;
if (!$this->group) $this->group = Group::where('default', 1)->find();
// 设置当前储存策略
$this->strategy = $this->getStrategyInstance($this->group->strategy);
}
/**
* 执行上传,成功返回数据,否则直接抛出异常
*
* @return array
* @throws Exception
*/
public function exec()
{
if (!$this->configs['allowed_tourist_upload'] && !$this->user) {
throw new Exception(lang('The administrator turned off the tourist upload!'));
}
$sameIpDayMaxUploadCount = $this->getConfig('same_ip_day_max_upload');
if ($sameIpDayMaxUploadCount > 0) {
$startTimestamp = strtotime(date('Y-m-d'));
$ipUploadCount = Images::where('ip', '=', request()->ip())->where('create_time', '>=', $startTimestamp)
->count();
if ($ipUploadCount >= $sameIpDayMaxUploadCount) {
throw new Exception(lang('The number of pictures uploaded today has reached the maximum'));
}
}
$image = $this->getImage();
$size = $image->getSize();
$mime = $image->getMime();
$sha1 = $image->hash('sha1');
$md5 = $image->hash('md5');
if ($this->user) {
if (($this->user->use_quota + $size) > $this->user->quota) {
throw new Exception(lang('Save failed! Your storage capacity is insufficient, please contact the administrator!'));
}
if (!$this->user->state) {
throw new Exception(lang('Your account is frozen, please contact the administrator!'));
}
}
$temp = $image->getPathname();
// 当前储存策略
$currentStrategy = strtolower($this->group->strategy);
$pathname = $this->makePathname($image->getInfo('name'));
$cdnDomain = $currentStrategy . '_cdn_domain';
$domain = $this->request->domain();
if (array_key_exists($cdnDomain, $this->strategy->configs)) {
if ($this->strategy->configs[$cdnDomain]) {
$domain = $this->strategy->configs[$cdnDomain];
}
}
$url = make_url($domain, $pathname);
// 自动水印
if (Config::get('system.watermark') && $watermarkConfig = config("watermark.{$currentStrategy}")) {
if ($watermarkConfig['enable']) {
$watermarkImage = app()->getRuntimePath() . 'temp/' . md5($sha1 . $md5);
$locates = [
1 => Image::WATER_NORTHWEST, 2 => Image::WATER_NORTH, 3 => Image::WATER_NORTHEAST,
4 => Image::WATER_WEST, 5 => Image::WATER_CENTER, 6 => Image::WATER_EAST,
7 => Image::WATER_SOUTHWEST, 8 => Image::WATER_SOUTH, 9 => Image::WATER_SOUTHEAST,
];
switch ($watermarkConfig['type']) {
case 1:
$watermark = Image::open($image)->text(
$watermarkConfig['text'],
$watermarkConfig['font'],
$watermarkConfig['size'],
$watermarkConfig['color'],
$locates[$watermarkConfig['locate']],
$watermarkConfig['offset'],
$watermarkConfig['angle']
);
break;
case 2:
$watermark = Image::open($image)->water(
$watermarkConfig['source'],
$watermarkConfig['locate'],
$watermarkConfig['alpha']
);
break;
default:
throw new Exception(lang('Abnormal configuration of automatic watermark function'));
}
$watermark->save($watermarkImage);
$temp = $watermarkImage;
$sha1 = sha1_file($temp);
$md5 = md5_file($temp);
$size = filesize($temp);
}
}
// 检测是否存在该图片,有则直接返回
if ($oldImage = Images::where('md5', $md5)->where('sha1', $sha1)->where('strategy', $currentStrategy)->find()) {
$pathname = $oldImage->pathname;
$url = make_url($domain, $pathname);
goto exist;
}
if (!$this->strategy->create($pathname, $temp)) {
if (Config::get('app.app_debug')) {
throw new Exception($this->strategy->getError());
}
throw new Exception(lang('Upload failed. Please check whether the policy configuration is correct!'));
}
isset($watermarkImage) && @unlink($watermarkImage);
exist:
// 图片鉴黄
$suspicious = 0;
if ($this->configs['open_audit']) {
$client = new Client(['timeout' => 30.00]);
$response = $client->get("https://www.moderatecontent.com/api/v2?key={$this->configs['audit_key']}&url={$url}");
if (200 == $response->getStatusCode()) {
$result = json_decode($response->getBody()->getContents());
if (0 == $result->error_code) {
if ($result->rating_index >= $this->configs['audit_index']) {
// 是否直接拦截色情图片
if (Config::get('system.intercept_salacity')) {
$this->strategy->delete($pathname);
throw new Exception(lang('The picture %s is suspected of violation. Uploading is prohibited!', [$image->getInfo('name')]));
}
$suspicious = 1;
}
} else {
$this->strategy->delete($pathname);
throw new Exception($result->error);
}
}
}
$imageData = [
'user_id' => $this->user ? $this->user->id : 0,
'strategy' => $currentStrategy,
'path' => dirname($pathname),
'name' => basename($pathname),
'pathname' => $pathname,
'size' => $size,
'mime' => $mime,
'sha1' => $sha1,
'md5' => $md5,
'suspicious' => $suspicious
];
// 默认上传文件夹,暂只支持一级
if ($this->user && $this->user->default_folder) {
$folderId = $this->user->folders()->where('name', $this->user->default_folder)->value('id');
if (!$folderId) {
if (!$folderId = $this->user->folders()->insertGetId([
'user_id' => $this->user->id,
'parent_id' => 0,
'name' => $this->user->default_folder
])) {
throw new Exception(lang('Folder creation failed!'));
}
}
$imageData['folder_id'] = $folderId;
}
if (!$model = Images::create($imageData)) {
$this->strategy->delete($pathname);
throw new Exception(lang('Failed to save picture data'));
}
$data = [
'id' => $model->id,
'name' => $image->getInfo('name'),
'url' => $url,
'size' => $size,
'mime' => $mime,
'sha1' => $sha1,
'md5' => $md5,
];
if ($this->user) {
$data['quota'] = sprintf('%.2f', (float)$this->user->quota);
$data['use_quota'] = sprintf('%.2f', (float)$this->user->use_quota);
}
return $data;
}
/**
* 获取图片资源
*
* @return array|null|\think\File
* @throws Exception
*/
private function getImage()
{
$image = $this->request->file('image');
if (null === $image) {
throw new Exception(lang('Picture resource acquisition failed'));
}
if (!is_uploaded_file($image->getPathname())) {
throw new Exception('file is not uploaded via HTTP POST');
}
if (!$image->check([
'size' => $this->configs['upload_max_size'],
'ext' => filter_comma($this->configs['upload_allowed_exts']),
])) {
throw new Exception($image->getError());
}
return $image;
}
/**
* Make pathname
*
* @param string $name 文件名
*
* @return string
*/
private function makePathname($name)
{
$naming = Config::pull('naming');
$pathRule = $this->configs['path_naming_rule'];
$fileRule = $this->configs['file_naming_rule'];
$path = trim(str_replace(
array_column($naming['path'], 'name'),
array_column($naming['path'], 'value'),
$pathRule
), '/');
// 原始文件名单独处理
foreach ($naming['file'] as &$item) {
if ($item['name'] === '{original}') {
$item['value'] = pathinfo($name, PATHINFO_FILENAME);
}
}
$file = trim(str_replace(
array_column($naming['file'], 'name'),
array_column($naming['file'], 'value'),
$fileRule
), '/') . '.' . get_file_ext($name);
return $path ? ($path . '/' . $file) : trim($file, '/');
}
}

View File

@ -1,18 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/26
* Time: 下午4:35
* Link: https://github.com/wisp-x
*/
namespace app\common\model;
use think\Model;
class Config extends Model
{
protected $createTime = false;
protected $json = ['extend'];
}

View File

@ -1,17 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018-12-27
* Time: 11:08
* Link: https://github.com/wisp-x
*/
namespace app\common\model;
use think\Model;
use think\model\concern\SoftDelete;
class Folders extends Model
{
use SoftDelete;
}

View File

@ -1,24 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2019-01-19
* Time: 13:07
* Link: https://github.com/wisp-x
*/
namespace app\common\model;
use think\Model;
class Group extends Model
{
protected $insert = ['default'];
public function setDefaultAttr($default)
{
if ($default) {
$this->where('default', 1)->setField('default', 0);
}
return $default ? 1 : 0;
}
}

View File

@ -1,41 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/29
* Time: 下午3:14
* Link: https://github.com/wisp-x
*/
namespace app\common\model;
use think\Model;
class Images extends Model
{
protected $updateTime = false;
protected $insert = ['ip'];
protected $append = ['url'];
public function getUrlAttr($url, $data)
{
// 图片链接
$cdnDomain = Config::where([
'key' => $data['strategy'],
'name' => $data['strategy'] . '_cdn_domain',
])->value('value');
$domain = $cdnDomain ? $cdnDomain : request()->domain();
return make_url($domain, $data['pathname']);
}
public function setIpAttr()
{
return request()->ip();
}
public function getDateAttr($date, $data)
{
return format_time($data['create_time']);
}
}

View File

@ -1,91 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/25
* Time: 下午3:20
* Link: https://github.com/wisp-x
*/
namespace app\common\model;
use think\Exception;
use think\facade\Session;
use think\Model;
use think\model\concern\SoftDelete;
class Users extends Model
{
use SoftDelete;
protected $insert = ['reg_ip', 'quota', 'token', 'group_id'];
protected $append = ['use_quota'];
public function setGroupIdAttr()
{
return Group::where('default', 1)->value('id');
}
public function setPassWordAttr($password)
{
return md5($password);
}
public function setRegIpAttr()
{
return request()->ip();
}
public function setQuotaAttr($quota)
{
return $quota ? $quota : Config::where('name', 'user_initial_quota')->value('value');
}
public function setTokenAttr()
{
return make_token();
}
public function getUseQuotaAttr()
{
return sprintf("%.2f", $this->images()->sum('size'));
}
public static function login($account, $password, $field = 'email')
{
if (!$account) {
throw new Exception(lang('Please enter the account number'));
}
if (!$password) {
throw new Exception(lang('Please input a password'));
}
if ($user = self::get([$field => $account])) {
if (0 === $user->state) {
throw new Exception(lang('Your account has been frozen, please contact the administrator!'));
}
if ($user->password !== md5($password)) {
throw new Exception(lang('Incorrect password'));
}
Session::set('uid', $user->id);
} else {
throw new Exception(lang('User does not exist'));
}
}
public function images()
{
return $this->hasMany(Images::class, 'user_id', 'id');
}
public function folders()
{
return $this->hasMany(Folders::class, 'user_id', 'id');
}
public function role()
{
return $this->hasOne(Group::class, 'id', 'group_id');
}
}

View File

@ -1,78 +0,0 @@
<?php
namespace app\common\traits;
use strategy\Driver;
use think\exception\HttpResponseException;
use think\facade\Config;
use think\facade\Response;
trait Core
{
/**
* 系统配置
* @var array
*/
protected $configs = [];
/**
* 获取指定储存策略的对象实例
*
* @param $strategy
* @return Driver
*/
public function getStrategyInstance($strategy)
{
$strategy = strtolower($strategy);
$configs = \app\common\model\Config::where('key', $strategy)->column('value', 'name');
// 驱动
$driver = Config::get('strategy.' . $strategy . '.class');
$class = new $driver($configs);
$class->configs = $configs;
// 获取该储存策略配置
return $class;
}
/**
* 获取系统配置信息
*
* @param string $name
* @return array|mixed|null
*/
public function getConfig($name = '')
{
if (count($this->configs) === 0) {
$data = \app\common\model\Config::all();
foreach ($data as $value) {
$this->configs[$value->name] = $value->value;
}
}
if ($name) {
return isset($this->configs[$name]) ? $this->configs[$name] : null;
}
return $this->configs;
}
/**
* 返回数据给客户端并中断输出
*
* @param string $msg 提示信息
* @param array $data 数据
* @param int $code 状态码
* @param string $type 返回数据类型
*
* @throws HttpResponseException
*/
protected function response($msg = '', $data = [], $code = 200, $type = 'json')
{
$response = Response::create([
'code' => $code,
'msg' => $msg,
'data' => $data ?: new \stdClass(),
'time' => time()
], $type);
throw new HttpResponseException($response);
}
}

View File

@ -1,28 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018-12-27
* Time: 14:30
* Link: https://github.com/wisp-x
*/
namespace app\common\validate;
use think\Validate;
class Folders extends Validate
{
protected $rule = [
'parent_id' => 'require|number|integer',
'name' => 'require|max:30|chsAlphaNum'
];
protected $message = [
'parent_id.require' => '{%Parent folder not found}',
'parent_id.number' => '{%Parent folder exception}',
'parent_id.integer' => '{%Parent folder exception}',
'name.require' => '{%Folder name cannot be empty}',
'name.max' => '{%Folder name length max. 30 characters}',
'name.chsAlphaNum' => '{%Folder names can only be Chinese characters, letters and numbers}'
];
}

View File

@ -1,24 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2019-01-19
* Time: 14:06
* Link: https://github.com/wisp-x
*/
namespace app\common\validate;
use think\Validate;
class Group extends Validate
{
protected $rule = [
'name' => 'require|max:30|chsAlphaNum'
];
protected $message = [
'name.require' => '{%Role group name cannot be empty}',
'name.max' => '{%The maximum length of the role group name is 30 characters}',
'name.chsAlphaNum' => '{%The role group name can only be Chinese characters, letters and numbers}'
];
}

View File

@ -1,57 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/26
* Time: 下午3:26
* Link: https://github.com/wisp-x
*/
namespace app\common\validate;
use think\Validate;
class Users extends Validate
{
protected $rule = [
'username' => 'require|min:3|max:15|alphaDash|unique:users',
'nickname' => 'max:15',
'default_folder' => 'max:30|chsAlphaNum',
'email' => 'require|email|max:50|unique:users',
'password' => 'require|confirm',
'captcha' => 'require|captcha|token',
];
protected $message = [
'username.require' => '{%User name cannot be empty}',
'username.min' => '{%The user name cannot be less than three characters}',
'username.max' => '{%The user name character length exceeds the limit}',
'username.alphaDash' => '{%User names can only be letters, numbers, and underscores_ And dash-}',
'username.unique' => '{%User name already exists, please replace}',
'nickname.max' => '{%The length of nickname characters exceeds the limit}',
'default_folder.max' => '{%Default upload folder name length exceeds limit}',
'default_folder.chsAlphaNum'=> '{%The default upload folder name can only be Chinese characters, letters and numbers}',
'email.require' => '{%Mailbox cannot be empty}',
'email.email' => '{%The mailbox format is incorrect}',
'email.max' => '{%Mailbox character length exceeds the limit}',
'email.unique' => '{%Mailbox already exists}',
'password.require' => '{%Password cannot be empty}',
'password.confirm' => '{%The passwords entered twice are inconsistent}',
'captcha.require' => '{%Please enter the verification code}',
'captcha.captcha' => '{%Verification code error}',
];
public function sceneEdit()
{
return $this->only(['nickname', 'default_folder', 'password'])->remove('password', 'require');
}
public function sceneAdminEdit()
{
return $this->only(['username', 'nickname', 'email', 'password'])->remove('password', 'require');
}
public function sceneInstall()
{
return $this->only(['username', 'email', 'password']);
}
}

View File

@ -1,45 +0,0 @@
<?php
namespace app\http\middleware;
use app\common\model\Users;
use app\common\traits\Core;
use think\Request;
class ApiAuthenticate
{
use Core;
/**
* 允许不登录访问的路径
*
* @var array
*/
private $paths = [
'api/token',
'api/upload'
];
public function handle(Request $request, \Closure $next)
{
if (!$this->getConfig('open_api')) { // 站点是否开启了接口
$this->response(lang('The administrator turned off API functionality'), [], 500);
}
$user = null;
$token = $request->header('token', $request->request('token'));
if ($token) {
if (!$user = Users::get(['token' => $token])) {
$this->response(lang('Authentication failed'), [], 401);
}
}
if (!in_array($request->path(), $this->paths)) {
if (!$token) $this->response(lang('Token does not exist'), [], 401);
}
$request->user = $user;
return $next($request);
}
}

View File

@ -1,70 +0,0 @@
<?php
namespace app\http\middleware;
use app\common\traits\Core;
use think\exception\HttpResponseException;
use think\facade\Response;
use think\Request;
class Initialize
{
use Core;
public function handle(Request $request, \Closure $next)
{
// 检测程序是否已安装
if (!file_exists(app()->getAppPath() . 'install.lock')) {
if ($request->controller(true) !== 'install' || $request->action(true) !== 'index') {
return redirect(url('install/index'));
}
} else {
// 检测封禁IP
$banIp = $this->getConfig('ban_ip');
if ($banIp) {
$ips = explode(',', str_replace('', ',', $banIp));
if ($this->banIp($request->ip(), $ips)) {
throw new HttpResponseException(Response::code(403));
}
}
}
return $next($request);
}
/**
* 拦截某个IP, 支持通配符
*
* @param string $ip
* @param array $ips
* @return bool
*/
private function banIp($ip, array $ips)
{
$parts = explode('.', $ip); // 分段当前 IP
$ban = false;
foreach ($ips as $item) {
// 如果直接匹配到
if ($item === $ip) {
$ban = true;
continue;
}
if (strpos($item, '*') !== false) {
$array = explode('.', $item);
$check = true;
for ($i = 0; $i < count($array); $i++) {
if ($array[$i] !== '*' && $array[$i] !== $parts[$i]) {
$check = false;
break;
}
}
if ($check) {
$ban = true;
break;
}
}
}
return $ban;
}
}

View File

@ -1,56 +0,0 @@
<?php
namespace app\http\middleware;
use app\common\model\Users;
use think\facade\Session;
use think\Request;
class WebAuthenticate
{
/**
* 允许不登录访问的路径
*
* @var array
*/
private $paths = [
'install/index',
'index/index',
'upload/upload',
'auth/login',
'auth/register',
'auth/forgot',
'auth/sendCode',
'index/api',
'index/gallery',
];
public function handle(Request $request, \Closure $next)
{
$controller = $request->controller(true);
$action = $request->action(true);
$path = $controller . '/' . $action;
$user = null;
if ($uid = Session::get('uid')) {
if (!$user = Users::get($uid)) {
Session::delete('uid');
}
}
if (!in_array($path, $this->paths) && !$user) {
return redirect(url('/auth/login'));
}
$request->user = $user;
// 单用户模式下, 只允许访问首页(除了接口)
if (env('system.single_user_mode') && !$user) {
if ($path !== 'index/index') {
return redirect(url('/'));
}
}
return $next($request);
}
}

View File

@ -1,123 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/25
* Time: 下午3:43
* Link: https://github.com/wisp-x
*/
namespace app\index\controller;
use app\common\model\Users;
use think\Exception;
use think\facade\Session;
class Auth extends Base
{
public function login($account = null, $password = null)
{
if ($this->request->isPost()) {
try {
Users::login($account, $password, filter_var($account, FILTER_VALIDATE_EMAIL) ? 'email' : 'username');
} catch (Exception $e) {
Session::flash('error', $e->getMessage());
return $this->fetch();
}
$this->redirect(url('/'));
}
return $this->fetch();
}
public function register()
{
if ($this->request->isPost()) {
try {
if ($this->getConfig('close_register')) {
throw new Exception(lang('Site registration closed'));
}
$data = $this->request->post();
$validate = $this->validate($data, 'Users');
if (true !== $validate) {
throw new Exception($validate);
}
Users::create($data);
} catch (Exception $e) {
Session::flash('error', $e->getMessage());
return $this->fetch();
}
Session::flash('success', lang('Registration successful'));
$this->redirect(url('auth/login'));
}
if ($this->getConfig('close_register')) {
abort(404, lang('Site registration closed'));
}
return $this->fetch();
}
public function forgot()
{
$delSession = function () {
Session::delete('code', 'forgot_');
Session::delete('email', 'forgot_');
};
if ($this->request->isPost()) {
try {
$data = $this->request->post();
$validate = $this->validate($data, [
'password|'.lang('Password') => 'require|confirm',
]);
if (true !== $validate) {
$this->error($validate);
}
if ($data['code'] != Session::get('code', 'forgot_')) {
throw new Exception(lang('Incorrect verification code'));
}
if (!$user = Users::get(['email' => Session::get('email', 'forgot_')])) {
throw new Exception(lang('User does not exist'));
}
$user->password = $data['password'];
$user->save();
} catch (Exception $e) {
$this->error($e->getMessage());
}
$delSession();
$this->success(lang('Reset successful'));
}
$delSession();
return $this->fetch();
}
public function sendCode()
{
if ($this->request->isPost()) {
$data = $this->request->post();
$validate = $this->validate($data, [
'email|'.lang('Mailbox') => 'require|email',
'captcha|'.lang('Verification Code') => 'require|captcha'
]);
if (true !== $validate) {
$this->error($validate);
}
if (!$user = Users::get(['email' => $data['email']])) {
$this->error(lang('Account does not exist'));
}
$code = generate_code();
$err = $this->sendMail(
$data['email'],
lang('Retrieve password'),
lang('Retrieve password mail content', [$user->username, $code])
);
if (true !== $err) {
$this->error($err);
}
Session::set('code', $code, 'forgot_');
Session::set('email', $data['email'], 'forgot_');
$this->success(lang('Sent successfully'));
}
}
}

View File

@ -1,79 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/25
* Time: 下午2:10
* Link: https://github.com/wisp-x
*/
namespace app\index\controller;
use app\common\model\Group;
use app\common\model\Users;
use app\common\traits\Core;
use PHPMailer\PHPMailer\PHPMailer;
use think\Controller;
use think\Exception;
use think\facade\Config;
use think\facade\Cookie;
use think\facade\Lang;
use think\facade\Session;
use think\facade\Env;
class Base extends Controller
{
use Core;
/**
* @var Users
*/
protected $user;
protected function initialize()
{
parent::initialize();
$this->user = request()->user;
if ($this->request->has('lang')) {
Cookie::set('think_var', $this->request->get('lang'));
}
$this->assign([
'config' => $this->getConfig(),
'user' => $this->user,
'uri' => strtolower($this->request->controller() . '/' . $this->request->action()),
'lang' => Lang::range(),
'languages' => json_encode(Lang::get()),
]);
}
protected function sendMail($email, $subject, $body)
{
$mail = new PHPMailer();
try {
// $mail->SMTPDebug = 2;
$mail->isSMTP();
$mail->Host = $this->getConfig('mail_smtp_host');
$mail->CharSet = 'UTF-8';
$mail->SMTPAuth = true;
$mail->Username = $this->getConfig('mail_smtp_username');
$mail->Password = $this->getConfig('mail_smtp_password');
$mail->SMTPSecure = $this->getConfig('mail_smtp_secure');
$mail->Port = $this->getConfig('mail_smtp_port');
$mail->setFrom($this->getConfig('mail_form_email'), $this->getConfig('site_name'));
$mail->addAddress($email);
$mail->addReplyTo($this->getConfig('mail_form_email'), $this->getConfig('site_name'));
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $body;
if (!$mail->send()) {
throw new Exception('Mailer Error: ' . $mail->ErrorInfo);
}
} catch (Exception $e) {
$this->error($e->getMessage());
}
return true;
}
}

View File

@ -1,70 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/27
* Time: 下午4:00
* Link: https://github.com/wisp-x
*/
namespace app\index\controller;
use app\common\model\Images;
use app\common\model\Users;
use think\Collection;
use think\Exception;
class Index extends Base
{
public function index()
{
// 是否是单用户模式
if (env('system.single_user_mode') && !request()->user) {
if ($this->request->isPost()) {
try {
$account = $this->request->post('account');
$password = $this->request->post('password');
$field = filter_var($account, FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
Users::login($account, $password, $field);
} catch (Exception $e) {
$this->error($e->getMessage());
}
$this->success(lang('Welcome back'));
}
return view('index/home');
}
$this->assign('images_count', Images::cache(120)->count());
return $this->fetch();
}
public function gallery()
{
if (!$this->getConfig('open_gallery')) {
abort(404, lang('Gallery feature is off'));
}
$images = [];
Images::order('id', 'desc')
->where('user_id', 0)
->paginate($this->request->limit ? $this->request->limit : 30)
->each(function (Images $item) use (&$images) {
$images[] = [
'url' => $item->url,
'date' => $item->date,
];
});
if ($this->request->isPost()) {
$this->success('success', null, $images);
}
$this->assign('images', $images);
return $this->fetch();
}
public function api()
{
if (!$this->getConfig('open_api')) {
abort(404, lang('API interface closed'));
}
$this->assign('domain', $this->request->domain());
return $this->fetch();
}
}

View File

@ -1,156 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/10/12
* Time: 19:15
* Link: https://github.com/wisp-x
*/
namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Exception;
use think\facade\Session;
class Install extends Controller
{
public function index($step = 1)
{
// 检测是否已安装
if (file_exists(app()->getAppPath() . 'install.lock') && !Session::has('install_success')) {
exit(lang('Installed tips'));
}
$phpVerGt56 = PHP_VERSION >= 5.6;
$isCurl = function_exists('curl_init');
$isFileInfo = function_exists('finfo_open');
$pdo = extension_loaded("pdo_mysql");
$isZip = class_exists('ZipArchive');
switch ($step) {
case 1:
// 运行环境检测
$testing = $phpVerGt56 && $isCurl && $isFileInfo && $pdo && $isZip;
$this->assign([
'phpVerGt56' => $phpVerGt56,
'isCurl' => $isCurl,
'isFileInfo' => $isFileInfo,
'pdo' => $pdo,
'isZip' => $isZip,
'testing' => $testing,
'dir' => is_writable(app()->getRuntimePath()) && is_writable(app()->getConfigPath()),
]);
break;
case 2:
// 安装
if ($this->request->isPost()) {
$hostname = $this->request->post('hostname');
$database = $this->request->post('database');
$username = $this->request->post('username');
$password = $this->request->post('password');
$hostport = $this->request->post('hostport');
try {
$installSql = app()->getAppPath() . 'sql/install.sql';
if (!is_file($installSql)) {
throw new Exception(lang('The database SQL file does not exist'));
}
$db = Db::connect(array_merge(\config('database.'), [
'hostname' => $hostname,
'database' => $database,
'username' => $username,
'password' => $password,
'hostport' => $hostport,
]));
$lines = file($installSql);
$temp = '';
foreach ($lines as &$line) {
$line = trim($line);
if (substr($line, 0, 2) == '--' || $line == '' || substr($line, 0, 2) == '/*') continue;
$temp .= $line;
if (substr($line, -1, 1) == ';') {
$db->execute($temp);
$temp = '';
}
}
Session::set('db', [
'hostname' => $hostname,
'database' => $database,
'username' => $username,
'password' => $password,
'hostport' => $hostport,
'prefix' => 'lsky_'
]);
} catch (Exception $e) {
$this->error($e->getMessage());
} catch (\PDOException $e) {
$this->error($e->getMessage());
}
$this->success(lang('Data written successfully'));
}
break;
case 3:
// 设置管理员账号密码
if ($this->request->isPost()) {
try {
$data = $this->request->post();
$data['is_admin'] = 1;
$data['group_id'] = 1;
$data['quota'] = 1073741824;
$data['update_time'] = time();
$data['create_time'] = time();
if ($data['password'] != $data['password_confirm']) {
throw new Exception(lang('The passwords entered twice are inconsistent!'));
}
$data['password'] = md5($data['password']);
$data['reg_ip'] = request()->ip();
$data['token'] = make_token(false);
$config = Session::get('db');
// 写入 env 文件
$env = str_ireplace([
'{hostname}',
'{database}',
'{username}',
'{password}',
'{hostport}',
], $config, @file_get_contents(app()->getRootPath() . '.env.example'));
if (!@file_put_contents(app()->getRootPath() . '.env', $env)) {
throw new \Exception(lang('Configuration file write failed'));
}
$db = Db::connect(array_merge(\config('database.'), $config));
unset($data['password_confirm']);
$db->name('users')->insert($data);
// 创建安装锁文件
if (!@fopen(app()->getAppPath() . 'install.lock', 'w')) {
throw new \Exception(lang('Setup lock file creation failed'));
}
} catch (Exception $e) {
@unlink(app()->getAppPath() . 'install.lock');
$this->error($e->getMessage());
} catch (\Exception $e) {
@unlink(app()->getAppPath() . 'install.lock');
$this->error($e->getMessage());
} catch (\PDOException $e) {
@unlink(app()->getAppPath() . 'install.lock');
$this->error($e->getMessage());
}
Session::flash('install_success', true);
// 删除session
Session::delete('db');
$this->success(lang('Set successfully'));
}
break;
}
$this->assign([
'step' => $step
]);
return $this->fetch();
}
}

View File

@ -1,38 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/26
* Time: 21:51
* Link: https://github.com/wisp-x
*/
namespace app\index\controller;
use think\Db;
use think\Exception;
use think\exception\ErrorException;
class Upload extends Base
{
public function upload()
{
Db::startTrans();
try {
$data = (new \app\common\controller\Upload)->exec();
Db::commit();
} catch (Exception $e) {
Db::rollback();
return json(['error' => $e->getMessage()]);
} catch (ErrorException $e) {
Db::rollback();
return json(['error' => $e->getMessage()]);
} catch (\Throwable $e) {
Db::rollback();
return json(['error' => $e->getMessage()]);
}
$this->result($data, 200, lang('Upload succeeded'));
}
}

View File

@ -1,268 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/26
* Time: 19:37
* Link: https://github.com/wisp-x
*/
namespace app\index\controller;
use app\common\model\Folders;
use app\common\model\Images;
use think\Db;
use think\facade\Config;
use think\facade\Session;
use think\Exception;
use think\Validate;
class User extends Base
{
public function images($keyword = '', $folderId = 0, $limit = 60)
{
$images = $folders = [];
if ($this->request->isPost()) {
try {
$model = $this->user->images()->order('create_time', 'desc');
$folders = $this->user->folders()->where('parent_id', $folderId)->select();
if (!empty($keyword)) {
$model = $model->where('pathname|alias_name|sha1|md5|ip', 'like', "%{$keyword}%");
}
if (is_numeric($folderId)) {
$model = $model->where('folder_id', $folderId);
}
$images = $model->paginate($limit);
} catch (Exception $e) {
$this->error($e->getMessage());
}
$this->success('success', null, [
'images' => $images,
'folders'=> $folders
]);
}
return $this->fetch();
}
public function deleteImages($deleteId = null)
{
Db::startTrans();
try {
$id = $deleteId ? $deleteId : $this->request->post('id');
$deletes = []; // 需要删除的文件
$images = $this->user->images()->where('id', 'in', $id)->select();
foreach ($images as &$value) {
// 查找是否有相同 md5 的文件记录,有的话则只删除记录不删除文件
if (!$this->exists($value)) {
$deletes[$value->strategy][] = $value->pathname;
}
$value->delete();
unset($value);
}
// 是否开启软删除(开启了只删除记录,不删除文件)
if (!$this->getConfig('soft_delete')) {
$strategy = [];
// 实例化所有储存策略驱动
$strategyAll = array_keys(Config::pull('strategy'));
foreach ($strategyAll as $value) {
// 获取储存策略驱动
$strategy[$value] = $this->getStrategyInstance($value);
}
foreach ($deletes as $key => $val) {
if (1 === count($val)) {
if (!$strategy[$key]->delete(isset($val[0]) ? $val[0] : null)) {
// throw new Exception(lang('Deletion failed'));
}
} else {
if (!$strategy[$key]->deletes($val)) {
// throw new Exception(lang('Batch deletion failed'));
}
}
}
}
Db::commit();
} catch (Exception $e) {
Db::rollback();
if ($deleteId) {
return false;
}
$this->error($e->getMessage());
}
if ($deleteId) {
return true;
}
$this->success(lang('Delete succeeded'));
}
public function createFolder()
{
if ($this->request->isPost()) {
try {
$parentId = $this->request->post('parent_id');
$name = $this->request->post('name');
$data = [
'user_id' => $this->user->id,
'parent_id' => $parentId,
'name' => $name
];
$validate = $this->validate($data, 'Folders');
if (true !== $validate) {
throw new Exception($validate);
}
Folders::create($data);
} catch (Exception $e) {
$this->error($e->getMessage());
}
$this->success(lang('Created successfully'));
}
}
public function deleteFolder()
{
if ($this->request->isPost()) {
Db::startTrans();
try {
$id = $this->request->post('id');
$folders = $images = [];
$this->getDeleteFoldersAndImages($id, $folders, $images);
$folders[] = (int) $id;
$folders && Folders::destroy($folders, true);
$images && $this->deleteImages($images);
Db::commit();
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
$this->success(lang('Delete succeeded'));
}
}
public function getFolders($parentId = 0)
{
if ($this->request->isPost()) {
$folders = $this->user->folders()->where('parent_id', $parentId)->select();
$this->success('success', null, $folders);
}
}
public function moveImages($ids, $folderId)
{
if ($this->request->isPost()) {
$count = $this->user->folders()->where('id', $folderId)->count();
if ($count || $folderId == 0) {
if (Images::where('id', 'in', $ids)->setField('folder_id', $folderId)) {
$this->success(lang('Move succeeded'));
}
$this->error(lang('Move failed'));
} else {
$this->error(lang('The folder does not exist!'));
}
}
}
public function renameFolder()
{
if ($this->request->isPost()) {
Db::startTrans();
try {
$id = $this->request->post('id');
$parentId = $this->request->post('parent_id');
$name = $this->request->post('name');
$data = [
'id' => $id,
'parent_id' => $parentId,
'user_id' => $this->user->id,
'name' => $name
];
$validate = $this->validate($data, 'Folders');
if (true !== $validate) {
throw new Exception($validate);
}
Folders::update($data);
Db::commit();
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
$this->success(lang('Rename succeeded'));
}
}
public function renameImage()
{
if ($this->request->isPost()) {
try {
$id = $this->request->post('id');
$name = $this->request->post('name');
$validate = Validate::make(['name|'.lang('Alias') => 'require|max:60|chsDash']);
if (!$validate->check(['name' => $name])) {
throw new \Exception($validate->getError());
}
if (!$this->user->images()->where('id', $id)->update(['alias_name' => $name])) {
throw new \Exception(lang('Rename failed'));
}
} catch (\Exception $e) {
$this->error($e->getMessage());
}
$this->success(lang('Rename succeeded'));
}
}
/**
* 检测除本身图片以外的记录是否存在
*
* @param Images $image
* @return float|string
*/
private function exists(Images $image)
{
return Images::where('id', 'neq', $image->id)
->where('md5', $image->md5)
->where('sha1', $image->sha1)
->count();
}
private function getDeleteFoldersAndImages($folderId, &$folders, &$images)
{
$folderList = $this->user->folders()->where('parent_id', $folderId)->column('id');
$imagesList = $this->user->images()->where('folder_id', $folderId)->column('id');
if ($imagesList) {
$images = array_merge($images, $imagesList);
}
foreach ($folderList as &$value) {
$folders[] = $value;
$this->getDeleteFoldersAndImages($value, $folders, $images);
}
}
public function settings()
{
if ($this->request->isPost()) {
try {
$data = $this->request->post();
$validate = $this->validate($data, 'Users.edit');
if (true !== $validate) {
throw new Exception($validate);
}
if ($data['password_old']) {
if (md5($data['password_old']) != $this->user->password) {
throw new Exception(lang('The original password is incorrect'));
}
}
if (!$data['password']) unset($data['password']);
$this->user->save($data);
} catch (Exception $e) {
$this->error($e->getMessage());
}
$this->success(lang('Saved successfully'));
}
return $this->fetch();
}
public function logout()
{
Session::delete('uid');
$this->redirect(url('/'));
}
}

View File

@ -1,38 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/27
* Time: 上午10:14
* Link: https://github.com/wisp-x
*/
namespace app\index\controller\admin;
use app\common\model\Config;
use app\index\controller\Base as AdminBase;
class Base extends AdminBase
{
protected function initialize()
{
parent::initialize();
if (!$this->user) {
$this->redirect(url('auth/login'));
}
if (!$this->user->is_admin) {
$this->redirect(url('/'));
}
}
protected function getConfigs($keys)
{
$data = Config::order('type', 'asc')->all();
$configs = [];
foreach ($data as $value) {
if (in_array($value->key, $keys)) {
$configs[$value->key][] = $value;
}
}
return $configs;
}
}

View File

@ -1,157 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2019-01-19
* Time: 11:59
* Link: https://github.com/wisp-x
*/
namespace app\index\controller\admin;
use app\common\model\Group as GroupModel;
use think\Db;
use think\Exception;
use think\facade\Config;
class Group extends Base
{
protected $strategyList;
protected function initialize()
{
parent::initialize();
$this->strategyList = Config::pull('strategy');
}
public function index()
{
$groups = GroupModel::select()->order('id', 'desc')->each(function ($item) {
$item->strategy_str = isset($this->strategyList[$item->strategy]) ? $this->strategyList[$item->strategy]['name'] : lang('Unknown');
return $item;
});
$this->assign([
'groups' => $groups,
'strategy_list' => $this->strategyList
]);
return $this->fetch();
}
public function add()
{
if ($this->request->isPost()) {
try {
$data = $this->request->post();
$validate = $this->validate($data, 'Group');
if (true !== $validate) {
throw new Exception($validate);
}
if (!GroupModel::create($data)) {
throw new Exception(lang('Add failed'));
}
} catch (Exception $e) {
$this->error($e->getMessage());
}
$this->success(lang('Added successfully'));
}
}
public function edit()
{
if ($this->request->isPost()) {
try {
$data = $this->request->post();
$validate = $this->validate($data, 'Group');
if (true !== $validate) {
throw new Exception($validate);
}
$data['default'] = array_key_exists('default', $data) ? 1 : 0;
if ($data['default'] === 0) {
if (!GroupModel::where('default', 1)->where('id', 'neq', $data['id'])->count()) {
throw new Exception(lang('Keep at least one default group'));
}
}
if (!GroupModel::update($data)) {
throw new Exception(lang('Edit failed'));
}
} catch (Exception $e) {
$this->error($e->getMessage());
}
$this->success(lang('Edit succeeded'));
}
}
public function del()
{
if ($this->request->isPost()) {
Db::startTrans();
try {
$id = $this->request->post('id');
if (1 == $id) {
throw new Exception(lang('The default group cannot be deleted'));
}
$group = GroupModel::find($id);
// 至少保留一个默认分组
$defaultId = GroupModel::where('default', 1)->where('id', 'neq', $id)->value('id');
if (!$defaultId) {
throw new Exception(lang('Keep at least one default group'));
}
// 转移该组下的用户到默认分组
\app\common\model\Users::where('group_id', $group->id)->setField('group_id', $defaultId);
$group->delete();
Db::commit();
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
$this->success(lang('Delete succeeded'));
}
}
public function getGroup()
{
if ($this->request->isPost()) {
$id = $this->request->post('id');
$this->success('success', null, GroupModel::find($id));
}
}
public function setDefault()
{
if ($this->request->isPost()) {
$id = $this->request->post('id');
$value = $this->request->post('value');
if (1 != $value) {
if (!GroupModel::where('default', 1)->where('id', 'neq', $id)->count()) {
$this->error(lang('Keep at least one default group'));
}
}
if (!GroupModel::update([
'id' => $id,
'default' => $value
])) {
$this->error(lang('Setting failed'));
}
$this->success(lang('Setting succeeded'));
}
}
public function setStrategy()
{
if ($this->request->isPost()) {
$id = $this->request->post('id');
$strategy = $this->request->post('strategy');
if (!array_key_exists($strategy, $this->strategyList)) {
$this->error(lang('Storage policy does not exist'));
}
if (!GroupModel::update([
'id' => $id,
'strategy' => $strategy
])) {
$this->error(lang('Setting failed'));
}
$this->success(lang('Setting succeeded'));
}
}
}

View File

@ -1,155 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/27
* Time: 上午10:29
* Link: https://github.com/wisp-x
*/
namespace app\index\controller\admin;
use app\common\model\Images as ImagesModel;
use app\common\model\Users;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use think\facade\Config;
use think\Db;
use think\Exception;
/**
* 图片管理
*
* Class Images
* @package app\index\controller\admin
*/
class Images extends Base
{
private $strategyList = [];
public function initialize()
{
parent::initialize();
$this->strategyList = Config::pull('strategy');
$this->assign('strategy_list', $this->strategyList);
}
public function index($strategy = '', $user_id = '', $suspicious = 0, $keyword = '', $limit = 30)
{
$model = new ImagesModel();
$model = $model->where('suspicious', $suspicious);
if ($strategy) {
$model = $model->where('strategy', $strategy);
}
if ($user_id) {
$model = $model->where('user_id', $user_id);
}
if (!empty($keyword)) {
$model = $model->where('pathname|alias_name|sha1|md5|ip', 'like', "%{$keyword}%");
}
$images = $model->order('id', 'desc')->paginate($limit, false, [
'query' => [
'strategy' => $strategy,
'keyword' => $keyword
]
])->each(function ($item) {
$username = Users::where('id', $item->user_id)->value('username');
$item->username = $username ? $username : lang('Visitor');
$item->strategyStr = isset($this->strategyList[$item->strategy]) ? $this->strategyList[$item->strategy]['name'] : lang('Unknown');
return $item;
});
$this->assign([
'images' => $images,
'keyword' => $keyword,
'strategyList' => $this->strategyList,
'strategy' => $strategy,
'suspicious' => $suspicious,
'user_id' => $user_id,
]);
return $this->fetch();
}
public function delete()
{
if ($this->request->isPost()) {
Db::startTrans();
try {
$id = $this->request->post('id');
$deletes = []; // 需要删除的文件
$images = ImagesModel::where('id', 'in', $id)->select();
foreach ($images as &$value) {
// 查找是否有相同 md5 的文件记录,有的话则只删除记录不删除文件
if (!$this->exists($value)) {
$deletes[$value->strategy][] = $value->pathname;
}
$value->delete();
unset($value);
}
// 是否开启软删除(开启了只删除记录,不删除文件)
if (!$this->getConfig('soft_delete')) {
$strategy = [];
// 实例化所有储存策略驱动
$strategyAll = array_keys($this->strategyList);
foreach ($strategyAll as $value) {
// 获取储存策略驱动
$strategy[$value] = $this->getStrategyInstance($value);
}
foreach ($deletes as $key => $val) {
if (1 === count($val)) {
if (!$strategy[$key]->delete(isset($val[0]) ? $val[0] : null)) {
// throw new Exception(lang('Deletion failed'));
}
} else {
if (!$strategy[$key]->deletes($val)) {
// throw new Exception(lang('Batch deletion failed'));
}
}
}
}
Db::commit();
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
$this->success(lang('Delete succeeded'));
}
}
/**
* 检测除本身图片以外的记录是否存在
*
* @param ImagesModel $image
* @return float|string
*/
private function exists(ImagesModel $image)
{
return ImagesModel::where('id', 'neq', $image->id)
->where('md5', $image->md5)
->where('sha1', $image->sha1)
->count();
}
public function getIpInfo()
{
if ($this->request->isPost()) {
try {
$data = null;
$ip = $this->request->post('ip');
$client = new Client();
$response = $client->get("https://ip.taobao.com/outGetIpInfo?ip={$ip}&accessKey=alibaba-inc");
if ($response->getStatusCode() == 200) {
$data = json_decode($response->getBody()->getContents(), true);
if (isset($data['code']) && $data['code'] == 0) {
$data = isset($data['data']) ? $data['data'] : null;
}
}
} catch (Exception $e) {
$this->error(lang('Acquisition failed'));
} catch (RequestException $e) {
$this->error(lang('The interface is abnormal, %s', [$e->getMessage()]));
}
$this->success(lang('Get success'), null, $data);
}
}
}

View File

@ -1,51 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/28
* Time: 下午4:25
* Link: https://github.com/wisp-x
*/
namespace app\index\controller\admin;
use think\Db;
use think\Exception;
use app\common\model\Config;
/**
* 储存策略
*
* Class Strategy
* @package app\index\controller\admin
*/
class Strategy extends Base
{
public function initialize()
{
parent::initialize();
$strategy = \think\facade\Config::pull('strategy');
$this->assign([
'configs' => parent::getConfigs(array_keys($strategy)),
'strategy' => $strategy
]);
}
public function index()
{
if ($this->request->isPost()) {
Db::startTrans();
try {
$data = $this->request->post();
foreach ($data as $key => $value) {
Config::where('name', $key)->setField('value', trim($value));
}
Db::commit();
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
$this->success(lang('Saved successfully'));
}
return $this->fetch();
}
}

View File

@ -1,217 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/27
* Time: 上午10:31
* Link: https://github.com/wisp-x
*/
namespace app\index\controller\admin;
use app\common\model\Config;
use think\Db;
use app\common\model\Images;
use think\Exception;
/**
* 系统设置
*
* Class System
* @package app\index\controller\admin
*/
class System extends Base
{
public function initialize()
{
parent::initialize();
$this->assign('configs', parent::getConfigs(['basics', 'upload', 'user', 'mail', 'audit', 'other']));
}
public function index()
{
if ($this->request->isPost()) {
Db::startTrans();
try {
$data = $this->request->post();
foreach ($data as $key => $value) {
Config::where('name', $key)->setField('value', $value);
}
Db::commit();
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
$this->success(lang('Saved successfully'));
}
// 命名规则
$naming = \think\facade\Config::pull('naming');
$this->assign('naming', $naming);
return $this->fetch();
}
public function console()
{
$storage = Images::sum('size');
$imagesCount = Images::count('*');
$suspiciousImagesCount = Images::where('suspicious', 1)->count();
$users_count = \app\common\model\Users::count('*');
$today = Images::whereTime('create_time', 'today')->count('*');
$yesterday = Images::whereTime('create_time', 'yesterday')->count('*');
$month = Images::whereTime('create_time', 'month')->count('*');
$tourists = Images::where('user_id', 0)->count();
$this->assign([
'storage' => format_size($storage, true), // 占用储存
'images_num' => $imagesCount, // 图片数量
'suspicious_images_num' => $suspiciousImagesCount, // 可疑图片
'users_num' => $users_count, // 用户数量
'today' => $today, // 今日上传
'yesterday' => $yesterday, // 昨日上传
'month' => $month, // 本月上传
'tourists' => $tourists, // 游客上传
]);
return $this->fetch();
}
public function testMail()
{
if ($this->request->isPost()) {
$email = $this->request->post('email');
$err = $this->sendMail($email, lang('Test'), lang('This is a test email!'));
if (true !== $err) {
$this->error($err);
}
$this->success(lang('Sent successfully'));
}
}
/**
* 更新系统
*/
public function upgrade()
{
$upgrade = null;
try {
if (!class_exists('ZipArchive')) {
throw new \Exception(lang('Cannot continue, please make sure ZipArrive is installed correctly'));
}
ignore_user_abort(true);
set_time_limit(0);
ini_set('max_execution_time', 0);
ini_set('memory_limit', '256M');
$upgrade = new \Upgrade(app()->getRootPath(), $this->getConfig('system_version'));
$release = $upgrade->release(); // 获取最新版
// 判断是否已经是最新版
if ($upgrade->check($release->version)) {
throw new \Exception(lang('The current system is the latest version'));
}
$upgradeFile = app()->getRuntimePath() . 'upgrade.zip';// 判断是否存在安装包
$file = file_exists($upgradeFile) ? $upgradeFile : $upgrade->download($release->url);
// 校验 MD5
if (strtolower(md5_file($file)) !== strtolower($release->md5)) {
throw new \Exception(lang('The installation package is corrupt. Please try again later'));
}
$dir = $upgrade->unzip($file, $upgrade->getWorkspace()); // 解压安装包到工作区目录
$path = rtrim($dir . strtolower($release->path), '/') . '/'; // 新版本程序解压后的根目录
$updateSql = $path . $release->sql; // 更新数据库结构 sql 文件路径
if (!$sql = @file_get_contents($updateSql)) {
throw new \Exception(lang('SQL file acquisition failed'));
}
// 创建安装锁文件
if (!@fopen($path . 'application/install.lock', 'w')) {
throw new \Exception(lang('Setup lock file creation failed'));
}
Db::startTrans();
// 检测新增表字段
if (!$tableFields = @include($path . 'config/table.php')) {
throw new \Exception(lang('Failed to get table field configuration file'));
}
foreach ($tableFields as $table => $fields) {
foreach ($fields as $field => $sql) {
$fetchFields = array_column(Db::query("DESCRIBE `{$table}`;"), 'Field');
if (!in_array($field, $fetchFields)) {
Db::execute($sql);
}
}
}
// 执行 sql 导入
if (is_file($path . $release->sql)) {
$lines = file($path . $release->sql);
$temp = '';
foreach ($lines as &$line) {
$line = trim($line);
if (substr($line, 0, 2) == '--' || $line == '' || substr($line, 0, 2) == '/*') continue;
$temp .= $line;
if (substr($line, -1, 1) == ';') {
Db::execute($temp);
$temp = '';
}
}
}
// 检测需要的删除文件或文件夹
foreach ($release->removes as $key => $items) {
foreach ($items as $item) {
$pathname = trim($upgrade->getRootPath(), '/') . '/' . trim($item, '/');
if ($key === 'folders') {
$upgrade->rmdir($pathname);
} else {
@unlink($pathname);
}
}
}
// 复制文件夹
$upgrade->copyDirs($path, $upgrade->getRootPath());
Db::commit();
} catch (\Exception $e) {
Db::rollback();
@$upgrade->rmdir($upgrade->getWorkspace());
$this->error($e->getMessage());
} catch (\PDOException $e) {
Db::rollback();
@$upgrade->rmdir($upgrade->getWorkspace());
$this->error($e->getMessage());
} catch (\HttpException $e) {
Db::rollback();
@$upgrade->rmdir($upgrade->getWorkspace());
$this->error($e->getMessage());
} catch (\Throwable $e) {
Db::rollback();
@$upgrade->rmdir($upgrade->getWorkspace());
$this->error($e->getMessage());
}
$this->success(lang('Upgrade Complete'));
}
/**
* 备份系统
*/
public function backup()
{
$backup = 'backups/' . date('YmdHis') . '.zip';
try {
$upgrade = new \Upgrade(app()->getRootPath(), $this->getConfig('system_version'));
$upgrade->backup($backup);
} catch (\Exception $e) {
$this->error($e->getMessage());
} catch (\PDOException $e) {
$this->error($e->getMessage());
} catch (\HttpException $e) {
$this->error($e->getMessage());
} catch (\Throwable $e) {
$this->error($e->getMessage());
}
$this->success(lang('Backup complete, %s', [$backup]));
}
}

View File

@ -1,151 +0,0 @@
<?php
/**
* User: Wisp X
* Date: 2018/9/27
* Time: 上午10:23
* Link: https://github.com/wisp-x
*/
namespace app\index\controller\admin;
use app\common\model\Users as UsersModel;
use think\Exception;
/**
* 用户管理
*
* Class Users
* @package app\index\controller\admin
*/
class Users extends Base
{
public function index($state = '', $keyword = '', $limit = 15)
{
$model = new UsersModel();
if (!empty($state)) {
$model = $model->where('state', $state);
}
if (!empty($keyword)) {
$model = $model->where('username|nickname|email', 'like', "%{$keyword}%");
}
$users = $model->order('id', 'desc')->paginate($limit, false, [
'query' => [
'state' => $state,
'keyword' => $keyword
]
]);
$this->assign([
'users' => $users,
'state' => $state,
'keyword' => $keyword,
'groups' => \app\common\model\Group::select()
]);
return $this->fetch();
}
public function delete()
{
if ($this->request->isPost()) {
$id = $this->request->post('id');
if (is_array($id)) {
if (in_array($this->user->id, $id)) {
$this->error(lang('You cannot delete your account!'));
}
} else {
if ($id == $this->user->id) {
$this->error(lang('You cannot delete your account!'));
}
}
if (!UsersModel::destroy($id)) {
$this->error(lang('Deletion failed'));
}
$this->success(lang('Delete succeeded'));
}
}
public function frozen()
{
if ($this->request->isPost()) {
$id = $this->request->post('id');
if (is_array($id)) {
if (in_array($this->user->id, $id)) {
$this->error(lang('You can\'t freeze your account!'));
}
} else {
if ($id == $this->user->id) {
$this->error(lang('You can\'t freeze your account!'));
}
}
$model = new UsersModel();
if (!$model->where('id', 'in', $id)->update(['state' => 0])) {
$this->error(lang('Freeze failed'));
}
$this->success(lang('Freeze succeeded'));
}
}
public function getUser()
{
if ($this->request->isPost()) {
$id = $this->request->post('id');
if (!$user = UsersModel::get($id)) {
$this->error(lang('Data acquisition failed'));
}
unset($user->password);
$this->success(lang('Success'), null, $user);
}
}
public function edit()
{
if ($this->request->isPost()) {
try {
$data = $this->request->post();
$validate = $this->validate($data, 'Users.AdminEdit');
if (true !== $validate) {
throw new Exception($validate);
}
if (!$data['password']) unset($data['password'], $data['password_confirm']);
if (!UsersModel::update($data)) {
throw new Exception(lang('Modification failed'));
}
} catch (Exception $e) {
$this->error($e->getMessage());
}
$this->success(lang('Saved successfully'));
}
}
public function setState()
{
if ($this->request->isPost()) {
$id = $this->request->post('id');
$state = $this->request->post('state');
if (!$user = UsersModel::get($id)) {
$this->error(lang('Data acquisition failed'));
}
if ($user->id === $this->user->id) {
$this->error(lang('You cannot modify your status'));
}
if (!$user->where('id', $id)->setField('state', $state)) {
$this->error(lang('Status modification failed'));
}
$this->success(lang('Status modification succeeded'));
}
}
public function setGroup()
{
if ($this->request->isPost()) {
$id = $this->request->post('id');
$groupId = $this->request->post('group_id');
if (!$group = \app\common\model\Group::find($groupId)) {
$this->error('Data acquisition failed');
}
if (!UsersModel::where('id', $id)->setField('group_id', $groupId)) {
$this->error(lang('Modification failed'));
}
$this->success(lang('Modified successfully'));
}
}
}

View File

@ -1,18 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 中间件配置
// +----------------------------------------------------------------------
return [
app\http\middleware\Initialize::class,
app\http\middleware\WebAuthenticate::class
];

View File

@ -1,210 +0,0 @@
{extend name="common:base" /}
{block name="title"}{:lang('Role group')} - {$config.site_name}{/block}
{block name="main"}
<div class="mdui-container">
<main>
<div class="mdui-m-t-2 mdui-m-b-2">
<div class="mdui-typo">
<blockquote>
<p>{:lang('Role group tips')}</p>
</blockquote>
</div>
<div class="mdui-btn-group mdui-m-a-1">
</div>
<div class="mdui-table-fluid">
<table class="mdui-table mdui-table-selectable">
<thead>
<tr>
<th>{:lang('Strategy used')}</th>
<th>{:lang('Name')}</th>
<th>{:lang('Register default')}</th>
<th>{:lang('Operation')}</th>
</tr>
</thead>
<tbody>
{foreach $groups as $value}
<tr data-id="{$value.id}">
<td>
<select class="mdui-select strategy">
{foreach $strategy_list as $strategy => $val}
<option value="{$strategy}" {if $value.strategy eq $strategy} selected{/if}>{:lang($val.name)}</option>
{/foreach}
</select>
</td>
<td>{$value.name}</td>
<td>
<label class="mdui-switch">
<input type="checkbox" class="default" {if $value.default eq 1}checked{/if}/>
<i class="mdui-switch-icon"></i>
</label>
</td>
<td>
<div class="mdui-btn-group">
<button class="mdui-btn mdui-btn-raised mdui-btn-dense edit">{:lang('Edit')}</button>
<button class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-red mdui-btn-dense del">{:lang('Delete')}</button>
</div>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</main>
<div class="mdui-dialog" id="add-dialog">
<div class="mdui-dialog-content">
<form action="{:url('admin/group/edit')}" method="post">
<div class="mdui-dialog-title">{:lang('Add role group')}</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Group name')}</label>
<input class="mdui-textfield-input" type="text" name="name" value="" placeholder="{:lang('Group name')}" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Strategy used')}</label>
<select class="mdui-select" name="strategy">
{foreach $strategy_list as $strategy => $val}
<option value="{$strategy}">{:lang($val.name)}</option>
{/foreach}
</select>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Is default')}</label>
<label class="mdui-switch">
<input type="checkbox" name="default" value="1"/>
<i class="mdui-switch-icon"></i>
</label>
</div>
<div class="mdui-dialog-actions">
<button type="button" class="mdui-btn mdui-ripple" mdui-dialog-cancel>{:lang('Cancel')}</button>
<button class="mdui-btn mdui-ripple">{:lang('Confirm')}</button>
</div>
</form>
</div>
</div>
<div class="mdui-dialog" id="edit-dialog">
<div class="mdui-dialog-content">
<form action="{:url('admin/group/edit')}" method="post">
<div class="mdui-dialog-title">{:lang('Edit role group')}</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Group name')}</label>
<input class="mdui-textfield-input" type="text" name="name" value="" placeholder="{:lang('Group name')}" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Strategy used')}</label>
<select class="mdui-select" name="strategy">
{foreach $strategy_list as $strategy => $val}
<option value="{$strategy}">{:lang($val.name)}</option>
{/foreach}
</select>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Is default')}</label>
<label class="mdui-switch">
<input type="checkbox" name="default" value="1"/>
<i class="mdui-switch-icon"></i>
</label>
</div>
<input type="hidden" name="id" value="">
<div class="mdui-dialog-actions">
<button type="button" class="mdui-btn mdui-ripple" mdui-dialog-cancel>{:lang('Cancel')}</button>
<button class="mdui-btn mdui-ripple">{:lang('Modify')}</button>
</div>
</form>
</div>
</div>
</div>
<div class="mdui-fab-wrapper" id="fab-buttons">
<button class="mdui-fab mdui-ripple mdui-color-purple" mdui-dialog="{target: '#add-dialog'}">
<i class="mdui-icon material-icons">add</i>
</button>
</div>
{/block}
{block name="js"}
<script>
$(function () {
var editDialog = new mdui.Dialog('#edit-dialog');
var methods = {
delete: function (id, batch, callback) {
var msg = lang('Are you sure to delete this role group?');
if (batch) {
msg = lang('Are you sure to delete the selected item role group?');
}
mdui.confirm(msg, function () {
app.request("{:url('admin/group/del')}", {id: id}, function () {
callback && callback();
});
}, function () {
}, {confirmText: lang('Confirm'), cancelText: lang('Cancel')});
},
};
// 编辑提交
$('#edit-dialog form').submit(function (e) {
e.preventDefault();
app.request("{:url('admin/group/edit')}", $(this).serialize(), function () {
editDialog.close();
history.go(0);
});
});
// 添加角色组
$('#add-dialog form').submit(function (e) {
e.preventDefault();
app.request("{:url('admin/group/add')}", $(this).serialize(), function () {
history.go(0);
});
});
// 更改储存策略
$('td select.strategy').change(function () {
var tr = $(this).closest('tr');
app.request("{:url('admin/group/setStrategy')}", {id: tr.data('id'), strategy: $(this).val()});
});
// 状态切换
$('td .default').change(function () {
var tr = $(this).closest('tr');
app.request("{:url('admin/group/setDefault')}", {id: tr.data('id'), value: this.checked ? 1 : 0}, function () {
$('td .default').attr('checked', false);
mdui.mutation('checkbox');
}, function () {
history.go(0);
});
});
// 编辑
$('td button.edit').click(function () {
var tr = $(this).closest('tr');
app.ajax("{:url('admin/group/getGroup')}", {id: tr.data('id')}, function (response) {
if (response.code) {
var form = $("#edit-dialog form");
for (x in response.data) {
var input = form.find("input[name='" + x + "']");
if (input.length) {
input.val(response.data[x]);
}
if (x === 'strategy') {
form.find("[name='strategy'] option[value='" + response.data[x] + "']").attr("selected", true);
}
if (x === 'default') {
form.find("[name='default']").attr('checked', 1 === response.data[x]);
mdui.mutation('checkbox');
}
}
editDialog.open();
} else {
mdui.snackbar({
message: response.msg
});
}
});
});
// 删除
$('td button.del').click(function () {
var tr = $(this).closest('tr');
methods.delete(tr.data('id'), false, function () {
tr.remove();
});
});
});
</script>
{/block}

View File

@ -1,173 +0,0 @@
{extend name="common:base" /}
{block name="title"}{:lang('Picture management')} - {$config.site_name}{/block}
{block name="css"}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/viewerjs@1.5.0/dist/viewer.min.css">
{/block}
{block name="main"}
<div class="mdui-container">
<main>
<div class="mdui-chip">
<span class="mdui-chip-icon"><i class="mdui-icon material-icons">&#xe88e;</i></span>
<span class="mdui-chip-title">{:lang('There are %s pictures in total', ['<small class="mdui-text-color-red">'.$images->total().'</small>'])}</span>
<a href="" class="mdui-chip-delete" mdui-tooltip="{content: '{:lang('Refresh')}', position: 'right'}"><i class="mdui-icon material-icons">&#xe863;</i></a>
</div>
<div class="mdui-clearfix mdui-m-t-1"></div>
<form action="" method="get" id="search-form">
<select class="where mdui-select mdui-float-left" mdui-select>
<option value="{}">{:lang('All')}</option>
{foreach $strategyList as $key => $value}
<option value='{"strategy": "{$key}"}' {if $key eq $strategy}selected{/if}>{:lang($value.name)}</option>
{/foreach}
<option value='{"user_id": "0"}' {eq name="user_id" value="0"} selected{/eq}>{:lang('Visitor picture')}</option>
<option value='{"suspicious": "1"}' {eq name="suspicious" value="1"} selected{/eq}>{:lang('Suspicious picture')}</option>
</select>
<input type="hidden" name="" id="search-input">
<input type="hidden" name="page" value="1">
<input class="mdui-textfield-input search-input mdui-float-left" type="text" name="keyword" placeholder="{:lang('Enter search...')}" value="{$keyword}" autocomplete="off"/>
</form>
<div class="mdui-clearfix"></div>
<div class="mdui-table-fluid mdui-m-t-2 mdui-m-b-2">
<table class="mdui-table mdui-table-selectable">
<thead>
<tr>
<th>{:lang('User')}</th>
<th>{:lang('Storage strategy')}</th>
<th>{:lang('Alias')}</th>
<th>{:lang('Route')}</th>
<th>{:lang('Size')}</th>
<th>{:lang('Type')}</th>
<th>{:lang('Upload IP')}</th>
<th>{:lang('Upload time')}</th>
<th>{:lang('Operation')}</th>
</tr>
</thead>
<tbody>
{foreach $images as $key => $value}
<tr data-id="{$value.id}">
<td>{$value.username}</td>
<td>{:lang($value.strategyStr)}</td>
<td>{$value.alias_name ?: '-'}</td>
<td>{$value.pathname}</td>
<td class="mdui-text-color-light-blue">{$value.size|format_size}</td>
<td>{$value.mime}</td>
<td class="get-city" style="cursor: pointer;">{$value.ip}</td>
<td title="{$value.create_time}">{$value.date}</td>
<td>
<img class="none" data-original="{$value.url}" src="{$value.url}">
<div class="mdui-btn-group">
<button class="mdui-btn mdui-btn-raised mdui-ripple mdui-btn-dense see" data-key="{$key}">{:lang('See')}</button>
<button class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-red mdui-btn-dense del">{:lang('Delete')}</button>
</div>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
<div class="page">
{$images|raw}
</div>
</main>
</div>
<div class="mdui-fab-wrapper" id="fab-buttons">
<button class="mdui-fab mdui-ripple mdui-color-red mdui-fab-hide" id="multi-delete" onclick="remove()">
<i class="mdui-icon material-icons">&#xe872;</i>
</button>
</div>
{/block}
{block name="js"}
<script src="https://cdn.jsdelivr.net/npm/viewerjs@1.5.0/dist/viewer.min.js"></script>
<script src="/static/jquery-viewer/1.2.0/js/jquery-viewer.js"></script>
<script>
var methods = {
delete: function (id, batch, callback) {
var msg = lang('Are you sure to delete this picture?');
if (batch) {
msg = lang('Are you sure to delete the selected picture?');
}
mdui.confirm(msg, function () {
app.request("{:url('admin/images/delete')}", {id: id}, function () {
callback && callback();
});
}, function () {
}, {confirmText: lang('Confirm'), cancelText: lang('Cancel')});
}
};
function remove() {
var selected = $('tr.mdui-table-row-selected');
var array = [];
if (selected.length) {
selected.each(function (index, value) {
array.push($(value).data('id'));
});
methods.delete(array, true, function () {
selected.remove();
});
} else {
mdui.snackbar({
message: lang('Select at least one data!')
});
}
}
$(function () {
var viewer = $('tbody').viewer({
url: 'data-original',
zIndex: 999999999
});
$('.mdui-select.where').on('close.mdui.select', function () {
var params = JSON.parse($(this).find('option:selected').val());
var name, value;
for (var key in params) {
name = key;
value = params[name];
}
$('#search-input').attr('name', name).val(value)
$('#search-form').submit();
});
// 多选操作
$('.mdui-checkbox input').change(function () {
var selected = $('tr.mdui-table-row-selected');
$('#multi-delete')[selected.length > 0 ? 'removeClass' : 'addClass']('mdui-fab-hide');
});
// 查看图片
$('td button.see').click(function () {
viewer.data('viewer').view($(this).data('key'))
});
// 删除
$('td button.del').click(function () {
var tr = $(this).closest('tr');
methods.delete(tr.data('id'), false, function () {
tr.remove();
});
});
// 根据ip获取城市
$('td.get-city').click(function () {
app.ajax("{:url('admin/images/getIpInfo')}", {ip: $(this).text()}, function (response) {
if (response.code) {
mdui.alert(
lang('Country:') + response.data.country +
'<br />' + lang('Region:') + response.data.area +
'<br />' + lang('Area:') + response.data.region +
'<br />' + lang('City:') + response.data.city +
'<br />' + lang('County:') + response.data.county +
'<br />ISP' + response.data.isp
, 'IP' + response.data.ip
);
} else {
mdui.snackbar({
message: response.msg
});
}
});
});
})
</script>
{/block}

View File

@ -1,70 +0,0 @@
{extend name="common:base" /}
{block name="title"}{:lang('Storage strategy')} - {$config.site_name}{/block}
{block name="main"}
<div class="mdui-container mdui-p-b-5">
<main>
<div class="strategy-container">
<div class="mdui-typo">
<blockquote class="mdui-m-l-0">
<p>{:lang('Storage strategy tips')}</p>
</blockquote>
</div>
<div id="tab" class="mdui-tab mdui-tab-scrollable" mdui-tab>
{foreach $strategy as $key => $value}
<a href="#tab-{$key}" class="mdui-ripple {if $key eq $config.storage_strategy}mdui-tab-active{/if}">{:lang($value.name)}</a>
{/foreach}
</div>
<div class="mdui-col-sm-8 mdui-col-md-8">
{foreach $configs as $key => $value}
<div id="tab-{$key}" class="{if $key neq $config.storage_strategy}none{/if}">
<form action="{:url('admin/strategy/index')}" method="post">
{foreach $value as $val}
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang($val.title)}{$val.tip ? '(' . lang($val.tip) . ')' : ''}</label>
{switch $val.type}
{case text}
<input class="mdui-textfield-input" type="{$val.input_type}" name="{$val.name}" value="{$val.value}" autocomplete="off" placeholder="{:lang($val.title)}"/>
{/case}
{case bool}
<label class="mdui-switch">
<input type="{$val.input_type}" data-name="{$val.name}" value="1" {if 1 eq $val.value}checked{/if}/>
<i class="mdui-switch-icon"></i>
</label>
{/case}
{case select}
<select name="{$val.name}" class="mdui-select">
{foreach $val.extend as $k => $v}
<option value="{$k}" {if $k eq $val.value}selected{/if}>{$v}</option>
{/foreach}
</select>
{/case}
{/switch}
</div>
{/foreach}
<input type="hidden" name="storage_strategy" value="{$key}">
<button type="submit" class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme-accent">{:lang('Save')}</button>
<button type="reset" class="mdui-btn mdui-btn-raised mdui-ripple">{:lang('Reset')}</button>
</form>
</div>
{/foreach}
</div>
</div>
</main>
</div>
{/block}
{block name="js"}
<script>
$(function () {
$('form').submit(function (e) {
e.preventDefault();
var data = $(this).serialize();
$(this).find("input[type='checkbox']").each(function (key, value) {
data += ("&" + $(value).data('name') + "=") + (value.checked ? value.value : 0);
});
app.request(this.action, data);
})
});
</script>
{/block}

View File

@ -1,116 +0,0 @@
{extend name="common:base" /}
{block name="title"}{:lang('Console')} - {$config.site_name}{/block}
{block name="main"}
<div class="mdui-container">
<main>
<div class="console-container">
<div class="mdui-row-sm-4 mdui-row-md-4 mdui-row-lg-4 mdui-row-xl-4">
<div class="mdui-col item mdui-m-b-2">
<div class="mdui-color-teal mdui-text-center mdui-text-color-white mdui-p-a-2 mdui-shadow-4 mdui-hoverable">
<i class="mdui-icon material-icons">&#xe623;</i>
<p>{:lang('Occupied storage')}</p>
<span class="mdui-text-color-white">{$storage[0]}
<small class="mdui-text-color-white">{if $storage[0]}{$storage[1]}{else/}Kb{/if}</small>
</span>
</div>
</div>
<div class="mdui-col item mdui-m-b-2">
<div class="mdui-color-cyan mdui-text-center mdui-text-color-white mdui-p-a-2 mdui-shadow-4 mdui-hoverable">
<p><i class="mdui-icon material-icons">&#xe3b6;</i> {:lang('Number of pictures')}</p>
<span class="mdui-text-color-white">{$images_num} <small class="mdui-text-color-white">{:lang('Piece')}</small></span>
</div>
</div>
<div class="mdui-col item mdui-m-b-2">
<div class="mdui-color-orange mdui-text-center mdui-text-color-white mdui-p-a-2 mdui-shadow-4 mdui-hoverable">
<p><i class="mdui-icon material-icons">&#xe8fd;</i> {:lang('Suspicious picture')}</p>
<span class="mdui-text-color-white">{$suspicious_images_num} <small class="mdui-text-color-white">{:lang('Piece')}</small></span>
</div>
</div>
<div class="mdui-col item mdui-m-b-2">
<div class="mdui-color-deep-purple mdui-text-center mdui-text-color-white mdui-p-a-2 mdui-shadow-4 mdui-hoverable">
<p><i class="mdui-icon material-icons">&#xe8d3;</i> {:lang('Number of users')}</p>
<span class="mdui-text-color-white">{$users_num} <small class="mdui-text-color-white">{:lang('Piece')}</small></span>
</div>
</div>
<div class="mdui-col item mdui-m-b-2">
<div class="mdui-color-red-accent mdui-text-center mdui-text-color-white mdui-p-a-2 mdui-shadow-4 mdui-hoverable">
<p><i class="mdui-icon material-icons">&#xe2c3;</i> {:lang('Upload today')}</p>
<span class="mdui-text-color-white">{$today} <small class="mdui-text-color-white">{:lang('Piece')}</small></span>
</div>
</div>
<div class="mdui-col item mdui-m-b-2">
<div class="mdui-color-indigo-accent mdui-text-center mdui-text-color-white mdui-p-a-2 mdui-shadow-4 mdui-hoverable">
<p><i class="mdui-icon material-icons">&#xe2c3;</i> {:lang('Uploaded yesterday')}</p>
<span class="mdui-text-color-white">{$yesterday} <small class="mdui-text-color-white">{:lang('Piece')}</small></span>
</div>
</div>
<div class="mdui-col item mdui-m-b-2">
<div class="mdui-color-brown mdui-text-center mdui-text-color-white mdui-p-a-2 mdui-shadow-4 mdui-hoverable">
<p><i class="mdui-icon material-icons">&#xe2c3;</i> {:lang('Upload this month')}</p>
<span class="mdui-text-color-white">{$month} <small class="mdui-text-color-white">{:lang('Piece')}</small></span>
</div>
</div>
<div class="mdui-col item mdui-m-b-2">
<div class="mdui-color-blue-grey mdui-text-center mdui-text-color-white mdui-p-a-2 mdui-shadow-4 mdui-hoverable">
<p><i class="mdui-icon material-icons">&#xe2c3;</i> {:lang('Visitor upload')}</p>
<span class="mdui-text-color-white">{$tourists} <small class="mdui-text-color-white">{:lang('Piece')}</small></span>
</div>
</div>
</div>
<div class="mdui-table-fluid">
<table class="mdui-table">
<tbody>
<tr>
<th colspan="15">{:lang('System configuration')}</th>
</tr>
<tr>
<td>{:lang('Operating system')}</td>
<td>{:php_uname('s')}</td>
<td>{:lang('Server IP:')}</td>
<td>{:GetHostByName($Think.server.http_host)}</td>
<td>{:lang('Website domain name:')}</td>
<td>{$Think.server.http_host}</td>
</tr>
<tr>
<td>{:lang('Operating environment:')}</td>
<td>{$Think.server.server_software}</td>
<td>{:lang('PHP version:')}</td>
<td>{$Think.PHP_VERSION}</td>
<td>{:lang('File upload restrictions:')}</td>
<td>{:ini_get('upload_max_filesize')}</td>
</tr>
</tbody>
</table>
</div>
<div class="mdui-table-fluid mdui-m-t-1">
<table class="mdui-table">
<tbody>
<tr>
<th colspan="15">{:lang('Software information')}</th>
</tr>
<tr>
<td>{:lang('Software version:')}</td>
<td>v{$config.system_version}</td>
</tr>
<tr>
<td>{:lang('User manual:')}</td>
<td><a href="https://www.kancloud.cn/wispx/lsky-pro/content" target="_blank">https://www.kancloud.cn/wispx/lsky-pro/content</a></td>
</tr>
<tr>
<td>{:lang('Warehouse address:')}</td>
<td><a href="https://github.com/wisp-x/lsky-pro" target="_blank">https://github.com/wisp-x/lsky-pro</a></td>
</tr>
<tr>
<td>{:lang('Contact author:')}</td>
<td><a href="mailto:i@wispx.cn">i@wispx.cn</a></td>
</tr>
</tbody>
</table>
</div>
</div>
</main>
</div>
{/block}

View File

@ -1,145 +0,0 @@
{extend name="common:base" /}
{block name="title"}{:lang('System management')} - {$config.site_name}{/block}
{block name="main"}
<div class="mdui-container">
<main>
<div class="system-container">
<div class="mdui-typo">
<blockquote class="mdui-m-l-0">
<p>
{:lang('System management tips')}
</p>
</blockquote>
</div>
<div class="mdui-tab mdui-tab-scrollable" mdui-tab>
<a href="#tab-basics" class="mdui-ripple">{:lang('Basic configuration')}</a>
<a href="#tab-upload" class="mdui-ripple">{:lang('Upload configuration')}</a>
<a href="#tab-user" class="mdui-ripple">{:lang('User configuration')}</a>
<a href="#tab-mail" class="mdui-ripple">{:lang('Mail configuration')}</a>
<a href="#tab-other" class="mdui-ripple">{:lang('Other configuration')}</a>
<a href="#tab-audit" class="mdui-ripple">{:lang('Picture identification yellow')}</a>
</div>
<div class="tabs mdui-col-sm-8 mdui-col-md-8">
{foreach $configs as $key => $value}
<div id="tab-{$key}" class="mdui-p-a-2" style="display: none;">
<form action="{:url('admin/system/index')}" method="post">
{foreach $value as $val}
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang($val.title)}{$val.tip ? '(' . lang($val.tip) . ')' : ''}</label>
{switch $val.type}
{case text}
<input class="mdui-textfield-input" type="{$val.input_type}" name="{$val.name}" value="{$val.value}" autocomplete="off" placeholder="{:lang($val.title)}"/>
{/case}
{case textarea}
<textarea class="mdui-textfield-input" rows="6" name="{$val.name}" autocomplete="off" placeholder="{:lang($val.title)}">{$val.value}</textarea>
{/case}
{case bool}
<label class="mdui-switch">
<input type="{$val.input_type}" data-name="{$val.name}" value="1" {if 1 eq $val.value}checked{/if}/>
<i class="mdui-switch-icon"></i>
</label>
{/case}
{case select}
<select name="{$val.name}" class="mdui-select" mdui-select>
{foreach $val.extend as $k => $v}
<option value="{$k}" {if $k eq $val.value}selected{/if}>{:lang($v)}</option>
{/foreach}
</select>
{/case}
{/switch}
</div>
{/foreach}
<button type="submit" class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme-accent">{:lang('Save')}</button>
<button type="reset" class="mdui-btn mdui-btn-raised mdui-ripple">{:lang('Reset')}</button>
{if 'mail' eq $key}
<!-- 测试邮件发送 -->
<button type="button" id="test-send-mail" class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-cyan-600 mdui-text-color-white">{:lang('Test mail sending')}</button>
{/if}
</form>
</div>
{/foreach}
</div>
</div>
</main>
<div class="mdui-dialog" id="path-var">
<div class="mdui-dialog-content mdui-p-a-0">
<div class="mdui-table-fluid">
<table class="mdui-table mdui-table-hoverable">
<thead>
<tr>
<th>{:lang('Variable name')}</th>
<th>{:lang('Example')}</th>
<th>{:lang('Explain')}</th>
</tr>
</thead>
<tbody>
{foreach $naming.path as $value}
<tr>
<td>{$value.name}</td>
<td>{:lang($value.example)}</td>
<td>{:lang($value.explain)}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
<div class="mdui-dialog" id="file-var">
<div class="mdui-dialog-content mdui-p-a-0">
<div class="mdui-table-fluid">
<table class="mdui-table mdui-table-hoverable">
<thead>
<tr>
<th>{:lang('Variable name')}</th>
<th>{:lang('Example')}</th>
<th>{:lang('Explain')}</th>
</tr>
</thead>
<tbody>
{foreach $naming.file as $value}
<tr>
<td>{$value.name}</td>
<td>{:lang($value.example)}</td>
<td>{:lang($value.explain)}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
$(function () {
$('form').submit(function (e) {
e.preventDefault();
var data = $(this).serialize();
$(this).find("input[type='checkbox']").each(function (key, value) {
data += ("&" + $(value).data('name') + "=") + (value.checked ? value.value : 0);
});
app.request(this.action, data)
});
$('#test-send-mail').click(function () {
mdui.prompt(lang('Please input mailbox'),
function (value) {
app.request("{:url('admin/system/testMail')}", {email: value});
},
function (value) {
},
{
confirmText: lang('Confirm'),
cancelText: lang('Cancel')
}
);
});
});
</script>
{/block}

View File

@ -1,247 +0,0 @@
{extend name="common:base" /}
{block name="title"}{:lang('User management')} - {$config.site_name}{/block}
{block name="main"}
<div class="mdui-container">
<main>
<div class="mdui-chip">
<span class="mdui-chip-icon"><i class="mdui-icon material-icons">&#xe88e;</i></span>
<span class="mdui-chip-title">{:lang('There are %s users in total', ['<small class="mdui-text-color-red">'.$users->total().'</small>'])}</span>
<a href="" class="mdui-chip-delete" mdui-tooltip="{content: '{:lang('Refresh')}', position: 'right'}"><i class="mdui-icon material-icons">&#xe863;</i></a>
</div>
<div class="mdui-clearfix mdui-m-t-1"></div>
<form action="" method="post" id="search-form">
<select class="where mdui-select mdui-float-left" name="state" mdui-select>
<option value="">{:lang('All')}</option>
<option value="1" {if 1 eq $state}selected{/if}>{:lang('Normal')}</option>
<option value="2" {if 2 eq $state}selected{/if}>{:lang('Frozen')}</option>
</select>
<input type="hidden" name="page" value="1">
<input class="mdui-textfield-input search-input mdui-float-left" type="text" name="keyword" placeholder="{:lang('Enter search...')}" value="{$keyword}" autocomplete="off"/>
</form>
<div class="mdui-clearfix"></div>
<div class="mdui-table-fluid mdui-m-t-2 mdui-m-b-2">
<table class="mdui-table mdui-table-selectable">
<thead>
<tr>
<th>{:lang('User name')}</th>
<th>{:lang('Role group')}</th>
<th>{:lang('Nickname')}</th>
<th>{:lang('Mailbox')}</th>
<th>{:lang('Used capacity')}</th>
<th>{:lang('Total capacity')}</th>
<th>{:lang('Account status')}</th>
<th>{:lang('Register IP')}</th>
<th>{:lang('Create time')}</th>
<th>{:lang('Operation')}</th>
</tr>
</thead>
<tbody>
{foreach $users as $value}
<tr data-id="{$value.id}">
<td>{$value.username}</td>
<td>
<select class="mdui-select group">
{foreach $groups as $group}
<option value="{$group.id}" {if $value.group_id eq $group.id}selected{/if}>{:lang($group.name)}</option>
{/foreach}
</select>
</td>
<td>{$value.nickname}</td>
<td>{$value.email}</td>
<td>{$value.use_quota|format_size}</td>
<td>{$value.quota|format_size}</td>
<td>
<select class="mdui-select state">
<option value="1" {if 1 eq $value.state}selected{/if}>{:lang('Normal')}</option>
<option value="0" {if 0 eq $value.state}selected{/if}>{:lang('Frozen')}</option>
</select>
</td>
<td>{$value.reg_ip}</td>
<td>{$value.create_time}</td>
<td>
<div class="mdui-btn-group">
<button class="mdui-btn mdui-btn-raised mdui-btn-dense edit">{:lang('Edit')}</button>
<button class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-red mdui-btn-dense del">{:lang('Delete')}</button>
</div>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
<div class="page">
{$users|raw}
</div>
</main>
<div class="mdui-dialog" id="edit-dialog">
<div class="mdui-dialog-content">
<form action="{:url('admin/users/edit')}" method="post">
<div class="mdui-dialog-title">{:lang('Modify user data')}</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('User name')}</label>
<input class="mdui-textfield-input" type="text" name="username" value="" placeholder="{:lang('User name')}" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Mailbox')}</label>
<input class="mdui-textfield-input" type="email" name="email" value="" placeholder="{:lang('Mailbox')}" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Nickname')}</label>
<input class="mdui-textfield-input" type="text" name="nickname" value="" maxlength="15" placeholder="{:lang('Nickname')}" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Storage capacity')}</label>
<input class="mdui-textfield-input" type="text" name="quota" value="" placeholder="{:lang('Storage capacity')}" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Used storage capacity')}</label>
<input class="mdui-textfield-input" type="text" name="use_quota" value="" placeholder="{:lang('Used storage capacity')}" autocomplete="off" disabled/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Password')}</label>
<input class="mdui-textfield-input" type="password" name="password" placeholder="{:lang('Password tip')}" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Confirm password')}</label>
<input class="mdui-textfield-input" type="password" name="password_confirm" placeholder="{:lang('Confirm password')}" autocomplete="off"/>
</div>
<input type="hidden" name="id" value="">
<div class="mdui-dialog-actions">
<button type="button" class="mdui-btn mdui-ripple" mdui-dialog-cancel>{:lang('Cancel')}</button>
<button class="mdui-btn mdui-ripple">{:lang('Modify')}</button>
</div>
</form>
</div>
</div>
</div>
<div class="mdui-fab-wrapper" id="fab-buttons" mdui-fab="{trigger: 'hover'}">
<button class="mdui-fab mdui-ripple mdui-color-purple mdui-fab-hide" id="settings-btn">
<i class="mdui-icon material-icons">&#xe8b8;</i>
<i class="mdui-icon mdui-fab-opened material-icons">&#xe8b8;</i>
</button>
<div class="mdui-fab-dial">
<button class="mdui-fab mdui-fab-mini mdui-ripple mdui-color-orange" onclick="settings('frozen')">
<i class="mdui-icon material-icons">&#xe14b;</i>
</button>
<button class="mdui-fab mdui-fab-mini mdui-ripple mdui-color-red" onclick="settings('delete')">
<i class="mdui-icon material-icons">&#xe872;</i>
</button>
</div>
</div>
{/block}
{block name="js"}
<script>
var methods = {
delete: function (id, batch, callback) {
var msg = lang('Are you sure to delete this user?');
if (batch) {
msg = lang('Are you sure to delete the selected user?');
}
mdui.confirm(msg, function () {
app.request("{:url('admin/users/delete')}", {id: id}, function () {
callback && callback();
});
}, function () {
}, {confirmText: lang('Confirm'), cancelText: lang('Cancel')});
},
frozen: function (id, batch, callback) {
var msg = lang('Are you sure to freeze this user?');
if (batch) {
msg = lang('Are you sure to freeze the selected users?');
}
mdui.confirm(msg, function () {
app.request("{:url('admin/users/frozen')}", {id: id}, function () {
callback && callback();
});
}, function () {
}, {confirmText: lang('Confirm'), cancelText: lang('Cancel')});
}
};
function settings(val) {
var array = [];
var selected = $('tr.mdui-table-row-selected');
if (selected.length) {
selected.each(function (index, value) {
array.push($(value).data('id'));
});
if ('frozen' === val) {
methods.frozen(array, true, function () {
history.go(0);
})
} else if ('delete' === val) {
methods.delete(array, true, function () {
selected.remove();
});
}
} else {
mdui.snackbar({
message: lang('Select at least one data!')
});
}
}
$(function () {
var dialog = new mdui.Dialog('#edit-dialog');
$('.mdui-select.where').on('close.mdui.select', function () {
$('#search-form').submit();
});
$('td select.group').change(function () {
var tr = $(this).closest('tr');
app.request("{:url('admin/users/setGroup')}", {id: tr.data('id'), group_id: $(this).val()});
});
// 多选操作
$('.mdui-checkbox input').change(function () {
var selected = $('tr.mdui-table-row-selected');
$('#settings-btn')[selected.length > 0 ? 'removeClass' : 'addClass']('mdui-fab-hide');
});
// 提交
$('#edit-dialog form').submit(function (e) {
e.preventDefault();
app.request("{:url('admin/users/edit')}", $(this).serialize(), function () {
dialog.close();
history.go(0);
});
});
// 状态切换
$('td select.state').change(function () {
var tr = $(this).closest('tr');
app.request("{:url('admin/users/setState')}", {id: tr.data('id'), state: $(this).val()});
});
// 编辑
$('td button.edit').click(function () {
var tr = $(this).closest('tr');
app.ajax("{:url('admin/users/getUser')}", {id: tr.data('id')}, function (response) {
if (response.code) {
var form = $("#edit-dialog form");
for (x in response.data) {
var input = form.find("input[name='" + x + "']");
if (input.length) {
input.val(response.data[x]);
}
}
dialog.open();
} else {
mdui.snackbar({
message: response.msg
});
}
});
});
// 删除
$('td button.del').click(function () {
var tr = $(this).closest('tr');
methods.delete(tr.data('id'), false, function () {
tr.remove();
});
});
});
</script>
{/block}

View File

@ -1,72 +0,0 @@
{extend name="common:base" /}
{block name="title"}{:lang('Retrieve password')} - {$config.site_name}{/block}
{block name="main"}
<div class="mdui-container">
<main>
<div class="mdui-row">
<div class="forgot-container">
<div class="panel mdui-col-sm-6 mdui-col-md-6 mdui-col-offset-sm-3 mdui-col-offset-md-3">
<div class="panel-header">{:lang('Retrieve password')}</div>
<div class="panel-body-box">
<form id="send-code" action="{:url('auth/forgot')}" method="post">
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">{:lang('Please input mailbox')}</label>
<input class="mdui-textfield-input" type="email" name="email" value="" required/>
</div>
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">{:lang('Verification Code')}</label>
<input class="mdui-textfield-input" type="text" name="captcha" maxlength="5" autocomplete="off" required/>
<img src="{:captcha_src()}" class="captcha" onclick="this.src = '{:captcha_src()}' + '?t=' + new Date().getTime()" alt="{:lang('Verification Code')}">
</div>
<div class="mdui-textfield mdui-textfield-floating-label">
<button class="mdui-btn mdui-btn-block mdui-color-theme-accent mdui-ripple">{:lang('Send verification code')}</button>
</div>
</form>
<form id="reset-password" class="none" action="{:url('auth/forgot')}" method="post">
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">{:lang('Mail verification code')}</label>
<input class="mdui-textfield-input" type="text" name="code" maxlength="5" autocomplete="off" required/>
</div>
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">{:lang('New password')}</label>
<input class="mdui-textfield-input" type="password" name="password" value="" required/>
</div>
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">{:lang('Confirm new password')}</label>
<input class="mdui-textfield-input" type="password" name="password_confirm" value="" required/>
</div>
<div class="mdui-textfield mdui-textfield-floating-label">
<button class="mdui-btn mdui-btn-block mdui-color-theme-accent mdui-ripple">{:lang('Reset password')}</button>
</div>
</form>
</div>
</div>
</div>
</div>
</main>
</div>
{/block}
{block name="js"}
<script>
$(function () {
$('#send-code').submit(function (e) {
e.preventDefault();
app.request("{:url('auth/sendCode')}", $(this).serialize(), function () {
$('#send-code').addClass('none');
$('#reset-password').removeClass('none');
}, function () {
$('.captcha').click();
});
});
$('#reset-password').submit(function (e) {
e.preventDefault();
app.request("{:url('auth/forgot')}", $(this).serialize(), function () {
window.location.href = "{:url('auth/login')}";
});
});
});
</script>
{/block}

View File

@ -1,46 +0,0 @@
{extend name="common:base" /}
{block name="title"}{:lang('Sign In')} - {$config.site_name}{/block}
{block name="css"}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css" rel="stylesheet">
{/block}
{block name="main"}
<div class="mdui-container">
<main>
<div class="mdui-row">
<div class="login-container">
<div class="panel mdui-col-sm-6 mdui-col-md-6 mdui-col-offset-sm-3 mdui-col-offset-md-3">
<div class="panel-header">{:lang('Login account')}</div>
<div class="panel-body-box">
<form action="{:url('auth/login')}" method="post">
{include file="common:alert"}
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">{:lang('Account')}</label>
<input class="mdui-textfield-input" type="text" name="account" value="{:input('post.account')}"/>
</div>
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">{:lang('Password')}</label>
<input class="mdui-textfield-input" type="password" name="password"/>
</div>
<div class="mdui-textfield mdui-textfield-floating-label">
<button class="mdui-btn mdui-btn-block mdui-color-theme-accent mdui-ripple">{:lang('Sign In')}</button>
</div>
{:token()}
</form>
<p class="mdui-clearfix mdui-m-t-1">
<a class="mdui-float-left" href="{:url('auth/forgot')}">{:lang('Forgot your password?')}</a>
<a class="mdui-float-right" href="{:url('auth/register')}">{:lang('Registered account')}</a>
</p>
</div>
</div>
</div>
</div>
</main>
</div>
{/block}
{block name="js"}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/js/bootstrap.min.js"></script>
{/block}

View File

@ -1,71 +0,0 @@
{extend name="common:base" /}
{block name="title"}{:lang('Sign Up')} - {$config.site_name}{/block}
{block name="css"}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css" rel="stylesheet">
{/block}
{block name="main"}
<div class="mdui-container">
<main>
<div class="mdui-row">
<div class="register-container">
<div class="panel mdui-col-sm-6 mdui-col-md-6 mdui-col-offset-sm-3 mdui-col-offset-md-3">
<div class="panel-header">{:lang('Registered account')}</div>
<div class="panel-body-box">
<form action="{:url('auth/register')}" method="post">
{include file="common:alert"}
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">{:lang('User name')}</label>
<input class="mdui-textfield-input" type="text" name="username" maxlength="15" value="{:input('post.username')}"/>
</div>
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">{:lang('Mailbox')}</label>
<input class="mdui-textfield-input" type="email" name="email" value="{:input('post.email')}"/>
</div>
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">{:lang('Password')}</label>
<input class="mdui-textfield-input" type="password" name="password" value="{:input('post.password')}"/>
</div>
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">{:lang('Confirm password')}</label>
<input class="mdui-textfield-input" type="password" name="password_confirm"/>
</div>
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">{:lang('Verification Code')}</label>
<input class="mdui-textfield-input" type="text" name="captcha" maxlength="5" autocomplete="off"/>
<img src="{:captcha_src()}" class="captcha" onclick="this.src = '{:captcha_src()}' + '?t=' + new Date().getTime()" alt="{:lang('Verification Code')}">
</div>
<div class="mdui-textfield mdui-textfield-floating-label">
{if $config.close_register}
<button class="mdui-btn mdui-btn-block mdui-color-theme-accent mdui-ripple" disabled>{:lang('Registration closed')}</button>
{else /}
<button class="mdui-btn mdui-btn-block mdui-color-theme-accent mdui-ripple">{:lang('Sign Up')}</button>
{/if}
</div>
{:token()}
</form>
<p class="mdui-clearfix mdui-m-t-1">
{:lang('Existing account?')}<a href="{:url('auth/login')}"> {:lang('Sign In')}</a>
</p>
</div>
</div>
</div>
</div>
{if $config.close_register}
<div class="mask">
<div class="content">
<div class="panel-box">
<h3>{:lang('Site registration closed')}</h3>
</div>
</div>
</div>
{/if}
</main>
</div>
{/block}
{block name="js"}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/js/bootstrap.min.js"></script>
{/block}

View File

@ -1,12 +0,0 @@
{if session('?success')}
<div class="error-box alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
{:session('success')}
</div>
{/if}
{if session('?error')}
<div class="error-box alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
{:session('error')}
</div>
{/if}

View File

@ -1,209 +0,0 @@
<!DOCTYPE html>
<html lang="{$lang}">
<head>
<meta charset="UTF-8">
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
<meta name="keywords" content="{$config.site_keywords}"/>
<meta name="description" content="{$config.site_description}"/>
<title>{block name="title"}Lsky Pro{/block}</title>
{block name="css"}{/block}
<link rel="shortcut icon" href="/favicon.ico">
<link rel="stylesheet" href="/static/app/iconfont/iconfont.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mdui@0.4.3/dist/css/mdui.min.css">
<link rel="stylesheet" href="/static/app/css/app.css?v=1.7">
<link rel="stylesheet" href="/static/app/css/markdown.css?v=1.0">
<!--[if IE]>
<script>window.location.href = '/compatibility.html';</script>
<![endif]-->
</head>
<body class="mdui-theme-accent-indigo mdui-appbar-with-toolbar {if cookie('?menu') and cookie('menu') eq 'open'}mdui-drawer-body-left{/if} {if cookie('theme') eq 'dark'} mdui-theme-layout-dark{/if}">
{$config.custom_style|raw}
{block name="header"}
<div class="mdui-appbar mdui-appbar-fixed">
<div class="mdui-toolbar mdui-color-black">
<span mdui-drawer="{target: '#menu'}" class="mdui-btn mdui-btn-icon open-menu"><i class="mdui-icon material-icons">&#xe5d2;</i></span>
<a href="{:url('/')}" class="mdui-typo-headline">{$config.site_name}</a>
<div class="mdui-toolbar-spacer"></div>
{if $user}
<!-- Update -->
{if $user.is_admin}
<span id="update" class="mdui-btn mdui-btn-icon"><i class="mdui-icon material-icons">&#xe923;</i></span>
{/if}
<!-- User -->
<a href="javascript:void(0)" mdui-menu="{target: '#user'}" class="mdui-btn mdui-btn-icon"><i class="mdui-icon material-icons">&#xe853;</i></a>
<ul class="mdui-menu" id="user">
<li class="mdui-menu-item">
<a href="{:url('user/images')}" class="mdui-ripple">{:lang('My picture')}</a>
<a href="{:url('user/settings')}" class="mdui-ripple">{:lang('Setting')}</a>
</li>
<li class="mdui-divider"></li>
<li class="mdui-menu-item">
<a href="{:url('user/logout')}" class="mdui-ripple">{:lang('Logout')}</a>
</li>
</ul>
{/if}
{if config('app.lang_switch_on')}
<!-- Language -->
<a href="javascript:void(0)" mdui-menu="{target: '#language'}" class="mdui-btn mdui-btn-icon"><i class="mdui-icon material-icons">&#xe894;</i></a>
<ul class="mdui-menu" id="language">
<li class="mdui-menu-item">
<a href="{:url(request()->path(), 'lang=zh-cn')}" class="mdui-ripple">简体中文</a>
<a href="{:url(request()->path(), 'lang=en')}" class="mdui-ripple">English</a>
</li>
</ul>
{/if}
<!-- Theme -->
<a id="set-theme" href="javascript:app.toggleTheme()" class="mdui-btn mdui-btn-icon">
<i class="mdui-icon material-icons">{if cookie('theme') eq 'dark'}&#xe3ac;{else/}&#xe3a9;{/if}</i>
</a>
</div>
</div>
{/block}
{block name="left"}
<div id="menu" class="mdui-drawer mdui-drawer-{if cookie('?menu') and cookie('menu') eq 'open'}open{else /}close{/if}">
<div class="mdui-list" mdui-collapse="{accordion: true}">
<a class="mdui-list-item mdui-ripple {if $uri eq 'index/index'}mdui-list-item-active{/if}" href="/">
<i class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-blue">&#xe88a;</i>
<div class="mdui-list-item-content">{:lang('Home')}</div>
</a>
{if $config.open_gallery}
<a class="mdui-list-item mdui-ripple {if $uri eq 'index/gallery'}mdui-list-item-active{/if}" href="{:url('index/gallery')}">
<i class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-teal">&#xe8aa;</i>
<div class="mdui-list-item-content">{:lang('Gallery')}</div>
</a>
{/if}
{if $config.open_api}
<a class="mdui-list-item mdui-ripple {if $uri eq 'index/api'}mdui-list-item-active{/if}" href="{:url('index/api')}">
<i class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-blue">&#xe157;</i>
<div class="mdui-list-item-content">{:lang('Api')}</div>
</a>
{/if}
{if $user}
<a class="mdui-list-item mdui-ripple {if $uri eq 'user/images'}mdui-list-item-active{/if}" href="{:url('user/images')}">
<i class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-deep-orange">&#xe251;</i>
<div class="mdui-list-item-content">{:lang('My picture')}</div>
</a>
<a class="mdui-list-item mdui-ripple {if $uri eq 'user/settings'}mdui-list-item-active{/if}" href="{:url('user/settings')}">
<i class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-theme">&#xe8b8;</i>
<div class="mdui-list-item-content">{:lang('Setting')}</div>
</a>
{if $user.is_admin}
<div class="mdui-collapse-item mdui-collapse-item-open">
<div class="mdui-collapse-item-header mdui-list-item mdui-ripple">
<i class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-brown">&#xe8b9;</i>
<div class="mdui-list-item-content">{:lang('System management')}</div>
<i class="mdui-collapse-item-arrow mdui-icon material-icons">&#xe313;</i>
</div>
<div class="mdui-collapse-item-body mdui-list">
<a href="{:url('admin/system/console')}" class="mdui-list-item mdui-ripple {if $uri eq 'admin.system/console'}mdui-list-item-active{/if}">{:lang('Console')}</a>
<a href="{:url('admin/group/index')}" class="mdui-list-item mdui-ripple {if $uri eq 'admin.group/index'}mdui-list-item-active{/if}">{:lang('Role group')}</a>
<a href="{:url('admin/users/index')}" class="mdui-list-item mdui-ripple {if $uri eq 'admin.users/index'}mdui-list-item-active{/if}">{:lang('User management')}</a>
<a href="{:url('admin/images/index')}" class="mdui-list-item mdui-ripple {if $uri eq 'admin.images/index'}mdui-list-item-active{/if}">{:lang('Picture management')}</a>
<a href="{:url('admin/strategy/index')}" class="mdui-list-item mdui-ripple {if $uri eq 'admin.strategy/index'}mdui-list-item-active{/if}">{:lang('Storage')}</a>
<a href="{:url('admin/system/index')}" class="mdui-list-item mdui-ripple {if $uri eq 'admin.system/index'}mdui-list-item-active{/if}">{:lang('System setting')}</a>
</div>
</div>
{/if}
<div class="quota-container">
<p>{:lang('Used capacity')}</p>
<progress max="{$user.quota}" value="{$user.use_quota}"></progress>
<p>
<span class="use-quota">{:format_size($user.use_quota)}</span> /
<span class="quota">{:format_size($user.quota)}</span>
</p>
</div>
{else /}
<a class="mdui-list-item mdui-ripple {if $uri eq 'auth/login'}mdui-list-item-active{/if}" href="{:url('auth/login')}">
<i class="mdui-list-item-icon mdui-icon material-icons iconfont icon-login mdui-text-color-teal"></i>
<div class="mdui-list-item-content">{:lang('Sign In')}</div>
</a>
{if !$config.close_register}
<a class="mdui-list-item mdui-ripple {if $uri eq 'auth/register'}mdui-list-item-active{/if}" href="{:url('auth/register')}">
<i class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-purple">&#xe7f0;</i>
<div class="mdui-list-item-content">{:lang('Sign Up')}</div>
</a>
{/if}
{/if}
</div>
</div>
{/block}
{block name="main"}
<div class="mdui-container">
<main></main>
</div>
{/block}
{block name="footer"}
<div class="mdui-fab-wrapper">
<button id="to-top" class="mdui-fab mdui-ripple mdui-fab-hide mdui-color-theme-accent">
<i class="mdui-icon material-icons">&#xe5d8;</i>
</button>
</div>
<div id="loading-container">
<div class="mask"></div>
<div class="loading">
<div class="mdui-spinner mdui-spinner-colorful"></div>
</div>
</div>
<footer>
<div class="mdui-container">
Copyright &copy; 2018 - present <a href="https://www.lsky.pro">Lsky Pro</a>. All rights reserved.
{if $config.icp_number}<a href="https://beian.miit.gov.cn/" target="_blank">{$config.icp_number}</a>.{/if}
{:lang('Footer tip')}
</div>
</footer>
{/block}
<script>window.languages = {$languages|raw}</script>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mdui@0.4.3/dist/js/mdui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked@0.8.0/marked.min.js"></script>
<script src="/static/app/js/app.js?v=1.3"></script>
{block name="js"}{/block}
<script>
var ver = '{$config.system_version}';
$(function () {
var toTop = $("#to-top"), toTopHide = function () {
if ($(window).scrollTop() > 50) {
toTop.removeClass('mdui-fab-hide');
} else {
toTop.addClass('mdui-fab-hide');
}
};
if ($(window).scrollTop() > 50) {
toTopHide();
}
$(window).scroll(function() {
toTopHide();
});
toTop.click(function () {
$('body,html').animate({ scrollTop: 0 }, 500);
});
$('.open-menu').click(function () {
if ($(window).width() > 1024) {
app.cookie.set('menu', $('body').hasClass('mdui-drawer-body-left') ? 'open' : 'close', 10, '/');
}
});
$('#update').click(function () {
app.getLastVer(ver, true);
});
$('body').on('click', '.markdown-body a', function (e) {
e.preventDefault();
window.open(this.href, '_blank');
});
});
</script>
{if $user and $user.is_admin and !cookie('?no_update')}
<script>
app.getLastVer(ver, false);
</script>
{/if}
{$config.statistics_code|raw}
</body>
</html>

View File

@ -1,532 +0,0 @@
{extend name="common:base" /}
{block name="title"}Upload API Document - {$config.site_name}{/block}
{block name="main"}
<style>
tbody tr:last-child td {
border-bottom: none;
}
.mdui-table td {
line-height: 36px;
}
.mdui-shadow-2 {
box-shadow: 0 0 10px 0 rgba(45, 45, 45, 0.13);
}
</style>
<div class="mdui-container">
<main>
<div class="mdui-m-b-2">
<h2>1. Get token</h2>
<div class="mdui-row">
<div class="mdui-col-md-6">
<div class="mdui-table-fluid mdui-m-t-1">
<table class="mdui-table">
<thead>
<tr>
<td>Function</td>
<td>Interface</td>
</tr>
</thead>
<tbody>
<tr>
<td>Request mode</td>
<td>POST</td>
</tr>
<tr>
<td>URL</td>
<td>{$domain}/api/token</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h4 class="mdui-m-t-2 mdui-m-b-1">Request parameters</h4>
<div class="mdui-table-fluid">
<table class="mdui-table">
<thead>
<tr>
<td>Parameter name</td>
<td>Type</td>
<td>Required</td>
<td>Explain</td>
</tr>
</thead>
<tbody>
<tr>
<td>email</td>
<td>String</td>
<td>Yes</td>
<td>Mailbox</td>
</tr>
<tr>
<td>password</td>
<td>String</td>
<td>Yes</td>
<td>Account password</td>
</tr>
</tbody>
</table>
</div>
<h4 class="mdui-m-t-2 mdui-m-b-1">Return data description</h4>
<div class="mdui-table-fluid">
<table class="mdui-table">
<thead>
<tr>
<td>Parameter name</td>
<td>Type</td>
<td>Instance value</td>
<td>Explain</td>
</tr>
</thead>
<tbody>
<tr>
<td>code</td>
<td>Number</td>
<td>200</td>
<td>The status code returns 200 for success and 500 for failure</td>
</tr>
<tr>
<td>msg</td>
<td>String</td>
<td>success</td>
<td>Prompt information</td>
</tr>
<tr>
<td>time</td>
<td>Number</td>
<td>1544176295</td>
<td>Response timestamp</td>
</tr>
<tr>
<td>data</td>
<td>array|object</td>
<td>{"token": "8961576c9090ef0902c4b89406f8d557"}</td>
<td>Obtained token data</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="mdui-m-b-2">
<h2>2. Picture upload</h2>
<div class="mdui-row">
<div class="mdui-col-md-6">
<div class="mdui-table-fluid mdui-m-t-1">
<table class="mdui-table">
<thead>
<tr>
<td>Function</td>
<td>Interface</td>
</tr>
</thead>
<tbody>
<tr>
<td>Request mode</td>
<td>POST</td>
</tr>
<tr>
<td>URL</td>
<td>{$domain}/api/upload</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h4 class="mdui-m-t-2 mdui-m-b-1">Request parameters</h4>
<div class="mdui-table-fluid">
<table class="mdui-table">
<thead>
<tr>
<td>Parameter name</td>
<td>Type</td>
<td>Required</td>
<td>Explain</td>
</tr>
</thead>
<tbody>
<tr>
<td>image</td>
<td>File</td>
<td>Yes</td>
<td>Form name</td>
</tr>
</tbody>
</table>
</div>
<div class="mdui-shadow-2 mdui-m-t-2 mdui-m-b-1 mdui-p-a-3 mdui-text-color-red">
Note: if the header has a token parameter during the request, the interface will authenticate the token, and the uploaded image is also in the token user account, otherwise the system will consider it as uploaded by tourists.
</div>
<h4 class="mdui-m-t-2 mdui-m-b-1">Return data description</h4>
<div class="mdui-table-fluid">
<table class="mdui-table">
<thead>
<tr>
<td>Parameter name</td>
<td>Type</td>
<td>Instance value</td>
<td>Explain</td>
</tr>
</thead>
<tbody>
<tr>
<td>code</td>
<td>Number</td>
<td>200</td>
<td>The status code returns 200 for success and 500 for failure</td>
</tr>
<tr>
<td>msg</td>
<td>String</td>
<td>success</td>
<td>Prompt information</td>
</tr>
<tr>
<td>time</td>
<td>Number</td>
<td>1544176295</td>
<td>Response timestamp</td>
</tr>
<tr>
<td>data</td>
<td>array|object</td>
<td>
<pre>{
"name": "9B7BCFBD05891B2D42187F126887777A.jpg",
"url": "http://domain.com/2018/12/08/5c0b519f44701.jpg"
}</pre>
</td>
<td>Picture data</td>
</tr>
</tbody>
</table>
</div>
<h4 class="mdui-m-t-2 mdui-m-b-1">Upload example</h4>
<pre class="mdui-shadow-2 mdui-p-a-3">
POST /api/upload HTTP/1.1
Host: {$domain}
Connection: keep-alive
Content-Length: 57398
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryx2mqINKHVPJ8yMdK
------WebKitFormBoundaryx2mqINKHVPJ8yMdK
Content-Disposition: form-data; name="image"; filename="test.png"
Content-Type: image/png
</pre>
<h4 class="mdui-m-t-2 mdui-m-b-1">Response error example</h4>
<pre class="mdui-shadow-2 mdui-p-a-3">
{
"code": 500,
"msg": "The administrator turned off the tourist upload!",
"data": null,
"time": 1544245931
}</pre>
</div>
<div class="mdui-shadow-2 mdui-m-t-2 mdui-m-b-1 mdui-p-a-3 mdui-text-color-red">
Note: token is required for the following interfaces
</div>
<div class="mdui-m-b-2">
<h2>3. Get picture list</h2>
<div class="mdui-row">
<div class="mdui-col-md-6">
<div class="mdui-table-fluid mdui-m-t-1">
<table class="mdui-table">
<thead>
<tr>
<td>Function</td>
<td>Interface</td>
</tr>
</thead>
<tbody>
<tr>
<td>Request mode</td>
<td>POST</td>
</tr>
<tr>
<td>URL</td>
<td>{$domain}/api/images</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h4 class="mdui-m-t-2 mdui-m-b-1">Request parameters</h4>
<div class="mdui-table-fluid">
<table class="mdui-table">
<thead>
<tr>
<td>Parameter name</td>
<td>Type</td>
<td>Required</td>
<td>Explain</td>
</tr>
</thead>
<tbody>
<tr>
<td>page</td>
<td>String</td>
<td>Yes</td>
<td>Page number</td>
</tr>
<tr>
<td>rows</td>
<td>String</td>
<td>No</td>
<td>Quantity per page, 20 by default</td>
</tr>
</tbody>
</table>
</div>
<h4 class="mdui-m-t-2 mdui-m-b-1">Return data description</h4>
<div class="mdui-table-fluid">
<table class="mdui-table">
<thead>
<tr>
<td>Parameter name</td>
<td>Type</td>
<td>Instance value</td>
<td>Explain</td>
</tr>
</thead>
<tbody>
<tr>
<td>total</td>
<td>Number</td>
<td>999</td>
<td>Total data</td>
</tr>
<tr>
<td>per_page</td>
<td>String</td>
<td>1</td>
<td>Number per page</td>
</tr>
<tr>
<td>current_page</td>
<td>Number</td>
<td>1</td>
<td>Current page</td>
</tr>
<tr>
<td>last_page</td>
<td>Number</td>
<td>999</td>
<td>Last page number</td>
</tr>
</tbody>
</table>
</div>
<h4 class="mdui-m-t-2 mdui-m-b-1">Picture data description</h4>
<div class="mdui-table-fluid">
<table class="mdui-table">
<thead>
<tr>
<td>Parameter name</td>
<td>Type</td>
<td>Instance value</td>
<td>Explain</td>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>Number</td>
<td>1</td>
<td>Picture ID</td>
</tr>
<tr>
<td>strategy</td>
<td>String</td>
<td>oss</td>
<td>Storage strategy, (cos: Tencent cloud, kodo: qiniu cloud, local: local, soo: Alibaba cloud OSS, remote: remote storage, uss: shooting cloud again)</td>
</tr>
<tr>
<td>path</td>
<td>String</td>
<td>2019/10/31</td>
<td>Picture path</td>
</tr>
<tr>
<td>alias_name</td>
<td>String</td>
<td>test</td>
<td>Picture alias</td>
</tr>
<tr>
<td>name</td>
<td>String</td>
<td>929616303ca92.jpg</td>
<td>Picture name</td>
</tr>
<tr>
<td>pathname</td>
<td>String</td>
<td>2019/10/31/929616303ca92.jpg</td>
<td>Picture path + name</td>
</tr>
<tr>
<td>size</td>
<td>String</td>
<td>30405.00</td>
<td>Picture size (bytes: b)</td>
</tr>
<tr>
<td>mime</td>
<td>String</td>
<td>image/jpeg</td>
<td>Picture MIME type</td>
</tr>
<tr>
<td>sha1</td>
<td>String</td>
<td>0143f7904f12e2a76ff2935f21a771b8adadf961</td>
<td>Picture SHA1 value</td>
</tr>
<tr>
<td>md5</td>
<td>String</td>
<td>e630c1d832f1701b0afe09cfe86a7f2b</td>
<td>Picture MD5 value</td>
</tr>
<tr>
<td>ip</td>
<td>String</td>
<td>192.168.0.1</td>
<td>Uploader IP</td>
</tr>
<tr>
<td>suspicious</td>
<td>Number</td>
<td>0</td>
<td>Is it a suspicious picture, (0: No, 1: Yes)</td>
</tr>
<tr>
<td>upload_time</td>
<td>Number</td>
<td>1572491936</td>
<td>Picture upload time</td>
</tr>
<tr>
<td>upload_date</td>
<td>String</td>
<td>2019-10-31 11:18:56</td>
<td>Picture upload date</td>
</tr>
<tr>
<td>url</td>
<td>String</td>
<td>http://domain.com/2019/10/31/929616303ca92.jpg</td>
<td>Pictures linking</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="mdui-m-b-2">
<h2>4. Get a single picture</h2>
<div class="mdui-row">
<div class="mdui-col-md-6">
<div class="mdui-table-fluid mdui-m-t-1">
<table class="mdui-table">
<thead>
<tr>
<td>Function</td>
<td>Interface</td>
</tr>
</thead>
<tbody>
<tr>
<td>Request mode</td>
<td>POST</td>
</tr>
<tr>
<td>URL</td>
<td>{$domain}/api/image</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h4 class="mdui-m-t-2 mdui-m-b-1">Request parameters</h4>
<div class="mdui-table-fluid">
<table class="mdui-table">
<thead>
<tr>
<td>Parameter name</td>
<td>Type</td>
<td>Request</td>
<td>Explain</td>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>String</td>
<td>Yes</td>
<td>Picture ID</td>
</tr>
</tbody>
</table>
</div>
<h4 class="mdui-m-t-2 mdui-m-b-1">The returned data is the same as the third one</h4>
</div>
<div class="mdui-m-b-2">
<h2>5. Delete picture</h2>
<div class="mdui-row">
<div class="mdui-col-md-6">
<div class="mdui-table-fluid mdui-m-t-1">
<table class="mdui-table">
<thead>
<tr>
<td>Function</td>
<td>Interface</td>
</tr>
</thead>
<tbody>
<tr>
<td>Request mode</td>
<td>POST</td>
</tr>
<tr>
<td>URL</td>
<td>{$domain}/api/delete</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h4 class="mdui-m-t-2 mdui-m-b-1">Request parameters</h4>
<div class="mdui-table-fluid">
<table class="mdui-table">
<thead>
<tr>
<td>Parameter name</td>
<td>Type</td>
<td>Required</td>
<td>Explain</td>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>String</td>
<td>Yes</td>
<td>Picture ID, delete multiple, separated by commas</td>
</tr>
</tbody>
</table>
</div>
</div>
</main>
</div>
{/block}

View File

@ -1,102 +0,0 @@
{extend name="common:base" /}
{block name="title"}{:lang('Gallery')} - {$config.site_name}{/block}
{block name="css"}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/viewerjs@1.5.0/dist/viewer.min.css">
{/block}
{block name="main"}
<style>
.image-item {
cursor: pointer;
position: relative;
overflow: hidden;
margin-bottom: .5rem;
height: 160px;
}
.image-item .mdui-grid-tile {
height: 100%;
}
.image-item .mdui-grid-tile .img {
height: 100%;
object-fit: cover;
background-size: cover;
background-position: center;
}
</style>
<div class="mdui-container">
<main>
<div id="images-box" class="mdui-row-xs-2 mdui-row-sm-4 mdui-row-md-5 mdui-row-lg-6 mdui-row-xl-7 mdui-grid-list">
{foreach ($images as $index => $image)}
<div class="mdui-col image-item">
<div class="mdui-grid-tile">
<div class="img" style="background-image: url('{$image.url}')"></div>
<img src="{$image.url}" style="display: none">
<div class="mdui-grid-tile-actions mdui-grid-tile-actions-top">
<div class="mdui-grid-tile-text">
<div class="mdui-grid-tile-title">{$image.date}</div>
</div>
</div>
</div>
</div>
{/foreach}
</div>
<button class="mdui-btn mdui-m-t-2 mdui-center mdui-ripple" id="more">{:lang('See more')}</button>
</main>
</div>
{/block}
{block name="js"}
<script src="https://cdn.jsdelivr.net/npm/viewerjs@1.5.0/dist/viewer.min.js"></script>
<script src="/static/jquery-viewer/1.2.0/js/jquery-viewer.js"></script>
<script>
var page = 2;
var limit = 30;
var loading = false;
var $box = $('#images-box');
var $more = $("#more");
var $viewer = $box.viewer({zIndex: 999999999});
$box.on('click', '.image-item .img', function () {
$viewer.data('viewer').view($(this).closest('.image-item').index());
});
$more.click(function () {
if (loading) return;
loading = true;
$more.attr('disabled', true).text(lang('Loading...'));
app.ajax("", {page: page, limit: limit}, function (response) {
if (response.code) {
var data = response.data;
if (data.length === 0) {
$more.text(lang('No more'));
} else {
var html = '';
for (var key in data) {
html += "<div class=\"mdui-col image-item\">\n" +
" <div class=\"mdui-grid-tile\">\n" +
" <div class=\"img\" style=\"background-image: url('"+ data[key].url + "')\"></div>\n" +
" <img src=\""+ data[key].url + "\" style=\"display: none\">\n" +
" <div class=\"mdui-grid-tile-actions mdui-grid-tile-actions-top\">\n" +
" <div class=\"mdui-grid-tile-text\">\n" +
" <div class=\"mdui-grid-tile-title\">"+ data[key].date + "</div>\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
" </div>"
}
$('#images-box').append(html);
$viewer.data('viewer').update();
loading = false;
if (data.length < limit) {
$more.text(lang('No more'));
} else {
$more.attr('disabled', false).text(lang('See more'));
page++;
}
}
}
});
});
</script>
{/block}

View File

@ -1,50 +0,0 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
<title>{$config.site_name}</title>
<link rel="stylesheet" href="/static/app/css/home.css">
<!--[if IE]>
<script>window.location.href = '/compatibility.html';</script>
<![endif]-->
</head>
<body>
<div id="bg"></div>
<div id="mask"></div>
<div id="login-btn">SIGN IN</div>
<div id="login-box">
<input type="text" name="account" placeholder="{:lang('Account input tip')}">
<input type="password" name="password" placeholder="{:lang('Password input tip')}">
<button type="button" id="login">{:lang('Sign In')}</button>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>
<script>
$('#login-btn').click(function () {
$('#login-box').css('display', 'flex')
setTimeout(function () {
$(this).hide();
$('body').addClass('fade')
}.bind(this), 60)
});
$('#login').click(function () {
$.ajax({
url: '',
type: 'post',
data: {
account: $('[name=account]').val(),
password: $('[name=password]').val(),
},
success: function (response) {
alert(response.msg);
if (response.code) {
history.go(0)
}
}
});
});
</script>
</html>

View File

@ -1,205 +0,0 @@
{extend name="common:base" /}
{block name="title"}{$config.site_name}{/block}
{block name="css"}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-fileinput@5.0.7/css/fileinput.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.12.1/css/all.min.css" rossorigin="anonymous" rel="stylesheet">
{/block}
{block name="main"}
<div class="mdui-container">
<main>
<div class="upload-container">
{if $config.notice}
<div class="alert alert-info alert-dismissible fade show">
<button type="button" class="close" data-dismiss="alert">&times;</button>
{$config.notice|raw}
</div>
{/if}
<div class="title">
<h1>Image Upload</h1>
<p>{:lang('Home upload info', [format_size($config.upload_max_size), $config.upload_single_num, $images_count])}</p>
</div>
<form action="" method="post" enctype="multipart/form-data">
<input id="image" style="display: none;" type="file" multiple name="image" accept="image/*">
</form>
<div class="success-info">
<div class="mdui-tab mdui-tab-scrollable" mdui-tab>
<a href="#code-url" class="mdui-ripple mdui-tab-active">URL</a>
<a href="#code-html" class="mdui-ripple">HTML</a>
<a href="#code-bbcode" class="mdui-ripple">BBCode</a>
<a href="#code-markdown" class="mdui-ripple">Markdown</a>
<a href="#code-markdown-with-link" class="mdui-ripple">Markdown with link</a>
</div>
<div id="code-url"><ul></ul></div>
<div id="code-html"><ul></ul></div>
<div id="code-bbcode"><ul></ul></div>
<div id="code-markdown"><ul></ul></div>
<div id="code-markdown-with-link"><ul></ul></div>
</div>
</div>
{if 0 == $config.allowed_tourist_upload and !$user}
<div class="mask">
<div class="content">
<div class="panel-box mdui-color-white mdui-text-center">
<h6 class="mdui-m-b-2">{:lang('Sign in tip')}</h6>
<div class="mdui-btn-group">
<a href="{:url('auth/login')}" class="mdui-btn mdui-ripple mdui-color-cyan mdui-text-color-white mdui-btn-dense">{:lang('Sign in')}</a>
<a href="{:url('auth/register')}" class="mdui-btn mdui-ripple mdui-color-green mdui-text-color-white mdui-btn-dense">{:lang('Sign up')}</a>
</div>
</div>
</div>
</div>
{/if}
</main>
</div>
{/block}
{block name="js"}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-fileinput@5.0.7/js/plugins/piexif.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-fileinput@5.0.7/js/plugins/sortable.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-fileinput@5.0.7/js/plugins/purify.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-fileinput@5.0.7/js/fileinput.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-fileinput@5.0.7/themes/fas/theme.min.js"></script>
{if ($lang === 'zh-cn')}
<script src="https://cdn.jsdelivr.net/npm/bootstrap-fileinput@5.0.7/js/locales/zh.js"></script>
{/if}
<script>
var clipboard = new ClipboardJS('.copy', {
text: function(trigger) {
return $(trigger).parent('li').text();
}
});
clipboard.on('success', function(e) {
app.msg(true, lang('Copy successful'));
});
clipboard.on('error', function(e) {
app.msg(false, lang('Copy failed'));
});
var sort = function (uls) {
for (var i = 0; i < uls.length; i++) {
var sortEle = $(uls[i]).find('li').sort(function (a, b) {
return $(a).data('index') > $(b).data('index') ? 1 : -1;
});
$(uls[i]).empty().append(sortEle);
}
};
$("#image").fileinput({
uploadUrl: "{:url('upload/upload')}",
language: "zh",
theme: "fas",
previewFileType: "image",
autoOrientImage: true,
uploadAsync: true,
overwriteInitial: false,
maxFileSize: "{$config.upload_max_size / 1024}",// kb
maxFileCount: "{$config.upload_single_num}",
showCaption: true,
dropZoneEnabled: true,
browseIcon: "<i class=\"fas fa-images\"></i> ",
allowedFileExtensions: JSON.parse('{:json_encode(explode(",", filter_comma($config.upload_allowed_exts)))}'),
}).on("fileuploaded", function(event, data, previewId, index) {
var form = data.form, files = data.files, extra = data.extra, response = data.response, reader = data.reader;
if(200 === response.code) {
$("#code-url ul").prepend("<li data-index=" + index + ">" + response.data.url + "<i class=\"copy iconfont icon-copy\"></i></li>");
$("#code-html ul").prepend("<li data-index=" + index + ">&lt;img src=\"" + response.data.url + "\" alt=\"" + response.data.name + "\" title=\"" + response.data.name + "\" /&gt;<i class=\"copy iconfont icon-copy\"></i></li>");
$("#code-bbcode ul").prepend("<li data-index=" + index + ">[img]" + response.data.url + "[/img]<i class=\"copy iconfont icon-copy\"></i></li>");
$("#code-markdown ul").prepend("<li data-index=" + index + ">![" + response.data.name + "](" + response.data.url + ")<i class=\"copy iconfont icon-copy\"></i></li>");
$("#code-markdown-with-link ul").prepend("<li data-index=" + index + ">[![" + response.data.name + "](" + response.data.url + ")](" + response.data.url + ")<i class=\"copy iconfont icon-copy\"></i></li>");
// 排序
sort(['#code-url ul', '#code-html ul', '#code-bbcode ul', '#code-markdown ul', '#code-markdown-with-link ul']);
$(".success-info").css("width", "inherit").css('display', 'block');
if (response.data.quota && response.data.use_quota) {
$('.quota-container progress').attr('max', response.data.quota);
$('.quota-container progress').val(response.data.use_quota);
$('.quota-container span.quota').text(app.bytesToSize(response.data.quota));
$('.quota-container span.use-quota').text(app.bytesToSize(response.data.use_quota));
}
} else if (500 === response.code) {
mdui.alert(response.msg, lang('Exception occurred'));
} else {
mdui.alert(response.msg);
}
}).on("filecleared", function (event, data, msg) {
// 清空
$('.success-info')
.css('display', 'none')
.find('#code-url, #code-html, #code-bbcode, #code-markdown, #code-markdown-with-link')
.find('ul')
.html('');
});
$('#image').css("display", "block");
$('.success-info ul').on('mouseenter', "li", function() {
$('.file-preview .file-drop-zone .file-preview-thumbnails > [data-template=image]').eq($(this).data('index')).addClass('hover');
}).on('mouseout', 'li', function () {
$('.file-preview .file-drop-zone .file-preview-thumbnails > [data-template=image]').eq($(this).data('index')).removeClass('hover');
});
</script>
{if 1 == $config.allowed_tourist_upload or $user}
<script>
// Originate from https://sm.ms
document.addEventListener('paste', function (event) {
var isChrome = false;
if ( event.clipboardData || event.originalEvent ) {
var clipboardData = (event.clipboardData || event.originalEvent.clipboardData);
if ( clipboardData.items ) {
// for chrome
var items = clipboardData.items,
len = items.length,
blob = null;
isChrome = true;
event.preventDefault();
let images = [];
for (var i = 0; i < len; i++) {
if (items[i].type.indexOf("image") !== -1) {
blob = items[i].getAsFile();
var ext = blob.name.substr(blob.name.lastIndexOf(".") + 1)
images.push(new File([blob], new Date().getTime() + "." + ext, {
type: blob.type
}));
}
}
if(images.length > 0) {
uploadBlobFile(images);
}
if ( blob !== null ) {
var reader = new FileReader();
reader.onload = function (event) {
var base64_str = event.target.result;
}
}
} else {
//for firefox
}
} else {
}
});
function uploadBlobFile(images) {
var form = $("#image");
mdui.confirm(lang('Upload pasted photos?'), function() {
$('.file-drop-zone-title').remove();
form.fileinput('readFiles', images);
setTimeout(function () {
form.fileinput('upload');
}, 400)
}, function () {}, {
confirmText: lang('Confirm'),
cancelText: lang('Cancel')
});
}
</script>
{/if}
{/block}

View File

@ -1,253 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Install Lsky Pro</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<link href="https://cdn.jsdelivr.net/npm/mdui@0.4.3/dist/css/mdui.min.css" rel="stylesheet">
</head>
<body class="mdui-theme-accent-indigo">
<style>
main {
margin: 5rem auto;
max-width: 500px;
border-radius: 3px;
padding: 1rem;
}
table {
width: 100%;
}
tr {
display: table;
width: 100%;
border: 1px solid #ebebeb;
}
td {
width: 50%;
margin-bottom: .8rem;
}
</style>
<div class="mdui-container">
<main class="mdui-shadow-2">
{switch step}
{case 1}
<h4>- 运行环境检测</h4>
<table>
<tbody>
<tr>
<td align="right">
PHP版本 &ge; 5.6
</td>
<td align="left">
{if ($phpVerGt56) }
<i class="mdui-icon material-icons mdui-text-color-green">&#xe86c;</i>
{else/}
<i class="mdui-icon material-icons mdui-text-color-red">&#xe5c9;</i>
{/if}
</td>
</tr>
<tr>
<td align="right">
fileInfo 拓展:
</td>
<td align="left">
{if ($isFileInfo) }
<i class="mdui-icon material-icons mdui-text-color-green">&#xe86c;</i>
{else/}
<i class="mdui-icon material-icons mdui-text-color-red">&#xe5c9;</i>
{/if}
</td>
</tr>
<tr>
<td align="right">
curl 拓展:
</td>
<td align="left">
{if ($isCurl) }
<i class="mdui-icon material-icons mdui-text-color-green">&#xe86c;</i>
{else/}
<i class="mdui-icon material-icons mdui-text-color-red">&#xe5c9;</i>
{/if}
</td>
</tr>
<tr>
<td align="right">
PDO 拓展:
</td>
<td align="left">
{if ($pdo) }
<i class="mdui-icon material-icons mdui-text-color-green">&#xe86c;</i>
{else/}
<i class="mdui-icon material-icons mdui-text-color-red">&#xe5c9;</i>
{/if}
</td>
</tr>
<tr>
<td align="right">
ZipArchive
</td>
<td align="left">
{if ($isZip) }
<i class="mdui-icon material-icons mdui-text-color-green">&#xe86c;</i>
{else/}
<i class="mdui-icon material-icons mdui-text-color-red">&#xe5c9;</i>
{/if}
</td>
</tr>
<tr>
<td align="right">
文件写入权限:
</td>
<td align="left">
{if ($dir) }
<i class="mdui-icon material-icons mdui-text-color-green">&#xe86c;</i>
{else/}
<i class="mdui-icon material-icons mdui-text-color-red">&#xe5c9;</i>
{/if}
</td>
</tr>
</tbody>
</table>
{if (!$testing) }
<a href="javascript:void(0)" class="mdui-btn mdui-btn-block mdui-m-t-1 mdui-color-teal mdui-ripple" disabled>检测不通过</a>
{else/}
<a href="{:url('install/index', ['step' => 2])}" class="mdui-btn mdui-btn-block mdui-m-t-1 mdui-color-teal mdui-ripple">下一步</a>
{/if}
{/case}
{case 2}
<h4>- 完善数据库配置</h4>
<form action="" method="post" id="configure-mysql-form">
<div class="mdui-textfield">
<label class="mdui-textfield-label">数据库连接地址</label>
<input class="mdui-textfield-input" type="text" name="hostname" placeholder="数据库连接地址" value="127.0.0.1" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">数据库名</label>
<input class="mdui-textfield-input" type="text" name="database" placeholder="数据库名称" value="lsky" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">数据库用户名</label>
<input class="mdui-textfield-input" type="text" name="username" placeholder="数据库用户名" value="root" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">数据库密码</label>
<input class="mdui-textfield-input" type="password" name="password" placeholder="数据库密码" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">数据库连接端口</label>
<input class="mdui-textfield-input" type="number" name="hostport" placeholder="数据库连接端口" value="3306" autocomplete="off"/>
</div>
<button class="mdui-btn mdui-btn-block mdui-m-t-1 mdui-color-teal mdui-ripple">配置数据库</button>
</form>
{/case}
{case 3}
<h4>- 设置管理员账号</h4>
<form action="" method="post" id="configure-admin-form">
<div class="mdui-textfield">
<label class="mdui-textfield-label">管理员邮箱</label>
<input class="mdui-textfield-input" type="email" name="email" placeholder="管理员邮箱" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">管理员用户名</label>
<input class="mdui-textfield-input" type="text" name="username" placeholder="管理员用户名" value="admin" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">管理员密码</label>
<input class="mdui-textfield-input" type="password" name="password" placeholder="管理员密码" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">确认管理员密码</label>
<input class="mdui-textfield-input" type="password" name="password_confirm" placeholder="确认管理员密码" autocomplete="off"/>
</div>
<button class="mdui-btn mdui-btn-block mdui-m-t-1 mdui-color-teal mdui-ripple">设置管理员账号</button>
</form>
{/case}
{case 4}
<h4>- 安装成功</h4>
<div class="mdui-text-center">
<p>程序安装成功,请牢记管理员账号密码!</p>
<a href="{:url('/')}" class="mdui-btn mdui-btn-block mdui-m-t-1 mdui-color-teal mdui-ripple">网站首页</a>
<a href="https://www.wispx.cn" class="mdui-btn mdui-btn-block mdui-m-t-1 mdui-color-pink mdui-ripple">作者博客</a>
</div>
<div class="mdui-m-t-2 mdui-text-color-grey">Copyright &copy; 2018 - present Wisp X All rights reserved.</div>
{/case}
{default /}
{/switch}
</main>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mdui@0.4.3/dist/js/mdui.min.js"></script>
<script>
$(function () {
var loading = false;
$('#configure-mysql-form').submit(function (e) {
e.preventDefault();
if (loading === true) return false;
loading = true;
$.ajax({
url: "{:url('install/index', ['step' => 2])}",
data: $(this).serialize(),
type: 'POST',
dataType: 'JSON',
beforeSend: function () {
},
success: function (response) {
if (response.code) {
location.href = "{:url('install/index',['step' => 3])}";
} else {
mdui.snackbar({
message: response.msg,
position: 'right-top'
});
}
},
error: function () {
},
complete: function () {
loading = false;
}
});
});
$('#configure-admin-form').submit(function (e) {
e.preventDefault();
if (loading === true) return false;
loading = true;
$.ajax({
url: "{:url('install/index', ['step' => 3])}",
data: $(this).serialize(),
type: 'POST',
dataType: 'JSON',
beforeSend: function () {
},
success: function (response) {
if (response.code) {
location.href = "{:url('install/index', ['step' => 4])}";
} else {
mdui.snackbar({
message: response.msg,
position: 'right-top'
});
}
},
error: function () {
},
complete: function () {
loading = false;
}
});
});
});
</script>
</html>

View File

@ -1,63 +0,0 @@
<!DOCTYPE html>
<html style="background:#eeeeee">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>抱歉无法兼容您的IE版本</title>
</head>
<style>
body {
color: #666;
text-align: center;
font-family: Helvetica, 'microsoft yahei', Arial, sans-serif;
margin: 0;
max-width: 800px;
margin: auto;
font-size: 14px;
padding-top: 100px;
}
h1 {
font-size: 56px;
line-height: 100px;
font-weight: normal;
color: #456;
}
h2 {
font-size: 24px;
color: #666;
line-height: 1.5em;
}
h3 {
color: #456;
font-size: 20px;
font-weight: normal;
line-height: 28px;
margin: 15px 0;
}
hr {
margin: 18px 0;
border: 0;
border-top: 1px solid #EEE;
border-bottom: 1px solid white;
}
a {
color: #17bc9b;
text-decoration: none;
}
</style>
<body>
<h1>Oops!</h1>
<h3>本站不支持 IE 9 及以下版本浏览器。</h3>
<hr/>
<p style="font-size:16px;">
为了获得更好的浏览体验,我们强烈建议您
<a href="http://browsehappy.com/">升级</a>到最新版本的IE浏览器或者使用较新版本的
<a href="http://browsehappy.com/" style="font-weight:bold;">Google Chrome</a><a href="http://browsehappy.com/" style="font-weight:bold;">Firefox</a>
<a href="http://browsehappy.com/" style="font-weight:bold;">Safari</a> 等。 如果您使用的是 IE 10 或以上版本,请关闭“兼容性视图”。
</p>
</body>
</html>

View File

@ -1,590 +0,0 @@
{extend name="common:base" /}
{block name="title"}{:lang('Picture management')} - {$config.site_name}{/block}
{block name="css"}
<link rel="stylesheet" href="/static/contextjs/css/context.standalone.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/viewerjs@1.5.0/dist/viewer.min.css">
{/block}
{block name="main"}
<div class="mdui-container-fluid">
<main>
<div class="images-container">
<div class="screen-box mdui-m-b-1">
<div class="mdui-chip">
<span class="mdui-chip-icon"><i class="mdui-icon material-icons">&#xe88e;</i></span>
<span class="mdui-chip-title">{:lang('There are %s pictures in total', ['<small class="mdui-text-color-red num">0</small>'])}</span>
<span id="reset" class="mdui-chip-delete" mdui-tooltip="{content: '{:lang('Reset data')}', position: 'right'}"><i class="mdui-icon material-icons">&#xe863;</i></span>
</div>
<div class="mdui-clearfix mdui-m-t-1"></div>
<form action="" method="post" id="search-form">
<select class="operation mdui-select" name="state" mdui-select>
<option value="">{:lang('Selected items')}</option>
<option value="move">{:lang('Move')}</option>
<option value="delete">{:lang('Delete')}</option>
</select>
<div class="mdui-btn-group mdui-m-r-1 mdui-float-left">
<button type="button" id="all" class="mdui-btn mdui-ripple mdui-color-theme-accent mdui-float-right">{:lang('Select all')}</button>
</div>
<input class="mdui-textfield-input search-input mdui-float-right" type="text" name="keyword" placeholder="{:lang('Enter search...')}" value="" autocomplete="off"/>
</form>
<div class="mdui-clearfix"></div>
<ul class="breadcrumb mdui-m-t-1">
<li class="active"><a data-id="0">Home</a></li>
</ul>
</div>
<div class="mdui-divider mdui-m-b-1"></div>
<div class="mdui-row">
<div class="box mdui-row-xs-3 mdui-row-sm-9 mdui-row-md-9 mdui-row-lg-10 mdui-col-xl-12">
<div class="folders-box"></div>
<div class="images-box"></div>
</div>
</div>
<button class="mdui-btn mdui-ripple mdui-center mdui-color-grey-300 mdui-text-color-black-secondary mdui-m-t-2 more"></button>
<!-- Info Dialog -->
<div class="mdui-dialog" id="info">
<div class="mdui-dialog-title"></div>
<div class="mdui-dialog-content">
<div class="mdui-row">
<div class="mdui-col-xs-12 mdui-col-sm-3 mdui-col-md-3 mdui-col-lg-3 mdui-col-xl-3">
<img class="qrcode mdui-center" src="/static/app/images/loading.jpg" width="100%">
</div>
<div class="mdui-col-xs-12 mdui-col-sm-9 mdui-col-md-9 mdui-col-lg-9 mdui-col-xl-9">
<table>
<tbody>
<tr class="alias_name">
<td align="right">{:lang('Alias:')}</td>
<td align="left"></td>
</tr>
<tr class="url">
<td align="right">{:lang('Link:')}</td>
<td align="left">
<input class="mdui-textfield-input" type="text" placeholder="{:lang('Picture link')}" value=""/>
</td>
</tr>
<tr class="pathname">
<td align="right">{:lang('Position:')}</td>
<td align="left"></td>
</tr>
<tr class="size">
<td align="right">{:lang('Size:')}</td>
<td align="left"></td>
</tr>
<tr class="md5">
<td align="right">{:lang('MD5:')}</td>
<td align="left"></td>
</tr>
<tr class="mime">
<td align="right">{:lang('Type:')}</td>
<td align="left"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="mdui-dialog-actions">
<div class="mdui-btn-group">
<a href="" target="_blank" class="open-url mdui-btn mdui-color-theme-accent mdui-ripple mdui-btn-dense">{:lang('Open link')}</a>
<button data-clipboard-action="copy" data-clipboard-text="" class="copy-url mdui-btn mdui-color-teal mdui-ripple mdui-btn-dense">{:lang('Copy link')}</button>
<button data-id="" class="delete-image mdui-btn mdui-color-red mdui-ripple mdui-btn-dense">{:lang('Delete')}</button>
<button class="mdui-btn mdui-ripple mdui-color-grey-600 mdui-btn-dense" mdui-dialog-cancel>{:lang('Close')}</button>
</div>
</div>
</div>
<!-- Folders Dialog -->
<div class="mdui-dialog" id="folders">
<div class="mdui-dialog-content mdui-p-a-0">
<ul class="breadcrumb">
<li class="active"><a data-id="0">Home</a></li>
</ul>
<ul class="mdui-list">
<!-- folders -->
</ul>
</div>
<div class="mdui-dialog-actions">
<button class="mdui-btn mdui-ripple" mdui-dialog-close>{:lang('Cancel')}</button>
<button class="mdui-btn mdui-ripple" mdui-dialog-confirm>{:lang('Confirm')}</button>
</div>
</div>
</div>
</main>
</div>
<!-- 用于右键复制 -->
<span id="copy-url" class="none copy-url" data-clipboard-action="copy" data-clipboard-text=""></span>
{/block}
{block name="js"}
<script src="/static/contextjs/js/context.js"></script>
<script src="https://cdn.jsdelivr.net/npm/viewerjs@1.5.0/dist/viewer.min.js"></script>
<script src="/static/jquery-viewer/1.2.0/js/jquery-viewer.js"></script>
<script>
$(function () {
var params = {},
viewer,
foldersBox = $('.folders-box'),
imagesBox = $('.images-box'),
totalBox = $('small.num'),
foldersDialog = new mdui.Dialog('.mdui-dialog#folders', {
modal: true
}),
selectedImagesId = [],
infoDialog = $(".mdui-dialog#info"),
qrcodeApi = 'https://api.wispx.cn/qrcode/generate?text=';
params.page = 1;
// 函数库
var methods = {
getData: function (options) {
params = options || params;
var more = $(".more");
more.attr('disabled', true).text(lang('Loading...'));
app.ajax("{:url('user/images')}", params, function (response) {
if (response.code) {
var images = response.data.images.data;
var folders = response.data.folders;
totalBox.text(response.data.images.total);
if (folders.length) {
for (var f = 0; f < folders.length; f++) {
foldersBox.append(
' <div class="mdui-col">' +
' <div class="item" data-id="' + folders[f].id + '" data-parent-id="' + folders[f].parent_id + '" data-name="' + folders[f].name + '">' +
' <div class="info">' +
' <img src="/static/app/images/folder.svg">' +
' </div>' +
' <p class="name">' + folders[f].name + '</p>' +
' </div>' +
'</div>'
);
}
}
if (images.length) {
for (var i = 0; i < images.length; i++) {
var filename = images[i].alias_name || images[i].name;
imagesBox.append(
'<div class="mdui-col">' +
' <div class="item" data-id="' + images[i].id + '" data-json=\'' + JSON.stringify(images[i]) + '\' title=' + filename + '>' +
' <i class="choice iconfont icon-choice"></i>' +
' <i class="info iconfont icon-info"></i>' +
' <div class="info image">' +
' <img data-original="' + images[i].url + '" src="' + images[i].url + '">' +
' </div>' +
' <p class="name">' + filename + '</p>' +
' </div>' +
'</div>');
}
// 图片预览插件
if (!viewer) {
viewer = $('.images-box').viewer({
url: 'data-original',
zIndex: 999999999
});
} else {
viewer.data('viewer').update();
}
if (response.data.images.current_page == response.data.images.last_page) {
return more.attr('disabled', true).text(lang('No more'));
}
params.page++;
return more.attr('disabled', false).text(lang('Loading more'));
} else {
more.attr('disabled', true).text(lang('No data available'));
}
}
});
},
resetData: function (options) {
foldersBox.html('');
imagesBox.html('');
methods.getData(options);
},
// 删除
delete: function (id, batch, callback) {
var msg = lang('Are you sure to delete this picture?');
if (batch) {
msg = lang('Are you sure to delete the selected picture?');
}
mdui.confirm(msg, function () {
app.request("{:url('user/deleteImages')}", {id: id}, function () {
callback && callback();
});
}, function () {
}, {confirmText: lang('Confirm'), cancelText: lang('Cancel')});
},
getFolders: function (options, openDialog, callback) {
openDialog = openDialog || false;
app.ajax("{:url('user/getFolders')}", options, function (response) {
if (response.code) {
$('#folders ul.mdui-list').html('');
var folders = response.data;
if (folders.length) {
for (var i = 0; i < folders.length; i++) {
$('#folders ul.mdui-list').append(
'<li class="mdui-list-item mdui-ripple" data-id="' + folders[i].id + '" data-parent-id="' + folders[i].parent_id + '">' +
' <i class="mdui-list-item-avatar mdui-icon material-icons">&#xe2c7;</i>' +
' <div class="mdui-list-item-content">' +
' <div class="mdui-list-item-title">' + folders[i].name + '</div>' +
' <div class="mdui-list-item-text">' + folders[i].create_time + '</div>' +
' </div>' +
'</li>'
);
}
} else {
$('#folders ul.mdui-list').html('<li class="mdui-text-center mdui-text-color-black-secondary">' + lang('Folder not found') + '</li>');
}
foldersDialog.handleUpdate();
openDialog && foldersDialog.open();
callback && callback();
}
})
}
};
methods.getData();
// 监听复制操作
var clipboard = new ClipboardJS('.copy-url');
clipboard.on('success', function(e) {
app.msg(true, lang('Copy successful'));
e.clearSelection();
});
clipboard.on('error', function(e) {
console.error('Action:', e.action);
console.error('Trigger:', e.trigger);
app.msg(false, lang('Copy failed'));
});
// Context Start
context.init({
fadeSpeed: 100,
filter: function ($obj) {},
above: 'auto',
preventDoubleContext: true,
compress: false
});
// 右键操作
$('.images-container').on('contextmenu', '.box', function(e) {
var $that = $(e.target), $item = $that.closest('.item');
if ($that.parents().hasClass('folders-box')) {
context.attach('.folders-box .item', [
{header: 'Compressed Menu'},
{text: lang('Open'), action: function (e) {
$item.click();
}
},
{text: lang('Rename'), action: function (e) {
e.preventDefault();
mdui.prompt(lang('Please enter a folder name'),
function (value) {
app.ajax("{:url('user/renameFolder')}", {
id: $item.data('id'),
parent_id: $item.data('parent-id'),
name: value
}, function (response) {
if (response.code) {
$item.attr('data-name', value).find('p.name').text(value);
return app.msg(true, response.msg);
}
mdui.alert(response.msg);
})
}
);
}
},
{divider: true},
{text: lang('Delete'), action: function (e) {
e.preventDefault();
mdui.confirm(lang('Are you sure to delete this folder?'), function() {
app.ajax("{:url('user/deleteFolder')}", {id: $item.data('id')}, function (response) {
if (response.code) {
$item.parent().remove();
return app.msg(true, response.msg);
}
mdui.alert(response.msg);
})
});
}
},
]);
} else if ($that.parents().hasClass('images-box')) {
var $item = $that.closest('.item'), data = $item.data('json');
context.attach('.images-box .item', [
{header: 'Compressed Menu'},
{text: lang('See picture'), action: function (e) {
e.preventDefault();
$item.find('img').click();
}
},
{text: lang('Open picture in new window'), href: data.url, target: '_blank'},
{divider: true},
{text: lang('Rename'), action: function (e) {
e.preventDefault();
mdui.prompt(lang('Please enter a picture name'),
function (value) {
app.ajax("{:url('user/renameImage')}", {
id: data.id,
name: value
}, function (response) {
if (response.code) {
methods.resetData();
return app.msg(true, response.msg);
}
mdui.alert(response.msg);
})
}
);
}
},
{text: lang('Copy link'), action: function (e) {
e.preventDefault();
$('#copy-url').attr('data-clipboard-text', data.url).click();
}
},
{
text: lang('Delete'), action: function (e) {
e.preventDefault();
methods.delete(data.id, false, function () {
$item.parent().remove();
totalBox.text(parseInt(totalBox.text()) - 1);
})
}
},
{
text: lang('Attribute'), action: function (e) {
e.preventDefault();
$item.find('i.info').click();
}
}
]);
} else {
context.attach('.box', [
{header: 'Compressed Menu'},
{text: lang('New folder'), action: function (e) {
e.preventDefault();
mdui.prompt(lang('Please enter a folder name'),
function (value) {
app.ajax("{:url('user/createFolder')}", {
parent_id: $('ul.breadcrumb li.active:last-child a').data('id'),
name: value
}, function (response) {
if (response.code) {
methods.resetData();
return app.msg(true, response.msg);
}
mdui.alert(response.msg);
})
}
);
}
},
{divider: true},
{text: lang('Refresh'), action: function (e) {
// e.preventDefault();
methods.resetData();
}
},
]);
}
});
// Context End
// 文件夹点击操作
$('.folders-box').on('click', '.mdui-col', function (e) {
var $that = $(e.target), $item = $that.closest('.item');
if ($item.length === 0) return false;
$('.screen-box ul.breadcrumb li:last-child').removeClass('active');
$('.screen-box ul.breadcrumb').append(
'<li class="active">' +
' <a data-id="' + $item.data('id') + '">' + $item.data('name') + '</a>' +
'</li>'
);
methods.resetData({
page: 1,
folderId: $item.data('id')
});
});
// 面包屑导航点击
$('.screen-box ul.breadcrumb').on('click', 'li:not(.active) a', function (e) {
e.preventDefault();
methods.resetData({
page: 1,
folderId: $(this).data('id')
});
$(this).parent('li').addClass('active').nextAll().remove();
});
// 模态框面包屑导航点击
$('.mdui-dialog ul.breadcrumb').on('click', 'li:not(.active) a', function (e) {
e.preventDefault();
methods.getFolders({
id: $(this).data('id')
});
$(this).parent('li').addClass('active').nextAll().remove();
});
// 模态框内文件夹点击操作
$('#folders').on('click', 'ul.mdui-list li.mdui-list-item', function (e) {
var that = this;
methods.getFolders({parentId: $(that).data('id')}, false, function () {
$('#folders ul.breadcrumb li:last-child').removeClass('active');
$('#folders ul.breadcrumb').append(
'<li class="active">' +
' <a data-id="' + $(that).data('id') + '">' + $(that).find('.mdui-list-item-title').text() + '</a>' +
'</li>'
);
});
});
// 确认移动文件夹事件
mdui.JQ('#folders').on('confirm.mdui.dialog', function (e) {
app.ajax("{:url('user/moveImages')}", {
ids: selectedImagesId,
folderId: $('#folders ul.breadcrumb li:last-child a').data('id')
}, function (response) {
if (response.code) {
methods.resetData();
return app.msg(true, response.msg);
}
mdui.alert(response.msg);
})
});
// 加载更多
$('.more').click(function () {
methods.getData();
});
// 筛选
$('.screen-box form').submit(function (e) {
e.preventDefault();
// 清空内容
foldersBox.html('')
imagesBox.html('');
params.keyword = $(this).find("input[name='keyword']").val();
params.page = 1;
methods.getData();
});
// 选中项操作
$('.screen-box .mdui-select.operation').on('close.mdui.select', function () {
if ($(this).val() !== '') {
var selected = $('.images-box .item.choice');
selectedImagesId = [];
if (selected.length) {
selected.each(function (index, value) {
selectedImagesId.push($(value).data('id'));
});
// 删除
if ('delete' === $(this).val()) {
methods.delete(selectedImagesId, true, function () {
selected.remove();
totalBox.text(parseInt(totalBox.text()) - selected.length);
// methods.getData();
});
}
// 移动
if ('move' === $(this).val()) {
methods.getFolders({parentId: $('#folders ul.breadcrumb li:last-child a').data('id')}, true);
}
} else {
app.msg(false, lang('Select at least one data!'))
}
}
});
// 全选
var all = false;
$('#all').click(function () {
var item = $('.images-box .item');
if (0 === item.length) {
return mdui.snackbar({
position: 'right-top',
message: lang('No data available!')
});
}
if (all) {
item.removeClass('choice');
$(this).text(lang('Select all'));
all = false;
} else {
item.removeClass('choice').addClass('choice');
$(this).text(lang('Deselect all'));
all = true;
}
});
// 单选
imagesBox.on('click', '.item i.choice', function () {
$(this).parent('.item').toggleClass('choice');
});
// 图片信息
var info = new mdui.Dialog('#info');
imagesBox.on('click', '.item i.info', function () {
var data = $(this).parent('.item').data('json');
if (data) {
// 标题
infoDialog.find('.mdui-dialog-title').text(data.name);
// 二维码
infoDialog.find('img.qrcode').attr('src', qrcodeApi + data.url);
// 信息
for (x in data) {
var tr = infoDialog.find('tr.' + x);
if (tr.length) {
var value = data[x];
if (x === 'size') {
value = app.bytesToSize(data[x]);
}
if (tr.find('td:last-child input').length) {
tr.find('td:last-child input').val(value);
} else {
tr.find('td:last-child').text(value);
}
}
}
// 按钮
infoDialog.find('.open-url').attr('href', data.url);
infoDialog.find('.copy-url').attr('data-clipboard-text', data.url);
infoDialog.find('.delete-image').attr('data-id', data.id);
info.open();
} else {
app.msg(false, lang('Data exception!'));
}
});
// 删除单张图片
infoDialog.find('.delete-image').click(function () {
var id = $(this).data('id');
if (id) {
info.close();
methods.delete(id, false, function () {
imagesBox.find(".item[data-id='" + id + "']").parent().remove();
totalBox.text(parseInt(totalBox.text()) - 1);
});
} else {
app.msg(false, lang('Data exception!'));
}
});
// 重置数据
$('#reset').click(function () {
methods.resetData();
});
})
</script>
{/block}

View File

@ -1,67 +0,0 @@
{extend name="common:base" /}
{block name="title"}{:lang('Setting')} - {$config.site_name}{/block}
{block name="main"}
<div class="mdui-container">
<main>
<div class="mdui-col-sm-8 mdui-col-md-8">
<form action="{:url('user/settings')}" method="post">
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('User name')}</label>
<input class="mdui-textfield-input" type="text" value="{$user.username}" disabled/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Mailbox')}</label>
<input class="mdui-textfield-input" type="email" value="{$user.email}" disabled/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Create time')}</label>
<input class="mdui-textfield-input" type="text" value="{$user.create_time}" disabled/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">Token</label>
<input class="mdui-textfield-input" type="text" value="{$user.token}" disabled/>
<div class="mdui-textfield-helper">{:lang('Token tip')}</div>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Nickname')}</label>
<input class="mdui-textfield-input" type="text" name="nickname" value="{$user.nickname}" maxlength="15" placeholder="{:lang('Nickname')}"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Default upload folder')}</label>
<input class="mdui-textfield-input" type="text" name="default_folder" value="{$user.default_folder}" maxlength="30" placeholder="{:lang('Default upload folder tip')}"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Old password')}</label>
<input class="mdui-textfield-input" type="password" name="password_old" placeholder="{:lang('Old password tip')}"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Password')}</label>
<input class="mdui-textfield-input" type="password" name="password" placeholder="{:lang('Password tip')}"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">{:lang('Confirm password')}</label>
<input class="mdui-textfield-input" type="password" name="password_confirm" placeholder="{:lang('Confirm password')}"/>
</div>
<div class="mdui-textfield">
<button type="submit" class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme-accent">{:lang('Save')}</button>
<button type="reset" class="mdui-btn mdui-btn-raised mdui-ripple">{:lang('Reset')}</button>
</div>
</form>
</div>
</main>
</div>
{/block}
{block name="js"}
<script>
$(function () {
$('form').submit(function (e) {
e.preventDefault();
app.request(this.action, $(this).serialize(), function () {
history.go(0)
})
});
});
</script>
{/block}

View File

@ -1,391 +0,0 @@
<?php
// [English]
return [
'Home' => 'Home',
'Gallery' => 'Gallery',
'Api' => 'Api',
'My picture' => 'My picture',
'Setting' => 'Setting',
'System management' => 'System',
'Console' => 'Console',
'Role group' => 'Role groups',
'User management' => 'Users',
'Picture management' => 'Pictures',
'Storage' => 'Storages',
'System setting' => 'System setting',
'Sign In' => 'Sign In',
'Sign Up' => 'Sign Up',
'Logout' => 'Logout',
'Used capacity' => 'Used capacity',
'Sign in tip' => 'Please log in and experience',
'Home upload info' => 'Up to %s piece pictures can be uploaded, and %s piece picture can be selected at a time. This site has hosted %s piece pictures.',
'Account input tip' => 'Please enter a user name or email address',
'Password input tip' => 'Please input a password',
'Copy successful' => 'Copy succeeded',
'Copy failed' => 'Copy failed',
'Upload pasted photos?' => 'Upload pasted pictures?',
'Confirm' => 'Confirm',
'Cancel' => 'Cancel',
'Exception occurred' => 'Exception occurred',
'Footer tip' => 'Please do not upload pictures that violate the law. Violators will bear the consequences.',
'%s second%s ago' => '%s second%s ago',
'%s minute%s ago' => '%s minute%s ago',
'%s hour%s ago' => '%s hour%s ago',
'%s day%s ago' => '%s day%s ago',
'%s week%s ago' => '%s week%s ago',
'%s month%s ago' => '%s month%s ago',
'%s year%s ago' => '%s year%s ago',
'See more' => 'See more',
'Loading more' => 'Load more',
'Loading...' => 'Loading...',
'No more' => 'I also have a bottom line~',
'No data available' => 'No data',
'There are %s pictures in total' => 'There are %s pictures in total',
'Select all' => 'Select all',
'Deselect all' => 'Deselect all',
'Selected items' => 'Selected item',
'Move' => 'Move',
'Delete' => 'Delete',
'Reset data' => 'Reset data',
'Enter search...' => 'Press enter search...',
'Are you sure to delete this picture?' => 'Are you sure to delete this picture?',
'Are you sure to delete the selected picture?' => 'Are you sure to delete the selected picture?',
'Folder not found' => 'Folder not found',
'Open' => 'Open',
'Close' => 'Close',
'Rename' => 'Rename',
'Please enter a folder name' => 'Please enter a folder name',
'Are you sure to delete this folder?' => 'Are you sure to delete this folder?',
'See picture' => 'View picture',
'Open picture in new window' => 'Open picture in new window',
'Please enter a picture name' => 'Please enter a picture name',
'Copy link' => 'Copy link',
'Open link' => 'Open link',
'Attribute' => 'Attribute',
'New folder' => 'New folder',
'Refresh' => 'Refresh',
'Select at least one data!' => 'Select at least one data!',
'No data available!' => 'No data',
'Data exception!' => 'Data exception!',
'Picture link' => 'Picture outer chain',
'Alias:' => 'Alias: ',
'Link:' => 'Link: ',
'Position:' => 'Position: ',
'Size:' => 'Size: ',
'MD5:' => 'MD5: ',
'Type:' => 'Type: ',
'User name' => 'User name',
'Mailbox' => 'Mailbox',
'Token tip' => 'Note: token has permission to manage pictures. Please do not disclose it at will.',
'Nickname' => 'Nickname',
'Default upload folder' => 'Default upload folder',
'Default upload folder tip' => 'Default upload folder name (automatically created when there is no upload)',
'Old password' => 'Original password',
'Old password tip' => 'Original password, Do not want to modify please leave blank',
'Account' => 'Account',
'Password' => 'Password',
'Forgot your password?' => 'Forgot your password?',
'Registered account' => 'Registered account',
'Registration closed' => 'Registration closed',
'Send verification code' => 'Send verification code',
'Mail verification code' => 'Mail verification code',
'New password' => 'New password',
'Confirm new password' => 'Confirm new password',
'Reset password' => 'Reset password',
'Password tip' => 'Password, Do not want to modify please leave blank',
'Confirm password' => 'Confirm password',
'Save' => 'Save',
'Reset' => 'Reset',
'Occupied storage' => 'Occupied storage',
'Piece' => 'Piece',
'Number of pictures' => 'Number of pictures',
'Suspicious picture' => 'Suspicious picture',
'Number of users' => 'Number of users',
'Upload today' => 'Upload today',
'Uploaded yesterday' => 'Uploaded yesterday',
'Upload this month' => 'Upload this month',
'Visitor upload' => 'Visitor upload',
'System configuration' => 'System configuration',
'Operating system' => 'Operating system',
'Server IP:' => 'Server IP: ',
'Website domain name:' => 'Website domain name: ',
'Operating environment:' => 'Operating environment: ',
'PHP version:' => 'PHP version: ',
'File upload restrictions:' => 'File upload restrictions: ',
'Software information' => 'Software information',
'Software version:' => 'Software version: ',
'User manual:' => 'User \'s manual: ',
'Warehouse address:' => 'Warehouse address: ',
'System management tips' => 'In system configuration, pay attention to using the &lt;script&gt;&lt;/script&gt; label in the statistics code. If it is not necessary, it can be set to blank. <br> If the basic configuration cannot be saved, please check whether the request is blocked by the firewall.',
'Basic configuration' => 'Basic configuration',
'Upload configuration' => 'Upload configuration',
'User configuration' => 'User configuration',
'Mail configuration' => 'Mail configuration',
'Other configuration' => 'Other configuration',
'Picture identification yellow' => 'Picture identification yellow',
'Test mail sending' => 'Test mail sending',
'Variable name' => 'Variable name',
'Example' => 'Example',
'Explain' => 'Explain',
'Please input mailbox' => 'Please enter email address',
'Turn off registration' => 'Close registration',
'Existing account?' => 'Existing account?',
'Website title' => 'Website title',
'Website keywords' => 'Website keywords',
'Website description' => 'Website description',
'Custom CSS' => 'Custom CSS',
'Statistical code' => 'Statistical code',
'Allow visitors to upload' => 'Allow visitors to upload',
'Allow visitors to upload tip' => 'Can visitors upload',
'Upload max size' => 'Maximum upload size',
'Upload max size tip' => 'Unit: B, default 5242880: 5m',
'Upload single num' => 'Number of single simultaneous uploads',
'Same ip day max upload' => 'Maximum upload limit of the same IP in one day',
'Same ip day max upload tip' => 'If it is 0, there is no limit',
'Upload allowed exts' => 'File suffix allowed to upload',
'Upload allowed exts tip' => 'Comma separated',
'Path naming rule' => 'File path naming rules',
'File naming rule' => 'File naming rules',
'Path naming variable cross reference table' => '<a href="javascript:void(0)" mdui-dialog="{target: \'#path-var\'}">Path naming variable comparison table</a>',
'File naming variable cross reference table' => '<a href="javascript:void(0)" mdui-dialog="{target: \'#file-var\'}">File naming variable cross reference table</a>',
'User initial quota' => 'User initial quota capacity',
'User initial quota tip' => 'Unit: B, default 1073741824: 1g, maximum 18 bits',
'Mail send mode' => 'Mail sending method',
'Mail smtp secure' => 'SMTP authentication method',
'Mail smtp host' => 'SMTP host address',
'Mail smtp username' => 'SMTP user name',
'Mail smtp password' => 'SMTP password',
'Mail smtp port' => 'SMTP port',
'Mail form mailbox' => 'Sender mailbox',
'Icp number' => 'E-ICP prepared No',
'Soft delete' => 'Soft delete',
'Soft delete tip' => 'The source file is not deleted when deleting the picture. It is not recommended to open it',
'Open gallery' => 'Open gallery function',
'Open gallery tip' => 'Open the gallery function, and the pictures uploaded by tourists will appear in the gallery',
'Open api' => 'Enable API',
'Open api tip' => 'Whether to open the interface function',
'Ban ip' => 'Blocked IP',
'Ban ip tip' => 'Blocked IP, multiple are separated by commas',
'Storage strategy' => 'Storage strategy',
'Domain name' => 'Domain name',
'Regional node' => 'Regional node',
'Region' => 'Region',
'Bucket name' => 'Bucket name',
'Operator account' => 'Operator account',
'Operator password' => 'Operator password',
'Cloud storage service name' => 'Cloud storage service name',
'System notice' => 'System announcement',
'System notice tip' => 'Support HTML',
'Remote storage type' => 'Remote storage type',
'Passive mode' => 'Passive mode',
'Connection address' => 'Connection address',
'Login account' => 'Login account',
'Login password' => 'Login password',
'Login mode' => 'Login mode',
'Connection port' => 'Connection port',
'Turn on picture yellow identification' => 'Turn on picture yellow identification',
'Turn on picture yellow identification tip' => 'Interface application address: <a href="https://www.moderatecontent.com" target="_blank">https://www.moderatecontent.com</a>',
'Content rating' => 'Content rating',
'Content rating tip' => '1 = very strict, 2 = strict, 3 = average',
'Very strict' => 'Very strict',
'Strict' => 'Strict',
'Commonly' => 'Commonly',
'System version' => 'System version',
'Default group' => 'Default group',
'Role group tips' => 'Users in different role groups will use different storage strategies to upload pictures. <br/> There is at least one default role group. Newly registered users and visitors will use the default role group. <br/> After the role group is deleted, the users under the group will be reset to the default role group.',
'Strategy used' => 'Use strategy',
'Name' => 'Name',
'Register default' => 'Register default',
'Operation' => 'Operation',
'Edit' => 'Edit',
'Add role group' => 'Add role group',
'Edit role group' => 'Edit role group',
'Group name' => 'Group name',
'Is default' => 'Default',
'Modify' => 'Modify',
'Are you sure to delete this role group?' => 'Are you sure to delete this role group?',
'Are you sure to delete the selected item role group?' => 'Are you sure to delete the selected role group?',
'There are %s users in total' => 'There are %s users in total',
'All' => 'All',
'Normal' => 'Normal',
'Frozen' => 'Frozen',
'Total capacity' => 'Total capacity',
'Account status' => 'Account status',
'Register IP' => 'Register IP',
'Modify user data' => 'Modify user data',
'Storage capacity' => 'Storage capacity',
'Used storage capacity' => 'Used storage capacity',
'Are you sure to delete this user?' => 'Are you sure you want to delete the user?',
'Are you sure to delete the selected user?' => 'Are you sure to delete the selected user?',
'Are you sure to freeze this user?' => 'Are you sure to freeze this user?',
'Are you sure to freeze the selected users?' => 'Are you sure to freeze the selected users?',
'Visitor picture' => 'Visitor picture',
'User' => 'User',
'Alias' => 'Alias',
'Route' => 'Route',
'Size' => 'Size',
'Type' => 'Type',
'Create time' => 'Create time',
'Upload time' => 'Upload time',
'See' => 'See',
'Country:' => 'Country: ',
'Region:' => 'Region: ',
'Area:' => 'Area: ',
'City:' => 'City: ',
'County:' => 'County: ',
'Local' => 'Local',
'Aliyun OSS' => 'Aliyun OSS',
'Tencent COS' => 'Tencent COS',
'Qiniu KODO' => 'Qiniu KODO',
'Upyun USS' => 'Upyun USS',
'Remote' => 'Remote',
'Storage strategy tips' => 'Multiple storage policies can be configured, and different role groups are used to control the user\'s picture storage policy.',
'It is already the latest version' => 'It is already the latest version',
'New version detected [%s]' => 'New version detected[%s]',
'Ignore' => 'Ignore',
'Don\'t prompt again' => 'Don\'t prompt again',
'Upgrade now' => 'Upgrade now',
'Upgrade note' => 'The original system files will be backed up before upgrading, but the \'runtime\' and \'public\' directories and databases will not be included',
'Do you need to back up the original system?' => '⚠ Do you need to back up the original system?',
'Backup' => 'Backup',
'No backup' => 'No backup',
'System prompt' => 'System prompt',
'Upgrading, please do not close the window' => 'Upgrading..., please do not close the window',
'Upgrade failed' => 'Upgrade failed, please try again later(Help documentation: <a target="_blank" href="https://www.kancloud.cn/wispx/lsky-pro/1569428">https://www.kancloud.cn/wispx/lsky-pro/1569428</a>)',
// Admin controller
'Unknown' => 'Unknown',
'Add failed' => 'Add failed',
'Added successfully' => 'Added successfully',
'Edit failed' => 'Edit failed',
'Edit succeeded' => 'Edit succeeded',
'Setting failed' => 'Setting failed',
'Setting succeeded' => 'Setting succeeded',
'Keep at least one default group' => 'Keep at least one default group',
'The default group cannot be deleted' => 'The default group cannot be deleted',
'Storage policy does not exist' => 'Storage policy does not exist',
'Visitor' => 'Visitor',
'Acquisition failed' => 'Acquisition failed',
'Get success' => 'Get success',
'The interface is abnormal, %s' => 'Interface exception, %s',
'Test' => 'Test',
'This is a test email!' => 'This is a test email!',
'Cannot continue, please make sure ZipArrive is installed correctly' => 'Unable to continue, please make sure ZipArchive is installed correctly',
'The current system is the latest version' => 'The current system is the latest version',
'The installation package is corrupt. Please try again later' => 'The installation package is corrupt. Please try again later',
'SQL file acquisition failed' => 'SQL file acquisition failed',
'Failed to get table field configuration file' => 'Failed to get table field profile',
'Upgrade Complete' => 'Upgrade Complete',
'Backup complete, %s' => 'Backup complete, %s',
'You cannot delete your account!' => 'You cannot delete your account!',
'You can\'t freeze your account!' => 'You can\'t freeze your account!',
'Freeze failed' => 'Freeze failed',
'Freeze succeeded' => 'Freeze succeeded',
'Data acquisition failed' => 'Data acquisition failed',
'Success' => 'Success',
'Modification failed' => 'Modification failed',
'Modified successfully' => 'Modified successfully',
'You cannot modify your status' => 'You cannot modify your status',
'Status modification failed' => 'Status modification failed',
'Status modification succeeded' => 'Status modification succeeded',
// Api controller
'The picture data was not found' => 'The picture data was not found',
'Delete succeeded' => 'Delete succeeded',
'Deletion failed' => 'Deletion failed',
'Delete succeeded!' => 'Delete succeeded!',
'Deletion failed!' => 'Deletion failed!',
'Account does not exist' => 'Account does not exist',
'Account password error' => 'Account password error',
'Token refresh failed' => 'Token refresh failed',
'The administrator closed the tourist upload channel' => 'The administrator closed the tourist upload channel',
'The administrator turned off the tourist upload!' => 'The administrator turned off the tourist upload!',
'The number of pictures uploaded today has reached the maximum' => 'The number of pictures uploaded today has reached the maximum',
'Save failed! Your storage capacity is insufficient, please contact the administrator!' => 'Save failed! Your storage capacity is insufficient, please contact the administrator!',
'Your account is frozen, please contact the administrator!' => 'Your account is frozen. Please contact the administrator!',
'Abnormal configuration of automatic watermark function' => 'Abnormal configuration of automatic watermark function',
'Upload failed. Please check whether the policy configuration is correct!' => 'Upload failed, please check whether the policy configuration is correct!',
'The picture %s is suspected of violation. Uploading is prohibited!' => 'The picture [%s] is suspected to be illegal. Upload is prohibited!',
'Folder creation failed!' => 'Folder creation failed!',
'Failed to save picture data' => 'Failed to save picture data',
'Picture resource acquisition failed' => 'Picture resource acquisition failed',
'Please enter the account number' => 'Please enter the account number',
'Please input a password' => 'Please input a password',
'Your account has been frozen, please contact the administrator!' => 'Your account has been frozen, please contact the administrator!',
'Incorrect password' => 'Incorrect password',
'User does not exist' => 'User does not exist',
// Validate
'Parent folder not found' => 'Parent folder not found',
'Parent folder exception' => 'Parent folder exception',
'Folder name cannot be empty' => 'Folder name cannot be empty',
'Folder name length max. 30 characters' => 'The folder name can be up to 30 characters long',
'Folder names can only be Chinese characters, letters and numbers' => 'Folder names can only be Chinese characters, letters and numbers',
'Role group name cannot be empty' => 'Role group name cannot be empty',
'The maximum length of the role group name is 30 characters' => 'The maximum length of the role group name is 30 characters',
'The role group name can only be Chinese characters, letters and numbers' => 'The role group name can only be Chinese characters, letters and numbers',
'User name cannot be empty' => 'User name cannot be empty',
'The user name cannot be less than three characters' => 'The user name cannot be less than three characters',
'User names can only be letters, numbers, and underscores_ And dash-' => 'User names can only be letters, numbers, and underscores_ And dash-',
'The user name character length exceeds the limit' => 'User name character length exceeds',
'User name already exists, please replace' => 'User name already exists, please replace',
'The length of nickname characters exceeds the limit' => 'Nickname character length exceeds',
'Default upload folder name length exceeds limit' => 'Default upload folder name length exceeds',
'The default upload folder name can only be Chinese characters, letters and numbers' => 'The default upload folder name can only be Chinese characters, letters and numbers',
'Mailbox cannot be empty' => 'Mailbox cannot be empty',
'The mailbox format is incorrect' => 'The mailbox format is incorrect',
'Mailbox character length exceeds the limit' => 'Mailbox character length exceeds the limit',
'Mailbox already exists' => 'Mailbox already exists',
'Password cannot be empty' => 'Password cannot be empty',
'The passwords entered twice are inconsistent' => 'The passwords entered twice are inconsistent',
'Please enter the verification code' => 'Please enter the verification code',
'Verification code error' => 'Verification code error',
// Middleware
'The administrator turned off API functionality' => 'The administrator has closed the API',
'Authentication failed' => 'Authentication failed',
'Token does not exist' => 'Token does not exist',
// Index controller
'Site registration closed' => 'Site registration closed',
'Registration successful' => 'Registration successful',
'Incorrect verification code' => 'Incorrect verification code',
'Reset successful' => 'Reset successful',
'Verification Code' => 'Verification Code',
'Retrieve password' => 'Retrieve password',
'Retrieve password mail content' => "Dear %s, you are applying for password reset. The verification code this time is <b> %s </b>. If it is not your own operation, please ignore it!",
'Sent successfully' => 'Sent successfully',
'Welcome back' => 'Welcome back',
'Gallery feature is off' => 'Gallery feature is off',
'API interface closed' => 'API interface closed',
'Installed tips' => 'You have successfully installed. Please delete the install.lock file if you need to re install',
'The database SQL file does not exist' => 'The database SQL file does not exist',
'Data written successfully' => 'Data written successfully',
'The passwords entered twice are inconsistent!' => 'The passwords entered twice are inconsistent!',
'Configuration file write failed' => 'Configuration file write failed',
'Setup lock file creation failed' => 'Failed to create the installation lock file',
'Set successfully' => 'Set successfully',
'Upload succeeded' => 'Upload succeeded',
'Created successfully' => 'Created successfully',
'Move succeeded' => 'Move succeeded',
'Move failed' => 'Move failed',
'The folder does not exist!' => 'The folder does not exist!',
'Rename succeeded' => 'Rename succeeded',
'Rename failed' => 'Rename failed',
'The original password is incorrect' => 'The original password is incorrect',
'Saved successfully' => 'Saved successfully',
'Batch deletion failed' => 'Batch deletion failed',
// Naming config
'Year' => 'Year',
'Month' => 'Month',
'Day' => 'Day',
'Upload date' => 'Upload date',
'Unique ID' => 'Unique ID',
'MD5 (non file)' => 'MD5 (non file)',
'16 bit random string' => '16 bit random string',
'8 bit random string' => '8 bit random string',
'Nothing' => 'Nothing',
'Original file name' => 'Original file name',
];

View File

@ -1,391 +0,0 @@
<?php
// [简体中文]
return [
'Home' => '首页',
'Gallery' => '画廊',
'Api' => '接口',
'My picture' => '我的图片',
'Setting' => '设置',
'System management' => '系统管理',
'Console' => '控制台',
'Role group' => '角色组',
'User management' => '用户管理',
'Picture management' => '图片管理',
'Storage' => '储存策略',
'System setting' => '系统设置',
'Sign In' => '登录',
'Sign Up' => '注册',
'Logout' => '退出账号',
'Used capacity' => '使用容量',
'Sign in tip' => '请登录后体验',
'Home upload info' => '最大可上传 %s 的图片,单次同时可选择 %s 张。本站已托管 %s 张图片。',
'Account input tip' => '请输入用户名或邮箱',
'Password input tip' => '请输入密码',
'Copy successful' => '复制成功',
'Copy failed' => '复制失败',
'Upload pasted photos?' => '是否上传粘贴的图片?',
'Confirm' => '确定',
'Cancel' => '取消',
'Exception occurred' => '发生异常',
'Footer tip' => '请勿上传违反中国大陆和香港法律的图片,违者后果自负。',
'%s second%s ago' => '%s秒前',
'%s minute%s ago' => '%s分钟前',
'%s hour%s ago' => '%s小时前',
'%s day%s ago' => '%s天前',
'%s week%s ago' => '%s周前',
'%s month%s ago' => '%s月前',
'%s year%s ago' => '%s年前',
'See more' => '查看更多',
'Loading more' => '加载更多',
'Loading...' => '加载中...',
'No more' => '我也是有底线的~',
'No data available' => '暂无数据',
'There are %s pictures in total' => '共有 %s 张图片',
'Select all' => '全选',
'Deselect all' => '取消全选',
'Selected items' => '选中项',
'Move' => '移动',
'Delete' => '删除',
'Reset data' => '重置数据',
'Enter search...' => '回车搜索...',
'Are you sure to delete this picture?' => '确认删除该图片吗?',
'Are you sure to delete the selected picture?' => '确认删除选中项图片吗?',
'Folder not found' => '没有找到文件夹',
'Open' => '打开',
'Close' => '关闭',
'Rename' => '重新命名',
'Please enter a folder name' => '请输入文件夹名称',
'Are you sure to delete this folder?' => '确认删除该文件夹吗?',
'See picture' => '查看图片',
'Open picture in new window' => '新窗口打开图片',
'Please enter a picture name' => '请输入图片名称',
'Copy link' => '复制链接',
'Open link' => '打开链接',
'Attribute' => '属性',
'New folder' => '新建文件夹',
'Refresh' => '刷新',
'Select at least one data!' => '至少选择一项数据!',
'No data available!' => '暂无数据',
'Data exception!' => '数据异常!',
'Picture link' => '图片外链',
'Alias:' => '别名:',
'Link:' => '链接:',
'Position:' => '位置:',
'Size:' => '大小:',
'MD5:' => 'MD5',
'Type:' => '类型:',
'User name' => '用户名',
'Mailbox' => '邮箱',
'Token tip' => '注意Token 具有管理图片权限,请不要随意泄漏。',
'Nickname' => '昵称',
'Default upload folder' => '默认上传文件夹',
'Default upload folder tip' => '默认上传文件夹名(不存在上传时自动创建)',
'Old password' => '原密码',
'Old password tip' => '原密码,不修改请留空',
'Account' => '账号',
'Password' => '密码',
'Forgot your password?' => '忘记密码?',
'Registered account' => '注册账号',
'Registration closed' => '已关闭注册',
'Send verification code' => '发送验证码',
'Mail verification code' => '邮件验证码',
'New password' => '新密码',
'Confirm new password' => '确认新密码',
'Reset password' => '重置密码',
'Password tip' => '密码,不修改请留空',
'Confirm password' => '确认密码',
'Save' => '保存',
'Reset' => '重置',
'Occupied storage' => '占用储存',
'Piece' => '张',
'Number of pictures' => '图片数量',
'Suspicious picture' => '可疑图片',
'Number of users' => '用户数量',
'Upload today' => '今日上传',
'Uploaded yesterday' => '昨日上传',
'Upload this month' => '本月上传',
'Visitor upload' => '游客上传',
'System configuration' => '系统配置',
'Operating system' => '操作系统',
'Server IP:' => '服务器 IP',
'Website domain name:' => '网站域名:',
'Operating environment:' => '运行环境:',
'PHP version:' => 'PHP 版本',
'File upload restrictions:' => '文件上传限制:',
'Software information' => '软件信息',
'Software version:' => '软件版本:',
'User manual:' => '用户手册:',
'Warehouse address:' => '仓库地址:',
'System management tips' => '系统配置,统计代码中注意要使用&lt;script&gt;&lt;/script&gt;标签,不设置可为空。<br>基础配置如果出现无法保存的情况请检查请求是否被防火墙拦截。',
'Basic configuration' => '基础配置',
'Upload configuration' => '上传配置',
'User configuration' => '用户配置',
'Mail configuration' => '邮件配置',
'Other configuration' => '其他配置',
'Picture identification yellow' => '图片鉴黄',
'Test mail sending' => '测试邮件发送',
'Variable name' => '变量名',
'Example' => '示例',
'Explain' => '说明',
'Please input mailbox' => '请输入邮箱',
'Turn off registration' => '关闭注册',
'Existing account?' => '已有账号?',
'Website title' => '网站标题',
'Website keywords' => '网站关键字',
'Website description' => '网站描述',
'Custom CSS' => '自定义CSS',
'Statistical code' => '统计代码',
'Allow visitors to upload' => '允许游客上传',
'Allow visitors to upload tip' => '是否允许游客上传',
'Upload max size' => '最大上传大小',
'Upload max size tip' => '单位b默认52428805M',
'Upload single num' => '单次同时上传数量',
'Same ip day max upload' => '相同ip一天内最大上传限制',
'Same ip day max upload tip' => '为0则不限制',
'Upload allowed exts' => '允许上传的文件后缀',
'Upload allowed exts tip' => '逗号隔开',
'Path naming rule' => '文件路径命名规则',
'File naming rule' => '文件命名规则',
'Path naming variable cross reference table' => '<a href="javascript:void(0)" mdui-dialog="{target: \'#path-var\'}">路径命名变量对照表</a>',
'File naming variable cross reference table' => '<a href="javascript:void(0)" mdui-dialog="{target: \'#file-var\'}">文件命名变量对照表</a>',
'User initial quota' => '用户初始配额容量',
'User initial quota tip' => '单位b默认10737418241G最大18位',
'Mail send mode' => '邮件发送方式',
'Mail smtp secure' => 'SMTP验证方式',
'Mail smtp host' => 'SMTP主机地址',
'Mail smtp username' => 'SMTP用户名',
'Mail smtp password' => 'SMTP密码',
'Mail smtp port' => 'SMTP端口',
'Mail form mailbox' => '发件人邮箱',
'Icp number' => '备案号',
'Soft delete' => '软删除',
'Soft delete tip' => '删除图片时不删除源文件,不建议开启',
'Open gallery' => '开启画廊',
'Open gallery tip' => '开启画廊功能,游客上传的图片将会出现在画廊中',
'Open api' => '开启API',
'Open api tip' => '是否开放接口',
'Ban ip' => '封禁IP',
'Ban ip tip' => '封禁IP, 多个使用逗号隔开',
'Storage strategy' => '储存策略',
'Domain name' => '域名',
'Regional node' => '地域节点',
'Region' => '所属区域',
'Bucket name' => '储存桶名称',
'Operator account' => '操作员账号',
'Operator password' => '操作员密码',
'Cloud storage service name' => '云储存服务名称',
'System notice' => '系统公告',
'System notice tip' => '支持html',
'Remote storage type' => '远程储存类型',
'Passive mode' => '被动模式',
'Connection address' => '连接地址',
'Login account' => '登录账号',
'Login password' => '登录密码',
'Login mode' => '登录方式',
'Connection port' => '连接端口',
'Turn on picture yellow identification' => '开启图片鉴黄',
'Turn on picture yellow identification tip' => '接口申请地址:<a href="https://www.moderatecontent.com" target="_blank">https://www.moderatecontent.com</a>',
'Content rating' => '内容评级',
'Content rating tip' => '1=非常严格2=严格3=一般',
'Very strict' => '非常严格',
'Strict' => '严格',
'Commonly' => '一般',
'System version' => '系统版本',
'Default group' => '默认组',
'Role group tips' => '不同的角色组下的用户,上传图片将使用不同的储存策略。<br>至少有一个默认角色组,新注册用户和访客将会使用默认的角色组。<br>角色组删除后,该组下面的用户将重置默认角色组。',
'Strategy used' => '使用策略',
'Name' => '名称',
'Register default' => '注册默认',
'Operation' => '操作',
'Edit' => '编辑',
'Add role group' => '添加角色组',
'Edit role group' => '编辑角色组',
'Group name' => '组名称',
'Is default' => '是否默认',
'Modify' => '修改',
'Are you sure to delete this role group?' => '确认删除该角色组吗?',
'Are you sure to delete the selected item role group?' => '确认删除选中项角色组吗?',
'There are %s users in total' => '共有 %s 个用户',
'All' => '全部',
'Normal' => '正常',
'Frozen' => '冻结',
'Total capacity' => '总容量',
'Account status' => '账号状态',
'Register IP' => '注册IP',
'Modify user data' => '修改用户数据',
'Storage capacity' => '储存容量',
'Used storage capacity' => '已使用储存容量',
'Are you sure to delete this user?' => '确认删除该用户吗?',
'Are you sure to delete the selected user?' => '确认删除选中项用户吗?',
'Are you sure to freeze this user?' => '确认冻结该用户吗?',
'Are you sure to freeze the selected users?' => '确认冻结选中项用户吗?',
'Visitor picture' => '访客图片',
'User' => '所属用户',
'Alias' => '别名',
'Route' => '路径',
'Size' => '大小',
'Type' => '类型',
'Create time' => '创建时间',
'Upload time' => '上传时间',
'See' => '查看',
'Country:' => '国家:',
'Region:' => '地区:',
'Area:' => '区域:',
'City:' => '城市:',
'County:' => '县:',
'Local' => '本地',
'Aliyun OSS' => '阿里云OSS',
'Tencent COS' => '腾讯云COS',
'Qiniu KODO' => '七牛云KODO',
'Upyun USS' => '又拍云USS',
'Remote' => '远程',
'Storage strategy tips' => '储存策略,可配置多个,使用不同的角色组来控制用户图片储存策略。',
'It is already the latest version' => '已经是最新版本',
'New version detected [%s]' => '检测到新版本[%s]',
'Ignore' => '忽略',
'Don\'t prompt again' => '不再提示',
'Upgrade now' => '立即升级',
'Upgrade note' => '将会在升级前备份原系统文件, 但不包括 runtime 和 public 目录以及数据库',
'Do you need to back up the original system?' => '⚠ 是否需要备份原系统?',
'Backup' => '备份',
'No backup' => '不备份',
'System prompt' => '系统提示',
'Upgrading, please do not close the window' => '升级中, 请不要关闭窗口...',
'Upgrade failed' => '升级失败, 请稍后重试(帮助文档: <a target="_blank" href="https://www.kancloud.cn/wispx/lsky-pro/1569428">https://www.kancloud.cn/wispx/lsky-pro/1569428</a>)',
// Admin controller
'Unknown' => '未知',
'Add failed' => '添加失败',
'Added successfully' => '添加成功',
'Edit failed' => '编辑失败',
'Edit succeeded' => '编辑成功',
'Setting failed' => '设置失败',
'Setting succeeded' => '设置成功',
'Keep at least one default group' => '至少保留一个默认组',
'The default group cannot be deleted' => '默认组不可删除',
'Storage policy does not exist' => '储存策略不存在',
'Visitor' => '访客',
'Acquisition failed' => '获取失败',
'Get success' => '获取成功',
'The interface is abnormal, %s' => '接口发生异常,%s',
'Test' => '测试',
'This is a test email!' => '这是一封测试邮件!',
'Cannot continue, please make sure ZipArrive is installed correctly' => '无法继续执行, 请确保 ZipArchive 正确安装',
'The current system is the latest version' => '当前系统已经是最新版',
'The installation package is corrupt. Please try again later' => '安装包损坏, 请稍后重试',
'SQL file acquisition failed' => 'SQL 文件获取失败',
'Failed to get table field configuration file' => '表字段配置文件获取失败',
'Upgrade Complete' => '升级完成',
'Backup complete, %s' => '备份完成,%s',
'You cannot delete your account!' => '不能删除自己的账号!',
'You can\'t freeze your account!' => '不能冻结自己的账号!',
'Freeze failed' => '冻结失败',
'Freeze succeeded' => '冻结成功',
'Data acquisition failed' => '数据获取失败',
'Success' => '成功',
'Modification failed' => '修改失败',
'Modified successfully' => '修改成功',
'You cannot modify your status' => '不可修改自己的状态',
'Status modification failed' => '状态修改失败',
'Status modification succeeded' => '状态修改成功',
// Api controller
'The picture data was not found' => '未找到该图片数据',
'Delete succeeded' => '删除成功',
'Deletion failed' => '删除失败',
'Delete succeeded!' => '删除成功!',
'Deletion failed!' => '删除失败!',
'Account does not exist' => '账号不存在',
'Account password error' => '账号密码错误',
'Token refresh failed' => 'Token 刷新失败',
'The administrator closed the tourist upload channel' => '管理员关闭了游客上传通道',
'The administrator turned off the tourist upload!' => '管理员关闭了游客上传!',
'The number of pictures uploaded today has reached the maximum' => '今日图片上传数量已达到上限',
'Save failed! Your storage capacity is insufficient, please contact the administrator!' => '保存失败!您的储存容量不足,请联系管理员!',
'Your account is frozen, please contact the administrator!' => '你的账号被冻结,请联系管理员!',
'Abnormal configuration of automatic watermark function' => '自动水印功能配置异常',
'Upload failed. Please check whether the policy configuration is correct!' => '上传失败,请检查策略配置是否正确!',
'The picture %s is suspected of violation. Uploading is prohibited!' => '图片[%s]涉嫌违规,禁止上传!',
'Folder creation failed!' => '文件夹创建失败!',
'Failed to save picture data' => '图片数据保存失败',
'Picture resource acquisition failed' => '图片资源获取失败',
'Please enter the account number' => '请输入账号',
'Please input a password' => '请输入密码',
'Your account has been frozen, please contact the administrator!' => '你的账户已被冻结,请联系管理员!',
'Incorrect password' => '密码不正确',
'User does not exist' => '用户不存在',
// Validate
'Parent folder not found' => '没有找到上级文件夹',
'Parent folder exception' => '上级文件夹异常',
'Folder name cannot be empty' => '文件夹名称不能为空',
'Folder name length max. 30 characters' => '文件夹名称长度最大30个字符',
'Folder names can only be Chinese characters, letters and numbers' => '文件夹名称只能是汉字、字母和数字',
'Role group name cannot be empty' => '角色组名称不能为空',
'The maximum length of the role group name is 30 characters' => '角色组名称长度最大30个字符',
'The role group name can only be Chinese characters, letters and numbers' => '角色组名称只能是汉字、字母和数字',
'User name cannot be empty' => '用户名不能为空',
'The user name cannot be less than three characters' => '用户名不能少于三个字符',
'User names can only be letters, numbers, and underscores_ And dash-' => '用户名只能是字母、数字和下划线_及破折号-',
'The user name character length exceeds the limit' => '用户名字符长度超出',
'User name already exists, please replace' => '用户名已存在,请更换',
'The length of nickname characters exceeds the limit' => '昵称字符长度超出',
'Default upload folder name length exceeds limit' => '默认上传文件夹名称长度超出',
'The default upload folder name can only be Chinese characters, letters and numbers' => '默认上传文件夹名称只能是汉字、字母和数字',
'Mailbox cannot be empty' => '邮箱不能为空',
'The mailbox format is incorrect' => '邮箱格式不正确',
'Mailbox character length exceeds the limit' => '邮箱字符长度超出',
'Mailbox already exists' => '邮箱已存在',
'Password cannot be empty' => '密码不能为空',
'The passwords entered twice are inconsistent' => '两次输入的密码不一致',
'Please enter the verification code' => '请输入验证码',
'Verification code error' => '验证码错误',
// Middleware
'The administrator turned off API functionality' => '管理员关闭了接口',
'Authentication failed' => '认证失败',
'Token does not exist' => 'Token 不存在',
// Index controller
'Site registration closed' => '站点已关闭注册',
'Registration successful' => '注册成功',
'Incorrect verification code' => '验证码不正确',
'Reset successful' => '重置成功',
'Verification Code' => '验证码',
'Retrieve password' => '找回密码',
'Retrieve password mail content' => "尊敬的 %s 您好,您正在申请重置密码操作,本次的验证码是 <b>%s</b>,如果不是您本人操作请忽略!",
'Sent successfully' => '发送成功',
'Welcome back' => '欢迎回来',
'Gallery feature is off' => '画廊功能已关闭',
'API interface closed' => 'API 接口已关闭',
'Installed tips' => '你已安装成功,需要重新安装请删除 install.lock 文件',
'The database SQL file does not exist' => '数据库 SQL 文件不存在',
'Data written successfully' => '数据写入成功',
'The passwords entered twice are inconsistent!' => '两次输入的密码不一致!',
'Configuration file write failed' => '配置文件写入失败',
'Setup lock file creation failed' => '安装锁文件创建失败',
'Set successfully' => '设置成功',
'Upload succeeded' => '上传成功',
'Created successfully' => '创建成功',
'Move succeeded' => '移动成功',
'Move failed' => '移动失败',
'The folder does not exist!' => '该文件夹不存在!',
'Rename succeeded' => '重命名成功',
'Rename failed' => '重命名失败',
'The original password is incorrect' => '原密码不正确',
'Saved successfully' => '保存成功',
'Batch deletion failed' => '批量删除失败',
// Naming config
'Year' => '年',
'Month' => '月',
'Day' => '日',
'Upload date' => '上传日期',
'Unique ID' => '唯一ID',
'MD5 (non file)' => 'md5(非文件md5)',
'16 bit random string' => '16位随机字符串',
'8 bit random string' => '8位随机字符串',
'Nothing' => '无',
'Original file name' => '原文件名',
];

View File

@ -1,13 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// 应用容器绑定定义
return [];

View File

@ -1,175 +0,0 @@
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `lsky`
--
--
-- 表的结构 `lsky_config`
--
DROP TABLE IF EXISTS `lsky_config`;
CREATE TABLE IF NOT EXISTS `lsky_config` (
`id` smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
`key` varchar(32) DEFAULT NULL COMMENT 'key',
`type` varchar(32) NOT NULL DEFAULT 'text' COMMENT 'text|bool|textarea|select',
`input_type` varchar(32) NOT NULL DEFAULT 'text' COMMENT 'input type属性',
`name` varchar(32) CHARACTER SET utf8mb4 NOT NULL UNIQUE COMMENT '配置名',
`title` varchar(100) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '配置标题',
`tip` varchar(1000) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '配置描述',
`value` text CHARACTER SET utf8mb4 NOT NULL COMMENT '配置值',
`extend` text CHARACTER SET utf8mb4 NOT NULL COMMENT '扩展属性',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='系统配置' ROW_FORMAT=COMPACT;
--
-- 表的结构 `lsky_images`
--
DROP TABLE IF EXISTS `lsky_images`;
CREATE TABLE IF NOT EXISTS `lsky_images` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
`user_id` int(11) NOT NULL DEFAULT 0 COMMENT '用户ID为0表示游客上传',
`folder_id` int(11) NOT NULL DEFAULT 0 COMMENT '文件夹ID',
`strategy` varchar(32) NOT NULL DEFAULT 'local' COMMENT '储存策略,默认本地',
`path` varchar(500) NOT NULL COMMENT '保存路径',
`name` varchar(500) NOT NULL COMMENT '保存名称',
`alias_name` varchar(255) NULL DEFAULT NULL COMMENT '别名',
`pathname` varchar(500) NOT NULL COMMENT '保存名称',
`size` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '图片大小(字节b)',
`mime` varchar(32) NOT NULL COMMENT '文件MIME类型',
`sha1` varchar(100) NOT NULL COMMENT 'hash sha1',
`md5` varchar(32) NOT NULL COMMENT 'hash md5',
`ip` varchar(128) DEFAULT NULL COMMENT '上传者IP',
`suspicious` tinyint(1) NOT NULL DEFAULT '0' COMMENT '可疑图片',
`create_time` int(11) NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='图片表';
--
-- 表的结构 `lsky_users`
--
DROP TABLE IF EXISTS `lsky_users`;
CREATE TABLE IF NOT EXISTS `lsky_users` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL DEFAULT '0' COMMENT '角色组ID',
`username` varchar(32) NOT NULL UNIQUE COMMENT '用户名',
`nickname` varchar(32) DEFAULT NULL COMMENT '昵称',
`email` varchar(100) NOT NULL UNIQUE COMMENT '邮箱',
`password` varchar(32) NOT NULL COMMENT '密码',
`quota` decimal(20,2) NOT NULL DEFAULT '0.00' COMMENT '可用配额容量(字节b)',
`default_folder` varchar(32) DEFAULT NULL COMMENT '默认上传文件夹',
`is_admin` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否为管理员',
`state` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0冻结1正常',
`token` varchar(32) DEFAULT NULL COMMENT 'Token',
`reg_ip` varchar(128) DEFAULT NULL COMMENT '注册IP',
`delete_time` int(11) DEFAULT NULL COMMENT '删除时间',
`update_time` int(11) NOT NULL COMMENT '更新时间',
`create_time` int(11) NOT NULL COMMENT '添加时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='用户表';
--
-- 表的结构 `lsky_folders`
--
DROP TABLE IF EXISTS `lsky_folders`;
CREATE TABLE `lsky_folders` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`user_id` int(11) NOT NULL COMMENT '用户ID',
`parent_id` int(11) NOT NULL DEFAULT '0' COMMENT '上级文件夹ID',
`name` varchar(100) NOT NULL COMMENT '文件夹名称',
`delete_time` int(11) DEFAULT NULL COMMENT '删除时间',
`update_time` int(11) DEFAULT NULL COMMENT '更新时间',
`create_time` int(11) DEFAULT NULL COMMENT '添加时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='文件夹表';
--
-- 表的结构 `lsky_users_group`
--
DROP TABLE IF EXISTS `lsky_group`;
CREATE TABLE `lsky_group` (
`id` INT NOT NULL AUTO_INCREMENT COMMENT 'ID',
`strategy` varchar(32) NOT NULL COMMENT '使用策略',
`name` varchar(32) NOT NULL COMMENT '组名称',
`default` tinyint(1) NOT NULL DEFAULT '0' COMMENT '默认',
`update_time` int(11) DEFAULT NULL COMMENT '更新时间',
`create_time` int(11) DEFAULT NULL COMMENT '添加时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='文件夹表';
-- --------------------------------------------------------
--
-- 表中的数据 `lsky_config`
--
INSERT INTO `lsky_config` (`id`, `key`, `type`, `input_type`, `name`, `title`, `tip`, `value`, `extend`) VALUES
(NULL, 'basics', 'bool', 'checkbox', 'close_register', 'Turn off registration', NULL, '0', ''),
(NULL, 'basics', 'text', 'text', 'site_name', 'Website title', NULL, 'Lsky Pro', ''),
(NULL, 'basics', 'text', 'text', 'site_keywords', 'Website keywords', NULL, 'Lsky Pro', ''),
(NULL, 'basics', 'text', 'text', 'site_description', 'Website description', NULL, 'Lsky Pro, Your photo album on the cloud.', ''),
(NULL, 'basics', 'textarea', 'textarea', 'custom_style', 'Custom CSS', NULL, '<!-- 可以直接引入第三方css样式 -->\r\n<style>\r\n /* body {} */\r\n</style>', ''),
(NULL, 'basics', 'textarea', 'textarea', 'statistics_code', 'Statistical code', NULL, '<script>\r\n// js统计代码</script>', ''),
(NULL, 'basics', 'text', 'text', 'icp_number', 'Icp number', NULL, '', ''),
(NULL, 'upload', 'bool', 'checkbox', 'allowed_tourist_upload', 'Allow visitors to upload', 'Allow visitors to upload tip', '1', ''),
(NULL, 'upload', 'text', 'text', 'upload_max_size', 'Upload max size', 'Upload max size tip', '5242880', ''),
(NULL, 'upload', 'text', 'number', 'upload_single_num', 'Upload single num', NULL, '10', ''),
(NULL, 'upload', 'text', 'number', 'same_ip_day_max_upload', 'Same ip day max upload', 'Same ip day max upload tip', '0', ''),
(NULL, 'upload', 'text', 'text', 'upload_allowed_exts', 'Upload allowed exts', 'Upload allowed exts tip', 'jpg,jpeg,gif,png,ico', ''),
(NULL, 'upload', 'text', 'text', 'path_naming_rule', 'Path naming rule', 'Path naming variable cross reference table', '{Y}/{m}/{d}', ''),
(NULL, 'upload', 'text', 'text', 'file_naming_rule', 'File naming rule', 'File naming variable cross reference table', '{uniqid}', ''),
(NULL, 'user', 'text', 'text', 'user_initial_quota', 'User initial quota', 'User initial quota tip', '1073741824', ''),
(NULL, 'mail', 'select', 'text', 'mail_send_mode', 'Mail send mode', NULL, 'smtp', '{\"smtp\":\"SMTP\"}'),
(NULL, 'mail', 'select', 'text', 'mail_smtp_secure', 'Mail smtp secure', NULL, 'none', '{\"none\":\"None\",\"tls\":\"TLS\",\"ssl\":\"SSL\"}'),
(NULL, 'mail', 'text', 'text', 'mail_smtp_host', 'Mail smtp host', NULL, '', ''),
(NULL, 'mail', 'text', 'text', 'mail_smtp_username', 'Mail smtp username', NULL, '', ''),
(NULL, 'mail', 'text', 'password', 'mail_smtp_password', 'Mail smtp password', NULL, '', ''),
(NULL, 'mail', 'text', 'number', 'mail_smtp_port', 'Mail smtp port', '25/465', '25', ''),
(NULL, 'mail', 'text', 'email', 'mail_form_email', 'Mail form mailbox', NULL, '', ''),
(NULL, 'other', 'bool', 'checkbox', 'soft_delete', 'Soft delete', 'Soft delete tip', '0', ''),
(NULL, 'other', 'bool', 'checkbox', 'open_gallery', 'Open gallery', 'Open gallery tip', '0', ''),
(NULL, 'other', 'bool', 'checkbox', 'open_api', 'Open api', 'Open api tip', '0', ''),
(NULL, 'other', 'textarea', 'textarea', 'ban_ip', 'Ban ip', 'Ban ip tip', '', ''),
(NULL, 'storage_strategy', 'select', 'text', 'storage_strategy', 'Storage strategy', NULL, 'local', ''),
(NULL, 'local', 'text', 'text', 'local_cdn_domain', 'Domain name', NULL, '', ''),
(NULL, 'oss', 'text', 'text', 'oss_cdn_domain', 'Domain name', NULL, '', ''),
(NULL, 'oss', 'text', 'text', 'oss_access_key_id', 'AccessKeyId', NULL, '', ''),
(NULL, 'oss', 'text', 'text', 'oss_access_key_secret', 'AccessKeySecret', NULL, '', ''),
(NULL, 'oss', 'text', 'text', 'oss_endpoint', 'Endpoint', 'Regional node', '', ''),
(NULL, 'oss', 'text', 'text', 'oss_bucket', 'Bucket', NULL, '', ''),
(NULL, 'cos', 'text', 'text', 'cos_cdn_domain', 'Domain name', NULL, '', ''),
(NULL, 'cos', 'text', 'text', 'cos_secret_id', 'SecretId', NULL, '', ''),
(NULL, 'cos', 'text', 'text', 'cos_secret_key', 'SecretKey', NULL, '', ''),
(NULL, 'cos', 'text', 'text', 'cos_region', 'Region', NULL, '', ''),
(NULL, 'cos', 'text', 'text', 'cos_bucket', 'Bucket', 'Bucket name', '', ''),
(NULL, 'kodo', 'text', 'text', 'kodo_cdn_domain', 'Domain name', NULL, '', ''),
(NULL, 'kodo', 'text', 'text', 'kodo_access_key', 'AccessKey', NULL, '', ''),
(NULL, 'kodo', 'text', 'text', 'kodo_secret_key', 'SecretKey', NULL, '', ''),
(NULL, 'kodo', 'text', 'text', 'kodo_bucket', 'Bucket', NULL, '', ''),
(NULL, 'uss', 'text', 'text', 'uss_cdn_domain', 'Domain name', NULL, '', ''),
(NULL, 'uss', 'text', 'text', 'uss_operator_name', 'OperatorName', 'Operator account', '', ''),
(NULL, 'uss', 'text', 'password', 'uss_operator_pwd', 'OperatorPwd', 'Operator password', '', ''),
(NULL, 'uss', 'text', 'text', 'uss_service_name', 'ServiceName', 'Cloud storage service name', '', ''),
(NULL, 'basics', 'textarea', 'textarea', 'notice', 'System notice', 'System notice tip', '', ''),
(NULL, 'remote', 'text', 'text', 'remote_cdn_domain', 'Domain name', NULL, '', ''),
(NULL, 'remote', 'select', 'text', 'remote_type', 'Remote storage type', NULL, 'ftp', '{\"ftp\":\"ftp\"}'),
(NULL, 'remote', 'bool', 'checkbox', 'remote_pasv', 'Passive mode', NULL, '0', ''),
(NULL, 'remote', 'text', 'text', 'remote_host', 'Connection address', NULL, '', ''),
(NULL, 'remote', 'text', 'text', 'remote_name', 'Login account', NULL, '', ''),
(NULL, 'remote', 'text', 'password', 'remote_password', 'Login password', NULL, '', ''),
(NULL, 'remote', 'text', 'number', 'remote_port', 'Connection port', NULL, '21', ''),
(NULL, 'audit', 'bool', 'checkbox', 'open_audit', 'Turn on picture yellow identification', 'Turn on picture yellow identification tip', '0', ''),
(NULL, 'audit', 'text', 'text', 'audit_key', 'Key', NULL, '', ''),
(NULL, 'audit', 'select', 'text', 'audit_index', 'Content rating', 'Content rating tip', '3', '{\"1\": \"Very strict\", \"2\": \"Strict\", \"3\": \"Commonly\"}'),
(NULL, '', 'text', 'text', 'system_version', 'System version', NULL, '1.6.4', '');
INSERT INTO `lsky_group` (`id`, `strategy`, `name`, `default`, `update_time`, `create_time`) VALUES (NULL, 'local', 'Default group', '1', '0', '0');

View File

@ -1,117 +0,0 @@
--
-- Sql更新文件选择数据库后导入或直接复制内容执行
--
-- v1.2.0
UPDATE `lsky_config` SET `value` = '1.2.1' WHERE `lsky_config`.`name` = 'system_version';
-- v1.3.2
UPDATE `lsky_config` SET `value` = '1.3.2' WHERE `lsky_config`.`name` = 'system_version';
INSERT IGNORE INTO `lsky_config` (`id`, `key`, `type`, `input_type`, `name`, `title`, `tip`, `value`, `extend`) VALUES
(NULL, 'audit', 'bool', 'checkbox', 'open_audit', 'Turn on picture yellow identification', 'Turn on picture yellow identification tip', '0', ''),
(NULL, 'audit', 'text', 'text', 'audit_key', 'Key', NULL, '', ''),
(NULL, 'audit', 'select', 'text', 'audit_index', 'Content rating', 'Content rating tip', '3', '{\"1\": \"Very strict\", \"2\": \"Strict\", \"3\": \"Commonly\"}'),
(NULL, 'other', 'bool', 'checkbox', 'open_api', 'Open api', 'Open api tip', '0', '');
-- v1.3.3
UPDATE `lsky_config` SET `value` = '1.3.3' WHERE `lsky_config`.`name` = 'system_version';
-- v1.4.0
UPDATE `lsky_config` SET `value` = '1.4.0' WHERE `lsky_config`.`name` = 'system_version';
UPDATE `lsky_config` SET `key` = 'uss', `name` = 'uss_cdn_domain' WHERE `lsky_config`.`name` = 'upyun_cdn_domain';
UPDATE `lsky_config` SET `key` = 'uss', `name` = 'uss_operator_name' WHERE `lsky_config`.`name` = 'upyun_operator_name';
UPDATE `lsky_config` SET `key` = 'uss', `name` = 'uss_operator_pwd' WHERE `lsky_config`.`name` = 'upyun_operator_pwd';
UPDATE `lsky_config` SET `key` = 'uss', `name` = 'uss_service_name' WHERE `lsky_config`.`name` = 'upyun_service_name';
UPDATE `lsky_config` SET `key` = 'kodo', `name` = 'kodo_cdn_domain' WHERE `lsky_config`.`name` = 'qiniu_cdn_domain';
UPDATE `lsky_config` SET `key` = 'kodo', `name` = 'kodo_access_key' WHERE `lsky_config`.`name` = 'qiniu_access_key';
UPDATE `lsky_config` SET `key` = 'kodo', `name` = 'kodo_secret_key' WHERE `lsky_config`.`name` = 'qiniu_secret_key';
UPDATE `lsky_config` SET `key` = 'kodo', `name` = 'kodo_bucket' WHERE `lsky_config`.`name` = 'qiniu_bucket';
UPDATE `lsky_config` SET `value` = 'kodo' WHERE `lsky_config`.`value` = 'qiniu';
UPDATE `lsky_config` SET `value` = 'uss' WHERE `lsky_config`.`value` = 'upyun';
-- v1.4.1
UPDATE `lsky_config` SET `value` = '1.4.1' WHERE `lsky_config`.`name` = 'system_version';
CREATE TABLE IF NOT EXISTS `lsky_folders` (
`id` int(11) PRIMARY KEY AUTO_INCREMENT NOT NULL COMMENT 'ID',
`user_id` int(11) NOT NULL COMMENT '用户ID',
`parent_id` int(11) NOT NULL DEFAULT '0' COMMENT '上级文件夹ID',
`name` varchar(100) NOT NULL COMMENT '文件夹名称',
`delete_time` int(11) DEFAULT NULL COMMENT '删除时间',
`update_time` int(11) DEFAULT NULL COMMENT '更新时间',
`create_time` int(11) DEFAULT NULL COMMENT '添加时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文件夹表';
-- v1.4.2
UPDATE `lsky_config` SET `value` = '1.4.2' WHERE `lsky_config`.`name` = 'system_version';
UPDATE `lsky_images` SET `strategy` = 'uss' WHERE `lsky_images`.`strategy` = 'upyun';
UPDATE `lsky_images` SET `strategy` = 'kodo' WHERE `lsky_images`.`strategy` = 'qiniu';
-- v1.5.0
UPDATE `lsky_config` SET `value` = '1.5.0' WHERE `lsky_config`.`name` = 'system_version';
UPDATE `lsky_config` SET `tip` = 'Turn on picture yellow identification tip' WHERE `lsky_config`.`name` = 'open_audit';
INSERT IGNORE INTO `lsky_config` (`id`, `key`, `type`, `input_type`, `name`, `title`, `tip`, `value`, `extend`) VALUES
(NULL, 'basics', 'textarea', 'textarea', 'custom_style', 'Custom CSS', NULL, '<!-- 可以直接引入第三方css样式 -->\r\n<style>\r\n /* body {} */\r\n</style>', ''),
(NULL, 'basics', 'textarea', 'textarea', 'statistics_code', 'Statistical code', NULL, '<script>\r\n // js统计代码 \r\n</script>', '');
CREATE TABLE IF NOT EXISTS `lsky_group` (
`id` INT NOT NULL AUTO_INCREMENT COMMENT 'ID',
`strategy` varchar(32) NOT NULL COMMENT '使用策略',
`name` varchar(32) NOT NULL COMMENT '组名称',
`default` tinyint(1) NOT NULL DEFAULT '0' COMMENT '默认',
`update_time` int(11) DEFAULT NULL COMMENT '更新时间',
`create_time` int(11) DEFAULT NULL COMMENT '添加时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='文件夹表';
INSERT IGNORE INTO `lsky_group` (`id`, `strategy`, `name`, `default`, `create_time`) VALUES ('1', 'local', 'Default group', '1', '0');
-- v1.5.1
UPDATE `lsky_config` SET `value` = '1.5.1' WHERE `lsky_config`.`name` = 'system_version';
ALTER TABLE `lsky_users` CHANGE `reg_ip` `reg_ip` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '注册IP';
-- v1.5.2
UPDATE `lsky_config` SET `value` = '1.5.2' WHERE `lsky_config`.`name` = 'system_version';
-- v1.5.3
UPDATE `lsky_config` SET `value` = '1.5.3' WHERE `lsky_config`.`name` = 'system_version';
-- v1.5.4
UPDATE `lsky_config` SET `value` = '1.5.4' WHERE `lsky_config`.`name` = 'system_version';
-- v1.5.5
UPDATE `lsky_config` SET `value` = '1.5.5' WHERE `lsky_config`.`name` = 'system_version';
INSERT IGNORE INTO `lsky_config` (`id`, `key`, `type`, `input_type`, `name`, `title`, `tip`, `value`, `extend`) VALUES
(NULL, 'basics', 'textarea', 'textarea', 'notice', 'System notice', 'System notice tip', '', ''),
(NULL, 'remote', 'text', 'text', 'remote_cdn_domain', 'Domain name', NULL, '', ''),
(NULL, 'remote', 'select', 'text', 'remote_type', 'Remote storage type', NULL, 'ftp', '{\"ftp\":\"Ftp\"}'),
(NULL, 'remote', 'text', 'text', 'remote_host', 'Connection address', NULL, '', ''),
(NULL, 'remote', 'text', 'text', 'remote_name', 'Login account', NULL, '', ''),
(NULL, 'remote', 'text', 'password', 'remote_password', 'Login password', NULL, '', ''),
(NULL, 'remote', 'text', 'number', 'remote_port', 'Connection port', NULL, '21', '');
-- v1.5.6
UPDATE `lsky_config` SET `value` = '1.5.6' WHERE `lsky_config`.`name` = 'system_version';
-- v1.5.7
UPDATE `lsky_config` SET `value` = '1.5.7' WHERE `lsky_config`.`name` = 'system_version';
-- v1.5.8
UPDATE `lsky_config` SET `value` = '1.5.8' WHERE `lsky_config`.`name` = 'system_version';
-- v1.6.0
UPDATE `lsky_config` SET `value` = '1.6.0' WHERE `lsky_config`.`name` = 'system_version';
INSERT IGNORE INTO `lsky_config` (`id`, `key`, `type`, `input_type`, `name`, `title`, `tip`, `value`, `extend`) VALUES
(NULL, 'other', 'textarea', 'textarea', 'ban_ip', 'Ban ip', 'Ban ip tip', '', ''),
(NULL, 'remote', 'bool', 'checkbox', 'remote_pasv', 'Passive mode', NULL, '0', '');
-- v1.6.1
UPDATE `lsky_config` SET `value` = '1.6.1' WHERE `lsky_config`.`name` = 'system_version';
-- v1.6.3
UPDATE `lsky_config` SET `value` = '1.6.3' WHERE `lsky_config`.`name` = 'system_version';
INSERT IGNORE INTO `lsky_config` (`id`, `key`, `type`, `input_type`, `name`, `title`, `tip`, `value`, `extend`) VALUES
(NULL, 'other', 'bool', 'checkbox', 'open_gallery', 'Open gallery', 'Open gallery tip', '', '');
-- v1.6.4
UPDATE `lsky_config` SET `value` = '1.6.4' WHERE `lsky_config`.`name` = 'system_version';
INSERT IGNORE INTO `lsky_config` (`id`, `key`, `type`, `input_type`, `name`, `title`, `tip`, `value`, `extend`) VALUES
(NULL, 'upload', 'text', 'number', 'same_ip_day_max_upload', 'Same ip day max upload', 'Same ip day max upload tip', '0', '');

View File

@ -1,28 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// 应用行为扩展定义文件
return [
// 应用初始化
'app_init' => [],
// 应用开始
'app_begin' => [],
// 模块初始化
'module_init' => [],
// 操作开始执行
'action_begin' => [],
// 视图内容过滤
'view_filter' => [],
// 日志写入
'log_write' => [],
// 应用结束
'app_end' => [],
];

53
artisan Executable file
View File

@ -0,0 +1,53 @@
#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any of our classes manually. It's great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);

55
bootstrap/app.php Normal file
View File

@ -0,0 +1,55 @@
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;

View File

@ -1,34 +1,62 @@
{
"name": "wisp-x/lsky-pro",
"description": "Lsky Pro, your photo album on the cloud.",
"name": "laravel/laravel",
"type": "project",
"keywords": [
"lsky",
"lsky Pro"
],
"homepage": "https://www.lsky.pro",
"license": "GPL-3.0",
"authors": [
{
"name": "Wisp X",
"email": "1591788658@qq.com"
}
],
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": ">=5.6.0",
"topthink/framework": "5.1.*",
"topthink/think-captcha": "^2.0",
"aliyuncs/oss-sdk-php": "^2.3",
"qiniu/php-sdk": "^7.2",
"upyun/sdk": "^3.3",
"qcloud/cos-sdk-v5": "^1.2",
"topthink/think-image": "^1.0",
"phpmailer/phpmailer": "^6.0",
"nicolab/php-ftp-client": "^1.5"
"php": "^7.3|^8.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.65",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^5.10",
"phpunit/phpunit": "^9.5.10"
},
"autoload": {
"psr-4": {
"app\\": "application"
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}

8129
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,146 +1,235 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 应用设置
// +----------------------------------------------------------------------
return [
// 应用名称
'app_name' => Env::get('app.name', 'Lsky Pro'),
// 应用地址
'app_host' => '',
// 应用调试模式
'app_debug' => Env::get('app.debug', false),
// 应用Trace
'app_trace' => Env::get('app.trace', false),
// 是否支持多模块
'app_multi_module' => true,
// 入口自动绑定模块
'auto_bind_module' => false,
// 注册的根命名空间
'root_namespace' => ['app'],
// 默认输出类型
'default_return_type' => 'html',
// 默认AJAX 数据返回格式,可选json xml ...
'default_ajax_return' => 'json',
// 默认JSONP格式返回的处理方法
'default_jsonp_handler' => 'jsonpReturn',
// 默认JSONP处理方法
'var_jsonp_handler' => 'callback',
// 默认时区
'default_timezone' => 'Asia/Shanghai',
// 是否开启多语言
'lang_switch_on' => true,
// 默认全局过滤方法 用逗号分隔多个
'default_filter' => '',
// 默认语言
'default_lang' => 'zh-cn',
// 应用类库后缀
'class_suffix' => false,
// 控制器类后缀
'controller_suffix' => false,
// +----------------------------------------------------------------------
// | 模块设置
// +----------------------------------------------------------------------
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
// 默认模块名
'default_module' => 'index',
// 禁止访问模块
'deny_module_list' => ['common'],
// 默认控制器名
'default_controller' => 'Index',
// 默认操作名
'default_action' => 'index',
// 默认验证器
'default_validate' => '',
// 默认的空模块名
'empty_module' => '',
// 默认的空控制器名
'empty_controller' => 'Error',
// 操作方法前缀
'use_action_prefix' => false,
// 操作方法后缀
'action_suffix' => '',
// 自动搜索控制器
'controller_auto_search' => true,
'name' => env('APP_NAME', 'Laravel'),
// +----------------------------------------------------------------------
// | URL设置
// +----------------------------------------------------------------------
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
// PATHINFO变量名 用于兼容模式
'var_pathinfo' => 's',
// 兼容PATH_INFO获取
'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'],
// pathinfo分隔符
'pathinfo_depr' => '/',
// HTTPS代理标识
'https_agent_name' => '',
// IP代理获取标识
'http_agent_ip' => 'X-REAL-IP',
// URL伪静态后缀
'url_html_suffix' => 'html',
// URL普通方式参数 用于自动生成
'url_common_param' => true,
// URL参数方式 0 按名称成对解析 1 按顺序解析
'url_param_type' => 0,
// 是否开启路由延迟解析
'url_lazy_route' => false,
// 是否强制使用路由
'url_route_must' => false,
// 合并路由规则
'route_rule_merge' => false,
// 路由是否完全匹配
'route_complete_match' => true,
// 使用注解路由
'route_annotation' => false,
// 域名根如thinkphp.cn
'url_domain_root' => '',
// 是否自动转换URL中的控制器和操作名
'url_convert' => false,
// 默认的访问控制器层
'url_controller_layer' => 'controller',
// 表单请求类型伪装变量
'var_method' => '_method',
// 表单ajax伪装变量
'var_ajax' => '_ajax',
// 表单pjax伪装变量
'var_pjax' => '_pjax',
// 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
'request_cache' => false,
// 请求缓存有效期
'request_cache_expire' => null,
// 全局请求缓存排除规则
'request_cache_except' => [],
// 是否开启路由缓存
'route_check_cache' => false,
// 路由缓存的Key自定义设置闭包默认为当前URL和请求类型的md5
'route_check_cache_key' => '',
// 路由缓存类型及参数
'route_cache_option' => [],
'env' => env('APP_ENV', 'production'),
// 默认跳转页面对应的模板文件
'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl',
'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl',
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
// 异常页面的模板文件
'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl',
'debug' => (bool) env('APP_DEBUG', false),
// 错误显示信息,非调试模式有效
'error_message' => '页面错误!请稍后再试~',
// 显示错误信息
'show_error_msg' => false,
// 异常处理handle类 留空使用 \think\exception\Handle
'exception_handle' => '',
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL', null),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Arr' => Illuminate\Support\Arr::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'Date' => Illuminate\Support\Facades\Date::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Http' => Illuminate\Support\Facades\Http::class,
'Js' => Illuminate\Support\Js::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
// 'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'Str' => Illuminate\Support\Str::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
],
];

111
config/auth.php Normal file
View File

@ -0,0 +1,111 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];

64
config/broadcasting.php Normal file
View File

@ -0,0 +1,64 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'useTLS' => true,
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];

View File

@ -1,25 +1,110 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 缓存设置
// +----------------------------------------------------------------------
use Illuminate\Support\Str;
return [
// 驱动方式
'type' => 'File',
// 缓存保存目录
'path' => '',
// 缓存前缀
'prefix' => '',
// 缓存有效期 0表示永久缓存
'expire' => 0,
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
'lock_connection' => 'default',
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
];

View File

@ -1,19 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 控制台配置
// +----------------------------------------------------------------------
return [
'name' => 'Think Console',
'version' => '0.1',
'user' => null,
];

View File

@ -1,30 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | Cookie设置
// +----------------------------------------------------------------------
return [
// cookie 名称前缀
'prefix' => '',
// cookie 保存时间
'expire' => 0,
// cookie 保存路径
'path' => '/',
// cookie 有效域名
'domain' => '',
// cookie 启用安全传输
'secure' => false,
// httponly设置
'httponly' => '',
// 是否使用 setcookie
'setcookie' => true,
];

34
config/cors.php Normal file
View File

@ -0,0 +1,34 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];

View File

@ -1,63 +1,147 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use Illuminate\Support\Str;
return [
// 数据库类型
'type' => 'mysql',
// 数据库连接DSN配置
'dsn' => '',
// 服务器地址
'hostname' => env('database.hostname', '127.0.0.1'),
// 数据库名
'database' => env('database.database', 'lsky'),
// 数据库用户名
'username' => env('database.username', 'root'),
// 数据库密码
'password' => env('database.password', ''),
// 数据库连接端口
'hostport' => env('database.hostport', '3306'),
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => env('database.charset', 'utf8mb4'),
// 数据库表前缀
'prefix' => env('database.prefix'),
// 数据库调试模式
'debug' => false,
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 自动读取主库数据
'read_master' => false,
// 是否严格检查字段是否存在
'fields_strict' => true,
// 数据集返回类型
'resultset_type' => 'array',
// 自动写入时间戳字段
'auto_timestamp' => true,
// 时间字段取出后的默认时间格式
'datetime_format' => 'Y-m-d H:i:s',
// 是否需要进行SQL性能分析
'sql_explain' => false,
// Builder类
'builder' => '',
// Query类
'query' => '\\think\\db\\Query',
// 是否需要断线重连
'break_reconnect' => false,
// 断线标识字符串
'break_match_str' => [],
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];

73
config/filesystems.php Normal file
View File

@ -0,0 +1,73 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

52
config/hashing.php Normal file
View File

@ -0,0 +1,52 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 1024,
'threads' => 2,
'time' => 2,
],
];

View File

@ -1,30 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 日志设置
// +----------------------------------------------------------------------
return [
// 日志记录方式,内置 file socket 支持扩展
'type' => 'File',
// 日志保存目录
'path' => '',
// 日志记录级别
'level' => [],
// 单文件日志写入
'single' => false,
// 独立日志级别
'apart_level' => [],
// 最大日志文件数量
'max_files' => 30,
// 是否关闭日志写入
'close' => false,
];

118
config/logging.php Normal file
View File

@ -0,0 +1,118 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

118
config/mail.php Normal file
View File

@ -0,0 +1,118 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array", "failover"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'auth_mode' => null,
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -t -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];

Some files were not shown because too many files have changed in this diff Show More