mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-01-11 07:27:58 +00:00
add long description field
This commit is contained in:
parent
e750dac85d
commit
c5eef6751d
Binary file not shown.
@ -88,7 +88,10 @@ define('MAGNET_META_TITLE_MIN_LENGTH', 10);
|
|||||||
define('MAGNET_META_TITLE_MAX_LENGTH', 255);
|
define('MAGNET_META_TITLE_MAX_LENGTH', 255);
|
||||||
|
|
||||||
define('MAGNET_META_DESCRIPTION_MIN_LENGTH', 0);
|
define('MAGNET_META_DESCRIPTION_MIN_LENGTH', 0);
|
||||||
define('MAGNET_META_DESCRIPTION_MAX_LENGTH', 10000);
|
define('MAGNET_META_DESCRIPTION_MAX_LENGTH', 255);
|
||||||
|
|
||||||
|
define('MAGNET_DESCRIPTION_MIN_LENGTH', 0);
|
||||||
|
define('MAGNET_DESCRIPTION_MAX_LENGTH', 10000);
|
||||||
|
|
||||||
|
|
||||||
define('MAGNET_STOP_WORDS_SIMILAR',
|
define('MAGNET_STOP_WORDS_SIMILAR',
|
||||||
|
@ -641,6 +641,17 @@ class Database {
|
|||||||
return $query->rowCount();
|
return $query->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateMagnetDescription(int $magnetId, string $description, int $timeUpdated) : int {
|
||||||
|
|
||||||
|
$this->_debug->query->update->total++;
|
||||||
|
|
||||||
|
$query = $this->_db->prepare('UPDATE `magnet` SET `description` = ?, `timeUpdated` = ? WHERE `magnetId` = ?');
|
||||||
|
|
||||||
|
$query->execute([$description, $timeUpdated, $magnetId]);
|
||||||
|
|
||||||
|
return $query->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
public function updateMagnetPublic(int $magnetId, bool $public, int $timeUpdated) : int {
|
public function updateMagnetPublic(int $magnetId, bool $public, int $timeUpdated) : int {
|
||||||
|
|
||||||
$this->_debug->query->update->total++;
|
$this->_debug->query->update->total++;
|
||||||
|
@ -242,17 +242,6 @@
|
|||||||
transition: opacity .2s;
|
transition: opacity .2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.max-height-220 {
|
|
||||||
max-height: 220px;
|
|
||||||
overflow: hidden;
|
|
||||||
transition: max-height .2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
*:hover > .max-height-parent-hover-840 {
|
|
||||||
max-height: 840px;
|
|
||||||
transition: max-height .2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blur-2 {
|
.blur-2 {
|
||||||
filter: blur(2px);
|
filter: blur(2px);
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,15 @@ $response = (object)
|
|||||||
'message' => false,
|
'message' => false,
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
'description' => (object)
|
||||||
|
[
|
||||||
|
'value' => false,
|
||||||
|
'valid' => (object)
|
||||||
|
[
|
||||||
|
'success' => true,
|
||||||
|
'message' => false,
|
||||||
|
]
|
||||||
|
],
|
||||||
'dn' => (object)
|
'dn' => (object)
|
||||||
[
|
[
|
||||||
'value' => false,
|
'value' => false,
|
||||||
@ -211,17 +220,27 @@ else {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$response->form->metaTitle->valid->success = false;
|
$response->form->metaTitle->valid->success = false;
|
||||||
$response->form->metaTitle->valid->message = sprintf(_('* required, minimum %s-%s chars'), MAGNET_META_TITLE_MIN_LENGTH, MAGNET_META_TITLE_MAX_LENGTH);
|
$response->form->metaTitle->valid->message = sprintf(_('* required, %s-%s chars'), MAGNET_META_TITLE_MIN_LENGTH, MAGNET_META_TITLE_MAX_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MAGNET_META_DESCRIPTION_MIN_LENGTH <= mb_strlen($_POST['metaDescription']) && MAGNET_META_DESCRIPTION_MAX_LENGTH >= mb_strlen($_POST['metaDescription']))
|
if (mb_strlen($_POST['metaDescription']) < MAGNET_META_DESCRIPTION_MIN_LENGTH || mb_strlen($_POST['metaDescription']) > MAGNET_META_DESCRIPTION_MAX_LENGTH)
|
||||||
{
|
{
|
||||||
$db->updateMagnetMetaDescription($magnet->magnetId, trim(strip_tags(html_entity_decode($_POST['metaDescription']))), time());
|
$response->form->metaDescription->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']));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$response->form->metaDescription->valid->success = false;
|
$db->updateMagnetMetaDescription($magnet->magnetId, trim(strip_tags(html_entity_decode($_POST['metaDescription']))), time());
|
||||||
$response->form->metaDescription->valid->message = sprintf(_('* required, minimum %s-%s chars'), MAGNET_META_DESCRIPTION_MIN_LENGTH, MAGNET_META_DESCRIPTION_MAX_LENGTH);
|
}
|
||||||
|
|
||||||
|
if (mb_strlen($_POST['description']) < MAGNET_DESCRIPTION_MIN_LENGTH || mb_strlen($_POST['description']) > MAGNET_DESCRIPTION_MAX_LENGTH)
|
||||||
|
{
|
||||||
|
$response->form->description->valid->success = false;
|
||||||
|
$response->form->description->valid->message = sprintf(_('* required, %s-%s chars, %s provided'), MAGNET_DESCRIPTION_MIN_LENGTH, MAGNET_DESCRIPTION_MAX_LENGTH, mb_strlen($_POST['description']));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->updateMagnetDescription($magnet->magnetId, trim(strip_tags(html_entity_decode($_POST['description']))), time());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Social
|
// Social
|
||||||
@ -364,6 +383,7 @@ else {
|
|||||||
if ($response->success &&
|
if ($response->success &&
|
||||||
$response->form->metaTitle->valid->success &&
|
$response->form->metaTitle->valid->success &&
|
||||||
$response->form->metaDescription->valid->success &&
|
$response->form->metaDescription->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 &&
|
||||||
$response->form->xs->valid->success)
|
$response->form->xs->valid->success)
|
||||||
@ -389,6 +409,9 @@ else {
|
|||||||
// Meta Description
|
// Meta Description
|
||||||
$response->form->metaDescription->value = $magnet->metaDescription;
|
$response->form->metaDescription->value = $magnet->metaDescription;
|
||||||
|
|
||||||
|
// Description
|
||||||
|
$response->form->description->value = $magnet->description;
|
||||||
|
|
||||||
// Magnet settings
|
// Magnet settings
|
||||||
$response->form->public->value = (bool) $magnet->public;
|
$response->form->public->value = (bool) $magnet->public;
|
||||||
$response->form->comments->value = (bool) $magnet->comments;
|
$response->form->comments->value = (bool) $magnet->comments;
|
||||||
@ -517,11 +540,16 @@ else {
|
|||||||
<div class="margin-b-8"><?php echo $response->form->metaTitle->valid->message ?></div>
|
<div class="margin-b-8"><?php echo $response->form->metaTitle->valid->message ?></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<input class="width-100 <?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 <?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" />
|
||||||
<label class="display-block margin-y-8"><?php echo _('Description') ?></label>
|
<label class="display-block margin-y-8"><?php echo _('Short description') ?></label>
|
||||||
<?php if ($response->form->metaDescription->valid->message) { ?>
|
<?php if ($response->form->metaDescription->valid->message) { ?>
|
||||||
<div class="margin-b-8"><?php echo $response->form->metaDescription->valid->message ?></div>
|
<div class="margin-b-8"><?php echo $response->form->metaDescription->valid->message ?></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<textarea class="width-100 <?php echo ($response->form->metaDescription->valid->success ? false : 'background-color-red') ?>" name="metaDescription" placeholder="<?php echo _('Describe your magnet for others') ?>"><?php echo $response->form->metaDescription->value ?></textarea>
|
<textarea class="width-100 <?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>
|
||||||
|
<label class="display-block margin-y-8"><?php echo _('Long description') ?></label>
|
||||||
|
<?php if ($response->form->description->valid->message) { ?>
|
||||||
|
<div class="margin-b-8"><?php echo $response->form->description->valid->message ?></div>
|
||||||
|
<?php } ?>
|
||||||
|
<textarea class="width-100 <?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>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="display-block margin-b-16">
|
<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>
|
<legend class="text-right width-100 padding-y-8 margin-b-8 border-bottom-default"><?php echo _('BitTorrent') ?></legend>
|
||||||
|
@ -170,7 +170,7 @@ else
|
|||||||
'metaTitle' => $magnet->metaTitle ? htmlentities($magnet->metaTitle) : ($magnet->dn ? htmlentities($magnet->dn): false),
|
'metaTitle' => $magnet->metaTitle ? htmlentities($magnet->metaTitle) : ($magnet->dn ? htmlentities($magnet->dn): false),
|
||||||
'metaDescription' => $magnet->metaDescription ? nl2br(
|
'metaDescription' => $magnet->metaDescription ? nl2br(
|
||||||
htmlentities(
|
htmlentities(
|
||||||
substr($magnet->metaDescription, 0, MAGNET_META_DESCRIPTION_LENGTH_SHORT)
|
$magnet->metaDescription
|
||||||
)
|
)
|
||||||
) : false,
|
) : false,
|
||||||
'approved' => (bool) $magnet->approved,
|
'approved' => (bool) $magnet->approved,
|
||||||
@ -306,7 +306,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($magnet->metaDescription) { ?>
|
<?php if ($magnet->metaDescription) { ?>
|
||||||
<div class="margin-y-8 max-height-220 max-height-parent-hover-840"><?php echo $magnet->metaDescription ?></div>
|
<div class="margin-y-8"><?php echo $magnet->metaDescription ?></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ($magnet->keywords) { ?>
|
<?php if ($magnet->keywords) { ?>
|
||||||
<div class="margin-y-8">
|
<div class="margin-y-8">
|
||||||
|
@ -147,9 +147,14 @@ else
|
|||||||
'metaTitle' => $magnet->metaTitle ? htmlentities($magnet->metaTitle) : ($magnet->dn ? htmlentities($magnet->dn): false),
|
'metaTitle' => $magnet->metaTitle ? htmlentities($magnet->metaTitle) : ($magnet->dn ? htmlentities($magnet->dn): false),
|
||||||
'metaDescription' => $magnet->metaDescription ? nl2br(
|
'metaDescription' => $magnet->metaDescription ? nl2br(
|
||||||
htmlentities(
|
htmlentities(
|
||||||
substr($magnet->metaDescription, 0, MAGNET_META_DESCRIPTION_LENGTH_SHORT)
|
$magnet->metaDescription
|
||||||
)
|
)
|
||||||
) : false,
|
) : false,
|
||||||
|
'description' => $magnet->description ? nl2br(
|
||||||
|
htmlentities(
|
||||||
|
$magnet->description
|
||||||
|
)
|
||||||
|
) : false,
|
||||||
'approved' => (bool) $magnet->approved,
|
'approved' => (bool) $magnet->approved,
|
||||||
'public' => (bool) $magnet->public,
|
'public' => (bool) $magnet->public,
|
||||||
'sensitive' => (bool) $magnet->sensitive,
|
'sensitive' => (bool) $magnet->sensitive,
|
||||||
@ -283,6 +288,9 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
|
|||||||
<?php if ($response->magnet->metaDescription) { ?>
|
<?php if ($response->magnet->metaDescription) { ?>
|
||||||
<div class="margin-y-8"><?php echo $response->magnet->metaDescription ?></div>
|
<div class="margin-y-8"><?php echo $response->magnet->metaDescription ?></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
<?php if ($response->magnet->description) { ?>
|
||||||
|
<div class="margin-y-8"><?php echo $response->magnet->description ?></div>
|
||||||
|
<?php } ?>
|
||||||
<?php if ($response->magnet->keywords) { ?>
|
<?php if ($response->magnet->keywords) { ?>
|
||||||
<div class="margin-y-8">
|
<div class="margin-y-8">
|
||||||
<?php foreach ($response->magnet->keywords as $keyword) { ?>
|
<?php foreach ($response->magnet->keywords as $keyword) { ?>
|
||||||
|
@ -216,13 +216,17 @@ else
|
|||||||
<td class="padding-t-16"><?php echo MAGNET_DEFAULT_APPROVED ? _('yes') : _('no') ?></td>
|
<td class="padding-t-16"><?php echo MAGNET_DEFAULT_APPROVED ? _('yes') : _('no') ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo _('Title length') ?></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_META_TITLE_MIN_LENGTH ?>-<?php echo MAGNET_META_TITLE_MAX_LENGTH ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo _('Description length') ?></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_META_DESCRIPTION_MIN_LENGTH ?>-<?php echo MAGNET_META_DESCRIPTION_MAX_LENGTH ?></td>
|
||||||
</tr>
|
</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>
|
<tr>
|
||||||
<td class="padding-y-8 border-bottom-default text-right" colspan="2">
|
<td class="padding-y-8 border-bottom-default text-right" colspan="2">
|
||||||
<?php echo _('Comments') ?>
|
<?php echo _('Comments') ?>
|
||||||
@ -233,7 +237,7 @@ else
|
|||||||
<td class="padding-t-16"><?php echo COMMENT_DEFAULT_APPROVED ? _('yes') : _('no') ?></td>
|
<td class="padding-t-16"><?php echo COMMENT_DEFAULT_APPROVED ? _('yes') : _('no') ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo _('Length') ?></td>
|
<td><?php echo _('Length, chars') ?></td>
|
||||||
<td><?php echo COMMENT_MIN_LENGTH ?>-<?php echo COMMENT_MAX_LENGTH ?></td>
|
<td><?php echo COMMENT_MIN_LENGTH ?>-<?php echo COMMENT_MAX_LENGTH ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
Loading…
Reference in New Issue
Block a user