本文整理汇总了PHP中user_remove函数的典型用法代码示例。如果您正苦于以下问题:PHP user_remove函数的具体用法?PHP user_remove怎么用?PHP user_remove使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_remove函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: public_server_cron
function public_server_cron($a, $b)
{
logger("public_server: cron start");
require_once 'include/enotify.php';
$r = q("select * from user where account_expires_on < UTC_TIMESTAMP() + INTERVAL 5 DAY and account_expires_on > '0000-00-00 00:00:00' and\n\t\texpire_notification_sent = '0000-00-00 00:00:00' ");
if (count($r)) {
foreach ($r as $rr) {
notification(array('uid' => $rr['uid'], 'type' => NOTIFY_SYSTEM, 'system_type' => 'public_server_expire', 'language' => $rr['language'], 'to_name' => $rr['username'], 'to_email' => $rr['email'], 'source_name' => t('Administrator'), 'source_link' => $a->get_baseurl(), 'source_photo' => $a->get_baseurl() . '/images/person-80.jpg'));
q("update user set expire_notification_sent = '%s' where uid = %d", dbesc(datetime_convert()), intval($rr['uid']));
}
}
$r = q("select * from user where account_expired = 1 and account_expires_on < UTC_TIMESTAMP() - INTERVAL 5 DAY and account_expires_on > '0000-00-00 00:00:00'");
if (count($r)) {
require_once 'include/Contact.php';
foreach ($r as $rr) {
user_remove($rr['uid']);
}
}
$nologin = get_config('public_server', 'nologin');
if ($nologin) {
$r = q("select uid from user where account_expired = 0 and login_date = '0000-00-00 00:00:00' and register_date < UTC_TIMESTAMP() - INTERVAL %d DAY and account_expires_on = '0000-00-00 00:00:00'", intval($nologin));
if (count($r)) {
foreach ($r as $rr) {
q("update user set account_expires_on = '%s' where uid = %d", dbesc(datetime_convert('UTC', 'UTC', 'now +' . '6 days')), intval($rr['uid']));
}
}
}
$flagusers = get_config('public_server', 'flagusers');
if ($flagusers) {
$r = q("select uid from user where account_expired = 0 and login_date < UTC_TIMESTAMP() - INTERVAL %d DAY and account_expires_on = '0000-00-00 00:00:00' and `page-flags` = 0", intval($flagusers));
if (count($r)) {
foreach ($r as $rr) {
q("update user set account_expires_on = '%s' where uid = %d", dbesc(datetime_convert('UTC', 'UTC', 'now +' . '6 days')), intval($rr['uid']));
}
}
}
$flagposts = get_config('public_server', 'flagposts');
$flagpostsexpire = get_config('public_server', 'flagpostsexpire');
if ($flagposts && $flagpostsexpire) {
$r = q("select uid from user where account_expired = 0 and login_date < UTC_TIMESTAMP() - INTERVAL %d DAY and account_expires_on = '0000-00-00 00:00:00' and expire = 0 and `page-flags` = 0", intval($flagposts));
if (count($r)) {
foreach ($r as $rr) {
q("update user set expire = %d where uid = %d", intval($flagpostsexpire), intval($rr['uid']));
}
}
}
logger("public_server: cron end");
}
示例2: testdrive_cron
function testdrive_cron($a, $b)
{
require_once 'include/enotify.php';
$r = q("select * from user where account_expires_on < UTC_TIMESTAMP() + INTERVAL 5 DAY and\n\t\texpire_notification_sent = '0000-00-00 00:00:00' ");
if (count($r)) {
foreach ($r as $rr) {
notification(array('uid' => $rr['uid'], 'type' => NOTIFY_SYSTEM, 'system_type' => 'testdrive_expire', 'language' => $rr['language'], 'to_name' => $rr['username'], 'to_email' => $rr['email'], 'source_name' => t('Administrator'), 'source_link' => $a->get_baseurl(), 'source_photo' => $a->get_baseurl() . '/images/person-80.jpg'));
q("update user set expire_notification_sent = '%s' where uid = %d", dbesc(datetime_convert()), intval($rr['uid']));
}
}
$r = q("select * from user where account_expired = 1 and account_expires_on < UTC_TIMESTAMP() - INTERVAL 5 DAY ");
if (count($r)) {
require_once 'include/Contact.php';
foreach ($r as $rr) {
user_remove($rr['uid']);
}
}
}
示例3: removeme_post
function removeme_post(&$a)
{
if (!local_user()) {
return;
}
if (!x($_POST, 'qxz_password') || !strlen(trim($_POST['qxz_password']))) {
return;
}
if (!x($_POST, 'verify') || !strlen(trim($_POST['verify']))) {
return;
}
if ($_POST['verify'] !== $_SESSION['remove_account_verify']) {
return;
}
$encrypted = hash('whirlpool', trim($_POST['qxz_password']));
if (strlen($a->user['password']) && $encrypted === $a->user['password']) {
require_once 'include/Contact.php';
user_remove($a->user['uid']);
// NOTREACHED
}
}
示例4: db_query
db_query("DELETE FROM `prefix_usercheck` WHERE `check` = '" . escape($_GET['check'], 'string') . "'");
break;
// join us
// join us
case 4:
echo '<br />Joinus kann über diese Liste nicht akzeptiert werden, mache diese über <a style="color:red;" href="http://ilch11.dev/admin.php?groups-joinus">Joinus Anfragen bearbeiten</a><br /><br />';
break;
// ak 5 remove account
// ak 5 remove account
case 5:
list($id, $muell) = explode('-remove-', $row['check']);
if ($id == $_SESSION['authid']) {
echo 'Der eigene Account ist auf diese Weise nicht löschbar.';
break;
}
user_remove($id);
db_query("DELETE FROM prefix_usercheck WHERE `check` = '" . escape($_GET['check'], 'string') . "'");
break;
}
} else {
$tpl->set_out('error', 'User nicht auffindbar', 3);
}
}
// remove pending user
if ($menu->get(1) == "del" and isset($_GET['check'])) {
db_query("DELETE FROM `prefix_usercheck` WHERE `check` = '" . escape($_GET['check'], 'string') . "'");
}
$tpl->out(0);
$ak = array('', 'neuer User', 'neues Passwort', 'neue Emailadresse', 'Join us');
$c = 0;
$erg = db_query("SELECT `check`, `name`, `email`, `ak`, date_format(`datime`,'%k:%i Uhr %e.%c.%Y') as `time` FROM `prefix_usercheck` ORDER by `datime` DESC");
示例5: _
$_SESSION['dialog']['info'][] = $ret['error_string'];
} else {
$_SESSION['dialog']['info'][] = _('Unable to process user addition');
}
header("Location: " . _u('index.php?app=main&inc=core_user&route=user_mgmnt&op=user_add&view=' . $view));
exit;
break;
case "user_del":
$up['username'] = $_REQUEST['uname'];
$del_uid = user_username2uid($up['username']);
// users cannot be removed if they still have subusers
$subusers = user_getsubuserbyuid($del_uid);
if (count($subusers) > 0) {
$ret['error_string'] = _('Unable to delete this user until all subusers under this user have been removed');
} else {
$ret = user_remove($del_uid);
}
$_SESSION['dialog']['info'][] = $ret['error_string'];
header("Location: " . _u('index.php?app=main&inc=core_user&route=user_mgmnt&op=user_list&view=' . $view));
exit;
break;
case "user_unban":
$uid = user_username2uid($_REQUEST['uname']);
if (user_banned_get($uid)) {
if (user_banned_remove($uid)) {
$_SESSION['dialog']['info'][] = _('Account has been unbanned') . ' (' . _('username') . ': ' . $_REQUEST['uname'] . ')';
} else {
$_SESSION['dialog']['info'][] = _('Unable to unban account') . ' (' . _('username') . ': ' . $_REQUEST['uname'] . ')';
}
} else {
$_SESSION['dialog']['info'][] = _('User is not on banned users list') . ' (' . _('username') . ': ' . $_REQUEST['uname'] . ')';
示例6: form_actions
function form_actions() {
global $colors, $user_actions, $auth_realms;
/* if we are to save this form, instead of display it */
if (isset($_POST["selected_items"])) {
if (get_request_var_post("drp_action") != "2") {
$selected_items = unserialize(stripslashes(get_request_var_post("selected_items")));
}
if (get_request_var_post("drp_action") == "1") { /* delete */
for ($i=0;($i<count($selected_items));$i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
user_remove($selected_items[$i]);
}
}
if (get_request_var_post("drp_action") == "2") { /* copy */
/* ================= input validation ================= */
input_validate_input_number(get_request_var_post("selected_items"));
input_validate_input_number(get_request_var_post("new_realm"));
/* ==================================================== */
$new_username = get_request_var_post("new_username");
$new_realm = get_request_var_post("new_realm", 0);
$template_user = db_fetch_row("SELECT username, realm FROM user_auth WHERE id = " . get_request_var_post("selected_items"));
$overwrite = array( "full_name" => get_request_var_post("new_fullname") );
if (strlen($new_username)) {
if (sizeof(db_fetch_assoc("SELECT username FROM user_auth WHERE username = '" . $new_username . "' AND realm = " . $new_realm))) {
raise_message(19);
} else {
if (user_copy($template_user["username"], $new_username, $template_user["realm"], $new_realm, false, $overwrite) === false) {
raise_message(2);
} else {
raise_message(1);
}
}
}
}
if (get_request_var_post("drp_action") == "3") { /* enable */
for ($i=0;($i<count($selected_items));$i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
user_enable($selected_items[$i]);
}
}
if (get_request_var_post("drp_action") == "4") { /* disable */
for ($i=0;($i<count($selected_items));$i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
user_disable($selected_items[$i]);
}
}
if (get_request_var_post("drp_action") == "5") { /* batch copy */
/* ================= input validation ================= */
input_validate_input_number(get_request_var_post("template_user"));
/* ==================================================== */
$copy_error = false;
$template = db_fetch_row("SELECT username, realm FROM user_auth WHERE id = " . get_request_var_post("template_user"));
for ($i=0;($i<count($selected_items));$i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
$user = db_fetch_row("SELECT username, realm FROM user_auth WHERE id = " . $selected_items[$i]);
if ((isset($user)) && (isset($template))) {
if (user_copy($template["username"], $user["username"], $template["realm"], $user["realm"], true) === false) {
$copy_error = true;
}
}
}
if ($copy_error) {
raise_message(2);
} else {
raise_message(1);
}
}
header("Location: user_admin.php");
exit;
}
/* loop through each of the users and process them */
$user_list = "";
$user_array = array();
$i = 0;
while (list($var,$val) = each($_POST)) {
if (ereg("^chk_([0-9]+)$", $var, $matches)) {
//.........这里部分代码省略.........
示例7: webservices_account_remove
function webservices_account_remove($uid)
{
$ret = user_remove($uid, TRUE);
if ($ret['status']) {
$json['status'] = 'OK';
$json['error'] = '0';
$json['info'] = $ret['error_string'];
} else {
$json['status'] = 'ERR';
$json['error'] = '606';
$json['info'] = $ret['error_string'];
}
return $json;
}
示例8: design
break;
// details des users aendern
// details des users aendern
case 2:
$design = new design('Admins Area', 'Admins Area', 2);
$design->header();
$changeok = true;
$uid = escape($_POST['uID'], 'integer');
$altes_recht = db_result(db_query("SELECT recht FROM prefix_user WHERE id = " . $uid), 0);
$neues_recht = escape($_POST['urecht'], 'integer');
if (($neues_recht <= $_SESSION['authright'] or $altes_recht <= $_SESSION['authright']) and $_SESSION['authid'] > 1) {
$changeok = false;
}
if ($changeok and chk_antispam('adminuser', true)) {
if (isset($_POST['userdel'])) {
user_remove($uid);
wd('?user', 'User wurde erfolgreich gelöscht');
} else {
$abf = "SELECT * FROM prefix_user WHERE id = '" . $uid . "'";
$erg = db_query($abf);
$row = db_fetch_object($erg);
if (isset($_POST['passw'])) {
$newPass = genkey(8);
$newPassHash = user_pw_crypt($newPass);
icmail($row->email, 'neues Password', "Hallo\n\nDein Password wurde soeben von einem Administrator gäendert es ist nun:\n\n{$newPass}\n\nGruß der Administrator");
db_query('UPDATE `prefix_user` SET pass = "' . $newPassHash . '" WHERE id = "' . escape($_POST['uID'], 'integer') . '"');
}
// avatar speichern START
$avatar_sql_update = '';
if (!empty($_FILES['avatarfile']['name'])) {
$file_tmpe = $_FILES['avatarfile']['tmp_name'];
示例9: form_actions
function form_actions()
{
global $user_actions, $auth_realms;
/* if we are to save this form, instead of display it */
if (isset($_POST['associate_host'])) {
while (list($var, $val) = each($_POST)) {
if (ereg('^chk_([0-9]+)$', $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
if (get_request_var_post('drp_action') == '1') {
db_execute_prepared('REPLACE INTO user_auth_perms (user_id, item_id, type) VALUES (?, ?, 3)', array(get_request_var_post('id'), $matches[1]));
} else {
db_execute_prepared('DELETE FROM user_auth_perms WHERE user_id = ? AND item_id = ? AND type = 3', array(get_request_var_post('id'), $matches[1]));
}
}
}
header('Location: user_admin.php?action=user_edit&tab=permsd&id=' . get_request_var_post('id'));
exit;
} elseif (isset($_POST['associate_graph'])) {
while (list($var, $val) = each($_POST)) {
if (ereg('^chk_([0-9]+)$', $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
if (get_request_var_post('drp_action') == '1') {
db_execute_prepared('REPLACE INTO user_auth_perms (user_id, item_id, type) VALUES (?, ?, 1)', array(get_request_var_post('id'), $matches[1]));
} else {
db_execute_prepared('DELETE FROM user_auth_perms WHERE user_id = ? AND item_id = ? AND type = 1', array(get_request_var_post('id'), $matches[1]));
}
}
}
header('Location: user_admin.php?action=user_edit&tab=permsg&id=' . get_request_var_post('id'));
exit;
} elseif (isset($_POST['associate_template'])) {
while (list($var, $val) = each($_POST)) {
if (ereg('^chk_([0-9]+)$', $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
if (get_request_var_post('drp_action') == '1') {
db_execute_prepared('REPLACE INTO user_auth_perms (user_id, item_id, type) VALUES (?, ?, 4)', array(get_request_var_post('id'), $matches[1]));
} else {
db_execute_prepared('DELETE FROM user_auth_perms WHERE user_id = ? AND item_id = ? AND type = 4', array(get_request_var_post('id'), $matches[1]));
}
}
}
header('Location: user_admin.php?action=user_edit&tab=permste&id=' . get_request_var_post('id'));
exit;
} elseif (isset($_POST['associate_groups'])) {
while (list($var, $val) = each($_POST)) {
if (ereg('^chk_([0-9]+)$', $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
if (get_request_var_post('drp_action') == '1') {
db_execute_prepared('REPLACE INTO user_auth_group_members (user_id, group_id) VALUES (?, ?)', array(get_request_var_post('id'), $matches[1]));
} else {
db_execute_prepared('DELETE FROM user_auth_group_members WHERE user_id = ? AND group_id = ?', array(get_request_var_post('id'), $matches[1]));
}
}
}
header('Location: user_admin.php?action=user_edit&tab=permsgr&id=' . get_request_var_post('id'));
exit;
} elseif (isset($_POST['associate_tree'])) {
while (list($var, $val) = each($_POST)) {
if (ereg('^chk_([0-9]+)$', $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
if (get_request_var_post('drp_action') == '1') {
db_execute_prepared('REPLACE INTO user_auth_perms (user_id, item_id, type) VALUES (?, ?, 2)', array(get_request_var_post('id'), $matches[1]));
} else {
db_execute_prepared('DELETE FROM user_auth_perms WHERE user_id = ? AND item_id = ? AND type = 2', array(get_request_var_post('id'), $matches[1]));
}
}
}
header('Location: user_admin.php?action=user_edit&tab=permstr&id=' . get_request_var_post('id'));
exit;
} elseif (isset($_POST['selected_items'])) {
if (get_request_var_post('drp_action') != '2') {
$selected_items = unserialize(stripslashes(get_request_var_post('selected_items')));
}
if (get_request_var_post('drp_action') == '1') {
/* delete */
for ($i = 0; $i < count($selected_items); $i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
user_remove($selected_items[$i]);
api_plugin_hook_function('user_remove', $selected_items[$i]);
}
}
if (get_request_var_post('drp_action') == '2') {
/* copy */
/* ================= input validation ================= */
input_validate_input_number(get_request_var_post('selected_items'));
input_validate_input_number(get_request_var_post('new_realm'));
/* ==================================================== */
$new_username = get_request_var_post('new_username');
//.........这里部分代码省略.........
示例10: admin_page_users
/**
* @param App $a
* @return string
*/
function admin_page_users(&$a)
{
if ($a->argc > 2) {
$uid = $a->argv[3];
$user = q("SELECT username, blocked FROM `user` WHERE `uid`=%d", intval($uid));
if (count($user) == 0) {
notice('User not found' . EOL);
goaway($a->get_baseurl(true) . '/admin/users');
return '';
// NOTREACHED
}
switch ($a->argv[2]) {
case "delete":
check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't');
// delete user
require_once "include/Contact.php";
user_remove($uid);
notice(sprintf(t("User '%s' deleted"), $user[0]['username']) . EOL);
break;
case "block":
check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't');
q("UPDATE `user` SET `blocked`=%d WHERE `uid`=%s", intval(1 - $user[0]['blocked']), intval($uid));
notice(sprintf($user[0]['blocked'] ? t("User '%s' unblocked") : t("User '%s' blocked"), $user[0]['username']) . EOL);
break;
}
goaway($a->get_baseurl(true) . '/admin/users');
return '';
// NOTREACHED
}
/* get pending */
$pending = q("SELECT `register`.*, `contact`.`name`, `user`.`email`\n\t\t\t\t FROM `register`\n\t\t\t\t LEFT JOIN `contact` ON `register`.`uid` = `contact`.`uid`\n\t\t\t\t LEFT JOIN `user` ON `register`.`uid` = `user`.`uid`;");
/* get users */
$total = q("SELECT count(*) as total FROM `user` where 1");
if (count($total)) {
$a->set_pager_total($total[0]['total']);
$a->set_pager_itemspage(100);
}
$users = q("SELECT `user` . * , `contact`.`name` , `contact`.`url` , `contact`.`micro`, `lastitem`.`lastitem_date`, `user`.`account_expired`\n\t\t\t\tFROM\n\t\t\t\t\t(SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`\n\t\t\t\t\tFROM `item`\n\t\t\t\t\tWHERE `item`.`type` = 'wall'\n\t\t\t\t\tGROUP BY `item`.`uid`) AS `lastitem`\n\t\t\t\t\t\t RIGHT OUTER JOIN `user` ON `user`.`uid` = `lastitem`.`uid`,\n\t\t\t\t\t `contact`\n\t\t\t\tWHERE\n\t\t\t\t\t `user`.`uid` = `contact`.`uid`\n\t\t\t\t\t\tAND `user`.`verified` =1\n\t\t\t\t\tAND `contact`.`self` =1\n\t\t\t\tORDER BY `contact`.`name` LIMIT %d, %d\n\t\t\t\t", intval($a->pager['start']), intval($a->pager['itemspage']));
function _setup_users($e)
{
$a = get_app();
$adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
$accounts = array(t('Normal Account'), t('Soapbox Account'), t('Community/Celebrity Account'), t('Automatic Friend Account'));
$e['page-flags'] = $accounts[$e['page-flags']];
$e['register_date'] = relative_date($e['register_date']);
$e['login_date'] = relative_date($e['login_date']);
$e['lastitem_date'] = relative_date($e['lastitem_date']);
//$e['is_admin'] = ($e['email'] === $a->config['admin_email']);
$e['is_admin'] = in_array($e['email'], $adminlist);
$e['deleted'] = $e['account_removed'] ? relative_date($e['account_expires_on']) : False;
return $e;
}
$users = array_map("_setup_users", $users);
// Get rid of dashes in key names, Smarty3 can't handle them
// and extracting deleted users
$tmp_users = array();
$deleted = array();
while (count($users)) {
$new_user = array();
foreach (array_pop($users) as $k => $v) {
$k = str_replace('-', '_', $k);
$new_user[$k] = $v;
}
if ($new_user['deleted']) {
array_push($deleted, $new_user);
} else {
array_push($tmp_users, $new_user);
}
}
//Reversing the two array, and moving $tmp_users to $users
array_reverse($deleted);
while (count($tmp_users)) {
array_push($users, array_pop($tmp_users));
}
$t = get_markup_template("admin_users.tpl");
$o = replace_macros($t, array('$title' => t('Administration'), '$page' => t('Users'), '$submit' => t('Add User'), '$select_all' => t('select all'), '$h_pending' => t('User registrations waiting for confirm'), '$h_deleted' => t('User waiting for permanent deletion'), '$th_pending' => array(t('Request date'), t('Name'), t('Email')), '$no_pending' => t('No registrations.'), '$approve' => t('Approve'), '$deny' => t('Deny'), '$delete' => t('Delete'), '$block' => t('Block'), '$unblock' => t('Unblock'), '$siteadmin' => t('Site admin'), '$accountexpired' => t('Account expired'), '$h_users' => t('Users'), '$h_newuser' => t('New User'), '$th_deleted' => array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Deleted since')), '$th_users' => array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account')), '$confirm_delete_multi' => t('Selected users will be deleted!\\n\\nEverything these users had posted on this site will be permanently deleted!\\n\\nAre you sure?'), '$confirm_delete' => t('The user {0} will be deleted!\\n\\nEverything this user has posted on this site will be permanently deleted!\\n\\nAre you sure?'), '$form_security_token' => get_form_security_token("admin_users"), '$baseurl' => $a->get_baseurl(true), '$pending' => $pending, 'deleted' => $deleted, '$users' => $users, '$newusername' => array('new_user_name', t("Name"), '', t("Name of the new user.")), '$newusernickname' => array('new_user_nickname', t("Nickname"), '', t("Nickname of the new user.")), '$newuseremail' => array('new_user_email', t("Email"), '', t("Email address of the new user."), '', '', 'email')));
$o .= paginate($a);
return $o;
}
示例11: admin_page_users
function admin_page_users(&$a)
{
if ($a->argc > 2) {
$uid = $a->argv[3];
$user = q("SELECT * FROM `user` WHERE `uid`=%d", intval($uid));
if (count($user) == 0) {
notice('User not found' . EOL);
goaway($a->get_baseurl() . '/admin/users');
return;
// NOTREACHED
}
switch ($a->argv[2]) {
case "delete":
// delete user
require_once "include/Contact.php";
user_remove($uid);
notice(sprintf(t("User '%s' deleted"), $user[0]['username']) . EOL);
break;
case "block":
q("UPDATE `user` SET `blocked`=%d WHERE `uid`=%s", intval(1 - $user[0]['blocked']), intval($uid));
notice(sprintf($user[0]['blocked'] ? t("User '%s' unblocked") : t("User '%s' blocked"), $user[0]['username']) . EOL);
break;
}
goaway($a->get_baseurl() . '/admin/users');
return;
// NOTREACHED
}
/* get pending */
$pending = q("SELECT `register`.*, `contact`.`name`, `user`.`email`\n\t\t\t\t FROM `register`\n\t\t\t\t LEFT JOIN `contact` ON `register`.`uid` = `contact`.`uid`\n\t\t\t\t LEFT JOIN `user` ON `register`.`uid` = `user`.`uid`;");
/* get users */
$total = q("SELECT count(*) as total FROM `user` where 1");
if (count($total)) {
$a->set_pager_total($total[0]['total']);
$a->set_pager_itemspage(100);
}
$users = q("SELECT `user` . * , `contact`.`name` , `contact`.`url` , `contact`.`micro`, `lastitem`.`lastitem_date`\n\t\t\t\tFROM\n\t\t\t\t\t(SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`\n\t\t\t\t\tFROM `item`\n\t\t\t\t\tWHERE `item`.`type` = 'wall'\n\t\t\t\t\tGROUP BY `item`.`uid`) AS `lastitem`\n\t\t\t\t\t\t RIGHT OUTER JOIN `user` ON `user`.`uid` = `lastitem`.`uid`,\n\t\t\t\t\t `contact`\n\t\t\t\tWHERE\n\t\t\t\t\t `user`.`uid` = `contact`.`uid`\n\t\t\t\t\t\tAND `user`.`verified` =1\n\t\t\t\t\tAND `contact`.`self` =1\n\t\t\t\tORDER BY `contact`.`name` LIMIT %d, %d\n\t\t\t\t", intval($a->pager['start']), intval($a->pager['itemspage']));
function _setup_users($e)
{
$accounts = array(t('Normal Account'), t('Soapbox Account'), t('Community/Celebrity Account'), t('Automatic Friend Account'));
$e['page-flags'] = $accounts[$e['page-flags']];
$e['register_date'] = relative_date($e['register_date']);
$e['login_date'] = relative_date($e['login_date']);
$e['lastitem_date'] = relative_date($e['lastitem_date']);
return $e;
}
$users = array_map("_setup_users", $users);
$t = get_markup_template("admin_users.tpl");
$o = replace_macros($t, array('$title' => t('Administration'), '$page' => t('Users'), '$submit' => t('Submit'), '$select_all' => t('select all'), '$h_pending' => t('User registrations waiting for confirm'), '$th_pending' => array(t('Request date'), t('Name'), t('Email')), '$no_pending' => t('No registrations.'), '$approve' => t('Approve'), '$deny' => t('Deny'), '$delete' => t('Delete'), '$block' => t('Block'), '$unblock' => t('Unblock'), '$h_users' => t('Users'), '$th_users' => array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account')), '$confirm_delete_multi' => t('Selected users will be deleted!\\n\\nEverything these users had posted on this site will be permanently deleted!\\n\\nAre you sure?'), '$confirm_delete' => t('The user {0} will be deleted!\\n\\nEverything this user has posted on this site will be permanently deleted!\\n\\nAre you sure?'), '$baseurl' => $a->get_baseurl(), '$pending' => $pending, '$users' => $users));
$o .= paginate($a);
return $o;
}
示例12: api_graph_remove_multi
include_once "./lib/api_graph.php";
api_graph_remove_multi($graphs);
}
if (sizeof($data_sources) > 0) {
include_once "./lib/api_data_source.php";
api_data_source_remove_multi($data_sources);
}
if (sizeof($hosts) > 0) {
include_once "./lib/api_device.php";
api_device_remove_multi($hosts);
}
// tree, tree_item
db_execute("DELETE FROM graph_tree WHERE id = '" . $_SESSION["private_tree_id"] . "'");
db_execute("DELETE FROM graph_tree_items WHERE graph_tree_id = '" . $_SESSION["private_tree_id"] . "'");
// user_auth
user_remove($_SESSION["sess_user_id"]);
// logout
header("Location: logout.php");
exit;
}
}
}
}
}
/* modify for multi user end */
include "./include/top_header.php";
api_plugin_hook('console_before');
?>
<table width="100%" align="center">
<tr>
<td class="textArea">
示例13: removeuser
/**
* remove user
*/
function removeuser($dir)
{
$user = stripslashes($GLOBALS['__POST']["user"]);
if ($user == $GLOBALS['__SESSION']["s_user"]) {
show_error($GLOBALS["error_msg"]["miscselfremove"]);
}
if (!user_remove($user)) {
show_error($user . ": " . $GLOBALS["error_msg"]["deluser"]);
}
miwoftp_redirect(make_link("list", $dir, NULL));
}
示例14: form_actions
function form_actions()
{
global $user_actions, $auth_realms;
/* ================= input validation ================= */
input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)\$");
/* ==================================================== */
/* if we are to save this form, instead of display it */
if (isset($_POST["selected_items"])) {
if (get_request_var_post("drp_action") != "2") {
$selected_items = sanitize_unserialize_selected_items($_POST['selected_items']);
}
if ($selected_items != false) {
if (get_request_var_post("drp_action") == "1") {
/* delete */
for ($i = 0; $i < count($selected_items); $i++) {
user_remove($selected_items[$i]);
api_plugin_hook_function('user_remove', $selected_items[$i]);
}
}
if (get_request_var_post("drp_action") == "2") {
/* copy */
/* ================= input validation ================= */
input_validate_input_number(get_request_var_post("selected_items"));
input_validate_input_number(get_request_var_post("new_realm"));
/* ==================================================== */
$new_username = get_request_var_post("new_username");
$new_realm = get_request_var_post("new_realm", 0);
$template_user = db_fetch_row("SELECT username, realm FROM user_auth WHERE id = " . get_request_var_post("selected_items"));
$overwrite = array("full_name" => get_request_var_post("new_fullname"));
if (strlen($new_username)) {
if (sizeof(db_fetch_assoc("SELECT username FROM user_auth WHERE username = '" . $new_username . "' AND realm = " . $new_realm))) {
raise_message(19);
} else {
if (user_copy($template_user["username"], $new_username, $template_user["realm"], $new_realm, false, $overwrite) === false) {
raise_message(2);
} else {
raise_message(1);
}
}
}
}
if (get_request_var_post("drp_action") == "3") {
/* enable */
for ($i = 0; $i < count($selected_items); $i++) {
user_enable($selected_items[$i]);
}
}
if (get_request_var_post("drp_action") == "4") {
/* disable */
for ($i = 0; $i < count($selected_items); $i++) {
user_disable($selected_items[$i]);
}
}
if (get_request_var_post("drp_action") == "5") {
/* batch copy */
/* ================= input validation ================= */
input_validate_input_number(get_request_var_post("template_user"));
/* ==================================================== */
$copy_error = false;
$template = db_fetch_row("SELECT username, realm FROM user_auth WHERE id = " . get_request_var_post("template_user"));
for ($i = 0; $i < count($selected_items); $i++) {
$user = db_fetch_row("SELECT username, realm FROM user_auth WHERE id = " . $selected_items[$i]);
if (isset($user) && isset($template)) {
if (user_copy($template["username"], $user["username"], $template["realm"], $user["realm"], true) === false) {
$copy_error = true;
}
}
}
if ($copy_error) {
raise_message(2);
} else {
raise_message(1);
}
}
}
header("Location: user_admin.php");
exit;
}
/* loop through each of the users and process them */
$user_list = "";
$user_array = array();
$i = 0;
while (list($var, $val) = each($_POST)) {
if (preg_match("/^chk_([0-9]+)\$/", $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
if (get_request_var_post("drp_action") != "2") {
$user_list .= "<li>" . htmlspecialchars(db_fetch_cell("SELECT username FROM user_auth WHERE id=" . $matches[1])) . "</li>";
}
$user_array[$i] = $matches[1];
$i++;
}
}
/* Check for deleting of Graph Export User */
if (get_request_var_post("drp_action") == "1" && isset($user_array) && sizeof($user_array)) {
/* delete */
$exportuser = read_config_option('export_user_id');
if (in_array($exportuser, $user_array)) {
raise_message(22);
//.........这里部分代码省略.........
示例15: removeuser
/**
* remove user
*/
function removeuser($dir)
{
$user = stripslashes($GLOBALS['__POST']["user"]);
if ($user == $GLOBALS['__SESSION']["s_user"]) {
show_error($GLOBALS["error_msg"]["miscselfremove"]);
}
if (!user_remove($user)) {
show_error($user . ": " . $GLOBALS["error_msg"]["deluser"]);
}
header("location: " . make_link("admin", $dir, NULL));
}