<?php
/** 
 * Zarafa Z-Merge
 * 
 * Copyright (C) 2005 - 2008  Zarafa B.V.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3, 
 * and under the terms of the GNU General Public License, version 3,
 * as published by the Free Software Foundation.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU (Affero) General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License 
 * and the GNU General Public License along with this program.  
 * If not, see <http://www.gnu.org/licenses/>.
 *  
 * Created on 10.11.2007 by Sebastian Kummer & Manfred Kutas
 *
 * @package Z-Merge
 */
 

/**
 *  installation directory -  must terminate with /
 */
define('ZMERGE_DIR', '/usr/lib/z-merge/');

/**
 *  Z-Merge PID file
 */
define('ZMERGE_PID', '/var/run/z-merge.pid');

 
/**
 * logger options
 *
 * Valid loglevels: FATAL, ERROR, WARN, INFO, DEBUG
 * Logsize is in MegaBytes
 */

define('ZMERGE_LOGFILE' , '/var/log/z-merge/z-merge.log');
define('ZMERGE_ERRORLOGFILE' , '/var/log/z-merge/z-merge-errors.log');
define('ZMERGE_LOGLEVEL' , INFO);
define('ZMERGE_LOGSIZE' , 5);

/**
 * Log conflict reason level
 *
 * if that parameter is set to a loglevel, the logfile will show
 * the reason for a synchronization conflict case (offline sync)
 *
 * ATTENTION: Be aware that the logfile will contain personal information
 *            from the synchronized objects that may be violating personal
 *            rights of your users! 
 *
 * Valid values: FATAL, ERROR, WARN, INFO, DEBUG, false (to disable)
 */
define('ZMERGE_LOGCONFLICTREASONLEVEL' , false);


/**
 * start livesync with one or more servers down?
 */
define('ZMERGE_FORCELIVESYNC', false); 


/**
 * reconnect offline servers after X minutes - default: 1
 */
define('ZMERGE_RECONNECT', 1); 


/**
 * send Z-Merge errors to this email address --> to disable set to false
 */
define('ZMERGE_SENDERRORS', false); 

/** 
 * Max number of transmitted objects per SOAP request 
 */
define("MAX_OBJECTS", 50);
 
/**
 * Z-Merge database configuration
 * 
 * ZMERGE_DB_TRYCOUNT		if connection is lost, try to establish for several times before exiting
 * 							default: 5
 * 
 * ZMERGE_DB_TYPE			type of the database used. 
 *							tested and supported is 'mysql'
 *
 * ZMERGE_DB_HOSTNAME		hostname used connecting to the database
 *
 * ZMERGE_DB_USERNAME		username used connecting to the database 
 * 							(when database is not existent, needs to be an administrative user)
 *
 * ZMERGE_DB_PASSWORD		password used connecting to the database
 *
 * ZMERGE_DB_DATABASE		database name to save data
 *
 * ZMERGE_DB_DEBUGLEVEL		advanced Pear::MDB options - consult MDB manual for details
 *
 * ZMERGE_DB_PORTABILITY	advanced Pear::MDB options - consult MDB manual for details
 * 
 */
define('ZMERGE_DB_TRYCOUNT', 5); 

define('ZMERGE_DB_TYPE', 'mysql'); 
define('ZMERGE_DB_HOSTNAME', 'localhost'); 
define('ZMERGE_DB_USERNAME', 'z-merge-agent'); 
define('ZMERGE_DB_PASSWORD', '%mysql_passwd%'); 
define('ZMERGE_DB_DATABASE', 'z-merge-agent'); 

define('ZMERGE_DB_DEBUGLEVEL', 2); 
define('ZMERGE_DB_PORTABILITY', MDB2_PORTABILITY_ALL); 
 


