!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/   drwxr-xr-x
Free 4.04 GB of 27.03 GB (14.93%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     view.rfc822.php (32.33 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/*
############################################################################
# DWmail
#      - version 4.0.1
#      - 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.
#
############################################################################
*/
require ("./includes/init.inc.php");
require (
"./includes/global.inc.php");
require (
"./includes/imap.inc.php");
require (
"./includes/rfc822.inc.php");
require (
"./includes/3rdparty/MIME/mimeDecode.inc.php");
require (
"./includes/functions.inc.php");
require (
"./includes/html.inc.php");
require (
"./includes/config.inc.php");

$MainSettings = new GlobalInit();
$TransIDEnabled = $MainSettings->INIGet('session.use_trans_sid');

session_cache_limiter($DefaultSessionCache);
session_start();

if (!
$_SESSION['DefaultLang']) {
    
$_SESSION['DefaultLang'] = $DefaultLang;
}
require (
"./lang/" . strip_tags(str_replace("..", "", trim($_SESSION['DefaultLang']))) . "/global.inc.php");
require (
"./lang/" . strip_tags(str_replace("..", "", trim($_SESSION['DefaultLang']))) . "/view.inc.php");
require (
"./lang/" . strip_tags(str_replace("..", "", trim($_SESSION['DefaultLang']))) . "/mailbox.inc.php");
@
setlocale(LC_TIME, $AvailLangs[$_SESSION['DefaultLang']]['locale']);

require (
"./includes/options.inc.php");

$id = intval(strip_tags($_GET['id']));
$pid = intval(strip_tags($_GET['pid']));
$folder = strip_tags($_GET['f']);
$folderencode = urlencode($folder);
$rr = strip_tags($_GET['rr']);
$switch = strip_tags($_GET['switch']);

if (
$_GET['f']) {
    
$_SESSION['folder'] = strip_tags(trim($_GET['f']));
}

if (isset(
$_GET['w']) && $_GET['w'] == 'popup') {
    
$prependheader = "popup_";
}
elseif (isset(
$_GET['w']) && $_GET['w'] == 'preview') {
    
$prependheader = "preview_";
}
else {
    
$prependheader = "";
}

if (isset(
$_GET['ap']) && $_GET['ap'] == 0) {
    
$eoptions['AutoPreview'] = $_GET['ap'];
    
$AutoPreview = 0;
    
$_SESSION['extoptions'] = serialize($eoptions);
    if (
$UseDatabase == 1) {
        
$MySQLUpdate = $MySQLConnection->DB_UpdatePrefs(serialize($eoptions), 'extended');
    }
}

if (
$switch == $lang['SView']['ViewHTML']) {
    
$HTMLemailmode = "1";
}
elseif (
$switch == $lang['SView']['ViewHTMLImages']) {
    
$HTMLemailmode = "5";
}
elseif (
$switch == $lang['SView']['ViewText']) {
    
$HTMLemailmode = "4";
}

// If you want to display the file type instead of file icons, set this to 0
$useattachmenticons = 1;

if (isset(
$HTMLemailmode)) {
    
$myoptions['HTMLemail'] = $HTMLemailmode;
    
$_SESSION['dwmailoptions'] = serialize($myoptions);
    if (
$UseDatabase == 1) {
        
$MySQLUpdate = $MySQLConnection->DB_UpdatePrefs(serialize($myoptions), 'standard');
    }
    else {
        if (
$AllowCookies == 1) {
            
$expiretime = 3600 * 8760;
            
setcookie ("dwmailoptions", serialize($myoptions), time()+$expiretime);
        }
    }
    
$HTMLemail = $HTMLemailmode;
}

$_SESSION['tpl'] = strip_tags(trim($_SESSION['tpl']));

$getFile = new fileProperties($_SESSION['tpl']);
$PageHeader = $getFile->fileRead($prependheader . 'header');
$PageFooter = $getFile->fileRead($prependheader . 'footer');
$PageCopyright = $getFile->fileRead('copyright');
$PageView = $getFile->fileRead('viewmessage');
$PageViewMenu = $getFile->fileRead('viewrfc822menu');
$PageMenu = $getFile->fileRead('menu');

$PageMenu = str_replace("[session]", $MainSettings->SessAppend_noecho($TransIDEnabled, 1), $PageMenu);
$PageMenu = str_replace("[session_append]", $MainSettings->SessAppend_noecho($TransIDEnabled, 0), $PageMenu);

$PageMenu = str_replace("[emailaddress]", $_SESSION['currentemailaddress'], $PageMenu);

$PageHeader = str_replace("[mainmenu]", $PageMenu, $PageHeader);
$PageHeader = str_replace("[header_refresh]", "", $PageHeader);
$PageHeader = str_replace("[charset]", $_SESSION['DefaultCharSet'], $PageHeader);
$PageHeader = str_replace("[lang]", $_SESSION['DefaultLang'], $PageHeader);
$PageHeader = str_replace("[langdir]", $AvailLangs[$_SESSION['DefaultLang']]['dir'], $PageHeader);
$PageHeader = str_replace("[pagetitle]", " - " . $lang['SView']['Title'], $PageHeader);
$PageFooter = str_replace("[mainmenu]", $PageMenu, $PageFooter);
$PageFooter = str_replace("[copyright]", $PageCopyright, $PageFooter);

if (
$AllowExternal == 1 && $UseDatabase == 1) {
    
$PageHeader = str_replace("[ifexternal]", "", $PageHeader);
    
$PageHeader = str_replace("[/ifexternal]", "", $PageHeader);
    
$PageFooter = str_replace("[ifexternal]", "", $PageFooter);
    
$PageFooter = str_replace("[/ifexternal]", "", $PageFooter);
}
else {
    
$PageHeader = preg_replace("/(\[)(ifexternal)(])(\r\n)*(.*)(\[\/ifexternal\])/siU", "", $PageHeader);
    
$PageFooter = preg_replace("/(\[)(ifexternal)(])(\r\n)*(.*)(\[\/ifexternal\])/siU", "", $PageFooter);
}

$genericerror = $getFile->fileRead('generic_message');
$genericerror = str_replace ('[pagetitle]', $lang['SErrors']['Title'], $genericerror);

$error_session = str_replace ('[pagemessage]', $lang['SErrors']['Session'], $genericerror);
CheckValidSession($_SESSION, $PageFooter, $error_session, $PageHeader, $lang);

$IMAPConnection = new WM_IMAPConnection($_SESSION);
$securitycheck = $IMAPConnection->WM_IMAPCheckSecurity();

$error_ipfailuresession = str_replace ('[pagemessage]', $lang['SErrors']['IP'], $genericerror);
CheckSessionSecurity($securitycheck, $PageFooter, $error_ipfailure, $PageHeader, $lang);

$mailbox = $IMAPConnection->WM_IMAPConnect();

checkmailbox_active($mailbox, $IMAPConnection, $PageHeader, $_SESSION['tpl'], $PageFooter, $getFile, $lang, $genericerror);

$IMAPConnection->WM_IMAPGetHeader($id);
$headerdetails = $IMAPConnection->WM_IMAPFullHeaders();

include (
"./includes/folderpane.inc.php");
$PageHeader = str_replace ("[folders]", $PageFolderPane, $PageHeader);
$PageHeader = LangReplace('Generic', $PageHeader, $lang);
$PageHeader = LangReplace('SFolderPane', $PageHeader, $lang);
$PageFooter = LangReplace('Generic', $PageFooter, $lang);
$PageFooter = LangReplace('SFolderPane', $PageFooter, $lang);

header ("Content-Type: text/html; charset=" . $_SESSION['DefaultCharSet']);
echo
$PageHeader;

$CodeSearch = array (
    
"[view_id]",
    
"[session]",
    
"[session_append]"
);

$CodeReplace = array (
    
$id,
    
$MainSettings->SessAppend_noecho($TransIDEnabled, 1),
    
$MainSettings->SessAppend_noecho($TransIDEnabled, 0)
);

$PageViewMenu = str_replace ($CodeSearch, $CodeReplace, $PageViewMenu);

$crlf = $MainSettings->GetCRLF();
$IMAPConnection->_crlf = $crlf;
$IMAPConnection->_charset = $_SESSION['DefaultCharSet'];

// Now this is where the file starts to substantially vary from view.php

$headerfull = $IMAPConnection->WM_IMAPRFCHeader($id);
$bodyfull = $IMAPConnection->WM_IMAPGetBody($id, -1, -1, 1);

$RFC822Message = new RFC822($_SESSION);
$RFC822Parts = $RFC822Message->GetParts($headerfull, $bodyfull);

$RFC822Content = $RFC822Parts[$pid];

$params['include_bodies'] = true;
$params['decode_bodies']  = true;
$params['decode_headers'] = true;

$RFCDecode = new Mail_mimeDecode($RFC822Content);
$ReturnMessage = $RFCDecode->decode($params);

// This is not yet designed to cope with a RFC822 message with another RFC822 message attached to it!
// i.e. a parent message with a message/rfc822 attachment which also contains a message/rfc822 attachment

// Find an importance header
if (strstr($RFC822Message->_RFCIndHeader, 'Importance:')) {
    
$header_arry = explode ("\n", $RFC822Message->_RFCIndHeader);
    
$line_number = 0;
    
$have_importance = 0;
    while (
$line = $header_arry[$line_number]) {
        
$line = trim($line);
        if (
strstr($line, "Importance:")) {
            
$importancelevel = str_replace ("Importance:", "", $line);
            
$importancelevel = trim($importancelevel);
            
$have_importance = 1;
        }
        
$line_number++;
    }
}

$PageView = preg_replace("/(\[)(ifflagged)(])(\r\n)*(.*)(\[\/ifflagged\])/siU", "", $PageView);
$PageView = preg_replace("/(\[)(ifreplied)(])(\r\n)*(.*)(\[\/ifreplied\])/siU", "", $PageView);

if (
strtolower($importancelevel) == "high") {
    
$importancegraphic = '<img src="templates/' . $_SESSION['tpl'] . '/images/mailbox/important.gif" alt="' . $lang['SMbox']['Importance'] . ': ' . $lang['SMbox']['ImportanceHigh'] . '" />';    
    
$importancetext = $lang['SMbox']['ImportanceHighDesc'];
}
elseif (
strtolower($importancelevel) == "low") {
    
$importancegraphic = '<img src="templates/' . $_SESSION['tpl'] . '/images/mailbox/low.gif" alt="' . $lang['SMbox']['Importance'] . ': ' . $lang['SMbox']['ImportanceLow'] . '" />';    
    
$importancetext = $lang['SMbox']['ImportanceLowDesc'];
}
elseif (
strtolower($importancelevel) == "normal") {
    
$have_importance = 0;
}
else {
    
$importancegraphic = '&nbsp;';    
}

if (
$have_importance == 1) {
    
$PageView = str_replace('[importance_icon]', $importancegraphic, $PageView);
    
$PageView = str_replace('[importance_message]', $importancetext, $PageView);
    
$PageView = str_replace('[ifimportance]', '', $PageView);
    
$PageView = str_replace('[/ifimportance]', '', $PageView);
}
else {
    
$PageView = preg_replace("/(\[)(ifimportance)(])(\r\n)*(.*)(\[\/ifimportance\])/siU", "", $PageView);
}

$PageView = preg_replace("/(\[)(ifcalendarerror)(])(\r\n)*(.*)(\[\/ifcalendarerror\])/siU", "", $PageView);

if (
sizeof($ReturnMessage->parts) >= 1) {
    
// Get Standard Attachments
    
$attachments = get_rfc_attachments($ReturnMessage);

    
// Get Inline/Embedded Attachments
    
$embeddedattachments = get_rfc_embeddedattachments($sections);

    
// All attachments (it's possible that embedded attachments could duplicate standard attachments 'if' the disposition of 'inline' is not set
    
if (is_array($attachments) && is_array($embeddedattachments)) {
        
$allattachments = array_merge($attachments, $embeddedattachments);
    }
    elseif (
is_array($embeddedattachments)) {
        
$allattachments = $embeddedattachments;
    }
    else {
        
$allattachments = $attachments;
    }
}

if (
$ReturnMessage->ctype_primary == 'multipart' && $ReturnMessage->ctype_secondary == 'mixed') {
    for (
$i=0; $i<sizeof ($ReturnMessage->parts); $i++) {
        if (
$ReturnMessage->parts[$i]->ctype_primary == 'multipart' && $ReturnMessage->parts[$i]->ctype_secondary == 'alternative') {
            for (
$j=0; $j<sizeof ($ReturnMessage->parts[$i]->parts); $j++) {
                if (
$ReturnMessage->parts[$i]->parts[$j]->ctype_primary == 'text' && $ReturnMessage->parts[$i]->parts[$j]->ctype_secondary == 'plain') {
                    
$message["text"] = $ReturnMessage->parts[$i]->parts[$j]->body;
                    
$message["text"] = nl2br(htmlspecialchars(stripslashes(trim($message["text"]))));
                    
                    if (
is_array($ReturnMessage->parts[$i]->parts[$j]->ctype_parameters)) {
                        foreach (
$ReturnMessage->parts[$i]->parts[$j]->ctype_parameters as $p2) {
                            
$charset["text"] = $p2;
                        }
                    }
                }
                elseif (
$ReturnMessage->parts[$i]->parts[$j]->ctype_primary == 'text' && $ReturnMessage->parts[$i]->parts[$j]->ctype_secondary == 'html') {
                    
$message["html"] = $ReturnMessage->parts[$i]->parts[$j]->body;
                    if (
is_array($ReturnMessage->parts[$i]->parts[$j]->ctype_parameters)) {
                        foreach (
$ReturnMessage->parts[$i]->parts[$j]->ctype_parameters as $p2) {
                            
$charset["html"] = $p2;
                        }
                    }
                }
            }
        }
        elseif (
$ReturnMessage->parts[$i]->ctype_primary == 'text' && $ReturnMessage->parts[$i]->ctype_secondary == 'plain') {
            
$message["text"] = $ReturnMessage->parts[$i]->body;
            
$message["text"] = nl2br(htmlspecialchars(stripslashes(trim($message["text"]))));
                    
            if (
is_array($ReturnMessage->parts[$i]->ctype_parameters)) {
                foreach (
$ReturnMessage->parts[$i]->ctype_parameters as $p2) {
                    
$charset["text"] = $p2;
                }
            }
        }
        elseif (
$ReturnMessage->parts[$i]->ctype_primary == 'text' && $ReturnMessage->parts[$i]->ctype_secondary == 'html') {
            
$message["html"] = $ReturnMessage->parts[$i]->body;
            if (
is_array($ReturnMessage->parts[$i]->ctype_parameters)) {
                foreach (
$ReturnMessage->parts[$i]->ctype_parameters as $p2) {
                    
$charset["html"] = $p2;
                }
            }
        }
    }
}
elseif (
$ReturnMessage->ctype_primary == 'multipart' && $ReturnMessage->ctype_secondary == 'alternative') {
    for (
$i=0; $i<sizeof ($ReturnMessage->parts); $i++) {
        if (
$ReturnMessage->parts[$i]->ctype_primary == 'text' && $ReturnMessage->parts[$i]->ctype_secondary == 'plain') {
            
$message["text"] = $ReturnMessage->parts[$i]->body;
            
$message["text"] = nl2br(htmlspecialchars(stripslashes(trim($message["text"]))));
            if (
is_array($ReturnMessage->parts[$i]->ctype_parameters)) {
                foreach (
$ReturnMessage->parts[$i]->ctype_parameters as $p2) {
                    
$charset["text"] = $p2;
                }
            }
        }
        elseif (
$ReturnMessage->parts[$i]->ctype_primary == 'text' && $ReturnMessage->parts[$i]->ctype_secondary == 'html') {
            
$message["html"] = $ReturnMessage->parts[$i]->body;
            if (
is_array($ReturnMessage->parts[$i]->ctype_parameters)) {
                foreach (
$ReturnMessage->parts[$i]->ctype_parameters as $p2) {
                    
$charset["html"] = $p2;
                }
            }
        }
    }
}

if (
is_array($message)) {
    if (isset(
$message["html"]) && ($HTMLemail == 1 || $HTMLemail == 5 || ($HTMLemail == 2 && !isset($message["text"])))) {
        
$content = $message["html"];
        
$charset = $charset["html"];
        
$view_styleformat = "view_html";
        if (
$HTMLemail == "5") {
            
$content = str_replace("src=", "removedsrc=", $content);
            
$PageView = preg_replace("/(\[)(ifhtml)(])(\r\n)*(.*)(\[\/ifhtml\])/siU", "", $PageView);
            
$PageView = preg_replace("/(\[)(iftext)(])(\r\n)*(.*)(\[\/iftext\])/siU", "", $PageView);
            
$PageView = str_replace('[ifhtmlnoimages]', '', $PageView);
            
$PageView = str_replace('[/ifhtmlnoimages]', '', $PageView);
        }
        else {
            
$PageView = preg_replace("/(\[)(ifhtmlnoimages)(])(\r\n)*(.*)(\[\/ifhtmlnoimages\])/siU", "", $PageView);
            
$PageView = preg_replace("/(\[)(iftext)(])(\r\n)*(.*)(\[\/iftext\])/siU", "", $PageView);
            
$PageView = str_replace('[ifhtml]', '', $PageView);
            
$PageView = str_replace('[/ifhtml]', '', $PageView);
        }
        
$CleanUpHTML = new HTMLCleanup($content);
        
$CleanUpHTML->ChangeTarget();
        
$CleanUpHTML->RemoveScripting();
        
$CleanUpHTML->RemoveMalicious();
        
$content = $CleanUpHTML->_body;
    }
    elseif ((isset(
$message["html"])) && (!isset($message["text"])) && ($HTMLemail == 4)) {
        
$content = parseLinks(strip_tags($message["html"]), 1, 0, $lang);
        
$charset = $charset["html"];
        
$view_styleformat = "view_text";
        
$PageView = preg_replace("/(\[)(ifhtmlnoimages)(])(\r\n)*(.*)(\[\/ifhtmlnoimages\])/siU", "", $PageView);
        
$PageView = preg_replace("/(\[)(ifhtml)(])(\r\n)*(.*)(\[\/ifhtml\])/siU", "", $PageView);
        
$PageView = str_replace('[iftext]', '', $PageView);
        
$PageView = str_replace('[/iftext]', '', $PageView);
    }
    else {
        
$content = parseLinks($message["text"], 1, 0, $lang);
        
$content = str_replace("\t", "&nbsp;&nbsp;", $content);
        
$charset = $charset["text"];
        
$view_styleformat = "view_text";
        if (isset(
$message["html"])) {
            
$PageView = preg_replace("/(\[)(ifhtmlnoimages)(])(\r\n)*(.*)(\[\/ifhtmlnoimages\])/siU", "", $PageView);
            
$PageView = preg_replace("/(\[)(ifhtml)(])(\r\n)*(.*)(\[\/ifhtml\])/siU", "", $PageView);
            
$PageView = str_replace('[iftext]', '', $PageView);
            
$PageView = str_replace('[/iftext]', '', $PageView);
        }
    }
}
else {
    if (
is_array($ReturnMessage->ctype_parameters)) {
        foreach (
$ReturnMessage->ctype_parameters as $p2) {
            
$charset = $p2;
        }
    }
    if ((
$ReturnMessage->ctype_primary == 'text' && $ReturnMessage->ctype_secondary == 'html') && ($HTMLemail == 1 || $HTMLemail == 2 || $HTMLemail == 5)) {
        
$content = $ReturnMessage->body;
        
$content = SeperateSignature($SeperateSignature, $content);
        
$content = $content;

        
$view_styleformat = "view_html";
        if (
$HTMLemail == "5") {
            
$content = str_replace("src=", "removedsrc=", $content);
            
$PageView = preg_replace("/(\[)(ifhtml)(])(\r\n)*(.*)(\[\/ifhtml\])/siU", "", $PageView);
            
$PageView = preg_replace("/(\[)(iftext)(])(\r\n)*(.*)(\[\/iftext\])/siU", "", $PageView);
            
$PageView = str_replace('[ifhtmlnoimages]', '', $PageView);
            
$PageView = str_replace('[/ifhtmlnoimages]', '', $PageView);
        }
        else {
            
$PageView = preg_replace("/(\[)(ifhtmlnoimages)(])(\r\n)*(.*)(\[\/ifhtmlnoimages\])/siU", "", $PageView);
            
$PageView = preg_replace("/(\[)(iftext)(])(\r\n)*(.*)(\[\/iftext\])/siU", "", $PageView);
            
$PageView = str_replace('[ifhtml]', '', $PageView);
            
$PageView = str_replace('[/ifhtml]', '', $PageView);
        }
        
$CleanUpHTML = new HTMLCleanup($content);
        
$CleanUpHTML->ChangeTarget();
        
$CleanUpHTML->RemoveScripting();
        
$CleanUpHTML->RemoveMalicious();
        
$content = $CleanUpHTML->_body;
    }
    elseif ((
$ReturnMessage->ctype_primary == 'text' && $ReturnMessage->ctype_secondary == 'html') && ($HTMLemail == 3)) {
        
$content = $ReturnMessage->body;
        
$content = htmlspecialchars(stripslashes(trim($content)));
        
$content = SeperateSignature($SeperateSignature, $content);
        
$content = nl2br($content);
        
$content = parseLinks($content, 1, 0, $lang);
        
$view_styleformat = "view_text";
        
$PageView = preg_replace("/(\[)(ifhtmlnoimages)(])(\r\n)*(.*)(\[\/ifhtmlnoimages\])/siU", "", $PageView);
        
$PageView = preg_replace("/(\[)(ifhtml)(])(\r\n)*(.*)(\[\/ifhtml\])/siU", "", $PageView);
        
$PageView = str_replace('[iftext]', '', $PageView);
        
$PageView = str_replace('[/iftext]', '', $PageView);
    }
    elseif ((
$ReturnMessage->ctype_primary == 'text' && $ReturnMessage->ctype_secondary == 'html') && ($HTMLemail == 4)) {
        
$content = $ReturnMessage->body;
        
$content = htmlspecialchars(strip_tags(stripslashes(trim($content))));
        
$content = SeperateSignature($SeperateSignature, $content);
        
$content = nl2br($content);
        
$content = parseLinks($content, 1, 0, $lang);
        
$view_styleformat = "view_text";
        
$PageView = preg_replace("/(\[)(ifhtmlnoimages)(])(\r\n)*(.*)(\[\/ifhtmlnoimages\])/siU", "", $PageView);
        
$PageView = preg_replace("/(\[)(ifhtml)(])(\r\n)*(.*)(\[\/ifhtml\])/siU", "", $PageView);
        
$PageView = str_replace('[iftext]', '', $PageView);
        
$PageView = str_replace('[/iftext]', '', $PageView);
    }
    else {
        
$content = $ReturnMessage->body;
        
$content = htmlspecialchars(stripslashes(trim($content)));
        
$content = str_replace("\t", "&nbsp;&nbsp;", $content);
        
$content = SeperateSignature($SeperateSignature, $content);
        
$content = nl2br($content);
        
$content = parseLinks($content, 1, 0, $lang);
        
$view_styleformat = "view_text";
    }
}

$PageView = preg_replace("/(\[)(ifhtmlnoimages)(])(\r\n)*(.*)(\[\/ifhtmlnoimages\])/siU", "", $PageView);
$PageView = preg_replace("/(\[)(iftext)(])(\r\n)*(.*)(\[\/iftext\])/siU", "", $PageView);
$PageView = preg_replace("/(\[)(ifhtml)(])(\r\n)*(.*)(\[\/ifhtml\])/siU", "", $PageView);


// Deal with this later!
// Attachment size displayed here is the size it takes in the email, not the download size (as attachments are binary encoded)
// The Attachment download page displays the final decoded file size

// Display attachments
if (is_array($allattachments)) {
while (list(
$key, $value) = each($allattachments)) {
    
$attachmentlink = "attachment.php?id=$id&amp;pid=$pid." . $key . "&amp;rfc=1&amp;f=" . $folderencode . $MainSettings->SessAppend_noecho($TransIDEnabled, 0);

    if (
$useattachmenticons == 1) {
        include_once (
"./includes/files.inc.php");
        
$icongra = attachmentIcons($allattachments[$key]->ctype_primary . '/' . $allattachments[$key]->ctype_secondary);
        
$attachmentdetails .= "<img alt=\"" . $allattachments[$key]->ctype_primary . "/" . $allattachments[$key]->ctype_secondary . "\" src=\"$icongra\" /> <a href=\"$attachmentlink\" title=\"" . $allattachments[$key]->ctype_primary . "/" . $allattachments[$key]->ctype_secondary . "\">";
    }
    else {
        
$attachmentdetails .= "<img alt=\"" . $lang['SView']['Attachment'] . "\" width=\"10\" height=\"13\" src=\"templates/" . $_SESSION['tpl'] . "/images/mailbox/attach.gif\" /> " . $allattachments[$key]->ctype_primary . "/" . $allattachments[$key]->ctype_secondary . " <a href=\"$attachmentlink\">";
    }
    if (isset(
$allattachments[$key]->ctype_parameters['name'])) {
        
$attachmentdetails .= $allattachments[$key]->ctype_parameters['name'];
    }
    else {
        if (isset(
$allattachments[$key]->ctype_parameters['description'])) {
            
$attachmentdetails .= $allattachments[$key]->ctype_parameters['description'];
        }
        else {
            
$attachmentdetails .= $lang['SView']['NoAttachmentName'];
        }
    }
    
$attachmentdetails .= " (" . ceil(strlen($allattachments[$key]->body)/1024). " Kb)</a><br />";
}
}

if (
$attachmentdetails == "") {
    
// Old 'No attachments' code displayed a 'none' instead of removing the header
    // $attachmentdetails = $lang['SView']['NoAttach'];
    
$PageView = preg_replace("/(\[)(ifattachments)(])(\r\n)*(.*)(\[\/ifattachments\])/siU", "", $PageView);
}
else {
    
$PageView = str_replace('[ifattachments]', '', $PageView);
    
$PageView = str_replace('[/ifattachments]', '', $PageView);
}

$nextprev = "<a href=\"view.php?id=" . $id . "&amp;f=" . $folderencode . $MainSettings->SessAppend_noecho($TransIDEnabled, 0) . "\">" . $lang['SView']['BackMess'] . "</a>";

// Find any embedded images and replace their ID in the body of the message so we can view them
if (is_array($embeddedattachments)) {
    if (
$_SERVER['HTTPS'] == "on") {
        
$currprot = 'https://';
    }
    else {
        
$currprot = 'http://';
    }
    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
        
if ($embeddedattachments[$x]["id"] <> '') {
            
$content = str_replace("cid:" . $embeddedattachments[$x]["id"], $currprot . $_SERVER['HTTP_HOST'] . str_replace("view.php", "attachment.php?submit=inline&amp;id=$id&amp;pid=" . $embeddedattachments[$x]["pid"]  . "&amp;" . strip_tags(SID), $_SERVER['PHP_SELF']), $content);
            
$embeddedattachments[$x]["displayinline"] = 0;
        }
        else {
            
$embeddedattachments[$x]["displayinline"] = 1;
        }
    }
}

// Save from address to addressbook button
if ($UseDatabase == 1) {
    
$from_array  = imap_rfc822_parse_adrlist($ReturnMessage->headers['from'], 'localhost');
    if ((
$from_array[0]->mailbox <> "") && ($from_array[0]->host <> "") && ($from_array[0]->host <> "localhost")) {
        
$urlenc_from_name = urlencode($from_array[0]->personal);
        
$urlenc_from_email = urlencode($from_array[0]->mailbox) . "@" . urlencode($from_array[0]->host);
        
$PageView = str_replace("[ifcontacts]", "", $PageView);
        
$PageView = str_replace("[/ifcontacts]", "", $PageView);
    }
    else {
        
$PageView = preg_replace("/(\[)(ifcontacts)(])(\r\n)*(.*)(\[\/ifcontacts\])/siU", "", $PageView);
    }
}
else {
    
$savelink = "";
    
$PageView = preg_replace("/(\[)(ifcontacts)(])(\r\n)*(.*)(\[\/ifcontacts\])/siU", "", $PageView);
}

if (
$AutoPreview == 1 && (is_array($attachments) || is_array($embeddedattachments))) {
    if (
$gdenable == 1 && $gddisable <> 1) {
        require(
"./includes/image.inc.php");
        
$autopreviewimage = $getFile->fileRead('viewpreviewimage_thumbs');
        
$autopreviewimages = $getFile->fileRead('viewautopreview_thumbs');
        
$gdimg = new GDImage();
        
$gdimg->imgSupport();
    }
    else {
        
$autopreviewimage = $getFile->fileRead('viewpreviewimage');
        
$autopreviewimages = $getFile->fileRead('viewautopreview');
    }
}
if (
$AutoPreview == 1 && is_array($attachments)) {
    for(
$x=0; $x<sizeof($attachments); $x++) {
        if (
$attachments[$x]["type"] == "image/jpeg" || $attachments[$x]["type"] == "image/pjpeg" || $attachments[$x]["type"] == "image/gif" || $attachments[$x]["type"] == "image/png") {
            
$imagetmp = $autopreviewimage;
            if (
$gdenable == 1 && $gdimg->_imgsupport == true && $gddisable <> 1) {
                
$imagetmp = str_replace("[preview_image]", "previewimage.php?id=$id&amp;pid=" . $attachments[$x]["pid"] . "&amp;f=" . $folderencode . "&amp;" . strip_tags(SID), $imagetmp);
            }
            else {
                
$imagetmp = str_replace("[preview_image]", "attachment.php?submit=inline&amp;id=$id&amp;pid=" . $attachments[$x]["pid"] . "&amp;f=" . $folderencode . "&amp;" . strip_tags(SID), $imagetmp);
            }
            
$imagetmp = str_replace("[preview_filename]", str_replace('"', "&quot;", $attachments[$x]["name"]), $imagetmp);
            
$imagetmp = str_replace("[preview_size]", ceil($attachments[$x]["size"]/1024). " Kb", $imagetmp);
            
$imagetmp = str_replace("[preview_id]", $id, $imagetmp);
            
$imagetmp = str_replace("[preview_pid]", $attachments[$x]["pid"], $imagetmp);
            
$imagetmp = str_replace("[preview_folder]", $folderencode, $imagetmp);
            
$imagetmp = str_replace("[session_append]", $MainSettings->SessAppend_noecho($TransIDEnabled, 0), $imagetmp);
            
$imagepreviews .= $imagetmp;
        }
    }
    if (
$imagepreviews <> "") {
        
$autopreviewimages = str_replace("[preview_images]", $imagepreviews, $autopreviewimages);
        
$autopreviewimages = str_replace("[current_querystring]", "?" . $_SERVER["QUERY_STRING"], $autopreviewimages);
    }
    else {
        
$autopreviewimages = "";
    }
}
elseif (
$AutoPreview == 1 && is_array($embeddedattachments)) {
    for(
$x=0; $x<sizeof($embeddedattachments); $x++) {
        if ((
$embeddedattachments[$x]["type"] == "image/jpeg" || $embeddedattachments[$x]["type"] == "image/pjpeg" || $embeddedattachments[$x]["type"] == "image/gif" || $embeddedattachments[$x]["type"] == "image/png") && $embeddedattachments[$x]["displayinline"] == 1) {
            
$imagetmp = $autopreviewimage;
            if (
$gdenable == 1 && $this->_imgsupport == true && $gddisable <> 1) {
                
$imagetmp = str_replace("[preview_image]", "previewimage.php?id=$id&amp;pid=" . $embeddedattachments[$x]["pid"] . "&amp;f=" . $folderencode . "&amp;" . strip_tags(SID), $imagetmp);
            }
            else {
                
$imagetmp = str_replace("[preview_image]", "attachment.php?submit=inline&amp;id=$id&amp;pid=" . $embeddedattachments[$x]["pid"] . "&amp;f=" . $folderencode . "&amp;" . strip_tags(SID), $imagetmp);
            }
            
$imagetmp = str_replace("[preview_filename]", str_replace('"', "&quot;", $embeddedattachments[$x]["name"]), $imagetmp);
            
$imagetmp = str_replace("[preview_size]", ceil($embeddedattachments[$x]["size"]/1024). " Kb", $imagetmp);
            
$imagetmp = str_replace("[preview_id]", $id, $imagetmp);
            
$imagetmp = str_replace("[preview_pid]", $embeddedattachments[$x]["pid"], $imagetmp);
            
$imagetmp = str_replace("[preview_folder]", $folderencode, $imagetmp);
            
$imagetmp = str_replace("[session_append]", $MainSettings->SessAppend_noecho($TransIDEnabled, 0), $imagetmp);
            
$imagepreviews .= $imagetmp;
        }
    }
    if (
$imagepreviews <> "") {
        
$autopreviewimages = str_replace("[preview_images]", $imagepreviews, $autopreviewimages);
        
$autopreviewimages = str_replace("[current_querystring]", "?" . $_SERVER["QUERY_STRING"], $autopreviewimages);
    }
    else {
        
$autopreviewimages = "";
    }
}
else {
    
$autopreviewimages = "";
}

if (
$headerdetails['ccaddress'] == '') {
    
$PageView = preg_replace("/(\[)(ifcc)(])(\r\n)*(.*)(\[\/ifcc\])/siU", "", $PageView);
}
else {
    
$PageView = str_replace('[ifcc]', '', $PageView);
    
$PageView = str_replace('[/ifcc]', '', $PageView);
}

if (
$headerdetails['bccaddress'] == '') {
    
$PageView = preg_replace("/(\[)(ifbcc)(])(\r\n)*(.*)(\[\/ifbcc\])/siU", "", $PageView);
}
else {
    
$PageView = str_replace('[ifbcc]', '', $PageView);
    
$PageView = str_replace('[/ifbcc]', '', $PageView);
}

$PageView = preg_replace("/(\[)(ifappointment)(])(\r\n)*(.*)(\[\/ifappointment\])/siU", "", $PageView);

$allowzip = 0;
if (
function_exists('gzcompress')) {
    
$allowzip = 1;
}

if (
$allowzip == 1) {
    
$PageView = str_replace("[ifzip]", "", $PageView);
    
$PageView = str_replace("[/ifzip]", "", $PageView);
}
else {
    
$PageView = preg_replace("/(\[)(ifzip)(])(\r\n)*(.*)(\[\/ifzip\])/siU", "", $PageView);
}

$localtime_date = DateToLocal($tz, $ReturnMessage->headers['date'], $DateFormattingFull);

if (
$charset == "") {
    
$charset = $_SESSION['DefaultCharSet'];
}

if (isset(
$ReturnMessage->headers['sender']) && $ReturnMessage->headers['sender'] <> $ReturnMessage->headers['from']) {
    
$view_from = parseLinks(htmlspecialchars($ReturnMessage->headers['sender']), 1, 1, $lang) . ' ' . $lang['SView']['Sender'] . ' ' . parseLinks(htmlspecialchars($ReturnMessage->headers['from']), 1, 1, $lang);
}
else {
    
$view_from = parseLinks(htmlspecialchars($ReturnMessage->headers['from']), 1, 1, $lang);
}

$CodeSearch = array (
    
"[view_from]",
    
"[view_to]",
    
"[view_cc]",
    
"[view_bcc]",
    
"[view_subject]",
    
"[view_date]",
    
"[view_messagedate]",
    
"[view_attachments]",
    
"[view_body]",
    
"[nextprev]",
    
"[view_menu]",
    
"[view_folder]",
    
"[view_styleformat]",
    
"[session_form]",
    
"[session_append]",
    
"[session_force]",
    
"[session]",
    
"[imap_move]",
    
"[view_fromname_urlencoded]",
    
"[view_fromemail_urlencoded]",
    
"[view_autopreview]",
    
"[view_id]",
    
"[view_partid]",
    
"[view]",
    
"[view_charset]"
);

$CodeReplace = array (
    
$view_from,
    
parseLinks(htmlspecialchars($ReturnMessage->headers['to']), 1, 1, $lang),
    
parseLinks(htmlspecialchars($ReturnMessage->headers['cc']), 1, 1, $lang),
    
parseLinks(htmlspecialchars($ReturnMessage->headers['bcc']), 1, 1, $lang),
    
$ReturnMessage->headers['subject'],
    
$localtime_date,
    
$ReturnMessage->headers['date'],
    
$attachmentdetails,
    
$content,
    
$nextprev,
    
$PageViewMenu,
    
urlencode($_SESSION['folder']),
    
$view_styleformat,
    
$MainSettings->SessAppend_form($TransIDEnabled),
    
$MainSettings->SessAppend_noecho($TransIDEnabled, 0),
    
"&amp;" . strip_tags(SID),
    
$MainSettings->SessAppend_noecho($TransIDEnabled, 1),
    
'',
    
$urlenc_from_name,
    
$urlenc_from_email,
    
$autopreviewimages,
    
$id,
    
$pid,
    
'view.rfc822',
    
$charset
);

$PageView = str_replace ($CodeSearch, $CodeReplace, $PageView);
$PageView = LangReplace('SView', $PageView, $lang);
echo
$PageView;

$IMAPConnection->WM_IMAPClose();

// Read Receipt popup code
if (($AllowReadReceipts == 1) && ($ask_receipt == 1) && ($rr <> 1)) {
    echo
$receiptjs;
}
if (
$rr == 1 && $AllowReadReceipts == 1) {
    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";
        }
        
$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";
        }
        
$to_array  = imap_rfc822_parse_adrlist($notemail, "localhost");
        if (
is_array($to_array)) {
        while(list(
$key,$val) = each($to_array)){
            if (
$val->mailbox <> "" && $val->host <> "") {
                
$smtpto = $SMTPConnection->WM_EnvelopeTO($val->mailbox . "@" . $val->host);
                if (!
$smtpto) {
                    
$smtperror[] = "Could not set to address";
                }
            }
        }
        }
        
// Build the email first
        
$sendemail = $IMAPConnection->WM_IMAPSendReceipt($notemail, $headerdetails['messageid'], $subj, $_SESSION['currentemailaddress'], 1, $headerdetails['date']);
    
        
// 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'] . $sendemail['message']);
        if (!
$emailsent) {
            
$smtperror[] = "Could not send data";
            
$emailsent = $smtperror;
        }

        
$smtpclose = $SMTPConnection->WM_SMTPClose();

    }
    else {
        
// Build the email first
        
$sendemail = $IMAPConnection->WM_IMAPSendReceipt($notemail, $headerdetails['messageid'], $subj, $_SESSION['currentemailaddress'], 0, $headerdetails['date']);

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

}
echo
$PageFooter;
?>

:: 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.0058 ]--