From 83958ebd4be58c64b23a3e9535f4246faeff8f4a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 22 Jun 2011 12:50:57 +0200 Subject: add oc_user::getUser to get the user id of the loggedin user --- apps/files_publiclink/lib_public.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'apps/files_publiclink') 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)); } -- cgit v1.2.3