diff options
author | Andrew Dolgov <[email protected]> | 2005-11-18 07:29:36 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2005-11-18 07:29:36 +0100 |
commit | 7d4c898ab3adbfbb0ad2c6887afc391273762828 (patch) | |
tree | ceee8f3919ea21a66a7be2abad674212fec9b5cd | |
parent | c8437f35c62f0ad12eee5d4b2ac075c44d7ed2c7 (diff) |
optional SINGLE_USER_MODE
-rw-r--r-- | backend.php | 44 | ||||
-rw-r--r-- | config.php-dist | 6 | ||||
-rw-r--r-- | prefs.php | 19 | ||||
-rw-r--r-- | tt-rss.php | 18 |
4 files changed, 56 insertions, 31 deletions
diff --git a/backend.php b/backend.php index ed8ab6c18..edef18a03 100644 --- a/backend.php +++ b/backend.php @@ -1621,28 +1621,32 @@ } 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, diff --git a/config.php-dist b/config.php-dist index 8e34e7b2c..9cea364dd 100644 --- a/config.php-dist +++ b/config.php-dist @@ -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 + +?> @@ -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> diff --git a/tt-rss.php b/tt-rss.php index 9348944f6..6dd4195fa 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -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> |