. * */ class OC_OCS_Cloud { public static function getSystemWebApps() { OC_Util::checkLoggedIn(); $apps = OC_App::getEnabledApps(); $values = array(); foreach($apps as $app) { $info = OC_App::getAppInfo($app); if(isset($info['standalone'])) { $newValue = array('name'=>$info['name'],'url'=>OC_Helper::linkToAbsolute($app,''),'icon'=>''); $values[] = $newValue; } } return new OC_OCS_Result($values); } public static function getUserQuota($parameters) { $user = OC_User::getUser(); if(OC_User::isAdminUser($user) or ($user==$parameters['user'])) { if(OC_User::userExists($parameters['user'])) { // calculate the disc space $userDir = '/'.$parameters['user'].'/files'; \OC\Files\Filesystem::init($parameters['user'], $userDir); $rootInfo = \OC\Files\Filesystem::getFileInfo(''); $sharedInfo = \OC\Files\Filesystem::getFileInfo('/Shared'); $used = $rootInfo['size'] - $sharedInfo['size']; $free = \OC\Files\Filesystem::free_space(); $total = $free + $used; if($total===0) $total = 1; // prevent division by zero $relative = round(($used/$total)*10000)/100; $xml = array(); $xml['quota'] = $total; $xml['free'] = $free; $xml['used'] = $used; $xml['relative'] = $relative; return new OC_OCS_Result($xml); } else { return new OC_OCS_Result(null, 300); } } else { return new OC_OCS_Result(null, 300); } } public static function getUserPublickey($parameters) { if(OC_User::userExists($parameters['user'])) { // calculate the disc space // TODO return new OC_OCS_Result(array()); } else { return new OC_OCS_Result(null, 300); } } public static function getUserPrivatekey($parameters) { $user = OC_User::getUser(); if(OC_User::isAdminUser($user) or ($user==$parameters['user'])) { if(OC_User::userExists($user)) { // calculate the disc space $txt = 'this is the private key of '.$parameters['user']; echo($txt); } else { return new OC_OCS_Result(null, 300, 'User does not exist'); } } else { return new OC_OCS_Result('null', 300, 'You donĀ“t have permission to access this ressource.'); } } }