Example #1
0
 static function create($options)
 {
     if (isset($options->cache)) {
         $cache = $options->cache . 'cache.tmp';
         if ($www = fs::read($cache)) {
             $www = unserialize($www);
             $www->bind();
             return $www;
         } else {
             $www = new www($options);
             fs::write($cache, serialize($www));
             $www->bind();
             return $www;
         }
     } else {
         $www = new www($options);
         $www->bind();
         return $www;
     }
 }
Example #2
0
<?php

define('output', 'html');
require_once __DIR__ . '/../../core/core.php';
Req('class/current_queues.class.php', __DIR__);
$CQ = new current_queues($CFG->DB);
echo www::ScriptHead('Current Queues');
$T = new TBL();
$T = $T->Make($CQ->DB_Update);
echo www::Alt($T);
Example #3
0
 /**
  * Frame
  * -------------------------
  **/
 public function Frame()
 {
     $HTML[] = '<td width="100%">';
     $URL = 'http://' . $_SERVER['SERVER_ADDR'] . ':' . $this->CFG->mtaPort;
     $WEB = file_get_contents($URL);
     $WEB = str_ireplace('href="', 'href="' . $URL . '/', $WEB);
     $WEB = str_ireplace('src="logo.gif"', 'src="' . $URL . '/logo.gif"', $WEB);
     $WEB = str_ireplace("\n", '', $WEB);
     $WEB = str_ireplace("   ", '', $WEB);
     $WEB = www::ScriptHead('PowerMTA Status') . '<div class="alt">' . $WEB . '</div>';
     file_put_contents(DATA . 'status', $WEB);
     $HTML[] = '<iframe class="f" name="Frame" id="Frame" src="/data/status"></iframe>';
     $HTML[] = '</td>';
     $this->HTML($HTML);
 }
Example #4
0
            if (($value = $this->router->request(new http\request($uri, 'GET', $request->protocol, $get), $global)) !== null) {
                $result[$param] = $value;
            }
        }
        return $result;
    }
    private static function substitute($string, $vars)
    {
        $vars = new readonly((object) $vars);
        return preg_replace_callback('/\\{@([\\w\\.]+)\\}/', function ($matches) use($vars) {
            return $vars[$matches[1]];
        }, $string);
    }
    static $success;
    static $error;
    private $batch;
    private $schema;
    private $documentation;
    private $vars;
    private $schemas = [];
    private $resolve = null;
    private $router;
    private $dispatcher;
    private $encoders = [];
}
www::$success = function ($content) {
    return www::encode($content);
};
www::$error = function ($e) {
    return www::encode(['type' => $e->type, 'description' => $e->description, 'stacktrace' => $e->getTrace()]);
};
Example #5
0
<?php

require_once 'config.php';
require_once www_root . 'www.php';
try {
    $www = www::create('en', 'us');
    try {
        $xhtml = $www->request($_SERVER['REQUEST_URI'], $response);
        $response->flush();
        if ($xhtml) {
            echo $xhtml->render();
        }
    } catch (Exception $e) {
        echo '<pre>' . $e . '</pre>';
    }
} catch (Exception $e) {
    echo '<pre>' . $e . '</pre>';
}
# profiler::render();
Example #6
0
<?php

define('output', 'html');
require_once __DIR__ . '/../../core/core.php';
Req('queue_filler/class/queue_filler.class.php', APPS);
www::ScriptHead('PMTA Configuration Builder');
$QF = new queue_filler($CFG->DB, $argv);
Example #7
0
<?php

define('output', 'html');
require_once __DIR__ . '/../../core/core.php';
Req('server_stats/class/server_stats.class.php', APPS);
echo www::ScriptHead('Server Stats');
echo www::Btns(['Clear Logs', 'Pause Traffic']);
$_ = new STATS($CFG->DB);
Example #8
0
<?php

define('output', 'html');
require_once __DIR__ . '/../../core/core.php';
Req('class/logger.class.php', __DIR__);
$LOG = new logger($CFG);
echo www::ScriptHead('PMTA Accounting Logger');
echo www::Alt(Debug($LOG));
Example #9
0
<?php

