replace include_once, require_once by require

This commit is contained in:
Spine committed 2026-05-27 23:29:06 +02:00
1 parent 36240a6b2b
commit 06d1f3f7f4
114 files changed
+613 -610

No files matched your search

+11 -11
View File
@@ -52,17 +52,16 @@
<element key="each" value="null"/>
<element key="eval" value="null"/>
<element key="extract" value="null"/>
<!-- use is_int() instead -->
<element key="is_integer" value="null"/>
<!-- use implode(...) instead -->
<element key="join" value="null"/>
<element key="md5" value="null"/>
<element key="sha1" value="null"/>
<element key="uniqid" value="null"/>
<!-- use hash_file('sha256', ...) instead -->
<element key="sha1file" value="null"/>
<!-- use string equality instead: $x == $y -->
<element key="strcmp" value="null"/>
<element key="include" value="require"/>
<element key="include_once" value="require"/>
<element key="is_integer" value="is_int"/>
<element key="join" value="implode"/>
<element key="md5" value="hash_file"/>
<element key="require_once" value="require"/>
<element key="sha1" value="hash_file"/>
<element key="uniqid" value="hash_file"/>
<element key="sha1file" value="hash_file"/>
<element key="strcmp" value="==="/>
</property>
</properties>
<type>warning</type>
@@ -81,6 +80,7 @@
<rule ref="Generic.PHP.NoSilencedErrors" />
<rule ref="Generic.PHP.Syntax" />
<rule ref="Generic.Strings.UnnecessaryStringConcat" />
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
<rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter" />
<rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing">
+2 -2
View File
@@ -679,8 +679,8 @@ class Tag extends \Gazelle\BaseManager {
)
select t."Name" as name,
count(*) as uses,
0 as posVotes,
0 as negVotes
0 as "posVotes",
0 as "negVotes"
from relay.tags t
inner join rt on (rt.id_tag = t."ID")
group by t."Name"
+2 -5
View File
@@ -3,17 +3,14 @@
namespace Gazelle;
use Gazelle\Enum\FeaturedAlbumType;
use Gazelle\Enum\LeechType;
use Gazelle\Enum\LeechReason;
use sad_spirit\pg_wrapper\converters\containers\ArrayConverter;
use sad_spirit\pg_wrapper\converters\IntegerConverter;
use sad_spirit\pg_wrapper\converters\StringConverter;
error_reporting(E_ALL);
require_once(__DIR__ . '/../lib/bootstrap.php');
require_once(__DIR__ . '/../tests/helper.php');
require __DIR__ . '/../lib/bootstrap.php';
require __DIR__ . '/../tests/helper.php';
$remove = [];
foreach (['pcntl_fork', 'pcntl_signal', 'pcntl_signal_dispatch', 'pcntl_waitpid'] as $function) {
+1 -1
View File
@@ -3,7 +3,7 @@
declare(strict_types=1);
require_once __DIR__ . '/../lib/bootstrap.php';
require __DIR__ . '/../lib/bootstrap.php';
$out = fopen($argv[1], 'w');
if ($out === false) {
+1 -1
View File
@@ -1,7 +1,7 @@
#! /usr/bin/env php
<?php
require_once(__DIR__ . '/../lib/bootstrap.php');
require __DIR__ . '/../lib/bootstrap.php';
$logger = new Gazelle\Log;
$collageMan = new Gazelle\Manager\Collage;
+3 -3
View File
@@ -30,10 +30,10 @@ declare(strict_types=1);
namespace Gazelle;
require_once __DIR__ . '/../lib/bootstrap.php';
require __DIR__ . '/../lib/bootstrap.php';
$pg = new \Gazelle\DB\Pg(PG_RO_DSN);
$pgrw = new \Gazelle\DB\Pg(PG_RW_DSN);
$pg = new DB\Pg(PG_RO_DSN);
$pgrw = new DB\Pg(PG_RW_DSN);
$dryRun = true;
if (isset($argv[1]) && $argv[1] === '--execute') {
+6 -4
View File
@@ -2,14 +2,16 @@
/* If ever can_leech and RatioWatchEnds get out of synch, no task will catch it */
require_once __DIR__ . '/../lib/bootstrap.php';
namespace Gazelle;
require __DIR__ . '/../lib/bootstrap.php';
ini_set('max_execution_time', -1);
$tracker = new Gazelle\Tracker();
$userMan = new Gazelle\Manager\User();
$tracker = new Tracker();
$userMan = new Manager\User();
$db = Gazelle\DB::DB();
$db = DB::DB();
$db->prepared_query('
SELECT um.ID
FROM users_main um
+1 -1
View File
@@ -14,7 +14,7 @@
* try it :)
*/
require_once(__DIR__ . '/../lib/config.php');
require __DIR__ . '/../lib/config.php';
array_shift($argv);
$multi = count($argv) > 1;
+2 -2
View File
@@ -5,11 +5,11 @@ declare(strict_types=1);
namespace Gazelle;
require_once __DIR__ . '/../../lib/bootstrap.php';
require __DIR__ . '/../../lib/bootstrap.php';
array_shift($argv);
$pg = new \Gazelle\DB\Pg(PG_RW_DSN);
$pg = new DB\Pg(PG_RW_DSN);
$truncate = false;
foreach ($argv as $type) {
+1 -1
View File
@@ -3,7 +3,7 @@
namespace Gazelle;
require_once __DIR__ . "/../../lib/bootstrap.php";
require __DIR__ . "/../../lib/bootstrap.php";
$db = DB::DB();
$pg = new DB\Pg(PG_RW_DSN);
+6 -4
View File
@@ -1,16 +1,18 @@
#! /usr/bin/env php
<?php
namespace Gazelle;
use \sad_spirit\pg_wrapper\converters\containers\MultiRangeConverter;
use \sad_spirit\pg_wrapper\converters\datetime\TimeStampTzConverter;
require_once __DIR__ . "/../../lib/bootstrap.php";
require __DIR__ . "/../../lib/bootstrap.php";
// length of interval between two records to extend the date range
define('INTERVAL_DAYS', 8);
$db = Gazelle\DB::DB();
$pg = new \Gazelle\DB\Pg(PG_RW_DSN);
$db = DB::DB();
$pg = new DB\Pg(PG_RW_DSN);
$db->prepared_query("
SELECT ID FROM users_main ORDER BY 1
@@ -64,7 +66,7 @@ foreach ($list as $userId) {
}
}
function persist(\Gazelle\DB\Pg $pg, int $userId, string $ip, int $total, array $range): void {
function persist(DB\Pg $pg, int $userId, string $ip, int $total, array $range): void {
$pgRange = array_map(fn ($dates) => [
'lower' => new \DateTimeImmutable($dates['begin']),
'upper' => new \DateTimeImmutable($dates['end']),
+4 -2
View File
@@ -8,7 +8,9 @@
* longer exists.
*/
require_once __DIR__ . '/../../lib/bootstrap.php';
namespace Gazelle;
require __DIR__ . '/../../lib/bootstrap.php';
ini_set('max_execution_time', -1);
@@ -22,7 +24,7 @@ $errLog = 0;
$newHtml = 0;
$errHtml = 0;
$db = Gazelle\DB::DB();
$db = DB::DB();
while (true) {
$db->prepared_query('
+5 -3
View File
@@ -1,7 +1,9 @@
#! /usr/bin/env php
<?php
require_once __DIR__ . "/../../lib/bootstrap.php";
namespace Gazelle;
require __DIR__ . "/../../lib/bootstrap.php";
function genPlaceholders(int $num, string $val) {
for ($i = 1; $i <= $num; $i++) {
@@ -9,8 +11,8 @@ function genPlaceholders(int $num, string $val) {
}
}
$db = Gazelle\DB::DB();
$pg = new \Gazelle\DB\Pg(PG_RW_DSN);
$db = DB::DB();
$pg = new DB\Pg(PG_RW_DSN);
$values = [];
+5 -3
View File
@@ -1,10 +1,12 @@
#! /usr/bin/env php
<?php
require_once __DIR__ . '/../../lib/bootstrap.php';
namespace Gazelle;
$db = Gazelle\DB::DB();
$pg = new \Gazelle\DB\Pg(PG_RW_DSN);
require __DIR__ . '/../../lib/bootstrap.php';
$db = DB::DB();
$pg = new DB\Pg(PG_RW_DSN);
$userCount = 0;
$db->prepared_query("
SELECT ID FROM users_main ORDER BY ID
+5 -3
View File
@@ -1,18 +1,20 @@
<?php
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
require_once __DIR__ . '/../../lib/bootstrap.php';
namespace Gazelle;
require __DIR__ . '/../../lib/bootstrap.php';
ini_set('max_execution_time', -1);
define('CHUNK', 100);
$db = Gazelle\DB::DB();
$db = DB::DB();
$offset = 0;
$processed = 0;
$new = 0;
$filer = new Gazelle\File\Torrent();
$filer = new File\Torrent();
while (true) {
$db->prepared_query('
+5 -3
View File
@@ -1,15 +1,17 @@
#!/usr/bin/env php
<?php
require_once __DIR__ . '/../../lib/bootstrap.php';
namespace Gazelle;
$db = Gazelle\DB::DB();
require __DIR__ . '/../../lib/bootstrap.php';
$db = DB::DB();
$db->prepared_query("
SELECT UserID, NavItems FROM users_info WHERE NavItems != '';
");
$manager = new Gazelle\Manager\User;
$manager = new Manager\User();
$n = 0;
foreach ($db->to_array(false, MYSQLI_NUM) as [$id, $items]) {
+6 -4
View File
@@ -1,9 +1,11 @@
#!/usr/bin/env php
<?php
require_once __DIR__ . '/../../lib/bootstrap.php';
namespace Gazelle;
$db = Gazelle\DB::DB();
require __DIR__ . '/../../lib/bootstrap.php';
$db = DB::DB();
$db->prepared_query("
SELECT UserID, AdminComment, WarnedTimes FROM users_info WHERE AdminComment REGEXP ' - Warn(ed|ing) '
@@ -147,8 +149,8 @@ function insert (int $id, array $data): void {
if (count($data) < 3) {
return;
}
$user = new Gazelle\Manager\User()->findByUsername($data['who']);
new Gazelle\DB\Pg(PG_RW_DSN)->prepared_query("
$user = new Manager\User()->findByUsername($data['who']);
new DB\Pg(PG_RW_DSN)->prepared_query("
insert into user_warning
(id_user, reason, id_user_warner, warning)
values (?, ?, ?, tstzrange(?, ?))
+1 -1
View File
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Gazelle;
require_once __DIR__ . '/../../lib/bootstrap.php';
require __DIR__ . '/../../lib/bootstrap.php';
/* The phinx migration will set up the default privileges
* according to the initial installation. For a site in
+2 -2
View File
@@ -5,9 +5,9 @@ declare(strict_types=1);
namespace Gazelle;
require_once __DIR__ . '/../../lib/bootstrap.php';
require __DIR__ . '/../../lib/bootstrap.php';
$pg = new \Gazelle\DB\Pg(PG_RW_DSN);
$pg = new DB\Pg(PG_RW_DSN);
$pg->begin();
$pg->query("
+1 -1
View File
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Gazelle;
require_once __DIR__ . '/../../lib/bootstrap.php';
require __DIR__ . '/../../lib/bootstrap.php';
$db = DB::DB();
$db->prepared_query("
+1 -1
View File
@@ -98,7 +98,7 @@ declare(strict_types=1);
namespace Gazelle;
define('FAKE_USERAGENT', 'ocelotctl');
require_once __DIR__ . '/../lib/bootstrap.php';
require __DIR__ . '/../lib/bootstrap.php';
array_shift($argv);
switch (array_shift($argv) ?? '') {
+7 -5
View File
@@ -9,12 +9,14 @@
* bitcoin-cli -rpcwallet=test listtransactions \* 20 | jq '[.[]|select(.confirmations > 1)]|map([.address, .amount]|join(","))|join("|")' | tr -d \" | tr '|' '\0' | xargs -0 php process-bitcoin-donation
*/
require_once(__DIR__ . '/../lib/bootstrap.php');
namespace Gazelle;
$bitcoin = new Gazelle\Donate\Bitcoin;
$userMan = new Gazelle\Manager\User;
require __DIR__ . '/../lib/bootstrap.php';
$xbtRate = new Gazelle\Manager\XBT()->latestRate('EUR');
$bitcoin = new Donate\Bitcoin;
$userMan = new Manager\User;
$xbtRate = new Manager\XBT()->latestRate('EUR');
if (!$xbtRate) {
echo "No exchange rate for BTC\n";
exit(1);
@@ -39,7 +41,7 @@ foreach ($argv as $paymentData) {
continue;
}
$donor = new Gazelle\User\Donor($user);
$donor = new User\Donor($user);
$donor->donate(
amount: $value,
xbtRate: $xbtRate,
+7 -5
View File
@@ -7,12 +7,14 @@
* Usage: process-monero-donation <payment_id>,<eur_value> [<payment_id>,<eur_value> ...]
*/
require_once(__DIR__ . '/../lib/bootstrap.php');
namespace Gazelle;
$monero = new Gazelle\Donate\Monero;
$userMan = new Gazelle\Manager\User;
require __DIR__ . '/../lib/bootstrap.php';
$xbtRate = new Gazelle\Manager\XBT()->latestRate('EUR');
$monero = new Donate\Monero();
$userMan = new Manager\User();
$xbtRate = new Manager\XBT()->latestRate('EUR');
array_shift($argv);
foreach ($argv as $paymentData) {
@@ -33,7 +35,7 @@ foreach ($argv as $paymentData) {
continue;
}
$donor = new Gazelle\User\Donor($user);
$donor = new User\Donor($user);
$donor->donate(
amount: $eurValue,
xbtRate: $xbtRate,
+7 -4
View File
@@ -10,9 +10,12 @@
* but the resulting select query is too clever to be easily understood.
*/
require_once(__DIR__ . '/../lib/bootstrap.php');
$db = Gazelle\DB::DB();
$manager = new Gazelle\Manager\ForumThread();
namespace Gazelle;
require __DIR__ . '/../lib/bootstrap.php';
$db = DB::DB();
$manager = new Manager\ForumThread();
$db->prepared_query("
SELECT ft.ID AS id,
@@ -57,7 +60,7 @@ foreach ($db->to_array(false, MYSQLI_ASSOC) as $row) {
->modify();
}
$forumMan = new Gazelle\Manager\Forum();
$forumMan = new Manager\Forum();
$db->prepared_query("
SELECT f.ID AS forum_id FROM forums f
");
+1 -1
View File
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Gazelle;
require_once(__DIR__ . '/../lib/bootstrap.php');
require __DIR__ . '/../lib/bootstrap.php';
$pg = new DB\Pg(PG_RW_DSN);
$pg->begin();
+4 -2
View File
@@ -1,9 +1,11 @@
#! /usr/bin/env php
<?php
require_once(__DIR__ . '/../lib/bootstrap.php');
require __DIR__ . '/../lib/bootstrap.php';
$db = Gazelle\DB::DB();
namespace Gazelle;
$db = DB::DB();
$db->dropTemporaryTable("torrents_votes_new");
$db->prepared_query("
CREATE TEMPORARY TABLE torrents_votes_new LIKE torrents_votes
+9 -4
View File
@@ -16,7 +16,9 @@
* migrate existing Gazelle installations.
*/
require_once __DIR__ . '/../lib/bootstrap.php';
namespace Gazelle;
require __DIR__ . '/../lib/bootstrap.php';
$allConfig = [
'-html' => [
@@ -42,8 +44,11 @@ $allConfig = [
],
];
if ($argc < 2 || !isset($allConfig[$argv[1]])) {
die('usage: ' . basename($argv[0]) . " <-html|-log|-torrent>\n");
if (count($argv) < 2 || !isset($allConfig[$argv[1]])) {
die('usage: '
. basename($argv[0])
. " <-html|-log|-torrent>\n"
);
}
$config = $allConfig[$argv[1]];
@@ -54,7 +59,7 @@ if ($find === false) {
die("Could not popen(" . $config['PIPE'] . ")\n");
}
$db = Gazelle\DB::DB();
$db = DB::DB();
$begin = hrtime(true);
$processed = 0;
$orphan = 0;
+1 -1
View File
@@ -3,7 +3,7 @@
namespace Gazelle;
require_once(__DIR__ . '/../lib/bootstrap.php');
require __DIR__ . '/../lib/bootstrap.php';
$db = DB::DB();
$geoip = new Util\GeoIP();
+8 -5
View File
@@ -1,11 +1,14 @@
<?php
require_once __DIR__ . '/../lib/bootstrap.php';
namespace Gazelle;
require __DIR__ . '/../lib/bootstrap.php';
$Cache->disableLocalCache();
$torMan = new Gazelle\Manager\Torrent();
$encoder = new OrpheusNET\BencodeTorrent\BencodeTorrent();
$db = Gazelle\DB::DB();
$torMan = new Manager\Torrent();
$encoder = new \OrpheusNET\BencodeTorrent\BencodeTorrent();
$db = DB::DB();
$max = $db->scalar("SELECT max(ID) FROM torrents");
$id = $argv[1] ?? 0;
@@ -22,7 +25,7 @@ while ($id < $max) {
foreach ($list as $id) {
try {
$torMan->findById($id)->regenerateFilelist($encoder);
} catch (RuntimeException $e) {
} catch (\RuntimeException $e) {
echo "$id: fail: " . $e->getMessage() . "\n";
}
}
+1 -1
View File
@@ -9,7 +9,7 @@
namespace Gazelle;
require_once(__DIR__ . '/../lib/bootstrap.php');
require __DIR__ . '/../lib/bootstrap.php';
$torMan = new Manager\Torrent();
$userMan = new Manager\User();
+1 -1
View File
@@ -11,7 +11,7 @@ namespace Gazelle;
use OrpheusNET\Logchecker\Logchecker;
require_once(__DIR__ . '/../lib/bootstrap.php');
require __DIR__ . '/../lib/bootstrap.php';
$dryRun = in_array('--dry-run', $argv);
$includeAdjusted = in_array('--include-adjusted', $argv);
+5 -3
View File
@@ -4,13 +4,15 @@
// Scan each torrent and make a note of what file extensions are present.
// 1.6M torrents takes about 12 minutes, running in tmux is advised.
require_once __DIR__ . '/../lib/bootstrap.php';
namespace Gazelle;
$db = Gazelle\DB::DB();
require __DIR__ . '/../lib/bootstrap.php';
$db = DB::DB();
$max = (int)$db->scalar("
select max(id) from torrents
");
$torMan = new Gazelle\Manager\Torrent();
$torMan = new Manager\Torrent();
$seen = [];
$chunk = 10000;
$id = 0;
+1 -1
View File
@@ -3,7 +3,7 @@
namespace Gazelle;
require_once(__DIR__ . '/../lib/bootstrap.php');
require __DIR__ . '/../lib/bootstrap.php';
Base::setRequestContext(new RequestContext('cli', '127.0.0.1', 'scheduler'));
new TaskScheduler()->run();
+1 -1
View File
@@ -3,7 +3,7 @@
namespace Gazelle;
require_once __DIR__ . '/../lib/bootstrap.php';
require __DIR__ . '/../lib/bootstrap.php';
$quiet = in_array('--quiet', $argv) || in_array('-q', $argv);
$exitCode = 0;
+1 -1
View File
@@ -2,7 +2,7 @@
<?php
namespace Gazelle;
require_once __DIR__ . '/../lib/bootstrap.php';
require __DIR__ . '/../lib/bootstrap.php';
if (stream_isatty(STDIN)) {
echo "usage: tor-exit-update < torbulkexitlist\n";
+4 -2
View File
@@ -1,9 +1,11 @@
#! /usr/bin/env php
<?php
require_once(__DIR__ . '/../lib/bootstrap.php');
namespace Gazelle;
$twig = Gazelle\Util\Twig::factory(new \Gazelle\Manager\User());
require __DIR__ . '/../lib/bootstrap.php';
$twig = Util\Twig::factory(new Manager\User());
// there is no dump() in production
$twig->addFunction(new \Twig\TwigFunction('dump', function ($value) { return ''; }));
+7 -2
View File
@@ -2,8 +2,13 @@
/* A script to import the old WhatCD wiki articles from the 10th birthday release */
require_once __DIR__ . '/../lib/bootstrap.php';
namespace Gazelle;
require __DIR__ . '/../lib/bootstrap.php';
if (count($argv) < 2) {
die("no filename given\n");
}
$in = fopen($argv[1], 'r');
if ($in === false) {
exit(1);
@@ -26,7 +31,7 @@ while (($row = fgets($in))) {
$body .= $row;
}
Gazelle\DB::DB()->prepared_query('
DB::DB()->prepared_query('
INSERT INTO wiki_articles (Title, Body, MinClassRead, MinClassEdit, Date, Author)
VALUES (?, ?, 800, 800, now(), 2)
', $title, $body
+6 -6
View File
@@ -9,7 +9,7 @@ namespace Gazelle;
* either unknown to the unit tests, or the queries here do not identify them.
*/
require_once(__DIR__ . '/../lib/bootstrap.php');
require __DIR__ . '/../lib/bootstrap.php';
$pgrw = new DB\Pg(PG_RW_DSN);
@@ -126,14 +126,14 @@ foreach ($db->collect(0) as $collageId) {
}
// clean requests
$db->prepared_query("
SELECT ID
FROM requests
WHERE Title LIKE 'phpunit %'
$requestList = $pgrw->columnex("
select id_request
from request
where title ~ '^phpunit '
");
$reqMan = new Manager\Request();
foreach ($db->collect(0) as $requestId) {
foreach ($requestList as $requestId) {
$request = $reqMan->findById($requestId);
echo "request {$request->id()} ({$request->title()})\n";
$request->remove();
+5 -3
View File
@@ -1,9 +1,11 @@
#! /usr/bin/env php
<?php
require_once(__DIR__ . '/../lib/bootstrap.php');
namespace Gazelle;
$db = Gazelle\DB::DB();
require __DIR__ . '/../lib/bootstrap.php';
$db = DB::DB();
$db->prepared_query("
select v.ID
@@ -19,7 +21,7 @@ $db->prepared_query("
where v.Encoding = 'V2 (VBR)'
");
$torMan = new Gazelle\Manager\Torrent;
$torMan = new Manager\Torrent();
foreach ($db->collect(0) as $id) {
$torrent = $torMan->findById($id);
+2 -2
View File
@@ -2,7 +2,7 @@
// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
require_once __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/vendor/autoload.php';
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Driver\Selector;
@@ -62,4 +62,4 @@ class CoverageHelper {
}
$coverage_helper = new CoverageHelper();
require_once __DIR__ . '/gazelle.php';
require __DIR__ . '/gazelle.php';
+3 -3
View File
@@ -8,14 +8,14 @@ use Gazelle\Util\Time;
// 1. Initialization
require_once __DIR__ . '/lib/bootstrap.php';
require __DIR__ . '/lib/bootstrap.php';
global $Cache, $Debug, $Twig;
$Debug->mark('bootstrap complete');
register_shutdown_function(
function () {
if (preg_match(DEBUG_URI, $_SERVER['REQUEST_URI'])) {
include DEBUG_TRACE; /** @phpstan-ignore-line */
require DEBUG_TRACE; /** @phpstan-ignore-line */
}
$error = error_get_last();
global $Debug;
@@ -161,7 +161,7 @@ if ($file === false) {
try {
$Debug->mark('call ' . str_replace(SERVER_ROOT . '/', '', $file));
include_once $file;
require $file;
} catch (\Error | \Exception $e) {
// if there was an ongoing transaction, abort it
if ($e::class === DB\MysqlException::class) {
+3 -3
View File
@@ -16,9 +16,9 @@ date_default_timezone_set('UTC');
if (!defined('SITE_NAME')) {
ob_start();
include_once __DIR__ . '/config.php';
include_once __DIR__ . '/../lib/util.php';
include_once __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/config.php';
require __DIR__ . '/../lib/util.php';
require __DIR__ . '/../vendor/autoload.php';
ob_end_clean();
}
+1 -1
View File
@@ -33,7 +33,7 @@
*/
if (file_exists(__DIR__ . '/override.config.php')) {
include_once __DIR__ . '/override.config.php';
require __DIR__ . '/override.config.php';
}
// ------------------------------------------------------------------------
@@ -5,10 +5,6 @@ declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
use Phinx\Db\Adapter\MysqlAdapter;
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
require_once __DIR__ . '/../../lib/config.php'; // for SITE_NAME
// phpcs:enable PSR1.Files.SideEffects.FoundWithSymbols
final class ReportTypes extends AbstractMigration {
public function up(): void {
$this->table('category', ['id' => false, 'primary_key' => ['category_id'], 'encoding' => 'utf8mb4'])
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
require_once __DIR__ . '/../lib/config.php';
require __DIR__ . '/../lib/config.php';
/* This second batch of Mysql migrations are run after the Postgresql migrations
* have been run. This is needed for the CI, to drop tables in the Mysql schema
@@ -4,10 +4,6 @@ declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
require_once __DIR__ . '/../../lib/config.php';
// phpcs:enable PSR1.Files.SideEffects.FoundWithSymbols
final class Fdw extends AbstractMigration {
protected array $enum = [ /** @phpstan-ignore-line */
/*
@@ -3,8 +3,8 @@
declare(strict_types=1);
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
require_once __DIR__ . '/../../lib/util.php';
require_once __DIR__ . '/../../lib/bootstrap.php';
require __DIR__ . '/../../lib/util.php';
require __DIR__ . '/../../lib/bootstrap.php';
// phpcs:enable PSR1.Files.SideEffects.FoundWithSymbols
/**
@@ -2,10 +2,6 @@
declare(strict_types=1);
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
require_once __DIR__ . '/../../lib/config.php';
// phpcs:enable PSR1.Files.SideEffects.FoundWithSymbols
use Phinx\Migration\AbstractMigration;
final class ArtistUsageRole extends AbstractMigration {
@@ -4,10 +4,6 @@ declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
require_once __DIR__ . '/../../lib/config.php';
// phpcs:enable PSR1.Files.SideEffects.FoundWithSymbols
final class ReadRelay extends AbstractMigration {
public function up(): void {
$login = MYSQL_RO_USER;
@@ -4,10 +4,6 @@ declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
require_once __DIR__ . '/../../lib/config.php';
// phpcs:enable PSR1.Files.SideEffects.FoundWithSymbols
final class Resource extends AbstractMigration {
/**
* @param array<string> $resourceList
@@ -2,10 +2,6 @@
declare(strict_types=1);
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
require_once __DIR__ . '/../../lib/config.php';
// phpcs:enable PSR1.Files.SideEffects.FoundWithSymbols
use Phinx\Migration\AbstractMigration;
final class CategoryBonusScale extends AbstractMigration {
@@ -2,10 +2,6 @@
declare(strict_types=1);
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
require_once __DIR__ . '/../../lib/config.php';
// phpcs:enable PSR1.Files.SideEffects.FoundWithSymbols
use Phinx\Migration\AbstractMigration;
final class BonusPointAccrualStats extends AbstractMigration {
@@ -2,10 +2,6 @@
declare(strict_types=1);
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
require_once __DIR__ . '/../../lib/config.php';
// phpcs:enable PSR1.Files.SideEffects.FoundWithSymbols
use Phinx\Migration\AbstractMigration;
final class DropUsersMainCollageTotal extends AbstractMigration {
@@ -4,10 +4,6 @@ declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
require_once __DIR__ . '/../../lib/config.php';
// phpcs:enable PSR1.Files.SideEffects.FoundWithSymbols
final class DropUsersInfoNavItems extends AbstractMigration {
public function change(): void {
$this->query("
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
require_once __DIR__ . '/../lib/config.php';
require __DIR__ . '/../lib/config.php';
return [
'paths' => [
+2 -2
View File
@@ -1,7 +1,7 @@
<?php
require_once __DIR__ . '/../lib/bootstrap.php';
require_once __DIR__ . '/../tests/helper.php';
require __DIR__ . '/../lib/bootstrap.php';
require __DIR__ . '/../tests/helper.php';
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
require_once __DIR__ . '/lib/config.php';
require __DIR__ . '/lib/config.php';
return [
'paths' => [
+2 -2
View File
@@ -16,5 +16,5 @@ header('Expires: ' . date('D, d M Y H:i:s', time() + (2 * 60 * 60)) . ' GMT');
header('Last-Modified: ' . date('D, d M Y H:i:s') . ' GMT');
header('Content-type: application/json');
require_once __DIR__ . '/../lib/bootstrap.php';
require_once __DIR__ . '/../sections/api/index.php';
require __DIR__ . '/../lib/bootstrap.php';
require __DIR__ . '/../sections/api/index.php';
+1 -1
View File
@@ -5,7 +5,7 @@ if (isset($_GET['clearcache'])) {
unset($_GET['clearcache']);
}
require_once __DIR__ . '/../lib/bootstrap.php';
require __DIR__ . '/../lib/bootstrap.php';
$user = new Gazelle\Manager\User()->findByAnnounceKey($_GET['passkey'] ?? '');
$feed = new Gazelle\Feed();
+1 -1
View File
@@ -1,3 +1,3 @@
<?php
require_once __DIR__ . '/../gazelle.php';
require __DIR__ . '/../gazelle.php';
+1 -1
View File
@@ -5,7 +5,7 @@
header('Content-type: application/opensearchdescription+xml');
require_once __DIR__ . '/../lib/config.php';
require __DIR__ . '/../lib/config.php';
$Type = in_array(($_GET['type'] ?? ''), ['torrents','artists','requests','forums','users','wiki','log'])
? $_GET['type']
+3 -3
View File
@@ -4,8 +4,8 @@ declare(strict_types=1);
namespace Gazelle;
require_once __DIR__ . '/' . match ($_GET['method'] ?? null) {
'transcode' => 'transcode.php',
'single' => 'single.php',
require __DIR__ . match ($_GET['method'] ?? '') {
'transcode' => '/transcode.php',
'single' => '/single.php',
default => json_error('bad method'),
};
+4 -4
View File
@@ -6,19 +6,19 @@ namespace Gazelle;
switch ($_REQUEST['type'] ?? null) {
case 'artists':
require_once __DIR__ . '/artists.php';
require __DIR__ . '/artists.php';
break;
case 'collages':
// FIXME: not implemented
json_die('not implemented');
//$_GET['bookmarks'] = 1;
//require_once __DIR__ . '/browse.php';
//require __DIR__ . '/browse.php';
//break;
case 'requests':
$_GET['type'] = 'bookmarks';
require_once __DIR__ . '/../requests.php';
require __DIR__ . '/../requests.php';
break;
default:
require_once __DIR__ . '/torrents.php';
require __DIR__ . '/torrents.php';
break;
}
+4 -5
View File
@@ -9,9 +9,8 @@ if ($Viewer->disableForums()) {
json_die('not allowed');
}
require_once __DIR__ . '/' . match ($_GET['type'] ?? 'main') {
'main' => 'main.php',
'viewforum' => 'forum.php',
'viewthread' => 'thread.php',
default => json_error('type'),
require __DIR__ . match ($_GET['type'] ?? '') {
'viewforum' => '/forum.php',
'viewthread' => '/thread.php',
default => '/main.php',
};
+3 -3
View File
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Gazelle;
require_once __DIR__ . '/' . match ($_GET['type'] ?? 'inbox') {
'viewconv' => 'viewconv.php',
default => 'inbox.php',
require __DIR__ . match ($_GET['type'] ?? '') {
'viewconv' => '/viewconv.php',
default => '/inbox.php',
};
+51 -51
View File
@@ -99,166 +99,166 @@ switch ($Action) {
// things (that may be) used on the site
case 'upload_section':
// Gets one of the upload forms
include_once 'upload.php';
require __DIR__ . '/upload.php';
break;
case 'preview':
include_once 'preview.php';
require __DIR__ . '/preview.php';
break;
case 'add_tag':
include_once 'torrent_tag_add.php';
require __DIR__ . '/torrent_tag_add.php';
break;
case 'delete_tag':
include_once 'torrent_tag_remove.php';
require __DIR__ . '/torrent_tag_remove.php';
break;
case 'stats':
include_once 'stats.php';
require __DIR__ . '/stats.php';
break;
// things not yet used on the site
case 'torrent':
include_once 'torrent.php';
require __DIR__ . '/torrent.php';
break;
case 'torrentgroup':
include_once 'torrentgroup.php';
require __DIR__ . '/torrentgroup.php';
break;
case 'torrentgroupalbumart': // so the album art script can function without breaking the ratelimit
include_once 'torrentgroupalbumart.php';
require __DIR__ . '/torrentgroupalbumart.php';
break;
case 'torrent_remove_cover_art':
include_once 'torrent_remove_cover_art.php';
require __DIR__ . '/torrent_remove_cover_art.php';
break;
case 'tcomments':
include_once 'tcomments.php';
require __DIR__ . '/tcomments.php';
break;
case 'user':
include_once 'user.php';
require __DIR__ . '/user.php';
break;
case 'forum':
include_once 'forum/index.php';
require __DIR__ . '/forum/index.php';
break;
case 'post_edit':
include_once 'post_edit.php';
require __DIR__ . '/post_edit.php';
break;
case 'top10':
include_once 'top10/index.php';
require __DIR__ . '/top10/index.php';
break;
case 'browse':
include_once 'browse.php';
require __DIR__ . '/browse.php';
break;
case 'usersearch':
include_once 'usersearch.php';
require __DIR__ . '/usersearch.php';
break;
case 'requests':
include_once 'requests.php';
require __DIR__ . '/requests.php';
break;
case 'artist':
include_once 'artist.php';
require __DIR__ . '/artist.php';
break;
case 'add_similar':
include_once __DIR__ . '/../artist/add_similar.php';
require __DIR__ . '/../artist/add_similar.php';
break;
case 'inbox':
include_once 'inbox/index.php';
require __DIR__ . '/inbox/index.php';
break;
case 'subscriptions':
include_once 'subscriptions.php';
require __DIR__ . '/subscriptions.php';
break;
case 'index':
include_once 'info.php';
require __DIR__ . '/info.php';
break;
case 'bookmarks':
include_once 'bookmarks/index.php';
require __DIR__ . '/bookmarks/index.php';
break;
case 'announcements':
include_once 'announcements.php';
require __DIR__ . '/announcements.php';
break;
case 'request':
include_once 'request.php';
require __DIR__ . '/request.php';
break;
case 'loadavg':
include_once 'loadavg.php';
require __DIR__ . '/loadavg.php';
break;
case 'better':
include_once 'better/index.php';
require __DIR__ . '/better/index.php';
break;
case 'password_validate':
include_once 'password_validate.php';
require __DIR__ . '/password_validate.php';
break;
case 'similar_artists':
include_once 'similar_artists.php';
require __DIR__ . '/similar_artists.php';
break;
case 'userhistory':
match ($_GET['type'] ?? '') {
'posts' => include_once 'userhistory/post_history.php',
'posts' => require __DIR__ . '/userhistory/post_history.php',
default => json_error('bad type'),
};
break;
case 'votefavorite':
include_once 'vote_handle.php';
require __DIR__ . '/vote_handle.php';
break;
case 'wiki':
include_once 'wiki.php';
require __DIR__ . '/wiki.php';
break;
case 'get_friends':
echo json_encode(new User\Friend($Viewer)->userList());
break;
case 'news_ajax':
include_once 'news_ajax.php';
require __DIR__ . '/news_ajax.php';
break;
case 'user_recents':
include_once 'user_recents.php';
require __DIR__ . '/user_recents.php';
break;
case 'collage':
include_once 'collage.php';
require __DIR__ . '/collage.php';
break;
case 'raw_bbcode':
include_once 'raw_bbcode.php';
require __DIR__ . '/raw_bbcode.php';
break;
case 'notifications':
include_once 'notifications.php';
require __DIR__ . '/notifications.php';
break;
case 'get_user_notifications':
include_once 'get_user_notifications.php';
require __DIR__ . '/get_user_notifications.php';
break;
case 'clear_user_notification':
include_once 'clear_user_notification.php';
require __DIR__ . '/clear_user_notification.php';
break;
case 'push_cycle_topic':
include_once 'push_cycle_topic.php';
require __DIR__ . '/push_cycle_topic.php';
break;
case 'push_test':
include_once 'push_test.php';
require __DIR__ . '/push_test.php';
break;
case 'loggy':
include_once 'loggy.php';
require __DIR__ . '/loggy.php';
break;
case 'user_stats':
include_once 'stats/users.php';
require __DIR__ . '/stats/users.php';
break;
case 'torrent_stats':
include_once 'stats/torrents.php';
require __DIR__ . '/stats/torrents.php';
break;
case 'logchecker':
include_once 'logchecker.php';
require __DIR__ . '/logchecker.php';
break;
case 'riplog':
include_once 'riplog.php';
require __DIR__ . '/riplog.php';
break;
case 'upload':
include_once __DIR__ . '/../upload/upload_handle.php';
require __DIR__ . '/../upload/upload_handle.php';
break;
case 'download':
include_once __DIR__ . '/../torrents/download.php';
require __DIR__ . '/../torrents/download.php';
break;
case 'request_fill':
json_print('success', include_once __DIR__ . '/../requests/fill_handle.php');
json_print('success', require __DIR__ . '/../requests/fill_handle.php');
break;
case 'add_log':
include_once __DIR__ . '/add_log.php';
require __DIR__ . '/add_log.php';
break;
case 'user_torrents':
include_once __DIR__ . '/user_torrents.php';
require __DIR__ . '/user_torrents.php';
break;
default:
// If they're screwing around with the query string
+4 -5
View File
@@ -9,9 +9,8 @@ if (!$Viewer->permitted('site_top10')) {
json_die('not allowed');
}
require_once __DIR__ . '/' . match ($_GET['type'] ?? 'torrents') {
'tags' => 'tags.php',
'torrents' => 'torrents.php',
'users' => 'users.php',
default => json_error('bad type'),
require __DIR__ . match ($_GET['type'] ?? '') {
'tags' => '/tags.php',
'users' => '/users.php',
default => '/torrents.php',
};
+2 -2
View File
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Gazelle;
require_once __DIR__ . '/' . match ($_GET['type'] ?? null) {
'posts' => 'post_history.php',
require __DIR__ . match ($_GET['type'] ?? '') {
'posts' => '/post_history.php',
default => json_error('bad type'),
};
+5 -5
View File
@@ -4,9 +4,9 @@ declare(strict_types=1);
namespace Gazelle;
require_once match ($_GET['action'] ?? '') {
'admin' => 'admin.php',
'edit' => 'edit.php',
'view' => 'view.php',
default => 'apply.php',
require __DIR__ . match ($_GET['action'] ?? '') {
'admin' => '/admin.php',
'edit' => '/edit.php',
'view' => '/view.php',
default => '/apply.php',
};
+26 -26
View File
@@ -5,37 +5,37 @@ declare(strict_types=1);
namespace Gazelle;
if (!empty($_POST['action'])) {
match ($_POST['action']) {
'add_similar' => include_once 'add_similar.php',
'add_alias' => include_once 'add_alias.php',
'change_artistid' => include_once 'change_artistid.php',
'download' => include_once 'download.php',
'rename' => include_once 'rename.php',
'edit' => include_once 'edit_handle.php',
'takeeditrequest' => include_once 'edit_request_handle.php',
if (isset($_POST['action'])) {
require __DIR__ . match ($_POST['action']) {
'add_similar' => '/add_similar.php',
'add_alias' => '/add_alias.php',
'change_artistid' => '/change_artistid.php',
'download' => '/download.php',
'rename' => '/rename.php',
'edit' => '/edit_handle.php',
'takeeditrequest' => '/edit_request_handle.php',
default => Error400::error('Missing artist POST action'),
};
} elseif (!empty($_GET['action'])) {
match ($_GET['action']) {
'autocomplete' => include_once 'autocomplete.php',
'change_artistid' => include_once 'change_artistid.php',
'delete' => include_once 'delete.php',
'delete_alias' => include_once 'delete_alias.php',
'delete_similar' => include_once 'delete_similar.php',
'edit' => include_once 'edit.php',
'editrequest' => include_once 'edit_request.php',
'history' => include_once 'history.php',
'notify' => include_once 'notify.php',
'notifyremove' => include_once 'notify_remove.php',
'revert' => include_once 'edit_handle.php',
'vote_similar' => include_once 'vote_similar.php',
} elseif (isset($_GET['action'])) {
require __DIR__ . match ($_GET['action']) {
'autocomplete' => '/autocomplete.php',
'change_artistid' => '/change_artistid.php',
'delete' => '/delete.php',
'delete_alias' => '/delete_alias.php',
'delete_similar' => '/delete_similar.php',
'edit' => '/edit.php',
'editrequest' => '/edit_request.php',
'history' => '/history.php',
'notify' => '/notify.php',
'notifyremove' => '/notify_remove.php',
'revert' => '/edit_handle.php',
'vote_similar' => '/vote_similar.php',
default => Error400::error('Missing artist action'),
};
} else {
if (!empty($_GET['id'])) {
include_once 'artist.php';
} elseif (empty($_GET['artistname'])) {
if (isset($_GET['id'])) {
require __DIR__ . '/artist.php';
} elseif (!isset($_GET['artistname'])) {
header('Location: torrents.php');
} else {
$db = DB::DB();
+3 -3
View File
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Gazelle;
require_once match ($_GET['method'] ?? '') {
'transcode' => 'transcode.php',
default => 'better.php',
require __DIR__ . match ($_GET['method'] ?? '') {
'transcode' => '/transcode.php',
default => '/better.php',
};
+6 -6
View File
@@ -4,10 +4,10 @@ declare(strict_types=1);
namespace Gazelle;
require_once match ($_REQUEST['action'] ?? '') {
'deadthread' => 'dead_thread.php',
'deleteblog' => 'delete_blog.php',
'takeeditblog' => 'edit_blog_handle.php',
'takenewblog' => 'new_blog_handle.php',
default => 'blog_page.php',
require __DIR__ . match ($_REQUEST['action'] ?? '') {
'deadthread' => '/dead_thread.php',
'deleteblog' => '/delete_blog.php',
'takeeditblog' => '/edit_blog_handle.php',
'takenewblog' => '/new_blog_handle.php',
default => '/blog_page.php',
};
+5 -5
View File
@@ -11,23 +11,23 @@ if ($Viewer->disableBonusPoints()) {
switch ($_REQUEST['action'] ?? '') {
case 'bprates':
include_once 'bprates.php';
require __DIR__ . '/bprates.php';
break;
case 'cacheflush':
new Manager\Bonus()->flush();
header("Location: bonus.php");
exit;
case 'history':
include_once 'history.php';
require __DIR__ . '/history.php';
break;
case 'prepare':
include_once 'prepare.php';
require __DIR__ . '/prepare.php';
break;
case 'purchase':
include_once 'purchase.php';
require __DIR__ . '/purchase.php';
break;
case 'donate':
default:
include_once 'shop.php';
require __DIR__ . '/shop.php';
break;
}
+9 -9
View File
@@ -6,24 +6,24 @@ namespace Gazelle;
switch ($_REQUEST['action'] ?? 'view') {
case 'add':
include_once 'add.php';
require __DIR__ . '/add.php';
break;
case 'remove':
include_once 'remove.php';
require __DIR__ . '/remove.php';
break;
case 'mass_edit':
include_once 'mass_edit.php';
require __DIR__ . '/mass_edit.php';
break;
case 'remove_snatched':
include_once 'remove_snatched.php';
require __DIR__ . '/remove_snatched.php';
break;
case 'edit':
match ($_REQUEST['type'] ?? '') {
'torrents' => include_once 'edit_torrents.php',
'torrents' => require __DIR__ . '/edit_torrents.php',
default => Error404::error(),
};
break;
@@ -31,18 +31,18 @@ switch ($_REQUEST['action'] ?? 'view') {
case 'view':
switch ($_REQUEST['type'] ?? 'torrents') {
case 'torrents':
include_once 'torrents.php';
require __DIR__ . '/torrents.php';
break;
case 'artists':
include_once 'artists.php';
require __DIR__ . '/artists.php';
break;
case 'collages':
$_GET['bookmarks'] = '1';
include_once __DIR__ . '/../collages/browse.php';
require __DIR__ . '/../collages/browse.php';
break;
case 'requests':
$_GET['type'] = 'bookmarks';
include_once __DIR__ . '/../requests/requests.php';
require __DIR__ . '/../requests/requests.php';
break;
default:
Error404::error();
+4 -4
View File
@@ -6,11 +6,11 @@ declare(strict_types=1);
namespace Gazelle;
if (!$Viewer || $Viewer->isLocked()) {
include_once 'webirc_disabled.php';
require __DIR__ . '/webirc_disabled.php';
exit;
}
require_once match ($_REQUEST['action'] ?? '') {
'webirc' => 'webirc.php',
default => 'join.php',
require match ($_REQUEST['action'] ?? '') {
'webirc' => __DIR__ . '/webirc.php',
default => __DIR__ . '/join.php',
};
+1 -1
View File
@@ -14,4 +14,4 @@ if ($collage->isDeleted()) {
exit;
}
require_once $collage->isArtist() ? 'collage_artists.php' : 'collage_torrent.php';
require __DIR__ . ($collage->isArtist() ? '/collage_artists.php' : '/collage_torrent.php');
+1 -1
View File
@@ -38,7 +38,7 @@ if (isset($_POST['name'])) {
$Err = "A collage with that name already exists: {$check->link()}.";
}
$ErrNoEscape = true;
include 'edit.php';
require __DIR__ . '/edit.php';
exit;
}
if ($collage->isOwner($Viewer)) {
+19 -19
View File
@@ -4,25 +4,25 @@ declare(strict_types=1);
namespace Gazelle;
require_once match ($_REQUEST['action'] ?? '') {
require __DIR__ . match ($_REQUEST['action'] ?? '') {
'add_torrent',
'add_torrent_batch' => 'add_torrent.php',
'add_torrent_batch' => '/add_torrent.php',
'add_artist',
'add_artist_batch' => 'add_artist.php',
'ajax_add' => 'ajax_add.php',
'autocomplete' => 'autocomplete.php',
'comments' => 'all_comments.php',
'delete' => 'delete.php',
'take_delete' => 'delete_handle.php',
'download' => 'download.php',
'edit' => 'edit.php',
'edit_handle' => 'edit_handle.php',
'manage' => 'manage.php',
'manage_handle' => 'manage_handle.php',
'manage_artists' => 'manage_artists.php',
'manage_artists_handle' => 'manage_artists_handle.php',
'new' => 'new.php',
'new_handle' => 'new_handle.php',
'recover' => 'recover.php',
default => empty($_GET['id']) ? 'browse.php' : 'collage.php',
'add_artist_batch' => '/add_artist.php',
'ajax_add' => '/ajax_add.php',
'autocomplete' => '/autocomplete.php',
'comments' => '/all_comments.php',
'delete' => '/delete.php',
'take_delete' => '/delete_handle.php',
'download' => '/download.php',
'edit' => '/edit.php',
'edit_handle' => '/edit_handle.php',
'manage' => '/manage.php',
'manage_handle' => '/manage_handle.php',
'manage_artists' => '/manage_artists.php',
'manage_artists_handle' => '/manage_artists_handle.php',
'new' => '/new.php',
'new_handle' => '/new_handle.php',
'recover' => '/recover.php',
default => isset($_GET['id']) ? '/collage.php' : '/browse.php',
};
+1 -1
View File
@@ -58,7 +58,7 @@ if ($Err) {
$Category = $categoryId;
$Tags = $_POST['tags'];
$Description = $_POST['description'];
include 'new.php';
require __DIR__ . '/new.php';
exit;
}
+9 -9
View File
@@ -4,13 +4,13 @@ declare(strict_types=1);
namespace Gazelle;
require_once match ($_REQUEST['action'] ?? null) {
'get' => 'get.php',
'jump' => 'jump.php',
'take_delete' => 'delete_handle.php',
'take_edit' => 'edit_handle.php',
'take_post' => 'post_handle.php',
'take_warn' => 'warn_handle.php',
'warn' => 'warn.php',
default => 'comments.php',
require __DIR__ . match ($_REQUEST['action'] ?? null) {
'get' => '/get.php',
'jump' => '/jump.php',
'take_delete' => '/delete_handle.php',
'take_edit' => '/edit_handle.php',
'take_post' => '/post_handle.php',
'take_warn' => '/warn_handle.php',
'warn' => '/warn.php',
default => '/comments.php',
};
+1 -1
View File
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Gazelle;
require_once __DIR__ . '/../forums/do_warn.php';
require __DIR__ . '/../forums/do_warn.php';
[$post, $body] = handleWarningRequest(new Manager\Comment());
$post->setField('Body', $body)
+2 -2
View File
@@ -10,11 +10,11 @@ $contestMan = new Manager\Contest();
switch ($_GET['action'] ?? '') {
case 'leaderboard':
include 'leaderboard.php';
require __DIR__ . '/leaderboard.php';
break;
case 'admin':
case 'create':
include 'admin.php';
require __DIR__ . '/admin.php';
break;
default:
echo $Twig->render('contest/intro.twig', [
+23 -23
View File
@@ -9,27 +9,27 @@ if ($Viewer->disableForums()) {
Error403::error();
}
require_once match ($_REQUEST['action'] ?? '') {
'add_poll_option' => 'add_poll_option.php',
'autosub' => 'autosub.php',
'catchup' => 'catchup.php',
'change_vote' => 'change_vote.php',
'delete' => 'delete.php',
'delete_poll_option' => 'delete_poll_option.php',
'get_post' => 'get_post.php',
'mod_thread' => 'thread_handle.php',
'take-new' => 'new_thread_handle.php',
'new' => 'new_thread.php',
'poll_mod' => 'poll_mod.php',
'reply' => 'reply_handle.php',
'search' => 'search.php',
'sticky_post' => 'sticky_post.php',
'take_topic_notes' => 'thread_notes_handle.php',
'take_warn' => 'warn_handle.php',
'takeedit' => 'edit_handle.php',
'viewforum' => 'forum.php',
'viewthread' => 'thread.php',
'viewtopic' => 'thread.php',
'warn' => 'warn.php',
default => 'main.php',
require __DIR__ . match ($_REQUEST['action'] ?? '') {
'add_poll_option' => '/add_poll_option.php',
'autosub' => '/autosub.php',
'catchup' => '/catchup.php',
'change_vote' => '/change_vote.php',
'delete' => '/delete.php',
'delete_poll_option' => '/delete_poll_option.php',
'get_post' => '/get_post.php',
'mod_thread' => '/thread_handle.php',
'take-new' => '/new_thread_handle.php',
'new' => '/new_thread.php',
'poll_mod' => '/poll_mod.php',
'reply' => '/reply_handle.php',
'search' => '/search.php',
'sticky_post' => '/sticky_post.php',
'take_topic_notes' => '/thread_notes_handle.php',
'take_warn' => '/warn_handle.php',
'takeedit' => '/edit_handle.php',
'viewforum' => '/forum.php',
'viewthread',
'viewtopic' => '/thread.php',
'warn' => '/warn.php',
default => '/main.php',
};
+1 -1
View File
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Gazelle;
require_once 'do_warn.php';
require __DIR__ . '/do_warn.php';
[$post, $body] = handleWarningRequest(new Manager\ForumPost());
$post->edit($Viewer, $body);
if ($post->isPinned()) {
+5 -5
View File
@@ -4,9 +4,9 @@ declare(strict_types=1);
namespace Gazelle;
require_once match ($_REQUEST['action'] ?? '') {
'add' => 'add.php',
'Save notes' => 'comment.php',
'Unfriend' => 'remove.php',
default => 'friends.php',
require __DIR__ . match ($_REQUEST['action'] ?? '') {
'add' => '/add.php',
'Save notes' => '/comment.php',
'Unfriend' => '/remove.php',
default => '/friends.php',
};
+3 -3
View File
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Gazelle;
require_once __DIR__ . '/' . match ($_GET['action'] ?? '') {
'open' => 'open.php',
default => 'gift.php',
require __DIR__ . match ($_GET['action'] ?? '') {
'open' => '/open.php',
default => '/gift.php',
};
+3 -3
View File
@@ -6,13 +6,13 @@ declare(strict_types=1);
namespace Gazelle;
if (!isset($Viewer)) {
include 'public.php';
require __DIR__ . '/public.php';
} else {
if (!isset($_REQUEST['action'])) {
include 'private.php';
require __DIR__ . '/private.php';
} else {
match ($_REQUEST['action']) {
'poll' => include __DIR__ . '/../forums/poll_vote.php',
'poll' => require __DIR__ . '/../forums/poll_vote.php',
default => Error400::error('Unknown action requested'),
};
}
+6 -6
View File
@@ -4,10 +4,10 @@ declare(strict_types=1);
namespace Gazelle;
require_once match ($_REQUEST['action'] ?? 'test') {
'update' => 'update.php',
'upload' => 'upload.php',
'take_upload' => 'upload_handle.php',
'take_test' => 'test_handle.php',
default => 'test.php',
require __DIR__ . match ($_REQUEST['action'] ?? '') {
'update' => '/update.php',
'upload' => '/upload.php',
'take_upload' => '/upload_handle.php',
'take_test' => '/test_handle.php',
default => '/test.php',
};
+4 -4
View File
@@ -4,8 +4,8 @@ declare(strict_types=1);
namespace Gazelle;
require_once match ($_REQUEST['action'] ?? '') {
'disabled' => 'disabled.php',
'recover' => isset($_REQUEST['key']) ? 'recover_step2.php' : 'recover_step1.php',
default => 'login.php',
require __DIR__ . match ($_REQUEST['action'] ?? '') {
'disabled' => '/disabled.php',
'recover' => isset($_REQUEST['key']) ? '/recover_step2.php' : '/recover_step1.php',
default => '/login.php',
};
+7 -7
View File
@@ -4,11 +4,11 @@ declare(strict_types=1);
namespace Gazelle;
require_once match ($_GET['action'] ?? '') {
'admin' => 'admin.php',
'browse' => 'browse.php',
'pair' => 'pair.php',
'save' => RECOVERY ? 'save.php' : 'recover.php',
'search', 'view' => 'view.php',
default => 'recover.php',
require __DIR__ . match ($_GET['action'] ?? '') {
'admin' => '/admin.php',
'browse' => '/browse.php',
'pair' => '/pair.php',
'save' => RECOVERY ? '/save.php' : '/recover.php',
'search', 'view' => '/view.php',
default => '/recover.php',
};
+2 -2
View File
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Gazelle;
if (isset($_REQUEST['action'])) {
include_once 'reports_handle.php';
require __DIR__ . '/reports_handle.php';
} else {
include_once 'reports.php';
require __DIR__ . '/reports.php';
}
+1 -1
View File
@@ -17,7 +17,7 @@ if (!$reportId || !$id || is_null($type)) {
Error400::error();
}
require_once 'array.php';
require __DIR__ . '/array.php';
/** @var array $Types */
$reportType = $Types[$type];
+12 -12
View File
@@ -4,16 +4,16 @@ declare(strict_types=1);
namespace Gazelle;
require_once match ($_REQUEST['action'] ?? '') {
'add_notes' => 'ajax_add_notes.php',
'claim' => 'ajax_claim_report.php',
'compose' => 'compose.php',
'report' => 'report.php',
'resolve' => 'ajax_resolve_report.php',
'stats' => 'stats.php',
'takecompose' => 'compose_handle.php',
'takereport' => 'report_handle.php',
'takeresolve' => 'resolve_handle.php',
'unclaim' => 'ajax_unclaim_report.php',
default => 'reports.php',
require __DIR__ . match ($_REQUEST['action'] ?? '') {
'add_notes' => '/ajax_add_notes.php',
'claim' => '/ajax_claim_report.php',
'compose' => '/compose.php',
'report' => '/report.php',
'resolve' => '/ajax_resolve_report.php',
'stats' => '/stats.php',
'takecompose' => '/compose_handle.php',
'takereport' => '/report_handle.php',
'takeresolve' => '/resolve_handle.php',
'unclaim' => '/ajax_unclaim_report.php',
default => '/reports.php',
};
+1 -1
View File
@@ -11,7 +11,7 @@ if (!$id) {
Error404::error();
}
require_once 'array.php';
require __DIR__ . '/array.php';
if (!isset($Types[$_GET['type'] ?? ''])) {
Error403::error();
}
+1 -1
View File
@@ -14,7 +14,7 @@ if (!$subjectId || empty($_POST['type'])) {
Error400::error();
}
require_once 'array.php';
require __DIR__ . '/array.php';
/** @var array $Types */
if (!array_key_exists($_POST['type'], $Types)) {
Error400::error();
+1 -1
View File
@@ -10,7 +10,7 @@ if (!$Viewer->permittedAny('admin_reports', 'site_moderate_forums')) {
Error403::error();
}
require_once 'array.php';
require __DIR__ . '/array.php';
$search = new Search\Report();
$paginator = new Util\Paginator(REPORTS_PER_PAGE, (int)($_REQUEST['page'] ?? 1));
+16 -16
View File
@@ -4,20 +4,20 @@ declare(strict_types=1);
namespace Gazelle;
require_once match ($_REQUEST['action'] ?? '') {
'ajax_claim' => 'ajax_claim.php',
'ajax_get_resolve_options' => 'ajax_get_resolve_options.php',
'ajax_new_report' => 'ajax_new_report.php',
'ajax_report' => 'ajax_report.php',
'ajax_switch' => 'ajax_switch.php',
'ajax_take_pm' => 'ajax_take_pm.php',
'ajax_unclaim' => 'ajax_unclaim.php',
'ajax_update_comment' => 'ajax_update_comment.php',
'ajax_update_resolve' => 'ajax_update_resolve.php',
'new' => 'reports.php',
'report' => 'create.php',
'search' => 'search.php',
'takereport' => 'report_handle.php',
'takeresolve' => 'resolve_handle.php',
default => isset($_GET['view']) ? 'static.php' : 'views.php',
require __DIR__ . match ($_REQUEST['action'] ?? '') {
'ajax_claim' => '/ajax_claim.php',
'ajax_get_resolve_options' => '/ajax_get_resolve_options.php',
'ajax_new_report' => '/ajax_new_report.php',
'ajax_report' => '/ajax_report.php',
'ajax_switch' => '/ajax_switch.php',
'ajax_take_pm' => '/ajax_take_pm.php',
'ajax_unclaim' => '/ajax_unclaim.php',
'ajax_update_comment' => '/ajax_update_comment.php',
'ajax_update_resolve' => '/ajax_update_resolve.php',
'new' => '/reports.php',
'report' => '/create.php',
'search' => '/search.php',
'takereport' => '/report_handle.php',
'takeresolve' => '/resolve_handle.php',
default => isset($_GET['view']) ? '/static.php' : '/views.php',
};
+1 -1
View File
@@ -38,7 +38,7 @@ View::show_header('Torrent Reports', ['js' => 'reportsv2,bbcode,browse,torrent']
?>
<div class="header">
<h2><?= $search->title() ?></h2>
<?php require_once 'header.php'; ?>
<?php require __DIR__ . '/header.php'; ?>
</div>
<div class="buttonbox pad center">
<?php if ($search->mode() !== 'resolved') { ?>
+1 -1
View File
@@ -237,7 +237,7 @@ while (true) {
}
if (isset($error)) {
include_once 'edit.php';
require __DIR__ . '/edit.php';
exit;
}
+14 -14
View File
@@ -9,18 +9,18 @@ if ($Viewer->disableRequests()) {
Error403::error('Your request privileges have been removed.');
}
require_once match ($_REQUEST['action'] ?? null) {
'delete', 'unfill' => 'interim.php',
'edit-bounty' => 'edit_bounty.php',
'edit' => 'edit.php',
'takeedit' => 'edit_handle.php',
'new' => 'new.php',
'takenew' => 'new_handle.php',
'takebounty' => 'bounty_handle.php',
'takedelete' => 'delete_handle.php',
'takefill' => 'fill_handle.php',
'takeunfill' => 'unfill_handle.php',
'takevote' => 'vote_handle.php',
'view', 'viewrequest' => 'request.php',
default => 'requests.php',
require __DIR__ . match ($_REQUEST['action'] ?? '') {
'delete', 'unfill' => '/interim.php',
'edit-bounty' => '/edit_bounty.php',
'edit' => '/edit.php',
'takeedit' => '/edit_handle.php',
'new' => '/new.php',
'takenew' => '/new_handle.php',
'takebounty' => '/bounty_handle.php',
'takedelete' => '/delete_handle.php',
'takefill' => '/fill_handle.php',
'takeunfill' => '/unfill_handle.php',
'takevote' => '/vote_handle.php',
'view', 'viewrequest' => '/request.php',
default => '/requests.php',
};
Loaded 100 of 114 files, more files were not shown because too many files have changed in this diff. Show more