Gollem
in package
Gollem base library.
Copyright 1999-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Tags
Table of Contents
- SORT_ASCEND = 0
- SORT_DATE = 2
- SORT_DESCEND = 1
- SORT_NAME = 1
- SORT_SIZE = 3
- SORT_TYPE = 0
- $backend : array<string|int, mixed>
- Configuration hash for the current backend.
- $_columns : array<string|int, mixed>
- Cache for display columns.
- changeDir() : mixed
- Changes the current directory of the Gollem session based on the 'dir' form field.
- changePermissions() : mixed
- Change permissions on files using the current Gollem session settings.
- checkPermissions() : bool
- Checks if a user has the specified permissions on a resource.
- copyFile() : mixed
- Copies a file using the current Gollem session settings.
- createFolder() : mixed
- Create a folder using the current Gollem session settings.
- deleteFile() : mixed
- Delete a file using the current Gollem session settings.
- deleteFolder() : mixed
- Delete a folder using the current Gollem session settings.
- directoryNavLink() : string
- Produces a directory link used for navigation.
- expireCache() : mixed
- Expire a folder cache entry.
- getColumns() : array<string|int, mixed>
- Parses the 'columns' preference.
- getDisplayPath() : string
- Generate the display path (the path with any root information stripped out).
- getVFSPath() : array<string|int, mixed>
- Take a fully qualified and break off the file or directory name.
- listFolder() : array<string|int, mixed>
- List the current folder.
- moveFile() : mixed
- Moves a file using the current Gollem session settings.
- pathEncode() : string
- Convert a Gollem path into a URL encoded string, but keep '/'.
- renameItem() : mixed
- Rename files using the current Gollem session settings.
- setDir() : mixed
- Changes the current directory of the Gollem session to the supplied value.
- sortDate() : mixed
- Internal sorting function for 'date'.
- sortName() : mixed
- Internal sorting function for 'name'.
- sortSize() : mixed
- Internal sorting function for 'size'.
- sortType() : mixed
- Internal sorting function for 'type'.
- stripAPIPath() : string
- Cleans a path presented to Gollem's browse API call.
- subdirectory() : string
- Generate correct subdirectory links.
- verifyDir() : bool
- This function verifies whether a given directory is below the root.
- writeFile() : mixed
- Write an uploaded file to the VFS backend.
- _copyFile() : mixed
- Private function that copies/moves files.
- _getCacheID() : mixed
- Generate the Cache ID for a directory.
- _setLabel() : mixed
- Set the lable to use for the current page.
- _sortDirs() : mixed
- Internal helper to sort directories first if pref set.
Constants
SORT_ASCEND
public
mixed
SORT_ASCEND
= 0
SORT_DATE
public
mixed
SORT_DATE
= 2
SORT_DESCEND
public
mixed
SORT_DESCEND
= 1
SORT_NAME
public
mixed
SORT_NAME
= 1
SORT_SIZE
public
mixed
SORT_SIZE
= 3
SORT_TYPE
public
mixed
SORT_TYPE
= 0
Properties
$backend
Configuration hash for the current backend.
public
static array<string|int, mixed>
$backend
$_columns
Cache for display columns.
protected
static array<string|int, mixed>
$_columns
Methods
changeDir()
Changes the current directory of the Gollem session based on the 'dir' form field.
public
static changeDir() : mixed
Tags
Return values
mixed —changePermissions()
Change permissions on files using the current Gollem session settings.
public
static changePermissions(string $dir, string $name, string $permission) : mixed
Parameters
- $dir : string
-
The directory name.
- $name : string
-
The filename to change permissions on.
- $permission : string
-
The permission mode to set.
Tags
Return values
mixed —checkPermissions()
Checks if a user has the specified permissions on a resource.
public
static checkPermissions(string $filter[, int $permission = Horde_Perms::READ ][, string $resource = null ]) : bool
Parameters
- $filter : string
-
What are we checking for. Either 'backend' or 'directory'.
- $permission : int = Horde_Perms::READ
-
The permission to check for. One of the Horde_Perms constants.
- $resource : string = null
-
The resource to check. If empty, check the current backend/directory.
Return values
bool —Returns true if the user has permission.
copyFile()
Copies a file using the current Gollem session settings.
public
static copyFile(string $backend_f, string $dir, string $name, string $backend_t, string $newdir) : mixed
Parameters
- $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.
Tags
Return values
mixed —createFolder()
Create a folder using the current Gollem session settings.
public
static createFolder(string $dir, string $name[, Horde_Vfs_Base $gollem_vfs = null ]) : mixed
Parameters
- $dir : string
-
The directory path.
- $name : string
-
The folder to create.
- $gollem_vfs : Horde_Vfs_Base = null
-
A VFS instance to use.
Tags
Return values
mixed —deleteFile()
Delete a file using the current Gollem session settings.
public
static deleteFile(string $dir, string $name) : mixed
Parameters
- $dir : string
-
The directory name.
- $name : string
-
The filename to delete.
Tags
Return values
mixed —deleteFolder()
Delete a folder using the current Gollem session settings.
public
static deleteFolder(string $dir, string $name) : mixed
Parameters
- $dir : string
-
The subdirectory name.
- $name : string
-
The folder name to delete.
Tags
Return values
mixed —directoryNavLink()
Produces a directory link used for navigation.
public
static directoryNavLink(string $currdir, string $url) : string
Parameters
- $currdir : string
-
The current directory string.
- $url : string
-
The URL to link to.
Return values
string —The directory navigation string.
expireCache()
Expire a folder cache entry.
public
static expireCache(string $dir) : mixed
Parameters
- $dir : string
-
The directory name.
Return values
mixed —getColumns()
Parses the 'columns' preference.
public
static getColumns(mixed $backend) : array<string|int, mixed>
Parameters
- $backend : mixed
Return values
array<string|int, mixed> —The list of columns to be displayed.
getDisplayPath()
Generate the display path (the path with any root information stripped out).
public
static getDisplayPath(string $path) : string
Parameters
- $path : string
-
The path to display.
Return values
string —The display path.
getVFSPath()
Take a fully qualified and break off the file or directory name.
public
static getVFSPath(string $fullpath) : array<string|int, mixed>
This pair is used for the input to many VFS library functions.
Parameters
- $fullpath : string
-
Path to be split.
Return values
array<string|int, mixed> —Array of ($path, $name)
listFolder()
List the current folder.
public
static listFolder(string $dir) : array<string|int, mixed>
Parameters
- $dir : string
-
The directory name.
Tags
Return values
array<string|int, mixed> —The sorted list of files.
moveFile()
Moves a file using the current Gollem session settings.
public
static moveFile(string $backend_f, string $dir, string $name, string $backend_t, string $newdir) : mixed
Parameters
- $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.
Tags
Return values
mixed —pathEncode()
Convert a Gollem path into a URL encoded string, but keep '/'.
public
static pathEncode(string $path) : string
This allows for proper PATH_INFO path parsing. Special care is taken to handle "+" and " ".
Parameters
- $path : string
-
Path to be urlencode()d.
Return values
string —URL-encoded string with '/' preserved.
renameItem()
Rename files using the current Gollem session settings.
public
static renameItem(string $oldDir, string $old, string $newDir, mixed $new) : mixed
Parameters
- $oldDir : string
-
Old directory name.
- $old : string
-
New file name.
- $newDir : string
-
New directory name.
- $new : mixed
Tags
Return values
mixed —setDir()
Changes the current directory of the Gollem session to the supplied value.
public
static setDir(string $dir) : mixed
Parameters
- $dir : string
-
Directory name.
Tags
Return values
mixed —sortDate()
Internal sorting function for 'date'.
public
static sortDate(mixed $a, mixed $b) : mixed
Parameters
- $a : mixed
- $b : mixed
Return values
mixed —sortName()
Internal sorting function for 'name'.
public
static sortName(mixed $a, mixed $b) : mixed
Parameters
- $a : mixed
- $b : mixed
Return values
mixed —sortSize()
Internal sorting function for 'size'.
public
static sortSize(mixed $a, mixed $b) : mixed
Parameters
- $a : mixed
- $b : mixed
Return values
mixed —sortType()
Internal sorting function for 'type'.
public
static sortType(mixed $a, mixed $b) : mixed
Parameters
- $a : mixed
- $b : mixed
Return values
mixed —stripAPIPath()
Cleans a path presented to Gollem's browse API call.
public
static stripAPIPath(string $path) : string
This will remove:
- leading '/'
- leading 'gollem'
- trailing '/' The desired end result is the path including VFS backend.
Parameters
- $path : string
-
Path as presented to Gollem API.
Return values
string —Cleaned path as described above.
subdirectory()
Generate correct subdirectory links.
public
static subdirectory(string $base, string $dir) : string
Parameters
- $base : string
-
The base directory.
- $dir : string
-
The directory string.
Return values
string —The correct subdirectoy string.
verifyDir()
This function verifies whether a given directory is below the root.
public
static verifyDir(string $dir) : bool
Parameters
- $dir : string
-
The directory to check.
Return values
bool —True if the directory is below the root.
writeFile()
Write an uploaded file to the VFS backend.
public
static writeFile(string $dir, string $name, string $filename) : mixed
Parameters
- $dir : string
-
The directory name.
- $name : string
-
The filename to create.
- $filename : string
-
The local file containing the file data.
Tags
Return values
mixed —_copyFile()
Private function that copies/moves files.
protected
static _copyFile(mixed $mode, mixed $backend_f, mixed $dir, mixed $name, mixed $backend_t, mixed $newdir) : mixed
Parameters
- $mode : mixed
- $backend_f : mixed
- $dir : mixed
- $name : mixed
- $backend_t : mixed
- $newdir : mixed
Tags
Return values
mixed —_getCacheID()
Generate the Cache ID for a directory.
protected
static _getCacheID(string $dir) : mixed
Parameters
- $dir : string
-
The directory name.
Return values
mixed —_setLabel()
Set the lable to use for the current page.
protected
static _setLabel() : mixed
Return values
mixed —_sortDirs()
Internal helper to sort directories first if pref set.
protected
static _sortDirs(mixed $a, mixed $b) : mixed
Parameters
- $a : mixed
- $b : mixed