} if (!empty($ids) && count($ids)) { $where = "id IN(" . join(",", $ids) . ")"; $db = NewADOConnection($GLOBALS['DSN2']); $limit = 25; $prev_fetch_mode = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $rows = $db->getAssoc("\r\n\t\t\t\tselect id,name,name_2,gr,localities,localities_2,score\r\n\t\t\t\tfrom placename_index \r\n\t\t\t\twhere {$where}\r\n\t\t\t\tlimit {$limit}"); $results = array(); foreach ($ids as $c => $id) { $row = $rows[$id]; $row['id'] = $id; $results[] = $row; } $smarty->assign_by_ref('results', $results); $smarty->assign("query_info", $sphinx->query_info); if ($sphinx->numberOfPages > 1) { $smarty->assign('pagesString', pagesString($pg, $sphinx->numberOfPages, $_SERVER['PHP_SELF'] . "?q=" . urlencode($q) . ($fuzzy ? "&f=on" : '') . "&page=")); $smarty->assign("offset", $offset); } $ADODB_FETCH_MODE = $prev_fetch_mode; } } else { $smarty->assign("query_info", "Search will only return 1000 results - please refine your search"); $smarty->assign('pagesString', pagesString($pg, 1, $_SERVER['PHP_SELF'] . "?q=" . urlencode($q) . "&page=")); } } $smarty->assign("q", $sphinx->qclean); $smarty->assign("fuzzy", $fuzzy); } $smarty->display($template, $cacheid);
if (!$smarty->is_cached($template, $cacheid)) { $sphinx->processQuery(); $ids = $sphinx->returnIds($pg, 'user'); if (count($ids)) { $where = "user_id IN(" . join(",", $ids) . ")"; $db = NewADOConnection($GLOBALS['DSN']); $limit = 25; $prev_fetch_mode = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $rows = $db->getAssoc("\r\n\t\t\tselect user.user_id,nickname,realname,images\r\n\t\t\tfrom user \r\n\t\t\tleft join user_stat using (user_id)\r\n\t\t\twhere {$where}\r\n\t\t\tlimit {$limit}"); $results = array(); foreach ($ids as $c => $id) { $row = $rows[$id]; $row['user_id'] = $id; $results[] = $row; } $smarty->assign_by_ref('results', $results); $smarty->assign("query_info", $sphinx->query_info); if ($sphinx->numberOfPages > 1) { $smarty->assign('pagesString', pagesString($pg, $sphinx->numberOfPages, $_SERVER['PHP_SELF'] . "?q=" . urlencode($q) . "&page=")); $smarty->assign("offset", ($pg - 1) * $sphinx->pageSize + 1); } $ADODB_FETCH_MODE = $prev_fetch_mode; } } $smarty->assign("q", $sphinx->qclean); } if (isset($_GET['popup'])) { $smarty->assign("popup", 1); } $smarty->display($template, $cacheid);
if ($USER->user_id && count($page)) { $prev_fetch_mode = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $list = $db->getAll("\r\n\t\tselect post_id,poster_id,poster_name,post_text,post_time\r\n\t\tfrom geobb_posts\r\n\t\twhere topic_id = {$topic_id}\r\n\t\torder by post_id\r\n\t\tlimit {$pagelimit},{$pgsize}"); $last = count($list) - 1; $postID = $list[$last]['post_id']; $db->Execute($sql = "insert into geobb_lastviewed set topic_id={$topic_id},user_id={$USER->user_id},last_post_id = {$postID} on duplicate key update last_post_id = if(last_post_id < {$postID},{$postID},last_post_id)"); } } else { $template = 'static_404.tpl'; } if (!$smarty->is_cached($template, $cacheid)) { if (count($page)) { $CONF['global_thumb_limit'] *= 2; $CONF['post_thumb_limit'] *= 2; $smarty->assign($page); if (empty($list)) { $prev_fetch_mode = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $list = $db->getAll("\r\n\t\t\tselect post_id,poster_id,poster_name,post_text,post_time\r\n\t\t\tfrom geobb_posts\r\n\t\t\twhere topic_id = {$topic_id}\r\n\t\t\torder by post_id\r\n\t\t\tlimit {$pagelimit},{$pgsize}"); } $smarty->assign_by_ref('list', $list); if ($page['posts_count'] > $pgsize) { $numberOfPages = ceil($page['posts_count'] / $pgsize); $smarty->assign('pagesString', pagesString($pg, $numberOfPages, "/gallery/{$page['url']}/")); } } } else { $smarty->assign('topic_id', $topic_id); } $smarty->display($template, $cacheid);
$title = "Location Specific Content"; $extra .= "&loc=1"; } else { $where = "content.`type` = 'info'"; } if (isset($CONF['forums']) && empty($CONF['forums']) || $USER->user_id == 0) { $where .= " AND content.`source` != 'themed'"; } if (!isset($resultCount)) { $resultCount = $db->getOne("SELECT COUNT(*) FROM content WHERE {$where}"); } if (!isset($numberOfPages)) { $numberOfPages = ceil($resultCount / $pageSize); } if ($numberOfPages > 1) { $smarty->assign('pagesString', pagesString($pg, $numberOfPages, $_SERVER['PHP_SELF'] . "?{$extra}&page=")); $smarty->assign("offset", ($pg - 1) * $pageSize + 1); } if ($pg > 1 && !isset($ids)) { $page = ($pg - 1) * $pageSize; $limit = "{$page},{$pageSize}"; } else { $limit = $pageSize; } $prev_fetch_mode = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $list = $db->getAll($sql = "\r\n\tselect content.content_id,content.user_id,url,title,extract,updated,created,realname,content.source,content.gridimage_id,\r\n\t\t(coalesce(views,0)+coalesce(topic_views,0)) as views,\r\n\t\t(coalesce(images,0)+coalesce(count(gridimage_post.seq_id),0)) as images,\r\n\t\tarticle_stat.words,coalesce(posts_count,0) as posts_count,coalesce(count(distinct gridimage_post.post_id),0) as posts_with_images\r\n\tfrom content \r\n\t\tleft join user using (user_id)\r\n\t\tleft join article_stat on (content.source = 'article' and foreign_id = article_id)\r\n\t\tleft join geobb_topics on (content.source IN ('gallery','themed') and foreign_id = topic_id) \r\n\t\tleft join gridimage_post using (topic_id)\r\n\twhere {$where}\r\n\tgroup by content_id\r\n\thaving posts_with_images >= posts_count/2\r\n\torder by content.`type` = 'info' desc, {$sql_order} \r\n\tlimit {$limit}"); if (!empty($_GET['debug'])) { print "<pre>{$sql}</pre>"; } if (false && !empty($_GET['q']) && !empty($CONF['sphinx_host'])) {