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


PHP messenger::im方法代码示例

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


在下文中一共展示了messenger::im方法的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;
        $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

示例3: 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

示例4: send

 /**
  * Send the email
  *
  * @param \messenger $messenger
  * @param string $contact
  * @return null
  */
 public function send(\messenger $messenger, $contact)
 {
     if (!sizeof($this->recipients)) {
         return;
     }
     foreach ($this->recipients as $recipient) {
         $messenger->template($this->template, $recipient['lang']);
         $messenger->replyto($this->sender_address);
         $messenger->to($recipient['address'], $recipient['name']);
         $messenger->im($recipient['jabber'], $recipient['username']);
         $messenger->headers('X-AntiAbuse: Board servername - ' . $this->server_name);
         $messenger->headers('X-AntiAbuse: User IP - ' . $this->sender_ip);
         if ($this->sender_id) {
             $messenger->headers('X-AntiAbuse: User_id - ' . $this->sender_id);
         }
         if ($this->sender_username) {
             $messenger->headers('X-AntiAbuse: Username - ' . $this->sender_username);
         }
         $messenger->subject(htmlspecialchars_decode($this->subject));
         $messenger->assign_vars(array('BOARD_CONTACT' => $contact, 'TO_USERNAME' => htmlspecialchars_decode($recipient['to_name']), 'FROM_USERNAME' => htmlspecialchars_decode($this->sender_name), 'MESSAGE' => htmlspecialchars_decode($this->body)));
         if (sizeof($this->template_vars)) {
             $messenger->assign_vars($this->template_vars);
         }
         $messenger->send($recipient['notify_type']);
     }
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:33,代码来源:message.php

示例5: pm_notification

/**
* PM Notification
*/
function pm_notification($mode, $author, $recipients, $subject, $message)
{
    global $db, $user, $config, $phpbb_root_path, $phpEx, $auth;
    $subject = censor_text($subject);
    unset($recipients[ANONYMOUS], $recipients[$user->data['user_id']]);
    if (!sizeof($recipients)) {
        return;
    }
    // Get banned User ID's
    $sql = 'SELECT ban_userid
		FROM ' . BANLIST_TABLE . '
		WHERE ' . $db->sql_in_set('ban_userid', array_map('intval', array_keys($recipients))) . '
			AND ban_exclude = 0';
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
        unset($recipients[$row['ban_userid']]);
    }
    $db->sql_freeresult($result);
    if (!sizeof($recipients)) {
        return;
    }
    $sql = 'SELECT user_id, username, user_email, user_lang, user_notify_pm, user_notify_type, user_jabber
		FROM ' . USERS_TABLE . '
		WHERE ' . $db->sql_in_set('user_id', array_map('intval', array_keys($recipients)));
    $result = $db->sql_query($sql);
    $msg_list_ary = array();
    while ($row = $db->sql_fetchrow($result)) {
        if ($row['user_notify_pm'] == 1 && trim($row['user_email'])) {
            $msg_list_ary[] = array('method' => $row['user_notify_type'], 'email' => $row['user_email'], 'jabber' => $row['user_jabber'], 'name' => $row['username'], 'lang' => $row['user_lang']);
        }
    }
    $db->sql_freeresult($result);
    if (!sizeof($msg_list_ary)) {
        return;
    }
    include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
    $messenger = new messenger();
    foreach ($msg_list_ary as $pos => $addr) {
        $messenger->template('privmsg_notify', $addr['lang']);
        $messenger->to($addr['email'], $addr['name']);
        $messenger->im($addr['jabber'], $addr['name']);
        $messenger->assign_vars(array('SUBJECT' => htmlspecialchars_decode($subject), 'AUTHOR_NAME' => htmlspecialchars_decode($author), 'USERNAME' => htmlspecialchars_decode($addr['name']), 'U_INBOX' => generate_board_url() . "/ucp.{$phpEx}?i=pm&folder=inbox"));
        $messenger->send($addr['method']);
    }
    unset($msg_list_ary);
    $messenger->save_queue();
    unset($messenger);
}
开发者ID:jvinhit,项目名称:php,代码行数:51,代码来源:functions_privmsgs.php

示例6: 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

示例7: main


