2d13e1de11c39393e7e96d9bd6849cba27fc6645
bernd webinterface => /webinterface

bernd authored 17 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15) */
bernd webinterface => /webinterface

bernd authored 17 years ago

16) 
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

17) require_once('class/database.php');
bernd add a function to handle re...

bernd authored 14 years ago

18) require_once('inc/debug.php');
bernd sql-abfragen abstrahiert

bernd authored 16 years ago

19) 
schokokeks.org web services Ermögliche Socket-Angabe fü...

schokokeks.org web services authored 10 years ago

20) function config($key, $localonly = false)
bernd Mehr config-optionen und co...

bernd authored 14 years ago

21) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

22)     global $config;
23) 
24)     if ($key == "modules") {
25)         // Stelle sicher, dass das "index"-Modul immer aktiv ist!
26)         if (! in_array("index", $config['modules'])) {
27)             $config['modules'][] = "index";
28)         }
29)         // Stelle sicher, dass das "about"-Modul immer aktiv ist!
30)         if (! in_array("about", $config['modules'])) {
31)             $config['modules'][] = "about";
32)         }
Bernd Wurst Lizenzinfos in eigenes Modu...

Bernd Wurst authored 10 years ago

33)     }
34) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

35)     if ($key == 'modules' && isset($_SESSION['restrict_modules'])) {
36)         $modules = array();
37)         foreach ($config['modules'] as $mod) {
38)             if (in_array($mod, $_SESSION['restrict_modules'])) {
39)                 $modules[] = $mod;
40)             }
41)         }
42)         return $modules;
bernd Erlaube subusers, die nur Z...

bernd authored 13 years ago

43)     }
44) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

45)     if (array_key_exists($key, $config)) {
46)         return $config[$key];
47)     }
Hanno remove whitespace in empty...

Hanno authored 5 years ago

48) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

49)     if ($localonly) {
50)         return null;
51)     }
schokokeks.org web services Ermögliche Socket-Angabe fü...

schokokeks.org web services authored 10 years ago

52) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

53)     /* read configuration from database */
54)     $result = db_query("SELECT `key`, value FROM misc.config");
Hanno remove whitespace in empty...

Hanno authored 5 years ago

55) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

56)     while ($object = $result->fetch()) {
57)         if (!array_key_exists($object['key'], $config)) {
58)             $config[$object['key']]=$object['value'];
59)         }
60)     }
61)     // Sonst wird das Passwort des webadmin-Users mit ausgegeben
62)     $debug_config = $config;
63)     unset($debug_config['db_pass']);
64)     DEBUG($debug_config);
65)     if (array_key_exists($key, $config)) {
66)         return $config[$key];
67)     } else {
68)         logger(LOG_ERR, "inc/base", "config", "Request to read nonexistant config option »{$key}«.");
69)     }
70)     return null;
bernd Mehr config-optionen und co...

bernd authored 14 years ago

71) }
72) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

73) function have_role($role)
74) {
Bernd Wurst Blende Aktionen aus, wenn d...

Bernd Wurst authored 6 years ago

75)     $have = $_SESSION['role'] & $role;
76)     if ($have) {
77)         DEBUG("Current user has role ".$role);
78)     } else {
79)         DEBUG("Current user does not have role ".$role);
80)     }
81)     return $have;
82) }
83) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

84) function get_server_by_id($id)
85) {
86)     $id = (int) $id;
87)     $result = db_query("SELECT hostname FROM system.servers WHERE id=?", array($id));
88)     $ret = $result->fetch();
89)     return $ret['hostname'];
bernd Info-Seite über Mail-Login-...

bernd authored 13 years ago

90) }
91) 
bernd Mehr config-optionen und co...

bernd authored 14 years ago

92) 
bernd add a function to handle re...

bernd authored 14 years ago

93) function redirect($target)
94) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

