[ class tree: functions ] [ index: functions ] [ all elements ]

Procedural File: functions.php

Source Location: /functions.php

Page Details

basic functions used by zenphoto

Headers not sent yet!

Includes
require_once (dirname(__FILE__).'/functions-filter.php') [line 23]
[ Top ]

require_once (getPlugin('captcha/'.$_zp_captcha.'.php')) [line 28]
[ Top ]

require_once (dirname(__FILE__).'/auth_zp.php') [line 46]
[ Top ]

require_once (dirname(__FILE__).'/'.PLUGIN_FOLDER.'/zenpage/zenpage-template-functions.php') [line 1714]
[ Top ]

require_once (dirname(__FILE__).'/class-load.php') [line 45]
[ Top ]

require_once (dirname(__FILE__).'/functions-basic.php') [line 22]
[ Top ]

require_once (PHPScript('5.0.0','_functions.php')) [line 2073]
[ Top ]

require_once (dirname(__FILE__).'/lib-json.php') [line 19]
[ Top ]

require_once (dirname(__FILE__).'/functions-i18n.php') [line 32]
[ Top ]


Constants
COMMENT_BODY_REQUIRED  [line 705]

COMMENT_BODY_REQUIRED = 16

[ Top ]

COMMENT_EMAIL_REQUIRED  [line 701]

COMMENT_EMAIL_REQUIRED = 1

[ Top ]

COMMENT_NAME_REQUIRED  [line 702]

COMMENT_NAME_REQUIRED = 2

[ Top ]

COMMENT_SEND_EMAIL  [line 706]

COMMENT_SEND_EMAIL = 32

[ Top ]

COMMENT_WEB_REQUIRED  [line 703]

COMMENT_WEB_REQUIRED = 4

[ Top ]

USE_CAPTCHA  [line 704]

USE_CAPTCHA = 8

[ Top ]

ZENPAGE_NEWS  [line 49]

ZENPAGE_NEWS = getOption("zenpage_news_page")

[ Top ]

ZENPAGE_PAGES  [line 50]

ZENPAGE_PAGES = getOption("zenpage_pages_page")

[ Top ]

ZP_ALBUM  [line 1700]

ZP_ALBUM = 2

[ Top ]

ZP_ALBUM_LINKED  [line 1705]

ZP_ALBUM_LINKED = 64

[ Top ]

ZP_COMMENT  [line 1702]

ZP_COMMENT = 8

[ Top ]

ZP_IMAGE  [line 1701]

ZP_IMAGE = 4

[ Top ]

ZP_IMAGE_LINKED  [line 1706]

ZP_IMAGE_LINKED = 128

[ Top ]

ZP_INDEX  [line 1699]

ZP_INDEX = 1

***************************************


[ Top ]

ZP_SEARCH  [line 1703]

ZP_SEARCH = 16

[ Top ]

ZP_SEARCH_LINKED  [line 1704]

ZP_SEARCH_LINKED = 32

[ Top ]

ZP_ZENPAGE_NEWS_ARTICLE  [line 1707]

ZP_ZENPAGE_NEWS_ARTICLE = 256

[ Top ]

ZP_ZENPAGE_NEWS_CATEGORY  [line 1708]

ZP_ZENPAGE_NEWS_CATEGORY = 512

[ Top ]

ZP_ZENPAGE_NEWS_DATE  [line 1709]

ZP_ZENPAGE_NEWS_DATE = 1024

[ Top ]

ZP_ZENPAGE_PAGE  [line 1710]

ZP_ZENPAGE_PAGE = 2048

[ Top ]

ZP_ZENPAGE_SINGLE  [line 1711]

ZP_ZENPAGE_SINGLE = 4096

[ Top ]


Functions
addPluginScript  [line 1101]

Allows plugins to add to the scripts output by zenJavascript()

Parameters:
string   $script:  the text to be added.


void addPluginScript( string $script  )

[ Top ]
addPluginType  [line 1112]

Registers a plugin as handler for a file extension

Parameters:
string   $suffix:  the file extension
string   $objectName:  the name of the object that handles this extension


void addPluginType( string $suffix, string $objectName  )

