makeTboxData4Save($split_search[$i])).'%';
$match_keyword = '% '.str_replace('*', '%', $myts->makeTboxData4Save($split_search[$i])).' %';
$sql = "SELECT pid ".
"FROM ".$xoopsDB->prefix("xcgal_pictures")." ".
"WHERE CONCAT(' ', keywords, ' ') LIKE '$match_keyword' ";
if ($query_all) $sql .=
"OR filename LIKE '$match_word' ".
"OR title LIKE '$match_word' ".
"OR caption LIKE '$match_word' ".
"OR user1 LIKE '$match_word' ".
"OR user2 LIKE '$match_word' ".
"OR user3 LIKE '$match_word' ".
"OR user4 LIKE '$match_word' ";
$result = $xoopsDB->query($sql);
if ($xoopsDB->getRowsNum($result)) {
$set ='';
while($row=$xoopsDB->fetchArray($result)){
$set .= $row['pid'].',';
} // while
if (empty($pic_set)) {
if ($current_match_type == 'not') {
$pic_set .= ' pid not in ('.substr($set, 0, -1).') ';
} else {
$pic_set .= ' pid in ('.substr($set, 0, -1).') ';
}
} else {
if ($current_match_type == 'not') {
$pic_set .= ' and pid not in ('.substr($set, 0, -1).') ';
} else {
$pic_set .= ' '.$current_match_type.' pid in ('.substr($set, 0, -1).') ';
}
}
}
$xoopsDB->freeRecordSet($result);
$current_match_type = 'and';
}
}
if (!empty($pic_set)) {
$sql = "SELECT count(*) ".
"FROM ".$xoopsDB->prefix("xcgal_pictures")." ".
"WHERE ($pic_set) ".
"AND approved = 'YES' ".
"$ALBUM_SET";
$result = $xoopsDB->query($sql);
$nbEnr = $xoopsDB->fetchArray($result);
$count = $nbEnr['count(*)'];
$xoopsDB->freeRecordSet($result);
if($select_columns != '*') $select_columns .= ', title, caption';
$sql = "SELECT $select_columns ".
"FROM ".$xoopsDB->prefix("xcgal_pictures")." ".
"WHERE ($pic_set) ".
"AND approved = 'YES' ".
"$ALBUM_SET $limit";
$result = $xoopsDB->query($sql);
$rowset = db_fetch_rowset($result);
$xoopsDB->freeRecordSet($result);
if ($set_caption) foreach ($rowset as $key => $row){
$caption = $rowset[$key]['title'] ? "".$myts->makeTboxData4Show($rowset[$key]['title'])."" : '';
if ($xoopsModuleConfig['caption_in_thumbview']){
$caption .= $rowset[$key]['caption'] ? "".$myts->makeTareaData4Show($rowset[$key]['caption'],0)."" : '';
}
$rowset[$key]['caption_text'] = $caption;
}
} else {
$count = 0;
$rowset = array();
}
} else {
$count = 0;
$rowset = array();
}
?>