Revert "refactor: Moved classes from Legacy folder to src root (#1828)"

This reverts commit 92ce77ec0e.
This commit is contained in:
Roman Kelesidis 2025-03-02 10:07:04 +03:00
parent 680bd77920
commit 380c94ff07
73 changed files with 276 additions and 258 deletions

View file

@ -136,8 +136,8 @@ switch ($mode) {
'POSTS_PER_PAGE' => $new['posts_per_page'],
'HOT_TOPIC' => $new['hot_threshold'],
'DEFAULT_DATEFORMAT' => $new['default_dateformat'],
'LANG_SELECT' => TorrentPier\Select::language($new['default_lang'], 'default_lang'),
'TIMEZONE_SELECT' => TorrentPier\Select::timezone($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' => (bool)$new['prune_enable'],

View file

@ -77,12 +77,12 @@ $cfg = bb_get_config(BB_CONFIG, true, false);
*/
if ($submit && $confirm) {
foreach ($db_fields_bool as $field_name => $field_def_val) {
\TorrentPier\Admin\Torrent::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);
}
\TorrentPier\Admin\Torrent::update_config_table(BB_CONFIG, $default_cfg_str, $cfg, 'str');
\TorrentPier\Admin\Torrent::update_config_table(BB_CONFIG, $default_cfg_bool, $cfg, 'bool');
\TorrentPier\Admin\Torrent::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');
@ -90,16 +90,16 @@ if ($submit && $confirm) {
}
// Set template vars
\TorrentPier\Admin\Torrent::set_tpl_vars($default_cfg_str, $cfg);
\TorrentPier\Admin\Torrent::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);
\TorrentPier\Admin\Torrent::set_tpl_vars_bool($default_cfg_bool, $cfg);
\TorrentPier\Admin\Torrent::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);
\TorrentPier\Admin\Torrent::set_tpl_vars($default_cfg_num, $cfg);
\TorrentPier\Admin\Torrent::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);
\TorrentPier\Admin\Torrent::set_tpl_vars_lang($db_fields_bool);
\TorrentPier\Legacy\Admin\Torrent::set_tpl_vars_lang($db_fields_bool);
// Get Forums list
$sql = 'SELECT f.*

View file

