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


PHP eZSys::indexDir方法代码示例

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


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

示例1: createRequestParser

 public function createRequestParser()
 {
     $parser = new ezpRestHttpRequestParser();
     if (strpos($_SERVER['SCRIPT_NAME'], self::INDEX_FILE) !== false) {
         // In non-vhost mode we need to build the prefix to be removed from URI
         $parser->prefix = eZSys::indexDir(true);
     }
     return $parser;
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:9,代码来源:mvc_configuration.php

示例2: 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'))) {
         $http->redirect(eZINI::instance()->variable('SiteAccessSettings', 'MobileSiteAccessURL'));
         eZExecution::cleanExit();
     }
 }
开发者ID:netbliss,项目名称:ezpublish,代码行数:18,代码来源:ezpmobiledeviceregexpfilter.php

示例3: createRedirectionUrl

 function createRedirectionUrl($process)
 {
     //__DEBUG__
     $this->logger->writeTimedString("createRedirectionUrl");
     //___end____
     $paypalINI = eZINI::instance('paypal.ini');
     $paypalServer = $paypalINI->variable('ServerSettings', 'ServerName');
     $requestURI = $paypalINI->variable('ServerSettings', 'RequestURI');
     $business = urlencode($paypalINI->variable('PaypalSettings', 'Business'));
     $processParams = $process->attribute('parameter_list');
     $orderID = $processParams['order_id'];
     $indexDir = eZSys::indexDir();
     $localHost = eZSys::serverURL();
     $localURI = eZSys::serverVariable('REQUEST_URI');
     $order = eZOrder::fetch($orderID);
     $amount = urlencode($order->attribute('total_inc_vat'));
     $currency = urlencode($order->currencyCode());
     //        include_once( 'lib/ezlocale/classes/ezlocale.php' );
     $locale = eZLocale::instance();
     $countryCode = urlencode($locale->countryCode());
     $maxDescLen = $paypalINI->variable('PaypalSettings', 'MaxDescriptionLength');
     $itemName = urlencode($this->createShortDescription($order, $maxDescLen));
     $accountInfo = $order->attribute('account_information');
     $first_name = urlencode($accountInfo['first_name']);
     $last_name = urlencode($accountInfo['last_name']);
     $street = urlencode($accountInfo['street2']);
     $zip = urlencode($accountInfo['zip']);
     $state = urlencode($accountInfo['state']);
     $place = urlencode($accountInfo['place']);
     $image_url = "{$localHost}" . urlencode($paypalINI->variable('PaypalSettings', 'LogoURI'));
     $background = urlencode($paypalINI->variable('PaypalSettings', 'BackgroundColor'));
     $pageStyle = urlencode($paypalINI->variable('PaypalSettings', 'PageStyle'));
     $noNote = urlencode($paypalINI->variable('PaypalSettings', 'NoNote'));
     $noteLabel = $noNote == 1 ? '' : urlencode($paypalINI->variable('PaypalSettings', 'NoteLabel'));
     $noShipping = 1;
     $url = $paypalServer . $requestURI . "?cmd=_ext-enter" . "&redirect_cmd=_xclick" . "&business={$business}" . "&item_name={$itemName}" . "&custom={$orderID}" . "&amount={$amount}" . "&currency_code={$currency}" . "&first_name={$first_name}" . "&last_name={$last_name}" . "&address1={$street}" . "&zip={$zip}" . "&state={$state}" . "&city={$place}" . "&image_url={$image_url}" . "&cs={$background}" . "&page_style={$pageStyle}" . "&no_shipping={$noShipping}" . "&cn={$noteLabel}" . "&no_note={$noNote}" . "&lc={$countryCode}" . "&notify_url={$localHost}" . $indexDir . "/paypal/notify_url/" . "&return={$localHost}" . $indexDir . "/shop/checkout/" . "&cancel_return={$localHost}" . $indexDir . "/shop/basket/";
     //__DEBUG__
     $this->logger->writeTimedString("business       = {$business}");
     $this->logger->writeTimedString("item_name      = {$itemName}");
     $this->logger->writeTimedString("custom         = {$orderID}");
     $this->logger->writeTimedString("no_shipping    = {$noShipping}");
     $this->logger->writeTimedString("localHost      = {$localHost}");
     $this->logger->writeTimedString("amount         = {$amount}");
     $this->logger->writeTimedString("currency_code  = {$currency}");
     $this->logger->writeTimedString("notify_url     = {$localHost}" . $indexDir . "/paypal/notify_url/");
     $this->logger->writeTimedString("return         = {$localHost}" . $indexDir . "/shop/checkout/");
     $this->logger->writeTimedString("cancel_return  = {$localHost}" . $indexDir . "/shop/basket/");
     //___end____
     return $url;
 }
