compile_check = true; $smarty->template_dir = "templates_v3"; $smarty->compile_dir = "templates_v3_c"; $mysqlConnector = new MySQLConnector(TidbIniLoader::DATABASE); $mysql = new MySQL($mysqlConnector); $tidbIniData = new TidbIniLoader(); $pars = array(); $importVariables = array("modus" => "nieuwnieuws", "index" => "0", "s" => "", "code" => "", "zoek" => "", "pagina" => 1, "width" => "", "height1" => "", "height2" => "", "lat" => "", "lng" => "", "zl" => "", "low" => "0", "high" => "10000000", "cat" => ""); foreach ($importVariables as $var => $default) { $pars[$var] = getIfExists($var, $_GET, $default); } $pars["ipadres"] = $_SERVER['REMOTE_ADDR']; $pars["lat"] = checkFloatRange_v2($pars["lat"], -90, 90, 52.2419); $pars["lng"] = checkFloatRange_v2($pars["lng"], -180, 180, 5.1419); $pars["zl"] = checkIntRange_v2($pars["zl"], 0, 20, 7); if ($pars["width"] != "") { $pars["width"] = checkIntRange_v2($pars["width"], 0, 800, 300); $pars["height1"] = checkIntRange_v2($pars["height1"], 0, 600, 200); $pars["height2"] = checkIntRange_v2($pars["height2"], 0, 600, 400); } $pars["searchQuery"] = $pars["zoek"]; $modus = $pars["modus"]; try { if (!$tidbIniData->setModus($modus)) { $modus = "nieuwnieuws"; $tidbIniData->setModus($modus); } if (getIfExists("REQUEST_URI", $_SERVER, "") == "/index.php?modus=$modus") { movedToNewHTTPAddress($tidbIniData->getParameter("mainLink", "")); } $pars["showMap"] = 1; $pars["showMessage"] = 1; $pars["showHeadlines"] = 1; $pars["showPostNews"] = 0; $pars["showComments"] = 0; $pars["showSummary"] = 0; $pars["feedPars"] = array(0,0,0,0,0,0,0,0); $pars["showCommentsVisiblity"] = 0; $pars["datum"] = strftime("%e %B %Y", time()); $pars["mapnewsVersion"] = 1028; $pars["add"] = array(1, 0); $tidbIniData->getAllParameters($pars); $pars["bericht"] = $pars["firstMessage"]; } catch (Exception $e) { die($e->getMessage()); } if ($pars["user"] != "") { $user = $pars["user"]; $smarty->security = true; $smarty->secure_dir = "user/$user/templates"; $smarty->template_dir = "user/$user/templates"; $smarty->compile_dir = "templates_v3_c/user/$user"; } if ($pars["index"] != 0) { $mysql->selectTable($tidbIniData->getParameter("databasePermalink", "")); $readRows = array("titel", "index", "permalink", "bericht", "parsed_message", "reacties", "url", "point_lat", "point_lng", "reads"); if ($pars["hasBron"] == 1) { $readRows[] = "bron"; } if ( ($modus == "nieuwnieuws") && ($pars["index"] < 1550000) ) { $mysql->selectTable("niuzarchief"); $readRows = array("titel", "index", "bericht", "bron", "url", "plaats", "point_lat", "point_lng", "reads"); } $row = $mysql->readRow($pars["index"], $readRows); if ( ($row !== false) && ($modus == "nieuwnieuws") && ($pars["index"] < 1550000) ) { $row["parsed_message"] = sprintf("

%s

%s", $row["titel"], $row["bericht"]); $row["permalink"] = "http://www.nuin.nl/n" . $pars["index"] . "-abcd.html"; } if ($row !== false) { $reads = intval($row["reads"] + 1); if (!isBot()) { $mysql->updateRow($pars["index"], array("reads" => $reads)); if ($tidbIniData->getParameter("database", "") != $tidbIniData->getParameter("databasePermalink", "")) { $mysql->selectTable($tidbIniData->getParameter("database", "")); $mysql->updateRow($pars["index"], array("reads" => $reads)); } } $pars["article"] = $row; $pars["metaDescription"] = str_replace("\n\r\n", "", trim(substr($row["bericht"], 0, 180))); $pars["title"] = $row["titel"] . " - nuin.nl"; $pars["showCommentsVisibility"] = 1; include_once($basedir . "classes/GetNews.php"); include_once($basedir . "classes/XMLFeedReader.php"); include_once($basedir . "classes/FeedParser.php"); include_once($basedir . "classes/Zipcode.php"); include_once($basedir . "functions/calculateDistance.php"); include_once($basedir . "classes/MarktplaatsTranslator.php"); include_once($basedir . "classes/IkDoeTranslator.php"); $getnews = new GetNews($mysqlConnector); $getnews->setModus($pars["modus"]); $pars["linkbar"] = $getnews->generateLinkBar($row); $pars["lat"] = $row["point_lat"]; $pars["lng"] = $row["point_lng"]; $pars["zl"] = 11; } else { $pars["article"]["parsed_message"] = "
Nuin.nl heeft het opgevraagde artikel helaas niet kunnen vinden.
"; } } $pars["device"] = ""; $pars["template"] = "index.tpl"; if ($pars["width"] != 0) { $pars["showHeadlines"] = 0; $pars["template"] = "embed.tpl"; } $possibleDevices = array("ipad" => 0, "iphone" => 1, "android" => 1, "mobile" => 1); // echo "USER AGENT: " . $_SERVER["HTTP_USER_AGENT"]; foreach ($possibleDevices as $device => $devModus) { if (strstr(strtolower($_SERVER["HTTP_USER_AGENT"]), $device) !== false) { $pars["device"] = $device; switch ($devModus) { case 0: $pars["template"] = "index.tpl"; break; case 1: $pars["template"] = "index-mobile.tpl"; $pars["showHeadlines"] = 0; $pars["width"] = 310; $pars["height1"] = 150; $pars["height2"] = 200; break; } break; } } if ($pars["modus"] == "plaatsbericht") { $tidbIniData->setModus($pars["code"]); $tidbIniData->getAllParameters($pars); $pars["showHeadlines"] = 0; $pars["showPostNews"] = 1; $pars["showMessage"] = 0; $pars["metaDescription"] = $pars["postNewsMetaDescription"]; $pars["subTitle"] = $pars["postNewsTitle"]; $pars["title"] = $pars["postNewsTitle"] . " - nuin.nl"; if ($pars["user"] == "nos") { movedToNewHTTPAddress("postnews.php?modus=" . $pars["code"]); } } if ($pars["modus"] == "mp") { $pars["showHeadlines"] = 0; $pars["rid"] = $pars["code"]; $pars["add"] = array(0, 1); if ($pars["rid"] == 0) { $pars["rid"] = 1; } if (strlen($pars["zoek"]) == 0) { $pars["feedPars"] = array($pars["rid"], $pars["cat"], "", "0", "100000000"); } else { $pars["feedPars"] = array(0, 0, $pars["zoek"], $pars["low"], $pars["high"]); } } if ($pars["showHeadlines"] == 1) { $params = array("modus" => $modus, "latlow" => 0, "latup" => 90, "lnglow" => 0, "lngup" => 90, "zoomlevel" => 15, "code" => $pars["code"], "sq" => $pars["zoek"], "searchquery" => $pars["zoek"], "page" => $pars["pagina"]); $hl = new GetHeadlines($mysqlConnector); $hl->setModus($modus); $hl->getData($params); $pars["hl_A"] = $hl->headlinesA; $pars["hl_B"] = $hl->headlinesB; $pars["hl_nop"] = $hl->numberOfPages; $pars["hl_ps"] = $hl->generatePageSelectorNJS($params["page"]); } $pars["start_lat"] = $pars["lat"]; $pars["start_lng"] = $pars["lng"]; $pars["start_zoomlevel"] = $pars["zl"]; $smarty->assign("pars", $pars); $smarty->display($pars["template"]); } ?>