function subscribe_to_feed($link, $url, $cat_id = 0,
$auth_login = '', $auth_pass = '') {
+ $url = fix_url($url);
$parts = parse_url($url);
if (!validate_feed_url($url)) return 2;
return $url;
}
+ /**
+ * Fixes incomplete URLs by prepending "http://".
+ *
+ * @param string $url Possibly incomplete URL
+ *
+ * @return string Fixed URL.
+ */
+ function fix_url($url) {
+ if (strpos($url, '://') === false) {
+ $url = 'http://' . $url;
+ }
+ return $url;
+ }
+
function validate_feed_url($url) {
$parts = parse_url($url);