当前位置: 首页>>代码示例>>PHP>>正文


PHP eZSys::requestURI方法代码示例

本文整理汇总了PHP中eZSys::requestURI方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSys::requestURI方法的具体用法?PHP eZSys::requestURI怎么用?PHP eZSys::requestURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZSys的用法示例。


在下文中一共展示了eZSys::requestURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct(array $settings = array())
 {
     $this->settings = $settings + array('use-cache-headers' => true, 'max-age' => 86400, 'siteaccess' => null, 'use-exceptions' => false);
     unset($settings);
     require_once __DIR__ . '/treemenu_functions.php';
     $this->setUseExceptions($this->settings['use-exceptions']);
     header('X-Powered-By: ' . eZPublishSDK::EDITION . ' (index_treemenu)');
     if ($this->settings['use-cache-headers'] === true) {
         define('MAX_AGE', $this->settings['max-age']);
         if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
             header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
             header('Expires: ' . gmdate('D, d M Y H:i:s', time() + MAX_AGE) . ' GMT');
             header('Cache-Control: max-age=' . MAX_AGE);
             header('Last-Modified: ' . gmdate('D, d M Y H:i:s', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) . ' GMT');
             header('Pragma: ');
             exit;
         }
     }
     // Tweaks ini filetime checks if not defined!
     // This makes ini system not check modified time so
     // that index_treemenu.php can assume that index.php does
     // this regular enough, set in config.php to override.
     if (!defined('EZP_INI_FILEMTIME_CHECK')) {
         define('EZP_INI_FILEMTIME_CHECK', false);
     }
     eZExecution::addFatalErrorHandler(function () {
         header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
     });
     eZDebug::setHandleType(eZDebug::HANDLE_FROM_PHP);
     // Trick to get eZSys working with a script other than index.php (while index.php still used in generated URLs):
     $_SERVER['SCRIPT_FILENAME'] = str_replace('/index_treemenu.php', '/index.php', $_SERVER['SCRIPT_FILENAME']);
     $_SERVER['PHP_SELF'] = str_replace('/index_treemenu.php', '/index.php', $_SERVER['PHP_SELF']);
     $ini = eZINI::instance();
     $timezone = $ini->variable('TimeZoneSettings', 'TimeZone');
     if ($timezone) {
         putenv("TZ={$timezone}");
     }
     // init uri code
     $GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable('REQUEST_URI');
     eZSys::init('index.php', $ini->variable('SiteAccessSettings', 'ForceVirtualHost') === 'true');
     $this->uri = eZURI::instance(eZSys::requestURI());
     $GLOBALS['eZRequestedURI'] = $this->uri;
     // Check for extension
     eZExtension::activateExtensions('default');
     // load siteaccess
     // Use injected siteaccess if available or match it internally.
     $this->access = isset($this->settings['siteaccess']) ? $this->settings['siteaccess'] : eZSiteAccess::match($this->uri, eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile());
     eZSiteAccess::change($this->access);
     // Check for new extension loaded by siteaccess
     eZExtension::activateExtensions('access');
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:51,代码来源:ezpkerneltreemenu.php

