im going crazy here trying to get this code to work, its complaining on
line 38 but i can see any problems with the file, any suggestions?


Cameron
<?php

class Directory
{
        var $base_dir;

        function Directory ( $base_dir )
        {

                if ( is_dir ( $base_dir ) ) {

                        $this->base_dir = $base_dir;
                        return (bool) true;

                } else {

                        return (bool) false;

                }

        }

        function _valid ( $dir )
        {

                if ( eregi ( "([..]{2})", $dir ) ) {

                        return (bool) false;

                } else {

                        return (bool) true;

                }

        }

        function list ( $path, $filter=false, $sort=false )
        {
                $path = $this->base_dir . $path;

                if ( $this->_valid ( $path ) && is_dir ( $path ) ) {

                        $dir = opendir ( $path );

                        if ( $filter ) {

                                while ( $blah = readdir ( $dir ) ) {

                                        if ( $blah == '.' || $blah == '..' ) {

                                                $files[] = $blah;

                                        }

                                }

                        } else {

                                while ( $files[] = readdir ( $dir ) ) { }

                        }

                        switch ( $sort ) {

                                case false:
                                        break;

                                case 'ASC':
                                        $files = sort ( $files, SORT_STRING );
                                        break;

                                case 'DESC':
                                        $files = rsort ( $files, SORT_STRING );
                                        break;

                                default:
                                        return (bool) false;

                        }

                        if ( is_array ( $files ) ) {

                                return $files;

                        } else {

                                return (bool) false;

                        }

                } else {

                        return (bool) false;

                }

        }

}
?>
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to