864a03c1b557235e9fa38aee8af2f3d784a622e6
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 15 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) 
Bernd Wurst add brute force protection...

Bernd Wurst authored 5 years ago

192) function count_failed_logins() {
193)     $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']));
194)     $data = $result->fetch();
195)     DEBUG('seen '.$data['num'].' failed logins from this address within 10 minutes');
196)     return $data['num'];
197) }
198) 
bernd Allow Header entries and AJAX

bernd authored 15 years ago

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

Hanno authored 5 years ago

201)     global $html_header;
202)     $html_header .= $arg;
bernd Allow Header entries and AJAX

bernd authored 15 years ago

203) }
bernd Logging aktiviert

bernd authored 16 years ago

204) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

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

Hanno authored 5 years ago

207)     global $title;
208)     $title = $arg;
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

209) }
210) 
211) function headline($arg)
212) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

213)     global $headline;
214)     $headline = $arg;
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

215) }
216) 
bernd webinterface => /webinterface

bernd authored 17 years ago

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

Hanno authored 5 years ago

219)     global $output;
220)     $output .= $arg;
bernd webinterface => /webinterface

bernd authored 17 years ago

221) }
222) 
Bernd Wurst Funktion für Fußnoten einge...

Bernd Wurst authored 6 years ago

223) function footnote($explaination)
224) {
225)     global $footnotes;
226)     if (!isset($footnotes) || !is_array($footnotes)) {
227)         $footnotes = array();
228)     }
229)     $fnid = array_search($explaination, $footnotes);
Bernd Wurst Bugfix für Fußnoten

Bernd Wurst authored 6 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

233)         $footnotes[] = $explaination;
234)     }
235)     $fnid = array_search($explaination, $footnotes);
236)     return str_repeat('*', ($fnid+1));
237) }
bernd webinterface => /webinterface

bernd authored 17 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 7 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 7 years ago

243) }
bernd webinterface => /webinterface

bernd authored 17 years ago

244) 
245) 
246) function are_you_sure($query_string, $question)
247) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

248)     $query_string = encode_querystring($query_string);
249)     $token = random_string(20);
250)     $_SESSION['are_you_sure_token'] = $token;
251)     title('Sicherheitsabfrage');
252)     output("
bernd * alle internen Links sinnv...

bernd authored 15 years ago

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

bernd authored 16 years ago

254)     <div class=\"confirmation\">
255)       <div class=\"question\">{$question}</div>
256)       <p class=\"buttons\">
257)         <input type=\"hidden\" name=\"random_token\" value=\"{$token}\" />
258)         <input type=\"submit\" name=\"really\" value=\"Ja\" />
bernd Entities repariert

bernd authored 16 years ago

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

bernd authored 16 years ago

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

Hanno authored 5 years ago

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

bernd authored 17 years ago

264) }
265) 
266) 
267) function user_is_sure()
268) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

Hanno authored 5 years ago

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

Hanno authored 5 years ago

272)             return true;
273)         } else {
274)             system_failure("Possible Cross-site-request-forgery detected!");
275)         }
276)     } elseif (isset($_POST['not_really'])) {
277)         return false;
278)     } else {
279)         return null;
280)     }
bernd webinterface => /webinterface

bernd authored 17 years ago

281) }
282) 
283) 
284) 
bernd XSRF-kram fixed

bernd authored 16 years ago

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

Hanno authored 5 years ago

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

bernd authored 16 years ago

297) }
298) 
299) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

bernd authored 16 years ago

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

Hanno Böck authored 5 years ago

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

Hanno authored 5 years ago

303)         $formtoken = $_REQUEST['formtoken'];
304)     }
305)     $sessid = session_id();
306)     if ($sessid == "") {
307)         DEBUG("Uh? Session not running? Wtf?");
308)         system_failure("Internal error! (Session not running)");
309)     }
310) 
Bernd Wurst Erzeuge Session-Token, fall...

Bernd Wurst authored 5 years ago

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

Hanno authored 5 years ago

314)     $correct_formtoken = hash('sha256', $sessid.$form_id.$_SESSION['session_token']);
315) 
316)     if (! ($formtoken == $correct_formtoken)) {
317)         system_failure("Possible cross-site-request-forgery!");
318)     }
bernd XSRF-kram fixed

