]> git.wh0rd.org Git - tt-rss.git/commitdiff
add debug mode only fast user switcher
authorAndrew Dolgov <fox@bah.spb.su>
Sun, 1 Oct 2006 04:05:12 +0000 (05:05 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sun, 1 Oct 2006 04:05:12 +0000 (05:05 +0100)
backend.php
functions.php
tt-rss.css
tt-rss.js
tt-rss.php

index 5e793f27f8721781796ab91e9d3419569f16f189..e7e4d6bcfd360f20e40d52bafad70a0268efc92a 100644 (file)
                                }
 
                                print "
-                                       <td width='40%'><a href=\"javascript:updateFeedList('title')\">Title</a></td>
+                                       <td width='35%'><a href=\"javascript:updateFeedList('title')\">Title</a></td>
                                        <td width='35%'><a href=\"javascript:updateFeedList('feed_url')\">Feed</a></td>
                                        <td width='15%'><a href=\"javascript:updateFeedList('last_article')\">Last&nbsp;Article</a></td>
                                        <td width='15%' align='right'><a href=\"javascript:updateFeedList('last_updated')\">Updated</a></td>";
index e408376b5b0e6c98bf9b7fa2442ef006b0a1a504..02228c8864863fef8b343339260c298667fe4635 100644 (file)
                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");
        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();
index 13d8cda0c8a83b2244bbf3cc1a561baf6e68f1b8..39d73a929efa44a8923ded0f72e448db8964712e 100644 (file)
@@ -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;
+}
index ed0f17924f3cb50756e94626b5ea8d7ec2c71d10..2bd5068df69c5dfb410e87b16f4adaffcbb6101f 100644 (file)
--- 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;
+}
index a323922b46f23b3e068e44263bac13db97c7fe9d..4894cf92fca51ab0bd6001c382933bee406d497b 100644 (file)
@@ -210,6 +210,16 @@ window.onload = init;
 <?php } ?>
 
 <div id="footer">
+       <?php if (defined('_DEBUG_USER_SWITCH')) { ?>
+               <select id="userSwitch" onchange="userSwitch()">
+               <?php 
+                       foreach (array('admin', 'fox', 'test') as $u) {
+                               $op_sel = ($u == $_SESSION["name"]) ? "selected" : "";
+                               print "<option $op_sel>$u</option>";
+                       }
+               ?>
+               </select>
+       <? } ?>
        <a href="http://tt-rss.spb.ru/">Tiny Tiny RSS</a> v<?php echo VERSION ?> &copy; 2005-2006 Andrew Dolgov
 </div>