From 543fce93fc51da8cd1b865b3a8658cdde3661745 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 25 Sep 2011 16:49:48 +0400 Subject: [PATCH] prefs: remove fix loading prompts after searching feeds or users --- modules/pref-feeds.php | 2 +- modules/pref-users.php | 102 ++++++++++++++++++++--------------------- 2 files changed, 51 insertions(+), 53 deletions(-) diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index 1645ca0ba..0fd3f02f1 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -1329,7 +1329,7 @@ print "
+ value=\"$feed_search\">
"; diff --git a/modules/pref-users.php b/modules/pref-users.php index b75d5b76f..8586abf2d 100644 --- a/modules/pref-users.php +++ b/modules/pref-users.php @@ -3,7 +3,7 @@ global $access_level_names; - if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) { + if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) { print __("Your access level is insufficient to open this tab."); return; } @@ -24,17 +24,17 @@ $result = db_query($link, "SELECT login, ".SUBSTRING_FOR_DATE."(last_login,1,16) AS last_login, access_level, - (SELECT COUNT(int_id) FROM ttrss_user_entries + (SELECT COUNT(int_id) FROM ttrss_user_entries WHERE owner_uid = id) AS stored_articles, ".SUBSTRING_FOR_DATE."(created,1,16) AS created - FROM ttrss_users + FROM ttrss_users WHERE id = '$uid'"); - + if (db_num_rows($result) == 0) { print "

".__('User not found')."

"; return; } - + // print "

User Details

"; $login = db_fetch_result($result, 0, "login"); @@ -59,7 +59,7 @@ $num_feeds = db_fetch_result($result, 0, "num_feeds"); print "".__('Subscribed feeds count')."$num_feeds"; - + print ""; print "

".__('Subscribed feeds')."

"; @@ -89,10 +89,10 @@ if (db_num_rows($result) < $num_feeds) { // FIXME - add link to show ALL subscribed feeds here somewhere - print "
  •  ...
  • "; } - + print ""; print "
    @@ -133,11 +133,11 @@ if ($sel_disabled) { print ""; - print ""; } else { - print ""; } @@ -150,10 +150,10 @@ print __('Access level: ') . " "; if (!$sel_disabled) { - print_select_hash("access_level", $access_level, $access_level_names, + print_select_hash("access_level", $access_level, $access_level_names, $sel_disabled); } else { - print_select_hash("", $access_level, $access_level_names, + print_select_hash("", $access_level, $access_level_names, $sel_disabled); print ""; } @@ -191,7 +191,7 @@ } if ($subop == "editSave") { - + if ($_SESSION["access_level"] >= 10) { $login = db_escape_string(trim($_REQUEST["login"])); @@ -202,13 +202,13 @@ if ($password) { $pwd_hash = encrypt_password($password, $login); - $pass_query_part = "pwd_hash = '$pwd_hash', "; + $pass_query_part = "pwd_hash = '$pwd_hash', "; $status_msg = format_notice(T_sprintf('Changed password of user %s.', $login)); } else { $pass_query_part = ""; } - db_query($link, "UPDATE ttrss_users SET $pass_query_part login = '$login', + db_query($link, "UPDATE ttrss_users SET $pass_query_part login = '$login', access_level = '$access_level', email = '$email' WHERE id = '$uid'"); } @@ -227,51 +227,51 @@ } } } else if ($subop == "add") { - + if ($_SESSION["access_level"] >= 10) { $login = db_escape_string(trim($_REQUEST["login"])); $tmp_user_pwd = make_password(8); $pwd_hash = encrypt_password($tmp_user_pwd, $login); - $result = db_query($link, "SELECT id FROM ttrss_users WHERE + $result = db_query($link, "SELECT id FROM ttrss_users WHERE login = '$login'"); if (db_num_rows($result) == 0) { - db_query($link, "INSERT INTO ttrss_users + db_query($link, "INSERT INTO ttrss_users (login,pwd_hash,access_level,last_login,created) VALUES ('$login', '$pwd_hash', 0, null, NOW())"); - - - $result = db_query($link, "SELECT id FROM ttrss_users WHERE + + + $result = db_query($link, "SELECT id FROM ttrss_users WHERE login = '$login' AND pwd_hash = '$pwd_hash'"); - + if (db_num_rows($result) == 1) { - + $new_uid = db_fetch_result($result, 0, "id"); - - $status_msg = format_notice(T_sprintf("Added user %s with password %s", + + $status_msg = format_notice(T_sprintf("Added user %s with password %s", $login, $tmp_user_pwd)); - + initialize_user($link, $new_uid); - + } else { - + $status_msg = format_warning(T_sprintf("Could not create user %s", $login)); - + } } else { $status_msg = format_warning(T_sprintf("User %s already exists.", $login)); } - } + } } else if ($subop == "resetPass") { if ($_SESSION["access_level"] >= 10) { $uid = db_escape_string($_REQUEST["id"]); - $result = db_query($link, "SELECT login,email + $result = db_query($link, "SELECT login,email FROM ttrss_users WHERE id = '$uid'"); $login = db_fetch_result($result, 0, "login"); @@ -341,8 +341,8 @@ "\n". "Sincerely, TT-RSS Mail Daemon.", "From: " . MAIL_FROM); */ } - - print "
    "; + + print ""; } } @@ -362,9 +362,7 @@ print "
    + value=\"$user_search\">
    "; @@ -378,9 +376,9 @@ print "
    ". "" . __('Select').""; print "
    "; - print "
    ".__('All')."
    "; - print "
    ".__('None')."
    "; print "
    "; @@ -406,7 +404,7 @@ $user_search = split(" ", $user_search); $tokens = array(); - foreach ($user_search as $token) { + foreach ($user_search as $token) { $token = trim($token); array_push($tokens, "(UPPER(login) LIKE UPPER('%$token%'))"); } @@ -417,11 +415,11 @@ $user_search_query = ""; } - $result = db_query($link, "SELECT + $result = db_query($link, "SELECT id,login,access_level,email, ".SUBSTRING_FOR_DATE."(last_login,1,16) as last_login, ".SUBSTRING_FOR_DATE."(created,1,16) as created - FROM + FROM ttrss_users WHERE $user_search_query @@ -430,7 +428,7 @@ if (db_num_rows($result) > 0) { - print "

    "; print " @@ -439,9 +437,9 @@ "; - + $lnum = 0; - + while ($line = db_fetch_assoc($result)) { $class = ($lnum % 2) ? "even" : "odd"; @@ -454,8 +452,8 @@ $this_row_id = ""; } else { $this_row_id = "id=\"UMRR-$uid\""; - } - + } + print ""; $line["login"] = htmlspecialchars($line["login"]); @@ -463,19 +461,19 @@ $line["created"] = make_local_datetime($link, $line["created"], false); $line["last_login"] = make_local_datetime($link, $line["last_login"], false); - print ""; $onclick = "onclick='editUser($uid, event)' title='".__('Click to edit')."'"; - print ""; + print ""; if (!$line["email"]) $line["email"] = " "; - print ""; - print ""; - print ""; - + print ""; + print ""; + print ""; + print ""; ++$lnum;
    ".__('Access Level')." ".__('Registered')." ".__('Last login')."
    " . $line["login"] . "" . $line["login"] . "" . $access_level_names[$line["access_level"]] . "" . $line["created"] . "" . $line["last_login"] . "" . $access_level_names[$line["access_level"]] . "" . $line["created"] . "" . $line["last_login"] . "