2018-08-04 10:53:24 +02:00
< ? php
/*
* PHP Frontend for pocsag monitor
*
* Copyright ( C ) 2004 - 2005
* Manuel Weiser ( manuelw @ fire - devils . org )
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 675 Mass Ave , Cambridge , MA 0213 9 , USA .
*/
require ( 'config.inc.php' );
$_SESSION [ " load_complete " ] = " " ;
$_SESSION [ " lastupdate " ] = " " ;
$_SESSION [ " online_users " ] = " " ;
/**************************/
// Seite zusammenstellen
//
//
// Startseite
if ( ! $_GET [ " do " ] )
{
2018-08-04 11:50:40 +02:00
$result = mysqli_query ( $dbconn , " SELECT a_alarmmail, a_alarmmail2sms, wap_pass, wap_show, wap_rows, wap_def_orgfilter, wap_def_statfilter FROM admin_users WHERE id = ' $_SESSION[userid] ' " ) or die ( mysqli_error ());
2018-08-04 11:33:52 +02:00
$row = mysqli_fetch_array ( $result );
2018-08-04 10:53:24 +02:00
$wap_pass = $row [ " wap_pass " ];
if ( $row [ " a_alarmmail2sms " ] == 1 ) $checked = 'checked' ;
$mailform_checkbox = '<input type="checkbox" name="mail2sms" value="1" ' . $checked . '>' ;
$mailform_mail = '<input name="alarmmail" type="text" id="alarmmail" value="' . $row [ " a_alarmmail " ] . '">' ;
$select_wap_show = '
< select name = " wap_show " id = " wap_show " >
< option value = " 0 " '; if( $row["wap_show"] == ' 0 ' ) $select_wap_show .= ' selected '; $select_wap_show .= ' > aktueller Tag </ option >
< option value = " 1 " '; if( $row["wap_show"] == ' 1 ' ) $select_wap_show .= ' selected '; $select_wap_show .= ' >& nbsp ; & nbsp ; 1 Stunde </ option >
< option value = " 6 " '; if( $row["wap_show"] == ' 6 ' ) $select_wap_show .= ' selected '; $select_wap_show .= ' >& nbsp ; & nbsp ; 6 Stunden </ option >
< option value = " 12 " '; if( $row["wap_show"] == ' 12 ' ) $select_wap_show .= ' selected '; $select_wap_show .= ' > 12 Stunden </ option >
< option value = " 18 " '; if( $row["wap_show"] == ' 18 ' ) $select_wap_show .= ' selected '; $select_wap_show .= ' > 18 Stunden </ option >
< option value = " 24 " '; if( $row["wap_show"] == ' 24 ' ) $select_wap_show .= ' selected '; $select_wap_show .= ' > 24 Stunden </ option >
< option value = " 48 " '; if( $row["wap_show"] == ' 48 ' ) $select_wap_show .= ' selected '; $select_wap_show .= ' > 48 Stunden </ option >
</ select >
' ;
$select_wap_rows = '
< select name = " wap_rows " id = " wap_rows " >
< option value = " 5 " '; if( $row["wap_rows"] == ' 5 ' ) $select_wap_rows .= ' selected '; $select_wap_rows .= ' >& nbsp ; & nbsp ; 5 Meldungen </ option >
< option value = " 10 " '; if( $row["wap_rows"] == ' 10 ' ) $select_wap_rows .= ' selected '; $select_wap_rows .= ' > 10 Meldungen </ option >
< option value = " 15 " '; if( $row["wap_rows"] == ' 15 ' ) $select_wap_rows .= ' selected '; $select_wap_rows .= ' > 15 Meldungen </ option >
< option value = " 20 " '; if( $row["wap_rows"] == ' 20 ' ) $select_wap_rows .= ' selected '; $select_wap_rows .= ' > 20 Meldungen </ option >
< option value = " 25 " '; if( $row["wap_rows"] == ' 25 ' ) $select_wap_rows .= ' selected '; $select_wap_rows .= ' > 25 Meldungen </ option >
< option value = " 30 " '; if( $row["wap_rows"] == ' 30 ' ) $select_wap_rows .= ' selected '; $select_wap_rows .= ' > 30 Meldungen </ option >
</ select >
' ;
$select_wap_orgfilter = '
< select name = " wap_orgfilter " id = " wap_orgfilter " >
< option value = " all " '; if( $row["wap_def_orgfilter"] == ' all ' ) $select_wap_orgfilter .= ' selected '; $select_wap_orgfilter .= ' > Alles </ option >
< option value = " ff " '; if( $row["wap_def_orgfilter"] == ' ff ' ) $select_wap_orgfilter .= ' selected '; $select_wap_orgfilter .= ' > Feuerwehr </ option >
< option value = " rd " '; if( $row["wap_def_orgfilter"] == ' rd ' ) $select_wap_orgfilter .= ' selected '; $select_wap_orgfilter .= ' > Rettungsdienst </ option >
</ select >
' ;
$select_wap_statfilter = '
< select name = " wap_statfilter " id = " wap_statfilter " >
< option value = " 0 " '; if( $row["wap_def_statfilter"] == ' 0 ' ) $select_wap_statfilter .= ' selected '; $select_wap_statfilter .= ' > Status aus </ option >
< option value = " 1 " '; if( $row["wap_def_statfilter"] == ' 1 ' ) $select_wap_statfilter .= ' selected '; $select_wap_statfilter .= ' > Status ein </ option >
</ select >
' ;
$select_search_ric = '
< select name = " search_ric " id = " search_ric " > '
;
2018-08-04 11:50:40 +02:00
$result = mysqli_query ( $dbconn , " SELECT id, org_name, org FROM organisation WHERE org != '' ORDER BY org ASC, org_name ASC " ) or die ( mysqli_error ());
2018-08-04 11:33:52 +02:00
while ( $row = mysqli_fetch_array ( $result ))
2018-08-04 10:53:24 +02:00
{
$select_search_ric .= '
< option value = " '. $row["id"] .' " > '.$row["org"].' & nbsp ; & nbsp ; '.$row["org_name"].' </ option >
' ;
}
$select_search_ric .= '
</ select >
' ;
2018-08-04 11:50:40 +02:00
$result = mysqli_query ( $dbconn , " SELECT a.*,
2018-08-04 10:53:24 +02:00
b . adresse , b . formatierung_id , b . bezeichnung , b . rec_typ ,
c . bg_farbe , c . text_farbe , c . text_format , c . text_groesse , c . text_groesse_text ,
d . org_name , d . org
FROM alarm2mail a
LEFT JOIN ric_zvei b ON b . adresse = a . adresse
LEFT JOIN formatierung c ON c . id = b . formatierung_id
LEFT JOIN organisation d ON d . id = b . org_id
2018-08-04 11:33:52 +02:00
WHERE a . userid = '$_SESSION[userid]' ORDER BY org ASC , org_name ASC , rec_typ ASC " ) or die (mysqli_error());
while ( $row = mysqli_fetch_array ( $result ))
2018-08-04 10:53:24 +02:00
{
// Zeitfunktion
if ( $row [ " time_from " ] == '0' && $row [ " time_to " ] == '0' )
{
$zeitfilter = 'immer' ;
}
else
{
$zeitfilter = time_format ( $row [ " time_from " ] ) . ' bis ' . time_format ( $row [ " time_to " ] ) . ' Uhr' ;
}
if ( ! empty ( $row [ " stiwo " ]) ) { $stiwo = " <span title= \" $row[stiwo] \" >Stiwo</span> " ; } else { $stiwo = " " ; }
$abos .= ' < tr >
< td bgcolor = " '. $row["bg_farbe"] .' " style = " border-bottom-style:solid;border-bottom-width:thin; " >< span style = " font-family:Verdana;color:'. $row["text_farbe"] .';font-size:'. $row["text_groesse"] .' px;font-weight:'. $row["text_format"] .' " >& nbsp ; '.$row["org"].' '.$row["org_name"].' '.$row["bezeichnung"].' - '.$row["rec_typ"].' </ span ></ td >
< td align = " center " bgcolor = " '. $row["bg_farbe"] .' " style = " border-bottom-style:solid;border-bottom-width:thin; " > '.$stiwo.' & nbsp ; </ td >
< td align = " center " bgcolor = " '. $row["bg_farbe"] .' " style = " border-bottom-style:solid;border-bottom-width:thin; " >< b > '.$zeitfilter.' </ b ></ td >
< td style = " border-bottom-style:solid;border-bottom-width:thin; " >& nbsp ; < a href = " '. $_SERVER["PHP_SELF"] .'?do=abodel&id='. $row["id"] .' " >& nbsp ; l & ouml ; schen </ a ></ td >
</ tr >
' ;
}
// Seiteninhalt ausgeben
eval ( " \$ page_middle .= \" " . gettemplate ( $template_dir . " body_profil_alarmmail " ) . " \" ; " );
}
2018-08-04 11:33:52 +02:00
// Ric zum Abo w<> hlen
2018-08-04 10:53:24 +02:00
elseif ( $_GET [ " do " ] == 'abodet' )
{
for ( $stunde = 0 ; $stunde <= 24 ; $stunde ++ )
{
$select_time_filter .= '
< option value = " '. $stunde .' " > '.$stunde.' : 00 </ option >
' ;
}
2018-08-04 11:50:40 +02:00
$result = mysqli_query ( $dbconn , " SELECT id, org_name, org FROM organisation WHERE id = ' $_REQUEST[search_ric] ' " ) or die ( mysqli_error ());
2018-08-04 11:33:52 +02:00
$row = mysqli_fetch_array ( $result );
2018-08-04 10:53:24 +02:00
$org_id = $row [ " id " ];
$org = $row [ " org " ];
$org_name = $row [ " org_name " ];
2018-08-04 11:50:40 +02:00
$result = mysqli_query ( $dbconn , " SELECT id, adresse, bezeichnung, rec_typ FROM ric_zvei WHERE org_id = ' $org_id ' " ) or die ( mysqli_error ());
2018-08-04 11:33:52 +02:00
while ( $row = mysqli_fetch_array ( $result ))
2018-08-04 10:53:24 +02:00
{
$select_ric .= '<input name="abo_ric[' . $i ++. ']" type="checkbox" value="' . $row [ " adresse " ] . '"> <b>' . $org . ' ' . $org_name . ' ' . $row [ " bezeichnung " ] . '</b> - ' . $row [ " rec_typ " ] . '<br>' ;
}
// Seiteninhalt ausgeben
eval ( " \$ page_middle .= \" " . gettemplate ( $template_dir . " body_profil_alarmmail_select " ) . " \" ; " );
}
// Abo eintragen
elseif ( $_GET [ " do " ] == 'aboins' )
{
foreach ( $_REQUEST [ " abo_ric " ] AS $v )
{
2018-08-04 11:33:52 +02:00
// pr<70> fen ob der User diese Ric bereits Abonniert hat
2018-08-04 11:50:40 +02:00
$result = mysqli_query ( $dbconn , " SELECT id FROM alarm2mail WHERE userid = ' $_SESSION[userid] ' AND adresse = ' $v ' " ) or die ( mysqli_error ());
2018-08-04 11:33:52 +02:00
$row = mysqli_fetch_array ( $result );
2018-08-04 10:53:24 +02:00
if ( empty ( $row [ " id " ]) )
{
2018-08-04 11:50:40 +02:00
$result = mysqli_query ( $dbconn , " INSERT INTO alarm2mail (adresse, userid, time_from, time_to, stiwo) VALUES (' $v ', ' $_SESSION[userid] ', ' $_REQUEST[alarm_time_filter_from] ', ' $_REQUEST[alarm_time_filter_to] ', ' $_REQUEST[alarm_stiwo] ') " ) or die ( mysqli_error ());
2018-08-04 10:53:24 +02:00
}
}
echo gohome ( $_SERVER [ " PHP_SELF " ]);
}
2018-08-04 11:33:52 +02:00
// Abo l<> schen
2018-08-04 10:53:24 +02:00
elseif ( $_GET [ " do " ] == 'abodel' )
{
2018-08-04 11:50:40 +02:00
$result = mysqli_query ( $dbconn , " DELETE FROM alarm2mail WHERE id = ' $_GET[id] ' AND userid = ' $_SESSION[userid] ' " ) or die ( mysqli_error ());
2018-08-04 10:53:24 +02:00
echo gohome ( $_SERVER [ " PHP_SELF " ]);
}
// Alarmmail Form setzen
elseif ( $_GET [ " do " ] == 'setmailform' )
{
if ( $_REQUEST [ " mail2sms " ] == 1 ) { $setto = 1 ; } else { $setto = 0 ; }
2018-08-04 11:50:40 +02:00
$result = mysqli_query ( $dbconn , " UPDATE admin_users SET a_alarmmail2sms=' $setto ', a_alarmmail=' $_REQUEST[alarmmail] ' WHERE id = ' $_SESSION[userid] ' " ) or die ( mysqli_error ());
2018-08-04 10:53:24 +02:00
echo gohome ( $_SERVER [ " PHP_SELF " ]);
}
// Wap Einstellungen speichern
elseif ( $_GET [ " do " ] == 'setwap' )
{
2018-08-04 11:50:40 +02:00
$result = mysqli_query ( $dbconn , " UPDATE admin_users SET wap_show=' $_REQUEST[wap_show] ', wap_rows=' $_REQUEST[wap_rows] ', wap_pass=' $_REQUEST[wap_pass] ', wap_def_orgfilter=' $_REQUEST[wap_orgfilter] ', wap_def_statfilter=' $_REQUEST[wap_statfilter] ' WHERE id = ' $_SESSION[userid] ' " ) or die ( mysqli_error ());
2018-08-04 10:53:24 +02:00
echo gohome ( $_SERVER [ " PHP_SELF " ]);
}
/**************************/
// Ausgabe Rahmen
//
eval ( " dooutput( \" " . gettemplate ( $template_dir . " rahmen " ) . " \" ); " );
/**************************/
// Datenbank schliessen
//
2018-08-04 11:33:52 +02:00
mysqli_close ( $dbconn );
2018-08-04 10:53:24 +02:00
?>