<?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);

	// Use these options to optionally disable some PHP configuration checks.
	// WARNING: these checks will disable checks regarding the security of the WebApp site configuration,
	// only change them if you know the consequences - improper use will lead to an insecure installation!
	define("CONFIG_CHECK_COOKIES_HTTP", FALSE);
	define("CONFIG_CHECK_COOKIES_SSL", FALSE);

	// 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", "white");
	
	// 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 addressbook to use an alphabetbar to only display items that start with the selected letter.
	define('ENABLE_GAB_ALPHABETBAR', false);

	// Set true to show public folders in hierarchy, false will disable public folders in hierarchy.
	define('ENABLE_PUBLIC_FOLDERS', true);

	// 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);

	// Remove delete permanently button from restore items dialog.
	define('DISABLE_DELETE_IN_RESTORE_ITEMS', false);

	// Booking method (true = direct booking, false = send meeting request)
	define('ENABLE_DIRECT_BOOKING', true);

	// If you want to make sure that the user name in the authentication is the same as
	// a certain variable in the certificate, then set this constant to the
	// the name of this certificate variable
	//define("CERT_VAR_TO_COMPARE_WITH", "SSL_CLIENT_S_DN_CN");


	/**************************************\
	* 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 the state files are allowed to survive (in seconds)
	// For filesystems on which relatime is used, this value should be larger then the relatime_interval
	// for kernels 2.6.30 and above relatime is enabled by default, and the relatime_interval is set to
	// 24 hours.
	define('STATE_FILE_MAX_LIFETIME', 28*60*60);

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

	// Define maximum nos of file can be attached at a time.
	define('FILE_UPLOAD_LIMIT', 50);

	// Define maximum nos of file can be in uploading queue at a time.
	define('FILE_QUEUE_LIMIT', 20);

	// When set to true, enable the multi-upload feature of the attachment dialog. This has the following caveats:
	// - In FireFox, you can only upload to HTTPS when the certificate is recognized as an official (not self-signed
	//   SSL certificate)
	// - In Linux, some versions of flash do not support this feature and can crash during upload. Updating to the latest
	//   version of flash should fix the issue.
	// - In Windows, upload fails if the internet status is 'offline' - open internet explorer to reconnect
	define("ENABLE_MULTI_UPLOAD", false);

	/**************************************\
	* 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'); // default fallback language
	}

	// List of languages that should be enabled in the logon
	// screen's language drop down.  Languages should be specified
	// using <languagecode>_<regioncode>[.UTF-8], and separated with
	// semicolon.  A list of available languages can be found in
	// the manual or by looking at the list of directories in
	// /usr/share/zarafa-webaccess/server/language .
	define("ENABLED_LANGUAGES", "ca;cs;da;de;en;es;fi;fr;he;hu;it;lt;nb;nl;pl;pt_BR;pt;ru;sl;sv;zh_CN;zh_TW");

	// Defines the default time zone, change e.g. to "Europe/London" when needed
	define('TIMEZONE', '');


	/**************************************\
	* 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(){}
	}
?>
