function OnPostForm() { $wizard =& $this->GetWizard(); $serviceID = $wizard->GetVar("nextStep"); $serviceStage = $wizard->GetVar("nextStepStage"); if ($serviceID == "finish") { $wizard->SetCurrentStep("finish"); return; } $defSiteName = GetMessage("MAIN_DEFAULT_SITE_NAME"); $wizard->GetVar("siteName"); if ($wizard->GetVar("siteName") != "") { $defSiteName = $wizard->GetVar("siteName"); } $res = false; $site_id = $wizard->GetVar("siteID"); if ($site_id != "") { $db_res = CSite::GetList($by = "sort", $order = "desc", array("LID" => $site_id)); if ($db_res) { $res = $db_res->Fetch(); } } if ($res) { $obSite = new CSite(); $result = $obSite->Update($site_id, array("NAME" => $defSiteName, "SITE_NAME" => $defSiteName)); } elseif ($res && $res["NAME"] == GetMessage("MAIN_DEFAULT_SITE_NAME")) { $SiteNAME = $defSiteName . " (" . GetMessage("MAIN_DEFAULT_SITE_NAME") . ")"; $obSite = new CSite(); $result = $obSite->Update($site_id, array("NAME" => $SiteNAME, "SITE_NAME" => $defSiteName)); } $arServices = WizardServices::GetServices($_SERVER["DOCUMENT_ROOT"] . $wizard->GetPath(), "/site/services/"); if ($_SERVER["PHP_SELF"] == "/index.php" && !NON_INTRANET_EDITION) { $arEditions = array("Portal"); if (EDITION == "E" || EDITION == "C" || EDITION == "H") { $arEditions[] = "Communications"; } if (EDITION == "E" || EDITION == "H") { $arEditions[] = "Enterprise"; } if (EDITION == "H") { $arEditions[] = "Holding"; } CBXFeatures::InitiateEditionsSettings($arEditions); if ($wizard->GetVar("allowSocial") != "Y") { $ar = array("Friends", "PersonalPhoto", "PersonalForum", "Blog", "Forum", "Gallery"); foreach ($ar as $f) { CBXFeatures::SetFeatureEnabled($f, false); } } CBXFeatures::SetFeatureEnabled("Analytics", false); } //define("WIZARD_IS_RERUN", $_SERVER["PHP_SELF"] != "/index.php"); if ($_SERVER["PHP_SELF"] != "/index.php") { unset($arServices["users"]); unset($arServices["iblock_demo_data"]); unset($arServices["medialibrary"]); if ($wizard->GetVar("installDemoData") != "Y") { $s = array(); foreach ($arServices["main"]["STAGES"] as $v) { if (!in_array($v, array("property.php", "options.php"))) { $s[] = $v; } } $arServices["main"]["STAGES"] = $s; //unset($arServices["forum"]); //unset($arServices["search"]); //unset($arServices["files"]); //unset($arServices["iblock"]); //unset($arServices["advertising"]); //unset($arServices["vote"]); //unset($arServices["learning"]); //unset($arServices["form"]); //unset($arServices["subscribe"]); //unset($arServices["blog"]); //unset($arServices["socialnetwork"]); //unset($arServices["intranet"]); //unset($arServices["support"]); //unset($arServices["workflow"]); //unset($arServices["fileman"]); //unset($arServices["statistic"]); } } if ($serviceStage == "skip") { $success = true; } else { $success = $this->InstallService($serviceID, $serviceStage); } list($nextService, $nextServiceStage, $stepsComplete, $status) = $this->GetNextStep($arServices, $serviceID, $serviceStage); if ($nextService == "finish") { if (LANGUAGE_ID != "ru") { CBXFeatures::SetFeatureEnabled("Salary", false); } $formName = $wizard->GetFormName(); $response = "window.ajaxForm.StopAjax(); window.ajaxForm.SetStatus('100'); window.ajaxForm.Post('" . $nextService . "', '" . $nextServiceStage . "','" . $status . "');"; } else { $arServiceID = array_keys($arServices); $lastService = array_pop($arServiceID); $stepsCount = $arServices[$lastService]["POSITION"]; if (array_key_exists("STAGES", $arServices[$lastService]) && is_array($arServices[$lastService])) { $stepsCount += count($arServices[$lastService]["STAGES"]) - 1; } $percent = round($stepsComplete / $stepsCount * 100); $response = "window.ajaxForm.SetStatus('" . $percent . "'); window.ajaxForm.Post('" . $nextService . "', '" . $nextServiceStage . "','" . $status . "');"; } die("[response]" . $response . "[/response]"); }