mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-05 19:41:44 +08:00
[更新]ComposerUpdate
This commit is contained in:
parent
4e96578cc2
commit
18f50d55d0
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
require_once __DIR__ . '/composer/autoload_real.php';
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
return ComposerAutoloaderInitdd2ee3ea59df033b75a787ac77c71af2::getLoader();
|
return ComposerAutoloaderInit407a0fe5b8b66687453d756daf4a3b35::getLoader();
|
||||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// autoload_real.php @generated by Composer
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
class ComposerAutoloaderInitdd2ee3ea59df033b75a787ac77c71af2
|
class ComposerAutoloaderInit407a0fe5b8b66687453d756daf4a3b35
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
@ -19,15 +19,15 @@ class ComposerAutoloaderInitdd2ee3ea59df033b75a787ac77c71af2
|
|||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInitdd2ee3ea59df033b75a787ac77c71af2', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInit407a0fe5b8b66687453d756daf4a3b35', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInitdd2ee3ea59df033b75a787ac77c71af2', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInit407a0fe5b8b66687453d756daf4a3b35', 'loadClassLoader'));
|
||||||
|
|
||||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||||
if ($useStaticLoader) {
|
if ($useStaticLoader) {
|
||||||
require_once __DIR__ . '/autoload_static.php';
|
require_once __DIR__ . '/autoload_static.php';
|
||||||
|
|
||||||
call_user_func(\Composer\Autoload\ComposerStaticInitdd2ee3ea59df033b75a787ac77c71af2::getInitializer($loader));
|
call_user_func(\Composer\Autoload\ComposerStaticInit407a0fe5b8b66687453d756daf4a3b35::getInitializer($loader));
|
||||||
} else {
|
} else {
|
||||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||||
foreach ($map as $namespace => $path) {
|
foreach ($map as $namespace => $path) {
|
||||||
@ -48,19 +48,19 @@ class ComposerAutoloaderInitdd2ee3ea59df033b75a787ac77c71af2
|
|||||||
$loader->register(true);
|
$loader->register(true);
|
||||||
|
|
||||||
if ($useStaticLoader) {
|
if ($useStaticLoader) {
|
||||||
$includeFiles = Composer\Autoload\ComposerStaticInitdd2ee3ea59df033b75a787ac77c71af2::$files;
|
$includeFiles = Composer\Autoload\ComposerStaticInit407a0fe5b8b66687453d756daf4a3b35::$files;
|
||||||
} else {
|
} else {
|
||||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||||
}
|
}
|
||||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||||
composerRequiredd2ee3ea59df033b75a787ac77c71af2($fileIdentifier, $file);
|
composerRequire407a0fe5b8b66687453d756daf4a3b35($fileIdentifier, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $loader;
|
return $loader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function composerRequiredd2ee3ea59df033b75a787ac77c71af2($fileIdentifier, $file)
|
function composerRequire407a0fe5b8b66687453d756daf4a3b35($fileIdentifier, $file)
|
||||||
{
|
{
|
||||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
require $file;
|
require $file;
|
||||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace Composer\Autoload;
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
class ComposerStaticInitdd2ee3ea59df033b75a787ac77c71af2
|
class ComposerStaticInit407a0fe5b8b66687453d756daf4a3b35
|
||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php',
|
'841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php',
|
||||||
@ -346,9 +346,9 @@ class ComposerStaticInitdd2ee3ea59df033b75a787ac77c71af2
|
|||||||
public static function getInitializer(ClassLoader $loader)
|
public static function getInitializer(ClassLoader $loader)
|
||||||
{
|
{
|
||||||
return \Closure::bind(function () use ($loader) {
|
return \Closure::bind(function () use ($loader) {
|
||||||
$loader->prefixLengthsPsr4 = ComposerStaticInitdd2ee3ea59df033b75a787ac77c71af2::$prefixLengthsPsr4;
|
$loader->prefixLengthsPsr4 = ComposerStaticInit407a0fe5b8b66687453d756daf4a3b35::$prefixLengthsPsr4;
|
||||||
$loader->prefixDirsPsr4 = ComposerStaticInitdd2ee3ea59df033b75a787ac77c71af2::$prefixDirsPsr4;
|
$loader->prefixDirsPsr4 = ComposerStaticInit407a0fe5b8b66687453d756daf4a3b35::$prefixDirsPsr4;
|
||||||
$loader->classMap = ComposerStaticInitdd2ee3ea59df033b75a787ac77c71af2::$classMap;
|
$loader->classMap = ComposerStaticInit407a0fe5b8b66687453d756daf4a3b35::$classMap;
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
}, null, ClassLoader::class);
|
||||||
}
|
}
|
||||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -499,12 +499,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||||
"reference": "9ba43129ddcfd571c88b78071ad1f347b106ff26"
|
"reference": "5d8dbc0707782c5b68ea5600f19001e128ee39c5"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/9ba43129ddcfd571c88b78071ad1f347b106ff26",
|
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/5d8dbc0707782c5b68ea5600f19001e128ee39c5",
|
||||||
"reference": "9ba43129ddcfd571c88b78071ad1f347b106ff26",
|
"reference": "5d8dbc0707782c5b68ea5600f19001e128ee39c5",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
@ -523,7 +523,7 @@
|
|||||||
"qiniu/php-sdk": "^7.2",
|
"qiniu/php-sdk": "^7.2",
|
||||||
"topthink/framework": "5.1.*"
|
"topthink/framework": "5.1.*"
|
||||||
},
|
},
|
||||||
"time": "2019-04-01T02:03:01+00:00",
|
"time": "2019-04-02T08:17:16+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"installation-source": "dist",
|
"installation-source": "dist",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -53,8 +53,8 @@ class Controller extends \stdClass
|
|||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
Cors::optionsHandler();
|
|
||||||
$this->request = request();
|
$this->request = request();
|
||||||
|
Cors::setOptionHandler($this->request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,7 +86,7 @@ class Controller extends \stdClass
|
|||||||
{
|
{
|
||||||
$result = ['code' => $code, 'info' => $info, 'data' => $data];
|
$result = ['code' => $code, 'info' => $info, 'data' => $data];
|
||||||
if ($this->_isCsrf) Csrf::clearFormToken(Csrf::getToken());
|
if ($this->_isCsrf) Csrf::clearFormToken(Csrf::getToken());
|
||||||
throw new \think\exception\HttpResponseException(json($result, 200, Cors::getRequestHeader()));
|
throw new \think\exception\HttpResponseException(json($result, 200, Cors::getRequestHeader($this->request)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,7 +98,7 @@ class Controller extends \stdClass
|
|||||||
public function error($info, $data = [], $code = 0)
|
public function error($info, $data = [], $code = 0)
|
||||||
{
|
{
|
||||||
$result = ['code' => $code, 'info' => $info, 'data' => $data];
|
$result = ['code' => $code, 'info' => $info, 'data' => $data];
|
||||||
throw new \think\exception\HttpResponseException(json($result, 200, Cors::getRequestHeader()));
|
throw new \think\exception\HttpResponseException(json($result, 200, Cors::getRequestHeader($this->request)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -127,8 +127,8 @@ class Controller extends \stdClass
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板变量赋值
|
* 模板变量赋值
|
||||||
* @param mixed $name 要显示的模板变量
|
* @param mixed $name 要显示的模板变量
|
||||||
* @param mixed $value 变量的值
|
* @param mixed $value 变量的值
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function assign($name, $value = '')
|
public function assign($name, $value = '')
|
||||||
|
@ -14,11 +14,10 @@
|
|||||||
|
|
||||||
namespace library\tools;
|
namespace library\tools;
|
||||||
|
|
||||||
use think\facade\Log;
|
use think\Request;
|
||||||
use think\facade\Session;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cors跨域支持工具
|
* 请求跨域支持
|
||||||
* Class Cors
|
* Class Cors
|
||||||
* @package library\tools
|
* @package library\tools
|
||||||
*/
|
*/
|
||||||
@ -26,57 +25,17 @@ class Cors
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置跨域允许头部信息
|
* Option请求处理
|
||||||
* @var array
|
* @param Request $request
|
||||||
*/
|
*/
|
||||||
private static $allowHeader = [
|
public static function setOptionHandler(Request $request)
|
||||||
'Host', 'Accept', 'Cookie', 'Origin', 'Pragma', 'Expires', 'Referer',
|
|
||||||
'User-Agent', 'Keep-Alive', 'Content-Type', 'Cache-Control', 'Last-Event-ID',
|
|
||||||
'Last-Modified', 'Content-Language', 'X-Requested-With', 'If-Modified-Since',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取会话令牌
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function getSessionToken()
|
|
||||||
{
|
{
|
||||||
if (PHP_SESSION_ACTIVE !== session_status()) Session::init(config('session.'));
|
if ($request->isOptions()) {
|
||||||
return Crypt::encode(session_name() . '=' . session_id());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用会话令牌
|
|
||||||
*/
|
|
||||||
public static function setSessionToken()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
if (PHP_SESSION_ACTIVE !== session_status()) Session::init(config('session.'));
|
|
||||||
if ($token = request()->header('User-Token-Cors', input('_cors_'))) {
|
|
||||||
list($name, $value) = explode('=', Crypt::decode($token) . '=');
|
|
||||||
if (!empty($value) && session_name() === $name && session_id() !== $value) {
|
|
||||||
Session::destroy(); # 注销原来的会话
|
|
||||||
session_id($value); # 切换到指定的会话
|
|
||||||
Session::init(config('session.')); # 刷新重启会话
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
Log::error(__METHOD__ . " : {$e->getMessage()}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ajax跨域Options授权处理
|
|
||||||
*/
|
|
||||||
public static function optionsHandler()
|
|
||||||
{
|
|
||||||
self::setSessionToken();
|
|
||||||
if (request()->isOptions()) {
|
|
||||||
header('Access-Control-Allow-Credentials:true');
|
header('Access-Control-Allow-Credentials:true');
|
||||||
header('Access-Control-Allow-Methods:GET,POST,OPTIONS');
|
header('Access-Control-Allow-Methods:GET,POST,OPTIONS');
|
||||||
header('Access-Control-Allow-Origin:' . request()->header('origin', '*'));
|
header('Access-Control-Allow-Origin:' . self::getOrigin($request));
|
||||||
header('Access-Control-Allow-Headers:' . join(',', self::$allowHeader));
|
header('Access-Control-Allow-Headers:' . self::getAllows($request));
|
||||||
header('Access-Control-Expose-Headers:User-Token-Cors,User-Token-Csrf');
|
header('Access-Control-Expose-Headers: User-Token-Csrf');
|
||||||
header('Content-Type:text/plain charset=UTF-8');
|
header('Content-Type:text/plain charset=UTF-8');
|
||||||
header('Access-Control-Max-Age:1728000');
|
header('Access-Control-Max-Age:1728000');
|
||||||
header('HTTP/1.0 204 No Content');
|
header('HTTP/1.0 204 No Content');
|
||||||
@ -87,19 +46,39 @@ class Cors
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajax跨域Request头部信息
|
* 获取返回Header信息
|
||||||
|
* @param Request $request
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getRequestHeader()
|
public static function getRequestHeader(Request $request)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'Access-Control-Allow-Credentials' => 'true',
|
'Access-Control-Allow-Credentials' => 'true',
|
||||||
'Access-Control-Allow-Methods' => 'GET,POST,OPTIONS',
|
'Access-Control-Allow-Methods' => 'GET,POST,OPTIONS',
|
||||||
'Access-Control-Allow-Origin' => request()->header('origin', '*'),
|
'Access-Control-Allow-Origin' => self::getOrigin($request),
|
||||||
'Access-Control-Allow-Headers' => join(',', self::$allowHeader),
|
'Access-Control-Allow-Headers' => self::getAllows($request),
|
||||||
'Access-Control-Expose-Headers' => 'User-Token-Cors,User-Token-Csrf',
|
'Access-Control-Expose-Headers' => 'User-Token-Csrf',
|
||||||
'User-Token-Cors' => self::getSessionToken(),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取Origin信息
|
||||||
|
* @param Request $request
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private static function getOrigin(Request $request)
|
||||||
|
{
|
||||||
|
return $request->header('origin', '*');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取Allow信息
|
||||||
|
* @param Request $request
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private static function getAllows(Request $request)
|
||||||
|
{
|
||||||
|
return 'Host,Accept,Cookie,Origin,Pragma,Expires,Referer,User-Agent,Keep-Alive,Content-Type,Cache-Control,Last-Event-ID,Last-Modified,Content-Language,X-Requested-With,If-Modified-Since';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user