mirror of
https://github.com/BillyOutlast/Gazelle-Porn.git
synced 2026-07-01 06:41:50 -04:00
sync: 2024-12-15 20:04:04 +0000
This commit is contained in:
@@ -121,6 +121,7 @@ source requests_base : connect {
|
||||
sql_attr_uint = Visible
|
||||
sql_attr_uint = Votes
|
||||
sql_attr_uint = Bounty
|
||||
sql_attr_uint = RequestType
|
||||
}
|
||||
source requests : requests_base {
|
||||
sql_query_pre = TRUNCATE TABLE sphinx_requests
|
||||
@@ -131,14 +132,14 @@ source requests : requests_base {
|
||||
ID, UserID, TimeAdded, LastVote, CategoryID, Title, \
|
||||
Year, ReleaseType, \
|
||||
CodecList, SourceList, ContainerList, ResolutionList, FillerID, \
|
||||
TorrentID, TimeFilled, Visible, Votes, Bounty ) \
|
||||
TorrentID, TimeFilled, Visible, Votes, Bounty, RequestType ) \
|
||||
SELECT \
|
||||
r.ID, r.UserID, UNIX_TIMESTAMP(TimeAdded), \
|
||||
UNIX_TIMESTAMP(LastVote), CategoryID, Title, Year, \
|
||||
ReleaseType, \
|
||||
CodecList, SourceList, ContainerList, ResolutionList, FillerID, TorrentID, \
|
||||
UNIX_TIMESTAMP(TimeFilled), Visible, \
|
||||
COUNT(rv.RequestID), SUM(rv.Bounty) >> 20 \
|
||||
COUNT(rv.RequestID), SUM(rv.Bounty) >> 20, RequestType \
|
||||
FROM requests AS r \
|
||||
JOIN requests_votes AS rv ON rv.RequestID = r.ID \
|
||||
GROUP BY rv.RequestID
|
||||
@@ -155,7 +156,7 @@ source requests : requests_base {
|
||||
ON DUPLICATE KEY UPDATE ArtistList = VALUES(ArtistList)
|
||||
sql_query = SELECT ID, UserID, TimeAdded, LastVote, CategoryID, Title, \
|
||||
Year, ArtistList, ReleaseType, CodecList, SourceList, ContainerList, ResolutionList, FillerID, \
|
||||
TorrentID, TimeFilled, Visible, Votes, Bounty, \
|
||||
TorrentID, TimeFilled, Visible, Votes, Bounty, RequestType, \
|
||||
Year AS YearFullText \
|
||||
FROM sphinx_requests
|
||||
sql_joined_field = taglist from query; \
|
||||
@@ -173,7 +174,7 @@ source requests : requests_base {
|
||||
source requests_delta : requests_base {
|
||||
sql_query = SELECT ID, UserID, TimeAdded, LastVote, CategoryID, Title, TagList, \
|
||||
Year, ArtistList, ReleaseType, CodecList, SourceList, ContainerList, ResolutionList, FillerID, \
|
||||
TorrentID, TimeFilled, Visible, Votes, Bounty, \
|
||||
TorrentID, TimeFilled, Visible, Votes, Bounty, RequestType, \
|
||||
Year AS YearFullText \
|
||||
FROM sphinx_requests_delta
|
||||
sql_query_killlist = SELECT ID FROM sphinx_requests_delta
|
||||
|
||||
Vendored
+3
-1
@@ -20,5 +20,7 @@
|
||||
},
|
||||
"intelephense.format.braces": "k&r",
|
||||
"formatFiles.excludedFolders": ["node_modules", ".vscode", ".git", "dist", ".chrome", "vendor"],
|
||||
"editor.detectIndentation": false
|
||||
"editor.detectIndentation": false,
|
||||
"intelephense.environment.phpVersion": "7.4",
|
||||
"makefile.configureOnOpen": false
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?
|
||||
|
||||
namespace Gazelle\Action;
|
||||
|
||||
class BasicReward {
|
||||
public static function getReward($action): RewardInfo {
|
||||
$rewardInfo = new RewardInfo;
|
||||
global $BaseRewardConfig;
|
||||
$config = $BaseRewardConfig[$action];
|
||||
$rewardInfo->tokenCount = !empty($config['token']) ? $config['token'] : 0;
|
||||
if (!empty($config['token_valid_day']) && $config['token_valid_day'] > 0) {
|
||||
$rewardInfo->tokenExpireTime = add_day(date('Y-m-d'), $config['token_valid_day']);
|
||||
}
|
||||
$rewardInfo->inviteCount = !empty($config['invite']) ? $config['invite'] : 0;
|
||||
if (!empty($config['invite_valid_day']) && $config['invite_valid_day'] > 0) {
|
||||
$rewardInfo->invteExpireTime = add_day(date('Y-m-d'), $config['invite_valid_day']);
|
||||
}
|
||||
$rewardInfo->bonus = !empty($config['bonus']) ? $config['bonus'] : 0;
|
||||
$rewardInfo->badgeID = !empty($config['badge_id']) ? $config['badge_id'] : 0;
|
||||
return $rewardInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?
|
||||
|
||||
namespace Gazelle\Action;
|
||||
|
||||
class RewardInfo {
|
||||
public int $tokenCount = 0;
|
||||
public $tokenExpireTime;
|
||||
|
||||
public int $inviteCount = 0;
|
||||
public $invteExpireTime;
|
||||
|
||||
public int $bonus = 0;
|
||||
|
||||
public int $badgeID = 0;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?
|
||||
|
||||
namespace Gazelle\Action;
|
||||
|
||||
abstract class UserActionEnum {
|
||||
const UploadTorrent = "upload_torrent";
|
||||
const CheckTorrent = "check_torrent";
|
||||
const Report = "report_torrent";
|
||||
const CreateRequest = "create_request";
|
||||
const FillRequest = "fill_request";
|
||||
const CreateCollage = "create_collage";
|
||||
const FillCollage = "fill_collage";
|
||||
const EditMovie = "edit_movie";
|
||||
const EditArtist = "edit_artist";
|
||||
const PostComment = "post_comment";
|
||||
const CreateTopic = "create_topic";
|
||||
const InviteFriend = "invite_friend"; // need register success
|
||||
}
|
||||
+21
-13
@@ -3,13 +3,13 @@
|
||||
namespace Gazelle;
|
||||
|
||||
abstract class BaseObject extends Base {
|
||||
protected $id;
|
||||
|
||||
protected int $id;
|
||||
|
||||
/* used for handling updates */
|
||||
protected $updateField = [];
|
||||
protected array $updateField = [];
|
||||
|
||||
public function __construct(int $id) {
|
||||
parent::__construct();
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
@@ -20,27 +20,35 @@ abstract class BaseObject extends Base {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function dirty(): bool {
|
||||
return !empty($this->updateField);
|
||||
}
|
||||
|
||||
public function setUpdate(string $field, $value) {
|
||||
$this->updateField[$field] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function field(string $field) {
|
||||
return $this->updateField[$field] ?? null;
|
||||
}
|
||||
|
||||
public function modify(): bool {
|
||||
if (!$this->updateField) {
|
||||
if (!$this->dirty()) {
|
||||
return false;
|
||||
}
|
||||
$set = implode(', ', array_map(function ($f) {
|
||||
return "$f = ?";
|
||||
}, array_keys($this->updateField)));
|
||||
$args = array_values($this->updateField);
|
||||
$set = implode(', ', array_merge(
|
||||
array_map(fn ($f) => "$f = ?", array_keys($this->updateField))
|
||||
));
|
||||
$args = array_merge(
|
||||
array_values($this->updateField),
|
||||
);
|
||||
$args[] = $this->id;
|
||||
$this->db->prepared_query(
|
||||
"UPDATE " . $this->tableName() . " SET
|
||||
$set WHERE ID = ?
|
||||
",
|
||||
self::$db->prepared_query(
|
||||
"UPDATE " . $this->tableName() . " SET $set WHERE ID = ?",
|
||||
...$args
|
||||
);
|
||||
$success = ($this->db->affected_rows() === 1);
|
||||
$success = (self::$db->affected_rows() === 1);
|
||||
if ($success) {
|
||||
$this->flush();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Gazelle\Manager;
|
||||
|
||||
use Gazelle\Action\BasicReward;
|
||||
use Gazelle\Action\UserActionEnum;
|
||||
|
||||
class ActionTrigger extends \Gazelle\Base {
|
||||
private Reward $rewardManager;
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->rewardManager = new Reward;
|
||||
}
|
||||
public function triggerUpload(int $GroupID, int $TorrentID) {
|
||||
$reward = BasicReward::getReward(UserActionEnum::UploadTorrent);
|
||||
$this->rewardManager->sendReward($reward, [$this->user['ID']], "Basic reward for uploading torrent($TorrentID).", false, true);
|
||||
}
|
||||
|
||||
public function triggerTorrentCheck(int $TorrentID) {
|
||||
$reward = BasicReward::getReward(UserActionEnum::CheckTorrent);
|
||||
$this->rewardManager->sendReward($reward, [$this->user['ID']], "Basic reward for checking torrent($TorrentID).", false, true);
|
||||
}
|
||||
|
||||
public function triggerMovieEdit(int $GroupID) {
|
||||
$reward = BasicReward::getReward(UserActionEnum::EditMovie);
|
||||
$this->rewardManager->sendReward($reward, [$this->user['ID']], "Basic reward for editing movie($GroupID) info.", false, true);
|
||||
}
|
||||
|
||||
public function triggerArtistEdit(int $ArtistID) {
|
||||
$reward = BasicReward::getReward(UserActionEnum::EditArtist);
|
||||
$this->rewardManager->sendReward($reward, [$this->user['ID']], "Basic reward for editing Artist($ArtistID) info.", false, true);
|
||||
}
|
||||
|
||||
public function triggerNewRequest(int $RequestID, int $TorrentID) {
|
||||
$reward = BasicReward::getReward(UserActionEnum::CreateRequest);
|
||||
$this->rewardManager->sendReward($reward, [$this->user['ID']], "Basic reward for Requesting($RequestID) Torrent.", false, true);
|
||||
}
|
||||
|
||||
public function triggerFillRequest(int $RequestID, int $TorrentID) {
|
||||
$reward = BasicReward::getReward(UserActionEnum::FillRequest);
|
||||
$this->rewardManager->sendReward($reward, [$this->user['ID']], "Basic reward for Filling Request($RequestID) by Torrent($TorrentID).", false, true);
|
||||
}
|
||||
|
||||
public function triggerCreateCollage(int $CollageID) {
|
||||
$reward = BasicReward::getReward(UserActionEnum::CreateCollage);
|
||||
$this->rewardManager->sendReward($reward, [$this->user['ID']], "Basic reward for Creating Collage($CollageID).", false, true);
|
||||
}
|
||||
|
||||
public function triggerFillCollage(int $CollageID, $GroupID) {
|
||||
$reward = BasicReward::getReward(UserActionEnum::FillCollage);
|
||||
$this->rewardManager->sendReward($reward, [$this->user['ID']], "Basic reward for Adding Movie($GroupID) to Collage($CollageID).", false, true);
|
||||
}
|
||||
|
||||
public function triggerPostComment(int $PostID) {
|
||||
$reward = BasicReward::getReward(UserActionEnum::PostComment);
|
||||
$this->rewardManager->sendReward($reward, [$this->user['ID']], "Basic reward for Posting($PostID) Comment.", false, true);
|
||||
}
|
||||
|
||||
public function triggerCreateTopic(int $TopicID) {
|
||||
$reward = BasicReward::getReward(UserActionEnum::CreateTopic);
|
||||
$this->rewardManager->sendReward($reward, [$this->user['ID']], "Basic reward for Create Topic($TopicID).", false, true);
|
||||
}
|
||||
|
||||
public function triggerInviteeRegister(int $Inviter) {
|
||||
$reward = BasicReward::getReward(UserActionEnum::InviteFriend);
|
||||
$this->rewardManager->sendReward($reward, [$Inviter], "Basic reward for invite user($this->user['ID']).", false, true);
|
||||
}
|
||||
|
||||
public function triggerReport(int $Type, int $ID, $ReportID) {
|
||||
$reward = BasicReward::getReward(UserActionEnum::Report);
|
||||
$this->rewardManager->sendReward($reward, [$this->user['ID']], "Basic reward for report($ReportID) $Type($ID).", false, true);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace Gazelle\Manager;
|
||||
use Misc;
|
||||
use Lang;
|
||||
use DB_MYSQL_DuplicateKeyException;
|
||||
use Gazelle\Action\RewardInfo;
|
||||
|
||||
class DonationSource {
|
||||
const PrepaidCard = "Prepaid Card";
|
||||
@@ -25,6 +26,7 @@ class DonationCurrency {
|
||||
const BTC = "BTC";
|
||||
}
|
||||
class Donation extends \Gazelle\Base {
|
||||
private Reward $rewardManager;
|
||||
private static $ForumDescriptions = array(
|
||||
"I want only two houses, rather than seven... I feel like letting go of things",
|
||||
"A billion here, a billion there, sooner or later it adds up to real money.",
|
||||
@@ -48,6 +50,10 @@ class Donation extends \Gazelle\Base {
|
||||
"I work very hard and I’m worth every cent!",
|
||||
"To all my Barbies out there who date Benjamin Franklin, George Washington, Abraham Lincoln, you'll be better off in life. Get that money."
|
||||
);
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->rewardManager = new Reward;
|
||||
}
|
||||
|
||||
public function moderatorAdjust(int $UserID, int $Rank, int $TotalRank, string $Reason, int $who) {
|
||||
$this->donate($UserID, [
|
||||
@@ -109,7 +115,7 @@ class Donation extends \Gazelle\Base {
|
||||
]);
|
||||
}
|
||||
|
||||
private function currency_exchange($Amount, $Currency) {
|
||||
function currencyExchange($Amount, $Currency) {
|
||||
switch ($Currency) {
|
||||
case 'BTC':
|
||||
$XBT = new \Gazelle\Manager\XBT;
|
||||
@@ -259,7 +265,7 @@ class Donation extends \Gazelle\Base {
|
||||
RankExpirationTime = NOW()");
|
||||
} else {
|
||||
// Donations from the store get donor points directly, no need to calculate them
|
||||
$ConvertedPrice = $this->currency_exchange($Amount, $Currency);
|
||||
$ConvertedPrice = $this->currencyExchange($Amount, $Currency);
|
||||
// 计算捐赠点数
|
||||
$DonorPoints = $ConvertedPrice / 50;
|
||||
$IncreaseRank = $DonorPoints;
|
||||
@@ -393,10 +399,9 @@ class Donation extends \Gazelle\Base {
|
||||
SET SpecialRank = '$SpecialRank'
|
||||
WHERE UserID = '$UserID'");
|
||||
if ($Invite > 0) {
|
||||
$this->db->query("
|
||||
UPDATE users_main
|
||||
SET Invites = Invites + '$Invite'
|
||||
WHERE ID = $UserID");
|
||||
$rewardInfo = new RewardInfo;
|
||||
$rewardInfo->inviteCount = $Invite;
|
||||
$this->rewardManager->sendReward($rewardInfo, [$UserID], "Donor reward.", false, true);
|
||||
}
|
||||
$this->cache->delete_value("donor_info_$UserID");
|
||||
$this->db->set_query_id($QueryID);
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
<?
|
||||
|
||||
namespace Gazelle\Manager;
|
||||
|
||||
use Gazelle\Action\RewardInfo;
|
||||
use Badges;
|
||||
use Misc;
|
||||
use Gazelle\Exception\InvalidParamException;
|
||||
|
||||
class Reward extends \Gazelle\Base {
|
||||
public function sendReward(RewardInfo $rewardInfo, array $toUserIDs, string $remark, bool $pm = false, bool $system = false) {
|
||||
// check badgeID valid
|
||||
if (count($toUserIDs) <= 0) {
|
||||
return;
|
||||
}
|
||||
$send = false;
|
||||
$BadgeName = '';
|
||||
if ($rewardInfo->badgeID > 0) {
|
||||
$Badge = Badges::get_badges_by_id($rewardInfo->badgeID);
|
||||
$BadgeName = $Badge['Label'];
|
||||
if (empty($BadgeName)) {
|
||||
throw new InvalidParamException('badge id');
|
||||
}
|
||||
$this->addBadge($toUserIDs, $rewardInfo->badgeID);
|
||||
$send = true;
|
||||
}
|
||||
$this->db->begin_transaction();
|
||||
try {
|
||||
if ($rewardInfo->tokenCount > 0) {
|
||||
$this->addTokens($toUserIDs, $rewardInfo->tokenCount, $rewardInfo->tokenExpireTime);
|
||||
$send = true;
|
||||
}
|
||||
if ($rewardInfo->inviteCount > 0) {
|
||||
$this->addInvites($toUserIDs, $rewardInfo->inviteCount, $rewardInfo->invteExpireTime);
|
||||
$send = true;
|
||||
}
|
||||
if (CONFIG['ENABLE_BADGE'] && $rewardInfo->bonus > 0) {
|
||||
$this->addBonus($toUserIDs, $rewardInfo->bonus);
|
||||
$send = true;
|
||||
}
|
||||
$this->recordRewardLog($rewardInfo, $toUserIDs, $remark, $system);
|
||||
} catch (\Exception $e) {
|
||||
$this->db->rollback();
|
||||
}
|
||||
if (!$send) {
|
||||
$this->db->rollback();
|
||||
return;
|
||||
}
|
||||
$this->db->commit();
|
||||
|
||||
// clear cache
|
||||
if ($rewardInfo->tokenCount > 0 || $rewardInfo->inviteCount > 0) {
|
||||
$this->clearCache("user_info_heavy_", $toUserIDs);
|
||||
}
|
||||
if ($rewardInfo->bonus > 0) {
|
||||
$this->clearCache("user_stats_", $toUserIDs);
|
||||
}
|
||||
if ($rewardInfo->badgeID > 0) {
|
||||
$this->clearCache("badges_by_", $toUserIDs);
|
||||
}
|
||||
if (!$pm) {
|
||||
return;
|
||||
}
|
||||
|
||||
// send pm
|
||||
foreach ($toUserIDs as $userID) {
|
||||
Misc::send_pm_with_tpl(
|
||||
$userID,
|
||||
'send_reward',
|
||||
[
|
||||
'Invites' => $rewardInfo->inviteCount,
|
||||
'InvitesTime' => $rewardInfo->invteExpireTime,
|
||||
'Tokens' => $rewardInfo->tokenCount,
|
||||
'TokensTime' => $rewardInfo->tokenExpireTime,
|
||||
'Bonus' => $rewardInfo->bonus,
|
||||
'BadgeName' => $BadgeName,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function addBadge($toUserIDs, $badgeID) {
|
||||
foreach ($toUserIDs as $userID) {
|
||||
$this->db->prepared_query("insert ignore into badges (UserID, BadgeID) values (" . intval($userID) . ", " . intval($badgeID) . ")");
|
||||
}
|
||||
}
|
||||
|
||||
private function addTokens($toUserIDs, $count, $expireTime) {
|
||||
$Where = " where id in (" . implode(",", $toUserIDs) . ")";
|
||||
$this->db->prepared_query("UPDATE users_main SET FLTokens = FLTokens + $count$Where");
|
||||
if ($expireTime) {
|
||||
$SQL = "INSERT INTO tokens_typed (`EndTime`, `Type`, `UserID`) VALUES";
|
||||
$Values = [];
|
||||
foreach ($toUserIDs as $UserID) {
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$Values[] = "('$expireTime', 'time', $UserID)";
|
||||
}
|
||||
}
|
||||
$SQL .= implode(',', $Values);
|
||||
$this->db->prepared_query($SQL);
|
||||
}
|
||||
}
|
||||
|
||||
private function clearCache($keyPrefix, $userIDs) {
|
||||
foreach ($userIDs as $userID) {
|
||||
$this->cache->delete_value($keyPrefix . $userID);
|
||||
}
|
||||
}
|
||||
|
||||
private function addInvites($userIDs, $count, $expireTime) {
|
||||
$Where = " where id in (" . implode(",", $userIDs) . ")";
|
||||
$this->db->prepared_query("UPDATE users_main SET Invites = Invites + $count$Where");
|
||||
if ($expireTime) {
|
||||
$SQL = "insert into invites_typed (`EndTime`, `Type`, `UserID`) values ";
|
||||
$Values = [];
|
||||
foreach ($userIDs as $UserID) {
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$Values[] = "('$expireTime', 'time', $UserID)";
|
||||
}
|
||||
}
|
||||
$SQL .= implode(',', $Values);
|
||||
$this->db->prepared_query($SQL);
|
||||
}
|
||||
}
|
||||
|
||||
private function addBonus($userIDs, $count) {
|
||||
$Where = " where id in (" . implode(",", $userIDs) . ")";
|
||||
$this->db->prepared_query("UPDATE users_main SET BonusPoints = BonusPoints + $count$Where");
|
||||
}
|
||||
|
||||
private function recordRewardLog(RewardInfo $rewardInfo, array $toUserIDs, string $remark, bool $system) {
|
||||
$fromUserID = 0;
|
||||
if (!$system) {
|
||||
$fromUserID = $this->user['ID'];
|
||||
}
|
||||
$Columns = "";
|
||||
$Values = "";
|
||||
if ($rewardInfo->inviteCount > 0) {
|
||||
$Columns .= ", Invites";
|
||||
$Values .= ", $rewardInfo->inviteCount";
|
||||
if ($rewardInfo->invteExpireTime) {
|
||||
$Columns .= ", InvitesTime";
|
||||
$Values .= ", '$rewardInfo->invteExpireTime'";
|
||||
}
|
||||
}
|
||||
if ($rewardInfo->tokenCount > 0) {
|
||||
$Columns .= ", Tokens";
|
||||
$Values .= ", $rewardInfo->tokenCount";
|
||||
if ($rewardInfo->tokenExpireTime) {
|
||||
$Columns .= ", TokensTime";
|
||||
$Values .= ", '$rewardInfo->tokenExpireTime'";
|
||||
}
|
||||
}
|
||||
if ($rewardInfo->bonus > 0) {
|
||||
$Columns .= ", Bonus";
|
||||
$Values .= ", $rewardInfo->bonus";
|
||||
}
|
||||
if ($rewardInfo->badgeID > 0) {
|
||||
$Columns .= ", Badge";
|
||||
$Values .= ", $rewardInfo->badgeID";
|
||||
}
|
||||
$this->db->prepared_query("INSERT INTO events_reward_log (UserIDs, ByUserID, Remark$Columns) VALUES ('" . implode(",", $toUserIDs) . "', " . $fromUserID . ", '$remark'$Values)");
|
||||
}
|
||||
}
|
||||
@@ -95,8 +95,6 @@ class TorrentSlot {
|
||||
self::TorrentSlotTypeUntouched,
|
||||
];
|
||||
|
||||
|
||||
|
||||
const SDSlots = [
|
||||
self::TorrentSlotTypeNone,
|
||||
self::TorrentSlotTypeQuality,
|
||||
@@ -625,6 +623,19 @@ class TorrentSlot {
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
public static function resolution_name($resolution) {
|
||||
switch ($resolution) {
|
||||
case self::TorrentSlotResolutionSD:
|
||||
case self::TorrentSlotResolutionHD720P:
|
||||
return "group_standard_resolution";
|
||||
case self::TorrentSlotResolutionHD1080P:
|
||||
return "group_high_resolution";
|
||||
case self::TorrentSlotResolutionUHD:
|
||||
return "group_ultra_high_resolution";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static function slot_filter_name($Slot) {
|
||||
switch ($Slot) {
|
||||
case self::TorrentSlotTypeNone:
|
||||
|
||||
+14
-9
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace Gazelle;
|
||||
|
||||
use VALIDATE, Artists, Format, ImageTools, Movie, Tags, Misc, Tracker, Torrents;
|
||||
use Gazelle\Manager\ActionTrigger;
|
||||
use Gazelle\Manager\Tag;
|
||||
use VALIDATE, Artists, Format, ImageTools, Movie, Tags, Misc, Tracker, Torrents, Users;
|
||||
use Gazelle\Util\Time, Gazelle\Torrent\EditionInfo, Gazelle\Torrent\TorrentSlot, Gazelle\Torrent\Notification, Gazelle\Util\FileChecker;
|
||||
|
||||
class UploadedTorrent {
|
||||
@@ -19,6 +21,7 @@ class Upload extends Base {
|
||||
private $notification;
|
||||
private $fileChecker;
|
||||
private $useAPI = false;
|
||||
private $trigger;
|
||||
|
||||
public function __construct($IsNewGroup, $UseAPI = false) {
|
||||
parent::__construct();
|
||||
@@ -27,6 +30,7 @@ class Upload extends Base {
|
||||
$this->isNewGroup = $IsNewGroup;
|
||||
$this->fileChecker = new FileChecker;
|
||||
$this->useAPI = $UseAPI;
|
||||
$this->trigger = new ActionTrigger;
|
||||
$this->initValidate();
|
||||
}
|
||||
|
||||
@@ -48,7 +52,7 @@ class Upload extends Base {
|
||||
$LogName = Torrents::torrent_name($this->properties, false);
|
||||
$TotalSize = $this->properties['Size'];
|
||||
Misc::write_log("Torrent $TorrentID ($LogName) was uploaded by " . $this->user['Username'] . ($this->useAPI ? ' using the api' : ''));
|
||||
Torrents::write_group_log($GroupID, $TorrentID, $this->user['ID'], "uploaded (" . number_format($TotalSize / (1024 * 1024 * 1024), 2) . ' GiB)', 0);
|
||||
Torrents::write_group_log($GroupID, $TorrentID, $this->user['ID'], 'uploaded ' . $this->properties['FilePath'] . '(' . number_format($TotalSize / (1024 * 1024 * 1024), 2) . ' GiB)', 0);
|
||||
|
||||
$this->clearCache();
|
||||
Tracker::update_tracker('add_torrent', array('id' => $TorrentID, 'info_hash' => rawurlencode($this->properties['InfoHash']), 'freetorrent' => $this->properties['FreeLeech']));
|
||||
@@ -59,6 +63,7 @@ class Upload extends Base {
|
||||
$this->updateUser();
|
||||
// TODO by qwerty async
|
||||
$this->notification->notify($this->properties, $this->isNewGroup);
|
||||
$this->trigger->triggerUpload($GroupID, $TorrentID);
|
||||
$this->cache->delete_value("torrent_{$TorrentID}_lock");
|
||||
return $this->buildUploadedTorrent();
|
||||
}
|
||||
@@ -269,9 +274,14 @@ class Upload extends Base {
|
||||
if ($properties['Diy'] || $properties['Buy']) {
|
||||
$properties['FreeLeech'] = Torrents::FREE;
|
||||
}
|
||||
$ReleaseGroup = Users::get_release_group_by_id($properties['Makers']);
|
||||
if (count($ReleaseGroup) > 0) {
|
||||
$properties['FreeEndTime'] = Time::timePlus(3600 * CONFIG['TORRENT_UPLOAD_FREE_HOUR']);
|
||||
} else {
|
||||
$properties['FreeEndTime'] = Time::timePlus(3600 * CONFIG['TORRENT_UPLOAD_FREE_HOUR']);
|
||||
}
|
||||
|
||||
// limit free
|
||||
$properties['FreeEndTime'] = Time::timePlus(3600 * 48);
|
||||
$properties['FreeTorrent'] = $properties['FreeLeech'];
|
||||
|
||||
$properties['Slot'] = TorrentSlot::CalSlot($properties);
|
||||
@@ -363,11 +373,6 @@ class Upload extends Base {
|
||||
$GroupID = $this->properties['GroupID'];
|
||||
$FirstTorrent = $TotalSize > 2 * 1024 * 1024 * 1024 ? 1 : $TorrentID;
|
||||
$this->db->query("update users_main set firsttorrent=IF(firsttorrent = 0, $FirstTorrent, firsttorrent) ,TotalUploads=TotalUploads+1 where id=" . $this->user['ID']);
|
||||
if ($this->user['DisablePoints'] == 0) {
|
||||
$BonusPoints = 300;
|
||||
$this->db->query("UPDATE users_main SET BonusPoints = BonusPoints + {$BonusPoints} WHERE ID=" . $this->user['ID']);
|
||||
$this->cache->delete_value('user_stats_' . $this->user['ID']);
|
||||
}
|
||||
$RecentUploads = $this->cache->get_value("recent_uploads_$UserID");
|
||||
if (is_array($RecentUploads)) {
|
||||
do {
|
||||
@@ -542,7 +547,7 @@ class Upload extends Base {
|
||||
$UserID = $this->user['ID'];
|
||||
$Tags = explode(',', $this->properties['TagList']);
|
||||
$Tags = Tags::main_name($Tags);
|
||||
$tagMan = new \Gazelle\Manager\Tag;
|
||||
$tagMan = new Tag;
|
||||
foreach ($Tags as $Tag) {
|
||||
$TagID = $tagMan->create($Tag, $this->user['ID']);
|
||||
if ($TagID) {
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<?
|
||||
|
||||
use Gazelle\Manager\Reward;
|
||||
use Gazelle\Action\RewardInfo;
|
||||
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/badges/functions.php');
|
||||
class Badges {
|
||||
static $Limit = array(
|
||||
@@ -180,15 +184,13 @@ class Badges {
|
||||
}
|
||||
public static function gave($UserID, $BadgeID, $SendPM = true) {
|
||||
$Badge = Badges::get_badges_by_id($BadgeID);
|
||||
G::$DB->query("insert ignore into badges (UserID, BadgeID) values (" . intval($UserID) . ", " . intval($BadgeID) . ")");
|
||||
$r = G::$DB->affected_rows();
|
||||
if ($r) {
|
||||
G::$Cache->delete_value("badges_by_" . $UserID);
|
||||
if ($SendPM) {
|
||||
Misc::send_pm_with_tpl($UserID, 'give_badges', ['BadgeName' => Badges::get_text($Badge['Label'], 'badge_name'), 'BadgeLevel' => $Badge['Level']]);
|
||||
}
|
||||
$rewardManager = new Reward;
|
||||
$reward = new RewardInfo;
|
||||
$reward->badgeID = $BadgeID;
|
||||
$rewardManager->sendReward($reward, [$UserID], "System", false, true);
|
||||
if ($SendPM) {
|
||||
Misc::send_pm_with_tpl($UserID, 'give_badges', ['BadgeName' => Badges::get_text($Badge['Label'], 'badge_name'), 'BadgeLevel' => $Badge['Level']]);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
public static function buy($UserID, $BadgeID, $Price) {
|
||||
if (G::$LoggedUser['ID'] != $UserID) return 0;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?
|
||||
|
||||
use Gazelle\Manager\ActionTrigger;
|
||||
|
||||
class Comments {
|
||||
/*
|
||||
* For all functions:
|
||||
@@ -32,6 +35,9 @@ class Comments {
|
||||
VALUES ('$Page', $PageID, " . G::$LoggedUser['ID'] . ", '" . sqltime() . "', '" . db_string($Body) . "')");
|
||||
$PostID = G::$DB->inserted_id();
|
||||
|
||||
$trigger = new ActionTrigger;
|
||||
$trigger->triggerPostComment($PostID);
|
||||
|
||||
$CatalogueID = floor((CONFIG['TORRENT_COMMENTS_PER_PAGE'] * $Pages - CONFIG['TORRENT_COMMENTS_PER_PAGE']) / CONFIG['THREAD_CATALOGUE']);
|
||||
G::$Cache->delete_value($Page . '_comments_' . $PageID . '_catalogue_' . $CatalogueID);
|
||||
G::$Cache->delete_value($Page . '_comments_' . $PageID);
|
||||
|
||||
@@ -1,851 +0,0 @@
|
||||
<?
|
||||
|
||||
define('BTC_API_URL', 'https://api.bitcoinaverage.com/ticker/global/EUR/');
|
||||
define('USD_API_URL', 'http://www.google.com/ig/calculator?hl=en&q=1USD=?EUR');
|
||||
|
||||
class Donations {
|
||||
private static $ForumDescriptions = array(
|
||||
"I want only two houses, rather than seven... I feel like letting go of things",
|
||||
"A billion here, a billion there, sooner or later it adds up to real money.",
|
||||
"I've cut back, because I'm buying a house in the West Village.",
|
||||
"Some girls are just born with glitter in their veins.",
|
||||
"I get half a million just to show up at parties. My life is, like, really, really fun.",
|
||||
"Some people change when they think they're a star or something",
|
||||
"I'd rather not talk about money. It’s kind of gross.",
|
||||
"I have not been to my house in Bermuda for two or three years, and the same goes for my house in Portofino. How long do I have to keep leading this life of sacrifice?",
|
||||
"When I see someone who is making anywhere from $300,000 to $750,000 a year, that's middle class.",
|
||||
"Money doesn't make you happy. I now have $50 million but I was just as happy when I had $48 million.",
|
||||
"I'd rather smoke crack than eat cheese from a tin.",
|
||||
"I am who I am. I can’t pretend to be somebody who makes $25,000 a year.",
|
||||
"A girl never knows when she might need a couple of diamonds at ten 'o' clock in the morning.",
|
||||
"I wouldn't run for president. I wouldn't want to move to a smaller house.",
|
||||
"I have the stardom glow.",
|
||||
"What's Walmart? Do they like, sell wall stuff?",
|
||||
"Whenever I watch TV and see those poor starving kids all over the world, I can't help but cry. I mean I'd love to be skinny like that, but not with all those flies and death and stuff.",
|
||||
"Too much money ain't enough money.",
|
||||
"What's a soup kitchen?",
|
||||
"I work very hard and I’m worth every cent!",
|
||||
"To all my Barbies out there who date Benjamin Franklin, George Washington, Abraham Lincoln, you'll be better off in life. Get that money."
|
||||
);
|
||||
|
||||
private static $IsSchedule = false;
|
||||
|
||||
public static function regular_donate($UserID, $DonationAmount, $Source, $Reason, $Currency = "CNY") {
|
||||
self::donate($UserID, array(
|
||||
"Source" => $Source,
|
||||
"Price" => $DonationAmount,
|
||||
"Currency" => $Currency,
|
||||
"Source" => $Source,
|
||||
"Reason" => $Reason,
|
||||
"SendPM" => true
|
||||
));
|
||||
}
|
||||
|
||||
public static function donate($UserID, $Args) {
|
||||
$UserID = (int)$UserID;
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
|
||||
G::$DB->query("
|
||||
SELECT 1
|
||||
FROM users_main
|
||||
WHERE ID = '$UserID'
|
||||
LIMIT 1");
|
||||
if (G::$DB->has_results()) {
|
||||
G::$Cache->InternalCache = false;
|
||||
foreach ($Args as &$Arg) {
|
||||
$Arg = db_string($Arg);
|
||||
}
|
||||
extract($Args);
|
||||
|
||||
// We don't always get a date passed in.
|
||||
if (empty($Date)) {
|
||||
$Date = sqltime();
|
||||
}
|
||||
|
||||
// Get the ID of the staff member making the edit
|
||||
$AddedBy = 0;
|
||||
if (!self::$IsSchedule) {
|
||||
$AddedBy = G::$LoggedUser['ID'];
|
||||
}
|
||||
|
||||
// Legacy donor, should remove at some point
|
||||
G::$DB->query("
|
||||
UPDATE users_info
|
||||
SET Donor = '1'
|
||||
WHERE UserID = '$UserID'");
|
||||
// Give them the extra invite
|
||||
$ExtraInvite = G::$DB->affected_rows();
|
||||
|
||||
// A staff member is directly manipulating donor points
|
||||
if (isset($Manipulation) && $Manipulation === "Direct") {
|
||||
$DonorPoints = $Rank;
|
||||
$AdjustedRank = $Rank >= MAX_EXTRA_RANK ? MAX_EXTRA_RANK : $Rank;
|
||||
G::$DB->query("
|
||||
INSERT INTO users_donor_ranks
|
||||
(UserID, Rank, TotalRank, DonationTime, RankExpirationTime)
|
||||
VALUES
|
||||
('$UserID', '$AdjustedRank', '$TotalRank', '$Date', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Rank = '$AdjustedRank',
|
||||
TotalRank = '$TotalRank',
|
||||
DonationTime = '$Date',
|
||||
RankExpirationTime = NOW()");
|
||||
} else {
|
||||
// Donations from the store get donor points directly, no need to calculate them
|
||||
if ($Source == "Store Parser") {
|
||||
$ConvertedPrice = self::currency_exchange($Amount * $Price, $Currency);
|
||||
} else {
|
||||
$ConvertedPrice = self::currency_exchange($Price, $Currency);
|
||||
$DonorPoints = self::calculate_rank($ConvertedPrice);
|
||||
}
|
||||
$IncreaseRank = $DonorPoints;
|
||||
|
||||
// Rank is the same thing as DonorPoints
|
||||
$CurrentRank = self::get_rank($UserID);
|
||||
// A user's donor rank can never exceed MAX_EXTRA_RANK
|
||||
// If the amount they donated causes it to overflow, chnage it to MAX_EXTRA_RANK
|
||||
// The total rank isn't affected by this, so their original donor point value is added to it
|
||||
if (($CurrentRank + $DonorPoints) >= MAX_EXTRA_RANK) {
|
||||
$AdjustedRank = MAX_EXTRA_RANK;
|
||||
} else {
|
||||
$AdjustedRank = $CurrentRank + $DonorPoints;
|
||||
}
|
||||
G::$DB->query("
|
||||
INSERT INTO users_donor_ranks
|
||||
(UserID, Rank, TotalRank, DonationTime, RankExpirationTime)
|
||||
VALUES
|
||||
('$UserID', '$AdjustedRank', '$DonorPoints', '$Date', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Rank = '$AdjustedRank',
|
||||
TotalRank = TotalRank + '$DonorPoints',
|
||||
DonationTime = '$Date',
|
||||
RankExpirationTime = NOW()");
|
||||
}
|
||||
// Donor cache key is outdated
|
||||
G::$Cache->delete_value("donor_info_$UserID");
|
||||
|
||||
// Get their rank
|
||||
$Rank = self::get_rank($UserID);
|
||||
$TotalRank = self::get_total_rank($UserID);
|
||||
|
||||
// Now that their rank and total rank has been set, we can calculate their special rank
|
||||
self::calculate_special_rank($UserID);
|
||||
|
||||
// Hand out invites
|
||||
if ($Rank > 1) {
|
||||
G::$DB->query("
|
||||
SELECT InvitesRecievedRank
|
||||
FROM users_donor_ranks
|
||||
WHERE UserID = '$UserID'");
|
||||
list($InvitesRecievedRank) = G::$DB->next_record();
|
||||
$AdjustedRank = $Rank >= MAX_RANK ? MAX_RANK : $Rank;
|
||||
$InviteRank = $AdjustedRank - $InvitesRecievedRank;
|
||||
if ($InviteRank > 0) {
|
||||
$Invites = $ExtraInvite ? ($InviteRank + 1) : $InviteRank;
|
||||
G::$DB->query("
|
||||
UPDATE users_main
|
||||
SET Invites = Invites + '$Invites'
|
||||
WHERE ID = $UserID");
|
||||
G::$DB->query("
|
||||
UPDATE users_donor_ranks
|
||||
SET InvitesRecievedRank = '$AdjustedRank'
|
||||
WHERE UserID = '$UserID'");
|
||||
}
|
||||
}
|
||||
|
||||
// Send them a thank you PM
|
||||
if ($SendPM) {
|
||||
$UserLang = Lang::getUserLang($UserID);
|
||||
$Subject = t('server.inbox.contribution_has_been_received', ['Values' => [$UserLang]]);
|
||||
$Body = self::get_pm_body($Source, $Currency, $Price, $IncreaseRank, $Rank, $UserLang);
|
||||
Misc::send_pm($UserID, 0, $Subject, $Body);
|
||||
}
|
||||
|
||||
// Lastly, add this donation to our history
|
||||
G::$DB->query("
|
||||
INSERT INTO donations
|
||||
(UserID, Amount, Source, Reason, Currency, Email, Time, AddedBy, Rank, TotalRank)
|
||||
VALUES
|
||||
('$UserID', '$ConvertedPrice', '$Source', '$Reason', '$Currency', '', '$Date', '$AddedBy', '$DonorPoints', '$TotalRank')");
|
||||
|
||||
|
||||
// Clear their user cache keys because the users_info values has been modified
|
||||
G::$Cache->delete_value("user_info_$UserID");
|
||||
G::$Cache->delete_value("user_info_heavy_$UserID");
|
||||
G::$Cache->delete_value("donor_info_$UserID");
|
||||
}
|
||||
G::$DB->set_query_id($QueryID);
|
||||
}
|
||||
|
||||
private static function calculate_special_rank($UserID) {
|
||||
$UserID = (int)$UserID;
|
||||
$UserLang = Lang::getUserLang($UserID);
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
// Are they are special?
|
||||
G::$DB->query("
|
||||
SELECT TotalRank, SpecialRank
|
||||
FROM users_donor_ranks
|
||||
WHERE UserID = '$UserID'");
|
||||
if (G::$DB->has_results()) {
|
||||
// Adjust their special rank depending on the total rank.
|
||||
list($TotalRank, $SpecialRank) = G::$DB->next_record();
|
||||
$SpecialInvites = 0;
|
||||
if ($TotalRank < 2) {
|
||||
$SpecialRank = 0;
|
||||
}
|
||||
if ($SpecialRank < 1 && $TotalRank >= 2) {
|
||||
Misc::send_pm($UserID, 0, t('server.inbox.get_special_rank_one_sbj', ['Values' => [$UserLang]]), t('server.inbox.get_special_rank_one_pm', ['Values' => [$UserLang]]));
|
||||
$SpecialRank = 1;
|
||||
}
|
||||
if ($SpecialRank < 2 && $TotalRank >= 6) {
|
||||
Misc::send_pm($UserID, 0, t('server.inbox.get_special_rank_two_sbj', ['Values' => [$UserLang]]), t('server.inbox.get_special_rank_two_pm', ['Values' => [$UserLang]]));
|
||||
$SpecialRank = 2;
|
||||
}
|
||||
if ($SpecialRank < 3 && $TotalRank >= 12) {
|
||||
Misc::send_pm($UserID, 0, t('server.inbox.get_special_rank_three_sbj', ['Values' => [$UserLang]]), t('server.inbox.get_special_rank_three_pm', ['Values' => [$UserLang]]));
|
||||
$SpecialRank = 3;
|
||||
$SpecialInvites += 2;
|
||||
}
|
||||
if ($SpecialRank < 4 && $TotalRank >= 24) {
|
||||
Misc::send_pm($UserID, 0, t('server.inbox.get_special_rank_four_sbj', ['Values' => [$UserLang]]), t('server.inbox.get_special_rank_four_pm', ['Values' => [$UserLang]]));
|
||||
$SpecialRank = 4;
|
||||
$SpecialInvites += 4;
|
||||
}
|
||||
if ($SpecialRank < 5 && $TotalRank >= 50) {
|
||||
Misc::send_pm($UserID, 0, t('server.inbox.get_special_rank_five_sbj', ['Values' => [$UserLang]]), t('server.inbox.get_special_rank_five_pm', ['Values' => [$UserLang]]));
|
||||
$SpecialRank = 5;
|
||||
$SpecialInvites += 6;
|
||||
}
|
||||
// Make them special
|
||||
if ($SpecialInvite) {
|
||||
G::$DB->query("
|
||||
UPDATE users_main
|
||||
SET Invites = Invites + '$SpecialInvites'
|
||||
WHERE ID = $UserID");
|
||||
G::$Cache->delete_value("user_info_$UserID");
|
||||
G::$Cache->delete_value("user_info_heavy_$UserID");
|
||||
}
|
||||
G::$DB->query("
|
||||
UPDATE users_donor_ranks
|
||||
SET SpecialRank = '$SpecialRank'
|
||||
WHERE UserID = '$UserID'");
|
||||
G::$Cache->delete_value("donor_info_$UserID");
|
||||
}
|
||||
G::$DB->set_query_id($QueryID);
|
||||
}
|
||||
|
||||
public static function schedule() {
|
||||
self::$IsSchedule = true;
|
||||
|
||||
//DonationsBitcoin::find_new_donations();
|
||||
self::expire_ranks();
|
||||
//self::get_new_conversion_rates();
|
||||
}
|
||||
|
||||
public static function expire_ranks() {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("
|
||||
SELECT UserID
|
||||
FROM users_donor_ranks
|
||||
WHERE Rank > 1
|
||||
AND SpecialRank != 5
|
||||
AND NOW() - INTERVAL 1464 HOUR < RankExpirationTime
|
||||
AND RankExpirationTime < NOW() - INTERVAL 1440 HOUR");
|
||||
|
||||
if (G::$DB->record_count() > 0) {
|
||||
while (list($UserID) = G::$DB->next_record()) {
|
||||
$UserLang = Lang::getUserLang($UserID);
|
||||
Misc::send_pm($UserID, 0, t('server.inbox.expire_rank_sbj', ['Values' => [$UserLang]]), t('server.inbox.expire_rank_pm', ['Values' => [$UserLang]]));
|
||||
}
|
||||
}
|
||||
|
||||
G::$DB->query("
|
||||
SELECT UserID, Rank
|
||||
FROM users_donor_ranks
|
||||
WHERE Rank > 1
|
||||
AND SpecialRank != 5
|
||||
AND RankExpirationTime < NOW() - INTERVAL 1488 HOUR");
|
||||
// 2 hours less than 32 days to account for schedule run times
|
||||
|
||||
if (G::$DB->record_count() > 0) {
|
||||
$UserIDs = array();
|
||||
while (list($UserID, $Rank) = G::$DB->next_record()) {
|
||||
G::$Cache->delete_value("donor_info_$UserID");
|
||||
G::$Cache->delete_value("donor_title_$UserID");
|
||||
G::$Cache->delete_value("donor_profile_rewards_$UserID");
|
||||
$UserIDs[] = $UserID;
|
||||
}
|
||||
$In = implode(',', $UserIDs);
|
||||
G::$DB->query("
|
||||
UPDATE users_donor_ranks
|
||||
SET Rank = Rank - IF(Rank = " . MAX_RANK . ", 2, 1), RankExpirationTime = NOW()
|
||||
WHERE UserID IN ($In)");
|
||||
}
|
||||
G::$DB->set_query_id($QueryID);
|
||||
}
|
||||
|
||||
private static function calculate_rank($Amount) {
|
||||
return floor($Amount / 50);
|
||||
}
|
||||
|
||||
public static function update_rank($UserID, $Rank, $TotalRank, $Reason) {
|
||||
$Rank = (int)$Rank;
|
||||
$TotalRank = (int)$TotalRank;
|
||||
|
||||
self::donate($UserID, array(
|
||||
"Manipulation" => "Direct",
|
||||
"Rank" => $Rank,
|
||||
"TotalRank" => $TotalRank,
|
||||
"Reason" => $Reason,
|
||||
"Source" => "Modify Values",
|
||||
"Currency" => "CNY"
|
||||
));
|
||||
}
|
||||
|
||||
public static function hide_stats($UserID) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("
|
||||
INSERT INTO users_donor_ranks
|
||||
(UserID, Hidden)
|
||||
VALUES
|
||||
('$UserID', '1')
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Hidden = '1'");
|
||||
G::$DB->set_query_id($QueryID);
|
||||
}
|
||||
|
||||
public static function show_stats($UserID) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("
|
||||
INSERT INTO users_donor_ranks
|
||||
(UserID, Hidden)
|
||||
VALUES
|
||||
('$UserID', '0')
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Hidden = '0'");
|
||||
G::$DB->set_query_id($QueryID);
|
||||
}
|
||||
|
||||
public static function is_visible($UserID) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("
|
||||
SELECT Hidden
|
||||
FROM users_donor_ranks
|
||||
WHERE Hidden = '0'
|
||||
AND UserID = '$UserID'");
|
||||
$HasResults = G::$DB->has_results();
|
||||
G::$DB->set_query_id($QueryID);
|
||||
return $HasResults;
|
||||
}
|
||||
|
||||
public static function has_donor_forum($UserID) {
|
||||
return self::get_rank($UserID) >= CONFIG['DONOR_FORUM_RANK'] || self::get_special_rank($UserID) >= MAX_SPECIAL_RANK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Put all the common donor info in the same cache key to save some cache calls
|
||||
*/
|
||||
public static function get_donor_info($UserID) {
|
||||
// Our cache class should prevent identical memcached requests
|
||||
$DonorInfo = G::$Cache->get_value("donor_info_$UserID");
|
||||
if ($DonorInfo === false) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("
|
||||
SELECT
|
||||
Rank,
|
||||
SpecialRank,
|
||||
TotalRank,
|
||||
DonationTime,
|
||||
RankExpirationTime + INTERVAL 1488 HOUR
|
||||
FROM users_donor_ranks
|
||||
WHERE UserID = '$UserID'");
|
||||
// 2 hours less than 32 days to account for schedule run times
|
||||
if (G::$DB->has_results()) {
|
||||
list($Rank, $SpecialRank, $TotalRank, $DonationTime, $ExpireTime) = G::$DB->next_record(MYSQLI_NUM, false);
|
||||
if ($DonationTime === null) {
|
||||
$DonationTime = 0;
|
||||
}
|
||||
if ($ExpireTime === null) {
|
||||
$ExpireTime = 0;
|
||||
}
|
||||
} else {
|
||||
$Rank = $SpecialRank = $TotalRank = $DonationTime = $ExpireTime = 0;
|
||||
}
|
||||
if (Permissions::is_mod($UserID)) {
|
||||
$Rank = MAX_EXTRA_RANK;
|
||||
$SpecialRank = MAX_SPECIAL_RANK;
|
||||
}
|
||||
G::$DB->query("
|
||||
SELECT
|
||||
IconMouseOverText,
|
||||
AvatarMouseOverText,
|
||||
CustomIcon,
|
||||
CustomIconLink,
|
||||
SecondAvatar,
|
||||
ColorUsername,
|
||||
GradientsColor
|
||||
FROM donor_rewards
|
||||
WHERE UserID = '$UserID'");
|
||||
$Rewards = G::$DB->next_record(MYSQLI_ASSOC);
|
||||
G::$DB->set_query_id($QueryID);
|
||||
|
||||
$DonorInfo = array(
|
||||
'Rank' => (int)$Rank,
|
||||
'SRank' => (int)$SpecialRank,
|
||||
'TotRank' => (int)$TotalRank,
|
||||
'Time' => $DonationTime,
|
||||
'ExpireTime' => $ExpireTime,
|
||||
'Rewards' => $Rewards
|
||||
);
|
||||
G::$Cache->cache_value("donor_info_$UserID", $DonorInfo, 0);
|
||||
}
|
||||
return $DonorInfo;
|
||||
}
|
||||
|
||||
public static function get_rank($UserID) {
|
||||
return self::get_donor_info($UserID)['Rank'];
|
||||
}
|
||||
|
||||
public static function get_special_rank($UserID) {
|
||||
return self::get_donor_info($UserID)['SRank'];
|
||||
}
|
||||
|
||||
public static function get_total_rank($UserID) {
|
||||
return self::get_donor_info($UserID)['TotRank'];
|
||||
}
|
||||
|
||||
public static function get_donation_time($UserID) {
|
||||
return self::get_donor_info($UserID)['Time'];
|
||||
}
|
||||
|
||||
public static function get_personal_collages($UserID) {
|
||||
$DonorInfo = self::get_donor_info($UserID);
|
||||
if ($DonorInfo['SRank'] == MAX_SPECIAL_RANK) {
|
||||
$Collages = 5;
|
||||
} else {
|
||||
$Collages = min($DonorInfo['Rank'], 5); // One extra collage per donor rank up to 5
|
||||
}
|
||||
return $Collages;
|
||||
}
|
||||
|
||||
public static function get_titles($UserID) {
|
||||
$Results = G::$Cache->get_value("donor_title_$UserID");
|
||||
if ($Results === false) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("
|
||||
SELECT Prefix, Suffix, UseComma
|
||||
FROM donor_forum_usernames
|
||||
WHERE UserID = '$UserID'");
|
||||
$Results = G::$DB->next_record();
|
||||
G::$DB->set_query_id($QueryID);
|
||||
G::$Cache->cache_value("donor_title_$UserID", $Results, 0);
|
||||
}
|
||||
return $Results;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function get_enabled_rewards($UserID) {
|
||||
$Rewards = array();
|
||||
$Rank = self::get_rank($UserID);
|
||||
$SpecialRank = self::get_special_rank($UserID);
|
||||
$HasAll = $SpecialRank == MAX_SPECIAL_RANK;
|
||||
|
||||
$Rewards = array(
|
||||
'HasAvatarMouseOverText' => false,
|
||||
'HasCustomDonorIcon' => false,
|
||||
'HasDonorForum' => false,
|
||||
'HasDonorIconLink' => false,
|
||||
'HasDonorIconMouseOverText' => false,
|
||||
'HasProfileInfo1' => false,
|
||||
'HasProfileInfo2' => false,
|
||||
'HasProfileInfo3' => false,
|
||||
'HasProfileInfo4' => false,
|
||||
'HasSecondAvatar' => false,
|
||||
'HasLimitedColorName' => false,
|
||||
'HasUnlimitedColor' => false,
|
||||
'HasGradientsColor' => false,
|
||||
);
|
||||
|
||||
// if ($Rank >= 1 || $HasAll) {
|
||||
//
|
||||
// }
|
||||
if ($Rank >= 2 || $HasAll) {
|
||||
$Rewards["HasDonorIconMouseOverText"] = true;
|
||||
$Rewards["HasProfileInfo1"] = true;
|
||||
}
|
||||
if ($Rank >= 3 || $HasAll) {
|
||||
$Rewards["HasAvatarMouseOverText"] = true;
|
||||
$Rewards["HasProfileInfo2"] = true;
|
||||
}
|
||||
if ($Rank >= 4 || $HasAll) {
|
||||
$Rewards["HasDonorIconLink"] = true;
|
||||
$Rewards["HasProfileInfo3"] = true;
|
||||
}
|
||||
if ($Rank >= MAX_RANK || $HasAll) {
|
||||
$Rewards["HasCustomDonorIcon"] = true;
|
||||
$Rewards["HasDonorForum"] = true;
|
||||
$Rewards["HasProfileInfo4"] = true;
|
||||
}
|
||||
if ($SpecialRank >= 4) {
|
||||
$Rewards["HasSecondAvatar"] = true;
|
||||
$Rewards["HasLimitedColorName"] = true;
|
||||
}
|
||||
if ($SpecialRank >= 5) {
|
||||
$Rewards["HasUnlimitedColor"] = true;
|
||||
$Rewards["HasGradientsColor"] = true;
|
||||
}
|
||||
return $Rewards;
|
||||
}
|
||||
|
||||
public static function get_rewards($UserID) {
|
||||
return self::get_donor_info($UserID)['Rewards'];
|
||||
}
|
||||
|
||||
public static function get_profile_rewards($UserID) {
|
||||
$Results = G::$Cache->get_value("donor_profile_rewards_$UserID");
|
||||
if ($Results === false) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("
|
||||
SELECT
|
||||
ProfileInfo1,
|
||||
ProfileInfoTitle1,
|
||||
ProfileInfo2,
|
||||
ProfileInfoTitle2,
|
||||
ProfileInfo3,
|
||||
ProfileInfoTitle3,
|
||||
ProfileInfo4,
|
||||
ProfileInfoTitle4
|
||||
FROM donor_rewards
|
||||
WHERE UserID = '$UserID'");
|
||||
$Results = G::$DB->next_record();
|
||||
G::$DB->set_query_id($QueryID);
|
||||
G::$Cache->cache_value("donor_profile_rewards_$UserID", $Results, 0);
|
||||
}
|
||||
return $Results;
|
||||
}
|
||||
|
||||
private static function add_profile_info_reward($Counter, &$Insert, &$Values, &$Update) {
|
||||
if (isset($_POST["profile_title_" . $Counter]) && isset($_POST["profile_info_" . $Counter])) {
|
||||
$ProfileTitle = db_string($_POST["profile_title_" . $Counter]);
|
||||
$ProfileInfo = db_string($_POST["profile_info_" . $Counter]);
|
||||
$ProfileInfoTitleSQL = "ProfileInfoTitle" . $Counter;
|
||||
$ProfileInfoSQL = "ProfileInfo" . $Counter;
|
||||
$Insert[] = "$ProfileInfoTitleSQL";
|
||||
$Values[] = "'$ProfileTitle'";
|
||||
$Update[] = "$ProfileInfoTitleSQL = '$ProfileTitle'";
|
||||
$Insert[] = "$ProfileInfoSQL";
|
||||
$Values[] = "'$ProfileInfo'";
|
||||
$Update[] = "$ProfileInfoSQL = '$ProfileInfo'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function update_rewards($UserID) {
|
||||
$Rank = self::get_rank($UserID);
|
||||
$SpecialRank = self::get_special_rank($UserID);
|
||||
$HasAll = $SpecialRank == MAX_SPECIAL_RANK;
|
||||
$Counter = 0;
|
||||
$Insert = array();
|
||||
$Values = array();
|
||||
$Update = array();
|
||||
|
||||
$Insert[] = "UserID";
|
||||
$Values[] = "'$UserID'";
|
||||
if ($Rank >= 1 || $HasAll) {
|
||||
}
|
||||
if ($Rank >= 2 || $HasAll) {
|
||||
if (isset($_POST['donor_icon_mouse_over_text'])) {
|
||||
$IconMouseOverText = db_string($_POST['donor_icon_mouse_over_text']);
|
||||
$Insert[] = "IconMouseOverText";
|
||||
$Values[] = "'$IconMouseOverText'";
|
||||
$Update[] = "IconMouseOverText = '$IconMouseOverText'";
|
||||
}
|
||||
$Counter++;
|
||||
}
|
||||
if ($Rank >= 3 || $HasAll) {
|
||||
if (isset($_POST['avatar_mouse_over_text'])) {
|
||||
$AvatarMouseOverText = db_string($_POST['avatar_mouse_over_text']);
|
||||
$Insert[] = "AvatarMouseOverText";
|
||||
$Values[] = "'$AvatarMouseOverText'";
|
||||
$Update[] = "AvatarMouseOverText = '$AvatarMouseOverText'";
|
||||
}
|
||||
$Counter++;
|
||||
}
|
||||
if ($Rank >= 4 || $HasAll) {
|
||||
if (isset($_POST['donor_icon_link'])) {
|
||||
$CustomIconLink = db_string($_POST['donor_icon_link']);
|
||||
if (!Misc::is_valid_url($CustomIconLink)) {
|
||||
$CustomIconLink = '';
|
||||
}
|
||||
$Insert[] = "CustomIconLink";
|
||||
$Values[] = "'$CustomIconLink'";
|
||||
$Update[] = "CustomIconLink = '$CustomIconLink'";
|
||||
}
|
||||
$Counter++;
|
||||
}
|
||||
if ($Rank >= MAX_RANK || $HasAll) {
|
||||
if (isset($_POST['donor_icon_custom_url'])) {
|
||||
$CustomIcon = db_string($_POST['donor_icon_custom_url']);
|
||||
if (!Misc::is_valid_url($CustomIcon)) {
|
||||
$CustomIcon = '';
|
||||
}
|
||||
$Insert[] = "CustomIcon";
|
||||
$Values[] = "'$CustomIcon'";
|
||||
$Update[] = "CustomIcon = '$CustomIcon'";
|
||||
}
|
||||
self::update_titles($UserID, $_POST['donor_title_prefix'], $_POST['donor_title_suffix'], $_POST['donor_title_comma']);
|
||||
$Counter++;
|
||||
}
|
||||
for ($i = 1; $i <= $Counter; $i++) {
|
||||
self::add_profile_info_reward($i, $Insert, $Values, $Update);
|
||||
}
|
||||
if ($SpecialRank >= 4) {
|
||||
if (isset($_POST['second_avatar'])) {
|
||||
$SecondAvatar = db_string($_POST['second_avatar']);
|
||||
if (!Misc::is_valid_url($SecondAvatar)) {
|
||||
$SecondAvatar = '';
|
||||
}
|
||||
$Insert[] = "SecondAvatar";
|
||||
$Values[] = "'$SecondAvatar'";
|
||||
$Update[] = "SecondAvatar = '$SecondAvatar'";
|
||||
}
|
||||
if (isset($_POST['limitedcolor']) && (preg_match('/^#[a-fA-F0-9]{6}$/', $_POST['limitedcolor']) || $_POST['limitedcolor'] == '')) {
|
||||
$ColorUsername = db_string($_POST['limitedcolor']);
|
||||
$Insert[] = "ColorUsername";
|
||||
$Values[] = "'$ColorUsername'";
|
||||
$Update[] = "ColorUsername = '$ColorUsername'";
|
||||
}
|
||||
}
|
||||
if ($SpecialRank >= 5) {
|
||||
if (isset($_POST['unlimitedcolor']) && (preg_match('/^#[a-fA-F0-9]{6}$/', $_POST['unlimitedcolor']) || $_POST['unlimitedcolor'] == '')) {
|
||||
$ColorUsername = db_string($_POST['unlimitedcolor']);
|
||||
$Insert[] = "ColorUsername";
|
||||
$Values[] = "'$ColorUsername'";
|
||||
$Update[] = "ColorUsername = '$ColorUsername'";
|
||||
}
|
||||
if (isset($_POST['gradientscolor']) && (preg_match('/^#[a-fA-F0-9]{6}(,#[a-fA-F0-9]{6}){1,2}$/', $_POST['gradientscolor']) || $_POST['gradientscolor'] == '')) {
|
||||
$GradientsColor = db_string($_POST['gradientscolor']);
|
||||
$Insert[] = "GradientsColor";
|
||||
$Values[] = "'$GradientsColor'";
|
||||
$Update[] = "GradientsColor = '$GradientsColor'";
|
||||
}
|
||||
}
|
||||
$Insert = implode(', ', $Insert);
|
||||
$Values = implode(', ', $Values);
|
||||
$Update = implode(', ', $Update);
|
||||
if ($Counter > 0) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("
|
||||
INSERT INTO donor_rewards
|
||||
($Insert)
|
||||
VALUES
|
||||
($Values)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
$Update");
|
||||
G::$DB->set_query_id($QueryID);
|
||||
}
|
||||
G::$Cache->delete_value("donor_profile_rewards_$UserID");
|
||||
G::$Cache->delete_value("donor_info_$UserID");
|
||||
}
|
||||
|
||||
public static function update_titles($UserID, $Prefix, $Suffix, $UseComma) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
$Prefix = trim(db_string($Prefix));
|
||||
$Suffix = trim(db_string($Suffix));
|
||||
$UseComma = empty($UseComma) ? true : false;
|
||||
G::$DB->query("
|
||||
INSERT INTO donor_forum_usernames
|
||||
(UserID, Prefix, Suffix, UseComma)
|
||||
VALUES
|
||||
('$UserID', '$Prefix', '$Suffix', '$UseComma')
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Prefix = '$Prefix',
|
||||
Suffix = '$Suffix',
|
||||
UseComma = '$UseComma'");
|
||||
G::$Cache->delete_value("donor_title_$UserID");
|
||||
G::$DB->set_query_id($QueryID);
|
||||
}
|
||||
|
||||
|
||||
public static function get_donation_history($UserID) {
|
||||
$UserID = (int)$UserID;
|
||||
if (empty($UserID)) {
|
||||
error(404);
|
||||
}
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("
|
||||
SELECT Amount, Email, Time, Currency, Reason, Source, AddedBy, Rank, TotalRank
|
||||
FROM donations
|
||||
WHERE UserID = '$UserID'
|
||||
ORDER BY Time DESC");
|
||||
$DonationHistory = G::$DB->to_array(false, MYSQLI_ASSOC, false);
|
||||
G::$DB->set_query_id($QueryID);
|
||||
return $DonationHistory;
|
||||
}
|
||||
|
||||
public static function get_rank_expiration($UserID) {
|
||||
$DonorInfo = self::get_donor_info($UserID);
|
||||
if ($DonorInfo['SRank'] == MAX_SPECIAL_RANK || $DonorInfo['Rank'] == 1) {
|
||||
$Return = 'Never';
|
||||
} elseif ($DonorInfo['ExpireTime']) {
|
||||
$ExpireTime = strtotime($DonorInfo['ExpireTime']);
|
||||
if ($ExpireTime - time() < 60) {
|
||||
$Return = 'Soon';
|
||||
} else {
|
||||
$Expiration = time_diff($ExpireTime); // 32 days
|
||||
$Return = "in $Expiration";
|
||||
}
|
||||
} else {
|
||||
$Return = '';
|
||||
}
|
||||
return $Return;
|
||||
}
|
||||
|
||||
public static function get_leaderboard_position($UserID) {
|
||||
$UserID = (int)$UserID;
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("SET @RowNum := 0");
|
||||
G::$DB->query("
|
||||
SELECT Position
|
||||
FROM (
|
||||
SELECT d.UserID, @RowNum := @RowNum + 1 AS Position
|
||||
FROM users_donor_ranks AS d
|
||||
ORDER BY TotalRank DESC
|
||||
) l
|
||||
WHERE UserID = '$UserID'");
|
||||
if (G::$DB->has_results()) {
|
||||
list($Position) = G::$DB->next_record();
|
||||
} else {
|
||||
$Position = 0;
|
||||
}
|
||||
G::$DB->set_query_id($QueryID);
|
||||
return $Position;
|
||||
}
|
||||
|
||||
public static function is_donor($UserID) {
|
||||
return self::get_rank($UserID) > 0;
|
||||
}
|
||||
|
||||
public static function currency_exchange($Amount, $Currency) {
|
||||
if (!self::is_valid_currency($Currency)) {
|
||||
error("$Currency is not valid currency");
|
||||
}
|
||||
switch ($Currency) {
|
||||
case 'USD':
|
||||
$Amount = self::usd_to_euro($Amount);
|
||||
break;
|
||||
case 'BTC':
|
||||
$Amount = self::btc_to_euro($Amount);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return round($Amount, 2);
|
||||
}
|
||||
|
||||
public static function is_valid_currency($Currency) {
|
||||
return $Currency == 'CNY' || $Currency == 'BTC' || $Currency == 'USD';
|
||||
}
|
||||
|
||||
public static function btc_to_euro($Amount) {
|
||||
$Rate = G::$Cache->get_value('btc_rate');
|
||||
if (empty($Rate)) {
|
||||
$Rate = self::get_stored_conversion_rate('BTC');
|
||||
G::$Cache->cache_value('btc_rate', $Rate, 86400);
|
||||
}
|
||||
return $Rate * $Amount;
|
||||
}
|
||||
|
||||
public static function usd_to_euro($Amount) {
|
||||
$Rate = G::$Cache->get_value('usd_rate');
|
||||
if (empty($Rate)) {
|
||||
$Rate = self::get_stored_conversion_rate('USD');
|
||||
G::$Cache->cache_value('usd_rate', $Rate, 86400);
|
||||
}
|
||||
return $Rate * $Amount;
|
||||
}
|
||||
|
||||
public static function get_stored_conversion_rate($Currency) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("
|
||||
SELECT Rate
|
||||
FROM currency_conversion_rates
|
||||
WHERE Currency = '$Currency'");
|
||||
list($Rate) = G::$DB->next_record(MYSQLI_NUM, false);
|
||||
G::$DB->set_query_id($QueryID);
|
||||
return $Rate;
|
||||
}
|
||||
|
||||
private static function set_stored_conversion_rate($Currency, $Rate) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("
|
||||
REPLACE INTO currency_conversion_rates
|
||||
(Currency, Rate, Time)
|
||||
VALUES
|
||||
('$Currency', $Rate, NOW())");
|
||||
if ($Currency == 'USD') {
|
||||
$KeyName = 'usd_rate';
|
||||
} elseif ($Currency == 'BTC') {
|
||||
$KeyName = 'btc_rate';
|
||||
}
|
||||
G::$Cache->cache_value($KeyName, $Rate, 86400);
|
||||
G::$DB->set_query_id($QueryID);
|
||||
}
|
||||
|
||||
private static function get_new_conversion_rates() {
|
||||
if ($BTC = file_get_contents(BTC_API_URL)) {
|
||||
$BTC = json_decode($BTC, true);
|
||||
if (isset($BTC['24h_avg'])) {
|
||||
if ($Rate = round($BTC['24h_avg'], 4)) { // We don't need good precision
|
||||
self::set_stored_conversion_rate('BTC', $Rate);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($USD = file_get_contents(USD_API_URL)) {
|
||||
// Valid JSON isn't returned so we make it valid.
|
||||
$Replace = array(
|
||||
'lhs' => '"lhs"',
|
||||
'rhs' => '"rhs"',
|
||||
'error' => '"error"',
|
||||
'icc' => '"icc"'
|
||||
);
|
||||
|
||||
$USD = str_replace(array_keys($Replace), array_values($Replace), $USD);
|
||||
$USD = json_decode($USD, true);
|
||||
if (isset($USD['rhs'])) {
|
||||
// The response is in format "# Euroes", extracts the numbers.
|
||||
$Rate = preg_split("/[\s,]+/", $USD['rhs']);
|
||||
if ($Rate = round($Rate[0], 4)) { // We don't need good precision
|
||||
self::set_stored_conversion_rate('USD', $Rate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function get_forum_description() {
|
||||
return self::$ForumDescriptions[rand(0, count(self::$ForumDescriptions) - 1)];
|
||||
}
|
||||
|
||||
private static function get_pm_body($Source, $Currency, $DonationAmount, $ReceivedRank, $CurrentRank, $Lang) {
|
||||
if ($Currency != 'BTC') {
|
||||
$DonationAmount = number_format($DonationAmount, 2);
|
||||
}
|
||||
if ($CurrentRank >= MAX_RANK) {
|
||||
$CurrentRank = MAX_RANK - 1;
|
||||
} elseif ($CurrentRank == 5) {
|
||||
$CurrentRank = 4;
|
||||
}
|
||||
return t('server.inbox.get_pm_body_1', ['Values' => [$Lang]])
|
||||
. " $DonationAmount $Currency\n"
|
||||
. t('server.inbox.get_pm_body_2', ['Values' => [$Lang]])
|
||||
. " $ReceivedRank "
|
||||
. t('server.inbox.get_pm_body_3', ['Values' => [$Lang]])
|
||||
. ($ReceivedRank == 1 ? '' : t('server.inbox.s', ['Values' => [$Lang]]))
|
||||
. "\n"
|
||||
. t('server.inbox.get_pm_body_4', ['Values' => [$Lang]])
|
||||
. " $CurrentRank\n"
|
||||
. t('server.inbox.get_pm_body_5', ['Values' => [$Lang]]);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
<?
|
||||
|
||||
use Gazelle\Manager\Donation;
|
||||
|
||||
class DonationsBitcoin {
|
||||
/**
|
||||
* Ask bitcoind for a list of all addresses that have received bitcoins
|
||||
@@ -159,7 +162,8 @@ class DonationsBitcoin {
|
||||
}
|
||||
$Debug->log_var($NewDonations, '$NewDonations');
|
||||
foreach (self::get_userids(array_keys($NewDonations)) as $Address => $UserID) {
|
||||
Donations::regular_donate($UserID, $NewDonations[$Address], 'Bitcoin Parser', '', 'BTC');
|
||||
$donation = new Donation;
|
||||
$donation->regularDonate($UserID, $NewDonations[$Address], 'Bitcoin Parser', '', 'BTC');
|
||||
self::store_donation($Address, $NewDonations[$Address]);
|
||||
}
|
||||
G::$Cache->cache_value('btc_total_received', $NewAmount, 0);
|
||||
|
||||
@@ -171,6 +171,7 @@ class DonationsView {
|
||||
}
|
||||
|
||||
public static function render_rank($rank, $specialRank, $ShowOverflow = true) {
|
||||
echo Donation::rankLabel($rank, $specialRank, $ShowOverflow);
|
||||
$donate = new Donation;
|
||||
echo $donate->rankLabel($rank, $specialRank, $ShowOverflow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,4 +23,67 @@ class Reports {
|
||||
}
|
||||
return $RemasterDisplayString;
|
||||
}
|
||||
|
||||
//Used to get reports info on a unison cache in both browsing pages and torrent pages.
|
||||
public static function get_reports($TorrentID) {
|
||||
$Reports = G::$Cache->get_value("reports_torrent_$TorrentID");
|
||||
if ($Reports === false) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("
|
||||
SELECT
|
||||
ID,
|
||||
ReporterID,
|
||||
Type,
|
||||
UserComment,
|
||||
ReportedTime,
|
||||
UploaderReply,
|
||||
ReplyTime
|
||||
FROM reportsv2
|
||||
WHERE TorrentID = $TorrentID
|
||||
AND Status != 'Resolved'");
|
||||
$Reports = G::$DB->to_array(false, MYSQLI_ASSOC);
|
||||
G::$DB->set_query_id($QueryID);
|
||||
G::$Cache->cache_value("reports_torrent_$TorrentID", $Reports, 0);
|
||||
}
|
||||
if (!check_perms('admin_reports')) {
|
||||
$Return = array();
|
||||
foreach ($Reports as $Report) {
|
||||
if ($Report['Type'] !== 'edited') {
|
||||
$Return[] = $Report;
|
||||
}
|
||||
}
|
||||
return $Return;
|
||||
}
|
||||
return $Reports;
|
||||
}
|
||||
|
||||
public static function get_reports_messages(array $ReportIDs) {
|
||||
$Ret = [];
|
||||
if (count($ReportIDs) <= 0) {
|
||||
return $Ret;
|
||||
}
|
||||
G::$DB->prepared_query(
|
||||
"SELECT
|
||||
ReportID,
|
||||
SentDate,
|
||||
SenderID,
|
||||
Body
|
||||
FROM reports_message
|
||||
WHERE ReportID in (" . implode(",", $ReportIDs) . ")"
|
||||
);
|
||||
$Reports = G::$DB->to_array(false, MYSQLI_ASSOC);
|
||||
foreach ($Reports as $Report) {
|
||||
$Ret[$Report['ReportID']][] = $Report;
|
||||
}
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
public static function add_reports_messages($ReportID, $UserID, $Body) {
|
||||
G::$DB->prepared_query(
|
||||
"INSERT INTO reports_message (ReportID,SentDate,SenderID,Body) VALUES (?, now(), ?, ?)",
|
||||
$ReportID,
|
||||
$UserID,
|
||||
$Body
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ class Requests {
|
||||
REPLACE INTO sphinx_requests_delta (
|
||||
ID, UserID, TimeAdded, LastVote, CategoryID, Title, TagList,
|
||||
Year, ReleaseType, CodecList, SourceList, ContainerList, ResolutionList, FillerID, TorrentID,
|
||||
TimeFilled, Visible, Votes, Bounty)
|
||||
TimeFilled, Visible, Votes, Bounty, RequestType)
|
||||
SELECT
|
||||
ID, r.UserID, UNIX_TIMESTAMP(TimeAdded) AS TimeAdded,
|
||||
UNIX_TIMESTAMP(LastVote) AS LastVote, CategoryID, Title, '$TagList',
|
||||
Year, ReleaseType, CodecList, SourceList, ContainerList, ResolutionList, FillerID, TorrentID,
|
||||
UNIX_TIMESTAMP(TimeFilled) AS TimeFilled, Visible,
|
||||
COUNT(rv.UserID) AS Votes, SUM(rv.Bounty) >> 20 AS Bounty
|
||||
COUNT(rv.UserID) AS Votes, SUM(rv.Bounty) >> 20 AS Bounty, RequestType
|
||||
FROM requests AS r
|
||||
LEFT JOIN requests_votes AS rv ON rv.RequestID = r.ID
|
||||
WHERE ID = $RequestID
|
||||
@@ -111,7 +111,8 @@ class Requests {
|
||||
FillerID,
|
||||
TorrentID,
|
||||
TimeFilled,
|
||||
GroupID
|
||||
GroupID,
|
||||
RequestType
|
||||
FROM requests
|
||||
WHERE ID IN ($IDs)
|
||||
ORDER BY ID");
|
||||
@@ -264,6 +265,28 @@ class Requests {
|
||||
return self::get_requests($Requests);
|
||||
}
|
||||
|
||||
public static function get_torrent_request_id($TorrentID, $RequestType) {
|
||||
G::$DB->query(
|
||||
"SELECT
|
||||
r.ID,
|
||||
SourceTorrent
|
||||
FROM requests AS r
|
||||
JOIN torrents AS t ON t.ID =$TorrentID and t.GroupID = r.GroupID
|
||||
WHERE r.RequestType = $RequestType and r.FillerID = '0'"
|
||||
);
|
||||
|
||||
$Requests = G::$DB->to_array('ID', MYSQLI_ASSOC, false);
|
||||
foreach ($Requests as $ID => $Request) {
|
||||
if (!preg_match('/' . TORRENT_REGEX . '/i', $Request['SourceTorrent'], $Matches)) {
|
||||
continue;
|
||||
}
|
||||
if ($Matches[2] == $TorrentID) {
|
||||
return $ID;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function get_artist_requests($ArtistID) {
|
||||
$DB = G::$DB;
|
||||
$Cache = G::$Cache;
|
||||
|
||||
@@ -1491,9 +1491,9 @@ class Text {
|
||||
$Block['Val'] = str_replace("\r", "\n", $Block['Val']);
|
||||
$Images = [];
|
||||
foreach ($Block['Val'] as $value) {
|
||||
if (is_array($value) && isset($value['Attr'])) {
|
||||
if (is_array($value) && !empty($value['Attr'])) {
|
||||
$Images[] = "'" . $value['Attr'] . "'";
|
||||
} else if (is_array($value) && isset($value['Val'])) {
|
||||
} else if (is_array($value) && !empty($value['Val'])) {
|
||||
$Images[] = "'" . $value['Val'] . "'";
|
||||
}
|
||||
}
|
||||
|
||||
+17
-13
@@ -590,17 +590,6 @@ class Torrents {
|
||||
G::$DB->set_query_id($QueryID);
|
||||
}
|
||||
|
||||
public static function write_group_log_with_time($GroupID, $TorrentID, $UserID, $Message, $Hidden) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
G::$DB->query("
|
||||
INSERT INTO group_log
|
||||
(GroupID, TorrentID, UserID, Info, Time, Hidden)
|
||||
VALUES
|
||||
($GroupID, $TorrentID, $UserID, '" . db_string($Message) . "', '" . Time::sqlTime() . "', $Hidden)");
|
||||
G::$DB->set_query_id($QueryID);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a torrent.
|
||||
*
|
||||
@@ -1412,12 +1401,12 @@ WHERE ud.TorrentID=? AND ui.NotifyOnDeleteDownloaded='1' AND ud.UserID NOT IN ({
|
||||
|
||||
foreach ($Torrents as $Torrent) {
|
||||
list($TorrentID, $GroupID, $InfoHash) = $Torrent;
|
||||
G::$Cache->delete_value("torrents_details_$GroupID");
|
||||
if ($LimitTime !== null) {
|
||||
G::$DB->query("
|
||||
INSERT INTO `freetorrents_timed`(`TorrentID`, `EndTime`)
|
||||
VALUES ($TorrentID, '$LimitTime') ON DUPLICATE KEY UPDATE EndTime=VALUES(EndTime)");
|
||||
}
|
||||
|
||||
Tracker::update_tracker('update_torrent', array('info_hash' => rawurlencode($InfoHash), 'freetorrent' => $FreeNeutral));
|
||||
G::$Cache->delete_value("torrent_download_$TorrentID");
|
||||
Misc::write_log(($Schedule ? "Schedule" : G::$LoggedUser['Username']) . " marked torrent $TorrentID freeleech $FreeNeutral type $FreeLeechType!");
|
||||
@@ -1504,7 +1493,7 @@ WHERE ud.TorrentID=? AND ui.NotifyOnDeleteDownloaded='1' AND ud.UserID NOT IN ({
|
||||
return (G::$LoggedUser['FLTokens'] >= 1
|
||||
&& !$Torrent['PersonalFL']
|
||||
&& (in_array($Torrent['FreeTorrent'], [self::OneFourthOff, self::TwoFourthOff, self::ThreeFourthOff]) || empty($Torrent['FreeTorrent']))
|
||||
&& G::$LoggedUser['CanLeech'] == self::FREE);
|
||||
&& G::$LoggedUser['CanLeech'] == 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2143,4 +2132,19 @@ WHERE ud.TorrentID=? AND ui.NotifyOnDeleteDownloaded='1' AND ud.UserID NOT IN ({
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function render_media_info($MediaInfo) {
|
||||
$Index = 0;
|
||||
$MediaInfoObj = json_decode($MediaInfo);
|
||||
if (is_array($MediaInfoObj)) {
|
||||
foreach ($MediaInfoObj as $MediaInfo) {
|
||||
$MediaInfo = ltrim(trim($MediaInfo), '[mediainfo]');
|
||||
$MediaInfo = ltrim(trim($MediaInfo), '[bdinfo]');
|
||||
$MediaInfo = rtrim(trim($MediaInfo), '[/mediainfo]');
|
||||
$MediaInfo = rtrim(trim($MediaInfo), '[/bdinfo]');
|
||||
echo ($Index > 0 ? "<br>" : "") . Text::full_format('[mediainfo]' . $MediaInfo . '[/mediainfo]');
|
||||
$Index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,6 +189,7 @@ class TorrentTableView {
|
||||
protected $CheckSelfTorrents;
|
||||
protected $AllUncheckedCnt = 0;
|
||||
protected $PageUncheckedCnt = 0;
|
||||
protected $TableTorrentClass;
|
||||
/**
|
||||
* @var DetailOption $DetailOption
|
||||
*/
|
||||
@@ -327,7 +328,7 @@ class TorrentTableView {
|
||||
time() - strtotime($LastReseedRequest) >= 864000) ||
|
||||
check_perms('users_mod'))
|
||||
) {
|
||||
?><a href="torrents.php?action=reseed&torrentid=<?= $TorrentID ?>&groupid=<?= $GroupID ?>" class="brackets" onclick="return confirm('<?= t('server.torrents.request_re_seed_confirm') ?>');"><?= t('server.torrents.request_re_seed') ?></a>
|
||||
?><a href="requests.php?action=new&type=2&torrentid=<?= $TorrentID ?>&groupid=<?= $GroupID ?>" class="brackets"><?= t('server.torrents.request_re_seed') ?></a>
|
||||
<?
|
||||
} ?>
|
||||
<? if (check_perms('site_moderate_requests')) { ?>
|
||||
@@ -567,18 +568,7 @@ class TorrentTableView {
|
||||
<div class=" TorrentDetail-row is-mediainfo is-block">
|
||||
<strong class="TorrentDetailSubtitle-title" id="subtitles_box_title"><?= t('server.torrents.media_info') ?>:</strong>
|
||||
<?
|
||||
$Index = 0;
|
||||
$MediaInfoObj = json_decode($MediaInfos);
|
||||
if (is_array($MediaInfoObj)) {
|
||||
foreach ($MediaInfoObj as $MediaInfo) {
|
||||
$MediaInfo = ltrim(trim($MediaInfo), '[mediainfo]');
|
||||
$MediaInfo = ltrim(trim($MediaInfo), '[bdinfo]');
|
||||
$MediaInfo = rtrim(trim($MediaInfo), '[/mediainfo]');
|
||||
$MediaInfo = rtrim(trim($MediaInfo), '[/bdinfo]');
|
||||
echo ($Index > 0 ? "<br>" : "") . Text::full_format('[mediainfo]' . $MediaInfo . '[/mediainfo]');
|
||||
$Index++;
|
||||
}
|
||||
}
|
||||
Torrents::render_media_info($MediaInfos);
|
||||
?>
|
||||
</div>
|
||||
<? } ?>
|
||||
|
||||
+8
-1
@@ -196,7 +196,7 @@ function FL_confirmation_msg($seeders, $Size) {
|
||||
/* Coder Beware: this text is emitted as part of a Javascript single quoted string.
|
||||
* Any apostrophes should be avoided or escaped appropriately (with \\').
|
||||
*/
|
||||
$TokenUses = ceil($Size / (5 * 1024 * 1024 * 1024));
|
||||
$TokenUses = 1;
|
||||
$FTStr = t('server.common.n_fl_token', ['Count' => $TokenUses, 'Values' => [$TokenUses]]);
|
||||
return ($seeders == 0)
|
||||
? t('server.common.not_seeded_sure_use_fl', ['Values' => [$FTStr]])
|
||||
@@ -368,3 +368,10 @@ function get_by_path($Object, $Path, $DefaultValue = null) {
|
||||
}
|
||||
return $Value;
|
||||
}
|
||||
|
||||
function add_day($date, $day) {
|
||||
$timestamp = strtotime($date);
|
||||
$timestamp = strtotime("+$day days", $timestamp);
|
||||
$newDate = date('Y-m-d', $timestamp);
|
||||
return $newDate;
|
||||
}
|
||||
|
||||
+13
-1
@@ -139,7 +139,19 @@ class View {
|
||||
<div class="BodyNavLinks">
|
||||
<?= $Pages ?>
|
||||
</div>
|
||||
<?
|
||||
<?
|
||||
}
|
||||
}
|
||||
|
||||
public static function long_text($ID, $Text, $Lines) {
|
||||
?>
|
||||
<div class="LongText">
|
||||
<input id="<?= $ID ?>" class="LongText-exp" type="checkbox">
|
||||
<div class="LongText-text LongText-line-<?= $Lines ?>">
|
||||
<label class="LongText-btn" for="<?= $ID ?>" data-more-content=<?= t('server.text.more') ?> , data-less-content="<?= t('server.text.collapse') ?>"></label>
|
||||
<?= $Text ?>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
}
|
||||
|
||||
+21
-1
@@ -92,6 +92,7 @@ $CONFIG['USER_LIMIT'] = 5000; //The maximum number of users the site can have, 0
|
||||
|
||||
$CONFIG['REQUEST_TAX'] = 0.0; //Percentage Tax (0 - 1) to charge users on making requests
|
||||
$CONFIG['REQUEST_MIN_VOTE'] = 1 * 1024 * 1024 * 1024;
|
||||
$CONFIG['REQUEST_FILL_FREE_HOUR'] = 0;
|
||||
|
||||
$CONFIG['STARTING_UPLOAD'] = 3221225472; //Upload given to newly registered users, in bytes using IEC standard (1024 bytes per KiB)
|
||||
|
||||
@@ -234,12 +235,15 @@ $CONFIG['DONATE_MONTH_GOAL'] = 75;
|
||||
$CONFIG['GLOBAL_FREELEECH'] = false;
|
||||
|
||||
$CONFIG['FEATURE_EMAIL_REENABLE'] = true;
|
||||
|
||||
$CONFIG['FREE_PROBABILITY'] = 20;
|
||||
$CONFIG['TORRENT_UPLOAD_FREE'] = false;
|
||||
$CONFIG['TORRENT_UPLOAD_FREE_HOUR'] = 48;
|
||||
$CONFIG['PG_TORRENT_UPLOAD_FREE_HOUR'] = 168;
|
||||
|
||||
$CONFIG['PUSH_CONFIG_SOCKET_LISTEN_ADDRESS'] = "127.0.0.1";
|
||||
$CONFIG['PUSH_CONFIG_SOCKET_LISTEN_PORT'] = 6789;
|
||||
|
||||
$CONFIG['TORRENT_UPLOAD_FREE'] = false;
|
||||
|
||||
$CONFIG['SECONDARY_CLASS'] = [];
|
||||
|
||||
@@ -249,6 +253,9 @@ $CONFIG['UPLOAD_RANK_SHOW_END_TIME'] = '0000-00-00 00:00:00';
|
||||
$CONFIG['RELEASE_GROUP'] = [];
|
||||
$CONFIG['RELEASE_GROUP_MEMBER'] = [];
|
||||
|
||||
|
||||
|
||||
|
||||
$PointRadios = [
|
||||
'DownloadCount' => 0.75,
|
||||
'UploadCount' => 1,
|
||||
@@ -276,3 +283,16 @@ $Bases = [
|
||||
"First Line Support" => 3000,
|
||||
"Translators" => 3000,
|
||||
];
|
||||
|
||||
$BaseRewardConfig = [
|
||||
'upload_torrent' => [
|
||||
'token' => 0,
|
||||
'token_valid_day' => 0,
|
||||
|
||||
'invite' => 0,
|
||||
'invite_valid_day' => 0,
|
||||
|
||||
'bonus' => 0,
|
||||
'badge_id' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
class SeedRequest extends AbstractMigration {
|
||||
/**
|
||||
* Change Method.
|
||||
*
|
||||
* Write your reversible migrations using this method.
|
||||
*
|
||||
* More information on writing migrations is available here:
|
||||
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
||||
*
|
||||
* The following commands can be used in this method and Phinx will
|
||||
* automatically reverse them when rolling back:
|
||||
*
|
||||
* createTable
|
||||
* renameTable
|
||||
* addColumn
|
||||
* addCustomColumn
|
||||
* renameColumn
|
||||
* addIndex
|
||||
* addForeignKey
|
||||
*
|
||||
* Any other destructive changes will result in an error when trying to
|
||||
* rollback the migration.
|
||||
*
|
||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||
* with the Table class.
|
||||
*/
|
||||
public function change() {
|
||||
$this->table('sphinx_requests')
|
||||
->addColumn('RequestType', 'integer', ['default' => 1])->save();
|
||||
$this->table('sphinx_requests_delta')
|
||||
->addColumn('RequestType', 'integer', ['default' => 1])->save();
|
||||
$this->table('requests')
|
||||
->addColumn('RequestType', 'integer', ['default' => 1])->save();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
class ReportsMessage extends AbstractMigration {
|
||||
/**
|
||||
* Change Method.
|
||||
*
|
||||
* Write your reversible migrations using this method.
|
||||
*
|
||||
* More information on writing migrations is available here:
|
||||
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
||||
*
|
||||
* The following commands can be used in this method and Phinx will
|
||||
* automatically reverse them when rolling back:
|
||||
*
|
||||
* createTable
|
||||
* renameTable
|
||||
* addColumn
|
||||
* addCustomColumn
|
||||
* renameColumn
|
||||
* addIndex
|
||||
* addForeignKey
|
||||
*
|
||||
* Any other destructive changes will result in an error when trying to
|
||||
* rollback the migration.
|
||||
*
|
||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||
* with the Table class.
|
||||
*/
|
||||
public function change() {
|
||||
$this->table('reports_message')
|
||||
->addColumn('ReportID', 'integer')
|
||||
->addColumn('SentDate', 'datetime')
|
||||
->addColumn('SenderID', 'integer')
|
||||
->addColumn('Body', 'text')
|
||||
->addIndex(['ReportID'])
|
||||
->save();
|
||||
$builder = $this->getQueryBuilder('select');
|
||||
$statement = $builder->select('*')->from('reportsv2')->execute();
|
||||
foreach ($statement->fetchAll('assoc') as $line) {
|
||||
if (empty($line['UploaderReply'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$builder = $this->getQueryBuilder('select');
|
||||
$statement = $builder->select('UserID')->where(['ID' => $line['TorrentID']])->from('torrents')->execute();
|
||||
$Torrent = $statement->fetch('assoc');
|
||||
$UploaderID = $Torrent['UserID'];
|
||||
if (empty($UploaderID)) {
|
||||
continue;
|
||||
}
|
||||
$builder = $this->getQueryBuilder('insert');
|
||||
$builder
|
||||
->insert(['ReportID', 'SentDate', 'SenderID', 'Body'])
|
||||
->into('reports_message')
|
||||
->values(['ReportID' => $line['ID'], 'SentDate' => $line['ReplyTime'], 'SenderID' => $UploaderID, 'Body' => $line['UploaderReply']])
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,7 @@ switch ($Document) {
|
||||
case 'activity':
|
||||
case 'badges':
|
||||
case 'subtitles':
|
||||
case 'task':
|
||||
$Valid = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -120,10 +120,12 @@ function AddMore(view, id) {
|
||||
}
|
||||
}
|
||||
|
||||
function SendPM(reportid) {
|
||||
function SendPM(idx, reportid) {
|
||||
$.post('reportsv2.php?action=ajax_take_pm', $('#reportform_' + reportid).serialize(), function (response) {
|
||||
$('#uploader_pm_' + reportid).val(response)
|
||||
})
|
||||
window.location = '#' + idx + 1
|
||||
location.reload()
|
||||
}
|
||||
|
||||
function UpdateComment(reportid) {
|
||||
|
||||
@@ -80,7 +80,7 @@ foreach ($GroupIDs as $GroupID) {
|
||||
'leechers' => (int)$Torrent['Leechers'],
|
||||
'snatched' => (int)$Torrent['Snatched'],
|
||||
'freeTorrent' => Torrents::torrent_freeleech($Torrent),
|
||||
'reported' => (count(Torrents::get_reports((int)$Torrent['ID'])) > 0),
|
||||
'reported' => (count(Reports::get_reports((int)$Torrent['ID'])) > 0),
|
||||
'time' => $Torrent['Time']
|
||||
);
|
||||
}
|
||||
|
||||
@@ -302,7 +302,8 @@ if ($NumResults == 0) {
|
||||
'fillerId' => (int)$Request['FillerID'],
|
||||
'fillerName' => $Filler ? $Filler['Username'] : '',
|
||||
'torrentId' => (int)$Request['TorrentID'],
|
||||
'timeFilled' => $Request['TimeFilled'] == 0 ? '' : $Request['TimeFilled']
|
||||
'timeFilled' => $Request['TimeFilled'] == 0 ? '' : $Request['TimeFilled'],
|
||||
'requestType' => $Request['RequestType'],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ $JsonTorrentDetails = array(
|
||||
'language' => $TorrentDetails['Language'],
|
||||
);
|
||||
|
||||
$Reports = Torrents::get_reports($TorrentID);
|
||||
$Reports = Reports::get_reports($TorrentID);
|
||||
if (count($Reports) > 0) {
|
||||
$Torrent['Reported'] = true;
|
||||
} else {
|
||||
|
||||
@@ -66,7 +66,7 @@ foreach ($TorrentList as $Torrent) {
|
||||
unset($File);
|
||||
$FileList = implode('|||', $FileList);
|
||||
$Userinfo = Users::user_info($Torrent['UserID']);
|
||||
$Reports = Torrents::get_reports($Torrent['ID']);
|
||||
$Reports = Reports::get_reports($Torrent['ID']);
|
||||
$Torrent['Reported'] = count($Reports) > 0;
|
||||
$JsonTorrentList[] = array(
|
||||
'id' => (int)$Torrent['ID'],
|
||||
|
||||
@@ -47,7 +47,6 @@ View::show_header(t('server.apply.apply'), 'apply,bbcode', 'PageApplyApply');
|
||||
<?= t('server.apply.open_roles') ?></div>
|
||||
</div>
|
||||
<div class="Group-body">
|
||||
<div><?= t('server.apply.referral_note') ?></div>
|
||||
<? foreach ($Roles as $title => $info) { ?>
|
||||
<div class="Box">
|
||||
<div class="Box-header">
|
||||
|
||||
@@ -558,6 +558,9 @@ View::show_header($ArtistHeaderName, 'browse,bbcode,comments,voting,recommend,su
|
||||
<td class="Table-cell">
|
||||
<?= t('server.artist.request_name') ?>
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.request_type') ?>
|
||||
</td>
|
||||
<td class="Table-cell TableRequest-cellValue">
|
||||
<?= t('server.artist.vote') ?>
|
||||
</td>
|
||||
@@ -572,6 +575,7 @@ View::show_header($ArtistHeaderName, 'browse,bbcode,comments,voting,recommend,su
|
||||
foreach ($Requests as $Request) {
|
||||
$RequestVotes = Requests::get_votes_array($Request['ID']);
|
||||
$RequestID = $Request['ID'];
|
||||
$RequestType = $Request['RequestType'];
|
||||
$RequestName = Torrents::group_name($Request, false);
|
||||
$FullName = "<a href=\"requests.php?action=view&id=$RequestID\">$RequestName</a>";
|
||||
$Tags = $Request['Tags'];
|
||||
@@ -581,10 +585,22 @@ View::show_header($ArtistHeaderName, 'browse,bbcode,comments,voting,recommend,su
|
||||
<?= $FullName ?>
|
||||
<div class="torrent_info">
|
||||
<?
|
||||
if ($RequestType == 2) {
|
||||
?>
|
||||
<a href="<?= $Request['SourceTorrent'] ?>"><?= str_replace('|', ', ', $Request['CodecList']) . ' / ' . str_replace('|', ', ', $Request['SourceList']) . ' / ' . str_replace('|', ', ', $Request['ResolutionList']) . ' / ' . str_replace('|', ', ', $Request['ContainerList']) ?></a>
|
||||
<?
|
||||
} else {
|
||||
?>
|
||||
<?= str_replace('|', ', ', $Request['CodecList']) . ' / ' . str_replace('|', ', ', $Request['SourceList']) . ' / ' . str_replace('|', ', ', $Request['ResolutionList']) . ' / ' . str_replace('|', ', ', $Request['ContainerList']) ?>
|
||||
<?
|
||||
|
||||
}
|
||||
?>
|
||||
<?= str_replace('|', ', ', $Request['CodecList']) . ' / ' . str_replace('|', ', ', $Request['SourceList']) . ' / ' . str_replace('|', ', ', $Request['ResolutionList']) . ' / ' . str_replace('|', ', ', $Request['ContainerList']) ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="TableRequest-cellType Table-cell">
|
||||
<?= $RequestType == 2 ? t('server.requests.seed_torrent') : t('server.requests.new_torrent') ?>
|
||||
</td>
|
||||
<td class="TableRequest-cellVotes Table-cell TableRequest-cellValue">
|
||||
<span id="vote_count_<?= $Request['ID'] ?>"><?= count($RequestVotes['Voters']) ?></span>
|
||||
<? if (check_perms('site_vote')) { ?>
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
The page that handles the backend of the 'edit artist' function.
|
||||
\*********************************************************************/
|
||||
|
||||
use Gazelle\Manager\ActionTrigger;
|
||||
|
||||
authorize();
|
||||
|
||||
if (!$_REQUEST['artistid'] || !is_number($_REQUEST['artistid'])) {
|
||||
@@ -112,6 +114,8 @@ $DB->query(
|
||||
|
||||
// There we go, all done!
|
||||
$Cache->delete_value("artist_$ArtistID"); // Delete artist cache
|
||||
$trigger = new ActionTrigger;
|
||||
$trigger->triggerArtistEdit($ArtistID);
|
||||
|
||||
// delete group artist cache;
|
||||
$DB->query(
|
||||
|
||||
@@ -41,13 +41,18 @@ foreach ($GroupIDs as $Idx => $GroupID) {
|
||||
// Handle stats and stuff
|
||||
$NumGroups++;
|
||||
extract(Torrents::array_group($TorrentList[$GroupID]));
|
||||
$ArtistSet = [];
|
||||
foreach ($Artists as $Importance => $ImportanceArtists) {
|
||||
foreach ($ImportanceArtists as $Artist) {
|
||||
if (isset($ArtistSet[$Artist['ArtistID']])) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($TopArtists[$Artist['ArtistID']])) {
|
||||
$TopArtists[$Artist['ArtistID']] = array('data' => $Artist, 'count' => 1);
|
||||
} else {
|
||||
$TopArtists[$Artist['ArtistID']]['count']++;
|
||||
}
|
||||
$ArtistSet[$Artist['ArtistID']] = true;
|
||||
}
|
||||
}
|
||||
new Tags(Torrents::tags($TorrentList[$GroupID]));
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?
|
||||
|
||||
use Gazelle\Manager\ActionTrigger;
|
||||
|
||||
authorize();
|
||||
|
||||
include(CONFIG['SERVER_ROOT'] . '/classes/validate.class.php');
|
||||
@@ -7,6 +9,7 @@ $Val = new VALIDATE;
|
||||
$FromAjax = isset($_POST['groupid']);
|
||||
function add_torrent($CollageID, $GroupID) {
|
||||
global $Cache, $LoggedUser, $DB;
|
||||
$trigger = new ActionTrigger;
|
||||
|
||||
$DB->query("
|
||||
SELECT MAX(Sort)
|
||||
@@ -36,6 +39,8 @@ function add_torrent($CollageID, $GroupID) {
|
||||
$Cache->delete_value("torrents_details_$GroupID");
|
||||
$Cache->delete_value("torrent_collages_$GroupID");
|
||||
$Cache->delete_value("torrent_collages_personal_$GroupID");
|
||||
$trigger->triggerFillCollage($CollageID, $GroupID);
|
||||
|
||||
|
||||
$DB->query("
|
||||
SELECT UserID
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Gazelle\Manager\ActionTrigger;
|
||||
|
||||
authorize();
|
||||
|
||||
include(CONFIG['SERVER_ROOT'] . '/classes/validate.class.php');
|
||||
@@ -90,4 +93,7 @@ $DB->query("
|
||||
$CollageID = $DB->inserted_id();
|
||||
$Cache->delete_value("collage_$CollageID");
|
||||
Misc::write_log("Collage $CollageID (" . $_POST['name'] . ') was created by ' . $LoggedUser['Username']);
|
||||
|
||||
$trigger = new ActionTrigger;
|
||||
$trigger->triggerCreateCollage($CollageID);
|
||||
header("Location: collages.php?id=$CollageID");
|
||||
|
||||
@@ -52,14 +52,19 @@ foreach ($GroupIDs as $Idx => $GroupID) {
|
||||
if ($UserID == G::$LoggedUser['ID']) {
|
||||
$NumGroupsByUser++;
|
||||
}
|
||||
$ArtistSet = [];
|
||||
|
||||
foreach ($Artists as $Importance => $ImportanceArtists) {
|
||||
foreach ($ImportanceArtists as $Artist) {
|
||||
if (isset($ArtistSet[$Artist['ArtistID']])) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($TopArtists[$Artist['ArtistID']])) {
|
||||
$TopArtists[$Artist['ArtistID']] = array('data' => $Artist, 'count' => 1);
|
||||
} else {
|
||||
$TopArtists[$Artist['ArtistID']]['count']++;
|
||||
}
|
||||
$ArtistSet[$Artist['ArtistID']] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?
|
||||
|
||||
use Gazelle\Manager\Donation;
|
||||
|
||||
$LastRead = Forums::get_last_read($Forums);
|
||||
View::show_header(t('server.forums.forums'), '', 'PageForumHome');
|
||||
?>
|
||||
@@ -18,7 +21,8 @@ View::show_header(t('server.forums.forums'), '', 'PageForumHome');
|
||||
continue;
|
||||
}
|
||||
if ($ForumID == CONFIG['DONOR_FORUM']) {
|
||||
$ForumDescription = Donations::get_forum_description();
|
||||
$donation = new Donation;
|
||||
$ForumDescription = $donation->forumDescription();
|
||||
}
|
||||
$TooltipTheme = $ForumID == CONFIG['DONOR_FORUM'] ? 'gold' : '';
|
||||
$Row = $Row === 'a' ? 'b' : 'a';
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Gazelle\Manager\ActionTrigger;
|
||||
|
||||
authorize();
|
||||
|
||||
/*
|
||||
@@ -88,6 +91,9 @@ $DB->query("
|
||||
('" . db_string($Title) . "', '" . $LoggedUser['ID'] . "', '$ForumID', '" . $sqltime . "', '" . $LoggedUser['ID'] . "', '" . $sqltime . "')");
|
||||
$TopicID = $DB->inserted_id();
|
||||
|
||||
$trigger = new ActionTrigger;
|
||||
$trigger->triggerCreateTopic($TopicID);
|
||||
|
||||
$DB->query("
|
||||
INSERT INTO forums_posts
|
||||
(TopicID, AuthorID, AddedTime, Body)
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Gazelle\Manager\ActionTrigger;
|
||||
|
||||
authorize();
|
||||
|
||||
//TODO: Remove all the stupid queries that could get their information just as easily from the cache
|
||||
@@ -130,6 +133,10 @@ if ($ThreadInfo['LastPostAuthorID'] == $LoggedUser['ID'] && isset($_POST['merge'
|
||||
|
||||
$PostID = $DB->inserted_id();
|
||||
|
||||
$trigger = new ActionTrigger;
|
||||
$trigger->triggerPostComment($PostID);
|
||||
|
||||
|
||||
//This updates the root index
|
||||
$DB->query("
|
||||
UPDATE forums
|
||||
|
||||
+32
-32
@@ -209,23 +209,23 @@ View::show_header(t('server.index.index'), 'comments', 'PageHome');
|
||||
<? } ?>
|
||||
|
||||
|
||||
<? if(is_array(CONFIG['INDEX_FORUM_IDS'])) {
|
||||
<? if (is_array(CONFIG['INDEX_FORUM_IDS'])) {
|
||||
|
||||
foreach (CONFIG['INDEX_FORUM_IDS'] as $ForumId) {
|
||||
|
||||
if(Forums::check_forumperm($ForumId)) {
|
||||
$ForumsInfo = Forums::get_forum_info($ForumId);
|
||||
if (Forums::check_forumperm($ForumId)) {
|
||||
$ForumsInfo = Forums::get_forum_info($ForumId);
|
||||
?>
|
||||
|
||||
<div class="SidebarItemStaffBlog SidebarItem Box">
|
||||
<div class="SidebarItem-header Box-header">
|
||||
<a href="forums.php?action=viewforum&forumid=<?= $ForumId ?>"><?= $ForumsInfo['Name'] ?></a>
|
||||
</div>
|
||||
<div class="SidebarItemStaffBlog SidebarItem Box">
|
||||
<div class="SidebarItem-header Box-header">
|
||||
<a href="forums.php?action=viewforum&forumid=<?= $ForumId ?>"><?= $ForumsInfo['Name'] ?></a>
|
||||
</div>
|
||||
|
||||
<?
|
||||
$Forum = $Cache->get_value("forums_index_$ForumId");
|
||||
if (!isset($Forum) || !is_array($Forum)) {
|
||||
$DB->query("
|
||||
<?
|
||||
$Forum = $Cache->get_value("forums_index_$ForumId");
|
||||
if (!isset($Forum) || !is_array($Forum)) {
|
||||
$DB->query("
|
||||
SELECT
|
||||
ID,
|
||||
Title,
|
||||
@@ -234,28 +234,28 @@ View::show_header(t('server.index.index'), 'comments', 'PageHome');
|
||||
WHERE ForumID = '$ForumId'
|
||||
ORDER BY CreatedTime DESC
|
||||
LIMIT 5"); // Can be cached until someone makes a new post
|
||||
$Forum = $DB->to_array();
|
||||
$Cache->cache_value("forums_index_$ForumId", $Forum);
|
||||
}
|
||||
?>
|
||||
<ul class="SidebarItem-body Box-body SidebarList is-ordered">
|
||||
<?
|
||||
$End = min(count($Forum), 5);
|
||||
for ($i = 0; $i < $End; $i++) {
|
||||
list($TopicID, $Title) = $Forum[$i];
|
||||
?>
|
||||
<li class="SidebarList-item">
|
||||
<strong>
|
||||
<a href="forums.php?action=viewthread&threadid=<?= $TopicID ?>"><?= $Title ?></a>
|
||||
</strong>
|
||||
</li>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
$Forum = $DB->to_array();
|
||||
$Cache->cache_value("forums_index_$ForumId", $Forum);
|
||||
}
|
||||
?>
|
||||
<ul class="SidebarItem-body Box-body SidebarList is-ordered">
|
||||
<?
|
||||
$End = min(count($Forum), 5);
|
||||
for ($i = 0; $i < $End; $i++) {
|
||||
list($TopicID, $Title) = $Forum[$i];
|
||||
?>
|
||||
<li class="SidebarList-item">
|
||||
<a href="forums.php?action=viewthread&threadid=<?= $TopicID ?>"><?= $Title ?></a>
|
||||
</li>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php }}} ?>
|
||||
<?php }
|
||||
}
|
||||
} ?>
|
||||
|
||||
<!-- Site History -->
|
||||
<?
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
enforce_login();
|
||||
|
||||
if (G::$LoggedUser['DisablePoints']) {
|
||||
error('Your points have been disabled.');
|
||||
}
|
||||
|
||||
$Bonus = new \Gazelle\Bonus(G::$DB, G::$Cache);
|
||||
|
||||
const DEFAULT_PAGE = '/sections/bonus/store.php';
|
||||
|
||||
if (isset($_GET['action'])) {
|
||||
switch ($_GET['action']) {
|
||||
case 'purchase':
|
||||
/* handle validity and cost as early as possible */
|
||||
if (isset($_REQUEST['label']) && preg_match('/^[a-z]{1,15}(-\w{1,15}){0,4}/', $_REQUEST['label'])) {
|
||||
$Label = $_REQUEST['label'];
|
||||
$Item = $Bonus->getItem($Label);
|
||||
if ($Item) {
|
||||
$Price = $Bonus->getEffectivePrice($Label, G::$LoggedUser['EffectiveClass']);
|
||||
if ($Price > G::$LoggedUser['BonusPoints']) {
|
||||
error('You cannot afford this item.');
|
||||
}
|
||||
switch ($Label) {
|
||||
case 'token-1':
|
||||
case 'token-2':
|
||||
case 'token-3':
|
||||
case 'other-1':
|
||||
case 'other-2':
|
||||
case 'other-3':
|
||||
require_once(CONFIG['SERVER_ROOT'] . '/sections/bonus/tokens.php');
|
||||
break;
|
||||
case 'invite':
|
||||
require_once(CONFIG['SERVER_ROOT'] . '/sections/bonus/invite.php');
|
||||
break;
|
||||
case 'title-bb-y':
|
||||
case 'title-bb-n':
|
||||
case 'title-off':
|
||||
require_once(CONFIG['SERVER_ROOT'] . '/sections/bonus/title.php');
|
||||
break;
|
||||
default:
|
||||
require_once(CONFIG['SERVER_ROOT'] . DEFAULT_PAGE);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
require_once(CONFIG['SERVER_ROOT'] . DEFAULT_PAGE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'bprates':
|
||||
require_once(CONFIG['SERVER_ROOT'] . '/sections/bonus/bprates.php');
|
||||
break;
|
||||
case 'title':
|
||||
require_once(CONFIG['SERVER_ROOT'] . '/sections/bonus/title.php');
|
||||
break;
|
||||
case 'history':
|
||||
require_once(CONFIG['SERVER_ROOT'] . '/sections/bonus/history.php');
|
||||
break;
|
||||
default:
|
||||
require_once(CONFIG['SERVER_ROOT'] . DEFAULT_PAGE);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
require_once(CONFIG['SERVER_ROOT'] . DEFAULT_PAGE);
|
||||
}
|
||||
@@ -9,6 +9,8 @@ if (isset($LoggedUser)) {
|
||||
}
|
||||
*/
|
||||
|
||||
use Gazelle\Manager\ActionTrigger;
|
||||
|
||||
include(CONFIG['SERVER_ROOT'] . '/classes/validate.class.php');
|
||||
$Val = new VALIDATE;
|
||||
|
||||
@@ -275,6 +277,8 @@ if (!empty($_REQUEST['confirm'])) {
|
||||
(UserID, InviterID, TreePosition, TreeID, TreeLevel)
|
||||
VALUES
|
||||
('$UserID', '$InviterID', '$TreePosition', '$TreeID', '$TreeLevel')");
|
||||
$trigger = new ActionTrigger;
|
||||
$trigger->triggerInviteeRegister($InviterID);
|
||||
}
|
||||
} else { // No inviter (open registration)
|
||||
$DB->query("
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?
|
||||
|
||||
use Gazelle\Manager\ActionTrigger;
|
||||
|
||||
authorize();
|
||||
|
||||
if (empty($_POST['id']) || !is_number($_POST['id']) || empty($_POST['type']) || ($_POST['type'] !== 'request_update' && empty($_POST['reason']))) {
|
||||
@@ -70,6 +73,9 @@ $DB->query('
|
||||
(' . db_string($LoggedUser['ID']) . ", $ID, '$Short', '" . sqltime() . "', '" . db_string($Reason) . "')");
|
||||
$ReportID = $DB->inserted_id();
|
||||
|
||||
$trigger = new ActionTrigger;
|
||||
$trigger->triggerReport($Short, $ID, $ReportID);
|
||||
|
||||
$Channels = array();
|
||||
|
||||
if ($Short === 'request_update') {
|
||||
|
||||
@@ -9,65 +9,17 @@ if (!check_perms('admin_reports')) {
|
||||
die();
|
||||
}
|
||||
|
||||
$Recipient = $_POST['pm_type'];
|
||||
$TorrentID = $_POST['torrentid'];
|
||||
$ReportID = $_POST['reportid'];
|
||||
|
||||
if (isset($_POST['uploader_pm']) && $_POST['uploader_pm'] != '') {
|
||||
$Message = $_POST['uploader_pm'];
|
||||
Reports::add_reports_messages($ReportID, $LoggedUser['ID'], $_POST['uploader_pm']);
|
||||
if ($DB->affected_rows()) {
|
||||
$Cache->delete_value("reports_torrent_$TorrentID");
|
||||
} else {
|
||||
//No message given
|
||||
die();
|
||||
error(403);
|
||||
}
|
||||
|
||||
if (!is_number($_POST['categoryid']) || !is_number($TorrentID)) {
|
||||
echo 'Hax on category ID!';
|
||||
die();
|
||||
} else {
|
||||
$CategoryID = $_POST['categoryid'];
|
||||
}
|
||||
$UploaderID = $_POST['uploaderid'];
|
||||
$ReporterID = $_POST['reporterid'];
|
||||
|
||||
if (array_key_exists($_POST['type'], $Types[$CategoryID])) {
|
||||
$ReportType = $Types[$CategoryID][$_POST['type']];
|
||||
} elseif (array_key_exists($_POST['type'], $Types['master'])) {
|
||||
$ReportType = $Types['master'][$_POST['type']];
|
||||
} else {
|
||||
//There was a type but it wasn't an option!
|
||||
echo 'Hax on section type';
|
||||
die();
|
||||
}
|
||||
|
||||
if (!isset($_POST['from_delete'])) {
|
||||
$Report = true;
|
||||
} elseif (!is_number($_POST['from_delete'])) {
|
||||
echo 'Hax occurred in from_delete';
|
||||
}
|
||||
|
||||
if ($Recipient == 'Uploader') {
|
||||
$ToID = $_POST['uploaderid'];
|
||||
if ($Report) {
|
||||
$Message = "You uploaded [url=" . site_url() . "torrents.php?torrentid=$TorrentID]the above torrent[/url]. It has been reported for the reason: " . $ReportType['title'] . "\n\n$Message";
|
||||
} else {
|
||||
$Message = "I am PMing you as you are the uploader of [url=" . site_url() . "torrents.php?torrentid=$TorrentID]the above torrent[/url].\n\n$Message";
|
||||
}
|
||||
} elseif ($Recipient == 'Reporter') {
|
||||
$ToID = $_POST['reporterid'];
|
||||
$Message = "You reported [url=" . site_url() . "torrents.php?torrentid=$TorrentID]the above torrent[/url] for the reason " . $ReportType['title'] . ":\n[quote]" . $_POST['report_reason'] . "[/quote]\n$Message";
|
||||
} else {
|
||||
$Err = "Something went horribly wrong";
|
||||
}
|
||||
|
||||
$Subject = $_POST['raw_name'];
|
||||
|
||||
if (!is_number($ToID)) {
|
||||
$Err = "Haxx occurring, non-number present";
|
||||
}
|
||||
|
||||
if ($ToID == $LoggedUser['ID']) {
|
||||
$Err = "That's you!";
|
||||
}
|
||||
|
||||
if (isset($Err)) {
|
||||
echo $Err;
|
||||
} else {
|
||||
Misc::send_pm($ToID, $LoggedUser['ID'], $Subject, $Message);
|
||||
}
|
||||
Misc::send_pm_with_tpl($UploaderID, 'report_reply', ['TorrentID' => $TorrentID, 'Content' => $_POST['uploader_pm']]);
|
||||
|
||||
@@ -1,13 +1,44 @@
|
||||
<?
|
||||
function render_item($Idx, $Report) {
|
||||
function render_item($Idx, $Report, $ReportMessages) {
|
||||
$DB = G::$DB;
|
||||
$Cache = G::$Cache;
|
||||
$LoggedUser = G::$LoggedUser;
|
||||
global $Types;
|
||||
list(
|
||||
$ReportID, $ReporterID, $ReporterName, $TorrentID, $Type, $UserComment, $UploaderReply, $ResolverID, $ResolverName, $Status, $ReportedTime, $LastChangeTime,
|
||||
$ModComment, $Tracks, $Images, $ExtraIDs, $Links, $LogMessage, $GroupName, $GroupID, $ArtistID, $ArtistName, $Year, $CategoryID, $Time, $RemasterTitle,
|
||||
$RemasterYear, $Codec, $Source, $Resolution, $Container, $Size, $UploaderID, $UploaderName
|
||||
$ReportID,
|
||||
$ReporterID,
|
||||
$ReporterName,
|
||||
$TorrentID,
|
||||
$Type,
|
||||
$UserComment,
|
||||
$UploaderReply,
|
||||
$ResolverID,
|
||||
$ResolverName,
|
||||
$Status,
|
||||
$ReportedTime,
|
||||
$LastChangeTime,
|
||||
$ModComment,
|
||||
$Tracks,
|
||||
$Images,
|
||||
$ExtraIDs,
|
||||
$Links,
|
||||
$LogMessage,
|
||||
$GroupName,
|
||||
$GroupID,
|
||||
$ArtistID,
|
||||
$ArtistName,
|
||||
$Year,
|
||||
$CategoryID,
|
||||
$Time,
|
||||
$RemasterTitle,
|
||||
$RemasterYear,
|
||||
$Codec,
|
||||
$Source,
|
||||
$Resolution,
|
||||
$Container,
|
||||
$Size,
|
||||
$UploaderID,
|
||||
$UploaderName
|
||||
) = Misc::display_array($Report, array('ModComment'));
|
||||
if (!$GroupID && $Status != 'Resolved') {
|
||||
//Torrent already deleted
|
||||
@@ -62,14 +93,17 @@ function render_item($Idx, $Report) {
|
||||
<span data-tooltip="<?= t('server.reportsv2.multi_resolve_title') ?>">
|
||||
<input type="checkbox" name="multi" id="multi<?= $ReportID ?>" />
|
||||
</span>
|
||||
<strong>#<?= $Idx + 1 ?></strong>
|
||||
<strong><a href='#<?= $Idx + 1 ?>' id='<?= $Idx + 1 ?>'>#<?= $Idx + 1 ?></a></strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-rowSubHeader">
|
||||
<td colspan="2"><?= t('server.torrents.report_info') ?></td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label">
|
||||
<?= t('server.common.torrents') ?>:
|
||||
</td>
|
||||
<td class="Form-items">
|
||||
<td class="Form-inputs">
|
||||
<?
|
||||
if (!$GroupID) {
|
||||
?>
|
||||
@@ -81,8 +115,6 @@ function render_item($Idx, $Report) {
|
||||
<?
|
||||
|
||||
if ($Status != 'Resolved') {
|
||||
|
||||
|
||||
$DB->query("
|
||||
SELECT r.ID
|
||||
FROM reportsv2 AS r
|
||||
@@ -232,55 +264,41 @@ function render_item($Idx, $Report) {
|
||||
<a href="user.php?id=<?= $UploaderID ?>"><?= $UploaderName ?></a>
|
||||
<div class="Table-cellRight Table-cellTop"><?= t('server.reportsv2.upload_time') ?>:</div>
|
||||
<div><?= $Time ?></div>
|
||||
</div>
|
||||
<?
|
||||
$DB->query("
|
||||
<?
|
||||
$DB->query("
|
||||
SELECT t.UserID
|
||||
FROM reportsv2 AS r
|
||||
JOIN torrents AS t ON t.ID = r.TorrentID
|
||||
WHERE r.Status != 'Resolved'
|
||||
AND t.UserID = $UploaderID");
|
||||
$UploaderOthers = ($DB->record_count() - 1);
|
||||
$UploaderOthers = ($DB->record_count() - 1);
|
||||
|
||||
if ($UploaderOthers > 0) { ?>
|
||||
<div style="font-style: italic;">
|
||||
<a href="reportsv2.php?view=uploader&id=<?= $UploaderID ?>">
|
||||
<?= t('server.reportsv2.there_are_n_other_reports_for_torrents_uploaded_by_this_user', ['Values' => [
|
||||
t('server.reportsv2.there_are_n_other_reports_for_torrents_uploaded_by_this_user_count', ['Count' => $UploaderOthers, 'Values' => [$UploaderOthers]])
|
||||
]]) ?>
|
||||
</a>
|
||||
</div>
|
||||
<? }
|
||||
?>
|
||||
if ($UploaderOthers > 0) { ?>
|
||||
<div style="font-style: italic;">
|
||||
<a href="reportsv2.php?view=uploader&id=<?= $UploaderID ?>">
|
||||
<?= t('server.reportsv2.there_are_n_other_reports_for_torrents_uploaded_by_this_user', ['Values' => [
|
||||
t('server.reportsv2.there_are_n_other_reports_for_torrents_uploaded_by_this_user_count', ['Count' => $UploaderOthers, 'Values' => [$UploaderOthers]])
|
||||
]]) ?>
|
||||
</a>
|
||||
</div>
|
||||
<? }
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label Table-cellRight Table-cellTop"><?= t('server.reportsv2.reporter') ?>:</td>
|
||||
<td class="Form-inputs">
|
||||
<a href="user.php?id=<?= $ReporterID ?>"><?= $ReporterName ?></a>
|
||||
<div class="Table-cellRight Table-cellTop"><?= t('server.reportsv2.date_reported') ?>:</div>
|
||||
<div><?= $ReportedTime ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label Table-cellRight Table-cellTop"><?= t('server.reportsv2.user_comment') ?>:</td>
|
||||
<td class="Form-inputs">
|
||||
<div class="HtmlText">
|
||||
<?= Text::full_format($UserComment) ?>
|
||||
</div>
|
||||
<a href="user.php?id=<?= $ReporterID ?>"><?= $ReporterName ?></a>
|
||||
<div class="Table-cellRight Table-cellTop"><?= t('server.reportsv2.date_reported') ?>:</div>
|
||||
<div><?= $ReportedTime ?></div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<? if ($UploaderReply) { ?>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label Table-cellRight"><?= t('server.reportsv2.uploader_s_reply') ?>:</td>
|
||||
<td class="Form-inputs">
|
||||
<div class="HtmlText">
|
||||
<?= Text::full_format($UploaderReply) ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
<? if ($Status == 'InProgress') { // END REPORTED STUFF :|: BEGIN MOD STUFF
|
||||
?>
|
||||
<tr class="Form-row">
|
||||
@@ -290,19 +308,61 @@ function render_item($Idx, $Report) {
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
<? if ($Status != 'Resolved') { ?>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label Table-cellRight Table-cellTop"><?= t('server.reportsv2.report_comment') ?>:</td>
|
||||
<td class="Form-inputs">
|
||||
<textarea style="min-height: auto;" class="Input" type="text" name="comment" id="comment<?= $ReportID ?>" size="70"><?= $ModComment ?></textarea>
|
||||
<input class="Button" type="button" value="Update now" onclick="UpdateComment(<?= $ReportID ?>);" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-rowSubHeader">
|
||||
<td colspan="2"><?= t('server.reports.conversation') ?></td>
|
||||
</tr>
|
||||
|
||||
<? if (count($ReportMessages) > 0) { ?>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label Table-cellRight Table-cellTop">
|
||||
<a href="javascript:Load('<?= $ReportID ?>')" data-tooltip="<?= t('server.reportsv2.resolve_title') ?>"><?= t('server.reportsv2.resolve') ?></a>:
|
||||
<?= t('server.reports.conversation_history') ?>:
|
||||
</td>
|
||||
<td class="Form-items">
|
||||
<td class="Form-items Table-cellTop">
|
||||
<?
|
||||
foreach ($ReportMessages as $Message) {
|
||||
if ($Message['SenderID'] == $UploaderID) {
|
||||
$Name = t('server.top10.torrents_uploaded');
|
||||
} else if ($Message['SenderID'] == $ReporterID) {
|
||||
$Name = t('server.reportsv2.reporter');
|
||||
} else {
|
||||
$Name = "TM";
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="BoxBody">
|
||||
<strong><?= $Name . ' ' . Users::format_username($Message['SenderID']) . ' ' . t('server.torrents.reports_replied_it') . ' ' . time_diff($Message['SentDate'], 2, true, true) ?></strong>
|
||||
<div style="padding-top:5px;">
|
||||
<?= Text::full_format($Message['Body']) ?>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label Table-cellRight Table-cellTop">
|
||||
<?= t('server.inbox.quote') ?>:
|
||||
</td>
|
||||
<td class="Form-items">
|
||||
<?php new TEXTAREA_PREVIEW('uploader_pm', 'uploader_pm_' . $ReportID, '', 50, 2, true, true, false); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td collapse="4">
|
||||
<input class=" Button" type="button" value="<?= t('server.inbox.send_message') ?>" onclick="SendPM(<?= $Idx ?>,<?= $ReportID ?>);" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-rowSubHeader">
|
||||
<td colspan="2"><?= t('server.reportsv2.resolve') ?></td>
|
||||
</tr>
|
||||
|
||||
<? if ($Status != 'Resolved') { ?>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label Table-cellRight Table-cellTop"><?= t('server.reportsv2.resolve') ?>:</td>
|
||||
<td class="Form-inputs">
|
||||
<div id="options<?= $ReportID ?>" class="Table-item Form-inputs">
|
||||
<select class="Input" name="resolve_type" id="resolve_type<?= $ReportID ?>" onchange="ChangeResolve(<?= $ReportID ?>);">
|
||||
<?
|
||||
@@ -343,48 +403,36 @@ function render_item($Idx, $Report) {
|
||||
<span data-tooltip="<?= t('server.reportsv2.remove_upload_privileges_title') ?>">
|
||||
<input type="checkbox" name="upload" id="upload<?= $ReportID ?>" /> <label for="upload<?= $ReportID ?>"><strong><?= t('server.reportsv2.remove_upload_privileges') ?></strong></label>
|
||||
</span>
|
||||
<div>
|
||||
<input class="Button" type="button" name="update_resolve" id="update_resolve<?= $ReportID ?>" value="Update now" onclick="UpdateResolve(<?= $ReportID ?>);" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label Table-cellRight Table-cellTop"><?= t('server.reports.comment') ?>:</td>
|
||||
<td class="Form-inputs">
|
||||
<textarea style="min-height: auto;" class="Input" type="text" name="comment" id="comment<?= $ReportID ?>" size="70"><?= $ModComment ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label Table-cellTop Table-cellRight"><?= t('server.reportsv2.custom_trumpable') ?>:</td>
|
||||
<td class="Form-inputs">
|
||||
<textarea class="Input" name="custom_trumpable" id="custom_trumpable<?= $ReportID ?>" cols="50" rows="2" style="min-height: auto;"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label Table-cellRight Table-cellTop" data-tooltip="<?= t('server.reportsv2.pm_uploader_reporter_title') ?>">
|
||||
<?= t('server.reportsv2.pm_uploader_reporter') ?>
|
||||
<select class="Input" name="pm_type" id="pm_type<?= $ReportID ?>">
|
||||
<option class="Select-option" value="Uploader" selected="selected"><?= t('server.reportsv2.uploader') ?></option>
|
||||
<option class="Select-option" value="Reporter"><?= t('server.reportsv2.reporter') ?></option>
|
||||
</select>:
|
||||
</td>
|
||||
<td class="Form-items Table-cellTop">
|
||||
<?php new TEXTAREA_PREVIEW('uploader_pm', 'uploader_pm_' . $ReportID, '', 50, 2, true, true, false); ?>
|
||||
<div>
|
||||
<input class="Button" type="button" value="Send now" onclick="SendPM(<?= $ReportID ?>);" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label Table-cellRight"><strong><?= t('server.reportsv2.extra') ?></strong> <?= t('server.reportsv2.space_log_message') ?>:</td>
|
||||
<td class="Form-inputs">
|
||||
<input style="width:unset" class="Input" type="text" name="log_message" id="log_message<?= $ReportID ?>" size="40" <?
|
||||
if ($ExtraIDs) {
|
||||
$Extras = explode(' ', $ExtraIDs);
|
||||
$Value = '';
|
||||
foreach ($Extras as $ExtraID) {
|
||||
$Value .= site_url() . "torrents.php?torrentid=$ExtraID ";
|
||||
}
|
||||
echo ' value="' . trim($Value) . '"';
|
||||
} elseif (isset($ReportType['extra_log'])) {
|
||||
printf(' value="%s"', $ReportType['extra_log']);
|
||||
} ?> />
|
||||
<input class="Input" type="text" name="log_message" id="log_message<?= $ReportID ?>" size="40" <?
|
||||
if ($ExtraIDs) {
|
||||
$Extras = explode(' ', $ExtraIDs);
|
||||
$Value = '';
|
||||
foreach ($Extras as $ExtraID) {
|
||||
$Value .= site_url() . "torrents.php?torrentid=$ExtraID ";
|
||||
}
|
||||
echo ' value="' . trim($Value) . '"';
|
||||
} elseif (isset($ReportType['extra_log'])) {
|
||||
printf(' value="%s"', $ReportType['extra_log']);
|
||||
} ?> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
@@ -405,6 +453,7 @@ function render_item($Idx, $Report) {
|
||||
<input class="Button" id="grab<?= $ReportID ?>" type="button" value="<?= t('server.reportsv2.claim') ?>" onclick="Grab(<?= $ReportID ?>);" />
|
||||
<? } ?>
|
||||
<input class="Button" type="button" id="submit_<?= $ReportID ?>" value="<?= t('server.common.submit') ?>" onclick="TakeResolve(<?= $ReportID ?>);" />
|
||||
<input class="Button" type="button" value="<?= t('client.common.save') ?>" onclick="UpdateComment(<?= $ReportID ?>);" />
|
||||
</td>
|
||||
</tr>
|
||||
<? } else { ?>
|
||||
|
||||
@@ -204,11 +204,12 @@ $DB->query("
|
||||
$Order
|
||||
LIMIT $Limit");
|
||||
|
||||
$Reports = G::$DB->to_array();
|
||||
$Reports = G::$DB->to_array(false, MYSQLI_NUM);
|
||||
|
||||
$DB->query('SELECT FOUND_ROWS()');
|
||||
list($Results) = $DB->next_record();
|
||||
$PageLinks = Format::get_pages($Page, $Results, REPORTS_PER_PAGE, 11);
|
||||
$ReportMessages = Reports::get_reports_messages(array_column($Reports, '0'));
|
||||
View::show_header(t('server.reportsv2.reports_v2'), 'reportsv2,bbcode,browse', 'PageReportV2Static');
|
||||
?>
|
||||
<div class="LayoutBody">
|
||||
@@ -239,7 +240,7 @@ View::show_header(t('server.reportsv2.reports_v2'), 'reportsv2,bbcode,browse', '
|
||||
<? } else { ?>
|
||||
<?
|
||||
foreach ($Reports as $Idx => $Report) {
|
||||
render_item($Idx, $Report)
|
||||
render_item($Idx, $Report, $ReportMessages[$Report['0']]);
|
||||
?>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
|
||||
@@ -210,16 +210,16 @@ if ($DB->affected_rows() > 0 || !$Report) {
|
||||
$Log .= ' ( ' . $Escaped['log_message'] . ' )';
|
||||
}
|
||||
$DB->query("
|
||||
SELECT GroupID, hex(info_hash)
|
||||
SELECT GroupID, hex(info_hash), FilePath, Size
|
||||
FROM torrents
|
||||
WHERE ID = $TorrentID");
|
||||
list($GroupID, $InfoHash) = $DB->next_record();
|
||||
list($GroupID, $InfoHash, $FilePath, $Size) = $DB->next_record();
|
||||
Torrents::delete_torrent($TorrentID, 0, $ResolveType['reason']);
|
||||
|
||||
//$InfoHash = unpack("H*", $InfoHash);
|
||||
$Log .= ' (' . strtoupper($InfoHash) . ')';
|
||||
Misc::write_log($Log);
|
||||
$Log = 'deleted torrent for the reason: ' . $ResolveType['title'] . '. ( ' . $Escaped['log_message'] . ' )';
|
||||
$Log = 'deleted ' . $FilePath . '(' . number_format($Size / (1024 * 1024 * 1024), 2) . ' GB) for the reason: ' . $ResolveType['title'] . '. ( ' . $Escaped['log_message'] . ' )';
|
||||
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], $Log, 0);
|
||||
$TrumpID = 0;
|
||||
if ($Escaped['resolve_type'] === 'trump') {
|
||||
|
||||
@@ -8,7 +8,7 @@ $TorrentID = intval($_POST['torrentid']);
|
||||
$DB->query("select count(1) from torrents where id=$TorrentID and userid=" . $LoggedUser['ID']);
|
||||
list($OwnTorrent) = $DB->next_record();
|
||||
if ($OwnTorrent) {
|
||||
$DB->query("UPDATE `reportsv2` SET `UploaderReply`='" . db_string($_POST['uploader_reply']) . "',`ReplyTime`=now() WHERE ID=$ReportID and TorrentID=$TorrentID");
|
||||
Reports::add_reports_messages($ReportID, $LoggedUser['ID'], $_POST['uploader_reply']);
|
||||
if ($DB->affected_rows()) {
|
||||
$Cache->delete_value("reports_torrent_$TorrentID");
|
||||
header("Location: torrents.php?torrentid=$TorrentID");
|
||||
|
||||
@@ -13,6 +13,11 @@ $SortOrders = array(
|
||||
'random' => false
|
||||
);
|
||||
|
||||
$RequestType = $_GET['request_type'];
|
||||
if (!empty($RequestType)) {
|
||||
$SphQL->where("requesttype", $RequestType);
|
||||
}
|
||||
|
||||
if (empty($_GET['order']) || !isset($SortOrders[$_GET['order']])) {
|
||||
$_GET['order'] = 'created';
|
||||
}
|
||||
@@ -403,6 +408,19 @@ View::show_header($Title, '', 'PageRequestHome');
|
||||
} ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row is-searchStr">
|
||||
<td class="Form-label"><?= t('server.requests.request_type') ?>:</td>
|
||||
<td class="Form-inputs">
|
||||
<div class="Checkbox">
|
||||
<input class="Input" type="checkbox" name="request_type[]" value="1" id="new_torrent" <?= empty($RequestType) || in_array(1, $RequestType) ? ' checked="checked" ' : '' ?> />
|
||||
<label class="Checkbox-label" for="new_torrent"><?= t('server.requests.new_torrent') ?></label>
|
||||
</div>
|
||||
<div class="Checkbox">
|
||||
<input class="Input" type="checkbox" name="request_type[]" value="2" id="seed_torrent" <?= empty($RequestType) || in_array(2, $RequestType) ? ' checked="checked" ' : '' ?> />
|
||||
<label class="Checkbox-label" for="new_torrent"><?= t('server.requests.seed_torrent') ?></label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row is-includeFilled">
|
||||
<td class="Form-label">
|
||||
<label for="include_filled_box"><?= t('server.requests.include_filled') ?>:</label>
|
||||
@@ -526,6 +544,9 @@ View::show_header($Title, '', 'PageRequestHome');
|
||||
<td class="Table-cell" style="width: 38%;">
|
||||
<?= t('server.requests.name') ?> / <a href="?order=year&sort=<?= ($OrderBy === 'year' ? $NewSort : 'desc') ?>&<?= $CurrentURL ?>"><?= t('server.requests.year') ?></a>
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.request_type') ?>
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<a href="?order=votes&sort=<?= ($OrderBy === 'votes' ? $NewSort : 'desc') ?>&<?= $CurrentURL ?>"><?= t('server.requests.quick_vote') ?></a>
|
||||
</td>
|
||||
@@ -576,6 +597,7 @@ View::show_header($Title, '', 'PageRequestHome');
|
||||
} else {
|
||||
$CategoryName = $Categories[$Request['CategoryID'] - 1];
|
||||
}
|
||||
$RequestType = $Request['RequestType'];
|
||||
|
||||
if ($Request['TorrentID'] != 0) {
|
||||
$IsFilled = true;
|
||||
@@ -594,10 +616,21 @@ View::show_header($Title, '', 'PageRequestHome');
|
||||
<?= $FullName ?>
|
||||
<div class="torrent_info">
|
||||
<?
|
||||
if ($RequestType == 2) {
|
||||
?>
|
||||
<a href="<?= $Request['SourceTorrent'] ?>"><?= str_replace('|', ', ', $Request['CodecList']) . ' / ' . str_replace('|', ', ', $Request['SourceList']) . ' / ' . str_replace('|', ', ', $Request['ResolutionList']) . ' / ' . str_replace('|', ', ', $Request['ContainerList']) ?></a>
|
||||
<?
|
||||
} else {
|
||||
?>
|
||||
<?= str_replace('|', ', ', $Request['CodecList']) . ' / ' . str_replace('|', ', ', $Request['SourceList']) . ' / ' . str_replace('|', ', ', $Request['ResolutionList']) . ' / ' . str_replace('|', ', ', $Request['ContainerList']) ?>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<?= str_replace('|', ', ', $Request['CodecList']) . ' / ' . str_replace('|', ', ', $Request['SourceList']) . ' / ' . str_replace('|', ', ', $Request['ResolutionList']) . ' / ' . str_replace('|', ', ', $Request['ContainerList']) ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="TableRequest-cellType Table-cell">
|
||||
<?= $RequestType == 2 ? t('server.requests.seed_torrent') : t('server.requests.new_torrent') ?>
|
||||
</td>
|
||||
<td class="TableRequest-cellVotes Table-cell">
|
||||
<span id="vote_count_<?= $RequestID ?>"><?= number_format($VoteCount) ?></span>
|
||||
<? if (!$IsFilled && check_perms('site_vote')) { ?>
|
||||
|
||||
+264
-213
@@ -9,6 +9,7 @@
|
||||
|
||||
$NewRequest = $_GET['action'] === 'new';
|
||||
|
||||
$Type = $_GET['type'];
|
||||
$RequestTaxPercent = ($RequestTax * 100);
|
||||
|
||||
if (!$NewRequest) {
|
||||
@@ -21,6 +22,7 @@ $GroupID = null;
|
||||
if (!empty($_GET['groupid']) && is_number($_GET['groupid'])) {
|
||||
$GroupID = $_GET['groupid'];
|
||||
}
|
||||
$TorrentID = $_GET['torrentid'];
|
||||
|
||||
|
||||
if ($NewRequest && ($LoggedUser['BytesUploaded'] < 250 * 1024 * 1024 || !check_perms('site_submit_requests'))) {
|
||||
@@ -156,7 +158,7 @@ View::show_header(($NewRequest ? t('server.requests.new_create') : t('server.req
|
||||
<? } ?>
|
||||
</div>
|
||||
<div class="BodyContent">
|
||||
<form class="Form-rowList Form FormUpload FormRequestNew Box u-formUploadAutoFilled" action="" method="post" id="request_form" onsubmit="globalapp.requestCalculate();" variant="header">
|
||||
<form class="Form-rowList Form FormRequest Box <?= $Type == '2' ? 'u-formNewRequest' : '' ?> <?= $Type == '1' ? 'u-formSeedRequest' : '' ?>" action="" method="post" id="request_form" onsubmit="globalapp.requestCalculate();" variant="header">
|
||||
<div>
|
||||
<? if (!$NewRequest) { ?>
|
||||
<input type="hidden" name="requestid" value="<?= $RequestID ?>" />
|
||||
@@ -172,56 +174,59 @@ View::show_header(($NewRequest ? t('server.requests.new_create') : t('server.req
|
||||
<tr class="Form-row">
|
||||
<td colspan="2" class="center"><?= t('server.requests.new_rules') ?></td>
|
||||
</tr>
|
||||
<tr class="Form-row hidden">
|
||||
<td class="Form-label">
|
||||
<?= t('server.upload.type') ?>:
|
||||
</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<select class="Input" id="categories" name="type" onchange="globalapp.requestCategories();">
|
||||
<? foreach (Misc::display_array($Categories) as $Cat) { ?>
|
||||
<option class="Select-option" value="<?= $Cat ?>" <?= (!empty($CategoryName) && ($CategoryName === $Cat) ? ' selected="selected"' : '') ?>><?= $Cat ?></option>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row" id="imdb_tr">
|
||||
<td class="Form-label"><?= t('server.requests.link') ?>:</td>
|
||||
<td class="Form-items" id="imdbfield">
|
||||
<input class="Input" type="text" id="imdb" name="imdb" size="45" placeholder="IMDb" value="<?= $IMDBID ?>" <?= $Disabled ?>>
|
||||
<div class="Form-inputs">
|
||||
<input class=" Input" type="text" id="group" name="group" size="45" placeholder="<?= t('server.requests.t_group') ?>" value="<?= $GroupID ? CONFIG['SITE_URL'] . '/torrents.php?id=' . $GroupID : '' ?>" <?= $Disabled ?>>
|
||||
<? if ($NewRequest) { ?>
|
||||
<button <?= $Disabled ?> id="imdb_button" class="Button autofill" variant="primary" type="button" onclick="globalapp.requestMovieAutofill()">
|
||||
<span><?= t('server.upload.movie_fill') ?></span>
|
||||
<span class="Loader"></span>
|
||||
</button>
|
||||
<div <?= $Disabled ?> class="Checkbox">
|
||||
<input class="Input" type="checkbox" name="no_imdb_link" id="no_imdb_link" onchange="globalapp.requestNoImdbId()" <?= $Disabled ?>>
|
||||
<label class="Checkbox-label" data-tooltip="<?= t('server.requests.link_empty_warning') ?>" for="no_imdb_link"> <?= t('server.requests.no_link') ?></label>
|
||||
<? if ($NewRequest) { ?>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label">
|
||||
<?= t('server.requests.request_type') ?>:
|
||||
</td>
|
||||
<td class="Form-items">
|
||||
<div id="request_type" class="RadioGroup">
|
||||
<div class="Radio">
|
||||
<input class="Input" type="radio" id="new_request" name="request_type" onchange="globalapp.requestNewTorrent();" value="1" <?= $Type == '1' ? 'checked' : '' ?>>
|
||||
<label class="Radio-label" for="new_request"><?= t('server.requests.new_torrent') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Radio">
|
||||
<input class="Input" type="radio" id="seed_request" name="request_type" onchange="globalapp.requestSeedTorrent();" value="2" <?= $Type == '2' ? 'checked' : '' ?>>
|
||||
<label class="Radio-label" for="mixed_subtitles"><?= t('server.requests.seed_torrent') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<? } else {
|
||||
?>
|
||||
<tr class="Form-row">
|
||||
<input type="hidden" id="new_request" name="request_type" value=1 />
|
||||
</tr>
|
||||
|
||||
<div class="u-formUploadNoImdbNote"><?= t('server.requests.auto_fill_note') ?></div>
|
||||
<? } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<div class="TableContainer <?= $NewRequest ? 'u-formUploadCollapse' : '' ?>">
|
||||
<table class="Form">
|
||||
<tr class="Form-row" id="releasetypes_tr">
|
||||
<td class="Form-label"><?= t('server.requests.release_list') ?>:</td>
|
||||
<? if ($NewRequest) { ?>
|
||||
<div class="TableContainer Form u-formRequestSeedCollapse">
|
||||
<table>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label">
|
||||
<?= t('server.torrents.permalink') ?>:
|
||||
</td>
|
||||
<td class="Form-inputs">
|
||||
<input class="Input" type="text" id="link" name="link" value="<?= $TorrentID ? CONFIG['SITE_URL'] . "/torrents.php?torrentid=$TorrentID" : '' ?>">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<? } ?>
|
||||
<div class="TableContainer Form <?= $NewRequest ? 'u-formRequestNewCollapse' : '' ?>">
|
||||
<table>
|
||||
<tr class="Form-row hidden">
|
||||
<td class="Form-label">
|
||||
<?= t('server.upload.type') ?>:
|
||||
</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<select <?= $Disabled ?> class="Input" id="releasetype" name="releasetype">
|
||||
<?
|
||||
foreach ($ReleaseTypes as $Key) {
|
||||
//echo '<h1>'.$ReleaseType.'</h1>'; die();
|
||||
?> <option class="Select-option" value="<?= $Key ?>" <?= !empty($ReleaseType) ? ($Key == $ReleaseType ? ' selected="selected"' : ($DisabledFlag ? 'disabled' : '')) : '' ?>><?= t('server.torrents.release_types')[$Key] ?></option>
|
||||
<select class="Input" id="categories" name="type" onchange="globalapp.requestCategories();">
|
||||
<? foreach (Misc::display_array($Categories) as $Cat) { ?>
|
||||
<option class="Select-option" value="<?= $Cat ?>" <?= (!empty($CategoryName) && ($CategoryName === $Cat) ? ' selected="selected"' : '') ?>><?= $Cat ?></option>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
@@ -229,202 +234,248 @@ View::show_header(($NewRequest ? t('server.requests.new_create') : t('server.req
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row" id="imdb_tr">
|
||||
<td class="Form-label"><?= t('server.requests.link') ?>:</td>
|
||||
<td class="Form-items" id="imdbfield">
|
||||
<div class="Form-inputs">
|
||||
<input class="Input is-small" type="text" id="imdb" name="imdb" size="45" placeholder="IMDb" value="<?= $IMDBID ?>" <?= $Disabled ?>>
|
||||
<input class=" Input" type="text" id="group" name="group" size="45" placeholder="<?= t('server.requests.t_group') ?>" value="<?= $GroupID ? CONFIG['SITE_URL'] . '/torrents.php?id=' . $GroupID : '' ?>" <?= $Disabled ?>>
|
||||
<? if ($NewRequest) { ?>
|
||||
<button <?= $Disabled ?> id="imdb_button" class="Button autofill" variant="primary" type="button" onclick="globalapp.requestMovieAutofill()">
|
||||
<span><?= t('server.upload.movie_fill') ?></span>
|
||||
<span class="Loader"></span>
|
||||
</button>
|
||||
<div <?= $Disabled ?> class="Checkbox">
|
||||
<input class="Input" type="checkbox" name="no_imdb_link" id="no_imdb_link" onchange="globalapp.requestNoImdbId()" <?= $Disabled ?>>
|
||||
<label class="Checkbox-label" data-tooltip="<?= t('server.requests.link_empty_warning') ?>" for="no_imdb_link"> <?= t('server.requests.no_link') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><?= t('server.upload.movie_title') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<input class="Input" type="text" id="name" name="name" <?= $Disabled ?> size="45" value="<?= (!empty($Title) ? $Title : '') ?>" />
|
||||
</div>
|
||||
<div class="u-formRequestNoImdbNote"><?= t('server.requests.auto_fill_note') ?></div>
|
||||
<? } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><?= t('server.upload.sub_title') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<input class="Input" type="text" id="subname" name="subname" <?= $Disabled ?> size="45" value="<?= (!empty($SubName) ? $SubName : '') ?>" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row" id="year_tr">
|
||||
<td class="Form-label"><?= t('server.requests.year') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<input class="Input" type="text" id="year" name="year" <?= $Disabled ?> size="5" value="<?= (!empty($Year) ? $Year : '') ?>" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row" id="artist_tr">
|
||||
<td class="Form-label"><?= t('server.common.director') ?>:</td>
|
||||
<td class="Form-items is-artist u-formUploadArtistList" id="artistfields">
|
||||
<?
|
||||
if (!empty($ArtistForm)) {
|
||||
$FirstArtist = true;
|
||||
foreach ($ArtistForm as $Importance => $Artists) {
|
||||
foreach ($Artists as $Artist) {
|
||||
?>
|
||||
<div class="Form-inputs is-artist">
|
||||
<input class="Input is-small" type="text" id="artist_id" name="artist_ids[]" value="<?= display_str($Artist['IMDBID']) ?>" size="45" <?= $Disabled ?> />
|
||||
<input class="Input is-small" type="text" id="artist" name="artists[]" size="45" value="<?= display_str($Artist['Name']) ?>" <? Users::has_autocomplete_enabled('other'); ?><?= $Disabled ?> />
|
||||
<input class="Input is-small" type="text" id="artist_sub" data-tooltip="<?= t('server.upload.sub_name') ?>" name="artists_sub[]" size="25" value="<?= display_str($Artist['SubName']) ?>" <? Users::has_autocomplete_enabled('other'); ?><?= $Disabled ?> />
|
||||
<input type="hidden" id="importance" name="importance[]" value=1 />
|
||||
<?
|
||||
if ($FirstArtist) {
|
||||
if (!$Disabled) {
|
||||
?>
|
||||
<a id="add_artist" href="javascript:globalapp.requestAddArtistField(true)" class="brackets">+</a> <a id="remove_artist" href="javascript:globalapp.requestRemoveArtistField()" class="brackets">−</a>
|
||||
<?
|
||||
}
|
||||
$FirstArtist = false;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<div class="Form-inputs">
|
||||
<input class="Input is-small" type="text" id="artist_id" name="artist_ids[]" size="45" placeholder="<?= t('server.upload.movie_imdb') ?>" />
|
||||
<input class="Input is-small" type="text" id="artist" name="artists[]" size="45" <?
|
||||
Users::has_autocomplete_enabled('other'); ?><?= $Disabled ?> placeholder="<?= t('server.upload.english_name') ?>" />
|
||||
<input class="Input is-small" type="text" id="artist_sub" name="artists_sub[]" size="25" placeholder="<?= t('server.upload.sub_name') ?>" <?
|
||||
Users::has_autocomplete_enabled('other'); ?><?= $Disabled ?> />
|
||||
<input type="hidden" id="importance" name="importance[]" value=1 />
|
||||
<a id="add_artist" href="#" onclick="globalapp.requestAddArtistField(true); return false;" class="brackets add-artist">+</a>
|
||||
<a id="remove_artist" href="#" onclick="globalapp.requestRemoveArtistField(); return false;" class="brackets remove-artist">−</a>
|
||||
</div>
|
||||
<? } ?>
|
||||
<div class="show-more hidden">
|
||||
<a href='#' onclick="globalapp.requestArtistsShowMore(); return false"><?= t('server.upload.show_more') ?></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<? if ($NewRequest || $CanEdit) { ?>
|
||||
<tr class="Form-row" id="image_tr">
|
||||
<td class="Form-label"><?= t('server.requests.image') ?>:</td>
|
||||
</table>
|
||||
|
||||
<div class="TableContainer <?= $NewRequest ? 'u-formRequestCollapse' : '' ?>">
|
||||
<table class="Form">
|
||||
<tr class="Form-row" id="releasetypes_tr">
|
||||
<td class="Form-label"><?= t('server.requests.release_list') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<input class="Input" type="text" id="image" name="image" <?= $Disabled ?> size="45" value="<?= (!empty($Image) ? $Image : '') ?>" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><?= t('server.requests.tags') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<?
|
||||
if ($GenreTags) {
|
||||
?>
|
||||
<select <?= $Disabled ?> class="Input" id="genre_tags" name="genre_tags" onchange="globalapp.requestAddTag(); return false;">
|
||||
<option class="Select-option">---</option>
|
||||
<? foreach (Misc::display_array($GenreTags) as $Genre) { ?>
|
||||
<option class="Select-option" value="<?= $Genre ?>"><?= $Genre ?></option>
|
||||
<? } ?>
|
||||
<select <?= $Disabled ?> class="Input" id="releasetype" name="releasetype">
|
||||
<?
|
||||
foreach ($ReleaseTypes as $Key) {
|
||||
//echo '<h1>'.$ReleaseType.'</h1>'; die();
|
||||
?> <option class="Select-option" value="<?= $Key ?>" <?= !empty($ReleaseType) ? ($Key == $ReleaseType ? ' selected="selected"' : ($DisabledFlag ? 'disabled' : '')) : '' ?>><?= t('server.torrents.release_types')[$Key] ?></option>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><?= t('server.upload.movie_title') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<input class="Input" type="text" id="name" name="name" <?= $Disabled ?> size="45" value="<?= (!empty($Title) ? $Title : '') ?>" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><?= t('server.upload.sub_title') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<input class="Input" type="text" id="subname" name="subname" <?= $Disabled ?> size="45" value="<?= (!empty($SubName) ? $SubName : '') ?>" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row" id="year_tr">
|
||||
<td class="Form-label"><?= t('server.requests.year') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<input class="Input" type="text" id="year" name="year" <?= $Disabled ?> size="5" value="<?= (!empty($Year) ? $Year : '') ?>" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row" id="artist_tr">
|
||||
<td class="Form-label"><?= t('server.common.director') ?>:</td>
|
||||
<td class="Form-items is-artist u-formRequestArtistList" id="artistfields">
|
||||
<?
|
||||
}
|
||||
if (!empty($ArtistForm)) {
|
||||
$FirstArtist = true;
|
||||
foreach ($ArtistForm as $Importance => $Artists) {
|
||||
foreach ($Artists as $Artist) {
|
||||
?>
|
||||
<input class="Input" type="text" <?= $Disabled ?> id="tags" name="tags" size="45" value="<?= (!empty($Tags) ? display_str($Tags) : '') ?>" <? Users::has_autocomplete_enabled('other'); ?> />
|
||||
</div>
|
||||
<div>
|
||||
<?= t('server.requests.tags_note') ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
if ($NewRequest || $CanEdit) {
|
||||
?>
|
||||
<tr class="Form-row" id="sources_tr">
|
||||
<td class="Form-label"><?= t('server.requests.acceptable_sources') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<div class="Checkbox">
|
||||
<input type="checkbox" name="all_sources" id="toggle_sources" onchange="globalapp.allToggle('sources', <?= ($NewRequest ? 1 : 0) ?>);" <?= !empty($SourceArray) && (count($SourceArray) === count($Sources)) ? ' checked="checked"' : ''; ?> /><label for="toggle_sources"> <?= t('server.requests.all') ?></label>
|
||||
<div class="Form-inputs is-artist">
|
||||
<input class="Input is-small" type="text" id="artist_id" name="artist_ids[]" value="<?= display_str($Artist['IMDBID']) ?>" size="45" <?= $Disabled ?> />
|
||||
<input class="Input is-small" type="text" id="artist" name="artists[]" size="45" value="<?= display_str($Artist['Name']) ?>" <? Users::has_autocomplete_enabled('other'); ?><?= $Disabled ?> />
|
||||
<input class="Input is-small" type="text" id="artist_sub" data-tooltip="<?= t('server.upload.sub_name') ?>" name="artists_sub[]" size="25" value="<?= display_str($Artist['SubName']) ?>" <? Users::has_autocomplete_enabled('other'); ?><?= $Disabled ?> />
|
||||
<input type="hidden" id="importance" name="importance[]" value=1 />
|
||||
<?
|
||||
if ($FirstArtist) {
|
||||
if (!$Disabled) {
|
||||
?>
|
||||
<a id="add_artist" href="javascript:globalapp.requestAddArtistField(true)" class="brackets">+</a> <a id="remove_artist" href="javascript:globalapp.requestRemoveArtistField()" class="brackets">−</a>
|
||||
<?
|
||||
}
|
||||
$FirstArtist = false;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<div class="Form-inputs">
|
||||
<input class="Input is-small" type="text" id="artist_id" name="artist_ids[]" size="45" placeholder="<?= t('server.upload.movie_imdb') ?>" />
|
||||
<input class="Input is-small" type="text" id="artist" name="artists[]" size="45" <?
|
||||
Users::has_autocomplete_enabled('other'); ?><?= $Disabled ?> placeholder="<?= t('server.upload.english_name') ?>" />
|
||||
<input class="Input is-small" type="text" id="artist_sub" name="artists_sub[]" size="25" placeholder="<?= t('server.upload.sub_name') ?>" <?
|
||||
Users::has_autocomplete_enabled('other'); ?><?= $Disabled ?> />
|
||||
<input type="hidden" id="importance" name="importance[]" value=1 />
|
||||
<a id="add_artist" href="#" onclick="globalapp.requestAddArtistField(true); return false;" class="brackets add-artist">+</a>
|
||||
<a id="remove_artist" href="#" onclick="globalapp.requestRemoveArtistField(); return false;" class="brackets remove-artist">−</a>
|
||||
</div>
|
||||
<? foreach ($Sources as $Key => $Val) { ?>
|
||||
<div class="Checkbox"><input type="checkbox" name="sources[]" value="<?= $Key ?>" onchange="if (!this.checked) { $('#toggle_sources').raw().checked = false; }" id="source_<?= $Key ?>" <?= (!empty($SourceArray) && in_array($Key, $SourceArray) ? ' checked="checked"' : '') ?> /><label for="source_<?= $Key ?>"> <?= $Val ?></label></div>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
<div class="show-more hidden">
|
||||
<a href='#' onclick="globalapp.requestArtistsShowMore(); return false"><?= t('server.upload.show_more') ?></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row" id="codecs_tr">
|
||||
<td class="Form-label"><?= t('server.requests.acceptable_codecs') ?>:</td>
|
||||
<? if ($NewRequest || $CanEdit) { ?>
|
||||
<tr class="Form-row" id="image_tr">
|
||||
<td class="Form-label"><?= t('server.requests.image') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<input class="Input" type="text" id="image" name="image" <?= $Disabled ?> size="45" value="<?= (!empty($Image) ? $Image : '') ?>" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><?= t('server.requests.tags') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<div class="Checkbox">
|
||||
<input type="checkbox" name="all_codecs" id="toggle_codecs" onchange="globalapp.allToggle('codecs', <?= ($NewRequest ? 1 : 0) ?>);" <?= (!empty($CodecArray) && (count($CodecArray) === count($Codecs)) ? ' checked="checked"' : '') ?> /><label for="toggle_codecs"> <?= t('server.requests.all') ?></label>
|
||||
</div>
|
||||
<? foreach ($Codecs as $Key => $Val) { ?>
|
||||
<?
|
||||
if ($GenreTags) {
|
||||
?>
|
||||
<select <?= $Disabled ?> class="Input" id="genre_tags" name="genre_tags" onchange="globalapp.requestAddTag(); return false;">
|
||||
<option class="Select-option">---</option>
|
||||
<? foreach (Misc::display_array($GenreTags) as $Genre) { ?>
|
||||
<option class="Select-option" value="<?= $Genre ?>"><?= $Genre ?></option>
|
||||
<? } ?>
|
||||
</select>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<input class="Input" type="text" <?= $Disabled ?> id="tags" name="tags" size="45" value="<?= (!empty($Tags) ? display_str($Tags) : '') ?>" <? Users::has_autocomplete_enabled('other'); ?> />
|
||||
</div>
|
||||
<div>
|
||||
<?= t('server.requests.tags_note') ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
if ($NewRequest || $CanEdit) {
|
||||
?>
|
||||
<tr class="Form-row" id="sources_tr">
|
||||
<td class="Form-label"><?= t('server.requests.acceptable_sources') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<div class="Checkbox">
|
||||
<input type="checkbox" name="codecs[]" value="<?= $Key ?>" id="codec_<?= $Key ?>" <?= (!empty($CodecArray) && in_array($Key, $CodecArray) ? ' checked="checked" ' : '') ?> onchange="if (!this.checked) { $('#toggle_codecs').raw().checked = false; }" /><label for="codec_<?= $Key ?>"> <?= $Val ?></label>
|
||||
<input type="checkbox" name="all_sources" id="toggle_sources" onchange="globalapp.allToggle('sources', <?= ($NewRequest ? 1 : 0) ?>);" <?= !empty($SourceArray) && (count($SourceArray) === count($Sources)) ? ' checked="checked"' : ''; ?> /><label for="toggle_sources"> <?= t('server.requests.all') ?></label>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row" id="containers_tr">
|
||||
<td class="Form-label"><?= t('server.requests.acceptable_containers') ?>:</td>
|
||||
<? foreach ($Sources as $Key => $Val) { ?>
|
||||
<div class="Checkbox"><input type="checkbox" name="sources[]" value="<?= $Key ?>" onchange="if (!this.checked) { $('#toggle_sources').raw().checked = false; }" id="source_<?= $Key ?>" <?= (!empty($SourceArray) && in_array($Key, $SourceArray) ? ' checked="checked"' : '') ?> /><label for="source_<?= $Key ?>"> <?= $Val ?></label></div>
|
||||
<? } ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row" id="codecs_tr">
|
||||
<td class="Form-label"><?= t('server.requests.acceptable_codecs') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<div class="Checkbox">
|
||||
<input type="checkbox" name="all_codecs" id="toggle_codecs" onchange="globalapp.allToggle('codecs', <?= ($NewRequest ? 1 : 0) ?>);" <?= (!empty($CodecArray) && (count($CodecArray) === count($Codecs)) ? ' checked="checked"' : '') ?> /><label for="toggle_codecs"> <?= t('server.requests.all') ?></label>
|
||||
</div>
|
||||
<? foreach ($Codecs as $Key => $Val) { ?>
|
||||
<div class="Checkbox">
|
||||
<input type="checkbox" name="codecs[]" value="<?= $Key ?>" id="codec_<?= $Key ?>" <?= (!empty($CodecArray) && in_array($Key, $CodecArray) ? ' checked="checked" ' : '') ?> onchange="if (!this.checked) { $('#toggle_codecs').raw().checked = false; }" /><label for="codec_<?= $Key ?>"> <?= $Val ?></label>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row" id="containers_tr">
|
||||
<td class="Form-label"><?= t('server.requests.acceptable_containers') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<div class="Checkbox">
|
||||
<input type="checkbox" name="all_containers" id="toggle_containers" onchange="globalapp.allToggle('containers', <?= ($NewRequest ? 1 : 0) ?>);" <?= (!empty($ContainerArray) && (count($ContainerArray) === count($Containers)) ? ' checked="checked"' : '') ?> /><label for="toggle_containers"> <?= t('server.requests.all') ?></label>
|
||||
</div>
|
||||
<? foreach ($Containers as $Key => $Val) { ?>
|
||||
<div class="Checkbox">
|
||||
<input type="checkbox" name="containers[]" value="<?= $Key ?>" id="container_<?= $Key ?>" <?= (!empty($ContainerArray) && in_array($Key, $ContainerArray) ? ' checked="checked" ' : '') ?> onchange="if (!this.checked) { $('#toggle_containers').raw().checked = false; }" /><label for="container_<?= $Key ?>"> <?= $Val ?></label>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row" id="resolutions_tr">
|
||||
<td class="Form-label"><?= t('server.requests.acceptable_resolutions') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<div class="Checkbox">
|
||||
<input type="checkbox" name="all_resolutions" id="toggle_resolutions" onchange="globalapp.allToggle('resolutions', <?= ($NewRequest ? 1 : 0) ?>);" <?= (!empty($ResolutionArray) && (count($ResolutionArray) === count($Resolutions)) ? ' checked="checked"' : '') ?> /><label for="toggle_resolutions"> <?= t('server.requests.all') ?></label>
|
||||
</div>
|
||||
<? foreach ($Resolutions as $Key => $Val) { ?>
|
||||
<div class="Checkbox">
|
||||
<input type="checkbox" name="resolutions[]" value="<?= $Key ?>" id="resolution_<?= $Key ?>" <?= (!empty($ResolutionArray) && in_array($Key, $ResolutionArray) ? ' checked="checked" ' : '') ?> onchange="if (!this.checked) { $('#toggle_resolutions').raw().checked = false; }" /><label for="resolution_<?= $Key ?>"> <?= $Val ?></label>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><?= t('server.requests.source_torrent') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<div class="Checkbox">
|
||||
<input type="checkbox" name="all_containers" id="toggle_containers" onchange="globalapp.allToggle('containers', <?= ($NewRequest ? 1 : 0) ?>);" <?= (!empty($ContainerArray) && (count($ContainerArray) === count($Containers)) ? ' checked="checked"' : '') ?> /><label for="toggle_containers"> <?= t('server.requests.all') ?></label>
|
||||
</div>
|
||||
<? foreach ($Containers as $Key => $Val) { ?>
|
||||
<div class="Checkbox">
|
||||
<input type="checkbox" name="containers[]" value="<?= $Key ?>" id="container_<?= $Key ?>" <?= (!empty($ContainerArray) && in_array($Key, $ContainerArray) ? ' checked="checked" ' : '') ?> onchange="if (!this.checked) { $('#toggle_containers').raw().checked = false; }" /><label for="container_<?= $Key ?>"> <?= $Val ?></label>
|
||||
</div>
|
||||
<? } ?>
|
||||
<input class="Input" type="text" name="source_torrent" value="<?= $SourceTorrent ?>" placeholder="<?= t('server.requests.source_torrent_placeholder') ?>">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row" id="resolutions_tr">
|
||||
<td class="Form-label"><?= t('server.requests.acceptable_resolutions') ?>:</td>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><?= t('server.requests.purchasable_at') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<div class="Checkbox">
|
||||
<input type="checkbox" name="all_resolutions" id="toggle_resolutions" onchange="globalapp.allToggle('resolutions', <?= ($NewRequest ? 1 : 0) ?>);" <?= (!empty($ResolutionArray) && (count($ResolutionArray) === count($Resolutions)) ? ' checked="checked"' : '') ?> /><label for="toggle_resolutions"> <?= t('server.requests.all') ?></label>
|
||||
</div>
|
||||
<? foreach ($Resolutions as $Key => $Val) { ?>
|
||||
<div class="Checkbox">
|
||||
<input type="checkbox" name="resolutions[]" value="<?= $Key ?>" id="resolution_<?= $Key ?>" <?= (!empty($ResolutionArray) && in_array($Key, $ResolutionArray) ? ' checked="checked" ' : '') ?> onchange="if (!this.checked) { $('#toggle_resolutions').raw().checked = false; }" /><label for="resolution_<?= $Key ?>"> <?= $Val ?></label>
|
||||
</div>
|
||||
<? } ?>
|
||||
<input class="Input" type="text" name="purchasable_at" value="<?= $PurchasableAt ?>" placeholder="<?= t('server.requests.purchasable_at_placeholder') ?>">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><?= t('server.requests.source_torrent') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<input class="Input" type="text" name="source_torrent" value="<?= $SourceTorrent ?>" placeholder="<?= t('server.requests.source_torrent_placeholder') ?>">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><?= t('server.requests.purchasable_at') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<div class="Form-inputs">
|
||||
<input class="Input" type="text" name="purchasable_at" value="<?= $PurchasableAt ?>" placeholder="<?= t('server.requests.purchasable_at_placeholder') ?>">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><?= t('server.requests.description') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<? new TEXTAREA_PREVIEW("description", "description", (!empty($Request['Description']) ? display_str($Request['Description']) : '')) ?>
|
||||
<div>
|
||||
<?= t('server.requests.description_note') ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><?= t('server.requests.description') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<? new TEXTAREA_PREVIEW("description", "description", (!empty($Request['Description']) ? display_str($Request['Description']) : '')) ?>
|
||||
<div>
|
||||
<?= t('server.requests.description_note') ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="TableContainer <?= $NewRequestu ? 'u-formRequestCommonCollapse' : '' ?>">
|
||||
<table>
|
||||
<?
|
||||
if ($NewRequest) { ?>
|
||||
<tr class="Form-row" id="voting">
|
||||
<td class="Form-label"><?= t('server.requests.bounty') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<td class="Form-inputs">
|
||||
<input class="Input is-small" type="number" pattern="[0-9]" min="1" id="amount_box" size="8" value="<?= (!empty($Bounty) ? $Bounty : '1') ?>" oninput="globalapp.requestCalculate();" />
|
||||
<select class="Input u-hidden" id="unit" name="unit" onchange="globalapp.requestCalculate();">
|
||||
<option class="Select-option" value="gb" <?= (!empty($_POST['unit']) && $_POST['unit'] === 'gb' ? ' selected="selected"' : '') ?>>GB</option>
|
||||
@@ -437,7 +488,7 @@ View::show_header(($NewRequest ? t('server.requests.new_create') : t('server.req
|
||||
<div>
|
||||
<?= t('server.requests.pst_body', ['Values' => [
|
||||
"<strong><span id='new_bounty'>1GB</span></strong>"
|
||||
]]) ?>
|
||||
]]) ?>:
|
||||
</div>
|
||||
<div>
|
||||
<?= t('server.requests.uploaded') ?>: <span id="new_uploaded"><?= Format::get_size($LoggedUser['BytesUploaded']) ?></span>
|
||||
|
||||
+128
-113
@@ -16,6 +16,18 @@ $Request = Requests::get_request($RequestID);
|
||||
if ($Request === false) {
|
||||
error(404);
|
||||
}
|
||||
$RequestType = $Request['RequestType'];
|
||||
if ($RequestType == 2) {
|
||||
$Link = $Request['SourceTorrent'];
|
||||
if (!preg_match('/' . TORRENT_REGEX . '/i', $Link, $Matches)) {
|
||||
error('invlaid request');
|
||||
} else {
|
||||
$SourceTorrentID = $Matches[2];
|
||||
$SourceTorrent = Torrents::get_torrent($SourceTorrentID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Convenience variables
|
||||
$IsFilled = !empty($Request['TorrentID']);
|
||||
@@ -45,6 +57,7 @@ $ResolutionString = implode(', ', explode('|', $Request['ResolutionList']));
|
||||
$ContainerString = implode(', ', explode('|', $Request['ContainerList']));
|
||||
$SourceString = implode(', ', explode('|', $Request['SourceList']));
|
||||
|
||||
|
||||
if (empty($Request['ReleaseType'])) {
|
||||
$ReleaseName = 'Unknown';
|
||||
} else {
|
||||
@@ -56,7 +69,7 @@ $RequestVotes = Requests::get_votes_array($RequestID);
|
||||
$VoteCount = count($RequestVotes['Voters']);
|
||||
$ProjectCanEdit = (check_perms('project_team') && !$IsFilled && ($Request['CategoryID'] === '0'));
|
||||
$UserCanEdit = (!$IsFilled && $LoggedUser['ID'] === $Request['UserID'] && $VoteCount < 2);
|
||||
$CanEdit = ($UserCanEdit || $ProjectCanEdit || check_perms('site_moderate_requests'));
|
||||
$CanEdit = ($UserCanEdit || $ProjectCanEdit || check_perms('site_moderate_requests')) && $RequestType != 2;
|
||||
|
||||
// Comments (must be loaded before View::show_header so that subscriptions and quote notifications are handled properly)
|
||||
list($NumComments, $Page, $Thread, $LastRead) = Comments::load('requests', $RequestID);
|
||||
@@ -85,16 +98,30 @@ $Pages = Format::get_pages($Page, $NumComments, CONFIG['TORRENT_COMMENTS_PER_PAG
|
||||
<? } ?>
|
||||
<a href="#" id="subscribelink_requests<?= $RequestID ?>" class="brackets" onclick="SubscribeComments('requests',<?= $RequestID ?>, '<?= Subscriptions::has_subscribed_comments('requests', $RequestID) !== false ? t('server.torrents.subscribe') : t('server.torrents.unsubscribe') ?>');return false;"><?= Subscriptions::has_subscribed_comments('requests', $RequestID) !== false ? t('server.torrents.unsubscribe') : t('server.torrents.subscribe') ?></a>
|
||||
<a href="reports.php?action=report&type=request&id=<?= $RequestID ?>" class="brackets"><?= t('server.requests.report_request') ?></a>
|
||||
<? if (!$IsFilled) { ?>
|
||||
<a href="upload.php?requestid=<?= $RequestID ?><?= ($Request['GroupID'] ? "&groupid=$Request[GroupID]" : '') ?>" class="brackets"><?= t('server.requests.upload_request') ?></a>
|
||||
<? }
|
||||
<?
|
||||
if (!$IsFilled) {
|
||||
if ($RequestType == 2) { ?>
|
||||
<a href="torrents.php?action=download&id=<?= $SourceTorrentID ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" data-tooltip="Download"><?= t('server.requests.seed_torrent') ?></a>
|
||||
<?
|
||||
} else {
|
||||
?>
|
||||
<a href="upload.php?requestid=<?= $RequestID ?><?= ($Request['GroupID'] ? "&groupid=$Request[GroupID]" : '') ?>" class="brackets"><?= t('server.requests.upload_request') ?></a>
|
||||
<?
|
||||
}
|
||||
}
|
||||
if (!$IsFilled && ($Request['CategoryID'] === '0')) { ?>
|
||||
<a href="reports.php?action=report&type=request_update&id=<?= $RequestID ?>" class="brackets"><?= t('server.requests.request_update') ?></a>
|
||||
<? } ?>
|
||||
<?
|
||||
$google_url = "https://www.blu-ray.com/search/?quicksearch=1&quicksearch_country=all§ion=bluraymovies&quicksearch_keyword=" . display_str($Request['Name']);
|
||||
?>
|
||||
<a target="_blank" href="<? echo $google_url; ?>" class="brackets"><?= t('server.requests.find_in_stores') ?></a>
|
||||
<?
|
||||
if ($RequestType != 2) {
|
||||
?>
|
||||
<a target="_blank" href="<? echo $google_url; ?>" class="brackets"><?= t('server.requests.find_in_stores') ?></a>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="MovieInfo MovieInfoMovie Box">
|
||||
@@ -124,17 +151,21 @@ $Pages = Format::get_pages($Page, $NumComments, CONFIG['TORRENT_COMMENTS_PER_PAG
|
||||
<?= icon('movie-type') ?>
|
||||
<span><?= $ReleaseName ?></span>
|
||||
</span>
|
||||
<span class="MovieInfo-fact TableTorrent-movieInfoFactsItem" data-tooltip="<?= t('server.requests.bounty') ?>">
|
||||
<?= icon('uploaded') ?>
|
||||
<div id="movieinfo_bountry"><?= Format::get_size($RequestVotes['TotalBounty']) ?></div>
|
||||
</span>
|
||||
<?
|
||||
if ($Request['GroupID']) {
|
||||
if ($RequestType == 2) {
|
||||
?>
|
||||
<span class="MovieInfo-fact TableTorrent-movieInfoFactsItem" data-tooltip="<?= t('server.requests.torrent_group') ?>">
|
||||
<a href="torrents.php?id=<?= $Request['GroupID'] ?>">torrents.php?id=<?= $Request['GroupID'] ?></a>
|
||||
</span>
|
||||
<span class="MovieInfo-fact TableTorrent-movieInfoFactsItem" data-tooltip="<?= t('server.common.torrent') ?>">
|
||||
<a href="torrents.php?torrentid=<?= $SourceTorrentID ?>">torrents.php?torrentid=<?= $SourceTorrentID ?></a>
|
||||
</span>
|
||||
<?
|
||||
} else {
|
||||
?>
|
||||
<span class="MovieInfo-fact TableTorrent-movieInfoFactsItem" data-tooltip="<?= t('server.requests.torrent_group') ?>">
|
||||
<a href="torrents.php?id=<?= $Request['GroupID'] ?>">torrents.php?id=<?= $Request['GroupID'] ?></a>
|
||||
</span>
|
||||
<?
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@@ -154,68 +185,76 @@ $Pages = Format::get_pages($Page, $NumComments, CONFIG['TORRENT_COMMENTS_PER_PAG
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class=" MovieInfo-synopsis" data-tooltip="<?= t('server.torrents.fold_tooltip') ?>">
|
||||
<p class="HtmlText">
|
||||
<?= Text::full_format($Request['Description']); ?>
|
||||
</p>
|
||||
</div>
|
||||
<table class="RequestDetailTable Table">
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.acceptable_codecs') ?>:
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= $CodecString ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.acceptable_containers') ?>:
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= $ContainerString ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.acceptable_resolutions') ?>:
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= $ResolutionString ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.acceptable_sources') ?>:
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= $SourceString ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
if ($Request['SourceTorrent']) {
|
||||
?>
|
||||
<?
|
||||
if ($RequestType == 2) {
|
||||
Torrents::render_media_info($SourceTorrent['MediaInfo']);
|
||||
} else {
|
||||
?>
|
||||
<div class="MovieInfo-synopsis" ?>
|
||||
<div class="HtmlText">
|
||||
<? View::long_text('movie_info_synopsis', display_str($Request['Description']), 2); ?>
|
||||
</div>
|
||||
</div>
|
||||
<table class="RequestDetailTable Table">
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.source_torrent') ?>:
|
||||
<?= t('server.requests.acceptable_codecs') ?>:
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= $Request['SourceTorrent'] ?>
|
||||
<?= $CodecString ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.acceptable_containers') ?>:
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= $ContainerString ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.acceptable_resolutions') ?>:
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= $ResolutionString ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.acceptable_sources') ?>:
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= $SourceString ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
if ($Request['SourceTorrent']) {
|
||||
?>
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.source_torrent') ?>:
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= $Request['SourceTorrent'] ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<? } ?>
|
||||
<? if ($Request['PurchasableAt']) { ?>
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.purchasable_at') ?>:
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= $Request['PurchasableAt'] ?>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
</table>
|
||||
<? } ?>
|
||||
<? if ($Request['PurchasableAt']) { ?>
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.purchasable_at') ?>:
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= $Request['PurchasableAt'] ?>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
</table>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
<div class="LayoutMainSidebar">
|
||||
@@ -233,13 +272,6 @@ $Pages = Format::get_pages($Page, $NumComments, CONFIG['TORRENT_COMMENTS_PER_PAG
|
||||
<? if ($Request['LastVote'] > $Request['TimeAdded']) { ?>
|
||||
<li class="SidebarList-item"><?= t('server.requests.last_voted') ?>: <?= time_diff($Request['LastVote']) ?> </li>
|
||||
<? } ?>
|
||||
<?
|
||||
if ($Request['GroupID']) {
|
||||
?>
|
||||
<li class="SidebarList-item"><?= t('server.requests.torrent_group') ?>: <a href="torrents.php?id=<?= $Request['GroupID'] ?>">torrents.php?id=<?= $Request['GroupID'] ?></a> </li>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<? if ($IsFilled) {
|
||||
$TimeCompare = 1267643718; // Requests v2 was implemented 2010-03-03 20:15:18
|
||||
?>
|
||||
@@ -297,37 +329,6 @@ $Pages = Format::get_pages($Page, $NumComments, CONFIG['TORRENT_COMMENTS_PER_PAG
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="SidebarItemArtists SidebarItem Box">
|
||||
<div class="SidebarItem-header Box-header">
|
||||
<strong><?= t('server.common.director') ?></strong>
|
||||
</div>
|
||||
<ul class="SidebarList SidebarItem-body Box-body">
|
||||
<?
|
||||
foreach ($ArtistForm[Artists::Director] as $Artist) {
|
||||
?>
|
||||
<li class="SidebarList-item">
|
||||
<?= Artists::display_artist($Artist) ?>
|
||||
</li>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="SidebarItemTags SidebarItem Box">
|
||||
<div class="SidebarItem-header Box-header">
|
||||
<strong><?= t('server.requests.tags') ?></strong>
|
||||
</div>
|
||||
<ul class="SidebarList SidebarItem-body Box-body">
|
||||
<?
|
||||
$Tags = Tags::get_sub_name($Request['Tags']);
|
||||
foreach ($Tags as $Key => $Tag) {
|
||||
?>
|
||||
<li class="SidebarList-item">
|
||||
<a href="torrents.php?action=advanced&taglist=<?= $Tag ?>"><?= $Tag ?></a>
|
||||
</li>
|
||||
<? } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="LayoutMainSidebar-main">
|
||||
<div class="TableContainer">
|
||||
@@ -390,19 +391,33 @@ $Pages = Format::get_pages($Page, $NumComments, CONFIG['TORRENT_COMMENTS_PER_PAG
|
||||
<td class="Form-label" valign="top"><?= t('server.requests.fill_request') ?>:</td>
|
||||
<td class="Form-items">
|
||||
<form class="u-vstack edit_form" name="request" action="" method="post">
|
||||
<div class="field_div">
|
||||
<input type="hidden" name="action" value="takefill" />
|
||||
<input type="hidden" name="auth" value="<?= $LoggedUser['AuthKey'] ?>" />
|
||||
<input type="hidden" name="requestid" value="<?= $RequestID ?>" />
|
||||
<input placeholder="<?= t('server.requests.should_be_pl_to_the_torrent') ?><?= site_url() ?>torrents.php?torrentid=xxxx" class="Input" type="text" size="50" name="link" <?= (!empty($Link) ? " value=\"$Link\"" : '') ?> />
|
||||
</div>
|
||||
<input type="hidden" name="action" value="takefill" />
|
||||
<input type="hidden" name="auth" value="<?= $LoggedUser['AuthKey'] ?>" />
|
||||
<input type="hidden" name="requestid" value="<?= $RequestID ?>" />
|
||||
<?
|
||||
if ($RequestType == 1) {
|
||||
?>
|
||||
<div class="field_div">
|
||||
|
||||
<input placeholder="<?= t('server.requests.should_be_pl_to_the_torrent') ?><?= site_url() ?>torrents.php?torrentid=xxxx" class="Input" type="text" size="50" name="link" <?= (!empty($Link) ? " value=\"$Link\"" : '') ?> />
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<div class="field_div">
|
||||
<? if (check_perms('site_moderate_requests')) { ?>
|
||||
<?= t('server.requests.for_user') ?>: <input class="Input is-small" type="text" size="25" name="user" <?= (!empty($FillerUsername) ? " value=\"$FillerUsername\"" : '') ?> />
|
||||
<? } ?>
|
||||
<button class="Button" type="submit" value="Fill request" /><?= t('server.requests.fill_request') ?></button>
|
||||
<a href="upload.php?requestid=<?= $RequestID ?><?= ($Request['GroupID'] ? "&groupid=$Request[GroupID]" : '') ?>"><button class="Button" type="button" id="upload" value="Upload request"><?= t('server.requests.upload_request') ?></button></a>
|
||||
<strong style="margin-bottom: 10px;">[<a href="javascript:void(0);" onclick="$('#fill_a_request_how_to_blockquote').toggle();"><strong class="how_to_toggle"><?= t('server.requests.fill_a_request_how_to_toggle') ?></strong></a>]</strong>
|
||||
<?
|
||||
if ($RequestType == 2) {
|
||||
} else {
|
||||
?>
|
||||
<a href="upload.php?requestid=<?= $RequestID ?><?= ($Request['GroupID'] ? "&groupid=$Request[GroupID]" : '') ?>"><button class="Button" type="button" id="upload" value="Upload request"><?= t('server.requests.upload_request') ?></button></a>
|
||||
<strong style="margin-bottom: 10px;">[<a href="javascript:void(0);" onclick="$('#fill_a_request_how_to_blockquote').toggle();"><strong class="how_to_toggle"><?= t('server.requests.fill_a_request_how_to_toggle') ?></strong></a>]</strong>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//******************************************************************************//
|
||||
//--------------- Fill a request -----------------------------------------------//
|
||||
|
||||
use Gazelle\Manager\ActionTrigger;
|
||||
|
||||
$RequestID = $_REQUEST['requestid'];
|
||||
if (!is_number($RequestID)) {
|
||||
error(0);
|
||||
@@ -9,42 +11,28 @@ if (!is_number($RequestID)) {
|
||||
|
||||
authorize();
|
||||
|
||||
//VALIDATION
|
||||
if (!empty($_GET['torrentid']) && is_number($_GET['torrentid'])) {
|
||||
$TorrentID = $_GET['torrentid'];
|
||||
} else {
|
||||
if (empty($_POST['link'])) {
|
||||
error(t('server.requests.forgot_link_fill_torrent'));
|
||||
} else {
|
||||
$Link = $_POST['link'];
|
||||
if (!preg_match('/' . TORRENT_REGEX . '/i', $Link, $Matches)) {
|
||||
error(t('server.requests.link_not_valid'));
|
||||
} else {
|
||||
$TorrentID = $Matches[2];
|
||||
}
|
||||
}
|
||||
if (!$TorrentID || !is_number($TorrentID)) {
|
||||
error(404);
|
||||
}
|
||||
}
|
||||
|
||||
//Torrent exists, check it's applicable
|
||||
$DB->query("
|
||||
SELECT
|
||||
t.UserID,
|
||||
t.Time,
|
||||
tg.ReleaseType,
|
||||
tg.CategoryID,
|
||||
t.GroupID
|
||||
FROM torrents AS t
|
||||
LEFT JOIN torrents_group AS tg ON t.GroupID = tg.ID
|
||||
WHERE t.ID = $TorrentID
|
||||
LIMIT 1");
|
||||
Title,
|
||||
UserID,
|
||||
TorrentID,
|
||||
CategoryID,
|
||||
ReleaseType,
|
||||
Year,
|
||||
Title as Name,
|
||||
Subtitle as SubName,
|
||||
RequestType,
|
||||
SourceTorrent
|
||||
FROM requests
|
||||
WHERE ID = $RequestID");
|
||||
$Data = $DB->next_record(MYSQLI_ASSOC, false);
|
||||
list($Title, $RequesterID, $OldTorrentID, $RequestCategoryID, $RequestReleaseType, $Year, $Name, $SubName, $RequestType, $SourceTorrent) = array_values($Data);
|
||||
|
||||
if (!$DB->has_results()) {
|
||||
error(404);
|
||||
if (!empty($OldTorrentID)) {
|
||||
$Err = t('server.requests.already_filled');
|
||||
}
|
||||
list($UploaderID, $UploadTime, $TorrentReleaseType, $TorrentCategoryID, $GroupID) = $DB->next_record();
|
||||
|
||||
$RequestGroupName = Torrents::group_name($Data, false);
|
||||
|
||||
$FillerID = $LoggedUser['ID'];
|
||||
$FillerUsername = $LoggedUser['Username'];
|
||||
@@ -62,36 +50,69 @@ if (!empty($_POST['user']) && check_perms('site_moderate_requests')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (time_ago($UploadTime) < 3600 && $UploaderID !== $FillerID && !check_perms('site_moderate_requests')) {
|
||||
$Err = t('server.requests.one_hour_grace_period');
|
||||
if ($RequestType == 1) {
|
||||
//VALIDATION
|
||||
if (!empty($_GET['torrentid']) && is_number($_GET['torrentid'])) {
|
||||
$TorrentID = $_GET['torrentid'];
|
||||
} else {
|
||||
if (empty($_POST['link'])) {
|
||||
error(t('server.requests.forgot_link_fill_torrent'));
|
||||
} else {
|
||||
$Link = $_POST['link'];
|
||||
if (!preg_match('/' . TORRENT_REGEX . '/i', $Link, $Matches)) {
|
||||
error(t('server.requests.link_not_valid'));
|
||||
} else {
|
||||
$TorrentID = $Matches[2];
|
||||
}
|
||||
}
|
||||
if (!$TorrentID || !is_number($TorrentID)) {
|
||||
error(404);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$Link = $SourceTorrent;
|
||||
if (!preg_match('/' . TORRENT_REGEX . '/i', $Link, $Matches)) {
|
||||
error('invlaid request');
|
||||
}
|
||||
$SourceTorrentID = $Matches[2];
|
||||
$Result = $DB->query(
|
||||
"SELECT xu.uid
|
||||
FROM xbt_files_users AS xu
|
||||
WHERE xu.fid = '$SourceTorrentID' and xu.uid = $FillerID and active = 1 and xu.remaining = 0 "
|
||||
);
|
||||
if (!$DB->has_results()) {
|
||||
//$Err = t('server.requests.cant_fill');
|
||||
}
|
||||
$TorrentID = $SourceTorrentID;
|
||||
}
|
||||
|
||||
|
||||
//Torrent exists, check it's applicable
|
||||
$DB->query("
|
||||
SELECT
|
||||
Title,
|
||||
UserID,
|
||||
TorrentID,
|
||||
CategoryID,
|
||||
ReleaseType,
|
||||
Year,
|
||||
Title as Name,
|
||||
Subtitle as SubName
|
||||
FROM requests
|
||||
WHERE ID = $RequestID");
|
||||
$Data = $DB->next_record(MYSQLI_ASSOC, false);
|
||||
list($Title, $RequesterID, $OldTorrentID, $RequestCategoryID, $RequestReleaseType, $Year, $Name, $SubName) = array_values($Data);
|
||||
$RequestGroupName = Torrents::group_name($Data, false);
|
||||
t.UserID,
|
||||
t.Time,
|
||||
tg.ReleaseType,
|
||||
tg.CategoryID,
|
||||
t.GroupID
|
||||
FROM torrents AS t
|
||||
LEFT JOIN torrents_group AS tg ON t.GroupID = tg.ID
|
||||
WHERE t.ID = $TorrentID
|
||||
LIMIT 1");
|
||||
|
||||
|
||||
if (!empty($OldTorrentID)) {
|
||||
$Err = t('server.requests.already_filled');
|
||||
if (!$DB->has_results()) {
|
||||
error(404);
|
||||
}
|
||||
list($UploaderID, $UploadTime, $TorrentReleaseType, $TorrentCategoryID, $GroupID) = $DB->next_record();
|
||||
if ($RequestType == 1) {
|
||||
if (time_ago($UploadTime) < 3600 && $UploaderID !== $FillerID && !check_perms('site_moderate_requests')) {
|
||||
$Err = t('server.requests.one_hour_grace_period');
|
||||
}
|
||||
}
|
||||
|
||||
$CategoryName = $Categories[$RequestCategoryID - 1];
|
||||
if ($RequestCategoryID !== '0' && $TorrentCategoryID !== $RequestCategoryID) {
|
||||
$Err = t('server.requests.torrent_category_different_from_torrent');
|
||||
}
|
||||
|
||||
$CategoryName = $Categories[$RequestCategoryID - 1];
|
||||
// Fill request
|
||||
if (!empty($Err)) {
|
||||
error($Err);
|
||||
@@ -115,7 +136,7 @@ $DB->query("
|
||||
$UserIDs = $DB->to_array();
|
||||
foreach ($UserIDs as $User) {
|
||||
list($VoterID) = $User;
|
||||
Misc::send_pm_with_tpl($VoterID, 'request_filled', ['FullName' => $FullName, 'RequestID' => $RequestID, 'TorrentID' => $TorrentID]);
|
||||
Misc::send_pm_with_tpl($VoterID, 'request_filled', ['FullName' => $FullName, 'RequestID' => $RequestID, 'TorrentID' => $TorrentID, 'RequestType' => $RequestType]);
|
||||
}
|
||||
|
||||
$RequestVotes = Requests::get_votes_array($RequestID);
|
||||
@@ -127,6 +148,11 @@ $DB->query("
|
||||
SET Uploaded = (Uploaded + " . $RequestVotes['TotalBounty'] . ")
|
||||
WHERE ID = $FillerID");
|
||||
|
||||
// free
|
||||
|
||||
if ($FreeHour = CONFIG['REQUEST_FILL_FREE_HOUR']) {
|
||||
Torrents::freeleech_torrents($TorrentID, 1, 0, false, date('Y-m-d H:i:s', strtotime("+$FreeHour Hour")));
|
||||
}
|
||||
|
||||
|
||||
$Cache->delete_value("user_stats_$FillerID");
|
||||
@@ -145,6 +171,8 @@ $ArtistIDs = $DB->to_array();
|
||||
foreach ($ArtistIDs as $ArtistID) {
|
||||
$Cache->delete_value("artists_requests_$ArtistID");
|
||||
}
|
||||
$trigger = new ActionTrigger;
|
||||
$trigger->triggerFillRequest($RequestID, $TorretnID);
|
||||
|
||||
Requests::update_sphinx_requests($RequestID);
|
||||
$SphQL = new SphinxqlQuery();
|
||||
|
||||
+339
-195
@@ -2,23 +2,40 @@
|
||||
|
||||
//******************************************************************************//
|
||||
//----------------- Take request -----------------------------------------------//
|
||||
authorize();
|
||||
|
||||
use Gazelle\Manager\ActionTrigger;
|
||||
|
||||
authorize();
|
||||
|
||||
if ($_POST['action'] !== 'takenew' && $_POST['action'] !== 'takeedit') {
|
||||
error(0);
|
||||
}
|
||||
|
||||
$NewRequest = ($_POST['action'] === 'takenew');
|
||||
|
||||
if (!$NewRequest) {
|
||||
$ReturnEdit = true;
|
||||
$RequestType = $_POST['request_type'];
|
||||
if ($_POST['action'] == 'takeedit' && $RequestType != 1) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
$NewRequest = ($_POST['action'] === 'takenew');
|
||||
|
||||
if ($NewRequest) {
|
||||
if (!check_perms('site_submit_requests') || $LoggedUser['BytesUploaded'] < 250 * 1024 * 1024) {
|
||||
error(403);
|
||||
}
|
||||
if (empty($_POST['amount'])) {
|
||||
$Err = t('server.requests.forgot_enter_bounty');
|
||||
} else {
|
||||
$Bounty = trim($_POST['amount']);
|
||||
if (!is_number($Bounty)) {
|
||||
$Err = t('server.requests.entered_bounty_not_number');
|
||||
} elseif ($Bounty < CONFIG['REQUEST_MIN_VOTE']) {
|
||||
$Err = t('server.requests.min_bounty');
|
||||
}
|
||||
$Bytes = $Bounty; //From MB to B
|
||||
}
|
||||
if ($LoggedUser['BytesUploaded'] < $Amount) {
|
||||
$Err = "You can't afford that request!";
|
||||
}
|
||||
} else {
|
||||
$RequestID = $_POST['requestid'];
|
||||
if (!is_number($RequestID)) {
|
||||
@@ -35,6 +52,7 @@ if ($NewRequest) {
|
||||
$CategoryName = $Categories[$Request['CategoryID'] - 1];
|
||||
$ProjectCanEdit = check_perms('project_team') && !$IsFilled;
|
||||
$CanEdit = ((!$IsFilled && $LoggedUser['ID'] === $Request['UserID'] && $VoteCount < 2) || $ProjectCanEdit || check_perms('site_moderate_requests'));
|
||||
$ReturnEdit = true;
|
||||
|
||||
if (!$CanEdit) {
|
||||
error(403);
|
||||
@@ -46,242 +64,313 @@ if (empty($_POST['type'])) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$CategoryName = $_POST['type'];
|
||||
$CategoryID = (array_search($CategoryName, $Categories) + 1);
|
||||
|
||||
if (empty($CategoryID)) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
if (empty($_POST['name'])) {
|
||||
$Err = t('server.requests.forgot_enter_title');
|
||||
} else {
|
||||
$Title = trim($_POST['name']);
|
||||
}
|
||||
|
||||
if (!empty($_POST['subname'])) {
|
||||
$Subtitle = trim($_POST['subname']);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_POST['source_torrent'])) {
|
||||
$SourceTorrent = trim($_POST['source_torrent']);
|
||||
}
|
||||
|
||||
if (!empty($_POST['purchasable_at'])) {
|
||||
$PurchasableAt = trim($_POST['purchasable_at']);
|
||||
}
|
||||
if (!empty($_POST['imdb'])) {
|
||||
preg_match('/(tt\\d+)/', $_POST['imdb'], $IMDBMatch);
|
||||
if ($IMDBMatch[1]) {
|
||||
$IMDBID = $IMDBMatch[1];
|
||||
if ($RequestType == '1' || empty($RequestType)) {
|
||||
if (empty($_POST['name'])) {
|
||||
$Err = t('server.requests.forgot_enter_title');
|
||||
} else {
|
||||
die("invalid imdb");
|
||||
$Title = trim($_POST['name']);
|
||||
}
|
||||
}
|
||||
if (empty($_POST['tags'])) {
|
||||
$Err = t('server.requests.forgot_enter_tags');
|
||||
} else {
|
||||
$Tags = trim($_POST['tags']);
|
||||
}
|
||||
|
||||
if ($NewRequest) {
|
||||
if (empty($_POST['amount'])) {
|
||||
$Err = t('server.requests.forgot_enter_bounty');
|
||||
} else {
|
||||
$Bounty = trim($_POST['amount']);
|
||||
if (!is_number($Bounty)) {
|
||||
$Err = t('server.requests.entered_bounty_not_number');
|
||||
} elseif ($Bounty < 100 * 1024 * 1024) {
|
||||
$Err = t('server.requests.min_bounty');
|
||||
if (!empty($_POST['subname'])) {
|
||||
$Subtitle = trim($_POST['subname']);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_POST['source_torrent'])) {
|
||||
$SourceTorrent = trim($_POST['source_torrent']);
|
||||
}
|
||||
|
||||
if (!empty($_POST['purchasable_at'])) {
|
||||
$PurchasableAt = trim($_POST['purchasable_at']);
|
||||
}
|
||||
if (!empty($_POST['imdb'])) {
|
||||
preg_match('/(tt\\d+)/', $_POST['imdb'], $IMDBMatch);
|
||||
if ($IMDBMatch[1]) {
|
||||
$IMDBID = $IMDBMatch[1];
|
||||
} else {
|
||||
die("invalid imdb");
|
||||
}
|
||||
$Bytes = $Bounty; //From MB to B
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($_POST['image'])) {
|
||||
$Image = '';
|
||||
} else {
|
||||
ImageTools::blacklisted($_POST['image']);
|
||||
if (preg_match('/' . IMAGE_REGEX . '/', trim($_POST['image'])) > 0) {
|
||||
$Image = trim($_POST['image']);
|
||||
if (empty($_POST['tags'])) {
|
||||
$Err = t('server.requests.forgot_enter_tags');
|
||||
} else {
|
||||
$Err = display_str($_POST['image']) . t('server.requests.image_link_invalid');
|
||||
$Tags = trim($_POST['tags']);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($_POST['description'])) {
|
||||
$Err = t('server.requests.forgot_enter_description');
|
||||
} else {
|
||||
$Description = trim($_POST['description']);
|
||||
}
|
||||
|
||||
if (empty($_POST['artist_ids'])) {
|
||||
$Err = t('server.requests.forgot_enter_artists');
|
||||
} else {
|
||||
$Artists = $_POST['artists'];
|
||||
$ArtistIDs = $_POST['artist_ids'];
|
||||
$ArtistsSubName = $_POST['artists_sub'];
|
||||
$Importance = $_POST['importance'];
|
||||
}
|
||||
|
||||
if (!is_number($_POST['releasetype']) || !in_array($_POST['releasetype'], $ReleaseTypes)) {
|
||||
$Err = t('server.requests.forgot_pick_release_type');
|
||||
}
|
||||
|
||||
$ReleaseType = $_POST['releasetype'];
|
||||
|
||||
if (empty($_POST['all_codecs']) && count($_POST['codecs']) !== count($Codecs)) {
|
||||
$CodecArray = $_POST['codecs'];
|
||||
if (count($CodecArray) < 1) {
|
||||
$Err = t('server.requests.require_one_codec');
|
||||
if (empty($_POST['image'])) {
|
||||
$Image = '';
|
||||
} else {
|
||||
ImageTools::blacklisted($_POST['image']);
|
||||
if (preg_match('/' . IMAGE_REGEX . '/', trim($_POST['image'])) > 0) {
|
||||
$Image = trim($_POST['image']);
|
||||
} else {
|
||||
$Err = display_str($_POST['image']) . t('server.requests.image_link_invalid');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$AllCodec = true;
|
||||
}
|
||||
|
||||
if (empty($_POST['all_sources']) && count($_POST['sources']) !== count($Sources)) {
|
||||
$SourceArray = $_POST['sources'];
|
||||
if (count($SourceArray) < 1) {
|
||||
$Err = t('server.requests.require_one_source');
|
||||
if (empty($_POST['description'])) {
|
||||
$Err = t('server.requests.forgot_enter_description');
|
||||
} else {
|
||||
$Description = trim($_POST['description']);
|
||||
}
|
||||
} else {
|
||||
$AllSources = true;
|
||||
}
|
||||
|
||||
if (empty($_POST['all_containers']) && count($_POST['containers']) !== count($Containers)) {
|
||||
$ContainerArray = $_POST['containers'];
|
||||
if (count($ContainerArray) < 1) {
|
||||
$Err = t('server.requests.require_one_container');
|
||||
if (empty($_POST['artist_ids'])) {
|
||||
$Err = t('server.requests.forgot_enter_artists');
|
||||
} else {
|
||||
$Artists = $_POST['artists'];
|
||||
$ArtistIDs = $_POST['artist_ids'];
|
||||
$ArtistsSubName = $_POST['artists_sub'];
|
||||
$Importance = $_POST['importance'];
|
||||
}
|
||||
} else {
|
||||
$AllContainer = true;
|
||||
}
|
||||
if (empty($_POST['all_resolutions']) && count($_POST['resolutions']) !== count($Resolutions)) {
|
||||
$ResolutionArray = $_POST['resolutions'];
|
||||
if (count($ResolutionArray) < 1) {
|
||||
$Err = t('server.requests.require_one_resolution');
|
||||
}
|
||||
} else {
|
||||
$AllResolution = true;
|
||||
}
|
||||
|
||||
// GroupID
|
||||
if (!empty($_POST['group'])) {
|
||||
$GroupID = trim($_POST['group']);
|
||||
if (preg_match('/^' . TORRENT_GROUP_REGEX . '/i', $GroupID, $Matches)) {
|
||||
$GroupID = $Matches[2];
|
||||
$Director = [];
|
||||
for ($i = 0, $il = count($Artists); $i < $il; $i++) {
|
||||
if (trim($ArtistIDs[$i]) !== '') {
|
||||
$Director[] = array('IMDBID' => trim($ArtistIDs[$i]), 'Name' => db_string(trim($Artists[$i])), 'SubName' => db_string(trim($ArtistsSubName[$i])));
|
||||
}
|
||||
}
|
||||
if (is_number($GroupID)) {
|
||||
$DB->query("
|
||||
if (count($Director) < 1) {
|
||||
$Err = t('server.requests.at_least_one_director');
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!is_number($_POST['releasetype']) || !in_array($_POST['releasetype'], $ReleaseTypes)) {
|
||||
$Err = t('server.requests.forgot_pick_release_type');
|
||||
}
|
||||
|
||||
$ReleaseType = $_POST['releasetype'];
|
||||
|
||||
if (empty($_POST['all_codecs']) && count($_POST['codecs']) !== count($Codecs)) {
|
||||
$CodecArray = $_POST['codecs'];
|
||||
if (count($CodecArray) < 1) {
|
||||
$Err = t('server.requests.require_one_codec');
|
||||
}
|
||||
} else {
|
||||
$AllCodec = true;
|
||||
}
|
||||
|
||||
if (empty($_POST['all_sources']) && count($_POST['sources']) !== count($Sources)) {
|
||||
$SourceArray = $_POST['sources'];
|
||||
if (count($SourceArray) < 1) {
|
||||
$Err = t('server.requests.require_one_source');
|
||||
}
|
||||
} else {
|
||||
$AllSources = true;
|
||||
}
|
||||
|
||||
if (empty($_POST['all_containers']) && count($_POST['containers']) !== count($Containers)) {
|
||||
$ContainerArray = $_POST['containers'];
|
||||
if (count($ContainerArray) < 1) {
|
||||
$Err = t('server.requests.require_one_container');
|
||||
}
|
||||
} else {
|
||||
$AllContainer = true;
|
||||
}
|
||||
if (empty($_POST['all_resolutions']) && count($_POST['resolutions']) !== count($Resolutions)) {
|
||||
$ResolutionArray = $_POST['resolutions'];
|
||||
if (count($ResolutionArray) < 1) {
|
||||
$Err = t('server.requests.require_one_resolution');
|
||||
}
|
||||
} else {
|
||||
$AllResolution = true;
|
||||
}
|
||||
// GroupID
|
||||
if (!empty($_POST['group'])) {
|
||||
$GroupID = trim($_POST['group']);
|
||||
if (preg_match('/^' . TORRENT_GROUP_REGEX . '/i', $GroupID, $Matches)) {
|
||||
$GroupID = $Matches[2];
|
||||
}
|
||||
if (is_number($GroupID)) {
|
||||
$DB->query("
|
||||
SELECT 1
|
||||
FROM torrents_group
|
||||
WHERE ID = '$GroupID'
|
||||
AND CategoryID = 1");
|
||||
if (!$DB->has_results()) {
|
||||
if (!$DB->has_results()) {
|
||||
$Err = t('server.requests.torrent_group_must_correspond_site');
|
||||
}
|
||||
} else {
|
||||
$Err = t('server.requests.torrent_group_must_correspond_site');
|
||||
}
|
||||
} else {
|
||||
$Err = t('server.requests.torrent_group_must_correspond_site');
|
||||
$GroupID = 0;
|
||||
}
|
||||
} else {
|
||||
$GroupID = 0;
|
||||
}
|
||||
|
||||
if (empty($_POST['year'])) {
|
||||
$Err = t('server.requests.forgot_enter_year');
|
||||
} else {
|
||||
$Year = trim($_POST['year']);
|
||||
if (!is_number($Year)) {
|
||||
$Err = t('server.requests.entered_year_not_number');
|
||||
}
|
||||
}
|
||||
|
||||
$Director = [];
|
||||
for ($i = 0, $il = count($Artists); $i < $il; $i++) {
|
||||
if (trim($ArtistIDs[$i]) !== '') {
|
||||
$Director[] = array('IMDBID' => trim($ArtistIDs[$i]), 'Name' => db_string(trim($Artists[$i])), 'SubName' => db_string(trim($ArtistsSubName[$i])));
|
||||
}
|
||||
}
|
||||
if (count($Director) < 1) {
|
||||
$Err = t('server.requests.at_least_one_director');
|
||||
}
|
||||
|
||||
|
||||
if (!empty($Err)) {
|
||||
error($Err);
|
||||
$Div = $_POST['unit'] === 'mb' ? 1024 * 1024 : 1024 * 1024 * 1024;
|
||||
$Bounty /= $Div;
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/requests/new_edit.php');
|
||||
die();
|
||||
}
|
||||
|
||||
//Databasify the input
|
||||
if (empty($AllCodec)) {
|
||||
foreach ($CodecArray as $Index => $MasterIndex) {
|
||||
if (array_key_exists($Index, $Codecs)) {
|
||||
$CodecArray[$Index] = $Codecs[$MasterIndex];
|
||||
} else {
|
||||
//Hax
|
||||
error(0);
|
||||
if (empty($_POST['year'])) {
|
||||
$Err = t('server.requests.forgot_enter_year');
|
||||
} else {
|
||||
$Year = trim($_POST['year']);
|
||||
if (!is_number($Year)) {
|
||||
$Err = t('server.requests.entered_year_not_number');
|
||||
}
|
||||
}
|
||||
$CodecList = implode('|', $CodecArray);
|
||||
} else {
|
||||
$CodecList = 'Any';
|
||||
}
|
||||
|
||||
if (empty($AllSources)) {
|
||||
foreach ($SourceArray as $Index => $MasterIndex) {
|
||||
if (array_key_exists($Index, $Sources)) {
|
||||
$SourceArray[$Index] = $Sources[$MasterIndex];
|
||||
if (!empty($Err)) {
|
||||
error($Err);
|
||||
$Div = $_POST['unit'] === 'mb' ? 1024 * 1024 : 1024 * 1024 * 1024;
|
||||
$Bounty /= $Div;
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/requests/new_edit.php');
|
||||
die();
|
||||
}
|
||||
|
||||
//Databasify the input
|
||||
if (empty($AllCodec)) {
|
||||
foreach ($CodecArray as $Index => $MasterIndex) {
|
||||
if (array_key_exists($Index, $Codecs)) {
|
||||
$CodecArray[$Index] = $Codecs[$MasterIndex];
|
||||
} else {
|
||||
//Hax
|
||||
error(0);
|
||||
}
|
||||
}
|
||||
$CodecList = implode('|', $CodecArray);
|
||||
} else {
|
||||
$CodecList = 'Any';
|
||||
}
|
||||
|
||||
if (empty($AllSources)) {
|
||||
foreach ($SourceArray as $Index => $MasterIndex) {
|
||||
if (array_key_exists($Index, $Sources)) {
|
||||
$SourceArray[$Index] = $Sources[$MasterIndex];
|
||||
} else {
|
||||
//Hax
|
||||
error(0);
|
||||
}
|
||||
}
|
||||
$SourceList = implode('|', $SourceArray);
|
||||
} else {
|
||||
$SourceList = 'Any';
|
||||
}
|
||||
|
||||
if (empty($AllContainer)) {
|
||||
foreach ($ContainerArray as $Index => $MasterIndex) {
|
||||
if (array_key_exists($Index, $Containers)) {
|
||||
$ContainerArray[$Index] = $Containers[$MasterIndex];
|
||||
} else {
|
||||
//Hax
|
||||
error(0);
|
||||
}
|
||||
}
|
||||
$ContainerList = implode('|', $ContainerArray);
|
||||
} else {
|
||||
$ContainerList = 'Any';
|
||||
}
|
||||
|
||||
if (empty($AllResolution)) {
|
||||
foreach ($ResolutionArray as $Index => $MasterIndex) {
|
||||
if (array_key_exists($Index, $Resolutions)) {
|
||||
$ResolutionArray[$Index] = $Resolutions[$MasterIndex];
|
||||
} else {
|
||||
//Hax
|
||||
error(0);
|
||||
}
|
||||
}
|
||||
$ResolutionList = implode('|', $ResolutionArray);
|
||||
} else {
|
||||
$ResolutionList = 'Any';
|
||||
}
|
||||
} else if ($RequestType == '2') {
|
||||
if (empty($_POST['link'])) {
|
||||
error(0);
|
||||
} else {
|
||||
$Link = $_POST['link'];
|
||||
if (!preg_match('/' . TORRENT_REGEX . '/i', $Link, $Matches)) {
|
||||
error(t('server.requests.link_not_valid'));
|
||||
} else {
|
||||
//Hax
|
||||
error(0);
|
||||
$TorrentID = $Matches[2];
|
||||
}
|
||||
}
|
||||
$SourceList = implode('|', $SourceArray);
|
||||
if (!$TorrentID || !is_number($TorrentID)) {
|
||||
error(t('server.requests.link_not_valid'));
|
||||
}
|
||||
$Torrent = Torrents::get_torrent($TorrentID);
|
||||
if (empty($Torrent)) {
|
||||
error(t('server.requests.link_not_valid'));
|
||||
}
|
||||
if ($RequestID = Requests::get_torrent_request_id($TorrentID, $RequestType)) {
|
||||
//Remove the bounty and create the vote
|
||||
|
||||
$Bounty = ($Bytes * (1 - $RequestTax));
|
||||
$DB->query("
|
||||
INSERT IGNORE INTO requests_votes
|
||||
(RequestID, UserID, Bounty)
|
||||
VALUES
|
||||
($RequestID, " . $LoggedUser['ID'] . ', ' . ($Bounty) . ')');
|
||||
|
||||
if ($DB->affected_rows() < 1) {
|
||||
//Insert failed, probably a dupe vote, just increase their bounty.
|
||||
$DB->query("
|
||||
UPDATE requests_votes
|
||||
SET Bounty = (Bounty + $Bounty)
|
||||
WHERE UserID = " . $LoggedUser['ID'] . "
|
||||
AND RequestID = $RequestID");
|
||||
}
|
||||
|
||||
$DB->query("
|
||||
UPDATE requests
|
||||
SET LastVote = NOW()
|
||||
WHERE ID = $RequestID");
|
||||
|
||||
$DB->query("
|
||||
UPDATE users_main
|
||||
SET Uploaded = (Uploaded - $Bytes)
|
||||
WHERE ID = " . $LoggedUser['ID']);
|
||||
$Cache->delete_value("request_$RequestID");
|
||||
$Cache->delete_value("request_votes_$RequestID");
|
||||
$Cache->delete_value('user_stats_' . $LoggedUser['ID']);
|
||||
|
||||
Requests::update_sphinx_requests($RequestID);
|
||||
$DB->query("
|
||||
SELECT UserID
|
||||
FROM requests_votes
|
||||
WHERE RequestID = '$RequestID'
|
||||
AND UserID != '$LoggedUser[ID]'");
|
||||
$UserIDs = array();
|
||||
while (list($UserID) = $DB->next_record()) {
|
||||
$UserIDs[] = $UserID;
|
||||
}
|
||||
NotificationsManager::notify_users($UserIDs, NotificationsManager::REQUESTALERTS, Format::get_size($Bytes) . " of bounty has been added to a request you've voted on!", "requests.php?action=view&id=" . $RequestID);
|
||||
header("Location: requests.php?action=view&id=$RequestID");
|
||||
die();
|
||||
}
|
||||
|
||||
$Group = $Torrent['Group'];
|
||||
$Title = $Group['Name'];
|
||||
$Subtitle = $Group['SubName'];
|
||||
$IMDBID = $Group['IMDBID'];
|
||||
$Tags = $Group['TagList'];
|
||||
$Image = $Group['WikiImage'];
|
||||
$Director = Artists::get_artist($Group['ID'])[Artists::Director];
|
||||
$ReleaseType = $Group['ReleaseType'];
|
||||
$SourceTorrent = $_POST['link'];
|
||||
$CodecList = $Torrent['Codec'];
|
||||
$SourceList = $Torrent['Source'];
|
||||
$ContainerList = $Torrent['Container'];
|
||||
$ResolutionList = $Torrent['Resolution'];
|
||||
$GroupID = $Group['ID'];
|
||||
$Year = $Group['Year'];
|
||||
} else {
|
||||
$SourceList = 'Any';
|
||||
error(0);
|
||||
}
|
||||
|
||||
if (empty($AllContainer)) {
|
||||
foreach ($ContainerArray as $Index => $MasterIndex) {
|
||||
if (array_key_exists($Index, $Containers)) {
|
||||
$ContainerArray[$Index] = $Containers[$MasterIndex];
|
||||
} else {
|
||||
//Hax
|
||||
error(0);
|
||||
}
|
||||
}
|
||||
$ContainerList = implode('|', $ContainerArray);
|
||||
} else {
|
||||
$ContainerList = 'Any';
|
||||
}
|
||||
|
||||
if (empty($AllResolution)) {
|
||||
foreach ($ResolutionArray as $Index => $MasterIndex) {
|
||||
if (array_key_exists($Index, $Resolutions)) {
|
||||
$ResolutionArray[$Index] = $Resolutions[$MasterIndex];
|
||||
} else {
|
||||
//Hax
|
||||
error(0);
|
||||
}
|
||||
}
|
||||
$ResolutionList = implode('|', $ResolutionArray);
|
||||
} else {
|
||||
$ResolutionList = 'Any';
|
||||
}
|
||||
|
||||
//Query time!
|
||||
if ($NewRequest) {
|
||||
$DB->query('
|
||||
INSERT INTO requests (
|
||||
UserID, TimeAdded, LastVote, CategoryID, Title, Year, Image, Description,
|
||||
ReleaseType, CodecList, SourceList, ContainerList, ResolutionList, IMDBID, PurchasableAt, Subtitle, SourceTorrent, Visible, GroupID)
|
||||
ReleaseType, CodecList, SourceList, ContainerList, ResolutionList, IMDBID, PurchasableAt, Subtitle, SourceTorrent, Visible, GroupID, RequestType)
|
||||
VALUES
|
||||
(' . $LoggedUser['ID'] . ", '" . sqltime() . "', '" . sqltime() . "', $CategoryID, '" . db_string($Title) . "', $Year, '" . db_string($Image) . "', '" . db_string($Description) . "', " .
|
||||
$ReleaseType . ", '$CodecList','$SourceList', '$ContainerList', '$ResolutionList', '$IMDBID', '" . db_string($PurchasableAt) . "', '" . db_string($Subtitle) . "', '" . db_string($SourceTorrent) . "', 1, " . $GroupID . ")");
|
||||
$ReleaseType . ", '$CodecList','$SourceList', '$ContainerList', '$ResolutionList', '$IMDBID', '" . db_string($PurchasableAt) . "', '" . db_string($Subtitle) . "', '" . db_string($SourceTorrent) . "', 1, " . $GroupID . ", '" . db_string($RequestType) . "')");
|
||||
|
||||
$RequestID = $DB->inserted_id();
|
||||
} else {
|
||||
@@ -382,6 +471,61 @@ if ($NewRequest) {
|
||||
SET Uploaded = (Uploaded - $Bytes)
|
||||
WHERE ID = " . $LoggedUser['ID']);
|
||||
$Cache->delete_value('user_stats_' . $LoggedUser['ID']);
|
||||
$trigger = new ActionTrigger;
|
||||
$trigger->triggerNewRequest($RequestID, $TorrentID);
|
||||
|
||||
|
||||
if ($RequestType == 2) {
|
||||
$usersToNotify = array();
|
||||
|
||||
$DB->query("
|
||||
SELECT s.uid AS id, MAX(s.tstamp) AS tstamp
|
||||
FROM xbt_snatched as s
|
||||
INNER JOIN users_main as u
|
||||
ON s.uid = u.ID
|
||||
WHERE s.fid = '$TorrentID'
|
||||
AND u.Enabled = '1'
|
||||
GROUP BY s.uid
|
||||
ORDER BY tstamp DESC
|
||||
LIMIT 100");
|
||||
if ($DB->has_results()) {
|
||||
$Users = $DB->to_array();
|
||||
foreach ($Users as $User) {
|
||||
$UserID = $User['id'];
|
||||
$TimeStamp = $User['tstamp'];
|
||||
|
||||
$usersToNotify[$UserID] = array("Snatched", $TimeStamp);
|
||||
}
|
||||
}
|
||||
|
||||
$usersToNotify[$UploaderID] = array("Uploaded", strtotime($UploadedTime));
|
||||
$Torrent = TOrrents::get_torrent($TorrentID);
|
||||
$Name = Torrents::torrent_name($Torrent, false);
|
||||
|
||||
$usersToNotify[1] = array("Snatched", time());
|
||||
|
||||
foreach ($usersToNotify as $UserID => $info) {
|
||||
$Username = Users::user_info($UserID)['Username'];
|
||||
list($action, $TimeStamp) = $info;
|
||||
Misc::send_pm_with_tpl(
|
||||
$UserID,
|
||||
'reseed_request',
|
||||
[
|
||||
'UserName' => $Username,
|
||||
'LoggedUserID' => $LoggedUser['ID'],
|
||||
'LoggedUserName' => $LoggedUser['Username'],
|
||||
'Date' => date('M d Y', $TimeStamp),
|
||||
'Action' => $action,
|
||||
'GroupID' => $GroupID,
|
||||
'TorrentID' => $TorrentID,
|
||||
'Name' => $Name,
|
||||
'Bountry' => Format::get_size($Bytes),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$Announce = "\"$Title\" - " . site_url() . "requests.php?action=view&id=$RequestID - " . implode(' ', $Tags);
|
||||
send_irc("PRIVMSG #requests :{$Announce}");
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<?php
|
||||
|
||||
//------------- Promote users -------------------------------------------//
|
||||
|
||||
use Gazelle\Manager\Reward;
|
||||
use Gazelle\Action\RewardInfo;
|
||||
|
||||
sleep(5);
|
||||
$DeadPeriod = TORRENT_DEAD_PERIOD;
|
||||
foreach ($UserPromoteCriteria as $L) { // $L = Level
|
||||
@@ -49,10 +53,11 @@ foreach ($UserPromoteCriteria as $L) { // $L = Level
|
||||
$UserIDs = $DB->collect('ID');
|
||||
|
||||
if (count($UserIDs) > 0) {
|
||||
$DB->query("
|
||||
UPDATE users_main
|
||||
$DB->query(
|
||||
"UPDATE users_main
|
||||
SET PermissionID = " . $L['To'] . "
|
||||
WHERE ID IN(" . implode(',', $UserIDs) . ')');
|
||||
WHERE ID IN(" . implode(',', $UserIDs) . ')'
|
||||
);
|
||||
foreach ($UserIDs as $UserID) {
|
||||
/*$Cache->begin_transaction("user_info_$UserID");
|
||||
$Cache->update_row(false, array('PermissionID' => $L['To']));
|
||||
@@ -61,19 +66,23 @@ foreach ($UserPromoteCriteria as $L) { // $L = Level
|
||||
$Cache->delete_value("user_info_heavy_$UserID");
|
||||
$Cache->delete_value("user_stats_$UserID");
|
||||
$Cache->delete_value("enabled_$UserID");
|
||||
$DB->query("
|
||||
UPDATE users_info
|
||||
$DB->query(
|
||||
"UPDATE users_info
|
||||
SET AdminComment = CONCAT('" . sqltime() . " - Class changed to " . Users::make_class_string($L['To']) . " by System\n\n', AdminComment)
|
||||
WHERE UserID = $UserID");
|
||||
|
||||
Misc::send_pm_with_tpl($UserID, 'promote_users', ['UserClass' => Users::make_class_string($L['To']), 'CONFIG' => CONFIG]);
|
||||
WHERE UserID = $UserID"
|
||||
);
|
||||
if ($L['Invite']) {
|
||||
$DB->query("select AwardLevel from users_main where ID=$UserID and AwardLevel < " . $L['AwardLevel']);
|
||||
$AwardLevel = $DB->collect('AwardLevel');
|
||||
if (count($AwardLevel) > 0) {
|
||||
$DB->query("UPDATE users_main SET AwardLevel = " . $L['AwardLevel'] . ", Invites = Invites + " . $L['Invite'] . " WHERE ID = $UserID");
|
||||
$DB->query("UPDATE users_main SET AwardLevel = " . $L['AwardLevel'] . " WHERE ID = $UserID");
|
||||
$rewardManager = new Reward;
|
||||
$reward = new RewardInfo;
|
||||
$reward->inviteCount = $L['Invite'];
|
||||
$rewardManager->sendReward($reward, [$UserID], "Level up reward.", false, true);
|
||||
}
|
||||
}
|
||||
Misc::send_pm_with_tpl($UserID, 'promote_users', ['UserClass' => Users::make_class_string($L['To']), 'CONFIG' => CONFIG]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
<?php
|
||||
|
||||
//------------- Delete dead torrents ------------------------------------//
|
||||
sleep(10);
|
||||
$Criteria = array();
|
||||
$Criteria[] = array('ddt' => 500 * 250 * 1024 * 1024, 'tdt' => 500, 'token' => 50, 'bonus' => 6000);
|
||||
$Criteria[] = array('ddt' => 320 * 250 * 1024 * 1024, 'tdt' => 320, 'token' => 32, 'bonus' => 2800);
|
||||
$Criteria[] = array('ddt' => 200 * 250 * 1024 * 1024, 'tdt' => 200, 'token' => 20, 'bonus' => 1300);
|
||||
$Criteria[] = array('ddt' => 120 * 250 * 1024 * 1024, 'tdt' => 120, 'token' => 12, 'bonus' => 600);
|
||||
$Criteria[] = array('ddt' => 60 * 250 * 1024 * 1024, 'tdt' => 60, 'token' => 6, 'bonus' => 240);
|
||||
$Criteria[] = array('ddt' => 25 * 250 * 1024 * 1024, 'tdt' => 25, 'token' => 2, 'bonus' => 100);
|
||||
$Criteria[] = array('ddt' => 10 * 250 * 1024 * 1024, 'tdt' => 10, 'token' => 1, 'bonus' => 0);
|
||||
/*
|
||||
$DB->query("select u.ID, u.Downloaded ND, l.Downloaded LD, TorrentCnt LT from users_main as u left join users_last_month as l on u.ID=l.ID");
|
||||
|
||||
$Users = $DB->to_array(false, MYSQLI_NUM, false);
|
||||
foreach ($Users as $User) {
|
||||
list($ID, $ND, $LD, $LT) = $User;
|
||||
$DB->query("SELECT COUNT(DISTINCT x.fid)
|
||||
FROM xbt_snatched AS x
|
||||
INNER JOIN torrents AS t ON t.ID = x.fid
|
||||
WHERE x.uid = '$ID'");
|
||||
$TorrentCnt = $DB->to_array(false, MYSQLI_NUM, false);
|
||||
$NT = $TorrentCnt[0][0];
|
||||
if ($LD == 0 && $ND != 0) {
|
||||
$DB->query("insert into users_last_month VALUES ($ID,$ND,$NT)");
|
||||
}
|
||||
if ($ND != $LD) {
|
||||
$DB->query("update users_last_month set Downloaded='$ND',TorrentCnt='$NT' where ID=$ID");
|
||||
foreach ($Criteria as $L) {
|
||||
if ($ND - $LD >= $L['ddt'] && $NT - $LT >= $L['tdt']) {
|
||||
$DB->query("UPDATE users_main SET FLTokens = FLTokens + ".$L['token'].",BonusPoints = BonusPoints + ".$L['bonus']." WHERE ID = $ID");
|
||||
for ($i = 0; $i < $L['token']; $i ++) {
|
||||
$DB->query("INSERT into tokens_typed (`UserID`,`EndTime`,`Type`) VALUES ($ID,DATE_FORMAT(date_sub(date_add(now(), interval 1 month), interval 1 day),'%Y-%m-%d'),'time')");
|
||||
}
|
||||
$Cache->delete_value('user_info_heavy_'.$ID);
|
||||
$Cache->delete_value('user_stats_'.$ID);
|
||||
Misc::send_pm($ID, 0, "本月奖励", "你拿到了 ".$L['tdt']." 个种子的奖励:".$L['token']." 枚令牌".($L['bonus']? $L['bonus']." 积分。": "。"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
$DB->query("SELECT xs.uid, xs.tstamp, xs.fid, t.Size
|
||||
FROM xbt_snatched AS xs left join torrents AS t ON t.ID = xs.fid
|
||||
WHERE xs.tstamp >= unix_timestamp(date_format(date_sub(now(), interval 1 month),'%Y-%m-01')) order by 2");
|
||||
$Requests = $DB->to_array();
|
||||
$SnatchedByUser;
|
||||
foreach ($Requests as $Request) {
|
||||
list($UserID, $Time, $TorrentID, $Size) = $Request;
|
||||
if (!isset($SnatchedByUser[$UserID][$TorrentID])) {
|
||||
$SnatchedByUser[$UserID][$TorrentID]['size'] = $Size;
|
||||
$SnatchedByUser[$UserID][$TorrentID]['free'] = 0;
|
||||
$SnatchedByUser[$UserID][$TorrentID]['unfree'] = 0;
|
||||
}
|
||||
$SnatchedByUser[$UserID][$TorrentID]['time'][] = $Time;
|
||||
}
|
||||
$DB->query("SELECT `UserID`, `TorrentID`, unix_timestamp(`Time`)
|
||||
FROM `users_freeleeches_time`
|
||||
WHERE unix_timestamp(Time) >= unix_timestamp(date_format(date_sub(now(), interval 1 month),'%Y-%m-01')) order by 3");
|
||||
$Requests = $DB->to_array();
|
||||
$TokenByUser;
|
||||
foreach ($Requests as $Request) {
|
||||
list($UserID, $TorrentID, $Time) = $Request;
|
||||
$TokenByUser[$UserID][$TorrentID][] = $Time;
|
||||
}
|
||||
$UsersCnt;
|
||||
foreach ($SnatchedByUser as $UserID => &$Torrents) {
|
||||
$UsersCnt[$UserID]['size'] = 0;
|
||||
$UsersCnt[$UserID]['cnt'] = 0;
|
||||
foreach ($Torrents as $TorrentID => &$Torrent) {
|
||||
if (isset($TokenByUser[$UserID][$TorrentID])) {
|
||||
foreach ($Torrent['time'] as $Time) {
|
||||
$free = false;
|
||||
foreach ($TokenByUser[$UserID][$TorrentID] as $key => $TokenTime) {
|
||||
if ($Time < $TokenTime + 345600) {
|
||||
unset($TokenByUser[$UserID][$TorrentID][$key]);
|
||||
$Torrent['free'] += 1;
|
||||
$free = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$free) {
|
||||
$Torrent['unfree'] += 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$Torrent['unfree'] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$DB->query("select u.ID, u.Downloaded ND, l.Downloaded LD, TorrentCnt LT from users_main as u left join users_last_month as l on u.ID=l.ID");
|
||||
$Requests = $DB->to_array();
|
||||
foreach ($Requests as $User) {
|
||||
list($ID, $ND, $LD, $LT) = $User;
|
||||
if ($LD == 0 && $ND != 0) {
|
||||
$DB->query("insert ignore into users_last_month VALUES ($ID,$ND,0)");
|
||||
}
|
||||
if ($ND != $LD) {
|
||||
$DB->query("update users_last_month set Downloaded='$ND',TorrentCnt=0 where ID=$ID");
|
||||
}
|
||||
$UsersCnt[$ID]['dt'] = $ND - $LD;
|
||||
}
|
||||
unset($Torrents, $Torrent);
|
||||
foreach ($SnatchedByUser as $UserID => $Torrents) {
|
||||
foreach ($Torrents as $Torrent) {
|
||||
if ($Torrent['unfree']) {
|
||||
$UsersCnt[$UserID]['size'] += $Torrent['size'];
|
||||
if ($Torrent['size']) {
|
||||
$UsersCnt[$UserID]['cnt']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// foreach ($UsersCnt as $UserID => $User) {
|
||||
// $LogSize = min ($User['size'], $User['dt']);
|
||||
// foreach ($Criteria as $L) {
|
||||
// if ($LogSize >= $L['ddt'] && $User['cnt'] >= $L['tdt']) {
|
||||
// $DB->query("UPDATE users_main SET FLTokens = FLTokens + ".$L['token'].",BonusPoints = BonusPoints + ".$L['bonus']." WHERE ID = $UserID");
|
||||
// for ($i = 0; $i < $L['token']; $i++) {
|
||||
// $DB->query("INSERT into tokens_typed (`UserID`,`EndTime`,`Type`) VALUES ($UserID,DATE_FORMAT(date_sub(date_add(now(), interval 1 month), interval 1 day),'%Y-%m-%d'),'time')");
|
||||
// }
|
||||
// $Cache->delete_value('user_info_heavy_'.$UserID);
|
||||
// $Cache->delete_value('user_stats_'.$UserID);
|
||||
// Misc::send_pm($UserID, 0, "本月奖励", "你拿到了 ".$L['tdt']." 个种子的奖励:".$L['token']." 枚令牌".($L['bonus']? "和 ".$L['bonus']." 积分。": "。"));
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -32,7 +32,6 @@ list($Secondary, $Staff) = $SupportStaff;
|
||||
</div>
|
||||
<div class="Group-body">
|
||||
<?= t('server.staff.role_applications_note') ?>
|
||||
<div><?= t('server.apply.referral_note') ?></div>
|
||||
</div>
|
||||
<? View::parse('generic/reply/staffpm.php', array('Hidden' => true)); ?>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
use Gazelle\Torrent\Subtitle;
|
||||
|
||||
$TorrentID = isset($_GET['torrentid']) ? $_GET['torrentid'] : null;
|
||||
// TODO by qwerty 获取失败
|
||||
if (!$TorrentID) {
|
||||
die();
|
||||
}
|
||||
@@ -26,7 +25,7 @@ if (empty($AllSubtitles)) {
|
||||
foreach ($AllSubtitles as $Subtitle) {
|
||||
$LanguageArray = explode(',', $Subtitle['languages']);
|
||||
$IsNew = time_ago($Subtitle['upload_time']) < 60;
|
||||
$CanRM = check_perms('users_mod');
|
||||
$CanRM = check_perms('users_mod') || $Subtitle['Uploader'] == $LoggedUser['ID'];
|
||||
$UserInfo = Users::user_info($Subtitle['uploader']);
|
||||
$UploaderName = $UserInfo['Username'];
|
||||
if ($UploaderName == '') {
|
||||
|
||||
@@ -9,11 +9,13 @@ if ($Action !== 'delete') {
|
||||
error(404);
|
||||
}
|
||||
|
||||
if ($LoggedUser['ID'] != $UserID && !check_perms('torrents_delete')) {
|
||||
|
||||
$DB->query('SELECT name, uploader FROM subtitles WHERE id=' . $_GET['id']);
|
||||
list($Name, $Uploader) = $DB->next_record(MYSQLI_NUM, false);
|
||||
|
||||
if ($LoggedUser['ID'] != $Uploader && !check_perms('users_mod')) {
|
||||
error(403);
|
||||
}
|
||||
$DB->query('SELECT name FROM subtitles WHERE id=' . $_GET['id']);
|
||||
list($Name) = $DB->next_record(MYSQLI_NUM, false);
|
||||
View::show_header(t('server.subtitles.delete_subtitle'), '', 'PageSubtitleDelete');
|
||||
|
||||
?>
|
||||
|
||||
@@ -9,13 +9,13 @@ if (!is_number($SubtitleID)) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
if (!check_perms('users_mod')) {
|
||||
$DB->query("SELECT torrent_id, name, uploader from subtitles where ID=" . $SubtitleID);
|
||||
list($TorrentID, $Name, $Uploader) = $DB->next_record(MYSQLI_BOTH, false);
|
||||
|
||||
if ($LoggedUser['ID'] != $Uploader && !check_perms('users_mod')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
$DB->query("SELECT torrent_id, name from subtitles where ID=" . $SubtitleID);
|
||||
list($TorrentID, $Name) = $DB->next_record(MYSQLI_BOTH, false);
|
||||
|
||||
$DB->query("DELETE FROM subtitles WHERE id = $SubtitleID");
|
||||
$DB->query("DELETE FROM subtitles_files WHERE id = $SubtitleID");
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
View::show_header(Lang::get('better', 'artists_with_no_image'));
|
||||
|
||||
$DB->query("
|
||||
SELECT COUNT(*) as count FROM artists_group AS a
|
||||
LEFT JOIN wiki_artists AS wiki ON wiki.RevisionID = a.RevisionID
|
||||
WHERE wiki.Image is NULL OR wiki.Image = ''");
|
||||
$row = $DB->next_record();
|
||||
$total = $row['count'];
|
||||
$total_str = number_format($total);
|
||||
$page = !empty($_GET['page']) ? intval($_GET['page']) : 1;
|
||||
$page = max(1, $page);
|
||||
$limit = TORRENTS_PER_PAGE;
|
||||
$offset = TORRENTS_PER_PAGE * ($page - 1);
|
||||
$DB->query("
|
||||
SELECT
|
||||
a.ArtistID,
|
||||
a.Name
|
||||
FROM artists_group AS a
|
||||
LEFT JOIN wiki_artists AS wiki ON wiki.RevisionID = a.RevisionID
|
||||
WHERE wiki.Image is NULL OR wiki.Image = ''
|
||||
ORDER BY a.Name
|
||||
LIMIT {$limit} OFFSET {$offset}");
|
||||
$artists = $DB->to_array('ArtistID', MYSQLI_ASSOC);
|
||||
$pages = Format::get_pages($page, $total, TORRENTS_PER_PAGE);
|
||||
?>
|
||||
<div class="header">
|
||||
<h2><?= Lang::get('better', 'artists_that_are_missing_images') ?></h2>
|
||||
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
</div>
|
||||
<div class="linkbox"><?= $pages ?></div>
|
||||
</div>
|
||||
|
||||
<div class="thin box pad">
|
||||
<h3><?= Lang::get('better', 'there_are_artists_remaining_before') ?> <?= $total_str ?> <?= Lang::get('better', 'there_are_artists_remaining_after') ?></h3>
|
||||
<div class="table_container border">
|
||||
<table class="torrent_table">
|
||||
<?
|
||||
|
||||
foreach ($artists as $id => $artist) {
|
||||
?>
|
||||
<tr class="torrent torrent_row">
|
||||
<td><a href='artist.php?id=<?= $id ?>' target='_blank'><?= $artist['Name'] ?></a></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
|
||||
View::show_footer();
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
View::show_header(Lang::get('better', 'torrents_with_no_artwork'));
|
||||
|
||||
$DB->query("SELECT COUNT(*) as count FROM torrents_group WHERE CategoryID = 1 AND WikiImage = ''");
|
||||
$row = $DB->next_record();
|
||||
$total = $row['count'];
|
||||
$total_str = number_format($total);
|
||||
$page = !empty($_GET['page']) ? intval($_GET['page']) : 1;
|
||||
$page = max(1, $page);
|
||||
$limit = TORRENTS_PER_PAGE;
|
||||
$offset = TORRENTS_PER_PAGE * ($page - 1);
|
||||
$DB->query("
|
||||
SELECT ID, Name
|
||||
FROM torrents_group
|
||||
WHERE CategoryID = 1 AND WikiImage = ''
|
||||
ORDER BY Name
|
||||
LIMIT {$limit} OFFSET {$offset}");
|
||||
$torrents = $DB->to_array('ID', MYSQLI_ASSOC);
|
||||
foreach (Artists::get_artists(array_keys($torrents)) as $group_id => $data) {
|
||||
$torrents[$group_id]['Artists'] = array();
|
||||
$torrents[$group_id]['ExtendedArtists'] = array();
|
||||
foreach (array(1, 4, 6) as $importance) {
|
||||
if (isset($data[$importance])) {
|
||||
$torrents[$group_id]['Artists'] = array_merge($torrents[$group_id]['Artists'], $data[$importance]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$pages = Format::get_pages($page, $total, TORRENTS_PER_PAGE);
|
||||
?>
|
||||
<div class="header">
|
||||
<h2><?= Lang::get('better', 'torrents_groups_that_are_missing_artwork') ?></h2>
|
||||
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
</div>
|
||||
<div class="linkbox"><?= $pages ?></div>
|
||||
</div>
|
||||
|
||||
<div class="thin box pad">
|
||||
<h3><?= Lang::get('better', 'there_are_torrent_groups_remaining_before') ?> <?= $total_str ?> <?= Lang::get('better', 'there_are_torrent_groups_remaining_after') ?></h3>
|
||||
<div class="table_container border">
|
||||
<table class="torrent_table">
|
||||
<?
|
||||
|
||||
foreach ($torrents as $id => $torrent) {
|
||||
if (count($torrent['Artists']) > 1) {
|
||||
$artist = "Various Artists";
|
||||
} else {
|
||||
$artist = "<a href='artist.php?id={$torrent['Artists'][0]['id']}' target='_blank'>{$torrent['Artists'][0]['name']}</a>";
|
||||
}
|
||||
?>
|
||||
<tr class="torrent torrent_row">
|
||||
<td><?= $artist ?> - <a href="torrents.php?id=<?= $id ?>" target="_blank"><?= $torrent['Name'] ?></a></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
|
||||
View::show_footer();
|
||||
Executable
+116
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
$_GET['filter'] = isset($_GET['filter']) ? $_GET['filter'] : 'all';
|
||||
$Join = '';
|
||||
$Where = '';
|
||||
$Filter = 0;
|
||||
if ($_GET['filter'] === 'snatched') {
|
||||
$Join = 'JOIN xbt_snatched AS x ON x.fid = t.ID AND x.uid = ' . $LoggedUser['ID'];
|
||||
$Filter = 1;
|
||||
} elseif ($_GET['filter'] === 'uploaded') {
|
||||
$Where = "AND t.UserID = {$LoggedUser['ID']}";
|
||||
$Filter = 2;
|
||||
}
|
||||
|
||||
$DB->query("SELECT count(t.ID) as count FROM torrents AS t {$Join} WHERE t.HasLogDB='1' AND t.LogChecksum='0' {$Where}");
|
||||
$Row = $DB->next_record();
|
||||
$Total = $Row['count'];
|
||||
$TotalStr = number_format($Total);
|
||||
$Page = !empty($_GET['page']) ? intval($_GET['page']) : 1;
|
||||
$Page = max(1, $Page);
|
||||
$Limit = TORRENTS_PER_PAGE;
|
||||
$Offset = TORRENTS_PER_PAGE * ($Page - 1);
|
||||
$Pages = Format::get_pages($Page, $Total, TORRENTS_PER_PAGE);
|
||||
|
||||
View::show_header(Lang::get('better', 'torrents_with_bad_missing_checksum'));
|
||||
$DB->query("
|
||||
SELECT
|
||||
t.ID,
|
||||
t.GroupID
|
||||
FROM torrents AS t
|
||||
{$Join}
|
||||
WHERE t.HasLogDB = '1' AND t.LogChecksum = '0' {$Where}
|
||||
ORDER BY t.ID ASC
|
||||
LIMIT {$Limit} OFFSET {$Offset}");
|
||||
|
||||
$TorrentsInfo = $DB->to_array('ID', MYSQLI_ASSOC);
|
||||
$GroupIDs = array();
|
||||
foreach ($TorrentsInfo as $Torrent) {
|
||||
$GroupIDs[] = $Torrent['GroupID'];
|
||||
}
|
||||
$Results = (count($GroupIDs) > 0) ? Torrents::get_groups($GroupIDs) : array();
|
||||
?>
|
||||
<div class="header">
|
||||
<? if ($Filter === 0) { ?>
|
||||
<h2><?= Lang::get('better', 'all_torrents_trumpable_for_bad_missing_checksum') ?></h2>
|
||||
<? } elseif ($Filter === 1) { ?>
|
||||
<h2><?= Lang::get('better', 'torrents_trumpable_for_bad_missing_checksum_that_you_have_snatched') ?></h2>
|
||||
<? } elseif ($Filter === 2) { ?>
|
||||
<h2><?= Lang::get('better', 'torrents_trumpable_for_bad_missing_checksum_that_you_have_uploaded') ?></h2>
|
||||
<? } ?>
|
||||
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
<? if ($Filter !== 0) { ?>
|
||||
<a href="better.php?method=checksum&filter=all" class="brackets"><?= Lang::get('better', 'show_all') ?></a>
|
||||
<? } ?>
|
||||
<? if ($Filter !== 1) { ?>
|
||||
<a href="better.php?method=checksum&filter=snatched" class="brackets"><?= Lang::get('better', 'show_only_those_you_have_snatched') ?></a>
|
||||
<? } ?>
|
||||
<? if ($Filter !== 2) { ?>
|
||||
<a href="better.php?method=checksum&filter=uploaded" class="brackets"><?= Lang::get('better', 'show_only_those_you_have_uploaded') ?></a>
|
||||
<? } ?>
|
||||
</div>
|
||||
<div class="linkbox">
|
||||
<?= $Pages ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="thin box pad">
|
||||
<h3><?= Lang::get('better', 'there_are_torrents_remaining_before') ?> <?= $TotalStr ?> <?= Lang::get('better', 'there_are_torrents_remaining_after') ?></h3>
|
||||
<div class="table_container border">
|
||||
<table class="torrent_table">
|
||||
<?
|
||||
foreach ($TorrentsInfo as $TorrentID => $Info) {
|
||||
extract(Torrents::array_group($Results[$Info['GroupID']]));
|
||||
$TorrentTags = new Tags($TagList);
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName = Artists::display_artists($ExtendedArtists);
|
||||
} else {
|
||||
$DisplayName = '';
|
||||
}
|
||||
$DisplayName .= "<a href=\"torrents.php?id=$GroupID&torrentid=$TorrentID#torrent$TorrentID\" class=\"tooltip\" title=\"" . Lang::get('global', 'view_torrent_group') . "\" dir=\"ltr\">$GroupName</a>";
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
if ($ReleaseType > 0) {
|
||||
$DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||
}
|
||||
|
||||
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
||||
if ($ExtraInfo) {
|
||||
$DisplayName .= " - $ExtraInfo";
|
||||
}
|
||||
?>
|
||||
<tr class="torrent torrent_row<?= $GroupFlags['IsSnatched'] ? ' snatched_torrent"' : '' ?>">
|
||||
<td>
|
||||
<span class="torrent_links_block">
|
||||
<a href="torrents.php?action=download&id=<?= $TorrentID ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" class="brackets tooltip" title="<?= Lang::get('better', 'download') ?>">DL</a>
|
||||
</span>
|
||||
<?= $DisplayName ?>
|
||||
<? if (check_perms('admin_reports')) { ?>
|
||||
<a href="better.php?method=files&remove=<?= $TorrentID ?>" class="brackets">X</a>
|
||||
<? } ?>
|
||||
<div class="tags"><?= $TorrentTags->format() ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
} ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
|
||||
$DB->query("
|
||||
DELETE FROM torrents_bad_compress
|
||||
WHERE TorrentID = " . $_GET['remove']);
|
||||
$DB->query("
|
||||
SELECT GroupID
|
||||
FROM torrents
|
||||
WHERE ID = " . $_GET['remove']);
|
||||
list($GroupID) = $DB->next_record();
|
||||
$Cache->delete_value('torrents_details_' . $GroupID);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_GET['filter']) && $_GET['filter'] == 'all') {
|
||||
$Join = '';
|
||||
$All = true;
|
||||
} else {
|
||||
$Join = "JOIN xbt_snatched AS x ON x.fid = tbf.TorrentID AND x.uid = " . $LoggedUser['ID'];
|
||||
$All = false;
|
||||
}
|
||||
|
||||
View::show_header(Lang::get('better', 'torrents_with_bad_compress'));
|
||||
$DB->query("
|
||||
SELECT tbf.TorrentID, t.GroupID
|
||||
FROM torrents_bad_compress AS tbf
|
||||
JOIN torrents AS t ON t.ID = tbf.TorrentID
|
||||
$Join
|
||||
ORDER BY tbf.TimeAdded ASC");
|
||||
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
|
||||
foreach ($TorrentsInfo as $Torrent) {
|
||||
$GroupIDs[] = $Torrent['GroupID'];
|
||||
}
|
||||
$Results = Torrents::get_groups($GroupIDs);
|
||||
?>
|
||||
<div class="header">
|
||||
<? if ($All) { ?>
|
||||
<h2><?= Lang::get('better', 'all_torrents_trumpable_for_bad_compress') ?></h2>
|
||||
<? } else { ?>
|
||||
<h2><?= Lang::get('better', 'torrents_trumpable_for_bad_compress_that_you_have_snatched') ?></h2>
|
||||
<? } ?>
|
||||
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
<? if ($All) { ?>
|
||||
<a href="better.php?method=compress" class="brackets"><?= Lang::get('better', 'show_only_those_you_have_snatched') ?></a>
|
||||
<? } else { ?>
|
||||
<a href="better.php?method=compress&filter=all" class="brackets"><?= Lang::get('better', 'show_all') ?></a>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="thin box pad">
|
||||
<h3><?= Lang::get('better', 'there_are_torrents_remaining_before') ?> <?= number_format(count($TorrentsInfo)) ?> <?= Lang::get('better', 'there_are_torrents_remaining_after') ?></h3>
|
||||
<div class="table_container border">
|
||||
<table class="torrent_table">
|
||||
<?
|
||||
foreach ($TorrentsInfo as $TorrentID => $Info) {
|
||||
extract(Torrents::array_group($Results[$Info['GroupID']]));
|
||||
$TorrentTags = new Tags($TagList);
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName = Artists::display_artists($ExtendedArtists);
|
||||
} else {
|
||||
$DisplayName = '';
|
||||
}
|
||||
$DisplayName .= "<a href=\"torrents.php?id=$GroupID&torrentid=$TorrentID#torrent$TorrentID\" class=\"tooltip\" title=\"" . Lang::get('global', 'view_torrent_group') . "\" dir=\"ltr\">$GroupName</a>";
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
if ($ReleaseType > 0) {
|
||||
$DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||
}
|
||||
|
||||
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
||||
if ($ExtraInfo) {
|
||||
$DisplayName .= ' - ' . $ExtraInfo;
|
||||
}
|
||||
?>
|
||||
<tr class="torrent torrent_row<?= $Torrents[$TorrentID]['IsSnatched'] ? ' snatched_torrent' : '' ?>">
|
||||
<td>
|
||||
<span class="torrent_links_block">
|
||||
<a href="torrents.php?action=download&id=<?= $TorrentID ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" class="brackets tooltip" title="<?= Lang::get('better', 'download') ?>">DL</a>
|
||||
</span>
|
||||
<?= $DisplayName ?>
|
||||
<? if (check_perms('admin_reports')) { ?>
|
||||
<a href="better.php?method=compress&remove=<?= $TorrentID ?>" class="brackets">X</a>
|
||||
<? } ?>
|
||||
<div class="tags"><?= $TorrentTags->format() ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
|
||||
$DB->query("
|
||||
DELETE FROM torrents_custom_trumpable
|
||||
WHERE TorrentID = " . $_GET['remove']);
|
||||
$DB->query("
|
||||
SELECT GroupID
|
||||
FROM torrents
|
||||
WHERE ID = " . $_GET['remove']);
|
||||
list($GroupID) = $DB->next_record();
|
||||
$Cache->delete_value('torrents_details_' . $GroupID);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_GET['filter']) && $_GET['filter'] == 'all') {
|
||||
$Join = '';
|
||||
$All = true;
|
||||
} else {
|
||||
$Join = "JOIN xbt_snatched AS x ON x.fid = tbf.TorrentID AND x.uid = " . $LoggedUser['ID'];
|
||||
$All = false;
|
||||
}
|
||||
|
||||
View::show_header(Lang::get('better', 'torrents_with_custom_trumpable_reason'));
|
||||
$DB->query("
|
||||
SELECT tbf.TorrentID, t.GroupID, tbf.CustomTrumpable
|
||||
FROM torrents_custom_trumpable AS tbf
|
||||
JOIN torrents AS t ON t.ID = tbf.TorrentID
|
||||
$Join
|
||||
ORDER BY tbf.TimeAdded ASC");
|
||||
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
|
||||
foreach ($TorrentsInfo as $Torrent) {
|
||||
$GroupIDs[] = $Torrent['GroupID'];
|
||||
}
|
||||
$Results = Torrents::get_groups($GroupIDs);
|
||||
?>
|
||||
<div class="header">
|
||||
<? if ($All) { ?>
|
||||
<h2><?= Lang::get('better', 'all_torrents_trumpable_for_custom_trumpable_reason') ?></h2>
|
||||
<? } else { ?>
|
||||
<h2><?= Lang::get('better', 'torrents_trumpable_for_custom_trumpable_reason_that_you_have_snatched') ?></h2>
|
||||
<? } ?>
|
||||
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
<? if ($All) { ?>
|
||||
<a href="better.php?method=custom" class="brackets"><?= Lang::get('better', 'show_currently_seeding') ?></a>
|
||||
<? } else { ?>
|
||||
<a href="better.php?method=custom&filter=all" class="brackets"><?= Lang::get('better', 'show_all') ?></a>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="thin box pad">
|
||||
<h3><?= Lang::get('better', 'there_are_torrents_remaining_before') ?> <?= number_format(count($TorrentsInfo)) ?> <?= Lang::get('better', 'there_are_torrents_remaining_after') ?></h3>
|
||||
<div class="table_container border">
|
||||
<table class="torrent_table">
|
||||
<?
|
||||
foreach ($TorrentsInfo as $TorrentID => $Info) {
|
||||
extract(Torrents::array_group($Results[$Info['GroupID']]));
|
||||
$TorrentTags = new Tags($TagList);
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName = Artists::display_artists($ExtendedArtists);
|
||||
} else {
|
||||
$DisplayName = '';
|
||||
}
|
||||
$DisplayName .= "<a href=\"torrents.php?id=$GroupID&torrentid=$TorrentID#torrent$TorrentID\" class=\"tooltip\" title=\"" . Lang::get('global', 'view_torrent_group') . "\" dir=\"ltr\">$GroupName</a>";
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
if ($ReleaseType > 0) {
|
||||
$DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||
}
|
||||
|
||||
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
||||
|
||||
$ExtraInfo .= $Info['CustomTrumpable'] . " / ";
|
||||
|
||||
$DisplayName .= ' - ' . $ExtraInfo;
|
||||
?>
|
||||
<tr class="torrent torrent_row<?= $Torrents[$TorrentID]['IsSnatched'] ? ' snatched_torrent' : '' ?>">
|
||||
<td>
|
||||
<span class="torrent_links_block">
|
||||
<a href="torrents.php?action=download&id=<?= $TorrentID ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" class="brackets tooltip" title="<?= Lang::get('better', 'download') ?>">DL</a>
|
||||
</span>
|
||||
<?= $DisplayName ?>
|
||||
<? if (check_perms('admin_reports')) { ?>
|
||||
<a href="better.php?method=custom&remove=<?= $TorrentID ?>" class="brackets">X</a>
|
||||
<? } ?>
|
||||
<div class="tags"><?= $TorrentTags->format() ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
View::show_header(Lang::get('better', 'artists_with_no_descriptions'));
|
||||
|
||||
$DB->query("
|
||||
SELECT COUNT(*) as count FROM artists_group AS a
|
||||
LEFT JOIN wiki_artists AS wiki ON wiki.RevisionID = a.RevisionID
|
||||
WHERE wiki.Body is NULL OR wiki.Body = ''");
|
||||
$row = $DB->next_record();
|
||||
$total = $row['count'];
|
||||
$total_str = number_format($total);
|
||||
$page = !empty($_GET['page']) ? intval($_GET['page']) : 1;
|
||||
$page = max(1, $page);
|
||||
$limit = TORRENTS_PER_PAGE;
|
||||
$offset = TORRENTS_PER_PAGE * ($page - 1);
|
||||
$DB->query("
|
||||
SELECT
|
||||
a.ArtistID,
|
||||
a.Name
|
||||
FROM artists_group AS a
|
||||
LEFT JOIN wiki_artists AS wiki ON wiki.RevisionID = a.RevisionID
|
||||
WHERE wiki.Body is NULL OR wiki.Body = ''
|
||||
ORDER BY a.Name
|
||||
LIMIT {$limit} OFFSET {$offset}");
|
||||
$artists = $DB->to_array('ArtistID', MYSQLI_ASSOC);
|
||||
$pages = Format::get_pages($page, $total, TORRENTS_PER_PAGE);
|
||||
?>
|
||||
<div class="header">
|
||||
<h2><?= Lang::get('better', 'artists_that_are_missing_descriptions') ?></h2>
|
||||
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
</div>
|
||||
<div class="linkbox"><?= $pages ?></div>
|
||||
</div>
|
||||
|
||||
<div class="thin box pad">
|
||||
<h3><?= Lang::get('better', 'there_are_artists_remaining_before') ?> <?= $total_str ?> <?= Lang::get('better', 'there_are_artists_remaining_after') ?></h3>
|
||||
<div class="table_container border">
|
||||
<table class="torrent_table">
|
||||
<?
|
||||
|
||||
foreach ($artists as $id => $artist) {
|
||||
?>
|
||||
<tr class="torrent torrent_row">
|
||||
<td><a href='artist.php?id=<?= $id ?>' target='_blank'><?= $artist['Name'] ?></a></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
|
||||
View::show_footer();
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
|
||||
$DB->query('
|
||||
DELETE FROM torrents_bad_files
|
||||
WHERE TorrentID = ' . $_GET['remove']);
|
||||
$DB->query('
|
||||
SELECT GroupID
|
||||
FROM torrents
|
||||
WHERE ID = ' . $_GET['remove']);
|
||||
list($GroupID) = $DB->next_record();
|
||||
$Cache->delete_value("torrents_details_$GroupID");
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_GET['filter']) && $_GET['filter'] == 'all') {
|
||||
$Join = '';
|
||||
$All = true;
|
||||
} else {
|
||||
$Join = 'JOIN xbt_snatched AS x ON x.fid = tfi.TorrentID AND x.uid = ' . $LoggedUser['ID'];
|
||||
$All = false;
|
||||
}
|
||||
|
||||
View::show_header(Lang::get('better', 'torrents_with_bad_file_names'));
|
||||
$DB->query("
|
||||
SELECT tfi.TorrentID, t.GroupID
|
||||
FROM torrents_bad_files AS tfi
|
||||
JOIN torrents AS t ON t.ID = tfi.TorrentID
|
||||
$Join
|
||||
ORDER BY tfi.TimeAdded ASC");
|
||||
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
|
||||
foreach ($TorrentsInfo as $Torrent) {
|
||||
$GroupIDs[] = $Torrent['GroupID'];
|
||||
}
|
||||
$Results = Torrents::get_groups($GroupIDs);
|
||||
?>
|
||||
<div class="header">
|
||||
<? if ($All) { ?>
|
||||
<h2><?= Lang::get('better', 'all_torrents_trumpable_for_bad_file_names') ?></h2>
|
||||
<? } else { ?>
|
||||
<h2><?= Lang::get('better', 'torrents_trumpable_for_bad_file_names_that_you_have_snatched') ?></h2>
|
||||
<? } ?>
|
||||
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
<? if ($All) { ?>
|
||||
<a href="better.php?method=files" class="brackets"><?= Lang::get('better', 'show_only_those_you_have_snatched') ?></a>
|
||||
<? } else { ?>
|
||||
<a href="better.php?method=files&filter=all" class="brackets"><?= Lang::get('better', 'show_all') ?></a>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="thin box pad">
|
||||
<h3><?= Lang::get('better', 'there_are_torrents_remaining_before') ?> <?= number_format(count($TorrentsInfo)) ?> <?= Lang::get('better', 'there_are_torrents_remaining_after') ?></h3>
|
||||
<div class="table_container border">
|
||||
<table class="torrent_table">
|
||||
<?
|
||||
foreach ($TorrentsInfo as $TorrentID => $Info) {
|
||||
extract(Torrents::array_group($Results[$Info['GroupID']]));
|
||||
$TorrentTags = new Tags($TagList);
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName = Artists::display_artists($ExtendedArtists);
|
||||
} else {
|
||||
$DisplayName = '';
|
||||
}
|
||||
$DisplayName .= "<a href=\"torrents.php?id=$GroupID&torrentid=$TorrentID#torrent$TorrentID\" class=\"tooltip\" title=\"" . Lang::get('global', 'view_torrent_group') . "\" dir=\"ltr\">$GroupName</a>";
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
if ($ReleaseType > 0) {
|
||||
$DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||
}
|
||||
|
||||
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
||||
if ($ExtraInfo) {
|
||||
$DisplayName .= " - $ExtraInfo";
|
||||
}
|
||||
?>
|
||||
<tr class="torrent torrent_row<?= $GroupFlags['IsSnatched'] ? ' snatched_torrent"' : '' ?>">
|
||||
<td>
|
||||
<span class="torrent_links_block">
|
||||
<a href="torrents.php?action=download&id=<?= $TorrentID ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" class="brackets tooltip" title="<?= Lang::get('better', 'download') ?>">DL</a>
|
||||
</span>
|
||||
<?= $DisplayName ?>
|
||||
<? if (check_perms('admin_reports')) { ?>
|
||||
<a href="better.php?method=files&remove=<?= $TorrentID ?>" class="brackets">X</a>
|
||||
<? } ?>
|
||||
<div class="tags"><?= $TorrentTags->format() ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
} ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
Executable
+100
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
|
||||
$DB->query("
|
||||
DELETE FROM torrents_bad_folders
|
||||
WHERE TorrentID = " . $_GET['remove']);
|
||||
$DB->query("
|
||||
SELECT GroupID
|
||||
FROM torrents
|
||||
WHERE ID = " . $_GET['remove']);
|
||||
list($GroupID) = $DB->next_record();
|
||||
$Cache->delete_value('torrents_details_' . $GroupID);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_GET['filter']) && $_GET['filter'] == 'all') {
|
||||
$Join = '';
|
||||
$All = true;
|
||||
} else {
|
||||
$Join = "JOIN xbt_snatched AS x ON x.fid = tbf.TorrentID AND x.uid = " . $LoggedUser['ID'];
|
||||
$All = false;
|
||||
}
|
||||
|
||||
View::show_header(Lang::get('better', 'torrents_with_bad_folder_names'));
|
||||
$DB->query("
|
||||
SELECT tbf.TorrentID, t.GroupID
|
||||
FROM torrents_bad_folders AS tbf
|
||||
JOIN torrents AS t ON t.ID = tbf.TorrentID
|
||||
$Join
|
||||
ORDER BY tbf.TimeAdded ASC");
|
||||
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
|
||||
foreach ($TorrentsInfo as $Torrent) {
|
||||
$GroupIDs[] = $Torrent['GroupID'];
|
||||
}
|
||||
$Results = Torrents::get_groups($GroupIDs);
|
||||
?>
|
||||
<div class="header">
|
||||
<? if ($All) { ?>
|
||||
<h2><?= Lang::get('better', 'all_torrents_trumpable_for_bad_folder_names') ?></h2>
|
||||
<? } else { ?>
|
||||
<h2><?= Lang::get('better', 'torrents_trumpable_for_bad_folder_names_that_you_have_snatched') ?></h2>
|
||||
<? } ?>
|
||||
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
<? if ($All) { ?>
|
||||
<a href="better.php?method=folders" class="brackets"><?= Lang::get('better', 'show_only_those_you_have_snatched') ?></a>
|
||||
<? } else { ?>
|
||||
<a href="better.php?method=folders&filter=all" class="brackets"><?= Lang::get('better', 'show_all') ?></a>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="thin box pad">
|
||||
<h3><?= Lang::get('better', 'there_are_torrents_remaining_before') ?> <?= number_format(count($TorrentsInfo)) ?> <?= Lang::get('better', 'there_are_torrents_remaining_after') ?></h3>
|
||||
<div class="table_container border">
|
||||
<table class="torrent_table">
|
||||
<?
|
||||
foreach ($TorrentsInfo as $TorrentID => $Info) {
|
||||
extract(Torrents::array_group($Results[$Info['GroupID']]));
|
||||
$TorrentTags = new Tags($TagList);
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName = Artists::display_artists($ExtendedArtists);
|
||||
} else {
|
||||
$DisplayName = '';
|
||||
}
|
||||
$DisplayName .= "<a href=\"torrents.php?id=$GroupID&torrentid=$TorrentID#torrent$TorrentID\" class=\"tooltip\" title=\"" . Lang::get('global', 'view_torrent_group') . "\" dir=\"ltr\">$GroupName</a>";
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
if ($ReleaseType > 0) {
|
||||
$DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||
}
|
||||
|
||||
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
||||
if ($ExtraInfo) {
|
||||
$DisplayName .= ' - ' . $ExtraInfo;
|
||||
}
|
||||
?>
|
||||
<tr class="torrent torrent_row<?= $Torrents[$TorrentID]['IsSnatched'] ? ' snatched_torrent' : '' ?>">
|
||||
<td>
|
||||
<span class="torrent_links_block">
|
||||
<a href="torrents.php?action=download&id=<?= $TorrentID ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" class="brackets tooltip" title="<?= Lang::get('better', 'download') ?>">DL</a>
|
||||
</span>
|
||||
<?= $DisplayName ?>
|
||||
<? if (check_perms('admin_reports')) { ?>
|
||||
<a href="better.php?method=folders&remove=<?= $TorrentID ?>" class="brackets">X</a>
|
||||
<? } ?>
|
||||
<div class="tags"><?= $TorrentTags->format() ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
|
||||
$DB->query("
|
||||
DELETE FROM torrents_bad_img
|
||||
WHERE TorrentID = " . $_GET['remove']);
|
||||
$DB->query("
|
||||
SELECT GroupID
|
||||
FROM torrents
|
||||
WHERE ID = " . $_GET['remove']);
|
||||
list($GroupID) = $DB->next_record();
|
||||
$Cache->delete_value('torrents_details_' . $GroupID);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_GET['filter']) && $_GET['filter'] == 'all') {
|
||||
$Join = '';
|
||||
$All = true;
|
||||
} else {
|
||||
$Join = "JOIN xbt_snatched AS x ON x.fid = tbf.TorrentID AND x.uid = " . $LoggedUser['ID'];
|
||||
$All = false;
|
||||
}
|
||||
|
||||
View::show_header(Lang::get('better', 'torrents_with_bad_artwork'));
|
||||
$DB->query("
|
||||
SELECT tbf.TorrentID, t.GroupID
|
||||
FROM torrents_bad_img AS tbf
|
||||
JOIN torrents AS t ON t.ID = tbf.TorrentID
|
||||
$Join
|
||||
ORDER BY tbf.TimeAdded ASC");
|
||||
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
|
||||
foreach ($TorrentsInfo as $Torrent) {
|
||||
$GroupIDs[] = $Torrent['GroupID'];
|
||||
}
|
||||
$Results = Torrents::get_groups($GroupIDs);
|
||||
?>
|
||||
<div class="header">
|
||||
<? if ($All) { ?>
|
||||
<h2><?= Lang::get('better', 'all_torrents_trumpable_for_bad_artwork') ?></h2>
|
||||
<? } else { ?>
|
||||
<h2><?= Lang::get('better', 'torrents_trumpable_for_bad_artwork_that_you_have_snatched') ?></h2>
|
||||
<? } ?>
|
||||
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
<? if ($All) { ?>
|
||||
<a href="better.php?method=img" class="brackets"><?= Lang::get('better', 'show_only_those_you_have_snatched') ?></a>
|
||||
<? } else { ?>
|
||||
<a href="better.php?method=img&filter=all" class="brackets"><?= Lang::get('better', 'show_all') ?></a>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="thin box pad">
|
||||
<h3><?= Lang::get('better', 'there_are_torrents_remaining_before') ?> <?= number_format(count($TorrentsInfo)) ?> <?= Lang::get('better', 'there_are_torrents_remaining_after') ?></h3>
|
||||
<div class="table_container border">
|
||||
<table class="torrent_table">
|
||||
<?
|
||||
foreach ($TorrentsInfo as $TorrentID => $Info) {
|
||||
extract(Torrents::array_group($Results[$Info['GroupID']]));
|
||||
$TorrentTags = new Tags($TagList);
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName = Artists::display_artists($ExtendedArtists);
|
||||
} else {
|
||||
$DisplayName = '';
|
||||
}
|
||||
$DisplayName .= "<a href=\"torrents.php?id=$GroupID&torrentid=$TorrentID#torrent$TorrentID\" class=\"tooltip\" title=\"" . Lang::get('global', 'view_torrent_group') . "\" dir=\"ltr\">$GroupName</a>";
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
if ($ReleaseType > 0) {
|
||||
$DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||
}
|
||||
|
||||
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
||||
if ($ExtraInfo) {
|
||||
$DisplayName .= ' - ' . $ExtraInfo;
|
||||
}
|
||||
?>
|
||||
<tr class="torrent torrent_row<?= $Torrents[$TorrentID]['IsSnatched'] ? ' snatched_torrent' : '' ?>">
|
||||
<td>
|
||||
<span class="torrent_links_block">
|
||||
<a href="torrents.php?action=download&id=<?= $TorrentID ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" class="brackets tooltip" title="<?= Lang::get('better', 'download') ?>">DL</a>
|
||||
</span>
|
||||
<?= $DisplayName ?>
|
||||
<? if (check_perms('admin_reports')) { ?>
|
||||
<a href="better.php?method=img&remove=<?= $TorrentID ?>" class="brackets">X</a>
|
||||
<? } ?>
|
||||
<div class="tags"><?= $TorrentTags->format() ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?
|
||||
enforce_login();
|
||||
if (isset($_GET['method'])) {
|
||||
switch ($_GET['method']) {
|
||||
case 'transcode':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/transcode.php');
|
||||
break;
|
||||
case 'transcode_beta':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/transcode_beta.php');
|
||||
break;
|
||||
case 'single':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/single.php');
|
||||
break;
|
||||
case 'snatch':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/snatch.php');
|
||||
break;
|
||||
case 'artistless':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/artistless.php');
|
||||
break;
|
||||
case 'checksum':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/checksum.php');
|
||||
break;
|
||||
case 'tags':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/tags.php');
|
||||
break;
|
||||
case 'folders':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/folders.php');
|
||||
break;
|
||||
case 'files':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/files.php');
|
||||
break;
|
||||
case 'upload':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/upload.php');
|
||||
break;
|
||||
case 'artwork':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/artwork.php');
|
||||
break;
|
||||
case 'artistimage':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/artistimage.php');
|
||||
break;
|
||||
case 'description':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/description.php');
|
||||
break;
|
||||
case 'lineage':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/lineage.php');
|
||||
break;
|
||||
case 'img':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/img.php');
|
||||
break;
|
||||
case 'compress':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/compress.php');
|
||||
break;
|
||||
case 'custom':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/custom.php');
|
||||
break;
|
||||
default:
|
||||
error(404);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/task/task.php');
|
||||
}
|
||||
Executable
+83
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
|
||||
$DB->query('
|
||||
DELETE FROM torrents_missing_lineage
|
||||
WHERE TorrentID = ' . $_GET['remove']);
|
||||
$DB->query('
|
||||
SELECT GroupID
|
||||
FROM torrents
|
||||
WHERE ID = ' . $_GET['remove']);
|
||||
list($GroupID) = $DB->next_record();
|
||||
$Cache->delete_value("torrents_details_$GroupID");
|
||||
}
|
||||
|
||||
View::show_header(Lang::get('better', 'torrents_with_missing_lineage'));
|
||||
$DB->query("
|
||||
SELECT tfi.TorrentID, t.GroupID
|
||||
FROM torrents_missing_lineage AS tfi
|
||||
JOIN torrents AS t ON t.ID = tfi.TorrentID
|
||||
ORDER BY tfi.TimeAdded ASC");
|
||||
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
|
||||
$GroupIDs = array();
|
||||
foreach ($TorrentsInfo as $Torrent) {
|
||||
$GroupIDs[] = $Torrent['GroupID'];
|
||||
}
|
||||
$Results = Torrents::get_groups($GroupIDs);
|
||||
?>
|
||||
<div class="header">
|
||||
<h2><?= Lang::get('better', 'all_torrents_trumpable_for_missing_lineage') ?></h2>
|
||||
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="thin box pad">
|
||||
<h3><?= Lang::get('better', 'there_are_torrents_remaining_before') ?> <?= number_format(count($TorrentsInfo)) ?> <?= Lang::get('better', 'there_are_torrents_remaining_after') ?></h3>
|
||||
<div class="table_container border">
|
||||
<table class="torrent_table">
|
||||
<?
|
||||
foreach ($TorrentsInfo as $TorrentID => $Info) {
|
||||
extract(Torrents::array_group($Results[$Info['GroupID']]));
|
||||
$TorrentTags = new Tags($TagList);
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName = Artists::display_artists($ExtendedArtists);
|
||||
} else {
|
||||
$DisplayName = '';
|
||||
}
|
||||
$DisplayName .= "<a href=\"torrents.php?id=$GroupID&torrentid=$TorrentID#torrent$TorrentID\" class=\"tooltip\" title=\"" . Lang::get('global', 'view_torrent_group') . "\" dir=\"ltr\">$GroupName</a>";
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
if ($ReleaseType > 0) {
|
||||
$DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||
}
|
||||
|
||||
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
||||
if ($ExtraInfo) {
|
||||
$DisplayName .= " - $ExtraInfo";
|
||||
}
|
||||
?>
|
||||
<tr class="torrent torrent_row<?= $GroupFlags['IsSnatched'] ? ' snatched_torrent"' : '' ?>">
|
||||
<td>
|
||||
<span class="torrent_links_block">
|
||||
<a href="torrents.php?action=download&id=<?= $TorrentID ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" class="brackets tooltip" title="<?= Lang::get('better', 'download') ?>">DL</a>
|
||||
</span>
|
||||
<?= $DisplayName ?>
|
||||
<? if (check_perms('admin_reports')) { ?>
|
||||
<a href="better.php?method=lineage&remove=<?= $TorrentID ?>" class="brackets">X</a>
|
||||
<? } ?>
|
||||
<div class="tags"><?= $TorrentTags->format() ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
} ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
Executable
+77
@@ -0,0 +1,77 @@
|
||||
<?
|
||||
if (($Results = $Cache->get_value('better_single_groupids')) === false) {
|
||||
$DB->query("
|
||||
SELECT
|
||||
t.ID AS TorrentID,
|
||||
t.GroupID AS GroupID
|
||||
FROM xbt_files_users AS x
|
||||
JOIN torrents AS t ON t.ID=x.fid
|
||||
WHERE t.Format='FLAC'
|
||||
GROUP BY x.fid
|
||||
HAVING COUNT(x.uid) = 1
|
||||
ORDER BY t.LogScore DESC, t.Time ASC
|
||||
LIMIT 30");
|
||||
|
||||
$Results = $DB->to_pair('GroupID', 'TorrentID', false);
|
||||
$Cache->cache_value('better_single_groupids', $Results, 30 * 60);
|
||||
}
|
||||
|
||||
$Groups = Torrents::get_groups(array_keys($Results));
|
||||
|
||||
View::show_header(Lang::get('better', 'single_seeder_flacs'));
|
||||
?>
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
</div>
|
||||
<div class="thin">
|
||||
<div class="table_container border">
|
||||
<table width="100%" class="torrent_table">
|
||||
<tr class="colhead">
|
||||
<td><?= Lang::get('better', 'torrent') ?></td>
|
||||
</tr>
|
||||
<?
|
||||
foreach ($Results as $GroupID => $FlacID) {
|
||||
if (!isset($Groups[$GroupID])) {
|
||||
continue;
|
||||
}
|
||||
$Group = $Groups[$GroupID];
|
||||
extract(Torrents::array_group($Group));
|
||||
$TorrentTags = new Tags($TagList);
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName = Artists::display_artists($ExtendedArtists);
|
||||
} else {
|
||||
$DisplayName = '';
|
||||
}
|
||||
|
||||
$DisplayName .= "<a href=\"torrents.php?id=$GroupID&torrentid=$FlacID\" class=\"tooltip\" title=\"" . Lang::get('global', 'view_torrent') . "\" dir=\"ltr\">$GroupName</a>";
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
if ($ReleaseType > 0) {
|
||||
$DisplayName .= " [" . $ReleaseTypes[$ReleaseType] . "]";
|
||||
}
|
||||
|
||||
$ExtraInfo = Torrents::torrent_info($Torrents[$FlacID]);
|
||||
if ($ExtraInfo) {
|
||||
$DisplayName .= ' - ' . $ExtraInfo;
|
||||
}
|
||||
?>
|
||||
<tr class="torrent torrent_row<?= $Torrents[$FlacID]['IsSnatched'] ? ' snatched_torrent' : '' ?>">
|
||||
<td>
|
||||
<span class="torrent_links_block">
|
||||
<a href="torrents.php?action=download&id=<?= $FlacID ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" title="<?= Lang::get('better', 'download') ?>" class="brackets tooltip">DL</a>
|
||||
</span>
|
||||
<?= $DisplayName ?>
|
||||
<div class="tags"><?= $TorrentTags->format() ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
Executable
+240
@@ -0,0 +1,240 @@
|
||||
<?
|
||||
if (!empty($_GET['userid']) && is_number($_GET['userid'])) {
|
||||
if (check_perms('users_override_paranoia')) {
|
||||
$UserID = $_GET['userid'];
|
||||
} else {
|
||||
error(403);
|
||||
}
|
||||
} else {
|
||||
$UserID = $LoggedUser['ID'];
|
||||
}
|
||||
|
||||
$Encodings = array('V0 (VBR)', 'V2 (VBR)', '320');
|
||||
$EncodingKeys = array_fill_keys($Encodings, true);
|
||||
|
||||
if (!empty($_GET['filter']) && $_GET['filter'] === 'seeding') {
|
||||
$SeedingOnly = true;
|
||||
} else {
|
||||
$SeedingOnly = false;
|
||||
}
|
||||
|
||||
// Get list of FLAC snatches
|
||||
$DB->query("
|
||||
SELECT t.GroupID, x.fid
|
||||
FROM " . ($SeedingOnly ? 'xbt_files_users' : 'xbt_snatched') . " AS x
|
||||
JOIN torrents AS t ON t.ID = x.fid
|
||||
JOIN torrents_group AS tg ON tg.ID = t.GroupID
|
||||
WHERE t.Format = 'FLAC'
|
||||
AND ((t.LogScore = '100' AND t.Media = 'CD')
|
||||
OR t.Media != 'CD')
|
||||
AND tg.CategoryID = 1
|
||||
AND x.uid = '$UserID'" .
|
||||
($SeedingOnly ? ' AND x.active = 1 AND x.remaining = 0' : ''));
|
||||
|
||||
$SnatchedTorrentIDs = array_fill_keys($DB->collect('fid'), true);
|
||||
$SnatchedGroupIDs = array_unique($DB->collect('GroupID'));
|
||||
if (count($SnatchedGroupIDs) > 1000) {
|
||||
shuffle($SnatchedGroupIDs);
|
||||
$SnatchedGroupIDs = array_slice($SnatchedGroupIDs, 0, 1000);
|
||||
}
|
||||
|
||||
if (count($SnatchedGroupIDs) === 0) {
|
||||
error(($SeedingOnly ? "You aren't seeding any perfect FLACs!" : "You haven't snatched any perfect FLACs!"));
|
||||
}
|
||||
// Create hash table
|
||||
|
||||
$DB->query("
|
||||
CREATE TEMPORARY TABLE temp_sections_better_snatch
|
||||
SELECT
|
||||
GroupID,
|
||||
GROUP_CONCAT(Encoding SEPARATOR ' ') AS EncodingList,
|
||||
CRC32(CONCAT_WS(
|
||||
' ', Media, Remasteryear, Remastertitle,
|
||||
Remasterrecordlabel, Remastercataloguenumber)
|
||||
) AS RemIdent
|
||||
FROM torrents
|
||||
WHERE GroupID IN (" . implode(',', $SnatchedGroupIDs) . ")
|
||||
AND Format IN ('FLAC', 'MP3')
|
||||
GROUP BY GroupID, RemIdent");
|
||||
|
||||
$DB->query("
|
||||
SELECT GroupID
|
||||
FROM temp_sections_better_snatch
|
||||
WHERE EncodingList NOT LIKE '%V0 (VBR)%'
|
||||
OR EncodingList NOT LIKE '%V2 (VBR)%'
|
||||
OR EncodingList NOT LIKE '%320%'");
|
||||
|
||||
$GroupIDs = array_fill_keys($DB->collect('GroupID'), true);
|
||||
|
||||
if (count($GroupIDs) === 0) {
|
||||
error('No results found');
|
||||
}
|
||||
|
||||
$Groups = Torrents::get_groups(array_keys($GroupIDs));
|
||||
$TorrentGroups = array();
|
||||
foreach ($Groups as $GroupID => $Group) {
|
||||
if (empty($Group['Torrents'])) {
|
||||
unset($Groups[$GroupID]);
|
||||
continue;
|
||||
}
|
||||
foreach ($Group['Torrents'] as $Torrent) {
|
||||
$TorRemIdent = "$Torrent[Media] $Torrent[RemasterYear] $Torrent[RemasterTitle] $Torrent[RemasterRecordLabel] $Torrent[RemasterCatalogueNumber]";
|
||||
if (!isset($TorrentGroups[$Group['ID']])) {
|
||||
$TorrentGroups[$Group['ID']] = array(
|
||||
$TorRemIdent => array(
|
||||
'FlacID' => 0,
|
||||
'Formats' => array(),
|
||||
'IsSnatched' => $Torrent['IsSnatched'],
|
||||
'Medium' => $Torrent['Media'],
|
||||
'RemasterTitle' => $Torrent['RemasterTitle'],
|
||||
'RemasterYear' => $Torrent['RemasterYear'],
|
||||
'RemasterRecordLabel' => $Torrent['RemasterRecordLabel'],
|
||||
'RemasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber']
|
||||
)
|
||||
);
|
||||
} elseif (!isset($TorrentGroups[$Group['ID']][$TorRemIdent])) {
|
||||
$TorrentGroups[$Group['ID']][$TorRemIdent] = array(
|
||||
'FlacID' => 0,
|
||||
'Formats' => array(),
|
||||
'IsSnatched' => $Torrent['IsSnatched'],
|
||||
'Medium' => $Torrent['Media'],
|
||||
'RemasterTitle' => $Torrent['RemasterTitle'],
|
||||
'RemasterYear' => $Torrent['RemasterYear'],
|
||||
'RemasterRecordLabel' => $Torrent['RemasterRecordLabel'],
|
||||
'RemasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber']
|
||||
);
|
||||
}
|
||||
if ($Torrent['Format'] == 'MP3' && isset($EncodingKeys[$Torrent['Encoding']])) {
|
||||
$TorrentGroups[$Group['ID']][$TorRemIdent]['Formats'][$Torrent['Encoding']] = true;
|
||||
} elseif (isset($SnatchedTorrentIDs[$Torrent['ID']])) {
|
||||
$TorrentGroups[$Group['ID']][$TorRemIdent]['FlacID'] = $Torrent['ID'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$Counter = array(
|
||||
'total' => 0, //how many FLAC torrents can be transcoded?
|
||||
'miss_total' => 0, //how many transcodes are missing?
|
||||
'miss_V0 (VBR)' => 0, //how many V0 transcodes are missing?
|
||||
'miss_V2 (VBR)' => 0, //how many V2 transcodes are missing?
|
||||
'miss_320' => 0, //how many 320 transcodes are missing?
|
||||
);
|
||||
foreach ($TorrentGroups as $Editions) {
|
||||
foreach ($Editions as $Edition) {
|
||||
if ($Edition['FlacID'] == 0) { // no FLAC in this edition
|
||||
continue;
|
||||
}
|
||||
$edition_miss = 0; //number of transcodes missing in this edition
|
||||
foreach ($Encodings as $Encoding) {
|
||||
if (!isset($Edition['Formats'][$Encoding])) {
|
||||
++$edition_miss;
|
||||
++$Counter["miss_$Encoding"];
|
||||
}
|
||||
}
|
||||
$Counter['miss_total'] += $edition_miss;
|
||||
$Counter['total'] += (bool)$edition_miss;
|
||||
}
|
||||
}
|
||||
|
||||
View::show_header(Lang::get('better', 'transcode_snatches'));
|
||||
?>
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
<? if ($SeedingOnly) { ?>
|
||||
<a href="better.php?method=snatch" class="brackets"><?= Lang::get('better', 'show_all') ?></a>
|
||||
<? } else { ?>
|
||||
<a href="better.php?method=snatch&filter=seeding" class="brackets"><?= Lang::get('better', 'show_currently_seeding') ?></a>
|
||||
<? } ?>
|
||||
</div>
|
||||
<div class="thin">
|
||||
<h2><?= Lang::get('better', 'transcode_space') ?><?= ($SeedingOnly ? Lang::get('better', 'transcode_seeding') : Lang::get('better', 'transcode_snatched')) ?><?= Lang::get('better', 'space_torrents') ?></h2>
|
||||
<h3><?= Lang::get('better', 'stats') ?></h3>
|
||||
<div class="box pad">
|
||||
<p>
|
||||
<?= Lang::get('better', 'number_of_perfect_flacs_you_can_transcode') ?>: <?= number_format($Counter['total']) ?><br />
|
||||
<?= Lang::get('better', 'number_of_missing_transcodes') ?>: <?= number_format($Counter['miss_total']) ?><br />
|
||||
<?= Lang::get('better', 'number_of_missing_mp3_transcodes') ?>: <?= number_format($Counter['miss_V2 (VBR)']) ?> / <?= number_format($Counter['miss_V0 (VBR)']) ?> / <?= number_format($Counter['miss_320']) ?>
|
||||
</p>
|
||||
</div>
|
||||
<h3><?= Lang::get('better', 'list') ?></h3>
|
||||
<div class="table_container border">
|
||||
<table width="100%" class="torrent_table">
|
||||
<tr class="colhead">
|
||||
<td><?= Lang::get('better', 'torrent') ?></td>
|
||||
<td>V2</td>
|
||||
<td>V0</td>
|
||||
<td>320</td>
|
||||
</tr>
|
||||
<?
|
||||
foreach ($TorrentGroups as $GroupID => $Editions) {
|
||||
$GroupInfo = $Groups[$GroupID];
|
||||
$GroupYear = $GroupInfo['Year'];
|
||||
$ExtendedArtists = $GroupInfo['ExtendedArtists'];
|
||||
$GroupCatalogueNumber = $GroupInfo['CatalogueNumber'];
|
||||
$GroupName = $GroupInfo['Name'];
|
||||
$GroupRecordLabel = $GroupInfo['RecordLabel'];
|
||||
$ReleaseType = $GroupInfo['ReleaseType'];
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$ArtistNames = Artists::display_artists($ExtendedArtists);
|
||||
} else {
|
||||
$ArtistNames = '';
|
||||
}
|
||||
$TorrentTags = new Tags($GroupInfo['TagList']);
|
||||
foreach ($Editions as $RemIdent => $Edition) {
|
||||
if (!$Edition['FlacID'] || count($Edition['Formats']) === 3) {
|
||||
continue;
|
||||
}
|
||||
$DisplayName = $ArtistNames . '<a href="torrents.php?id=' . $GroupID . '&torrentid=' . $Edition['FlacID'] . '#torrent' . $Edition['FlacID'] . '" class="tooltip" title="' . Lang::get('global', 'view_torrent') . '" dir="ltr">' . $GroupName . '</a>';
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
if ($ReleaseType > 0) {
|
||||
$DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||
}
|
||||
$DisplayName .= ' [' . $Edition['Medium'] . ']';
|
||||
|
||||
$EditionInfo = array();
|
||||
if (!empty($Edition['RemasterYear'])) {
|
||||
$ExtraInfo = $Edition['RemasterYear'];
|
||||
} else {
|
||||
$ExtraInfo = '';
|
||||
}
|
||||
if (!empty($Edition['RemasterRecordLabel'])) {
|
||||
$EditionInfo[] = $Edition['RemasterRecordLabel'];
|
||||
}
|
||||
if (!empty($Edition['RemasterTitle'])) {
|
||||
$EditionInfo[] = $Edition['RemasterTitle'];
|
||||
}
|
||||
if (!empty($Edition['RemasterCatalogueNumber'])) {
|
||||
$EditionInfo[] = $Edition['RemasterCatalogueNumber'];
|
||||
}
|
||||
if (!empty($Edition['RemasterYear'])) {
|
||||
$ExtraInfo .= ' - ';
|
||||
}
|
||||
$ExtraInfo .= implode(' / ', $EditionInfo);
|
||||
?>
|
||||
<tr class="torrent torrent_row<?= $Edition['IsSnatched'] ? ' snatched_torrent' : '' ?>">
|
||||
<td>
|
||||
<span class="torrent_links_block float_right">
|
||||
[<a href="torrents.php?action=download&id=<?= $Edition['FlacID'] ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" title="<?= Lang::get('better', 'download') ?>" class="brackets tooltip">DL</a>]
|
||||
</span>
|
||||
<?= $DisplayName ?>
|
||||
<div class="torrent_info"><?= $ExtraInfo ?></div>
|
||||
<div class="tags"><?= $TorrentTags->format() ?></div>
|
||||
</td>
|
||||
<td><?= isset($Edition['Formats']['V2 (VBR)']) ? '<strong class="important_text_alt">' . Lang::get('better', 'yes') . '</strong>' : '<strong class="important_text">' . Lang::get('better', 'no') . '</strong>' ?></td>
|
||||
<td><?= isset($Edition['Formats']['V0 (VBR)']) ? '<strong class="important_text_alt">' . Lang::get('better', 'yes') . '</strong>' : '<strong class="important_text">' . Lang::get('better', 'no') . '</strong>' ?></td>
|
||||
<td><?= isset($Edition['Formats']['320']) ? '<strong class="important_text_alt">' . Lang::get('better', 'yes') . '</strong>' : '<strong class="important_text">' . Lang::get('better', 'no') . '</strong>' ?></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
Executable
+103
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
|
||||
$DB->query("
|
||||
DELETE FROM torrents_bad_tags
|
||||
WHERE TorrentID = " . $_GET['remove']);
|
||||
$DB->query("
|
||||
SELECT GroupID
|
||||
FROM torrents
|
||||
WHERE ID = " . $_GET['remove']);
|
||||
list($GroupID) = $DB->next_record();
|
||||
$Cache->delete_value('torrents_details_' . $GroupID);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_GET['filter']) && $_GET['filter'] == 'all') {
|
||||
$Join = '';
|
||||
$All = true;
|
||||
} else {
|
||||
$Join = "JOIN xbt_snatched AS x ON x.fid = tbt.TorrentID AND x.uid = " . $LoggedUser['ID'];
|
||||
$All = false;
|
||||
}
|
||||
|
||||
View::show_header(Lang::get('better', 'torrents_with_bad_tags'));
|
||||
$DB->query("
|
||||
SELECT tbt.TorrentID, t.GroupID
|
||||
FROM torrents_bad_tags AS tbt
|
||||
JOIN torrents AS t ON t.ID = tbt.TorrentID
|
||||
$Join
|
||||
ORDER BY tbt.TimeAdded ASC");
|
||||
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
|
||||
foreach ($TorrentsInfo as $Torrent) {
|
||||
$GroupIDs[] = $Torrent['GroupID'];
|
||||
}
|
||||
$Results = Torrents::get_groups($GroupIDs);
|
||||
?>
|
||||
<div class="header">
|
||||
<? if ($All) { ?>
|
||||
<h2><?= Lang::get('better', 'all_torrents_trumpable_for_bad_tags') ?></h2>
|
||||
<? } else { ?>
|
||||
<h2><?= Lang::get('better', 'torrents_trumpable_for_bad_tags_that_you_have_snatched') ?></h2>
|
||||
<? } ?>
|
||||
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
<? if ($All) { ?>
|
||||
<a href="better.php?method=tags" class="brackets"><?= Lang::get('better', 'show_only_those_you_have_snatched') ?></a>
|
||||
<? } else { ?>
|
||||
<a href="better.php?method=tags&filter=all" class="brackets"><?= Lang::get('better', 'show_all') ?></a>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="thin box pad">
|
||||
<h3><?= Lang::get('better', 'there_are_torrents_remaining_before') ?> <?= number_format(count($TorrentsInfo)) ?> <?= Lang::get('better', 'there_are_torrents_remaining_after') ?></h3>
|
||||
<div class="table_container border">
|
||||
<table class="torrent_table">
|
||||
<?
|
||||
foreach ($TorrentsInfo as $TorrentID => $Info) {
|
||||
extract(Torrents::array_group($Results[$Info['GroupID']]));
|
||||
$TorrentTags = new Tags($TagList);
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName = Artists::display_artists($ExtendedArtists);
|
||||
} else {
|
||||
$DisplayName = '';
|
||||
}
|
||||
$DisplayName .= "<a href=\"torrents.php?id=$GroupID&torrentid=$TorrentID#torrent$TorrentID\" class=\"tooltip\" title=\"" . Lang::get('global', 'view_torrent') . "\" dir=\"ltr\">$GroupName</a>";
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
if ($ReleaseType > 0) {
|
||||
$DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||
}
|
||||
|
||||
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
||||
if ($ExtraInfo) {
|
||||
$DisplayName .= ' - ' . $ExtraInfo;
|
||||
}
|
||||
?>
|
||||
<tr class="torrent torrent_row<?= $Torrents[$TorrentID]['IsSnatched'] ? ' snatched_torrent' : '' ?>">
|
||||
<td>
|
||||
<span class="torrent_links_block">
|
||||
<a href="torrents.php?action=download&id=<?= $TorrentID ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" class="brackets tooltip" title="<?= Lang::get('better', 'download') ?>">DL</a>
|
||||
</span>
|
||||
<?= $DisplayName ?>
|
||||
<? if (check_perms('admin_reports')) { ?>
|
||||
<a href="better.php?method=tags&remove=<?= $TorrentID ?>" class="brackets">X</a>
|
||||
<? } ?>
|
||||
<div class="tags"><?= $TorrentTags->format() ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
@@ -0,0 +1,195 @@
|
||||
<?
|
||||
if (!isset($_GET['type']) || !is_number($_GET['type']) || $_GET['type'] > 3 || $_GET['type'] == 1) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
$Options = array('v0', 'v2', '320');
|
||||
$Encodings = array('V0 (VBR)', 'V2 (VBR)', '320');
|
||||
$EncodingKeys = array_fill_keys($Encodings, true);
|
||||
|
||||
if ($_GET['type'] === '3') {
|
||||
//$List = "!(v0 | v2 | 320)";
|
||||
$List = "!(v0 | 320)";
|
||||
} else {
|
||||
$List = '!' . $Options[$_GET['type']];
|
||||
if ($_GET['type'] !== '0') {
|
||||
$_GET['type'] = display_str($_GET['type']);
|
||||
}
|
||||
}
|
||||
$SphQL = new SphinxqlQuery();
|
||||
$SphQL->select('id, groupid')
|
||||
->from('better_transcode')
|
||||
->where('logscore', 100)
|
||||
->where_match('FLAC', 'format')
|
||||
->where_match($List, 'encoding', false)
|
||||
->order_by('RAND()')
|
||||
->limit(0, TORRENTS_PER_PAGE, TORRENTS_PER_PAGE);
|
||||
if (!empty($_GET['search'])) {
|
||||
$SphQL->where_match($_GET['search'], '(groupname,artistname,year,taglist)');
|
||||
}
|
||||
|
||||
$SphQLResult = $SphQL->query();
|
||||
$TorrentCount = $SphQLResult->get_meta('total');
|
||||
|
||||
if ($TorrentCount == 0) {
|
||||
error('No results found!');
|
||||
}
|
||||
|
||||
$Results = $SphQLResult->to_array('groupid');
|
||||
$Groups = Torrents::get_groups(array_keys($Results));
|
||||
$TorrentGroups = array();
|
||||
foreach ($Groups as $GroupID => $Group) {
|
||||
if (empty($Group['Torrents'])) {
|
||||
unset($Groups[$GroupID]);
|
||||
continue;
|
||||
}
|
||||
foreach ($Group['Torrents'] as $Torrent) {
|
||||
$TorRemIdent = "$Torrent[Media] $Torrent[RemasterYear] $Torrent[RemasterTitle] $Torrent[RemasterRecordLabel] $Torrent[RemasterCatalogueNumber]";
|
||||
if (!isset($TorrentGroups[$Group['ID']])) {
|
||||
$TorrentGroups[$Group['ID']] = array(
|
||||
$TorRemIdent => array(
|
||||
'FlacID' => 0,
|
||||
'Formats' => array(),
|
||||
'RemasterTitle' => $Torrent['RemasterTitle'],
|
||||
'RemasterYear' => $Torrent['RemasterYear'],
|
||||
'RemasterRecordLabel' => $Torrent['RemasterRecordLabel'],
|
||||
'RemasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'],
|
||||
'IsSnatched' => false
|
||||
)
|
||||
);
|
||||
} elseif (!isset($TorrentGroups[$Group['ID']][$TorRemIdent])) {
|
||||
$TorrentGroups[$Group['ID']][$TorRemIdent] = array(
|
||||
'FlacID' => 0,
|
||||
'Formats' => array(),
|
||||
'RemasterTitle' => $Torrent['RemasterTitle'],
|
||||
'RemasterYear' => $Torrent['RemasterYear'],
|
||||
'RemasterRecordLabel' => $Torrent['RemasterRecordLabel'],
|
||||
'RemasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'],
|
||||
'IsSnatched' => false
|
||||
);
|
||||
}
|
||||
if ($Torrent['Format'] == 'MP3' && isset($EncodingKeys[$Torrent['Encoding']])) {
|
||||
$TorrentGroups[$Group['ID']][$TorRemIdent]['Formats'][$Torrent['Encoding']] = true;
|
||||
} elseif ($TorrentGroups[$Group['ID']][$TorRemIdent]['FlacID'] == 0 && $Torrent['Format'] == 'FLAC' && ($Torrent['LogScore'] == 100 || $Torrent['Media'] != 'CD')) {
|
||||
$TorrentGroups[$Group['ID']][$TorRemIdent]['FlacID'] = $Torrent['ID'];
|
||||
$TorrentGroups[$Group['ID']][$TorRemIdent]['IsSnatched'] = $Torrent['IsSnatched'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
View::show_header(Lang::get('better', 'transcode_search'));
|
||||
?>
|
||||
<br />
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
</div>
|
||||
<div class="thin">
|
||||
<form class="search_form" name="transcodes" action="" method="get">
|
||||
<table cellpadding="6" cellspacing="1" border="0" class="border" width="100%">
|
||||
<tr>
|
||||
<td class="label"><strong><?= Lang::get('better', 'search') ?>:</strong></td>
|
||||
<td>
|
||||
<input type="hidden" name="method" value="transcode" />
|
||||
<input type="hidden" name="type" value="<?= $_GET['type'] ?>" />
|
||||
<input type="search" name="search" size="60" value="<?= (!empty($_GET['search']) ? display_str($_GET['search']) : '') ?>" />
|
||||
|
||||
<input type="submit" value="Search" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<br />
|
||||
<div class="table_container border">
|
||||
<table width="100%" class="torrent_table">
|
||||
<tr class="colhead">
|
||||
<td><?= Lang::get('better', 'torrent') ?></td>
|
||||
<!--
|
||||
<td>V2</td>
|
||||
-->
|
||||
<td>V0</td>
|
||||
<td>320</td>
|
||||
</tr>
|
||||
<?
|
||||
foreach ($TorrentGroups as $GroupID => $Editions) {
|
||||
$GroupInfo = $Groups[$GroupID];
|
||||
$GroupYear = $GroupInfo['Year'];
|
||||
$ExtendedArtists = $GroupInfo['ExtendedArtists'];
|
||||
$GroupCatalogueNumber = $GroupInfo['CatalogueNumber'];
|
||||
$GroupName = $GroupInfo['Name'];
|
||||
$GroupRecordLabel = $GroupInfo['RecordLabel'];
|
||||
$ReleaseType = $GroupInfo['ReleaseType'];
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$ArtistNames = Artists::display_artists($ExtendedArtists);
|
||||
} else {
|
||||
$ArtistNames = '';
|
||||
}
|
||||
$TorrentTags = new Tags($GroupInfo['TagList']);
|
||||
foreach ($Editions as $RemIdent => $Edition) {
|
||||
if (
|
||||
!$Edition['FlacID'] //no FLAC in this group
|
||||
|| !empty($Edition['Formats']) && $_GET['type'] === '3' //at least one transcode present when we only wanted groups containing no transcodes at all (type 3)
|
||||
|| $Edition['Formats'][$Encodings[$_GET['type']]] == true //the transcode we asked for is already there
|
||||
|| count($Edition['Formats']) === 3
|
||||
) //all 3 transcodes are there already (this can happen due to the caching of Sphinx's better_transcode table)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$DisplayName = $ArtistNames . '<a href="torrents.php?id=' . $GroupID . '&torrentid=' . $Edition['FlacID'] . '#torrent' . $Edition['FlacID'] . '" class="tooltip" title="' . Lang::get('global', 'view_torrent') . '" dir="ltr">' . $GroupName . '</a>';
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
if ($ReleaseType > 0) {
|
||||
$DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||
}
|
||||
if ($Edition['IsSnatched']) {
|
||||
$DisplayName .= ' ' . Format::torrent_label('Snatched!');
|
||||
}
|
||||
|
||||
$EditionInfo = array();
|
||||
if (!empty($Edition['RemasterYear'])) {
|
||||
$ExtraInfo = $Edition['RemasterYear'];
|
||||
} else {
|
||||
$ExtraInfo = '';
|
||||
}
|
||||
if (!empty($Edition['RemasterRecordLabel'])) {
|
||||
$EditionInfo[] = $Edition['RemasterRecordLabel'];
|
||||
}
|
||||
if (!empty($Edition['RemasterTitle'])) {
|
||||
$EditionInfo[] = $Edition['RemasterTitle'];
|
||||
}
|
||||
if (!empty($Edition['RemasterCatalogueNumber'])) {
|
||||
$EditionInfo[] = $Edition['RemasterCatalogueNumber'];
|
||||
}
|
||||
if (!empty($Edition['RemasterYear'])) {
|
||||
$ExtraInfo .= ' - ';
|
||||
}
|
||||
$ExtraInfo .= implode(' / ', $EditionInfo);
|
||||
?>
|
||||
<tr<?= $Edition['IsSnatched'] ? ' class="snatched_torrent"' : '' ?>>
|
||||
<td>
|
||||
<span class="torrent_links_block float_right">
|
||||
[<a href="torrents.php?action=download&id=<?= $Edition['FlacID'] ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" title="<?= Lang::get('better', 'download') ?>" class="brackets tooltip">DL</a>]
|
||||
</span>
|
||||
<?= $DisplayName ?>
|
||||
<div class="torrent_info"><?= $ExtraInfo ?></div>
|
||||
<div class="tags"><?= $TorrentTags->format() ?></div>
|
||||
</td>
|
||||
<!--
|
||||
<td><?= isset($Edition['Formats']['V2 (VBR)']) ? '<strong class="important_text_alt">' . Lang::get('better', 'yes') . '</strong>' : '<strong class="important_text">' . Lang::get('better', 'no') . '</strong>' ?></td>
|
||||
-->
|
||||
<td><?= isset($Edition['Formats']['V0 (VBR)']) ? '<strong class="important_text_alt">' . Lang::get('better', 'yes') . '</strong>' : '<strong class="important_text">' . Lang::get('better', 'no') . '</strong>' ?></td>
|
||||
<td><?= isset($Edition['Formats']['320']) ? '<strong class="important_text_alt">' . Lang::get('better', 'yes') . '</strong>' : '<strong class="important_text">' . Lang::get('better', 'no') . '</strong>' ?></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
Executable
+356
@@ -0,0 +1,356 @@
|
||||
<?
|
||||
|
||||
/**
|
||||
* New transcode module:
|
||||
* $_GET['filter'] determines which torrents should be shown and can be empty/all (default), uploaded, snatched or seeding
|
||||
* $_GET['target'] further filters which transcodes one would like to do and can be empty/any (default), v0, v2, 320 or all
|
||||
* Here, 'any' means that at least one of the formats V0, V2 and 320 is missing and 'all' means that all of them are missing.
|
||||
* 'v0', etc. mean that this specific format is missing (but others might be present).
|
||||
*
|
||||
* Furthermore, there's $_GET['userid'] which allows to see the page as a different user would see it (specifically relevant for uploaded/snatched/seeding).
|
||||
*/
|
||||
|
||||
if (!empty($_GET['userid']) && is_number($_GET['userid'])) {
|
||||
if (check_perms('users_override_paranoia')) {
|
||||
$UserID = $_GET['userid'];
|
||||
} else {
|
||||
error(403);
|
||||
}
|
||||
} else {
|
||||
$UserID = $LoggedUser['ID'];
|
||||
}
|
||||
|
||||
if (empty($_GET['filter']) || !in_array($_GET['filter'], array('uploaded', 'seeding', 'snatched'))) {
|
||||
$_GET['filter'] = 'all';
|
||||
}
|
||||
if (empty($_GET['target']) || !in_array($_GET['target'], array('v0', 'v2', '320', 'all'))) {
|
||||
$_GET['target'] = 'any';
|
||||
}
|
||||
$Encodings = array('v0' => 'V0 (VBR)', 'v2' => 'V2 (VBR)', '320' => '320');
|
||||
|
||||
function transcode_init_sphql() {
|
||||
// Initializes a basic SphinxqlQuery object
|
||||
$SphQL = new SphinxqlQuery();
|
||||
$SphQL->select('groupid')
|
||||
->from('better_transcode')
|
||||
->where('logscore', 100)
|
||||
->where_match('FLAC', 'format')
|
||||
->order_by('RAND()')
|
||||
->limit(0, TORRENTS_PER_PAGE, TORRENTS_PER_PAGE);
|
||||
if (in_array($_GET['target'], array('v0', 'v2', '320'))) {
|
||||
// V0/V2/320 is missing
|
||||
$SphQL->where_match('!' . $_GET['target'], 'encoding', false);
|
||||
} elseif ($_GET['target'] === 'all') {
|
||||
// all transcodes are missing
|
||||
$SphQL->where_match('!(v0 | v2 | 320)', 'encoding', false);
|
||||
} else {
|
||||
// any transcode is missing
|
||||
$SphQL->where_match('!(v0 v2 320)', 'encoding', false);
|
||||
}
|
||||
if (!empty($_GET['search'])) {
|
||||
$SphQL->where_match($_GET['search'], '(groupname,artistname,year,taglist)');
|
||||
}
|
||||
return $SphQL;
|
||||
}
|
||||
|
||||
function transcode_parse_groups($Groups) {
|
||||
$TorrentGroups = array();
|
||||
foreach ($Groups as $GroupID => $Group) {
|
||||
if (empty($Group['Torrents'])) {
|
||||
continue;
|
||||
}
|
||||
foreach ($Group['Torrents'] as $TorrentID => $Torrent) {
|
||||
$RemIdent = "$Torrent[Media] $Torrent[RemasterYear] $Torrent[RemasterTitle] $Torrent[RemasterRecordLabel] $Torrent[RemasterCatalogueNumber]";
|
||||
if (!isset($TorrentGroups[$GroupID])) {
|
||||
$TorrentGroups[$GroupID] = array(
|
||||
'Year' => $Group['Year'],
|
||||
'ExtendedArtists' => $Group['ExtendedArtists'],
|
||||
'Name' => $Group['Name'],
|
||||
'ReleaseType' => $Group['ReleaseType'],
|
||||
'TagList' => $Group['TagList'],
|
||||
'Editions' => array()
|
||||
);
|
||||
}
|
||||
if (!isset($TorrentGroups[$GroupID]['Editions'][$RemIdent])) {
|
||||
if ($Torrent['Remastered'] && $Torrent['RemasterYear'] != 0) {
|
||||
$EditionName = $Torrent['RemasterYear'];
|
||||
$AddExtra = ' - ';
|
||||
if ($Torrent['RemasterRecordLabel']) {
|
||||
$EditionName .= $AddExtra . display_str($Torrent['RemasterRecordLabel']);
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Torrent['RemasterCatalogueNumber']) {
|
||||
$EditionName .= $AddExtra . display_str($Torrent['RemasterCatalogueNumber']);
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Torrent['RemasterTitle']) {
|
||||
$EditionName .= $AddExtra . display_str($Torrent['RemasterTitle']);
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
$EditionName .= $AddExtra . display_str($Torrent['Media']);
|
||||
} else {
|
||||
$AddExtra = ' / ';
|
||||
if (!$Torrent['Remastered']) {
|
||||
$EditionName = 'Original Release';
|
||||
if ($Group['RecordLabel']) {
|
||||
$EditionName .= $AddExtra . $Group['RecordLabel'];
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Group['CatalogueNumber']) {
|
||||
$EditionName .= $AddExtra . $Group['CatalogueNumber'];
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
} else {
|
||||
$EditionName = 'Unknown Release(s)';
|
||||
}
|
||||
$EditionName .= $AddExtra . display_str($Torrent['Media']);
|
||||
}
|
||||
$TorrentGroups[$GroupID]['Editions'][$RemIdent] = array(
|
||||
'FlacIDs' => array(),
|
||||
'MP3s' => array(),
|
||||
'Media' => $Torrent['Media'],
|
||||
'EditionName' => $EditionName,
|
||||
'FLACIsSnatched' => false
|
||||
);
|
||||
}
|
||||
|
||||
if ($Torrent['Format'] == 'MP3') {
|
||||
$TorrentGroups[$GroupID]['Editions'][$RemIdent]['MP3s'][$Torrent['Encoding']] = true;
|
||||
} elseif (
|
||||
$Torrent['Format'] == 'FLAC' && ($Torrent['LogScore'] == 100 || $Torrent['Media'] != 'CD')
|
||||
&& !isset($TorrentGroups[$GroupID]['Editions'][$RemIdent]['FlacIDs'][$TorrentID])
|
||||
) {
|
||||
$TorrentGroups[$GroupID]['Editions'][$RemIdent]['FlacIDs'][$TorrentID] = true;
|
||||
$TorrentGroups[$GroupID]['Editions'][$RemIdent]['FLACIsSnatched'] = $TorrentGroups[$GroupID]['Editions'][$RemIdent]['FLACIsSnatched'] || $Torrent['IsSnatched'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $TorrentGroups;
|
||||
}
|
||||
|
||||
$Groups = array();
|
||||
$ResultCount = 0;
|
||||
if (in_array($_GET['filter'], array('all', 'uploaded'))) {
|
||||
$SphQL = transcode_init_sphql();
|
||||
if ($_GET['filter'] === 'uploaded') {
|
||||
$SphQL->where('uploader', $UserID);
|
||||
}
|
||||
|
||||
$SphQLResult = $SphQL->query();
|
||||
$ResultCount = $SphQLResult->get_meta('total');
|
||||
if ($ResultCount != 0) {
|
||||
$Results = $SphQLResult->collect('groupid');
|
||||
$Groups = Torrents::get_groups(array_values($Results));
|
||||
$Groups = transcode_parse_groups($Groups);
|
||||
}
|
||||
unset($SphQL, $SphQLResult, $Results);
|
||||
} elseif (in_array($_GET['filter'], array('snatched', 'seeding'))) {
|
||||
// Read all snatched/seeding torrents
|
||||
$DB->query("
|
||||
SELECT t.GroupID, x.fid
|
||||
FROM " . ($_GET['filter'] === 'seeding' ? 'xbt_files_users' : 'xbt_snatched') . " AS x
|
||||
JOIN torrents AS t ON t.ID=x.fid
|
||||
JOIN torrents_group AS tg ON tg.ID = t.GroupID
|
||||
WHERE t.Format='FLAC'
|
||||
AND (t.LogScore = '100' OR t.Media != 'CD')
|
||||
AND tg.CategoryID = 1
|
||||
AND x.uid = '$UserID'
|
||||
" . ($_GET['filter'] === 'seeding' ? 'AND x.active=1 AND x.Remaining=0' : ''));
|
||||
$Debug->set_flag('SELECTed ' . $_GET['filter'] . ' torrents');
|
||||
$Snatched = $DB->to_array();
|
||||
$Debug->set_flag('Received data from DB');
|
||||
shuffle($Snatched); // randomize results
|
||||
while ($ResultCount < TORRENTS_PER_PAGE && count($Snatched) > 0) {
|
||||
// we throw TORRENTS_PER_PAGE results into Sphinx until we have at least TORRENTS_PER_PAGE results (or no snatches left)
|
||||
$SnatchedTmp = array_slice($Snatched, 0, TORRENTS_PER_PAGE);
|
||||
$Snatched = array_slice($Snatched, TORRENTS_PER_PAGE);
|
||||
|
||||
$SphQL = transcode_init_sphql();
|
||||
$SphQL->where('groupid', array_map(function ($row) {
|
||||
return $row['GroupID'];
|
||||
}, $SnatchedTmp));
|
||||
|
||||
$SphQLResult = $SphQL->query();
|
||||
$ResultsTmp = $SphQLResult->collect('groupid');
|
||||
$GroupsTmp = Torrents::get_groups(array_values($ResultsTmp));
|
||||
$GroupsTmp = transcode_parse_groups($GroupsTmp);
|
||||
// Since we're asking Sphinxql about groups and remidents, the result can/will contain different editions that are transcodable but weren't snatched, so let's filter them out
|
||||
foreach ($GroupsTmp as $GroupID => $Group) {
|
||||
foreach ($Group['Editions'] as $RemIdent => $Edition) {
|
||||
$EditionSnatched = false;
|
||||
foreach ($SnatchedTmp as $SnatchedTmpE) {
|
||||
if (isset($Edition['FlacIDs'][$SnatchedTmpE['fid']])) {
|
||||
$EditionSnatched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$EditionSnatched || count($Edition['MP3s']) === 3) {
|
||||
unset($GroupsTmp[$GroupID]['Editions'][$RemIdent]);
|
||||
}
|
||||
}
|
||||
$ResultCount += count($GroupsTmp[$GroupID]['Editions']);
|
||||
if (count($GroupsTmp[$GroupID]['Editions']) === 0) {
|
||||
unset($GroupsTmp[$GroupID]);
|
||||
}
|
||||
}
|
||||
$Groups = $GroupsTmp + $Groups;
|
||||
unset($SnatchedTmp, $SphQL, $SphQLResult, $ResultsTmp, $GroupsTmp);
|
||||
}
|
||||
}
|
||||
$Debug->log_var($Groups, 'Groups');
|
||||
|
||||
$Counter = array(
|
||||
'total' => 0, //how many FLAC torrents can be transcoded?
|
||||
'miss_total' => 0, //how many transcodes are missing?
|
||||
'miss_V0 (VBR)' => 0, //how many V0 transcodes are missing?
|
||||
'miss_V2 (VBR)' => 0, //how many V2 transcodes are missing?
|
||||
'miss_320' => 0, //how many 320 transcodes are missing?
|
||||
);
|
||||
foreach ($Groups as $GroupID => $Group) {
|
||||
foreach ($Group['Editions'] as $RemIdent => $Edition) {
|
||||
if (
|
||||
count($Edition['FlacIDs']) === 0 //no FLAC in this group
|
||||
|| (!empty($Edition['MP3s']) && $_GET['target'] === 'all') //at least one transcode present when we only wanted groups containing no transcodes at all
|
||||
|| isset($Edition['MP3s'][$Encodings[$_GET['target']]]) //the transcode we asked for is already there
|
||||
|| count($Edition['MP3s']) === 3
|
||||
) //all 3 transcodes are there already (this can happen due to the caching of Sphinx's better_transcode table)
|
||||
{
|
||||
$Debug->log_var($Edition, 'Skipping ' . $RemIdent);
|
||||
unset($Groups[$GroupID]['Editions'][$RemIdent]);
|
||||
continue;
|
||||
}
|
||||
$edition_miss = 0; //number of transcodes missing in this edition
|
||||
foreach ($Encodings as $Encoding) {
|
||||
if (!isset($Edition['MP3s'][$Encoding])) {
|
||||
++$edition_miss;
|
||||
++$Counter['miss_' . $Encoding];
|
||||
}
|
||||
}
|
||||
$Counter['miss_total'] += $edition_miss;
|
||||
$Counter['total'] += (bool)$edition_miss;
|
||||
}
|
||||
}
|
||||
$Debug->log_var($Counter, 'counter');
|
||||
|
||||
View::show_header('Transcode Search');
|
||||
?>
|
||||
<br />
|
||||
<div class="thin">
|
||||
<h2>Transcodes</h2>
|
||||
<h3>Search</h3>
|
||||
<form class="search_form" name="transcodes" action="" method="get">
|
||||
<input type="hidden" name="method" value="transcode_beta" />
|
||||
<div class="table_container border">
|
||||
<table cellpadding="6" cellspacing="1" border="0" class="border" width="100%">
|
||||
<tr>
|
||||
<td class="label"><strong>Filter</strong></td>
|
||||
<td>
|
||||
<select name="filter">
|
||||
<option value="all" <?= ($_GET['filter'] == 'all' ? ' selected="selected"' : '') ?>>Show all torrents</option>
|
||||
<option value="snatched" <?= ($_GET['filter'] == 'snatched' ? ' selected="selected"' : '') ?>>Snatched only</option>
|
||||
<option value="seeding" <?= ($_GET['filter'] == 'seeding' ? ' selected="selected"' : '') ?>>Seeding only</option>
|
||||
<option value="uploaded" <?= ($_GET['filter'] == 'uploaded' ? ' selected="selected"' : '') ?>>Uploaded only</option>
|
||||
</select>
|
||||
<select name="target">
|
||||
<option value="any" <?= ($_GET['target'] == 'any' ? ' selected="selected"' : '') ?>>Any transcode missing</option>
|
||||
<option value="v0" <?= ($_GET['target'] == 'v0' ? ' selected="selected"' : '') ?>>V0 missing</option>
|
||||
<option value="v2" <?= ($_GET['target'] == 'v2' ? ' selected="selected"' : '') ?>>V2 missing</option>
|
||||
<option value="320" <?= ($_GET['target'] == '320' ? ' selected="selected"' : '') ?>>320 missing</option>
|
||||
<option value="all" <?= ($_GET['target'] == 'all' ? ' selected="selected"' : '') ?>>All transcodes missing</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><strong>Search</strong></td>
|
||||
<td>
|
||||
<input type="search" name="search" size="60" value="<?= (!empty($_GET['search']) ? display_str($_GET['search']) : '') ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="submit" value="Search" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<h3>About</h3>
|
||||
<div class="box pad">
|
||||
<p>
|
||||
This page aims at listing <?= TORRENTS_PER_PAGE ?> random transcodable perfect FLACs matching the options you selected above, but there can be more or less matches on this page. The following numbers tell you something about the torrents currently listed below and can change if you reload.<br /><br />
|
||||
|
||||
Number of perfect FLACs you can transcode: <?= number_format($Counter['total']) ?><br />
|
||||
Number of missing transcodes: <?= number_format($Counter['miss_total']) ?><br />
|
||||
Number of missing V2 / V0 / 320 transcodes: <?= number_format($Counter['miss_V2 (VBR)']) ?> / <?= number_format($Counter['miss_V0 (VBR)']) ?> / <?= number_format($Counter['miss_320']) ?>
|
||||
</p>
|
||||
</div>
|
||||
<h3>List</h3>
|
||||
<div class="table_container border">
|
||||
<table width="100%" class="torrent_table">
|
||||
<tr class="colhead">
|
||||
<td>Torrent</td>
|
||||
<td>V2</td>
|
||||
<td>V0</td>
|
||||
<td>320</td>
|
||||
</tr>
|
||||
<?
|
||||
if ($ResultCount == 0) {
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="4">No results found!</td>
|
||||
</tr>
|
||||
<?
|
||||
} else {
|
||||
foreach ($Groups as $GroupID => $Group) {
|
||||
$GroupYear = $Group['Year'];
|
||||
$ExtendedArtists = $Group['ExtendedArtists'];
|
||||
$GroupName = $Group['Name'];
|
||||
$ReleaseType = $Group['ReleaseType'];
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$ArtistNames = Artists::display_artists($ExtendedArtists);
|
||||
} else {
|
||||
$ArtistNames = '';
|
||||
}
|
||||
|
||||
$TorrentTags = new Tags($Group['TagList']);
|
||||
|
||||
foreach ($Group['Editions'] as $RemIdent => $Edition) {
|
||||
// TODO: point to the correct FLAC (?)
|
||||
$FlacID = array_search(true, $Edition['FlacIDs']);
|
||||
$DisplayName = $ArtistNames . "<a href=\"torrents.php?id=$GroupID&torrentid=$FlacID#torrent$FlacID\" class=\"tooltip\" title=\"" . Lang::get('global', 'view_torrent') . "\" dir=\"ltr\">$GroupName</a>";
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
if ($ReleaseType > 0) {
|
||||
$DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||
}
|
||||
if ($Edition['FLACIsSnatched']) {
|
||||
$DisplayName .= ' ' . Format::torrent_label('Snatched!');
|
||||
}
|
||||
?>
|
||||
<tr<?= ($Edition['FLACIsSnatched'] ? ' class="snatched_torrent"' : '') ?>>
|
||||
<td>
|
||||
<span class="torrent_links_block">
|
||||
<a href="torrents.php?action=download&id=<?= $Edition['FlacID'] ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" title="Download" class="brackets tooltip">DL</a>
|
||||
</span>
|
||||
<?= $DisplayName ?>
|
||||
<div class="torrent_info"><?= $Edition['EditionName'] ?></div>
|
||||
<div class="tags"><?= $TorrentTags->format('better.php?action=transcode&tags=') ?></div>
|
||||
</td>
|
||||
<td><?= (isset($Edition['MP3s']['V2 (VBR)']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>') ?></td>
|
||||
<td><?= (isset($Edition['MP3s']['V0 (VBR)']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>') ?></td>
|
||||
<td><?= (isset($Edition['MP3s']['320']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>') ?></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
Executable
+219
@@ -0,0 +1,219 @@
|
||||
<?
|
||||
if (!empty($_GET['userid']) && is_number($_GET['userid'])) {
|
||||
if (check_perms('users_override_paranoia')) {
|
||||
$UserID = $_GET['userid'];
|
||||
} else {
|
||||
error(403);
|
||||
}
|
||||
} else {
|
||||
$UserID = $LoggedUser['ID'];
|
||||
}
|
||||
|
||||
$Encodings = array('V0 (VBR)', 'V2 (VBR)', '320');
|
||||
$EncodingKeys = array_fill_keys($Encodings, true);
|
||||
|
||||
// Get list of FLAC uploads
|
||||
$DB->query("
|
||||
SELECT t.GroupID, t.ID
|
||||
FROM torrents AS t
|
||||
JOIN torrents_group AS tg ON tg.ID = t.GroupID
|
||||
WHERE t.Format='FLAC'
|
||||
AND ((t.LogScore = '100' AND t.Media = 'CD')
|
||||
OR t.Media != 'CD')
|
||||
AND tg.CategoryID = 1
|
||||
AND t.UserID = '$UserID'");
|
||||
|
||||
$UploadedTorrentIDs = array_fill_keys($DB->collect('ID'), true);
|
||||
$UploadedGroupIDs = $DB->collect('GroupID');
|
||||
|
||||
if (count($UploadedGroupIDs) === 0) {
|
||||
error(Lang::get('better', 'you_havent_uploaded_any_perfect_flacs'));
|
||||
}
|
||||
|
||||
// Create hash table
|
||||
$DB->query("
|
||||
CREATE TEMPORARY TABLE temp_sections_better_upload
|
||||
SELECT
|
||||
GroupID,
|
||||
GROUP_CONCAT(Encoding SEPARATOR ' ') AS EncodingList,
|
||||
CRC32(CONCAT_WS(
|
||||
' ', Media, Remasteryear, Remastertitle,
|
||||
Remasterrecordlabel, Remastercataloguenumber)
|
||||
) AS RemIdent
|
||||
FROM torrents
|
||||
WHERE GroupID IN (" . implode(',', $UploadedGroupIDs) . ")
|
||||
AND Format IN ('FLAC', 'MP3')
|
||||
GROUP BY GroupID, RemIdent");
|
||||
|
||||
$DB->query("
|
||||
SELECT GroupID
|
||||
FROM temp_sections_better_upload
|
||||
WHERE EncodingList NOT LIKE '%V0 (VBR)%'
|
||||
OR EncodingList NOT LIKE '%V2 (VBR)%'
|
||||
OR EncodingList NOT LIKE '%320%'");
|
||||
|
||||
$GroupIDs = array_fill_keys($DB->collect('GroupID'), true);
|
||||
|
||||
if (count($GroupIDs) === 0) {
|
||||
error(Lang::get('better', 'no_results_found'));
|
||||
}
|
||||
|
||||
$Groups = Torrents::get_groups(array_keys($GroupIDs));
|
||||
$TorrentGroups = array();
|
||||
foreach ($Groups as $GroupID => $Group) {
|
||||
if (empty($Group['Torrents'])) {
|
||||
unset($Groups[$GroupID]);
|
||||
continue;
|
||||
}
|
||||
foreach ($Group['Torrents'] as $Torrent) {
|
||||
$TorRemIdent = "$Torrent[Media] $Torrent[RemasterYear] $Torrent[RemasterTitle] $Torrent[RemasterRecordLabel] $Torrent[RemasterCatalogueNumber]";
|
||||
if (!isset($TorrentGroups[$Group['ID']])) {
|
||||
$TorrentGroups[$Group['ID']] = array(
|
||||
$TorRemIdent => array(
|
||||
'FlacID' => 0,
|
||||
'Formats' => array(),
|
||||
'IsSnatched' => $Torrent['IsSnatched'],
|
||||
'Medium' => $Torrent['Media'],
|
||||
'RemasterTitle' => $Torrent['RemasterTitle'],
|
||||
'RemasterYear' => $Torrent['RemasterYear'],
|
||||
'RemasterRecordLabel' => $Torrent['RemasterRecordLabel'],
|
||||
'RemasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber']
|
||||
)
|
||||
);
|
||||
} elseif (!isset($TorrentGroups[$Group['ID']][$TorRemIdent])) {
|
||||
$TorrentGroups[$Group['ID']][$TorRemIdent] = array(
|
||||
'FlacID' => 0,
|
||||
'Formats' => array(),
|
||||
'IsSnatched' => $Torrent['IsSnatched'],
|
||||
'Medium' => $Torrent['Media'],
|
||||
'RemasterTitle' => $Torrent['RemasterTitle'],
|
||||
'RemasterYear' => $Torrent['RemasterYear'],
|
||||
'RemasterRecordLabel' => $Torrent['RemasterRecordLabel'],
|
||||
'RemasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber']
|
||||
);
|
||||
}
|
||||
if ($Torrent['Format'] == 'MP3' && isset($EncodingKeys[$Torrent['Encoding']])) {
|
||||
$TorrentGroups[$Group['ID']][$TorRemIdent]['Formats'][$Torrent['Encoding']] = true;
|
||||
$Counter['existing'][$Torrent['Encoding']] += 1;
|
||||
} elseif (isset($UploadedTorrentIDs[$Torrent['ID']])) {
|
||||
$TorrentGroups[$Group['ID']][$TorRemIdent]['FlacID'] = $Torrent['ID'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$Counter = array(
|
||||
'total' => 0, //how many FLAC torrents can be transcoded?
|
||||
'miss_total' => 0, //how many transcodes are missing?
|
||||
'miss_V0 (VBR)' => 0, //how many V0 transcodes are missing?
|
||||
'miss_V2 (VBR)' => 0, //how many V2 transcodes are missing?
|
||||
'miss_320' => 0, //how many 320 transcodes are missing?
|
||||
);
|
||||
foreach ($TorrentGroups as $Editions) {
|
||||
foreach ($Editions as $Edition) {
|
||||
if ($Edition['FlacID'] == 0) { // no FLAC in this edition
|
||||
continue;
|
||||
}
|
||||
$edition_miss = 0; //number of transcodes missing in this edition
|
||||
foreach ($Encodings as $Encoding) {
|
||||
if (!isset($Edition['Formats'][$Encoding])) {
|
||||
++$edition_miss;
|
||||
++$Counter["miss_$Encoding"];
|
||||
}
|
||||
}
|
||||
$Counter['miss_total'] += $edition_miss;
|
||||
$Counter['total'] += (bool)$edition_miss;
|
||||
}
|
||||
}
|
||||
|
||||
View::show_header('Transcode Uploads');
|
||||
?>
|
||||
<div class="linkbox">
|
||||
<a href="better.php" class="brackets"><?= Lang::get('better', 'back_to_better_php_list') ?></a>
|
||||
</div>
|
||||
<div class="thin">
|
||||
<h2><?= Lang::get('better', 'transcode_uploaded_torrents') ?></h2>
|
||||
<h3><?= Lang::get('better', 'stats') ?></h3>
|
||||
<div class="box pad">
|
||||
<p>
|
||||
<?= Lang::get('better', 'number_of_perfect_flacs_you_can_transcode') ?>: <?= number_format($Counter['total']) ?><br />
|
||||
<?= Lang::get('better', 'number_of_missing_transcodes') ?>: <?= number_format($Counter['miss_total']) ?><br />
|
||||
<?= Lang::get('better', 'number_of_missing_v2_v0_320_transcodes') ?>: <?= number_format($Counter['miss_V2 (VBR)']) ?> / <?= number_format($Counter['miss_V0 (VBR)']) ?> / <?= number_format($Counter['miss_320']) ?>
|
||||
</p>
|
||||
</div>
|
||||
<h3>List</h3>
|
||||
<div class="table_container border">
|
||||
<table width="100%" class="torrent_table">
|
||||
<tr class="colhead">
|
||||
<td><?= Lang::get('better', 'torrent') ?></td>
|
||||
<td>V2</td>
|
||||
<td>V0</td>
|
||||
<td>320</td>
|
||||
</tr>
|
||||
<?
|
||||
foreach ($TorrentGroups as $GroupID => $Editions) {
|
||||
$GroupInfo = $Groups[$GroupID];
|
||||
extract(Torrents::array_group($GroupInfo));
|
||||
|
||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$ArtistNames = Artists::display_artists($ExtendedArtists);
|
||||
} else {
|
||||
$ArtistNames = '';
|
||||
}
|
||||
$TorrentTags = new Tags($TagList);
|
||||
foreach ($Editions as $RemIdent => $Edition) {
|
||||
if (!$Edition['FlacID'] || count($Edition['Formats']) === 3) {
|
||||
continue;
|
||||
}
|
||||
$DisplayName = $ArtistNames . '<a href="torrents.php?id=' . $GroupID . '&torrentid=' . $Edition['FlacID'] . '#torrent' . $Edition['FlacID'] . '" class="tooltip" title="' . Lang::get('global', 'view_torrent') . '" dir="ltr">' . $GroupName . '</a>';
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
if ($ReleaseType > 0) {
|
||||
$DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||
}
|
||||
$DisplayName .= ' [' . $Edition['Medium'] . ']';
|
||||
|
||||
$EditionInfo = array();
|
||||
if (!empty($Edition['RemasterYear'])) {
|
||||
$ExtraInfo = $Edition['RemasterYear'];
|
||||
} else {
|
||||
$ExtraInfo = '';
|
||||
}
|
||||
if (!empty($Edition['RemasterRecordLabel'])) {
|
||||
$EditionInfo[] = $Edition['RemasterRecordLabel'];
|
||||
}
|
||||
if (!empty($Edition['RemasterTitle'])) {
|
||||
$EditionInfo[] = $Edition['RemasterTitle'];
|
||||
}
|
||||
if (!empty($Edition['RemasterCatalogueNumber'])) {
|
||||
$EditionInfo[] = $Edition['RemasterCatalogueNumber'];
|
||||
}
|
||||
if (!empty($Edition['RemasterYear'])) {
|
||||
$ExtraInfo .= ' - ';
|
||||
}
|
||||
$ExtraInfo .= implode(' / ', $EditionInfo);
|
||||
?>
|
||||
<tr class="torrent torrent_row<?= $Edition['IsSnatched'] ? ' snatched_torrent' : '' ?>">
|
||||
<td>
|
||||
<span class="torrent_links_block">
|
||||
<a href="torrents.php?action=download&id=<?= $Edition['FlacID'] ?>&authkey=<?= $LoggedUser['AuthKey'] ?>&torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" title="<?= Lang::get('better', 'download') ?>" class="brackets tooltip">DL</a>
|
||||
</span>
|
||||
<?= $DisplayName ?>
|
||||
<div class="torrent_info"><?= $ExtraInfo ?></div>
|
||||
<div class="tags"><?= $TorrentTags->format() ?></div>
|
||||
</td>
|
||||
<td><?= isset($Edition['Formats']['V2 (VBR)']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>' ?></td>
|
||||
<td><?= isset($Edition['Formats']['V0 (VBR)']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>' ?></td>
|
||||
<td><?= isset($Edition['Formats']['320']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>' ?></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
@@ -1,4 +1,7 @@
|
||||
<?
|
||||
|
||||
use Gazelle\Manager\Donation;
|
||||
|
||||
if (!check_perms('users_mod')) {
|
||||
error(403);
|
||||
}
|
||||
@@ -55,15 +58,16 @@ $OldDonations = G::$DB->to_pair(0, 1, false);
|
||||
<?
|
||||
if (!empty($NewDonations)) {
|
||||
foreach (DonationsBitcoin::get_userids(array_keys($NewDonations)) as $Address => $UserID) {
|
||||
$DonationEUR = Donations::currency_exchange($NewDonations[$Address], 'BTC');
|
||||
$donation = new Donation;
|
||||
$DonationEUR = $donation->currencyExchange($NewDonations[$Address], 'BTC');
|
||||
?>
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell"><?= $Address ?></td>
|
||||
<td class="Table-cell"><?= Users::format_username($UserID, true, false, false) ?></td>
|
||||
<td class="Table-cell"><?= $NewDonations[$Address] ?> (<?= "$DonationEUR EUR" ?>)</td>
|
||||
<td class="Table-cell"><?= $AllDonations[$Address] ?></td>
|
||||
<td class="Table-cell"><?= (int)Donations::get_rank($UserID) ?></td>
|
||||
<td class="Table-cell"><?= (int)Donations::get_special_rank($UserID) ?></td>
|
||||
<td class="Table-cell"><?= (int)$donation->rank($UserID) ?></td>
|
||||
<td class="Table-cell"><?= (int)$donation->specialRank($UserID) ?></td>
|
||||
</tr>
|
||||
<? }
|
||||
} else { ?>
|
||||
|
||||
@@ -201,22 +201,10 @@ switch ($_REQUEST['action']) {
|
||||
$Cache->delete_value('news_latest_title');
|
||||
$Cache->delete_value('news');
|
||||
|
||||
|
||||
|
||||
NotificationsManager::send_push(NotificationsManager::get_push_enabled_users(), $_POST['title'], $_POST['body'], site_url() . 'index.php', NotificationsManager::NEWS);
|
||||
|
||||
header('Location: index.php');
|
||||
break;
|
||||
|
||||
case 'bonus_points':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/tools/managers/bonus_points.php');
|
||||
break;
|
||||
case 'tokens':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/tools/managers/tokens.php');
|
||||
break;
|
||||
case 'invite':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/tools/managers/invite.php');
|
||||
break;
|
||||
case 'multiple_freeleech':
|
||||
include(CONFIG['SERVER_ROOT'] . '/sections/tools/managers/multiple_freeleech.php');
|
||||
break;
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
if (!check_perms('users_mod')) {
|
||||
error(403);
|
||||
}
|
||||
$Message = "";
|
||||
if (isset($_REQUEST['add_points'])) {
|
||||
authorize();
|
||||
$Points = floatval($_REQUEST['num_points']);
|
||||
|
||||
if ($Points < 0) {
|
||||
error('Please enter a valid number of points.');
|
||||
}
|
||||
|
||||
$sql = "
|
||||
UPDATE users_main
|
||||
SET BonusPoints = BonusPoints + {$Points}
|
||||
WHERE Enabled = '1'";
|
||||
$DB->query($sql);
|
||||
$sql = "
|
||||
SELECT ID
|
||||
FROM users_main
|
||||
WHERE Enabled = '1'";
|
||||
$DB->query($sql);
|
||||
while (list($UserID) = $DB->next_record()) {
|
||||
$Cache->delete_value("user_stats_{$UserID}");
|
||||
}
|
||||
$Message = '<strong>' . number_format($Points) . ' bonus points added to all enabled users.</strong><br /><br />';
|
||||
}
|
||||
|
||||
View::show_header(t('server.tools.add_bonus_sitewide'), '', 'PageToolBonusPoint');
|
||||
|
||||
?>
|
||||
<div class="BodyHeader">
|
||||
<h2 class="BodyHeader-nav"><?= t('server.tools.add_bonus_points_to_all_users') ?></h2>
|
||||
</div>
|
||||
<div class="BoxBody" style="margin-left: auto; margin-right: auto; text-align: center; max-width: 40%;">
|
||||
<?= $Message ?>
|
||||
<form class="add_form" name="fltokens" action="" method="post">
|
||||
<input type="hidden" name="action" value="bonus_points" />
|
||||
<input type="hidden" name="auth" value="<?= $LoggedUser['AuthKey'] ?>" />
|
||||
<?= t('server.tools.points_to_add') ?>: <input class="Input" type="text" name="num_points" size="10" style="text-align: right;" /><br /><br />
|
||||
<input class="Button" type="submit" name="add_points" value="Add points" />
|
||||
</form>
|
||||
</div>
|
||||
<br />
|
||||
<?
|
||||
|
||||
View::show_footer();
|
||||
?>
|
||||
@@ -1,141 +0,0 @@
|
||||
<?
|
||||
|
||||
if (!check_perms('users_mod')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['add_points'])) {
|
||||
authorize();
|
||||
$Points = floatval($_REQUEST['num_points']);
|
||||
|
||||
if ($Points < 0) {
|
||||
error('Please enter a valid number of points.');
|
||||
}
|
||||
|
||||
$sql = "
|
||||
UPDATE users_main
|
||||
SET BonusPoints = BonusPoints + {$Points}
|
||||
WHERE Enabled = '1'";
|
||||
$DB->query($sql);
|
||||
$sql = "
|
||||
SELECT ID
|
||||
FROM users_main
|
||||
WHERE Enabled = '1'";
|
||||
$DB->query($sql);
|
||||
while (list($UserID) = $DB->next_record()) {
|
||||
$Cache->delete_value("user_stats_{$UserID}");
|
||||
}
|
||||
$Message = '<strong>' . number_format($Points) . ' bonus points added to all enabled users.</strong><br /><br />';
|
||||
} else if (isset($_REQUEST['addtokens'])) {
|
||||
authorize();
|
||||
$Tokens = $_REQUEST['numtokens'];
|
||||
|
||||
if (!is_number($Tokens) || ($Tokens < 0)) {
|
||||
error('Please enter a valid number of tokens.');
|
||||
}
|
||||
$sql = "
|
||||
UPDATE users_main
|
||||
SET FLTokens = FLTokens + $Tokens
|
||||
WHERE Enabled = '1'";
|
||||
if (!isset($_REQUEST['leechdisabled'])) {
|
||||
$sql .= "
|
||||
AND can_leech = 1";
|
||||
}
|
||||
$DB->query($sql);
|
||||
$sql = "
|
||||
SELECT ID
|
||||
FROM users_main
|
||||
WHERE Enabled = '1'";
|
||||
if (!isset($_REQUEST['leechdisabled'])) {
|
||||
$sql .= "
|
||||
AND can_leech = 1";
|
||||
}
|
||||
$DB->query($sql);
|
||||
while (list($UserID) = $DB->next_record()) {
|
||||
$Cache->delete_value("user_info_heavy_$UserID");
|
||||
}
|
||||
$message = '<strong>' . number_format($Tokens) . 'freeleech tokens added to all enabled users' . (!isset($_REQUEST['leechdisabled']) ? ' with enabled leeching privs' : '') . '.</strong><br /><br />';
|
||||
} elseif (isset($_REQUEST['cleartokens'])) {
|
||||
authorize();
|
||||
$Tokens = $_REQUEST['numtokens'];
|
||||
|
||||
if (!is_number($Tokens) || ($Tokens < 0)) {
|
||||
error('Please enter a valid number of tokens.');
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['onlydrop'])) {
|
||||
$Where = "WHERE FLTokens > $Tokens";
|
||||
} elseif (!isset($_REQUEST['leechdisabled'])) {
|
||||
$Where = "WHERE (Enabled = '1' AND can_leech = 1) OR FLTokens > $Tokens";
|
||||
} else {
|
||||
$Where = "WHERE Enabled = '1' OR FLTokens > $Tokens";
|
||||
}
|
||||
$DB->query("
|
||||
SELECT ID
|
||||
FROM users_main
|
||||
$Where");
|
||||
$Users = $DB->to_array();
|
||||
$DB->query("
|
||||
UPDATE users_main
|
||||
SET FLTokens = $Tokens
|
||||
$Where");
|
||||
|
||||
foreach ($Users as $UserID) {
|
||||
list($UserID) = $UserID;
|
||||
$Cache->delete_value("user_info_heavy_$UserID");
|
||||
}
|
||||
|
||||
$where = '';
|
||||
}
|
||||
View::show_header('Bonus Tokens Invites');
|
||||
?>
|
||||
<div>
|
||||
<div class="BodyHeader">
|
||||
<h2 class="BodyHeader-nav">Bonus</h2>
|
||||
</div>
|
||||
<div class="BoxBody" style="margin-left: auto; margin-right: auto; text-align: center; max-width: 40%;">
|
||||
<?= $Message ?>
|
||||
<form class="add_form" name="fltokens" action="" method="post">
|
||||
<input type="hidden" name="action" value="bonus_token_invite" />
|
||||
<input type="hidden" name="auth" value="<?= $LoggedUser['AuthKey'] ?>" />
|
||||
Points to add: <input class="Input" type="text" name="num_points" size="10" style="text-align: right;" /><br /><br />
|
||||
<input class="Button" type="submit" name="add_points" value="Add points" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="BodyHeader">
|
||||
<h2 class="BodyHeader-nav">Tokens</h2>
|
||||
</div>
|
||||
<div class="BoxBody" style="margin-left: auto; margin-right: auto; text-align: center; max-width: 40%;">
|
||||
<?= $message ?>
|
||||
<form class="add_form" name="fltokens" action="" method="post">
|
||||
<input type="hidden" name="action" value="bonus_token_invite" />
|
||||
<input type="hidden" name="auth" value="<?= $LoggedUser['AuthKey'] ?>" />
|
||||
Tokens to add: <input class="Input" type="text" name="numtokens" size="5" style="text-align: right;" value="0" /><br /><br />
|
||||
<label for="leechdisabled">Grant tokens to leech disabled users: </label><input type="checkbox" id="leechdisabled" name="leechdisabled" value="1" /><br /><br />
|
||||
<input class="Button" type="submit" name="addtokens" value="Add tokens" />
|
||||
</form>
|
||||
</div>
|
||||
<br />
|
||||
<div class="BoxBody" style="margin-left: auto; margin-right: auto; text-align: center; max-width: 40%;">
|
||||
<?= $message ?>
|
||||
<form class="manage_form" name="fltokens" action="" method="post">
|
||||
<input type="hidden" name="action" value="tokens" />
|
||||
<input type="hidden" name="auth" value="<?= $LoggedUser['AuthKey'] ?>" />
|
||||
Tokens to set: <input class="Input" type="text" name="numtokens" size="5" style="text-align: right;" value="0" /><br /><br />
|
||||
<span id="droptokens"><label for="onlydrop">Only affect users with at least this many tokens: </label><input type="checkbox" id="onlydrop" name="onlydrop" value="1" onchange="$('#disabled').gtoggle(); return true;" /></span><br />
|
||||
<span id="disabled"><label for="leechdisabled">Also add tokens (as needed) to leech disabled users: </label><input type="checkbox" id="leechdisabled" name="leechdisabled" value="1" onchange="$('#droptokens').gtoggle(); return true;" /></span><br /><br />
|
||||
<input class="Button" type="submit" name="cleartokens" value="Set token total" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="BodyHeader">
|
||||
<h2 class="BodyHeader-nav">Invites</h2>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
@@ -1,33 +1,9 @@
|
||||
<?
|
||||
function eventsRewardLog($UserIDs, $Invites, $InvitesTime, $Tokens, $TokensTime, $Bonus, $BadgeID, $Remark) {
|
||||
$Columns = "";
|
||||
$Values = "";
|
||||
if ($Invites) {
|
||||
$Columns .= ", Invites";
|
||||
$Values .= ", $Invites";
|
||||
if ($InvitesTime) {
|
||||
$Columns .= ", InvitesTime";
|
||||
$Values .= ", '$InvitesTime'";
|
||||
}
|
||||
}
|
||||
if ($Tokens) {
|
||||
$Columns .= ", Tokens";
|
||||
$Values .= ", $Tokens";
|
||||
if ($TokensTime) {
|
||||
$Columns .= ", TokensTime";
|
||||
$Values .= ", '$TokensTime'";
|
||||
}
|
||||
}
|
||||
if ($Bonus) {
|
||||
$Columns .= ", Bonus";
|
||||
$Values .= ", $Bonus";
|
||||
}
|
||||
if ($BadgeID) {
|
||||
$Columns .= ", Badge";
|
||||
$Values .= ", $BadgeID";
|
||||
}
|
||||
G::$DB->query("insert into events_reward_log (UserIDs, ByUserID, Remark$Columns) values ('" . implode(",", $UserIDs) . "', " . G::$LoggedUser['ID'] . ", '$Remark'$Values)");
|
||||
}
|
||||
|
||||
use Gazelle\Manager\Reward;
|
||||
use Gazelle\Action\RewardInfo;
|
||||
use Gazelle\Exception\InvalidParamException;
|
||||
|
||||
function getUserIDs($UsernamesString) {
|
||||
$Usernames = preg_split("/[\s,]+/", $UsernamesString);
|
||||
G::$DB->query("select ID from users_main where username in ('" . implode("','", $Usernames) . "')");
|
||||
@@ -38,79 +14,7 @@ function getUserIDs($UsernamesString) {
|
||||
return $UserIDs;
|
||||
}
|
||||
}
|
||||
function addTokens($UserIDs, $Numbers, $Time, $SendToLeechDisabled) {
|
||||
$Where = " where id in (" . implode(",", $UserIDs) . ")";
|
||||
if (!$SendToLeechDisabled) {
|
||||
$Where .= ' and can_leech = 1';
|
||||
}
|
||||
G::$DB->query("UPDATE users_main SET FLTokens = FLTokens + $Numbers$Where");
|
||||
if ($Time) {
|
||||
$SQL = "insert into tokens_typed (`EndTime`, `Type`, `UserID`) values ";
|
||||
$Values = [];
|
||||
foreach ($UserIDs as $UserID) {
|
||||
for ($i = 0; $i < $Numbers; $i++) {
|
||||
$Values[] = "('$Time', 'time', $UserID)";
|
||||
}
|
||||
}
|
||||
$SQL .= implode(',', $Values);
|
||||
G::$DB->query($SQL);
|
||||
}
|
||||
clearCache($UserIDs, 'user_info_heavy_');
|
||||
}
|
||||
function addInvites($UserIDs, $Numbers, $Time) {
|
||||
$Where = " where id in (" . implode(",", $UserIDs) . ")";
|
||||
G::$DB->query("UPDATE users_main SET Invites = Invites + $Numbers$Where");
|
||||
if ($Time) {
|
||||
$SQL = "insert into invites_typed (`EndTime`, `Type`, `UserID`) values ";
|
||||
$Values = [];
|
||||
foreach ($UserIDs as $UserID) {
|
||||
for ($i = 0; $i < $Numbers; $i++) {
|
||||
$Values[] = "('$Time', 'time', $UserID)";
|
||||
}
|
||||
}
|
||||
$SQL .= implode(',', $Values);
|
||||
G::$DB->query($SQL);
|
||||
}
|
||||
clearCache($UserIDs, 'user_info_heavy_');
|
||||
}
|
||||
function addBonus($UserIDs, $Numbers) {
|
||||
$Where = " where id in (" . implode(",", $UserIDs) . ")";
|
||||
G::$DB->query("UPDATE users_main SET BonusPoints = BonusPoints + $Numbers$Where");
|
||||
clearCache($UserIDs, 'user_stats_');
|
||||
}
|
||||
function addBadges($UserIDs, $BadgeID) {
|
||||
foreach ($UserIDs as $UserID) {
|
||||
Badges::gave($UserID, $BadgeID, false);
|
||||
}
|
||||
}
|
||||
function clearCache($UserIDs, $Label) {
|
||||
G::$DB->query("SELECT max(id) from users_main");
|
||||
list($MaxID) = G::$DB->next_record();
|
||||
for ($i = 1; $i <= $MaxID; $i++) {
|
||||
G::$Cache->delete_value($Label . $i);
|
||||
}
|
||||
}
|
||||
function sendRewardPM($UserIDs, $Invites, $InvitesTime, $Tokens, $TokensTime, $Bonus, $BadgeID) {
|
||||
$BadgeName = "";
|
||||
if ($BadgeID) {
|
||||
$Badge = Badges::get_badges_by_id($BadgeID);
|
||||
$BadgeName = t("server.badges.${Badge['Label']}_badge_name");
|
||||
}
|
||||
foreach ($UserIDs as $UserID) {
|
||||
Misc::send_pm_with_tpl(
|
||||
$UserID,
|
||||
'send_reward',
|
||||
[
|
||||
'Invites' => $Invites,
|
||||
'InvitesTime' => $InvitesTime,
|
||||
'Tokens' => $Tokens,
|
||||
'TokensTime' => $TokensTime,
|
||||
'Bonus' => $Bonus,
|
||||
'BadgeName' => $BadgeName,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!check_perms('users_mod')) {
|
||||
error(403);
|
||||
}
|
||||
@@ -205,20 +109,22 @@ if (isset($_POST['action'])) {
|
||||
error(t('server.common.invalid_param'));
|
||||
}
|
||||
$PM = db_string($_POST['pm']);
|
||||
eventsRewardLog($UserIDs, $InvitesNumbers, $InvitesTime, $TokensNumbers, $TokensTime, $BonusNumbers, $BadgeID, $PM);
|
||||
if (!empty($_POST['tokens_numbers'])) {
|
||||
addTokens($UserIDs, $TokensNumbers, $TokensTime, $SendToLeechDisabled);
|
||||
$RewardInfo = new RewardInfo;
|
||||
$RewardInfo->tokenCount = $TokensNumbers ? $TokensNumbers : 0;
|
||||
$RewardInfo->tokenExpireTime = $TokensTime;
|
||||
$RewardInfo->inviteCount = $InvitesNumbers ? $InvitesNumbers : 0;
|
||||
$RewardInfo->invteExpireTime = $InvitesTime;
|
||||
$RewardInfo->badgeID = $BadgeID ? $BadgeID : 0;
|
||||
$RewardInfo->bonus = $BonusNumbers ? $BonusNumbers : 0;
|
||||
$RewardManager = new Reward;
|
||||
try {
|
||||
$RewardManager->sendReward($RewardInfo, $UserIDs, $PM, true);
|
||||
} catch (InvalidParamException $e) {
|
||||
error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
error_log($e->getMessage());
|
||||
error("internal error");
|
||||
}
|
||||
if (!empty($_POST['invites_numbers'])) {
|
||||
addInvites($UserIDs, $InvitesNumbers, $InvitesTime);
|
||||
}
|
||||
if (!empty($_POST['bonus_numbers'])) {
|
||||
addBonus($UserIDs, $BonusNumbers);
|
||||
}
|
||||
if (!empty($_POST['badgeid'])) {
|
||||
addBadges($UserIDs, $BadgeID);
|
||||
}
|
||||
sendRewardPM($UserIDs, $InvitesNumbers, $InvitesTime, $TokensNumbers, $TokensTime, $BonusNumbers, $BadgeID);
|
||||
header("Location: tools.php?action=events_reward_history");
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -7,41 +7,10 @@ function userIDs2Usernames($UserIDs, $Space) {
|
||||
}
|
||||
return $Usernames;
|
||||
}
|
||||
if (isset($_GET['id'])) {
|
||||
$DB->query("SELECT * from events_reward_log where id=" . intval($_GET['id']));
|
||||
$Recode = $DB->next_record(MYSQLI_ASSOC);
|
||||
?>
|
||||
<h3><?= t('server.tools.userids') ?></h3>
|
||||
<p><?= userIDs2Usernames($Recode['UserIDs'], '<br>') ?></p>
|
||||
<h3><?= t('server.tools.byuserid') ?></h3>
|
||||
<p><?= Users::format_username($Recode['ByUserID']) ?></p>
|
||||
<h3><?= t('server.tools.invites') ?></h3>
|
||||
<p><?= $Recode['Invites'] ?></p>
|
||||
<h3><?= t('server.tools.invitestime') ?></h3>
|
||||
<p><?= $Recode['InvitesTime'] ?></p>
|
||||
<h3><?= t('server.tools.tokens') ?></h3>
|
||||
<p><?= $Recode['Tokens'] ?></p>
|
||||
<h3><?= t('server.tools.tokenstime') ?></h3>
|
||||
<p><?= $Recode['TokensTime'] ?></p>
|
||||
<h3><?= t('server.tools.Bonus') ?></h3>
|
||||
<p><?= $Recode['Bonus'] ?></p>
|
||||
<h3><?= t('server.tools.badge') ?></h3>
|
||||
<p><?
|
||||
if ($Recode['Badge']) {
|
||||
$Badge = Badges::get_badges_by_id($Recode['Badge']);
|
||||
echo t("server.badges.${Badge['Label']}_badge_name");
|
||||
}
|
||||
?></p>
|
||||
<h3><?= t('server.tools.remark') ?></h3>
|
||||
<p><?= $Recode['Remark'] ?></p>
|
||||
<h3><?= t('server.tools.time') ?></h3>
|
||||
<p><?= $Recode['Time'] ?></p>
|
||||
<?
|
||||
exit();
|
||||
}
|
||||
|
||||
const PAGE_COUNT = 50;
|
||||
|
||||
View::show_header(t('server.tools.events_reward_history'));
|
||||
$DB->query("SELECT * from events_reward_log ORDER BY ID DESC");
|
||||
$Histories = $DB->to_array(false, MYSQLI_ASSOC);
|
||||
?>
|
||||
<div class="LayoutPage">
|
||||
<div class="BodyHeader">
|
||||
@@ -50,56 +19,111 @@ $Histories = $DB->to_array(false, MYSQLI_ASSOC);
|
||||
<div class="BodyNavLinks">
|
||||
<div class="center"><a href="tools.php?action=events_reward" class="brackets"><?= t('server.tools.events_reward') ?></a></div>
|
||||
</div>
|
||||
<div class="TableContainer">
|
||||
<table class="TableEventRewardHistory Table">
|
||||
<tr class="Table-rowHeader">
|
||||
<th class="Table-cell"><?= t('server.tools.userids') ?></th>
|
||||
<th class="Table-cell"><?= t('server.tools.byuserid') ?></th>
|
||||
<th class="Table-cell"><?= t('server.tools.events_reward') ?></th>
|
||||
<th class="Table-cell"><?= t('server.tools.remark') ?></th>
|
||||
<th class="Table-cell"><?= t('server.tools.time') ?></th>
|
||||
</tr>
|
||||
<?
|
||||
foreach ($Histories as $Recode) {
|
||||
?>
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell"><?= strlen($Recode['UserIDs']) > 15 ? '<a target="_blank" href="tools.php?action=events_reward_history&id=' . $Recode['ID'] . '">' . t('server.tools.show_all') . '</a>' : userIDs2Usernames($Recode['UserIDs'], ' ') ?></td>
|
||||
<td class="Table-cell"><?= Users::format_username($Recode['ByUserID']) ?></td>
|
||||
<td class="Table-cell"><?
|
||||
$Strs = [];
|
||||
if ($Recode['Invites']) {
|
||||
$Str = t('server.tools.space_invite', ['Count' => $Recode['Invites'], 'Values' => [$Recode['Invites']]]);
|
||||
if ($Recode['InvitesTime']) {
|
||||
$Str .= " (" . substr($Recode['InvitesTime'], 0, 10) . ")";
|
||||
}
|
||||
$Strs[] = $Str;
|
||||
}
|
||||
if ($Recode['Tokens']) {
|
||||
$Str = t('server.tools.space_token', ['Count' => $Recode['Tokens'], 'Values' => [$Recode['Tokens']]]);
|
||||
if ($Recode['TokensTime']) {
|
||||
$Str .= " (" . substr($Recode['TokensTime'], 0, 10) . ")";
|
||||
}
|
||||
$Strs[] = $Str;
|
||||
}
|
||||
if ($Recode['Bonus']) {
|
||||
$Strs[] = $Recode['Bonus'] . t('server.tools.space_bonus');
|
||||
}
|
||||
if ($Recode['Badge']) {
|
||||
$Badge = Badges::get_badges_by_id($Recode['Badge']);
|
||||
$Strs[] = t("server.badges.${Badge['Label']}_badge_name");
|
||||
}
|
||||
if (count($Strs)) {
|
||||
echo implode(", ", $Strs);
|
||||
}
|
||||
?></td>
|
||||
<td class="Table-cell"><?= $Recode['Remark'] ?></td>
|
||||
<td class="Table-cell"><?= $Recode['Time'] ?></td>
|
||||
<?
|
||||
if (isset($_GET['id'])) {
|
||||
$DB->query("SELECT * from events_reward_log where id=" . intval($_GET['id']));
|
||||
$Recode = $DB->next_record(MYSQLI_ASSOC);
|
||||
?>
|
||||
<div class="HtmlText">
|
||||
<h2><?= t('server.tools.userids') ?></h2>
|
||||
<p><?= userIDs2Usernames($Recode['UserIDs'], ', ') ?></p>
|
||||
<h2><?= t('server.tools.byuserid') ?></h2>
|
||||
<p><?= !empty($Recode['ByUserID']) ? Users::format_username($Recode['ByUserID']) : 'System' ?></p>
|
||||
<? if ($Recode['Invites'] > 0) { ?>
|
||||
<h2><?= t('server.tools.invites') ?></h2>
|
||||
<p><?= $Recode['Invites'] ?><?= $Recode['InvitesTime'] ? '(' . $Recode['InvitesTime'] . ')' : '' ?></p>
|
||||
<? } ?>
|
||||
<? if ($Recode['Tokens'] > 0) { ?>
|
||||
<h2><?= t('server.tools.tokens') ?></h2>
|
||||
<p><?= $Recode['Tokens'] ?></p><?= $Recode['TokensTime'] ? '(' . $Recode['TokensTime'] . ')' : '' ?></p>
|
||||
<? } ?>
|
||||
<? if ($Recode['Bonus'] > 0) { ?>
|
||||
<h2><?= t('server.tools.Bonus') ?></h2>
|
||||
<p><?= $Recode['Bonus'] ?></p>
|
||||
<? } ?>
|
||||
<? if ($Recode['Badge']) { ?>
|
||||
<h2><?= t('server.tools.badge') ?></h2>
|
||||
<p>
|
||||
<?
|
||||
$Badge = Badges::get_badges_by_id($Recode['Badge']);
|
||||
echo t("server.badges.${Badge['Label']}_badge_name");
|
||||
?></p>
|
||||
<? } ?>
|
||||
<h2><?= t('server.tools.remark') ?></h2>
|
||||
<p><?= $Recode['Remark'] ?></p>
|
||||
<h2><?= t('server.tools.time') ?></h2>
|
||||
<p><?= $Recode['Time'] ?></p>
|
||||
</div>
|
||||
<?
|
||||
} else {
|
||||
list($Page, $Limit) = Format::page_limit(PAGE_COUNT);
|
||||
$Records = $DB->query("SELECT SQL_CALC_FOUND_ROWS * from events_reward_log ORDER BY ID DESC LIMIT $Limit");
|
||||
$DB->query('SELECT FOUND_ROWS()');
|
||||
list($Results) = $DB->next_record();
|
||||
$Pages = Format::get_pages($Page, $Results, PAGE_COUNT, 5);
|
||||
|
||||
$DB->set_query_id($Records);
|
||||
$Histories = $DB->to_array(false, MYSQLI_ASSOC);
|
||||
?>
|
||||
<div class="BodyNavLinks">
|
||||
<?= $Pages ?>
|
||||
</div>
|
||||
<div class="TableContainer">
|
||||
<table class="TableEventRewardHistory Table">
|
||||
<tr class="Table-rowHeader">
|
||||
<th class="Table-cell"><?= t('server.tools.userids') ?></th>
|
||||
<th class="Table-cell"><?= t('server.tools.byuserid') ?></th>
|
||||
<th class="Table-cell"><?= t('server.tools.events_reward') ?></th>
|
||||
<th class="Table-cell"><?= t('server.tools.remark') ?></th>
|
||||
<th class="Table-cell"><?= t('server.tools.time') ?></th>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
<?
|
||||
foreach ($Histories as $Recode) {
|
||||
?>
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell"><?= strlen($Recode['UserIDs']) > 1 ? '<a target="_blank" href="tools.php?action=events_reward_history&id=' . $Recode['ID'] . '">' . t('server.tools.show_all') . '</a>' : userIDs2Usernames($Recode['UserIDs'], ' ') ?></td>
|
||||
<td class="Table-cell"><?= Users::format_username($Recode['ByUserID']) ?></td>
|
||||
<td class="Table-cell"><?
|
||||
$Strs = [];
|
||||
if ($Recode['Invites']) {
|
||||
$Str = t('server.tools.space_invite', ['Count' => $Recode['Invites'], 'Values' => [$Recode['Invites']]]);
|
||||
if ($Recode['InvitesTime']) {
|
||||
$Str .= " (" . substr($Recode['InvitesTime'], 0, 10) . ")";
|
||||
}
|
||||
$Strs[] = $Str;
|
||||
}
|
||||
if ($Recode['Tokens']) {
|
||||
$Str = t('server.tools.space_token', ['Count' => $Recode['Tokens'], 'Values' => [$Recode['Tokens']]]);
|
||||
if ($Recode['TokensTime']) {
|
||||
$Str .= " (" . substr($Recode['TokensTime'], 0, 10) . ")";
|
||||
}
|
||||
$Strs[] = $Str;
|
||||
}
|
||||
if ($Recode['Bonus']) {
|
||||
$Strs[] = $Recode['Bonus'] . t('server.tools.space_bonus');
|
||||
}
|
||||
if ($Recode['Badge']) {
|
||||
$Badge = Badges::get_badges_by_id($Recode['Badge']);
|
||||
$Strs[] = t("server.badges.${Badge['Label']}_badge_name");
|
||||
}
|
||||
if (count($Strs)) {
|
||||
echo implode(", ", $Strs);
|
||||
}
|
||||
?></td>
|
||||
<td class="Table-cell"><?= $Recode['Remark'] ?></td>
|
||||
<td class="Table-cell"><?= $Recode['Time'] ?></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="BodyNavLinks">
|
||||
<?= $Pages ?>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer()
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
<?php
|
||||
if (!check_perms('users_edit_invites')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['addinvite'])) {
|
||||
authorize();
|
||||
$Invites = intval($_REQUEST['numinvite']);
|
||||
$UserID = false;
|
||||
if (isset($_REQUEST['userid'])) {
|
||||
$UserID = intval($_REQUEST['userid']);
|
||||
if ($UserID <= 0) {
|
||||
error(403);
|
||||
}
|
||||
}
|
||||
if ($Invites <= 0) {
|
||||
error(403);
|
||||
}
|
||||
$Datetime = false;
|
||||
if (isset($_REQUEST['datetime'])) {
|
||||
$Datetime = intval($_REQUEST['datetime']);
|
||||
if ($Datetime <= 0) {
|
||||
error(403);
|
||||
}
|
||||
}
|
||||
$DB->query("UPDATE users_main
|
||||
SET Invites = Invites + $Invites
|
||||
WHERE " . ($UserID ? "ID=$UserID" : "Enabled='1'"));
|
||||
$HasUser = $DB->affected_rows();
|
||||
if ($HasUser) {
|
||||
if ($Datetime) {
|
||||
if ($UserID) {
|
||||
for ($i = 0; $i < $Invites; $i++) {
|
||||
$DB->query("INSERT into invites_typed (`UserID`,`EndTime`,`Type`) VALUES ($UserID, date_add(now(), INTERVAL $Datetime HOUR), 'time');");
|
||||
}
|
||||
$Cache->delete_value('user_info_heavy_' . $UserID);
|
||||
} else {
|
||||
for ($i = 0; $i < $Invites; $i++) {
|
||||
$DB->query("INSERT into invites_typed (`UserID`,`EndTime`,`Type`)
|
||||
select id, date_add(now(), INTERVAL $Datetime HOUR), 'time' from users_main where Enabled='1'");
|
||||
}
|
||||
$DB->query("select max(id) from users_main");
|
||||
list($MaxID) = $DB->next_record();
|
||||
for ($i = 0; $i < $MaxID; $i++) {
|
||||
$Cache->delete_value('user_info_heavy_' . $MaxID);
|
||||
}
|
||||
}
|
||||
}
|
||||
$message = "<strong>已为 " . ($UserID ? Users::format_username($UserID) : "所有启用用户") . " 添加 $Invites 个邀请" . ($Datetime ? ",$Datetime 小时后到期" : "") . "。</strong><br><br>";
|
||||
} else {
|
||||
$message = '<strong>用户不存在</strong><br /><br />';
|
||||
}
|
||||
}
|
||||
View::show_header(t('server.tools.add_invites'));
|
||||
|
||||
?>
|
||||
<div class="BodyHeader">
|
||||
<h2 class="BodyHeader-nav"><?= t('server.tools.add_invites_to_users') ?></h2>
|
||||
</div>
|
||||
<script>
|
||||
function timed() {
|
||||
document.getElementById("datetime").disabled = !document.getElementById("time").checked
|
||||
}
|
||||
|
||||
function user() {
|
||||
document.getElementById("userid").disabled = !document.getElementById("one").checked
|
||||
}
|
||||
</script>
|
||||
<div class="BoxBody" style="margin-left: auto; margin-right: auto; text-align: center; max-width: 40%;">
|
||||
<?= $message ?>
|
||||
<form class="add_form" name="invites" method="post">
|
||||
<input type="hidden" name="action" value="invite" />
|
||||
<input type="hidden" name="auth" value="<?= $LoggedUser['AuthKey'] ?>" />
|
||||
<input id="all" type="radio" name="all" value="all" onclick="user()" checked><label for="all"><?= t('server.tools.all_enabled_users') ?></label>
|
||||
<input id="one" type="radio" name="all" value="one" onclick="user()"><label for="one"><?= t('server.tools.userid') ?></label>
|
||||
<br>
|
||||
<input class="Input" type="number" id="userid" name="userid" size="5" style="text-align: right;" value="0" min="0" disabled />
|
||||
<br><br>
|
||||
<label for="numinvite"><?= t('server.tools.invites') ?>: </label><br>
|
||||
<input class="Input" type="number" id="numinvite" name="numinvite" size="5" style="text-align: right;" value="0" min="0" />
|
||||
<br><br>
|
||||
<div class="Checkbox">
|
||||
<input class="Input" type="checkbox" id="time" onclick="timed()" />
|
||||
<label class="Checkbox-label" for="time"><?= t('server.tools.period_of_validity') ?></label>
|
||||
</div>
|
||||
<br>
|
||||
<input class="Input" type="number" name="datetime" id="datetime" disabled><br><?= t('server.tools.hours') ?>
|
||||
|
||||
<br><br>
|
||||
<input class="Button" type="submit" name="addinvite" value="Add invites" />
|
||||
</form>
|
||||
</div>
|
||||
<?
|
||||
|
||||
View::show_footer()
|
||||
?>
|
||||
@@ -1,103 +0,0 @@
|
||||
<?php
|
||||
if (!check_perms('users_mod')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['addtokens'])) {
|
||||
authorize();
|
||||
$Tokens = $_REQUEST['numtokens'];
|
||||
|
||||
if (!is_number($Tokens) || ($Tokens < 0)) {
|
||||
error('Please enter a valid number of tokens.');
|
||||
}
|
||||
$sql = "
|
||||
UPDATE users_main
|
||||
SET FLTokens = FLTokens + $Tokens
|
||||
WHERE Enabled = '1'";
|
||||
if (!isset($_REQUEST['leechdisabled'])) {
|
||||
$sql .= "
|
||||
AND can_leech = 1";
|
||||
}
|
||||
$DB->query($sql);
|
||||
$sql = "
|
||||
SELECT ID
|
||||
FROM users_main
|
||||
WHERE Enabled = '1'";
|
||||
if (!isset($_REQUEST['leechdisabled'])) {
|
||||
$sql .= "
|
||||
AND can_leech = 1";
|
||||
}
|
||||
$DB->query($sql);
|
||||
while (list($UserID) = $DB->next_record()) {
|
||||
$Cache->delete_value("user_info_heavy_$UserID");
|
||||
}
|
||||
$message = '<strong>' . number_format($Tokens) . 'freeleech tokens added to all enabled users' . (!isset($_REQUEST['leechdisabled']) ? ' with enabled leeching privs' : '') . '.</strong><br /><br />';
|
||||
} elseif (isset($_REQUEST['cleartokens'])) {
|
||||
authorize();
|
||||
$Tokens = $_REQUEST['numtokens'];
|
||||
|
||||
if (!is_number($Tokens) || ($Tokens < 0)) {
|
||||
error('Please enter a valid number of tokens.');
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['onlydrop'])) {
|
||||
$Where = "WHERE FLTokens > $Tokens";
|
||||
} elseif (!isset($_REQUEST['leechdisabled'])) {
|
||||
$Where = "WHERE (Enabled = '1' AND can_leech = 1) OR FLTokens > $Tokens";
|
||||
} else {
|
||||
$Where = "WHERE Enabled = '1' OR FLTokens > $Tokens";
|
||||
}
|
||||
$DB->query("
|
||||
SELECT ID
|
||||
FROM users_main
|
||||
$Where");
|
||||
$Users = $DB->to_array();
|
||||
$DB->query("
|
||||
UPDATE users_main
|
||||
SET FLTokens = $Tokens
|
||||
$Where");
|
||||
|
||||
foreach ($Users as $UserID) {
|
||||
list($UserID) = $UserID;
|
||||
$Cache->delete_value("user_info_heavy_$UserID");
|
||||
}
|
||||
|
||||
$where = '';
|
||||
}
|
||||
|
||||
|
||||
View::show_header(t('server.tools.add_tokens_sitewide'));
|
||||
|
||||
?>
|
||||
<div class="BodyHeader">
|
||||
<h2 class="BodyHeader-nav"><?= t('server.tools.add_fl_tokens_to_all_enabled_users') ?></h2>
|
||||
<div class="BodyNavLinks">
|
||||
<a href="tools.php?action=tokens&showabusers=1" class="brackets"><?= t('server.tools.show_abusers') ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="BoxBody" style="margin-left: auto; margin-right: auto; text-align: center; max-width: 40%;">
|
||||
<?= $message ?>
|
||||
<form class="add_form" name="fltokens" action="" method="post">
|
||||
<input type="hidden" name="action" value="tokens" />
|
||||
<input type="hidden" name="auth" value="<?= $LoggedUser['AuthKey'] ?>" />
|
||||
<?= t('server.tools.tokens_to_add') ?>: <input class="Input" type="text" name="numtokens" size="5" style="text-align: right;" value="0" /><br /><br />
|
||||
<label for="leechdisabled"><?= t('server.tools.grant_tokens_to_leech_disabled_users') ?>: </label><input type="checkbox" id="leechdisabled" name="leechdisabled" value="1" /><br /><br />
|
||||
<input class="Button" type="submit" name="addtokens" value="Add tokens" />
|
||||
</form>
|
||||
</div>
|
||||
<br />
|
||||
<div class="BoxBody" style="margin-left: auto; margin-right: auto; text-align: center; max-width: 40%;">
|
||||
<?= $message ?>
|
||||
<form class="manage_form" name="fltokens" action="" method="post">
|
||||
<input type="hidden" name="action" value="tokens" />
|
||||
<input type="hidden" name="auth" value="<?= $LoggedUser['AuthKey'] ?>" />
|
||||
<?= t('server.tools.tokens_to_set') ?>: <input class="Input" type="text" name="numtokens" size="5" style="text-align: right;" value="0" /><br /><br />
|
||||
<span id="droptokens"><label for="onlydrop"><?= t('server.tools.only_affect_users_with_at_least_this_many_tokens') ?>: </label><input type="checkbox" id="onlydrop" name="onlydrop" value="1" onchange="$('#disabled').gtoggle(); return true;" /></span><br />
|
||||
<span id="disabled"><label for="leechdisabled"><?= t('server.tools.also_add_tokens_to_leech_disabled_users') ?>: </label><input type="checkbox" id="leechdisabled" name="leechdisabled" value="1" onchange="$('#droptokens').gtoggle(); return true;" /></span><br /><br />
|
||||
<input class="Button" type="submit" name="cleartokens" value="Set token total" />
|
||||
</form>
|
||||
</div>
|
||||
<?
|
||||
|
||||
View::show_footer()
|
||||
?>
|
||||
@@ -92,251 +92,4 @@ $HeadTitle = Torrents::torrent_simple_view($TorrentDetail['Group'], $TorrentDeta
|
||||
</form>
|
||||
</div>
|
||||
<?
|
||||
if (check_perms('admin_reports')) {
|
||||
?>
|
||||
<div id="all_reports" style="margin-left: auto; margin-right: auto;">
|
||||
<?
|
||||
include(CONFIG['SERVER_ROOT'] . '/classes/reports.class.php');
|
||||
include(CONFIG['SERVER_ROOT'] . '/classes/reportsv2_type.php');
|
||||
$ReportID = 0;
|
||||
$ReporterID = 0;
|
||||
$DB->query("
|
||||
SELECT
|
||||
tg.Name,
|
||||
tg.SubName,
|
||||
tg.ID,
|
||||
CASE COUNT(ta.GroupID)
|
||||
WHEN 1 THEN aa.ArtistID
|
||||
WHEN 0 THEN '0'
|
||||
ELSE '0'
|
||||
END AS ArtistID,
|
||||
CASE COUNT(ta.GroupID)
|
||||
WHEN 1 THEN aa.Name
|
||||
WHEN 0 THEN ''
|
||||
ELSE 'Various Artists'
|
||||
END AS ArtistName,
|
||||
tg.Year,
|
||||
tg.CategoryID,
|
||||
t.Time,
|
||||
t.RemasterTitle,
|
||||
t.RemasterYear,
|
||||
t.Source,
|
||||
t.Codec,
|
||||
t.Container,
|
||||
t.Resolution,
|
||||
t.Processing,
|
||||
t.Size,
|
||||
t.UserID AS UploaderID,
|
||||
uploader.Username
|
||||
FROM torrents AS t
|
||||
LEFT JOIN torrents_group AS tg ON tg.ID = t.GroupID
|
||||
LEFT JOIN torrents_artists AS ta ON ta.GroupID = tg.ID AND ta.Importance = '1'
|
||||
LEFT JOIN artists_alias AS aa ON aa.ArtistID = ta.ArtistID
|
||||
LEFT JOIN users_main AS uploader ON uploader.ID = t.UserID
|
||||
WHERE t.ID = $TorrentID");
|
||||
|
||||
if (!$DB->has_results()) {
|
||||
die();
|
||||
}
|
||||
$Data = $DB->next_record(MYSQLI_ASSOC, false);
|
||||
list(
|
||||
$GroupName, $SubName, $GroupID, $ArtistID, $ArtistName, $Year, $CategoryID, $Time, $RemasterTitle,
|
||||
$RemasterYear, $Source, $Codec, $Container, $Resolution, $Processing, $Size, $UploaderID, $UploaderName
|
||||
) = array_values($Data);
|
||||
|
||||
$Type = 'dupe'; //hardcoded default
|
||||
|
||||
if (array_key_exists($Type, $Types[$CategoryID])) {
|
||||
$ReportType = $Types[$CategoryID][$Type];
|
||||
} elseif (array_key_exists($Type, $Types['master'])) {
|
||||
$ReportType = $Types['master'][$Type];
|
||||
} else {
|
||||
//There was a type but it wasn't an option!
|
||||
$Type = 'other';
|
||||
$ReportType = $Types['master']['other'];
|
||||
}
|
||||
$TorrentDetail = Torrents::get_torrent($TorrentID);
|
||||
$RawName = Torrents::torrent_name($TorrentDetail, false);
|
||||
$LinkName = "<a href=\"torrents.php?torrentid=$TorrentID\">$RawName</a>";
|
||||
$BBName = "[url=torrents.php?torrentid=$TorrentID] $RawName [/url]";
|
||||
?>
|
||||
<div id="report<?= $ReportID ?>" class="report">
|
||||
<form class="create_form" name="report" id="reportform_<?= $ReportID ?>" action="reports.php" method="post">
|
||||
<?
|
||||
/*
|
||||
* Some of these are for takeresolve, some for the JavaScript.
|
||||
*/
|
||||
?>
|
||||
<div>
|
||||
<input type="hidden" name="auth" value="<?= $LoggedUser['AuthKey'] ?>" />
|
||||
<input type="hidden" id="reportid<?= $ReportID ?>" name="reportid" value="<?= $ReportID ?>" />
|
||||
<input type="hidden" id="torrentid<?= $ReportID ?>" name="torrentid" value="<?= $TorrentID ?>" />
|
||||
<input type="hidden" id="uploader<?= $ReportID ?>" name="uploader" value="<?= $UploaderName ?>" />
|
||||
<input type="hidden" id="uploaderid<?= $ReportID ?>" name="uploaderid" value="<?= $UploaderID ?>" />
|
||||
<input type="hidden" id="reporterid<?= $ReportID ?>" name="reporterid" value="<?= $ReporterID ?>" />
|
||||
<input type="hidden" id="raw_name<?= $ReportID ?>" name="raw_name" value="<?= $RawName ?>" />
|
||||
<input type="hidden" id="type<?= $ReportID ?>" name="type" value="<?= $Type ?>" />
|
||||
<input type="hidden" id="categoryid<?= $ReportID ?>" name="categoryid" value="<?= $CategoryID ?>" />
|
||||
<input type="hidden" id="pm_type<?= $ReportID ?>" name="pm_type" value="Uploader" />
|
||||
<input type="hidden" id="from_delete<?= $ReportID ?>" name="from_delete" value="<?= $GroupID ?>" />
|
||||
</div>
|
||||
<div class="TableContainer">
|
||||
<table cellpadding="5" class="Form-rowList" variant="header">
|
||||
<tr class="Form-rowHeader">
|
||||
<td class="Form-title"><?= t('server.reportsv2.report_a_torrent') ?></td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td colspan="4">
|
||||
<? if ($GroupID) { ?>
|
||||
<? $DB->query("
|
||||
SELECT r.ID
|
||||
FROM reportsv2 AS r
|
||||
LEFT JOIN torrents AS t ON t.ID = r.TorrentID
|
||||
WHERE r.Status != 'Resolved'
|
||||
AND t.GroupID = $GroupID");
|
||||
$GroupOthers = ($DB->has_results());
|
||||
|
||||
if ($GroupOthers > 0) { ?>
|
||||
<div style="text-align: right;">
|
||||
<a href="reportsv2.php?view=group&id=<?= $GroupID ?>">
|
||||
<?= t('server.reportsv2.there_are_n_other_reports_for_torrents_in_this_group', [
|
||||
'Values' => [
|
||||
t('server.reportsv2.there_are_n_other_reports_for_torrents_in_this_group_report', ['Count' => $GroupOthers, 'Values' => [$GroupOthers]]),
|
||||
]
|
||||
]) ?>
|
||||
</a>
|
||||
</div>
|
||||
<? }
|
||||
|
||||
$DB->query("
|
||||
SELECT t.UserID
|
||||
FROM reportsv2 AS r
|
||||
JOIN torrents AS t ON t.ID = r.TorrentID
|
||||
WHERE r.Status != 'Resolved'
|
||||
AND t.UserID = $UploaderID");
|
||||
$UploaderOthers = ($DB->has_results());
|
||||
|
||||
if ($UploaderOthers > 0) { ?>
|
||||
<div style="text-align: right;">
|
||||
<a href="reportsv2.php?view=uploader&id=<?= $UploaderID ?>">
|
||||
<?= t('server.reportsv2.there_are_n_other_reports_for_torrents_uploaded_by_this_user', ['Values' => [
|
||||
t('server.reportsv2.there_are_n_other_reports_for_torrents_uploaded_by_this_user_count', ['Count' => $UploaderOthers, 'Values' => [$UploaderOthers]])
|
||||
]]) ?>
|
||||
</a>
|
||||
</div>
|
||||
<? }
|
||||
|
||||
$DB->query("
|
||||
SELECT DISTINCT req.ID,
|
||||
req.FillerID,
|
||||
um.Username,
|
||||
req.TimeFilled
|
||||
FROM requests AS req
|
||||
JOIN users_main AS um ON um.ID = req.FillerID
|
||||
AND req.TorrentID = $TorrentID");
|
||||
$Requests = ($DB->has_results());
|
||||
if ($Requests > 0) {
|
||||
while (list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
|
||||
?>
|
||||
<div style="text-align: right;">
|
||||
<strong class="u-colorWarning"><a href="user.php?id=<?= $FillerID ?>"><?= $FillerName ?></a> <?= t('server.torrents.used_this_torrent_to_fill') ?> <a href="requests.php?action=viewrequest&id=<?= $RequestID ?>"><?= t('server.torrents.this_request') ?></a> <?= time_diff($FilledTime) ?></strong>
|
||||
</div>
|
||||
<? }
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<? /* END REPORTED STUFF :|: BEGIN MOD STUFF */ ?>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label">
|
||||
<a href="javascript:Load('<?= $ReportID ?>')" data-tooltip="<?= t('server.reportsv2.resolve_title') ?>"><?= t('server.torrents.resolve') ?>:</a>
|
||||
</td>
|
||||
<td class="Form-items" colspan="3">
|
||||
<div class="Form-inputs">
|
||||
<select class="Input" name="resolve_type" id="resolve_type<?= $ReportID ?>" onchange="ChangeResolve(<?= $ReportID ?>);">
|
||||
<?
|
||||
$TypeList = $Types['master'] + $Types[$CategoryID];
|
||||
$Priorities = array();
|
||||
foreach ($TypeList as $Key => $Value) {
|
||||
$Priorities[$Key] = $Value['priority'];
|
||||
}
|
||||
array_multisort($Priorities, SORT_ASC, $TypeList);
|
||||
|
||||
foreach ($TypeList as $IType => $Data) {
|
||||
?>
|
||||
<option class="Select-option" value="<?= $IType ?>" <?= (($Type == $IType) ? ' selected="selected"' : '') ?>><?= $Data['title'] ?></option>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
|
||||
<span id="options<?= $ReportID ?>">
|
||||
|
||||
<span data-tooltip="<?= t('server.torrents.warning_title') ?>">
|
||||
<label for="warning<?= $ReportID ?>"><strong><?= t('server.torrents.warning') ?></strong></label>
|
||||
<select class="Input" name="warning" id="warning<?= $ReportID ?>">
|
||||
<? for ($i = 0; $i < 9; $i++) { ?>
|
||||
<option class="Select-option" value="<?= $i ?>" <?= (($ReportType['resolve_options']['warn'] == $i) ? ' selected="selected"' : '') ?>><?= $i ?></option>
|
||||
<? } ?>
|
||||
</select>
|
||||
</span>
|
||||
|
|
||||
<span data-tooltip="<?= t('server.torrents.delete_title') ?>">
|
||||
<input type="checkbox" name="delete" id="delete<?= $ReportID ?>" <?= ($ReportType['resolve_options']['delete'] ? ' checked="checked"' : '') ?> />
|
||||
<label for="delete<?= $ReportID ?>"><strong><?= t('server.common.delete') ?></strong></label>
|
||||
</span>
|
||||
<?
|
||||
$DB->query("select firsttorrent from users_main where id=$UploaderID and firsttorrent=$TorrentID");
|
||||
$FirstTorrent = $DB->has_results();
|
||||
if ($FirstTorrent) {
|
||||
?>
|
||||
<span data-tooltip="<?= t('server.torrents.first_torrent_title') ?>"><strong class="u-colorWarning"><?= t('server.torrents.first_torrent') ?></strong></span>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
|
|
||||
<span data-tooltip="<?= t('server.torrents.remove_upload_privileges_title') ?>">
|
||||
<input type="checkbox" name="upload" id="upload<?= $ReportID ?>" <?= ($ReportType['resolve_options']['upload'] ? ' checked="checked"' : '') ?> />
|
||||
<label for="upload<?= $ReportID ?>"><strong><?= t('server.torrents.remove_upload_privileges') ?></strong></label>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><?= t('server.torrents.pm_uploader') ?>:</td>
|
||||
<td class="Form-items" colspan="3">
|
||||
<span data-tooltip="<?= t('server.torrents.appended_to_the_regular_message_unless_using_send_now') ?>">
|
||||
<? new TEXTAREA_PREVIEW("uploader_pm", "uploader_pm") ?>
|
||||
</span>
|
||||
<input style="width:100px" class="Button" type="button" value="Send now" onclick="SendPM(<?= $ReportID ?>);" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><strong><?= t('server.torrents.extra') ?></strong><?= t('server.torrents.space_log_message') ?>:</td>
|
||||
<td class="Form-inputs">
|
||||
<input class="Input" type="text" name="log_message" id="log_message<?= $ReportID ?>" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td class="Form-label"><strong><?= t('server.torrents.extra') ?></strong><?= t('server.torrents.space_staff_notes') ?>:</td>
|
||||
<div>
|
||||
<td class="Form-inputs">
|
||||
<input class="Input" type="text" name="admin_message" id="admin_message<?= $ReportID ?>" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Form-row">
|
||||
<td colspan="4" style="text-align: center;">
|
||||
<input class="Button" type="button" value="<?= t('server.common.submit') ?>" onclick="TakeResolve(<?= $ReportID ?>);" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
View::show_footer(); ?>
|
||||
@@ -166,7 +166,7 @@ View::show_header($Title, 'browse,comments,torrent,bbcode,recommend,cover_art,su
|
||||
<?
|
||||
}
|
||||
if (check_perms('site_submit_requests')) { ?>
|
||||
<a href="requests.php?action=new&groupid=<?= $GroupID ?>" class="brackets"><?= t('server.torrents.req_format') ?></a>
|
||||
<a href="requests.php?action=new&type=1&groupid=<?= $GroupID ?>" class="brackets"><?= t('server.torrents.req_format') ?></a>
|
||||
<? } ?>
|
||||
<a href="torrents.php?action=grouplog&groupid=<?= $GroupID ?>" class="brackets"><?= t('server.torrents.viewlog') ?></a>
|
||||
</div>
|
||||
@@ -236,14 +236,16 @@ View::show_header($Title, 'browse,comments,torrent,bbcode,recommend,cover_art,su
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class=" MovieInfo-synopsis" data-tooltip="<?= t('server.torrents.fold_tooltip') ?>">
|
||||
<p class="HtmlText">
|
||||
<?= display_str($WikiBody) ?>
|
||||
</p>
|
||||
<div class="MovieInfo-synopsis">
|
||||
<div class=" HtmlText">
|
||||
<?
|
||||
View::long_text('movie_info_synopsis', display_str($WikiBody), 2);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="MovieInfo-artists u-hideScrollbar">
|
||||
<?
|
||||
for ($i = 0; $i < 10 && $i < count($Actors); $i++) {
|
||||
for ($i = 0; $i < 7 && $i < count($Actors); $i++) {
|
||||
?>
|
||||
<a class="MovieInfo-artist" href="<? echo " artist.php?id=" . $Actors[$i]['ArtistID'] ?>">
|
||||
<img class="MovieInfo-artistPhoto <?= $Actors[$i]['Image'] ? '' : 'default_photo' ?>" src="<?= ImageTools::process($Actors[$i]['Image']) ?>">
|
||||
@@ -1064,6 +1066,9 @@ View::show_header($Title, 'browse,comments,torrent,bbcode,recommend,cover_art,su
|
||||
<span> | </span>
|
||||
<?= t('server.common.requests') ?>
|
||||
</td>
|
||||
<td class="Table-cell">
|
||||
<?= t('server.requests.request_type') ?>
|
||||
</td>
|
||||
<td class="TableRequest-cellVotes Table-cell TableRequest-cellValue"><?= t('server.torrents.votes') ?></td>
|
||||
<td class="TableRequest-cellBounty Table-cell TableRequest-cellValue"><?= t('server.torrents.bounty') ?></td>
|
||||
<td class="Table-cell TableRequest-cellValue">
|
||||
@@ -1072,6 +1077,7 @@ View::show_header($Title, 'browse,comments,torrent,bbcode,recommend,cover_art,su
|
||||
</tr>
|
||||
<? foreach ($Requests as $Request) {
|
||||
$RequestVotes = Requests::get_votes_array($Request['ID']);
|
||||
$RequestType = $Request['RequestType'];
|
||||
|
||||
$CodecString = implode(', ', explode('|', $Request['CodecList']));
|
||||
$SourceString = implode(', ', explode('|', $Request['SourceList']));
|
||||
@@ -1084,6 +1090,9 @@ View::show_header($Title, 'browse,comments,torrent,bbcode,recommend,cover_art,su
|
||||
<a href="requests.php?action=view&id=<?= $Request['ID'] ?>"><?= $CodecString ?> /
|
||||
<?= $SourceString ?> / <?= $ResolutionString ?> / <?= $ContainerString ?></a>
|
||||
</td>
|
||||
<td class="TableRequest-cellType Table-cell">
|
||||
<?= $RequestType == 2 ? t('server.requests.seed_torrent') : t('server.requests.new_torrent') ?>
|
||||
</td>
|
||||
<td class="TableRequest-cellVotes Table-cell TableRequest-cellValue">
|
||||
<span id="vote_count_<?= $Request['ID'] ?>"><?= count($RequestVotes['Voters']) ?></span>
|
||||
<? if (check_perms('site_vote')) { ?>
|
||||
|
||||
@@ -118,59 +118,51 @@ if ($_REQUEST['usetoken'] && in_array($FreeTorrent, [Torrents::Normal, Torrents:
|
||||
// First make sure this isn't already FL, and if it is, do nothing
|
||||
|
||||
if (!Torrents::has_token($TorrentID)) {
|
||||
$TokenUses = ceil($Size / (5 * 1024 * 1024 * 1024));
|
||||
if ($FLTokens < $TokenUses) {
|
||||
$TokenUses = 1;
|
||||
if ($FLTokens < 1) {
|
||||
error(t('server.torrents.error_tokens_not_enough'));
|
||||
}
|
||||
/*
|
||||
if ($Size >= 2147483648) {
|
||||
error('This torrent is too large. Please use the regular DL link.');
|
||||
}
|
||||
*/
|
||||
// Let the tracker know about this
|
||||
if (!Tracker::update_tracker('add_token', array('info_hash' => rawurlencode($InfoHash), 'userid' => $UserID))) {
|
||||
error(t('server.torrents.error_occurred_to_token'));
|
||||
}
|
||||
|
||||
if (!Torrents::has_token($TorrentID)) {
|
||||
$DB->query("
|
||||
INSERT INTO users_freeleeches (UserID, TorrentID, Time)
|
||||
VALUES ($UserID, $TorrentID, NOW())
|
||||
G::$DB->begin_transaction();
|
||||
try {
|
||||
G::$DB->prepared_query("SELECT FLTokens FROM users_main where ID = $UserID");
|
||||
$TokenCount = G::$DB->collect('FLTokens');
|
||||
if ($TokenCount[0] < $TokenUses) {
|
||||
G::$DB->rollback();
|
||||
error(Lang::get('torrents', 'error_tokens_not_enough'));
|
||||
};
|
||||
G::$DB->prepared_query("
|
||||
INSERT INTO users_freeleeches (UserID, TorrentID, Time, Uses)
|
||||
VALUES ($UserID, $TorrentID, NOW(), $TokenUses)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Time = VALUES(Time),
|
||||
Expired = FALSE,
|
||||
Uses = Uses + $TokenUses");
|
||||
$DB->query("
|
||||
G::$DB->prepared_query("
|
||||
INSERT INTO users_freeleeches_time (UserID, TorrentID, Time)
|
||||
VALUES ($UserID, $TorrentID, NOW())");
|
||||
$DB->query("
|
||||
G::$DB->prepared_query("
|
||||
UPDATE users_main
|
||||
SET FLTokens = FLTokens - $TokenUses
|
||||
WHERE ID = $UserID");
|
||||
for ($i = 0; $i < $TokenUses; $i++) {
|
||||
$DB->query(
|
||||
"select ID from (SELECT ID FROM `tokens_typed` WHERE UserID='$UserID' and Type='time' ORDER BY `EndTime`) a
|
||||
union all
|
||||
select ID from (select ID FROM `tokens_typed` WHERE UserID='$UserID' and Type='count') b
|
||||
limit 1"
|
||||
);
|
||||
$UsedTokenID = $DB->collect('ID');
|
||||
if (count($UsedTokenID) > 0) {
|
||||
$DB->query("delete from `tokens_typed` WHERE ID = '$UsedTokenID[0]'");
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Fix for downloadthemall messing with the cached token count
|
||||
$UInfo = Users::user_heavy_info($UserID);
|
||||
$FLTokens = $UInfo['FLTokens'];
|
||||
$TimedTokens = $UInfo['TimedTokens'];
|
||||
$Cache->begin_transaction("user_info_heavy_$UserID");
|
||||
$Cache->update_row(false, array('FLTokens' => ($FLTokens - $TokenUses), 'TimedTokens' => ($TimedTokens >= $TokenUses ? $TimedTokens - $TokenUses : 0)));
|
||||
$Cache->commit_transaction(0);
|
||||
|
||||
$Cache->delete_value("users_tokens_$UserID");
|
||||
G::$DB->prepared_query("DELETE FROM tokens_typed WHERE ID in (SELECT tmp.ID FROM (SELECT ID FROM tokens_typed order by EndTime limit $TokenUses) tmp)");
|
||||
} catch (Exception $e) {
|
||||
error_log($e);
|
||||
G::$DB->rollback();
|
||||
}
|
||||
G::$DB->commit();
|
||||
// Fix for downloadthemall messing with the cached token count
|
||||
$UInfo = Users::user_heavy_info($UserID);
|
||||
$FLTokens = $UInfo['FLTokens'];
|
||||
$TimedTokens = $UInfo['TimedTokens'];
|
||||
$Cache->begin_transaction("user_info_heavy_$UserID");
|
||||
$Cache->update_row(false, array('FLTokens' => ($FLTokens - $TokenUses), 'TimedTokens' => ($TimedTokens >= $TokenUses ? $TimedTokens - $TokenUses : 0)));
|
||||
$Cache->commit_transaction(0);
|
||||
|
||||
$Cache->delete_value("users_tokens_$UserID");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ $Title = Torrents::group_name($Group);
|
||||
<table class="TableGroupHistory Table">
|
||||
<tr class="Table-rowHeader">
|
||||
<td class="Table-cell TableTorrent-cellUploadTime"><?= t('server.torrents.date') ?></td>
|
||||
<td class="Table-cell"><?= t('server.common.torrent') ?></td>
|
||||
<td class="Table-cell TableTorrent-cellID"><?= t('server.common.torrent') ?></td>
|
||||
<td class="Table-cell TableTorrent-cellUserName"><?= t('server.torrents.user') ?></td>
|
||||
<td class="Table-cell"><?= t('server.torrents.info') ?></td>
|
||||
</tr>
|
||||
@@ -30,23 +30,37 @@ $Title = Torrents::group_name($Group);
|
||||
WHERE GroupID = $GroupID
|
||||
ORDER BY Time DESC");
|
||||
$LogEntries = $DB->to_array(false, MYSQLI_NUM);
|
||||
$i = 0;
|
||||
foreach ($LogEntries as $LogEntry) {
|
||||
list($TorrentID, $UserID, $Info, $Time) = $LogEntry;
|
||||
if (strpos($Info, 'deleted') !== false) {
|
||||
$Color = 'red';
|
||||
}
|
||||
if (strpos($Info, 'uploaded ') !== false) {
|
||||
$Color = 'green';
|
||||
}
|
||||
?>
|
||||
<tr class="Table-row">
|
||||
<td class="Table-cell TableTorrent-cellUploadTime"><?= $Time ?></td>
|
||||
<?
|
||||
if ($TorrentID != 0) {
|
||||
?>
|
||||
<td class="Table-cell"><a href="torrents.php?torrentid=<?= $TorrentID ?>"><?= $TorrentID ?></a></td>
|
||||
<td class="Table-cell TableTorrent-cellID"><a href="torrents.php?torrentid=<?= $TorrentID ?>"><?= $TorrentID ?></a></td>
|
||||
<? } else {
|
||||
?>
|
||||
<td class="Table-cell"></td>
|
||||
<? } ?>
|
||||
<td class="Table-cell TableTorrent-cellUserName"><?= Users::format_username($UserID, false, false, false) ?></td>
|
||||
<td class="Table-cell"><?= $Info ?></td>
|
||||
<td class="Table-cell">
|
||||
<span style="color: <?= $Color ?>">
|
||||
<?
|
||||
View::long_text('log_' . $i, $Info, 1);
|
||||
?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
$i++;
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
@@ -103,32 +103,32 @@ HTML;
|
||||
<table class="TableMissing Table" variant="ungroup" id="slot_table">
|
||||
<tr class="Table-rowHeader">
|
||||
<td class="TableMissing-cellName Table-cell"><?= t('server.torrents.name') ?></td>
|
||||
<td class="TableMissing-cellSnatches Table-cell">
|
||||
<td class="TableMissing-cellSnatches Table-cell Table-cellCenter ">
|
||||
<i aria-hidden="true" alt="Snatches" data-tooltip="<?= t('server.common.snatched') ?>">
|
||||
<?= icon("torrent-snatches") ?>
|
||||
</i>
|
||||
</td>
|
||||
<td class="TableMissing-cellRequests Table-cell">
|
||||
<td class="TableMissing-cellRequests Table-cell Table-cellCenter ">
|
||||
<i aria-hidden="true" alt="Request number" data-tooltip="<?= t('server.torrents.request_number') ?>">
|
||||
<?= icon("Table/request-numbers") ?>
|
||||
</i>
|
||||
</td>
|
||||
<td class="TableMissing-cellSDEncode Table-cell" data-tooltip="<?= t('server.torrents.sd_encode_title') ?>">
|
||||
<td class="TableMissing-cellSDEncode Table-cell Table-cellCenter " data-tooltip="<?= t('server.torrents.sd_encode_title') ?>">
|
||||
<?= t('server.torrents.sd_encode') ?>
|
||||
</td>
|
||||
<td class="TableMissing-cellSDUntouched Table-cell" data-tooltip="<?= t('server.torrents.sd_untouched_title') ?>">
|
||||
<td class="TableMissing-cellSDUntouched Table-cell Table-cellCenter " data-tooltip="<?= t('server.torrents.sd_untouched_title') ?>">
|
||||
<?= t('server.torrents.sd_untouched') ?>
|
||||
</td>
|
||||
<td class="TableMissing-cellHDencode Table-cell" data-tooltip="<?= t('server.torrents.hd_encode_title') ?>">
|
||||
<td class="TableMissing-cellHDencode Table-cell Table-cellCenter " data-tooltip="<?= t('server.torrents.hd_encode_title') ?>">
|
||||
<?= t('server.torrents.hd_encode') ?>
|
||||
</td>
|
||||
<td class="TableMissing-cellHDUntouched Table-cell" data-tooltip="<?= t('server.torrents.hd_untouched_title') ?>">
|
||||
<td class="TableMissing-cellHDUntouched Table-cell Table-cellCenter " data-tooltip="<?= t('server.torrents.hd_untouched_title') ?>">
|
||||
<?= t('server.torrents.hd_untouched') ?>
|
||||
</td>
|
||||
<td class="TableMissing-cellUHDEncode Table-cell" data-tooltip="<?= t('server.torrents.uhd_encode_title') ?>">
|
||||
<td class="TableMissing-cellUHDEncode Table-cell Table-cellCenter " data-tooltip="<?= t('server.torrents.uhd_encode_title') ?>">
|
||||
<?= t('server.torrents.uhd_encode') ?>
|
||||
</td>
|
||||
<td class="TableMissing-cellUHDUnTouched Table-cell" data-tooltip="<?= t('server.torrents.uhd_untouched_title') ?>">
|
||||
<td class="TableMissing-cellUHDUnTouched Table-cell Table-cellCenter " data-tooltip="<?= t('server.torrents.uhd_untouched_title') ?>">
|
||||
<?= t('server.torrents.uhd_untouched') ?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -156,7 +156,7 @@ HTML;
|
||||
case TorrentSlot::TorrentSlotStatusFull:
|
||||
// 满的class
|
||||
$SlotStatusClass[$type] = '';
|
||||
$text[$type] = "<span class='u-colorWarning' title = '" . t('server.torrents.slot_status_full') . "'>" . icon('full-filled-circle') . "</span>";
|
||||
$text[$type] = "<span class='u-colorWarning' title = '" . t('server.torrents.slot_status_full') . "'>" . icon('circle') . "</span>";
|
||||
break;
|
||||
case TorrentSlot::TorrentSlotStatusFree:
|
||||
// 有空位的class
|
||||
@@ -166,7 +166,7 @@ HTML;
|
||||
$SlotsTitle .= "<div> " . t('server.torrents.' . TorrentSlot::slot_option_lang($slot)) . "</div>";
|
||||
}
|
||||
$title = t('server.torrents.slots_we_need');
|
||||
$text[$type] = "<span class='u-colorCircle' data-tooltip-html>" . icon('half-filled-circle') .
|
||||
$text[$type] = "<span class='u-colorCircle' data-tooltip-html>" . icon('circle') .
|
||||
"<div data-tooltip-html-content>
|
||||
<div class='title'>$title</div>
|
||||
<div class='content'>$SlotsTitle</div>
|
||||
@@ -182,17 +182,17 @@ HTML;
|
||||
?>
|
||||
<tr class="TableMissing-row Table-row">
|
||||
<td class="TableMissing-cellName Table-cell"><a href="torrents.php?id=<?= $GroupID ?>&view=slot#slot"><?= $GroupName ?><a></td>
|
||||
<td class="TableMissing-cellSnatches Table-cell"><?= $SnatchedCount ?></td>
|
||||
<td class="TableMissing-cellRequests Table-cell"><?= $RequestCount ?></td>
|
||||
<td class="TableMissing-cellSDEncode Table-cell <?= $SlotStatusClass[TorrentSlot::TorrentSlotGroupSDEncode] ?>"><?= $text[TorrentSlot::TorrentSlotGroupSDEncode] ?>
|
||||
<td class="TableMissing-cellSnatches Table-cell Table-cellCenter "><?= $SnatchedCount ?></td>
|
||||
<td class="TableMissing-cellRequests Table-cell Table-cellCenter "><?= $RequestCount ?></td>
|
||||
<td class="TableMissing-cellSDEncode Table-cell Table-cellCenter <?= $SlotStatusClass[TorrentSlot::TorrentSlotGroupSDEncode] ?>"><?= $text[TorrentSlot::TorrentSlotGroupSDEncode] ?>
|
||||
</td>
|
||||
<td class="TableMissing-cellSDUntouched Table-cell <?= $SlotStatusClass[TorrentSlot::TorrentSlotGroupSDUntouched] ?>"><?= $text[TorrentSlot::TorrentSlotGroupSDUntouched] ?>
|
||||
<td class="TableMissing-cellSDUntouched Table-cell Table-cellCenter <?= $SlotStatusClass[TorrentSlot::TorrentSlotGroupSDUntouched] ?>"><?= $text[TorrentSlot::TorrentSlotGroupSDUntouched] ?>
|
||||
</td>
|
||||
<td class="TableMissing-cellHDEncode Table-cell <?= $SlotStatusClass[TorrentSlot::TorrentSlotGroupHDEncode] ?>"><?= $text[TorrentSlot::TorrentSlotGroupHDEncode] ?>
|
||||
<td class="TableMissing-cellHDEncode Table-cell Table-cellCenter <?= $SlotStatusClass[TorrentSlot::TorrentSlotGroupHDEncode] ?>"><?= $text[TorrentSlot::TorrentSlotGroupHDEncode] ?>
|
||||
</td>
|
||||
<td class="TableMissing-cellHDUntouched Table-cell <?= $SlotStatusClass[TorrentSlot::TorrentSlotGroupHDUntouched] ?>"><?= $text[TorrentSlot::TorrentSlotGroupHDUntouched] ?></td>
|
||||
<td class="TableMissing-cellUHDEncode Table-cell <?= $SlotStatusClass[TorrentSlot::TorrentSlotGroupUHDEncode] ?>"><?= $text[TorrentSlot::TorrentSlotGroupUHDEncode] ?></td>
|
||||
<td class="TableMissing-cellUHDUntouched Table-cell <?= $SlotStatusClass[TorrentSlot::TorrentSlotGroupUHDUntouched] ?>"><?= $text[TorrentSlot::TorrentSlotGroupUHDUntouched] ?></td>
|
||||
<td class="TableMissing-cellHDUntouched Table-cell Table-cellCenter <?= $SlotStatusClass[TorrentSlot::TorrentSlotGroupHDUntouched] ?>"><?= $text[TorrentSlot::TorrentSlotGroupHDUntouched] ?></td>
|
||||
<td class="TableMissing-cellUHDEncode Table-cell Table-cellCenter <?= $SlotStatusClass[TorrentSlot::TorrentSlotGroupUHDEncode] ?>"><?= $text[TorrentSlot::TorrentSlotGroupUHDEncode] ?></td>
|
||||
<td class="TableMissing-cellUHDUntouched Table-cell Table-cellCenter <?= $SlotStatusClass[TorrentSlot::TorrentSlotGroupUHDUntouched] ?>"><?= $text[TorrentSlot::TorrentSlotGroupUHDUntouched] ?></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
|
||||
@@ -4,12 +4,16 @@ if (!isset($_GET['torrentid']) || !is_number($_GET['torrentid'])) {
|
||||
}
|
||||
$TorrentID = $_GET['torrentid'];
|
||||
|
||||
$Reports = Torrents::get_reports($TorrentID);
|
||||
|
||||
$Reports = Reports::get_reports($TorrentID);
|
||||
$NumReports = count($Reports);
|
||||
if ($NumReports < 0) {
|
||||
die();
|
||||
}
|
||||
$ReportIDs = array_column($Reports, 'ID');
|
||||
$ReportsMessage = Reports::get_reports_messages($ReportIDs);
|
||||
$Reported = true;
|
||||
$UploaderID = Torrents::get_torrent($TorrentID)['UserID'];
|
||||
include(CONFIG['SERVER_ROOT'] . '/classes/reportsv2_type.php');
|
||||
?>
|
||||
<div class="TorrentDetail-row is-reportList is-block">
|
||||
@@ -17,15 +21,19 @@ include(CONFIG['SERVER_ROOT'] . '/classes/reportsv2_type.php');
|
||||
<?
|
||||
foreach ($Reports as $Report) {
|
||||
$ReportID = $Report['ID'];
|
||||
if (check_perms('admin_reports')) {
|
||||
$ReporterID = $Report['ReporterID'];
|
||||
$ReporterID = $Report['ReporterID'];
|
||||
$IsAdmin = check_perms('admin_reports');
|
||||
if ($IsAdmin) {
|
||||
$Reporter = Users::user_info($ReporterID);
|
||||
$ReporterName = $Reporter['Username'];
|
||||
$ReportLinks = "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> " . t('server.torrents.reported_it');
|
||||
} else {
|
||||
$ReportLinks = t('server.torrents.someone_reported_it');
|
||||
}
|
||||
$UploaderLinks = t('server.torrents.uploader_replied_it');
|
||||
$IsUploader = $LoggedUser['ID'] == $UploaderID;
|
||||
$IsReporter = $LoggedUser['ID'] == $ReporterID;
|
||||
$ReplyLinks = t('server.torrents.reports_replied_it');
|
||||
|
||||
|
||||
if (isset($Types[1][$Report['Type']])) {
|
||||
$ReportType = $Types[1][$Report['Type']];
|
||||
@@ -34,58 +42,67 @@ include(CONFIG['SERVER_ROOT'] . '/classes/reportsv2_type.php');
|
||||
} else {
|
||||
$ReportType = $Types['master']['other'];
|
||||
}
|
||||
$CanReply = $UserID == G::$LoggedUser['ID'] && !$Report['UploaderReply'] && !$ReadOnly;
|
||||
$CanReply = ($IsUploader || $IsReporter || $IsAdmin) && !$ReadOnly;
|
||||
$area = new TEXTAREA_PREVIEW('uploader_reply', '', '', 50, 10, true, true, true, array(
|
||||
'placeholder="' . t('server.torrents.reply_it_patiently') . '"'
|
||||
), false);
|
||||
?>
|
||||
<div class="Box">
|
||||
<div class="Box-header">
|
||||
<a href="reportsv2.php?view=report&id=<?= $Report['ID'] ?>">
|
||||
<?= $ReportType['title'] ?>
|
||||
</a>
|
||||
<div class="Box-headerActions">
|
||||
<? if ($CanReply) {
|
||||
<div class="Box-body BoxList">
|
||||
<div class="BoxBody">
|
||||
<strong>
|
||||
<? if ($ReportAdmin) {
|
||||
?>
|
||||
<a class="report_reply_btn" onclick="$('.can_reply_<?= $ReportID ?>').toggle()" href="javascript:void(0)"><?= t('server.torrents.reply') ?></a>
|
||||
<a href="reportsv2.php?view=report&id=<?= $Report['ID'] ?>">
|
||||
<?= $ReportLinks; ?>
|
||||
</a>
|
||||
<?
|
||||
} else {
|
||||
?>
|
||||
<?= $ReportLinks; ?>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<?= $ReportType['title'] ?>
|
||||
<?= t('server.torrents.at', ['Values' => [time_diff($Report['ReportedTime'], 2, true, true)]])
|
||||
?>
|
||||
</strong>
|
||||
<div style="padding-top:5px;">
|
||||
<?= Text::full_format($Report['UserComment']) ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="Box-body BoxList">
|
||||
|
||||
<? foreach ($ReportsMessage[$ReportID] as $Message) {
|
||||
if ($Message['SenderID'] == $UploaderID) {
|
||||
$Name = t('server.top10.torrents_uploaded');
|
||||
} else if ($Message['SenderID'] == $ReporterID) {
|
||||
$Name = t('server.reportsv2.reporter');
|
||||
} else {
|
||||
$Name = "TM";
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="BoxBody">
|
||||
<strong>
|
||||
<?= $ReportLinks ?>
|
||||
<?= t('server.torrents.at', ['Values' => [time_diff($Report['ReportedTime'], 2, true, true)]])
|
||||
?>
|
||||
</strong>
|
||||
|
||||
|
||||
<strong><?= $Name . ($IsAdmin ? ' ' . Users::format_username($Message['SenderID']) : '') . ' ' . $ReplyLinks . ' ' . time_diff($Message['SentDate'], 2, true, true) ?></strong>
|
||||
<div style="padding-top:5px;">
|
||||
<?= Text::full_format($Report['UserComment']) ?>
|
||||
<?= Text::full_format($Message['Body']) ?>
|
||||
</div>
|
||||
</div>
|
||||
<? if ($Report['UploaderReply']) { ?>
|
||||
<div class="BoxBody">
|
||||
<strong><?= $UploaderLinks . ' ' . time_diff($Report['ReplyTime'], 2, true, true) ?></strong>
|
||||
<div style="padding-top:5px;">
|
||||
<?= Text::full_format($Report['UploaderReply']) ?>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<form class="can_reply_<?= $ReportID ?>" style="display:none;" action="reportsv2.php?action=takeuploaderreply" method="POST">
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<? if ($CanReply) {
|
||||
?>
|
||||
<form class="Form can_reply_<?= $ReportID ?>" action="reportsv2.php?action=takeuploaderreply" method="POST">
|
||||
<input type="hidden" name="reportid" value="<?= $ReportID ?>">
|
||||
<input type="hidden" name="torrentid" value="<?= $TorrentID ?>">
|
||||
<?= $area->getBuffer() ?>
|
||||
<div class="center">
|
||||
<div class="Form-row center">
|
||||
<input class="Button" type="submit">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ $DB->query("
|
||||
UPDATE torrents
|
||||
SET LastReseedRequest = NOW()
|
||||
WHERE ID = '$TorrentID'");
|
||||
$Torrent = TOrrents::get_torrent($TorrentID);
|
||||
|
||||
$usersToNotify = array();
|
||||
|
||||
@@ -45,6 +44,7 @@ if ($DB->has_results()) {
|
||||
}
|
||||
|
||||
$usersToNotify[$UploaderID] = array("uploaded", strtotime($UploadedTime));
|
||||
$Torrent = TOrrents::get_torrent($TorrentID);
|
||||
$Name = Torrents::torrent_name($Torrent, false);
|
||||
|
||||
foreach ($usersToNotify as $UserID => $info) {
|
||||
|
||||
@@ -27,6 +27,7 @@ $DB->query("
|
||||
t.Processing,
|
||||
t.RemasterTitle,
|
||||
t.RemasterYear,
|
||||
t.FilePath,
|
||||
COUNT(x.uid)
|
||||
FROM torrents AS t
|
||||
LEFT JOIN torrents_group AS tg ON tg.ID = t.GroupID
|
||||
@@ -35,8 +36,23 @@ $DB->query("
|
||||
WHERE t.ID = '$TorrentID'");
|
||||
$Data = G::$DB->next_record(MYSQLI_ASSOC, false);
|
||||
list(
|
||||
$UserID, $GroupID, $Size, $InfoHash, $Name, $SubName, $Year, $Time, $Codec, $Source, $Resolution, $Container, $Processing,
|
||||
$RemasterTitle, $RemasterYear, $Snatches
|
||||
$UserID,
|
||||
$GroupID,
|
||||
$Size,
|
||||
$InfoHash,
|
||||
$Name,
|
||||
$SubName,
|
||||
$Year,
|
||||
$Time,
|
||||
$Codec,
|
||||
$Source,
|
||||
$Resolution,
|
||||
$Container,
|
||||
$Processing,
|
||||
$RemasterTitle,
|
||||
$RemasterYear,
|
||||
$FilePath,
|
||||
$Snatches
|
||||
) = array_values($Data);
|
||||
$TorrentDetail = Torrents::get_torrent($TorrentID);
|
||||
$RawName = Torrents::torrent_name($TorrentDetail, false);
|
||||
@@ -58,7 +74,7 @@ Torrents::delete_torrent($TorrentID, $GroupID);
|
||||
$Log = "Torrent $TorrentID ($RawName) (" . strtoupper($InfoHash[1]) . ") was deleted by " . $LoggedUser['Username'] . ': ' . $_POST['reason'] . ' ' . $_POST['extra'];
|
||||
Torrents::send_pm($TorrentID, $UserID, $RawName, $Log, 0, G::$LoggedUser['ID'] != $UserID);
|
||||
Misc::write_log($Log);
|
||||
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], 'deleted torrent (' . number_format($Size / (1024 * 1024), 2) . ' MB, ' . strtoupper($InfoHash[1]) . ') for reason: ' . $_POST['reason'] . ' ' . $_POST['extra'], 0);
|
||||
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], 'deleted ' . $FilePath . ' (' . number_format($Size / (1024 * 1024 * 1024), 2) . ' GB) for reason: ' . $_POST['reason'] . ' ' . $_POST['extra'], 0);
|
||||
|
||||
View::show_header(t('server.torrents.torrent_deleted'), '', 'PageTorrentTakeDelete');
|
||||
?>
|
||||
|
||||
@@ -351,6 +351,7 @@ Misc::write_log("Torrent $TorrentID in group $GroupID was edited by " . $LoggedU
|
||||
if ($LogDetails) {
|
||||
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], $LogDetails, 0);
|
||||
}
|
||||
|
||||
$Cache->delete_value("torrents_details_$GroupID");
|
||||
$Cache->delete_value("torrent_download_$TorrentID");
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?
|
||||
|
||||
use Gazelle\Manager\ActionTrigger;
|
||||
|
||||
authorize();
|
||||
|
||||
// Quick SQL injection check
|
||||
@@ -151,8 +154,8 @@ $DB->query(
|
||||
SubName = '$SubName'
|
||||
WHERE ID='$GroupID'"
|
||||
);
|
||||
|
||||
|
||||
$trigger = new ActionTrigger;
|
||||
$trigger->triggerMovieEdit($GroupID);
|
||||
Torrents::update_movie_info($GroupID, $IMDBID, $DoubanID, true);
|
||||
Torrents::update_hash($GroupID);
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Gazelle\Manager\ActionTrigger;
|
||||
|
||||
if (empty($_GET['torrentid'])) {
|
||||
error(403);
|
||||
}
|
||||
@@ -41,4 +43,6 @@ G::$Cache->delete_value("torrent_group_$GroupID");
|
||||
G::$Cache->delete_value("torrents_details_$GroupID");
|
||||
$DB->query("insert into torrents_check (UserID, TorrentID, Type) values (" . $LoggedUser['ID'] . ", $TorrentID, " . ($Checked ? "1" : "0") . ")");
|
||||
Misc::write_log("Torrent $TorrentID was " . ($Checked ? "" : "un") . "checked by " . $LoggedUser['Username']);
|
||||
$trigger = new ActionTrigger;
|
||||
$trigger->triggerTorrentCheck($TorrentID);
|
||||
echo json_encode(array('ret' => 'success'));
|
||||
|
||||
@@ -28,8 +28,12 @@ $TorrentID = $uploadedTorrent->TorrentID;
|
||||
if (!$uploadedTorrent->$IsPrivate) {
|
||||
View::show_header(t('server.upload.header_warning'), '', 'PageUploadHandle');
|
||||
?>
|
||||
<h1><?= t('server.upload.upload_handle_warning') ?></h1>
|
||||
<p><?= t('server.upload.need_download_new_torrent1') ?><a href="torrents.php?id=<?= $GroupID ?>&torrentid=<?= $TorrentID ?>"><?= t('server.upload.here') ?></a><?= t('server.upload.need_download_new_torrent2') ?></p>
|
||||
<div class="LayoutBody">
|
||||
<div class="BodyHeader">
|
||||
<div class="BodyHeader-nav"><?= t('server.upload.upload_handle_warning') ?></div>
|
||||
</div>
|
||||
<p><?= t('server.upload.need_download_new_torrent1') ?><a href="torrents.php?id=<?= $GroupID ?>&torrentid=<?= $TorrentID ?>"><?= t('server.upload.here') ?></a><?= t('server.upload.need_download_new_torrent2') ?></p>
|
||||
</div>
|
||||
<? View::show_footer();
|
||||
} elseif ($uploadedTorrent->RequestID) {
|
||||
header("Location: requests.php?action=takefill&requestid=$RequestID&torrentid=$TorrentID&auth=" . $LoggedUser['AuthKey']);
|
||||
|
||||
@@ -366,7 +366,8 @@ $NotifyOnDeleteSeeding = (!empty($_POST['notifyondeleteseeding']) ? 1 : 0);
|
||||
$NotifyOnDeleteSnatched = (!empty($_POST['notifyondeletesnatched']) ? 1 : 0);
|
||||
$NotifyOnDeleteDownloaded = (!empty($_POST['notifyondeletedownloaded']) ? 1 : 0);
|
||||
|
||||
Donations::update_rewards($UserID);
|
||||
$donation = new Donation;
|
||||
$donation->updateReward($UserID);
|
||||
NotificationsManager::save_settings($UserID);
|
||||
|
||||
// Information on how the user likes to download torrents is stored in cache
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user