Overview

Classes

  • _zp_captcha
  • _zp_HTML_cache
  • admin_approval
  • Album
  • AlbumBase
  • AlbumZip
  • AMFReader
  • AMFStream
  • AnyFile
  • AnyFile_Options
  • auto_backup
  • AVCSequenceParameterSetReader
  • bxslider
  • cacheManager
  • cachemanager_internal_deprecations
  • cacheManagerFeed
  • CI_jsmin
  • CI_load
  • cloneZenphoto
  • codeIgniter_kludge
  • colorbox
  • Combi
  • Comment
  • comment_form
  • contactformOptions
  • cookieConsent
  • crop_image
  • cycle
  • defaultCodeblocks
  • deprecated_functions
  • DownloadList
  • dynamic_locale
  • dynamicAlbum
  • elFinder
  • elFinder_options
  • elFinderConnector
  • elFinderEditor
  • elFinderEditorOnlineConvert
  • elFinderEditorZipArchive
  • elFinderEditorZohoOffice
  • elFinderLibGdBmp
  • elFinderPlugin
  • elFinderPluginAutoResize
  • elFinderPluginAutoRotate
  • elFinderPluginNormalizer
  • elFinderPluginSanitizer
  • elFinderPluginWatermark
  • elFinderSession
  • elFinderVolumeBox
  • elFinderVolumeDriver
  • elFinderVolumeDropbox
  • elFinderVolumeDropbox2
  • elFinderVolumeFlysystemGoogleDriveCache
  • elFinderVolumeFlysystemGoogleDriveNetmount
  • elFinderVolumeFTP
  • elFinderVolumeGoogleDrive
  • elFinderVolumeGroup
  • elFinderVolumeLocalFileSystem
  • elFinderVolumeMySQL
  • elFinderVolumeOneDrive
  • elFinderVolumeTrash
  • elFinderVolumeTrashMySQL
  • email_new_user
  • exampleMacros
  • external_auth
  • favorites
  • favoritesOptions
  • feed
  • fieldExtender
  • flag_thumbnail
  • Gallery
  • galleryArticles
  • getID3
  • getid3_aac
  • getid3_apetag
  • getid3_flv
  • getid3_handler
  • getid3_id3v1
  • getid3_id3v2
  • getid3_lib
  • getid3_lyrics3
  • getid3_mp3
  • getid3_mpeg
  • getid3_quicktime
  • getid3_swf
  • GoogleMap
  • Googlemaps
  • hitcounter
  • htmlmetatags
  • Image
  • internal_deprecations
  • ipBlocker
  • jPlayer
  • jplayer_options
  • jquery_rating
  • JSMin
  • lazyload
  • lib_GD_Options
  • lib_Imagick_Options
  • lib_NoGraphics
  • matomoStats
  • MediaObject
  • menu_manager
  • MergedRSS
  • MergedRSSOptions
  • mobile
  • Mobile_Detect
  • mobileTheme
  • multipleLayoutOptions
  • null_seo
  • OAuthConsumer
  • OAuthDataStore
  • OAuthRequest
  • OAuthServer
  • OAuthSignatureMethod
  • OAuthSignatureMethod_HMAC_SHA1
  • OAuthSignatureMethod_PLAINTEXT
  • OAuthSignatureMethod_RSA_SHA1
  • OAuthToken
  • OAuthUtil
  • openStreetMap
  • openStreetMapOptions
  • pagedThumbsNav
  • pagedthumbsOptions
  • PersistentObject
  • PHPMailer\PHPMailer\PHPMailer
  • PHPMailer\PHPMailer\POP3
  • PHPMailer\PHPMailer\SMTP
  • print_album_menu
  • pseudoPlayer
  • publishContent
  • quota_manager
  • reCaptcha
  • RecursiveCallbackFilterIterator
  • redirector
  • redirectorOptions
  • register_user
  • rewriteRules
  • rewriteTokens
  • RSS
  • rss_options
  • scriptlessSocialsharing
  • scriptlessSocialsharingOptions
  • search_statistics
  • SearchEngine
  • security_logger
  • securityHeaders
  • securityheadersOptions
  • seo_locale
  • Services_JSON
  • Services_JSON_Error
  • setup
  • setupMutex
  • setupRSS
  • show_not_loggedin
  • sitemap
  • sitemapOptions
  • static_html_cache
  • staticHTMLCacheOptions
  • tagsuggest
  • TextObject
  • TextObject_Options
  • ThemeObject
  • themeSwitcher
  • tinymce4Options
  • tinyURL
  • Transientimage
  • UploadHandler
  • user_expiry
  • user_groups
  • user_logout_options
  • userAddressFields
  • userDataExport
  • utf8
  • Video
  • VideoObject_Options
  • WEBdocs
  • WEBdocs_Options
  • xmpMetadata
  • Zenpage
  • Zenpage_internal_deprecations
  • ZenpageCategory
  • zenpagecms
  • ZenpageItems
  • ZenpageNews
  • ZenpagePage
  • ZenpageRoot
  • Zenphoto_Administrator
  • Zenphoto_Authority
  • zenphoto_org_news
  • zenphoto_seo
  • zenphotoDonate
  • ZipStream
  • zp_PHPMailer
  • zpFunctions
  • zpMutex
  • zpSimpleSpam
  • zpTrivialSpam

Interfaces

  • elFinderSessionInterface

Exceptions

  • elFinderAbortException
  • elFinderTriggerException
  • getid3_exception
  • JSMin_UnterminatedCommentException
  • JSMin_UnterminatedRegExpException
  • JSMin_UnterminatedStringException
  • OAuthExcept
  • PHPMailer\PHPMailer\Exception

