'revision') AND (post_type <> 'nav_menu_item') "; if ( is_array($queryarray) && $count = count($queryarray) ) { $str_query = array(); for($j=0;$j<$count;$j++){ $str_query[] = "(post_title LIKE '%".$queryarray[$j]."%' OR post_content LIKE '%".$queryarray[$j]."%')"; } $where .= " AND ".implode(" $andor ", $str_query); } if ($userid) { if ($wp_uid){ $where .= " AND (post_author=".$wp_uid.")"; } else { $where .= " AND 0 "; } } $request = "SELECT * FROM " . $views_table ." WHERE ".$where; $request .= " ORDER BY post_date DESC"; $result = $xoopsDB->query($request,$limit,$offset); while($myrow = $xoopsDB->fetchArray($result)){ if ($myrow['post_type'] !=='revision' && $myrow['post_type'] !=='nav_menu_item') switch ($myrow['post_type']) { case 'page': $ret[$i]['link'] = $mid_url . '?page_id=' . $myrow['ID']; break; case 'post': case '': $ret[$i]['link'] = $mid_url . '?p=' . $myrow['ID']; break; default: $ret[$i]['link'] = $mid_url . '?'.$myrow['post_type'].'=' .$myrow['post_name']; } $ret[$i]['title'] = $blog_name . $myts->htmlSpecialChars($myrow['post_title']); $date_str = $myrow['post_date']; $yyyy = substr($date_str,0,4); $mm = substr($date_str,5,2); $dd = substr($date_str,8,2); $hh = substr($date_str,11,2); $nn = substr($date_str,14,2); $ss = substr($date_str,17,2); $ret[$i]['time'] = mktime( $hh,$nn,$ss,$mm,$dd,$yyyy); $ret[$i]['uid'] = wp_uid_to_xoops_uid($myrow['post_author'],$mydirname); $context = '' ; $text =$myrow['post_content']; // get context for module "search" $showcontext = empty( $_GET['showcontext'] ) ? 0 : 1 ; if( function_exists( 'search_make_context' ) && $showcontext ) { if( function_exists( 'easiestml' ) ) $text = easiestml( $text ) ; $full_context = strip_tags($text) ; $context = search_make_context( $full_context , $queryarray ) ; } $ret[$i]['context']=$context; $i++; } } return $ret; } } if( ! function_exists( 'get_blog_option' ) ) { function get_blog_option($option_table,$option_name){ $xoopsDB =& XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT option_value FROM $option_table WHERE option_name = '" . $option_name . "'"; $result = $xoopsDB->query($sql, 0, 0); if ($xoopsDB->getRowsNum($result) > 0){ $row = $xoopsDB->fetchArray($result); return $row['option_value']; } return 0; } } ?>