enable Generic.WhiteSpace.ScopeIndent and PSR1.Methods.CamelCapsMethodName

This commit is contained in:
Spine
2024-08-17 20:30:43 +00:00
parent 070d461df7
commit 1ecf60170b
51 changed files with 438 additions and 373 deletions

View File

@@ -19,11 +19,9 @@
<exclude name="Generic.Files.LineLength" />
<exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma" />
<exclude name="Generic.NamingConventions.UpperCaseConstantName" />
<exclude name="Generic.WhiteSpace.ScopeIndent" />
<exclude name="PSR1.Classes.ClassDeclaration" />
<exclude name="PSR1.Files.SideEffects" />
<exclude name="PSR1.Methods.CamelCapsMethodName" />
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
<exclude name="PSR2.Classes.PropertyDeclaration.SpacingAfterType" />

View File

@@ -1,4 +1,5 @@
<?php
// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
namespace Gazelle;

View File

@@ -1,4 +1,5 @@
<?php
// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
namespace Gazelle\DB;

View File

@@ -17,6 +17,7 @@ class Pg {
return $this->pdo->prepare($query);
}
// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
public function prepared_query(string $query, ...$args): int {
$st = $this->prepare($query);
if ($st->execute([...$args])) {
@@ -25,6 +26,7 @@ class Pg {
return 0;
}
}
// phpcs:enable
public function insert(string $query, ...$args): int {
$st = $this->prepare($query);

View File

@@ -35,7 +35,7 @@ class Artist extends \Gazelle\Json {
}
$artists = $tgroup->artistRole()->legacyList();
$artists = $artists[1] ?? null;
$Found = $this->search_array($artists, 'id', $artistId);
$Found = $this->searchList($artists, 'id', $artistId);
if ($this->releasesOnly && empty($Found)) {
continue;
}
@@ -148,14 +148,14 @@ class Artist extends \Gazelle\Json {
];
}
protected function search_array(mixed $Array, string $Key, mixed $Value): array {
protected function searchList(mixed $Array, string $Key, mixed $Value): array {
$results = [];
if (is_array($Array)) {
if (isset($Array[$Key]) && $Array[$Key] == $Value) {
$results[] = $Array;
}
foreach ($Array as $subarray) {
$results = array_merge($results, $this->search_array($subarray, $Key, $Value));
$results = array_merge($results, $this->searchList($subarray, $Key, $Value));
}
}
return $results;

View File

@@ -1,4 +1,5 @@
<?php
// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
namespace Gazelle\Search;

View File

@@ -18,7 +18,7 @@ class Tracker extends Base {
return self::$Requests;
}
public function last_error(): string|false {
public function lastError(): string|false {
return $this->error;
}

View File

@@ -179,51 +179,51 @@ class Quote extends \Gazelle\BaseUser {
foreach ($quoteList as $q) {
$context = [];
switch ($q['Page']) {
case 'artist':
$artist = $artistMan->findById($q['PageID']);
$context = [
'jump' => "artist.php?id={$q['PageID']}&amp;postid={$q['PostID']}#post{$q['PostID']}",
'link' => $artist->link(),
'title' => 'Artist',
];
break;
case 'collages':
$context = [
'jump' => "collages.php?action=comments&amp;collageid={$q['PageID']}&amp;postid={$q['PostID']}#post{$q['PostID']}",
'link' => sprintf('<a href="collages.php?id=%d">%s</a>', $q['PageID'], display_str($q['CollageName'])),
'title' => 'Collage',
];
break;
case 'forums':
$post = $postMan->findById($q['PostID']);
$context = [
'jump' => $post->url(),
'link' => $post->thread()->forum()->link() . ' &rsaquo; ' . $post->thread()->link() . ' &rsaquo; ' . $post->link(),
'title' => 'Forums',
];
break;
case 'requests':
$request = $reqMan->findById($q['PageID']);
if (is_null($request)) {
continue 2;
}
$context = [
'jump' => $request->url() . "&amp;postid={$q['PostID']}#post{$q['PostID']}",
'link' => $request->smartLink(),
'title' => 'Request',
];
break;
case 'torrents':
$tgroup = $tgMan->findById($q['PageID']);
if (is_null($tgroup)) {
continue 2;
}
$context = [
'jump' => "torrents.php?id={$q['PageID']}&amp;postid={$q['PostID']}#post{$q['PostID']}",
'link' => $tgroup->link(),
'title' => 'Torrent',
];
break;
case 'artist':
$artist = $artistMan->findById($q['PageID']);
$context = [
'jump' => "artist.php?id={$q['PageID']}&amp;postid={$q['PostID']}#post{$q['PostID']}",
'link' => $artist->link(),
'title' => 'Artist',
];
break;
case 'collages':
$context = [
'jump' => "collages.php?action=comments&amp;collageid={$q['PageID']}&amp;postid={$q['PostID']}#post{$q['PostID']}",
'link' => sprintf('<a href="collages.php?id=%d">%s</a>', $q['PageID'], display_str($q['CollageName'])),
'title' => 'Collage',
];
break;
case 'forums':
$post = $postMan->findById($q['PostID']);
$context = [
'jump' => $post->url(),
'link' => $post->thread()->forum()->link() . ' &rsaquo; ' . $post->thread()->link() . ' &rsaquo; ' . $post->link(),
'title' => 'Forums',
];
break;
case 'requests':
$request = $reqMan->findById($q['PageID']);
if (is_null($request)) {
continue 2;
}
$context = [
'jump' => $request->url() . "&amp;postid={$q['PostID']}#post{$q['PostID']}",
'link' => $request->smartLink(),
'title' => 'Request',
];
break;
case 'torrents':
$tgroup = $tgMan->findById($q['PageID']);
if (is_null($tgroup)) {
continue 2;
}
$context = [
'jump' => "torrents.php?id={$q['PageID']}&amp;postid={$q['PostID']}#post{$q['PostID']}",
'link' => $tgroup->link(),
'title' => 'Torrent',
];
break;
}
$page[] = array_merge(
$context,

View File

@@ -236,7 +236,7 @@ class UserCreator extends Base {
* the site code needs to know whether to redirect the user to the login page
* or tell them to check their email for a confirmation message.
*/
function newInstall(): bool {
public function newInstall(): bool {
return $this->newInstall ??= !(bool)self::$db->scalar("SELECT ID FROM users_main LIMIT 1");
}

View File

@@ -105,9 +105,11 @@ class Wiki extends BaseObject {
return $this->info()['title'];
}
// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
public function ToC(): string {
return $this->info()['toc'] ?? '';
}
// phpcs:enable
public function editable(User $user): bool {
return $this->minClassEdit() <= $user->privilege()->effectiveClassLevel();

View File

@@ -1,4 +1,5 @@
<?php
// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
if (!extension_loaded('mysqli')) {
error('Mysqli Extension not loaded.');

View File

@@ -1,4 +1,5 @@
<?php
// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
class SphinxqlQuery {
private $Sphinxql;

View File

@@ -1,4 +1,5 @@
<?php
// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
class SphinxqlResult {
/**

View File

@@ -1,4 +1,5 @@
<?php
// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
use Gazelle\Enum\CacheBucket;
@@ -673,27 +674,27 @@ class Text {
case '**':
case '###':
case '***':
$CurrentId = 1;
$Array[$ArrayPos] = ['Type' => 'list'];
$Array[$ArrayPos]['Val'] = explode("[$TagName]", $Block);
$Array[$ArrayPos]['ListType'] = $TagName[0] === '*' ? 'ul' : 'ol';
$Array[$ArrayPos]['Tag'] = $TagName;
$ChildPrefix = $ListPrefix === '' ? $ListId : $ListPrefix;
if ($Attrib !== '') {
$ChildPrefix = $Attrib;
}
foreach ($Array[$ArrayPos]['Val'] as $Key => $Val) {
// phpstan complains about:
// "Call to function is_string() with string will always evaluate to true."
// But if you remove the call (since $Val is always supposed to be a string):
// "Parameter #1 $string of function trim expects string, array|string given."
// This is more a reflection on the hairiness of this code than anything else
if (is_string($Val)) { /** @phpstan-ignore-line */
$Id = $ChildPrefix . '.' . $CurrentId++;
$Array[$ArrayPos]['Val'][$Key] = self::parse(trim($Val), $Id);
$Array[$ArrayPos]['Val'][$Key]['Id'] = $Id;
}
$CurrentId = 1;
$Array[$ArrayPos] = ['Type' => 'list'];
$Array[$ArrayPos]['Val'] = explode("[$TagName]", $Block);
$Array[$ArrayPos]['ListType'] = $TagName[0] === '*' ? 'ul' : 'ol';
$Array[$ArrayPos]['Tag'] = $TagName;
$ChildPrefix = $ListPrefix === '' ? $ListId : $ListPrefix;
if ($Attrib !== '') {
$ChildPrefix = $Attrib;
}
foreach ($Array[$ArrayPos]['Val'] as $Key => $Val) {
// phpstan complains about:
// "Call to function is_string() with string will always evaluate to true."
// But if you remove the call (since $Val is always supposed to be a string):
// "Parameter #1 $string of function trim expects string, array|string given."
// This is more a reflection on the hairiness of this code than anything else
if (is_string($Val)) { /** @phpstan-ignore-line */
$Id = $ChildPrefix . '.' . $CurrentId++;
$Array[$ArrayPos]['Val'][$Key] = self::parse(trim($Val), $Id);
$Array[$ArrayPos]['Val'][$Key]['Id'] = $Id;
}
}
$ListId++;
break;
default:
@@ -819,287 +820,287 @@ class Text {
continue;
}
if (self::$Levels < self::$MaximumNests) {
switch ($Block['Type']) {
case 'b':
$Str .= '<strong>' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</strong>';
break;
case 'u':
$Str .= '<span style="text-decoration: underline;">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</span>';
break;
case 'i':
$Str .= '<span style="font-style: italic;">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . "</span>";
break;
case 's':
$Str .= '<span style="text-decoration: line-through;">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</span>';
break;
case 'hr':
$Str .= '<hr />';
break;
case 'important':
$Str .= '<strong class="important_text">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</strong>';
break;
case 'user':
$Str .= '<a href="user.php?action=search&amp;search=' . urlencode(trim($Block['Val'], '@')) . '">' . $Block['Val'] . '</a>';
break;
case 'artist':
$Str .= '<a href="artist.php?artistname=' . urlencode(html_unescape($Block['Val'])) . '">' . $Block['Val'] . '</a>';
break;
case 'rule':
$Rule = trim(strtolower($Block['Val']));
if (!preg_match('/^[hr]/', $Rule)) {
$Rule = "r$Rule";
}
$Str .= '<a href="rules.php?p=upload#' . urlencode(html_unescape($Rule)) . '">' . preg_replace('/[aA-zZ]/', '', $Block['Val']) . '</a>';
break;
case 'collage':
$Str .= self::bbcodeCollageUrl((int)$Block['Val']);
break;
case 'forum':
$Str .= self::bbcodeForumUrl((int)$Block['Val']);
break;
case 'thread':
$Str .= self::bbcodeThreadUrl((string)$Block['Val']);
break;
case 'pl':
$found = preg_split('/\s*,\s*/m', strtolower($Block['Attr']), -1, PREG_SPLIT_NO_EMPTY);
if ($found !== false) {
$Str .= \Gazelle\Manager\Torrent::renderPL((int)$Block['Val'], $found);
} else {
$Str .= "[pl]{$Block['Val']}[/pl]";
}
break;
case 'torrent':
$GroupID = 0;
if (preg_match(TGROUP_REGEXP, $Block['Val'], $match)) {
if (isset($match['id'])) {
$GroupID = $match['id'];
switch ($Block['Type']) {
case 'b':
$Str .= '<strong>' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</strong>';
break;
case 'u':
$Str .= '<span style="text-decoration: underline;">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</span>';
break;
case 'i':
$Str .= '<span style="font-style: italic;">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . "</span>";
break;
case 's':
$Str .= '<span style="text-decoration: line-through;">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</span>';
break;
case 'hr':
$Str .= '<hr />';
break;
case 'important':
$Str .= '<strong class="important_text">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</strong>';
break;
case 'user':
$Str .= '<a href="user.php?action=search&amp;search=' . urlencode(trim($Block['Val'], '@')) . '">' . $Block['Val'] . '</a>';
break;
case 'artist':
$Str .= '<a href="artist.php?artistname=' . urlencode(html_unescape($Block['Val'])) . '">' . $Block['Val'] . '</a>';
break;
case 'rule':
$Rule = trim(strtolower($Block['Val']));
if (!preg_match('/^[hr]/', $Rule)) {
$Rule = "r$Rule";
}
} elseif ((int)$Block['Val']) {
$GroupID = $Block['Val'];
}
$tgroup = (new Gazelle\Manager\TGroup())->findById((int)$GroupID);
if (is_null($tgroup)) {
$Str .= '[torrent]' . str_replace('[inlineurl]', '', $Block['Val']) . '[/torrent]';
} else {
if (str_contains($Block['Attr'], 'noartist')) {
$Str .= "<a href=\"{$tgroup->url()}\" title=\"" . ($tgroup->hashTag() ?: 'View torrent group')
$Str .= '<a href="rules.php?p=upload#' . urlencode(html_unescape($Rule)) . '">' . preg_replace('/[aA-zZ]/', '', $Block['Val']) . '</a>';
break;
case 'collage':
$Str .= self::bbcodeCollageUrl((int)$Block['Val']);
break;
case 'forum':
$Str .= self::bbcodeForumUrl((int)$Block['Val']);
break;
case 'thread':
$Str .= self::bbcodeThreadUrl((string)$Block['Val']);
break;
case 'pl':
$found = preg_split('/\s*,\s*/m', strtolower($Block['Attr']), -1, PREG_SPLIT_NO_EMPTY);
if ($found !== false) {
$Str .= \Gazelle\Manager\Torrent::renderPL((int)$Block['Val'], $found);
} else {
$Str .= "[pl]{$Block['Val']}[/pl]";
}
break;
case 'torrent':
$GroupID = 0;
if (preg_match(TGROUP_REGEXP, $Block['Val'], $match)) {
if (isset($match['id'])) {
$GroupID = $match['id'];
}
} elseif ((int)$Block['Val']) {
$GroupID = $Block['Val'];
}
$tgroup = (new Gazelle\Manager\TGroup())->findById((int)$GroupID);
if (is_null($tgroup)) {
$Str .= '[torrent]' . str_replace('[inlineurl]', '', $Block['Val']) . '[/torrent]';
} else {
if (str_contains($Block['Attr'], 'noartist')) {
$Str .= "<a href=\"{$tgroup->url()}\" title=\"" . ($tgroup->hashTag() ?: 'View torrent group')
. '" dir="ltr">' . html_escape($tgroup->name()) . '</a>';
} else {
$Str .= $tgroup->link();
} else {
$Str .= $tgroup->link();
}
}
}
break;
break;
case 'wiki':
$Str .= '<a href="wiki.php?action=article&amp;name=' . urlencode($Block['Val']) . '">' . $Block['Val'] . '</a>';
break;
case 'tex':
$Str .= '<katex>' . $Block['Val'] . '</katex>';
break;
case 'plain':
$Str .= $Block['Val'];
break;
case 'pre':
$Str .= '<pre>' . $Block['Val'] . '</pre>';
break;
case 'code':
$Str .= '<code>' . $Block['Val'] . '</code>';
break;
case 'list':
$Str .= "<{$Block['ListType']} class=\"postlist\">";
foreach ($Block['Val'] as $Line) {
$Str .= '<li' . ($Rules ? ' id="r' . $Line['Id'] . '"' : '') . '>' . self::to_html($Line, $Rules, $cache, $bucket) . '</li>';
}
$Str .= '</' . $Block['ListType'] . '>';
break;
case 'align':
$ValidAttribs = ['left', 'center', 'right'];
if (!in_array($Block['Attr'], $ValidAttribs)) {
$Str .= '[align=' . $Block['Attr'] . ']' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '[/align]';
} else {
$Str .= '<div style="text-align: ' . $Block['Attr'] . ';">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</div>';
}
break;
case 'color':
case 'colour':
$Block['Attr'] = strtolower($Block['Attr']);
if (!in_array($Block['Attr'], self::$ColorName) && !preg_match('/^#[0-9a-f]{6}$/', $Block['Attr'])) {
$Str .= '[color=' . $Block['Attr'] . ']' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '[/color]';
} else {
$Str .= '<span style="color: ' . $Block['Attr'] . ';">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</span>';
}
break;
case 'headline':
$text = self::to_html($Block['Val'], $Rules, $cache, $bucket);
$raw = self::raw_text($Block['Val']);
if (!in_array($Block['Attr'], self::$HeadlineLevels)) {
$Str .= sprintf('%1$s%2$s%1$s', str_repeat('=', $Block['Attr'] + 1), $text);
} else {
$id = '_' . crc32($raw . self::$HeadlineID);
if (self::$InQuotes === 0) {
self::$Headlines[] = [$Block['Attr'], $raw, $id];
case 'wiki':
$Str .= '<a href="wiki.php?action=article&amp;name=' . urlencode($Block['Val']) . '">' . $Block['Val'] . '</a>';
break;
case 'tex':
$Str .= '<katex>' . $Block['Val'] . '</katex>';
break;
case 'plain':
$Str .= $Block['Val'];
break;
case 'pre':
$Str .= '<pre>' . $Block['Val'] . '</pre>';
break;
case 'code':
$Str .= '<code>' . $Block['Val'] . '</code>';
break;
case 'list':
$Str .= "<{$Block['ListType']} class=\"postlist\">";
foreach ($Block['Val'] as $Line) {
$Str .= '<li' . ($Rules ? ' id="r' . $Line['Id'] . '"' : '') . '>' . self::to_html($Line, $Rules, $cache, $bucket) . '</li>';
}
$Str .= sprintf('<h%1$d id="%3$s">%2$s</h%1$d>', ($Block['Attr'] + 2), $text, $id);
self::$HeadlineID++;
}
break;
case 'inlinesize':
case 'size':
$ValidAttribs = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'];
if (!in_array($Block['Attr'], $ValidAttribs)) {
$Str .= '[size=' . $Block['Attr'] . ']' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '[/size]';
} else {
$Str .= '<span class="size' . $Block['Attr'] . '">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</span>';
}
break;
case 'quote':
self::$NoImg++; // No images inside quote tags
self::$InQuotes++;
if (self::$InQuotes == self::$NestsBeforeHide) { //Put quotes that are nested beyond the specified limit in [hide] tags.
$Str .= '<strong>Older quotes</strong>: <a href="javascript:void(0);" onclick="BBCode.spoiler(this);">Show</a>';
$Str .= '<blockquote class="hidden spoiler">';
}
if (!empty($Block['Attr'])) {
$Exploded = explode('|', self::to_html($Block['Attr'], $Rules, $cache, $bucket));
if (isset($Exploded[1]) && (is_numeric($Exploded[1]) || (in_array($Exploded[1][0], ['a', 't', 'c', 'r']) && is_numeric(substr($Exploded[1], 1))))) {
// the part after | is either a number or starts with a, t, c or r, followed by a number (forum post, artist comment, torrent comment, collage comment or request comment, respectively)
$PostID = trim($Exploded[1]);
$Str .= '<a href="#" onclick="QuoteJump(event, \'' . $PostID . '\'); return false;"><strong class="quoteheader">' . $Exploded[0] . '</strong> wrote: </a>';
$Str .= '</' . $Block['ListType'] . '>';
break;
case 'align':
$ValidAttribs = ['left', 'center', 'right'];
if (!in_array($Block['Attr'], $ValidAttribs)) {
$Str .= '[align=' . $Block['Attr'] . ']' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '[/align]';
} else {
$Str .= '<strong class="quoteheader">' . $Exploded[0] . '</strong> wrote: ';
$Str .= '<div style="text-align: ' . $Block['Attr'] . ';">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</div>';
}
break;
case 'color':
case 'colour':
$Block['Attr'] = strtolower($Block['Attr']);
if (!in_array($Block['Attr'], self::$ColorName) && !preg_match('/^#[0-9a-f]{6}$/', $Block['Attr'])) {
$Str .= '[color=' . $Block['Attr'] . ']' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '[/color]';
} else {
$Str .= '<span style="color: ' . $Block['Attr'] . ';">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</span>';
}
break;
case 'headline':
$text = self::to_html($Block['Val'], $Rules, $cache, $bucket);
$raw = self::raw_text($Block['Val']);
if (!in_array($Block['Attr'], self::$HeadlineLevels)) {
$Str .= sprintf('%1$s%2$s%1$s', str_repeat('=', $Block['Attr'] + 1), $text);
} else {
$id = '_' . crc32($raw . self::$HeadlineID);
if (self::$InQuotes === 0) {
self::$Headlines[] = [$Block['Attr'], $raw, $id];
}
$Str .= sprintf('<h%1$d id="%3$s">%2$s</h%1$d>', ($Block['Attr'] + 2), $text, $id);
self::$HeadlineID++;
}
break;
case 'inlinesize':
case 'size':
$ValidAttribs = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'];
if (!in_array($Block['Attr'], $ValidAttribs)) {
$Str .= '[size=' . $Block['Attr'] . ']' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '[/size]';
} else {
$Str .= '<span class="size' . $Block['Attr'] . '">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</span>';
}
break;
case 'quote':
self::$NoImg++; // No images inside quote tags
self::$InQuotes++;
if (self::$InQuotes == self::$NestsBeforeHide) { //Put quotes that are nested beyond the specified limit in [hide] tags.
$Str .= '<strong>Older quotes</strong>: <a href="javascript:void(0);" onclick="BBCode.spoiler(this);">Show</a>';
$Str .= '<blockquote class="hidden spoiler">';
}
}
$Str .= '<blockquote>' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</blockquote>';
if (self::$InQuotes == self::$NestsBeforeHide) { //Close quote the deeply nested quote [hide].
$Str .= '</blockquote><br />'; // Ensure new line after quote train hiding
}
self::$NoImg--;
self::$InQuotes--;
break;
case 'box':
$Str .= '<div class="box pad" style="padding: 10px 10px 10px 20px">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</div>';
break;
case 'pad':
$Attr = array_filter(explode('|', $Block['Attr'] ?? ''), fn($x) => is_numeric($x) && (float)$x >= 0);
if (count($Attr) === 0) {
$Str .= self::to_html($Block['Val'], $Rules, $cache, $bucket);
} else {
$Padding = implode(' ', array_map(fn($x) => "{$x}px", $Attr));
$Str .= "<span style=\"display: inline-block; padding: {$Padding}\">" . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</span>';
}
break;
case 'hide':
case 'spoiler':
$Str .= '<strong>' . ($Block['Attr'] ?: 'Hidden text') . '</strong>: <a href="javascript:void(0);" onclick="BBCode.spoiler(this);">Show</a>';
$Str .= '<blockquote class="hidden spoiler">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</blockquote>';
break;
case 'mature':
if (self::$viewer->option('EnableMatureContent')) {
if (!empty($Block['Attr'])) {
$Str .= '<strong class="mature" style="font-size: 1.2em;">Mature content:</strong><strong> ' . $Block['Attr'] . '</strong><br /> <a href="javascript:void(0);" onclick="BBCode.spoiler(this);">Show</a>';
$Str .= '<blockquote class="hidden spoiler">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</blockquote>';
} else {
$Str .= '<strong>Use of the [mature] tag requires a description.</strong> The correct format is as follows: <strong>[mature=description] ...content... [/mature]</strong>, where "description" is a mandatory description of the post. Misleading descriptions will be penalized. For further information on our mature content policies, please refer to this <a href="wiki.php?action=article&amp;id=1063">wiki</a>.';
$Exploded = explode('|', self::to_html($Block['Attr'], $Rules, $cache, $bucket));
if (isset($Exploded[1]) && (is_numeric($Exploded[1]) || (in_array($Exploded[1][0], ['a', 't', 'c', 'r']) && is_numeric(substr($Exploded[1], 1))))) {
// the part after | is either a number or starts with a, t, c or r, followed by a number (forum post, artist comment, torrent comment, collage comment or request comment, respectively)
$PostID = trim($Exploded[1]);
$Str .= '<a href="#" onclick="QuoteJump(event, \'' . $PostID . '\'); return false;"><strong class="quoteheader">' . $Exploded[0] . '</strong> wrote: </a>';
} else {
$Str .= '<strong class="quoteheader">' . $Exploded[0] . '</strong> wrote: ';
}
}
} else {
$Str .= '<span class="mature_blocked" style="font-style: italic;"><a href="wiki.php?action=article&amp;id=1063">Mature content</a> has been blocked. You can choose to view mature content by editing your <a href="user.php?action=edit&amp;id=me">settings</a>.</span>';
}
break;
case 'img':
if (self::$NoImg > 0 && self::valid_url($Block['Val'])) {
$Str .= '<a rel="noreferrer" target="_blank" href="' . $Block['Val'] . '">' . $Block['Val'] . '</a> (image)';
$Str .= '<blockquote>' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</blockquote>';
if (self::$InQuotes == self::$NestsBeforeHide) { //Close quote the deeply nested quote [hide].
$Str .= '</blockquote><br />'; // Ensure new line after quote train hiding
}
self::$NoImg--;
self::$InQuotes--;
break;
}
if (!self::valid_url($Block['Val'], '\.(?:avif|bmp|gif|jpe?g|png|svg|tiff|webp)')) {
$Str .= "[img]{$Block['Val']}[/img]";
} else {
$LocalURL = self::local_url($Block['Val']);
if ($LocalURL) {
$Str .= '<img loading="lazy" class="scale_image" onclick="lightbox.init(this, $(this).width());" alt="' . $Block['Val'] . '" src="' . $LocalURL . '" />';
} else {
if ($cache) {
$image = image_cache_encode($Block['Val'], bucket: $bucket);
$original = " data-origin-src=\"{$Block['Val']}\"";
} else {
$image = $Block['Val'];
$original = "";
}
$Str .= "<img loading=\"lazy\" class=\"scale_image\" onclick=\"lightbox.init(this, $(this).width());\" alt=\"$image\" src=\"$image\"$original />";
}
}
break;
case 'aud':
if (self::$NoImg > 0 && self::valid_url($Block['Val'])) {
$Str .= '<a rel="noreferrer" target="_blank" href="' . $Block['Val'] . '">' . $Block['Val'] . '</a> (audio)';
case 'box':
$Str .= '<div class="box pad" style="padding: 10px 10px 10px 20px">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</div>';
break;
}
if (!self::valid_url($Block['Val'], '\.(?:mp3|ogg|wav)')) {
$Str .= '[aud]' . $Block['Val'] . '[/aud]';
} else {
//TODO: Proxy this for staff?
$Str .= '<audio controls="controls" src="' . $Block['Val'] . '"><a rel="noreferrer" target="_blank" href="' . $Block['Val'] . '">' . $Block['Val'] . '</a></audio>';
}
break;
case 'url':
// Make sure the URL has a label
if (empty($Block['Val'])) {
$Block['Val'] = $Block['Attr'];
$NoName = true; // If there isn't a Val for this
} else {
$Block['Val'] = self::to_html($Block['Val'], $Rules, $cache, $bucket);
$NoName = false;
}
if (!self::valid_url($Block['Attr'])) {
if (self::relative_url($Block['Attr'])) {
$Str .= '<a href="' . $Block['Attr'] . '">' . $Block['Val'] . '</a>';
case 'pad':
$Attr = array_filter(explode('|', $Block['Attr'] ?? ''), fn($x) => is_numeric($x) && (float)$x >= 0);
if (count($Attr) === 0) {
$Str .= self::to_html($Block['Val'], $Rules, $cache, $bucket);
} else {
$Str .= '[url=' . $Block['Attr'] . ']' . $Block['Val'] . '[/url]';
$Padding = implode(' ', array_map(fn($x) => "{$x}px", $Attr));
$Str .= "<span style=\"display: inline-block; padding: {$Padding}\">" . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</span>';
}
} else {
$LocalURL = self::local_url($Block['Attr']);
if ($LocalURL) {
if ($NoName) {
$Block['Val'] = substr($LocalURL, 1);
}
if ($resolved = self::resolve_url($Block['Val'])) {
$Str .= $resolved;
break;
case 'hide':
case 'spoiler':
$Str .= '<strong>' . ($Block['Attr'] ?: 'Hidden text') . '</strong>: <a href="javascript:void(0);" onclick="BBCode.spoiler(this);">Show</a>';
$Str .= '<blockquote class="hidden spoiler">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</blockquote>';
break;
case 'mature':
if (self::$viewer->option('EnableMatureContent')) {
if (!empty($Block['Attr'])) {
$Str .= '<strong class="mature" style="font-size: 1.2em;">Mature content:</strong><strong> ' . $Block['Attr'] . '</strong><br /> <a href="javascript:void(0);" onclick="BBCode.spoiler(this);">Show</a>';
$Str .= '<blockquote class="hidden spoiler">' . self::to_html($Block['Val'], $Rules, $cache, $bucket) . '</blockquote>';
} else {
$Str .= '<a href="' . $LocalURL . '">' . $Block['Val'] . '</a>';
$Str .= '<strong>Use of the [mature] tag requires a description.</strong> The correct format is as follows: <strong>[mature=description] ...content... [/mature]</strong>, where "description" is a mandatory description of the post. Misleading descriptions will be penalized. For further information on our mature content policies, please refer to this <a href="wiki.php?action=article&amp;id=1063">wiki</a>.';
}
} else {
if ($resolved = self::resolve_url($Block['Val'])) {
$Str .= $resolved;
$Str .= '<span class="mature_blocked" style="font-style: italic;"><a href="wiki.php?action=article&amp;id=1063">Mature content</a> has been blocked. You can choose to view mature content by editing your <a href="user.php?action=edit&amp;id=me">settings</a>.</span>';
}
break;
case 'img':
if (self::$NoImg > 0 && self::valid_url($Block['Val'])) {
$Str .= '<a rel="noreferrer" target="_blank" href="' . $Block['Val'] . '">' . $Block['Val'] . '</a> (image)';
break;
}
if (!self::valid_url($Block['Val'], '\.(?:avif|bmp|gif|jpe?g|png|svg|tiff|webp)')) {
$Str .= "[img]{$Block['Val']}[/img]";
} else {
$LocalURL = self::local_url($Block['Val']);
if ($LocalURL) {
$Str .= '<img loading="lazy" class="scale_image" onclick="lightbox.init(this, $(this).width());" alt="' . $Block['Val'] . '" src="' . $LocalURL . '" />';
} else {
$Str .= '<a rel="noreferrer" target="_blank" href="' . $Block['Attr'] . '">' . $Block['Val'] . '</a>';
if ($cache) {
$image = image_cache_encode($Block['Val'], bucket: $bucket);
$original = " data-origin-src=\"{$Block['Val']}\"";
} else {
$image = $Block['Val'];
$original = "";
}
$Str .= "<img loading=\"lazy\" class=\"scale_image\" onclick=\"lightbox.init(this, $(this).width());\" alt=\"$image\" src=\"$image\"$original />";
}
}
}
break;
break;
case 'inlineurl':
if (!self::valid_url($Block['Attr'], '', true)) {
$Array = self::parse($Block['Attr']);
$Block['Attr'] = $Array;
$Str .= self::to_html($Block['Attr'], $Rules, $cache, $bucket);
} else {
$LocalURL = self::local_url($Block['Attr']);
if ($LocalURL) {
$Str .= self::resolve_url($Block['Attr'])
case 'aud':
if (self::$NoImg > 0 && self::valid_url($Block['Val'])) {
$Str .= '<a rel="noreferrer" target="_blank" href="' . $Block['Val'] . '">' . $Block['Val'] . '</a> (audio)';
break;
}
if (!self::valid_url($Block['Val'], '\.(?:mp3|ogg|wav)')) {
$Str .= '[aud]' . $Block['Val'] . '[/aud]';
} else {
//TODO: Proxy this for staff?
$Str .= '<audio controls="controls" src="' . $Block['Val'] . '"><a rel="noreferrer" target="_blank" href="' . $Block['Val'] . '">' . $Block['Val'] . '</a></audio>';
}
break;
case 'url':
// Make sure the URL has a label
if (empty($Block['Val'])) {
$Block['Val'] = $Block['Attr'];
$NoName = true; // If there isn't a Val for this
} else {
$Block['Val'] = self::to_html($Block['Val'], $Rules, $cache, $bucket);
$NoName = false;
}
if (!self::valid_url($Block['Attr'])) {
if (self::relative_url($Block['Attr'])) {
$Str .= '<a href="' . $Block['Attr'] . '">' . $Block['Val'] . '</a>';
} else {
$Str .= '[url=' . $Block['Attr'] . ']' . $Block['Val'] . '[/url]';
}
} else {
$LocalURL = self::local_url($Block['Attr']);
if ($LocalURL) {
if ($NoName) {
$Block['Val'] = substr($LocalURL, 1);
}
if ($resolved = self::resolve_url($Block['Val'])) {
$Str .= $resolved;
} else {
$Str .= '<a href="' . $LocalURL . '">' . $Block['Val'] . '</a>';
}
} else {
if ($resolved = self::resolve_url($Block['Val'])) {
$Str .= $resolved;
} else {
$Str .= '<a rel="noreferrer" target="_blank" href="' . $Block['Attr'] . '">' . $Block['Val'] . '</a>';
}
}
}
break;
case 'inlineurl':
if (!self::valid_url($Block['Attr'], '', true)) {
$Array = self::parse($Block['Attr']);
$Block['Attr'] = $Array;
$Str .= self::to_html($Block['Attr'], $Rules, $cache, $bucket);
} else {
$LocalURL = self::local_url($Block['Attr']);
if ($LocalURL) {
$Str .= self::resolve_url($Block['Attr'])
?? ('<a href="' . $LocalURL . '">' . substr($LocalURL, 1) . '</a>');
} else {
$Str .= self::resolve_url($Block['Attr'])
} else {
$Str .= self::resolve_url($Block['Attr'])
?? sprintf('<a rel="noreferrer" target="_blank" href="%s">%s</a>', $Block['Attr'], $Block['Attr']);
}
}
}
break;
break;
}
}
}
}
self::$Levels--;
return $Str;
}

View File

@@ -1,4 +1,5 @@
<?php
// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
class Users {
/**

View File

@@ -1,4 +1,5 @@
<?php
// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
class View {
/**

View File

@@ -232,7 +232,7 @@ function byte_format(float|int|null $size, int $levels = 2): string {
*/
function byte_unformat(float $value, string $unit): int {
return (int)(
$value * match($unit) {
$value * match ($unit) {
'KiB' => 1024,
'MiB' => 1024 ** 2,
'GiB' => 1024 ** 3,

View File

@@ -1,4 +1,5 @@
<?php
// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
declare(strict_types=1);

View File

@@ -7,12 +7,12 @@ use Phinx\Migration\AbstractMigration;
/************************************************************
To initialize a running database, execute the following query
once the code has been deployed.
once the code has been deployed.
BEGIN;
DELETE FROM user_has_ordinal
WHERE user_ordinal_id =
WHERE user_ordinal_id =
(SELECT user_ordinal_id FROM user_ordinal WHERE name = 'personal-collage');
INSERT INTO user_has_ordinal (user_ordinal_id, user_id, value)

View File

@@ -1,5 +1,8 @@
<?php
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
header('Content-type: application/opensearchdescription+xml');
require_once(__DIR__ . '/../lib/config.php');

View File

@@ -1,6 +1,8 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
$RevisionID = (int)($_GET['revisionid'] ?? 0);
$artistMan = new Gazelle\Manager\Artist();

View File

@@ -1,6 +1,8 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
$bonus = new Gazelle\User\Bonus($Viewer);

View File

@@ -1,6 +1,9 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
ini_set('max_execution_time', 600);
set_time_limit(0);

View File

@@ -7,6 +7,6 @@ if (!$Viewer || $Viewer->isLocked()) {
}
require_once(match ($_REQUEST['action'] ?? '') {
'webirc' => 'webirc.php',
default => 'join.php',
'webirc' => 'webirc.php',
default => 'join.php',
});

View File

@@ -1,8 +1,9 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
/** @var Gazelle\Collage $Collage required from collage.php */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
$Collage->setViewer($Viewer);
$CollageID = $Collage->id();
@@ -57,9 +58,7 @@ echo $Twig->render('collage/sidebar.twig', [
?>
</div>
<div class="main_column">
<?php
if ($CollageCovers != 0) {
?>
<?php if ($CollageCovers != 0) { ?>
<div id="coverart" class="box">
<div class="head" id="coverhead"><strong>Cover Art</strong></div>
<ul class="collage_images" id="collage_page0">
@@ -71,8 +70,7 @@ if ($CollageCovers != 0) {
?>
</ul>
</div>
<?php
if ($NumGroups > $CollageCovers) { ?>
<?php if ($NumGroups > $CollageCovers) { ?>
<div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
<span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0); return false;"><strong>&laquo; First</strong></a> | </span>
<span id="prevpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;"><strong>&lsaquo; Prev</strong></a> | </span>

View File

@@ -1,6 +1,8 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
$tgMan = (new Gazelle\Manager\TGroup())->setViewer($Viewer);
$torMan = (new Gazelle\Manager\Torrent())->setViewer($Viewer);

View File

@@ -1,6 +1,9 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
/*
* $_REQUEST['action'] is artist, collages, requests or torrents (default torrents)
* $_REQUEST['type'] depends on the page:

View File

@@ -1,5 +1,7 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
$poll = (new Gazelle\Manager\ForumPoll())->findById((int)($_POST['threadid'] ?? 0));
if (is_null($poll)) {

View File

@@ -1,5 +1,7 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
use Gazelle\Util\Time;

View File

@@ -2,6 +2,8 @@
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Gazelle\Cache $Cache */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
use Gazelle\Enum\CacheBucket;

View File

@@ -1,28 +1,3 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?= SITE_NAME ?> :: Membership recovery</title>
<meta http-equiv="X-UA-Compatible" content="chrome=1; IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="stylesheet" href="<?= STATIC_SERVER ?>/styles/apollostage/style.css" />
<style type="text/css" media="screen">
body{background-color:#212328;margin:0;font-size:0.9em;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}
.container{margin:30px auto 140px;width:900px;}
form{margin:30px auto 140px;width:700px;padding:20px}
a{color:#fff;text-decoration:none}
a:hover{text-decoration:underline}
p{margin:10px 0;font-size:18px;line-height:1.6em}
h5{padding-top:30px}
#suggestions{margin-top:35px;color:#fff}
#suggestions a,p{color:#fff;font-weight:200}
#suggestions a{font-size:14px;margin:0 10px}
</style>
</head>
<body>
<div class="container">
<?php
/** @phpstan-var \Gazelle\Cache $Cache */
@@ -65,8 +40,34 @@ if ($Cache->get_value($key)) {
}
$Cache->cache_value($key, 1, 300);
if ($msg == 'ok') {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?= SITE_NAME ?> :: Membership recovery</title>
<meta http-equiv="X-UA-Compatible" content="chrome=1; IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="stylesheet" href="<?= STATIC_SERVER ?>/styles/apollostage/style.css" />
<style type="text/css" media="screen">
body{background-color:#212328;margin:0;font-size:0.9em;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}
.container{margin:30px auto 140px;width:900px;}
form{margin:30px auto 140px;width:700px;padding:20px}
a{color:#fff;text-decoration:none}
a:hover{text-decoration:underline}
p{margin:10px 0;font-size:18px;line-height:1.6em}
h5{padding-top:30px}
#suggestions{margin-top:35px;color:#fff}
#suggestions a,p{color:#fff;font-weight:200}
#suggestions a{font-size:14px;margin:0 10px}
</style>
</head>
<body>
<div class="container">
<?php if ($msg == 'ok') { ?>
<h3>Success!</h3>
<p>Your information has been uploaded and secured. It will be held for the next 30 days and then removed.</p>
@@ -84,18 +85,14 @@ recheck your spam folder), join the <tt>#recovery</tt> channel on IRC.</p>
Port: 6667 or +7000 for SSL</p>
</blockquote>
<?php
} else {
?>
<?php } else { ?>
<h3>There was a problem</h3>
<p>Your information was not saved for the following reason.</p>
<center><b style="font-size: 20pt;"><?= $msg ?></b></center>
<p>Please wait five minutes and try again.</p>
<?php
}
?>
<?php } ?>
</div>
</body>
</html>

View File

@@ -1,5 +1,7 @@
<?php
/** @phpstan-var ?\Gazelle\User $Viewer */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
if ($Viewer) {
header("Location: index.php");

View File

@@ -1,5 +1,8 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
/*
* This is the AJAX page that gets called from the JavaScript
* function NewReport(), any changes here should probably be

View File

@@ -1,4 +1,7 @@
<?php
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
/*
* The backend to changing the report type when making a report.
* It prints out the relevant report_messages from the array, then

View File

@@ -1,6 +1,9 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
/*
* This page is used for viewing reports in every viewpoint except auto.
* It doesn't AJAX grab a new report when you resolve each one, use auto

View File

@@ -46,7 +46,7 @@ if ($Viewer->permitted('admin_manage_blog')) {
header('Location: staffblog.php');
exit;
default:
default:
error(403);
}
}

View File

@@ -1,5 +1,7 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
if (!$Viewer->permitted('admin_manage_referrals')) {
error(403);

View File

@@ -41,6 +41,8 @@ function classList(int $Selected = 0): string {
}
/** @phpstan-var \Gazelle\User $Viewer */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
if (!$Viewer->permitted('admin_manage_forums')) {
error(403);

View File

@@ -13,6 +13,8 @@ function type_list(array $Types, int $Selected = 0): string {
}
/** @phpstan-var \Gazelle\User $Viewer */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
if (!$Viewer->permitted('admin_manage_referrals')) {
error(403);

View File

@@ -1,6 +1,8 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
$torMan = (new Gazelle\Manager\Torrent())->setViewer($Viewer);
$reportMan = new Gazelle\Manager\Torrent\Report($torMan);

View File

@@ -1,6 +1,8 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
$vote = new Gazelle\User\Vote($Viewer);
$tagMan = new Gazelle\Manager\Tag();

View File

@@ -1,6 +1,8 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
use Gazelle\Util\SortableTableHeader;

View File

@@ -2,6 +2,8 @@
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Gazelle\Cache $Cache */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
use Gazelle\Enum\CacheBucket;

View File

@@ -1,6 +1,8 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
$torrent = (new Gazelle\Manager\Torrent())->findById((int)($_GET['id'] ?? 0));
if (is_null($torrent)) {

View File

@@ -1,6 +1,8 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
use Gazelle\Util\SortableTableHeader;

View File

@@ -1,6 +1,8 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
use Gazelle\Util\SortableTableHeader;

View File

@@ -1,5 +1,7 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
//**********************************************************************//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Upload form ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

View File

@@ -280,7 +280,7 @@ if ($torrent) {
defined('AJAX')
? "The exact same torrent file already exists on the site! (torrentid=$torrentId)"
: "<a href=\"torrents.php?torrentid=$torrentId\">The exact same torrent file already exists on the site!</a>"
);
);
} else {
// A lost torrent
$torrentFiler->put($bencoder->getEncode(), $torrentId);

View File

@@ -2,6 +2,8 @@
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Gazelle\Cache $Cache */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
use Gazelle\Enum\UserTokenType;
use Gazelle\User\Vote;

View File

@@ -1,6 +1,8 @@
<?php
/** @phpstan-var \Gazelle\User $Viewer */
/** @phpstan-var \Twig\Environment $Twig */
// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
if (!$Viewer->permitted('site_collages_subscribe')) {
error(403);

View File

@@ -81,7 +81,7 @@ class TrackerTest extends TestCase {
public function testTrackerUser(): void {
$tracker = new \Gazelle\Tracker();
$info = $tracker->info();
$this->assertFalse($tracker->last_error(), 'tracker-init');
$this->assertFalse($tracker->lastError(), 'tracker-init');
$this->user = Helper::makeUser('trk.' . randomString(10), 'tracker');
$this->assertEquals(