function Set40Mode() { $Query = "SELECT VERSION() as VERSION"; $res = @mysql_query($Query); $Version = @mysql_fetch_object($res); if (CompareVersions($Version->VERSION, "4.1") == 1) { @mysql_query("SET SESSION sql_mode='MYSQL40' "); } }
function UpdatesAvailable() { global $nsProduct; $Avail = 0; $Necessary = false; $D = @opendir(SELF . "/update"); while (($Row = @readdir($D)) !== false) { if ($Row == ".." || $Row == "." || $Row == "CVS") { continue; } if (CompareVersions($Row, $nsProduct->VERSION) < 1) { continue; } $Necessary = true; $Avail++; } @closedir($D); if ($Necessary) { $nsProduct->Redir("update", "", "admin"); } return $Avail; }
function SetMysql40Mode() { $Version = $this->ReturnValue("SELECT VERSION()"); $this->Version = $Version; if (CompareVersions($Version, "4.1") == 1) { $this->Query(" SET SESSION sql_mode='MYSQL40' "); } }
$UseRedir = true; $Done = ValidVar($_REQUEST['Done']) ? $_REQUEST['Done'] : false; $Run = ValidVar($_REQUEST['Run']) ? $_REQUEST['Run'] : false; $NoHands = ValidVar($_REQUEST['NoHands']) ? $_REQUEST['NoHands'] : false; $Silent = ValidVar($_REQUEST['Silent']) ? true : false; ///////////////////////////////////////////// ///////// call any process functions $D = @opendir(SELF . "/update"); while (($Row = @readdir($D)) !== false) { if ($Row == ".." || $Row == "." || $Row == "CVS") { continue; } if (CompareVersions($Row, $nsProduct->VERSION) < 1) { continue; } if (CompareVersions($Row, $nsProduct->VERSION, 1) == 1 && $nsProduct->LICENSE != 1) { $Logs->Alert($Lang['NextVersionKey']); } $UpdateDescr[$Row] = ""; $DescrFile = "{$Row}." . $nsLang->CurrentLang . ".html"; if (@file_exists(SELF . "/update/{$Row}/{$DescrFile}")) { $UpdateDescr[$Row] = ReadFileData(SELF . "/update/{$Row}/{$DescrFile}"); } elseif (@file_exists(SELF . "/update/{$Row}/{$Row}.html")) { $UpdateDescr[$Row] = ReadFileData(SELF . "/update/{$Row}/{$Row}.html"); } $UpdatesArr[] = $Row; } @closedir($D); if (count($UpdatesArr) > 0) { sort($UpdatesArr); $UpdatesAvail = count($UpdatesArr);
$nsLang->TplInc("inc/user_welcome"); $ProgPath[0]['Name'] = $Lang['Administr']; $ProgPath[0]['Url'] = getURL("admin", "", "admin"); $ProgPath[1]['Name'] = $Lang['Title']; $ProgPath[1]['Url'] = getURL("versioncheck", "", "admin"); $MenuSection = "admin"; $ConnectionFailed = false; $NewVersion = CheckForNewVersion(); if (!$ConnectionFailed) { if (CompareVersions($NewVersion, $nsProduct->VERSION) == 1) { $Logs->Msg("<span style=\"font-size:14px;color:#000000;font-weight:bold;font-family:Arial;\">" . $Lang['LatestVersion'] . $NewVersion . "</span><br>" . $Lang['NewVersionAvail']); } if (CompareVersions($NewVersion, $nsProduct->VERSION) == -1) { $Logs->Err($Lang['Fun']); } if (CompareVersions($NewVersion, $nsProduct->VERSION) == 0) { $Logs->Msg($Lang['NoNew']); } } ///////////////////////////////////////////// ///////// call any process functions ///////////////////////////////////////////// ///////// display section here include $nsTemplate->Inc(); ///////////////////////////////////////////// ///////// process functions here ///////////////////////////////////////////// ///////// library section function CheckForNewVersion() { global $nsProduct, $Logs, $Lang, $_SERVER, $ConnectionFailed;
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; } }
function GeneratePackages($dir) { if (($debs = glob($dir . "/*.deb")) === false) { return false; } $packages = array(); foreach ($debs as $deb) { if (($control = GetPkgInfo($deb)) === false) { continue; } if (!isset($packages[$control['Package']])) { $packages[$control['Package']] = $control; } else { // Compare version numbers if (CompareVersions($control['Version'], $packages[$control['Package']]['Version']) > 0) { $packages[$control['Package']] = $control; } } } $packages_string = ""; foreach ($packages as $info) { foreach ($info as $fieldname => $value) { $packages_string .= $fieldname . ": " . $value . "\n"; } $packages_string .= "\n"; } return $packages_string; }
function AddNewKey($Key) { global $Db, $nsProduct, $BF, $Logs, $Lang; $Key = str_replace("\n", "", $Key); $KEY_DECODE = $BF->decrypt($Key); $License = GetLicenseText($KEY_DECODE); if (!$License) { $Logs->Err($Lang['KeyHasNoInfo']); return; } if ($nsProduct->LICENSE == 1 && !isset($License['P'])) { $Logs->Err($Lang['SecondaryKeyErr']); return; } $KeyId = intval(ValidVar($License['ID'])); if (!ValidId($KeyId) || $KeyId == 0) { $Logs->Err($Lang['KeyIsInvalid']); return; } if (ValidVar($License['L']) != intval(ValidVar($License['L']))) { $Logs->Err($Lang['KeyIsInvalid']); return; } $Query = "SELECT ID FROM " . PFX . "_tracker_license WHERE KEY_ID={$KeyId} OR LICENSE_KEY='{$Key}'"; $CheckId = $Db->ReturnValue($Query); if (ValidId($CheckId)) { $Logs->Err($Lang['KeyExists']); return; } if (CompareVersions($License['V'], $nsProduct->VERSION, 1) != 0) { $Logs->Err($Lang['KeyIsInvalid']); return; } if (isset($License['REQ']) && !CheckRequirements($License['REQ'])) { $Logs->Err($Lang['RequiredNotFound']); return false; } $Query = "INSERT INTO " . PFX . "_tracker_license (LICENSE_KEY, STAMP, KEY_ID) VALUES ('{$Key}', NOW(), {$KeyId})"; $Db->Query($Query); $nsProduct->Redir("license", "RCrt=1", "admin"); }