//.........这里部分代码省略.........
									AND ug.group_id = ' . $group_id . '
									AND ug.user_id = ' . $user->data['user_id'];
                            $result = $db->sql_query($sql);
                            $row = $db->sql_fetchrow($result);
                            $db->sql_freeresult($result);
                            if ($row) {
                                if ($row['user_pending']) {
                                    trigger_error($user->lang['ALREADY_IN_GROUP_PENDING'] . $return_page);
                                }
                                trigger_error($user->lang['ALREADY_IN_GROUP'] . $return_page);
                            }
                            // Check permission to join (open group or request)
                            if ($group_row[$group_id]['group_type'] != GROUP_OPEN && $group_row[$group_id]['group_type'] != GROUP_FREE) {
                                trigger_error($user->lang['CANNOT_JOIN_GROUP'] . $return_page);
                            }
                            if (confirm_box(true)) {
                                if ($group_row[$group_id]['group_type'] == GROUP_FREE) {
                                    group_user_add($group_id, $user->data['user_id']);
                                    $email_template = 'group_added';
                                } else {
                                    group_user_add($group_id, $user->data['user_id'], false, false, false, 0, 1);
                                    $email_template = 'group_request';
                                }
                                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                                $messenger = new messenger();
                                $sql = 'SELECT u.username, u.username_clean, u.user_email, u.user_notify_type, u.user_jabber, u.user_lang
									FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u
									WHERE ug.user_id = u.user_id
										AND ' . ($group_row[$group_id]['group_type'] == GROUP_FREE ? "ug.user_id = {$user->data['user_id']}" : 'ug.group_leader = 1') . "\n\t\t\t\t\t\t\t\t\t\tAND ug.group_id = {$group_id}";
                                $result = $db->sql_query($sql);
                                while ($row = $db->sql_fetchrow($result)) {
                                    $messenger->template($email_template, $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_row[$group_id]['group_name']), 'REQUEST_USERNAME' => $user->data['username'], 'U_PENDING' => generate_board_url() . "/ucp.{$phpEx}?i=groups&mode=manage&action=list&g={$group_id}", 'U_GROUP' => generate_board_url() . "/memberlist.{$phpEx}?mode=group&g={$group_id}"));
                                    $messenger->send($row['user_notify_type']);
                                }
                                $db->sql_freeresult($result);
                                $messenger->save_queue();
                                add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_JOIN' . ($group_row[$group_id]['group_type'] == GROUP_FREE ? '' : '_PENDING'), $group_row[$group_id]['group_name']);
                                meta_refresh(3, $this->u_action);
                                trigger_error($user->lang[$group_row[$group_id]['group_type'] == GROUP_FREE ? 'GROUP_JOINED' : 'GROUP_JOINED_PENDING'] . $return_page);
                            } else {
                                $s_hidden_fields = array('selected' => $group_id, 'action' => 'join', 'submit' => true);
                                confirm_box(false, $group_row[$group_id]['group_type'] == GROUP_FREE ? 'GROUP_JOIN' : 'GROUP_JOIN_PENDING', build_hidden_fields($s_hidden_fields));
                            }
                            break;
                        case 'demote':
                            if (!($row = group_memberships($group_id, $user->data['user_id']))) {
                                trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
                            }
                            list(, $row) = each($row);
                            if (!$row['group_leader']) {
                                trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
                            }
                            if (confirm_box(true)) {
                                group_user_attributes('demote', $group_id, $user->data['user_id']);
                                add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_DEMOTE', $group_row[$group_id]['group_name']);
                                meta_refresh(3, $this->u_action);
                                trigger_error($user->lang['USER_GROUP_DEMOTED'] . $return_page);
                            } else {
                                $s_hidden_fields = array('selected' => $group_id, 'action' => 'demote', 'submit' => true);
                                confirm_box(false, 'USER_GROUP_DEMOTE', build_hidden_fields($s_hidden_fields));
                            }
                            break;
                    }
开发者ID:html,项目名称:PI,代码行数:67,代码来源:ucp_groups.php

示例8: disapprove_post


