From 2547ece0cacb7080060ad3bc32b879fee6b52230 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 14 Feb 2021 14:59:22 +0300 Subject: pref-users: cleanup index --- classes/pref/users.php | 214 +++++++++++++++++++++---------------------------- 1 file changed, 93 insertions(+), 121 deletions(-) diff --git a/classes/pref/users.php b/classes/pref/users.php index 5c622a9b1..0454a1292 100644 --- a/classes/pref/users.php +++ b/classes/pref/users.php @@ -251,12 +251,8 @@ class Pref_Users extends Handler_Protected { print T_sprintf("Added user %s with password %s", $login, $tmp_user_pwd); - $this->initialize_user($new_uid); - } else { - print T_sprintf("Could not create user %s", $login); - } } else { print T_sprintf("User %s already exists.", $login); @@ -303,10 +299,6 @@ class Pref_Users extends Handler_Protected { global $access_level_names; - print "
"; - print "
"; - print "
"; - $user_search = clean($_REQUEST["search"] ?? ""); if (array_key_exists("search", $_REQUEST)) { @@ -315,137 +307,117 @@ class Pref_Users extends Handler_Protected { $user_search = ($_SESSION["prefs_user_search"] ?? ""); } - print "
- - -
"; - $sort = clean($_REQUEST["sort"] ?? ""); if (!$sort || $sort == "undefined") { $sort = "login"; } - print "
". - "" . __('Select').""; - print "
"; - print "
".__('All')."
"; - print "
".__('None')."
"; - print "
"; - - print ""; - - print " - - - "; - - PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "prefUsersToolbar"); - - print "
"; #toolbar - print "
"; #pane - print "
"; - $sort = $this->validate_field($sort, ["login", "access_level", "created", "num_feeds", "created", "last_login"], "login"); if ($sort != "login") $sort = "$sort DESC"; - $sth = $this->pdo->prepare("SELECT - tu.id, - login,access_level,email, - ".SUBSTRING_FOR_DATE."(last_login,1,16) as last_login, - ".SUBSTRING_FOR_DATE."(created,1,16) as created, - (SELECT COUNT(id) FROM ttrss_feeds WHERE owner_uid = tu.id) AS num_feeds - FROM - ttrss_users tu - WHERE - (:search = '' OR login LIKE :search) AND tu.id > 0 - ORDER BY $sort"); - $sth->execute([":search" => $user_search ? "%$user_search%" : ""]); - - print ""; - - print " - - - - - - "; - - $lnum = 0; - - while ($line = $sth->fetch()) { - - $uid = $line["id"]; - - print ""; - - $line["login"] = htmlspecialchars($line["login"]); - $line["created"] = TimeHelper::make_local_datetime($line["created"], false); - $line["last_login"] = TimeHelper::make_local_datetime($line["last_login"], false); - - print ""; - - print ""; - - print ""; - print ""; - print ""; - print ""; - - print ""; - - ++$lnum; - } - - print "
 ".__('Login')."".__('Access Level')."".__('Subscribed feeds')."".__('Registered')."".__('Last login')."
person " . $line["login"] . "" . $access_level_names[$line["access_level"]] . "" . $line["num_feeds"] . "" . $line["created"] . "" . $line["last_login"] . "
"; - - if ($lnum == 0) { - if (!$user_search) { - print_warning(__('No users defined.')); - } else { - print_warning(__('No matching users found.')); - } - } - - print "
"; #pane - - PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "prefUsers"); - - print "
"; #container - - } + ?> + +
+
+
+ +
+ + +
+ +
+ +
+
+
+
+
+ + + + + + + + + + run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "prefUsersToolbar") ?> + +
+
+
+ + + + + + + + + + + + + pdo->prepare("SELECT + tu.id, + login,access_level,email, + ".SUBSTRING_FOR_DATE."(last_login,1,16) as last_login, + ".SUBSTRING_FOR_DATE."(created,1,16) as created, + (SELECT COUNT(id) FROM ttrss_feeds WHERE owner_uid = tu.id) AS num_feeds + FROM + ttrss_users tu + WHERE + (:search = '' OR login LIKE :search) AND tu.id > 0 + ORDER BY $sort"); + $sth->execute([":search" => $user_search ? "%$user_search%" : ""]); + + while ($row = $sth->fetch()) { ?> + + + + + + + + + + + +
+ + person
+
+ run_hooks(PluginHost::HOOK_PREFS_TAB, "prefUsers") ?> +
+ prepare("insert into ttrss_feeds (owner_uid,title,feed_url) - values (?, 'Tiny Tiny RSS: Forum', - 'https://tt-rss.org/forum/rss.php')"); - $sth->execute([$uid]); - } - static function logout_user() { if (session_status() === PHP_SESSION_ACTIVE) session_destroy(); -- cgit v1.2.3