if (!preg_match("/^http[s]?:\\/\\/([^\\/]+)(.*)\$/", $feed, $matches)) { // If not, it is an internal feed $aRSSArray = KTrss::getInternalFeed($user); } else { // If it is a url, it is an external feed // However, sometimes internal documents get added as external feeds // Check that the url isn't an internal one. global $default; $rootUrl = $default->rootUrl; $bSSL = $default->sslEnabled; $sProtocol = $bSSL ? 'https' : 'http'; $sBaseUrl = $sProtocol . '://' . $_SERVER['HTTP_HOST'] . $rootUrl; $sInternal = $sBaseUrl . '/rss.php'; if (!(strpos($feed, $sInternal) === FALSE)) { // Feed is internal $aRSSArray = KTrss::getExternalInternalFeed($feed, $user); } else { $aRSSArray = rss2array($feed); } } if (is_array($aRSSArray[errors])) { foreach ($aRSSArray[errors] as $errorItem) { $response .= $errorItem . '<br>'; echo '<br>' . $response . '<br>'; return; } } // Prepare response data to be passed back to page $response = "<h3>" . $aRSSArray[channel][title] . "</h3>" . "<div class='outerContainer' id='outerContainer'>" . "<table width='90%'>"; for ($i = 0; $i < count($aRSSArray[items]); $i++) { $response .= "<tr>\n\t\t\t\t<td colspan='2'><strong><a href='" . $aRSSArray[items][$i][link] . "' target='_blank'>" . $aRSSArray[items][$i][title] . "</a><strong></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . $aRSSArray[items][$i][description] . "</td>\n\t\t\t</tr>\n\t\t\t<tr><td colspan='2'><br></td></tr>";