]> git.wh0rd.org Git - tt-rss.git/commitdiff
installer: ask for SELF_URL_PATH
authorAndrew Dolgov <fox@fakecake.org>
Wed, 27 Mar 2013 14:49:04 +0000 (18:49 +0400)
committerAndrew Dolgov <fox@fakecake.org>
Wed, 27 Mar 2013 14:49:04 +0000 (18:49 +0400)
install/index.php

index b0696ca6d155cdbd161b5f4ff8027b8e8ad419bb..1b5def331e808109bd59d0174d0cee948b4d984c 100644 (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;
+       }
+
 ?>
 
 <div class="floatingLogo"><img src="../images/logo_small.png"></div>
 <div class='content'>
 
 <?php
+
        if (file_exists("../config.php")) {
                require "../config.php";
 
        @$DB_NAME = strip_tags($_POST['DB_NAME']);
        @$DB_PASS = strip_tags($_POST['DB_PASS']);
        @$DB_PORT = strip_tags($_POST['DB_PORT']);
+       @$SELF_URL_PATH = strip_tags($_POST['SELF_URL_PATH']);
 
+       if (!$SELF_URL_PATH) {
+               $SELF_URL_PATH = preg_replace("/\/install\/$/", "/", make_self_url_path());
+       }
 ?>
 
-<h2>Database settings</h2>
-
 <form action="" method="post">
 <input type="hidden" name="op" value="testconfig">
 
+<h2>Database settings</h2>
+
 <?php
        $issel_pgsql = $DB_TYPE == "pgsql" ? "selected" : "";
        $issel_mysql = $DB_TYPE == "mysql" ? "selected" : "";
        <input name="DB_PORT" placeholder="if needed, PgSQL only" size="20" value="<?php echo $DB_PORT ?>"/>
 </fieldset>
 
+<h2>Other settings</h2>
+
+<p>This should be set to the location your Tiny Tiny RSS will be available on.</p>
+
+<fieldset>
+       <label>Tiny Tiny RSS URL</label>
+       <input  name="SELF_URL_PATH" placeholder="<?php echo $SELF_URL_PATH; ?>" size="60" value="<?php echo $SELF_URL_PATH ?>"/>
+</fieldset>
+
+
 <p><input type="submit" value="Test configuration"></p>
 
 </form>
                                <input type="hidden" name="DB_HOST" value="<?php echo $DB_HOST ?>"/>
                                <input type="hidden" name="DB_PORT" value="<?php echo $DB_PORT ?>"/>
                                <input type="hidden" name="DB_TYPE" value="<?php echo $DB_TYPE ?>"/>
+                               <input type="hidden" name="SELF_URL_PATH" value="<?php echo $SELF_URL_PATH ?>"/>
 
                                <?php if ($need_confirm) { ?>
                                        <p><input onclick="return confirm('Please read the warning above. Continue?')" type="submit" value="Initialize database" style="color : red"></p>
                                <input type="hidden" name="DB_HOST" value="<?php echo $DB_HOST ?>"/>
                                <input type="hidden" name="DB_PORT" value="<?php echo $DB_PORT ?>"/>
                                <input type="hidden" name="DB_TYPE" value="<?php echo $DB_TYPE ?>"/>
+                               <input type="hidden" name="SELF_URL_PATH" value="<?php echo $SELF_URL_PATH ?>"/>
 
                                <input type="hidden" name="op" value="skipschema">
                                <p><input type="submit" value="Skip initialization"></p>
                                        echo "\tdefine('DB_PASS', '$DB_PASS');\n";
                                } else if (preg_match("/define\('DB_PORT'/", $line)) {
                                        echo "\tdefine('DB_PORT', '$DB_PORT');\n";
-
+                               } else if (preg_match("/define\('SELF_URL_PATH'/", $line)) {
+                                       echo "\tdefine('SELF_URL_PATH', '$SELF_URL_PATH');\n";
                                } else {
                                        print "$line\n";
                                }