. * */ // Do not load FS ... $RUNTIME_NOSETUPFS = true; require_once('../../lib/base.php'); OC_Util::checkAppEnabled('remoteStorage'); require_once('Sabre/autoload.php'); require_once('lib_remoteStorage.php'); require_once('oauth_ro_auth.php'); ini_set('default_charset', 'UTF-8'); #ini_set('error_reporting', ''); @ob_clean(); $path = substr($_SERVER["REQUEST_URI"], strlen($_SERVER["SCRIPT_NAME"])); $pathParts = explode('/', $path); if(count($pathParts) == 2 && $pathParts[0] == '') { //TODO: input checking. these explodes may fail to produces the desired arrays: $subPathParts = explode('?', $pathParts[1]); $ownCloudUser = $subPathParts[0]; foreach($_GET as $k => $v) { if($k=='user_address'){ $userAddress=$v; } else if($k=='redirect_uri'){ $appUrlParts=explode('/', $v); $appUrl = $appUrlParts[2];//bit dodgy i guess } else if($k=='scope'){ $categories=$v; } } $currUser = OC_User::getUser(); if($currUser == $ownCloudUser) { if(isset($_POST['allow'])) { //TODO: check if this can be faked by editing the cookie in firebug! $token=OC_remoteStorage::createCategories($appUrl, $categories); header('Location: '.$_GET['redirect_uri'].'#access_token='.$token.'&token_type=bearer'); } else { ?> ownCloud

remoteStorage

requests read & write access to your '.$categories[0].''; if(count($categories)==2) { echo ' and '.$categories[1].''; } else if(count($categories)>2) { for($i=1; $i'.$categories[$i].''; } echo ', and '.$categories[$i].''; } } ?>.