Functions

  • access
  • accessAlbums
  • accessAllAlbums
  • accessImage
  • add_context
  • addalbumsToDatabase
  • addCategoriesToDatabase
  • addDateToTitlelink
  • addGeoCoord
  • addItem
  • addMissingDefaultRewriteTokens
  • addPagesToDatabase
  • addReconfigureNote
  • addSubalbumMenus
  • addWatermark
  • admin_album_list
  • admin_securityChecks
  • admin_showupdate
  • adminPageNav
  • adminToolbox
  • albumNumber
  • applyMacros
  • authorSelector
  • bind_textdomain_codeset
  • bindtextdomain
  • build_query
  • build_url
  • bulkActionRedirect
  • bulkTags
  • byteConvert
  • cacheImage
  • checkAccess
  • checkAlbumForImages
  • checkAlbumimagesort
  • checkAlbumParentid
  • checkAlbumPassword
  • checkChosenItemStatus
  • checkChosenMenuset
  • checked
  • checkFolder
  • checkForEmptyTitle
  • checkForGuest
  • checkForPage
  • checkForUpdate
  • checkHitcounterDisplay
  • checkIfChecked
  • checkIfLockedNews
  • checkIfLockedPage
  • checkIfNew
  • checkInstall
  • checkLayoutUseForImages
  • checkObjectsThumb
  • checkPageValidity
  • checkParentLayouts
  • checkPublishDates
  • checkRequiredField
  • checkSchedulePublishingNotes
  • checkSelectedAlbum
  • checkSignature
  • checkTitlelinkDuplicate
  • cleanAlbum
  • cleanHTML
  • clonedFrom
  • codeblocktabsJS
  • comment_form_addComment
  • comment_form_handle_comment
  • comment_form_PaginationJS
  • comment_form_postcomment
  • comment_form_print10Most
  • comment_form_visualEditor
  • commentFormUseCaptcha
  • commentReply
  • commentsAllowed
  • compressRow
  • consolidatedEditMessages
  • copyLayoutSelection
  • copyThemeDirectory
  • createMenuIfNotExists
  • createRelatedItemsResultArray
  • createTitlelink
  • cron_starter
  • curlRequest
  • currentRelativeURL
  • customOptions
  • dateDiff
  • datepickerJS
  • dateTimeConvert
  • db_affected_rows
  • db_close
  • db_collation
  • db_connect
  • db_count
  • db_create
  • db_create_table
  • db_error
  • db_fetch_assoc
  • db_fetch_row
  • db_free_result
  • db_getClientInfo
  • db_getServerInfo
  • db_getSQLmode
  • db_getVersion
  • db_insert_id
  • db_isMariaDB
  • db_LIKE_escape
  • db_list_fields
  • db_name
  • db_num_rows
  • db_permissions
  • db_quote
  • db_setSQLmode
  • db_show
  • db_software
  • db_table_update
  • db_truncate_table
  • debug404
  • debugLog
  • debugLogBacktrace
  • debuglogReconfigureNote
  • debugLogVar
  • decompressField
  • decompressRow
  • defaultCodeblocks_codebox
  • deleteArticle
  • deleteCategory
  • deleteItem
  • deleteLayoutSelection
  • deletePage
  • deleteThemeDirectory
  • dircopy
  • disableExtension
  • elFinder_admin_tabs
  • elFinder_tinymce
  • elFinderAutoloader
  • enableExtension
  • executeRSS
  • exitZP
  • exposeZenPhotoInformations
  • extendExecution
  • extensionEnabled
  • fetchComments
  • filesystemToInternal
  • fillbuffer
  • filterImageQuery
  • fix_path_redirect
  • formatList
  • fullText
  • galleryAlbumsPerPage
  • gallerystats_filesize_r
  • genAlbumList
  • generateAttributesFromArray
  • generateImageCacheFile
  • generateLanguageList
  • generateListFromArray
  • generateListFromFiles
  • generateRadiobuttonsFromArray
  • generateUnorderedListFromArray
  • get_AnyFile_suffixes
  • get_context
  • get_filterScript
  • get_instance
  • get_language_string
  • getAdminstratorsOptionsArray
  • getAdminThumb
  • getAdminThumbHTML
  • getAlbumArray
  • getAlbumBreadcrumb
  • getAlbumBreadcrumbAdmin
  • getAlbumCustomData
  • getAlbumData
  • getAlbumDate
  • getAlbumDesc
  • getAlbumFolder
  • getAlbumGeodata
  • getAlbumInherited
  • getAlbumLocation
  • getAlbumPage
  • getAlbumStatistic
  • getAlbumThumb
  • getAlbumTitle
  • getAlbumURL
  • getAllAccessibleAlbums
  • getAllAlbums
  • getAllDates
  • getAllowedTags
  • getAllSubAlbumIDs
  • getAllTagsCount
  • getAllTagsFromAlbum
  • getAllTagsFromAlbum_multi_unique
  • getAllTagsFromZenpage
  • getAllTagsUnique
  • getAllTranslations
  • getAnnotatedAlbumTitle
  • getAnnotatedImageTitle
  • getAnonymIP
  • getAuthor
  • getBare
  • getBareAlbumDesc
  • getBareAlbumTitle
  • getBareGalleryDesc
  • getBareGalleryTitle
  • getBareImageDesc
  • getBareImageTitle
  • getBareNewsTitle
  • getBarePageTitle
  • getCheckboxState
  • getCodeblock
  • getCommentAddress
  • getCommentAuthorEmail
  • getCommentAuthorLink
  • getCommentAuthorName
  • getCommentAuthorSite
  • getCommentBody
  • getCommentCount
  • getCommentDateTime
  • getCommentErrors
  • getCommentStored
  • getContactFormMacros
  • getContentShorten
  • getCookieInfoData
  • getCookieInfoHTML
  • getCookieInfoMacro
  • getCurrentMenuItem
  • getCurrentNewsArchive
  • getCurrentPage
  • getCurrentTheme
  • getCustomAlbumThumb
  • getCustomAlbumThumbMaxSpace
  • getCustomGalleryIndexPage
  • getCustomGalleryIndexURL
  • getCustomImageURL
  • getCustomPageURL
  • getCustomSizedImageMaxSpace
  • getCustomSizedImageThumbMaxSpace
  • getDataUsageNotice
  • getDefaultHeight
  • getDefaultRewriteTokens
  • getDefaultSizedImage
  • getDefaultWidth
  • getdownloadList
  • getDownloadURL
  • getE
  • getEnabledPlugins
  • getExpiryDatePost
  • getFavoritesURL
  • getField
  • getFullHeight
  • getFullImageFilesize
  • getFullImageURL
  • getFullWidth
  • getGalleryDesc
  • getGalleryIndexURL
  • getGalleryTitle
  • getGeoCoord
  • getHeadTitle
  • getHitcounter
  • getImageArgs
  • getImageCacheFilename
  • getImageCachePostfix
  • getImageCity
  • getImageCountry
  • getImageCustomData
  • getImageData
  • getImageDate
  • getImageDesc
  • getImageGeodata
  • getImageLocation
  • getImageMetaData
  • getImageParameters
  • getImageProcessorURI
  • getImageProcessorURIFromCacheName
  • getImageRotation
  • getImageState
  • getImageStatistic
  • getImageThumb
  • getImageTitle
  • getImageType
  • getImageURI
  • getImageURL
  • getItem
  • getItemByID
  • getItemTitleAndURL
  • getjPlayerSkinCSS
  • getjPlayerSkins
  • getLangAttributeLocale
  • getLanguageArray
  • getLanguageDisplayName
  • getLanguageFlag
  • getLanguageSubdomains
  • getLanguageText
  • getLatestComments
  • getLatestNews
  • getLatestZenpageComments
  • getLayout
  • getLayoutSelector
  • getLinkHTML
  • getLogTabs
  • getMacros
  • getMainSiteName
  • getMainSiteURL
  • getManagedAlbumList
  • getMaxSpaceContainer
  • getMenuFromLink
  • getMenuItemChilds
  • getMenuItems
  • getMenumanagerPredicessor
  • getMenumanagerSuccessor
  • getMenuSetSelector
  • getMenuVisibility
  • getMimeString
  • getNestedAlbumList
  • getNewsAdminOption
  • getNewsAdminOptionPath
  • getNewsArchivePath
  • getNewsArchiveURL
  • getNewsAuthor
  • getNewsCategories
  • getNewsCategoryCustomData
  • getNewsCategoryDesc
  • getNewsCategoryURL
  • getNewsContent
  • getNewsCustomData
  • getNewsDate
  • getNewsExtraContent
  • getNewsID
  • getNewsIndexURL
  • getNewsPagesStatistic
  • getNewsPathNav
  • getNewsReadMore
  • getNewsTitle
  • getNewsURL
  • getNextAlbum
  • getNextAlbumURL
  • getNextImageThumb
  • getNextImageURL
  • getNextNewsPageURL
  • getNextNewsURL
  • getNextPageURL
  • getNextPrevNews
  • getNotViewableAlbums
  • getNotViewableImages
  • getNumAlbums
  • getNumAllSubalbums
  • getNumImages
  • getNumNews
  • getNumPages
  • getOption
  • getOptionFromDB
  • getOptionList
  • getOwnerAuthor
  • getOwnerAuthorURL
  • getPageAuthor
  • getPageContent
  • getPageCustomData
  • getPageDate
  • getPageExtraContent
  • getPageID
  • getPageLastChangeDate
  • getPageNavList
  • getPageNumURL
  • getPageParentID
  • getPageRedirect
  • getPageSelector
  • getPageSortorder
  • getPageTitle
  • getPageTitleLink
  • getPageURL
  • getParentAlbums
  • getParentAlbumsAdmin
  • getParentBreadcrumb
  • getParentMenuItems
  • getPasswordProtectImage
  • getPHPFiles
  • getPictureOfTheDay
  • getPlugin
  • getPluginFiles
  • getPluginTabs
  • getPrevAlbum
  • getPrevAlbumURL
  • getPrevImageThumb
  • getPrevImageURL
  • getPrevNewsPageURL
  • getPrevNewsURL
  • getPrevPageURL
  • getProtectedImageURL
  • getRandomImages
  • getRandomImagesAlbum
  • getRating
  • getReconfigureNote
  • getRelatedItems
  • getRequestURI
  • getrow
  • getRSSLink
  • getRules
  • getSearchDate
  • getSearchURL
  • getSearchWords
  • getSelectedLayout
  • getSerializedArray
  • getSetClause
  • getSiteHomeURL
  • getSizeCustomImage
  • getSizeDefaultImage
  • getSizeDefaultThumb
  • getSizedImageURL
  • getSizeFullImage
  • getSortByOptions
  • getSortByStatusOptions
  • getStandardGalleryIndexURL
  • getSubtabs
  • getSuffix
  • getSystemLocales
  • getTagCountByAccess
  • getTagOrder
  • getTags
  • gettext
  • gettext_pl
  • gettext_th
  • getThemeFiles
  • getThemeOption
  • getTimezones
  • getTinyMCE4ConfigFiles
  • getTitle
  • getTotalHitcounter
  • getTotalImagesIn
  • getTotalNewsPages
  • getTotalPages
  • getUnprotectedImageURL
  • getUrAlbum
  • getUserIP
  • getUserLocale
  • getUserURL
  • getVersion
  • getWatermarkParam
  • getWatermarkPath
  • getWatermarks
  • getWhereClause
  • getXSRFToken
  • getZenpagePagesOptionsArray
  • getZenpageStatistic
  • handleSearchParms
  • hasDynamicAlbumSuffix
  • hasNextImage
  • hasNextNewsPage
  • hasNextPage
  • hasPrevImage
  • hasPrevNewsPage
  • hasPrevPage
  • hasPrimaryScripts
  • hl_attrval
  • hl_bal
  • hl_cmtcd
  • hl_ent
  • hl_prot
  • hl_regex
  • hl_spec
  • hl_tag
  • hl_tag2
  • hl_tidy
  • hl_version
  • html_decode
  • html_encode
  • html_encodeTagged
  • html_pathurlencode
  • htmLawed
  • httpsRedirect
  • httpUploadHandler
  • httpUploadHandler_admin_tabs
  • i18nSetLocale
  • ignoreSetupRunRequest
  • imageBlurGD
  • imagecreatefrombmp
  • imageDebug
  • imageError
  • imageNumber
  • imgSrcURI
  • in_context
  • installSignature
  • instrument
  • internalToFilesystem
  • inventMenuItem
  • iptc_make_tag
  • is_AdminEditPage
  • is_connected
  • is_News
  • is_NewsArchive
  • is_NewsArticle
  • is_NewsCategory
  • is_NewsPage
  • is_Pages
  • is_valid_email_zp
  • is_zip
  • isAlbumClass
  • isAlbumPage
  • isArchive
  • isCurrentitemParent
  • isHandledAlbum
  • isImageClass
  • isImagePage
  • isImagePhoto
  • isImageVideo
  • isIncompatibleExtension
  • isLandscape
  • isolate
  • isSetupProtected
  • isValidEmail
  • isValidURL
  • jQueryUpload_head
  • jQueryUpload_headers
  • jQueryUploadHandler
  • jQueryUploadHandler_admin_tabs
  • js_encode
  • json_decode
  • json_encode
  • kses
  • kses_array_lc
  • kses_attr
  • kses_bad_protocol
  • kses_bad_protocol_once
  • kses_bad_protocol_once2
  • kses_check_attr_val
  • kses_decode_entities
  • kses_hair
  • kses_hook
  • kses_html_error
  • kses_js_entities
  • kses_no_null
  • kses_normalize_entities
  • kses_normalize_entities2
  • kses_split
  • kses_split2
  • kses_stripslashes
  • kses_version
  • ksesProcess
  • layoutSelector
  • layoutSelector_album
  • listDBUses
  • listDirectoryFiles
  • listUses
  • load_zenpage_news
  • load_zenpage_pages
  • loadLocalOptions
  • log_message
  • lookupSortKey
  • macro_admin_tabs
  • macroList_show
  • makeAlbumCurrent
  • makeImageCurrent
  • makeSpecialImageName
  • markRelease_button
  • mb_strlen
  • mb_strpos
  • mb_strrpos
  • mb_strtolower
  • mb_strtoupper
  • mb_substr
  • mb_substr_count
  • menu_admin_toolbox_global
  • menu_tabs
  • minDiff
  • mkdir_recursive
  • myts_date
  • newAlbum
  • newImage
  • next_album
  • next_comment
  • next_image
  • next_news
  • next_page
  • ngettext
  • ngettext_pl
  • ngettext_th
  • omsAdditions
  • parse_query
  • parse_size
  • parseAllowedTags
  • parseHttpAcceptLanguage
  • pathurlencode
  • pluginDebug
  • populateManagedObjectsList
  • postAlbumSort
  • postIndexDecode
  • postIndexEncode
  • prefix
  • prepareAlbumPage
  • prepareCustomPage
  • prepareImagePage
  • prepareIndexPage
  • print404status
  • print_language_string_list
  • printAddToFavorites
  • printAdminFooter
  • printAdminHeader
  • printAdminRightsTable
  • printAdminThumb
  • printAlbumBreadcrumb
  • printAlbumButtons
  • printAlbumCustomData
  • printAlbumData
  • printAlbumDate
  • printAlbumDesc
  • printAlbumEditForm
  • printAlbumEditRow
  • printAlbumLegend
  • printAlbumLocation
  • printAlbumMenu
  • printAlbumMenuJump
  • printAlbumMenuList
  • printAlbumMenuListAlbum
  • printAlbumsSelector
  • printAlbumStatistic
  • printAlbumStatisticItem
  • printAlbumThumbImage
  • printAlbumTitle
  • printAlbumURL
  • printAllDates
  • printAllNestedList
  • printAllNewsCategories
  • printAllTags
  • printAllTagsAs
  • printAllTagsFromAlbum
  • printAllTagsFromZenpage
  • printAnnotatedAlbumTitle
  • printAnnotatedImageTitle
  • printArticleCategories
  • printArticleDatesDropdown
  • printArticlesPerPageDropdown
  • printAuthorDropdown
  • printBareAlbumDesc
  • printBareAlbumTitle
  • printBareGalleryDesc
  • printBareGalleryTitle
  • printBareImageDesc
  • printBareImageTitle
  • printBareNewsTitle
  • printBarePageTitle
  • printBarGraph
  • printBulkActions
  • printCategoriesStatistic
  • printCategoryCheckboxListEntry
  • printCategoryDropdown
  • printCategoryListSortableTable
  • printCategorySelection
  • printCodeblock
  • printCodeblockEdit
  • printCommentAuthorLink
  • printCommentErrors
  • printCommentForm
  • printContactForm
  • printContactFormMacro
  • printCookieInfo
  • printCopyrightNotice
  • printCurrentNewsArchive
  • printCurrentNewsCategory
  • printCustomAlbumThumbImage
  • printCustomAlbumThumbMaxSpace
  • printCustomMenu
  • printCustomPageSelector
  • printCustomPageURL
  • printCustomSizedImage
  • printCustomSizedImageMaxSpace
  • printCustomSizedImageThumbMaxSpace
  • printDataUsageNotice
  • printDefaultSizedImage
  • printDownloadAlbumZipURL
  • printdownloadList
  • printDownloadURL
  • printEditCommentLink
  • printEditDropdown
  • printExpired
  • printFavoritesURL
  • printFullAlbumsList
  • printFullImageDownloadURL
  • printGalleryDesc
  • printGalleryIndexURL
  • printGalleryTitle
  • printGoogleMap
  • printHeadTitle
  • printHomeLink
  • printImageCustomData
  • printImageData
  • printImageDate
  • printImageDesc
  • printImageMetadata
  • printImageslist
  • printImageStatistic
  • printImageThumb
  • printImageTitle
  • printImageURL
  • printItemEditLink
  • printItemsList
  • printItemsListTable
  • printItemStatusDropdown
  • printjPlayerPlaylist
  • printLangAttribute
  • printLanguageSelector
  • printLastChangeInfo
  • printLatestAlbums
  • printLatestComments
  • printLatestImages
  • printLatestImagesByDate
  • printLatestImagesByMtime
  • printLatestNews
  • printLatestUpdatedAlbums
  • printLinkHTML
  • printLogoAndLinks
  • printManagedObjects
  • printMenuemanagerPageList
  • printMenuemanagerPageListWithNav
  • printMenumanagerBreadcrumb
  • printMenumanagerNextLink
  • printMenumanagerPrevLink
  • printMostPopularItems
  • printMostRatedAlbums
  • printMostRatedImages
  • printMostRatedItems
  • printNestedAlbumsList
  • printNestedItemsList
  • printNestedMenu
  • printNews
  • printNewsArchive
  • printNewsArticlesList
  • printNewsAuthor
  • printNewsCategories
  • printNewsCategoryCustomData
  • printNewsCategoryDesc
  • printNewsCategoryURL
  • printNewsContent
  • printNewsCustomData
  • printNewsDate
  • printNewsExtraContent
  • printNewsIndexURL
  • printNewsPageList
  • printNewsPageListWithNav
  • printNewsStatistic
  • printNewsTitle
  • printNewsURL
  • printNextNewsLink
  • printNextNewsPageLink
  • printNextPageURL
  • printOpenStreetMap
  • printOwnerAuthor
  • printOwnerAuthorURL
  • printPageArticleTags
  • printPageAuthor
  • printPageContent
  • printPageCustomData
  • printPageDate
  • printPagedThumbsNav
  • printPageExtraContent
  • printPageID
  • printPageLastChangeDate
  • printPageList
  • printPageListWithNav
  • printPageMenu
  • printPageNav
  • printPageSelector
  • printPagesListTable
  • printPagesStatistic
  • printPageTitle
  • printPageTitleLink
  • printPageURL
  • printParentBreadcrumb
  • printPasswordForm
  • printPopularAlbums
  • printPopularImages
  • printPrevNewsLink
  • printPrevNewsPageLink
  • printPrevPageURL
  • printPrivacyPageLink
  • printPublished
  • printPublishIconLink
  • printPublishIconLinkGallery
  • printRandomImages
  • printRating
  • printReconfigureError
  • printReconfigureNote
  • printRegisterURL
  • printRegistrationForm
  • printRelatedItems
  • printRSSHeaderLink
  • printRSSLink
  • printScheduledPublishingNotes
  • printSearchBreadcrumb
  • printSearchForm
  • printSelectorWithCustomField
  • printSiteHomeURL
  • printSizedImageURL
  • printSlideShow
  • printSlideShowLink
  • printSortableHead
  • printSortOrderDropdown
  • printSubLevelAlbums
  • printSubPagesExcerpts
  • printSubtabs
  • printTabs
  • printTags
  • printThumbNav
  • printTinyPageNav
  • printTinyZenpageCategorySelector
  • printTopRatedAlbums
  • printTopRatedImages
  • printTopRatedItems
  • printUnpublishedDropdown
  • printUserLogin_out
  • printUserSelector
  • printUserURL
  • printVersion
  • printZenJavascripts
  • printZenpageIconLegend
  • printZenpageItems
  • printZenpageItemsBreadcrumb
  • printZenpageNewsCategorySelector
  • printZenpagePageSelector
  • printZenpagePagesSelector
  • printZenpageStatistic
  • printZenphotoLink
  • process_language_string_save
  • processAlbumBulkActions
  • processAlbumEdit
  • processCodeblockSave
  • processCommentBulkActions
  • processCredentials
  • processCustomOptionSave
  • processEditSelection
  • processExtensionVariable
  • processImageBulkActions
  • processImageEdit
  • processManagedObjects
  • processMenuBulkActions
  • processOrder
  • processRights
  • processTags
  • processZenpageBulkActions
  • propSizes
  • protectSetupFiles
  • publishItem
  • purgeOption
  • purgeThemeOption
  • query
  • query_full_array
  • query_single_row
  • rc4
  • read_exif_data_protected
  • readTags
  • reconfigureAction
  • reconfigureCSS
  • recordMissing
  • redirectionHandler
  • redirectURL
  • rem_context
  • removeDir
  • removeParentAlbumNames
  • removeTrailingSlash
  • renameOption
  • replaceOption
  • replaceThemeOption
  • restore_context
  • reveal
  • rewrite_get_album_image
  • rewrite_path
  • rewriteHandler
  • RSS_Channel
  • RSS_Retrieve
  • RSS_Tags
  • rulesList
  • safe_fnmatch
  • safe_glob
  • sanitize
  • sanitize_numeric
  • sanitize_path
  • sanitize_script
  • sanitize_string
  • sanitizeRedirect
  • save_context
  • saveLayoutSelection
  • saveZenphotoLayoutSelection
  • search_quote
  • secureServer
  • seo_cleanup_button
  • seoFriendly
  • seoFriendlyJS
  • set_context
  • setAlbumSubtabs
  • setexifvars
  • setMainDomain
  • setOption
  • setOptionDefault
  • setSiteState
  • setThemeColumns
  • setThemeOption
  • setThemeOptionDefault
  • setTinyZenpageLocale
  • setupCurrentLocale
  • setupDomain
  • setupTheme
  • shortenContent
  • shortentitle
  • showOrNotShowField
  • showZenphotoOptions
  • shuffle_assoc
  • signatureChange
  • site_upgrade_button
  • site_upgrade_status
  • skipScheduledPublishing
  • sortArray
  • sortByKey
  • sortByMultilingual
  • sortMultiArray
  • standardScripts
  • standardThemeOptions
  • stickyNews
  • storeConfig
  • storeTags
  • stripSuffix
  • submenuOf
  • switchLog
  • tagSelector
  • tagSuggestJS
  • tagSuggestJS_admin
  • tagSuggestJS_frontend
  • tagURLs
  • textdomain
  • themeIsEditable
  • themeSetup
  • tidyHTML
  • timezoneDiff
  • tinymce4ConfigJS
  • truncate_string
  • unprotectSetupFiles
  • unpublishedZenpageItemCheck
  • unpublishedZenphotoItemCheck
  • unpublishSubalbums
  • unQuote
  • unTagURLs
  • unzip
  • updateArticle
  • updateCacheName
  • updateCategory
  • updateConfigItem
  • updateImageProcessorLink
  • updateItemSortorder
  • updateItemsSortorder
  • updateMenuItem
  • updatePage
  • upload_extra
  • upload_form
  • upload_head
  • user_mailing_list_button
  • validateLocale
  • writeHeader
  • XSRFdefender
  • XSRFToken
  • zenpageAlbumImage
  • zenpageBulkActionMessage
  • zenpageJSCSS
  • zenpagePublish
  • zenphoto_PHPMailer
  • zenphoto_sendmail
  • zenPhotoTheme
  • zp_apply_filter
  • zp_clearCookie
  • zp_colorAllocate
  • zp_cookieEncode
  • zp_copyCanvas
  • zp_createImage
  • zp_drawRectangle
  • zp_error
  • zp_filter_slot
  • zp_filter_unique_id
  • zp_getCookie
  • zp_getFonts
  • zp_graphicsLibInfo
  • zp_handle_password
  • zp_handle_password_single
  • zp_has_filter
  • zp_image_types
  • zp_imageCanRotate
  • zp_imageColorTransparent
  • zp_imageDims
  • zp_imageFill
  • zp_imageFontHeight
  • zp_imageFontWidth
  • zp_imageFromString
  • zp_imageGet
  • zp_imageGray
  • zp_imageHeight
  • zp_imageIPTC
  • zp_imageKill
  • zp_imageLoadFont
  • zp_imageMerge
  • zp_imageOutput
  • zp_imageResizeAlpha
  • zp_imageResizeTransparent
  • zp_imageUnsharpMask
  • zp_imageWidth
  • zp_load_album
  • zp_load_gallery
  • zp_load_image
  • zp_load_page
  • zp_load_request
  • zp_load_search
  • zp_loggedin
  • zp_mail
  • zp_register_filter
  • zp_remove_filter
  • zp_resampleImage
  • zp_rotateImage
  • zp_session_destroy
  • zp_session_start
  • zp_setCookie
  • zp_writeString
  • zpErrorHandler
  • zpFormattedDate
  • zpRewriteURL
  • Overview
  • Class
  • Tree
  • Package
  • Deprecated
   1:    2:    3:    4:    5:    6:    7:    8:    9:   10:   11:   12:   13:   14:   15:   16:   17:   18:   19:   20:   21:   22:   23:   24:   25:   26:   27:   28:   29:   30:   31:   32:   33:   34:   35:   36:   37:   38:   39:   40:   41:   42:   43:   44:   45:   46:   47:   48:   49:   50:   51:   52:   53:   54:   55:   56:   57:   58:   59:   60:   61:   62:   63:   64:   65:   66:   67:   68:   69:   70:   71:   72:   73:   74:   75:   76:   77:   78:   79:   80:   81:   82:   83:   84:   85:   86:   87:   88:   89:   90:   91:   92:   93:   94:   95:   96:   97:   98:   99:  100:  101:  102:  103:  104:  105:  106:  107:  108:  109:  110:  111:  112:  113:  114:  115:  116:  117:  118:  119:  120:  121:  122:  123:  124:  125:  126:  127:  128:  129:  130:  131:  132:  133:  134:  135:  136:  137:  138:  139:  140:  141:  142:  143:  144:  145:  146:  147:  148:  149:  150:  151:  152:  153:  154:  155:  156:  157:  158:  159:  160:  161:  162:  163:  164:  165:  166:  167:  168:  169:  170:  171:  172:  173:  174:  175:  176:  177:  178:  179:  180:  181:  182:  183:  184:  185:  186:  187:  188:  189:  190:  191:  192:  193:  194:  195:  196:  197:  198:  199:  200:  201:  202:  203:  204:  205:  206:  207:  208:  209:  210:  211:  212:  213:  214:  215:  216:  217:  218:  219:  220:  221:  222:  223:  224:  225:  226:  227:  228:  229:  230:  231:  232:  233:  234:  235:  236:  237:  238:  239:  240:  241:  242:  243:  244:  245:  246:  247:  248:  249:  250:  251:  252:  253:  254:  255:  256:  257:  258:  259:  260:  261:  262:  263:  264:  265:  266:  267:  268:  269:  270:  271:  272:  273:  274:  275:  276:  277:  278:  279:  280:  281:  282:  283:  284:  285:  286:  287:  288:  289:  290:  291:  292:  293:  294:  295:  296:  297:  298:  299:  300:  301:  302:  303:  304:  305:  306:  307:  308:  309:  310:  311:  312:  313:  314:  315:  316:  317:  318:  319:  320:  321:  322:  323:  324:  325:  326:  327:  328:  329:  330:  331:  332:  333:  334:  335:  336:  337:  338:  339:  340:  341:  342:  343:  344:  345:  346:  347:  348:  349:  350:  351:  352:  353:  354:  355:  356:  357:  358:  359:  360:  361:  362:  363:  364:  365:  366:  367:  368:  369:  370:  371:  372:  373:  374:  375:  376:  377:  378:  379:  380:  381:  382:  383:  384:  385:  386:  387:  388:  389:  390:  391:  392:  393:  394:  395:  396:  397:  398:  399:  400:  401:  402:  403:  404:  405:  406:  407:  408:  409:  410:  411:  412:  413:  414:  415:  416:  417:  418:  419:  420:  421:  422:  423:  424:  425:  426:  427:  428:  429:  430:  431:  432:  433:  434:  435:  436:  437:  438:  439:  440:  441:  442:  443:  444:  445:  446:  447:  448:  449:  450:  451:  452:  453:  454:  455:  456:  457:  458:  459:  460:  461:  462:  463:  464:  465:  466:  467:  468:  469:  470:  471:  472:  473:  474:  475:  476:  477:  478:  479:  480:  481:  482:  483:  484:  485:  486:  487:  488:  489:  490:  491:  492:  493:  494:  495:  496:  497:  498:  499:  500:  501:  502:  503:  504:  505:  506:  507:  508:  509:  510:  511:  512:  513:  514:  515:  516:  517:  518:  519:  520:  521:  522:  523:  524:  525:  526:  527:  528:  529:  530:  531:  532:  533:  534:  535:  536:  537:  538:  539:  540:  541:  542:  543:  544:  545:  546:  547:  548:  549:  550:  551:  552:  553:  554:  555:  556:  557:  558:  559:  560:  561:  562:  563:  564:  565:  566:  567:  568:  569:  570:  571:  572:  573:  574:  575:  576:  577:  578:  579:  580:  581:  582:  583:  584:  585:  586:  587:  588:  589:  590:  591:  592:  593:  594:  595:  596:  597:  598:  599:  600:  601:  602:  603:  604:  605:  606:  607:  608:  609:  610:  611:  612:  613:  614:  615:  616:  617:  618:  619:  620:  621:  622:  623:  624:  625:  626:  627:  628:  629:  630:  631:  632:  633:  634:  635:  636:  637:  638:  639:  640:  641:  642:  643:  644:  645:  646:  647:  648:  649:  650:  651:  652:  653:  654:  655:  656:  657:  658:  659:  660:  661:  662:  663:  664:  665:  666:  667:  668:  669:  670:  671:  672:  673:  674:  675:  676:  677:  678:  679:  680:  681:  682:  683:  684:  685:  686:  687:  688:  689:  690:  691:  692:  693:  694:  695:  696:  697:  698:  699:  700:  701:  702:  703:  704:  705:  706:  707:  708:  709:  710:  711:  712:  713:  714:  715:  716:  717:  718:  719:  720:  721:  722:  723:  724:  725:  726:  727:  728:  729:  730:  731:  732:  733:  734:  735:  736:  737:  738:  739:  740:  741:  742:  743:  744:  745:  746:  747:  748:  749:  750:  751:  752:  753:  754:  755:  756:  757:  758:  759:  760:  761:  762:  763:  764:  765:  766:  767:  768:  769:  770:  771:  772:  773:  774:  775:  776:  777:  778:  779:  780:  781:  782:  783:  784:  785:  786:  787:  788:  789:  790:  791:  792:  793:  794:  795:  796:  797:  798:  799:  800:  801:  802:  803:  804:  805:  806:  807:  808:  809:  810:  811:  812:  813:  814:  815:  816:  817:  818:  819:  820:  821:  822:  823:  824:  825:  826:  827:  828:  829:  830:  831:  832:  833:  834:  835:  836:  837:  838:  839:  840:  841:  842:  843:  844:  845:  846:  847:  848:  849:  850:  851:  852:  853:  854:  855:  856:  857:  858:  859:  860:  861:  862:  863:  864:  865:  866:  867:  868:  869:  870:  871:  872:  873:  874:  875:  876:  877:  878:  879:  880:  881:  882:  883:  884:  885:  886:  887:  888:  889:  890:  891:  892:  893:  894:  895:  896:  897:  898:  899:  900:  901:  902:  903:  904:  905:  906:  907:  908:  909:  910:  911:  912:  913:  914:  915:  916:  917:  918:  919:  920:  921:  922:  923:  924:  925:  926:  927:  928:  929:  930:  931:  932:  933:  934:  935:  936:  937:  938:  939:  940:  941:  942:  943:  944:  945:  946:  947:  948:  949:  950:  951:  952:  953:  954:  955:  956:  957:  958:  959:  960:  961:  962:  963:  964:  965:  966:  967:  968:  969:  970:  971:  972:  973:  974:  975:  976:  977:  978:  979:  980:  981:  982:  983:  984:  985:  986:  987:  988:  989:  990:  991:  992:  993:  994:  995:  996:  997:  998:  999: 1000: 1001: 1002: 1003: 1004: 1005: 1006: 1007: 1008: 1009: 1010: 1011: 1012: 1013: 1014: 1015: 1016: 1017: 1018: 1019: 1020: 1021: 1022: 1023: 1024: 1025: 1026: 1027: 1028: 1029: 1030: 1031: 1032: 1033: 1034: 1035: 1036: 1037: 1038: 1039: 1040: 1041: 1042: 1043: 1044: 1045: 1046: 1047: 1048: 1049: 1050: 1051: 1052: 1053: 1054: 1055: 1056: 1057: 1058: 1059: 1060: 1061: 1062: 1063: 1064: 1065: 1066: 1067: 1068: 1069: 1070: 1071: 1072: 1073: 1074: 1075: 1076: 1077: 1078: 1079: 1080: 1081: 1082: 1083: 1084: 1085: 1086: 1087: 1088: 1089: 1090: 1091: 1092: 1093: 1094: 1095: 1096: 1097: 1098: 1099: 1100: 1101: 1102: 1103: 1104: 1105: 1106: 1107: 1108: 1109: 1110: 1111: 1112: 1113: 1114: 1115: 1116: 1117: 1118: 1119: 1120: 1121: 1122: 1123: 1124: 1125: 1126: 1127: 1128: 1129: 1130: 1131: 1132: 1133: 1134: 1135: 1136: 1137: 1138: 1139: 1140: 1141: 1142: 1143: 1144: 1145: 1146: 1147: 1148: 1149: 1150: 1151: 1152: 1153: 1154: 1155: 1156: 1157: 1158: 1159: 1160: 1161: 1162: 1163: 1164: 1165: 1166: 1167: 1168: 1169: 1170: 1171: 1172: 1173: 1174: 1175: 1176: 1177: 1178: 1179: 1180: 1181: 1182: 1183: 1184: 1185: 1186: 1187: 1188: 1189: 1190: 1191: 1192: 1193: 1194: 1195: 1196: 1197: 1198: 1199: 1200: 1201: 1202: 1203: 1204: 1205: 1206: 1207: 1208: 1209: 1210: 1211: 1212: 1213: 1214: 1215: 1216: 1217: 1218: 1219: 1220: 1221: 1222: 1223: 1224: 1225: 1226: 1227: 1228: 1229: 1230: 1231: 1232: 1233: 1234: 1235: 1236: 1237: 1238: 1239: 1240: 1241: 1242: 1243: 1244: 1245: 1246: 1247: 1248: 1249: 1250: 1251: 1252: 1253: 1254: 1255: 1256: 1257: 1258: 1259: 1260: 1261: 1262: 1263: 1264: 1265: 1266: 1267: 1268: 1269: 1270: 1271: 1272: 1273: 1274: 1275: 1276: 1277: 1278: 1279: 1280: 1281: 1282: 1283: 1284: 1285: 1286: 1287: 1288: 1289: 1290: 1291: 1292: 1293: 1294: 1295: 1296: 1297: 1298: 1299: 1300: 1301: 1302: 1303: 1304: 1305: 1306: 1307: 1308: 1309: 1310: 1311: 1312: 1313: 1314: 1315: 1316: 1317: 1318: 1319: 1320: 1321: 1322: 1323: 1324: 1325: 1326: 1327: 1328: 1329: 1330: 1331: 1332: 1333: 1334: 1335: 1336: 1337: 1338: 1339: 1340: 1341: 1342: 1343: 1344: 1345: 1346: 1347: 1348: 1349: 1350: 1351: 1352: 1353: 1354: 1355: 1356: 1357: 1358: 1359: 1360: 1361: 1362: 1363: 1364: 1365: 1366: 1367: 1368: 1369: 1370: 1371: 1372: 1373: 1374: 1375: 1376: 1377: 1378: 1379: 1380: 1381: 1382: 1383: 1384: 1385: 1386: 1387: 1388: 1389: 1390: 1391: 1392: 1393: 1394: 1395: 1396: 1397: 1398: 1399: 1400: 1401: 1402: 1403: 1404: 1405: 1406: 1407: 1408: 1409: 1410: 1411: 1412: 1413: 1414: 1415: 1416: 1417: 1418: 1419: 1420: 1421: 1422: 1423: 1424: 1425: 1426: 1427: 1428: 1429: 1430: 1431: 1432: 1433: 1434: 1435: 1436: 1437: 1438: 1439: 1440: 1441: 1442: 1443: 1444: 1445: 1446: 1447: 1448: 1449: 1450: 1451: 1452: 1453: 1454: 1455: 1456: 1457: 1458: 1459: 1460: 1461: 1462: 1463: 1464: 1465: 1466: 1467: 1468: 1469: 1470: 1471: 1472: 1473: 1474: 1475: 1476: 1477: 1478: 1479: 1480: 1481: 1482: 1483: 1484: 1485: 1486: 1487: 1488: 1489: 1490: 1491: 1492: 1493: 1494: 1495: 1496: 1497: 1498: 1499: 1500: 1501: 1502: 1503: 1504: 1505: 1506: 1507: 1508: 1509: 1510: 1511: 1512: 1513: 1514: 1515: 1516: 1517: 1518: 1519: 1520: 1521: 1522: 1523: 1524: 1525: 1526: 1527: 1528: 1529: 1530: 1531: 1532: 1533: 1534: 1535: 1536: 1537: 1538: 1539: 1540: 1541: 1542: 1543: 1544: 1545: 1546: 1547: 1548: 1549: 1550: 1551: 1552: 1553: 1554: 1555: 1556: 1557: 1558: 1559: 1560: 1561: 1562: 1563: 1564: 1565: 1566: 1567: 1568: 1569: 1570: 1571: 1572: 1573: 1574: 1575: 1576: 1577: 1578: 1579: 1580: 1581: 1582: 1583: 1584: 1585: 1586: 1587: 1588: 1589: 1590: 1591: 1592: 1593: 1594: 1595: 1596: 1597: 1598: 1599: 1600: 1601: 1602: 1603: 1604: 1605: 1606: 1607: 1608: 1609: 1610: 1611: 1612: 1613: 1614: 1615: 1616: 1617: 1618: 1619: 1620: 1621: 1622: 1623: 1624: 1625: 1626: 1627: 1628: 1629: 1630: 1631: 1632: 1633: 1634: 1635: 1636: 1637: 1638: 1639: 1640: 1641: 1642: 1643: 1644: 1645: 1646: 1647: 1648: 1649: 1650: 1651: 1652: 1653: 1654: 1655: 1656: 1657: 1658: 1659: 1660: 1661: 1662: 1663: 1664: 1665: 1666: 1667: 1668: 1669: 1670: 1671: 1672: 1673: 1674: 1675: 1676: 1677: 1678: 1679: 1680: 1681: 1682: 1683: 1684: 1685: 1686: 1687: 1688: 1689: 1690: 1691: 1692: 1693: 1694: 1695: 1696: 1697: 1698: 1699: 1700: 1701: 1702: 1703: 1704: 1705: 1706: 1707: 1708: 1709: 1710: 1711: 1712: 1713: 1714: 1715: 1716: 1717: 1718: 1719: 1720: 1721: 1722: 1723: 1724: 1725: 1726: 1727: 1728: 1729: 1730: 1731: 1732: 1733: 1734: 1735: 1736: 1737: 1738: 1739: 1740: 1741: 1742: 1743: 1744: 1745: 1746: 1747: 1748: 1749: 1750: 1751: 1752: 1753: 1754: 1755: 1756: 1757: 1758: 1759: 1760: 1761: 1762: 1763: 1764: 1765: 1766: 1767: 1768: 1769: 1770: 1771: 1772: 1773: 1774: 1775: 1776: 1777: 1778: 1779: 1780: 1781: 1782: 1783: 1784: 1785: 1786: 1787: 1788: 1789: 1790: 1791: 1792: 1793: 1794: 1795: 1796: 1797: 1798: 1799: 1800: 1801: 1802: 1803: 1804: 1805: 1806: 1807: 1808: 1809: 1810: 1811: 1812: 1813: 1814: 1815: 1816: 1817: 1818: 1819: 1820: 1821: 1822: 1823: 1824: 1825: 1826: 1827: 1828: 1829: 1830: 1831: 1832: 1833: 1834: 1835: 1836: 1837: 1838: 1839: 1840: 1841: 1842: 1843: 1844: 1845: 1846: 1847: 1848: 1849: 1850: 1851: 1852: 1853: 1854: 1855: 1856: 1857: 1858: 1859: 1860: 1861: 1862: 1863: 1864: 1865: 1866: 1867: 1868: 1869: 1870: 1871: 1872: 1873: 1874: 1875: 1876: 1877: 1878: 1879: 1880: 1881: 1882: 1883: 1884: 1885: 1886: 1887: 1888: 1889: 1890: 1891: 1892: 1893: 1894: 1895: 1896: 1897: 1898: 1899: 1900: 1901: 1902: 1903: 1904: 1905: 1906: 1907: 1908: 1909: 1910: 1911: 1912: 1913: 1914: 1915: 1916: 1917: 1918: 1919: 1920: 1921: 1922: 1923: 1924: 1925: 1926: 1927: 1928: 1929: 1930: 1931: 1932: 1933: 1934: 1935: 1936: 1937: 1938: 1939: 1940: 1941: 1942: 1943: 1944: 1945: 1946: 1947: 1948: 1949: 1950: 1951: 1952: 1953: 1954: 1955: 1956: 1957: 1958: 1959: 1960: 1961: 1962: 1963: 1964: 1965: 1966: 1967: 1968: 1969: 1970: 1971: 1972: 1973: 1974: 1975: 1976: 1977: 1978: 1979: 1980: 1981: 1982: 1983: 1984: 1985: 1986: 1987: 1988: 1989: 1990: 1991: 1992: 1993: 1994: 1995: 1996: 1997: 1998: 1999: 2000: 2001: 2002: 2003: 2004: 2005: 2006: 2007: 2008: 2009: 2010: 2011: 2012: 2013: 2014: 2015: 2016: 2017: 2018: 2019: 2020: 2021: 2022: 2023: 2024: 2025: 2026: 2027: 2028: 2029: 2030: 2031: 2032: 2033: 2034: 2035: 2036: 2037: 2038: 2039: 2040: 2041: 2042: 2043: 2044: 2045: 2046: 2047: 2048: 2049: 2050: 2051: 2052: 2053: 2054: 2055: 2056: 2057: 2058: 2059: 2060: 2061: 2062: 2063: 2064: 2065: 2066: 2067: 2068: 2069: 2070: 2071: 2072: 2073: 2074: 2075: 2076: 2077: 2078: 2079: 2080: 2081: 2082: 2083: 2084: 2085: 2086: 2087: 2088: 2089: 2090: 2091: 2092: 2093: 2094: 2095: 2096: 2097: 2098: 2099: 2100: 2101: 2102: 2103: 2104: 2105: 2106: 2107: 2108: 2109: 2110: 2111: 2112: 2113: 2114: 2115: 2116: 2117: 2118: 2119: 2120: 2121: 2122: 2123: 2124: 2125: 2126: 2127: 2128: 2129: 2130: 2131: 2132: 2133: 2134: 2135: 2136: 2137: 2138: 2139: 2140: 2141: 2142: 2143: 2144: 2145: 2146: 2147: 2148: 2149: 2150: 2151: 2152: 2153: 2154: 2155: 2156: 2157: 2158: 2159: 2160: 2161: 2162: 2163: 2164: 2165: 2166: 2167: 2168: 2169: 2170: 2171: 2172: 2173: 2174: 2175: 2176: 2177: 2178: 2179: 2180: 2181: 2182: 2183: 2184: 2185: 2186: 2187: 2188: 2189: 2190: 2191: 2192: 2193: 2194: 2195: 2196: 2197: 2198: 2199: 2200: 2201: 2202: 2203: 2204: 2205: 2206: 2207: 2208: 2209: 2210: 2211: 2212: 2213: 2214: 2215: 2216: 2217: 2218: 2219: 2220: 2221: 2222: 2223: 2224: 2225: 2226: 2227: 2228: 2229: 2230: 2231: 2232: 2233: 2234: 2235: 2236: 2237: 2238: 2239: 2240: 2241: 2242: 2243: 2244: 2245: 2246: 2247: 2248: 2249: 2250: 2251: 2252: 2253: 2254: 2255: 2256: 2257: 
