From 380c94ff07b1bb74c6501c9fda25577c21ac6cd5 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sun, 2 Mar 2025 10:07:04 +0300 Subject: [PATCH] Revert "refactor: Moved classes from `Legacy` folder to `src` root (#1828)" This reverts commit 92ce77ec0ec703c08a659419087a373f76e711f7. --- admin/admin_board.php | 4 ++-- admin/admin_bt_forum_cfg.php | 22 +++++++++--------- admin/admin_cron.php | 18 +++++++-------- admin/admin_forum_prune.php | 2 +- admin/admin_forums.php | 8 +++---- admin/admin_groups.php | 14 +++++------ admin/admin_ug_auth.php | 22 +++++++++--------- admin/admin_user_search.php | 4 ++-- ajax.php | 2 +- common.php | 14 +++++------ dl.php | 2 +- feed.php | 4 ++-- group.php | 12 +++++----- group_edit.php | 4 ++-- library/ajax/change_tor_status.php | 2 +- library/ajax/change_torrent.php | 12 +++++----- library/ajax/edit_group_profile.php | 2 +- library/ajax/manage_admin.php | 8 +++---- library/ajax/manage_user.php | 8 +++---- library/ajax/mod_action.php | 2 +- library/ajax/passkey.php | 4 ++-- library/ajax/posts.php | 6 ++--- library/ajax/view_torrent.php | 2 +- library/attach_mod/displaying_torrent.php | 2 +- library/attach_mod/posting_attachments.php | 2 +- library/includes/bbcode.php | 8 +++---- .../includes/cron/jobs/board_maintenance.php | 6 ++--- library/includes/cron/jobs/prune_forums.php | 2 +- .../cron/jobs/prune_inactive_users.php | 2 +- .../includes/cron/jobs/update_forums_atom.php | 8 +++---- library/includes/functions.php | 8 +++---- library/includes/init_bb.php | 6 ++--- library/includes/ucp/register.php | 10 ++++---- modcp.php | 14 +++++------ poll.php | 6 ++--- posting.php | 18 +++++++-------- src/{ => Legacy}/Admin/Common.php | 6 ++--- src/{ => Legacy}/Admin/Cron.php | 4 ++-- src/{ => Legacy}/Admin/Torrent.php | 4 ++-- src/{ => Legacy}/Atom.php | 4 ++-- src/{ => Legacy}/Attach.php | 8 +++---- src/{ => Legacy}/AttachPosting.php | 4 ++-- src/{ => Legacy}/BBCode.php | 6 +++-- src/{ => Legacy}/Cache/APCu.php | 10 ++++---- src/{ => Legacy}/Cache/Common.php | 4 ++-- src/{ => Legacy}/Cache/File.php | 7 +++--- src/{ => Legacy}/Cache/Memcached.php | 12 ++++++---- src/{ => Legacy}/Cache/Redis.php | 12 ++++++---- src/{ => Legacy}/Cache/Sqlite.php | 10 ++++---- src/{ => Legacy}/Caches.php | 23 +++++++------------ src/{ => Legacy}/Common/Html.php | 4 ++-- src/{ => Legacy}/Common/Upload.php | 11 ++++----- src/{ => Legacy}/Common/User.php | 9 ++++---- src/{ => Legacy}/Datastore/APCu.php | 10 ++++---- src/{ => Legacy}/Datastore/Common.php | 4 ++-- src/{ => Legacy}/Datastore/File.php | 7 +++--- src/{ => Legacy}/Datastore/Memcached.php | 12 ++++++---- src/{ => Legacy}/Datastore/Redis.php | 12 ++++++---- src/{ => Legacy}/Datastore/Sqlite.php | 10 ++++---- src/{ => Legacy}/DateDelta.php | 4 ++-- src/{ => Legacy}/Dbs.php | 4 ++-- src/{ => Legacy}/Group.php | 4 ++-- src/{ => Legacy}/LogAction.php | 4 ++-- src/{ => Legacy}/Poll.php | 4 ++-- src/{ => Legacy}/Post.php | 10 ++++---- src/{ => Legacy}/Select.php | 4 ++-- src/{ => Legacy}/SqlDb.php | 8 ++++--- src/{ => Legacy}/Template.php | 4 ++-- src/{ => Legacy}/Torrent.php | 7 ++++-- src/{ => Legacy}/TorrentFileList.php | 4 ++-- src/{ => Legacy}/WordsRate.php | 4 ++-- tracker.php | 4 ++-- viewtopic.php | 6 ++--- 73 files changed, 276 insertions(+), 258 deletions(-) rename src/{ => Legacy}/Admin/Common.php (99%) rename src/{ => Legacy}/Admin/Cron.php (98%) rename src/{ => Legacy}/Admin/Torrent.php (98%) rename src/{ => Legacy}/Atom.php (99%) rename src/{ => Legacy}/Attach.php (99%) rename src/{ => Legacy}/AttachPosting.php (98%) rename src/{ => Legacy}/BBCode.php (99%) rename src/{ => Legacy}/Cache/APCu.php (97%) rename src/{ => Legacy}/Cache/Common.php (97%) rename src/{ => Legacy}/Cache/File.php (97%) rename src/{ => Legacy}/Cache/Memcached.php (98%) rename src/{ => Legacy}/Cache/Redis.php (98%) rename src/{ => Legacy}/Cache/Sqlite.php (97%) rename src/{ => Legacy}/Caches.php (72%) rename src/{ => Legacy}/Common/Html.php (98%) rename src/{ => Legacy}/Common/Upload.php (97%) rename src/{ => Legacy}/Common/User.php (99%) rename src/{ => Legacy}/Datastore/APCu.php (97%) rename src/{ => Legacy}/Datastore/Common.php (98%) rename src/{ => Legacy}/Datastore/File.php (97%) rename src/{ => Legacy}/Datastore/Memcached.php (98%) rename src/{ => Legacy}/Datastore/Redis.php (98%) rename src/{ => Legacy}/Datastore/Sqlite.php (97%) rename src/{ => Legacy}/DateDelta.php (98%) rename src/{ => Legacy}/Dbs.php (96%) rename src/{ => Legacy}/Group.php (99%) rename src/{ => Legacy}/LogAction.php (98%) rename src/{ => Legacy}/Poll.php (98%) rename src/{ => Legacy}/Post.php (99%) rename src/{ => Legacy}/Select.php (97%) rename src/{ => Legacy}/SqlDb.php (99%) rename src/{ => Legacy}/Template.php (99%) rename src/{ => Legacy}/Torrent.php (99%) rename src/{ => Legacy}/TorrentFileList.php (98%) rename src/{ => Legacy}/WordsRate.php (97%) diff --git a/admin/admin_board.php b/admin/admin_board.php index 0fdb5bb0d..b836ff29f 100644 --- a/admin/admin_board.php +++ b/admin/admin_board.php @@ -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'], diff --git a/admin/admin_bt_forum_cfg.php b/admin/admin_bt_forum_cfg.php index cdd11389a..75453e0ca 100644 --- a/admin/admin_bt_forum_cfg.php +++ b/admin/admin_bt_forum_cfg.php @@ -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.* diff --git a/admin/admin_cron.php b/admin/admin_cron.php index 8beb6ec2e..757108ec0 100644 --- a/admin/admin_cron.php +++ b/admin/admin_cron.php @@ -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'] . '

