更新 v1.8.0版本

This commit is contained in:
LyLme 2023-12-17 23:43:43 +08:00
parent 1bc5d7ab13
commit b423b2a5e6
4 changed files with 352 additions and 322 deletions

View File

@ -1,173 +1,194 @@
<?php <?php
function strexists($string, $find) {
return !(strpos($string, $find) === FALSE); function strexists($string, $find)
{
return !(strpos($string, $find) === false);
} }
function dstrpos($string, $arr) { function dstrpos($string, $arr)
if(empty($string)) return false; {
foreach((array)$arr as $v) { if(empty($string)) {
if(strpos($string, $v) !== false) { return false;
return true; }
} foreach((array)$arr as $v) {
} if(strpos($string, $v) !== false) {
return false; return true;
}
}
return false;
} }
//判断移动端 //判断移动端
function checkmobile() { function checkmobile()
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']); {
$ualist = array('android', 'midp', 'nokia', 'mobile', 'iphone', 'ipod', 'blackberry', 'windows phone'); $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
if((dstrpos($useragent, $ualist) || strexists($_SERVER['HTTP_ACCEPT'], "VND.WAP") || strexists(isset($_SERVER['HTTP_VIA']),"wap"))) { $ualist = array('android', 'midp', 'nokia', 'mobile', 'iphone', 'ipod', 'blackberry', 'windows phone');
return true; if((dstrpos($useragent, $ualist) || strexists($_SERVER['HTTP_ACCEPT'], "VND.WAP") || strexists(isset($_SERVER['HTTP_VIA']), "wap"))) {
} else { return true;
return false; } else {
} return false;
}
} }
//判断蜘蛛 //判断蜘蛛
function is_spider() { function is_spider()
$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']); {
$spiders = array( $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
'Googlebot', $spiders = array(
'Baiduspider', 'Googlebot',
'Yahoo! Slurp', 'Baiduspider',
'YodaoBot', 'Yahoo! Slurp',
'msnbot', 'YodaoBot',
'360Spider', 'msnbot',
'spider', '360Spider',
'Spider' 'spider',
//这里可以加入更多的蜘蛛标示 'Spider'
); //这里可以加入更多的蜘蛛标示
foreach ($spiders as $spider) { );
$spider = strtolower($spider); foreach ($spiders as $spider) {
if (strpos($userAgent, $spider) !== false) { $spider = strtolower($spider);
return true; if (strpos($userAgent, $spider) !== false) {
} return true;
} }
return false; }
return false;
} }
function daddslashes($string) { function daddslashes($string)
if(is_array($string)) { {
foreach($string as $key => $val) { if(is_array($string)) {
$string[$key] = daddslashes($val); foreach($string as $key => $val) {
} $string[$key] = daddslashes($val);
} else { }
$string = addslashes($string); } else {
} $string = addslashes($string);
return $string; }
return $string;
} }
function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) { function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0)
$ckey_length = 4; {
$key = md5($key ? $key : ENCRYPT_KEY); $ckey_length = 4;
$keya = md5(substr($key, 0, 16)); $key = md5($key ? $key : ENCRYPT_KEY);
$keyb = md5(substr($key, 16, 16)); $keya = md5(substr($key, 0, 16));
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length) : substr(md5(microtime()) , -$ckey_length)) : ''; $keyb = md5(substr($key, 16, 16));
$cryptkey = $keya . md5($keya . $keyc); $keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length) : substr(md5(microtime()), -$ckey_length)) : '';
$key_length = strlen($cryptkey); $cryptkey = $keya . md5($keya . $keyc);
$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $keyb) , 0, 16) . $string; $key_length = strlen($cryptkey);
$string_length = strlen($string); $string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $keyb), 0, 16) . $string;
$result = ''; $string_length = strlen($string);
$box = range(0, 255); $result = '';
$rndkey = array(); $box = range(0, 255);
for ($i = 0; $i <= 255; $i++) { $rndkey = array();
$rndkey[$i] = ord($cryptkey[$i % $key_length]); for ($i = 0; $i <= 255; $i++) {
} $rndkey[$i] = ord($cryptkey[$i % $key_length]);
for ($j = $i = 0; $i < 256; $i++) { }
$j = ($j + $box[$i] + $rndkey[$i]) % 256; for ($j = $i = 0; $i < 256; $i++) {
$tmp = $box[$i]; $j = ($j + $box[$i] + $rndkey[$i]) % 256;
$box[$i] = $box[$j]; $tmp = $box[$i];
$box[$j] = $tmp; $box[$i] = $box[$j];
} $box[$j] = $tmp;
for ($a = $j = $i = 0; $i < $string_length; $i++) { }
$a = ($a + 1) % 256; for ($a = $j = $i = 0; $i < $string_length; $i++) {
$j = ($j + $box[$a]) % 256; $a = ($a + 1) % 256;
$tmp = $box[$a]; $j = ($j + $box[$a]) % 256;
$box[$a] = $box[$j]; $tmp = $box[$a];
$box[$j] = $tmp; $box[$a] = $box[$j];
$result.= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256])); $box[$j] = $tmp;
} $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
if ($operation == 'DECODE') { }
if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb) , 0, 16)) { if ($operation == 'DECODE') {
return substr($result, 26); if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16)) {
} else { return substr($result, 26);
return ''; } else {
} return '';
} else { }
return $keyc . str_replace('=', '', base64_encode($result)); } else {
} return $keyc . str_replace('=', '', base64_encode($result));
}
} }
//CDN //CDN
function cdnpublic($cdnpublic) { function cdnpublic($cdnpublic)
if(empty($cdnpublic)) { {
return '.'; if(empty($cdnpublic)) {
} else { return '.';
return $cdnpublic.$conf['version']; } else {
} return $cdnpublic . $conf['version'];
}
} }
//获取协议和域名 //获取协议和域名
function siteurl() { function siteurl()
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; {
$domainName = $_SERVER['HTTP_HOST']; $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
return $protocol . $domainName; $domainName = $_SERVER['HTTP_HOST'];
return $protocol . $domainName;
} }
$background = $conf["background"]; $background = $conf["background"];
//网站背景 //网站背景
function background() { function background()
return $GLOBALS['background_img']; {
return $GLOBALS['background_img'];
} }
function update() { function update()
@$update = json_decode(get_curl(base64_decode("aHR0cHM6Ly9jZG4ubHlsbWUuY29tL2FwaS91cGRhdGU=").'?ver='.VERSION.'&domain='.$_SERVER['HTTP_HOST']),true); {
return $update; @$update = json_decode(get_curl(base64_decode("aHR0cHM6Ly9jZG4ubHlsbWUuY29tL2FwaS91cGRhdGU=") . '?ver=' . VERSION . '&domain=' . $_SERVER['HTTP_HOST']), true);
return $update;
} }
function getver($ver) { function getver($ver)
$vn = explode('.', str_replace('v', '', $ver)); {
return $vn[0] . sprintf("%02d", $vn[1]) . sprintf("%02d", $vn[2]); $vn = explode('.', str_replace('v', '', $ver));
return $vn[0] . sprintf("%02d", $vn[1]) . sprintf("%02d", $vn[2]);
} }
//更新设置 //更新设置
function saveSetting($k, $v) { function saveSetting($k, $v)
global $DB; {
$v = daddslashes($v); global $DB;
return $DB->query("UPDATE `lylme_config` SET `v` = '$v' WHERE `lylme_config`.`k` = '$k';"); $v = daddslashes($v);
return $DB->query("UPDATE `lylme_config` SET `v` = '$v' WHERE `lylme_config`.`k` = '$k';");
} }
//获取相对路径 //获取相对路径
function get_urlpath($srcurl,$baseurl) { function get_urlpath($srcurl, $baseurl)
if(substr($srcurl,0,2)=="//"){ {
return parse_url($baseurl)['scheme'].':'.$srcurl; if(substr($srcurl, 0, 2) == "//") {
return parse_url($baseurl)['scheme'] . ':' . $srcurl;
} }
if(empty($srcurl))return ''; if(empty($srcurl)) {
$srcinfo = parse_url($srcurl); return '';
if(isset($srcinfo['scheme'])) { }
return $srcurl; $srcinfo = parse_url($srcurl);
} if(isset($srcinfo['scheme'])) {
$baseinfo = parse_url($baseurl); return $srcurl;
$url = $baseinfo['scheme'].'://'.$baseinfo['host']; }
if(substr($srcinfo['path'], 0, 1) == '/') { $baseinfo = parse_url($baseurl);
$path = $srcinfo['path']; $url = $baseinfo['scheme'] . '://' . $baseinfo['host'];
} else { if(substr($srcinfo['path'], 0, 1) == '/') {
$path = dirname($baseinfo['path']).'/'.$srcinfo['path']; $path = $srcinfo['path'];
} } else {
$rst = array(); $path = dirname($baseinfo['path']) . '/' . $srcinfo['path'];
$path_array = explode('/', $path); }
if(!$path_array[0]) { $rst = array();
$rst[] = ''; $path_array = explode('/', $path);
} if(!$path_array[0]) {
foreach ($path_array AS $key => $dir) { $rst[] = '';
if ($dir == '..') { }
if (end($rst) == '..') { foreach ($path_array as $key => $dir) {
$rst[] = '..'; if ($dir == '..') {
} elseif(!array_pop($rst)) { if (end($rst) == '..') {
$rst[] = '..'; $rst[] = '..';
} } elseif(!array_pop($rst)) {
} elseif($dir && $dir != '.') { $rst[] = '..';
$rst[] = $dir; }
} } elseif($dir && $dir != '.') {
} $rst[] = $dir;
if(!end($path_array)) { }
$rst[] = ''; }
} if(!end($path_array)) {
$url .= implode('/', $rst); $rst[] = '';
if( !empty($srcinfo['query']) ) $url .= '?'.$srcinfo['query']; }
return str_replace('\\', '/', $url); $url .= implode('/', $rst);
if(!empty($srcinfo['query'])) {
$url .= '?' . $srcinfo['query'];
}
return str_replace('\\', '/', $url);
} }
//获取客户端IP //获取客户端IP
function get_real_ip() { function get_real_ip()
{
$real_ip = ''; $real_ip = '';
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); $arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
@ -186,179 +207,187 @@ function get_real_ip() {
} else { } else {
return ""; return "";
} }
// return $real_ip; // return $real_ip;
} }
function yan() { function yan()
$filename = ROOT.'/assets/data/data.dat'; {
//随机一言文件路径 $filename = ROOT . '/assets/data/data.dat';
if (file_exists($filename)) { //随机一言文件路径
$data = explode(PHP_EOL, file_get_contents($filename)); if (file_exists($filename)) {
$result = str_replace(array( $data = explode(PHP_EOL, file_get_contents($filename));
"\r", $result = str_replace(array(
"\n", "\r",
"\r\n" "\n",
) , '', $data[array_rand($data) ]); "\r\n"
return $result; ), '', $data[array_rand($data) ]);
} return $result;
}
} }
function rearr($data,$arr) { function rearr($data, $arr)
$arr = str_replace('{group_id}', $data['group_id'],$arr); {
$arr = str_replace('{group_name}', $data['group_name'],$arr); $arr = str_replace('{group_id}', $data['group_id'], $arr);
$arr = str_replace('{group_icon}', $data['group_icon'],$arr); $arr = str_replace('{group_name}', $data['group_name'], $arr);
$arr = str_replace('{link_id}', $data['id'],$arr); $arr = str_replace('{group_icon}', $data['group_icon'], $arr);
$arr = str_replace('{link_name}', $data['name'],$arr); $arr = str_replace('{link_id}', $data['id'], $arr);
$arr = str_replace('{link_url}', $data['url'],$arr); $arr = str_replace('{link_name}', $data['name'], $arr);
if (empty($data["icon"])) { $arr = str_replace('{link_url}', $data['url'], $arr);
$icon = '<img src="/assets/img/default-icon.png" alt="' . strip_tags($data["name"]) . '" />'; if (empty($data["icon"])) {
} else if (!preg_match("/^<svg*/", $data["icon"])) { $icon = '<img src="/assets/img/default-icon.png" alt="' . strip_tags($data["name"]) . '" />';
$icon = '<img src="' . $data["icon"] . '" alt="' . strip_tags($data["name"]) . '" />'; } elseif (!preg_match("/^<svg*/", $data["icon"])) {
} else { $icon = '<img src="' . $data["icon"] . '" alt="' . strip_tags($data["name"]) . '" />';
$icon = $data["icon"]; } else {
} $icon = $data["icon"];
$arr = str_replace('{link_icon}', $icon,$arr); }
return $arr; $arr = str_replace('{link_icon}', $icon, $arr);
return $arr;
} }
//获取head //获取head
function get_head($url) { function get_head($url)
header("Content-type:text/html;charset=utf-8"); {
$data = get_curl($url); header("Content-type:text/html;charset=utf-8");
//获取网站title $data = get_curl($url);
preg_match('/<title.*?>(?<title>.*?)<\/title>/sim', $data, $title); //获取网站title
$encode = mb_detect_encoding($title['title'], array('GB2312','GBK','UTF-8', 'CP936')); preg_match('/<title.*?>(?<title>.*?)<\/title>/sim', $data, $title);
//得到字符串编码 $encode = mb_detect_encoding($title['title'], array('GB2312','GBK','UTF-8', 'CP936'));
$file_charset = iconv_get_encoding()['internal_encoding']; //得到字符串编码
//当前文件编码 $file_charset = iconv_get_encoding()['internal_encoding'];
if ( $encode != 'CP936' && $encode != $file_charset) { //当前文件编码
$title = iconv($encode, $file_charset, $title['title']); if ($encode != 'CP936' && $encode != $file_charset) {
$data = iconv($encode, $file_charset, $data); $title = iconv($encode, $file_charset, $title['title']);
} else { $data = iconv($encode, $file_charset, $data);
$title = $title['title']; } else {
} $title = $title['title'];
// 获取网站icon
preg_match('/<link rel=".*?icon" * href="(.*?)".*?>/is', $data,$icon);
preg_match('/<meta +name *=["\']?description["\']? *content=["\']?([^<>"]+)["\']?/i', $data, $description);
preg_match('/<meta +name *=["\']?keywords["\']? *content=["\']?([^<>"]+)["\']?/i', $data, $keywords);
$icon = $icon[1];
if(!empty($icon)){
$icon = get_urlpath($icon,$url);
}else{
$parse = parse_url($url);
$port = $parse['port']==80||$parse['port']=="" ? '': ":".$parse['port'];
$iconurl = $parse['scheme'].'://'.$parse['host'].$port.'/favicon.ico';
if(get_curl($iconurl)!=404) {
$icon = $iconurl;
}
} }
$get_heads=array("title" =>$title,"charset"=> $encode,"icon" => $icon,"description"=>$description[1],"keywords"=>$keywords[1],"url"=>$url); // 获取网站icon
return $get_heads; preg_match('/<link rel=".*?icon" * href="(.*?)".*?>/is', $data, $icon);
preg_match('/<meta +name *=["\']?description["\']? *content=["\']?([^<>"]+)["\']?/i', $data, $description);
preg_match('/<meta +name *=["\']?keywords["\']? *content=["\']?([^<>"]+)["\']?/i', $data, $keywords);
$icon = $icon[1];
if(!empty($icon)) {
$icon = get_urlpath($icon, $url);
} else {
$parse = parse_url($url);
$port = $parse['port'] == 80 || $parse['port'] == "" ? '' : ":" . $parse['port'];
$iconurl = $parse['scheme'] . '://' . $parse['host'] . $port . '/favicon.ico';
if(get_curl($iconurl) != 404) {
$icon = $iconurl;
}
}
$get_heads = array("title" => $title,"charset" => $encode,"icon" => $icon,"description" => $description[1],"keywords" => $keywords[1],"url" => $url);
return $get_heads;
} }
//模拟GET请求 //模拟GET请求
function get_curl($url) { function get_curl($url)
$curl = curl_init(); {
curl_setopt_array($curl, array( $curl = curl_init();
CURLOPT_URL => $url, curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => $url,
CURLOPT_ENCODING => '', CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 10, CURLOPT_ENCODING => '',
CURLOPT_TIMEOUT => 0, CURLOPT_MAXREDIRS => 10,
CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 0,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_HTTPHEADER => array( CURLOPT_CUSTOMREQUEST => 'GET',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36 Edg/101.0.1210.39 Lylme/11.24' CURLOPT_HTTPHEADER => array(
), 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36 Edg/101.0.1210.39 Lylme/11.24'
)); ),
$contents = curl_exec($curl); ));
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); $contents = curl_exec($curl);
curl_close($curl); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if($httpCode==404) { curl_close($curl);
return $httpCode; if($httpCode == 404) {
} return $httpCode;
return $contents; }
return $contents;
} }
//长度判断 //长度判断
function strlens($str) { function strlens($str)
if(strlen($str) > 255) { {
return true; if(strlen($str) > 255) {
} else { return true;
return false; } else {
} return false;
}
} }
//apply($name, $url, $icon, $group_id); //apply($name, $url, $icon, $group_id);
function apply($name, $url, $icon, $group_id, $status) { function apply($name, $url, $icon, $group_id, $status)
$name=strip_tags(daddslashes($name)); {
$url=strip_tags(daddslashes($url)); $name = strip_tags(daddslashes($name));
$icon=strip_tags(daddslashes($icon)); $url = strip_tags(daddslashes($url));
$group_id=strip_tags(daddslashes($group_id)); $icon = strip_tags(daddslashes($icon));
$userip = get_real_ip(); $group_id = strip_tags(daddslashes($group_id));
$date = date("Y-m-d H:i:s"); $userip = get_real_ip();
if(empty($name) || empty($url) || empty($group_id)) { $date = date("Y-m-d H:i:s");
//|| empty($icon) if(empty($name) || empty($url) || empty($group_id)) {
return('{"code": "-1", "msg": "必填项不能为空"}'); //|| empty($icon)
} else if(!preg_match('/^http*/i', $url)) { return('{"code": "-1", "msg": "必填项不能为空"}');
return('{"code": "-2", "msg": "链接不符合要求"}'); } elseif(!preg_match('/^http*/i', $url)) {
} else if(strlens($name)||strlens($url)||strlens($icon)||strlens($group_id)||strlens($userip)) { return('{"code": "-2", "msg": "链接不符合要求"}');
return('{"code": "500", "msg": "非法参数"}'); } elseif(strlens($name) || strlens($url) || strlens($icon) || strlens($group_id) || strlens($userip)) {
} else { return('{"code": "500", "msg": "非法参数"}');
global $DB; } else {
if($DB->num_rows($DB->query("SELECT * FROM `lylme_apply` WHERE `apply_url` LIKE '".$url."';"))>0) { global $DB;
return('{"code": "-3", "msg": "链接已存在,请勿重复提交"}'); if($DB->num_rows($DB->query("SELECT * FROM `lylme_apply` WHERE `apply_url` LIKE '" . $url . "';")) > 0) {
} return('{"code": "-3", "msg": "链接已存在,请勿重复提交"}');
$sql = "INSERT INTO `lylme_apply` (`apply_id`, `apply_name`, `apply_url`, `apply_group`, `apply_icon`, `apply_mail`, `apply_time`, `apply_status`) VALUES (NULL, '".$name."', '".$url."', '".$group_id."', '".$icon."', '".$userip."', '".$date."', '".$status."');"; }
if($DB->query($sql)) { $sql = "INSERT INTO `lylme_apply` (`apply_id`, `apply_name`, `apply_url`, `apply_group`, `apply_icon`, `apply_desc`, `apply_time`, `apply_status`) VALUES (NULL, '" . $name . "', '" . $url . "', '" . $group_id . "', '" . $icon . "', '" . $userip . "', '" . $date . "', '" . $status . "');";
switch ($status) { if($DB->query($sql)) {
case 0: switch ($status) {
return('{"code": "200", "msg": "请等待管理员审核"}'); case 0:
break; return('{"code": "200", "msg": "请等待管理员审核"}');
case 1: break;
if(ins_link($name, $url, $icon, $group_id, $status,$userip)) { case 1:
return('{"code": "200", "msg": "网站已收录"}'); if(ins_link($name, $url, $icon, $group_id, $status, $userip)) {
} else { return('{"code": "200", "msg": "网站已收录"}');
return('{"code": "-5", "msg": "请联系网站管理员"}'); } else {
} return('{"code": "-5", "msg": "请联系网站管理员"}');
break; }
} break;
} else { }
return('{"code": "-4", "msg": "未知错误,请联系网站管理员"}'); } else {
} return('{"code": "-4", "msg": "未知错误,请联系网站管理员"}');
} }
}
} }
function ins_link($name, $url, $icon, $group_id, $status) { function ins_link($name, $url, $icon, $group_id, $status)
global $DB; {
$name=strip_tags(daddslashes($name)); global $DB;
$url=strip_tags(daddslashes($url)); $name = strip_tags(daddslashes($name));
$icon=strip_tags(daddslashes($icon)); $url = strip_tags(daddslashes($url));
$group_id=strip_tags(daddslashes($group_id)); $icon = strip_tags(daddslashes($icon));
$userip = get_real_ip(); $group_id = strip_tags(daddslashes($group_id));
$date = date("Y-m-d H:i:s"); $userip = get_real_ip();
$link_order = $DB->count('select MAX(id) from `lylme_links`')+1; $date = date("Y-m-d H:i:s");
$sql1 = "INSERT INTO `lylme_links` (`id`, `name`, `group_id`, `url`, `icon`, `PS`,`link_order`) VALUES (NULL, '" . $name . "', '" . $group_id . "', '" . $url . "', '" . $icon . "', '" . $userip . "的提交 ', '" . $link_order . "');"; $link_order = $DB->count('select MAX(id) from `lylme_links`') + 1;
if($DB->query($sql1)) { $sql1 = "INSERT INTO `lylme_links` (`id`, `name`, `group_id`, `url`, `icon`, `PS`,`link_order`) VALUES (NULL, '" . $name . "', '" . $group_id . "', '" . $url . "', '" . $icon . "', '" . $userip . "的提交 ', '" . $link_order . "');";
return true; if($DB->query($sql1)) {
} else { return true;
return false; } else {
} return false;
}
} }
function theme_file($file) { function theme_file($file)
global $conf; {
$theme = ROOT.'template/'.$conf['template'].'/'.$file; global $conf;
if(file_exists($theme)) { $theme = ROOT . 'template/' . $conf['template'] . '/' . $file;
return $theme; if(file_exists($theme)) {
} else { return $theme;
return 'template/'.$file; } else {
} return 'template/' . $file;
}
} }
function wxPlus($data){ function wxPlus($data)
{
//申请收录后推送到微信公众号 //申请收录后推送到微信公众号
$curl = curl_init(); $curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://wx.lylme.com/api/apply/"); curl_setopt($curl, CURLOPT_URL, "https://wx.lylme.com/api/apply/");
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($curl); $output = curl_exec($curl);
curl_close($curl); curl_close($curl);
return $output; return $output;
} }
?>

