2006-10-01 12:05:20 +02:00
|
|
|
<?php
|
|
|
|
function module_pref_users($link) {
|
|
|
|
|
2006-10-02 05:22:20 +02:00
|
|
|
global $access_level_names;
|
|
|
|
|
2008-05-16 08:03:14 +02:00
|
|
|
if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) {
|
|
|
|
print __("Your access level is insufficient to open this tab.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-01-24 09:16:47 +01:00
|
|
|
$subop = $_REQUEST["subop"];
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2008-09-18 06:53:36 +02:00
|
|
|
if ($subop == "user-details") {
|
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
$uid = sprintf("%d", $_REQUEST["id"]);
|
2008-09-18 06:53:36 +02:00
|
|
|
|
2009-01-25 18:19:09 +01:00
|
|
|
print "<div id=\"infoBoxTitle\">".__('User details')."</div>";
|
2008-09-18 06:53:36 +02:00
|
|
|
|
|
|
|
print "<div class='infoBoxContents'>";
|
|
|
|
|
|
|
|
$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
|
|
|
|
WHERE owner_uid = id) AS stored_articles,
|
|
|
|
".SUBSTRING_FOR_DATE."(created,1,16) AS created
|
|
|
|
FROM ttrss_users
|
|
|
|
WHERE id = '$uid'");
|
|
|
|
|
|
|
|
if (db_num_rows($result) == 0) {
|
2009-01-25 18:19:09 +01:00
|
|
|
print "<h1>".__('User not found')."</h1>";
|
2008-09-18 06:53:36 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// print "<h1>User Details</h1>";
|
|
|
|
|
|
|
|
$login = db_fetch_result($result, 0, "login");
|
|
|
|
|
|
|
|
print "<table width='100%'>";
|
|
|
|
|
2010-11-07 16:14:48 +01:00
|
|
|
$last_login = make_local_datetime($link,
|
2010-11-11 14:15:33 +01:00
|
|
|
db_fetch_result($result, 0, "last_login"), true);
|
2008-09-18 06:53:36 +02:00
|
|
|
|
2010-11-07 16:14:48 +01:00
|
|
|
$created = make_local_datetime($link,
|
2010-11-11 14:15:33 +01:00
|
|
|
db_fetch_result($result, 0, "created"), true);
|
2008-09-18 06:53:36 +02:00
|
|
|
|
|
|
|
$access_level = db_fetch_result($result, 0, "access_level");
|
|
|
|
$stored_articles = db_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>";
|
|
|
|
|
2008-10-08 06:14:20 +02:00
|
|
|
$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 "<tr><td>".__('Subscribed feeds count')."</td><td>$num_feeds</td></tr>";
|
|
|
|
|
2008-09-18 06:53:36 +02:00
|
|
|
print "</table>";
|
|
|
|
|
|
|
|
print "<h1>".__('Subscribed feeds')."</h1>";
|
|
|
|
|
|
|
|
$result = db_query($link, "SELECT id,title,site_url FROM ttrss_feeds
|
|
|
|
WHERE owner_uid = '$uid' ORDER BY title");
|
|
|
|
|
|
|
|
print "<ul class=\"userFeedList\">";
|
|
|
|
|
|
|
|
$row_class = "odd";
|
|
|
|
|
|
|
|
while ($line = db_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 class=\"$row_class\">$feed_icon <a href=\"".$line["site_url"]."\">".$line["title"]."</a></li>";
|
|
|
|
|
|
|
|
$row_class = toggleEvenOdd($row_class);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (db_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'>
|
2010-01-12 13:56:29 +01:00
|
|
|
<button onclick=\"closeInfoBox()\">".__("Close this window").
|
|
|
|
"</button></div>";
|
2008-09-18 06:53:36 +02:00
|
|
|
|
|
|
|
print "</div>";
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-10-01 12:05:20 +02:00
|
|
|
if ($subop == "edit") {
|
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
$id = db_escape_string($_REQUEST["id"]);
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2008-08-06 10:40:04 +02:00
|
|
|
print "<div id=\"infoBoxTitle\">".__('User Editor')."</div>";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
print "<div class=\"infoBoxContents\">";
|
|
|
|
|
2007-03-02 21:58:29 +01:00
|
|
|
print "<form id=\"user_edit_form\" onsubmit='return false'>";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
print "<input type=\"hidden\" name=\"id\" value=\"$id\">";
|
|
|
|
print "<input type=\"hidden\" name=\"op\" value=\"pref-users\">";
|
|
|
|
print "<input type=\"hidden\" name=\"subop\" value=\"editSave\">";
|
|
|
|
|
|
|
|
$result = db_query($link, "SELECT * FROM ttrss_users WHERE id = '$id'");
|
|
|
|
|
|
|
|
$login = db_fetch_result($result, 0, "login");
|
|
|
|
$access_level = db_fetch_result($result, 0, "access_level");
|
|
|
|
$email = db_fetch_result($result, 0, "email");
|
|
|
|
|
2008-08-06 10:40:04 +02:00
|
|
|
$sel_disabled = ($id == $_SESSION["uid"]) ? "disabled" : "";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2008-08-06 10:40:04 +02:00
|
|
|
print "<div class=\"dlgSec\">".__("User")."</div>";
|
|
|
|
print "<div class=\"dlgSecCont\">";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2009-01-22 14:30:29 +01:00
|
|
|
if ($sel_disabled) {
|
|
|
|
print "<input type=\"hidden\" name=\"login\" value=\"$login\">";
|
2009-01-22 16:02:05 +01:00
|
|
|
print "<input size=\"30\" style=\"font-size : 16px\"
|
|
|
|
onkeypress=\"return filterCR(event, userEditSave)\" $sel_disabled
|
|
|
|
value=\"$login\">";
|
|
|
|
} else {
|
|
|
|
print "<input size=\"30\" style=\"font-size : 16px\"
|
|
|
|
onkeypress=\"return filterCR(event, userEditSave)\" $sel_disabled
|
|
|
|
name=\"login\" value=\"$login\">";
|
2009-01-22 14:30:29 +01:00
|
|
|
}
|
2008-08-06 10:40:04 +02:00
|
|
|
|
|
|
|
print "</div>";
|
|
|
|
|
|
|
|
print "<div class=\"dlgSec\">".__("Authentication")."</div>";
|
|
|
|
print "<div class=\"dlgSecCont\">";
|
|
|
|
|
|
|
|
print __('Access level: ') . " ";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2009-01-22 16:05:00 +01:00
|
|
|
if (!$sel_disabled) {
|
|
|
|
print_select_hash("access_level", $access_level, $access_level_names,
|
|
|
|
$sel_disabled);
|
|
|
|
} else {
|
|
|
|
print_select_hash("", $access_level, $access_level_names,
|
|
|
|
$sel_disabled);
|
|
|
|
print "<input type=\"hidden\" name=\"access_level\" value=\"$access_level\">";
|
|
|
|
}
|
2008-08-06 10:40:04 +02:00
|
|
|
|
|
|
|
print "<br/>";
|
|
|
|
|
|
|
|
print __('Change password to') .
|
2008-08-07 05:06:53 +02:00
|
|
|
" <input size=\"20\" onkeypress=\"return filterCR(event, userEditSave)\"
|
2008-08-06 10:40:04 +02:00
|
|
|
name=\"password\">";
|
|
|
|
|
|
|
|
print "</div>";
|
|
|
|
|
|
|
|
print "<div class=\"dlgSec\">".__("Options")."</div>";
|
|
|
|
print "<div class=\"dlgSecCont\">";
|
|
|
|
|
|
|
|
print __('E-mail: ').
|
2008-08-07 05:06:53 +02:00
|
|
|
" <input size=\"30\" name=\"email\" onkeypress=\"return filterCR(event, userEditSave)\"
|
2008-08-06 10:40:04 +02:00
|
|
|
value=\"$email\">";
|
|
|
|
|
|
|
|
print "</div>";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
print "</table>";
|
|
|
|
|
|
|
|
print "</form>";
|
2009-01-22 16:02:05 +01:00
|
|
|
|
2008-08-06 10:40:04 +02:00
|
|
|
print "<div class=\"dlgButtons\">
|
2010-01-12 13:56:29 +01:00
|
|
|
<button onclick=\"return userEditSave()\">".
|
|
|
|
__('Save')."</button>
|
|
|
|
<button onclick=\"return userEditCancel()\">".
|
|
|
|
__('Cancel')."</button></div>";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
print "</div>";
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($subop == "editSave") {
|
|
|
|
|
2010-07-01 10:26:27 +02:00
|
|
|
if ($_SESSION["access_level"] >= 10) {
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2009-01-24 09:16:47 +01:00
|
|
|
$login = db_escape_string(trim($_REQUEST["login"]));
|
|
|
|
$uid = db_escape_string($_REQUEST["id"]);
|
|
|
|
$access_level = (int) $_REQUEST["access_level"];
|
|
|
|
$email = db_escape_string(trim($_REQUEST["email"]));
|
|
|
|
$password = db_escape_string(trim($_REQUEST["password"]));
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
if ($password) {
|
2007-09-12 05:58:05 +02:00
|
|
|
$pwd_hash = encrypt_password($password, $login);
|
2006-10-01 12:05:20 +02:00
|
|
|
$pass_query_part = "pwd_hash = '$pwd_hash', ";
|
2007-03-05 13:50:46 +01:00
|
|
|
print_notice(T_sprintf('Changed password of user <b>%s</b>.', $login));
|
2006-10-01 12:05:20 +02:00
|
|
|
} else {
|
|
|
|
$pass_query_part = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
db_query($link, "UPDATE ttrss_users SET $pass_query_part login = '$login',
|
|
|
|
access_level = '$access_level', email = '$email' WHERE id = '$uid'");
|
|
|
|
|
|
|
|
}
|
|
|
|
} else if ($subop == "remove") {
|
|
|
|
|
2009-01-20 15:26:24 +01:00
|
|
|
if ($_SESSION["access_level"] >= 10) {
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
foreach ($ids as $id) {
|
2010-06-10 12:29:55 +02:00
|
|
|
if ($id != $_SESSION["uid"] && $id != 1) {
|
2009-01-20 15:26:24 +01:00
|
|
|
db_query($link, "DELETE FROM ttrss_tags WHERE owner_uid = '$id'");
|
|
|
|
db_query($link, "DELETE FROM ttrss_feeds WHERE owner_uid = '$id'");
|
|
|
|
db_query($link, "DELETE FROM ttrss_users WHERE id = '$id'");
|
|
|
|
}
|
2006-10-01 12:05:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if ($subop == "add") {
|
|
|
|
|
2009-01-20 15:26:24 +01:00
|
|
|
if ($_SESSION["access_level"] >= 10) {
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
$login = db_escape_string(trim($_REQUEST["login"]));
|
2006-10-01 12:05:20 +02:00
|
|
|
$tmp_user_pwd = make_password(8);
|
2007-09-12 05:58:05 +02:00
|
|
|
$pwd_hash = encrypt_password($tmp_user_pwd, $login);
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
$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
|
2007-11-16 06:11:59 +01:00
|
|
|
(login,pwd_hash,access_level,last_login,created)
|
|
|
|
VALUES ('$login', '$pwd_hash', 0, null, NOW())");
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
$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");
|
|
|
|
|
2007-03-05 13:50:46 +01:00
|
|
|
print_notice(T_sprintf("Added user <b>%s</b> with password <b>%s</b>",
|
|
|
|
$login, $tmp_user_pwd));
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
initialize_user($link, $new_uid);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
2007-03-05 13:50:46 +01:00
|
|
|
print_warning(T_sprintf("Could not create user <b>%s</b>", $login));
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
2007-03-05 13:50:46 +01:00
|
|
|
print_warning(T_sprintf("User <b>%s</b> already exists.", $login));
|
2006-10-01 12:05:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if ($subop == "resetPass") {
|
|
|
|
|
2010-07-01 10:26:27 +02:00
|
|
|
if ($_SESSION["access_level"] >= 10) {
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
$uid = db_escape_string($_REQUEST["id"]);
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
$result = db_query($link, "SELECT login,email
|
|
|
|
FROM ttrss_users WHERE id = '$uid'");
|
|
|
|
|
|
|
|
$login = db_fetch_result($result, 0, "login");
|
|
|
|
$email = db_fetch_result($result, 0, "email");
|
|
|
|
$tmp_user_pwd = make_password(8);
|
2007-09-12 05:58:05 +02:00
|
|
|
$pwd_hash = encrypt_password($tmp_user_pwd, $login);
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
db_query($link, "UPDATE ttrss_users SET pwd_hash = '$pwd_hash'
|
|
|
|
WHERE id = '$uid'");
|
|
|
|
|
2007-03-05 13:50:46 +01:00
|
|
|
print_notice(T_sprintf("Changed password of user <b>%s</b>
|
|
|
|
to <b>%s</b>", $login, $tmp_user_pwd));
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2009-01-22 14:28:15 +01:00
|
|
|
if ($email) {
|
2008-01-16 16:34:40 +01:00
|
|
|
print_notice(T_sprintf("Notifying <b>%s</b>.", $email));
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2009-01-22 14:41:34 +01:00
|
|
|
require_once "lib/MiniTemplator.class.php";
|
2008-05-18 09:32:03 +02:00
|
|
|
|
|
|
|
$tpl = new MiniTemplator;
|
|
|
|
|
|
|
|
$tpl->readTemplateFromFile("templates/resetpass_template.txt");
|
|
|
|
|
|
|
|
$tpl->setVariable('LOGIN', $login);
|
|
|
|
$tpl->setVariable('NEWPASS', $tmp_user_pwd);
|
|
|
|
|
|
|
|
$tpl->addBlock('message');
|
|
|
|
|
|
|
|
$message = "";
|
|
|
|
|
|
|
|
$tpl->generateOutputToString($message);
|
|
|
|
|
|
|
|
$mail = new PHPMailer();
|
|
|
|
|
2009-01-22 14:28:15 +01:00
|
|
|
$mail->PluginDir = "lib/phpmailer/";
|
|
|
|
$mail->SetLanguage("en", "lib/phpmailer/language/");
|
2008-05-18 09:32:03 +02:00
|
|
|
|
|
|
|
$mail->CharSet = "UTF-8";
|
|
|
|
|
|
|
|
$mail->From = DIGEST_FROM_ADDRESS;
|
|
|
|
$mail->FromName = DIGEST_FROM_NAME;
|
|
|
|
$mail->AddAddress($email, $login);
|
|
|
|
|
|
|
|
if (DIGEST_SMTP_HOST) {
|
|
|
|
$mail->Host = DIGEST_SMTP_HOST;
|
|
|
|
$mail->Mailer = "smtp";
|
2008-11-21 07:32:26 +01:00
|
|
|
$mail->SMTPAuth = DIGEST_SMTP_LOGIN != '';
|
2008-05-18 09:32:03 +02:00
|
|
|
$mail->Username = DIGEST_SMTP_LOGIN;
|
|
|
|
$mail->Password = DIGEST_SMTP_PASSWORD;
|
|
|
|
}
|
|
|
|
|
|
|
|
$mail->IsHTML(false);
|
2008-05-18 09:43:19 +02:00
|
|
|
$mail->Subject = __("[tt-rss] Password change notification");
|
2008-05-18 09:32:03 +02:00
|
|
|
$mail->Body = $message;
|
|
|
|
|
|
|
|
$rc = $mail->Send();
|
|
|
|
|
|
|
|
if (!$rc) print_error($mail->ErrorInfo);
|
|
|
|
|
|
|
|
/* mail("$login <$email>", "Password reset notification",
|
2006-10-01 12:05:20 +02:00
|
|
|
"Hi, $login.\n".
|
|
|
|
"\n".
|
|
|
|
"Your password for this TT-RSS installation was reset by".
|
|
|
|
" an administrator.\n".
|
|
|
|
"\n".
|
|
|
|
"Your new password is $tmp_user_pwd, please remember".
|
|
|
|
" it for later reference.\n".
|
|
|
|
"\n".
|
2008-05-18 09:32:03 +02:00
|
|
|
"Sincerely, TT-RSS Mail Daemon.", "From: " . MAIL_FROM); */
|
2006-10-01 12:05:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
print "</div>";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-04 05:26:20 +02:00
|
|
|
set_pref($link, "_PREFS_ACTIVE_TAB", "userConfig");
|
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
$user_search = db_escape_string($_REQUEST["search"]);
|
2008-05-17 05:32:36 +02:00
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
if (array_key_exists("search", $_REQUEST)) {
|
2008-05-17 05:32:36 +02:00
|
|
|
$_SESSION["prefs_user_search"] = $user_search;
|
|
|
|
} else {
|
|
|
|
$user_search = $_SESSION["prefs_user_search"];
|
|
|
|
}
|
|
|
|
|
2010-01-12 13:56:29 +01:00
|
|
|
print "<div style='float : right'>
|
2008-05-17 05:32:36 +02:00
|
|
|
<input id=\"user_search\" size=\"20\" type=\"search\"
|
|
|
|
onfocus=\"javascript:disableHotkeys();\"
|
|
|
|
onblur=\"javascript:enableHotkeys();\"
|
|
|
|
onchange=\"javascript:updateUsersList()\" value=\"$user_search\">
|
2010-01-12 13:56:29 +01:00
|
|
|
<button onclick=\"javascript:updateUsersList()\">".
|
|
|
|
__('Search')."</button>
|
2008-05-17 05:32:36 +02:00
|
|
|
</div>";
|
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
$sort = db_escape_string($_REQUEST["sort"]);
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
if (!$sort || $sort == "undefined") {
|
|
|
|
$sort = "login";
|
|
|
|
}
|
|
|
|
|
2010-01-12 13:56:29 +01:00
|
|
|
print "<button onclick=\"javascript:addUser()\">".__('Create user')."</button>";
|
|
|
|
|
|
|
|
print "
|
|
|
|
<button onclick=\"javascript:selectedUserDetails()\">".
|
|
|
|
__('Details')."</button>
|
|
|
|
<button onclick=\"javascript:editSelectedUser()\">".
|
|
|
|
__('Edit')."</button>
|
|
|
|
<button onclick=\"javascript:removeSelectedUsers()\">".
|
|
|
|
__('Remove')."</button>
|
|
|
|
<button onclick=\"javascript:resetSelectedUserPass()\">".
|
|
|
|
__('Reset password')."</button>";
|
2010-01-11 16:43:53 +01:00
|
|
|
|
|
|
|
print "</div>";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2008-05-17 05:32:36 +02:00
|
|
|
if ($user_search) {
|
2009-10-07 13:12:21 +02:00
|
|
|
|
|
|
|
$user_search = split(" ", $user_search);
|
|
|
|
$tokens = array();
|
|
|
|
|
|
|
|
foreach ($user_search as $token) {
|
|
|
|
$token = trim($token);
|
|
|
|
array_push($tokens, "(UPPER(login) LIKE UPPER('%$token%'))");
|
|
|
|
}
|
|
|
|
|
|
|
|
$user_search_query = "(" . join($tokens, " AND ") . ") AND ";
|
|
|
|
|
2008-05-17 05:32:36 +02:00
|
|
|
} else {
|
|
|
|
$user_search_query = "";
|
|
|
|
}
|
|
|
|
|
2006-10-01 12:05:20 +02:00
|
|
|
$result = db_query($link, "SELECT
|
|
|
|
id,login,access_level,email,
|
2008-05-17 05:38:39 +02:00
|
|
|
".SUBSTRING_FOR_DATE."(last_login,1,16) as last_login,
|
|
|
|
".SUBSTRING_FOR_DATE."(created,1,16) as created
|
2006-10-01 12:05:20 +02:00
|
|
|
FROM
|
|
|
|
ttrss_users
|
2008-05-17 05:32:36 +02:00
|
|
|
WHERE
|
|
|
|
$user_search_query
|
|
|
|
id > 0
|
2006-10-01 12:05:20 +02:00
|
|
|
ORDER BY $sort");
|
|
|
|
|
2008-05-17 05:32:36 +02:00
|
|
|
if (db_num_rows($result) > 0) {
|
|
|
|
|
2006-10-01 12:05:20 +02:00
|
|
|
// print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>";
|
|
|
|
|
|
|
|
print "<p><table width=\"100%\" cellspacing=\"0\"
|
|
|
|
class=\"prefUserList\" id=\"prefUserList\">";
|
|
|
|
|
|
|
|
print "<tr><td class=\"selectPrompt\" colspan=\"8\">
|
2007-05-14 09:56:49 +02:00
|
|
|
".__('Select:')."
|
2010-11-12 11:52:53 +01:00
|
|
|
<a href=\"#\" onclick=\"selectTableRows('prefUserList', 'all')\">".__('All')."</a>,
|
|
|
|
<a href=\"#\" onclick=\"selectTableRows('prefUserList', 'none')\">".__('None')."</a>
|
2006-10-01 12:05:20 +02:00
|
|
|
</td</tr>";
|
|
|
|
|
|
|
|
print "<tr class=\"title\">
|
|
|
|
<td align='center' width=\"5%\"> </td>
|
2010-11-11 16:59:21 +01:00
|
|
|
<td width=''><a href=\"#\" onclick=\"updateUsersList('login')\">".__('Login')."</a></td>
|
|
|
|
<td width='20%'><a href=\"#\" onclick=\"updateUsersList('access_level')\">".__('Access Level')."</a></td>
|
|
|
|
<td width='20%'><a href=\"#\" onclick=\"updateUsersList('created')\">".__('Registered')."</a></td>
|
|
|
|
<td width='20%'><a href=\"#\" onclick=\"updateUsersList('last_login')\">".__('Last login')."</a></td></tr>";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
$lnum = 0;
|
|
|
|
|
|
|
|
while ($line = db_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
$class = ($lnum % 2) ? "even" : "odd";
|
|
|
|
|
|
|
|
$uid = $line["id"];
|
2009-12-29 16:49:27 +01:00
|
|
|
$edit_uid = $_REQUEST["id"];
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
if ($subop == "edit" && $uid != $edit_uid) {
|
2010-11-14 13:55:51 +01:00
|
|
|
$class .= " Grayed";
|
2006-10-01 12:05:20 +02:00
|
|
|
$this_row_id = "";
|
|
|
|
} else {
|
|
|
|
$this_row_id = "id=\"UMRR-$uid\"";
|
|
|
|
}
|
|
|
|
|
|
|
|
print "<tr class=\"$class\" $this_row_id>";
|
|
|
|
|
|
|
|
$line["login"] = htmlspecialchars($line["login"]);
|
|
|
|
|
2010-11-07 16:14:48 +01:00
|
|
|
$line["created"] = make_local_datetime($link, $line["created"], false);
|
|
|
|
$line["last_login"] = make_local_datetime($link, $line["last_login"], false);
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2010-11-11 16:59:21 +01:00
|
|
|
print "<td align='center'><input onclick='toggleSelectRow(this);'
|
2006-10-01 12:05:20 +02:00
|
|
|
type=\"checkbox\" id=\"UMCHK-$uid\"></td>";
|
|
|
|
|
2010-11-11 16:59:21 +01:00
|
|
|
$onclick = "onclick='editUser($uid, event)' title='".__('Click to edit')."'";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2008-05-17 17:36:35 +02:00
|
|
|
print "<td $onclick>" . $line["login"] . "</td>";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2008-05-17 17:36:35 +02:00
|
|
|
if (!$line["email"]) $line["email"] = " ";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2008-05-17 17:36:35 +02:00
|
|
|
print "<td $onclick>" . $access_level_names[$line["access_level"]] . "</td>";
|
|
|
|
print "<td $onclick>" . $line["created"] . "</td>";
|
|
|
|
print "<td $onclick>" . $line["last_login"] . "</td>";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
print "</tr>";
|
|
|
|
|
|
|
|
++$lnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
print "</table>";
|
|
|
|
|
2008-05-17 05:32:36 +02:00
|
|
|
} else {
|
|
|
|
print "<p>";
|
|
|
|
if (!$user_search) {
|
2009-10-06 11:37:24 +02:00
|
|
|
print_warning(__('No users defined.'));
|
2008-05-17 05:32:36 +02:00
|
|
|
} else {
|
2009-10-06 11:37:24 +02:00
|
|
|
print_warning(__('No matching users found.'));
|
2008-05-17 05:32:36 +02:00
|
|
|
}
|
|
|
|
print "</p>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-10-01 12:05:20 +02:00
|
|
|
}
|
|
|
|
?>
|