示例#1
0
//echo "WIZARD_TEMPLATE_ID=".WIZARD_TEMPLATE_ID." | ";
//echo "WIZARD_TEMPLATE_RELATIVE_PATH=".WIZARD_TEMPLATE_RELATIVE_PATH." | ";
//echo "WIZARD_TEMPLATE_ABSOLUTE_PATH=".WIZARD_TEMPLATE_ABSOLUTE_PATH." | ";
//echo "WIZARD_THEME_ID=".WIZARD_THEME_ID." | ";
//echo "WIZARD_THEME_RELATIVE_PATH=".WIZARD_THEME_RELATIVE_PATH." | ";
//echo "WIZARD_THEME_ABSOLUTE_PATH=".WIZARD_THEME_ABSOLUTE_PATH." | ";
//echo "WIZARD_SERVICE_RELATIVE_PATH=".WIZARD_SERVICE_RELATIVE_PATH." | ";
//echo "WIZARD_SERVICE_ABSOLUTE_PATH=".WIZARD_SERVICE_ABSOLUTE_PATH." | ";
//echo "WIZARD_IS_RERUN=".WIZARD_IS_RERUN." | ";
//die();
if (!defined("WIZARD_TEMPLATE_ID")) {
    return;
}
if (in_array(WIZARD_TEMPLATE_ID, array("bright_extranet", "classic_extranet", "modern_extranet"))) {
    $bitrixTemplateDir = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/";
    CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . CExtranetWizardServices::GetTemplatesPath(WIZARD_RELATIVE_PATH . "/site") . "/" . WIZARD_TEMPLATE_ID, $bitrixTemplateDir . WIZARD_TEMPLATE_ID, $rewrite = true, $recursive = true);
    $logo = WIZARD_SITE_LOGO;
    $logo = intval($logo) ? CFile::GetPath($logo) : '/bitrix/templates/' . WIZARD_TEMPLATE_ID . '/images/default_logo.gif';
    CWizardUtil::ReplaceMacros($bitrixTemplateDir . WIZARD_TEMPLATE_ID . '/include_areas/company_name.php', array("SITE_DIR" => WIZARD_SITE_DIR, "COMPANY_NAME" => WIZARD_SITE_NAME, "COMPANY_LOGO" => $logo));
    CWizardUtil::ReplaceMacros($bitrixTemplateDir . WIZARD_TEMPLATE_ID . '/header.php', array("SITE_DIR" => WIZARD_SITE_DIR));
    CWizardUtil::ReplaceMacros($bitrixTemplateDir . WIZARD_TEMPLATE_ID . '/footer.php', array("SITE_DIR" => WIZARD_SITE_DIR));
    COption::SetOptionString("main", "wizard_template_id_extranet", WIZARD_TEMPLATE_ID);
} else {
    COption::SetOptionString("main", "wizard_template_id_extranet", "current_intranet_template");
}
//Attach template to  site
$obSite = CSite::GetList($by = "def", $order = "desc", array("LID" => WIZARD_SITE_ID));
if ($arSite = $obSite->Fetch()) {
    $arTemplates = array();
    $found = false;
    $foundEmpty = false;
示例#2
0
 function InstallService($serviceID, $serviceStage)
 {
     $wizard =& $this->GetWizard();
     $siteID = COption::GetOptionString("main", "wizard_site_code_extranet");
     $siteFolder = COption::GetOptionString("main", "wizard_site_folder_extranet");
     $siteName = COption::GetOptionString("main", "wizard_site_name_extranet");
     if (COption::GetOptionString("main", "wizard_extranet_rerun") == "Y") {
         define("WIZARD_IS_RERUN", true);
     }
     if (WIZARD_IS_RERUN === true) {
         $rsSites = CSite::GetByID(COption::GetOptionString("extranet", "extranet_site"));
         if ($arSite = $rsSites->Fetch()) {
             define("WIZARD_SITE_ID", $arSite["ID"]);
             define("WIZARD_SITE_DIR", $arSite["DIR"]);
             define("WIZARD_SITE_NAME", $siteName);
             define("WIZARD_SITE_PATH", $_SERVER["DOCUMENT_ROOT"] . $arSite["DIR"]);
             $bFound = true;
         }
     }
     if (!$bFound) {
         define("WIZARD_SITE_ID", $siteID);
         define("WIZARD_SITE_DIR", $siteFolder);
         define("WIZARD_SITE_NAME", $siteName);
         define("WIZARD_SITE_PATH", $_SERVER["DOCUMENT_ROOT"] . $siteFolder);
     }
     $wizardPath = $wizard->GetPath();
     define("WIZARD_RELATIVE_PATH", $wizardPath);
     define("WIZARD_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . $wizardPath);
     $templatesPath = "";
     $templatesPath = CExtranetWizardServices::GetTemplatesPath(WIZARD_RELATIVE_PATH . "/site");
     $arTemplates = CExtranetWizardServices::GetTemplates($templatesPath);
     $templateID = $wizard->GetVar("templateID");
     if ($templateID == "current_intranet_template") {
         $rsDefSiteTemplates = CSite::GetTemplateList(CSite::GetDefSite());
         while ($arDefSiteTemplates = $rsDefSiteTemplates->Fetch()) {
             if ($arDefSiteTemplates["CONDITION"] == "") {
                 $templateID = $arDefSiteTemplates["TEMPLATE"];
                 break;
             }
         }
     }
     define("WIZARD_TEMPLATE_ID", $templateID);
     if (in_array($templateID, array("bright_extranet", "classic_extranet", "modern_extranet"))) {
         define("WIZARD_TEMPLATE_RELATIVE_PATH", $templatesPath . "/" . WIZARD_TEMPLATE_ID);
         define("WIZARD_TEMPLATE_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . WIZARD_TEMPLATE_RELATIVE_PATH);
         $themeID = $wizard->GetVar($templateID . "_themeID");
         $arThemes = CExtranetWizardServices::GetThemes(WIZARD_TEMPLATE_RELATIVE_PATH . "/themes");
         define("WIZARD_THEME_ID", $themeID);
         define("WIZARD_THEME_RELATIVE_PATH", WIZARD_TEMPLATE_RELATIVE_PATH . "/themes/" . WIZARD_THEME_ID);
         define("WIZARD_THEME_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . WIZARD_THEME_RELATIVE_PATH);
     }
     $servicePath = WIZARD_RELATIVE_PATH . "/site/services/" . $serviceID;
     define("WIZARD_SERVICE_RELATIVE_PATH", $servicePath);
     define("WIZARD_SERVICE_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . $servicePath);
     $b24ToCp = file_exists(WIZARD_SITE_PATH . ".superleft.menu.php") ? true : false;
     define("WIZARD_B24_TO_CP", $b24ToCp);
     define("WIZARD_SITE_LOGO", intval($wizard->GetVar("siteLogo")));
     if (!file_exists(WIZARD_SERVICE_ABSOLUTE_PATH . "/" . $serviceStage)) {
         return false;
     }
     if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru") {
         if (file_exists(WIZARD_SERVICE_ABSOLUTE_PATH . "/lang/en/" . $serviceStage)) {
             __IncludeLang(WIZARD_SERVICE_ABSOLUTE_PATH . "/lang/en/" . $serviceStage);
         }
     }
     $dbGroups = CGroup::GetList($by = "id", $order = "asc", array("ACTIVE" => "Y"));
     while ($arGroup = $dbGroups->Fetch()) {
         define("WIZARD_" . $arGroup["STRING_ID"] . "_GROUP", $arGroup["ID"]);
     }
     if (file_exists(WIZARD_SERVICE_ABSOLUTE_PATH . "/lang/" . LANGUAGE_ID . "/" . $serviceStage)) {
         __IncludeLang(WIZARD_SERVICE_ABSOLUTE_PATH . "/lang/" . LANGUAGE_ID . "/" . $serviceStage);
     }
     @set_time_limit(3600);
     global $DB, $DBType, $APPLICATION, $USER, $CACHE_MANAGER;
     include WIZARD_SERVICE_ABSOLUTE_PATH . "/" . $serviceStage;
 }