Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

mcp_pm_reports.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 12.87 KiB


001  <?php
002  /**
003  *
004  * This file is part of the phpBB Forum Software package.
005  *
006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
007  * @license GNU General Public License, version 2 (GPL-2.0)
008  *
009  * For full copyright and license information, please see
010  * the docs/CREDITS.txt file.
011  *
012  */
013   
014  /**
015  * @ignore
016  */
017  if (!defined('IN_PHPBB'))
018  {
019      exit;
020  }
021   
022  /**
023  * mcp_reports
024  * Handling the reports queue
025  */
026  class mcp_pm_reports
027  {
028      var $p_master;
029      var $u_action;
030   
031      function mcp_pm_reports(&$p_master)
032      {
033          $this->p_master = &$p_master;
034      }
035   
036      function main($id, $mode)
037      {
038          global $auth, $db, $user, $template, $cache;
039          global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container;
040   
041          include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
042          include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
043   
044          $start = request_var('start', 0);
045          $pagination = $phpbb_container->get('pagination');
046   
047          $this->page_title = 'MCP_PM_REPORTS';
048   
049          switch ($action)
050          {
051              case 'close':
052              case 'delete':
053                  include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
054   
055                  $report_id_list = request_var('report_id_list', array(0));
056   
057                  if (!sizeof($report_id_list))
058                  {
059                      trigger_error('NO_REPORT_SELECTED');
060                  }
061   
062                  if (!function_exists('close_report'))
063                  {
064                      include($phpbb_root_path . 'includes/mcp/mcp_reports.' . $phpEx);
065                  }
066   
067                  close_report($report_id_list, $mode, $action, true);
068   
069              break;
070          }
071   
072          switch ($mode)
073          {
074              case 'pm_report_details':
075   
076                  $user->add_lang(array('posting', 'viewforum', 'viewtopic', 'ucp'));
077   
078                  $report_id = request_var('r', 0);
079   
080                  $sql = 'SELECT r.pm_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour
081                      FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u
082                      WHERE r.report_id = ' . $report_id . '
083                          AND rr.reason_id = r.reason_id
084                          AND r.user_id = u.user_id
085                          AND r.post_id = 0
086                      ORDER BY report_closed ASC';
087                  $result = $db->sql_query_limit($sql, 1);
088                  $report = $db->sql_fetchrow($result);
089                  $db->sql_freeresult($result);
090   
091                  if (!$report_id || !$report)
092                  {
093                      trigger_error('NO_REPORT');
094                  }
095   
096                  $phpbb_notifications = $phpbb_container->get('notification_manager');
097   
098                  $phpbb_notifications->mark_notifications_read_by_parent('notification.type.report_pm', $report_id, $user->data['user_id']);
099   
100                  $pm_id = $report['pm_id'];
101                  $report_id = $report['report_id'];
102   
103                  $pm_info = phpbb_get_pm_data(array($pm_id));
104   
105                  if (!sizeof($pm_info))
106                  {
107                      trigger_error('NO_REPORT_SELECTED');
108                  }
109   
110                  $pm_info = $pm_info[$pm_id];
111   
112                  write_pm_addresses(array('to' => $pm_info['to_address'], 'bcc' => $pm_info['bcc_address']), (int) $pm_info['author_id']);
113   
114                  $reason = array('title' => $report['reason_title'], 'description' => $report['reason_description']);
115                  if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])]))
116                  {
117                      $reason['description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])];
118                      $reason['title'] = $user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])];
119                  }
120   
121                  // Process message, leave it uncensored
122                  $parse_flags = ($pm_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
123                  $message = generate_text_for_display($pm_info['message_text'], $pm_info['bbcode_uid'], $pm_info['bbcode_bitfield'], $parse_flags, false);
124   
125                  $report['report_text'] = make_clickable(bbcode_nl2br($report['report_text']));
126   
127                  if ($pm_info['message_attachment'] && $auth->acl_get('u_pm_download'))
128                  {
129                      $sql = 'SELECT *
130                          FROM ' . ATTACHMENTS_TABLE . '
131                          WHERE post_msg_id = ' . $pm_id . '
132                              AND in_message = 1
133                          ORDER BY filetime DESC';
134                      $result = $db->sql_query($sql);
135   
136                      while ($row = $db->sql_fetchrow($result))
137                      {
138                          $attachments[] = $row;
139                      }
140                      $db->sql_freeresult($result);
141   
142                      if (sizeof($attachments))
143                      {
144                          $update_count = array();
145                          parse_attachments(0, $message, $attachments, $update_count);
146                      }
147   
148                      // Display not already displayed Attachments for this post, we already parsed them. ;)
149                      if (!empty($attachments))
150                      {
151                          $template->assign_var('S_HAS_ATTACHMENTS', true);
152   
153                          foreach ($attachments as $attachment)
154                          {
155                              $template->assign_block_vars('attachment', array(
156                                  'DISPLAY_ATTACHMENT'    => $attachment)
157                              );
158                          }
159                      }
160                  }
161   
162                  $template->assign_vars(array(
163                      'S_MCP_REPORT'            => true,
164                      'S_PM'                    => true,
165                      'S_CLOSE_ACTION'        => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports&amp;mode=pm_report_details&amp;r=' . $report_id),
166                      'S_CAN_VIEWIP'            => $auth->acl_getf_global('m_info'),
167                      'S_POST_REPORTED'        => $pm_info['message_reported'],
168                      'S_REPORT_CLOSED'        => $report['report_closed'],
169                      'S_USER_NOTES'            => true,
170   
171                      'U_MCP_REPORT'                => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports&amp;mode=pm_report_details&amp;r=' . $report_id),
172                      'U_MCP_REPORTER_NOTES'        => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&amp;mode=user_notes&amp;u=' . $report['user_id']),
173                      'U_MCP_USER_NOTES'            => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&amp;mode=user_notes&amp;u=' . $pm_info['author_id']),
174                      'U_MCP_WARN_REPORTER'        => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&amp;mode=warn_user&amp;u=' . $report['user_id']) : '',
175                      'U_MCP_WARN_USER'            => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&amp;mode=warn_user&amp;u=' . $pm_info['author_id']) : '',
176   
177                      'EDIT_IMG'                => $user->img('icon_post_edit', $user->lang['EDIT_POST']),
178                      'MINI_POST_IMG'            => $user->img('icon_post_target', 'POST'),
179   
180                      'RETURN_REPORTS'            => sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports' . (($pm_info['message_reported']) ? '&amp;mode=pm_reports' : '&amp;mode=pm_reports_closed') . '&amp;start=' . $start) . '">', '</a>'),
181                      'REPORTED_IMG'                => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
182                      'REPORT_DATE'                => $user->format_date($report['report_time']),
183                      'REPORT_ID'                    => $report_id,
184                      'REPORT_REASON_TITLE'        => $reason['title'],
185                      'REPORT_REASON_DESCRIPTION'    => $reason['description'],
186                      'REPORT_TEXT'                => $report['report_text'],
187   
188                      'POST_AUTHOR_FULL'        => get_username_string('full', $pm_info['author_id'], $pm_info['username'], $pm_info['user_colour']),
189                      'POST_AUTHOR_COLOUR'    => get_username_string('colour', $pm_info['author_id'], $pm_info['username'], $pm_info['user_colour']),
190                      'POST_AUTHOR'            => get_username_string('username', $pm_info['author_id'], $pm_info['username'], $pm_info['user_colour']),
191                      'U_POST_AUTHOR'            => get_username_string('profile', $pm_info['author_id'], $pm_info['username'], $pm_info['user_colour']),
192   
193                      'REPORTER_FULL'                => get_username_string('full', $report['user_id'], $report['username'], $report['user_colour']),
194                      'REPORTER_COLOUR'            => get_username_string('colour', $report['user_id'], $report['username'], $report['user_colour']),
195                      'REPORTER_NAME'                => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']),
196                      'U_VIEW_REPORTER_PROFILE'    => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']),
197   
198                      'POST_PREVIEW'            => $message,
199                      'POST_SUBJECT'            => ($pm_info['message_subject']) ? $pm_info['message_subject'] : $user->lang['NO_SUBJECT'],
200                      'POST_DATE'                => $user->format_date($pm_info['message_time']),
201                      'POST_IP'                => $pm_info['author_ip'],
202                      'POST_IPADDR'            => ($auth->acl_getf_global('m_info') && request_var('lookup', '')) ? @gethostbyaddr($pm_info['author_ip']) : '',
203                      'POST_ID'                => $pm_info['msg_id'],
204   
205                      'U_LOOKUP_IP'            => ($auth->acl_getf_global('m_info')) ? $this->u_action . '&amp;r=' . $report_id . '&amp;pm=' . $pm_id . '&amp;lookup=' . $pm_info['author_ip'] . '#ip' : '',
206                  ));
207   
208                  $this->tpl_name = 'mcp_post';
209   
210              break;
211   
212              case 'pm_reports':
213              case 'pm_reports_closed':
214                  $user->add_lang(array('ucp'));
215   
216                  $sort_days = $total = 0;
217                  $sort_key = $sort_dir = '';
218                  $sort_by_sql = $sort_order_sql = array();
219                  phpbb_mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total);
220   
221                  $limit_time_sql = ($sort_days) ? 'AND r.report_time >= ' . (time() - ($sort_days * 86400)) : '';
222   
223                  if ($mode == 'pm_reports')
224                  {
225                      $report_state = 'p.message_reported = 1 AND r.report_closed = 0';
226                  }
227                  else
228                  {
229                      $report_state = 'r.report_closed = 1';
230                  }
231   
232                  $sql = 'SELECT r.report_id
233                      FROM ' . PRIVMSGS_TABLE . ' p, ' . REPORTS_TABLE . ' r ' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . (($sort_order_sql[0] == 'r') ? ', ' . USERS_TABLE . ' ru' : '') . "
234                      WHERE $report_state
235                          AND r.pm_id = p.msg_id
236                          " . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.author_id' : '') . '
237                          ' . (($sort_order_sql[0] == 'r') ? 'AND ru.user_id = r.user_id' : '') . "
238                          AND r.post_id = 0
239                          $limit_time_sql
240                      ORDER BY $sort_order_sql";
241                  $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
242   
243                  $i = 0;
244                  $report_ids = array();
245                  while ($row = $db->sql_fetchrow($result))
246                  {
247                      $report_ids[] = $row['report_id'];
248                      $row_num[$row['report_id']] = $i++;
249                  }
250                  $db->sql_freeresult($result);
251   
252                  if (sizeof($report_ids))
253                  {
254                      $sql = 'SELECT p.*, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id
255                          FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru
256                          WHERE ' . $db->sql_in_set('r.report_id', $report_ids) . "
257                              AND r.pm_id = p.msg_id
258                              AND p.author_id = u.user_id
259                              AND ru.user_id = r.user_id
260                          ORDER BY $sort_order_sql";
261                      $result = $db->sql_query($sql);
262   
263                      $pm_list = $pm_by_id = array();
264                      while ($row = $db->sql_fetchrow($result))
265                      {
266                          $pm_by_id[(int) $row['msg_id']] = $row;
267                          $pm_list[] = (int) $row['msg_id'];
268                      }
269                      $db->sql_freeresult($result);
270   
271                      if (sizeof($pm_list))
272                      {
273                          $address_list = get_recipient_strings($pm_by_id);
274   
275                          foreach ($pm_list as $message_id)
276                          {
277                              $row = $pm_by_id[$message_id];
278                              $template->assign_block_vars('postrow', array(
279                                  'U_VIEW_DETAILS'            => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=pm_reports&amp;mode=pm_report_details&amp;r={$row['report_id']}"),
280   
281                                  'PM_AUTHOR_FULL'        => get_username_string('full', $row['author_id'], $row['username'], $row['user_colour']),
282                                  'PM_AUTHOR_COLOUR'        => get_username_string('colour', $row['author_id'], $row['username'], $row['user_colour']),
283                                  'PM_AUTHOR'                => get_username_string('username', $row['author_id'], $row['username'], $row['user_colour']),
284                                  'U_PM_AUTHOR'            => get_username_string('profile', $row['author_id'], $row['username'], $row['user_colour']),
285   
286                                  'REPORTER_FULL'            => get_username_string('full', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
287                                  'REPORTER_COLOUR'        => get_username_string('colour', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
288                                  'REPORTER'                => get_username_string('username', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
289                                  'U_REPORTER'            => get_username_string('profile', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
290   
291                                  'PM_SUBJECT'            => ($row['message_subject']) ? $row['message_subject'] : $user->lang['NO_SUBJECT'],
292                                  'PM_TIME'                => $user->format_date($row['message_time']),
293                                  'REPORT_ID'                => $row['report_id'],
294                                  'REPORT_TIME'            => $user->format_date($row['report_time']),
295   
296                                  'RECIPIENTS'            => implode($user->lang['COMMA_SEPARATOR'], $address_list[$row['msg_id']]),
297                                  'ATTACH_ICON_IMG'        => ($auth->acl_get('u_download') && $row['message_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
298                              ));
299                          }
300                      }
301                  }
302   
303                  $base_url = $this->u_action . "&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir";
304                  $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
305   
306                  // Now display the page
307                  $template->assign_vars(array(
308                      'L_EXPLAIN'                => ($mode == 'pm_reports') ? $user->lang['MCP_PM_REPORTS_OPEN_EXPLAIN'] : $user->lang['MCP_PM_REPORTS_CLOSED_EXPLAIN'],
309                      'L_TITLE'                => ($mode == 'pm_reports') ? $user->lang['MCP_PM_REPORTS_OPEN'] : $user->lang['MCP_PM_REPORTS_CLOSED'],
310   
311                      'S_PM'                    => true,
312                      'S_MCP_ACTION'            => $this->u_action,
313                      'S_CLOSED'                => ($mode == 'pm_reports_closed') ? true : false,
314   
315                      'TOTAL'                    => $total,
316                      'TOTAL_REPORTS'            => $user->lang('LIST_REPORTS', (int) $total),
317                      )
318                  );
319   
320                  $this->tpl_name = 'mcp_reports';
321              break;
322          }
323      }
324  }
325