修复开启登录上传后无法上传bug,安装增加user.ini检测

pull/18/head
icret 2022-01-28 21:32:29 +08:00
parent 11c8ee4f0b
commit 7e8f021bf1
7 changed files with 62 additions and 34 deletions

View File

@ -94,7 +94,7 @@ $HTTP["url"] =~ "^/(i|public)/" {
fastcgi.server = ()
}
```
- 或者参考:[https://blog.png.cm/981.html](https://blog.png.cm/981.html)
- 或者参考:[https://blog.png.cm/996.html](https://blog.png.cm/996.html)
<details><summary><mark><font color=darkred>点击查看2.0版更新日志</font></mark></summary>
@ -252,7 +252,7 @@ RewriteRule config/(.*).(php)$ [F]
deny all;
}
```
- - 或者参考https://blog.png.cm/992.html https://blog.png.cm/939.html
- - 或者参考https://blog.png.cm/939.html
- 一些精简
* 2021-4-14 v2.0.2.1 Dev1

View File

@ -464,8 +464,8 @@ function is_who_login($user)
function checkEnv($mode)
{
// 初始化安装
if (!file_exists(APP_ROOT . '/install/install.lock') and file_exists(APP_ROOT . '/install/install.php')) {
exit('<script type="text/javascript">window.location.href="' . get_whole_url('/') . '/install/index.php"</script>');
if (!is_file(APP_ROOT . '/install/install.lock') and is_file(APP_ROOT . '/install/install.php')) {
echo '<script type="text/javascript">window.location.href="' . get_whole_url('/') . '/install/index.php"</script>';
}
if ($mode) {
@ -644,12 +644,24 @@ function re_checkImg($name)
{
global $config;
$fileToPath = str_replace('_', '/', $name); // 将图片名称还原为带路径的名称eg:2021_11_03_pbmn1a.jpg =>2021/11/03/pbmn1a.jpg
$fileToPath = str_replace('_', '/', $name); // 将图片名称还原为带路径的名称eg:2021_11_03_pbmn1a.jpg =>2021/11/03/pbmn1a.jpg
$now_path_file = APP_ROOT . $config['path'] . 'suspic/' . $name; // 当前图片绝对位置 */i/suspic/2021_10_30_p8vypd.png
$to_file = APP_ROOT . $config['path'] . $fileToPath; // 要还原图片的绝对位置 */i/2021/10/30/p8vypd.png
rename($now_path_file, $to_file);
if (is_file($now_path_file)) {
$to_file = APP_ROOT . $config['path'] . $fileToPath; // 要还原图片的绝对位置 */i/2021/10/30/p8vypd.png
rename($now_path_file, $to_file); // 移动文件
} else {
echo "
<script>
new $.zui.Messager('文件不存在!', {
type: 'danger', // 定义颜色主题
icon: 'warning-sign'
}).show();
</script>
";
}
}
/**
* 创建缩略图
* @param $imgName string 需要创建缩略图的名称

View File

@ -80,5 +80,5 @@ $config=Array
'check_ip_model'=>0,
'check_ip_list'=>'',
'version'=>'2.4.7',
'form'=>'2022-01-27 17:20:14'
'form'=>'2022-01-28 21:21:52'
);

View File

@ -7,7 +7,6 @@ require APP_ROOT . '/application/WaterMask.php';
// 检查登录
if ($config['mustLogin']) {
checkLogin();
exit;
}
// 黑/白IP名单上传

View File

@ -12,7 +12,7 @@ if (isset($_POST['password'])) {
$config['user'] = $_POST['user'];
} else {
exit('<script>window.alert("两次密码不一致请重新输入");location.href="./index.php";</script>');
exit('<script>window.alert("两次密码不一致请重新输入!");location.href="./index.php";</script>');
}
}
@ -32,7 +32,7 @@ file_put_contents(APP_ROOT . '/install/install.lock', '安装程序锁定文件
// 删除安装目录
if (isset($_POST['del_install'])) {
if ($_POST['del_install'] == "del") {
deldir(APP_ROOT . "/install/");
deldir(APP_ROOT . "/install");
}
}
@ -43,15 +43,15 @@ if (isset($_POST['del_extra_files'])) {
@unlink(APP_ROOT . '/LICENSE');
@unlink(APP_ROOT . '/README.md');
@unlink(APP_ROOT . '/config/EasyIamge.lock');
@deldir(APP_ROOT . "/.github/");
@deldir(APP_ROOT . "/.git/");
@deldir(APP_ROOT . "/.github");
@deldir(APP_ROOT . "/.git");
}
}
// 跳转主页
echo '
<script>
window.alert("安装成功,即将为您跳转到登陆界面");
location.href="../admin/index.php";
window.alert("安装成功,即将为您跳转到登陆界面!");
location.href="../index.php";
</script>
';

View File

@ -27,6 +27,8 @@ if (!IS_WIN) {
}
}
$userINI = is_file(APP_ROOT . '/.user.ini') ? false : true; // user.ini
function checkPASS($name)
{
if ($name) {
@ -49,12 +51,13 @@ function checkPASS($name)
<meta name="description" content="EasyIamge 2.0 安装环境检测" />
<link rel="shortcut icon" href="./../favicon.ico" type="image/x-icon" />
<link href="./../public/static/zui/css/zui.min.css?v1.10.0" rel="stylesheet">
<link href="./../public/static/nprogress.min.css?v1.10.0" rel="stylesheet">
<script src="./../public/static/zui/lib/jquery/jquery-3.4.1.min.js?v3.4.1"></script>
<script src="./../public/static/zui/js/zui.min.js?v1.10.0"></script>
<script src="./../public/static/qrcode.min.js?v2.0"></script>
<script src="./../public/static/nprogress.min.js"></script>
</head>
<body class="container">
<!-- install header html end -->
@ -98,14 +101,17 @@ function checkPASS($name)
<td>可写</td>
<td><?php checkPASS($i_wjj); ?></td>
</tr>
<tr>
<td>.user.ini</td>
<td>防止跨目录访问和读取文件-><a href="https://lnmp.org/faq/lnmp-vhost-add-howto.html#user.ini" target="_blank">删除方法</a></td>
<td><?php checkPASS($userINI); ?></td>
</tr>
</tbody>
</table>
<?php
$checkres = array($phpEnv, $fileinfo, $gd, $i_wjj, $file_php);
$checkres = array($phpEnv, $fileinfo, $gd, $i_wjj, $file_php, $userINI);
if (in_array(false, $checkres)) {
echo '<p class="text-danger">如果你的PHP版本较低或者不想安装上述PHP扩展请删除<code>install</code>目录</p>
@ -125,7 +131,7 @@ function checkPASS($name)
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span>
<span aria-hidden="true">x</span>
<span class="sr-only">关闭</span></button>
<h4 class="modal-title icon icon-mobile" style="text-align: center">扫描二维码使用手机上传</h4>
</div>
@ -141,6 +147,13 @@ function checkPASS($name)
</div>
</div>
<script>
// NProgress
NProgress.configure({
showSpinner: false
});
NProgress.set(0.0);
NProgress.set(0.5);
// js二维码 获取当前网址并赋值给id=text的value
document.getElementById("text").value = window.location.href;
var qrcode = new QRCode(document.getElementById("qrcode"), {
@ -170,7 +183,6 @@ function checkPASS($name)
</script>
<footer class="text-muted small col-md-12" style="text-align: center;margin-bottom: 10px">
<hr>
<p><a href="/../admin/terms.php" target="_blank">请勿上传违反中国政策的图片</a><i class="icon icon-smile"></i></p>
<div>
<!-- 对话框触发按钮 -->
<a href="#" data-position="center" data-moveable="inside" data-moveable="true" data-toggle="modal" data-target="#myModal">

View File

@ -17,16 +17,18 @@ if ($state !== 'checked') {
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>EasyIamge 2.0 即将完成安装</title>
<title>EasyIamge 2.0 即将完成安装!</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="EasyIamge 2.0 即将完成安装" />
<meta name="description" content="EasyIamge 2.0 即将完成安装" />
<meta name="keywords" content="EasyIamge 2.0 即将完成安装!" />
<meta name="description" content="EasyIamge 2.0 即将完成安装!" />
<link rel="shortcut icon" href="./../favicon.ico" type="image/x-icon" />
<link href="./../public/static/zui/css/zui.min.css?v1.10.0" rel="stylesheet">
<link href="./../public/static/nprogress.min.css?v1.10.0" rel="stylesheet">
<script src="./../public/static/zui/lib/jquery/jquery-3.4.1.min.js?v3.4.1"></script>
<script src="./../public/static/zui/js/zui.min.js?v1.10.0"></script>
<script src="./../public/static/qrcode.min.js?v2.0"></script>
<script src="./../public/static/nprogress.min.js"></script>
<style>
.message {
font-size: 12px;
@ -52,7 +54,7 @@ if ($state !== 'checked') {
<div class="form-group">
<label class="col-sm-2">网站域名,末尾不加"/"</label>
<div class="col-md-6 col-sm-10">
<input type="url" class="form-control" name="domain" value="<?php echo get_whole_url('/install/install.php'); ?>" required="required" onkeyup="this.value=this.value.replace(/\s/g,'')" placeholder="网站域名与图片链接域名可以不同比如A域名上传可以返回B域名图片链接如果不变的话下边2个填写成一样的" title="网站域名与图片链接域名可以不同比如A域名上传可以返回B域名图片链接如果不变的话下边2个填写成一样的">
<input type="url" class="form-control" name="domain" value="<?php echo get_whole_url('/install/install.php'); ?>" required="required" onkeyup="this.value=this.value.replace(/\s/g,'')" placeholder="网站域名与图片链接域名可以不同比如A域名上传可以返回B域名图片链接如果不变的话下边2个填写成一样的!" title="网站域名与图片链接域名可以不同比如A域名上传可以返回B域名图片链接如果不变的话下边2个填写成一样的!">
</div>
</div>
<div class="form-group">
@ -74,6 +76,7 @@ if ($state !== 'checked') {
<input type="text" class="form-control inp" name="password" value="" required="required" placeholder="请使用英文输入法输入密码并不小于8位数" onkeyup="this.value=this.value.replace(/\s/g,'')">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 ">确认密码</label>
<div class="col-md-6 col-sm-10">
@ -84,7 +87,7 @@ if ($state !== 'checked') {
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" name="del_extra_files" value="del" checked><span style="font-weight: bold;color:green;" title="删除Github/Gitee下载的多余文件">删除多余文件</span>
<input type="checkbox" name="del_extra_files" value="del" checked><span style="font-weight: bold;color:green;" title="删除Github|Gitee下载的多余文件">删除多余文件</span>
</label>
<label>
<input type="checkbox" name="del_install" value="del"><span style="font-weight: bold;color:red;">删除安装目录</span>
@ -94,13 +97,12 @@ if ($state !== 'checked') {
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-success">准备就绪,开始安装!</button>
<a class="btn btn" href="index.php">上一步</a>
<button type="submit" class="btn btn-success">开始安装</button>
</div>
</div>
</form>
</div>
<script>
var password = document.querySelector('.inp');
var message = document.querySelector('.message');
@ -115,15 +117,13 @@ if ($state !== 'checked') {
}
}
</script>
<!-- install bottom HTML start -->
<div class="modal fade" id="myModal">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span>
<span aria-hidden="true">x</span>
<span class="sr-only">关闭</span></button>
<h4 class="modal-title icon icon-mobile" style="text-align: center">扫描二维码使用手机上传</h4>
</div>
@ -139,6 +139,12 @@ if ($state !== 'checked') {
</div>
</div>
<script>
// NProgress
NProgress.configure({
showSpinner: false
});
NProgress.set(0.5);
NProgress.set(0.9);
// js二维码 获取当前网址并赋值给id=text的value
document.getElementById("text").value = window.location.href;
var qrcode = new QRCode(document.getElementById("qrcode"), {
@ -168,7 +174,6 @@ if ($state !== 'checked') {
</script>
<footer class="text-muted small col-md-12" style="text-align: center;margin-bottom: 10px">
<hr>
<p><a href="/../admin/terms.php" target="_blank">请勿上传违反中国政策的图片</a><i class="icon icon-smile"></i></p>
<div>
<!-- 对话框触发按钮 -->
<a href="#" data-position="center" data-moveable="inside" data-moveable="true" data-toggle="modal" data-target="#myModal">