]> git.wh0rd.org - tt-rss.git/blobdiff - include/functions.php
Merge branch 'reg_exp_length' of lllusion3418/tt-rss into master
[tt-rss.git] / include / functions.php
index efa4ec8e7d5bc8d4cee7443a266bf638f5ddb3d5..b5e2eb77665a41d4e23cb5e45c40630973eb0972 100755 (executable)
@@ -1,6 +1,6 @@
 <?php
        define('EXPECTED_CONFIG_VERSION', 26);
-       define('SCHEMA_VERSION', 133);
+       define('SCHEMA_VERSION', 134);
 
        define('LABEL_BASE_INDEX', -1024);
        define('PLUGIN_FEED_BASE_INDEX', -128);
@@ -11,6 +11,7 @@
        $fetch_last_error_code = false;
        $fetch_last_content_type = false;
        $fetch_last_error_content = false; // curl only for the time being
+       $fetch_effective_url = false;
        $fetch_curl_used = false;
        $suppress_debugging = false;
 
                global $fetch_last_error_content;
                global $fetch_last_content_type;
                global $fetch_last_modified;
+               global $fetch_effective_url;
                global $fetch_curl_used;
 
                $fetch_last_error = false;
                $fetch_last_content_type = "";
                $fetch_curl_used = false;
                $fetch_last_modified = "";
+               $fetch_effective_url = "";
 
                if (!is_array($options)) {
 
                        $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                        $fetch_last_content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
 
+                       $fetch_effective_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
+
                        $fetch_last_error_code = $http_code;
 
                        if ($http_code != 200 || $type && strpos($fetch_last_content_type, "$type") === false) {
 
                         $context_options = array(
                                  'http' => array(
+                                               'header' => array(
+                                                       'Connection: close'
+                                               ),
                                                'method' => 'GET',
                                                'ignore_errors' => true,
                                                'timeout' => $timeout ? $timeout : FILE_FETCH_TIMEOUT,
                                  );
 
                        if (!$post_query && $last_modified) {
-                               $context_options['http']['header'] = "If-Modified-Since: $last_modified\r\n";
+                               array_push($context_options['http']['header'], "If-Modified-Since: $last_modified");
                        }
 
                        if (defined('_HTTP_PROXY')) {
 
                        $old_error = error_get_last();
 
+                       $fetch_effective_url = $url;
+
                        $data = @file_get_contents($url, false, $context);
 
                        if (isset($http_response_header) && is_array($http_response_header)) {
                                                        // e.g. if we were being redirected -- last one is the right one
                                                } else if ($key == 'last-modified') {
                                                        $fetch_last_modified = $value;
+                                               } else if ($key == 'location') {
+                                                       $fetch_effective_url = $value;
                                                }
                                        }
 
                        }
                }
 
-               $allowed_elements = array('a', 'address', 'acronym', 'audio', 'article', 'aside',
+               $allowed_elements = array('a', 'abbr', 'address', 'acronym', 'audio', 'article', 'aside',
                        'b', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br',
                        'caption', 'cite', 'center', 'code', 'col', 'colgroup',
                        'data', 'dd', 'del', 'details', 'description', 'dfn', 'div', 'dl', 'font',