95)     global $debugmode;
96)     if ($target == '') {
97)         $target = $_SERVER['REQUEST_URI'];
98)     }
99)     if (! $debugmode) {
100)         header("Location: {$target}");
101)     } else {
102)         if (strpos($target, '?') === false) {
103)             print 'REDIRECT: '.internal_link($target, $target);
104)         } else {
105)             list($file, $qs) = explode('?', $target, 2);
106)             print 'REDIRECT: '.internal_link($file, $target, $qs);
107)         }
108)     }
109)     die();
bernd add a function to handle re...

bernd authored 14 years ago

110) }
111) 
112) 
bernd Hilfsfunktionen bzgl. mehre...

bernd authored 14 years ago

113) function my_server_id()
114) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

115)     $uid = (int) $_SESSION['userinfo']['uid'];
116)     $result = db_query("SELECT server FROM system.useraccounts WHERE uid=?", array($uid));
117)     $r = $result->fetch();
118)     DEBUG($r);
119)     return $r['server'];
bernd Hilfsfunktionen bzgl. mehre...

bernd authored 14 years ago

120) }
121) 
122) 
123) function additional_servers()
124) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

125)     $uid = (int) $_SESSION['userinfo']['uid'];
126)     $result = db_query("SELECT server FROM system.user_server WHERE uid=?", array($uid));
127)     $servers = array();
128)     while ($s = $result->fetch()) {
129)         $servers[] = $s['server'];
130)     }
131)     DEBUG($servers);
132)     return $servers;
bernd Hilfsfunktionen bzgl. mehre...

bernd authored 14 years ago

133) }
134) 
135) 
136) function server_names()
137) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

138)     $result = db_query("SELECT id, hostname FROM system.servers");
139)     $servers = array();
140)     while ($s = $result->fetch()) {
141)         $servers[$s['id']] = $s['hostname'];
142)     }
143)     DEBUG($servers);
144)     return $servers;
bernd Hilfsfunktionen bzgl. mehre...

bernd authored 14 years ago

145) }
146) 
147) 
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

148) function maybe_null($value)
149) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

150)     if (! $value) {
151)         return null;
152)     }
bernd maybe_null behandelt jetzt...

bernd authored 14 years ago

153) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

154)     if (strlen((string) $value) > 0) {
155)         return (string) $value;
156)     } else {
157)         return null;
158)     }
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

159) }
160) 
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

161) 
bernd Logger mit Logleveln

bernd authored 14 years ago

162) #define('LOG_ERR', 3);
163) #define('LOG_WARNING', 4);
164) #define('LOG_INFO', 6);
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

165) 
bernd Logger mit Logleveln

bernd authored 14 years ago

166) function logger($severity, $scriptname, $scope, $message)
bernd Logging aktiviert

bernd authored 16 years ago

167) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

168)     if (config('logging') < $severity) {
169)         DEBUG("NOT LOGGING $scriptname:$scope:$message");
170)         return;
171)     }
172) 
173)     DEBUG("LOGGING $scriptname:$scope:$message");
174)     $user = null;
175)     if (array_key_exists("role", $_SESSION)) {
176)         if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
177)             $user = $_SESSION['userinfo']['username'];
178)         } elseif ($_SESSION['role'] & ROLE_CUSTOMER) {
179)             $user = $_SESSION['customerinfo']['customerno'];
180)         }
181)     }
182) 
183)     $args = array(":user" => $user,
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

184)                 ":remote" => $_SERVER['REMOTE_ADDR'],
185)                 ":scriptname" => $scriptname,
186)                 ":scope" => $scope,
187)                 ":message" => $message);
bernd Logging aktiviert

bernd authored 16 years ago

188) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

189)     db_query("INSERT INTO misc.scriptlog (remote, user,scriptname,scope,message) VALUES (:remote, :user, :scriptname, :scope, :message)", $args);
bernd Logging aktiviert

bernd authored 16 years ago

190) }
191) 
Hanno fix codingstyle

Hanno authored 5 years ago

