当前位置: 首页>>代码示例>>PHP>>正文


PHP messenger::template方法代码示例

本文整理汇总了PHP中messenger::template方法的典型用法代码示例。如果您正苦于以下问题:PHP messenger::template方法的具体用法?PHP messenger::template怎么用?PHP messenger::template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在messenger的用法示例。


在下文中一共展示了messenger::template方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
        }
    }
开发者ID:alhitary,项目名称:notifyadmin,代码行数:30,代码来源:listener.php

示例2: 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';
    }
开发者ID:Tarendai,项目名称:spring-website,代码行数:60,代码来源:ucp_remind.php

示例3: test_email_parsing

 /**
  * @dataProvider email_parsing_data
  */
 public function test_email_parsing($author_name, $forum_name, $topic_title, $username)
 {
     global $config, $phpEx, $user;
     $this->messenger->set_addresses($user->data);
     $this->messenger->assign_vars(array('EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])), 'SITENAME' => htmlspecialchars_decode($config['sitename']), 'AUTHOR_NAME' => $author_name, 'FORUM_NAME' => $forum_name, 'TOPIC_TITLE' => $topic_title, 'USERNAME' => $username, 'U_FORUM' => generate_board_url() . "/viewforum.{$phpEx}?f=1", 'U_STOP_WATCHING_FORUM' => generate_board_url() . "/viewforum.{$phpEx}?uid=2&f=1&unwatch=forum"));
     $this->messenger->template('newtopic_notify', $user->data['user_lang'], '', '');
     $reflection_template = $this->reflection_template_property->getValue($this->messenger);
     $msg = trim($reflection_template->assign_display('body'));
     $this->assertContains($author_name, $msg);
     $this->assertContains($forum_name, $msg);
     $this->assertContains($topic_title, $msg);
     $this->assertContains($username, $msg);
     $this->assertContains(htmlspecialchars_decode($config['sitename']), $msg);
     $this->assertContains(str_replace('<br />', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])), $msg);
     $this->assertNotContains('EMAIL_SIG', $msg);
     $this->assertNotContains('U_STOP_WATCHING_FORUM', $msg);
 }
开发者ID:phpbb,项目名称:phpbb,代码行数:20,代码来源:email_parsing_test.php

示例4: 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]);
    }
开发者ID:jvinhit,项目名称:php,代码行数:57,代码来源:ucp_activate.php

示例5: 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';
    }
开发者ID:jvinhit,项目名称:php,代码行数:57,代码来源:ucp_remind.php

示例6: 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]);
    }
开发者ID:yunsite,项目名称:gloryroad,代码行数:56,代码来源:ucp_activate.php

示例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());
    }
开发者ID:Galixte,项目名称:emailonbirthday,代码行数:52,代码来源:birthday.php

示例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();
 }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:50,代码来源:messenger_base.php

示例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';
    }
开发者ID:yunsite,项目名称:gloryroad,代码行数:42,代码来源:ucp_remind.php

示例10: run

 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->user->session_begin();
     $this->user->setup('common');
     if ($this->config['email_enable']) {
         include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
         $messenger = new \messenger(false);
         $messenger->template('installed', $this->install_config->get('language'));
         $messenger->to($this->config['board_email'], $this->install_config->get('admin_name'));
         $messenger->anti_abuse_headers($this->config, $this->user);
         $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($this->install_config->get('admin_name')), 'PASSWORD' => htmlspecialchars_decode($this->install_config->get('admin_passwd'))));
         $messenger->send(NOTIFY_EMAIL);
     }
     // Login admin
     // Ugly but works
     $this->auth->login($this->install_config->get('admin_name'), $this->install_config->get('admin_passwd'), false, true, true);
     $this->iohandler->set_cookie($this->config['cookie_name'] . '_sid', $this->user->session_id);
     $this->iohandler->set_cookie($this->config['cookie_name'] . '_u', $this->user->cookie_data['u']);
     $this->iohandler->set_cookie($this->config['cookie_name'] . '_k', $this->user->cookie_data['k']);
     // Create log
     $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_INSTALL_INSTALLED', false, array($this->config['version']));
     // Remove install_lock
     @unlink($this->phpbb_root_path . 'cache/install_lock');
 }