' . sprintf($lang['CLICK_RETURN_JOBS'], '', '') . '

' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '', '')); 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)); } } diff --git a/admin/admin_forum_prune.php b/admin/admin_forum_prune.php index e3f16b373..97a3a539b 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 = \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; diff --git a/admin/admin_forums.php b/admin/admin_forums.php index 7bbf024b2..8a195bb64 100644 --- a/admin/admin_forums.php +++ b/admin/admin_forums.php @@ -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(); diff --git a/admin/admin_groups.php b/admin/admin_groups.php index 1fee66982..69361639d 100644 --- a/admin/admin_groups.php +++ b/admin/admin_groups.php @@ -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'] . '

'; $message .= sprintf($lang['CLICK_RETURN_GROUPSADMIN'], '', '') . '

'; @@ -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'] . '

'; $message .= sprintf($lang['CLICK_RETURN_GROUPSADMIN'], '', '') . '

'; diff --git a/admin/admin_ug_auth.php b/admin/admin_ug_auth.php index db5d5f644..b6914f4dd 100644 --- a/admin/admin_ug_auth.php +++ b/admin/admin_ug_auth.php @@ -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'] . '

'; $message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '', '') . '

'; @@ -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'] . '

'; $message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '', '') . '

'; @@ -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'] . '

