/** * Verifies Timezone, StateMachine and Backend configuration * * @access public * @return boolean * @trows FatalMisconfigurationException */ public static function CheckAdvancedConfig() { global $specialLogUsers, $additionalFolders; if (!is_array($specialLogUsers)) { throw new FatalMisconfigurationException("The WBXML log users is not an array."); } if (!defined('SINK_FORCERECHECK')) { define('SINK_FORCERECHECK', 300); } else { if (SINK_FORCERECHECK !== false && (!is_int(SINK_FORCERECHECK) || SINK_FORCERECHECK < 1)) { throw new FatalMisconfigurationException("The SINK_FORCERECHECK value must be 'false' or a number higher than 0."); } } if (!defined('SYNC_CONTACTS_MAXPICTURESIZE')) { define('SYNC_CONTACTS_MAXPICTURESIZE', 49152); } else { if (!is_int(SYNC_CONTACTS_MAXPICTURESIZE) || SYNC_CONTACTS_MAXPICTURESIZE < 1) { throw new FatalMisconfigurationException("The SYNC_CONTACTS_MAXPICTURESIZE value must be a number higher than 0."); } } if (!defined('USE_PARTIAL_FOLDERSYNC')) { define('USE_PARTIAL_FOLDERSYNC', false); } // the check on additional folders will not throw hard errors, as this is probably changed on live systems if (isset($additionalFolders) && !is_array($additionalFolders)) { ZLog::Write(LOGLEVEL_ERROR, "ZPush::CheckConfig() : The additional folders synchronization not available as array."); } else { self::$addSyncFolders = array(); // process configured data foreach ($additionalFolders as $af) { if (!is_array($af) || !isset($af['store']) || !isset($af['folderid']) || !isset($af['name']) || !isset($af['type'])) { ZLog::Write(LOGLEVEL_ERROR, "ZPush::CheckConfig() : the additional folder synchronization is not configured correctly. Missing parameters. Entry will be ignored."); continue; } if ($af['store'] == "" || $af['folderid'] == "" || $af['name'] == "" || $af['type'] == "") { ZLog::Write(LOGLEVEL_WARN, "ZPush::CheckConfig() : the additional folder synchronization is not configured correctly. Empty parameters. Entry will be ignored."); continue; } if (!in_array($af['type'], array(SYNC_FOLDER_TYPE_USER_CONTACT, SYNC_FOLDER_TYPE_USER_APPOINTMENT, SYNC_FOLDER_TYPE_USER_TASK, SYNC_FOLDER_TYPE_USER_MAIL))) { ZLog::Write(LOGLEVEL_ERROR, sprintf("ZPush::CheckConfig() : the type of the additional synchronization folder '%s is not permitted.", $af['name'])); continue; } $folder = new SyncFolder(); $folder->serverid = $af['folderid']; $folder->parentid = 0; // only top folders are supported $folder->displayname = $af['name']; $folder->type = $af['type']; // save store as custom property which is not streamed directly to the device $folder->NoBackendFolder = true; $folder->Store = $af['store']; self::$addSyncFolders[$folder->serverid] = $folder; } } ZLog::Write(LOGLEVEL_DEBUG, sprintf("Used timezone '%s'", date_default_timezone_get())); // get the statemachine, which will also try to load the backend.. This could throw errors self::GetStateMachine(); }
/** * Verifies Timezone, StateMachine and Backend configuration * * @access public * @return boolean * @trows FatalMisconfigurationException */ public static function CheckAdvancedConfig() { global $specialLogUsers, $additionalFolders; if (!is_array($specialLogUsers)) { throw new FatalMisconfigurationException("The WBXML log users is not an array."); } if (!defined('SYNC_CONTACTS_MAXPICTURESIZE')) { define('SYNC_CONTACTS_MAXPICTURESIZE', 49152); } else { if (!is_int(SYNC_CONTACTS_MAXPICTURESIZE) || SYNC_CONTACTS_MAXPICTURESIZE < 1) { throw new FatalMisconfigurationException("The SYNC_CONTACTS_MAXPICTURESIZE value must be a number higher than 0."); } } if (!defined('USE_PARTIAL_FOLDERSYNC')) { define('USE_PARTIAL_FOLDERSYNC', false); } if (!defined('PING_LOWER_BOUND_LIFETIME')) { define('PING_LOWER_BOUND_LIFETIME', false); } elseif (PING_LOWER_BOUND_LIFETIME !== false && (!is_int(PING_LOWER_BOUND_LIFETIME) || PING_LOWER_BOUND_LIFETIME < 1 || PING_LOWER_BOUND_LIFETIME > 3540)) { throw new FatalMisconfigurationException("The PING_LOWER_BOUND_LIFETIME value must be 'false' or a number between 1 and 3540 inclusively."); } if (!defined('PING_HIGHER_BOUND_LIFETIME')) { define('PING_HIGHER_BOUND_LIFETIME', false); } elseif (PING_HIGHER_BOUND_LIFETIME !== false && (!is_int(PING_HIGHER_BOUND_LIFETIME) || PING_HIGHER_BOUND_LIFETIME < 1 || PING_HIGHER_BOUND_LIFETIME > 3540)) { throw new FatalMisconfigurationException("The PING_HIGHER_BOUND_LIFETIME value must be 'false' or a number between 1 and 3540 inclusively."); } if (PING_HIGHER_BOUND_LIFETIME !== false && PING_LOWER_BOUND_LIFETIME !== false && PING_HIGHER_BOUND_LIFETIME < PING_LOWER_BOUND_LIFETIME) { throw new FatalMisconfigurationException("The PING_HIGHER_BOUND_LIFETIME value must be greater or equal to PING_LOWER_BOUND_LIFETIME."); } // Check KOE flags if (!defined('KOE_CAPABILITY_GAB')) { define('KOE_CAPABILITY_GAB', false); } if (!defined('KOE_CAPABILITY_RECEIVEFLAGS')) { define('KOE_CAPABILITY_RECEIVEFLAGS', false); } if (!defined('KOE_CAPABILITY_SENDFLAGS')) { define('KOE_CAPABILITY_SENDFLAGS', false); } if (!defined('KOE_CAPABILITY_OOF')) { define('KOE_CAPABILITY_OOF', false); } if (!defined('KOE_CAPABILITY_OOFTIMES')) { define('KOE_CAPABILITY_OOFTIMES', false); } if (!defined('KOE_CAPABILITY_NOTES')) { define('KOE_CAPABILITY_NOTES', false); } if (!defined('KOE_CAPABILITY_SHAREDFOLDER')) { define('KOE_CAPABILITY_SHAREDFOLDER', false); } if (!defined('KOE_GAB_FOLDERID')) { define('KOE_GAB_FOLDERID', ''); } if (!defined('KOE_GAB_STORE')) { define('KOE_GAB_STORE', ''); } if (!defined('KOE_GAB_NAME')) { define('KOE_GAB_NAME', false); } // the check on additional folders will not throw hard errors, as this is probably changed on live systems if (isset($additionalFolders) && !is_array($additionalFolders)) { ZLog::Write(LOGLEVEL_ERROR, "ZPush::CheckConfig() : The additional folders synchronization not available as array."); } else { self::$addSyncFolders = array(); // process configured data foreach ($additionalFolders as $af) { if (!is_array($af) || !isset($af['store']) || !isset($af['folderid']) || !isset($af['name']) || !isset($af['type'])) { ZLog::Write(LOGLEVEL_ERROR, "ZPush::CheckConfig() : the additional folder synchronization is not configured correctly. Missing parameters. Entry will be ignored."); continue; } if ($af['store'] == "" || $af['folderid'] == "" || $af['name'] == "" || $af['type'] == "") { ZLog::Write(LOGLEVEL_WARN, "ZPush::CheckConfig() : the additional folder synchronization is not configured correctly. Empty parameters. Entry will be ignored."); continue; } if (!in_array($af['type'], array(SYNC_FOLDER_TYPE_USER_NOTE, SYNC_FOLDER_TYPE_USER_CONTACT, SYNC_FOLDER_TYPE_USER_APPOINTMENT, SYNC_FOLDER_TYPE_USER_TASK, SYNC_FOLDER_TYPE_USER_MAIL))) { ZLog::Write(LOGLEVEL_ERROR, sprintf("ZPush::CheckConfig() : the type of the additional synchronization folder '%s is not permitted.", $af['name'])); continue; } $folder = new SyncFolder(); $folder->BackendId = $af['folderid']; $folder->serverid = ZPush::GetDeviceManager(true)->GetFolderIdForBackendId($folder->BackendId, true, DeviceManager::FLD_ORIGIN_CONFIG, $af['name']); $folder->parentid = 0; // only top folders are supported $folder->displayname = $af['name']; $folder->type = $af['type']; // save store as custom property which is not streamed directly to the device $folder->NoBackendFolder = true; $folder->Store = $af['store']; self::$addSyncFolders[$folder->BackendId] = $folder; } } ZLog::Write(LOGLEVEL_DEBUG, sprintf("Used timezone '%s'", date_default_timezone_get())); // get the statemachine, which will also try to load the backend.. This could throw errors self::GetStateMachine(); }