开发者ID:hgchen,项目名称:phpbb,代码行数:27,代码来源:notify_user.php

示例11: 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]);
    }
开发者ID:WarriorMachines,项目名称:warriormachines-phpbb,代码行数:81,代码来源:ucp_activate.php

示例12: 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&amp;txn_id=' . $this->data['txn_id'])));
     // Now send the e-mail message
     $messenger->send(NOTIFY_EMAIL);
 }
开发者ID:Gfksx,项目名称:customisation-db,代码行数:31,代码来源:notifications.php

示例13: close_report

/**
* Closes a report
*/
function close_report($report_id_list, $mode, $action, $pm = false)
{
    global $db, $template, $user, $config, $auth;
    global $phpEx, $phpbb_root_path;
    $pm_where = $pm ? ' AND r.post_id = 0 ' : ' AND r.pm_id = 0 ';
    $id_column = $pm ? 'pm_id' : 'post_id';
    $module = $pm ? 'pm_reports' : 'reports';
    $pm_prefix = $pm ? 'PM_' : '';
    $sql = "SELECT r.{$id_column}\n\t\tFROM " . REPORTS_TABLE . ' r
		WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . $pm_where;
    $result = $db->sql_query($sql);
    $post_id_list = array();
    while ($row = $db->sql_fetchrow($result)) {
        $post_id_list[] = $row[$id_column];
    }
    $post_id_list = array_unique($post_id_list);
    if ($pm) {
        if (!$auth->acl_getf_global('m_report')) {
            trigger_error('NOT_AUTHORISED');
        }
    } else {
        if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report'))) {
            trigger_error('NOT_AUTHORISED');
        }
    }
    if ($action == 'delete' && strpos($user->data['session_page'], 'mode=report_details') !== false) {
        $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&amp;mode=reports');
    } elseif ($action == 'delete' && strpos($user->data['session_page'], 'mode=pm_report_details') !== false) {
        $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&amp;mode=pm_reports');
    } else {
        if ($action == 'close' && !request_var('r', 0)) {
            $redirect = request_var('redirect', build_url(array('mode', 'p', 'quickmod')) . '&amp;mode=' . $module);
        } else {
            $redirect = request_var('redirect', build_url(array('quickmod')));
        }
    }
    $success_msg = '';
    $forum_ids = array();
    $topic_ids = array();
    $s_hidden_fields = build_hidden_fields(array('i' => $module, 'mode' => $mode, 'report_id_list' => $report_id_list, 'action' => $action, 'redirect' => $redirect));
    if (confirm_box(true)) {
        $post_info = $pm ? get_pm_data($post_id_list) : get_post_data($post_id_list, 'm_report');
        $sql = "SELECT r.report_id, r.{$id_column}, r.report_closed, r.user_id, r.user_notify, u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type\n\t\t\tFROM " . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u
			WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . '
				' . ($action == 'close' ? 'AND r.report_closed = 0' : '') . '
				AND r.user_id = u.user_id' . $pm_where;
        $result = $db->sql_query($sql);
        $reports = $close_report_posts = $close_report_topics = $notify_reporters = $report_id_list = array();
        while ($report = $db->sql_fetchrow($result)) {
            $reports[$report['report_id']] = $report;
            $report_id_list[] = $report['report_id'];
            if (!$report['report_closed']) {
                $close_report_posts[] = $report[$id_column];
                if (!$pm) {
                    $close_report_topics[] = $post_info[$report['post_id']]['topic_id'];
                }
            }
            if ($report['user_notify'] && !$report['report_closed']) {
                $notify_reporters[$report['report_id']] =& $reports[$report['report_id']];
            }
        }
        $db->sql_freeresult($result);
        if (sizeof($reports)) {
            $close_report_posts = array_unique($close_report_posts);
            $close_report_topics = array_unique($close_report_topics);
            if (!$pm && sizeof($close_report_posts)) {
                // Get a list of topics that still contain reported posts
                $sql = 'SELECT DISTINCT topic_id
					FROM ' . POSTS_TABLE . '
					WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . '
						AND post_reported = 1
						AND ' . $db->sql_in_set('post_id', $close_report_posts, true);
                $result = $db->sql_query($sql);
                $keep_report_topics = array();
                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);
//.........这里部分代码省略.........
开发者ID:noprom,项目名称:cryptdb,代码行数:101,代码来源:mcp_reports.php

示例14: main

    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template, $cache;
        global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;
        $user->add_lang(array('posting', 'ucp', 'acp/users'));
        $this->tpl_name = 'acp_users';
        $this->page_title = 'ACP_USER_' . strtoupper($mode);
        include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
        include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
        $error = array();
        $username = request_var('username', '', true);
        $user_id = request_var('u', 0);
        $action = request_var('action', '');
        $submit = isset($_POST['update']) ? true : false;
        // Whois (special case)
        if ($action == 'whois') {
            $this->page_title = 'WHOIS';
            $this->tpl_name = 'simple_body';
            $user_ip = request_var('user_ip', '');
            $domain = gethostbyaddr($user_ip);
            $ipwhois = '';
            if ($ipwhois = user_ipwhois($user_ip)) {
                $ipwhois = preg_replace('#(\\s)([\\w\\-\\._\\+]+@[\\w\\-\\.]+)(\\s)#', '\\1<a href="mailto:\\2">\\2</a>\\3', $ipwhois);
                $ipwhois = preg_replace('#(\\s)(http:/{2}[^\\s]*)(\\s)#', '\\1<a href="\\2" target="_blank">\\2</a>\\3', $ipwhois);
            }
            $template->assign_vars(array('MESSAGE_TITLE' => sprintf($user->lang['IP_WHOIS_FOR'], $domain), 'MESSAGE_TEXT' => nl2br($ipwhois)));
            return;
        }
        // Show user selection mask
        if (!$username && !$user_id) {
            $this->page_title = 'SELECT_USER';
            $template->assign_vars(array('U_ACTION' => $this->u_action, 'ANONYMOUS_USER_ID' => ANONYMOUS, 'S_SELECT_USER' => true, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=select_user&amp;field=username')));
            return;
        }
        if (!$user_id) {
            $sql = 'SELECT user_id
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE username = '" . $db->sql_escape($username) . "'";
            $result = $db->sql_query($sql);
            $user_id = (int) $db->sql_fetchfield('user_id');
            $db->sql_freeresult($result);
            if (!$user_id) {
                trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action));
            }
        }
        // Generate content for all modes
        $sql = 'SELECT u.*, s.*
			FROM ' . USERS_TABLE . ' u
				LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id)
			WHERE u.user_id = ' . $user_id . '
			ORDER BY s.session_time DESC';
        $result = $db->sql_query($sql);
        $user_row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        if (!$user_row) {
            trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action));
        }
        // Generate overall "header" for user admin
        $s_form_options = '';
        // Include info file...
        include_once $phpbb_root_path . 'includes/acp/info/acp_users.' . $phpEx;
        $forms_ary = acp_users_info::module();
        foreach ($forms_ary['modes'] as $value => $ary) {
            if (!$this->is_authed($ary['auth'])) {
                continue;
            }
            $selected = $mode == $value ? ' selected="selected"' : '';
            $s_form_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang['ACP_USER_' . strtoupper($value)] . '</option>';
        }
        $template->assign_vars(array('U_BACK' => $this->u_action, 'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i={$id}&amp;u={$user_id}"), 'U_ACTION' => $this->u_action . '&amp;u=' . $user_id, 'S_FORM_OPTIONS' => $s_form_options));
        // Prevent normal users/admins change/view founders if they are not a founder by themselves
        if ($user->data['user_type'] != USER_FOUNDER && $user_row['user_type'] == USER_FOUNDER) {
            trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action));
        }
        switch ($mode) {
            case 'overview':
                $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_ADMIN'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
                        }
                        // 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 . '&amp;u=' . $user_id));
                        }
                        if ($user_id == $user->data['user_id']) {
                            trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
                        }
                        if (confirm_box(true)) {
                            user_delete($delete_type, $user_id);
                            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
//.........这里部分代码省略.........
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:acp_users.php

示例15: group_user_attributes

/**
* This is used to promote (to leader), demote or set as default a member/s
*/
function group_user_attributes($action, $group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $group_attributes = false)
{
    global $db, $auth, $phpbb_root_path, $phpEx, $config;
    // We need both username and user_id info
    $result = user_get_id_name($user_id_ary, $username_ary);
    if (!sizeof($user_id_ary) || $result !== false) {
        return 'NO_USERS';
    }
    if (!$group_name) {
        $group_name = get_group_name($group_id);
    }
    switch ($action) {
        case 'demote':
        case 'promote':
            $sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . "\n\t\t\t\tWHERE group_id = {$group_id}\n\t\t\t\t\tAND user_pending = 1\n\t\t\t\t\tAND " . $db->sql_in_set('user_id', $user_id_ary);
            $result = $db->sql_query_limit($sql, 1);
            $not_empty = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if ($not_empty) {
                return 'NO_VALID_USERS';
            }
            $sql = 'UPDATE ' . USER_GROUP_TABLE . '
				SET group_leader = ' . ($action == 'promote' ? 1 : 0) . "\n\t\t\t\tWHERE group_id = {$group_id}\n\t\t\t\t\tAND user_pending = 0\n\t\t\t\t\tAND " . $db->sql_in_set('user_id', $user_id_ary);
            $db->sql_query($sql);
            $log = $action == 'promote' ? 'LOG_GROUP_PROMOTED' : 'LOG_GROUP_DEMOTED';
            break;
        case 'approve':
            // Make sure we only approve those which are pending ;)
            $sql = 'SELECT u.user_id, u.user_email, u.username, u.username_clean, u.user_notify_type, u.user_jabber, u.user_lang
				FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug
				WHERE ug.group_id = ' . $group_id . '
					AND ug.user_pending = 1
					AND ug.user_id = u.user_id
					AND ' . $db->sql_in_set('ug.user_id', $user_id_ary);
            $result = $db->sql_query($sql);
            $user_id_ary = $email_users = array();
            while ($row = $db->sql_fetchrow($result)) {
                $user_id_ary[] = $row['user_id'];
                $email_users[] = $row;
            }
            $db->sql_freeresult($result);
            if (!sizeof($user_id_ary)) {
                return false;
            }
            $sql = 'UPDATE ' . USER_GROUP_TABLE . "\n\t\t\t\tSET user_pending = 0\n\t\t\t\tWHERE group_id = {$group_id}\n\t\t\t\t\tAND " . $db->sql_in_set('user_id', $user_id_ary);
            $db->sql_query($sql);
            // Send approved email to users...
            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
            $messenger = new messenger();
            foreach ($email_users as $row) {
                $messenger->template('group_approved', $row['user_lang']);
                $messenger->to($row['user_email'], $row['username']);
                $messenger->im($row['user_jabber'], $row['username']);
                $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($row['username']), 'GROUP_NAME' => htmlspecialchars_decode($group_name), 'U_GROUP' => generate_board_url() . "/ucp.{$phpEx}?i=groups&mode=membership"));
                $messenger->send($row['user_notify_type']);
            }
            $messenger->save_queue();
            $log = 'LOG_USERS_APPROVED';
            break;
        case 'default':
            $sql = 'SELECT user_id, group_id FROM ' . USERS_TABLE . '
				WHERE ' . $db->sql_in_set('user_id', $user_id_ary, false, true);
            $result = $db->sql_query($sql);
            $groups = array();
            while ($row = $db->sql_fetchrow($result)) {
                if (!isset($groups[$row['group_id']])) {
                    $groups[$row['group_id']] = array();
                }
                $groups[$row['group_id']][] = $row['user_id'];
            }
            $db->sql_freeresult($result);
            foreach ($groups as $gid => $uids) {
                remove_default_rank($gid, $uids);
                remove_default_avatar($gid, $uids);
            }
            group_set_user_default($group_id, $user_id_ary, $group_attributes);
            $log = 'LOG_GROUP_DEFAULTS';
            break;
    }
    // Clear permissions cache of relevant users
    $auth->acl_clear_prefetch($user_id_ary);
    add_log('admin', $log, $group_name, implode(', ', $username_ary));
    group_update_listings($group_id);
    return false;
}
开发者ID:Phatboy82,项目名称:phpbbgarage,代码行数:88,代码来源:functions_user.php


注:本文中的messenger::template方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。