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 02139, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
require_once("config.inc.php");
|
|
|
|
|
|
|
|
|
|
if( $_GET["pmdo"] == "reply" )
|
|
|
|
|
{
|
2018-08-04 15:49:43 +02:00
|
|
|
|
$result = mysqli_query($dbconn, "SELECT real_name FROM admin_users WHERE id = '$_GET[to]'") or die (mysqli_error($dbconn));
|
2018-08-04 11:33:52 +02:00
|
|
|
|
$row = mysqli_fetch_array($result);
|
2018-08-04 10:53:24 +02:00
|
|
|
|
eval ("\$message_field .= \"".gettemplate($template_dir."body_message_reply")."\";");
|
|
|
|
|
|
|
|
|
|
echo $message_field;
|
|
|
|
|
}
|
|
|
|
|
elseif( $_GET["pmdo"] == "doreply" )
|
|
|
|
|
{
|
2018-08-04 11:50:40 +02:00
|
|
|
|
$result = mysqli_query($dbconn, "INSERT INTO messages (userid_from, userid_to, message) VALUES ('$_SESSION[userid]', '$_REQUEST[userid_to]', '$_REQUEST[msg_text]')");
|
2018-08-04 15:49:43 +02:00
|
|
|
|
$result = mysqli_query($dbconn, "DELETE FROM messages WHERE id = '$_REQUEST[msg_id]'")or die(mysqli_error($dbconn));
|
2018-08-04 10:53:24 +02:00
|
|
|
|
|
|
|
|
|
echo gohome($_SERVER["PHP_SELF"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
elseif( $_GET["pmdo"] == "write" )
|
|
|
|
|
{
|
|
|
|
|
$select_msg_to = '
|
|
|
|
|
<select name="userid_to" id="userid_to">
|
2018-08-04 11:33:52 +02:00
|
|
|
|
<option value="0">Empf<EFBFBD>nger</option>
|
2018-08-04 10:53:24 +02:00
|
|
|
|
<option>--------------------</option>
|
|
|
|
|
<option value="0">Alle</option>';
|
|
|
|
|
|
2018-08-04 15:49:43 +02:00
|
|
|
|
$result = mysqli_query($dbconn, "SELECT id, real_name FROM admin_users WHERE pm_allow = '1' ORDER BY real_name ASC") or die (mysqli_error($dbconn));
|
2018-08-04 11:33:52 +02:00
|
|
|
|
while($row = mysqli_fetch_array($result))
|
2018-08-04 10:53:24 +02:00
|
|
|
|
{
|
|
|
|
|
if( $_GET["msg_to"] == $row["id"] ) { $selected = 'selected'; $can_pm = '1'; } else { $selected = ''; }
|
|
|
|
|
$select_msg_to .= '
|
|
|
|
|
<option value="'.$row["id"].'" '.$selected.'>'.$row["real_name"].'</option>
|
|
|
|
|
';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$select_msg_to .= '
|
|
|
|
|
</select>
|
|
|
|
|
';
|
|
|
|
|
|
|
|
|
|
if( $_GET["msg_to"] && empty($can_pm) )
|
|
|
|
|
{
|
|
|
|
|
// pm_allow ist auf 0
|
|
|
|
|
$message_field .= "<b><font color=\"red\"><br>Der User darf keine PM Empfangen/Senden</font></b><br><br>";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//pm_allow ist auf 1
|
|
|
|
|
eval ("\$message_field .= \"".gettemplate($template_dir."body_message_write")."\";");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo $message_field;
|
|
|
|
|
}
|
|
|
|
|
elseif( $_GET["pmdo"] == "dowrite" )
|
|
|
|
|
{
|
|
|
|
|
if( $_REQUEST["userid_to"] != '0' )
|
|
|
|
|
{
|
|
|
|
|
// an einen bestimmten User
|
2018-08-04 11:50:40 +02:00
|
|
|
|
$result = mysqli_query($dbconn, "INSERT INTO messages (userid_from, userid_to, message) VALUES ('$_SESSION[userid]', '$_REQUEST[userid_to]', '$_REQUEST[msg_text]')");
|
2018-08-04 10:53:24 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-08-04 11:33:52 +02:00
|
|
|
|
// an alle User die PM d<>rfen
|
2018-08-04 15:49:43 +02:00
|
|
|
|
$result = mysqli_query($dbconn, "SELECT id FROM admin_users WHERE pm_allow = '1'") or die (mysqli_error($dbconn));
|
2018-08-04 11:33:52 +02:00
|
|
|
|
while($row = mysqli_fetch_array($result))
|
2018-08-04 10:53:24 +02:00
|
|
|
|
{
|
2018-08-04 11:50:40 +02:00
|
|
|
|
$result_msg = mysqli_query($dbconn, "INSERT INTO messages (userid_from, userid_to, message) VALUES ('$_SESSION[userid]', '$row[id]', '$_REQUEST[msg_text]')");
|
2018-08-04 10:53:24 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo gohome($_SERVER["PHP_SELF"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
elseif( $_GET["pmdo"] == "deletepm" )
|
|
|
|
|
{
|
2018-08-04 15:49:43 +02:00
|
|
|
|
$result = mysqli_query($dbconn, "DELETE FROM messages WHERE id = '$_GET[msg_id]'")or die(mysqli_error($dbconn));
|
2018-08-04 10:53:24 +02:00
|
|
|
|
}
|
|
|
|
|
?>
|