3030ob_start ("ob_gzhandler " );
3131
3232class 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 , $ next_link = '' , $ stop = true , $ priority = 1 ) {
114- //$this->uses("error");
115- //$this->error->message($msg, $priority);
116- echo $ msg ;
117- if ($ next_link != "" ) echo "<a href=' $ next_link'>Next</a> " ;
118- if ($ stop == true ) die ();
119- }
120-
121- function lng ($ text )
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 , $ next_link = '' , $ stop = true , $ priority = 1 ) {
114+ //$this->uses("error");
115+ //$this->error->message($msg, $priority);
116+ if ($ stop == true ){
117+ $ msg = '<html>
118+ <head>
119+ <title>Error</title>
120+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
121+ <link href="../themes/default/style.css" rel="stylesheet" type="text/css">
122+ </head>
123+ <body>
124+ <br><br><br>
125+ <table width="100%" border="0" cellspacing="0" cellpadding="2">
126+ <tr>
127+ <td class="error"><b>Error:</b><br> ' .$ msg ;
128+ if ($ next_link != "" ) $ msg .= '<a href=" ' .$ next_link .'">Next</a><br> ' ;
129+ $ msg .= '</td>
130+ </tr>
131+ </table>
132+ </body>
133+ </html> ' ;
134+ die ($ msg );
135+ } else {
136+ echo $ msg ;
137+ if ($ next_link != "" ) echo "<a href=' $ next_link'>Next</a> " ;
138+ }
139+ }
140+
141+ function lng ($ text )
122142 {
123143 global $ conf ;
124144 if ($ this ->_language_inc != 1 ) {
@@ -128,22 +148,22 @@ function lng($text)
128148 $ this ->_wb = $ wb ;
129149 $ this ->_language_inc = 1 ;
130150 }
131-
151+
132152 if (!empty ($ this ->_wb [$ text ])) {
133153 $ text = $ this ->_wb [$ text ];
134154 }
135-
155+
136156 return $ text ;
137157 }
138-
139- function tpl_defaults () {
140- global $ conf ;
141-
142- $ this ->tpl ->setVar ('theme ' ,$ _SESSION ["s " ]["theme " ]);
143- $ this ->tpl ->setVar ('phpsessid ' ,session_id ());
144- $ this ->tpl ->setVar ('html_content_encoding ' ,$ conf ["html_content_encoding " ]);
145-
146- }
158+
159+ function tpl_defaults () {
160+ global $ conf ;
161+
162+ $ this ->tpl ->setVar ('theme ' ,$ _SESSION ["s " ]["theme " ]);
163+ $ this ->tpl ->setVar ('phpsessid ' ,session_id ());
164+ $ this ->tpl ->setVar ('html_content_encoding ' ,$ conf ["html_content_encoding " ]);
165+
166+ }
147167
148168}
149169
0 commit comments