From 717f5e645b47a444bb0a2f524658e36ad1a4b74f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 18 Nov 2005 13:02:38 +0100 Subject: [PATCH] user details for user manager --- backend.php | 97 ++++++++++++++++++++++++++++++++++++++++++++++++--- functions.php | 3 ++ prefs.js | 20 +++++++++++ tt-rss.css | 9 +++-- 4 files changed, 119 insertions(+), 10 deletions(-) diff --git a/backend.php b/backend.php index 9078a2043..f7318ff47 100644 --- a/backend.php +++ b/backend.php @@ -11,9 +11,6 @@ require_once "functions.php"; require_once "magpierss/rss_fetch.inc"; -// $_SESSION["uid"] = PLACEHOLDER_UID; // FIXME: placeholder -// $_SESSION["name"] = PLACEHOLDER_NAME; - $op = $_REQUEST["op"]; if ($op == "rpc" || $op == "updateAllFeeds") { @@ -1928,14 +1925,104 @@ print " Selection: + onclick=\"javascript:selectedUserDetails()\" value=\"User details\"> "; + onclick=\"javascript:removeSelectedUsers()\" value=\"Remove\"> + "; + } } + if ($op == "user-details") { + + if (WEB_DEMO_MODE || $_SESSION["access_level"] < 10) { + return; + } + + print " + Tiny Tiny RSS : User Details + + + "; + + $uid = sprintf("%d", $_GET["id"]); + + /* FIXME this badly needs real implementation */ + + print "
"; + + $result = db_query($link, "SELECT login,last_login,access_level + FROM ttrss_users + WHERE id = '$uid'"); + + if (db_num_rows($result) == 0) { + print "

User not found

"; + return; + } + + print "

User Details

"; + + print ""; + + $login = db_fetch_result($result, 0, "login"); + $last_login = db_fetch_result($result, 0, "last_login"); + $access_level = db_fetch_result($result, 0, "access_level"); + + print ""; + print ""; + print ""; + + $result = db_query($link, "SELECT COUNT(id) as num_feeds FROM ttrss_feeds + WHERE owner_uid = '$uid'"); + + $num_feeds = db_fetch_result($result, 0, "num_feeds"); + + print ""; + + $result = db_query($link, "SELECT + SUM(LENGTH(content)+LENGTH(title)+LENGTH(link)+LENGTH(guid)) AS db_size + FROM ttrss_entries WHERE owner_uid = '$uid'"); + + $db_size = db_fetch_result($result, 0, "db_size"); + + print ""; + + print "
Username$login
Access level$access_level
Last logged in$last_login
Subscribed feeds count$num_feeds
Approx. DB size$db_size bytes
"; + + print "

Subscribed feeds

"; + + $result = db_query($link, "SELECT id,title,feed_url FROM ttrss_feeds + WHERE owner_uid = '$uid'"); + + print ""; + + print "

+ (Close this window)

"; + + print "
"; + + print ""; + + } + db_close($link); ?> diff --git a/functions.php b/functions.php index 9a6f70184..730b1fedd 100644 --- a/functions.php +++ b/functions.php @@ -106,6 +106,9 @@ if (!rename($tmpfname, $icon_file)) { unlink($tmpfname); } + + chmod($icon_file, 0644); + error_reporting (E_ERROR | E_WARNING | E_PARSE); } diff --git a/prefs.js b/prefs.js index c18e5100f..4333aac18 100644 --- a/prefs.js +++ b/prefs.js @@ -848,7 +848,27 @@ function resetSelectedUserPass() { } +function selectedUserDetails() { + var rows = getSelectedUsers(); + + if (rows.length == 0) { + notify("No users are selected."); + return; + } + + if (rows.length > 1) { + notify("Please select one user."); + return; + } + + var id = rows[0]; + + var w = window.open("backend.php?op=user-details&id=" + id, + "User Details", + "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no"); + +} function editSelectedFilter() { var rows = getSelectedFilters(); diff --git a/tt-rss.css b/tt-rss.css index 3fb4961b0..ca591c50e 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -181,7 +181,7 @@ ul.feedList li.feed { display : block; } -ul.feedList img { +ul.feedList img, img.feedIcon { margin : 0px 3px 0px 0px; width : 16px; height : 16px; @@ -411,7 +411,7 @@ a.helpLink:hover { color : #5050aa; } -div.helpResponse { +div.helpResponse, div.userDetails { margin : 10px; background-image : url("images/vgrad_light_rev2.png"); background-position : top left; @@ -420,17 +420,16 @@ div.helpResponse { border : 1px solid #f0f0f0; } -div.helpResponse h1 { +div.helpResponse h1, div.userDetails h1 { border-width : 0px 0px 1px 0px; border-style : solid; border-color : #c0c0c0; font-size : 16pt; } -div.helpResponse h2 { +div.helpResponse h2, div.userDetails h2 { border-width : 0px 0px 0px 0px; font-size : 12pt; - } pre {