-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller.php
58 lines (54 loc) · 1.36 KB
/
controller.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
<?php
/*
* Initialising Database connection in a class.
* Every module can use this instance to perform database operations.
*
*/
/*
* Including functions files. You can add your filename.php file to
* load all the functions in that file.
*/
$exclude = array('.','..');
$classes=opendir('classes');
while($Class = readdir($classes)){
if(!in_array(strtolower($Class), $exclude)) {
//This statement removes '.' and '..' from the directory list.
include('classes/'.$Class);
}
}
if(isset($_GET['u'])&&$_GET['u']=="admin"){
//authenticate
require('auth.php');
$user='admin_';
}
else{
$user='';
}
$hooks=$db->getTableasArray("SELECT hook FROM hooks ORDER BY `order` asc");
$modules=$db->getTableasArray("SELECT hook, module FROM ".$user."pages WHERE PAGE = '".$db->__($view)."' ORDER BY `order` asc");
/*
* Pushing all modules to be loaded for a hook into an array
* with its hook name as variable name.
* Example: header is a hook, so $header is an array of all the module
* names to be loaded
*
*/
foreach($modules as $module){
if(!isset($$module['hook'])){
$$module['hook']= array();
array_push($$module['hook'],$module['module']);
}
else{
array_push($$module['hook'],$module['module']);
}
}
/*
* Loading all the hooks available in the hooks directory.
*
*/
foreach($hooks as $hook){
if($hook){
include('hooks/'.$hook['hook'].'.php');
}
}
?>