本文整理匯總了PHP中Gallery::getPassword方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gallery::getPassword方法的具體用法?PHP Gallery::getPassword怎麽用?PHP Gallery::getPassword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gallery
的用法示例。
在下文中一共展示了Gallery::getPassword方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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 $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;
}
示例2: while
$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();
}
}
}
if (empty($hash)) {
// check for gallery password
$hash = $_zp_gallery->getPassword();
$authType = 'zp_gallery_auth';
$hint = $_zp_gallery->getPasswordHint();
$show = $_zp_gallery->getUser();
}
if (empty($hash) && GALLERY_SECURITY == 'private' || !empty($hash) && zp_getCookie($authType) != $hash) {
require_once dirname(__FILE__) . "/template-functions.php";
$parms = '';
if (isset($_GET['wmk'])) {
$parms = '&wmk=' . $_GET['wmk'];
}
if (isset($_GET['q'])) {
$parms .= '&q=' . sanitize_numeric($_GET['q']);
}
if (isset($_GET['dsp'])) {
$parms .= '&dsp=' . sanitize_numeric($_GET['dsp']);
示例3: gettext
echo 'style="display:none"';
}
?>
>
<td style="background-color: #ECF1F2;">
<p>
<a href="javascript:toggle_passwords('',true);">
<?php
echo gettext("Gallery password:");
?>
</a>
</p>
</td>
<td style="background-color: #ECF1F2;">
<?php
$x = $gallery->getPassword();
if (empty($x)) {
?>
<img src="images/lock_open.png" />
<?php
} else {
$x = ' ';
?>
<script type="text/javascript">
function resetPass() {
$('#gallery_user').val('');
$('#gallerypass').val('');
$('#gallerypass_2').val('');
$('.hint').val('');
toggle_passwords('',true);
}