aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_publiclink
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-06-22 12:50:57 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-06-22 12:50:57 +0200
commit83958ebd4be58c64b23a3e9535f4246faeff8f4a (patch)
tree169321f7bb32e315c6a33ce139b799efdc224da4 /apps/files_publiclink
parentc0af177223f5ebd74614b775121ea7f3497d25a5 (diff)
downloadnextcloud-server-83958ebd4be58c64b23a3e9535f4246faeff8f4a.tar.gz
nextcloud-server-83958ebd4be58c64b23a3e9535f4246faeff8f4a.zip
add oc_user::getUser to get the user id of the loggedin user
Diffstat (limited to 'apps/files_publiclink')
-rw-r--r--apps/files_publiclink/lib_public.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/files_publiclink/lib_public.php b/apps/files_publiclink/lib_public.php
index aeef9212377..93ccc52d0e9 100644
--- a/apps/files_publiclink/lib_public.php
+++ b/apps/files_publiclink/lib_public.php
@@ -7,7 +7,7 @@ class OC_PublicLink{
*/
public function __construct($path,$expiretime=0){
if($path and OC_FILESYSTEM::file_exists($path) and OC_FILESYSTEM::is_readable($path)){
- $user=$_SESSION['user_id'];
+ $user=OC_USER::getUser();
$token=sha1("$user-$path-$expiretime");
$query=OC_DB::prepare("INSERT INTO *PREFIX*publiclink VALUES(?,?,?,?)");
$result=$query->execute(array($token,$path,$user,$expiretime));
@@ -60,7 +60,7 @@ class OC_PublicLink{
*/
static public function getLinks(){
$query=OC_DB::prepare("SELECT * FROM *PREFIX*publiclink WHERE user=?");
- return $query->execute(array($_SESSION['user_id']))->fetchAll();
+ return $query->execute(array(OC_USER::getUser()))->fetchAll();
}
/**
@@ -69,7 +69,7 @@ class OC_PublicLink{
static public function delete($token){
$query=OC_DB::prepare("SELECT user,path FROM *PREFIX*publiclink WHERE token=?");
$result=$query->execute(array($token))->fetchAll();
- if(count($result)>0 and $result[0]['user']==$_SESSION['user_id']){
+ if(count($result)>0 and $result[0]['user']==OC_USER::getUser()){
$query=OC_DB::prepare("DELETE FROM *PREFIX*publiclink WHERE token=?");
$query->execute(array($token));
}