本文整理汇总了PHP中album::getPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP album::getPassword方法的具体用法?PHP album::getPassword怎么用?PHP album::getPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类album
的用法示例。
在下文中一共展示了album::getPassword方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 $albumname the album
* @param string &$hint becomes populated with the password hint.
* @return bool
*/
function checkAlbumPassword($albumname, &$hint)
{
global $_zp_pre_authorization, $_zp_loggedin;
if (zp_loggedin(ADMIN_RIGHTS | VIEWALL_RIGHTS | ALL_ALBUMS_RIGHTS)) {
return true;
}
if ($_zp_loggedin) {
if (isMyAlbum($albumname, ALL_RIGHTS)) {
return true;
}
// he is allowed to see it.
}
if (isset($_zp_pre_authorization[$albumname])) {
return true;
}
$album = new album($_zp_gallery, $albumname);
$hash = $album->getPassword();
if (empty($hash)) {
$album = $album->getParent();
while (!is_null($album)) {
$hash = $album->getPassword();
$authType = "zp_album_auth_" . cookiecode($album->name);
$saved_auth = zp_getCookie($authType);
if (!empty($hash)) {
if ($saved_auth != $hash) {
$hint = $album->getPasswordHint();
return false;
}
}
$album = $album->getParent();
}
// revert all tlhe way to the gallery
$hash = getOption('gallery_password');
$authType = 'zp_gallery_auth';
$saved_auth = zp_getCookie($authType);
if (!empty($hash)) {
if ($saved_auth != $hash) {
$hint = get_language_string(getOption('gallery_hint'));
return false;
}
}
} else {
$authType = "zp_album_auth_" . cookiecode($album->name);
$saved_auth = zp_getCookie($authType);
if ($saved_auth != $hash) {
$hint = $album->getPasswordHint();
return false;
}
}
$_zp_pre_authorization[$albumname] = true;
return true;
}