-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathheader.php
53 lines (50 loc) · 1.5 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
52
53
<?php
error_reporting( E_ALL );
session_start();
ob_start();
class NotAuthorized extends Exception {}
class InvalidInput 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 );
}
}
function redirect( $url = '' ) {
throw new RedirectException( $url );
}
function view( $path, $variables = array(), $initial = false ) {
extract( $variables );
if ( $initial ) {
include 'views/header.php';
}
include 'views/' . $path . '.php';
if ( $initial ) {
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';
?>