/** * begin() checks for security (authentication) using AirUser library. * * @method begin() */ public function begin() { parent::begin(); $this->load->library('AirUser'); $this->load->library('AirHtml'); // load recent view lib $u = $this->airuser->get_user(); if ($u) { $this->load->library('AirRecent', array('user' => $u)); } // Keep current user for later. $this->user = $u; // load API $u = $this->airuser->get_user(); if ($u) { $this->api = new AIRAPI($u); } $this->_init_security(); // supported browsers if ($this->view == 'html') { $supported = false; $this->load->library('user_agent'); $bro = $this->agent->browser(); $ver = $this->agent->version(); // compare the leading version number try { $leading = intval(array_shift(explode('.', $ver))); foreach ($this->browsers as $regex => $num) { if (preg_match($regex, $bro)) { if (is_null($num) || $leading >= $num) { $supported = true; } break; } } } catch (Exception $e) { $supported = true; //Just let them through } // die now if unsupported if (!$supported) { $this->airoutput->view = 'unsupported'; $this->airoutput->write(); exit; } } }