192) function count_failed_logins()
193) {
Bernd Wurst disable brute force check w...

Bernd Wurst authored 5 years ago

194)     if (config('logging') < LOG_WARNING) {
195)         DEBUG("logging is disabled, no brute force check possible");
196)         return;
197)     }
Bernd Wurst add brute force protection...

Bernd Wurst authored 5 years ago

198)     $result = db_query("SELECT count(*) AS num FROM misc.scriptlog WHERE user IS NULL AND scriptname='session/start' AND scope='login' AND message LIKE 'wrong user data%' AND remote=:remote AND `timestamp` > NOW() - INTERVAL 10 MINUTE", array(":remote" => $_SERVER['REMOTE_ADDR']));
199)     $data = $result->fetch();
200)     DEBUG('seen '.$data['num'].' failed logins from this address within 10 minutes');
201)     return $data['num'];
202) }
203) 
bernd Allow Header entries and AJAX

bernd authored 15 years ago

204) function html_header($arg)
205) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

206)     global $html_header;
207)     $html_header .= $arg;
bernd Allow Header entries and AJAX

bernd authored 15 years ago

208) }
bernd Logging aktiviert

bernd authored 16 years ago

209) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

210) function title($arg)
211) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

212)     global $title;
213)     $title = $arg;
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

214) }
215) 
216) function headline($arg)
217) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

218)     global $headline;
219)     $headline = $arg;
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

220) }
221) 
bernd webinterface => /webinterface

bernd authored 17 years ago

222) function output($arg)
223) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

224)     global $output;
225)     $output .= $arg;
bernd webinterface => /webinterface

bernd authored 17 years ago

226) }
227) 
Bernd Wurst Funktion für Fußnoten einge...

Bernd Wurst authored 6 years ago

228) function footnote($explaination)
229) {
230)     global $footnotes;
231)     if (!isset($footnotes) || !is_array($footnotes)) {
232)         $footnotes = array();
233)     }
234)     $fnid = array_search($explaination, $footnotes);
Bernd Wurst Bugfix für Fußnoten

Bernd Wurst authored 6 years ago

235)     DEBUG($footnotes);
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

236)     if ($fnid === false) {
Bernd Wurst Bugfix für Fußnoten

Bernd Wurst authored 6 years ago

237)         DEBUG("Footnote »{$explaination}« is not in footnotes!");
Bernd Wurst Funktion für Fußnoten einge...

Bernd Wurst authored 6 years ago

238)         $footnotes[] = $explaination;
239)     }
240)     $fnid = array_search($explaination, $footnotes);
241)     return str_repeat('*', ($fnid+1));
242) }
bernd webinterface => /webinterface

bernd authored 17 years ago

243) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

244) function random_string($len)
Bernd Wurst random_string() verwendet u...

Bernd Wurst authored 7 years ago

245) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

246)     $s = str_replace('+', '.', base64_encode(random_bytes(ceil($len*3/4))));
247)     return substr($s, 0, $len);
Bernd Wurst random_string() verwendet u...

Bernd Wurst authored 7 years ago

248) }
bernd webinterface => /webinterface

bernd authored 17 years ago

249) 
250) 
251) function are_you_sure($query_string, $question)
252) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

253)     $query_string = encode_querystring($query_string);
254)     $token = random_string(20);
255)     $_SESSION['are_you_sure_token'] = $token;
256)     title('Sicherheitsabfrage');
257)     output("
bernd * alle internen Links sinnv...

bernd authored 15 years ago

258)     <form action=\"{$query_string}\" method=\"post\">
bernd Umfangreiche Code-Aufräumar...

bernd authored 16 years ago

259)     <div class=\"confirmation\">
260)       <div class=\"question\">{$question}</div>
261)       <p class=\"buttons\">
262)         <input type=\"hidden\" name=\"random_token\" value=\"{$token}\" />
263)         <input type=\"submit\" name=\"really\" value=\"Ja\" />
bernd Entities repariert