/**
 * Z-Merge server merge options
 * 
 * SERVER_NAME 			Servername. Must be the same as configured in the Z-Merge DB (lastmodes table)
 * 
 * SERVER_TYPE			Servertype: SugarCRM or ZARAFA
 * 
 * SERVER_URL 			URL of the Z-Merge SOAP connector on the server
 * 
 * SERVER_PROXY			Proxyinformation necessary to connect to the server (optional)
 * 
 * SERVER_EVENTDRIVEN	if the SOAP interface itself waits for change events
 * 
 * SERVER_NOEVENTQUERY	if the SOAP interface don't support events, 
 * 						time before quering the server again for changes (default >5)
 * 
 * SERVER_TIMEOUT		seconds before timing out trying to reach the server
 * 
 * SERVER_WAITTIMEOUT	time in seconds to wait for an answer from the server
 * 						should be greater than configured on the server
 * 
 * SERVER_DUPLICATOR	indicates if this server is the best to produce duplicates.
 *						in general that applies to a server who has real groups
 *
 */
$servers = array(
	// Zarafa Server 	
	array(
		SERVER_NAME			=> "Zarafa",
		SERVER_TYPE			=> ZARAFA,
		SERVER_URL 			=> "http://127.0.0.1/syn3/z-merge-zarafa", 
		SERVER_USERNAME		=> "administrator",
		SERVER_PASSWORD		=> "syn3", 
		SERVER_PROXY		=> array('host' => '', 'port' => '', 'username' => '', 'password' => ''), 	
		SERVER_EVENTDRIVEN	=> true,
		SERVER_NOEVENTQUERY	=> 5,
		SERVER_TIMEOUT 		=> 10,
		SERVER_WAITTIMEOUT 	=> 120,
		SERVER_DUPLICATOR	=> false,
	),
	
	// SugarCRM Server
	array(
		SERVER_NAME			=> "Sugar",
		SERVER_TYPE			=> SUGARCRM,
		SERVER_URL 			=> "http://127.0.0.1/syn3/sugarcrm", 
		SERVER_USERNAME		=> "administrator",
		SERVER_PASSWORD		=> "syn3", 
		SERVER_PROXY		=> array('host' => '', 'port' => '', 'username' => '', 'password' => ''), 	
		SERVER_EVENTDRIVEN	=> true,
		SERVER_NOEVENTQUERY	=> 5,
		SERVER_TIMEOUT 		=> 10,
		SERVER_WAITTIMEOUT 	=> 120,
		SERVER_DUPLICATOR	=> true,
	),
	
);


 
/**
 * Z-Merge conflict resolution options
 * 
 * GENERAL_PROCEDURE 			What to do, if a duplicate is found (when offline synching).
 * 								options: DUPLICATE
 * 
 * DUPLICATION_INDICATION		Updates a field in each ObjectType with a indication.
 * 								default: true
 * 
 * DUPLICATION_INDICATE_FIELD	For each type of object, one or more fields can me 
 * 								modified to indicate the conflict when duplicating.
 * 
 * 								Possible values can be found in 'mergeObjects/SyncDefs.php'.
 * 								Each object you want to be modified, needs ONE field definition
 * 								You can define the string that should be prepended or appended to the variable.
 * 								Only normal variables can be used (STREAMER_VAR).
 * 								Only strings can be modified.
 * 
 * 								ATTENTION: 	THE CHOOSEN VARIABLE MUST BE MAPPED IN EACH
 * 								----------	SERVER-TRANSFORMATION-OBJECT CONNECTED IN THE SYSTEM
 * 
 */
$conflict_resolution = array(
	GENERAL_PROCEDURE 			=> DUPLICATE,
	DUPLICATION_INDICATION		=> true,				
	DUPLICATION_INDICATE_FIELD	=> array(
									SYNC_POOMTASKS_SUBJECT 		=> array('CONFLICT: ', SYNC_POOMTASKS_SUBJECT),
									SYNC_POOMCONTACTS_LASTNAME	=> array(SYNC_POOMCONTACTS_LASTNAME, ' (CONFLICT)'),
									SYNC_POOMCONTACTS_FILEAS	=> array('CONFLICT: ', SYNC_POOMCONTACTS_FILEAS),
									SYNC_POOMCAL_SUBJECT		=> array('CONFLICT: ', SYNC_POOMCAL_SUBJECT),
									SYNC_POOMNOTE_SUBJECT		=> array('CONFLICT: ', SYNC_POOMNOTE_SUBJECT),
								   )
);


?>
