60ba2d3f94e0764d99904f896e1f01cecedc22bb
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) 
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
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) {
22)   global $config;
bernd Erlaube subusers, die nur Z...

bernd authored 13 years ago

23) 
Bernd Wurst Lizenzinfos in eigenes Modu...

Bernd Wurst authored 10 years ago

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)     }
33)   }
34) 
bernd Erlaube subusers, die nur Z...

bernd authored 13 years ago

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

bernd authored 14 years ago

46)   if (array_key_exists($key, $config))
47)     return $config[$key];
48)   
schokokeks.org web services Ermögliche Socket-Angabe fü...

schokokeks.org web services authored 10 years ago

49)   if ($localonly) {
50)     return NULL;
51)   }  
52) 
bernd config() liest die Datenban...

bernd authored 14 years ago

53)   /* read configuration from database */
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

54)   $result = db_query( "SELECT `key`, value FROM misc.config" );
bernd config() liest die Datenban...

bernd authored 14 years ago

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

Bernd Wurst authored 10 years ago

56)   while( $object = $result->fetch() ) {
schokokeks.org web services Config-File-Optionen werden...

schokokeks.org web services authored 10 years ago

57)     if (!array_key_exists($object['key'], $config)) {
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

58) 	    $config[$object['key']]=$object['value'];
schokokeks.org web services Config-File-Optionen werden...

schokokeks.org web services authored 10 years ago

59)     }
bernd config() liest die Datenban...

bernd authored 14 years ago

60)   }
bernd Passwort-Ändern geht jetzt...

bernd authored 13 years ago

61)   // Sonst wird das Passwort des webadmin-Users mit ausgegeben
62)   $debug_config = $config;
63)   unset($debug_config['db_pass']);
64)   DEBUG($debug_config);
bernd Mehr config-optionen und co...

bernd authored 14 years ago

65)   if (array_key_exists($key, $config))
66)     return $config[$key];
67)   else
bernd Logger mit Logleveln

bernd authored 14 years ago

68)     logger(LOG_ERR, "inc/base", "config", "Request to read nonexistant config option »{$key}«.");
bernd Einige Dummheiten repariert...

bernd authored 14 years ago

69)     return NULL;
bernd Mehr config-optionen und co...

bernd authored 14 years ago

70) }
71) 
Bernd Wurst Blende Aktionen aus, wenn d...

Bernd Wurst authored 6 years ago

72) function have_role($role) {
73)     $have = $_SESSION['role'] & $role;
74)     if ($have) {
75)         DEBUG("Current user has role ".$role);
76)     } else {
77)         DEBUG("Current user does not have role ".$role);
78)     }
79)     return $have;
80) }
81) 
bernd Info-Seite über Mail-Login-...

bernd authored 13 years ago

82) function get_server_by_id($id) {
83)   $id = (int) $id;
Bernd Wurst Weitere Prepared-Statement-...

Bernd Wurst authored 10 years ago

84)   $result = db_query("SELECT hostname FROM system.servers WHERE id=?", array($id));
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

85)   $ret = $result->fetch();
86)   return $ret['hostname'];
bernd Info-Seite über Mail-Login-...

bernd authored 13 years ago

87) }
88) 
bernd Mehr config-optionen und co...

bernd authored 14 years ago

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

bernd authored 14 years ago

90) function redirect($target)
91) {
92)   global $debugmode;
Bernd Wurst Session aufräumen, Weiterle...

Bernd Wurst authored 6 years ago

93)   if ($target == '') {
94)       $target = $_SERVER['REQUEST_URI'];
95)   }
Bernd Wurst Erste Vorbereitungen für Do...

Bernd Wurst authored 6 years ago

96)   if (! $debugmode) {
bernd add a function to handle re...

bernd authored 14 years ago

97)     header("Location: {$target}");
Bernd Wurst Erste Vorbereitungen für Do...

Bernd Wurst authored 6 years ago

98)   } else {
99)       if (strpos($target, '?') === false) {
100)         print 'REDIRECT: '.internal_link($target, $target);
101)       } else {
102)           list($file, $qs) = explode('?', $target, 2);
103)           print 'REDIRECT: '.internal_link($file, $target, $qs);
104)       }
105)   }
bernd add a function to handle re...

bernd authored 14 years ago

106)   die();
107) }
108) 
109) 
bernd Hilfsfunktionen bzgl. mehre...

bernd authored 14 years ago

110) function my_server_id()
111) {
112)   $uid = (int) $_SESSION['userinfo']['uid'];
Bernd Wurst Einige Statements auf Prepa...