开发者ID:mugoweb,项目名称:ezpaypal,代码行数:50,代码来源:ezpaypalgateway.php

示例4: 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();
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:16,代码来源:redirectoperator.php

示例5: getIndexDir

 /**
  * Internal function to get current index dir
  *
  * @return string
  */
 protected static function getIndexDir()
 {
     static $cachedIndexDir = null;
     if ($cachedIndexDir === null) {
         $cachedIndexDir = eZSys::indexDir() . '/';
     }
     return $cachedIndexDir;
 }
开发者ID:legende91,项目名称:ez,代码行数:13,代码来源:ezjscserverfunctionsjs.php

示例6: getHTTPVariable

$pScope = getHTTPVariable('scope');
// @todo The spec mentions (FIXME:chapter) throwing an error if the request has extra parameters. Check this.
// Try loading the REST client based on the ID
$application = ezpRestClient::fetchByClientId($pClientId);
if (!$application instanceof ezpRestClient) {
    error($pRedirectUri, 'invalid_client');
}
// The client is found, validate the redirect_uri
if (!$application->isEndPointValid($pRedirectUri)) {
    error($pRedirectUri, 'redirect_uri_mismatch');
}
// authentication
$user = eZUser::currentUser();
// login is like REALLY required here. But we can't use the standard policy check, as it won't redirect w/ GET parameters
if (!$user->isRegistered()) {
    $redirectUri = str_replace(eZSys::indexDir(), '', $_SERVER['REQUEST_URI']);
    $tpl = eZTemplate::factory();
    $tpl->setVariable('redirect_uri', $redirectUri, 'User');
    $tpl->setVariable('site_access', array('allowed' => true));
    $result = array();
    $result['content'] = $tpl->fetch('design:user/login.tpl');
    $result['pagelayout'] = false;
    $result['path'] = array(array('text' => ezpI18n::tr('kernel/user', 'User'), 'url' => false), array('text' => ezpI18n::tr('kernel/user', 'Login'), 'url' => false));
    $result['pagelayout'] = 'oauthloginpagelayout.tpl';
    return $result;
}
// logged in, but no access to oauth/authorize
$access = $user->hasAccessTo('oauth', 'authorize');
if (!$access['accessWord'] == 'yes') {
    return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:authorize.php

示例7: currentSiteFromPath

 /**
  * Detects a possible/valid site-name in start of a path.
  *
  * From eZ Publish.
  *
  * @param string $path Eg. '/plain_site_user/Content/Folder1/file1.txt'
  * @return string The name of the site that was detected (eg. 'plain_site_user')
  *                or false if not site could be detected
  * @todo remove or move in another class?
  */
 public function currentSiteFromPath($path)
 {
     $indexDir = eZSys::indexDir();
     // Remove indexDir if used in non-virtualhost mode.
     if (preg_match("#^" . preg_quote($indexDir) . "(.+)\$#", $path, $matches)) {
         $path = $matches[1];
     }
     foreach ($this->availableSites as $site) {
         // Check if given path starts with this site-name, if so: return it.
         if (preg_match("#^/" . preg_quote($site) . "(.*)\$#", $path, $matches)) {
             return $site;
         }
     }
     return false;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:25,代码来源:ezwebdavcontentbackend.php

示例8: processURL

    function processURL( $url )
    {
        $this->appendLogEntry( "start url: $url", 'CS:processURL' );
        $indexDir = eZSys::indexDir();
        $len = strlen( $indexDir );

        if ( $indexDir == substr( $url, 0, $len ) )
        {
            $url = substr( $url, $len );
        }

        // Remove the starting / if there is one
        // the rest of the operation code expects this to not be present
        if ( strlen( $url ) > 0 and $url[0] == '/' )
            $url = substr( $url, 1 );

        $this->appendLogEntry( "indexdir url: $url", 'CS:processURL' );
        return $url;
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:19,代码来源:ezwebdavcontentserver.php

示例9: 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();
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:74,代码来源:ezpkernelweb.php

示例10: foreach

     if ($redirUri == "enabled") {
         $automatic_redir = false;
     } else {
         $redirUris = $ini->variableArray("DebugSettings", "DebugRedirection");
         $uri = eZURI::instance(eZSys::requestURI());
         $uri->toBeginning();
         foreach ($redirUris as $redirUri) {
             $redirUri = new eZURI($redirUri);
             if ($redirUri->matchBase($uri)) {
                 $automatic_redir = false;
                 break;
             }
         }
     }
 }
 $redirectURI = eZSys::indexDir();
 $moduleRedirectUri = $module->redirectURI();
 $redirectStatus = $module->redirectStatus();
 $translatedModuleRedirectUri = $moduleRedirectUri;
 if ($ini->variable('URLTranslator', 'Translation') == 'enabled' && eZURLAliasML::urlTranslationEnabledByUri(new eZURI($moduleRedirectUri))) {
     if (eZURLAliasML::translate($translatedModuleRedirectUri, true)) {
         $moduleRedirectUri = $translatedModuleRedirectUri;
         if (strlen($moduleRedirectUri) > 0 and $moduleRedirectUri[0] != '/') {
             $moduleRedirectUri = '/' . $moduleRedirectUri;
         }
     }
 }
 if (preg_match('#^(\\w+:)|^//#', $moduleRedirectUri)) {
     $redirectURI = $moduleRedirectUri;
 } else {
     $leftSlash = false;
开发者ID:legende91,项目名称:ez,代码行数:31,代码来源:index.php

示例11: 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

示例12: 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

示例13: 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

示例14: siteaccessURLs

 /**
  * @return array Urls to access user and admin siteaccesses
  */
 function siteaccessURLs()
 {
     $siteType = $this->chosenSiteType();
     $url = $siteType['url'];
     if (!preg_match("#^[a-zA-Z0-9]+://(.*)\$#", $url)) {
         $url = 'http://' . $url;
     }
     $currentURL = $url;
     $adminURL = $url;
     if ($siteType['access_type'] == 'url') {
         $ini = eZINI::instance();
         if ($ini->hasVariable('SiteSettings', 'DefaultAccess')) {
             $siteType['access_type_value'] = $ini->variable('SiteSettings', 'DefaultAccess');
         }
         $url .= '/' . $siteType['access_type_value'];
         $adminURL .= '/' . $siteType['admin_access_type_value'];
     } else {
         if ($siteType['access_type'] == 'hostname') {
             $url = $siteType['access_type_value'];
             $adminURL = $siteType['admin_access_type_value'];
             if (!preg_match("#^[a-zA-Z0-9]+://(.*)\$#", $url)) {
                 $url = 'http://' . $url;
             }
             if (!preg_match("#^[a-zA-Z0-9]+://(.*)\$#", $adminURL)) {
                 $adminURL = 'http://' . $adminURL;
             }
             $url .= eZSys::indexDir(false);
             $adminURL .= eZSys::indexDir(false);
         } else {
             if ($siteType['access_type'] == 'port') {
                 $url = eZHTTPTool::createRedirectURL($currentURL, array('override_port' => $siteType['access_type_value']));
                 $adminURL = eZHTTPTool::createRedirectURL($currentURL, array('override_port' => $siteType['admin_access_type_value']));
             }
         }
     }
     $siteaccessURL = array('url' => $url, 'admin_url' => $adminURL);
     return $siteaccessURL;
 }
开发者ID:netbliss,项目名称:ezpublish,代码行数:41,代码来源:ezstep_installer.php

示例15: match


//.........这里部分代码省略.........
                             case 'part':
                                 $hasHostMatch = strpos($host, $matchHost) !== false;
                                 break;
                             default:
                                 $hasHostMatch = false;
                                 eZDebug::writeError("Unknown host_uri host match: {$matchHostMethod}", "access");
                                 break;
                         }
                         if ($hasHostMatch) {
                             if ($matchURI !== '') {
                                 $matchURIFolders = explode('/', $matchURI);
                                 $uri->increase(count($matchURIFolders));
                                 $uri->dropBase();
                                 $access['uri_part'] = $matchURIFolders;
                             }
                             $access['name'] = $matchAccess;
                             $access['type'] = $type;
                             return $access;
                         }
                     }
                 }
                 break;
             case 'index':
                 $type = eZSiteAccess::TYPE_INDEX_FILE;
                 $match_type = $ini->variable('SiteAccessSettings', 'IndexMatchType');
                 $match_item = $file;
                 if ($match_type == 'element') {
                     $match_index = $ini->variable('SiteAccessSettings', 'IndexMatchElement');
                     $match_pos = strpos($match_item, '.php');
                     if ($match_pos !== false) {
                         $match_item = substr($match_item, 0, $match_pos);
                         $match_arr = explode('_', $match_item);
                         $name = $match_arr[$match_index];
                     }
                 } else {
                     if ($match_type == 'text') {
                         $matcher_pre = $ini->variable('SiteAccessSettings', 'IndexMatchSubtextPre');
                         $matcher_post = $ini->variable('SiteAccessSettings', 'IndexMatchSubtextPost');
                     } else {
                         if ($match_type == 'regexp') {
                             $matcher = $ini->variable('SiteAccessSettings', 'IndexMatchRegexp');
                             $match_num = $ini->variable('SiteAccessSettings', 'IndexMatchRegexpItem');
                         } else {
                             continue;
                         }
                     }
                 }
                 break;
             default:
                 eZDebug::writeError("Unknown access match: {$matchprobe}", "access");
                 break;
         }
         if ($match_type == 'regexp') {
             $name = self::matchRegexp($match_item, $matcher, $match_num);
         } else {
             if ($match_type == 'text') {
                 $name = self::matchText($match_item, $matcher_pre, $matcher_post);
             }
         }
         if (isset($name) && $name != '') {
             $nameClean = self::washName($name);
             if (in_array($nameClean, $siteAccessList)) {
                 if ($nameClean !== $name) {
                     if (!$ini->hasVariable('SiteAccessSettings', 'NormalizeSANames') || $ini->variable('SiteAccessSettings', 'NormalizeSANames') == 'enabled') {
                         $name = $nameClean;
                         if ($ini->hasVariable('SiteAccessSettings', 'RedirectOnNormalize') && $ini->variable('SiteAccessSettings', 'RedirectOnNormalize') == 'enabled') {
                             header($_SERVER['SERVER_PROTOCOL'] . " 301 Moved Permanently");
                             header("Status: 301 Moved Permanently");
                             $uriSlice = $uri->URIArray;
                             array_shift($uriSlice);
                             $newUri = $name . '/' . implode('/', $uriSlice);
                             $location = eZSys::indexDir() . "/" . eZURI::encodeIRI($newUri);
                             header("Location: " . $location);
                             eZExecution::cleanExit();
                         }
                     }
                 }
                 if ($type == eZSiteAccess::TYPE_URI) {
                     if ($match_type == 'element') {
                         $uri->increase($match_index);
                         $uri->dropBase();
                     } else {
                         if ($match_type == 'regexp') {
                             $uri->setURIString($match_item);
                         } else {
                             if ($match_type == 'text') {
                                 $uri->setURIString($match_item);
                             }
                         }
                     }
                 }
                 $access['type'] = $type;
                 $access['name'] = $name;
                 $access['uri_part'] = $uri_part;
                 return $access;
             }
         }
     }
     return $access;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:101,代码来源:ezsiteaccess.php


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