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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
report.php
001 <?php
002 /**
003 *
004 * @package phpBB3
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 define('IN_PHPBB', true);
015 $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
016 $phpEx = substr(strrchr(__FILE__, '.'), 1);
017 include($phpbb_root_path . 'common.' . $phpEx);
018 include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
019
020 // Start session management
021 $user->session_begin();
022 $auth->acl($user->data);
023 $user->setup('mcp');
024
025 $forum_id = request_var('f', 0);
026 $post_id = request_var('p', 0);
027 $reason_id = request_var('reason_id', 0);
028 $report_text = utf8_normalize_nfc(request_var('report_text', '', true));
029 $user_notify = ($user->data['is_registered']) ? request_var('notify', 0) : false;
030
031 $submit = (isset($_POST['submit'])) ? true : false;
032
033 if (!$post_id)
034 {
035 trigger_error('NO_POST_SELECTED');
036 }
037
038 $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=$post_id") . "#p$post_id";
039
040 // Has the report been cancelled?
041 if (isset($_POST['cancel']))
042 {
043 redirect($redirect_url);
044 }
045
046 // Grab all relevant data
047 $sql = 'SELECT t.*, p.*
048 FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
049 WHERE p.post_id = $post_id
050 AND p.topic_id = t.topic_id";
051 $result = $db->sql_query($sql);
052 $report_data = $db->sql_fetchrow($result);
053 $db->sql_freeresult($result);
054
055 if (!$report_data)
056 {
057 trigger_error('POST_NOT_EXIST');
058 }
059
060 $forum_id = (int) ($report_data['forum_id']) ? $report_data['forum_id'] : $forum_id;
061 $topic_id = (int) $report_data['topic_id'];
062
063 $sql = 'SELECT *
064 FROM ' . FORUMS_TABLE . '
065 WHERE forum_id = ' . $forum_id;
066 $result = $db->sql_query($sql);
067 $forum_data = $db->sql_fetchrow($result);
068 $db->sql_freeresult($result);
069
070 if (!$forum_data)
071 {
072 trigger_error('FORUM_NOT_EXIST');
073 }
074
075 // Check required permissions
076 $acl_check_ary = array('f_list' => 'POST_NOT_EXIST', 'f_read' => 'USER_CANNOT_READ', 'f_report' => 'USER_CANNOT_REPORT');
077
078 foreach ($acl_check_ary as $acl => $error)
079 {
080 if (!$auth->acl_get($acl, $forum_id))
081 {
082 trigger_error($error);
083 }
084 }
085 unset($acl_check_ary);
086
087 if ($report_data['post_reported'])
088 {
089 $message = $user->lang['ALREADY_REPORTED'];
090 $message .= '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>');
091 trigger_error($message);
092 }
093
094 // Submit report?
095 if ($submit && $reason_id)
096 {
097 $sql = 'SELECT *
098 FROM ' . REPORTS_REASONS_TABLE . "
099 WHERE reason_id = $reason_id";
100 $result = $db->sql_query($sql);
101 $row = $db->sql_fetchrow($result);
102 $db->sql_freeresult($result);
103
104 if (!$row || (!$report_text && strtolower($row['reason_title']) == 'other'))
105 {
106 trigger_error('EMPTY_REPORT');
107 }
108
109 $sql_ary = array(
110 'reason_id' => (int) $reason_id,
111 'post_id' => $post_id,
112 'user_id' => (int) $user->data['user_id'],
113 'user_notify' => (int) $user_notify,
114 'report_closed' => 0,
115 'report_time' => (int) time(),
116 'report_text' => (string) $report_text
117 );
118
119 $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
120 $db->sql_query($sql);
121 $report_id = $db->sql_nextid();
122
123 if (!$report_data['post_reported'])
124 {
125 $sql = 'UPDATE ' . POSTS_TABLE . '
126 SET post_reported = 1
127 WHERE post_id = ' . $post_id;
128 $db->sql_query($sql);
129 }
130
131 if (!$report_data['topic_reported'])
132 {
133 $sql = 'UPDATE ' . TOPICS_TABLE . '
134 SET topic_reported = 1
135 WHERE topic_id = ' . $report_data['topic_id'] . '
136 OR topic_moved_id = ' . $report_data['topic_id'];
137 $db->sql_query($sql);
138 }
139
140 meta_refresh(3, $redirect_url);
141
142 $message = $user->lang['POST_REPORTED_SUCCESS'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>');
143 trigger_error($message);
144 }
145
146 // Generate the reasons
147 display_reasons($reason_id);
148
149 $template->assign_vars(array(
150 'REPORT_TEXT' => $report_text,
151 'S_REPORT_ACTION' => append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $post_id),
152
153 'S_NOTIFY' => $user_notify,
154 'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false)
155 );
156
157 generate_forum_nav($forum_data);
158
159 // Start output of page
160 page_header($user->lang['REPORT_POST']);
161
162 $template->set_filenames(array(
163 'body' => 'report_body.html')
164 );
165
166 page_footer();
167
168 ?>