function search_videos($items, $conn) { global $set, $db, $apx, $user; require_once BASEDIR . getmodulepath('videos') . 'functions.php'; //Suchstring generieren $tagmatches = videos_match_tags($items); foreach ($items as $item) { $tagmatch = array_shift($tagmatches); $search[] = " ( " . iif($tagmatch, " id IN (" . implode(',', $tagmatch) . ") OR ") . " title LIKE '%" . addslashes_like($item) . "%' OR text LIKE '%" . addslashes_like($item) . "%' ) "; } $searchstring = implode($conn, $search); //Videos durchsuchen $data = $db->fetch("SELECT id,title FROM " . PRE . "_videos WHERE ( searchable='1' AND '" . time() . "' BETWEEN starttime AND endtime " . section_filter() . " AND ( " . $searchstring . " ) ) ORDER BY addtime DESC"); if (count($data)) { foreach ($data as $res) { ++$i; $result[$i]['TITLE'] = $res['title']; $result[$i]['LINK'] = mklink('videos.php?id=' . $res['id'], 'videos,id' . $res['id'] . urlformat($res['title']) . '.html'); } } return $result; }
} $tabledata[$i]['RATING'] = $rate->display(); $tabledata[$i]['RATING_VOTES'] = $rate->count(); $tabledata[$i]['DISPLAY_RATING'] = 1; } } } $apx->tmpl->assign('VIDEO', $tabledata); $apx->tmpl->parse('search_result'); } else { $where = ''; //Suchbegriffe if ($_REQUEST['item']) { $items = array(); $it = explode(' ', preg_replace('#[ ]{2,}#', ' ', trim($_REQUEST['item']))); $tagmatches = videos_match_tags($it); foreach ($it as $item) { if (trim($item)) { $string = preg_replace('#[\\s_-]+#', '[^0-9a-zA-Z]*', $item); if (preg_match('#^[0-9a-zA-Z]+$#', $string)) { $items[] = " LIKE '%" . addslashes_like($string) . "%' "; } else { $items[] = " REGEXP '" . addslashes($string) . "' "; } } } if ($_REQUEST['conn'] == 'or') { $conn = ' OR '; } else { $conn = ' AND '; }