[ Top ]
add_context  [line 1728]
Parameters:
   $context: 


void add_context( $context  )

[ Top ]
byteConvert  [line 1647]

Returns a byte size from a size value (eg: 100M).

Parameters:
int   $bytes: 


string byteConvert( int $bytes  )

[ Top ]
checkAlbumPassword  [line 461]

Checks to see access is allowed to an album Returns true if access is allowed.

There is no password dialog--you must have already had authorization via a cookie.

Parameters:
string   $albumname:  the album
string   &$hint:  becomes populated with the password hint.


bool checkAlbumPassword( string $albumname, string &$hint  )

[ Top ]
checkObjectsThumb  [line 176]

Search for a thumbnail for the image

Parameters:
string   $album:  folder path of the album
string   $image:  name of the target


string checkObjectsThumb( string $album, string $image  )

[ Top ]
commentsAllowed  [line 2005]

Returns true if all the right conditions are set to allow comments for the $type

Parameters:
string   $type:  Which comments


bool commentsAllowed( string $type  )

[ Top ]
dateTimeConvert  [line 1682]

Converts a datetime to connoical form

Parameters:
string   $datetime:  input date/time string
bool   $raw:  set to true to return the timestamp otherwise you get a string


mixed dateTimeConvert( string $datetime, [bool $raw = false]  )

[ Top ]
debug404  [line 2057]
Parameters:
   $album: 
   $image: 
   $theme: 


void debug404( $album, $image, $theme  )

[ Top ]
dircopy  [line 1615]

Copies a directory recursively

Parameters:
string   $srcdir:  the source directory.
string   $dstdir:  the destination directory.

API Tags:
Return:  total number of files copied.


the dircopy( string $srcdir, string $dstdir  )

[ Top ]
dirsize  [line 311]

Get the size of a directory.

From: http://aidan.dotgeek.org/lib/

Parameters:
string   $directory:  Path to directory

Information Tags:
Author:  Aidan Lister <aidan@php.net>
Version:  1.0.0

void dirsize( string $directory  )

[ Top ]
fetchComments  [line 632]

Gets an array of comments for the current admin

Parameters:
int   $number:  how many comments desired


array fetchComments( int $number  )

[ Top ]
galleryAlbumsPerPage  [line 1034]

Returns the number of album thumbs that go on a gallery page


int galleryAlbumsPerPage( )

[ Top ]
generateListFromArray  [line 1268]

Creates the body of a select list

Parameters:
array   $currentValue:  list of items to be flagged as checked
array   $list:  the elements of the select list
bool   $descending:  set true for a reverse order sort
   $localize: 


void generateListFromArray( array $currentValue, array $list, bool $descending, $localize  )

[ Top ]
generateListFromFiles  [line 1302]

Generates a selection list from files found on disk

Parameters:
strig   $currentValue:  the current value of the selector
string   $root:  directory path to search
string   $suffix:  suffix to select for
bool   $descending:  set true to get a reverse order sort


void generateListFromFiles( strig $currentValue, string $root, string $suffix, [bool $descending = false]  )

[ Top ]
getAllSubAlbumIDs  [line 924]

Returns an array of album ids whose parent is the folder

Parameters:
string   $albumfolder:  folder name if you want a album different >>from the current album


array getAllSubAlbumIDs( [string $albumfolder = '']  )

[ Top ]
getAllTagsCount  [line 1162]

Returns an array indexed by 'tag' with the element value the count of the tag


array getAllTagsCount( )

[ Top ]
getAllTagsUnique  [line 1140]

Returns an array of unique tag names


unknown getAllTagsUnique( )

[ Top ]
getEnabledPlugins  [line 609]

Returns an array of the currently enabled plugins


array getEnabledPlugins( )

[ Top ]
getManagedAlbumList  [line 902]

Populates and returns the $_zp_admin_album_list array


array getManagedAlbumList( )

[ Top ]
getNotViewableAlbums  [line 1387]

Returns a list of album IDs that the current viewer is allowed to see


array getNotViewableAlbums( )

[ Top ]
getPlugin  [line 579]

