本文整理汇总了PHP中eZHTTPTool::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP eZHTTPTool::redirect方法的具体用法?PHP eZHTTPTool::redirect怎么用?PHP eZHTTPTool::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZHTTPTool
的用法示例。
在下文中一共展示了eZHTTPTool::redirect方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
{
$redirectUri = $namedParameters['url'];
// if $redirectUri is not starting with scheme://
if (!preg_match('#^\\w+://#', $redirectUri)) {
// path to eZ Publish index
$indexDir = eZSys::indexDir();
/* We need to make sure we have one
and only one slash at the concatenation point
between $indexDir and $redirectUri. */
$redirectUri = rtrim($indexDir, '/') . '/' . ltrim($redirectUri, '/');
}
// Redirect to $redirectUri by returning status code 301 and exit.
eZHTTPTool::redirect($redirectUri, array(), 301);
eZExecution::cleanExit();
}
示例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: checkUser
static function checkUser(&$siteBasics, &$url)
{
$http = eZHTTPTool::instance();
if (!$http->hasSessionVariable(self::STEP)) {
$http->setSessionVariable(self::STEP, self::STEP_PRE_CHECK_USER_INFO);
}
$loginStep =& $http->sessionVariable(self::STEP);
if ($http->hasSessionVariable(self::FORCE_LOGIN) && $loginStep < self::STEP_PRE_COLLECT_USER_INFO) {
$loginStep = self::STEP_PRE_COLLECT_USER_INFO;
}
switch ($loginStep) {
case self::STEP_PRE_CHECK_USER_INFO:
$ini = eZINI::instance();
$handlerList = array('standard');
if ($ini->hasVariable('UserSettings', 'LoginHandler')) {
$handlerList = $ini->variable('UserSettings', 'LoginHandler');
}
if ($http->hasSessionVariable(self::LAST_HANDLER_NAME)) {
$http->removeSessionVariable(self::LAST_HANDLER_NAME);
}
foreach ($handlerList as $handler) {
$userObject = eZUserLoginHandler::instance($handler);
if ($userObject) {
$check = $userObject->checkUser($siteBasics, $url);
if ($check === null) {
eZUserLoginHandler::sessionCleanup();
return null;
}
$http->setSessionVariable(self::LAST_CHECK_REDIRECT, $check);
$http->setSessionVariable(self::LAST_HANDLER_NAME, $handler);
}
}
$http->setSessionVariable(self::STEP, self::STEP_PRE_COLLECT_USER_INFO);
return eZUserLoginHandler::checkUser($siteBasics, $url);
break;
case self::STEP_PRE_COLLECT_USER_INFO:
$http->setSessionVariable(self::STEP, self::STEP_POST_COLLECT_USER_INFO);
$handler = null;
if ($http->hasSessionVariable(self::LAST_HANDLER_NAME)) {
$handlerName = $http->sessionVariable(self::LAST_HANDLER_NAME);
$handler = eZUserLoginHandler::instance($handlerName);
}
if ($handler) {
return $handler->preCollectUserInfo();
} else {
$redirect =& $http->sessionVariable(self::LAST_CHECK_REDIRECT);
if (!$redirect) {
$redirect = array('module' => 'user', 'function' => 'login');
}
return $redirect;
}
break;
case self::STEP_POST_COLLECT_USER_INFO:
$http->setSessionVariable(self::STEP, self::STEP_LOGIN_USER);
$handler = null;
if ($http->hasSessionVariable(self::LAST_HANDLER_NAME)) {
$handlerName = $http->sessionVariable(self::LAST_HANDLER_NAME);
$handler = eZUserLoginHandler::instance($handlerName);
}
if ($handler) {
// Use specified login handler to handle Login info input
if (!$handler->postCollectUserInfo()) {
eZUserLoginHandler::sessionCleanup();
eZHTTPTool::redirect('/');
eZExecution::cleanExit();
}
}
return eZUserLoginHandler::checkUser($siteBasics, $url);
break;
case self::STEP_LOGIN_USER:
$ini = eZINI::instance();
$handlerList = array('standard');
if ($ini->hasVariable('UserSettings', 'LoginHandler')) {
$handlerList = $ini->variable('UserSettings', 'LoginHandler');
}
$userInfoArray =& $http->sessionVariable(self::USER_INFO);
$http->removeSessionVariable(self::USER_INFO);
if ($http->hasSessionVariable(self::FORCE_LOGIN)) {
$http->removeSessionVariable(self::FORCE_LOGIN);
}
$user = null;
if (is_array($userInfoArray) and $userInfoArray['login'] and $userInfoArray['password']) {
foreach ($handlerList as $handler) {
$userObject = eZUserLoginHandler::instance($handler);
if ($userObject) {
$user = $userObject->loginUser($userInfoArray['login'], $userInfoArray['password']);
if (is_subclass_of($user, 'eZUser')) {
eZUserLoginHandler::sessionCleanup();
return null;
} else {
if (is_array($user)) {
eZUserLoginHandler::sessionCleanup();
return $user;
}
}
}
}
}
$http->setSessionVariable(self::STEP, self::STEP_PRE_CHECK_USER_INFO);
return eZUserLoginHandler::checkUser($siteBasics, $url);
//.........这里部分代码省略.........
示例4: 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);
}
}
$redirectURI .= $moduleRedirectUri;
}
eZStaticCache::executeActions();
eZDB::checkTransactionCounter();
if ($automaticRedirect) {
eZHTTPTool::redirect($redirectURI, array(), $this->module->redirectStatus());
} else {
// 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();
}
示例5: trim
}
$ngConnectINI = eZINI::instance('ngconnect.ini');
$availableLoginMethods = $ngConnectINI->variable('ngconnect', 'LoginMethods');
$authHandlerClasses = $ngConnectINI->variable('ngconnect', 'AuthHandlerClasses');
$loginWindowType = trim($ngConnectINI->variable('ngconnect', 'LoginWindowType'));
$debugEnabled = trim($ngConnectINI->variable('ngconnect', 'DebugEnabled')) == 'true';
if (function_exists('curl_init') && function_exists('json_decode')) {
if (in_array($loginMethod, $availableLoginMethods) && isset($authHandlerClasses[$loginMethod]) && class_exists(trim($authHandlerClasses[$loginMethod]))) {
$authHandlerClassName = trim($authHandlerClasses[$loginMethod]);
$authHandler = new $authHandlerClassName();
if ($authHandler instanceof INGConnectAuthInterface) {
$currentUser = eZUser::currentUser();
if ($currentUser->isAnonymous() || !$currentUser->isAnonymous() && !ngConnect::userHasConnection($currentUser->ContentObjectID, $loginMethod)) {
$result = $authHandler->getRedirectUri();
if ($result['status'] == 'success' && isset($result['redirect_uri'])) {
return eZHTTPTool::redirect($result['redirect_uri']);
} else {
if ($debugEnabled && isset($result['message'])) {
eZDebug::writeError($result['message'], 'ngconnect/login');
} else {
if ($debugEnabled) {
eZDebug::writeError('Unknown error', 'ngconnect/login');
}
}
}
}
} else {
if ($debugEnabled) {
eZDebug::writeError('Invalid auth handler class: ' . $authHandlerClassName, 'ngconnect/login');
}
}
示例6: array
<?php
/***********************
Redirections Ecole Head
***********************/
$site_FR = 'http://www.ecolehead.fr';
//$site_EN = 'http://www.eurosearch-associes.com';
$aRedirections = array('`^/L-ecole$`' => $site_FR . '/Ecole/Projet', '`^/Le-parcours-HEAD$`' => $site_FR . '/Parcours', '`^/Candidature$`' => $site_FR . '/contact/form/candidature', '`^/L-equipe-fondatrice$`' => $site_FR . '/Ecole/Equipe', '`^/Financement$`' => $site_FR . '/Admissions/Financement-des-etudes', '`^/Contact$`' => $site_FR . '/Contact-HEAD', '`^/Les-valeurs$`' => $site_FR . '/Ecole/Nos-Valeurs', '`^/Partenariats$`' => $site_FR . '/Partenaires/Partenaires');
$requestURI = $_SERVER['REQUEST_URI'];
foreach ($aRedirections as $pattern => $redirectUri) {
if (preg_match($pattern, $requestURI) == 1) {
eZHTTPTool::redirect($redirectUri, array(), 301);
eZExecution::cleanExit();
}
}
示例7: substr
}
if (!$leftSlash and !$rightSlash) {
// Both are without a slash, so add one
$moduleRedirectUri = '/' . $moduleRedirectUri;
} else {
if ($leftSlash and $rightSlash) {
// Both are with a slash, so we remove one
$moduleRedirectUri = substr($moduleRedirectUri, 1);
}
}
$redirectURI .= $moduleRedirectUri;
}
eZStaticCache::executeActions();
eZDB::checkTransactionCounter();
if ($automatic_redir) {
eZHTTPTool::redirect($redirectURI, array(), $redirectStatus);
} else {
// Make sure any errors or warnings are reported
if ($ini->variable('DebugSettings', 'DisplayDebugWarnings') == 'enabled') {
if (isset($GLOBALS['eZDebugError']) and $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']) and $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();
if (empty($warningList)) {
$warningList = false;
}
$tpl->setVariable('site', $site);
示例8: 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();
}
}
示例9: 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 );
$sslZoneRedirectionURL = false;
if ( $nowSSL && !$inSSL )
{
// switch to plain HTTP
$ini = eZINI::instance();
$host = $ini->variable( 'SiteSettings', 'SiteURL' );
$sslZoneRedirectionURL = "http://" . $host . $indexDir . $requestURI;
}
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;
}
if ( $sslZoneRedirectionURL ) // if a redirection URL is found
{
eZDebugSetting::writeDebug( 'kernel-ssl-zone', "redirecting to [$sslZoneRedirectionURL]" );
eZHTTPTool::redirect( $sslZoneRedirectionURL, array(), false, false );
eZExecution::cleanExit();
}
}
示例10: array
<?php
/**
* Vue gérant les redirections de liens référencés dans eZ Publish
* Utile pour les liens sponsorisés, notamment pour éviter les problèmes de validation HTML
* ou pour cacher les régies publicitaires
* @copyright Copyright (C) 2011 - Metal France. All rights reserved
* @author Jerome Vieilledent
* @version 3.0
* @package metalfrance
* @subpackage mf
*/
$Module = $Params['Module'];
$Result = array();
$http = eZHTTPTool::instance();
$mfINI = eZINI::instance('metalfrance.ini');
$url = eZURL::url((int) $Params['LinkID']);
eZHTTPTool::redirect($url, array(), '302');
示例11: loginUser
static function loginUser($login, $password, $authenticationMatch = false)
{
$moduleINI = eZINI::instance('module.ini');
$siteINI = eZINI::instance('site.ini');
$rpxApiKey = $moduleINI->variable('ModuleSettings', 'RPXApiKey');
$attributeID = $moduleINI->variable('ModuleSettings', 'OpenIDAttributeID');
$openidUser = new eZOpenIDUser();
$http = eZHTTPTool::instance();
//RPX login
if ($http->hasPostVariable('token')) {
$token = $http->postVariable('token');
$post_data = array('token' => $http->postVariable('token'), 'apiKey' => $rpxApiKey, 'format' => 'json');
$ezopenid = new eZOpenID();
$form = $ezopenid->submitForm();
if (!$form) {
return false;
}
$post_data = $ezopenid->httpBuildQuery($post_data);
$response = $form->post("https://rpxnow.com/api/v2/auth_info", $post_data);
if (!$response) {
return false;
}
$raw_json = $response->body;
if (!$raw_json) {
return false;
}
$auth_info = json_decode($raw_json, true);
if ($auth_info['stat'] == 'ok') {
$profile = $auth_info['profile'];
$identifier = $profile['identifier'];
if (isset($profile['photo'])) {
$photo_url = $profile['photo'];
}
if (isset($profile['displayName'])) {
$name = $profile['displayName'];
}
if (isset($profile['email'])) {
$email = $profile['email'];
}
if ($identifier or $email) {
$http->setSessionVariable('Token', 1);
if ($siteINI->variable('UserSettings', 'RequireUniqueEmail') == 'true') {
$user = $openidUser->LogInOpenIDUser(false, $email);
if ($user) {
return $user;
}
}
$user = $openidUser->LogInOpenIDUser($identifier, false);
if ($user) {
return $user;
} else {
//On demand: for functionality to register a new account automatically, contact info@contactivity.com
}
}
}
return false;
} elseif ($http->hasPostVariable('OpenIDURL') or $http->hasSessionVariable('OpenIDURL')) {
if (!$http->hasSessionVariable('OpenIDURL')) {
if (!$http->hasPostVariable('OpenIDURL')) {
return false;
}
$url = $http->postVariable('OpenIDURL');
$ezopenid = new eZOpenID();
$identifier = $ezopenid->normalizeUrl($url);
if (!$identifier) {
return false;
}
$consumer = $ezopenid->getConsumer();
if (!$consumer) {
return false;
}
$auth_request = $consumer->begin($identifier);
if (!$auth_request) {
return false;
}
$redirect_url = $auth_request->redirectURL($ezopenid->getTrustRoot(), $ezopenid->getReturnTo('login'));
if (!$redirect_url) {
return false;
}
$http->setSessionVariable('OpenIDURL', $identifier);
return eZHTTPTool::redirect($redirect_url);
eZExecution::cleanExit();
} else {
$identifier = $http->sessionVariable('OpenIDURL');
$http->removeSessionVariable('OpenIDURL');
$ezopenid = new eZOpenID();
$consumer = $ezopenid->getConsumer();
$return_to = $ezopenid->getReturnTo('login');
$auth_info = $consumer->complete($return_to);
if ($auth_info->status == "success" and $identifier) {
$user = $openidUser->LogInOpenIDUser($identifier, false);
if ($user) {
return $user;
} else {
//On demand: for functionality to register a new account automatically, contact info@contactivity.com
}
}
}
}
return false;
//.........这里部分代码省略.........
示例12: array
<?php
/***********************
Redirections Completel
***********************/
$site_FR = 'http://www.completel.fr';
//$site_FR = 'http://195.167.195.205';
//$site_FR = '';
$aRedirections = array();
/**
* Transformation de l'URI pour avoir une adresse dénuée de caractères spéciaux et exploitable
*/
$patternURI = array("'é'", "'è'", "'ë'", "'ê'", "'É'", "'È'", "'Ë'", "'Ê'", "'á'", "'à'", "'ä'", "'â'", "'å'", "'Á'", "'À'", "'Ä'", "'Â'", "'Å'", "'ó'", "'ò'", "'ö'", "'ô'", "'Ó'", "'Ò'", "'Ö'", "'Ô'", "'í'", "'ì'", "'ï'", "'î'", "'Í'", "'Ì'", "'Ï'", "'Î'", "'ú'", "'ù'", "'ü'", "'û'", "'Ú'", "'Ù'", "'Ü'", "'Û'", "'ý'", "'ÿ'", "'Ý'", "'ø'", "'Ø'", "'œ'", "'Œ'", "'Æ'", "'ç'", "'Ç'");
$replaceURI = array('e', 'e', 'e', 'e', 'E', 'E', 'E', 'E', 'a', 'a', 'a', 'a', 'a', 'A', 'A', 'A', 'A', 'A', 'o', 'o', 'o', 'o', 'O', 'O', 'O', 'O', 'i', 'i', 'i', 'I', 'I', 'I', 'I', 'I', 'u', 'u', 'u', 'u', 'U', 'U', 'U', 'U', 'y', 'y', 'Y', 'o', 'O', 'a', 'A', 'A', 'c', 'C');
$requestURI = preg_replace($patternURI, $replaceURI, urldecode($_SERVER['REQUEST_URI']));
foreach ($aRedirections as $pattern => $redirectUri) {
if (preg_match($pattern, $requestURI) == 1) {
eZHTTPTool::redirect($redirectUri, array(), 301);
eZExecution::cleanExit();
}
}
/**
* Cas particulier : capture de $_GET
*/
$redirectMask = array('`^/recherche\\?searchword=(.*)$`' => $site_FR . '/content/search?SearchText=$1');
foreach ($redirectMask as $pattern => $redirectUri) {
if (($newUrl = preg_replace($pattern, $redirectUri, $requestURI)) != $requestURI) {
eZHTTPTool::redirect($newUrl, array(), 301);
eZExecution::cleanExit();
}
}
示例13: array
<?php
/**
* Vue permettant de rediriger les URLs de MF v2 vers celles de la v3
* @copyright Copyright (C) 2011 - Metal France. All rights reserved
* @author Jerome Vieilledent
* @version 3.0
* @package metalfrance
* @subpackage mfcompat
*/
$Module = $Params['Module'];
$Result = array();
$http = eZHTTPTool::instance();
$mfINI = eZINI::instance('metalfrance.ini');
try {
$url = MFCompat::getRedirectImage($Params['Type'], $Params['Name']);
eZHTTPTool::redirect('/' . $url, array(), '301');
} catch (Exception $e) {
$errMsg = $e->getMessage();
eZLog::write($errMsg, 'mfcompat-error.log');
eZDebug::writeError($errMsg, 'MFCompat::Redirect');
return $Module->handleError(eZError::KERNEL_NOT_FOUND, 'kernel');
}
示例14: editTranslation
/**
* @desc The view : edit
* @author David LE RICHE <david.leriche@openwide.fr>
* @param array $Params => view parameter array
* @return array
* @copyright 2012
* @version 1.1
*/
public function editTranslation($Params)
{
// get the list of translation file
$fileTranslationList = self::getTranslationListFile();
if (isset($_POST['todo']) && $_POST['todo'] == 'validEdit') {
$params = array();
unset($_POST['todo']);
foreach ($_POST as $key => $value) {
$params[$key] = $value;
}
$params['fileTranslationList'] = $fileTranslationList;
try {
$parseFile = new OWTranslateParseFile($params);
$parseFile->setTranslation();
eZHTTPTool::redirect('/translate/list');
} catch (Exception $e) {
eZLog::write($e, 'owtranslate.log');
}
} else {
// parse file
$parseFileParams = array('fileTranslationList' => $fileTranslationList, 'sourceKey' => isset($Params['UserParameters']['sourceKey']) ? $Params['UserParameters']['sourceKey'] : '', 'dataKey' => isset($Params['UserParameters']['dataKey']) ? $Params['UserParameters']['dataKey'] : '');
try {
$parseFile = new OWTranslateParseFile($parseFileParams);
$dataforEdit = $parseFile->getTranslationForEdit();
// return the view
$tpl = eZTemplate::factory();
$tpl->setVariable('dataforEdit', $dataforEdit);
$tpl->setVariable('sourceKey', $parseFileParams['sourceKey']);
$tpl->setVariable('dataKey', $parseFileParams['dataKey']);
$tpl->setVariable('languageList', $parseFile->languageList);
$Result = self::getView('edit', $tpl);
return $Result;
} catch (Exception $e) {
eZLog::write($e, 'owtranslate.log');
}
}
}