aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Database.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/Database.class.php')
-rwxr-xr-xinc/poche/Database.class.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index 9adb1644..6244df88 100755
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -407,14 +407,15 @@ class Database {
407 public function getLastId($column = '') { 407 public function getLastId($column = '') {
408 return $this->getHandle()->lastInsertId($column); 408 return $this->getHandle()->lastInsertId($column);
409 } 409 }
410 410
411 public function search($term){ 411 public function search($term, $user_id, $limit = '') {
412 $search = '%'.$term.'%'; 412 $search = '%'.$term.'%';
413 $query = $this->getHandle()->prepare("SELECT * FROM entries WHERE content LIKE ? OR title LIKE ? OR url LIKE ?"); //searches in content, title and URL 413 $sql_action = "SELECT * FROM entries WHERE user_id=? AND (content LIKE ? OR title LIKE ? OR url LIKE ?) "; //searches in content, title and URL
414 $query->execute(array($search,$search,$search)); 414 $sql_action .= $this->getEntriesOrder().' ' . $limit;
415 $entries = $query->fetchAll(); 415 $params_action = array($user_id, $search, $search, $search);
416 return $entries; 416 $query = $this->executeQuery($sql_action, $params_action);
417 } 417 return $query->fetchAll();
418 }
418 419
419 public function retrieveAllTags($user_id, $term = null) { 420 public function retrieveAllTags($user_id, $term = null) {
420 $sql = "SELECT DISTINCT tags.*, count(entries.id) AS entriescount FROM tags 421 $sql = "SELECT DISTINCT tags.*, count(entries.id) AS entriescount FROM tags