rename magnet meta fields

This commit is contained in:
ghost 2023-09-12 14:37:48 +03:00
parent 14ee992930
commit 55ee0d86d8
10 changed files with 70 additions and 70 deletions

Binary file not shown.

View File

@ -15,8 +15,8 @@ source magnet : yggtracker
SELECT `magnet`.`timeAdded`, \ SELECT `magnet`.`timeAdded`, \
`magnet`.`timeUpdated`, \ `magnet`.`timeUpdated`, \
`magnet`.`magnetId`, \ `magnet`.`magnetId`, \
`magnet`.`metaTitle`, \ `magnet`.`title`, \
`magnet`.`metaDescription`, \ `magnet`.`preview`, \
`magnet`.`description`, \ `magnet`.`description`, \
`magnet`.`dn`, \ `magnet`.`dn`, \
(SELECT GROUP_CONCAT(DISTINCT `infoHash`.`value`) \ (SELECT GROUP_CONCAT(DISTINCT `infoHash`.`value`) \

View File

@ -84,11 +84,11 @@ define('MAGNET_DEFAULT_SENSITIVE', false);
define('MAGNET_EDITOR_LOCK_TIMEOUT', 60*60); define('MAGNET_EDITOR_LOCK_TIMEOUT', 60*60);
define('MAGNET_META_TITLE_MIN_LENGTH', 10); define('MAGNET_TITLE_MIN_LENGTH', 10);
define('MAGNET_META_TITLE_MAX_LENGTH', 140); define('MAGNET_TITLE_MAX_LENGTH', 140);
define('MAGNET_META_DESCRIPTION_MIN_LENGTH', 0); define('MAGNET_PREVIEW_MIN_LENGTH', 0);
define('MAGNET_META_DESCRIPTION_MAX_LENGTH', 255); define('MAGNET_PREVIEW_MAX_LENGTH', 255);
define('MAGNET_DESCRIPTION_MIN_LENGTH', 0); define('MAGNET_DESCRIPTION_MIN_LENGTH', 0);
define('MAGNET_DESCRIPTION_MAX_LENGTH', 10000); define('MAGNET_DESCRIPTION_MAX_LENGTH', 10000);

View File

@ -694,24 +694,24 @@ class Database {
return $query->rowCount(); return $query->rowCount();
} }
public function updateMagnetMetaTitle(int $magnetId, string $metaTitle, int $timeUpdated) : int { public function updateMagnetTitle(int $magnetId, string $title, int $timeUpdated) : int {
$this->_debug->query->update->total++; $this->_debug->query->update->total++;
$query = $this->_db->prepare('UPDATE `magnet` SET `metaTitle` = ?, `timeUpdated` = ? WHERE `magnetId` = ?'); $query = $this->_db->prepare('UPDATE `magnet` SET `title` = ?, `timeUpdated` = ? WHERE `magnetId` = ?');
$query->execute([$metaTitle, $timeUpdated, $magnetId]); $query->execute([$title, $timeUpdated, $magnetId]);
return $query->rowCount(); return $query->rowCount();
} }
public function updateMagnetMetaDescription(int $magnetId, string $metaDescription, int $timeUpdated) : int { public function updateMagnetPreview(int $magnetId, string $preview, int $timeUpdated) : int {
$this->_debug->query->update->total++; $this->_debug->query->update->total++;
$query = $this->_db->prepare('UPDATE `magnet` SET `metaDescription` = ?, `timeUpdated` = ? WHERE `magnetId` = ?'); $query = $this->_db->prepare('UPDATE `magnet` SET `preview` = ?, `timeUpdated` = ? WHERE `magnetId` = ?');
$query->execute([$metaDescription, $timeUpdated, $magnetId]); $query->execute([$preview, $timeUpdated, $magnetId]);
return $query->rowCount(); return $query->rowCount();
} }

View File

@ -77,7 +77,7 @@ class Sphinx {
{ {
if (!in_array(mb_strtolower($value), array_map('strtolower', $stopWords))) if (!in_array(mb_strtolower($value), array_map('strtolower', $stopWords)))
{ {
$result[] = sprintf('@metaTitle "%s" | @dn "%s"', $value, $value); $result[] = sprintf('@title "%s" | @dn "%s"', $value, $value);
} }
} }
} }