bernd authored 16 years ago

319) }
320) 
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

321) 
bernd Zeige Links auf dem Startse...

bernd authored 14 years ago

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

Hanno authored 5 years ago

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

bernd authored 14 years ago

325) }
326) 
327) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

330)     global $prefix, $needed_modules;
331)     if (! isset($needed_modules)) {
332)         $needed_modules = array();
333)     }
334)     if (in_array($modname, $needed_modules)) {
335)         return;
336)     }
337)     $needed_modules[] = $modname;
Bernd Wurst Rudimentäre Adressauswahl/D...

Bernd Wurst authored 6 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 6 years ago

343)     $style = 'modules/'.$modname.'/style.css';
344)     if (file_exists($style)) {
345)         html_header('<link rel="stylesheet" href="'.$prefix.$style.'" type="text/css" />'."\n");
346)     }
347) }
348) 
349) 
bernd * alle internen Links sinnv...

bernd authored 15 years ago

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

bernd authored 16 years ago

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

Hanno authored 5 years ago

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

bernd authored 15 years ago

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

bernd authored 16 years ago

374) 
bernd * alle internen Links sinnv...

bernd authored 15 years ago

375) 
Bernd Wurst Beta-Hinweis eingefügt

Bernd Wurst authored 6 years ago

376) function beta_notice()
377) {
378)     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>');
379) }
380) 
381) 
Bernd Wurst Google-Auth-Token setzen un...

Bernd Wurst authored 11 years ago

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

bernd authored 14 years ago

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

Hanno authored 5 years ago

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

bernd authored 14 years ago

385) }
386) 
bernd * alle internen Links sinnv...

bernd authored 15 years ago

387) 
388) function internal_link($file, $label, $querystring = '', $attribs = '')
389) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

390)     global $prefix;
391)     if (strpos($file, '/') === 0) {
392)         $file = $prefix.substr($file, 1);
393)     }
394)     $querystring = encode_querystring($querystring);
395)     return "<a href=\"{$file}{$querystring}\" {$attribs} >{$label}</a>";
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

396) }
397) 
398) 
399) function html_form($form_id, $scriptname, $querystring, $content)
400) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

bernd authored 16 years ago

408) }
409) 
410) 
bernd * wie viele Reihen wurden a...

bernd authored 15 years ago

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

bernd authored 16 years ago

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

Hanno authored 5 years ago

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

bernd authored 16 years ago

426) }
427) 
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

428) 
bernd Neue Funktion zur Anzeige e...

bernd authored 12 years ago

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

Hanno authored 5 years ago

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

bernd authored 12 years ago

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

Hanno authored 5 years ago

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

bernd authored 12 years ago

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

Hanno authored 5 years ago

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

bernd authored 12 years ago

443)                        $current_year+1 => $current_year+1,
444)                        $current_year+2 => $current_year+2,
445)                        $current_year+3 => $current_year+3,
446)                        $current_year+4 => $current_year+4);
Hanno remove whitespace in empty...

Hanno authored 5 years ago

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

Hanno authored 5 years ago

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

bernd authored 12 years ago

456) }
457) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

bernd authored 12 years ago

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

Hanno authored 5 years ago

460)     $modules = config('modules');
461)     $modconfig = array();
462)     foreach ($modules as $name) {
463)         $modconfig[$name] = null;
464)         if (file_exists('modules/'.$name.'/module.info')) {
465)             $modconfig[$name] = parse_ini_file('modules/'.$name.'/module.info');
466)         }
467)     }
468)     return $modconfig;
bernd Index-Blöcke werden jetzt v...

bernd authored 12 years ago

469) }
Hanno Default exception handler w...

Hanno authored 5 years ago

470) 
471) function handle_exception($e)
472) {
Bernd Wurst send exception via mail onl...

Bernd Wurst authored 5 years ago

473)     if (config('enable_debug')) {
474)         print_r($e->getMessage());
475)         print_r(serialize($_POST));
476)         print_r(serialize($_SERVER));
477)     } else {
478)         $msg = "Exception caught:\n".$e->getMessage()."\n".serialize($_POST)."\n".serialize($_SERVER);
479)         mail(config("adminmail"), "Exception on configinterface", $msg);
480)     }