From a89fc28bba311d35b48458dbe2442dbb737813fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9D=BE?= Date: Wed, 28 Nov 2012 16:57:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=8E=E5=8F=B0=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=88=A0=E9=99=A4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lastRSS.php | 2 +- lastRSS_class.php | 9 +++++---- lastRSS_setting.php | 33 ++++++++++++++++++++++++--------- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/lastRSS.php b/lastRSS.php index c65a0eb..afc095f 100644 --- a/lastRSS.php +++ b/lastRSS.php @@ -1,7 +1,7 @@ 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); diff --git a/lastRSS_setting.php b/lastRSS_setting.php index 5b9fd37..5bf710a 100644 --- a/lastRSS_setting.php +++ b/lastRSS_setting.php @@ -48,9 +48,9 @@ function plugin_setting_view(){ fetch_array($feeds)) { ?> -
  • - 删除 - 《》 URL: +
  • + 删除 + 《》 URL:
  • '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();