~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/php/phpBB3/includes/mcp/mcp_front.php

  • Committer: dcoles
  • Date: 2008-02-13 04:10:55 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:443
Added Forum application along with unmodifed version of phpBB3 "Olympus" 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
*
 
4
* @package mcp
 
5
* @version $Id: mcp_front.php,v 1.34 2007/11/03 11:09:11 acydburn Exp $
 
6
* @copyright (c) 2005 phpBB Group
 
7
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
 
8
*
 
9
*/
 
10
 
 
11
/**
 
12
* @ignore
 
13
*/
 
14
if (!defined('IN_PHPBB'))
 
15
{
 
16
        exit;
 
17
}
 
18
 
 
19
/**
 
20
* MCP Front Panel
 
21
*/
 
22
function mcp_front_view($id, $mode, $action)
 
23
{
 
24
        global $phpEx, $phpbb_root_path, $config;
 
25
        global $template, $db, $user, $auth, $module;
 
26
 
 
27
        // Latest 5 unapproved
 
28
        if ($module->loaded('queue'))
 
29
        {
 
30
                $forum_list = get_forum_list('m_approve');
 
31
                $post_list = array();
 
32
                $forum_names = array();
 
33
 
 
34
                $forum_id = request_var('f', 0);
 
35
 
 
36
                $template->assign_var('S_SHOW_UNAPPROVED', (!empty($forum_list)) ? true : false);
 
37
                
 
38
                if (!empty($forum_list))
 
39
                {
 
40
                        $sql = 'SELECT COUNT(post_id) AS total
 
41
                                FROM ' . POSTS_TABLE . '
 
42
                                WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ')
 
43
                                        AND post_approved = 0';
 
44
                        $result = $db->sql_query($sql);
 
45
                        $total = (int) $db->sql_fetchfield('total');
 
46
                        $db->sql_freeresult($result);
 
47
 
 
48
                        if ($total)
 
49
                        {
 
50
                                $global_id = $forum_list[0];
 
51
 
 
52
                                $sql = 'SELECT forum_id, forum_name
 
53
                                        FROM ' . FORUMS_TABLE . '
 
54
                                        WHERE ' . $db->sql_in_set('forum_id', $forum_list);
 
55
                                $result = $db->sql_query($sql);
 
56
 
 
57
                                while ($row = $db->sql_fetchrow($result))
 
58
                                {
 
59
                                        $forum_names[$row['forum_id']] = $row['forum_name'];
 
60
                                }
 
61
                                $db->sql_freeresult($result);
 
62
 
 
63
                                $sql = 'SELECT post_id
 
64
                                        FROM ' . POSTS_TABLE . '
 
65
                                        WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ')
 
66
                                                AND post_approved = 0
 
67
                                        ORDER BY post_time DESC';
 
68
                                $result = $db->sql_query_limit($sql, 5);
 
69
 
 
70
                                while ($row = $db->sql_fetchrow($result))
 
71
                                {
 
72
                                        $post_list[] = $row['post_id'];
 
73
                                }
 
74
                                $db->sql_freeresult($result);
 
75
 
 
76
                                if (empty($post_list))
 
77
                                {
 
78
                                        $total = 0;
 
79
                                }
 
80
                        }
 
81
 
 
82
                        if ($total)
 
83
                        {
 
84
                                $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
 
85
                                        FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
 
86
                                        WHERE ' . $db->sql_in_set('p.post_id', $post_list) . '
 
87
                                                AND t.topic_id = p.topic_id
 
88
                                                AND p.poster_id = u.user_id
 
89
                                        ORDER BY p.post_time DESC';
 
90
                                $result = $db->sql_query($sql);
 
91
 
 
92
                                while ($row = $db->sql_fetchrow($result))
 
93
                                {
 
94
                                        $global_topic = ($row['forum_id']) ? false : true;
 
95
                                        if ($global_topic)
 
96
                                        {
 
97
                                                $row['forum_id'] = $global_id;
 
98
                                        }
 
99
 
 
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
?>
 
 
b'\\ No newline at end of file'