/** * @return bool * Проверяем что система поддерживает D7 */ public function isVersionD7() { return CheckVersion(ModuleManager::getVersion('main'), '14.00.00'); }
function MapsList($rev, $num, $format) { if (!CheckVersion($rev)) { die("Invalid revision"); } $con = db_connect(); $format = $con->real_escape_string($format); $num = $con->real_escape_string($num); $rev = $con->real_escape_string($rev); $result = ""; switch ($format) { default: $result .= '<table border="1" width="100%"><tr><td><strong>#</strong></td><td><strong>Map</strong></td><td style="text-align: center"><strong>Games played</strong></td><td style="text-align: center"><strong>Average players per game</strong></td></tr>' . "\n"; } if ($num != -1) { $limit = "LIMIT {$num}"; } else { $limit = ""; } $data = $con->query("SELECT Map, COUNT(Map) as MapCount, AVG(Players) as AvgPlayers FROM Games WHERE Rev='{$rev}' GROUP BY Map ORDER BY MapCount DESC " . $limit); if (!$data) { error_log("Error getting maps: " . mysqli_error($con)); } $index = 0; while ($row = $data->fetch_array()) { $Map = $row['Map']; $MapCount = $row['MapCount']; $AvgPlayers = $row['AvgPlayers']; $index++; switch ($format) { default: $result .= "<tr class=\"no_translate\"><td>{$index}</td><td style=\"white-space: nowrap;\">{$Map}</td><td style=\"text-align: center\">{$MapCount}</td><td style=\"text-align: center\">" . number_format($AvgPlayers, 2) . "</td></tr>\n"; } } switch ($format) { default: $result .= "</table>\n"; } echo $result; }
LocalRedirect($arParams['PATH_TO_REPORT_LIST']); } $helperClassName = $arResult['HELPER_CLASS'] = isset($arParams['REPORT_HELPER_CLASS']) ? $arParams['REPORT_HELPER_CLASS'] : ''; if ($isPost && isset($_POST['HELPER_CLASS'])) { $helperClassName = $arResult['HELPER_CLASS'] = $_POST['HELPER_CLASS']; } $ownerId = $arResult['OWNER_ID'] = call_user_func(array($helperClassName, 'getOwnerId')); // auto create fresh default reports only if some reports alredy exist $userReportVersion = CUserOptions::GetOption('report', '~U_' . $ownerId, call_user_func(array($helperClassName, 'getFirstVersion'))); $sysReportVersion = call_user_func(array($helperClassName, 'getCurrentVersion')); if ($sysReportVersion !== $userReportVersion && CheckVersion($sysReportVersion, $userReportVersion)) { CUserOptions::SetOption('report', '~U_' . $ownerId, $sysReportVersion); if (CReport::GetCountInt($ownerId) > 0) { $dReports = call_user_func(array($helperClassName, 'getDefaultReports')); foreach ($dReports as $moduleVer => $vReports) { if ($moduleVer !== $userReportVersion && CheckVersion($moduleVer, $userReportVersion)) { // add fresh vReports CReport::addFreshDefaultReports($vReports, $ownerId); } } } } // create default reports by user request if ($isPost && !empty($_POST['CREATE_DEFAULT'])) { $dReports = call_user_func(array($helperClassName, 'getDefaultReports')); foreach ($dReports as $moduleVer => $vReports) { CReport::addFreshDefaultReports($vReports, $ownerId); } LocalRedirect($arParams['PATH_TO_REPORT_LIST']); } // main action
$Name = $con->real_escape_string($_REQUEST["name"]); if (!isset($_REQUEST["ip"])) { $IP = $con->real_escape_string($_SERVER['REMOTE_ADDR']); //Use the server's IP as it appears to us } else { $IP = $con->real_escape_string($_REQUEST["ip"]); } $Port = intval($con->real_escape_string($_REQUEST["port"])); if ($Port < 1 || $Port > 65535) { $con->close(); die("invalid port"); } $PlayerCount = intval($con->real_escape_string($_REQUEST["playercount"])); $TTL = max(min(intval($con->real_escape_string($_REQUEST["ttl"])), $MAX_TTL), 1); $Rev = $con->real_escape_string($_REQUEST["rev"]); if (!CheckVersion($Rev)) { $con->close(); die("Invalid revision"); } $Coderev = $con->real_escape_string($_REQUEST["coderev"]); $IsDedicated = intval($con->real_escape_string($_REQUEST["dedicated"])); $OS = $con->real_escape_string($_REQUEST["os"]); if ($Name === "" || $IP === "" || $Port === "" || $TTL === "" || $PlayerCount === "") { error_log("Incorrect parameters " . $Name . " " . $IP . " " . $Port . " " . $TTL . " " . $PlayerCount . " "); $con->close(); die("Incorrect parameters"); } //Don't allow buggy Linux server versions, Windows server (ICS) is ok if (($Coderev == "r4179" || $Coderev == "r4185") && $_SERVER['HTTP_USER_AGENT'] != "Mozilla/4.0 (compatible; ICS)") { $con->close(); die("Please download the server update");
function Check4Update($s_chk_file, $s_id = "") { global $lNow, $php_errormsg; @($l_last_chk = filemtime($s_chk_file)); if ($l_last_chk === false || $lNow - $l_last_chk >= CHECK_DAYS * 24 * 60 * 60) { CheckVersion(); // // update the check file's time stamp // @($fp = fopen($s_chk_file, "w")); if ($fp !== false) { fwrite($fp, "FormMail version check " . (empty($s_id) ? "" : "for identifier '{$s_id}' ") . "at " . date("H:i:s d-M-Y", $lNow) . "\n"); fclose($fp); } else { SendAlert(GetMessage(MSG_CHK_FILE_ERROR, array("FILE" => $s_chk_file, "ERROR" => CheckString($php_errormsg)))); } } }
} for ($j = 0; $j < $type[1]; $j++) { ?> <input type="text" size="<?php echo $type[2]; ?> " value="" name="<?php echo htmlspecialcharsbx($Option[0]) . "[]"; ?> "><br><?php } } elseif ($type[0] == "selectbox") { $arr = $type[1]; $arr_keys = array_keys($arr); $alertWarning = ''; if (in_array($Option[0], array('auto_method', 'reiterate_method')) && !CheckVersion(SM_VERSION, '15.0.9')) { $alertWarning = 'onchange="if(this.value==\'cron\')alert(\'' . GetMessage('opt_sender_cron_support') . SM_VERSION . '.\');"'; } ?> <select name="<?php echo htmlspecialcharsbx($Option[0]); ?> " <?php echo $alertWarning; ?> ><?php $arr_keys_count = count($arr_keys); for ($j = 0; $j < $arr_keys_count; $j++) { ?> <option value="<?php echo $arr_keys[$j];
function __CheckDepends() { $success = true; if (array_key_exists("DEPENDENCIES", $this->arDescription) && is_array($this->arDescription["DEPENDENCIES"])) { $arModules = CWizardUtil::GetModules(); foreach ($this->arDescription["DEPENDENCIES"] as $module => $version) { if (!array_key_exists($module, $arModules)) { $this->SetError( str_replace("#MODULE#", htmlspecialcharsbx($module), GetMessage("MAIN_WIZARD_ERROR_MODULE_REQUIRED")) ); $success = false; } elseif (!$arModules[$module]["IsInstalled"]) { $this->SetError( str_replace("#MODULE#", $arModules[$module]["MODULE_NAME"], GetMessage("MAIN_WIZARD_ERROR_MODULE_REQUIRED")) ); $success = false; } elseif (!CheckVersion($arModules[$module]["MODULE_VERSION"], $version)) { $this->SetError( str_replace(Array("#MODULE#", "#VERSION#"), Array($arModules[$module]["MODULE_NAME"], htmlspecialcharsbx($version)), GetMessage("MAIN_WIZARD_ERROR_MODULE_REQUIRED2")) ); $success = false; } } } return $success; }
$text2 = GetMessage("GD_SECURITY_EVENT_COUNT"); } else { $text2 = GetMessage("GD_SECURITY_EVENT_COUNT_EMPTY"); } if ($securityEventsCount > 999) { $securityEventsCount = round($securityEventsCount / 1000, 1) . 'K'; } } else { $lamp_class = " bx-gadgets-note"; $text2_class = "red"; $text2 = GetMessage("GD_SECURITY_FILTER_OFF_DESC"); $securityEventsCount = 0; } $minSecurityVersionForScan = "12.5.0"; include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/security/install/version.php"; if (CheckVersion($arModuleVersion['VERSION'], $minSecurityVersionForScan)) { $lastResult = CSecuritySiteChecker::getLastTestingInfo(); $isScanNeeded = CSecuritySiteChecker::isNewTestNeeded(); $scannerMessage = ""; $isShowScanButton = true; } else { $isScanNeeded = false; $isShowScanButton = false; $scannerMessage = GetMessage("GD_SECURITY_UPDATE_NEEDED", array("#MIN_VERSION#" => $minSecurityVersionForScan)); } } else { $lamp_class = ""; $text2_class = "red"; $text2 = GetMessage("GD_SECURITY_MODULE"); $isScanNeeded = false; $scannerMessage = "";
$update_info = file_get_contents('http://www.admidio.org/update.txt'); // Admidio Versionen vom Server übergeben $stable_version = GetUpdateVersion($update_info, 'Version='); $beta_version = GetUpdateVersion($update_info, 'Beta-Version='); $beta_release = GetUpdateVersion($update_info, 'Beta-Release='); // Keine Stabile Version verfügbar (eigentlich unmöglich) if ($stable_version === '') { $stable_version = 'n/a'; } // Keine Beatversion verfügbar if ($beta_version === '') { $beta_version = 'n/a'; $beta_release = ''; } // Auf Update prüfen $version_update = CheckVersion(ADMIDIO_VERSION, $stable_version, $beta_version, $beta_release, ADMIDIO_VERSION_BETA); } // Nur im Anzeigemodus geht es weiter, ansonsten kann der aktuelle Updatestand // in der Variable $version_update abgefragt werden. // $version_update (0 = Kein Update, 1 = Neue stabile Version, 2 = Neue Beta-Version, 3 = Neue stabile + Beta Version, 99 = Keine Verbindung) if ($getMode == 2) { /***********************************************************************/ /* Updateergebnis anzeigen */ /***********************************************************************/ if ($version_update === 1) { $versionstext = $gL10n->get('UPD_NEW'); } elseif ($version_update === 2) { $versionstext = $gL10n->get('UPD_NEW_BETA'); } elseif ($version_update === 3) { $versionstext = $gL10n->get('UPD_NEW_BOTH'); } elseif ($version_update === 99) {
<td><textarea name="DESCRIPTION" cols="30" rows="3"><?echo $str_DESCRIPTION?></textarea></td> </tr> <tr class="heading"> <td colspan="2"><?echo GetMessage("MAIN_T_EDIT_CONTENT", array("#WORK_AREA#"=>'<a href="javascript:void(0)" onclick="document.bform.CONTENT.value+=\'#WORK_AREA#\';" title="'.GetMessage("MAIN_T_EDIT_INSERT_WORK_AREA").'">#WORK_AREA#</a>'))?></td> </tr> <tr> <td align="center" colspan="2"> <? $loadEditor = false; if((!defined("BX_DISABLE_TEMPLATE_EDITOR") || BX_DISABLE_TEMPLATE_EDITOR == false) && COption::GetOptionString("main", "templates_visual_editor", "N") == "Y" && IsModuleInstalled('fileman')) { if(COption::GetOptionString("fileman", "use_old_version", "N") != "Y") { include($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/fileman/install/version.php"); $loadEditor = CheckVersion($arModuleVersion['VERSION'],"6.5.7"); } } if($loadEditor): if(!class_exists('CFileMan')) CModule::IncludeModule("fileman"); AddEventHandler("fileman", "OnBeforeHTMLEditorScriptsGet", "__TE_editorScripts"); function __TE_editorScripts($editorName,$arEditorParams) { return array( "JS" => array('template_edit_editor.js') ); } ?><script> TE_MESS = {};
function ServerQuery($format, $rev) { if ($format == "ajaxupdate") { /* * the requester expects to receive a json object * some browsers withdraw the standard text/html that php returns by default */ header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); //expired in the past to prevent caching header('Content-type: application/json'); } global $MAIN_VERSION, $TABLE_REFRESH, $BASE_URL; if ($rev == "") { $rev = $MAIN_VERSION; } $con = db_connect(); $format = $con->real_escape_string($format); $rev = $con->real_escape_string($rev); if (!isset($format) && !CheckVersion($rev)) { $con->close(); die("Invalid revision"); } if ($rev == "") { $rev = $MAIN_VERSION; } $Result = ""; $server_count = 0; ///////////////////////////////////////// // HEADER // ///////////////////////////////////////// switch ($format) { case "ajaxupdate": $Result = array(); break; case "refresh": $Result = '<script type="text/javascript">' . "\n" . 'function srvlsttim(dat){var x="<tr><td><strong>Name</strong></td><td><strong>Address</strong></td><td style=\\"text-align: center\\"><strong>Players</strong></td></tr>";for(var n=0;n<dat.cnt;n++){x+="<tr><td><img src=\\"' . $BASE_URL . 'flags/"+dat.srvs[n].c+".gif\\" alt=\\""+dat.srvs[n].c+"\\" /> "+dat.srvs[n].n+"</td><td>"+(dat.srvs[n].a=="0"?" <img src=\\"' . $BASE_URL . 'error.png\\" alt=\\"Server unreachable\\" style=\\"vertical-align:middle\\" />":"")+dat.srvs[n].i+"</td><td style=\\"text-align: center\\">"+dat.srvs[n].p+"</td></tr>";jQuery("#ajxtbl").empty().append(x);}}' . "\n" . 'function updsr(){setTimeout(function (){jQuery.ajax({dataType: "jsonp",jsonp: "jsonp_callback",url: "' . $BASE_URL . 'serverquery.php?format=ajaxupdate&rev=' . $rev . '",success: function (data){srvlsttim(data);updsr();}});}, ' . 1000 * $TABLE_REFRESH . ');}' . "\n" . 'jQuery(document).ready(function($){updsr();});</script>' . "\n"; case "table": $Result .= '<table border="1" width="100%" id="ajxtbl"><tr><td><strong>Name</strong></td><td><strong>Address</strong></td><td style="text-align: center"><strong>Players</strong></td></tr>'; break; case "kamclub": $Result .= '<table border="1" width="100%" id="ajxtbl" style="font-size:11px; font-family:Arial,Tahoma"><tr><td><strong>Название сервера</strong></td><td><strong>Адрес</strong></td><td style="text-align: center"><strong>Кол-во игроков</strong></td></tr>'; break; case "kamclubeng": $Result .= '<table border="1" width="100%" id="ajxtbl" style="font-size:11px; font-family:Arial,Tahoma"><tr><td><strong>Server name</strong></td><td><strong>Address</strong></td><td style="text-align: center"><strong>Players</strong></td></tr>'; default: } ///////////////////////////////////////// // BODY // ///////////////////////////////////////// Remove_Old_Servers($con); $data = $con->query("SELECT IP, Port, Name, Players, Dedicated, OS, Pingable FROM Servers WHERE Rev='{$rev}' ORDER BY Players DESC, Name ASC"); while ($row = $data->fetch_array()) { $Name = $row['Name']; $IP = $row['IP']; $Port = $row['Port']; $PlayerCount = $row['Players']; $IsDedicated = $row['Dedicated']; $OS = $row['OS']; $Alive = $row['Pingable']; $server_count++; switch ($format) { case "refresh": case "kamclub": case "kamclubeng": case "table": //Clean color codes matching [$xxxxxx] or [] $Name = preg_replace('/\\[\\$[0-9a-fA-F]{6}\\]|\\[\\]|\\[\\]/', "", $Name); //WTF regex $Country = IPToCountry($IP); $Warning = ''; if (!$Alive) { $Warning = ' <IMG src="' . $BASE_URL . 'error.png" alt="Server unreachable" style="vertical-align:middle">'; } $Result .= "<TR class=\"no_translate\"><TD><IMG src=\"" . $BASE_URL . "flags/" . strtolower($Country) . ".gif\" alt=\"" . GetCountryName($Country) . "\"> {$Name}</TD><TD>{$Warning}{$IP}</TD><TD style=\"text-align: center\">{$PlayerCount}</TD></TR>\n"; break; case "ajaxupdate": //Clean color codes matching [$xxxxxx] or [] $Name = preg_replace('/\\[\\$[0-9a-fA-F]{6}\\]|\\[\\]|\\[\\]/', "", $Name); //WTF regex $srvsgl = array(); $srvsgl['c'] = strtolower(IPToCountry($IP)); $srvsgl['n'] = $Name; if (!$Alive) { $srvsgl['a'] = "0"; } else { $srvsgl['a'] = "1"; } $srvsgl['i'] = $IP; //$Result['o'] = $Port; // not used yet $srvsgl['p'] = $PlayerCount; $Result[] = $srvsgl; break; default: if (substr($rev, 1) >= 4878) { //New server releases expect more parameters $Result .= "{$Name},{$IP},{$Port},{$IsDedicated},{$OS}\n"; } else { $Result .= "{$Name},{$IP},{$Port}\n"; } } } ///////////////////////////////////////// // FOOTER // ///////////////////////////////////////// switch ($format) { case "ajaxupdate": $Result = json_encode(array("cnt" => $server_count, "srvs" => $Result)); $Result = $_GET['jsonp_callback'] . "(" . $Result . ")"; break; case "kamclub": case "kamclubeng": case "refresh": case "table": $Result .= '</table>'; default: } echo $Result; $con->close(); }
function Check4Update($s_chk_file, $s_id = "") { global $lNow; @($l_last_chk = filemtime($s_chk_file)); if ($l_last_chk === false || $lNow - $l_last_chk >= 3 * 24 * 60 * 60) { CheckVersion(); // // update the check file's time stamp // @($fp = fopen($s_chk_file, "w")); if ($fp !== false) { fwrite($fp, "FormMail version check " . (empty($s_id) ? "" : "for identifier '{$s_id}' ") . "at " . date("H:i:s d-M-Y", $lNow) . "\n"); fclose($fp); } else { SendAlert("Unable to create check file '{$s_chk_file}'"); } } }
<?php include_once "serverlib.php"; include_once "consts.php"; include_once "db.php"; if (!CheckVersion($_REQUEST["rev"])) { die("Invalid revision"); } $con = db_connect(); $Map = $con->real_escape_string($_REQUEST["map"]); $CRC = $con->real_escape_string($_REQUEST["mapcrc"]); $PlayerCount = $con->real_escape_string($_REQUEST["playercount"]); $Rev = $con->real_escape_string($_REQUEST["rev"]); if ($Map == "" || $Rev == "" || $PlayerCount == "") { $con->close(); die("Incorrect parameters"); } db_init($con); $Now = date("Y-m-d H:i:s"); $query = "INSERT INTO Games (Rev, Timestamp, Map, MapCRC, Players) VALUES ('{$Rev}', '{$Now}', '{$Map}', '{$CRC}', {$PlayerCount})"; if (!$con->query($query)) { error_log("Error adding game: " . mysqli_error($con)); } $con->close(); die('success');
public function DoInstall() { if ($GLOBALS['APPLICATION']->GetGroupRight('main') < 'W') { return; } if (is_array($this->NEED_MODULES) && !empty($this->NEED_MODULES)) { foreach ($this->NEED_MODULES as $module) { if (!IsModuleInstalled($module)) { $this->ShowForm('ERROR', $this->GetMessage('DDELIVERY_NEED_MODULES', array('#MODULE#' => $module, '#NEED#' => $this->NEED_MODULES))); return; } include $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $module . '/install/version.php'; if (!CheckVersion($arModuleVersion['VERSION'], $this->NEED_MAIN_VERSION)) { $this->ShowForm('ERROR', $this->GetMessage('DDELIVERY_NEED_MODULES', array('#MODULE#' => $module, '#NEED#' => $this->NEED_MAIN_VERSION))); return; } } } if (!function_exists('curl_init')) { $this->ShowForm('ERROR', $this->GetMessage('DDELIVERY_NEED_MODULES_CURL', array('#MODULE#' => 'cURL'))); return; } if (CheckVersion(SM_VERSION, $this->NEED_MAIN_VERSION)) { RegisterModuleDependences('sale', 'onSaleDeliveryHandlersBuildList', self::MODULE_ID, 'DDeliveryEvents', 'Init'); RegisterModuleDependences('sale', 'OnOrderNewSendEmail', self::MODULE_ID, 'DDeliveryEvents', 'OnOrderNewSendEmail'); RegisterModuleDependences('sale', 'OnSaleBeforeStatusOrder', self::MODULE_ID, 'DDeliveryEvents', 'OnSaleBeforeStatusOrder'); if (!symlink(__DIR__ . "/components/ddelivery", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components/ddelivery")) { CopyDirFiles(__DIR__ . "/components", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", true, true); } RegisterModule(self::MODULE_ID); CModule::IncludeModule("sale"); $ddeliveryConfig = CSaleDeliveryHandler::GetBySID('ddelivery')->Fetch(); $ddeliveryConfig['ACTIVE'] = 'N'; CSaleDeliveryHandler::Set('ddelivery', $ddeliveryConfig, false); include_once __DIR__ . '/../include.php'; include_once __DIR__ . '/../DDeliveryEvents.php'; include_once __DIR__ . '/../DDeliveryShop.php'; // Добавляем свойства в бд CSaleOrderProps::add(array('PERSON_TYPE_ID' => '1', 'NAME' => 'DDelivery LocalID', 'TYPE' => 'TEXT', 'REQUIED' => 'N', 'DEFAULT_VALUE' => '', 'SORT' => '10000', 'USER_PROPS' => 'N', 'IS_LOCATION' => 'N', 'PROPS_GROUP_ID' => '2', 'IS_EMAIL' => 'N', 'IS_PROFILE_NAME' => 'N', 'IS_PAYER' => 'N', 'IS_LOCATION4TAX' => 'N', 'IS_ZIP' => 'N', 'CODE' => 'DDELIVERY_ID', 'IS_FILTERED' => 'Y', 'ACTIVE' => 'Y', 'UTIL' => 'Y', 'INPUT_FIELD_LOCATION' => '0', 'MULTIPLE' => 'N')); $IntegratorShop = new DDeliveryShop($ddeliveryConfig['CONFIG']['CONFIG'], array(), array()); $ddeliveryUI = new DDeliveryUI($IntegratorShop, true); $ddeliveryUI->createTables(); $this->ShowForm('OK', GetMessage('MOD_INST_OK'), true); } else { $this->ShowForm('ERROR', $this->GetMessage('DDELIVERY_NEED_RIGHT_VER', array('#NEED#' => $this->NEED_MAIN_VERSION))); } }