本文整理汇总了PHP中Album::getPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::getPassword方法的具体用法?PHP Album::getPassword怎么用?PHP Album::getPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::getPassword方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAlbumThumbImage
/**
* Gets the album's set thumbnail image from the database if one exists,
* otherwise, finds the first image in the album or sub-album and returns it
* as an Image object.
*
* @return Image
*/
function getAlbumThumbImage()
{
if (!is_null($this->albumthumbnail)) {
return $this->albumthumbnail;
}
$albumdir = $this->localpath;
$thumb = $this->get('thumb');
$i = strpos($thumb, '/');
if ($root = $i === 0) {
$thumb = substr($thumb, 1);
// strip off the slash
$albumdir = ALBUM_FOLDER_SERVERPATH;
}
$shuffle = empty($thumb);
$field = getOption('AlbumThumbSelectField');
$direction = getOption('AlbumThumbSelectDirection');
if (!empty($thumb) && !is_numeric($thumb) && file_exists($albumdir . internalToFilesystem($thumb))) {
if ($i === false) {
return newImage($this, $thumb);
} else {
$pieces = explode('/', $thumb);
$i = count($pieces);
$thumb = $pieces[$i - 1];
unset($pieces[$i - 1]);
$albumdir = implode('/', $pieces);
if (!$root) {
$albumdir = $this->name . "/" . $albumdir;
} else {
$albumdir = $albumdir . "/";
}
$this->albumthumbnail = newImage(new Album($this->gallery, $albumdir), $thumb);
return $this->albumthumbnail;
}
} else {
$this->getImages(0, 0, $field, $direction);
$thumbs = $this->images;
if (!is_null($thumbs)) {
if ($shuffle) {
shuffle($thumbs);
}
$mine = $this->isMyItem(LIST_RIGHTS);
$other = NULL;
while (count($thumbs) > 0) {
// first check for images
$thumb = array_shift($thumbs);
$thumb = newImage($this, $thumb);
if ($mine || $thumb->getShow()) {
if (isImagePhoto($thumb)) {
// legitimate image
$this->albumthumbnail = $thumb;
return $this->albumthumbnail;
} else {
if (!is_null($thumb->objectsThumb)) {
// "other" image with a thumb sidecar
$this->albumthumbnail = $thumb;
return $this->albumthumbnail;
} else {
if (is_null($other)) {
$other = $thumb;
}
}
}
}
}
if (!is_null($other)) {
// "other" image, default thumb
$this->albumthumbnail = $other;
return $this->albumthumbnail;
}
}
}
// Otherwise, look in sub-albums.
$subalbums = $this->getAlbums();
if (!is_null($subalbums)) {
if ($shuffle) {
shuffle($subalbums);
}
while (count($subalbums) > 0) {
$folder = array_pop($subalbums);
$subalbum = new Album($this->gallery, $folder);
$pwd = $subalbum->getPassword();
if ($subalbum->getShow() && empty($pwd) || $subalbum->isMyItem(LIST_RIGHTS)) {
$thumb = $subalbum->getAlbumThumbImage();
if (strtolower(get_class($thumb)) !== 'transientimage' && $thumb->exists) {
$this->albumthumbnail = $thumb;
return $thumb;
}
}
}
}
$nullimage = SERVERPATH . '/' . ZENFOLDER . '/images/imageDefault.png';
if (OFFSET_PATH == 0) {
// check for theme imageDefault.png if we are in the gallery
//.........这里部分代码省略.........
示例2: getAlbumThumbImage
/**
* Gets the album's set thumbnail image from the database if one exists,
* otherwise, finds the first image in the album or sub-album and returns it
* as an Image object.
*
* @return Image
*/
function getAlbumThumbImage()
{
if (!is_null($this->albumthumbnail)) {
return $this->albumthumbnail;
}
$albumdir = $this->localpath;
$thumb = $this->get('thumb');
$i = strpos($thumb, '/');
if ($root = $i === 0) {
$thumb = substr($thumb, 1);
// strip off the slash
$albumdir = getAlbumFolder();
}
$shuffle = $thumb != '1';
if (!empty($thumb) && $thumb != '1' && file_exists($albumdir . UTF8ToFilesystem($thumb))) {
if ($i === false) {
return newImage($this, $thumb);
} else {
$pieces = explode('/', $thumb);
$i = count($pieces);
$thumb = $pieces[$i - 1];
unset($pieces[$i - 1]);
$albumdir = implode('/', $pieces);
if (!$root) {
$albumdir = $this->name . "/" . $albumdir;
} else {
$albumdir = $albumdir . "/";
}
$this->albumthumbnail = newImage(new Album($this->gallery, $albumdir), $thumb);
return $this->albumthumbnail;
}
} else {
if ($this->isDynamic()) {
$this->getImages(0, 0, 'ID', 'DESC');
$thumbs = $this->images;
if (!is_null($thumbs)) {
if ($shuffle) {
shuffle($thumbs);
}
while (count($thumbs) > 0) {
$thumb = array_shift($thumbs);
if (is_valid_image($thumb['filename'])) {
$alb = new Album($this->gallery, $thumb['folder']);
$thumb = newImage($alb, $thumb['filename']);
if ($thumb->getShow()) {
$this->albumthumbnail = $thumb;
return $thumb;
}
}
}
}
} else {
$this->getImages(0, 0, 'ID', 'DESC');
$thumbs = $this->images;
if (!is_null($thumbs)) {
if ($shuffle) {
shuffle($thumbs);
}
while (count($thumbs) > 0) {
$thumb = array_shift($thumbs);
if (is_valid_image($thumb)) {
$thumb = newImage($this, $thumb);
if ($thumb->getShow()) {
$this->albumthumbnail = $thumb;
return $thumb;
}
}
}
}
// Otherwise, look in sub-albums.
$subalbums = $this->getSubAlbums();
if (!is_null($subalbums)) {
if ($shuffle) {
shuffle($subalbums);
}
while (count($subalbums) > 0) {
$folder = array_pop($subalbums);
$subalbum = new Album($this->gallery, $folder);
$pwd = $subalbum->getPassword();
if ($subalbum->getShow() && empty($pwd) || isMyALbum($folder, ALL_RIGHTS)) {
$thumb = $subalbum->getAlbumThumbImage();
if (strtolower(get_class($thumb)) !== 'transientimage' && $thumb->exists) {
$this->albumthumbnail = $thumb;
return $thumb;
}
}
}
}
//jordi-kun - no images, no subalbums, check for videos
$dp = opendir($albumdir);
while ($thumb = readdir($dp)) {
if (is_file($albumdir . $thumb) && is_valid_video($thumb)) {
$othersThumb = checkObjectsThumb($albumdir, $thumb);
//.........这里部分代码省略.........
示例3: header
header("Location: {$i}");
exit;
}
$_zp_gallery = new Gallery();
$albumobj = new Album($_zp_gallery, $album8);
if (!$albumobj->checkAccess() && !zp_loggedin(VIEW_FULLIMAGE_RIGHTS)) {
// handle password form if posted
zp_handle_password('zp_image_auth', getOption('protected_image_password'), getOption('protected_image_user'));
//check for passwords
$hash = getOption('protected_image_password');
$authType = 'zp_image_auth';
$hint = get_language_string(getOption('protected_image_hint'));
$show = getOption('protected_image_user');
if (empty($hash)) {
// check for album password
$hash = $albumobj->getPassword();
$authType = "zp_album_auth_" . $albumobj->get('id');
$hint = $albumobj->getPasswordHint();
$show = $albumobj->getUser();
if (empty($hash)) {
$albumobj = $albumobj->getParent();
while (!is_null($albumobj)) {
$hash = $albumobj->getPassword();
$authType = "zp_album_auth_" . $albumobj->get('id');
$hint = $albumobj->getPasswordHint();
$show = $albumobj->getUser();
if (!empty($hash)) {
break;
}
$albumobj = $albumobj->getParent();
}
示例4: checkAlbumPassword
/**
* Checks to see access is allowed to an album
* Returns true if access is allowed.
* There is no password dialog--you must have already had authorization via a cookie.
*
* @param string $album album object or name of the album
* @param string &$hint becomes populated with the password hint.
* @return bool
*/
function checkAlbumPassword($album, &$hint = NULL)
{
global $_zp_pre_authorization, $_zp_gallery;
if (is_object($album)) {
$albumname = $album->name;
} else {
if (!is_object($_zp_gallery)) {
$_zp_gallery = new Gallery();
}
$album = new Album($_zp_gallery, $albumname = $album);
}
if (isset($_zp_pre_authorization[$albumname])) {
return $_zp_pre_authorization[$albumname];
}
$hash = $album->getPassword();
if (empty($hash)) {
$album = $album->getParent();
while (!is_null($album)) {
$hash = $album->getPassword();
$authType = "zp_album_auth_" . $album->get('id');
$saved_auth = zp_getCookie($authType);
if (!empty($hash)) {
if ($saved_auth == $hash) {
$_zp_pre_authorization[$albumname] = $authType;
return $authType;
} else {
$hint = $album->getPasswordHint();
return false;
}
}
$album = $album->getParent();
}
// revert all tlhe way to the gallery
$hash = $_zp_gallery->getPassword();
$authType = 'zp_gallery_auth';
$saved_auth = zp_getCookie($authType);
if (empty($hash)) {
$authType = 'zp_public_access';
} else {
if ($saved_auth != $hash) {
$hint = $_zp_gallery->getPasswordHint();
return false;
}
}
} else {
$authType = "zp_album_auth_" . $album->get('id');
$saved_auth = zp_getCookie($authType);
if ($saved_auth != $hash) {
$hint = $album->getPasswordHint();
return false;
}
}
$_zp_pre_authorization[$albumname] = $authType;
return $authType;
}