diff --git a/admin/admin_log.php b/admin/admin_log.php
index 89f0e8b0b..7cf566f13 100644
--- a/admin/admin_log.php
+++ b/admin/admin_log.php
@@ -151,7 +151,7 @@ if ($var =& $_REQUEST[$daysback_key] && $var != $def_days) {
$url = url_arg($url, $daysback_key, $daysback_val);
}
if ($var =& $_REQUEST[$datetime_key] && $var != $def_datetime) {
- $tz = TIMENOW + (3600 * config()->get('board_timezone'));
+ $tz = TIMENOW + (3600 * tp_config()->get('board_timezone'));
if (($tmp_timestamp = strtotime($var, $tz)) > 0) {
$datetime_val = $tmp_timestamp;
$url = url_arg($url, $datetime_key, date($dt_format, $datetime_val));
diff --git a/admin/admin_mass_email.php b/admin/admin_mass_email.php
index 51902d960..c818d9f60 100644
--- a/admin/admin_mass_email.php
+++ b/admin/admin_mass_email.php
@@ -14,7 +14,7 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php';
-if (!config()->get('emailer.enabled')) {
+if (!tp_config()->get('emailer.enabled')) {
bb_die($lang['EMAILER_DISABLED']);
}
@@ -23,7 +23,7 @@ set_time_limit(1200);
$subject = trim(request_var('subject', ''));
$message = (string)request_var('message', '');
$group_id = (int)request_var(POST_GROUPS_URL, 0);
-$reply_to = (string)request_var('reply_to', config()->get('board_email'));
+$reply_to = (string)request_var('reply_to', tp_config()->get('board_email'));
$message_type = (string)request_var('message_type', '');
$errors = $user_id_sql = [];
diff --git a/admin/admin_words.php b/admin/admin_words.php
index 94f11caba..0cfe078df 100644
--- a/admin/admin_words.php
+++ b/admin/admin_words.php
@@ -14,7 +14,7 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php';
-if (!config()->get('use_word_censor')) {
+if (!tp_config()->get('use_word_censor')) {
bb_die('Word censor disabled
(use_word_censor in config.php)');
}
diff --git a/bt/announce.php b/bt/announce.php
index ea1cca19a..346aed741 100644
--- a/bt/announce.php
+++ b/bt/announce.php
@@ -18,8 +18,8 @@ if (empty($userAgent)) {
die;
}
-$announce_interval = config()->get('announce_interval');
-$passkey_key = config()->get('passkey_key');
+$announce_interval = tp_config()->get('announce_interval');
+$passkey_key = tp_config()->get('passkey_key');
// Recover info_hash
if (isset($_GET['?info_hash']) && !isset($_GET['info_hash'])) {
@@ -65,10 +65,10 @@ if (strlen($peer_id) !== 20) {
}
// Check for client ban
-if (config()->get('client_ban.enabled')) {
+if (tp_config()->get('client_ban.enabled')) {
$targetClient = [];
- foreach (config()->get('client_ban.clients') as $clientId => $banReason) {
+ foreach (tp_config()->get('client_ban.clients') as $clientId => $banReason) {
if (str_starts_with($peer_id, $clientId)) {
$targetClient = [
'peer_id' => $clientId,
@@ -78,7 +78,7 @@ if (config()->get('client_ban.enabled')) {
}
}
- if (config()->get('client_ban.only_allow_mode')) {
+ if (tp_config()->get('client_ban.only_allow_mode')) {
if (empty($targetClient['peer_id'])) {
msg_die('Your BitTorrent client has been banned!');
}
@@ -129,7 +129,7 @@ if (
|| !is_numeric($port)
|| ($port < 1024 && !$stopped)
|| $port > 0xFFFF
- || (!empty(config()->get('disallowed_ports')) && in_array($port, config()->get('disallowed_ports')))
+ || (!empty(tp_config()->get('disallowed_ports')) && in_array($port, tp_config()->get('disallowed_ports')))
) {
msg_die('Invalid port: ' . $port);
}
@@ -168,13 +168,13 @@ if (preg_match('/(Mozilla|Browser|Chrome|Safari|AppleWebKit|Opera|Links|Lynx|Bot
$ip = $_SERVER['REMOTE_ADDR'];
// 'ip' query handling
-if (!config()->get('ignore_reported_ip') && isset($_GET['ip']) && $ip !== $_GET['ip']) {
- if (!config()->get('verify_reported_ip') && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
+if (!tp_config()->get('ignore_reported_ip') && isset($_GET['ip']) && $ip !== $_GET['ip']) {
+ if (!tp_config()->get('verify_reported_ip') && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$x_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
if ($x_ip === $_GET['ip']) {
$filteredIp = filter_var($x_ip, FILTER_VALIDATE_IP);
- if ($filteredIp !== false && (config()->get('allow_internal_ip') || !filter_var($filteredIp, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))) {
+ if ($filteredIp !== false && (tp_config()->get('allow_internal_ip') || !filter_var($filteredIp, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))) {
$ip = $filteredIp;
}
}
@@ -270,7 +270,7 @@ if ($lp_info) {
define('IS_MOD', !IS_GUEST && (int)$row['user_level'] === MOD);
define('IS_GROUP_MEMBER', !IS_GUEST && (int)$row['user_level'] === GROUP_MEMBER);
define('IS_USER', !IS_GUEST && (int)$row['user_level'] === USER);
- define('IS_SUPER_ADMIN', IS_ADMIN && isset(config()->get('super_admins')[$user_id]));
+ define('IS_SUPER_ADMIN', IS_ADMIN && isset(tp_config()->get('super_admins')[$user_id]));
define('IS_AM', IS_ADMIN || IS_MOD);
$topic_id = $row['topic_id'];
$releaser = (int)($user_id == $row['poster_id']);
@@ -278,13 +278,13 @@ if ($lp_info) {
$tor_status = $row['tor_status'];
// Check tor status
- if (!IS_AM && isset(config()->get('tor_frozen')[$tor_status]) && !(isset(config()->get('tor_frozen_author_download')[$tor_status]) && $releaser)) {
+ if (!IS_AM && isset(tp_config()->get('tor_frozen')[$tor_status]) && !(isset(tp_config()->get('tor_frozen_author_download')[$tor_status]) && $releaser)) {
msg_die('Torrent frozen and cannot be downloaded');
}
// Check hybrid status
if (!empty($row['info_hash']) && !empty($row['info_hash_v2'])) {
- $stat_protocol = match ((int)config()->get('tracker.hybrid_stat_protocol')) {
+ $stat_protocol = match ((int)tp_config()->get('tracker.hybrid_stat_protocol')) {
2 => substr($row['info_hash_v2'], 0, 20),
default => $row['info_hash'] // 1
};
@@ -294,7 +294,7 @@ if ($lp_info) {
}
// Ratio limits
- if ((RATIO_ENABLED || config()->get('tracker.limit_concurrent_ips')) && !$stopped) {
+ if ((RATIO_ENABLED || tp_config()->get('tracker.limit_concurrent_ips')) && !$stopped) {
$user_ratio = get_bt_ratio($row);
if ($user_ratio === null) {
$user_ratio = 1;
@@ -302,10 +302,10 @@ if ($lp_info) {
$rating_msg = '';
if (!$seeder) {
- foreach (config()->get('rating') as $ratio => $limit) {
+ foreach (tp_config()->get('rating') as $ratio => $limit) {
if ($user_ratio < $ratio) {
- config()->set('tracker.limit_active_tor', 1);
- config()->set('tracker.limit_leech_count', $limit);
+ tp_config()->set('tracker.limit_active_tor', 1);
+ tp_config()->set('tracker.limit_leech_count', $limit);
$rating_msg = " (ratio < $ratio)";
break;
}
@@ -313,23 +313,23 @@ if ($lp_info) {
}
// Limit active torrents
- if (!isset(config()->get('unlimited_users')[$user_id]) && config()->get('tracker.limit_active_tor') && ((config()->get('tracker.limit_seed_count') && $seeder) || (config()->get('tracker.limit_leech_count') && !$seeder))) {
+ if (!isset(tp_config()->get('unlimited_users')[$user_id]) && tp_config()->get('tracker.limit_active_tor') && ((config()->get('tracker.limit_seed_count') && $seeder) || (config()->get('tracker.limit_leech_count') && !$seeder))) {
$sql = "SELECT COUNT(DISTINCT topic_id) AS active_torrents
FROM " . BB_BT_TRACKER . "
WHERE user_id = $user_id
AND seeder = $seeder
AND topic_id != $topic_id";
- if (!$seeder && config()->get('tracker.leech_expire_factor') && $user_ratio < 0.5) {
+ if (!$seeder && tp_config()->get('tracker.leech_expire_factor') && $user_ratio < 0.5) {
$sql .= " AND update_time > " . (TIMENOW - 60 * config()->get('tracker.leech_expire_factor'));
}
$sql .= " GROUP BY user_id";
if ($row = DB()->fetch_row($sql)) {
- if ($seeder && config()->get('tracker.limit_seed_count') && $row['active_torrents'] >= config()->get('tracker.limit_seed_count')) {
- msg_die('Only ' . config()->get('tracker.limit_seed_count') . ' torrent(s) allowed for seeding');
- } elseif (!$seeder && config()->get('tracker.limit_leech_count') && $row['active_torrents'] >= config()->get('tracker.limit_leech_count')) {
- msg_die('Only ' . config()->get('tracker.limit_leech_count') . ' torrent(s) allowed for leeching' . $rating_msg);
+ if ($seeder && tp_config()->get('tracker.limit_seed_count') && $row['active_torrents'] >= tp_config()->get('tracker.limit_seed_count')) {
+ msg_die('Only ' . tp_config()->get('tracker.limit_seed_count') . ' torrent(s) allowed for seeding');
+ } elseif (!$seeder && tp_config()->get('tracker.limit_leech_count') && $row['active_torrents'] >= tp_config()->get('tracker.limit_leech_count')) {
+ msg_die('Only ' . tp_config()->get('tracker.limit_leech_count') . ' torrent(s) allowed for leeching' . $rating_msg);
}
}
}
diff --git a/bt/includes/init_tr.php b/bt/includes/init_tr.php
index 283c71ede..d0085b4ee 100644
--- a/bt/includes/init_tr.php
+++ b/bt/includes/init_tr.php
@@ -12,8 +12,8 @@ if (!defined('IN_TRACKER')) {
}
// Exit if tracker is disabled
-if (config()->get('tracker.bt_off')) {
- msg_die(config()->get('tracker.bt_off_reason'));
+if (tp_config()->get('tracker.bt_off')) {
+ msg_die(tp_config()->get('tracker.bt_off_reason'));
}
//
diff --git a/bt/scrape.php b/bt/scrape.php
index dd94ab8ff..392032426 100644
--- a/bt/scrape.php
+++ b/bt/scrape.php
@@ -11,7 +11,7 @@ define('IN_TRACKER', true);
define('BB_ROOT', './../');
require dirname(__DIR__) . '/common.php';
-if (!config()->get('tracker.scrape')) {
+if (!tp_config()->get('tracker.scrape')) {
msg_die('Please disable SCRAPE!');
}
@@ -58,8 +58,8 @@ foreach ($info_hash_array[1] as $hash) {
$info_hash_count = count($info_hashes);
if (!empty($info_hash_count)) {
- if ($info_hash_count > config()->get('max_scrapes')) {
- $info_hashes = array_slice($info_hashes, 0, config()->get('max_scrapes'));
+ if ($info_hash_count > tp_config()->get('max_scrapes')) {
+ $info_hashes = array_slice($info_hashes, 0, tp_config()->get('max_scrapes'));
}
$info_hashes_sql = implode('\', \'', $info_hashes);
diff --git a/composer.json b/composer.json
index 20b053793..aa314804c 100644
--- a/composer.json
+++ b/composer.json
@@ -55,13 +55,20 @@
"bugsnag/bugsnag": "^v3.29.1",
"claviska/simpleimage": "^4.0",
"egulias/email-validator": "^4.0.1",
+ "fakerphp/faker": "^1.24",
"filp/whoops": "^2.15",
"gemorroj/m3u-parser": "^6.0.1",
"gigablah/sphinxphp": "2.0.8",
"google/recaptcha": "^1.3",
+ "illuminate/collections": "^12.19",
+ "illuminate/config": "^12.19",
"illuminate/container": "^12.19",
+ "illuminate/database": "^12.19",
+ "illuminate/events": "^12.19",
"illuminate/http": "^12.19",
+ "illuminate/routing": "^12.19",
"illuminate/support": "^12.19",
+ "illuminate/validation": "^12.19",
"jacklul/monolog-telegram": "^3.1",
"josantonius/cookie": "^2.0",
"league/flysystem": "^3.28",
@@ -88,7 +95,6 @@
"App\\": "app/"
},
"files": [
- "src/helpers.php",
"app/helpers.php"
]
},
diff --git a/composer.lock b/composer.lock
index d3502768f..118c243e6 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "99433ae342bb6c1dc1d9a8e9f933d1f1",
+ "content-hash": "b6064b3dc730bc6bf800fdf90be38b43",
"packages": [
{
"name": "arokettu/bencode",
@@ -480,6 +480,66 @@
},
"time": "2025-03-10T13:15:53+00:00"
},
+ {
+ "name": "brick/math",
+ "version": "0.13.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/brick/math.git",
+ "reference": "fc7ed316430118cc7836bf45faff18d5dfc8de04"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/brick/math/zipball/fc7ed316430118cc7836bf45faff18d5dfc8de04",
+ "reference": "fc7ed316430118cc7836bf45faff18d5dfc8de04",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^8.1"
+ },
+ "require-dev": {
+ "php-coveralls/php-coveralls": "^2.2",
+ "phpunit/phpunit": "^10.1",
+ "vimeo/psalm": "6.8.8"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Brick\\Math\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Arbitrary-precision arithmetic library",
+ "keywords": [
+ "Arbitrary-precision",
+ "BigInteger",
+ "BigRational",
+ "arithmetic",
+ "bigdecimal",
+ "bignum",
+ "bignumber",
+ "brick",
+ "decimal",
+ "integer",
+ "math",
+ "mathematics",
+ "rational"
+ ],
+ "support": {
+ "issues": "https://github.com/brick/math/issues",
+ "source": "https://github.com/brick/math/tree/0.13.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/BenMorel",
+ "type": "github"
+ }
+ ],
+ "time": "2025-03-29T13:50:30+00:00"
+ },
{
"name": "bugsnag/bugsnag",
"version": "v3.29.3",
@@ -1300,6 +1360,69 @@
],
"time": "2025-03-06T22:45:56+00:00"
},
+ {
+ "name": "fakerphp/faker",
+ "version": "v1.24.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/FakerPHP/Faker.git",
+ "reference": "e0ee18eb1e6dc3cda3ce9fd97e5a0689a88a64b5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/e0ee18eb1e6dc3cda3ce9fd97e5a0689a88a64b5",
+ "reference": "e0ee18eb1e6dc3cda3ce9fd97e5a0689a88a64b5",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.4 || ^8.0",
+ "psr/container": "^1.0 || ^2.0",
+ "symfony/deprecation-contracts": "^2.2 || ^3.0"
+ },
+ "conflict": {
+ "fzaninotto/faker": "*"
+ },
+ "require-dev": {
+ "bamarni/composer-bin-plugin": "^1.4.1",
+ "doctrine/persistence": "^1.3 || ^2.0",
+ "ext-intl": "*",
+ "phpunit/phpunit": "^9.5.26",
+ "symfony/phpunit-bridge": "^5.4.16"
+ },
+ "suggest": {
+ "doctrine/orm": "Required to use Faker\\ORM\\Doctrine",
+ "ext-curl": "Required by Faker\\Provider\\Image to download images.",
+ "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.",
+ "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.",
+ "ext-mbstring": "Required for multibyte Unicode string functionality."
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Faker\\": "src/Faker/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "François Zaninotto"
+ }
+ ],
+ "description": "Faker is a PHP library that generates fake data for you.",
+ "keywords": [
+ "data",
+ "faker",
+ "fixtures"
+ ],
+ "support": {
+ "issues": "https://github.com/FakerPHP/Faker/issues",
+ "source": "https://github.com/FakerPHP/Faker/tree/v1.24.1"
+ },
+ "time": "2024-11-21T13:46:39+00:00"
+ },
{
"name": "filp/whoops",
"version": "2.18.3",
@@ -2071,6 +2194,59 @@
],
"time": "2025-02-03T10:55:03+00:00"
},
+ {
+ "name": "illuminate/bus",
+ "version": "v12.19.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/illuminate/bus.git",
+ "reference": "60da78ea881c539ce56c5b66321be73755c5918c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/illuminate/bus/zipball/60da78ea881c539ce56c5b66321be73755c5918c",
+ "reference": "60da78ea881c539ce56c5b66321be73755c5918c",
+ "shasum": ""
+ },
+ "require": {
+ "illuminate/collections": "^12.0",
+ "illuminate/contracts": "^12.0",
+ "illuminate/pipeline": "^12.0",
+ "illuminate/support": "^12.0",
+ "php": "^8.2"
+ },
+ "suggest": {
+ "illuminate/queue": "Required to use closures when chaining jobs (^12.0)."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "12.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Illuminate\\Bus\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
+ }
+ ],
+ "description": "The Illuminate Bus package.",
+ "homepage": "https://laravel.com",
+ "support": {
+ "issues": "https://github.com/laravel/framework/issues",
+ "source": "https://github.com/laravel/framework"
+ },
+ "time": "2025-05-13T15:08:45+00:00"
+ },
{
"name": "illuminate/collections",
"version": "v12.19.3",
@@ -2273,6 +2449,131 @@
},
"time": "2025-06-12T15:07:31+00:00"
},
+ {
+ "name": "illuminate/database",
+ "version": "v12.19.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/illuminate/database.git",
+ "reference": "758dcd2128af1bc9427a6f72d247a4f0c078a24a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/illuminate/database/zipball/758dcd2128af1bc9427a6f72d247a4f0c078a24a",
+ "reference": "758dcd2128af1bc9427a6f72d247a4f0c078a24a",
+ "shasum": ""
+ },
+ "require": {
+ "brick/math": "^0.11|^0.12|^0.13",
+ "ext-pdo": "*",
+ "illuminate/collections": "^12.0",
+ "illuminate/container": "^12.0",
+ "illuminate/contracts": "^12.0",
+ "illuminate/macroable": "^12.0",
+ "illuminate/support": "^12.0",
+ "laravel/serializable-closure": "^1.3|^2.0",
+ "php": "^8.2"
+ },
+ "suggest": {
+ "ext-filter": "Required to use the Postgres database driver.",
+ "fakerphp/faker": "Required to use the eloquent factory builder (^1.24).",
+ "illuminate/console": "Required to use the database commands (^12.0).",
+ "illuminate/events": "Required to use the observers with Eloquent (^12.0).",
+ "illuminate/filesystem": "Required to use the migrations (^12.0).",
+ "illuminate/http": "Required to convert Eloquent models to API resources (^12.0).",
+ "illuminate/pagination": "Required to paginate the result set (^12.0).",
+ "symfony/finder": "Required to use Eloquent model factories (^7.2)."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "12.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Illuminate\\Database\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
+ }
+ ],
+ "description": "The Illuminate Database package.",
+ "homepage": "https://laravel.com",
+ "keywords": [
+ "database",
+ "laravel",
+ "orm",
+ "sql"
+ ],
+ "support": {
+ "issues": "https://github.com/laravel/framework/issues",
+ "source": "https://github.com/laravel/framework"
+ },
+ "time": "2025-06-18T12:55:09+00:00"
+ },
+ {
+ "name": "illuminate/events",
+ "version": "v12.19.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/illuminate/events.git",
+ "reference": "bf1f121ea51e077e893d32e2848e102513d4b1b5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/illuminate/events/zipball/bf1f121ea51e077e893d32e2848e102513d4b1b5",
+ "reference": "bf1f121ea51e077e893d32e2848e102513d4b1b5",
+ "shasum": ""
+ },
+ "require": {
+ "illuminate/bus": "^12.0",
+ "illuminate/collections": "^12.0",
+ "illuminate/container": "^12.0",
+ "illuminate/contracts": "^12.0",
+ "illuminate/macroable": "^12.0",
+ "illuminate/support": "^12.0",
+ "php": "^8.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "12.x-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "functions.php"
+ ],
+ "psr-4": {
+ "Illuminate\\Events\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
+ }
+ ],
+ "description": "The Illuminate Events package.",
+ "homepage": "https://laravel.com",
+ "support": {
+ "issues": "https://github.com/laravel/framework/issues",
+ "source": "https://github.com/laravel/framework"
+ },
+ "time": "2025-05-13T15:08:45+00:00"
+ },
{
"name": "illuminate/filesystem",
"version": "v12.19.3",
@@ -2447,6 +2748,118 @@
},
"time": "2024-07-23T16:31:01+00:00"
},
+ {
+ "name": "illuminate/pipeline",
+ "version": "v12.19.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/illuminate/pipeline.git",
+ "reference": "a1039dfe54854470cdda37782bab0901aa588dd4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/illuminate/pipeline/zipball/a1039dfe54854470cdda37782bab0901aa588dd4",
+ "reference": "a1039dfe54854470cdda37782bab0901aa588dd4",
+ "shasum": ""
+ },
+ "require": {
+ "illuminate/contracts": "^12.0",
+ "illuminate/support": "^12.0",
+ "php": "^8.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "12.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Illuminate\\Pipeline\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
+ }
+ ],
+ "description": "The Illuminate Pipeline package.",
+ "homepage": "https://laravel.com",
+ "support": {
+ "issues": "https://github.com/laravel/framework/issues",
+ "source": "https://github.com/laravel/framework"
+ },
+ "time": "2025-05-13T15:08:45+00:00"
+ },
+ {
+ "name": "illuminate/routing",
+ "version": "v12.19.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/illuminate/routing.git",
+ "reference": "f4cc40e27fb8771fec7ff6f1daf8a13020a9eba5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/illuminate/routing/zipball/f4cc40e27fb8771fec7ff6f1daf8a13020a9eba5",
+ "reference": "f4cc40e27fb8771fec7ff6f1daf8a13020a9eba5",
+ "shasum": ""
+ },
+ "require": {
+ "ext-filter": "*",
+ "ext-hash": "*",
+ "illuminate/collections": "^12.0",
+ "illuminate/container": "^12.0",
+ "illuminate/contracts": "^12.0",
+ "illuminate/http": "^12.0",
+ "illuminate/macroable": "^12.0",
+ "illuminate/pipeline": "^12.0",
+ "illuminate/session": "^12.0",
+ "illuminate/support": "^12.0",
+ "php": "^8.2",
+ "symfony/http-foundation": "^7.2.0",
+ "symfony/http-kernel": "^7.2.0",
+ "symfony/routing": "^7.2.0"
+ },
+ "suggest": {
+ "illuminate/console": "Required to use the make commands (^12.0).",
+ "php-http/discovery": "Required to use PSR-7 bridging features (^1.15).",
+ "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^7.2)."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "12.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Illuminate\\Routing\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
+ }
+ ],
+ "description": "The Illuminate Routing package.",
+ "homepage": "https://laravel.com",
+ "support": {
+ "issues": "https://github.com/laravel/framework/issues",
+ "source": "https://github.com/laravel/framework"
+ },
+ "time": "2025-06-17T17:01:27+00:00"
+ },
{
"name": "illuminate/session",
"version": "v12.19.3",
@@ -2581,6 +2994,119 @@
},
"time": "2025-06-12T15:07:56+00:00"
},
+ {
+ "name": "illuminate/translation",
+ "version": "v12.19.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/illuminate/translation.git",
+ "reference": "705bdc5e8616ac76d247302831d05ac5ba352b44"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/illuminate/translation/zipball/705bdc5e8616ac76d247302831d05ac5ba352b44",
+ "reference": "705bdc5e8616ac76d247302831d05ac5ba352b44",
+ "shasum": ""
+ },
+ "require": {
+ "illuminate/collections": "^12.0",
+ "illuminate/contracts": "^12.0",
+ "illuminate/filesystem": "^12.0",
+ "illuminate/macroable": "^12.0",
+ "illuminate/support": "^12.0",
+ "php": "^8.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "12.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Illuminate\\Translation\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
+ }
+ ],
+ "description": "The Illuminate Translation package.",
+ "homepage": "https://laravel.com",
+ "support": {
+ "issues": "https://github.com/laravel/framework/issues",
+ "source": "https://github.com/laravel/framework"
+ },
+ "time": "2025-05-26T17:31:37+00:00"
+ },
+ {
+ "name": "illuminate/validation",
+ "version": "v12.19.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/illuminate/validation.git",
+ "reference": "42ac1d782c8541c3e779f7ffff33093edd5739a4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/illuminate/validation/zipball/42ac1d782c8541c3e779f7ffff33093edd5739a4",
+ "reference": "42ac1d782c8541c3e779f7ffff33093edd5739a4",
+ "shasum": ""
+ },
+ "require": {
+ "brick/math": "^0.11|^0.12|^0.13",
+ "egulias/email-validator": "^3.2.5|^4.0",
+ "ext-filter": "*",
+ "ext-mbstring": "*",
+ "illuminate/collections": "^12.0",
+ "illuminate/container": "^12.0",
+ "illuminate/contracts": "^12.0",
+ "illuminate/macroable": "^12.0",
+ "illuminate/support": "^12.0",
+ "illuminate/translation": "^12.0",
+ "php": "^8.2",
+ "symfony/http-foundation": "^7.2",
+ "symfony/mime": "^7.2"
+ },
+ "suggest": {
+ "illuminate/database": "Required to use the database presence verifier (^12.0).",
+ "ramsey/uuid": "Required to use Validator::validateUuid() (^4.7)."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "12.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Illuminate\\Validation\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
+ }
+ ],
+ "description": "The Illuminate Validation package.",
+ "homepage": "https://laravel.com",
+ "support": {
+ "issues": "https://github.com/laravel/framework/issues",
+ "source": "https://github.com/laravel/framework"
+ },
+ "time": "2025-06-13T13:58:47+00:00"
+ },
{
"name": "jacklul/monolog-telegram",
"version": "3.2.0",
@@ -2706,6 +3232,67 @@
],
"time": "2024-09-11T14:15:04+00:00"
},
+ {
+ "name": "laravel/serializable-closure",
+ "version": "v2.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/laravel/serializable-closure.git",
+ "reference": "b352cf0534aa1ae6b4d825d1e762e35d43f8a841"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/b352cf0534aa1ae6b4d825d1e762e35d43f8a841",
+ "reference": "b352cf0534aa1ae6b4d825d1e762e35d43f8a841",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^8.1"
+ },
+ "require-dev": {
+ "illuminate/support": "^10.0|^11.0|^12.0",
+ "nesbot/carbon": "^2.67|^3.0",
+ "pestphp/pest": "^2.36|^3.0",
+ "phpstan/phpstan": "^2.0",
+ "symfony/var-dumper": "^6.2.0|^7.0.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Laravel\\SerializableClosure\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
+ },
+ {
+ "name": "Nuno Maduro",
+ "email": "nuno@laravel.com"
+ }
+ ],
+ "description": "Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.",
+ "keywords": [
+ "closure",
+ "laravel",
+ "serializable"
+ ],
+ "support": {
+ "issues": "https://github.com/laravel/serializable-closure/issues",
+ "source": "https://github.com/laravel/serializable-closure"
+ },
+ "time": "2025-03-19T13:51:03+00:00"
+ },
{
"name": "league/color-extractor",
"version": "0.4.0",
@@ -5496,6 +6083,87 @@
],
"time": "2025-05-02T09:40:28+00:00"
},
+ {
+ "name": "symfony/routing",
+ "version": "v7.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/routing.git",
+ "reference": "8e213820c5fea844ecea29203d2a308019007c15"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/routing/zipball/8e213820c5fea844ecea29203d2a308019007c15",
+ "reference": "8e213820c5fea844ecea29203d2a308019007c15",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.2",
+ "symfony/deprecation-contracts": "^2.5|^3"
+ },
+ "conflict": {
+ "symfony/config": "<6.4",
+ "symfony/dependency-injection": "<6.4",
+ "symfony/yaml": "<6.4"
+ },
+ "require-dev": {
+ "psr/log": "^1|^2|^3",
+ "symfony/config": "^6.4|^7.0",
+ "symfony/dependency-injection": "^6.4|^7.0",
+ "symfony/expression-language": "^6.4|^7.0",
+ "symfony/http-foundation": "^6.4|^7.0",
+ "symfony/yaml": "^6.4|^7.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Routing\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Maps an HTTP request to a set of configuration variables",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "router",
+ "routing",
+ "uri",
+ "url"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/routing/tree/v7.3.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2025-05-24T20:43:28+00:00"
+ },
{
"name": "symfony/service-contracts",
"version": "v3.6.0",
diff --git a/docs/illuminate-integration.md b/docs/illuminate-integration.md
new file mode 100644
index 000000000..861638428
--- /dev/null
+++ b/docs/illuminate-integration.md
@@ -0,0 +1,212 @@
+# Illuminate Package Integration Guide
+
+This document outlines the integration of Laravel's Illuminate packages in TorrentPier 3.0.
+
+> **Note**: After these changes, run `composer update` to install the newly added `illuminate/config` package.
+
+## Installed Illuminate Packages
+
+The following Illuminate packages are available in TorrentPier:
+
+1. **illuminate/collections** - Powerful array/collection manipulation
+2. **illuminate/config** - Configuration repository system
+3. **illuminate/container** - Dependency injection container
+4. **illuminate/database** - Database query builder and Eloquent ORM
+5. **illuminate/events** - Event dispatcher system
+6. **illuminate/http** - HTTP request/response handling
+7. **illuminate/routing** - Routing system
+8. **illuminate/support** - Support utilities (Str, Arr, etc.)
+9. **illuminate/validation** - Data validation
+
+## Current Integration Status
+
+### ✅ Fully Integrated
+
+1. **Container (illuminate/container)**
+ - Used as the core DI container via `bootstrap/container.php`
+ - Custom wrapper in `App\Container\Container`
+ - Global `app()` helper function available
+
+2. **Support (illuminate/support)**
+ - Helper functions: `collect()`, `str()`, `data_get()`, `data_set()`, `tap()`, `optional()`
+ - String and array manipulation utilities
+ - Collection class for data manipulation
+
+3. **Events (illuminate/events)**
+ - Event dispatcher registered in `AppServiceProvider`
+ - Event classes in `app/Events/`
+ - Listener classes in `app/Listeners/`
+ - `EventServiceProvider` for registering event listeners
+ - Global `event()` helper function
+
+4. **Config (illuminate/config)**
+ - Configuration repository registered in `AppServiceProvider`
+ - Global `config()` helper function
+ - Loads all PHP files from `/config/` directory
+
+5. **Validation (illuminate/validation)**
+ - Used in `App\Http\Requests\FormRequest` base class
+ - Provides Laravel-style request validation
+
+### ⚠️ Partially Integrated
+
+1. **HTTP (illuminate/http)**
+ - Request/Response classes used in routing
+ - Not fully utilizing all HTTP features
+
+2. **Collections (illuminate/collections)**
+ - Available via `collect()` helper
+ - Could be used more extensively in models/services
+
+### ❌ Not Yet Integrated
+
+1. **Database (illuminate/database)**
+ - Package installed but not used
+ - Project uses Nette Database instead
+ - Could migrate to Eloquent ORM in future
+
+2. **Routing (illuminate/routing)**
+ - Package installed but custom router is used
+ - Could migrate to full Illuminate routing
+
+## Usage Examples
+
+### Using the Event System
+
+```php
+// Dispatch an event
+use App\Events\UserRegistered;
+
+event(new UserRegistered(
+ userId: $userId,
+ username: $username,
+ email: $email,
+ registeredAt: new DateTime()
+));
+
+// In a listener
+class SendWelcomeEmail
+{
+ public function handle(UserRegistered $event): void
+ {
+ // Send welcome email
+ mail($event->getEmail(), 'Welcome!', 'Welcome to TorrentPier!');
+ }
+}
+```
+
+### Using Configuration
+
+```php
+// Get a config value
+$appName = config('app.name');
+$debug = config('app.debug', false);
+
+// Set a config value
+config(['app.timezone' => 'UTC']);
+
+// Get entire config array
+$databaseConfig = config('database');
+```
+
+### Using Collections
+
+```php
+// Create a collection
+$users = collect($userArray);
+
+// Chain methods
+$activeAdmins = $users
+ ->where('status', 'active')
+ ->where('role', 'admin')
+ ->sortBy('name')
+ ->values();
+
+// Use collection helpers
+$names = $users->pluck('name');
+$grouped = $users->groupBy('role');
+```
+
+### Using Validation
+
+```php
+use App\Http\Requests\FormRequest;
+
+class RegisterRequest extends FormRequest
+{
+ public function rules(): array
+ {
+ return [
+ 'username' => 'required|string|min:3|max:25',
+ 'email' => 'required|email',
+ 'password' => 'required|min:8|confirmed',
+ ];
+ }
+}
+
+// In controller
+public function register(RegisterRequest $request)
+{
+ $validated = $request->validated();
+ // Process registration with validated data
+}
+```
+
+## Service Providers
+
+Service providers bootstrap the Illuminate packages:
+
+1. **AppServiceProvider** - Registers config and events
+2. **EventServiceProvider** - Maps events to listeners
+3. **RouteServiceProvider** - Loads route files
+
+Register new providers in `bootstrap/container.php`.
+
+## Future Integration Opportunities
+
+1. **Migrate to Eloquent ORM**
+ - Replace Nette Database with Eloquent
+ - Use migrations and model relationships
+ - Leverage query scopes and mutators
+
+2. **Full Routing Integration**
+ - Replace custom router with Illuminate routing
+ - Use route model binding
+ - Implement route caching
+
+3. **Add Queue System**
+ - Install `illuminate/queue`
+ - Process long-running tasks asynchronously
+ - Integrate with event listeners
+
+4. **Add Cache Integration**
+ - Install `illuminate/cache`
+ - Replace custom cache with Laravel's cache
+ - Use cache tags and TTL
+
+5. **Add Filesystem Integration**
+ - Already have `league/flysystem`
+ - Add `illuminate/filesystem` for Laravel integration
+ - Unified file operations
+
+## Best Practices
+
+1. **Use Dependency Injection**
+ - Inject services via constructor
+ - Use the container for resolution
+ - Avoid service location pattern
+
+2. **Leverage Events**
+ - Decouple components with events
+ - Use listeners for side effects
+ - Consider queued listeners for heavy tasks
+
+3. **Configuration Management**
+ - Keep environment-specific values in `.env`
+ - Use config files for application settings
+ - Cache configuration in production
+
+4. **Follow Laravel Conventions**
+ - Use Laravel naming conventions
+ - Structure code like a Laravel app
+ - Leverage Laravel patterns and practices
\ No newline at end of file
diff --git a/src/Ajax.php b/src/Ajax.php
index 374ee6664..9b0aae287 100644
--- a/src/Ajax.php
+++ b/src/Ajax.php
@@ -91,8 +91,8 @@ class Ajax
}
// Exit if board is disabled via ON/OFF trigger or by admin
- if (config()->get('board_disable') || is_file(BB_DISABLED)) {
- if (config()->get('board_disable')) {
+ if (tp_config()->get('board_disable') || is_file(BB_DISABLED)) {
+ if (tp_config()->get('board_disable')) {
$this->ajax_die($lang['BOARD_DISABLE']);
} elseif (is_file(BB_DISABLED) && $this->action !== 'manage_admin') {
$this->ajax_die($lang['BOARD_DISABLE_CRON']);
diff --git a/src/Censor.php b/src/Censor.php
index dc5c760ce..8a4fe01d1 100644
--- a/src/Censor.php
+++ b/src/Censor.php
@@ -111,7 +111,7 @@ class Censor
*/
public function isEnabled(): bool
{
- return config()->get('use_word_censor', false);
+ return tp_config()->get('use_word_censor', false);
}
/**
diff --git a/src/Dev.php b/src/Dev.php
index 8348c52f6..e4a1ef44f 100644
--- a/src/Dev.php
+++ b/src/Dev.php
@@ -90,11 +90,11 @@ class Dev
*/
private function getBugsnag(): void
{
- if (!config()->get('bugsnag.enabled')) {
+ if (!tp_config()->get('bugsnag.enabled')) {
return;
}
- $bugsnag = Client::make(config()->get('bugsnag.api_key'));
+ $bugsnag = Client::make(tp_config()->get('bugsnag.api_key'));
$this->whoops->pushHandler(function ($e) use ($bugsnag) {
$bugsnag->notifyException($e);
});
@@ -107,7 +107,7 @@ class Dev
*/
private function getTelegramSender(): void
{
- if (!config()->get('telegram_sender.enabled')) {
+ if (!tp_config()->get('telegram_sender.enabled')) {
return;
}
@@ -115,7 +115,7 @@ class Dev
$telegramSender->loggerOnly(true);
$telegramSender->setLogger((new Logger(
APP_NAME,
- [(new TelegramHandler(config()->get('telegram_sender.token'), (int)config()->get('telegram_sender.chat_id'), timeout: (int)config()->get('telegram_sender.timeout')))
+ [(new TelegramHandler(tp_config()->get('telegram_sender.token'), (int)tp_config()->get('telegram_sender.chat_id'), timeout: (int)config()->get('telegram_sender.timeout')))
->setFormatter(new TelegramFormatter())]
)));
$this->whoops->pushHandler($telegramSender);
@@ -132,7 +132,7 @@ class Dev
* Show errors on page with enhanced database information
*/
$prettyPageHandler = new \TorrentPier\Whoops\EnhancedPrettyPageHandler();
- foreach (config()->get('whoops.blacklist', []) as $key => $secrets) {
+ foreach (tp_config()->get('whoops.blacklist', []) as $key => $secrets) {
foreach ($secrets as $secret) {
$prettyPageHandler->blacklist($key, $secret);
}
@@ -181,7 +181,7 @@ class Dev
private function getWhoopsPlaceholder(): void
{
$this->whoops->pushHandler(function ($e) {
- echo config()->get('whoops.error_message');
+ echo tp_config()->get('whoops.error_message');
echo "