修复后台无法删除的bug
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Rss订阅
|
||||
Version: 1.3.3
|
||||
Version: 1.3.4
|
||||
Plugin URL: http://xiaosong.org/tech/the-official-releas-of-rss-subscribe-plugin
|
||||
Description: 订阅朋友的博客feed,显示在自己博客~
|
||||
Author: 小松
|
||||
|
||||
@@ -133,20 +133,21 @@ class lastRSS {
|
||||
$results = '';
|
||||
$context = stream_context_create(array(
|
||||
'http' => array(
|
||||
'timeout' => 3
|
||||
'timeout' => 1
|
||||
)
|
||||
));
|
||||
if (get_cfg_var('allow_url_fopen')) {
|
||||
$f = fopen($url, 'r');
|
||||
while (!feof($f)) {
|
||||
if ($f = fopen($url, 'r', false, $context)) {
|
||||
while (!feof($f)) {
|
||||
$results .= fgets($f, 4096);
|
||||
}
|
||||
fclose($f);
|
||||
}
|
||||
} else if (extension_loaded('curl')) {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'PHP Curl/xiaosong.org 1.0 BETA');
|
||||
$results = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
@@ -48,9 +48,9 @@ function plugin_setting_view(){
|
||||
<?php
|
||||
while ($item = $DB->fetch_array($feeds)) {
|
||||
?>
|
||||
<li class="entry">
|
||||
<span class="right" id="data-id" data="<?php echo $item['id']; ?>"><a href="?plugin=lastRSS&do=del&id=<?php echo $item['id']; ?>" onclick="javascript:if (!confirm('确认删除这个 RSS 数据源?')) { return false }">删除</a></span>
|
||||
《<span id="data-title" data="<?php echo $item['title']; ?>"><?php echo $item['title']; ?></span>》 URL:<span style="color:#666; font-size: 12px;" id="data-url" data="<?php echo $item['url']; ?>"><?php echo $item['url']; ?></span>
|
||||
<li class="entry" data-id="<?php echo $item['id']; ?>" data-url="<?php echo $item['url']; ?>" data-title="<?php echo $item['title']; ?>">
|
||||
<span class="right"><a href="javascript:;" class="del">删除</a></span>
|
||||
《<span ><?php echo $item['title']; ?></span>》 URL:<span style="color:#666; font-size: 12px;"><?php echo $item['url']; ?></span>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
@@ -63,12 +63,13 @@ function plugin_setting_view(){
|
||||
?>
|
||||
<?php
|
||||
function plugin_setting(){
|
||||
$do = isset($_GET['do']) ? addslashes($_GET['do']) : '';
|
||||
$do = isset($_GET['do']) ? $_GET['do'] : '';
|
||||
if ($do == 'del') {
|
||||
$id = intval($_GET['id']);
|
||||
$id = intval($_POST['id']);
|
||||
if ($id != 0) {
|
||||
deleteFeed($id);
|
||||
header("Location:plugin.php?plugin=lastRSS&setting=true");
|
||||
$msg = array('success' => 'true');
|
||||
exit(json_encode($msg));
|
||||
}
|
||||
} elseif ($do == 'update') {
|
||||
$id = intval($_POST['id']);
|
||||
@@ -127,9 +128,9 @@ function plugin_setting(){
|
||||
$body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $("html") : $("body")) : $("html,body");
|
||||
$("#lastRSS").addClass('sidebarsubmenu1');
|
||||
$(".entry").dblclick(function(){
|
||||
var feedUrl = $(this).children("#data-url").attr("data"),
|
||||
feedId = $(this).children("#data-id").attr("data"),
|
||||
feedTitle = $(this).children("#data-title").attr("data");
|
||||
var feedUrl = $(this).data("url"),
|
||||
feedId = $(this).data("id"),
|
||||
feedTitle = $(this).data("title");
|
||||
$("#modify_url").val(feedUrl);
|
||||
$("#modify_title").val(feedTitle);
|
||||
$("#modify_id").val(feedId);
|
||||
@@ -140,6 +141,20 @@ function plugin_setting(){
|
||||
$("#modify_url").focus();
|
||||
});
|
||||
});
|
||||
$('.del').click(function(){
|
||||
if (confirm('确认删除这个 RSS 数据源?')) {
|
||||
var _parent = $(this).parents('.entry');
|
||||
var _id = _parent.data('id');
|
||||
$.post('./plugin.php?plugin=lastRSS&action=setting&do=del', {id: _id}, function(e, s){
|
||||
if (s === 'success') {
|
||||
_parent.remove();
|
||||
} else {
|
||||
alert('删除出错!请前往http://xiaosong.org/留言');
|
||||
}
|
||||
})
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$("#cancel_update").click(function(){
|
||||
$("#lastRSS_form_modify").slideUp(200,function(){
|
||||
$("#modify_url").blur();
|
||||
|
||||
Reference in New Issue
Block a user