From 3f2a73181a35cf0856b97cc949d7b7be511b1fcc Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Wed, 5 Nov 2014 19:50:02 +0100 Subject: [PATCH] Added is_readable to permission check #258 --- php/modules/misc.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/php/modules/misc.php b/php/modules/misc.php index 420f452..c4d8fd4 100755 --- a/php/modules/misc.php +++ b/php/modules/misc.php @@ -121,13 +121,9 @@ function get_hashed_password($password) { function hasPermissions($path) { - /* assume that if running with the same uid as the owner of the directory it's ok */ - //$stat = @stat($path); - //if ($stat && ($stat['uid'] == getmyuid())) return true; - //if (substr(sprintf('%o', @fileperms($path)), -4)!=$permissions) return false; - //else return true; + if (is_readable($path)===true&& + is_writeable($path)===true) return true; - if (is_writeable($path)) return true; return false; }