!C99Shell v. 1.0 pre-release build #16!

Software: Apache/2.0.54 (Fedora). PHP/5.0.4 

uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 

uid=48(apache) gid=48(apache) groups=48(apache)
context=system_u:system_r:httpd_sys_script_t
 

Safe-mode: OFF (not secure)

/home/mnnews/public_html/dwmail/includes/   drwxr-xr-x
Free 3.96 GB of 27.03 GB (14.65%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     compose.inc.php (24.39 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/*
############################################################################
# DWmail
#      - version 4.0.2
#      - Copyright (c) 2003-2006 Dominion Web Design
#      - http://www.dominion-web.com/products/dwmail/
############################################################################
#
# The contents of this file are subject to the DWmail License version
# 2.2 ('License'). You may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.dominion-web.com/products/dwmail/license.php

# Software distributed under the License is distributed on an "AS IS" basis,
# without warranty of any kind, either express or implied.
#
# This code is Copyright (c) 2003-2006 Dominion Web Design.
# All rights reserved.
#
# This software may not be redistributed outside the terms of the
# license agreement.
#
############################################################################
*/

// Check to see if form has been submitted first and if so process a send email request
if (!empty($_POST['submit']) || !empty($_POST['sendbutton']) || !empty($_POST['savedraft'])) {
    
// Page has been submitted as either a draft or as a send
    
$replyto = $MainSettings->CheckSlashes(trim($_POST['replyto']));
    
$replyto = str_replace("&quot;", '"', $replyto);
    
$to = $MainSettings->CheckSlashes(trim($_POST['to']));
    
$to = str_replace("&quot;", '"', $to);
    
$to = str_replace(";", ",", $to);
    
$cc = $MainSettings->CheckSlashes(trim($_POST['cc']));
    
$cc = str_replace("&quot;", '"', $cc);
    
$cc = str_replace(";", ",", $cc);
    
$bcc = $MainSettings->CheckSlashes(trim($_POST['bcc']));
    
$bcc = str_replace("&quot;", '"', $bcc);
    
$bcc = str_replace(";", ",", $bcc);
    
$alias = $MainSettings->CheckSlashes(trim(urldecode($_POST['alias'])));
    
$alias = str_replace("&quot;", '"', $alias);
    
$subject = $MainSettings->CheckSlashes(trim($_POST['subject']));
    
$subject = str_replace("&quot;", '"', $subject);
    
$subject = str_replace("<", '&lt;', $subject);
    
$subject = str_replace(">", '&gt;', $subject);
    
$body2 = $MainSettings->CheckSlashes(trim($_POST['body']));
    
$priority = $_POST['priority'];
    
$receipt = $_POST['receipt'];
    
$attacharry = $_SESSION['cafwd'];

    
$allowemail = 0;
    if (empty(
$_POST['ajaxdraft'])) {
        
$LastEmail = $MySQLConnection->DB_GetPrefs('lastemail');
        if (isset(
$LastEmail)) {
            if (
$LastEmail > $_SESSION['lastemail']) {
                
$_SESSION['lastemail'] = $LastEmail;
            }
        }

        if (!isset(
$_SESSION['lastemail'])) {
            
$_SESSION['lastemail'] = time();
            
$allowemail = 1;
        }
        else {
            if ((
time() - $_SESSION['lastemail']) >= $floodfilter) {
                
$_SESSION['lastemail'] = time();
                
$CheckUpdate = $MySQLConnection->DB_UpdatePrefs(time(), 'lastemail');
                
$allowemail = 1;
            }
        }
        unset (
$LastEmail);
    }
    else {
        
$allowemail = 1;
    }

    
$to_array  = imap_rfc822_parse_adrlist($to, $DefaultDomain);
    
$cc_array  = imap_rfc822_parse_adrlist($cc, $DefaultDomain);
    
$bcc_array  = imap_rfc822_parse_adrlist($bcc, $DefaultDomain);

    if (
$alias <> '') {
        
$alias_array  = imap_rfc822_parse_adrlist($alias, $DefaultDomain);

        unset (
$alias);
        if (
is_array($alias_array)) {
            if (
$alias_array[0]->personal <> "") {
                
$checkordname = $MIMEChecker->check8bit($alias_array[0]->personal);
                if (
$checkordname == TRUE) {
                    
$alias .= $MIMEChecker->RFCEncode($alias_array[0]->personal, $_SESSION['DefaultCharSet']) . " ";
                }
                else {
                    
$alias .= "\"" . $alias_array[0]->personal . "\" ";
                }
                unset (
$checkordname);
            }
            
$alias .= "<" . $alias_array[0]->mailbox . "@" . $alias_array[0]->host . ">";
        }
    }

    
$recipientarray = array_merge ($to_array, $cc_array, $bcc_array);
    
$recipientcount = count ($recipientarray);

    
// Flood check handler
    
if ($allowemail == 0 && empty($_POST['savedraft'])) {
        
$error_floodfilter = $lang['SCompose']['FloodFilter'];
        
$error_floodfilter = str_replace("[floodfilter]", $floodfilter, $error_floodfilter);
        
$errormessage = $error_floodfilter;
    }

    
// Maximum recipient handler
    
elseif ($recipientcount > $recipientmaximum && empty($_POST['savedraft'])) {
        
$errormessage = $lang['SCompose']['RecipientMaximum'];
        
$errormessage = str_replace("[recipientmaximum]", $recipientmaximum, $errormessage);
    }

    
// No recipients to email
    
elseif ($recipientcount == 0 && empty($_POST['savedraft'])) {
        
$errormessage = $lang['SCompose']['NoRecipients'];
    }

    else {

        
// Rebuild Email Addresses to RFC822 and RFC 2047 standards
        // Note if the personal name contains an @ and is not enclosed in quotes DWmail will generate an unexpected data error
        // We assume any email addresses taken from the database using GROUPS are already in RFC standards and so we won't re-parse through imap_rfc822_parse_adrlist()
        
unset ($to);
        if (
is_array($to_array)) {
            for(
$key=0; $key<sizeof($to_array); $key++) {
                if ((
$to_array[$key]->mailbox <> "" && substr($to_array[$key]->mailbox, 0, 6) <> "group:" && $to_array[$key]->host <> "") && ($to_array[$key]->mailbox <> "INVALID_ADDRESS" && $to_array[$key]->host <> ".SYNTAX-ERROR")) {
                    if (
$key <> 0) {
                        
$to .= ", ";
                    }
                    if (
$to_array[$key]->personal <> "") {
                        
$checkordname = $MIMEChecker->check8bit($to_array[$key]->personal);
                        if (
$checkordname == TRUE) {
                            
$to .= $MIMEChecker->RFCEncode($to_array[$key]->personal, $_SESSION['DefaultCharSet']) . " ";
                        }
                        else {
                            
$to .= "\"" . $to_array[$key]->personal . "\" ";
                        }
                        unset (
$checkordname);
                    }
                    
$to .= "<" . $to_array[$key]->mailbox . "@" . $to_array[$key]->host . ">";
                }
                elseif (
substr($to_array[$key]->mailbox, 0, 6) == "group:") {
                    
// We have found a group
                    // At the moment, unfortunately we assume that details parsed from the database are in valid RFC format
                    
$groupname = substr($to_array[$key]->mailbox, 6);
                    
$grouplisting = $MySQLConnection->DB_FindGroup($groupname);
                    if (
is_array($grouplisting)) {
                        while(list(
$key, $value) = each($grouplisting)) {
                            if (isset(
$to) && $to <> '') {
                                
$to .= ", ";
                            }
                            
$checkordname = $MIMEChecker->check8bit($grouplisting[$key]['firstname'] . ' ' . $grouplisting[$key]['lastname']);
                            if (
$checkordname == TRUE) {
                                
$to .= $MIMEChecker->RFCEncode($grouplisting[$key]['firstname'] . ' ' . $grouplisting[$key]['lastname'], $_SESSION['DefaultCharSet']) . " ";
                            }
                            else {
                                
$to .= "\"" . $grouplisting[$key]['firstname'] . " " . $grouplisting[$key]['lastname'] . "\" ";
                            }
                            
$to .= "<" . $grouplisting[$key]['email'] . ">";
                        }
                    }
                    else {
                        
// Group does not exist
                        
$errormessage = str_replace("[groupname]", $groupname, $lang['SContacts']['GroupSendError']);
                    }
                }
            }
        }
        
// Reset to array for SMTP sending
        
unset ($to_array);
        
$to_array  = imap_rfc822_parse_adrlist($to, $DefaultDomain);
        unset (
$cc);
        if (
is_array($cc_array)) {
            for(
$key=0; $key<sizeof($cc_array); $key++) {
                if ((
$cc_array[$key]->mailbox <> "" && substr($cc_array[$key]->mailbox, 0, 6) <> "group:" && $cc_array[$key]->host <> "") && ($cc_array[$key]->mailbox <> "INVALID_ADDRESS" && $cc_array[$key]->host <> ".SYNTAX-ERROR")) {
                    if (
$key <> 0) {
                        
$cc .= ", ";
                    }
                    if (
$cc_array[$key]->personal <> "") {
                        
$checkordname = $MIMEChecker->check8bit($cc_array[$key]->personal);
                        if (
$checkordname == TRUE) {
                            
$cc .= $MIMEChecker->RFCEncode($cc_array[$key]->personal, $_SESSION['DefaultCharSet']) . " ";
                        }
                        else {
                            
$cc .= "\"" . $cc_array[$key]->personal . "\" ";
                        }
                        unset (
$checkordname);
                    }
                    
$cc .= "<" . $cc_array[$key]->mailbox . "@" . $cc_array[$key]->host . ">";
                }
                elseif (
substr($cc_array[$key]->mailbox, 0, 6) == "group:") {
                    
// We have found a group
                    // At the moment, unfortunately we assume that details parsed from the database are in valid RFC format
                    
$groupname = substr($cc_array[$key]->mailbox, 6);
                    
$grouplisting = $MySQLConnection->DB_FindGroup($groupname);
                    if (
is_array($grouplisting)) {
                        while(list(
$key, $value) = each($grouplisting)) {
                            if (isset(
$cc) && $cc <> '') {
                                
$cc .= ", ";
                            }
                            
$checkordname = $MIMEChecker->check8bit($grouplisting[$key]['firstname'] . ' ' . $grouplisting[$key]['lastname']);
                            if (
$checkordname == TRUE) {
                                
$cc .= $MIMEChecker->RFCEncode($grouplisting[$key]['firstname'] . ' ' . $grouplisting[$key]['lastname'], $_SESSION['DefaultCharSet']) . " ";
                            }
                            else {
                                
$cc .= "\"" . $grouplisting[$key]['firstname'] . " " . $grouplisting[$key]['lastname'] . "\" ";
                            }
                            
$cc .= "<" . $grouplisting[$key]['email'] . ">";
                        }
                    }
                    else {
                        
// Group does not exist
                        
$errormessage = str_replace("[groupname]", $groupname, $lang['SContacts']['GroupSendError']);
                    }
                }
            }
        }
        
// Reset to array for SMTP sending
        
unset ($cc_array);
        
$cc_array  = imap_rfc822_parse_adrlist($cc, $DefaultDomain);
        unset (
$bcc);
        if (
is_array($bcc_array)) {
            for(
$key=0; $key<sizeof($bcc_array); $key++) {
                if ((
$bcc_array[$key]->mailbox <> "" && substr($bcc_array[$key]->mailbox, 0, 6) <> "group:" && $bcc_array[$key]->host <> "") && ($bcc_array[$key]->mailbox <> "INVALID_ADDRESS" && $bcc_array[$key]->host <> ".SYNTAX-ERROR")) {
                    if (
$key <> 0) {
                        
$bcc .= ", ";
                    }
                    if (
$bcc_array[$key]->personal <> "") {
                        
$checkordname = $MIMEChecker->check8bit($bcc_array[$key]->personal);
                        if (
$checkordname == TRUE) {
                            
$bcc .= $MIMEChecker->RFCEncode($bcc_array[$key]->personal, $_SESSION['DefaultCharSet']) . " ";
                        }
                        else {
                            
$bcc .= "\"" . $bcc_array[$key]->personal . "\" ";
                        }
                        unset (
$checkordname);
                    }
                    
$bcc .= "<" . $bcc_array[$key]->mailbox . "@" . $bcc_array[$key]->host . ">";
                }
                elseif (
substr($bcc_array[$key]->mailbox, 0, 6) == "group:") {
                    
// We have found a group
                    // At the moment, unfortunately we assume that details parsed from the database are in valid RFC format
                    
$groupname = substr($bcc_array[$key]->mailbox, 6);
                    
$grouplisting = $MySQLConnection->DB_FindGroup($groupname);
                    if (
is_array($grouplisting)) {
                        while(list(
$key, $value) = each($grouplisting)) {
                            if (isset(
$bcc) && $bcc <> '') {
                                
$bcc .= ", ";
                            }
                            
$checkordname = $MIMEChecker->check8bit($grouplisting[$key]['firstname'] . ' ' . $grouplisting[$key]['lastname']);
                            if (
$checkordname == TRUE) {
                                
$bcc .= $MIMEChecker->RFCEncode($grouplisting[$key]['firstname'] . ' ' . $grouplisting[$key]['lastname'], $_SESSION['DefaultCharSet']) . " ";
                            }
                            else {
                                
$bcc .= "\"" . $grouplisting[$key]['firstname'] . " " . $grouplisting[$key]['lastname'] . "\" ";
                            }
                            
$bcc .= "<" . $grouplisting[$key]['email'] . ">";
                        }
                    }
                    else {
                        
// Group does not exist
                        
$errormessage = str_replace("[groupname]", $groupname, $lang['SContacts']['GroupSendError']);
                    }
                }
            }
        }
        
// Reset to array for SMTP sending
        
unset ($bcc_array);
        
$bcc_array  = imap_rfc822_parse_adrlist($bcc, $DefaultDomain);

        
$recipientarray = array_merge ($to_array, $cc_array, $bcc_array);
        
$recipientcount = count ($recipientarray);

        
// Maximum recipient handler
        
if ($recipientcount > $recipientmaximum && empty($_POST['savedraft'])) {
            
$errormessage = $lang['SCompose']['RecipientMaximum'];
            
$errormessage = str_replace("[recipientmaximum]", $recipientmaximum, $errormessage);
        }

        if (
$AppendSignature == 1 && $_POST['edit'] <> "text") {
            
$PageSignature = $getFile->fileRead('signaturehtml');
            
$PageSignature = strip_tags($PageSignature, "<p><br><img><b><em><strong><i><a><u><ul><ol><li><font><span><div>");
            if (
$PageSignature == '') {
                
$PageSignature = parseLinks(nl2br($getFile->fileRead('signature')), 0);
            }
        }
        else {
            
$PageSignature = $getFile->fileRead('signature');
        }


        
// Append an administrator signature if necessary
        
if ($AppendSignature == 1 && empty($_POST['savedraft'])) {
            
$PageSignature = $crlf . $crlf . $PageSignature;
        }
        if (
$crlf == "\n") {
            
$body2 = str_replace("\r", "", $body2);
            
$PageSignature = str_replace("\r", "", $PageSignature);
        }

        if (
$_POST['edit'] <> "text") {
            
$PageSignature = "<br />" . $PageSignature;
            if (!empty(
$_POST['savedraft'])) {
                
// Don't set <html> or <body> in a draft message
                
$body2= $body2 . $PageSignature;
            }
            else {
                
$body2 = "<html><title>" . $subject . "</title><body>" . $body2 . $PageSignature . "</body></html>";
            }
        }
        else {
            
$body2 = $body2 . $PageSignature;
        }

        
// Handle forwarded attachments
        
if (is_array($attacharry)) {
            
$structure = $IMAPConnection->WM_IMAPGetStructure($_POST['msgid']);
            
$sections = parseBody($structure);
            
$x = 0;
            while(list(
$key, $value) = each($attacharry)) {
                
$whichsection = $attacharry[$key]['pid'];
                
settype($whichsection, "integer");

                for(
$i=0; $i<sizeof($sections); $i++) {
                    if(
$sections[$i]["pid"] == $whichsection) {
                        
$type = $sections[$i]["type"];
                        
$encoding = $sections[$i]["encoding"];
                        
$filename = $sections[$i]["name"];
                        
$size = $sections[$i]["size"];
                        
$description = $sections[$i]["description"];
                        
$disposition = $sections[$i]["disposition"];
                        
$cid = $sections[$i]["id"];
                    }
                }


                
$attachment = $IMAPConnection->WM_IMAPGetBody($_POST['msgid'], $whichsection, -1);
                
$finalfile = parseEncoding($attachment, $encoding);

                
$decodedsize = strlen($finalfile);
                
$preattachedfiles[$x]['size'] = $decodedsize;
                
$preattachedfiles[$x]['name'] = $filename;
                
$preattachedfiles[$x]['type'] = $type;
                
$preattachedfiles[$x]['contents'] = $finalfile;
                
$preattachedfiles[$x]['cid'] = $cid;
                
$preattachedfiles[$x]['disposition'] = $disposition;
                
$preattachedfiles[$x]['description'] = $description;
                
$x++;
            }

            
// Convert back inline images back to CID's so that they work in the final message again
            
$embeddedattachments = get_embeddedattachments($sections);
            if (
is_array($embeddedattachments)) {
                for(
$x=0; $x<sizeof($embeddedattachments); $x++) {
                    
// Note this calls the same file as attachment download but we must set submit=inline to allow display rather than download
                    
$body2 = str_replace("attachment.php?submit=inline&amp;id=" . $_POST['msgid'] . "&amp;pid=" . $embeddedattachments[$x]["pid"]  . "&amp;f=" . $_POST['f'] . "&amp;" . strip_tags(SID), "cid:" . $embeddedattachments[$x]["id"], $body2);
                    
$body2 = str_replace("attachment.php?submit=inline&id=" . $_POST['msgid'] . "&pid=" . $embeddedattachments[$x]["pid"]  . "&f=" . $_POST['f'] . "&" . strip_tags(SID), "cid:" . $embeddedattachments[$x]["id"], $body2);
                }
                
$body2 = str_replace("attachment.php?submit=inline", "", $body2);
                
$body2 = str_replace(strip_tags(SID), "", $body2);
            }
        }
        else {
            
$preattachedfiles = "";
        }

        
// Now deal with embedded attachments
        // Only scan jpeg and gif types to lower resources
        // This handles user added embedded images and NOT forwarded embedded images
        
if ($_SESSION['ca']) {
            for(
$i=0; $i<sizeof($_SESSION['ca']); $i++) {
                if (
$_SESSION['ca'][$i]['type'] == "image/jpeg" || $_SESSION['ca'][$i]['type'] == "image/pjpeg" || $_SESSION['ca'][$i]['type'] == "image/gif") {
                    if (
$_SERVER['HTTPS'] == "on") {
                        
$httpstatus = "https://";
                    }
                    else {
                        
$httpstatus = "http://";
                    }
                    
$pathtorender = str_replace ("compose.php", "renderimage.php", $_SERVER["REQUEST_URI"]);
                    
$findneedle = $httpstatus . $_SERVER["HTTP_HOST"] . $pathtorender . "?embedid=" . $i . "&amp;" . strip_tags(SID);
                    if (
strstr($body2, $findneedle)) {
                        
// Found an embedded image so first generate a content id
                        // Then replace the renderimage URL with the CID
                        
for($j=1; $j<=8; $j++) {
                            
$temprnd1 .= rand(0, 9);
                        }
                        for(
$j=1; $j<=4; $j++) {
                            
$temprnd2 .= rand(0, 9);
                        }
                        
$newcid = $i . $temprnd1 . '@' . date("dmY") . '-' . $temprnd2;
                        
$_SESSION['ca'][$i]['cid'] = $newcid;
                        
$body2 = str_replace($findneedle, 'cid:' . $newcid, $body2);
                        unset (
$newcid);
                        unset (
$temprnd1);
                        unset (
$temprnd2);
                    }
                }
            }
        }

        if (empty(
$errormessage)) {

        if (empty(
$_POST['submit']) && empty($_POST['sendbutton']) && !empty($_POST['savedraft'])) {
            
// This if/else routine is for saving drafts
            
$buildemail = $IMAPConnection->WM_IMAPBuildEmail($to, $cc, $bcc, $replyto, $subject, $body2, $_SESSION['ca'], $preattachedfiles, $AttachmentNumber, $_POST['edit'], $priority, $receipt, $_SESSION['currentemailaddress'], 0, $pname, $alias, '', $_POST['mid']);

            
$saveemail = $IMAPConnection->WM_IMAPSaveSent($CyrusIMAP, $UseSMTP, $IMAPDrafts, $IMAPSubscriptions, '\\Draft');

            if (empty(
$_POST['ajaxdraft'])) {
                if (
$_SESSION['fs'] == 1) {
                    echo (
"<html><body><script language=\"javascript\" type=\"text/javascript\">window.close();</script></body></html>");
                    exit;
                }
                else {
                    
header ('Location: ./mailbox.php?f=' . urlencode($IMAPDrafts) . '&' . strip_tags(SID));
                    exit;
                }
            }
        }

        if ((!empty(
$_POST['submit']) || !empty($_POST['sendbutton'])) && empty($_POST['savedraft'])) {
            
// This if/else routine is for sending emails

            // DWmail is in Local mode and is going to send using SMTP
            
if (($DWmailMode == 1) && ($UseSMTP == 1)) {
                require (
"./includes/smtp.inc.php");
                
$SMTPConnection = new WM_SMTPConnection($_SESSION);
                
$SMTPConnection->_helodomain = $HELOServerName;
                
$smtpconnect = $SMTPConnection->WM_SMTPConnect($DefaultSMTP);
                if (!
$smtpconnect) {
                    
$smtperror[] = "Failed to connect to SMTP server: $DefaultSMTP";
                }
                
$smtphelo = $SMTPConnection->WM_HELO();
                if (!
$smtphelo) {
                    
$smtperror[] = "HELO to SMTP server failed";
                }
                if (
$UseSMTPAuth == 1) {
                    
$smtpauth = $SMTPConnection->WM_SMTPAuth();
                    if (!
$smtpauth) {
                        
$smtperror[] = "Authentication to SMTP server failed";
                    }
                }
                
$smtpfrom = $SMTPConnection->WM_EnvelopeFROM($_SESSION['currentemailaddress']);
                if (!
$smtpfrom) {
                    
$smtperror[] = "Could not set From address";
                }
                if (
is_array($to_array)) {
                for(
$key=0; $key<sizeof($to_array); $key++) {
                    if ((
$to_array[$key]->mailbox <> "" && $to_array[$key]->host <> "") && ($to_array[$key]->mailbox <> "INVALID_ADDRESS" && $to_array[$key]->host <> ".SYNTAX-ERROR")) {
                        
$smtpto = $SMTPConnection->WM_EnvelopeTO($to_array[$key]->mailbox . "@" . $to_array[$key]->host);
                        if (!
$smtpto) {
                            
$smtperror[] = "Could not set To address";
                        }
                    }
                }
                }
                if (
is_array($cc_array)) {
                for(
$key=0; $key<sizeof($cc_array); $key++) {
                    if ((
$cc_array[$key]->mailbox <> "" && $cc_array[$key]->host <> "") && ($cc_array[$key]->mailbox <> "INVALID_ADDRESS" && $cc_array[$key]->host <> ".SYNTAX-ERROR")) {
                        
$smtpcc = $SMTPConnection->WM_EnvelopeTO($cc_array[$key]->mailbox . "@" . $cc_array[$key]->host);
                        if (!
$smtpcc) {
                            
$smtperror[] = "Could not set Cc address";
                        }
                    }
                }
                }
                if (
is_array($bcc_array)) {
                for(
$key=0; $key<sizeof($bcc_array); $key++) {
                    if ((
$bcc_array[$key]->mailbox <> "" && $bcc_array[$key]->host <> "") && ($bcc_array[$key]->mailbox <> "INVALID_ADDRESS" && $bcc_array[$key]->host <> ".SYNTAX-ERROR")) {
                        
$smtpbcc = $SMTPConnection->WM_EnvelopeTO($bcc_array[$key]->mailbox . "@" . $bcc_array[$key]->host);
                        if (!
$smtpbcc) {
                            
$smtperror[] = "Could not set Bcc address";
                        }
                    }
                }
                }

                
// Build the email first
                
$sendemail = $IMAPConnection->WM_IMAPBuildEmail($to, $cc, $bcc, $replyto, $subject, $body2, $_SESSION['ca'], $preattachedfiles, $AttachmentNumber, $_POST['edit'], $priority, $receipt, $_SESSION['currentemailaddress'], 1, $pname, $alias, '', $_POST['mid']);

                
// Make sure all new lines are \n and then force all \n to \r\n
                // to strip and bare line feeds (as SMTP will not allow this)
                
$sendemail['header'] = str_replace ("\r\n", "\n", $sendemail['header']);
                
$sendemail['header'] = str_replace ("\n", "\r\n", $sendemail['header']);

                
$sendemail['message'] = str_replace ("\r\n", "\n", $sendemail['message']);
                
$sendemail['message'] = str_replace ("\n", "\r\n", $sendemail['message']);

                
$emailsent = $SMTPConnection->WM_Data($sendemail['header'] . "\r\n" . $sendemail['message']);
                if (!
$emailsent) {
                    
$smtperror[] = "Could not send header and body of message";
                    
$emailsent = $smtperror;
                }

                
$smtpclose = $SMTPConnection->WM_SMTPClose();

                
// If you wish to see the SMTP communication logs then you can uncomment the next line (useful for debugging)
                // echo ($SMTPConnection->_smtplog);

            
}
            else {
                
// This section uses the imap_mail() command and not SMTP

                // Build the email first
                
$sendemail = $IMAPConnection->WM_IMAPBuildEmail($to, $cc, $bcc, $replyto, $subject, $body2, $_SESSION['ca'], $preattachedfiles, $AttachmentNumber, $_POST['edit'], $priority, $receipt, $_SESSION['currentemailaddress'], 0, $pname, $alias, '', $_POST['mid']);

                
// This bit actually calls the sendmail routine
                
$emailsent = $IMAPConnection->WM_IMAPSendMail($sendemail);
            }

            
$PageGenericMessage = $getFile->fileRead('generic_message');
            
$PageGenericMessage = str_replace("[pagetitle]", $lang['SCompose']['Title'], $PageGenericMessage);

            
// Check for errors and save if required
            
if ($emailsent == TRUE && !is_array($emailsent)) {
                
// Log successful sent mail
                
if ($StatsLogging == 1 && $UseDatabase == 1) {
                    
$LogSend = $MySQLConnection->DB_LogSend($recipientcount);
                }

                
// Delete from draft folder
                
if ($_SESSION['folder'] == $IMAPDrafts && !empty($id)) {
                    
$IMAPConnection->WM_IMAPDelete($id);
                    
$IMAPConnection->WM_IMAPExpungeMailbox();
                }

                
// Save email to sent mail folder
                
if ($_SESSION['fs'] == 1) {
                    
$returnmessage = $lang['SCompose']['Success'] . "<br /><br /><script language=\"javascript\" type=\"text/javascript\">window.close();</script>";
                }
                else {
                    
$returnmessage = $lang['SCompose']['Success'] . "<br /><br /><a href=\"mailbox.php?f=" . urlencode($_SESSION['folder']) . $MainSettings->SessAppend_noecho($TransIDEnabled, 0) . "\">" . $lang['Back'] . "</a>";
                }
                if ((
$_SESSION['servertype'] == "imap" || $_SESSION['servertype'] == "imapssl") && $_POST['savesent'] == 1) {
                    
$saveemail = $IMAPConnection->WM_IMAPSaveSent($CyrusIMAP, $UseSMTP, $IMAPSentMail, $IMAPSubscriptions);
                }

                
// Set the message headers to answered
                
if ($_POST['msgid']) {
                    
$SetAnswered = $IMAPConnection->WM_IMAPSetFlag("\\Answered", $_POST['msgid']);
                }

                
// Remove attachments from the session as the message was sent
                
unset($_SESSION['ca']);
                unset(
$_SESSION['cafwd']);

                
// Check whether to save recipients to addressbook
                
if ($_POST['saverecipients'] == 1 && $UseDatabase == 1) {
                    
// loop through $recipientarray
                    
if (is_array($recipientarray)) {
                        for(
$key=0; $key<sizeof($recipientarray); $key++) {
                            if ((
$recipientarray[$key]->mailbox <> "" && $recipientarray[$key]->host <> "") && ($recipientarray[$key]->mailbox <> "INVALID_ADDRESS" && $recipientarray[$key]->host <> ".SYNTAX-ERROR")) {
                                if (
$recipientarray[$key]->personal <> "") {
                                    
$submitteddetails['lastname'] = $recipientarray[$key]->personal;
                                }
                                else {
                                    
$submitteddetails['lastname'] = $recipientarray[$key]->mailbox . "@" . $recipientarray[$key]->host;
                                }
                                
$submitteddetails['email'] = $recipientarray[$key]->mailbox . "@" . $recipientarray[$key]->host;
                                if (
$MySQLMakeConnection) {
                                    
// Check if email is already in addressbook
                                    
$ab_check = $MySQLConnection->DB_EntryExist($submitteddetails['email']);
                                    if (!
$ab_check) {
                                        
$ab_addentry = $MySQLConnection->DB_NewEntry($submitteddetails);
                                    }
                                }
                            }
                        }
                    }
                
                }
            }
            else {
                if (
is_array($emailsent)) {
                    
$imapreturn = $lang['SErrors']['IMAPError'] . "'" . implode("<br />\n", $emailsent) . "'";
                }
                if (
$_SESSION['fs'] == 1) {
                    
$errormessage = $lang['SErrors']['IMAPError'] . " $imapreturn<br /><br />";
                }
                else {
                    
$errormessage = $lang['SErrors']['IMAPError'] . " $imapreturn<br /><br /><a href=\"mailbox.php?f=" . urlencode($_SESSION['folder']) . $MainSettings->SessAppend_noecho($TransIDEnabled, 0) . "\">" . $lang['Back'] . "</a>";
                }
            }
        }
        }

    }
}

?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0079 ]--