Simplifying hasPermissions

Simplifying the permissions check. 
I've tested this with a couple permission sets and user sets.
This commit is contained in:
Archie 2014-11-03 23:23:15 -08:00
parent 3d99d1d71c
commit 6bc6b5dcd1

View File

@ -121,13 +121,14 @@ function get_hashed_password($password) {
}
function hasPermissions($path, $permissions = '0777') {
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;
# Using built-in php function
if (is_writeable($path)) {
return true;
}
return false;
}