本文整理汇总了PHP中zp_getCookie函数的典型用法代码示例。如果您正苦于以下问题:PHP zp_getCookie函数的具体用法?PHP zp_getCookie怎么用?PHP zp_getCookie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zp_getCookie函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invalidate
static function invalidate($cookies)
{
global $_zp_loggedin, $_zp_current_admin_obj;
if (zp_getCookie('cookieInvalidator') != ($newBase = getOption('cookieInvalidator_base'))) {
foreach ($cookies as $cookie => $value) {
zp_clearCookie($cookie);
}
zp_setCookie('cookieInvalidator', $newBase);
$_zp_current_admin_obj = $_zp_loggedin = NULL;
}
}
示例2: theme
/**
*
* Filter to "setupTheme" that will override the gallery theme with user selected theme
* @param string $theme
*/
static function theme($theme)
{
global $_zp_gallery;
$new = zp_getCookie('themeSwitcher_theme');
if ($new) {
if (array_key_exists($new, $_zp_gallery->getThemes())) {
$theme = $new;
}
}
return $theme;
}
示例3: zp_handle_password
/**
*checks for album password posting
*/
function zp_handle_password()
{
global $_zp_loggedin, $_zp_login_error, $_zp_current_album;
if (zp_loggedin()) {
return;
}
// who cares, we don't need any authorization
$cookiepath = WEBPATH;
if (WEBPATH == '') {
$cookiepath = '/';
}
$check_auth = '';
if (in_context(ZP_SEARCH)) {
// search page
$authType = 'zp_search_auth';
$check_auth = getOption('search_password');
$check_user = getOption('search_user');
} else {
if (in_context(ZP_ALBUM)) {
// album page
$authType = "zp_album_auth_" . cookiecode($_zp_current_album->name);
$check_auth = $_zp_current_album->getPassword();
$check_user = $_zp_current_album->getUser();
if (empty($check_auth)) {
$parent = $_zp_current_album->getParent();
while (!is_null($parent)) {
$check_auth = $parent->getPassword();
$check_user = $parent->getUser();
$authType = "zp_album_auth_" . cookiecode($parent->name);
if (!empty($check_auth)) {
break;
}
$parent = $parent->getParent();
}
}
}
}
if (empty($check_auth)) {
// anything else is controlled by the gallery credentials
$authType = 'zp_gallery_auth';
$check_auth = getOption('gallery_password');
$check_user = getOption('gallery_user');
}
// Handle the login form.
if (isset($_POST['password']) && isset($_POST['pass'])) {
$post_user = $_POST['user'];
$post_pass = $_POST['pass'];
$auth = md5($post_user . $post_pass);
if ($_zp_loggedin = checkLogon($post_user, $post_pass)) {
// allow Admin user login
zp_setcookie("zenphoto_auth", $auth, time() + COOKIE_PESISTENCE, $cookiepath);
} else {
if ($auth == $check_auth && $post_user == $check_user) {
// Correct auth info. Set the cookie.
zp_setcookie($authType, $auth, time() + COOKIE_PESISTENCE, $cookiepath);
} else {
// Clear the cookie, just in case
zp_setcookie($authType, "", time() - 368000, $cookiepath);
$_zp_login_error = true;
}
}
return;
}
if (empty($check_auth)) {
//no password on record
return;
}
if (($saved_auth = zp_getCookie($authType)) != '') {
if ($saved_auth == $check_auth) {
return;
} else {
// Clear the cookie
zp_setcookie($authType, "", time() - 368000, $cookiepath);
}
}
}
示例4: dirname
$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) || !empty($hash) && zp_getCookie($authType) != $hash) {
require_once SERVERPATH . "/" . ZENFOLDER . '/rewrite.php';
require_once dirname(__FILE__) . "/template-functions.php";
require_once SERVERPATH . "/" . ZENFOLDER . '/functions-controller.php';
zp_load_gallery();
foreach (getEnabledPlugins() as $extension => $plugin) {
if ($plugin['priority'] & THEME_PLUGIN) {
require_once $plugin['path'];
$_zp_loaded_plugins[$extension] = $extension;
}
}
$theme = setupTheme($albumobj);
$custom = $_zp_themeroot . '/functions.php';
if (file_exists($custom)) {
require_once $custom;
}
示例5: html_encode
echo '<strong>*</strong>';
}
?>
</label>
<input type="text" id="admin_email" name="admin_email" value="<?php
echo html_encode($admin_e);
?>
" size="<?php
echo TEXT_INPUT_SIZE;
?>
" />
</p>
<?php
}
if (extensionEnabled('userAddressFields')) {
$address = getSerializedArray(zp_getCookie('reister_user_form_addresses'));
if (empty($address)) {
$address = array('street' => '', 'city' => '', 'state' => '', 'country' => '', 'postal' => '', 'website' => '');
}
$show = $required = getOption('register_user_address_info');
if ($required == 'required') {
$required = '<strong>*</strong>';
} else {
$required = false;
}
if ($show) {
?>
<p>
<label for="comment_form_street">
<?php
printf(gettext('Street%s'), $required);
示例6: checkForGuest
/**
* returns the auth type of a guest login
*
* @param string $hint
* @param string $show
* @return string
*/
function checkForGuest(&$hint = NULL, &$show = NULL)
{
global $_zp_gallery, $_zp_gallery_page, $_zp_current_zenpage_page, $_zp_current_category, $_zp_current_zenpage_news;
$authType = zp_apply_filter('checkForGuest', NULL);
if (!is_null($authType)) {
return $authType;
}
if (in_context(ZP_SEARCH)) {
// search page
$hash = getOption('search_password');
if (getOption('search_user') != '') {
$show = true;
}
$hint = get_language_string(getOption('search_hint'));
$authType = 'zp_search_auth';
if (empty($hash)) {
$hash = $_zp_gallery->getPassword();
if ($_zp_gallery->getUser() != '') {
$show = true;
}
$hint = $_zp_gallery->getPasswordHint();
$authType = 'zp_gallery_auth';
}
if (!empty($hash) && zp_getCookie($authType) == $hash) {
return $authType;
}
} else {
if (!is_null($_zp_current_zenpage_news)) {
$authType = $_zp_current_zenpage_news->checkAccess($hint, $show);
return $authType;
} else {
if (isset($_GET['album'])) {
// album page
list($album, $image) = rewrite_get_album_image('album', 'image');
if ($authType = checkAlbumPassword($album, $hint)) {
return $authType;
} else {
$alb = newAlbum($album);
if ($alb->getUser() != '') {
$show = true;
}
return false;
}
} else {
// other page
$hash = $_zp_gallery->getPassword();
if ($_zp_gallery->getUser() != '') {
$show = true;
}
$hint = $_zp_gallery->getPasswordHint();
if (!empty($hash) && zp_getCookie('zp_gallery_auth') == $hash) {
return 'zp_gallery_auth';
}
}
}
}
if (empty($hash)) {
return 'zp_public_access';
}
return false;
}
示例7: getLanguageText
/**
* Returns a canonical language name string for the location
*
* @param string $loc the location. If NULL use the current cookie
* @param string separator will be used between the major and qualifier parts, e.g. en_US
*
* @return string
*/
static function getLanguageText($loc = NULL, $separator = NULL)
{
global $_locale_Subdomains;
if (is_null($loc)) {
$text = @$_locale_Subdomains[zp_getCookie('dynamic_locale')];
} else {
$text = @$_locale_Subdomains[$loc];
//en_US always is always empty here so so urls in dynamic locale or html_meta_tags are wrong (Quickfix)
if (empty($text)) {
$text = $loc;
}
}
if (!is_null($separator)) {
$text = str_replace('_', $separator, $text);
}
return $text;
}
示例8: localePath
static function localePath($full = false, $loc = NULL)
{
global $_zp_page, $_zp_gallery_page, $_zp_current_locale;
if ($full) {
$path = FULLWEBPATH;
} else {
$path = WEBPATH;
}
if (is_null($loc)) {
$loc = zp_getCookie('dynamic_locale');
}
if ($loc != $_zp_current_locale) {
if ($locale = zpFunctions::getLanguageText($loc)) {
$path .= '/' . $locale;
}
}
return $path;
}
示例9: zp_error
if (TEST_RELEASE) {
zp_error(gettext('Forbidden'));
} else {
header("HTTP/1.0 403 " . gettext("Forbidden"));
header("Status: 403 " . gettext("Forbidden"));
exitZP();
// terminate the script with no output
}
}
$hash = getOption('downloadList_password');
if (GALLERY_SECURITY != 'public' || $hash) {
// credentials required to download
if (!zp_loggedin(getOption('downloadList_rights') ? FILES_RIGHTS : ALL_RIGHTS)) {
$user = getOption('downloadList_user');
zp_handle_password('download_auth', $hash, $user);
if (!empty($hash) && zp_getCookie('download_auth') != $hash) {
$show = $user ? true : NULL;
$hint = '';
if (!empty($hash)) {
$hint = get_language_string(getOption('downloadList_hint'));
}
if (isset($_GET['albumzip'])) {
$item .= '&albumzip';
}
printPasswordForm($hint, true, $show, '?download=' . $item);
exitZP();
}
}
}
if (isset($_GET['albumzip'])) {
DownloadList::updateListItemCount($item . '.zip');
示例10: setOptionDefault
setOptionDefault('viewer_size_image_default', '$s=' . $default);
}
function getOptionsSupported()
{
return array(gettext('Image sizes allowed') => array('key' => 'viewer_size_image_sizes', 'type' => 3, 'desc' => gettext('List of sizes from which the viewer may select.<br />The form is "$s=<size>" or "$h=<height>,$w=<width>;"....<br />See printCustomSizedImage() for details')), gettext('Default size') => array('key' => 'viewer_size_image_default', 'type' => 0, 'desc' => gettext('The initial size for the image. Format is a single instance of the sizes list.')));
}
function handleOption($option, $currentValue)
{
}
}
if (!OFFSET_PATH) {
$cookiepath = WEBPATH;
if (WEBPATH == '') {
$cookiepath = '/';
}
$saved = zp_getCookie('viewer_size_image_saved');
if (empty($saved)) {
$postdefault = trim(getOption('viewer_size_image_default'));
} else {
$_POST['viewer_size_image_selection'] = true;
// ignore default size
$postdefault = $saved;
}
}
/**
* prints the radio button image size selection list
*
* @param string $text text to introduce the radio button list
* @param string $default the default (initial) for the image sizing
* @param array $usersizes an array of sizes which may be choosen.
*/
示例11: zp_getCookie
/**
* Returns the value of a cookie from either the cookies or from $_SESSION[]
*
* @param string $name the name of the cookie
*/
function zp_getCookie($name)
{
if (isset($_COOKIE[$name])) {
$cookiev = sanitize($_COOKIE[$name]);
} else {
$cookiev = '';
}
if (DEBUG_LOGIN) {
if (isset($_SESSION[$name])) {
$sessionv = sanitize($_SESSION[$name]);
} else {
$sessionv = '';
}
debugLog(zp_getCookie($name) . '=::' . 'album_session=' . GALLERY_SESSION . "; SESSION[" . session_id() . "]=" . sanitize($sessionv) . ", COOKIE=" . sanitize($cookiev));
}
if (!empty($cookiev) && (defined('GALLERY_SESSION') && !GALLERY_SESSION)) {
return zp_cookieEncode($cookiev);
}
if (isset($_SESSION[$name])) {
return sanitize($_SESSION[$name]);
}
return NULL;
}
示例12: handleComment
function handleComment()
{
global $_zp_current_image, $_zp_current_album, $_zp_comment_stored, $_zp_current_zenpage_news, $_zp_current_zenpage_page;
$activeImage = false;
$comment_error = 0;
$cookie = zp_getCookie('zenphoto');
if (isset($_POST['comment'])) {
if (in_context(ZP_ALBUM) || in_context(ZP_ZENPAGE_NEWS_ARTICLE) || in_context(ZP_ZENPAGE_PAGE)) {
if (isset($_POST['name'])) {
$p_name = sanitize($_POST['name'], 3);
} else {
$p_name = '';
}
if (isset($_POST['email'])) {
$p_email = sanitize($_POST['email'], 3);
} else {
$p_email = "";
}
if (isset($_POST['website'])) {
$p_website = sanitize($_POST['website'], 3);
} else {
$p_website = "";
}
if (isset($_POST['comment'])) {
$p_comment = sanitize($_POST['comment'], 1);
} else {
$p_comment = '';
}
$p_server = ThemeUtil::getUserIP();
if (isset($_POST['code'])) {
$code1 = sanitize($_POST['code'], 3);
$code2 = sanitize($_POST['code_h'], 3);
} else {
$code1 = '';
$code2 = '';
}
$p_private = isset($_POST['private']);
$p_anon = isset($_POST['anon']);
if (isset($_POST['imageid'])) {
//used (only?) by the tricasa hack to know which image the client is working with.
$activeImage = zp_load_image_from_id(sanitize_numeric($_POST['imageid']));
if ($activeImage !== false) {
$commentadded = $activeImage->addComment($p_name, $p_email, $p_website, $p_comment, $code1, $code2, $p_server, $p_private, $p_anon);
$redirectTo = $activeImage->getLink();
}
} else {
if (in_context(ZP_IMAGE) and in_context(ZP_ALBUM)) {
$commentobject = $_zp_current_image;
$redirectTo = $_zp_current_image->getLink();
} else {
if (!in_context(ZP_IMAGE) and in_context(ZP_ALBUM)) {
$commentobject = $_zp_current_album;
$redirectTo = $_zp_current_album->getAlbumLink();
} else {
if (in_context(ZP_ZENPAGE_NEWS_ARTICLE)) {
$commentobject = $_zp_current_zenpage_news;
$redirectTo = FULLWEBPATH . '/index.php?p=' . ZENPAGE_NEWS . '&title=' . $_zp_current_zenpage_news->getTitlelink();
} else {
if (in_context(ZP_ZENPAGE_PAGE)) {
$commentobject = $_zp_current_zenpage_page;
$redirectTo = FULLWEBPATH . '/index.php?p=' . ZENPAGE_PAGES . '&title=' . $_zp_current_zenpage_page->getTitlelink();
}
}
}
}
$commentadded = $commentobject->addComment($p_name, $p_email, $p_website, $p_comment, $code1, $code2, $p_server, $p_private, $p_anon);
}
$comment_error = $commentadded->getInModeration();
$_zp_comment_stored = array($commentadded->getName(), $commentadded->getEmail(), $commentadded->getWebsite(), $commentadded->getComment(), false, $commentadded->getPrivate(), $commentadded->getAnon(), $commentadded->getCustomData());
if (isset($_POST['remember'])) {
$_zp_comment_stored[4] = true;
}
if (!$comment_error) {
if (isset($_POST['remember'])) {
// Should always re-cookie to update info in case it's changed...
$_zp_comment_stored[3] = '';
// clear the comment itself
zp_setcookie('zenphoto', implode('|~*~|', $_zp_comment_stored), time() + COOKIE_PESISTENCE, '/');
} else {
zp_setcookie('zenphoto', '', time() - 368000, '/');
}
return COMMENT_SUCCESS;
} else {
$comment_error++;
if ($activeImage !== false and !in_context(ZP_ZENPAGE_NEWS_ARTICLE) and !in_context(ZP_ZENPAGE_PAGE)) {
// tricasa hack? Set the context to the image on which the comment was posted
$_zp_current_image = $activeImage;
$_zp_current_album = $activeImage->getAlbum();
set_context(ZP_IMAGE | ZP_ALBUM | ZP_INDEX);
}
}
}
} else {
if (!empty($cookie)) {
// Comment form was not submitted; get the saved info from the cookie.
$_zp_comment_stored = explode('|~*~|', stripslashes($cookie));
$_zp_comment_stored[4] = true;
if (!isset($_zp_comment_stored[5])) {
$_zp_comment_stored[5] = false;
}
//.........这里部分代码省略.........
示例13: dirname
$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']);
}
$action = WEBPATH . '/' . ZENFOLDER . '/full-image.php?userlog=1&a=' . pathurlencode($album8) . '&i=' . urlencode($image8) . $parms;
printPasswordForm($hint, true, $_zp_gallery->getUserLogonField() || $show, $action);
exit;
}
示例14: getAdministrators
$offer = $_GET['ticket'];
$admins = getAdministrators();
$admin = array_shift($admins);
$req = getOption('admin_reset_date');
$adm = $admin['user'];
$pas = $admin['pass'];
$ref = md5($req . $adm . $pas);
if ($ref === $offer) {
if (time() <= $req + 3 * 24 * 60 * 60) {
// you have one week to use the request
setOption('admin_reset_date', NULL);
}
}
}
if (!isset($_POST['login'])) {
$_zp_loggedin = checkAuthorization(zp_getCookie('zenphoto_auth'));
if (!$_zp_loggedin) {
// Clear the cookie
zp_setcookie("zenphoto_auth", "", time() - 368000, $cookiepath);
}
} else {
// Handle the login form.
if (isset($_POST['login']) && isset($_POST['user']) && isset($_POST['pass'])) {
$post_user = sanitize($_POST['user'], 3);
$post_pass = sanitize($_POST['pass'], 3);
$redirect = sanitize_path($_POST['redirect']);
if ($_zp_loggedin = checkLogon($post_user, $post_pass)) {
zp_setcookie("zenphoto_auth", passwordHash($post_user, $post_pass), time() + COOKIE_PESISTENCE, $cookiepath);
if (!empty($redirect)) {
header("Location: " . FULLWEBPATH . '/' . $redirect);
}
示例15: checkCookieCredentials
/**
* Checks saved cookies to see if a user is logged in
*/
function checkCookieCredentials()
{
list($auth, $id) = explode('.', zp_getCookie('zp_user_auth') . '.');
$loggedin = $this->checkAuthorization($auth, (int) $id);
$loggedin = zp_apply_filter('authorization_cookie', $loggedin, $auth, $id);
if ($loggedin) {
return $loggedin;
}
zp_clearCookie("zp_user_auth");
return NULL;
}