//.........这里部分代码省略.........
            $post_disapprove_sql[] = $post_id;
        }
        unset($post_data);
        if (sizeof($forum_topics_real)) {
            foreach ($forum_topics_real as $forum_id => $topics_real) {
                $sql = 'UPDATE ' . FORUMS_TABLE . "\n\t\t\t\t\tSET forum_topics_real = forum_topics_real - {$topics_real}\n\t\t\t\t\tWHERE forum_id = {$forum_id}";
                $db->sql_query($sql);
            }
        }
        if (sizeof($topic_replies_real_sql)) {
            foreach ($topic_replies_real_sql as $topic_id => $num_replies) {
                $sql = 'UPDATE ' . TOPICS_TABLE . "\n\t\t\t\t\tSET topic_replies_real = topic_replies_real - {$num_replies}\n\t\t\t\t\tWHERE topic_id = {$topic_id}";
                $db->sql_query($sql);
            }
        }
        if (sizeof($post_disapprove_sql)) {
            if (!function_exists('delete_posts')) {
                include_once $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
            }
            // We do not check for permissions here, because the moderator allowed approval/disapproval should be allowed to delete the disapproved posts
            delete_posts('post_id', $post_disapprove_sql);
            foreach ($disapprove_log as $log_data) {
                add_log('mod', $log_data['forum_id'], $log_data['topic_id'], $log_data['type'] == 'topic' ? 'LOG_TOPIC_DISAPPROVED' : 'LOG_POST_DISAPPROVED', $log_data['post_subject'], $disapprove_reason);
            }
        }
        unset($post_disapprove_sql, $topic_replies_real_sql);
        update_post_information('topic', array_keys($topic_id_list));
        if (sizeof($forum_id_list)) {
            update_post_information('forum', array_keys($forum_id_list));
        }
        unset($topic_id_list, $forum_id_list);
        $messenger = new messenger();
        // Notify Poster?
        if ($notify_poster) {
            $lang_reasons = array();
            foreach ($post_info as $post_id => $post_data) {
                if ($post_data['poster_id'] == ANONYMOUS) {
                    continue;
                }
                if (isset($disapprove_reason_lang)) {
                    // Okay we need to get the reason from the posters language
                    if (!isset($lang_reasons[$post_data['user_lang']])) {
                        // Assign the current users translation as the default, this is not ideal but getting the board default adds another layer of complexity.
                        $lang_reasons[$post_data['user_lang']] = $user->lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang];
                        // Only load up the language pack if the language is different to the current one
                        if ($post_data['user_lang'] != $user->lang_name && file_exists($phpbb_root_path . '/language/' . $post_data['user_lang'] . '/mcp.' . $phpEx)) {
                            // Load up the language pack
                            $lang = array();
                            @(include $phpbb_root_path . '/language/' . $post_data['user_lang'] . '/mcp.' . $phpEx);
                            // If we find the reason in this language pack use it
                            if (isset($lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang])) {
                                $lang_reasons[$post_data['user_lang']] = $lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang];
                            }
                            unset($lang);
                            // Free memory
                        }
                    }
                    $email_disapprove_reason = $lang_reasons[$post_data['user_lang']];
                    $email_disapprove_reason .= $reason ? "\n\n" . $reason : '';
                }
                $email_template = $post_data['post_id'] == $post_data['topic_first_post_id'] && $post_data['post_id'] == $post_data['topic_last_post_id'] ? 'topic_disapproved' : 'post_disapproved';
                $messenger->template($email_template, $post_data['user_lang']);
                $messenger->to($post_data['user_email'], $post_data['username']);
                $messenger->im($post_data['user_jabber'], $post_data['username']);
                $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($post_data['username']), 'REASON' => htmlspecialchars_decode($email_disapprove_reason), 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_data['post_subject'])), 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_data['topic_title']))));
                $messenger->send($post_data['user_notify_type']);
            }
            unset($lang_reasons);
        }
        unset($post_info, $disapprove_reason, $email_disapprove_reason, $disapprove_reason_lang);
        $messenger->save_queue();
        if (sizeof($forum_topics_real)) {
            $success_msg = $num_disapproved == 1 ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS';
        } else {
            $success_msg = sizeof($post_id_list) == 1 ? 'POST_DISAPPROVED_SUCCESS' : 'POSTS_DISAPPROVED_SUCCESS';
        }
    } else {
        include_once $phpbb_root_path . 'includes/functions_display.' . $phpEx;
        display_reasons($reason_id);
        $show_notify = false;
        foreach ($post_info as $post_data) {
            if ($post_data['poster_id'] == ANONYMOUS) {
                continue;
            } else {
                $show_notify = true;
                break;
            }
        }
        $template->assign_vars(array('S_NOTIFY_POSTER' => $show_notify, 'S_APPROVE' => false, 'REASON' => $reason, 'ADDITIONAL_MSG' => $additional_msg));
        confirm_box(false, 'DISAPPROVE_POST' . (sizeof($post_id_list) == 1 ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
    }
    $redirect = request_var('redirect', "index.{$phpEx}");
    $redirect = reapply_sid($redirect);
    if (!$success_msg) {
        redirect($redirect);
    } else {
        meta_refresh(3, $redirect);
        trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"{$redirect}\">", '</a>'));
    }
}
开发者ID:html,项目名称:PI,代码行数:101,代码来源:mcp_queue.php

