public function __construct($userId, Zend_Controller_Request_Http $request = null, $body = null) { if (Syncope_Registry::isRegistered('loggerBackend')) { $this->_logger = Syncope_Registry::get('loggerBackend'); } $this->_userId = $userId; $this->_request = $request !== null ? $request : new Zend_Controller_Request_Http(); $this->_body = $body !== null ? $body : fopen('php://input', 'r'); $this->_deviceBackend = Syncope_Registry::get('deviceBackend'); }
/** * constructor */ private function __construct() { if (Syncope_Registry::isRegistered('loggerBackend')) { $this->_logger = Syncope_Registry::get('loggerBackend'); } }
/** * the constructor * * @param mixed $_requestBody * @param Syncope_Model_Device $_device * @param string $_policyKey */ public function __construct($_requestBody, Syncope_Model_IDevice $_device, $_policyKey) { $this->_policyKey = $_policyKey; $this->_device = $_device; $this->_deviceBackend = Syncope_Registry::get('deviceBackend'); $this->_folderBackend = Syncope_Registry::get('folderStateBackend'); $this->_syncStateBackend = Syncope_Registry::get('syncStateBackend'); $this->_contentStateBackend = Syncope_Registry::get('contentStateBackend'); if (Syncope_Registry::isRegistered('loggerBackend')) { $this->_logger = Syncope_Registry::get('loggerBackend'); } if ($this->_skipValidatePolicyKey !== true && $this->_policyKey === null) { #throw new Syncope_Exception_PolicyKeyMissing(); } if ($this->_skipValidatePolicyKey !== true && ($this->_policyKey === 0 || $this->_device->policykey != $this->_policyKey)) { #throw new Syncope_Exception_ProvisioningNeeded(); } // should we wipe the mobile phone? if ($this->_skipValidatePolicyKey !== true && !empty($this->_policyKey) && $this->_device->remotewipe >= Syncope_Command_Provision::REMOTEWIPE_REQUESTED) { throw new Syncope_Exception_ProvisioningNeeded(); } $this->_inputDom = $_requestBody; $this->_syncTimeStamp = new DateTime(null, new DateTimeZone('UTC')); if ($this->_logger instanceof Zend_Log) { $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " sync timestamp: " . $this->_syncTimeStamp->format('Y-m-d H:i:s')); } // Creates an instance of the DOMImplementation class $imp = new DOMImplementation(); // Creates a DOMDocumentType instance $dtd = $imp->createDocumentType('AirSync', "-//AIRSYNC//DTD AirSync//EN", "http://www.microsoft.com/"); // Creates a DOMDocument instance $this->_outputDom = $imp->createDocument($this->_defaultNameSpace, $this->_documentElement, $dtd); $this->_outputDom->formatOutput = false; $this->_outputDom->encoding = 'utf-8'; }