本文整理汇总了PHP中messenger::send方法的典型用法代码示例。如果您正苦于以下问题:PHP messenger::send方法的具体用法?PHP messenger::send怎么用?PHP messenger::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messenger
的用法示例。
在下文中一共展示了messenger::send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template, $phpbb_container;
if (!$config['allow_password_reset']) {
trigger_error($user->lang('UCP_PASSWORD_RESET_DISABLED', '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'));
}
$username = request_var('username', '', true);
$email = strtolower(request_var('email', ''));
$submit = isset($_POST['submit']) ? true : false;
if ($submit) {
$sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row) {
trigger_error('NO_EMAIL_USER');
}
if ($user_row['user_type'] == USER_IGNORE) {
trigger_error('NO_USER');
}
if ($user_row['user_type'] == USER_INACTIVE) {
if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
trigger_error('ACCOUNT_DEACTIVATED');
} else {
trigger_error('ACCOUNT_NOT_ACTIVATED');
}
}
// Check users permissions
$auth2 = new \phpbb\auth\auth();
$auth2->acl($user_row);
if (!$auth2->acl_get('u_chgpasswd')) {
trigger_error('NO_AUTH_PASSWORD_REMINDER');
}
$server_url = generate_board_url();
// Make password at least 8 characters long, make it longer if admin wants to.
// gen_rand_string() however has a limit of 12 or 13.
$user_password = gen_rand_string_friendly(max(8, mt_rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars'])));
// For the activation key a random length between 6 and 10 will do.
$user_actkey = gen_rand_string(mt_rand(6, 10));
// Instantiate passwords manager
$passwords_manager = $phpbb_container->get('passwords.manager');
$sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape($passwords_manager->hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
$db->sql_query($sql);
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$messenger->template('user_activate_passwd', $user_row['user_lang']);
$messenger->set_addresses($user_row);
$messenger->anti_abuse_headers($config, $user);
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
$messenger->send($user_row['user_notify_type']);
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
$message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
trigger_error($message);
}
$template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
$this->tpl_name = 'ucp_remind';
$this->page_title = 'UCP_REMIND';
}
示例2: ucp_register_user_row_after
public function ucp_register_user_row_after($event)
{
if ($this->config['require_activation'] != USER_ACTIVATION_ADMIN) {
// Grab an array of user_id's with a_user permissions ... these users can activate a user
$admin_ary = $this->auth->acl_get_list(false, 'a_user', false);
$admin_ary = !empty($admin_ary[0]['a_user']) ? $admin_ary[0]['a_user'] : array();
// Also include founders
$where_sql = ' WHERE user_type = ' . USER_FOUNDER;
if (sizeof($admin_ary)) {
$where_sql .= ' OR ' . $this->db->sql_in_set('user_id', $admin_ary);
}
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
FROM ' . USERS_TABLE . ' ' . $where_sql;
$result = $this->db->sql_query($sql);
$data = array('username' => $this->request->variable('username', '', true), 'email' => strtolower($this->request->variable('email', '')), 'user_regdate' => time(), 'user_ip' => $this->user->ip, 'lang' => basename($this->request->variable('lang', $this->user->lang_name)));
while ($row = $this->db->sql_fetchrow($result)) {
if (!class_exists('messenger')) {
include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
}
$messenger = new \messenger(false);
$server_url = generate_board_url();
$messenger->template('@dmzx_notifyadmin/admin_notify_registered', $data['lang']);
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($data['username']), 'USER_MAIL' => $data['email'], 'USER_REGDATE' => date($this->config['default_dateformat'], $data['user_regdate']), 'USER_IP' => $data['user_ip']));
$messenger->send(NOTIFY_EMAIL);
}
$this->db->sql_freeresult($result);
}
}
示例3: main
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template;
$user_id = request_var('u', 0);
$key = request_var('k', '');
$sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey, user_inactive_reason
FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_id = {$user_id}";
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row) {
trigger_error('NO_USER');
}
if ($user_row['user_type'] != USER_INACTIVE && !$user_row['user_newpasswd']) {
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
trigger_error('ALREADY_ACTIVATED');
}
if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL || $user_row['user_actkey'] != $key) {
trigger_error('WRONG_ACTIVATION');
}
$update_password = $user_row['user_newpasswd'] ? true : false;
if ($update_password) {
$sql_ary = array('user_actkey' => '', 'user_password' => $user_row['user_newpasswd'], 'user_newpasswd' => '', 'user_pass_convert' => 0, 'user_login_attempts' => 0);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user_row['user_id'];
$db->sql_query($sql);
}
if (!$update_password) {
include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
user_active_flip('activate', $user_row['user_id']);
$sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_actkey = ''\n\t\t\t\tWHERE user_id = {$user_row['user_id']}";
$db->sql_query($sql);
}
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) {
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$messenger->template('admin_welcome_activated', $user_row['user_lang']);
$messenger->to($user_row['user_email'], $user_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($user_row['username'])));
$messenger->send($user_row['user_notify_type']);
$message = 'ACCOUNT_ACTIVE_ADMIN';
} else {
if (!$update_password) {
$message = $user_row['user_inactive_reason'] == INACTIVE_PROFILE ? 'ACCOUNT_ACTIVE_PROFILE' : 'ACCOUNT_ACTIVE';
} else {
$message = 'PASSWORD_ACTIVATED';
}
}
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
trigger_error($user->lang[$message]);
}
示例4: main
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template;
$username = request_var('username', '', true);
$email = strtolower(request_var('email', ''));
$submit = isset($_POST['submit']) ? true : false;
if ($submit) {
$sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email = '" . $db->sql_escape($email) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row) {
trigger_error('NO_EMAIL_USER');
}
if ($user_row['user_type'] == USER_IGNORE) {
trigger_error('NO_USER');
}
if ($user_row['user_type'] == USER_INACTIVE) {
if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
trigger_error('ACCOUNT_DEACTIVATED');
} else {
trigger_error('ACCOUNT_NOT_ACTIVATED');
}
}
// Check users permissions
$auth2 = new auth();
$auth2->acl($user_row);
if (!$auth2->acl_get('u_chgpasswd')) {
trigger_error('NO_AUTH_PASSWORD_REMINDER');
}
$server_url = generate_board_url();
$key_len = 54 - strlen($server_url);
$key_len = max(6, $key_len);
// we want at least 6
$key_len = $config['max_pass_chars'] ? min($key_len, $config['max_pass_chars']) : $key_len;
// we want at most $config['max_pass_chars']
$user_actkey = substr(gen_rand_string(10), 0, $key_len);
$user_password = gen_rand_string(8);
$sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
$db->sql_query($sql);
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$messenger->template('user_activate_passwd', $user_row['user_lang']);
$messenger->to($user_row['user_email'], $user_row['username']);
$messenger->im($user_row['user_jabber'], $user_row['username']);
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
$messenger->send($user_row['user_notify_type']);
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
$message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
trigger_error($message);
}
$template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
$this->tpl_name = 'ucp_remind';
$this->page_title = 'UCP_REMIND';
}
示例5: main
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template;
$user_id = request_var('u', 0);
$key = request_var('k', '');
$sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey
FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_id = {$user_id}";
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row) {
trigger_error('NO_USER');
}
if ($user_row['user_type'] != USER_INACTIVE && !$user_row['user_newpasswd']) {
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
trigger_error('ALREADY_ACTIVATED');
}
if ($user_row['user_actkey'] != $key) {
trigger_error('WRONG_ACTIVATION');
}
$update_password = $user_row['user_newpasswd'] ? true : false;
if ($update_password) {
$sql_ary = array('user_type' => USER_NORMAL, 'user_actkey' => '', 'user_password' => $user_row['user_newpasswd'], 'user_newpasswd' => '');
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user_row['user_id'];
$db->sql_query($sql);
}
if (!$update_password) {
include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
// Now we need to demote the user from the inactive group and add him to the registered group
user_active_flip($user_row['user_id'], $user_row['user_type'], '', $user_row['username'], true);
// Update last username
update_last_username();
set_config('num_users', $config['num_users'] + 1, true);
}
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) {
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$messenger->template('admin_welcome_activated', $user_row['user_lang']);
$messenger->replyto($config['board_contact']);
$messenger->to($user_row['user_email'], $user_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('SITENAME' => $config['sitename'], 'USERNAME' => html_entity_decode($user_row['username']), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig'])));
$messenger->send($user_row['user_notify_type']);
$message = 'ACCOUNT_ACTIVE_ADMIN';
} else {
$message = !$update_password ? 'ACCOUNT_ACTIVE' : 'PASSWORD_ACTIVATED';
}
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
trigger_error($user->lang[$message]);
}
示例6: testSend
public function testSend()
{
$content = array('vcode' => rand(1000, 9999));
$sendTo['sms'] = array('13816351212');
$sendTo['email'] = array("test@shopex.cn");
$m = messenger::send($sendTo, 'account-member', $content);
if ($m['rsp'] == "fail") {
echo $m['err_msg'];
}
echo "加入队列成功";
}
示例7: run
/**
* Runs this cron task.
*
* @return null
*/
public function run()
{
$time = $this->user->create_datetime();
$now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
// Display birthdays of 29th february on 28th february in non-leap-years
$leap_year_birthdays = '';
if ($now['mday'] == 28 && $now['mon'] == 2 && !$time->format('L')) {
$leap_year_birthdays = ' OR user_birthday LIKE "' . $this->db->sql_escape(sprintf("%2d-%2d-", 29, 2)) . '%"';
}
$sql = 'SELECT user_id, username, user_email, user_lang,
YEAR(CURRENT_TIMESTAMP) - YEAR(str_to_date(user_birthday, "%d-%m-%Y")) AS age
FROM ' . USERS_TABLE . '
WHERE user_birthday <> " 0- 0- 0" AND user_birthday <> "" AND
(user_birthday LIKE "' . $this->db->sql_escape(sprintf("%2d-%2d-", $now["mday"], $now["mon"])) . '%"' . $leap_year_birthdays . ') AND
email_on_birthday + 15778463 < UNIX_TIMESTAMP(now())';
$result = $this->db->sql_query($sql);
$msg_list = array();
while ($row = $this->db->sql_fetchrow($result)) {
$msg_list[] = array('user_id' => $row['user_id'], 'name' => $row['username'], 'email' => $row['user_email'], 'lang' => $row['user_lang'], 'age' => $this->convertNumber($row['age']) . $this->text_number($row['age']), 'time' => time());
}
if (sizeof($msg_list)) {
if ($this->config['email_enable']) {
if (!class_exists('messenger')) {
include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
}
$server_url = generate_board_url();
$messenger = new \messenger(false);
foreach ($msg_list as $key => $value) {
$messenger->template('@forumhulp_emailonbirthday/emailonbirthday', $value['lang']);
$messenger->to($value['email'], $value['name']);
$messenger->headers('X-AntiAbuse: Board servername - ' . $this->config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $value['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $value['name']);
$messenger->headers('X-AntiAbuse: User IP - ' . '127.0.0.1');
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($value['name']), 'BIRTHDAY' => $value['age'], 'SITENAME' => $this->config['sitename']));
$messenger->send(NOTIFY_EMAIL);
$sql = 'UPDATE ' . USERS_TABLE . ' SET email_on_birthday = ' . time() . ' WHERE user_id = ' . $value['user_id'];
$this->db->sql_query($sql);
}
$userlist = array_map(function ($entry) {
return $entry['name'];
}, $msg_list);
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['session_ip'], 'BIRTHDAYSEND', false, array(implode(', ', $userlist)));
}
}
$this->config->set('email_on_birthday_last_gc', time());
}
示例8: notify_using_messenger
/**
* Notify using phpBB messenger
*
* @param int $notify_method Notify method for messenger (e.g. NOTIFY_IM)
* @param string $template_dir_prefix Base directory to prepend to the email template name
*
* @return null
*/
protected function notify_using_messenger($notify_method, $template_dir_prefix = '')
{
if (empty($this->queue)) {
return;
}
// Load all users we want to notify (we need their email address)
$user_ids = $users = array();
foreach ($this->queue as $notification) {
$user_ids[] = $notification->user_id;
}
// We do not send emails to banned users
if (!function_exists('phpbb_get_banned_user_ids')) {
include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
}
$banned_users = phpbb_get_banned_user_ids($user_ids);
// Load all the users we need
$this->user_loader->load_users($user_ids);
// Load the messenger
if (!class_exists('messenger')) {
include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
}
$messenger = new \messenger();
// Time to go through the queue and send emails
/** @var \phpbb\notification\type\type_interface $notification */
foreach ($this->queue as $notification) {
if ($notification->get_email_template() === false) {
continue;
}
$user = $this->user_loader->get_user($notification->user_id);
if ($user['user_type'] == USER_IGNORE || $user['user_type'] == USER_INACTIVE && $user['user_inactive_reason'] == INACTIVE_MANUAL || in_array($notification->user_id, $banned_users)) {
continue;
}
$messenger->template($notification->get_email_template(), $user['user_lang'], '', $template_dir_prefix);
$messenger->set_addresses($user);
$messenger->assign_vars(array_merge(array('USERNAME' => $user['username'], 'U_NOTIFICATION_SETTINGS' => generate_board_url() . '/ucp.' . $this->php_ext . '?i=ucp_notifications&mode=notification_options'), $notification->get_email_template_variables()));
$messenger->send($notify_method);
}
// Save the queue in the messenger class (has to be called or these emails could be lost?)
$messenger->save_queue();
// We're done, empty the queue
$this->empty_queue();
}
示例9: main
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template;
$username = request_var('username', '', true);
$email = request_var('email', '');
$submit = isset($_POST['submit']) ? true : false;
if ($submit) {
$sql = 'SELECT user_id, username, user_email, user_jabber, user_notify_type, user_type, user_lang
FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email = '" . $db->sql_escape($email) . "'\n\t\t\t\t\tAND LOWER(username) = '" . $db->sql_escape(strtolower($username)) . "'";
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row) {
trigger_error('NO_EMAIL_USER');
}
if ($user_row['user_type'] == USER_INACTIVE) {
trigger_error('ACCOUNT_NOT_ACTIVATED');
}
$server_url = generate_board_url();
$key_len = 54 - strlen($server_url);
$key_len = $key_len < 6 ? 6 : $key_len;
$user_actkey = substr(gen_rand_string(10), 0, $key_len);
$user_password = gen_rand_string(8);
$sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape(md5($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
$db->sql_query($sql);
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$messenger->template('user_activate_passwd', $row['user_lang']);
$messenger->replyto($user->data['user_email']);
$messenger->to($user_row['user_email'], $user_row['username']);
$messenger->im($user_row['user_jabber'], $user_row['username']);
$messenger->assign_vars(array('SITENAME' => $config['sitename'], 'USERNAME' => html_entity_decode($user_row['username']), 'PASSWORD' => html_entity_decode($user_password), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
$messenger->send($user_row['user_notify_type']);
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
$message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
trigger_error($message);
}
$template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
$this->tpl_name = 'ucp_remind';
$this->page_title = 'UCP_REMIND';
}
示例10: main
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template, $phpbb_container, $phpbb_dispatcher;
$user_id = request_var('u', 0);
$key = request_var('k', '');
$sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey, user_inactive_reason
FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_id = {$user_id}";
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row) {
trigger_error('NO_USER');
}
if ($user_row['user_type'] != USER_INACTIVE && !$user_row['user_newpasswd']) {
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
trigger_error('ALREADY_ACTIVATED');
}
if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL || $user_row['user_actkey'] !== $key) {
trigger_error('WRONG_ACTIVATION');
}
// Do not allow activating by non administrators when admin activation is on
// Only activation type the user should be able to do is INACTIVE_REMIND
// or activate a new password which is not an activation state :@
if (!$user_row['user_newpasswd'] && $user_row['user_inactive_reason'] != INACTIVE_REMIND && $config['require_activation'] == USER_ACTIVATION_ADMIN && !$auth->acl_get('a_user')) {
if (!$user->data['is_registered']) {
login_box('', $user->lang['NO_AUTH_OPERATION']);
}
trigger_error('NO_AUTH_OPERATION');
}
$update_password = $user_row['user_newpasswd'] ? true : false;
if ($update_password) {
$sql_ary = array('user_actkey' => '', 'user_password' => $user_row['user_newpasswd'], 'user_newpasswd' => '', 'user_login_attempts' => 0);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user_row['user_id'];
$db->sql_query($sql);
add_log('user', $user_row['user_id'], 'LOG_USER_NEW_PASSWORD', $user_row['username']);
}
if (!$update_password) {
include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
user_active_flip('activate', $user_row['user_id']);
$sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_actkey = ''\n\t\t\t\tWHERE user_id = {$user_row['user_id']}";
$db->sql_query($sql);
// Create the correct logs
add_log('user', $user_row['user_id'], 'LOG_USER_ACTIVE_USER');
if ($auth->acl_get('a_user')) {
add_log('admin', 'LOG_USER_ACTIVE', $user_row['username']);
}
}
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) {
$phpbb_notifications = $phpbb_container->get('notification_manager');
$phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']);
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$messenger->template('admin_welcome_activated', $user_row['user_lang']);
$messenger->set_addresses($user_row);
$messenger->anti_abuse_headers($config, $user);
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username'])));
$messenger->send($user_row['user_notify_type']);
$message = 'ACCOUNT_ACTIVE_ADMIN';
} else {
if (!$update_password) {
$message = $user_row['user_inactive_reason'] == INACTIVE_PROFILE ? 'ACCOUNT_ACTIVE_PROFILE' : 'ACCOUNT_ACTIVE';
} else {
$message = 'PASSWORD_ACTIVATED';
}
}
/**
* This event can be used to modify data after user account's activation
*
* @event core.ucp_activate_after
* @var array user_row Array with some user data
* @var string message Language string of the message that will be displayed to the user
* @since 3.1.6-RC1
*/
$vars = array('user_row', 'message');
extract($phpbb_dispatcher->trigger_event('core.ucp_activate_after', compact($vars)));
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
trigger_error($user->lang[$message]);
}
示例11: main
//.........这里部分代码省略.........
$user_row = array('username' => $data['username'], 'user_password' => phpbb_hash($data['new_password']), 'user_email' => $data['email'], 'group_id' => (int) $group_id, 'user_timezone' => (double) $data['tz'], 'user_dst' => $is_dst, 'user_lang' => $data['lang'], 'user_type' => $user_type, 'user_actkey' => $user_actkey, 'user_ip' => $user->ip, 'user_regdate' => time(), 'user_inactive_reason' => $user_inactive_reason, 'user_inactive_time' => $user_inactive_time);
if ($config['new_member_post_limit']) {
$user_row['user_new'] = 1;
}
// Register user...
$user_id = user_add($user_row, $cp_data);
// This should not happen, because the required variables are listed above...
if ($user_id === false) {
trigger_error('NO_USER', E_USER_ERROR);
}
// Okay, captcha, your job is done.
if ($config['enable_confirm'] && isset($captcha)) {
$captcha->reset();
}
if ($coppa && $config['email_enable']) {
$message = $user->lang['ACCOUNT_COPPA'];
$email_template = 'coppa_welcome_inactive';
} else {
if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) {
$message = $user->lang['ACCOUNT_INACTIVE'];
$email_template = 'user_welcome_inactive';
} else {
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable']) {
$message = $user->lang['ACCOUNT_INACTIVE_ADMIN'];
$email_template = 'admin_welcome_inactive';
} else {
$message = $user->lang['ACCOUNT_ADDED'];
$email_template = 'user_welcome';
}
}
}
if ($config['email_enable']) {
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$messenger->template($email_template, $data['lang']);
$messenger->to($data['email'], $data['username']);
$messenger->anti_abuse_headers($config, $user);
$messenger->assign_vars(array('WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), 'USERNAME' => htmlspecialchars_decode($data['username']), 'PASSWORD' => htmlspecialchars_decode($data['new_password']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_id}&k={$user_actkey}"));
if ($coppa) {
$messenger->assign_vars(array('FAX_INFO' => $config['coppa_fax'], 'MAIL_INFO' => $config['coppa_mail'], 'EMAIL_ADDRESS' => $data['email']));
}
$messenger->send(NOTIFY_EMAIL);
if ($config['require_activation'] == USER_ACTIVATION_ADMIN) {
// Grab an array of user_id's with a_user permissions ... these users can activate a user
$admin_ary = $auth->acl_get_list(false, 'a_user', false);
$admin_ary = !empty($admin_ary[0]['a_user']) ? $admin_ary[0]['a_user'] : array();
// Also include founders
$where_sql = ' WHERE user_type = ' . USER_FOUNDER;
if (sizeof($admin_ary)) {
$where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
}
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
FROM ' . USERS_TABLE . ' ' . $where_sql;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$messenger->template('admin_activate', $row['user_lang']);
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($data['username']), 'U_USER_DETAILS' => "{$server_url}/memberlist.{$phpEx}?mode=viewprofile&u={$user_id}", 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_id}&k={$user_actkey}"));
$messenger->send($row['user_notify_type']);
}
$db->sql_freeresult($result);
}
}
$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
trigger_error($message);
}
}
$s_hidden_fields = array('agreed' => 'true', 'change_lang' => 0);
if ($config['coppa_enable']) {
$s_hidden_fields['coppa'] = $coppa;
}
if ($config['enable_confirm']) {
$s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields());
}
$s_hidden_fields = build_hidden_fields($s_hidden_fields);
$confirm_image = '';
// Visual Confirmation - Show images
if ($config['enable_confirm']) {
$template->assign_vars(array('CAPTCHA_TEMPLATE' => $captcha->get_template()));
}
//
$l_reg_cond = '';
switch ($config['require_activation']) {
case USER_ACTIVATION_SELF:
$l_reg_cond = $user->lang['UCP_EMAIL_ACTIVATE'];
break;
case USER_ACTIVATION_ADMIN:
$l_reg_cond = $user->lang['UCP_ADMIN_ACTIVATE'];
break;
}
$template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'USERNAME' => $data['username'], 'PASSWORD' => $data['new_password'], 'PASSWORD_CONFIRM' => $data['password_confirm'], 'EMAIL' => $data['email'], 'EMAIL_CONFIRM' => $data['email_confirm'], 'L_REG_COND' => $l_reg_cond, 'L_USERNAME_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), 'L_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_TZ_OPTIONS' => tz_select($data['tz']), 'S_CONFIRM_REFRESH' => $config['enable_confirm'] && $config['confirm_refresh'] ? true : false, 'S_REGISTRATION' => true, 'S_COPPA' => $coppa, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register')));
//
$user->profile_fields = array();
// Generate profile fields -> Template Block Variable profile_fields
$cp->generate_profile_fields('register', $user->get_iso_lang_id());
//
$this->tpl_name = 'ucp_register';
$this->page_title = 'UCP_REGISTRATION';
}
示例12: close_report
//.........这里部分代码省略.........
while ($row = $db->sql_fetchrow($result)) {
$keep_report_topics[] = $row['topic_id'];
}
$db->sql_freeresult($result);
$close_report_topics = array_diff($close_report_topics, $keep_report_topics);
unset($keep_report_topics);
}
$db->sql_transaction('begin');
if ($action == 'close') {
$sql = 'UPDATE ' . REPORTS_TABLE . '
SET report_closed = 1
WHERE ' . $db->sql_in_set('report_id', $report_id_list);
} else {
$sql = 'DELETE FROM ' . REPORTS_TABLE . '
WHERE ' . $db->sql_in_set('report_id', $report_id_list);
}
$db->sql_query($sql);
if (sizeof($close_report_posts)) {
if ($pm) {
$sql = 'UPDATE ' . PRIVMSGS_TABLE . '
SET message_reported = 0
WHERE ' . $db->sql_in_set('msg_id', $close_report_posts);
$db->sql_query($sql);
if ($action == 'delete') {
delete_pm(ANONYMOUS, $close_report_posts, PRIVMSGS_INBOX);
}
} else {
$sql = 'UPDATE ' . POSTS_TABLE . '
SET post_reported = 0
WHERE ' . $db->sql_in_set('post_id', $close_report_posts);
$db->sql_query($sql);
if (sizeof($close_report_topics)) {
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_reported = 0
WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . '
OR ' . $db->sql_in_set('topic_moved_id', $close_report_topics);
$db->sql_query($sql);
}
}
}
$db->sql_transaction('commit');
}
unset($close_report_posts, $close_report_topics);
foreach ($reports as $report) {
if ($pm) {
add_log('mod', 0, 0, 'LOG_PM_REPORT_' . strtoupper($action) . 'D', $post_info[$report['pm_id']]['message_subject']);
} else {
add_log('mod', $post_info[$report['post_id']]['forum_id'], $post_info[$report['post_id']]['topic_id'], 'LOG_REPORT_' . strtoupper($action) . 'D', $post_info[$report['post_id']]['post_subject']);
}
}
$messenger = new messenger();
// Notify reporters
if (sizeof($notify_reporters)) {
foreach ($notify_reporters as $report_id => $reporter) {
if ($reporter['user_id'] == ANONYMOUS) {
continue;
}
$post_id = $reporter[$id_column];
$messenger->template(($pm ? 'pm_report_' : 'report_') . $action . 'd', $reporter['user_lang']);
$messenger->to($reporter['user_email'], $reporter['username']);
$messenger->im($reporter['user_jabber'], $reporter['username']);
if ($pm) {
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($reporter['username']), 'CLOSER_NAME' => htmlspecialchars_decode($user->data['username']), 'PM_SUBJECT' => htmlspecialchars_decode(censor_text($post_info[$post_id]['message_subject']))));
} else {
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($reporter['username']), 'CLOSER_NAME' => htmlspecialchars_decode($user->data['username']), 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_info[$post_id]['post_subject'])), 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_info[$post_id]['topic_title']))));
}
$messenger->send($reporter['user_notify_type']);
}
}
if (!$pm) {
foreach ($post_info as $post) {
$forum_ids[$post['forum_id']] = $post['forum_id'];
$topic_ids[$post['topic_id']] = $post['topic_id'];
}
}
unset($notify_reporters, $post_info, $reports);
$messenger->save_queue();
$success_msg = sizeof($report_id_list) == 1 ? "{$pm_prefix}REPORT_" . strtoupper($action) . 'D_SUCCESS' : "{$pm_prefix}REPORTS_" . strtoupper($action) . 'D_SUCCESS';
} else {
confirm_box(false, $user->lang[strtoupper($action) . "_{$pm_prefix}REPORT" . (sizeof($report_id_list) == 1 ? '' : 'S') . '_CONFIRM'], $s_hidden_fields);
}
$redirect = request_var('redirect', "index.{$phpEx}");
$redirect = reapply_sid($redirect);
if (!$success_msg) {
redirect($redirect);
} else {
meta_refresh(3, $redirect);
$return_forum = '';
$return_topic = '';
if (!$pm) {
if (sizeof($forum_ids) === 1) {
$return_forum = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
}
if (sizeof($topic_ids) === 1) {
$return_topic = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 't=' . current($topic_ids) . '&f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
}
}
trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_forum . $return_topic . sprintf($user->lang['RETURN_PAGE'], "<a href=\"{$redirect}\">", '</a>'));
}
}
示例13: send_email
/**
* Sends out an email.
*
* @todo Needs major work still...
*/
private function send_email()
{
global $user;
trigger_error('Send Email method is still under development ;)' . E_USER_ERROR);
// setup the e-mail for the founders
if (!class_exists('messenger')) {
include $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
}
$messenger = new messenger(false);
// use the specified email language template according tho this users' language settings.
$messenger->template($this->email_tpl, $user->data['lang']);
// Set the "to" header.
// @todo Set email
// $messenger->to(NOTIFICATION_EMAIL, 'Greg');
// E-mail subject
$messenger->subject(htmlspecialchars_decode($this->subject));
// set some X-AntiAbuse headers, may not be needed but...
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user_id);
$messenger->headers('X-AntiAbuse: Username - ' . $username);
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
// Assign variables for the MVC to be used in the e-mail template
$messenger->assign_vars(array('TO_USERNAME' => 'Greg Head', 'MESSAGE' => $message, 'SUBJECT' => $subject, 'AMOUNT' => $this->data['mc_gross'], 'PAYER_EMAIL' => $this->data['payer_email'], 'PAYER_USERNAME' => $this->sender_data ? $this->sender_data['username'] : $this->data['first_name'], 'VERIFY' => $this->verified ? $user->lang['TRANSACTION_VERIFIED'] : sprintf($user->lang['TRANSACTION_NOT_VERIFIED'], $this->page . '?action=validate&txn_id=' . $this->data['txn_id'])));
// Now send the e-mail message
$messenger->send(NOTIFY_EMAIL);
}
示例14: main
//.........这里部分代码省略.........
}
// Instantiate passwords manager
$passwords_manager = $phpbb_container->get('passwords.manager');
$user_row = array('username' => $data['username'], 'user_password' => $passwords_manager->hash($data['new_password']), 'user_email' => $data['email'], 'group_id' => (int) $group_id, 'user_timezone' => $data['tz'], 'user_lang' => $data['lang'], 'user_type' => $user_type, 'user_actkey' => $user_actkey, 'user_ip' => $this->user->ip, 'user_regdate' => time(), 'user_inactive_reason' => $user_inactive_reason, 'user_inactive_time' => $user_inactive_time);
if ($this->config['allow_birthdays']) {
$user_row['user_birthday'] = $data['user_birthday'];
}
// Register user...
$user_id = user_add($user_row, $cp_data);
if (!empty($data['group'])) {
if (!empty($group_default)) {
group_user_add($data['group'], array($user_id), false, false, true);
} else {
group_user_add($data['group'], array($user_id));
}
}
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_USER_ADDED', time(), array($data['username']));
// This should not happen, because the required variables are listed above...
if ($user_id === false) {
trigger_error($this->user->lang['NO_USER'], E_USER_ERROR);
}
// send a message to the user...if needed
$message = array();
if ($this->config['require_activation'] == USER_ACTIVATION_SELF && $this->config['email_enable']) {
$message[] = $this->user->lang['ACP_ACCOUNT_INACTIVE'];
$email_template = '@phpbbmodders_adduser/user_added_inactive';
} else {
if ($this->config['require_activation'] == USER_ACTIVATION_ADMIN && $this->config['email_enable'] && !$admin_activate) {
$message[] = $this->user->lang['ACP_ACCOUNT_INACTIVE_ADMIN'];
$email_template = '@phpbbmodders_adduser/user_added_admin_welcome_inactive';
} else {
$message[] = $this->user->lang['ACP_ACCOUNT_ADDED'];
$email_template = '@phpbbmodders_adduser/user_added_welcome';
}
}
if ($config['email_enable']) {
if (!class_exists('messenger')) {
include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
}
$messenger = new \messenger(false);
$messenger->template($email_template, $data['lang']);
$messenger->to($data['email'], $data['username']);
$messenger->headers('X-AntiAbuse: Board servername - ' . $this->config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $this->user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $this->user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $this->user->ip);
$messenger->assign_vars(array('WELCOME_MSG' => htmlspecialchars_decode(sprintf($this->user->lang['WELCOME_SUBJECT'], $this->config['sitename'])), 'USERNAME' => htmlspecialchars_decode($data['username']), 'PASSWORD' => htmlspecialchars_decode($data['new_password']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_id}&k={$user_actkey}"));
$messenger->send(NOTIFY_EMAIL);
}
if ($this->config['require_activation'] == USER_ACTIVATION_ADMIN && !$admin_activate) {
$phpbb_notifications = $phpbb_container->get('notification_manager');
$phpbb_notifications->add_notifications('notification.type.admin_activate_user', array('user_id' => $user_id, 'user_actkey' => $user_row['user_actkey'], 'user_regdate' => $user_row['user_regdate']));
}
$message[] = sprintf($user->lang['CONTINUE_EDIT_USER'], '<a href="' . append_sid("{$this->phpbb_admin_path}index.{$phpEx}", 'i=users&mode=overview&u=' . $user_id) . '">', $data['username'], '</a>');
$message[] = sprintf($user->lang['EDIT_USER_GROUPS'], '<a href="' . append_sid("{$this->phpbb_admin_path}index.{$phpEx}", 'i=users&mode=groups&u=' . $user_id) . '">', '</a>');
$message[] = adm_back_link($this->u_action);
trigger_error(implode('<br />', $message));
}
}
$l_reg_cond = '';
switch ($this->config['require_activation']) {
case USER_ACTIVATION_SELF:
$l_reg_cond = $this->user->lang['ACP_EMAIL_ACTIVATE'];
break;
case USER_ACTIVATION_ADMIN:
$l_reg_cond = $this->user->lang['ACP_ADMIN_ACTIVATE'];
break;
default:
$l_reg_cond = $this->user->lang['ACP_INSTANT_ACTIVATE'];
break;
}
if ($this->config['allow_birthdays']) {
$s_birthday_day_options = '<option value="0"' . (!$data['bday_day'] ? ' selected="selected"' : '') . '>--</option>';
for ($i = 1; $i < 32; $i++) {
$selected = $i == $data['bday_day'] ? ' selected="selected"' : '';
$s_birthday_day_options .= "<option value=\"{$i}\"{$selected}>{$i}</option>";
}
$s_birthday_month_options = '<option value="0"' . (!$data['bday_month'] ? ' selected="selected"' : '') . '>--</option>';
for ($i = 1; $i < 13; $i++) {
$selected = $i == $data['bday_month'] ? ' selected="selected"' : '';
$s_birthday_month_options .= "<option value=\"{$i}\"{$selected}>{$i}</option>";
}
$s_birthday_year_options = '';
$now = getdate();
$s_birthday_year_options = '<option value="0"' . (!$data['bday_year'] ? ' selected="selected"' : '') . '>--</option>';
for ($i = $now['year'] - 100; $i <= $now['year']; $i++) {
$selected = $i == $data['bday_year'] ? ' selected="selected"' : '';
$s_birthday_year_options .= "<option value=\"{$i}\"{$selected}>{$i}</option>";
}
unset($now);
$this->template->assign_vars(array('S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, 'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options, 'S_BIRTHDAYS_ENABLED' => true));
}
// Get the groups, so that the user can be added to them
$s_group_options = $this->get_groups($group_selected);
$timezone_selects = phpbb_timezone_select($template, $user, $data['tz'], true);
$this->template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'NEW_USERNAME' => $data['username'], 'EMAIL' => $data['email'], 'PASSWORD' => $data['new_password'], 'PASSWORD_CONFIRM' => $data['password_confirm'], 'L_PASSWORD_EXPLAIN' => $this->user->lang($config['pass_complex'] . '_EXPLAIN', $this->user->lang('CHARACTERS', (int) $this->config['min_pass_chars']), $this->user->lang('CHARACTERS', (int) $this->config['max_pass_chars'])) . ' ' . $this->user->lang['PASSWORD_EXPLAIN'], 'L_USERNAME_EXPLAIN' => $this->user->lang($config['allow_name_chars'] . '_EXPLAIN', $this->user->lang('CHARACTERS', (int) $this->config['min_name_chars']), $this->user->lang('CHARACTERS', (int) $this->config['max_name_chars'])), 'L_ADD_USER_EXPLAIN' => sprintf($this->user->lang['ADD_USER_EXPLAIN'], '<a href="' . append_sid("{$this->phpbb_admin_path}index.{$phpEx}", 'i=acp_board&mode=registration') . '">', '</a>'), 'L_REG_COND' => $l_reg_cond, 'L_MOD_VERSION' => sprintf($this->user->lang['MOD_VERSION'], $this->config['adduser_version']), 'S_USER_ADD' => true, 'S_GROUP_OPTIONS' => $s_group_options, 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_ADMIN_ACTIVATE' => $this->config['require_activation'] == USER_ACTIVATION_ADMIN ? true : false, 'U_ADMIN_ACTIVATE' => $admin_activate ? 'checked="checked"' : '', 'U_GROUP_DEFAULT' => $group_default ? 'checked="checked"' : ''));
$this->user->profile_fields = array();
// Generate profile fields -> Template Block Variable profile_fields
$cp->generate_profile_fields('register', $user->get_iso_lang_id());
}
示例15: main
//.........这里部分代码省略.........
$reason = 'USER_ADMIN_BAN_EMAIL_REASON';
$log = 'LOG_USER_BAN_EMAIL';
break;
case 'banip':
$ban[] = $user_row['user_ip'];
$sql = 'SELECT DISTINCT poster_ip
FROM ' . POSTS_TABLE . "\n\t\t\t\t\t\t\t\t\t\tWHERE poster_id = {$user_id}";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$ban[] = $row['poster_ip'];
}
$db->sql_freeresult($result);
$reason = 'USER_ADMIN_BAN_IP_REASON';
$log = 'LOG_USER_BAN_IP';
break;
}
user_ban(substr($action, 3), $ban, 0, 0, 0, $user->lang[$reason]);
add_log('admin', $log, $user->lang[$reason]);
add_log('user', $user_id, $log, $user->lang[$reason]);
trigger_error($user->lang['BAN_SUCCESSFUL'] . adm_back_link($this->u_action . '&u=' . $user_id));
break;
case 'reactivate':
if ($config['email_enable']) {
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$server_url = generate_board_url();
$user_actkey = gen_rand_string(10);
$key_len = 54 - strlen($server_url);
$key_len = $key_len > 6 ? $key_len : 6;
$user_actkey = substr($user_actkey, 0, $key_len);
if ($user_row['user_type'] != USER_INACTIVE) {
user_active_flip($user_id, $user_row['user_type'], $user_actkey, $user_row['username']);
}
$messenger = new messenger(false);
$messenger->template('user_resend_inactive', $user_row['user_lang']);
$messenger->replyto($config['board_contact']);
$messenger->to($user_row['user_email'], $user_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('SITENAME' => $config['sitename'], 'WELCOME_MSG' => sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename']), 'USERNAME' => html_entity_decode($user_row['username']), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
$messenger->send(NOTIFY_EMAIL);
add_log('admin', 'LOG_USER_REACTIVATE', $user_row['username']);
add_log('user', $user_id, 'LOG_USER_REACTIVATE_USER');
trigger_error($user->lang['FORCE_REACTIVATION_SUCCESS'] . adm_back_link($this->u_action . '&u=' . $user_id));
}
break;
case 'active':
user_active_flip($user_id, $user_row['user_type'], false, $user_row['username']);
$message = $user_row['user_type'] == USER_INACTIVE ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED';
$log = $user_row['user_type'] == USER_INACTIVE ? 'LOG_USER_ACTIVE' : 'LOG_USER_INACTIVE';
add_log('user', $user_id, $log . '_USER');
if ($user_row['user_type'] == USER_INACTIVE) {
set_config('num_users', $config['num_users'] + 1, true);
} else {
set_config('num_users', $config['num_users'] - 1, true);
}
// Update latest username
update_last_username();
trigger_error($user->lang[$message] . adm_back_link($this->u_action . '&u=' . $user_id));
break;
case 'delsig':
$sql_ary = array('user_sig' => '', 'user_sig_bbcode_uid' => '', 'user_sig_bbcode_bitfield' => 0);
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\t\t\t\t\t\tWHERE user_id = {$user_id}";
$db->sql_query($sql);
add_log('admin', 'LOG_USER_DEL_SIG', $user_row['username']);