'; @@ -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'] . '

'; @@ -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']); } diff --git a/admin/admin_user_search.php b/admin/admin_user_search.php index c9bb93351..4a29d0e06 100644 --- a/admin/admin_user_search.php +++ b/admin/admin_user_search.php @@ -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 ) diff --git a/ajax.php b/ajax.php index abe638c8e..dad885165 100644 --- a/ajax.php +++ b/ajax.php @@ -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 */ diff --git a/common.php b/common.php index 3cb9951f0..a455a7de2 100644 --- a/common.php +++ b/common.php @@ -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 diff --git a/dl.php b/dl.php index ac2b0b8d9..2812f1fa0 100644 --- a/dl.php +++ b/dl.php @@ -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 diff --git a/feed.php b/feed.php index 68f61ee32..366518ef0 100644 --- a/feed.php +++ b/feed.php @@ -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']); diff --git a/group.php b/group.php index 4b690d3ad..237b12357 100644 --- a/group.php +++ b/group.php @@ -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 diff --git a/group_edit.php b/group_edit.php index 258765dac..f98e69aed 100644 --- a/group_edit.php +++ b/group_edit.php @@ -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; diff --git a/library/ajax/change_tor_status.php b/library/ajax/change_tor_status.php index 94f80c30a..0ece009cb 100644 --- a/library/ajax/change_tor_status.php +++ b/library/ajax/change_tor_status.php @@ -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] . ' ' . $lang['TOR_STATUS_NAME'][$new_status] . '', $bb_cfg['tor_icons'][$tor['tor_status']] . ' ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . ''); diff --git a/library/ajax/change_torrent.php b/library/ajax/change_torrent.php index 33df83265..ca26b7c24 100644 --- a/library/ajax/change_torrent.php +++ b/library/ajax/change_torrent.php @@ -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; } diff --git a/library/ajax/edit_group_profile.php b/library/ajax/edit_group_profile.php index 85eb64c86..1a40f941f 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 = 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']) { diff --git a/library/ajax/manage_admin.php b/library/ajax/manage_admin.php index 9128096a5..cb0249239 100644 --- a/library/ajax/manage_admin.php +++ b/library/ajax/manage_admin.php @@ -66,16 +66,16 @@ switch ($mode) { $this->response['indexer_html'] = '' . $lang['INDEXER'] . ''; break; case 'update_user_level': - TorrentPier\Group::update_user_level('all'); + \TorrentPier\Legacy\Group::update_user_level('all'); $this->response['update_user_level_html'] = '' . $lang['USER_LEVELS_UPDATED'] . ''; 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'] = '' . $lang['TOPICS_DATA_SYNCHRONIZED'] . ''; 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'] = '' . $lang['USER_POSTS_COUNT_SYNCHRONIZED'] . ''; break; case 'unlock_cron': diff --git a/library/ajax/manage_user.php b/library/ajax/manage_user.php index f989c91b7..8a1e4b25e 100644 --- a/library/ajax/manage_user.php +++ b/library/ajax/manage_user.php @@ -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': diff --git a/library/ajax/mod_action.php b/library/ajax/mod_action.php index 76e7be7ba..0817f7e4e 100644 --- a/library/ajax/mod_action.php +++ b/library/ajax/mod_action.php @@ -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] . ' ' . $lang['TOR_STATUS_NAME'][$status] . '', $bb_cfg['tor_icons'][$tor['tor_status']] . ' ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . ''); diff --git a/library/ajax/passkey.php b/library/ajax/passkey.php index dd518e43d..3cf156ecf 100644 --- a/library/ajax/passkey.php +++ b/library/ajax/passkey.php @@ -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: diff --git a/library/ajax/posts.php b/library/ajax/posts.php index 68e3ad1fc..e34b8b2c1 100644 --- a/library/ajax/posts.php +++ b/library/ajax/posts.php @@ -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 diff --git a/library/ajax/view_torrent.php b/library/ajax/view_torrent.php index 3b036fcde..942a32b11 100644 --- a/library/ajax/view_torrent.php +++ b/library/ajax/view_torrent.php @@ -36,7 +36,7 @@ try { return; } -$torrent = new TorrentPier\TorrentFileList($tor); +$torrent = new TorrentPier\Legacy\TorrentFileList($tor); $tor_filelist = $torrent->get_filelist(); diff --git a/library/attach_mod/displaying_torrent.php b/library/attach_mod/displaying_torrent.php index 087470990..373b6b863 100644 --- a/library/attach_mod/displaying_torrent.php +++ b/library/attach_mod/displaying_torrent.php @@ -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 diff --git a/library/attach_mod/posting_attachments.php b/library/attach_mod/posting_attachments.php index f5331ef77..cfc5f7468 100644 --- a/library/attach_mod/posting_attachments.php +++ b/library/attach_mod/posting_attachments.php @@ -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(); } diff --git a/library/includes/bbcode.php b/library/includes/bbcode.php index fa5305713..29ea40982 100644 --- a/library/includes/bbcode.php +++ b/library/includes/bbcode.php @@ -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); } diff --git a/library/includes/cron/jobs/board_maintenance.php b/library/includes/cron/jobs/board_maintenance.php index cc34ae9e8..8c47d34fb 100644 --- a/library/includes/cron/jobs/board_maintenance.php +++ b/library/includes/cron/jobs/board_maintenance.php @@ -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']) { diff --git a/library/includes/cron/jobs/prune_forums.php b/library/includes/cron/jobs/prune_forums.php index 8674140a7..722aef2c5 100644 --- a/library/includes/cron/jobs/prune_forums.php +++ b/library/includes/cron/jobs/prune_forums.php @@ -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'])); } } diff --git a/library/includes/cron/jobs/prune_inactive_users.php b/library/includes/cron/jobs/prune_inactive_users.php index c6c9ac56f..92b271a91 100644 --- a/library/includes/cron/jobs/prune_inactive_users.php +++ b/library/includes/cron/jobs/prune_inactive_users.php @@ -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) { diff --git a/library/includes/cron/jobs/update_forums_atom.php b/library/includes/cron/jobs/update_forums_atom.php index 9366c3ab3..e6151add0 100644 --- a/library/includes/cron/jobs/update_forums_atom.php +++ b/library/includes/cron/jobs/update_forums_atom.php @@ -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); } } diff --git a/library/includes/functions.php b/library/includes/functions.php index b4a36d84d..edb43d26f 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -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; } } diff --git a/library/includes/init_bb.php b/library/includes/init_bb.php index 347fe448b..05d51880c 100644 --- a/library/includes/init_bb.php +++ b/library/includes/init_bb.php @@ -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; diff --git a/library/includes/ucp/register.php b/library/includes/ucp/register.php index a7680ada3..111e67ce4 100644 --- a/library/includes/ucp/register.php +++ b/library/includes/ucp/register.php @@ -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'), diff --git a/modcp.php b/modcp.php index ad41229e7..33a578ac7 100644 --- a/modcp.php +++ b/modcp.php @@ -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'] . '

