GetSimple Support Forum

Full Version: Insert image error in filebrowser.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Using GS 3.0 with Innovation Theme in debug mode.

Browser = Firefox 3.6x

Insert image into page. Browse server.

Fatal error: Call to undefined function posix_getpwuid() in GetSimple_3.0/admin/filebrowser.php on line 151.

I have verified there are several images in the Upload folder on server, but only the first image displays.

Any ideas? Thanks.

N
Are you running on a Unix host?

This command is specific for Unix.

We couold implement this better , I'll add it to the SVN.

To get you over the issue you could just comment out lines 149-155

Regards, Mike.
This should sort that out for you. I'll add it to the SVN for the next release.

Code:
// get the file permissions.
            if ($isUnixHost && defined('GSDEBUG')) {
                $filePerms = substr(sprintf('%o', fileperms($path.$upload['name'])), -4);
                if (function_exists('posix_getpwuid')){
                    $fileOwner = posix_getpwuid(fileowner($path.$upload['name']));
                }
                if (($filePerms) && isset($fileOwner['name'])){
                    echo '<td style="width:70px;text-align:right;"><span>'.$fileOwner['name'].'/'.$filePerms.'</span></td>';
                }
            }
Mike, is this code snippet in upload.php too?
n00dles101 Wrote:This should sort that out for you. I'll add it to the SVN for the next release.

Code:
// get the file permissions.
            if ($isUnixHost && defined('GSDEBUG')) {
                $filePerms = substr(sprintf('%o', fileperms($path.$upload['name'])), -4);
                if (function_exists('posix_getpwuid')){
                    $fileOwner = posix_getpwuid(fileowner($path.$upload['name']));
                }
                if (($filePerms) && isset($fileOwner['name'])){
                    echo '<td style="width:70px;text-align:right;"><span>'.$fileOwner['name'].'/'.$filePerms.'</span></td>';
                }
            }

If you move the function_exists to the outer if it's even better/clearer code ;-)
Code:
if ($isUnixHost && defined('GSDEBUG') && function_exists('posix_getpwuid')) {
        $filePerms = substr(sprintf('%o', fileperms($path.$upload['name'])), -4);
        $fileOwner = posix_getpwuid(fileowner($path.$upload['name']));
        ...
@Chris, already in upload.php.

@mvlcek, yeah suppose that makes more sense as we need both before the info is output.
This worked a treat! Thanks for your help, Mike.

Nancy O'Shea