*   Lynxpress is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with Lynxpress.  If not, see http://www.gnu.org/licenses/.
 */
namespace Site;

use Library\Variable\Server as VServer;
use Library\Mail\Mail;
use Exception;
try {
    define('PATH', '');
    define('INC', 'includes/');
    define('ADMIN', 'admin/');
    require_once 'config.php';
    require_once INC . 'class.loader.inc.php';
    Loader::load();
    new Session();
    $title = '404 Page Not Found';
    $menu = array('Sorry but the Lynx didn\'t show up');
    require_once Html::header();
    Html::_404();
    require_once Html::footer();
    $mail = new Mail(WS_EMAIL, '"404 not found reached', str_replace('",', "\",\n", json_encode(VServer::all())));
    $mail->send();
} catch (Exception $e) {
    die('<h1>' . $e->getMessage() . '</h1>');
}
 /**
  * Method to get informations about the browser and stock them into attributes
  *
  * @access private
  */
 private function get_browser()
 {
     $iphone = strpos(VServer::HTTP_USER_AGENT(), 'iPhone;');
     $android = strpos(VServer::HTTP_USER_AGENT(), 'Android');
     $ipad = strpos(VServer::HTTP_USER_AGENT(), 'iPad');
     $webkit = strpos(VServer::HTTP_USER_AGENT(), 'AppleWebKit/');
     $gecko = strpos(VServer::HTTP_USER_AGENT(), 'Firefox/');
     $presto = strpos(VServer::HTTP_USER_AGENT(), 'Presto/');
     $trident = strpos(VServer::HTTP_USER_AGENT(), 'Trident/');
     if ($iphone !== false || $android !== false || $ipad !== false) {
         $this->_renderer = 'mobile';
         $this->_html5 = false;
     } else {
         if ($webkit !== false) {
             $webkit_version = substr(VServer::HTTP_USER_AGENT(), $webkit, 20);
             if ($webkit_version >= 'AppleWebKit/533.18.1') {
                 $this->_html5 = true;
             } else {
                 $this->_html5 = false;
             }
             $this->_renderer = 'webkit';
         } elseif ($gecko !== false) {
             $gecko_version = substr(VServer::HTTP_USER_AGENT(), $gecko, 9);
             $ff10up = substr(VServer::HTTP_USER_AGENT(), $gecko, 10);
             if ($gecko_version >= 'Firefox/4') {
                 $this->_html5 = true;
             } elseif ($ff10up >= 'Firefox/10') {
                 $this->_html5 = true;
             } else {
                 $this->_html5 = false;
             }
             $this->_renderer = 'gecko';
         } elseif ($presto !== false) {
             $this->_html5 = false;
             $this->_renderer = 'presto';
         } elseif ($trident !== false) {
             $this->_html5 = false;
             $this->_renderer = 'trident';
         } elseif (in_array(VServer::HTTP_USER_AGENT(), $this->_bots)) {
             $this->_html5 = true;
             $this->_renderer = 'bot';
         } else {
             $this->_html5 = false;
             $this->_renderer = 'unknown';
         }
     }
 }