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_EOL ?> magnet->magnetId) ?> <?php echo sprintf(_('%s - Comments - %s'), htmlentities($response->magnet->title), WEBSITE_NAME) ?> findMagnetComments($response->magnet->magnetId) as $magnetComment) { ?> user->address == $db->getUser($magnetComment->userId)->address || in_array($response->user->address, MODERATOR_IP_LIST)) { ?> <?php echo sprintf('%s - comment #%s', htmlspecialchars($magnet->title, ENT_QUOTES, 'UTF-8'), $magnetComment->magnetCommentId) ?> value, ENT_QUOTES, 'UTF-8') ?> magnet->magnetId, $magnetComment->magnetCommentId) ?> magnet->magnetId, $magnetComment->magnetCommentId) ?> success) { ?> <?php echo sprintf(_('%s - %s'), htmlentities($response->magnet->title), WEBSITE_NAME) ?> <?php echo $response->message ?>
success) { ?> magnet->access->read) { ?>

magnet->title ?>

magnet->leechers && !$response->magnet->seeders) { ?>
magnet->public) { ?> magnet->approved) { ?> magnet->access->edit) { ?>
magnet->preview) { ?>
magnet->preview ?>
magnet->description) { ?>
magnet->description ?>
magnet->keywords) { ?>
magnet->keywords as $keyword) { ?> #
magnet->timeUpdated ? _('Updated') : _('Added') ?> magnet->timeUpdated ? $response->magnet->timeUpdated : $response->magnet->timeAdded ?> magnet->seeders ?> magnet->completed ?> magnet->leechers ?> magnet->directs) { ?> magnet->directs ?> magnet->star->status) { ?> magnet->star->total ?> magnet->comments) { ?> magnet->comment->status) { ?> magnet->comment->total ?> magnet->download->status) { ?> magnet->download->total ?>
searchMagnetsTotal($magnet->title ? $magnet->title : $magnet->dn, 'similar', MAGNET_STOP_WORDS_SIMILAR)) { ?> 1) { // skip current magnet ?>

searchMagnets( $magnet->title ? $magnet->title : $magnet->dn, 0, 10, $similarMagnetsTotal, 'similar', MAGNET_STOP_WORDS_SIMILAR ) as $result) { ?> getMagnet($result->magnetid)) { ?> 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))) { ?>
magnet->comments) { ?>

findMagnetComments($response->magnet->magnetId) as $magnetComment) { ?>
user->address == $db->getUser($magnetComment->userId)->address || in_array($response->user->address, MODERATOR_IP_LIST) || ($magnetComment->approved && $magnetComment->public)) { ?>
value)) ?>
timeAdded) ?> public) { ?> approved) { ?> user->address, MODERATOR_IP_LIST)) { ?> approved) { ?>
message ?>