private function clearRequest() { OCA_mozilla_sync\OutputData::$outputBuffer = ''; OCA_mozilla_sync\Utils::$requestMethod = 'GET'; OCA_mozilla_sync\Utils::$lastStatus = OCA_mozilla_sync\Utils::STATUS_OK; }
private function deleteUser() { $this->clearRequest(); OCA_mozilla_sync\Utils::$requestMethod = 'DELETE'; $_SERVER['PHP_AUTH_USER'] = $this->userHash; $_SERVER['PHP_AUTH_PW'] = $this->password; $urlParser = new OCA_mozilla_sync\UrlParser('/1.0/' . $this->userHash); $userService = new OCA_mozilla_sync\UserService($urlParser); $userService->run(); }
<?php $url = OCA_mozilla_sync\Utils::getSyncUrl(); if ($url === false) { OCA_mozilla_sync\Utils::changeHttpStatus(404); exit; } $service = OCA_mozilla_sync\Utils::getServiceType(); $urlParser = new OCA_mozilla_sync\UrlParser($url); if (!$urlParser->isValid()) { OCA_mozilla_sync\Utils::changeHttpStatus(404); exit; } OCA_mozilla_sync\Utils::generateMozillaTimestamp(); if ($service === 'userapi') { $userService = new OCA_mozilla_sync\UserService($urlParser); $userService->run(); } else { if ($service === 'storageapi') { $storageService = new OCA_mozilla_sync\StorageService($urlParser); $storageService->run(); } }
<?php $tmpl = null; $email = OC_Preferences::getValue(OCP\User::getUser(), 'settings', 'email'); //no email address set if ($email === null) { $tmpl = new OCP\Template('mozilla_sync', 'noemail'); } else { $tmpl = new OCP\Template('mozilla_sync', 'settings'); $tmpl->assign('email', $email); $tmpl->assign('syncaddress', OCA_mozilla_sync\Utils::getServerAddress()); } return $tmpl->fetchPage();