示例2: filterKeys

 /**
  * Filters cache keys when needed.
  * Useful to avoid having current URI as a cache key if an error has occurred and has been caught by error module.
  *
  * @param array $keys
  */
 private static function filterKeys(array &$keys)
 {
     if (isset($GLOBALS['eZRequestError']) && $GLOBALS['eZRequestError'] === true) {
         $requestUri = eZSys::requestURI();
         foreach ($keys as $i => &$key) {
             if (is_array($key)) {
                 self::filterKeys($key);
             } else {
                 if ($key === $requestUri) {
                     unset($keys[$i]);
                 }
             }
         }
     }
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:21,代码来源:eztemplatecacheblock.php

示例3: str_replace

// Trick to get eZSys working with a script other than index.php (while index.php still used in generated URLs):
$_SERVER['SCRIPT_FILENAME'] = str_replace( '/index_treemenu.php', '/index.php', $_SERVER['SCRIPT_FILENAME'] );
$_SERVER['PHP_SELF'] = str_replace( '/index_treemenu.php', '/index.php', $_SERVER['PHP_SELF'] );

$ini = eZINI::instance();
$timezone = $ini->variable( 'TimeZoneSettings', 'TimeZone' );
if ( $timezone )
{
    putenv( "TZ=$timezone" );
}

// init uri code
$GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable( 'REQUEST_URI' );
eZSys::init( 'index.php', $ini->variable( 'SiteAccessSettings', 'ForceVirtualHost' ) === 'true' );
$uri = eZURI::instance( eZSys::requestURI() );

$GLOBALS['eZRequestedURI'] = $uri;

// Check for extension
eZExtension::activateExtensions( 'default' );

// load siteaccess
$access = eZSiteAccess::match( $uri,
                      eZSys::hostname(),
                      eZSys::serverPort(),
                      eZSys::indexFile() );
$access = eZSiteAccess::change( $access );
$GLOBALS['eZCurrentAccess'] = $access;

// Check for new extension loaded by siteaccess
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:30,代码来源:index_treemenu.php

示例4: 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;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:99,代码来源:ezuser.php

示例5: __construct

 /**
  * @param array $settings
  * @param null $responseWriterClass Name of the ezpRestHttpResponseWriter implementation to use during request
  */
 public function __construct(array $settings = array(), $responseWriterClass = null)
 {
     $this->responseWriterClass = $responseWriterClass;
     if (isset($settings['injected-settings'])) {
         $injectedSettings = array();
         foreach ($settings['injected-settings'] as $keySetting => $injectedSetting) {
             list($file, $section, $setting) = explode('/', $keySetting);
             $injectedSettings[$file][$section][$setting] = $injectedSetting;
         }
         // Those settings override anything else in local .ini files and their overrides
         eZINI::injectSettings($injectedSettings);
     }
     if (isset($settings['injected-merge-settings'])) {
         $injectedSettings = array();
         foreach ($settings['injected-merge-settings'] as $keySetting => $injectedSetting) {
             list($file, $section, $setting) = explode('/', $keySetting);
             $injectedSettings[$file][$section][$setting] = $injectedSetting;
         }
         // Those settings override anything else in local .ini files and their overrides
         eZINI::injectMergeSettings($injectedSettings);
     }
     $this->settings = $settings + array('use-cache-headers' => true, 'max-age' => 86400, 'siteaccess' => null, 'use-exceptions' => false);
     unset($settings, $injectedSettings, $file, $section, $setting, $keySetting, $injectedSetting);
     // lazy loaded database driver
     include __DIR__ . '/lazy.php';
     $this->setUseExceptions($this->settings['use-exceptions']);
     // Tweaks ini filetime checks if not defined!
     // This makes ini system not check modified time so
     // that index_treemenu.php can assume that index.php does
     // this regular enough, set in config.php to override.
     if (!defined('EZP_INI_FILEMTIME_CHECK')) {
         define('EZP_INI_FILEMTIME_CHECK', false);
     }
     eZExecution::addFatalErrorHandler(function () {
         if (!headers_sent()) {
             header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
         }
     });
     eZDebug::setHandleType(eZDebug::HANDLE_FROM_PHP);
     // Trick to get eZSys working with a script other than index.php (while index.php still used in generated URLs):
     $_SERVER['SCRIPT_FILENAME'] = str_replace('/index_rest.php', '/index.php', $_SERVER['SCRIPT_FILENAME']);
     $_SERVER['PHP_SELF'] = str_replace('/index_rest.php', '/index.php', $_SERVER['PHP_SELF']);
     $ini = eZINI::instance();
     $timezone = $ini->variable('TimeZoneSettings', 'TimeZone');
     if ($timezone) {
         putenv("TZ={$timezone}");
     }
     eZDebug::setHandleType(eZDebug::HANDLE_NONE);
     $GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable('REQUEST_URI');
     $ini = eZINI::instance();
     eZSys::init('index_rest.php', $ini->variable('SiteAccessSettings', 'ForceVirtualHost') == 'true');
     $uri = eZURI::instance(eZSys::requestURI());
     $GLOBALS['eZRequestedURI'] = $uri;
     // load extensions
     eZExtension::activateExtensions('default');
     require_once __DIR__ . '/restkernel_functions.php';
     // set siteaccess from X-Siteaccess header if given and exists
     if (isset($_SERVER['HTTP_X_SITEACCESS']) && eZSiteAccess::exists($_SERVER['HTTP_X_SITEACCESS'])) {
         $access = array('name' => $_SERVER['HTTP_X_SITEACCESS'], 'type' => eZSiteAccess::TYPE_STATIC);
     } else {
         $access = eZSiteAccess::match($uri, eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile());
     }
     eZSiteAccess::change($access);
     // load siteaccess extensions
     eZExtension::activateExtensions('access');
     // Now that all extensions are activated and siteaccess has been changed, reset
     // all eZINI instances as they may not take into account siteaccess specific settings.
     eZINI::resetAllInstances(false);
     if (ezpRestDebug::isDebugEnabled()) {
         $debug = ezpRestDebug::getInstance();
         $debug->updateDebugSettings();
     }
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:77,代码来源:ezpkernelrest.php

示例6: instance

 /**
  * Returns a shared instance of the eZURI class IF $uri is false or the same as current
  * request uri, if not then a new non shared instance is created.
  *
  * @param bool|string $uri Shared uri instance if false
  * @return eZURI
  */
 public static function instance($uri = false)
 {
     // If $uri is false we assume the caller wants eZSys::requestURI()
     if ($uri === false or $uri == eZSys::requestURI()) {
         if (!isset($GLOBALS['eZURIRequestInstance'])) {
             $GLOBALS['eZURIRequestInstance'] = new eZURI(eZSys::requestURI());
         }
         return $GLOBALS['eZURIRequestInstance'];
     }
     return new eZURI($uri);
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:18,代码来源:ezuri.php

示例7: requestInit

 protected function requestInit()
 {
     if ($this->isInitialized) {
         return;
     }
     eZExecution::setCleanExit(false);
     $scriptStartTime = microtime(true);
     $GLOBALS['eZRedirection'] = false;
     $this->access = eZSiteAccess::current();
     eZDebug::setScriptStart($scriptStartTime);
     eZDebug::addTimingPoint("Script start");
     $this->uri = eZURI::instance(eZSys::requestURI());
     $GLOBALS['eZRequestedURI'] = $this->uri;
     // Be able to do general events early in process
     ezpEvent::getInstance()->notify('request/preinput', array($this->uri));
     // Initialize module loading
     $this->siteBasics['module-repositories'] = eZModule::activeModuleRepositories();
     eZModule::setGlobalPathList($this->siteBasics['module-repositories']);
     // make sure we get a new $ini instance now that it has been reset
     $ini = eZINI::instance();
     // start: eZCheckValidity
     // pre check, setup wizard related so needs to be before session/db init
     // TODO: Move validity check in the constructor? Setup is not meant to be launched at each (sub)request is it?
     if ($ini->variable('SiteAccessSettings', 'CheckValidity') === 'true') {
         $this->check = array('module' => 'setup', 'function' => 'init');
         // Turn off some features that won't bee needed yet
         $this->siteBasics['policy-check-omit-list'][] = 'setup';
         $this->siteBasics['show-page-layout'] = $ini->variable('SetupSettings', 'PageLayout');
         $this->siteBasics['validity-check-required'] = true;
         $this->siteBasics['session-required'] = $this->siteBasics['user-object-required'] = false;
         $this->siteBasics['db-required'] = $this->siteBasics['no-cache-adviced'] = $this->siteBasics['url-translator-allowed'] = false;
         $this->siteBasics['site-design-override'] = $ini->variable('SetupSettings', 'OverrideSiteDesign');
         $this->access = eZSiteAccess::change(array('name' => 'setup', 'type' => eZSiteAccess::TYPE_URI));
         eZTranslatorManager::enableDynamicTranslations();
     }
     // stop: eZCheckValidity
     if ($this->siteBasics['session-required']) {
         // Check if this should be run in a cronjob
         if ($ini->variable('Session', 'BasketCleanup') !== 'cronjob') {
             eZSession::addCallback('destroy_pre', function (eZDBInterface $db, $key, $escapedKey) {
                 $basket = eZBasket::fetch($key);
                 if ($basket instanceof eZBasket) {
                     $basket->remove();
                 }
             });
             eZSession::addCallback('gc_pre', function (eZDBInterface $db, $time) {
                 eZBasket::cleanupExpired($time);
             });
             eZSession::addCallback('cleanup_pre', function (eZDBInterface $db) {
                 eZBasket::cleanup();
             });
         }
         // addCallBack to update session id for shop basket on session regenerate
         eZSession::addCallback('regenerate_post', function (eZDBInterface $db, $escNewKey, $escOldKey) {
             $db->query("UPDATE ezbasket SET session_id='{$escNewKey}' WHERE session_id='{$escOldKey}'");
         });
         // TODO: Session starting should be made only once in the constructor
         $this->sessionInit();
     }
     // if $this->siteBasics['db-required'], open a db connection and check that db is connected
     if ($this->siteBasics['db-required'] && !eZDB::instance()->isConnected()) {
         $this->warningList[] = array('error' => array('type' => 'kernel', 'number' => eZError::KERNEL_NO_DB_CONNECTION), 'text' => 'No database connection could be made, the system might not behave properly.');
     }
     // eZCheckUser: pre check, RequireUserLogin & FORCE_LOGIN related so needs to be after session init
     if (!isset($this->check)) {
         $this->check = eZUserLoginHandler::preCheck($this->siteBasics, $this->uri);
     }
     ezpEvent::getInstance()->notify('request/input', array($this->uri));
     // Initialize with locale settings
     // TODO: Move to constructor? Is it relevant to init the locale/charset for each (sub)requests?
     $this->languageCode = eZLocale::instance()->httpLocaleCode();
     $phpLocale = trim($ini->variable('RegionalSettings', 'SystemLocale'));
     if ($phpLocale != '') {
         setlocale(LC_ALL, explode(',', $phpLocale));
     }
     $this->httpCharset = eZTextCodec::httpCharset();
     // TODO: are these parameters supposed to vary across potential sub-requests?
     $this->site = array('title' => $ini->variable('SiteSettings', 'SiteName'), 'design' => $ini->variable('DesignSettings', 'SiteDesign'), 'http_equiv' => array('Content-Type' => 'text/html; charset=' . $this->httpCharset, 'Content-language' => $this->languageCode));
     // Read role settings
     $this->siteBasics['policy-check-omit-list'] = array_merge($this->siteBasics['policy-check-omit-list'], $ini->variable('RoleSettings', 'PolicyOmitList'));
     $this->isInitialized = true;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:82,代码来源:ezpkernelweb.php

示例8: foreach

    $moduleResult['ui_context'] = $module->uiContextName();
}
$moduleResult['ui_component'] = $module->uiComponentName();
$moduleResult['is_mobile_device'] = $mobileDeviceDetect->isMobileDevice();
$moduleResult['mobile_device_alias'] = $mobileDeviceDetect->getUserAgentAlias();
$templateResult = null;
eZDebug::setUseExternalCSS($use_external_css);
if ($show_page_layout) {
    $tpl = eZTemplate::factory();
    if ($tpl->hasVariable('node')) {
        $tpl->unsetVariable('node');
    }
    if (!isset($moduleResult['path'])) {
        $moduleResult['path'] = false;
    }
    $moduleResult['uri'] = eZSys::requestURI();
    $tpl->setVariable("module_result", $moduleResult);
    $meta = $ini->variable('SiteSettings', 'MetaDataArray');
    if (!isset($meta['description'])) {
        $metaDescription = "";
        if (isset($moduleResult['path']) and is_array($moduleResult['path'])) {
            foreach ($moduleResult['path'] as $pathPart) {
                if (isset($pathPart['text'])) {
                    $metaDescription .= $pathPart['text'] . " ";
                }
            }
        }
        $meta['description'] = $metaDescription;
    }
    $site['uri'] = $oldURI;
    $site['redirect'] = false;
开发者ID:legende91,项目名称:ez,代码行数:31,代码来源:index.php

示例9: init

 static function init($index = "index.php", $force_VirtualHost = false)
 {
     $isCGI = substr(php_sapi_name(), 0, 3) == 'cgi';
     $instance = eZSys::instance();
     if (eZSys::isDebugEnabled()) {
         eZDebug::writeNotice(eZSys::serverVariable('PHP_SELF'), 'PHP_SELF');
         eZDebug::writeNotice(eZSys::serverVariable('SCRIPT_FILENAME'), 'SCRIPT_FILENAME');
         eZDebug::writeNotice(eZSys::serverVariable('DOCUMENT_ROOT'), 'DOCUMENT_ROOT');
         eZDebug::writeNotice(eZSys::serverVariable('REQUEST_URI'), 'REQUEST_URI');
         eZDebug::writeNotice(eZSys::serverVariable('QUERY_STRING'), 'QUERY_STRING');
         eZDebug::writeNotice(ini_get('include_path'), 'include_path');
     }
     $phpSelf = eZSys::serverVariable('PHP_SELF');
     // Find out, where our files are.
     if (preg_match("!(.*/){$index}\$!", eZSys::serverVariable('SCRIPT_FILENAME'), $regs)) {
         $siteDir = $regs[1];
         $index = "/{$index}";
     } elseif (preg_match("!(.*/){$index}/?!", $phpSelf, $regs)) {
         // Some people using CGI have their $_SERVER['SCRIPT_FILENAME'] not right... so we are trying this.
         $siteDir = eZSys::serverVariable('DOCUMENT_ROOT') . $regs[1];
         $index = "/{$index}";
     } else {
         // Fallback... doesn't work with virtual-hosts, but better than nothing
         $siteDir = "./";
         $index = "/{$index}";
     }
     if ($isCGI and !$force_VirtualHost) {
         $index .= '?';
     }
     // Setting the right include_path
     $includePath = ini_get("include_path");
     if (trim($includePath) != "") {
         $includePath = $includePath . $instance->envSeparator() . $siteDir;
     } else {
         $includePath = $siteDir;
     }
     ini_set("include_path", $includePath);
     $scriptName = eZSys::serverVariable('SCRIPT_NAME');
     // Get the webdir.
     $wwwDir = "";
     if ($force_VirtualHost) {
         $wwwDir = "";
     } else {
         if (preg_match("!(.*){$index}\$!", $scriptName, $regs)) {
             $wwwDir = $regs[1];
         }
         if (preg_match("!(.*){$index}\$!", $phpSelf, $regs)) {
             $wwwDir = $regs[1];
         }
     }
     if (!$isCGI || $force_VirtualHost) {
         $requestURI = eZSys::serverVariable('REQUEST_URI');
     } else {
         $requestURI = eZSys::serverVariable('QUERY_STRING');
         /* take out PHPSESSID, if url-encoded */
         if (preg_match("/(.*)&PHPSESSID=[^&]+(.*)/", $requestURI, $matches)) {
             $requestURI = $matches[1] . $matches[2];
         }
     }
     // Fallback... Finding the paths above failed, so $_SERVER['PHP_SELF'] is not set right.
     if ($siteDir == "./") {
         $phpSelf = $requestURI;
     }
     if (!$isCGI) {
         $index_reg = str_replace(".", "\\.", $index);
         // Trick: Rewrite setup doesn't have index.php in $_SERVER['PHP_SELF'], so we don't want an $index
         if (!preg_match("!.*{$index_reg}.*!", $phpSelf) || $force_VirtualHost) {
             $index = "";
         } else {
             if (eZSys::isDebugEnabled()) {
                 eZDebug::writeNotice("{$wwwDir}{$index}", '$wwwDir$index');
             }
             // Get the right $_SERVER['REQUEST_URI'], when using nVH setup.
             if (preg_match("!^{$wwwDir}{$index}(.*)!", $phpSelf, $req)) {
                 if (!$req[1]) {
                     if ($phpSelf != "{$wwwDir}{$index}" and preg_match("!^{$wwwDir}(.*)!", $requestURI, $req)) {
                         $requestURI = $req[1];
                         $index = '';
                     } elseif ($phpSelf == "{$wwwDir}{$index}" and (preg_match("!^{$wwwDir}{$index}(.*)!", $requestURI, $req) or preg_match("!^{$wwwDir}(.*)!", $requestURI, $req))) {
                         $requestURI = $req[1];
                     }
                 } else {
                     $requestURI = $req[1];
                 }
             }
         }
     }
     if ($isCGI and $force_VirtualHost) {
         $index = '';
     }
     // Remove url parameters
     if ($isCGI and !$force_VirtualHost) {
         $pattern = "!(\\/[^&]+)!";
     } else {
         $pattern = "!([^?]+)!";
     }
     if (preg_match($pattern, $requestURI, $regs)) {
         $requestURI = $regs[1];
     }
     // Remove internal links
//.........这里部分代码省略.........
开发者ID:runelangseid,项目名称:ezpublish,代码行数:101,代码来源:ezsys.php

示例10: redirect

 /**
  * Handles redirection to the mobile optimized interface
  *
  */
 public function redirect()
 {
     $http = eZHTTPTool::instance();
     $currentSiteAccess = eZSiteAccess::current();
     if ($http->hasGetVariable('notmobile')) {
         setcookie('eZMobileDeviceDetect', 1, time() + (int) eZINI::instance()->variable('SiteAccessSettings', 'MobileDeviceDetectCookieTimeout'), '/');
         $http->redirect(eZSys::indexDir());
         eZExecution::cleanExit();
     }
     if (!isset($_COOKIE['eZMobileDeviceDetect']) && !in_array($currentSiteAccess['name'], eZINI::instance()->variable('SiteAccessSettings', 'MobileSiteAccessList'))) {
         $currentUrl = eZSys::serverURL() . eZSys::requestURI();
         $redirectUrl = eZINI::instance()->variable('SiteAccessSettings', 'MobileSiteAccessURL');
         // Do not redirect if already on the redirect url
         if (strpos($currentUrl, $redirectUrl) !== 0) {
             // Default siteaccess name needs to be removed from the uri when redirecting
             $uri = explode('/', ltrim(eZSys::requestURI(), '/'));
             if (array_shift($uri) == $currentSiteAccess['name']) {
                 $http->redirect($redirectUrl . '/' . implode('/', $uri));
             } else {
                 $http->redirect($redirectUrl . eZSys::requestURI());
             }
         }
         eZExecution::cleanExit();
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:29,代码来源:ezpmobiledeviceregexpfilter.php

示例11: 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();
     }
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:53,代码来源:ezsslzone.php

示例12: generateViewParametersString

 private function generateViewParametersString($preSeparator = '', $postSeparator = '')
 {
     // taking view parameters and generate a string with them
     $eZURI = eZURI::instance(eZSys::requestURI());
     $viewParametersString = '';
     foreach ($eZURI->UserArray as $paramName => $paramValue) {
         $viewParametersString .= $preSeparator . $paramName . $postSeparator . $paramValue;
     }
     return $viewParametersString;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:10,代码来源:ezsiblockfunction.php

示例13: customClassAttributeHTTPAction

 public function customClassAttributeHTTPAction($http, $action, $classAttribute)
 {
     $object = false;
     preg_match("#^(.*)_([0-9]+)\$#", $action, $matches);
     if (count($matches) === 3) {
         $action = $matches[1];
         $object = eZContentObject::fetch($matches[2]);
     }
     $skipUserIDs = $classAttribute->attribute(self::$definition['skip_user_ids']['field']);
     $skipUserIDs = explode(',', $skipUserIDs);
     switch ($action) {
         case 'browse_user':
             $ini = eZINI::instance();
             $id = $classAttribute->attribute('id');
             $uri = eZURI::instance(eZSys::requestURI());
             $userClass = eZContentClass::fetch($ini->variable('UserSettings', 'UserClassID'));
             if ($userClass instanceof eZContentClass === false) {
                 break;
             }
             $browseParameters = array('action_name' => 'AddRelatedObjectToDataType', 'browse_custom_action' => array('name' => 'CustomActionButton[' . $id . '_add_user]', 'value' => 'add_user'), 'persistent_data' => array('ContentClassHasInput' => 0), 'from_page' => $uri->originalURIString(), 'start_node' => 5, 'class_array' => array($userClass->attribute('identifier')));
             $module = null;
             $browseURL = eZContentBrowse::browse($browseParameters, $module);
             eZURI::transformURI($browseURL);
             $http->redirect($browseURL);
             break;
         case 'add_user':
             if ($http->hasPostVariable('SelectedObjectIDArray') && $http->hasPostVariable('BrowseCancelButton') === false) {
                 $selectedObjectIDs = $http->postVariable('SelectedObjectIDArray');
                 $selectedObjectID = $selectedObjectIDs[0];
             }
             if (in_array($selectedObjectID, $skipUserIDs) === false) {
                 $skipUserIDs[] = $selectedObjectID;
                 $classAttribute->setAttribute(self::$definition['skip_user_ids']['field'], implode(',', $skipUserIDs));
             }
             break;
         case 'remove_skip_user':
             if ($object instanceof eZContentObject) {
                 foreach ($skipUserIDs as $key => $userID) {
                     if ($userID == $object->attribute('id')) {
                         unset($skipUserIDs[$key]);
                         break;
                     }
                 }
                 $classAttribute->setAttribute(self::$definition['skip_user_ids']['field'], implode(',', $skipUserIDs));
             }
             break;
     }
 }
开发者ID:philandteds,项目名称:nxc_captcha,代码行数:48,代码来源:nxccaptchatype.php

示例14: 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();
        }
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:53,代码来源:ezsslzone.php

示例15: modify

 function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     $ini = eZINI::instance('xrowmetadata.ini');
     $page_limit = $ini->variable('EditorInputSettings', 'MaxPageLimit');
     $uri = eZURI::instance(eZSys::requestURI());
     $viewParameters = $uri->UserParameters();
     if (count($viewParameters) == 0) {
         $page_offset = 0;
     } else {
         $page_offset = $viewParameters['offset'];
     }
     switch ($operatorName) {
         case 'metadata':
             if (isset($namedParameters['node_id'])) {
                 $node = eZContentObjectTreeNode::fetch($namedParameters['node_id']);
                 if ($node instanceof eZContentObjectTreeNode) {
                     $cur_parent = $node->fetchParent();
                     $obj_name = $node->getName();
                     $obj_count = $node->subTreeCount(array('IgnoreVisibility' => true));
                     $localbusiness_count = $node->subTreeCount(array('IgnoreVisibility' => true, 'ClassFilterType' => 'include', 'ClassFilterArray' => array('localbusiness')));
                     $path_array_temp = array_reverse(explode('/', $node->pathWithNames()));
                     $obj_path = implode(' | ', $path_array_temp);
                     $obj_parentname = $cur_parent->Name;
                     $page_count = ceil($localbusiness_count / $page_limit);
                     $page_nr = $page_offset / $page_limit + 1;
                     $page_count_value = ezpI18n::tr('kernel/classes/datatypes', 'page') . " " . $page_nr . "/" . $page_count;
                     $operatorValue = xrowMetaDataFunctions::fetchByObject($node->attribute('object'));
                     if ($operatorValue !== false) {
                         if (isset($operatorValue->title)) {
                             $search_title = $operatorValue->title;
                             $placeholder_title_array = self::getPlaceholders($search_title);
                             if (count($placeholder_title_array) !== 0) {
                                 foreach ($placeholder_title_array as $placeholder_title) {
                                     switch ($placeholder_title) {
                                         case "count":
                                             $meta_title = str_replace("[count]", $obj_count, $search_title);
                                             continue;
                                         case "name":
                                             $meta_title = str_replace("[name]", $obj_name, $search_title);
                                             continue;
                                         case "path":
                                             $meta_title = str_replace("[path]", $obj_path, $search_title);
                                             continue;
                                         case "parentname":
                                             $meta_title = str_replace("[parentname]", $obj_parentname, $search_title);
                                             continue;
                                         case "count:localbusiness":
                                             $meta_title = str_replace("[count:localbusiness]", $localbusiness_count, $search_title);
                                             continue;
                                         case "pagecount":
                                             $meta_title = str_replace("[pagecount]", $page_count_value, $search_title);
                                             continue;
                                     }
                                     $search_title = $meta_title;
                                 }
                                 $operatorValue->title = $search_title;
                                 unset($search_title);
                             }
                         }
                         if (isset($operatorValue->description)) {
                             $search_description = $operatorValue->description;
                             $placeholder_title_description = self::getPlaceholders($search_description);
                             if (count($placeholder_title_description) !== 0) {
                                 foreach ($placeholder_title_description as $placeholder_description) {
                                     switch ($placeholder_description) {
                                         case "count":
                                             $meta_description = str_replace("[count]", $obj_count, $search_description);
                                             continue;
                                         case "name":
                                             $meta_description = str_replace("[name]", $obj_name, $search_description);
                                             continue;
                                         case "path":
                                             $meta_description = str_replace("[path]", $obj_path, $search_description);
                                             continue;
                                         case "parentname":
                                             $meta_description = str_replace("[parentname]", $obj_parentname, $search_description);
                                             continue;
                                         case "count:localbusiness":
                                             $meta_description = str_replace("[count:localbusiness]", $localbusiness_count, $search_description);
                                             continue;
                                         case "pagecount":
                                             $meta_description = str_replace("[pagecount]", $page_count_value, $search_description);
                                             continue;
                                     }
                                     $search_description = $meta_description;
                                 }
                                 $operatorValue->description = $search_description;
                                 unset($search_description);
                             }
                         }
                     }
                 } else {
                     $operatorValue = false;
                 }
             } else {
                 $operatorValue = false;
             }
             break;
     }
 }
开发者ID:rantoniazzi,项目名称:xrowmetadata,代码行数:100,代码来源:xrowmetadataoperator.php


注:本文中的eZSys::requestURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。