<?php
/**
 * zenpage template functions
 *
 * @author Malte Müller (acrylian), Stephen Billard (sbillard)
 * @package plugins
 * @subpackage zenpage
 */
/* * ********************************************* */
/* ZENPAGE TEMPLATE FUNCTIONS
    /*********************************************** */


/* * ********************************************* */
/* General functions
    /*********************************************** */

/**
 * Checks if the current page is in news context.
 *
 * @return bool
 */
function is_News() {
    global $_zp_current_zenpage_news;
    return(!is_null($_zp_current_zenpage_news));
}

/**
 * Checks if the current page is the news page in general.
 *
 * @return bool
 */
function is_NewsPage() {
    global $_zp_gallery_page;
    return $_zp_gallery_page == 'news.php';
}

/**
 * Checks if the current page is a single news article page
 *
 * @return bool
 */
function is_NewsArticle() {
    return is_News() && in_context(ZP_ZENPAGE_SINGLE);
}

/**
 * Checks if the current page is a news category page
 *
 * @return bool
 */
function is_NewsCategory() {
    return in_context(ZP_ZENPAGE_NEWS_CATEGORY);
}

/**
 * Checks if the current page is a news archive page
 *
 * @return bool
 */
function is_NewsArchive() {
    return in_context(ZP_ZENPAGE_NEWS_DATE);
}

