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

	// Use this option to optionally disable some PHP configuration checks.
	// WARNING: this check will disable checks regarding the security of grommunio Web site configuration,
	// only change it if you know the consequences - improper use will lead to an insecure installation!
	define("CONFIG_CHECK_COOKIES_SSL", TRUE);

	// Depending on your setup, it might be advisable to change the lines below to one defined with your
	// default socket location.
	// Examples: define("DEFAULT_SERVER", "default:");
	define("DEFAULT_SERVER", "default:");

	// Defines the default domain of email addresses to login with
	// If this is set, you can login with only the user part of an email.
	// Examples: define("DEFAULT_DOMAIN", "example.com");
	//define("DEFAULT_DOMAIN", "");

	// Name of the cookie that is used for the session
	define("COOKIE_NAME", "GROMMUNIO_WEB");

	// Set to 'false' to disable secure session cookies and to allow log-in without HTTPS.
	define("SECURE_COOKIES", TRUE);

	// Enable shared rules
	define("ENABLE_SHARED_RULES", TRUE);

	// Allow users to enable the conversation (threaded) view for their inbox.
	// Set to 'false' to disable the feature server-wide regardless of user settings.
	define("ENABLE_CONVERSATION_VIEW", TRUE);

	// Allow dragging attachments out of an opened e-mail directly into a
	// cooperating web application's drop zone (the attachment bytes are embedded
	// in the drag operation). Set to FALSE to disable server-wide.
	// Overrides defaults.php
	//define("ENABLE_ATTACHMENT_DRAG_OUT", TRUE);

	// Maximum attachment size (in bytes) whose content is embedded in the drag
	// operation for ENABLE_ATTACHMENT_DRAG_OUT. Larger attachments are not
	// embedded; they can still be dragged to the operating system. Default 25 MiB.
	// Overrides defaults.php
	//define("ATTACHMENT_DRAG_OUT_MAX_SIZE", 26214400);

	// Enable resolving hidden address book entries (disabled by default).
	// Overrides defaults.php
	//define("ENABLE_RESOLVE_HIDDEN_USERS", true);

	// Whether to show domains without users/contacts in their global address book.
	define("GAB_SHOW_EMPTY_DOMAINS", true);

	// The timeout (in seconds) for the session. User will be logged out of grommunio Web
	// when he has not actively used grommunio Web for this time.
	// Set to 0 (or remove) for no timeout during browser session.
	define("CLIENT_TIMEOUT", 0);

	// Handler which is used for storing and retrieving data associated with a session.
	define("SESSION_SAVE_HANDLER", "files");
	ini_set("session.save_handler", SESSION_SAVE_HANDLER);

	// Path where the session associated data is saved.
	define("SESSION_SAVE_PATH", "/var/lib/grommunio-web/session");
	ini_set("session.save_path", SESSION_SAVE_PATH);

	// Defines the domains from which cross domain authentication requests
	// are allowed. E.g. if WebMeetings runs under a different domain than
	// the grommunio Web then add this domain here. Add http(s):// to the domains
	// and separate domains with spaces.
	// Set to empty string (default) to only allow authentication requests
	// from within the same domain.
	// Set to "*" to allow authentication requests from any domain. (not
	// recommended)
	define("CROSS_DOMAIN_AUTHENTICATION_ALLOWED_DOMAINS", "");

	// 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 temp path (absolute). Here uploaded attachments will be saved.
	// The web client doesn't work without this directory.
	define("TMP_PATH", "/tmp");

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

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

	// Define a list of plugins that cannot be disabled by users.
	// Plugins should be separated by a semicolon (;). A wildcard (*)
	// can be used to identify multiple plugins.
	// Overrides defaults.php
	define("ALWAYS_ENABLED_PLUGINS_LIST", "passwd;mdm");

	// Path used for client(domain) define data such as themes, icons ...
	define("APPDATA_DIR", "appdata");

	// Path used for full text index of every user
	define("SQLITE_INDEX_PATH", GROOT . DIRECTORY_SEPARATOR . "cache/sqlite-index");

	// General grommunio Web theme. This will be loaded by default for every user
	// (if the theme is installed as a plugin)
	// Users can override the 'logged-in' theme in the settings.
	//define("THEME", 'grommunioLighttheme');

	// The title that will be shown in the title bar of the browser
	define("WEBAPP_TITLE", "grommunio Web");

	// Enable widgets/today context.
	// Overrides defaults.php
	define("ENABLE_WIDGETS", false);

	// Additional color schemes for the calendars can be added by uncommenting and editing the following define.
	// The format is the same as the format of COLOR_SCHEMES which is defined in default.php
	// To change the default colors, COLOR_SCHEMES can also be defined here.
	// Note: Every color should have a unique name, because it is used to identify the color
	// define("ADDITIONAL_COLOR_SCHEMES", json_encode(array(
	// 		array(
	//			'name' => 'pink',
	//			'displayName' => _('Pink'),
	//			'base' => '#ff0099'
	//		)
	// )));

	// Additional categories can be added by uncommenting and editing the following define.
	// The format is the same as the format of DEFAULT_CATEGORIES which is defined in default.php
	// To change the default categories, DEFAULT_CATEGORIES can also be defined here.
	// Note: Every category should have a unique name, because it is used to identify the category
	// define("ADDITIONAL_CATEGORIES", json_encode(array(
	// 		array(
	//			'name' => _('Family'),
	//			'color' => '#000000',
	//			'quickAccess' => true,
	//			'sortIndex' => 10
	//		)
	// )));

	// Additional Prefix for the Contact name can be added by uncommenting and editing the following define.
	// define("CONTACT_PREFIX", json_encode(array(
	//  	array(_('Er.')),
	//  	array(_('Gr.'))
	// )));

	// Additional Suffix for the Contact name can be added by uncommenting and editing the following define.
	// define("CONTACT_SUFFIX", json_encode(array(
	//  	array(_('A')),
	//  	array(_('B'))
	// )));

	// The grommunio admin API status endpoint
	define('ADMIN_API_STATUS_ENDPOINT', 'http://[::1]:8080/api/v1/status');

	// Whether to show the Logout button in grommunio-web (true or false).
	// Show per default.
	define('SHOW_LOGOUT_BUTTON', true);

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

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

	/**********************************************************************************
	 *  Logging settings
	 *
	 *  Possible LOG_USER_LEVEL values are:
	 *  LOGLEVEL_OFF            - no logging
	 *  LOGLEVEL_FATAL          - log only critical errors
	 *  LOGLEVEL_ERROR          - logs events which might require corrective actions
	 *  LOGLEVEL_WARN           - might lead to an error or require corrective actions in the future
	 *  LOGLEVEL_INFO           - usually completed actions
	 *  LOGLEVEL_DEBUG          - debugging information, typically only meaningful to developers
	 *
	 *  The verbosity increases from top to bottom. More verbose levels include less verbose
	 *  ones, e.g. setting to LOGLEVEL_DEBUG will also output LOGLEVEL_FATAL, LOGLEVEL_ERROR,
	 *  LOGLEVEL_WARN and LOGLEVEL_INFO level entries.
	 *
	 **************************************************************************************/
	// Overrides defaults.php
	define("LOG_USER_LEVEL", LOGLEVEL_DEBUG);

	// Uncomment to log detailed full-text search diagnostics to the PHP error log.
	//define("DEBUG_FULLTEXT_SEARCH", true);

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

	// Location to the translations
	define("LANGUAGE_DIR", "server/language/");

	// Defines the default interface language. This can be overridden by the user.
	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_US.UTF-8'); // default fallback language
	}

	// Defines the default time zone
	if (!ini_get('date.timezone')) {
		date_default_timezone_set('Europe/Vienna');
	}

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

	// Do not log errors into stdout, since this generates faulty JSON responses.
	ini_set("display_errors", false);

	ini_set("log_errors", true);
	error_reporting(E_ERROR);

	if (file_exists('debug.php')){
		include_once('debug.php');
	}else{
		// define empty dump function in case we still use it somewhere
		function dump(){}
	}
?>
