diff --git a/pandora_console/operation/events/events_rss.php b/pandora_console/operation/events/events_rss.php index e3fd4340f4..77116dcc05 100644 --- a/pandora_console/operation/events/events_rss.php +++ b/pandora_console/operation/events/events_rss.php @@ -28,6 +28,9 @@ $ipOrigin = $_SERVER['REMOTE_ADDR']; // Uncoment this to activate ACL on RSS Events if (!isInACL($ipOrigin)) { + rss_error_handler(null, null, null, null, + __("Your IP is not into the IP list with API access.")); + exit; } @@ -39,25 +42,52 @@ $pss = get_user_info($user); $hashup2 = md5($user.$pss['password']); if ($hashup != $hashup2) { + rss_error_handler(null, null, null, null, + __("The URL of your feed has bad hash.")); + exit; } header("Content-Type: application/xml; charset=UTF-8"); //Send header before starting to output -function rss_error_handler ($errno, $errstr, $errfile, $errline) { +function rss_error_handler ($errno, $errstr, $errfile, $errline, $error_human_description = null) { $url = ui_get_full_url(false); $selfurl = ui_get_full_url('?' . $_SERVER['QUERY_STRING'], false, true); $rss_feed = ''; //' Fixes certain highlighters freaking out on the PHP closing tag + $rss_feed .= "\n"; $rss_feed .= ''; - $rss_feed .= 'Pandora RSS FeedLatest events on Pandora'; + $rss_feed .= "\n"; + $rss_feed .= ''; + $rss_feed .= "\n"; + $rss_feed .= 'Pandora RSS Feed'; + $rss_feed .= "\n"; + $rss_feed .= 'Latest events on Pandora'; + $rss_feed .= "\n"; $rss_feed .= ''.date (DATE_RFC822, 0).''; - $rss_feed .= ''.$url.''; //Link back to the main Pandora page - $rss_feed .= ''; //Alternative for Atom feeds. It's the same. - - $rss_feed .= ''.$url.'/index.php?sec=eventos&sec2=operation/events/eventsError creating feed'; - $rss_feed .= 'There was an error creating the feed: '.$errno.' - '.$errstr.' in '.$errfile.' on line '.$errline.''; - $rss_feed .= ''.$url.'/index.php?sec=eventos&sec2=operation/events/events'; + $rss_feed .= "\n"; + $rss_feed .= '' . $url . ''; //Link back to the main Pandora page + $rss_feed .= "\n"; + $rss_feed .= ''; //Alternative for Atom feeds. It's the same. + $rss_feed .= "\n"; + $rss_feed .= ''; + $rss_feed .= "\n"; + $rss_feed .= ''.$url.'/index.php?sec=eventos&sec2=operation/events/events'; + $rss_feed .= "\n"; + $rss_feed .= 'Error creating feed'; + $rss_feed .= "\n"; + if (empty($error_human_description)) { + $rss_feed .= 'There was an error creating the feed: '.$errno.' - '.$errstr.' in '.$errfile.' on line '.$errline.''; + } + else { + $rss_feed .= '' . io_safe_input($error_human_description) .''; + } + $rss_feed .= "\n"; + $rss_feed .= ''.$url.'/index.php?sec=eventos&sec2=operation/events/events'; + $rss_feed .= "\n"; + $rss_feed .= ''; + $rss_feed .= "\n"; + $rss_feed .= ''; exit ($rss_feed); //Exit by displaying the feed }