/**
 * Checks if the current page is a zenpage page
 *
 * @return bool
 */
function is_Pages() {
    return in_context(ZP_ZENPAGE_PAGE);
}

/**
 * returns the "sticky" value of the news article
 * @param obj $newsobj optional news object to check directly outside news context
 * @return bool
 */
function stickyNews($newsobj = NULL) {
    global $_zp_current_zenpage_news;
    if (is_null($newsobj)) {
        $newsobj = $_zp_current_zenpage_news;
    }
    return $newsobj->getSticky();

    return false;
}

/* * ********************************************* */
/* News article functions
    /*********************************************** */

/**
 * Gets the latest news either only news articles or with the latest images or albums
 *
 * NOTE: This function excludes articles that are password protected via a category for not logged in users!
 *
 * @param int $number The number of news items to get
 * @param string $category Optional news articles by category (only "none" option)
 * @param bool $sticky place sticky articles at the front of the list
 * @param string $sortdirection 'asc' ascending otherwise descending
 * @return array
 */
function getLatestNews($number = 2, $category = '', $sticky = true, $sortdirection = 'desc') {
    global $_zp_zenpage, $_zp_current_zenpage_news;
    $sortdir = strtolower($sortdirection) != 'asc';
    if (empty($category)) {
        $latest = $_zp_zenpage->getArticles($number, NULL, true, NULL, $sortdir, $sticky, NULL);
    } else {
        $catobj = new ZenpageCategory($category);
        $latest = $catobj->getArticles($number, NULL, true, NULL, $sortdir, $sticky);
    }
    return $latest;
}

/**
 * Prints the latest news either only news articles or with the latest images or albums as a unordered html list
 *
 * NOTE: Latest images and albums require the image_album_statistic plugin
 *
 * @param int $number The number of news items to get
 * @param string $category Optional news articles by category (only "none" option"
 * @param bool $showdate If the date should be shown
 * @param bool $showcontent If the content should be shown
 * @param int $contentlength The lengths of the content
 * @param bool $showcat If the categories should be shown
 * @param string $readmore Text for the read more link, if empty the option value for "zenpage_readmore" is used
 * @param bool $sticky place sticky articles at the front of the list
 * @return string
 */
function printLatestNews($number = 5, $category = '', $showdate = true, $showcontent = true, $contentlength = 70, $showcat = true, $readmore = NULL, $sticky = true) {
    global $_zp_gallery, $_zp_current_zenpage_news;
    $latest = getLatestNews($number, $category, $sticky);
    echo "\n<ul id=\"latestnews\">\n";
    $count = "";
    foreach ($latest as $item) {
        $count++;
        $category = "";
        $categories = "";

        $obj = new ZenpageNews($item['titlelink']);
        $title = html_encode($obj->getTitle());
        $link = html_encode(getNewsURL($item['titlelink']));
        $count2 = 0;
        $category = $obj->getCategories();
        foreach ($category as $cat) {
            $catobj = new ZenpageCategory($cat['titlelink']);
            $count2++;
            if ($count2 != 1) {
                $categories = $categories . ", ";
            }
            $categories = $categories . $catobj->getTitle();
        }
        $thumb = "";
        $content = $obj->getContent();
        if ($obj->getTruncation()) {
            $shorten = true;
        }
        $date = zpFormattedDate(DATE_FORMAT, strtotime($item['date']));
        echo "<li>";
        echo "<h3><a href=\"" . $link . "\" title=\"" . getBare(html_encode($title)) . "\">" . $title . "</a></h3>\n";
        if ($showdate) {
            echo "<span class=\"latestnews-date\">" . $date . "</span>\n";
        }
        if ($showcontent) {
            echo "<span class=\"latestnews-desc\">" . getContentShorten($content, $contentlength, '', $readmore, $link) . "</span>\n";
        }
        if ($showcat && !empty($categories)) {
            echo "<span class=\"latestnews-cats\">(" . html_encode($categories) . ")</span>\n";
        }
        echo "</li>\n";
        if ($count == $number) {
            break;
        }
    }
    echo "</ul>\n";
}

/**
 * Returns the number of news articles.
 *
 * When in search context this is the count of the articles found. Otherwise
 * it is the count of articles that match the criteria.
 *
 * @param bool $total
 * @return int
 */
function getNumNews($total = false) {
    global $_zp_zenpage, $_zp_current_zenpage_news, $_zp_current_zenpage_news_restore, $_zp_zenpage_articles, $_zp_gallery, $_zp_current_search;
    if ($total) {
        return count($_zp_zenpage->getArticles(0));
    } else if (in_context(ZP_SEARCH)) {
        return count($_zp_current_search->getArticles());
    } else {
        return count($_zp_zenpage->getArticles(0));
    }
}

/**
 * Returns the next news item on a page.
 * sets $_zp_current_zenpage_news to the next news item
 * Returns true if there is an new item to be shown
 *
 * @return bool
 */
function next_news() {
    global $_zp_zenpage, $_zp_current_zenpage_news, $_zp_current_zenpage_news_restore, $_zp_zenpage_articles, $_zp_current_category, $_zp_gallery, $_zp_current_search;
    if (is_null($_zp_zenpage_articles)) {
        if (in_context(ZP_SEARCH)) {
            //note: we do not know how to paginate the search page, so for now we will return all news articles
            $_zp_zenpage_articles = $_zp_current_search->getArticles(ZP_ARTICLES_PER_PAGE, NULL, true, NULL, NULL);
        } else {
            if (in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
                $_zp_zenpage_articles = $_zp_current_category->getArticles(ZP_ARTICLES_PER_PAGE, NULL, false, NULL, NULL);
            } else {
                $_zp_zenpage_articles = $_zp_zenpage->getArticles(ZP_ARTICLES_PER_PAGE, NULL, false, NULL, NULL);
            }
            if (empty($_zp_zenpage_articles)) {
                return NULL;
            }
        }
        $_zp_current_zenpage_news_restore = $_zp_current_zenpage_news;
    }
    if (!empty($_zp_zenpage_articles)) {
        $news = array_shift($_zp_zenpage_articles);
        if (is_array($news)) {
            add_context(ZP_ZENPAGE_NEWS_ARTICLE);
            $_zp_current_zenpage_news = new ZenpageNews($news['titlelink']);
            return true;
        }
    }

    $_zp_zenpage_articles = NULL;
    $_zp_current_zenpage_news = $_zp_current_zenpage_news_restore;
    rem_context(ZP_ZENPAGE_NEWS_ARTICLE);
    return false;
}

/**
 * Gets the id of a news article/item
 *
 * @return int
 */
function getNewsID() {
    global $_zp_current_zenpage_news;
    if (!is_null($_zp_current_zenpage_news)) {
        return $_zp_current_zenpage_news->getID();
    }
}

/**
 * Gets the news article title
 *
 * @return string
 */
function getNewsTitle() {
    global $_zp_current_zenpage_news;
    if (!is_null($_zp_current_zenpage_news)) {
        return $_zp_current_zenpage_news->getTitle();
    }
}

/**
 * prints the news article title
 *
 * @param string $before insert if you want to use for the breadcrumb navigation or in the html title tag
 */
function printNewsTitle($before = '') {
    if ($title = getNewsTitle()) {
        if ($before) {
            echo '<span class="beforetext">' . html_encode($before) . '</span>';
        }
        echo html_encode($title);
    }
}

/**
 * Returns the raw title of a news article.
 *
 *
 * @return string
 */
function getBareNewsTitle() {
    return getBare(getNewsTitle());
}

function printBareNewsTitle() {
    echo html_encode(getBareNewsTitle());
}

/**
 * Returns the link (url) of the current news article.
 * or of the titlelink passed if not empty
 *
 * @param string $titlelink
 * @return string
 */
function getNewsURL($titlelink = NULL) {
    global $_zp_current_zenpage_news;
    if (empty($titlelink)) {
        $obj = $_zp_current_zenpage_news;
    } else {
        $obj = new ZenpageNews($titlelink);
    }
    if (!is_null($obj))
        return $obj->getLink();
}

/**
 * Prints the title of a news article as a full html link
 *
 * @param string $before insert what you want to be show before the titlelink.
 */
function printNewsURL($before = '') {
    if (getNewsTitle()) {
        if ($before) {
            $before = '<span class="beforetext">' . html_encode($before) . '</span>';
        }
        echo "<a href=\"" . html_encode(getNewsURL()) . "\" title=\"" . getBareNewsTitle() . "\">" . $before . html_encodeTagged(getNewsTitle()) . "</a>";
    }
}

/**
 * Gets the content of a news article
 *
 * If using the CombiNews feature this returns the description for gallery items (see printNewsContent for more)
 *
 * @param int $shorten The optional length of the content for the news list for example, will override the plugin option setting if set, "" (empty) for full content (not used for image descriptions!)
 * @param string $shortenindicator The placeholder to mark the shortening (e.g."(...)"). If empty the Zenpage option for this is used.
 * @param string $readmore The text for the "read more" link. If empty the term set in Zenpage option is used.
 *
 * @return string
 */
function getNewsContent($shorten = false, $shortenindicator = NULL, $readmore = NULL) {
    global $_zp_current_image, $_zp_gallery, $_zp_current_zenpage_news, $_zp_page;
    if (!$_zp_current_zenpage_news->checkAccess()) {
        return '<p>' . gettext('<em>This entry belongs to a protected category.</em>') . '</p>';
    }
    $excerptbreak = false;
    if (!$shorten && !is_NewsArticle()) {
        $shorten = ZP_SHORTEN_LENGTH;
    }

    $articlecontent = $_zp_current_zenpage_news->getContent();
    if (!is_NewsArticle()) {
        if ($_zp_current_zenpage_news->getTruncation()) {
            $shorten = true;
        }
        $articlecontent = getContentShorten($articlecontent, $shorten, $shortenindicator, $readmore, $_zp_current_zenpage_news->getLink());
    }

    return $articlecontent;
}

/**
 * Prints the news article content. Note: TinyMCE used by Zenpage for news articles may already add a surrounding <p></p> to the content.
 *
 * If using the CombiNews feature this prints the thumbnail or sized image for a gallery item.
 * If using the 'CombiNews sized image' mode it shows movies directly and the description below.
 *
 * @param int $shorten $shorten The lengths of the content for the news main page for example (only for video/audio descriptions, not for normal image descriptions)
 * @param string $shortenindicator The placeholder to mark the shortening (e.g."(...)"). If empty the Zenpage option for this is used.
 * @param string $readmore The text for the "read more" link. If empty the term set in Zenpage option is used.
 */
function printNewsContent($shorten = false, $shortenindicator = NULL, $readmore = NULL) {
    global $_zp_current_zenpage_news;
    $content = zp_apply_filter('articlecontent_html', getNewsContent($shorten, $shortenindicator, $readmore), $_zp_current_zenpage_news);
    echo html_encodeTagged($content);
}

/**
 * Shorten the content of any type of item and add the shorten indicator and readmore link
 * set on the Zenpage plugin options. Helper function for getNewsContent() but usage of course not limited to that.
 * If there is nothing to shorten the content passed.
 *
 * The read more link is wrapped within <p class="readmorelink"></p>.
 *
 * @param string $text The text content to be shortenend.
 * @param mixed $shorten The lenght the content should be shortened. Set to true for shorten to pagebreak zero or false for no shortening
 * @param string $shortenindicator The placeholder to mark the shortening (e.g."(...)"). If empty the Zenpage option for this is used.
 * @param string $readmore The text for the "read more" link. If empty the term set in Zenpage option is used.
 * @param string $readmoreurl The url the read more link should point to
 */