bernd authored 16 years ago

264)         &#160; &#160;
bernd Umfangreiche Code-Aufräumar...

bernd authored 16 years ago

265)         <input type=\"submit\" name=\"not_really\" value=\"Nein\" />
266)       </p>
267)     </div>");
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

268)     output("</form>\n");
bernd webinterface => /webinterface

bernd authored 17 years ago

269) }
270) 
271) 
272) function user_is_sure()
273) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

274)     if (isset($_POST['really'])) {
Hanno avoid undefined index

Hanno authored 5 years ago

275)         if (array_key_exists('random_token', $_POST) &&
276)             ($_POST['random_token'] == $_SESSION['are_you_sure_token'])) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

277)             return true;
278)         } else {
279)             system_failure("Possible Cross-site-request-forgery detected!");
280)         }
281)     } elseif (isset($_POST['not_really'])) {
282)         return false;
283)     } else {
284)         return null;
285)     }
bernd webinterface => /webinterface

bernd authored 17 years ago

286) }
287) 
288) 
289) 
bernd XSRF-kram fixed

bernd authored 16 years ago

290) function generate_form_token($form_id)
291) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

292)     require_once("inc/debug.php");
293)     $sessid = session_id();
294)     if ($sessid == "") {
295)         DEBUG("Uh? Session not running? Wtf?");
296)         system_failure("Internal error!");
297)     }
298)     if (! isset($_SESSION['session_token'])) {
299)         $_SESSION['session_token'] = random_string(10);
300)     }
301)     return hash('sha256', $sessid.$form_id.$_SESSION['session_token']);
bernd XSRF-kram fixed

bernd authored 16 years ago

302) }
303) 
304) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

305) function check_form_token($form_id, $formtoken = null)
bernd XSRF-kram fixed

bernd authored 16 years ago

306) {
Hanno Böck Warnung wg. undefined index...

Hanno Böck authored 5 years ago

307)     if ($formtoken == null && isset($_REQUEST['formtoken'])) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

308)         $formtoken = $_REQUEST['formtoken'];
309)     }
310)     $sessid = session_id();
311)     if ($sessid == "") {
312)         DEBUG("Uh? Session not running? Wtf?");
313)         system_failure("Internal error! (Session not running)");
314)     }
315) 
Bernd Wurst Erzeuge Session-Token, fall...

Bernd Wurst authored 5 years ago

316)     if (! isset($_SESSION['session_token'])) {
317)         $_SESSION['session_token'] = random_string(10);
318)     }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

319)     $correct_formtoken = hash('sha256', $sessid.$form_id.$_SESSION['session_token']);
320) 
321)     if (! ($formtoken == $correct_formtoken)) {
322)         system_failure("Possible cross-site-request-forgery!");
323)     }
bernd XSRF-kram fixed

bernd authored 16 years ago

324) }
325) 
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

326) 
bernd Zeige Links auf dem Startse...

bernd authored 14 years ago

327) function have_module($modname)
328) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

329)     return in_array($modname, config('modules'));
bernd Zeige Links auf dem Startse...

bernd authored 14 years ago

330) }
331) 
332) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

333) function use_module($modname)
Bernd Wurst Rudimentäre Adressauswahl/D...

Bernd Wurst authored 6 years ago

334) {
Bernd Wurst Aktualisiere Domain- und In...

Bernd Wurst authored 6 years ago

335)     global $prefix, $needed_modules;
336)     if (! isset($needed_modules)) {
337)         $needed_modules = array();
338)     }
339)     if (in_array($modname, $needed_modules)) {
340)         return;
341)     }
342)     $needed_modules[] = $modname;
Bernd Wurst Rudimentäre Adressauswahl/D...

Bernd Wurst authored 6 years ago

343)     if (! have_module($modname)) {
344)         system_failure("Soll nicht verfügbares Modul laden!");
345)     }
346)     /* setup module include path */
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

