blob: c8955b8662b11dd64721226be764bf35db4de159 (
plain)
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
70
71
|
<?php
$modules = array();
function loadModule($modulename)
{
global $MODULES_DIR;
global $modules;
$modulefile = $MODULES_DIR . "/" . $modulename . ".php";
if(!$modules[$modulename]) {
if(file_exists($modulefile)) {
include_once($modulefile);
$module = call_user_func($modulename . "_init");
$modules[$modulename] = $module;
} else {
// Module does not exist.
}
}
}
function loadAllModules()
{
loadModule("config");
loadModule("discography");
loadModule("events");
loadModule("gallery");
loadModule("guestbook");
loadModule("icons");
loadModule("links");
loadModule("members");
loadModule("news");
loadModule("pages");
loadModule("downloads");
loadModule("newsletter");
}
function getModuleParams($code)
{
$params = array();
$ps = explode(",", $code);
foreach($ps as $p) {
$v = explode("=", $p);
$params[$v[0]] = $v[1];
}
return $params;
}
function runModule($code)
{
global $modules;
$str = "";
$m = explode("?", $code);
$module = $m[0];
$params = getModuleParams($m[1]);
loadModule($module);
if($modules[$module]) {
$str .= $modules[$module]->run($params);
} else {
$str .= "<p><strong>CMS ERROR: Could not find module:";
$str .= " [[" . $modulecode . "]]</strong></p>\n";
}
return $str;
}
?>
|