* of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ require_once 'geograph/global.inc.php'; init_session(); $smarty = new GeographPage(); //regenerate? if (!$smarty->is_cached('explore.tpl')) { if (!$db) { $db = NewADOConnection($GLOBALS['DSN']); if (!$db) { die('Database connection failed'); } } $countylist = array(); $recordSet =& $db->Execute("SELECT reference_index,county_id,name FROM loc_counties WHERE n > 0"); while (!$recordSet->EOF) { $countylist[$CONF['references'][$recordSet->fields[0]]][$recordSet->fields[1]] = $recordSet->fields[2]; $recordSet->MoveNext(); } $recordSet->Close(); $smarty->assign_by_ref('countylist', $countylist); $topicsraw = $db->GetAssoc("select gp.topic_id,concat(topic_title,' [',count(*),']') as title,forum_name from gridimage_post gp\n\t\tinner join geobb_topics using (topic_id)\n\t\tinner join geobb_forums using (forum_id)\n\t\tgroup by gp.topic_id \n\t\thaving count(*) > 4\n\t\torder by geobb_topics.forum_id desc,topic_title");
limit 1'); if (count($page)) { if ($page['user_id'] == $USER->user_id) { $cacheid .= '|' . $USER->user_id; } if (!isset($_GET['dontcount']) && @strpos($_SERVER['HTTP_REFERER'], $page['url']) === FALSE) { $db->Execute("UPDATE LOW_PRIORITY article_stat SET views=views+1 WHERE article_id = " . $page['article_id']); } //when this page was modified $mtime = strtotime($page['update_time']); //can't use IF_MODIFIED_SINCE for logged in users as has no concept as uniqueness customCacheControl($mtime, $cacheid, $USER->user_id == 0); } 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($page['extract'])) { $smarty->assign('meta_description', "User contributed article about, " . $page['extract']); } if (!empty($page['gridsquare_id'])) { $square = new GridSquare(); $square->loadFromId($page['gridsquare_id']); $smarty->assign('grid_reference', $square->grid_reference); require_once 'geograph/conversions.class.php'; $conv = new Conversions(); list($lat, $long) = $conv->gridsquare_to_wgs84($square); $smarty->assign('lat', $lat);
$cacheid .= "." . md5(serialize($_GET)); } if (isset($_REQUEST['inner'])) { $template = 'content_iframe.tpl'; } else { $template = 'content.tpl'; } $db = NewADOConnection($GLOBALS['DSN']); $data = $db->getRow("show table status like 'content'"); //when this table was modified $mtime = strtotime($data['Update_time']); //can't use IF_MODIFIED_SINCE for logged in users as has no concept as uniqueness customCacheControl($mtime, $cacheid, $USER->user_id == 0); $smarty->assign('noSphinx', empty($CONF['sphinx_host'])); // FIXME -> global? if ($template == 'content_iframe.tpl' && !$smarty->is_cached($template, $cacheid)) { $extra = 'inner'; $pageSize = 25; #$pg = empty($_GET['page'])?1:intval($_GET['page']); $order = isset($_GET['order']) && ctype_lower($_GET['order']) ? $_GET['order'] : 'updated'; switch ($order) { case 'views': $sql_order = "views desc"; $title = "Most Viewed"; break; case 'created': $sql_order = "created desc"; $title = "Recently Created"; break; case 'title': $sql_order = "title";