Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
 /**
  *
  * @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;
 }
Ejemplo n.º 3
0
 public static function getHostname()
 {
     $hostname = Zmz_Host::getHostname();
     return $hostname;
 }