mirror of
https://github.com/YGGverse/YGGo.git
synced 2025-08-31 00:02:36 +00:00
show images total instead of pages in placeholder on image search page
This commit is contained in:
parent
5297e6e918
commit
f0b2eb1613
@ -94,6 +94,15 @@ class MySQL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Images
|
// Images
|
||||||
|
public function getTotalImages() {
|
||||||
|
|
||||||
|
$query = $this->_db->prepare('SELECT COUNT(*) AS `total` FROM `hostImage`');
|
||||||
|
|
||||||
|
$query->execute();
|
||||||
|
|
||||||
|
return $query->fetch()->total;
|
||||||
|
}
|
||||||
|
|
||||||
public function getTotalHostImages(int $hostId) {
|
public function getTotalHostImages(int $hostId) {
|
||||||
|
|
||||||
$query = $this->_db->prepare('SELECT COUNT(*) AS `total` FROM `hostImage` WHERE `hostId` = ?');
|
$query = $this->_db->prepare('SELECT COUNT(*) AS `total` FROM `hostImage` WHERE `hostId` = ?');
|
||||||
|
@ -15,19 +15,35 @@ $sphinx = new SphinxQL(SPHINX_HOST, SPHINX_PORT);
|
|||||||
// Connect database
|
// Connect database
|
||||||
$db = new MySQL(DB_HOST, DB_PORT, DB_NAME, DB_USERNAME, DB_PASSWORD);
|
$db = new MySQL(DB_HOST, DB_PORT, DB_NAME, DB_USERNAME, DB_PASSWORD);
|
||||||
|
|
||||||
|
// Filter request data
|
||||||
|
$t = !empty($_GET['t']) ? Filter::url($_GET['t']) : 'page';
|
||||||
|
$m = !empty($_GET['m']) ? Filter::url($_GET['m']) : 'default';
|
||||||
|
$q = !empty($_GET['q']) ? Filter::url($_GET['q']) : '';
|
||||||
|
$p = !empty($_GET['p']) ? (int) $_GET['p'] : 1;
|
||||||
|
|
||||||
// Define page basics
|
// Define page basics
|
||||||
|
switch ($t) {
|
||||||
|
|
||||||
|
case 'image':
|
||||||
|
|
||||||
|
$totalPages = $db->getTotalImages();
|
||||||
|
|
||||||
|
$placeholder = Filter::plural($totalPages, [sprintf(_('Over %s image or enter the new one...'), $totalPages),
|
||||||
|
sprintf(_('Over %s images or enter the new one...'), $totalPages),
|
||||||
|
sprintf(_('Over %s images or enter the new one...'), $totalPages),
|
||||||
|
]);
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
|
||||||
$totalPages = $db->getTotalPages();
|
$totalPages = $db->getTotalPages();
|
||||||
|
|
||||||
$placeholder = Filter::plural($totalPages, [sprintf(_('Over %s page or enter the new one...'), $totalPages),
|
$placeholder = Filter::plural($totalPages, [sprintf(_('Over %s page or enter the new one...'), $totalPages),
|
||||||
sprintf(_('Over %s pages or enter the new one...'), $totalPages),
|
sprintf(_('Over %s pages or enter the new one...'), $totalPages),
|
||||||
sprintf(_('Over %s pages or enter the new one...'), $totalPages),
|
sprintf(_('Over %s pages or enter the new one...'), $totalPages),
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// Filter request data
|
|
||||||
$t = !empty($_GET['t']) ? Filter::url($_GET['t']) : 'page';
|
|
||||||
$m = !empty($_GET['m']) ? Filter::url($_GET['m']) : 'default';
|
|
||||||
$q = !empty($_GET['q']) ? Filter::url($_GET['q']) : '';
|
|
||||||
$p = !empty($_GET['p']) ? (int) $_GET['p'] : 1;
|
|
||||||
|
|
||||||
// Crawl request
|
// Crawl request
|
||||||
if (filter_var($q, FILTER_VALIDATE_URL) && preg_match(CRAWL_URL_REGEXP, $q)) {
|
if (filter_var($q, FILTER_VALIDATE_URL) && preg_match(CRAWL_URL_REGEXP, $q)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user