NAME
Labyrinth::Support - Common Function Library for Labyrinth.
SYNOPSIS
use Labyrinth::Support;
DESCRIPTION
The functions contain herein are commonly used throughout Labyrinth and plugins.
EXPORT
AlignName
AlignClass
AlignSelect
PublishState
PublishSelect
PublishAction
FieldCheck
ParamCheck
AuthorCheck
MasterCheck
AccessName
AccessID
AccessUser
AccessGroup
AccessSelect
AccessAllFolders
AccessAllAreas
RealmCheck
RealmSelect
RealmName
RealmID
ProfileSelect
FolderName
FolderID
FolderSelect
AreaSelect
FUNCTIONS
- PublishState
-
Returns the name of the current publish state, given the numeric state.
- PublishSelect
-
Provides a dropdown selection box, as a XHTML code snippet, of the currently available publishing states.
- PublishAction
-
Provides a dropdown selection box, as a XHTML code snippet, of the currently accessible publishing states.
- AlignName
-
Returns the name of the given alignment type, defaults to 'none'.
- AlignClass
-
Returns the class of the given alignment type, defaults to 'nail'.
- AlignSelect
-
Provides a dropdown selection box, as a XHTML code snippet, of the currently available alignment states.
- AuthorCheck
-
Checks whether the current user is the author of the data requested, or has permissions to allow them to access the data. If not sets the BADACCESS error code, otherwise retrieves the data.
- MasterCheck
-
Ensure only a Master user can access a Master user details.
- FieldCheck(\@allfields,\@mandatory)
-
Stores all the input data listed in @allfields, then checks that all the fields listed in @mandatory are provided. Any errors found during parameter parsing both for missing mandatory fields and via Data::FormValidator are then flagged and the error code set.
- ParamCheck(\%fields)
-
Cleans data inputs, then stores all the input data fields in $tvars{data}. All mandatory fields are validated to ensure each has a value. Any errors found during parameter parsing both for missing mandatory fields and via Data::FormValidator are then flagged and the error code set.
The fields hash contains a list of fields, with the keys 'type' and 'html'. 'type' indicates whether the field is mandatory (1) or optional (0). 'html' indicates the level of cleaning required:
my %fields = ( linkid => { type => 0, html => 0 }, catid => { type => 0, html => 0 }, href => { type => 1, html => 1 }, title => { type => 1, html => 3 }, body => { type => 0, html => 2 }, ); # type: 0 = optional, 1 = mandatory # html: 0 = none, 1 = text, 2 = textarea, 3 = no links
'0' should only be used if previous parameter validation via Data::FormValidator has already ensured that only legal characters are used.
'1' removes all HTML tags.
'2' removes disallowed HTML tags and cleans up many tags and whitespace.
'3' removes anything that looks like a link or script tag, with the aim of preventing a XSS attack.
- AccessName
-
Returns the access permission name, given the access id.
- AccessID
-
Returns the access id, given the access permission name.
- AccessUser
-
Returns whether the current user has access at the given level of permissions. Default permission level is ADMIN. Returns 1 if permission is granted, 0 otherwise.
- AccessGroup
-
Returns whether the current user has access to the given group. Returns 1 if yes, 0 otherwise.
- AccessSelect
-
Provides a dropdown selection box, as a XHTML code snippet, of the currently available access states.
- AccessAllFolders
-
Return list of folders current user has access to.
- AccessAllAreas
-
Return list of areas current user has access to.
- RealmCheck
-
Checks whether the given realm is known within the system.
- RealmSelect
-
Provides a dropdown selection box, as a XHTML code snippet, of the currently available realms.
- RealmName
-
Returns the name of a realm, given a realm id.
- RealmID
-
Returns the id of a realm, given a realm name.
- ProfileSelect
-
Returns a dropdown list for the current list of profiles.
- FolderID
-
Returns the folder id, given the folder name.
- FolderName
-
Returns the name of a folder, given a folder id.
- FolderSelect
-
Provides a dropdown selection box, as a XHTML code snippet, of the currently available folders.
- AreaSelect
-
Provides a dropdown selection box, as a XHTML code snippet, of the currently available areas.
SEE ALSO
Time::Local
Labyrinth
AUTHOR
Barbie, <barbie@missbarbell.co.uk> for Miss Barbell Productions, http://www.missbarbell.co.uk/
COPYRIGHT & LICENSE
Copyright (C) 2002-2015 Barbie for Miss Barbell Productions
All Rights Reserved.
This module is free software; you can redistribute it and/or
modify it under the Artistic License 2.0.