diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-06-22 12:50:57 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-06-22 12:50:57 +0200 |
commit | 83958ebd4be58c64b23a3e9535f4246faeff8f4a (patch) | |
tree | 169321f7bb32e315c6a33ce139b799efdc224da4 /apps/files_publiclink | |
parent | c0af177223f5ebd74614b775121ea7f3497d25a5 (diff) | |
download | nextcloud-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.php | 6 |
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)); } |