diff options
author | Andreas Unterkircher <unki@netshadow.at> | 2007-07-15 08:50:33 +0000 |
---|---|---|
committer | Andreas Unterkircher <unki@netshadow.at> | 2007-07-15 08:50:33 +0000 |
commit | a63f899582afffadbabfdf422489b7937f0e6a1e (patch) | |
tree | d2868e32513d32bf658872018ede19eeab126909 | |
parent | 22ac9327fb70b59796a6e5405e18788e89af4d69 (diff) |
get_current_user() returns the OWNER of the php script - now we use posix functions to get the current process user
git-svn-id: file:///var/lib/svn/phpfspot/trunk@206 fa6a889d-dae6-447d-9e79-4ba9a3039384
-rw-r--r-- | phpfspot.class.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php index ba94884..579054d 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -199,7 +199,7 @@ class PHPFSPOT { } if(!is_readable($orig_path)) { - $this->_warning("Photo ". $orig_path ." is not readable for user ". get_current_user() ."<br />\n"); + $this->_warning("Photo ". $orig_path ." is not readable for user ". $this->getuid() ."<br />\n"); } /* If the thumbnail doesn't exist yet, try to create it */ @@ -891,7 +891,7 @@ class PHPFSPOT { } if(!is_readable($full_path)) { - $this->_warning("File ". $full_path ." is not readable for ". get_current_user() ."\n"); + $this->_warning("File ". $full_path ." is not readable for ". $this->getuid() ."\n"); return; } @@ -1319,6 +1319,18 @@ class PHPFSPOT { } // whatToDo() + private function getuid() + { + if($uid = posix_getuid()) { + if($user = posix_getpwuid($uid)) { + return $user['name']; + } + } + + return 'n/a'; + + } // getuid() + } ?> |