public function direct($ssl) { $toScheme = $ssl ? 'https' : 'http'; $scheme = Zmz_Host::getScheme(); if ($scheme != $toScheme) { $request = $this->getRequest(); $url = Zmz_Host::buildUrl(Zmz_Host::getHostname(), $toScheme, Zmz_Host::getPort()); $url .= $request->getRequestUri(); $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $redirector->gotoUrl($url); } }
/** * * @return string $timezone */ public static function findTimezone() { $locale = self::getLocale(); if (!$locale->getRegion()) { try { $locale = new Zend_Locale($locale . '_' . strtoupper($locale)); } catch (Exception $e) { } } $region = $locale->getRegion(); if ($region) { $timezoneList = Zend_Locale::getTranslationList('TimezoneToTerritory'); if (isset($timezoneList[$region])) { $timezone = $timezoneList[$region]; return $timezone; } } $httpCookieObject = new Zend_Http_Cookie('timezone', null, Zmz_Host::getHostname()); $cookie = new Zmz_Cookie($httpCookieObject); $timezoneCookieValue = $cookie->getValue(); $timezoneArray = @explode('/', $timezoneCookieValue); // check valid cookie if (isset($timezoneArray[0]) && isset($timezoneArray[1])) { $offset = intval($timezoneArray[0]); $dts = intval($timezoneArray[1]); $guessedTimezone = timezone_name_from_abbr('', $offset, $dts); try { $tz = new DateTimeZone($guessedTimezone); $guessedLocation = $tz->getLocation(); // $guessedLocationCode = $guessedLocation['country_code']; $timezone = $guessedTimezone; } catch (Exception $e) { $timezone = self::$defaultTimezone; } } else { $timezone = self::$defaultTimezone; } return $timezone; }
public static function getHostname() { $hostname = Zmz_Host::getHostname(); return $hostname; }