View File

@ -212,11 +212,11 @@ else
// Return html // Return html
$response->html->title = sprintf( $response->html->title = sprintf(
_('%s - Download - %s'), _('%s - Download - %s'),
htmlentities($magnet->metaTitle), htmlentities($magnet->title),
WEBSITE_NAME WEBSITE_NAME
); );
$response->html->h1 = htmlentities($magnet->metaTitle); $response->html->h1 = htmlentities($magnet->title);
// @TODO implement .bittorrent, separated v1/v2 magnet links // @TODO implement .bittorrent, separated v1/v2 magnet links
$response->html->link->magnet = implode('&', array_unique($link->magnet)); $response->html->link->magnet = implode('&', array_unique($link->magnet));

View File

@ -24,7 +24,7 @@ $response = (object)
'message' => false, 'message' => false,
'form' => (object) 'form' => (object)
[ [
'metaTitle' => (object) 'title' => (object)
[ [
'value' => false, 'value' => false,
'valid' => (object) 'valid' => (object)
@ -33,7 +33,7 @@ $response = (object)
'message' => false, 'message' => false,
] ]
], ],
'metaDescription' => (object) 'preview' => (object)
[ [
'value' => false, 'value' => false,
'valid' => (object) 'valid' => (object)
@ -221,27 +221,27 @@ else {
} }
// Meta // Meta
if (MAGNET_META_TITLE_MIN_LENGTH <= mb_strlen($_POST['metaTitle']) && MAGNET_META_TITLE_MAX_LENGTH >= mb_strlen($_POST['metaTitle'])) if (MAGNET_TITLE_MIN_LENGTH <= mb_strlen($_POST['title']) && MAGNET_TITLE_MAX_LENGTH >= mb_strlen($_POST['title']))
{ {
$db->updateMagnetMetaTitle($magnet->magnetId, trim(strip_tags(html_entity_decode($_POST['metaTitle']))), time()); $db->updateMagnetTitle($magnet->magnetId, trim(strip_tags(html_entity_decode($_POST['title']))), time());
$response->form->metaTitle->valid->success = true; $response->form->title->valid->success = true;
$response->form->metaTitle->valid->message = false; $response->form->title->valid->message = false;
} }
else else
{ {
$response->form->metaTitle->valid->success = false; $response->form->title->valid->success = false;
$response->form->metaTitle->valid->message = sprintf(_('* required, %s-%s chars'), MAGNET_META_TITLE_MIN_LENGTH, MAGNET_META_TITLE_MAX_LENGTH); $response->form->title->valid->message = sprintf(_('* required, %s-%s chars'), MAGNET_TITLE_MIN_LENGTH, MAGNET_TITLE_MAX_LENGTH);
} }
if (mb_strlen($_POST['metaDescription']) < MAGNET_META_DESCRIPTION_MIN_LENGTH || mb_strlen($_POST['metaDescription']) > MAGNET_META_DESCRIPTION_MAX_LENGTH) if (mb_strlen($_POST['preview']) < MAGNET_PREVIEW_MIN_LENGTH || mb_strlen($_POST['preview']) > MAGNET_PREVIEW_MAX_LENGTH)
{ {
$response->form->metaDescription->valid->success = false; $response->form->preview->valid->success = false;
$response->form->metaDescription->valid->message = sprintf(_('* required, %s-%s chars, %s provided'), MAGNET_META_DESCRIPTION_MIN_LENGTH, MAGNET_META_DESCRIPTION_MAX_LENGTH, mb_strlen($_POST['metaDescription'])); $response->form->preview->valid->message = sprintf(_('* required, %s-%s chars, %s provided'), MAGNET_PREVIEW_MIN_LENGTH, MAGNET_PREVIEW_MAX_LENGTH, mb_strlen($_POST['preview']));
} }
else else
{ {
$db->updateMagnetMetaDescription($magnet->magnetId, trim(strip_tags(html_entity_decode($_POST['metaDescription']))), time()); $db->updateMagnetPreview($magnet->magnetId, trim(strip_tags(html_entity_decode($_POST['preview']))), time());
} }
if (mb_strlen($_POST['description']) < MAGNET_DESCRIPTION_MIN_LENGTH || mb_strlen($_POST['description']) > MAGNET_DESCRIPTION_MAX_LENGTH) if (mb_strlen($_POST['description']) < MAGNET_DESCRIPTION_MIN_LENGTH || mb_strlen($_POST['description']) > MAGNET_DESCRIPTION_MAX_LENGTH)
@ -466,8 +466,8 @@ else {
// Is valid // Is valid
if ($response->success && if ($response->success &&
$response->form->metaTitle->valid->success && $response->form->title->valid->success &&
$response->form->metaDescription->valid->success && $response->form->preview->valid->success &&
$response->form->description->valid->success && $response->form->description->valid->success &&
$response->form->tr->valid->success && $response->form->tr->valid->success &&
$response->form->as->valid->success && $response->form->as->valid->success &&
@ -495,10 +495,10 @@ else {
} }
// Meta Title, auto-replace with Display Name on empty value // Meta Title, auto-replace with Display Name on empty value
$response->form->metaTitle->value = $magnet->metaTitle ? $magnet->metaTitle : $magnet->dn; $response->form->title->value = $magnet->title ? $magnet->title : $magnet->dn;
// Meta Description // Meta Description
$response->form->metaDescription->value = $magnet->metaDescription; $response->form->preview->value = $magnet->preview;
// Description // Description
$response->form->description->value = $magnet->description; $response->form->description->value = $magnet->description;
@ -637,30 +637,30 @@ else {
<legend class="text-right width-100 padding-y-8 margin-b-8 border-bottom-default"><?php echo _('Meta') ?></legend> <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"> <label class="display-block margin-y-8 padding-t-4">
<?php echo _('Title') ?> <?php echo _('Title') ?>
<sub class="opacity-0 parent-hover-opacity-09" title="<?php echo sprintf(_('Subject and meta title (%s-%s chars)'), MAGNET_META_TITLE_MIN_LENGTH, MAGNET_META_TITLE_MAX_LENGTH) ?>"> <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"> <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"/> <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> </svg>
</sub> </sub>
<?php if ($response->form->metaTitle->valid->message) { ?> <?php if ($response->form->title->valid->message) { ?>
<div class="margin-b-8"><?php echo $response->form->metaTitle->valid->message ?></div> <div class="margin-b-8"><?php echo $response->form->title->valid->message ?></div>
<?php } ?> <?php } ?>
<input class="width-100 margin-t-8 <?php echo ($response->form->metaTitle->valid->success ? false : 'background-color-red') ?>" type="text" name="metaTitle" value="<?php echo $response->form->metaTitle->value ?>" placeholder="<?php echo _('Main title') ?>" maxlength="255" /> <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>
<label class="display-block margin-y-8 padding-t-4"> <label class="display-block margin-y-8 padding-t-4">
<?php echo _('Short description') ?> <?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_META_DESCRIPTION_MIN_LENGTH, MAGNET_META_DESCRIPTION_MAX_LENGTH) ?>"> <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"> <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"/> <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> </svg>
</sub> </sub>
<?php if ($response->form->metaDescription->valid->message) { ?> <?php if ($response->form->preview->valid->message) { ?>
<div class="margin-b-8"><?php echo $response->form->metaDescription->valid->message ?></div> <div class="margin-b-8"><?php echo $response->form->preview->valid->message ?></div>
<?php } ?> <?php } ?>
<textarea class="width-100 margin-t-8 <?php echo ($response->form->metaDescription->valid->success ? false : 'background-color-red') ?>" name="metaDescription" placeholder="<?php echo _('Shows in listing and meta tags') ?>"><?php echo $response->form->metaDescription->value ?></textarea> <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>
<label class="display-block margin-y-8 padding-t-4"> <label class="display-block margin-y-8 padding-t-4">
<?php echo _('Long description') ?> <?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) ?>"> <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"> <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"/> <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"/>

View File

@ -118,10 +118,10 @@ else
$response->magnets[] = (object) $response->magnets[] = (object)
[ [
'magnetId' => $magnet->magnetId, 'magnetId' => $magnet->magnetId,
'metaTitle' => $magnet->metaTitle ? htmlentities($magnet->metaTitle) : ($magnet->dn ? htmlentities($magnet->dn): false), 'title' => $magnet->title ? htmlentities($magnet->title) : ($magnet->dn ? htmlentities($magnet->dn): false),
'metaDescription' => $magnet->metaDescription ? nl2br( 'preview' => $magnet->preview ? nl2br(
htmlentities( htmlentities(
$magnet->metaDescription $magnet->preview
) )
) : false, ) : false,
'approved' => (bool) $magnet->approved, 'approved' => (bool) $magnet->approved,
@ -172,8 +172,8 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
<?php foreach ($response->magnets as $magnet) { ?> <?php foreach ($response->magnets as $magnet) { ?>
<?php if ($magnet->access->read) { ?> <?php if ($magnet->access->read) { ?>
<item> <item>
<title><?php echo htmlspecialchars($magnet->metaTitle, ENT_QUOTES, 'UTF-8') ?></title> <title><?php echo htmlspecialchars($magnet->title, ENT_QUOTES, 'UTF-8') ?></title>
<description><?php echo htmlspecialchars(strip_tags($magnet->metaDescription), ENT_QUOTES, 'UTF-8') ?></description> <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> <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> <link><?php echo sprintf('%s/magnet.php?magnetId=%s', WEBSITE_URL, $magnet->magnetId) ?></link>
</item> </item>
@ -222,7 +222,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
<?php echo !$magnet->public || !$magnet->approved ? 'opacity-06 opacity-hover-1' : false ?>"> <?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 ?>"> <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) ?>"> <a href="<?php echo sprintf('%s/magnet.php?magnetId=%s', WEBSITE_URL, $magnet->magnetId) ?>">
<h2 class="margin-b-8"><?php echo $magnet->metaTitle ?></h2> <h2 class="margin-b-8"><?php echo $magnet->title ?></h2>
<?php if ($magnet->leechers && !$magnet->seeders) { ?> <?php if ($magnet->leechers && !$magnet->seeders) { ?>
<span class="label label-green margin-x-4 font-size-10 position-relative top--2 cursor-default" <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') ?>"> title="<?php echo _('Active leechers waiting for seeds') ?>">
@ -255,8 +255,8 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
</a> </a>
<?php } ?> <?php } ?>
</div> </div>
<?php if ($magnet->metaDescription) { ?> <?php if ($magnet->preview) { ?>
<div class="margin-y-8"><?php echo $magnet->metaDescription ?></div> <div class="margin-y-8"><?php echo $magnet->preview ?></div>
<?php } ?> <?php } ?>
<?php if ($magnet->keywords) { ?> <?php if ($magnet->keywords) { ?>
<div class="margin-y-8"> <div class="margin-y-8">

View File

@ -101,10 +101,10 @@ else
$response->magnet = (object) $response->magnet = (object)
[ [
'magnetId' => $magnet->magnetId, 'magnetId' => $magnet->magnetId,
'metaTitle' => $magnet->metaTitle ? htmlentities($magnet->metaTitle) : ($magnet->dn ? htmlentities($magnet->dn): false), 'title' => $magnet->title ? htmlentities($magnet->title) : ($magnet->dn ? htmlentities($magnet->dn): false),
'metaDescription' => $magnet->metaDescription ? nl2br( 'preview' => $magnet->preview ? nl2br(
htmlentities( htmlentities(
$magnet->metaDescription $magnet->preview
) )
) : false, ) : false,
'description' => $magnet->description ? nl2br( 'description' => $magnet->description ? nl2br(
@ -153,12 +153,12 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
<channel> <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> <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> <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->metaTitle), WEBSITE_NAME) ?></title> <title><?php echo sprintf(_('%s - Comments - %s'), htmlentities($response->magnet->title), WEBSITE_NAME) ?></title>
<description><?php echo _('BitTorrent Registry for Yggdrasil') ?></description> <description><?php echo _('BitTorrent Registry for Yggdrasil') ?></description>
<?php foreach ($db->getMagnetComments($response->magnet->magnetId) as $magnetComment) { ?> <?php foreach ($db->getMagnetComments($response->magnet->magnetId) as $magnetComment) { ?>
<?php if ($response->user->address == $db->getUser($magnetComment->userId)->address || in_array($response->user->address, MODERATOR_IP_LIST)) { ?> <?php if ($response->user->address == $db->getUser($magnetComment->userId)->address || in_array($response->user->address, MODERATOR_IP_LIST)) { ?>
<item> <item>
<title><?php echo sprintf('%s - comment #%s', htmlspecialchars($magnet->metaTitle, ENT_QUOTES, 'UTF-8'), $magnetComment->magnetCommentId) ?></title> <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> <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> <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> <link><?php echo sprintf('%s/magnet.php?magnetId=%s#comment-%s', WEBSITE_URL, $response->magnet->magnetId, $magnetComment->magnetCommentId) ?></link>
@ -174,8 +174,8 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
<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/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 ?>" /> <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) { ?> <?php if ($response->success) { ?>
<title><?php echo sprintf(_('%s - %s'), htmlentities($response->magnet->metaTitle), WEBSITE_NAME) ?></title> <title><?php echo sprintf(_('%s - %s'), htmlentities($response->magnet->title), WEBSITE_NAME) ?></title>
<meta name="description" content="<?php echo htmlentities($response->magnet->metaDescription) ?>" /> <meta name="description" content="<?php echo htmlentities($response->magnet->preview) ?>" />
<meta name="keywords" content="<?php echo htmlentities(implode(',',$response->magnet->keywords)) ?>" /> <meta name="keywords" content="<?php echo htmlentities(implode(',',$response->magnet->keywords)) ?>" />
<?php } else { ?> <?php } else { ?>
<title><?php echo $response->message ?></title> <title><?php echo $response->message ?></title>
@ -207,7 +207,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
<?php echo !$response->magnet->public || !$response->magnet->approved ? 'opacity-06 opacity-hover-1' : false ?>"> <?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 ?>"> <div class="padding-16 <?php echo $response->magnet->sensitive ? 'blur-2 blur-hover-0' : false ?>">
<a name="magnet-<?php echo $response->magnet->magnetId ?>"></a> <a name="magnet-<?php echo $response->magnet->magnetId ?>"></a>
<h1 class="margin-b-8"><?php echo $response->magnet->metaTitle ?></h1> <h1 class="margin-b-8"><?php echo $response->magnet->title ?></h1>
<?php if ($response->magnet->leechers && !$response->magnet->seeders) { ?> <?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" <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') ?>"> title="<?php echo _('Active leechers waiting for seeds') ?>">
@ -247,8 +247,8 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
--> -->
<?php } ?> <?php } ?>
</div> </div>
<?php if ($response->magnet->metaDescription) { ?> <?php if ($response->magnet->preview) { ?>
<div class="margin-y-8"><?php echo $response->magnet->metaDescription ?></div> <div class="margin-y-8"><?php echo $response->magnet->preview ?></div>
<?php } ?> <?php } ?>
<?php if ($response->magnet->description) { ?> <?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> <div class="margin-t-16 margin-b-8 padding-t-16 border-top-default"><?php echo $response->magnet->description ?></div>
@ -349,7 +349,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
</span> </span>
</div> </div>
</div> </div>
<?php if ($similarMagnetsTotal = $sphinx->searchMagnetsTotal($magnet->metaTitle ? $magnet->metaTitle : $magnet->dn, 'similar', MAGNET_STOP_WORDS_SIMILAR)) { ?> <?php if ($similarMagnetsTotal = $sphinx->searchMagnetsTotal($magnet->title ? $magnet->title : $magnet->dn, 'similar', MAGNET_STOP_WORDS_SIMILAR)) { ?>
<?php if ($similarMagnetsTotal > 1) { // skip current magnet ?> <?php if ($similarMagnetsTotal > 1) { // skip current magnet ?>
<div class="padding-y-8 padding-x-16"> <div class="padding-y-8 padding-x-16">
<a name="similar"></a> <a name="similar"></a>
@ -358,7 +358,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
<div class="padding-x-16 margin-b-8"> <div class="padding-x-16 margin-b-8">
<div class="padding-16 margin-t-8 border-radius-3 background-color-night"> <div class="padding-16 margin-t-8 border-radius-3 background-color-night">
<?php foreach ( $sphinx->searchMagnets( <?php foreach ( $sphinx->searchMagnets(
$magnet->metaTitle ? $magnet->metaTitle : $magnet->dn, $magnet->title ? $magnet->title : $magnet->dn,
0, 0,
10, 10,
$similarMagnetsTotal, $similarMagnetsTotal,
@ -371,7 +371,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
in_array($response->user->address, MODERATOR_IP_LIST) || ($magnet->approved && $magnet->public))) { ?> in_array($response->user->address, MODERATOR_IP_LIST) || ($magnet->approved && $magnet->public))) { ?>
<div class="margin-y-8"> <div class="margin-y-8">
<a href="<?php echo sprintf('%s/magnet.php?magnetId=%s', WEBSITE_URL, $magnet->magnetId) ?>" class="margin-b-16"> <a href="<?php echo sprintf('%s/magnet.php?magnetId=%s', WEBSITE_URL, $magnet->magnetId) ?>" class="margin-b-16">
<?php echo nl2br(htmlentities($magnet->metaTitle ? $magnet->metaTitle : $magnet->dn)) ?> <?php echo nl2br(htmlentities($magnet->title ? $magnet->title : $magnet->dn)) ?>
</a> </a>
</div> </div>
<?php } ?> <?php } ?>

View File

@ -276,11 +276,11 @@ else if (is_null($user->public))
</tr> </tr>
<tr> <tr>
<td><?php echo _('Title, chars') ?></td> <td><?php echo _('Title, chars') ?></td>
<td><?php echo MAGNET_META_TITLE_MIN_LENGTH ?>-<?php echo MAGNET_META_TITLE_MAX_LENGTH ?></td> <td><?php echo MAGNET_TITLE_MIN_LENGTH ?>-<?php echo MAGNET_TITLE_MAX_LENGTH ?></td>
</tr> </tr>
<tr> <tr>
<td><?php echo _('Description short, chars') ?></td> <td><?php echo _('Description short, chars') ?></td>
<td><?php echo MAGNET_META_DESCRIPTION_MIN_LENGTH ?>-<?php echo MAGNET_META_DESCRIPTION_MAX_LENGTH ?></td> <td><?php echo MAGNET_PREVIEW_MIN_LENGTH ?>-<?php echo MAGNET_PREVIEW_MAX_LENGTH ?></td>
</tr> </tr>
<tr> <tr>
<td><?php echo _('Description long, chars') ?></td> <td><?php echo _('Description long, chars') ?></td>