PHP Class Gollem, horde

Copyright 1999-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Author: Max Kalika ([email protected])
Author: Chuck Hagenbuch ([email protected])
Author: Michael Slusarz ([email protected])
Datei anzeigen Open project: horde/horde Class Usage Examples

Public Properties

Property Type Description
$backend array Configuration hash for the current backend.

Protected Properties

Property Type Description
$_columns array Cache for display columns.

Public Methods

Method Description
changeDir ( ) Changes the current directory of the Gollem session based on the 'dir' form field.
changePermissions ( string $dir, string $name, string $permission ) Change permissions on files using the current Gollem session settings.
checkPermissions ( string $filter, integer $permission = Horde_Perms::READ, string $resource = null ) : boolean Checks if a user has the specified permissions on a resource.
copyFile ( string $backend_f, string $dir, string $name, string $backend_t, string $newdir ) Copies a file using the current Gollem session settings.
createFolder ( string $dir, string $name, Horde_Vfs_Base $gollem_vfs = null ) Create a folder using the current Gollem session settings.
deleteFile ( string $dir, string $name ) Delete a file using the current Gollem session settings.
deleteFolder ( string $dir, string $name ) Delete a folder using the current Gollem session settings.
directoryNavLink ( string $currdir, string $url ) : string Produces a directory link used for navigation.
expireCache ( string $dir ) Expire a folder cache entry.
getColumns ( $backend ) : array Parses the 'columns' preference.
getDisplayPath ( string $path ) : string Generate the display path (the path with any root information stripped out).
getVFSPath ( string $fullpath ) : array Take a fully qualified and break off the file or directory name.
listFolder ( string $dir ) : array List the current folder.
moveFile ( string $backend_f, string $dir, string $name, string $backend_t, string $newdir ) Moves a file using the current Gollem session settings.
pathEncode ( string $path ) : string Convert a Gollem path into a URL encoded string, but keep '/'.
renameItem ( string $oldDir, string $old, string $newDir, $new ) Rename files using the current Gollem session settings.
setDir ( string $dir ) Changes the current directory of the Gollem session to the supplied value.
sortDate ( $a, $b ) Internal sorting function for 'date'.
sortName ( $a, $b ) Internal sorting function for 'name'.
sortSize ( $a, $b ) Internal sorting function for 'size'.
sortType ( $a, $b ) Internal sorting function for 'type'.
stripAPIPath ( string $path ) : string Cleans a path presented to Gollem's browse API call.
subdirectory ( string $base, string $dir ) : string Generate correct subdirectory links.
verifyDir ( string $dir ) : boolean This function verifies whether a given directory is below the root.
writeFile ( string $dir, string $name, string $filename ) Write an uploaded file to the VFS backend.

Protected Methods

Method Description
_copyFile ( $mode, $backend_f, $dir, $name, $backend_t, $newdir ) Private function that copies/moves files.
_getCacheID ( string $dir ) Generate the Cache ID for a directory.
_setLabel ( ) Set the lable to use for the current page.
_sortDirs ( $a, $b ) Internal helper to sort directories first if pref set.

Method Details

_copyFile() protected static method

Private function that copies/moves files.
protected static _copyFile ( $mode, $backend_f, $dir, $name, $backend_t, $newdir )

_getCacheID() protected static method

Generate the Cache ID for a directory.
protected static _getCacheID ( string $dir )
$dir string The directory name.

_setLabel() protected static method

Set the lable to use for the current page.
protected static _setLabel ( )

_sortDirs() protected static method

Internal helper to sort directories first if pref set.
protected static _sortDirs ( $a, $b )

changeDir() public static method

Changes the current directory of the Gollem session based on the 'dir' form field.
public static changeDir ( )

changePermissions() public static method

Change permissions on files using the current Gollem session settings.
public static changePermissions ( string $dir, string $name, string $permission )
$dir string The directory name.
$name string The filename to change permissions on.
$permission string The permission mode to set.

checkPermissions() public static method

Checks if a user has the specified permissions on a resource.
public static checkPermissions ( string $filter, integer $permission = Horde_Perms::READ, string $resource = null ) : boolean
$filter string What are we checking for. Either 'backend' or 'directory'.
$permission integer The permission to check for. One of the Horde_Perms constants.
$resource string The resource to check. If empty, check the current backend/directory.
return boolean Returns true if the user has permission.

