<?php
/* $Id: container.inc.php,v 1.25 2006/04/27 11:42:28 k-fish Exp $ */

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

//error_reporting(E_ERROR | E_WARNING | E_PARSE);
//error_reporting(E_ALL);
if (isset($myEnv["debug"])) {
   error_reporting($myEnv["debug"]);
   if (isset($myEnv["debug_to_screen"])) {
      ini_set("display_errors",1);
   }
} else {
   error_reporting(0);
   ini_set("display_errors",0);
}

define('UACTIVE', 9);
define('UDISABLED', 3);
define('UDELETED', 0);

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

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

// define path to JPGraph
if(PHP_VERSION >= 5)
    define('JPGRAPHPATH', INCLUDEPATH . 'jpgraph2/');
else
    define('JPGRAPHPATH', INCLUDEPATH . 'jpgraph1/');

// 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", ROOTURL."docs/html/".$_SESSION["MGW"]->spkz."/modules_".$myEnv["module"].".html");
elseif(file_exists(ROOTPATH."/docs/html/en/modules_".$myEnv["module"].".html"))
    $smarty->assign("helpurl", ROOTURL."docs/html/en/modules_".$myEnv["module"].".html");
elseif(file_exists(ROOTPATH."/docs/html/nohelp.".$_SESSION["MGW"]->spkz.".html"))
    $smarty->assign("helpurl", ROOTURL."docs/html/nohelp.".$_SESSION["MGW"]->spkz.".html");
else
    $smarty->assign("helpurl", ROOTURL."docs/html/nohelp.en.html");
*/
$smarty->assign("helpurl","http://www.moregroupware.com/wiki/");

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