public function chmodR($path, $filemode)
    {

        if (!$this->isFolder($path)) {
            return $this->chmod($path, $filemode);
        }

        $dirh = @opendir($path);
        while ($file = readdir($dirh)) {
            if ($file != '.' && $file != '..') {
                $fullpath = $path . '/' . $file;
                if (!$this->isFolder($fullpath)) {
                    if (!$this->chmod($fullpath, $filemode)) {
                        return false;
                    }
                } else {
                    if (!$this->chmodR($fullpath, $filemode)) {
                        return false;
                    }
                }
            }
        }

        closedir($dirh);

        if ($this->chmod($path, $filemode)) {
            return true;
        } else {
            return false;
        }
    }
public function chmodR($path, $filemode)
    {

        if (!$this->isFolder($path)) {
            return $this->chmod($path, $filemode);
        }

        $dirh = @opendir($path);
        while ($file = readdir($dirh)) {
            if ($file != '.' && $file != '..') {
                $fullpath = $path . '/' . $file;
                if (!$this->isFolder($fullpath)) {
                    if (!$this->chmod($fullpath, $filemode)) {
                        return false;
                    }
                } else {
                    if (!$this->chmodR($fullpath, $filemode)) {
                        return false;
                    }
                }
            }
        }

        closedir($dirh);

        if ($this->chmod($path, $filemode)) {
            return true;
        } else {
            return false;
        }
    }
public function chmodR ( $ path , $ filemode ) { if ( ! $ this -> isFolder ( $ path ) ) { return $ this -> chmod ( $ path , $ filemode ) ; } $ dirh = @ opendir ( $ path ) ; while ( $ file = readdir ( $ dirh ) ) { if ( $ file != '.' && $ file != '..' ) { $ fullpath = $ path . '/' . $ file ; if ( ! $ this -> isFolder ( $ fullpath ) ) { if ( ! $ this -> chmod ( $ fullpath , $ filemode ) ) { return false ; } } else { if ( ! $ this -> chmodR ( $ fullpath , $ filemode ) ) { return false ; } } } } closedir ( $ dirh ) ; if ( $ this -> chmod ( $ path , $ filemode ) ) { return true ; } else { return false ; } }
Recursively sets permissions for all files in a folder

@param type $path
@param type $permission
Recursively sets permissions for all files in a folder