compile_check = true; $smarty->template_dir = "templates_v3"; $smarty->compile_dir = "templates_v3_c"; $show = array(); $get_modus = getIfExists('modus', $_GET, "nieuwnieuws"); if ($get_modus == "nieuws") { $get_modus = "nieuwnieuws"; } $show["leesverderop"] = 0; if ($get_modus == "nieuwnieuws") { $show["leesverderop"] = 1; } $get_level = checkIntRange(getIfExists('level', $_GET, 7), 0, 25, 7); $get_latlow = checkFloatRange(getIfExists('latlow', $_GET, 52), -90, 90, 52); $get_latup = checkFloatRange(getIfExists('latup', $_GET, 54), -90, 90, 54); $get_lnglow = checkFloatRange(getIfExists('lnglow', $_GET, 5), -180, 180, 5); $get_lngup = checkFloatRange(getIfExists('lngup', $_GET, 6), -180, 180, 6); $get_searchquery = getIfExists('sq', $_GET, ""); $get_sort = getIfExists('sort', $_GET, "index"); $tidbIniData = new TidbIniLoader(); try { if (!$tidbIniData->setModus($get_modus)) { throw new Exception("error 21"); } if ( ($table = $tidbIniData->getParameter("database", "")) == "") { throw new Exception ("error 22"); } $mysqlConnector = new MySQLConnector('rdzldb'); $mysql = new MySQL($mysqlConnector); $mysql->selectTable($table); $mysql->setCache(false); $variables = array($get_latlow, $get_lnglow, $get_latup, $get_lngup); $condition = " `point_lat` > %s1 AND `point_lng` > %s2 AND `point_lat` < %s3 AND `point_lng` < %s4 "; if (strlen($get_searchquery) > 0) { $variables[] = $get_searchquery; $condition .= " AND MATCH(`titel`,`bericht`, `parsed_message`, `auteur`) AGAINST(%s5)"; } $condition .= " ORDER BY `index` DESC LIMIT 100"; $readRows = array("index", "plaats", "titel", "bericht", "permalink", "datum", "tijd", "url"); if ($show["leesverderop"] == 1) { $readRows[] = "bron"; } $mysql->findRows($readRows, $variables, $condition, $data); $towns = array(); for ($i = 0; $i < count($data); $i++) { $data[$i]["message"] = substr($data[$i]["bericht"], 0, 200) . "...."; list ($y,$m,$d) = explode('-',$data[$i]["datum"]); list ($h,$mi,$s) = explode(':',$data[$i]["tijd"]); $data[$i]["pubdate"] = date("D, j M Y G:i:s O", mktime($h,$mi,$s,$m,$d,$y)); $townA = explode("/", trim(strtolower($data[$i]["plaats"]))); $town = $townA[0]; if (array_key_exists($town, $towns)) { $towns[$town] += 1; } else { $towns[$town] = 1; } } arsort($towns, SORT_NUMERIC); $keys = array_keys($towns); $town = ucwords(strtolower($keys[0])); $title = trim($tidbIniData->getParameter("clusterMarkersTitle", "Berichten")); if (!preg_match("/\s(uit|in|van|rondom|te)/", $title)) { $title = trim($title) . " uit"; } $title .= " $town e.o."; $show["feedDescription"] = $title; if (count($data) > 0) { $show["pubdate"] = $data[0]["pubdate"]; } else { $show["pubdate"] = ""; } } catch (Exception $e) { die($e->getMessage()); } $smarty->assign("data", $data); $smarty->assign("show", $show); $smarty->display('rss.tpl'); } ?>