更新 1.3.4

This commit is contained in:
六零 2022-07-20 13:13:26 +08:00
parent 1807e424e9
commit b1c763abea
11 changed files with 253 additions and 6 deletions

View File

@ -7,8 +7,14 @@ function theme($theme,$str){
if(!empty($arr[$str])){
return strip_tags($arr[$str]);
}
else if($str =='theme_version'){
return '未知';
}
else if($str =='theme_name'){
return $theme;
}
else{
return 'unknown';
return false;
}
}
$set=isset($_GET['set'])?$_GET['set']:null;
@ -25,7 +31,7 @@ if(!empty($set)) {
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header"><h4>主题设置 <a href="https://spage.lylme.com" target="_blank">更多主题 >></a></h4></div>
<div class="card-header"><h4>主题设置 <a href="https://spage.lylme.com/themes" target="_blank">更多主题 >></a></h4></div>
<div class="card-body">
<div class="table-responsive">
<table class="table">
@ -45,13 +51,21 @@ if(!empty($set)) {
foreach($themes as $theme) {
$theme = str_replace($theme_path ,"" , $theme);
echo'<tr><td><h4>'.theme($theme,"theme_name").' </h4>版本:'.theme($theme,"theme_version").'</td>';
echo '<td><p>'.theme($theme,"theme_explain").'</p></td>';
echo '<td><p>'.theme($theme,"author_name").'</p>';
if(!empty(theme($theme,"author_link"))){
echo ' <a href="'.theme($theme,"author_link").'" target="_blank">作者主页</a>';
echo '<td><p>'.theme($theme,"theme_explain").'</p>';
if(theme($theme,"theme_course")){
echo ' <a href="'.theme($theme,"theme_course").'" target="_blank">主题教程</a>';
}
echo'</td>';
echo '<td><p>'.theme($theme,"author_name").'</p>';
if(theme($theme,"author_link")){
echo ' <a href="'.theme($theme,"author_link").'" target="_blank">作者主页</a>';
}
echo '</td><td>';
if(theme($theme,"theme_demo")){
echo '<p><a class="btn btn-default" href="'.theme($theme,"theme_demo").'" target="_blank">在线演示</a></p>';
}
echo '</td>';
echo '<td><p><a class="btn btn-default" href="'.theme($theme,"theme_demo").'" target="_blank">在线演示</a></p></td>';
if($conf['template'] == $theme) {
echo '<td><p class="btn btn-default disabled">当前使用</p></td>';
} else {

View File

@ -21,6 +21,29 @@ function checkmobile() {
return false;
}
}
//判断蜘蛛
function is_spider(){
$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
$spiders = array(
'Googlebot',
'Baiduspider',
'Yahoo! Slurp',
'YodaoBot',
'msnbot',
'360Spider',
'spider',
'Spider'
//这里可以加入更多的蜘蛛标示
);
foreach ($spiders as $spider) {
$spider = strtolower($spider);
if (strpos($userAgent, $spider) !== false) {
return true;
}
}
return false;
}
function daddslashes($string) {
if(is_array($string)) {
foreach($string as $key => $val) {
@ -295,4 +318,14 @@ function ins_link($name, $url, $icon, $group_id, $status){
return false;
}
}
function theme_file($file){
global $conf;
$theme = ROOT.'template/'.$conf['template'].'/'.$file;
if(file_exists($theme)){
return $theme;
}
else{
return 'template/'.$file;
}
}
?>

View File

@ -47,6 +47,9 @@ if($sqlvn < 10205) {
if($sqlvn < 10300) {
$version = 'v1.3.0';
}
if($sqlvn < 10304) {
$version = 'v1.3.4';
}
$sql=explode(';',$sql);
for ($i=0;$i<count($sql);$i++) {
if (trim($sql[$i])=='')continue;

View File

@ -1,3 +1,3 @@
<?php
define('VERSION', '1.3.0');
define('VERSION', '1.3.4');
?>

48
site/baidu_api.php Normal file
View File

@ -0,0 +1,48 @@
<?php
/* ## 百度主动推动
** 说明:
** 用于百度自动推送建议添加GET方式的CRON执行
** 仅适用于六零导航页1.3.5及以上版本并且已配置伪静态子链格式如http://域名/site-66.html
--------------------------------------
** 使用方法:
** 获取推送接口https://ziyuan.baidu.com/linksubmit/index
** 修改$api为自己的推送接口地址
*/
$api = 'http://data.zz.baidu.com/urls?site=https://hao.lylme.com&token=xxxxxxxx';
//以下内容无需修改
include_once("../include/common.php");
$urls = array();
array_push($urls,siteurl(),siteurl().'/apply',siteurl().'/about');
$sites = $DB->query("SELECT `id` FROM `lylme_links` WHERE `link_pwd` = 0");
while ( $site = $DB->fetch($sites)) {
$url = siteurl().'/site-'.$site['id'].'.html';
array_push($urls,$url);
}
$ch = curl_init();
$options = array(
CURLOPT_URL => $api,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode("\n", $urls),
CURLOPT_HTTPHEADER => array('Content-Type: text/html'),
);
curl_setopt_array($ch, $options);
$results = curl_exec($ch);
$httpCode = curl_getinfo($ch,CURLINFO_HTTP_CODE);
echo $results;
if($httpCode == 200){
$result = json_decode($results,true);
echo('<p>>>>>>>Successful</p>
本次推送:'.count($urls).'<br>
成功推送:'.$result['success'].'<br>
--------------------------------------<br>'.
implode("<br>", $urls));
}
else {
echo('<p>推送失败<br><a href="https://ziyuan.baidu.com/college/courseinfo?id=267&page=3#h2_article_title12">帮助</a></p>');
}
?>

39
site/index.php Normal file
View File

@ -0,0 +1,39 @@
<?php
include("../include/common.php");
$id = daddslashes($_GET['id']);
$sites = $DB->query("select * from lylme_links where id='$id' limit 1");
$site = $DB->fetch($sites);
if (empty($site["icon"])) {
$site["icon"] = '< img src="/assets/img/default-icon.png" alt="' . $site["name"] . '" />';
} else if (!preg_match("/^<svg*/", $site["icon"])) {
$site["icon"] = '< img src="' . $site["icon"] . '" alt="' . $site["name"] . '" />';
} else {
$site["icon"] = $site["icon"];
}
if(empty($DB->num_rows($sites)) || $site['link_pwd']!=0){
include(theme_file('404.php')); //页面不存在
exit();
}
else {
$groups = $DB->query("select `group_name`,`group_icon` from lylme_groups where group_id=".$site['group_id']." limit 1");
$group = $DB->fetch($groups);
print_r($site);
//include(theme_file('site.php'));
// $pv =$site['link_pv']+1;
// $DB->query("UPDATE `lylme_links` SET `link_pv` = '".$pv."' WHERE `lylme_links`.`id` = $id;");
exit();
}
/**
* 变量说明
* $groups['group_name'] 所在分组名称
* $groups['group_icon'] 所在分组图标
* $site['id'] 链接ID
* $site['name'] 链接名称
* $site['url'] 链接地址
* $site['PS'] 链接描述
**/
?>

35
site/sitemap.php Normal file
View File

@ -0,0 +1,35 @@
<?php
include_once("../include/common.php");
header("Content-type: text/xml");
header('HTTP/1.1 200 OK');
echo '<?xml version="1.0" encoding="utf-8"?>'."\n".'<urlset>'."\n";
?>
<url>
<loc><?php echo siteurl()?></loc>
<lastmod><?php echo date('Y-m-d');?></lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc><?php echo siteurl().'/apply'?></loc>
<lastmod><?php echo date('Y-m');?>-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc><?php echo siteurl().'/about'?></loc>
<lastmod><?php echo date('Y-m');?>-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.9</priority>
</url>
<?php
$sites = $DB->query("SELECT `id` FROM `lylme_links` WHERE `link_pwd` = 0");
while ( $site = $DB->fetch($sites)) { ?>
<url>
<loc><?php echo(siteurl().'/site-'.$site['id'].'.html');?></loc>
<lastmod><?php echo date('Y-m');?>-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<?php } ?>
</urlset>

31
site/template/404.php Normal file
View File

@ -0,0 +1,31 @@
<?php
header("status: 404 Not Found");
?>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>404 - 页面不存在</title>
<link href="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap/5.1.3/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
<style>
body{background-color:#fff}
.error-page{height:100%;position:fixed;width:100%}
.error-body{padding-top:5%}
.error-body h1{font-size:210px;font-weight:700;text-shadow:4px 4px 0 #f5f6fa,6px 6px 0 #33cabb;line-height:210px;color:#33cabb}
.error-body h4{margin:30px 0px}
</style>
</head>
<body>
<section class="error-page">
<div class="error-box">
<div class="error-body text-center">
<h1>404</h1>
<h4>抱歉,页面不存在!</h4>
<a href="/" class="btn btn-primary ">返回首页</a>
</div>
</div>
</section>
</body>
</html>

38
site/template/site.php Normal file
View File

@ -0,0 +1,38 @@
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title><?php echo $site['name'] . " - " .explode("-", $conf['title'])[0];?></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="keywords" content="<?php echo $site['name'].','.$conf['keywords']?>" />
<meta name="description" content="<?php echo explode("-", $conf['title'])[0];?>已收录站点:<?php echo $site['name'].'。'.$conf['description']?>" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link href="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/docsify/4.12.2/themes/vue.min.css" type="text/css" rel="stylesheet">
<style>
body{background:#fff!important}
body:not(.ready){overflow:auto!important}
#main{max-width:90%}
p.footer{margin-top:60px}
a{text-decoration:none}
svg.icon{width:40px;height:40px}
p.footer{width:100%;position:fixed;bottom:0;text-align:center}
span.site_name{font-size:22px;margin:0;font-weight:700;margin-left:5px}
.service-wrap-w a{color:#fff!important}
#SOHUCS #SOHU_MAIN .module-mobile-cmt-header{background-color:#fff!important}
</style>
<link href="https://cdn.lylme.com/admin/lyear/css/style.min.css" rel="stylesheet">
</head>
<body>
<div class="markdown-section" id="main">
<?php
echo $site["icon"].'<span class="site_name">'. $site["name"].'</span>
<p><b>分类:'.$group['group_name'].'</b></p>
<p>浏览量:'.$pv.'</p>
';
echo "<p><a class='btn btn-pink' href='/'>返回</a> <a rel='nofollow' class='btn btn-success' href='". $site["url"]."'>访问</a></p>";
?>
<script src="/assets/js/svg.js"></script>
</div>
</body>
</html>

View File

@ -0,0 +1,4 @@
RewriteEngine On
#RewriteBase /
RewriteRule ^site-(\d+)\.html$ /site/index.php?id=$1
RewriteRule ^/sitemap.xml$ /site/sitemap.php

View File

@ -0,0 +1,2 @@
rewrite ^/site-(\d+)\.html$ /site/index.php?id=$1;
rewrite ^/sitemap.xml$ /site/sitemap.php;