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 "<h1>".__('User not found')."</h1>";
- return;
- }
-
- print "<table width='100%'>";
-
- $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 "<tr><td>".__('Registered')."</td><td>$created</td></tr>";
- print "<tr><td>".__('Last logged in')."</td><td>$last_login</td></tr>";
-
- $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 "<tr><td>".__('Subscribed feeds count')."</td><td>$num_feeds</td></tr>";
- print "<tr><td>".__('Stored articles')."</td><td>$stored_articles</td></tr>";
-
- print "</table>";
-
- print "<h1>".__('Subscribed feeds')."</h1>";
-
- $result = $this->dbh->query("SELECT id,title,site_url FROM ttrss_feeds
- WHERE owner_uid = '$uid' ORDER BY title");
-
- print "<ul class=\"userFeedList\">";
-
- while ($line = $this->dbh->fetch_assoc($result)) {
-
- $icon_file = ICONS_URL."/".$line["id"].".ico";
-
- if (file_exists($icon_file) && filesize($icon_file) > 0) {
- $feed_icon = "<img class=\"tinyFeedIcon\" src=\"$icon_file\">";
- } else {
- $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">";
- }
-
- print "<li>$feed_icon <a href=\"".$line["site_url"]."\">".$line["title"]."</a></li>";
-
- }
-
- if ($this->dbh->num_rows($result) < $num_feeds) {
- // FIXME - add link to show ALL subscribed feeds here somewhere
- print "<li><img
- class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\"> ...</li>";
- }
-
- print "</ul>";
-
- print "<div align='center'>
- <button dojoType=\"dijit.form.Button\" type=\"submit\">".__("Close this window").
- "</button></div>";
-
- return;
- }
-
function edit() {
global $access_level_names;
- $id = $this->dbh->escape_string($_REQUEST["id"]);
+ print '<div dojoType="dijit.layout.TabContainer" style="height : 400px">
+ <div dojoType="dijit.layout.ContentPane" title="'.__('Edit user').'">';
+
print "<form id=\"user_edit_form\" onsubmit='return false' dojoType=\"dijit.form.Form\">";
+ $id = (int) $this->dbh->escape_string($_REQUEST["id"]);
+
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$id\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-users\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"editSave\">";
print "<input size=\"30\" style=\"font-size : 16px\"
dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"
- onkeypress=\"return filterCR(event, userEditSave)\" $sel_disabled
+ $sel_disabled
name=\"login\" value=\"$login\">";
print "</div>";
print "<hr/>";
- print "<input dojoType=\"dijit.form.TextBox\" type=\"password\" size=\"20\" onkeypress=\"return filterCR(event, userEditSave)\" placeholder=\"Change password\"
+ print "<input dojoType=\"dijit.form.TextBox\" type=\"password\" size=\"20\" placeholder=\"Change password\"
name=\"password\">";
print "</div>";
print "<div class=\"dlgSec\">".__("Options")."</div>";
print "<div class=\"dlgSecCont\">";
- print "<input dojoType=\"dijit.form.TextBox\" size=\"30\" name=\"email\" onkeypress=\"return filterCR(event, userEditSave)\" placeholder=\"E-mail\"
+ print "<input dojoType=\"dijit.form.TextBox\" size=\"30\" name=\"email\" placeholder=\"E-mail\"
value=\"$email\">";
print "</div>";
print "</form>";
+ print '</div>'; #tab
+ print "<div href=\"backend.php?op=pref-users&method=userdetails&id=$id\"
+ dojoType=\"dijit.layout.ContentPane\" title=\"".__('User details')."\">";
+
+ print '</div>';
+ print '</div>';
+
print "<div class=\"dlgButtons\">
<button dojoType=\"dijit.form.Button\" type=\"submit\">".
- __('Save')."</button>
+ __('Save')."</button>
<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('userEditDlg').hide()\">".
- __('Cancel')."</button></div>";
+ __('Cancel')."</button></div>";
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 "<h1>".__('User not found')."</h1>";
+ return;
+ }
+
+ print "<table width='100%'>";
+
+ $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 "<tr><td>".__('Registered')."</td><td>$created</td></tr>";
+ print "<tr><td>".__('Last logged in')."</td><td>$last_login</td></tr>";
+
+ $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 "<tr><td>".__('Subscribed feeds count')."</td><td>$num_feeds</td></tr>";
+ print "<tr><td>".__('Stored articles')."</td><td>$stored_articles</td></tr>";
+
+ print "</table>";
+
+ print "<h1>".__('Subscribed feeds')."</h1>";
+
+ $result = $this->dbh->query("SELECT id,title,site_url FROM ttrss_feeds
+ WHERE owner_uid = '$id' ORDER BY title");
+
+ print "<ul class=\"userFeedList\">";
+
+ while ($line = $this->dbh->fetch_assoc($result)) {
+
+ $icon_file = ICONS_URL."/".$line["id"].".ico";
+
+ if (file_exists($icon_file) && filesize($icon_file) > 0) {
+ $feed_icon = "<img class=\"tinyFeedIcon\" src=\"$icon_file\">";
+ } else {
+ $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">";
+ }
+
+ print "<li>$feed_icon <a href=\"".$line["site_url"]."\">".$line["title"]."</a></li>";
+
+ }
+
+ if ($this->dbh->num_rows($result) < $num_feeds) {
+ // FIXME - add link to show ALL subscribed feeds here somewhere
+ print "<li><img
+ class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\"> ...</li>";
+ }
+
+ print "</ul>";
+ }
+
function editSave() {
$login = $this->dbh->escape_string(trim($_REQUEST["login"]));
$uid = $this->dbh->escape_string($_REQUEST["id"]);
print "<button dojoType=\"dijit.form.Button\" onclick=\"addUser()\">".__('Create user')."</button>";
print "
- <button dojoType=\"dijit.form.Button\" onclick=\"selectedUserDetails()\">".
- __('Details')."</button dojoType=\"dijit.form.Button\">
<button dojoType=\"dijit.form.Button\" onclick=\"editSelectedUser()\">".
__('Edit')."</button dojoType=\"dijit.form.Button\">
<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedUsers()\">".