summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
Diffstat (limited to 'src/views')
-rw-r--r--src/views/Template.class.php27
-rw-r--r--src/views/pages/no-conf.html.php8
-rw-r--r--src/views/pages/plugins/index.html.php5
-rw-r--r--src/views/pages/users/500.html.php5
4 files changed, 23 insertions, 22 deletions
diff --git a/src/views/Template.class.php b/src/views/Template.class.php
index bf57e93..9d55b75 100644
--- a/src/views/Template.class.php
+++ b/src/views/Template.class.php
@@ -1,24 +1,19 @@
<?php
+require_once('Singleton.class.php');
+require_once('Site.class.php');
-require_once('Login.class.php');
+require_once('Login.class.php');// used to see if logged in
+require_once('Auth.class.php');// used to get username if we are
-class Template {
+class Template extends Singleton {
private $indent = 0;
private $ret = false;
- private $base = '/';
- private $db = null;
-
+
public function status($status) {
header($_SERVER["SERVER_PROTOCOL"]." $status");
header("Status: $status");
}
- public function __construct($base_url, $mm=null) {
- $this->base = $base_url;
- if ($mm!==null)
- $this->db = $mm->database();
- }
-
public function setRet($ret) {
$this->ret = $ret;
}
@@ -92,7 +87,7 @@ class Template {
echo $str;
}
public function url($page) {
- return $this->base.$page;
+ return Site::getInstance()->baseUrl().$page;
}
public function row($cells) {
@@ -112,12 +107,8 @@ class Template {
echo $str;
}
public function header($title) {
- $db = $this->db;
- if ($db==null) {
- $username = false;
- } else {
- $username = $db->getUsername(Login::isLoggedIn());
- }
+ // username=false if not logged in or not connected to DB
+ $username = Auth::getInstance(Login::isLoggedIn())->getName();
$ret = $this->ret;
$this->ret = true;
diff --git a/src/views/pages/no-conf.html.php b/src/views/pages/no-conf.html.php
new file mode 100644
index 0000000..1f4e3d3
--- /dev/null
+++ b/src/views/pages/no-conf.html.php
@@ -0,0 +1,8 @@
+<?php global $VARS;
+$t = $VARS['template'];
+
+$t->header('Message Manager');
+$t->paragraph('Awe shiz, dude, conf.php doesn\'t exist, you '.
+ 'need to go through the '.
+ '<a href="installer">installer</a>.');
+$t->footer();
diff --git a/src/views/pages/plugins/index.html.php b/src/views/pages/plugins/index.html.php
index 1f89344..b182288 100644
--- a/src/views/pages/plugins/index.html.php
+++ b/src/views/pages/plugins/index.html.php
@@ -1,7 +1,8 @@
-<?php global $VARS, $mm;
+<?php global $VARS;
+require_once('Database.class.php');
$t = $VARS['template'];
$plugins = $VARS['plugins'];
-$db = $mm->database();
+$db = Database::getInstance();
$t->header('Administrator Plugin Management');
$t->openTag('form',array('method'=>'post','action'=>$t->url('plugins')));
diff --git a/src/views/pages/users/500.html.php b/src/views/pages/users/500.html.php
index f4f1c42..339fe63 100644
--- a/src/views/pages/users/500.html.php
+++ b/src/views/pages/users/500.html.php
@@ -1,6 +1,7 @@
-<?php global $VARS, $mm;
+<?php global $VARS;
+require_once('Database.class.php');
$t = $VARS['template'];
-$db = $mm->database();
+$db = Database::getInstance();
$t->status('500 Internal Server Error');
$t->header('Unknown error');