implement force-feed logic (#196)

This commit is contained in:
onli 2014-07-07 00:32:50 +02:00
parent 19bdfec0b9
commit 2439399c08
4 changed files with 30 additions and 23 deletions

View File

@ -4,6 +4,8 @@
Version 2.0-beta3 ()
------------------------------------------------------------------------
* Moved general syndication plugin option into the core
* Smarty 3.1.19 upgrade (see changelog)
* Fixed thumbnail recreation, Issue #134

View File

@ -603,6 +603,18 @@
'description' => SYNDICATION_PLUGIN_PUBDATE_DESC,
'type' => 'bool',
'default' => true,
'permission' => 'blogConfiguration'),
array ('var' => 'feedCustom',
'title' => FEED_CUSTOM,
'description' => FEED_CUSTOM_DESC,
'type' => 'string',
'default' => '',
'permission' => 'blogConfiguration'),
array ('var' => 'feedForceCustom',
'title' => FEED_FORCE,
'description' => FEED_FORCE_DESC,
'type' => 'bool',
'default' => false,
'permission' => 'blogConfiguration')
));

View File

@ -105,9 +105,9 @@ class serendipity_plugin_syndication extends serendipity_plugin {
break;
case 'custom_url':
$propbag->add('type', 'string');
$propbag->add('type', 'boolean');
$propbag->add('name', 'Custom URL'); // i18n
$propbag->add('description', 'If you want to link to a separate feed, enter its URL here. This will override all other settings.'); // i18n
$propbag->add('description', 'If you want to link to the custom feed specified in the blog configuration, enable this option.'); // i18n
$propbag->add('default', '');
break;
@ -129,7 +129,7 @@ class serendipity_plugin_syndication extends serendipity_plugin {
$custom_img = trim($this->get_config('big_img', 'templates/2k11/img/subtome.png'));
$subtome = serendipity_db_bool($this->get_config('subToMe', true));
$fbid = $this->get_config('fb_id');
$custom_url = $this->get_config('custom_url', '');
$custom_url = serendipity_db_bool($this->get_config('custom_url', false));
$feed_format = $this->get_config('feed_format', 'rss');
$useRss = true;
@ -165,8 +165,8 @@ class serendipity_plugin_syndication extends serendipity_plugin {
$COMMENTS = $custom_comm;
}
if ($custom_url != "") {
$mainFeed = $custom_url;
if ($custom_url) {
$mainFeed = serendipity_get_config_var('feedCustom');
} else {
$mainFeed = serendipity_rewriteURL(PATH_FEEDS .'/index.rss2', 'serendipityHTTPPath');
if ($fbid != "") {

29
rss.php
View File

@ -221,24 +221,17 @@ if ($metadata['fullFeed'] === 'client') {
}
}
// TODO: Recode option to force a specific feed instead of showing the main feed
//if ($_GET['type'] == 'content' &&
//!isset($_GET['category']) &&
//!isset($serendipity['GET']['tag']) &&
//$plugin->get_config('show_feedburner') === 'force' &&
//!preg_match('@FeedBurn@i', $_SERVER['HTTP_USER_AGENT']) &&
//!(serendipity_userLoggedIn() && isset($_GET['forceLocal']))
//) {
//$fbid = $plugin->get_config('fb_id');
//if (stristr($fbid, 'http://')) {
//$url = $fbid;
//} else {
//$url = 'http://feeds.feedburner.com/' . $fbid;
//}
//header('Status: 302 Found');
//header('Location: ' . $url);
//exit;
//}
if ($_GET['type'] == 'content' &&
!isset($_GET['category']) &&
!isset($serendipity['GET']['tag']) &&
serendipity_db_bool(serendipity_get_config_var('feedForceCustom', false)) &&
!preg_match('@FeedBurn@i', $_SERVER['HTTP_USER_AGENT']) && // the hardcoded pass for feedburner is for BC. New services should just use the forceLocal-param
!isset($_GET['forceLocal'])
) {
header('Status: 302 Found');
header('Location: ' . serendipity_get_config_var('feedCustom'));
exit;
}
$metadata['showMail'] = serendipity_db_bool(serendipity_get_config_var('show_mail', $metadata['showMail']));
$file_version = preg_replace('@[^0-9a-z\.-_]@i', '', $version);