function getContentShorten($text, $shorten, $shortenindicator = NULL, $readmore = NULL, $readmoreurl = NULL) {
    $readmorelink = '';
    if (is_null($shortenindicator)) {
        $shortenindicator = ZP_SHORTENINDICATOR;
    }
    if (is_null($readmore)) {
        $readmore = get_language_string(ZP_READ_MORE);
    }
    if (!is_null($readmoreurl)) {
        $readmorelink = '<p class="readmorelink"><a href="' . html_encode($readmoreurl) . '" title="' . html_encode($readmore) . '">' . html_encode($readmore) . '</a></p>';
    }

    if (!$shorten && !is_NewsArticle()) {
        $shorten = ZP_SHORTEN_LENGTH;
    }
    $contentlenght = mb_strlen($text);
    if (!empty($shorten) && ($contentlenght > (int) $shorten)) {
        if (stristr($text, '<!-- pagebreak -->')) {
            $array = explode('<!-- pagebreak -->', $text);
            $newtext = array_shift($array);
            while (!empty($array) && (mb_strlen($newtext) + mb_strlen($array[0])) < $shorten) { //  find the last break within shorten
                $newtext .= array_shift($array);
            }
            if ($shortenindicator && empty($array) || ($array[0] == '</p>' || trim($array[0]) == '')) { //  page break was at end of article
                $text = shortenContent($newtext, $shorten, '') . $readmorelink;
            } else {
                $text = shortenContent($newtext, $shorten, $shortenindicator, true) . $readmorelink;
            }
        } else {
            if (!is_bool($shorten)) {
                $newtext = shortenContent($text, $shorten, $shortenindicator);
                if ($newtext != $text) {
                    $text = $newtext . $readmorelink;
                }
            }
        }
    }
    return $text;
}

/**
 * Gets the extracontent of a news article if in single news articles view or returns FALSE
 *
 * @return string
 */
function getNewsExtraContent() {
    global $_zp_current_zenpage_news;
    if (is_News()) {
        $extracontent = $_zp_current_zenpage_news->getExtraContent();
        return $extracontent;
    } else {
        return FALSE;
    }
}

/**
 * Prints the extracontent of a news article if in single news articles view
 *
 * @return string
 */
function printNewsExtraContent() {
    echo getNewsExtraContent();
}

/**
 * Returns the text for the read more link for news articles or gallery items if in CombiNews mode
 *
 * @return string
 */
function getNewsReadMore() {
    global $_zp_current_zenpage_news;
    $readmore = get_language_string(ZP_READ_MORE);
    return $readmore;
}

/**
 * Gets the custom data field of the curent news article
 *
 * @return string
 */
function getNewsCustomData() {
    global $_zp_current_zenpage_news;
    if (!is_null($_zp_current_zenpage_news)) {
        return $_zp_current_zenpage_news->getCustomData();
    }
}

/**
 * Prints the custom data field of the curent news article
 *
 */
function printNewsCustomData() {
    echo getNewsCustomData();
}

/**
 * Prints the title of the currently selected news category
 *
 * @param string $before insert what you want to be show before it
 */
function printCurrentNewsCategory($before = '') {
    global $_zp_current_category;
    if (in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
        if ($before) {
            echo '<span class="beforetext">' . html_encode($before) . '</span>';
        }
        echo html_encode($_zp_current_category->getTitle());
    }
}

/**
 * Gets the description of the current news category
 *
 * @return string
 */
function getNewsCategoryDesc() {
    global $_zp_current_category;
    if (!is_null($_zp_current_category)) {
        return $_zp_current_category->getDesc();
    }
}

/**
 * Prints the description of the news category
 *
 */
function printNewsCategoryDesc() {
    global $_zp_current_category;
    $desc = zp_apply_filter('categorydesc_html', getNewsCategoryDesc(), $_zp_current_category);
    echo html_encodeTagged($desc);
}

/**
 * Gets the custom data field of the current news category
 *
 * @return string
 */
function getNewsCategoryCustomData() {
    global $_zp_current_category;
    if (!is_null($_zp_current_category)) {
        return $_zp_current_category->getCustomData();
    }
}

/**
 * Prints the custom data field of the news category
 *
 */
function printNewsCategoryCustomData() {
    echo getNewsCategoryCustomData();
}

/**
 * Gets the categories of the current news article
 *
 * @return array
 */
function getNewsCategories() {
    global $_zp_current_zenpage_news;
    if (!is_null($_zp_current_zenpage_news)) {
        $categories = $_zp_current_zenpage_news->getCategories();
        return $categories;
    }
    return false;
}

/**
 * Prints the categories of current article as a unordered html list
 *
 * @param string $separator A separator to be shown between the category names if you choose to style the list inline
 * @param string $class The CSS class for styling
 * @return string
 */
function printNewsCategories($separator = '', $before = '', $class = '') {
    $categories = getNewsCategories();
    $catcount = count($categories);
    if ($catcount != 0) {
        if ($before) {
            echo '<span class="beforetext">' . html_encode($before) . '</span>';
        }
        echo "<ul class=\"$class\">\n";
        $count = 0;
        if ($separator) {
            $separator = '<span class="betweentext">' . html_encode($separator) . '</span>';
        }
        foreach ($categories as $cat) {
            $count++;
            $catobj = new ZenpageCategory($cat['titlelink']);
            if ($count >= $catcount) {
                $separator = "";
            }
            echo "<li><a href=\"" . $catobj->getLink() . "\" title=\"" . html_encode($catobj->getTitle()) . "\">" . $catobj->getTitle() . '</a>' . $separator . "</li>\n";
        }
        echo "</ul>\n";
    }
}

/**
 * Gets the date of the current news article
 *
 * @return string
 */
function getNewsDate() {
    global $_zp_current_zenpage_news;
    if (!is_null($_zp_current_zenpage_news)) {
        $d = $_zp_current_zenpage_news->getDateTime();
        return zpFormattedDate(DATE_FORMAT, strtotime($d));
    }
    return false;
}

/**
 * Prints the date of the current news article
 *
 * @return string
 */
function printNewsDate() {
    echo html_encode(getNewsDate());
}

/**
 * Prints the monthy news archives sorted by year
 * NOTE: This does only include news articles.
 *
 * @param string $class optional class
 * @param string $yearclass optional class for "year"
 * @param string $monthclass optional class for "month"
 * @param string $activeclass optional class for the currently active archive
 * @param bool $yearsonly If set to true the archive only shows the years with total count (Default false)
 * @param string $order 'desc' (default) or 'asc' for descending or ascending
 */
function printNewsArchive($class = 'archive', $yearclass = 'year', $monthclass = 'month', $activeclass = "archive-active", $yearsonly = false, $order = 'desc') {
    global $_zp_zenpage;
    if (!empty($class)) {
        $class = "class=\"$class\"";
    }
    if (!empty($yearclass)) {
        $yearclass = "class=\"$yearclass\"";
    }
    if (!empty($monthclass)) {
        $monthclass = "class=\"$monthclass\"";
    }
    if (!empty($activeclass)) {
        $activeclass = "class=\"$activeclass\"";
    }
    $datecount = $_zp_zenpage->getAllArticleDates($yearsonly, $order);
    $lastyear = "";
    $nr = "";
    echo "\n<ul $class>\n";
    foreach($datecount as $key => $val) {
        $nr++;
        if ($key == '0000-00-01') {
            $year = "no date";
            $month = "";
        } else {
            $dt = strftime('%Y-%B', strtotime($key));
            $year = substr($dt, 0, 4);
            $month = substr($dt, 5);
        }
        if ($lastyear != $year) {
            $lastyear = $year;
            if (!$yearsonly) {
                if ($nr != 1) {
                    echo "</ul>\n</li>\n";
                }
                echo "<li $yearclass>$year\n<ul $monthclass>\n";
            }
        }
        if ($yearsonly) {
            $datetosearch = $key;
        } else {
            $datetosearch = strftime('%Y-%B', strtotime($key));
        }
        if (getCurrentNewsArchive('plain') == $datetosearch) {
            $active = $activeclass;
        } else {
            $active = "";
        }
        if ($yearsonly) {
            echo "<li $active><a href=\"" . html_encode(getNewsArchivePath($key, 1)) . "\" title=\"" . $key . " (" . $val . ")\" rel=\"nofollow\">$key ($val)</a></li>\n";
        } else {
            echo "<li $active><a href=\"" . html_encode(getNewsArchivePath(substr($key, 0, 7), 1)) . "\" title=\"" . $month . " (" . $val . ")\" rel=\"nofollow\">$month ($val)</a></li>\n";
        }
    }
    if ($yearsonly) {
        echo "</ul>\n";
    } else {
        echo "</ul>\n</li>\n</ul>\n";
    }
}

/**
 * Gets the current select news date (year-month) or formatted
 *
 * @param string $mode "formatted" for a formatted date or "plain" for the pure year-month (for example "2008-09") archive date
 * @param string $format If $mode="formatted" how the date should be printed (see PHP's strftime() function for the requirements)
 * @return string
 */
function getCurrentNewsArchive($mode = 'formatted', $format = '%B %Y') {
    global $_zp_post_date;
    if (in_context(ZP_ZENPAGE_NEWS_DATE)) {
        $archivedate = $_zp_post_date;
        if ($mode == "formatted") {
            $archivedate = strtotime($archivedate);
            $archivedate = strftime($format, $archivedate);
        }
        return $archivedate;
    }
    return false;
}

/**
 * Prints the current select news date (year-month) or formatted
 *
 * @param string $before What you want to print before the archive if using in a breadcrumb navigation for example
 * @param string $mode "formatted" for a formatted date or "plain" for the pure year-month (for example "2008-09") archive date
 * @param string $format If $mode="formatted" how the date should be printed (see PHP's strftime() function for the requirements)
 * @return string
 */
function printCurrentNewsArchive($before = '', $mode = 'formatted', $format = '%B %Y') {
    if ($date = getCurrentNewsArchive($mode, $format)) {
        if ($before) {
            echo '<span class="beforetext">' . html_encode($before) . '</span>';
        }
        echo html_encode($date);
    }
}

/**
 * Prints all news categories as a unordered html list
 *
 * @param string $newsindex How you want to call the link the main news page without a category, leave empty if you don't want to print it at all.
 * @param bool $counter TRUE or FALSE (default TRUE). If you want to show the number of articles behind the category name within brackets,
 * @param string $css_id The CSS id for the list
 * @param string $css_class_topactive The css class for the active menu item
 * @param bool $startlist set to true to output the UL tab
 * @param string $css_class CSS class of the sub level list(s)
 * @param string $css_class_active CSS class of the sub level list(s)
 * @param string $option The mode for the menu:
 *                                              "list" context sensitive toplevel plus sublevel pages,
 *                                              "list-top" only top level pages,
 *                                              "omit-top" only sub level pages
 *                                              "list-sub" lists only the current pages direct offspring
 * @param int $showsubs Set to depth of sublevels that should be shown always. 0 by default. To show all, set to a true! Only valid if option=="list".
 * @param int $limit truncation of display text
 * @return string
 */
function printAllNewsCategories($newsindex = 'All news', $counter = TRUE, $css_id = '', $css_class_topactive = '', $startlist = true, $css_class = '', $css_class_active = '', $option = 'list', $showsubs = false, $limit = NULL) {
    printNestedMenu($option, 'categories', $counter, $css_id, $css_class_topactive, $css_class, $css_class_active, $newsindex, $showsubs, $startlist, $limit);
}

/* * ********************************************* */
/* News article URL functions
    /*********************************************** */

/**
 * Returns the full path to a news category
 *
 * @param string $cat The category titlelink
 *
 * @return string
 */
function getNewsCategoryURL($cat = NULL) {
    global $_zp_zenpage, $_zp_current_category;
    if (empty($cat)) {
        $obj = $_zp_current_category->getTitlelink();
    } else {
        $obj = new ZenpageCategory($cat);
    }
    return $obj->getLink(1);
}

/**
 * Prints the full link to a news category
 *
 * @param string $before If you want to print text before the link
 * @param string $catlink The category link of a category
 *
 * @return string
 */
function printNewsCategoryURL($before = '', $catlink = '') {
    $catobj = new ZenpageCategory($catlink);
    echo "<a href=\"" . html_encode($catobj->getLink()) . "\" title=\"" . html_encode($catobj->getTitle()) . "\">";
    if ($before) {
        echo '<span class="beforetext">' . html_encode($before) . '</span>';
    }
    echo html_encode($catobj->getTitle()) . "</a>";
}

/**
 * Prints the full link of the news index page (news page 1 by default)
 *
 * @param string $name The linktext
 * @param string $before The text to appear before the link text
 * @param string $archive Name to print for the news date archive link
 * @param int $page Page number to append
 */
function printNewsIndexURL($name = NULL, $before = '', $archive = NULL, $page = '') {
    global $_zp_post_date;
    if ($_zp_post_date) {
        if (is_null($archive)) {
            $name = '<em>' . gettext('Archive') . '</em>';
        } else {
            $name = getBare(html_encode($archive));
        }
        $link = zp_apply_filter('getLink', rewrite_path(_ARCHIVE_ . '/', "/index.php?p=archive"), 'archive.php', NULL);
    } else {
        if (is_null($name)) {
            $name = gettext('News');
        } else {
            $name = getBare(html_encode($name));
        }
        $link = getNewsIndexURL($page);
    }
    if ($before) {
        echo '<span class="beforetext">' . html_encode($before) . '</span>';
    }
    echo "<a href=\"" . html_encode($link) . "\" title=\"" . getBare($name) . "\">" . $name . "</a>";
}

/**
 * Returns path of news date archive
 *
 * @return string
 */
function getNewsArchivePath($date, $page) {
    $rewrite = '/' . _NEWS_ARCHIVE_ . '/' . $date . '/';
    $plain = "/index.php?p=news&date=$date";
    if ($page > 1) {
        $rewrite .=  $page . '/';
        $plain .= "&page=$page";
    }
    return zp_apply_filter('getLink', rewrite_path($rewrite, $plain), 'archive.php', $page);
}

/* * ********************************************************* */
/* News index / category / date archive pagination functions
    /********************************************************** */

function getNewsPathNav($page) {
    global $_zp_current_category, $_zp_post_date;
    if (in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
        return $_zp_current_category->getLink($page);
    }
    if (in_context(ZP_ZENPAGE_NEWS_DATE)) {
        return getNewsArchivePath($_zp_post_date, $page);
    }
    $rewrite = '/' . _NEWS_ . '/';
    $plain = 'index.php?p=news';
    if ($page > 1) {
        $rewrite .= $page . '/';
        $plain .= '&page=' . $page;
    }
    return zp_apply_filter('getLink', rewrite_path($rewrite, $plain), 'news.php', $page);
}

/**
 * Returns true there is a previous news page
 * 
 * @global int $_zp_page
 * @return bool
 */
function hasPrevNewsPage() {
    global $_zp_page;
    return $_zp_page > 1;
}

/**
 * Returns the url to the previous news page
 *
 * @return string
 */
function getPrevNewsPageURL() {
    global $_zp_page;
    if (hasPrevNewsPage()) {
        return getNewsPathNav($_zp_page - 1);
    } 
    return false;
}

/**
 * Prints the link to the previous news page
 *
 * @param string $prev The linktext
 * @param string $class The CSS class for the disabled link
 *
 * @return string
 */
function printPrevNewsPageLink($prev = '« prev', $class = 'disabledlink') {
    global $_zp_zenpage, $_zp_page;
    if ($link = getPrevNewsPageURL()) {
        echo "<a href='" . html_encode($link) . "' title='" . gettext("Prev page") . " " . ($_zp_page - 1) . "' >" . html_encode($prev) . "</a>\n";
    } else {
        echo "<span class=\"$class\">" . html_encode($prev) . "</span>\n";
    }
}

/**
 * Returns true if there is a next news page
 * 
 * @global obj $_zp_zenpage
 * @global int $_zp_page
 * @return bool
 */
function hasNextNewsPage() {
    global $_zp_zenpage, $_zp_page;
    $total_pages = $_zp_zenpage->getTotalNewsPages();
    return $_zp_page < $total_pages;
}

/**
 * Returns the url to the next news page
 *
 * @return string
 */
function getNextNewsPageURL() {
    global $_zp_page;
    if (hasNextNewsPage()) {
        return getNewsPathNav($_zp_page + 1);
    }
    return false;
}

/**
 * Prints the link to the next news page
 *
 * @param string $next The linktext
 * @param string $class The CSS class for the disabled link
 *
 * @return string
 */
function printNextNewsPageLink($next = 'next »', $class = 'disabledlink') {
    global $_zp_page;
    if ($link = getNextNewsPageURL()) {
        echo "<a href='" . html_encode($link) . "' title='" . gettext("Next page") . " " . ($_zp_page + 1) . "'>" . html_encode($next) . "</a>\n";
    } else {
        echo "<span class=\"$class\">" . html_encode($next) . "</span>\n";
    }
}