347)     ini_set('include_path', ini_get('include_path').':./modules/'.$modname.'/include:');
Bernd Wurst Rudimentäre Adressauswahl/D...

Bernd Wurst authored 6 years ago

348)     $style = 'modules/'.$modname.'/style.css';
349)     if (file_exists($style)) {
350)         html_header('<link rel="stylesheet" href="'.$prefix.$style.'" type="text/css" />'."\n");
351)     }
352) }
353) 
354) 
bernd * alle internen Links sinnv...

bernd authored 15 years ago

355) function encode_querystring($querystring)
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

356) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

357)     global $debugmode;
358)     if ($debugmode) {
359)         $querystring = 'debug&'.$querystring;
360)     }
361)     $query = explode('&', $querystring);
362)     $new_query = array();
363)     foreach ($query as $item) {
364)         if ($item != '') {
365)             $split = explode('=', $item, 2);
366)             if (count($split) == 1) {
367)                 $new_query[] = $split[0];
368)             } else {
369)                 $new_query[] = $split[0].'='.urlencode($split[1]);
370)             }
371)         }
372)     }
373)     $querystring = implode('&amp;', $new_query);
374)     if ($querystring) {
375)         $querystring = '?'.$querystring;
376)     }
377)     return $querystring;
bernd * alle internen Links sinnv...

bernd authored 15 years ago

378) }
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

379) 
bernd * alle internen Links sinnv...

bernd authored 15 years ago

380) 
Bernd Wurst Beta-Hinweis eingefügt

Bernd Wurst authored 6 years ago

381) function beta_notice()
382) {
383)     output('<div class="beta"><h4>Achtung: Testbetrieb</h4><p>Diese Funktion ist im Testbetrieb. Bei Fehlfunktionen, Unklarheiten oder Verbesserungsvorschlägen bitten wir um kurze Nachricht an <a href="mailto:root@schokokeks.org">root@schokokeks.org</a></p></div>');
384) }
385) 
386) 
Bernd Wurst Google-Auth-Token setzen un...

Bernd Wurst authored 11 years ago

387) function addnew($file, $label, $querystring = '', $attribs = '')
bernd addnew() eingeführt

bernd authored 14 years ago

388) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

389)     output('<p class="addnew">'.internal_link($file, $label, $querystring, $attribs).'</p>');
bernd addnew() eingeführt

bernd authored 14 years ago

390) }
391) 
bernd * alle internen Links sinnv...

bernd authored 15 years ago

392) 
393) function internal_link($file, $label, $querystring = '', $attribs = '')
394) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

395)     global $prefix;
396)     if (strpos($file, '/') === 0) {
397)         $file = $prefix.substr($file, 1);
398)     }
399)     $querystring = encode_querystring($querystring);
400)     return "<a href=\"{$file}{$querystring}\" {$attribs} >{$label}</a>";
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

401) }
402) 
403) 
404) function html_form($form_id, $scriptname, $querystring, $content)
405) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

406)     $querystring = encode_querystring($querystring);
407)     $ret = '';
408)     $ret .= '<form id="'.$form_id.'" action="'.$scriptname.$querystring.'" method="post">'."\n";
409)     $ret .= '<p style="display: none;"><input type="hidden" name="formtoken" value="'.generate_form_token($form_id).'" /></p>'."\n";
410)     $ret .= $content;
411)     $ret .= '</form>';
412)     return $ret;
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

413) }
414) 
415) 
bernd * wie viele Reihen wurden a...

bernd authored 15 years ago

416) function html_select($name, $options, $default='', $free='')
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

417) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

418)     require_once('inc/security.php');
419)     $ret = "<select name=\"{$name}\" id=\"{$name}\" size=\"1\" {$free} >\n";
420)     foreach ($options as $key => $value) {
421)         $selected = '';
422)         if ($default == $key) {
423)             $selected = ' selected="selected" ';
424)         }
425)         $key = filter_input_general($key);
426)         $value = filter_input_general($value);
427)         $ret .= "  <option value=\"{$key}\"{$selected}>{$value}</option>\n";
428)     }
429)     $ret .= '</select>';
430)     return $ret;
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