示例9: main

	function main($id, $mode)
	{
		global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;

		//
		if ($config['require_activation'] == USER_ACTIVATION_DISABLE)
		{
			trigger_error('UCP_REGISTER_DISABLE');
		}

		include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);

		$confirm_id		= request_var('confirm_id', '');
		$coppa			= (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false;
		$agreed			= (!empty($_POST['agreed'])) ? 1 : 0;
		$submit			= (isset($_POST['submit'])) ? true : false;
		$change_lang	= request_var('change_lang', '');
		$user_lang		= request_var('lang', $user->lang_name);


		// not so fast, buddy
		if (($submit && !check_form_key('ucp_register', false, '', false, $config['min_time_reg']))
			|| (!$submit && !check_form_key('ucp_register_terms', false, '', false, $config['min_time_terms'])))
		{
			$agreed = false;
		}
		
		if ($agreed)
		{
			add_form_key('ucp_register');
		}
		else
		{
			add_form_key('ucp_register_terms');
		}


		if ($change_lang || $user_lang != $config['default_lang'])
		{
			$use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang);

			if (file_exists($phpbb_root_path . 'language/' . $use_lang . '/'))
			{
				if ($change_lang)
				{
					$submit = false;

					// Setting back agreed to let the user view the agreement in his/her language
					$agreed = (empty($_GET['change_lang'])) ? 0 : $agreed;
				}

				$user->lang_name = $lang = $use_lang;
				$user->lang_path = $phpbb_root_path . 'language/' . $lang . '/';
				$user->lang = array();
				$user->add_lang(array('common', 'ucp'));
			}
			else
			{
				$change_lang = '';
				$user_lang = $user->lang_name;
			}
		}

		$cp = new custom_profile();

		$error = $cp_data = $cp_error = array();

		//
		if (!$agreed || ($coppa === false && $config['coppa_enable']) || ($coppa && !$config['coppa_enable']))
		{
			$add_lang = ($change_lang) ? '&amp;change_lang=' . urlencode($change_lang) : '';
			$add_coppa = ($coppa !== false) ? '&amp;coppa=' . $coppa : '';

			$s_hidden_fields = ($confirm_id) ? array('confirm_id' => $confirm_id) : array();

			// If we change the language, we want to pass on some more possible parameter.
			if ($change_lang)
			{
				// We do not include the password!
				$s_hidden_fields = array_merge($s_hidden_fields, array(
					'username'			=> utf8_normalize_nfc(request_var('username', '', true)),
					'email'				=> strtolower(request_var('email', '')),
					'email_confirm'		=> strtolower(request_var('email_confirm', '')),
					'confirm_code'		=> request_var('confirm_code', ''),
					'lang'				=> $user->lang_name,
					'tz'				=> request_var('tz', (float) $config['board_timezone']),
				));
			}

			if ($coppa === false && $config['coppa_enable'])
			{
				$now = getdate();
				$coppa_birthday = $user->format_date(mktime($now['hours'] + $user->data['user_dst'], $now['minutes'], $now['seconds'], $now['mon'], $now['mday'] - 1, $now['year'] - 13), $user->lang['DATE_FORMAT']);
				unset($now);

				$template->assign_vars(array(
					'L_COPPA_NO'		=> sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday),
					'L_COPPA_YES'		=> sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday),

					'U_COPPA_NO'		=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&amp;coppa=0' . $add_lang),
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:101,代码来源:ucp_register.php

示例10: 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;
        add_form_key('ucp_resend');
        if ($submit) {
            if (!check_form_key('ucp_resend')) {
                trigger_error('FORM_INVALID');
            }
            $sql = 'SELECT user_id, group_id, username, user_email, user_type, user_lang, user_actkey, 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_actkey'] && $user_row['user_type'] != USER_INACTIVE) {
                trigger_error('ACCOUNT_ALREADY_ACTIVATED');
            }
            if (!$user_row['user_actkey'] || $user_row['user_type'] == USER_INACTIVE && $user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
                trigger_error('ACCOUNT_DEACTIVATED');
            }
            // Determine coppa status on group (REGISTERED(_COPPA))
            $sql = 'SELECT group_name, group_type
				FROM ' . GROUPS_TABLE . '
				WHERE group_id = ' . $user_row['group_id'];
            $result = $db->sql_query($sql);
            $row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$row) {
                trigger_error('NO_GROUP');
            }
            $coppa = $row['group_name'] == 'REGISTERED_COPPA' && $row['group_type'] == GROUP_SPECIAL ? true : false;
            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
            $messenger = new messenger(false);
            if ($config['require_activation'] == USER_ACTIVATION_SELF || $coppa) {
                $messenger->template($coppa ? 'coppa_resend_inactive' : 'user_resend_inactive', $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('WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), 'USERNAME' => htmlspecialchars_decode($user_row['username']), 'U_ACTIVATE' => generate_board_url() . "/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}"));
                if ($coppa) {
                    $messenger->assign_vars(array('FAX_INFO' => $config['coppa_fax'], 'MAIL_INFO' => $config['coppa_mail'], 'EMAIL_ADDRESS' => $user_row['user_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);
                $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
					FROM ' . USERS_TABLE . '
					WHERE ' . $db->sql_in_set('user_id', $admin_ary[0]['a_user']);
                $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->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']), 'U_USER_DETAILS' => generate_board_url() . "/memberlist.{$phpEx}?mode=viewprofile&u={$user_row['user_id']}", 'U_ACTIVATE' => generate_board_url() . "/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}"));
                    $messenger->send($row['user_notify_type']);
                }
                $db->sql_freeresult($result);
            }
            meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
            $message = $config['require_activation'] == USER_ACTIVATION_ADMIN ? $user->lang['ACTIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT'];
            $message .= '<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=resend_act')));
        $this->tpl_name = 'ucp_resend';
        $this->page_title = 'UCP_RESEND';
    }
开发者ID:danielheyman,项目名称:EazySubs,代码行数:84,代码来源:ucp_resend.php

示例11: main

    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template, $cache;
        global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
        $user->add_lang('acp/email');
        $this->tpl_name = 'acp_email';
        $this->page_title = 'ACP_MASS_EMAIL';
        // Set some vars
        $submit = isset($_POST['submit']) ? true : false;
        $error = array();
        $usernames = request_var('usernames', '');
        $group_id = request_var('g', 0);
        $subject = request_var('subject', '', true);
        $message = request_var('message', '', true);
        // Do the job ...
        if ($submit) {
            // Error checking needs to go here ... if no subject and/or no message then skip
            // over the send and return to the form
            $use_queue = isset($_POST['send_immediatly']) ? false : true;
            $priority = request_var('mail_priority_flag', MAIL_NORMAL_PRIORITY);
            if (!$subject) {
                $error[] = $user->lang['NO_EMAIL_SUBJECT'];
            }
            if (!$message) {
                $error[] = $user->lang['NO_EMAIL_MESSAGE'];
            }
            if (!sizeof($error)) {
                if ($usernames) {
                    $usernames = implode(', ', preg_replace('#^[\\s]*?(.*?)[\\s]*?$#e', "\"'\" . \$db->sql_escape('\\1') . \"'\"", explode("\n", $usernames)));
                    $sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang 
						FROM ' . USERS_TABLE . " \n\t\t\t\t\t\tWHERE username IN ({$usernames})\n\t\t\t\t\t\t\tAND user_allow_massemail = 1\n\t\t\t\t\t\tORDER BY user_lang, user_notify_type";
                    // , SUBSTRING(user_email FROM INSTR(user_email, '@'))
                } else {
                    if ($group_id) {
                        $sql = 'SELECT u.user_email, u.username, u.user_lang, u.user_jabber, u.user_notify_type 
							FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug \n\t\t\t\t\t\t\tWHERE ug.group_id = {$group_id} \n\t\t\t\t\t\t\t\tAND ug.user_pending = 0\n\t\t\t\t\t\t\t\tAND u.user_id = ug.user_id \n\t\t\t\t\t\t\t\tAND u.user_allow_massemail = 1\n\t\t\t\t\t\t\tORDER BY u.user_lang, u.user_notify_type";
                    } else {
                        $sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang 
							FROM ' . USERS_TABLE . '
							WHERE user_allow_massemail = 1
							ORDER BY user_lang, user_notify_type';
                    }
                }
                $result = $db->sql_query($sql);
                $row = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                if (!$row) {
                    trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action));
                }
                $i = $j = 0;
                // Send with BCC, no more than 50 recipients for one mail (to not exceed the limit)
                $max_chunk_size = 50;
                $email_list = array();
                $old_lang = $row['user_lang'];
                $old_notify_type = $row['user_notify_type'];
                do {
                    if ($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email'] || $row['user_notify_type'] == NOTIFY_IM && $row['user_jabber'] || $row['user_notify_type'] == NOTIFY_BOTH && $row['user_email'] && $row['user_jabber']) {
                        if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type) {
                            $i = 0;
                            $j++;
                            $old_lang = $row['user_lang'];
                            $old_notify_type = $row['user_notify_type'];
                        }
                        $email_list[$j][$i]['lang'] = $row['user_lang'];
                        $email_list[$j][$i]['method'] = $row['user_notify_type'];
                        $email_list[$j][$i]['email'] = $row['user_email'];
                        $email_list[$j][$i]['name'] = $row['username'];
                        $email_list[$j][$i]['jabber'] = $row['user_jabber'];
                        $i++;
                    }
                } while ($row = $db->sql_fetchrow($result));
                $db->sql_freeresult($result);
                // Send the messages
                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
                $messenger = new messenger($use_queue);
                $errored = false;
                for ($i = 0, $size = sizeof($email_list); $i < $size; $i++) {
                    $used_lang = $email_list[$i][0]['lang'];
                    $used_method = $email_list[$i][0]['method'];
                    for ($j = 0, $list_size = sizeof($email_list[$i]); $j < $list_size; $j++) {
                        $email_row = $email_list[$i][$j];
                        $messenger->{sizeof($email_list[$i]) == 1 ? 'to' : 'bcc'}($email_row['email'], $email_row['name']);
                        $messenger->im($email_row['jabber'], $email_row['name']);
                    }
                    $messenger->template('admin_send_email', $used_lang);
                    $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->subject(html_entity_decode($subject));
                    $messenger->replyto($config['board_email']);
                    $messenger->set_mail_priority($priority);
                    $messenger->assign_vars(array('SITENAME' => $config['sitename'], 'CONTACT_EMAIL' => $config['board_contact'], 'MESSAGE' => html_entity_decode($message)));
                    if (!$messenger->send($used_method)) {
                        $errored = true;
                    }
                }
                unset($email_list);
                $messenger->save_queue();