Returns the fully qualified "require" file name of the plugin file.

Parameters:
string   $plugin:  is the name of the plugin file, typically something.php
bool   $inTheme:  tells where to find the plugin. true means look in the current theme false means look in the zp-core/plugins folder.
   $path: 


string getPlugin( string $plugin, [bool $inTheme = false], [ $path = SERVERPATH]  )

[ Top ]
getPluginFiles  [line 536]

Returns a consolidated list of plugins The array structure is key=plugin name, value=plugin path

Parameters:
string   $pattern:  File system wildcard matching pattern to limit the search
string   $folder:  subfolder within the plugin folders to search
bool   $stripsuffix:  set to true to remove the suffix from the key name in the array


array getPluginFiles( string $pattern, [string $folder = ''], [bool $stripsuffix = true]  )

[ Top ]
getThemeOption  [line 1966]

Returns the value of a theme option

Parameters:
string   $option:  option key
object   $album: 
string   $default:  theme name


mixed getThemeOption( string $option, [object $album = NULL], [string $default = false]  )

[ Top ]
getUrAlbum  [line 219]

Returns the oldest ancestor of an alubm;

Parameters:
string   $album:  an album object


object getUrAlbum( string $album  )

[ Top ]
getUserIP  [line 2015]

Returns the viewer's IP address Deals with transparent proxies


string getUserIP( )

[ Top ]
get_context  [line 1717]

void get_context( )

[ Top ]
handleSearchParms  [line 945]

recovers search parameters from stored cookie, clears the cookie

Parameters:
string   $what:  the page type
string   $album:  Name of the album
string   $image:  Name of the image


void handleSearchParms( string $what, [string $album = NULL], [string $image = NULL]  )

[ Top ]
in_context  [line 1725]
Parameters:
   $context: 


void in_context( $context  )

[ Top ]
isImagePhoto  [line 1599]

Returns true if the image is a standard photo type

Parameters:
object   $image:  optional image object


bool isImagePhoto( [object $image = NULL]  )

[ Top ]
isImageVideo  [line 1584]

Returns video argument of the current Image.

Parameters:
object   $image:  optional image object


bool isImageVideo( [object $image = NULL]  )

[ Top ]
isValidURL  [line 1461]

Checks to see if a URL is valid

Parameters:
string   $url:  the URL being checked


bool isValidURL( string $url  )

[ Top ]
is_connected  [line 2047]

Returns true if there is an internet connection

Parameters:
string   $host:  optional host name to test


bool is_connected( [string $host = 'www.zenphoto.org']  )

[ Top ]
is_valid_email_zp  [line 345]

Determines if the input is an e-mail address. Adapted from WordPress.

Name changed to avoid conflicts in WP integrations.

Parameters:
string   $input_email:  email address?


bool is_valid_email_zp( string $input_email  )

[ Top ]
is_valid_image  [line 163]

Returns true if the file is an image

Parameters:
string   $filename:  the name of the target


bool is_valid_image( string $filename  )

[ Top ]
is_valid_other_type  [line 1123]

Returns true if the file is handled by a plugin object

Parameters:
string   $filename: 


bool is_valid_other_type( string $filename  )

[ Top ]
logTime  [line 1750]

Logs a time into the debug log

Parameters:
string   $tag:  log annotation


void logTime( string $tag  )

[ Top ]
lookupSortKey  [line 239]

Returns a sort field part for querying Note: $sorttype may be a comma separated list of field names. If so, these are peckmarked and returned otherwise unchanged.

Parameters:
string   $sorttype:  the 'Display" name of the sort
string   $default:  the default if $sorttype is empty
string   $filename:  the value to be used if $sorttype is 'Filename' since the field is different between the album table and the image table.


string lookupSortKey( string $sorttype, string $default, string $filename  )

[ Top ]
makeSpecialImageName  [line 1664]

Returns an i.php "image name" for an image not within the albums structure

Parameters:
string   $image:  Path to the image


string makeSpecialImageName( string $image  )

[ Top ]
myts_date  [line 285]

Simple mySQL timestamp formatting function.