431) }
432) 
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

433) 
bernd Neue Funktion zur Anzeige e...

bernd authored 12 years ago

434) function html_datepicker($nameprefix, $timestamp)
435) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

436)     $valid_days = array( 1 =>  1,  2 =>  2,  3 =>  3,  4 =>  4,  5 =>  5,
bernd Neue Funktion zur Anzeige e...

bernd authored 12 years ago

437)                        6 =>  6,  7 =>  7,  8 =>  8,  9 =>  9, 10 => 10,
438)                       11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15,
439)                       16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20,
440)                       21 => 21, 22 => 22, 23 => 23, 24 => 24, 25 => 25,
441)                       26 => 26, 27 => 27, 28 => 28, 29 => 29, 30 => 30,
442)                       31 => 31);
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

443)     $valid_months = array( 1 =>  1,  2 =>  2,  3 =>  3,  4 =>  4,  5 =>  5,
bernd Neue Funktion zur Anzeige e...

bernd authored 12 years ago

444)                          6 =>  6,  7 =>  7,  8 =>  8,  9 =>  9, 10 => 10,
445)                         11 => 11, 12 => 12);
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

446)     $current_year = (int) date('Y');
447)     $valid_years = array($current_year => $current_year,
bernd Datums-Check und Daten in u...

bernd authored 12 years ago

448)                        $current_year+1 => $current_year+1,
449)                        $current_year+2 => $current_year+2,
450)                        $current_year+3 => $current_year+3,
451)                        $current_year+4 => $current_year+4);
Hanno remove whitespace in empty...

Hanno authored 5 years ago

452) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

453)     $selected_day = date('d', $timestamp);
454)     $selected_month = date('m', $timestamp);
455)     $selected_year = date('Y', $timestamp);
456)     $ret = '';
457)     $ret .= html_select($nameprefix.'_day', $valid_days, $selected_day, 'style="text-align: right;"').". ";
458)     $ret .= html_select($nameprefix.'_month', $valid_months, $selected_month, 'style="text-align: right;"').". ";
459)     $ret .= html_select($nameprefix.'_year', $valid_years, $selected_year);
460)     return $ret;
bernd Neue Funktion zur Anzeige e...

bernd authored 12 years ago

461) }
462) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

463) function get_modules_info()
bernd Index-Blöcke werden jetzt v...

bernd authored 12 years ago

464) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

465)     $modules = config('modules');
466)     $modconfig = array();
467)     foreach ($modules as $name) {
468)         $modconfig[$name] = null;
469)         if (file_exists('modules/'.$name.'/module.info')) {
470)             $modconfig[$name] = parse_ini_file('modules/'.$name.'/module.info');
471)         }
472)     }
473)     return $modconfig;
bernd Index-Blöcke werden jetzt v...

bernd authored 12 years ago

474) }
Hanno Default exception handler w...

Hanno authored 5 years ago

475) 
476) function handle_exception($e)
477) {
Bernd Wurst send exception via mail onl...

Bernd Wurst authored 5 years ago

478)     if (config('enable_debug')) {
Bernd Wurst print stack trace with exce...

Bernd Wurst authored 5 years ago

479)         print_r($e->getMessage()."<br>");
480)         debug_print_backtrace();
481)         echo("<br>");
482)         print_r(serialize($_POST)."<br>");
Bernd Wurst send exception via mail onl...

Bernd Wurst authored 5 years ago

483)         print_r(serialize($_SERVER));
484)     } else {
485)         $msg = "Exception caught:\n".$e->getMessage()."\n".serialize($_POST)."\n".serialize($_SERVER);
486)         mail(config("adminmail"), "Exception on configinterface", $msg);
487)     }