Skip to content

Commit 313ce88

Browse files
committed
v2.6.5
1 parent 4f73cae commit 313ce88

File tree

8 files changed

+45
-64
lines changed

8 files changed

+45
-64
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ $HTTP["url"] =~ "^/(i|public)/" {
180180

181181
<details><summary>点击查看2.0版更新日志</summary>
182182

183+
* 2022-05-27 v2.6.5
184+
- 更改文件位置
185+
183186
* 2022-05-26 v2.6.4
184187
- 更改版本显示方式
185188

admin/admin.inc.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -780,12 +780,20 @@
780780
<a href="https://github.com/verot/class.upload.php" target="_blank"><span class="label label-badge label-success" data-toggle="tooltip" title="文件管理">Tinyfilemanager</span></a>
781781
<span class="label label-badge label-success" data-toggle="tooltip" title="当前版本"><?php echo get_current_verson(); ?></span>
782782
<?php if (getVersion() !== get_current_verson()) : ?>
783-
<a href="https://github.com/icret/EasyImages2.0/releases" target="_blank"><span class="label label-badge label-warning" data-toggle="tooltip" title="Github有更新,更新后删除<p>/admin/logs/verson/</p>文件夹会自动同步最新版本号"><?php echo getVersion(); ?> New</span></a>
783+
<a href="#NewVersion" data-toggle="collapse" class="label label-badge label-warning" title="Github有更新"><?php echo getVersion(); ?> New</span></a>
784784
<?php endif; ?>
785785
<a href="https://github.com/icret/EasyImages2.0/blob/master/LICENSE" target="_blank"><span class="label label-badge" data-toggle="tooltip" title="许可证">GPL-2.0</span></a>
786786
</p>
787787
<p class="text-muted"><i class="icon icon-certificate"> EasyImage2.0简单图床构建于众多优秀的开源项目之上,非常感谢这些项目!</i></p>
788788
</div>
789+
<div class="collapse" id="NewVersion">
790+
<div class="bg-primary with-padding">
791+
<p>最新版本: <?php echo getVersion('name'); ?> <a href="<?php echo getVersion('zipball_url'); ?>" target="_blank" class="label label-badge">点击下载</a></p>
792+
<p>更新日期: <?php echo getVersion('created_at'); ?></p>
793+
<p>更新内容: <br /><?php echo getVersion('body'); ?></p>
794+
<p>更新后删除<small style="color: black;">/admin/logs/verson/</small>文件夹会自动同步最新版本号</p>
795+
</div>
796+
</div>
789797
</div>
790798
<div class="tab-pane fade" id="Content9">
791799
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">

admin/verson.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.6.5

application/check.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
* 检测弹窗内容
99
*/
1010

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

application/class.version.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ public function __construct($url)
1414
$this->url = $url;
1515
}
1616

