diff --git a/database/yggtracker.mwb b/database/yggtracker.mwb index fd1d697..d38ddfe 100644 Binary files a/database/yggtracker.mwb and b/database/yggtracker.mwb differ diff --git a/example/environment/sphinx.conf b/example/environment/sphinx.conf index 90c4d69..1f5f6bf 100644 --- a/example/environment/sphinx.conf +++ b/example/environment/sphinx.conf @@ -15,8 +15,8 @@ source magnet : yggtracker SELECT `magnet`.`timeAdded`, \ `magnet`.`timeUpdated`, \ `magnet`.`magnetId`, \ - `magnet`.`metaTitle`, \ - `magnet`.`metaDescription`, \ + `magnet`.`title`, \ + `magnet`.`preview`, \ `magnet`.`description`, \ `magnet`.`dn`, \ (SELECT GROUP_CONCAT(DISTINCT `infoHash`.`value`) \ diff --git a/src/config/app.php.example b/src/config/app.php.example index 0933cb8..abcf5f5 100644 --- a/src/config/app.php.example +++ b/src/config/app.php.example @@ -84,11 +84,11 @@ define('MAGNET_DEFAULT_SENSITIVE', false); define('MAGNET_EDITOR_LOCK_TIMEOUT', 60*60); -define('MAGNET_META_TITLE_MIN_LENGTH', 10); -define('MAGNET_META_TITLE_MAX_LENGTH', 140); +define('MAGNET_TITLE_MIN_LENGTH', 10); +define('MAGNET_TITLE_MAX_LENGTH', 140); -define('MAGNET_META_DESCRIPTION_MIN_LENGTH', 0); -define('MAGNET_META_DESCRIPTION_MAX_LENGTH', 255); +define('MAGNET_PREVIEW_MIN_LENGTH', 0); +define('MAGNET_PREVIEW_MAX_LENGTH', 255); define('MAGNET_DESCRIPTION_MIN_LENGTH', 0); define('MAGNET_DESCRIPTION_MAX_LENGTH', 10000); diff --git a/src/library/database.php b/src/library/database.php index 05bf6b9..fdd794c 100644 --- a/src/library/database.php +++ b/src/library/database.php @@ -694,24 +694,24 @@ class Database { 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++; - $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(); } - 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++; - $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(); } diff --git a/src/library/sphinx.php b/src/library/sphinx.php index 12be426..6cb15ae 100644 --- a/src/library/sphinx.php +++ b/src/library/sphinx.php @@ -77,7 +77,7 @@ class Sphinx { { 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); } } } diff --git a/src/public/download.php b/src/public/download.php index bc8663e..3cd7599 100644 --- a/src/public/download.php +++ b/src/public/download.php @@ -212,11 +212,11 @@ else // Return html $response->html->title = sprintf( _('%s - Download - %s'), - htmlentities($magnet->metaTitle), + htmlentities($magnet->title), WEBSITE_NAME ); - $response->html->h1 = htmlentities($magnet->metaTitle); + $response->html->h1 = htmlentities($magnet->title); // @TODO implement .bittorrent, separated v1/v2 magnet links $response->html->link->magnet = implode('&', array_unique($link->magnet)); diff --git a/src/public/edit.php b/src/public/edit.php index 4eb73dc..34adbd7 100644 --- a/src/public/edit.php +++ b/src/public/edit.php @@ -24,7 +24,7 @@ $response = (object) 'message' => false, 'form' => (object) [ - 'metaTitle' => (object) + 'title' => (object) [ 'value' => false, 'valid' => (object) @@ -33,7 +33,7 @@ $response = (object) 'message' => false, ] ], - 'metaDescription' => (object) + 'preview' => (object) [ 'value' => false, 'valid' => (object) @@ -221,27 +221,27 @@ else { } // 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->metaTitle->valid->message = false; + $response->form->title->valid->success = true; + $response->form->title->valid->message = false; } else { - $response->form->metaTitle->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->success = false; + $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->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->success = false; + $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 { - $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) @@ -466,8 +466,8 @@ else { // Is valid if ($response->success && - $response->form->metaTitle->valid->success && - $response->form->metaDescription->valid->success && + $response->form->title->valid->success && + $response->form->preview->valid->success && $response->form->description->valid->success && $response->form->tr->valid->success && $response->form->as->valid->success && @@ -495,10 +495,10 @@ else { } // 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 - $response->form->metaDescription->value = $magnet->metaDescription; + $response->form->preview->value = $magnet->preview; // Description $response->form->description->value = $magnet->description; @@ -637,30 +637,30 @@ else {