/**
 * Prints the page number list for news page navigation
 *
 * @param string $class The CSS class for the disabled link
 *
 * @return string
 */
function printNewsPageList($class = 'pagelist') {
    printNewsPageListWithNav("", "", false, $class, true);
}

/**
 * Prints the full news page navigation with prev/next links and the page number list
 *
 * @param string $next The next page link text
 * @param string $prev The prev page link text
 * @param bool $nextprev If the prev/next links should be printed
 * @param string $class The CSS class for the disabled link
 * @param bool $firstlast Add links to the first and last pages of you gallery
 * @param int $navlen Number of navigation links to show (0 for all pages). Works best if the number is odd.
 *
 * @return string
 */
function printNewsPageListWithNav($next, $prev, $nextprev = true, $class = 'pagelist', $firstlast = true, $navlen = 9) {
    global $_zp_zenpage, $_zp_page;
    $total = ceil($_zp_zenpage->getTotalArticles() / ZP_ARTICLES_PER_PAGE);
    if ($total > 1) {
        if ($navlen == 0)
            $navlen = $total;
        $extralinks = 2;
        if ($firstlast)
            $extralinks = $extralinks + 2;
        $len = floor(($navlen - $extralinks) / 2);
        $j = max(round($extralinks / 2), min($_zp_page - $len - (2 - round($extralinks / 2)), $total - $navlen + $extralinks - 1));
        $ilim = min($total, max($navlen - round($extralinks / 2), $_zp_page + floor($len)));
        $k1 = round(($j - 2) / 2) + 1;
        $k2 = $total - round(($total - $ilim) / 2);
        echo "<ul class=\"$class\">\n";
        if ($nextprev) {
            echo "<li class=\"prev\">";
            printPrevNewsPageLink($prev);
            echo "</li>\n";
        }
        if ($firstlast) {
            echo '<li class = "' . ($_zp_page == 1 ? 'current' : 'first') . '">';
            if ($_zp_page == 1) {
                echo "1";
            } else {
                echo '<a href = "' . html_encode(getNewsPathNav(1)) . '" title = "' . gettext("Page") . ' 1">1</a>';
            }
            echo "</li>\n";
            if ($j > 2) {
                echo "<li>";
                $linktext = ($j - 1 > 2) ? '...' : $k1;
                echo '<a href = "' . html_encode(getNewsPathNav($k1)) . '" title = "' . sprintf(ngettext('Page %u', 'Page %u', $k1), $k1) . '">' . $linktext . '</a>';
                echo "</li>\n";
            }
        }
        for ($i = $j; $i <= $ilim; $i++) {
            echo "<li" . (($i == $_zp_page) ? " class=\"current\"" : "") . ">";
            if ($i == $_zp_page) {
                echo $i;
            } else {
                echo '<a href = "' . html_encode(getNewsPathNav($i)) . '" title = "' . sprintf(ngettext('Page %1$u', 'Page %1$u', $i), $i) . '">' . $i . '</a>';
            }
            echo "</li>\n";
        }
        if ($i < $total) {
            echo "<li>";
            $linktext = ($total - $i > 1) ? '...' : $k2;
            echo '<a href = "' . html_encode(getNewsPathNav($k2)) . '" title = "' . sprintf(ngettext('Page %u', 'Page %u', $k2), $k2) . '">' . $linktext . '</a>';
            echo "</li>\n";
        }
        if ($firstlast && $i <= $total) {
            echo "\n  <li class=\"last\">";
            if ($_zp_page == $total) {
                echo $total;
            } else {
                echo '<a href = "' . html_encode(getNewsPathNav($total)) . '" title = "' . sprintf(ngettext('Page {%u}', 'Page {%u}', $total), $total) . '">' . $total . '</a>';
            }
            echo "</li>\n";
        }
        if ($nextprev) {
            echo '<li class = "next">';
            printNextNewsPageLink($next);
            echo "</li>\n";
        }
        echo "</ul>\n";
    }
}

function getTotalNewsPages() {
    global $_zp_zenpage;
    return$_zp_zenpage->getTotalNewsPages();
}

/* * ********************************************************************* */
/* Single news article pagination functions (previous and next article)
    /*********************************************************************** */

/**
 * Returns the title and the titlelink of the next or previous article in single news article pagination as an array
 * Returns false if there is none (or option is empty)
 *
 * NOTE: This is not available if using the CombiNews feature
 *
 * @param string $option "prev" or "next"
 *
 * @return mixed
 */
function getNextPrevNews($option = '') {
    global $_zp_zenpage, $_zp_current_zenpage_news;
    if (!empty($option)) {
        switch ($option) {
            case "prev":
                if ($article = $_zp_current_zenpage_news->getPrevArticle()) {
                    return array("link" => $article->getLink(), "title" => $article->getTitle());
                }
                break;
            case "next":
                if ($article = $_zp_current_zenpage_news->getNextArticle()) {
                    return array("link" => $article->getLink(), "title" => $article->getTitle());
                }
                break;
        }
    }
    return false;
}

/**
 * Returns the title and the titlelink of the previous article in single news article pagination as an array
 * Returns false if there is none (or option is empty)
 *
 * NOTE: This is not available if using the CombiNews feature
 *
 * @return mixed
 */
function getPrevNewsURL() {
    return getNextPrevNews("prev");
}

/**
 * Returns the title and the titlelink of the next article in single news article pagination as an array
 * Returns false if there is none (or option is empty)
 *
 * NOTE: This is not available if using the CombiNews feature
 *
 * @return mixed
 */
function getNextNewsURL() {
    return getNextPrevNews("next");
}

/**
 * Prints the link of the next article in single news article pagination if available
 *
 * NOTE: This is not available if using the CombiNews feature
 *
 * @param string $next If you want to show something with the title of the article like a symbol
 * @return string
 */
function printNextNewsLink($next = " »") {
    $article_url = getNextPrevNews("next");
    if ($article_url && array_key_exists('link', $article_url) && $article_url['link'] != "") {
        echo "<a href=\"" . html_encode($article_url['link']) . "\" title=\"" . html_encode(getBare($article_url['title'])) . "\">" . $article_url['title'] . "</a> " . html_encode($next);
    }
}

/**
 * Prints the link of the previous article in single news article pagination if available
 *
 * NOTE: This is not available if using the CombiNews feature
 *
 * @param string $next If you want to show something with the title of the article like a symbol
 * @return string
 */
function printPrevNewsLink($prev = "« ") {
    $article_url = getNextPrevNews("prev");
    if ($article_url && array_key_exists('link', $article_url) && $article_url['link'] != "") {
        echo html_encode($prev) . " <a href=\"" . html_encode($article_url['link']) . "\" title=\"" . html_encode(getBare($article_url['title'])) . "\">" . $article_url['title'] . "</a>";
    }
}

/* * ******************************************************* */
/* Functions - shared by Pages and News articles
    /********************************************************* */

/**
 * Gets the statistic for pages, news articles or categories as an unordered list
 *
 * @param int $number The number of news items to get
 * @param string $option "all" pages, articles  and categories
 *                                           "news" for news articles
 *                                           "categories" for news categories
 *                                           "pages" for pages
 * @param string $mode "popular" most viewed for pages, news articles and categories
 *                                       "mostrated" for news articles and pages
 *                                       "toprated" for news articles and pages
 *                                       "random" for pages and news articles
 * @param boolean $sortdirection true for descending (default); false for ascending
 * @return array
 */
function getZenpageStatistic($number = 10, $option = "all", $mode = "popular", $sortdirection = true) {
    global $_zp_zenpage;
    switch (strtolower($sortdirection)) {
        case 'asc':
            $sortdirection = false;
            trigger_error(gettext('getZenpageStatistic - "asc" for the $sortdirection is deprecated since ZenphotoCMS 1.5.8. Use false instead.'), E_USER_NOTICE);
            break;
        case 'desc':
            trigger_error(gettext('getZenpageStatistic - "desc" for the $sortdirection is deprecated since ZenphotoCMS 1.5.8. Use true instead.'), E_USER_NOTICE);
            $sortdirection = true;
            break;
    }
    $statsarticles = array();
    $statscats = array();
    $statspages = array();
    if ($option == "all" || $option == "news") {
        $articles = $_zp_zenpage->getArticles($number, NULL, true, $mode, $sortdirection, false);
        $counter = "";
        $statsarticles = array();
        foreach ($articles as $article) {
            $counter++;
            $obj = new ZenpageNews($article['titlelink']);
            $statsarticles[$counter] = array(
                            "id"                     => $obj->getID(),
                            "title"              => $obj->getTitle(),
                            "titlelink"      => $article['titlelink'],
                            "hitcounter"     => $obj->getHitcounter(),
                            "total_votes"    => $obj->getTotal_votes(),
                            "rating"             => $obj->getRating(),
                            "content"            => $obj->getContent(),
                            "date"               => $obj->getDateTime(),
                            "type"               => "News"
            );
        }
        $stats = $statsarticles;
    }
    if (($option == "all" || $option == "categories") && $mode != "mostrated" && $mode != "toprated") {
        $categories = $_zp_zenpage->getAllCategories(true, $mode, $sortdirection);
        $counter = "";
        $statscats = array();
        foreach ($categories as $cat) {
            $counter++;
            $statscats[$counter] = array(
                            "id"                     => $cat['id'],
                            "title"              => html_encode(get_language_string($cat['title'])),
                            "titlelink"      => getNewsCategoryURL($cat['titlelink']),
                            "hitcounter"     => $cat['hitcounter'],
                            "total_votes"    => "",
                            "rating"             => "",
                            "content"            => '',
                            "date"               => '',
                            "type"               => "Category"
            );
        }
        $stats = $statscats;
    }
    if ($option == "all" || $option == "pages") {
        $pages = $_zp_zenpage->getPages(NULL, false, $number, $mode, $sortdirection);
        $counter = "";
        $statspages = array();
        foreach ($pages as $page) {
            $counter++;
            $pageobj = new ZenpagePage($page['titlelink']);
            $statspages[$counter] = array(
                            "id"                     => $pageobj->getID(),
                            "title"              => $pageobj->getTitle(),
                            "titlelink"      => $page['titlelink'],
                            "hitcounter"     => $pageobj->getHitcounter(),
                            "total_votes"    => $pageobj->get('total_votes'),
                            "rating"             => $pageobj->get('rating'),
                            "content"            => $pageobj->getContent(),
                            "date"               => $pageobj->getDateTime(),
                            "type"               => "Page"
            );
        }
        $stats = $statspages;
    }
    if ($option == "all") {
        $stats = array_merge($statsarticles, $statscats, $statspages);
        if ($mode == 'random') {
            shuffle($stats);
        } else {
            $stats = sortMultiArray($stats, $mode, $sortdir);
        }
    }
    return $stats;
}

/**
 * Prints the statistics Zenpage items as an unordered list
 *
 * @param int $number The number of news items to get
 * @param string $option "all" pages and articles
 *                                           "news" for news articles
 *                                           "pages" for pages
 * @param string $mode "popular" most viewed for pages, news articles and categories
 *                                       "mostrated" for news articles and pages
 *                                       "toprated" for news articles and pages
 *                                       "random" for pages, news articles and categories
 * @param bool $showstats if the value should be shown
 * @param bool $showtype if the type should be shown
 * @param bool $showdate if the date should be shown (news articles and pages only)
 * @param bool $showcontent if the content should be shown (news articles and pages only)
 * @param bool $contentlength The shortened lenght of the content
 * @param bool $sortdir True fro descending (default), false for ascending
 */
function printZenpageStatistic($number = 10, $option = "all", $mode = "popular", $showstats = true, $showtype = true, $showdate = true, $showcontent = true, $contentlength = 40, $sortdir = true) {
    $stats = getZenpageStatistic($number, $option, $mode, $sortdir);
    $contentlength = sanitize_numeric($contentlength);
    switch ($mode) {
        case 'popular':
            $cssid = "'zenpagemostpopular'";
            break;
        case 'mostrated':
            $cssid = "'zenpagemostrated'";
            break;
        case 'toprated':
            $cssid = "'zenpagetoprated'";
            break;
        case 'random':
            $cssid = "'zenpagerandom'";
            break;
    }
    echo "<ul id=$cssid>";
    foreach ($stats as $item) {
        switch ($mode) {
            case 'popular':
                $statsvalue = $item['hitcounter'];
                break;
            case 'mostrated':
                $statsvalue = $item['total_votes'];
                break;
            case 'toprated':
                $statsvalue = $item['rating'];
                break;
        }
        switch ($item['type']) {
            case 'Page':
                $titlelink = html_encode(getPageURL($item['titlelink']));
            case 'News':
                $titlelink = html_encode(getNewsURL($item['titlelink']));
                break;
            case 'Category':
                $titlelink = html_encode(getNewsCategoryURL($item['titlelink']));
                break;
        }
        echo '<li><a href = "' . $titlelink . '" title = "' . html_encode(getBare($item['title'])) . '"><h3>' . $item['title'];
        echo '<small>';
        if ($showtype) {
            echo ' [' . $item['type'] . ']';
        }
        if ($showstats && ($item['type'] != 'Category' && $mode != 'mostrated' && $mode != 'toprated')) {
            echo ' (' . $statsvalue . ')';
        }
        echo '</small>';
        echo '</h3></a>';
        if ($showdate && $item['type'] != 'Category') {
            echo "<p>" . zpFormattedDate(DATE_FORMAT, strtotime($item['date'])) . "</p>";
        }
        if ($showcontent && $item['type'] != 'Category') {
            echo '<p>' . truncate_string($item['content'], $contentlength) . '</p>';
        }
        echo '</li>';
    }
    echo '</ul>';
}

/**
 * Prints the most popular pages, news articles and categories as an unordered list
 *
 * @param int $number The number of news items to get
 * @param string $option "all" pages and articles
 *                                           "news" for news articles
 *                                           "pages" for pages
 * @param bool $showstats if the value should be shown
 * @param bool $showtype if the type should be shown
 * @param bool $showdate if the date should be shown (news articles and pages only)
 * @param bool $showcontent if the content should be shown (news articles and pages only)
 * @param bool $contentlength The shortened lenght of the content
 */
function printMostPopularItems($number = 10, $option = "all", $showstats = true, $showtype = true, $showdate = true, $showcontent = true, $contentlength = 40) {
    printZenpageStatistic($number, $option, "popular", $showstats, $showtype, $showdate, $showcontent, $contentlength);
}

/**
 * Prints the most rated pages and news articles as an unordered list
 *
 * @param int $number The number of news items to get
 * @param string $option "all" pages and articles
 *                                           "news" for news articles
 *                                           "pages" for pages
 * @param bool $showstats if the value should be shown
 * @param bool $showtype if the type should be shown
 * @param bool $showdate if the date should be shown (news articles and pages only)
 * @param bool $showcontent if the content should be shown (news articles and pages only)
 * @param bool $contentlength The shortened lenght of the content
 */
function printMostRatedItems($number = 10, $option = "all", $showstats = true, $showtype = true, $showdate = true, $showcontent = true, $contentlength = 40) {
    printZenpageStatistic($number, $option, "mostrated", $showstats, $showtype, $showdate, $showcontent, $contentlength);
}

/**
 * Prints the top rated pages and news articles as an unordered list
 *
 * @param int $number The number of news items to get
 * @param string $option "all" pages and articles
 *                                           "news" for news articles
 *                                           "pages" for pages
 * @param bool $showstats if the value should be shown
 * @param bool $showtype if the type should be shown
 * @param bool $showdate if the date should be shown (news articles and pages only)
 * @param bool $showcontent if the content should be shown (news articles and pages only)
 * @param bool $contentlength The shortened lenght of the content
 */
function printTopRatedItems($number = 10, $option = "all", $showstats = true, $showtype = true, $showdate = true, $showcontent = true, $contentlength = 40) {
    printZenpageStatistic($number, $option, "toprated", $showstats, $showtype, $showdate, $showcontent, $contentlength);
}