copyFile() public static method

Copies a file using the current Gollem session settings.
public static copyFile ( string $backend_f, string $dir, string $name, string $backend_t, string $newdir )
$backend_f string The backend to copy the file from.
$dir string The directory name of the original file.
$name string The original filename.
$backend_t string The backend to copy the file to.
$newdir string The directory to copy the file to.

createFolder() public static method

Create a folder using the current Gollem session settings.
public static createFolder ( string $dir, string $name, Horde_Vfs_Base $gollem_vfs = null )
$dir string The directory path.
$name string The folder to create.
$gollem_vfs Horde_Vfs_Base A VFS instance to use.

deleteFile() public static method

Delete a file using the current Gollem session settings.
public static deleteFile ( string $dir, string $name )
$dir string The directory name.
$name string The filename to delete.

deleteFolder() public static method

Delete a folder using the current Gollem session settings.
public static deleteFolder ( string $dir, string $name )
$dir string The subdirectory name.
$name string The folder name to delete.

expireCache() public static method

Expire a folder cache entry.
public static expireCache ( string $dir )
$dir string The directory name.

getColumns() public static method

Parses the 'columns' preference.
public static getColumns ( $backend ) : array
return array The list of columns to be displayed.

getDisplayPath() public static method

Generate the display path (the path with any root information stripped out).
public static getDisplayPath ( string $path ) : string
$path string The path to display.
return string The display path.

getVFSPath() public static method

This pair is used for the input to many VFS library functions.
public static getVFSPath ( string $fullpath ) : array
$fullpath string Path to be split.
return array Array of ($path, $name)

listFolder() public static method

List the current folder.
public static listFolder ( string $dir ) : array
$dir string The directory name.
return array The sorted list of files.

moveFile() public static method

Moves a file using the current Gollem session settings.
public static moveFile ( string $backend_f, string $dir, string $name, string $backend_t, string $newdir )
$backend_f string The backend to move the file from.
$dir string The directory name of the original file.
$name string The original filename.
$backend_t string The backend to move the file to.
$newdir string The directory to move the file to.

pathEncode() public static method

This allows for proper PATH_INFO path parsing. Special care is taken to handle "+" and " ".
public static pathEncode ( string $path ) : string
$path string Path to be urlencode()d.
return string URL-encoded string with '/' preserved.

renameItem() public static method

Rename files using the current Gollem session settings.
public static renameItem ( string $oldDir, string $old, string $newDir, $new )
$oldDir string Old directory name.
$old string Old file name.
$newDir string New directory name.

setDir() public static method

Changes the current directory of the Gollem session to the supplied value.
public static setDir ( string $dir )
$dir string Directory name.

sortDate() public static method

Internal sorting function for 'date'.
public static sortDate ( $a, $b )

sortName() public static method

Internal sorting function for 'name'.
public static sortName ( $a, $b )

sortSize() public static method

Internal sorting function for 'size'.
public static sortSize ( $a, $b )

sortType() public static method

Internal sorting function for 'type'.
public static sortType ( $a, $b )

stripAPIPath() public static method

This will remove: - leading '/' - leading 'gollem' - trailing '/' The desired end result is the path including VFS backend.
public static stripAPIPath ( string $path ) : string
$path string Path as presented to Gollem API.
return string Cleaned path as described above.

subdirectory() public static method

Generate correct subdirectory links.
public static subdirectory ( string $base, string $dir ) : string
$base string The base directory.
$dir string The directory string.
return string The correct subdirectoy string.

verifyDir() public static method

This function verifies whether a given directory is below the root.
public static verifyDir ( string $dir ) : boolean
$dir string The directory to check.
return boolean True if the directory is below the root.

writeFile() public static method

Write an uploaded file to the VFS backend.
public static writeFile ( string $dir, string $name, string $filename )
$dir string The directory name.
$name string The filename to create.
$filename string The local file containing the file data.

Property Details

$_columns protected_oe static_oe property

Cache for display columns.
protected static array $_columns
return array

$backend public_oe static_oe property

Configuration hash for the current backend.
public static array $backend
return array