<?php
/* $Id: container.inc.php,v 1.20 2003/10/22 17:33:44 emailtotom Exp $ */

if (!defined('ROOTPATH')) die("This is a library.");

require_once(SMARTY_DIR . "Smarty.class.php");

// definition of moregroupware class, holding application vars
include(INCLUDEPATH . 'mgw.class.php');

// tar functions
require(INCLUDEPATH."/tar/tar.class.php");

// functions for translation
include(INCLUDEPATH . 'lang.inc.php');

// array for tracking file revision number used in sql error report screen
$Revisions_array = Array();

// important functions like connect to database
include(INCLUDEPATH . 'userfunc.inc.php');

// definition of moregroupware version and label
include(INCLUDEPATH . 'version.inc.php');

// Logging facilities
include(INCLUDEPATH . 'log.inc.php');

// Notify
include(INCLUDEPATH . 'notify.inc.php');

// Auto-Assigns for template engine and global definitions
include(INCLUDEPATH . 'appconfig.inc.php');

// check SSL status and redirect if needed
if($appconf['forcessl'] == 1 && !(isset($_SERVER['HTTPS']))){
    header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
    exit();
}

// include module specific functions if present (they are now in module/inc)
// must be named module_func.inc.php (i.e. calendar_func.inc.php)
if(file_exists(ROOTPATH . "/modules/" . $myEnv["module"]. "/inc/" . $myEnv["module"] . "_func.inc.php")) {
    include(ROOTPATH . "/modules/" . $myEnv["module"] . "/inc/" . $myEnv["module"] . "_func.inc.php");
}

// help system
if(file_exists(ROOTPATH."/docs/html/".$_SESSION["MGW"]->spkz."/modules_".$myEnv["module"].".html")) $smarty->assign("helpurl", "docs/html/".$_SESSION["MGW"]->spkz."/modules_".$myEnv["module"].".html");
elseif(file_exists(ROOTPATH."/docs/html/en/modules_".$myEnv["module"].".html")) $smarty->assign("helpurl", "docs/html/en/modules_".$myEnv["module"].".html");
elseif(file_exists(ROOTPATH."/docs/html/nohelp.".$_SESSION["MGW"]->spkz.".html")) $smarty->assign("helpurl","docs/html/nohelp.".$_SESSION["MGW"]->spkz.".html");
else $smarty->assign("helpurl","docs/html/nohelp.en.html");

// include module autoexecution of several things like translation, authentication, and more
include(INCLUDEPATH . 'module_exec.inc.php');
?>