From ae128469b3f6d2cc2709cf12e721ce2645840678 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+github@gmail.com> Date: Tue, 25 Oct 2016 16:08:31 +0200 Subject: [PATCH] exclude not visible articles in search, fixes #38 --- models/SBArticle.php | 6 ++++-- plugin.manifest | 2 +- views/search/index.php | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/models/SBArticle.php b/models/SBArticle.php index e3b9557..09a2285 100644 --- a/models/SBArticle.php +++ b/models/SBArticle.php @@ -244,10 +244,12 @@ class SBArticle extends SimpleORMap { $query = "SELECT artikel_id FROM sb_artikel - WHERE titel LIKE CONCAT('%', :needle, '%') - OR beschreibung LIKE CONCAT('%', :needle, '%')"; + WHERE (visible = 1 OR user_id = :user_id) + AND (titel LIKE CONCAT('%', :needle, '%') + OR beschreibung LIKE CONCAT('%', :needle, '%'))"; $statement = DBManager::get()->prepare($query); $statement->bindValue(':needle', $needle); + $statement->bindValue(':user_id', $GLOBALS['user']->id); $statement->execute(); $article_ids = $statement->fetchAll(PDO::FETCH_COLUMN); diff --git a/plugin.manifest b/plugin.manifest index 34cad85..c9275cc 100644 --- a/plugin.manifest +++ b/plugin.manifest @@ -2,6 +2,6 @@ pluginname=SchwarzesBrettPlugin pluginclassname=SchwarzesBrettPlugin pluginclassname=SchwarzesBrettWidget origin=IBIT -version=3.11 +version=3.11.1 studipMinVersion=3.3 description=Globales Schwarzes Brett f�r Kleinanzeigen mit Kategorien (Gesuche/Angebote) diff --git a/views/search/index.php b/views/search/index.php index 6f076d9..fbfa482 100644 --- a/views/search/index.php +++ b/views/search/index.php @@ -14,7 +14,7 @@ </tbody> <? endif; ?> <? foreach ($categories as $id => $category): ?> - <tbody> + <tbody class="sb-articles"> <tr> <th colspan="5"> <a href="<?= $controller->url_for('category/' . $id) ?>"> -- GitLab