From 461766f33ef735eca51d0bf63fa1557c59aa5451 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 1 Oct 2006 05:05:12 +0100 Subject: add debug mode only fast user switcher --- backend.php | 2 +- functions.php | 25 +++++++++++++++++++++---- tt-rss.css | 7 +++++++ tt-rss.js | 5 +++++ tt-rss.php | 10 ++++++++++ 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/backend.php b/backend.php index 5e793f27f..e7e4d6bcf 100644 --- a/backend.php +++ b/backend.php @@ -1533,7 +1533,7 @@ } print " - Title + Title Feed Last Article Updated"; diff --git a/functions.php b/functions.php index e408376b5..02228c886 100644 --- a/functions.php +++ b/functions.php @@ -1011,14 +1011,23 @@ return true; } - function authenticate_user($link, $login, $password) { + function authenticate_user($link, $login, $password, $force_auth = false) { if (!SINGLE_USER_MODE) { $pwd_hash = 'SHA1:' . sha1($password); - - $result = db_query($link, "SELECT id,login,access_level FROM ttrss_users WHERE - login = '$login' AND pwd_hash = '$pwd_hash'"); + + if ($force_auth && defined('_DEBUG_USER_SWITCH')) { + $query = "SELECT id,login,access_level + FROM ttrss_users WHERE + login = '$login'"; + } else { + $query = "SELECT id,login,access_level + FROM ttrss_users WHERE + login = '$login' AND pwd_hash = '$pwd_hash'"; + } + + $result = db_query($link, $query); if (db_num_rows($result) == 1) { $_SESSION["uid"] = db_fetch_result($result, 0, "id"); @@ -1145,6 +1154,14 @@ function login_sequence($link) { if (!SINGLE_USER_MODE) { + if (defined('_DEBUG_USER_SWITCH') && $_SESSION["uid"]) { + $swu = db_escape_string($_REQUEST["swu"]); + if ($swu) { + $_SESSION["prefs_cache"] = false; + return authenticate_user($link, $swu, null, true); + } + } + if (!validate_session($link)) { logout_user(); $redirect_uri = get_login_redirect(); diff --git a/tt-rss.css b/tt-rss.css index 13d8cda0c..39d73a929 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -51,6 +51,7 @@ ul.feedList { margin : 5px; padding : 0px 0px 0px 5px; font-size : small; + white-space : nowrap; } ul.feedList li.feedCat { @@ -1244,3 +1245,9 @@ div.return a:hover { border-style : solid; } + +#userSwitch { + position : absolute; + bottom : 2px; + right : 2px; +} diff --git a/tt-rss.js b/tt-rss.js index ed0f17924..2bd5068df 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -564,3 +564,8 @@ function catchupCurrentFeed() { } } +function userSwitch() { + var chooser = document.getElementById("userSwitch"); + var user = chooser[chooser.selectedIndex].value; + window.location = "tt-rss.php?swu=" + user; +} diff --git a/tt-rss.php b/tt-rss.php index a323922b4..4894cf92f 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -210,6 +210,16 @@ window.onload = init; -- cgit v1.2.3