Beispiel #1
0
 public static function initController()
 {
     $id = Request::get('Currency', null, 'COOKIE');
     $Current = new Currency();
     $Default = Currency::findDefault();
     $code = null;
     if (function_exists('geoip_record_by_name')) {
         $arr = @geoip_record_by_name(Request::get('REMOTE_ADDR', '', 'SERVER'));
         $code = isset($arr['country_code']) ? $arr['country_code'] : null;
     }
     $arr = Currency::findCurrencies(true);
     foreach ($arr as $i => $Currency) {
         if ($Currency->Id == $id) {
             $Current = $Currency;
             break;
         }
     }
     if (!$Current->Id && $code) {
         foreach ($arr as $Currency) {
             if ($Currency->hasCountry($code)) {
                 $Current = $Currency;
                 break;
             }
         }
     }
     if (!$Current->Id) {
         foreach ($arr as $Currency) {
             $Current = $Currency;
             break;
         }
     }
     Runtime::set('CURRENCY_DEFAULT', $Default);
     Runtime::set('CURRENCY_CURRENT', $Current);
     return false;
 }
Beispiel #2
0
 /**
  * The function initializes and authorizes system users, such as 
  * admins and customers.
  * 
  * @static
  * @access private
  */
 private static function initSecurity()
 {
     $Admin = new Admin();
     $Admin = $Admin->auth();
     if ($Admin === false) {
         $Admin = new Admin();
     }
     Runtime::set('SECURITY_USER', $Admin);
 }
Beispiel #3
0
 /**
  * The error document page handler.
  * 
  * @access protected
  * @return string The HTML code.
  */
 protected function notFound()
 {
     header("HTTP/1.0 404 Not Found");
     $Page = new Content_Page();
     $Page = $Page->findItem(array('module = Controller_Frontend_404'));
     Runtime::set('ROUTING_PAGE', $Page);
     $this->getView()->setMethod('notFound');
     return $this->getView()->render();
 }