aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ocs.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ocs.php')
-rw-r--r--lib/ocs.php66
1 files changed, 33 insertions, 33 deletions
diff --git a/lib/ocs.php b/lib/ocs.php
index ad01e5c42fa..3a9be4cf09d 100644
--- a/lib/ocs.php
+++ b/lib/ocs.php
@@ -102,79 +102,79 @@ class OC_OCS {
// eventhandler
// CONFIG
// apiconfig - GET - CONFIG
- if(($method=='get') and ($ex[$paracount-3] == 'v1.php') and ($ex[$paracount-2] == 'config')){
+ if(($method=='get') and ($ex[$paracount-3] == 'v1.php') and ($ex[$paracount-2] == 'config')) {
OC_OCS::apiconfig($format);
// PERSON
// personcheck - POST - PERSON/CHECK
- }elseif(($method=='post') and ($ex[$paracount-4] == 'v1.php') and ($ex[$paracount-3]=='person') and ($ex[$paracount-2] == 'check')){
+ }elseif(($method=='post') and ($ex[$paracount-4] == 'v1.php') and ($ex[$paracount-3]=='person') and ($ex[$paracount-2] == 'check')) {
$login = self::readData($method, 'login', 'text');
$passwd = self::readData($method, 'password', 'text');
OC_OCS::personcheck($format,$login,$passwd);
// ACTIVITY
// activityget - GET ACTIVITY page,pagesize als urlparameter
- }elseif(($method=='get') and ($ex[$paracount-3] == 'v1.php') and ($ex[$paracount-2] == 'activity')){
+ }elseif(($method=='get') and ($ex[$paracount-3] == 'v1.php') and ($ex[$paracount-2] == 'activity')) {
$page = self::readData($method, 'page', 'int', 0);
$pagesize = self::readData($method, 'pagesize','int', 10);
if($pagesize<1 or $pagesize>100) $pagesize=10;
OC_OCS::activityget($format,$page,$pagesize);
// activityput - POST ACTIVITY
- }elseif(($method=='post') and ($ex[$paracount-3] == 'v1.php') and ($ex[$paracount-2] == 'activity')){
+ }elseif(($method=='post') and ($ex[$paracount-3] == 'v1.php') and ($ex[$paracount-2] == 'activity')) {
$message = self::readData($method, 'message', 'text');
OC_OCS::activityput($format,$message);
// PRIVATEDATA
// get - GET DATA
- }elseif(($method=='get') and ($ex[$paracount-4] == 'v1.php') and ($ex[$paracount-2] == 'getattribute')){
+ }elseif(($method=='get') and ($ex[$paracount-4] == 'v1.php') and ($ex[$paracount-2] == 'getattribute')) {
OC_OCS::privateDataGet($format);
- }elseif(($method=='get') and ($ex[$paracount-5] == 'v1.php') and ($ex[$paracount-3] == 'getattribute')){
+ }elseif(($method=='get') and ($ex[$paracount-5] == 'v1.php') and ($ex[$paracount-3] == 'getattribute')) {
$app=$ex[$paracount-2];
OC_OCS::privateDataGet($format, $app);
- }elseif(($method=='get') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-4] == 'getattribute')){
+ }elseif(($method=='get') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-4] == 'getattribute')) {
$key=$ex[$paracount-2];
$app=$ex[$paracount-3];
OC_OCS::privateDataGet($format, $app,$key);
// set - POST DATA
- }elseif(($method=='post') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-4] == 'setattribute')){
+ }elseif(($method=='post') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-4] == 'setattribute')) {
$key=$ex[$paracount-2];
$app=$ex[$paracount-3];
$value = self::readData($method, 'value', 'text');
OC_OCS::privatedataset($format, $app, $key, $value);
// delete - POST DATA
- }elseif(($method=='post') and ($ex[$paracount-6] =='v1.php') and ($ex[$paracount-4] == 'deleteattribute')){
+ }elseif(($method=='post') and ($ex[$paracount-6] =='v1.php') and ($ex[$paracount-4] == 'deleteattribute')) {
$key=$ex[$paracount-2];
$app=$ex[$paracount-3];
OC_OCS::privatedatadelete($format, $app, $key);
// CLOUD
// systemWebApps
- }elseif(($method=='get') and ($ex[$paracount-5] == 'v1.php') and ($ex[$paracount-4]=='cloud') and ($ex[$paracount-3] == 'system') and ($ex[$paracount-2] == 'webapps')){
+ }elseif(($method=='get') and ($ex[$paracount-5] == 'v1.php') and ($ex[$paracount-4]=='cloud') and ($ex[$paracount-3] == 'system') and ($ex[$paracount-2] == 'webapps')) {
OC_OCS::systemwebapps($format);
// quotaget
- }elseif(($method=='get') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-5]=='cloud') and ($ex[$paracount-4] == 'user') and ($ex[$paracount-2] == 'quota')){
+ }elseif(($method=='get') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-5]=='cloud') and ($ex[$paracount-4] == 'user') and ($ex[$paracount-2] == 'quota')) {
$user=$ex[$paracount-3];
OC_OCS::quotaget($format,$user);
// quotaset
- }elseif(($method=='post') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-5]=='cloud') and ($ex[$paracount-4] == 'user') and ($ex[$paracount-2] == 'quota')){
+ }elseif(($method=='post') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-5]=='cloud') and ($ex[$paracount-4] == 'user') and ($ex[$paracount-2] == 'quota')) {
$user=$ex[$paracount-3];
$quota = self::readData('post', 'quota', 'int');
OC_OCS::quotaset($format,$user,$quota);
// keygetpublic
- }elseif(($method=='get') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-5]=='cloud') and ($ex[$paracount-4] == 'user') and ($ex[$paracount-2] == 'publickey')){
+ }elseif(($method=='get') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-5]=='cloud') and ($ex[$paracount-4] == 'user') and ($ex[$paracount-2] == 'publickey')) {
$user=$ex[$paracount-3];
OC_OCS::publicKeyGet($format,$user);
// keygetprivate
- }elseif(($method=='get') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-5]=='cloud') and ($ex[$paracount-4] == 'user') and ($ex[$paracount-2] == 'privatekey')){
+ }elseif(($method=='get') and ($ex[$paracount-6] == 'v1.php') and ($ex[$paracount-5]=='cloud') and ($ex[$paracount-4] == 'user') and ($ex[$paracount-2] == 'privatekey')) {
$user=$ex[$paracount-3];
OC_OCS::privateKeyGet($format,$user);
@@ -229,7 +229,7 @@ class OC_OCS {
if(isset($_SERVER['PHP_AUTH_PW'])) $authpw=$_SERVER['PHP_AUTH_PW']; else $authpw='';
if(empty($authuser)) {
- if($forceuser){
+ if($forceuser) {
header('WWW-Authenticate: Basic realm="your valid user account or api key"');
header('HTTP/1.0 401 Unauthorized');
exit;
@@ -237,8 +237,8 @@ class OC_OCS {
$identifieduser='';
}
}else{
- if(!OC_User::login($authuser,$authpw)){
- if($forceuser){
+ if(!OC_User::login($authuser,$authpw)) {
+ if($forceuser) {
header('WWW-Authenticate: Basic realm="your valid user account or api key"');
header('HTTP/1.0 401 Unauthorized');
exit;
@@ -310,7 +310,7 @@ class OC_OCS {
xmlwriter_write_attribute($writer,'details',$tagattribute);
}
foreach($entry as $key=>$value) {
- if(is_array($value)){
+ if(is_array($value)) {
foreach($value as $k=>$v) {
xmlwriter_write_element($writer,$k,$v);
}
@@ -330,7 +330,7 @@ class OC_OCS {
xmlwriter_write_attribute($writer,'details',$tagattribute);
}
foreach($entry as $key=>$value) {
- if(is_array($value)){
+ if(is_array($value)) {
xmlwriter_start_element($writer,$entrykey);
foreach($value as $k=>$v) {
xmlwriter_write_element($writer,$k,$v);
@@ -363,7 +363,7 @@ class OC_OCS {
if (is_numeric($key)) {
$key = $node;
}
- if (is_array($value)){
+ if (is_array($value)) {
xmlwriter_start_element($writer,$key);
OC_OCS::toxml($writer,$value,$node);
xmlwriter_end_element($writer);
@@ -402,8 +402,8 @@ class OC_OCS {
* @return string xml/json
*/
private static function personCheck($format,$login,$passwd) {
- if($login<>''){
- if(OC_User::login($login,$passwd)){
+ if($login<>'') {
+ if(OC_User::login($login,$passwd)) {
$xml['person']['personid']=$login;
echo(OC_OCS::generatexml($format,'ok',100,'',$xml,'person','check',2));
}else{
@@ -480,7 +480,7 @@ class OC_OCS {
*/
private static function privateDataSet($format, $app, $key, $value) {
$user=OC_OCS::checkpassword();
- if(OC_OCS::setData($user,$app,$key,$value)){
+ if(OC_OCS::setData($user,$app,$key,$value)) {
echo(OC_OCS::generatexml($format,'ok',100,''));
}
}
@@ -493,11 +493,11 @@ class OC_OCS {
* @return string xml/json
*/
private static function privateDataDelete($format, $app, $key) {
- if($key=="" or $app==""){
+ if($key=="" or $app=="") {
return; //key and app are NOT optional here
}
$user=OC_OCS::checkpassword();
- if(OC_OCS::deleteData($user,$app,$key)){
+ if(OC_OCS::deleteData($user,$app,$key)) {
echo(OC_OCS::generatexml($format,'ok',100,''));
}
}
@@ -511,21 +511,21 @@ class OC_OCS {
* @return array
*/
public static function getData($user,$app="",$key="") {
- if($app){
+ if($app) {
$apps=array($app);
}else{
$apps=OC_Preferences::getApps($user);
}
- if($key){
+ if($key) {
$keys=array($key);
}else{
- foreach($apps as $app){
+ foreach($apps as $app) {
$keys=OC_Preferences::getKeys($user,$app);
}
}
$result=array();
- foreach($apps as $app){
- foreach($keys as $key){
+ foreach($apps as $app) {
+ foreach($keys as $key) {
$value=OC_Preferences::getValue($user,$app,$key);
$result[]=array('app'=>$app,'key'=>$key,'value'=>$value);
}
@@ -592,7 +592,7 @@ class OC_OCS {
$login=OC_OCS::checkpassword();
if(OC_Group::inGroup($login, 'admin') or ($login==$user)) {
- if(OC_User::userExists($user)){
+ if(OC_User::userExists($user)) {
// calculate the disc space
$user_dir = '/'.$user.'/files';
OC_Filesystem::init($user_dir);
@@ -653,7 +653,7 @@ class OC_OCS {
private static function publicKeyGet($format,$user) {
$login=OC_OCS::checkpassword();
- if(OC_User::userExists($user)){
+ if(OC_User::userExists($user)) {
// calculate the disc space
$txt='this is the public key of '.$user;
echo($txt);
@@ -672,7 +672,7 @@ class OC_OCS {
$login=OC_OCS::checkpassword();
if(OC_Group::inGroup($login, 'admin') or ($login==$user)) {
- if(OC_User::userExists($user)){
+ if(OC_User::userExists($user)) {
// calculate the disc space
$txt='this is the private key of '.$user;
echo($txt);