Beispiel #1
0
header("Pragma: no-cache");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
$user = new usersMenus();
if (!$user->AsSquidAdministrator) {
    $tpl = new templates();
    echo "alert('" . $tpl->javascript_parse_text("{ERROR_NO_PRIVS}") . ");";
    exit;
}
if (isset($_GET["popup"])) {
    popup();
    exit;
}
if (isset($_GET["request-order"])) {
    request_order();
    exit;
}
if (isset($_GET["savelicense"])) {
    savelicense();
    exit;
}
if (isset($_GET["delete-lic"])) {
    deletelic();
    exit;
}
js();
function js()
{
    $page = CurrentPageName();
    $tpl = new templates();
/**
 * routine runner
 *
 * @param string $compa coda, $configa!
 */
function routine($code, $config)
{
    global $oPOP, $oSMTP, $oMSG;
    extract($config);
    /* check if trh is enabled */
    if (empty($POP3_SERVER) || empty($SMTP_SERVER)) {
        return false;
    }
    print "Company Routine: {$code}\n";
    db_con("cubit_{$code}");
    /* check for requests/responses */
    $oPOP->reset();
    $oPOP->retrieveMessages($POP3_SERVER, 110, $POP3_USER, $POP3_PASS, false);
    /* loop through each message */
    while (($msg = $oPOP->enumGetMessage()) !== false) {
        /* process message, on failure continue with next message */
        if (!$oMSG->processMessage($msg)) {
            continue;
        }
        /* check subject for message type */
        if (!isset($oMSG->headers["Subject"])) {
            continue;
        }
        if (preg_match(REGEX_REQTYPE, $oMSG->headers["Subject"], $si)) {
            $key = $si[2];
            $req = $si[1];
            print "Key: {$key}\n";
            print "Req Type: {$req}\n";
            switch ($req) {
                /* new client request */
                case "reqkey":
                    print "entering request_new()\n";
                    $ret = request_new($key, $oMSG, $config);
                    break;
                    /* response to new request */
                /* response to new request */
                case "rspkey":
                    print "entering response_new()\n";
                    $ret = response_new($key, $oMSG, $config);
                    break;
                    /* request order */
                /* request order */
                case "reqpur":
                    print "entering request_order()\n";
                    $ret = request_order($key, $oMSG, $config);
                    break;
                    /* order response */
                /* order response */
                case "rsppur":
                    print "entering response_purchase()\n";
                    $ret = response_order($key, $oMSG, $config);
                    break;
                default:
                    print "invalid request type\n";
                    return false;
            }
        } else {
            print "Not matching: " . $oMSG->headers["Subject"] . "\n";
        }
    }
    return true;
}