Simplifying hasPermissions
Simplifying the permissions check. I've tested this with a couple permission sets and user sets.
This commit is contained in:
parent
3d99d1d71c
commit
6bc6b5dcd1
@ -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 */
|
# Using built-in php function
|
||||||
$stat = @stat($path);
|
if (is_writeable($path)) {
|
||||||
if ($stat && ($stat['uid'] == getmyuid())) return true;
|
return true;
|
||||||
if (substr(sprintf('%o', @fileperms($path)), -4)!=$permissions) return false;
|
}
|
||||||
else return true;
|
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user