diff --git a/admin/admin_board.php b/admin/admin_board.php
index 84d7d74c0..c2a534b03 100644
--- a/admin/admin_board.php
+++ b/admin/admin_board.php
@@ -13,7 +13,6 @@ if (!empty($setmodules)) {
return;
}
require __DIR__ . '/pagestart.php';
-require INC_DIR . '/functions_selects.php';
$mode = isset($_GET['mode']) ? $_GET['mode'] : '';
@@ -134,8 +133,8 @@ switch ($mode) {
'POSTS_PER_PAGE' => $new['posts_per_page'],
'HOT_TOPIC' => $new['hot_threshold'],
'DEFAULT_DATEFORMAT' => $new['default_dateformat'],
- 'LANG_SELECT' => language_select($new['default_lang'], 'default_lang'),
- 'TIMEZONE_SELECT' => tz_select($new['board_timezone'], 'board_timezone'),
+ 'LANG_SELECT' => \TorrentPier\Legacy\Select::language($new['default_lang'], 'default_lang'),
+ 'TIMEZONE_SELECT' => \TorrentPier\Legacy\Select::timezone($new['board_timezone'], 'board_timezone'),
'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'],
'LOGIN_RESET_TIME' => $new['login_reset_time'],
'PRUNE_ENABLE' => $new['prune_enable'] ? true : false,
diff --git a/admin/admin_bt_forum_cfg.php b/admin/admin_bt_forum_cfg.php
index 5dd02fc91..d45f5767c 100644
--- a/admin/admin_bt_forum_cfg.php
+++ b/admin/admin_bt_forum_cfg.php
@@ -16,8 +16,6 @@ require __DIR__ . '/pagestart.php';
$max_forum_name_len = 30;
$max_forum_rows = 25;
-require INC_DIR . '/functions_admin_torrent.php';
-
$submit = isset($_POST['submit']);
$confirm = isset($_POST['confirm']);
@@ -78,12 +76,12 @@ $cfg = bb_get_config(BB_CONFIG, true, false);
*/
if ($submit && $confirm) {
foreach ($db_fields_bool as $field_name => $field_def_val) {
- update_table_bool(BB_FORUMS, 'forum_id', $field_name, $field_def_val);
+ \TorrentPier\Legacy\Admin\Torrent::update_table_bool(BB_FORUMS, 'forum_id', $field_name, $field_def_val);
}
- update_config_table(BB_CONFIG, $default_cfg_str, $cfg, 'str');
- update_config_table(BB_CONFIG, $default_cfg_bool, $cfg, 'bool');
- update_config_table(BB_CONFIG, $default_cfg_num, $cfg, 'num');
+ \TorrentPier\Legacy\Admin\Torrent::update_config_table(BB_CONFIG, $default_cfg_str, $cfg, 'str');
+ \TorrentPier\Legacy\Admin\Torrent::update_config_table(BB_CONFIG, $default_cfg_bool, $cfg, 'bool');
+ \TorrentPier\Legacy\Admin\Torrent::update_config_table(BB_CONFIG, $default_cfg_num, $cfg, 'num');
$datastore->update('cat_forums');
@@ -91,16 +89,16 @@ if ($submit && $confirm) {
}
// Set template vars
-set_tpl_vars($default_cfg_str, $cfg);
-set_tpl_vars_lang($default_cfg_str);
+\TorrentPier\Legacy\Admin\Torrent::set_tpl_vars($default_cfg_str, $cfg);
+\TorrentPier\Legacy\Admin\Torrent::set_tpl_vars_lang($default_cfg_str);
-set_tpl_vars_bool($default_cfg_bool, $cfg);
-set_tpl_vars_lang($default_cfg_bool);
+\TorrentPier\Legacy\Admin\Torrent::set_tpl_vars_bool($default_cfg_bool, $cfg);
+\TorrentPier\Legacy\Admin\Torrent::set_tpl_vars_lang($default_cfg_bool);
-set_tpl_vars($default_cfg_num, $cfg);
-set_tpl_vars_lang($default_cfg_num);
+\TorrentPier\Legacy\Admin\Torrent::set_tpl_vars($default_cfg_num, $cfg);
+\TorrentPier\Legacy\Admin\Torrent::set_tpl_vars_lang($default_cfg_num);
-set_tpl_vars_lang($db_fields_bool);
+\TorrentPier\Legacy\Admin\Torrent::set_tpl_vars_lang($db_fields_bool);
// Get Forums list
$sql = 'SELECT f.*
diff --git a/admin/admin_cron.php b/admin/admin_cron.php
index fafd873dc..82c108464 100644
--- a/admin/admin_cron.php
+++ b/admin/admin_cron.php
@@ -33,9 +33,6 @@ if (!IS_SUPER_ADMIN) {
bb_die($lang['NOT_ADMIN']);
}
-require INC_DIR . '/functions_admin_torrent.php';
-require INC_DIR . '/functions_admin_cron.php';
-
$sql = DB()->fetch_rowset('SELECT * FROM ' . BB_CONFIG . " WHERE config_name = 'cron_enabled' OR config_name = 'cron_check_interval'");
foreach ($sql as $row) {
@@ -97,7 +94,7 @@ switch ($mode) {
break;
case 'run':
- run_jobs($job_id);
+ \TorrentPier\Legacy\Admin\Cron::run_jobs($job_id);
redirect('admin/' . basename(__FILE__) . '?mode=list');
break;
@@ -180,7 +177,7 @@ switch ($mode) {
break;
case 'delete':
- delete_jobs($job_id);
+ \TorrentPier\Legacy\Admin\Cron::delete_jobs($job_id);
bb_die($lang['JOB_REMOVED'] . '
' . sprintf($lang['CLICK_RETURN_JOBS'], '', '') . '
' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '', ''));
break;
}
@@ -188,25 +185,25 @@ switch ($mode) {
if ($submit) {
if ($_POST['mode'] == 'list') {
if ($cron_action == 'run' && $jobs) {
- run_jobs($jobs);
+ \TorrentPier\Legacy\Admin\Cron::run_jobs($jobs);
} elseif ($cron_action == 'delete' && $jobs) {
- delete_jobs($jobs);
+ \TorrentPier\Legacy\Admin\Cron::delete_jobs($jobs);
} elseif (($cron_action == 'disable' || $cron_action == 'enable') && $jobs) {
- toggle_active($jobs, $cron_action);
+ \TorrentPier\Legacy\Admin\Cron::toggle_active($jobs, $cron_action);
}
redirect('admin/' . basename(__FILE__) . '?mode=list');
- } elseif (validate_cron_post($_POST) == 1) {
+ } elseif (\TorrentPier\Legacy\Admin\Cron::validate_cron_post($_POST) == 1) {
if ($_POST['mode'] == 'edit') {
- update_cron_job($_POST);
+ \TorrentPier\Legacy\Admin\Cron::update_cron_job($_POST);
} elseif ($_POST['mode'] == 'add') {
- insert_cron_job($_POST);
+ \TorrentPier\Legacy\Admin\Cron::insert_cron_job($_POST);
} else {
bb_die('Mode error');
}
redirect('admin/' . basename(__FILE__) . '?mode=list');
} else {
- bb_die(validate_cron_post($_POST));
+ bb_die(\TorrentPier\Legacy\Admin\Cron::validate_cron_post($_POST));
}
}
diff --git a/admin/admin_disallow.php b/admin/admin_disallow.php
index 9d5f9fcb3..1f969c04d 100644
--- a/admin/admin_disallow.php
+++ b/admin/admin_disallow.php
@@ -16,14 +16,12 @@ require __DIR__ . '/pagestart.php';
$message = '';
if (isset($_POST['add_name'])) {
- include INC_DIR . '/functions_validate.php';
-
$disallowed_user = isset($_POST['disallowed_user']) ? trim($_POST['disallowed_user']) : trim($_GET['disallowed_user']);
if ($disallowed_user == '') {
bb_die($lang['FIELDS_EMPTY']);
}
- if (validate_username($disallowed_user)) {
+ if (\TorrentPier\Legacy\Validate::username($disallowed_user)) {
$message = $lang['DISALLOWED_ALREADY'];
} else {
$sql = 'INSERT INTO ' . BB_DISALLOW . " (disallow_username) VALUES('" . DB()->escape($disallowed_user) . "')";
diff --git a/admin/admin_forum_prune.php b/admin/admin_forum_prune.php
index ce9e46a72..e44824797 100644
--- a/admin/admin_forum_prune.php
+++ b/admin/admin_forum_prune.php
@@ -34,7 +34,7 @@ if (isset($_REQUEST['submit'])) {
$sql = 'SELECT forum_id, forum_name FROM ' . BB_FORUMS . " $where_sql";
foreach (DB()->fetch_rowset($sql) as $i => $row) {
- $pruned_topics = topic_delete('prune', $row['forum_id'], $prunetime, !empty($_POST['prune_all_topic_types']));
+ $pruned_topics = \TorrentPier\Legacy\Admin\Common::topic_delete('prune', $row['forum_id'], $prunetime, !empty($_POST['prune_all_topic_types']));
$pruned_total += $pruned_topics;
$prune_performed = true;
diff --git a/admin/admin_forums.php b/admin/admin_forums.php
index 00ee75004..44c2b678a 100644
--- a/admin/admin_forums.php
+++ b/admin/admin_forums.php
@@ -12,7 +12,6 @@ if (!empty($setmodules)) {
return;
}
require __DIR__ . '/pagestart.php';
-require INC_DIR . '/functions_group.php';
array_deep($_POST, 'trim');
@@ -432,7 +431,7 @@ if ($mode) {
if ($to_id == -1) {
// Delete everything from forum
- topic_delete('prune', $from_id, 0, true);
+ \TorrentPier\Legacy\Admin\Common::topic_delete('prune', $from_id, 0, true);
} else {
// Move all posts
$sql = 'SELECT * FROM ' . BB_FORUMS . " WHERE forum_id IN($from_id, $to_id)";
@@ -461,7 +460,7 @@ if ($mode) {
$start_id += $per_cycle;
}
- sync('forum', $to_id);
+ \TorrentPier\Legacy\Admin\Common::sync('forum', $to_id);
}
DB()->query('DELETE FROM ' . BB_FORUMS . " WHERE forum_id = $from_id");
@@ -470,7 +469,7 @@ if ($mode) {
$cat_forums = get_cat_forums();
fix_orphan_sf();
- update_user_level('all');
+ \TorrentPier\Legacy\Group::update_user_level('all');
$datastore->update('cat_forums');
CACHE('bb_cache')->rm();
@@ -636,7 +635,7 @@ if ($mode) {
break;
case 'forum_sync':
- sync('forum', (int)$_GET['f']);
+ \TorrentPier\Legacy\Admin\Common::sync('forum', (int)$_GET['f']);
$datastore->update('cat_forums');
CACHE('bb_cache')->rm();
diff --git a/admin/admin_groups.php b/admin/admin_groups.php
index ac4b26827..fc27b10c6 100644
--- a/admin/admin_groups.php
+++ b/admin/admin_groups.php
@@ -12,7 +12,6 @@ if (!empty($setmodules)) {
return;
}
require __DIR__ . '/pagestart.php';
-require INC_DIR . '/functions_group.php';
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : 0;
$mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : '';
@@ -21,7 +20,7 @@ attachment_quota_settings('group', isset($_POST['group_update']), $mode);
if (!empty($_POST['edit']) || !empty($_POST['new'])) {
if (!empty($_POST['edit'])) {
- if (!$row = get_group_data($group_id)) {
+ if (!$row = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
bb_die($lang['GROUP_NOT_EXIST']);
}
$group_info = array(
@@ -72,11 +71,11 @@ if (!empty($_POST['edit']) || !empty($_POST['new'])) {
));
} elseif (!empty($_POST['group_update'])) {
if (!empty($_POST['group_delete'])) {
- if (!$group_info = get_group_data($group_id)) {
+ if (!$group_info = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
bb_die($lang['GROUP_NOT_EXIST']);
}
// Delete Group
- delete_group($group_id);
+ \TorrentPier\Legacy\Group::delete_group($group_id);
$message = $lang['DELETED_GROUP'] . '
';
$message .= sprintf($lang['CLICK_RETURN_GROUPSADMIN'], '', '') . '
';
@@ -111,18 +110,18 @@ if (!empty($_POST['edit']) || !empty($_POST['new'])) {
);
if ($mode == 'editgroup') {
- if (!$group_info = get_group_data($group_id)) {
+ if (!$group_info = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
bb_die($lang['GROUP_NOT_EXIST']);
}
if ($group_info['group_moderator'] != $group_moderator) {
// Create user_group for new group's moderator
- add_user_into_group($group_id, $group_moderator);
+ \TorrentPier\Legacy\Group::add_user_into_group($group_id, $group_moderator);
$sql_ary['mod_time'] = TIMENOW;
// Delete old moderator's user_group
if (isset($_POST['delete_old_moderator'])) {
- delete_user_group($group_id, $group_info['group_moderator']);
+ \TorrentPier\Legacy\Group::delete_user_group($group_id, $group_info['group_moderator']);
}
}
@@ -145,7 +144,7 @@ if (!empty($_POST['edit']) || !empty($_POST['new'])) {
$new_group_id = DB()->sql_nextid();
// Create user_group for group's moderator
- add_user_into_group($new_group_id, $group_moderator);
+ \TorrentPier\Legacy\Group::add_user_into_group($new_group_id, $group_moderator);
$message = $lang['ADDED_NEW_GROUP'] . '
';
$message .= sprintf($lang['CLICK_RETURN_GROUPSADMIN'], '', '') . '
';
diff --git a/admin/admin_sitemap.php b/admin/admin_sitemap.php
index 78fe82c48..6bd142f67 100644
--- a/admin/admin_sitemap.php
+++ b/admin/admin_sitemap.php
@@ -12,7 +12,6 @@ if (!empty($setmodules)) {
return;
}
require __DIR__ . '/pagestart.php';
-require INC_DIR . '/functions_selects.php';
$sql = 'SELECT * FROM ' . BB_CONFIG;
diff --git a/admin/admin_ug_auth.php b/admin/admin_ug_auth.php
index fe603d41c..b403c8737 100644
--- a/admin/admin_ug_auth.php
+++ b/admin/admin_ug_auth.php
@@ -16,8 +16,6 @@ require __DIR__ . '/pagestart.php';
$max_forum_name_length = 50;
-require INC_DIR . '/functions_group.php';
-
$yes_sign = '√';
$no_sign = 'x';
@@ -63,7 +61,7 @@ if ($submit && $mode == 'user') {
if ($row = DB()->fetch_row($sql)) {
$group_id = $row['group_id'];
} else {
- $group_id = create_user_group($user_id);
+ $group_id = \TorrentPier\Legacy\Group::create_user_group($user_id);
}
if (!$group_id || !$user_id || null === $this_user_level) {
@@ -80,7 +78,7 @@ if ($submit && $mode == 'user') {
DB()->query('UPDATE ' . BB_USERS . ' SET user_level = ' . ADMIN . " WHERE user_id = $user_id");
// Delete any entries in auth_access, they are not required if user is becoming an admin
- delete_permissions($group_id, $user_id);
+ \TorrentPier\Legacy\Group::delete_permissions($group_id, $user_id);
$message = $lang['AUTH_UPDATED'] . '
';
$message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '', '') . '
';
@@ -96,7 +94,7 @@ if ($submit && $mode == 'user') {
// Update users level, reset to USER
DB()->query('UPDATE ' . BB_USERS . ' SET user_level = ' . USER . " WHERE user_id = $user_id");
- delete_permissions($group_id, $user_id);
+ \TorrentPier\Legacy\Group::delete_permissions($group_id, $user_id);
$message = $lang['AUTH_UPDATED'] . '
';
$message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '', '') . '
';
@@ -121,10 +119,9 @@ if ($submit && $mode == 'user') {
}
}
- delete_permissions($group_id, null, $cat_id);
- store_permissions($group_id, $auth);
-
- update_user_level($user_id);
+ \TorrentPier\Legacy\Group::delete_permissions($group_id, null, $cat_id);
+ \TorrentPier\Legacy\Group::store_permissions($group_id, $auth);
+ \TorrentPier\Legacy\Group::update_user_level($user_id);
$l_auth_return = ($mode == 'user') ? $lang['CLICK_RETURN_USERAUTH'] : $lang['CLICK_RETURN_GROUPAUTH'];
$message = $lang['AUTH_UPDATED'] . '
';
@@ -137,7 +134,7 @@ if ($submit && $mode == 'user') {
// Submit new GROUP permissions
//
elseif ($submit && $mode == 'group' && is_array($_POST['auth'])) {
- if (!$group_data = get_group_data($group_id)) {
+ if (!$group_data = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
bb_die($lang['GROUP_NOT_EXIST']);
}
@@ -150,10 +147,9 @@ elseif ($submit && $mode == 'group' && is_array($_POST['auth'])) {
}
}
- delete_permissions($group_id, null, $cat_id);
- store_permissions($group_id, $auth);
-
- update_user_level('all');
+ \TorrentPier\Legacy\Group::delete_permissions($group_id, null, $cat_id);
+ \TorrentPier\Legacy\Group::store_permissions($group_id, $auth);
+ \TorrentPier\Legacy\Group::update_user_level('all');
$l_auth_return = $lang['CLICK_RETURN_GROUPAUTH'];
$message = $lang['AUTH_UPDATED'] . '
';
@@ -294,7 +290,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
} elseif ($mode == 'group' && $group_id) {
$page_cfg['quirks_mode'] = true;
- if (!$group_data = get_group_data($group_id)) {
+ if (!$group_data = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
bb_die($lang['GROUP_NOT_EXIST']);
}
diff --git a/admin/admin_user_search.php b/admin/admin_user_search.php
index 24181b470..68e799717 100644
--- a/admin/admin_user_search.php
+++ b/admin/admin_user_search.php
@@ -15,8 +15,6 @@ require __DIR__ . '/pagestart.php';
array_deep($_POST, 'trim');
-require INC_DIR . '/functions_selects.php';
-
$total_sql = '';
if (!isset($_REQUEST['dosearch'])) {
@@ -53,8 +51,8 @@ if (!isset($_REQUEST['dosearch'])) {
}
}
- $language_list = language_select('', 'language_type');
- $timezone_list = tz_select('', 'timezone_type');
+ $language_list = \TorrentPier\Legacy\Select::language('', 'language_type');
+ $timezone_list = \TorrentPier\Legacy\Select::timezone('', 'timezone_type');
$sql = 'SELECT f.forum_id, f.forum_name, f.forum_parent, c.cat_id, c.cat_title
FROM ( ' . BB_FORUMS . ' AS f INNER JOIN ' . BB_CATEGORIES . ' AS c ON c.cat_id = f.cat_id )
diff --git a/admin/pagestart.php b/admin/pagestart.php
index 1985e1bf0..ce6079b61 100644
--- a/admin/pagestart.php
+++ b/admin/pagestart.php
@@ -13,7 +13,6 @@ define('IN_ADMIN', true);
require dirname(__DIR__) . '/common.php';
require ATTACH_DIR . '/attachment_mod.php';
require ATTACH_DIR . '/includes/functions_admin.php';
-require_once INC_DIR . '/functions_admin.php';
$user->session_start();
diff --git a/ajax.php b/ajax.php
index ae872c03b..0ff277d1a 100644
--- a/ajax.php
+++ b/ajax.php
@@ -31,14 +31,9 @@ if ($ajax->action != 'manage_admin') {
// Load actions required modules
switch ($ajax->action) {
case 'view_post':
- require INC_DIR . '/bbcode.php';
- break;
-
case 'posts':
case 'post_mod_comment':
require INC_DIR . '/bbcode.php';
- require INC_DIR . '/functions_post.php';
- require INC_DIR . '/functions_admin.php';
break;
case 'view_torrent':
@@ -47,21 +42,6 @@ switch ($ajax->action) {
case 'change_torrent':
case 'gen_passkey':
require ATTACH_DIR . '/attachment_mod.php';
- require INC_DIR . '/functions_torrent.php';
- break;
-
- case 'user_register':
- require INC_DIR . '/functions_validate.php';
- break;
-
- case 'manage_user':
- case 'manage_admin':
- require INC_DIR . '/functions_admin.php';
- break;
-
- case 'group_membership':
- case 'manage_group':
- require INC_DIR . '/functions_group.php';
break;
}
diff --git a/common.php b/common.php
index 0c3dc9664..bec97a86d 100644
--- a/common.php
+++ b/common.php
@@ -343,6 +343,10 @@ function hexhex($value)
return dechex(hexdec($value));
}
+/**
+ * @param string $str
+ * @return string
+ */
function str_compact($str)
{
return preg_replace('#\s+#u', ' ', trim($str));
diff --git a/dl.php b/dl.php
index 6595158a1..6dfec78b2 100644
--- a/dl.php
+++ b/dl.php
@@ -44,8 +44,7 @@ function send_file_to_browser($attachment, $upload_dir)
//bt
if (!(isset($_GET['original']) && !IS_USER)) {
- include INC_DIR . '/functions_torrent.php';
- send_torrent_with_passkey($filename);
+ \TorrentPier\Legacy\Torrent::send_torrent_with_passkey($filename);
}
// Now the tricky part... let's dance
diff --git a/feed.php b/feed.php
index eca121f2e..dd12cd095 100644
--- a/feed.php
+++ b/feed.php
@@ -36,8 +36,7 @@ if ($mode == 'get_feed_url' && ($type == 'f' || $type == 'u') && $id >= 0) {
if (file_exists($bb_cfg['atom']['path'] . '/f/' . $id . '.atom') && filemtime($bb_cfg['atom']['path'] . '/f/' . $id . '.atom') > $timecheck) {
redirect($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
} else {
- require_once INC_DIR . '/functions_atom.php';
- if (update_forum_feed($id, $forum_data)) {
+ if (\TorrentPier\Legacy\Atom::update_forum_feed($id, $forum_data)) {
redirect($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
} else {
bb_simple_die($lang['ATOM_NO_FORUM']);
@@ -55,8 +54,7 @@ if ($mode == 'get_feed_url' && ($type == 'f' || $type == 'u') && $id >= 0) {
if (file_exists($bb_cfg['atom']['path'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') && filemtime($bb_cfg['atom']['path'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') > $timecheck) {
redirect($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
} else {
- require_once INC_DIR . '/functions_atom.php';
- if (update_user_feed($id, $username)) {
+ if (\TorrentPier\Legacy\Atom::update_user_feed($id, $username)) {
redirect($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
} else {
bb_simple_die($lang['ATOM_NO_USER']);
diff --git a/group.php b/group.php
index 5e8dbbc29..81dfb7d15 100644
--- a/group.php
+++ b/group.php
@@ -11,7 +11,6 @@ define('BB_SCRIPT', 'group');
define('BB_ROOT', './');
require __DIR__ . '/common.php';
require INC_DIR . '/bbcode.php';
-require INC_DIR . '/functions_group.php';
$page_cfg['use_tablesorter'] = true;
@@ -59,7 +58,7 @@ $group_info = array();
$is_moderator = false;
if ($group_id) {
- if (!$group_info = get_group_data($group_id)) {
+ if (!$group_info = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
bb_die($lang['GROUP_NOT_EXIST']);
}
if (!$group_info['group_id'] || !$group_info['group_moderator'] || !$group_info['moderator_name']) {
@@ -193,7 +192,7 @@ if (!$group_id) {
bb_die($lang['ALREADY_MEMBER_GROUP']);
}
- add_user_into_group($group_id, $userdata['user_id'], 1, TIMENOW);
+ \TorrentPier\Legacy\Group::add_user_into_group($group_id, $userdata['user_id'], 1, TIMENOW);
if ($bb_cfg['group_send_email']) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
@@ -217,7 +216,7 @@ if (!$group_id) {
set_die_append_msg(false, false, $group_id);
bb_die($lang['GROUP_JOINED']);
} elseif (!empty($_POST['unsub']) || !empty($_POST['unsubpending'])) {
- delete_user_group($group_id, $userdata['user_id']);
+ \TorrentPier\Legacy\Group::delete_user_group($group_id, $userdata['user_id']);
set_die_append_msg(false, false, $group_id);
bb_die($lang['UNSUB_SUCCESS']);
@@ -235,7 +234,7 @@ if (!$group_id) {
bb_die($lang['COULD_NOT_ADD_USER']);
}
- add_user_into_group($group_id, $row['user_id']);
+ \TorrentPier\Legacy\Group::add_user_into_group($group_id, $row['user_id']);
if ($bb_cfg['group_send_email']) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
@@ -274,7 +273,7 @@ if (!$group_id) {
AND group_id = $group_id
");
- update_user_level($sql_in);
+ \TorrentPier\Legacy\Group::update_user_level($sql_in);
} elseif (!empty($_POST['deny']) || !empty($_POST['remove'])) {
DB()->query("
DELETE FROM " . BB_USER_GROUP . "
@@ -283,7 +282,7 @@ if (!$group_id) {
");
if (!empty($_POST['remove'])) {
- update_user_level($sql_in);
+ \TorrentPier\Legacy\Group::update_user_level($sql_in);
}
}
// Email users when they are approved
diff --git a/group_edit.php b/group_edit.php
index 59a71e28b..2c1dc3268 100644
--- a/group_edit.php
+++ b/group_edit.php
@@ -10,7 +10,6 @@
define('BB_SCRIPT', 'group_edit');
define('BB_ROOT', './');
require __DIR__ . '/common.php';
-require INC_DIR . '/functions_group.php';
$page_cfg['include_bbcode_js'] = true;
@@ -24,7 +23,7 @@ $is_moderator = false;
$submit = !empty($_POST['submit']);
if ($group_id) {
- if (!$group_info = get_group_data($group_id)) {
+ if (!$group_info = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
bb_die($lang['GROUP_NOT_EXIST']);
}
if (!$group_info['group_id'] || !$group_info['group_moderator'] || !$group_info['moderator_name']) {
diff --git a/library/ajax/avatar.php b/library/ajax/avatar.php
index 0888e19a8..6a418d891 100644
--- a/library/ajax/avatar.php
+++ b/library/ajax/avatar.php
@@ -36,6 +36,6 @@ switch ($mode) {
DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id");
-cache_rm_user_sessions($user_id);
+\TorrentPier\Legacy\Sessions::cache_rm_user_sessions($user_id);
$this->response['avatar_html'] = $response;
diff --git a/library/ajax/change_tor_status.php b/library/ajax/change_tor_status.php
index 8073d16e9..9c4a8f02d 100644
--- a/library/ajax/change_tor_status.php
+++ b/library/ajax/change_tor_status.php
@@ -83,7 +83,7 @@ switch ($mode) {
}
}
- change_tor_status($attach_id, $new_status);
+ \TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $new_status);
$this->response['status'] = $bb_cfg['tor_icons'][$new_status] . ' ' . $lang['TOR_STATUS_NAME'][$new_status] . ' · ' . profile_url($userdata) . ' · ' . delta_time(TIMENOW) . $lang['TOR_BACK'] . '';
@@ -97,7 +97,7 @@ switch ($mode) {
}
send_pm($tor['poster_id'], $subject, $message, $userdata['user_id']);
- cache_rm_user_sessions($tor['poster_id']);
+ \TorrentPier\Legacy\Sessions::cache_rm_user_sessions($tor['poster_id']);
}
}
break;
@@ -115,7 +115,7 @@ switch ($mode) {
}
send_pm($tor['checked_user_id'], $subject, $message, $userdata['user_id']);
- cache_rm_user_sessions($tor['checked_user_id']);
+ \TorrentPier\Legacy\Sessions::cache_rm_user_sessions($tor['checked_user_id']);
break;
}
diff --git a/library/ajax/change_torrent.php b/library/ajax/change_torrent.php
index 7fd2186bc..b247ca738 100644
--- a/library/ajax/change_torrent.php
+++ b/library/ajax/change_torrent.php
@@ -69,18 +69,18 @@ switch ($type) {
} else {
$tor_type = 0;
}
- change_tor_type($attach_id, $tor_type);
+ \TorrentPier\Legacy\Torrent::change_tor_type($attach_id, $tor_type);
$title = $lang['CHANGE_TOR_TYPE'];
$url = make_url(TOPIC_URL . $torrent['topic_id']);
break;
case 'reg':
- tracker_register($attach_id);
+ \TorrentPier\Legacy\Torrent::tracker_register($attach_id);
$url = (TOPIC_URL . $torrent['topic_id']);
break;
case 'unreg':
- tracker_unregister($attach_id);
+ \TorrentPier\Legacy\Torrent::tracker_unregister($attach_id);
$url = (TOPIC_URL . $torrent['topic_id']);
break;
@@ -88,7 +88,7 @@ switch ($type) {
if (empty($this->request['confirmed'])) {
$this->prompt_for_confirm($lang['DEL_TORRENT']);
}
- delete_torrent($attach_id);
+ \TorrentPier\Legacy\Torrent::delete_torrent($attach_id);
$url = make_url(TOPIC_URL . $torrent['topic_id']);
break;
@@ -96,7 +96,7 @@ switch ($type) {
if (empty($this->request['confirmed'])) {
$this->prompt_for_confirm($lang['DEL_MOVE_TORRENT']);
}
- delete_torrent($attach_id);
+ \TorrentPier\Legacy\Torrent::delete_torrent($attach_id);
$url = make_url("modcp.php?t={$torrent['topic_id']}&mode=move&sid={$userdata['session_id']}");
break;
}
diff --git a/library/ajax/change_user_opt.php b/library/ajax/change_user_opt.php
index 7a516cdf3..dd89f689f 100644
--- a/library/ajax/change_user_opt.php
+++ b/library/ajax/change_user_opt.php
@@ -33,6 +33,6 @@ foreach ($bf['user_opt'] as $opt_name => $opt_bit) {
DB()->query("UPDATE " . BB_USERS . " SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id");
// Удаляем данные из кеша
-cache_rm_user_sessions($user_id);
+\TorrentPier\Legacy\Sessions::cache_rm_user_sessions($user_id);
$this->response['resp_html'] = $lang['SAVED'];
diff --git a/library/ajax/change_user_rank.php b/library/ajax/change_user_rank.php
index 97c198d48..40ee79b39 100644
--- a/library/ajax/change_user_rank.php
+++ b/library/ajax/change_user_rank.php
@@ -26,7 +26,7 @@ if ($rank_id != 0 && !isset($ranks[$rank_id])) {
DB()->query("UPDATE " . BB_USERS . " SET user_rank = $rank_id WHERE user_id = $user_id");
-cache_rm_user_sessions($user_id);
+\TorrentPier\Legacy\Sessions::cache_rm_user_sessions($user_id);
$user_rank = ($rank_id) ? '' . $ranks[$rank_id]['rank_title'] . '' : '';
diff --git a/library/ajax/edit_group_profile.php b/library/ajax/edit_group_profile.php
index e693ad7a2..a23502fa1 100644
--- a/library/ajax/edit_group_profile.php
+++ b/library/ajax/edit_group_profile.php
@@ -13,7 +13,7 @@ if (!defined('IN_AJAX')) {
global $bb_cfg, $userdata, $lang;
-if (!$group_id = (int)$this->request['group_id'] or !$group_info = get_group_data($group_id)) {
+if (!$group_id = (int)$this->request['group_id'] or !$group_info = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
$this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']);
}
if (!$mode = (string)$this->request['mode']) {
diff --git a/library/ajax/edit_user_profile.php b/library/ajax/edit_user_profile.php
index 62caa3db9..62f0f8702 100644
--- a/library/ajax/edit_user_profile.php
+++ b/library/ajax/edit_user_profile.php
@@ -25,18 +25,16 @@ $value = $this->request['value'] = (string)(isset($this->request['value'])) ? $t
switch ($field) {
case 'username':
- require_once INC_DIR . '/functions_validate.php';
$value = clean_username($value);
- if ($err = validate_username($value)) {
+ if ($err = \TorrentPier\Legacy\Validate::username($value)) {
$this->ajax_die(strip_tags($err));
}
$this->response['new_value'] = $this->request['value'];
break;
case 'user_email':
- require_once INC_DIR . '/functions_validate.php';
$value = htmlCHR($value);
- if ($err = validate_email($value)) {
+ if ($err = \TorrentPier\Legacy\Validate::email($value)) {
$this->ajax_die($err);
}
$this->response['new_value'] = $this->request['value'];
@@ -138,8 +136,7 @@ switch ($field) {
$this->response['new_value'] = humn_size($value, null, null, ' ');
if (!$btu = get_bt_userdata($user_id)) {
- require INC_DIR . '/functions_torrent.php';
- generate_passkey($user_id, true);
+ \TorrentPier\Legacy\Torrent::generate_passkey($user_id, true);
$btu = get_bt_userdata($user_id);
}
$btu[$field] = $value;
@@ -147,7 +144,6 @@ switch ($field) {
break;
case 'user_points':
- $value = htmlCHR($value);
$value = (float)str_replace(',', '.', $this->request['value']);
$value = sprintf('%.2f', $value);
$this->response['new_value'] = $value;
@@ -160,6 +156,6 @@ switch ($field) {
$value_sql = DB()->escape($value, true);
DB()->query("UPDATE $table SET $field = $value_sql WHERE user_id = $user_id");
-cache_rm_user_sessions($user_id);
+\TorrentPier\Legacy\Sessions::cache_rm_user_sessions($user_id);
$this->response['edit_id'] = $this->request['edit_id'];
diff --git a/library/ajax/gen_passkey.php b/library/ajax/gen_passkey.php
index 738ea903d..a6a859152 100644
--- a/library/ajax/gen_passkey.php
+++ b/library/ajax/gen_passkey.php
@@ -20,11 +20,11 @@ if ($req_uid == $userdata['user_id'] || IS_ADMIN) {
$this->prompt_for_confirm($lang['BT_GEN_PASSKEY_NEW']);
}
- if (!$passkey = generate_passkey($req_uid, IS_ADMIN)) {
+ if (!$passkey = \TorrentPier\Legacy\Torrent::generate_passkey($req_uid, IS_ADMIN)) {
$this->ajax_die('Could not insert passkey');
}
- tracker_rm_user($req_uid);
+ \TorrentPier\Legacy\Torrent::tracker_rm_user($req_uid);
$this->response['passkey'] = $passkey;
} else {
diff --git a/library/ajax/index_data.php b/library/ajax/index_data.php
index 14f074e9a..cf23fb531 100644
--- a/library/ajax/index_data.php
+++ b/library/ajax/index_data.php
@@ -90,7 +90,7 @@ switch ($mode) {
// Set current user timezone
DB()->query("UPDATE " . BB_USERS . " SET user_timezone = $tz WHERE user_id = " . $userdata['user_id']);
$bb_cfg['board_timezone'] = $tz;
- cache_rm_user_sessions($userdata['user_id']);
+ \TorrentPier\Legacy\Sessions::cache_rm_user_sessions($userdata['user_id']);
}
break;
diff --git a/library/ajax/manage_admin.php b/library/ajax/manage_admin.php
index 35d0506d3..5b5d04691 100644
--- a/library/ajax/manage_admin.php
+++ b/library/ajax/manage_admin.php
@@ -80,9 +80,7 @@ switch ($mode) {
case 'update_user_level':
- require INC_DIR . '/functions_group.php';
-
- update_user_level('all');
+ \TorrentPier\Legacy\Group::update_user_level('all');
$this->response['update_user_level_html'] = '' . $lang['USER_LEVELS_UPDATED'] . '';
@@ -90,8 +88,8 @@ switch ($mode) {
case 'sync_topics':
- sync('topic', 'all');
- sync_all_forums();
+ \TorrentPier\Legacy\Admin\Common::sync('topic', 'all');
+ \TorrentPier\Legacy\Admin\Common::sync_all_forums();
$this->response['sync_topics_html'] = '' . $lang['TOPICS_DATA_SYNCHRONIZED'] . '';
@@ -99,7 +97,7 @@ switch ($mode) {
case 'sync_user_posts':
- sync('user_posts', 'all');
+ \TorrentPier\Legacy\Admin\Common::sync('user_posts', 'all');
$this->response['sync_user_posts_html'] = '' . $lang['USER_POSTS_COUNT_SYNCHRONIZED'] . '';
@@ -107,7 +105,7 @@ switch ($mode) {
case 'unlock_cron':
- TorrentPier\Helpers\CronHelper::enableBoard();
+ \TorrentPier\Helpers\CronHelper::enableBoard();
$this->response['unlock_cron_html'] = '' . $lang['ADMIN_UNLOCKED'] . '';
diff --git a/library/ajax/manage_user.php b/library/ajax/manage_user.php
index 9fc8a73bf..9e71812e4 100644
--- a/library/ajax/manage_user.php
+++ b/library/ajax/manage_user.php
@@ -27,8 +27,8 @@ switch ($mode) {
}
if ($user_id != BOT_UID) {
- delete_user_sessions($user_id);
- user_delete($user_id);
+ \TorrentPier\Legacy\Sessions::delete_user_sessions($user_id);
+ \TorrentPier\Legacy\Admin\Common::user_delete($user_id);
$this->response['info'] = $lang['USER_DELETED'];
} else {
@@ -48,8 +48,8 @@ switch ($mode) {
if (IS_ADMIN) {
$user_topics = DB()->fetch_rowset("SELECT topic_id FROM " . BB_TOPICS . " WHERE topic_poster = $user_id", 'topic_id');
- $deleted_topics = topic_delete($user_topics);
- $deleted_posts = post_delete('user', $user_id);
+ $deleted_topics = \TorrentPier\Legacy\Admin\Common::topic_delete($user_topics);
+ $deleted_posts = \TorrentPier\Legacy\Admin\Common::post_delete('user', $user_id);
$this->response['info'] = $lang['USER_DELETED_POSTS'];
} else {
@@ -68,7 +68,7 @@ switch ($mode) {
}
if (IS_ADMIN) {
- post_delete('user', $user_id);
+ \TorrentPier\Legacy\Admin\Common::post_delete('user', $user_id);
$this->response['info'] = $lang['USER_DELETED_POSTS'];
} else {
@@ -99,7 +99,7 @@ switch ($mode) {
}
DB()->query("UPDATE " . BB_USERS . " SET user_active = '0' WHERE user_id = " . $user_id);
- delete_user_sessions($user_id);
+ \TorrentPier\Legacy\Sessions::delete_user_sessions($user_id);
$this->response['info'] = $lang['USER_ACTIVATE_OFF'];
diff --git a/library/ajax/mod_action.php b/library/ajax/mod_action.php
index 861211cf7..65678250f 100644
--- a/library/ajax/mod_action.php
+++ b/library/ajax/mod_action.php
@@ -28,7 +28,7 @@ switch ($mode) {
$topic_ids = DB()->fetch_rowset("SELECT attach_id FROM " . BB_BT_TORRENTS . " WHERE topic_id IN($topics)", 'attach_id');
foreach ($topic_ids as $attach_id) {
- change_tor_status($attach_id, $status);
+ \TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $status);
}
$this->response['status'] = $bb_cfg['tor_icons'][$status];
$this->response['topics'] = explode(',', $topics);
diff --git a/library/ajax/post_mod_comment.php b/library/ajax/post_mod_comment.php
index 954e29a8a..0ffca2782 100644
--- a/library/ajax/post_mod_comment.php
+++ b/library/ajax/post_mod_comment.php
@@ -43,7 +43,7 @@ if ($mc_type && $post['poster_id'] != $userdata['user_id']) {
$message = sprintf($lang['MC_COMMENT_PM_MSG'], get_username($post['poster_id']), make_url(POST_URL . "$post_id#$post_id"), $lang['MC_COMMENT'][$mc_type]['type'], $mc_text);
send_pm($post['poster_id'], $subject, $message);
- cache_rm_user_sessions($post['poster_id']);
+ \TorrentPier\Legacy\Sessions::cache_rm_user_sessions($post['poster_id']);
}
switch ($mc_type) {
diff --git a/library/ajax/posts.php b/library/ajax/posts.php
index bb2ac8395..077c15103 100644
--- a/library/ajax/posts.php
+++ b/library/ajax/posts.php
@@ -60,7 +60,7 @@ switch ($this->request['type']) {
if (empty($this->request['confirmed'])) {
$this->prompt_for_confirm($lang['CONFIRM_DELETE']);
}
- post_delete($post_id);
+ \TorrentPier\Legacy\Admin\Common::post_delete($post_id);
// Update atom feed
update_atom('topic', (int)$this->request['topic_id']);
@@ -271,7 +271,7 @@ switch ($this->request['type']) {
$post_id = DB()->sql_nextid();
DB()->sql_query("INSERT INTO " . BB_POSTS_TEXT . " (post_id, post_text) VALUES ($post_id, '" . DB()->escape($message) . "')");
- update_post_stats('reply', $post, $post['forum_id'], $topic_id, $post_id, $userdata['user_id']);
+ \TorrentPier\Legacy\Post::update_post_stats('reply', $post, $post['forum_id'], $topic_id, $post_id, $userdata['user_id']);
$s_message = str_replace('\n', "\n", $message);
$s_topic_title = str_replace('\n', "\n", $post['topic_title']);
@@ -283,7 +283,7 @@ switch ($this->request['type']) {
if ($bb_cfg['topic_notify_enabled']) {
$notify = !empty($this->request['notify']);
- user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
+ \TorrentPier\Legacy\Post::user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
}
// Update atom feed
diff --git a/library/ajax/user_register.php b/library/ajax/user_register.php
index 6e6bdef10..9c3bc99b9 100644
--- a/library/ajax/user_register.php
+++ b/library/ajax/user_register.php
@@ -22,7 +22,7 @@ switch ($mode) {
if (empty($username)) {
$html = ' ' . $lang['CHOOSE_A_NAME'] . '';
- } elseif ($err = validate_username($username)) {
+ } elseif ($err = \TorrentPier\Legacy\Validate::username($username)) {
$html = '
' . $err . '';
}
break;
@@ -32,7 +32,7 @@ switch ($mode) {
if (empty($email)) {
$html = '
' . $lang['CHOOSE_E_MAIL'] . '';
- } elseif ($err = validate_email($email)) {
+ } elseif ($err = \TorrentPier\Legacy\Validate::email($email)) {
$html = '
' . $err . '';
}
break;
diff --git a/library/config.php b/library/config.php
index 118e3a6ef..708d011d2 100644
--- a/library/config.php
+++ b/library/config.php
@@ -367,7 +367,8 @@ $bb_cfg['last_visit_update_intrv'] = 3600; // sec
$bb_cfg['invalid_logins'] = 5; // Количество неверных попыток ввода пароля, перед выводом проверки капчей
$bb_cfg['new_user_reg_disabled'] = false; // Запретить регистрацию новых учетных записей
$bb_cfg['unique_ip'] = false; // Запретить регистрацию нескольких учетных записей с одного ip
-$bb_cfg['new_user_reg_restricted'] = false; // Ограничить регистрацию новых пользователей по времени с 01:00 до 17:00
+$bb_cfg['new_user_reg_restricted'] = false; // Ограничить регистрацию новых пользователей по времени по указанному ниже интервалу
+$bb_cfg['new_user_reg_interval'] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]; // Допустимые часы регистрации
$bb_cfg['reg_email_activation'] = true; // Требовать активацию учетной записи по email
// Email
diff --git a/library/defines.php b/library/defines.php
index 971afb4f1..556db87fd 100644
--- a/library/defines.php
+++ b/library/defines.php
@@ -97,9 +97,14 @@ define('TOR_TMP', 10); // временная
define('TOR_PREMOD', 11); // премодерация
define('TOR_REPLENISH', 12); // пополняемая
+// Cron
define('CRON_LOG_ENABLED', true); // global ON/OFF
define('CRON_FORCE_LOG', false); // always log regardless of job settings
define('CRON_DIR', INC_DIR . '/cron/');
define('CRON_JOB_DIR', CRON_DIR . 'jobs/');
define('CRON_LOG_DIR', 'cron'); // inside LOG_DIR
define('CRON_LOG_FILE', 'cron'); // without ext
+
+// Session variables
+define('ONLY_NEW_POSTS', 1);
+define('ONLY_NEW_TOPICS', 2);
diff --git a/library/includes/cron/jobs/board_maintenance.php b/library/includes/cron/jobs/board_maintenance.php
index 707e7e41b..72a67d563 100644
--- a/library/includes/cron/jobs/board_maintenance.php
+++ b/library/includes/cron/jobs/board_maintenance.php
@@ -11,12 +11,10 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-require_once INC_DIR . '/functions_admin.php';
-
// Синхронизация
-sync('topic', 'all');
-sync('user_posts', 'all');
-sync_all_forums();
+\TorrentPier\Legacy\Admin\Common::sync('topic', 'all');
+\TorrentPier\Legacy\Admin\Common::sync('user_posts', 'all');
+\TorrentPier\Legacy\Admin\Common::sync_all_forums();
// Чистка bb_poll_users
if ($poll_max_days = (int)$bb_cfg['poll_max_days']) {
diff --git a/library/includes/cron/jobs/prune_forums.php b/library/includes/cron/jobs/prune_forums.php
index 73bdce80b..0b12b6707 100644
--- a/library/includes/cron/jobs/prune_forums.php
+++ b/library/includes/cron/jobs/prune_forums.php
@@ -11,12 +11,10 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-require_once INC_DIR . '/functions_admin.php';
-
if ($bb_cfg['prune_enable']) {
$sql = "SELECT forum_id, prune_days FROM " . BB_FORUMS . " WHERE prune_days != 0";
foreach (DB()->fetch_rowset($sql) as $row) {
- topic_delete('prune', $row['forum_id'], (TIMENOW - 86400 * $row['prune_days']));
+ \TorrentPier\Legacy\Admin\Common::topic_delete('prune', $row['forum_id'], (TIMENOW - 86400 * $row['prune_days']));
}
}
diff --git a/library/includes/cron/jobs/prune_inactive_users.php b/library/includes/cron/jobs/prune_inactive_users.php
index ef4f420e0..e69bcfa40 100644
--- a/library/includes/cron/jobs/prune_inactive_users.php
+++ b/library/includes/cron/jobs/prune_inactive_users.php
@@ -11,8 +11,6 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-require_once INC_DIR . '/functions_admin.php';
-
$users_per_cycle = 1000;
while (true) {
@@ -48,7 +46,7 @@ while (true) {
}
if ($prune_users = $not_activated_users + $not_active_users) {
- user_delete($prune_users);
+ \TorrentPier\Legacy\Admin\Common::user_delete($prune_users);
}
if (count($prune_users) < $users_per_cycle) {
diff --git a/library/includes/cron/jobs/update_forums_atom.php b/library/includes/cron/jobs/update_forums_atom.php
index e72283192..a0d7f64bf 100644
--- a/library/includes/cron/jobs/update_forums_atom.php
+++ b/library/includes/cron/jobs/update_forums_atom.php
@@ -13,25 +13,23 @@ if (!defined('BB_ROOT')) {
global $bb_cfg;
-require_once INC_DIR . '/functions_atom.php';
-
$timecheck = TIMENOW - 600;
$forums_data = DB()->fetch_rowset("SELECT forum_id, allow_reg_tracker, forum_name FROM " . BB_FORUMS);
if (file_exists($bb_cfg['atom']['path'] . '/f/0.atom')) {
if (filemtime($bb_cfg['atom']['path'] . '/f/0.atom') <= $timecheck) {
- update_forum_feed(0, $forums_data);
+ \TorrentPier\Legacy\Atom::update_forum_feed(0, $forums_data);
}
} else {
- update_forum_feed(0, $forums_data);
+ \TorrentPier\Legacy\Atom::update_forum_feed(0, $forums_data);
}
foreach ($forums_data as $forum_data) {
if (file_exists($bb_cfg['atom']['path'] . '/f/' . $forum_data['forum_id'] . '.atom')) {
if (filemtime($bb_cfg['atom']['path'] . '/f/' . $forum_data['forum_id'] . '.atom') <= $timecheck) {
- update_forum_feed($forum_data['forum_id'], $forum_data);
+ \TorrentPier\Legacy\Atom::update_forum_feed($forum_data['forum_id'], $forum_data);
}
} else {
- update_forum_feed($forum_data['forum_id'], $forum_data);
+ \TorrentPier\Legacy\Atom::update_forum_feed($forum_data['forum_id'], $forum_data);
}
}
diff --git a/library/includes/functions.php b/library/includes/functions.php
index 7e9939d19..21b5f5f2d 100644
--- a/library/includes/functions.php
+++ b/library/includes/functions.php
@@ -1335,7 +1335,7 @@ function bb_die($msg_text)
// If empty session
if (empty($userdata)) {
- $userdata = session_pagestart();
+ $userdata = \TorrentPier\Legacy\Sessions::session_pagestart();
}
// If the header hasn't been output then do it
@@ -2081,16 +2081,14 @@ function is_gold($type)
function update_atom($type, $id)
{
- require_once INC_DIR . '/functions_atom.php';
-
switch ($type) {
case 'user':
- update_user_feed($id, get_username($id));
+ \TorrentPier\Legacy\Atom::update_user_feed($id, get_username($id));
break;
case 'topic':
$topic_poster = (int)DB()->fetch_row("SELECT topic_poster FROM " . BB_TOPICS . " WHERE topic_id = $id LIMIT 1", 'topic_poster');
- update_user_feed($topic_poster, get_username($topic_poster));
+ \TorrentPier\Legacy\Atom::update_user_feed($topic_poster, get_username($topic_poster));
break;
}
}
diff --git a/library/includes/functions_admin.php b/library/includes/functions_admin.php
deleted file mode 100644
index e50dd104d..000000000
--- a/library/includes/functions_admin.php
+++ /dev/null
@@ -1,749 +0,0 @@
-fetch_rowset("SELECT forum_id FROM " . BB_FORUMS) as $row) {
- sync('forum', $row['forum_id']);
- }
-}
-
-function sync($type, $id)
-{
- switch ($type) {
- case 'forum':
-
- if (!$forum_csv = get_id_csv($id)) {
- break;
- }
- // sync posts
- $tmp_sync_forums = 'tmp_sync_forums';
-
- DB()->query("
- CREATE TEMPORARY TABLE $tmp_sync_forums (
- forum_id SMALLINT UNSIGNED NOT NULL DEFAULT '0',
- forum_last_post_id INT UNSIGNED NOT NULL DEFAULT '0',
- forum_posts MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
- forum_topics MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
- PRIMARY KEY (forum_id)
- ) ENGINE = MEMORY
- ");
- DB()->add_shutdown_query("DROP TEMPORARY TABLE IF EXISTS $tmp_sync_forums");
-
- // начальное обнуление значений
- $forum_ary = explode(',', $forum_csv);
- DB()->query("REPLACE INTO $tmp_sync_forums (forum_id) VALUES(" . implode('),(', $forum_ary) . ")");
-
- DB()->query("
- REPLACE INTO $tmp_sync_forums
- (forum_id, forum_last_post_id, forum_posts, forum_topics)
- SELECT
- forum_id,
- MAX(topic_last_post_id),
- SUM(topic_replies) + COUNT(topic_id),
- COUNT(topic_id)
- FROM " . BB_TOPICS . "
- WHERE forum_id IN($forum_csv)
- GROUP BY forum_id
- ");
-
- DB()->query("
- UPDATE
- $tmp_sync_forums tmp, " . BB_FORUMS . " f
- SET
- f.forum_last_post_id = tmp.forum_last_post_id,
- f.forum_posts = tmp.forum_posts,
- f.forum_topics = tmp.forum_topics
- WHERE
- f.forum_id = tmp.forum_id
- ");
-
- DB()->query("DROP TEMPORARY TABLE $tmp_sync_forums");
-
- break;
-
- case 'topic':
-
- $all_topics = ($id === 'all');
-
- if (!$all_topics and !$topic_csv = get_id_csv($id)) {
- break;
- }
-
- // Проверка на остаточные записи об уже удаленных топиках
- DB()->query("DELETE FROM " . BB_TOPICS . " WHERE topic_first_post_id NOT IN (SELECT post_id FROM " . BB_POSTS . ")");
-
- $tmp_sync_topics = 'tmp_sync_topics';
-
- DB()->query("
- CREATE TEMPORARY TABLE $tmp_sync_topics (
- topic_id INT UNSIGNED NOT NULL DEFAULT '0',
- total_posts INT UNSIGNED NOT NULL DEFAULT '0',
- topic_first_post_id INT UNSIGNED NOT NULL DEFAULT '0',
- topic_last_post_id INT UNSIGNED NOT NULL DEFAULT '0',
- topic_last_post_time INT UNSIGNED NOT NULL DEFAULT '0',
- topic_attachment INT UNSIGNED NOT NULL DEFAULT '0',
- PRIMARY KEY (topic_id)
- ) ENGINE = MEMORY
- ");
- DB()->add_shutdown_query("DROP TEMPORARY TABLE IF EXISTS $tmp_sync_topics");
-
- $where_sql = (!$all_topics) ? "AND t.topic_id IN($topic_csv)" : '';
-
- DB()->query("
- INSERT INTO $tmp_sync_topics
- SELECT
- t.topic_id,
- COUNT(p.post_id) AS total_posts,
- MIN(p.post_id) AS topic_first_post_id,
- MAX(p.post_id) AS topic_last_post_id,
- MAX(p.post_time) AS topic_last_post_time,
- IF(MAX(a.attach_id), 1, 0) AS topic_attachment
- FROM " . BB_TOPICS . " t
- LEFT JOIN " . BB_POSTS . " p ON(p.topic_id = t.topic_id)
- LEFT JOIN " . BB_ATTACHMENTS . " a ON(a.post_id = p.post_id)
- WHERE t.topic_status != " . TOPIC_MOVED . "
- $where_sql
- GROUP BY t.topic_id
- ");
-
- DB()->query("
- UPDATE
- $tmp_sync_topics tmp, " . BB_TOPICS . " t
- SET
- t.topic_replies = tmp.total_posts - 1,
- t.topic_first_post_id = tmp.topic_first_post_id,
- t.topic_last_post_id = tmp.topic_last_post_id,
- t.topic_last_post_time = tmp.topic_last_post_time,
- t.topic_attachment = tmp.topic_attachment
- WHERE
- t.topic_id = tmp.topic_id
- ");
-
- if ($topics = DB()->fetch_rowset("SELECT topic_id FROM " . $tmp_sync_topics . " WHERE total_posts = 0", 'topic_id')) {
- topic_delete($topics);
- }
-
- DB()->query("DROP TEMPORARY TABLE $tmp_sync_topics");
-
- break;
-
- case 'user_posts':
-
- $all_users = ($id === 'all');
-
- if (!$all_users and !$user_csv = get_id_csv($id)) {
- break;
- }
-
- $tmp_user_posts = 'tmp_sync_user_posts';
-
- DB()->query("
- CREATE TEMPORARY TABLE $tmp_user_posts (
- user_id INT NOT NULL DEFAULT '0',
- user_posts MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
- PRIMARY KEY (user_id)
- ) ENGINE = MEMORY
- ");
- DB()->add_shutdown_query("DROP TEMPORARY TABLE IF EXISTS $tmp_user_posts");
-
- // Set posts count = 0 and then update to real count
- $where_user_sql = (!$all_users) ? "AND user_id IN($user_csv)" : "AND user_posts != 0";
- $where_post_sql = (!$all_users) ? "AND poster_id IN($user_csv)" : '';
-
- DB()->query("
- REPLACE INTO $tmp_user_posts
- SELECT user_id, 0
- FROM " . BB_USERS . "
- WHERE user_id != " . GUEST_UID . "
- $where_user_sql
- UNION
- SELECT poster_id, COUNT(*)
- FROM " . BB_POSTS . "
- WHERE poster_id != " . GUEST_UID . "
- $where_post_sql
- GROUP BY poster_id
- ");
-
- DB()->query("
- UPDATE
- $tmp_user_posts tmp, " . BB_USERS . " u
- SET
- u.user_posts = tmp.user_posts
- WHERE
- u.user_id = tmp.user_id
- ");
-
- DB()->query("DROP TEMPORARY TABLE $tmp_user_posts");
-
- break;
- }
-}
-
-function topic_delete($mode_or_topic_id, $forum_id = null, $prune_time = 0, $prune_all = false)
-{
- global $lang, $log_action;
-
- $prune = ($mode_or_topic_id === 'prune');
-
- if (!$prune and !$topic_csv = get_id_csv($mode_or_topic_id)) {
- return false;
- }
-
- $log_topics = $sync_forums = array();
-
- if ($prune) {
- $sync_forums[$forum_id] = true;
- } else {
- $where_sql = ($forum_csv = get_id_csv($forum_id)) ? "AND forum_id IN($forum_csv)" : '';
-
- $sql = "
- SELECT topic_id, forum_id, topic_title, topic_status
- FROM " . BB_TOPICS . "
- WHERE topic_id IN($topic_csv)
- $where_sql
- ";
-
- $topic_csv = array();
-
- foreach (DB()->fetch_rowset($sql) as $row) {
- $topic_csv[] = $row['topic_id'];
- $log_topics[] = $row;
- $sync_forums[$row['forum_id']] = true;
- }
-
- if (!$topic_csv = get_id_csv($topic_csv)) {
- return false;
- }
- }
-
- // Get topics to delete
- $tmp_delete_topics = 'tmp_delete_topics';
-
- DB()->query("
- CREATE TEMPORARY TABLE $tmp_delete_topics (
- topic_id INT UNSIGNED NOT NULL DEFAULT '0',
- PRIMARY KEY (topic_id)
- ) ENGINE = MEMORY
- ");
- DB()->add_shutdown_query("DROP TEMPORARY TABLE IF EXISTS $tmp_delete_topics");
-
- $where_sql = ($prune) ? "forum_id = $forum_id" : "topic_id IN($topic_csv)";
- $where_sql .= ($prune && $prune_time) ? " AND topic_last_post_time < $prune_time" : '';
- $where_sql .= ($prune && !$prune_all) ? " AND topic_type NOT IN(" . POST_ANNOUNCE . "," . POST_STICKY . ")" : '';
-
- DB()->query("INSERT INTO $tmp_delete_topics SELECT topic_id FROM " . BB_TOPICS . " WHERE $where_sql");
-
- // Get topics count
- $row = DB()->fetch_row("SELECT COUNT(*) AS topics_count FROM $tmp_delete_topics");
-
- if (!$deleted_topics_count = $row['topics_count']) {
- DB()->query("DROP TEMPORARY TABLE $tmp_delete_topics");
- return 0;
- }
-
- // Update user posts count
- $tmp_user_posts = 'tmp_user_posts';
-
- DB()->query("
- CREATE TEMPORARY TABLE $tmp_user_posts (
- user_id INT NOT NULL DEFAULT '0',
- user_posts MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
- PRIMARY KEY (user_id)
- ) ENGINE = MEMORY
- ");
- DB()->add_shutdown_query("DROP TEMPORARY TABLE IF EXISTS $tmp_user_posts");
-
- DB()->query("
- INSERT INTO $tmp_user_posts
- SELECT p.poster_id, COUNT(p.post_id)
- FROM " . $tmp_delete_topics . " del, " . BB_POSTS . " p
- WHERE p.topic_id = del.topic_id
- AND p.poster_id != " . GUEST_UID . "
- GROUP BY p.poster_id
- ");
-
- // Get array for atom update
- $atom_csv = array();
- foreach (DB()->fetch_rowset('SELECT user_id FROM ' . $tmp_user_posts) as $at) {
- $atom_csv[] = $at['user_id'];
- }
-
- DB()->query("
- UPDATE
- $tmp_user_posts tmp, " . BB_USERS . " u
- SET
- u.user_posts = u.user_posts - tmp.user_posts
- WHERE
- u.user_id = tmp.user_id
- ");
-
- DB()->query("DROP TEMPORARY TABLE $tmp_user_posts");
-
- // Delete votes
- DB()->query("
- DELETE pv, pu
- FROM " . $tmp_delete_topics . " del
- LEFT JOIN " . BB_POLL_VOTES . " pv USING(topic_id)
- LEFT JOIN " . BB_POLL_USERS . " pu USING(topic_id)
- ");
-
- // Delete attachments (from disk)
- $attach_dir = get_attachments_dir();
-
- $result = DB()->query("
- SELECT
- d.physical_filename
- FROM
- " . $tmp_delete_topics . " del,
- " . BB_POSTS . " p,
- " . BB_ATTACHMENTS . " a,
- " . BB_ATTACHMENTS_DESC . " d
- WHERE
- p.topic_id = del.topic_id
- AND a.post_id = p.post_id
- AND d.attach_id = a.attach_id
- ");
-
- while ($row = DB()->fetch_next($result)) {
- if ($filename = basename($row['physical_filename'])) {
- @unlink("$attach_dir/" . $filename);
- @unlink("$attach_dir/" . THUMB_DIR . '/t_' . $filename);
- }
- }
- unset($row, $result);
-
- // Delete posts, posts_text, attachments (from DB)
- DB()->query("
- DELETE p, pt, ps, a, d, ph
- FROM " . $tmp_delete_topics . " del
- LEFT JOIN " . BB_POSTS . " p ON(p.topic_id = del.topic_id)
- LEFT JOIN " . BB_POSTS_TEXT . " pt ON(pt.post_id = p.post_id)
- LEFT JOIN " . BB_POSTS_HTML . " ph ON(ph.post_id = p.post_id)
- LEFT JOIN " . BB_POSTS_SEARCH . " ps ON(ps.post_id = p.post_id)
- LEFT JOIN " . BB_ATTACHMENTS . " a ON(a.post_id = p.post_id)
- LEFT JOIN " . BB_ATTACHMENTS_DESC . " d ON(d.attach_id = a.attach_id)
- ");
-
- // Delete topics, topics watch
- DB()->query("
- DELETE t, tw
- FROM " . $tmp_delete_topics . " del
- LEFT JOIN " . BB_TOPICS . " t USING(topic_id)
- LEFT JOIN " . BB_TOPICS_WATCH . " tw USING(topic_id)
- ");
-
- // Delete topic moved stubs
- DB()->query("
- DELETE t
- FROM " . $tmp_delete_topics . " del, " . BB_TOPICS . " t
- WHERE t.topic_moved_id = del.topic_id
- ");
-
- // Delete torrents
- DB()->query("
- DELETE tor, tr, dl
- FROM " . $tmp_delete_topics . " del
- LEFT JOIN " . BB_BT_TORRENTS . " tor USING(topic_id)
- LEFT JOIN " . BB_BT_TRACKER . " tr USING(topic_id)
- LEFT JOIN " . BB_BT_DLSTATUS . " dl USING(topic_id)
- ");
-
- // Log action
- if ($prune) {
- // TODO
- } else {
- foreach ($log_topics as $row) {
- if ($row['topic_status'] == TOPIC_MOVED) {
- $row['topic_title'] = '' . $lang['TOPIC_MOVED'] . ' ' . $row['topic_title'];
- }
-
- $log_action->mod('mod_topic_delete', array(
- 'forum_id' => $row['forum_id'],
- 'topic_id' => $row['topic_id'],
- 'topic_title' => $row['topic_title'],
- ));
- }
- }
-
- // Sync
- sync('forum', array_keys($sync_forums));
-
- // Update atom feed
- foreach ($atom_csv as $atom) {
- update_atom('user', $atom);
- }
-
- DB()->query("DROP TEMPORARY TABLE $tmp_delete_topics");
-
- return $deleted_topics_count;
-}
-
-function topic_move($topic_id, $to_forum_id, $from_forum_id = null, $leave_shadow = false, $insert_bot_msg = false)
-{
- global $log_action;
-
- $to_forum_id = (int)$to_forum_id;
-
- // Verify input params
- if (!$topic_csv = get_id_csv($topic_id)) {
- return false;
- }
- if (!forum_exists($to_forum_id)) {
- return false;
- }
- if ($from_forum_id && (!forum_exists($from_forum_id) || $to_forum_id == $from_forum_id)) {
- return false;
- }
-
- // Get topics info
- $where_sql = ($forum_csv = get_id_csv($from_forum_id)) ? "AND forum_id IN($forum_csv)" : '';
-
- $sql = "SELECT * FROM " . BB_TOPICS . " WHERE topic_id IN($topic_csv) AND topic_status != " . TOPIC_MOVED . " $where_sql";
-
- $topics = array();
- $sync_forums = array($to_forum_id => true);
-
- foreach (DB()->fetch_rowset($sql) as $row) {
- if ($row['forum_id'] != $to_forum_id) {
- $topics[$row['topic_id']] = $row;
- $sync_forums[$row['forum_id']] = true;
- }
- }
-
- if (!$topics or !$topic_csv = get_id_csv(array_keys($topics))) {
- return false;
- }
-
- // Insert topic in the old forum that indicates that the topic has moved
- if ($leave_shadow) {
- $shadows = array();
-
- foreach ($topics as $topic_id => $row) {
- $shadows[] = array(
- 'forum_id' => $row['forum_id'],
- 'topic_title' => $row['topic_title'],
- 'topic_poster' => $row['topic_poster'],
- 'topic_time' => TIMENOW,
- 'topic_status' => TOPIC_MOVED,
- 'topic_type' => POST_NORMAL,
- 'topic_vote' => $row['topic_vote'],
- 'topic_views' => $row['topic_views'],
- 'topic_replies' => $row['topic_replies'],
- 'topic_first_post_id' => $row['topic_first_post_id'],
- 'topic_last_post_id' => $row['topic_last_post_id'],
- 'topic_moved_id' => $topic_id,
- 'topic_last_post_time' => $row['topic_last_post_time'],
- );
- }
- if ($sql_args = DB()->build_array('MULTI_INSERT', $shadows)) {
- DB()->query("INSERT INTO " . BB_TOPICS . $sql_args);
- }
- }
-
- DB()->query("UPDATE " . BB_TOPICS . " SET forum_id = $to_forum_id WHERE topic_id IN($topic_csv)");
- DB()->query("UPDATE " . BB_POSTS . " SET forum_id = $to_forum_id WHERE topic_id IN($topic_csv)");
- DB()->query("UPDATE " . BB_BT_TORRENTS . " SET forum_id = $to_forum_id WHERE topic_id IN($topic_csv)");
-
- // Bot
- if ($insert_bot_msg) {
- foreach ($topics as $topic_id => $row) {
- insert_post('after_move', $topic_id, $to_forum_id, $row['forum_id']);
- }
- sync('topic', array_keys($topics));
- }
-
- // Sync
- sync('forum', array_keys($sync_forums));
-
- // Log action
- foreach ($topics as $topic_id => $row) {
- $log_action->mod('mod_topic_move', array(
- 'forum_id' => $row['forum_id'],
- 'forum_id_new' => $to_forum_id,
- 'topic_id' => $topic_id,
- 'topic_title' => $row['topic_title'],
- ));
- }
-
- return true;
-}
-
-// $exclude_first - в режиме удаления сообщений по списку исключать первое сообщение в теме
-function post_delete($mode_or_post_id, $user_id = null, $exclude_first = true)
-{
- global $log_action;
-
- $del_user_posts = ($mode_or_post_id === 'user'); // Delete all user posts
-
- // Get required params
- if ($del_user_posts) {
- if (!$user_csv = get_id_csv($user_id)) {
- return false;
- }
- } else {
- if (!$post_csv = get_id_csv($mode_or_post_id)) {
- return false;
- }
-
- // фильтр заглавных сообщений в теме
- if ($exclude_first) {
- $sql = "SELECT topic_first_post_id FROM " . BB_TOPICS . " WHERE topic_first_post_id IN($post_csv)";
-
- if ($first_posts = DB()->fetch_rowset($sql, 'topic_first_post_id')) {
- $posts_without_first = array_diff(explode(',', $post_csv), $first_posts);
-
- if (!$post_csv = get_id_csv($posts_without_first)) {
- return false;
- }
- }
- }
- }
-
- // Collect data for logs, sync..
- $log_topics = $sync_forums = $sync_topics = $sync_users = array();
-
- if ($del_user_posts) {
- $sync_topics = DB()->fetch_rowset("SELECT DISTINCT topic_id FROM " . BB_POSTS . " WHERE poster_id IN($user_csv)", 'topic_id');
-
- if ($topic_csv = get_id_csv($sync_topics)) {
- foreach (DB()->fetch_rowset("SELECT DISTINCT forum_id FROM " . BB_TOPICS . " WHERE topic_id IN($topic_csv)") as $row) {
- $sync_forums[$row['forum_id']] = true;
- }
- }
- $sync_users = explode(',', $user_csv);
- } else {
- $sql = "
- SELECT p.topic_id, p.forum_id, t.topic_title
- FROM " . BB_POSTS . " p, " . BB_TOPICS . " t
- WHERE p.post_id IN($post_csv)
- AND t.topic_id = p.topic_id
- GROUP BY t.topic_id
- ";
-
- foreach (DB()->fetch_rowset($sql) as $row) {
- $log_topics[] = $row;
- $sync_topics[] = $row['topic_id'];
- $sync_forums[$row['forum_id']] = true;
- }
-
- $sync_users = DB()->fetch_rowset("SELECT DISTINCT poster_id FROM " . BB_POSTS . " WHERE post_id IN($post_csv)", 'poster_id');
- }
-
- // Get all post_id for deleting
- $tmp_delete_posts = 'tmp_delete_posts';
-
- DB()->query("
- CREATE TEMPORARY TABLE $tmp_delete_posts (
- post_id INT UNSIGNED NOT NULL DEFAULT '0',
- PRIMARY KEY (post_id)
- ) ENGINE = MEMORY
- ");
- DB()->add_shutdown_query("DROP TEMPORARY TABLE IF EXISTS $tmp_delete_posts");
-
- if ($del_user_posts) {
- $where_sql = "poster_id IN($user_csv)";
-
- $exclude_posts_ary = array();
- foreach (DB()->fetch_rowset("SELECT topic_first_post_id FROM " . BB_TOPICS . " WHERE topic_poster IN($user_csv)") as $row) {
- $exclude_posts_ary[] = $row['topic_first_post_id'];
- }
- if ($exclude_posts_csv = get_id_csv($exclude_posts_ary)) {
- $where_sql .= " AND post_id NOT IN($exclude_posts_csv)";
- }
- } else {
- $where_sql = "post_id IN($post_csv)";
- }
-
- DB()->query("INSERT INTO $tmp_delete_posts SELECT post_id FROM " . BB_POSTS . " WHERE $where_sql");
-
- // Deleted posts count
- $row = DB()->fetch_row("SELECT COUNT(*) AS posts_count FROM $tmp_delete_posts");
-
- if (!$deleted_posts_count = $row['posts_count']) {
- DB()->query("DROP TEMPORARY TABLE $tmp_delete_posts");
- return 0;
- }
-
- // Delete attachments (from disk)
- $attach_dir = get_attachments_dir();
-
- $result = DB()->query("
- SELECT
- d.physical_filename
- FROM
- " . $tmp_delete_posts . " del,
- " . BB_ATTACHMENTS . " a,
- " . BB_ATTACHMENTS_DESC . " d
- WHERE
- a.post_id = del.post_id
- AND d.attach_id = a.attach_id
- ");
-
- while ($row = DB()->fetch_next($result)) {
- if ($filename = basename($row['physical_filename'])) {
- @unlink("$attach_dir/" . $filename);
- @unlink("$attach_dir/" . THUMB_DIR . '/t_' . $filename);
- }
- }
- unset($row, $result);
-
- // Delete posts, posts_text, attachments (from DB)
- DB()->query("
- DELETE p, pt, ps, tor, a, d, ph
- FROM " . $tmp_delete_posts . " del
- LEFT JOIN " . BB_POSTS . " p ON(p.post_id = del.post_id)
- LEFT JOIN " . BB_POSTS_TEXT . " pt ON(pt.post_id = del.post_id)
- LEFT JOIN " . BB_POSTS_HTML . " ph ON(ph.post_id = del.post_id)
- LEFT JOIN " . BB_POSTS_SEARCH . " ps ON(ps.post_id = del.post_id)
- LEFT JOIN " . BB_BT_TORRENTS . " tor ON(tor.post_id = del.post_id)
- LEFT JOIN " . BB_ATTACHMENTS . " a ON(a.post_id = del.post_id)
- LEFT JOIN " . BB_ATTACHMENTS_DESC . " d ON(d.attach_id = a.attach_id)
- ");
-
- // Log action
- if ($del_user_posts) {
- $log_action->admin('mod_post_delete', array(
- 'log_msg' => 'user: ' . get_usernames_for_log($user_id) . "
posts: $deleted_posts_count",
- ));
- } elseif (!defined('IN_CRON')) {
- foreach ($log_topics as $row) {
- $log_action->mod('mod_post_delete', array(
- 'forum_id' => $row['forum_id'],
- 'topic_id' => $row['topic_id'],
- 'topic_title' => $row['topic_title'],
- ));
- }
- }
-
- // Sync
- sync('topic', $sync_topics);
- sync('forum', array_keys($sync_forums));
- sync('user_posts', $sync_users);
-
- // Update atom feed
- foreach ($sync_topics as $atom_topic) {
- update_atom('topic', $atom_topic);
- }
- foreach ($sync_users as $atom_user) {
- update_atom('user', $atom_user);
- }
-
- DB()->query("DROP TEMPORARY TABLE $tmp_delete_posts");
-
- return $deleted_posts_count;
-}
-
-function user_delete($user_id, $delete_posts = false)
-{
- global $bb_cfg, $log_action;
-
- if (!$user_csv = get_id_csv($user_id)) {
- return false;
- }
- if (!$user_id = DB()->fetch_rowset("SELECT user_id FROM " . BB_USERS . " WHERE user_id IN($user_csv)", 'user_id')) {
- return false;
- }
- $user_csv = get_id_csv($user_id);
-
- // LOG
- $log_action->admin('adm_user_delete', array(
- 'log_msg' => get_usernames_for_log($user_id),
- ));
-
- // Avatar
- $result = DB()->query("SELECT user_id, avatar_ext_id FROM " . BB_USERS . " WHERE avatar_ext_id > 0 AND user_id IN($user_csv)");
-
- while ($row = DB()->fetch_next($result)) {
- delete_avatar($row['user_id'], $row['avatar_ext_id']);
- }
-
- if ($delete_posts) {
- post_delete('user', $user_id);
- } else {
- DB()->query("UPDATE " . BB_POSTS . " SET poster_id = " . DELETED . " WHERE poster_id IN($user_csv)");
- }
-
- DB()->query("UPDATE " . BB_GROUPS . " SET group_moderator = 2 WHERE group_single_user = 0 AND group_moderator IN($user_csv)");
- DB()->query("UPDATE " . BB_TOPICS . " SET topic_poster = " . DELETED . " WHERE topic_poster IN($user_csv)");
- DB()->query("UPDATE " . BB_BT_TORRENTS . " SET poster_id = " . DELETED . " WHERE poster_id IN($user_csv)");
-
- DB()->query("
- DELETE ug, g, a, qt1, qt2
- FROM " . BB_USER_GROUP . " ug
- LEFT JOIN " . BB_GROUPS . " g ON(g.group_id = ug.group_id AND g.group_single_user = 1)
- LEFT JOIN " . BB_AUTH_ACCESS . " a ON(a.group_id = g.group_id)
- LEFT JOIN " . BB_QUOTA . " qt1 ON(qt1.user_id = ug.user_id)
- LEFT JOIN " . BB_QUOTA . " qt2 ON(qt2.group_id = g.group_id)
- WHERE ug.user_id IN($user_csv)
- ");
-
- DB()->query("
- DELETE u, ban, pu, s, tw, asn
- FROM " . BB_USERS . " u
- LEFT JOIN " . BB_BANLIST . " ban ON(ban.ban_userid = u.user_id)
- LEFT JOIN " . BB_POLL_USERS . " pu ON(pu.user_id = u.user_id)
- LEFT JOIN " . BB_SESSIONS . " s ON(s.session_user_id = u.user_id)
- LEFT JOIN " . BB_TOPICS_WATCH . " tw ON(tw.user_id = u.user_id)
- LEFT JOIN " . BB_AUTH_ACCESS_SNAP . " asn ON(asn.user_id = u.user_id)
- WHERE u.user_id IN($user_csv)
- ");
-
- DB()->query("
- DELETE btu, tr
- FROM " . BB_BT_USERS . " btu
- LEFT JOIN " . BB_BT_TRACKER . " tr ON(tr.user_id = btu.user_id)
- WHERE btu.user_id IN($user_csv)
- ");
-
- // PM
- DB()->query("
- DELETE pm, pmt
- FROM " . BB_PRIVMSGS . " pm
- LEFT JOIN " . BB_PRIVMSGS_TEXT . " pmt ON(pmt.privmsgs_text_id = pm.privmsgs_id)
- WHERE pm.privmsgs_from_userid IN($user_csv)
- AND pm.privmsgs_type IN(" . PRIVMSGS_SENT_MAIL . ',' . PRIVMSGS_SAVED_OUT_MAIL . ")
- ");
-
- DB()->query("
- DELETE pm, pmt
- FROM " . BB_PRIVMSGS . " pm
- LEFT JOIN " . BB_PRIVMSGS_TEXT . " pmt ON(pmt.privmsgs_text_id = pm.privmsgs_id)
- WHERE pm.privmsgs_to_userid IN($user_csv)
- AND pm.privmsgs_type IN(" . PRIVMSGS_READ_MAIL . ',' . PRIVMSGS_SAVED_IN_MAIL . ")
- ");
-
- DB()->query("UPDATE " . BB_PRIVMSGS . " SET privmsgs_from_userid = " . DELETED . " WHERE privmsgs_from_userid IN($user_csv)");
- DB()->query("UPDATE " . BB_PRIVMSGS . " SET privmsgs_to_userid = " . DELETED . " WHERE privmsgs_to_userid IN($user_csv)");
-
- // Delete user feed
- foreach (explode(',', $user_csv) as $user_id) {
- $file_path = $bb_cfg['atom']['path'] . '/u/' . floor($user_id / 5000) . '/' . ($user_id % 100) . '/' . $user_id . '.atom';
- @unlink($file_path);
- }
-}
-
-function get_usernames_for_log($user_id)
-{
- $users_log_msg = array();
-
- if ($user_csv = get_id_csv($user_id)) {
- $sql = "SELECT user_id, username FROM " . BB_USERS . " WHERE user_id IN($user_csv)";
-
- foreach (DB()->fetch_rowset($sql) as $row) {
- $users_log_msg[] = "$row[username] [$row[user_id]]";
- }
- }
-
- return implode(', ', $users_log_msg);
-}
diff --git a/library/includes/functions_admin_cron.php b/library/includes/functions_admin_cron.php
deleted file mode 100644
index 78155fea9..000000000
--- a/library/includes/functions_admin_cron.php
+++ /dev/null
@@ -1,161 +0,0 @@
-sql_query($sql)) {
- bb_die('Could not obtain cron script');
- }
-
- while ($row = DB()->sql_fetchrow($result)) {
- $job = $row['cron_script'];
- $job_script = INC_DIR . '/cron/jobs/' . $job;
- require($job_script);
- }
- DB()->query("
- UPDATE " . BB_CRON . " SET
- last_run = NOW(),
- run_counter = run_counter + 1,
- next_run =
- CASE
- WHEN schedule = 'hourly' THEN
- DATE_ADD(NOW(), INTERVAL 1 HOUR)
- WHEN schedule = 'daily' THEN
- DATE_ADD(DATE_ADD(CURDATE(), INTERVAL 1 DAY), INTERVAL TIME_TO_SEC(run_time) SECOND)
- WHEN schedule = 'weekly' THEN
- DATE_ADD(
- DATE_ADD(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(NOW()) DAY), INTERVAL 7 DAY),
- INTERVAL CONCAT(ROUND(run_day-1), ' ', run_time) DAY_SECOND)
- WHEN schedule = 'monthly' THEN
- DATE_ADD(
- DATE_ADD(DATE_SUB(CURDATE(), INTERVAL DAYOFMONTH(NOW())-1 DAY), INTERVAL 1 MONTH),
- INTERVAL CONCAT(ROUND(run_day-1), ' ', run_time) DAY_SECOND)
- ELSE
- DATE_ADD(NOW(), INTERVAL TIME_TO_SEC(run_interval) SECOND)
- END
- WHERE cron_id IN ($jobs)
- ");
-
- return;
-}
-
-function delete_jobs($jobs)
-{
- DB()->query("DELETE FROM " . BB_CRON . " WHERE cron_id IN ($jobs)");
- return;
-}
-
-function toggle_active($jobs, $cron_action)
-{
- $active = ($cron_action == 'disable') ? 0 : 1;
- DB()->query("UPDATE " . BB_CRON . " SET cron_active = $active WHERE cron_id IN ($jobs)");
- return;
-}
-
-function validate_cron_post($cron_arr)
-{
- $errors = 'Errors in: ';
- $errnum = 0;
- if (!$cron_arr['cron_title']) {
- $errors .= 'cron title (empty value), ';
- $errnum++;
- }
- if (!$cron_arr['cron_script']) {
- $errors .= 'cron script (empty value), ';
- $errnum++;
- }
- if ($errnum > 0) {
- $result = $errors . ' total ' . $errnum . ' errors
Back';
- } else {
- $result = 1;
- }
- return $result;
-}
-
-function insert_cron_job($cron_arr)
-{
- $row = DB()->fetch_row("SELECT cron_title, cron_script FROM " . BB_CRON . " WHERE cron_title = '" . $_POST['cron_title'] . "' or cron_script = '" . $_POST['cron_script'] . "' ");
-
- if ($row) {
- global $lang;
-
- if ($_POST['cron_script'] == $row['cron_script']) {
- $langmode = $lang['SCRIPT_DUPLICATE'];
- } else {
- $langmode = $lang['TITLE_DUPLICATE'];
- }
-
- $message = $langmode . "
" . sprintf($lang['CLICK_RETURN_JOBS_ADDED'], "", "") . "
" . sprintf($lang['CLICK_RETURN_JOBS'], "", "") . "
" . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], "", "");
-
- bb_die($message);
- }
-
- $cron_active = $cron_arr['cron_active'];
- $cron_title = $cron_arr['cron_title'];
- $cron_script = $cron_arr['cron_script'];
- $schedule = $cron_arr['schedule'];
- $run_day = $cron_arr['run_day'];
- $run_time = $cron_arr['run_time'];
- $run_order = $cron_arr['run_order'];
- $last_run = $cron_arr['last_run'];
- $next_run = $cron_arr['next_run'];
- $run_interval = $cron_arr['run_interval'];
- $log_enabled = $cron_arr['log_enabled'];
- $log_file = $cron_arr['log_file'];
- $log_sql_queries = $cron_arr['log_sql_queries'];
- $disable_board = $cron_arr['disable_board'];
- $run_counter = $cron_arr['run_counter'];
-
- DB()->query("INSERT INTO " . BB_CRON . " (cron_active, cron_title, cron_script, schedule, run_day, run_time, run_order, last_run, next_run, run_interval, log_enabled, log_file, log_sql_queries, disable_board, run_counter) VALUES (
- $cron_active, '$cron_title', '$cron_script', '$schedule', '$run_day', '$run_time', '$run_order', '$last_run', '$next_run', '$run_interval', $log_enabled, '$log_file', $log_sql_queries, $disable_board, '$run_counter')");
-}
-
-function update_cron_job($cron_arr)
-{
- $cron_id = $cron_arr['cron_id'];
- $cron_active = $cron_arr['cron_active'];
- $cron_title = DB()->escape($cron_arr['cron_title']);
- $cron_script = DB()->escape($cron_arr['cron_script']);
- $schedule = $cron_arr['schedule'];
- $run_day = $cron_arr['run_day'];
- $run_time = $cron_arr['run_time'];
- $run_order = $cron_arr['run_order'];
- $last_run = $cron_arr['last_run'];
- $next_run = $cron_arr['next_run'];
- $run_interval = $cron_arr['run_interval'];
- $log_enabled = $cron_arr['log_enabled'];
- $log_file = DB()->escape($cron_arr['log_file']);
- $log_sql_queries = $cron_arr['log_sql_queries'];
- $disable_board = $cron_arr['disable_board'];
- $run_counter = $cron_arr['run_counter'];
-
- DB()->query("UPDATE " . BB_CRON . " SET
- cron_active = '$cron_active',
- cron_title = '$cron_title',
- cron_script = '$cron_script',
- schedule = '$schedule',
- run_day = '$run_day',
- run_time = '$run_time',
- run_order = '$run_order',
- last_run = '$last_run',
- next_run = '$next_run',
- run_interval = '$run_interval',
- log_enabled = '$log_enabled',
- log_file = '$log_file',
- log_sql_queries = '$log_sql_queries',
- disable_board = '$disable_board',
- run_counter = '$run_counter'
- WHERE cron_id = $cron_id
- ");
-}
diff --git a/library/includes/functions_admin_torrent.php b/library/includes/functions_admin_torrent.php
deleted file mode 100644
index 443a79dcd..000000000
--- a/library/includes/functions_admin_torrent.php
+++ /dev/null
@@ -1,104 +0,0 @@
-sql_query($sql)) {
- bb_die('Could not update ' . $table_name);
- }
-
- if (isset($_POST[$field_name])) {
- // Get new status
- $in_sql = array();
-
- foreach ($_POST[$field_name] as $i => $val) {
- $in_sql[] = (int)$val;
- }
-
- // Update status
- if ($in_sql = implode(',', $in_sql)) {
- $sql = "UPDATE $table_name
- SET $field_name = 1
- WHERE $key IN($in_sql)";
-
- if (!$result = DB()->sql_query($sql)) {
- bb_die('Could not update ' . $table_name);
- }
- }
- }
- return;
-}
-
-function set_tpl_vars($default_cfg, $cfg)
-{
- global $template;
-
- foreach ($default_cfg as $config_name => $config_value) {
- $template->assign_vars(array(strtoupper($config_name) => htmlspecialchars($cfg[$config_name])));
- }
-}
-
-function set_tpl_vars_bool($default_cfg, $cfg)
-{
- global $template, $lang;
-
- foreach ($default_cfg as $config_name => $config_value) {
- // YES/NO 'checked="checked"'
- $template->assign_vars(array(
- strtoupper($config_name) . '_YES' => ($cfg[$config_name]) ? HTML_CHECKED : '',
- strtoupper($config_name) . '_NO' => (!$cfg[$config_name]) ? HTML_CHECKED : '',
- ));
- // YES/NO lang vars
- $template->assign_vars(array(
- 'L_' . strtoupper($config_name) . '_YES' => ($cfg[$config_name]) ? "$lang[YES]" : $lang['YES'],
- 'L_' . strtoupper($config_name) . '_NO' => (!$cfg[$config_name]) ? "$lang[NO]" : $lang['NO'],
- ));
- }
-}
-
-function set_tpl_vars_lang($default_cfg)
-{
- global $template, $lang;
-
- foreach ($default_cfg as $config_name => $config_value) {
- $template->assign_vars(array(
- 'L_' . strtoupper($config_name) => isset($lang[$config_name]) ? $lang[$config_name] : '',
- 'L_' . strtoupper($config_name) . '_EXPL' => isset($lang[$config_name . '_expl']) ? $lang[$config_name . '_expl'] : '',
- 'L_' . strtoupper($config_name) . '_HEAD' => isset($lang[$config_name . '_head']) ? $lang[$config_name . '_head'] : '',
- ));
- }
-}
-
-function update_config_table($table_name, $default_cfg, $cfg, $type)
-{
- foreach ($default_cfg as $config_name => $config_value) {
- if (isset($_POST[$config_name]) && $_POST[$config_name] != $cfg[$config_name]) {
- if ($type == 'str') {
- $config_value = $_POST[$config_name];
- } elseif ($type == 'bool') {
- $config_value = ($_POST[$config_name]) ? 1 : 0;
- } elseif ($type == 'num') {
- $config_value = abs((int)$_POST[$config_name]);
- } else {
- return;
- }
-
- bb_update_config(array($config_name => $config_value), $table_name);
- }
- }
-}
diff --git a/library/includes/functions_atom.php b/library/includes/functions_atom.php
deleted file mode 100644
index 4753808da..000000000
--- a/library/includes/functions_atom.php
+++ /dev/null
@@ -1,202 +0,0 @@
- 0 && $forum_data['allow_reg_tracker']) {
- $select_tor_sql = ', tor.size AS tor_size, tor.tor_status';
- $join_tor_sql = "LEFT JOIN " . BB_BT_TORRENTS . " tor ON(t.topic_id = tor.topic_id)";
- }
- if ($forum_id == 0) {
- $sql = "
- SELECT
- t.topic_id, t.topic_title, t.topic_status,
- u1.username AS first_username,
- p1.post_time AS topic_first_post_time, p1.post_edit_time AS topic_first_post_edit_time,
- p2.post_time AS topic_last_post_time, p2.post_edit_time AS topic_last_post_edit_time,
- tor.size AS tor_size, tor.tor_status
- FROM " . BB_BT_TORRENTS . " tor
- LEFT JOIN " . BB_TOPICS . " t ON(tor.topic_id = t.topic_id)
- LEFT JOIN " . BB_USERS . " u1 ON(t.topic_poster = u1.user_id)
- LEFT JOIN " . BB_POSTS . " p1 ON(t.topic_first_post_id = p1.post_id)
- LEFT JOIN " . BB_POSTS . " p2 ON(t.topic_last_post_id = p2.post_id)
- ORDER BY t.topic_last_post_time DESC
- LIMIT 100
- ";
- } elseif ($forum_id > 0) {
- $sql = "
- SELECT
- t.topic_id, t.topic_title, t.topic_status,
- u1.username AS first_username,
- p1.post_time AS topic_first_post_time, p1.post_edit_time AS topic_first_post_edit_time,
- p2.post_time AS topic_last_post_time, p2.post_edit_time AS topic_last_post_edit_time
- $select_tor_sql
- FROM " . BB_TOPICS . " t
- LEFT JOIN " . BB_USERS . " u1 ON(t.topic_poster = u1.user_id)
- LEFT JOIN " . BB_POSTS . " p1 ON(t.topic_first_post_id = p1.post_id)
- LEFT JOIN " . BB_POSTS . " p2 ON(t.topic_last_post_id = p2.post_id)
- $join_tor_sql
- WHERE t.forum_id = $forum_id
- ORDER BY t.topic_last_post_time DESC
- LIMIT 50
- ";
- }
- $topics_tmp = DB()->fetch_rowset($sql);
- $topics = array();
- foreach ($topics_tmp as $topic) {
- if (isset($topic['topic_status'])) {
- if ($topic['topic_status'] == TOPIC_MOVED) {
- continue;
- }
- }
- if (isset($topic['tor_status'])) {
- if (isset($bb_cfg['tor_frozen'][$topic['tor_status']])) {
- continue;
- }
- }
- $topics[] = $topic;
- }
- if (!count($topics)) {
- @unlink($file_path);
- return false;
- }
- if (create_atom($file_path, 'f', $forum_id, htmlCHR($forum_data['forum_name']), $topics)) {
- return true;
- }
-
- return false;
-}
-
-function update_user_feed($user_id, $username)
-{
- global $bb_cfg;
- $file_path = $bb_cfg['atom']['path'] . '/u/' . floor($user_id / 5000) . '/' . ($user_id % 100) . '/' . $user_id . '.atom';
- $sql = "
- SELECT
- t.topic_id, t.topic_title, t.topic_status,
- u1.username AS first_username,
- p1.post_time AS topic_first_post_time, p1.post_edit_time AS topic_first_post_edit_time,
- p2.post_time AS topic_last_post_time, p2.post_edit_time AS topic_last_post_edit_time,
- tor.size AS tor_size, tor.tor_status
- FROM " . BB_TOPICS . " t
- LEFT JOIN " . BB_USERS . " u1 ON(t.topic_poster = u1.user_id)
- LEFT JOIN " . BB_POSTS . " p1 ON(t.topic_first_post_id = p1.post_id)
- LEFT JOIN " . BB_POSTS . " p2 ON(t.topic_last_post_id = p2.post_id)
- LEFT JOIN " . BB_BT_TORRENTS . " tor ON(t.topic_id = tor.topic_id)
- WHERE t.topic_poster = $user_id
- ORDER BY t.topic_last_post_time DESC
- LIMIT 50
- ";
- $topics_tmp = DB()->fetch_rowset($sql);
- $topics = array();
- foreach ($topics_tmp as $topic) {
- if (isset($topic['topic_status'])) {
- if ($topic['topic_status'] == TOPIC_MOVED) {
- continue;
- }
- }
- if (isset($topic['tor_status'])) {
- if (isset($bb_cfg['tor_frozen'][$topic['tor_status']])) {
- continue;
- }
- }
- $topics[] = $topic;
- }
- if (!count($topics)) {
- @unlink($file_path);
- return false;
- }
- if (create_atom($file_path, 'u', $user_id, wbr($username), $topics)) {
- return true;
- }
-
- return false;
-}
-
-function create_atom($file_path, $mode, $id, $title, $topics)
-{
- global $lang;
- $dir = dirname($file_path);
- if (!file_exists($dir)) {
- if (!bb_mkdir($dir)) {
- return false;
- }
- }
- foreach ($topics as $topic) {
- $last_time = $topic['topic_last_post_time'];
- if ($topic['topic_last_post_edit_time']) {
- $last_time = $topic['topic_last_post_edit_time'];
- }
- $date = bb_date($last_time, 'Y-m-d', 0);
- $time = bb_date($last_time, 'H:i:s', 0);
- break;
- }
- $atom = "";
- $atom .= "\n";
- $atom .= "
$out"); - } - - header("Content-Type: application/x-bittorrent; name=\"$dl_fname\""); - header("Content-Disposition: attachment; filename=\"$dl_fname\""); - - bb_exit($output); -} - -function generate_passkey($user_id, $force_generate = false) -{ - global $bb_cfg, $lang, $sql; - - $user_id = (int)$user_id; - - // Check if user can change passkey - if (!$force_generate) { - $sql = "SELECT user_opt FROM " . BB_USERS . " WHERE user_id = $user_id LIMIT 1"; - - if (!$result = DB()->sql_query($sql)) { - bb_die('Could not query userdata for passkey'); - } - if ($row = DB()->sql_fetchrow($result)) { - if (bf($row['user_opt'], 'user_opt', 'dis_passkey')) { - bb_die($lang['NOT_AUTHORISED']); - } - } - } - - for ($i = 0; $i < 20; $i++) { - $passkey_val = make_rand_str(BT_AUTH_KEY_LENGTH); - $old_passkey = null; - - if ($row = DB()->fetch_row("SELECT auth_key FROM " . BB_BT_USERS . " WHERE user_id = $user_id LIMIT 1")) { - $old_passkey = $row['auth_key']; - } - - // Insert new row - DB()->query("INSERT IGNORE INTO " . BB_BT_USERS . " (user_id, auth_key) VALUES ($user_id, '$passkey_val')"); - - if (DB()->affected_rows() == 1) { - return $passkey_val; - } - // Update - DB()->query("UPDATE IGNORE " . BB_BT_USERS . " SET auth_key = '$passkey_val' WHERE user_id = $user_id"); - - if (DB()->affected_rows() == 1) { - // Ocelot - if ($bb_cfg['ocelot']['enabled']) { - ocelot_update_tracker('change_passkey', array('oldpasskey' => $old_passkey, 'newpasskey' => $passkey_val)); - } - return $passkey_val; - } - } - return false; -} - -function tracker_rm_torrent($topic_id) -{ - return DB()->sql_query("DELETE FROM " . BB_BT_TRACKER . " WHERE topic_id = " . (int)$topic_id); -} - -function tracker_rm_user($user_id) -{ - return DB()->sql_query("DELETE FROM " . BB_BT_TRACKER . " WHERE user_id = " . (int)$user_id); -} - -function get_registered_torrents($id, $mode) -{ - $field = ($mode == 'topic') ? 'topic_id' : 'post_id'; - - $sql = "SELECT topic_id FROM " . BB_BT_TORRENTS . " WHERE $field = $id LIMIT 1"; - - if (!$result = DB()->sql_query($sql)) { - bb_die('Could not query torrent id'); - } - - if ($rowset = @DB()->sql_fetchrowset($result)) { - return $rowset; - } else { - return false; - } -} - -function torrent_error_exit($message) -{ - global $reg_mode, $return_message, $lang; - - $msg = ''; - - if (isset($reg_mode) && ($reg_mode == 'request' || $reg_mode == 'newtopic')) { - if (isset($return_message)) { - $msg .= $return_message . '