Procedural File: admin-functions.php
Source Location: /admin-functions.php
Page Details
support functions for Admin
Includes
require_once
(dirname(__FILE__).'/functions.php')
[line 9]
Constants
CUSTOM_OPTION_PREFIX [line 484]
CUSTOM_OPTION_PREFIX = '_ZP_CUSTOM_'
|
|
OPTION_TYPE_CHECKBOX [line 514]
OPTION_TYPE_CHECKBOX_ARRAY [line 519]
OPTION_TYPE_CHECKBOX_ARRAY = 6
|
|
OPTION_TYPE_CHECKBOX_UL [line 520]
OPTION_TYPE_CHECKBOX_UL = 7
|
|
OPTION_TYPE_CLEARTEXT [line 522]
OPTION_TYPE_CLEARTEXT = 9
|
|
OPTION_TYPE_COLOR_PICKER [line 521]
OPTION_TYPE_COLOR_PICKER = 8
|
|
OPTION_TYPE_CUSTOM [line 515]
OPTION_TYPE_NOTE [line 523]
OPTION_TYPE_RADIO [line 517]
OPTION_TYPE_SELECTOR [line 518]
OPTION_TYPE_TEXTAREA [line 516]
OPTION_TYPE_TEXTBOX [line 513]
Generates the HTML for custom options (e.g. theme options, plugin options, etc.)
TEXTAREA_COLUMNS [line 11]
TEXTAREA_COLUMNS_SHORT [line 13]
TEXTAREA_COLUMNS_SHORT = 32
|
|
TEXT_INPUT_SIZE [line 12]
TEXT_INPUT_SIZE_SHORT [line 14]
TEXT_INPUT_SIZE_SHORT = 30
|
|
Functions
adminPageNav [line 2334]
Parameters:
|
|
$pagenum: |
|
|
|
$totalpages: |
|
|
|
$adminpage: |
|
|
|
$parms: |
|
|
|
$tab: |
|
void adminPageNav(
$pagenum, $totalpages, $adminpage, $parms, [ $tab = '']
)
|
|
adminPrintImageThumb [line 205]
Print the thumbnail for a particular Image.
Parameters:
|
$bg |
3: |
|
|
$image |
$image: |
object The Image object whose thumbnail we want to display. |
|
$class |
$class: |
string Optional class attribute for the hyperlink. Default is NULL. |
|
$id |
$id: |
string Optional id attribute for the hyperlink. Default is NULL. |
Information Tags:
| Author: | Todd Papaioannou (lucky@luckyspin.org) |
| Since: | 1.0.0 |
void adminPrintImageThumb(
$image $image, [$class $class = NULL], [$id $id = NULL], $bg 3
)
|
|
admin_album_list [line 3979]
Returns an option list of administrators who can own albums or images
Parameters:
string admin_album_list(
string $owner
)
|
|
admin_securityChecks [line 3858]
Standard admin pages checks
Parameters:
|
bit |
$rights: |
|
|
string |
$return--where: |
to go after login |
|
|
$return: |
|
void admin_securityChecks(
bit $rights, $return, string $return--where
)
|
|
checked [line 431]
Parameters:
void checked(
$checked, $current
)
|
|
checkForUpdate [line 2295]
Searches the zenphoto.org home page for the current zenphoto download locates the version number of the download and compares it to the version we are running.
API Tags:
| Return: | If there is a more current version on the WEB, returns its version number otherwise returns FALSE |
Information Tags:
codeblocktabsJS [line 3832]
Codeblock tabs JavaScript code
commentReply [line 2568]
Takes a comment and makes the body of an email.
Parameters:
|
string |
$str: |
comment |
|
string |
$name: |
author |
|
string |
$albumtitle: |
album |
|
string |
$imagetitle: |
image |
string commentReply(
string $str, string $name, string $albumtitle, string $imagetitle
)
|
|
copyThemeDirectory [line 2661]
Copy a theme directory to create a new custom theme
Parameters:
|
$source |
$source: |
source directory |
|
$target |
$target: |
target directory |
|
|
$newname: |
|
API Tags:
| Return: | either true or an error message |
Information Tags:
bool|string copyThemeDirectory(
$source $source, $target $target, $newname
)
|
|
currentRelativeURL [line 2829]
Return URL of current admin page
Parameters:
|
string |
$source: |
the script file incase REQUEST_URI is not available |
API Tags:
Information Tags:
string currentRelativeURL(
string $source
)
|
|
customOptions [line 525]
Parameters:
|
|
$optionHandler: |
|
|
|
$indent: |
|
|
|
$album: |
|
|
|
$showhide: |
|
|
|
$supportedOptions: |
|
|
|
$theme: |
|
|
|
$initial: |
|
void customOptions(
$optionHandler, [ $indent = ""], [ $album = NULL], [ $showhide = false], [ $supportedOptions = NULL], [ $theme = false], [ $initial = 'none']
)
|
|
deleteThemeDirectory [line 2796]
Parameters:
void deleteThemeDirectory(
$source
)
|
|
displayDeleted [line 461]
genAlbumUploadList [line 436]
Parameters:
void genAlbumUploadList(
&$list, [ $curAlbum = NULL]
)
|
|
generateRadiobuttonsFromArray [line 854]
Prints radio buttons from an array
Parameters:
|
string |
$currentvalue: |
The current selected value |
|
string |
$list: |
the array of the list items form is localtext => buttonvalue |
|
string |
$option: |
the name of the option for the input field name |
|
bool |
$behind: |
set true to have the "text" before the button |
|
|
$class: |
|
void generateRadiobuttonsFromArray(
string $currentvalue, string $list, string $option, [bool $behind = false], [ $class = 'checkboxlabel']
)
|
|
generateUnorderedListFromArray [line 881]
Creates the body of an unordered list with checkbox label/input fields (scrollable sortables)
Parameters:
|
array |
$currentValue: |
list of items to be flagged as checked |
|
array |
$list: |
the elements of the select list |
|
string |
$prefix: |
prefix of the input item |
|
string |
$alterrights: |
are the items changable. |
|
bool |
$sort: |
true for sorted list |
|
string |
$class: |
optional class for items |
|
bool |
$localize: |
true if the list local key is text for the item |
|
|
$extra: |
|
void generateUnorderedListFromArray(
array $currentValue, array $list, string $prefix, string $alterrights, bool $sort, bool $localize, [string $class = NULL], [ $extra = NULL]
)
|
|
getAlbumBreadcrumbAdmin [line 2856]
Parameters:
void getAlbumBreadcrumbAdmin(
$album
)
|
|
getCheckboxState [line 3174]
Returns the value of a checkbox form item
Parameters:
|
string |
$id: |
the $_REQUEST index |
API Tags:
int getCheckboxState(
string $id
)
|
|
getLocaleForTinyMCEandAFM [line 3820]
Extracs the first two characters from the Zenphoto locale names like 'de_DE' so that TinyMCE and the Ajax File Manager who use two character locales like 'de' can set their language packs
string getLocaleForTinyMCEandAFM(
)
|
|
getMagickConstants [line 3939]
Returns Magick (Gmagick/Imagick) constants that begin with $filter and removes the constant of the form $filter . 'UNDEFINED' if it exists.
The returned array will be an associative array in which the keys and values are identical strings sorted in alphabetical order.
Parameters:
|
string |
$class: |
The class to reflect |
|
string |
$filter: |
The string to delimit constants |
array getMagickConstants(
string $class, string $filter
)
|
|
getNestedAlbumList [line 3314]
generates a nested list of albums for the album tab sorting
Returns an array of "albums" each element contains: 'name' which is the folder name 'album' which is an album object for the album 'sort_order' which is an array of the sort order set
Parameters:
|
$subalbum |
$subalbum: |
root level album (NULL is the gallery) |
|
$levels |
$levels: |
how far to nest |
|
$level |
$level: |
internal for keeping the sort order elements |
array getNestedAlbumList(
$subalbum $subalbum, $levels $levels, [$level $level = array()]
)
|
|
getParentAlbumsAdmin [line 2848]
Returns an array of the names of the parents of the current album.
Parameters:
|
object |
$album: |
optional album object to use inseted of the current album |
array getParentAlbumsAdmin(
object $album
)
|
|
getTagOrder [line 2494]
Returns the desired tagsort order (0 for alphabetic, 1 for most used)
getWatermarks [line 3195]
Returns a merged list of available watermarks
isolate [line 2583]
Extracts and returns a 'statement' from a PHP script for so that it may be 'evaled'
Parameters:
|
string |
$target: |
the assignment variable to match on |
|
string |
$str: |
the PHP script |
string isolate(
string $target, string $str
)
|
|
isTextFile [line 2632]
Check if a file is a text file
Parameters:
|
string |
$file: |
|
|
array |
$ok_extensions: |
array of file extensions that are OK to edit (ie text files) |
Information Tags:
bool isTextFile(
string $file, [array $ok_extensions = array('css','php','js','txt','inc')]
)
|
|
is_zip [line 2554]
Checks for a zip file
Parameters:
|
string |
$filename: |
name of the file |
bool is_zip(
string $filename
)
|
|
listDirectoryFiles [line 2601]
Return an array of files from a directory and sub directories
This is a non recursive function that digs through a directory. More info here:
Parameters:
Information Tags:
array listDirectoryFiles(
string $dir
)
|
|
minDiff [line 3910]
returns the shortest version of string2 that is different from string1
Parameters:
|
string |
$string1: |
|
|
string2 |
$string2: |
|
void minDiff(
string $string1, string2 $string2
)
|
|
postAlbumSort [line 3253]
POST handler for album tree sorts
Parameters:
|
int |
$parentid: |
id of owning album |
void postAlbumSort(
int $parentid
)
|
|
postIndexDecode [line 841]
Decodes encoded $_POST index
Parameters:
string postIndexDecode(
string $str
)
|
|
postIndexEncode [line 831]
Encodes for use as a $_POST index
Parameters:
void postIndexEncode(
string $str
)
|
|
printAdminFooter [line 23]
Print the footer <div> for the bottom of all admin pages.
Parameters:
|
string |
$addl: |
additional text to output on the footer. |
Information Tags:
| Author: | Todd Papaioannou (lucky@luckyspin.org) |
| Since: | 1.0.0 |
void printAdminFooter(
[string $addl = '']
)
|
|
printAdminHeader [line 72]
Print the header for all admin pages. Starts at <DOCTYPE> but does not include the </head> tag, in case there is a need to add something further.
Parameters:
|
string |
$tab: |
the album page |
|
string |
$subtab: |
the sub-tab if any |
void printAdminHeader(
string $tab, [string $subtab = NULL]
)
|
|
printAdminRightsTable [line 2900]
Outputs the rights checkbox table for admin
Parameters:
|
string |
$background: |
background color |
|
string |
$alterrights: |
are the items changable |
|
bit |
$rights: |
rights of the admin |
|
$id |
$id: |
int record id for the save |
void printAdminRightsTable(
$id $id, string $background, string $alterrights, bit $rights
)
|
|
printAlbumBreadcrumbAdmin [line 2870]
prints the album breadcrumb for the album edit page
Parameters:
|
object |
$album: |
Object of the album |
void printAlbumBreadcrumbAdmin(
object $album
)
|
|
printAlbumButtons [line 1815]
puts out the maintenance buttons for an album
Parameters:
|
object |
$album: |
is the album being emitted |
void printAlbumButtons(
object $album
)
|
|
printAlbumEditForm [line 1053]
emits the html for editing album information
called in edit album and mass edit
Parameters:
|
string |
$index: |
the index of the entry in mass edit or '0' if single album |
|
object |
$album: |
the album object |
|
bool |
$collapse_tags: |
set true to initially hide tab list |
Information Tags:
void printAlbumEditForm(
string $index, object $album, bool $collapse_tags
)
|
|
printAlbumEditRow [line 1893]
puts out a row in the edit album table
Parameters:
|
object |
$album: |
is the album being emitted |
|
bool |
$show_thumb: |
set to false to show thumb standin image rather than album thumb |
void printAlbumEditRow(
object $album, bool $show_thumb
)
|
|
printAlbumLedgend [line 1860]
void printAlbumLedgend(
)
|
|
printBulkActions [line 3501]
Edit tab bulk actions drop-down
Parameters:
|
array |
$checkarray: |
the list of actions |
|
bool |
$checkAll: |
set true to include check all box |
void printBulkActions(
array $checkarray, [bool $checkAll = false]
)
|
|
printEditDropdown [line 3407]
Prints the dropdown menu for the nesting level depth for the album sorting
Parameters:
void printEditDropdown(
$subtab, [ $nestinglevels = array('1','2','3','4','5')]
)
|
|
printLogoAndLinks [line 219]
Print the html required to display the ZP logo and links in the top section of the admin page.
Information Tags:
| Author: | Todd Papaioannou (lucky@luckyspin.org) |
| Since: | 1.0.0 |
void printLogoAndLinks(
)
|
|
printManagedObjects [line 2952]
Creates the managed album table for Admin
Parameters:
|
string |
$type: |
the kind of list |
|
array |
$objlist: |
list of objects |
|
string |
$alterrights: |
are the items changable |
|
int |
$adminid: |
ID of the admin |
|
int |
$prefix: |
the admin row |
|
bit |
$rights: |
the privileges of the user |
|
|
$kind: |
|
|
|
$flag: |
|
void printManagedObjects(
string $type, array $objlist, string $alterrights, int $adminid, int $prefix, bit $rights, $kind, $flag
)
|
|
printNestedAlbumsList [line 3346]
Prints the sortable nested albums list returns true if nesting levels exceede the database container
Parameters:
|
array |
$pages: |
The array containing all pages |
|
bool |
$show_thumb: |
set false to use thumb standin image. |
|
|
$albums: |
|
bool printNestedAlbumsList(
$albums, bool $show_thumb, array $pages
)
|
|
printSortableHead [line 159]
void printSortableHead(
)
|
|
printTabs [line 265]
Print the nav tabs for the admin section. We determine which tab should be highlighted from the $_GET['page']. If none is set, we default to "home".
Information Tags:
| Author: | Todd Papaioannou (lucky@luckyspin.org) |
| Since: | 1.0.0 |
print_language_string_list [line 2380]
Generates an editable list of language strings
Parameters:
|
string |
$dbstring: |
either a serialized languag string array or a single string |
|
string |
$name: |
the prefix for the label, id, and name tags |
|
bool |
$textbox: |
set to true for a textbox rather than a text field |
|
string |
$locale: |
optional locale of the translation desired |
|
string |
$edit: |
optional class |
|
int |
$wide: |
column size. true or false for the standard or short sizes. Or pass a column size |
|
string |
$ulclass: |
set to the class for the UL element |
|
int |
$rows: |
set to the number of rows to show. |
void print_language_string_list(
string $dbstring, string $name, [bool $textbox = false], [string $locale = NULL], [string $edit = ''], [int $wide = TEXT_INPUT_SIZE], [string $ulclass = 'language_string_list'], [int $rows = 6]
)
|
|
processAlbumBulkActions [line 3619]
Processes the check box bulk actions for albums
void processAlbumBulkActions(
)
|
|
processAlbumEdit [line 2107]
processes the post from the above
Parameters:
|
int |
$index: |
the index of the entry in mass edit or 0 if single album |
|
object |
$album: |
the album object |
|
string |
$redirectto: |
used to redirect page refresh on move/copy/rename |
|
|
&$redirectto: |
|
API Tags:
| Return: | error flag if passwords don't match |
Information Tags:
string processAlbumEdit(
int $index, object $album, &$redirectto, string $redirectto
)
|
|
processCommentBulkActions [line 3780]
Processes the check box bulk actions for comments
void processCommentBulkActions(
)
|
|
processCustomOptionSave [line 785]
Parameters:
|
|
$returntab: |
|
|
|
$themename: |
|
|
|
$themealbum: |
|
void processCustomOptionSave(
$returntab, [ $themename = NULL], [ $themealbum = NULL]
)
|
|
processEditSelection [line 3463]
Parameters:
void processEditSelection(
$subtab
)
|
|
processImageBulkActions [line 3700]
Handles Image bulk actions
Parameters:
void processImageBulkActions(
$album $album
)
|
|
processManagedObjects [line 3082]
Parameters:
void processManagedObjects(
$i, &$rights
)
|
|
processOrder [line 3223]
Processes the serialized array from tree sort.
Returns an array in the form [$id=>array(sort orders), $id=>array(sort orders),...]
Parameters:
|
$orderstr |
$orderstr: |
the serialzied tree sort order |
array processOrder(
$orderstr $orderstr
)
|
|
processRights [line 3058]
processes the post of administrator rights
Parameters:
|
int |
$i: |
the admin row number |
bit processRights(
int $i
)
|
|
process_language_string_save [line 2462]
process the post of a language string form
Parameters:
|
string |
$name: |
the prefix for the label, id, and name tags |
|
bool |
$cleanup: |
set to true to clean up after the TinyMCE editor |
|
$sanitize_level |
$sanitize_level: |
the type of sanitization required |
string process_language_string_save(
string $name, [$sanitize_level $sanitize_level = 3], bool $cleanup
)
|
|
removeParentAlbumNames [line 2880]
Removes the parent album name so that we can print a album breadcrumb with them
Parameters:
|
object |
$album: |
Object of the album |
string removeParentAlbumNames(
object $album
)
|
|
setAlbumSubtabs [line 391]
Parameters:
void setAlbumSubtabs(
$album
)
|
|
standardScripts [line 3184]
Returns an array of "standard" theme scripts. This list is normally used to exclude these scripts form various option seletors.
tagSelector [line 950]
Creates an unordered checklist of the tags
Parameters:
|
object |
$that: |
Object for which to get the tags |
|
string |
$postit: |
prefix to prepend for posting |
|
bool |
$showCounts: |
set to true to get tag count displayed |
|
|
$mostused: |
|
|
|
$addnew: |
|
|
|
$resizeable: |
|
void tagSelector(
object $that, string $postit, [bool $showCounts = false], [ $mostused = false], [ $addnew = true], [ $resizeable = false]
)
|
|
themeIsEditable [line 2646]
Check if a theme is editable (ie not a bundled theme)
Parameters:
|
$theme |
$theme: |
theme to check |
|
$themes |
$themes: |
array of installed themes (eg result of getThemes()) |
Information Tags:
bool themeIsEditable(
$theme $theme, $themes $themes
)
|
|
unQuote [line 3965]
Strips off quotes from the strng
Parameters:
void unQuote(
$string $string
)
|
|
unzip [line 2510]
Unzips an image archive
Parameters:
|
file |
$file: |
the archive |
|
string |
$dir: |
where the images go |
void unzip(
file $file, string $dir
)
|
|
XSRFdefender [line 3886]
Checks for Cross Site Request Forgeries
Parameters:
void XSRFdefender(
string $action
)
|
|
|
|