<script>
function mailDelete() {
var txt;
var r = confirm("<?PHP echo $resetM;?>");
if (r == true) {
txt = "";
window.open('messages-send-delxx.php', '_parent');
}
}
</script>

<div class="box-body">

<div class="padd-lr10">
<div class="box boxStyle2 infoBox margin-b15">
<div class="padd10t">

<table id="tableN" class="col-md-12">
<tr class='tabTop'>
<td colspan="2">

<?PHP 
define("DATA_FILE", "./../".$SYSD."/mails/mailing.inc.php");
extract($_POST);
$sendfrom=($_POST['sendfrom']);
$sendto=($_POST['sendto']);
$sendsubject=($_POST['sendsubject']);

if (isset($_POST['save'])) {
if (strlen(@$_POST[sendfrom])<=0){@$_POST[sendfrom]="";}
if (strlen(@$_POST[sendto])<=0){@$_POST[sendto]="";}
if (strlen(@$_POST[sendsubject])<=0){@$_POST[sendsubject]="";}
$Message=SaveData();}
else{
@die ("
<span class='resF'>".$resultFalseM."</span>
<br>
<br>
<a href='$ilink'>
<div class='vlinkS'>
<i class='hvL fa fa-arrow-circle-right padd-right5'></i>
<span class='hvS'>".$back1."</span>
</div>
</a>
");
return ($tag);
}

function SaveData(){
$tag='';
$patterns=array();
$replacements=array();
$content=file(DATA_FILE);
$t=chr(34);

$patterns[0]='/sendfrom=(.+?);/';
$patterns[1]='/sendto=(.+?);/';
$patterns[2]='/sendsubject=(.+?);/';

@$replacements[0]=sprintf("sendfrom=%s%s%s;",$t,$_POST[sendfrom],$t);
@$replacements[1]=sprintf("sendto=%s%s%s;",$t,$_POST[sendto],$t);
@$replacements[2]=sprintf("sendsubject=%s%s%s;",$t,$_POST[sendsubject],$t);

if ($fp=fopen(DATA_FILE,"w")){
$tag="<?PHP \n";
include("./../languages/$_COOKIE[xlanguage]/general.inc.php");
@print_r("<span class='resT'>".$resultTrueM."</span>");
fputs($fp,$tag,strlen($tag));
for ($i=1;$i < count($content);$i++){
$check=$content[$i];
$check=(preg_replace($patterns,$replacements,$check));
$check=preg_replace("/\r|\r/s", "\r", $check);
include("./../function/savecheck.inc.php");
if (strlen($check)> 0) $content[$i]=$check;
$line=sprintf('%s',$content[$i]);
fputs($fp,$line,strlen($line));
}
fclose($fp);
}
}

extract($_POST);
$editorLMs=($_POST['editorLMs']);

$saveMailing="./../".$SYSD."/mails/mailingtext.inc.php";
$handle=fopen($saveMailing, "w");
fwrite($handle,$editorLMs);
fclose($handle);
$oldumask = umask(0);
chmod($saveMailing, 0644);
umask($oldumask);

echo "
<br>
<br>
<u>".$messagedata9.":</u><br> 
".$messagedata8a.": ".$sendfrom."<br>
".$messagedata8b.": ".$sendto."<br>
<br>

<b>".$messagedata8c.": ".$sendsubject."</b><br>
<br>
";

include("./../".$SYSD."/mails/mailingtext.inc.php");

include("./../".$SYSD."/mails/mailing-signatur.inc.php");

echo "
<br>
<br>
<div>
<button onclick=\"window.location.href='$elink';\" class='btn form-btn3 font14'>".$messagedata5."</button> 
<button onclick=\"mailDelete()\" class='btn form-btn3 font14'>".$messagedata5d."</button> <span class='wbb'></span>
<button onclick=\"window.location.href='messages-send-save1.php';\" class='btn form-btn3 font14'>".$messagedata10."</button>
</div>
";
?>
</td>
</tr>

</table>
<div class="clearX box-footer"></div>
</div>
</div>
</div>

</div>
