forgot to add includes/MySmarty.class.php :(

moved a couple of things into an override of Smarty::display()
This commit is contained in:
Ryan Walberg 2012-11-26 02:30:26 +00:00
parent 137d715568
commit db7808688f
17 changed files with 61 additions and 53 deletions

View file

@ -0,0 +1,34 @@
<?php
define('SMARTY_DIR', dirname(__FILE__) . "/Smarty-3.1.12/libs/");
require_once(SMARTY_DIR . "Smarty.class.php");
require_once(dirname(__FILE__) . "/config.php");
class MySmarty extends Smarty {
public function __construct() {
parent::__construct();
}
public function dbh() {
$opt = $this->opt();
return new PDO(
$opt["pdo_connection_string"],
$opt["pdo_username"],
$opt["pdo_password"]);
}
public function opt() {
static $opt;
if (!isset($opt)) {
$opt = getGlobalOptions();
}
return $opt;
}
public function display($t) {
parent::assign('isadmin', $_SESSION['admin']);
parent::assign('opt', $this->opt());
parent::display($t);
}
}
?>