Пример #1
0
<?php

if (!$Db->ID) {
    $nsProduct->Redir("db", "", "error");
}
if ($nsUser->Logged()) {
    ExtendUser();
}
if ($nsUser->Logged() && !$nsUser->ADMIN && !$nsUser->MERCHANT) {
    $nsUser->Logout();
    $nsProduct->Redir("login", "ac_err=1", "admin");
}
if ($nsProduct->STRT_INT == 0) {
    $Query = "UPDATE " . PFX . "_system_product SET STRT_INT = '" . time() . "' WHERE ID = " . $nsProduct->ID;
    $Db->Query($Query);
    TrialExceed();
}
if ($nsProduct->TRIAL_EXCEED) {
    $nsProduct->Redir("license", "EditId=new", "admin");
}
if (!$nsUser->Logged() && $nsProduct->Action != "login") {
    // user was not logged in, but wanted to open some page that required
    // authorization, we send the user to the login page and also pass
    // the login page our current URL so that after successful login the
    // user will be redirected where he intended to go
    $get = 'redirect=' . urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    $nsProduct->Redir('login', $get, 'admin');
}
if (ValidVar($_GP['RUpd'])) {
    $Logs->Msg($Lang['RecordUpdated']);
}
Пример #2
0
function GetCurrentLicense()
{
    // 1- trial, 2- client, 3- agent
    global $Db, $nsProduct, $BF;
    $MaxVersion = 0;
    $nsProduct->LC = array();
    $nsProduct->LICENSE = 1;
    $nsProduct->WHITE = false;
    //$nsProduct->MAX_CLIENTS=0;
    $nsProduct->MAX_SITES = 0;
    $nsProduct->TRIAL_EXCEED = false;
    $nsProduct->DAYS_LEFT = 0;
    $nsProduct->MAX_KEY_VERSION = 0;
    $Query = "SELECT * FROM " . PFX . "_tracker_license";
    $Sql = new Query($Query);
    while ($Row = $Sql->Row()) {
        $Row->KEY_DECODE = $BF->decrypt($Row->LICENSE_KEY);
        $Row->License = GetLicenseText($Row->KEY_DECODE);
        if (!$Row->License) {
            continue;
        }
        if ($nsProduct->MAX_KEY_VERSION < intval($Row->License['V'])) {
            $nsProduct->MAX_KEY_VERSION = intval($Row->License['V']);
        }
        if (CompareVersions($Row->License['V'], $nsProduct->VERSION, 1) != 0) {
            continue;
        }
        $Row->License['ID'] = intval(ValidVar($Row->License['ID']));
        $Row->License['L'] = intval(ValidVar($Row->License['L']));
        $Row->License['WL'] = intval(ValidVar($Row->License['WL']));
        if (ValidId($Row->License['L']) && $Row->License['L'] > 0) {
            $nsProduct->MAX_SITES += $Row->License['L'];
        }
        if (ValidVar($Row->License['WL']) == 1) {
            $nsProduct->WHITE = true;
        }
        if (isset($Row->License['P']) && $Row->License['P'] == 3) {
            $nsProduct->LICENSE = 3;
        }
        if (isset($Row->License['P']) && $Row->License['P'] == 2 && $nsProduct->LICENSE != 3) {
            $nsProduct->LICENSE = 2;
        }
        $nsProduct->LC[] = $Row;
    }
    if ($nsProduct->LICENSE == 1) {
        $nsProduct->MAX_SITES = 1;
        $nsProduct->WHITE = false;
        TrialExceed();
    }
    for ($i = 0; $i < count($nsProduct->LC); $i++) {
        $nsProduct->LC[$i]->KEY_DECODE = false;
        $nsProduct->LC[$i]->LICENSE_KEY = false;
    }
    $nsProduct->WHITE_ENABLE = false;
    $nsProduct->WHITE_POSSIBLE = false;
    $nsProduct->WHITE_NO_LOGO = false;
    $nsProduct->WHITE_NO_COPY = false;
    if ($nsProduct->WHITE) {
        $nsProduct->WHITE_POSSIBLE = true;
        $Check = $Db->Select("SELECT WHITE_NO_LOGO, WHITE_NO_COPY FROM " . PFX . "_tracker_config WHERE COMPANY_ID=0 AND SITE_ID=0");
        $nsProduct->WHITE_NO_LOGO = $Check->WHITE_NO_LOGO;
        $nsProduct->WHITE_NO_COPY = $Check->WHITE_NO_COPY;
    }
}