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();