]> git.wh0rd.org Git - tt-rss.git/commitdiff
sanity check: better suggestion for SELF_URL_PATH
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 28 Mar 2013 06:10:55 +0000 (10:10 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 28 Mar 2013 06:14:10 +0000 (10:14 +0400)
include/sanity_check.php

index b2cb8ab45620b50a01e8a704c3f6ea88558f50fc..1610cfeb043ad64ed034111ec59a59fc22b57b22 100644 (file)
@@ -2,6 +2,12 @@
        // WARNING: Don't ask for help on tt-rss.org forums or the bugtracker if you have
        // modified this file.
 
+       function make_self_url_path() {
+               $url_path = ($_SERVER['HTTPS'] != "on" ? 'http://' :  'https://') . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
+
+               return $url_path;
+       }
+
        function initial_sanity_check($link) {
 
                $errors = array();
                        }
 
                        if (SELF_URL_PATH == "http://yourserver/tt-rss/") {
-                               if ($_SERVER['HTTP_REFERER']) {
-                                       array_push($errors,
-                                               "Please set SELF_URL_PATH to the correct value for your server (possible value: <b>" . $_SERVER['HTTP_REFERER'] . "</b>)");
-                               } else {
-                                       array_push($errors, "Please set SELF_URL_PATH to the correct value for your server.");
-                               }
+                               $urlpath = preg_replace("/\w+\.php$/", "", make_self_url_path());
+
+                               array_push($errors,
+                                               "Please set SELF_URL_PATH to the correct value for your server (possible value: <b>$urlpath</b>)");
                        }
 
                        if (!is_writable(ICONS_DIR)) {