View File

@ -18,7 +18,7 @@ INSERT INTO `lylme_groups` (`group_id`, `group_name`, `group_icon`, `group_order
(6, '游戏娱乐', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-game00\"></use></svg>', 6, 1, 0), (6, '游戏娱乐', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-game00\"></use></svg>', 6, 1, 0),
(7, '网站公告', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-gg00\"></use></svg>', 7, 1, 0); (7, '网站公告', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-gg00\"></use></svg>', 7, 1, 0);
INSERT INTO `lylme_links` (`id`, `name`, `group_id`, `url`, `icon`, `PS`, `link_order`, `link_status`, `link_pwd`) VALUES INSERT INTO `lylme_links` (`id`, `name`, `group_id`, `url`, `icon`, `link_desc`, `link_order`, `link_status`, `link_pwd`) VALUES
(1, '百度', 1, 'https://www.baidu.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-icon_baidulogo\"></use></svg>', NULL, 10, 1, 0), (1, '百度', 1, 'https://www.baidu.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-icon_baidulogo\"></use></svg>', NULL, 10, 1, 0),
(2, '腾讯视频', 1, 'https://v.qq.com', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-tengxunshipin\"></use></svg>', NULL, 10, 1, 0), (2, '腾讯视频', 1, 'https://v.qq.com', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-tengxunshipin\"></use></svg>', NULL, 10, 1, 0),
(3, '优酷', 1, 'https://www.youku.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-youku\"></use></svg>', NULL, 10, 1, 0), (3, '优酷', 1, 'https://www.youku.com/', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-youku\"></use></svg>', NULL, 10, 1, 0),
@ -110,15 +110,15 @@ INSERT INTO `lylme_sou` (`sou_id`, `sou_alias`, `sou_name`, `sou_hint`, `sou_col
(7, 'google', '谷歌搜索', '值得信任的搜索引擎', '#3B83FA', 'https://www.google.com/search?q=', '', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-google00\"></use></svg>', 1, 7), (7, 'google', '谷歌搜索', '值得信任的搜索引擎', '#3B83FA', 'https://www.google.com/search?q=', '', '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-google00\"></use></svg>', 1, 7),
(8, 'fanyi', '在线翻译', '输入翻译内容(自动检测语言)', '#0084fe', 'https://fanyi.baidu.com/#auto/zh/', NULL, '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-fanyi\"></use></svg>', 1, 8); (8, 'fanyi', '在线翻译', '输入翻译内容(自动检测语言)', '#0084fe', 'https://fanyi.baidu.com/#auto/zh/', NULL, '<svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#icon-fanyi\"></use></svg>', 1, 8);
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),
(5, '申请收录', '/apply', 1),
(6, '查看', '/pwd', 0);
COMMIT;
INSERT INTO `lylme_tags` (`tag_id`, `tag_name`, `tag_link`, `tag_target`, `sort`) 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);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

