Browse Source

Updated permission check #260

Tobias Reich 9 years ago
parent
commit
348af5ca3d
1 changed files with 7 additions and 4 deletions
  1. 7 4
      php/modules/misc.php

+ 7 - 4
php/modules/misc.php

@@ -119,13 +119,16 @@ 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);
+	//$stat = @stat($path);
 	//if ($stat && ($stat['uid'] == getmyuid())) return true;
-	if (substr(sprintf('%o', @fileperms($path)), -4)!=$permissions) return false;
-	else return true;
+	//if (substr(sprintf('%o', @fileperms($path)), -4)!=$permissions) return false;
+	//else return true;
+
+	if (is_writeable($path)) return true;
+	return false;
 
 }