diff --git a/contributors.txt b/contributors.txt
index c88224b24c..d659e2e158 100644
--- a/contributors.txt
+++ b/contributors.txt
@@ -16,7 +16,7 @@ qaqra
rserg99
leszav
Dr_Brown
-Bullit
+Bullit (http://bestrip.org/)
Triceratop (http://goldenshara.com/)
Ramzess
@@ -26,7 +26,7 @@ Ramzess
SamSeGo
alesel (http://sporttracker.kz/)
-Bullit
+Bullit (http://bestrip.org/)
igorsaevets
vasilich619
wint1000 (http://asmlocator.ru/)
diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql
index 08af7c232c..2bb84d7d95 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');
@@ -615,29 +604,27 @@ CREATE TABLE IF NOT EXISTS `bb_cron` (
-- Дамп данных таблицы `bb_cron`
--
-INSERT INTO `bb_cron` VALUES (1, 0, 'Site backup', 'site_backup.php', 'daily', '1', '05:00:00', 10, '', '', NULL, 1, '', 0, 1, 0);
-INSERT INTO `bb_cron` VALUES (2, 0, 'DB backup', 'db_backup.php', 'daily', '1', '05:00:00', 20, '', '', NULL, 1, '', 0, 1, 0);
-INSERT INTO `bb_cron` VALUES (3, 1, 'Attach maintenance', 'attach_maintenance.php', 'daily', NULL, '05:00:00', 40, '', '', NULL, 1, '', 0, 1, 0);
-INSERT INTO `bb_cron` VALUES (4, 1, 'Board maintenance', 'bb_maintenance.php', 'daily', NULL, '05:00:00', 40, '', '', NULL, 1, '', 0, 1, 0);
-INSERT INTO `bb_cron` VALUES (5, 1, 'Prune forums', 'prune_forums.php', 'daily', NULL, '05:00:00', 50, '', '', NULL, 1, '', 0, 1, 0);
-INSERT INTO `bb_cron` VALUES (6, 1, 'Prune topic moved stubs', 'prune_topic_moved.php', 'daily', NULL, '05:00:00', 60, '', '', NULL, 1, '', 0, 1, 0);
-INSERT INTO `bb_cron` VALUES (7, 1, 'Logs cleanup', 'clean_log.php', 'daily', NULL, '05:00:00', 70, '', '', NULL, 1, '', 0, 1, 0);
-INSERT INTO `bb_cron` VALUES (8, 1, 'Tracker maintenance', 'tr_maintenance.php', 'daily', NULL, '05:00:00', 90, '', '', NULL, 1, '', 0, 1, 0);
-INSERT INTO `bb_cron` VALUES (9, 1, 'Clean dlstat', 'clean_dlstat.php', 'daily', NULL, '05:00:00', 100, '', '', NULL, 1, '', 0, 1, 0);
-INSERT INTO `bb_cron` VALUES (10, 1, 'Prune inactive users', 'prune_inactive_users.php', 'daily', NULL, '05:00:00', 110, '', '', NULL, 1, '', 0, 1, 0);
-INSERT INTO `bb_cron` VALUES (11, 1, 'Sessions cleanup', 'sessions_cleanup.php', 'interval', NULL, NULL, 255, '', '', '00:03:00', 0, '', 0, 0, 0);
-INSERT INTO `bb_cron` VALUES (12, 1, 'DS update ''cat_forums''', 'ds_update_cat_forums.php', 'interval', NULL, NULL, 255, '', '', '00:05:00', 0, '', 0, 0, 0);
-INSERT INTO `bb_cron` VALUES (13, 1, 'DS update ''stats''', 'ds_update_stats.php', 'interval', NULL, NULL, 255, '', '', '00:10:00', 0, '', 0, 0, 0);
-INSERT INTO `bb_cron` VALUES (14, 1, 'Flash topic view', 'flash_topic_view.php', 'interval', NULL, NULL, 255, '', '', '00:10:00', 0, '', 0, 0, 0);
-INSERT INTO `bb_cron` VALUES (15, 1, 'Clean search results', 'clean_search_results.php', 'interval', NULL, NULL, 255, '', '', '00:10:00', 0, '', 0, 0, 0);
-INSERT INTO `bb_cron` VALUES (16, 1, 'Tracker cleanup and dlstat', 'tr_cleanup_and_dlstat.php', 'interval', NULL, NULL, 20, '', '', '00:15:00', 0, '', 0, 0, 0);
-INSERT INTO `bb_cron` VALUES (17, 1, 'Make tracker snapshot', 'tr_make_snapshot.php', 'interval', NULL, NULL, 10, '', '', '00:10:00', 0, '', 0, 0, 0);
-INSERT INTO `bb_cron` VALUES (18, 1, 'Seeder last seen', 'tr_update_seeder_last_seen.php', 'interval', NULL, NULL, 255, '', '', '01:00:00', 0, '', 0, 0, 0);
-INSERT INTO `bb_cron` VALUES (19, 1, 'Captcha', 'captcha_gen_gc.php', 'daily', NULL, '05:00:00', 120, '', '', NULL, 0, '', 0, 0, 0);
-INSERT INTO `bb_cron` VALUES (20, 1, 'Tracker dl-complete count', 'tr_complete_count.php', 'interval', NULL, NULL, 255, '', '', '06:00:00', 0, '', 0, 0, 0);
-INSERT INTO `bb_cron` VALUES (21, 1, 'Cache garbage collector', 'cache_gc.php', 'interval', NULL, NULL, 255, '', '', '00:05:00', 0, '', 0, 0, 0);
-INSERT INTO `bb_cron` VALUES (22, 1, 'Sitemap update', 'sitemap.php', 'daily', NULL, '06:00:00', 30, '', '', NULL, 0, '', 0, 0, 0);
-INSERT INTO `bb_cron` VALUES (23, 1, 'Update forums atom', 'update_forums_atom.php', 'interval', NULL, NULL, 255, '', '', '00:15:00', 0, '', 0, 0, 0);
+INSERT INTO `bb_cron` VALUES (1, 1, 'Attach maintenance', 'attach_maintenance.php', 'daily', NULL, '05:00:00', 40, '', '', NULL, 1, '', 0, 1, 0);
+INSERT INTO `bb_cron` VALUES (2, 1, 'Board maintenance', 'bb_maintenance.php', 'daily', NULL, '05:00:00', 40, '', '', NULL, 1, '', 0, 1, 0);
+INSERT INTO `bb_cron` VALUES (3, 1, 'Prune forums', 'prune_forums.php', 'daily', NULL, '05:00:00', 50, '', '', NULL, 1, '', 0, 1, 0);
+INSERT INTO `bb_cron` VALUES (4, 1, 'Prune topic moved stubs', 'prune_topic_moved.php', 'daily', NULL, '05:00:00', 60, '', '', NULL, 1, '', 0, 1, 0);
+INSERT INTO `bb_cron` VALUES (5, 1, 'Logs cleanup', 'clean_log.php', 'daily', NULL, '05:00:00', 70, '', '', NULL, 1, '', 0, 1, 0);
+INSERT INTO `bb_cron` VALUES (6, 1, 'Tracker maintenance', 'tr_maintenance.php', 'daily', NULL, '05:00:00', 90, '', '', NULL, 1, '', 0, 1, 0);
+INSERT INTO `bb_cron` VALUES (7, 1, 'Clean dlstat', 'clean_dlstat.php', 'daily', NULL, '05:00:00', 100, '', '', NULL, 1, '', 0, 1, 0);
+INSERT INTO `bb_cron` VALUES (8, 1, 'Prune inactive users', 'prune_inactive_users.php', 'daily', NULL, '05:00:00', 110, '', '', NULL, 1, '', 0, 1, 0);
+INSERT INTO `bb_cron` VALUES (9, 1, 'Sessions cleanup', 'sessions_cleanup.php', 'interval', NULL, NULL, 255, '', '', '00:03:00', 0, '', 0, 0, 0);
+INSERT INTO `bb_cron` VALUES (10, 1, 'DS update ''cat_forums''', 'ds_update_cat_forums.php', 'interval', NULL, NULL, 255, '', '', '00:05:00', 0, '', 0, 0, 0);
+INSERT INTO `bb_cron` VALUES (11, 1, 'DS update ''stats''', 'ds_update_stats.php', 'interval', NULL, NULL, 255, '', '', '00:10:00', 0, '', 0, 0, 0);
+INSERT INTO `bb_cron` VALUES (12, 1, 'Flash topic view', 'flash_topic_view.php', 'interval', NULL, NULL, 255, '', '', '00:10:00', 0, '', 0, 0, 0);
+INSERT INTO `bb_cron` VALUES (13, 1, 'Clean search results', 'clean_search_results.php', 'interval', NULL, NULL, 255, '', '', '00:10:00', 0, '', 0, 0, 0);
+INSERT INTO `bb_cron` VALUES (14, 1, 'Tracker cleanup and dlstat', 'tr_cleanup_and_dlstat.php', 'interval', NULL, NULL, 20, '', '', '00:15:00', 0, '', 0, 0, 0);
+INSERT INTO `bb_cron` VALUES (15, 1, 'Make tracker snapshot', 'tr_make_snapshot.php', 'interval', NULL, NULL, 10, '', '', '00:10:00', 0, '', 0, 0, 0);
+INSERT INTO `bb_cron` VALUES (16, 1, 'Seeder last seen', 'tr_update_seeder_last_seen.php', 'interval', NULL, NULL, 255, '', '', '01:00:00', 0, '', 0, 0, 0);
+INSERT INTO `bb_cron` VALUES (17, 1, 'Captcha', 'captcha_gen_gc.php', 'daily', NULL, '05:00:00', 120, '', '', NULL, 0, '', 0, 0, 0);
+INSERT INTO `bb_cron` VALUES (18, 1, 'Tracker dl-complete count', 'tr_complete_count.php', 'interval', NULL, NULL, 255, '', '', '06:00:00', 0, '', 0, 0, 0);
+INSERT INTO `bb_cron` VALUES (19, 1, 'Cache garbage collector', 'cache_gc.php', 'interval', NULL, NULL, 255, '', '', '00:05:00', 0, '', 0, 0, 0);
+INSERT INTO `bb_cron` VALUES (20, 1, 'Sitemap update', 'sitemap.php', 'daily', NULL, '06:00:00', 30, '', '', NULL, 0, '', 0, 0, 0);
+INSERT INTO `bb_cron` VALUES (21, 1, 'Update forums atom', 'update_forums_atom.php', 'interval', NULL, NULL, 255, '', '', '00:15:00', 0, '', 0, 0, 0);
-- --------------------------------------------------------
@@ -868,7 +855,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 +870,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 +930,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 +992,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 +1139,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 +1153,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 0000000000..17b8b19d61
--- /dev/null
+++ b/upgrade/changes.txt
@@ -0,0 +1,20 @@
+Схема изменений начиная с версии 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`;
+DELETE FROM `bb_cron` WHERE `cron_script` = 'site_backup.php';
+DELETE FROM `bb_cron` WHERE `cron_script` = 'db_backup.php';
diff --git a/upload/admin/admin_board.php b/upload/admin/admin_board.php
index fe2e966dd1..a709f7a34f 100644
--- a/upload/admin/admin_board.php
+++ b/upload/admin/admin_board.php
@@ -56,7 +56,6 @@
'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_forums.php b/upload/admin/admin_forums.php
index ce017520f1..eb2c56ae45 100644
--- a/upload/admin/admin_forums.php
+++ b/upload/admin/admin_forums.php
@@ -831,13 +831,11 @@ function get_info ($mode, $id)
case 'category':
$table = BB_CATEGORIES;
$idfield = 'cat_id';
- $namefield = 'cat_title';
break;
case 'forum':
$table = BB_FORUMS;
$idfield = 'forum_id';
- $namefield = 'forum_name';
break;
default:
diff --git a/upload/admin/admin_reports.php b/upload/admin/admin_reports.php
deleted file mode 100644
index 612ae7a902..0000000000
--- 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/attach_mod/posting_attachments.php b/upload/attach_mod/posting_attachments.php
index 60e91d1618..f01bc0cd99 100644
--- a/upload/attach_mod/posting_attachments.php
+++ b/upload/attach_mod/posting_attachments.php
@@ -749,10 +749,7 @@ function display_attachment_bodies()
$s_hidden = '';
$s_hidden .= '';
- $u_rules_id = $forum_id;
-
$template->assign_vars(array(
- 'RULES' => ''. $lang['ALLOWED_EXTENSIONS_AND_SIZES'] .'',
'ADD_ATTACH_HIDDEN_FIELDS' => $s_hidden,
));
@@ -783,12 +780,11 @@ function display_attachment_bodies()
if ($this->add_attachment_body)
{
$template->assign_vars(array(
- 'TPL_ADD_ATTACHMENT' => true,
- 'FILE_COMMENT' => htmlspecialchars($this->file_comment),
- 'FILESIZE' => $attach_config['max_filesize'],
- 'FILENAME' => htmlspecialchars($this->filename),
-
- 'S_FORM_ENCTYPE' => 'enctype="multipart/form-data"',
+ 'TPL_ADD_ATTACHMENT' => true,
+ 'FILE_COMMENT' => htmlspecialchars($this->file_comment),
+ 'FILESIZE' => $attach_config['max_filesize'],
+ 'FILENAME' => htmlspecialchars($this->filename),
+ 'S_FORM_ENCTYPE' => 'enctype="multipart/form-data"',
));
}
@@ -810,13 +806,12 @@ function display_attachment_bodies()
}
$template->assign_block_vars('attach_row', array(
- 'FILE_NAME' => @htmlspecialchars($this->attachment_filename_list[$i]),
- 'ATTACH_FILENAME' => @$this->attachment_list[$i],
- 'FILE_COMMENT' => @htmlspecialchars($this->attachment_comment_list[$i]),
- 'ATTACH_ID' => @$this->attachment_id_list[$i],
-
- 'U_VIEW_ATTACHMENT' => $download_link)
- );
+ 'FILE_NAME' => @htmlspecialchars($this->attachment_filename_list[$i]),
+ 'ATTACH_FILENAME' => @$this->attachment_list[$i],
+ 'FILE_COMMENT' => @htmlspecialchars($this->attachment_comment_list[$i]),
+ 'ATTACH_ID' => @$this->attachment_id_list[$i],
+ 'U_VIEW_ATTACHMENT' => $download_link,
+ ));
// Thumbnail there ? And is the User Admin or Mod ? Then present the 'Delete Thumbnail' Button
if (@intval($this->attachment_thumbnail_list[$i]) == 1 && ((isset($is_auth['auth_mod']) && $is_auth['auth_mod']) || IS_ADMIN))
diff --git a/upload/common.php b/upload/common.php
index 42ca82e411..b30bd090d8 100644
--- a/upload/common.php
+++ b/upload/common.php
@@ -194,14 +194,6 @@ function get_cache_obj ($cache_name)
$this->ref[$cache_name] =& $this->obj[$cache_name];
break;
- case 'eaccelerator':
- if (!isset($this->obj[$cache_name]))
- {
- $this->obj[$cache_name] = new cache_eaccelerator($this->cfg['prefix']);
- }
- $this->ref[$cache_name] =& $this->obj[$cache_name];
- break;
-
case 'apc':
if (!isset($this->obj[$cache_name]))
{
@@ -827,61 +819,6 @@ function is_installed ()
}
}
-class cache_eaccelerator extends cache_common
-{
- var $used = true;
- var $engine = 'eAccelerator';
- var $prefix = null;
-
- function cache_eaccelerator ($prefix = null)
- {
- if (!$this->is_installed())
- {
- die('Error: eAccelerator extension not installed');
- }
- $this->dbg_enabled = sql_dbg_enabled();
- $this->prefix = $prefix;
- }
-
- function get ($name, $get_miss_key_callback = '', $ttl = 0)
- {
- $this->cur_query = "cache->get('$name')";
- $this->debug('start');
- $this->debug('stop');
- $this->cur_query = null;
- $this->num_queries++;
-
- return eaccelerator_get($this->prefix . $name);
- }
-
- function set ($name, $value, $ttl = 0)
- {
- $this->cur_query = "cache->set('$name')";
- $this->debug('start');
- $this->debug('stop');
- $this->cur_query = null;
- $this->num_queries++;
-
- return eaccelerator_put($this->prefix . $name, $value, $ttl);
- }
-
- function rm ($name = '')
- {
- $this->cur_query = "cache->rm('$name')";
- $this->debug('start');
- $this->debug('stop');
- $this->cur_query = null;
- $this->num_queries++;
-
- return eaccelerator_rm($this->prefix . $name);
- }
-
- function is_installed ()
- {
- return function_exists('eaccelerator_get');
- }
-}
-
class cache_apc extends cache_common
{
var $used = true;
@@ -1575,74 +1512,6 @@ function is_installed ()
}
}
-class datastore_eaccelerator extends datastore_common
-{
- var $engine = 'eAccelerator';
- var $prefix = null;
-
- function datastore_eaccelerator ($prefix = null)
- {
- if (!$this->is_installed())
- {
- die('Error: eAccelerator extension not installed');
- }
- $this->dbg_enabled = sql_dbg_enabled();
- $this->prefix = $prefix;
- }
-
- function store ($title, $var)
- {
- $this->data[$title] = $var;
-
- $this->cur_query = "cache->set('$title')";
- $this->debug('start');
- $this->debug('stop');
- $this->cur_query = null;
- $this->num_queries++;
-
- eaccelerator_put($this->prefix . $title, $var);
- }
-
- function clean ()
- {
- foreach ($this->known_items as $title => $script_name)
- {
- $this->cur_query = "cache->rm('$title')";
- $this->debug('start');
- $this->debug('stop');
- $this->cur_query = null;
- $this->num_queries++;
-
- eaccelerator_rm($this->prefix . $title);
- }
- }
-
- function _fetch_from_store ()
- {
- if (!$items = $this->queued_items)
- {
- $src = $this->_debug_find_caller('enqueue');
- trigger_error("Datastore: item '$item' already enqueued [$src]", E_USER_ERROR);
- }
-
- foreach ($items as $item)
- {
- $this->cur_query = "cache->get('$item')";
- $this->debug('start');
- $this->debug('stop');
- $this->cur_query = null;
- $this->num_queries++;
-
- $this->data[$item] = eaccelerator_get($this->prefix . $item);
- }
- }
-
- function is_installed ()
- {
- return function_exists('eaccelerator_get');
- }
-}
-
class datastore_xcache extends datastore_common
{
var $prefix = null;
@@ -1884,10 +1753,6 @@ function _fetch_from_store ()
$datastore = new datastore_redis($bb_cfg['cache']['redis'], $bb_cfg['cache']['prefix']);
break;
- case 'eaccelerator':
- $datastore = new datastore_eaccelerator($bb_cfg['cache']['prefix']);
- break;
-
case 'xcache':
$datastore = new datastore_xcache($bb_cfg['cache']['prefix']);
break;
diff --git a/upload/config.php b/upload/config.php
index 5bd16d8eff..bcc03d31ec 100644
--- a/upload/config.php
+++ b/upload/config.php
@@ -13,7 +13,6 @@
* Server
- Cloudflare
- Script versions
- - Backup script
- GZip
* Tracker
* FAQ url
@@ -71,9 +70,9 @@
$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'] = '07-09-2014';
-$bb_cfg['tp_release_state'] = 'R600';
+$bb_cfg['tp_version'] = '2.1.1';
+$bb_cfg['tp_release_date'] = '11-09-2014';
+$bb_cfg['tp_release_state'] = 'ALPHA';
// Database
$charset = 'utf8';
@@ -120,7 +119,7 @@
'con_required' => true,
);
-// Available cache types: memcache, sqlite, redis, eaccelerator, apc, xcache (default of filecache)
+// Available cache types: memcache, sqlite, redis, apc, xcache (default of filecache)
# name => array( (string) type, (array) cfg )
$bb_cfg['cache']['engines'] = array(
'bb_cache' => array('filecache', array()),
@@ -132,7 +131,7 @@
'bb_poll_data' => array('filecache', array()),
);
// Datastore
-// Available datastore types: memcache, sqlite, redis, eaccelerator, apc, xcache (default filecache)
+// Available datastore types: memcache, sqlite, redis, apc, xcache (default filecache)
$bb_cfg['datastore_type'] = 'filecache';
// Server
@@ -147,12 +146,7 @@
}
// Increase number after changing js or css
-$bb_cfg['js_ver'] = 1;
-$bb_cfg['css_ver'] = 1;
-
-// Backup
-$bb_cfg['db_backup_shell_cmd'] = ''; // '/path/to/db_backup.sh 2>&1'
-$bb_cfg['site_backup_shell_cmd'] = '';
+$bb_cfg['js_ver'] = $bb_cfg['css_ver'] = 1;
// GZip
$bb_cfg['gzip_compress'] = true; // compress output
@@ -606,9 +600,9 @@
$bb_cfg['first_logon_redirect_url'] = 'index.php';
$bb_cfg['terms_and_conditions_url'] = 'terms.php';
-$bb_cfg['user_agreement_url'] = 'misc.php?do=info&show=user_agreement';
-$bb_cfg['copyright_holders_url'] = 'misc.php?do=info&show=copyright_holders';
-$bb_cfg['advert_url'] = 'misc.php?do=info&show=advert';
+$bb_cfg['user_agreement_url'] = 'info.php?show=user_agreement';
+$bb_cfg['copyright_holders_url'] = 'info.php?show=copyright_holders';
+$bb_cfg['advert_url'] = 'info.php?show=advert';
// Captcha
$bb_cfg['captcha'] = array(
diff --git a/upload/includes/cron/jobs/db_backup.php b/upload/includes/cron/jobs/db_backup.php
deleted file mode 100644
index 75b9954700..0000000000
--- a/upload/includes/cron/jobs/db_backup.php
+++ /dev/null
@@ -1,37 +0,0 @@
-from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
- $emailer->replyto($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
-
- $emailer->use_template('blank');
- $emailer->email_address($bb_cfg['tech_admin_email']);
- $emailer->set_subject("DB Backup failed [{$bb_cfg['server_name']}]");
-
- $emailer->assign_vars(array(
- 'MESSAGE' => $cron_runtime_log,
- ));
- $emailer->send();
- $emailer->reset();
-}
-
-sleep(10);
-
-DB()->expect_slow_query(16*60, 100);
\ No newline at end of file
diff --git a/upload/includes/cron/jobs/site_backup.php b/upload/includes/cron/jobs/site_backup.php
deleted file mode 100644
index 6aced5c6bf..0000000000
--- a/upload/includes/cron/jobs/site_backup.php
+++ /dev/null
@@ -1,33 +0,0 @@
-from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
- $emailer->replyto($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
-
- $emailer->use_template('blank');
- $emailer->email_address($bb_cfg['tech_admin_email']);
- $emailer->set_subject("Site Backup failed [{$bb_cfg['server_name']}]");
-
- $emailer->assign_vars(array(
- 'MESSAGE' => $cron_runtime_log,
- ));
- $emailer->send();
- $emailer->reset();
-}
-
-sleep(10);
\ No newline at end of file
diff --git a/upload/includes/functions_report.php b/upload/includes/functions_report.php
deleted file mode 100644
index 448bb3ce32..0000000000
--- 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 a2c71263c3..0000000000
--- 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 c022bd5a32..fd1ad7c66a 100644
--- a/upload/includes/init_bb.php
+++ b/upload/includes/init_bb.php
@@ -3,7 +3,7 @@
if (!defined('BB_ROOT')) die(basename(__FILE__));
if (PHP_VERSION < '5.3') die('TorrentPier II requires PHP version 5.3+. Your PHP version '. PHP_VERSION);
if (!defined('BB_SCRIPT')) define('BB_SCRIPT', 'undefined');
-if (!defined('BB_CFG_LOADED')) trigger_error('bb_cfg not loaded', E_USER_ERROR);
+if (!defined('BB_CFG_LOADED')) trigger_error('File config.php not loaded', E_USER_ERROR);
// Define some basic configuration arrays
unset($stopwords, $synonyms_match, $synonyms_replace);
@@ -168,26 +168,6 @@ function bb_setcookie ($name, $val, $lifetime = COOKIE_PERSIST, $httponly = fals
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 @@ function bb_setcookie ($name, $val, $lifetime = COOKIE_PERSIST, $httponly = fals
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 ff86aa4a58..9055227191 100644
--- a/upload/includes/page_header.php
+++ b/upload/includes/page_header.php
@@ -108,60 +108,6 @@
));
// 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 @@
'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 baa56e5a36..0000000000
--- 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 1e78d7d4ec..0000000000
--- 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 4a4fed1b69..0000000000
--- 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 5892cf7fc3..0000000000
--- 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 dba6bbf60c..0000000000
--- 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 3737379aec..0000000000
--- 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 4cfd47d72b..0000000000
--- 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 626d64c17f..b3d607d3ea 100644
--- a/upload/includes/ucp/viewprofile.php
+++ b/upload/includes/ucp/viewprofile.php
@@ -55,23 +55,6 @@
$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/info.php b/upload/info.php
new file mode 100644
index 0000000000..1234e40f4f
--- /dev/null
+++ b/upload/info.php
@@ -0,0 +1,71 @@
+session_start();
+
+global $lang;
+
+$info = array();
+$html_dir = LANG_DIR . 'html/';
+$req_mode = !empty($_REQUEST['show']) ? (string) $_REQUEST['show'] : 'not_found';
+
+switch ($req_mode)
+{
+ case 'advert':
+ $info['title'] = $lang['ADVERT'];
+ $info['src'] = 'advert.html';
+ break;
+
+ case 'copyright_holders':
+ $info['title'] = $lang['COPYRIGHT_HOLDERS'];
+ $info['src'] = 'copyright_holders.html';
+ break;
+
+ case 'not_found':
+ $info['title'] = $lang['NOT_FOUND'];
+ $info['src'] = 'not_found.html';
+ break;
+
+ case 'user_agreement':
+ $info['title'] = $lang['USER_AGREEMENT'];
+ $info['src'] = 'user_agreement.html';
+ break;
+
+ default:
+ bb_simple_die('Invalid request');
+}
+
+$require = file_exists($html_dir . $info['src']) ? $html_dir . $info['src'] : $html_dir . 'not_found.html';
+
+?>
+
+
File not found
+Файл не найден
+Файл не знайдено
+{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} | -
{L_ATTACH_RULES_TITLE} | -
---|
{L_NOTE_USER_EMPTY_GROUP_PERMISSIONS} | -
- {group_row.GROUP_RULE_HEADER}-- - {group_row.extension_row.EXTENSION} - - - |
-
{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} |
- |||||||||||||||||
- - | -