public function __construct($file) { global $admin_required; $this->file = $file; $this->show_menu = true; $this->variables = array(); $this->admin = isset($admin_required); try { $db = new Database(); $result = $db->get_pdo()->query('select count(*) from banners'); if ($result) { $result = $result->fetch(); $this->offer_banners = $result[0] > 0; } else { $this->set('reason', 'This may be because the table definitions have not been ' . 'loaded into the database.'); $this->fatal('Unable to read the banners table.'); } } catch (PDOException $ex) { $this->set('reason', 'This probably means that the database details in ' . 'config.inc are incorrect.'); $this->fatal($ex->getMessage()); } $this->set('key', Template::get_ajax_key()); }