17-
public function readJson()
17+
public function readJson($name = 'tag_name')
1818
{
1919
if (file_exists(__DIR__ . '/../admin/logs/verson/verson.json')) {
2020
$file = fopen(__DIR__ . '/../admin/logs/verson/verson.json', 'r');
2121
$test = fread($file, filesize(__DIR__ . '/../admin/logs/verson/verson.json'));
2222
$verson = json_decode($test, true);
23-
return $verson['tag_name'];
23+
return $verson[$name];
2424
fclose($file);
2525
} else {
2626
$this->downJson();
@@ -30,9 +30,8 @@ public function readJson()
3030
public function downJson()
3131
{
3232

33-
if(!is_dir(__DIR__.'/../admin/logs/verson/'))
34-
{
35-
mkdir(__DIR__.'/../admin/logs/verson/',0755,true);
33+
if (!is_dir(__DIR__ . '/../admin/logs/verson/')) {
34+
mkdir(__DIR__ . '/../admin/logs/verson/', 0755, true);
3635
}
3736

3837
$verson = $this->geturl($this->url);

application/function.php

+6-35
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ function checkLogin()
8080
return 203;
8181
}
8282

83-
8483
// 管理员登陆
8584
if ($getCOK[1] == $config['password']) {
8685
return 204;
@@ -179,7 +178,7 @@ function config_path($path = null)
179178
global $config;
180179
// php5.6 兼容写法:
181180
$path = isset($path) ? $path : date('Y/m/d/');
182-
// php7.0 $path = $path ?? date('Y/m/d/');
181+
// php7.0 $path = $path ?? date('Y/m/d/');
183182
$img_path = $config['path'] . $path;
184183

185184
if (!is_dir($img_path)) {
@@ -662,7 +661,7 @@ function imgRatio()
662661
* 定时获取GitHub 最新版本
663662
* @return mixed|null 读取版本信息
664663
*/
665-
function getVersion()
664+
function getVersion($name = 'tag_name')
666665
{
667666
global $config;
668667

@@ -677,7 +676,7 @@ function getVersion()
677676
$get_ver_day = array('1006', '2501'); // 检测日期的时间
678677

679678
foreach ($get_ver_day as $day) {
680-
if (empty($getVersion->readJson())) { // 不存在就下载
679+
if (empty($getVersion->readJson($name))) { // 不存在就下载
681680
$getVersion->downJson();
682681
} else if ($day == $now) { // 是否在需要更新的日期
683682
$getVersion->downJson();
@@ -686,7 +685,7 @@ function getVersion()
686685
return null;
687686
*/
688687
} else { // 返回版本
689-
return $getVersion->readJson();
688+
return $getVersion->readJson($name);
690689
}
691690
}
692691
}
@@ -1347,41 +1346,13 @@ function isAnimatedGifWebp($src)
13471346
return strpos($filecontent, chr(0x21) . chr(0xff) . chr(0x0b) . 'NETSCAPE2.0') === FALSE ? false : true;
13481347
}
13491348

1350-
/**
1351-
* 读取日志
1352-
* @param String $logs 文件路径
1353-
*/
1354-
function read_upload_logs($logs = null)
1355-
{
1356-
global $config;
1357-
1358-
$logs = isset($logs) ? $logs : APP_ROOT . '/admin/logs/upload/' . date('Y-m') . '.php';
1359-
1360-
if ($config['upload_logs'] == 0) {
1361-
$logs = '已经关闭了上传日志!';
1362-
} else {
1363-
if (file_exists($logs)) {
1364-
$logs = file_get_contents($logs, false, null, 274, 1000000);
1365-
$logs = str_replace(
1366-
array('{', '}}', '"', '\\', 'source:', 'date:', 'ip:', 'port:', 'user_agent:', 'path:', 'size:', 'checkImg:', 'from:'),
1367-
array('', '', '', '', '源名:', '日期:', 'IP:', '端口:', '信息:', '路径:', '大小:', '鉴黄状态:', '来源:'),
1368-
$logs
1369-
);
1370-
} else {
1371-
$logs = "日志文件不存在,可能是当前月份没有新上传日志,请尝试上传一张!";
1372-
}
1373-
}
1374-
1375-
return $logs;
1376-
}
1377-
13781349
/**
13791350
* 获取当前版本号
13801351
* @param String $file 文件相对路径
13811352
* @return String 内容信息
13821353
*/
13831354

1384-
function get_current_verson($file = '/config/verson.txt')
1355+
function get_current_verson($file = '/admin/verson.txt')
13851356
{
13861357
$file = APP_ROOT . $file;
13871358

@@ -1390,5 +1361,5 @@ function get_current_verson($file = '/config/verson.txt')
13901361
return file_get_contents($file);
13911362
}
13921363

1393-
return 'No Verson file';
1364+
return 'No Verson';
13941365
}

config/config.php

+20-20
Large diffs are not rendered by default.

config/verson.txt

-1
This file was deleted.

0 commit comments

Comments
 (0)