71 lines
3.1 KiB
PHP
71 lines
3.1 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../seria.php';
|
|
|
|
if(!$sUserInfo->isLoggedIn()) {
|
|
http_response_code(403);
|
|
die('You must be logged in to view this page.');
|
|
}
|
|
|
|
$pUserName = (string)filter_input(INPUT_GET, 'name');
|
|
|
|
try {
|
|
$pUserInfo = SeriaUser::byName($pdo, $pUserName);
|
|
} catch(SeriaUserNotFoundException $ex) {
|
|
http_response_code(404);
|
|
die('User not found.');
|
|
}
|
|
|
|
$pTransferCount = $pUserInfo->getActiveTransferCounts();
|
|
$pTransferRatio = $pUserInfo->calculateRatio();
|
|
|
|
$tPageTitle = $pUserInfo->getName();
|
|
|
|
require_once __DIR__ . '/_header.php';
|
|
|
|
echo '<div class="profile" style="--user-colour:' . (string)$pUserInfo->getColour() . '" id="p' . $pUserInfo->getId() . '">';
|
|
|
|
|
|
echo '<div class="profile-header" id="p' . $pUserInfo->getId() . 'h">';
|
|
echo '<div class="avatar profile-header-avatar"><img src="' . sprintf(SERIA_AVATAR_FORMAT_RES, $pUserInfo->getId(), 200) . '" alt="" width="100" height="100" /></div>';
|
|
echo '<div class="profile-header-info">';
|
|
echo '<div class="profile-header-info-name"><span>' . $pUserInfo->getName() . '</span></div>';
|
|
echo '<div class="profile-header-info-flashii"><a href="' . sprintf(SERIA_PROFILE_FORMAT, $pUserInfo->getId()) . '">View full profile on ' . SERIA_FLASHIINET . '</a></div>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
|
|
|
|
echo '<div class="profile-transfer" id="p' . $pUserInfo->getId() . 'r">';
|
|
|
|
echo '<a href="/history.php?name=' . $pUserInfo->getName() . '">Ratio <span style="color: ' . seria_ratio_colour($pTransferRatio) . ';">' . number_format($pTransferRatio, 3) . '</span></a>';
|
|
echo '<a href="/history.php?name=' . $pUserInfo->getName() . '&filter=uploaded"><span style="color: green;">Uploaded</span> ' . byte_symbol($pUserInfo->getBytesUploaded()) . '</a>';
|
|
echo '<a href="/history.php?name=' . $pUserInfo->getName() . '&filter=downloaded"><span style="color: red;">Downloaded</span> ' . byte_symbol($pUserInfo->getBytesDownloaded()) . '</a>';
|
|
echo '<a href="/history.php?name=' . $pUserInfo->getName() . '&filter=uploading"><span style="color: green;">Seeding</span> ' . number_format($pTransferCount->user_uploading) . '</a>';
|
|
echo '<a href="/history.php?name=' . $pUserInfo->getName() . '&filter=downloading"><span style="color: red;">Leeching</span> ' . number_format($pTransferCount->user_downloading) . '</a>';
|
|
|
|
echo '</div>';
|
|
|
|
$pSubmissions = $pUserInfo->getProfileSubmissions();
|
|
|
|
if(!empty($pSubmissions)) {
|
|
echo '<div class="profile-submissions" id="p' . $pUserInfo->getId() . 's">';
|
|
echo '<div class="profile-submissions-header">Latest Submissions</div>';
|
|
|
|
foreach($pSubmissions as $submission)
|
|
echo $submission->toHTML($sUserInfo, 'profile-submission', false);
|
|
|
|
echo '<div class="profile-submissions-full"><a href="/available.php?name=' . $pUserInfo->getName() . '">View all submissions</a></div>';
|
|
echo '</div>';
|
|
}
|
|
|
|
|
|
echo '<div class="profile-history" id="p' . $pUserInfo->getId() . 't">';
|
|
echo '<div class="profile-history-header">Latest Transfers</div>';
|
|
|
|
echo 'todo: keep track of this';
|
|
|
|
echo '<div class="profile-history-full"><a href="/history.php?name=' . $pUserInfo->getName() . '">View full transfer history</a></div>';
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
|
|
require_once __DIR__ . '/_footer.php';
|