define('output', 'html');
require_once __DIR__ . '/../../core/core.php';
Req('incoming_emails/class/incoming_emails.class.php', APPS);
echo www::ScriptHead('Incoming Email Reader');
$IE = new incoming_emails($CFG);
$EMAIL = file_get_contents(LOGS . 'apps/incoming_emails/last.msg');
$IE->ReadEmail($EMAIL);
$Headers = $IE->ShowHeaders();
$T = new TBL();
$T = $T->Make($Headers) . '<br><br>';
$Body = $IE->ShowParts();
$HTML = '<h1>' . $IE->Subject . '</h1>' . $T . $Body;
echo www::Alt($HTML);
Example #10
0
<?php

define('output', 'html');
require_once __DIR__ . '/../../core/core.php';
Req('class/telnet_tester.class.php', __DIR__);
echo www::ScriptHead('Telnet Tester');
if (!isset($_POST['ip'])) {
    $F = new FORMS('TelNetTest', 'Telnet Email Testing', false, 500);
    $F->Text('ip', ['IP Address' => false], false);
    $F->Text('ehlo', ['EHLO' => false], false);
    $F->Text('mailfrom', ['Mail From' => false], false);
    $F->Text('to', ['To' => false], false);
    $F->Text('from', ['From' => false], false);
    $F->Text('subject', ['Subject Line' => false], false);
    $F->write('<b style="padding:25px 0px 0px;">Additional Headers</b>');
    $F->Textarea('headers', false, false, 460, 100);
    $F->write('<b style="padding:25px 0px 0px;">Body</b>');
    $F->Textarea('body', false, false, 460, 250);
    $F->Button('TelNetTest', 'send test');
    $F->JS("\$('button#TelNetTest').click(function(){\n    var ip = \$('#ip').val();\n    var ehlo = \$('#ehlo').val();\n    var from = \$('#from').val();\n    var to = \$('#to').val();\n    var mailfrom = \$('#mailfrom').val();\n    var headers = \$('#headers').val();\n    var subject = \$('#subject').val();\n    var body = \$('#body').val();\n    \$('td#results').html('<h3>Working... Please Wait...</h3>');\n    \$.post(window.location.href,{ip:ip,ehlo:ehlo,from:from,to:to,mailfrom:mailfrom,headers:headers,body:body,subject:subject},function(data){\n      \$('td#results').html(data);\n    });\n  });");
    $F = $F->PrintForm();
    echo www::Alt("\n    <table>\n      <tr>\n        <td>" . $F . "</td>\n        <td id=\"results\"></td>\n\t    </tr>\n    </table>");
} else {
    $TNT = new TelNetTest($_POST);
    $TNT->SendMail();
}
Example #11
0
<?php

define('output', 'html');
require_once __DIR__ . '/../../core/core.php';
Req('config_writer/class/config_writer.class.php', APPS);
echo www::ScriptHead('PMTA Configuration Builder');
$CONFIG = new config_writer($CFG->DB);
$CONFIG = implode(LF, $CONFIG->Conf);
echo www::Btns(['Save', 'Edit', 'Upload']);
echo www::Alt(htmlspecialchars($CONFIG));
file_put_contents(DATA . 'config', $CONFIG);
exec('cp -f ' . DATA . 'config ' . DIR . '../');
Example #12
0
<?php

define('output', 'html');
require_once __DIR__ . '/../../core/core.php';
Req('adknowledge_injector/class/adknowledge_injector.class.php', APPS);
echo www::ScriptHead('Adknowledge Injector');
$INJECT = new adknowledge_injector($CFG->DB);
echo "<pre>";
print_r($INJECT);
echo "</pre>";
Example #13
0
<?php

define('output', 'html');
require_once __DIR__ . '/../../core/core.php';
Req('class/job_writer.class.php', __DIR__);
$JW = new job_writer($CFG);
echo www::ScriptHead('Job Writer');
echo www::Alt(implode('', $JW->ALERTS));
echo www::Alt(Debug($JW));