本文整理汇总了PHP中user_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP user_delete函数的具体用法?PHP user_delete怎么用?PHP user_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_delete函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testRolePurchaseCheckout
public function testRolePurchaseCheckout()
{
// Add role assignment to the test product.
$rid = $this->drupalCreateRole(array('access content'));
$this->drupalLogin($this->adminUser);
$this->drupalPostForm('node/' . $this->product->id() . '/edit/features', array('feature' => 'role'), t('Add'));
$edit = array('role' => $rid, 'end_override' => TRUE, 'expire_relative_duration' => 1, 'expire_relative_granularity' => 'day');
$this->drupalPostForm(NULL, $edit, t('Save feature'));
// Check out with the test product.
$method = $this->createPaymentMethod('other');
$this->addToCart($this->product);
$order = $this->checkout();
uc_payment_enter($order->id(), $method['id'], $order->getTotal());
// Test that the role was granted.
// @todo Re-enable when Rules is available.
// $this->assertTrue($order->getOwner()->hasRole($rid), 'Existing user was granted role.');
// Test that the email is correct.
$role = Role::load($rid);
// @todo Re-enable when Rules is available.
// $this->assertMailString('subject', $role->label(), 4, 'Role assignment email mentions role in subject line.');
// Test that the role product / user relation is deleted with the user.
user_delete($order->getOwnerId());
// Run cron to ensure deleted users are handled correctly.
$this->cronRun();
}
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:25,代码来源:RoleTest.php
示例2: update_bots
public function update_bots()
{
// Update bots
if (!function_exists('user_delete')) {
include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
}
$bots_updates = array('NG-Search [Bot]' => false, 'Nutch/CVS [Bot]' => false, 'OmniExplorer [Bot]' => false, 'Seekport [Bot]' => false, 'Synoo [Bot]' => false, 'WiseNut [Bot]' => false, 'Baidu [Spider]' => 'Baiduspider', 'Exabot [Bot]' => 'Exabot', 'Voyager [Bot]' => 'voyager/', 'W3C [Validator]' => 'W3C_Validator');
foreach ($bots_updates as $bot_name => $bot_agent) {
$sql = 'SELECT user_id
FROM ' . USERS_TABLE . '
WHERE user_type = ' . USER_IGNORE . "\n\t\t\t\t\tAND username_clean = '" . $this->db->sql_escape(utf8_clean_string($bot_name)) . "'";
$result = $this->db->sql_query($sql);
$bot_user_id = (int) $this->db->sql_fetchfield('user_id');
$this->db->sql_freeresult($result);
if ($bot_user_id) {
if ($bot_agent === false) {
$sql = 'DELETE FROM ' . BOTS_TABLE . "\n\t\t\t\t\t\tWHERE user_id = {$bot_user_id}";
$this->sql_query($sql);
user_delete('retain', $bot_user_id);
} else {
$sql = 'UPDATE ' . BOTS_TABLE . "\n\t\t\t\t\t\tSET bot_agent = '" . $this->db->sql_escape($bot_agent) . "'\n\t\t\t\t\t\tWHERE user_id = {$bot_user_id}";
$this->sql_query($sql);
}
}
}
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:26,代码来源:bot_update.php
示例3: deleteUsers
/**
* Deletes a given list of users.
*
* @param array $uids
* An indexed array of user IDs to delete.
*/
protected function deleteUsers(array $uids = array())
{
foreach ($uids as $uid) {
$this->reassignFiles($uid);
user_delete($uid);
}
}
开发者ID:robtryson,项目名称:nysits,代码行数:13,代码来源:AcsfDuplicationScrubUserHandler.php
示例4: testFilePurchaseCheckout
public function testFilePurchaseCheckout()
{
// Add file download feature to the test product.
$filename = $this->getTestFile();
$this->drupalLogin($this->adminUser);
$this->drupalPostForm('node/' . $this->product->id() . '/edit/features', array('feature' => 'file'), t('Add'));
$edit = array('uc_file_model' => '', 'uc_file_filename' => $filename);
$this->drupalPostForm(NULL, $edit, t('Save feature'));
// Check out with the test product.
$method = $this->createPaymentMethod('other');
$this->addToCart($this->product);
$order = $this->checkout();
uc_payment_enter($order->id(), $method['id'], $order->getTotal());
// Test that the file was granted.
// @todo Re-enable when Rules is available.
// $this->assertTrue($order->getUser()->hasFile($filename), 'Existing user was granted file.');
// Test that the email is correct.
// $file = entity_load('user_file', $fid);
// @todo Re-enable when Rules is available.
// $this->assertMailString('subject', $file->label(), 4, 'File assignment email mentions file in subject line.');
// Delete the user.
user_delete($order->getOwnerId());
// Run cron to ensure deleted users are handled correctly.
$this->cronRun();
}
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:25,代码来源:FileTest.php
示例5: bots
/**
* Reset all bots
*/
function bots($error)
{
global $config, $db;
if (isset($_POST['yes'])) {
$sql = 'SELECT group_id, group_colour
FROM ' . GROUPS_TABLE . "\n\t\t\t\tWHERE group_name = 'BOTS'";
$result = $db->sql_query($sql);
$group_id = (int) $db->sql_fetchfield('group_id', false, $result);
$group_colour = $db->sql_fetchfield('group_colour', 0, $result);
$db->sql_freeresult($result);
if (!$group_id) {
// If we reach this point then something has gone very wrong
$error[] = 'NO_BOT_GROUP';
return $error;
} else {
if (!function_exists('user_add')) {
include PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT;
}
// Remove existing bots
$uids = array();
$sql = 'SELECT user_id FROM ' . BOTS_TABLE;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$uids[] = $row['user_id'];
}
$db->sql_freeresult($result);
if (!empty($uids)) {
// Remove all the bots
foreach ($uids as $uid) {
user_delete('remove', $uid);
}
// Clear out the bots table
$db->sql_query('DELETE FROM ' . BOTS_TABLE);
}
// Add the bots
foreach ($this->db_cleaner->data->bots as $bot_name => $bot_ary) {
/* Clean the users table of any bots matching this...
* this is an issue if a default bot was removed from the bots group. */
$username_clean = utf8_clean_string($bot_name);
if (empty($username_clean)) {
// This shouldn't happen but we should handle it anyway...
continue;
}
$sql = 'DELETE FROM ' . USERS_TABLE . ' WHERE username_clean = \'' . $db->sql_escape($username_clean) . '\'';
$db->sql_query($sql);
// `$bot_ary` can be false, if a bot was removed in a certain phpBB version
if ($bot_ary === false) {
continue;
}
$user_row = array('user_type' => USER_IGNORE, 'group_id' => $group_id, 'username' => $bot_name, 'user_regdate' => time(), 'user_password' => '', 'user_colour' => $group_colour, 'user_email' => '', 'user_lang' => $config['default_lang'], 'user_style' => 1, 'user_timezone' => 0, 'user_dateformat' => $config['default_dateformat'], 'user_allow_massemail' => 0);
$user_id = user_add($user_row);
if ($user_id) {
$sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array('bot_active' => 1, 'bot_name' => (string) $bot_name, 'user_id' => (int) $user_id, 'bot_agent' => (string) $bot_ary[0], 'bot_ip' => (string) $bot_ary[1]));
$result = $db->sql_query($sql);
}
}
}
}
}
开发者ID:melvingb,项目名称:phpbb3.1-STK,代码行数:62,代码来源:database_cleaner_controller.php
示例6: hook_mandrill_mailsend_result
/**
* Allow other modules to respond to the result of sending an email.
*
* @param array $result
* Associative array containing the send result, including the status.
*/
function hook_mandrill_mailsend_result($result)
{
if ($result['status'] == 'rejected') {
// Delete user.
$user = user_load_by_mail($result['email']);
user_delete($user->uid);
}
}
开发者ID:isaenkov,项目名称:Dru.io,代码行数:14,代码来源:mandrill.api.php
示例7: user_delete_unwanted
function user_delete_unwanted()
{
db_delete('user', '(`authorized`=0) AND (`timestamp`<=' . time() - config_get('confirm_authorize_timeout') . ')');
$q = db_select('user', array('id'), '(`last_act`>0) AND (`last_act`<' . (time() - config_get('user-lifetime')) . ') AND (`id`!=1)');
while ($r = db_row($q)) {
user_delete($r['id']);
}
}
开发者ID:Nazg-Gul,项目名称:gate,代码行数:8,代码来源:user.php
示例8: delete_contact
function delete_contact()
{
if (check_rights('delete_contact')) {
$user_id = $_GET['contact'];
user_delete('retain', $user_id);
header("location: /manager.php?action=list_contacts");
return $html;
} else {
return "Нет соответствующих прав.<br/>";
}
}
开发者ID:jsib,项目名称:intranet,代码行数:11,代码来源:delete_contact.php
示例9: user_merge
/**
* Merge two user accounts into one
*
* @author eviL3
* @param int $old_user User id of the old user
* @param int $new_user User id of the new user
*
* @return void
*/
function user_merge($old_user, $new_user)
{
global $user, $db;
if (!function_exists('user_add')) {
global $phpbb_root_path, $phpEx;
include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
}
$old_user = (int) $old_user;
$new_user = (int) $new_user;
// Update postcount
$total_posts = 0;
// Add up the total number of posts for both...
$sql = 'SELECT user_posts
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', array($old_user, $new_user));
$result = $db->sql_query($sql);
while ($return = $db->sql_fetchrow($result)) {
$total_posts = $total_posts + (int) $return['user_posts'];
}
$db->sql_freeresult($result);
// Now set the new user to have the total amount of posts. ;)
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array('user_posts' => $total_posts)) . ' WHERE user_id = ' . $new_user);
// Get both users userdata
$data = array();
foreach (array($old_user, $new_user) as $key) {
$sql = 'SELECT user_id, username, user_colour
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $key;
$result = $db->sql_query($sql);
$data[$key] = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
}
$update_ary = array(ATTACHMENTS_TABLE => array('poster_id'), FORUMS_TABLE => array(array('forum_last_poster_id', 'forum_last_poster_name', 'forum_last_poster_colour')), LOG_TABLE => array('user_id', 'reportee_id'), MODERATOR_CACHE_TABLE => array(array('user_id', 'username')), POSTS_TABLE => array(array('poster_id', 'post_username'), 'post_edit_user'), POLL_VOTES_TABLE => array('vote_user_id'), PRIVMSGS_TABLE => array('author_id', 'message_edit_user'), PRIVMSGS_TO_TABLE => array('user_id', 'author_id'), REPORTS_TABLE => array('user_id'), TOPICS_TABLE => array(array('topic_poster', 'topic_first_poster_name', 'topic_first_poster_colour'), array('topic_last_poster_id', 'topic_last_poster_name', 'topic_last_poster_colour')));
foreach ($update_ary as $table => $field_ary) {
foreach ($field_ary as $field) {
$sql_ary = array();
if (!is_array($field)) {
$field = array($field);
}
$sql_ary[$field[0]] = $new_user;
if (!empty($field[1])) {
$sql_ary[$field[1]] = $data[$new_user]['username'];
}
if (!empty($field[2])) {
$sql_ary[$field[2]] = $data[$new_user]['user_colour'];
}
$primary_field = $field[0];
$sql = "UPDATE {$table} SET " . $db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\t\tWHERE {$primary_field} = {$old_user}";
$db->sql_query($sql);
}
}
user_delete('remove', $old_user);
}
开发者ID:phpbbmodders-30x-mods,项目名称:modders-libs,代码行数:62,代码来源:functions_user_merge.php
示例10: main
public function main($id, $mode)
{
global $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
global $request, $phpbb_container, $phpbb_log;
$user->add_lang_ext('jv/deletemyregistration', 'ucp');
$error = array();
$submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST);
$delete_acc = $request->variable('delete_acc', false, false, \phpbb\request\request_interface::POST);
$delete_post = $request->variable('delete_post', false, false, \phpbb\request\request_interface::POST) && $auth->acl_get('u_my_acc_post_delete') ? true : false;
$user_password = $request->variable('user_password', '', true);
add_form_key('my_acc_delete');
if ($submit) {
if (!check_form_key('my_acc_delete')) {
$error[] = 'FORM_INVALID';
}
if (!$delete_acc) {
$error[] = 'MY_ACC_DELETE_CONFIRM_ERROR';
}
if ($user->data['user_type'] == USER_FOUNDER) {
$error[] = 'MY_ACC_DELETE_FOUNDER_ERROR';
}
// Instantiate passwords manager
$passwords_manager = $phpbb_container->get('passwords.manager');
if (!$passwords_manager->check($user_password, $user->data['user_password'])) {
$error[] = 'CUR_PASSWORD_ERROR';
}
if (!sizeof($error) && $submit) {
$delete_type = $delete_post ? 'remove' : 'retain';
$log_type = $delete_post ? 'LOG_MY_ACC_POST_DELETE' : 'LOG_MY_ACC_DELETE';
$additional_data = array('reportee_id' => 0, $user->data['username']);
$phpbb_log->add('user', ANONYMOUS, $user->ip, $log_type, time(), $additional_data);
user_delete($delete_type, $user->data['user_id'], $user->data['username']);
meta_refresh(5, append_sid($phpbb_root_path . 'index.' . $phpEx));
trigger_error('MY_ACC_DELETE_SUCCESS');
}
// Replace "error" strings with their real, localised form
$error = array_map(array($user, 'lang'), $error);
}
$template->assign_vars(array('S_ERROR' => sizeof($error) ? true : false, 'S_DELETE_MY_POST' => $auth->acl_get('u_my_acc_post_delete') ? true : false, 'S_UCP_ACTION' => $this->u_action, 'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], 'ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'CONFIRM_CHECKED' => $delete_acc ? ' checked="checked"' : '', 'POST_CHECKED' => $delete_post ? ' checked="checked"' : ''));
// Set desired template
$this->tpl_name = 'ucp_profile_' . $mode;
$this->page_title = 'UCP_PROFILE_' . strtoupper($mode);
}
开发者ID:cracknel,项目名称:ubuntudanmark.dk,代码行数:43,代码来源:delete_my_registration_module.php
示例11: ucp_profile_reg_details_data
/**
* Delete the user
*
* @param type $event
*/
public function ucp_profile_reg_details_data($event)
{
$this->user->add_lang(array('acp/common', 'acp/users'));
$delete_type = request_var('delete_type', '');
$this->template->assign_vars(array('AUTH_DELETE_POSTS' => $this->auth->acl_get('u_self_delete_posts') ? true : false));
if ($event['submit'] && $delete_type) {
if ($this->user->data['user_type'] == USER_FOUNDER) {
$this->error[] = 'CANNOT_REMOVE_FOUNDER';
}
if (!sizeof($this->error)) {
if (confirm_box(true)) {
$delete_type = $this->auth->acl_get('u_self_delete_posts') ? $delete_type : 'remove';
user_delete($delete_type, $this->user->data['user_id'], $this->user->data['username']);
add_log('admin', 'LOG_USER_DELETED', $this->user->data['username']);
trigger_error($this->user->lang['USER_DELETED'] . '<br /><br />' . sprintf($this->user->lang['RETURN_INDEX'], '<a href="' . generate_board_url() . '">', '</a>'));
} else {
confirm_box(false, $this->user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('delete' => 1, 'form_token' => $this->request->variable('form_token', ''), 'submit' => true, 'cur_password' => $this->request->variable('cur_password', '', true), 'delete_type' => $delete_type)));
}
}
}
}
开发者ID:rinsrans,项目名称:phpBB-selfdelete,代码行数:26,代码来源:listener.php
示例12: test_user_delete
public function test_user_delete()
{
// Check that user is linked
$sql = 'SELECT ot.user_id AS user_id
FROM phpbb_oauth_accounts oa, phpbb_oauth_tokens ot
WHERE oa.user_id = 2
AND ot.user_id = oa.user_id';
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
$this->assertEquals(array('user_id' => '2'), $row);
// user_delete() should return false
$this->assertFalse(user_delete('remove', array(2)));
// Make sure user link was removed
$sql = 'SELECT ot.user_id AS user_id
FROM phpbb_oauth_accounts oa, phpbb_oauth_tokens ot
WHERE oa.user_id = 2
AND ot.user_id = oa.user_id';
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
$this->assertEmpty($row);
}
开发者ID:ZerGabriel,项目名称:phpbb,代码行数:23,代码来源:user_delete_test.php
示例13: main
//.........这里部分代码省略.........
case 'overview':
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
$user->add_lang('acp/ban');
$delete = request_var('delete', 0);
$delete_type = request_var('delete_type', '');
$ip = request_var('ip', 'ip');
if ($submit)
{
// You can't delete the founder
if ($delete && $user_row['user_type'] != USER_FOUNDER)
{
if (!$auth->acl_get('a_userdel'))
{
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}
// Check if the user wants to remove himself or the guest user account
if ($user_id == ANONYMOUS)
{
trigger_error($user->lang['CANNOT_REMOVE_ANONYMOUS'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}
if ($user_id == $user->data['user_id'])
{
trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}
if (confirm_box(true))
{
user_delete($delete_type, $user_id, $user_row['username']);
add_log('admin', 'LOG_USER_DELETED', $user_row['username']);
trigger_error($user->lang['USER_DELETED'] . adm_back_link($this->u_action));
}
else
{
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
'u' => $user_id,
'i' => $id,
'mode' => $mode,
'action' => $action,
'update' => true,
'delete' => 1,
'delete_type' => $delete_type))
);
}
}
// Handle quicktool actions
switch ($action)
{
case 'banuser':
case 'banemail':
case 'banip':
if ($user_id == $user->data['user_id'])
{
trigger_error($user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}
if ($user_row['user_type'] == USER_FOUNDER)
{
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:acp_users.php
示例14: thread_update
thread_update($tid, array('fid' => $newfid));
$arr = array('uid' => $uid, 'tid' => $thread['tid'], 'pid' => $thread['firstpid'], 'subject' => $thread['subject'], 'comment' => '', 'create_date' => $time, 'action' => 'move');
modlog_create($arr);
}
}
message(0, '移动完成');
}
}
} elseif ($action == 'deleteuser') {
$_uid = param(2, 0);
$method != 'POST' and message(-1, 'Method error');
empty($group['allowdeleteuser']) and message(-1, '您无权删除用户');
$u = user_read($_uid);
empty($u) and message(-1, '用户不存在或者已经被删除。');
$u['gid'] < 6 and message(-1, '不允许删除管理组,请先调整用户用户组。');
$r = user_delete($_uid);
$r === FALSE ? message(-1, '删除失败') : message(0, '删除成功');
} elseif ($action == 'banip') {
$method != 'POST' and message(-1, 'Method error');
$_ip = xn_urldecode(param(2));
empty($_ip) and message(-1, 'IP 为空');
$_ip = long2ip(ip2long($_ip));
// 安全过滤
$day = intval(xn_urldecode(param(3)));
empty($group['allowbanuser']) and message(-1, '您无权禁止 IP');
$arr = explode('.', $_ip);
$arr[0] == '0' and message(-1, 'IP 地址不能以 0 开头。');
$banip = banip_read_by_ip($_ip);
if ($day == -1) {
$r = banip_delete($banip['banid']);
} else {
开发者ID:xianyuxmu,项目名称:alinkagarden-xiuno,代码行数:31,代码来源:mod.php
示例15: test_delete_user_id_data
/**
* @dataProvider delete_user_id_data
*/
public function test_delete_user_id_data($mode, $cleaned_tables)
{
$this->assertFalse(user_delete($mode, 2));
foreach ($cleaned_tables as $table) {
$sql = 'SELECT user_id
FROM ' . $table . '
WHERE user_id = 2';
$result = $this->db->sql_query($sql);
$this->assertFalse($this->db->sql_fetchfield('user_id'), 'Found data for deleted user in table: ' . $table);
$this->db->sql_freeresult($result);
$sql = 'SELECT user_id
FROM ' . $table . '
WHERE user_id = 3';
$result = $this->db->sql_query($sql);
$this->assertEquals(3, $this->db->sql_fetchfield('user_id'), 'Missing data for user in table: ' . $table);
$this->db->sql_freeresult($result);
}
}
开发者ID:hgchen,项目名称:phpbb,代码行数:21,代码来源:delete_user_test.php
示例16: main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
$user->add_lang('memberlist');
$action = request_var('action', '');
$mark = isset($_REQUEST['mark']) ? request_var('mark', array(0)) : array();
$start = request_var('start', 0);
$submit = isset($_POST['submit']);
// Sort keys
$sort_days = request_var('st', 0);
$sort_key = request_var('sk', 'i');
$sort_dir = request_var('sd', 'd');
$form_key = 'acp_inactive';
add_form_key($form_key);
if ($submit && sizeof($mark)) {
if ($action !== 'delete' && !check_form_key($form_key)) {
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
}
switch ($action) {
case 'activate':
case 'delete':
$sql = 'SELECT user_id, username
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', $mark);
$result = $db->sql_query($sql);
$user_affected = array();
while ($row = $db->sql_fetchrow($result)) {
$user_affected[$row['user_id']] = $row['username'];
}
$db->sql_freeresult($result);
if ($action == 'activate') {
if ($config['require_activation'] == USER_ACTIVATION_ADMIN) {
// Get those 'being activated'...
$sql = 'SELECT user_id, username, user_email, user_lang
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', $mark) . '
AND user_type = ' . USER_INACTIVE;
$result = $db->sql_query($sql);
$inactive_users = array();
while ($row = $db->sql_fetchrow($result)) {
$inactive_users[] = $row;
}
$db->sql_freeresult($result);
}
user_active_flip('activate', $mark);
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !empty($inactive_users)) {
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger();
foreach ($inactive_users as $row) {
$messenger->template('admin_welcome_activated', $row['user_lang']);
$messenger->to($row['user_email'], $row['username']);
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($row['username'])));
$messenger->send(NOTIFY_EMAIL);
}
$messenger->save_queue();
}
} else {
if ($action == 'delete') {
if (confirm_box(true)) {
if (!$auth->acl_get('a_userdel')) {
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
foreach ($mark as $user_id) {
user_delete('retain', $user_id, $user_affected[$user_id]);
}
add_log('admin', 'LOG_INACTIVE_' . strtoupper($action), implode(', ', $user_affected));
} else {
$s_hidden_fields = array('mode' => $mode, 'action' => $action, 'mark' => $mark, 'submit' => 1, 'start' => $start);
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields));
}
}
}
break;
case 'remind':
if (empty($config['email_enable'])) {
trigger_error($user->lang['EMAIL_DISABLED'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', $mark) . '
AND user_inactive_reason';
$sql .= $config['require_activation'] == USER_ACTIVATION_ADMIN ? ' = ' . INACTIVE_REMIND : ' <> ' . INACTIVE_MANUAL;
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result)) {
// Send the messages
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger();
$usernames = array();
do {
$messenger->template('user_remind_inactive', $row['user_lang']);
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
//.........这里部分代码省略.........
开发者ID:html,项目名称:PI,代码行数:101,代码来源:acp_inactive.php
示例17: testTemporaryUser
/**
* Tests that the details page displays correctly for a temporary user.
*/
public function testTemporaryUser()
{
// Create a temporary user.
$tempuser = $this->drupalCreateUser();
$tempuser_uid = $tempuser->id();
// Log in as the admin user.
$this->drupalLogin($this->adminUser);
// Generate a single watchdog entry.
$this->generateLogEntries(1, array('user' => $tempuser, 'uid' => $tempuser_uid));
$wid = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchField();
// Check if the full message displays on the details page.
$this->drupalGet('admin/reports/dblog/event/' . $wid);
$this->assertText('Dblog test log message');
// Delete the user.
user_delete($tempuser->id());
$this->drupalGet('user/' . $tempuser_uid);
$this->assertResponse(404);
// Check if the full message displays on the details page.
$this->drupalGet('admin/reports/dblog/event/' . $wid);
$this->assertText('Dblog test log message');
}
开发者ID:318io,项目名称:318-io,代码行数:24,代码来源:DbLogTest.php
示例18: auth_ensure_user_authenticated
auth_ensure_user_authenticated();
current_user_ensure_unprotected();
# Only allow users to delete their own accounts if allow_account_delete = ON or
# the user has permission to manage user accounts.
if (OFF == config_get('allow_account_delete') && !access_has_global_level(config_get('manage_user_threshold'))) {
print_header_redirect('account_page.php');
}
# check that we are not deleting the last administrator account
$t_admin_threshold = config_get_global('admin_site_threshold');
if (current_user_is_administrator() && user_count_level($t_admin_threshold) <= 1) {
trigger_error(ERROR_USER_CHANGE_LAST_ADMIN, ERROR);
}
helper_ensure_confirmed(lang_get('confirm_delete_msg'), lang_get('delete_account_button'));
form_security_purge('account_delete');
$t_user_id = auth_get_current_user_id();
auth_logout();
user_delete($t_user_id);
html_page_top1();
html_page_top2a();
?>
<br />
<div align="center">
<?php
echo lang_get('account_removed_msg') . '<br />';
print_bracket_link(config_get('logout_redirect_page'), lang_get('proceed'));
?>
</div>
<?php
html_page_bottom1a();
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:31,代码来源:account_delete.php
示例19: prune_users
/**
* Prune users
*/
function prune_users($id, $mode)
{
global $db, $user, $auth, $template, $cache, $phpbb_log, $request;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container;
/** @var \phpbb\group\helper $group_helper */
$group_helper = $phpbb_container->get('group_helper');
$user->add_lang('memberlist');
$prune = isset($_POST['prune']) ? true : false;
if ($prune) {
$action = $request->variable('action', 'deactivate');
$deleteposts = $request->variable('deleteposts', 0);
if (confirm_box(true)) {
$user_ids = $usernames = array();
$this->get_prune_users($user_ids, $usernames);
if (sizeof($user_ids)) {
if ($action == 'deactivate') {
user_active_flip('deactivate', $user_ids);
$l_log = 'LOG_PRUNE_USER_DEAC';
} else {
if ($action == 'delete') {
if ($deleteposts) {
user_delete('remove', $user_ids);
$l_log = 'LOG_PRUNE_USER_DEL_DEL';
} else {
user_delete('retain', $user_ids, true);
$l_log = 'LOG_PRUNE_USER_DEL_ANON';
}
}
}
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, $l_log, false, array(implode(', ', $usernames)));
$msg = $user->lang['USER_' . strtoupper($action) . '_SUCCESS'];
} else {
$msg = $user->lang['USER_PRUNE_FAILURE'];
}
trigger_error($msg . adm_back_link($this->u_action));
} else {
// We list the users which will be pruned...
$user_ids = $usernames = array();
$this->get_prune_users($user_ids, $usernames);
if (!sizeof($user_ids)) {
trigger_error($user->lang['USER_PRUNE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
// Assign to template
foreach ($user_ids as $user_id) {
$template->assign_block_vars('users', array('USERNAME' => $usernames[$user_id], 'USER_ID' => $user_id, 'U_PROFILE' => get_username_string('profile', $user_id, $usernames[$user_id]), 'U_USER_ADMIN' => $auth->acl_get('a_user') ? append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : ''));
}
$template->assign_vars(array('S_DEACTIVATE' => $action == 'deactivate' ? true : false, 'S_DELETE' => $action == 'delete' ? true : false));
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('i' => $id, 'mode' => $mode, 'prune' => 1, 'deleteposts' => $request->variable('deleteposts', 0), 'action' => $request->variable('action', ''))), 'confirm_body_prune.html');
}
}
$find_count = array('lt' => $user->lang['LESS_THAN'], 'eq' => $user->lang['EQUAL_TO'], 'gt' => $user->lang['MORE_THAN']);
$s_find_count = '';
foreach ($find_count as $key => $value) {
$selected = $key == 'eq' ? ' selected="selected"' : '';
$s_find_count .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
$find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']);
$s_find_active_time = '';
foreach ($find_time as $key => $value) {
$s_find_active_time .= '<option value="' . $key . '">' . $value . '</option>';
}
$sql = 'SELECT group_id, group_name
FROM ' . GROUPS_TABLE . '
WHERE group_type <> ' . GROUP_SPECIAL . '
ORDER BY group_name ASC';
$result = $db->sql_query($sql);
$s_group_list = '';
while ($row = $db->sql_fetchrow($result)) {
$s_group_list .= '<option value="' . $row['group_id'] . '">' . $group_helper->get_name($row['group_name']) . '</option>';
}
$db->sql_freeresult($result);
if ($s_group_list) {
// Only prepend the "All groups" option if there are groups,
// otherwise we don't want to display this option at all.
$s_group_list = '<option value="0">' . $user->lang['PRUNE_USERS_GROUP_NONE'] . '</option>' . $s_group_list;
}
$template->assign_vars(array('U_ACTION' => $this->u_action, 'S_ACTIVE_OPTIONS' => $s_find_active_time, 'S_GROUP_LIST' => $s_group_list, 'S_COUNT_OPTIONS' => $s_find_count, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&form=acp_prune&field=users')));
}
开发者ID:hgchen,项目名称:phpbb,代码行数:81,代码来源:acp_prune.php
示例20: user_activate
if ($row['user_status'] != STATUS_ACTIVE) {
user_activate($id);
}
break;
case 'delete':
if (display_confirmation()) {
$sql = 'SELECT user_id, user_type
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $id;
$result = $_CLASS['core_db']->query($sql);
$row = $_CLASS['core_db'] > fetch_row_assoc($result);
$_CLASS['core_db']->free_result($result);
if ($row['user_type'] != USER_BOT) {
break;
}
user_delete($id);
trigger_error($_CLASS['core_user']->
|
请发表评论