//.........这里部分代码省略.........
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:acp_email.php

示例12: close_report

/**
* Closes a report
*/
function close_report($post_id_list, $mode, $action)
{
    global $db, $template, $user, $config;
    global $phpEx, $phpbb_root_path;
    if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_report'))) {
        trigger_error('NOT_AUTHORIZED');
    }
    if ($action == 'delete' && strpos($user->data['session_page'], 'mode=report_details') !== false) {
        $redirect = request_var('redirect', build_url(array('mode')) . '&amp;mode=reports');
    } else {
        $redirect = request_var('redirect', $user->data['session_page']);
    }
    $success_msg = '';
    $s_hidden_fields = build_hidden_fields(array('i' => 'reports', 'mode' => $mode, 'post_id_list' => $post_id_list, 'f' => $forum_id, 'action' => $action, 'redirect' => $redirect));
    if (confirm_box(true)) {
        $post_info = get_post_data($post_id_list, 'm_report');
        $sql = 'SELECT r.post_id, r.report_closed, r.user_id, r.user_notify, u.username, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type
			FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u
			WHERE r.post_id IN (' . implode(',', array_keys($post_info)) . ')
				' . ($action == 'close' ? 'AND r.report_closed = 0' : '') . '
				AND r.user_id = u.user_id';
        $result = $db->sql_query($sql);
        $reports = array();
        while ($report = $db->sql_fetchrow($result)) {
            $reports[$report['post_id']] = $report;
        }
        $db->sql_freeresult($result);
        $close_report_posts = $close_report_topics = $notify_reporters = array();
        foreach ($post_info as $post_id => $post_data) {
            if (isset($reports[$post_id])) {
                $close_report_posts[] = $post_id;
                $close_report_topics[] = $post_data['topic_id'];
                if ($reports[$post_id]['user_notify'] && !$reports[$post_id]['report_closed']) {
                    $notify_reporters[$post_id] = $reports[$post_id];
                }
            }
        }
        if (sizeof($close_report_posts)) {
            $close_report_topics = array_unique($close_report_topics);
            // Get a list of topics that still contain reported posts
            $sql = 'SELECT DISTINCT topic_id
				FROM ' . POSTS_TABLE . '
				WHERE topic_id IN (' . implode(', ', $close_report_topics) . ')
					AND post_reported = 1
					AND post_id NOT IN (' . implode(', ', $close_report_posts) . ')';
            $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 post_id IN (' . implode(', ', $close_report_posts) . ')';
            } else {
                $sql = 'DELETE FROM ' . REPORTS_TABLE . '
					WHERE post_id IN (' . implode(', ', $close_report_posts) . ')';
            }
            $db->sql_query($sql);
            $sql = 'UPDATE ' . POSTS_TABLE . '
				SET post_reported = 0
				WHERE post_id IN (' . implode(', ', $close_report_posts) . ')';
            $db->sql_query($sql);
            $sql = 'UPDATE ' . TOPICS_TABLE . '
				SET topic_reported = 0
				WHERE topic_id IN (' . implode(', ', $close_report_topics) . ')';
            $db->sql_query($sql);
            $db->sql_transaction('commit');
        }
        unset($close_report_posts, $close_report_topics);
        $messenger = new messenger();
        // Notify reporters
        if (sizeof($notify_reporters)) {
            $email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
            foreach ($notify_reporters as $post_id => $reporter) {
                if ($reporter['user_id'] == ANONYMOUS) {
                    continue;
                }
                $messenger->template('report_' . $action . 'd', $reporter['user_lang']);
                $messenger->replyto($config['board_email']);
                $messenger->to($reporter['user_email'], $reporter['username']);
                $messenger->im($reporter['user_jabber'], $reporter['username']);
                $messenger->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'USERNAME' => html_entity_decode($reporter['username']), 'CLOSER_NAME' => html_entity_decode($user->data['username']), 'POST_SUBJECT' => html_entity_decode(censor_text($post_info[$post_id]['post_subject'])), 'TOPIC_TITLE' => html_entity_decode(censor_text($post_info[$post_id]['topic_title']))));
                $messenger->send($reporter['user_notify_type']);
                $messenger->reset();
            }
            $messenger->save_queue();
        }
        unset($notify_reporters, $post_info);
        $success_msg = sizeof($post_id_list) == 1 ? 'REPORT_' . strtoupper($action) . 'D_SUCCESS' : 'REPORTS_' . strtoupper($action) . 'D_SUCCESS';
    } else {
        confirm_box(false, $user->lang[strtoupper($action) . '_REPORT' . (sizeof($post_id_list) == 1 ? '' : 'S') . '_CONFIRM'], $s_hidden_fields);
    }
