// All rights reserved.
This script is part of PHPWCMS. The PHPWCMS web content management system 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.
The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
A copy is found in the textfile GPL.txt and important notices to the license
from the author is found in LICENSE.txt distributed with these scripts.
This script 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.
This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------
$msg_send_ok = 0;
$msg_subject = '';
$msg_message = '';
$msg = 0;
$msg_err = '';
//If this should be a replay to another mail
if(isset($_GET["msg"]) && intval($_GET["msg"]) && empty($_POST['msg_send_aktion'])) {
list($msg, $msg_read) = explode(":", $_GET["msg"]);
$msg = intval($msg);
if($msg_read == "I" && $msg) { //Wenn die Nachricht noch den Status Unread hat, setzen auf read
$sql = "UPDATE ".DB_PREPEND."phpwcms_message SET ".
"msg_tstamp=msg_tstamp, msg_read=1 WHERE ".
"msg_uid=".$_SESSION["wcs_user_id"]." AND ".
"msg_id=".$msg.";";
mysql_query($sql, $db) or die("error");
}
if($msg) {
$sql = "SELECT *, DATE_FORMAT(phpwcms_message.msg_tstamp, '%b %e, %Y (%H:%i)') AS send_date ".
"FROM ".DB_PREPEND."phpwcms_message INNER JOIN ".DB_PREPEND."phpwcms_user ON ".
DB_PREPEND."phpwcms_message.msg_from=".DB_PREPEND."phpwcms_user.usr_id WHERE ".DB_PREPEND."phpwcms_message.msg_uid=".$_SESSION["wcs_user_id"].
" AND ".DB_PREPEND."phpwcms_message.msg_id=".$msg." LIMIT 1;";
if($result = mysql_query($sql, $db)) {
if($msgdetail = mysql_fetch_array($result)) {
$msg_subject = $BL['be_msg_RE'].": ".$msgdetail["msg_subject"];
$msg_message = "\n\n----[".$BL['be_msg_by']." ".$msgdetail["usr_name"].
" ".$BL['be_msg_on']." ".$msgdetail["send_date"]."]----\n".
$BL['be_msg_subject'].": ".$msgdetail["msg_subject"].
"\n".$BL['be_msg_msg'].": ".$msgdetail["msg_text"];
$msg_to = $msgdetail["msg_from"];
$msg_pid = $msg;
}
}
}
}
//Get signature value of user
if($result = mysql_query( "SELECT detail_signature FROM ".DB_PREPEND."phpwcms_userdetail WHERE detail_pid=".
$_SESSION["wcs_user_id"]." LIMIT 1;") ) {
if($row = mysql_fetch_row($result)) {
if(trim($row[0])) $msg_message = "\n\n\t\n".$row[0].$msg_message;
}
}
if(isset($_POST['msg_send_aktion']) && intval($_POST['msg_send_aktion'])) {
$msg_subject = strip_tags(slweg(trim($_POST["msg_send_subject"])));
$msg_message = strip_tags(slweg($_POST["msg_send_msg"]));
$msg_to = slweg(trim($_POST["msg_send_receiver"]));
$msg_pid = intval($_POST['msg_send_pid']);
if(isEmpty($msg_to)) {
$msg_err .= "- ".$BL['be_msg_err1']."\n";
}
if(isEmpty($msg_subject)) {
$msg_err .= "- ".$BL['be_msg_err2']."\n";
}
if(isEmpty($msg_message)) {
$msg_err .= "- ".$BL['be_msg_err3']."\n";
}
if(isEmpty($msg_err)) {
//send message routine
$msg_receivers = explode(":", $msg_to);
foreach($msg_receivers as $value) {
$sql = "INSERT INTO ".DB_PREPEND."phpwcms_message (".
"msg_pid, msg_uid, msg_subject, msg_text, msg_to, msg_from) VALUES (".
$msg_pid.",".
intval($value).",'".
aporeplace($msg_subject)."','".
aporeplace($msg_message)."','".
aporeplace($msg_to)."',".
$_SESSION["wcs_user_id"].
");";
mysql_query($sql, $db) or die("Error while sending message");
}
$msg_send_ok = 1;
}
}
if($msg_send_ok) {
echo "".$BL['be_msg_sent']."
";
echo $BL['be_msg_fwd']."
".$BL['be_msg_create'].".";
$forward_to_message_center = 1;
} else { //Mitteilungszusammenstellung
?>