Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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