@ -99,7 +99,7 @@ switch ($mode) {
break;
case 'run':
\TorrentPier\Admin\Cron::run_jobs($job_id);
\TorrentPier\Legacy\Admin\Cron::run_jobs($job_id);
redirect('admin/' . basename(__FILE__) . '?mode=list');
break;
@ -182,7 +182,7 @@ switch ($mode) {
break;
case 'delete':
\TorrentPier\Admin\Cron::delete_jobs($job_id);
\TorrentPier\Legacy\Admin\Cron::delete_jobs($job_id);
bb_die($lang['JOB_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_JOBS'], '<a href="admin_cron.php?mode=list">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
break;
}
@ -191,25 +191,25 @@ if ($submit) {
$mode2 = $_POST['mode'] ?? '';
if ($mode2 == 'list') {
if ($cron_action == 'run' && $jobs) {
\TorrentPier\Admin\Cron::run_jobs($jobs);
\TorrentPier\Legacy\Admin\Cron::run_jobs($jobs);
} elseif ($cron_action == 'delete' && $jobs) {
\TorrentPier\Admin\Cron::delete_jobs($jobs);
\TorrentPier\Legacy\Admin\Cron::delete_jobs($jobs);
} elseif (($cron_action == 'disable' || $cron_action == 'enable') && $jobs) {
\TorrentPier\Admin\Cron::toggle_active($jobs, $cron_action);
\TorrentPier\Legacy\Admin\Cron::toggle_active($jobs, $cron_action);
}
redirect('admin/' . basename(__FILE__) . '?mode=list');
} elseif (\TorrentPier\Admin\Cron::validate_cron_post($_POST) == 1) {
} elseif (\TorrentPier\Legacy\Admin\Cron::validate_cron_post($_POST) == 1) {
if ($mode2 == 'edit') {
\TorrentPier\Admin\Cron::update_cron_job($_POST);
\TorrentPier\Legacy\Admin\Cron::update_cron_job($_POST);
} elseif ($mode2 == 'add') {
\TorrentPier\Admin\Cron::insert_cron_job($_POST);
\TorrentPier\Legacy\Admin\Cron::insert_cron_job($_POST);
} else {
bb_die("Invalid mode: $mode2");
}
redirect('admin/' . basename(__FILE__) . '?mode=list');
} else {
bb_die(\TorrentPier\Admin\Cron::validate_cron_post($_POST));
bb_die(\TorrentPier\Legacy\Admin\Cron::validate_cron_post($_POST));
}
}

View file

@ -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 = \TorrentPier\Admin\Common::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;

View file

@ -437,7 +437,7 @@ if ($mode) {
if ($to_id == -1) {
// Delete everything from forum
\TorrentPier\Admin\Common::topic_delete('prune', $from_id, 0, true);
\TorrentPier\Legacy\Admin\Common::topic_delete('prune', $from_id, 0, true);
$datastore->update('stats');
} else {
// Move all posts
@ -467,7 +467,7 @@ if ($mode) {
$start_id += $per_cycle;
}
\TorrentPier\Admin\Common::sync('forum', $to_id);
\TorrentPier\Legacy\Admin\Common::sync('forum', $to_id);
}
DB()->query('DELETE FROM ' . BB_FORUMS . " WHERE forum_id = $from_id");
@ -476,7 +476,7 @@ if ($mode) {
$cat_forums = get_cat_forums();
fix_orphan_sf();
TorrentPier\Group::update_user_level('all');
\TorrentPier\Legacy\Group::update_user_level('all');
$datastore->update('cat_forums');
CACHE('bb_cache')->rm();
@ -650,7 +650,7 @@ if ($mode) {
break;
case 'forum_sync':
\TorrentPier\Admin\Common::sync('forum', (int)$_GET[POST_FORUM_URL]);
\TorrentPier\Legacy\Admin\Common::sync('forum', (int)$_GET[POST_FORUM_URL]);
$datastore->update('cat_forums');
CACHE('bb_cache')->rm();

View file

@ -21,7 +21,7 @@ attachment_quota_settings('group', $mode, isset($_POST['group_update']));
if (!empty($_POST['edit']) || !empty($_POST['new'])) {
if (!empty($_POST['edit'])) {
if (!$row = TorrentPier\Group::get_group_data($group_id)) {
if (!$row = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
bb_die($lang['GROUP_NOT_EXIST']);
}
$group_info = [
@ -72,11 +72,11 @@ if (!empty($_POST['edit']) || !empty($_POST['new'])) {
]);
} elseif (!empty($_POST['group_update'])) {
if (!empty($_POST['group_delete'])) {
if (!$group_info = TorrentPier\Group::get_group_data($group_id)) {
if (!$group_info = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
bb_die($lang['GROUP_NOT_EXIST']);
}
// Delete Group
TorrentPier\Group::delete_group($group_id);
\TorrentPier\Legacy\Group::delete_group($group_id);
$message = $lang['DELETED_GROUP'] . '<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_GROUPSADMIN'], '<a href="admin_groups.php">', '</a>') . '<br /><br />';
@ -111,18 +111,18 @@ if (!empty($_POST['edit']) || !empty($_POST['new'])) {
];
if ($mode == 'editgroup') {
if (!$group_info = TorrentPier\Group::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
TorrentPier\Group::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'])) {
TorrentPier\Group::delete_user_group($group_id, $group_info['group_moderator']);
\TorrentPier\Legacy\Group::delete_user_group($group_id, $group_info['group_moderator']);
}
}
@ -145,7 +145,7 @@ if (!empty($_POST['edit']) || !empty($_POST['new'])) {
$new_group_id = DB()->sql_nextid();
// Create user_group for group's moderator
TorrentPier\Group::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'] . '<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_GROUPSADMIN'], '<a href="admin_groups.php">', '</a>') . '<br /><br />';

View file

@ -67,7 +67,7 @@ if ($submit && $mode == 'user') {
if ($row = DB()->fetch_row($sql)) {
$group_id = $row['group_id'];
} else {
$group_id = TorrentPier\Group::create_user_group($user_id);
$group_id = \TorrentPier\Legacy\Group::create_user_group($user_id);
}
if (!$group_id || !$user_id || null === $this_user_level) {
@ -84,7 +84,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
TorrentPier\Group::delete_permissions($group_id, $user_id);
\TorrentPier\Legacy\Group::delete_permissions($group_id, $user_id);
$message = $lang['AUTH_UPDATED'] . '<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '<a href="admin_ug_auth.php?mode=' . $mode . '&' . POST_USERS_URL . '=' . $user_id . '">', '</a>') . '<br /><br />';
@ -100,7 +100,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");
TorrentPier\Group::delete_permissions($group_id, $user_id);
\TorrentPier\Legacy\Group::delete_permissions($group_id, $user_id);
$message = $lang['AUTH_UPDATED'] . '<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '<a href="admin_ug_auth.php?mode=' . $mode . '&' . POST_USERS_URL . '=' . $user_id . '">', '</a>') . '<br /><br />';
@ -125,9 +125,9 @@ if ($submit && $mode == 'user') {
}
}
TorrentPier\Group::delete_permissions($group_id, null, $cat_id);
TorrentPier\Group::store_permissions($group_id, $auth);
TorrentPier\Group::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'] . '<br /><br />';
@ -140,7 +140,7 @@ if ($submit && $mode == 'user') {
// Submit new GROUP permissions
//
elseif ($submit && $mode == 'group' && (!empty($_POST['auth']) && is_array($_POST['auth']))) {
if (!$group_data = TorrentPier\Group::get_group_data($group_id)) {
if (!$group_data = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
bb_die($lang['GROUP_NOT_EXIST']);
}
@ -153,9 +153,9 @@ elseif ($submit && $mode == 'group' && (!empty($_POST['auth']) && is_array($_POS
}
}
TorrentPier\Group::delete_permissions($group_id, null, $cat_id);
TorrentPier\Group::store_permissions($group_id, $auth);
TorrentPier\Group::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'] . '<br /><br />';
@ -296,7 +296,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
} elseif ($mode == 'group' && $group_id) {
$page_cfg['quirks_mode'] = true;
if (!$group_data = TorrentPier\Group::get_group_data($group_id)) {
if (!$group_data = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
bb_die($lang['GROUP_NOT_EXIST']);
}

View file

@ -52,8 +52,8 @@ if (!isset($_REQUEST['dosearch'])) {
}
}
$language_list = TorrentPier\Select::language('', 'language_type');
$timezone_list = TorrentPier\Select::timezone('', '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 )

View file

@ -41,5 +41,5 @@ $ajax->exec();
/**
* @deprecated ajax_common
* Dirty class removed from here since 2.2.0
* To add new actions see at src/Ajax.php
* To add new actions see at src/Legacy/Ajax.php
*/

View file

@ -109,7 +109,7 @@ unset($server_protocol, $server_port);
/**
* Database
*/
$DBS = new TorrentPier\Dbs($bb_cfg);
$DBS = new TorrentPier\Legacy\Dbs($bb_cfg);
function DB(string $db_alias = 'db')
{
@ -120,7 +120,7 @@ function DB(string $db_alias = 'db')
/**
* Cache
*/
$CACHES = new TorrentPier\Caches($bb_cfg);
$CACHES = new TorrentPier\Legacy\Caches($bb_cfg);
function CACHE(string $cache_name)
{
@ -133,20 +133,20 @@ function CACHE(string $cache_name)
*/
switch ($bb_cfg['datastore_type']) {
case 'apcu':
$datastore = new \TorrentPier\Datastore\APCu($bb_cfg['cache']['prefix']);
$datastore = new TorrentPier\Legacy\Datastore\APCu($bb_cfg['cache']['prefix']);
break;
case 'memcached':
$datastore = new \TorrentPier\Datastore\Memcached($bb_cfg['cache']['memcached'], $bb_cfg['cache']['prefix']);
$datastore = new TorrentPier\Legacy\Datastore\Memcached($bb_cfg['cache']['memcached'], $bb_cfg['cache']['prefix']);
break;
case 'sqlite':
$datastore = new \TorrentPier\Datastore\Sqlite($bb_cfg['cache']['db_dir'] . 'datastore', $bb_cfg['cache']['prefix']);
$datastore = new TorrentPier\Legacy\Datastore\Sqlite($bb_cfg['cache']['db_dir'] . 'datastore', $bb_cfg['cache']['prefix']);
break;
case 'redis':
$datastore = new \TorrentPier\Datastore\Redis($bb_cfg['cache']['redis'], $bb_cfg['cache']['prefix']);
$datastore = new TorrentPier\Legacy\Datastore\Redis($bb_cfg['cache']['redis'], $bb_cfg['cache']['prefix']);
break;
case 'filecache':
default:
$datastore = new \TorrentPier\Datastore\File($bb_cfg['cache']['db_dir'] . 'datastore/', $bb_cfg['cache']['prefix']);
$datastore = new TorrentPier\Legacy\Datastore\File($bb_cfg['cache']['db_dir'] . 'datastore/', $bb_cfg['cache']['prefix']);
}
// Functions

2
dl.php
View file

@ -46,7 +46,7 @@ function send_file_to_browser($attachment, $upload_dir)
//bt
if (!(isset($_GET['original']) && !IS_USER)) {
TorrentPier\Torrent::send_torrent_with_passkey($filename);
\TorrentPier\Legacy\Torrent::send_torrent_with_passkey($filename);
}
// Now the tricky part... let's dance

View file

@ -37,7 +37,7 @@ if ($mode === 'get_feed_url' && ($type === 'f' || $type === 'u') && $id >= 0) {
if (is_file($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 {
if (\TorrentPier\Atom::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,7 +55,7 @@ if ($mode === 'get_feed_url' && ($type === 'f' || $type === 'u') && $id >= 0) {
if (is_file($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 {
if (\TorrentPier\Atom::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']);

View file

@ -32,7 +32,7 @@ $group_info = [];
$is_moderator = false;
if ($group_id) {
if (!$group_info = TorrentPier\Group::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']) {
@ -166,7 +166,7 @@ if (!$group_id) {
bb_die($lang['ALREADY_MEMBER_GROUP']);
}
TorrentPier\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']) {
// Sending email
@ -188,7 +188,7 @@ if (!$group_id) {
set_die_append_msg(group_id: $group_id);
bb_die($lang['GROUP_JOINED']);
} elseif (!empty($_POST['unsub']) || !empty($_POST['unsubpending'])) {
TorrentPier\Group::delete_user_group($group_id, $userdata['user_id']);
\TorrentPier\Legacy\Group::delete_user_group($group_id, $userdata['user_id']);
set_die_append_msg(group_id: $group_id);
bb_die($lang['UNSUB_SUCCESS']);
@ -222,7 +222,7 @@ if (!$group_id) {
}
}
TorrentPier\Group::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']) {
// Sending email
@ -260,7 +260,7 @@ if (!$group_id) {
AND group_id = $group_id
");
TorrentPier\Group::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 . "
@ -269,7 +269,7 @@ if (!$group_id) {
");
if (!empty($_POST['remove'])) {
TorrentPier\Group::update_user_level($sql_in);
\TorrentPier\Legacy\Group::update_user_level($sql_in);
}
}
// Email users when they are approved

View file

@ -23,7 +23,7 @@ $is_moderator = false;
$submit = !empty($_POST['submit']);
if ($group_id) {
if (!$group_info = TorrentPier\Group::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']) {
@ -36,7 +36,7 @@ if ($is_moderator) {
// Avatar
if ($submit) {
if (!empty($_FILES['avatar']['name']) && $bb_cfg['group_avatars']['up_allowed']) {
$upload = new \TorrentPier\Common\Upload();
$upload = new TorrentPier\Legacy\Common\Upload();
if ($upload->init($bb_cfg['group_avatars'], $_FILES['avatar']) and $upload->store('avatar', ['user_id' => GROUP_AVATAR_MASK . $group_id, 'avatar_ext_id' => $group_info['avatar_ext_id']])) {
$avatar_ext_id = (int)$upload->file_ext_id;

View file

@ -85,7 +85,7 @@ switch ($mode) {
}
}
TorrentPier\Torrent::change_tor_status($attach_id, $new_status);
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $new_status);
// Log action
$log_msg = sprintf($lang['TOR_STATUS_LOG_ACTION'], $bb_cfg['tor_icons'][$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b>', $bb_cfg['tor_icons'][$tor['tor_status']] . ' <b> ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '</b>');

View file

@ -23,7 +23,7 @@ if (!isset($this->request['type'])) {
$attach_id = (int)$this->request['attach_id'];
$type = (string)$this->request['type'];
if (!$torrent = TorrentPier\Torrent::get_torrent_info($attach_id)) {
if (!$torrent = \TorrentPier\Legacy\Torrent::get_torrent_info($attach_id)) {
$this->ajax_die($lang['INVALID_ATTACH_ID']);
}
@ -52,7 +52,7 @@ switch ($type) {
$tor_type_lang = "{$lang['UNSET_GOLD_TORRENT']} / {$lang['UNSET_SILVER_TORRENT']}";
}
TorrentPier\Torrent::change_tor_type($attach_id, $tor_type);
\TorrentPier\Legacy\Torrent::change_tor_type($attach_id, $tor_type);
// Log action
$log_action->mod('mod_topic_change_tor_type', [
@ -67,12 +67,12 @@ switch ($type) {
break;
case 'reg':
TorrentPier\Torrent::tracker_register($attach_id);
\TorrentPier\Legacy\Torrent::tracker_register($attach_id);
$url = (TOPIC_URL . $torrent['topic_id']);
break;
case 'unreg':
TorrentPier\Torrent::tracker_unregister($attach_id);
\TorrentPier\Legacy\Torrent::tracker_unregister($attach_id);
$url = (TOPIC_URL . $torrent['topic_id']);
break;
@ -80,7 +80,7 @@ switch ($type) {
if (empty($this->request['confirmed'])) {
$this->prompt_for_confirm($lang['DEL_TORRENT']);
}
TorrentPier\Torrent::delete_torrent($attach_id);
\TorrentPier\Legacy\Torrent::delete_torrent($attach_id);
$url = make_url(TOPIC_URL . $torrent['topic_id']);
break;
@ -88,7 +88,7 @@ switch ($type) {
if (empty($this->request['confirmed'])) {
$this->prompt_for_confirm($lang['DEL_MOVE_TORRENT']);
}
TorrentPier\Torrent::delete_torrent($attach_id);
\TorrentPier\Legacy\Torrent::delete_torrent($attach_id);
$url = make_url("modcp.php?" . POST_TOPIC_URL . "={$torrent['topic_id']}&mode=move&sid={$userdata['session_id']}");
break;
}

View file

@ -13,7 +13,7 @@ if (!defined('IN_AJAX')) {
global $bb_cfg, $userdata, $lang;
if (!$group_id = (int)$this->request['group_id'] or !$group_info = TorrentPier\Group::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']) {

View file

@ -66,16 +66,16 @@ switch ($mode) {
$this->response['indexer_html'] = '<span class="seed bold">' . $lang['INDEXER'] . '</span>';
break;
case 'update_user_level':
TorrentPier\Group::update_user_level('all');
\TorrentPier\Legacy\Group::update_user_level('all');
$this->response['update_user_level_html'] = '<span class="seed bold">' . $lang['USER_LEVELS_UPDATED'] . '</span>';
break;
case 'sync_topics':
\TorrentPier\Admin\Common::sync('topic', 'all');
\TorrentPier\Admin\Common::sync_all_forums();
\TorrentPier\Legacy\Admin\Common::sync('topic', 'all');
\TorrentPier\Legacy\Admin\Common::sync_all_forums();
$this->response['sync_topics_html'] = '<span class="seed bold">' . $lang['TOPICS_DATA_SYNCHRONIZED'] . '</span>';
break;
case 'sync_user_posts':
\TorrentPier\Admin\Common::sync('user_posts', 'all');
\TorrentPier\Legacy\Admin\Common::sync('user_posts', 'all');
$this->response['sync_user_posts_html'] = '<span class="seed bold">' . $lang['USER_POSTS_COUNT_SYNCHRONIZED'] . '</span>';
break;
case 'unlock_cron':

View file

@ -37,7 +37,7 @@ switch ($mode) {
if (!in_array($user_id, explode(',', EXCLUDED_USERS))) {
\TorrentPier\Sessions::delete_user_sessions($user_id);
\TorrentPier\Admin\Common::user_delete($user_id);
\TorrentPier\Legacy\Admin\Common::user_delete($user_id);
$user_id = $userdata['user_id']; // Store self user_id for redirect after successful deleting
$this->response['info'] = $lang['USER_DELETED'];
@ -54,8 +54,8 @@ switch ($mode) {
}
$user_topics = DB()->fetch_rowset("SELECT topic_id FROM " . BB_TOPICS . " WHERE topic_poster = $user_id", 'topic_id');
$deleted_topics = \TorrentPier\Admin\Common::topic_delete($user_topics);
$deleted_posts = \TorrentPier\Admin\Common::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'];
break;
case 'delete_message':
@ -66,7 +66,7 @@ switch ($mode) {
$this->prompt_for_confirm($lang['DELETE_USER_POSTS_CONFIRM']);
}
\TorrentPier\Admin\Common::post_delete('user', $user_id);
\TorrentPier\Legacy\Admin\Common::post_delete('user', $user_id);
$this->response['info'] = $lang['USER_DELETED_POSTS'];
break;
case 'user_activate':

View file

@ -41,7 +41,7 @@ switch ($mode) {
$this->ajax_die($lang['TORRENT_FAILED']);
}
TorrentPier\Torrent::change_tor_status($attach_id, $status);
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $status);
// Log action
$log_msg = sprintf($lang['TOR_STATUS_LOG_ACTION'], $bb_cfg['tor_icons'][$status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$status] . '</b>', $bb_cfg['tor_icons'][$tor['tor_status']] . ' <b> ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '</b>');

View file

@ -31,11 +31,11 @@ switch ($mode) {
$this->prompt_for_confirm($lang['BT_GEN_PASSKEY_NEW']);
}
if (!$passkey = TorrentPier\Torrent::generate_passkey($req_uid, IS_ADMIN)) {
if (!$passkey = \TorrentPier\Legacy\Torrent::generate_passkey($req_uid, IS_ADMIN)) {
$this->ajax_die('Could not insert passkey');
}
TorrentPier\Torrent::tracker_rm_user($req_uid);
\TorrentPier\Legacy\Torrent::tracker_rm_user($req_uid);
$this->response['passkey'] = $passkey;
break;
default:

View file

@ -53,7 +53,7 @@ switch ($this->request['type']) {
if (empty($this->request['confirmed'])) {
$this->prompt_for_confirm($lang['CONFIRM_DELETE']);
}
\TorrentPier\Admin\Common::post_delete($post_id);
\TorrentPier\Legacy\Admin\Common::post_delete($post_id);
// Update atom feed
update_atom('topic', (int)$this->request['topic_id']);
@ -262,7 +262,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) . "')");
TorrentPier\Post::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']);
@ -274,7 +274,7 @@ switch ($this->request['type']) {
if ($bb_cfg['topic_notify_enabled']) {
$notify = !empty($this->request['notify']);
TorrentPier\Post::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

View file

@ -36,7 +36,7 @@ try {
return;
}
$torrent = new TorrentPier\TorrentFileList($tor);
$torrent = new TorrentPier\Legacy\TorrentFileList($tor);
$tor_filelist = $torrent->get_filelist();

View file

@ -148,7 +148,7 @@ if ($tor_reged && $tor_info) {
$tor_type = $tor_info['tor_type'];
// Magnet link
$user_passkey = TorrentPier\Torrent::getPasskey($bt_user_id);
$user_passkey = \TorrentPier\Legacy\Torrent::getPasskey($bt_user_id);
$tor_magnet = create_magnet($tor_info['info_hash'], $tor_info['info_hash_v2'], $user_passkey, html_ent_decode($t_data['topic_title']));
// ratio limits

View file

@ -18,6 +18,6 @@ function execute_posting_attachment_handling()
{
global $attachment_mod;
$attachment_mod['posting'] = new TorrentPier\AttachPosting();
$attachment_mod['posting'] = new TorrentPier\Legacy\AttachPosting();
$attachment_mod['posting']->posting_attachment_mod();
}

View file

@ -97,7 +97,7 @@ function bbcode_tpl_compact($text)
// prepare a posted message for entry into the database
function prepare_message($message)
{
$message = TorrentPier\BBCode::clean_up($message);
$message = \TorrentPier\Legacy\BBCode::clean_up($message);
$message = htmlCHR($message, false, ENT_NOQUOTES);
return $message;
}
@ -383,7 +383,7 @@ function add_search_words($post_id, $post_message, $topic_title = '', $only_retu
/**
* Dirty class removed from here since 2.2.0
* To add new bbcodes see at src/BBCode.php
* To add new bbcodes see at src/Legacy/BBCode.php
*/
function bbcode2html($text)
@ -391,7 +391,7 @@ function bbcode2html($text)
global $bbcode, $wordCensor;
if (!isset($bbcode)) {
$bbcode = new TorrentPier\BBCode();
$bbcode = new TorrentPier\Legacy\BBCode();
}
$text = $wordCensor->censorString($text);
return $bbcode->bbcode2html($text);
@ -401,7 +401,7 @@ function get_words_rate($text)
{
static $wr = null;
if (!isset($wr)) {
$wr = new TorrentPier\WordsRate();
$wr = new TorrentPier\Legacy\WordsRate();
}
return $wr->get_words_rate($text);
}

View file

@ -12,9 +12,9 @@ if (!defined('BB_ROOT')) {
}
// Synchronization
\TorrentPier\Admin\Common::sync('topic', 'all');
\TorrentPier\Admin\Common::sync('user_posts', 'all');
\TorrentPier\Admin\Common::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();
// Cleaning bb_poll_users
if ($poll_max_days = (int)$bb_cfg['poll_max_days']) {

View file

@ -15,6 +15,6 @@ 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) {
\TorrentPier\Admin\Common::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']));
}
}

View file

@ -45,7 +45,7 @@ while (true) {
}
if ($prune_users = $not_activated_users + $not_active_users) {
\TorrentPier\Admin\Common::user_delete($prune_users);
\TorrentPier\Legacy\Admin\Common::user_delete($prune_users);
}
if (count($prune_users) < $users_per_cycle) {

View file

@ -18,18 +18,18 @@ $forums_data = DB()->fetch_rowset("SELECT forum_id, allow_reg_tracker, forum_nam
if (is_file($bb_cfg['atom']['path'] . '/f/0.atom')) {
if (filemtime($bb_cfg['atom']['path'] . '/f/0.atom') <= $timecheck) {
\TorrentPier\Atom::update_forum_feed(0, $forums_data);
\TorrentPier\Legacy\Atom::update_forum_feed(0, $forums_data);
}
} else {
\TorrentPier\Atom::update_forum_feed(0, $forums_data);
\TorrentPier\Legacy\Atom::update_forum_feed(0, $forums_data);
}
foreach ($forums_data as $forum_data) {
if (is_file($bb_cfg['atom']['path'] . '/f/' . $forum_data['forum_id'] . '.atom')) {
if (filemtime($bb_cfg['atom']['path'] . '/f/' . $forum_data['forum_id'] . '.atom') <= $timecheck) {
\TorrentPier\Atom::update_forum_feed($forum_data['forum_id'], $forum_data);
\TorrentPier\Legacy\Atom::update_forum_feed($forum_data['forum_id'], $forum_data);
}
} else {
\TorrentPier\Atom::update_forum_feed($forum_data['forum_id'], $forum_data);
\TorrentPier\Legacy\Atom::update_forum_feed($forum_data['forum_id'], $forum_data);
}
}

View file

@ -1075,7 +1075,7 @@ function setup_style()
}
}
$template = new TorrentPier\Template(TEMPLATES_DIR . '/' . $tpl_dir_name);
$template = new TorrentPier\Legacy\Template(TEMPLATES_DIR . '/' . $tpl_dir_name);
$css_dir = 'styles/' . basename(TEMPLATES_DIR) . '/' . $tpl_dir_name . '/css/';
$template->assign_vars([
@ -1342,7 +1342,7 @@ function bb_die($msg_text, $status_code = null)
// If the header hasn't been output then do it
if (!defined('PAGE_HEADER_SENT')) {
if (empty($template)) {
$template = new TorrentPier\Template(BB_ROOT . "templates/{$bb_cfg['tpl_name']}");
$template = new TorrentPier\Legacy\Template(BB_ROOT . "templates/{$bb_cfg['tpl_name']}");
}
if (empty($theme)) {
$theme = setup_style();
@ -2004,12 +2004,12 @@ function update_atom($type, $id)
{
switch ($type) {
case 'user':
\TorrentPier\Atom::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');
\TorrentPier\Atom::update_user_feed($topic_poster, get_username($topic_poster));
\TorrentPier\Legacy\Atom::update_user_feed($topic_poster, get_username($topic_poster));
break;
}
}

View file

@ -390,10 +390,10 @@ require_once INC_DIR . '/functions.php';
$bb_cfg = array_merge(bb_get_config(BB_CONFIG), $bb_cfg);
$log_action = new TorrentPier\LogAction();
$log_action = new TorrentPier\Legacy\LogAction();
$wordCensor = new TorrentPier\Censor();
$html = new \TorrentPier\Common\Html();
$user = new \TorrentPier\Common\User();
$html = new TorrentPier\Legacy\Common\Html();
$user = new TorrentPier\Legacy\Common\User();
$userdata =& $user->data;

View file

@ -410,7 +410,7 @@ foreach ($profile_fields as $field => $can_edit) {
$pr_data['avatar_ext_id'] = 0;
$db_data['avatar_ext_id'] = 0;
} elseif (!empty($_FILES['avatar']['name']) && $bb_cfg['avatars']['up_allowed']) {
$upload = new \TorrentPier\Common\Upload();
$upload = new TorrentPier\Legacy\Common\Upload();
if ($upload->init($bb_cfg['avatars'], $_FILES['avatar'], !isset($_POST['use_monster_avatar'])) and $upload->store('avatar', $pr_data)) {
$pr_data['avatar_ext_id'] = $upload->file_ext_id;
@ -565,7 +565,7 @@ foreach ($profile_fields as $field => $can_edit) {
}
}
}
$tp_data['TEMPLATES_SELECT'] = TorrentPier\Select::template($pr_data['tpl_name'], 'tpl_name');
$tp_data['TEMPLATES_SELECT'] = \TorrentPier\Legacy\Select::template($pr_data['tpl_name'], 'tpl_name');
break;
/**
@ -607,7 +607,7 @@ if ($submit && !$errors) {
// Generate passkey
for ($i = 0, $max_try = 3; $i <= $max_try; $i++) {
if (TorrentPier\Torrent::generate_passkey($new_user_id, true)) {
if (\TorrentPier\Legacy\Torrent::generate_passkey($new_user_id, true)) {
break;
}
if ($i == $max_try) {
@ -722,8 +722,8 @@ $template->assign_vars([
'INVITE_CODE' => !empty($_GET['invite']) ? htmlCHR($_GET['invite']) : '',
'CAPTCHA_HTML' => ($need_captcha) ? bb_captcha('get') : '',
'LANGUAGE_SELECT' => TorrentPier\Select::language($pr_data['user_lang'], 'user_lang'),
'TIMEZONE_SELECT' => TorrentPier\Select::timezone($pr_data['user_timezone'], 'user_timezone'),
'LANGUAGE_SELECT' => \TorrentPier\Legacy\Select::language($pr_data['user_lang'], 'user_lang'),
'TIMEZONE_SELECT' => \TorrentPier\Legacy\Select::timezone($pr_data['user_timezone'], 'user_timezone'),
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['avatars']['max_width'], $bb_cfg['avatars']['max_height'], humn_size($bb_cfg['avatars']['max_size'])),
'AVATAR_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_avatar'),

View file

@ -220,7 +220,7 @@ switch ($mode) {
}
if ($confirmed) {
$result = \TorrentPier\Admin\Common::topic_delete($req_topics, $forum_id);
$result = \TorrentPier\Legacy\Admin\Common::topic_delete($req_topics, $forum_id);
//Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
@ -255,7 +255,7 @@ switch ($mode) {
if ($confirmed) {
$new_forum_id = (int)$_POST['new_forum'];
$result = \TorrentPier\Admin\Common::topic_move($req_topics, $new_forum_id, $forum_id, isset($_POST['move_leave_shadow']), isset($_POST['insert_bot_msg']), $_POST['reason_move_bot']);
$result = \TorrentPier\Legacy\Admin\Common::topic_move($req_topics, $new_forum_id, $forum_id, isset($_POST['move_leave_shadow']), isset($_POST['insert_bot_msg']), $_POST['reason_move_bot']);
//Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
@ -491,14 +491,14 @@ switch ($mode) {
//bot
if (isset($_POST['after_split_to_old'])) {
TorrentPier\Post::insert_post('after_split_to_old', $topic_id, $forum_id, '', $new_topic_id, trim($_POST['subject']));
\TorrentPier\Legacy\Post::insert_post('after_split_to_old', $topic_id, $forum_id, '', $new_topic_id, trim($_POST['subject']));
}
if (isset($_POST['after_split_to_new'])) {
TorrentPier\Post::insert_post('after_split_to_new', $new_topic_id, $new_forum_id, $forum_id, $new_topic_id, '', $topic_id);
\TorrentPier\Legacy\Post::insert_post('after_split_to_new', $new_topic_id, $new_forum_id, $forum_id, $new_topic_id, '', $topic_id);
}
\TorrentPier\Admin\Common::sync('topic', [$topic_id, $new_topic_id]);
\TorrentPier\Admin\Common::sync('forum', [$forum_id, $new_forum_id]);
\TorrentPier\Legacy\Admin\Common::sync('topic', [$topic_id, $new_topic_id]);
\TorrentPier\Legacy\Admin\Common::sync('forum', [$forum_id, $new_forum_id]);
//bot
$message = $lang['TOPIC_SPLIT'] . '<br /><br /><a href="' . TOPIC_URL . "$topic_id&amp;sid=" . $userdata['session_id'] . '">' . $lang['TOPIC_SPLIT_OLD'] . '</a>';
@ -522,7 +522,7 @@ switch ($mode) {
}
// Delete posts
$result = \TorrentPier\Admin\Common::post_delete(explode(',', $post_id_sql));
$result = \TorrentPier\Legacy\Admin\Common::post_delete(explode(',', $post_id_sql));
$msg = $result ? $lang['DELETE_POSTS_SUCCESFULLY'] : $lang['NO_POSTS_REMOVED'];
bb_die(return_msg_mcp($msg));

View file

@ -24,7 +24,7 @@ $return_topic_url .= !empty($_POST['start']) ? "&amp;start=" . (int)$_POST['star
set_die_append_msg($forum_id, $topic_id);
$poll = new TorrentPier\Poll();
$poll = new TorrentPier\Legacy\Poll();
// Checking $topic_id
if (!$topic_id) {
@ -68,7 +68,7 @@ switch ($mode) {
}
// Checking that poll has not been finished
if (!TorrentPier\Poll::pollIsActive($t_data)) {
if (!\TorrentPier\Legacy\Poll::pollIsActive($t_data)) {
bb_die($lang['NEW_POLL_ENDED']);
}
@ -76,7 +76,7 @@ switch ($mode) {
bb_die($lang['NO_VOTE_OPTION']);
}
if (TorrentPier\Poll::userIsAlreadyVoted($topic_id, (int)$userdata['user_id'])) {
if (\TorrentPier\Legacy\Poll::userIsAlreadyVoted($topic_id, (int)$userdata['user_id'])) {
bb_die($lang['ALREADY_VOTED']);
}

View file

@ -334,12 +334,12 @@ if (($delete || $mode == 'delete') && !$confirm) {
$attach_rg_sig = (isset($_POST['attach_rg_sig'], $_POST['poster_rg']) && $_POST['poster_rg'] != -1) ? 1 : 0;
$poster_rg_id = (isset($_POST['poster_rg']) && $_POST['poster_rg'] != -1) ? (int)$_POST['poster_rg'] : 0;
TorrentPier\Post::prepare_post($mode, $post_data, $error_msg, $username, $subject, $message);
\TorrentPier\Legacy\Post::prepare_post($mode, $post_data, $error_msg, $username, $subject, $message);
if (!$error_msg) {
$topic_type = (isset($post_data['topic_type']) && $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce']) ? $post_data['topic_type'] : $topic_type;
TorrentPier\Post::submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $topic_type, DB()->escape($username), DB()->escape($subject), DB()->escape($message), $update_post_time, $poster_rg_id, $attach_rg_sig, (int)$robots_indexing);
\TorrentPier\Legacy\Post::submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $topic_type, DB()->escape($username), DB()->escape($subject), DB()->escape($message), $update_post_time, $poster_rg_id, $attach_rg_sig, (int)$robots_indexing);
$post_url = POST_URL . "$post_id#$post_id";
$post_msg = ($mode == 'editpost') ? $lang['EDITED'] : $lang['STORED'];
@ -352,7 +352,7 @@ if (($delete || $mode == 'delete') && !$confirm) {
case 'delete':
if (!$post_data['first_post']) {
TorrentPier\Post::delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id);
\TorrentPier\Legacy\Post::delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id);
} else {
redirect('modcp.php?' . POST_TOPIC_URL . "=$topic_id&mode=delete&sid=" . $userdata['session_id']);
}
@ -362,12 +362,12 @@ if (($delete || $mode == 'delete') && !$confirm) {
if (!$error_msg) {
if (!in_array($mode, ['editpost', 'delete'])) {
$user_id = ($mode == 'reply' || $mode == 'newtopic') ? $userdata['user_id'] : $post_data['poster_id'];
TorrentPier\Post::update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
\TorrentPier\Legacy\Post::update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
}
$attachment_mod['posting']->insert_attachment($post_id);
if (!$error_msg) {
TorrentPier\Post::user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $notify_user);
\TorrentPier\Legacy\Post::user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $notify_user);
}
if ($mode == 'newtopic' || $mode == 'reply') {
@ -401,12 +401,12 @@ if (($delete || $mode == 'delete') && !$confirm) {
LIMIT 1
", 'checked_releases');
if ($count_checked_releases || IS_AM) {
TorrentPier\Torrent::tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
\TorrentPier\Legacy\Torrent::tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
} else {
TorrentPier\Torrent::tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_PREMOD);
\TorrentPier\Legacy\Torrent::tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_PREMOD);
}
} else {
TorrentPier\Torrent::tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
\TorrentPier\Legacy\Torrent::tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
}
}
}
@ -647,7 +647,7 @@ if ($mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post'])
// Topic review
if ($mode == 'reply' && $is_auth['auth_read']) {
TorrentPier\Post::topic_review($topic_id);
\TorrentPier\Legacy\Post::topic_review($topic_id);
}
require(PAGE_HEADER);

View file

@ -7,13 +7,13 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Admin;
namespace TorrentPier\Legacy\Admin;
use TorrentPier\Post;
use TorrentPier\Legacy\Post;
/**
* Class Common
* @package TorrentPier\Admin
* @package TorrentPier\Legacy\Admin
*/
class Common
{

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Admin;
namespace TorrentPier\Legacy\Admin;
/**
* Class Cron
* @package TorrentPier\Admin
* @package TorrentPier\Legacy\Admin
*/
class Cron
{

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Admin;
namespace TorrentPier\Legacy\Admin;
/**
* Class Torrent
* @package TorrentPier\Admin
* @package TorrentPier\Legacy\Admin
*/
class Torrent
{

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
/**
* Class Atom
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class Atom
{

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
/**
* Class Attach
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class Attach
{
@ -67,7 +67,7 @@ class Attach
$this->attachment_extension_list = get_var('extension_list', ['']);
$this->attachment_mimetype_list = get_var('mimetype_list', ['']);
$this->filename = (isset($_FILES['fileupload']['name']) && $_FILES['fileupload']['name'] !== 'none') ? trim(stripslashes($_FILES['fileupload']['name'])) : '';
$this->filename = (isset($_FILES['fileupload'], $_FILES['fileupload']['name']) && $_FILES['fileupload']['name'] !== 'none') ? trim(stripslashes($_FILES['fileupload']['name'])) : '';
$this->attachment_list = get_var('attachment_list', ['']);
$this->attachment_thumbnail_list = get_var('attach_thumbnail_list', [0]);
@ -431,7 +431,7 @@ class Attach
}
}
// Get current information to delete the Old Attachment
// Get current informations to delete the Old Attachment
$sql = 'SELECT physical_filename, comment, thumbnail
FROM ' . BB_ATTACHMENTS_DESC . '
WHERE attach_id = ' . (int)$attachment_id;

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
/**
* Class AttachPosting
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class AttachPosting extends Attach
{

View file

@ -7,11 +7,13 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
use function in_array;
/**
* Class BBCode
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class BBCode
{

View file

@ -7,15 +7,17 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Cache;
namespace TorrentPier\Legacy\Cache;
use TorrentPier\Dev;
use MatthiasMullie\Scrapbook\Adapters\Apc;
use Exception;
use MatthiasMullie\Scrapbook\Adapters\Apc;
use TorrentPier\Dev;
/**
* Class APCu
* @package TorrentPier\Cache
* @package TorrentPier\Legacy\Cache
*/
class APCu extends Common
{

View file

@ -7,13 +7,13 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Cache;
namespace TorrentPier\Legacy\Cache;
use TorrentPier\Dev;
/**
* Class Common
* @package TorrentPier\Cache
* @package TorrentPier\Legacy\Cache
*/
class Common
{

View file

@ -7,16 +7,17 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Cache;
namespace TorrentPier\Legacy\Cache;
use TorrentPier\Dev;
use League\Flysystem\Filesystem;
use League\Flysystem\Local\LocalFilesystemAdapter;
use MatthiasMullie\Scrapbook\Adapters\Flysystem;
use TorrentPier\Dev;
/**
* Class File
* @package TorrentPier\Cache
* @package TorrentPier\Legacy\Cache
*/
class File extends Common
{

View file

@ -7,16 +7,18 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Cache;
namespace TorrentPier\Legacy\Cache;
use TorrentPier\Dev;
use Memcached as MemcachedClient;
use MatthiasMullie\Scrapbook\Adapters\Memcached as MemcachedCache;
use Exception;
use MatthiasMullie\Scrapbook\Adapters\Memcached as MemcachedCache;
use Memcached as MemcachedClient;
use TorrentPier\Dev;
/**
* Class Memcached
* @package TorrentPier\Cache
* @package TorrentPier\Legacy\Cache
*/
class Memcached extends Common
{

View file

@ -7,16 +7,18 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Cache;
namespace TorrentPier\Legacy\Cache;
use TorrentPier\Dev;
use Redis as RedisClient;
use MatthiasMullie\Scrapbook\Adapters\Redis as RedisCache;
use Exception;
use MatthiasMullie\Scrapbook\Adapters\Redis as RedisCache;
use Redis as RedisClient;
use TorrentPier\Dev;
/**
* Class Redis
* @package TorrentPier\Cache
* @package TorrentPier\Legacy\Cache
*/
class Redis extends Common
{

View file

@ -7,16 +7,18 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Cache;
namespace TorrentPier\Legacy\Cache;
use TorrentPier\Dev;
use Exception;
use MatthiasMullie\Scrapbook\Adapters\SQLite as SQLiteCache;
use PDO;
use TorrentPier\Dev;
use Exception;
/**
* Class Sqlite
* @package TorrentPier\Cache
* @package TorrentPier\Legacy\Cache
*/
class Sqlite extends Common
{

View file

@ -7,18 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
use TorrentPier\Cache\APCu;
use TorrentPier\Cache\Common;
use TorrentPier\Cache\File;
use TorrentPier\Cache\Memcached;
use TorrentPier\Cache\Redis;
use TorrentPier\Cache\Sqlite;
namespace TorrentPier\Legacy;
/**
* Class Caches
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class Caches
{
@ -29,7 +22,7 @@ class Caches
public function __construct($cfg)
{
$this->cfg = $cfg['cache'];
$this->obj['__stub'] = new Common();
$this->obj['__stub'] = new Cache\Common();
}
public function get_cache_obj($cache_name)
@ -43,32 +36,32 @@ class Caches
switch ($cache_type) {
case 'apcu':
if (!isset($this->obj[$cache_name])) {
$this->obj[$cache_name] = new APCu($this->cfg['prefix']);
$this->obj[$cache_name] = new Cache\APCu($this->cfg['prefix']);
}
$this->ref[$cache_name] =& $this->obj[$cache_name];
break;
case 'memcached':
if (!isset($this->obj[$cache_name])) {
$this->obj[$cache_name] = new Memcached($this->cfg['memcached'], $this->cfg['prefix']);
$this->obj[$cache_name] = new Cache\Memcached($this->cfg['memcached'], $this->cfg['prefix']);
}
$this->ref[$cache_name] =& $this->obj[$cache_name];
break;
case 'sqlite':
if (!isset($this->obj[$cache_name])) {
$this->obj[$cache_name] = new Sqlite($this->cfg['db_dir'] . $cache_name, $this->cfg['prefix']);
$this->obj[$cache_name] = new Cache\Sqlite($this->cfg['db_dir'] . $cache_name, $this->cfg['prefix']);
}
$this->ref[$cache_name] =& $this->obj[$cache_name];
break;
case 'redis':
if (!isset($this->obj[$cache_name])) {
$this->obj[$cache_name] = new Redis($this->cfg['redis'], $this->cfg['prefix']);
$this->obj[$cache_name] = new Cache\Redis($this->cfg['redis'], $this->cfg['prefix']);
}
$this->ref[$cache_name] =& $this->obj[$cache_name];
break;
case 'filecache':
default:
if (!isset($this->obj[$cache_name])) {
$this->obj[$cache_name] = new File($this->cfg['db_dir'] . $cache_name . '/', $this->cfg['prefix']);
$this->obj[$cache_name] = new Cache\File($this->cfg['db_dir'] . $cache_name . '/', $this->cfg['prefix']);
}
$this->ref[$cache_name] =& $this->obj[$cache_name];
break;

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Common;
namespace TorrentPier\Legacy\Common;
/**
* Class Html
* @package TorrentPier\Common
* @package TorrentPier\Legacy\Common
*/
class Html
{

View file

@ -7,14 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Common;
use claviska\SimpleImage;
use Exception;
namespace TorrentPier\Legacy\Common;
/**
* Class Upload
* @package TorrentPier\Common
* @package TorrentPier\Legacy\Common
*/
class Upload
{
@ -168,14 +165,14 @@ class Upload
if (($this->cfg['max_width'] && $width > $this->cfg['max_width']) || ($this->cfg['max_height'] && $height > $this->cfg['max_height'])) {
for ($i = 0, $max_try = 3; $i <= $max_try; $i++) {
try {
$image = new SimpleImage();
$image = new \claviska\SimpleImage();
$image
->fromFile($this->file['tmp_name'])
->autoOrient()
->resize($this->cfg['max_width'], $this->cfg['max_height'])
->toFile($this->file['tmp_name']);
break;
} catch (Exception $e) {
} catch (\Exception $e) {
if ($i == $max_try) {
$this->errors[] = sprintf($lang['UPLOAD_ERROR_DIMENSIONS'], $this->cfg['max_width'], $this->cfg['max_height']);
return false;

View file

@ -7,15 +7,16 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Common;
namespace TorrentPier\Legacy\Common;
use TorrentPier\Legacy\DateDelta;
use TorrentPier\Sessions;
use Exception;
use TorrentPier\DateDelta;
use TorrentPier\Sessions;
/**
* Class User
* @package TorrentPier\Common
* @package TorrentPier\Legacy\Common
*/
class User
{

View file

@ -7,15 +7,17 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Datastore;
namespace TorrentPier\Legacy\Datastore;
use TorrentPier\Dev;
use MatthiasMullie\Scrapbook\Adapters\Apc;
use Exception;
use MatthiasMullie\Scrapbook\Adapters\Apc;
use TorrentPier\Dev;
/**
* Class APCu
* @package TorrentPier\Datastore
* @package TorrentPier\Legacy\Datastore
*/
class APCu extends Common
{

View file

@ -7,13 +7,13 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Datastore;
namespace TorrentPier\Legacy\Datastore;
use TorrentPier\Dev;
/**
* Class Common
* @package TorrentPier\Datastore
* @package TorrentPier\Legacy\Datastore
*/
class Common
{

View file

@ -7,16 +7,17 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Datastore;
namespace TorrentPier\Legacy\Datastore;
use TorrentPier\Dev;
use League\Flysystem\Filesystem;
use League\Flysystem\Local\LocalFilesystemAdapter;
use MatthiasMullie\Scrapbook\Adapters\Flysystem;
use TorrentPier\Dev;
/**
* Class File
* @package TorrentPier\Datastore
* @package TorrentPier\Legacy\Datastore
*/
class File extends Common
{

View file

@ -7,16 +7,18 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Datastore;
namespace TorrentPier\Legacy\Datastore;
use TorrentPier\Dev;
use Memcached as MemcachedClient;
use MatthiasMullie\Scrapbook\Adapters\Memcached as MemcachedCache;
use Exception;
use MatthiasMullie\Scrapbook\Adapters\Memcached as MemcachedCache;
use Memcached as MemcachedClient;
use TorrentPier\Dev;
/**
* Class Memcached
* @package TorrentPier\Datastore
* @package TorrentPier\Legacy\Datastore
*/
class Memcached extends Common
{

View file

@ -7,16 +7,18 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Datastore;
namespace TorrentPier\Legacy\Datastore;
use TorrentPier\Dev;
use Redis as RedisClient;
use MatthiasMullie\Scrapbook\Adapters\Redis as RedisCache;
use Exception;
use MatthiasMullie\Scrapbook\Adapters\Redis as RedisCache;
use Redis as RedisClient;
use TorrentPier\Dev;
/**
* Class Redis
* @package TorrentPier\Datastore
* @package TorrentPier\Legacy\Datastore
*/
class Redis extends Common
{

View file

@ -7,16 +7,18 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier\Datastore;
namespace TorrentPier\Legacy\Datastore;
use TorrentPier\Dev;
use Exception;
use MatthiasMullie\Scrapbook\Adapters\SQLite as SQLiteCache;
use PDO;
use TorrentPier\Dev;
use Exception;
/**
* Class Sqlite
* @package TorrentPier\Datastore
* @package TorrentPier\Legacy\Datastore
*/
class Sqlite extends Common
{

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
/**
* Class DateDelta
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class DateDelta
{

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
/**
* Class Dbs
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class Dbs
{

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
/**
* Class Group
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class Group
{

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
/**
* Class LogAction
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class LogAction
{

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
/**
* Class Poll
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class Poll
{

View file

@ -7,13 +7,16 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
use TorrentPier\Admin\Common;
use TorrentPier\Emailer;
use TorrentPier\IndexNow;
use TorrentPier\Legacy\Admin\Common;
use TorrentPier\Validate;
/**
* Class Post
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class Post
{
@ -53,7 +56,6 @@ class Post
// Check message
if (!empty($message)) {
// todo
} elseif ($mode != 'delete') {
$error_msg .= (!empty($error_msg)) ? '<br />' . $lang['EMPTY_MESSAGE'] : $lang['EMPTY_MESSAGE'];
}

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
/**
* Class Select
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class Select
{

View file

@ -7,13 +7,15 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
use mysqli_result;
use TorrentPier\Dev;
/**
* Class SqlDb
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class SqlDb
{
@ -657,7 +659,7 @@ class SqlDb
$this->init();
}
return "{$this->selected_db}_$name";
return "{$this->selected_db}_{$name}";
}
/**

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
/**
* Class Template
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class Template
{

View file

@ -7,15 +7,18 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
use TorrentPier\TorrServerAPI;
use Arokettu\Bencode\Bencode;
use Arokettu\Bencode\Bencode\Collection;
use Exception;
/**
* Class Torrent
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class Torrent
{

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
/**
* Class TorrentFileList
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class TorrentFileList
{

View file

@ -7,11 +7,11 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
namespace TorrentPier;
namespace TorrentPier\Legacy;
/**
* Class WordsRate
* @package TorrentPier
* @package TorrentPier\Legacy
*/
class WordsRate
{

View file

@ -223,7 +223,7 @@ foreach ($s_not_seen_opt as $val => $opt) {
$s_not_seen_select[$opt['lang']] = $val;
}
if ($release_groups = TorrentPier\Group::get_group_data('all')) {
if ($release_groups = \TorrentPier\Legacy\Group::get_group_data('all')) {
$s_rg_opt = array(
$search_all => array(
'lang' => $lang['CHOOSE_RELEASE_GROUP'],
@ -713,7 +713,7 @@ if ($allowed_forums) {
$s_last = $tor['seeder_last_seen'];
$att_id = $tor['attach_id'];
$size = $tor['size'];
$tor_magnet = create_magnet($tor['info_hash'], $tor['info_hash_v2'], TorrentPier\Torrent::getPasskey($user_id), html_ent_decode($tor['topic_title']));
$tor_magnet = create_magnet($tor['info_hash'], $tor['info_hash_v2'], \TorrentPier\Legacy\Torrent::getPasskey($user_id), html_ent_decode($tor['topic_title']));
$compl = $tor['complete_count'];
$dl_sp = $dl ? humn_size($dl, 0, 'KB') . '/s' : '0 KB/s';
$ul_sp = $ul ? humn_size($ul, 0, 'KB') . '/s' : '0 KB/s';

View file

@ -538,14 +538,14 @@ if (!DB()->sql_query($sql)) {
// Does this topic contain a poll?
//
if ($topic_has_poll) {
$poll_votes_js = TorrentPier\Poll::get_poll_data_items_js($topic_id);
$poll_votes_js = \TorrentPier\Legacy\Poll::get_poll_data_items_js($topic_id);
if (!$poll_votes_js) {
$template->assign_vars(['TOPIC_HAS_POLL' => false]);
} else {
$template->assign_vars([
'SHOW_VOTE_BTN' => TorrentPier\Poll::pollIsActive($t_data),
'POLL_ALREADY_VOTED' => TorrentPier\Poll::userIsAlreadyVoted($topic_id, (int)$userdata['user_id']),
'SHOW_VOTE_BTN' => \TorrentPier\Legacy\Poll::pollIsActive($t_data),
'POLL_ALREADY_VOTED' => \TorrentPier\Legacy\Poll::userIsAlreadyVoted($topic_id, (int)$userdata['user_id']),
'POLL_VOTES_JS' => $poll_votes_js
]);
}