<?php
/* 
	config.php
	
	The config file for the ajax webaccess.
	All possible web client settings can be set in this file. Some settings 
	(language) can also be set per user or logon.

*/
	// Comment next line to disable the config check (or set FALSE to log the config errors)
	define("CONFIG_CHECK", TRUE);

	// Default Zarafa server to connect to.
	#define("DEFAULT_SERVER","file:///var/run/zarafa");
	#define("DEFAULT_SERVER","file://\\\\.\\pipe\\zarafa");
	define("DEFAULT_SERVER","http://localhost:236/zarafa");

	// When using a single-signon system on your webserver, but Zarafa is on another server
	// you can use https to access the zarafa server, and authenticate using an SSL certificate.
	define("SSLCERT_FILE", NULL);
	define("SSLCERT_PASS", NULL);

	// set to 'true' to strip domain from login name found from Single Signon webservers
	define("LOGINNAME_STRIP_DOMAIN", false);

	// Name of the cookie that is used for the session, we can also use an external cookie
	if (isset($_GET["external"]) && preg_match("/[a-z][a-z0-9_]+/i",$_GET["external"])){
		define("COOKIE_NAME",$_GET["external"]);
	}else{
		define("COOKIE_NAME","ZARAFA_WEBACCESS");
	}
	
	// Defines the theme that should be used, is a subdirectory under the 'layout' directory.
	define("THEME_COLOR", "default");
	
	// Defines the base url and end with a slash.
	$base_url = dirname($_SERVER["PHP_SELF"]);
	if(substr($base_url,-1)!="/") $base_url .="/";
	define("BASE_URL", $base_url);
	
	// Defines the base path on the server, terminated by a slash
	define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . "/");

	// Defines the location to the MIME type definitions
	define("MIME_TYPES", BASE_PATH . "server/mimetypes.dat");

	// Defines the temp path (absolute). Here uploaded attachments will be saved.
	// The web client doesn't work without this directory.
	define("TMP_PATH", "/tmp");

	// Define the server paths
	set_include_path(BASE_PATH. PATH_SEPARATOR . 
	                 BASE_PATH."server/PEAR/" .  PATH_SEPARATOR . 
	                 "/include/php/" .  PATH_SEPARATOR . 
	                 "/var/www/include/php/");

	// Define the relative URL for dialogs, this string is appended with HTTP GET arguments
	define("DIALOG_URL", "index.php?load=dialog&");

	// Define the relative URL for Drag and drop file upload
	define("DND_FILEUPLOAD_URL", "index.php?load=upload_attachment&");

	// Define the path to the plugin directory (No slash at the end)
	define("PATH_PLUGIN_DIR", "plugins");

	// Enable the plugins
	define("ENABLE_PLUGINS", true);

	// Define list of disabled plugins separated by semicolon
	define("DISABLED_PLUGINS_LIST", '');

	// Disable PHP5>PHP4 compatibility, this could segfault apache with xml_parser_free
	ini_set('zend.ze1_compatibility_mode', false);

	// Set addressbook for GAB not to show any users unless searching for a specific user
	define("DISABLE_FULL_GAB", false);

	// Set the threshold for the addressnook to only show a full contactlist when the number of rows 
	// do not exeed this threshold. Otherwise the user can only use the search. Enter any number above
	// zero to set the threshold or -1 to always show the list or 0 to always hide the full list.
	define("DISABLE_FULL_CONTACTLIST_THRESHOLD", -1);
	
	// Set the number of previous days used in free busy module to show.
	define('FREEBUSY_DAYBEFORE_COUNT', 7);

	// Set the number of total days used in free busy module to show.
	define('FREEBUSY_NUMBEROFDAYS_COUNT', 90);
	
	/**************************************\
	* Memory usage and timeouts            *
	\**************************************/
	
	// This sets the maximum time in seconds that is allowed to run before it is terminated by the parser.	
	ini_set('max_execution_time', 300); // 5 minutes

	// BLOCK_SIZE (in bytes) is used for attachments by mapi_stream_read/mapi_stream_write
	define('BLOCK_SIZE', 1048576);

	// This value is used by the webclient to prevent a session timeout (in milliseconds)
	define('CLIENT_TIMEOUT', 5*60*1000);

	// Time that static files may exist in the client's cache (13 weeks)
	define('EXPIRES_TIME', 60*60*24*7*13);

	// Time that attachments are allowed to survive (in seconds)
	define('UPLOADED_ATTACHMENT_MAX_LIFETIME', 6*60*60);

	/**************************************\
	* FCKEditor                            *
	\**************************************/
	
	// Location to the HTML editor, if installed
	define('FCKEDITOR_PATH',dirname($_SERVER['SCRIPT_FILENAME'])."/client/widgets/fckeditor");
	define('FCKEDITOR_JS_PATH','client/widgets/fckeditor');

	// Spellchecker, change here to enable
	define('FCKEDITOR_SPELLCHECKER_ENABLED', false);
	define('FCKEDITOR_SPELLCHECKER_PATH', '/usr/local/bin/aspell');
	define('FCKEDITOR_SPELLCHECKER_LANGUAGE', FALSE); // set FALSE to use the language chosen by the user, but make sure that these languages are installed with aspell!

	/**************************************\
	* Languages                            *
	\**************************************/
	

	// Location to the translations
	define("LANGUAGE_DIR", "server/language/");
	
	// Defines the default interface language. This can be overriden by the user.
	// This language is also used on the login page
	if (isset($_ENV['LANG']) && $_ENV['LANG']!="C"){
		define('LANG', $_ENV["LANG"]); // This means the server environment language determines the web client language.
	}else{
		define('LANG', 'en_EN'); // default fallback language
	}

    // Defines the default time zone
    if (function_exists("date_default_timezone_set")){
        date_default_timezone_set("Europe/London");
    }


	/**************************************\
	* Debugging                            *
	\**************************************/

	ini_set("display_errors", false);
	error_reporting(0);
	
	if (file_exists("debug.php")){
		include("debug.php");
	}else{
		// define empty dump function in case we still use it somewhere
		function dump(){}
	}
?>
