forked from LyLme/lylme_spage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
333 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
$title = '微信推送'; | ||
include './head.php'; | ||
$set=isset($_GET['set'])?$_GET['set']:null; | ||
if($set=='save') { | ||
$userkey=$_POST['userkey']; | ||
$wxplustime=$_POST['wxplustime']; | ||
saveSetting('wxplus',$userkey); | ||
saveSetting('wxplustime',$wxplustime); | ||
if(empty($userkey)) { | ||
echo '<script>alert("微信推送已关闭");window.location.href="./wxplus.php";</script>'; | ||
} else { | ||
echo '<script>alert("微信推送密钥配置成功");window.location.href="./wxplus.php";</script>'; | ||
} | ||
} else { | ||
?> | ||
<!--页面主要内容--> | ||
<main class="lyear-layout-content"> | ||
<div class="container-fluid"> | ||
<div class="row"> | ||
<div class="col-lg-12"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<form method="post" action="wxplus.php?set=save" class="site-form"> | ||
<div class="form-group"> | ||
<label class="control-label">微信推送密钥</label> | ||
<textarea type="text" class="form-control" name="userkey" id="userkey" ><?php echo $conf['wxplus']; | ||
?></textarea> | ||
</div> | ||
<div class="form-group"> | ||
<label class="control-label">微信推送时间</label> | ||
<input class="form-control" type="time" id="wxplustime" name="wxplustime" placeholder="请选择推送提醒时间" value="<?php echo $conf['wxplustime'];?>" /> | ||
</div> | ||
<p class="m-t-15"> | ||
1. 功能说明:开启微信推送,用户提交申请收录会推送提醒到<code>上云六零</code>公众号<br> | ||
2. 开启功能:填写用户的微信推送密钥<br> | ||
3. 关闭功能:编辑框留空保存即可关闭该功能<br> | ||
4. 获取密钥:微信关注公众号<code>上云六零</code>回复<code>推送密钥</code>复制到编辑框中保存即可<br> | ||
5. 温馨提示:为了避免打扰,每天最多推送一次。当日<?php echo $conf['wxplustime'];?>前的提交会在<?php echo $conf['wxplustime'];?>前推送,之后提交的在次日<?php echo $conf['wxplustime'];?>前推送</p> | ||
<button type="submit" class="btn btn-primary">保存</button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</main> | ||
<?php | ||
} | ||
include './footer.php'; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
//抓取网页(旧版) | ||
function geturl(){ | ||
var url = $("input[name=\'url\']").val(); | ||
if(!url){ | ||
layer.msg('链接地址不能为空'); | ||
return false; | ||
} | ||
$('#loading').css("display","flex"); | ||
if (!/^http[s]?:\/\/+/.test(url)&&url!="") { | ||
var url = "http://"+url; | ||
$("input[name=\'url\']").val(url); | ||
} | ||
|
||
$.ajax({ | ||
url:"index.php", | ||
type:"GET", | ||
dataType:"json", | ||
data:{url:url}, | ||
success:function(data){ | ||
var head = eval(data); | ||
$("input[name=\'name\']").val(head.title); | ||
if(!head.title && !head.icon){ | ||
layer.msg('获取失败,请手动填写'); | ||
} | ||
else if(!head.icon){ | ||
layer.msg('未获取到网站图标'); | ||
} | ||
$("textarea[name=\'icon\']").val(head.icon); | ||
$('#loading').css("display","none"); | ||
return true; | ||
}, | ||
error:function(data){ | ||
layer.msg('获取失败,目标网站无法访问或防火墙限制!'); | ||
$('#loading').css("display","none"); | ||
return false; | ||
} | ||
}); | ||
} | ||
//补全URL | ||
function gurl(){ | ||
var url = $("input[name=\'url\']").val(); | ||
if (!/^http[s]?:\/\/+/.test(url)&&url!="") { | ||
var url = "http://"+url; | ||
$("input[name=\'url\']").val(url); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
//生成二维码 | ||
function recode(){ | ||
$('#captcha_img').attr('src','../include/validatecode.php?r='+Math.random()); | ||
$("input[name=\'authcode\']").val(''); | ||
} | ||
//微信相关推送 | ||
function wxPlus(){ | ||
var url = $("input[name=\'url\']").val(); | ||
var name = $("input[name=\'name\']").val(); | ||
if(!url || !name){ | ||
return false; | ||
} | ||
$.ajax({ | ||
url:"./wxplus.php?wx=plus", | ||
type:"POST", | ||
data:{ | ||
wx_name: name, | ||
wx_url: url | ||
},success:function(data){ | ||
console.log(data.data); | ||
} | ||
}); | ||
} | ||
|
||
//提交 | ||
function submit(){ | ||
var url = $("input[name=\'url\']"); | ||
var name = $("input[name=\'name\']"); | ||
var group_id = $("select[name=\'group_id\']"); | ||
var icon = $("input[name=\'icon\']") ? $("input[name=\'icon\']") : $("textarea[name=\'icon\']"); | ||
var authcode = $("input[name=\'authcode\']"); | ||
if(!url.val() || !name.val() || !group_id.val() || !authcode.val()){ | ||
layer.msg('必填项不能为空'); | ||
return false; | ||
} | ||
$.ajax({ | ||
url:"index.php?submit=post", | ||
type:"POST", | ||
dataType:"json", | ||
data:{ | ||
url: url.val(), | ||
name: name.val(), | ||
group_id: group_id.val(), | ||
icon: icon.val(), | ||
authcode: authcode.val() | ||
}, | ||
success:function(data){ | ||
if(data.code == '200'){ | ||
wxPlus(name,url); | ||
swal({ | ||
title: "成功", | ||
text: data.msg, | ||
icon: "success", | ||
allowOutsideClick:false, | ||
button : "确定" | ||
}).then(function () { | ||
recode(); | ||
window.location.replace("./"); | ||
return true; | ||
}); | ||
} | ||
else{ | ||
swal({ | ||
title: "失败", | ||
text: data.msg, | ||
icon: "error", | ||
allowOutsideClick:false, | ||
button : "确定" | ||
}).then(function () { | ||
recode(); | ||
return false; | ||
}); | ||
} | ||
|
||
|
||
}, | ||
error:function(data){ | ||
layer.msg('服务器错误'); | ||
return false; | ||
} | ||
}); | ||
} | ||
|
||
|
||
//抓取网页(新版) | ||
function get_url(){ | ||
var url = $("input[name=\'url\']").val(); | ||
if(!url){ | ||
layer.msg('链接地址不能为空'); | ||
return false; | ||
} | ||
$('#loading').css("display","flex"); | ||
if (!/^http[s]?:\/\/+/.test(url)&&url!="") { | ||
var url = "http://"+url; | ||
$("input[name=\'url\']").val(url); | ||
} | ||
|
||
$.ajax({ | ||
url:"index.php", | ||
type:"GET", | ||
dataType:"json", | ||
data:{url:url}, | ||
success:function(data){ | ||
$("input[name=\'name\']").val(data.title); | ||
if(!data.title && !data.icon){ | ||
layer.msg('获取失败,请手动填写'); | ||
} | ||
else if(!data.icon){ | ||
layer.msg('未获取到网站图标'); | ||
} | ||
layer.msg('正则抓取目标网站图标...'); | ||
downloadimg(data.icon,url); | ||
$('#loading').css("display","none"); | ||
return true; | ||
}, | ||
error:function(data){ | ||
layer.msg('获取失败,目标网站无法访问或防火墙限制!'); | ||
$('#loading').css("display","none"); | ||
return false; | ||
} | ||
}); | ||
} | ||
//抓取图标 | ||
function downloadimg(url,referer){ | ||
$.ajax({ | ||
url:"/include/file.php", | ||
type:"POST", | ||
dataType:"json", | ||
data:{url:url,referer:referer}, | ||
success:function(data){ | ||
if(data.code == '200'){ | ||
layer.msg(data.msg); | ||
$("input[name=\'icon\']").val(data.url); | ||
$("#review").attr("src",data.url); | ||
$("#review").show(); | ||
return true; | ||
} | ||
else{ | ||
layer.msg(data.msg); | ||
return false; | ||
} | ||
}, | ||
error:function(data){ | ||
layer.msg('服务器错误'); | ||
return false; | ||
} | ||
}); | ||
} | ||
//生成图标 | ||
function uploadimg(e) { | ||
var formData = new FormData(); | ||
formData.append("file", $("#file")[0].files[0]); | ||
$.ajax({ | ||
method: 'POST', | ||
url: '/include/file.php', | ||
data: formData, | ||
timeout: 20000, | ||
cache: false, | ||
processData: false, | ||
contentType: false, | ||
dataType:"JSON", | ||
success:function(data){ | ||
if(data.code == '200'){ | ||
layer.msg(data.msg); | ||
$("input[name=\'icon\']").val(data.url); | ||
$("#review").attr("src",data.url); | ||
$("#review").show(); | ||
return true; | ||
} | ||
else{ | ||
layer.msg(data.msg); | ||
return false; | ||
} | ||
}, | ||
error:function(data){ | ||
layer.msg('服务器错误'); | ||
return false; | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
include("../include/common.php"); | ||
if($_GET['wx']=="plus"){ | ||
$wx_key = $conf["wxplus"]; | ||
$plus_time = $conf["plus_time"]?$conf["plus_time"]:"22:00"; | ||
$web_title = explode("-", $conf['title'])[0]; | ||
//$web_title = "六零导航页"; | ||
if(empty($wx_key)){exit("微信推送未开启");} | ||
$wx_name = $_POST['wx_name']; | ||
$url = parse_url($_POST['wx_url'])['host']; | ||
$wx_url = $url?$url:$_POST['wx_url']; | ||
$data = ' | ||
{"wx_name":"'.$wx_name.'","wx_url":"'.$wx_url.'","web_name":"'.$web_title.'","plus_time":"'.$plus_time.'","wx_key":"'.$wx_key.'"}'; | ||
exit(wxPlus($data)); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<?php | ||
define('VERSION', '1.5.1'); | ||
define('VERSION', '1.6.0'); | ||
?> |
Oops, something went wrong.