This commit is contained in:
icret
2022-05-27 00:13:59 +08:00
parent 4f73cae1fc
commit 313ce88a64
8 changed files with 45 additions and 64 deletions

View File

@@ -8,8 +8,8 @@ if (!is_file(APP_ROOT . '/install/install.lock') and is_file(APP_ROOT . '/instal
* 检测弹窗内容
*/
if (file_exists(APP_ROOT . '/config/EasyIamge.lock')) return; // 查询锁定弹窗文件是否存在
file_put_contents(APP_ROOT . '/config/EasyIamge.lock', '安装环境检测锁定文件,如需再次展示请删除此文件!', FILE_APPEND | LOCK_EX);
if (file_exists(APP_ROOT . '/admin/EasyIamge.lock')) return; // 查询锁定弹窗文件是否存在
file_put_contents(APP_ROOT . '/admin/EasyIamge.lock', '安装环境检测锁定文件,如需再次展示请删除此文件!', FILE_APPEND | LOCK_EX);
?>
<div class="modal fade" id="myModal-1">
<div class="modal-dialog">

View File

@@ -14,13 +14,13 @@ class getVerson
$this->url = $url;
}
public function readJson()
public function readJson($name = 'tag_name')
{
if (file_exists(__DIR__ . '/../admin/logs/verson/verson.json')) {
$file = fopen(__DIR__ . '/../admin/logs/verson/verson.json', 'r');
$test = fread($file, filesize(__DIR__ . '/../admin/logs/verson/verson.json'));
$verson = json_decode($test, true);
return $verson['tag_name'];
return $verson[$name];
fclose($file);
} else {
$this->downJson();
@@ -30,9 +30,8 @@ class getVerson
public function downJson()
{
if(!is_dir(__DIR__.'/../admin/logs/verson/'))
{
mkdir(__DIR__.'/../admin/logs/verson/',0755,true);
if (!is_dir(__DIR__ . '/../admin/logs/verson/')) {
mkdir(__DIR__ . '/../admin/logs/verson/', 0755, true);
}
$verson = $this->geturl($this->url);

View File

@@ -80,7 +80,6 @@ function checkLogin()
return 203;
}
// 管理员登陆
if ($getCOK[1] == $config['password']) {
return 204;
@@ -179,7 +178,7 @@ function config_path($path = null)
global $config;
// php5.6 兼容写法:
$path = isset($path) ? $path : date('Y/m/d/');
// php7.0 $path = $path ?? date('Y/m/d/');
// php7.0 $path = $path ?? date('Y/m/d/');
$img_path = $config['path'] . $path;
if (!is_dir($img_path)) {
@@ -662,7 +661,7 @@ function imgRatio()
* 定时获取GitHub 最新版本
* @return mixed|null 读取版本信息
*/
function getVersion()
function getVersion($name = 'tag_name')
{
global $config;
@@ -677,7 +676,7 @@ function getVersion()
$get_ver_day = array('1006', '2501'); // 检测日期的时间
foreach ($get_ver_day as $day) {
if (empty($getVersion->readJson())) { // 不存在就下载
if (empty($getVersion->readJson($name))) { // 不存在就下载
$getVersion->downJson();
} else if ($day == $now) { // 是否在需要更新的日期
$getVersion->downJson();
@@ -686,7 +685,7 @@ function getVersion()
return null;
*/
} else { // 返回版本
return $getVersion->readJson();
return $getVersion->readJson($name);
}
}
}
@@ -1347,41 +1346,13 @@ function isAnimatedGifWebp($src)
return strpos($filecontent, chr(0x21) . chr(0xff) . chr(0x0b) . 'NETSCAPE2.0') === FALSE ? false : true;
}
/**
* 读取日志
* @param String $logs 文件路径
*/
function read_upload_logs($logs = null)
{
global $config;
$logs = isset($logs) ? $logs : APP_ROOT . '/admin/logs/upload/' . date('Y-m') . '.php';
if ($config['upload_logs'] == 0) {
$logs = '已经关闭了上传日志!';
} else {
if (file_exists($logs)) {
$logs = file_get_contents($logs, false, null, 274, 1000000);
$logs = str_replace(
array('{', '}}', '"', '\\', 'source:', 'date:', 'ip:', 'port:', 'user_agent:', 'path:', 'size:', 'checkImg:', 'from:'),
array('', '', '', '', '源名:', '日期:', 'IP:', '端口:', '信息:', '路径:', '大小:', '鉴黄状态:', '来源:'),
$logs
);
} else {
$logs = "日志文件不存在,可能是当前月份没有新上传日志,请尝试上传一张!";
}
}
return $logs;
}
/**
* 获取当前版本号
* @param String $file 文件相对路径
* @return String 内容信息
*/
function get_current_verson($file = '/config/verson.txt')
function get_current_verson($file = '/admin/verson.txt')
{
$file = APP_ROOT . $file;
@@ -1390,5 +1361,5 @@ function get_current_verson($file = '/config/verson.txt')
return file_get_contents($file);
}
return 'No Verson file';
return 'No Verson';
}