mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
remove parentheses from (new Class())->method()
This commit is contained in:
2
Makefile
2
Makefile
@@ -92,7 +92,7 @@ lint-php:
|
||||
-o -path ./node_modules -prune \
|
||||
-o -path ./misc/docker -prune \
|
||||
-o -type f -name '*.php' \
|
||||
print0 \
|
||||
-print0 \
|
||||
| xargs -0 php -l -n | grep -v '^No syntax errors detected in' || true
|
||||
vendor/bin/phpcs -p --report-width=256
|
||||
vendor/bin/phpstan analyse --memory-limit=1024M --configuration=misc/phpstan.neon
|
||||
|
||||
@@ -39,7 +39,7 @@ class GenerateInvite extends AbstractAPI {
|
||||
$interviewer->id(), $key, $email, "Passed Interview"
|
||||
);
|
||||
if (!empty($_GET['email'])) {
|
||||
(new Mail())->send($email, 'New account confirmation at ' . SITE_NAME,
|
||||
new Mail()->send($email, 'New account confirmation at ' . SITE_NAME,
|
||||
self::$twig->render('email/invite-interviewer.twig', [
|
||||
'inviter_name' => $interviewer->username(),
|
||||
'inviter_key' => $key,
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Gazelle\API;
|
||||
|
||||
class Request extends AbstractAPI {
|
||||
public function run(): array {
|
||||
$request = (new \Gazelle\Manager\Request())->findById((int)($_GET['request_id'] ?? 0));
|
||||
$request = new \Gazelle\Manager\Request()->findById((int)($_GET['request_id'] ?? 0));
|
||||
if (is_null($request)) {
|
||||
json_error('Missing request id');
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class Torrent extends AbstractAPI {
|
||||
}
|
||||
|
||||
protected function torrent(int $id): array {
|
||||
$torrent = (new \Gazelle\Manager\Torrent())->findById($id);
|
||||
$torrent = new \Gazelle\Manager\Torrent()->findById($id);
|
||||
if (is_null($torrent)) {
|
||||
json_error('Torrent not found');
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class Torrent extends AbstractAPI {
|
||||
}
|
||||
|
||||
protected function tgroup(int $id): array {
|
||||
$tgroup = (new \Gazelle\Manager\TGroup())->findById($id);
|
||||
$tgroup = new \Gazelle\Manager\TGroup()->findById($id);
|
||||
if (is_null($tgroup)) {
|
||||
json_error('Group not found');
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class Applicant extends BaseObject {
|
||||
final public const ENTRIES_PER_PAGE = 1000; // TODO: change to 50 and implement pagination
|
||||
|
||||
public function flush(): static {
|
||||
(new Manager\Applicant())->flush();
|
||||
new Manager\Applicant()->flush();
|
||||
if (isset($this->info)) {
|
||||
self::$cache->delete_value("user_applicant_{$this->userId()}");
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class Applicant extends BaseObject {
|
||||
* Sending from System ensures the discussion is not fragmented
|
||||
* between inboxes.
|
||||
*/
|
||||
(new User($this->userId()))->inbox()->createSystem(
|
||||
new User($this->userId())->inbox()->createSystem(
|
||||
"You have a reply to your {$this->role()->title()} application",
|
||||
self::$twig->render('applicant/pm-reply.bbcode.twig', [
|
||||
'applicant' => $this,
|
||||
|
||||
@@ -95,10 +95,10 @@ class ApplicantRole extends BaseObject {
|
||||
(RoleID, UserID, Body, ThreadID)
|
||||
VALUES (?, ?, ?, ?)
|
||||
", $this->id, $user->id, $body,
|
||||
(new Manager\Thread())->createThread('staff-role')->id
|
||||
new Manager\Thread()->createThread('staff-role')->id
|
||||
);
|
||||
(new Manager\Applicant())->flush();
|
||||
(new Manager\ApplicantRole())->flush();
|
||||
new Manager\Applicant()->flush();
|
||||
new Manager\ApplicantRole()->flush();
|
||||
return new Applicant(self::$db->inserted_id());
|
||||
}
|
||||
|
||||
@@ -148,8 +148,8 @@ class ApplicantRole extends BaseObject {
|
||||
", $this->id
|
||||
);
|
||||
$affected = self::$db->affected_rows() + parent::remove();
|
||||
(new Manager\Applicant())->flush();
|
||||
(new Manager\ApplicantRole())->flush();
|
||||
new Manager\Applicant()->flush();
|
||||
new Manager\ApplicantRole()->flush();
|
||||
return $affected;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -865,7 +865,7 @@ class Artist extends BaseAttrObject implements CollageEntry {
|
||||
self::$db->prepared_query("DELETE FROM wiki_artists WHERE PageID = ?", $id);
|
||||
$db->relaxConstraints(false);
|
||||
|
||||
(new Manager\Comment())->remove('artist', $id);
|
||||
new Manager\Comment()->remove('artist', $id);
|
||||
$this->flush();
|
||||
$affected = parent::remove();
|
||||
$this->logger()->general(
|
||||
|
||||
@@ -187,7 +187,7 @@ abstract class AbstractCollage extends \Gazelle\Base {
|
||||
$args = array_merge(
|
||||
...array_map(
|
||||
fn(int $sort, int $entryId) => [
|
||||
(int)$entryId,
|
||||
$entryId,
|
||||
($sort + 1) * 10,
|
||||
$this->id,
|
||||
$userMap[$entryId]
|
||||
|
||||
@@ -146,7 +146,7 @@ class TGroup extends AbstractCollage {
|
||||
$rows = parent::remove(); // soft remove in AbstractCollage
|
||||
} else {
|
||||
// personal collages are nuked hard, no undo
|
||||
(new \Gazelle\Manager\Comment())->remove('collages', $this->id);
|
||||
new \Gazelle\Manager\Comment()->remove('collages', $this->id);
|
||||
self::$db->prepared_query("
|
||||
DELETE FROM bookmarks_collages WHERE CollageID = ?
|
||||
", $this->id
|
||||
|
||||
@@ -70,7 +70,7 @@ abstract class AbstractComment extends \Gazelle\BaseObject {
|
||||
'postId' => $postId,
|
||||
'authorId' => $userId,
|
||||
'name' => $author->username(),
|
||||
'donor' => (new \Gazelle\User\Donor($author))->isDonor(),
|
||||
'donor' => new \Gazelle\User\Donor($author)->isDonor(),
|
||||
'warned' => $author->isWarned(),
|
||||
'enabled' => $author->isEnabled(),
|
||||
'class' => $manager->userclassName($author->primaryClass()),
|
||||
@@ -190,7 +190,7 @@ abstract class AbstractComment extends \Gazelle\BaseObject {
|
||||
);
|
||||
$affected = self::$db->affected_rows();
|
||||
if ($affected) {
|
||||
(new \Gazelle\User\Quote($user))->flush();
|
||||
new \Gazelle\User\Quote($user)->flush();
|
||||
}
|
||||
|
||||
// last read
|
||||
@@ -303,7 +303,7 @@ abstract class AbstractComment extends \Gazelle\BaseObject {
|
||||
$affected += self::$db->affected_rows();
|
||||
self::$db->commit();
|
||||
|
||||
(new \Gazelle\Manager\Subscription())->flushPage($page, $this->pageId);
|
||||
new \Gazelle\Manager\Subscription()->flushPage($page, $this->pageId);
|
||||
|
||||
self::$cache->delete_multi([
|
||||
"edit_{$page}_" . $this->id,
|
||||
|
||||
@@ -198,7 +198,7 @@ class Contest extends BaseObject {
|
||||
}
|
||||
|
||||
public function bonusPerUserValue(): int {
|
||||
$totalEnabledUsers = (new Stats\Users())->enabledUserTotal();
|
||||
$totalEnabledUsers = new Stats\Users()->enabledUserTotal();
|
||||
return $totalEnabledUsers
|
||||
? (int)floor(
|
||||
$this->bonusPoolTotal() * $this->bonusPerUserRatio()
|
||||
@@ -346,7 +346,7 @@ class Contest extends BaseObject {
|
||||
'username' => $user->username(),
|
||||
])
|
||||
);
|
||||
(new User\Bonus($user))->addPoints($totalGain);
|
||||
new User\Bonus($user)->addPoints($totalGain);
|
||||
$user->addStaffNote(
|
||||
number_format($totalGain)
|
||||
. " BP added for {$totalEntries} entries in {$this->name()}"
|
||||
|
||||
@@ -203,7 +203,7 @@ class Debug {
|
||||
$Tracer = debug_backtrace();
|
||||
|
||||
// This is in case something in this function goes wrong and we get stuck with an infinite loop
|
||||
if (($Tracer[$Steps]['class'] ?? '') === 'Gazelle\\Debug' && $Tracer[$Steps]['function'] === 'errorHandler') {
|
||||
if (($Tracer[$Steps]['class'] ?? '') === \Gazelle\Debug::class && $Tracer[$Steps]['function'] === 'errorHandler') {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ class Download extends Base {
|
||||
self::$db->rollback();
|
||||
return DownloadStatus::no_tokens;
|
||||
}
|
||||
if (!(new Tracker())->addToken($this->torrent, $user)) {
|
||||
if (!new Tracker()->addToken($this->torrent, $user)) {
|
||||
self::$db->rollback();
|
||||
return DownloadStatus::tracker;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class Forum extends BaseObject {
|
||||
}
|
||||
|
||||
public function flush(): static {
|
||||
(new Manager\Forum())->flushToc();
|
||||
new Manager\Forum()->flushToc();
|
||||
self::$cache->delete_multi([
|
||||
sprintf(self::CACHE_FORUM, $this->id),
|
||||
sprintf(self::CACHE_TOC_FORUM, $this->id),
|
||||
|
||||
@@ -216,7 +216,7 @@ class ForumPost extends BaseObject {
|
||||
self::$db->commit();
|
||||
|
||||
$thread->forum()->adjust();
|
||||
(new Manager\Subscription())->flushThread($thread);
|
||||
new Manager\Subscription()->flushThread($thread);
|
||||
|
||||
$thread->flushPostCatalogue($this);
|
||||
$thread->flush();
|
||||
|
||||
@@ -15,7 +15,7 @@ class ForumThread extends BaseObject {
|
||||
public function flush(): static {
|
||||
self::$cache->delete_value(sprintf(self::CACHE_KEY, $this->id));
|
||||
self::$cache->delete_value("edit_forums_{$this->id}");
|
||||
(new Manager\Forum())->flushToc();
|
||||
new Manager\Forum()->flushToc();
|
||||
unset($this->info);
|
||||
return $this;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ class ForumThread extends BaseObject {
|
||||
}
|
||||
|
||||
public function addPost(User $user, string $body): ForumPost {
|
||||
$post = (new Manager\ForumPost())->create($this, $user, $body);
|
||||
$post = new Manager\ForumPost()->create($this, $user, $body);
|
||||
$this->info();
|
||||
$this->info['post_total_summary']++;
|
||||
$this->info['last_post_id'] = $post->id();
|
||||
@@ -345,7 +345,7 @@ class ForumThread extends BaseObject {
|
||||
);
|
||||
$affected = self::$db->affected_rows();
|
||||
$this->updateRoot($post->userId(), $post->id());
|
||||
(new Manager\Forum())->flushToc();
|
||||
new Manager\Forum()->flushToc();
|
||||
$this->forum()->flush();
|
||||
$this->flushPostCatalogue($post);
|
||||
$this->flush();
|
||||
@@ -458,7 +458,7 @@ class ForumThread extends BaseObject {
|
||||
$affected = self::$db->affected_rows();
|
||||
$db->relaxConstraints(false);
|
||||
$this->forum()->adjust();
|
||||
(new Manager\Subscription())->moveThread($this, null);
|
||||
new Manager\Subscription()->moveThread($this, null);
|
||||
|
||||
$previousPost = self::$db->rowAssoc("
|
||||
SELECT AuthorID AS user_id,
|
||||
|
||||
@@ -78,7 +78,7 @@ class ForumTransition extends BaseObject {
|
||||
return $this->classLevel() <= $user->classLevel()
|
||||
|| in_array($user->id, $this->userIdList())
|
||||
|| array_intersect(
|
||||
array_keys((new User\Privilege($user))->secondaryClassList()),
|
||||
array_keys(new User\Privilege($user)->secondaryClassList()),
|
||||
$this->secondaryClassIdList()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ class Artist extends \Gazelle\Json {
|
||||
}
|
||||
|
||||
$JsonSimilar = [];
|
||||
foreach ((new \Gazelle\Artist\Similar($artist))->info() as $s) {
|
||||
foreach (new \Gazelle\Artist\Similar($artist)->info() as $s) {
|
||||
$JsonSimilar[] = [
|
||||
'artistId' => $s['artist_id'],
|
||||
'name' => $s['name'],
|
||||
|
||||
@@ -51,7 +51,7 @@ class Collage extends \Gazelle\Json {
|
||||
'locked' => $this->collage->isLocked(),
|
||||
'maxGroups' => $this->collage->maxGroups(),
|
||||
'maxGroupsPerUser' => $this->collage->maxGroupsPerUser(),
|
||||
'hasBookmarked' => (new \Gazelle\User\Bookmark($this->user))->isCollageBookmarked($this->collage->id()),
|
||||
'hasBookmarked' => new \Gazelle\User\Bookmark($this->user)->isCollageBookmarked($this->collage->id()),
|
||||
'subscriberCount' => $this->collage->numSubscribers(),
|
||||
'torrentGroupIDList' => $entryList,
|
||||
'pages' => $this->collage->isArtist() ? 1 : ceil(count($entryList) / static::$ENTRIES_PER_PAGE),
|
||||
|
||||
@@ -105,7 +105,7 @@ class ForumThread extends \Gazelle\Json {
|
||||
'authorId' => $authorId,
|
||||
'authorName' => $author->username(),
|
||||
'paranoia' => $author->paranoia(),
|
||||
'donor' => (new \Gazelle\User\Donor($author))->isDonor(),
|
||||
'donor' => new \Gazelle\User\Donor($author)->isDonor(),
|
||||
'warned' => $author->isWarned(),
|
||||
'avatar' => $author->avatar(),
|
||||
'enabled' => $author->isEnabled(),
|
||||
@@ -114,7 +114,7 @@ class ForumThread extends \Gazelle\Json {
|
||||
];
|
||||
}
|
||||
|
||||
$subscribed = (new \Gazelle\User\Subscription($this->user))->isSubscribed($thread);
|
||||
$subscribed = new \Gazelle\User\Subscription($this->user)->isSubscribed($thread);
|
||||
if ($subscribed) {
|
||||
self::$cache->delete_value("subscriptions_user_new_{$this->user->id}");
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ class Inbox extends \Gazelle\Json {
|
||||
'avatar' => $senderId ? $user[$senderId]->avatar() : null,
|
||||
'warned' => $senderId && $user[$senderId]->isWarned(),
|
||||
'enabled' => $senderId && $user[$senderId]->isEnabled(),
|
||||
'donor' => $senderId && (new \Gazelle\User\Donor($user[$senderId]))->isDonor(),
|
||||
'donor' => $senderId && new \Gazelle\User\Donor($user[$senderId])->isDonor(),
|
||||
'date' => $actionDate,
|
||||
];
|
||||
self::$db->set_query_id($qid);
|
||||
|
||||
@@ -20,7 +20,7 @@ class News extends \Gazelle\Json {
|
||||
$r['created'],
|
||||
time_diff($r['created'], 2, false),
|
||||
],
|
||||
(new \Gazelle\Manager\News())->list($this->limit, $this->offset)
|
||||
new \Gazelle\Manager\News()->list($this->limit, $this->offset)
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class TGroup extends \Gazelle\Json {
|
||||
'categoryName' => $tgroup->categoryName(),
|
||||
'time' => $tgroup->time(),
|
||||
'vanityHouse' => $tgroup->isShowcase(),
|
||||
'isBookmarked' => (new \Gazelle\User\Bookmark($this->user))->isTorrentBookmarked($tgroup->id()),
|
||||
'isBookmarked' => new \Gazelle\User\Bookmark($this->user)->isTorrentBookmarked($tgroup->id()),
|
||||
'tags' => array_values($tgroup->tagNameList()),
|
||||
'musicInfo' => $musicInfo,
|
||||
];
|
||||
@@ -41,7 +41,7 @@ class TGroup extends \Gazelle\Json {
|
||||
'torrents' => array_reduce($this->tgroup->torrentIdList(), function ($acc, $id) {
|
||||
$torrent = $this->torMan->findById($id);
|
||||
if ($torrent) {
|
||||
$acc[] = (new Torrent($torrent, $this->user, $this->torMan))->torrentPayload();
|
||||
$acc[] = new Torrent($torrent, $this->user, $this->torMan)->torrentPayload();
|
||||
}
|
||||
return $acc;
|
||||
}, []),
|
||||
|
||||
@@ -54,7 +54,7 @@ class Torrent extends \Gazelle\Json {
|
||||
public function payload(): array {
|
||||
return [
|
||||
'group' => $this->torrent->hasTGroup()
|
||||
? (new TGroup($this->torrent->group(), $this->user, $this->torMan))->tgroupPayload()
|
||||
? new TGroup($this->torrent->group(), $this->user, $this->torMan)->tgroupPayload()
|
||||
: null, // an orphan torrent
|
||||
'torrent' => $this->torrentPayload(),
|
||||
];
|
||||
|
||||
@@ -20,7 +20,7 @@ class User extends \Gazelle\Json {
|
||||
|
||||
$stats = $user->stats();
|
||||
$forumPosts = $stats->forumPostTotal();
|
||||
$releaseVotes = (new Vote($user))->userTotal(Vote::UPVOTE | Vote::DOWNVOTE);
|
||||
$releaseVotes = new Vote($user)->userTotal(Vote::UPVOTE | Vote::DOWNVOTE);
|
||||
$uploaded = $this->valueOrNull($user->uploadedSize(), 'uploaded');
|
||||
$downloaded = $this->valueOrNull($user->downloadedSize(), 'downloaded');
|
||||
$uploads = $this->valueOrNull($stats->uploadTotal(), 'uploads+');
|
||||
@@ -53,14 +53,14 @@ class User extends \Gazelle\Json {
|
||||
'requests' => (int)$requestsFilled,
|
||||
'uploaded' => (int)$uploaded,
|
||||
'uploads' => (int)$uploads,
|
||||
'bonus' => (new \Gazelle\User\Bonus($user))->pointsSpent(),
|
||||
'bonus' => new \Gazelle\User\Bonus($user)->pointsSpent(),
|
||||
]
|
||||
);
|
||||
|
||||
return [
|
||||
'username' => $user->username(),
|
||||
'avatar' => $user->avatar(),
|
||||
'isFriend' => (new \Gazelle\User\Friend($user))->isFriend($viewer),
|
||||
'isFriend' => new \Gazelle\User\Friend($user)->isFriend($viewer),
|
||||
'profileText' => \Text::full_format($user->profileInfo()),
|
||||
'stats' => [
|
||||
'joinedDate' => $user->created(),
|
||||
@@ -98,7 +98,7 @@ class User extends \Gazelle\Json {
|
||||
'class' => $user->userclassName(),
|
||||
'paranoia' => $user->paranoiaLevel(),
|
||||
'paranoiaText' => $user->paranoiaLabel(),
|
||||
'donor' => (new \Gazelle\User\Donor($user))->isDonor(),
|
||||
'donor' => new \Gazelle\User\Donor($user)->isDonor(),
|
||||
'warned' => $user->isWarned(),
|
||||
'enabled' => $user->isEnabled(),
|
||||
'passkey' => ($user->id === $viewer->id() || $viewer->isStaff()) ? $user->announceKey() : null,
|
||||
|
||||
@@ -30,7 +30,7 @@ class UserSearch extends \Gazelle\Json {
|
||||
$payload[] = [
|
||||
'userId' => $user->id,
|
||||
'username' => $user->username(),
|
||||
'donor' => (new \Gazelle\User\Donor($user))->isDonor(),
|
||||
'donor' => new \Gazelle\User\Donor($user)->isDonor(),
|
||||
'warned' => $user->isWarned(),
|
||||
'enabled' => $user->isEnabled(),
|
||||
'class' => $user->userclassName(),
|
||||
|
||||
@@ -67,7 +67,7 @@ class Login extends Base {
|
||||
if (self::$cache->get_value($key) === false) {
|
||||
self::$cache->cache_value($key, true, 86400);
|
||||
// fake a user object temporarily to send them some email
|
||||
(new User($this->userId))->inbox()->createSystem(
|
||||
new User($this->userId)->inbox()->createSystem(
|
||||
"Too many login attempts on your account",
|
||||
self::$twig->render('login/too-many-failures.bbcode.twig', [
|
||||
'ipaddr' => $ipaddr,
|
||||
@@ -82,7 +82,7 @@ class Login extends Base {
|
||||
self::$cache->increment($key);
|
||||
}
|
||||
} elseif ($this->watch->nrBans() > 3) {
|
||||
(new Manager\Ban())->create(
|
||||
new Manager\Ban()->create(
|
||||
$ipaddr, 'Automated ban, too many failed login attempts'
|
||||
);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ class Login extends Base {
|
||||
|
||||
// Did they come in over Tor?
|
||||
$ipaddr = $this->requestContext()->remoteAddr();
|
||||
if (BLOCK_TOR && !$user->permitted('can_use_tor') && (new Manager\Tor())->isExitNode($ipaddr)) {
|
||||
if (BLOCK_TOR && !$user->permitted('can_use_tor') && new Manager\Tor()->isExitNode($ipaddr)) {
|
||||
$userMan->disableUserList(
|
||||
new Tracker(),
|
||||
[$user->id],
|
||||
@@ -156,7 +156,7 @@ class Login extends Base {
|
||||
}
|
||||
|
||||
if (!$user->permitted('site_disable_ip_history')) {
|
||||
(new User\History($user))->registerSiteIp($ipaddr);
|
||||
new User\History($user)->registerSiteIp($ipaddr);
|
||||
}
|
||||
|
||||
// We have a user!
|
||||
|
||||
@@ -199,7 +199,7 @@ class Artist extends \Gazelle\BaseManager {
|
||||
}
|
||||
|
||||
public function sectionName(int $sectionId): ?string {
|
||||
return (new \Gazelle\ReleaseType())->findExtendedNameById($sectionId);
|
||||
return new \Gazelle\ReleaseType()->findExtendedNameById($sectionId);
|
||||
}
|
||||
|
||||
public function sectionLabel(int $sectionId): string {
|
||||
@@ -207,6 +207,6 @@ class Artist extends \Gazelle\BaseManager {
|
||||
}
|
||||
|
||||
public function sectionTitle(int $sectionId): string {
|
||||
return (new \Gazelle\ReleaseType())->sectionTitle($sectionId);
|
||||
return new \Gazelle\ReleaseType()->sectionTitle($sectionId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class Bonus extends \Gazelle\Base {
|
||||
* @return int Discount rate (0: normal price, 100: everything is free :)
|
||||
*/
|
||||
public function discount(): int {
|
||||
return (int)(new \Gazelle\Manager\SiteOption())->findValueByName('bonus-discount');
|
||||
return (int)new \Gazelle\Manager\SiteOption()->findValueByName('bonus-discount');
|
||||
}
|
||||
|
||||
public function itemList(): array {
|
||||
|
||||
@@ -46,7 +46,7 @@ class Collage extends \Gazelle\BaseManager {
|
||||
);
|
||||
$id = self::$db->inserted_id();
|
||||
$user->stats()->increment('collage_total');
|
||||
(new \Gazelle\Stats\Collage())->increment();
|
||||
new \Gazelle\Stats\Collage()->increment();
|
||||
$this->logger()->general(
|
||||
"Collage $id ($name) was created by {$user->username()}"
|
||||
);
|
||||
|
||||
@@ -46,9 +46,9 @@ class Comment extends \Gazelle\BaseManager {
|
||||
if ($page == 'collages') {
|
||||
self::$cache->delete_value("{$page}_comments_recent_{$pageId}");
|
||||
}
|
||||
(new \Gazelle\User\Notification\Quote($user))
|
||||
new \Gazelle\User\Notification\Quote($user)
|
||||
->create($page, $pageId, $postId, $body);
|
||||
(new Subscription())->flushPage($page, $pageId);
|
||||
new Subscription()->flushPage($page, $pageId);
|
||||
|
||||
$className = $this->className($page);
|
||||
return new $className($pageId, 0, $postId); /** @phpstan-ignore-line */
|
||||
@@ -139,7 +139,7 @@ class Comment extends \Gazelle\BaseManager {
|
||||
$affected = self::$db->affected_rows();
|
||||
|
||||
// literally, move the comment thread to nowhere i.e. delete
|
||||
(new \Gazelle\Manager\Subscription())->move($page, $pageId, null);
|
||||
new \Gazelle\Manager\Subscription()->move($page, $pageId, null);
|
||||
|
||||
self::$db->prepared_query("
|
||||
DELETE FROM users_notify_quoted WHERE Page = ? AND PageID = ?
|
||||
|
||||
@@ -84,7 +84,7 @@ class FeaturedAlbum extends \Gazelle\BaseManager {
|
||||
);
|
||||
|
||||
self::$db->commit();
|
||||
return (new \Gazelle\FeaturedAlbum($featureType, $tgroup->id))->flush();
|
||||
return new \Gazelle\FeaturedAlbum($featureType, $tgroup->id)->flush();
|
||||
}
|
||||
|
||||
public function findById(int $id): ?\Gazelle\FeaturedAlbum {
|
||||
|
||||
@@ -44,7 +44,7 @@ class IPv4 extends \Gazelle\Base {
|
||||
);
|
||||
$affected = self::$db->affected_rows();
|
||||
$user->setField('IP', $ipv4)
|
||||
->setField('ipcc', (new \Gazelle\Util\GeoIP(new \Gazelle\Util\Curl()))->countryISO($ipv4))
|
||||
->setField('ipcc', new \Gazelle\Util\GeoIP(new \Gazelle\Util\Curl())->countryISO($ipv4))
|
||||
->modify();
|
||||
self::$cache->delete_value(sprintf('ipv4_dup_' . str_replace('-', '_', $ipv4)));
|
||||
$this->flush();
|
||||
|
||||
@@ -19,7 +19,7 @@ class Invite extends \Gazelle\Base {
|
||||
);
|
||||
$invite = new \Gazelle\Invite($inviteKey);
|
||||
if (is_number($source)) {
|
||||
(new \Gazelle\Manager\InviteSource())->createPendingInviteSource((int)$source, $inviteKey);
|
||||
new \Gazelle\Manager\InviteSource()->createPendingInviteSource((int)$source, $inviteKey);
|
||||
}
|
||||
self::$db->commit();
|
||||
return $invite;
|
||||
|
||||
@@ -275,7 +275,7 @@ class Recovery extends \Gazelle\Base {
|
||||
VALUES (?, ?, ?, ?, now() + interval 1 week)
|
||||
", $admin_id, $key, $email, "Account recovery id={$id} key={$key}"
|
||||
);
|
||||
(new Mail())->send($email, 'Account recovery confirmation at ' . SITE_NAME,
|
||||
new Mail()->send($email, 'Account recovery confirmation at ' . SITE_NAME,
|
||||
self::$twig->render('email/recovery.twig', [
|
||||
'invite_key' => $key,
|
||||
])
|
||||
@@ -549,7 +549,7 @@ $reclaimMsg
|
||||
--OPS Staff
|
||||
END_MSG;
|
||||
}
|
||||
(new \Gazelle\User($siteUserId))->inbox()
|
||||
new \Gazelle\User($siteUserId)->inbox()
|
||||
->createSystem("Your buffer stats have been updated", $Body);
|
||||
}
|
||||
|
||||
|
||||
@@ -544,7 +544,7 @@ class Referral extends \Gazelle\Base {
|
||||
);
|
||||
|
||||
if (REFERRAL_SEND_EMAIL) {
|
||||
(new Mail())->send($email, 'You have been invited to ' . SITE_NAME,
|
||||
new Mail()->send($email, 'You have been invited to ' . SITE_NAME,
|
||||
self::$twig->render('email/referral.twig', [
|
||||
'email' => $email,
|
||||
'inviter_key' => $inviteKey,
|
||||
|
||||
@@ -24,7 +24,7 @@ class SSLHost extends \Gazelle\Base {
|
||||
// Let us know if you can show otherwise.
|
||||
|
||||
$url = "https://{$hostname}:{$port}";
|
||||
$curl = (new \Gazelle\Util\Curl())
|
||||
$curl = new \Gazelle\Util\Curl()
|
||||
->setOption(CURLOPT_CERTINFO, true)
|
||||
->setOption(CURLOPT_SSL_VERIFYPEER, true)
|
||||
->setOption(CURLOPT_SSL_VERIFYHOST, 2);
|
||||
|
||||
@@ -38,7 +38,7 @@ class Subscription extends \Gazelle\Base {
|
||||
$list = self::$db->collect('UserID');
|
||||
|
||||
foreach ($list as $userId) {
|
||||
(new \Gazelle\User\Quote(new \Gazelle\User($userId)))->flush();
|
||||
new \Gazelle\User\Quote(new \Gazelle\User($userId))->flush();
|
||||
}
|
||||
|
||||
self::$db->set_query_id($qid);
|
||||
@@ -71,7 +71,7 @@ class Subscription extends \Gazelle\Base {
|
||||
);
|
||||
foreach (self::$db->collect('UserID') as $userId) {
|
||||
++$affected;
|
||||
(new \Gazelle\User\Quote(new \Gazelle\User($userId)))->flush();
|
||||
new \Gazelle\User\Quote(new \Gazelle\User($userId))->flush();
|
||||
}
|
||||
return $affected;
|
||||
}
|
||||
|
||||
@@ -181,8 +181,8 @@ class TGroup extends \Gazelle\BaseManager {
|
||||
", $new->id, $old->id
|
||||
);
|
||||
|
||||
(new \Gazelle\Manager\Bookmark())->merge($old, $new);
|
||||
(new \Gazelle\Manager\Comment())->merge('torrents', $old->id, $new->id);
|
||||
new \Gazelle\Manager\Bookmark()->merge($old, $new);
|
||||
new \Gazelle\Manager\Comment()->merge('torrents', $old->id, $new->id);
|
||||
$voteManager->merge($old, $new, $userManager);
|
||||
|
||||
// Collages
|
||||
@@ -338,7 +338,7 @@ class TGroup extends \Gazelle\BaseManager {
|
||||
if ($oldCategoryId === $categoryId) {
|
||||
return null;
|
||||
}
|
||||
switch ((new Category())->findNameById($categoryId)) {
|
||||
switch (new Category()->findNameById($categoryId)) {
|
||||
case 'Music':
|
||||
if (empty($artistName) || !$year || !$releaseType) {
|
||||
return null;
|
||||
@@ -384,9 +384,9 @@ class TGroup extends \Gazelle\BaseManager {
|
||||
if (self::$db->scalar('SELECT ID FROM torrents WHERE GroupID = ?', $old->id)) {
|
||||
$old->flush()->refresh();
|
||||
} else {
|
||||
(new \Gazelle\Manager\Bookmark())->merge($old, $new);
|
||||
(new \Gazelle\Manager\Comment())->merge('torrents', $old->id, $new->id);
|
||||
(new \Gazelle\Manager\Vote())->merge($old, $new, new \Gazelle\Manager\User());
|
||||
new \Gazelle\Manager\Bookmark()->merge($old, $new);
|
||||
new \Gazelle\Manager\Comment()->merge('torrents', $old->id, $new->id);
|
||||
new \Gazelle\Manager\Vote()->merge($old, $new, new \Gazelle\Manager\User());
|
||||
$this->logger()->merge($old, $new);
|
||||
$old->removeTGroup();
|
||||
}
|
||||
|
||||
@@ -277,10 +277,10 @@ class Tag extends \Gazelle\BaseManager {
|
||||
// update cache and sphinx
|
||||
// (some of these may not have changed, skipping them would be a false optimization)
|
||||
foreach ($affectedRequests as $id) {
|
||||
(new \Gazelle\Request($id))->updateSphinx();
|
||||
new \Gazelle\Request($id)->updateSphinx();
|
||||
}
|
||||
foreach ($affectedTGroups as $id) {
|
||||
(new \Gazelle\TGroup($id))->refresh();
|
||||
new \Gazelle\TGroup($id)->refresh();
|
||||
}
|
||||
|
||||
return $changed;
|
||||
|
||||
@@ -66,9 +66,9 @@ class Tor extends \Gazelle\Base {
|
||||
}
|
||||
|
||||
public function isExitNode(string $ip): bool {
|
||||
return BLOCK_TOR ? (bool)$this->pg()->scalar("
|
||||
return BLOCK_TOR && (bool)$this->pg()->scalar("
|
||||
SELECT 1 FROM tor_node WHERE ipv4 = ?
|
||||
", $ip
|
||||
) : false;
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ class Torrent extends \Gazelle\BaseManager {
|
||||
*/
|
||||
|
||||
public static function renderPL(int $id, array $attr): ?string {
|
||||
$torrent = (new self())->findById($id);
|
||||
$torrent = new self()->findById($id);
|
||||
$meta = '';
|
||||
$wantMeta = !(in_array('nometa', $attr) || in_array('title', $attr));
|
||||
|
||||
@@ -572,7 +572,7 @@ class Torrent extends \Gazelle\BaseManager {
|
||||
if (is_null($deleted)) {
|
||||
return null;
|
||||
}
|
||||
$tgroup = (new \Gazelle\Manager\TGroup())->findById((int)$deleted['GroupID']);
|
||||
$tgroup = new \Gazelle\Manager\TGroup()->findById((int)$deleted['GroupID']);
|
||||
if (is_null($tgroup)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1093,7 +1093,7 @@ class User extends \Gazelle\BaseManager {
|
||||
self::$db->prepared_query($query, ...$args);
|
||||
foreach (self::$db->collect(0) as $userId) {
|
||||
$user = $this->findById($userId);
|
||||
if (is_null($user) || (new \Gazelle\User\Warning($user))->isWarned()) {
|
||||
if (is_null($user) || new \Gazelle\User\Warning($user)->isWarned()) {
|
||||
continue;
|
||||
}
|
||||
++$processed;
|
||||
|
||||
@@ -37,7 +37,7 @@ class UserToken extends \Gazelle\BaseManager {
|
||||
", $user->id, UserTokenType::password->value
|
||||
);
|
||||
$userToken = $this->create(UserTokenType::password, $user);
|
||||
(new \Gazelle\Util\Mail())->send($user->email(), 'Password reset information for ' . SITE_NAME,
|
||||
new \Gazelle\Util\Mail()->send($user->email(), 'Password reset information for ' . SITE_NAME,
|
||||
self::$twig->render('email/password-reset.twig', [
|
||||
'ipaddr' => $this->requestContext()->remoteAddr(),
|
||||
'reset_key' => $userToken->value(),
|
||||
|
||||
@@ -29,7 +29,7 @@ class Vote extends \Gazelle\Base {
|
||||
foreach (self::$db->collect(0) as $userId) {
|
||||
$user = $userManager->findById($userId);
|
||||
if ($user) {
|
||||
(new \Gazelle\User\Vote($user))->flush();
|
||||
new \Gazelle\User\Vote($user)->flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -643,7 +643,7 @@ class Request extends BaseObject implements CategoryHasArtist {
|
||||
);
|
||||
$updated = self::$db->affected_rows();
|
||||
$this->updateSphinx();
|
||||
(new \SphinxqlQuery())->raw_query(
|
||||
new \SphinxqlQuery()->raw_query(
|
||||
sprintf("
|
||||
UPDATE requests, requests_delta SET torrentid = %d, fillerid = %d WHERE id = %d
|
||||
", $torrent->id, $user->id, $this->id
|
||||
@@ -659,7 +659,7 @@ class Request extends BaseObject implements CategoryHasArtist {
|
||||
", $this->id
|
||||
);
|
||||
foreach (self::$db->collect(0) as $userId) {
|
||||
(new User($userId))->inbox()->createSystem("The request \"$name\" has been filled", $message);
|
||||
new User($userId)->inbox()->createSystem("The request \"$name\" has been filled", $message);
|
||||
}
|
||||
|
||||
$this->logger()->general(
|
||||
@@ -695,7 +695,7 @@ class Request extends BaseObject implements CategoryHasArtist {
|
||||
$filler->flush();
|
||||
self::$db->commit();
|
||||
|
||||
(new \SphinxqlQuery())->raw_query("
|
||||
new \SphinxqlQuery()->raw_query("
|
||||
UPDATE requests, requests_delta SET
|
||||
torrentid = 0,
|
||||
fillerid = 0
|
||||
@@ -883,7 +883,7 @@ class Request extends BaseObject implements CategoryHasArtist {
|
||||
// and live with the <= 1 minute delay if we have more than 100 bookmarkers
|
||||
$this->updateSphinx();
|
||||
} else {
|
||||
(new \SphinxqlQuery())->raw_query(
|
||||
new \SphinxqlQuery()->raw_query(
|
||||
"UPDATE requests, requests_delta SET bookmarker = ("
|
||||
. implode(',', self::$db->collect('UserID'))
|
||||
. ") WHERE id = {$this->id}"
|
||||
@@ -913,7 +913,7 @@ class Request extends BaseObject implements CategoryHasArtist {
|
||||
REPLACE INTO sphinx_requests_delta (ID) VALUES (?)
|
||||
", $this->id
|
||||
);
|
||||
(new Manager\Comment())->remove('requests', $this->id);
|
||||
new Manager\Comment()->remove('requests', $this->id);
|
||||
self::$db->commit();
|
||||
|
||||
foreach ($artisIds as $artistId) {
|
||||
|
||||
@@ -170,7 +170,7 @@ class Request extends \Gazelle\Base {
|
||||
$this->negate = true;
|
||||
}
|
||||
}
|
||||
$filter = (new \Gazelle\Manager\Tag())->sphinxFilter(['include' => $include, 'exclude' => $exclude], $this->negate, $tagMode === 'all');
|
||||
$filter = new \Gazelle\Manager\Tag()->sphinxFilter(['include' => $include, 'exclude' => $exclude], $this->negate, $tagMode === 'all');
|
||||
$this->tagList = $filter['input'];
|
||||
if ($filter['predicate']) {
|
||||
$this->sphinxq->where_match($filter['predicate'], 'taglist', false);
|
||||
|
||||
@@ -437,7 +437,7 @@ class Torrent {
|
||||
|
||||
case 'releasetype':
|
||||
$id = (int)$Value;
|
||||
if (!is_null((new \Gazelle\ReleaseType())->findNameById($id))) {
|
||||
if (!is_null(new \Gazelle\ReleaseType()->findNameById($id))) {
|
||||
$this->SphQL->where('ReleaseType', $id);
|
||||
}
|
||||
break;
|
||||
@@ -489,7 +489,7 @@ class Torrent {
|
||||
private function post_process_fields(): void {
|
||||
if (isset($this->Terms['taglist'])) {
|
||||
// Replace bad tags with tag aliases
|
||||
$this->Terms['taglist'] = (new \Gazelle\Manager\Tag())->replaceAliasList($this->Terms['taglist']);
|
||||
$this->Terms['taglist'] = new \Gazelle\Manager\Tag()->replaceAliasList($this->Terms['taglist']);
|
||||
if (isset($this->RawTerms['tags_type']) && (int)$this->RawTerms['tags_type'] === self::TAGS_ANY) {
|
||||
$this->Terms['taglist']['operator'] = self::SPH_BOOL_OR;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class Staff extends BaseUser {
|
||||
];
|
||||
$effectiveClass = $this->user->privilege()->effectiveClassLevel();
|
||||
$args = [$this->user->id, $effectiveClass];
|
||||
$classes = (new Manager\User())->classList();
|
||||
$classes = new Manager\User()->classList();
|
||||
if ($effectiveClass >= $classes[MOD]['Level']) {
|
||||
$cond[] = 'Level >= ?';
|
||||
$args[] = $classes[MOD]['Level'];
|
||||
|
||||
@@ -6,7 +6,7 @@ class StaffGroup extends BaseObject {
|
||||
final public const tableName = 'staff_groups';
|
||||
|
||||
public function flush(): static {
|
||||
(new Manager\Privilege())->flush();
|
||||
new Manager\Privilege()->flush();
|
||||
self::$cache->delete_value(Manager\StaffGroup::LIST_KEY);
|
||||
unset($this->info);
|
||||
return $this;
|
||||
|
||||
@@ -402,7 +402,7 @@ class TGroup extends BaseAttrObject implements CategoryHasArtist, CollageEntry {
|
||||
public function releaseTypeName(): ?string {
|
||||
static $releaseTypes;
|
||||
if (is_null($releaseTypes)) {
|
||||
$releaseTypes = (new ReleaseType())->list();
|
||||
$releaseTypes = new ReleaseType()->list();
|
||||
}
|
||||
return $this->info()['ReleaseType'] == 0 ? null : $releaseTypes[$this->releaseType()];
|
||||
}
|
||||
@@ -862,9 +862,9 @@ class TGroup extends BaseAttrObject implements CategoryHasArtist, CollageEntry {
|
||||
$old->flush();
|
||||
$old->refresh();
|
||||
} else {
|
||||
(new Manager\Bookmark())->merge($old, $this);
|
||||
(new Manager\Comment())->merge('torrents', $oldId, $this->id);
|
||||
(new Manager\Vote())->merge($old, $this, new Manager\User());
|
||||
new Manager\Bookmark()->merge($old, $this);
|
||||
new Manager\Comment()->merge('torrents', $oldId, $this->id);
|
||||
new Manager\Vote()->merge($old, $this, new Manager\User());
|
||||
$this->logger()->merge($old, $this);
|
||||
$old->removeTGroup();
|
||||
}
|
||||
@@ -984,7 +984,7 @@ class TGroup extends BaseAttrObject implements CategoryHasArtist, CollageEntry {
|
||||
self::$cache->delete_value("torrent_collages_" . $this->id);
|
||||
}
|
||||
|
||||
(new Manager\Comment())->remove('torrents', $this->id);
|
||||
new Manager\Comment()->remove('torrents', $this->id);
|
||||
|
||||
// Requests
|
||||
self::$db->prepared_query("
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class ArtistUsage extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Stats\Artists())->updateUsage();
|
||||
$this->processed = new \Gazelle\Stats\Artists()->updateUsage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class BetterTranscode extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Manager\TGroup())->refreshBetterTranscode();
|
||||
$this->processed = new \Gazelle\Manager\TGroup()->refreshBetterTranscode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Gazelle\Task;
|
||||
|
||||
class CommunityStats extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Stats\Users())->refresh()
|
||||
+ (new \Gazelle\Stats\TGroups())->refresh();
|
||||
$this->processed = new \Gazelle\Stats\Users()->refresh()
|
||||
+ new \Gazelle\Stats\TGroups()->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class CycleAuthKeys extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed += (new \Gazelle\Manager\User())->cycleAuthKeys();
|
||||
$this->processed += new \Gazelle\Manager\User()->cycleAuthKeys();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class DisableDownloadingRatioWatch extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed += (new \Gazelle\Manager\User())->ratioWatchEngage(new \Gazelle\Tracker(), $this);
|
||||
$this->processed += new \Gazelle\Manager\User()->ratioWatchEngage(new \Gazelle\Tracker(), $this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class DisableLeechingRatioWatch extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed += (new \Gazelle\Manager\User())->ratioWatchBlock(new \Gazelle\Tracker(), $this);
|
||||
$this->processed += new \Gazelle\Manager\User()->ratioWatchBlock(new \Gazelle\Tracker(), $this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class DisableUnconfirmedUsers extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Manager\User())->disableUnconfirmedUsers();
|
||||
$this->processed = new \Gazelle\Manager\User()->disableUnconfirmedUsers();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Gazelle\Task;
|
||||
|
||||
class ExpireFlTokens extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Manager\User())
|
||||
$this->processed = new \Gazelle\Manager\User()
|
||||
->expireFreeleechTokens(new \Gazelle\Manager\Torrent(), new \Gazelle\Tracker());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class ExpireInvites extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Manager\Invite())->expire($this);
|
||||
$this->processed = new \Gazelle\Manager\Invite()->expire($this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class InactiveUserDeactivate extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Manager\User())->inactiveUserDeactivate(new \Gazelle\Tracker());
|
||||
$this->processed = new \Gazelle\Manager\User()->inactiveUserDeactivate(new \Gazelle\Tracker());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class InactiveUserWarn extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Manager\User())->inactiveUserWarn(new \Gazelle\Util\Mail());
|
||||
$this->processed = new \Gazelle\Manager\User()->inactiveUserWarn(new \Gazelle\Util\Mail());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class LockOldThreads extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Manager\ForumThread())->lockOldThreads();
|
||||
$this->processed = new \Gazelle\Manager\ForumThread()->lockOldThreads();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Gazelle\Task;
|
||||
|
||||
class Peerupdate extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
[$updated, /* $skipped */] = (new \Gazelle\Manager\Torrent())->updatePeerlists();
|
||||
[$updated, /* $skipped */] = new \Gazelle\Manager\Torrent()->updatePeerlists();
|
||||
$this->processed += (int)$updated;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class RatioRequirements extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Manager\User())->updateRatioRequirements();
|
||||
$this->processed = new \Gazelle\Manager\User()->updateRatioRequirements();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class RatioWatch extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed += (new \Gazelle\Manager\User())->ratioWatchAudit(new \Gazelle\Tracker(), $this);
|
||||
$this->processed += new \Gazelle\Manager\User()->ratioWatchAudit(new \Gazelle\Tracker(), $this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class RemoveDeadSessions extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed += (new \Gazelle\Manager\Session())->purge();
|
||||
$this->processed += new \Gazelle\Manager\Session()->purge();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class ResetReseedRequest extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed += (new \Gazelle\Manager\Torrent())->resetReseededRequest();
|
||||
$this->processed += new \Gazelle\Manager\Torrent()->resetReseededRequest();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class SSLCertificate extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed += (new \Gazelle\Manager\SSLHost())->schedule();
|
||||
$this->processed += new \Gazelle\Manager\SSLHost()->schedule();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class TorrentHistory extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
(new \Gazelle\Manager\Torrent())->updateSeedingHistory();
|
||||
new \Gazelle\Manager\Torrent()->updateSeedingHistory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class UpdateDailyTop10 extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Manager\Torrent())->storeTop10('Daily', 1);
|
||||
$this->processed = new \Gazelle\Manager\Torrent()->storeTop10('Daily', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class UpdateUserBonusPoints extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Manager\Bonus())->givePoints($this);
|
||||
$this->processed = new \Gazelle\Manager\Bonus()->givePoints($this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class UpdateWeeklyTop10 extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Manager\Torrent())->storeTop10('Weekly', 7);
|
||||
$this->processed = new \Gazelle\Manager\Torrent()->storeTop10('Weekly', 7);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Gazelle\Task;
|
||||
|
||||
class UploadNotifier extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed = (new \Gazelle\Manager\Notification())
|
||||
$this->processed = new \Gazelle\Manager\Notification()
|
||||
->processBacklog(
|
||||
new \Gazelle\Manager\NotificationTicket(),
|
||||
new \Gazelle\Manager\Torrent(),
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Gazelle\Task;
|
||||
|
||||
class UserLastAccess extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed += (new \Gazelle\Manager\User())->refreshLastAccess();
|
||||
$this->processed += new \Gazelle\Manager\User()->refreshLastAccess();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Gazelle\Task;
|
||||
|
||||
class UserStatsDaily extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed += (new \Gazelle\Stats\Users())
|
||||
$this->processed += new \Gazelle\Stats\Users()
|
||||
->registerActivity('users_stats_daily', DELETE_USER_STATS_DAILY_DAY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Gazelle\Task;
|
||||
|
||||
class UserStatsMonthly extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed += (new \Gazelle\Stats\Users())
|
||||
$this->processed += new \Gazelle\Stats\Users()
|
||||
->registerActivity('users_stats_monthly', DELETE_USER_STATS_MONTHLY_DAY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Gazelle\Task;
|
||||
|
||||
class UserStatsYearly extends \Gazelle\Task {
|
||||
public function run(): void {
|
||||
$this->processed += (new \Gazelle\Stats\Users())
|
||||
$this->processed += new \Gazelle\Stats\Users()
|
||||
->registerActivity('users_stats_yearly', 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ class Torrent extends TorrentAbstract {
|
||||
);
|
||||
$affected = self::$db->affected_rows();
|
||||
self::$cache->delete_value("users_tokens_{$user->id}");
|
||||
(new Tracker())->removeToken($this, $user);
|
||||
new Tracker()->removeToken($this, $user);
|
||||
return $affected;
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ class Torrent extends TorrentAbstract {
|
||||
self::$db->begin_transaction();
|
||||
$this->info();
|
||||
if ($this->id > MAX_PREV_TORRENT_ID && $removePoints) {
|
||||
(new User\Bonus($this->uploader()))->removePointsForUpload($this);
|
||||
new User\Bonus($this->uploader())->removePointsForUpload($this);
|
||||
}
|
||||
|
||||
// copy the metadata that will be needed after the row has been removed
|
||||
@@ -501,7 +501,7 @@ class Torrent extends TorrentAbstract {
|
||||
$media = $this->media();
|
||||
$format = $this->format();
|
||||
$encoding = $this->encoding();
|
||||
(new Tracker())->update('delete_torrent', [
|
||||
new Tracker()->update('delete_torrent', [
|
||||
'id' => $this->id,
|
||||
'info_hash' => $this->infohashEncoded(),
|
||||
'reason' => $trackerReason,
|
||||
|
||||
@@ -111,7 +111,7 @@ class Report extends \Gazelle\BaseObject {
|
||||
}
|
||||
|
||||
public function reportType(): \Gazelle\Torrent\ReportType {
|
||||
return (new \Gazelle\Manager\Torrent\ReportType())->findByType($this->type());
|
||||
return new \Gazelle\Manager\Torrent\ReportType()->findByType($this->type());
|
||||
}
|
||||
|
||||
public function resolverId(): int {
|
||||
|
||||
@@ -226,7 +226,7 @@ abstract class TorrentAbstract extends BaseAttrObject {
|
||||
SELECT FileList FROM torrents WHERE ID = ?
|
||||
", $this->id
|
||||
);
|
||||
$chunkSize = (int)(1024 ** 2);
|
||||
$chunkSize = 1024 ** 2;
|
||||
$chunkTotal = (int)ceil(strlen($fileList) / $chunkSize);
|
||||
for ($c = 0; $c < $chunkTotal; $c++) {
|
||||
self::$cache->cache_value(
|
||||
@@ -364,7 +364,7 @@ abstract class TorrentAbstract extends BaseAttrObject {
|
||||
* This method can be used to verify that group() can be called.
|
||||
*/
|
||||
public function hasTGroup(): bool {
|
||||
return (new Manager\TGroup())->findById($this->groupId()) instanceof TGroup;
|
||||
return new Manager\TGroup()->findById($this->groupId()) instanceof TGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -136,7 +136,7 @@ class Upload extends Base {
|
||||
'description_release' => $this->releaseDescription(),
|
||||
'is_uploaded' => $this->isUploaded,
|
||||
'logchecker_accept' => \OrpheusNET\Logchecker\Logchecker::getAcceptValues(),
|
||||
'release_type' => (new ReleaseType())->list(),
|
||||
'release_type' => new ReleaseType()->list(),
|
||||
'tag_list' => $GenreTags,
|
||||
'tgroup' => $this->isUploaded && is_array($this->Torrent) ? $manager->findById($this->Torrent['GroupID']) : null,
|
||||
'torrent' => $this->Torrent,
|
||||
|
||||
14
app/User.php
14
app/User.php
@@ -114,7 +114,7 @@ class User extends BaseAttrObject {
|
||||
'samesite' => 'Strict',
|
||||
]);
|
||||
if ($sessionId) {
|
||||
(new User\Session($this))->drop($sessionId);
|
||||
new User\Session($this)->drop($sessionId);
|
||||
}
|
||||
$this->flush();
|
||||
}
|
||||
@@ -204,7 +204,7 @@ class User extends BaseAttrObject {
|
||||
}
|
||||
$this->info['RatioWatchEndsEpoch'] = $this->info['RatioWatchEnds']
|
||||
? strtotime($this->info['RatioWatchEnds']) : 0;
|
||||
$this->info['warning_expiry'] = (new User\Warning($this))->warningExpiry();
|
||||
$this->info['warning_expiry'] = new User\Warning($this)->warningExpiry();
|
||||
|
||||
self::$cache->cache_value($key, $this->info, 3600);
|
||||
self::$db->set_query_id($qid);
|
||||
@@ -293,9 +293,9 @@ class User extends BaseAttrObject {
|
||||
AvatarDisplay::show
|
||||
=> $viewed->avatar() ?: USER_DEFAULT_AVATAR,
|
||||
AvatarDisplay::fallbackSynthetic
|
||||
=> $viewed->avatar() ?: (new User\SyntheticAvatar($this))->avatar($viewed->username()),
|
||||
=> $viewed->avatar() ?: new User\SyntheticAvatar($this)->avatar($viewed->username()),
|
||||
AvatarDisplay::forceSynthetic
|
||||
=> (new User\SyntheticAvatar($this))->avatar($viewed->username()),
|
||||
=> new User\SyntheticAvatar($this)->avatar($viewed->username()),
|
||||
AvatarDisplay::none /** @phpstan-ignore-line */
|
||||
=> USER_DEFAULT_AVATAR,
|
||||
},
|
||||
@@ -1126,7 +1126,7 @@ class User extends BaseAttrObject {
|
||||
}
|
||||
|
||||
public function updateCatchup(): bool {
|
||||
return (new WitnessTable\UserReadForum())->witness($this);
|
||||
return new WitnessTable\UserReadForum()->witness($this);
|
||||
}
|
||||
|
||||
public function addClasses(array $classes): int {
|
||||
@@ -1333,7 +1333,7 @@ class User extends BaseAttrObject {
|
||||
* @return int number of collages (including collages granted from donations)
|
||||
*/
|
||||
public function allowedPersonalCollages(): int {
|
||||
return $this->paidPersonalCollages() + (new User\Donor($this))->collageTotal();
|
||||
return $this->paidPersonalCollages() + new User\Donor($this)->collageTotal();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1712,7 +1712,7 @@ class User extends BaseAttrObject {
|
||||
|
||||
public function buffer(): array {
|
||||
$class = $this->primaryClass();
|
||||
$demotion = array_filter((new Manager\User())->demotionCriteria(), fn($v) => in_array($class, $v['From']));
|
||||
$demotion = array_filter(new Manager\User()->demotionCriteria(), fn($v) => in_array($class, $v['From']));
|
||||
$criteria = end($demotion);
|
||||
|
||||
$effectiveUpload = $this->uploadedSize() + $this->stats()->requestBountySize();
|
||||
|
||||
@@ -170,7 +170,7 @@ class Activity extends \Gazelle\BaseUser {
|
||||
$this->setAlert('<a class="nobr" href="staffblog.php">New staff blog post!</a>');
|
||||
}
|
||||
if (FEATURE_EMAIL_REENABLE) {
|
||||
$total = (new \Gazelle\Manager\AutoEnable())->openTotal();
|
||||
$total = new \Gazelle\Manager\AutoEnable()->openTotal();
|
||||
if ($total > 0) {
|
||||
$this->setAction('<a class="nobr" href="tools.php?action=enable_requests">'
|
||||
. $total . " Enable request" . plural($total) . "</a>");
|
||||
|
||||
@@ -161,7 +161,7 @@ class AutoEnable extends \Gazelle\BaseUser {
|
||||
", $token, $this->id
|
||||
);
|
||||
}
|
||||
(new Mail())->send($this->email(), $subject, self::$twig->render($template, ['token' => $token]));
|
||||
new Mail()->send($this->email(), $subject, self::$twig->render($template, ['token' => $token]));
|
||||
$this->user->addStaffNote(
|
||||
"Enable request {$this->id} " . strtolower($this->outcomeLabel())
|
||||
. ' by [user]' . $viewer->username() . '[/user]' . (!empty($comment) ? "\nReason: $comment" : "")
|
||||
@@ -208,7 +208,7 @@ class AutoEnable extends \Gazelle\BaseUser {
|
||||
WHERE um.ID = ?
|
||||
", $userId
|
||||
);
|
||||
(new \Gazelle\Tracker())->addUser($this->user);
|
||||
new \Gazelle\Tracker()->addUser($this->user);
|
||||
self::$cache->delete_value(self::CACHE_TOTAL_OPEN);
|
||||
$success = true;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class Bonus extends \Gazelle\BaseUser {
|
||||
}
|
||||
|
||||
protected function items(): array {
|
||||
return (new \Gazelle\Manager\Bonus())->itemList();
|
||||
return new \Gazelle\Manager\Bonus()->itemList();
|
||||
}
|
||||
|
||||
public function itemList(): array {
|
||||
|
||||
@@ -58,7 +58,7 @@ class Bookmark extends \Gazelle\BaseUser {
|
||||
self::$cache->delete_multi(["u_book_t_" . $this->user->id, "bookmarks_{$type}_" . $this->user->id, "bookmarks_group_ids_" . $this->user->id]);
|
||||
|
||||
$torMan = new \Gazelle\Manager\Torrent();
|
||||
$tgroup = (new \Gazelle\Manager\TGroup())->findById($id);
|
||||
$tgroup = new \Gazelle\Manager\TGroup()->findById($id);
|
||||
$tgroup->stats()->increment('bookmark_total');
|
||||
|
||||
// RSS feed stuff
|
||||
@@ -312,7 +312,7 @@ class Bookmark extends \Gazelle\BaseUser {
|
||||
|
||||
if ($type === 'torrent' && self::$db->affected_rows()) {
|
||||
self::$cache->delete_value("bookmarks_group_ids_" . $this->user->id);
|
||||
(new \Gazelle\TGroup($id))->stats()->increment('bookmark_total', -1);
|
||||
new \Gazelle\TGroup($id)->stats()->increment('bookmark_total', -1);
|
||||
}
|
||||
return $affected;
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ class Donor extends \Gazelle\BaseUser {
|
||||
$fiatAmount = $amount;
|
||||
break;
|
||||
default:
|
||||
$xbtAmount = (new \Gazelle\Manager\XBT())->fiat2xbt($amount, $currency);
|
||||
$xbtAmount = new \Gazelle\Manager\XBT()->fiat2xbt($amount, $currency);
|
||||
$fiatAmount = $xbtAmount * $xbtRate;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ class MultiFactorAuth extends \Gazelle\BaseUser {
|
||||
* @return bool Valid key, they may log in.
|
||||
*/
|
||||
public function burnRecovery(string $token): bool {
|
||||
$userToken = (new Manager\UserToken())->findByToken($token);
|
||||
$userToken = new Manager\UserToken()->findByToken($token);
|
||||
if (
|
||||
$userToken instanceof Token
|
||||
&& $userToken->user->id === $this->user->id
|
||||
@@ -168,7 +168,7 @@ class MultiFactorAuth extends \Gazelle\BaseUser {
|
||||
delete from multi_factor_auth where id_user = ?
|
||||
", $this->user->id
|
||||
);
|
||||
(new Manager\UserToken())->removeTokens($this->user, UserTokenType::mfa);
|
||||
new Manager\UserToken()->removeTokens($this->user, UserTokenType::mfa);
|
||||
$this->flush();
|
||||
return $affected;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class Blog extends AbstractNotification {
|
||||
}
|
||||
|
||||
public function clear(): int {
|
||||
return (int)(new \Gazelle\WitnessTable\UserReadBlog())->witness($this->user);
|
||||
return (int)new \Gazelle\WitnessTable\UserReadBlog()->witness($this->user);
|
||||
}
|
||||
|
||||
public function load(): bool {
|
||||
@@ -17,7 +17,7 @@ class Blog extends AbstractNotification {
|
||||
if (is_null($latest)) {
|
||||
return false;
|
||||
}
|
||||
$lastRead = (new \Gazelle\WitnessTable\UserReadBlog())->lastRead($this->user);
|
||||
$lastRead = new \Gazelle\WitnessTable\UserReadBlog()->lastRead($this->user);
|
||||
|
||||
// You must be new around here.
|
||||
$newJoiner = is_null($lastRead) && $latest->createdEpoch() > strtotime($this->user->created());
|
||||
|
||||
@@ -17,13 +17,13 @@ class GlobalNotification extends AbstractNotification {
|
||||
self::$cache->cache_value(
|
||||
sprintf(self::CLEARED, $this->user->id),
|
||||
true,
|
||||
(new \Gazelle\Notification\GlobalNotification())->remaining()
|
||||
new \Gazelle\Notification\GlobalNotification()->remaining()
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function load(): bool {
|
||||
$alert = (new \Gazelle\Notification\GlobalNotification())->alert();
|
||||
$alert = new \Gazelle\Notification\GlobalNotification()->alert();
|
||||
if ($alert && self::$cache->get_value(sprintf(self::CLEARED, $this->user->id)) === false) {
|
||||
$this->title = $alert['title'];
|
||||
$this->url = $alert['url'];
|
||||
|
||||
@@ -8,10 +8,10 @@ class News extends AbstractNotification {
|
||||
}
|
||||
|
||||
public function clear(): int {
|
||||
if ((new \Gazelle\WitnessTable\UserReadNews())->witness($this->user)) {
|
||||
if (new \Gazelle\WitnessTable\UserReadNews()->witness($this->user)) {
|
||||
$this->user->flush();
|
||||
}
|
||||
return (new \Gazelle\Manager\News())->latestId();
|
||||
return new \Gazelle\Manager\News()->latestId();
|
||||
}
|
||||
|
||||
public function load(): bool {
|
||||
@@ -20,7 +20,7 @@ class News extends AbstractNotification {
|
||||
if ($newsId === -1) {
|
||||
return false;
|
||||
}
|
||||
$lastRead = (new \Gazelle\WitnessTable\UserReadNews())->lastRead($this->user);
|
||||
$lastRead = new \Gazelle\WitnessTable\UserReadNews()->lastRead($this->user);
|
||||
|
||||
// You must be new around here.
|
||||
$newJoiner = is_null($lastRead)
|
||||
|
||||
@@ -11,11 +11,11 @@ class Quote extends AbstractNotification {
|
||||
}
|
||||
|
||||
public function clear(): int {
|
||||
return (new UserQuote($this->user))->clearAll();
|
||||
return new UserQuote($this->user)->clearAll();
|
||||
}
|
||||
|
||||
public function load(): bool {
|
||||
$total = (new UserQuote($this->user))->unreadTotal();
|
||||
$total = new UserQuote($this->user)->unreadTotal();
|
||||
if ($total > 0) {
|
||||
$this->title = 'New quote' . plural($total);
|
||||
$this->url = 'userhistory.php?action=quote_notifications';
|
||||
@@ -55,7 +55,7 @@ class Quote extends AbstractNotification {
|
||||
$notifier = new \Gazelle\User\Notification($user);
|
||||
if ($notifier->isActive('Quote')) {
|
||||
++$quoted;
|
||||
(new UserQuote($user))->create($page, $pageId, $this->user, $postId);
|
||||
new UserQuote($user)->create($page, $pageId, $this->user, $postId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ class Subscription extends AbstractNotification {
|
||||
}
|
||||
|
||||
public function clear(): int {
|
||||
return (new \Gazelle\User\Subscription($this->user))->clear();
|
||||
return new \Gazelle\User\Subscription($this->user)->clear();
|
||||
}
|
||||
|
||||
public function load(): bool {
|
||||
$total = (new \Gazelle\User\Subscription($this->user))->unread();
|
||||
$total = new \Gazelle\User\Subscription($this->user)->unread();
|
||||
if ($total > 0) {
|
||||
$this->title = 'New subscription' . plural($total);
|
||||
$this->url = 'userhistory.php?action=subscriptions';
|
||||
|
||||
@@ -54,7 +54,7 @@ class Session extends \Gazelle\BaseUser {
|
||||
// do a cheap append to a delta table, and then reconsolidate to
|
||||
// the real table every once in a while via the scheduler.
|
||||
$this->user->refreshLastAccess();
|
||||
(new History($this->user))->registerSiteIp($ipaddr);
|
||||
new History($this->user)->registerSiteIp($ipaddr);
|
||||
|
||||
self::$db->prepared_query("
|
||||
UPDATE users_sessions SET
|
||||
|
||||
@@ -135,7 +135,7 @@ class Subscription extends \Gazelle\BaseUser {
|
||||
public function unread(): int {
|
||||
$unread = self::$cache->get_value('subscriptions_user_new_' . $this->user->id);
|
||||
if ($unread === false) {
|
||||
$unread = (new \Gazelle\Manager\Forum())->unreadSubscribedForumTotal($this->user) + $this->unreadCommentTotal();
|
||||
$unread = new \Gazelle\Manager\Forum()->unreadSubscribedForumTotal($this->user) + $this->unreadCommentTotal();
|
||||
self::$cache->cache_value('subscriptions_user_new_' . $this->user->id, $unread, 0);
|
||||
}
|
||||
return $unread;
|
||||
|
||||
@@ -118,7 +118,7 @@ class UserCreator extends Base {
|
||||
? UserStatus::enabled->value
|
||||
: UserStatus::unconfirmed->value,
|
||||
STARTING_INVITES,
|
||||
(new \Gazelle\Util\GeoIP(new \Gazelle\Util\Curl()))
|
||||
new \Gazelle\Util\GeoIP(new \Gazelle\Util\Curl())
|
||||
->countryISO($ipaddr),
|
||||
authKey()
|
||||
];
|
||||
@@ -199,7 +199,7 @@ class UserCreator extends Base {
|
||||
}
|
||||
|
||||
if ($inviter) {
|
||||
(new Manager\InviteSource())->resolveInviteSource($this->inviteKey, $user);
|
||||
new Manager\InviteSource()->resolveInviteSource($this->inviteKey, $user);
|
||||
$inviter->stats()->increment('invited_total');
|
||||
$user->externalProfile()->modifyProfile($inviterReason);
|
||||
self::$db->prepared_query("
|
||||
@@ -222,9 +222,9 @@ class UserCreator extends Base {
|
||||
|
||||
self::$db->commit();
|
||||
|
||||
(new Tracker())->addUser($user);
|
||||
new Tracker()->addUser($user);
|
||||
if ($this->note) {
|
||||
(new User\AuditTrail($user))->addEvent(
|
||||
new User\AuditTrail($user)->addEvent(
|
||||
UserAuditEvent::invite,
|
||||
implode("\n", $this->note)
|
||||
);
|
||||
|
||||
@@ -198,7 +198,7 @@ class Twig {
|
||||
if (is_null($user)) {
|
||||
return new \Twig\Markup('', 'UTF-8');
|
||||
}
|
||||
$icon = [(new \Gazelle\User\Donor($user))->heart($viewer)];
|
||||
$icon = [new \Gazelle\User\Donor($user)->heart($viewer)];
|
||||
if ($user->isWarned()) {
|
||||
$icon[] = '<a href="wiki.php?action=article&name=warnings"><img src="'
|
||||
. STATIC_SERVER . '/common/symbols/warned.png" alt="Warned" title="Warned'
|
||||
@@ -317,7 +317,7 @@ class Twig {
|
||||
'UTF-8'
|
||||
)));
|
||||
|
||||
$twig->addTest(new \Twig\TwigTest('donor', fn ($user) => !is_null($user) && $user::class === \Gazelle\User::class && (new \Gazelle\User\Donor($user))->isDonor()));
|
||||
$twig->addTest(new \Twig\TwigTest('donor', fn ($user) => !is_null($user) && $user::class === \Gazelle\User::class && new \Gazelle\User\Donor($user)->isDonor()));
|
||||
$twig->addTest(new \Twig\TwigTest('forum_thread', fn ($thread) => $thread instanceof \Gazelle\ForumThread));
|
||||
|
||||
$twig->addTest(new \Twig\TwigTest('nan', fn ($value) => is_nan($value)));
|
||||
|
||||
@@ -184,7 +184,7 @@ class Validator {
|
||||
break;
|
||||
}
|
||||
global $Viewer; // FIXME
|
||||
$banned = (new \Gazelle\Util\ImageProxy($Viewer))->badHost($ValidateVar);
|
||||
$banned = new \Gazelle\Util\ImageProxy($Viewer)->badHost($ValidateVar);
|
||||
if ($banned) {
|
||||
$this->errorMessage = "Please rehost images from " . html_escape($banned) . " elsewhere.";
|
||||
break;
|
||||
|
||||
10
app/View.php
10
app/View.php
@@ -58,7 +58,7 @@ class View extends Base {
|
||||
)
|
||||
);
|
||||
|
||||
$threshold = (new Manager\SiteOption())
|
||||
$threshold = new Manager\SiteOption()
|
||||
->findValueByName('download-warning-threshold');
|
||||
if ($threshold) {
|
||||
$activity->setStats((int)$threshold, new Stats\Torrent());
|
||||
@@ -71,7 +71,7 @@ class View extends Base {
|
||||
|
||||
$PageID = [$module, $_REQUEST['action'] ?? false, $_REQUEST['type'] ?? false];
|
||||
$navLinks = [];
|
||||
foreach ((new Manager\UserNavigation())->userControlList($user) as $n) {
|
||||
foreach (new Manager\UserNavigation()->userControlList($user) as $n) {
|
||||
[$ID, $Key, $Title, $Target, $Tests, $TestUser, $Mandatory] = array_values($n);
|
||||
if (str_contains($Tests, ':')) {
|
||||
$testList = [];
|
||||
@@ -96,7 +96,7 @@ class View extends Base {
|
||||
} elseif ($Key === 'subscriptions') {
|
||||
if (
|
||||
isset($alertList['Subscription'])
|
||||
&& (new User\Subscription($user))->unread()
|
||||
&& new User\Subscription($user)->unread()
|
||||
) {
|
||||
$extraClass[] = 'new-subscriptions';
|
||||
}
|
||||
@@ -191,7 +191,7 @@ class View extends Base {
|
||||
$launch = SITE_LAUNCH_YEAR . "-$launch";
|
||||
}
|
||||
|
||||
$alertList = (new User\Notification($user))
|
||||
$alertList = new User\Notification($user)
|
||||
->setDocument(
|
||||
$user->requestContext()->module(),
|
||||
$_REQUEST['action'] ?? ''
|
||||
@@ -210,7 +210,7 @@ class View extends Base {
|
||||
'db' => self::$db,
|
||||
'debug' => $Debug,
|
||||
'disclaimer' => $showDisclaimer,
|
||||
'last_active' => (new User\Session($user))->lastActive($SessionID),
|
||||
'last_active' => new User\Session($user)->lastActive($SessionID),
|
||||
'launch' => $launch,
|
||||
'load' => sys_getloadavg(),
|
||||
'notification' => $notification,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user