Merge branch 'stable'

This commit is contained in:
following
2013-05-14 13:59:17 +02:00
2 changed files with 8 additions and 16 deletions
+6 -14
View File
@@ -18,24 +18,19 @@ class RSSParser {
return '';
// error
$error = false;
$rss = array();
// check $url
if(!preg_match('!^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\:\,\?\'\\\+&%\$#\=~_\-]+))*$!',$url)) {
$error = true;
} else {
if (preg_match('!^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\:\,\?\'\\\+&%\$#\=~_\-]+))*$!',$url))
{
$tpl->assign('includetext',$includetext);
// get xml-data
$data = @file_get_contents($url);
// check data
if($data === false || strpos($data, 'rss version=') === false) {
$error = true;
} else {
if ($data !== false && strpos($data, 'rss version=') !== false)
{
// parse XML
try {
@@ -81,15 +76,12 @@ class RSSParser {
}
}
}
catch(Exception $e) {
$error = true;
catch(Exception $e)
{
}
}
}
// assign to template
$tpl->assign('rsserror',$error);
// return
return $rss;
}
+2 -2
View File
@@ -50,7 +50,7 @@
</table>
{else}
<div id="blog">
{if !$rsserror}
{if $news|@count}
{include file="res_rssparser.tpl" rss=$news}
{else}
<p><em>{t}currently not available{/t}</em></p>
@@ -104,7 +104,7 @@
</div>
*}
<div id="forum">
{if !$rsserror}
{if $forum|@count}
{include file="res_rssparser.tpl" rss=$forum}
{else}
<p><em>{t}currently not available{/t}</em></p>