/**
 * Prints a context sensitive menu of all pages as a unordered html list
 *
 * @param string $option The mode for the menu:
 *                                              "list" context sensitive toplevel plus sublevel pages,
 *                                              "list-top" only top level pages,
 *                                              "omit-top" only sub level pages
 *                                              "list-sub" lists only the current pages direct offspring
 * @param string $mode 'pages' or 'categories'
 * @param bool $counter Only $mode = 'categories': Count the articles in each category
 * @param string $css_id CSS id of the top level list
 * @param string $css_class_topactive class of the active item in the top level list
 * @param string $css_class CSS class of the sub level list(s)
 * @param string $$css_class_active CSS class of the sub level list(s)
 * @param string $indexname insert the name (default "Gallery Index") how you want to call the link to the gallery index, insert "" (default) if you don't use it, it is not printed then.
 * @param int $showsubs Set to depth of sublevels that should be shown always. 0 by default. To show all, set to a true! Only valid if option=="list".
 * @param bool $startlist set to true to output the UL tab (false automatically if you use 'omit-top' or 'list-sub')
 * @param int $limit truncation limit display strings
 * @return string
 */
function printNestedMenu($option = 'list', $mode = NULL, $counter = TRUE, $css_id = NULL, $css_class_topactive = NULL, $css_class = NULL, $css_class_active = NULL, $indexname = NULL, $showsubs = 0, $startlist = true, $limit = NULL) {
    global $_zp_zenpage, $_zp_gallery_page, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_current_category;
    if (is_null($limit)) {
        $limit = MENU_TRUNCATE_STRING;
    }
    if($mode == 'allcategories') {
        $mode = 'categories';
    }
    if (is_null($css_id)) {
        switch ($mode) {
            case 'pages':
                $css_id = 'menu_pages';
                break;
            case 'categories':
                $css_id = 'menu_categories';
                break;
        }
    }
    if (is_null($css_class_topactive)) {
        $css_class_topactive = 'menu_topactive';
    }
    if (is_null($css_class)) {
        $css_class = 'submenu';
    }
    if (is_null($css_class_active)) {
        $css_class_active = 'menu-active';
    }
    if ($showsubs === true)
        $showsubs = 9999999999;
    switch ($mode) {
        case 'pages':
            $items = $_zp_zenpage->getPages();
            $currentitem_id = getPageID();
            if (is_object($_zp_current_zenpage_page)) {
                $currentitem_parentid = $_zp_current_zenpage_page->getParentID();
            } else {
                $currentitem_parentid = NULL;
            }
            $currentitem_sortorder = getPageSortorder();
            break;
        case 'categories':
            $items = $_zp_zenpage->getAllCategories();
            if (is_object($_zp_current_category) && $mode == 'categories') {
                $currentitem_sortorder = $_zp_current_category->getSortOrder();
                $currentitem_id = $_zp_current_category->getID();
                $currentitem_parentid = $_zp_current_category->getParentID();
            } else {
                $currentitem_sortorder = NULL;
                $currentitem_id = NULL;
                $currentitem_parentid = NULL;
            }
            break;
    }

    // don't highlight current pages or foldout if in search mode as next_page() sets page context
    if (in_context(ZP_SEARCH) && $mode == 'pages') { // categories are not searched
        $css_class_topactive = "";
        $css_class_active = "";
        rem_context(ZP_ZENPAGE_PAGE);
    }
    if (0 == count($items) + (int) ($mode == 'categories'))
        return; // nothing to do
    $startlist = $startlist && !($option == 'omit-top' || $option == 'list-sub');
    if ($startlist)
        echo '<ul id="' . $css_id . '">';
    // if index link and if if with count
    if (!empty($indexname)) {
        if ($limit) {
            $display = shortenContent($indexname, $limit, MENU_TRUNCATE_INDICATOR);
        } else {
            $display = $indexname;
        }
        switch ($mode) {
            case 'pages':
                if ($_zp_gallery_page == "index.php") {
                    echo '<li class="' . $css_class_topactive . '">' . html_encode($display) . '</li>';
                } else {
                    echo "<li><a href='" . html_encode(getGalleryIndexURL()) . "' title='" . html_encode($indexname) . "'>" . html_encode($display) . "</a></li>";
                }
                break;
            case 'categories':
                if (($_zp_gallery_page == "news.php") && !is_NewsCategory() && !is_NewsArchive() && !is_NewsArticle()) {
                    echo '<li class="' . $css_class_topactive . '">' . html_encode($display);
                } else {
                    echo "<li><a href=\"" . html_encode(getNewsIndexURL()) . "\" title=\"" . html_encode($indexname) . "\">" . html_encode($display) . "</a>";
                }
                if ($counter) {
                    if (in_context(ZP_ZENPAGE_NEWS_CATEGORY) && $mode == 'categories') {
                        $totalcount = count($_zp_current_category->getArticles(0));
                    } else {
                        save_context();
                        rem_context(ZP_ZENPAGE_NEWS_DATE);
                        $totalcount = count($_zp_zenpage->getArticles(0));
                        restore_context();
                    }
                    echo ' <span style="white-space:nowrap;"><small>(' . sprintf(ngettext('%u article', '%u articles', $totalcount), $totalcount) . ')</small></span>';
                }
                echo "</li>\n";
                break;
        }
    }
    $baseindent = max(1, count(explode("-", $currentitem_sortorder)));
    $indent = 1;
    $open = array($indent => 0);
    $parents = array(NULL);
    $order = explode('-', $currentitem_sortorder);
    $mylevel = count($order);
    $myparentsort = array_shift($order);
    for ($c = 0; $c <= $mylevel; $c++) {
        $parents[$c] = NULL;
    }
    foreach ($items as $item) {
        $password_class = '';
        switch ($mode) {
            case 'pages':
                $catcount = 1; //   so page items all show.
                $pageobj = new ZenpagePage($item['titlelink']);
                $itemtitle = $pageobj->getTitle();
                $itemsortorder = $pageobj->getSortOrder();
                $itemid = $pageobj->getID();
                $itemparentid = $pageobj->getParentID();
                $itemtitlelink = $pageobj->getTitlelink();
                $itemurl = $pageobj->getLink();
                $count = '';
                if ($pageobj->isProtected()) {
                    $password_class = ' has_password';
                }
                break;
            case 'categories':
                $catobj = new ZenpageCategory($item['titlelink']);
                $itemtitle = $catobj->getTitle();
                $itemsortorder = $catobj->getSortOrder();
                $itemid = $catobj->getID();
                $itemparentid = $catobj->getParentID();
                $itemtitlelink = $catobj->getTitlelink();
                $itemurl = $catobj->getLink();
                $catcount = count($catobj->getArticles());
                if ($counter) {
                    $count = ' <span style="white-space:nowrap;"><small>(' . sprintf(ngettext('%u article', '%u articles', $catcount), $catcount) . ')</small></span>';
                } else {
                    $count = '';
                }
                if ($catobj->isProtected()) {
                    $password_class = ' has_password';
                }
                break;
        }
        if ($catcount) {
            $level = max(1, count(explode('-', $itemsortorder)));
            $process = (($level <= $showsubs && $option == "list") // user wants all the pages whose level is <= to the parameter
                            || ($option == 'list' || $option == 'list-top') && $level == 1 // show the top level
                            || (($option == 'list' || ($option == 'omit-top' && $level > 1)) && (($itemid == $currentitem_id) // current page
                            || ($itemparentid == $currentitem_id) // offspring of current page
                            || ($level < $mylevel && $level > 1 && (strpos($itemsortorder, $myparentsort) === 0) )// direct ancestor
                            || (($level == $mylevel) && ($currentitem_parentid == $itemparentid)) // sibling
                            )
                            ) || ($option == 'list-sub' && ($itemparentid == $currentitem_id) // offspring of the current page
                            )
                            );

            if ($process) {
                if ($level > $indent) {
                    echo "\n" . str_pad("\t", $indent, "\t") . '<ul class="' . $css_class . '">'."\n";
                    $indent++;
                    $parents[$indent] = NULL;
                    $open[$indent] = 0;
                } else if ($level < $indent) {
                    $parents[$indent] = NULL;
                    while ($indent > $level) {
                        if ($open[$indent]) {
                            $open[$indent] --;
                            echo "</li>\n";
                        }
                        $indent--;
                        echo str_pad("\t", $indent, "\t") . "</ul>\n";
                    }
                } else { // level == indent, have not changed
                    if ($open[$indent]) { // level = indent
                        echo str_pad("\t", $indent, "\t") . "</li>\n";
                        $open[$indent] --;
                    } else {
                        echo "\n";
                    }
                }
                if ($open[$indent]) { // close an open LI if it exists
                    echo "</li>\n";
                    $open[$indent] --;
                }
                echo str_pad("\t", $indent - 1, "\t");
                $open[$indent] ++;
                $parents[$indent] = $itemid;
                if ($level == 1) { // top level
                    $class = $css_class_topactive . $password_class;
                } else {
                    $class = $css_class_active . $password_class;
                }
                if (!is_null($_zp_current_zenpage_page)) {
                    $gettitle = $_zp_current_zenpage_page->getTitle();
                    $getname = $_zp_current_zenpage_page->getTitlelink();
                } else if (!is_null($_zp_current_category)) {
                    $gettitle = $_zp_current_category->getTitle();
                    $getname = $_zp_current_category->getTitlelink();
                } else {
                    $gettitle = '';
                    $getname = '';
                }
                $current = "";
                if ($itemtitlelink == $getname && !in_context(ZP_SEARCH)) {
                    switch ($mode) {
                        case 'pages':
                            if ($_zp_gallery_page == 'pages.php') {
                                $current = $class;
                            }
                            break;
                        case 'categories':
                            if ($_zp_gallery_page == 'news.php') {
                                $current = $class;
                            }
                            break;
                    }
                }
                if(empty($current)) {
                    $current =  trim($password_class);
                }
                if ($limit) {
                    $itemtitle = shortenContent($itemtitle, $limit, MENU_TRUNCATE_INDICATOR);
                }
                echo '<li class="' . $current. '"><a href="' . html_encode($itemurl) . '" title="' . html_encode(getBare($itemtitle)) . '">' . html_encode($itemtitle) . '</a>' . $count;
            }
        }
    }
    // cleanup any hanging list elements
    while ($indent > 1) {
        if ($open[$indent]) {
            echo "</li>\n";
            $open[$indent] --;
        }
        $indent--;
        echo str_pad("\t", $indent, "\t") . "</ul>";
    }
    if ($open[$indent]) {
        echo "</li>\n";
        $open[$indent] --;
    } else {
        echo "\n";
    }
    if ($startlist)
        echo "</ul>\n";
}

/**
 * Prints the parent items breadcrumb navigation for pages or categories
 *
 * @param string $before Text to place before the breadcrumb item
 * @param string $after Text to place after the breadcrumb item
 */
function printZenpageItemsBreadcrumb($before = NULL, $after = NULL) {
    global $_zp_current_zenpage_page, $_zp_current_zenpage_news, $_zp_current_category;
    if (is_NewsPage()) {
        $page = '';
        if (is_NewsArticle()) {
            $page = $_zp_current_zenpage_news->getNewsLoopPage();
        }
        $archive = '';
        if(is_NewsArchive()) {
            $archive = null;
        }
        printNewsIndexURL(NULL, '', $archive, $page);
    }
    if (is_Pages() || is_NewsCategory()) {
        $parentitems = array();
        if (is_Pages()) {
            $parentitems = $_zp_current_zenpage_page->getParents();
        }
        if (is_NewsCategory()) {
            $parentitems = $_zp_current_category->getParents();
        }
        foreach ($parentitems as $item) {
            if (is_Pages()) {
                $pageobj = new ZenpagePage($item);
                $parentitemurl = html_encode($pageobj->getLink());
                $parentitemtitle = $pageobj->getTitle();
            }
            if (is_NewsCategory()) {
                $catobj = new ZenpageCategory($item);
                $parentitemurl = $catobj->getLink();
                $parentitemtitle = $catobj->getTitle();
            }
            if ($before) {
                echo '<span class="beforetext">' . html_encode($before) . '</span>';
            }
            echo"<a href='" . $parentitemurl . "'>" . html_encode($parentitemtitle) . "</a>";
            if ($after) {
                echo '<span class="aftertext">' . html_encode($after) . '</span>';
            }
        }
    }
}

/* * ********************************************* */
/* Pages functions
    /*********************************************** */
$_zp_zenpage_pagelist = NULL;

/**
 * Returns a count of the pages
 *
 * If in search context, the count is the number of items found.
 * If in a page context, the count is the number of sub-pages of the current page.
 * Otherwise it is the total number of pages.
 *
 * @param bool $total return the count of all pages
 *
 * @return int
 */
function getNumPages($total = false) {
    global $_zp_zenpage, $_zp_zenpage_pagelist, $_zp_current_search, $_zp_current_zenpage_page;
    $addquery = '';
    if (!$total) {
        if (in_context(ZP_SEARCH)) {
            $_zp_zenpage_pagelist = $_zp_current_search->getPages();
            return count($_zp_zenpage_pagelist);
        } else if (in_context(ZP_ZENPAGE_PAGE)) {
            if (!zp_loggedin(ADMIN_RIGHTS | ZENPAGE_PAGES_RIGHTS)) {
                $addquery = ' AND `show` = 1';
            }
            return db_count('pages', 'WHERE parentid=' . $_zp_current_zenpage_page->getID() . $addquery);
        }
    }
    if (!zp_loggedin(ADMIN_RIGHTS | ZENPAGE_PAGES_RIGHTS)) {
        $addquery = ' WHERE `show` = 1';
    }
    return db_count('pages', $addquery);
}

/**
 * Returns pages from the current page object/search/or parent pages based on context
 * Updates $_zp_zenpage_curent_page and returns true if there is another page to be delivered
 * @return boolean
 */
function next_page() {
    global $_zp_zenpage, $_zp_next_pagelist, $_zp_current_search, $_zp_current_zenpage_page, $_zp_current_page_restore;
    if (is_null($_zp_next_pagelist)) {
        if (in_context(ZP_SEARCH)) {
            $_zp_next_pagelist = $_zp_current_search->getPages(NULL, false, NULL, NULL, NULL);
        } else if (in_context(ZP_ZENPAGE_PAGE)) {
            if (!is_null($_zp_current_zenpage_page)) {
                $_zp_next_pagelist = $_zp_current_zenpage_page->getPages(NULL, false, NULL, NULL, NULL);
            }
        } else {
            $_zp_next_pagelist = $_zp_zenpage->getPages(NULL, true, NULL, NULL, NULL);
        }
        save_context();
        add_context(ZP_ZENPAGE_PAGE);
        $_zp_current_page_restore = $_zp_current_zenpage_page;
    }
    while (!empty($_zp_next_pagelist)) {
        $page = new ZenpagePage(array_shift($_zp_next_pagelist));
        if ((zp_loggedin() && $page->isMyItem(LIST_RIGHTS)) || $page->checkForGuest()) {
            $_zp_current_zenpage_page = $page;
            return true;
        }
    }
    $_zp_next_pagelist = NULL;
    $_zp_current_zenpage_page = $_zp_current_page_restore;
    restore_context();
    return false;
}

/**
 * Returns title of a page
 *
 * @return string
 */
function getPageTitle() {
    global $_zp_current_zenpage_page;
    if (!is_null($_zp_current_zenpage_page)) {
        return $_zp_current_zenpage_page->getTitle();
    }
}

/**
 * Prints the title of a page
 *
 * @return string
 */
function printPageTitle($before = NULL) {
    if ($title = getPageTitle()) {
        if ($before) {
            echo '<span class="beforetext">' . html_encode($before) . '</span>';
        }
        echo html_encode($title);
    }
}

/**
 * Returns the raw title of a page.
 *
 * @return string
 */
function getBarePageTitle() {
    return getBare(getPageTitle());
}

/**
 * prints the raw title of a page.
 *
 * @return string
 */
function printBarePageTitle() {
    echo html_encode(getBarePageTitle());
}

/**
 * Returns titlelink of a page
 *
 * @return string
 */
function getPageTitleLink() {
    global $_zp_current_zenpage_page;
    if (is_Pages()) {
        return $_zp_current_zenpage_page->getTitlelink();
    }
}

/**
 * Prints titlelink of a page
 * !!!!!!!!!!NOT THE URL TO THE PAGE!!!!!!!!!!!!!
 *
 * @return string
 */
function printPageTitleLink() {
    global $_zp_current_zenpage_page;
    echo html_encode(getPageURL(getPageTitleLink()));
}

/**
 * Returns the id of a page
 *
 * @return int
 */
