diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-03-12 23:19:55 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-03-12 23:19:55 +0000 |
commit | 9988679d567a8bba9bade92dd9524bb012a1fe43 (patch) | |
tree | 72da21e7465fed3ca99f20bd809a3df9c020530d /phpBB/includes/ucp | |
parent | f4cfd3665f7cf1ed96ce4c2eca03ac6854aae258 (diff) | |
download | forums-9988679d567a8bba9bade92dd9524bb012a1fe43.tar forums-9988679d567a8bba9bade92dd9524bb012a1fe43.tar.gz forums-9988679d567a8bba9bade92dd9524bb012a1fe43.tar.bz2 forums-9988679d567a8bba9bade92dd9524bb012a1fe43.tar.xz forums-9988679d567a8bba9bade92dd9524bb012a1fe43.zip |
- streamlined reports to consist of the feature set we decided upon (Nils, your turn now)
- use getenv instead of $_ENV (with $_ENV the case could be wrong)
- permission fixes (there was a bug arising with getting permission flags - re-added them and handled roles deletion differently)
- implemented max login attempts
- changed the expected return parameters for logins/sessions
- added acp page for editing report/denial reasons
- other fixes here and there
git-svn-id: file:///svn/phpbb/trunk@5622 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/ucp')
-rw-r--r-- | phpBB/includes/ucp/ucp_confirm.php | 6 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_viewfolder.php | 11 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_viewmessage.php | 7 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_prefs.php | 7 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_register.php | 18 | ||||
-rwxr-xr-x | phpBB/includes/ucp/ucp_reports.php | 367 |
6 files changed, 19 insertions, 397 deletions
diff --git a/phpBB/includes/ucp/ucp_confirm.php b/phpBB/includes/ucp/ucp_confirm.php index 831ea92dcc..2edf124b82 100644 --- a/phpBB/includes/ucp/ucp_confirm.php +++ b/phpBB/includes/ucp/ucp_confirm.php @@ -28,8 +28,9 @@ class ucp_confirm // Do we have an id? No, then just exit $confirm_id = request_var('id', ''); + $type = request_var('type', 0); - if (!$confirm_id) + if (!$confirm_id || !$type) { exit; } @@ -38,7 +39,8 @@ class ucp_confirm $sql = 'SELECT code FROM ' . CONFIRM_TABLE . " WHERE session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_id = '" . $db->sql_escape($confirm_id) . "'"; + AND confirm_id = '" . $db->sql_escape($confirm_id) . "' + AND confirm_type = $type"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index b64adc53b0..3616e06c77 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -29,7 +29,7 @@ function view_folder($id, $mode, $folder_id, $folder, $type) $icons = array(); $cache->obtain_icons($icons); - $color_rows = array('marked', 'replied', 'message_reported', 'friend', 'foe'); + $color_rows = array('marked', 'replied', 'friend', 'foe'); foreach ($color_rows as $var) { @@ -167,14 +167,11 @@ function view_folder($id, $mode, $folder_id, $folder, $type) 'PM_IMG' => ($row_indicator) ? $user->img('pm_' . $row_indicator, '') : '', 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $row['message_attachment'] && $config['allow_pm_attach'] && $config['auth_download_pm']) ? $user->img('icon_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', - 'S_PM_REPORTED' => (!empty($row['message_reported']) && $auth->acl_get('m_')) ? true : false, 'S_PM_DELETED' => ($row['deleted']) ? true : false, 'U_VIEW_PM' => ($row['deleted']) ? '' : $view_message_url, 'U_REMOVE_PM' => ($row['deleted']) ? $remove_message_url : '', - 'RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? implode(', ', $address_list[$message_id]) : '', - 'U_MCP_REPORT' => "{$phpbb_root_path}mcp.$phpEx?sid={$user->session_id}&i=reports&pm=$message_id") - // 'U_MCP_QUEUE' => "mcp.$phpEx?sid={$user->session_id}&i=mod_queue&t=$topic_id") + 'RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? implode(', ', $address_list[$message_id]) : '') ); } unset($folder_info['rowset']); @@ -437,8 +434,6 @@ function get_pm_from($folder_id, $folder, $user_id, $url, $type = 'folder') 'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('btn_locked', 'PM_LOCKED') : $user->img('btn_post_pm', 'POST_PM'), - 'REPORTED_IMG' => $user->img('icon_reported', 'MESSAGE_REPORTED'), - 'L_NO_MESSAGES' => (!$auth->acl_get('u_sendpm')) ? $user->lang['POST_PM_LOCKED'] : $user->lang['NO_MESSAGES'], 'S_SELECT_SORT_DIR' => $s_sort_dir, @@ -476,7 +471,7 @@ function get_pm_from($folder_id, $folder, $user_id, $url, $type = 'folder') $sql_start = $start; } - $sql = 'SELECT t.*, p.author_id, p.root_level, p.message_time, p.message_subject, p.icon_id, p.message_reported, p.to_address, p.message_attachment, p.bcc_address, u.username + $sql = 'SELECT t.*, p.author_id, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u WHERE t.user_id = $user_id AND p.author_id = u.user_id diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index aec007a36b..8b9d4d859d 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -164,8 +164,6 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'S_ONLINE' => (!$config['load_onlinetrack']) ? false : ((isset($user_info['online']) && $user_info['online']) ? true : false), 'DELETE_IMG' => $user->img('btn_delete', $user->lang['DELETE_MESSAGE']), 'INFO_IMG' => $user->img('btn_info', $user->lang['VIEW_PM_INFO']), - 'REPORT_IMG' => $user->img('btn_report', $user->lang['REPORT_PM']), - 'REPORTED_IMG' => $user->img('icon_reported', $user->lang['MESSAGE_REPORTED_MESSAGE']), 'PROFILE_IMG' => $user->img('btn_profile', $user->lang['READ_PROFILE']), 'EMAIL_IMG' => $user->img('btn_email', $user->lang['SEND_EMAIL']), 'QUOTE_IMG' => $user->img('btn_quote', $user->lang['POST_QUOTE_PM']), @@ -179,9 +177,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'SIGNATURE' => ($message_row['enable_sig']) ? $signature : '', 'EDITED_MESSAGE' => $l_edited_by, - 'U_MCP_REPORT' => "{$phpbb_root_path}mcp.$phpEx$SID&mode=pm_details&p=" . $message_row['msg_id'], - 'U_REPORT' => ($config['auth_report_pm'] && $auth->acl_get('u_pm_report')) ? "{$phpbb_root_path}report.$phpEx$SID&pm=" . $message_row['msg_id'] : '', - 'U_INFO' => ($auth->acl_get('m_') && ($message_row['message_reported'] || $message_row['forwarded'])) ? "{$phpbb_root_path}mcp.$phpEx$SID&mode=pm_details&p=" . $message_row['msg_id'] : '', + 'U_INFO' => ($auth->acl_get('m_') && $message_row['forwarded']) ? "{$phpbb_root_path}mcp.$phpEx$SID&mode=pm_details&p=" . $message_row['msg_id'] : '', 'U_DELETE' => ($auth->acl_get('u_pm_delete')) ? "$url&mode=compose&action=delete&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_AUTHOR_PROFILE' => "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $author_id, 'U_EMAIL' => $user_info['email'], @@ -191,7 +187,6 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'U_PREVIOUS_PM' => "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=previous", 'U_NEXT_PM' => "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=next", - 'S_MESSAGE_REPORTED'=> ($message_row['message_reported'] && $auth->acl_get('m_')) ? true : false, 'S_HAS_ATTACHMENTS' => (sizeof($attachments)) ? true : false, 'S_DISPLAY_NOTICE' => $display_notice && $message_row['message_attachment'], diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index c58caa7ef0..fd79225c6d 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -42,7 +42,6 @@ class ucp_prefs 'notifypm' => true, 'popuppm' => false, 'allowpm' => true, - 'report_pm_notify' => false ); foreach ($var_ary as $var => $default) @@ -63,7 +62,6 @@ class ucp_prefs if (!sizeof($error)) { $user->optionset('popuppm', $popuppm); - $user->optionset('report_pm_notify', $report_pm_notify); $sql_ary = array( 'user_allow_pm' => $allowpm, @@ -113,9 +111,6 @@ class ucp_prefs $popuppm = (isset($popuppm)) ? $popuppm : $user->optionget('popuppm'); $popup_pm_yes = ($popuppm) ? ' checked="checked"' : ''; $popup_pm_no = (!$popuppm) ? ' checked="checked"' : ''; - $report_pm_notify = (isset($report_pm_notify)) ? $report_pm_notify : $user->optionget('report_pm_notify'); - $report_pm_notify_yes = ($report_pm_notify) ? ' checked="checked"' : ''; - $report_pm_notify_no = (!$report_pm_notify) ? ' checked="checked"' : ''; $dst = (isset($dst)) ? $dst : $user->data['user_dst']; $dst_yes = ($dst) ? ' checked="checked"' : ''; $dst_no = (!$dst) ? ' checked="checked"' : ''; @@ -160,8 +155,6 @@ class ucp_prefs 'NOTIFY_PM_NO' => $notify_pm_no, 'POPUP_PM_YES' => $popup_pm_yes, 'POPUP_PM_NO' => $popup_pm_no, - 'REPORT_PM_YES' => $report_pm_notify_yes, - 'REPORT_PM_NO' => $report_pm_notify_no, 'DST_YES' => $dst_yes, 'DST_NO' => $dst_no, 'NOTIFY_EMAIL' => ($notifymethod == NOTIFY_EMAIL) ? 'checked="checked"' : '', diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 42a203884f..57f6a32de8 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -150,7 +150,8 @@ class ucp_register $sql = 'SELECT code FROM ' . CONFIRM_TABLE . " WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "'"; + AND session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . CONFIRM_REG; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) @@ -164,7 +165,8 @@ class ucp_register { $sql = 'DELETE FROM ' . CONFIRM_TABLE . " WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "'"; + AND session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . CONFIRM_REG; $db->sql_query($sql); } } @@ -401,14 +403,16 @@ class ucp_register while ($row = $db->sql_fetchrow($result)); $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' - WHERE session_id NOT IN (' . implode(', ', $sql_in) . ')'; + WHERE session_id NOT IN (' . implode(', ', $sql_in) . ') + AND confirm_type = ' . CONFIRM_REG; $db->sql_query($sql); } $db->sql_freeresult($result); $sql = 'SELECT COUNT(session_id) AS attempts FROM ' . CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "'"; + WHERE session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . CONFIRM_REG; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) @@ -421,18 +425,18 @@ class ucp_register $db->sql_freeresult($result); $code = gen_rand_string(mt_rand(5, 8)); - - $confirm_id = md5(uniqid($user->ip)); + $confirm_id = md5(unique_id(0, $user->ip)); $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( 'confirm_id' => (string) $confirm_id, 'session_id' => (string) $user->session_id, + 'confirm_type' => (int) CONFIRM_REG, 'code' => (string) $code) ); $db->sql_query($sql); } - $confirm_image = "<img src=\"ucp.$phpEx$SID&mode=confirm&id=$confirm_id\" alt=\"\" title=\"\" />"; + $confirm_image = '<img src="' . $phpbb_root_path . 'ucp.' . $phpEx . $SID . '&mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_REG . '" alt="" title="" />'; $s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />'; } diff --git a/phpBB/includes/ucp/ucp_reports.php b/phpBB/includes/ucp/ucp_reports.php deleted file mode 100755 index 6fe1b2342a..0000000000 --- a/phpBB/includes/ucp/ucp_reports.php +++ /dev/null @@ -1,367 +0,0 @@ -<?php -/** -* -* @package ucp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -/** -* @package ucp -* ucp_reports -*/ -class ucp_reports -{ - function main($id, $mode) - { - global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; - - switch ($mode) - { - case 'list': - $this->ucp_reports_list($id, $mode); - break; - case 'report': - $this->ucp_reports_report($id, $mode); - break; - } - } - - function ucp_reports_list($id, $mode) - { - global $db, $user, $config, $template; - - $sql = "SELECT - r.report_id, r.report_time, r.report_status, - p.post_id, p.poster_id, - t.topic_id, t.topic_title, - f.forum_id, f.forum_name, - u.username - FROM " . - REPORTS_TABLE . " r - LEFT JOIN " . POSTS_TABLE . " p USING (post_id) - LEFT JOIN " . TOPICS_TABLE . " t USING (topic_id) - LEFT JOIN " . FORUMS_TABLE . " f USING (forum_id)," . - REASONS_TABLE . " re, " . - USERS_TABLE . " u - WHERE - p.poster_id = u.user_id - && r.reason_id = re.reason_id - && r.user_id = " . $user->data['user_id'] . " - ORDER BY - report_time DESC"; - - $start = request_var('start', 0); - $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); - - while ($row = $db->sql_fetchrow($result)) - { - if ($row['poster_id'] == ANONYMOUS) - { - $poster = (!empty($row['post_username'])) ? $row['post_username'] : $user->lang['GUEST']; - } - else - { - $poster = $row['username']; - } - - $template->assign_block_vars('report', array( - 'U_FORUM' => "mcp.$phpEx$SID&i=report&mode=&f={$row['forum_id']}", - // Q: Why accessing the topic by a post_id instead of its topic_id? - // A: To prevent the post from being hidden because of wrong encoding or different charset - 'U_REPORT_TOPIC' => "mcp.$phpEx$SID&i=report&mode=report_view_topic&t={$row['topic_id']}", - 'U_VIEW_DETAILS'=> "mcp.$phpEx$SID&i=queue&start=$start&mode=approve_details&f={$forum_id}&p={$row['post_id']}", - 'U_VIEWPROFILE' => ($row['poster_id'] != ANONYMOUS) ? "memberlist.$phpEx$SID&mode=viewprofile&u={$row['poster_id']}" : '', - - 'REPORT_COUNT' => $row['report_count'], - 'FORUM_NAME' => $row['forum_name'], - 'TOPIC_TITLE' => $row['topic_title'], - 'POSTER' => $poster, - 'REPORT_TIME' => $user->format_date($row['report_time']), - ) - ); - } - $db->sql_freeresult($result); - - - $this->tpl_name = 'ucp_reports_list'; - } - - function ucp_reports_report($id, $mode) - { - global $db, $user, $config, $template, $auth; - - $post_id = request_var('p', 0); - $report_type = ($post_id > 0) ? REPORT_POST : REPORT_GENERAL; - - // Insert or update report in the database if a form has been submitted - if (isset($_POST['submit'])) - { - $report_id = request_var('report_id', 0); - $reason_id = request_var('reason_id', 0); - $user_notify = (!empty($_REQUEST['notify']) && $user->data['is_registered']) ? true : false; - $report_text = request_var('report_text', ''); - - $sql = 'SELECT reason_name - FROM ' . REASONS_TABLE . " - WHERE reason_id = $reason_id"; - $result = $db->sql_query($sql); - - // TODO: 'other' is used as a special value. Make sure that you can't remove this in the admin. - if (!($row = $db->sql_fetchrow($result)) || (!$report_text && $row['reason_name'] == 'other')) - { - trigger_error('EMPTY_REPORT'); - } - $db->sql_freeresult($result); - - if (!empty($user->lang['report_reasons']['DESCRIPTION'][$row['reason_name']])) - { - $reason_desc = $user->lang['report_reasons']['DESCRIPTION'][$row['reason_name']]; - } - else - { - $reason_desc = $row['reason_name']; - } - - $sql_ary = array( - 'reason_id' => (int) $reason_id, - 'reason_type' => (int) $report_type, - 'post_id' => (int) $post_id, - 'user_id' => (int) $user->data['user_id'], - 'user_notify' => (int) $user_notify, - 'report_time' => (int) time(), - 'report_text' => (string) $report_text // TODO: Add some BBcode magic - ); - - if ($report_id) - { - $sql = 'UPDATE ' . REPORTS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE report_id = ' . $report_id . ' user_id = ' . $user->data['user_id']; - $db->sql_query($sql); - if ($db->sql_affectedrows() == 0) - { - // TODO: i18n? - trigger_error("You tried to change a report that isn't yours."); - } - } - else - { - $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . - $db->sql_build_array('INSERT', $sql_ary); - $db->sql_query($sql); - $report_id = $db->sql_nextid(); - } - - if (!$report_data['post_reported']) - { - $sql = 'UPDATE ' . POSTS_TABLE . ' - SET post_reported = 1 - WHERE post_id = ' . $id; - $db->sql_query($sql); - } - - if (!$report_data['topic_reported']) - { - $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_reported = 1 - WHERE topic_id = ' . $report_data['topic_id']; - $db->sql_query($sql); - } - - // Send Notifications - // All persons get notified about a new report, if notified by PM, send out email notifications too - - // Send notifications to moderators - $acl_list = $auth->acl_get_list(false, array('m_', 'a_'), array(0, $report_data['forum_id'])); - $notify_user = $acl_list[$report_data['forum_id']]['m_']; - $notify_user = array_unique(array_merge($notify_user, $acl_list[0]['a_'])); - unset($acl_list); - - // How to notify them? - $sql = 'SELECT user_id, username, user_options, user_lang, user_email, user_notify_type, user_jabber - FROM ' . USERS_TABLE . ' - WHERE user_id IN (' . implode(', ', $notify_user) . ')'; - $result = $db->sql_query($sql); - - $notify_user = array(); - while ($row = $db->sql_fetchrow($result)) - { - $notify_user[$row['user_id']] = array( - 'name' => $row['username'], - 'email' => $row['user_email'], - 'jabber'=> $row['user_jabber'], - 'lang' => $row['user_lang'], - 'notify_type' => $row['user_notify_type'], - - 'pm' => $user->optionget('report_pm_notify', $row['user_options']) - ); - } - $db->sql_freeresult($result); - - $report_data = array( - 'id' => $id, - 'report_id' => $report_id, - 'reporter' => $user->data['username'], - 'reason' => $reason_desc, - 'text' => $report_text, - 'subject' => $report_data['post_subject'], - 'view_post' => ($report_type == REPORT_POST) ? "viewtopic.$phpEx?f={$report_data['forum_id']}&t={$report_data['topic_id']}&p=$id&e=$id" : '' - ); - - report_notification($notify_user, $report_type, $report_data); - - meta_refresh(3, $redirect_url); - - $message = $user->lang['POST_REPORTED_SUCCESS'] . '<br /><br />' . sprintf($user->lang[(($report_type == REPORT_POST) ? 'RETURN_TOPIC' : 'RETURN_PREVIOUS')], '<a href="' . $redirect_url . '">', '</a>'); - trigger_error($message); - } - - - // Show the 'create report' form - // Report about a specific post or a general report (i.e. message to the mods)? - $post_id = (request_var('p', 0)) ? true : false; - - if ($report_type == REPORT_POST) - { - $sql = 'SELECT - f.forum_id, - t.topic_id - FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f - WHERE p.post_id = $post_id - AND p.topic_id = t.topic_id - AND p.forum_id = f.forum_id"; - $result = $db->sql_query($sql); - - if (!($report_data = $db->sql_fetchrow($result))) - { - $message = $user->lang['POST_NOT_EXIST']; - trigger_error($message); - } - - $forum_id = $report_data['forum_id']; - $topic_id = $report_data['topic_id']; - - // Check required permissions - $acl_check_ary = array('f_list' => 'POST_NOT_EXIST', 'f_read' => 'USER_CANNOT_READ', 'f_report' => 'USER_CANNOT_REPORT'); - - foreach ($acl_check_ary as $acl => $error) - { - if (!$auth->acl_get($acl, $forum_id)) - { - trigger_error($error); - } - } - unset($acl_check_ary); - - // Check if the post has already been reported by this user - $sql = "SELECT - report_id, reason_id, post_id, user_notify, report_time, report_text, report_status, - bbcode_uid, bbcode_bitfield - FROM " . REPORTS_TABLE . " - WHERE post_id = $post_id - AND user_id = " . $user->data['user_id']; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - if ($user->data['is_registered']) - { - // A report exists, extract $row if we're going to display the form - if ($reason_id) - { - $report_id = (int) $row['report_id']; - } - else - { - // Overwrite set variables - $report_id = $row['report_id']; - $reason_id = $row['reason_id']; - $post_id = $row['post_id']; - $user_notify = $row['user_notify']; - $report_time = $row['report_time']; - $report_text = $row['report_text']; - $report_status = $row['report_status']; - $bbcode_uid = $row['bbcode_uid']; - $bbcode_bitfield= $row['bbcode_bitfield']; - } - } - else - { - // TODO: is this what we want? - trigger_error($user->lang['ALREADY_REPORTED'] . '<br /><br />' . sprintf($user->lang[(($report_type == REPORT_POST) ? 'RETURN_TOPIC' : 'RETURN_PREVIOUS')], '<a href="' . $redirect_url . '">', '</a>')); - } - } - else - { - $report_id = 0; - } - } - - // Show create report form - // Generate the form - $sql = "SELECT * - FROM " . REASONS_TABLE . " - WHERE report_type = $report_type - ORDER BY reason_priority ASC"; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $row['reason_name'] = strtoupper($row['reason_name']); - - $reason_title = (!empty($user->lang['report_reasons']['TITLE'][$row['reason_name']])) ? $user->lang['report_reasons']['TITLE'][$row['reason_name']] : ucwords(str_replace('_', ' ', $row['reason_name'])); - - $reason_desc = (!empty($user->lang['report_reasons']['DESCRIPTION'][$row['reason_name']])) ? $user->lang['report_reasons']['DESCRIPTION'][$row['reason_name']] : $row['reason_description']; - - $template->assign_block_vars('reason', array( - 'ID' => $row['reason_id'], - 'NAME' => htmlspecialchars($reason_title), - 'DESCRIPTION' => htmlspecialchars($reason_desc), - 'S_SELECTED' => ($row['reason_id'] == $reason_id) ? true : false) - ); - } - - $template->assign_vars(array( - 'REPORT_TEXT' => $report_text, - 'S_REPORT_ACTION' => "{$phpbb_root_path}report.$phpEx$SID&p=$id" . (($report_id) ? "&report_id=$report_id" : ''), - - 'S_NOTIFY' => (!empty($user_notify)) ? true : false, - 'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false, - 'S_REPORT_POST' => ($report_type == REPORT_POST) ? true : false) - ); - - $this->tpl_name = 'ucp_reports_report'; - } -} - -/** -* @package module_install -*/ -class ucp_reports_info -{ - function module() - { - return array( - 'filename' => 'ucp_reports', - 'title' => 'UCP_REPORTS', - 'version' => '1.0.0', - 'modes' => array( - 'list' => array('title' => 'UCP_REPORTS_LIST', 'auth' => ''), - 'report' => array('title' => 'UCP_REPORTS_REPORT', 'auth' => ''), - ), - ); - } - - function install() - { - } - - function uninstall() - { - } -} - -?>
\ No newline at end of file |