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; }
{ if ( !($_SERVER["REQUEST_METHOD"]=="POST" && $_POST["action"]=="import" && $isAdmin && check_freetrix_sessid()) ) break; if (!is_uploaded_file($_FILES["wizardFile"]["tmp_name"])) { $strError .= GetMessage("MAIN_WIZARD_LOAD_ERROR_LOAD"); break; } elseif(GetFileExtension(strtolower($_FILES["wizardFile"]["name"])) != "gz") { $strError .= GetMessage("MAIN_WIZARD_TAR_GZ"); break; } $wizardPath = $_SERVER["DOCUMENT_ROOT"].CWizardUtil::GetRepositoryPath(); require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/classes/general/tar_gz.php"); $oArchiver = new CArchiver($_FILES["wizardFile"]["tmp_name"]); if (!$oArchiver->extractFiles($wizardPath)) { $strError .= GetMessage("MAIN_WIZARD_IMPORT_ERROR"); $arErrors = &$oArchiver->GetErrors(); if(count($arErrors)>0) { $strError .= ":<br>"; foreach ($arErrors as $value) $strError .= "[".$value[0]."] ".$value[1]."<br>"; } else
function GetWizardCharset($wizardName) { if (!defined("B_PROLOG_INCLUDED")) { define("B_PROLOG_INCLUDED", true); } $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"; if (array_key_exists("CHARSET", $arWizardDescription) && strlen($arWizardDescription["CHARSET"]) > 0) { return $arWizardDescription["CHARSET"]; } return false; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/extranet/classes/general/wizard_utils.php"; $arTemplates = array(); $templatesPath = CWizardUtil::GetRepositoryPath() . CWizardUtil::MakeWizardPath("bitrix:extranet") . "/site/templates"; $arTemplates = CExtranetWizardServices::GetTemplates($templatesPath); $arSteps = array("WelcomeStep"); if (!empty($arTemplates)) { $arSteps[] = "SelectTemplateStep"; $arSteps[] = "SelectThemeStep"; } $arSteps[] = "SiteSettingsStep"; $arSteps[] = "DataInstallStep"; $arSteps[] = "FinishStep"; $arWizardDescription = array("NAME" => GetMessage("EXTRANET_WIZARD_NAME"), "DESCRIPTION" => GetMessage("EXTRANET_WIZARD_DESC"), "VERSION" => "1.0.0", "START_TYPE" => "WINDOW", "TEMPLATES" => array(array("SCRIPT" => "scripts/template.php", "CLASS" => "ExtranetWizardTemplate")), "STEPS" => $arSteps);
IncludeModuleLangFile(__FILE__); $ID = $_REQUEST["ID"]; $ID = str_replace("\\", "", $ID); $ID = str_replace("/", "", $ID); $bUseCompression = true; if (!extension_loaded('zlib') || !function_exists("gzcompress")) { $bUseCompression = false; } $HTTP_ACCEPT_ENCODING = ""; CheckDirPath($_SERVER['DOCUMENT_ROOT'] . BX_PERSONAL_ROOT . "/tmp/wizards/"); $tempFile = $_SERVER['DOCUMENT_ROOT'] . BX_PERSONAL_ROOT . "/tmp/wizards/" . md5(uniqid(rand(), true) . ".tar.gz"); $wizardPath = $_SERVER["DOCUMENT_ROOT"] . CWizardUtil::GetRepositoryPath() . CWizardUtil::MakeWizardPath($ID); $strError = ""; if (is_dir($wizardPath)) { $oArchiver = new CArchiver($tempFile, $bUseCompression); $success = $oArchiver->add("\"" . $wizardPath . "\"", false, $_SERVER["DOCUMENT_ROOT"] . CWizardUtil::GetRepositoryPath()); if ($success) { header('Pragma: public'); header('Cache-control: private'); header('Accept-Ranges: bytes'); header("Content-Length: " . filesize($tempFile)); header("Content-Type: application/x-force-download; filename=" . str_replace(":", "-", $ID) . ".tar.gz"); header("Content-Disposition: attachment; filename=\"" . str_replace(":", "-", $ID) . ".tar.gz\""); header("Content-Transfer-Encoding: binary"); readfile($tempFile); unlink($tempFile); } else { $strError .= GetMessage("MAIN_WIZARD_EXPORT_ERROR"); $arErrors =& $oArchiver->GetErrors(); if (count($arErrors) > 0) { $strError .= ":<br>";