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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
report.php
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 define('IN_PHPBB', true);
018 $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
019 $phpEx = substr(strrchr(__FILE__, '.'), 1);
020 include($phpbb_root_path . 'common.' . $phpEx);
021 include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
022
023 // Start session management
024 $user->session_begin();
025 $auth->acl($user->data);
026 $user->setup('mcp');
027
028 $forum_id = request_var('f', 0);
029 $post_id = request_var('p', 0);
030 $pm_id = request_var('pm', 0);
031 $reason_id = request_var('reason_id', 0);
032 $report_text = utf8_normalize_nfc(request_var('report_text', '', true));
033 $user_notify = ($user->data['is_registered']) ? request_var('notify', 0) : false;
034
035 $submit = (isset($_POST['submit'])) ? true : false;
036
037 if (!$post_id && (!$pm_id || !$config['allow_pm_report']))
038 {
039 trigger_error('NO_POST_SELECTED');
040 }
041
042 if ($post_id)
043 {
044 $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=$post_id") . "#p$post_id";
045 $return_forum_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id");
046 $pm_id = 0;
047 }
048 else
049 {
050 $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&p=$pm_id");
051 $return_forum_url = '';
052 $post_id = 0;
053 $forum_id = 0;
054 }
055
056 // Has the report been cancelled?
057 if (isset($_POST['cancel']))
058 {
059 redirect($redirect_url);
060 }
061
062 if ($post_id)
063 {
064 // Grab all relevant data
065 $sql = 'SELECT t.*, p.*
066 FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
067 WHERE p.post_id = $post_id
068 AND p.topic_id = t.topic_id";
069 $result = $db->sql_query($sql);
070 $report_data = $db->sql_fetchrow($result);
071 $db->sql_freeresult($result);
072
073 if (!$report_data)
074 {
075 trigger_error('POST_NOT_EXIST');
076 }
077
078 $forum_id = (int) $report_data['forum_id'];
079 $topic_id = (int) $report_data['topic_id'];
080 $reported_post_text = $report_data['post_text'];
081 $reported_post_bitfield = $report_data['bbcode_bitfield'];
082 $reported_post_uid = $report_data['bbcode_uid'];
083 $reported_post_enable_bbcode = $report_data['enable_bbcode'];
084 $reported_post_enable_smilies = $report_data['enable_smilies'];
085 $reported_post_enable_magic_url = $report_data['enable_magic_url'];
086
087 $sql = 'SELECT *
088 FROM ' . FORUMS_TABLE . '
089 WHERE forum_id = ' . $forum_id;
090 $result = $db->sql_query($sql);
091 $forum_data = $db->sql_fetchrow($result);
092 $db->sql_freeresult($result);
093
094 if (!$forum_data)
095 {
096 trigger_error('FORUM_NOT_EXIST');
097 }
098
099 // Check required permissions
100 $acl_check_ary = array('f_list' => 'POST_NOT_EXIST', 'f_read' => 'USER_CANNOT_READ', 'f_report' => 'USER_CANNOT_REPORT');
101
102 foreach ($acl_check_ary as $acl => $error)
103 {
104 if (!$auth->acl_get($acl, $forum_id))
105 {
106 trigger_error($error);
107 }
108 }
109 unset($acl_check_ary);
110
111 if ($report_data['post_reported'])
112 {
113 $message = $user->lang['ALREADY_REPORTED'];
114 $message .= '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>');
115 $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $return_forum_url . '">', '</a>');
116 trigger_error($message);
117 }
118 }
119 else
120 {
121 // Grab all relevant data
122 $sql = 'SELECT p.*, pt.*
123 FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . " pt
124 WHERE p.msg_id = $pm_id
125 AND p.msg_id = pt.msg_id
126 AND (p.author_id = " . $user->data['user_id'] . " OR pt.user_id = " . $user->data['user_id'] . ")";
127 $result = $db->sql_query($sql);
128 $report_data = $db->sql_fetchrow($result);
129 $db->sql_freeresult($result);
130
131 if (!$report_data)
132 {
133 $user->add_lang('ucp');
134 trigger_error('NO_MESSAGE');
135 }
136
137 if ($report_data['message_reported'])
138 {
139 $message = $user->lang['ALREADY_REPORTED_PM'];
140 $message .= '<br /><br />' . sprintf($user->lang['RETURN_PM'], '<a href="' . $redirect_url . '">', '</a>');
141 trigger_error($message);
142 }
143
144 $reported_post_text = $report_data['message_text'];
145 $reported_post_bitfield = $report_data['bbcode_bitfield'];
146 $reported_post_uid = $report_data['bbcode_uid'];
147 $reported_post_enable_bbcode = $report_data['enable_bbcode'];
148 $reported_post_enable_smilies = $report_data['enable_smilies'];
149 $reported_post_enable_magic_url = $report_data['enable_magic_url'];
150 }
151
152 if ($config['enable_post_confirm'] && !$user->data['is_registered'])
153 {
154 $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
155 $captcha->init(CONFIRM_REPORT);
156 }
157
158 $error = array();
159 $s_hidden_fields = '';
160
161 // Submit report?
162 if ($submit && $reason_id)
163 {
164 if (isset($captcha))
165 {
166 $visual_confirmation_response = $captcha->validate();
167 if ($visual_confirmation_response)
168 {
169 $error[] = $visual_confirmation_response;
170 }
171 }
172
173 $sql = 'SELECT *
174 FROM ' . REPORTS_REASONS_TABLE . "
175 WHERE reason_id = $reason_id";
176 $result = $db->sql_query($sql);
177 $row = $db->sql_fetchrow($result);
178 $db->sql_freeresult($result);
179
180 if (!$row || (!$report_text && strtolower($row['reason_title']) == 'other'))
181 {
182 $error[] = $user->lang('EMPTY_REPORT');
183 }
184
185 if (!sizeof($error))
186 {
187 if (isset($captcha))
188 {
189 $captcha->reset();
190 }
191
192 $sql_ary = array(
193 'reason_id' => (int) $reason_id,
194 'post_id' => $post_id,
195 'pm_id' => $pm_id,
196 'user_id' => (int) $user->data['user_id'],
197 'user_notify' => (int) $user_notify,
198 'report_closed' => 0,
199 'report_time' => (int) time(),
200 'report_text' => (string) $report_text,
201 'reported_post_text' => $reported_post_text,
202 'reported_post_uid' => $reported_post_uid,
203 'reported_post_bitfield' => $reported_post_bitfield,
204 'reported_post_enable_bbcode' => $reported_post_enable_bbcode,
205 'reported_post_enable_smilies' => $reported_post_enable_smilies,
206 'reported_post_enable_magic_url' => $reported_post_enable_magic_url,
207 );
208
209 $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
210 $db->sql_query($sql);
211 $report_id = $db->sql_nextid();
212
213 $phpbb_notifications = $phpbb_container->get('notification_manager');
214
215 if ($post_id)
216 {
217 $sql = 'UPDATE ' . POSTS_TABLE . '
218 SET post_reported = 1
219 WHERE post_id = ' . $post_id;
220 $db->sql_query($sql);
221
222 if (!$report_data['topic_reported'])
223 {
224 $sql = 'UPDATE ' . TOPICS_TABLE . '
225 SET topic_reported = 1
226 WHERE topic_id = ' . $report_data['topic_id'] . '
227 OR topic_moved_id = ' . $report_data['topic_id'];
228 $db->sql_query($sql);
229 }
230
231 $lang_return = $user->lang['RETURN_TOPIC'];
232 $lang_success = $user->lang['POST_REPORTED_SUCCESS'];
233
234 $phpbb_notifications->add_notifications('notification.type.report_post', array_merge($report_data, $row, $forum_data, array(
235 'report_text' => $report_text,
236 )));
237 }
238 else
239 {
240 $sql = 'UPDATE ' . PRIVMSGS_TABLE . '
241 SET message_reported = 1
242 WHERE msg_id = ' . $pm_id;
243 $db->sql_query($sql);
244
245 $sql_ary = array(
246 'msg_id' => $pm_id,
247 'user_id' => ANONYMOUS,
248 'author_id' => (int) $report_data['author_id'],
249 'pm_deleted' => 0,
250 'pm_new' => 0,
251 'pm_unread' => 0,
252 'pm_replied' => 0,
253 'pm_marked' => 0,
254 'pm_forwarded' => 0,
255 'folder_id' => PRIVMSGS_INBOX,
256 );
257
258 $sql = 'INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
259 $db->sql_query($sql);
260
261 $lang_return = $user->lang['RETURN_PM'];
262 $lang_success = $user->lang['PM_REPORTED_SUCCESS'];
263
264 $phpbb_notifications->add_notifications('notification.type.report_pm', array_merge($report_data, $row, array(
265 'report_text' => $report_text,
266 'from_user_id' => $report_data['author_id'],
267 'report_id' => $report_id,
268 )));
269 }
270
271 meta_refresh(3, $redirect_url);
272
273 $message = $lang_success . '<br /><br />' . sprintf($lang_return, '<a href="' . $redirect_url . '">', '</a>');
274 if ($return_forum_url)
275 {
276 $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $return_forum_url . '">', '</a>');
277 }
278 trigger_error($message);
279 }
280 else if (isset($captcha) && $captcha->is_solved() !== false)
281 {
282 $s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields());
283 }
284 }
285
286 // Generate the reasons
287 display_reasons($reason_id);
288
289 $page_title = ($pm_id) ? $user->lang['REPORT_MESSAGE'] : $user->lang['REPORT_POST'];
290
291 if (isset($captcha) && $captcha->is_solved() === false)
292 {
293 $template->assign_vars(array(
294 'S_CONFIRM_CODE' => true,
295 'CAPTCHA_TEMPLATE' => $captcha->get_template(),
296 ));
297 }
298
299 $template->assign_vars(array(
300 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
301 'S_REPORT_POST' => ($pm_id) ? false : true,
302 'REPORT_TEXT' => $report_text,
303 'S_REPORT_ACTION' => append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $post_id . '&pm=' . $pm_id),
304 'S_HIDDEN_FIELDS' => (sizeof($s_hidden_fields)) ? $s_hidden_fields : null,
305
306 'S_NOTIFY' => $user_notify,
307 'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false,
308 'S_IN_REPORT' => true,
309 ));
310
311 generate_forum_nav($forum_data);
312
313 // Start output of page
314 page_header($page_title);
315
316 $template->set_filenames(array(
317 'body' => 'report_body.html')
318 );
319
320 page_footer();
321