aboutsummaryrefslogtreecommitdiff
path: root/p
diff options
context:
space:
mode:
authorGravatar Seokseong Jeon <sjeon87+github@gmail.com> 2017-05-05 01:43:34 +0900
committerGravatar GitHub <noreply@github.com> 2017-05-05 01:43:34 +0900
commitcb897980cd930ec73762118ca8e38ec0050ff5e3 (patch)
tree37ae732b80e856987739a6409c06cf6da66c95d0 /p
parent09787cfd7a68e994f248c0cad0ebe5ae68b7aaf3 (diff)
parent53f00571e554f6eeea4fea19d9ddc5eca2ce2997 (diff)
Merge branch 'dev' into cli-act-num-articles
Diffstat (limited to 'p')
-rw-r--r--p/api/pshb.php39
-rw-r--r--p/f.php3
-rw-r--r--p/scripts/main.js14
-rw-r--r--p/themes/base-theme/template.css2
4 files changed, 43 insertions, 15 deletions
diff --git a/p/api/pshb.php b/p/api/pshb.php
index e9b66b167..378f43516 100644
--- a/p/api/pshb.php
+++ b/p/api/pshb.php
@@ -23,8 +23,13 @@ if (!ctype_xdigit($key)) {
chdir(PSHB_PATH);
$canonical64 = @file_get_contents('keys/' . $key . '.txt');
if ($canonical64 === false) {
+ if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'unsubscribe') {
+ logMe('Warning: Accept unknown unsubscribe');
+ header('Connection: close');
+ exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : '');
+ }
header('HTTP/1.1 404 Not Found');
- logMe('Error: Feed key not found!: ' . $key);
+ logMe('Warning: Feed key not found!: ' . $key);
die('Feed key not found!');
}
$canonical64 = trim($canonical64);
@@ -36,7 +41,7 @@ if (!preg_match('/^[A-Za-z0-9_-]+$/D', $canonical64)) {
$hubFile = @file_get_contents('feeds/' . $canonical64 . '/!hub.json');
if ($hubFile === false) {
header('HTTP/1.1 404 Not Found');
- //@unlink('keys/' . $key . '.txt');
+ unlink('keys/' . $key . '.txt');
logMe('Error: Feed info not found!: ' . $canonical64);
die('Feed info not found!');
}
@@ -50,8 +55,19 @@ chdir('feeds/' . $canonical64);
$users = glob('*.txt', GLOB_NOSORT);
if (empty($users)) {
header('HTTP/1.1 410 Gone');
- logMe('Error: Nobody is subscribed to this feed anymore!: ' . $canonical64);
- die('Nobody is subscribed to this feed anymore!');
+ $url = base64url_decode($canonical64);
+ logMe('Warning: Nobody subscribes to this feed anymore!: ' . $url);
+ unlink('../../keys/' . $key . '.txt');
+ Minz_Configuration::register('system',
+ DATA_PATH . '/config.php',
+ DATA_PATH . '/config.default.php');
+ FreshRSS_Context::$system_conf = Minz_Configuration::get('system');
+ $feed = new FreshRSS_Feed($url);
+ $feed->pubSubHubbubSubscribe(false);
+ unlink('!hub.json');
+ chdir('..');
+ recursive_unlink($canonical64);
+ die('Nobody subscribes to this feed anymore!');
}
if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') {
@@ -108,7 +124,9 @@ $nb = 0;
foreach ($users as $userFilename) {
$username = basename($userFilename, '.txt');
if (!file_exists(USERS_PATH . '/' . $username . '/config.php')) {
- break;
+ logMe('Warning: Removing broken user link: ' . $username . ' for ' . $self);
+ unlink($userFilename);
+ continue;
}
try {
@@ -119,11 +137,14 @@ foreach ($users as $userFilename) {
new Minz_ModelPdo($username); //TODO: FIXME: Quick-fix while waiting for a better FreshRSS() constructor/init
FreshRSS_Context::init();
list($updated_feeds, $feed) = FreshRSS_feed_Controller::actualizeFeed(0, $self, false, $simplePie);
- if ($updated_feeds > 0) {
+ if ($updated_feeds > 0 || $feed != false) {
$nb++;
+ } else {
+ logMe('Warning: User ' . $username . ' does not subscribe anymore to ' . $self);
+ unlink($userFilename);
}
} catch (Exception $e) {
- logMe('Error: ' . $e->getMessage());
+ logMe('Error: ' . $e->getMessage() . ' for user ' . $username . ' and feed ' . $self);
}
}
@@ -132,8 +153,8 @@ unset($simplePie);
if ($nb === 0) {
header('HTTP/1.1 410 Gone');
- logMe('Error: Nobody is subscribed to this feed anymore after all!: ' . $self);
- die('Nobody is subscribed to this feed anymore after all!');
+ logMe('Warning: Nobody subscribes to this feed anymore after all!: ' . $self);
+ die('Nobody subscribes to this feed anymore after all!');
} elseif (!empty($hubJson['error'])) {
$hubJson['error'] = false;
file_put_contents('./!hub.json', json_encode($hubJson));
diff --git a/p/f.php b/p/f.php
index e4c82bb16..c47fa747a 100644
--- a/p/f.php
+++ b/p/f.php
@@ -1,6 +1,6 @@
<?php
-
require('../constants.php');
+require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
require(LIB_PATH . '/favicons.php');
require(LIB_PATH . '/http-conditional.php');
@@ -15,7 +15,6 @@ function show_default_favicon($cacheSeconds = 3600) {
}
}
-
$id = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '0';
if (!ctype_xdigit($id)) {
$id = '0';
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 5dbb95c91..9aca75b93 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -803,12 +803,12 @@ function updateFeed(feeds, feeds_count) {
if (!feed) {
return;
}
-
$.ajax({
type: 'POST',
url: feed.url,
data : {
_csrf: context.csrf,
+ noCommit: feeds.length > 0 ? 1 : 0,
},
}).always(function (data) {
feed_processed++;
@@ -830,7 +830,6 @@ function init_actualize() {
if (ajax_loading) {
return false;
}
-
ajax_loading = true;
$.getJSON('./?c=javascript&a=actualize').done(function (data) {
@@ -841,7 +840,16 @@ function init_actualize() {
}
if (data.feeds.length === 0) {
openNotification(data.feedback_no_refresh, "good");
- ajax_loading = false;
+ $.ajax({ //Empty request to force refresh server database cache
+ type: 'POST',
+ url: './?c=feed&a=actualize&id=-1',
+ data : {
+ _csrf: context.csrf,
+ noCommit: 0,
+ },
+ }).always(function (data) {
+ ajax_loading = false;
+ });
return;
}
//Progress bar
diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css
index cc36c3ffa..d7ae7be51 100644
--- a/p/themes/base-theme/template.css
+++ b/p/themes/base-theme/template.css
@@ -345,7 +345,7 @@ a.btn {
/*=== Tree */
.tree {
margin: 0;
- padding: 0;
+ padding: 0 0 15em 0;
list-style: none;
text-align: left;
}