' . $lang['TOPIC_SPLIT_OLD'] . ''; @@ -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)); diff --git a/poll.php b/poll.php index 10d0acfc4..f64d04b70 100644 --- a/poll.php +++ b/poll.php @@ -24,7 +24,7 @@ $return_topic_url .= !empty($_POST['start']) ? "&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']); } diff --git a/posting.php b/posting.php index 2b9db9b34..39d44c373 100644 --- a/posting.php +++ b/posting.php @@ -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); diff --git a/src/Admin/Common.php b/src/Legacy/Admin/Common.php similarity index 99% rename from src/Admin/Common.php rename to src/Legacy/Admin/Common.php index b304cbb2a..eeb5bbeda 100644 --- a/src/Admin/Common.php +++ b/src/Legacy/Admin/Common.php @@ -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 { diff --git a/src/Admin/Cron.php b/src/Legacy/Admin/Cron.php similarity index 98% rename from src/Admin/Cron.php rename to src/Legacy/Admin/Cron.php index 35fd44571..451152160 100644 --- a/src/Admin/Cron.php +++ b/src/Legacy/Admin/Cron.php @@ -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 { diff --git a/src/Admin/Torrent.php b/src/Legacy/Admin/Torrent.php similarity index 98% rename from src/Admin/Torrent.php rename to src/Legacy/Admin/Torrent.php index fe7930a4d..d0e1b80ad 100644 --- a/src/Admin/Torrent.php +++ b/src/Legacy/Admin/Torrent.php @@ -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 { diff --git a/src/Atom.php b/src/Legacy/Atom.php similarity index 99% rename from src/Atom.php rename to src/Legacy/Atom.php index 557a1efba..21d65d7ac 100644 --- a/src/Atom.php +++ b/src/Legacy/Atom.php @@ -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 { diff --git a/src/Attach.php b/src/Legacy/Attach.php similarity index 99% rename from src/Attach.php rename to src/Legacy/Attach.php index 1d6e92d39..c85593abb 100644 --- a/src/Attach.php +++ b/src/Legacy/Attach.php @@ -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; diff --git a/src/AttachPosting.php b/src/Legacy/AttachPosting.php similarity index 98% rename from src/AttachPosting.php rename to src/Legacy/AttachPosting.php index 31768f9dc..65f7f4d90 100644 --- a/src/AttachPosting.php +++ b/src/Legacy/AttachPosting.php @@ -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 { diff --git a/src/BBCode.php b/src/Legacy/BBCode.php similarity index 99% rename from src/BBCode.php rename to src/Legacy/BBCode.php index ec79905d2..06efda6eb 100644 --- a/src/BBCode.php +++ b/src/Legacy/BBCode.php @@ -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 { diff --git a/src/Cache/APCu.php b/src/Legacy/Cache/APCu.php similarity index 97% rename from src/Cache/APCu.php rename to src/Legacy/Cache/APCu.php index 1557d6316..6e3b26fec 100644 --- a/src/Cache/APCu.php +++ b/src/Legacy/Cache/APCu.php @@ -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 { diff --git a/src/Cache/Common.php b/src/Legacy/Cache/Common.php similarity index 97% rename from src/Cache/Common.php rename to src/Legacy/Cache/Common.php index 0ef634f8d..4fb32eec9 100644 --- a/src/Cache/Common.php +++ b/src/Legacy/Cache/Common.php @@ -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 { diff --git a/src/Cache/File.php b/src/Legacy/Cache/File.php similarity index 97% rename from src/Cache/File.php rename to src/Legacy/Cache/File.php index b88b5f320..fea4d0ea5 100644 --- a/src/Cache/File.php +++ b/src/Legacy/Cache/File.php @@ -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 { diff --git a/src/Cache/Memcached.php b/src/Legacy/Cache/Memcached.php similarity index 98% rename from src/Cache/Memcached.php rename to src/Legacy/Cache/Memcached.php index dc7324f5b..ddbc1b02c 100644 --- a/src/Cache/Memcached.php +++ b/src/Legacy/Cache/Memcached.php @@ -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 { diff --git a/src/Cache/Redis.php b/src/Legacy/Cache/Redis.php similarity index 98% rename from src/Cache/Redis.php rename to src/Legacy/Cache/Redis.php index 5103d8435..d20c53aa8 100644 --- a/src/Cache/Redis.php +++ b/src/Legacy/Cache/Redis.php @@ -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 { diff --git a/src/Cache/Sqlite.php b/src/Legacy/Cache/Sqlite.php similarity index 97% rename from src/Cache/Sqlite.php rename to src/Legacy/Cache/Sqlite.php index 7cbeb3cf4..b6ba7f347 100644 --- a/src/Cache/Sqlite.php +++ b/src/Legacy/Cache/Sqlite.php @@ -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 { diff --git a/src/Caches.php b/src/Legacy/Caches.php similarity index 72% rename from src/Caches.php rename to src/Legacy/Caches.php index acb816863..5a03da24a 100644 --- a/src/Caches.php +++ b/src/Legacy/Caches.php @@ -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; diff --git a/src/Common/Html.php b/src/Legacy/Common/Html.php similarity index 98% rename from src/Common/Html.php rename to src/Legacy/Common/Html.php index 2ae2957f6..20c5cb66a 100644 --- a/src/Common/Html.php +++ b/src/Legacy/Common/Html.php @@ -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 { diff --git a/src/Common/Upload.php b/src/Legacy/Common/Upload.php similarity index 97% rename from src/Common/Upload.php rename to src/Legacy/Common/Upload.php index 5fba7cd23..858b59fc7 100644 --- a/src/Common/Upload.php +++ b/src/Legacy/Common/Upload.php @@ -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; diff --git a/src/Common/User.php b/src/Legacy/Common/User.php similarity index 99% rename from src/Common/User.php rename to src/Legacy/Common/User.php index c10c3a285..a5d69497f 100644 --- a/src/Common/User.php +++ b/src/Legacy/Common/User.php @@ -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 { diff --git a/src/Datastore/APCu.php b/src/Legacy/Datastore/APCu.php similarity index 97% rename from src/Datastore/APCu.php rename to src/Legacy/Datastore/APCu.php index 52f34c98c..c99e1c333 100644 --- a/src/Datastore/APCu.php +++ b/src/Legacy/Datastore/APCu.php @@ -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 { diff --git a/src/Datastore/Common.php b/src/Legacy/Datastore/Common.php similarity index 98% rename from src/Datastore/Common.php rename to src/Legacy/Datastore/Common.php index f3b108968..53f148d6e 100644 --- a/src/Datastore/Common.php +++ b/src/Legacy/Datastore/Common.php @@ -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 { diff --git a/src/Datastore/File.php b/src/Legacy/Datastore/File.php similarity index 97% rename from src/Datastore/File.php rename to src/Legacy/Datastore/File.php index 3d1357d8b..a802724ba 100644 --- a/src/Datastore/File.php +++ b/src/Legacy/Datastore/File.php @@ -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 { diff --git a/src/Datastore/Memcached.php b/src/Legacy/Datastore/Memcached.php similarity index 98% rename from src/Datastore/Memcached.php rename to src/Legacy/Datastore/Memcached.php index f57983845..65fb92c94 100644 --- a/src/Datastore/Memcached.php +++ b/src/Legacy/Datastore/Memcached.php @@ -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 { diff --git a/src/Datastore/Redis.php b/src/Legacy/Datastore/Redis.php similarity index 98% rename from src/Datastore/Redis.php rename to src/Legacy/Datastore/Redis.php index 4316e7ceb..20a843589 100644 --- a/src/Datastore/Redis.php +++ b/src/Legacy/Datastore/Redis.php @@ -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 { diff --git a/src/Datastore/Sqlite.php b/src/Legacy/Datastore/Sqlite.php similarity index 97% rename from src/Datastore/Sqlite.php rename to src/Legacy/Datastore/Sqlite.php index 6849180e0..9d032a4f5 100644 --- a/src/Datastore/Sqlite.php +++ b/src/Legacy/Datastore/Sqlite.php @@ -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 { diff --git a/src/DateDelta.php b/src/Legacy/DateDelta.php similarity index 98% rename from src/DateDelta.php rename to src/Legacy/DateDelta.php index 6959fb436..6b75eaf3e 100644 --- a/src/DateDelta.php +++ b/src/Legacy/DateDelta.php @@ -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 { diff --git a/src/Dbs.php b/src/Legacy/Dbs.php similarity index 96% rename from src/Dbs.php rename to src/Legacy/Dbs.php index ae4f967de..c1e27937b 100644 --- a/src/Dbs.php +++ b/src/Legacy/Dbs.php @@ -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 { diff --git a/src/Group.php b/src/Legacy/Group.php similarity index 99% rename from src/Group.php rename to src/Legacy/Group.php index 629117e06..2fc3238ff 100644 --- a/src/Group.php +++ b/src/Legacy/Group.php @@ -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 { diff --git a/src/LogAction.php b/src/Legacy/LogAction.php similarity index 98% rename from src/LogAction.php rename to src/Legacy/LogAction.php index 802705fa5..b1d7b2dfb 100644 --- a/src/LogAction.php +++ b/src/Legacy/LogAction.php @@ -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 { diff --git a/src/Poll.php b/src/Legacy/Poll.php similarity index 98% rename from src/Poll.php rename to src/Legacy/Poll.php index 917870c1c..c0d70b7bc 100644 --- a/src/Poll.php +++ b/src/Legacy/Poll.php @@ -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 { diff --git a/src/Post.php b/src/Legacy/Post.php similarity index 99% rename from src/Post.php rename to src/Legacy/Post.php index daea59316..b82a03d86 100644 --- a/src/Post.php +++ b/src/Legacy/Post.php @@ -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)) ? '
' . $lang['EMPTY_MESSAGE'] : $lang['EMPTY_MESSAGE']; } diff --git a/src/Select.php b/src/Legacy/Select.php similarity index 97% rename from src/Select.php rename to src/Legacy/Select.php index 9ef8e46f9..6dc3de2e0 100644 --- a/src/Select.php +++ b/src/Legacy/Select.php @@ -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 { diff --git a/src/SqlDb.php b/src/Legacy/SqlDb.php similarity index 99% rename from src/SqlDb.php rename to src/Legacy/SqlDb.php index 985837058..3fa1dbab8 100644 --- a/src/SqlDb.php +++ b/src/Legacy/SqlDb.php @@ -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}"; } /** diff --git a/src/Template.php b/src/Legacy/Template.php similarity index 99% rename from src/Template.php rename to src/Legacy/Template.php index 734b8e8f3..1c509d3bd 100644 --- a/src/Template.php +++ b/src/Legacy/Template.php @@ -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 { diff --git a/src/Torrent.php b/src/Legacy/Torrent.php similarity index 99% rename from src/Torrent.php rename to src/Legacy/Torrent.php index d39e3bc64..791ff30bd 100644 --- a/src/Torrent.php +++ b/src/Legacy/Torrent.php @@ -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 { diff --git a/src/TorrentFileList.php b/src/Legacy/TorrentFileList.php similarity index 98% rename from src/TorrentFileList.php rename to src/Legacy/TorrentFileList.php index b7755f543..fd600d015 100644 --- a/src/TorrentFileList.php +++ b/src/Legacy/TorrentFileList.php @@ -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 { diff --git a/src/WordsRate.php b/src/Legacy/WordsRate.php similarity index 97% rename from src/WordsRate.php rename to src/Legacy/WordsRate.php index f1f745571..e2f20c5fe 100644 --- a/src/WordsRate.php +++ b/src/Legacy/WordsRate.php @@ -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 { diff --git a/tracker.php b/tracker.php index 2d4a41ad9..5f3c50d57 100644 --- a/tracker.php +++ b/tracker.php @@ -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'; diff --git a/viewtopic.php b/viewtopic.php index 4c2c87e05..01e2de2e5 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -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 ]); }