Bernd Wurst authored 10 years ago

113)   $result = db_query("SELECT server FROM system.useraccounts WHERE uid=?", array($uid));
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

114)   $r = $result->fetch();
bernd Hilfsfunktionen bzgl. mehre...

bernd authored 14 years ago

115)   DEBUG($r);
116)   return $r['server'];
117) }
118) 
119) 
120) function additional_servers()
121) {
122)   $uid = (int) $_SESSION['userinfo']['uid'];
Bernd Wurst Einige Statements auf Prepa...

Bernd Wurst authored 10 years ago

123)   $result = db_query("SELECT server FROM system.user_server WHERE uid=?", array($uid));
bernd Hilfsfunktionen bzgl. mehre...

bernd authored 14 years ago

124)   $servers = array();
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

125)   while ($s = $result->fetch())
bernd Hilfsfunktionen bzgl. mehre...

bernd authored 14 years ago

126)     $servers[] = $s['server'];
127)   DEBUG($servers);
128)   return $servers;
129) }
130) 
131) 
132) function server_names()
133) {
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

134)   $result = db_query("SELECT id, hostname FROM system.servers");
bernd Hilfsfunktionen bzgl. mehre...

bernd authored 14 years ago

135)   $servers = array();
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

136)   while ($s = $result->fetch())
bernd Hilfsfunktionen bzgl. mehre...

bernd authored 14 years ago

137)     $servers[$s['id']] = $s['hostname'];
138)   DEBUG($servers);
139)   return $servers;
140) }
141) 
142) 
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

143) function maybe_null($value)
144) {
Bernd Wurst Funktion maybe_null() umdef...

Bernd Wurst authored 6 years ago

145)   if (! $value)
146)     return NULL;
bernd maybe_null behandelt jetzt...

bernd authored 15 years ago

147) 
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

148)   if (strlen( (string) $value ) > 0)
Bernd Wurst Funktion maybe_null() umdef...

Bernd Wurst authored 6 years ago

149)     return (string) $value;
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

150)   else
Bernd Wurst Funktion maybe_null() umdef...

Bernd Wurst authored 6 years ago

151)     return NULL;
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

152) }
153) 
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

154) 
bernd Logger mit Logleveln

bernd authored 14 years ago

155) #define('LOG_ERR', 3);
156) #define('LOG_WARNING', 4);
157) #define('LOG_INFO', 6);
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

158) 
bernd Logger mit Logleveln

bernd authored 14 years ago

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

bernd authored 16 years ago

160) {
Bernd Wurst Zuverlässigeres Logging bei...

Bernd Wurst authored 6 years ago

161)   if (config('logging') < $severity) {
162)     DEBUG("NOT LOGGING $scriptname:$scope:$message");
bernd Logging konfigurierbar

bernd authored 16 years ago

163)     return;
Bernd Wurst Zuverlässigeres Logging bei...

Bernd Wurst authored 6 years ago

164)   }
bernd Logging konfigurierbar

bernd authored 16 years ago

165) 
Bernd Wurst Zuverlässigeres Logging bei...

Bernd Wurst authored 6 years ago

166)   DEBUG("LOGGING $scriptname:$scope:$message");
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

167)   $user = NULL;
bernd Bugfix: Logger zeigt wieder...

bernd authored 16 years ago

168)   if ($_SESSION['role'] & ROLE_SYSTEMUSER)
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

169)     $user = $_SESSION['userinfo']['username'];
bernd Bugfix: Logger zeigt wieder...

bernd authored 16 years ago

170)   elseif ($_SESSION['role'] & ROLE_CUSTOMER)
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

171)     $user = $_SESSION['customerinfo']['customerno'];
bernd Logging aktiviert

bernd authored 16 years ago

172)   
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

173)   $args = array(":user" => $user,
174)                 ":remote" => $_SERVER['REMOTE_ADDR'],
175)                 ":scriptname" => $scriptname,
176)                 ":scope" => $scope,
177)                 ":message" => $message);
bernd Logging aktiviert

bernd authored 16 years ago

178) 
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

179)   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

180) }
181) 
bernd Allow Header entries and AJAX

bernd authored 15 years ago

182) function html_header($arg)
183) {
184)   global $html_header;
185)   $html_header .= $arg;
186) }
bernd Logging aktiviert

bernd authored 16 years ago

187) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

188) function title($arg)
189) {
190)   global $title;
191)   $title = $arg;
192) }
193) 
194) function headline($arg)
195) {
196)   global $headline;
197)   $headline = $arg;
198) }
199) 
bernd webinterface => /webinterface

bernd authored 17 years ago

