Gallery1:API Changes From 1.5.7 To 1.5.8 - Gallery Codex
Personal tools

Gallery1:API Changes From 1.5.7 To 1.5.8

From Gallery Codex

Classes

classes/UserDB.php

The class has now a new variable called 'initialized'. Its set to false in the constructor and gets true when the object was successully instanced.

  • isInitialized()

New method to check wether an UserDB object was successfully instanced.


  • validPassword($password, $user = NULL)

This method now performs stronger checks and also optionally accepts a user object to check username against password.


classes/Album.php

  • getParentAlbums($addChild = false, $ignoreReturnto = false, $withGalleryLink = true, $uplevel = 30)

New param $withGalleryLink. If true, and the last album in the array is a rootalbum, a link to Gallery is added. New param $uplevel. How much level of parent albums to you want to show?


  • addPhoto(..)

Old return code was 0 anytime. Now its: array(true, $statusMsg);


  • deletePhoto($index, ..)

Returns fals if $index does not point to an existing item.


  • getPreviewTag($index, $size = 0, $attrs = array())

$attrs was a string. Now its an array!


  • getThumbnailTag($index, $size = 0, $attrs = array())

$attrs was a string. Now its an array!


  • getThumbnailTagById($id, $size = 0, $attrs = array())

$attrs was a string. Now its an array!


  • getHighlightAsThumbnailTag($size = 0, $attrList = array())

$attrList was a string. Now its an array!


  • getPhotoTag($index, $full = false, $attrs = array())

$full now defaults to false. $attrs was a string. Now its an array!


  • getAlbumName(..)

Return now null in case item does not exist.


  • setItemCaptureDate(..)

Returns true/false on success/failure now.


  • setItemCaptureDate(..)

Returns true/false on success/failure now.


  • setOwner($uid)

Returns true/false on success/failure now.


  • makeThumbnailRecursive(..)

REMOVED!


  • makeThumbnails($recursive = false)

NEW!


  • isImage($id)

NEW!


  • isImageByIndex($index)

NEW!


  • canViewItem($user, $index, $full = false)

NEW!


  • getAltText($index)

NEW!!


classes/AlbumDB.php

The class has now a new variable called 'initialized'. Its set to false in the constructor and gets true when the object was successully instanced.

  • isInitialized()

New method to check wether an UserDB object was successfully instanced.

classes/AlbumItem.php

  • setItemCaptureDate($itemCaptureDate = , $album = null)

New param $album. Needs to be set. In previuous version $gallery->album was used, now you need to give the album.


  • getPreviewTag($dir, $size = 0, $attrs = array())

$attrs was a string. Now its an array!


  • getThumbnailTag($dir, $size = 0, $attrs = array())

$attrs was a string. Now its an array!


  • getHighlightTag($dir, $size = 0, $attrList = array())

$attrList was a string. Now its an array! $alttext param removed.


  • createCaption($dir, $captionType)

NEW!

  • isImage()

NEW!


classes/AlbumDB.php

  • getTag($dir, $full = false, $size = 0, $attrs = array())

$attrs was a string. Now its an array!


CSS

  • New classes that might need to be updated/adjusted in skins:

.g-tabset .g-tabset a .g-tabset a:hover .g-tabset a.g-activeTab .g-button .g-buttonDisable, input:focus.g-buttonDisable .g-disabled .g-selected

Filesytem

  • Icons for navigation moved into its own folder.
  • WZ Javascripts moved into its own folder.

Functions

Changed functions

lib/content.php

  • printAlbumOptionList

Renamed into albumOptionList Does not print the output anymore Return value is now array($uptodate, $albumOptionList) instead of just $uptodate


  • printNestedVals

Renamed into nestedAlbumOptionList Does not print the output anymore Returns $nestedAlbumOptionList

=== lib/imageManipulation.php

  • function netpbm_decompose_image(..)

Old name was Netpbm_decompose_image(..)


  • function netpbm(..)

Old name was Netpbm(..)

=== lib/lang.php

  • function gTranslate($domain = null, $singular, $plural = , $count = null, $nonetext = , $short = false)

Parameter $short is new and set to false per default. Previous versions of Gallery had this implicit, but set to true!!

=== lib/url.php

  • function galleryLink($url = , $text =, $attrList = array(), $icon = , $addBrackets = false)

New params $icon, $addBrackets.

=== lib/valchecks.php

  • function isValidGalleryInteger($value, $includingZero = false, $emptyAllowed = false)

Old name/syntax was isValidInteger($mixed, $includingZero = false, $default = NULL, $emptyAllowed = false) !!


  • function isValidText($text, $level = 0)

Old Syntax was isValidText($text, $default = NULL)


New functions

lib/album.php

  • returnToPathArray($album = NULL, $withCurrentAlbum = true, $photoview = false)

Returns the a HTML string containg links to the upper albums

=== lib/albumItem.php

  • generateCaption($captionType = 1, $originalFilename, $filename) {

What should the caption be, if no caption was given by user ? See captionOptions.inc.php for options

lib/content.php

  • LoginLogoutButton($return = 'albums.php', $photoCount = 1) {

Returns a html string that represents the login/logout button, or just the text.


  • jsHTML($path)

Returns the HTML code to a js file inside the Galley js folder


  • addProgressbar($id, $label = )

Returns the HTML code for a progressbar


  • updateProgressBar($htmlId, $status, $percentDone)

Wrapper around js function updateProgressBar. Updates a progressbar.

  • addProgressBarText($htmlId, $text)

Wrapper around js function addProgressBarText. Updates a progressbar.


  • gHtmlSafe($string)

Returns a safetodisplayed copy of $string.

lib/form.php

  • function gInput($type, $name, $label = null, $tableElement = false, $value = null, $attrList = array(), $multiInput = false)
 Returns the HTML Code for an input element. Very nice to cleanup and unify code.

lib/messages.php

  • function infoBox($messages = array(), $caption = , $withOuterBorder = true)

Returns the HTML code for a nice notice box.


  • function showInvalidReqMesg($text = )

Unified output message for the case a page was called invalid.


  • function printPopupStart($title = , $header = , $align = 'center')

Outputs the HTML start elements of an popup.

platform/fs_*

  • function fs_fileIsHidden($filename)

Is file hidden ? Means it starts with a . Returns false anytime in windows environment.


  • function fs_rmdir($dir)

Deletes a directory.

lib/valchecks.php

  • function isValidGalleryUrl($url) {

Checks whether an URL is a Gallery URL.


  • function isSafeHttpHeader($header)

Checks whether a header contains malicious characters.


  • function getMaliciousChars($level = 1)

Returns a set of malicious chars. Level 0: Only chars that i (the author) think are evil anytime are considered. Level 1: All malicious.


  • function xssCleanup($string, $level = 1)

Removes malicious chars from a string.


  • function isXSSclean($string, $level = 1)

Checks whether a string, (eg. filename or url) contains malicious characters!!


  • function validAlbumName($name)

Checks whether an albuname has unallowed chars.


  • function passwordStrength($password)

Calculates the password strength of a password.


  • function isValidTimestamp($timestamp)

Checks whether a value seems to be a valid timestamp.


  • function inRange($value, $min, $max)

Is a given value (number) in a certain range?