public static function getSearchVideos($query, $order = "none") { if ($order == "none") { $order = "timestamp desc"; } $query = trim(urldecode($query)); if ($query != '') { if ($query[0] == '#') { $query = trim($query, '#'); $all = Video::all(array('conditions' => array('tags LIKE ? AND visibility = ?', '%' . $query . '%', Config::getValue_('vid_visibility_public')), 'order' => $order)); } else { $all = Video::all(array('conditions' => array('(title LIKE ? OR description LIKE ? OR tags LIKE ? OR poster_id=?) AND visibility = ?', '%' . $query . '%', '%' . $query . '%', '%' . $query . '%', UserChannel::getIdByName($query), Config::getValue_('vid_visibility_public')), 'order' => $order)); } return $all; } }