commit | author | age
|
b5a2f8
|
1 |
<?php
|
T |
2 |
/*
|
|
3 |
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
|
|
4 |
All rights reserved.
|
|
5 |
|
|
6 |
Redistribution and use in source and binary forms, with or without modification,
|
|
7 |
are permitted provided that the following conditions are met:
|
|
8 |
|
|
9 |
* Redistributions of source code must retain the above copyright notice,
|
|
10 |
this list of conditions and the following disclaimer.
|
|
11 |
* Redistributions in binary form must reproduce the above copyright notice,
|
|
12 |
this list of conditions and the following disclaimer in the documentation
|
|
13 |
and/or other materials provided with the distribution.
|
|
14 |
* Neither the name of ISPConfig nor the names of its contributors
|
|
15 |
may be used to endorse or promote products derived from this software without
|
|
16 |
specific prior written permission.
|
|
17 |
|
|
18 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
19 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
20 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
21 |
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
22 |
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
23 |
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
24 |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
25 |
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
26 |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
27 |
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28 |
*/
|
|
29 |
|
|
30 |
ob_start("ob_gzhandler");
|
|
31 |
|
|
32 |
class app {
|
|
33 |
|
|
34 |
var $_language_inc = 0;
|
|
35 |
var $_wb;
|
|
36 |
|
|
37 |
function app() {
|
|
38 |
|
|
39 |
global $conf;
|
|
40 |
|
|
41 |
if($conf["start_db"] == true) {
|
|
42 |
$this->load('db_'.$conf["db_type"]);
|
|
43 |
$this->db = new db;
|
|
44 |
}
|
|
45 |
|
|
46 |
if($conf["start_session"] == true) {
|
|
47 |
session_start();
|
|
48 |
$_SESSION["s"]['id'] = session_id();
|
|
49 |
if($_SESSION["s"]["theme"] == '') $_SESSION["s"]['theme'] = $conf['theme'];
|
|
50 |
if($_SESSION["s"]["language"] == '') $_SESSION["s"]['language'] = $conf['language'];
|
|
51 |
}
|
|
52 |
|
|
53 |
}
|
|
54 |
|
|
55 |
function uses($classes) {
|
|
56 |
global $conf;
|
|
57 |
|
|
58 |
$cl = explode(',',$classes);
|
|
59 |
if(is_array($cl)) {
|
|
60 |
foreach($cl as $classname) {
|
|
61 |
if(!is_object($this->$classname)) {
|
|
62 |
include_once($conf['classpath'] . "/".$classname.".inc.php");
|
|
63 |
$this->$classname = new $classname;
|
|
64 |
}
|
|
65 |
}
|
|
66 |
}
|
|
67 |
|
|
68 |
}
|
|
69 |
|
|
70 |
function load($files) {
|
|
71 |
|
|
72 |
global $conf;
|
|
73 |
$fl = explode(',',$files);
|
|
74 |
if(is_array($fl)) {
|
|
75 |
foreach($fl as $file) {
|
|
76 |
include_once($conf['classpath'] . "/".$file.".inc.php");
|
|
77 |
}
|
|
78 |
}
|
|
79 |
|
|
80 |
}
|
|
81 |
|
|
82 |
/*
|
|
83 |
0 = DEBUG
|
|
84 |
1 = WARNING
|
|
85 |
2 = ERROR
|
|
86 |
*/
|
|
87 |
|
|
88 |
function log($msg, $priority = 0) {
|
|
89 |
|
|
90 |
if($priority >= $conf["log_priority"]) {
|
|
91 |
if (is_writable($conf["log_file"])) {
|
|
92 |
|
|
93 |
if (!$fp = fopen ($conf["log_file"], "a")) {
|
|
94 |
$this->error("Logfile konnte nicht geöffnet werden.");
|
|
95 |
}
|
|
96 |
if (!fwrite($fp, date("d.m.Y-H:i")." - ". $msg."\r\n")) {
|
|
97 |
$this->error("Schreiben in Logfile nicht möglich.");
|
|
98 |
}
|
|
99 |
fclose($fp);
|
|
100 |
|
|
101 |
} else {
|
|
102 |
$this->error("Logfile ist nicht beschreibbar.");
|
|
103 |
}
|
|
104 |
} // if
|
|
105 |
} // func
|
|
106 |
|
|
107 |
/*
|
|
108 |
0 = DEBUG
|
|
109 |
1 = WARNING
|
|
110 |
2 = ERROR
|
|
111 |
*/
|
|
112 |
|
|
113 |
function error($msg, $priority = 2) {
|
|
114 |
//$this->uses("error");
|
|
115 |
//$this->error->message($msg, $priority);
|
|
116 |
echo $msg;
|
|
117 |
if($priority == 2) exit;
|
|
118 |
}
|
|
119 |
|
|
120 |
function lng($text)
|
|
121 |
{
|
|
122 |
global $conf;
|
|
123 |
if($this->_language_inc != 1) {
|
|
124 |
// loading global and module Wordbook
|
|
125 |
@include_once($conf["rootpath"]."/lib/lang/".$_SESSION["s"]["language"].".lng");
|
|
126 |
@include_once($conf["rootpath"]."/web/".$_SESSION["s"]["module"]["name"]."/lib/lang/".$_SESSION["s"]["language"].".lng");
|
|
127 |
$this->_wb = $wb;
|
|
128 |
$this->_language_inc = 1;
|
|
129 |
}
|
|
130 |
|
|
131 |
if(!empty($this->_wb[$text])) {
|
|
132 |
$text = $this->_wb[$text];
|
|
133 |
}
|
|
134 |
|
|
135 |
return $text;
|
|
136 |
}
|
|
137 |
|
|
138 |
function tpl_defaults() {
|
336a57
|
139 |
global $conf;
|
b5a2f8
|
140 |
|
T |
141 |
$this->tpl->setVar('theme',$_SESSION["s"]["theme"]);
|
|
142 |
$this->tpl->setVar('phpsessid',session_id());
|
336a57
|
143 |
$this->tpl->setVar('html_content_encoding',$conf["html_content_encoding"]);
|
b5a2f8
|
144 |
|
T |
145 |
}
|
|
146 |
|
|
147 |
}
|
|
148 |
|
|
149 |
/*
|
|
150 |
Initialize application (app) object
|
|
151 |
*/
|
|
152 |
|
|
153 |
$app = new app;
|
|
154 |
|
|
155 |
?> |