/** * (non-PHPdoc) * @see ActiveSync/ActiveSync_TestCase::setUp() */ protected function setUp() { parent::setUp(); Syncroton_Registry::setDatabase(Tinebase_Core::getDb()); Syncroton_Registry::setTransactionManager(Tinebase_TransactionManager::getInstance()); Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new Syncroton_Backend_Device(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new Syncroton_Backend_Folder(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new Syncroton_Backend_SyncState(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::CONTENTSTATEBACKEND, new Syncroton_Backend_Content(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::POLICYBACKEND, new Syncroton_Backend_Policy(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set('loggerBackend', Tinebase_Core::getLogger()); Syncroton_Registry::setContactsDataClass('Addressbook_Frontend_ActiveSync'); Syncroton_Registry::setCalendarDataClass('Calendar_Frontend_ActiveSync'); Syncroton_Registry::setEmailDataClass('Felamimail_Frontend_ActiveSync'); Syncroton_Registry::setTasksDataClass('Tasks_Frontend_ActiveSync'); $this->_device = Syncroton_Registry::getDeviceBackend()->create(ActiveSync_TestCase::getTestDevice()); }
/** * (non-PHPdoc) * @see Syncroton/Syncroton_TestCase::setUp() */ public function setUp() { Syncroton_Registry::setDatabase(ConnectionManager::getDataSource('test')); Syncroton_Registry::getTransactionManager()->startTransaction(Syncroton_Registry::getDatabase()); Syncroton_Registry::set('loggerBackend', new Syncroton_Log('lil_active_sync')); try { $device = Syncroton_Registry::getDeviceBackend()->getUserDevice('1234', 'iphone-abcd'); Syncroton_Registry::getDeviceBackend()->delete($device); } catch (Syncroton_Exception_NotFound $e) { // do nothing => it's ok } require_once dirname(dirname(__FILE__)) . DS . 'Backend' . DS . 'DeviceTest.php'; $this->_device = Syncroton_Registry::getDeviceBackend()->create(DeviceTest::getTestDevice()); Syncroton_Registry::setContactsDataClass('Syncroton_Data_Contacts'); Syncroton_Registry::setCalendarDataClass('Syncroton_Data_Calendar'); Syncroton_Registry::setEmailDataClass('Syncroton_Data_Email'); Syncroton_Registry::setTasksDataClass('Syncroton_Data_Tasks'); Syncroton_Registry::setGALDataClass('Syncroton_Data_Contacts'); // speed up tests Syncroton_Registry::set(Syncroton_Registry::PING_TIMEOUT, 1); Syncroton_Registry::set(Syncroton_Registry::QUIET_TIME, 1); }
if (!defined('WEBROOT_DIR')) { define('WEBROOT_DIR', basename(dirname(__FILE__))); } if (!defined('WWW_ROOT')) { define('WWW_ROOT', dirname(__FILE__) . DS); } if (!defined('CAKE_CORE_INCLUDE_PATH')) { if (function_exists('ini_set')) { ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path')); } if (!(include 'Cake' . DS . 'bootstrap.php')) { $failed = true; } } else { if (!(include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) { $failed = true; } } if (!empty($failed)) { trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR); } App::uses('ConnectionManager', 'Model'); Syncroton_Registry::setDatabase(ConnectionManager::getDataSource('default')); Syncroton_Registry::set('loggerBackend', new Syncroton_Log()); Syncroton_Registry::setContactsDataClass('Syncroton_Data_Contacts'); Syncroton_Registry::setCalendarDataClass('Syncroton_Data_Calendar'); Syncroton_Registry::setTasksDataClass('Syncroton_Data_Tasks'); Syncroton_Registry::setEmailDataClass('Syncroton_Data_Email'); Syncroton_Registry::setNotesDataClass('Syncroton_Data_Notes'); $server = new Syncroton_Server($_SERVER['PHP_AUTH_USER']); $server->handle();
public static function initSyncrotonRegistry() { Syncroton_Registry::setDatabase(Tinebase_Core::getDb()); Syncroton_Registry::setTransactionManager(Tinebase_TransactionManager::getInstance()); Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new Syncroton_Backend_Device(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new Syncroton_Backend_Folder(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new Syncroton_Backend_SyncState(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::CONTENTSTATEBACKEND, new Syncroton_Backend_Content(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::POLICYBACKEND, new Syncroton_Backend_Policy(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::LOGGERBACKEND, Tinebase_Core::getLogger()); Syncroton_Registry::set(Syncroton_Registry::SESSION_VALIDATOR, function () { return !Tinebase_Core::inMaintenanceMode(); }); }
/** * addnote method * * @return void */ public function addnote() { App::uses('ConnectionManager', 'Model'); Syncroton_Registry::setDatabase(ConnectionManager::getDataSource('default')); Syncroton_Registry::setNotesDataClass('Syncroton_Data_Notes'); Syncroton_Registry::set('loggerBackend', new Syncroton_Log('lil_active_sync2')); $device = Syncroton_Registry::getDeviceBackend()->getUserDevice('miha', 'ApplC33JKLWDDTWD'); Syncroton_Data_Factory::factory(Syncroton_Data_Factory::CLASS_NOTES, $device, new DateTime(null, new DateTimeZone('utc')))->createEntry('', new Syncroton_Model_Note(array('subject' => 'Second note'))); return new CakeResponse(array('body' => 'success')); }
* * Example server file * * @package doc * @license http://www.tine20.org/licenses/lgpl.html LGPL Version 3 * @copyright Copyright (c) 2012-2012 Metaways Infosystems GmbH (http://www.metaways.de) * @author Lars Kneschke <*****@*****.**> */ if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="Syncroton"'); header('HTTP/1.0 401 Unauthorized'); echo 'Please authenticate!'; exit; } // http://localhost/Microsoft-Server-ActiveSync $paths = array(realpath(dirname(__FILE__) . '/../forbidden/zend1/library/'), realpath(dirname(__FILE__)), realpath(dirname(__FILE__) . '/lib'), get_include_path()); set_include_path(implode(PATH_SEPARATOR, $paths)); require_once 'Zend\\Loader\\Autoloader.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->setFallbackAutoloader(true); $db = Zend_Db::factory('PDO_MYSQL', array('host' => '127.0.0.1', 'username' => 'root', 'password' => '', 'dbname' => 'syncro')); Syncroton_Registry::setDatabase($db); $writer = new Zend_Log_Writer_Stream(dirname(__FILE__) . '\\syncroton.log'); $writer->addFilter(new Zend_Log_Filter_Priority(Zend_Log::DEBUG)); Syncroton_Registry::set('loggerBackend', new Zend_Log($writer)); Syncroton_Registry::setContactsDataClass('Syncroton_Data_Contacts'); Syncroton_Registry::setCalendarDataClass('Syncroton_Data_Calendar'); Syncroton_Registry::setTasksDataClass('Syncroton_Data_Tasks'); #Syncroton_Registry::setEmailDataClass('Syncroton_Data_Email'); $server = new Syncroton_Server($_SERVER['PHP_AUTH_USER']); $server->handle();