本文整理汇总了PHP中eZSys::queryString方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSys::queryString方法的具体用法?PHP eZSys::queryString怎么用?PHP eZSys::queryString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZSys
的用法示例。
在下文中一共展示了eZSys::queryString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
{
$destination = $namedParameters['destination'];
switch ($operatorName) {
case 'language_switcher':
$ini = eZINI::instance();
if (!$ini->hasVariable('RegionalSettings', 'LanguageSwitcherClass')) {
return;
}
// Append original query string if no query string has already been passed in $destination
if (strpos($destination, '?') === false) {
$destination .= eZSys::queryString();
}
$className = $ini->variable('RegionalSettings', 'LanguageSwitcherClass');
$operatorValue = call_user_func(array($className, 'setupTranslationSAList'), $destination);
break;
}
}
示例2: instance
/**
* Returns a shared instance of the eZUser class pr $id value.
* If user can not be fetched, then anonymous user is returned and
* a warning trown, if anonymous user can not be fetched, then NoUser
* is returned and another warning is thrown.
*
* @param int|false $id On false: Gets current user id from session
* or from {@link eZUser::anonymousId()} if not set.
* @return eZUser
*/
static function instance($id = false)
{
if (!empty($GLOBALS["eZUserGlobalInstance_{$id}"])) {
return $GLOBALS["eZUserGlobalInstance_{$id}"];
}
$userId = $id;
$currentUser = null;
$http = eZHTTPTool::instance();
$anonymousUserID = self::anonymousId();
$sessionHasStarted = eZSession::hasStarted();
// If not specified get the current user
if ($userId === false) {
if ($sessionHasStarted) {
$userId = $http->sessionVariable('eZUserLoggedInID');
if (!is_numeric($userId)) {
$userId = $anonymousUserID;
eZSession::setUserID($userId);
$http->setSessionVariable('eZUserLoggedInID', $userId);
}
} else {
$userId = $anonymousUserID;
eZSession::setUserID($userId);
}
}
// Check user cache (this effectivly fetches user from cache)
// user not found if !isset( isset( $userCache['info'][$userId] ) )
$userCache = self::getUserCacheByUserId($userId);
if (isset($userCache['info'][$userId])) {
$userArray = $userCache['info'][$userId];
if (is_numeric($userArray['contentobject_id'])) {
$currentUser = new eZUser($userArray);
$currentUser->setUserCache($userCache);
}
}
$ini = eZINI::instance();
// Check if:
// - the user has not logged out,
// - the user is not logged in,
// - and if a automatic single sign on plugin is enabled.
if (!self::$userHasLoggedOut && is_object($currentUser) && !$currentUser->isRegistered()) {
$ssoHandlerArray = $ini->variable('UserSettings', 'SingleSignOnHandlerArray');
if (!empty($ssoHandlerArray)) {
$ssoUser = false;
foreach ($ssoHandlerArray as $ssoHandler) {
$className = 'eZ' . $ssoHandler . 'SSOHandler';
if (class_exists($className)) {
$impl = new $className();
$ssoUser = $impl->handleSSOLogin();
// If a user was found via SSO, then use it
if ($ssoUser !== false) {
$currentUser = $ssoUser;
$userId = $currentUser->attribute('contentobject_id');
$userInfo = array();
$userInfo[$userId] = array('contentobject_id' => $userId, 'login' => $currentUser->attribute('login'), 'email' => $currentUser->attribute('email'), 'password_hash' => $currentUser->attribute('password_hash'), 'password_hash_type' => $currentUser->attribute('password_hash_type'));
eZSession::setUserID($userId);
$http->setSessionVariable('eZUserLoggedInID', $userId);
eZUser::updateLastVisit($userId);
eZUser::setCurrentlyLoggedInUser($currentUser, $userId);
eZHTTPTool::redirect(eZSys::wwwDir() . eZSys::indexFile(false) . eZSys::requestURI() . eZSys::queryString(), array(), 302);
eZExecution::cleanExit();
}
} else {
eZDebug::writeError("Undefined ssoHandler class: {$className}", __METHOD__);
}
}
}
}
if ($userId != $anonymousUserID) {
$sessionInactivityTimeout = $ini->variable('Session', 'ActivityTimeout');
if (!isset($GLOBALS['eZSessionIdleTime'])) {
eZUser::updateLastVisit($userId);
} else {
$sessionIdle = $GLOBALS['eZSessionIdleTime'];
if ($sessionIdle > $sessionInactivityTimeout) {
eZUser::updateLastVisit($userId);
}
}
}
if (!$currentUser) {
$currentUser = eZUser::fetch(self::anonymousId());
eZDebug::writeWarning('User not found, returning anonymous');
}
if (!$currentUser) {
$currentUser = new eZUser(array('id' => -1, 'login' => 'NoUser'));
eZDebug::writeWarning('Anonymous user not found, returning NoUser');
}
$GLOBALS["eZUserGlobalInstance_{$id}"] = $currentUser;
return $currentUser;
}
示例3: attribute
/**
* Get value for an attribute
*
* @param string $attr
* @return boolean the value for attribute $attr or null if it does not exist.
*/
public function attribute($attr)
{
switch ($attr) {
case 'element':
return $this->element();
break;
case 'tail':
return $this->elements();
break;
case 'base':
return $this->base();
break;
case 'index':
return $this->index();
break;
case 'uri':
return $this->uriString();
break;
case 'original_uri':
return $this->originalURIString();
break;
case 'query_string':
return eZSys::queryString();
break;
default:
eZDebug::writeError("Attribute '{$attr}' does not exist", __METHOD__);
return null;
break;
}
}
示例4: array
$Module->redirectToView('register');
}
$userIsNotAllowedToLogin = false;
$failedLoginAttempts = false;
$maxNumOfFailedLogin = !eZUser::isTrusted() ? eZUser::maxNumberOfFailedLogin() : false;
// Should we show message about failed login attempt and max number of failed login
if ($loginWarning and isset($GLOBALS['eZFailedLoginAttemptUserID'])) {
$showMessageIfExceeded = $ini->hasVariable('UserSettings', 'ShowMessageIfExceeded') ? $ini->variable('UserSettings', 'ShowMessageIfExceeded') == 'true' : false;
$failedUserID = $GLOBALS['eZFailedLoginAttemptUserID'];
$failedLoginAttempts = eZUser::failedLoginAttemptsByUserID($failedUserID);
$canLogin = eZUser::isEnabledAfterFailedLogin($failedUserID);
if ($showMessageIfExceeded and !$canLogin) {
$userIsNotAllowedToLogin = true;
}
}
$tpl = eZTemplate::factory();
$tpl->setVariable('login', $userLogin, 'User');
$tpl->setVariable('post_data', $postData, 'User');
$tpl->setVariable('password', $userPassword, 'User');
$tpl->setVariable('redirect_uri', $userRedirectURI . eZSys::queryString(), 'User');
$tpl->setVariable('warning', array('bad_login' => $loginWarning), 'User');
$tpl->setVariable('site_access', array('allowed' => $siteAccessAllowed, 'name' => $siteAccessName));
$tpl->setVariable('user_is_not_allowed_to_login', $userIsNotAllowedToLogin, 'User');
$tpl->setVariable('failed_login_attempts', $failedLoginAttempts, 'User');
$tpl->setVariable('max_num_of_failed_login', $maxNumOfFailedLogin, 'User');
$Result = array();
$Result['content'] = $tpl->fetch('design:user/login.tpl');
$Result['path'] = array(array('text' => ezpI18n::tr('kernel/user', 'User'), 'url' => false), array('text' => ezpI18n::tr('kernel/user', 'Login'), 'url' => false));
if ($ini->variable('SiteSettings', 'LoginPage') == 'custom') {
$Result['pagelayout'] = 'loginpagelayout.tpl';
}
示例5: redirect
/**
* Performs a redirection
*/
protected function redirect()
{
$GLOBALS['eZRedirection'] = true;
$ini = eZINI::instance();
$automaticRedirect = true;
if ($GLOBALS['eZDebugAllowed'] && ($redirUri = $ini->variable('DebugSettings', 'DebugRedirection')) !== 'disabled') {
if ($redirUri == "enabled") {
$automaticRedirect = false;
} else {
$uri = eZURI::instance(eZSys::requestURI());
$uri->toBeginning();
foreach ($ini->variableArray("DebugSettings", "DebugRedirection") as $redirUri) {
$redirUri = new eZURI($redirUri);
if ($redirUri->matchBase($uri)) {
$automaticRedirect = false;
break;
}
}
}
}
$redirectURI = eZSys::indexDir();
$moduleRedirectUri = $this->module->redirectURI();
if ($ini->variable('URLTranslator', 'Translation') === 'enabled' && eZURLAliasML::urlTranslationEnabledByUri(new eZURI($moduleRedirectUri))) {
$translatedModuleRedirectUri = $moduleRedirectUri;
if (eZURLAliasML::translate($translatedModuleRedirectUri, true)) {
$moduleRedirectUri = $translatedModuleRedirectUri;
if (strlen($moduleRedirectUri) > 0 && $moduleRedirectUri[0] !== '/') {
$moduleRedirectUri = '/' . $moduleRedirectUri;
}
}
}
if (preg_match('#^(\\w+:)|^//#', $moduleRedirectUri)) {
$redirectURI = $moduleRedirectUri;
} else {
$leftSlash = strlen($redirectURI) > 0 && $redirectURI[strlen($redirectURI) - 1] === '/';
$rightSlash = strlen($moduleRedirectUri) > 0 && $moduleRedirectUri[0] === '/';
if (!$leftSlash && !$rightSlash) {
// Both are without a slash, so add one
$moduleRedirectUri = '/' . $moduleRedirectUri;
} else {
if ($leftSlash && $rightSlash) {
// Both are with a slash, so we remove one
$moduleRedirectUri = substr($moduleRedirectUri, 1);
}
}
// In some cases $moduleRedirectUri can already contain $redirectURI (including the siteaccess).
if (!empty($redirectURI) && strpos($moduleRedirectUri, $redirectURI) === 0) {
$redirectURI = $moduleRedirectUri;
} else {
$redirectURI .= $moduleRedirectUri;
}
}
// After the module redirect url is completed, add the queryString params so they carry over the redirect operation
$redirectURI .= eZSys::queryString();
if ($ini->variable('ContentSettings', 'StaticCache') == 'enabled') {
$staticCacheHandlerClassName = $ini->variable('ContentSettings', 'StaticCacheHandler');
$staticCacheHandlerClassName::executeActions();
}
eZDB::checkTransactionCounter();
if (!$automaticRedirect) {
// Make sure any errors or warnings are reported
if ($ini->variable('DebugSettings', 'DisplayDebugWarnings') === 'enabled') {
if (isset($GLOBALS['eZDebugError']) && $GLOBALS['eZDebugError']) {
eZAppendWarningItem(array('error' => array('type' => 'error', 'number' => 1, 'count' => $GLOBALS['eZDebugErrorCount']), 'identifier' => 'ezdebug-first-error', 'text' => ezpI18n::tr('index.php', 'Some errors occurred, see debug for more information.')));
}
if (isset($GLOBALS['eZDebugWarning']) && $GLOBALS['eZDebugWarning']) {
eZAppendWarningItem(array('error' => array('type' => 'warning', 'number' => 1, 'count' => $GLOBALS['eZDebugWarningCount']), 'identifier' => 'ezdebug-first-warning', 'text' => ezpI18n::tr('index.php', 'Some general warnings occured, see debug for more information.')));
}
}
$tpl = eZTemplate::factory();
$tpl->setVariable('site', $this->site);
$tpl->setVariable('warning_list', !empty($this->warningList) ? $this->warningList : false);
$tpl->setVariable('redirect_uri', eZURI::encodeURL($redirectURI));
$templateResult = $tpl->fetch('design:redirect.tpl');
eZDebug::addTimingPoint("Script end");
eZDisplayResult($templateResult);
eZExecution::cleanExit();
}
return eZHTTPTool::redirect($redirectURI, array(), $this->module->redirectStatus(), true, true);
}
示例6: switchIfNeeded
/**
* \static
* \param $inSSL The desired access mode.
*
* Change access mode (HTTP/HTTPS):
* - If previous mode was HHTP but $inSSL is true, we switch to SSL.
* - If previous mode was SSL but $inSSL is false, we switch to HTTP.
* - Otherwise no mode change is occured.
*
* Mode change is done by redirect to the same URL, but with changed
* protocol (http/https) and TCP port.
*
* In case of mode change this method does not return (exit() is called).
*/
static function switchIfNeeded($inSSL)
{
// if it's undefined whether we should redirect we do nothing
if (!isset($inSSL)) {
return;
}
// $nowSSl is true if current access mode is HTTPS.
$nowSSL = eZSys::isSSLNow();
$requestURI = eZSys::requestURI();
$indexDir = eZSys::indexDir(false);
// If there are any $_GET parameters, those should be passed into the new URI
$getString = eZSys::queryString();
$sslZoneRedirectionURL = false;
if ($nowSSL && !$inSSL) {
// switch to plain HTTP
$ini = eZINI::instance();
$host = $ini->variable('SiteSettings', 'SiteURL');
$port = parse_url("http://{$host}", PHP_URL_PORT);
$host = eZSys::serverVariable('HTTP_HOST');
$host = preg_replace('/:\\d+$/', '', $host);
if ($port && $port != 80) {
$host .= ":{$port}";
}
$sslZoneRedirectionURL = "http://" . $host . $indexDir . $requestURI . $getString;
} elseif (!$nowSSL && $inSSL) {
// switch to HTTPS
$host = eZSys::serverVariable('HTTP_HOST');
$host = preg_replace('/:\\d+$/', '', $host);
$ini = eZINI::instance();
$sslPort = $ini->variable('SiteSettings', 'SSLPort');
$sslPortString = $sslPort == eZSSLZone::DEFAULT_SSL_PORT ? '' : ":{$sslPort}";
$sslZoneRedirectionURL = "https://" . $host . $sslPortString . $indexDir . $requestURI . $getString;
}
if ($sslZoneRedirectionURL) {
eZDebugSetting::writeDebug('kernel-ssl-zone', "redirecting to [{$sslZoneRedirectionURL}]");
eZHTTPTool::redirect($sslZoneRedirectionURL, array(), false, false);
eZExecution::cleanExit();
}
}