Skip to content

Commit

Permalink
remove useless SITE_URL and allow relative (e.g. [url=wiki.php]) urls…
Browse files Browse the repository at this point in the history
… in bbcode
  • Loading branch information
Spine authored and itismadness committed Aug 15, 2021
1 parent 411f6bc commit 78863ea
Show file tree
Hide file tree
Showing 38 changed files with 76 additions and 96 deletions.
2 changes: 1 addition & 1 deletion app/Applicant.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function saveNote($posterId, $body, $visibility) {
, (new User($this->userId()))->username()
, (new User($posterId))->username()
, $this->roleTitle()
, SITE_URL . '/apply.php?action=view&id=' . $this->id()
, 'apply.php?action=view&id=' . $this->id()
, SITE_NAME
)
);
Expand Down
1 change: 0 additions & 1 deletion app/Bonus.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ public function sendPmToOther($fromID, $toID, $amount) {
'FROM' => (new User($fromID))->username(),
'AMOUNT' => $amount,
'PLURAL' => plural($amount),
'SITE_URL' => SITE_URL,
'WIKI_ID' => 57,
])
);
Expand Down
12 changes: 6 additions & 6 deletions app/Manager/Donation.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ protected function calculateSpecialRank(\Gazelle\User $user, int $TotalRank) {
$userMan->sendPM($UserID, 0,
"You have Reached Special Donor Rank #1! You've Earned: One User Pick. Details Inside.",
$this->twig->render('donation/special-rank-1.twig', [
'forum_url' => SITE_URL . '/forums.php?action=viewthread&threadid=178640&postid=4839790#post4839790',
'staffpm_url' => SITE_URL . '/staffpm.php',
'forum_url' => 'forums.php?action=viewthread&threadid=178640&postid=4839790#post4839790',
'staffpm_url' => 'staffpm.php',
])
);
$SpecialRank = 1;
Expand All @@ -187,7 +187,7 @@ protected function calculateSpecialRank(\Gazelle\User $user, int $TotalRank) {
$userMan->sendPM($UserID, 0,
"You have Reached Special Donor Rank #2! You've Earned: The Double-Avatar. Details Inside.",
$this->twig->render('donation/special-rank-2.twig', [
'forum_url' => SITE_URL . '/forums.php?action=viewthread&threadid=178640&postid=4839790#post4839790',
'forum_url' => 'forums.php?action=viewthread&threadid=178640&postid=4839790#post4839790',
])
);
$SpecialRank = 2;
Expand All @@ -197,8 +197,8 @@ protected function calculateSpecialRank(\Gazelle\User $user, int $TotalRank) {
$userMan->sendPM($UserID, 0,
"You have Reached Special Donor Rank #3! You've Earned: Diamond Rank. Details Inside.",
$this->twig->render('donation/special-rank-3.twig', [
'forum_url' => SITE_URL . '/forums.php?action=viewthread&threadid=178640&postid=4839790#post4839790',
'forum_gold_url' => SITE_URL . '/forums.php?action=viewthread&threadid=178640&postid=4839789#post4839789',
'forum_url' => 'forums.php?action=viewthread&threadid=178640&postid=4839790#post4839790',
'forum_gold_url' => 'forums.php?action=viewthread&threadid=178640&postid=4839789#post4839789',
])
);
$SpecialRank = 3;
Expand Down Expand Up @@ -272,7 +272,7 @@ protected function messageBody(string $Source, string $Currency, string $amount,
'points' => $ReceivedRank,
's' => plural($ReceivedRank),
'rank' => $CurrentRank,
'staffpm_url' => SITE_URL . '/staffpm.php',
'staffpm_url' => 'staffpm.php',
]);
}

Expand Down
10 changes: 5 additions & 5 deletions app/Manager/ReportV2Types.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
'upload' => '0',
'warn' => '4',
'delete' => '1',
'pm' => '[rule]h1.2[/rule]. You have uploaded material that is currently forbidden. Items on the Do Not Upload (DNU) list (at the top of the [url='.SITE_URL.'/upload.php]upload page[/url]) and in the [url='.SITE_URL.'/rules.php?p=upload#h1.2]Specifically Banned[/url] portion of the uploading rules cannot be uploaded to the site. Do not upload them unless your torrent meets a condition specified in the comments of the DNU list.
'pm' => '[rule]h1.2[/rule]. You have uploaded material that is currently forbidden. Items on the Do Not Upload (DNU) list (at the top of the [url=upload.php]upload page[/url]) and in the [url=rules.php?p=upload#h1.2]Specifically Banned[/url] portion of the uploading rules cannot be uploaded to the site. Do not upload them unless your torrent meets a condition specified in the comments of the DNU list.
Your torrent was reported because it contained material from the DNU list or from the Specifically Banned section of the rules.'
]
],
Expand Down Expand Up @@ -381,7 +381,7 @@
'warn' => '0',
'delete' => '0',
'pm' => "[rule]2.3.16[/rule]. Properly tag your music files.
The Uploading Rules require that all uploads be properly tagged. Your torrent has been marked as having bad tags. It is now listed on [url=".SITE_URL."/better.php]better.php[/url] and is eligible for trumping. You are of course free to fix this torrent yourself. Add or fix the required tags and upload the replacement torrent to the site. Then, report (RP) the older torrent using the category \"Tag Trump\" and indicate in the report comments that you have fixed the tags. Be sure to provide a link (PL) to the new replacement torrent."
The Uploading Rules require that all uploads be properly tagged. Your torrent has been marked as having bad tags. It is now listed on [url=better.php]better.php[/url] and is eligible for trumping. You are of course free to fix this torrent yourself. Add or fix the required tags and upload the replacement torrent to the site. Then, report (RP) the older torrent using the category \"Tag Trump\" and indicate in the report comments that you have fixed the tags. Be sure to provide a link (PL) to the new replacement torrent."
]
],
'folders_bad' => [
Expand All @@ -398,7 +398,7 @@
'warn' => '0',
'delete' => '0',
'pm' => "[rule]2.3.2[/rule]. Name your directories with meaningful titles, such as \"Artist - Album (Year) - Format\".
The Uploading Rules require that all uploads contain torrent directories with meaningful names. Your torrent has been marked as having a poorly named torrent directory. It is now listed on [url=".SITE_URL."/better.php]better.php[/url] and is eligible for trumping. You are of course free to fix this torrent yourself. Add or fix the folder/directory name(s) and upload the replacement torrent to the site. Then, report (RP) the older torrent using the category \"Folder Trump\" and indicate in the report comments that you have fixed the directory name(s). Be sure to provide a link (PL) to the new replacement torrent."
The Uploading Rules require that all uploads contain torrent directories with meaningful names. Your torrent has been marked as having a poorly named torrent directory. It is now listed on [url=better.php]better.php[/url] and is eligible for trumping. You are of course free to fix this torrent yourself. Add or fix the folder/directory name(s) and upload the replacement torrent to the site. Then, report (RP) the older torrent using the category \"Folder Trump\" and indicate in the report comments that you have fixed the directory name(s). Be sure to provide a link (PL) to the new replacement torrent."
]
],
'wrong_format' => [
Expand Down Expand Up @@ -636,7 +636,7 @@
'pm' => '[rule]2.3.11[/rule]. File names must accurately reflect the song titles. You may not have file names like 01track.mp3, 02track.mp3, etc. Torrents containing files that are named with incorrect song titles can be trumped by properly labeled torrents. Also, torrents that are sourced from the scene but do not have the "Scene" label must comply with site naming rules (no release group names in the file names, no advertisements in the file names, etc.). If all the letters in the track titles are capitalized, the torrent is trumpable.
[rule]2.3.13[/rule]. Track numbers are required in file names (e.g., "01 - TrackName.mp3"). If a torrent without track numbers in the file names is uploaded, then a torrent with the track numbers in the file names can take its place. When formatted properly, file names will sort in order by track number or playing order. Also see [rule]2.3.14[/rule].
The Uploading Rules require that all uploads contain audio tracks with accurate file names. Your torrent has been marked as having incorrect or incomplete file names. It is now listed on [url='.SITE_URL.'/better.php]better.php[/url] and is eligible for trumping. You are of course free to fix this torrent yourself. Add or fix the file names and upload the replacement torrent to the site. Then, report (RP) the older torrent using the category "Bad File Names Trump" and indicate in the report comments that you have fixed the file names. Be sure to provide a permalink (PL) to the new replacement torrent.'
The Uploading Rules require that all uploads contain audio tracks with accurate file names. Your torrent has been marked as having incorrect or incomplete file names. It is now listed on [url=better.php]better.php[/url] and is eligible for trumping. You are of course free to fix this torrent yourself. Add or fix the file names and upload the replacement torrent to the site. Then, report (RP) the older torrent using the category "Bad File Names Trump" and indicate in the report comments that you have fixed the file names. Be sure to provide a permalink (PL) to the new replacement torrent.'
]
],
'skips' => [
Expand Down Expand Up @@ -673,7 +673,7 @@
'upload' => '0',
'warn' => '0',
'delete' => '0',
'pm' => '[rule]2.2.10.3[/rule]. A FLAC upload with an EAC or XLD rip log that scores 100% on the log checker replaces one with a lower score... . Note: A FLAC upload with a log that scores 95% for not defeating the audio cache may be rescored to 100% following the procedure outlined in [url='.SITE_URL.'/wiki.php?action=article&id=79]this wiki[/url].
'pm' => '[rule]2.2.10.3[/rule]. A FLAC upload with an EAC or XLD rip log that scores 100% on the log checker replaces one with a lower score... . Note: A FLAC upload with a log that scores 95% for not defeating the audio cache may be rescored to 100% following the procedure outlined in [url=wiki.php?action=article&id=79]this wiki[/url].
[rule]2.2.10.5[/rule]. XLD and EAC logs in languages other than English require a manual log checker score adjustment by staff.
[rule]2.2.10.6.2[/rule]. If you created a CD range rip that has matching CRCs for test and copy, and where every track has an AccurateRip score of 2 or more, then you may submit your torrent for manual score adjustment.
[rule]2.2.10.9.2[/rule]. If you find that an appended log has not been scored properly, please report the torrent and use the log rescore option.
Expand Down
6 changes: 3 additions & 3 deletions app/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function refundBounty(int $userId, string $staffName) {
$this->informRequestFillerReduction($bounty, $staffName);
$message = sprintf("%s Refund of %s bounty (%s b) on %s by %s\n\n",
sqltime(), \Format::get_size($bounty), $bounty,
SITE_URL . '/requests.php?action=view&id=' . $this->id, $staffName
'requests.php?action=view&id=' . $this->id, $staffName
);
$this->db->prepared_query("
UPDATE users_info ui
Expand Down Expand Up @@ -99,7 +99,7 @@ public function removeBounty(int $userId, string $staffName) {
$this->informRequestFillerReduction($bounty, $staffName);
$message = sprintf("%s Removal of %s bounty (%s b) on %s by %s\n\n",
sqltime(), \Format::get_size($bounty), $bounty,
SITE_URL . '/requests.php?action=view&id=' . $this->id, $staffName
'requests.php?action=view&id=' . $this->id, $staffName
);
$this->db->prepared_query("
UPDATE users_info ui SET
Expand All @@ -126,7 +126,7 @@ public function informRequestFillerReduction(int $bounty, string $staffName) {
if (!$fillerId) {
return;
}
$requestUrl = SITE_URL . '/requests.php?action=view&id=' . $this->id;
$requestUrl = 'requests.php?action=view&id=' . $this->id;
$message = sprintf("%s Reduction of %s bounty (%s b) on filled request %s by %s\n\n",
sqltime(), \Format::get_size($bounty), $bounty, $requestUrl, $staffName
);
Expand Down
2 changes: 1 addition & 1 deletion app/Schedule/Tasks/DemoteUsersRatio.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private function demote(int $newClass, float $ratio, int $upload, array $demoteC
"You have been demoted to $classString",
"You now only meet the requirements for the \"$classString\" user class.\n\nTo read more about "
. SITE_NAME
. "'s user classes, read [url=".SITE_URL."/wiki.php?action=article&name=userclasses]this wiki article[/url]."
. "'s user classes, read [url=wiki.php?action=article&name=userclasses]this wiki article[/url]."
);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Schedule/Tasks/DisableLeechingRatioWatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function run()
if (count($users) > 0) {
$userMan = new \Gazelle\Manager\User;
$subject = 'Leeching Disabled';
$message = 'You have downloaded more than 10 GB while on Ratio Watch. Your leeching privileges have been disabled. Please reread the rules and refer to this guide on how to improve your ratio ' . SITE_URL . '/wiki.php?action=article&name=ratiotips';
$message = 'You have downloaded more than 10 GB while on Ratio Watch. Your leeching privileges have been disabled. Please reread the rules and refer to this guide on [url=wiki.php?action=article&name=ratiotips]how to improve your ratio[/url]';
$tracker = new \Gazelle\Tracker;
foreach ($users as $torrentPass => $userID) {
$userMan->sendPM($userID, 0, $subject, $message);
Expand Down
4 changes: 2 additions & 2 deletions app/Schedule/Tasks/NotifyNonseedingUploaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function run()
$name .= " [$format / $encoding]";
}

$torrentAlerts[$userID]['Msg'] .= "\n[url=".SITE_URL."/torrents.php?torrentid=$id]".$name."[/url]";
$torrentAlerts[$userID]['Msg'] .= "\n[url=torrents.php?torrentid=$id]".$name."[/url]";
$torrentAlerts[$userID]['Count']++;

$this->processed++;
Expand All @@ -60,7 +60,7 @@ public function run()
foreach ($torrentAlerts as $userID => $messageInfo) {
$userMan->sendPM($userID, 0,
'Unseeded torrent notification',
$messageInfo['Count'] . " of your uploads will be deleted for inactivity soon. Unseeded torrents are deleted after 4 weeks. If you still have the files, you can seed your uploads by ensuring the torrents are in your client and that they aren't stopped. You can view the time that a torrent has been unseeded by clicking on the torrent description line and looking for the \"Last active\" time. For more information, please go [url=".SITE_URL."/wiki.php?action=article&id=77]here[/url].\n\nThe following torrent".plural($messageInfo['Count']).' will be removed for inactivity:'.$messageInfo['Msg']."\n\nIf you no longer wish to receive these notifications, please disable them in your profile settings."
$messageInfo['Count'] . " of your uploads will be deleted for inactivity soon. Unseeded torrents are deleted after 4 weeks. If you still have the files, you can seed your uploads by ensuring the torrents are in your client and that they aren't stopped. You can view the time that a torrent has been unseeded by clicking on the torrent description line and looking for the \"Last active\" time. For more information, please go [url=wiki.php?action=article&id=77]here[/url].\n\nThe following torrent".plural($messageInfo['Count']).' will be removed for inactivity:'.$messageInfo['Msg']."\n\nIf you no longer wish to receive these notifications, please disable them in your profile settings."
);
$this->debug("Warning user $userID about ${messageInfo['Count']} torrents", $userID);
}
Expand Down
10 changes: 3 additions & 7 deletions app/Schedule/Tasks/RatioWatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ public function run()
$this->cache->deleteMulti(["u_$userID", "user_info_heavy_$userID"]);
$userMan->sendPM($userID, 0,
'You have been taken off Ratio Watch',
"Congratulations! Feel free to begin downloading again.\n To ensure that you do not get put on ratio watch again, please read the rules located [url="
. SITE_URL."/rules.php?p=ratio]here[/url].\n"
"Congratulations! Feel free to begin downloading again.\n To ensure that you do not get put on ratio watch again, please read the rules located [url=rules.php?p=ratio]here[/url].\n"
);

$this->processed++;
Expand Down Expand Up @@ -83,11 +82,8 @@ public function run()
$this->cache->deleteMulti(["u_$userID", "user_info_heavy_$userID"]);
$userMan->sendPM($userID, 0,
'You have been put on Ratio Watch',
"This happens when your ratio falls below the requirements outlined in the rules located [url="
. SITE_URL
. "/rules.php?p=ratio]here[/url].\n For information about ratio watch, click the link above."
);

"This happens when your ratio falls below the requirements outlined in the rules located [url=rules.php?p=ratio]here[/url].\n For information about ratio watch, click the link above."
);
$this->processed++;
$this->debug("Putting $userID on ratio watch", $userID);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Torrent/Reaper.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function deleteDeadTorrents(bool $unseeded, bool $neverSeeded) {
$deleteNotes[$userID] = ['Count' => 0, 'Msg' => ''];
}

$deleteNotes[$userID]['Msg'] .= sprintf("\n[url=%s/torrents.php?id=%s]%s[/url]", SITE_URL, $group['ID'], $name);
$deleteNotes[$userID]['Msg'] .= sprintf("\n[url=torrents.php?id=%s]%s[/url]", $group['ID'], $name);
$deleteNotes[$userID]['Count']++;

++$i;
Expand Down
18 changes: 5 additions & 13 deletions classes/text.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1011,18 +1011,10 @@ private static function to_html ($Array, $Rules) {
}

if (!self::valid_url($Block['Attr'])) {
if (!self::relative_url($Block['Attr'])) {
$Str .= '[url=' . $Block['Attr'] . ']' . $Block['Val'] . '[/url]';
if (self::relative_url($Block['Attr'])) {
$Str .= '<a href="' . $Block['Attr'] . '">' . $Block['Val'] . '</a>';
} else {
if (substr($Block['Val'], 0, 1) != '/') {
$Block['Val'] = '/' . $Block['Val'];
}
$url = self::resolve_url(SITE_URL . $Block['Val']);
if ($url) {
$Str .= $url;
} else {
$Str .= '[url=' . $Block['Attr'] . ']' . $Block['Val'] . '[/url]';
}
$Str .= '[url=' . $Block['Attr'] . ']' . $Block['Val'] . '[/url]';
}
} else {
$LocalURL = self::local_url($Block['Attr']);
Expand Down Expand Up @@ -1411,7 +1403,7 @@ protected static function bbcodeForumUrl($val) {
$name = 'restricted';
}
return $name
? sprintf('<a href="forums.php?action=viewforum&forumid=%d">%s</a>', $id, $name)
? sprintf('<a href="forums.php?action=viewforum&amp;forumid=%d">%s</a>', $id, $name)
: '[forum]' . $val . '[/forum]';
}

Expand Down Expand Up @@ -1444,7 +1436,7 @@ protected static function bbcodeThreadUrl($thread, $post = null) {
self::$viewer = new Gazelle\User($LoggedUser['ID']);
}
if (!self::$viewer->readAccess(new Gazelle\Forum($forumId))) {
return sprintf('<a href="forums.php?action=viewforum&forumid=%d">%s</a>', $id, 'restricted');
return sprintf('<a href="forums.php?action=viewforum&amp;forumid=%d">%s</a>', $id, 'restricted');
}

if ($post) {
Expand Down
Loading

0 comments on commit 78863ea

Please sign in to comment.