X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=application%2Fmodels%2Fvideos_model.php;h=0d9fe7bf8585a4cd926819f633b41037c0700ff5;hb=e788f88e8475e9c87eef355c71abed3c329c4c0b;hp=c887b70c84eb1f8084322a6992c46bd6ce5c9643;hpb=b4a28ad3ca6e0166cbf209000277200c43d63802;p=living-lab-site.git diff --git a/application/models/videos_model.php b/application/models/videos_model.php index c887b70..0d9fe7b 100644 --- a/application/models/videos_model.php +++ b/application/models/videos_model.php @@ -16,8 +16,6 @@ class Videos_model extends CI_Model { $this->load->library('singleton_db'); $this->db = $this->singleton_db->connect(); } - - $this->load->helper('url'); } /** @@ -208,23 +206,23 @@ class Videos_model extends CI_Model { $count = 100; $str_search = trim($str_search); - - $this->load->helper('text'); $query = $this->db->query( "SELECT id, name, title, duration, user_id, views, thumbs_count, default_thumb FROM `videos` - WHERE title LIKE '%". $str_search . "%' + WHERE MATCH (title, description, tags) AGAINST (?) ORDER BY name - LIMIT ?, ?", // TODO summary order - array($offset, $count)); + LIMIT ?, ?", + array($str_search, $offset, $count)); if ($query->num_rows() > 0) $videos = $query->result_array(); else return NULL; + $this->load->helper('text'); + foreach ($videos as & $video) { // P2P-Tube Video URL