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();
/** * 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')); }