View File

@ -16,7 +16,7 @@ CREATE TABLE `lylme_apply` (
`apply_url` varchar(255) NOT NULL, `apply_url` varchar(255) NOT NULL,
`apply_group` int(2) NOT NULL, `apply_group` int(2) NOT NULL,
`apply_icon` text NOT NULL, `apply_icon` text NOT NULL,
`apply_mail` varchar(30) NOT NULL, `apply_desc` varchar(30) NOT NULL,
`apply_time` datetime NOT NULL, `apply_time` datetime NOT NULL,
`apply_status` int(11) NOT NULL `apply_status` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='收录申请'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='收录申请';
@ -78,7 +78,7 @@ CREATE TABLE `lylme_links` (
`group_id` int(2) NOT NULL DEFAULT '1' COMMENT '分组名称', `group_id` int(2) NOT NULL DEFAULT '1' COMMENT '分组名称',
`url` varchar(255) NOT NULL COMMENT '链接地址', `url` varchar(255) NOT NULL COMMENT '链接地址',
`icon` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '链接图标', `icon` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '链接图标',
`PS` varchar(255) DEFAULT NULL COMMENT '备注', `link_desc` varchar(255) DEFAULT NULL COMMENT '链接描述',
`link_order` int(4) DEFAULT '10' COMMENT '链接排序', `link_order` int(4) DEFAULT '10' COMMENT '链接排序',
`link_status` int(1) NOT NULL DEFAULT '1' COMMENT '链接状态', `link_status` int(1) NOT NULL DEFAULT '1' COMMENT '链接状态',
`link_pwd` int(2) DEFAULT '0' COMMENT '加密组ID' `link_pwd` int(2) DEFAULT '0' COMMENT '加密组ID'
@ -111,7 +111,8 @@ CREATE TABLE `lylme_tags` (
`tag_id` int(11) NOT NULL, `tag_id` int(11) NOT NULL,
`tag_name` varchar(30) NOT NULL, `tag_name` varchar(30) NOT NULL,
`tag_link` varchar(60) NOT NULL, `tag_link` varchar(60) NOT NULL,
`tag_target` int(1) NOT NULL DEFAULT '1' `tag_target` int(1) NOT NULL DEFAULT '1',
`sort` int(11) NOT NULL DEFAULT '10' COMMENT '权重'
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,4 +1,4 @@
-- v1.8.0 -- v1.8.0
ALTER TABLE `lylme_apply` CHANGE `apply_mail` `apply_desc` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '链接描述'; ALTER TABLE `lylme_apply` CHANGE `apply_mail` `apply_desc` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '链接描述';
ALTER TABLE `lylme_links` CHANGE `PS` `link_desc` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '链接描述'; ALTER TABLE `lylme_links` CHANGE `PS` `link_desc` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '链接描述';
ALTER TABLE `lylme_tags` ADD `sort` INT NOT NULL DEFAULT '60' COMMENT '权重' AFTER `tag_target`; ALTER TABLE `lylme_tags` ADD `sort` INT NOT NULL DEFAULT '10' COMMENT '权重' AFTER `tag_target`;