Overview

Packages

  • admin
  • classes
    • media
  • CodeIgniter
    • Libraries
  • core
  • functions
  • JSMin
  • None
  • OpenID
  • PHP
  • PHPMailer
  • plugins
    • admin
    • development
    • feed
    • mail
    • media
    • misc
    • seo
    • spam
    • uploader
    • users
    • zenpage
    • zenphoto
      • news
  • Services
    • JSON

Classes

  • _zp_captcha
  • _zp_HTML_cache
  • admin_approval
  • Album
  • AlbumBase
  • AlbumZip
  • AMFReader
  • AMFStream
  • AnyFile
  • AnyFile_Options
  • Auth_OpenID
  • Auth_OpenID_AlreadySigned
  • Auth_OpenID_AssociateRequest
  • Auth_OpenID_Association
  • Auth_OpenID_AuthRequest
  • Auth_OpenID_AX
  • Auth_OpenID_AX_AttrInfo
  • Auth_OpenID_AX_Error
  • Auth_OpenID_AX_FetchRequest
  • Auth_OpenID_AX_FetchResponse
  • Auth_OpenID_AX_KeyValueMessage
  • Auth_OpenID_AX_Message
  • Auth_OpenID_AX_StoreRequest
  • Auth_OpenID_AX_StoreResponse
  • Auth_OpenID_BcMathWrapper
  • Auth_OpenID_CancelResponse
  • Auth_OpenID_CheckAuthRequest
  • Auth_OpenID_CheckIDRequest
  • Auth_OpenID_Consumer
  • Auth_OpenID_ConsumerResponse
  • Auth_OpenID_CryptUtil
  • Auth_OpenID_DatabaseConnection
  • Auth_OpenID_Decoder
  • Auth_OpenID_DiffieHellman
  • Auth_OpenID_DiffieHellmanSHA1ConsumerSession
  • Auth_OpenID_DiffieHellmanSHA1ServerSession
  • Auth_OpenID_DiffieHellmanSHA256ConsumerSession
  • Auth_OpenID_DiffieHellmanSHA256ServerSession
  • Auth_OpenID_DumbStore
  • Auth_OpenID_Encoder
  • Auth_OpenID_EncodingError
  • Auth_OpenID_Extension
  • Auth_OpenID_FailureResponse
  • Auth_OpenID_FileStore
  • Auth_OpenID_GenericConsumer
  • Auth_OpenID_GmpMathWrapper
  • Auth_OpenID_KVForm
  • Auth_OpenID_MalformedReturnURL
  • Auth_OpenID_MalformedTrustRoot
  • Auth_OpenID_Mapping
  • Auth_OpenID_MathLibrary
  • Auth_OpenID_MDB2Store
  • Auth_OpenID_MemcachedStore
  • Auth_OpenID_Message
  • Auth_OpenID_MySQLStore
  • Auth_OpenID_NamespaceMap
  • Auth_OpenID_NoReturnToError
  • Auth_OpenID_OpenIDStore
  • Auth_OpenID_PAPE_Request
  • Auth_OpenID_PAPE_Response
  • Auth_OpenID_Parse
  • Auth_OpenID_PlainTextConsumerSession
  • Auth_OpenID_PlainTextServerSession
  • Auth_OpenID_PostgreSQLStore
  • Auth_OpenID_Request
  • Auth_OpenID_Server
  • Auth_OpenID_ServerError
  • Auth_OpenID_ServerErrorContainer
  • Auth_OpenID_ServerRequest
  • Auth_OpenID_ServerResponse
  • Auth_OpenID_ServiceEndpoint
  • Auth_OpenID_ServiceEndpointLoader
  • Auth_OpenID_SessionNegotiator
  • Auth_OpenID_SetupNeededResponse
  • Auth_OpenID_Signatory
  • Auth_OpenID_SigningEncoder
  • Auth_OpenID_SQLiteStore
  • Auth_OpenID_SQLStore
  • Auth_OpenID_SRegBase
  • Auth_OpenID_SRegRequest
  • Auth_OpenID_SRegResponse
  • Auth_OpenID_SuccessResponse
  • Auth_OpenID_TrustRoot
  • Auth_OpenID_TypeURIMismatch
  • Auth_OpenID_UntrustedReturnURL
  • Auth_OpenID_WebResponse
  • Auth_Yadis_Discovery
  • Auth_Yadis_DiscoveryResult
  • Auth_Yadis_dom
  • Auth_Yadis_domxml
  • Auth_Yadis_HTTPFetcher
  • Auth_Yadis_HTTPResponse
  • Auth_Yadis_Manager
  • Auth_Yadis_ManagerLoader
  • Auth_Yadis_ParanoidHTTPFetcher
  • Auth_Yadis_ParseHTML
  • Auth_Yadis_PHPSession
  • Auth_Yadis_PlainHTTPFetcher
  • Auth_Yadis_ProxyResolver
  • Auth_Yadis_Service
  • Auth_Yadis_SessionLoader
  • Auth_Yadis_XMLParser
  • Auth_Yadis_XRDS
  • Auth_Yadis_Yadis
  • auto_backup
  • AVCSequenceParameterSetReader
  • bxslider
  • cacheManager
  • cacheManagerFeed
  • CI_jsmin
  • CI_load
  • cloneZenphoto
  • codeIgniter_kludge
  • colorbox
  • Comment
  • comment_form
  • contactformOptions
  • crop_image
  • cycle
  • defaultCodeblocks
  • deprecated_functions
  • DownloadList
  • dynamic_locale
  • dynamicAlbum
  • elFinder_options
  • email_new_user
  • exampleMacros
  • external_auth
  • ExternalFeed
  • externalFeed_options
  • favorites
  • favoritesOptions
  • federated_logon
  • 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
  • googleVerifyOptions
  • hitcounter
  • HTML
  • htmlmetatags
  • http_auth
  • Image
  • image_effects
  • internal_deprecations
  • ipBlocker
  • jcarousel
  • jPlayer
  • jplayer_options
  • jquery_rating
  • JSMin
  • lib_GD_Options
  • lib_Imagick_Options
  • lib_NoGraphics
  • 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
  • pagedThumbsNav
  • pagedthumbsOptions
  • PclZip
  • PersistentObject
  • PHPMailer
  • PlainText
  • POP3
  • print_album_menu
  • pseudoPlayer
  • publishContent
  • quota_manager
  • reCaptcha
  • ReCaptchaResponse
  • register_user
  • rewriteRules
  • rewriteTokens
  • RSS
  • RSS_internal_deprecations
  • rss_options
  • search_statistics
  • SearchEngine
  • security_logger
  • seo_locale
  • Services_JSON
  • Services_JSON_Error
  • setupexternalFeed
  • setupRSS
  • show_not_loggedin
  • sitemap
  • slideshow
  • SMTP
  • static_html_cache
  • tagsuggest
  • TextObject
  • TextObject_internal_deprecations
  • TextObject_Options
  • ThemeObject
  • themeSwitcher
  • tinymce4Options
  • tinyURL
  • Transientimage
  • tweet
  • TwitterOAuth
  • UploadHandler
  • user_expiry
  • user_groups
  • user_logout_options
  • userAddressFields
  • utf8
  • Video
  • Video_internal_deprecations
  • VideoObject_Options
  • viewer_size_image_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
  • zpCaptcha
  • zpFunctions
  • zpLegacySpam
  • zpMutex
  • zpSimpleSpam
  • zpTrivialSpam

Exceptions

  • BadFunctionCallException
  • BadMethodCallException
  • Exception
  • getid3_exception
  • JSMin_UnterminatedCommentException
  • JSMin_UnterminatedRegExpException
  • JSMin_UnterminatedStringException
  • LogicException
  • OAuthExcept
  • phpmailerException

