From: Andrew Dolgov Date: Wed, 12 Aug 2015 17:19:38 +0000 (+0300) Subject: combine user edit & user details X-Git-Tag: 16.3~142 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=bf9cc9ad9526471551b057e6390f6c040599e531;p=tt-rss.git combine user edit & user details --- diff --git a/classes/pref/users.php b/classes/pref/users.php index 89554ba6..a10404d0 100644 --- a/classes/pref/users.php +++ b/classes/pref/users.php @@ -17,89 +17,16 @@ class Pref_Users extends Handler_Protected { return array_search($method, $csrf_ignored) !== false; } - function userdetails() { - - $uid = sprintf("%d", $_REQUEST["id"]); - - $result = $this->dbh->query("SELECT login, - ".SUBSTRING_FOR_DATE."(last_login,1,16) AS last_login, - access_level, - (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 - WHERE id = '$uid'"); - - if ($this->dbh->num_rows($result) == 0) { - print "

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

"; - return; - } - - print ""; - - $last_login = make_local_datetime( - $this->dbh->fetch_result($result, 0, "last_login"), true); - - $created = make_local_datetime( - $this->dbh->fetch_result($result, 0, "created"), true); - - $stored_articles = $this->dbh->fetch_result($result, 0, "stored_articles"); - - print ""; - print ""; - - $result = $this->dbh->query("SELECT COUNT(id) as num_feeds FROM ttrss_feeds - WHERE owner_uid = '$uid'"); - - $num_feeds = $this->dbh->fetch_result($result, 0, "num_feeds"); - - print ""; - print ""; - - print "
".__('Registered')."$created
".__('Last logged in')."$last_login
".__('Subscribed feeds count')."$num_feeds
".__('Stored articles')."$stored_articles
"; - - print "

".__('Subscribed feeds')."

"; - - $result = $this->dbh->query("SELECT id,title,site_url FROM ttrss_feeds - WHERE owner_uid = '$uid' ORDER BY title"); - - print ""; - - print "
-
"; - - return; - } - function edit() { global $access_level_names; - $id = $this->dbh->escape_string($_REQUEST["id"]); + print '
+
'; + print "
"; + $id = (int) $this->dbh->escape_string($_REQUEST["id"]); + print ""; print ""; print ""; @@ -121,7 +48,7 @@ class Pref_Users extends Handler_Protected { print ""; print "
"; @@ -142,7 +69,7 @@ class Pref_Users extends Handler_Protected { print "
"; - print ""; print "
"; @@ -150,7 +77,7 @@ class Pref_Users extends Handler_Protected { print "
".__("Options")."
"; print "
"; - print ""; print "
"; @@ -159,15 +86,92 @@ class Pref_Users extends Handler_Protected { print ""; + print ''; #tab + print "
"; + + print '
'; + print ''; + print "
+ __('Save')."
"; + __('Cancel').""; return; } + function userdetails() { + $id = (int) $this->dbh->escape_string($_REQUEST["id"]); + + $result = $this->dbh->query("SELECT login, + ".SUBSTRING_FOR_DATE."(last_login,1,16) AS last_login, + access_level, + (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 + WHERE id = '$id'"); + + if ($this->dbh->num_rows($result) == 0) { + print "

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

"; + return; + } + + print ""; + + $last_login = make_local_datetime( + $this->dbh->fetch_result($result, 0, "last_login"), true); + + $created = make_local_datetime( + $this->dbh->fetch_result($result, 0, "created"), true); + + $stored_articles = $this->dbh->fetch_result($result, 0, "stored_articles"); + + print ""; + print ""; + + $result = $this->dbh->query("SELECT COUNT(id) as num_feeds FROM ttrss_feeds + WHERE owner_uid = '$id'"); + + $num_feeds = $this->dbh->fetch_result($result, 0, "num_feeds"); + + print ""; + print ""; + + print "
".__('Registered')."$created
".__('Last logged in')."$last_login
".__('Subscribed feeds count')."$num_feeds
".__('Stored articles')."$stored_articles
"; + + print "

".__('Subscribed feeds')."

"; + + $result = $this->dbh->query("SELECT id,title,site_url FROM ttrss_feeds + WHERE owner_uid = '$id' ORDER BY title"); + + print ""; + } + function editSave() { $login = $this->dbh->escape_string(trim($_REQUEST["login"])); $uid = $this->dbh->escape_string($_REQUEST["id"]); @@ -338,8 +342,6 @@ class Pref_Users extends Handler_Protected { print ""; print " -