Verzeichnisstruktur phpBB-3.0.0


Veröffentlicht
12.12.2007

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:51 - Dateigröße: 9.58 KiB


001  <?php
002  /**
003  *
004  * @package mcp
005  * @version $Id$
006  * @copyright (c) 2005 phpBB Group
007  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
008  *
009  */
010   
011  /**
012  * @ignore
013  */
014  if (!defined('IN_PHPBB'))
015  {
016      exit;
017  }
018   
019  /**
020  * MCP Front Panel
021  */
022  function mcp_front_view($id, $mode, $action)
023  {
024      global $phpEx, $phpbb_root_path, $config;
025      global $template, $db, $user, $auth, $module;
026   
027      // Latest 5 unapproved
028      if ($module->loaded('queue'))
029      {
030          $forum_list = get_forum_list('m_approve');
031          $post_list = array();
032          $forum_names = array();
033   
034          $forum_id = request_var('f', 0);
035   
036          $template->assign_var('S_SHOW_UNAPPROVED', (!empty($forum_list)) ? true : false);
037          
038          if (!empty($forum_list))
039          {
040              $sql = 'SELECT COUNT(post_id) AS total
041                  FROM ' . POSTS_TABLE . '
042                  WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ')
043                      AND post_approved = 0';
044              $result = $db->sql_query($sql);
045              $total = (int) $db->sql_fetchfield('total');
046              $db->sql_freeresult($result);
047   
048              if ($total)
049              {
050                  $global_id = $forum_list[0];
051   
052                  $sql = 'SELECT forum_id, forum_name
053                      FROM ' . FORUMS_TABLE . '
054                      WHERE ' . $db->sql_in_set('forum_id', $forum_list);
055                  $result = $db->sql_query($sql);
056   
057                  while ($row = $db->sql_fetchrow($result))
058                  {
059                      $forum_names[$row['forum_id']] = $row['forum_name'];
060                  }
061                  $db->sql_freeresult($result);
062   
063                  $sql = 'SELECT post_id
064                      FROM ' . POSTS_TABLE . '
065                      WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ')
066                          AND post_approved = 0
067                      ORDER BY post_time DESC';
068                  $result = $db->sql_query_limit($sql, 5);
069   
070                  while ($row = $db->sql_fetchrow($result))
071                  {
072                      $post_list[] = $row['post_id'];
073                  }
074                  $db->sql_freeresult($result);
075   
076                  if (empty($post_list))
077                  {
078                      $total = 0;
079                  }
080              }
081   
082              if ($total)
083              {
084                  $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.username, u.username_clean, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id
085                      FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
086                      WHERE ' . $db->sql_in_set('p.post_id', $post_list) . '
087                          AND t.topic_id = p.topic_id
088                          AND p.poster_id = u.user_id
089                      ORDER BY p.post_time DESC';
090                  $result = $db->sql_query($sql);
091   
092                  while ($row = $db->sql_fetchrow($result))
093                  {
094                      $global_topic = ($row['forum_id']) ? false : true;
095                      if ($global_topic)
096                      {
097                          $row['forum_id'] = $global_id;
098                      }
099   
100                      $template->assign_block_vars('unapproved', array(
101                          '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']),
102                          'U_MCP_FORUM'        => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=forum_view&amp;f=' . $row['forum_id']) : '',
103                          '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']),
104                          'U_FORUM'            => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
105                          'U_TOPIC'            => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
106                          'U_AUTHOR'            => ($row['poster_id'] == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&amp;u=' . $row['poster_id']),
107   
108                          'FORUM_NAME'    => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'],
109                          'POST_ID'        => $row['post_id'],
110                          'TOPIC_TITLE'    => $row['topic_title'],
111                          'AUTHOR'        => ($row['poster_id'] == ANONYMOUS) ? (($row['post_username']) ? $row['post_username'] : $user->lang['GUEST']) : $row['username'],
112                          'SUBJECT'        => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
113                          'POST_TIME'        => $user->format_date($row['post_time']))
114                      );
115                  }
116                  $db->sql_freeresult($result);
117              }
118   
119              $template->assign_vars(array(
120                  'S_MCP_QUEUE_ACTION'    => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue"),
121              ));
122   
123              if ($total == 0)
124              {
125                  $template->assign_vars(array(
126                      'L_UNAPPROVED_TOTAL'        => $user->lang['UNAPPROVED_POSTS_ZERO_TOTAL'],
127                      'S_HAS_UNAPPROVED_POSTS'    => false)
128                  );
129              }
130              else
131              {
132                  $template->assign_vars(array(
133                      'L_UNAPPROVED_TOTAL'        => ($total == 1) ? $user->lang['UNAPPROVED_POST_TOTAL'] : sprintf($user->lang['UNAPPROVED_POSTS_TOTAL'], $total),
134                      'S_HAS_UNAPPROVED_POSTS'    => true)
135                  );
136              }
137          }
138      }
139   
140      // Latest 5 reported
141      if ($module->loaded('reports'))
142      {
143          $forum_list = get_forum_list('m_report');
144   
145          $template->assign_var('S_SHOW_REPORTS', (!empty($forum_list)) ? true : false);
146   
147          if (!empty($forum_list))
148          {
149              $sql = 'SELECT COUNT(r.report_id) AS total
150                  FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p
151                  WHERE r.post_id = p.post_id
152                      AND r.report_closed = 0
153                      AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')';
154              $result = $db->sql_query($sql);
155              $total = (int) $db->sql_fetchfield('total');
156              $db->sql_freeresult($result);
157   
158              if ($total)
159              {
160                  $global_id = $forum_list[0];
161   
162                  $sql = $db->sql_build_query('SELECT', array(
163                      'SELECT'    => 'r.report_time, p.post_id, p.post_subject, p.post_time, 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',
164   
165                      'FROM'        => array(
166                          REPORTS_TABLE            => 'r',
167                          REPORTS_REASONS_TABLE    => 'rr',
168                          TOPICS_TABLE            => 't',
169                          USERS_TABLE                => array('u', 'u2'),
170                          POSTS_TABLE                => 'p'
171                      ),
172   
173                      'LEFT_JOIN'    => array(
174                          array(
175                              'FROM'    => array(FORUMS_TABLE => 'f'),
176                              'ON'    => 'f.forum_id = p.forum_id'
177                          )
178                      ),
179   
180                      'WHERE'        => 'r.post_id = p.post_id
181                          AND r.report_closed = 0
182                          AND r.reason_id = rr.reason_id
183                          AND p.topic_id = t.topic_id
184                          AND r.user_id = u.user_id
185                          AND p.poster_id = u2.user_id
186                          AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')',
187   
188                      'ORDER_BY'    => 'p.post_time DESC'
189                  ));
190                  $result = $db->sql_query_limit($sql, 5);
191   
192                  while ($row = $db->sql_fetchrow($result))
193                  {
194                      $global_topic = ($row['forum_id']) ? false : true;
195                      if ($global_topic)
196                      {
197                          $row['forum_id'] = $global_id;
198                      }
199   
200                      $template->assign_block_vars('report', array(
201                          '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"),
202                          'U_MCP_FORUM'        => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . "&amp;i=$id&amp;mode=forum_view") : '',
203                          '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"),
204                          'U_FORUM'            => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
205                          'U_TOPIC'            => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
206   
207                          'REPORTER_FULL'        => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
208                          'REPORTER'            => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
209                          'REPORTER_COLOUR'    => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
210                          'U_REPORTER'        => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
211   
212                          'AUTHOR_FULL'        => get_username_string('full', $row['author_id'], $row['author_name'], $row['author_colour']),
213                          'AUTHOR'            => get_username_string('username', $row['author_id'], $row['author_name'], $row['author_colour']),
214                          'AUTHOR_COLOUR'        => get_username_string('colour', $row['author_id'], $row['author_name'], $row['author_colour']),
215                          'U_AUTHOR'            => get_username_string('profile', $row['author_id'], $row['author_name'], $row['author_colour']),
216   
217                          'FORUM_NAME'    => (!$global_topic) ? $row['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'],
218                          'TOPIC_TITLE'    => $row['topic_title'],
219                          'SUBJECT'        => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
220                          'REPORT_TIME'    => $user->format_date($row['report_time']),
221                          'POST_TIME'        => $user->format_date($row['post_time']),
222                      ));
223                  }
224              }
225   
226              if ($total == 0)
227              {
228                  $template->assign_vars(array(
229                      'L_REPORTS_TOTAL'    =>    $user->lang['REPORTS_ZERO_TOTAL'],
230                      'S_HAS_REPORTS'        =>    false)
231                  );
232              }
233              else
234              {
235                  $template->assign_vars(array(
236                      'L_REPORTS_TOTAL'    => ($total == 1) ? $user->lang['REPORT_TOTAL'] : sprintf($user->lang['REPORTS_TOTAL'], $total),
237                      'S_HAS_REPORTS'        => true)
238                  );
239              }
240          }
241      }
242   
243      // Latest 5 logs
244      if ($module->loaded('logs'))
245      {
246          $forum_list = get_forum_list('m_');
247   
248          if (!empty($forum_list))
249          {
250              // Add forum_id 0 for global announcements
251              $forum_list[] = 0;
252   
253              $log_count = 0;
254              $log = array();
255              view_log('mod', $log, $log_count, 5, 0, $forum_list);
256   
257              foreach ($log as $row)
258              {
259                  $template->assign_block_vars('log', array(
260                      'USERNAME'        => $row['username_full'],
261                      'IP'            => $row['ip'],
262                      'TIME'            => $user->format_date($row['time']),
263                      'ACTION'        => $row['action'],
264                      'U_VIEW_TOPIC'    => (!empty($row['viewtopic'])) ? $row['viewtopic'] : '',
265                      'U_VIEWLOGS'    => (!empty($row['viewlogs'])) ? $row['viewlogs'] : '')
266                  );
267              }
268          }
269   
270          $template->assign_vars(array(
271              'S_SHOW_LOGS'    => (!empty($forum_list)) ? true : false,
272              'S_HAS_LOGS'    => (!empty($log)) ? true : false)
273          );
274      }
275   
276      $template->assign_var('S_MCP_ACTION', append_sid("{$phpbb_root_path}mcp.$phpEx"));
277      make_jumpbox(append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=forum_view'), 0, false, 'm_', true);
278  }
279   
280  ?>