Functions

  • __autoload
  • _escape_xref
  • _recaptcha_aes_encrypt
  • _recaptcha_aes_pad
  • _recaptcha_http_post
  • _recaptcha_mailhide_email_parts
  • _recaptcha_mailhide_urlbase64
  • _recaptcha_qsencode
  • accessAllAlbums
  • add_context
  • addalbumsToDatabase
  • addCategoriesToDatabase
  • addGeoCoord
  • addItem
  • addPagesToDatabase
  • addPluginScript
  • addPluginType
  • addSubalbumMenus
  • admin_album_list
  • admin_securityChecks
  • admin_showupdate
  • adminPageNav
  • adminToolbox
  • albumNumber
  • applyMacros
  • Auth_OpenID_arrangeByType
  • Auth_OpenID_AX_checkAlias
  • Auth_OpenID_AX_toTypeURIs
  • Auth_OpenID_bestMatchingService
  • Auth_OpenID_checkFieldName
  • Auth_OpenID_checkSessionType
  • Auth_OpenID_checkTimestamp
  • Auth_OpenID_detectMathLibrary
  • Auth_OpenID_discover
  • Auth_OpenID_discoverURI
  • Auth_OpenID_discoverWithoutYadis
  • Auth_OpenID_discoverWithYadis
  • Auth_OpenID_discoverXRI
  • Auth_OpenID_extractReturnURL
  • Auth_OpenID_findOPLocalIdentifier
  • Auth_OpenID_getAllAssociationTypes
  • Auth_OpenID_getAllowedReturnURLs
  • Auth_OpenID_getAuthorityPattern
  • Auth_OpenID_getAvailableSessionTypes
  • Auth_OpenID_getDefaultAssociationOrder
  • Auth_OpenID_getDefaultGen
  • Auth_OpenID_getDefaultMod
  • Auth_OpenID_getDefaultNegotiator
  • Auth_OpenID_getEncodedPattern
  • Auth_OpenID_getEncryptedNegotiator
  • Auth_OpenID_getEscapeRE
  • Auth_OpenID_getMathLib
  • Auth_OpenID_getOnlyEncryptedOrder
  • Auth_OpenID_getOpenIDConsumerTypeURIs
  • Auth_OpenID_getOpenIDTypeName
  • Auth_OpenID_getOpenIDTypeURIs
  • Auth_OpenID_getOPOrUserServices
  • Auth_OpenID_getSecretSize
  • Auth_OpenID_getSessionTypes
  • Auth_OpenID_getSupportedAssociationTypes
  • Auth_OpenID_getUnreserved
  • Auth_OpenID_getURIPattern
  • Auth_OpenID_getURLIllegalCharRE
  • Auth_OpenID_HMACSHA1
  • Auth_OpenID_HMACSHA256
  • Auth_OpenID_include_init
  • Auth_OpenID_isError
  • Auth_OpenID_isOpenID1
  • Auth_OpenID_legacy_discover
  • Auth_OpenID_makeOpenIDEndpoints
  • Auth_OpenID_math_extensions
  • Auth_OpenID_mkNonce
  • Auth_OpenID_noMathSupport
  • Auth_OpenID_pct_encoded_replace
  • Auth_OpenID_pct_encoded_replace_unreserved
  • Auth_OpenID_registerNamespaceAlias
  • Auth_OpenID_remove_dot_segments
  • Auth_OpenID_removeNamespaceAlias
  • Auth_OpenID_returnToMatches
  • Auth_OpenID_setNoMathSupport
  • Auth_OpenID_SHA1
  • Auth_OpenID_SHA256
  • Auth_OpenID_splitNonce
  • Auth_OpenID_supportsSReg
  • Auth_OpenID_urinorm
  • Auth_OpenID_verifyReturnTo
  • Auth_Yadis_array_scramble
  • Auth_Yadis_escapeForIRI
  • Auth_Yadis_getCanonicalID
  • Auth_Yadis_getDefaultProxy
  • Auth_Yadis_getEscapeRE
  • Auth_Yadis_getIPrivateChars
  • Auth_Yadis_getNSMap
  • Auth_Yadis_getServiceEndpoints
  • Auth_Yadis_getSupportedExtensions
  • Auth_Yadis_getUCSChars
  • Auth_Yadis_getXMLParser
  • Auth_Yadis_getXRDExpiration
  • Auth_Yadis_getXrefRE
  • Auth_Yadis_getXRIAuthorities
  • Auth_Yadis_identifierScheme
  • Auth_Yadis_iriToURI
  • Auth_Yadis_pct_escape_unicode
  • Auth_Yadis_providerIsAuthoritative
  • Auth_Yadis_rootAuthority
  • Auth_Yadis_setDefaultParser
  • Auth_Yadis_startswith
  • Auth_Yadis_toIRINormal
  • Auth_Yadis_toURINormal
  • Auth_Yadis_XRI
  • Auth_Yadis_XRIAppendArgs
  • authorSelector
  • build_query
  • build_url
  • bulkActionRedirect
  • bulkTags
  • byteConvert
  • cacheImage
  • checkAccess
  • checkAlbumimagesort
  • checkAlbumParentid
  • checkAlbumPassword
  • checkChosenItemStatus
  • checkChosenMenuset
  • checked
  • checkFolder
  • checkForEmptyTitle
  • checkForGuest
  • checkForPage
  • checkForPassword
  • checkForUpdate
  • checkHitcounterDisplay
  • checkIfChecked
  • checkIfLockedNews
  • checkIfLockedPage
  • checkIfNew
  • checkInstall
  • checkLayoutUseForImages
  • checkNewsAccess
  • checkNewsCategoryPassword
  • checkObjectsThumb
  • checkPagePassword
  • checkPageValidity
  • checkParentLayouts
  • checkPublishDates
  • checkRequiredField
  • checkSelectedAlbum
  • checkSignature
  • cleanAlbum
  • cleanHTML
  • clearSitemapCache
  • clonedFrom
  • codeblocktabsJS
  • comment_form_addComment
  • comment_form_handle_comment
  • comment_form_PaginationJS
  • comment_form_postcomment
  • comment_form_print10Most
  • comment_form_visualEditor
  • commentFormUseCaptcha
  • commentReply
  • commentsAllowed
  • consolidatedEditMessages
  • copyLayoutSelection
  • copyThemeDirectory
  • countArticles
  • countCombiNews
  • createMenuIfNotExists
  • createRelatedItemsResultArray
  • cron_starter
  • 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_getSQLmode
  • db_insert_id
  • 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
  • debugLogVar
  • defaultCodeblocks_codebox
  • deleteArticle
  • deleteCategory
  • deleteItem
  • deleteLayoutSelection
  • deletePage
  • deleteThemeDirectory
  • detect_fetcher
  • detect_math
  • detect_query_corruption
  • detect_random
  • detect_stores
  • detect_xml
  • dircopy
  • displayError
  • doIncludes
  • elFinder_admin_tabs
  • elFinder_tinymce
  • enableExtension
  • escape
  • executeRSS
  • exitZP
  • exposeZenPhotoInformations
  • extensionEnabled
  • fetchComments
  • filesystemToInternal
  • filter_extractReturnURL
  • filter_MatchesAnyOpenIDConsumerType
  • filter_MatchesAnyOpenIDType
  • filterImageQuery
  • fix_path_redirect
  • formatList
  • fullText
  • galleryAlbumsPerPage
  • genAlbumList
  • generateCaptcha
  • generateLanguageList
  • generateListFromArray
  • generateListFromFiles
  • generateRadiobuttonsFromArray
  • generateSitemapCacheFile
  • generateSitemapIndexCacheFile
  • generateUnorderedListFromArray
  • get_AnyFile_suffixes
  • get_context
  • get_filterScript
  • get_instance
  • get_language_string
  • getAdminThumb
  • getAlbumArray
  • getAlbumBreadcrumb
  • getAlbumBreadcrumbAdmin
  • getAlbumCustomData
  • getAlbumData
  • getAlbumDate
  • getAlbumDesc
  • getAlbumFolder
  • getAlbumGeodata
  • getAlbumId
  • getAlbumInherited
  • getAlbumLinkURL
  • getAlbumLocation
  • getAlbumPage
  • getAlbumPlace
  • getAlbumStatistic
  • getAlbumThumb
  • getAlbumTitle
  • getAlbumURL
  • getAllAccessibleAlbums
  • getAllAlbums
  • getAllArticleDates
  • getAllCategories
  • getAllDates
  • getAllowedTags
  • getAllSubAlbumIDs
  • getAllSubalbums
  • getAllTagsCount
  • getAllTagsFromAlbum
  • getAllTagsFromAlbum_multi_unique
  • getAllTagsFromZenpage
  • getAllTagsUnique
  • getAllTranslations
  • getAnnotatedAlbumTitle
  • getAnnotatedImageTitle
  • getArticles
  • getAuthor
  • getBare
  • getBareAlbumDesc
  • getBareAlbumTitle
  • getBareGalleryDesc
  • getBareGalleryTitle
  • getBareImageDesc
  • getBareImageTitle
  • getBareNewsAlbumTitle
  • getBareNewsTitle
  • getBarePageTitle
  • getCategory
  • getCategoryID
  • getCategoryLink
  • getCategoryParentID
  • getCategorySortOrder
  • getCategoryTitle
  • getCheckboxState
  • getCodeblock
  • getCombiNews
  • getCommentAddress
  • getCommentAuthorEmail
  • getCommentAuthorLink
  • getCommentAuthorName
  • getCommentAuthorSite
  • getCommentBody
  • getCommentCount
  • getCommentDate
  • getCommentDateTime
  • getCommentErrors
  • getCommentsAllowed
  • getCommentStored
  • getCommentTime
  • getConsumer
  • getContentShorten
  • getCurrentMenuItem
  • getCurrentNewsArchive
  • getCurrentNewsCategory
  • getCurrentNewsCategoryID
  • getCurrentNewsCategoryParentID
  • getCurrentNewsPage
  • getCurrentPage
  • getCurrentTheme
  • getCustomAlbumThumb
  • getCustomAlbumThumbMaxSpace
  • getCustomImageURL
  • getCustomPageURL
  • getCustomSizedImageMaxSpace
  • getCustomSizedImageThumbMaxSpace
  • getDefaultHeight
  • getDefaultSizedImage
  • getDefaultWidth
  • getDownloadLink
  • getdownloadList
  • getDownloadURL
  • getE
  • getEnabledPlugins
  • getExpiryDatePost
  • getFavoritesURL
  • getField
  • getFirstImageURL
  • getFullHeight
  • getFullImageURL
  • getFullNewsImage
  • getFullWidth
  • getGalleryDesc
  • getGalleryIndexURL
  • getGalleryTitle
  • getGeoCoord
  • getHeadTitle
  • getHitcounter
  • getImageArgs
  • getImageCacheFilename
  • getImageCachePostfix
  • getImageCity
  • getImageCountry
  • getImageCustomData
  • getImageData
  • getImageDate
  • getImageDesc
  • getImageEXIFData
  • getImageGeodata
  • getImageID
  • getImageLinkURL
  • getImageLocation
  • getImageMetaData
  • getImageParameters
  • getImageProcessorURI
  • getImageProcessorURIFromCacheName
  • getImageRotation
  • getImageSortOrder
  • getImageState
  • getImageStatistic
  • getImageThumb
  • getImageTitle
  • getImageURI
  • getImageURL
  • getItem
  • getItemByID
  • getItemTitleAndURL
  • getjPlayerSkinCSS
  • getjPlayerSkins
  • getLanguageArray
  • getLanguageFlag
  • getLastImageURL
  • getLatestComments
  • getLatestNews
  • getLatestZenpageComments
  • getLayout
  • getLayoutSelector
  • getLink
  • getLinkHTML
  • getLogTabs
  • getMacros
  • getMainSiteName
  • getMainSiteURL
  • getManagedAlbumList
  • getMaxSpaceContainer
  • getMenuFromLink
  • getMenuItemChilds
  • getMenuItems
  • getMenumanagerPredicessor
  • getMenumanagerSuccessor
  • getMenuSetSelector
  • getMenuVisibility
  • getMimeString
  • getNestedAlbumList
  • getNewsAdminOption
  • getNewsAdminOptionPath
  • getNewsAlbumName
  • getNewsAlbumTitle
  • getNewsAlbumURL
  • getNewsArchivePath
  • getNewsArchiveURL
  • getNewsAuthor
  • getNewsCategories
  • getNewsCategoryCustomData
  • getNewsCategoryDesc
  • getNewsCategoryPath
  • getNewsCategoryURL
  • getNewsContent
  • getNewsContentShorten
  • getNewsCustomData
  • getNewsDate
  • getNewsExtraContent
  • getNewsID
  • getNewsImageTags
  • getNewsIndexURL
  • getNewsLink
  • getNewsPagesStatistic
  • getNewsPathNav
  • getNewsReadMore
  • getNewsTitle
  • getNewsTitleLink
  • getNewsTitlePath
  • getNewsType
  • getNewsURL
  • getNewsVideoContent
  • getNextAlbum
  • getNextAlbumURL
  • getNextImageThumb
  • getNextImageURL
  • getNextNewsPageURL
  • getNextNewsURL
  • getNextPageURL
  • getNextPrevNews
  • getNotViewableAlbums
  • getNotViewableImages
  • getNumAlbums
  • getNumAllSubalbums
  • getNumImages
  • getNumNews
  • getNumPages
  • getNumSubalbums
  • getOpenIDURL
  • getOption
  • getOptionFromDB
  • getOptionList
  • getPageAuthor
  • getPageContent
  • getPageCustomData
  • getPageDate
  • getPageExtraContent
  • getPageID
  • getPageLastChangeDate
  • getPageLinkPath
  • getPageLinkURL
  • getPageNavList
  • getPageNumURL
  • getPageParentID
  • getPageRedirect
  • getPages
  • getPageSelector
  • getPageSortorder
  • getPageTitle
  • getPageTitleLink
  • getPageURL
  • getParentAlbums
  • getParentAlbumsAdmin
  • getParentBreadcrumb
  • getParentItems
  • getParentMenuItems
  • getParentNewsCategories
  • getParentPages
  • getPasswordProtectImage
  • getPHPFiles
  • getPlugin
  • getPluginFiles
  • getPluginTabs
  • getPrevAlbum
  • getPrevAlbumURL
  • getPrevImageThumb
  • getPrevImageURL
  • getPrevNewsPageURL
  • getPrevNewsURL
  • getPrevPageURL
  • getProtectedImageURL
  • getRandomImages
  • getRandomImagesAlbum
  • getRating
  • getRelatedItems
  • getRequestURI
  • getReturnTo
  • getRSSHeaderLink
  • getRSSLink
  • getScheme
  • getSearchDate
  • getSearchURL
  • getSearchWords
  • getSelectedLayout
  • getSerializedArray
  • getSetClause
  • getSiteHomeURL
  • getSitemapAlbumList
  • getSitemapAlbums
  • getSitemapGoogleImageVideoExtras
  • getSitemapGoogleLoopIndex
  • getSitemapImages
  • getSitemapIndexLinks
  • getSitemapZenpageNewsArticles
  • getSitemapZenpageNewsCategories
  • getSitemapZenpageNewsIndex
  • getSitemapZenpagePages
  • getSizeCustomImage
  • getSizeDefaultImage
  • getSizeDefaultThumb
  • getSizedImageURL
  • getSizeFullImage
  • getStore
  • getSubCategories
  • getSubtabs
  • getSuffix
  • getTagCountByAccess
  • getTagOrder
  • getTags
  • gettext_pl
  • gettext_th
  • getTheme
  • getThemeFiles
  • getThemeOption
  • getTimezones
  • getTinyMCE4ConfigFiles
  • getTitle
  • getTotalArticles
  • getTotalImagesIn
  • getTotalNewsPages
  • getTotalPages
  • getTrustRoot
  • getUnprotectedImageURL
  • getUrAlbum
  • getURL
  • getUserIP
  • getUserLocale
  • getVersion
  • getViewerImageSize
  • getWatermarkParam
  • getWatermarkPath
  • getWatermarks
  • getWhereClause
  • getXSRFToken
  • getZenpageHitcounter
  • getZenpageRSSHeaderLink
  • getZenpageRSSLink
  • getZenpageStatistic
  • googleVerifyHead
  • handleSearchParms
  • hasDynamicAlbumSuffix
  • hasNextImage
  • hasNextPage
  • hasPrevImage
  • hasPrevPage
  • hitcounter
  • html_decode
  • html_encode
  • html_encodeTagged
  • httpsRedirect
  • httpUploadHandler
  • httpUploadHandler_admin_tabs
  • i18nSetLocale
  • imageBlurGD
  • imageDebug
  • imageError
  • imageNumber
  • imgSrcURI
  • in_context
  • inNewsCategory
  • inProtectedNewsCategory
  • installSignature
  • instrument
  • inSubNewsCategoryOf
  • internalToFilesystem
  • inventMenuItem
  • iptc_make_tag
  • is_AdminEditPage
  • is_connected
  • is_GalleryNewsType
  • is_News
  • is_NewsArchive
  • is_NewsArticle
  • is_NewsCategory
  • is_NewsPage
  • is_NewsType
  • is_Pages
  • is_valid_email_zp
  • is_valid_image
  • is_valid_other_type
  • is_zip
  • isAlbumClass
  • isAlbumPage
  • isArchive
  • isHandledAlbum
  • isImageClass
  • isImagePage
  • isImagePhoto
  • isImageVideo
  • isLandscape
  • isMyAlbum
  • isMyNews
  • isMyPage
  • isolate
  • isProtectedAlbum
  • isProtectedNewsCategory
  • isProtectedPage
  • isSubNewsCategoryOf
  • 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
  • my_truncate_string
  • myts_date
  • newAlbum
  • newImage
  • next_album
  • next_comment
  • next_image
  • next_news
  • next_page
  • ngettext_pl
  • ngettext_th
  • normalizeColumns
  • omsAdditions
  • openedForComments
  • parse_query
  • parse_size
  • parseAllowedTags
  • parseHttpAcceptLanguage
  • passAlbums
  • passImages
  • pathurlencode
  • PclZipUtilCopyBlock
  • PclZipUtilOptionText
  • PclZipUtilPathInclusion
  • PclZipUtilPathReduction
  • PclZipUtilRename
  • PclZipUtilTranslateWinPath
  • PHPMailerAutoload
  • populateManagedObjectsList
  • postAlbumSort
  • postIndexDecode
  • postIndexEncode
  • prefix
  • prepareAlbumPage
  • prepareCustomPage
  • prepareImagePage
  • prepareIndexPage
  • print404status
  • print_language_string_list
  • printAddToFavorites
  • printAdminFooter
  • printAdminHeader
  • printAdminRightsTable
  • printAdminToolbox
  • printAlbumBreadcrumb
  • printAlbumButtons
  • printAlbumCustomData
  • printAlbumData
  • printAlbumDate
  • printAlbumDesc
  • printAlbumEditForm
  • printAlbumEditRow
  • printAlbumLegend
  • printAlbumLink
  • printAlbumLocation
  • printAlbumMap
  • printAlbumMenu
  • printAlbumMenuJump
  • printAlbumMenuList
  • printAlbumMenuListAlbum
  • printAlbumPlace
  • printAlbumRating
  • printAlbumsSelector
  • printAlbumStatistic
  • printAlbumStatisticItem
  • printAlbumThumbImage
  • printAlbumTitle
  • printAlbumURL
  • printAlbumZip
  • printAllDates
  • printAllNewsCategories
  • printAllTags
  • printAllTagsAs
  • printAllTagsFromAlbum
  • printAllTagsFromZenpage
  • printAnnotatedAlbumTitle
  • printAnnotatedImageTitle
  • printArticleCategories
  • printArticleDatesDropdown
  • printArticlesPerPageDropdown
  • printBareAlbumDesc
  • printBareAlbumTitle
  • printBareGalleryDesc
  • printBareGalleryTitle
  • printBareImageDesc
  • printBareImageTitle
  • printBareNewsTitle
  • printBarePageTitle
  • printBulkActions
  • printCaptcha
  • printCategoriesStatistic
  • printCategoryCheckboxListEntry
  • printCategoryDropdown
  • printCategoryListSortableTable
  • printCategorySelection
  • printCodeblock
  • printCodeblockEdit
  • printCommentAuthorLink
  • printCommentErrors
  • printCommentForm
  • printContactForm
  • printCurrentNewsArchive
  • printCurrentNewsCategory
  • printCustomAlbumThumbImage
  • printCustomAlbumThumbMaxSpace
  • printCustomMenu
  • printCustomPageSelector
  • printCustomPageURL
  • printCustomSizedImage
  • printCustomSizedImageMaxHeight
  • printCustomSizedImageMaxSpace
  • printCustomSizedImageThumbMaxSpace
  • printDefaultSizedImage
  • printDownloadAlbumZipURL
  • printDownloadLink
  • printDownloadLinkAlbumZip
  • printdownloadList
  • printDownloadURL
  • printEditable
  • printEditCommentLink
  • printEditDropdown
  • printExpired
  • printFavoritesLink
  • printFavoritesURL
  • printField
  • printGalleryDesc
  • printGalleryIndexURL
  • printGalleryTitle
  • printGoogleMap
  • printHeadTitle
  • printHomeLink
  • printImageCustomData
  • printImageData
  • printImageDate
  • printImageDesc
  • printImageDiv
  • printImageEXIFData
  • printImageID
  • printImageLink
  • printImageMap
  • printImageMetadata
  • printImageRating
  • printImageSortOrder
  • printImageStatistic
  • printImageThumb
  • printImageTitle
  • printImageURL
  • printItemEditLink
  • printItemsList
  • printItemsListTable
  • printItemStatusDropdown
  • printjCarouselThumbNav
  • printjPlayerPlaylist
  • printLanguageSelector
  • printLatestAlbums
  • printLatestComments
  • printLatestImages
  • printLatestImagesByDate
  • printLatestImagesByMtime
  • printLatestNews
  • printLatestUpdatedAlbums
  • printLatestZenpageComments
  • printLink
  • printLinkHTML
  • printLogoAndLinks
  • printManagedObjects
  • printMenuemanagerPageList
  • printMenuemanagerPageListWithNav
  • printMenumanagerBreadcrumb
  • printMenumanagerNextLink
  • printMenumanagerPrevLink
  • printMostPopularItems
  • printMostRatedAlbums
  • printMostRatedImages
  • printMostRatedItems
  • printNestedAlbumsList
  • printNestedItemsList
  • printNestedMenu
  • printNews
  • printNewsArchive
  • printNewsAuthor
  • printNewsCategories
  • printNewsCategoryCustomData
  • printNewsCategoryDesc
  • printNewsCategoryURL
  • printNewsContent
  • printNewsCustomData
  • printNewsDate
  • printNewsExtraContent
  • printNewsImageTags
  • printNewsIndexURL
  • printNewsLink
  • printNewsPageList
  • printNewsPageListWithNav
  • printNewsReadMoreLink
  • printNewsStatistic
  • printNewsTitle
  • printNewsTitleLink
  • printNewsURL
  • printNextNewsLink
  • printNextNewsPageLink
  • printNextPageLink
  • printNextPageURL
  • printPageArticleTags
  • printPageAuthor
  • printPageContent
  • printPageCustomData
  • printPageDate
  • printPagedThumbsNav
  • printPageExtraContent
  • printPageID
  • printPageLastChangeDate
  • printPageLinkURL
  • printPageList
  • printPageListWithNav
  • printPageMenu
  • printPageNav
  • printPageSelector
  • printPagesListTable
  • printPagesStatistic
  • printPageTitle
  • printPageTitleLink
  • printPageURL
  • printParentBreadcrumb
  • printParentPagesBreadcrumb
  • printPasswordForm
  • printPopularAlbums
  • printPopularImages
  • printPreloadScript
  • printPrevNewsLink
  • printPrevNewsPageLink
  • printPrevPageLink
  • printPrevPageURL
  • printPublished
  • printPublishIconLink
  • printRandomImages
  • printRating
  • printRegisterURL
  • printRegistrationForm
  • printRelatedItems
  • printRSSHeaderLink
  • printRSSLink
  • printSearchBreadcrumb
  • printSearchForm
  • printSiteHomeURL
  • printSizedImageLink
  • printSizedImageURL
  • printSlideShow
  • printSlideShowJS
  • printSlideShowLink
  • printSortableHead
  • printSortOrderDropdown
  • printSubPagesExcerpts
  • printSubtabs
  • printTabs
  • printTags
  • printThumbNav
  • printTopRatedAlbums
  • printTopRatedImages
  • printTopRatedItems
  • printUnpublishedDropdown
  • printUserLogin_out
  • printUserSizeImage
  • printUserSizeSelector
  • printVersion
  • printZenJavascripts
  • printZenpageIconLegend
  • printZenpageItemsBreadcrumb
  • printZenpageNewsCategorySelector
  • printZenpagePagesSelector
  • printZenpageRSSHeaderLink
  • printZenpageRSSLink
  • printZenpageStatistic
  • printZenphotoLink
  • process_language_string_save
  • processAlbumBulkActions
  • processAlbumEdit
  • processCodeblockSave
  • processCommentBulkActions
  • processCredentials
  • processCustomOptionSave
  • processEditSelection
  • processExpired
  • processImageBulkActions
  • processImageEdit
  • processManagedObjects
  • processMenuBulkActions
  • processOrder
  • processRights
  • processTags
  • processZenpageBulkActions
  • propSizes
  • publishItem
  • purgeOption
  • query
  • query_full_array
  • query_single_row
  • rc4
  • read_exif_data_protected
  • readTags
  • recaptcha_check_answer
  • recaptcha_get_html
  • recaptcha_get_signup_url
  • recaptcha_mailhide_html
  • recaptcha_mailhide_url
  • reconfigureAction
  • reconfigureCS
  • reconfigurePage
  • recordMissing
  • rem_context
  • removeParentAlbumNames
  • resetCurrentAlbum
  • restore_context
  • reveal
  • rewrite_get_album_image
  • rewrite_path
  • rewrite_path_zenpage
  • RSS_Channel
  • RSS_Retrieve
  • RSS_Tags
  • rulesList
  • run
  • 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
  • setAlbumCustomData
  • setAlbumSubtabs
  • setImageCustomData
  • setMainDomain
  • setOption
  • setOptionDefault
  • setPluginDomain
  • setThemeColumns
  • setThemeDomain
  • setThemeOption
  • setThemeOptionDefault
  • setupAllowedMaps
  • setupCurrentLocale
  • setupDomain
  • setupTheme
  • shortenContent
  • showOrNotShowField
  • shuffle_assoc
  • signatureChange
  • site_upgrade_button
  • site_upgrade_status
  • sitemap_echonl
  • sitemap_getChangefreq
  • sitemap_getDateformat
  • sitemap_getDBLimit
  • sitemap_getISO8601Date
  • skipScheduledPublishing
  • sortByKey
  • sortByMultilingual
  • sortMultiArray
  • standardScripts
  • standardThemeOptions
  • stickyNews
  • storeConfig
  • storeTags
  • stripSuffix
  • submenuOf
  • switchLog
  • tagSelector
  • tagSuggestJS
  • tagSuggestJS_admin
  • tagSuggestJS_frontend
  • themeIsEditable
  • themeSetup
  • timezoneDiff
  • tinymce4ConfigJS
  • truncate_string
  • unpublishedZenphotoItemCheck
  • unpublishSubalbums
  • unQuote
  • unzip
  • updateArticle
  • updateCacheName
  • updateCategory
  • updateConfigItem
  • updateItemSortorder
  • updateItemsSortorder
  • updateMenuItem
  • updatePage
  • upload_extra
  • upload_form
  • upload_head
  • user_mailing_list_button
  • validateLocale
  • wordpress_import_button
  • wp_prefix
  • wp_query_full_array
  • wpimport_TryAgainError
  • XSRFdefender
  • XSRFToken
  • zenJavascript
  • zenpageAlbumImage
  • zenpageBulkActionMessage
  • zenpageHitcounter
  • zenpageJSCSS
  • zenpageOpenedForComments
  • 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_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_start
  • zp_setCookie
  • zp_writeString
  • zpErrorHandler
  • zpFormattedDate
  • zpRewriteURL
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
   1: <?php
   2: 
   3: /**
   4:  * Gallery Class
   5:  * @package classes
   6:  */
   7: // force UTF-8 Ø
   8: $_zp_gallery = new Gallery();
   9: 
  10: class Gallery {
  11: 
  12:     var $albumdir = NULL;
  13:     var $table = 'gallery';
  14:     protected $albums = NULL;
  15:     protected $theme;
  16:     protected $themes;
  17:     protected $lastalbumsort = NULL;
  18:     protected $data = array();
  19:     protected $unprotected_pages = array();
  20: 
  21:     /**
  22:      * Creates an instance of a gallery
  23:      *
  24:      * @return Gallery
  25:      */
  26:     function __construct() {
  27: // Set our album directory
  28:         $this->albumdir = ALBUM_FOLDER_SERVERPATH;
  29:         $data = getOption('gallery_data');
  30:         if ($data) {
  31:             $this->data = getSerializedArray($data);
  32:         }
  33:         if (isset($this->data['unprotected_pages'])) {
  34:             $pages = getSerializedArray($this->data['unprotected_pages']);
  35:             if (is_array($pages))
  36:                 $this->unprotected_pages = $pages; //   protect against a failure
  37:         }
  38:     }
  39: 
  40:     /**
  41:      * Returns the gallery title
  42:      *
  43:      * @return string
  44:      */
  45:     function getTitle($locale = NULL) {
  46:         $text = $this->get('gallery_title');
  47:         if ($locale !== 'all') {
  48:             $text = get_language_string($text, $locale);
  49:         }
  50:         $text = zpFunctions::unTagURLs($text);
  51:         return $text;
  52:     }
  53: 
  54:     /**
  55:      * Returns a tag stripped title
  56:      * @param string $locale
  57:      * @return string
  58:      */
  59:     function getBareTitle($locale = NULL) {
  60:         return getBare($this->getTitle($locale));
  61:     }
  62: 
  63:     function setTitle($title) {
  64:         $this->set('gallery_title', zpFunctions::tagURLs($title));
  65:     }
  66: 
  67:     /**
  68:      * Returns the gallery description
  69:      *
  70:      * @return string
  71:      */
  72:     function getDesc($locale = NULL) {
  73:         $text = $this->get('Gallery_description');
  74:         if ($locale == 'all') {
  75:             return zpFunctions::unTagURLs($text);
  76:         } else {
  77:             return applyMacros(zpFunctions::unTagURLs(get_language_string($text, $locale)));
  78:         }
  79:         return $text;
  80:     }
  81: 
  82:     /**
  83:      * Sets the gallery description
  84:      * @param string $desc
  85:      */
  86:     function setDesc($desc) {
  87:         $desc = zpFunctions::tagURLs($desc);
  88:         $this->set('Gallery_description', $desc);
  89:     }
  90: 
  91:     /**
  92:      * Returns the hashed password for guest gallery access
  93:      *
  94:      */
  95:     function getPassword() {
  96:         if (GALLERY_SECURITY != 'public') {
  97:             return NULL;
  98:         } else {
  99:             return $this->get('gallery_password');
 100:         }
 101:     }
 102: 
 103:     function setPassword($value) {
 104:         $this->set('gallery_password', $value);
 105:     }
 106: 
 107:     /**
 108:      * Returns the hind associated with the gallery password
 109:      *
 110:      * @return string
 111:      */
 112:     function getPasswordHint($locale = NULL) {
 113:         $text = $this->get('gallery_hint');
 114:         if ($locale !== 'all') {
 115:             $text = get_language_string($text, $locale);
 116:         }
 117:         $text = zpFunctions::unTagURLs($text);
 118:         return $text;
 119:     }
 120: 
 121:     function setPasswordHint($value) {
 122:         $this->set('gallery_hint', zpFunctions::tagURLs($value));
 123:     }
 124: 
 125:     function getUser() {
 126:         return($this->get('gallery_user'));
 127:     }
 128: 
 129:     function setUser($value) {
 130:         $this->set('gallery_user', $value);
 131:     }
 132: 
 133:     /**
 134:      * Returns the main albums directory
 135:      *
 136:      * @return string
 137:      */
 138:     function getAlbumDir() {
 139:         return $this->albumdir;
 140:     }
 141: 
 142:     /**
 143:      * Returns the DB field corresponding to the album sort type desired
 144:      *
 145:      * @param string $sorttype the desired sort
 146:      * @return string
 147:      */
 148:     function getAlbumSortKey($sorttype = null) {
 149:         if (empty($sorttype)) {
 150:             $sorttype = $this->getSortType();
 151:         }
 152:         return lookupSortKey($sorttype, 'sort_order', 'albums');
 153:     }
 154: 
 155:     function getSortDirection() {
 156:         return $this->get('sort_direction');
 157:     }
 158: 
 159:     function setSortDirection($value) {
 160:         $this->set('sort_direction', (int) ($value && true));
 161:     }
 162: 
 163:     function getSortType() {
 164:         $type = $this->get('gallery_sorttype');
 165:         return $type;
 166:     }
 167: 
 168:     function setSortType($value) {
 169:         $this->set('gallery_sorttype', $value);
 170:     }
 171: 
 172:     /**
 173:      * Get Albums will create our $albums array with a fully populated set of Album
 174:      * names in the correct order.
 175:      *
 176:      * Returns an array of albums (a pages worth if $page is not zero)
 177:      *
 178:      * @param int $page An option parameter that can be used to return a slice of the array.
 179:      * @param string $sorttype the kind of sort desired
 180:      * @param string $direction set to a direction to override the default option
 181:      * @param bool $care set to false if the order of the albums does not matter
 182:      * @param bool $mine set true/false to override ownership
 183:      *
 184:      * @return  array
 185:      */
 186:     function getAlbums($page = 0, $sorttype = null, $direction = null, $care = true, $mine = NULL) {
 187: 
 188:         // Have the albums been loaded yet?
 189:         if ($mine || is_null($this->albums) || $care && $sorttype . $direction !== $this->lastalbumsort) {
 190: 
 191:             $albumnames = $this->loadAlbumNames();
 192:             $key = $this->getAlbumSortKey($sorttype);
 193:             $albums = $this->sortAlbumArray(NULL, $albumnames, $key, $direction, $mine);
 194: 
 195:             // Store the values
 196:             $this->albums = $albums;
 197:             $this->lastalbumsort = $sorttype . $direction;
 198:         }
 199: 
 200:         if ($page == 0) {
 201:             return $this->albums;
 202:         } else {
 203:             return array_slice($this->albums, galleryAlbumsPerPage() * ($page - 1), galleryAlbumsPerPage());
 204:         }
 205:     }
 206: 
 207:     /**
 208:      * Load all of the albums names that are found in the Albums directory on disk.
 209:      * Returns an array containing this list.
 210:      *
 211:      * @return array
 212:      */
 213:     private function loadAlbumNames() {
 214:         $albumdir = $this->getAlbumDir();
 215:         $dir = opendir($albumdir);
 216:         if (!$dir) {
 217:             if (!is_dir($albumdir)) {
 218:                 $msg .= sprintf(gettext('Error: The “albums” directory (%s) cannot be found.'), $this->albumdir);
 219:             } else {
 220:                 $msg .= sprintf(gettext('Error: The “albums” directory (%s) is not readable.'), $this->albumdir);
 221:             }
 222:             zp_error($msg);
 223:         }
 224:         $albums = array();
 225: 
 226:         while ($dirname = readdir($dir)) {
 227:             if ($dirname{0} != '.' && (is_dir($albumdir . $dirname) || hasDynamicAlbumSuffix($dirname))) {
 228:                 $albums[] = filesystemToInternal($dirname);
 229:             }
 230:         }
 231:         closedir($dir);
 232:         return zp_apply_filter('album_filter', $albums);
 233:     }
 234: 
 235:     /**
 236:      * Returns the a specific album in the array indicated by index.
 237:      * Takes care of bounds checking, no need to check input.
 238:      *
 239:      * @param int $index the index of the album sought
 240:      * @return Album
 241:      */
 242:     function getAlbum($index) {
 243:         $this->getAlbums();
 244:         if ($index >= 0 && $index < $this->getNumAlbums()) {
 245:             return newAlbum($this->albums[$index]);
 246:         } else {
 247:             return false;
 248:         }
 249:     }
 250: 
 251:     /**
 252:      * Returns the total number of TOPLEVEL albums in the gallery (does not include sub-albums)
 253:      * @param bool $db whether or not to use the database (includes ALL detected albums) or the directories
 254:      * @param bool $publishedOnly set to true to exclude un-published albums
 255:      * @return int
 256:      */
 257:     function getNumAlbums($db = false, $publishedOnly = false) {
 258:         $count = -1;
 259:         if (!$db) {
 260:             $this->getAlbums(0, NULL, NULL, false);
 261:             $count = count($this->albums);
 262:         } else {
 263:             $sql = '';
 264:             if ($publishedOnly) {
 265:                 $sql = 'WHERE `show`=1';
 266:             }
 267:             $count = db_count('albums', $sql);
 268:         }
 269:         return $count;
 270:     }
 271: 
 272:     /**
 273:      * Populates the theme array and returns it. The theme array contains information about
 274:      * all the currently available themes.
 275:      * @return array
 276:      */
 277:     function getThemes() {
 278:         if (empty($this->themes)) {
 279:             $themedir = SERVERPATH . "/themes";
 280:             $themes = array();
 281:             if ($dp = @opendir($themedir)) {
 282:                 while (false !== ($dir = readdir($dp))) {
 283:                     if (substr($dir, 0, 1) != "." && is_dir("$themedir/$dir")) {
 284:                         $themefile = $themedir . "/$dir/theme_description.php";
 285:                         $dir8 = filesystemToInternal($dir);
 286:                         if (file_exists($themefile)) {
 287:                             $theme_description = array();
 288:                             require($themefile);
 289:                             $themes[$dir8] = $theme_description;
 290:                         } else {
 291:                             $themes[$dir8] = array('name' => gettext('Unknown'), 'author' => gettext('Unknown'), 'version' => gettext('Unknown'), 'desc' => gettext('<strong>Missing theme info file!</strong>'), 'date' => gettext('Unknown'));
 292:                         }
 293:                     }
 294:                 }
 295:                 ksort($themes, SORT_LOCALE_STRING);
 296:             }
 297:             $this->themes = $themes;
 298:         }
 299:         return $this->themes;
 300:     }
 301: 
 302:     /**
 303:      * Returns the foldername of the current theme.
 304:      * if no theme is set, picks the "first" theme.
 305:      * @return string
 306:      */
 307:     function getCurrentTheme() {
 308:         $theme = NULL;
 309:         if (empty($this->theme)) {
 310:             $theme = $this->get('current_theme');
 311:             if (empty($theme) || !file_exists(SERVERPATH . "/" . THEMEFOLDER . "/$theme")) {
 312:                 $themes = array_keys($this->getThemes());
 313:                 if (!empty($themes)) {
 314:                     $theme = array_shift($themes);
 315:                 }
 316:             }
 317:             $this->theme = $theme;
 318:         }
 319:         return $this->theme;
 320:     }
 321: 
 322:     /**
 323:      * Sets the current theme
 324:      * @param string the name of the current theme
 325:      */
 326:     function setCurrentTheme($theme) {
 327:         $this->set('current_theme', $this->theme = $theme);
 328:     }
 329: 
 330:     /**
 331:      * Returns the number of images in the gallery
 332:      * @param int $what 0: all images from the database
 333:      *                                  1: published images from the database
 334:      *                                  2: "viewable" images via the object model
 335:      * @return int
 336:      */
 337:     function getNumImages($what = 0) {
 338:         switch ((int) $what) {
 339:             case 0:
 340:                 return db_count('images', '');
 341:                 break;
 342:             case 1:
 343:                 $rows = query("SELECT `id` FROM " . prefix('albums') . " WHERE `show`=0");
 344:                 $idlist = array();
 345:                 $exclude = 'WHERE `show`=1';
 346:                 if ($rows) {
 347:                     while ($row = db_fetch_assoc($rows)) {
 348:                         $idlist[] = $row['id'];
 349:                     }
 350:                     if (!empty($idlist)) {
 351:                         $exclude .= ' AND `albumid` NOT IN (' . implode(',', $idlist) . ')';
 352:                     }
 353:                     db_free_result($rows);
 354:                 }
 355:                 return db_count('images', $exclude);
 356:                 break;
 357:             case 2:
 358:                 $count = 0;
 359:                 $albums = $this->getAlbums(0);
 360:                 foreach ($albums as $analbum) {
 361:                     $album = newAlbum($analbum);
 362:                     if (!$album->isDynamic()) {
 363:                         $count = $count + self::getImageCount($album);
 364:                     }
 365:                 }
 366:                 return $count;
 367:                 break;
 368:         }
 369:     }
 370: 
 371:     private function getImageCount($album) {
 372:         $count = $album->getNumImages();
 373:         $albums = $album->getAlbums(0);
 374:         foreach ($albums as $analbum) {
 375:             $album = newAlbum($analbum);
 376:             if (!$album->isDynamic()) {
 377:                 $count = $count + self::getImageCount($album);
 378:             }
 379:         }
 380:         return $count;
 381:     }
 382: 
 383:     /**
 384:      * Returns the count of comments
 385:      *
 386:      * @param bool $moderated set true if you want to see moderated comments
 387:      * @return array
 388:      */
 389:     function getNumComments($moderated = false) {
 390:         $sql = '';
 391:         if (!$moderated) {
 392:             $sql = "WHERE `inmoderation`=0";
 393:         }
 394:         return db_count('comments', $sql);
 395:     }
 396: 
 397:     /** For every album in the gallery, look for its file. Delete from the database
 398:      * if the file does not exist. Do the same for images. Clean up comments that have
 399:      * been left orphaned.
 400:      *
 401:      * Returns true if the operation was interrupted because it was taking too long
 402:      *
 403:      * @param bool $cascade garbage collect every image and album in the gallery.
 404:      * @param bool $complete garbage collect every image and album in the *database* - completely cleans the database.
 405:      * @param  int $restart Image ID to restart scan from
 406:      * @return bool
 407:      */
 408:     function garbageCollect($cascade = true, $complete = false, $restart = '') {
 409:         global $_zp_gallery;
 410:         if (empty($restart)) {
 411:             setOption('last_garbage_collect', time());
 412:             /* purge old search cache items */
 413:             $sql = 'DELETE FROM ' . prefix('search_cache');
 414:             if (!$complete) {
 415:                 $sql .= ' WHERE `date`<' . db_quote(date('Y-m-d H:m:s', time() - SEARCH_CACHE_DURATION * 60));
 416:             }
 417:             $result = query($sql);
 418: 
 419:             /* clean the comments table */
 420:             $this->commentClean('images');
 421:             $this->commentClean('albums');
 422:             $this->commentClean('news');
 423:             $this->commentClean('pages');
 424: // clean up obj_to_tag
 425:             $dead = array();
 426:             $result = query("SELECT * FROM " . prefix('obj_to_tag'));
 427:             if ($result) {
 428:                 while ($row = db_fetch_assoc($result)) {
 429:                     $tbl = $row['type'];
 430:                     $dbtag = query_single_row("SELECT `id` FROM " . prefix('tags') . " WHERE `id`='" . $row['tagid'] . "'", false);
 431:                     if (!$dbtag) {
 432:                         $dead[] = $row['id'];
 433:                     }
 434:                     $dbtag = query_single_row("SELECT `id` FROM " . prefix($tbl) . " WHERE `id`='" . $row['objectid'] . "'", false);
 435:                     if (!$dbtag) {
 436:                         $dead[] = $row['id'];
 437:                     }
 438:                 }
 439:                 db_free_result($result);
 440:             }
 441:             if (!empty($dead)) {
 442:                 $dead = array_unique($dead);
 443:                 query('DELETE FROM ' . prefix('obj_to_tag') . ' WHERE `id`=' . implode(' OR `id`=', $dead));
 444:             }
 445: // clean up admin_to_object
 446:             $dead = array();
 447:             $result = query("SELECT * FROM " . prefix('admin_to_object'));
 448:             if ($result) {
 449:                 while ($row = db_fetch_assoc($result)) {
 450:                     $dbtag = query_single_row("SELECT * FROM " . prefix('administrators') . " WHERE `id`='" . $row['adminid'] . "'", false);
 451:                     if (!$dbtag) {
 452:                         $dead[] = $row['id'];
 453:                     }
 454:                     $tbl = $row['type'];
 455:                     $dbtag = query_single_row("SELECT `id` FROM " . prefix($tbl) . " WHERE `id`='" . $row['objectid'] . "'", false);
 456:                     if (!$dbtag) {
 457:                         $dead[] = $row['id'];
 458:                     }
 459:                 }
 460:                 db_free_result($result);
 461:             }
 462:             if (!empty($dead)) {
 463:                 $dead = array_unique($dead);
 464:                 query('DELETE FROM ' . prefix('admin_to_object') . ' WHERE `id`=' . implode(' OR `id`=', $dead));
 465:             }
 466: // clean up news2cat
 467:             $dead = array();
 468:             $result = query("SELECT * FROM " . prefix('news2cat'));
 469:             if ($result) {
 470:                 while ($row = db_fetch_assoc($result)) {
 471:                     $dbtag = query_single_row("SELECT `id` FROM " . prefix('news') . " WHERE `id`='" . $row['news_id'] . "'", false);
 472:                     if (!$dbtag) {
 473:                         $dead[] = $row['id'];
 474:                     }
 475:                     $dbtag = query_single_row("SELECT `id` FROM " . prefix('news_categories') . " WHERE `id`='" . $row['cat_id'] . "'", false);
 476:                     if (!$dbtag) {
 477:                         $dead[] = $row['id'];
 478:                     }
 479:                 }
 480:                 db_free_result($result);
 481:             }
 482:             if (!empty($dead)) {
 483:                 $dead = array_unique($dead);
 484:                 query('DELETE FROM ' . prefix('news2cat') . ' WHERE `id`=' . implode(' OR `id`=', $dead));
 485:             }
 486: 
 487: // Check for the existence albums
 488:             $dead = array();
 489:             $live = array(''); // purge the root album if it exists
 490:             $deadalbumthemes = array();
 491: // Load the albums from disk
 492:             $result = query("SELECT * FROM " . prefix('albums'));
 493:             while ($row = db_fetch_assoc($result)) {
 494:                 $albumpath = internalToFilesystem($row['folder']);
 495:                 $albumpath_valid = preg_replace('~/\.*/~', '/', $albumpath);
 496:                 $albumpath_valid = ltrim(trim($albumpath_valid, '/'), './');
 497:                 $illegal = $albumpath != $albumpath_valid;
 498:                 $valid = file_exists(ALBUM_FOLDER_SERVERPATH . $albumpath_valid) && (hasDynamicAlbumSuffix($albumpath_valid) || is_dir(ALBUM_FOLDER_SERVERPATH . $albumpath_valid));
 499:                 if ($valid && $illegal) { // maybe there is only one record so we can fix it.
 500:                     $valid = query('UPDATE ' . prefix('albums') . ' SET `folder`=' . db_quote($albumpath_valid) . ' WHERE `id`=' . $row['id'], false);
 501:                     debugLog(sprintf(gettext('Invalid album folder: %1$s %2$s'), $albumpath, $valid ? gettext('fixed') : gettext('discarded')));
 502:                 }
 503:                 if (!$valid || in_array($row['folder'], $live)) {
 504:                     $dead[] = $row['id'];
 505:                     if ($row['album_theme'] !== '') { // orphaned album theme options table
 506:                         $deadalbumthemes[$row['id']] = $row['folder'];
 507:                     }
 508:                 } else {
 509:                     $live[] = $row['folder'];
 510:                 }
 511:             }
 512:             db_free_result($result);
 513: 
 514:             if (count($dead) > 0) { /* delete the dead albums from the DB */
 515:                 asort($dead);
 516:                 $criteria = '(' . implode(',', $dead) . ')';
 517:                 $first = array_pop($dead);
 518:                 $sql1 = "DELETE FROM " . prefix('albums') . " WHERE `id` IN $criteria";
 519:                 $n = query($sql1);
 520:                 if (!$complete && $n && $cascade) {
 521:                     $sql2 = "DELETE FROM " . prefix('images') . " WHERE `albumid` IN $criteria";
 522:                     query($sql2);
 523:                     $sql3 = "DELETE FROM " . prefix('comments') . " WHERE `type`='albums' AND `ownerid` IN $criteria";
 524:                     query($sql3);
 525:                     $sql4 = "DELETE FROM " . prefix('obj_to_tag') . " WHERE `type`='albums' AND `objectid` IN $criteria";
 526:                     query($sql4);
 527:                 }
 528:             }
 529:             if (count($deadalbumthemes) > 0) { // delete the album theme options tables for dead albums
 530:                 foreach ($deadalbumthemes as $id => $deadtable) {
 531:                     $sql = 'DELETE FROM ' . prefix('options') . ' WHERE `ownerid`=' . $id;
 532:                     query($sql, false);
 533:                 }
 534:             }
 535:         }
 536: 
 537:         if ($complete) {
 538:             if (empty($restart)) {
 539:                 /* check album parent linkage */
 540:                 $albums = $_zp_gallery->getAlbums();
 541:                 foreach ($albums as $album) {
 542:                     checkAlbumParentid($album, NULL, 'debuglog');
 543:                 }
 544: 
 545:                 /* refresh 'metadata' albums */
 546:                 $albumids = query("SELECT `id`, `mtime`, `folder`, `dynamic` FROM " . prefix('albums'));
 547:                 if ($albumids) {
 548:                     while ($analbum = db_fetch_assoc($albumids)) {
 549:                         if (($mtime = filemtime(ALBUM_FOLDER_SERVERPATH . internalToFilesystem($analbum['folder']))) > $analbum['mtime']) {
 550: // refresh
 551:                             $album = newAlbum($analbum['folder']);
 552:                             $album->set('mtime', $mtime);
 553:                             if ($this->getAlbumUseImagedate()) {
 554:                                 $album->setDateTime(NULL);
 555:                             }
 556:                             if ($album->isDynamic()) {
 557:                                 $data = file_get_contents($album->localpath);
 558:                                 $thumb = getOption('AlbumThumbSelect');
 559:                                 $words = $fields = '';
 560:                                 while (!empty($data)) {
 561:                                     $data1 = trim(substr($data, 0, $i = strpos($data, "\n")));
 562:                                     if ($i === false) {
 563:                                         $data1 = $data;
 564:                                         $data = '';
 565:                                     } else {
 566:                                         $data = substr($data, $i + 1);
 567:                                     }
 568:                                     if (strpos($data1, 'WORDS=') !== false) {
 569:                                         $words = "words=" . urlencode(substr($data1, 6));
 570:                                     }
 571:                                     if (strpos($data1, 'THUMB=') !== false) {
 572:                                         $thumb = trim(substr($data1, 6));
 573:                                     }
 574:                                     if (strpos($data1, 'FIELDS=') !== false) {
 575:                                         $fields = "&searchfields=" . trim(substr($data1, 7));
 576:                                     }
 577:                                 }
 578:                                 if (!empty($words)) {
 579:                                     if (empty($fields)) {
 580:                                         $fields = '&searchfields=tags';
 581:                                     }
 582:                                 }
 583:                                 $album->set('search_params', $words . $fields);
 584:                                 $album->set('thumb', $thumb);
 585:                             }
 586:                             $album->save();
 587:                             zp_apply_filter('album_refresh', $album);
 588:                         }
 589:                     }
 590:                     db_free_result($albumids);
 591:                 }
 592: 
 593:                 /* Delete all image entries that don't belong to an album at all. */
 594: 
 595:                 $albumids = query("SELECT `id` FROM " . prefix('albums')); /* all the album IDs */
 596:                 $idsofalbums = array();
 597:                 if ($albumids) {
 598:                     while ($row = db_fetch_assoc($albumids)) {
 599:                         $idsofalbums[] = $row['id'];
 600:                     }
 601:                     db_free_result($albumids);
 602:                 }
 603:                 $imageAlbums = query("SELECT DISTINCT `albumid` FROM " . prefix('images')); /* albumids of all the images */
 604:                 $albumidsofimages = array();
 605:                 if ($imageAlbums) {
 606:                     while ($row = db_fetch_assoc($imageAlbums)) {
 607:                         $albumidsofimages[] = $row['albumid'];
 608:                     }
 609:                     db_free_result($imageAlbums);
 610:                 }
 611:                 $orphans = array_diff($albumidsofimages, $idsofalbums); /* albumids of images with no album */
 612: 
 613:                 if (count($orphans) > 0) { /* delete dead images from the DB */
 614:                     $firstrow = array_pop($orphans);
 615:                     $sql = "DELETE FROM " . prefix('images') . " WHERE `albumid`='" . $firstrow . "'";
 616:                     foreach ($orphans as $id) {
 617:                         $sql .= " OR `albumid`='" . $id . "'";
 618:                     }
 619:                     query($sql);
 620: 
 621: // Then go into existing albums recursively to clean them... very invasive.
 622:                     foreach ($this->getAlbums(0) as $folder) {
 623:                         $album = newAlbum($folder);
 624:                         if (!$album->isDynamic()) {
 625:                             if (is_null($album->getDateTime())) { // see if we can get one from an image
 626:                                 $images = $album->getImages(0, 0);
 627:                                 if (count($images) > 0) {
 628:                                     $image = newImage($album, array_shift($images));
 629:                                     $album->setDateTime($image->getDateTime());
 630:                                 }
 631:                             }
 632:                             $album->garbageCollect(true);
 633:                             $album->preLoad();
 634:                         }
 635:                         $album->save();
 636:                         zp_apply_filter('album_refresh', $album);
 637:                     }
 638:                 }
 639:             }
 640: 
 641:             /* Look for image records where the file no longer exists. While at it, check for images with IPTC data to update the DB */
 642: 
 643:             $start = array_sum(explode(" ", microtime())); // protect against too much processing.
 644:             if (!empty($restart)) {
 645:                 $restartwhere = ' WHERE `id`>' . $restart . ' AND `mtime`=0';
 646:             } else {
 647:                 $restartwhere = ' WHERE `mtime`=0';
 648:             }
 649:             define('RECORD_LIMIT', 5);
 650:             $sql = 'SELECT * FROM ' . prefix('images') . $restartwhere . ' ORDER BY `id` LIMIT ' . (RECORD_LIMIT + 2);
 651:             $images = query($sql);
 652:             if ($images) {
 653:                 $c = 0;
 654:                 while ($image = db_fetch_assoc($images)) {
 655:                     $albumobj = getItemByID('albums', $image['albumid']);
 656:                     if ($albumobj->exists && file_exists($imageName = internalToFilesystem(ALBUM_FOLDER_SERVERPATH . $albumobj->name . '/' . $image['filename']))) {
 657:                         if ($image['mtime'] != $mtime = filemtime($imageName)) { // file has changed since we last saw it
 658:                             $imageobj = newImage($albumobj, $image['filename']);
 659:                             $imageobj->set('mtime', $mtime);
 660:                             $imageobj->updateMetaData(); // prime the EXIF/IPTC fields
 661:                             $imageobj->updateDimensions(); // update the width/height & account for rotation
 662:                             $imageobj->save();
 663:                             zp_apply_filter('image_refresh', $imageobj);
 664:                         }
 665:                     } else {
 666:                         $sql = 'DELETE FROM ' . prefix('images') . ' WHERE `id`="' . $image['id'] . '";';
 667:                         $result = query($sql);
 668:                         $sql = 'DELETE FROM ' . prefix('comments') . ' WHERE `type` IN (' . zp_image_types('"') . ') AND `ownerid` ="' . $image['id'] . '";';
 669:                         $result = query($sql);
 670:                     }
 671:                     if (++$c >= RECORD_LIMIT) {
 672:                         return $image['id']; // avoide excessive processing
 673:                     }
 674:                 }
 675:                 db_free_result($images);
 676:             }
 677: // cleanup the tables
 678:             $resource = db_show('tables');
 679:             if ($resource) {
 680:                 while ($row = db_fetch_assoc($resource)) {
 681:                     $tbl = array_shift($row);
 682:                     query('OPTIMIZE TABLE `' . $tbl . '`');
 683:                 }
 684:                 db_free_result($resource);
 685:             }
 686:         }
 687:         return false;
 688:     }
 689: 
 690:     function commentClean($table) {
 691:         $ids = query('SELECT `id` FROM ' . prefix($table)); /* all the IDs */
 692:         $idsofitems = array();
 693:         if ($ids) {
 694:             while ($row = db_fetch_assoc($ids)) {
 695:                 $idsofitems[] = $row['id'];
 696:             }
 697:             db_free_result($ids);
 698:         }
 699:         $sql = "SELECT DISTINCT `ownerid` FROM " . prefix('comments') . ' WHERE `type` =' . db_quote($table);
 700:         $commentOwners = query($sql); /* all the comments */
 701:         $idsofcomments = array();
 702:         if ($commentOwners) {
 703:             while ($row = db_fetch_assoc($commentOwners)) {
 704:                 $idsofcomments [] = $row['ownerid'];
 705:             }
 706:             db_free_result($commentOwners);
 707:         }
 708:         $orphans = array_diff($idsofcomments, $idsofitems); /* owner ids of comments with no owner */
 709: 
 710:         if (count($orphans) > 0) { /* delete dead comments from the DB */
 711:             $sql = "DELETE FROM " . prefix('comments') . " WHERE `type`=" . db_quote($table) . " AND (`ownerid`=" . implode(' OR `ownerid`=', $orphans) . ')';
 712:             query($sql);
 713:         }
 714:     }
 715: 
 716:     /**
 717:      * Cleans out the cache folder
 718:      *
 719:      * @param string $cachefolder the sub-folder to clean
 720:      */
 721:     static function clearCache($cachefolder = NULL) {
 722:         if (is_null($cachefolder)) {
 723:             $cachefolder = SERVERCACHE;
 724:         }
 725:         zpFunctions::removeDir($cachefolder, true);
 726:     }
 727: 
 728:     /**
 729:      * Sort the album array based on either according to the sort key.
 730:      * Default is to sort on the `sort_order` field.
 731:      *
 732:      * Returns an array with the albums in the desired sort order
 733:      *
 734:      * @param array $albums array of album names
 735:      * @param string $sortkey the sorting scheme
 736:      * @param string $sortdirection
 737:      * @param bool $mine set true/false to override ownership
 738:      * @return array
 739:      *
 740:      * @author Todd Papaioannou (lucky@luckyspin.org)
 741:      * @since 1.0.0
 742:      */
 743:     function sortAlbumArray($parentalbum, $albums, $sortkey = '`sort_order`', $sortdirection = NULL, $mine = NULL) {
 744:         if (count($albums) == 0) {
 745:             return array();
 746:         }
 747:         if (is_null($mine) && zp_loggedin(MANAGE_ALL_ALBUM_RIGHTS)) {
 748:             $mine = true;
 749:         }
 750:         if (is_null($parentalbum)) {
 751:             $albumid = ' IS NULL';
 752:             $obj = $this;
 753:             $viewUnpublished = $mine;
 754:         } else {
 755:             $albumid = '=' . $parentalbum->getID();
 756:             $obj = $parentalbum;
 757:             $viewUnpublished = (zp_loggedin() && $obj->albumSubRights() & (MANAGED_OBJECT_RIGHTS_EDIT | MANAGED_OBJECT_RIGHTS_VIEW));
 758:         }
 759: 
 760:         if (($sortkey == '`sort_order`') || ($sortkey == 'RAND()')) { // manual sort is always ascending
 761:             $order = false;
 762:         } else {
 763:             if (!is_null($sortdirection)) {
 764:                 $order = strtoupper($sortdirection) == 'DESC';
 765:             } else {
 766:                 $order = $obj->getSortDirection('album');
 767:             }
 768:         }
 769:         $sortkey = db_quote($sortkey, false);
 770:         $sql = 'SELECT * FROM ' . prefix("albums") . ' WHERE `parentid`' . $albumid . ' ORDER BY ' . $sortkey . ' ' . $sortdirection;
 771:         $result = query($sql);
 772:         $results = array();
 773:         //  check database aganist file system
 774:         while ($row = db_fetch_assoc($result)) {
 775:             $folder = $row['folder'];
 776:             if (($key = array_search($folder, $albums)) !== false) { // album exists in filesystem
 777:                 $results[$row['folder']] = $row;
 778:                 unset($albums[$key]);
 779:             } else { // album no longer exists
 780:                 $id = $row['id'];
 781:                 query("DELETE FROM " . prefix('albums') . " WHERE `id`=$id"); // delete the record
 782:                 query("DELETE FROM " . prefix('comments') . " WHERE `type` ='images' AND `ownerid`= '$id'"); // remove image comments
 783:                 query("DELETE FROM " . prefix('obj_to_tag') . "WHERE `type`='albums' AND `objectid`=" . $id);
 784:                 query("DELETE FROM " . prefix('albums') . " WHERE `id` = " . $id);
 785:             }
 786:         }
 787:         db_free_result($result);
 788:         foreach ($albums as $folder) { // these albums are not in the database
 789:             $albumobj = newAlbum($folder);
 790:             if ($albumobj->exists) { // fail to instantiate?
 791:                 $results[$folder] = $albumobj->getData();
 792:             }
 793:         }
 794:         //  now put the results in the right order
 795:         $results = sortByKey($results, $sortkey, $order);
 796:         //  albums are now in the correct order
 797:         $albums_ordered = array();
 798:         foreach ($results as $row) { // check for visible
 799:             $folder = $row['folder'];
 800:             $album = newAlbum($folder);
 801:             switch (checkPublishDates($row)) {
 802:                 case 1:
 803:                     $album->setShow(0);
 804:                     $album->save();
 805:                 case 2:
 806:                     $row['show'] = 0;
 807:             }
 808: 
 809:             if ($mine || $row['show'] || (($list = $album->isMyItem(LIST_RIGHTS)) && is_null($album->getParent())) || (is_null($mine) && $list && $viewUnpublished)) {
 810:                 $albums_ordered[] = $folder;
 811:             }
 812:         }
 813:         return $albums_ordered;
 814:     }
 815: 
 816:     /**
 817:      * Returns the hitcount
 818:      *
 819:      * @return int
 820:      */
 821:     function getHitcounter() {
 822:         return $this->get('hitcounter');
 823:     }
 824: 
 825:     /**
 826:      * counts visits to the object
 827:      */
 828:     function countHit() {
 829:         $this->set('hitcounter', $this->get('hitcounter') + 1);
 830:         $this->save();
 831:     }
 832: 
 833:     /**
 834:      * Title to be used for the home (not Zenphoto gallery) WEBsite
 835:      */
 836:     function getWebsiteTitle($locale = NULL) {
 837:         $text = $this->get('website_title');
 838:         if ($locale !== 'all') {
 839:             $text = get_language_string($text, $locale);
 840:         }
 841:         $text = zpFunctions::unTagURLs($text);
 842:         return $text;
 843:     }
 844: 
 845:     function setWebsiteTitle($value) {
 846:         $this->set('website_title', zpFunctions::tagURLs($value));
 847:     }
 848: 
 849:     /**
 850:      * The URL of the home (not Zenphoto gallery) WEBsite
 851:      */
 852:     function getWebsiteURL() {
 853:         return $this->get('website_url');
 854:     }
 855: 
 856:     function setWebsiteURL($value) {
 857:         $this->set('website_url', $value);
 858:     }
 859: 
 860:     /**
 861:      * Option to allow only registered users view the site
 862:      */
 863:     function getSecurity() {
 864:         return $this->get('gallery_security');
 865:     }
 866: 
 867:     function setSecurity($value) {
 868:         $this->set('gallery_security', $value);
 869:     }
 870: 
 871:     /**
 872:      * Option to expose the user field on logon forms
 873:      */
 874:     function getUserLogonField() {
 875:         return $this->get('login_user_field');
 876:     }
 877: 
 878:     function setUserLogonField($value) {
 879:         $this->set('login_user_field', $value);
 880:     }
 881: 
 882:     /**
 883:      * Option to update album date from date of new images
 884:      */
 885:     function getAlbumUseImagedate() {
 886:         return $this->get('album_use_new_image_date');
 887:     }
 888: 
 889:     function setAlbumUseImagedate($value) {
 890:         $this->set('album_use_new_image_date', $value);
 891:     }
 892: 
 893:     /**
 894:      * Option to show images in the thumbnail selector
 895:      */
 896:     function getThumbSelectImages() {
 897:         return $this->get('thumb_select_images');
 898:     }
 899: 
 900:     function setThumbSelectImages($value) {
 901:         $this->set('thumb_select_images', $value);
 902:     }
 903: 
 904:     /**
 905:      * Option to show subalbum images in the thumbnail selector
 906:      */
 907:     function getSecondLevelThumbs() {
 908:         return $this->get('multilevel_thumb_select_images');
 909:     }
 910: 
 911:     function setSecondLevelThumbs($value) {
 912:         $this->set('multilevel_thumb_select_images', $value);
 913:     }
 914: 
 915:     /**
 916:      * Option of for gallery sessions
 917:      */
 918:     function getGallerySession() {
 919:         return $this->get('album_session');
 920:     }
 921: 
 922:     function setGallerySession($value) {
 923:         $this->set('album_session', $value);
 924:     }
 925: 
 926:     /**
 927:      *
 928:      * Tests if a page is excluded from password protection
 929:      * @param $page
 930:      */
 931:     function isUnprotectedPage($page) {
 932:         return (in_array($page, $this->unprotected_pages));
 933:     }
 934: 
 935:     function setUnprotectedPage($page, $on) {
 936:         if ($on) {
 937:             array_unshift($this->unprotected_pages, $page);
 938:             $this->unprotected_pages = array_unique($this->unprotected_pages);
 939:         } else {
 940:             $key = array_search($page, $this->unprotected_pages);
 941:             if ($key !== false) {
 942:                 unset($this->unprotected_pages[$key]);
 943:             }
 944:         }
 945:         $this->set('unprotected_pages', serialize($this->unprotected_pages));
 946:     }
 947: 
 948:     function getAlbumPublish() {
 949:         return $this->get('album_publish');
 950:     }
 951: 
 952:     function setAlbumPublish($v) {
 953:         $this->set('album_publish', $v);
 954:     }
 955: 
 956:     function getImagePublish() {
 957:         return $this->get('image_publish');
 958:     }
 959: 
 960:     function setImagePublish($v) {
 961:         $this->set('image_publish', $v);
 962:     }
 963: 
 964:     /**
 965:      * Returns the codeblocks as an serialized array
 966:      *
 967:      * @return array
 968:      */
 969:     function getCodeblock() {
 970:         return zpFunctions::unTagURLs($this->get("codeblock"));
 971:     }
 972: 
 973:     /**
 974:      * set the codeblocks as an serialized array
 975:      *
 976:      */
 977:     function setCodeblock($cb) {
 978:         $this->set('codeblock', zpFunctions::tagURLs($cb));
 979:     }
 980: 
 981:     /**
 982:      * Checks if guest is loggedin for the album
 983:      * @param unknown_type $hint
 984:      * @param unknown_type $show
 985:      */
 986:     function checkforGuest(&$hint = NULL, &$show = NULL) {
 987:         if (!(GALLERY_SECURITY != 'public')) {
 988:             return false;
 989:         }
 990:         $hint = '';
 991:         $pwd = $this->getPassword();
 992:         if (!empty($pwd)) {
 993:             return 'zp_gallery_auth';
 994:         }
 995:         return 'zp_public_access';
 996:     }
 997: 
 998:     /**
 999:      *
1000:      * returns true if there is any protection on the gallery
1001:      */
1002:     function isProtected() {
1003:         return $this->checkforGuest() != 'zp_public_access';
1004:     }
1005: 
1006:     function get($field) {
1007:         if (isset($this->data[$field])) {
1008:             return $this->data[$field];
1009:         }
1010:         return NULL;
1011:     }
1012: 
1013:     function set($field, $value) {
1014:         $this->data[$field] = $value;
1015:     }
1016: 
1017:     function save() {
1018:         setOption('gallery_data', serialize($this->data));
1019:     }
1020: 
1021:     /**
1022:      *
1023:      * "Magic" function to return a string identifying the object when it is treated as a string
1024:      * @return string
1025:      */
1026:     public function __toString() {
1027:         return 'Gallery object';
1028:     }
1029: 
1030:     /**
1031:      * registers object handlers for image varients
1032:      * @global array $_zp_extra_filetypes
1033:      * @param type $suffix
1034:      * @param type $objectName
1035:      */
1036:     static function addImageHandler($suffix, $objectName) {
1037:         global $_zp_extra_filetypes;
1038:         $_zp_extra_filetypes[strtolower($suffix)] = $objectName;
1039:     }
1040: 
1041:     /**
1042:      * Returns true if the file is an image
1043:      *
1044:      * @param string $filename the name of the target
1045:      * @return bool
1046:      */
1047:     static function validImage($filename) {
1048:         global $_zp_supported_images;
1049:         return in_array(getSuffix($filename), $_zp_supported_images);
1050:     }
1051: 
1052:     /**
1053:      * Returns true if the file is handled by an image handler plugin object
1054:      *
1055:      * @param string $filename
1056:      * @return bool
1057:      */
1058:     static function validImageAlt($filename) {
1059:         global $_zp_extra_filetypes;
1060:         return @$_zp_extra_filetypes[getSuffix($filename)];
1061:     }
1062: 
1063:     /**
1064:      * registers object handlers for album varients
1065:      * @global array $_zp_albumHandlers
1066:      * @param type $suffix
1067:      * @param type $objectName
1068:      */
1069:     static function addAlbumHandler($suffix, $objectName) {
1070:         global $_zp_albumHandlers;
1071:         $_zp_albumHandlers[strtolower($suffix)] = $objectName;
1072:     }
1073: 
1074: }
1075: 
1076: ?>
1077: 
Zenphoto doc API documentation generated by ApiGen