优化安装程序

This commit is contained in:
LyLme 2024-05-06 00:38:03 +08:00
parent c5bd52df18
commit 37b83cff3e
8 changed files with 76 additions and 45 deletions

View File

@ -36,7 +36,7 @@ INSERT INTO `lylme_config` VALUES
(5, 'background', './assets/img/background.jpg', '背景图片'),
(6, 'title', '上网导航 - LyLme Spage', '网站标题'),
(7, 'cdnpublic', NULL, 'CDN地址'),
(8, 'copyright', 'Copyright ©2022 <a href=\"/\">LyLme Spage</a>. All Rights Reserved.', '版权代码'),
(8, 'copyright', 'Copyright ©2022-2024 <a href=\"/\">LyLme Spage</a>. All Rights Reserved.', '版权代码'),
(9, 'description', '六零导航页(LyLme Spage)致力于简洁高效无广告的上网导航和搜索入口,沉淀最具价值链接,全站无商业推广,简约而不简单。', '网站描述'),
(10, 'home-title', '<h2 class=\"title\">上网,从这里开始!</h2>', '首页标题'),
(11, 'icp', '', '备案号'),
@ -46,7 +46,7 @@ INSERT INTO `lylme_config` VALUES
(15, 'template', 'default', '网站模板'),
(16, 'wztj', '', '网站统计代码(自定义footer)'),
(17, 'tq', 'true', '天气显示开关'),
(18, 'version', 'v1.8.5', '程序版本'),
(18, 'version', 'v1.9.5', '程序版本'),
(19, 'wap_background', NULL, '手机端背景'),
(20, 'wxplus', '', '微信推送密钥'),
(21, 'wxplustime', '20:00', '微信推送时间'),
@ -106,7 +106,7 @@ INSERT INTO `lylme_links` VALUES
(17, '斗鱼直播', 1, 'https://www.douyu.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-douyu00\"></use></svg>', NULL, 10, 1, 0),
(18, '企鹅电竞', 1, 'https://egame.qq.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-qie00\"></use></svg>', NULL, 10, 1, 0),
(19, '微信文件传输助手', 1, 'https://filehelper.weixin.qq.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-wechat00\"></use></svg>', NULL, 10, 1, 0),
(20, '120秒视界', 1, 'https://60s.lylme.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-remen\"></use></svg>', NULL, 10, 1, 0),
(20, '今日热点', 1, 'https://60s.lylme.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-remen\"></use></svg>', NULL, 10, 1, 0),
(21, 'Office模板', 2, 'https://www.officeplus.cn/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-office00\"></use></svg>', NULL, 10, 1, 0),
(22, '搞定设计', 2, 'https://www.gaoding.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-gaoding00\"></use></svg>', NULL, 10, 1, 0),
(23, '素材天下', 2, 'http://www.sucaitianxia.net/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-video\"></use></svg>', NULL, 10, 1, 0),
@ -164,9 +164,7 @@ INSERT INTO `lylme_links` VALUES
(75, 'STEAM', 6, 'https://store.steampowered.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-steam00\"></use></svg>', NULL, 10, 1, 0),
(76, '王者荣耀', 6, 'https://pvp.qq.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-wzry00\"></use></svg>', NULL, 10, 1, 0),
(77, '3DM GAME', 6, 'https://www.3dmgame.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-games00\"></use></svg>', NULL, 10, 1, 0),
(78, '官方主页', 7, 'https://www.lylme.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-home00\"></use></svg>', NULL, 10, 1, 0),
(79, '申请收录', 7, '/apply', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-sq00\"></use></svg>', NULL, 10, 1, 0),
(80, '建议&反馈', 7, 'https://support.qq.com/products/356339', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-fk00\"></use></svg>', NULL, 10, 1, 0);
(78, '申请收录', 7, '/apply', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-sq00\"></use></svg>', NULL, 10, 1, 0);
DROP TABLE IF EXISTS `lylme_pwd`;
CREATE TABLE `lylme_pwd` (
@ -210,12 +208,9 @@ CREATE TABLE `lylme_tags` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `lylme_tags` VALUES
(1, '主页', 'https://www.lylme.com/', 0, 10),
(2, '博客', 'https://blog.lylme.com/', 1, 10),
(3, 'Github', 'https://github.com/lylme', 1, 10),
(4, '关于本站', '/about', 1, 10),
(5, '申请收录', '/apply', 1, 10),
(6, '查看', '/pwd', 0, 10);
(1, '关于本站', '/about', 1, 10),
(2, '申请收录', '/apply', 1, 10),
(3, '访问管理', '/pwd', 0, 10);
ALTER TABLE `lylme_apply`

View File

@ -35,10 +35,7 @@ CREATE TABLE `lylme_tags` (
`tag_target` int(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `lylme_tags` (`tag_id`, `tag_name`, `tag_link`, `tag_target`) VALUES
(1, '主页', 'https://www.lylme.com/', 0),
(2, '博客', 'https://blog.lylme.com/', 1),
(3, 'Github', 'https://github.com/lylme', 1),
(4, '关于本站', '/about', 1);
(1, '关于本站', '/about', 10);
ALTER TABLE `lylme_tags`
ADD PRIMARY KEY (`tag_id`);
ALTER TABLE `lylme_tags`

View File

@ -1,4 +1,5 @@
<?php
/**
* @File: index.php
* @User: LyLme <admin@lylme.com>
@ -10,12 +11,12 @@ header('Content-Type:text/html; charset=utf-8');
// 检测php版本号
if (phpversion() < '5.4') {
exit('抱歉您的PHP版本过低请升级到PHP5.4或更高版本再安装!');
if (!(version_compare(phpversion(), '7.1.0', '>=') && version_compare(phpversion(), '8.0.0', '<'))) {
exit('抱歉您的PHP版本过低或过高请将PHP版本修改为PHP7.1及以上(不支持PHP8)再安装!');
}
// 不限制响应时间
//error_reporting(0);
error_reporting(E_ERROR | E_WARNING | E_PARSE);
set_time_limit(0);
// 设置系统路径
@ -42,11 +43,11 @@ $GLOBALS['isNext'] = true;
// 获取当前步骤
function getStep()
{
$s1 = $_GET['s'] ?: 0;
$s1 = isset($_GET['s']) ? $_GET['s'] : 0;
// 初始化参数
$s2 = $_POST['s'] ?: 0;
$s2 = isset($_POST['s']) ? $_POST['s'] : 0;
// 如果有GET值则覆盖POST值
if ($s1 > 0 && in_array($s1, [1, 63832, md5('done')])) {
if ($s1 > 0 && in_array($s1, [1, 6766, md5('done')])) {
$s2 = $s1;
}
return $s2;
@ -187,7 +188,7 @@ if ($s == 3) {
}
// 检测数据库信息
if ($s == 63832) {
if ($s == 6766) {
$dbhost = $_GET['dbhost'] ?: '';
$dbuser = $_GET['dbuser'] ?: '';
$dbpwd = $_GET['dbpwd'] ?: '';
@ -197,7 +198,7 @@ if ($s == 63832) {
$pdo = new PDO($dsn, $dbuser, $dbpwd);
echo 'true';
} catch (Exception $e) {
echo 'false';
echo $e->getMessage();
}
exit();
}
@ -229,6 +230,10 @@ function getExtendArray()
[
'name' => 'mbstring',
'status' => extension_loaded('mbstring'),
],
[
'name' => 'MySQLi',
'status' => extension_loaded('mysqli'),
]
];
foreach ($data as $item) {
@ -300,9 +305,11 @@ function clearBOM($contents)
$charset[1] = substr($contents, 0, 1);
$charset[2] = substr($contents, 1, 1);
$charset[3] = substr($contents, 2, 1);
if (ord($charset[1]) == 239 &&
if (
ord($charset[1]) == 239 &&
ord($charset[2]) == 187 &&
ord($charset[3]) == 191) {
ord($charset[3]) == 191
) {
return substr($contents, 3);
} else {
return $contents;

View File

@ -80,7 +80,7 @@ function CheckForm() {
$.ajax({
url: 'index.php',
data: {
s: 63832,
s: 6766,
dbhost: $("#dbhost").val(),
dbuser: $("#dbuser").val(),
dbpwd: $("#dbpwd").val(),
@ -96,7 +96,7 @@ function CheckForm() {
document.form.submit();
return;
} else {
$('#cpwdTxt').html('<span class="error">不可用</span>');
$('#cpwdTxt').html('<span class="error">'+data+'</span>');
$("#dbpwd").focus();
$('#cpwd').val("false");
return false;
@ -119,7 +119,7 @@ function CheckPwd() {
$.ajax({
url: 'index.php',
data: {
s: 63832,
s: 6766,
dbhost: $("#dbhost").val(),
dbport: $("#dbport").val(),
dbuser: $("#dbuser").val(),
@ -132,7 +132,7 @@ function CheckPwd() {
$('#cpwdTxt').html('<span class="correct">可用</span>');
$('#cpwd').val("true");
} else {
$('#cpwdTxt').html('<span class="error">不可用</span>');
$('#cpwdTxt').html('<span class="error">'+data+'</span>');
$('#cpwd').val("false");
}
}

View File

@ -33,8 +33,8 @@
</tr>
<tr>
<td height="26" class="firstCol">PHP 版本</td>
<td>5.4</td>
<td>7.0</td>
<td>&ge;7.1 && &lt;8.0</td>
<td>7.4</td>
<td class="endCol"><?php echo PHP_VERSION; ?></td>
</tr>
<tr>

View File

@ -46,10 +46,17 @@
<tr>
<td height="40" align="right">数据库密码:</td>
<td><input type="password" name="dbpwd" id="dbpwd" class="input" onblur="CheckPwd()"/>
<span class="cnote"><span id="cpwdTxt"></span></span>
<input type="hidden" name="cpwd" id="cpwd" value="false"></td>
</td>
</tr>
<tr>
<td height="40" align="center" colspan="2">
<span class="cnote"><span id="cpwdTxt"></span></span>
<input type="hidden" name="cpwd" id="cpwd" value="false">
</td>
<td>
</td>
</tr>
<tr>
<td height="40" colspan="2" align="left"><span class="title">默认管理员信息</span></td>
</tr>

View File

@ -1,8 +1,10 @@
<?php if (!defined('IN_INSTALL')) {
exit('Request Error!');
} ?>
<?php $admin_url = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://" . $_SERVER['HTTP_HOST'] . "/admin"; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@ -10,16 +12,24 @@
<link href="templates/style/install.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="templates/js/jquery.min.js"></script>
</head>
<body>
<div class="header"></div>
<div class="mainBody">
<div class="note">
<div class="complete"><strong>现在您可以:</strong><br />
<a href="../">访问首页</a><span></span><a href="../admin/">登录后台</a><br/><br/>
<div class="installed">
<a href="../">访问首页</a><span></span><a class="admin" href="../admin/">登录后台</a>
</div>
<strong>六零导航页安装信息:</strong><br />
<p><b>后台地址:</b><a href="<?php echo $admin_url; ?>"><?php echo $admin_url; ?></a></p>
<p><b>后台账号:</b>admin</p>
<p><b>后台密码:</b>123456</p><br /><br />
您可以访问 <a href="https://doc.lylme.com/sapge/" target="_blank" class="link">帮助文档</a> 获取更多帮助
</div>
</div>
</div>
<div class="footer"><span class="step4"></span> <span class="copyright"><?php echo $cfg_copyright; ?></span></div>
</body>
</html>

View File

@ -349,3 +349,18 @@ input[type="text"]:focus, input[type="password"]:focus {
border: 1px solid #666;
text-decoration: none;
}
.installed {
margin: 0.8rem 0 2rem;
}
.installed a {
background: #46a6ff;
padding: 5px 10px;
font-size: 16px;
border-radius: 10px;
color: #fff;
text-decoration: none !important;
}
.installed .admin {
background: #49739a;
}