mirror of https://gitee.com/karson/fastadmin.git
Merge branch 'master' into develop
commit
af241c7c21
|
|
@ -205,14 +205,17 @@ class Install extends Command
|
|||
$callback = function ($matches) use ($mysqlHostname, $mysqlHostport, $mysqlUsername, $mysqlPassword, $mysqlDatabase, $mysqlPrefix) {
|
||||
$field = "mysql" . ucfirst($matches[1]);
|
||||
$replace = $$field;
|
||||
return "{$matches[1]} = {$replace}" . PHP_EOL;
|
||||
if ($matches[1] == 'hostport' && $mysqlHostport == 3306) {
|
||||
$replace = '';
|
||||
}
|
||||
return "'{$matches[1]}'{$matches[2]}=>{$matches[3]}Env::get('database.{$matches[1]}', '{$replace}'),";
|
||||
};
|
||||
$dbConfigText = preg_replace_callback("/'(hostname|database|username|password|hostport|prefix)'(\s+)=>(\s+)Env::get\((.*)\)\,/", $callback, $config);
|
||||
$dbConfigText = preg_replace_callback("/'(hostname|database|username|password|hostport|prefix)'(\s+)=>(\s+)Env::get\((.*)\)\,/", $callback, $dbConfigText);
|
||||
|
||||
// 检测能否成功写入数据库配置
|
||||
$result = @file_put_contents($dbConfigFile, $dbConfigText);
|
||||
if (!$result) {
|
||||
throw new Exception(__('The current permissions are insufficient to write the file %s', '.env'));
|
||||
throw new Exception(__('The current permissions are insufficient to write the file %s', 'application/database.php'));
|
||||
}
|
||||
|
||||
// 设置新的Token随机密钥key
|
||||
|
|
@ -288,15 +291,17 @@ class Install extends Command
|
|||
'public' . DS . 'assets' . DS . 'libs'
|
||||
];
|
||||
|
||||
//数据库配置文件
|
||||
$dbConfigFile = APP_PATH . 'database.php';
|
||||
|
||||
if (version_compare(PHP_VERSION, '7.0.0', '<')) {
|
||||
throw new Exception(__("The current version %s is too low, please use PHP 7.0 or higher", PHP_VERSION));
|
||||
}
|
||||
if (!extension_loaded("PDO")) {
|
||||
throw new Exception(__("PDO is not currently installed and cannot be installed"));
|
||||
}
|
||||
$envConfFile = ROOT_PATH . '.env';
|
||||
if (is_file($envConfFile) && !is_really_writable($envConfFile)) {
|
||||
throw new Exception(__('The current permissions are insufficient to write the file %s', '.env'));
|
||||
if (!is_really_writable($dbConfigFile)) {
|
||||
throw new Exception(__('The current permissions are insufficient to write the configuration file application/database.php'));
|
||||
}
|
||||
foreach ($checkDirs as $k => $v) {
|
||||
if (!is_dir(ROOT_PATH . $v)) {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ class Config extends Backend
|
|||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = model('Config');
|
||||
// $this->model = model('Config');
|
||||
$this->model = new ConfigModel;
|
||||
ConfigModel::event('before_write', function ($row) {
|
||||
if (isset($row['name']) && $row['name'] == 'name' && preg_match("/fast" . "admin/i", $row['value'])) {
|
||||
throw new Exception(__("Site name incorrect"));
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ if (!function_exists('check_cors_request')) {
|
|||
if (isset($_SERVER['HTTP_ORIGIN']) && $_SERVER['HTTP_ORIGIN']) {
|
||||
$info = parse_url($_SERVER['HTTP_ORIGIN']);
|
||||
$domainArr = explode(',', config('fastadmin.cors_request_domain'));
|
||||
$domainArr[] = request()->host();
|
||||
$domainArr[] = request()->host(true);
|
||||
if (in_array("*", $domainArr) || in_array($_SERVER['HTTP_ORIGIN'], $domainArr) || (isset($info['host']) && in_array($info['host'], $domainArr))) {
|
||||
header("Access-Control-Allow-Origin: " . $_SERVER['HTTP_ORIGIN']);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -539,6 +539,11 @@ class Backend extends Controller
|
|||
//如果有primaryvalue,说明当前是初始化传值,按照选择顺序排序
|
||||
if ($primaryvalue !== null && preg_match("/^[a-z0-9_\-]+$/i", $primarykey)) {
|
||||
$primaryvalue = array_unique(is_array($primaryvalue) ? $primaryvalue : explode(',', $primaryvalue));
|
||||
//修复自定义data-primary-key为字符串内容时,给排序字段添加上引号
|
||||
$primaryvalue= array_map(function ($value) {
|
||||
return '\'' . $value . '\'';
|
||||
}, $primaryvalue);
|
||||
|
||||
$primaryvalue = implode(',', $primaryvalue);
|
||||
|
||||
$this->model->orderRaw("FIELD(`{$primarykey}`, {$primaryvalue})");
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class Email
|
|||
$secureArr = [0 => '', 1 => 'tls', 2 => 'ssl'];
|
||||
$secure = isset($secureArr[$this->options['mail_verify_type']]) ? $secureArr[$this->options['mail_verify_type']] : '';
|
||||
|
||||
$this->mail = new Mailer(new Log);
|
||||
$this->mail = new Mailer();
|
||||
$this->mail->setServer($this->options['mail_smtp_host'], $this->options['mail_smtp_port'], $secure);
|
||||
$this->mail->setAuth($this->options['mail_from'], $this->options['mail_smtp_pass']);
|
||||
|
||||
|
|
|
|||
|
|
@ -183,12 +183,14 @@ class Date
|
|||
mktime(23, 59, 59, $month, $day - date("w", mktime(0, 0, 0, $month, $day, $year)) + 7 - 7 * (-$offset), $year);
|
||||
break;
|
||||
case 'month':
|
||||
$time = $position ? mktime(0, 0, 0, $month + $offset, 1, $year) : mktime(23, 59, 59, $month + $offset, cal_days_in_month(CAL_GREGORIAN, $month + $offset, $year), $year);
|
||||
$_timestamp=mktime(0, 0, 0, $month + $offset, 1, $year);
|
||||
$time = $position ? $_timestamp : mktime(23, 59, 59, $month + $offset, cal_days_in_month(CAL_GREGORIAN, date("m",$_timestamp), date("Y",$_timestamp)), $year);
|
||||
break;
|
||||
case 'quarter':
|
||||
$_month=date("m",mktime(0, 0, 0, (ceil(date('n', mktime(0, 0, 0, $month, $day, $year)) / 3) + $offset) * 3, $day, $year));
|
||||
$time = $position ?
|
||||
mktime(0, 0, 0, 1 + ((ceil(date('n', mktime(0, 0, 0, $month, $day, $year)) / 3) + $offset) - 1) * 3, 1, $year) :
|
||||
mktime(23, 59, 59, (ceil(date('n', mktime(0, 0, 0, $month, $day, $year)) / 3) + $offset) * 3, cal_days_in_month(CAL_GREGORIAN, (ceil(date('n', mktime(0, 0, 0, $month, $day, $year)) / 3) + $offset) * 3, $year), $year);
|
||||
mktime(23, 59, 59, (ceil(date('n', mktime(0, 0, 0, $month, $day, $year)) / 3) + $offset) * 3, cal_days_in_month(CAL_GREGORIAN, $_month, $year), $year);
|
||||
break;
|
||||
case 'year':
|
||||
$time = $position ? mktime(0, 0, 0, 1, 1, $year + $offset) : mktime(23, 59, 59, 12, 31, $year + $offset);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|||
location.href = ret.url ? ret.url : "/";
|
||||
}, 1000);
|
||||
}, function (data) {
|
||||
$("input[name=captcha]").next(".input-group-addon").find("img").trigger("click");
|
||||
$("input[name=captcha]").next(".input-group-btn").find("img").trigger("click");
|
||||
});
|
||||
},
|
||||
changepwd: function () {
|
||||
|
|
|
|||
|
|
@ -12130,7 +12130,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|||
'click .img-center': function (e, value, row, index) {
|
||||
var data = [];
|
||||
value = value === null ? '' : value.toString();
|
||||
var arr = value != '' ? split(",") : [];
|
||||
var arr = value != '' ? value.split(",") : [];
|
||||
$.each(arr, function (index, value) {
|
||||
data.push({
|
||||
src: Fast.api.cdnurl(value),
|
||||
|
|
|
|||
|
|
@ -11979,7 +11979,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|||
'click .img-center': function (e, value, row, index) {
|
||||
var data = [];
|
||||
value = value === null ? '' : value.toString();
|
||||
var arr = value != '' ? split(",") : [];
|
||||
var arr = value != '' ? value.split(",") : [];
|
||||
$.each(arr, function (index, value) {
|
||||
data.push({
|
||||
src: Fast.api.cdnurl(value),
|
||||
|
|
|
|||
|
|
@ -602,7 +602,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
|||
'click .img-center': function (e, value, row, index) {
|
||||
var data = [];
|
||||
value = value === null ? '' : value.toString();
|
||||
var arr = value != '' ? split(",") : [];
|
||||
var arr = value != '' ? value.split(",") : [];
|
||||
$.each(arr, function (index, value) {
|
||||
data.push({
|
||||
src: Fast.api.cdnurl(value),
|
||||
|
|
|
|||
Loading…
Reference in New Issue