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_front.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 14.20 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 Front Panel
024  */
025  function mcp_front_view($id, $mode, $action)
026  {
027      global $phpEx, $phpbb_root_path, $config;
028      global $template, $db, $user, $auth, $module;
029      global $phpbb_dispatcher;
030   
031      // Latest 5 unapproved
032      if ($module->loaded('queue'))
033      {
034          $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_approve')));
035          $post_list = array();
036          $forum_names = array();
037   
038          $forum_id = request_var('f', 0);
039   
040          $template->assign_var('S_SHOW_UNAPPROVED', (!empty($forum_list)) ? true : false);
041   
042          if (!empty($forum_list))
043          {
044              $sql = 'SELECT COUNT(post_id) AS total
045                  FROM ' . POSTS_TABLE . '
046                  WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '
047                      AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE));
048              $result = $db->sql_query($sql);
049              $total = (int) $db->sql_fetchfield('total');
050              $db->sql_freeresult($result);
051   
052              if ($total)
053              {
054                  $sql = 'SELECT forum_id, forum_name
055                      FROM ' . FORUMS_TABLE . '
056                      WHERE ' . $db->sql_in_set('forum_id', $forum_list);
057                  $result = $db->sql_query($sql);
058   
059                  while ($row = $db->sql_fetchrow($result))
060                  {
061                      $forum_names[$row['forum_id']] = $row['forum_name'];
062                  }
063                  $db->sql_freeresult($result);
064   
065                  $sql = 'SELECT post_id
066                      FROM ' . POSTS_TABLE . '
067                      WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '
068                          AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) . '
069                      ORDER BY post_time DESC, post_id DESC';
070                  $result = $db->sql_query_limit($sql, 5);
071   
072                  while ($row = $db->sql_fetchrow($result))
073                  {
074                      $post_list[] = $row['post_id'];
075                  }
076                  $db->sql_freeresult($result);
077   
078                  if (empty($post_list))
079                  {
080                      $total = 0;
081                  }
082              }
083   
084              /**
085              * Alter list of posts and total as required
086              *
087              * @event core.mcp_front_view_queue_postid_list_after
088              * @var    int        total                        Number of unapproved posts
089              * @var    array    post_list                    List of unapproved posts
090              * @var    array    forum_list                    List of forums that contain the posts
091              * @var    array    forum_names                    Associative array with forum_id as key and it's corresponding forum_name as value
092              * @since 3.1.0-RC3
093              */
094              $vars = array('total', 'post_list', 'forum_list', 'forum_names');
095              extract($phpbb_dispatcher->trigger_event('core.mcp_front_view_queue_postid_list_after', compact($vars)));
096   
097              if ($total)
098              {
099                  $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.post_attachment, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id
100                      FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
101                      WHERE ' . $db->sql_in_set('p.post_id', $post_list) . '
102                          AND t.topic_id = p.topic_id
103                          AND p.poster_id = u.user_id
104                      ORDER BY p.post_time DESC, p.post_id DESC';
105                  $result = $db->sql_query($sql);
106   
107                  while ($row = $db->sql_fetchrow($result))
108                  {
109                      $template->assign_block_vars('unapproved', array(
110                          'U_POST_DETAILS'    => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=approve_details&amp;f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']),
111                          'U_MCP_FORUM'        => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=forum_view&amp;f=' . $row['forum_id']),
112                          'U_MCP_TOPIC'        => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=topic_view&amp;f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
113                          'U_FORUM'            => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
114                          'U_TOPIC'            => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
115   
116                          'AUTHOR_FULL'        => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour']),
117                          'AUTHOR'            => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour']),
118                          'AUTHOR_COLOUR'        => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour']),
119                          'U_AUTHOR'            => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour']),
120   
121                          'FORUM_NAME'    => $forum_names[$row['forum_id']],
122                          'POST_ID'        => $row['post_id'],
123                          'TOPIC_TITLE'    => $row['topic_title'],
124                          'SUBJECT'        => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
125                          'POST_TIME'        => $user->format_date($row['post_time']),
126                          'ATTACH_ICON_IMG'    => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
127                      ));
128                  }
129                  $db->sql_freeresult($result);
130              }
131   
132              $s_hidden_fields = build_hidden_fields(array(
133                  'redirect'        => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main' . (($forum_id) ? '&amp;f=' . $forum_id : ''))
134              ));
135   
136              $template->assign_vars(array(
137                  'S_HIDDEN_FIELDS'        => $s_hidden_fields,
138                  'S_MCP_QUEUE_ACTION'    => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue"),
139                  'L_UNAPPROVED_TOTAL'    => $user->lang('UNAPPROVED_POSTS_TOTAL', (int) $total),
140                  'S_HAS_UNAPPROVED_POSTS'=> ($total != 0),
141              ));
142          }
143      }
144   
145      // Latest 5 reported
146      if ($module->loaded('reports'))
147      {
148          $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_report')));
149   
150          $template->assign_var('S_SHOW_REPORTS', (!empty($forum_list)) ? true : false);
151   
152          if (!empty($forum_list))
153          {
154              $sql = 'SELECT COUNT(r.report_id) AS total
155                  FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p
156                  WHERE r.post_id = p.post_id
157                      AND r.pm_id = 0
158                      AND r.report_closed = 0
159                      AND ' . $db->sql_in_set('p.forum_id', $forum_list);
160              $result = $db->sql_query($sql);
161              $total = (int) $db->sql_fetchfield('total');
162              $db->sql_freeresult($result);
163   
164              if ($total)
165              {
166                  $sql_ary = array(
167                      'SELECT'    => 'r.report_time, p.post_id, p.post_subject, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id, t.topic_id, t.topic_title, f.forum_id, f.forum_name',
168   
169                      'FROM'        => array(
170                          REPORTS_TABLE            => 'r',
171                          REPORTS_REASONS_TABLE    => 'rr',
172                          TOPICS_TABLE            => 't',
173                          USERS_TABLE                => array('u', 'u2'),
174                          POSTS_TABLE                => 'p',
175                      ),
176   
177                      'LEFT_JOIN'    => array(
178                          array(
179                              'FROM'    => array(FORUMS_TABLE => 'f'),
180                              'ON'    => 'f.forum_id = p.forum_id',
181                          ),
182                      ),
183   
184                      'WHERE'        => 'r.post_id = p.post_id
185                          AND r.pm_id = 0
186                          AND r.report_closed = 0
187                          AND r.reason_id = rr.reason_id
188                          AND p.topic_id = t.topic_id
189                          AND r.user_id = u.user_id
190                          AND p.poster_id = u2.user_id
191                          AND ' . $db->sql_in_set('p.forum_id', $forum_list),
192   
193                      'ORDER_BY'    => 'p.post_time DESC, p.post_id DESC',
194                  );
195   
196                  /**
197                  * Alter sql query to get latest reported posts
198                  *
199                  * @event core.mcp_front_reports_listing_query_before
200                  * @var    int        sql_ary                        Associative array with the query to be executed
201                  * @var    array    forum_list                    List of forums that contain the posts
202                  * @since 3.1.0-RC3
203                  */
204                  $vars = array('sql_ary', 'forum_list');
205                  extract($phpbb_dispatcher->trigger_event('core.mcp_front_reports_listing_query_before', compact($vars)));
206   
207                  $sql = $db->sql_build_query('SELECT', $sql_ary);
208                  $result = $db->sql_query_limit($sql, 5);
209   
210                  while ($row = $db->sql_fetchrow($result))
211                  {
212                      $template->assign_block_vars('report', array(
213                          'U_POST_DETAILS'    => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id'] . "&amp;i=reports&amp;mode=report_details"),
214                          'U_MCP_FORUM'        => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . "&amp;i=$id&amp;mode=forum_view"),
215                          'U_MCP_TOPIC'        => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id'] . "&amp;i=$id&amp;mode=topic_view"),
216                          'U_FORUM'            => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
217                          'U_TOPIC'            => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
218   
219                          'REPORTER_FULL'        => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
220                          'REPORTER'            => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
221                          'REPORTER_COLOUR'    => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
222                          'U_REPORTER'        => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
223   
224                          'AUTHOR_FULL'        => get_username_string('full', $row['author_id'], $row['author_name'], $row['author_colour']),
225                          'AUTHOR'            => get_username_string('username', $row['author_id'], $row['author_name'], $row['author_colour']),
226                          'AUTHOR_COLOUR'        => get_username_string('colour', $row['author_id'], $row['author_name'], $row['author_colour']),
227                          'U_AUTHOR'            => get_username_string('profile', $row['author_id'], $row['author_name'], $row['author_colour']),
228   
229                          'FORUM_NAME'    => $row['forum_name'],
230                          'TOPIC_TITLE'    => $row['topic_title'],
231                          'SUBJECT'        => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
232                          'REPORT_TIME'    => $user->format_date($row['report_time']),
233                          'POST_TIME'        => $user->format_date($row['post_time']),
234                          'ATTACH_ICON_IMG'    => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
235                      ));
236                  }
237              }
238   
239              $template->assign_vars(array(
240                  'L_REPORTS_TOTAL'    => $user->lang('REPORTS_TOTAL', (int) $total),
241                  'S_HAS_REPORTS'        => ($total != 0),
242              ));
243          }
244      }
245   
246      // Latest 5 reported PMs
247      if ($module->loaded('pm_reports') && $auth->acl_getf_global('m_report'))
248      {
249          $template->assign_var('S_SHOW_PM_REPORTS', true);
250          $user->add_lang(array('ucp'));
251   
252          $sql = 'SELECT COUNT(r.report_id) AS total
253              FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . ' p
254              WHERE r.post_id = 0
255                  AND r.pm_id = p.msg_id
256                  AND r.report_closed = 0';
257          $result = $db->sql_query($sql);
258          $total = (int) $db->sql_fetchfield('total');
259          $db->sql_freeresult($result);
260   
261          if ($total)
262          {
263              include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
264   
265              $sql_ary = array(
266                  'SELECT'    => 'r.report_id, r.report_time, p.msg_id, p.message_subject, p.message_time, p.to_address, p.bcc_address, p.message_attachment, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id',
267   
268                  'FROM'        => array(
269                      REPORTS_TABLE            => 'r',
270                      REPORTS_REASONS_TABLE    => 'rr',
271                      USERS_TABLE                => array('u', 'u2'),
272                      PRIVMSGS_TABLE                => 'p',
273                  ),
274   
275                  'WHERE'        => 'r.pm_id = p.msg_id
276                      AND r.post_id = 0
277                      AND r.report_closed = 0
278                      AND r.reason_id = rr.reason_id
279                      AND r.user_id = u.user_id
280                      AND p.author_id = u2.user_id',
281   
282                  'ORDER_BY'    => 'p.message_time DESC',
283              );
284              $sql = $db->sql_build_query('SELECT', $sql_ary);
285              $result = $db->sql_query_limit($sql, 5);
286   
287              $pm_by_id = $pm_list = array();
288              while ($row = $db->sql_fetchrow($result))
289              {
290                  $pm_by_id[(int) $row['msg_id']] = $row;
291                  $pm_list[] = (int) $row['msg_id'];
292              }
293   
294              $address_list = get_recipient_strings($pm_by_id);
295   
296              foreach ($pm_list as $message_id)
297              {
298                  $row = $pm_by_id[$message_id];
299   
300                  $template->assign_block_vars('pm_report', array(
301                      'U_PM_DETAILS'    => append_sid("{$phpbb_root_path}mcp.$phpEx", 'r=' . $row['report_id'] . "&amp;i=pm_reports&amp;mode=pm_report_details"),
302   
303                      'REPORTER_FULL'        => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
304                      'REPORTER'            => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
305                      'REPORTER_COLOUR'    => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
306                      'U_REPORTER'        => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
307   
308                      'PM_AUTHOR_FULL'        => get_username_string('full', $row['author_id'], $row['author_name'], $row['author_colour']),
309                      'PM_AUTHOR'            => get_username_string('username', $row['author_id'], $row['author_name'], $row['author_colour']),
310                      'PM_AUTHOR_COLOUR'        => get_username_string('colour', $row['author_id'], $row['author_name'], $row['author_colour']),
311                      'U_PM_AUTHOR'            => get_username_string('profile', $row['author_id'], $row['author_name'], $row['author_colour']),
312   
313                      'PM_SUBJECT'        => $row['message_subject'],
314                      'REPORT_TIME'        => $user->format_date($row['report_time']),
315                      'PM_TIME'            => $user->format_date($row['message_time']),
316                      'RECIPIENTS'        => implode(', ', $address_list[$row['msg_id']]),
317                      'ATTACH_ICON_IMG'    => ($auth->acl_get('u_download') && $row['message_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
318                  ));
319              }
320          }
321   
322          $template->assign_vars(array(
323              'L_PM_REPORTS_TOTAL'    => $user->lang('PM_REPORTS_TOTAL', (int) $total),
324              'S_HAS_PM_REPORTS'        => ($total != 0),
325          ));
326      }
327   
328      // Latest 5 logs
329      if ($module->loaded('logs'))
330      {
331          $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_')));
332   
333          if (!empty($forum_list))
334          {
335              $log_count = false;
336              $log = array();
337              view_log('mod', $log, $log_count, 5, 0, $forum_list);
338   
339              foreach ($log as $row)
340              {
341                  $template->assign_block_vars('log', array(
342                      'USERNAME'        => $row['username_full'],
343                      'IP'            => $row['ip'],
344                      'TIME'            => $user->format_date($row['time']),
345                      'ACTION'        => $row['action'],
346                      'U_VIEW_TOPIC'    => (!empty($row['viewtopic'])) ? $row['viewtopic'] : '',
347                      'U_VIEWLOGS'    => (!empty($row['viewlogs'])) ? $row['viewlogs'] : '')
348                  );
349              }
350          }
351   
352          $template->assign_vars(array(
353              'S_SHOW_LOGS'    => (!empty($forum_list)) ? true : false,
354              'S_HAS_LOGS'    => (!empty($log)) ? true : false)
355          );
356      }
357   
358      $template->assign_var('S_MCP_ACTION', append_sid("{$phpbb_root_path}mcp.$phpEx"));
359      make_jumpbox(append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=forum_view'), 0, false, 'm_', true);
360  }
361