Example #1
0
            die(json_encode(array_map(function ($str) {
                return str_replace("\r", "", $str);
            }, $result->result->item)));
        }
        die(json_encode(array()));
    }
    if ($_GET['action'] == 'stop') {
        $result = $client->commandStop(array('commandid' => $_GET['cmd_id']));
        die(json_encode(true));
    }
}
$id = preg_replace('/[^0-9]/', '', $_GET['id']);
if ($_GET['type'] == 'log') {
    // Fetch data from local SQL log
    $dbBackend = new DatabaseBackend($settings->getDatabase());
    $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);