Parameters:
string   $format:  formatting template
int   $mytimestamp:  timestamp


string myts_date( string $format, int $mytimestamp  )

[ Top ]
pageError  [line 1445]

Emits a page error. Used for attempts to bypass password protection

Parameters:
string   $err:  error code
string   $text:  error message


void pageError( string $err, string $text  )

[ Top ]
parseAllowedTags  [line 136]

parses the allowed HTML tags for use by htmLawed

Parameters:
string   &$source:  by name, contains the string with the tag options

API Tags:
Return:  the allowed_tags array.

Information Tags:
Since:  1.1.3

array parseAllowedTags( string &$source  )

[ Top ]
parseThemeDef  [line 1416]

Parses and sanitizes Theme definition text

Parameters:
file   $file:  theme file


string parseThemeDef( file $file  )

[ Top ]
postComment  [line 727]

Generic comment adding routine. Called by album objects or image objects to add comments.

Returns a comment object

Parameters:
string   $name:  Comment author name
string   $email:  Comment author email
string   $website:  Comment author website
string   $comment:  body of the comment
string   $code:  CAPTCHA code entered
string   $code_ok:  CAPTCHA md5 expected
string   $type:  'albums' if it is an album or 'images' if it is an image comment
object   $receiver:  the object (image or album) to which to post the comment
string   $ip:  the IP address of the comment poster
bool   $private:  set to true if the comment is for the admin only
bool   $anon:  set to true if the poster wishes to remain anonymous
bit   $check:  bitmask of which fields must be checked. If set overrides the options


object postComment( string $name, string $email, string $website, string $comment, string $code, string $code_ok, object $receiver, string $ip, bool $private, bool $anon, [bit $check = false], string $type  )

[ Top ]
printLargeFileContents  [line 516]

Processes a file for createAlbumZip

Parameters:
string   $dest:  the source [sic] to process


void printLargeFileContents( string $dest  )

[ Top ]
printLink  [line 1323]

General link printing function

Parameters:
string   $url:  The link URL
string   $text:  The text to go with the link
string   $title:  Text for the title tag
string   $class:  optional class
string   $id:  optional id


void printLink( string $url, string $text, [string $title = NULL], [string $class = NULL], [string $id = NULL]  )

[ Top ]
readTags  [line 1248]

Retrieves the tags for an album/image Returns them in an array

Parameters:
int   $id:  the record id of the album/image
string   $tbl:  'albums' or 'images'


unknown readTags( int $id, string $tbl  )

[ Top ]
rem_context  [line 1731]
Parameters:
   $context: 


void rem_context( $context  )

[ Top ]
restore_context  [line 1740]

void restore_context( )

[ Top ]
safe_fnmatch  [line 1506]

pattern match function Works with accented characters where the PHP one does not.

Parameters:
string   $pattern:  pattern
string   $string:  haystack


bool safe_fnmatch( string $pattern, string $string  )

[ Top ]
safe_glob  [line 1471]

Provide an alternative to glob which does not return filenames with accented charactes in them

Parameters:
string   $pattern:  the 'pattern' for matching files
bit   $flags:  glob 'flags'


void safe_glob( string $pattern, [bit $flags = 0]  )

[ Top ]
save_context  [line 1736]

void save_context( )

[ Top ]
seoFriendly  [line 2029]

Strips out and/or replaces characters from the string that are not "soe" friendly

Parameters:
string   $source: 


string seoFriendly( string $source  )

[ Top ]
setBoolThemeOption  [line 1949]

Sets value for a boolena theme option insures that the value is either zero or one

Parameters:
string   $key:  Option key
bool   $bool:  value to be set
object   $album:  album object
string   $default:  theme name


void setBoolThemeOption( string $key, bool $bool, [object $album = NULL], [string $default = false]  )

[ Top ]
setexifvars  [line 122]

initializes the $_zp_exifvars array display state


void setexifvars( )

[ Top ]
setThemeOption  [line 1891]

Set options local to theme and/or album

Parameters:
string   $key: 
string   $value: 
object   $album: 
bool   $default:  set to true for setting default theme options (does not set the option if it already exists)


