本文整理汇总了PHP中messenger::replyto方法的典型用法代码示例。如果您正苦于以下问题:PHP messenger::replyto方法的具体用法?PHP messenger::replyto怎么用?PHP messenger::replyto使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messenger
的用法示例。
在下文中一共展示了messenger::replyto方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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]);
}
示例2: 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';
}
示例3: 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')) . '&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);
}
//.........这里部分代码省略.........
示例4: switch
$_CLASS['core_db']->free_result($result);
// Post data grab actions
switch ($action) {
case 'icq':
$presence_img = '<img src="http://web.icq.com/whitepages/online?icq=' . $row[$sql_field] . '&img=5" width="18" height="18" border="0" alt="" />';
break;
case 'jabber':
if ($submit && @extension_loaded('xml')) {
// Add class loader
require_once $site_file_root . 'includes/forums/functions_messenger.php';
$subject = sprintf($_CLASS['core_user']->lang['IM_JABBER_SUBJECT'], $_CLASS['core_user']->data['username'], $config['server_name']);
$message = $_POST['message'];
$messenger = new messenger();
$messenger->template('profile_send_email', $row['user_lang']);
$messenger->subject($subject);
$messenger->replyto($_CLASS['core_user']->data['user_email']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array('SITENAME' => $_CORE_CONFIG['global']['site_name'], 'BOARD_EMAIL' => $config['board_contact'], 'FROM_USERNAME' => $_CLASS['core_user']->data['username'], 'TO_USERNAME' => $row['username'], 'MESSAGE' => $message));
$messenger->send(NOTIFY_IM);
$messenger->save_queue();
$s_select = 'S_SENT_JABBER';
}
break;
}
$_CLASS['core_template']->assign_array(array('CONTACT_NAME' => $row[$sql_field], 'IM_CONTACT' => $row[$sql_field], 'USERNAME' => addslashes($row['username']), 'EMAIL' => $row['user_email'], 'SITENAME' => addslashes($_CORE_CONFIG['global']['site_name']), 'PRESENCE_IMG' => $presence_img, 'L_SEND_IM_EXPLAIN' => $_CLASS['core_user']->lang['IM_' . $lang], 'L_IM_SENT_JABBER' => sprintf($_CLASS['core_user']->lang['IM_SENT_JABBER'], $row['username']), $s_select => true, 'S_IM_ACTION' => $s_action));
break;
case 'viewprofile':
// Display a profile
if ($user_id == ANONYMOUS) {
trigger_error('NO_USER');
}
示例5: pm_notification
function pm_notification($mode, $author, $recipients, $subject, $message)
{
global $_CLASS, $config;
return;
$subject = censor_text($subject);
// Get banned User ID's
$sql = 'SELECT ban_userid
FROM ' . BANLIST_TABLE;
$result = $_CLASS['core_db']->query($sql);
unset($recipients[ANONYMOUS], $recipients[$_CLASS['core_user']->data['user_id']]);
while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
if (isset($row['ban_userid'])) {
unset($recipients[$row['ban_userid']]);
}
}
$_CLASS['core_db']->free_result($result);
if (!sizeof($recipients)) {
return;
}
$recipient_list = implode(', ', array_keys($recipients));
$sql = 'SELECT user_id, username, user_email, user_lang, user_notify_pm, user_notify_type, user_jabber
FROM ' . USERS_TABLE . "\r\n\t\tWHERE user_id IN ({$recipient_list})";
$result = $_CLASS['core_db']->query($sql);
$msg_list_ary = array();
while ($row = $_CLASS['core_db']->fetch_row_assoc($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']);
}
}
$_CLASS['core_db']->free_result($result);
if (!sizeof($msg_list_ary)) {
return;
}
require_once 'includes/forums/functions_messenger.php';
$messenger = new messenger();
$email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
foreach ($msg_list_ary as $pos => $addr) {
$messenger->template('privmsg_notify', $addr['lang']);
$messenger->replyto($config['board_email']);
$messenger->to($addr['email'], $addr['name']);
$messenger->im($addr['jabber'], $addr['name']);
$messenger->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'SUBJECT' => $subject, 'AUTHOR_NAME' => $author, 'USERNAME' => $addr['name'], 'U_INBOX' => generate_link('Control_Panel&i=pm&mode=unread', array('full' => true, 'sid' => true))));
$messenger->send($addr['method']);
$messenger->reset();
}
unset($msg_list_ary);
if ($messenger->queue) {
$messenger->save_queue();
}
unset($messenger);
}
示例6: time
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_emailtime = ' . time() . '
WHERE user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$email_tpl = $user_id ? 'profile_send_email' : 'email_notify';
$mail_to_users = array();
$mail_to_users[] = array('email_lang' => $email_lang, 'email' => $email, 'name' => $name, 'username' => $user_id ? $row['username'] : '', 'to_name' => $name, 'user_jabber' => $user_id ? $row['user_jabber'] : '', 'user_notify_type' => $user_id ? $row['user_notify_type'] : NOTIFY_EMAIL, 'topic_title' => !$user_id ? $row['topic_title'] : '', 'forum_id' => !$user_id ? $row['forum_id'] : 0);
// Ok, now the same email if CC specified, but without exposing the users email address
if ($cc) {
$mail_to_users[] = array('email_lang' => $user->data['user_lang'], 'email' => $user->data['user_email'], 'name' => $user->data['username'], 'username' => $user->data['username'], 'to_name' => $name, 'user_jabber' => $user->data['user_jabber'], 'user_notify_type' => $user_id ? $user->data['user_notify_type'] : NOTIFY_EMAIL, 'topic_title' => !$user_id ? $row['topic_title'] : '', 'forum_id' => !$user_id ? $row['forum_id'] : 0);
}
foreach ($mail_to_users as $row) {
$messenger->template($email_tpl, $row['email_lang']);
$messenger->replyto($user->data['user_email']);
$messenger->to($row['email'], $row['name']);
if ($user_id) {
$messenger->subject(htmlspecialchars_decode($subject));
$messenger->im($row['user_jabber'], $row['username']);
$notify_type = $row['user_notify_type'];
} else {
$notify_type = NOTIFY_EMAIL;
}
$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('BOARD_CONTACT' => $config['board_contact'], 'TO_USERNAME' => htmlspecialchars_decode($row['to_name']), 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']), 'MESSAGE' => htmlspecialchars_decode($message)));
if ($topic_id) {
$messenger->assign_vars(array('TOPIC_NAME' => htmlspecialchars_decode($row['topic_title']), 'U_TOPIC' => generate_board_url() . "/viewtopic.{$phpEx}?f=" . $row['forum_id'] . "&t={$topic_id}"));
示例7: main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
$action = request_var('action', '');
$mark = isset($_REQUEST['mark']) ? implode(', ', request_var('mark', array(0))) : '';
if ($mark) {
switch ($action) {
case 'activate':
case 'delete':
if (!$auth->acl_get('a_user')) {
trigger_error($user->lang['NO_ADMIN']);
}
$sql = 'SELECT username
FROM ' . USERS_TABLE . "\n\t\t\t\t\t\tWHERE user_id IN ({$mark})";
$result = $db->sql_query($sql);
$user_affected = array();
while ($row = $db->sql_fetchrow($result)) {
$user_affected[] = $row['username'];
}
$db->sql_freeresult($result);
if ($action == 'activate') {
include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
$mark_ary = explode(', ', $mark);
foreach ($mark_ary as $user_id) {
user_active_flip($user_id, USER_INACTIVE);
}
set_config('num_users', $config['num_users'] + sizeof($mark_ary), true);
// Update latest username
update_last_username();
} else {
if ($action == 'delete') {
if (!$auth->acl_get('a_userdel')) {
trigger_error($user->lang['NO_ADMIN']);
}
$sql = 'DELETE FROM ' . USER_GROUP_TABLE . " WHERE user_id IN ({$mark})";
$db->sql_query($sql);
$sql = 'DELETE FROM ' . USERS_TABLE . " WHERE user_id IN ({$mark})";
$db->sql_query($sql);
add_log('admin', 'LOG_INDEX_' . strtoupper($action), implode(', ', $user_affected));
}
}
break;
case 'remind':
if (!$auth->acl_get('a_user')) {
trigger_error($user->lang['NO_ADMIN']);
}
if (empty($config['email_enable'])) {
trigger_error($user->lang['EMAIL_DISABLED']);
}
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey
FROM ' . USERS_TABLE . " \n\t\t\t\t\t\tWHERE user_id IN ({$mark})";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result)) {
// Send the messages
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger();
$board_url = generate_board_url() . "/ucp.{$phpEx}?mode=activate";
$sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
$usernames = array();
do {
$messenger->template('user_remind_inactive', $row['user_lang']);
$messenger->replyto($config['board_email']);
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array('EMAIL_SIG' => $sig, 'USERNAME' => html_entity_decode($row['username']), 'SITENAME' => $config['sitename'], 'REGISTER_DATE' => $user->format_date($row['user_regdate']), 'U_ACTIVATE' => "{$board_url}&mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey']));
$messenger->send($row['user_notify_type']);
$usernames[] = $row['username'];
} while ($row = $db->sql_fetchrow($result));
$messenger->save_queue();
add_log('admin', 'LOG_INDEX_REMIND', implode(', ', $usernames));
unset($usernames);
}
$db->sql_freeresult($result);
break;
}
}
switch ($action) {
case 'online':
if (!$auth->acl_get('a_board')) {
trigger_error($user->lang['NO_ADMIN']);
}
set_config('record_online_users', 1, true);
set_config('record_online_date', time(), true);
add_log('admin', 'LOG_RESET_ONLINE');
break;
case 'stats':
if (!$auth->acl_get('a_board')) {
trigger_error($user->lang['NO_ADMIN']);
}
$sql = 'SELECT COUNT(post_id) AS stat
FROM ' . POSTS_TABLE . '
WHERE post_approved = 1';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('num_posts', (int) $row['stat'], true);
$sql = 'SELECT COUNT(topic_id) AS stat
FROM ' . TOPICS_TABLE . '
WHERE topic_approved = 1';
//.........这里部分代码省略.........
示例8: disapprove_post
/**
* Disapprove Post/Topic
*/
function disapprove_post($post_id_list, $mode)
{
global $db, $template, $user, $config;
global $phpEx, $phpbb_root_path;
if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_approve'))) {
trigger_error('NOT_AUTHORIZED');
}
$redirect = request_var('redirect', build_url(array('t', 'mode')) . '&mode=unapproved_topics');
$reason = request_var('reason', '', true);
$reason_id = request_var('reason_id', 0);
$success_msg = $additional_msg = '';
$s_hidden_fields = build_hidden_fields(array('i' => 'queue', 'mode' => $mode, 'post_id_list' => $post_id_list, 'f' => $forum_id, 'action' => 'disapprove', 'redirect' => $redirect));
$notify_poster = isset($_REQUEST['notify_poster']) ? true : false;
$disapprove_reason = '';
if ($reason_id) {
$sql = 'SELECT reason_title, reason_description
FROM ' . REPORTS_REASONS_TABLE . "\n\t\t\tWHERE reason_id = {$reason_id}";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$row || !$reason && $row['reason_title'] == 'other') {
$additional_msg = $user->lang['NO_REASON_DISAPPROVAL'];
unset($_POST['confirm']);
} else {
// If the reason is defined within the language file, we will use the localized version, else just use the database entry...
$disapprove_reason = $row['reason_title'] != 'other' ? isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]) ? $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])] : $row['reason_description'] : '';
$disapprove_reason .= $reason ? "\n\n" . $reason : '';
}
}
if (confirm_box(true)) {
$post_info = get_post_data($post_id_list, 'm_approve');
// If Topic -> forum_topics_real -= 1
// If Post -> topic_replies_real -= 1
$forum_topics_real = 0;
$topic_replies_real_sql = $post_disapprove_sql = $topic_id_list = array();
foreach ($post_info as $post_id => $post_data) {
$topic_id_list[$post_data['topic_id']] = 1;
// Topic or Post. ;)
if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_last_post_id'] == $post_id) {
if ($post_data['forum_id']) {
$forum_topics_real++;
}
} else {
if (!isset($topic_replies_real_sql[$post_data['topic_id']])) {
$topic_replies_real_sql[$post_data['topic_id']] = 1;
} else {
$topic_replies_real_sql[$post_data['topic_id']]++;
}
}
$post_disapprove_sql[] = $post_id;
}
if ($forum_topics_real) {
$sql = 'UPDATE ' . FORUMS_TABLE . "\n\t\t\t\tSET forum_topics_real = forum_topics_real - {$forum_topics_real}\n\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);
}
unset($post_disapprove_sql, $topic_replies_real_sql);
update_post_information('topic', array_keys($topic_id_list));
update_post_information('forum', $forum_id);
unset($topic_id_list);
$messenger = new messenger();
// Notify Poster?
if ($notify_poster) {
$email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
foreach ($post_info as $post_id => $post_data) {
if ($post_data['poster_id'] == ANONYMOUS) {
continue;
}
$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->replyto($config['board_email']);
$messenger->to($post_data['user_email'], $post_data['username']);
$messenger->im($post_data['user_jabber'], $post_data['username']);
$messenger->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'USERNAME' => html_entity_decode($post_data['username']), 'REASON' => html_entity_decode($disapprove_reason), 'POST_SUBJECT' => html_entity_decode(censor_text($post_data['post_subject'])), 'TOPIC_TITLE' => html_entity_decode(censor_text($post_data['topic_title']))));
$messenger->send($post_data['user_notify_type']);
$messenger->reset();
}
$messenger->save_queue();
}
unset($post_info, $disapprove_reason);
if ($forum_topics_real) {
$success_msg = $forum_topics_real == 1 ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS';
} else {
$success_msg = sizeof($post_id_list) == 1 ? 'POST_DISAPPROVED_SUCCESS' : 'POSTS_DISAPPROVED_SUCCESS';
}
//.........这里部分代码省略.........
示例9: disapprove_post
function disapprove_post($post_id_list)
{
global $_CLASS, $_CORE_CONFIG, $config;
if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_approve'))) {
trigger_error('NOT_AUTHORIZED');
}
$redirect = request_var('redirect', $_CLASS['core_user']->data['session_page']);
$reason = request_var('reason', '');
$reason_id = request_var('reason_id', 0);
$success_msg = $additional_msg = '';
$s_hidden_fields = build_hidden_fields(array('post_id_list' => $post_id_list, 'f' => $forum_id, 'mode' => 'disapprove', 'redirect' => $redirect));
$notify_poster = isset($_REQUEST['notify_poster']) ? true : false;
if ($reason_id) {
$sql = 'SELECT reason_name
FROM ' . REASONS_TABLE . " \n\t\t\tWHERE reason_id = {$reason_id}";
$result = $_CLASS['core_db']->query($sql);
if (!($row = $_CLASS['core_db']->fetch_row_assoc($result)) || !$reason && $row['reason_name'] == 'other') {
$additional_msg = 'Please give an appropiate reason for disapproval';
unset($_POST['confirm']);
} else {
$disapprove_reason = $row['reason_name'] != 'other' ? $_CLASS['core_user']->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_name'])] : '';
$disapprove_reason .= $reason ? "\n\n" . $_REQUEST['reason'] : '';
unset($reason);
}
$_CLASS['core_db']->free_result($result);
}
if (confirm_box(true)) {
$post_info = get_post_data($post_id_list, 'm_approve');
// If Topic -> forum_topics_real -= 1
// If Post -> topic_replies_real -= 1
$forum_topics_real = 0;
$topic_replies_real_sql = $post_disapprove_sql = $topic_id_list = array();
foreach ($post_info as $post_id => $post_data) {
$topic_id_list[$post_data['topic_id']] = 1;
// Topic or Post. ;)
if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_last_post_id'] == $post_id) {
if ($post_data['forum_id']) {
$forum_topics_real++;
}
} else {
if (!isset($topic_replies_real_sql[$post_data['topic_id']])) {
$topic_replies_real_sql[$post_data['topic_id']] = 1;
} else {
$topic_replies_real_sql[$post_data['topic_id']]++;
}
}
$post_disapprove_sql[] = $post_id;
}
if ($forum_topics_real) {
$sql = 'UPDATE ' . FORUMS_TABLE . "\n\t\t\t\tSET forum_topics_real = forum_topics_real - {$forum_topics_real}\n\t\t\t\tWHERE forum_id = {$forum_id}";
$_CLASS['core_db']->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}";
$_CLASS['core_db']->query($sql);
}
}
if (sizeof($post_disapprove_sql)) {
// 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);
}
unset($post_disapprove_sql, $topic_replies_real_sql);
update_post_information('topic', array_keys($topic_id_list));
update_post_information('forum', $forum_id);
unset($topic_id_list);
$messenger = new messenger();
// Notify Poster?
if ($notify_poster) {
$email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
foreach ($post_info as $post_id => $post_data) {
if ($post_data['poster_id'] == ANONYMOUS) {
continue;
}
$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->replyto($config['board_email']);
$messenger->to($post_data['user_email'], $post_data['username']);
$messenger->im($post_data['user_jabber'], $post_data['username']);
$messenger->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => $_CORE_CONFIG['global']['sitename'], 'USERNAME' => $post_data['username'], 'REASON' => stripslashes($disapprove_reason), 'POST_SUBJECT' => censor_text($post_data['post_subject']), 'TOPIC_TITLE' => censor_text($post_data['topic_title'])));
$messenger->send($post_data['user_notify_type']);
$messenger->reset();
}
$messenger->save_queue();
}
unset($post_info, $disapprove_reason);
if ($forum_topics_real) {
$success_msg = $forum_topics_real == 1 ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS';
} else {
$success_msg = sizeof($post_id_list) == 1 ? 'POST_DISAPPROVED_SUCCESS' : 'POSTS_DISAPPROVED_SUCCESS';
}
} else {
$sql = 'SELECT *
FROM ' . REASONS_TABLE . '
ORDER BY reason_priority ASC';
$result = $_CLASS['core_db']->query($sql);
while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$row['reason_name'] = strtoupper($row['reason_name']);
$reason_title = !empty($_CLASS['core_user']->lang['report_reasons']['TITLE'][$row['reason_name']]) ? $_CLASS['core_user']->lang['report_reasons']['TITLE'][$row['reason_name']] : ucwords(str_replace('_', ' ', $row['reason_name']));
$reason_desc = !empty($_CLASS['core_user']->lang['report_reasons']['DESCRIPTION'][$row['reason_name']]) ? $_CLASS['core_user']->lang['report_reasons']['DESCRIPTION'][$row['reason_name']] : $row['reason_desc'];
//.........这里部分代码省略.........
示例10: main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
$user->add_lang('posting');
$preview = !empty($_POST['preview']) ? true : false;
$submit = !empty($_POST['submit']) ? true : false;
$delete = !empty($_POST['delete']) ? true : false;
$error = $data = array();
$s_hidden_fields = '';
switch ($mode) {
case 'reg_details':
if ($submit) {
$var_ary = array('username' => $user->data['username'], 'email' => $user->data['user_email'], 'email_confirm' => (string) '', 'new_password' => (string) '', 'cur_password' => (string) '', 'password_confirm' => (string) '');
foreach ($var_ary as $var => $default) {
$data[$var] = request_var($var, $default);
}
$var_ary = array('password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 'new_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 'cur_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 'email' => array(array('string', false, 6, 60), array('email', $data['email'])), 'email_confirm' => array('string', true, 6, 60));
if ($auth->acl_get('u_chgname') && $config['allow_namechange']) {
$var_ary['username'] = array(array('string', false, $config['min_name_chars'], $config['max_name_chars']), array('username', $data['username']));
}
$error = validate_data($data, $var_ary);
extract($data);
unset($data);
if ($auth->acl_get('u_chgpasswd') && $new_password && $password_confirm != $new_password) {
$error[] = 'NEW_PASSWORD_ERROR';
}
if (($new_password || $auth->acl_get('u_chgemail') && $email != $user->data['user_email'] || $username != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange']) && md5($cur_password) != $user->data['user_password']) {
$error[] = 'CUR_PASSWORD_ERROR';
}
if ($auth->acl_get('u_chgemail') && $email != $user->data['user_email'] && $email_confirm != $email) {
$error[] = 'NEW_EMAIL_ERROR';
}
if (!sizeof($error)) {
$sql_ary = array('username' => $auth->acl_get('u_chgname') && $config['allow_namechange'] ? $username : $user->data['username'], 'user_email' => $auth->acl_get('u_chgemail') ? $email : $user->data['user_email'], 'user_email_hash' => $auth->acl_get('u_chgemail') ? crc32(strtolower($email)) . strlen($email) : $user->data['user_email_hash'], 'user_password' => $auth->acl_get('u_chgpasswd') && $new_password ? md5($new_password) : $user->data['user_password'], 'user_passchg' => $auth->acl_get('u_chgpasswd') && $new_password ? time() : 0);
if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $username != $user->data['username']) {
add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $username);
}
if ($auth->acl_get('u_chgpasswd') && $new_password && md5($new_password) != $user->data['user_password']) {
$user->reset_login_keys();
add_log('user', $user->data['user_id'], 'LOG_USER_NEW_PASSWORD', $username);
}
if ($auth->acl_get('u_chgemail') && $email != $user->data['user_email']) {
add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $username, $user->data['user_email'], $email);
}
if ($config['email_enable'] && $email != $user->data['user_email'] && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN)) {
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$server_url = generate_board_url();
$user_actkey = gen_rand_string(10);
$key_len = 54 - strlen($server_url);
$key_len = $key_len > 6 ? $key_len : 6;
$user_actkey = substr($user_actkey, 0, $key_len);
$messenger = new messenger();
$template_file = $config['require_activation'] == USER_ACTIVATION_ADMIN ? 'user_activate_inactive' : 'user_activate';
$messenger->template($template_file, $user->data['user_lang']);
$messenger->replyto($config['board_contact']);
$messenger->to($email, $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($username), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user->data['user_id']}&k={$user_actkey}"));
$messenger->send(NOTIFY_EMAIL);
if ($config['require_activation'] == USER_ACTIVATION_ADMIN) {
// Grab an array of user_id's with a_user permissions
$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 user_id IN (' . implode(', ', $admin_ary[0]['a_user']) . ')';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$messenger->template('admin_activate', $row['user_lang']);
$messenger->replyto($config['board_contact']);
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array('USERNAME' => html_entity_decode($username), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user->data['user_id']}&k={$user_actkey}"));
$messenger->send($row['user_notify_type']);
}
$db->sql_freeresult($result);
}
$messenger->save_queue();
$sql_ary += array('user_type' => USER_INACTIVE, 'user_actkey' => $user_actkey);
}
if (sizeof($sql_ary)) {
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
}
// Need to update config, forum, topic, posting, messages, etc.
if ($username != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange']) {
user_update_name($user->data['username'], $username);
}
meta_refresh(3, $this->u_action);
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
}
$user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\\w]+' => 'USERNAME_ALPHA_ONLY', '[\\w_\\+\\. \\-\\[\\]]+' => 'USERNAME_ALPHA_SPACERS');
//.........这里部分代码省略.........
示例11: main
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $cache, $template;
$user->add_lang('groups');
$return_page = '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '">', '</a>');
$mark_ary = request_var('mark', array(0));
$submit = !empty($_POST['submit']) ? true : false;
$delete = !empty($_POST['delete']) ? true : false;
$error = $data = array();
switch ($mode) {
case 'membership':
if ($submit || isset($_POST['change_default'])) {
$action = isset($_POST['change_default']) ? 'change_default' : request_var('action', '');
$group_id = $action == 'change_default' ? request_var('default', 0) : request_var('selected', 0);
if (!$group_id) {
trigger_error('NO_GROUP_SELECTED');
}
$sql = 'SELECT group_id, group_name, group_type
FROM ' . GROUPS_TABLE . "\n\t\t\t\t\t\tWHERE group_id IN ({$group_id}, {$user->data['group_id']})";
$result = $db->sql_query($sql);
$group_row = array();
while ($row = $db->sql_fetchrow($result)) {
$row['group_name'] = $row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
$group_row[$row['group_id']] = $row;
}
$db->sql_freeresult($result);
if (!sizeof($group_row)) {
trigger_error('GROUP_NOT_EXIST');
}
switch ($action) {
case 'change_default':
// User already having this group set as default?
if ($group_id == $user->data['group_id']) {
trigger_error($user->lang['ALREADY_DEFAULT_GROUP'] . $return_page);
}
if (!$auth->acl_get('u_chggrp')) {
trigger_error($user->lang['NOT_AUTHORIZED'] . $return_page);
}
// User needs to be member of the group in order to make it default
if (!group_memberships($group_id, $user->data['user_id'], true)) {
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
if (confirm_box(true)) {
group_user_attributes('default', $group_id, $user->data['user_id']);
add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_CHANGE', sprintf($user->lang['USER_GROUP_CHANGE'], $group_row[$group_id]['group_name'], $group_row[$user->data['group_id']]['group_name']));
meta_refresh(3, $this->u_action);
trigger_error($user->lang['CHANGED_DEFAULT_GROUP'] . $return_page);
} else {
$s_hidden_fields = array('default' => $group_id, 'change_default' => true);
confirm_box(false, sprintf($user->lang['GROUP_CHANGE_DEFAULT'], $group_row[$group_id]['group_name']), build_hidden_fields($s_hidden_fields));
}
break;
case 'resign':
// User tries to resign from default group but is not allowed to change it?
if ($group_id == $user->data['group_id'] && !$auth->acl_get('u_chggrp')) {
trigger_error($user->lang['NOT_RESIGN_FROM_DEFAULT_GROUP'] . $return_page);
}
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 (confirm_box(true)) {
group_user_del($group_id, $user->data['user_id']);
add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_RESIGN', $group_row[$group_id]['group_name']);
meta_refresh(3, $this->u_action);
trigger_error($user->lang[$row['user_pending'] ? 'GROUP_RESIGNED_PENDING' : 'GROUP_RESIGNED_MEMBERSHIP'] . $return_page);
} else {
$s_hidden_fields = array('selected' => $group_id, 'action' => 'resign', 'submit' => true);
confirm_box(false, $row['user_pending'] ? 'GROUP_RESIGN_PENDING' : 'GROUP_RESIGN_MEMBERSHIP', build_hidden_fields($s_hidden_fields));
}
break;
case 'join':
if (group_memberships($group_id, $user->data['user_id'], true)) {
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();
$email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
$sql = 'SELECT u.username, 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->replyto($config['board_email']);
$messenger->to($row['user_email'], $row['username']);
//.........这里部分代码省略.........
示例12: user_notification
/**
* User Notification
*/
function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id, $topic_id, $post_id)
{
global $db, $user, $config, $phpbb_root_path, $phpEx, $auth;
$topic_notification = $mode == 'reply' || $mode == 'quote';
$forum_notification = $mode == 'post';
if (!$topic_notification && !$forum_notification) {
trigger_error('WRONG_NOTIFICATION_MODE');
}
if (!$config['allow_topic_notify']) {
return;
}
$topic_title = $topic_notification ? $topic_title : $subject;
$topic_title = censor_text($topic_title);
// Get banned User ID's
$sql = 'SELECT ban_userid
FROM ' . BANLIST_TABLE;
$result = $db->sql_query($sql);
$sql_ignore_users = ANONYMOUS . ', ' . $user->data['user_id'];
while ($row = $db->sql_fetchrow($result)) {
if (isset($row['ban_userid'])) {
$sql_ignore_users .= ', ' . $row['ban_userid'];
}
}
$db->sql_freeresult($result);
$notify_rows = array();
// -- get forum_userids || topic_userids
$sql = 'SELECT u.user_id, u.username, u.user_email, u.user_lang, u.user_notify_type, u.user_jabber
FROM ' . ($topic_notification ? TOPICS_WATCH_TABLE : FORUMS_WATCH_TABLE) . ' w, ' . USERS_TABLE . ' u
WHERE w.' . ($topic_notification ? 'topic_id' : 'forum_id') . ' = ' . ($topic_notification ? $topic_id : $forum_id) . "\n\t\t\tAND w.user_id NOT IN ({$sql_ignore_users})\n\t\t\tAND w.notify_status = 0\n\t\t\tAND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
AND u.user_id = w.user_id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$notify_rows[$row['user_id']] = array('user_id' => $row['user_id'], 'username' => $row['username'], 'user_email' => $row['user_email'], 'user_jabber' => $row['user_jabber'], 'user_lang' => $row['user_lang'], 'notify_type' => $topic_notification ? 'topic' : 'forum', 'template' => $topic_notification ? 'topic_notify' : 'newtopic_notify', 'method' => $row['user_notify_type'], 'allowed' => false);
}
$db->sql_freeresult($result);
// forum notification is sent to those not already receiving topic notifications
if ($topic_notification) {
if (sizeof($notify_rows)) {
$sql_ignore_users .= ', ' . implode(', ', array_keys($notify_rows));
}
$sql = 'SELECT u.user_id, u.username, u.user_email, u.user_lang, u.user_notify_type, u.user_jabber
FROM ' . FORUMS_WATCH_TABLE . ' fw, ' . USERS_TABLE . " u\n\t\t\tWHERE fw.forum_id = {$forum_id}\n\t\t\t\tAND fw.user_id NOT IN ({$sql_ignore_users})\n\t\t\t\tAND fw.notify_status = 0\n\t\t\t\tAND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
AND u.user_id = fw.user_id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$notify_rows[$row['user_id']] = array('user_id' => $row['user_id'], 'username' => $row['username'], 'user_email' => $row['user_email'], 'user_jabber' => $row['user_jabber'], 'user_lang' => $row['user_lang'], 'notify_type' => 'forum', 'template' => 'forum_notify', 'method' => $row['user_notify_type'], 'allowed' => false);
}
$db->sql_freeresult($result);
}
if (!sizeof($notify_rows)) {
return;
}
// Make sure users are allowed to read the forum
foreach ($auth->acl_get_list(array_keys($notify_rows), 'f_read', $forum_id) as $forum_id => $forum_ary) {
foreach ($forum_ary as $auth_option => $user_ary) {
foreach ($user_ary as $user_id) {
$notify_rows[$user_id]['allowed'] = true;
}
}
}
// Now, we have to do a little step before really sending, we need to distinguish our users a little bit. ;)
$msg_users = $delete_ids = $update_notification = array();
foreach ($notify_rows as $user_id => $row) {
if (!$row['allowed'] || !trim($row['user_email'])) {
$delete_ids[$row['notify_type']][] = $row['user_id'];
} else {
$msg_users[] = $row;
$update_notification[$row['notify_type']][] = $row['user_id'];
}
}
unset($notify_rows);
// Now, we are able to really send out notifications
if (sizeof($msg_users)) {
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger();
$email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
$msg_list_ary = array();
foreach ($msg_users as $row) {
$pos = !isset($msg_list_ary[$row['template']]) ? 0 : sizeof($msg_list_ary[$row['template']]);
$msg_list_ary[$row['template']][$pos]['method'] = $row['method'];
$msg_list_ary[$row['template']][$pos]['email'] = $row['user_email'];
$msg_list_ary[$row['template']][$pos]['jabber'] = $row['user_jabber'];
$msg_list_ary[$row['template']][$pos]['name'] = $row['username'];
$msg_list_ary[$row['template']][$pos]['lang'] = $row['user_lang'];
}
unset($msg_users);
foreach ($msg_list_ary as $email_template => $email_list) {
foreach ($email_list as $addr) {
$messenger->template($email_template, $addr['lang']);
$messenger->replyto($config['board_email']);
$messenger->to($addr['email'], $addr['name']);
$messenger->im($addr['jabber'], $addr['name']);
$messenger->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => html_entity_decode($config['sitename']), 'USERNAME' => html_entity_decode($addr['name']), 'TOPIC_TITLE' => html_entity_decode($topic_title), 'FORUM_NAME' => html_entity_decode($forum_name), 'U_FORUM' => generate_board_url() . "/viewforum.{$phpEx}?f={$forum_id}&e=0", 'U_TOPIC' => generate_board_url() . "/viewtopic.{$phpEx}?f={$forum_id}&t={$topic_id}&e=0", 'U_NEWEST_POST' => generate_board_url() . "/viewtopic.{$phpEx}?f={$forum_id}&t={$topic_id}&p={$post_id}&e={$post_id}", 'U_STOP_WATCHING_TOPIC' => generate_board_url() . "/viewtopic.{$phpEx}?f={$forum_id}&t={$topic_id}&unwatch=topic", 'U_STOP_WATCHING_FORUM' => generate_board_url() . "/viewforum.{$phpEx}?f={$forum_id}&unwatch=forum"));
$messenger->send($addr['method']);
$messenger->reset();
}
}
//.........这里部分代码省略.........
示例13: array
/**
* Notify moderators of pending items. Notification is via options configured in ACP ie. Email/Jabber/Private message
*
* @param string &$mcp_mode_to_approve mode used in URL sent to notify of pending item
*
*/
function pending_notification($mcp_mode_to_approve)
{
global $user, $phpEx, $auth, $garage_config, $config, $garage, $phpbb_root_path;
//Get All Users With The Rights To Approve Items If We Need To
if ($garage_config['enable_email_pending_notify'] || $garage_config['enable_pm_pending_notify']) {
$garage_moderators = $auth->acl_get_list(false, array('m_garage_approve_vehicle', 'm_garage_approve_make', 'm_garage_approve_model', 'm_garage_approve_business', 'm_garage_approve_quartermile', 'm_garage_approve_dynorun', 'm_garage_approve_guestbook', 'm_garage_approve_lap', 'm_garage_approve_track', 'm_garage_approve_product'), false);
//Merge All Moderators With Permissions & Unique Them.
$moderators = array_unique(array_merge($garage_moderators[0]['m_garage_approve_vehicle'], $garage_moderators[0]['m_garage_approve_make'], $garage_moderators[0]['m_garage_approve_model'], $garage_moderators[0]['m_garage_approve_business'], $garage_moderators[0]['m_garage_approve_quartermile'], $garage_moderators[0]['m_garage_approve_dynorun'], $garage_moderators[0]['m_garage_approve_guestbook'], $garage_moderators[0]['m_garage_approve_lap'], $garage_moderators[0]['m_garage_approve_track'], $garage_moderators[0]['m_garage_approve_product']));
}
//Do We Send Email && Jabber Notifications On Pending Items?
if ($garage_config['enable_email_pending_notify']) {
//Get All Garage Moderators To Notify Via Email
$moderators_to_email = $garage->moderators_requiring_email($moderators, $garage_config['enable_email_pending_notify_optout']);
//Process All Moderator Returned And Send Them Notification Via There Perferred Methods (Email/Jabber)
for ($i = 0, $count = sizeof($moderators_to_email); $i < $count; $i++) {
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger();
$messenger->template('garage_pending', $moderators_to_email[$i]['user_lang']);
$messenger->replyto($config['board_contact']);
$messenger->to($moderators_to_email[$i]['user_email'], $moderators_to_email[$i]['username']);
$messenger->im($moderators_to_email[$i]['user_jabber'], $moderators_to_email[$i]['username']);
$messenger->assign_vars(array('U_MCP' => generate_board_url() . "/mcp.{$phpEx}?i=garage&mode={$mcp_mode_to_approve}"));
//Send Them The Actual Notification
$messenger->send($moderators_to_email[$i]['user_notify_type']);
}
}
//Do We Send Private Message Notifications On Pending Items?
if ($garage_config['enable_pm_pending_notify']) {
//Get All Garage Moderators To Notify Via PM
$moderators_to_pm = $garage->moderators_requiring_pm($moderators, $garage_config['enable_pm_pending_notify_optout']);
//Process All Moderator Returned And Send Them Notification Via Private Message
for ($i = 0, $count = sizeof($moderators_to_pm); $i < $count; $i++) {
include_once $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
include_once $phpbb_root_path . 'includes/message_parser.' . $phpEx;
$message_parser = new parse_message();
$message_parser->message = sprintf($user->lang['PENDING_NOTIFY_TEXT'], '<a href="mcp.' . $phpEx . '?i=garage&mode=' . $mcp_mode_to_approve . '">' . $user->lang['HERE'] . '</a>');
$message_parser->parse(true, true, true, false, false, true, true);
$pm_data = array('from_user_id' => $user->data['user_id'], 'from_user_ip' => $user->data['user_ip'], 'from_username' => $user->data['username'], 'enable_sig' => false, 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => false, 'icon_id' => 0, 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'address_list' => array('u' => array($moderators_to_pm[$i]['user_id'] => 'to')));
//Now We Have All Data Lets Send The PM!!
submit_pm('post', $user->lang['PENDING_ITEMS'], $pm_data, false, false);
}
}
return;
}
示例14: 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
user_get_id_name($user_id_ary, $username_ary);
if (!sizeof($user_id_ary)) {
return false;
}
if (!$group_name) {
$group_name = get_group_name($group_id);
}
switch ($action) {
case 'demote':
case 'promote':
$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_id IN (" . implode(', ', $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.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 ug.user_id IN (' . implode(', ', $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 user_id IN (" . implode(', ', $user_id_ary) . ')';
$db->sql_query($sql);
// Send approved email to users...
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger();
$email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
foreach ($email_users as $row) {
$messenger->template('group_approved', $row['user_lang']);
$messenger->replyto($config['board_email']);
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'USERNAME' => html_entity_decode($row['username']), 'GROUP_NAME' => html_entity_decode($group_name), 'U_GROUP' => generate_board_url() . "/ucp.{$phpEx}?i=groups&mode=membership"));
$messenger->send($row['user_notify_type']);
$messenger->reset();
}
$messenger->save_queue();
$log = 'LOG_USERS_APPROVED';
break;
case 'default':
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));
return true;
}
示例15: report_notification
function report_notification($notify_user, $report_post, $report_data)
{
global $config, $site_file_root;
require_once $site_file_root . 'includes/forums/functions_messenger.php';
require_once $site_file_root . 'includes/forums/functions_privmsgs.php';
$messenger = new messenger();
$email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
$email_template = $report_post ? 'new_report_post' : 'new_report_pm';
$view_report_url = $report_post ? generate_link('Forums&file=mcp&i=queue&r=' . $report_data['report_id'], array('full' => true, 'sid' => false)) : generate_link('Forums&file=mcp&i=pm&p=' . $report_data['id'] . '&r=' . $report_data['report_id'], array('full' => true, 'sid' => false));
foreach ($notify_user as $user_id => $notify_row) {
// Send notification by email
if (!$notify_row['pm']) {
$messenger->to($notify_row['email'], $notify_row['name']);
$messenger->im($notify_row['jabber'], $notify_row['name']);
$messenger->replyto($config['board_email']);
$messenger->template($email_template, $notify_row['lang']);
$messenger->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'USERNAME' => $notify_row['name'], 'SUBJECT' => $report_data['subject'], 'REPORTER' => $report_data['reporter'], 'REPORT_REASON' => $report_data['reason'], 'REPORT_TEXT' => $report_data['text'], 'U_VIEW_REPORT' => $view_report_url, 'U_VIEW_POST' => generate_board_url() . '/' . $report_data['view_post']));
$messenger->send($notify_row['notify_type']);
$messenger->reset();
$messenger->save_queue();
} else {
// Use messenger for getting the correct message, we use the email template
$messenger->template($email_template, $notify_row['lang']);
$messenger->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'USERNAME' => $notify_row['name'], 'SUBJECT' => $report_data['subject'], 'REPORTER' => $report_data['reporter'], 'REPORT_REASON' => $report_data['reason'], 'REPORT_TEXT' => $report_data['text'], 'U_VIEW_REPORT' => generate_board_url() . '/' . $view_report_url));
// break the sending process...
$messenger->send(false, true);
$messenger->reset();
// do not put in reporters outbox
submit_pm('post', $report_data['subject'], '', array(), array(), array('address_list' => array('u' => array($user_id => 'to')), 'icon_id' => 0, 'enable_bbcode' => 0, 'enable_html' => 0, 'enable_smilies' => 0, 'enable_magic_url' => 1, 'enable_sig' => 0, 'message_md5' => md5($messenger->msg), 'bbcode_bitfield' => 0, 'bbcode_uid' => 0, 'attachment_data' => array(), 'filename_data' => array(), 'message' => $messenger->msg), true, false);
}
}
unset($messenger);
}