200) function output($arg)
201) {
202)   global $output;
203)   $output .= $arg;
204) }
205) 
Bernd Wurst Funktion für Fußnoten einge...

Bernd Wurst authored 6 years ago

206) function footnote($explaination)
207) {
208)     global $footnotes;
209)     if (!isset($footnotes) || !is_array($footnotes)) {
210)         $footnotes = array();
211)     }
212)     $fnid = array_search($explaination, $footnotes);
Bernd Wurst Bugfix für Fußnoten

Bernd Wurst authored 6 years ago

213)     DEBUG($footnotes);
214)     if ($fnid === FALSE) {
215)         DEBUG("Footnote »{$explaination}« is not in footnotes!");
Bernd Wurst Funktion für Fußnoten einge...

Bernd Wurst authored 6 years ago

216)         $footnotes[] = $explaination;
217)     }
218)     $fnid = array_search($explaination, $footnotes);
219)     return str_repeat('*', ($fnid+1));
220) }
bernd webinterface => /webinterface

bernd authored 17 years ago

221) 
Bernd Wurst random_string korrigiert, s...

Bernd Wurst authored 7 years ago

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

Bernd Wurst authored 7 years ago

223) {
Bernd Wurst random_string korrigiert, s...

Bernd Wurst authored 7 years ago

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

Bernd Wurst authored 7 years ago

226) }
bernd webinterface => /webinterface

bernd authored 17 years ago

227) 
228) 
229) function are_you_sure($query_string, $question)
230) {
bernd * alle internen Links sinnv...

bernd authored 15 years ago

231)   $query_string = encode_querystring($query_string);
bernd webinterface => /webinterface

bernd authored 17 years ago

232)   $token = random_string(20);
bernd XSRF-kram fixed

bernd authored 16 years ago

233)   $_SESSION['are_you_sure_token'] = $token;
bernd Benutze überall title() sta...

bernd authored 13 years ago

234)   title('Sicherheitsabfrage');
235)   output("
bernd * alle internen Links sinnv...

bernd authored 15 years ago

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

bernd authored 16 years ago

237)     <div class=\"confirmation\">
238)       <div class=\"question\">{$question}</div>
239)       <p class=\"buttons\">
240)         <input type=\"hidden\" name=\"random_token\" value=\"{$token}\" />
241)         <input type=\"submit\" name=\"really\" value=\"Ja\" />
bernd Entities repariert

bernd authored 16 years ago

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

bernd authored 16 years ago

243)         <input type=\"submit\" name=\"not_really\" value=\"Nein\" />
244)       </p>
245)     </div>");
bernd </form>

bernd authored 16 years ago

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

bernd authored 17 years ago

247) }
248) 
249) 
250) function user_is_sure()
251) {
252)   if (isset($_POST['really']))
253)   {
bernd XSRF-kram fixed

bernd authored 16 years ago

254)     if ($_POST['random_token'] == $_SESSION['are_you_sure_token'])
bernd webinterface => /webinterface

bernd authored 17 years ago

255)       return true;
256)     else
257)       system_failure("Possible Cross-site-request-forgery detected!");
258)   }
259)   elseif (isset($_POST['not_really']))
260)     return false;
261)   else
262)     return NULL;
263) }
264) 
265) 
266) 
bernd XSRF-kram fixed

bernd authored 16 years ago

267) function generate_form_token($form_id)
268) {
269)   require_once("inc/debug.php");
270)   $sessid = session_id();
271)   if ($sessid == "") 
272)   {
273)     DEBUG("Uh? Session not running? Wtf?");
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

274)     system_failure("Internal error!");
bernd XSRF-kram fixed

bernd authored 16 years ago

275)   }
Bernd Wurst random_string() verwendet u...

Bernd Wurst authored 7 years ago

276)   if (! isset($_SESSION['session_token'])) {
bernd XSRF-kram fixed

bernd authored 16 years ago

277)     $_SESSION['session_token'] = random_string(10);
Bernd Wurst random_string() verwendet u...

Bernd Wurst authored 7 years ago

278)   }
bernd Umfangreiche Code-Aufräumar...

bernd authored 16 years ago

279)   return hash('sha256', $sessid.$form_id.$_SESSION['session_token']);
bernd XSRF-kram fixed

bernd authored 16 years ago

280) }
281) 
282) 
bernd Umfangreiche Code-Aufräumar...

bernd authored 16 years ago

283) function check_form_token($form_id, $formtoken = NULL)
bernd XSRF-kram fixed

bernd authored 16 years ago

