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: define('COMMENTS_PER_PAGE', max(1, getOption('comment_form_comments_per_page')));
  3: 
  4: $_zp_comment_stored = array();
  5: 
  6: function comment_form_PaginationJS() {
  7:     ?>
  8:     <script type="text/javascript" src="<?php echo WEBPATH . '/' . ZENFOLDER; ?>/js/jquery.pagination.js"></script>
  9:     <script type="text/javascript">
 10:         function pageselectCallback(page_index, jq) {
 11:             var items_per_page = <?php echo max(1, COMMENTS_PER_PAGE); ?>;
 12:             var max_elem = Math.min((page_index + 1) * items_per_page, $('#comments div.comment').length);
 13:             var newcontent = '';
 14:             for (var i = page_index * items_per_page; i < max_elem; i++) {
 15:                 newcontent += '<div class="comment">' + $('#comments div.comment:nth-child(' + (i + 1) + ')').html() + '</div>';
 16:             }
 17:             $('#Commentresult').html(newcontent);
 18:             return false;
 19:         }
 20:         function initPagination() {
 21:             var startPage;
 22:             if (Comm_ID_found) {
 23:                 startPage = Math.ceil(current_comment_N /<?php echo max(1, COMMENTS_PER_PAGE); ?>) - 1;
 24:             } else {
 25:                 startPage = 0;
 26:             }
 27:             var num_entries = $('#comments div.comment').length;
 28:             if (num_entries) {
 29:                 $(".Pagination").pagination(num_entries, {
 30:                     prev_text: "<?php echo gettext('prev'); ?>",
 31:                     next_text: "<?php echo gettext('next'); ?>",
 32:                     callback: pageselectCallback,
 33:                     load_first_page: true,
 34:                     items_per_page:<?php echo max(1, getOption('comment_form_comments_per_page')); ?>, // Show only one item per page
 35:                     current_page: startPage
 36:                 });
 37:             }
 38:         }
 39:         $(document).ready(function() {
 40:             current_comment_N = $('.comment h4').index($(addrBar_hash)) + 1;
 41:             initPagination();
 42:             if (Comm_ID_found) {
 43:                 $(addrBar_hash).scrollToMe();
 44:             }
 45:         });
 46:         var current_comment_N, addrBar_hash = window.location.hash, Comm_ID_found = !addrBar_hash.search(/#zp_comment_id_/);
 47:         jQuery.fn.extend({
 48:             scrollToMe: function() {
 49:                 var x = jQuery(this).offset().top - 10;
 50:                 jQuery('html,body').animate({scrollTop: x}, 400);
 51:             }});
 52:     </script>
 53:     <?php
 54: }
 55: 
 56: function comment_form_visualEditor() {
 57:     zp_apply_filter('texteditor_config', 'comments');
 58: }
 59: 
 60: /**
 61:  * Admin overview summary
 62:  */
 63: function comment_form_print10Most() {
 64:     ?>
 65:     <div class="box overview-utility">
 66:         <h2 class="h2_bordered"><?php echo gettext("10 Most Recent Comments"); ?></h2>
 67:         <ul>
 68:             <?php
 69:             $comments = fetchComments(10);
 70:             foreach ($comments as $comment) {
 71:                 $id = $comment['id'];
 72:                 $author = $comment['name'];
 73:                 $email = $comment['email'];
 74:                 $link = gettext('<strong>database error</strong> '); // incase of such
 75:                 // ZENPAGE: switch added for zenpage comment support
 76:                 switch ($comment['type']) {
 77:                     case "albums":
 78:                         $album = getItemByID('albums', $comment['ownerid']);
 79:                         if ($album) {
 80:                             $link = "<a href=\"" . $album->getlink() . "\">" . $album->gettitle() . "</a>";
 81:                         }
 82:                         break;
 83:                     case "news": // ZENPAGE: if plugin is installed
 84:                         if (extensionEnabled('zenpage')) {
 85:                             $news = getItemByID('news', $comment['ownerid']);
 86:                             if ($news) {
 87:                                 $link = "<a href=\"" . $news->getLink() . "\">" . $news->getTitle() . "</a> " . gettext("[news]");
 88:                             }
 89:                         }
 90:                         break;
 91:                     case "pages": // ZENPAGE: if plugin is installed
 92:                         if (extensionEnabled('zenpage')) {
 93:                             $page = getItemByID('pages', $comment['ownerid']);
 94:                             if ($page) {
 95:                                 $link = "<a href=\"" . $page->getlink() . "\">" . $page->getTitle() . "</a> " . gettext("[page]");
 96:                             }
 97:                         }
 98:                         break;
 99:                     default: // all of the image types
100:                         $image = getItemByID('images', $comment['ownerid']);
101:                         if ($image) {
102:                             $link = "<a href=\"" . $image->getLink() . "\">" . $image->getTitle() . "</a>";
103:                         }
104:                         break;
105:                 }
106:                 $comment = shortenContent($comment['comment'], 123, '...');
107:                 echo "<li><div class=\"commentmeta\">" . sprintf(gettext('<em>%1$s</em> commented on %2$s:'), $author, $link) . "</div><div class=\"commentbody\">$comment</div></li>";
108:             }
109:             ?>
110:         </ul>
111:     </div>
112:     <?php
113: }
114: 
115: /**
116:  * Processes the post of an address
117:  *
118:  * @param int $i sequence number of the comment
119:  * @return array
120:  */
121: function getCommentAddress($i) {
122:     $result = array();
123:     if (isset($_POST[$i . '-comment_form_website']))
124:         $result['website'] = sanitize($_POST[$i . '-comment_form_website'], 1);
125:     if (isset($_POST[$i . '-comment_form_street']))
126:         $result['street'] = sanitize($_POST[$i . '-comment_form_street'], 1);
127:     if (isset($_POST[$i . '-comment_form_city']))
128:         $result['city'] = sanitize($_POST[$i . '-comment_form_city'], 1);
129:     if (isset($_POST[$i . '-comment_form_state']))
130:         $result['state'] = sanitize($_POST[$i . '-comment_form_state'], 1);
131:     if (isset($_POST[$i . '-comment_form_country']))
132:         $result['country'] = sanitize($_POST[$i . '-comment_form_country'], 1);
133:     if (isset($_POST[$i . '-comment_form_postal']))
134:         $result['postal'] = sanitize($_POST[$i . '-comment_form_postal'], 1);
135:     return $result;
136: }
137: 
138: /**
139:  * Returns an error message if a comment posting was not accepted
140:  *
141:  * @return string
142:  */
143: function getCommentErrors() {
144:     global $_zp_comment_error;
145:     return $_zp_comment_error;
146: }
147: 
148: /**
149:  * Tool to output an error message if a comment posting was not accepted
150:  */
151: function printCommentErrors() {
152:     global $_zp_comment_error, $_zp_comment_on_hold;
153:     if ($_zp_comment_on_hold) {
154:         $s = trim(str_replace($_zp_comment_on_hold, '', trim($_zp_comment_error)));
155:         ?>
156:         <p class="notebox"><?php echo $_zp_comment_on_hold; ?></p>
157:         <?php
158:     } else {
159:         $s = trim($_zp_comment_error);
160:     }
161:     if ($s) {
162:         $lines = explode('.', $s);
163:         foreach ($lines as $key => $line) {
164:             if (empty($line) || $line == gettext('Mail send failed')) {
165:                 unset($lines[$key]);
166:             }
167:         }
168:         ?>
169:         <div class="errorbox">
170:             <h2><?php echo ngettext('Error posting comment:', 'Errors posting comment:', count($lines)); ?></h2>
171:             <ul class="errorlist">
172:                 <?php
173:                 foreach ($lines as $line) {
174:                     echo '<li>' . trim($line) . '</li>';
175:                 }
176:                 ?>
177:             </ul>
178:         </div>
179:         <?php
180:     }
181: }
182: 
183: define('COMMENT_EMAIL_REQUIRED', 1);
184: define('COMMENT_NAME_REQUIRED', 2);
185: define('COMMENT_WEB_REQUIRED', 4);
186: define('USE_CAPTCHA', 8);
187: define('COMMENT_BODY_REQUIRED', 16);
188: define('COMMENT_SEND_EMAIL', 32);
189: 
190: /**
191:  * Generic comment adding routine. Called by album objects or image objects
192:  * to add comments.
193:  *
194:  * Returns a comment object
195:  *
196:  * @param string $name Comment author name
197:  * @param string $email Comment author email
198:  * @param string $website Comment author website
199:  * @param string $comment body of the comment
200:  * @param string $code CAPTCHA code entered
201:  * @param string $code_ok CAPTCHA hash expected
202:  * @param string $type 'albums' if it is an album or 'images' if it is an image comment
203:  * @param object $receiver the object (image or album) to which to post the comment
204:  * @param string $ip the IP address of the comment poster
205:  * @param bool $private set to true if the comment is for the admin only
206:  * @param bool $anon set to true if the poster wishes to remain anonymous
207:  * @param string $customdata
208:  * @param bit $check bitmask of which fields must be checked. If set overrides the options
209:  * @return object
210:  */
211: function comment_form_addComment($name, $email, $website, $comment, $code, $code_ok, $receiver, $ip, $private, $anon, $customdata, $check = false) {
212:     global $_zp_captcha, $_zp_gallery, $_zp_authority, $_zp_comment_on_hold, $_zp_spamFilter;
213:     if ($check === false) {
214:         $whattocheck = 0;
215:         if (getOption('comment_email_required') == 'required')
216:             $whattocheck = $whattocheck | COMMENT_EMAIL_REQUIRED;
217:         if (getOption('comment_name_required'))
218:             $whattocheck = $whattocheck | COMMENT_NAME_REQUIRED;
219:         if (getOption('comment_web_required') == 'required')
220:             $whattocheck = $whattocheck | COMMENT_WEB_REQUIRED;
221:         switch (getOption('Use_Captcha')) {
222:             case 0:
223:                 break;
224:             case 2:
225:                 if (zp_loggedin(POST_COMMENT_RIGHTS)) {
226:                     break;
227:                 }
228:             default:
229:                 $whattocheck = $whattocheck | USE_CAPTCHA;
230:                 break;
231:         }
232:         if (getOption('comment_body_requiired'))
233:             $whattocheck = $whattocheck | COMMENT_BODY_REQUIRED;
234:         IF (getOption('email_new_comments'))
235:             $whattocheck = $whattocheck | COMMENT_SEND_EMAIL;
236:     } else {
237:         $whattocheck = $check;
238:     }
239:     $type = $receiver->table;
240:     $receiver->getComments();
241:     $name = trim($name);
242:     $email = trim($email);
243:     $website = trim($website);
244: // Let the comment have trailing line breaks and space? Nah...
245: // Also (in)validate HTML here, and in $name.
246:     $comment = trim($comment);
247:     $receiverid = $receiver->getID();
248:     $goodMessage = 2;
249:     if ($private)
250:         $private = 1;
251:     else
252:         $private = 0;
253:     if ($anon)
254:         $anon = 1;
255:     else
256:         $anon = 0;
257:     $commentobj = new Comment();
258:     $commentobj->transient = false; // otherwise we won't be able to save it....
259:     $commentobj->setOwnerID($receiverid);
260:     $commentobj->setName($name);
261:     $commentobj->setEmail($email);
262:     $commentobj->setWebsite($website);
263:     $commentobj->setComment($comment);
264:     $commentobj->setType($type);
265:     $commentobj->setIP($ip);
266:     $commentobj->setPrivate($private);
267:     $commentobj->setAnon($anon);
268:     $commentobj->setInModeration(0);
269:     $commentobj->setCustomData($customdata);
270:     if (($whattocheck & COMMENT_EMAIL_REQUIRED) && (empty($email) || !is_valid_email_zp($email))) {
271:         $commentobj->setInModeration(-2);
272:         $commentobj->comment_error_text .= ' ' . gettext("You must supply an e-mail address.");
273:         $goodMessage = false;
274:     }
275:     if (($whattocheck & COMMENT_NAME_REQUIRED) && empty($name)) {
276:         $commentobj->setInModeration(-3);
277:         $commentobj->comment_error_text .= ' ' . gettext("You must enter your name.");
278:         $goodMessage = false;
279:     }
280:     if (($whattocheck & COMMENT_WEB_REQUIRED) && (empty($website) || !isValidURL($website))) {
281:         $commentobj->setInModeration(-4);
282:         $commentobj->comment_error_text .= ' ' . gettext("You must supply a WEB page URL.");
283:         $goodMessage = false;
284:     }
285:     if (($whattocheck & USE_CAPTCHA)) {
286:         if (!$_zp_captcha->checkCaptcha($code, $code_ok)) {
287:             $commentobj->setInModeration(-5);
288:             $commentobj->comment_error_text .= ' ' . gettext("CAPTCHA verification failed.");
289:             $goodMessage = false;
290:         }
291:     }
292:     if (($whattocheck & COMMENT_BODY_REQUIRED) && empty($comment)) {
293:         $commentobj->setInModeration(-6);
294:         $commentobj->comment_error_text .= ' ' . gettext("You must enter something in the comment text.");
295:         $goodMessage = false;
296:     }
297:     $moderate = 0;
298:     if ($goodMessage && isset($_zp_spamFilter)) {
299:         $goodMessage = $_zp_spamFilter->filterMessage($name, $email, $website, $comment, $receiver, $ip);
300:         switch ($goodMessage) {
301:             case 0:
302:                 $commentobj->setInModeration(2);
303:                 $commentobj->comment_error_text .= sprintf(gettext('Your comment was rejected by the <em>%s</em> SPAM filter.'), $_zp_spamFilter->name);
304:                 $goodMessage = false;
305:                 break;
306:             case 1:
307:                 $_zp_comment_on_hold = sprintf(gettext('Your comment has been marked for moderation by the <em>%s</em> SPAM filter.'), $_zp_spamFilter->name);
308:                 $commentobj->comment_error_text .= $_zp_comment_on_hold;
309:                 $commentobj->setInModeration(1);
310:                 $moderate = 1;
311:                 break;
312:             case 2:
313:                 $commentobj->setInModeration(0);
314:                 break;
315:         }
316:     }
317:     $localerrors = $commentobj->getInModeration();
318:     zp_apply_filter('comment_post', $commentobj, $receiver);
319:     if ($check === false) {
320:         // ignore filter provided errors if caller is supplying the fields to check
321:         $localerrors = $commentobj->getInModeration();
322:     }
323:     if ($goodMessage && $localerrors >= 0) {
324:         // Update the database entry with the new comment
325:         $commentobj->save();
326:         //  add to comments array and notify the admin user
327:         if (!$moderate) {
328:             $receiver->comments[] = array('name'                 => $commentobj->getname(),
329:                             'email'              => $commentobj->getEmail(),
330:                             'website'            => $commentobj->getWebsite(),
331:                             'comment'            => $commentobj->getComment(),
332:                             'date'               => $commentobj->getDateTime(),
333:                             'custom_data'    => $commentobj->getCustomData());
334:         }
335:         switch ($type) {
336:             case "albums":
337:                 $url = "album=" . pathurlencode($receiver->name);
338:                 $ur_album = getUrAlbum($receiver);
339:                 if ($moderate) {
340:                     $action = sprintf(gettext('A comment has been placed in moderation on your album “%1$s”.'), $receiver->name);
341:                 } else {
342:                     $action = sprintf(gettext('A comment has been posted on your album “%1$s”.'), $receiver->name);
343:                 }
344:                 break;
345:             case "news":
346:                 $url = "p=news&title=" . urlencode($receiver->getTitlelink());
347:                 if ($moderate) {
348:                     $action = sprintf(gettext('A comment has been placed in moderation on your article “%1$s”.'), $receiver->getTitlelink());
349:                 } else {
350:                     $action = sprintf(gettext('A comment has been posted on your article “%1$s”.'), $receiver->getTitlelink());
351:                 }
352:                 break;
353:             case "pages":
354:                 $url = "p=pages&title=" . urlencode($receiver->getTitlelink());
355:                 if ($moderate) {
356:                     $action = sprintf(gettext('A comment has been placed in moderation on your page “%1$s”.'), $receiver->getTitlelink());
357:                 } else {
358:                     $action = sprintf(gettext('A comment has been posted on your page “%1$s”.'), $receiver->getTitlelink());
359:                 }
360:                 break;
361:             default: // all image types
362:                 $album = $receiver->getAlbum();
363:                 $url = "album=" . pathurlencode($album->name) . "&image=" . urlencode($receiver->filename);
364:                 $ur_album = getUrAlbum($album);
365:                 if ($moderate) {
366:                     $action = sprintf(gettext('A comment has been placed in moderation on your image “%1$s” in the album “%2$s”.'), $receiver->getTitle(), $album->name);
367:                 } else {
368:                     $action = sprintf(gettext('A comment has been posted on your image “%1$s” in the album “%2$s”.'), $receiver->getTitle(), $album->name);
369:                 }
370:                 break;
371:         }
372:         if (($whattocheck & COMMENT_SEND_EMAIL)) {
373:             $message = $action . "\n\n" .
374:                             sprintf(gettext('Author: %1$s' . "\n" . 'Email: %2$s' . "\n" . 'Website: %3$s' . "\n" . 'Comment:' . "\n\n" . '%4$s'), $commentobj->getname(), $commentobj->getEmail(), $commentobj->getWebsite(), $commentobj->getComment()) . "\n\n" .
375:                             sprintf(gettext('You can view all comments about this item here:' . "\n" . '%1$s'), 'http://' . $_SERVER['SERVER_NAME'] . WEBPATH . '/index.php?' . $url) . "\n\n" .
376:                             sprintf(gettext('You can edit the comment here:' . "\n" . '%1$s'), 'http://' . $_SERVER['SERVER_NAME'] . WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/comment_form/admin-comments.php?page=editcomment&id=' . $commentobj->getID());
377:             $emails = array();
378:             $admin_users = $_zp_authority->getAdministrators();
379:             foreach ($admin_users as $admin) {
380:                 // mail anyone with full rights
381:                 if (!empty($admin['email']) && (($admin['rights'] & ADMIN_RIGHTS) ||
382:                                 (($admin['rights'] & (MANAGE_ALL_ALBUM_RIGHTS | COMMENT_RIGHTS)) == (MANAGE_ALL_ALBUM_RIGHTS | COMMENT_RIGHTS)))) {
383:                     $emails[] = $admin['email'];
384:                     unset($admin_users[$admin['id']]);
385:                 }
386:             }
387:             if ($type === "images" OR $type === "albums") {
388:                 // mail to album admins
389:                 $id = $ur_album->getID();
390:                 $sql = 'SELECT `adminid` FROM ' . prefix('admin_to_object') . ' WHERE `objectid`=' . $id . ' AND `type` LIKE "album%"';
391:                 $result = query($sql);
392:                 if ($result) {
393:                     while ($anadmin = db_fetch_assoc($result)) {
394:                         $id = $anadmin['adminid'];
395:                         if (array_key_exists($id, $admin_users)) {
396:                             $admin = $admin_users[$id];
397:                             if (($admin['rights'] & COMMENT_RIGHTS) && !empty($admin['email'])) {
398:                                 $emails[] = $admin['email'];
399:                             }
400:                         }
401:                     }
402:                     db_free_result($result);
403:                 }
404:             }
405:             $on = gettext('Comment posted');
406:             $result = zp_mail("[" . $_zp_gallery->getTitle() . "] $on", $message, $emails);
407:             if ($result) {
408:                 $commentobj->setInModeration(-12);
409:                 $commentobj->comment_error_text = $result;
410:             }
411:         }
412:     }
413:     return $commentobj;
414: }
415: 
416: /**
417:  * Use see if a captcha should be displayed
418:  * @return boolean
419:  */
420: function commentFormUseCaptcha() {
421:     switch (getOption('Use_Captcha')) {
422:         case 0:
423:             return false;
424:         case 2:
425:             return !zp_loggedin(POST_COMMENT_RIGHTS);
426:         default:
427:             return true;
428:     }
429: }
430: 
431: /**
432:  *
433:  * checks if comments are allowed and then processes them if so
434:  * @param string $error
435:  */
436: function comment_form_postcomment($error) {
437:     global $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_news, $_zp_current_zenpage_page;
438:     if (( (commentsAllowed('comment_form_albums') && in_context(ZP_ALBUM) && !in_context(ZP_IMAGE) && $_zp_current_album->getCommentsAllowed()) ||
439:                     (commentsAllowed('comment_form_images') && in_context(ZP_IMAGE) && $_zp_current_image->getCommentsAllowed()) ||
440:                     (commentsAllowed('comment_form_articles') && in_context(ZP_ZENPAGE_NEWS_ARTICLE) && $_zp_current_zenpage_news->getCommentsAllowed()) ||
441:                     (commentsAllowed('comment_form_pages') && in_context(ZP_ZENPAGE_PAGE) && $_zp_current_zenpage_page->getCommentsAllowed()))
442:     ) {
443:         $error = comment_form_handle_comment();
444:     }
445:     return $error;
446: }
447: 
448: /**
449:  *
450:  * Handles the POSTing of a comment
451:  * @return NULL|boolean
452:  */
453: function comment_form_handle_comment() {
454:     global $_zp_current_image, $_zp_current_album, $_zp_comment_stored, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_HTML_cache;
455:     $comment_error = 0;
456:     $cookie = zp_getCookie('zenphoto_comment');
457:     if (isset($_POST['comment']) && (!isset($_POST['username']) || empty($_POST['username']))) { // 'username' is a honey-pot trap
458:         /*
459:          * do not save the post page in the cache
460:          * Also the cache should be cleared so that a new page is saved at the first non-comment posting viewing.
461:          * But this has to wait until processing is finished to avoid race conditions.
462:          */
463:         $_zp_HTML_cache->disable();
464:         if (in_context(ZP_IMAGE)) {
465:             $commentobject = $_zp_current_image;
466:             $redirectTo = $_zp_current_image->getLink();
467:         } else if (in_context(ZP_ALBUM)) {
468:             $commentobject = $_zp_current_album;
469:             $redirectTo = $_zp_current_album->getLink();
470:         } else if (in_context(ZP_ZENPAGE_NEWS_ARTICLE)) {
471:             $commentobject = $_zp_current_zenpage_news;
472:             $redirectTo = FULLWEBPATH . '/index.php?p=news&title=' . $_zp_current_zenpage_news->getTitlelink();
473:         } else if (in_context(ZP_ZENPAGE_PAGE)) {
474:             $commentobject = $_zp_current_zenpage_page;
475:             $redirectTo = FULLWEBPATH . '/index.php?p=pages&title=' . $_zp_current_zenpage_page->getTitlelink();
476:         } else {
477:             $commentobject = NULL;
478:             $error = gettext('Comment posted on unknown page!');
479:         }
480:         if (is_object($commentobject)) {
481:             if (isset($_POST['name'])) {
482:                 $p_name = sanitize($_POST['name'], 3);
483:             } else {
484:                 $p_name = NULL;
485:             }
486:             if (isset($_POST['email'])) {
487:                 $p_email = sanitize($_POST['email'], 3);
488:                 if (!is_valid_email_zp($p_email)) {
489:                     $p_email = NULL;
490:                 }
491:             } else {
492:                 $p_email = NULL;
493:             }
494:             if (isset($_POST['website'])) {
495:                 $p_website = sanitize($_POST['website'], 3);
496:                 if ($p_website && strpos($p_website, 'http') !== 0) {
497:                     $p_website = 'http://' . $p_website;
498:                 }
499:                 if (!isValidURL($p_website)) {
500:                     $p_website = NULL;
501:                 }
502:             } else {
503:                 $p_website = NULL;
504:             }
505:             if (isset($_POST['comment'])) {
506:                 $p_comment = sanitize($_POST['comment'], 1);
507:             } else {
508:                 $p_comment = '';
509:             }
510:             $p_server = getUserIP();
511:             if (isset($_POST['code'])) {
512:                 $code1 = sanitize($_POST['code'], 3);
513:                 $code2 = sanitize($_POST['code_h'], 3);
514:             } else {
515:                 $code1 = '';
516:                 $code2 = '';
517:             }
518:             $p_private = isset($_POST['private']);
519:             $p_anon = isset($_POST['anon']);
520: 
521:             $commentadded = $commentobject->addComment($p_name, $p_email, $p_website, $p_comment, $code1, $code2, $p_server, $p_private, $p_anon, serialize(getCommentAddress(0)));
522: 
523:             $comment_error = $commentadded->getInModeration();
524:             $_zp_comment_stored = array('name'       => $commentadded->getName(),
525:                             'email'      => $commentadded->getEmail(),
526:                             'website'    => $commentadded->getWebsite(),
527:                             'comment'    => $commentadded->getComment(),
528:                             'saved'      => isset($_POST['remember']),
529:                             'private'    => $commentadded->getPrivate(),
530:                             'anon'       => $commentadded->getAnon(),
531:                             'custom'     => $commentadded->getCustomData()
532:             );
533: 
534:             if ($comment_error) {
535:                 $error = $commentadded->comment_error_text;
536:                 $comment_error++;
537:             } else {
538:                 $_zp_HTML_cache->clearHtmlCache();
539:                 $error = NULL;
540:                 if (isset($_POST['remember'])) {
541:                     // Should always re-cookie to update info in case it's changed...
542:                     $_zp_comment_stored['comment'] = ''; // clear the comment itself
543:                     zp_setCookie('zenphoto_comment', serialize($_zp_comment_stored));
544:                 } else {
545:                     zp_clearCookie('zenphoto_comment');
546:                 }
547:                 //use $redirectTo to send users back to where they came from instead of booting them back to the gallery index. (default behaviour)
548:                 if (!isset($_SERVER['SERVER_SOFTWARE']) || strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'microsoft-iis') === false) {
549:                     // but not for Microsoft IIS because that server fails if we redirect!
550:                     header('Location: ' . $redirectTo . '#zp_comment_id_' . $commentadded->getId());
551:                     exitZP();
552:                 }
553:             }
554:         }
555:         return $error;
556:     } else {
557:         if (!empty($cookie)) {
558:             $cookiedata = getSerializedArray($cookie);
559:             if (count($cookiedata) > 1) {
560:                 $_zp_comment_stored = $cookiedata;
561:             }
562:         }
563:     }
564:     return false;
565: }
566: 
567: /**
568:  * Returns the comment author's name
569:  *
570:  * @return string
571:  */
572: function getCommentAuthorName() {
573:     global $_zp_current_comment;
574:     return $_zp_current_comment['name'];
575: }
576: 
577: /**
578:  * Returns the comment author's email
579:  *
580:  * @return string
581:  */
582: function getCommentAuthorEmail() {
583:     global $_zp_current_comment;
584:     return $_zp_current_comment['email'];
585: }
586: 
587: /**
588:  * Returns the comment author's website
589:  *
590:  * @return string
591:  */
592: function getCommentAuthorSite() {
593:     global $_zp_current_comment;
594:     return $_zp_current_comment['website'];
595: }
596: 
597: /**
598:  * Prints a link to the author
599:  *
600:  * @param string $title URL title tag
601:  * @param string $class optional class tag
602:  * @param string $id optional id tag
603:  */
604: function getCommentAuthorLink($title = NULL, $class = NULL, $id = NULL) {
605:     global $_zp_current_comment;
606:     $name = $_zp_current_comment['name'];
607:     if ($_zp_current_comment['anon']) {
608:         $site = NULL;
609:     } else {
610:         $site = $_zp_current_comment['website'];
611:     }
612:     if (empty($site)) {
613:         return html_encode($_zp_current_comment['name']);
614:     } else {
615:         if (is_null($title)) {
616:             $title = "Visit " . $name;
617:         }
618:         return getLinkHTML($site, $_zp_current_comment['name'], $title, $class, $id);
619:     }
620: }
621: 
622: /**
623:  * Prints a link to the author
624:  *
625:  * @param string $title URL title tag
626:  * @param string $class optional class tag
627:  * @param string $id optional id tag
628:  */
629: function printCommentAuthorLink($title = NULL, $class = NULL, $id = NULL) {
630:     echo getCommentAuthorLink($title, $class, $id);
631: }
632: 
633: /**
634:  * Returns a formatted date and time for the comment.
635:  * Uses the "date_format" option for the formatting unless
636:  * a format string is passed.
637:  *
638:  * @param string $format 'strftime' date/time format
639:  * @return string
640:  */
641: function getCommentDateTime($format = NULL) {
642:     if (is_null($format)) {
643:         $format = DATE_FORMAT;
644:     }
645:     global $_zp_current_comment;
646:     return myts_date($format, $_zp_current_comment['date']);
647: }
648: 
649: /**
650:  * Returns the body of the current comment
651:  *
652:  * @return string
653:  */
654: function getCommentBody() {
655:     global $_zp_current_comment;
656:     return str_replace("\n", "<br />", stripslashes($_zp_current_comment['comment']));
657: }
658: 
659: /**
660:  * Creates a link to the admin comment edit page for the current comment
661:  *
662:  * @param string $text Link text
663:  * @param string $before text to go before the link
664:  * @param string $after text to go after the link
665:  * @param string $title title text
666:  * @param string $class optional css clasee
667:  * @param string $id optional css id
668:  */
669: function printEditCommentLink($text, $before = '', $after = '', $title = NULL, $class = NULL, $id = NULL) {
670:     global $_zp_current_comment;
671:     if (zp_loggedin(COMMENT_RIGHTS)) {
672:         if ($before) {
673:             echo '<span class="beforetext">' . html_encode($before) . '</span>';
674:         }
675:         printLinkHTML(WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/comment_form//admin-comments.php?page=editcomment&id=' . $_zp_current_comment['id'], $text, $title, $class, $id);
676:         if ($after) {
677:             echo '<span class="aftertext">' . html_encode($after) . '</span>';
678:         }
679:     }
680: }
681: 
682: /**
683:  * Gets latest comments for images, albums, news and pages
684:  *
685:  * @param int $number how many comments you want.
686:  * @param string $type  "all" for all latest comments of all images, albums, news and pages
687:  *                                          an array of table items e.g. array('images','albums') for all images, albums, news and pages
688:  *                                          "image" for the lastest comments of one specific image
689:  *                                          "album" for the latest comments of one specific album
690:  *                                          "news" for the latest comments of one specific news article
691:  *                                          "page" for the latest comments of one specific Page
692:  * @param int $id the record id of element to get the comments for if $type != "all"
693:  */
694: function getLatestComments($number, $type = "all", $id = NULL) {
695:     global $_zp_gallery;
696:     $albumcomment = $imagecomment = NULL;
697:     $comments = array();
698:     $whereclause = '';
699:     switch ($type) {
700:         case is_array($type):
701:             $whereclause = ' AND `type` IN ("' . implode('","', $type) . '")';
702:         case 'all':
703:             $sql = 'SELECT * FROM ' . prefix('comments') . ' WHERE `private`=0 AND `inmoderation`=0' . $whereclause . ' ORDER BY `date` DESC';
704:             $commentsearch = query($sql);
705:             if ($commentsearch) {
706:                 while ($number > 0 && $commentcheck = db_fetch_assoc($commentsearch)) {
707:                     $item = getItemByID($commentcheck['type'], $commentcheck['ownerid']);
708:                     if ($item && $item->checkAccess()) {
709:                         $number--;
710:                         $commentcheck['albumtitle'] = $commentcheck['titlelink'] = $commentcheck['folder'] = $commentcheck['filename'] = '';
711:                         $commentcheck['title'] = $item->getTitle('all');
712:                         switch ($item->table) {
713:                             case 'albums':
714:                                 $commentcheck['folder'] = $item->getFileName();
715:                                 $commentcheck['albumtitle'] = $commentcheck['title'];
716:                                 break;
717:                             case 'images':
718:                                 $commentcheck['filename'] = $item->filename;
719:                                 $commentcheck['folder'] = $item->album->name;
720:                                 $commentcheck['albumtitle'] = $item->album->getTitle('all');
721:                                 break;
722:                             case 'news':
723:                             case 'pages':
724:                                 $commentcheck['titlelink'] = $item->getTitlelink();
725:                                 break;
726:                         }
727:                         $commentcheck['pubdate'] = $commentcheck['date']; //    for RSS
728:                         $comments[] = $commentcheck;
729:                     }
730:                 }
731:                 db_free_result($commentsearch);
732:             }
733:             return $comments;
734:         case 'album':
735:             if ($item = getItemByID('albums', $id)) {
736:                 $comments = array_slice($item->getComments(), 0, $number);
737:                 // add the other stuff people want
738:                 foreach ($comments as $key => $comment) {
739:                     $comment['pubdate'] = $comment['date'];
740:                     $alb = getItemByID('albums', $comment['ownerid']);
741:                     $comment['folder'] = $alb->name;
742:                     $comment['albumtitle'] = $item->getTitle('all');
743:                     $comments[$key] = $comment;
744:                 }
745:                 return $comments;
746:             } else {
747:                 return array();
748:             }
749:         case 'image':
750:             if ($item = getItemByID('images', $id)) {
751:                 $comments = array_slice($item->getComments(), 0, $number);
752:                 // add the other stuff people want
753:                 foreach ($comments as $key => $comment) {
754:                     $comment['pubdate'] = $comment['date'];
755:                     $img = getItemByID('images', $comment['ownerid']);
756:                     $comment['folder'] = $img->album->name;
757:                     $comment['filename'] = $img->filename;
758:                     $comment['title'] = $item->getTitle('all');
759:                     $comment['albumtitle'] = $img->album->getTitle('all');
760:                     $comments[$key] = $comment;
761:                 }
762:                 return $comments;
763:             } else {
764:                 return array();
765:             }
766:         case 'news':
767:             if ($item = getItemByID('news', $id)) {
768:                 $comments = array_slice($item->getComments(), 0, $number);
769:                 // add the other stuff people want
770:                 foreach ($comments as $key => $comment) {
771:                     $comment['pubdate'] = $comment['date'];
772:                     $comment['titlelink'] = $item->getTitlelink();
773:                     $comment['title'] = $item->getTitle('all');
774:                     $comments[$key] = $comment;
775:                 }
776:                 return $comments;
777:             } else {
778:                 return array();
779:             }
780:         case 'page':
781:             if ($item = getItemByID('pages', $id)) {
782:                 $comments = array_slice($item->getComments(), 0, $number);
783:                 // add the other stuff people want
784:                 foreach ($comments as $key => $comment) {
785:                     $comment['pubdate'] = $comment['date'];
786:                     $comment['titlelink'] = $item->getTitlelink();
787:                     $comment['title'] = $item->getTitle('all');
788:                     $comments[$key] = $comment;
789:                 }
790:                 return $comments;
791:             } else {
792:                 return array();
793:             }
794:     }
795: }
796: 
797: /**
798:  * Prints latest comments for images, albums, news and pages
799:  *
800:  * @param int $number how many comments you want.
801:  * @param int $shorten how many characters you want to show in the excerpt.
802:  * @param string $type  "all" for all latest comments of all images, albums, news and pages
803:  *                                          an array of table items e.g. array('images','albums', 'news', 'pages') for all images, albums, news and pages
804:  *                                          "image" for the lastest comments of one specific image
805:  *                                          "album" for the latest comments of one specific album
806:  *                                          "news" for the latest comments of one specific news article
807:  *                                          "page" for the latest comments of one specific Page
808:  * @param int $item the record id of element to get the comments for if $type != "all".
809:  * @param string $ulid id for the <ul> element.
810:  * @param string $shortenindicator indicator to show that the string is truncated.
811:  */
812: function printLatestComments($number, $shorten = '123', $type = "all", $item = NULL, $ulid = 'showlatestcomments', $shortenindicator = '...') {
813:     $comments = getLatestComments($number, $type, $item);
814:     echo '<ul id="' . $ulid . $item . "\">\n";
815:     foreach ($comments as $comment) {
816:         if ($comment['anon'] === "0") {
817:             $author = " " . gettext("by") . " " . $comment['name'];
818:         } else {
819:             $author = "";
820:         }
821:         $shortcomment = shortenContent($comment['comment'], $shorten, $shortenindicator);
822:         $website = $comment['website'];
823:         $date = $comment['date'];
824:         switch ($comment['type']) {
825:             case 'albums':
826:                 $album = getItemByID('albums', $comment['ownerid']);
827:                 if ($album) {
828:                     echo '<li><a href="' . $album->getLink() . '" class="commentmeta">' . $album->getTitle() . $author . "</a><br />\n";
829:                     echo '<span class="commentbody">' . $shortcomment . '</span></li>';
830:                 }
831:                 break;
832:             case 'images':
833:                 $image = getItemByID('images', $comment['ownerid']);
834:                 if ($image) {
835:                     echo '<li><a href="' . $image->getLink() . '" class="commentmeta">' . $image->album->gettitle() . ': ' . $image->getTitle() . $author . "</a><br />\n";
836:                     echo '<span class="commentbody">' . $shortcomment . '</span></li>';
837:                 }
838:                 break;
839:             case 'news':
840:                 $news = getItemByID('news', $comment['ownerid']);
841:                 if ($news) {
842:                     echo '<li><a href="' . $news->getLink() . '" class="commentmeta">' . gettext('News') . ':' . $news->getTitle() . $author . "</a><br />\n";
843:                     echo '<span class="commentbody">' . $shortcomment . '</span></li>';
844:                 }
845:                 break;
846:             case 'pages':
847:                 $page = getItemByID('news', $comment['ownerid']);
848:                 if ($page) {
849:                     echo '<li><a href="' . $page->getLink() . '" class="commentmeta">' . gettext('News') . ':' . $page->getTitle() . $author . "</a><br />\n";
850:                     echo '<span class="commentbody">' . $shortcomment . '</span></li>';
851:                 }
852:                 break;
853:         }
854:     }
855:     echo "</ul>\n";
856: }
857: 
858: /**
859:  * Retuns the count of comments on the current image
860:  *
861:  * @return int
862:  */
863: function getCommentCount() {
864:     global $_zp_current_image, $_zp_current_album, $_zp_current_zenpage_page, $_zp_current_zenpage_news;
865:     if (in_context(ZP_IMAGE) && in_context(ZP_ALBUM)) {
866:         if (is_null($_zp_current_image))
867:             return false;
868:         return $_zp_current_image->getCommentCount();
869:     } else if (!in_context(ZP_IMAGE) && in_context(ZP_ALBUM)) {
870:         if (is_null($_zp_current_album))
871:             return false;
872:         return $_zp_current_album->getCommentCount();
873:     }
874:     if (function_exists('is_News')) {
875:         if (is_News()) {
876:             return $_zp_current_zenpage_news->getCommentCount();
877:         }
878:         if (is_Pages()) {
879:             return $_zp_current_zenpage_page->getCommentCount();
880:         }
881:     }
882: }
883: 
884: /**
885:  * Iterate through comments; use the ZP_COMMENT context.
886:  * Return true if there are more comments
887:  * @param  bool $desc set true for desecnding order
888:  *
889:  * @return bool
890:  */
891: function next_comment($desc = false) {
892:     global $_zp_current_image, $_zp_current_album, $_zp_current_comment, $_zp_comments, $_zp_current_zenpage_page, $_zp_current_zenpage_news;
893: //ZENPAGE: comments support
894:     if (is_null($_zp_current_comment)) {
895:         if (in_context(ZP_IMAGE) AND in_context(ZP_ALBUM)) {
896:             if (is_null($_zp_current_image))
897:                 return false;
898:             $_zp_comments = $_zp_current_image->getComments(false, false, $desc);
899:         } else if (!in_context(ZP_IMAGE) AND in_context(ZP_ALBUM)) {
900:             $_zp_comments = $_zp_current_album->getComments(false, false, $desc);
901:         }
902:         if (function_exists('is_NewsArticle')) {
903:             if (is_NewsArticle()) {
904:                 $_zp_comments = $_zp_current_zenpage_news->getComments(false, false, $desc);
905:             }
906:             if (is_Pages()) {
907:                 $_zp_comments = $_zp_current_zenpage_page->getComments(false, false, $desc);
908:             }
909:         }
910:         if (empty($_zp_comments)) {
911:             return false;
912:         }
913:     } else if (empty($_zp_comments)) {
914:         $_zp_comments = NULL;
915:         $_zp_current_comment = NULL;
916:         rem_context(ZP_COMMENT);
917:         return false;
918:     }
919:     $_zp_current_comment = array_shift($_zp_comments);
920:     if ($_zp_current_comment['anon']) {
921:         $_zp_current_comment['email'] = $_zp_current_comment['name'] = '<' . gettext("Anonymous") . '>';
922:     }
923:     add_context(ZP_COMMENT);
924:     return true;
925: }
926: 
927: /**
928:  * Returns the data from the last comment posted
929:  * @param bool $numeric Set to true for old themes to get 0->6 indices rather than descriptive ones
930:  *
931:  * @return array
932:  */
933: function getCommentStored($numeric = false) {
934:     global $_zp_comment_stored;
935:     if ($numeric) {
936:         return array_merge($_zp_comment_stored);
937:     }
938:     return $_zp_comment_stored;
939: }
940: 
941: 
942:     /**
943:      * Takes a comment and makes the body of an email.
944:      *
945:      * @param obj $obj Object of the item commented on
946:      * @param string $author Comment author
947:      * @param string $fullcomment The comment itself
948:      * @return string
949:      */
950:     function commentReply($obj, $author, $fullcomment) {
951:   if (is_object($obj)) {
952:     $comment = ": %0D%0A%0D%0A" . implode('%0D%0A', explode('\n', wordwrap(getBare($fullcomment), 75, '\n')));
953:     $message = '';
954:     switch ($obj->table) {
955:       case 'albums':
956:         $title = $obj->getTitle();
957:         $message = sprintf(gettext('%1$s commented on album %2$s%3$s'), $author, $obj->getTitle(),$comment);
958:         break;
959:       default:
960:       case 'images':
961:         $message = sprintf(gettext('%1$s commented on %2$s in album %3$s%4$s'), $author, $obj->getTitle(), $obj->getAlbum()->getTitle(), $comment);
962:         break;
963:       case 'news':
964:       case 'pages':
965:         $message = sprintf(gettext('%1$s commented on %2$s%3$s'), $author, $obj->getTitle(),$comment);
966:         break;
967:     }
968:     return $message;
969:   }
970: }
971: ?>
Zenphoto doc API documentation generated by ApiGen