Skip to content

Commit

Permalink
prepare more for PHP 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Spine authored and itismadness committed Aug 15, 2021
1 parent 0926777 commit 6450a81
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion app/Forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ public function departmentList(User $user): array {
INNER JOIN forums origin USING (CategoryID)
LEFT JOIN forums_last_read_topics flrt ON (flrt.TopicID = ft.id AND flrt.UserID = ?)
WHERE origin.ID = ?
AND " . implode($cond, ' AND ') . "
AND " . implode(' AND ', $cond) . "
GROUP BY ft.ForumID
ORDER BY f.Sort
", $user->id(), $user->id(), $this->forumId, ...$args
Expand Down
1 change: 0 additions & 1 deletion app/Stats/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ public function geodistribution(): array {
}
}
}
reset($Rank);

for ($i = $CountryMin; $i <= $CountryMax; $i++) {
$LogIncrements[] = \Format::human_format(pow(2, $i));
Expand Down
4 changes: 2 additions & 2 deletions app/Top10/Torrent.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct (array $formats, $currentUser) {
}

public function getTopTorrents($getParameters, $details = 'all', $limit = 10) {
$cacheKey = 'top10_v2_' . $details . '_' . md5(implode($getParameters,'')) . '_' . $limit;
$cacheKey = 'top10_v2_' . $details . '_' . md5(implode('', $getParameters)) . '_' . $limit;
$topTorrents = $this->cache->get_value($cacheKey);

if ($topTorrents !== false) {
Expand Down Expand Up @@ -182,7 +182,7 @@ private function tagWhere($getParameters, $any = false) {

// This is to make the prepared query work.

$where = implode(array_fill(0, count($tags), "t.Name = ?"), ' OR ');
$where = implode(' OR ', array_fill(0, count($tags), "t.Name = ?"));
$clause = "
g.ID IN (
SELECT tt.GroupID
Expand Down
5 changes: 1 addition & 4 deletions classes/text.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -948,10 +948,7 @@ private static function to_html ($Array, $Rules) {
if (count($Attr) === 0) {
$Str .= self::to_html($Block['Val'], $Rules);
} else {
$Padding = implode(
" ",
array_map(function ($x) { return $x . "px"; }, $Attr)
);
$Padding = implode(' ', array_map(function ($x) { return $x . "px"; }, $Attr));
$Str .= "<span style='display: inline-block; padding: {$Padding}'>" . self::to_html($Block['Val'], $Rules).'</span>';
}
break;
Expand Down
3 changes: 1 addition & 2 deletions sections/collages/browse.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@

if (!empty($Tags)) {
$Where[] = '('
. implode(
$tagSearchAll ? ' AND ' : ' OR ',
. implode($tagSearchAll ? ' AND ' : ' OR ',
array_fill(0, count($Tags), "c.TagList LIKE concat('%', ?, '%')")
)
. ')';
Expand Down
71 changes: 38 additions & 33 deletions sections/user/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,77 +212,83 @@ function display_rank(Gazelle\UserRank $r, string $dimension) {
<div class="box box_info box_userinfo_percentile">
<div class="head colhead_dark">Percentile Rankings (hover for values)</div>
<ul class="stats nobullet">
<?php if (($Override = check_paranoia_here('uploaded'))) { ?>
<?php if (($Override = check_paranoia_here('uploaded'))) { ?>
<li class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>" title="<?=Format::get_size($stats['BytesUploaded'])?> uploaded">Data uploaded: <?= display_rank($rank, 'uploaded') ?></li>
<?php
}
if (($Override = check_paranoia_here('downloaded'))) { ?>
}
if (($Override = check_paranoia_here('downloaded'))) {
?>
<li class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>" title="<?=Format::get_size($stats['BytesDownloaded'])?> downloaded">Data downloaded: <?= display_rank($rank, 'downloaded') ?></li>
<?php
}
if (($Override = check_paranoia_here('uploads+'))) { ?>
}
if (($Override = check_paranoia_here('uploads+'))) {
?>
<li class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>" title="<?=number_format($Uploads)?> uploads">Torrents uploaded: <?= display_rank($rank, 'uploads') ?></li>
<?php
}
if (($Override = check_paranoia_here('requestsfilled_count'))) { ?>
}
if (($Override = check_paranoia_here('requestsfilled_count'))) {
?>
<li class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>" title="<?=number_format($RequestsFilled)?> filled">Requests filled: <?= display_rank($rank, 'requests') ?></li>
<?php
}
if (($Override = check_paranoia_here('requestsvoted_bounty'))) { ?>
}
if (($Override = check_paranoia_here('requestsvoted_bounty'))) {
?>
<li class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>" title="<?=Format::get_size($TotalSpent)?> spent">Request votes: <?= display_rank($rank, 'bounty') ?></li>
<?php } ?>
<li class="tooltip" title="<?=number_format($User->forumPosts())?> posts">Forum posts made: <?= display_rank($rank, 'posts') ?></li>
<?php
if (($Override = check_paranoia_here('torrentcomments++'))) { ?>
if (($Override = check_paranoia_here('torrentcomments++'))) {
?>
<li class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>" title="<?= number_format($torrentComments) ?> posted">Torrent comments: <?= display_rank($rank, 'comment-t') ?></li>
<?php
}
if (($Override = check_paranoia_here('collagecontribs+'))) { ?>
}
if (($Override = check_paranoia_here('collagecontribs+'))) {
?>
<li class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>" title="<?=number_format($collageAdditions)?> contributions">Collage contributions: <?= display_rank($rank, 'collage') ?></li>
<?php }
if (($Override = check_paranoia_here('artistsadded'))) { ?>
<?php
}
if (($Override = check_paranoia_here('artistsadded'))) {
?>
<li class="tooltip<?=($Override === 2 ? ' paranoia_override' : '')?>" title="<?=number_format($ArtistsAdded)?> added">Artists added: <?= display_rank($rank, 'artists') ?></li>
<?php } ?>
<li class="tooltip" title="<?=number_format($releaseVotes)?> votes">Release votes cast: <?= display_rank($rank, 'votes') ?></li>
<?php
if ($OwnProfile || check_perms('admin_bp_history')) { ?>
<?php if ($OwnProfile || check_perms('admin_bp_history')) { ?>
<li class="tooltip<?= !$OwnProfile && check_perms('admin_bp_history') ? ' paranoia_override' : '' ?>" title="<?=number_format($bonusPointsSpent)?> spent">Bonus points spent: <?= display_rank($rank, 'bonus') ?></li>
<?php
}
if (check_paranoia_here(['artistsadded', 'collagecontribs+', 'downloaded', 'requestsfilled_count', 'requestsvoted_bounty', 'torrentcomments++', 'uploaded', 'uploads+', ])) { ?>
}
if (check_paranoia_here(['artistsadded', 'collagecontribs+', 'downloaded', 'requestsfilled_count', 'requestsvoted_bounty', 'torrentcomments++', 'uploaded', 'uploads+', ])) {
?>
<li<?= $User->classLevel() >= 900 ? ' title="Infinite"' : '' ?>><strong>Overall rank: <?= $rank->score() === false ? 'Server busy'
: $User->classLevel() >= 900 ? '&nbsp;&infin;' : number_format($rank->score() * $User->rankFactor()) ?></strong></li>
<?php } ?>
: ($User->classLevel() >= 900 ? '&nbsp;&infin;' : number_format($rank->score() * $User->rankFactor())) ?></strong></li>
<?php } ?>
</ul>
</div>
<?php
if (check_perms('users_mod') || check_perms('users_view_ips') || check_perms('users_view_keys')) {
?>
<?php if (check_perms('users_mod') || check_perms('users_view_ips') || check_perms('users_view_keys')) { ?>
<div class="box box_info box_userinfo_history">
<div class="head colhead_dark">History</div>
<ul class="stats nobullet">
<?php if (check_perms('users_view_email')) { ?>
<?php if (check_perms('users_view_email')) { ?>
<li>Emails: <?=number_format($User->emailCount())?> <a href="userhistory.php?action=email&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<?php
}
if (check_perms('users_view_ips')) {
}
if (check_perms('users_view_ips')) {
?>
<li>IPs: <?=number_format($User->siteIPCount())?> <a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" class="brackets">View</a>&nbsp;<a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>&amp;usersonly=1" class="brackets">View users</a></li>
<?php if (check_perms('users_view_ips') && check_perms('users_mod')) { ?>
<?php if (check_perms('users_view_ips') && check_perms('users_mod')) { ?>
<li>Tracker IPs: <?=number_format($User->trackerIPCount())?> <a href="userhistory.php?action=tracker_ips&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<?php
}
}
if (check_perms('users_view_keys')) {
}
if (check_perms('users_view_keys')) {
?>
<li>Announce keys: <?=number_format($User->announceKeyCount())?> <a href="userhistory.php?action=passkeys&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<?php
}
if (check_perms('users_mod')) {
}
if (check_perms('users_mod')) {
?>
<li>Password history: <?=number_format($User->passwordCount())?> <a href="userhistory.php?action=passwords&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<li>Stats: N/A <a href="userhistory.php?action=stats&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<?php } ?>
<?php } ?>
</ul>
</div>
<?php } ?>
Expand Down Expand Up @@ -853,5 +859,4 @@ function display_rank(Gazelle\UserRank $r, string $dimension) {
</div>
</div>
<?php

View::show_footer();

0 comments on commit 6450a81

Please sign in to comment.