Upgrade remoteRSS plugin
This commit is contained in:
parent
dcdf147af1
commit
8eea0968e0
@ -256,7 +256,9 @@ function serendipity_fetchImageFromDatabase($id, $mode = 'read') {
|
||||
$cond['distinct'] = '';
|
||||
}
|
||||
|
||||
if ($mode != 'discard') {
|
||||
serendipity_ACL_SQL($cond, false, 'directory', $mode);
|
||||
}
|
||||
|
||||
$rs = serendipity_db_query("SELECT {$cond['distinct']} i.id, i.name, i.extension, i.mime, i.size, i.dimensions_width, i.dimensions_height, i.date, i.thumbnail_name, i.authorid, i.path, i.hotlink, i.realname
|
||||
FROM {$serendipity['dbPrefix']}images AS i
|
||||
|
@ -19,3 +19,10 @@
|
||||
@define('PLUGIN_REMOTERSS_BULLETIMG_BLAHBLAH', 'Image to display before each headline.');
|
||||
@define('PLUGIN_REMOTERSS_DISPLAYDATE', 'Display Date');
|
||||
@define('PLUGIN_REMOTERSS_DISPLAYDATE_BLAHBLAH', 'Display the date below the headline?');
|
||||
|
||||
@define('PLUGIN_REMOTERSS_RSSLINK', 'RSS-Link verwenden?');
|
||||
@define('PLUGIN_REMOTERSS_RSSLINK_DESC', 'Soll ein Hyperlink auf den im RSS-Feed angegebenen Link gesetzt werden?');
|
||||
@define('PLUGIN_REMOTERSS_RSSFIELD', 'RSS Zielelement');
|
||||
@define('PLUGIN_REMOTERSS_RSSFIELD_DESC', 'Welches Element des RSS-Feeds soll dargestellt werden? (z.B.: "title", "content:encoded", "description", ...)');
|
||||
@define('PLUGIN_REMOTERSS_RSSESCAPE', 'HTML-Ausgabe escapen?');
|
||||
@define('PLUGIN_REMOTERSS_RSSESCAPE_DESC', 'Wenn aktiviert, wird HTML in RSS-Feeds maskiert und "sicher" ausgegeben. Wenn diese Option deaktiviert ist, wird HTML in einem Feed interpretiert - dies stellt eine potentielle Gefahr dar, wenn der eingebundene Feed nicht ihrer ist!');
|
||||
|
@ -19,3 +19,10 @@
|
||||
@define('PLUGIN_REMOTERSS_BULLETIMG_BLAHBLAH', 'Image to display before each headline.');
|
||||
@define('PLUGIN_REMOTERSS_DISPLAYDATE', 'Display Date');
|
||||
@define('PLUGIN_REMOTERSS_DISPLAYDATE_BLAHBLAH', 'Display the date below the headline?');
|
||||
|
||||
@define('PLUGIN_REMOTERSS_RSSLINK', 'RSS-Link verwenden?');
|
||||
@define('PLUGIN_REMOTERSS_RSSLINK_DESC', 'Soll ein Hyperlink auf den im RSS-Feed angegebenen Link gesetzt werden?');
|
||||
@define('PLUGIN_REMOTERSS_RSSFIELD', 'RSS Zielelement');
|
||||
@define('PLUGIN_REMOTERSS_RSSFIELD_DESC', 'Welches Element des RSS-Feeds soll dargestellt werden? (z.B.: "title", "content:encoded", "description", ...)');
|
||||
@define('PLUGIN_REMOTERSS_RSSESCAPE', 'HTML-Ausgabe escapen?');
|
||||
@define('PLUGIN_REMOTERSS_RSSESCAPE_DESC', 'Wenn aktiviert, wird HTML in RSS-Feeds maskiert und "sicher" ausgegeben. Wenn diese Option deaktiviert ist, wird HTML in einem Feed interpretiert - dies stellt eine potentielle Gefahr dar, wenn der eingebundene Feed nicht ihrer ist!');
|
||||
|
@ -26,4 +26,11 @@
|
||||
@define('PLUGIN_REMOTERSS_DISPLAYDATE', 'Display Date');
|
||||
@define('PLUGIN_REMOTERSS_DISPLAYDATE_BLAHBLAH', 'Display the date below the headline?');
|
||||
|
||||
@define('PLUGIN_REMOTERSS_RSSLINK', 'Use RSS-Link?');
|
||||
@define('PLUGIN_REMOTERSS_RSSLINK_DESC', 'Shall a link be set to the link specified in the RSS feed?');
|
||||
@define('PLUGIN_REMOTERSS_RSSFIELD', 'RSS display element');
|
||||
@define('PLUGIN_REMOTERSS_RSSFIELD_DESC', 'Whic element of the RSS feed should be displayed? (i.e.: "title", "content:encoded", "description", ...)');
|
||||
@define('PLUGIN_REMOTERSS_RSSESCAPE', 'Escape HTML output');
|
||||
@define('PLUGIN_REMOTERSS_RSSESCAPE_DESC', 'If enabled, HTML in RSS-feeds will be escaped and no XSS is possible. If this option is disabled, HTML in the feeds can be interpretated. This is a possible security issue, if the embedded feed is not yours!');
|
||||
|
||||
?>
|
||||
|
@ -257,18 +257,40 @@ class serendipity_plugin_remoterss extends serendipity_plugin {
|
||||
$propbag->add('description', PLUGIN_REMOTERSS_BLAHBLAH);
|
||||
$propbag->add('stackable', true);
|
||||
$propbag->add('author', 'Udo Gerhards, Richard Thomas Harrison');
|
||||
$propbag->add('version', '1.5');
|
||||
$propbag->add('version', '1.7');
|
||||
$propbag->add('requirements', array(
|
||||
'serendipity' => '0.8',
|
||||
'smarty' => '2.6.7',
|
||||
'php' => '4.1.0'
|
||||
));
|
||||
$propbag->add('configuration', array('number', 'displaydate', 'dateformat', 'sidebartitle', 'rssuri', 'charset', 'target', 'cachetime', 'feedtype', 'bulletimg', 'markup'));
|
||||
$propbag->add('configuration', array('number', 'use_rss_link', 'show_rss_element', 'escape_rss', 'displaydate', 'dateformat', 'sidebartitle', 'rssuri', 'charset', 'target', 'cachetime', 'feedtype', 'bulletimg', 'markup'));
|
||||
$propbag->add('groups', array('FRONTEND_EXTERNAL_SERVICES'));
|
||||
}
|
||||
|
||||
function introspect_config_item($name, &$propbag) {
|
||||
switch($name) {
|
||||
|
||||
case 'use_rss_link':
|
||||
$propbag->add('type', 'boolean');
|
||||
$propbag->add('name', PLUGIN_REMOTERSS_RSSLINK);
|
||||
$propbag->add('description', PLUGIN_REMOTERSS_RSSLINK_DESC);
|
||||
$propbag->add('default', 'false');
|
||||
break;
|
||||
|
||||
case 'escape_rss':
|
||||
$propbag->add('type', 'boolean');
|
||||
$propbag->add('name', PLUGIN_REMOTERSS_RSSESCAPE);
|
||||
$propbag->add('description', PLUGIN_REMOTERSS_RSSESCAPE_DESC);
|
||||
$propbag->add('default', 'true');
|
||||
break;
|
||||
|
||||
case 'show_rss_element':
|
||||
$propbag->add('type', 'string');
|
||||
$propbag->add('name', PLUGIN_REMOTERSS_RSSFIELD);
|
||||
$propbag->add('description', PLUGIN_REMOTERSS_RSSFIELD_DESC);
|
||||
$propbag->add('default', 'title');
|
||||
break;
|
||||
|
||||
case 'markup':
|
||||
$propbag->add('type', 'boolean');
|
||||
$propbag->add('name', DO_MARKUP);
|
||||
@ -448,17 +470,35 @@ class serendipity_plugin_remoterss extends serendipity_plugin {
|
||||
$c->parse($rssuri);
|
||||
$this->encoding = $c->rss['encoding'];
|
||||
|
||||
$use_rss_link = serendipity_db_bool($this->get_config('use_rss_link'));
|
||||
$rss_element = $this->get_config('show_rss_element');
|
||||
$escape_rss = serendipity_db_bool($this->get_config('escape_rss'));
|
||||
$i = 0;
|
||||
$content = '';
|
||||
while (($showAll || ($i < $number)) && ($item = $c->getNextItem())) {
|
||||
if (empty($item['title'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($use_rss_link) {
|
||||
$content .= '<a href="' . $this->decode($item['link']) . '" ' . (!empty($target) ? 'target="'.$target.'"' : '') . '>';
|
||||
}
|
||||
|
||||
if (!empty($bulletimg)) {
|
||||
$content .= '<img src="' . $bulletimg . '" border="0" alt="*" /> ';
|
||||
}
|
||||
$content .= $this->decode($item['title']) . "</a><br />\n";
|
||||
|
||||
if ($escape_rss) {
|
||||
$content .= $this->decode($item[$rss_element]);
|
||||
} else {
|
||||
$content .= htmlspecialchars($this->decode($item[$rss_element]));
|
||||
}
|
||||
|
||||
if ($use_rss_link) {
|
||||
$content .= '</a>';
|
||||
}
|
||||
|
||||
$content .= "<br />\n";
|
||||
$item['timestamp'] = @strtotime(isset($item['pubdate']) ? $item['pubdate'] : $item['dc:date']);
|
||||
if (!($item['timestamp'] == -1) AND ($displaydate == 'true')) {
|
||||
$content .= '<div class="serendipitySideBarDate">'
|
||||
|
@ -98,6 +98,7 @@ switch ($serendipity['GET']['step']) {
|
||||
$media['external'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
if (isset($created_thumbnail) && isset($image_id)) {
|
||||
$media['is_uploaded'] = true;
|
||||
$serendipity['GET']['image'] = $media['imgID'] = (int)$image_id; // $image_id is passed from images.inc.php
|
||||
break;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user