<?php
//#################################################################################################
// Global settings
//#################################################################################################
// chillyCMS - Content Management System
// Copyright (C) 2008
// Stefanie Wiegand <hide@address.com> & Johannes Cox <hide@address.com>
//
// This program is licensed under the GPL 3.0 license. For more information see LICENSE.txt.
//#################################################################################################
defined('DOIT') or die('Restricted access');
//Global Constants
if (!defined('PATH')) {
define("PATH", substr(implode("/",explode(DIRECTORY_SEPARATOR,dirname(__FILE__))),0,-5));
}
if (!defined('CMSFOLDER')) {
$docroot = $_SERVER["DOCUMENT_ROOT"];
if (substr($docroot,-1)!="/") { $docroot.="/"; }
define("CMSFOLDER", substr(dirname(dirname(__FILE__)), strlen($docroot)));
}
if (!defined('URL')) {
$httphost = $_SERVER["HTTP_HOST"];
if (substr($httphost,0,7)!="http://") { $httphost = "http://".$httphost; }
if (substr($httphost,-1)!="/") { $httphost .= "/"; }
if (CMSFOLDER) {
define("URL", $httphost.CMSFOLDER);
} else {
define("URL", substr($httphost,0,-1));
}
}
require_once(PATH."/core/database.class.php");
require_once(PATH.'/core/helpers.include.php');
//if installation has not yet been processed then send to installation
if(defined('DB_HOST') && DB_HOST) {
$db = new Database();
$db->get_table("site_settings");
$result = $db->getdata_array();
$db->get_table("system_groups");
$groups = $db->getdata_array();
$db->close();
$settings = array();
if (!empty($result)) {
foreach ($result as $row) {
$settings[$row["key"]]=$row["value"];
}
}
$settings = array_map("escape_html",$settings);
if (!isset($settings["language"]) or $settings["language"]==null) { $settings["language"]="en"; }
$language=$settings["language"];
} else {
//only redirect to installation if we're not there, yet
$ds = explode(DIRECTORY_SEPARATOR,$_SERVER['PHP_SELF']);
if (array_pop($ds) != 'install.site.php') {
header('Location: '.URL.'/installation/install.site.php');
}
$settings['language'] = 'en';
$settings['template'] = 'blue';
$settings['offline_mode'] = '0';
}
?>