function getPageID() {
    global $_zp_current_zenpage_page;
    if (is_Pages()) {
        return $_zp_current_zenpage_page->getID();
    }
}

/**
 * Prints the id of a page
 *
 * @return string
 */
function printPageID() {
    echo getPageID();
}

/**
 * Returns the id of the parent page of a page
 *
 * @return int
 */
function getPageParentID() {
    global $_zp_current_zenpage_page;
    if (is_Pages()) {
        return $_zp_current_zenpage_page->getParentid();
    }
}

/**
 * Returns the creation date of a page
 *
 * @return string
 */
function getPageDate() {
    global $_zp_current_zenpage_page;
    if (!is_null($_zp_current_zenpage_page)) {
        $d = $_zp_current_zenpage_page->getDatetime();
        return zpFormattedDate(DATE_FORMAT, strtotime($d));
    }
    return false;
}

/**
 * Prints the creation date of a page
 *
 * @return string
 */
function printPageDate() {
    echo html_encode(getPageDate());
}

/**
 * Returns the last change date of a page if available
 *
 * @return string
 */
function getPageLastChangeDate() {
    global $_zp_current_zenpage_page;
    if (!is_null($_zp_current_zenpage_page)) {
        $d = $_zp_current_zenpage_page->getLastChange();
        return zpFormattedDate(DATE_FORMAT, strtotime($d));
    }
    return false;
}

/**
 * Prints the last change date of a page
 *
 * @param string $before The text you want to show before the link
 * @return string
 */
function printPageLastChangeDate($before) {
    echo html_encode($before . getPageLastChangeDate());
}

/**
 * Returns page content either of the current page or if requested by titlelink directly. If not both return false
 * Set the titlelink of a page to call a specific even un-published page ($published = false) as a gallery description or on another custom page for example
 *
 * @param string $titlelink the titlelink of the page to print the content from
 * @param bool $published If titlelink is set, set this to false if you want to call an un-published page's content. True is default
 *
 * @return mixed
 */
function getPageContent($titlelink = NULL, $published = true) {
    global $_zp_current_zenpage_page;
    if (is_Pages() && empty($titlelink)) {
        return $_zp_current_zenpage_page->getContent();
    }
    // print content of a page directly on a normal zenphoto theme page or any other page for example
    if (!empty($titlelink)) {
        $page = new ZenpagePage($titlelink);
        if ($page->isPublished() || ( !$page->isPublished() && ! $published)) {
            return $page->getContent();
        }
    }
    return false;
}

/**
 * Print page content either of the current page or if requested by titlelink directly. If not both return false
 * Set the titlelink of a page to call a specific even un-published page ($published = false) as a gallery description or on another custom page for example
 *
 * @param string $titlelink the titlelink of the page to print the content from
 * @param bool $published If titlelink is set, set this to false if you want to call an un-published page's content. True is default
 * @return mixed
 */
function printPageContent($titlelink = NULL, $published = true) {
    global $_zp_current_zenpage_page;
    $content = zp_apply_filter('pagecontent_html', getPageContent($titlelink, $published), $_zp_current_zenpage_page);
    echo html_encodeTagged($content);
}

/**
 * Returns page extra content either of the current page or if requested by titlelink directly. If not both return false
 * Set the titlelink of a page to call a specific even un-published page ($published = false) as a gallery description or on another custom page for example
 *
 * @param string $titlelink the titlelink of the page to print the content from
 * @param bool $published If titlelink is set, set this to false if you want to call an un-published page's extra content. True is default
 * @return mixed
 */
function getPageExtraContent($titlelink = '', $published = true) {
    global $_zp_current_zenpage_page;
    if (is_Pages() && empty($titlelink)) {
        return $_zp_current_zenpage_page->getExtracontent();
    }
    // print content of a page directly on a normal zenphoto theme page for example
    if (!empty($titlelink)) {
        $page = new ZenpagePage($titlelink);
        if ($page->isPublished() || ( !$page->isPublished() && ! $published)) {
            return $page->getExtracontent();
        }
    }
    return false;
}

/**
 * Prints page extra content if on a page either of the current page or if requested by titlelink directly. If not both return false
 * Set the titlelink of a page to call a specific even un-published page ($published = false) as a gallery description or on another custom page for example
 *
 * @param string $titlelink the titlelink of the page to print the content from
 * @param bool $published If titlelink is set, set this to false if you want to call an un-published page's extra content. True is default
 * @return mixed
 */
function printPageExtraContent($titlelink = NULL, $published = true) {
    echo getPageExtraContent($titlelink, $published);
}

/**
 * Gets the custom data field of the current page
 *
 * @return string
 */
function getPageCustomData() {
    global $_zp_current_zenpage_page;
    if (!is_null($_zp_current_zenpage_page)) {
        return $_zp_current_zenpage_page->getCustomData();
    }
}

/**
 * Prints the custom data field of the current page
 *
 */
function printPageCustomData() {
    echo getPageCustomData();
}

/**
 * Returns the sortorder of a page
 *
 * @return string
 */
function getPageSortorder() {
    global $_zp_current_zenpage_page;
    if (is_Pages()) {
        return $_zp_current_zenpage_page->getSortOrder();
    }
    return false;
}

/**
 * Returns full path to a specific page
 *
 * @return string
 */
function getPageURL($titlelink = '') {
    global $_zp_zenpage, $_zp_current_zenpage_page;
    if (empty($titlelink)) {
        $obj = $_zp_current_zenpage_page;
    } else {
        $obj = new ZenpagePage($titlelink);
    }
    return $obj->getLink();
}

/**
 * Prints the url to a specific zenpage page
 *
 * @param string $linktext Text for the URL
 * @param string $titlelink page to include in URL
 * @param string $prev text to insert before the URL
 * @param string $next text to follow the URL
 * @param string $class optional class
 */
function printPageURL($linktext = NULL, $titlelink = NULL, $prev = '', $next = '', $class = NULL) {
    if (!is_null($class)) {
        $class = 'class="' . $class . '"';
    }
    if (is_null($linktext)) {
        $linktext = getPageTitle();
    }
    echo $prev . "<a href=\"" . html_encode(getPageURL($titlelink)) . "\" $class title=\"" . html_encode($linktext) . "\">" . html_encode($linktext) . "</a>" . $next;
}

/**
 * Prints excerpts of the direct subpages (1 level) of a page for a kind of overview. The setup is:
 * <div class='pageexcerpt'>
 * <h4>page title</h3>
 * <p>page content excerpt</p>
 * <p>read more</p>
 * </div>
 *
 * @param int $excerptlength The length of the page content, if nothing specifically set, the plugin option value for 'news article text length' is used
 * @param string $readmore The text for the link to the full page. If empty the read more setting from the options is used.
 * @param string $shortenindicator The optional placeholder that indicates that the content is shortened, if this is not set the plugin option "news article text shorten indicator" is used.
 * @return string
 */
function printSubPagesExcerpts($excerptlength = NULL, $readmore = NULL, $shortenindicator = NULL) {
    global $_zp_current_zenpage_page;
    if (is_null($readmore)) {
        $readmore = get_language_string(ZP_READ_MORE);
    }
    $pages = $_zp_current_zenpage_page->getPages();
    $subcount = 0;
    if (is_null($excerptlength)) {
        $excerptlength = ZP_SHORTEN_LENGTH;
    }
    foreach ($pages as $page) {
        $pageobj = new ZenpagePage($page['titlelink']);
        if ($pageobj->getParentID() == $_zp_current_zenpage_page->getID()) {
            $subcount++;
            $pagetitle = html_encode($pageobj->getTitle());
            $pagecontent = $pageobj->getContent();
            if ($pageobj->checkAccess()) {
                $pagecontent = getContentShorten($pagecontent, $excerptlength, $shortenindicator, $readmore, $pageobj->getLink());
            } else {
                $pagecontent = '<p><em>' . gettext('This page is password protected') . '</em></p>';
            }
            echo '<div class="pageexcerpt">';
            echo '<h4><a href="' . html_encode($pageobj->getLink()) . '" title="' . getBare($pagetitle) . '">' . $pagetitle . '</a></h4>';
            echo $pagecontent;
            echo '</div>';
        }
    }
}

/**
 * Prints a context sensitive menu of all pages as a unordered html list
 *
 * @param string $option The mode for the menu:
 *                                              "list" context sensitive toplevel plus sublevel pages,
 *                                              "list-top" only top level pages,
 *                                              "omit-top" only sub level pages
 *                                              "list-sub" lists only the current pages direct offspring
 * @param string $css_id CSS id of the top level list
 * @param string $css_class_topactive class of the active item in the top level list
 * @param string $css_class CSS class of the sub level list(s)
 * @param string $$css_class_active CSS class of the sub level list(s)
 * @param string $indexname insert the name (default "Gallery Index") how you want to call the link to the gallery index, insert "" (default) if you don't use it, it is not printed then.
 * @param int $showsubs Set to depth of sublevels that should be shown always. 0 by default. To show all, set to a true! Only valid if option=="list".
 * @param bool $startlist set to true to output the UL tab
 * @@param int $limit truncation of display text
 * @return string
 */
function printPageMenu($option = 'list', $css_id = NULL, $css_class_topactive = NULL, $css_class = NULL, $css_class_active = NULL, $indexname = NULL, $showsubs = 0, $startlist = true, $limit = NULL) {
    printNestedMenu($option, 'pages', false, $css_id, $css_class_topactive, $css_class, $css_class_active, $indexname, $showsubs, $startlist, $limit);
}

/**
 * If the titlelink is valid this will setup for the page
 * Returns true if page is setup and valid, otherwise returns false
 *
 * @param string $titlelink The page to setup
 *
 * @return bool
 */
function checkForPage($titlelink) {
    if (!empty($titlelink)) {
        load_zenpage_pages($titlelink);
        return in_context(ZP_ZENPAGE_PAGE);
    }
    return false;
}

/* * ********************************************* */
/* Comments
    /*********************************************** */

/**
 * Gets latest comments for news articles and pages
 *
 * @param int $number how many comments you want.
 * @param string $type  "all" for all latest comments for all news articles and all pages
 *                                          "news" for the lastest comments of one specific news article
 *                                          "page" for the lastest comments of one specific page
 * @param int $itemID the ID of the element to get the comments for if $type != "all"
 */
function getLatestZenpageComments($number, $type = "all", $itemID = "") {
    $itemID = sanitize_numeric($itemID);
    $number = sanitize_numeric($number);
    $checkauth = zp_loggedin();

    if ($type == 'all' || $type == 'news') {
        $newspasswordcheck = "";
        if (zp_loggedin(MANAGE_ALL_NEWS_RIGHTS)) {
            $newsshow = '';
        } else {
            $newsshow = 'news.show=1 AND';
            $newscheck = query_full_array("SELECT * FROM " . prefix('news') . " ORDER BY date");
            foreach ($newscheck as $articlecheck) {
                $obj = new ZenpageNews($articlecheck['titlelink']);
                if ($obj->inProtectedCategory()) {
                    if ($checkauth && $obj->isMyItem(LIST_RIGHTS)) {
                        $newsshow = '';
                    } else {
                        $excludenews = " AND id != " . $articlecheck['id'];
                        $newspasswordcheck = $newspasswordcheck . $excludenews;
                    }
                }
            }
        }
    }
    if ($type == 'all' || $type == 'page') {
        $pagepasswordcheck = "";
        if (zp_loggedin(MANAGE_ALL_PAGES_RIGHTS)) {
            $pagesshow = '';
        } else {
            $pagesshow = 'pages.show=1 AND';
            $pagescheck = query_full_array("SELECT * FROM " . prefix('pages') . " ORDER BY date");
            foreach ($pagescheck as $pagecheck) {
                $obj = new ZenpagePage($pagecheck['titlelink']);
                if ($obj->isProtected()) {
                    if ($checkauth && $obj->isMyItem(LIST_RIGHTS)) {
                        $pagesshow = '';
                    } else {
                        $excludepages = " AND pages.id != " . $pagecheck['id'];
                        $pagepasswordcheck = $pagepasswordcheck . $excludepages;
                    }
                }
            }
        }
    }
    switch ($type) {
        case "news":
            $whereNews = " WHERE $newsshow news.id = " . $itemID . " AND c.ownerid = news.id AND c.type = 'news' AND c.private = 0 AND c.inmoderation = 0" . $newspasswordcheck;
            break;
        case "page":
            $wherePages = " WHERE $pagesshow pages.id = " . $itemID . " AND c.ownerid = pages.id AND c.type = 'pages' AND c.private = 0 AND c.inmoderation = 0" . $pagepasswordcheck;
            break;
        case "all":
            $whereNews = " WHERE $newsshow c.ownerid = news.id AND c.type = 'news' AND c.private = 0 AND c.inmoderation = 0" . $newspasswordcheck;
            $wherePages = " WHERE $pagesshow c.ownerid = pages.id AND c.type = 'pages' AND c.private = 0 AND c.inmoderation = 0" . $pagepasswordcheck;
            break;
    }
    $comments_news = array();
    $comments_pages = array();
    if ($type == "all" OR $type == "news") {
        $comments_news = query_full_array("SELECT c.id, c.name, c.type, c.website,"
                        . " c.date, c.anon, c.comment, news.title, news.titlelink FROM " . prefix('comments') . " AS c, " . prefix('news') . " AS news "
                        . $whereNews
                        . " ORDER BY c.id DESC LIMIT $number");
    }
    if ($type == "all" OR $type == "page") {
        $comments_pages = query_full_array($sql = "SELECT c.id, c.name, c.type, c.website,"
                        . " c.date, c.anon, c.comment, pages.title, pages.titlelink FROM " . prefix('comments') . " AS c, " . prefix('pages') . " AS pages "
                        . $wherePages
                        . " ORDER BY c.id DESC LIMIT $number");
    }
    $comments = array();
    foreach ($comments_news as $comment) {
        $comments[$comment['id']] = $comment;
    }
    foreach ($comments_pages as $comment) {
        $comments[$comment['id']] = $comment;
    }
    krsort($comments);
    return array_slice($comments, 0, $number);
}

/**
 * support to show an image from an album
 * The imagename is optional. If absent the album thumb image will be
 * used and the link will be to the album. If present the link will be
 * to the image.
 *
 * @param string $albumname
 * @param string $imagename
 * @param int $size the size to make the image. If omitted image will be 50% of 'image_size' option.
 * @param bool $linkalbum set true to link specific image to album instead of image
 */
function zenpageAlbumImage($albumname, $imagename = NULL, $size = NULL, $linkalbum = false) {
    global $_zp_gallery;
    echo '<br />';
    $album = newAlbum($albumname);
    if ($album->loaded) {
        if (is_null($size)) {
            $size = floor(getOption('image_size') * 0.5);
        }
        $image = NULL;
        if (is_null($imagename)) {
            $linkalbum = true;
            $image = $album->getAlbumThumbImage();
        } else {
            $image = newImage($album, $imagename);
        }
        if ($image && $image->loaded) {
            makeImageCurrent($image);
            if ($linkalbum) {
                rem_context(ZP_IMAGE);
                echo '<a href="' . html_encode($album->getLink()) . '"   title="' . sprintf(gettext('View the %s album'), $albumname) . '">';
                add_context(ZP_IMAGE);
                printCustomSizedImage(sprintf(gettext('View the album %s'), $albumname), $size);
                rem_context(ZP_IMAGE | ZP_ALBUM);
                echo '</a>';
            } else {
                echo '<a href="' . html_encode(getImageURL()) . '" title="' . sprintf(gettext('View %s'), $imagename) . '">';
                printCustomSizedImage(sprintf(gettext('View %s'), $imagename), $size);
                rem_context(ZP_IMAGE | ZP_ALBUM);
                echo '</a>';
            }
        } else {
            ?>
            <span style="background:red;color:black;">
                <?php
                printf(gettext('<code>zenpageAlbumImage()</code> did not find the image %1$s:%2$s'), $albumname, $imagename);
                ?>
            </span>
            <?php
        }
    } else {
        ?>
        <span style="background:red;color:black;">
            <?php
            printf(gettext('<code>zenpageAlbumImage()</code> did not find the album %1$s'), $albumname);
            ?>
        </span>
        <?php
    }
}

Zenpage::expiry();
?>
ZenphotoCMS 1.5.x API documentation generated by ApiGen