]> git.wh0rd.org Git - tt-rss.git/commitdiff
optional SINGLE_USER_MODE
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 18 Nov 2005 06:29:36 +0000 (07:29 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 18 Nov 2005 06:29:36 +0000 (07:29 +0100)
backend.php
config.php-dist
prefs.php
tt-rss.php

index ed8ab6c1889ef213fcd88cc386e973eb6a28159f..edef18a03bdb07f5a37e14509f6059004fc17b9f 100644 (file)
 
                } else {
 
-                       print "<form action=\"backend.php\" method=\"POST\">";
-
-                       print "<table width=\"100%\" class=\"prefPrefsList\">";
-                       print "<tr><td colspan='3'><h3>Authentication</h3></tr></td>";
-
-                       print "<tr><td width=\"40%\">Old password</td>";
-                       print "<td><input class=\"editbox\" type=\"password\"
-                               name=\"OLD_PASSWORD\"></td></tr>";
-
-                       print "<tr><td width=\"40%\">New password</td>";
-                       
-                       print "<td><input class=\"editbox\" type=\"password\"
-                               name=\"NEW_PASSWORD\"></td></tr>";
+                       if (!SINGLE_USER_MODE) {
 
-                       print "</table>";
-
-                       print "<input type=\"hidden\" name=\"op\" value=\"pref-prefs\">";
-
-                       print "<p><input class=\"button\" type=\"submit\" 
-                               value=\"Change password\" name=\"subop\">";
+                               print "<form action=\"backend.php\" method=\"POST\">";
+       
+                               print "<table width=\"100%\" class=\"prefPrefsList\">";
+                               print "<tr><td colspan='3'><h3>Authentication</h3></tr></td>";
+       
+                               print "<tr><td width=\"40%\">Old password</td>";
+                               print "<td><input class=\"editbox\" type=\"password\"
+                                       name=\"OLD_PASSWORD\"></td></tr>";
+       
+                               print "<tr><td width=\"40%\">New password</td>";
+                               
+                               print "<td><input class=\"editbox\" type=\"password\"
+                                       name=\"NEW_PASSWORD\"></td></tr>";
+       
+                               print "</table>";
+       
+                               print "<input type=\"hidden\" name=\"op\" value=\"pref-prefs\">";
+       
+                               print "<p><input class=\"button\" type=\"submit\" 
+                                       value=\"Change password\" name=\"subop\">";
+       
+                               print "</form>";
 
-                       print "</form>";
+                       }
 
                        $result = db_query($link, "SELECT 
                                ttrss_user_prefs.pref_name,short_desc,help_text,value,type_name,
index 8e34e7b2c9c3fba9094edfafd77540f7b53feb96..9cea364dd1c4e7ac46704557ecd4525eed657fc1 100644 (file)
@@ -16,5 +16,9 @@
 
        define(USE_HTTP_AUTH, false);
        // use HTTP Basic authentication
-?>
 
+       define(SINGLE_USER_MODE, true);
+       // disable all multi-user stuff altogether and just assume admin user
+       // is always logged in
+
+?>
index 837cf584f051cc8909757924807268f49d4aac2b..f6b862f0760d020bff1f944d24e43566b1c42d6a 100644 (file)
--- a/prefs.php
+++ b/prefs.php
@@ -8,15 +8,22 @@
 
        $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
 
-       if (!USE_HTTP_AUTH) {
-               if (!$_SESSION["uid"]) {
-                       header("Location: login.php");
-                       exit;
+       if (!SINGLE_USER_MODE) {
+
+               if (!USE_HTTP_AUTH) {
+                       if (!$_SESSION["uid"]) {
+                               header("Location: login.php");
+                               exit;
+                       }
+               } else {
+                       authenticate_user($link);
                }
        } else {
-               authenticate_user($link);
+               $_SESSION["uid"] = 1;
+               $_SESSION["name"] = "admin";
        }
 
+
        initialize_user_prefs($link, $_SESSION["uid"]); 
        // FIXME this needs to be moved somewhere after user creation
 
@@ -61,7 +68,9 @@
                                <div id="notify"><span id="notify_body"></div>
                        </td>
                </tr><tr><td class="welcomePrompt">
+                       <? if (!SINGLE_USER_MODE) { ?>
                        Hello, <b><?= $_SESSION["name"] ?></b> (<a href="logout.php">Logout</a>)</td>
+                       <? } ?>
                </tr></table>
        </td>
 </tr>
index 9348944f61eb0ad105ff4f79f0f853f71a0c224a..6dd4195fae1559a0c6405f40fd621bbbd92d3fd5 100644 (file)
@@ -8,13 +8,19 @@
 
        $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
 
-       if (!USE_HTTP_AUTH) {
-               if (!$_SESSION["uid"]) {
-                       header("Location: login.php");
-                       exit;
+       if (!SINGLE_USER_MODE) {
+
+               if (!USE_HTTP_AUTH) {
+                       if (!$_SESSION["uid"]) {
+                               header("Location: login.php");
+                               exit;
+                       }
+               } else {
+                       authenticate_user($link);
                }
        } else {
-               authenticate_user($link);
+               $_SESSION["uid"] = 1;
+               $_SESSION["name"] = "admin";
        }
 
        initialize_user_prefs($link, $_SESSION["uid"]); 
@@ -70,7 +76,9 @@
                                <div id="notify"><span id="notify_body"></div>
                        </td>
                </tr><tr><td class="welcomePrompt">
+                       <? if (!SINGLE_USER_MODE) { ?>
                        Hello, <b><?= $_SESSION["name"] ?></b> (<a href="logout.php">Logout</a>)</td>
+                       <? } ?>
                </tr></table>
        </td>
 </tr>