Location: PHPKode > projects > GuanxiCRM Business Solution > include/appconfig.inc
<?PHP
/* $Id: appconfig.inc,v 1.40 2002/10/30 23:27:47 klp Exp $ */

// adding file revision into global array
if(function_exists("revisionInit")) revisionInit("\$Revision: 1.40 $", __FILE__);

//define folderseperator
if(PHP_OS=="WINNT" OR PHP_OS=="WIN32") {
	$folderseperator = "\\";
} else {
	$folderseperator = "/";
}

// The general templates path (we need it because smarty lacks of several template paths)
$appconf["gentemplates"] = "file:".$appconf["rootpath"]."/modules/general/templates/" . $appconf["theme"] . "/".trim($myEnv["output"]);
$appconf["genpath"]=$appconf["rootpath"]."/modules/general/templates/" . $appconf["theme"];

// Path to images (module specific and general)
$appconf["imgpathmaster"] = $appconf["rooturl"] ."/modules/general/templates/" . $appconf["theme"] . "/media";
$appconf["imgpath"] = $appconf["rooturl"] ."/modules/" . $myEnv["module"] . "/templates/" .$appconf["theme"] ."/media";
$appconf["imgpathgeneral"] = $appconf["rooturl"] . "/modules/general/templates/". $appconf["theme"] . "/media";

// URL to current script folder
$appconf["loginurl"] = $appconf["rooturl"] . "/index.php";

// path to templates and configs (smarty)
$smarty_tmpl  = $appconf["rootpath"] ."/modules/" . $myEnv["module"] . "/templates/" .$appconf["theme"] ."/" . $myEnv["output"];
$smarty_tmplc = $appconf["rootpath"] . "/templates_c";
// $smarty_cfg   = $appconf["rootpath"] . "/configs";

$smarty = new Smarty;
@$smarty->config_dir=$smarty_cfg;

if ($appconf["html_compressor"]) {
    // register the smarty html_compressor prefilter
    include(ROOTPATH . "/include/smarty/html_compressor.inc");

    if($appconf["html_compressor_debug"]) {
        $smarty->force_compile = true;
    }
    $smarty->register_prefilter("html_compressor");
}
//$smarty->show_info_header = true;
//$smarty->show_info_include = true;

// modifiers declarated in userfunc.inc
$smarty->register_modifier("mgw_datetime","smarty_mod_mgwdatetime");
$smarty->register_modifier("mgw_date","smarty_mod_mgwdate");
$smarty->register_modifier("mgw_time","smarty_mod_mgwtime");

session_name($appconf["session_name"]);
session_start();

// if MGW hasnĀ“t been registered, do so here.  Important for tracking the current url,
// should a url other than moregroupware/index.php be called first.
if(!isset($_SESSION["MGW"])) {
    $_SESSION["MGW"]= new mgw();
}

// Define Output Type (wml, html,...)
$rows_per_page=10;

// Ausgabetyp definieren
if (!isset($_SESSION['content_type']) || isset($ctype))  {
	if(isset($ctype))  {
		$content_type = $ctype;
	}
	else {
		$content_type = "html";
	}
	$_SESSION["content_type"] = $content_type;

}
if(IsSet($content_type) && $content_type=="wml")   {
	header('Content-Type: text/vnd.wap.wml');
	$myEnv["output"] = "wml";
	$smarty->template_dir = $appconf["rootpath"] ."/modules/" . $myEnv["module"] . "/templates/" . $appconf["theme"] . "/" . $myEnv["output"];
	$smarty->compile_dir = $appconf["rootpath"] . "/templates_wml_c";
	
	// redefine it because of wml (this must be changed in the future, because this is crap code)
	$app_gentemplates = "file:" . $appconf["rootpath"] ."/modules/general/templates/" .$appconf["theme"] ."/".trim($myEnv["output"]);
	
	$rows_per_page=5;
}
else  {
	$smarty->template_dir=$smarty_tmpl;
	$smarty->compile_dir=$smarty_tmplc;
}

//allways assign path to general template w/o theme (mainly for css)
$smarty->assign("genpath",$appconf["genpath"]);

// allways assign path to images (module and general)
$smarty->assign("imgpathmaster",$appconf["imgpathmaster"]);
$smarty->assign("imgpath",$appconf["imgpath"]);
$smarty->assign("imgpathgeneral",$appconf["imgpathgeneral"]);

// SID allways assign into templates
//$smarty->assign("PHPSESSID", session_id());
$smarty->assign("SESSION", SID);
$smarty->assign("SESSIONID", session_id());
$smarty->assign("SESSIONNAME", session_name());

// app_rooturl allways assign
$smarty->assign("rooturl", $appconf["rooturl"]);

// assign skin (css)
if(isset($_SESSION["MGW"]->settings["css_skin_theme"])) {
	$smarty->assign("skin", $_SESSION["MGW"]->settings["css_skin_theme"]);
}

// assign theme (as defined during setup)
$smarty->assign("theme", $appconf["theme"]);

// username und userfullname allways assign
if(isset($_SESSION["MGW"]->username))
	$smarty->assign("username", $_SESSION["MGW"]->username);
	
if(isset($_SESSION["MGW"]->fullusername))
	$smarty->assign("userfullname", $_SESSION["MGW"]->fullusername);

// Umgebungsvar $PHP_SELF allways assign
$smarty->assign("phpself", $_SERVER["PHP_SELF"]);

// General template path allways assign
$smarty->assign("gentemplates", $appconf["gentemplates"]);

// assign actual modulename / name of folder where module resides
$smarty->assign("actmodule", $myEnv["module"]);
if(isset($myEnv["submenu"]))
     $smarty->assign("actsubmenu", $myEnv["submenu"]);
else
     $smarty->assign("actsubmenu", 0);

// Version und Name allways assign
$smarty->assign("gwversion", "[Release $gwversion]");
$smarty->assign("gwtitle", $gwtitle);

if(isset($_SESSION["MGW"]->charset))
     $smarty->assign("charset", $_SESSION["MGW"]->charset);

$conn = connect_database();
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;

$lu_date = $conn->DBTimeStamp(time());
	
// assign all Main Menus
$sql = "SELECT * FROM mgw_modules WHERE active=1 ORDER BY displevel";
if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));

$store = $myEnv["module"];
$myEnv["module"] = "general";
if(!isset($_SESSION["MGW"]->spkz) || $_SESSION["MGW"]->spkz=="") $_SESSION["MGW"]->spkz= $appconf["def_language"];
$menulabels = readLanguageFile($_SESSION["MGW"]->spkz, "_navi");
while($row = $res->fetchRow()){
    $mname = $row["modulename"];
    if(isset($_SESSION["MGW"]->rights[$mname]) && $_SESSION["MGW"]->rights[$mname]->read){
	$_modulename = $row["modulename"];
	
	// assign "*" after modulename in menu if its not translated yet
	if(!isset($menulabels[$_modulename]) || $menulabels[$_modulename]=="")
	    $menustring = $_modulename. " *";
	else
	    $menustring = $menulabels[$_modulename];

	$row["label"] = $menustring;

	// WARNING !!! I (rabol) have made a small patch to smarty.class.php, line 239 to make this work
	// I have also written a mail to the authors of Smarty about the issue
	$smarty->append("mdata", $row);
    }
}
$myEnv["module"] = $store;
?>
Return current item: GuanxiCRM Business Solution