//.........这里部分代码省略.........
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:mcp_reports.php

示例13: sprintf

    /**
     * Notify users about karma's changes (via PM/email/jabber)
     */
    function user_notification($data)
    {
        global $user, $db;
        $forum_id = $data['forum_id'];
        $topic_id = $data['topic_id'];
        $post_id = $data['post_id'];
        $user_id = $data['user_id'];
        $sql = 'SELECT user_karma_notify_pm, user_karma_notify_email, user_karma_notify_jabber
			FROM ' . USERS_TABLE . '
			WHERE user_id = ' . $user_id;
        $result = $db->sql_query($sql);
        $to_user = $db->sql_fetchrow($result);
        $notifications['pm'] = $this->config['notify_pm'] && $to_user['user_karma_notify_pm'];
        $notifications['email'] = $this->config['notify_email'] && $to_user['user_karma_notify_email'];
        $notifications['jabber'] = $this->config['notify_jabber'] && $to_user['user_karma_notify_jabber'];
        $from_user_id = $user->data['user_id'];
        $from_username = $user->data['username'];
        // Select template for messenger, subject and message
        if ($data['action'] == 'increase') {
            $subject = 'KARMA_NOTIFY_INCREASE_SUBJECT';
            $message = 'KARMA_NOTIFY_INCREASE_MESSAGE';
            $notify_tpl = 'karma_notify_increase';
            if ($this->config['anonym_increase']) {
                $message .= '_ANONYM';
                $notify_tpl .= '_anonym';
                $from_user_id = $data['user_id'];
                $from_username = $user->lang['KARMA_NOTIFY_HIDDEN_SENDER'];
            }
        } else {
            $subject = 'KARMA_NOTIFY_DECREASE_SUBJECT';
            $message = 'KARMA_NOTIFY_DECREASE_MESSAGE';
            $notify_tpl = 'karma_notify_decrease';
            if ($this->config['anonym_decrease']) {
                $message .= '_ANONYM';
                $notify_tpl .= '_anonym';
                $from_user_id = $data['user_id'];
                $from_username = $user->lang['KARMA_NOTIFY_HIDDEN_SENDER'];
            }
        }
        if ($this->config['power_show']) {
            $message .= '_POWERED';
            $notify_tpl .= '_powered';
        }
        if ($notifications['pm']) {
            global $config, $phpbb_root_path, $phpEx;
            $subject = $user->lang[$subject];
            $message = sprintf($user->lang[$message], $user->data['username'], $data['karma_power']);
            $message .= !empty($data['comment']) ? "\r\n" . sprintf($user->lang['KARMA_NOTIFY_MESSAGE_COMMENTS'], $user->data['username']) . "\r\n\r\n" . $data['comment'] : '';
            $message .= "\r\n\r\n" . $this->generate_backlink($forum_id, $topic_id, $post_id, $user_id);
            include $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
            $message_parser = new parse_message();
            $message = utf8_normalize_nfc($message);
            $options = '';
            generate_text_for_storage($message, $data['bbcode_uid'], $data['bbcode_bitfield'], $options, true, true, true);
            $icon_id = $data['icon_id'];
            // Always attach signature status
            $enable_sig = !$config['allow_sig'] || !$config['allow_sig_pm'] ? false : ($user->optionget('attachsig') ? true : false);
            // Store message, sync counters
            $pm_data = array('from_user_id' => $from_user_id, 'from_user_ip' => $user->data['user_ip'], 'from_username' => $from_username, 'icon_id' => (int) $icon_id, 'enable_sig' => (bool) $enable_sig, 'enable_bbcode' => $data['enable_bbcode'], 'enable_smilies' => $data['enable_smilies'], 'enable_urls' => $data['enable_urls'], 'bbcode_bitfield' => $data['bbcode_bitfield'], 'bbcode_uid' => $data['bbcode_uid'], 'author_id' => $user->data['user_id'], 'message' => $message, 'address_list' => array('u' => array($data['user_id'] => 'to')));
            unset($message_parser);
            submit_pm('post', $subject, $pm_data, false);
        }
        if ($notifications['email'] || $notifications['jabber']) {
            if ($notifications['email'] && $notifications['jabber'] && $config['email_enable'] && $config['jab_enable']) {
                $method = NOTIFY_BOTH;
            } else {
                if ($notifications['email'] && $config['email_enable']) {
                    $method = NOTIFY_EMAIL;
                } else {
                    if ($notifications['jabber'] && $config['jab_enable']) {
                        $method = NOTIFY_IM;
                    } else {
                        return;
                    }
                }
            }
            $comment = '';
            if ($this->config['comments'] && $data['comment']) {
                $comment = $data['comment'];
                // make list items visible as such
                if ($data['bbcode_uid']) {
                    $comment = str_replace('[*:' . $data['bbcode_uid'] . ']', '&sdot;&nbsp;', $comment);
                    // no BBCode in comment
                    strip_bbcode($comment, $data['bbcode_uid']);
                }
                $comment = "\r\n" . $user->lang['KARMA_NOTIFY_MESSAGE_COMMENTS'] . "\r\n" . $comment . "\r\n";
            }
            // Now, we are able to really send out notifications
            global $db, $phpbb_root_path, $phpEx;
            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
            $messenger = new messenger();
            $messenger->template($notify_tpl, $user->data['user_lang']);
            $messenger->to($user->data['user_email'], $user->data['username']);
            $messenger->im($user->data['user_jabber'], $user->data['username']);
            $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($data['username']), 'AUTHOR_NAME' => htmlspecialchars_decode($user->data['username']), 'POWER' => $data['karma_power'], 'BACKLINK' => $this->generate_backlink($forum_id, $topic_id, $post_id, $user_id), 'COMMENT' => $comment));
            $messenger->send($method);
            $messenger->save_queue();
