forked from dionyziz/ntua-db
-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.php
51 lines (48 loc) · 1.47 KB
/
header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
class NotAuthorized extends Exception {}
class InvalidInput extends Exception {}
class Duplicate extends Exception {}
class NotImplemented extends Exception {
private $functionName;
public function __construct( $function = '(unknown method)' ) {
$this->functionName = $function;
parent::__construct( 'Not implemented', 0, null );
}
public function getFunctionName() {
return $this->functionName;
}
}
class RedirectException extends Exception {
private $url;
public function getURL() {
return $this->url;
}
public function __construct( $url ) {
$this->url = $url;
parent::__construct( 'URL exception', 0, null );
}
}
session_start();
function Redirect( $url = '' ) {
throw new RedirectException( $url );
}
function view( $path, $variables = false) {
if ( $variables === false ) {
$variables = array();
}
extract( $variables );
include 'views/header.php';
include 'views/' . $path . '.php';
include 'views/footer.php';
}
global $settings;
$settings = include 'settings.php';
$models = opendir( 'models' );
while ( ( $file = readdir( $models ) ) !== false ) {
if ( substr( $file, 0, 1 ) == '.' ) {
continue;
}
include 'models/' . $file;
}
include 'controllers/base.php';
?>