root / tags / milestone_3 / phpBB / report.php
History | View | Annotate | Download (11.7 kB)
| 1 | 3604 | ludovic_arnaud | <?php
|
|---|---|---|---|
| 2 | 5114 | acydburn | /**
|
| 3 | 5114 | acydburn | * |
| 4 | 5114 | acydburn | * @package phpBB3 |
| 5 | 5114 | acydburn | * @version $Id$ |
| 6 | 5114 | acydburn | * @copyright (c) 2005 phpBB Group |
| 7 | 5114 | acydburn | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 8 | 5114 | acydburn | * |
| 9 | 5114 | acydburn | */ |
| 10 | 3604 | ludovic_arnaud | |
| 11 | 5114 | acydburn | /**
|
| 12 | 5114 | acydburn | */ |
| 13 | 3604 | ludovic_arnaud | define('IN_PHPBB', true); |
| 14 | 3604 | ludovic_arnaud | $phpbb_root_path = './'; |
| 15 | 4473 | psotfx | $phpEx = substr(strrchr(__FILE__, '.'), 1); |
| 16 | 3604 | ludovic_arnaud | include($phpbb_root_path . 'common.'.$phpEx); |
| 17 | 5250 | acydburn | include($phpbb_root_path . 'includes/functions_display.'.$phpEx); |
| 18 | 3604 | ludovic_arnaud | |
| 19 | 3604 | ludovic_arnaud | // Start session management
|
| 20 | 5250 | acydburn | $user->session_begin();
|
| 21 | 3604 | ludovic_arnaud | $auth->acl($user->data); |
| 22 | 4844 | acydburn | $user->setup('mcp'); |
| 23 | 3953 | psotfx | |
| 24 | 4978 | acydburn | // Report PM or Post?
|
| 25 | 4978 | acydburn | $id = request_var('p', request_var('pm', 0)); |
| 26 | 4978 | acydburn | $report_post = (request_var('p', 0)) ? true : false; |
| 27 | 4978 | acydburn | $reason_id = request_var('reason_id', 0); |
| 28 | 5117 | acydburn | $user_notify = (!empty($_REQUEST['notify']) && $user->data['is_registered']) ? true : false; |
| 29 | 4978 | acydburn | $report_text = request_var('report_text', ''); |
| 30 | 3604 | ludovic_arnaud | |
| 31 | 4978 | acydburn | if (!$id) |
| 32 | 4883 | acydburn | {
|
| 33 | 4978 | acydburn | trigger_error('INVALID_MODE'); |
| 34 | 4883 | acydburn | } |
| 35 | 4883 | acydburn | |
| 36 | 4978 | acydburn | $redirect_url = ($report_post) ? "{$phpbb_root_path}viewtopic.$phpEx$SID&p=$id#$id" : "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&p=$id"; |
| 37 | 4883 | acydburn | |
| 38 | 3953 | psotfx | // Has the report been cancelled?
|
| 39 | 3953 | psotfx | if (isset($_POST['cancel'])) |
| 40 | 3953 | psotfx | {
|
| 41 | 4883 | acydburn | redirect($redirect_url);
|
| 42 | 3953 | psotfx | } |
| 43 | 3953 | psotfx | |
| 44 | 3953 | psotfx | // Grab all relevant data
|
| 45 | 4978 | acydburn | if ($report_post) |
| 46 | 4883 | acydburn | {
|
| 47 | 4883 | acydburn | $sql = 'SELECT f.*, t.*, p.* |
| 48 | 4883 | acydburn | FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f |
| 49 | 4978 | acydburn | WHERE p.post_id = $id |
| 50 | 4883 | acydburn | AND p.topic_id = t.topic_id |
| 51 | 4883 | acydburn | AND p.forum_id = f.forum_id";
|
| 52 | 4883 | acydburn | } |
| 53 | 4978 | acydburn | else
|
| 54 | 4883 | acydburn | {
|
| 55 | 4883 | acydburn | // Only the user itself is able to report his Private Messages
|
| 56 | 4883 | acydburn | $sql = 'SELECT p.*, t.* |
| 57 | 4883 | acydburn | FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . " t |
| 58 | 4978 | acydburn | WHERE t.msg_id = $id |
| 59 | 4883 | acydburn | AND t.user_id = " . $user->data['user_id'] . ' |
| 60 | 4883 | acydburn | AND t.msg_id = p.msg_id';
|
| 61 | 4883 | acydburn | } |
| 62 | 3604 | ludovic_arnaud | $result = $db->sql_query($sql); |
| 63 | 3604 | ludovic_arnaud | |
| 64 | 4883 | acydburn | if (!($report_data = $db->sql_fetchrow($result))) |
| 65 | 3604 | ludovic_arnaud | {
|
| 66 | 4978 | acydburn | $message = ($report_post) ? $user->lang['POST_NOT_EXIST'] : $user->lang['PM_NOT_EXIST']; |
| 67 | 4978 | acydburn | trigger_error($message); |
| 68 | 3604 | ludovic_arnaud | } |
| 69 | 3604 | ludovic_arnaud | |
| 70 | 4978 | acydburn | if ($report_post) |
| 71 | 4883 | acydburn | {
|
| 72 | 4883 | acydburn | $forum_id = $report_data['forum_id']; |
| 73 | 4883 | acydburn | $topic_id = $report_data['topic_id']; |
| 74 | 3604 | ludovic_arnaud | |
| 75 | 4883 | acydburn | // Check required permissions
|
| 76 | 4883 | acydburn | $acl_check_ary = array('f_list' => 'POST_NOT_EXIST', 'f_read' => 'USER_CANNOT_READ', 'f_report' => 'USER_CANNOT_REPORT'); |
| 77 | 4978 | acydburn | |
| 78 | 4883 | acydburn | foreach ($acl_check_ary as $acl => $error) |
| 79 | 4883 | acydburn | {
|
| 80 | 4883 | acydburn | if (!$auth->acl_get($acl, $forum_id)) |
| 81 | 4883 | acydburn | {
|
| 82 | 4883 | acydburn | trigger_error($error); |
| 83 | 4883 | acydburn | } |
| 84 | 4883 | acydburn | } |
| 85 | 4883 | acydburn | unset($acl_check_ary); |
| 86 | 4883 | acydburn | } |
| 87 | 4883 | acydburn | else
|
| 88 | 3604 | ludovic_arnaud | {
|
| 89 | 4883 | acydburn | if (!$config['auth_report_pm'] || !$auth->acl_get('u_pm_report')) |
| 90 | 3953 | psotfx | {
|
| 91 | 4883 | acydburn | trigger_error('USER_CANNOT_REPORT'); |
| 92 | 3953 | psotfx | } |
| 93 | 3604 | ludovic_arnaud | } |
| 94 | 3604 | ludovic_arnaud | |
| 95 | 4445 | ludovic_arnaud | // Check if the post has already been reported by this user
|
| 96 | 4445 | ludovic_arnaud | $sql = 'SELECT * |
| 97 | 4883 | acydburn | FROM ' . REPORTS_TABLE . ' |
| 98 | 4978 | acydburn | WHERE ' . (($report_post) ? "post_id = $id" : "msg_id = $id") . ' |
| 99 | 4883 | acydburn | AND user_id = ' . $user->data['user_id']; |
| 100 | 4445 | ludovic_arnaud | $result = $db->sql_query($sql); |
| 101 | 3953 | psotfx | |
| 102 | 4193 | ludovic_arnaud | if ($row = $db->sql_fetchrow($result)) |
| 103 | 4193 | ludovic_arnaud | {
|
| 104 | 5117 | acydburn | if ($user->data['is_registered']) |
| 105 | 4012 | ludovic_arnaud | {
|
| 106 | 4445 | ludovic_arnaud | // A report exists, extract $row if we're going to display the form
|
| 107 | 4978 | acydburn | if ($reason_id) |
| 108 | 4445 | ludovic_arnaud | {
|
| 109 | 4978 | acydburn | $report_id = (int) $row['report_id']; |
| 110 | 4445 | ludovic_arnaud | } |
| 111 | 4445 | ludovic_arnaud | else
|
| 112 | 4445 | ludovic_arnaud | {
|
| 113 | 4445 | ludovic_arnaud | // Overwrite set variables
|
| 114 | 4445 | ludovic_arnaud | extract($row); |
| 115 | 4445 | ludovic_arnaud | } |
| 116 | 4012 | ludovic_arnaud | } |
| 117 | 4193 | ludovic_arnaud | else
|
| 118 | 4193 | ludovic_arnaud | {
|
| 119 | 4978 | acydburn | trigger_error($user->lang['ALREADY_REPORTED'] . '<br /><br />' . sprintf($user->lang[(($report_post) ? 'RETURN_TOPIC' : 'RETURN_MESSAGE')], '<a href="' . $redirect_url . '">', '</a>')); |
| 120 | 4193 | ludovic_arnaud | } |
| 121 | 4012 | ludovic_arnaud | } |
| 122 | 4012 | ludovic_arnaud | else
|
| 123 | 4012 | ludovic_arnaud | {
|
| 124 | 4012 | ludovic_arnaud | $report_id = 0; |
| 125 | 4012 | ludovic_arnaud | } |
| 126 | 4012 | ludovic_arnaud | |
| 127 | 3604 | ludovic_arnaud | // Has the report been confirmed?
|
| 128 | 4978 | acydburn | if (isset($_POST['submit']) && $reason_id) |
| 129 | 3604 | ludovic_arnaud | {
|
| 130 | 4978 | acydburn | $sql = 'SELECT reason_name |
| 131 | 3953 | psotfx | FROM ' . REASONS_TABLE . " |
| 132 | 3953 | psotfx | WHERE reason_id = $reason_id"; |
| 133 | 3953 | psotfx | $result = $db->sql_query($sql); |
| 134 | 3953 | psotfx | |
| 135 | 4883 | acydburn | if (!($row = $db->sql_fetchrow($result)) || (!$report_text && $row['reason_name'] == 'other')) |
| 136 | 3798 | ludovic_arnaud | {
|
| 137 | 3798 | ludovic_arnaud | trigger_error('EMPTY_REPORT'); |
| 138 | 3798 | ludovic_arnaud | } |
| 139 | 3953 | psotfx | $db->sql_freeresult($result); |
| 140 | 3798 | ludovic_arnaud | |
| 141 | 4978 | acydburn | $reason_desc = (!empty($user->lang['report_reasons']['DESCRIPTION'][$row['reason_name']])) ? $user->lang['report_reasons']['DESCRIPTION'][$row['reason_name']] : $row['reason_name']; |
| 142 | 4978 | acydburn | |
| 143 | 3604 | ludovic_arnaud | $sql_ary = array( |
| 144 | 4883 | acydburn | 'reason_id' => (int) $reason_id, |
| 145 | 4978 | acydburn | 'post_id' => ($report_post) ? $id : 0, |
| 146 | 4978 | acydburn | 'msg_id' => ($report_post) ? 0 : $id, |
| 147 | 4883 | acydburn | 'user_id' => (int) $user->data['user_id'], |
| 148 | 4883 | acydburn | 'user_notify' => (int) $user_notify, |
| 149 | 4883 | acydburn | 'report_time' => (int) time(), |
| 150 | 4883 | acydburn | 'report_text' => (string) $report_text |
| 151 | 3604 | ludovic_arnaud | ); |
| 152 | 3604 | ludovic_arnaud | |
| 153 | 4012 | ludovic_arnaud | if ($report_id) |
| 154 | 4012 | ludovic_arnaud | {
|
| 155 | 4012 | ludovic_arnaud | $sql = 'UPDATE ' . REPORTS_TABLE . ' |
| 156 | 4012 | ludovic_arnaud | SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' |
| 157 | 4012 | ludovic_arnaud | WHERE report_id = ' . $report_id; |
| 158 | 4012 | ludovic_arnaud | $db->sql_query($sql); |
| 159 | 4012 | ludovic_arnaud | } |
| 160 | 4012 | ludovic_arnaud | else
|
| 161 | 4012 | ludovic_arnaud | {
|
| 162 | 4012 | ludovic_arnaud | $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . |
| 163 | 4012 | ludovic_arnaud | $db->sql_build_array('INSERT', $sql_ary); |
| 164 | 4012 | ludovic_arnaud | $db->sql_query($sql); |
| 165 | 4978 | acydburn | $report_id = $db->sql_nextid(); |
| 166 | 4012 | ludovic_arnaud | } |
| 167 | 3604 | ludovic_arnaud | |
| 168 | 4978 | acydburn | if ($report_post) |
| 169 | 3604 | ludovic_arnaud | {
|
| 170 | 4978 | acydburn | if (!$report_data['post_reported']) |
| 171 | 4883 | acydburn | {
|
| 172 | 4883 | acydburn | $sql = 'UPDATE ' . POSTS_TABLE . ' |
| 173 | 4883 | acydburn | SET post_reported = 1 |
| 174 | 4978 | acydburn | WHERE post_id = ' . $id; |
| 175 | 4883 | acydburn | $db->sql_query($sql); |
| 176 | 4883 | acydburn | } |
| 177 | 4883 | acydburn | |
| 178 | 4978 | acydburn | if (!$report_data['topic_reported']) |
| 179 | 4883 | acydburn | {
|
| 180 | 4883 | acydburn | $sql = 'UPDATE ' . TOPICS_TABLE . ' |
| 181 | 4883 | acydburn | SET topic_reported = 1 |
| 182 | 4978 | acydburn | WHERE topic_id = ' . $report_data['topic_id']; |
| 183 | 4883 | acydburn | $db->sql_query($sql); |
| 184 | 4883 | acydburn | } |
| 185 | 3604 | ludovic_arnaud | } |
| 186 | 4883 | acydburn | else
|
| 187 | 3604 | ludovic_arnaud | {
|
| 188 | 4978 | acydburn | if (!$report_data['message_reported']) |
| 189 | 4883 | acydburn | {
|
| 190 | 4883 | acydburn | $sql = 'UPDATE ' . PRIVMSGS_TABLE . " |
| 191 | 4883 | acydburn | SET message_reported = 1 |
| 192 | 4978 | acydburn | WHERE msg_id = $id"; |
| 193 | 4883 | acydburn | $db->sql_query($sql); |
| 194 | 4883 | acydburn | } |
| 195 | 3604 | ludovic_arnaud | } |
| 196 | 3604 | ludovic_arnaud | |
| 197 | 4978 | acydburn | // Send Notifications
|
| 198 | 4978 | acydburn | // PM: Reported Post is put into all admin's boxes (not notifying about 'this' PM)
|
| 199 | 4978 | acydburn | // All persons get notified about a new report, if notified by PM, send out email notifications too
|
| 200 | 4978 | acydburn | |
| 201 | 4978 | acydburn | // Send notifications to moderators
|
| 202 | 4978 | acydburn | $acl_list = ($report_post) ? $auth->acl_get_list(false, array('m_', 'a_'), array(0, $report_data['forum_id'])) : $auth->acl_get_list(false, 'a_', 0); |
| 203 | 4978 | acydburn | $notify_user = ($report_post) ? $acl_list[$report_data['forum_id']]['m_'] : array(); |
| 204 | 4978 | acydburn | $notify_user = array_unique(array_merge($notify_user, $acl_list[0]['a_'])); |
| 205 | 4978 | acydburn | unset($acl_list); |
| 206 | 4978 | acydburn | |
| 207 | 4978 | acydburn | // Send reported PM to responsible persons (admins)
|
| 208 | 4978 | acydburn | if (!$report_post) |
| 209 | 4978 | acydburn | {
|
| 210 | 4978 | acydburn | foreach ($notify_user as $user_id) |
| 211 | 4978 | acydburn | {
|
| 212 | 4978 | acydburn | $db->sql_query('INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', array( |
| 213 | 4978 | acydburn | 'msg_id' => (int) $id, |
| 214 | 4978 | acydburn | 'user_id' => (int) $user_id, |
| 215 | 4978 | acydburn | 'author_id' => (int) $report_data['author_id'], |
| 216 | 4978 | acydburn | 'folder_id' => PRIVMSGS_NO_BOX, |
| 217 | 4978 | acydburn | 'new' => 1, |
| 218 | 4978 | acydburn | 'unread' => 1, |
| 219 | 4978 | acydburn | 'forwarded' => 0)) |
| 220 | 4978 | acydburn | ); |
| 221 | 4978 | acydburn | } |
| 222 | 4978 | acydburn | |
| 223 | 4978 | acydburn | // Update Status
|
| 224 | 4978 | acydburn | $sql = 'UPDATE ' . USERS_TABLE . ' |
| 225 | 4978 | acydburn | SET user_new_privmsg = user_new_privmsg + 1, user_unread_privmsg = user_unread_privmsg + 1 |
| 226 | 4978 | acydburn | WHERE user_id IN (' . implode(', ', $notify_user) . ')'; |
| 227 | 4978 | acydburn | $db->sql_query($sql); |
| 228 | 4978 | acydburn | } |
| 229 | 4978 | acydburn | |
| 230 | 4978 | acydburn | // How to notify them?
|
| 231 | 4978 | acydburn | $sql = 'SELECT user_id, username, user_options, user_lang, user_email, user_notify_type, user_jabber |
| 232 | 4978 | acydburn | FROM ' . USERS_TABLE . ' |
| 233 | 4978 | acydburn | WHERE user_id IN (' . implode(', ', $notify_user) . ')'; |
| 234 | 4978 | acydburn | $result = $db->sql_query($sql); |
| 235 | 4978 | acydburn | |
| 236 | 4978 | acydburn | $notify_user = array(); |
| 237 | 4978 | acydburn | while ($row = $db->sql_fetchrow($result)) |
| 238 | 4978 | acydburn | {
|
| 239 | 4978 | acydburn | $notify_user[$row['user_id']] = array( |
| 240 | 4978 | acydburn | 'name' => $row['username'], |
| 241 | 4978 | acydburn | 'email' => $row['user_email'], |
| 242 | 4978 | acydburn | 'jabber'=> $row['user_jabber'], |
| 243 | 4978 | acydburn | 'lang' => $row['user_lang'], |
| 244 | 4978 | acydburn | 'notify_type' => $row['user_notify_type'], |
| 245 | 4978 | acydburn | |
| 246 | 4978 | acydburn | 'pm' => $user->optionget('report_pm_notify', $row['user_options']) |
| 247 | 4978 | acydburn | ); |
| 248 | 4978 | acydburn | } |
| 249 | 4978 | acydburn | $db->sql_freeresult($result); |
| 250 | 4978 | acydburn | |
| 251 | 4978 | acydburn | $report_data = array( |
| 252 | 4978 | acydburn | 'id' => $id, |
| 253 | 4978 | acydburn | 'report_id' => $report_id, |
| 254 | 4978 | acydburn | 'reporter' => $user->data['username'], |
| 255 | 4978 | acydburn | 'reason' => $reason_desc, |
| 256 | 4978 | acydburn | 'text' => $report_text, |
| 257 | 4978 | acydburn | 'subject' => ($report_post) ? $report_data['post_subject'] : $report_data['message_subject'], |
| 258 | 4978 | acydburn | 'view_post' => ($report_post) ? "viewtopic.$phpEx?f={$report_data['forum_id']}&t={$report_data['topic_id']}&p=$id&e=$id" : '' |
| 259 | 4978 | acydburn | ); |
| 260 | 4978 | acydburn | |
| 261 | 4978 | acydburn | report_notification($notify_user, $report_post, $report_data); |
| 262 | 4978 | acydburn | |
| 263 | 4883 | acydburn | meta_refresh(3, $redirect_url); |
| 264 | 3798 | ludovic_arnaud | |
| 265 | 4978 | acydburn | $message = $user->lang[(($report_post) ? 'POST' : 'MESSAGE') . '_REPORTED_SUCCESS'] . '<br /><br />' . sprintf($user->lang[(($report_post) ? 'RETURN_TOPIC' : 'RETURN_MESSAGE')], '<a href="' . $redirect_url . '">', '</a>'); |
| 266 | 3953 | psotfx | trigger_error($message); |
| 267 | 3604 | ludovic_arnaud | } |
| 268 | 3604 | ludovic_arnaud | |
| 269 | 3953 | psotfx | |
| 270 | 3604 | ludovic_arnaud | // Generate the form
|
| 271 | 3953 | psotfx | $sql = 'SELECT * |
| 272 | 3953 | psotfx | FROM ' . REASONS_TABLE . ' |
| 273 | 3953 | psotfx | ORDER BY reason_priority ASC';
|
| 274 | 3953 | psotfx | $result = $db->sql_query($sql); |
| 275 | 3604 | ludovic_arnaud | |
| 276 | 3604 | ludovic_arnaud | while ($row = $db->sql_fetchrow($result)) |
| 277 | 3604 | ludovic_arnaud | {
|
| 278 | 4883 | acydburn | $row['reason_name'] = strtoupper($row['reason_name']); |
| 279 | 3604 | ludovic_arnaud | |
| 280 | 4883 | acydburn | $reason_title = (!empty($user->lang['report_reasons']['TITLE'][$row['reason_name']])) ? $user->lang['report_reasons']['TITLE'][$row['reason_name']] : ucwords(str_replace('_', ' ', $row['reason_name'])); |
| 281 | 3604 | ludovic_arnaud | |
| 282 | 5153 | bartvb | $reason_desc = (!empty($user->lang['report_reasons']['DESCRIPTION'][$row['reason_name']])) ? $user->lang['report_reasons']['DESCRIPTION'][$row['reason_name']] : $row['reason_description']; |
| 283 | 3953 | psotfx | |
| 284 | 3604 | ludovic_arnaud | $template->assign_block_vars('reason', array( |
| 285 | 3604 | ludovic_arnaud | 'ID' => $row['reason_id'], |
| 286 | 4445 | ludovic_arnaud | 'NAME' => htmlspecialchars($reason_title), |
| 287 | 4445 | ludovic_arnaud | 'DESCRIPTION' => htmlspecialchars($reason_desc), |
| 288 | 4978 | acydburn | 'S_SELECTED' => ($row['reason_id'] == $reason_id) ? true : false) |
| 289 | 4978 | acydburn | ); |
| 290 | 3604 | ludovic_arnaud | } |
| 291 | 3604 | ludovic_arnaud | |
| 292 | 4978 | acydburn | $u_report = ($report_post) ? "p=$id" : "pm=$id"; |
| 293 | 4883 | acydburn | |
| 294 | 4012 | ludovic_arnaud | $template->assign_vars(array( |
| 295 | 4978 | acydburn | 'REPORT_TEXT' => $report_text, |
| 296 | 4978 | acydburn | 'S_REPORT_ACTION' => "{$phpbb_root_path}report.$phpEx$SID&$u_report" . (($report_id) ? "&report_id=$report_id" : ''), |
| 297 | 4445 | ludovic_arnaud | |
| 298 | 4978 | acydburn | 'S_NOTIFY' => (!empty($user_notify)) ? true : false, |
| 299 | 5117 | acydburn | 'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false, |
| 300 | 4978 | acydburn | 'S_REPORT_POST' => $report_post) |
| 301 | 4883 | acydburn | ); |
| 302 | 3953 | psotfx | |
| 303 | 4978 | acydburn | if ($report_post) |
| 304 | 4883 | acydburn | {
|
| 305 | 4883 | acydburn | generate_forum_nav($report_data);
|
| 306 | 4883 | acydburn | } |
| 307 | 3953 | psotfx | |
| 308 | 3953 | psotfx | // Start output of page
|
| 309 | 4978 | acydburn | $page_title = ($report_post) ? $user->lang['REPORT_POST'] : $user->lang['REPORT_MESSAGE']; |
| 310 | 4978 | acydburn | page_header($page_title);
|
| 311 | 3953 | psotfx | |
| 312 | 3604 | ludovic_arnaud | $template->set_filenames(array( |
| 313 | 3953 | psotfx | 'body' => 'report_body.html') |
| 314 | 3953 | psotfx | ); |
| 315 | 3604 | ludovic_arnaud | |
| 316 | 4012 | ludovic_arnaud | page_footer(); |
| 317 | 3604 | ludovic_arnaud | |
| 318 | 4978 | acydburn | function report_notification($notify_user, $report_post, $report_data) |
| 319 | 4978 | acydburn | {
|
| 320 | 4978 | acydburn | global $config, $phpbb_root_path, $phpEx; |
| 321 | 4978 | acydburn | |
| 322 | 4978 | acydburn | include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); |
| 323 | 4978 | acydburn | include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); |
| 324 | 4978 | acydburn | $messenger = new messenger(); |
| 325 | 4978 | acydburn | |
| 326 | 4978 | acydburn | $email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']); |
| 327 | 4978 | acydburn | $email_template = ($report_post) ? 'new_report_post' : 'new_report_pm'; |
| 328 | 4978 | acydburn | $view_report_url = ($report_post) ? "mcp.$phpEx?i=queue&r=" . $report_data['report_id'] : "ucp.$phpEx?i=pm&p=" . $report_data['id'] . "&r=" . $report_data['report_id']; |
| 329 | 4978 | acydburn | |
| 330 | 4978 | acydburn | foreach ($notify_user as $user_id => $notify_row) |
| 331 | 4978 | acydburn | {
|
| 332 | 4978 | acydburn | // Send notification by email
|
| 333 | 4978 | acydburn | if (!$notify_row['pm']) |
| 334 | 4978 | acydburn | {
|
| 335 | 4978 | acydburn | $messenger->to($notify_row['email'], $notify_row['name']); |
| 336 | 4978 | acydburn | $messenger->im($notify_row['jabber'], $notify_row['name']); |
| 337 | 4978 | acydburn | $messenger->replyto($config['board_email']); |
| 338 | 4978 | acydburn | |
| 339 | 4978 | acydburn | $messenger->template($email_template, $notify_row['lang']); |
| 340 | 4978 | acydburn | |
| 341 | 4978 | acydburn | $messenger->assign_vars(array( |
| 342 | 4978 | acydburn | 'EMAIL_SIG' => $email_sig, |
| 343 | 4978 | acydburn | 'SITENAME' => $config['sitename'], |
| 344 | 4978 | acydburn | 'USERNAME' => $notify_row['name'], |
| 345 | 4978 | acydburn | 'SUBJECT' => $report_data['subject'], |
| 346 | 4978 | acydburn | 'REPORTER' => $report_data['reporter'], |
| 347 | 4978 | acydburn | |
| 348 | 4978 | acydburn | 'REPORT_REASON' => $report_data['reason'], |
| 349 | 4978 | acydburn | 'REPORT_TEXT' => $report_data['text'], |
| 350 | 4978 | acydburn | |
| 351 | 4978 | acydburn | 'U_VIEW_REPORT' => generate_board_url() . '/' . $view_report_url, |
| 352 | 4978 | acydburn | 'U_VIEW_POST' => generate_board_url() . '/' . $report_data['view_post']) |
| 353 | 4978 | acydburn | ); |
| 354 | 4978 | acydburn | |
| 355 | 4978 | acydburn | $messenger->send($notify_row['notify_type']); |
| 356 | 4978 | acydburn | $messenger->reset(); |
| 357 | 4978 | acydburn | |
| 358 | 5114 | acydburn | $messenger->save_queue();
|
| 359 | 4978 | acydburn | } |
| 360 | 4978 | acydburn | else
|
| 361 | 4978 | acydburn | {
|
| 362 | 4978 | acydburn | // Use messenger for getting the correct message, we use the email template
|
| 363 | 4978 | acydburn | $messenger->template($email_template, $notify_row['lang']); |
| 364 | 4978 | acydburn | |
| 365 | 4978 | acydburn | $messenger->assign_vars(array( |
| 366 | 4978 | acydburn | 'EMAIL_SIG' => $email_sig, |
| 367 | 4978 | acydburn | 'SITENAME' => $config['sitename'], |
| 368 | 4978 | acydburn | 'USERNAME' => $notify_row['name'], |
| 369 | 4978 | acydburn | 'SUBJECT' => $report_data['subject'], |
| 370 | 4978 | acydburn | 'REPORTER' => $report_data['reporter'], |
| 371 | 4978 | acydburn | |
| 372 | 4978 | acydburn | 'REPORT_REASON' => $report_data['reason'], |
| 373 | 4978 | acydburn | 'REPORT_TEXT' => $report_data['text'], |
| 374 | 4978 | acydburn | |
| 375 | 4978 | acydburn | 'U_VIEW_REPORT' => generate_board_url() . '/' . $view_report_url) |
| 376 | 4978 | acydburn | ); |
| 377 | 4978 | acydburn | |
| 378 | 4978 | acydburn | // break the sending process...
|
| 379 | 4978 | acydburn | $messenger->send(false, true); |
| 380 | 4978 | acydburn | $messenger->reset(); |
| 381 | 4978 | acydburn | |
| 382 | 4978 | acydburn | // do not put in reporters outbox
|
| 383 | 4978 | acydburn | submit_pm('post', $report_data['subject'], '', array(), array(), array( |
| 384 | 5250 | acydburn | 'address_list' => array('u' => array($user_id => 'to')), |
| 385 | 5250 | acydburn | 'from_user_id' => $user->data['user_id'], |
| 386 | 5250 | acydburn | 'from_user_ip' => $user->ip, |
| 387 | 5255 | acydburn | 'from_username' => $user->data['username'], |
| 388 | 5250 | acydburn | 'icon_id' => 0, |
| 389 | 4978 | acydburn | 'enable_bbcode' => 0, |
| 390 | 4978 | acydburn | 'enable_html' => 0, |
| 391 | 4978 | acydburn | 'enable_smilies' => 0, |
| 392 | 4978 | acydburn | 'enable_magic_url' => 1, |
| 393 | 4978 | acydburn | 'enable_sig' => 0, |
| 394 | 4978 | acydburn | 'message_md5' => md5($messenger->msg), |
| 395 | 4978 | acydburn | 'bbcode_bitfield' => 0, |
| 396 | 4978 | acydburn | 'bbcode_uid' => 0, |
| 397 | 4978 | acydburn | 'attachment_data' => array(), |
| 398 | 4978 | acydburn | 'filename_data' => array(), |
| 399 | 5250 | acydburn | 'message' => $messenger->msg |
| 400 | 4978 | acydburn | ), true, false); |
| 401 | 4978 | acydburn | } |
| 402 | 4978 | acydburn | } |
| 403 | 4978 | acydburn | unset($messenger); |
| 404 | 4978 | acydburn | } |
| 405 | 4978 | acydburn | |
| 406 | 3604 | ludovic_arnaud | ?> |

