diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql
index 08af7c232..c6c00b019 100644
--- a/install/sql/mysql.sql
+++ b/install/sql/mysql.sql
@@ -44,10 +44,6 @@ DROP TABLE IF EXISTS `bb_privmsgs`;
DROP TABLE IF EXISTS `bb_privmsgs_text`;
DROP TABLE IF EXISTS `bb_quota_limits`;
DROP TABLE IF EXISTS `bb_ranks`;
-DROP TABLE IF EXISTS `bb_reports`;
-DROP TABLE IF EXISTS `bb_reports_changes`;
-DROP TABLE IF EXISTS `bb_reports_modules`;
-DROP TABLE IF EXISTS `bb_reports_reasons`;
DROP TABLE IF EXISTS `bb_search_rebuild`;
DROP TABLE IF EXISTS `bb_search_results`;
DROP TABLE IF EXISTS `bb_sessions`;
@@ -555,15 +551,8 @@ INSERT INTO `bb_config` VALUES ('static_sitemap', '');
INSERT INTO `bb_config` VALUES ('topics_per_page', '50');
INSERT INTO `bb_config` VALUES ('xs_use_cache', '1');
INSERT INTO `bb_config` VALUES ('active_ads', '');
-INSERT INTO `bb_config` VALUES ('report_subject_auth', '1');
-INSERT INTO `bb_config` VALUES ('report_modules_cache', '1');
-INSERT INTO `bb_config` VALUES ('report_hack_count', '0');
-INSERT INTO `bb_config` VALUES ('report_notify', '0');
-INSERT INTO `bb_config` VALUES ('report_list_admin', '0');
-INSERT INTO `bb_config` VALUES ('report_new_window', '0');
INSERT INTO `bb_config` VALUES ('cron_enabled', '1');
INSERT INTO `bb_config` VALUES ('cron_check_interval', '300');
-INSERT INTO `bb_config` VALUES ('reports_enabled', '1');
INSERT INTO `bb_config` VALUES ('magnet_links_enabled', '1');
INSERT INTO `bb_config` VALUES ('gender', '1');
INSERT INTO `bb_config` VALUES ('callseed', '0');
@@ -868,7 +857,6 @@ CREATE TABLE IF NOT EXISTS `bb_posts` (
`post_edit_time` int(11) NOT NULL DEFAULT '0',
`post_edit_count` smallint(5) unsigned NOT NULL DEFAULT '0',
`post_attachment` tinyint(1) NOT NULL DEFAULT '0',
- `post_reported` tinyint(1) NOT NULL DEFAULT '0',
`user_post` tinyint(1) NOT NULL DEFAULT '1',
`mc_comment` TEXT NOT NULL DEFAULT '',
`mc_type` TINYINT( 1 ) NOT NULL DEFAULT '0',
@@ -884,7 +872,7 @@ CREATE TABLE IF NOT EXISTS `bb_posts` (
-- Дамп данных таблицы `bb_posts`
--
-INSERT INTO `bb_posts` VALUES (1, 1, 1, 2, UNIX_TIMESTAMP(), '', 0, 0, '', 0, 0, 0, 0, 1, '', 0, 0);
+INSERT INTO `bb_posts` VALUES (1, 1, 1, 2, UNIX_TIMESTAMP(), '', 0, 0, '', 0, 0, 0, 1, '', 0, 0);
-- --------------------------------------------------------
@@ -944,7 +932,6 @@ CREATE TABLE IF NOT EXISTS `bb_privmsgs` (
`privmsgs_to_userid` mediumint(8) NOT NULL DEFAULT '0',
`privmsgs_date` int(11) NOT NULL DEFAULT '0',
`privmsgs_ip` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
- `privmsgs_reported` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`privmsgs_id`),
KEY `privmsgs_from_userid` (`privmsgs_from_userid`),
KEY `privmsgs_to_userid` (`privmsgs_to_userid`)
@@ -1007,100 +994,6 @@ INSERT INTO `bb_ranks` VALUES (1, 'Администратор', -1, 1, 'images/r
-- --------------------------------------------------------
---
--- Структура таблицы `bb_reports`
---
-
-CREATE TABLE IF NOT EXISTS `bb_reports` (
- `report_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
- `user_id` mediumint(8) NOT NULL,
- `report_time` int(11) NOT NULL,
- `report_last_change` mediumint(8) unsigned DEFAULT NULL,
- `report_module_id` mediumint(8) unsigned NOT NULL,
- `report_status` tinyint(1) NOT NULL,
- `report_reason_id` mediumint(8) unsigned NOT NULL,
- `report_subject` int(11) NOT NULL,
- `report_subject_data` mediumtext,
- `report_title` varchar(255) NOT NULL,
- `report_desc` text NOT NULL,
- PRIMARY KEY (`report_id`),
- KEY `user_id` (`user_id`),
- KEY `report_time` (`report_time`),
- KEY `report_type_id` (`report_module_id`),
- KEY `report_status` (`report_status`),
- KEY `report_reason_id` (`report_reason_id`),
- KEY `report_subject` (`report_subject`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Структура таблицы `bb_reports_changes`
---
-
-CREATE TABLE IF NOT EXISTS `bb_reports_changes` (
- `report_change_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
- `report_id` mediumint(8) unsigned NOT NULL,
- `user_id` mediumint(8) NOT NULL,
- `report_change_time` int(11) NOT NULL,
- `report_status` tinyint(1) NOT NULL,
- `report_change_comment` text NOT NULL,
- PRIMARY KEY (`report_change_id`),
- KEY `report_id` (`report_id`),
- KEY `user_id` (`user_id`),
- KEY `report_change_time` (`report_change_time`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Структура таблицы `bb_reports_modules`
---
-
-CREATE TABLE IF NOT EXISTS `bb_reports_modules` (
- `report_module_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
- `report_module_order` mediumint(8) unsigned NOT NULL,
- `report_module_notify` tinyint(1) NOT NULL,
- `report_module_prune` smallint(6) NOT NULL,
- `report_module_last_prune` int(11) DEFAULT NULL,
- `report_module_name` varchar(50) NOT NULL,
- `auth_write` tinyint(1) NOT NULL,
- `auth_view` tinyint(1) NOT NULL,
- `auth_notify` tinyint(1) NOT NULL,
- `auth_delete` tinyint(1) NOT NULL,
- PRIMARY KEY (`report_module_id`),
- KEY `report_module_order` (`report_module_order`),
- KEY `auth_view` (`auth_view`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
---
--- Дамп данных таблицы `bb_reports_modules`
---
-
-INSERT INTO `bb_reports_modules` VALUES (1, 1, 0, 0, NULL, 'report_general', 0, 1, 1, 1);
-INSERT INTO `bb_reports_modules` VALUES (2, 2, 0, 0, NULL, 'report_post', 0, 1, 1, 1);
-INSERT INTO `bb_reports_modules` VALUES (3, 3, 0, 0, NULL, 'report_topic', 0, 1, 1, 1);
-INSERT INTO `bb_reports_modules` VALUES (4, 4, 0, 0, NULL, 'report_user', 0, 1, 1, 1);
-INSERT INTO `bb_reports_modules` VALUES (5, 5, 0, 0, NULL, 'report_privmsg', 0, 1, 1, 1);
-
--- --------------------------------------------------------
-
---
--- Структура таблицы `bb_reports_reasons`
---
-
-CREATE TABLE IF NOT EXISTS `bb_reports_reasons` (
- `report_reason_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
- `report_module_id` mediumint(8) unsigned NOT NULL,
- `report_reason_order` mediumint(8) unsigned NOT NULL,
- `report_reason_desc` varchar(255) NOT NULL,
- PRIMARY KEY (`report_reason_id`),
- KEY `report_type_id` (`report_module_id`),
- KEY `report_reason_order` (`report_reason_order`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
--
-- Структура таблицы `bb_search_rebuild`
--
@@ -1248,7 +1141,6 @@ CREATE TABLE IF NOT EXISTS `bb_topics` (
`topic_last_post_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`topic_moved_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`topic_attachment` tinyint(1) NOT NULL DEFAULT '0',
- `topic_reported` tinyint(1) NOT NULL DEFAULT '0',
`topic_dl_type` tinyint(1) NOT NULL DEFAULT '0',
`topic_last_post_time` int(11) NOT NULL DEFAULT '0',
`topic_show_first_post` tinyint(1) unsigned NOT NULL DEFAULT '0',
@@ -1263,7 +1155,7 @@ CREATE TABLE IF NOT EXISTS `bb_topics` (
-- Дамп данных таблицы `bb_topics`
--
-INSERT INTO `bb_topics` VALUES (1, 1, 'Добро пожаловать в TorrentPier II', 2, UNIX_TIMESTAMP(), 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 972086460, 0);
+INSERT INTO `bb_topics` VALUES (1, 1, 'Добро пожаловать в TorrentPier II', 2, UNIX_TIMESTAMP(), 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, UNIX_TIMESTAMP(), 0);
-- --------------------------------------------------------
diff --git a/upgrade/changes.txt b/upgrade/changes.txt
new file mode 100644
index 000000000..715985ee1
--- /dev/null
+++ b/upgrade/changes.txt
@@ -0,0 +1,18 @@
+Схема изменений начиная с версии 2.1 (R600):
+
+Изменения в базе:
+
+DROP TABLE IF EXISTS `bb_reports`;
+DROP TABLE IF EXISTS `bb_reports_changes`;
+DROP TABLE IF EXISTS `bb_reports_modules`;
+DROP TABLE IF EXISTS `bb_reports_reasons`;
+DELETE FROM `bb_config` WHERE `config_name` = 'report_subject_auth';
+DELETE FROM `bb_config` WHERE `config_name` = 'report_modules_cache';
+DELETE FROM `bb_config` WHERE `config_name` = 'report_hack_count';
+DELETE FROM `bb_config` WHERE `config_name` = 'report_notify';
+DELETE FROM `bb_config` WHERE `config_name` = 'report_list_admin';
+DELETE FROM `bb_config` WHERE `config_name` = 'report_new_window';
+DELETE FROM `bb_config` WHERE `config_name` = 'reports_enabled';
+ALTER TABLE `bb_posts` DROP COLUMN `post_reported`;
+ALTER TABLE `bb_privmsgs` DROP COLUMN `privmsgs_reported`;
+ALTER TABLE `bb_topics` DROP COLUMN `topic_reported`;
diff --git a/upload/admin/admin_board.php b/upload/admin/admin_board.php
index fe2e966dd..a709f7a34 100644
--- a/upload/admin/admin_board.php
+++ b/upload/admin/admin_board.php
@@ -56,7 +56,6 @@ switch ($mode)
'S_CONFIG_ACTION' => 'admin_board.php?mode=config_mods',
'CONFIG_MODS' => true,
- 'REPORTS_ENABLED' => $new['reports_enabled'],
'MAGNET_LINKS_ENABLED' => $new['magnet_links_enabled'],
'GENDER' => $new['gender'],
'CALLSEED' => $new['callseed'],
diff --git a/upload/admin/admin_reports.php b/upload/admin/admin_reports.php
deleted file mode 100644
index 612ae7a90..000000000
--- a/upload/admin/admin_reports.php
+++ /dev/null
@@ -1,558 +0,0 @@
- '
'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '', ''),
- 'config' => '
'. sprintf($lang['CLICK_RETURN_REPORT_CONFIG'], '', ''),
- 'admin' => '
'. sprintf($lang['CLICK_RETURN_REPORT_ADMIN'], '', '')
-);
-
-$redirect_url = 'admin/admin_reports.php';
-
-$template->assign_var('S_REPORT_ACTION', 'admin_reports.php');
-
-if (isset($_POST['mode']) || isset($_GET['mode']))
-{
- $mode = (isset($_POST['mode'])) ? $_POST['mode'] : $_GET['mode'];
-
- //
- // allow multiple modes (we need this for sub-modes, e.g. the report reasons)
- //
- if (is_array($mode))
- {
- $modes = $mode;
- $mode = $modes[0];
- }
- else
- {
- $modes = array($mode);
- }
-}
-else
-{
- $mode = '';
- $modes = array();
-}
-
-//
-// Configuration page
-//
-if ($mode == 'config')
-{
- if (isset($_POST['submit']))
- {
- $config_update = (isset($_POST['bb_cfg'])) ? $_POST['bb_cfg'] : array();
-
- bb_update_config($config_update);
- report_modules_cache_clean();
-
- bb_die($lang['REPORT_CONFIG_UPDATED'] . $return_links['config'] . $return_links['index']);
- }
- else
- {
- $template->assign_vars(array(
- 'S_HIDDEN_FIELDS' => '',
-
- 'REPORT_SUBJECT_AUTH_ON' => ($bb_cfg['report_subject_auth']) ? ' checked="checked"' : '',
- 'REPORT_SUBJECT_AUTH_OFF' => (!$bb_cfg['report_subject_auth']) ? ' checked="checked"' : '',
- 'REPORT_MODULES_CACHE_ON' => ($bb_cfg['report_modules_cache']) ? ' checked="checked"' : '',
- 'REPORT_MODULES_CACHE_OFF' => (!$bb_cfg['report_modules_cache']) ? ' checked="checked"' : '',
- 'REPORT_NOTIFY_CHANGE' => ($bb_cfg['report_notify'] == REPORT_NOTIFY_CHANGE) ? ' checked="checked"' : '',
- 'REPORT_NOTIFY_NEW' => ($bb_cfg['report_notify'] == REPORT_NOTIFY_NEW) ? ' checked="checked"' : '',
- 'REPORT_NOTIFY_OFF' => (!$bb_cfg['report_notify']) ? ' checked="checked"' : '',
- 'REPORT_LIST_ADMIN_ON' => ($bb_cfg['report_list_admin']) ? ' checked="checked"' : '',
- 'REPORT_LIST_ADMIN_OFF' => (!$bb_cfg['report_list_admin']) ? ' checked="checked"' : '',
- 'REPORT_NEW_WINDOW_ON' => ($bb_cfg['report_new_window']) ? ' checked="checked"' : '',
- 'REPORT_NEW_WINDOW_OFF' => (!$bb_cfg['report_new_window']) ? ' checked="checked"' : '',
- ));
-
- print_page('report_config_body.tpl', 'admin');
- }
-}
-else if (isset($_POST[POST_CAT_URL]) || isset($_GET[POST_CAT_URL]))
-{
- $module_id = (isset($_POST[POST_CAT_URL])) ? (int) $_POST[POST_CAT_URL] : (int) $_GET[POST_CAT_URL];
-
- if (!$report_module = report_modules('id', $module_id))
- {
- bb_die($lang['REPORT_MODULE_NOT_EXISTS'] . $return_links['admin'] . $return_links['index']);
- }
-
- switch ($mode)
- {
- //
- // Edit module
- //
- case 'edit':
- if (isset($_POST['submit']))
- {
- $module_notify = (isset($_POST['report_module_notify']) && $_POST['report_module_notify'] == 1) ? 1 : 0;
- $module_prune = (isset($_POST['report_module_prune'])) ? (int) $_POST['report_module_prune'] : $report_module->data['report_module_prune'];
-
- $auth_write = (isset($_POST['auth_write'])) ? (int) $_POST['auth_write'] : $report_module->data['auth_write'];
- $auth_view = (isset($_POST['auth_view'])) ? (int) $_POST['auth_view'] : $report_module->data['auth_view'];
- $auth_notify = (isset($_POST['auth_notify'])) ? (int) $_POST['auth_notify'] : $report_module->data['auth_notify'];
- $auth_delete = (isset($_POST['auth_delete'])) ? (int) $_POST['auth_delete'] : $report_module->data['auth_delete'];
-
- report_module_edit($module_id, $module_notify, $module_prune, $auth_write, $auth_view, $auth_notify, $auth_delete);
-
- bb_die($lang['REPORT_MODULE_EDITED'] . $return_links['admin'] . $return_links['index']);
- }
- else if (isset($_POST['cancel']))
- {
- redirect($redirect_url);
- }
-
- $module_info = $report_module->info();
-
- $hidden_fields = '';
-
- $template->assign_vars(array(
- 'S_HIDDEN_FIELDS' => $hidden_fields,
- 'MODULE_TITLE' => $module_info['title'],
- 'MODULE_EXPLAIN' => $module_info['explain'],
- 'MODULE_NOTIFY_ON' => ($report_module->data['report_module_notify']) ? ' checked="checked"' : '',
- 'MODULE_NOTIFY_OFF' => (!$report_module->data['report_module_notify']) ? ' checked="checked"' : '',
- 'MODULE_PRUNE' => $report_module->data['report_module_prune'])
- );
-
- //
- // Authorisation selects
- //
- report_auth_select('auth_write', $report_module->data['auth_write'], array(REPORT_AUTH_USER, REPORT_AUTH_MOD, REPORT_AUTH_ADMIN));
- report_auth_select('auth_view', $report_module->data['auth_view']);
- report_auth_select('auth_notify', $report_module->data['auth_notify']);
- report_auth_select('auth_delete', $report_module->data['auth_delete'], array(REPORT_AUTH_MOD, REPORT_AUTH_CONFIRM, REPORT_AUTH_ADMIN));
-
- print_page('report_module_edit_body.tpl', 'admin');
- break;
-
- //
- // Report reasons
- //
- case 'reasons':
- $reason_mode = (isset($modes[1])) ? $modes[1] : '';
-
- $temp_url = "admin_reports.php?mode=reasons&" . POST_CAT_URL . "=$module_id";
- $return_links['reasons'] = '
' . sprintf($lang['CLICK_RETURN_REPORT_REASONS'], '', '');
-
- $redirect_url = 'admin/admin_reports.php?mode=reasons&' . POST_CAT_URL . "=$module_id";
-
- if (isset($_POST[POST_REPORT_REASON_URL]) || isset($_GET[POST_REPORT_REASON_URL]))
- {
- $reason_id = (isset($_POST[POST_REPORT_REASON_URL])) ? (int) $_POST[POST_REPORT_REASON_URL] : (int) $_GET[POST_REPORT_REASON_URL];
-
- switch ($reason_mode)
- {
- //
- // Edit reason
- //
- case 'edit':
- $errors = array();
-
- if (isset($_POST['submit']))
- {
- $reason_desc = (isset($_POST['report_reason_desc'])) ? htmlspecialchars($_POST['report_reason_desc']) : '';
-
- //
- // Validate reason desc
- //
- if (empty($reason_desc))
- {
- $errors[] = $lang['REASON_DESC_EMPTY'];
- }
-
- if (empty($errors))
- {
- $reason_desc = str_replace("\'", "'", $reason_desc);
-
- report_reason_edit($reason_id, $module_id, $reason_desc);
-
- bb_die($lang['REPORT_REASON_EDITED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
- }
- }
- else if (isset($_POST['cancel']))
- {
- redirect($redirect_url);
- }
-
- //
- // Show validation errors
- //
- if (!empty($errors))
- {
- $template->assign_block_vars('switch_report_errors', array());
- foreach ($errors as $error)
- {
- $template->assign_block_vars('switch_report_errors.report_errors', array(
- 'MESSAGE' => $error)
- );
- }
- }
-
- if (!$report_reason = report_reason_obtain($reason_id))
- {
- bb_die($lang['REPORT_REASON_NOT_EXISTS'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
- }
-
- if (isset($reason_desc))
- {
- $report_reason['report_reason_desc'] = stripslashes($reason_desc);
- }
-
- $hidden_fields = '';
- $hidden_fields .= '';
-
- $template->assign_vars(array(
- 'S_HIDDEN_FIELDS' => $hidden_fields,
- 'REASON_DESC' => $report_reason['report_reason_desc'])
- );
-
- print_page('report_reason_edit_body.tpl', 'admin');
- break;
-
- //
- // Move reason up/down
- //
- case 'up':
- case 'down':
- report_reason_move($reason_mode, $reason_id);
-
- redirect($redirect_url);
- break;
-
- //
- // Delete reason
- //
- case 'delete':
- if (isset($_POST['confirm']))
- {
- report_reason_delete($reason_id);
-
- bb_die($lang['REPORT_REASON_DELETED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
- }
- else if (isset($_POST['cancel']))
- {
- redirect($redirect_url);
- }
-
- $hidden_fields = '';
- $hidden_fields .= '';
-
- print_confirmation(array(
- 'CONFIRM_TITLE' => $lang['DELETE_REASON'],
- 'QUESTION' => $lang['DELETE_REPORT_REASON_EXPLAIN'],
- 'FORM_ACTION' => "admin_reports.php",
- 'HIDDEN_FIELDS' => $hidden_fields,
- ));
- break;
-
- default:
- bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
- break;
- }
- }
- else
- {
- switch ($reason_mode)
- {
- //
- // Add reason
- //
- case 'add':
- $errors = array();
-
- if (isset($_POST['submit']))
- {
- $reason_desc = (isset($_POST['report_reason_desc'])) ? htmlspecialchars($_POST['report_reason_desc']) : '';
-
- //
- // Validate reason desc
- //
- if (empty($reason_desc))
- {
- $errors[] = $lang['REASON_DESC_EMPTY'];
- }
-
- if (empty($errors))
- {
- $reason_desc = str_replace("\'", "'", $reason_desc);
-
- report_reason_insert($module_id, $reason_desc);
-
- bb_die($lang['REPORT_REASON_ADDED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
- }
- }
- else if (isset($_POST['cancel']))
- {
- redirect($redirect_url);
- }
-
- //
- // Show validation errors
- //
- if (!empty($errors))
- {
- $template->assign_block_vars('switch_report_errors', array());
- foreach ($errors as $error)
- {
- $template->assign_block_vars('switch_report_errors.report_errors', array(
- 'MESSAGE' => $error)
- );
- }
- }
-
- $hidden_fields = '';
- $hidden_fields .= '';
-
- $template->assign_vars(array(
- 'S_HIDDEN_FIELDS' => $hidden_fields,
- 'REASON_DESC' => (isset($reason_desc)) ? stripslashes($reason_desc) : '')
- );
-
- print_page('report_reason_edit_body.tpl', 'admin');
- break;
-
- case '':
-
- if ($report_reasons = $report_module->reasons_obtain())
- {
- foreach ($report_reasons as $reason_id => $reason_desc)
- {
- $template->assign_block_vars('report_reasons', array(
- 'DESC' => $reason_desc,
-
- 'U_EDIT' => 'admin_reports.php?mode[]=reasons&' . POST_CAT_URL . "=$module_id&mode[]=edit&" . POST_REPORT_REASON_URL . "=$reason_id",
- 'U_MOVE_UP' => 'admin_reports.php?mode[]=reasons&' . POST_CAT_URL . "=$module_id&mode[]=up&" . POST_REPORT_REASON_URL . "=$reason_id",
- 'U_MOVE_DOWN' => 'admin_reports.php?mode[]=reasons&' . POST_CAT_URL . "=$module_id&mode[]=down&" . POST_REPORT_REASON_URL . "=$reason_id",
- 'U_DELETE' => 'admin_reports.php?mode[]=reasons&' . POST_CAT_URL . "=$module_id&mode[]=delete&" . POST_REPORT_REASON_URL . "=$reason_id")
- );
- }
- }
- else
- {
- $template->assign_block_vars('switch_no_reasons', array());
- }
-
- $template->assign_vars(array(
- 'U_ADD_REASON' => 'admin_reports.php?mode[]=reasons&' . POST_CAT_URL . "=$module_id&mode[]=add",
- 'U_MODULES' => "admin_reports.php",
- ));
-
- print_page('report_module_reasons_body.tpl', 'admin');
- break;
-
- default:
- bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
- break;
- }
- }
- break;
-
- //
- // Move module up/down
- //
- case 'up':
- case 'down':
- report_module_move($mode, $module_id);
-
- redirect($redirect_url);
- break;
-
- //
- // Synchronize module
- //
- case 'sync':
- if (!method_exists($report_module, 'sync'))
- {
- bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['admin'] . $return_links['index']);
- }
-
- $report_module->sync();
-
- bb_die($lang['REPORT_MODULE_SYNCED'] . $return_links['admin'] . $return_links['index']);
- break;
-
- //
- // Uninstall module
- //
- case 'uninstall':
- if (isset($_POST['confirm']))
- {
- report_module_uninstall($module_id);
-
- bb_die($lang['REPORT_MODULE_UNINSTALLED'] . $return_links['admin'] . $return_links['index']);
- }
- else if (isset($_POST['cancel']))
- {
- redirect($redirect_url);
- }
-
- $hidden_fields = '';
-
- print_confirmation(array(
- 'CONFIRM_TITLE' => $lang['UNINSTALL_REPORT_MODULE'],
- 'QUESTION' => $lang['UNINSTALL_REPORT_MODULE_EXPLAIN'],
- 'FORM_ACTION' => 'admin_reports.php',
- 'HIDDEN_FIELDS' => $hidden_fields,
- ));
- break;
-
- default:
- bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['admin'] . $return_links['index']);
- break;
- }
-}
-else if (isset($_POST['module']) || isset($_GET['module']))
-{
- $module_name = (isset($_POST['module'])) ? stripslashes($_POST['module']) : stripslashes($_GET['module']);
-
- if (!$report_module = report_modules_inactive('name', $module_name))
- {
- bb_die($lang['REPORT_MODULE_NOT_EXISTS'] . $return_links['admin'] . $return_links['index']);
- }
-
- switch ($mode)
- {
- //
- // Install module
- //
- case 'install':
- if (isset($_POST['submit']))
- {
- $module_notify = (isset($_POST['report_module_notify']) && $_POST['report_module_notify'] == 1) ? 1 : 0;
- $module_prune = (isset($_POST['report_module_prune'])) ? (int) $_POST['report_module_prune'] : 0;
-
- $auth_write = (isset($_POST['auth_write'])) ? (int) $_POST['auth_write'] : REPORT_AUTH_USER;
- $auth_view = (isset($_POST['auth_view'])) ? (int) $_POST['auth_view'] : REPORT_AUTH_MOD;
- $auth_notify = (isset($_POST['auth_notify'])) ? (int) $_POST['auth_notify'] : REPORT_AUTH_MOD;
- $auth_delete = (isset($_POST['auth_delete'])) ? (int) $_POST['auth_delete'] : REPORT_AUTH_ADMIN;
-
- report_module_install($module_notify, $module_prune, $module_name, $auth_write, $auth_view, $auth_notify, $auth_delete, false);
-
- bb_die($lang['REPORT_MODULE_INSTALLED'] . $return_links['admin'] . $return_links['index']);
- }
- else if (isset($_POST['cancel']))
- {
- redirect($redirect_url);
- }
-
- $module_info = $report_module->info();
-
- $hidden_fields = '';
-
- $template->assign_vars(array(
- 'S_HIDDEN_FIELDS' => $hidden_fields,
-
- 'MODULE_TITLE' => $module_info['title'],
- 'MODULE_EXPLAIN' => $module_info['explain'],
- 'MODULE_NOTIFY_ON' => ($bb_cfg['report_notify']) ? ' checked="checked"' : '',
- 'MODULE_NOTIFY_OFF' => (!$bb_cfg['report_notify']) ? ' checked="checked"' : '',
- 'MODULE_PRUNE' => 0,
- ));
-
- //
- // Authorisation selects
- //
- report_auth_select('auth_write', REPORT_AUTH_USER, array(REPORT_AUTH_USER, REPORT_AUTH_MOD, REPORT_AUTH_ADMIN));
- report_auth_select('auth_view', REPORT_AUTH_MOD);
- report_auth_select('auth_notify', REPORT_AUTH_MOD);
- report_auth_select('auth_delete', REPORT_AUTH_CONFIRM, array(REPORT_AUTH_MOD, REPORT_AUTH_CONFIRM, REPORT_AUTH_ADMIN));
-
- print_page('report_module_edit_body.tpl', 'admin');
- break;
-
- default:
- bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['admin'] . $return_links['index']);
- break;
- }
-}
-else
-{
- switch ($mode)
- {
- case '':
- $report_modules = report_modules();
- $report_counts = report_counts_obtain();
- $report_reason_counts = report_reason_counts_obtain();
-
- //
- // Display installed modules
- //
- $template->assign_block_vars('installed_modules', array());
- foreach (array_keys($report_modules) as $report_module_id)
- {
- $report_module =& $report_modules[$report_module_id];
- $module_info = $report_module->info();
-
- $template->assign_block_vars('installed_modules.modules', array(
- 'L_REASONS' => sprintf($lang['REASONS'], $report_reason_counts[$report_module->id]),
-
- 'MODULE_TITLE' => $module_info['title'],
- 'MODULE_EXPLAIN' => $module_info['explain'],
- 'REPORT_COUNT' => $report_counts[$report_module->id],
-
- 'U_EDIT' => 'admin_reports.php?mode=edit&' . POST_CAT_URL . '=' . $report_module->id,
- 'U_REASONS' => 'admin_reports.php?mode=reasons&' . POST_CAT_URL . '=' . $report_module->id,
- 'U_MOVE_UP' => 'admin_reports.php?mode=up&' . POST_CAT_URL . '=' . $report_module->id,
- 'U_MOVE_DOWN' => 'admin_reports.php?mode=down&' . POST_CAT_URL . '=' . $report_module->id,
- 'U_SYNC' => 'admin_reports.php?mode=sync&' . POST_CAT_URL . '=' . $report_module->id,
- 'U_UNINSTALL' => 'admin_reports.php?mode=uninstall&' . POST_CAT_URL . '=' . $report_module->id)
- );
-
- //
- // Display sync option if available
- //
- if (method_exists($report_module, 'sync'))
- {
- $template->assign_block_vars('installed_modules.modules.switch_sync', array());
- }
- }
-
- if (empty($report_modules))
- {
- $template->assign_block_vars('installed_modules.switch_no_modules', array());
- }
-
- $report_modules_inactive = report_modules_inactive();
-
- //
- // Display inactive modules
- //
- $template->assign_block_vars('inactive_modules', array());
- foreach (array_keys($report_modules_inactive) as $key)
- {
- $report_module =& $report_modules_inactive[$key];
- $module_info = $report_module->info();
-
- $template->assign_block_vars('inactive_modules.modules', array(
- 'MODULE_TITLE' => $module_info['title'],
- 'MODULE_EXPLAIN' => $module_info['explain'],
- 'REPORT_COUNT' => '-',
-
- 'U_INSTALL' => 'admin_reports.php?mode=install&module=' . $report_module->data['module_name'])
- );
- }
-
- if (empty($report_modules_inactive))
- {
- $template->assign_block_vars('inactive_modules.switch_no_modules', array());
- }
-
- print_page('report_modules_body.tpl', 'admin');
- break;
-
- default:
- bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['admin'] . $return_links['index']);
- break;
- }
-}
\ No newline at end of file
diff --git a/upload/config.php b/upload/config.php
index a1586e0e7..b1dd0ef9a 100644
--- a/upload/config.php
+++ b/upload/config.php
@@ -71,9 +71,9 @@ $domain_name = 'torrentpier.me'; // enter here your primary domain name of your
$domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $domain_name;
// Version info
-$bb_cfg['tp_version'] = '2.1 (STABLE)';
-$bb_cfg['tp_release_date'] = '01-09-2014';
-$bb_cfg['tp_release_state'] = 'R600';
+$bb_cfg['tp_version'] = '2.1.1';
+$bb_cfg['tp_release_date'] = '07-09-2014';
+$bb_cfg['tp_release_state'] = 'ALPHA';
// Database
$charset = 'utf8';
diff --git a/upload/includes/functions_report.php b/upload/includes/functions_report.php
deleted file mode 100644
index 448bb3ce3..000000000
--- a/upload/includes/functions_report.php
+++ /dev/null
@@ -1,1138 +0,0 @@
- $report_subject) {
- $temp[(int)$report_id] = (int)$report_subject[0];
- }
- } else {
- foreach ($subjects as $report_id => $report_subject) {
- $temp[(int)$report_id] = array(
- (int)$report_subject[0],
- $report_subject[1]);
- }
- }
-
- $subjects = $temp;
-}
-
-//
-// Reads modules from cache file
-//
-function report_modules_cache_read()
-{
- return CACHE('bb_cache')->get('report_modules');
-}
-
-//
-// Writes modules to cache file
-//
-function report_modules_cache_write($modules)
-{
- return (bool)CACHE('bb_cache')->set('report_modules', $modules, 86400);
-}
-
-//
-// Deletes modules cache file
-//
-function report_modules_cache_clean()
-{
- CACHE('bb_cache')->rm('report_modules');
-}
-
-//
-// Obtains modules from the database
-//
-function report_modules_obtain()
-{
- if (!$modules = CACHE('bb_cache')->get('report_modules_obtain')) {
- $sql = 'SELECT report_module_id, report_module_order, report_module_notify, report_module_prune, report_module_last_prune,
- report_module_name, auth_write, auth_view, auth_notify, auth_delete
- FROM ' . BB_REPORTS_MODULES . '
- ORDER BY report_module_order';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report modules');
- }
-
- $modules = DB()->sql_fetchrowset($result);
- DB()->sql_freeresult($result);
- CACHE('bb_cache')->set('report_modules_obtain', $modules, 600);
- }
-
- if (empty($modules)) {
- return array();
- }
-
- return $modules;
-}
-
-//
-// Obtains report modules from the database or the cache, includes modules and
-// stores module objects
-//
-function report_modules($mode = 'all', $module = null)
-{
- global $bb_cfg;
- static $modules, $module_names;
-
- if (!$bb_cfg['reports_enabled']) return false;
-
- if (!isset($modules)) {
- include(INC_DIR . "report_module.php");
-
- if (!$bb_cfg['report_modules_cache'] || !$rows = report_modules_cache_read()) {
- $rows = report_modules_obtain();
- if ($bb_cfg['report_modules_cache']) {
- report_modules_cache_write($rows);
- }
- }
-
- $modules = $module_names = array();
- foreach ($rows as $row) {
- // Include module file
- $row['report_module_name'] = basename($row['report_module_name']);
- include(INC_DIR . 'report_hack/' . $row['report_module_name'] . ".php");
-
- // Include language file
- $lang = array();
- $lang_file = LANG_ROOT_DIR . "{$bb_cfg['default_lang']}/report_hack/{$row['report_module_name']}.php";
- if (file_exists($lang_file)) {
- include($lang_file);
- }
-
- // Create module object
- $modules[$row['report_module_id']] = new $row['report_module_name']($row['report_module_id'], $row, $lang);
-
- // Add module name to convert array
- $module_names[$row['report_module_name']] = $row['report_module_id'];
-
- // Delete old reports
- if ($row['report_module_prune'] && $row['report_module_last_prune'] + ($row['report_module_prune'] * 3600) < TIMENOW) {
- report_prune($row['report_module_id'], $row['report_module_prune'] * 86400);
-
- if ($bb_cfg['report_modules_cache']) {
- report_modules_cache_clean();
- }
- }
- }
- }
-
- switch ($mode) {
- case 'all':
- return $modules;
- break;
-
- case 'names':
- return $module_names;
- break;
-
- case 'name':
- case 'id':
- if (!isset($module)) {
- return false;
- }
- $key = ($mode == 'name') ? $module_names[$module] : $module;
- return (isset($modules[$key])) ? $modules[$key] : false;
- break;
-
- default:
- return false;
- break;
- }
-}
-
-//
-// Checks the authorisation for multiple reports, returns array with report ids
-//
-function reports_auth_check(&$reports, $auth_names = 'auth_view', $subject_auth = true)
-{
- global $bb_cfg;
-
- if (!is_array($reports)) {
- return array();
- }
-
- $auth_check_array = $reports_data = array();
- foreach ($reports as $report) {
- if (!isset($auth_check_array[$report['report_module_id']])) {
- $auth_check_array[$report['report_module_id']] = array();
- }
-
- $auth_check_array[$report['report_module_id']][$report['report_id']] = array($report['report_subject'], $report['report_subject_data']);
-
- $reports_data[$report['report_id']] = $report;
- }
-
- $reports = $report_ids = array();
-
- $report_modules = report_modules();
- foreach ($auth_check_array as $report_module_id => $report_subjects) {
- $report_module =& $report_modules[$report_module_id];
-
- //
- // Check module authorisation
- //
- if (!$report_module->auth_check($auth_names)) {
- continue;
- }
-
- //
- // Check subject authorisation
- //
- if ($subject_auth && $bb_cfg['report_subject_auth']) {
- $report_module->subjects_auth_check($report_subjects);
- if (empty($report_subjects)) {
- continue;
- }
- }
-
- foreach (array_keys($report_subjects) as $report_id) {
- $reports[] = $reports_data[$report_id];
- $report_ids[] = $report_id;
- }
- }
-
- return $report_ids;
-}
-
-//
-// Executes a module action
-//
-function reports_module_action($reports, $action_name, $action_params = array())
-{
- if (!is_array($reports)) {
- return;
- }
-
- if (!is_array($action_params)) {
- $action_params = array(null, $action_params);
- } else {
- array_unshift($action_params, null);
- }
-
- $report_modules_subjects = array();
- foreach ($reports as $report) {
- if (!isset($report_modules_subjects[$report['report_module_id']])) {
- $report_modules_subjects[$report['report_module_id']] = array();
- }
-
- $report_modules_subjects[$report['report_module_id']][$report['report_id']] = array($report['report_subject'], $report['report_subject_data']);
- }
-
- $report_modules = report_modules();
- foreach ($report_modules_subjects as $report_module_id => $report_subjects) {
- $report_module =& $report_modules[$report_module_id];
-
- if (method_exists($report_module, "action_$action_name")) {
- $action_params[0] = $report_subjects;
- call_user_func_array(array($report_module, "action_$action_name"), $action_params);
- }
- }
-}
-
-//
-// Handles email notifications, note that this function has variable parameters
-// Includes authorisation check
-//
-function report_notify($mode)
-{
- global $user, $userdata, $bb_cfg;
-
- $num_args = func_num_args();
- $notify_users = $reports = array();
-
- switch ($mode) {
- case 'new':
- if ($num_args < 2) {
- return false;
- }
-
- $report = func_get_arg(1);
- $reports[$report['report_id']] =& $report;
-
- // get module object
- $report_module = report_modules('id', $report['report_module_id']);
-
- // Check if notifications are enabled
- if (!$report_module->data['report_module_notify']) {
- break;
- }
-
- // Obtain report reason description
- if ($report['report_reason_id']) {
- $sql = 'SELECT report_reason_desc FROM ' . BB_REPORTS_REASONS . ' WHERE report_reason_id = ' . $report['report_reason_id'];
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report reason desc');
- }
-
- $row = DB()->sql_fetchrow($result);
- DB()->sql_freeresult($result);
-
- $report['report_reason_desc'] = ($row) ? $row['report_reason_desc'] : '';
- } else {
- $report['report_reason_desc'] = '';
- }
-
- // Obtain notification users
- $user_level_sql = ($bb_cfg['report_list_admin']) ? '= ' . ADMIN : 'IN(' . ADMIN . ', ' . MOD . ')';
- $sql = 'SELECT username, user_id, user_level, user_email, user_lang
- FROM ' . BB_USERS . '
- WHERE user_active = 1
- AND user_level ' . $user_level_sql . '
- AND user_id <> ' . $userdata['user_id'];
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain administrators and moderators #1');
- }
-
- $notify_users[$report['report_id']] = array();
- while ($row = DB()->sql_fetchrow($result)) {
- // Check module authorisation
- if (!$report_module->auth_check(array('auth_view', 'auth_notify'), $row)) {
- continue;
- }
-
- // Check subject authorisation
- if ($bb_cfg['report_subject_auth']) {
- $report_subject = array($report['report_id'] => array($report['report_subject'], $report['report_subject_data']));
- if (!$report_module->subjects_auth_check($report_subject, $row)) {
- continue;
- }
- }
-
- $notify_users[$report['report_id']][] = $row;
- }
- DB()->sql_freeresult($result);
-
- // specify email template
- $email_template = 'report_new';
- break;
-
- case 'change':
- if ($num_args < 3) {
- return false;
- }
-
- $status = func_get_arg(1);
-
- $report_ids = func_get_arg(2);
- report_prepare_ids($report_ids);
-
- // Obtain report information
- $sql = 'SELECT r.report_id, r.report_module_id, r.report_subject, r.report_subject_data, r.report_title, r.report_desc,
- rc.report_change_time, rc.report_change_comment, u.username, u.user_rank
- FROM ' . BB_REPORTS . ' r
- INNER JOIN ' . BB_REPORTS_CHANGES . ' rc
- ON rc.report_change_id = r.report_last_change
- INNER JOIN ' . BB_USERS . ' u
- ON u.user_id = rc.user_id
- WHERE r.report_id IN(' . implode(', ', $report_ids) . ')';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report information');
- }
-
- $auth_check_array = array();
- while ($row = DB()->sql_fetchrow($result)) {
- if (isset($row['report_subject_data'])) {
- $row['report_subject_data'] = unserialize($row['report_subject_data']);
- }
-
- if (!isset($auth_check_array[$row['report_module_id']])) {
- $auth_check_array[$row['report_module_id']] = array();
- }
-
- $auth_check_array[$row['report_module_id']][$row['report_id']] = array($row['report_subject'], $row['report_subject_data']);
-
- $reports[$row['report_id']] = $row;
- }
- DB()->sql_freeresult($result);
-
- // Obtain notification users
- $user_level_sql = ($bb_cfg['report_list_admin']) ? '= ' . ADMIN : 'IN(' . ADMIN . ', ' . MOD . ')';
- $sql = 'SELECT user_id, user_level, user_email, user_lang
- FROM ' . BB_USERS . '
- WHERE user_active = 1
- AND user_level ' . $user_level_sql . '
- AND user_id <> ' . $userdata['user_id'];
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain administrators and moderators #2');
- }
-
- $auth_options = array('auth_view', 'auth_notify');
- if ($status == REPORT_DELETE) {
- $auth_options[] = 'auth_delete';
- }
-
- $report_modules = report_modules();
-
- while ($row = DB()->sql_fetchrow($result)) {
- foreach ($auth_check_array as $report_module_id => $report_subjects) {
- $report_module =& $report_modules[$report_module_id];
-
- // Check if notifications are enabled
- if (!$report_module->data['report_module_notify']) {
- continue;
- }
-
- // Check module authorisation
- if (!$report_module->auth_check($auth_options, $row)) {
- continue;
- }
-
- // Check subject authorisation
- if ($bb_cfg['report_subject_auth']) {
- $report_module->subjects_auth_check($report_subjects, $row);
- }
-
- // Add users
- foreach (array_keys($report_subjects) as $report_id) {
- if (!isset($notify_users[$report_id])) {
- $notify_users[$report_id] = array();
- }
-
- $notify_users[$report_id][] = $row;
- }
- }
- }
- DB()->sql_freeresult($result);
-
- // specify email template
- $email_template = 'report_change';
- break;
-
- default:
- return false;
- break;
- }
-
- if (empty($notify_users)) {
- return true;
- }
-
- require(INC_DIR . 'emailer.class.php');
- $emailer = new emailer($bb_cfg['smtp_delivery']);
-
- $emailer->from($bb_cfg['sitename'] . " <{$bb_cfg['board_email']}>");
-
- // Send emails
- foreach ($notify_users as $report_id => $report_notify_users) {
- $report =& $reports[$report_id];
- foreach ($report_notify_users as $user_info) {
- $emailer->use_template($email_template, $user_info['user_lang']);
- $emailer->email_address($user_info['username'] . " <{$user_info['user_email']}>");
-
- // Get language variables
- $lang =& report_notify_lang($user_info['user_lang']);
-
- // Set email variables, we use $vars here because of an emailer bug
- $vars = array(
- 'SITENAME' => $bb_cfg['sitename'],
-
- 'REPORT_TITLE' => $report['report_title'],
- 'REPORT_TEXT' => $report['report_desc'],
-
- 'U_REPORT_VIEW' => make_url("report.php?" . POST_REPORT_URL . "=$report_id"),
- );
-
- switch ($mode) {
- case 'new':
- if ($report['report_reason_desc']) {
- $report_reason = (isset($lang[$report['report_reason_desc']])) ? $lang[$report['report_reason_desc']] : $report['report_reason_desc'];
- } else {
- $report_reason = '-';
- }
-
- $vars = array_merge($vars, array(
- 'REPORT_AUTHOR' => $userdata['username'],
- 'REPORT_TIME' => bb_date($report['report_time'], $bb_cfg['last_post_date_format']),
- 'REPORT_REASON' => $report_reason,
- ));
- break;
-
- case 'change':
- $vars = array_merge($vars, array(
- 'REPORT_CHANGE_AUTHOR' => $report['username'],
- 'REPORT_CHANGE_TIME' => bb_date($report['report_change_time'], $bb_cfg['last_post_date_format']),
- 'REPORT_CHANGE_STATUS' => $lang['REPORT_STATUS'][$status],
- 'REPORT_CHANGE_COMMENT' => str_replace(array("\r\n", "\r", "\n"), ' ', $report['report_change_comment']),
- ));
- break;
- }
-
- $emailer->assign_vars($vars);
- $emailer->send();
- $emailer->reset();
- }
- }
-
- return true;
-}
-
-//
-// Helper function for report_notify(), returns general language variable for the specified
-// language
-//
-function &report_notify_lang($language)
-{
- global $bb_cfg;
- static $languages = array();
- $language = $bb_cfg['default_lang'];
-
- if (!isset($languages[$language])) {
- if ($bb_cfg['default_lang'] == $language) {
- global $lang;
- } else {
- $lang = array();
- include(LANG_ROOT_DIR . "$language/main.php");
- }
-
- $languages[$language] = $lang;
- }
-
- return $languages[$language];
-}
-
-//
-// Obtains count of new and open reports
-// Includes authorisation check
-//
-function report_count_obtain()
-{
- global $userdata, $bb_cfg;
- static $report_count;
-
- if (isset($report_count)) {
- return $report_count;
- }
-
- if ($userdata['user_level'] == ADMIN) {
- if (!$report_count = CACHE('bb_cache')->get('report_count_obtain')) {
- $sql = 'SELECT COUNT(report_id) AS report_count FROM ' . BB_REPORTS . ' WHERE report_status IN(' . REPORT_NEW . ', ' . REPORT_OPEN . ')';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report count #1');
- }
- $report_count = DB()->sql_fetchfield('report_count', 0, $result);
- DB()->sql_freeresult($result);
- CACHE('bb_cache')->set('report_count_obtain', $report_count, 600);
- }
- } else if ($userdata['user_level'] != MOD) {
- $report_count = 0;
- } else if (!$bb_cfg['report_subject_auth']) {
- $sql = 'SELECT COUNT(r.report_id) AS report_count
- FROM ' . BB_REPORTS . ' r
- INNER JOIN ' . BB_REPORTS_MODULES . ' rm
- ON rm.report_module_id = r.report_module_id
- WHERE report_status IN(' . REPORT_NEW . ', ' . REPORT_OPEN . ')
- AND rm.auth_view <= ' . REPORT_AUTH_MOD;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report count #2');
- }
-
- $report_count = DB()->sql_fetchfield('report_count', 0, $result);
- DB()->sql_freeresult($result);
- } else {
- $sql = 'SELECT report_id, report_module_id, report_subject, report_subject_data
- FROM ' . BB_REPORTS . '
- WHERE report_status IN(' . REPORT_NEW . ', ' . REPORT_OPEN . ')';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not check report auth');
- }
-
- $reports = DB()->sql_fetchrowset($result);
- DB()->sql_freeresult($result);
-
- if (!empty($reports)) {
- for ($i = 0, $count = count($reports); $i < $count; $i++) {
- if (isset($reports[$i]['report_subject_data'])) {
- $reports[$i]['report_subject_data'] = unserialize($reports[$i]['report_subject_data']);
- }
- }
-
- reports_auth_check($reports);
- $report_count = count($reports);
- } else {
- $report_count = 0;
- }
- }
-
- return $report_count;
-}
-
-//
-// Obtains reports (for a specific report module if $module_id is defined)
-// Includes authorisation check if $auth_check is set to true.
-//
-function reports_obtain($module_id = null, $auth_check = true)
-{
- $where_sql = (isset($module_id)) ? 'AND r.report_module_id = ' . (int)$module_id : '';
- $sql = 'SELECT r.report_id, r.user_id, r.report_time, r.report_module_id, r.report_status, r.report_subject,
- r.report_subject_data, r.report_title, u.username, u.user_rank
- FROM ' . BB_REPORTS . ' r
- LEFT JOIN ' . BB_USERS . ' u
- ON u.user_id = r.user_id
- WHERE r.report_status <> ' . REPORT_DELETE . "
- $where_sql
- ORDER BY r.report_status ASC, r.report_time DESC";
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain reports #1');
- }
-
- $rows = DB()->sql_fetchrowset($result);
- DB()->sql_freeresult($result);
-
- if (empty($rows)) {
- return array();
- }
-
- for ($i = 0, $count = count($rows); $i < $count; $i++) {
- if (isset($rows[$i]['report_subject_data'])) {
- $rows[$i]['report_subject_data'] = unserialize($rows[$i]['report_subject_data']);
- }
- }
-
- // Check authorisation
- if ($auth_check) {
- reports_auth_check($rows);
- }
-
- // Prepare reports array
- $reports = array();
- foreach ($rows as $row) {
- if (!isset($reports[$row['report_module_id']])) {
- $reports[$row['report_module_id']] = array();
- }
-
- $reports[$row['report_module_id']][] = $row;
- }
-
- return $reports;
-}
-
-//
-// Obtains open reports
-// Includes authorisation check if $auth_check is set to true.
-//
-function reports_open_obtain($module_id, $report_subject, $auth_check = true)
-{
- $sql = 'SELECT r.report_id, r.user_id, r.report_time, r.report_module_id, r.report_status, r.report_subject,
- r.report_subject_data, r.report_title, u.username, u.user_rank
- FROM ' . BB_REPORTS . ' r
- LEFT JOIN ' . BB_USERS . ' u
- ON u.user_id = r.user_id
- WHERE r.report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
- AND r.report_module_id = ' . (int)$module_id . '
- AND r.report_subject = ' . (int)$report_subject . '
- ORDER BY r.report_status ASC, r.report_time DESC';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain open reports');
- }
-
- $reports = DB()->sql_fetchrowset($result);
- DB()->sql_freeresult($result);
-
- if (empty($reports)) {
- return array();
- }
-
- for ($i = 0, $count = count($reports); $i < $count; $i++) {
- if (isset($reports[$i]['report_subject_data'])) {
- $reports[$i]['report_subject_data'] = unserialize($reports[$i]['report_subject_data']);
- }
- }
-
- // Check authorisation
- if ($auth_check) {
- reports_auth_check($reports);
- }
-
- return $reports;
-}
-
-//
-// Obtains reports suggested for deletion
-// Includes authorisation check if $auth_check is set to true.
-//
-function reports_deleted_obtain($auth_check = true)
-{
- $sql = 'SELECT r.report_id, r.user_id, r.report_time, r.report_module_id, r.report_subject,
- r.report_subject_data, r.report_title, u.username, u.user_rank
- FROM ' . BB_REPORTS . ' r
- LEFT JOIN ' . BB_USERS . ' u
- ON u.user_id = r.user_id
- WHERE r.report_status = ' . REPORT_DELETE . '
- ORDER BY r.report_time DESC';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain deleted reports');
- }
-
- $reports = DB()->sql_fetchrowset($result);
- DB()->sql_freeresult($result);
-
- if (empty($reports)) {
- return array();
- }
-
- for ($i = 0, $count = count($reports); $i < $count; $i++) {
- if (isset($reports[$i]['report_subject_data'])) {
- $reports[$i]['report_subject_data'] = unserialize($reports[$i]['report_subject_data']);
- }
- }
-
- // Check authorisation
- if ($auth_check) {
- reports_auth_check($reports, array('auth_view', 'auth_delete'));
- }
-
- return $reports;
-}
-
-//
-// Obtains report information for the specified report.
-// Includes authorisation check if $auth_check is set to true.
-//
-function report_obtain($report_id, $auth_check = true)
-{
- global $lang;
-
- $sql = 'SELECT r.report_id, r.user_id, r.report_time, r.report_module_id, r.report_status, r.report_subject,
- r.report_subject_data, r.report_title, r.report_desc, rr.report_reason_desc, u.username, u.user_rank
- FROM ' . BB_REPORTS . ' r
- LEFT JOIN ' . BB_REPORTS_REASONS . ' rr
- ON rr.report_reason_id = r.report_reason_id
- LEFT JOIN ' . BB_USERS . ' u
- ON u.user_id = r.user_id
- WHERE r.report_id = ' . (int)$report_id;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain reports #2');
- }
-
- $report = DB()->sql_fetchrow($result);
- DB()->sql_freeresult($result);
-
- if (!$report) {
- return false;
- }
-
- if (isset($report['report_subject_data'])) {
- $report['report_subject_data'] = unserialize($report['report_subject_data']);
- }
-
- if (isset($report['report_reason_desc']) && isset($lang[$report['report_reason_desc']])) {
- $report['report_reason_desc'] = $lang[$report['report_reason_desc']];
- }
-
- // Check authorisation
- if ($auth_check) {
- $auth_names = ($report['report_status'] == REPORT_DELETE) ? array('auth_view', 'auth_delete') : 'auth_view';
- $reports = array($report);
-
- reports_auth_check($reports, $auth_names);
-
- return (!empty($reports)) ? $reports[0] : false;
- } else {
- return $report;
- }
-}
-
-//
-// Returns report changes for the specified report.
-// Doesn't include authorisation check
-//
-function report_changes_obtain($report_id)
-{
- $sql = 'SELECT rc.user_id, rc.report_change_time, rc.report_status, rc.report_change_comment, u.username, u.user_rank
- FROM ' . BB_REPORTS_CHANGES . ' rc
- LEFT JOIN ' . BB_USERS . ' u
- ON u.user_id = rc.user_id
- WHERE rc.report_id = ' . (int)$report_id . '
- ORDER BY rc.report_change_time';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report changes');
- }
-
- $report_changes = DB()->sql_fetchrowset($result);
- DB()->sql_freeresult($result);
-
- if (empty($report_changes)) {
- return array();
- }
-
- return $report_changes;
-}
-
-//
-// Checks if there is a duplicate report
-//
-function report_duplicate_check($module_id, $report_subject)
-{
- $sql = 'SELECT COUNT(report_id) AS count
- FROM ' . BB_REPORTS . '
- WHERE report_module_id = ' . (int)$module_id . '
- AND report_subject = ' . (int)$report_subject . '
- AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not check for duplicate reports');
- }
-
- $count = DB()->sql_fetchfield('count', 0, $result);
- DB()->sql_freeresult($result);
-
- return ($count > 0);
-}
-
-//
-// Deletes old reports
-//
-function report_prune($module_id, $prune_time)
-{
- //
- // Obtain old reports
- //
- $sql = 'SELECT r.report_id, r.report_module_id, r.report_subject, r.report_subject_data
- FROM ' . BB_REPORTS . ' r
- INNER JOIN ' . BB_REPORTS_CHANGES . ' rc
- ON rc.report_change_id = r.report_last_change
- WHERE r.report_module_id = ' . (int)$module_id . '
- AND r.report_status IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
- AND rc.report_change_time < ' . (TIMENOW - (int)$prune_time);
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain old reports #1');
- }
-
- $reports = $report_ids = array();
- while ($row = DB()->sql_fetchrow($result)) {
- $reports[] = $row;
- $report_ids[] = $row['report_id'];
- }
- DB()->sql_freeresult($result);
-
- // Execute module action
- reports_module_action($reports, 'delete');
-
- // Delete reports
- reports_delete($report_ids, false, false);
-
- // Set last prune date
- $sql = 'UPDATE ' . BB_REPORTS_MODULES . ' SET report_module_last_prune = ' . TIMENOW . ' WHERE report_module_id = ' . (int)$module_id;
- if (!DB()->sql_query($sql)) {
- bb_die('Could not delete old reports #2');
- }
-}
-
-//
-// Inserts a new report
-// Includes authorisation check if $auth_check is set to true.
-//
-function report_insert($module_id, $report_subject, $report_reason, $report_title, $report_desc, $auth_check = true, $module_action = true, $notify = true)
-{
- global $userdata, $bb_cfg;
-
- $report_module = report_modules('id', $module_id);
-
- // Check authorisation
- if ($auth_check && !$report_module->auth_check('auth_write')) {
- return false;
- }
-
- if (method_exists($report_module, 'subject_data_obtain')) {
- $report_subject_data = $report_module->subject_data_obtain($report_subject);
-
- if (is_array($report_subject_data)) {
- $report_subject_data_sql = "'" . str_replace("\'", "''", addslashes(serialize($report_subject_data))) . "'";
- } else {
- $report_subject_data_sql = 'NULL';
- }
- } else {
- $report_subject_data = null;
- $report_subject_data_sql = 'NULL';
- }
-
- //
- // Insert report
- //
- $sql = 'INSERT INTO ' . BB_REPORTS . ' (user_id, report_time, report_module_id, report_status, report_reason_id,
- report_subject, report_subject_data, report_title, report_desc)
- VALUES (' . $userdata['user_id'] . ', ' . TIMENOW . ', ' . (int)$module_id . ', ' . REPORT_NEW . ', ' . (int)$report_reason . ',
- ' . (int)$report_subject . ", $report_subject_data_sql, '" . DB()->escape($report_title) . "',
- '" . DB()->escape($report_desc) . "')";
- if (!DB()->sql_query($sql)) {
- bb_die('Could not insert report');
- }
-
- $report_id = DB()->sql_nextid();
-
- $report = array(
- 'report_id' => $report_id,
- 'report_time' => TIMENOW,
- 'report_module_id' => $module_id,
- 'report_reason_id' => $report_reason,
- 'report_subject' => $report_subject,
- 'report_subject_data' => $report_subject_data,
- 'report_title' => $report_title,
- 'report_desc' => $report_desc
- );
-
- // Execute module action
- if ($module_action) {
- $report_module = report_modules('id', $module_id);
- if (method_exists($report_module, 'action_insert')) {
- $report_module->action_insert($report_subject, $report_id, $report_subject_data);
- }
- }
-
- // Send report notifications
- if ($notify && ($bb_cfg['report_notify'] == REPORT_NOTIFY_NEW || $bb_cfg['report_notify'] == REPORT_NOTIFY_CHANGE)) {
- report_notify('new', $report);
- }
-
- // Increase report counter
- if (isset($bb_cfg['report_hack_count'])) {
- $sql = 'UPDATE ' . BB_CONFIG . " SET config_value = config_value + 1 WHERE config_name = 'report_hack_count'";
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update report hack count');
- }
- }
-
- CACHE('bb_cache')->rm('report_count_obtain');
-
- return $report_id;
-}
-
-//
-// Updates the status of the specified reports to $report_status, also inserts report status changes (with $comment)
-// Includes authorisation check if $auth_check is set to true.
-//
-function reports_update_status($report_ids, $report_status, $comment = '', $auth_check = true, $module_action = true, $notify = true)
-{
- global $userdata, $bb_cfg;
-
- report_prepare_ids($report_ids);
- $report_status = (int)$report_status;
-
- if (empty($report_ids)) {
- return;
- }
-
- if ($auth_check || $module_action) {
- $sql = 'SELECT report_id, report_module_id, report_subject, report_subject_data
- FROM ' . BB_REPORTS . '
- WHERE report_id IN(' . implode(', ', $report_ids) . ')';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain reports #3');
- }
-
- $reports = DB()->sql_fetchrowset($result);
- DB()->sql_freeresult($result);
-
- if (empty($reports)) {
- return;
- }
- }
-
- // Check authorisation
- if ($auth_check) {
- $report_ids = reports_auth_check($reports);
- }
-
- if (empty($report_ids)) {
- return;
- }
-
- // Insert report status changes and update reports
- $comment = DB()->escape($comment);
- foreach ($report_ids as $report_id) {
- $sql = 'INSERT INTO ' . BB_REPORTS_CHANGES . " (report_id, user_id, report_change_time, report_status, report_change_comment)
- VALUES($report_id, " . $userdata['user_id'] . ', ' . TIMENOW . ", $report_status, '$comment')";
- if (!DB()->sql_query($sql)) {
- bb_die('Could not insert report change');
- }
-
- $change_id = DB()->sql_nextid();
-
- // Update reports
- $sql = 'UPDATE ' . BB_REPORTS . "
- SET
- report_status = $report_status,
- report_last_change = " . (int)$change_id . "
- WHERE report_id = $report_id";
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update reports status');
- }
- }
-
- // Execute module action
- if ($module_action) {
- reports_module_action($reports, 'update_status', $report_status);
- }
-
- // Send report notifications
- if ($notify && $bb_cfg['report_notify'] == REPORT_NOTIFY_CHANGE) {
- report_notify('change', $report_status, $report_ids);
- }
-
- CACHE('bb_cache')->rm('report_count_obtain');
-}
-
-//
-// Deletes the specified reports, also deletes report status changes
-// Includes authorisation check if $auth_check is set to true.
-//
-function reports_delete($report_ids, $auth_check = true, $module_action = true)
-{
- report_prepare_ids($report_ids);
-
- if (empty($report_ids)) {
- return;
- }
-
- if ($auth_check || $module_action) {
- $sql = 'SELECT report_id, report_status, report_module_id, report_subject, report_subject_data
- FROM ' . BB_REPORTS . '
- WHERE report_id IN(' . implode(', ', $report_ids) . ')';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain reports #4');
- }
-
- $reports = DB()->sql_fetchrowset($result);
- DB()->sql_freeresult($result);
-
- if (empty($reports)) {
- return;
- }
- }
-
- // Check authorisation
- if ($auth_check) {
- // general authorisation check
- $update_ids = reports_auth_check($reports, array('auth_view', 'auth_delete_view'));
-
- // check for auth_delete
- $report_ids = reports_auth_check($reports, 'auth_delete', false);
-
- // Update reports without auth_delete
- for ($i = 0, $count = count($update_ids); $i < $count; $i++) {
- if (in_array($update_ids[$i], $report_ids)) {
- unset($update_ids[$i]);
- }
- }
-
- if (!empty($update_ids)) {
- reports_update_status($update_ids, REPORT_DELETE, false, false);
- }
- }
-
- $reports_sql = implode(', ', $report_ids);
- if ($reports_sql == '') {
- return;
- }
-
- // Delete reports
- $sql = 'DELETE FROM ' . BB_REPORTS . " WHERE report_id IN($reports_sql)";
- if (!DB()->sql_query($sql)) {
- bb_die('Could not delete reports');
- }
-
- // Delete report status changes
- $sql = 'DELETE FROM ' . BB_REPORTS_CHANGES . " WHERE report_id IN($reports_sql)";
- if (!DB()->sql_query($sql)) {
- bb_die('Could not delete reports changes');
- }
-
- // Execute module action
- if ($module_action) {
- reports_module_action($reports, 'delete');
- }
-
- CACHE('bb_cache')->rm('report_count_obtain');
-}
-
-//
-// Returns report statistics
-//
-function report_statistics($mode)
-{
- global $bb_cfg;
-
- switch ($mode) {
- case 'report_hack_count':
- return $bb_cfg[$mode];
- break;
-
- case 'report_count':
- $sql = 'SELECT COUNT(report_id) AS report_count
- FROM ' . BB_REPORTS;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report statistics');
- }
-
- $report_count = DB()->sql_fetchfield('report_count', 0, $result);
- DB()->sql_freeresult($result);
-
- if ($report_count > $bb_cfg['report_hack_count']) {
- $sql = 'UPDATE ' . BB_CONFIG . " SET config_value = '" . $report_count . "' WHERE config_name = 'report_hack_count'";
- DB()->sql_query($sql);
- }
-
- return $report_count;
- break;
-
- case 'modules_count':
- $report_modules = report_modules();
-
- return count($report_modules);
- break;
- }
-
- return $mode;
-}
-
-//
-// Obtains all forums moderated by the specified user
-//
-function user_moderated_forums($user_id)
-{
- static $moderators = array();
-
- if (!isset($moderators[$user_id])) {
- // all auth_mod of user
- $sql = 'SELECT aa.forum_id
- FROM ' . BB_USER_GROUP . ' ug
- INNER JOIN ' . BB_AUTH_ACCESS . ' aa
- ON aa.group_id = ug.group_id
- WHERE ug.user_id = ' . (int)$user_id . '
- AND aa.forum_perm = 8
- GROUP BY aa.forum_id';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain moderated forums');
- }
-
- $moderators[$user_id] = array();
- while ($row = DB()->sql_fetchrow($result)) {
- $moderators[$user_id][] = $row['forum_id'];
- }
- DB()->sql_freeresult($result);
- }
-
- return $moderators[$user_id];
-}
\ No newline at end of file
diff --git a/upload/includes/functions_report_admin.php b/upload/includes/functions_report_admin.php
deleted file mode 100644
index a2c71263c..000000000
--- a/upload/includes/functions_report_admin.php
+++ /dev/null
@@ -1,520 +0,0 @@
-sql_query($sql)) {
- bb_die('Could not obtain report counts');
- }
-
- $report_counts = array();
- while ($row = DB()->sql_fetchrow($result)) {
- $report_counts[$row['report_module_id']] = $row['report_count'];
- }
- DB()->sql_freeresult($result);
-
- return $report_counts;
-}
-
-//
-// Obtains report reason count for each report module
-//
-function report_reason_counts_obtain()
-{
- $sql = 'SELECT rm.report_module_id, COUNT(rr.report_reason_id) AS reason_count
- FROM ' . BB_REPORTS_MODULES . ' rm
- LEFT JOIN ' . BB_REPORTS_REASONS . ' rr
- ON rr.report_module_id = rm.report_module_id
- GROUP BY rm.report_module_id';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report reason counts');
- }
-
- $report_reason_counts = array();
- while ($row = DB()->sql_fetchrow($result)) {
- $report_reason_counts[$row['report_module_id']] = $row['reason_count'];
- }
- DB()->sql_freeresult($result);
-
- return $report_reason_counts;
-}
-
-//
-// Obtains inactive report modules, includes modules and stores module objects
-//
-function report_modules_inactive($mode = 'all', $module = null)
-{
- global $bb_cfg;
- static $modules;
-
- if (!isset($modules)) {
- if (!class_exists("report_module"))
- include(INC_DIR . "report_module.php");
-
- $installed_modules = report_modules('names');
-
- $deny_modes = array('open', 'process', 'clear', 'delete', 'reported');
-
- $dir = @opendir(INC_DIR . 'report_hack');
-
- $modules = array();
-
- while ($file = @readdir($dir)) {
- if (!preg_match('#(.*)\.' . bb_preg_quote('php', '#') . '$#', $file, $matches)) {
- continue;
- }
-
- // exclude installed modules
- $module_name = $matches[1];
- if (isset($installed_modules[$module_name])) {
- continue;
- }
-
- // include module file
- include(INC_DIR . "report_hack/$file");
-
- // Include language file
- $lang = array();
-
- $lang_file = LANG_ROOT_DIR . "{$bb_cfg['default_lang']}/report_hack/$module_name.php";
- if (file_exists($lang_file)) {
- include($lang_file);
- }
-
- // Create module object
- $modules[$module_name] = new $module_name(0, array('module_name' => $module_name), $lang);
-
- //
- // Check validity of the module
- //
- if (!empty($modules[$module_name]->mode) && in_array($modules[$module_name]->mode, $deny_modes)) {
- unset($modules[$module_name]);
- }
- if (!isset($modules[$module_name]->id) || !isset($modules[$module_name]->data) || !isset($modules[$module_name]->lang) || !isset($modules[$module_name]->duplicates)) {
- unset($modules[$module_name]);
- }
- }
-
- @closedir($dir);
- }
-
- switch ($mode) {
- case 'all':
- return $modules;
- break;
-
- case 'name':
- if (!isset($module)) {
- return false;
- }
-
- return (isset($modules[$module])) ? $modules[$module] : false;
- break;
-
- default:
- return false;
- break;
- }
-}
-
-//
-// Generates the auth select box
-//
-function report_auth_select($block_name, $default, $select_items = array(REPORT_AUTH_MOD, REPORT_AUTH_ADMIN))
-{
- global $lang, $template;
-
- foreach ($select_items as $value) {
- $template->assign_block_vars($block_name, array(
- 'VALUE' => $value,
- 'TITLE' => $lang['REPORT_AUTH'][$value],
- 'SELECTED' => ($value == $default) ? ' selected="selected"' : '')
- );
- }
-}
-
-//
-// Installs a report module
-//
-function report_module_install($module_notify, $module_prune, $module_name, $auth_write, $auth_view, $auth_notify, $auth_delete, $check = true)
-{
- global $bb_cfg;
-
- //
- // Check module
- //
- if ($check) {
- if (!$report_module = report_modules_inactive('name', $module_name)) {
- return false;
- }
- }
-
- //
- // Get module order
- //
- $sql = 'SELECT MAX(report_module_order) AS max_order
- FROM ' . BB_REPORTS_MODULES;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain max order #1');
- }
-
- $max_order = DB()->sql_fetchfield('max_order', 0, $result);
- DB()->sql_freeresult($result);
-
- //
- // Insert module
- //
- $sql = 'INSERT INTO ' . BB_REPORTS_MODULES . ' (report_module_order, report_module_notify, report_module_prune,
- report_module_name, auth_write, auth_view, auth_notify, auth_delete)
- VALUES(' . ($max_order + 1) . ', ' . (int)$module_notify . ', ' . (int)$module_prune . ",
- '" . DB()->escape($module_name) . "', " . (int)$auth_write . ', ' . (int)$auth_view . ',
- ' . (int)$auth_notify . ', ' . (int)$auth_delete . ')';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not install report module');
- }
-
- $module_id = DB()->sql_nextid();
-
- //
- // Clean modules cache
- //
- if ($bb_cfg['report_modules_cache']) {
- report_modules_cache_clean();
- }
-
- return $module_id;
-}
-
-//
-// Edits a module
-//
-function report_module_edit($module_id, $module_notify, $module_prune, $auth_write, $auth_view, $auth_notify, $auth_delete)
-{
- global $bb_cfg;
-
- $sql = 'UPDATE ' . BB_REPORTS_MODULES . '
- SET
- report_module_notify = ' . (int)$module_notify . ',
- report_module_prune = ' . (int)$module_prune . ',
- auth_write = ' . (int)$auth_write . ',
- auth_view = ' . (int)$auth_view . ',
- auth_notify = ' . (int)$auth_notify . ',
- auth_delete = ' . (int)$auth_delete . '
- WHERE report_module_id = ' . (int)$module_id;
- if (!DB()->sql_query($sql)) {
- bb_die('Could not edit report module');
- }
-
- //
- // Clean modules cache
- //
- if ($bb_cfg['report_modules_cache']) {
- report_modules_cache_clean();
- }
-}
-
-//
-// Moves a module to another position (up or down), reorders other modules
-//
-function report_module_move($mode, $module_id, $steps = 1)
-{
- global $bb_cfg;
-
- if (!$report_module = report_modules('id', $module_id)) {
- return false;
- }
-
- switch ($mode) {
- case 'up':
- $sql = 'UPDATE ' . BB_REPORTS_MODULES . "
- SET report_module_order = report_module_order + 1
- WHERE report_module_order >= " . ($report_module->data['report_module_order'] - (int)$steps) . '
- AND report_module_order < ' . $report_module->data['report_module_order'];
- break;
-
- case 'down':
- $sql = 'UPDATE ' . BB_REPORTS_MODULES . "
- SET report_module_order = report_module_order - 1
- WHERE report_module_order <= " . ($report_module->data['report_module_order'] + (int)$steps) . '
- AND report_module_order > ' . $report_module->data['report_module_order'];
- break;
-
- default:
- return false;
- break;
- }
-
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update module order #1');
- }
-
- if (DB()->affected_rows()) {
- $op = ($mode == 'up') ? '-' : '+';
- $sql = 'UPDATE ' . BB_REPORTS_MODULES . "
- SET report_module_order = report_module_order $op 1
- WHERE report_module_id = " . (int)$module_id;
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update module order #2');
- }
- }
-
- DB()->sql_query('');
-
- //
- // Clean modules cache
- //
- if ($bb_cfg['report_modules_cache']) {
- report_modules_cache_clean();
- }
-
- return true;
-}
-
-//
-// Uninstalls a report module
-//
-function report_module_uninstall($module_id)
-{
- global $bb_cfg;
-
- //
- // Obtain reports in this module
- //
- $sql = 'SELECT report_id
- FROM ' . BB_REPORTS . '
- WHERE report_module_id = ' . (int)$module_id;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report ids');
- }
-
- $report_ids = array();
- while ($row = DB()->sql_fetchrow($result)) {
- $report_ids = $row['report_id'];
- }
- DB()->sql_freeresult($result);
-
- // delete reports
- reports_delete($report_ids, false, false);
-
- //
- // Sync module
- //
- $report_module = report_modules('id', $module_id);
- if (method_exists($report_module, 'sync')) {
- $report_module->sync(true);
- }
-
- //
- // Update module order
- //
- $sql = 'UPDATE ' . BB_REPORTS_MODULES . '
- SET report_module_order = report_module_order - 1
- WHERE report_module_order > ' . $report_module->data['report_module_order'];
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update module order #3');
- }
-
- //
- // Delete report reasons
- //
- $sql = 'DELETE FROM ' . BB_REPORTS_REASONS . '
- WHERE report_module_id = ' . (int)$module_id;
- if (!DB()->sql_query($sql)) {
- bb_die('Could not delete report reason #1');
- }
-
- //
- // Delete module
- //
- $sql = 'DELETE FROM ' . BB_REPORTS_MODULES . '
- WHERE report_module_id = ' . (int)$module_id;
- if (!DB()->sql_query($sql)) {
- bb_die('Could not delete report module');
- }
-
- //
- // Clean modules cache
- //
- if ($bb_cfg['report_modules_cache']) {
- report_modules_cache_clean();
- }
-}
-
-//
-// Obtains a report reason
-//
-function report_reason_obtain($reason_id)
-{
- $sql = 'SELECT report_reason_desc
- FROM ' . BB_REPORTS_REASONS . '
- WHERE report_reason_id = ' . (int)$reason_id;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report reason #1');
- }
-
- $row = DB()->sql_fetchrow($result);
- DB()->sql_freeresult($result);
-
- return $row;
-}
-
-//
-// Inserts a report reason
-//
-function report_reason_insert($module_id, $reason_desc)
-{
- //
- // Get reason order
- //
- $sql = 'SELECT MAX(report_reason_order) AS max_order
- FROM ' . BB_REPORTS_REASONS;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain max order #2');
- }
-
- $max_order = DB()->sql_fetchfield('max_order', 0, $result);
- DB()->sql_freeresult($result);
-
- //
- // Insert reason
- //
- $sql = 'INSERT INTO ' . BB_REPORTS_REASONS . ' (report_module_id, report_reason_order, report_reason_desc)
- VALUES(' . (int)$module_id . ', ' . ($max_order + 1) . ", '" . DB()->escape($reason_desc) . "')";
- if (!DB()->sql_query($sql)) {
- bb_die('Could not insert report reason');
- }
-
- return DB()->sql_nextid();
-}
-
-//
-// Edits a report reason
-//
-function report_reason_edit($reason_id, $module_id, $reason_desc)
-{
- $sql = 'UPDATE ' . BB_REPORTS_REASONS . '
- SET
- report_module_id = ' . (int)$module_id . ",
- report_reason_desc = '" . DB()->escape($reason_desc) . "'
- WHERE report_reason_id = " . (int)$reason_id;
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update report reason');
- }
-}
-
-//
-// Moves a report reason to another position (up or down), reorders other report reasons
-//
-function report_reason_move($mode, $reason_id, $steps = 1)
-{
- //
- // Obtain report reason information
- //
- $sql = 'SELECT report_module_id, report_reason_order
- FROM ' . BB_REPORTS_REASONS . '
- WHERE report_reason_id = ' . (int)$reason_id;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report reason #3');
- }
-
- $row = DB()->sql_fetchrow($result);
- DB()->sql_freeresult($result);
-
- if (!$row) {
- return false;
- }
-
- switch ($mode) {
- case 'up':
- $sql = 'UPDATE ' . BB_REPORTS_REASONS . '
- SET report_reason_order = report_reason_order + 1
- WHERE report_module_id = ' . $row['report_module_id'] . '
- AND report_reason_order >= ' . ($row['report_reason_order'] - (int)$steps) . '
- AND report_reason_order < ' . $row['report_reason_order'];
- break;
-
- case 'down':
- $sql = 'UPDATE ' . BB_REPORTS_REASONS . '
- SET report_reason_order = report_reason_order - 1
- WHERE report_module_id = ' . $row['report_module_id'] . '
- AND report_reason_order <= ' . ($row['report_reason_order'] + (int)$steps) . '
- AND report_reason_order > ' . $row['report_reason_order'];
- break;
-
- default:
- return false;
- break;
- }
-
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update report reason order #1');
- }
-
- if (DB()->affected_rows()) {
- $op = ($mode == 'up') ? '-' : '+';
- $sql = 'UPDATE ' . BB_REPORTS_REASONS . "
- SET report_reason_order = report_reason_order $op 1
- WHERE report_reason_id = " . (int)$reason_id;
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update report reason order #2');
- }
- }
-
- DB()->sql_query('');
-
- return true;
-}
-
-//
-// Deletes a report reason
-//
-function report_reason_delete($reason_id)
-{
- //
- // Obtain report reason information
- //
- $sql = 'SELECT report_module_id, report_reason_order
- FROM ' . BB_REPORTS_REASONS . '
- WHERE report_reason_id = ' . (int)$reason_id;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report reason #3');
- }
-
- $row = DB()->sql_fetchrow($result);
- DB()->sql_freeresult($result);
-
- if (!$row) {
- return;
- }
-
- //
- // Update report reason order
- //
- $sql = 'UPDATE ' . BB_REPORTS_REASONS . '
- SET report_reason_order = report_reason_order - 1
- WHERE report_module_id = ' . $row['report_module_id'] . '
- AND report_reason_order > ' . $row['report_reason_order'];
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update report reason order #3');
- }
-
- //
- // Delete report reason
- //
- $sql = 'DELETE FROM ' . BB_REPORTS_REASONS . '
- WHERE report_reason_id = ' . (int)$reason_id;
- if (!DB()->sql_query($sql)) {
- bb_die('Could not delete report reason #2');
- }
-}
\ No newline at end of file
diff --git a/upload/includes/init_bb.php b/upload/includes/init_bb.php
index c022bd5a3..709cb2e9c 100644
--- a/upload/includes/init_bb.php
+++ b/upload/includes/init_bb.php
@@ -168,26 +168,6 @@ define('QUOTA_PM_LIMIT', 2);
define('TOR_STATUS_NORMAL', 0);
define('TOR_STATUS_FROZEN', 1);
-// Report
-// Report status constants
-define('REPORT_NEW', 0);
-define('REPORT_OPEN', 1);
-define('REPORT_IN_PROCESS', 2);
-define('REPORT_CLEARED', 3);
-define('REPORT_DELETE', 4);
-// Report authorisation constants
-define('REPORT_AUTH_USER', 0);
-define('REPORT_AUTH_MOD', 1);
-define('REPORT_AUTH_CONFIRM', 2);
-define('REPORT_AUTH_ADMIN', 3);
-// Report notification constants
-define('REPORT_NOTIFY_NEW', 1);
-define('REPORT_NOTIFY_CHANGE', 2);
-// Other report constants
-define('POST_REPORT_URL', 'r');
-define('POST_REPORT_REASON_URL', 'r');
-// Report [END]
-
// Gender
define('MALE', 1);
define('FEMALE', 2);
@@ -306,10 +286,6 @@ define('BB_PRIVMSGS_TEXT', 'bb_privmsgs_text');
define('BB_QUOTA_LIMITS', 'bb_quota_limits');
define('BB_QUOTA', 'bb_attach_quota');
define('BB_RANKS', 'bb_ranks');
-define('BB_REPORTS', 'bb_reports'); // Report
-define('BB_REPORTS_CHANGES', 'bb_reports_changes'); // Report Change's
-define('BB_REPORTS_MODULES', 'bb_reports_modules'); // Report Module Table
-define('BB_REPORTS_REASONS', 'bb_reports_reasons'); // Report Reasons
define('BB_SEARCH_REBUILD', 'bb_search_rebuild');
define('BB_SEARCH', 'bb_search_results');
define('BB_SESSIONS', 'bb_sessions');
diff --git a/upload/includes/page_header.php b/upload/includes/page_header.php
index ff86aa4a5..905522719 100644
--- a/upload/includes/page_header.php
+++ b/upload/includes/page_header.php
@@ -108,60 +108,6 @@ $template->assign_vars(array(
));
// The following assigns all _common_ variables that may be used at any point in a template
-// Report
-//
-// Report list link
-//
-if ($bb_cfg['reports_enabled'])
-{
- if (empty($gen_simple_header) && ($userdata['user_level'] == ADMIN || (!$bb_cfg['report_list_admin'] && $userdata['user_level'] == MOD)))
- {
- if (!function_exists("report_count_obtain"))
- include(INC_DIR . "functions_report.php");
-
- $report_count = report_count_obtain();
- if ($report_count > 0)
- {
- $template->assign_block_vars('switch_report_list_new', array());
-
- $report_list = $lang['REPORTS'];
- $report_list .= ($report_count == 1) ? $lang['NEW_REPORT'] : sprintf($lang['NEW_REPORTS'], $report_count);
- }
- else
- {
- $template->assign_block_vars('switch_report_list', array());
-
- $report_list = $lang['REPORTS'] . $lang['NO_NEW_REPORTS'];
- }
- }
- else
- {
- $report_list = '';
- }
- //
- // Get report general module and create report link
- //
- if (empty($gen_simple_header))
- {
- if (!function_exists("report_count_obtain"))
- include(INC_DIR . "functions_report.php");
-
- $report_general = report_modules('name', 'report_general');
-
- if ($report_general && $report_general->auth_check('auth_write'))
- {
- $template->assign_block_vars('switch_report_general', array());
-
- $template->assign_vars(array(
- 'U_WRITE_REPORT' => "report.php?mode=" . $report_general->mode,
- 'L_WRITE_REPORT' => $report_general->lang['WRITE_REPORT'])
- );
- }
- }
-}
-else $report_list = '';
-// Report [END]
-
$template->assign_vars(array(
'SIMPLE_HEADER' => !empty($gen_simple_header),
@@ -196,11 +142,6 @@ $template->assign_vars(array(
'PM_INFO' => $pm_info,
'PRIVMSG_IMG' => $icon_pm,
- // Report
- 'REPORT_LIST' => $report_list,
- 'U_REPORT_LIST' => "report.php",
- // Report [END]
-
'LOGGED_IN' => $logged_in,
'SESSION_USER_ID' => $userdata['user_id'],
'POINTS' => $userdata['user_points'],
diff --git a/upload/includes/report_hack/.htaccess b/upload/includes/report_hack/.htaccess
deleted file mode 100644
index baa56e5a3..000000000
--- a/upload/includes/report_hack/.htaccess
+++ /dev/null
@@ -1,2 +0,0 @@
-order allow,deny
-deny from all
\ No newline at end of file
diff --git a/upload/includes/report_hack/report_general.php b/upload/includes/report_hack/report_general.php
deleted file mode 100644
index 1e78d7d4e..000000000
--- a/upload/includes/report_hack/report_general.php
+++ /dev/null
@@ -1,17 +0,0 @@
-id = $id;
- $this->data = $data;
- $this->lang = $lang;
- }
-}
\ No newline at end of file
diff --git a/upload/includes/report_hack/report_post.php b/upload/includes/report_hack/report_post.php
deleted file mode 100644
index 4a4fed1b6..000000000
--- a/upload/includes/report_hack/report_post.php
+++ /dev/null
@@ -1,245 +0,0 @@
-id = $id;
- $this->data = $data;
- $this->lang = $lang;
- }
-
- //
- // Synchronizing function
- //
- function sync($uninstall = false)
- {
- $sql = 'UPDATE ' . BB_POSTS . '
- SET post_reported = 0';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not reset post reported flag');
- }
-
- if (!$uninstall) {
- $sql = 'SELECT report_subject
- FROM ' . BB_REPORTS . '
- WHERE report_module_id = ' . $this->id . '
- AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
- GROUP BY report_subject';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain open reports');
- }
-
- $open_ids = array();
- while ($row = DB()->sql_fetchrow($result)) {
- $open_ids[] = $row['report_subject'];
- }
- DB()->sql_freeresult($result);
-
- if (!empty($open_ids)) {
- $sql = 'UPDATE ' . BB_POSTS . '
- SET post_reported = 1
- WHERE post_id IN(' . implode(', ', $open_ids) . ')';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not sync post reported flag');
- }
- }
- }
- }
-
- //
- // Module action: Insert
- //
- function action_insert($report_subject, $report_id, $report_subject_data)
- {
- $sql = 'UPDATE ' . BB_POSTS . '
- SET post_reported = 1
- WHERE post_id = ' . (int)$report_subject;
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update post reported flag #1');
- }
- }
-
- //
- // Module action: Update status
- //
- function action_update_status($report_subjects, $report_status)
- {
- switch ($report_status) {
- case REPORT_CLEARED:
- case REPORT_DELETE:
- $this->action_delete($report_subjects);
- break;
-
- default:
- report_prepare_subjects($report_subjects, true);
-
- $sql = 'UPDATE ' . BB_POSTS . '
- SET post_reported = 1
- WHERE post_id IN(' . implode(', ', $report_subjects) . ')';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update post reported flag #2');
- }
- break;
- }
- }
-
- //
- // Module action: Delete
- //
- function action_delete($report_subjects)
- {
- report_prepare_subjects($report_subjects, true);
-
- $sql = 'SELECT report_subject
- FROM ' . BB_REPORTS . '
- WHERE report_module_id = ' . $this->id . '
- AND report_id NOT IN(' . implode(', ', array_keys($report_subjects)) . ')
- AND report_subject IN(' . implode(', ', $report_subjects) . ')
- AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
- GROUP BY report_subject';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not get open reports');
- }
-
- $open_ids = array();
- while ($row = DB()->sql_fetchrow($result)) {
- $open_ids[] = $row['report_subject'];
- }
- DB()->sql_freeresult($result);
-
- if (!empty($open_ids)) {
- $sql = 'UPDATE ' . BB_POSTS . '
- SET post_reported = 1
- WHERE post_id IN(' . implode(', ', $open_ids) . ')';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update post reported flag #3');
- }
- }
-
- $clear_ids = array();
- foreach ($report_subjects as $report_subject) {
- if (!in_array($report_subject, $open_ids)) {
- $clear_ids[] = $report_subject;
- }
- }
-
- if (!empty($clear_ids)) {
- $sql = 'UPDATE ' . BB_POSTS . '
- SET post_reported = 0
- WHERE post_id IN(' . implode(', ', $clear_ids) . ')';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update post reported flag #4');
- }
- }
- }
-
- //
- // Returns url to a report subject
- //
- function subject_url($report_subject, $non_html_amp = false)
- {
- $report_subject = (int)$report_subject;
- return 'viewtopic.php?' . POST_POST_URL . '=' . $report_subject . '#' . $report_subject;
- }
-
- //
- // Returns report subject title
- //
- function subject_obtain($report_subject)
- {
- $sql = 'SELECT t.topic_title, t.topic_first_post_id
- FROM ' . BB_POSTS . ' p
- INNER JOIN ' . BB_POSTS_TEXT . ' pt
- ON pt.post_id = p.post_id
- INNER JOIN ' . BB_TOPICS . ' t
- ON t.topic_id = p.topic_id
- WHERE p.post_id = ' . (int)$report_subject;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report subject');
- }
-
- $row = DB()->sql_fetchrow($result);
- DB()->sql_freeresult($result);
-
- if (!$row) {
- return false;
- }
-
- if ($row['topic_title'] != '') {
- return $row['topic_title'];
- } else {
- $subject = ($row['topic_first_post_id'] == $report_subject) ? '' : 'Re: ';
- $subject .= $row['topic_title'];
-
- return $subject;
- }
- }
-
- //
- // Obtains additional subject data
- //
- function subject_data_obtain($report_subject)
- {
- $sql = 'SELECT forum_id
- FROM ' . BB_POSTS . '
- WHERE post_id = ' . (int)$report_subject;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report subject data');
- }
-
- $row = DB()->sql_fetchrow($result);
- DB()->sql_freeresult($result);
-
- return $row;
- }
-
- //
- // Obtains subjects authorisation
- //
- function subjects_auth_obtain($user_id, $report_subjects)
- {
- report_prepare_subjects($report_subjects);
- $moderated_forums = user_moderated_forums($user_id);
-
- //
- // Check stored forum ids
- //
- $check_posts = array();
- foreach ($report_subjects as $report_subject) {
- if (in_array($report_subject[1]['forum_id'], $moderated_forums)) {
- $this->subjects_auth[$user_id][$report_subject[0]] = true;
- } else {
- $this->subjects_auth[$user_id][$report_subject[0]] = false;
-
- $check_posts[] = $report_subject[0];
- }
- }
-
- //
- // Check current forum ids
- //
- if (!empty($check_posts)) {
- $sql = 'SELECT post_id, forum_id
- FROM ' . BB_POSTS . '
- WHERE post_id IN(' . implode(', ', $check_posts) . ')';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain current forum ids');
- }
-
- while ($row = DB()->sql_fetchrow($result)) {
- if (in_array($row['forum_id'], $moderated_forums)) {
- $this->subjects_auth[$user_id][$row['post_id']] = true;
- }
- }
- DB()->sql_freeresult($result);
- }
- }
-}
\ No newline at end of file
diff --git a/upload/includes/report_hack/report_privmsg.php b/upload/includes/report_hack/report_privmsg.php
deleted file mode 100644
index 5892cf7fc..000000000
--- a/upload/includes/report_hack/report_privmsg.php
+++ /dev/null
@@ -1,226 +0,0 @@
-id = $id;
- $this->data = $data;
- $this->lang = $lang;
- }
-
- //
- // Synchronizing function
- //
- function sync($uninstall = false)
- {
- $sql = 'UPDATE ' . BB_PRIVMSGS . '
- SET privmsgs_reported = 0';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not reset privmsgs reported flag');
- }
-
- if (!$uninstall) {
- $sql = 'SELECT report_subject
- FROM ' . BB_REPORTS . '
- WHERE report_module_id = ' . $this->id . '
- AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
- GROUP BY report_subject';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain open reports');
- }
-
- $open_ids = array();
- while ($row = DB()->sql_fetchrow($result)) {
- $open_ids[] = $row['report_subject'];
- }
- DB()->sql_freeresult($result);
-
- if (!empty($open_ids)) {
- $sql = 'UPDATE ' . BB_PRIVMSGS . '
- SET privmsgs_reported = 1
- WHERE privmsgs_id IN(' . implode(', ', $open_ids) . ')';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not sync privmsgs reported flag');
- }
- }
- }
- }
-
- //
- // Module action: Insert
- //
- function action_insert($report_subject, $report_id)
- {
- $sql = 'UPDATE ' . BB_PRIVMSGS . '
- SET privmsgs_reported = 1
- WHERE privmsgs_id = ' . (int)$report_subject;
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update privmsgs reported flag #1');
- }
- }
-
- //
- // Module action: Update status
- //
- function action_update_status($report_subjects, $report_status)
- {
- switch ($report_status) {
- case REPORT_CLEARED:
- case REPORT_DELETE:
- $this->action_delete($report_subjects);
- break;
-
- default:
- report_prepare_subjects($report_subjects, true);
-
- $sql = 'UPDATE ' . BB_PRIVMSGS . '
- SET privmsgs_reported = 1
- WHERE privmsgs_id IN(' . implode(', ', $report_subjects) . ')';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update privmsgs reported flag #2');
- }
- break;
- }
- }
-
- //
- // Module action: Delete
- //
- function action_delete($report_subjects)
- {
- report_prepare_subjects($report_subjects, true);
-
- $sql = 'SELECT report_subject
- FROM ' . BB_REPORTS . '
- WHERE report_module_id = ' . $this->id . '
- AND report_id NOT IN(' . implode(', ', array_keys($report_subjects)) . ')
- AND report_subject IN(' . implode(', ', $report_subjects) . ')
- AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
- GROUP BY report_subject';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not get open reports');
- }
-
- $open_ids = array();
- while ($row = DB()->sql_fetchrow($result)) {
- $open_ids[] = $row['report_subject'];
- }
- DB()->sql_freeresult($result);
-
- if (!empty($open_ids)) {
- $sql = 'UPDATE ' . BB_PRIVMSGS . '
- SET privmsgs_reported = 1
- WHERE privmsgs_id IN(' . implode(', ', $open_ids) . ')';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update privmsgs reported flag #3');
- }
- }
-
- $clear_ids = array();
- foreach ($report_subjects as $report_subject) {
- if (!in_array($report_subject, $open_ids)) {
- $clear_ids[] = $report_subject;
- }
- }
-
- if (!empty($clear_ids)) {
- $sql = 'UPDATE ' . BB_PRIVMSGS . '
- SET privmsgs_reported = 0
- WHERE privmsgs_id IN(' . implode(', ', $clear_ids) . ')';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update privmsgs reported flag #4');
- }
- }
- }
-
- //
- // Returns url to a report subject
- //
- function subject_url($report_subject, $non_html_amp = false)
- {
- $sep = ($non_html_amp) ? '&' : '&';
- return PM_URL . '?mode=read' . $sep . POST_POST_URL . '=' . (int)$report_subject;
- }
-
- //
- // Returns report subject title
- //
- function subject_obtain($report_subject)
- {
- global $userdata;
-
- $sql = 'SELECT privmsgs_subject
- FROM ' . BB_PRIVMSGS . '
- WHERE privmsgs_to_userid = ' . $userdata['user_id'] . '
- AND privmsgs_id = ' . (int)$report_subject;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report subject');
- }
-
- $row = DB()->sql_fetchrow($result);
- DB()->sql_freeresult($result);
-
- return ($row) ? $row['privmsgs_subject'] : false;
- }
-
- //
- // Returns report subject details
- //
- function subject_details_obtain($report_subject)
- {
- $sql = 'SELECT p.privmsgs_subject, p.privmsgs_from_userid, pt.privmsgs_text, u.username, u.user_id, u.user_rank
- FROM ' . BB_PRIVMSGS . ' p
- INNER JOIN ' . BB_PRIVMSGS_TEXT . ' pt
- ON pt.privmsgs_text_id = privmsgs_id
- LEFT JOIN ' . BB_USERS . ' u
- ON u.user_id = p.privmsgs_from_userid
- WHERE privmsgs_id = ' . (int)$report_subject;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report subject details');
- }
-
- $row = DB()->sql_fetchrow($result);
- DB()->sql_freeresult($result);
-
- if (!$row) {
- return false;
- }
-
- $subject_details = array(
- 'MESSAGE_ID' => '#' . $report_subject,
- 'MESSAGE_FROM' => profile_url($row),
- 'MESSAGE_TITLE' => $row['privmsgs_subject'],
- 'MESSAGE_TEXT' => $row['privmsgs_text']);
-
- $this->_subject_details_prepare($subject_details['MESSAGE_TEXT'], $subject_details['MESSAGE_TITLE'], $row);
-
- return array(
- 'details' => $subject_details);
- }
-
- //
- // Helper function for subject_details_obtain(), prepares private message and private
- // message subject
- //
- function _subject_details_prepare(&$message, &$subject, $row)
- {
- require_once(INC_DIR . "bbcode.php");
-
- $message = bbcode2html($message);
-
- $orig_word = $replacement_word = array();
- obtain_word_list($orig_word, $replacement_word);
-
- if (!empty($orig_word)) {
- $subject = preg_replace($orig_word, $replacement_word, $subject);
- $message = preg_replace($orig_word, $replacement_word, $message);
- }
- }
-}
\ No newline at end of file
diff --git a/upload/includes/report_hack/report_topic.php b/upload/includes/report_hack/report_topic.php
deleted file mode 100644
index dba6bbf60..000000000
--- a/upload/includes/report_hack/report_topic.php
+++ /dev/null
@@ -1,229 +0,0 @@
-id = $id;
- $this->data = $data;
- $this->lang = $lang;
- }
-
- //
- // Synchronizing function
- //
- function sync($uninstall = false)
- {
- $sql = 'UPDATE ' . BB_TOPICS . '
- SET topic_reported = 0';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not reset topic reported flag');
- }
-
- if (!$uninstall) {
- $sql = 'SELECT report_subject
- FROM ' . BB_REPORTS . '
- WHERE report_module_id = ' . $this->id . '
- AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
- GROUP BY report_subject';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain open reports');
- }
-
- $open_ids = array();
- while ($row = DB()->sql_fetchrow($result)) {
- $open_ids[] = $row['report_subject'];
- }
- DB()->sql_freeresult($result);
-
- if (!empty($open_ids)) {
- $sql = 'UPDATE ' . BB_TOPICS . '
- SET topic_reported = 1
- WHERE topic_id IN(' . implode(', ', $open_ids) . ')';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not sync topic reported flag');
- }
- }
- }
- }
-
- //
- // Module action: Insert
- //
- function action_insert($report_subject, $report_id, $report_subject_data)
- {
- $sql = 'UPDATE ' . BB_TOPICS . '
- SET topic_reported = 1
- WHERE topic_id = ' . (int)$report_subject;
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update topic reported flag #1');
- }
- }
-
- //
- // Module action: Update status
- //
- function action_update_status($report_subjects, $report_status)
- {
- switch ($report_status) {
- case REPORT_CLEARED:
- case REPORT_DELETE:
- $this->action_delete($report_subjects);
- break;
-
- default:
- report_prepare_subjects($report_subjects, true);
-
- $sql = 'UPDATE ' . BB_TOPICS . '
- SET topic_reported = 1
- WHERE topic_id IN(' . implode(', ', $report_subjects) . ')';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update topic reported flag #2');
- }
- break;
- }
- }
-
- //
- // Module action: Delete
- //
- function action_delete($report_subjects)
- {
- report_prepare_subjects($report_subjects, true);
-
- $sql = 'SELECT report_subject
- FROM ' . BB_REPORTS . '
- WHERE report_module_id = ' . $this->id . '
- AND report_id NOT IN(' . implode(', ', array_keys($report_subjects)) . ')
- AND report_subject IN(' . implode(', ', $report_subjects) . ')
- AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
- GROUP BY report_subject';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain open reports');
- }
-
- $open_ids = array();
- while ($row = DB()->sql_fetchrow($result)) {
- $open_ids[] = $row['report_subject'];
- }
- DB()->sql_freeresult($result);
-
- if (!empty($open_ids)) {
- $sql = 'UPDATE ' . BB_TOPICS . '
- SET topic_reported = 1
- WHERE topic_id IN(' . implode(', ', $open_ids) . ')';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update topic reported flag #3');
- }
- }
-
- $clear_ids = array();
- foreach ($report_subjects as $report_subject) {
- if (!in_array($report_subject, $open_ids)) {
- $clear_ids[] = $report_subject;
- }
- }
-
- if (!empty($clear_ids)) {
- $sql = 'UPDATE ' . BB_TOPICS . '
- SET topic_reported = 0
- WHERE topic_id IN(' . implode(', ', $clear_ids) . ')';
- if (!DB()->sql_query($sql)) {
- bb_die('Could not update topic reported flag #4');
- }
- }
- }
-
- //
- // Returns url to a report subject
- //
- function subject_url($report_subject, $non_html_amp = false)
- {
- return 'viewtopic.php?' . POST_TOPIC_URL . '=' . (int)$report_subject;
- }
-
- //
- // Returns report subject title
- //
- function subject_obtain($report_subject)
- {
- $sql = 'SELECT topic_title
- FROM ' . BB_TOPICS . '
- WHERE topic_id = ' . (int)$report_subject;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report subject');
- }
-
- $row = DB()->sql_fetchrow($result);
- DB()->sql_freeresult($result);
-
- return ($row) ? $row['topic_title'] : false;
- }
-
- //
- // Obtains additional subject data
- //
- function subject_data_obtain($report_subject)
- {
- $sql = 'SELECT forum_id
- FROM ' . BB_TOPICS . '
- WHERE topic_id = ' . (int)$report_subject;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report subject data');
- }
-
- $row = DB()->sql_fetchrow($result);
- DB()->sql_freeresult($result);
-
- return $row;
- }
-
- //
- // Obtains subjects authorisation
- //
- function subjects_auth_obtain($user_id, $report_subjects)
- {
- report_prepare_subjects($report_subjects);
- $moderated_forums = user_moderated_forums($user_id);
-
- //
- // Check stored forum ids
- //
- $check_topics = array();
- foreach ($report_subjects as $report_subject) {
- if (in_array($report_subject[1]['forum_id'], $moderated_forums)) {
- $this->subjects_auth[$user_id][$report_subject[0]] = true;
- } else {
- $this->subjects_auth[$user_id][$report_subject[0]] = false;
-
- $check_topics[] = $report_subject[0];
- }
- }
-
- //
- // Check current forum ids
- //
- if (!empty($check_topics)) {
- $sql = 'SELECT topic_id, forum_id
- FROM ' . BB_TOPICS . '
- WHERE topic_id IN(' . implode(', ', $check_topics) . ')';
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain current forum ids');
- }
-
- while ($row = DB()->sql_fetchrow($result)) {
- if (in_array($row['forum_id'], $moderated_forums)) {
- $this->subjects_auth[$user_id][$row['topic_id']] = true;
- }
- }
- DB()->sql_freeresult($result);
- }
- }
-}
\ No newline at end of file
diff --git a/upload/includes/report_hack/report_user.php b/upload/includes/report_hack/report_user.php
deleted file mode 100644
index 3737379ae..000000000
--- a/upload/includes/report_hack/report_user.php
+++ /dev/null
@@ -1,44 +0,0 @@
-id = $id;
- $this->data = $data;
- $this->lang = $lang;
- }
-
- //
- // Returns url to a report subject
- //
- function subject_url($id, $non_html_amp = false)
- {
- $sep = ($non_html_amp) ? '&' : '&';
- return 'profile.php?mode=viewprofile' . $sep . POST_USERS_URL . '=' . (int)$id;
- }
-
- //
- // Returns report subject title
- //
- function subject_obtain($report_subject)
- {
- $sql = 'SELECT username
- FROM ' . BB_USERS . '
- WHERE user_id = ' . (int)$report_subject;
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not obtain report subject');
- }
-
- $row = DB()->sql_fetchrow($result);
- DB()->sql_freeresult($result);
-
- return ($row) ? $row['username'] : false;
- }
-}
\ No newline at end of file
diff --git a/upload/includes/report_module.php b/upload/includes/report_module.php
deleted file mode 100644
index 4cfd47d72..000000000
--- a/upload/includes/report_module.php
+++ /dev/null
@@ -1,191 +0,0 @@
- $this->lang['MODULE_TITLE'],
- 'explain' => $this->lang['MODULE_EXPLAIN']);
- }
-
- //
- // Generates a return link based on the subject_url() method
- //
- function return_link($id)
- {
- global $lang;
-
- if (method_exists($this, 'subject_url') && isset($this->lang['CLICK_RETURN']))
- {
- return '
' . sprintf($this->lang['CLICK_RETURN'], '', '');
- }
- else
- {
- return '';
- }
- }
-
- //
- // Returns report reasons of the module
- //
- function reasons_obtain()
- {
- global $lang;
-
- $sql = 'SELECT report_reason_id, report_reason_desc
- FROM ' . BB_REPORTS_REASONS . '
- WHERE report_module_id = ' . (int) $this->id . '
- ORDER BY report_reason_order';
- if (!$result = DB()->sql_query($sql))
- {
- bb_die('Could not obtain report reasons');
- }
-
- $rows = array();
- while ($row = DB()->sql_fetchrow($result))
- {
- $rows[$row['report_reason_id']] = (isset($lang[$row['report_reason_desc']])) ? $lang[$row['report_reason_desc']] : $row['report_reason_desc'];
- }
- DB()->sql_freeresult($result);
-
- return (!empty($rows)) ? $rows : false;
- }
-
- //
- // Checks module authorisation
- //
- function auth_check($auth_names, $userdata = null)
- {
- if (!isset($userdata))
- {
- global $userdata;
- }
-
- if ($userdata['user_id'] == GUEST_UID)
- {
- return false;
- }
-
- //
- // Set "virtual" column
- //
- if (!isset($this->data['auth_delete_view']))
- {
- if ($this->data['auth_delete'] == REPORT_AUTH_CONFIRM)
- {
- $this->data['auth_delete_view'] = REPORT_AUTH_MOD;
- }
- else
- {
- $this->data['auth_delete_view'] = $this->data['auth_delete'];
- }
- }
-
- switch ($userdata['user_level'])
- {
- case ADMIN:
- return true;
- break;
-
- case MOD:
- $auth_value = REPORT_AUTH_MOD;
- break;
-
- case GROUP_MEMBER:
- case USER:
- $auth_value = REPORT_AUTH_USER;
- break;
-
- default:
- return false;
- break;
- }
-
- if (!is_array($auth_names))
- {
- $auth_names = array($auth_names);
- }
-
- //
- // Check authorisation
- //
- foreach ($auth_names as $auth_name)
- {
- if ($this->data[$auth_name] > $auth_value)
- {
- return false;
- }
- }
-
- return true;
- }
-
- //
- // Checks the authorisation to view the specified report subjects
- //
- function subjects_auth_check(&$report_subjects, $userdata = null)
- {
- if (!method_exists($this, 'subjects_auth_obtain') || empty($report_subjects))
- {
- return true;
- }
-
- if (!isset($userdata))
- {
- global $userdata;
- }
-
- if ($userdata['user_level'] == ADMIN)
- {
- return true;
- }
- else if ($userdata['user_level'] != MOD)
- {
- return false;
- }
-
- report_prepare_subjects($report_subjects);
-
- $user_id = $userdata['user_id'];
- if (!isset($this->subject_auth[$user_id]))
- {
- $this->subject_auth[$user_id] = array();
- $this->subjects_auth_obtain($user_id, $report_subjects);
- }
- else
- {
- $check_ids = array();
- foreach ($report_subjects as $report_id => $report_subject)
- {
- if (!isset($this->subjects_auth[$user_id][$report_subject[0]]))
- {
- $check_ids[] = $report_subjects[$report_id];
- }
- }
-
- if (!empty($check_ids))
- {
- $this->subjects_auth_obtain($user_id, $check_ids);
- }
- }
-
- $subjects_count = count($report_subjects);
- foreach ($report_subjects as $report_id => $report_subject)
- {
- if (!$this->subjects_auth[$user_id][$report_subject[0]])
- {
- unset($report_subjects[$report_id]);
- }
- }
-
- return ($subjects_count == count($report_subjects));
- }
-}
\ No newline at end of file
diff --git a/upload/includes/ucp/viewprofile.php b/upload/includes/ucp/viewprofile.php
index 626d64c17..b3d607d3e 100644
--- a/upload/includes/ucp/viewprofile.php
+++ b/upload/includes/ucp/viewprofile.php
@@ -55,23 +55,6 @@ else
$email = '';
}
-// Report
-//
-// Get report user module and create report link
-//
-include(INC_DIR ."functions_report.php");
-$report_user = report_modules('name', 'report_user');
-
-if ($report_user && $report_user->auth_check('auth_write'))
-{
- $template->assign_block_vars('switch_report_user', array());
- $template->assign_vars(array(
- 'U_REPORT_USER' => 'report.php?mode='. $report_user->mode .'&id='. $profiledata['user_id'],
- 'L_REPORT_USER' => $report_user->lang['WRITE_REPORT'])
- );
-}
-// Report [END]
-
//
// Generate page
//
diff --git a/upload/language/en/main.php b/upload/language/en/main.php
index ec47d316c..646f3df32 100644
--- a/upload/language/en/main.php
+++ b/upload/language/en/main.php
@@ -1381,71 +1381,16 @@ $lang['ONLY_NEW_POSTS'] = 'only new posts';
$lang['ONLY_NEW_TOPICS'] = 'only new topics';
$lang['TORHELP_TITLE'] = 'Please help seeding these torrents!';
-
-// Reports (need to translate it!)
-$lang['REPORTS'] = 'Reports';
-$lang['REPORTS_DISABLE'] = 'Reports disabled';
-$lang['NEW_REPORT'] = ' (one open)';
-$lang['NEW_REPORTS'] = ' (%d open)';
-$lang['NO_NEW_REPORTS'] = ': no new Reports';
-$lang['REPORT_INDEX'] = 'Index';
$lang['STATISTICS'] = 'Statistics';
$lang['STATISTIC'] = 'Statistic';
$lang['VALUE'] = 'Value';
-$lang['REPORT_COUNT'] = 'Current report count';
-$lang['REPORT_MODULES_COUNT'] = 'Report modules count';
-$lang['REPORT_HACK_COUNT'] = 'Overall report count';
-$lang['DELETED_REPORTS'] = 'Reports suggested for deletion';
-$lang['REPORT_TYPE'] = 'Report type';
-$lang['REPORT_BY'] = 'by';
-$lang['NO_REPORTS'] = 'No reports';
$lang['INVERT_SELECT'] = 'Invert selection';
-$lang['REPORTED_BY'] = 'Reported by';
-$lang['REPORTED_TIME'] = 'Reported on';
$lang['STATUS'] = 'Status';
$lang['LAST_CHANGED_BY'] = 'Last changed by';
$lang['CHANGES'] = 'Changes';
-$lang['REPORT_CHANGE_TEXT'] = 'Marked as "%1$s" by %2$s on %3$s.';
-$lang['REPORT_CHANGE_TEXT_COMMENT'] = 'Marked as "%1$s" by %2$s on %3$s:
%4$s';
-$lang['REPORT_CHANGE_DELETE_TEXT'] = 'Suggested for deletion by %1$s on %2$s.';
$lang['ACTION'] = 'Action';
-$lang['REPORT_MARK'] = 'Mark as';
-$lang['OPEN_REPORTS'] = 'Offene Meldungen';
-$lang['NO_REPORTS_FOUND'] = 'No matching reports found.';
-$lang['NO_REPORTS_SELECTED'] = 'No reports were selected.';
-$lang['REPORT_NOT_EXISTS'] = 'The selected report doesn\'t exist.';
-$lang['REPORT_NOT_SUPPORTED'] = 'This feature isn\'t supported.';
-$lang['CLICK_RETURN_REPORT'] = '%sClick here%s to return to the report.';
-$lang['CLICK_RETURN_REPORT_LIST'] = '%sClick here%s to return to the report list.';
-
-$lang['REPORT_STATUS'] = array(
- REPORT_NEW => 'new',
- REPORT_OPEN => 'open',
- REPORT_IN_PROCESS => 'in process',
- REPORT_CLEARED => 'cleared',
- REPORT_DELETE => 'suggested for deletion',
-);
-
$lang['REASON'] = 'Reason';
-$lang['REPORT_SUBJECT'] = 'Subject';
-$lang['REPORT_TITLE_EMPTY'] = 'You must enter a title of the report.';
-$lang['REPORT_DESC_EMPTY'] = 'You must enter a message.';
-$lang['REPORT_INSERTED'] = 'The report was sent to the team.';
-
-$lang['CHANGE_REPORT'] = 'Change report';
-$lang['CHANGE_REPORTS'] = 'Change reports';
-$lang['CHANGE_REPORT_EXPLAIN'] = 'Are you sure you want to change the status of the selected report?';
-$lang['CHANGE_REPORTS_EXPLAIN'] = 'Are you sure you want to change the status of the selected reports?';
$lang['COMMENT'] = 'Comment';
-$lang['REPORT_CHANGED'] = 'The status of the selected report was changed.';
-$lang['REPORTS_CHANGED'] = 'The status of the selected reports was changed.';
-
-$lang['DELETE_REPORT'] = 'Delete report';
-$lang['DELETE_REPORTS'] = 'Delete reports';
-$lang['DELETE_REPORT_EXPLAIN'] = 'Are you sure you want to delete the selected report?';
-$lang['DELETE_REPORTS_EXPLAIN'] = 'Are you sure you want to delete the selected reports?';
-$lang['REPORT_DELETED'] = 'The selected report was deleted.';
-$lang['REPORTS_DELETED'] = 'The selected reports were deleted.';
// search
$lang['SEARCH_S'] = 'search...';
@@ -2114,73 +2059,7 @@ $lang['SF_SHOW_ON_INDEX'] = 'Show on main page';
$lang['SF_PARENT_FORUM'] = 'Parent forum';
$lang['SF_NO_PARENT'] = 'No parent forum';
$lang['TEMPLATE'] = 'Template';
-
-// Reports (need to translate!)
-$lang['REPORT_CONFIG_EXPLAIN'] = 'On this page you can change the general configuration of the report feature.';
-$lang['REPORT_SUBJECT_AUTH'] = 'Individual permissions';
-$lang['REPORT_SUBJECT_AUTH_EXPLAIN'] = 'If this setting is enabled, moderators can only view reports they can edit. For example a post report will be hidden if the user isn\'t a moderator of the forum the post belongs to.';
-$lang['REPORT_MODULES_CACHE'] = 'Cache modules in a file';
-$lang['REPORT_MODULES_CACHE_EXPLAIN'] = 'Note: The cache directory must be set to CHMOD 777 (full write permissions).';
-$lang['REPORT_NOTIFY'] = 'Email notification';
-$lang['REPORT_NOTIFY_CHANGE'] = 'on status changes and new reports';
-$lang['REPORT_NOTIFY_NEW'] = 'on new reports';
-$lang['REPORT_LIST_ADMIN'] = 'Admin-only report list';
-$lang['REPORT_NEW_WINDOW'] = 'Open subjects in a new window';
-$lang['REPORT_NEW_WINDOW_EXPLAIN'] = 'This setting also affects direct links to the reports at the view topic page.';
-$lang['REPORT_CONFIG_UPDATED'] = 'The configuration has been updated.';
-$lang['CLICK_RETURN_REPORT_CONFIG'] = 'Click %sHere%s to return to the configuration.';
-
-$lang['MODULES_REASONS'] = 'Modules and Reasons';
-$lang['REPORT_ADMIN_EXPLAIN'] = 'On this page you can install new report modules and edit or uninstall currently installed modules. In addition you can set up predefined reasons for every report module.';
-$lang['REPORT_MODULE'] = 'Report module';
-$lang['INSTALLED_MODULES'] = 'Installed modules';
-$lang['NO_MODULES_INSTALLED'] = 'No modules installed';
-$lang['REASONS'] = 'Reasons (%d)';
$lang['SYNC'] = 'Sync';
-$lang['UNINSTALL'] = 'Uninstall';
-$lang['INSTALL2'] = 'Install';
-$lang['INACTIVE_MODULES'] = 'Inactive modules';
-$lang['NO_MODULES_INACTIVE'] = 'No inactive modules';
-$lang['REPORT_MODULE_NOT_EXISTS'] = 'The selected module doesn\'t exist.';
-$lang['CLICK_RETURN_REPORT_ADMIN'] = 'Click %sHere%s to return to the Modules & Reasons administration.';
-
-$lang['BACK_MODULES'] = 'Back to the modules';
-$lang['REPORT_REASON'] = 'Report reason';
-$lang['NO_REASONS'] = 'No reasons for this module';
-$lang['ADD_REASON'] = 'Add reason';
-$lang['EDIT_REASON'] = 'Edit reason';
-$lang['REASON_DESC_EXPLAIN'] = 'If the description matches with a language variable, the variable will be used instead.';
-$lang['REASON_DESC_EMPTY'] = 'You must enter a report reason.';
-$lang['REPORT_REASON_ADDED'] = 'The report reason has been added.';
-$lang['REPORT_REASON_EDITED'] = 'The report reason has been edited.';
-$lang['DELETE_REASON'] = 'Delete reason';
-$lang['DELETE_REPORT_REASON_EXPLAIN'] = 'Are you sure you want to delete the selected report reason?';
-$lang['REPORT_REASON_DELETED'] = 'The report reason has been deleted.';
-$lang['REPORT_REASON_NOT_EXISTS'] = 'The selected report reason doesn\'t exist.';
-$lang['CLICK_RETURN_REPORT_REASONS'] = 'Click %sHere%s to return to the report reasons administration.';
-
-$lang['REPORT_MODULE_SYNCED'] = 'The module has been synced.';
-
-$lang['UNINSTALL_REPORT_MODULE'] = 'Uninstall module';
-$lang['UNINSTALL_REPORT_MODULE_EXPLAIN'] = 'Are you sure you want to uninstall the selected report module?
Note: All reports in the module will be deleted, too.';
-$lang['REPORT_MODULE_UNINSTALLED'] = 'The module has been uninstalled.';
-
-$lang['INSTALL_REPORT_MODULE'] = 'Install module';
-$lang['EDIT_REPORT_MODULE'] = 'Edit module';
-$lang['REPORT_PRUNE'] = 'Prune reports';
-$lang['REPORT_PRUNE_EXPLAIN'] = 'Cleared reports and reports marked for deletion will be deleted automatically after x days. Set to zero to disable the feature.';
-$lang['REPORT_PERMISSIONS'] = 'Report permissions';
-$lang['WRITE'] = 'Write';
-$lang['REPORT_AUTH'] = array(
- REPORT_AUTH_USER => 'Users',
- REPORT_AUTH_MOD => 'Moderators',
- REPORT_AUTH_CONFIRM => 'Moderators (after confirmation)',
- REPORT_AUTH_ADMIN => 'Administrators'
-);
-$lang['REPORT_AUTH_NOTIFY_EXPLAIN'] = 'Moderators will only be notified if they can view and edit the report.';
-$lang['REPORT_AUTH_DELETE_EXPLAIN'] = 'If you select Moderators (after confirmation), deletions have to be confirmed by an administrator.';
-$lang['REPORT_MODULE_INSTALLED'] = 'The module has been installed.';
-$lang['REPORT_MODULE_EDITED'] = 'The module has been edited.';
// Mods
$lang['MAX_NEWS_TITLE'] = 'Max. length of the news';
diff --git a/upload/language/en/report_hack/.htaccess b/upload/language/en/report_hack/.htaccess
deleted file mode 100644
index baa56e5a3..000000000
--- a/upload/language/en/report_hack/.htaccess
+++ /dev/null
@@ -1,2 +0,0 @@
-order allow,deny
-deny from all
\ No newline at end of file
diff --git a/upload/language/en/report_hack/report_general.php b/upload/language/en/report_hack/report_general.php
deleted file mode 100644
index 0cd76718a..000000000
--- a/upload/language/en/report_hack/report_general.php
+++ /dev/null
@@ -1,17 +0,0 @@
-%4$s';
-$lang['REPORT_CHANGE_DELETE_TEXT'] = 'Отмечено для удаления пользователем %1$s в %2$s.';
$lang['ACTION'] = 'Действие';
-$lang['REPORT_MARK'] = 'Отметить как';
-$lang['OPEN_REPORTS'] = 'открытые сообщения';
-$lang['NO_REPORTS_FOUND'] = 'Подходящих сообщений не найдено.';
-$lang['NO_REPORTS_SELECTED'] = 'Не было выделено ни одного сообщения.';
-$lang['REPORT_NOT_EXISTS'] = 'Выбранное сообщение не существует.';
-$lang['REPORT_NOT_SUPPORTED'] = 'Данная опция не поддерживается.';
-$lang['CLICK_RETURN_REPORT'] = '%sВернуться к сообщению%s';
-$lang['CLICK_RETURN_REPORT_LIST'] = '%sВернуться к списку сообщений%s';
-
-$lang['REPORT_STATUS'] = array(
- REPORT_NEW => 'Новое',
- REPORT_OPEN => 'Открыто',
- REPORT_IN_PROCESS => 'В обработке',
- REPORT_CLEARED => 'Закрыто',
- REPORT_DELETE => 'Отмечено для удаления',
-);
-
$lang['REASON'] = 'Причина';
-$lang['REPORT_SUBJECT'] = 'Тема';
-$lang['REPORT_TITLE_EMPTY'] = 'Необходимо ввести заголовок сообщения.';
-$lang['REPORT_DESC_EMPTY'] = 'Необходимо ввести сообщение.';
-$lang['REPORT_INSERTED'] = 'Сообщение было отправлено администрации.';
-
-$lang['CHANGE_REPORT'] = 'Изменить сообщение';
-$lang['CHANGE_REPORTS'] = 'Изменить сообщения';
-$lang['CHANGE_REPORT_EXPLAIN'] = 'Вы уверены, что хотите изменить статус выбранного сообщения?';
-$lang['CHANGE_REPORTS_EXPLAIN'] = 'Вы уверены, что хотите изменить статус выбранных сообщений?';
$lang['COMMENT'] = 'Комментарий';
-$lang['REPORT_CHANGED'] = 'Статус выбранного сообщения был изменен.';
-$lang['REPORTS_CHANGED'] = 'Статус выбранных сообщений был изменен.';
-
-$lang['DELETE_REPORT'] = 'Удалить сообщение';
-$lang['DELETE_REPORTS'] = 'Удалить сообщения';
-$lang['DELETE_REPORT_EXPLAIN'] = 'Вы уверены, что хотите удалить выбранное сообщение?';
-$lang['DELETE_REPORTS_EXPLAIN'] = 'Вы уверены, что хотите удалить выбранные сообщения?';
-$lang['REPORT_DELETED'] = 'Выбранное сообщение удалено.';
-$lang['REPORTS_DELETED'] = 'Выбранные сообщения удалены.';
// search
$lang['SEARCH_S'] = 'поиск…';
@@ -2114,73 +2059,7 @@ $lang['SF_SHOW_ON_INDEX'] = 'Показывать на главной';
$lang['SF_PARENT_FORUM'] = 'Родительский форум';
$lang['SF_NO_PARENT'] = 'Нет родительского форума';
$lang['TEMPLATE'] = 'Шаблон';
-
-// Reports
-$lang['REPORT_CONFIG_EXPLAIN'] = 'На этой странице находятся основные настройки модуля "Сообщения о нарушениях".';
-$lang['REPORT_SUBJECT_AUTH'] = 'Индивидуальные права доступа';
-$lang['REPORT_SUBJECT_AUTH_EXPLAIN'] = 'Если опция включена, то модераторы смогут просматривать и редактировать только сообщения о нарушениях в модерируемых ими форумах.';
-$lang['REPORT_MODULES_CACHE'] = 'Кэшировать модули в файлах';
-$lang['REPORT_MODULES_CACHE_EXPLAIN'] = 'Замечание: права доступа к директории cache в режим "полный доступ на запись и чтение" (CHMOD 777).';
-$lang['REPORT_NOTIFY'] = 'Уведомления по e-mail';
-$lang['REPORT_NOTIFY_CHANGE'] = 'об изменениях статусов и новых сообщениях';
-$lang['REPORT_NOTIFY_NEW'] = 'о новых сообщениях';
-$lang['REPORT_LIST_ADMIN'] = 'Список сообщений доступен только администратору';
-$lang['REPORT_NEW_WINDOW'] = 'Открывать страницу с нарушением в новом окне';
-$lang['REPORT_NEW_WINDOW_EXPLAIN'] = 'Эта опция так же влияет на вид ссылок к форме отправки сообщения о нарушении на страницах просмотра тем.';
-$lang['REPORT_CONFIG_UPDATED'] = 'Конфигурция обновлена.';
-$lang['CLICK_RETURN_REPORT_CONFIG'] = '%sНажмите%s для возврата к настройкам модуля.';
-
-$lang['MODULES_REASONS'] = 'Модули и Причины';
-$lang['REPORT_ADMIN_EXPLAIN'] = 'На этой странице вы можете установить новый модуль, изменить настройки модуля или удалить уже установленный модуль. Так же здесь вы можете задать установить Причины написания сообщений о нарушении для каждого модуля.';
-$lang['REPORT_MODULE'] = 'Модуль Сообщений о нарушении';
-$lang['INSTALLED_MODULES'] = 'Установленные модули';
-$lang['NO_MODULES_INSTALLED'] = 'Нет установленных модулей';
-$lang['REASONS'] = 'Причины (%d)';
$lang['SYNC'] = 'Синхронизировать';
-$lang['UNINSTALL'] = 'Удалить';
-$lang['INSTALL2'] = 'Установить';
-$lang['INACTIVE_MODULES'] = 'Неактивные модули';
-$lang['NO_MODULES_INACTIVE'] = 'Нет неактивных модулей';
-$lang['REPORT_MODULE_NOT_EXISTS'] = 'Выбранный модель не существует.';
-$lang['CLICK_RETURN_REPORT_ADMIN'] = '%sНажмите%s для возврата к настройкам Модулей и Причин.';
-
-$lang['BACK_MODULES'] = 'Назад к модулям';
-$lang['REPORT_REASON'] = 'Причина написания сообщения';
-$lang['NO_REASONS'] = 'Нет определенных Причин для этого модуля';
-$lang['ADD_REASON'] = 'Добавить Причину';
-$lang['EDIT_REASON'] = 'Редактировать Причину';
-$lang['REASON_DESC_EXPLAIN'] = 'Если название совпадет с языковой переменно, то будет использована переменная.';
-$lang['REASON_DESC_EMPTY'] = 'Нобходимо ввести текст Причины.';
-$lang['REPORT_REASON_ADDED'] = 'Причина добавлена.';
-$lang['REPORT_REASON_EDITED'] = 'Причина отредактирована.';
-$lang['DELETE_REASON'] = 'Удалить Причину';
-$lang['DELETE_REPORT_REASON_EXPLAIN'] = 'Вы уверены, что хотите удалить выбранную Причину?';
-$lang['REPORT_REASON_DELETED'] = 'Причина удалена.';
-$lang['REPORT_REASON_NOT_EXISTS'] = 'Выбранная Причина не существует.';
-$lang['CLICK_RETURN_REPORT_REASONS'] = '%sНажмите%s для возврата к настройкам Причин сообщений о нарушениях.';
-
-$lang['REPORT_MODULE_SYNCED'] = 'Модуль синхронизирован.';
-
-$lang['UNINSTALL_REPORT_MODULE'] = 'Удалить модуль';
-$lang['UNINSTALL_REPORT_MODULE_EXPLAIN'] = 'Вы уверены, что хотите удалить выбранный модуль?
Замечание: все сообщения для этого модуля также будут удалены.';
-$lang['REPORT_MODULE_UNINSTALLED'] = 'Модуль удален.';
-
-$lang['INSTALL_REPORT_MODULE'] = 'Установить модуль';
-$lang['EDIT_REPORT_MODULE'] = 'Редактировать настройки модуля';
-$lang['REPORT_PRUNE'] = 'Очистить сообщения';
-$lang['REPORT_PRUNE_EXPLAIN'] = 'Зыкрытые и отмеченные для удаления сообщения автоматически будут удалены через x дней. Значение zero отключает автоматическую чистку.';
-$lang['REPORT_PERMISSIONS'] = 'Права доступа';
-$lang['WRITE'] = 'Написать';
-$lang['REPORT_AUTH'] = array(
- REPORT_AUTH_USER => 'Пользователи',
- REPORT_AUTH_MOD => 'Модераторы',
- REPORT_AUTH_CONFIRM => 'Модераторы (после подтверждения)',
- REPORT_AUTH_ADMIN => 'Администраторы'
-);
-$lang['REPORT_AUTH_NOTIFY_EXPLAIN'] = 'Модераторы будут уведомлены только, если они могут просматривать и редактировать сообщение.';
-$lang['REPORT_AUTH_DELETE_EXPLAIN'] = 'Если выбрано Модераторы (после подтверждения), удаление сообщения должно быть подтверждено администратором.';
-$lang['REPORT_MODULE_INSTALLED'] = 'Модуль удален.';
-$lang['REPORT_MODULE_EDITED'] = 'Модуль отредактирован.';
// Mods
$lang['MAX_NEWS_TITLE'] = 'Макс. длина новости';
diff --git a/upload/language/ru/report_hack/.htaccess b/upload/language/ru/report_hack/.htaccess
deleted file mode 100644
index baa56e5a3..000000000
--- a/upload/language/ru/report_hack/.htaccess
+++ /dev/null
@@ -1,2 +0,0 @@
-order allow,deny
-deny from all
\ No newline at end of file
diff --git a/upload/language/ru/report_hack/report_general.php b/upload/language/ru/report_hack/report_general.php
deleted file mode 100644
index cf723a4b2..000000000
--- a/upload/language/ru/report_hack/report_general.php
+++ /dev/null
@@ -1,17 +0,0 @@
-%4$s';
-$lang['REPORT_CHANGE_DELETE_TEXT'] = 'Відзначено для видалення користувачем %1$s %2$s.';
$lang['ACTION'] = 'Дія';
-$lang['REPORT_MARK'] = 'Відмітити як';
-$lang['OPEN_REPORTS'] = 'відкриті повідомлення';
-$lang['NO_REPORTS_FOUND'] = 'Відповідних повідомлень не знайдено.';
-$lang['NO_REPORTS_SELECTED'] = 'Не було виділено жодного повідомлення.';
-$lang['REPORT_NOT_EXISTS'] = 'Вибране повідомлення не існує.';
-$lang['REPORT_NOT_SUPPORTED'] = 'Ця опція не підтримується.';
-$lang['CLICK_RETURN_REPORT'] = '%sВернуться до повідомлення%s';
-$lang['CLICK_RETURN_REPORT_LIST'] = '%sВернуться до списку повідомлень%s';
-
-$lang['REPORT_STATUS'] = array(
- REPORT_NEW => 'Нове',
- REPORT_OPEN => 'Відкрито',
- REPORT_IN_PROCESS => 'В обробці',
- REPORT_CLEARED => 'Закрито',
- REPORT_DELETE => 'Відзначено для видалення',
-);
-
-$lang['REASON'] = 'Причина';
-$lang['REPORT_SUBJECT'] = 'Тема';
-$lang['REPORT_TITLE_EMPTY'] = 'Необхідно ввести заголовок повідомлення.';
-$lang['REPORT_DESC_EMPTY'] = 'Необхідно ввести повідомлення.';
-$lang['REPORT_INSERTED'] = 'Повідомлення було відправлено адміністрації.';
-
-$lang['CHANGE_REPORT'] = 'Редагувати повідомлення';
-$lang['CHANGE_REPORTS'] = 'Редагувати повідомлення';
-$lang['CHANGE_REPORT_EXPLAIN'] = 'Ви впевнені, що хочете змінити статус вибраного повідомлення?';
-$lang['CHANGE_REPORTS_EXPLAIN'] = 'Ви впевнені, що хочете змінити статус вибраних повідомлень?';
$lang['COMMENT'] = 'Коментар';
-$lang['REPORT_CHANGED'] = 'Статус вибраного повідомлення було змінено.';
-$lang['REPORTS_CHANGED'] = 'Статус вибрані повідомлення було змінено.';
-
-$lang['DELETE_REPORT'] = 'Видалити повідомлення';
-$lang['DELETE_REPORTS'] = 'Видалити повідомлення';
-$lang['DELETE_REPORT_EXPLAIN'] = 'Ви впевнені, що хочете видалити вибране повідомлення?';
-$lang['DELETE_REPORTS_EXPLAIN'] = 'Ви впевнені, що бажаєте видалити вибрані повідомлення?';
-$lang['REPORT_DELETED'] = 'Вибране повідомлення видалено.';
-$lang['REPORTS_DELETED'] = 'Вибрані повідомлення видалено.';
+$lang['REASON'] = 'Причина';
// search
$lang['SEARCH_S'] = 'пошук...';
@@ -2114,73 +2059,7 @@ $lang['SF_SHOW_ON_INDEX'] = 'Показувати на головній';
$lang['SF_PARENT_FORUM'] = 'Батьківський форум';
$lang['SF_NO_PARENT'] = 'Немає батьківського форуму';
$lang['TEMPLATE'] = 'Шаблон';
-
-// Reports
-$lang['REPORT_CONFIG_EXPLAIN'] = 'На цій сторінці знаходяться основні налаштування модуля "Повідомлення про порушення".';
-$lang['REPORT_SUBJECT_AUTH'] = 'Індивідуальні права доступу';
-$lang['REPORT_SUBJECT_AUTH_EXPLAIN'] = 'Якщо опція включена, то модератори зможуть переглядати і редагувати тільки повідомлення про порушення в модерованих ними форумах.';
-$lang['REPORT_MODULES_CACHE'] = 'Кешувати модулі у файлах';
-$lang['REPORT_MODULES_CACHE_EXPLAIN'] = 'Зауваження: права доступу до директорії cache в режим "повний доступ на запис і читання" (CHMOD 777).';
-$lang['REPORT_NOTIFY'] = 'Повідомлення по e-mail';
-$lang['REPORT_NOTIFY_CHANGE'] = 'про зміни статусів і нових повідомлень';
-$lang['REPORT_NOTIFY_NEW'] = 'про нові повідомлення';
-$lang['REPORT_LIST_ADMIN'] = 'Список повідомлень доступний тільки адміністратору';
-$lang['REPORT_NEW_WINDOW'] = 'Відкривати сторінку з порушенням в новому вікні';
-$lang['REPORT_NEW_WINDOW_EXPLAIN'] = 'Ця опція так само впливає на вид посилань на формі відправки повідомлення про порушення на сторінках перегляду тим.';
-$lang['REPORT_CONFIG_UPDATED'] = 'Конфигурцію оновлено.';
-$lang['CLICK_RETURN_REPORT_CONFIG'] = '%sНатиснить%s для повернення до налаштувань модуля.';
-
-$lang['MODULES_REASONS'] = 'Модулі та Причини';
-$lang['REPORT_ADMIN_EXPLAIN'] = 'На цій сторінці ви можете встановити новий модуль, змінити настройки модуля або видалити вже встановлений модуль. Так само тут ви можете задати встановити Причини написання повідомлень про порушення для кожного модуля.';
-$lang['REPORT_MODULE'] = 'Модуль Повідомлень про порушення';
-$lang['INSTALLED_MODULES'] = 'Встановлені модулі';
-$lang['NO_MODULES_INSTALLED'] = 'Немає встановлених модулів';
-$lang['REASONS'] = 'Причини (%d)';
$lang['SYNC'] = 'Синхронізувати';
-$lang['UNINSTALL'] = 'Видалити';
-$lang['INSTALL2'] = 'Встановити';
-$lang['INACTIVE_MODULES'] = 'Неактивні модулі';
-$lang['NO_MODULES_INACTIVE'] = 'Немає неактивних модулів';
-$lang['REPORT_MODULE_NOT_EXISTS'] = 'Обраний модуль не існує.';
-$lang['CLICK_RETURN_REPORT_ADMIN'] = '%sНатиснить%s для повернення до налаштувань Модулів і Причин.';
-
-$lang['BACK_MODULES'] = 'Назад до модулів';
-$lang['REPORT_REASON'] = 'Причина написання повідомлення';
-$lang['NO_REASONS'] = 'Немає особливих Причин для цього модуля';
-$lang['ADD_REASON'] = 'Додати Причину';
-$lang['EDIT_REASON'] = 'Редагувати Причину';
-$lang['REASON_DESC_EXPLAIN'] = 'Якщо назва співпаде з мовної мінливой, то буде використана мінлива.';
-$lang['REASON_DESC_EMPTY'] = 'Нобхідно ввести текст Причини.';
-$lang['REPORT_REASON_ADDED'] = 'Причину додано.';
-$lang['REPORT_REASON_EDITED'] = 'Причина відредагована.';
-$lang['DELETE_REASON'] = 'Видалити Причину';
-$lang['DELETE_REPORT_REASON_EXPLAIN'] = 'Ви впевнені, що хочете видалити обрану Причину?';
-$lang['REPORT_REASON_DELETED'] = 'Причину видалено.';
-$lang['REPORT_REASON_NOT_EXISTS'] = 'Обрана Причина не існує.';
-$lang['CLICK_RETURN_REPORT_REASONS'] = '%sНатиснить%s для повернення до налаштувань Причин повідомлень про порушення.';
-
-$lang['REPORT_MODULE_SYNCED'] = 'Модуль синхронізований.';
-
-$lang['UNINSTALL_REPORT_MODULE'] = 'Видалити модуль';
-$lang['UNINSTALL_REPORT_MODULE_EXPLAIN'] = 'Ви впевнені, що хочете видалити вибраний модуль?
Зауваження: всі повідомлення для цього модуля буде видалено.';
-$lang['REPORT_MODULE_UNINSTALLED'] = 'Модуль видалено.';
-
-$lang['INSTALL_REPORT_MODULE'] = 'Встановити модуль';
-$lang['EDIT_REPORT_MODULE'] = 'Редагувати настройки модуля';
-$lang['REPORT_PRUNE'] = 'Очистити повідомлення';
-$lang['REPORT_PRUNE_EXPLAIN'] = 'Зыкрытые та позначені для видалення повідомлення автоматично будуть видалені через x днів. Значення zero відключає автоматичне чищення.';
-$lang['REPORT_PERMISSIONS'] = 'Права доступу';
-$lang['WRITE'] = 'Написати';
-$lang['REPORT_AUTH'] = array(
- REPORT_AUTH_USER => 'Користувачі',
- REPORT_AUTH_MOD => 'Модератори',
- REPORT_AUTH_CONFIRM => 'Модератори (після підтвердження)',
- REPORT_AUTH_ADMIN => 'Адміністратори'
-);
-$lang['REPORT_AUTH_NOTIFY_EXPLAIN'] = 'Модератори будуть повідомлені тільки, якщо вони можуть переглядати і редагувати повідомлення.';
-$lang['REPORT_AUTH_DELETE_EXPLAIN'] = 'Якщо вибрано Модератори (після підтвердження), видалення повідомлення повинно бути підтверджено адміністратором.';
-$lang['REPORT_MODULE_INSTALLED'] = 'Модуль видалено.';
-$lang['REPORT_MODULE_EDITED'] = 'Модуль відредагований.';
// Mods
$lang['MAX_NEWS_TITLE'] = 'Макс. довжина новини';
diff --git a/upload/language/uk/report_hack/.htaccess b/upload/language/uk/report_hack/.htaccess
deleted file mode 100644
index baa56e5a3..000000000
--- a/upload/language/uk/report_hack/.htaccess
+++ /dev/null
@@ -1,2 +0,0 @@
-order allow,deny
-deny from all
\ No newline at end of file
diff --git a/upload/language/uk/report_hack/report_general.php b/upload/language/uk/report_hack/report_general.php
deleted file mode 100644
index b083c41d5..000000000
--- a/upload/language/uk/report_hack/report_general.php
+++ /dev/null
@@ -1,17 +0,0 @@
-auth_check('auth_write'))
- {
- if ($privmsg['privmsgs_reported'])
- {
- $report_img = '';
- $report = $report_privmsg->lang['DUPLICATE_REPORT'];
- }
- else
- {
- $temp_url = "report.php?mode=" . $report_privmsg->mode . "&id=$privmsg_id";
- $report_img = '
';
- $report = '' . $report_privmsg->lang['WRITE_REPORT'] . '';
- }
-
- $template->assign_vars(array(
- 'REPORT_PM_IMG' => $report_img,
- 'REPORT_PM' => $report,
- ));
- }
- }
- // Report [END]
-
$s_hidden_fields = '';
$page_title = $lang['READ_PM'];
diff --git a/upload/report.php b/upload/report.php
deleted file mode 100644
index 9869ffb28..000000000
--- a/upload/report.php
+++ /dev/null
@@ -1,753 +0,0 @@
-session_start(array('req_login' => true));
-
-if(!$bb_cfg['reports_enabled']) bb_die($lang['REPORTS_DISABLE']);
-
-$return_links = array(
- 'index' => '
' . sprintf($lang['CLICK_RETURN_INDEX'], '', ''),
- 'list' => '
' . sprintf($lang['CLICK_RETURN_REPORT_LIST'], '', '')
-);
-
-if (isset($_POST['mode']) || isset($_GET['mode']))
-{
- $mode = (isset($_POST['mode'])) ? $_POST['mode'] : $_GET['mode'];
-}
-else
-{
- $mode = '';
-}
-
-$report_modules = report_modules();
-
-//
-// Check for matching report module
-//
-if (!empty($mode))
-{
- foreach (array_keys($report_modules) as $report_module_id)
- {
- $report_module =& $report_modules[$report_module_id];
-
- if (!empty($report_module->mode) && $mode == $report_module->mode)
- {
- break;
- }
-
- unset($report_module);
- }
-}
-
-//
-// Report module matched, show report form
-//
-if (isset($report_module))
-{
- $errors = array();
-
- if (isset($_POST['id']) || isset($_GET['id']))
- {
- $report_subject_id = (isset($_POST['id'])) ? (int) $_POST['id'] : (int) $_GET['id'];
- }
- else
- {
- $report_subject_id = 0;
- }
-
- //
- // Check authorisation, check for duplicate reports
- //
- if (!$report_module->auth_check('auth_write'))
- {
- bb_die($report_module->lang['AUTH_WRITE_ERROR'] . $report_module->return_link($report_subject_id) . $return_links['index']);
- }
- else if (!$report_module->duplicates && report_duplicate_check($report_module->id, $report_subject_id))
- {
- bb_die($report_module->lang['DUPLICATE_ERROR'] . $report_module->return_link($report_subject_id) . $return_links['index']);
- }
-
- if (isset($_POST['submit']))
- {
- $report_reason = (isset($_POST['reason'])) ? (int) $_POST['reason'] : 0;
- $report_desc = (isset($_POST['message'])) ? $_POST['message'] : '';
-
- //
- // Obtain report title if necessary
- //
- if (method_exists($report_module, 'subject_obtain'))
- {
- $report_title = addslashes($report_module->subject_obtain($report_subject_id));
- }
- else
- {
- $report_title = (isset($_POST['title'])) ? $_POST['title'] : '';
- $report_subject_id = 0;
- }
-
- //
- // Validate values
- //
- if (empty($report_title))
- {
- $errors[] = $lang['REPORT_TITLE_EMPTY'];
- }
-
- if (empty($report_desc))
- {
- $errors[] = $lang['REPORT_DESC_EMPTY'];
- }
-
- //
- // Insert report
- //
- if (empty($errors))
- {
- $report_desc = str_replace("\'", "'", $report_desc);
- $report_title = clean_title($report_title);
-
- report_insert($report_module->id, $report_subject_id, $report_reason, $report_title, $report_desc, false);
-
- bb_die($lang['REPORT_INSERTED'] . $report_module->return_link($report_subject_id) . $return_links['index']);
- }
- }
- else if (isset($_POST['cancel']))
- {
- $redirect_url = (method_exists($report_module, 'subject_url')) ? $report_module->subject_url($report_subject_id, true) : "index.php";
- redirect($redirect_url);
- }
-
- $page_title = $report_module->lang['WRITE_REPORT'];
- include(PAGE_HEADER);
- $template->set_filenames(array(
- 'body' => 'report_form_body.tpl')
- );
-
- //
- // Show validation errors
- //
- if (!empty($errors))
- {
- $template->assign_block_vars('switch_report_errors', array());
- foreach ($errors as $error)
- {
- $template->assign_block_vars('switch_report_errors.report_errors', array(
- 'MESSAGE' => $error,
- ));
- }
- }
-
- //
- // Generate report reasons select
- //
- if ($report_reasons = $report_module->reasons_obtain())
- {
- $template->assign_block_vars('switch_report_reasons', array());
-
- foreach ($report_reasons as $reason_id => $reason_desc)
- {
- $template->assign_block_vars('switch_report_reasons.report_reasons', array(
- 'ID' => $reason_id,
- 'DESC' => $reason_desc,
- 'CHECKED' => (isset($report_reason) && $report_reason == $reason_id) ? ' selected="selected"' : '',
- ));
- }
- }
-
- //
- // Show report subject, check for correct subject
- //
- if (method_exists($report_module, 'subject_obtain'))
- {
- if ($report_subject = $report_module->subject_obtain($report_subject_id))
- {
- $template->assign_block_vars('switch_report_subject', array());
- $template->assign_var('REPORT_SUBJECT', $report_subject);
-
- if (method_exists($report_module, 'subject_url'))
- {
- $template->assign_block_vars('switch_report_subject.switch_url', array());
- $template->assign_var('U_REPORT_SUBJECT', $report_module->subject_url($report_subject_id));
- }
- }
- else
- {
- bb_die($report_module->lang['WRITE_REPORT_ERROR'] . $return_links['index']);
- }
- }
- //
- // Show report title input
- //
- else
- {
- $template->assign_block_vars('switch_report_title', array());
- }
-
- $hidden_fields = '';
-
- $template->assign_vars(array(
- 'S_REPORT_ACTION' => "report.php",
- 'S_HIDDEN_FIELDS' => $hidden_fields,
-
- 'L_WRITE_REPORT' => $report_module->lang['WRITE_REPORT'],
- 'L_WRITE_REPORT_EXPLAIN' => $report_module->lang['WRITE_REPORT_EXPLAIN'],
- 'REPORT_TITLE' => (!method_exists($report_module, 'subject_obtain') && isset($report_title)) ? stripslashes($report_title) : '',
- 'REPORT_DESC' => (isset($report_desc)) ? stripslashes($report_desc) : '',
- ));
-
- $template->pparse('body');
- include(PAGE_FOOTER);
-}
-else
-{
- if ($userdata['user_level'] != ADMIN && ($bb_cfg['report_list_admin'] || $userdata['user_level'] != MOD))
- {
- redirect("index.php");
- }
-
- $params = array('open', 'process', 'clear', 'delete');
- foreach ($params as $param)
- {
- if (isset($_POST[$param]))
- {
- $mode = $param;
- }
- }
-
- // Report status css classes
- $report_status_classes = array(
- REPORT_NEW => 'report_new',
- REPORT_OPEN => 'report_open',
- REPORT_IN_PROCESS => 'report_process',
- REPORT_CLEARED => 'report_cleared',
- REPORT_DELETE => 'report_delete'
- );
-
- switch ($mode)
- {
- case 'open':
- case 'process':
- case 'clear':
- case 'delete':
- //
- // Validate report ids
- //
- if (isset($_POST[POST_REPORT_URL]) || isset($_GET[POST_REPORT_URL]))
- {
- $report_id = (isset($_POST[POST_REPORT_URL])) ? $_POST[POST_REPORT_URL] : $_GET[POST_REPORT_URL];
- $reports = array((int) $report_id);
-
- $single_report = true;
- }
- else if (isset($_POST['reports']))
- {
- $reports = array();
- foreach ($_POST['reports'] as $report_id)
- {
- $reports[] = (int) $report_id;
- }
-
- $single_report = false;
- }
-
- if (empty($reports))
- {
- meta_refresh('report.php', 3);
- bb_die($lang['NO_REPORTS_SELECTED'] . $return_links['list'] . $return_links['index']);
- }
-
- //
- // Cancel action
- //
- if (isset($_POST['cancel']))
- {
- $redirect_url = ($single_report) ? "report.php?" . POST_REPORT_URL . '=' . $reports[0] : "report.php";
- redirect($redirect_url);
- }
-
- //
- // Hidden fields
- //
- $hidden_fields = '';
- if ($single_report)
- {
- $hidden_fields .= '';
- }
- else
- {
- foreach ($reports as $report_id)
- {
- $hidden_fields .= '';
- }
- }
-
- $template->assign_vars(array(
- 'S_CONFIRM_ACTION' => "report.php",
- 'S_HIDDEN_FIELDS' => $hidden_fields,
- ));
-
- //
- // Change reports status
- //
- if ($mode != 'delete')
- {
- if (isset($_POST['confirm']))
- {
- $comment = (isset($_POST['comment'])) ? $_POST['comment'] : '';
-
- switch ($mode)
- {
- case 'open':
- $status = REPORT_OPEN;
- break;
-
- case 'process':
- $status = REPORT_IN_PROCESS;
- break;
-
- case 'clear':
- $status = REPORT_CLEARED;
- break;
- }
-
- reports_update_status($reports, $status, $comment);
-
- $meta_url = ($single_report) ? "report.php?" . POST_REPORT_URL . '=' . $reports[0] : "report.php";
-
- meta_refresh($meta_url, 3);
-
- $return_link = ($single_report) ? '
' . sprintf($lang['CLICK_RETURN_REPORT'], '', '') : '';
- $message = ($single_report) ? 'REPORT_CHANGED' : 'REPORTS_CHANGED';
- bb_die($lang[$message] . $return_link . $return_links['list'] . $return_links['index']);
- }
-
- $page_title = ($single_report) ? $lang['CHANGE_REPORT'] : $lang['CHANGE_REPORTS'];
-
- include(PAGE_HEADER);
- $template->set_filenames(array(
- 'body' => 'report_change_body.tpl',
- ));
-
- $template->assign_vars(array(
- 'MESSAGE_TITLE' => $page_title,
- 'MESSAGE_TEXT' => ($single_report) ? $lang['CHANGE_REPORT_EXPLAIN'] : $lang['CHANGE_REPORTS_EXPLAIN'],
- ));
-
- $template->pparse('body');
- include(PAGE_FOOTER);
- }
- //
- // Delete reports
- //
- else
- {
- if (isset($_POST['confirm']))
- {
- reports_delete($reports);
- meta_refresh('report.php', 3);
- $message = ($single_report) ? 'REPORT_DELETED' : 'REPORTS_DELETED';
- bb_die($lang[$message] . $return_links['list'] . $return_links['index']);
- }
-
- print_confirmation(array(
- 'CONFIRM_TITLE' => ($single_report) ? $lang['DELETE_REPORT'] : $lang['DELETE_REPORTS'],
- 'QUESTION' => ($single_report) ? $lang['DELETE_REPORT_EXPLAIN'] : $lang['DELETE_REPORTS_EXPLAIN'],
- 'FORM_ACTION' => "report.php",
- 'HIDDEN_FIELDS' => $hidden_fields,
- ));
- }
- break;
-
- case 'reported':
- $cat = (isset($_GET[POST_CAT_URL])) ? (int) $_GET[POST_CAT_URL] : 0;
- $report_subject_id = (isset($_GET['id'])) ? (int) $_GET['id'] : 0;
-
- if (empty($cat) || empty($report_subject_id) || !isset($report_modules[$cat]))
- {
- bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['index']);
- }
-
- $report_module =& $report_modules[$cat];
- $reports = reports_open_obtain($cat, $report_subject_id);
-
- //
- // No open reports for the subject, sync report module
- //
- if (empty($reports))
- {
- if (method_exists($report_module, 'sync'))
- {
- $report_module->sync();
- }
-
- bb_die($lang['NO_REPORTS_FOUND'] . $report_module->return_link($report_subject_id) . $return_links['index']);
- }
- //
- // Redirect to the open report
- //
- else if (count($reports) == 1)
- {
- $redirect_url = "report.php?" . POST_REPORT_URL . '=' . $reports[0]['report_id'];
- redirect($redirect_url);
- }
-
- $page_title = $lang['OPEN_REPORTS'];
- include(PAGE_HEADER);
- $template->set_filenames(array(
- 'body' => 'report_open_body.tpl',
- ));
-
- $template->assign_vars(array(
- 'S_REPORT_ACTION', "report.php",
-
- 'L_STATUS_CLEARED' => $lang['REPORT_STATUS'][REPORT_CLEARED],
- 'L_STATUS_IN_PROCESS' => $lang['REPORT_STATUS'][REPORT_IN_PROCESS],
- 'L_STATUS_OPEN' => $lang['REPORT_STATUS'][REPORT_OPEN],
- ));
-
- //
- // Show list with open reports
- //
- foreach ($reports as $report)
- {
- $template->assign_block_vars('open_reports', array(
- 'U_SHOW' => "report.php?" . POST_REPORT_URL . '=' . $report['report_id'],
-
- 'ID' => $report['report_id'],
- 'TITLE' => $report['report_title'],
- 'AUTHOR' => profile_url($report),
- 'TIME' => bb_date($report['report_time']),
- ));
- }
-
- $template->pparse('body');
- include(PAGE_FOOTER);
- break;
-
- case '':
- $page_title = $lang['REPORTS'];
- include(PAGE_HEADER);
- $template->set_filenames(array(
- 'body' => 'report_list_body.tpl')
- );
-
- $template->assign_vars(array(
- 'S_REPORT_ACTION' => "report.php",
-
- 'U_REPORT_INDEX' => "report.php",
-
- 'L_STATUS_CLEARED' => $lang['REPORT_STATUS'][REPORT_CLEARED],
- 'L_STATUS_IN_PROCESS' => $lang['REPORT_STATUS'][REPORT_IN_PROCESS],
- 'L_STATUS_OPEN' => $lang['REPORT_STATUS'][REPORT_OPEN],
- ));
-
- $cat = (isset($_GET[POST_CAT_URL])) ? (int) $_GET[POST_CAT_URL] : null;
- $cat_url = (!empty($cat)) ? '&' . POST_CAT_URL . "=$cat" : '';
-
- $show_delete_option = false;
-
- //
- // Show report list
- //
- $reports = reports_obtain($cat);
- foreach (array_keys($report_modules) as $report_module_id)
- {
- $report_module =& $report_modules[$report_module_id];
-
- //
- // Check module authorisation
- //
- if (!$report_module->auth_check('auth_view'))
- {
- continue;
- }
-
- $template->assign_block_vars('report_modules', array(
- 'U_SHOW' => "report.php?" . POST_CAT_URL . '=' . $report_module->id,
- 'TITLE' => $report_module->lang['REPORT_LIST_TITLE'],
- ));
-
- //
- // No reports in this category, display no reports message
- //
- if (!isset($reports[$report_module->id]))
- {
- if (empty($cat) || $cat == $report_module->id)
- {
- $template->assign_block_vars('report_modules.no_reports', array());
- }
-
- continue;
- }
-
- //
- // Check if deletions are allowed
- //
- if ($report_module->auth_check('auth_delete_view'))
- {
- $show_delete_option = true;
- }
-
- //
- // Show reports
- //
- foreach ($reports[$report_module->id] as $report)
- {
- $template->assign_block_vars('report_modules.reports', array(
- 'U_SHOW' => "report.php?" . POST_REPORT_URL . '=' . $report['report_id'] . $cat_url,
- 'ROW_CLASS' => $report_status_classes[$report['report_status']],
- 'ID' => $report['report_id'],
- 'TITLE' => (strlen($report['report_title'] > 53)) ? substr($report['report_title'], 0, 50) . '...' : $report['report_title'],
- 'AUTHOR' => profile_url($report),
- 'TIME' => bb_date($report['report_time']),
- 'STATUS' => $lang['REPORT_STATUS'][$report['report_status']],
- ));
-
- if (isset($_GET[POST_REPORT_URL]) && $_GET[POST_REPORT_URL] == $report['report_id'])
- {
- $template->assign_block_vars('report_modules.reports.switch_current', array());
- }
- }
- }
-
- if ($show_delete_option)
- {
- $template->assign_block_vars('switch_global_delete_option', array());
- }
-
- //
- // Show information for one report
- //
- if (isset($_GET[POST_REPORT_URL]))
- {
- $template->set_filenames(array(
- 'report_view' => 'report_view_body.tpl')
- );
-
- if (!$report = report_obtain((int) $_GET[POST_REPORT_URL]))
- {
- bb_die($lang['REPORT_NOT_EXISTS'] . $return_links['list'] . $return_links['index']);
- }
-
- if ($report['report_status'] == REPORT_NEW)
- {
- reports_update_status($report['report_id'], REPORT_OPEN, '', false, true, false);
- $report['report_status'] = REPORT_OPEN;
- }
-
- //
- // Show report subject (with or without details, depending on the report module)
- //
- $report_module =& $report_modules[$report['report_module_id']];
- if (method_exists($report_module, 'subject_details_obtain'))
- {
- if ($report_subject = $report_module->subject_details_obtain($report['report_subject']))
- {
- if (isset($report_subject['subject']) || isset($report_subject['details']))
- {
- $template->assign_block_vars('report_subject', array());
- }
-
- //
- // Assign report subject
- //
- if (isset($report_subject['subject']))
- {
- $template->assign_block_vars('report_subject.switch_subject', array());
- $template->assign_var('REPORT_SUBJECT', $report_subject['subject']);
-
- if (method_exists($report_module, 'subject_url'))
- {
- $template->assign_block_vars('report_subject.switch_subject.switch_url', array());
- $template->assign_vars(array(
- 'S_REPORT_SUBJECT_TARGET' => ($bb_cfg['report_new_window']) ? ' target="_blank"' : '',
- 'U_REPORT_SUBJECT' => $report_module->subject_url($report['report_subject']),
- ));
- }
- }
-
- //
- // Assign report subject details
- //
- if (isset($report_subject['details']))
- {
- foreach ($report_subject['details'] as $detail_title => $detail_value)
- {
- $template->assign_block_vars('report_subject.details', array(
- 'TITLE' => $report_module->lang[strtoupper($detail_title)],
- 'VALUE' => $detail_value,
- ));
- }
- }
- }
- else
- {
- $template->assign_block_vars('switch_report_subject_deleted', array());
- $template->assign_var('L_REPORT_SUBJECT_DELETED', $report_module->lang['DELETED_ERROR']);
- }
- }
- else if (method_exists($report_module, 'subject_obtain'))
- {
- if ($report_subject = $report_module->subject_obtain($report['report_subject']))
- {
- //
- // Assign report subject
- //
- $template->assign_block_vars('report_subject', array());
- $template->assign_block_vars('report_subject.switch_subject', array());
- $template->assign_var('REPORT_SUBJECT', $report_subject);
-
- if (method_exists($report_module, 'subject_url'))
- {
- $template->assign_block_vars('report_subject.switch_subject.switch_url', array());
- $template->assign_vars(array(
- 'S_REPORT_SUBJECT_TARGET' => ($bb_cfg['report_new_window']) ? ' target="_blank"' : '',
- 'U_REPORT_SUBJECT' => $report_module->subject_url($report['report_subject']),
- ));
- }
- }
- else
- {
- $template->assign_block_vars('switch_report_subject_deleted', array());
- $template->assign_var('L_REPORT_SUBJECT_DELETED', $report_module->lang['DELETED_ERROR']);
- }
- }
-
- //
- // Assign report reason
- //
- if (!empty($report['report_reason_desc']))
- {
- $template->assign_block_vars('switch_report_reason', array());
-
- $template->assign_var('REPORT_REASON', $report['report_reason_desc']);
- }
-
- //
- // Show report changes
- //
- if ($report_changes = report_changes_obtain($report['report_id']))
- {
- $template->assign_block_vars('switch_report_changes', array());
-
- foreach ($report_changes as $report_change)
- {
- $report_change_user = profile_url($report_change);
-
- $report_change_status = $lang['REPORT_STATUS'][$report_change['report_status']];
- $report_change_time = bb_date($report_change['report_change_time']);
-
- //
- // Text that contains all information
- //
- if ($report_change['report_status'] == REPORT_DELETE)
- {
- $report_change_text = sprintf($lang['REPORT_CHANGE_DELETE_TEXT'], $report_change_user, $report_change_time);
- }
- else if ($report_change['report_change_comment'] != '')
- {
- $report_change_text = sprintf($lang['REPORT_CHANGE_TEXT_COMMENT'], $report_change_status, $report_change_user, $report_change_time, bbcode2html($report_change['report_change_comment']));
- }
- else
- {
- $report_change_text = sprintf($lang['REPORT_CHANGE_TEXT'], $report_change_status, $report_change_user, $report_change_time);
- }
-
- $template->assign_block_vars('switch_report_changes.report_changes', array(
- 'ROW_CLASS' => $report_status_classes[$report_change['report_status']],
- 'STATUS' => $report_change_status,
- 'USER' => $report_change_user,
- 'TIME' => $report_change_time,
- 'TEXT' => $report_change_text,
- ));
- }
-
- //
- // Assign last change information
- //
- $template->assign_vars(array(
- 'REPORT_LAST_CHANGE_TIME' => $report_change_time,
- 'REPORT_LAST_CHANGE_USER' => profile_url($report_change),
- ));
- }
-
- //
- // Check if deletions are allowed
- //
- if ($report_module->auth_check('auth_delete_view'))
- {
- $template->assign_block_vars('switch_delete_option', array());
- }
-
- $template->assign_vars(array(
- 'S_HIDDEN_FIELDS' => '',
- 'U_REPORT_AUTHOR_PRIVMSG' => PM_URL . "?mode=post&" . POST_USERS_URL . '=' . $report['user_id'],
- 'REPORT_TYPE' => $report_module->lang['REPORT_TYPE'],
- 'REPORT_TITLE' => $report['report_title'],
- 'REPORT_AUTHOR' => profile_url($report),
- 'REPORT_TIME' => bb_date($report['report_time']),
- 'REPORT_DESC' => bbcode2html($report['report_desc']),
- 'REPORT_STATUS' => $lang['REPORT_STATUS'][$report['report_status']],
- 'REPORT_STATUS_CLASS' => $report_status_classes[$report['report_status']],
- ));
- }
- //
- // Show report index page
- //
- else
- {
- $template->set_filenames(array(
- 'report_view' => 'report_index_body.tpl')
- );
-
- $statistics = array(
- 'Report_count' => 'report_count',
- 'Report_modules_count' => 'modules_count',
- 'Report_hack_count' => 'report_hack_count');
- foreach ($statistics as $stat_lang => $stat_mode)
- {
- $template->assign_block_vars('report_statistics', array(
- 'STATISTIC' => $lang[strtoupper($stat_lang)],
- 'VALUE' => report_statistics($stat_mode),
- ));
- }
-
- $deleted_reports = reports_deleted_obtain();
- if (!empty($deleted_reports))
- {
- $template->assign_block_vars('switch_deleted_reports', array());
- foreach ($deleted_reports as $report)
- {
- $report_module =& $report_modules[$report['report_module_id']];
-
- $template->assign_block_vars('switch_deleted_reports.deleted_reports', array(
- 'U_SHOW' => "report.php?" . POST_REPORT_URL . '=' . $report['report_id'] . $cat_url,
- 'ID' => $report['report_id'],
- 'TITLE' => $report['report_title'],
- 'TYPE' => $report_module->lang['REPORT_TYPE'],
- 'AUTHOR' => profile_url($report),
- 'TIME' => bb_date($report['report_time']),
- 'STATUS' => $lang['REPORT_STATUS'][REPORT_DELETE],
- ));
- }
- }
- }
-
- $template->assign_var_from_handle('REPORT_VIEW', 'report_view');
-
- $template->pparse('body');
- include(PAGE_FOOTER);
- break;
-
- default:
- bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['index']);
- break;
- }
-}
\ No newline at end of file
diff --git a/upload/templates/admin/admin_board.tpl b/upload/templates/admin/admin_board.tpl
index 179209258..bd3c15805 100644
--- a/upload/templates/admin/admin_board.tpl
+++ b/upload/templates/admin/admin_board.tpl
@@ -164,13 +164,6 @@
{L_REPORT_CONFIG_EXPLAIN}
-{L_REPORT_REASON} | -{L_ACTION} | -
---|---|
{report_reasons.DESC} | -- {L_EDIT} | - {L_MOVE_UP} | - {L_MOVE_DOWN} | - {L_DELETE} - | -
{L_NO_REASONS} | -|
- {L_ADD_REASON} | - {L_BACK_MODULES} - | -
{L_REPORT_ADMIN_EXPLAIN}
-{L_REPORT_MODULE} | -{L_REPORTS} | -{L_ACTION} | -
---|---|---|
{L_INSTALLED_MODULES} | -||
- {installed_modules.modules.MODULE_TITLE} - {installed_modules.modules.MODULE_EXPLAIN} - |
- {installed_modules.modules.REPORT_COUNT} | -- {L_EDIT} | - {installed_modules.modules.L_REASONS} | - - {L_SYNC} | - - {L_MOVE_UP} | - {L_MOVE_DOWN} | - {L_UNINSTALL} - | -
{L_NO_MODULES_INSTALLED} | -||
{L_INACTIVE_MODULES} | -||
- {inactive_modules.modules.MODULE_TITLE} - {inactive_modules.modules.MODULE_EXPLAIN} - |
- {inactive_modules.modules.REPORT_COUNT} | -- {L_INSTALL2} - | -
{L_NO_MODULES_INACTIVE} | -
{T_INDEX} | -
{L_REPORT_INDEX} | -|||||
---|---|---|---|---|---|
- {L_STATISTICS}: -
- - {L_DELETED_REPORTS}: - - -
- - |
- |||||
- | -
{T_INDEX} | -
- - - {L_MARK_ALL} :: - {L_INVERT_SELECT} - - | -- {REPORT_VIEW} - | -
{L_HOME} | -
- {L_MARK_ALL} :: - {L_INVERT_SELECT} - | -
{REPORT_TYPE} | -|||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
- {REPORT_TITLE} - - -
- - - -
- - -
- -
- |
- |||||||||||||||||
{L_CHANGES} | -|||||||||||||||||
{switch_report_changes.report_changes.TEXT} |
- |||||||||||||||||
- - | -