-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.php
69 lines (51 loc) · 1.56 KB
/
init.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
// the initial file for whole app
include 'admin/connect.php';
if (isset($_SESSION['user'])) {
$session_user = $_SESSION['user'];
} else{
$session_user = '';
}
// define paths
$includes = 'includes/';
$functions = 'includes/functions/';
$templates = 'includes/templates/';
$components = 'includes/components/';
$css = 'layout/css/';
$js = 'layout/js/';
// include parts
include $functions . 'functions.php';
//include $templates . 'header.php';
$actual_link = "http://" .$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$getArr = explode('/', $actual_link);
$current_page = '';
if (isset($current_page)) {
$current_page = end($getArr);
}
$user_state = $con->prepare("SELECT * FROM users WHERE Username = ?");
$user_state->execute(array($session_user));
$user_info = $user_state->fetch();
/**
* class for holding headers and footers
*/
class hook {
public $components = 'includes/components/';
public function inc_header($part = Null, $dash = Null, $header = 'header'){
$temps = 'includes/templates/';
return $head = include $temps . $header. $dash . $part. '.php';
}
public function inc_footer($part = Null, $dash = Null,$footer = 'footer'){
$temps = 'includes/templates/';
return $foot = include $temps . $footer. $dash . $part. '.php';
}
public function component($name, $php = NULL) {
if ($php != NULL) {
$php = '.php';
}
$url = $this->components . $name . $php;
return $url;
}
}
$hook_up = new hook();