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


PHP eZSys::serverVariable方法代码示例

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


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

示例1: writeAudit

    /**
     * Writes $auditName with $auditAttributes as content
     * to file name that will be fetched from ini settings by auditNameSettings() for logging.
     *
     * @param string $auditName
     * @param array $auditAttributes
     * @return bool
     */
    static function writeAudit( $auditName, $auditAttributes = array() )
    {
        $enabled = eZAudit::isAuditEnabled();
        if ( !$enabled )
            return false;

        $auditNameSettings = eZAudit::auditNameSettings();

        if ( !isset( $auditNameSettings[$auditName] ) )
            return false;

        $ip = eZSys::clientIP();
        if ( !$ip )
            $ip = eZSys::serverVariable( 'HOSTNAME', true );

        $user = eZUser::currentUser();
        $userID = $user->attribute( 'contentobject_id' );
        $userLogin = $user->attribute( 'login' );

        $message = "[$ip] [$userLogin:$userID]\n";

        foreach ( array_keys( $auditAttributes ) as $attributeKey )
        {
            $attributeValue = $auditAttributes[$attributeKey];
            $message .= "$attributeKey: $attributeValue\n";
        }

        $logName = $auditNameSettings[$auditName]['file_name'];
        $dir = $auditNameSettings[$auditName]['dir'];
        eZLog::write( $message, $logName, $dir );

        return true;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:41,代码来源:ezaudit.php

示例2: __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

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

 function createDataFromGET()
 {
     $this->logger->writeTimedString('createDataFromGET');
     $this->callbackData = array();
     $query_string = eZSys::serverVariable('QUERY_STRING');
     if ($query_string) {
         $key_value_pairs = explode('&', $query_string);
         foreach ($key_value_pairs as $key_value) {
             $data = explode('=', $key_value);
             $this->callbackData[$data[0]] = $data[1];
             $this->logger->writeTimedString("{$data['0']} = {$data['1']}");
         }
     }
     return count($this->callbackData) > 0;
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:15,代码来源:ezpaymentcallbackchecker.php

示例5: browserSupportsDHTMLType

 /**
  * browserSupportsDHTMLType
  * Identify supported browser by layout engine using user agent string.
  *
  * @static
  * @return string|false Name of supported layout engine or false
  */
 public static function browserSupportsDHTMLType()
 {
     if (self::$browserType === null) {
         self::$browserType = false;
         $userAgent = eZSys::serverVariable('HTTP_USER_AGENT');
         // Opera 9.6+
         if (strpos($userAgent, 'Presto') !== false && preg_match('/Presto\\/([0-9\\.]+)/i', $userAgent, $browserInfo)) {
             if ($browserInfo[1] >= 2.1) {
                 self::$browserType = 'Presto';
             }
         } else {
             if (strpos($userAgent, 'Trident') !== false && preg_match('/Trident\\/([0-9\\.]+)/i', $userAgent, $browserInfo)) {
                 if ($browserInfo[1] >= 4.0) {
                     self::$browserType = 'Trident';
                 }
             } else {
                 if (strpos($userAgent, 'MSIE') !== false && preg_match('/MSIE[ \\/]([0-9\\.]+)/i', $userAgent, $browserInfo)) {
                     if ($browserInfo[1] >= 6.0) {
                         self::$browserType = 'Trident';
                     }
                 } else {
                     if (strpos($userAgent, 'Gecko') !== false && preg_match('/rv:([0-9\\.]+)/i', $userAgent, $browserInfo)) {
                         if ($browserInfo[1] >= 1.9) {
                             self::$browserType = 'Gecko';
                         }
                     } else {
                         if (strpos($userAgent, 'WebKit') !== false && strpos($userAgent, 'Mobile') === false && strpos($userAgent, 'Android') === false && strpos($userAgent, 'iPad') === false && strpos($userAgent, 'iPhone') === false && strpos($userAgent, 'iPod') === false && preg_match('/WebKit\\/([0-9\\.]+)/i', $userAgent, $browserInfo)) {
                             if ($browserInfo[1] >= 528.16) {
                                 self::$browserType = 'WebKit';
                             }
                         } else {
                             if (strpos($userAgent, 'AppleWebKit') !== false && strpos($userAgent, 'Mobile') !== false && strpos($userAgent, 'Android') === false && preg_match('/AppleWebKit\\/([0-9\\.]+)/i', $userAgent, $browserInfo)) {
                                 if ($browserInfo[1] >= 534.46) {
                                     self::$browserType = 'MobileWebKit';
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (self::$browserType === false) {
             eZDebug::writeNotice('Browser not supported: ' . $userAgent, __METHOD__);
         }
     }
     return self::$browserType;
 }
开发者ID:heliopsis,项目名称:ezoe,代码行数:54,代码来源:ezoexmlinput.php

示例6: while

                    } else {
                        $step = $stepData->nextStep($currentStep);
                    }
                }
            }
        } else {
            $step = $stepData->step(0);
            //step contains file and class
        }
    }
}
$done = false;
$result = null;
while (!$done && $step != null) {
    // Some common variables for all steps
    $tpl->setVariable("script", eZSys::serverVariable('PHP_SELF'));
    $siteBasics = $GLOBALS['eZSiteBasics'];
    $useIndex = $siteBasics['validity-check-required'];
    if ($useIndex) {
        $script = eZSys::wwwDir() . eZSys::indexFileName();
    } else {
        $script = eZSys::indexFile() . "/setup/{$partName}";
    }
    $tpl->setVariable('script', $script);
    $tpl->setVariable("version", array("text" => eZPublishSDK::version(), "major" => eZPublishSDK::majorVersion(), "minor" => eZPublishSDK::minorVersion(), "release" => eZPublishSDK::release(), "alias" => eZPublishSDK::alias()));
    if ($persistenceList === null) {
        $persistenceList = eZSetupFetchPersistenceList();
    }
    $tpl->setVariable('persistence_list', $persistenceList);
    // Try to include the relevant file
    $includeFile = $baseDir . 'steps/ezstep_' . $step['file'] . '.php';
开发者ID:legende91,项目名称:ez,代码行数:31,代码来源:ezsetup.php

示例7: writeFile

 function writeFile(&$logFileData, &$string, $verbosityLevel, $alwaysLog = false)
 {
     $enabled = eZDebug::isDebugEnabled();
     if (!$alwaysLog and !$enabled) {
         return;
     }
     if (!$alwaysLog and !$this->isLogFileEnabled($verbosityLevel)) {
         return;
     }
     $oldHandleType = eZDebug::setHandleType(self::HANDLE_TO_PHP);
     $logDir = $logFileData[0];
     $logName = $logFileData[1];
     $fileName = $logDir . $logName;
     if (!file_exists($logDir)) {
         eZDir::mkdir($logDir, false, true);
     }
     $oldumask = @umask(0);
     clearstatcache(true, $fileName);
     $fileExisted = file_exists($fileName);
     if ($fileExisted and filesize($fileName) > eZDebug::maxLogSize()) {
         if (eZDebug::rotateLog($fileName)) {
             $fileExisted = false;
         }
     }
     $logFile = @fopen($fileName, "a");
     if ($logFile) {
         $time = strftime("%b %d %Y %H:%M:%S", strtotime("now"));
         $ip = eZSys::clientIP();
         if (!$ip) {
             $ip = eZSys::serverVariable('HOSTNAME', true);
         }
         $notice = "[ " . $time . " ] [" . $ip . "] " . $string . "\n";
         @fwrite($logFile, $notice);
         @fclose($logFile);
         if (!$fileExisted) {
             $ini = eZINI::instance();
             $permissions = octdec($ini->variable('FileSettings', 'LogFilePermissions'));
             @chmod($fileName, $permissions);
         }
         @umask($oldumask);
     } else {
         @umask($oldumask);
         $logEnabled = $this->isLogFileEnabled($verbosityLevel);
         $this->setLogFileEnabled(false, $verbosityLevel);
         if ($verbosityLevel != self::LEVEL_ERROR or $logEnabled) {
             eZDebug::setHandleType($oldHandleType);
             $this->writeError("Cannot open log file '{$fileName}' for writing\n" . "The web server must be allowed to modify the file.\n" . "File logging for '{$fileName}' is disabled.", 'eZDebug::writeFile');
         }
     }
     eZDebug::setHandleType($oldHandleType);
 }
开发者ID:schwabokaner,项目名称:ezpublish-legacy,代码行数:51,代码来源:ezdebug.php

示例8: count

}
$callFnListCount = count($callFnList) - 1;
// do calls
if ($callType === 'stream') {
    if (isset($Params['interval']) && is_numeric($Params['interval']) && $Params['interval'] > 49) {
        // intervall in milliseconds, minimum is 0.05 seconds
        $callInterval = $Params['interval'] * 1000;
    } else {
        // default interval is every 0.5 seconds
        $callInterval = 500 * 1000;
    }
    $endTime = time() + 29;
    while (@ob_end_clean()) {
    }
    // flush 256 bytes first to force IE to not buffer the stream
    if (strpos(eZSys::serverVariable('HTTP_USER_AGENT'), 'MSIE') !== false) {
        echo '                                                  ';
        echo '                                                  ';
        echo '                                                  ';
        echo '                                                  ';
        echo "                                                  \n";
    }
    // set_time_limit(65);
    while (time() < $endTime) {
        echo $streamSeperator . implode($callSeperator, multipleezjscServerCalls($callFnList, $contentType));
        flush();
        usleep($callInterval);
    }
} else {
    echo implode($callSeperator, multipleezjscServerCalls($callFnList, $contentType));
}
开发者ID:legende91,项目名称:ez,代码行数:31,代码来源:call.php

示例9: setUp

 /**
  * Test case setup
  * Prepare $_SERVER variable
  *
  */
 public function setUp()
 {
     parent::setUp();
     $this->httpHost = eZSys::serverVariable('HTTP_HOST');
     eZSys::setServerVariable('HTTP_HOST', 'localhost');
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:11,代码来源:ezsiteinstaller_test.php

示例10: doLog

 /**
  * This method gets called by self::filter()
  */
 public static function doLog($method, array $values, &$output)
 {
     switch ($method) {
         case 'apache':
             foreach ($values as $varName => $value) {
                 /// @todo should remove any " or space chars in the value for proper parsing by updateperfstats.php
                 apache_note($varName, $value);
             }
             break;
         case 'piwik':
             $text = '';
             foreach (eZPerfLoggerINI::variable('GeneralSettings', 'TrackVariables') as $i => $var) {
                 $text .= "\npiwikTracker.setCustomVariable( {$i}, \"{$var}\", \"{$values[$var]}\", \"page\" );";
             }
             $text .= "\npiwikTracker.trackPageView();";
             $output = preg_replace('/piwikTracker\\.trackPageView\\( *\\);?/', $text, $output);
             break;
         case 'googleanalytics':
             $text = '';
             foreach (eZPerfLoggerINI::variable('GeneralSettings', 'TrackVariables') as $i => $var) {
                 $text .= "\n_gaq.push([{$i}, '{$var}', '{$values[$var]}', 3]);";
             }
             $text .= "\n_gaq.push(['_trackPageview']);";
             $output = preg_replace("/_gaq.push\\( *[ *['\"]_trackPageview['\"] *] *\\);?/", $text, $output);
             break;
         case 'logfile':
         case 'syslog':
             /// same format as Apache "combined" by default
             $size = self::$outputSize;
             if ($size == 0) {
                 $size = '-';
             }
             $text = eZPerfLoggerApacheLogger::apacheLogLine('combined', $size, self::$returnCode) . ' ';
             foreach ($values as $value) {
                 // do same as apache does: replace nulls with "-"
                 if ((string) $value === '') {
                     $text .= "- ";
                 } else {
                     /// @todo should remove any " or space chars in the value for proper parsing by updateperfstats.php
                     $text .= $value . " ";
                 }
             }
             if ($method == 'logfile') {
                 $text .= "\n";
                 file_put_contents(eZPerfLoggerINI::variable('logfileSettings', 'FileName'), $text, FILE_APPEND);
             } else {
                 // syslog: we use apache log format for lack of a better idea...
                 openlog("eZPerfLog", LOG_PID, LOG_USER);
                 syslog(LOG_INFO, $text);
             }
             break;
         case 'headers':
             $prefix = eZPerfLoggerINI::variable('HeadersSettings', 'HeaderPrefix');
             foreach (eZPerfLoggerINI::variable('GeneralSettings', 'TrackVariables') as $i => $var) {
                 header($prefix . str_replace(array('(', ')', '<', '>', '@', ',', ';', ':', '\\', '"', '/', '[', ']', '?', '=', '{', '}', ' ', "\t"), '-', $var) . ': ' . $values[$var]);
             }
             break;
         case 'database':
         case 'csv':
         case 'storage':
             if ($method == 'csv') {
                 $storageClass = 'eZPerfLoggerCSVStorage';
             } else {
                 if ($method == 'database') {
                     $storageClass = 'eZPerfLoggerDBStorage';
                 } else {
                     $storageClass = eZPerfLoggerINI::variable('ParsingSettings', 'StorageClass');
                 }
             }
             /// @todo log error if storage class does not implement correct interface
             // when we deprecate php 5.2, we will be able to use $storageClass::insertStats...
             call_user_func(array($storageClass, 'insertStats'), array(array('url' => isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : $_SERVER["PHP_SELF"], 'ip' => is_callable('eZSys::clientIP') ? eZSys::clientIP() : eZSys::serverVariable('REMOTE_ADDR'), 'time' => time(), 'response_status' => self::$returnCode, 'response_size' => self::$outputSize, 'counters' => $values)));
             break;
             /// @todo !important log a warning for default case (unhandled log format)
     }
 }
开发者ID:gggeek,项目名称:ezperformancelogger,代码行数:79,代码来源:ezperflogger.php

示例11: updateSettings

 static function updateSettings($settings)
 {
     // Make sure errors are handled by PHP when we read, including our own debug output.
     $oldHandleType = eZDebug::setHandleType(self::HANDLE_TO_PHP);
     if (isset($settings['debug-log-files-enabled'])) {
         $GLOBALS['eZDebugLogFileEnabled'] = $settings['debug-log-files-enabled'];
         if (isset($GLOBALS["eZDebugGlobalInstance"])) {
             $GLOBALS["eZDebugGlobalInstance"]->GlobalLogFileEnabled = $settings['debug-log-files-enabled'];
         }
     }
     if (isset($settings['debug-styles'])) {
         $GLOBALS['eZDebugStyles'] = $settings['debug-styles'];
     }
     if (isset($settings['always-log']) and is_array($settings['always-log'])) {
         $GLOBALS['eZDebugAlwaysLog'] = $settings['always-log'];
     }
     if (isset($settings['log-only'])) {
         $GLOBALS['eZDebugLogOnly'] = $settings['log-only'] == 'enabled';
     }
     $notDebugByIP = true;
     $debugEnabled = $settings['debug-enabled'];
     if ($settings['debug-enabled'] and $settings['debug-by-ip']) {
         $ipAddress = eZSys::serverVariable('REMOTE_ADDR', true);
         if ($ipAddress) {
             $debugEnabled = false;
             foreach ($settings['debug-ip-list'] as $itemToMatch) {
                 if (preg_match("/^(([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+))(\\/([0-9]+)\$|\$)/", $itemToMatch, $matches)) {
                     if ($matches[6]) {
                         if (eZDebug::isIPInNet($ipAddress, $matches[1], $matches[7])) {
                             $debugEnabled = true;
                             $notDebugByIP = false;
                             break;
                         }
                     } else {
                         if ($matches[1] == $ipAddress) {
                             $debugEnabled = true;
                             $notDebugByIP = false;
                             break;
                         }
                     }
                 }
             }
         } else {
             $debugEnabled = in_array('commandline', $settings['debug-ip-list']) && php_sapi_name() == 'cli';
         }
     }
     if ($settings['debug-enabled'] and isset($settings['debug-by-user']) and $settings['debug-by-user'] and $notDebugByIP) {
         $debugUserIDList = $settings['debug-user-list'] ? $settings['debug-user-list'] : array();
         $GLOBALS['eZDebugUserIDList'] = $debugUserIDList;
         // We enable the debug temporarily.
         // In checkDebugByUser() will be last(final) check for debug by user id.
         $debugEnabled = true;
     }
     $GLOBALS['eZDebugEnabled'] = $debugEnabled;
     eZDebug::setHandleType($oldHandleType);
 }
开发者ID:BGCX067,项目名称:ezfire-svn-to-git,代码行数:56,代码来源:ezdebug.php

示例12: protocolSchema

 static function protocolSchema()
 {
     $schema = '';
     if (preg_match("#^([a-zA-Z]+)/.*\$#", eZSys::serverVariable('SERVER_PROTOCOL'), $schemaMatches)) {
         $schema = strtolower($schemaMatches[1]) . '://';
     }
     return $schema;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:8,代码来源:ezsys.php

示例13: 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') . eZSys::serverVariable('REQUEST_URI'));
         eZExecution::cleanExit();
     }
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:18,代码来源:ezpmobiledeviceregexpfilter.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);
     // 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

示例15: checkServerIP

 function checkServerIP()
 {
     $remoteHostIP = eZSys::serverVariable('REMOTE_ADDR');
     $serverIPList = $this->ini->variable('ServerSettings', 'ServerIP');
     if ($serverIPList === false) {
         $this->logger->writeTimedString("Skipped the IP check because ServerIP is not set in the settings. Remote host is: {$remoteHostIP}.", 'checkServerIP');
         return true;
     }
     if (is_array($serverIPList) && in_array($remoteHostIP, $serverIPList)) {
         return true;
     }
     $this->logger->writeTimedString("server with ip = {$remoteHostIP} does not exist.", 'checkServerIP failed');
     $this->logger->writeTimedString($serverIPList, 'serverIPList from ini file is');
     return false;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:15,代码来源:ezpaymentcallbackchecker.php


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