//.........这里部分代码省略.........
开发者ID:esacinc,项目名称:forum-sitplatform-org-website,代码行数:101,代码来源:functions_karma.php

示例14: main

    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
        //
        if ($config['require_activation'] == USER_ACTIVATION_DISABLE) {
            trigger_error('UCP_REGISTER_DISABLE');
        }
        include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
        $confirm_id = request_var('confirm_id', '');
        $coppa = isset($_REQUEST['coppa']) ? !empty($_REQUEST['coppa']) ? 1 : 0 : false;
        $agreed = !empty($_POST['agreed']) ? 1 : 0;
        $submit = isset($_POST['submit']) ? true : false;
        $change_lang = request_var('change_lang', '');
        if ($change_lang) {
            $submit = false;
            $lang = $change_lang;
            $user->lang_name = $lang = $change_lang;
            $user->lang_path = $phpbb_root_path . 'language/' . $lang . '/';
            $user->lang = array();
            $user->add_lang(array('common', 'ucp'));
        }
        $cp = new custom_profile();
        $error = $data = $cp_data = $cp_error = array();
        //
        if (!$agreed) {
            if ($coppa === false && $config['coppa_enable']) {
                $now = getdate();
                $coppa_birthday = $user->format_date(mktime($now['hours'] + $user->data['user_dst'], $now['minutes'], $now['seconds'], $now['mon'], $now['mday'] - 1, $now['year'] - 13), $user->lang['DATE_FORMAT']);
                unset($now);
                $template->assign_vars(array('L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), 'U_COPPA_NO' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register&amp;coppa=0'), 'U_COPPA_YES' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register&amp;coppa=1'), 'S_SHOW_COPPA' => true, 'S_REGISTER_ACTION' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register')));
            } else {
                $template->assign_vars(array('L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()), 'S_SHOW_COPPA' => false, 'S_REGISTRATION' => true, 'S_REGISTER_ACTION' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register')));
            }
            $this->tpl_name = 'ucp_agreement';
            return;
        }
        $var_ary = array('username' => (string) '', 'password_confirm' => (string) '', 'new_password' => (string) '', 'cur_password' => (string) '', 'email' => (string) '', 'email_confirm' => (string) '', 'confirm_code' => (string) '', 'lang' => (string) $config['default_lang'], 'tz' => (double) $config['board_timezone']);
        // If we change the language inline, we do not want to display errors, but pre-fill already filled out values
        if ($change_lang) {
            foreach ($var_ary as $var => $default) {
                ${$var} = request_var($var, $default, true);
            }
        }
        // Check and initialize some variables if needed
        if ($submit) {
            foreach ($var_ary as $var => $default) {
                $data[$var] = request_var($var, $default, true);
            }
            $var_ary = array('username' => array(array('string', false, $config['min_name_chars'], $config['max_name_chars']), array('username')), 'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), 'new_password' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), 'email' => array(array('string', false, 6, 60), array('email')), 'email_confirm' => array('string', false, 6, 60), 'confirm_code' => array('string', !$config['enable_confirm'], 5, 8), 'tz' => array('num', false, -14, 14), 'lang' => array('match', false, '#^[a-z_]{2,}$#i'));
            $error = validate_data($data, $var_ary);
            extract($data);
            unset($data);
            // Replace "error" strings with their real, localised form
            $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
            // validate custom profile fields
            $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error);
            // Visual Confirmation handling
            $wrong_confirm = false;
            if ($config['enable_confirm']) {
                if (!$confirm_id) {
                    $error[] = $user->lang['CONFIRM_CODE_WRONG'];
                    $wrong_confirm = true;
                } else {
                    $sql = 'SELECT code
						FROM ' . CONFIRM_TABLE . "\n\t\t\t\t\t\tWHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'\n\t\t\t\t\t\t\tAND session_id = '" . $db->sql_escape($user->session_id) . "'\n\t\t\t\t\t\t\tAND confirm_type = " . CONFIRM_REG;
                    $result = $db->sql_query($sql);
                    $row = $db->sql_fetchrow($result);
                    $db->sql_freeresult($result);
                    if ($row) {
                        if (strcasecmp($row['code'], $confirm_code) === 0) {
                            $sql = 'DELETE FROM ' . CONFIRM_TABLE . "\n\t\t\t\t\t\t\t\tWHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'\n\t\t\t\t\t\t\t\t\tAND session_id = '" . $db->sql_escape($user->session_id) . "'\n\t\t\t\t\t\t\t\t\tAND confirm_type = " . CONFIRM_REG;
                            $db->sql_query($sql);
                        } else {
                            $error[] = $user->lang['CONFIRM_CODE_WRONG'];
                            $wrong_confirm = true;
                        }
                    } else {
                        $error[] = $user->lang['CONFIRM_CODE_WRONG'];
                        $wrong_confirm = true;
                    }
                }
            }
            if (!sizeof($error)) {
                if ($new_password != $password_confirm) {
                    $error[] = $user->lang['NEW_PASSWORD_ERROR'];
                }
                if ($email != $email_confirm) {
                    $error[] = $user->lang['NEW_EMAIL_ERROR'];
                }
            }
            if (!sizeof($error)) {
                $server_url = generate_board_url();
                // Which group by default?
                $group_reg = $coppa ? 'REGISTERED_COPPA' : 'REGISTERED';
                $group_inactive = $coppa ? 'INACTIVE_COPPA' : 'INACTIVE';
                $group_name = $config['require_activation'] == USER_ACTIVATION_NONE ? $group_reg : $group_inactive;
                $sql = 'SELECT group_id
					FROM ' . GROUPS_TABLE . "\n\t\t\t\t\tWHERE group_name = '" . $db->sql_escape($group_name) . "'\n\t\t\t\t\t\tAND group_type = " . GROUP_SPECIAL;
                $result = $db->sql_query($sql);
                $row = $db->sql_fetchrow($result);
//.........这里部分代码省略.........
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:ucp_register.php

示例15: while

         $email_list[$j][$i]['jabber'] = $row['user_jabber'];
         $i++;
     }
 } while ($row = $_CLASS['core_db']->sql_fetchrow($result));
 $_CLASS['core_db']->sql_freeresult($result);
 // Send the messages
 include_once $site_file_root . 'includes/forums/functions_messenger.php';
 $messenger = new messenger($use_queue);
 $errored = false;
 for ($i = 0; $i < sizeof($email_list); $i++) {
     $used_lang = $email_list[$i][0]['lang'];
     $used_method = $email_list[$i][0]['method'];
     for ($j = 0; $j < sizeof($email_list[$i]); $j++) {
         $email_row = $email_list[$i][$j];
         $messenger->{sizeof($email_list[$i]) == 1 ? 'to' : 'bcc'}($email_row['email'], $email_row['name']);
         $messenger->im($email_row['jabber'], $email_row['name']);
     }
     $messenger->template('admin_send_email', $used_lang);
     $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
     $messenger->headers('X-AntiAbuse: User_id - ' . $_CLASS['core_user']->data['user_id']);
     $messenger->headers('X-AntiAbuse: Username - ' . $_CLASS['core_user']->data['username']);
     $messenger->headers('X-AntiAbuse: User IP - ' . $_CLASS['core_user']->ip);
     $messenger->subject($subject);
     $messenger->replyto($config['board_email']);
     $messenger->set_mail_priority($priority);
     $messenger->assign_vars(array('SITENAME' => $config['sitename'], 'CONTACT_EMAIL' => $config['board_contact'], 'MESSAGE' => $message));
     if (!$messenger->send($used_method, $log_session)) {
         $errored = true;
     }
 }
 unset($email_list);
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:admin_email.php


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