284) {
bernd Umfangreiche Code-Aufräumar...

bernd authored 16 years ago

285)   if ($formtoken == NULL)
Bernd Wurst Neue MySQL-Verwaltung

Bernd Wurst authored 11 years ago

286)     $formtoken = $_REQUEST['formtoken'];
bernd XSRF-kram fixed

bernd authored 16 years ago

287)   $sessid = session_id();
288)   if ($sessid == "") 
289)   {
290)     DEBUG("Uh? Session not running? Wtf?");
bernd Umfangreiche Code-Aufräumar...

bernd authored 16 years ago

291)     system_failure("Internal error! (Session not running)");
bernd XSRF-kram fixed

bernd authored 16 years ago

292)   }
293) 
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

294)   $correct_formtoken = hash('sha256', $sessid.$form_id.$_SESSION['session_token']);
bernd XSRF-kram fixed

bernd authored 16 years ago

295) 
296)   if (! ($formtoken == $correct_formtoken))
297)     system_failure("Possible cross-site-request-forgery!");
298) }
299) 
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

300) 
bernd Zeige Links auf dem Startse...

bernd authored 14 years ago

301) function have_module($modname)
302) {
bernd Mehr config-optionen und co...

bernd authored 14 years ago

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

bernd authored 14 years ago

304) }
305) 
306) 
Bernd Wurst Rudimentäre Adressauswahl/D...

Bernd Wurst authored 6 years ago

307) function use_module($modname) 
308) {
Bernd Wurst Aktualisiere Domain- und In...

Bernd Wurst authored 6 years ago

309)     global $prefix, $needed_modules;
310)     if (! isset($needed_modules)) {
311)         $needed_modules = array();
312)     }
313)     if (in_array($modname, $needed_modules)) {
314)         return;
315)     }
316)     $needed_modules[] = $modname;
Bernd Wurst Rudimentäre Adressauswahl/D...

Bernd Wurst authored 6 years ago

317)     if (! have_module($modname)) {
318)         system_failure("Soll nicht verfügbares Modul laden!");
319)     }
320)     /* setup module include path */
321)     ini_set('include_path',ini_get('include_path').':./modules/'.$modname.'/include:');
322)     $style = 'modules/'.$modname.'/style.css';
323)     if (file_exists($style)) {
324)         html_header('<link rel="stylesheet" href="'.$prefix.$style.'" type="text/css" />'."\n");
325)     }
326) 
327) }
328) 
329) 
bernd * alle internen Links sinnv...

bernd authored 15 years ago

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

bernd authored 16 years ago

331) {
332)   global $debugmode;
333)   if ($debugmode)
bernd * alle internen Links sinnv...

bernd authored 15 years ago

334)     $querystring = 'debug&'.$querystring;
335)   $query = explode('&', $querystring);
336)   $new_query = array();
337)   foreach ($query AS $item)
338)     if ($item != '')
339)     {
bernd fix a warning

bernd authored 14 years ago

340)       $split = explode('=', $item, 2);
341)       if (count($split) == 1)
342)         $new_query[] = $split[0];
bernd Bug im Client-Zertfikat-Man...

bernd authored 15 years ago

343)       else
bernd fix a warning

bernd authored 14 years ago

344)         $new_query[] = $split[0].'='.urlencode($split[1]);
bernd * alle internen Links sinnv...

bernd authored 15 years ago

345)     }
346)   $querystring = implode('&amp;', $new_query);
347)   if ($querystring)
348)     $querystring = '?'.$querystring;
349)   return $querystring;
350) }
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

351) 
bernd * alle internen Links sinnv...

bernd authored 15 years ago

352) 
Bernd Wurst Beta-Hinweis eingefügt

Bernd Wurst authored 6 years ago

353) function beta_notice()
354) {
355)     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>');
356) }
357) 
358) 
Bernd Wurst Google-Auth-Token setzen un...

Bernd Wurst authored 11 years ago

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

bernd authored 14 years ago

360) {
Bernd Wurst Google-Auth-Token setzen un...

Bernd Wurst authored 11 years ago

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

bernd authored 14 years ago

362) }
363) 
bernd * alle internen Links sinnv...

bernd authored 15 years ago

364) 
365) function internal_link($file, $label, $querystring = '', $attribs = '')
366) {
bernd Erlaube absolute Links

bernd authored 15 years ago

367)   global $prefix;
bernd Das böse ==0

bernd authored 15 years ago

368)   if (strpos($file, '/') === 0)
bernd Erlaube absolute Links

bernd authored 15 years ago

369)   {
370)     $file = $prefix.substr($file, 1);
371)   }
bernd * alle internen Links sinnv...

