Browse Source

fix ocs path and queries

tags/v3.0
Thibaut GRIDEL 14 years ago
parent
commit
477b9877a0
2 changed files with 21 additions and 23 deletions
  1. 2
    4
      inc/HTTP/WebDAV/Server/Filesystem.php
  2. 19
    19
      inc/lib_ocs.php

+ 2
- 4
inc/HTTP/WebDAV/Server/Filesystem.php View File

// get additional properties from database // get additional properties from database
$query = "SELECT ns, name, value FROM properties WHERE path = '$path'"; $query = "SELECT ns, name, value FROM properties WHERE path = '$path'";
$res = OC_DB::select($query); $res = OC_DB::select($query);
while ($row = $res[0]) {
foreach ($res as $row) {
$info["props"][] = $this->mkprop($row["ns"], $row["name"], $row["value"]); $info["props"][] = $this->mkprop($row["ns"], $row["name"], $row["value"]);
} }
return $info; return $info;
$where = "WHERE path = '$options[path]' AND token = '$options[update]'"; $where = "WHERE path = '$options[path]' AND token = '$options[update]'";


$query = "SELECT owner, exclusivelock FROM locks $where"; $query = "SELECT owner, exclusivelock FROM locks $where";
$res = OC_DB::query($query);
$row = OC_DB::fetch_assoc($res);
OC_DB::free_result($res);
$row = OC_DB::select($query);


if (is_array($row)) { if (is_array($row)) {
$query = "UPDATE `locks` SET `expires` = '$options[timeout]', `modified` = ".time()." $where"; $query = "UPDATE `locks` SET `expires` = '$options[timeout]', `modified` = ".time()." $where";

+ 19
- 19
inc/lib_ocs.php View File

/** /**
* ownCloud * ownCloud
* *
* @author Frank Karlitschek
* @copyright 2010 Frank Karlitschek karlitschek@kde.org
*
* @author Frank Karlitschek
* @copyright 2010 Frank Karlitschek karlitschek@kde.org
*
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version. * version 3 of the License, or any later version.
*
*
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/ */




} }


// preprocess url // preprocess url
$url=$_SERVER['PHP_SELF'];
$url=$_SERVER['REQUEST_URI'];
if(substr($url,(strlen($url)-1))<>'/') $url.='/'; if(substr($url,(strlen($url)-1))<>'/') $url.='/';
$ex=explode('/',$url); $ex=explode('/',$url);
$paracount=count($ex); $paracount=count($ex);
OC_OCS::apiconfig($format); OC_OCS::apiconfig($format);


// PERSON // PERSON
// personcheck - POST - PERSON/CHECK
// personcheck - POST - PERSON/CHECK
}elseif(($method=='post') and (strtolower($ex[$paracount-4])=='v1.php') and (strtolower($ex[$paracount-3])=='person') and (strtolower($ex[$paracount-2])=='check')){ }elseif(($method=='post') and (strtolower($ex[$paracount-4])=='v1.php') and (strtolower($ex[$paracount-3])=='person') and (strtolower($ex[$paracount-2])=='check')){
$format=OC_OCS::readdata('format','text'); $format=OC_OCS::readdata('format','text');
$login=OC_OCS::readdata('login','text'); $login=OC_OCS::readdata('login','text');


// ACTIVITY // ACTIVITY
// activityget - GET ACTIVITY page,pagesize als urlparameter // activityget - GET ACTIVITY page,pagesize als urlparameter
}elseif(($method=='get') and (strtolower($ex[$paracount-3])=='v1.php')and (strtolower($ex[$paracount-2])=='activity')){
}elseif(($method=='get') and (strtolower($ex[$paracount-3])=='v1.php')and (strtolower($ex[$paracount-2])=='activity')){
$format=OC_OCS::readdata('format','text'); $format=OC_OCS::readdata('format','text');
$page=OC_OCS::readdata('page','int'); $page=OC_OCS::readdata('page','int');
$pagesize=OC_OCS::readdata('pagesize','int'); $pagesize=OC_OCS::readdata('pagesize','int');
OC_OCS::activityget($format,$page,$pagesize); OC_OCS::activityget($format,$page,$pagesize);


// activityput - POST ACTIVITY // activityput - POST ACTIVITY
}elseif(($method=='post') and (strtolower($ex[$paracount-3])=='v1.php')and (strtolower($ex[$paracount-2])=='activity')){
}elseif(($method=='post') and (strtolower($ex[$paracount-3])=='v1.php')and (strtolower($ex[$paracount-2])=='activity')){
$format=OC_OCS::readdata('format','text'); $format=OC_OCS::readdata('format','text');
$message=OC_OCS::readdata('message','text'); $message=OC_OCS::readdata('message','text');
OC_OCS::activityput($format,$message); OC_OCS::activityput($format,$message);
/** /**
* checks if the user is authenticated * checks if the user is authenticated
* checks the IP whitlist, apikeys and login/password combination * checks the IP whitlist, apikeys and login/password combination
* if $forceuser is true and the authentication failed it returns an 401 http response.
* if $forceuser is true and the authentication failed it returns an 401 http response.
* if $forceuser is false and authentification fails it returns an empty username string * if $forceuser is false and authentification fails it returns an empty username string
* @param bool $forceuser * @param bool $forceuser
* @return username string * @return username string
} }




/**
/**
* check if the provided login/apikey/password is valid * check if the provided login/apikey/password is valid
* @param string $format * @param string $format
* @param string $login * @param string $login


// ACTIVITY API ############################################# // ACTIVITY API #############################################


/**
/**
* get my activities * get my activities
* @param string $format * @param string $format
* @param string $page * @param string $page


$user=OC_OCS::checkpassword(); $user=OC_OCS::checkpassword();


$result = OC_DB::query('select count(id) as co from log');
$entry=OC_DB::fetch_assoc($result);
$result = OC_DB::query('select count(*) as co from log');
$entry=$result->fetchRow();
$totalcount=$entry['co']; $totalcount=$entry['co'];
OC_DB::free_result($result); OC_DB::free_result($result);


$xml[$i]['personid']=$log['user']; $xml[$i]['personid']=$log['user'];
$xml[$i]['firstname']=$log['user']; $xml[$i]['firstname']=$log['user'];
$xml[$i]['lastname']=''; $xml[$i]['lastname']='';
$xml[$i]['profilepage']=$url;
$xml[$i]['profilepage']=$url;


$pic=$url.'/img/owncloud-icon.png'; $pic=$url.'/img/owncloud-icon.png';
$xml[$i]['avatarpic']=$pic; $xml[$i]['avatarpic']=$pic;
echo($txt); echo($txt);
} }


/**
/**
* submit a activity * submit a activity
* @param string $format * @param string $format
* @param string $message * @param string $message

Loading…
Cancel
Save