Example #1
0
<?php

if (!defined('SP_ENDUSER')) {
    die('File not included');
}
header('Content-type: text/plain');
$id = preg_replace('/[^0-9]/', '', $_GET['id']);
$nodeBackend = new NodeBackend($settings->getNode($_GET['node']));
$mail = $nodeBackend->getMailInQueue("queueid=" . $id, $errors);
if (!$mail) {
    die('No mail found');
}
$client = $nodeBackend->soap();
header('Content-Disposition: attachment; filename=' . $mail->msgid . '.txt');
$file = $mail->msgpath;
$read = 10000;
$offset = 0;
try {
    while (true) {
        $result = $client->fileRead(array('file' => $file, 'offset' => $offset, 'size' => $read));
        echo $result->data;
        flush();
        if ($result->size < $read) {
            break;
        }
        $offset = $result->offset;
    }
} catch (SoapFault $f) {
    echo "Error: " . $f->faultstring;
}
Example #2
0
    $mail = $dbBackend->getMail($id);
    if (!$mail) {
        die('Invalid mail');
    }
    // Resolv SOAP node
    $node = $settings->getNodeBySerial($mail->serialno);
    if (!$node) {
        die('Unable to find SOAP node');
    }
    $args = array('searchlog', '-a', $mail->msgts, '--', $mail->msgid);
} else {
    $node = $settings->getNode($_GET['node']);
    if (!$node) {
        die('Invalid mail');
    }
    $nodeBackend = new NodeBackend($node);
    if ($_GET['type'] == 'history') {
        $mail = $nodeBackend->getMailInHistory('historyid=' . $id, $errors);
    } else {
        $mail = $nodeBackend->getMailInQueue('queueid=' . $id, $errors);
    }
    if (!$mail || $errors) {
        die('Invalid mail');
    }
    $args = array('searchlog', '-a', $mail->msgts, '--', $mail->msgid . ':' . $id);
}
$client = $node->soap();
try {
    $cmd_id = $client->commandRun(array('argv' => $args));
} catch (Exception $e) {
    die('unable to start log');
Example #3
0
        } catch (SoapFault $f) {
            die($f->getMessage());
        }
    }
    header('Location: ' . $_SERVER['REQUEST_URI']);
    die;
}
$action_colors = array('DELIVER' => '#8c1', 'QUEUE' => '#1ad', 'QUARANTINE' => '#f70', 'REJECT' => '#ba0f4b', 'DELETE' => '#333', 'BOUNCE' => '#333', 'ERROR' => '#333', 'DEFER' => '#b5b');
$action_icons = array('DELIVER' => 'check', 'QUEUE' => 'exchange', 'QUARANTINE' => 'inbox', 'REJECT' => 'ban', 'DELETE' => 'trash-o', 'BOUNCE' => 'mail-reply', 'ERROR' => 'exclamation', 'DEFER' => 'clock-o');
function get_preview_link($m)
{
    return '?' . http_build_query(array('page' => 'preview', 'node' => $m['id'], 'id' => $m['data']->id, 'msgid' => $m['data']->msgid, 'msgactionid' => $m['data']->msgactionid, 'type' => $m['type']));
}
// Backends
$dbBackend = new DatabaseBackend($settings->getDatabase());
$nodeBackend = new NodeBackend($settings->getNodes());
// Default values
$search = isset($_GET['search']) ? hql_transform($_GET['search']) : '';
$size = isset($_GET['size']) ? intval($_GET['size']) : 50;
$size = $size > 5000 ? 5000 : $size;
$source = isset($_GET['source']) ? $_GET['source'] : $settings->getDefaultSource();
// Select box arrays
$pagesize = array(10, 50, 100, 500, 1000, 5000);
$sources = array();
if ($settings->getUseDatabaseLog()) {
    $sources += array('log' => 'Log');
}
if ($settings->getDisplayHistory()) {
    $sources += array('history' => 'History');
}
if ($nodeBackend->isValid() && $settings->getDisplayQueue()) {