bernd authored 15 years ago

372)   $querystring = encode_querystring($querystring);
373)   return "<a href=\"{$file}{$querystring}\" {$attribs} >{$label}</a>";
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

374) }
375) 
376) 
377) function html_form($form_id, $scriptname, $querystring, $content)
378) {
bernd * alle internen Links sinnv...

bernd authored 15 years ago

379)   $querystring = encode_querystring($querystring);
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

380)   $ret = '';
Bernd Wurst Domain-Nutzung mit Deeplink...

Bernd Wurst authored 6 years ago

381)   $ret .= '<form id="'.$form_id.'" action="'.$scriptname.$querystring.'" method="post">'."\n";
bernd Umfangreiche Code-Aufräumar...

bernd authored 16 years ago

382)   $ret .= '<p style="display: none;"><input type="hidden" name="formtoken" value="'.generate_form_token($form_id).'" /></p>'."\n";
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

383)   $ret .= $content;
384)   $ret .= '</form>';
385)   return $ret;  
386) }
387) 
388) 
bernd * wie viele Reihen wurden a...

bernd authored 15 years ago

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

bernd authored 16 years ago

390) {
391)   require_once('inc/security.php');
bernd * wie viele Reihen wurden a...

bernd authored 15 years ago

392)   $ret = "<select name=\"{$name}\" id=\"{$name}\" size=\"1\" {$free} >\n";
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

393)   foreach ($options as $key => $value)
394)   {
395)     $selected = '';
396)     if ($default == $key)
397)       $selected = ' selected="selected" ';
398)     $key = filter_input_general($key);
399)     $value = filter_input_general($value);
400)     $ret .= "  <option value=\"{$key}\"{$selected}>{$value}</option>\n";
401)   }
402)   $ret .= '</select>';
403)   return $ret;
404) }
405) 
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

406) 
bernd Neue Funktion zur Anzeige e...

bernd authored 12 years ago

407) function html_datepicker($nameprefix, $timestamp)
408) {
409)   $valid_days = array( 1 =>  1,  2 =>  2,  3 =>  3,  4 =>  4,  5 =>  5,
410)                        6 =>  6,  7 =>  7,  8 =>  8,  9 =>  9, 10 => 10,
411)                       11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15,
412)                       16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20,
413)                       21 => 21, 22 => 22, 23 => 23, 24 => 24, 25 => 25,
414)                       26 => 26, 27 => 27, 28 => 28, 29 => 29, 30 => 30,
415)                       31 => 31);
416)   $valid_months = array( 1 =>  1,  2 =>  2,  3 =>  3,  4 =>  4,  5 =>  5,
417)                          6 =>  6,  7 =>  7,  8 =>  8,  9 =>  9, 10 => 10,
418)                         11 => 11, 12 => 12);
bernd Datums-Check und Daten in u...

bernd authored 12 years ago

419)   $current_year = (int) date('Y');
420)   $valid_years = array($current_year => $current_year, 
421)                        $current_year+1 => $current_year+1,
422)                        $current_year+2 => $current_year+2,
423)                        $current_year+3 => $current_year+3,
424)                        $current_year+4 => $current_year+4);
425)               
bernd Neue Funktion zur Anzeige e...

bernd authored 12 years ago

426)   $selected_day = date('d', $timestamp);
427)   $selected_month = date('m', $timestamp);
428)   $selected_year = date('Y', $timestamp);
429)   $ret = '';
430)   $ret .= html_select($nameprefix.'_day', $valid_days, $selected_day, 'style="text-align: right;"').". ";
431)   $ret .= html_select($nameprefix.'_month', $valid_months, $selected_month, 'style="text-align: right;"').". ";
bernd Datums-Check und Daten in u...

bernd authored 12 years ago

432)   $ret .= html_select($nameprefix.'_year', $valid_years, $selected_year);
bernd Neue Funktion zur Anzeige e...

bernd authored 12 years ago

433)   return $ret;
434) }
435) 
bernd Index-Blöcke werden jetzt v...

bernd authored 12 years ago

436) function get_modules_info() 
437) {
438)   $modules = config('modules');
439)   $modconfig = array();
440)   foreach ($modules AS $name) {
441)     $modconfig[$name] = NULL;
442)     if (file_exists('modules/'.$name.'/module.info')) {
443)       $modconfig[$name] = parse_ini_file('modules/'.$name.'/module.info');
444)     }
445)   }
446)   return $modconfig;
447) }
448) 
449) 
bernd Neues Jabber-Modul (noch ni...

bernd authored 16 years ago

450)