升级静态文件

This commit is contained in:
icret
2022-03-16 15:18:32 +08:00
parent 699b4451ce
commit 1ccb28e2e9
7 changed files with 179 additions and 136 deletions

View File

@@ -13,16 +13,7 @@ foreach ($expand as $val) {
';
}
}
// 检测是否更改默认域名
if (strstr('localhost|127.0.0.1', $_SERVER['HTTP_HOST'])) {
echo '
<script>
new $.zui.Messager("请修改默认域名,可能会导致网站访问异常! ",{
type: "black" // 定义颜色主题
}).show();
</script>
';
}
// 检测是否修改默认密码
if ($config['password'] === 'e6e061838856bf47e1de730719fb2609') {
echo '
@@ -34,6 +25,31 @@ if ($config['password'] === 'e6e061838856bf47e1de730719fb2609') {
</script>
';
}
/*
// 检测是否更改默认域名
if (strstr('localhost|127.0.0.1|192.168.', $_SERVER['HTTP_HOST'])) {
echo '
<script>
new $.zui.Messager("请修改默认域名,可能会导致网站访问异常! ",{
type: "black" // 定义颜色主题
}).show();
</script>
';
}
*/
// 检测是否局域网访问
if (is_local($config['domain'])) {
echo '
<script>
new $.zui.Messager("当前使用局域网,可能会导致外网访问异常!",{
type: "black" // 定义颜色主题
}).show();
</script>
';
}
// 检测监黄接口是否可以访问
if ($configp['checkImg'] !== 0) {

View File

@@ -112,34 +112,47 @@ function imgName($source = null)
return trim(com_create_guid(), '{}');
}
return strtolower(sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535)));
return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}
switch ($config['imgName']) {
case "source": // 以上传文件名称 例微信图片_20211228214754
case "source":
// 以上传文件名称 例微信图片_20211228214754
// 过滤非法名称 $source = preg_replace("/\/|\~|\!|\@|\#|\\$|\%|\^|\&|\*|\(|\)|\_|\+|\{|\}|\:|\<|\>|\?|\[|\]|\,|\.|\/|\;|\'|\`|\-|\=|\\\|\|/","",$source);
return $source;
break;
case "date": // 以上传时间 例192704
case "date":
// 以上传时间 例192704
return date("His");
break;
case "unix": // 以Unix时间 例1635074840
case "unix":
// 以Unix时间 例1635074840
return time();
break;
case "uniqid": // 基于以微秒计的当前时间 例6175436c73418
case "uniqid":
// 基于以微秒计的当前时间 例6175436c73418
return uniqid(true);
break;
case "guid": // 全球唯一标识符 例6EDAD0CC-AB0C-4F61-BCCA-05FAD65BF0FA
case "guid":
// 全球唯一标识符 例6EDAD0CC-AB0C-4F61-BCCA-05FAD65BF0FA
return create_guid();
break;
case "md5": // md5加密时间 例3888aa69eb321a2b61fcc63520bf6c82
case "md5":
// md5加密时间 例3888aa69eb321a2b61fcc63520bf6c82
return md5(microtime());
break;
case "sha1": // sha1加密微秒 例654faac01499e0cb5fb0e9d78b21e234c63d842a
case "sha1":
// sha1加密微秒 例654faac01499e0cb5fb0e9d78b21e234c63d842a
return sha1(microtime());
break;
case "crc32":
// crc32加密微秒 例2495551279
return crc32(microtime());
break;
default:
return base_convert(date('His') . mt_rand(1001, 9999), 10, 36); // 将上传时间+随机数转换为36进制 例vx77yu
// 将上传时间+随机数转换为36进制 例vx77yu
return base_convert(date('His') . mt_rand(1001, 9999), 10, 36);
}
}
@@ -1163,8 +1176,23 @@ function isWebpAnimated($src)
// animated
$isAnimated = true;
} else {
// non animated
// not animated
$isAnimated = false;
}
return $isAnimated;
}
/**
* 根据URL判断是否本地局域网访问PHP代码函数
* https://blog.csdn.net/monxinmonxin0/article/details/44854383
* @param $url 要判断的网址
* @return bool 是|否
*/
function is_local($url)
{
if (stristr($url, 'localhost') || stristr($url, '127.') || stristr($url, '192.')) {
return true;
} else {
return false;
}
}

View File

@@ -73,12 +73,12 @@
.card {
box-shadow: rgba(0, 0, 0, 0.45) 0px 25px 20px -20px;
border-radius: 10px;
border-radius: 5px 5px 5px 5px;
}
img {
cursor: pointer;
transition: all 0.6s;
transition: all 0.8s;
}
img:hover {
@@ -90,9 +90,8 @@
.bottom-bar {
width: 100%;
position: absolute;
left: 0;
bottom: 0px;
background-color: rgba(0, 0, 0, 0.5);
bottom: -4px;
background-color: rgba(0, 0, 0, 0.4);
}
</style>
<div class="row" style="margin-bottom:100px">

View File

@@ -48,7 +48,7 @@ Thumb::show($src, $w, $h);
require_once __DIR__ . '/function.php';
// 中文翻译 https://my.oschina.net/whrlmc/blog/81739
define('LOCAL_FILE_BASE_DIRECTORY', APP_ROOT);
define('MEMORY_LIMIT', '128M');
define('MEMORY_LIMIT', '256M');
define('DEFAULT_WIDTH', 258);
define('DEFAULT_HEIGHT', 258);
define('FILE_CACHE_PREFIX', 'EasyImage');
@@ -60,10 +60,10 @@ define('FILE_CACHE_DIRECTORY', APP_ROOT . $config['path'] . 'thumbnails');
define('NOT_FOUND_IMAGE', $config['imgurl'] . '/public/images/404.png');
define('ERROR_IMAGE', $config['imgurl'] . '/public/images/404.png');
define('DISPLAY_ERROR_MESSAGES', false);
define('MAX_FILE_SIZE', 10485760); // 10 Megs 是 10485760。这是我们将处理的最大内部或外部文件大小。
define('MAX_FILE_SIZE', 10485760); // 10 Megs 是 10485760。这是我们将处理的最大内部或外部文件大小。
define('FILE_CACHE_TIME_BETWEEN_CLEANS', 86400); // 多久清理一次缓存
define('FILE_CACHE_MAX_FILE_AGE', 86400); // 文件必须从缓存中删除多长时间
define('BROWSER_CACHE_MAX_AGE', 864000); // 浏览器缓存时间
define('FILE_CACHE_MAX_FILE_AGE', 86400); // 文件必须从缓存中删除多长时间
define('BROWSER_CACHE_MAX_AGE', 864000); // 浏览器缓存时间
global $ALLOWED_SITES;
$ALLOWED_SITES = array(