fix insert. Forgot to add a ", ?" when adding gruppenfotoerlaubnis.
[fsinf/pub/w2c.git] / funcs.php
index 917705c987764951015ca10ec427e5e44abf60b3..6e4047fd47daa88f1074ee9880acff072729ee74 100644 (file)
--- a/funcs.php
+++ b/funcs.php
@@ -1,13 +1,12 @@
-<?php
-
+<?php define('FUNCS_PATH', __DIR__);
 /**
 * welcome.TU.code Anmeldesystem.
 * by Jan Vales <jan@jvales.net> (aka. Someone <someone@somenet.org>)
 */
 
-require_once('./settings.php');
-require_once('./db_funcs.php');
-require_once('./html_funcs.php');
+require_once(FUNCS_PATH.'/settings.php');
+require_once(FUNCS_PATH.'/db_funcs.php');
+require_once(FUNCS_PATH.'/html_funcs.php');
 
 function login(){
   if(!isset($_SERVER['HTTPS'])){
@@ -22,23 +21,23 @@ function login(){
   }else{
     header('WWW-Authenticate: Basic realm="WelcomeTUcode login"');
     header('HTTP/1.0 401 Unauthorized');
-    exit('Nicht eingeloggt. Falsche Anmeldedaten?');
+    exit(html_top("Anmeldesystem").html_linkbox().'<span class="statusERR">Nicht eingeloggt. Falsche Anmeldedaten?</span>'.html_bottom());
   }
 }
 
 function list_anmeldungen(){
   $liste = db_list_anmeldungen();
-  $ret = '<table border=1 class="sortable"><tr><th>Aktion</th><th>id</th><th>Anmeldung bei</th><th>Nachname(n)</th><th>Vorname(n)</th><th>Geboren</th>'.
-    '<th>Nationalität</th><th>Sprachkenntnis</th><th>Vorwissen</th><th>Analphabet</th><th>fotoerlaubnis</th><th>Videoerlaubnis</th>'.
-       '<th>Status</th><th>Bemerkung</th><th>Termin</th></tr>'."\n";
+  $ret = '<table id="sortable"><thead><tr><th>Aktion</th><th>id</th><th>Anmeldung bei</th><th>Nachname(n)</th><th>Vorname(n)</th><th>Geboren</th>'.
+    '<th>Nationalität</th><th>Sprachkenntnis</th><th>Vorwissen</th><th>Analphabet</th><th>Gruppen-</th><th>Foto-</th><th>Videoerlaubnis</th>'.
+       '<th>Status</th><th>Bemerkung</th><th>Termin</th></tr></thead><tbody>'."\n";
   foreach ($liste as &$person) {
     $ret .='<tr id="pers_'.$person['id'].'"><td><a href="./person.php?id='.$person['id'].'">Bearbeiten</a></td><td>'.$person['id'].'</td>';
        $ret .='<td>'.$person['uname'].'</td><td>'.$person['nname'].'</td><td>'.$person['vname'].'</td><td><nobr>'.$person['gebdatum'].'</nobr></td>';
        $ret .='<td>'.$person['nationaliaet'].'</td><td>'.$person['sprachen'].'</td><td>'.$person['vorwissen'].'</td><td>'.$person['analphabet'].'</td>';
-       $ret .='<td>'.$person['fotoerlaubnis'].'</td><td>'.$person['videoerlaubnis'].'</td><td>'.$person['status'].'</td><td>'.$person['bemerkungen'].'</td>';
-       $ret .='<td>'.$person['termin'].'</td></tr>'."\n";
+       $ret .='<td>'.$person['gruppenfotoerlaubnis'].'</td><td>'.$person['fotoerlaubnis'].'</td><td>'.$person['videoerlaubnis'].'</td>';
+    $ret .='<td>'.$person['status'].'</td><td>'.$person['bemerkungen'].'</td><td>'.$person['termin'].'</td></tr>'."\n";
   }
-  return $ret.'</table>'."\n";
+  return $ret.'</tbody></table>'."\n";
 }
 
 function store_person(){
@@ -75,6 +74,9 @@ function store_person(){
     if(!isset($_REQUEST['fotoerlaubnis']))$_REQUEST['fotoerlaubnis'] = '0';
     $pdata['fotoerlaubnis']=$_REQUEST['fotoerlaubnis'];
 
+    if(!isset($_REQUEST['gruppenfotoerlaubnis']))$_REQUEST['gruppenfotoerlaubnis'] = '0';
+    $pdata['gruppenfotoerlaubnis']=$_REQUEST['gruppenfotoerlaubnis'];
+
     if(!isset($_REQUEST['videoerlaubnis']))$_REQUEST['videoerlaubnis'] = '0';
     $pdata['videoerlaubnis']=$_REQUEST['videoerlaubnis'];