mirror of https://gitee.com/karson/fastadmin.git
parent
685fc267c0
commit
2ecae60d86
|
|
@ -322,7 +322,6 @@ class Extractor
|
||||||
if (preg_match_all('/@(?<name>[A-Za-z_-]+)[\s\t]*\((?<args>(?:(?!\)).)*)\)\r?/s', $docblock, $matches))
|
if (preg_match_all('/@(?<name>[A-Za-z_-]+)[\s\t]*\((?<args>(?:(?!\)).)*)\)\r?/s', $docblock, $matches))
|
||||||
{
|
{
|
||||||
$numMatches = count($matches[0]);
|
$numMatches = count($matches[0]);
|
||||||
|
|
||||||
for ($i = 0; $i < $numMatches; ++$i)
|
for ($i = 0; $i < $numMatches; ++$i)
|
||||||
{
|
{
|
||||||
// annotations has arguments
|
// annotations has arguments
|
||||||
|
|
@ -330,7 +329,12 @@ class Extractor
|
||||||
{
|
{
|
||||||
$argsParts = trim($matches['args'][$i]);
|
$argsParts = trim($matches['args'][$i]);
|
||||||
$name = $matches['name'][$i];
|
$name = $matches['name'][$i];
|
||||||
|
$argsParts = preg_replace("/\{(\w+)\}/", '#$1#', $argsParts);
|
||||||
$value = self::parseArgs($argsParts);
|
$value = self::parseArgs($argsParts);
|
||||||
|
if(is_string($value))
|
||||||
|
{
|
||||||
|
$value = preg_replace("/\#(\w+)\#/", '{$1}', $argsParts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -382,27 +382,31 @@
|
||||||
//instead of the initial attribute
|
//instead of the initial attribute
|
||||||
var url = $(form).attr('action');
|
var url = $(form).attr('action');
|
||||||
|
|
||||||
var serializedData = new FormData();
|
var formData = new FormData();
|
||||||
|
|
||||||
$(form).find('input').each(function (i, input) {
|
$(form).find('input').each(function (i, input) {
|
||||||
if ($(input).attr('type') == 'file') {
|
if ($(input).attr('type') == 'file') {
|
||||||
serializedData.append($(input).attr('name'), $(input)[0].files[0]);
|
formData.append($(input).attr('name'), $(input)[0].files[0]);
|
||||||
} else {
|
} else {
|
||||||
serializedData.append($(input).attr('name'), $(input).val())
|
formData.append($(input).attr('name'), $(input).val())
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var index, key, value;
|
var index, key, value;
|
||||||
|
|
||||||
if (matchedParamsInRoute) {
|
if (matchedParamsInRoute) {
|
||||||
|
var params = {};
|
||||||
|
formData.forEach(function(value, key){
|
||||||
|
params[key] = value;
|
||||||
|
});
|
||||||
for (index = 0; index < matchedParamsInRoute.length; ++index) {
|
for (index = 0; index < matchedParamsInRoute.length; ++index) {
|
||||||
try {
|
try {
|
||||||
key = matchedParamsInRoute[index];
|
key = matchedParamsInRoute[index];
|
||||||
value = serializedData[key];
|
value = params[key];
|
||||||
if (typeof value == "undefined")
|
if (typeof value == "undefined")
|
||||||
value = "";
|
value = "";
|
||||||
url = url.replace("{" + key + "}", value);
|
url = url.replace("\{" + key + "\}", value);
|
||||||
delete serializedData[key];
|
formData.delete(key);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
@ -425,7 +429,7 @@
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: $('#apiUrl').val() + url,
|
url: $('#apiUrl').val() + url,
|
||||||
data: $(form).attr('method') == 'get' ? $(form).serialize() : serializedData,
|
data: $(form).attr('method') == 'get' ? $(form).serialize() : formData,
|
||||||
type: $(form).attr('method') + '',
|
type: $(form).attr('method') + '',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: false,
|
contentType: false,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
$cdnurl = function_exists('config') ? config('view_replace_str.__CDN__') : '';
|
$cdnurl = function_exists('config') ? config('view_replace_str.__CDN__') : '';
|
||||||
$publicurl = function_exists('config') ? config('view_replace_str.__PUBLIC__') : '/';
|
$publicurl = function_exists('config') ? config('view_replace_str.__PUBLIC__') : '/';
|
||||||
|
$debug = function_exists('config') ? config('app_debug') : false;
|
||||||
|
|
||||||
$lang = [
|
$lang = [
|
||||||
'An error occurred' => '发生错误',
|
'An error occurred' => '发生错误',
|
||||||
|
|
@ -17,15 +18,16 @@ if (isset($_GET['lang'])) {
|
||||||
} elseif (isset($_COOKIE['think_var'])) {
|
} elseif (isset($_COOKIE['think_var'])) {
|
||||||
$langSet = strtolower($_COOKIE['think_var']);
|
$langSet = strtolower($_COOKIE['think_var']);
|
||||||
} elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
} elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||||
preg_match('/^([a-z\d\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches);
|
preg_match('/^([a-z\d\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches);
|
||||||
$langSet = strtolower($matches[1]);
|
$langSet = strtolower($matches[1]);
|
||||||
}
|
}
|
||||||
$langSet = $langSet && in_array($langSet, ['zh-cn', 'en']) ? $langSet : 'zh-cn';
|
$langSet = $langSet && in_array($langSet, ['zh-cn', 'en']) ? $langSet : 'zh-cn';
|
||||||
$langSet == 'en' && $lang = array_combine(array_keys($lang), array_keys($lang));
|
$langSet == 'en' && $lang = array_combine(array_keys($lang), array_keys($lang));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
<title><?=$lang['An error occurred']?></title>
|
<title><?=$lang['An error occurred']?></title>
|
||||||
<meta name="robots" content="noindex,nofollow" />
|
<meta name="robots" content="noindex,nofollow" />
|
||||||
|
|
@ -73,14 +75,14 @@ $langSet == 'en' && $lang = array_combine(array_keys($lang), array_keys($lang));
|
||||||
.error-page-wrapper .buttons-container a:nth-child(2) {margin-top:12px;}
|
.error-page-wrapper .buttons-container a:nth-child(2) {margin-top:12px;}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="error-page-wrapper">
|
<body class="error-page-wrapper">
|
||||||
<div class="content-container">
|
<div class="content-container">
|
||||||
<div class="head-line">
|
<div class="head-line">
|
||||||
<img src="<?=$cdnurl?>/assets/img/error.svg" alt="" width="120"/>
|
<img src="<?=$cdnurl?>/assets/img/error.svg" alt="" width="120"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="subheader">
|
<div class="subheader">
|
||||||
<?=$lang['The page you are looking for is temporarily unavailable']?>
|
<?=$debug?$message:$lang['The page you are looking for is temporarily unavailable']?>
|
||||||
</div>
|
</div>
|
||||||
<div class="hr"></div>
|
<div class="hr"></div>
|
||||||
<div class="context">
|
<div class="context">
|
||||||
|
|
@ -94,6 +96,6 @@ $langSet == 'en' && $lang = array_combine(array_keys($lang), array_keys($lang));
|
||||||
<a href="<?=$publicurl?>"><?=$lang['Home']?></a>
|
<a href="<?=$publicurl?>"><?=$lang['Home']?></a>
|
||||||
<a href="<?=$publicurl?>"><?=$lang['Feedback']?></a>
|
<a href="<?=$publicurl?>"><?=$lang['Feedback']?></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -62,6 +62,7 @@ class Date
|
||||||
* @param string $output formatting string
|
* @param string $output formatting string
|
||||||
* @return string when only a single output is requested
|
* @return string when only a single output is requested
|
||||||
* @return array associative list of all outputs requested
|
* @return array associative list of all outputs requested
|
||||||
|
* @from https://github.com/kohana/ohanzee-helpers/blob/master/src/Date.php
|
||||||
*/
|
*/
|
||||||
public static function span($remote, $local = NULL, $output = 'years,months,weeks,days,hours,minutes,seconds')
|
public static function span($remote, $local = NULL, $output = 'years,months,weeks,days,hours,minutes,seconds')
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ namespace fast;
|
||||||
use ArrayAccess;
|
use ArrayAccess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 表单元素生成
|
||||||
* @class Form
|
* @class Form
|
||||||
* @package fast
|
* @package fast
|
||||||
* @method mixed token() static token
|
* @method mixed token() static token
|
||||||
|
|
@ -45,6 +46,12 @@ class Form
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 表单元素生成
|
||||||
|
* @from https://github.com/illuminate/html
|
||||||
|
* @package fast
|
||||||
|
*/
|
||||||
class FormBuilder
|
class FormBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="http://www.fastadmin.net" target="_blank">FastAdmin</a>
|
<a class="navbar-brand" href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-collapse collapse">
|
<div class="navbar-collapse collapse">
|
||||||
<form class="navbar-form navbar-right">
|
<form class="navbar-form navbar-right">
|
||||||
|
|
@ -3351,9 +3351,9 @@
|
||||||
|
|
||||||
<div class="row mt0 footer">
|
<div class="row mt0 footer">
|
||||||
<div class="col-md-6" align="left">
|
<div class="col-md-6" align="left">
|
||||||
Generated on 2018-03-16 14:43:16 </div>
|
Generated on 2018-04-01 15:11:14 </div>
|
||||||
<div class="col-md-6" align="right">
|
<div class="col-md-6" align="right">
|
||||||
<a href="http://www.fastadmin.net" target="_blank">FastAdmin</a>
|
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -3476,27 +3476,31 @@
|
||||||
//instead of the initial attribute
|
//instead of the initial attribute
|
||||||
var url = $(form).attr('action');
|
var url = $(form).attr('action');
|
||||||
|
|
||||||
var serializedData = new FormData();
|
var formData = new FormData();
|
||||||
|
|
||||||
$(form).find('input').each(function (i, input) {
|
$(form).find('input').each(function (i, input) {
|
||||||
if ($(input).attr('type') == 'file') {
|
if ($(input).attr('type') == 'file') {
|
||||||
serializedData.append($(input).attr('name'), $(input)[0].files[0]);
|
formData.append($(input).attr('name'), $(input)[0].files[0]);
|
||||||
} else {
|
} else {
|
||||||
serializedData.append($(input).attr('name'), $(input).val())
|
formData.append($(input).attr('name'), $(input).val())
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var index, key, value;
|
var index, key, value;
|
||||||
|
|
||||||
if (matchedParamsInRoute) {
|
if (matchedParamsInRoute) {
|
||||||
|
var params = {};
|
||||||
|
formData.forEach(function(value, key){
|
||||||
|
params[key] = value;
|
||||||
|
});
|
||||||
for (index = 0; index < matchedParamsInRoute.length; ++index) {
|
for (index = 0; index < matchedParamsInRoute.length; ++index) {
|
||||||
try {
|
try {
|
||||||
key = matchedParamsInRoute[index];
|
key = matchedParamsInRoute[index];
|
||||||
value = serializedData[key];
|
value = params[key];
|
||||||
if (typeof value == "undefined")
|
if (typeof value == "undefined")
|
||||||
value = "";
|
value = "";
|
||||||
url = url.replace("{" + key + "}", value);
|
url = url.replace("\{" + key + "\}", value);
|
||||||
delete serializedData[key];
|
formData.delete(key);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
@ -3519,7 +3523,7 @@
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: $('#apiUrl').val() + url,
|
url: $('#apiUrl').val() + url,
|
||||||
data: $(form).attr('method') == 'get' ? $(form).serialize() : serializedData,
|
data: $(form).attr('method') == 'get' ? $(form).serialize() : formData,
|
||||||
type: $(form).attr('method') + '',
|
type: $(form).attr('method') + '',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: false,
|
contentType: false,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue