This commit is contained in:
root
2025-11-13 19:52:28 +03:00
parent 8aeeb05b7d
commit 807dec3b6c
4646 changed files with 163445 additions and 626017 deletions

View File

@@ -73,14 +73,14 @@ function strip_tags(str)
}
function CAjaxForm(formName, target, hiddenField)
function CAjaxForm(formName, target, hiddenFields)
{
var form = document.forms[formName];
if (!form)
form = document.getElementById(formName);
this.nextStep = form.elements[hiddenField];
this.nextStepStage = form.elements[hiddenField+"Stage"];
this.hiddenFields = hiddenFields;
this.iframe = document.getElementById(target);
this.form = form;
this.form.target = target;
@@ -160,15 +160,15 @@ CAjaxForm.prototype.ShowError = function(errorMessage)
var skipButton = document.getElementById("error_skip_button");
var _this = this;
var nextStep = this.nextStep.value;
var nextStepStage = this.nextStepStage.value;
retryButton.onclick = function() {_this.HideError(); _this.Post(nextStep, nextStepStage,'');};
var nextStep = this.form.elements[this.hiddenFields.nextStep].value;
retryButton.onclick = function() {_this.HideError(); _this.Post({}, '');};
if (nextStep == "main")
skipButton.onclick = function() {_this.HideError(); _this.Post(nextStep, nextStepStage,'');};
skipButton.onclick = function() {_this.HideError(); _this.Post({}, '');};
else
skipButton.onclick = function() {_this.HideError(); _this.Post(nextStep, 'skip','');};
skipButton.onclick = function() {_this.HideError(); _this.Post({'nextStepStage': 'skip'}, '');};
}
CAjaxForm.prototype.HideError = function()
@@ -188,13 +188,18 @@ CAjaxForm.prototype.HideError = function()
waitWindow.style.display = "block";
}
CAjaxForm.prototype.Post = function(nextStep, nextStepStage, status)
CAjaxForm.prototype.Post = function(vars, status)
{
if (nextStep)
this.nextStep.value = nextStep;
if (nextStepStage)
this.nextStepStage.value = nextStepStage;
for (let key in vars)
{
if (vars.hasOwnProperty(key))
{
if (this.form.elements[this.hiddenFields[key]])
{
this.form.elements[this.hiddenFields[key]].value = vars[key];
}
}
}
this.form.submit();
@@ -221,9 +226,12 @@ CAjaxForm.prototype.SetStatus = function(percent, status)
if (!this.indicator)
this.indicator = document.getElementById("indicator");
if (!this.status)
this.status = document.getElementById("status");
this.status.innerHTML = status;
if (status)
{
if (!this.status)
this.status = document.getElementById("status");
this.status.innerHTML = status;
}
if (this.percent)
this.percent.innerHTML = percent + "%";
@@ -252,3 +260,39 @@ function PreloadImages()
}
}
function SubmitForm(formId, action, fields)
{
let form = document.getElementById(formId);
if (!form)
{
form = document.createElement('form');
form.setAttribute('id', formId);
form.setAttribute('method', 'post');
form.setAttribute('action', action);
form.setAttribute('target', '_blank');
for (let name in fields)
{
if (fields.hasOwnProperty(name))
{
let i = document.createElement('input');
i.setAttribute('type', 'hidden');
i.setAttribute('name', name);
form.appendChild(i);
}
}
document.getElementsByTagName('body')[0].appendChild(form);
}
for (let name in fields)
{
if (fields.hasOwnProperty(name))
{
form.elements[name].value = fields[name];
}
}
form.submit();
}

File diff suppressed because one or more lines are too long

View File

@@ -1,2 +1,2 @@
function CancelBubble(e){if(e.stopPropagation){e.preventDefault();e.stopPropagation()}else{e.cancelBubble=true;e.returnValue=false}}function NeedRootUser(){var e=document.getElementById("create_user_Y");var t=document.getElementById("create_db_Y");if(e.checked||t&&t.checked){document.getElementById("line1").style.display="";document.getElementById("line2").style.display="";document.getElementById("line3").style.display=""}else{document.getElementById("line1").style.display="none";document.getElementById("line2").style.display="none";document.getElementById("line3").style.display="none"}var n=document.getElementById("db_exists");var i=document.getElementById("db_new");if(n&&i){n.style.display=!t.checked?"block":"none";i.style.display=t.checked?"block":"none"}}function NeedUTFSection(e){if(e=="mssql"||e=="mssql_native"){document.getElementById("utf-row-two").style.display="none";document.getElementById("utf-row-one").style.display="none";document.getElementById("utf8_inst").checked=false;document.getElementsByName("__wiz_utf8")[0].value=""}else{document.getElementById("utf-row-one").style.display="";document.getElementById("utf-row-two").style.display=""}}function htmlspecialchars(e){if(typeof e!="string")return e;e=e.replace(/&/g,"&amp;");e=e.replace(/"/g,"&quot;");e=e.replace(/</g,"&lt;");e=e.replace(/>/g,"&gt;");return e}function strip_tags(e){return e.replace(/<\/?[^>]+>/gi,"")}function CAjaxForm(e,t,n){var i=document.forms[e];if(!i)i=document.getElementById(e);this.nextStep=i.elements[n];this.nextStepStage=i.elements[n+"Stage"];this.iframe=document.getElementById(t);this.form=i;this.form.target=t;var r=this;if(this.iframe.attachEvent)this.iframe.attachEvent("onload",function(){r.AjaxHandler()});else this.iframe.onload=function(){r.AjaxHandler()};this.percent=null;this.percent2=null;this.indicator=null;this.status=null}CAjaxForm.prototype.AjaxHandler=function(){if(this.iframe.contentWindow&&this.iframe.contentWindow.location.href.indexOf("http")!=0)return;if(this.iframe.contentDocument)var e=this.iframe.contentDocument;else var e=this.iframe.contentWindow.document;var t=e.body.innerHTML;if(t.length==0||e.getElementById("bitrix_install_template")){this.ShowError("Connection error. Empty response.");return}var n=new RegExp("\\[response\\]","i");var i=new RegExp("\\[/response\\]","i");var r=t.match(n);if(r===null){this.ShowError(t);return}var o=r.index+r[0].length;var s=t.search(i);if(s==-1){this.ShowError(t);return}t=t.substr(o,s-o);window.eval(t)};CAjaxForm.prototype.ShowError=function(e){var t=document.getElementById("error_container");var n=document.getElementById("error_text");if(!t||!n)return;var i=document.getElementById("wait");if(i)i.style.display="none";t.style.display="block";n.innerHTML=strip_tags(e);var r=document.getElementById("error_retry_button");var o=document.getElementById("error_skip_button");var s=this;var a=this.nextStep.value;var l=this.nextStepStage.value;r.onclick=function(){s.HideError();s.Post(a,l,"")};if(a=="main")o.onclick=function(){s.HideError();s.Post(a,l,"")};else o.onclick=function(){s.HideError();s.Post(a,"skip","")}};CAjaxForm.prototype.HideError=function(){var e=document.getElementById("error_container");var t=document.getElementById("error_text");if(!e||!t)return;while(t.firstChild)t.removeChild(t.firstChild);e.style.display="none";var n=document.getElementById("wait");if(n)n.style.display="block"};CAjaxForm.prototype.Post=function(e,t,n){if(e)this.nextStep.value=e;if(t)this.nextStepStage.value=t;this.form.submit();if(!this.status)this.status=document.getElementById("status");if(n.length>0)this.status.innerHTML=n+"..."};CAjaxForm.prototype.StopAjax=function(){this.iframe.onload=null;this.form.target="_self"};CAjaxForm.prototype.SetStatus=function(e,t){if(!this.percent)this.percent=document.getElementById("percent");if(!this.percent2)this.percent2=document.getElementById("percent2");if(!this.indicator)this.indicator=document.getElementById("indicator");if(!this.status)this.status=document.getElementById("status");this.status.innerHTML=t;if(this.percent)this.percent.innerHTML=e+"%";if(this.percent2)this.percent2.innerHTML=e+"%";this.indicator.style.width=e+"%"};function OnBeforeUserExit(e){if(!e)var e=window.event;e.returnValue=warningBeforeOnload}function PreloadImages(){var e=["prev.gif","error.gif","wait.gif","admin.gif","public.gif"];for(var t=0;t<e.length;t++){var n=new Image;n.src="/bitrix/images/install/"+e[t]}}
function CancelBubble(e){if(e.stopPropagation){e.preventDefault();e.stopPropagation()}else{e.cancelBubble=true;e.returnValue=false}}function NeedRootUser(){var e=document.getElementById("create_user_Y");var t=document.getElementById("create_db_Y");if(e.checked||t&&t.checked){document.getElementById("line1").style.display="";document.getElementById("line2").style.display="";document.getElementById("line3").style.display=""}else{document.getElementById("line1").style.display="none";document.getElementById("line2").style.display="none";document.getElementById("line3").style.display="none"}var n=document.getElementById("db_exists");var i=document.getElementById("db_new");if(n&&i){n.style.display=!t.checked?"block":"none";i.style.display=t.checked?"block":"none"}}function NeedUTFSection(e){if(e=="mssql"||e=="mssql_native"){document.getElementById("utf-row-two").style.display="none";document.getElementById("utf-row-one").style.display="none";document.getElementById("utf8_inst").checked=false;document.getElementsByName("__wiz_utf8")[0].value=""}else{document.getElementById("utf-row-one").style.display="";document.getElementById("utf-row-two").style.display=""}}function htmlspecialchars(e){if(typeof e!="string")return e;e=e.replace(/&/g,"&amp;");e=e.replace(/"/g,"&quot;");e=e.replace(/</g,"&lt;");e=e.replace(/>/g,"&gt;");return e}function strip_tags(e){return e.replace(/<\/?[^>]+>/gi,"")}function CAjaxForm(e,t,n){var i=document.forms[e];if(!i)i=document.getElementById(e);this.hiddenFields=n;this.iframe=document.getElementById(t);this.form=i;this.form.target=t;var r=this;if(this.iframe.attachEvent)this.iframe.attachEvent("onload",(function(){r.AjaxHandler()}));else this.iframe.onload=function(){r.AjaxHandler()};this.percent=null;this.percent2=null;this.indicator=null;this.status=null}CAjaxForm.prototype.AjaxHandler=function(){if(this.iframe.contentWindow&&this.iframe.contentWindow.location.href.indexOf("http")!=0)return;if(this.iframe.contentDocument)var e=this.iframe.contentDocument;else var e=this.iframe.contentWindow.document;var t=e.body.innerHTML;if(t.length==0||e.getElementById("bitrix_install_template")){this.ShowError("Connection error. Empty response.");return}var n=new RegExp("\\[response\\]","i");var i=new RegExp("\\[/response\\]","i");var r=t.match(n);if(r===null){this.ShowError(t);return}var o=r.index+r[0].length;var s=t.search(i);if(s==-1){this.ShowError(t);return}t=t.substr(o,s-o);window.eval(t)};CAjaxForm.prototype.ShowError=function(e){var t=document.getElementById("error_container");var n=document.getElementById("error_text");if(!t||!n)return;var i=document.getElementById("wait");if(i)i.style.display="none";t.style.display="block";n.innerHTML=strip_tags(e);var r=document.getElementById("error_retry_button");var o=document.getElementById("error_skip_button");var s=this;var l=this.form.elements[this.hiddenFields.nextStep].value;r.onclick=function(){s.HideError();s.Post({},"")};if(l=="main")o.onclick=function(){s.HideError();s.Post({},"")};else o.onclick=function(){s.HideError();s.Post({nextStepStage:"skip"},"")}};CAjaxForm.prototype.HideError=function(){var e=document.getElementById("error_container");var t=document.getElementById("error_text");if(!e||!t)return;while(t.firstChild)t.removeChild(t.firstChild);e.style.display="none";var n=document.getElementById("wait");if(n)n.style.display="block"};CAjaxForm.prototype.Post=function(e,t){for(let t in e){if(e.hasOwnProperty(t)){if(this.form.elements[this.hiddenFields[t]]){this.form.elements[this.hiddenFields[t]].value=e[t]}}}this.form.submit();if(!this.status)this.status=document.getElementById("status");if(t.length>0)this.status.innerHTML=t+"..."};CAjaxForm.prototype.StopAjax=function(){this.iframe.onload=null;this.form.target="_self"};CAjaxForm.prototype.SetStatus=function(e,t){if(!this.percent)this.percent=document.getElementById("percent");if(!this.percent2)this.percent2=document.getElementById("percent2");if(!this.indicator)this.indicator=document.getElementById("indicator");if(t){if(!this.status)this.status=document.getElementById("status");this.status.innerHTML=t}if(this.percent)this.percent.innerHTML=e+"%";if(this.percent2)this.percent2.innerHTML=e+"%";this.indicator.style.width=e+"%"};function OnBeforeUserExit(e){if(!e)var e=window.event;e.returnValue=warningBeforeOnload}function PreloadImages(){var e=["prev.gif","error.gif","wait.gif","admin.gif","public.gif"];for(var t=0;t<e.length;t++){var n=new Image;n.src="/bitrix/images/install/"+e[t]}}function SubmitForm(e,t,n){let i=document.getElementById(e);if(!i){i=document.createElement("form");i.setAttribute("id",e);i.setAttribute("method","post");i.setAttribute("action",t);i.setAttribute("target","_blank");for(let e in n){if(n.hasOwnProperty(e)){let t=document.createElement("input");t.setAttribute("type","hidden");t.setAttribute("name",e);i.appendChild(t)}}document.getElementsByTagName("body")[0].appendChild(i)}for(let e in n){if(n.hasOwnProperty(e)){i.elements[e].value=n[e]}}i.submit()}
//# sourceMappingURL=script.map.js

View File

@@ -43,11 +43,11 @@ class WizardTemplate extends CWizardTemplate
include($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/.config.php");
}
$title = $bxProductConfig["product_wizard"]["product_name"] ?? $arWizardConfig["productName"] ?? InstallGetMessage("INS_TITLE3");
$title = $bxProductConfig["product_wizard"]["product_name"] ?? $arWizardConfig["productName"] ?? GetMessage("INS_TITLE3");
$titleSub = "";
if($title == InstallGetMessage("INS_TITLE3"))
$titleSub = '<div class="inst-title-label">'.InstallGetMessage("INS_TITLE2").'</div>';
if($title == GetMessage("INS_TITLE3"))
$titleSub = '<div class="inst-title-label">'.GetMessage("INS_TITLE2").'</div>';
$title = str_replace("#VERS#", $productVersion , $title);
$browserTitle = strip_tags(str_replace(Array("<br>", "<br />"), " ",$title));
@@ -56,16 +56,16 @@ class WizardTemplate extends CWizardTemplate
$copyright = $bxProductConfig["product_wizard"]["copyright"];
else
{
$copyright = InstallGetMessage("COPYRIGHT");
$copyright = GetMessage("COPYRIGHT");
if (isset($arWizardConfig["copyrightText"]))
$copyright .= $arWizardConfig["copyrightText"];
}
$copyright = str_replace("#CURRENT_YEAR#", date("Y") , $copyright);
$support = $bxProductConfig["product_wizard"]["links"] ?? $arWizardConfig["supportText"] ?? InstallGetMessage("SUPPORT");
$support = $bxProductConfig["product_wizard"]["links"] ?? $arWizardConfig["supportText"] ?? GetMessage("SUPPORT");
if (file_exists($_SERVER["DOCUMENT_ROOT"]."/readme.html"))
$support = InstallGetMessage("SUPPORT_README").$support;
$support = GetMessage("SUPPORT_README").$support;
//Images
$logoImage = "";
@@ -134,15 +134,15 @@ class WizardTemplate extends CWizardTemplate
$jsBeforeOnload = "";
if ($currentStep == "create_modules")
{
$jsBeforeOnload .= "var warningBeforeOnload = '".InstallGetMessage("INS_BEFORE_USER_EXIT")."';\n";
$jsBeforeOnload .= "var warningBeforeOnload = '".GetMessage("INS_BEFORE_USER_EXIT")."';\n";
$jsBeforeOnload .= "window.onbeforeunload = OnBeforeUserExit;";
}
$jsCode = "";
$jsCode = file_get_contents($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/install/wizard/script.js");
$instructionText = InstallGetMessage("GOTO_README");
$noscriptInfo = InstallGetMessage("INST_JAVASCRIPT_DISABLED");
$instructionText = GetMessage("GOTO_README");
$noscriptInfo = GetMessage("INST_JAVASCRIPT_DISABLED");
return <<<HTML
<!DOCTYPE html>

View File

@@ -1,6 +1,9 @@
<?php
function InstallGetMessage($name, $aReplace=null)
/**
* @deprecated
*/
function InstallGetMessage($name, $aReplace = null)
{
return GetMessage($name, $aReplace);
}
@@ -21,42 +24,44 @@ class BXInstallServices
$additionalInstallDefine = (NEED_PERSON_TYPE) ? 'define("NEED_PERSON_TYPE", true);' : 'define("NEED_PERSON_TYPE", false);';
}
$indexContent = '<'.'?'.
'define("WIZARD_DEFAULT_SITE_ID", "'.(defined("WIZARD_DEFAULT_SITE_ID") ? WIZARD_DEFAULT_SITE_ID : "s1").'");'.
$additionalInstallDefine.
$personTypeDefine.
'require('.'$'.'_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");'.
'require_once('.'$'.'_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/wizard.php");'.
'$'.'wizard = new CWizard("'.$wizardName.'");'.
'$'.'wizard->Install();'.
'require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php");'.
'?'.'>';
$indexContent = '<' . '?' .
'define("WIZARD_DEFAULT_SITE_ID", "' . (defined("WIZARD_DEFAULT_SITE_ID") ? WIZARD_DEFAULT_SITE_ID : "s1") . '");' .
$additionalInstallDefine .
$personTypeDefine .
'require(' . '$' . '_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");' .
'require_once(' . '$' . '_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/wizard.php");' .
'$' . 'wizard = new CWizard("' . $wizardName . '");' .
'$' . 'wizard->Install();' .
'require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php");' .
'?' . '>';
$p = $_SERVER["DOCUMENT_ROOT"]."/index.php";
$p = $_SERVER["DOCUMENT_ROOT"] . "/index.php";
if (defined("WIZARD_DEFAULT_SITE_ID"))
{
$rsSite = CSite::GetList("sort", "asc", array("ID" => WIZARD_DEFAULT_SITE_ID));
$rsSite = CSite::GetList("sort", "asc", ["ID" => WIZARD_DEFAULT_SITE_ID]);
$arSite = $rsSite->GetNext();
$p = CSite::GetSiteDocRoot($arSite["LID"]).$arSite["DIR"]."/index.php";
$p = CSite::GetSiteDocRoot($arSite["LID"]) . $arSite["DIR"] . "/index.php";
}
$handler = @fopen($p,"wb");
$handler = @fopen($p, "wb");
if (!$handler)
{
$errorMessage = InstallGetMessage("INST_WIZARD_INDEX_ACCESS_ERROR");
$errorMessage = GetMessage("INST_WIZARD_INDEX_ACCESS_ERROR");
return false;
}
$success = @fwrite($handler, $indexContent);
if (!$success)
{
$errorMessage = InstallGetMessage("INST_WIZARD_INDEX_ACCESS_ERROR");
$errorMessage = GetMessage("INST_WIZARD_INDEX_ACCESS_ERROR");
return false;
}
if (defined("BX_FILE_PERMISSIONS"))
@chmod($_SERVER["DOCUMENT_ROOT"]."/index.php", BX_FILE_PERMISSIONS);
{
@chmod($_SERVER["DOCUMENT_ROOT"] . "/index.php", BX_FILE_PERMISSIONS);
}
fclose($handler);
@@ -66,105 +71,141 @@ class BXInstallServices
public static function LoadWizardData($wizard)
{
$arTmp = explode(":", $wizard);
$ar = array();
$ar = [];
foreach ($arTmp as $a)
{
$a = preg_replace("#[^a-z0-9_.-]+#i", "", $a);
if ($a <> '')
{
$ar[] = $a;
}
}
if (count($ar) > 2)
$path = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$ar[0]."/install/wizards/".$ar[1]."/".$ar[2];
{
$path = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $ar[0] . "/install/wizards/" . $ar[1] . "/" . $ar[2];
}
elseif (count($ar) == 2)
$path = $_SERVER["DOCUMENT_ROOT"]."/bitrix/wizards/".$ar[0]."/".$ar[1];
{
$path = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/wizards/" . $ar[0] . "/" . $ar[1];
}
else
{
return false;
}
if (!file_exists($path."/.description.php") || !is_file($path."/.description.php"))
if (!file_exists($path . "/.description.php") || !is_file($path . "/.description.php"))
{
return false;
}
if (!defined("B_PROLOG_INCLUDED"))
{
define("B_PROLOG_INCLUDED", true);
}
global $MESS;
if(file_exists($path."/lang/en/.description.php"))
include($path."/lang/en/.description.php");
if (file_exists($path."/lang/".LANGUAGE_ID."/.description.php"))
include($path."/lang/".LANGUAGE_ID."/.description.php");
if (file_exists($path . "/lang/en/.description.php"))
{
include($path . "/lang/en/.description.php");
}
if (file_exists($path . "/lang/" . LANGUAGE_ID . "/.description.php"))
{
include($path . "/lang/" . LANGUAGE_ID . "/.description.php");
}
$arWizardDescription = array();
include($path."/.description.php");
$arWizardDescription = [];
include($path . "/.description.php");
if (empty($arWizardDescription))
{
return false;
}
if (!array_key_exists("WIZARD_TYPE", $arWizardDescription))
{
return false;
}
if (defined("WIZARD_DEFAULT_TONLY") && WIZARD_DEFAULT_TONLY === true && !defined("WIZARD_DEFAULT_DONLY") && strtoupper($arWizardDescription["WIZARD_TYPE"]) != "INSTALL")
{
return false;
}
if (defined("WIZARD_DEFAULT_TONLY") && WIZARD_DEFAULT_TONLY === true && defined("WIZARD_DEFAULT_DONLY") && strtoupper($arWizardDescription["WIZARD_TYPE"]) != "INSTALL" && strtoupper($arWizardDescription["WIZARD_TYPE"]) != "INSTALL_ONCE")
{
return false;
}
if ((!defined("WIZARD_DEFAULT_TONLY") || WIZARD_DEFAULT_TONLY !== true) && strtoupper($arWizardDescription["WIZARD_TYPE"]) != "INSTALL" && strtoupper($arWizardDescription["WIZARD_TYPE"]) != "INSTALL_ONCE")
{
return false;
}
if ($arWizardDescription["IMAGE"] <> '')
{
if (count($ar) > 2)
{
BXInstallServices::CopyDirFiles(
$path."/".$arWizardDescription["IMAGE"],
$_SERVER["DOCUMENT_ROOT"]."/bitrix/tmp/".$ar[1]."/".$ar[2]."/".$arWizardDescription["IMAGE"],
$path . "/" . $arWizardDescription["IMAGE"],
$_SERVER["DOCUMENT_ROOT"] . "/bitrix/tmp/" . $ar[1] . "/" . $ar[2] . "/" . $arWizardDescription["IMAGE"],
true
);
$arWizardDescription["IMAGE"] = "/bitrix/tmp/".$ar[1]."/".$ar[2]."/".$arWizardDescription["IMAGE"];
$arWizardDescription["IMAGE"] = "/bitrix/tmp/" . $ar[1] . "/" . $ar[2] . "/" . $arWizardDescription["IMAGE"];
}
else
{
$arWizardDescription["IMAGE"] = "/bitrix/wizards/".$ar[0]."/".$ar[1]."/".$arWizardDescription["IMAGE"];
$arWizardDescription["IMAGE"] = "/bitrix/wizards/" . $ar[0] . "/" . $ar[1] . "/" . $arWizardDescription["IMAGE"];
}
}
return array(
return [
"ID" => implode(":", $ar),
"NAME" => $arWizardDescription["NAME"],
"DESCRIPTION" => $arWizardDescription["DESCRIPTION"],
"IMAGE" => $arWizardDescription["IMAGE"],
"VERSION" => $arWizardDescription["VERSION"],
);
];
}
public static function GetWizardsList($moduleName = "")
{
$arWizardsList = array();
$arWizardsList = [];
if ($moduleName == '')
{
$path = $_SERVER["DOCUMENT_ROOT"]."/bitrix/wizards";
$path = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/wizards";
if ($h1 = opendir($path))
{
while (($f1 = readdir($h1)) !== false)
{
if ($f1 == "." || $f1 == "..")
{
continue;
}
if (!is_dir($path."/".$f1))
if (!is_dir($path . "/" . $f1))
{
continue;
}
if ($h2 = opendir($path."/".$f1))
if ($h2 = opendir($path . "/" . $f1))
{
while (($f2 = readdir($h2)) !== false)
{
if ($f2 == "." || $f2 == "..")
continue;
if (!is_dir($path."/".$f1."/".$f2))
continue;
if (!file_exists($path."/".$f1."/".$f2."/.description.php"))
continue;
if ($wizardData = BXInstallServices::LoadWizardData($f1.":".$f2))
{
$arWizardsList[$f1.":".$f2] = $wizardData;
continue;
}
if (!is_dir($path . "/" . $f1 . "/" . $f2))
{
continue;
}
if (!file_exists($path . "/" . $f1 . "/" . $f2 . "/.description.php"))
{
continue;
}
if ($wizardData = BXInstallServices::LoadWizardData($f1 . ":" . $f2))
{
$arWizardsList[$f1 . ":" . $f2] = $wizardData;
}
}
closedir($h2);
@@ -174,48 +215,68 @@ class BXInstallServices
}
}
$path = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules";
$path = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules";
if ($h1 = opendir($path))
{
while (($f1 = readdir($h1)) !== false)
{
if ($f1 == "." || $f1 == "..")
{
continue;
}
if ($moduleName <> '' && $f1 != $moduleName)
{
continue;
}
if (!is_dir($path."/".$f1) || !file_exists($path."/".$f1."/install/wizards") || !is_dir($path."/".$f1."/install/wizards"))
if (!is_dir($path . "/" . $f1) || !file_exists($path . "/" . $f1 . "/install/wizards") || !is_dir($path . "/" . $f1 . "/install/wizards"))
{
continue;
}
if ($h2 = opendir($path."/".$f1."/install/wizards"))
if ($h2 = opendir($path . "/" . $f1 . "/install/wizards"))
{
while (($f2 = readdir($h2)) !== false)
{
if ($f2 == "." || $f2 == "..")
{
continue;
}
if (!is_dir($path."/".$f1."/install/wizards/".$f2))
if (!is_dir($path . "/" . $f1 . "/install/wizards/" . $f2))
{
continue;
}
if ($h3 = opendir($path."/".$f1."/install/wizards/".$f2))
if ($h3 = opendir($path . "/" . $f1 . "/install/wizards/" . $f2))
{
while (($f3 = readdir($h3)) !== false)
{
if ($f3 == "." || $f3 == "..")
{
continue;
}
if (!is_dir($path."/".$f1."/install/wizards/".$f2."/".$f3))
if (!is_dir($path . "/" . $f1 . "/install/wizards/" . $f2 . "/" . $f3))
{
continue;
}
if (array_key_exists($f2.":".$f3, $arWizardsList))
if (array_key_exists($f2 . ":" . $f3, $arWizardsList))
{
continue;
}
if (!file_exists($path."/".$f1."/install/wizards/".$f2."/".$f3."/.description.php"))
if (!file_exists($path . "/" . $f1 . "/install/wizards/" . $f2 . "/" . $f3 . "/.description.php"))
{
continue;
}
if ($wizardData = BXInstallServices::LoadWizardData($f1.":".$f2.":".$f3))
$arWizardsList[$f2.":".$f3] = $wizardData;
if ($wizardData = BXInstallServices::LoadWizardData($f1 . ":" . $f2 . ":" . $f3))
{
$arWizardsList[$f2 . ":" . $f3] = $wizardData;
}
}
closedir($h3);
}
@@ -226,8 +287,10 @@ class BXInstallServices
closedir($h1);
}
if(LANGUAGE_ID != 'ru')
if (LANGUAGE_ID != 'ru')
{
unset($arWizardsList['bitrix:demo']);
}
ksort($arWizardsList);
@@ -237,24 +300,30 @@ class BXInstallServices
public static function CopyDirFiles($path_from, $path_to, $rewrite = true)
{
if (str_starts_with($path_to . "/", $path_from . "/"))
{
return false;
}
if (is_dir($path_from))
{
BXInstallServices::CheckDirPath($path_to."/");
BXInstallServices::CheckDirPath($path_to . "/");
}
elseif (is_file($path_from))
{
$p = strrpos($path_to, "/");
$path_to_dir = substr($path_to, 0, $p);
BXInstallServices::CheckDirPath($path_to_dir."/");
BXInstallServices::CheckDirPath($path_to_dir . "/");
if (file_exists($path_to) && !$rewrite)
{
return false;
}
@copy($path_from, $path_to);
if(is_file($path_to) && defined("BX_FILE_PERMISSIONS"))
if (is_file($path_to) && defined("BX_FILE_PERMISSIONS"))
{
@chmod($path_to, BX_FILE_PERMISSIONS);
}
return true;
}
@@ -268,21 +337,25 @@ class BXInstallServices
while (($file = readdir($handle)) !== false)
{
if ($file == "." || $file == "..")
{
continue;
if (is_dir($path_from."/".$file))
{
BXInstallServices::CopyDirFiles($path_from."/".$file, $path_to."/".$file, $rewrite);
}
elseif (is_file($path_from."/".$file))
{
if (file_exists($path_to."/".$file) && !$rewrite)
continue;
@copy($path_from."/".$file, $path_to."/".$file);
if(defined("BX_FILE_PERMISSIONS"))
if (is_dir($path_from . "/" . $file))
{
BXInstallServices::CopyDirFiles($path_from . "/" . $file, $path_to . "/" . $file, $rewrite);
}
elseif (is_file($path_from . "/" . $file))
{
if (file_exists($path_to . "/" . $file) && !$rewrite)
{
@chmod($path_to."/".$file, BX_FILE_PERMISSIONS);
continue;
}
@copy($path_from . "/" . $file, $path_to . "/" . $file);
if (defined("BX_FILE_PERMISSIONS"))
{
@chmod($path_to . "/" . $file, BX_FILE_PERMISSIONS);
}
}
}
@@ -295,7 +368,6 @@ class BXInstallServices
global $arWizardConfig;
$dbTypes = [];
if (isset($arWizardConfig['pgsql']) && $arWizardConfig['pgsql'] === 'yes')
{
$dbTypes['pgsql'] = function_exists('pg_pconnect');
@@ -310,7 +382,7 @@ class BXInstallServices
public static function CheckDirPath($path, $dirPermissions = 0755)
{
$badDirs = Array();
$badDirs = [];
$path = str_replace("\\", "/", $path);
$path = str_replace("//", "/", $path);
@@ -320,8 +392,10 @@ class BXInstallServices
$path = substr($path, 0, $p);
}
while (strlen($path) > 1 && $path[strlen($path) - 1]=="/")
while (strlen($path) > 1 && $path[strlen($path) - 1] == "/")
{
$path = substr($path, 0, strlen($path) - 1);
}
$p = strrpos($path, "/");
while ($p > 0)
@@ -329,7 +403,9 @@ class BXInstallServices
if (file_exists($path) && is_dir($path))
{
if (!is_writable($path))
{
@chmod($path, $dirPermissions);
}
break;
}
$badDirs[] = substr($path, $p + 1);
@@ -337,12 +413,14 @@ class BXInstallServices
$p = strrpos($path, "/");
}
for ($i = count($badDirs)-1; $i>=0; $i--)
for ($i = count($badDirs) - 1; $i >= 0; $i--)
{
$path = $path."/".$badDirs[$i];
$path = $path . "/" . $badDirs[$i];
$success = @mkdir($path, $dirPermissions);
if (!$success)
{
return false;
}
}
return true;
@@ -351,7 +429,10 @@ class BXInstallServices
public static function DeleteDirRec($path)
{
$path = str_replace("\\", "/", $path);
if (!file_exists($path)) return;
if (!file_exists($path))
{
return;
}
if (!is_dir($path))
{
@unlink($path);
@@ -361,11 +442,18 @@ class BXInstallServices
{
while (($file = readdir($handle)) !== false)
{
if ($file == "." || $file == "..") continue;
if (is_dir($path."/".$file))
BXInstallServices::DeleteDirRec($path."/".$file);
if ($file == "." || $file == "..")
{
continue;
}
if (is_dir($path . "/" . $file))
{
BXInstallServices::DeleteDirRec($path . "/" . $file);
}
else
@unlink($path."/".$file);
{
@unlink($path . "/" . $file);
}
}
}
closedir($handle);
@@ -374,37 +462,57 @@ class BXInstallServices
public static function VersionCompare($strCurver, $strMinver, $strMaxver = "0.0.0")
{
$curver = explode(".", $strCurver);for ($i = 0; $i < 3; $i++) $curver[$i] = (isset($curver[$i]) ? intval($curver[$i]) : 0);
$minver = explode(".", $strMinver); for ($i = 0; $i < 3; $i++) $minver[$i] = (isset($minver[$i]) ? intval($minver[$i]) : 0);
$maxver = explode(".", $strMaxver); for ($i = 0; $i < 3; $i++) $maxver[$i] = (isset($maxver[$i]) ? intval($maxver[$i]) : 0);
$curver = explode(".", $strCurver);
for ($i = 0; $i < 3; $i++)
{
$curver[$i] = (isset($curver[$i]) ? intval($curver[$i]) : 0);
}
$minver = explode(".", $strMinver);
for ($i = 0; $i < 3; $i++)
{
$minver[$i] = (isset($minver[$i]) ? intval($minver[$i]) : 0);
}
$maxver = explode(".", $strMaxver);
for ($i = 0; $i < 3; $i++)
{
$maxver[$i] = (isset($maxver[$i]) ? intval($maxver[$i]) : 0);
}
if (($minver[0]>0 || $minver[1]>0 || $minver[2]>0)
if (($minver[0] > 0 || $minver[1] > 0 || $minver[2] > 0)
&&
($curver[0]<$minver[0]
|| (($curver[0]==$minver[0]) && ($curver[1]<$minver[1]))
|| (($curver[0]==$minver[0]) && ($curver[1]==$minver[1]) && ($curver[2]<$minver[2]))
($curver[0] < $minver[0]
|| (($curver[0] == $minver[0]) && ($curver[1] < $minver[1]))
|| (($curver[0] == $minver[0]) && ($curver[1] == $minver[1]) && ($curver[2] < $minver[2]))
))
{
return false;
elseif (($maxver[0]>0 || $maxver[1]>0 || $maxver[2]>0)
}
elseif (($maxver[0] > 0 || $maxver[1] > 0 || $maxver[2] > 0)
&&
($curver[0]>$maxver[0]
|| (($curver[0]==$maxver[0]) && ($curver[1]>$maxver[1]))
|| (($curver[0]==$maxver[0]) && ($curver[1]==$maxver[1]) && ($curver[2]>=$maxver[2]))
($curver[0] > $maxver[0]
|| (($curver[0] == $maxver[0]) && ($curver[1] > $maxver[1]))
|| (($curver[0] == $maxver[0]) && ($curver[1] == $maxver[1]) && ($curver[2] >= $maxver[2]))
))
{
return false;
}
else
{
return true;
}
}
public static function Add2Log($sText, $sErrorCode = "")
{
$MAX_LOG_SIZE = 1000000;
$READ_PSIZE = 8000;
$LOG_FILE = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/install.log";
$LOG_FILE_TMP = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/install_tmp.log";
$LOG_FILE = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/install.log";
$LOG_FILE_TMP = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/install_tmp.log";
if ($sText == '' && $sErrorCode == '')
{
return;
}
$old_abort_status = ignore_user_abort(true);
@@ -427,18 +535,20 @@ class BXInstallServices
return false;
}
$iSeekLen = intval($log_size-$MAX_LOG_SIZE/2.0);
$iSeekLen = intval($log_size - $MAX_LOG_SIZE / 2.0);
fseek($fp, $iSeekLen);
do
{
$data = fread($fp, $READ_PSIZE);
if ($data == '')
{
break;
}
@fwrite($fp1, $data);
}
while(true);
while (true);
@fclose($fp);
@fclose($fp1);
@@ -453,7 +563,7 @@ class BXInstallServices
{
if (flock($fp, LOCK_EX))
{
@fwrite($fp, date("Y-m-d H:i:s")." - ".$sErrorCode." - ".$sText."\n");
@fwrite($fp, date("Y-m-d H:i:s") . " - " . $sErrorCode . " - " . $sText . "\n");
@fflush($fp);
@flock($fp, LOCK_UN);
@fclose($fp);
@@ -462,14 +572,12 @@ class BXInstallServices
ignore_user_abort($old_abort_status);
}
public static function ParseForSql($sqlString)
{
}
public static function GetConfigWizard()
{
if (isset($GLOBALS["arWizardConfig"]) && array_key_exists("demoWizardName", $GLOBALS["arWizardConfig"]) && CWizardUtil::CheckName($GLOBALS["arWizardConfig"]["demoWizardName"]))
{
return $GLOBALS["arWizardConfig"]["demoWizardName"];
}
return false;
}
@@ -477,10 +585,14 @@ class BXInstallServices
public static function GetDemoWizard()
{
if (!defined("B_PROLOG_INCLUDED"))
define("B_PROLOG_INCLUDED",true);
{
define("B_PROLOG_INCLUDED", true);
}
if(($demo = self::GetConfigWizard()) !== false)
if (($demo = self::GetConfigWizard()) !== false)
{
return $demo;
}
$arWizards = CWizardUtil::GetWizardList();
@@ -497,12 +609,18 @@ class BXInstallServices
$position = strpos($wizardID, ":");
if ($position !== false)
{
$wizardName = substr($wizardID, $position + 1);
}
else
{
$wizardName = $wizardID;
}
if ($wizardName == "demo")
{
return $wizardID;
}
}
return $defaultWizard;
@@ -511,27 +629,35 @@ class BXInstallServices
public static function GetWizardCharset($wizardName)
{
if (!defined("B_PROLOG_INCLUDED"))
define("B_PROLOG_INCLUDED",true);
{
define("B_PROLOG_INCLUDED", true);
}
$wizardPath = CWizardUtil::GetRepositoryPath().CWizardUtil::MakeWizardPath($wizardName);
if (!file_exists($_SERVER["DOCUMENT_ROOT"].$wizardPath."/.description.php"))
$wizardPath = CWizardUtil::GetRepositoryPath() . CWizardUtil::MakeWizardPath($wizardName);
if (!file_exists($_SERVER["DOCUMENT_ROOT"] . $wizardPath . "/.description.php"))
{
return false;
}
$arWizardDescription = Array();
include($_SERVER["DOCUMENT_ROOT"].$wizardPath."/.description.php");
$arWizardDescription = [];
include($_SERVER["DOCUMENT_ROOT"] . $wizardPath . "/.description.php");
if (array_key_exists("CHARSET", $arWizardDescription) && $arWizardDescription["CHARSET"] <> '')
{
return $arWizardDescription["CHARSET"];
}
return false;
}
public static function IsShortInstall()
{
$dbconnPath = $_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/dbconn.php";
$dbconnPath = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/dbconn.php";
if (!file_exists($dbconnPath))
{
return false;
}
@include($dbconnPath);
@@ -551,19 +677,23 @@ class BXInstallServices
{
$bCgi = (stristr(php_sapi_name(), "cgi") !== false);
$bFastCgi = ($bCgi && (array_key_exists('FCGI_ROLE', $_SERVER) || array_key_exists('FCGI_ROLE', $_ENV)));
if($bCgi && !$bFastCgi)
header("Status: ".$status);
if ($bCgi && !$bFastCgi)
{
header("Status: " . $status);
}
else
header($_SERVER["SERVER_PROTOCOL"]." ".$status);
{
header($_SERVER["SERVER_PROTOCOL"] . " " . $status);
}
}
public static function LocalRedirect($url)
{
global $HTTP_HOST, $SERVER_PORT;
$url = str_replace("&amp;","&",$url);
$url = str_replace ("\r", "", $url);
$url = str_replace ("\n", "", $url);
$url = str_replace("&amp;", "&", $url);
$url = str_replace("\r", "", $url);
$url = str_replace("\n", "", $url);
BXInstallServices::SetStatus("302 Found");
@@ -578,10 +708,12 @@ class BXInstallServices
}
else
{
if ($SERVER_PORT!="80" && $SERVER_PORT != 443 && $SERVER_PORT>0 && strpos($HTTP_HOST, ":".$SERVER_PORT) <= 0)
$HTTP_HOST .= ":".$SERVER_PORT;
if ($SERVER_PORT != "80" && $SERVER_PORT != 443 && $SERVER_PORT > 0 && strpos($HTTP_HOST, ":" . $SERVER_PORT) <= 0)
{
$HTTP_HOST .= ":" . $SERVER_PORT;
}
$protocol = ($_SERVER["SERVER_PORT"]==443 || strtolower($_SERVER["HTTPS"]) == "on" ? "https" : "http");
$protocol = ($_SERVER["SERVER_PORT"] == 443 || strtolower($_SERVER["HTTPS"]) == "on" ? "https" : "http");
header("Request-URI: $protocol://$HTTP_HOST$url");
header("Content-Location: $protocol://$HTTP_HOST$url");
@@ -590,11 +722,12 @@ class BXInstallServices
exit;
}
public static function SetSession()
{
if (!function_exists("session_start"))
{
return false;
}
session_start();
$_SESSION["session_check"] = "Y";
@@ -605,17 +738,19 @@ class BXInstallServices
public static function CheckSession()
{
if (!function_exists("session_start"))
{
return false;
}
session_start();
return ( isset($_SESSION["session_check"]) && $_SESSION["session_check"] == "Y" );
return (isset($_SESSION["session_check"]) && $_SESSION["session_check"] == "Y");
}
public static function GetWizardsSettings()
{
$arWizardConfig = [];
$configFile = $_SERVER["DOCUMENT_ROOT"]."/install.config";
$configFile = $_SERVER["DOCUMENT_ROOT"] . "/install.config";
require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/classes/general/xml.php');
@@ -647,109 +782,13 @@ class BXInstallServices
return $arWizardConfig;
}
public static function GetRegistrationKey($lic_key_user_name, $lic_key_user_surname, $lic_key_email, $DBType)
public static function GetRegistrationUrl(): string
{
$lic_site = $_SERVER["HTTP_HOST"];
if($lic_site == '')
$lic_site = "localhost";
$arClientModules = Array();
$handle = @opendir($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules");
if ($handle)
return match (LANGUAGE_ID)
{
while (false !== ($dir = readdir($handle)))
{
if (is_dir($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$dir)
&& $dir!="." && $dir!="..")
{
$module_dir = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$dir;
if (file_exists($module_dir."/install/index.php"))
{
$arClientModules[] = $dir;
}
}
}
closedir($handle);
}
$lic_edition = serialize($arClientModules);
if(LANGUAGE_ID == "ru")
$host = "www.1c-bitrix.ru";
else
$host = "www.bitrixsoft.com";
$maxUsers = 0;
$path = "/bsm_register_key.php";
$query = "sur_name=$lic_key_user_surname&first_name=$lic_key_user_name&email=$lic_key_email&site=$lic_site&modules=".urlencode($lic_edition)."&db=$DBType&lang=".LANGUAGE_ID."&bx=Y&max_users=".$maxUsers;
if(defined("install_license_type"))
$query .= "&cp_type=".install_license_type;
if(defined("install_edition"))
$query .= "&edition=".install_edition;
$page_content = "";
$fp = @fsockopen("ssl://" . $host, 443, $errnum, $errstr, 30);
if ($fp)
{
fputs($fp, "POST {$path} HTTP/1.1\r\n");
fputs($fp, "Host: {$host}\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded; charset=\"UTF-8\"\r\n");
fputs($fp, "User-Agent: bitrixKeyReq\r\n");
fputs($fp, "Content-length: " . strlen($query) . "\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $query."\r\n\r\n");
$headersEnded = 0;
while(!feof($fp))
{
$returned_data = fgets($fp, 128);
if($returned_data=="\r\n")
{
$headersEnded = 1;
}
if($headersEnded==1)
{
$page_content .= htmlspecialcharsbx($returned_data);
}
}
fclose($fp);
}
$arContent = explode("\n", $page_content);
$bOk = false;
$key = "";
foreach($arContent as $v)
{
if($v == "OK")
$bOk = true;
if(strlen($v) > 10)
$key = trim($v);
}
if($bOk && $key <> '')
return $key;
return false;
}
public static function CreateLicenseFile($licenseKey)
{
if ($licenseKey == '')
$licenseKey = "DEMO";
$filePath = $_SERVER["DOCUMENT_ROOT"]."/bitrix/license_key.php";
if (!$fp = @fopen($filePath, "wb"))
return false;
$fileContent = "<"."? \$"."LICENSE_KEY = \"".addslashes($licenseKey)."\"; ?".">";
if (!fwrite($fp, $fileContent))
return false;
@fclose($fp);
return true;
'en' => "https://store.bitrix24.com/profile/license-keys.php",
'de' => "https://store.bitrix24.de/profile/license-keys.php",
default => "https://www.1c-bitrix.ru/support/key_info.php",
};
}
}

File diff suppressed because it is too large Load Diff