[go: up one dir, main page]

Menu

[r5]: / trunk / core / core.class.php  Maximize  Restore  History

Download this file

91 lines (76 with data), 1.8 kB

 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
// +--------------------------------------------+
// | Twiggi web-based groupware. |
// | |
// | For copyright and license information |
// | please read the COPYRIGHT file. |
// +--------------------------------------------+
class core
{
static $instance = false;
private $major_version = 2;
private $minor_version = 0;
private $state_version = "ALPHA";
private $root = NULL;
private $slash = NULL;
private $config = array();
private $debug = true;
private function __construct()
{
$this->root = dirname("../");
$this->slash = DIRECTORY_SEPARATOR;
$this->load_config();
}
public function get_instance()
{
if (!core::$instance)
{
core::$instance = new core();
}
return core::$instance;
}
private function load_config()
{
$config_file = $this->root.$this->slash."config".$this->slash."config.inc.php";
if (!file_exists($config_file))
{
core_print(__FILE__,__LINE__,ERROR,$config_file." is missing");
return;
}
include_once($config_file);
$this->config = $cfg;
}
public function get_config_option($option)
{
if (array_key_exists($option,$this->config))
{
if (($this->config[$option] == NULL) && ($this->debug))
{
core_print(__FILE__,__LINE__,WARNING,$option." is NULL");
}
return $this->config[$option];
}
if ($this->debug)
{
core_print(__FILE__,__LINE__,WARNING,$option." is not a known configuration option");
}
return NULL;
}
public function get_root()
{
return $this->root;
}
public function get_slash()
{
return $this->slash;
}
public function get_version()
{
return $this->major_version.".".$this->minor_version." (".$this->state_version.")";
}
public function show_page()
{
print "Twiggi web-based groupware core module is up and running. Version ";
}
}
?>