diff --git a/app/Controllers/Backend.php b/app/Controllers/Backend.php index f09e107..5bf19d7 100644 --- a/app/Controllers/Backend.php +++ b/app/Controllers/Backend.php @@ -22,6 +22,7 @@ class Backend { private $conf; private $title = 'Settings'; private $passwordRequired = false; + private $search = null; /** * Handles the index action for the controller. @@ -107,6 +108,15 @@ class Backend { * @return void */ private function showInfos() { + if (!empty($this->params->search)) { + $search = htmlspecialchars(trim($this->params->search)); + if (!empty($search)) { + $this->search = $search; + } else { + $this->search = null; + } + } + if (!empty($this->params->start)) { $this->start = $this->params->start; } @@ -116,7 +126,7 @@ class Backend { } $conx = new DataBase(); - $genList = $conx->getList($this->start, $this->end); + $genList = $conx->getList($this->start, $this->end, $this->search); $total = $conx->getTotal(); $inError = $conx->getInError(); $inQueue = $this->getInQueue(); @@ -124,6 +134,7 @@ class Backend { $max = $this->max; $next = $start + $max; $previous = $start - ($max); + $search = $this->search; if (count($genList) < $this->max) { $next = $start; diff --git a/app/DataBase/DataBase.php b/app/DataBase/DataBase.php index 7df577e..a125420 100644 --- a/app/DataBase/DataBase.php +++ b/app/DataBase/DataBase.php @@ -264,10 +264,14 @@ class DataBase { * * @return array An array of objects representing the records in the "soshot" table. */ - public function getList(int $start, int $end) { - $stmt = $this->db->prepare("SELECT * FROM soshot ORDER BY created DESC limit :start, :end;"); + public function getList(int $start, int $end, string $search = null) { + if ($search != null) { + $stmt = $this->db->prepare("SELECT * FROM soshot WHERE url like '%$search%' ORDER BY created DESC limit :start, :end;"); + } else { + $stmt = $this->db->prepare("SELECT * FROM soshot ORDER BY created DESC limit :start, :end;"); + } $stmt->execute(array(':start' => $start, ':end' => $end)); $result = $stmt->fetchAll(PDO::FETCH_OBJ); return $result; } -} +} \ No newline at end of file diff --git a/tpl/infos.php b/tpl/infos.php index 0d49cc2..1d258d2 100644 --- a/tpl/infos.php +++ b/tpl/infos.php @@ -3,7 +3,6 @@ use App\Utils\ConvertStatus; use App\Utils\Domains; -//require_once 'nav.php'; ?>
@@ -15,6 +14,11 @@ use App\Utils\Domains;
  • Error :
  • +
    + + +
    + @@ -50,8 +54,8 @@ use App\Utils\Domains;