<?php
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED ^ E_STRICT); 
$rootPath = is_file("../../../../library/document.php") ? "../../../../" : "../../";
define("CMS", "korCMS");
session_set_cookie_params( null, null, null, false, true);
session_start();
include($rootPath."config/odyssey.ini.php");

if(isset($_GET['secure_protocol'])){
	$protocol = ($_GET['secure_protocol'] == "1") ? "https" : "http";
}else{
	$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https" : "http";
}

$domainPath = $protocol."://".$_SERVER['HTTP_HOST']."/";

function getFPath(){
	$parts = explode("/", $_SERVER["PHP_SELF"]);
	array_shift($parts); // the first element will be empty to we get rid of it
	array_pop($parts); // get rid of script name
	$fPath =implode("/", $parts);
	if(substr($fPath, -1) != "/") $fPath.="/";
	$fPath = ($fPath == "/") ? null : $fPath;	
	return $fPath;	
}

function getBase(){
	global $domain_name;
	if($_SERVER['SERVER_NAME'] == "localhost") return str_replace("localhost", NULL, $domain_name)."/";	
	global $domainPath;
	$www = preg_match('/^www/', $_SERVER['SERVER_NAME']) ? 'www.' : null;
	$parts = explode("/", $_SERVER["PHP_SELF"]);
	array_shift($parts); // the first element will be empty to we get rid of it
	array_pop($parts); // get rid of script name
	$fPath =implode("/", $parts);
	$newPath = $domainPath.$fPath;
	if(substr($newPath, -1) != "/") $newPath.="/";
	return $newPath; // for sef urls, must be a base tag in html HEAD with this value
}

include($rootPath."library/db.php");
include($rootPath."library/system.php");
include($rootPath."library/messages.php");
include($rootPath."library/variables.php");
include($rootPath."library/language.php");
include($rootPath."library/authentication.php");
include($rootPath."library/dates.php");
include($rootPath."library/parameters.php");
include($rootPath."library/content.php");
include($rootPath."library/categories.php");
include($rootPath."library/sef.php");
$sef = new sef();
$db = new db();
$system = new system();
$messages = new messages();
$variables = new variables();
$language = new language();
$auth = new authentication(false);
$dates = new dates();
$parameters = new parameters();
$content = new content();
$categories = new categories();
$db->query("SET NAMES 'utf8mb4'");
$variables->getSafeVars(array_keys($_REQUEST));
global $langID;

function t($key, $langID=NULL, $context=NULL){
	global $language;
	return $language->getText($key, $langID, $context);
}

$activeCats = $categories->getActiveCategoriesIDs($dataSource);
echo implode(",", $activeCats);
?>