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 .
*/
// Done in Haupttabelle updaten
2018-08-04 15:49:43 +02:00
$result_check_ins = mysqli_query ( $dbconn , " UPDATE dme SET zeit=' $row[zeit] ', done='1' WHERE num=' $row[num] ' " ) or die ( mysqli_error ( $dbconn ));
2018-08-04 10:53:24 +02:00
if ( trim ( $row [ " funktion " ]) != 'Klartext' && trim ( $row [ " funktion " ]) != 'Info' && $amenable == 1 )
{
2018-08-04 11:50:40 +02:00
$result_alarm_mail = mysqli_query ( $dbconn , " SELECT a.userid, a.time_from, a.time_to, a.stiwo, b.id, b.a_mail, b.a_alarmmail, b.a_alarmmail2sms, b.amail_count, b.ft_allow
2018-08-04 10:53:24 +02:00
FROM alarm2mail a
LEFT JOIN admin_users b ON b . id = a . userid
2018-08-04 15:49:43 +02:00
WHERE adresse = " . $row["adresse_neu"] ) or die(mysqli_error( $dbconn ));
2018-08-04 11:33:52 +02:00
while ( $row_alarm_mail = mysqli_fetch_array ( $result_alarm_mail ) )
2018-08-04 10:53:24 +02:00
{
// Alarmmail Counter
$amail_count = $row_alarm_mail [ " amail_count " ] + 1 ;
2018-08-04 11:33:52 +02:00
// schauen ob f<> r Alarm extra Mailadresse
2018-08-04 10:53:24 +02:00
if ( $row_alarm_mail [ " a_alarmmail " ] ) $row_alarm_mail [ " a_mail " ] = $row_alarm_mail [ " a_alarmmail " ];
// schauen ob Alarm im Zeitfenster liegt
if ( $row_alarm_mail [ " time_from " ] > $row_alarm_mail [ " time_to " ] ) $row_alarm_mail [ " time_to " ] = 24 + $row_alarm_mail [ " time_to " ];
// Stichwort checken
if ( empty ( $row_alarm_mail [ " stiwo " ]) ) { $stiwo_check = 'hit' ; }
else { $stiwo_check = check_stiwo ( $row_alarm_mail [ " stiwo " ], $row [ " text " ]); }
// Meldung im EMailformat senden
if ( $stiwo_check == 'hit' && $row_alarm_mail [ " a_alarmmail2sms " ] == '0' && ( $row_alarm_mail [ " time_from " ] == $row_alarm_mail [ " time_to " ] || ( $row_alarm_mail [ " time_from " ] <= get_hour ( get_time ( $row [ " zeit " ]) ) && $row_alarm_mail [ " time_to " ] > get_hour ( get_time ( $row [ " zeit " ]) ) ) ) )
{
// Mail normal senden
if ( $row_alarm_mail [ " ft_allow " ] == 1 )
{
// Wenn FullText erlaubt
2018-08-04 19:22:23 +02:00
mail_alarm ( get_date_long ( $row [ " zeit " ]), get_time ( $row [ " zeit " ]), $row_alarm_mail [ " a_mail " ], $row [ " org " ], $row [ " org_name " ], $row [ " bezeichnung " ], $row [ " text " ]);
2018-08-04 10:53:24 +02:00
}
else
{
// Wenn FullText erlaubt
mail_alarm ( get_date_long ( $row [ " zeit " ]), get_time ( $row [ " zeit " ]), $row_alarm_mail [ " a_mail " ], $row [ " org " ], $row [ " org_name " ], $row [ " bezeichnung " ], " Einsatzalarm " );
}
// Mailcounter
2018-08-04 11:50:40 +02:00
$result_counter = mysqli_query ( $dbconn , " UPDATE admin_users SET amail_count=' $amail_count ' WHERE id=' $row_alarm_mail[id] ' " );
2018-08-04 10:53:24 +02:00
}
// Meldung im SMSformat senden
if ( $stiwo_check == 'hit' && $row_alarm_mail [ " a_alarmmail2sms " ] == '1' && ( $row_alarm_mail [ " time_from " ] == $row_alarm_mail [ " time_to " ] || ( $row_alarm_mail [ " time_from " ] <= get_hour ( get_time ( $row [ " zeit " ]) ) && $row_alarm_mail [ " time_to " ] > get_hour ( get_time ( $row [ " zeit " ]) ) ) ) )
{
// Mail im SMS Format senden
if ( $row_alarm_mail [ " ft_allow " ] == 1 )
{
// Wenn FullText erlaubt
mail_alarm_sms ( get_date_long ( $row [ " zeit " ]), get_time ( $row [ " zeit " ]), $row_alarm_mail [ " a_mail " ], $row [ " org " ], $row [ " org_name " ], utf8_decode ( $row [ " text " ]));
}
else
{
// Wenn kein FullText erlaubt
mail_alarm_sms ( get_date_long ( $row [ " zeit " ]), get_time ( $row [ " zeit " ]), $row_alarm_mail [ " a_mail " ], $row [ " org " ], $row [ " org_name " ], " Einsatzalarm " );
}
// Mailcounter
2018-08-04 11:50:40 +02:00
$result_counter = mysqli_query ( $dbconn , " UPDATE admin_users SET amail_count=' $amail_count ' WHERE id=' $row_alarm_mail[id] ' " );
2018-08-04 10:53:24 +02:00
}
}
}
// Einsatzcounter updaten
if ( ( $row [ " zeit " ] - $row [ " last_alarm " ]) > 1000 )
{
$alarmcount = $row [ " alarm_count " ] + 1 ;
2018-08-04 15:49:43 +02:00
$result_check_ins = mysqli_query ( $dbconn , " UPDATE organisation SET alarm_count=' $alarmcount ', last_alarm=' $row[zeit] ' WHERE id=' $row[org_id] ' " ) or die ( mysqli_error ( $dbconn ));
2018-08-04 10:53:24 +02:00
}
?>