function CWizard($wizardName) { $this->name = $wizardName; if (!CWizardUtil::CheckName($this->name)) { $this->SetError(GetMessage("MAIN_WIZARD_ERROR_WRONG_WIZ_NAME")); return; } $pathToWizard = CWizardUtil::MakeWizardPath($this->name); $this->path = CWizardUtil::GetRepositoryPath() . $pathToWizard; if (!file_exists($_SERVER["DOCUMENT_ROOT"] . $this->path) || !is_dir($_SERVER["DOCUMENT_ROOT"] . $this->path)) { $this->SetError(GetMessage("MAIN_WIZARD_ERROR_NOT_FOUND")); return; } $this->__GetDescription(); $this->__CheckDepends(); $this->__GetInstallationScript(); }
function CopyWizard($wizardName, $newName) { if (!CWizardUtil::CheckName($wizardName) || !CWizardUtil::CheckName($newName)) { return false; } $wizardPath = $_SERVER["DOCUMENT_ROOT"] . CWizardUtil::GetRepositoryPath() . CWizardUtil::MakeWizardPath($wizardName); $newNamePath = $_SERVER["DOCUMENT_ROOT"] . CWizardUtil::GetRepositoryPath() . CWizardUtil::MakeWizardPath($newName); if (!file_exists($wizardPath) || file_exists($newNamePath)) { return false; } CopyDirFiles($wizardPath, $newNamePath, $rewrite = false, $recursive = true); return true; }
function GetDemoWizard() { if (!defined("B_PROLOG_INCLUDED")) { define("B_PROLOG_INCLUDED", true); } if (isset($GLOBALS["arWizardConfig"]) && array_key_exists("demoWizardName", $GLOBALS["arWizardConfig"]) && CWizardUtil::CheckName($GLOBALS["arWizardConfig"]["demoWizardName"])) { return $GLOBALS["arWizardConfig"]["demoWizardName"]; } $arWizards = CWizardUtil::GetWizardList(); $defaultWizard = false; foreach ($arWizards as $arWizard) { $wizardID = $arWizard["ID"]; if ($wizardID == "bitrix:demo") { $defaultWizard = "bitrix:demo"; continue; } $position = strpos($wizardID, ":"); if ($position !== false) { $wizardName = substr($wizardID, $position + 1); } else { $wizardName = $wizardID; } if ($wizardName == "demo") { return $wizardID; } } return $defaultWizard; }