ghost
1 year ago
7 changed files with 0 additions and 3625 deletions
@ -1,670 +0,0 @@
@@ -1,670 +0,0 @@
|
||||
<?php |
||||
|
||||
// Bootstrap |
||||
require_once __DIR__ . '/../config/bootstrap.php'; |
||||
|
||||
// Define response |
||||
$response = (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => _('Internal server error'), |
||||
'title' => sprintf(_('Oops - %s'), WEBSITE_NAME) |
||||
]; |
||||
|
||||
// Begin action request |
||||
switch (isset($_GET['target']) ? urldecode($_GET['target']) : false) |
||||
{ |
||||
case 'profile': |
||||
|
||||
switch (isset($_GET['toggle']) ? $_GET['toggle'] : false) |
||||
{ |
||||
case 'jidenticon': |
||||
|
||||
// Yggdrasil connections only |
||||
if (!Valid::host($_SERVER['REMOTE_ADDR'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Yggdrasil connection required for this action'); |
||||
} |
||||
|
||||
// Init session |
||||
else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user session'); |
||||
} |
||||
|
||||
// Get user |
||||
else if (!$user = $db->getUser($userId)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user info'); |
||||
} |
||||
|
||||
// On first visit, redirect user to the welcome page with access level question |
||||
else if (is_null($user->public)) |
||||
{ |
||||
header( |
||||
sprintf('Location: %s/welcome.php', WEBSITE_URL) |
||||
); |
||||
} |
||||
|
||||
// Render icon |
||||
else |
||||
{ |
||||
header('Cache-Control: max-age=604800'); |
||||
|
||||
|
||||
$icon = new Jdenticon\Identicon(); |
||||
|
||||
$icon->setValue($user->{USER_IDENTICON_FIELD}); |
||||
$icon->setSize(empty($_GET['size']) ? 100 : (int) $_GET['size']); |
||||
$icon->setStyle( |
||||
[ |
||||
'backgroundColor' => 'rgba(255, 255, 255, 0)', |
||||
] |
||||
); |
||||
$icon->displayImage('webp'); |
||||
} |
||||
|
||||
break; |
||||
} |
||||
|
||||
break; |
||||
|
||||
case 'comment': |
||||
|
||||
switch (isset($_GET['toggle']) ? $_GET['toggle'] : false) |
||||
{ |
||||
case 'approved': |
||||
|
||||
// Yggdrasil connections only |
||||
if (!Valid::host($_SERVER['REMOTE_ADDR'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Yggdrasil connection required for this action'); |
||||
} |
||||
|
||||
// Init session |
||||
else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user session'); |
||||
} |
||||
|
||||
// Get user |
||||
else if (!$user = $db->getUser($userId)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user info'); |
||||
} |
||||
|
||||
// On first visit, redirect user to the welcome page with access level question |
||||
else if (is_null($user->public)) |
||||
{ |
||||
header( |
||||
sprintf('Location: %s/welcome.php', WEBSITE_URL) |
||||
); |
||||
} |
||||
|
||||
// Magnet comment exists |
||||
else if (!$magnetComment = $db->getMagnetComment(isset($_GET['magnetCommentId']) && $_GET['magnetCommentId'] > 0 ? (int) $_GET['magnetCommentId'] : 0)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Requested magnet comment not found'); |
||||
} |
||||
|
||||
// Access allowed |
||||
else if (!in_array($user->address, MODERATOR_IP_LIST)) { |
||||
|
||||
$response->success = false; |
||||
$response->message = _('Access denied'); |
||||
} |
||||
|
||||
// Validate callback |
||||
else if (empty($_GET['callback'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Callback required'); |
||||
} |
||||
|
||||
// Validate base64 |
||||
else if (!$callback = (string) @base64_decode($_GET['callback'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Invalid callback encoding'); |
||||
} |
||||
|
||||
// Request valid |
||||
else |
||||
{ |
||||
if ($magnetComment->approved) |
||||
{ |
||||
$db->updateMagnetCommentApproved($magnetComment->magnetCommentId, false); |
||||
|
||||
if (USER_AUTO_APPROVE_ON_COMMENT_APPROVE) |
||||
{ |
||||
$db->updateUserApproved($magnetComment->userId, false, time()); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
$db->updateMagnetCommentApproved($magnetComment->magnetCommentId, true); |
||||
|
||||
if (USER_AUTO_APPROVE_ON_COMMENT_APPROVE) |
||||
{ |
||||
$db->updateUserApproved($magnetComment->userId, true, time()); |
||||
} |
||||
} |
||||
|
||||
// Redirect to edit page |
||||
header( |
||||
sprintf('Location: %s', $callback) |
||||
); |
||||
} |
||||
|
||||
break; |
||||
|
||||
case 'new': |
||||
|
||||
// Yggdrasil connections only |
||||
if (!Valid::host($_SERVER['REMOTE_ADDR'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Yggdrasil connection required for this action'); |
||||
} |
||||
|
||||
// Init session |
||||
else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user session'); |
||||
} |
||||
|
||||
// Get user |
||||
else if (!$user = $db->getUser($userId)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user info'); |
||||
} |
||||
|
||||
// On first visit, redirect user to the welcome page with access level question |
||||
else if (is_null($user->public)) |
||||
{ |
||||
header( |
||||
sprintf('Location: %s/welcome.php', WEBSITE_URL) |
||||
); |
||||
} |
||||
|
||||
// Magnet exists |
||||
else if (!$magnet = $db->getMagnet(isset($_GET['magnetId']) && $_GET['magnetId'] > 0 ? (int) $_GET['magnetId'] : 0)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Requested magnet not found'); |
||||
} |
||||
|
||||
// Access allowed |
||||
else if (!($user->address == $db->getUser($magnet->userId)->address || in_array($user->address, MODERATOR_IP_LIST) || ($magnet->public && $magnet->approved))) { |
||||
|
||||
$response->success = false; |
||||
$response->message = _('Magnet not available for this action'); |
||||
} |
||||
|
||||
// Validate callback |
||||
else if (empty($_GET['callback'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Callback required'); |
||||
} |
||||
|
||||
// Validate base64 |
||||
else if (!$callback = (string) @base64_decode($_GET['callback'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Invalid callback encoding'); |
||||
} |
||||
|
||||
// Validate comment value |
||||
else if (empty($_POST['comment']) || |
||||
mb_strlen($_POST['comment']) < MAGNET_COMMENT_MIN_LENGTH || |
||||
mb_strlen($_POST['comment']) > MAGNET_COMMENT_MAX_LENGTH) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = sprintf(_('Valid comment value required, %s-%s chars allowed'), MAGNET_COMMENT_MIN_LENGTH, MAGNET_COMMENT_MAX_LENGTH); |
||||
} |
||||
|
||||
// Request valid |
||||
else |
||||
{ |
||||
if ($magnetCommentId = $db->addMagnetComment($magnet->magnetId, |
||||
$user->userId, |
||||
null, // @TODO implement threads |
||||
trim($_POST['comment']), |
||||
$user->approved || in_array($user->address, MODERATOR_IP_LIST) ? true : MAGNET_COMMENT_DEFAULT_APPROVED, |
||||
MAGNET_COMMENT_DEFAULT_PUBLIC, |
||||
time())) |
||||
{ |
||||
|
||||
// Push event to other nodes |
||||
if (API_EXPORT_ENABLED && |
||||
API_EXPORT_PUSH_ENABLED && |
||||
API_EXPORT_USERS_ENABLED && |
||||
API_EXPORT_MAGNETS_ENABLED && |
||||
API_EXPORT_MAGNET_COMMENTS_ENABLED) |
||||
{ |
||||
if (!$memoryApiExportPush = $memory->get('api.export.push')) |
||||
{ |
||||
$memoryApiExportPush = []; |
||||
} |
||||
|
||||
$memoryApiExportPush[] = (object) |
||||
[ |
||||
'time' => time(), |
||||
'userId' => $user->userId, |
||||
'magnetId' => $magnet->magnetId, |
||||
'magnetCommentId' => $magnetCommentId |
||||
]; |
||||
|
||||
$memory->set('api.export.push', $memoryApiExportPush, 3600); |
||||
} |
||||
|
||||
// Redirect to referrer page |
||||
header( |
||||
sprintf('Location: %s#comment-%s', $callback, $magnetCommentId) |
||||
); |
||||
} |
||||
} |
||||
|
||||
break; |
||||
|
||||
default: |
||||
|
||||
header( |
||||
sprintf('Location: %s', WEBSITE_URL) |
||||
); |
||||
} |
||||
|
||||
break; |
||||
|
||||
case 'magnet': |
||||
|
||||
switch (isset($_GET['toggle']) ? $_GET['toggle'] : false) |
||||
{ |
||||
case 'star': |
||||
|
||||
// Yggdrasil connections only |
||||
if (!Valid::host($_SERVER['REMOTE_ADDR'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Yggdrasil connection required for this action'); |
||||
} |
||||
|
||||
// Init session |
||||
else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user session'); |
||||
} |
||||
|
||||
// Get user |
||||
else if (!$user = $db->getUser($userId)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user info'); |
||||
} |
||||
|
||||
// On first visit, redirect user to the welcome page with access level question |
||||
else if (is_null($user->public)) |
||||
{ |
||||
header( |
||||
sprintf('Location: %s/welcome.php', WEBSITE_URL) |
||||
); |
||||
} |
||||
|
||||
// Magnet exists |
||||
else if (!$magnet = $db->getMagnet(isset($_GET['magnetId']) && $_GET['magnetId'] > 0 ? (int) $_GET['magnetId'] : 0)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Requested magnet not found'); |
||||
} |
||||
|
||||
// Access allowed |
||||
else if (!($_SERVER['REMOTE_ADDR'] == $db->getUser($magnet->userId)->address || in_array($_SERVER['REMOTE_ADDR'], MODERATOR_IP_LIST) || ($magnet->public && $magnet->approved))) { |
||||
|
||||
$response->success = false; |
||||
$response->message = _('Magnet not available for this action'); |
||||
} |
||||
|
||||
// Validate callback |
||||
else if (empty($_GET['callback'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Callback required'); |
||||
} |
||||
|
||||
// Validate base64 |
||||
else if (!$callback = (string) @base64_decode($_GET['callback'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Invalid callback encoding'); |
||||
} |
||||
|
||||
// Request valid |
||||
else |
||||
{ |
||||
// Save star |
||||
if ($magnetStarId = $db->addMagnetStar( $magnet->magnetId, |
||||
$user->userId, |
||||
!$db->findLastMagnetStarValue($magnet->magnetId, $user->userId), |
||||
time())) |
||||
{ |
||||
// Push event to other nodes |
||||
if (API_EXPORT_ENABLED && |
||||
API_EXPORT_PUSH_ENABLED && |
||||
API_EXPORT_USERS_ENABLED && |
||||
API_EXPORT_MAGNETS_ENABLED && |
||||
API_EXPORT_MAGNET_STARS_ENABLED) |
||||
{ |
||||
if (!$memoryApiExportPush = $memory->get('api.export.push')) |
||||
{ |
||||
$memoryApiExportPush = []; |
||||
} |
||||
|
||||
$memoryApiExportPush[] = (object) |
||||
[ |
||||
'time' => time(), |
||||
'userId' => $user->userId, |
||||
'magnetId' => $magnet->magnetId, |
||||
'magnetStarId' => $magnetStarId |
||||
]; |
||||
|
||||
$memory->set('api.export.push', $memoryApiExportPush, 3600); |
||||
} |
||||
|
||||
// Redirect to edit page |
||||
header( |
||||
sprintf('Location: %s', $callback) |
||||
); |
||||
} |
||||
} |
||||
|
||||
break; |
||||
|
||||
case 'new': |
||||
|
||||
// Yggdrasil connections only |
||||
if (!Valid::host($_SERVER['REMOTE_ADDR'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Yggdrasil connection required for this action'); |
||||
} |
||||
|
||||
// Init session |
||||
else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user session'); |
||||
} |
||||
|
||||
// Get user |
||||
else if (!$user = $db->getUser($userId)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user info'); |
||||
} |
||||
|
||||
// On first visit, redirect user to the welcome page with access level question |
||||
else if (is_null($user->public)) |
||||
{ |
||||
header( |
||||
sprintf('Location: %s/welcome.php', WEBSITE_URL) |
||||
); |
||||
} |
||||
|
||||
// Validate link |
||||
if (empty($_GET['magnet'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Link required'); |
||||
} |
||||
|
||||
// Validate magnet |
||||
else if (!$magnet = Yggverse\Parser\Magnet::parse($_GET['magnet'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Invalid magnet link'); |
||||
} |
||||
|
||||
// Request valid |
||||
else |
||||
{ |
||||
// Begin magnet registration |
||||
try |
||||
{ |
||||
$db->beginTransaction(); |
||||
|
||||
// Init magnet |
||||
if ($magnetId = $db->addMagnet( $user->userId, |
||||
$magnet->xl, |
||||
$magnet->dn, |
||||
'', // @TODO deprecated, remove |
||||
MAGNET_DEFAULT_PUBLIC, |
||||
MAGNET_DEFAULT_COMMENTS, |
||||
MAGNET_DEFAULT_SENSITIVE, |
||||
$user->approved ? true : MAGNET_DEFAULT_APPROVED, |
||||
time())) |
||||
{ |
||||
foreach ($magnet as $key => $value) |
||||
{ |
||||
switch ($key) |
||||
{ |
||||
case 'xt': |
||||
foreach ($value as $xt) |
||||
{ |
||||
if (Yggverse\Parser\Magnet::isXTv1($xt)) |
||||
{ |
||||
$db->addMagnetToInfoHash( |
||||
$magnetId, |
||||
$db->initInfoHashId( |
||||
Yggverse\Parser\Magnet::filterInfoHash($xt), 1 |
||||
) |
||||
); |
||||
} |
||||
if (Yggverse\Parser\Magnet::isXTv2($xt)) |
||||
{ |
||||
$db->addMagnetToInfoHash( |
||||
$magnetId, |
||||
$db->initInfoHashId( |
||||
Yggverse\Parser\Magnet::filterInfoHash($xt), 2 |
||||
) |
||||
); |
||||
} |
||||
} |
||||
break; |
||||
case 'tr': |
||||
foreach ($value as $tr) |
||||
{ |
||||
if (Valid::url($tr)) |
||||
{ |
||||
if ($url = Yggverse\Parser\Url::parse($tr)) |
||||
{ |
||||
$db->initMagnetToAddressTrackerId( |
||||
$magnetId, |
||||
$db->initAddressTrackerId( |
||||
$db->initSchemeId($url->host->scheme), |
||||
$db->initHostId($url->host->name), |
||||
$db->initPortId($url->host->port), |
||||
$db->initUriId($url->page->uri) |
||||
) |
||||
); |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
case 'ws': |
||||
foreach ($value as $ws) |
||||
{ |
||||
// @TODO |
||||
} |
||||
break; |
||||
case 'as': |
||||
foreach ($value as $as) |
||||
{ |
||||
if (Valid::url($as)) |
||||
{ |
||||
if ($url = Yggverse\Parser\Url::parse($as)) |
||||
{ |
||||
$db->initMagnetToAcceptableSourceId( |
||||
$magnetId, |
||||
$db->initAcceptableSourceId( |
||||
$db->initSchemeId($url->host->scheme), |
||||
$db->initHostId($url->host->name), |
||||
$db->initPortId($url->host->port), |
||||
$db->initUriId($url->page->uri) |
||||
) |
||||
); |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
case 'xs': |
||||
foreach ($value as $xs) |
||||
{ |
||||
if (Valid::url($xs)) |
||||
{ |
||||
if ($url = Yggverse\Parser\Url::parse($xs)) |
||||
{ |
||||
$db->initMagnetToExactSourceId( |
||||
$magnetId, |
||||
$db->initExactSourceId( |
||||
$db->initSchemeId($url->host->scheme), |
||||
$db->initHostId($url->host->name), |
||||
$db->initPortId($url->host->port), |
||||
$db->initUriId($url->page->uri) |
||||
) |
||||
); |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
case 'mt': |
||||
foreach ($value as $mt) |
||||
{ |
||||
// @TODO |
||||
} |
||||
break; |
||||
case 'x.pe': |
||||
foreach ($value as $xPe) |
||||
{ |
||||
// @TODO |
||||
} |
||||
break; |
||||
case 'kt': |
||||
foreach ($value as $kt) |
||||
{ |
||||
$db->initMagnetToKeywordTopicId( |
||||
$magnetId, |
||||
$db->initKeywordTopicId(trim(mb_strtolower(strip_tags(html_entity_decode($kt))))) |
||||
); |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
|
||||
$db->commit(); |
||||
|
||||
// Redirect to edit page |
||||
header(sprintf('Location: %s/edit.php?magnetId=%s', trim(WEBSITE_URL, '/'), $magnetId)); |
||||
} |
||||
|
||||
} catch (Exception $e) { |
||||
|
||||
var_dump($e); |
||||
|
||||
$db->rollBack(); |
||||
} |
||||
} |
||||
|
||||
break; |
||||
} |
||||
|
||||
break; |
||||
} |
||||
|
||||
?> |
||||
|
||||
<!DOCTYPE html> |
||||
<html lang="en-US"> |
||||
<head> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/common.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/framework.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<title> |
||||
<?php echo $response->title ?> |
||||
</title> |
||||
<meta name="robots" content="noindex,nofollow"/> |
||||
<meta name="author" content="YGGtracker" /> |
||||
<meta charset="UTF-8" /> |
||||
</head> |
||||
<body> |
||||
<header> |
||||
<div class="container"> |
||||
<div class="row margin-t-8 text-center"> |
||||
<a class="logo" href="<?php echo WEBSITE_URL ?>"><?php echo str_replace('YGG', '<span>YGG</span>', WEBSITE_NAME) ?></a> |
||||
<form class="margin-t-8" name="search" method="get" action="<?php echo WEBSITE_URL ?>/index.php"> |
||||
<input type="text" name="query" value="" placeholder="<?php echo _('search or submit magnet link') ?>" /> |
||||
<input type="submit" value="<?php echo _('submit') ?>" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</header> |
||||
<main> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100"> |
||||
<div class="padding-16 margin-y-8 border-radius-3 background-color-night"> |
||||
<div class="text-center"><?php echo $response->message ?></div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<?php if (!empty($_SERVER['HTTP_REFERER']) && false !== strpos($_SERVER['HTTP_REFERER'], WEBSITE_URL)) { ?> |
||||
<div class="row"> |
||||
<div class="column width-100 text-right"> |
||||
<a class="button margin-l-8" |
||||
rel="nofollow" |
||||
href="<?php echo $_SERVER['HTTP_REFERER'] ?>"> |
||||
<?php echo _('back') ?> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
<?php } ?> |
||||
</div> |
||||
</main> |
||||
<footer> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100 text-center margin-y-8"> |
||||
<?php foreach (json_decode(file_get_contents(__DIR__ . '/../config/trackers.json')) as $i => $tracker) { ?> |
||||
<?php if (!empty($tracker->announce) && !empty($tracker->stats)) { ?> |
||||
<a href="<?php echo $tracker->announce ?>"><?php echo sprintf('Tracker %s', $i + 1) ?></a> |
||||
/ |
||||
<a href="<?php echo $tracker->stats ?>"><?php echo _('Stats') ?></a> |
||||
| |
||||
<?php } ?> |
||||
<?php } ?> |
||||
<a href="<?php echo WEBSITE_URL ?>/faq.php"><?php echo _('F.A.Q') ?></a> |
||||
| |
||||
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss"><?php echo _('RSS') ?></a> |
||||
<?php if (API_EXPORT_ENABLED) { ?> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a> |
||||
<?php } ?> |
||||
| |
||||
<a href="https://github.com/YGGverse/YGGtracker"><?php echo _('GitHub') ?></a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</footer> |
||||
</body> |
||||
</html> |
@ -1,335 +0,0 @@
@@ -1,335 +0,0 @@
|
||||
<?php |
||||
|
||||
// Bootstrap |
||||
require_once __DIR__ . '/../config/bootstrap.php'; |
||||
|
||||
// Define response |
||||
$response = (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => _('Internal server error'), |
||||
'html' => (object) |
||||
[ |
||||
'title' => sprintf(_('Oops - %s'), WEBSITE_NAME), |
||||
'h1' => false, |
||||
'link' => (object) [], |
||||
] |
||||
]; |
||||
|
||||
// Yggdrasil connections only |
||||
if (!Valid::host($_SERVER['REMOTE_ADDR'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Yggdrasil connection required for this action'); |
||||
} |
||||
|
||||
// Init session |
||||
else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user session'); |
||||
} |
||||
|
||||
// Magnet exists |
||||
else if (!$magnet = $db->getMagnet(isset($_GET['magnetId']) && $_GET['magnetId'] > 0 ? (int) $_GET['magnetId'] : 0)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Requested magnet not found'); |
||||
} |
||||
|
||||
// Access allowed |
||||
else if (!($_SERVER['REMOTE_ADDR'] == $db->getUser($magnet->userId)->address || in_array($_SERVER['REMOTE_ADDR'], MODERATOR_IP_LIST) || ($magnet->public && $magnet->approved))) { |
||||
|
||||
$response->success = false; |
||||
$response->message = _('Magnet not available for this action'); |
||||
} |
||||
|
||||
// Get user |
||||
else if (!$user = $db->getUser($userId)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user info'); |
||||
} |
||||
|
||||
// On first visit, redirect user to the welcome page with access level question |
||||
else if (is_null($user->public)) |
||||
{ |
||||
header( |
||||
sprintf('Location: %s/welcome.php', WEBSITE_URL) |
||||
); |
||||
} |
||||
|
||||
// Request valid |
||||
else |
||||
{ |
||||
// Register magnet download |
||||
if ($magnetDownloadId = $db->addMagnetDownload($magnet->magnetId, $user->userId, time())) |
||||
{ |
||||
// Push event to other nodes |
||||
if (API_EXPORT_ENABLED && |
||||
API_EXPORT_PUSH_ENABLED && |
||||
API_EXPORT_USERS_ENABLED && |
||||
API_EXPORT_MAGNETS_ENABLED && |
||||
API_EXPORT_MAGNET_DOWNLOADS_ENABLED) |
||||
{ |
||||
if (!$memoryApiExportPush = $memory->get('api.export.push')) |
||||
{ |
||||
$memoryApiExportPush = []; |
||||
} |
||||
|
||||
$memoryApiExportPush[] = (object) |
||||
[ |
||||
'time' => time(), |
||||
'userId' => $user->userId, |
||||
'magnetId' => $magnet->magnetId, |
||||
'magnetDownloadId' => $magnetDownloadId |
||||
]; |
||||
|
||||
$memory->set('api.export.push', $memoryApiExportPush, 3600); |
||||
} |
||||
} |
||||
|
||||
// Build magnet link |
||||
$link = (object) |
||||
[ |
||||
'magnet' => [], |
||||
'direct' => [], |
||||
]; |
||||
|
||||
/// Exact Topic |
||||
$xt = []; |
||||
|
||||
foreach ($db->findMagnetToInfoHashByMagnetId($magnet->magnetId) as $result) |
||||
{ |
||||
if ($infoHash = $db->getInfoHash($result->infoHashId)) |
||||
{ |
||||
switch ($infoHash->version) |
||||
{ |
||||
case 1: |
||||
|
||||
$xt[] = sprintf('xt=urn:btih:%s', $infoHash->value); |
||||
|
||||
break; |
||||
|
||||
case 2: |
||||
|
||||
$xt[] = sprintf('xt=urn:btmh:1220%s', $infoHash->value); |
||||
|
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
$link->magnet[] = sprintf('magnet:?%s', implode('&', $xt)); |
||||
|
||||
/// Display Name |
||||
$link->magnet[] = sprintf('dn=%s', urlencode($magnet->dn)); |
||||
|
||||
// Keyword Topic |
||||
$kt = []; |
||||
|
||||
foreach ($db->findKeywordTopicByMagnetId($magnet->magnetId) as $result) |
||||
{ |
||||
$kt[] = urlencode($db->getKeywordTopic($result->keywordTopicId)->value); |
||||
} |
||||
|
||||
$link->magnet[] = sprintf('kt=%s', implode('+', $kt)); |
||||
|
||||
/// Address Tracker |
||||
foreach ($db->findAddressTrackerByMagnetId($magnet->magnetId) as $result) |
||||
{ |
||||
$addressTracker = $db->getAddressTracker($result->addressTrackerId); |
||||
|
||||
$scheme = $db->getScheme($addressTracker->schemeId); |
||||
$host = $db->getHost($addressTracker->hostId); |
||||
$port = $db->getPort($addressTracker->portId); |
||||
$uri = $db->getUri($addressTracker->uriId); |
||||
|
||||
// Yggdrasil host only |
||||
if (!Valid::host($host->value)) |
||||
{ |
||||
continue; |
||||
} |
||||
|
||||
$link->magnet[] = sprintf('tr=%s', urlencode($port->value ? sprintf('%s://%s:%s%s', $scheme->value, |
||||
$host->value, |
||||
$port->value, |
||||
$uri->value) : sprintf('%s://%s%s', $scheme->value, |
||||
$host->value, |
||||
$uri->value))); |
||||
} |
||||
|
||||
// Append trackers.json |
||||
foreach (json_decode(file_get_contents(__DIR__ . '/../config/trackers.json')) as $tracker) |
||||
{ |
||||
$link->magnet[] = sprintf('tr=%s', urlencode($tracker->announce)); |
||||
} |
||||
|
||||
/// Acceptable Source |
||||
foreach ($db->findAcceptableSourceByMagnetId($magnet->magnetId) as $result) |
||||
{ |
||||
$acceptableSource = $db->getAcceptableSource($result->acceptableSourceId); |
||||
|
||||
$scheme = $db->getScheme($acceptableSource->schemeId); |
||||
$host = $db->getHost($acceptableSource->hostId); |
||||
$port = $db->getPort($acceptableSource->portId); |
||||
$uri = $db->getUri($acceptableSource->uriId); |
||||
|
||||
// Yggdrasil host only |
||||
if (!Valid::host($host->value)) |
||||
{ |
||||
continue; |
||||
} |
||||
|
||||
$link->magnet[] = sprintf('as=%s', urlencode($port->value ? sprintf('%s://%s:%s%s', $scheme->value, |
||||
$host->value, |
||||
$port->value, |
||||
$uri->value) : sprintf('%s://%s%s', $scheme->value, |
||||
$host->value, |
||||
$uri->value))); |
||||
$link->direct[] = $port->value ? sprintf('%s://%s:%s%s', $scheme->value, |
||||
$host->value, |
||||
$port->value, |
||||
$uri->value) : sprintf('%s://%s%s', $scheme->value, |
||||
$host->value, |
||||
$uri->value); |
||||
} |
||||
|
||||
/// Exact Source |
||||
foreach ($db->findExactSourceByMagnetId($magnet->magnetId) as $result) |
||||
{ |
||||
$eXactSource = $db->getExactSource($result->eXactSourceId); |
||||
|
||||
$scheme = $db->getScheme($eXactSource->schemeId); |
||||
$host = $db->getHost($eXactSource->hostId); |
||||
$port = $db->getPort($eXactSource->portId); |
||||
$uri = $db->getUri($eXactSource->uriId); |
||||
|
||||
// Yggdrasil host only |
||||
if (!Valid::host($host->value)) |
||||
{ |
||||
continue; |
||||
} |
||||
|
||||
$link->magnet[] = sprintf('xs=%s', urlencode($port->value ? sprintf('%s://%s:%s%s', $scheme->value, |
||||
$host->value, |
||||
$port->value, |
||||
$uri->value) : sprintf('%s://%s%s', $scheme->value, |
||||
$host->value, |
||||
$uri->value))); |
||||
} |
||||
|
||||
// Return html |
||||
$response->html->title = sprintf( |
||||
_('%s - Download - %s'), |
||||
htmlentities($magnet->title), |
||||
WEBSITE_NAME |
||||
); |
||||
|
||||
$response->html->h1 = htmlentities($magnet->title); |
||||
|
||||
// @TODO implement .bittorrent, separated v1/v2 magnet links |
||||
$response->html->link->magnet = implode('&', array_unique($link->magnet)); |
||||
$response->html->link->direct = $link->direct; |
||||
} |
||||
|
||||
?> |
||||
|
||||
<!DOCTYPE html> |
||||
<html lang="en-US"> |
||||
<head> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/common.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/framework.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<title> |
||||
<?php echo $response->html->title ?> |
||||
</title> |
||||
<meta name="robots" content="noindex,nofollow"/> |
||||
<meta name="author" content="YGGtracker" /> |
||||
<meta charset="UTF-8" /> |
||||
</head> |
||||
<body> |
||||
<header> |
||||
<div class="container"> |
||||
<div class="row margin-t-8 text-center"> |
||||
<a class="logo" href="<?php echo WEBSITE_URL ?>"><?php echo str_replace('YGG', '<span>YGG</span>', WEBSITE_NAME) ?></a> |
||||
<form class="margin-t-8" name="search" method="get" action="<?php echo WEBSITE_URL ?>/index.php"> |
||||
<input type="text" name="query" value="" placeholder="<?php echo _('search or submit magnet link') ?>" /> |
||||
<input type="submit" value="<?php echo _('submit') ?>" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</header> |
||||
<main> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100"> |
||||
<div class="padding-16 margin-y-8 border-radius-3 background-color-night"> |
||||
<?php if ($response->success) { ?> |
||||
<div class="text-center"> |
||||
<h1 class="display-block margin-b-16 font-size-16"><?php echo $response->html->h1 ?></h1> |
||||
<div class="margin-b-16 text-color-night"> |
||||
<?php echo _('* make sure BitTorrent client listen Yggdrasil interface!') ?> |
||||
</div> |
||||
<a class="padding-x-4" href="<?php echo $response->html->link->magnet ?>" title="<?php echo _('Magnet') ?>"> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-magnet" viewBox="0 0 16 16"> |
||||
<path d="M8 1a7 7 0 0 0-7 7v3h4V8a3 3 0 0 1 6 0v3h4V8a7 7 0 0 0-7-7Zm7 11h-4v3h4v-3ZM5 12H1v3h4v-3ZM0 8a8 8 0 1 1 16 0v8h-6V8a2 2 0 1 0-4 0v8H0V8Z"/> |
||||
</svg> |
||||
</a> |
||||
<?php foreach ($response->html->link->direct as $direct) { ?> |
||||
<a class="padding-x-4" href="<?php echo $direct ?>" title="<?php echo _('Direct') ?>"> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-database" viewBox="0 0 16 16"> |
||||
<path d="M4.318 2.687C5.234 2.271 6.536 2 8 2s2.766.27 3.682.687C12.644 3.125 13 3.627 13 4c0 .374-.356.875-1.318 1.313C10.766 5.729 9.464 6 8 6s-2.766-.27-3.682-.687C3.356 4.875 3 4.373 3 4c0-.374.356-.875 1.318-1.313ZM13 5.698V7c0 .374-.356.875-1.318 1.313C10.766 8.729 9.464 9 8 9s-2.766-.27-3.682-.687C3.356 7.875 3 7.373 3 7V5.698c.271.202.58.378.904.525C4.978 6.711 6.427 7 8 7s3.022-.289 4.096-.777A4.92 4.92 0 0 0 13 5.698ZM14 4c0-1.007-.875-1.755-1.904-2.223C11.022 1.289 9.573 1 8 1s-3.022.289-4.096.777C2.875 2.245 2 2.993 2 4v9c0 1.007.875 1.755 1.904 2.223C4.978 15.71 6.427 16 8 16s3.022-.289 4.096-.777C13.125 14.755 14 14.007 14 13V4Zm-1 4.698V10c0 .374-.356.875-1.318 1.313C10.766 11.729 9.464 12 8 12s-2.766-.27-3.682-.687C3.356 10.875 3 10.373 3 10V8.698c.271.202.58.378.904.525C4.978 9.71 6.427 10 8 10s3.022-.289 4.096-.777A4.92 4.92 0 0 0 13 8.698Zm0 3V13c0 .374-.356.875-1.318 1.313C10.766 14.729 9.464 15 8 15s-2.766-.27-3.682-.687C3.356 13.875 3 13.373 3 13v-1.302c.271.202.58.378.904.525C4.978 12.71 6.427 13 8 13s3.022-.289 4.096-.777c.324-.147.633-.323.904-.525Z"/> |
||||
</svg> |
||||
</a> |
||||
<?php } ?> |
||||
</div> |
||||
<?php } else { ?> |
||||
<div class="text-center"> |
||||
<?php echo $response->message ?> |
||||
</div> |
||||
<?php } ?> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<?php if (!empty($_SERVER['HTTP_REFERER']) && false !== strpos($_SERVER['HTTP_REFERER'], WEBSITE_URL)) { ?> |
||||
<div class="row"> |
||||
<div class="column width-100 text-right"> |
||||
<a class="button margin-l-8" |
||||
rel="nofollow" |
||||
href="<?php echo $_SERVER['HTTP_REFERER'] ?>"> |
||||
<?php echo _('back') ?> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
<?php } ?> |
||||
</div> |
||||
</main> |
||||
<footer> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100 text-center margin-y-8"> |
||||
<?php foreach (json_decode(file_get_contents(__DIR__ . '/../config/trackers.json')) as $i => $tracker) { ?> |
||||
<?php if (!empty($tracker->announce) && !empty($tracker->stats)) { ?> |
||||
<a href="<?php echo $tracker->announce ?>"><?php echo sprintf('Tracker %s', $i + 1) ?></a> |
||||
/ |
||||
<a href="<?php echo $tracker->stats ?>"><?php echo _('Stats') ?></a> |
||||
| |
||||
<?php } ?> |
||||
<?php } ?> |
||||
<a href="<?php echo WEBSITE_URL ?>/faq.php"><?php echo _('F.A.Q') ?></a> |
||||
| |
||||
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss"><?php echo _('RSS') ?></a> |
||||
<?php if (API_EXPORT_ENABLED) { ?> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a> |
||||
<?php } ?> |
||||
| |
||||
<a href="https://github.com/YGGverse/YGGtracker"><?php echo _('GitHub') ?></a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</footer> |
||||
</body> |
||||
</html> |
@ -1,914 +0,0 @@
@@ -1,914 +0,0 @@
|
||||
<?php |
||||
|
||||
// Bootstrap |
||||
require_once __DIR__ . '/../config/bootstrap.php'; |
||||
|
||||
// Define variables |
||||
$response = (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
'form' => (object) |
||||
[ |
||||
'title' => (object) |
||||
[ |
||||
'value' => false, |
||||
'valid' => (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
] |
||||
], |
||||
'preview' => (object) |
||||
[ |
||||
'value' => false, |
||||
'valid' => (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
] |
||||
], |
||||
'description' => (object) |
||||
[ |
||||
'value' => false, |
||||
'valid' => (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
] |
||||
], |
||||
'dn' => (object) |
||||
[ |
||||
'value' => false, |
||||
'valid' => (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
] |
||||
], |
||||
'xt' => (object) |
||||
[ |
||||
'value' => [], |
||||
'valid' => (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
] |
||||
], |
||||
'kt' => (object) |
||||
[ |
||||
'value' => [], |
||||
'valid' => (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
] |
||||
], |
||||
'tr' => (object) |
||||
[ |
||||
'value' => [], |
||||
'valid' => (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
] |
||||
], |
||||
'as' => (object) |
||||
[ |
||||
'value' => [], |
||||
'valid' => (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
] |
||||
], |
||||
'xs' => (object) |
||||
[ |
||||
'value' => [], |
||||
'valid' => (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
] |
||||
], |
||||
'public' => (object) |
||||
[ |
||||
'value' => false, |
||||
'valid' => (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
] |
||||
], |
||||
'comments' => (object) |
||||
[ |
||||
'value' => false, |
||||
'valid' => (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
] |
||||
], |
||||
'sensitive' => (object) |
||||
[ |
||||
'value' => false, |
||||
'valid' => (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
] |
||||
], |
||||
'approved' => (object) |
||||
[ |
||||
'value' => false, |
||||
], |
||||
] |
||||
]; |
||||
|
||||
// Yggdrasil connections only |
||||
if (!Valid::host($_SERVER['REMOTE_ADDR'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Yggdrasil connection required to enable resource features'); |
||||
} |
||||
|
||||
// Init session |
||||
else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user session'); |
||||
} |
||||
|
||||
// Get user |
||||
else if (!$user = $db->getUser($userId)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user info'); |
||||
} |
||||
|
||||
// Init magnet |
||||
else if (!$magnet = $db->getMagnet(isset($_GET['magnetId']) ? (int) $_GET['magnetId'] : 0)) { |
||||
|
||||
$response->success = false; |
||||
$response->message = _('Magnet not found!'); |
||||
} |
||||
|
||||
// Validate access |
||||
else if (!($user->address == $db->getUser($magnet->userId)->address || in_array($user->address, MODERATOR_IP_LIST))) { |
||||
|
||||
$response->success = false; |
||||
$response->message = _('You have no permissions to edit this magnet!'); |
||||
} |
||||
|
||||
// On first visit, redirect user to the welcome page with access level question |
||||
else if (is_null($user->public)) |
||||
{ |
||||
header( |
||||
sprintf('Location: %s/welcome.php', WEBSITE_URL) |
||||
); |
||||
} |
||||
|
||||
// Process form |
||||
else { |
||||
|
||||
// Validate magnet lock |
||||
if ($lastMagnetLock = $db->findLastMagnetLock($magnet->magnetId)) |
||||
{ |
||||
if ($lastMagnetLock->userId != $user->userId && |
||||
$lastMagnetLock->timeAdded > time() - MAGNET_EDITOR_LOCK_TIMEOUT) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('This form have opened by owner or moderator, to prevent overwriting, try attempt later!'); |
||||
} |
||||
} |
||||
|
||||
// Lock form for moderators |
||||
$db->addMagnetLock($magnet->magnetId, $user->userId, time()); |
||||
|
||||
// Update form |
||||
if (!empty($_POST)) { |
||||
|
||||
// Push event to other nodes |
||||
if (API_EXPORT_ENABLED && |
||||
API_EXPORT_PUSH_ENABLED && |
||||
API_EXPORT_USERS_ENABLED && |
||||
API_EXPORT_MAGNETS_ENABLED) |
||||
{ |
||||
if (!$memoryApiExportPush = $memory->get('api.export.push')) |
||||
{ |
||||
$memoryApiExportPush = []; |
||||
} |
||||
|
||||
$memoryApiExportPush[] = (object) |
||||
[ |
||||
'time' => time(), |
||||
'userId' => $user->userId, |
||||
'magnetId' => $magnet->magnetId, |
||||
]; |
||||
|
||||
$memory->set('api.export.push', $memoryApiExportPush, 3600); |
||||
} |
||||
|
||||
// Approve by moderation request |
||||
if (in_array($user->address, MODERATOR_IP_LIST)) |
||||
{ |
||||
$db->updateMagnetApproved($magnet->magnetId, isset($_POST['approved']), time()); |
||||
|
||||
// Auto-approve user on magnet approve |
||||
if (USER_AUTO_APPROVE_ON_MAGNET_APPROVE) |
||||
{ |
||||
$db->updateUserApproved($magnet->userId, isset($_POST['approved']), time()); |
||||
} |
||||
} |
||||
|
||||
// Approve by user approved status |
||||
else |
||||
{ |
||||
$db->updateMagnetApproved($magnet->magnetId, (bool) $user->approved, time()); |
||||
} |
||||
|
||||
// Social |
||||
$db->updateMagnetComments($magnet->magnetId, isset($_POST['comments']) ? true : false, time()); |
||||
$db->updateMagnetSensitive($magnet->magnetId, isset($_POST['sensitive']) ? true : false, time()); |
||||
|
||||
if (isset($_POST['public'])) // could be enabled once only because of distributed database model #1 |
||||
{ |
||||
$db->updateMagnetPublic($magnet->magnetId, true, time()); |
||||
} |
||||
|
||||
// Title |
||||
$response->form->title->valid->success = true; |
||||
$response->form->title->valid->message = []; |
||||
|
||||
if (!Valid::magnetTitle($_POST['title'], $response->form->title->valid->message)) |
||||
{ |
||||
$response->form->title->valid->success = false; |
||||
} |
||||
|
||||
else |
||||
{ |
||||
$db->updateMagnetTitle( |
||||
$magnet->magnetId, |
||||
Filter::magnetTitle($_POST['title']), |
||||
time() |
||||
); |
||||
} |
||||
|
||||
// Preview |
||||
$response->form->preview->valid->success = true; |
||||
$response->form->preview->valid->message = []; |
||||
|
||||
if (!Valid::magnetPreview($_POST['preview'], $response->form->preview->valid->message)) |
||||
{ |
||||
$response->form->preview->valid->success = false; |
||||
} |
||||
|
||||
else |
||||
{ |
||||
$db->updateMagnetPreview( |
||||
$magnet->magnetId, |
||||
Filter::magnetPreview($_POST['preview']), |
||||
time() |
||||
); |
||||
} |
||||
|
||||
// Description |
||||
$response->form->description->valid->success = true; |
||||
$response->form->description->valid->message = []; |
||||
|
||||
if (!Valid::magnetDescription($_POST['description'], $response->form->description->valid->message)) |
||||
{ |
||||
$response->form->description->valid->success = false; |
||||
} |
||||
|
||||
else |
||||
{ |
||||
$db->updateMagnetDescription( |
||||
$magnet->magnetId, |
||||
Filter::magnetDescription($_POST['description']), |
||||
time() |
||||
); |
||||
} |
||||
|
||||
// Display Name |
||||
$response->form->dn->valid->success = true; |
||||
$response->form->dn->valid->message = []; |
||||
|
||||
if (!Valid::magnetDn($_POST['dn'], $response->form->dn->valid->message)) |
||||
{ |
||||
$response->form->dn->valid->success = false; |
||||
} |
||||
|
||||
else |
||||
{ |
||||
$db->updateMagnetDn( |
||||
$magnet->magnetId, |
||||
Filter::magnetDn($_POST['dn']), |
||||
time() |
||||
); |
||||
} |
||||
|
||||
// Exact Topic |
||||
if (isset($_POST['xt'])) |
||||
{ |
||||
foreach ((array) $_POST['xt'] as $version => $value) |
||||
{ |
||||
switch ($version) |
||||
{ |
||||
case 1: |
||||
|
||||
if (!empty($value) && Yggverse\Parser\Magnet::isXTv1($value)) |
||||
{ |
||||
$exist = false; |
||||
|
||||
foreach ($db->findMagnetToInfoHashByMagnetId($magnet->magnetId) as $result) |
||||
{ |
||||
if ($infoHash = $db->getInfoHash($result->infoHashId)) |
||||
{ |
||||
if ($infoHash->version == 1) |
||||
{ |
||||
$exist = true; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (!$exist) |
||||
{ |
||||
$db->addMagnetToInfoHash( |
||||
$magnet->magnetId, |
||||
$db->initInfoHashId( |
||||
Yggverse\Parser\Magnet::filterInfoHash($value), 1 |
||||
) |
||||
); |
||||
} |
||||
} |
||||
|
||||
break; |
||||
|
||||
case 2: |
||||
|
||||
if (!empty($value) && Yggverse\Parser\Magnet::isXTv2($value)) |
||||
{ |
||||
$exist = false; |
||||
|
||||
foreach ($db->findMagnetToInfoHashByMagnetId($magnet->magnetId) as $result) |
||||
{ |
||||
if ($infoHash = $db->getInfoHash($result->infoHashId)) |
||||
{ |
||||
if ($infoHash->version == 2) |
||||
{ |
||||
$exist = true; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (!$exist) |
||||
{ |
||||
$db->addMagnetToInfoHash( |
||||
$magnet->magnetId, |
||||
$db->initInfoHashId( |
||||
Yggverse\Parser\Magnet::filterInfoHash($value), 2 |
||||
) |
||||
); |
||||
} |
||||
} |
||||
|
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// Keyword Topic |
||||
$db->deleteMagnetToKeywordTopicByMagnetId($magnet->magnetId); |
||||
|
||||
if (!empty($_POST['kt'])) |
||||
{ |
||||
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['kt'])) as $kt) |
||||
{ |
||||
$kt = trim($kt); |
||||
|
||||
if (!empty(trim($kt))) |
||||
{ |
||||
$db->initMagnetToKeywordTopicId( |
||||
$magnet->magnetId, |
||||
$db->initKeywordTopicId(trim(mb_strtolower(strip_tags(html_entity_decode($kt))))) |
||||
); |
||||
} |
||||
} |
||||
} |
||||
|
||||
// Address Tracker |
||||
$db->deleteMagnetToAddressTrackerByMagnetId($magnet->magnetId); |
||||
|
||||
if (!empty($_POST['tr'])) |
||||
{ |
||||
$response->form->tr->valid->success = false; |
||||
$response->form->tr->valid->message = _('* please, provide at least one Yggdrasil address'); |
||||
|
||||
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['tr'])) as $tr) |
||||
{ |
||||
$tr = trim($tr); |
||||
|
||||
if (Valid::url($tr)) |
||||
{ |
||||
if ($url = Yggverse\Parser\Url::parse($tr)) |
||||
{ |
||||
$db->initMagnetToAddressTrackerId( |
||||
$magnet->magnetId, |
||||
$db->initAddressTrackerId( |
||||
$db->initSchemeId($url->host->scheme), |
||||
$db->initHostId($url->host->name), |
||||
$db->initPortId($url->host->port), |
||||
$db->initUriId($url->page->uri) |
||||
) |
||||
); |
||||
|
||||
$response->form->tr->valid->success = true; |
||||
$response->form->tr->valid->message = false; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
// Acceptable Source |
||||
$db->deleteMagnetToAcceptableSourceByMagnetId($magnet->magnetId); |
||||
|
||||
if (!empty($_POST['as'])) |
||||
{ |
||||
$response->form->as->valid->success = false; |
||||
$response->form->as->valid->message = _('* please, provide at least one Yggdrasil address'); |
||||
|
||||
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['as'])) as $as) |
||||
{ |
||||
$xs = trim($as); |
||||
|
||||
if (Valid::url($as)) |
||||
{ |
||||
if ($url = Yggverse\Parser\Url::parse($as)) |
||||
{ |
||||
$db->initMagnetToAcceptableSourceId( |
||||
$magnet->magnetId, |
||||
$db->initAcceptableSourceId( |
||||
$db->initSchemeId($url->host->scheme), |
||||
$db->initHostId($url->host->name), |
||||
$db->initPortId($url->host->port), |
||||
$db->initUriId($url->page->uri) |
||||
) |
||||
); |
||||
|
||||
$response->form->as->valid->success = true; |
||||
$response->form->as->valid->message = false; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
// Exact Source |
||||
$db->deleteMagnetToExactSourceByMagnetId($magnet->magnetId); |
||||
|
||||
if (!empty($_POST['xs'])) |
||||
{ |
||||
$response->form->xs->valid->success = false; |
||||
$response->form->xs->valid->message = _('* please, provide at least one Yggdrasil address'); |
||||
|
||||
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['xs'])) as $xs) |
||||
{ |
||||
$xs = trim($xs); |
||||
|
||||
if (Valid::url($xs)) |
||||
{ |
||||
if ($url = Yggverse\Parser\Url::parse($xs)) |
||||
{ |
||||
$db->initMagnetToExactSourceId( |
||||
$magnet->magnetId, |
||||
$db->initExactSourceId( |
||||
$db->initSchemeId($url->host->scheme), |
||||
$db->initHostId($url->host->name), |
||||
$db->initPortId($url->host->port), |
||||
$db->initUriId($url->page->uri) |
||||
) |
||||
); |
||||
|
||||
$response->form->xs->valid->success = true; |
||||
$response->form->xs->valid->message = false; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
// Is valid |
||||
if ($response->success && |
||||
$response->form->title->valid->success && |
||||
$response->form->preview->valid->success && |
||||
$response->form->description->valid->success && |
||||
$response->form->dn->valid->success && |
||||
$response->form->tr->valid->success && |
||||
$response->form->as->valid->success && |
||||
$response->form->xs->valid->success) |
||||
{ |
||||
// Unlock form |
||||
$db->flushMagnetLock($magnet->magnetId); |
||||
|
||||
// Return redirect to the magnet page |
||||
header( |
||||
sprintf('Location: %s/magnet.php?magnetId=%s', WEBSITE_URL, $magnet->magnetId) |
||||
); |
||||
} |
||||
else |
||||
{ |
||||
// Refresh magnet data |
||||
$magnet = $db->getMagnet($magnet->magnetId); |
||||
|
||||
// Replace fields by last POST data |
||||
foreach ($_POST as $key => $value) |
||||
{ |
||||
$magnet->{$key} = $value; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// Meta Title, auto-replace with Display Name on empty value |
||||
$response->form->title->value = $magnet->title ? $magnet->title : $magnet->dn; |
||||
|
||||
// Meta Description |
||||
$response->form->preview->value = $magnet->preview; |
||||
|
||||
// Description |
||||
$response->form->description->value = $magnet->description; |
||||
|
||||
// Magnet settings |
||||
$response->form->public->value = (bool) $magnet->public; |
||||
$response->form->comments->value = (bool) $magnet->comments; |
||||
$response->form->sensitive->value = (bool) $magnet->sensitive; |
||||
$response->form->approved->value = (bool) $magnet->approved; |
||||
|
||||
// Display Name |
||||
$response->form->dn->value = $magnet->dn; |
||||
|
||||
// Exact Topic |
||||
foreach ($db->findMagnetToInfoHashByMagnetId($magnet->magnetId) as $result) |
||||
{ |
||||
if ($infoHash = $db->getInfoHash($result->infoHashId)) |
||||
{ |
||||
$response->form->xt->value[$infoHash->version] = $infoHash->value; |
||||
} |
||||
} |
||||
|
||||
// Keyword Topic |
||||
$kt = []; |
||||
foreach ($db->findKeywordTopicByMagnetId($magnet->magnetId) as $result) |
||||
{ |
||||
$kt[] = $db->getKeywordTopic($result->keywordTopicId)->value; |
||||
} |
||||
|
||||
$response->form->kt->value = implode(', ', $kt); |
||||
|
||||
// Address Tracker |
||||
$tr = []; |
||||
foreach ($db->findAddressTrackerByMagnetId($magnet->magnetId) as $result) |
||||
{ |
||||
$addressTracker = $db->getAddressTracker($result->addressTrackerId); |
||||
|
||||
$scheme = $db->getScheme($addressTracker->schemeId); |
||||
$host = $db->getHost($addressTracker->hostId); |
||||
$port = $db->getPort($addressTracker->portId); |
||||
$uri = $db->getUri($addressTracker->uriId); |
||||
|
||||
$tr[] = $port->value ? sprintf('%s://%s:%s%s', $scheme->value, |
||||
$host->value, |
||||
$port->value, |
||||
$uri->value) : sprintf('%s://%s%s', $scheme->value, |
||||
$host->value, |
||||
$uri->value); |
||||
} |
||||
|
||||
$response->form->tr->value = implode(PHP_EOL, $tr); |
||||
|
||||
// Acceptable Source |
||||
$as = []; |
||||
foreach ($db->findAcceptableSourceByMagnetId($magnet->magnetId) as $result) |
||||
{ |
||||
$acceptableSource = $db->getAcceptableSource($result->acceptableSourceId); |
||||
|
||||
$scheme = $db->getScheme($acceptableSource->schemeId); |
||||
$host = $db->getHost($acceptableSource->hostId); |
||||
$port = $db->getPort($acceptableSource->portId); |
||||
$uri = $db->getUri($acceptableSource->uriId); |
||||
|
||||
$as[] = $port->value ? sprintf('%s://%s:%s%s', $scheme->value, |
||||
$host->value, |
||||
$port->value, |
||||
$uri->value) : sprintf('%s://%s%s', $scheme->value, |
||||
$host->value, |
||||
$uri->value); |
||||
} |
||||
|
||||
$response->form->as->value = implode(PHP_EOL, $as); |
||||
|
||||
// Exact Source |
||||
$xs = []; |
||||
foreach ($db->findExactSourceByMagnetId($magnet->magnetId) as $result) |
||||
{ |
||||
$eXactSource = $db->getExactSource($result->eXactSourceId); |
||||
|
||||
$scheme = $db->getScheme($eXactSource->schemeId); |
||||
$host = $db->getHost($eXactSource->hostId); |
||||
$port = $db->getPort($eXactSource->portId); |
||||
$uri = $db->getUri($eXactSource->uriId); |
||||
|
||||
$xs[] = $port->value ? sprintf('%s://%s:%s%s', $scheme->value, |
||||
$host->value, |
||||
$port->value, |
||||
$uri->value) : sprintf('%s://%s%s', $scheme->value, |
||||
$host->value, |
||||
$uri->value); |
||||
} |
||||
|
||||
$response->form->xs->value = implode(PHP_EOL, $xs); |
||||
} |
||||
|
||||
?> |
||||
|
||||
<!DOCTYPE html> |
||||
<html lang="en-US"> |
||||
<head> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/common.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/framework.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<title> |
||||
<?php echo sprintf(_('Edit - %s'), WEBSITE_NAME) ?> |
||||
</title> |
||||
<meta name="description" content="<?php echo _('BitTorrent Registry for Yggdrasil') ?>" /> |
||||
<meta name="keywords" content="yggdrasil, yggverse, yggtracker, bittorrent, magnet, catalog" /> |
||||
<meta name="author" content="YGGtracker" /> |
||||
<meta charset="UTF-8" /> |
||||
</head> |
||||
<body> |
||||
<header> |
||||
<div class="container"> |
||||
<div class="row margin-t-8 text-center"> |
||||
<a class="logo" href="<?php echo WEBSITE_URL ?>"><?php echo str_replace('YGG', '<span>YGG</span>', WEBSITE_NAME) ?></a> |
||||
<form class="margin-t-8" name="search" method="get" action="<?php echo WEBSITE_URL ?>/index.php"> |
||||
<input type="text" name="query" value="" placeholder="<?php echo _('search or submit magnet link') ?>" /> |
||||
<input type="submit" value="<?php echo _('submit') ?>" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</header> |
||||
<main> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100"> |
||||
<?php if ($response->success) { ?> |
||||
<div class="padding-x-16 text-right"> |
||||
<a href="<?php echo WEBSITE_URL ?>" target="_blank"><?php echo _('catalog') ?></a> |
||||
<!-- <a href="<?php echo WEBSITE_URL ?>/magnet.php?magnetId=<?php echo $magnet->magnetId ?>" target="_blank"><?php echo _('magnet page') ?></a> --> |
||||
</div> |
||||
<div class="padding-16 margin-y-8 border-radius-3 background-color-night"> |
||||
<h2 class="margin-b-8"><?php echo _('Edit magnet') ?></h2> |
||||
<form name="search" method="post" action="<?php echo WEBSITE_URL ?>/edit.php?magnetId=<?php echo $magnet->magnetId ?>"> |
||||
<fieldset class="display-block margin-b-16"> |
||||
<legend class="text-right width-100 padding-y-8 margin-b-8 border-bottom-default"><?php echo _('Meta') ?></legend> |
||||
<label class="display-block margin-y-8 padding-t-4"> |
||||
<?php echo _('Title') ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo sprintf(_('Subject and meta title (%s-%s chars)'), MAGNET_TITLE_MIN_LENGTH, MAGNET_TITLE_MAX_LENGTH) ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
<?php if ($response->form->title->valid->message) { ?> |
||||
<div class="margin-b-8"><?php echo implode('<br />', $response->form->title->valid->message) ?></div> |
||||
<?php } ?> |
||||
<input class="width-100 margin-t-8 <?php echo ($response->form->title->valid->success ? false : 'background-color-red') ?>" type="text" name="title" value="<?php echo $response->form->title->value ?>" placeholder="<?php echo _('Main title') ?>" maxlength="255" /> |
||||
</label> |
||||
<label class="display-block margin-y-8 padding-t-4"> |
||||
<?php echo _('Preview') ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo sprintf(_('Visible in listings, magnet web page description and meta description (%s-%s chars)'), MAGNET_PREVIEW_MIN_LENGTH, MAGNET_PREVIEW_MAX_LENGTH) ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
<?php if ($response->form->preview->valid->message) { ?> |
||||
<div class="margin-b-8"><?php echo implode('<br />', $response->form->preview->valid->message) ?></div> |
||||
<?php } ?> |
||||
<textarea class="width-100 margin-t-8 <?php echo ($response->form->preview->valid->success ? false : 'background-color-red') ?>" name="preview" placeholder="<?php echo _('Shows in listing and meta tags') ?>"><?php echo $response->form->preview->value ?></textarea> |
||||
</label> |
||||
<label class="display-block margin-y-8 padding-t-4"> |
||||
<?php echo _('Description') ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo sprintf(_('Visible on magnet web page (%s-%s chars)'), MAGNET_DESCRIPTION_MIN_LENGTH, MAGNET_DESCRIPTION_MAX_LENGTH) ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
<?php if ($response->form->description->valid->message) { ?> |
||||
<div class="margin-b-8"><?php echo implode('<br />', $response->form->description->valid->message) ?></div> |
||||
<?php } ?> |
||||
<textarea class="width-100 margin-t-8 <?php echo ($response->form->description->valid->success ? false : 'background-color-red') ?>" name="description" placeholder="<?php echo _('Shows on magnet page') ?>"><?php echo $response->form->description->value ?></textarea> |
||||
</label> |
||||
</fieldset> |
||||
<fieldset class="display-block margin-b-16"> |
||||
<legend class="text-right width-100 padding-y-8 margin-b-8 border-bottom-default"><?php echo _('BitTorrent') ?></legend> |
||||
<label class="display-block margin-y-8 padding-t-4" for="xt-1"> |
||||
<?php echo _('Info Hash v1 (xt)') ?> |
||||
<?php if (empty($response->form->xt->value[1])) { ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('Info info hash (btih) not provided and could be changed once') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
<input class="width-100 margin-t-8 <?php echo (empty($response->form->xt->value[2]) ? 'background-color-red' : false) ?>" type="text" name="xt[1]" id="xt-1" value="" /> |
||||
<?php } else { ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('Unique info hash (btih)') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
<input class="width-100 margin-t-8" type="text" name="xt[1]" id="xt-1" value="<?php echo $response->form->xt->value[1] ?>" readonly="readonly" disabled="disabled" /> |
||||
<?php } ?> |
||||
</label> |
||||
<label class="display-block margin-y-8 padding-t-4" for="xt-2"> |
||||
<?php echo _('Info Hash v2 (xt)') ?> |
||||
<?php if (empty($response->form->xt->value[2])) { ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('Info info hash (btmh) not provided and could be changed once') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
<input class="width-100 margin-t-8 <?php echo (empty($response->form->xt->value[1]) ? 'background-color-red' : false) ?>" type="text" name="xt[2]" id="xt-2" value="" /> |
||||
<?php } else { ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('Unique info hash (btmh)') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
<input class="width-100 margin-t-8" type="text" name="xt[2]" id="xt-2" value="<?php echo $response->form->xt->value[2] ?>" readonly="readonly" disabled="disabled" /> |
||||
<?php } ?> |
||||
</label> |
||||
<?php if (empty($response->form->xt->value[1]) && empty($response->form->xt->value[2])) { ?> |
||||
<div class="margin-b-8"><?php echo _('At least v1 or v2 info hash required for download') ?></div> |
||||
<?php } ?> |
||||
<label class="display-block margin-y-8 padding-t-4" for="dn"> |
||||
<?php echo _('Display Name (dn)') ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('Filename display to the user in BitTorrent client') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
<?php if ($response->form->dn->valid->message) { ?> |
||||
<div class="margin-b-8"><?php echo implode('<br />', $response->form->dn->valid->message) ?></div> |
||||
<?php } ?> |
||||
<input class="width-100 margin-t-8 <?php echo ($response->form->dn->valid->success ? false : 'background-color-red') ?>" type="text" name="dn" id="dn" value="<?php echo $response->form->dn->value ?>" placeholder="<?php echo _('A filename to display to the user, for convenience') ?>" maxlength="255" /> |
||||
</label> |
||||
<label class="display-block margin-y-8 padding-t-4" for="kt"> |
||||
<?php echo _('Keyword Topic (kt)') ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('Search keywords for YGGtracker and P2P networks over DHT') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
<textarea class="width-100 margin-t-8" name="kt" id="kt" placeholder="<?php echo _('Hash tag, comma separated, or one per line') ?>"><?php echo $response->form->kt->value ?></textarea> |
||||
</label> |
||||
<label class="display-block margin-y-8 padding-t-4" for="tr"> |
||||
<?php echo _('Address Tracker (tr)') ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('Yggdrasil only trackers URL to obtain peers without DHT') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
<?php if ($response->form->tr->valid->message) { ?> |
||||
<div class="margin-b-8"><?php echo $response->form->tr->valid->message ?></div> |
||||
<?php } ?> |
||||
<textarea class="width-100 margin-t-8 <?php echo ($response->form->tr->valid->success ? false : 'background-color-red') ?>" name="tr" id="tr" placeholder="<?php echo _('BitTorrent trackers list - comma separated, or one per line') ?>"><?php echo $response->form->tr->value ?></textarea> |
||||
</label> |
||||
<label class="display-block margin-y-8 padding-t-4" for="as"> |
||||
<?php echo _('Acceptable Source (as)') ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('Yggdrasil only URL to a direct download from a web server') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
<?php if ($response->form->as->valid->message) { ?> |
||||
<div class="margin-b-8"><?php echo $response->form->as->valid->message ?></div> |
||||
<?php } ?> |
||||
<textarea class="width-100 margin-t-8 <?php echo ($response->form->as->valid->success ? false : 'background-color-red') ?>" name="as" id="as" placeholder="<?php echo _('Web servers to a direct download - comma separated, or one per line') ?>"><?php echo $response->form->as->value ?></textarea> |
||||
</label> |
||||
<label class="display-block margin-y-8 padding-t-4" for="xs"> |
||||
<?php echo _('eXact Source (xs)') ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('Yggdrasil only URL to download source for the file pointed to by the Magnet link') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
<?php if ($response->form->xs->valid->message) { ?> |
||||
<div class="margin-b-8"><?php echo $response->form->xs->valid->message ?></div> |
||||
<?php } ?> |
||||
<textarea class="width-100 margin-t-8 <?php echo ($response->form->xs->valid->success ? false : 'background-color-red') ?>" name="xs" id="xs" placeholder="<?php echo _('URL of a P2P source for the file or the address of a hub - comma separated, or one per line') ?>"><?php echo $response->form->xs->value ?></textarea> |
||||
</label> |
||||
</fieldset> |
||||
<fieldset class="display-block"> |
||||
<legend class="text-right width-100 padding-y-8 margin-b-16 border-bottom-default"><?php echo _('Social') ?></legend> |
||||
<div class="margin-b-8"> |
||||
<label class="margin-y-8" for="public"> |
||||
<?php if ($response->form->public->value) { ?> |
||||
<input type="checkbox" id="public" name="public" value="1" checked="checked" disabled="disabled" /> |
||||
<?php } else { ?> |
||||
<input type="checkbox" id="public" name="public" value="1" /> |
||||
<?php } ?> |
||||
<?php echo _('Public') ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo $response->form->public->value ? _('Magnet already transmitted to this website, RSS feeds and YGGtracker nodes') : _('Make permanently visible on this website, RSS feeds and other YGGtracker nodes') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
</label> |
||||
</div> |
||||
<div class="margin-b-8"> |
||||
<label class="margin-y-8" for="comments"> |
||||
<?php if ($response->form->comments->value) { ?> |
||||
<input type="checkbox" id="comments" name="comments" value="1" checked="checked" /> |
||||
<?php } else { ?> |
||||
<input type="checkbox" id="comments" name="comments" value="1" /> |
||||
<?php } ?> |
||||
<?php echo _('Comments') ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('Allow comments for this publication') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
</label> |
||||
</div> |
||||
<div class="margin-b-8"> |
||||
<label class="margin-y-8" for="sensitive"> |
||||
<?php if ($response->form->sensitive->value) { ?> |
||||
<input type="checkbox" id="sensitive" name="sensitive" value="1" checked="checked" /> |
||||
<?php } else { ?> |
||||
<input type="checkbox" id="sensitive" name="sensitive" value="1" /> |
||||
<?php } ?> |
||||
<?php echo _('Sensitive') ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('Apply NSFW filters for this publication') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
</label> |
||||
</div> |
||||
<?php if (in_array($user->address, MODERATOR_IP_LIST)) { ?> |
||||
<div class="margin-b-8"> |
||||
<label class="margin-y-8" for="approved"> |
||||
<?php if ($response->form->approved->value) { ?> |
||||
<input type="checkbox" id="approved" name="approved" value="1" checked="checked" /> |
||||
<?php } else { ?> |
||||
<input type="checkbox" id="approved" name="approved" value="1" /> |
||||
<?php } ?> |
||||
<?php echo _('Approved') ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo USER_AUTO_APPROVE_ON_MAGNET_APPROVE ? _('Approve this post and user') : _('Approve this post as moderator') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
</label> |
||||
</div> |
||||
<?php } ?> |
||||
</fieldset> |
||||
<fieldset class="display-block text-right"> |
||||
<input type="submit" value="<?php echo _('save') ?>" /> |
||||
</fieldset> |
||||
</form> |
||||
</div> |
||||
<?php } else { ?> |
||||
<div class="padding-16 margin-y-8 border-radius-3 background-color-night"> |
||||
<div class="text-center"><?php echo $response->message ?></div> |
||||
</div> |
||||
<?php } ?> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</main> |
||||
<footer> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100 text-center margin-y-8"> |
||||
<?php foreach (json_decode(file_get_contents(__DIR__ . '/../config/trackers.json')) as $i => $tracker) { ?> |
||||
<?php if (!empty($tracker->announce) && !empty($tracker->stats)) { ?> |
||||
<a href="<?php echo $tracker->announce ?>"><?php echo sprintf('Tracker %s', $i + 1) ?></a> |
||||
/ |
||||
<a href="<?php echo $tracker->stats ?>"><?php echo _('Stats') ?></a> |
||||
| |
||||
<?php } ?> |
||||
<?php } ?> |
||||
<a href="<?php echo WEBSITE_URL ?>/faq.php"><?php echo _('F.A.Q') ?></a> |
||||
| |
||||
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss"><?php echo _('RSS') ?></a> |
||||
<?php if (API_EXPORT_ENABLED) { ?> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a> |
||||
<?php } ?> |
||||
| |
||||
<a href="https://github.com/YGGverse/YGGtracker"><?php echo _('GitHub') ?></a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</footer> |
||||
</body> |
||||
</html> |
@ -1,228 +0,0 @@
@@ -1,228 +0,0 @@
|
||||
|
||||
<?php |
||||
|
||||
// Bootstrap |
||||
require_once __DIR__ . '/../config/bootstrap.php'; |
||||
|
||||
// Define response |
||||
$response = (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => _('Internal server error'), |
||||
]; |
||||
|
||||
// Yggdrasil connections only |
||||
if (!Valid::host($_SERVER['REMOTE_ADDR'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Yggdrasil connection required for this action'); |
||||
} |
||||
|
||||
// Init session |
||||
else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user session'); |
||||
} |
||||
|
||||
// Get user |
||||
else if (!$user = $db->getUser($userId)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user info'); |
||||
} |
||||
|
||||
// On first visit, redirect user to the welcome page with access level question |
||||
/* Allow to users read this page before accepting data access type in welcome form |
||||
else if (is_null($user->public)) |
||||
{ |
||||
header( |
||||
sprintf('Location: %s/welcome.php', WEBSITE_URL) |
||||
); |
||||
} |
||||
*/ |
||||
|
||||
?> |
||||
<!DOCTYPE html> |
||||
<html lang="en-US"> |
||||
<head> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/common.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/framework.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<title> |
||||
<?php echo sprintf(_('F.A.Q. - %s'), WEBSITE_NAME) ?> |
||||
</title> |
||||
<meta name="author" content="YGGtracker" /> |
||||
<meta charset="UTF-8" /> |
||||
</head> |
||||
<body> |
||||
<header> |
||||
<div class="container"> |
||||
<div class="row margin-t-8 text-center"> |
||||
<a class="logo" href="<?php echo WEBSITE_URL ?>"><?php echo str_replace('YGG', '<span>YGG</span>', WEBSITE_NAME) ?></a> |
||||
<form class="margin-t-8" name="search" method="get" action="<?php echo WEBSITE_URL ?>/index.php"> |
||||
<input type="text" name="query" value="" placeholder="<?php echo _('search or submit magnet link') ?>" /> |
||||
<input type="submit" value="<?php echo _('submit') ?>" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</header> |
||||
<main> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100"> |
||||
<div class="padding-16 margin-y-8 border-radius-3 background-color-night"> |
||||
<?php if ($response->success) { ?> |
||||
<h1><?php echo _('F.A.Q.') ?></h1> |
||||
<div class="margin-b-16 text-right padding-y-8 margin-b-8 border-bottom-default"> |
||||
<?php echo _('Project') ?> |
||||
</div> |
||||
<div class="margin-b-16"> |
||||
<h3><?php echo _('About') ?></h3> |
||||
<a class="opacity-0 parent-hover-opacity-09 position-relative top-2" name="about" href="#about"> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link" viewBox="0 0 16 16"> |
||||
<path d="M6.354 5.5H4a3 3 0 0 0 0 6h3a3 3 0 0 0 2.83-4H9c-.086 0-.17.01-.25.031A2 2 0 0 1 7 10.5H4a2 2 0 1 1 0-4h1.535c.218-.376.495-.714.82-1z"/> |
||||
<path d="M9 5.5a3 3 0 0 0-2.83 4h1.098A2 2 0 0 1 9 6.5h3a2 2 0 1 1 0 4h-1.535a4.02 4.02 0 0 1-.82 1H12a3 3 0 1 0 0-6H9z"/> |
||||
</svg> |
||||
</a> |
||||
<div class="margin-t-16"> |
||||
<p><?php echo _('YGGtracker is an <a href="https://github.com/YGGverse/YGGtracker">open source</a> community-driven BitTorrent registry for <a href="https://yggdrasil-network.github.io/">Yggdrasil</a> ecosystem.') ?></p> |
||||
<p><?php echo _('Project following free and censorship-resistant data exchange by using Yggdrasil tuns and federated API.') ?></p> |
||||
</div> |
||||
</div> |
||||
<div class="margin-b-16"> |
||||
<h3><?php echo _('Privacy') ?></h3> |
||||
<a class="opacity-0 parent-hover-opacity-09 position-relative top-2" name="privacy" href="#privacy"> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link" viewBox="0 0 16 16"> |
||||
<path d="M6.354 5.5H4a3 3 0 0 0 0 6h3a3 3 0 0 0 2.83-4H9c-.086 0-.17.01-.25.031A2 2 0 0 1 7 10.5H4a2 2 0 1 1 0-4h1.535c.218-.376.495-.714.82-1z"/> |
||||
<path d="M9 5.5a3 3 0 0 0-2.83 4h1.098A2 2 0 0 1 9 6.5h3a2 2 0 1 1 0 4h-1.535a4.02 4.02 0 0 1-.82 1H12a3 3 0 1 0 0-6H9z"/> |
||||
</svg> |
||||
</a> |
||||
<div class="margin-t-16"> |
||||
<p class="margin-b-16"><?php echo _('YGGtracker uses IPv6 in 0200::/7 range to auto-identify users and relate theirs activity like downloads, favlists, comments, etc, without manual registration. This model allows to build decentralized BitTorrent registry where users able to manage their own content everywhere YGGtracker instance running.') ?></p> |
||||
<p class="margin-b-16"><?php echo _('On first visit, each user select Local or Distributed access level to say application how to properly process personal data. The Local access means that profile data like Yggdrasil IPv6 stored locally and not displaying or transmitting trough API to other YGGtracker nodes. Otherwise, any user activity will be publicly related with address that proves ownership and other nodes able to collect it and sync their remote registry by timestamp.') ?></p> |
||||
<p><?php echo _('Pay attention, Yggdrasil protocol does not make activity private. So if your connection sensitive for ISP or local laws, please use Proxy bridge, Tor or I2P software before use YGGtracker.') ?></p> |
||||
</div> |
||||
</div> |
||||
<div class="margin-b-16"> |
||||
<h3><?php echo _('Rules') ?></h3> |
||||
<a class="opacity-0 parent-hover-opacity-09 position-relative top-2" name="rules" href="#rules"> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link" viewBox="0 0 16 16"> |
||||
<path d="M6.354 5.5H4a3 3 0 0 0 0 6h3a3 3 0 0 0 2.83-4H9c-.086 0-.17.01-.25.031A2 2 0 0 1 7 10.5H4a2 2 0 1 1 0-4h1.535c.218-.376.495-.714.82-1z"/> |
||||
<path d="M9 5.5a3 3 0 0 0-2.83 4h1.098A2 2 0 0 1 9 6.5h3a2 2 0 1 1 0 4h-1.535a4.02 4.02 0 0 1-.82 1H12a3 3 0 1 0 0-6H9z"/> |
||||
</svg> |
||||
</a> |
||||
<div class="margin-t-16"> |
||||
<p><?php echo sprintf(_('Every node able to provide local rules like region, content subject, etc. Human-readable manifest usually available at <a href="%s/node.php">Node</a> page.'), WEBSITE_URL) ?></p> |
||||
</div> |
||||
</div> |
||||
<div class="margin-b-16 text-right padding-y-8 margin-b-8 border-bottom-default"> |
||||
<?php echo _('Interface') ?> |
||||
</div> |
||||
<div class="margin-b-16"> |
||||
<h3><?php echo _('Upload') ?></h3> |
||||
<a class="opacity-0 parent-hover-opacity-09 position-relative top-2" name="download" href="#upload"> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link" viewBox="0 0 16 16"> |
||||
<path d="M6.354 5.5H4a3 3 0 0 0 0 6h3a3 3 0 0 0 2.83-4H9c-.086 0-.17.01-.25.031A2 2 0 0 1 7 10.5H4a2 2 0 1 1 0-4h1.535c.218-.376.495-.714.82-1z"/> |
||||
<path d="M9 5.5a3 3 0 0 0-2.83 4h1.098A2 2 0 0 1 9 6.5h3a2 2 0 1 1 0 4h-1.535a4.02 4.02 0 0 1-.82 1H12a3 3 0 1 0 0-6H9z"/> |
||||
</svg> |
||||
</a> |
||||
<div class="margin-t-16"> |
||||
<p><?php echo _('Just copy magnet link from your BitTorrent client into the search field in header, then enter <strong>Submit</strong>.') ?></p> |
||||
<p class="margin-b-16"><?php echo _('You will be redirected to edit form, where provide additional options like description or magnet meta.') ?></p> |
||||
<p class="margin-b-16"><?php echo _('When publication has sensitive content, please mark your post as sensitive, this option allows properly process the data in API as NSFW by applying UI filters.') ?></p> |
||||
</div> |
||||
</div> |
||||
<div class="margin-b-16"> |
||||
<h3><?php echo _('Download') ?></h3> |
||||
<a class="opacity-0 parent-hover-opacity-09 position-relative top-2" name="download" href="#download"> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link" viewBox="0 0 16 16"> |
||||
<path d="M6.354 5.5H4a3 3 0 0 0 0 6h3a3 3 0 0 0 2.83-4H9c-.086 0-.17.01-.25.031A2 2 0 0 1 7 10.5H4a2 2 0 1 1 0-4h1.535c.218-.376.495-.714.82-1z"/> |
||||
<path d="M9 5.5a3 3 0 0 0-2.83 4h1.098A2 2 0 0 1 9 6.5h3a2 2 0 1 1 0 4h-1.535a4.02 4.02 0 0 1-.82 1H12a3 3 0 1 0 0-6H9z"/> |
||||
</svg> |
||||
</a> |
||||
<div class="margin-t-16"> |
||||
<p class="margin-b-16"><?php echo _('To use torrents in Yggdrasil network, your client should support IPv6 protocol and listen Yggdrasil interface, instead or with regular internet connection.') ?></p> |
||||
<p class="margin-b-16"><?php echo _('<a href="https://www.qbittorrent.org/">qBittorrent</a> supports all required features, just check <strong>Preferences</strong> - <strong>Advanced</strong> - <strong>Optional IP address to bind</strong> and set to <strong>All addresses</strong> or Yggdrasil address only.') ?></p> |
||||
<p><?php echo sprintf(_('To start download, click %s icon and select available options: magnet or direct download.'), '<svg class="width-13px position-relative top-2" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-down-circle" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8zm15 0A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v5.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V4.5z"/></svg>') ?></p> |
||||
</div> |
||||
</div> |
||||
<div class="margin-b-16"> |
||||
<h3><?php echo _('Seeding') ?></h3> |
||||
<a class="opacity-0 parent-hover-opacity-09 position-relative top-2" name="seeding" href="#seeding"> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link" viewBox="0 0 16 16"> |
||||
<path d="M6.354 5.5H4a3 3 0 0 0 0 6h3a3 3 0 0 0 2.83-4H9c-.086 0-.17.01-.25.031A2 2 0 0 1 7 10.5H4a2 2 0 1 1 0-4h1.535c.218-.376.495-.714.82-1z"/> |
||||
<path d="M9 5.5a3 3 0 0 0-2.83 4h1.098A2 2 0 0 1 9 6.5h3a2 2 0 1 1 0 4h-1.535a4.02 4.02 0 0 1-.82 1H12a3 3 0 1 0 0-6H9z"/> |
||||
</svg> |
||||
</a> |
||||
<div class="margin-t-16"> |
||||
<p><?php echo _('To start seeding, make sure you have BitTorrent client configured to listen Yggdrasil interface.') ?></p> |
||||
<p><?php echo _('UPnP option not applying to router in Yggdrasil tunnels. But port open required in firewall rules.') ?></p> |
||||
<p><?php echo _('On changes completed, re-announce your connection to tracker, alternatively restart BitTorrent client.') ?></p> |
||||
</div> |
||||
</div> |
||||
<div class="margin-b-16 text-right padding-y-8 margin-b-8 border-bottom-default"> |
||||
<?php echo _('Development') ?> |
||||
</div> |
||||
<div class="margin-b-16"> |
||||
<h3><?php echo _('Deploy') ?></h3> |
||||
<a class="opacity-0 parent-hover-opacity-09 position-relative top-2" name="deploy" href="#deploy"> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link" viewBox="0 0 16 16"> |
||||
<path d="M6.354 5.5H4a3 3 0 0 0 0 6h3a3 3 0 0 0 2.83-4H9c-.086 0-.17.01-.25.031A2 2 0 0 1 7 10.5H4a2 2 0 1 1 0-4h1.535c.218-.376.495-.714.82-1z"/> |
||||
<path d="M9 5.5a3 3 0 0 0-2.83 4h1.098A2 2 0 0 1 9 6.5h3a2 2 0 1 1 0 4h-1.535a4.02 4.02 0 0 1-.82 1H12a3 3 0 1 0 0-6H9z"/> |
||||
</svg> |
||||
</a> |
||||
<div class="margin-t-16"> |
||||
<p class="margin-b-16"><?php echo _('At this moment, software and communication protocol under development.') ?></p> |
||||
<p><?php echo _('To deploy YGGtracker instance with features available before release, read <a href="https://github.com/YGGverse/YGGtracker#installation">Install</a> section.') ?></p> |
||||
<p><?php echo _('Please define your node in <a href="https://github.com/YGGverse/YGGtracker/blob/main/src/config/trackers.json">trackers.json</a> registry to participate shared model testing.') ?></p> |
||||
</div> |
||||
</div> |
||||
<div class="margin-b-16"> |
||||
<h3><?php echo _('Contribute') ?></h3> |
||||
<a class="opacity-0 parent-hover-opacity-09 position-relative top-2" name="contribute" href="#contribute"> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link" viewBox="0 0 16 16"> |
||||
<path d="M6.354 5.5H4a3 3 0 0 0 0 6h3a3 3 0 0 0 2.83-4H9c-.086 0-.17.01-.25.031A2 2 0 0 1 7 10.5H4a2 2 0 1 1 0-4h1.535c.218-.376.495-.714.82-1z"/> |
||||
<path d="M9 5.5a3 3 0 0 0-2.83 4h1.098A2 2 0 0 1 9 6.5h3a2 2 0 1 1 0 4h-1.535a4.02 4.02 0 0 1-.82 1H12a3 3 0 1 0 0-6H9z"/> |
||||
</svg> |
||||
</a> |
||||
<div class="margin-t-16"> |
||||
<p class="margin-b-16"><?php echo _('Ideas or bug reports on <a href="https://github.com/YGGverse/YGGtracker/issues">Issues</a> page!') ?></p> |
||||
</div> |
||||
</div> |
||||
<?php } else { ?> |
||||
<div class="text-center"><?php echo $response->message ?></div> |
||||
<?php } ?> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</main> |
||||
<footer> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100 text-center margin-y-8"> |
||||
<?php foreach (json_decode(file_get_contents(__DIR__ . '/../config/trackers.json')) as $i => $tracker) { ?> |
||||
<?php if (!empty($tracker->announce) && !empty($tracker->stats)) { ?> |
||||
<a href="<?php echo $tracker->announce ?>"><?php echo sprintf('Tracker %s', $i + 1) ?></a> |
||||
/ |
||||
<a href="<?php echo $tracker->stats ?>"><?php echo _('Stats') ?></a> |
||||
| |
||||
<?php } ?> |
||||
<?php } ?> |
||||
<a href="<?php echo WEBSITE_URL ?>/faq.php"><?php echo _('F.A.Q') ?></a> |
||||
| |
||||
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss"><?php echo _('RSS') ?></a> |
||||
<?php if (API_EXPORT_ENABLED) { ?> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a> |
||||
<?php } ?> |
||||
| |
||||
<a href="https://github.com/YGGverse/YGGtracker"><?php echo _('GitHub') ?></a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</footer> |
||||
</body> |
||||
</html> |
@ -1,508 +0,0 @@
@@ -1,508 +0,0 @@
|
||||
<?php |
||||
|
||||
// Bootstrap |
||||
require_once __DIR__ . '/../config/bootstrap.php'; |
||||
|
||||
// Define response |
||||
$response = (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
'magnet' => [], |
||||
'comments' => [], |
||||
]; |
||||
|
||||
// Yggdrasil connections only |
||||
if (!Valid::host($_SERVER['REMOTE_ADDR'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Yggdrasil connection required to enable resource features'); |
||||
} |
||||
|
||||
// Init session |
||||
else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user session'); |
||||
} |
||||
|
||||
// Get user |
||||
else if (!$user = $db->getUser($userId)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user info'); |
||||
} |
||||
|
||||
// Init magnet |
||||
else if (!$magnet = $db->getMagnet(isset($_GET['magnetId']) ? (int) $_GET['magnetId'] : 0)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Magnet not found! Submit new magnet link by sending address to the search field.'); |
||||
} |
||||
|
||||
// On first visit, redirect user to the welcome page with access level question |
||||
else if (is_null($user->public) && !isset($_GET['rss'])) |
||||
{ |
||||
header( |
||||
sprintf('Location: %s/welcome.php', WEBSITE_URL) |
||||
); |
||||
} |
||||
|
||||
// Request valid |
||||
else |
||||
{ |
||||
// Get access info |
||||
$accessRead = ($user->address == $db->getUser($magnet->userId)->address || in_array($user->address, MODERATOR_IP_LIST) || ($magnet->public && $magnet->approved)); |
||||
$accessEdit = ($user->address == $db->getUser($magnet->userId)->address || in_array($user->address, MODERATOR_IP_LIST)); |
||||
|
||||
// Update magnet viewed |
||||
if ($accessRead) |
||||
{ |
||||
if ($magnetViewId = $db->addMagnetView($magnet->magnetId, $userId, time())) |
||||
{ |
||||
// Push event to other nodes |
||||
if (API_EXPORT_ENABLED && |
||||
API_EXPORT_PUSH_ENABLED && |
||||
API_EXPORT_USERS_ENABLED && |
||||
API_EXPORT_MAGNETS_ENABLED && |
||||
API_EXPORT_MAGNET_VIEWS_ENABLED) |
||||
{ |
||||
if (!$memoryApiExportPush = $memory->get('api.export.push')) |
||||
{ |
||||
$memoryApiExportPush = []; |
||||
} |
||||
|
||||
$memoryApiExportPush[] = (object) |
||||
[ |
||||
'time' => time(), |
||||
'userId' => $user->userId, |
||||
'magnetId' => $magnet->magnetId, |
||||
'magnetViewId' => $magnetViewId |
||||
]; |
||||
|
||||
$memory->set('api.export.push', $memoryApiExportPush, 3600); |
||||
} |
||||
} |
||||
} |
||||
|
||||
// Keywords |
||||
$keywords = []; |
||||
|
||||
foreach ($db->findKeywordTopicByMagnetId($magnet->magnetId) as $keyword) |
||||
{ |
||||
$keywords[] = $db->getKeywordTopic($keyword->keywordTopicId)->value; |
||||
} |
||||
|
||||
$response->user = $user; |
||||
$response->magnet = (object) |
||||
[ |
||||
'magnetId' => $magnet->magnetId, |
||||
'title' => $magnet->title ? htmlentities($magnet->title) : ($magnet->dn ? htmlentities($magnet->dn): false), |
||||
'preview' => $magnet->preview ? nl2br( |
||||
htmlentities( |
||||
$magnet->preview |
||||
) |
||||
) : false, |
||||
'description' => $magnet->description ? nl2br( |
||||
htmlentities( |
||||
$magnet->description |
||||
) |
||||
) : false, |
||||
'approved' => (bool) $magnet->approved, |
||||
'public' => (bool) $magnet->public, |
||||
'sensitive' => (bool) $magnet->sensitive, |
||||
'comments' => (bool) $magnet->comments, |
||||
'timeAdded' => $magnet->timeAdded ? Time::ago((int) $magnet->timeAdded) : false, |
||||
'timeUpdated' => $magnet->timeUpdated ? Time::ago((int) $magnet->timeUpdated) : false, |
||||
'keywords' => $keywords, |
||||
'comment' => (object) |
||||
[ |
||||
'total' => $db->findMagnetCommentsTotalByMagnetId($magnet->magnetId), |
||||
'status' => $db->findMagnetCommentsTotal($magnet->magnetId, $userId), |
||||
], |
||||
'download' => (object) |
||||
[ |
||||
'total' => $db->findMagnetDownloadsTotalByMagnetId($magnet->magnetId), |
||||
'status' => $db->findMagnetDownloadsTotal($magnet->magnetId, $userId), |
||||
], |
||||
'star' => (object) |
||||
[ |
||||
'total' => $db->findMagnetStarsTotalByMagnetId($magnet->magnetId, true), |
||||
'status' => $db->findLastMagnetStarValue($magnet->magnetId, $userId), |
||||
], |
||||
'access' => (object) |
||||
[ |
||||
'read' => $accessRead, |
||||
'edit' => $accessEdit, |
||||
], |
||||
'seeders' => $db->getMagnetToAddressTrackerSeedersSumByMagnetId($magnet->magnetId), |
||||
'completed' => $db->getMagnetToAddressTrackerCompletedSumByMagnetId($magnet->magnetId), |
||||
'leechers' => $db->getMagnetToAddressTrackerLeechersSumByMagnetId($magnet->magnetId), |
||||
'directs' => $db->getMagnetToAcceptableSourceTotalByMagnetId($magnet->magnetId), |
||||
]; |
||||
} |
||||
|
||||
if (isset($_GET['rss']) && isset($_GET['target']) && $_GET['target'] == 'comment' && $response->success) { ?><?php |
||||
header('Content-type: text/xml;charset=UTF-8'); |
||||
echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?> |
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"> |
||||
<channel> |
||||
<atom:link href="<?php echo sprintf('%s/magnet.php?magnetId=%s#comment', WEBSITE_URL, $response->magnet->magnetId) ?>" rel="self" type="application/rss+xml"></atom:link> |
||||
<link><?php echo sprintf('%s/magnet.php?magnetId=%s#comment', WEBSITE_URL, $response->magnet->magnetId) ?></link> |
||||
<title><?php echo sprintf(_('%s - Comments - %s'), htmlentities($response->magnet->title), WEBSITE_NAME) ?></title> |
||||
<description><?php echo _('BitTorrent Registry for Yggdrasil') ?></description> |
||||
<?php foreach ($db->findMagnetComments($response->magnet->magnetId) as $magnetComment) { ?> |
||||
<?php if ($response->user->address == $db->getUser($magnetComment->userId)->address || in_array($response->user->address, MODERATOR_IP_LIST)) { ?> |
||||
<item> |
||||
<title><?php echo sprintf('%s - comment #%s', htmlspecialchars($magnet->title, ENT_QUOTES, 'UTF-8'), $magnetComment->magnetCommentId) ?></title> |
||||
<description><?php echo htmlspecialchars($magnetComment->value, ENT_QUOTES, 'UTF-8') ?></description> |
||||
<guid><?php echo sprintf('%s/magnet.php?magnetId=%s#comment-%s', WEBSITE_URL, $response->magnet->magnetId, $magnetComment->magnetCommentId) ?></guid> |
||||
<link><?php echo sprintf('%s/magnet.php?magnetId=%s#comment-%s', WEBSITE_URL, $response->magnet->magnetId, $magnetComment->magnetCommentId) ?></link> |
||||
</item> |
||||
<?php } ?> |
||||
<?php } ?> |
||||
</channel> |
||||
</rss> |
||||
<?php } else { ?> |
||||
<!DOCTYPE html> |
||||
<html lang="en-US"> |
||||
<head> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/common.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/framework.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<?php if ($response->success) { ?> |
||||
<title><?php echo sprintf(_('%s - %s'), htmlentities($response->magnet->title), WEBSITE_NAME) ?></title> |
||||
<meta name="description" content="<?php echo htmlentities($response->magnet->preview) ?>" /> |
||||
<meta name="keywords" content="<?php echo htmlentities(implode(',',$response->magnet->keywords)) ?>" /> |
||||
<?php } else { ?> |
||||
<title><?php echo $response->message ?></title> |
||||
<?php } ?> |
||||
<meta name="author" content="YGGtracker" /> |
||||
<meta charset="UTF-8" /> |
||||
</head> |
||||
<body> |
||||
<header> |
||||
<div class="container"> |
||||
<div class="row margin-t-8 text-center"> |
||||
<a class="logo" href="<?php echo WEBSITE_URL ?>"><?php echo str_replace('YGG', '<span>YGG</span>', WEBSITE_NAME) ?></a> |
||||
<form class="margin-t-8" name="search" method="get" action="<?php echo WEBSITE_URL ?>/index.php"> |
||||
<input type="text" name="query" value="" placeholder="<?php echo _('search or submit magnet link') ?>" /> |
||||
<input type="submit" value="<?php echo _('submit') ?>" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</header> |
||||
<main> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100"> |
||||
<?php if ($response->success) { ?> |
||||
<?php if ($response->magnet->access->read) { ?> |
||||
<div class="margin-y-8 |
||||
border-radius-3 |
||||
background-color-night |
||||
<?php echo !$response->magnet->public || !$response->magnet->approved ? 'opacity-06 opacity-hover-1' : false ?>"> |
||||
<div class="padding-16 <?php echo $response->magnet->sensitive ? 'blur-2 blur-hover-0' : false ?>"> |
||||
<a name="magnet-<?php echo $response->magnet->magnetId ?>"></a> |
||||
<h1 class="margin-b-8"><?php echo $response->magnet->title ?></h1> |
||||
<?php if ($response->magnet->leechers && !$response->magnet->seeders) { ?> |
||||
<span class="label label-green margin-x-4 font-size-10 position-relative top--2 cursor-default" |
||||
title="<?php echo _('Active leechers waiting for seeds') ?>"> |
||||
<?php echo _('wanted') ?> |
||||
</span> |
||||
<?php } ?> |
||||
<div class="float-right opacity-0 parent-hover-opacity-09"> |
||||
<?php if (!$response->magnet->public) { ?> |
||||
<span class="margin-l-8" title="<?php echo _('Private') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye-slash-fill" viewBox="0 0 16 16"> |
||||
<path d="m10.79 12.912-1.614-1.615a3.5 3.5 0 0 1-4.474-4.474l-2.06-2.06C.938 6.278 0 8 0 8s3 5.5 8 5.5a7.029 7.029 0 0 0 2.79-.588zM5.21 3.088A7.028 7.028 0 0 1 8 2.5c5 0 8 5.5 8 5.5s-.939 1.721-2.641 3.238l-2.062-2.062a3.5 3.5 0 0 0-4.474-4.474L5.21 3.089z"/> |
||||
<path d="M5.525 7.646a2.5 2.5 0 0 0 2.829 2.829l-2.83-2.829zm4.95.708-2.829-2.83a2.5 2.5 0 0 1 2.829 2.829zm3.171 6-12-12 .708-.708 12 12-.708.708z"/> |
||||
</svg> |
||||
</span> |
||||
<?php } ?> |
||||
<?php if (!$response->magnet->approved) { ?> |
||||
<span class="margin-l-8" title="<?php echo _('Waiting for approve') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-hourglass-split" viewBox="0 0 16 16"> |
||||
<path d="M2.5 15a.5.5 0 1 1 0-1h1v-1a4.5 4.5 0 0 1 2.557-4.06c.29-.139.443-.377.443-.59v-.7c0-.213-.154-.451-.443-.59A4.5 4.5 0 0 1 3.5 3V2h-1a.5.5 0 0 1 0-1h11a.5.5 0 0 1 0 1h-1v1a4.5 4.5 0 0 1-2.557 4.06c-.29.139-.443.377-.443.59v.7c0 .213.154.451.443.59A4.5 4.5 0 0 1 12.5 13v1h1a.5.5 0 0 1 0 1h-11zm2-13v1c0 .537.12 1.045.337 1.5h6.326c.216-.455.337-.963.337-1.5V2h-7zm3 6.35c0 .701-.478 1.236-1.011 1.492A3.5 3.5 0 0 0 4.5 13s.866-1.299 3-1.48V8.35zm1 0v3.17c2.134.181 3 1.48 3 1.48a3.5 3.5 0 0 0-1.989-3.158C8.978 9.586 8.5 9.052 8.5 8.351z"/> |
||||
</svg> |
||||
</span> |
||||
<?php } ?> |
||||
<?php if ($response->magnet->access->edit) { ?> |
||||
<a class="text-color-green margin-l-12" href="<?php echo WEBSITE_URL ?>/edit.php?magnetId=<?php echo $response->magnet->magnetId ?>" title="<?php echo _('Edit') ?>"> |
||||
<svg class="text-color-green" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-square" viewBox="0 0 16 16"> |
||||
<path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/> |
||||
<path fill-rule="evenodd" d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z"/> |
||||
</svg> |
||||
</a> |
||||
<?php } else { ?> |
||||
<!-- TODO |
||||
<a class="text-color-pink margin-l-12" rel="nofollow" href="<?php echo WEBSITE_URL ?>/action.php?target=magnet&toggle=report&magnetId=<?php echo $response->magnet->magnetId ?>&callback=<?php echo base64_encode(sprintf('%s/index.php?query=%s#magnet-%s', WEBSITE_URL, urlencode($request->query), $magnet->magnetId)) ?>" title="<?php echo _('Report') ?>"> |
||||
<svg class="text-color-pink" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-flag" viewBox="0 0 16 16"> |
||||
<path d="M14.778.085A.5.5 0 0 1 15 .5V8a.5.5 0 0 1-.314.464L14.5 8l.186.464-.003.001-.006.003-.023.009a12.435 12.435 0 0 1-.397.15c-.264.095-.631.223-1.047.35-.816.252-1.879.523-2.71.523-.847 0-1.548-.28-2.158-.525l-.028-.01C7.68 8.71 7.14 8.5 6.5 8.5c-.7 0-1.638.23-2.437.477A19.626 19.626 0 0 0 3 9.342V15.5a.5.5 0 0 1-1 0V.5a.5.5 0 0 1 1 0v.282c.226-.079.496-.17.79-.26C4.606.272 5.67 0 6.5 0c.84 0 1.524.277 2.121.519l.043.018C9.286.788 9.828 1 10.5 1c.7 0 1.638-.23 2.437-.477a19.587 19.587 0 0 0 1.349-.476l.019-.007.004-.002h.001M14 1.221c-.22.078-.48.167-.766.255-.81.252-1.872.523-2.734.523-.886 0-1.592-.286-2.203-.534l-.008-.003C7.662 1.21 7.139 1 6.5 1c-.669 0-1.606.229-2.415.478A21.294 21.294 0 0 0 3 1.845v6.433c.22-.078.48-.167.766-.255C4.576 7.77 5.638 7.5 6.5 7.5c.847 0 1.548.28 2.158.525l.028.01C9.32 8.29 9.86 8.5 10.5 8.5c.668 0 1.606-.229 2.415-.478A21.317 21.317 0 0 0 14 7.655V1.222z"/> |
||||
</svg> |
||||
</a> |
||||
--> |
||||
<?php } ?> |
||||
</div> |
||||
<?php if ($response->magnet->preview) { ?> |
||||
<div class="margin-y-8"><?php echo $response->magnet->preview ?></div> |
||||
<?php } ?> |
||||
<?php if ($response->magnet->description) { ?> |
||||
<div class="margin-t-16 margin-b-8 padding-t-16 border-top-default"><?php echo $response->magnet->description ?></div> |
||||
<?php } ?> |
||||
<?php if ($response->magnet->keywords) { ?> |
||||
<div class="margin-y-8"> |
||||
<?php foreach ($response->magnet->keywords as $keyword) { ?> |
||||
<small> |
||||
<a href="<?php echo WEBSITE_URL ?>/index.php?query=<?php echo urlencode($keyword) ?>">#<?php echo htmlentities($keyword) ?></a> |
||||
</small> |
||||
<?php } ?> |
||||
</div> |
||||
<?php } ?> |
||||
<div class="width-100 padding-y-4"></div> |
||||
<!-- DOUBTS |
||||
<span class="margin-t-8 margin-r-8 cursor-default" title="<?php echo $response->magnet->timeUpdated ? _('Updated') : _('Added') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clock" viewBox="0 0 16 16"> |
||||
<path d="M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71V3.5z"/> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0z"/> |
||||
</svg> |
||||
<sup><?php echo $response->magnet->timeUpdated ? $response->magnet->timeUpdated : $response->magnet->timeAdded ?></sup> |
||||
</span> |
||||
--> |
||||
<span class="margin-t-8 margin-r-8 cursor-default"> |
||||
<sup> |
||||
<?php echo $response->magnet->timeUpdated ? _('Updated') : _('Added') ?> |
||||
<?php echo $response->magnet->timeUpdated ? $response->magnet->timeUpdated : $response->magnet->timeAdded ?> |
||||
</sup> |
||||
</span> |
||||
<span class="margin-t-8 margin-r-8 cursor-default opacity-0 parent-hover-opacity-09" title="<?php echo _('Seeds') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-up" viewBox="0 0 16 16"> |
||||
<path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5z"/> |
||||
</svg> |
||||
<sup><?php echo $response->magnet->seeders ?></sup> |
||||
</span> |
||||
<span class="margin-t-8 margin-r-8 cursor-default opacity-0 parent-hover-opacity-09" title="<?php echo _('Peers') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-down" viewBox="0 0 16 16"> |
||||
<path fill-rule="evenodd" d="M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1z"/> |
||||
</svg> |
||||
<sup><?php echo $response->magnet->completed ?></sup> |
||||
</span> |
||||
<span class="margin-t-8 margin-r-8 cursor-default opacity-0 parent-hover-opacity-09" title="<?php echo _('Leechers') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-cup-hot" viewBox="0 0 16 16"> |
||||
<path fill-rule="evenodd" d="M.5 6a.5.5 0 0 0-.488.608l1.652 7.434A2.5 2.5 0 0 0 4.104 16h5.792a2.5 2.5 0 0 0 2.44-1.958l.131-.59a3 3 0 0 0 1.3-5.854l.221-.99A.5.5 0 0 0 13.5 6H.5ZM13 12.5a2.01 2.01 0 0 1-.316-.025l.867-3.898A2.001 2.001 0 0 1 13 12.5ZM2.64 13.825 1.123 7h11.754l-1.517 6.825A1.5 1.5 0 0 1 9.896 15H4.104a1.5 1.5 0 0 1-1.464-1.175Z"/> |
||||
<path d="m4.4.8-.003.004-.014.019a4.167 4.167 0 0 0-.204.31 2.327 2.327 0 0 0-.141.267c-.026.06-.034.092-.037.103v.004a.593.593 0 0 0 .091.248c.075.133.178.272.308.445l.01.012c.118.158.26.347.37.543.112.2.22.455.22.745 0 .188-.065.368-.119.494a3.31 3.31 0 0 1-.202.388 5.444 5.444 0 0 1-.253.382l-.018.025-.005.008-.002.002A.5.5 0 0 1 3.6 4.2l.003-.004.014-.019a4.149 4.149 0 0 0 .204-.31 2.06 2.06 0 0 0 .141-.267c.026-.06.034-.092.037-.103a.593.593 0 0 0-.09-.252A4.334 4.334 0 0 0 3.6 2.8l-.01-.012a5.099 5.099 0 0 1-.37-.543A1.53 1.53 0 0 1 3 1.5c0-.188.065-.368.119-.494.059-.138.134-.274.202-.388a5.446 5.446 0 0 1 .253-.382l.025-.035A.5.5 0 0 1 4.4.8Zm3 0-.003.004-.014.019a4.167 4.167 0 0 0-.204.31 2.327 2.327 0 0 0-.141.267c-.026.06-.034.092-.037.103v.004a.593.593 0 0 0 .091.248c.075.133.178.272.308.445l.01.012c.118.158.26.347.37.543.112.2.22.455.22.745 0 .188-.065.368-.119.494a3.31 3.31 0 0 1-.202.388 5.444 5.444 0 0 1-.253.382l-.018.025-.005.008-.002.002A.5.5 0 0 1 6.6 4.2l.003-.004.014-.019a4.149 4.149 0 0 0 .204-.31 2.06 2.06 0 0 0 .141-.267c.026-.06.034-.092.037-.103a.593.593 0 0 0-.09-.252A4.334 4.334 0 0 0 6.6 2.8l-.01-.012a5.099 5.099 0 0 1-.37-.543A1.53 1.53 0 0 1 6 1.5c0-.188.065-.368.119-.494.059-.138.134-.274.202-.388a5.446 5.446 0 0 1 .253-.382l.025-.035A.5.5 0 0 1 7.4.8Zm3 0-.003.004-.014.019a4.077 4.077 0 0 0-.204.31 2.337 2.337 0 0 0-.141.267c-.026.06-.034.092-.037.103v.004a.593.593 0 0 0 .091.248c.075.133.178.272.308.445l.01.012c.118.158.26.347.37.543.112.2.22.455.22.745 0 .188-.065.368-.119.494a3.198 3.198 0 0 1-.202.388 5.385 5.385 0 0 1-.252.382l-.019.025-.005.008-.002.002A.5.5 0 0 1 9.6 4.2l.003-.004.014-.019a4.149 4.149 0 0 0 .204-.31 2.06 2.06 0 0 0 .141-.267c.026-.06.034-.092.037-.103a.593.593 0 0 0-.09-.252A4.334 4.334 0 0 0 9.6 2.8l-.01-.012a5.099 5.099 0 0 1-.37-.543A1.53 1.53 0 0 1 9 1.5c0-.188.065-.368.119-.494.059-.138.134-.274.202-.388a5.446 5.446 0 0 1 .253-.382l.025-.035A.5.5 0 0 1 10.4.8Z"/> |
||||
</svg> |
||||
<sup><?php echo $response->magnet->leechers ?></sup> |
||||
</span> |
||||
<?php if ($response->magnet->directs) { ?> |
||||
<span class="margin-t-8 margin-r-8 cursor-default opacity-0 parent-hover-opacity-09" title="<?php echo _('Direct') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-database" viewBox="0 0 16 16"> |
||||
<path d="M4.318 2.687C5.234 2.271 6.536 2 8 2s2.766.27 3.682.687C12.644 3.125 13 3.627 13 4c0 .374-.356.875-1.318 1.313C10.766 5.729 9.464 6 8 6s-2.766-.27-3.682-.687C3.356 4.875 3 4.373 3 4c0-.374.356-.875 1.318-1.313ZM13 5.698V7c0 .374-.356.875-1.318 1.313C10.766 8.729 9.464 9 8 9s-2.766-.27-3.682-.687C3.356 7.875 3 7.373 3 7V5.698c.271.202.58.378.904.525C4.978 6.711 6.427 7 8 7s3.022-.289 4.096-.777A4.92 4.92 0 0 0 13 5.698ZM14 4c0-1.007-.875-1.755-1.904-2.223C11.022 1.289 9.573 1 8 1s-3.022.289-4.096.777C2.875 2.245 2 2.993 2 4v9c0 1.007.875 1.755 1.904 2.223C4.978 15.71 6.427 16 8 16s3.022-.289 4.096-.777C13.125 14.755 14 14.007 14 13V4Zm-1 4.698V10c0 .374-.356.875-1.318 1.313C10.766 11.729 9.464 12 8 12s-2.766-.27-3.682-.687C3.356 10.875 3 10.373 3 10V8.698c.271.202.58.378.904.525C4.978 9.71 6.427 10 8 10s3.022-.289 4.096-.777A4.92 4.92 0 0 0 13 8.698Zm0 3V13c0 .374-.356.875-1.318 1.313C10.766 14.729 9.464 15 8 15s-2.766-.27-3.682-.687C3.356 13.875 3 13.373 3 13v-1.302c.271.202.58.378.904.525C4.978 12.71 6.427 13 8 13s3.022-.289 4.096-.777c.324-.147.633-.323.904-.525Z"/> |
||||
</svg> |
||||
<sup><?php echo $response->magnet->directs ?></sup> |
||||
</span> |
||||
<?php } ?> |
||||
<span class="float-right margin-l-12"> |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/action.php?target=magnet&toggle=star&magnetId=<?php echo $response->magnet->magnetId ?>&callback=<?php echo base64_encode(sprintf('%s/magnet.php?magnetId=%s', WEBSITE_URL, $response->magnet->magnetId)) ?>" title="<?php echo _('Star') ?>"> |
||||
<?php if ($response->magnet->star->status) { ?> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-star-fill" viewBox="0 0 16 16"> |
||||
<path d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z"/> |
||||
</svg> |
||||
<?php } else { ?> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-star" viewBox="0 0 16 16"> |
||||
<path d="M2.866 14.85c-.078.444.36.791.746.593l4.39-2.256 4.389 2.256c.386.198.824-.149.746-.592l-.83-4.73 3.522-3.356c.33-.314.16-.888-.282-.95l-4.898-.696L8.465.792a.513.513 0 0 0-.927 0L5.354 5.12l-4.898.696c-.441.062-.612.636-.283.95l3.523 3.356-.83 4.73zm4.905-2.767-3.686 1.894.694-3.957a.565.565 0 0 0-.163-.505L1.71 6.745l4.052-.576a.525.525 0 0 0 .393-.288L8 2.223l1.847 3.658a.525.525 0 0 0 .393.288l4.052.575-2.906 2.77a.565.565 0 0 0-.163.506l.694 3.957-3.686-1.894a.503.503 0 0 0-.461 0z"/> |
||||
</svg> |
||||
<?php } ?> |
||||
</a> |
||||
<sup><?php echo $response->magnet->star->total ?></sup> |
||||
</span> |
||||
<?php if ($response->magnet->comments) { ?> |
||||
<span class="float-right margin-l-12"> |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/magnet.php?magnetId=<?php echo $magnet->magnetId ?>#comment" title="<?php echo _('Comment') ?>"> |
||||
<?php if ($response->magnet->comment->status) { ?> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chat-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 15c4.418 0 8-3.134 8-7s-3.582-7-8-7-8 3.134-8 7c0 1.76.743 3.37 1.97 4.6-.097 1.016-.417 2.13-.771 2.966-.079.186.074.394.273.362 2.256-.37 3.597-.938 4.18-1.234A9.06 9.06 0 0 0 8 15z"/> |
||||
</svg> |
||||
<?php } else { ?> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chat" viewBox="0 0 16 16"> |
||||
<path d="M2.678 11.894a1 1 0 0 1 .287.801 10.97 10.97 0 0 1-.398 2c1.395-.323 2.247-.697 2.634-.893a1 1 0 0 1 .71-.074A8.06 8.06 0 0 0 8 14c3.996 0 7-2.807 7-6 0-3.192-3.004-6-7-6S1 4.808 1 8c0 1.468.617 2.83 1.678 3.894zm-.493 3.905a21.682 21.682 0 0 1-.713.129c-.2.032-.352-.176-.273-.362a9.68 9.68 0 0 0 .244-.637l.003-.01c.248-.72.45-1.548.524-2.319C.743 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7-3.582 7-8 7a9.06 9.06 0 0 1-2.347-.306c-.52.263-1.639.742-3.468 1.105z"/> |
||||
</svg> |
||||
<?php } ?> |
||||
</a> |
||||
<sup><?php echo $response->magnet->comment->total ?></sup> |
||||
</span> |
||||
<?php } ?> |
||||
<span class="float-right margin-l-12"> |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/download.php?magnetId=<?php echo $response->magnet->magnetId ?>" title="<?php echo _('Download') ?>"> |
||||
<?php if ($response->magnet->download->status) { ?> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-down-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v5.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V4.5z"/> |
||||
</svg> |
||||
<?php } else { ?> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-down-circle" viewBox="0 0 16 16"> |
||||
<path fill-rule="evenodd" d="M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8zm15 0A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v5.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V4.5z"/> |
||||
</svg> |
||||
<?php } ?> |
||||
</a> |
||||
<sup><?php echo $response->magnet->download->total ?></sup> |
||||
</span> |
||||
</div> |
||||
</div> |
||||
<?php if ($similarMagnetsTotal = $sphinx->searchMagnetsTotal($magnet->title ? $magnet->title : $magnet->dn, 'similar', MAGNET_STOP_WORDS_SIMILAR)) { ?> |
||||
<?php if ($similarMagnetsTotal > 1) { // skip current magnet ?>
|
||||
<div class="padding-y-8 padding-x-16"> |
||||
<a name="similar"></a> |
||||
<h3><?php echo _('Similar') ?></h3> |
||||
</div> |
||||
<div class="padding-x-16 margin-b-8"> |
||||
<div class="padding-16 margin-t-8 border-radius-3 background-color-night"> |
||||
<?php foreach ( $sphinx->searchMagnets( |
||||
$magnet->title ? $magnet->title : $magnet->dn, |
||||
0, |
||||
10, |
||||
$similarMagnetsTotal, |
||||
'similar', |
||||
MAGNET_STOP_WORDS_SIMILAR |
||||
) as $result) { ?> |
||||
<?php if ($magnet = $db->getMagnet($result->magnetid)) { ?> |
||||
<?php if ($result->magnetid != $response->magnet->magnetId && // skip current magnet
|
||||
($response->user->address == $db->getUser($magnet->userId)->address || |
||||
in_array($response->user->address, MODERATOR_IP_LIST) || ($magnet->approved && $magnet->public))) { ?> |
||||
<div class="margin-y-8"> |
||||
<a href="<?php echo sprintf('%s/magnet.php?magnetId=%s', WEBSITE_URL, $magnet->magnetId) ?>" class="margin-b-16"> |
||||
<?php echo nl2br(htmlentities($magnet->title ? $magnet->title : $magnet->dn)) ?> |
||||
</a> |
||||
</div> |
||||
<?php } ?> |
||||
<?php } ?> |
||||
<?php } ?> |
||||
</div> |
||||
</div> |
||||
<?php } ?> |
||||
<?php } ?> |
||||
<?php if ($response->magnet->comments) { ?> |
||||
<div class="padding-y-8 padding-x-16"> |
||||
<a name="comment"></a> |
||||
<h3><?php echo _('Comments') ?></h3> |
||||
<sup><small><a href="<?php echo sprintf('%s/magnet.php?rss&magnetId=%s&target=comment', WEBSITE_URL, $response->magnet->magnetId) ?>"><?php echo _('RSS') ?></a></small></sup> |
||||
</div> |
||||
<div class="padding-x-16"> |
||||
<?php foreach ($db->findMagnetComments($response->magnet->magnetId) as $magnetComment) { ?> |
||||
<div class="padding-x-16 padding-t-16 padding-b-8 margin-t-8 border-radius-3 background-color-night <?php echo !$magnetComment->approved || !$magnetComment->public ? 'opacity-06 opacity-hover-1' : false ?>"> |
||||
<a name="comment-<?php echo $magnetComment->magnetCommentId ?>"></a> |
||||
<?php if ($response->user->address == $db->getUser($magnetComment->userId)->address || |
||||
in_array($response->user->address, MODERATOR_IP_LIST) || |
||||
($magnetComment->approved && $magnetComment->public)) { ?> |
||||
<div class="margin-b-16"> |
||||
<?php echo nl2br(htmlentities($magnetComment->value)) ?> |
||||
</div> |
||||
<?php if (USER_DEFAULT_IDENTICON) { ?> |
||||
<img class="float-left margin-r-4" |
||||
alt="" |
||||
src="<?php echo sprintf('%s/action.php?target=profile&toggle=%s&userId=%s&size=16', |
||||
WEBSITE_URL, |
||||
USER_DEFAULT_IDENTICON, |
||||
$magnetComment->userId) ?>" /> |
||||
<?php } ?> |
||||
<sup> |
||||
<?php echo Time::ago((int) $magnetComment->timeAdded) ?> |
||||
</sup> |
||||
<span class="opacity-0 parent-hover-opacity-09"> |
||||
<?php if (!$magnetComment->public) { ?> |
||||
<span class="margin-l-8" title="<?php echo _('Private') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye-slash-fill" viewBox="0 0 16 16"> |
||||
<path d="m10.79 12.912-1.614-1.615a3.5 3.5 0 0 1-4.474-4.474l-2.06-2.06C.938 6.278 0 8 0 8s3 5.5 8 5.5a7.029 7.029 0 0 0 2.79-.588zM5.21 3.088A7.028 7.028 0 0 1 8 2.5c5 0 8 5.5 8 5.5s-.939 1.721-2.641 3.238l-2.062-2.062a3.5 3.5 0 0 0-4.474-4.474L5.21 3.089z"/> |
||||
<path d="M5.525 7.646a2.5 2.5 0 0 0 2.829 2.829l-2.83-2.829zm4.95.708-2.829-2.83a2.5 2.5 0 0 1 2.829 2.829zm3.171 6-12-12 .708-.708 12 12-.708.708z"/> |
||||
</svg> |
||||
</span> |
||||
<?php } ?> |
||||
<?php if (!$magnetComment->approved) { ?> |
||||
<span class="margin-l-8" title="<?php echo _('Waiting for approve') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-hourglass-split" viewBox="0 0 16 16"> |
||||
<path d="M2.5 15a.5.5 0 1 1 0-1h1v-1a4.5 4.5 0 0 1 2.557-4.06c.29-.139.443-.377.443-.59v-.7c0-.213-.154-.451-.443-.59A4.5 4.5 0 0 1 3.5 3V2h-1a.5.5 0 0 1 0-1h11a.5.5 0 0 1 0 1h-1v1a4.5 4.5 0 0 1-2.557 4.06c-.29.139-.443.377-.443.59v.7c0 .213.154.451.443.59A4.5 4.5 0 0 1 12.5 13v1h1a.5.5 0 0 1 0 1h-11zm2-13v1c0 .537.12 1.045.337 1.5h6.326c.216-.455.337-.963.337-1.5V2h-7zm3 6.35c0 .701-.478 1.236-1.011 1.492A3.5 3.5 0 0 0 4.5 13s.866-1.299 3-1.48V8.35zm1 0v3.17c2.134.181 3 1.48 3 1.48a3.5 3.5 0 0 0-1.989-3.158C8.978 9.586 8.5 9.052 8.5 8.351z"/> |
||||
</svg> |
||||
</span> |
||||
<?php } ?> |
||||
<small> |
||||
<?php if (in_array($response->user->address, MODERATOR_IP_LIST)) { ?> |
||||
<a class="float-right margin-l-12" |
||||
href="<?php echo WEBSITE_URL ?>/action.php?target=comment&toggle=approved&magnetCommentId=<?php echo $magnetComment->magnetCommentId ?>&callback=<?php echo base64_encode(sprintf('%s/magnet.php?magnetId=%s#comment-%s', WEBSITE_URL, $magnetComment->magnetId, $magnetComment->magnetCommentId)) ?>"> |
||||
<?php if ($magnetComment->approved) { ?> |
||||
<?php echo _('disapprove') ?> |
||||
<?php } else { ?> |
||||
<?php echo _('approve') ?> |
||||
<?php } ?> |
||||
</a> |
||||
<?php } ?> |
||||
</small> |
||||
</span> |
||||
<?php } else { ?> |
||||
<div class="margin-b-8"><?php echo _('hidden content') ?></div> |
||||
<?php } ?> |
||||
</div> |
||||
<?php } ?> |
||||
<form name="comment" |
||||
method="post" |
||||
action="<?php echo sprintf('%s/action.php?target=comment&toggle=new&magnetId=%s&callback=%s', |
||||
WEBSITE_URL, |
||||
$response->magnet->magnetId, |
||||
base64_encode(sprintf('%s/magnet.php?magnetId=%s', |
||||
WEBSITE_URL, |
||||
$response->magnet->magnetId))) ?>"> |
||||
<div class="padding-y-8"> |
||||
<textarea class="width-100 padding-16" |
||||
name="comment" |
||||
value="" |
||||
placeholder="<?php echo _('Enter your comment') ?>" |
||||
minlength="<?php echo MAGNET_COMMENT_MIN_LENGTH ?>" |
||||
maxlength="<?php echo MAGNET_COMMENT_MAX_LENGTH ?>"></textarea> |
||||
</div> |
||||
<div class="padding-b-8 text-right"> |
||||
<input type="submit" value="<?php echo _('send') ?>" /> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
<?php } ?> |
||||
<?php } else { ?> |
||||
<div class="padding-16 margin-y-8 border-radius-3 background-color-night"> |
||||
<div><?php echo _('Magnet not public') ?></div> |
||||
</div> |
||||
<?php } ?> |
||||
<?php } else { ?> |
||||
<div class="padding-16 margin-y-8 border-radius-3 background-color-night"> |
||||
<div class="text-center"><?php echo $response->message ?></div> |
||||
</div> |
||||
<?php } ?> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</main> |
||||
<footer> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100 text-center margin-y-8"> |
||||
<?php foreach (json_decode(file_get_contents(__DIR__ . '/../config/trackers.json')) as $i => $tracker) { ?> |
||||
<?php if (!empty($tracker->announce) && !empty($tracker->stats)) { ?> |
||||
<a href="<?php echo $tracker->announce ?>"><?php echo sprintf('Tracker %s', $i + 1) ?></a> |
||||
/ |
||||
<a href="<?php echo $tracker->stats ?>"><?php echo _('Stats') ?></a> |
||||
| |
||||
<?php } ?> |
||||
<?php } ?> |
||||
<a href="<?php echo WEBSITE_URL ?>/faq.php"><?php echo _('F.A.Q') ?></a> |
||||
| |
||||
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss"><?php echo _('RSS') ?></a> |
||||
<?php if (API_EXPORT_ENABLED) { ?> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a> |
||||
<?php } ?> |
||||
| |
||||
<a href="https://github.com/YGGverse/YGGtracker"><?php echo _('GitHub') ?></a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</footer> |
||||
</body> |
||||
</html> |
||||
<?php } ?> |
@ -1,534 +0,0 @@
@@ -1,534 +0,0 @@
|
||||
|
||||
<?php |
||||
|
||||
// Bootstrap |
||||
require_once __DIR__ . '/../config/bootstrap.php'; |
||||
|
||||
// Define response |
||||
$response = (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => _('Internal server error'), |
||||
]; |
||||
|
||||
// Yggdrasil connections only |
||||
if (!Valid::host($_SERVER['REMOTE_ADDR'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Yggdrasil connection required for this action'); |
||||
} |
||||
|
||||
// Init session |
||||
else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user session'); |
||||
} |
||||
|
||||
// Get user |
||||
else if (!$user = $db->getUser($userId)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user info'); |
||||
} |
||||
|
||||
// On first visit, redirect user to the welcome page with access level question |
||||
else if (is_null($user->public)) |
||||
{ |
||||
header( |
||||
sprintf('Location: %s/welcome.php', WEBSITE_URL) |
||||
); |
||||
} |
||||
|
||||
?> |
||||
<!DOCTYPE html> |
||||
<html lang="en-US"> |
||||
<head> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/common.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/framework.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<title> |
||||
<?php echo sprintf(_('%s instance info'), WEBSITE_NAME) ?> |
||||
</title> |
||||
<meta name="robots" content="noindex,nofollow"/> |
||||
<meta name="author" content="YGGtracker" /> |
||||
<meta charset="UTF-8" /> |
||||
</head> |
||||
<body> |
||||
<header> |
||||
<div class="container"> |
||||
<div class="row margin-t-8 text-center"> |
||||
<a class="logo" href="<?php echo WEBSITE_URL ?>"><?php echo str_replace('YGG', '<span>YGG</span>', WEBSITE_NAME) ?></a> |
||||
<form class="margin-t-8" name="search" method="get" action="<?php echo WEBSITE_URL ?>/index.php"> |
||||
<input type="text" name="query" value="" placeholder="<?php echo _('search or submit magnet link') ?>" /> |
||||
<input type="submit" value="<?php echo _('submit') ?>" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</header> |
||||
<main> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100"> |
||||
<div class="padding-16 margin-y-8 border-radius-3 background-color-night"> |
||||
<?php if ($response->success) { ?> |
||||
<h1 class="margin-b-16"><?php echo _('Node info') ?></h1> |
||||
<table class="width-100"> |
||||
<tbody> |
||||
<tr> |
||||
<td class="padding-b-8 border-bottom-default text-right" colspan="2"> |
||||
<?php echo _('Profile') ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td class="padding-t-16"><?php echo _('Access level') ?></td> |
||||
<td class="padding-t-16 cursor-default <?php echo $user->public ? _('text-color-green') : _('text-color-pink') ?>"> |
||||
<?php echo $user->public ? _('Distributed') : _('Local') ?> |
||||
<sub class="text-color-default opacity-0 parent-hover-opacity-09" title="<?php echo $user->public ? _('You have access to own data everywhere YGGtracker running') : _('Your profile details stored on this instance only') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Address') ?></td> |
||||
<td> |
||||
<?php echo $user->address ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Updated') ?></td> |
||||
<td> |
||||
<?php echo Time::ago((int) $user->timeUpdated) ?> |
||||
</td> |
||||
</tr> |
||||
<!-- |
||||
<tr> |
||||
<td><?php echo _('Magnets') ?></td> |
||||
<td> |
||||
<?php echo $db->findMagnetsTotalByUserId($user->userId) ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Comments') ?></td> |
||||
<td> |
||||
<?php echo $db->findMagnetCommentsTotalByUserId($user->userId) ?> |
||||
</td> |
||||
</tr> |
||||
--> |
||||
<tr> |
||||
<td class="padding-b-8 border-bottom-default text-right" colspan="2"> |
||||
<?php echo _('Rules') ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td class="padding-t-16"><?php echo _('Subject') ?></td> |
||||
<td class="padding-t-16"><?php echo _(NODE_RULE_SUBJECT) ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Languages') ?></td> |
||||
<td><?php echo _(NODE_RULE_LANGUAGES) ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td class="padding-y-8 border-bottom-default text-right" colspan="2"> |
||||
<?php echo _('Totals') ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td class="padding-t-16"><?php echo _('Users') ?></td> |
||||
<td class="padding-t-16"> |
||||
<?php echo $db->getUsersTotal() ?> |
||||
<?php if ($usersTotalByPublicTrue = $db->getUsersTotalByPublic(true)) { ?> |
||||
/ |
||||
<span class="cursor-default text-color-green"> |
||||
<?php echo $usersTotalByPublicTrue ?> |
||||
</span> |
||||
<?php } ?> |
||||
<?php if ($usersTotalByPublicFalse = $db->getUsersTotalByPublic(false)) { ?> |
||||
/ |
||||
<span class="cursor-default text-color-pink"> |
||||
<?php echo $usersTotalByPublicFalse ?> |
||||
</span> |
||||
<?php } ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('total') . |
||||
($usersTotalByPublicTrue ? sprintf(' / %s', _('distributed')) : false) . |
||||
($usersTotalByPublicFalse ? sprintf(' / %s', _('local')) : false) ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Magnets') ?></td> |
||||
<td class="cursor-default"> |
||||
<?php echo $db->getMagnetsTotal() ?> |
||||
<?php if ($magnetsTotalByUsersPublicTrue = $db->getMagnetsTotalByUsersPublic(true)) { ?> |
||||
/ |
||||
<span class="text-color-green"> |
||||
<?php echo $magnetsTotalByUsersPublicTrue ?> |
||||
</span> |
||||
<?php } ?> |
||||
<?php if ($magnetsTotalByUsersPublicFalse = $db->getMagnetsTotalByUsersPublic(false)) { ?> |
||||
/ |
||||
<span class="text-color-pink"> |
||||
<?php echo $magnetsTotalByUsersPublicFalse ?> |
||||
</span> |
||||
<?php } ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('total') . |
||||
($magnetsTotalByUsersPublicTrue ? sprintf(' / %s', _('distributed')) : false) . |
||||
($magnetsTotalByUsersPublicFalse ? sprintf(' / %s', _('local')) : false) ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Downloads') ?></td> |
||||
<td class="cursor-default"> |
||||
<?php echo $db->getMagnetDownloadsTotal() ?> |
||||
<?php if ($magnetDownloadsTotalByUsersPublicTrue = $db->findMagnetDownloadsTotalByUsersPublic(true)) { ?> |
||||
/ |
||||
<span class="text-color-green"> |
||||
<?php echo $magnetDownloadsTotalByUsersPublicTrue ?> |
||||
</span> |
||||
<?php } ?> |
||||
<?php if ($magnetDownloadsTotalByUsersPublicFalse = $db->findMagnetDownloadsTotalByUsersPublic(false)) { ?> |
||||
/ |
||||
<span class="text-color-pink"> |
||||
<?php echo $magnetDownloadsTotalByUsersPublicFalse ?> |
||||
</span> |
||||
<?php } ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('total') . |
||||
($magnetDownloadsTotalByUsersPublicTrue ? sprintf(' / %s', _('distributed')) : false) . |
||||
($magnetDownloadsTotalByUsersPublicFalse ? sprintf(' / %s', _('local')) : false) ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Comments') ?></td> |
||||
<td class="cursor-default"> |
||||
<?php echo $db->getMagnetCommentsTotal() ?> |
||||
<?php if ($magnetCommentsTotalByUsersPublicTrue = $db->findMagnetCommentsTotalByUsersPublic(true)) { ?> |
||||
/ |
||||
<span class="text-color-green"> |
||||
<?php echo $magnetCommentsTotalByUsersPublicTrue ?> |
||||
</span> |
||||
<?php } ?> |
||||
<?php if ($magnetCommentsTotalByUsersPublicFalse = $db->findMagnetCommentsTotalByUsersPublic(false)) { ?> |
||||
/ |
||||
<span class="text-color-pink"> |
||||
<?php echo $magnetCommentsTotalByUsersPublicFalse ?> |
||||
</span> |
||||
<?php } ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('total') . |
||||
($magnetCommentsTotalByUsersPublicTrue ? sprintf(' / %s', _('distributed')) : false) . |
||||
($magnetCommentsTotalByUsersPublicFalse ? sprintf(' / %s', _('local')) : false) ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Stars') ?></td> |
||||
<td class="cursor-default"> |
||||
<?php echo $db->getMagnetStarsTotal() ?> |
||||
<?php if ($magnetStarsTotalByUsersPublicTrue = $db->findMagnetStarsTotalByUsersPublic(true)) { ?> |
||||
/ |
||||
<span class="text-color-green"> |
||||
<?php echo $magnetStarsTotalByUsersPublicTrue ?> |
||||
</span> |
||||
<?php } ?> |
||||
<?php if ($magnetStarsTotalByUsersPublicFalse = $db->findMagnetStarsTotalByUsersPublic(false)) { ?> |
||||
/ |
||||
<span class="text-color-pink"> |
||||
<?php echo $magnetStarsTotalByUsersPublicFalse ?> |
||||
</span> |
||||
<?php } ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('total') . |
||||
($magnetStarsTotalByUsersPublicTrue ? sprintf(' / %s', _('distributed')) : false) . |
||||
($magnetStarsTotalByUsersPublicFalse ? sprintf(' / %s', _('local')) : false) ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Views') ?></td> |
||||
<td class="cursor-default"> |
||||
<?php echo $db->getMagnetViewsTotal() ?> |
||||
<?php if ($magnetViewsTotalByUsersPublicTrue = $db->findMagnetViewsTotalByUsersPublic(true)) { ?> |
||||
/ |
||||
<span class="text-color-green"> |
||||
<?php echo $magnetViewsTotalByUsersPublicTrue ?> |
||||
</span> |
||||
<?php } ?> |
||||
<?php if ($magnetViewsTotalByUsersPublicFalse = $db->findMagnetViewsTotalByUsersPublic(false)) { ?> |
||||
/ |
||||
<span class="text-color-pink"> |
||||
<?php echo $magnetViewsTotalByUsersPublicFalse ?> |
||||
</span> |
||||
<?php } ?> |
||||
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo _('total') . |
||||
($magnetViewsTotalByUsersPublicTrue ? sprintf(' / %s', _('distributed')) : false) . |
||||
($magnetViewsTotalByUsersPublicFalse ? sprintf(' / %s', _('local')) : false) ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/> |
||||
</svg> |
||||
</sub> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Moderators') ?></td> |
||||
<td><?php echo count(MODERATOR_IP_LIST) ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Seeds') ?></td> |
||||
<td><?php echo $db->getMagnetToAddressTrackerSeedersSum() ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Peers') ?></td> |
||||
<td><?php echo $db->getMagnetToAddressTrackerCompletedSum() ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Leechers') ?></td> |
||||
<td><?php echo $db->getMagnetToAddressTrackerLeechersSum() ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td class="padding-y-8 border-bottom-default text-right" colspan="2"> |
||||
<?php echo _('Users') ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td class="padding-t-16"><?php echo _('Identicon') ?></td> |
||||
<td class="padding-t-16"><?php echo USER_DEFAULT_IDENTICON ? USER_DEFAULT_IDENTICON : _('no') ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Identicon key') ?></td> |
||||
<td><?php echo USER_IDENTICON_FIELD ? USER_IDENTICON_FIELD : _('undefined') ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Approved by default') ?></td> |
||||
<td><?php echo USER_DEFAULT_APPROVED ? _('yes') : _('no') ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Auto-approved on magnet approve') ?></td> |
||||
<td><?php echo USER_AUTO_APPROVE_ON_MAGNET_APPROVE ? _('yes') : _('no') ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Auto-approved on comment approve') ?></td> |
||||
<td><?php echo USER_AUTO_APPROVE_ON_COMMENT_APPROVE ? _('yes') : _('no') ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td class="padding-y-8 border-bottom-default text-right" colspan="2"> |
||||
<?php echo _('Magnets') ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td class="padding-t-16"><?php echo _('Approved by default') ?></td> |
||||
<td class="padding-t-16"><?php echo MAGNET_DEFAULT_APPROVED ? _('yes') : _('no') ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Title, chars') ?></td> |
||||
<td><?php echo MAGNET_TITLE_MIN_LENGTH ?>-<?php echo MAGNET_TITLE_MAX_LENGTH ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Description short, chars') ?></td> |
||||
<td><?php echo MAGNET_PREVIEW_MIN_LENGTH ?>-<?php echo MAGNET_PREVIEW_MAX_LENGTH ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Description long, chars') ?></td> |
||||
<td><?php echo MAGNET_DESCRIPTION_MIN_LENGTH ?>-<?php echo MAGNET_DESCRIPTION_MAX_LENGTH ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Keywords long, chars, quantity') ?></td> |
||||
<td> |
||||
<?php echo MAGNET_KT_MIN_LENGTH ?>-<?php echo MAGNET_KT_MAX_LENGTH ?> |
||||
/ |
||||
<?php echo MAGNET_KT_MIN_QUANTITY ?>-<?php echo MAGNET_KT_MAX_QUANTITY ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('TR, quantity') ?></td> |
||||
<td> |
||||
<?php echo MAGNET_TR_MIN_QUANTITY ?>-<?php echo MAGNET_TR_MAX_QUANTITY ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('AS, quantity') ?></td> |
||||
<td> |
||||
<?php echo MAGNET_AS_MIN_QUANTITY ?>-<?php echo MAGNET_AS_MAX_QUANTITY ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('WS, quantity') ?></td> |
||||
<td> |
||||
<?php echo MAGNET_WS_MIN_QUANTITY ?>-<?php echo MAGNET_WS_MAX_QUANTITY ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td class="padding-y-8 border-bottom-default text-right" colspan="2"> |
||||
<?php echo _('Comments') ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td class="padding-t-16"><?php echo _('Approved by default') ?></td> |
||||
<td class="padding-t-16"><?php echo MAGNET_COMMENT_DEFAULT_APPROVED ? _('yes') : _('no') ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td><?php echo _('Length, chars') ?></td> |
||||
<td><?php echo MAGNET_COMMENT_MIN_LENGTH ?>-<?php echo MAGNET_COMMENT_MAX_LENGTH ?></td> |
||||
</tr> |
||||
<tr> |
||||
<td class="padding-y-8 padding-b-8 border-bottom-default text-right" colspan="2"> |
||||
<?php echo _('Trackers') ?> |
||||
<a href="https://github.com/YGGverse/YGGtracker/blob/main/src/config/trackers.json" title="<?php echo _('Add') ?>"> |
||||
<sub class="margin-l-4"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-circle" viewBox="0 0 16 16"> |
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/> |
||||
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"/> |
||||
</svg> |
||||
</sub> |
||||
</a> |
||||
</td> |
||||
<?php foreach (json_decode(file_get_contents(__DIR__ . '/../config/trackers.json')) as $i => $tracker) { ?> |
||||
<tr> |
||||
<td class="padding-t-16"><?php echo sprintf('#%s', $i + 1) ?></td> |
||||
</tr> |
||||
<?php foreach ($tracker as $key => $value) { ?> |
||||
<?php if ($value) { ?> |
||||
<tr> |
||||
<td> |
||||
<span class="margin-l-16"><?php echo $key ?></span> |
||||
</td> |
||||
<?php if ($key == 'description') { ?> |
||||
<td><?php echo $value ?></td> |
||||
<?php } else { ?> |
||||
<td class="font-size-10"> |
||||
<a href="<?php echo $value ?>"> |
||||
<?php echo $value ?> |
||||
</a> |
||||
</td> |
||||
<?php } ?> |
||||
</tr> |
||||
<?php } ?> |
||||
<?php } ?> |
||||
<?php } ?> |
||||
</tr> |
||||
<tr> |
||||
<td class="padding-y-8 padding-b-8 border-bottom-default text-right" colspan="2"> |
||||
<?php echo _('Nodes') ?> |
||||
<a href="https://github.com/YGGverse/YGGtracker/blob/main/src/config/nodes.json" title="<?php echo _('Add') ?>"> |
||||
<sub class="margin-l-4"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-circle" viewBox="0 0 16 16"> |
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/> |
||||
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"/> |
||||
</svg> |
||||
</sub> |
||||
</a> |
||||
</td> |
||||
<?php foreach (json_decode(file_get_contents(__DIR__ . '/../config/nodes.json')) as $i => $node) { ?> |
||||
<tr> |
||||
<td class="padding-t-16"><?php echo sprintf('#%s', $i + 1) ?></td> |
||||
</tr> |
||||
<?php foreach ($node as $key => $value) { ?> |
||||
<?php if ($value) { ?> |
||||
<tr> |
||||
<td> |
||||
<span class="margin-l-16"><?php echo $key ?></span> |
||||
</td> |
||||
<?php if ($key == 'description') { ?> |
||||
<td><?php echo $value ?></td> |
||||
<?php } else { ?> |
||||
<td class="font-size-10"> |
||||
<a href="<?php echo $value ?>"> |
||||
<?php echo $value ?> |
||||
</a> |
||||
</td> |
||||
<?php } ?> |
||||
</tr> |
||||
<?php } ?> |
||||
<?php } ?> |
||||
<?php } ?> |
||||
</tr> |
||||
<tr> |
||||
<td class="padding-y-8 padding-b-8 border-bottom-default text-right" colspan="2"> |
||||
<?php echo _('Peers') ?> |
||||
<a href="https://github.com/YGGverse/YGGtracker/blob/main/src/config/peers.json" title="<?php echo _('Add') ?>"> |
||||
<sub class="margin-l-4"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-circle" viewBox="0 0 16 16"> |
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/> |
||||
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"/> |
||||
</svg> |
||||
</sub> |
||||
</a> |
||||
</td> |
||||
<?php foreach (json_decode(file_get_contents(__DIR__ . '/../config/peers.json')) as $i => $peer) { ?> |
||||
<tr> |
||||
<td class="padding-t-16"><?php echo sprintf('#%s', $i + 1) ?></td> |
||||
</tr> |
||||
<?php foreach ($peer as $key => $value) { ?> |
||||
<?php if ($value) { ?> |
||||
<tr> |
||||
<td> |
||||
<span class="margin-l-16"><?php echo $key ?></span> |
||||
</td> |
||||
<?php if ($key == 'description') { ?> |
||||
<td><?php echo $value ?></td> |
||||
<?php } else { ?> |
||||
<td class="font-size-10"> |
||||
<a href="<?php echo $value ?>"> |
||||
<?php echo $value ?> |
||||
</a> |
||||
</td> |
||||
<?php } ?> |
||||
</tr> |
||||
<?php } ?> |
||||
<?php } ?> |
||||
<?php } ?> |
||||
</tr> |
||||
</tbody> |
||||
</table> |
||||
<?php } else { ?> |
||||
<div class="text-center"><?php echo $response->message ?></div> |
||||
<?php } ?> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</main> |
||||
<footer> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100 text-center margin-y-8"> |
||||
<?php foreach (json_decode(file_get_contents(__DIR__ . '/../config/trackers.json')) as $i => $tracker) { ?> |
||||
<?php if (!empty($tracker->announce) && !empty($tracker->stats)) { ?> |
||||
<a href="<?php echo $tracker->announce ?>"><?php echo sprintf('Tracker %s', $i + 1) ?></a> |
||||
/ |
||||
<a href="<?php echo $tracker->stats ?>"><?php echo _('Stats') ?></a> |
||||
| |
||||
<?php } ?> |
||||
<?php } ?> |
||||
<a href="<?php echo WEBSITE_URL ?>/faq.php"><?php echo _('F.A.Q') ?></a> |
||||
| |
||||
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss"><?php echo _('RSS') ?></a> |
||||
<?php if (API_EXPORT_ENABLED) { ?> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a> |
||||
<?php } ?> |
||||
| |
||||
<a href="https://github.com/YGGverse/YGGtracker"><?php echo _('GitHub') ?></a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</footer> |
||||
</body> |
||||
</html> |
@ -1,436 +0,0 @@
@@ -1,436 +0,0 @@
|
||||
<?php |
||||
|
||||
// Bootstrap dependencies |
||||
require_once __DIR__ . '/../config/bootstrap.php'; |
||||
|
||||
// Define variables |
||||
$request = (object) |
||||
[ |
||||
'query' => false, |
||||
'page' => 1, |
||||
]; |
||||
|
||||
// Prepare request |
||||
$request->query = isset($_GET['query']) ? urldecode((string) $_GET['query']) : ''; |
||||
$request->page = isset($_GET['page']) && $_GET['page'] > 0 ? (int) $_GET['page'] : 1; |
||||
|
||||
// Define response |
||||
$response = (object) |
||||
[ |
||||
'success' => true, |
||||
'message' => false, |
||||
'magnets' => [], |
||||
]; |
||||
|
||||
// Yggdrasil connections only |
||||
if (!Valid::host($_SERVER['REMOTE_ADDR'])) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Yggdrasil connection required to enable resource features'); |
||||
} |
||||
|
||||
// Init session |
||||
else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user session'); |
||||
} |
||||
|
||||
// Get user |
||||
else if (!$user = $db->getUser($userId)) |
||||
{ |
||||
$response->success = false; |
||||
$response->message = _('Could not init user info'); |
||||
} |
||||
|
||||
// On first visit, redirect user to the welcome page with access level question |
||||
else if (is_null($user->public) && !isset($_GET['rss'])) |
||||
{ |
||||
header( |
||||
sprintf('Location: %s/welcome.php', WEBSITE_URL) |
||||
); |
||||
} |
||||
|
||||
// Request valid |
||||
else |
||||
{ |
||||
// Query is magnet link |
||||
if ($magnet = Yggverse\Parser\Magnet::is($request->query)) |
||||
{ |
||||
header( |
||||
sprintf('Location: %s/action.php?target=magnet&toggle=new&magnet=%s', WEBSITE_URL, urlencode($request->query)) |
||||
); |
||||
} |
||||
|
||||
// Get index |
||||
$response->total = $sphinx->searchMagnetsTotal($request->query); |
||||
$results = $sphinx->searchMagnets( |
||||
$request->query, |
||||
$request->page * WEBSITE_PAGINATION_LIMIT - WEBSITE_PAGINATION_LIMIT, |
||||
WEBSITE_PAGINATION_LIMIT, |
||||
$response->total |
||||
); |
||||
|
||||
foreach ($results as $result) |
||||
{ |
||||
if ($magnet = $db->getMagnet($result->magnetid)) |
||||
{ |
||||
// Get access info |
||||
$accessRead = ($user->address == $db->getUser($magnet->userId)->address || in_array($user->address, MODERATOR_IP_LIST) || ($magnet->public && $magnet->approved)); |
||||
$accessEdit = ($user->address == $db->getUser($magnet->userId)->address || in_array($user->address, MODERATOR_IP_LIST)); |
||||
|
||||
// Keywords |
||||
$keywords = []; |
||||
|
||||
foreach ($db->findKeywordTopicByMagnetId($magnet->magnetId) as $keyword) |
||||
{ |
||||
$keywords[] = $db->getKeywordTopic($keyword->keywordTopicId)->value; |
||||
} |
||||
|
||||
$response->magnets[] = (object) |
||||
[ |
||||
'magnetId' => $magnet->magnetId, |
||||
'title' => $magnet->title ? htmlentities($magnet->title) : ($magnet->dn ? htmlentities($magnet->dn): false), |
||||
'preview' => $magnet->preview ? nl2br( |
||||
htmlentities( |
||||
$magnet->preview |
||||
) |
||||
) : false, |
||||
'approved' => (bool) $magnet->approved, |
||||
'public' => (bool) $magnet->public, |
||||
'sensitive' => (bool) $magnet->sensitive, |
||||
'comments' => (bool) $magnet->comments, |
||||
'timeAdded' => $magnet->timeAdded ? Time::ago((int) $magnet->timeAdded) : false, |
||||
'timeUpdated' => $magnet->timeUpdated ? Time::ago((int) $magnet->timeUpdated) : false, |
||||
'keywords' => $keywords, |
||||
'comment' => (object) |
||||
[ |
||||
'total' => $db->findMagnetCommentsTotalByMagnetId($magnet->magnetId), |
||||
'status' => $db->findMagnetCommentsTotal($magnet->magnetId, $userId), |
||||
], |
||||
'download' => (object) |
||||
[ |
||||
'total' => $db->findMagnetDownloadsTotalByMagnetId($magnet->magnetId), |
||||
'status' => $db->findMagnetDownloadsTotal($magnet->magnetId, $userId), |
||||
], |
||||
'star' => (object) |
||||
[ |
||||
'total' => $db->findMagnetStarsTotalByMagnetId($magnet->magnetId, true), |
||||
'status' => $db->findLastMagnetStarValue($magnet->magnetId, $userId), |
||||
], |
||||
'access' => (object) |
||||
[ |
||||
'read' => $accessRead, |
||||
'edit' => $accessEdit, |
||||
], |
||||
'seeders' => $db->getMagnetToAddressTrackerSeedersSumByMagnetId($magnet->magnetId), |
||||
'completed' => $db->getMagnetToAddressTrackerCompletedSumByMagnetId($magnet->magnetId), |
||||
'leechers' => $db->getMagnetToAddressTrackerLeechersSumByMagnetId($magnet->magnetId), |
||||
'directs' => $db->getMagnetToAcceptableSourceTotalByMagnetId($magnet->magnetId) |
||||
]; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (isset($_GET['rss']) && $response->success) { ?><?php |
||||
header('Content-type: text/xml;charset=UTF-8'); |
||||
echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?> |
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"> |
||||
<channel> |
||||
<atom:link href="<?php echo WEBSITE_URL ?>/index.php<?php echo sprintf('?query=%s', urlencode($request->query)) ?>" rel="self" type="application/rss+xml"></atom:link> |
||||
<title><?php echo !empty($request->query) ? sprintf(_('%s - Search - %s'), htmlspecialchars($request->query, ENT_QUOTES, 'UTF-8'), WEBSITE_NAME) |
||||
: WEBSITE_NAME ?></title> |
||||
<description><?php echo _('BitTorrent Registry for Yggdrasil') ?></description> |
||||
<link><?php echo sprintf('%s/index.php%s', |
||||
WEBSITE_URL, |
||||
sprintf('?query=%s', urlencode($request->query))) ?></link> |
||||
<?php foreach ($response->magnets as $magnet) { ?> |
||||
<?php if ($magnet->access->read) { ?> |
||||
<item> |
||||
<title><?php echo htmlspecialchars($magnet->title, ENT_QUOTES, 'UTF-8') ?></title> |
||||
<description><?php echo htmlspecialchars(strip_tags($magnet->preview), ENT_QUOTES, 'UTF-8') ?></description> |
||||
<guid><?php echo sprintf('%s/magnet.php?magnetId=%s', WEBSITE_URL, $magnet->magnetId) ?></guid> |
||||
<link><?php echo sprintf('%s/magnet.php?magnetId=%s', WEBSITE_URL, $magnet->magnetId) ?></link> |
||||
</item> |
||||
<?php } ?> |
||||
<?php } ?> |
||||
</channel> |
||||
</rss> |
||||
<?php } else { ?> |
||||
<!DOCTYPE html> |
||||
<html lang="en-US"> |
||||
<head> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/common.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE_URL ?>/assets/theme/default/css/framework.css?<?php echo WEBSITE_CSS_VERSION ?>" /> |
||||
<title> |
||||
<?php echo sprintf(_('%s - Search - %s'), |
||||
htmlspecialchars($request->query, ENT_QUOTES, 'UTF-8'), |
||||
WEBSITE_NAME) ?> |
||||
</title> |
||||
<meta name="description" content="<?php echo _('BitTorrent Registry for Yggdrasil') ?>" /> |
||||
<meta name="keywords" content="yggdrasil, yggverse, yggtracker, bittorrent, magnet, catalog" /> |
||||
<meta name="author" content="YGGtracker" /> |
||||
<meta charset="UTF-8" /> |
||||
</head> |
||||
<body> |
||||
<header> |
||||
<div class="container"> |
||||
<div class="row margin-t-8 text-center"> |
||||
<a class="logo" href="<?php echo WEBSITE_URL ?>"><?php echo str_replace('YGG', '<span>YGG</span>', WEBSITE_NAME) ?></a> |
||||
<form class="margin-t-8" name="search" method="get" action="<?php echo WEBSITE_URL ?>/search.php"> |
||||
<input type="text" name="query" value="<?php echo htmlentities($request->query) ?>" placeholder="<?php echo _('search or submit magnet link') ?>" /> |
||||
<input type="submit" value="<?php echo _('submit') ?>" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</header> |
||||
<main> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100"> |
||||
<?php if ($response->success) { ?> |
||||
<?php if ($response->magnets) { ?> |
||||
<?php foreach ($response->magnets as $magnet) { ?> |
||||
<?php if ($magnet->access->read) { ?> |
||||
<a name="magnet-<?php echo $magnet->magnetId ?>"></a> |
||||
<div class="margin-y-8 |
||||
border-radius-3 |
||||
background-color-night |
||||
<?php echo !$magnet->public || !$magnet->approved ? 'opacity-06 opacity-hover-1' : false ?>"> |
||||
<div class="padding-16 <?php echo $magnet->sensitive ? 'blur-2 blur-hover-0' : false ?>"> |
||||
<a href="<?php echo sprintf('%s/magnet.php?magnetId=%s', WEBSITE_URL, $magnet->magnetId) ?>"> |
||||
<h2 class="margin-b-8"><?php echo $magnet->title ?></h2> |
||||
<?php if ($magnet->leechers && !$magnet->seeders) { ?> |
||||
<span class="label label-green margin-x-4 font-size-10 position-relative top--2 cursor-default" |
||||
title="<?php echo _('Active leechers waiting for seeds') ?>"> |
||||
<?php echo _('wanted') ?> |
||||
</span> |
||||
<?php } ?> |
||||
</a> |
||||
<div class="float-right opacity-0 parent-hover-opacity-09"> |
||||
<?php if (!$magnet->public) { ?> |
||||
<span class="margin-l-8" title="<?php echo _('Private') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye-slash-fill" viewBox="0 0 16 16"> |
||||
<path d="m10.79 12.912-1.614-1.615a3.5 3.5 0 0 1-4.474-4.474l-2.06-2.06C.938 6.278 0 8 0 8s3 5.5 8 5.5a7.029 7.029 0 0 0 2.79-.588zM5.21 3.088A7.028 7.028 0 0 1 8 2.5c5 0 8 5.5 8 5.5s-.939 1.721-2.641 3.238l-2.062-2.062a3.5 3.5 0 0 0-4.474-4.474L5.21 3.089z"/> |
||||
<path d="M5.525 7.646a2.5 2.5 0 0 0 2.829 2.829l-2.83-2.829zm4.95.708-2.829-2.83a2.5 2.5 0 0 1 2.829 2.829zm3.171 6-12-12 .708-.708 12 12-.708.708z"/> |
||||
</svg> |
||||
</span> |
||||
<?php } ?> |
||||
<?php if (!$magnet->approved) { ?> |
||||
<span class="margin-l-8" title="<?php echo _('Waiting for approve') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-hourglass-split" viewBox="0 0 16 16"> |
||||
<path d="M2.5 15a.5.5 0 1 1 0-1h1v-1a4.5 4.5 0 0 1 2.557-4.06c.29-.139.443-.377.443-.59v-.7c0-.213-.154-.451-.443-.59A4.5 4.5 0 0 1 3.5 3V2h-1a.5.5 0 0 1 0-1h11a.5.5 0 0 1 0 1h-1v1a4.5 4.5 0 0 1-2.557 4.06c-.29.139-.443.377-.443.59v.7c0 .213.154.451.443.59A4.5 4.5 0 0 1 12.5 13v1h1a.5.5 0 0 1 0 1h-11zm2-13v1c0 .537.12 1.045.337 1.5h6.326c.216-.455.337-.963.337-1.5V2h-7zm3 6.35c0 .701-.478 1.236-1.011 1.492A3.5 3.5 0 0 0 4.5 13s.866-1.299 3-1.48V8.35zm1 0v3.17c2.134.181 3 1.48 3 1.48a3.5 3.5 0 0 0-1.989-3.158C8.978 9.586 8.5 9.052 8.5 8.351z"/> |
||||
</svg> |
||||
</span> |
||||
<?php } ?> |
||||
<?php if ($magnet->access->edit) { ?> |
||||
<a class="text-color-green margin-l-12" href="<?php echo WEBSITE_URL ?>/edit.php?magnetId=<?php echo $magnet->magnetId ?>" title="<?php echo _('Edit') ?>"> |
||||
<svg class="text-color-green" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-square" viewBox="0 0 16 16"> |
||||
<path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/> |
||||
<path fill-rule="evenodd" d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z"/> |
||||
</svg> |
||||
</a> |
||||
<?php } ?> |
||||
</div> |
||||
<?php if ($magnet->preview) { ?> |
||||
<div class="margin-y-8"><?php echo $magnet->preview ?></div> |
||||
<?php } ?> |
||||
<?php if ($magnet->keywords) { ?> |
||||
<div class="margin-y-8"> |
||||
<?php foreach ($magnet->keywords as $keyword) { ?> |
||||
<small> |
||||
<a href="<?php echo WEBSITE_URL ?>/search.php?query=<?php echo urlencode($keyword) ?>">#<?php echo htmlentities($keyword) ?></a> |
||||
</small> |
||||
<?php } ?> |
||||
</div> |
||||
<?php } ?> |
||||
<div class="width-100 padding-y-4"></div> |
||||
<!-- DOUBTS |
||||
<span class="margin-t-8 margin-r-8 cursor-default" title="<?php echo $magnet->timeUpdated ? _('Updated') : _('Added') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clock" viewBox="0 0 16 16"> |
||||
<path d="M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71V3.5z"/> |
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0z"/> |
||||
</svg> |
||||
<sup><?php echo $magnet->timeUpdated ? $magnet->timeUpdated : $magnet->timeAdded ?></sup> |
||||
</span> |
||||
--> |
||||
<span class="margin-t-8 margin-r-8 cursor-default"> |
||||
<sup> |
||||
<?php echo $magnet->timeUpdated ? _('Updated') : _('Added') ?> |
||||
<?php echo $magnet->timeUpdated ? $magnet->timeUpdated : $magnet->timeAdded ?> |
||||
</sup> |
||||
</span> |
||||
<span class="margin-t-8 margin-r-8 cursor-default opacity-0 parent-hover-opacity-09" title="<?php echo _('Seeds') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-up" viewBox="0 0 16 16"> |
||||
<path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5z"/> |
||||
</svg> |
||||
<sup><?php echo $magnet->seeders ?></sup> |
||||
</span> |
||||
<span class="margin-t-8 margin-r-8 cursor-default opacity-0 parent-hover-opacity-09" title="<?php echo _('Peers') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-down" viewBox="0 0 16 16"> |
||||
<path fill-rule="evenodd" d="M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1z"/> |
||||
</svg> |
||||
<sup><?php echo $magnet->completed ?></sup> |
||||
</span> |
||||
<span class="margin-t-8 margin-r-8 cursor-default opacity-0 parent-hover-opacity-09" title="<?php echo _('Leechers') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-cup-hot" viewBox="0 0 16 16"> |
||||
<path fill-rule="evenodd" d="M.5 6a.5.5 0 0 0-.488.608l1.652 7.434A2.5 2.5 0 0 0 4.104 16h5.792a2.5 2.5 0 0 0 2.44-1.958l.131-.59a3 3 0 0 0 1.3-5.854l.221-.99A.5.5 0 0 0 13.5 6H.5ZM13 12.5a2.01 2.01 0 0 1-.316-.025l.867-3.898A2.001 2.001 0 0 1 13 12.5ZM2.64 13.825 1.123 7h11.754l-1.517 6.825A1.5 1.5 0 0 1 9.896 15H4.104a1.5 1.5 0 0 1-1.464-1.175Z"/> |
||||
<path d="m4.4.8-.003.004-.014.019a4.167 4.167 0 0 0-.204.31 2.327 2.327 0 0 0-.141.267c-.026.06-.034.092-.037.103v.004a.593.593 0 0 0 .091.248c.075.133.178.272.308.445l.01.012c.118.158.26.347.37.543.112.2.22.455.22.745 0 .188-.065.368-.119.494a3.31 3.31 0 0 1-.202.388 5.444 5.444 0 0 1-.253.382l-.018.025-.005.008-.002.002A.5.5 0 0 1 3.6 4.2l.003-.004.014-.019a4.149 4.149 0 0 0 .204-.31 2.06 2.06 0 0 0 .141-.267c.026-.06.034-.092.037-.103a.593.593 0 0 0-.09-.252A4.334 4.334 0 0 0 3.6 2.8l-.01-.012a5.099 5.099 0 0 1-.37-.543A1.53 1.53 0 0 1 3 1.5c0-.188.065-.368.119-.494.059-.138.134-.274.202-.388a5.446 5.446 0 0 1 .253-.382l.025-.035A.5.5 0 0 1 4.4.8Zm3 0-.003.004-.014.019a4.167 4.167 0 0 0-.204.31 2.327 2.327 0 0 0-.141.267c-.026.06-.034.092-.037.103v.004a.593.593 0 0 0 .091.248c.075.133.178.272.308.445l.01.012c.118.158.26.347.37.543.112.2.22.455.22.745 0 .188-.065.368-.119.494a3.31 3.31 0 0 1-.202.388 5.444 5.444 0 0 1-.253.382l-.018.025-.005.008-.002.002A.5.5 0 0 1 6.6 4.2l.003-.004.014-.019a4.149 4.149 0 0 0 .204-.31 2.06 2.06 0 0 0 .141-.267c.026-.06.034-.092.037-.103a.593.593 0 0 0-.09-.252A4.334 4.334 0 0 0 6.6 2.8l-.01-.012a5.099 5.099 0 0 1-.37-.543A1.53 1.53 0 0 1 6 1.5c0-.188.065-.368.119-.494.059-.138.134-.274.202-.388a5.446 5.446 0 0 1 .253-.382l.025-.035A.5.5 0 0 1 7.4.8Zm3 0-.003.004-.014.019a4.077 4.077 0 0 0-.204.31 2.337 2.337 0 0 0-.141.267c-.026.06-.034.092-.037.103v.004a.593.593 0 0 0 .091.248c.075.133.178.272.308.445l.01.012c.118.158.26.347.37.543.112.2.22.455.22.745 0 .188-.065.368-.119.494a3.198 3.198 0 0 1-.202.388 5.385 5.385 0 0 1-.252.382l-.019.025-.005.008-.002.002A.5.5 0 0 1 9.6 4.2l.003-.004.014-.019a4.149 4.149 0 0 0 .204-.31 2.06 2.06 0 0 0 .141-.267c.026-.06.034-.092.037-.103a.593.593 0 0 0-.09-.252A4.334 4.334 0 0 0 9.6 2.8l-.01-.012a5.099 5.099 0 0 1-.37-.543A1.53 1.53 0 0 1 9 1.5c0-.188.065-.368.119-.494.059-.138.134-.274.202-.388a5.446 5.446 0 0 1 .253-.382l.025-.035A.5.5 0 0 1 10.4.8Z"/> |
||||
</svg> |
||||
<sup><?php echo $magnet->leechers ?></sup> |
||||
</span> |
||||
<?php if ($magnet->directs) { ?> |
||||
<span class="margin-t-8 margin-r-8 cursor-default opacity-0 parent-hover-opacity-09" title="<?php echo _('Direct') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-database" viewBox="0 0 16 16"> |
||||
<path d="M4.318 2.687C5.234 2.271 6.536 2 8 2s2.766.27 3.682.687C12.644 3.125 13 3.627 13 4c0 .374-.356.875-1.318 1.313C10.766 5.729 9.464 6 8 6s-2.766-.27-3.682-.687C3.356 4.875 3 4.373 3 4c0-.374.356-.875 1.318-1.313ZM13 5.698V7c0 .374-.356.875-1.318 1.313C10.766 8.729 9.464 9 8 9s-2.766-.27-3.682-.687C3.356 7.875 3 7.373 3 7V5.698c.271.202.58.378.904.525C4.978 6.711 6.427 7 8 7s3.022-.289 4.096-.777A4.92 4.92 0 0 0 13 5.698ZM14 4c0-1.007-.875-1.755-1.904-2.223C11.022 1.289 9.573 1 8 1s-3.022.289-4.096.777C2.875 2.245 2 2.993 2 4v9c0 1.007.875 1.755 1.904 2.223C4.978 15.71 6.427 16 8 16s3.022-.289 4.096-.777C13.125 14.755 14 14.007 14 13V4Zm-1 4.698V10c0 .374-.356.875-1.318 1.313C10.766 11.729 9.464 12 8 12s-2.766-.27-3.682-.687C3.356 10.875 3 10.373 3 10V8.698c.271.202.58.378.904.525C4.978 9.71 6.427 10 8 10s3.022-.289 4.096-.777A4.92 4.92 0 0 0 13 8.698Zm0 3V13c0 .374-.356.875-1.318 1.313C10.766 14.729 9.464 15 8 15s-2.766-.27-3.682-.687C3.356 13.875 3 13.373 3 13v-1.302c.271.202.58.378.904.525C4.978 12.71 6.427 13 8 13s3.022-.289 4.096-.777c.324-.147.633-.323.904-.525Z"/> |
||||
</svg> |
||||
<sup><?php echo $magnet->directs ?></sup> |
||||
</span> |
||||
<?php } ?> |
||||
<!-- @TODO doubts |
||||
<?php if ($user->public && $magnet->public) { ?> |
||||
<span class="margin-t-8 margin-r-8 cursor-default opacity-0 parent-hover-opacity-09" title="<?php echo _('Distributed') ?>"> |
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check-all" viewBox="0 0 16 16"> |
||||
<path d="M8.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L2.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093L8.95 4.992a.252.252 0 0 1 .02-.022zm-.92 5.14.92.92a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 1 0-1.091-1.028L9.477 9.417l-.485-.486-.943 1.179z"/> |
||||
</svg> |
||||
<a href="<?php echo sprintf('%s/node.php#nodes', WEBSITE_URL) ?>"> |
||||
<sup><?php echo 2 ?></sup> |
||||
</a> |
||||
</span> |
||||
<?php } ?> |
||||
--> |
||||
<span class="float-right margin-l-12"> |
||||
<a rel="nofollow" href="<?php echo sprintf('%s/action.php?target=magnet&toggle=star&magnetId=%s&callback=%s', |
||||
WEBSITE_URL, |
||||
$magnet->magnetId, |
||||
base64_encode(sprintf('%s/search.php?%s#magnet-%s', |
||||
WEBSITE_URL, |
||||
($request->query ? sprintf('&query=%s', urlencode($request->query)) : false). |
||||
($request->page ? sprintf('&page=%s', urlencode($request->page)) : false), |
||||
$magnet->magnetId))) ?>" title="<?php echo _('Star') ?>"> |
||||
<?php if ($magnet->star->status) { ?> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-star-fill" viewBox="0 0 16 16"> |
||||
<path d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z"/> |
||||
</svg> |
||||
<?php } else { ?> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-star" viewBox="0 0 16 16"> |
||||
<path d="M2.866 14.85c-.078.444.36.791.746.593l4.39-2.256 4.389 2.256c.386.198.824-.149.746-.592l-.83-4.73 3.522-3.356c.33-.314.16-.888-.282-.95l-4.898-.696L8.465.792a.513.513 0 0 0-.927 0L5.354 5.12l-4.898.696c-.441.062-.612.636-.283.95l3.523 3.356-.83 4.73zm4.905-2.767-3.686 1.894.694-3.957a.565.565 0 0 0-.163-.505L1.71 6.745l4.052-.576a.525.525 0 0 0 .393-.288L8 2.223l1.847 3.658a.525.525 0 0 0 .393.288l4.052.575-2.906 2.77a.565.565 0 0 0-.163.506l.694 3.957-3.686-1.894a.503.503 0 0 0-.461 0z"/> |
||||
</svg> |
||||
<?php } ?> |
||||
</a> |
||||
<sup><?php echo $magnet->star->total ?></sup> |
||||
</span> |
||||
<?php if ($magnet->comments) { ?> |
||||
<span class="float-right margin-l-12"> |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/magnet.php?magnetId=<?php echo $magnet->magnetId ?>#comment" title="<?php echo _('Comment') ?>"> |
||||
<?php if ($magnet->comment->status) { ?> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chat-fill" viewBox="0 0 16 16"> |
||||
<path d="M8 15c4.418 0 8-3.134 8-7s-3.582-7-8-7-8 3.134-8 7c0 1.76.743 3.37 1.97 4.6-.097 1.016-.417 2.13-.771 2.966-.079.186.074.394.273.362 2.256-.37 3.597-.938 4.18-1.234A9.06 9.06 0 0 0 8 15z"/> |
||||
</svg> |
||||
<?php } else { ?> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chat" viewBox="0 0 16 16"> |
||||
<path d="M2.678 11.894a1 1 0 0 1 .287.801 10.97 10.97 0 0 1-.398 2c1.395-.323 2.247-.697 2.634-.893a1 1 0 0 1 .71-.074A8.06 8.06 0 0 0 8 14c3.996 0 7-2.807 7-6 0-3.192-3.004-6-7-6S1 4.808 1 8c0 1.468.617 2.83 1.678 3.894zm-.493 3.905a21.682 21.682 0 0 1-.713.129c-.2.032-.352-.176-.273-.362a9.68 9.68 0 0 0 .244-.637l.003-.01c.248-.72.45-1.548.524-2.319C.743 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7-3.582 7-8 7a9.06 9.06 0 0 1-2.347-.306c-.52.263-1.639.742-3.468 1.105z"/> |
||||
</svg> |
||||
<?php } ?> |
||||
</a> |
||||
<sup><?php echo $magnet->comment->total ?></sup> |
||||
</span> |
||||
<?php } ?> |
||||
<span class="float-right margin-l-12"> |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/download.php?magnetId=<?php echo $magnet->magnetId ?>" title="<?php echo _('Download') ?>"> |
||||
<?php if ($magnet->download->status) { ?> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-down-circle-fill" viewBox="0 0 16 16"> |
||||
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v5.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V4.5z"/> |
||||
</svg> |
||||
<?php } else { ?> |
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-down-circle" viewBox="0 0 16 16"> |
||||
<path fill-rule="evenodd" d="M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8zm15 0A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v5.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V4.5z"/> |
||||
</svg> |
||||
<?php } ?> |
||||
</a> |
||||
<sup><?php echo $magnet->download->total ?></sup> |
||||
</span> |
||||
</div> |
||||
</div> |
||||
<?php } else { ?> |
||||
<!-- DOUBTS |
||||
<div class="padding-16 margin-y-8 border-radius-3 background-color-night"> |
||||
<div><?php echo _('Hidden content') ?></div> |
||||
</div> |
||||
--> |
||||
<?php } ?> |
||||
<?php } ?> |
||||
<?php } else { ?> |
||||
<div class="padding-16 margin-y-8 border-radius-3 background-color-night text-center"> |
||||
<h2 class="margin-b-8"> |
||||
<?php echo _('Nothing found') ?> |
||||
</h2> |
||||
<div class="text-color-night"><?php echo _('* share your magnet links above to change it') ?></div> |
||||
</div> |
||||
<?php } ?> |
||||
<?php } else { ?> |
||||
<div class="padding-16 margin-y-8 border-radius-3 background-color-night"> |
||||
<div class="text-center"><?php echo $response->message ?></div> |
||||
</div> |
||||
<?php } ?> |
||||
</div> |
||||
</div> |
||||
<?php if ($response->total > WEBSITE_PAGINATION_LIMIT) { ?> |
||||
<div class="row"> |
||||
<div class="column width-100 text-right"> |
||||
<?php echo sprintf(_('page %s / %s'), $request->page, ceil($response->total / WEBSITE_PAGINATION_LIMIT)) ?> |
||||
<?php if ($request->page > 1) { ?> |
||||
<a class="button margin-l-8" |
||||
rel="nofollow" |
||||
href="<?php echo sprintf('%s/search.php?page=%s', WEBSITE_URL, |
||||
$request->page - 1, |
||||
sprintf('&query=%s', urlencode($request->query))) ?>"> |
||||
<?php echo _('back') ?> |
||||
</a> |
||||
<?php } ?> |
||||
<?php if ($request->page < ceil($response->total / WEBSITE_PAGINATION_LIMIT)) { ?> |
||||
<a class="button margin-l-4" |
||||
rel="nofollow" |
||||
href="<?php echo sprintf('%s/search.php?page=%s', WEBSITE_URL, |
||||
$request->page + 1, |
||||
sprintf('&query=%s', urlencode($request->query))) ?>"> |
||||
<?php echo _('next') ?> |
||||
</a> |
||||
<?php } ?> |
||||
</div> |
||||
</div> |
||||
<?php } ?> |
||||
</div> |
||||
</main> |
||||
<footer> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="column width-100 text-center margin-y-8"> |
||||
<?php foreach (json_decode(file_get_contents(__DIR__ . '/../config/trackers.json')) as $i => $tracker) { ?> |
||||
<?php if (!empty($tracker->announce) && !empty($tracker->stats)) { ?> |
||||
<a href="<?php echo $tracker->announce ?>"><?php echo sprintf('Tracker %s', $i + 1) ?></a> |
||||
/ |
||||
<a href="<?php echo $tracker->stats ?>"><?php echo _('Stats') ?></a> |
||||
| |
||||
<?php } ?> |
||||
<?php } ?> |
||||
<a href="<?php echo WEBSITE_URL ?>/faq.php"><?php echo _('F.A.Q') ?></a> |
||||
| |
||||
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/search.php?rss<?php echo sprintf('&query=%s', urlencode($request->query)) ?>"> |
||||
<?php echo _('RSS') ?> |
||||
</a> |
||||
<?php if (API_EXPORT_ENABLED) { ?> |
||||
| |
||||
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a> |
||||
<?php } ?> |
||||
| |
||||
<a href="https://github.com/YGGverse/YGGtracker"><?php echo _('GitHub') ?></a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</footer> |
||||
</body> |
||||
</html> |
||||
<?php } ?> |
Loading…
Reference in new issue