void setThemeOption( string $key, string $value, [object $album = NULL], [bool $default = false]  )

[ Top ]
setThemeOptionDefault  [line 1929]

Used to set default values for theme specific options

Parameters:
string   $key: 
mixed   $value: 


void setThemeOptionDefault( string $key, mixed $value  )

[ Top ]
setupTheme  [line 1044]

Returns the theme folder If there is an album theme, loads the theme options.


string setupTheme( )

[ Top ]
set_context  [line 1721]
Parameters:
   $context: 


void set_context( $context  )

[ Top ]
sortByMultilingual  [line 435]

Sorts the results of a DB search by the current locale string for $field

Parameters:
array   $dbresult:  the result of the DB query
string   $field:  the field name to sort on
bool   $descending:  the direction of the sort

API Tags:
Return:  the sorted result


array sortByMultilingual( array $dbresult, string $field, bool $descending  )

[ Top ]
sortMultiArray  [line 1343]

multidimensional array column sort

Parameters:
array   $array:  The multidimensional array to be sorted
string   $index:  Which key should be sorted by
string   $order:  true for descending sorts
bool   $natsort:  If natural order should be used
bool   $case_sensitive:  If the sort should be case sensitive
   $descending: 

Information Tags:
Author:  redoc (http://codingforums.com/showthread.php?t=71904)

array sortMultiArray( array $array, string $index, [ $descending = false], [bool $natsort = true], [bool $case_sensitive = false], string $order  )

[ Top ]
storeTags  [line 1203]

Stores tags for an album/image

Parameters:
array   $tags:  the tag values
int   $id:  the record id of the album/image
string   $tbl:  'albums' or 'images'


void storeTags( array $tags, int $id, string $tbl  )

[ Top ]
truncate_string  [line 204]

Returns a truncated string

Parameters:
string   $string:  souirce string
int   $length:  how long it should be
string   $elipsis:  the text to tack on indicating shortening


string truncate_string( string $string, int $length, [string $elipsis = '...']  )

[ Top ]
zpFormattedDate  [line 265]

Returns a formated date for output

Parameters:
string   $format:  the "strftime" format string
date   $dt:  the date to be output


string zpFormattedDate( string $format, date $dt  )

[ Top ]
zp_getCookie  [line 1515]

Returns the value of a cookie from either the cookies or from $_SESSION[]

Parameters:
string   $name:  the name of the cookie


void zp_getCookie( string $name  )

[ Top ]
zp_handle_password  [line 1763]

checks password posting

Parameters:
string   $authType:  override of athorization type
   $check_auth: 
   $check_user: 


void zp_handle_password( [string $authType = NULL], [ $check_auth = NULL], [ $check_user = NULL]  )

[ Top ]
zp_image_types  [line 1568]

returns a list of comment record 'types' for "images"

Parameters:
string   $quote:  quotation mark to use


string zp_image_types( string $quote  )

[ Top ]
zp_mail  [line 370]

Send an mail to the mailing list. We also attempt to intercept any form injection attacks by slime ball spammers. Returns error message if send failure.

Parameters:
string   $subject:  The subject of the email.
string   $message:  The message contents of the email.
string   $from_mail:  Optional sender for the email.
string   $from_name:  Optional sender for the name.
array   $email_list:  a list of email addresses
   $cc_addresses: 

Information Tags:
Author:  Todd Papaioannou (lucky@luckyspin.org)
Since:  1.0.0

string zp_mail( string $subject, string $message, [array $email_list = null], [ $cc_addresses = NULL], string $from_mail, string $from_name  )

[ Top ]
zp_setCookie  [line 1546]

Sets a cookie both in the browser cookies and in $_SESSION[]

Parameters:
string   $name:  The 'cookie' name
string   $value:  The value to be stored
timestamp   $time:  The time the cookie expires
string   $path:  The path on the server in which the cookie will be available on
   $secure: 


void zp_setCookie( string $name, string $value, [timestamp $time = NULL], [string $path = NULL], [ $secure = false]  )

[ Top ]


Documentation generated on Fri, 28 May 2010 13:51:59 +0200 by phpDocumentor 1.4.1