Example #1
0
 function InstallFiles($site_dir = "/", $default_site_id = false)
 {
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/eshopapp/install/components", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", true, true);
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/eshopapp/install/templates/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/templates/", true, true);
     if (!$default_site_id) {
         $default_site_id = CSite::GetDefSite();
     }
     if ($default_site_id) {
         $arAppTempalate = array("SORT" => 1, "CONDITION" => "CSite::InDir('" . $site_dir . "eshop_app/')", "TEMPLATE" => "eshop_app");
         $arFields = array("TEMPLATE" => array());
         $dbTemplates = CSite::GetTemplateList($default_site_id);
         $eshopAppFound = false;
         while ($template = $dbTemplates->Fetch()) {
             if ($template["TEMPLATE"] == "eshop_app") {
                 $eshopAppFound = true;
                 $template = $arAppTempalate;
             }
             $arFields["TEMPLATE"][] = array("TEMPLATE" => $template['TEMPLATE'], "SORT" => $template['SORT'], "CONDITION" => $template['CONDITION']);
         }
         if (!$eshopAppFound) {
             $arFields["TEMPLATE"][] = $arAppTempalate;
         }
         $obSite = new CSite();
         $arFields["LID"] = $default_site_id;
         $obSite->Update($default_site_id, $arFields);
     }
     return true;
 }
Example #2
0
 function InstallFiles()
 {
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mobile/public/mobile/", $_SERVER["DOCUMENT_ROOT"] . "/mobile/", True, True);
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mobile/install/templates/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/templates/", True, True);
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mobile/install/components/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", true, true);
     $default_site_id = CSite::GetDefSite();
     if ($default_site_id) {
         $arAppTempalate = array("SORT" => 1, "CONDITION" => "CSite::InDir('/mobile/')", "TEMPLATE" => "mobile_app");
         $arFields = array("TEMPLATE" => array());
         $dbTemplates = CSite::GetTemplateList($default_site_id);
         $mobileAppFound = false;
         while ($template = $dbTemplates->Fetch()) {
             if ($template["TEMPLATE"] == "mobile_app") {
                 $mobileAppFound = true;
                 $template = $arAppTempalate;
             }
             $arFields["TEMPLATE"][] = array("TEMPLATE" => $template['TEMPLATE'], "SORT" => $template['SORT'], "CONDITION" => $template['CONDITION']);
         }
         if (!$mobileAppFound) {
             $arFields["TEMPLATE"][] = $arAppTempalate;
         }
         $obSite = new CSite();
         $arFields["LID"] = $default_site_id;
         $obSite->Update($default_site_id, $arFields);
     }
     CUrlRewriter::ReindexFile("/mobile/webdav/index.php");
     CUrlRewriter::ReindexFile("/mobile/disk/index.php");
     CUrlRewriter::Add(array("CONDITION" => "#^/mobile/disk/(?<hash>[0-9]+)/download#", "RULE" => "download=1&objectId=\$1", "ID" => "bitrix:mobile.disk.file.detail", "PATH" => "/mobile/disk/index.php"));
     return true;
 }
Example #3
0
 function OnPostForm()
 {
     $wizard =& $this->GetWizard();
     $serviceID = $wizard->GetVar("nextStep");
     $serviceStage = $wizard->GetVar("nextStepStage");
     if ($serviceID == "finish") {
         $wizard->SetCurrentStep("finish");
         return;
     }
     $defSiteName = GetMessage("wiz_site_default_name");
     if (GetMessage("wiz_site_name") != "") {
         $defSiteName = GetMessage("wiz_site_name");
     } elseif ($wizard->wizardName != "") {
         $defSiteName = $wizard->wizardName;
     }
     $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 ($wizard->GetVar("siteCreate") == "Y") {
         if (!$res) {
             $arFields = array("LID" => $site_id, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => $defSiteName, "DIR" => $wizard->GetVar("siteFolder"), "FORMAT_DATE" => LANGUAGE_ID == "en" ? "MM/DD/YYYY" : "DD.MM.YYYY", "FORMAT_DATETIME" => LANGUAGE_ID == "en" ? "MM/DD/YYYY H:MI T" : "DD.MM.YYYY HH:MI:SS", "FORMAT_NAME" => CSite::GetDefaultNameFormat(), "CHARSET" => defined("BX_UTF") ? "UTF-8" : (LANGUAGE_ID == "ru" ? "windows-1251" : "ISO-8859-1"), "SITE_NAME" => $defSiteName, "SERVER_NAME" => $_SERVER["SERVER_NAME"], "EMAIL" => COption::GetOptionString("main", "email_from"), "LANGUAGE_ID" => LANGUAGE_ID, "DOC_ROOT" => "");
             $obSite = new CSite();
             $result = $obSite->Add($arFields);
             if ($result) {
             } else {
                 echo $obSite->LAST_ERROR;
                 die;
             }
         }
         $wizard->SetVar("siteCreate", "N");
     }
     $pattern = '/^(.*):(.*)\\((.*)\\)/';
     preg_match($pattern, $res["NAME"], $matches);
     if ($res && (count($matches) > 0 || $res["NAME"] == $site_id) && $site_id != "s1") {
         $templateID = $wizard->GetVar("templateID");
         $themeVarName = $templateID . "_themeID";
         $themeID = $wizard->GetVar($themeVarName);
         $templatesPath = WizardServices::GetTemplatesPath($wizard->GetPath() . "/site");
         $arTemplates = WizardServices::GetTemplates($templatesPath);
         $templatesPath = WizardServices::GetTemplatesPath($wizard->GetPath() . "/site");
         $arThemes = WizardServices::GetThemes($templatesPath . "/" . $templateID . "/themes", $templatesPath . "/" . $templateID);
         $siteNemNew = $defSiteName . ": " . $arTemplates[$templateID]["NAME"] . ' (' . $arThemes[$themeID]["NAME"] . ')';
         $obSite = new CSite();
         $result = $obSite->Update($site_id, array("NAME" => $siteNemNew, "SITE_NAME" => $siteNemNew));
     } elseif ($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));
     }
     CModule::IncludeModule('fileman');
     COption::SetOptionString("fileman", "different_set", "Y");
     $arMenuTypes = GetMenuTypes($site_id);
     if (count($arMenuTypes) == 0) {
         $arMenuTypes = array('left' => GetMessage("WIZ_MENU_LEFT"), 'top' => GetMessage("WIZ_MENU_TOP"), 'bottom' => GetMessage("WIZ_MENU_BOTTOM"));
     } else {
         if (!$arMenuTypes['left'] || $arMenuTypes['left'] == GetMessage("WIZ_MENU_LEFT_DEFAULT")) {
             $arMenuTypes['left'] = GetMessage("WIZ_MENU_LEFT");
         }
         if (!$arMenuTypes['top'] || $arMenuTypes['top'] == GetMessage("WIZ_MENU_TOP_DEFAULT")) {
             $arMenuTypes['top'] = GetMessage("WIZ_MENU_TOP");
         }
         if (!$arMenuTypes['bottom']) {
             $arMenuTypes['bottom'] = GetMessage("WIZ_MENU_BOTTOM");
         }
     }
     SetMenuTypes($arMenuTypes, $site_id);
     $arServices = WizardServices::GetServices($_SERVER["DOCUMENT_ROOT"] . $wizard->GetPath(), "/site/services/");
     $this->CorrectServices($arServices);
     if ($serviceStage == "skip") {
         $success = true;
     } else {
         $success = $this->InstallService($serviceID, $serviceStage);
     }
     if (!$this->repeatCurrentService) {
         list($nextService, $nextServiceStage, $stepsComplete, $status) = $this->GetNextStep($arServices, $serviceID, $serviceStage);
     }
     if ($nextService == "finish") {
         $formName = $wizard->GetFormName();
         $response = "window.ajaxForm.StopAjax(); window.ajaxForm.SetStatus('100'); window.ajaxForm.Post('" . $nextService . "', '" . $nextServiceStage . "','" . $status . "');";
         COption::SetOptionString("main", "wizard_first" . substr($wizard->GetID(), 7) . "_" . $wizard->GetVar("siteID"), "Y", false, $siteID);
     } 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]");
 }
Example #4
0
if (!defined("WIZARD_TEMPLATE_ID")) {
    return;
}
$bitrixTemplateDir = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . WIZARD_TEMPLATE_ID;
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . WizardServices::GetTemplatesPath(WIZARD_RELATIVE_PATH . "/site") . "/" . WIZARD_TEMPLATE_ID, $bitrixTemplateDir, $rewrite = true, $recursive = true, $delete_after_copy = false);
//Attach template to default site
$obSite = CSite::GetList($by = "def", $order = "desc", array("LID" => WIZARD_SITE_ID));
if ($arSite = $obSite->Fetch()) {
    $arTemplates = array();
    $found = false;
    $foundEmpty = false;
    $obTemplate = CSite::GetTemplateList($arSite["LID"]);
    while ($arTemplate = $obTemplate->Fetch()) {
        if (!$found && strlen(trim($arTemplate["CONDITION"])) <= 0) {
            $arTemplate["TEMPLATE"] = WIZARD_TEMPLATE_ID;
            $found = true;
        }
        if ($arTemplate["TEMPLATE"] == "empty") {
            $foundEmpty = true;
            continue;
        }
        $arTemplates[] = $arTemplate;
    }
    if (!$found) {
        $arTemplates[] = array("CONDITION" => "", "SORT" => 150, "TEMPLATE" => WIZARD_TEMPLATE_ID);
    }
    $arFields = array("TEMPLATE" => $arTemplates, "NAME" => $arSite["NAME"]);
    $obSite = new CSite();
    $obSite->Update($arSite["LID"], $arFields);
}
COption::SetOptionString("main", "wizard_template_id", WIZARD_TEMPLATE_ID, false, WIZARD_SITE_ID);
Example #5
0
		COption::SetOptionString("eshop", "shopFIO_ua", $shopFIO_ua, false, WIZARD_SITE_ID);
		$shopTax_ua = $wizard->GetVar("shopTax_ua");
		COption::SetOptionString("eshop", "shopTax_ua", $shopTax_ua, false, WIZARD_SITE_ID);
	}

	$siteTelephone = $wizard->GetVar("siteTelephone");
	COption::SetOptionString("eshop", "siteTelephone", $siteTelephone, false, WIZARD_SITE_ID);
	$shopEmail = $wizard->GetVar("shopEmail");
	COption::SetOptionString("eshop", "shopEmail", $shopEmail, false, WIZARD_SITE_ID);
	$siteName = $wizard->GetVar("siteName");
	COption::SetOptionString("eshop", "siteName", $siteName, false, WIZARD_SITE_ID);
		
	$obSite = new CSite;
	$obSite->Update(WIZARD_SITE_ID, Array(
			"EMAIL" => $shopEmail,
			"SITE_NAME" => $siteName,
			"SERVER_NAME" => $_SERVER["SERVER_NAME"],
		));
	
	if(strlen($siteStamp)>0)
	{
		if(IntVal($siteStamp) > 0)
		{
			$ff = CFile::GetByID($siteStamp);
			if($zr = $ff->Fetch())
			{
				$strOldFile = str_replace("//", "/", WIZARD_SITE_ROOT_PATH."/".(COption::GetOptionString("main", "upload_dir", "upload"))."/".$zr["SUBDIR"]."/".$zr["FILE_NAME"]);
				@copy($strOldFile, WIZARD_SITE_PATH."include/stamp.gif");
				CFile::Delete($zr["ID"]);
				$siteStamp = WIZARD_SITE_DIR."include/stamp.gif";
				COption::SetOptionString("eshop", "siteStamp", $siteStamp, false, WIZARD_SITE_ID);
Example #6
0
	function __InstallTemplate($templateID)
	{
		if (!array_key_exists($templateID, $this->arTemplates))
			return;

		//Copy template
		$canCopyTemplate = !(
			file_exists($_SERVER["DOCUMENT_ROOT"].FX_PERSONAL_ROOT."/templates/".$templateID) &&
			isset($this->arTemplates[$templateID]["REWRITE"]) && $this->arTemplates[$templateID]["REWRITE"] == "N"
		);

		//If the main module was not included
		global $DB, $DBType, $APPLICATION, $USER;
		require_once($_SERVER['DOCUMENT_ROOT']."/freetrix/modules/main/include.php");

		if ($canCopyTemplate)
		{
			CopyDirFiles(
				$_SERVER["DOCUMENT_ROOT"].$this->__GetTemplatesPath()."/".$templateID,
				$_SERVER["DOCUMENT_ROOT"].FX_PERSONAL_ROOT."/templates/".$templateID,
				$rewrite = true,
				$recursive = true
			);
		}

		//Attach template to default site
		$obSite = CSite::GetList($by = "def", $order = "desc", Array("ACTIVE" => "Y"));
		if ($arSite = $obSite->Fetch())
		{
			$arTemplates = Array();
			$found = false;
			$obTemplate = CSite::GetTemplateList($arSite["LID"]);
			while($arTemplate = $obTemplate->Fetch())
			{
				if(!$found && strlen(Trim($arTemplate["CONDITION"]))<=0)
				{
					$arTemplate["TEMPLATE"] = $templateID;
					$found = true;
				}
				$arTemplates[]= $arTemplate;
			}

			if (!$found)
				$arTemplates[]= Array("CONDITION" => "", "SORT" => 150, "TEMPLATE" => $templateID);

			$arFields = Array(
				"TEMPLATE" => $arTemplates,
				"NAME" => $arSite["NAME"],
			);

			$obSite = new CSite();
			$obSite->Update($arSite["LID"], $arFields);
		}

		//Copy files
		$this->__MoveDirFiles($this->arTemplates[$templateID]);
	}
Example #7
0
 function InstallFiles()
 {
     if ($_ENV['COMPUTERNAME'] != 'BX') {
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/im/install/js", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/js", true, true);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/im/install/components", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", true, true);
         CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/im/install/activities', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/activities', true, true);
         CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/im/install/admin', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin', true, true);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/im/install/templates", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/templates", True, True);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/im/install/public", $_SERVER["DOCUMENT_ROOT"] . "/", True, True);
         $default_site_id = CSite::GetDefSite();
         if ($default_site_id) {
             $arAppTempalate = array("SORT" => 1, "CONDITION" => "CSite::InDir('/desktop_app/')", "TEMPLATE" => "desktop_app");
             $arFields = array("TEMPLATE" => array());
             $dbTemplates = CSite::GetTemplateList($default_site_id);
             $desktopAppFound = false;
             while ($template = $dbTemplates->Fetch()) {
                 if ($template["TEMPLATE"] == "desktop_app") {
                     $desktopAppFound = true;
                     $template = $arAppTempalate;
                 }
                 $arFields["TEMPLATE"][] = array("TEMPLATE" => $template['TEMPLATE'], "SORT" => $template['SORT'], "CONDITION" => $template['CONDITION']);
             }
             if (!$desktopAppFound) {
                 $arFields["TEMPLATE"][] = $arAppTempalate;
             }
             $obSite = new CSite();
             $arFields["LID"] = $default_site_id;
             $obSite->Update($default_site_id, $arFields);
         }
         $GLOBALS["APPLICATION"]->SetFileAccessPermission('/desktop_app/', array("*" => "R"));
     }
     return true;
 }
Example #8
0
 /**
  * Binds (and creates if it's necessary) template to the application folder
  *
  * @param $templateId - symbolic code of the template
  * @param $folder - the application folder
  * @param bool $createNew - flag of the necessity of creating a new template
  */
 public static function bindTemplate($templateId, $folder, $createNew)
 {
     $arFields = array("TEMPLATE" => array());
     if ($createNew) {
         CopyDirFiles(Application::getDocumentRoot() . "/bitrix/modules/mobileapp/templates/default_app/", Application::getDocumentRoot() . "/bitrix/templates/" . $templateId, True, True);
         File::putFileContents(Application::getDocumentRoot() . "/bitrix/templates/" . $templateId . "/description.php", str_replace(array("#mobile_template_name#"), array($templateId), File::getFileContents(Application::getDocumentRoot() . "/bitrix/templates/" . $templateId . "/description.php")));
         $arFields["TEMPLATE"][] = array("SORT" => 1, "CONDITION" => "CSite::InDir('/" . $folder . "/')", "TEMPLATE" => $templateId);
     }
     $default_site_id = \CSite::GetDefSite();
     if ($default_site_id) {
         $dbTemplates = \CSite::GetTemplateList($default_site_id);
         $arFields["LID"] = $default_site_id;
         $isTemplateFound = false;
         while ($template = $dbTemplates->Fetch()) {
             $arFields["TEMPLATE"][] = array("TEMPLATE" => $template['TEMPLATE'], "SORT" => $template['SORT'], "CONDITION" => $template['CONDITION']);
             if ($template["TEMPLATE"] == $templateId && !$createNew && !$isTemplateFound) {
                 $isTemplateFound = true;
                 $arFields["TEMPLATE"][] = array("SORT" => 1, "CONDITION" => "CSite::InDir('/" . $folder . "/')", "TEMPLATE" => $templateId);
             }
         }
         $obSite = new \CSite();
         $obSite->Update($default_site_id, $arFields);
     }
 }
Example #9
0
 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]");
 }
Example #10
0
								{
									$v["TEMPLATE"] = $ID;
									$bW = true;
								}
								$arTemplates[]= $v;
							}

							if(!$bW)
								$arTemplates[]= Array('CONDITION' => '', 'SORT' => 150, 'TEMPLATE' => $ID);

							$arFields = array(
								"TEMPLATE" => $arTemplates,
								"NAME" => $ar_site["NAME"],
							);
							$ob_site = new CSite();
							$ob_site->Update($SITE_ID, $arFields);
						}
					}
				}
				else
				{
					$strError .= GetMessage("MAIN_T_EDIT_IMP_ERR");
					$arErrors = &$oArchiver->GetErrors();
					if(count($arErrors)>0)
					{
						$strError .= ":<br>";
						foreach ($arErrors as $value)
							$strError .= "[".$value[0]."] ".$value[1]."<br>";
					}
					else
						$strError .= ".<br>";
Example #11
0
 private static function OnExtranetSettingsChange($_2009704874, $_888882404)
 {
     $_227964291 = COption::$GLOBALS['_____266107269'][67]("extranet", "extranet_site", "");
     if ($_227964291) {
         $_830904240 = new CSite();
         $_830904240->Update($_227964291, array(___1476597692(341) => $_888882404 ? ___1476597692(342) : ___1476597692(343)));
     }
     self::InstallModule(___1476597692(344), $_888882404);
 }
Example #12
0
 function OnPostForm()
 {
     $wizard =& $this->GetWizard();
     $currentStep = $wizard->GetVar('nextStep');
     $install_mod = $wizard->GetVar('install');
     $all_mod = $wizard->GetVar('b_modules');
     if ($currentStep < 1) {
         $currentStep = 0;
     }
     $install_steps = array(GetMessage('WIZ_TEMPLATE_INSTALL'), GetMessage('WIZ_SETTINGS_INSTALL'));
     foreach ($all_mod as $m_id => $m_name) {
         $install_steps[] = in_array($m_id, $install_mod) ? array('module' => array('install', $m_id), 'status' => GetMessage('WIZ_MODULE_INSTALLING') . $m_name) : array('module' => array('uninstall', $m_id), 'status' => GetMessage('WIZ_MODULE_UNINSTALLING') . $m_name);
     }
     if (!isset($install_steps[$currentStep])) {
         $wizard->SetCurrentStep('success');
         return;
     }
     $arVars = $wizard->GetVars();
     switch ($currentStep) {
         case 0:
             //Копируем шаблон
             CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . '/bitrix/wizards/nsandrey/empty_install/site/template/', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/templates/' . $arVars['templateDir'] . '/', true, true, false);
             $templ_desc = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/bitrix/templates/' . $arVars['templateDir'] . '/description.php');
             $templ_desc = strtr($templ_desc, array('#TEMPLATE_NAME#' => $arVars['templateName'], '#TEMPLATE_DESCRIPTION#' => $arVars['templateDescription']));
             file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/bitrix/templates/' . $arVars['templateDir'] . '/description.php', $templ_desc);
             break;
         case 1:
             //Копируем и настраиваем паблик
             CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . '/bitrix/wizards/nsandrey/empty_install/site/public/' . LANGUAGE_ID . '/', $_SERVER['DOCUMENT_ROOT'] . '/', true, true, false);
             $site_meta = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/.section.php');
             $site_meta = strtr($site_meta, array('#SITE_TITLE#' => $arVars['siteMetaTitle'], '#SITE_DESCRIPTION#' => $arVars['siteMetaDescription'], '#SITE_KEYWORDS#' => $arVars['siteMetaKeywords']));
             file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/.section.php', $site_meta);
             $obSite = new CSite();
             $obSite->Update(SITE_ID, array('NAME' => $arVars['siteName'], 'TEMPLATE' => array(array('CONDITION' => '', 'SORT' => 1, 'TEMPLATE' => $arVars['templateDir']))));
             break;
         default:
             ob_start();
             if (@file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $install_steps[$currentStep]['module'][1] . '/install/index.php')) {
                 include_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $install_steps[$currentStep]['module'][1] . '/install/index.php';
                 register_shutdown_function('on_shutdown', $install_steps, $currentStep);
                 $module = new $install_steps[$currentStep]['module'][1]();
                 global $step;
                 $_REQUEST['sessid'] = bitrix_sessid();
                 if ($install_steps[$currentStep]['module'][1] == 'wiki' || $install_steps[$currentStep]['module'][1] == 'photogallery') {
                     $_REQUEST['step'] = $step = 3;
                 } else {
                     $_REQUEST['step'] = $step = 2;
                 }
                 if ($install_steps[$currentStep]['module'][0] == 'install' && !$module->IsInstalled()) {
                     $module->DoInstall();
                 } elseif ($install_steps[$currentStep]['module'][0] == 'uninstall' && $module->IsInstalled()) {
                     $module->DoUninstall();
                 }
             }
             ob_end_clean();
             break;
     }
     if (!isset($install_steps[$currentStep + 1])) {
         $response = "window.ajaxForm.StopAjax(); window.ajaxForm.SetStatus('100'); window.ajaxForm.Post('" . ($currentStep + 1) . "', 'skip', '" . ($currentStep < 2 ? $install_steps[$currentStep] : $install_steps[$currentStep]['status']) . "');";
     } else {
         $progress = round($currentStep / sizeof($install_steps) * 100);
         $response = "window.ajaxForm.SetStatus('" . $progress . "'); window.ajaxForm.Post('" . ($currentStep + 1) . "', 'skip', '" . ($currentStep < 2 ? $install_steps[$currentStep] : $install_steps[$currentStep]['status']) . "');";
     }
     die("[response]" . $response . "[/response]");
 }
Example #13
0
 private static function OnExtranetSettingsChange($_404690384, $_1907506185)
 {
     $_853853045 = COption::$GLOBALS['_____1046378448'][67]("extranet", "extranet_site", "");
     if ($_853853045) {
         $_1507626550 = new CSite();
         $_1507626550->Update($_853853045, array(___916150341(339) => $_1907506185 ? ___916150341(340) : ___916150341(341)));
     }
     self::InstallModule(___916150341(342), $_1907506185);
 }
Example #14
0
                $obCCourse = new CCourse();
                $obCCourse->Update($arCourse["ID"], array("CODE" => $arCoursesSite[$key]));
            }
        }
        /*
        it's new rights model now, rights mudt be set for every lesson and/or for module at all
        if (isset($arCourse["ID"])){
        	CCourse::SetPermission($arCourse["ID"], Array("2"=>"R"));
        
        }
        */
        CopyDirFiles($pathToService . "/" . LANGUAGE_ID . "/images/" . $courseCode . "/", WIZARD_SITE_PATH, $rewrite = false, $recursive = true);
    } catch (LearnException $e) {
    }
}
if (!WIZARD_IS_RERUN || WIZARD_FIRST_INSTAL !== "Y") {
    $obSite = CSite::GetByID(WIZARD_SITE_ID);
    if (!($arSite = $obSite->Fetch())) {
        return;
    }
    $arTemplates = array();
    $obTemplate = CSite::GetTemplateList(WIZARD_SITE_ID);
    while ($arTemplate = $obTemplate->Fetch()) {
        $arTemplates[] = $arTemplate;
    }
    $urlTemlates = WIZARD_SITE_DIR . "services/learning/course";
    $arTemplates[] = array("CONDITION" => "CSite::InDir('" . $urlTemlates . "')", "SORT" => 150, "TEMPLATE" => "learning");
    $obSite = new CSite();
    $obSite->Update(WIZARD_SITE_ID, array("TEMPLATE" => $arTemplates, "NAME" => $arSite["NAME"]));
    $APPLICATION->SetGroupRight("learning", WIZARD_PORTAL_ADMINISTRATION_GROUP, "W");
}
Example #15
0
    //desktop on index page, depending on SITE_ID
    $sOptions = 'a:1:{s:7:"GADGETS";a:11:{s:13:"BIRTHDAY@5438";a:4:{s:6:"COLUMN";i:0;s:3:"ROW";i:0;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:11:"HONOUR@8771";a:4:{s:6:"COLUMN";i:0;s:3:"ROW";i:1;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:19:"NEW_EMPLOYEES@11193";a:4:{s:6:"COLUMN";i:0;s:3:"ROW";i:2;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:14:"OFFICIAL@13359";a:3:{s:6:"COLUMN";i:1;s:3:"ROW";i:0;s:4:"HIDE";s:1:"N";}s:10:"LIFE@14720";a:4:{s:6:"COLUMN";i:1;s:3:"ROW";i:1;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:10:"VIDEO@8095";a:4:{s:6:"COLUMN";i:1;s:3:"ROW";i:2;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:12:"PHOTOS@11262";a:4:{s:6:"COLUMN";i:1;s:3:"ROW";i:3;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:15:"desktop-actions";a:3:{s:6:"COLUMN";i:2;s:3:"ROW";i:0;s:4:"HIDE";s:1:"N";}s:9:"VOTE@4378";a:3:{s:6:"COLUMN";i:2;s:3:"ROW";i:1;s:4:"HIDE";s:1:"N";}s:22:"COMPANY_CALENDAR@20319";a:4:{s:6:"COLUMN";i:2;s:3:"ROW";i:2;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:17:"SHARED_DOCS@14908";a:4:{s:6:"COLUMN";i:2;s:3:"ROW";i:3;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}}}';
    $arOptions = unserialize($sOptions);
    WizardServices::SetUserOption('intranet', '~gadgets_mainpage_' . WIZARD_SITE_ID, $arOptions, $common = true);
    $links = GetMessage('MAIN_OPT_DEF_LINKS');
    //personal desktop, depending on SITE_ID
    $sOptions = 'a:1:{s:7:"GADGETS";a:9:{s:13:"BIRTHDAY@8298";a:4:{s:6:"COLUMN";i:0;s:3:"ROW";i:0;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:14:"HTML_AREA@8623";a:4:{s:6:"COLUMN";i:0;s:3:"ROW";i:1;s:8:"USERDATA";a:1:{s:7:"content";s:1:" ";}s:4:"HIDE";s:1:"N";}s:13:"UPDATES@17676";a:4:{s:6:"COLUMN";i:1;s:3:"ROW";i:0;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:11:"TASKS@11589";a:4:{s:6:"COLUMN";i:1;s:3:"ROW";i:1;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:9:"BLOG@8601";a:4:{s:6:"COLUMN";i:1;s:3:"ROW";i:2;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:15:"desktop-actions";a:3:{s:6:"COLUMN";i:2;s:3:"ROW";i:0;s:4:"HIDE";s:1:"N";}s:14:"CALENDAR@22972";a:4:{s:6:"COLUMN";i:2;s:3:"ROW";i:1;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:13:"WEATHER@21928";a:4:{s:6:"COLUMN";i:2;s:3:"ROW";i:2;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:12:"PROBKI@25675";a:4:{s:6:"COLUMN";i:2;s:3:"ROW";i:3;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}}}';
    $arOptions = unserialize($sOptions);
    $arOptions['GADGETS']['HTML_AREA@8623']['USERDATA']['content'] = $links;
    WizardServices::SetUserOption('intranet', '~gadgets_dashboard_' . WIZARD_SITE_ID, $arOptions, $common = true);
}
if (WIZARD_IS_RERUN) {
    return;
}
$obSite = new CSite();
$obSite->Update(WIZARD_SITE_ID, array("NAME" => COption::GetOptionString("main", "site_name", GetMessage("DEFAULT_SITE_NAME"))));
CGroup::SetSubordinateGroups(WIZARD_PERSONNEL_DEPARTMENT_GROUP, array(WIZARD_EMPLOYEES_GROUP, WIZARD_RATING_VOTE_GROUP, WIZARD_RATING_VOTE_AUTHORITY_GROUP));
CGroup::SetSubordinateGroups(WIZARD_PORTAL_ADMINISTRATION_GROUP, array(WIZARD_EMPLOYEES_GROUP));
COption::SetOptionString("main", "server_name", $_SERVER["SERVER_NAME"]);
COption::SetOptionString("main", "upload_dir", "upload");
COption::SetOptionString("main", "component_cache_on", "Y");
COption::SetOptionString("main", "save_original_file_name", "Y");
COption::SetOptionString("main", "captcha_registration", "N");
COption::SetOptionString("main", "use_secure_password_cookies", "Y");
COption::SetOptionString("main", "new_user_email_uniq_check", "Y");
COption::SetOptionString("main", "auth_comp2", "Y");
COption::SetOptionString("main", "vendor", LANGUAGE_ID == "ru" ? "1c_bitrix_portal" : "bitrix_portal");
COption::SetOptionString("main", "PARAM_MAX_USERS", "25");
COption::SetOptionString("main", "update_autocheck", "7");
COption::SetOptionString("main", "use_digest_auth", "Y");
COption::SetOptionString("main", "use_time_zones", "Y");
Example #16
0
COption::SetOptionString("main", 'CAPTCHA_arTTFFiles', 'bitrix_captcha.ttf');
SetMenuTypes(array("left" => GetMessage("LEFT_MENU_NAME"), "top" => GetMessage("TOP_MENU_NAME")), "s1");
SetMenuTypes(array("left" => GetMessage("LEFT_MENU_NAME"), "top" => GetMessage("TOP_MENU_NAME")), "");
COption::SetOptionString("fileman", "default_edit", "html");
COption::SetOptionString("fileman", "propstypes", serialize(array("description" => GetMessage("MAIN_OPT_DESCRIPTION"), "keywords" => GetMessage("MAIN_OPT_KEYWORDS"), "title" => GetMessage("MAIN_OPT_TITLE"), "keywords_inner" => GetMessage("MAIN_OPT_KEYWORDS_INNER"))));
if (LANGUAGE_ID != 'ru' && COption::GetOptionString('seo', 'counters', '') == '') {
    COption::SetOptionString('seo', 'counters', '<a href="http://www.webdew.ro/utils.php"><img src="http://www.webdew.ro/pagerank/free-pagerank-display.php?a=getCode&amp;s=goo" title="Free PageRank Display Code" border="0px" alt="PageRank" /></a>');
}
//user options
DemoSiteUtil::SetUserOption("global", "settings", array("start_menu_preload" => "Y", "start_menu_title" => "N"), $common = true);
//Gadgets
CUserOptions::SetOption('intranet', '~gadgets_holder1', unserialize(GetMessage("MAIN_SETTINGS_GADGETS")), true);
//Print template
$pathToService = str_replace("\\", "/", dirname(__FILE__));
CopyDirFiles($wizardPath . "/misc/print_template/" . LANGUAGE_ID, $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/print", $rewrite = true, $recursive = true);
$obSite = CSite::GetByID("s1");
if (!($arSite = $obSite->Fetch())) {
    return;
}
$arTemplates = array();
$obTemplate = CSite::GetTemplateList("s1");
while ($arTemplate = $obTemplate->Fetch()) {
    $arTemplates[] = $arTemplate;
}
$arTemplates[] = array("CONDITION" => "\$_GET['print']=='Y'", "SORT" => 150, "TEMPLATE" => "print");
$obSite = new CSite();
$obSite->Update("s1", array("TEMPLATE" => $arTemplates, "NAME" => COption::GetOptionString("main", "site_name", $arSite["NAME"])));
//socialservices
$bRu = LANGUAGE_ID == 'ru';
$arServices = array("VKontakte" => "N", "MyMailRu" => "N", "Twitter" => "N", "Facebook" => "N", "Livejournal" => "Y", "YandexOpenID" => $bRu ? "Y" : "N", "Rambler" => $bRu ? "Y" : "N", "MailRuOpenID" => $bRu ? "Y" : "N", "Liveinternet" => $bRu ? "Y" : "N", "Blogger" => "Y", "OpenID" => "Y", "LiveID" => "N");
COption::SetOptionString("socialservices", "auth_services", serialize($arServices));
Example #17
0
        return;
    }
    $success = $package->ImportPackage();
    if ($success) {
        $dbResult = CCourse::GetList(array(), array("CODE" => "BX-ADM001"));
        $arCourse = $dbResult->Fetch();
    }
}
if (isset($arCourse["ID"])) {
    CCourse::SetPermission($arCourse["ID"], array("2" => "R"));
}
//Public files
CopyDirFiles($pathToService . "/" . LANGUAGE_ID . "/public", $_SERVER["DOCUMENT_ROOT"] . "/communication/learning", $rewrite = false, $recursive = true);
//Left menu
DemoSiteUtil::AddMenuItem("/communication/.left.menu.php", array(GetMessage("SERVICE_LEARNING"), "/communication/learning/", array(), array(), ""));
//Template
CopyDirFiles($pathToService . "/" . LANGUAGE_ID . "/template", $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/learning", $rewrite = true, $recursive = true);
$obSite = CSite::GetByID("s1");
if (!($arSite = $obSite->Fetch())) {
    return;
}
$arTemplates = array();
$obTemplate = CSite::GetTemplateList("s1");
while ($arTemplate = $obTemplate->Fetch()) {
    $arTemplates[] = $arTemplate;
}
$arTemplates[] = array("CONDITION" => "CSite::InDir('/communication/learning/course/')", "SORT" => 150, "TEMPLATE" => "learning");
$obSite = new CSite();
$obSite->Update("s1", array("TEMPLATE" => $arTemplates, "NAME" => $arSite["NAME"]));
//Communication section
include dirname(__FILE__) . "/../communication/install.php";
Example #18
0
        $CHARSET = defined("BX_UTF") ? "UTF-8" : "windows-1251";
        $SERVER_NAME = $_SERVER["SERVER_NAME"];
    }
    $culture = CultureTable::getRow(array('filter' => array("=FORMAT_DATE" => $FORMAT_DATE, "=FORMAT_DATETIME" => $FORMAT_DATETIME, "=FORMAT_NAME" => $FORMAT_NAME, "=CHARSET" => $CHARSET)));
    if ($culture) {
        $cultureId = $culture["ID"];
    } else {
        $addResult = CultureTable::add(array("NAME" => WIZARD_SITE_ID, "CODE" => WIZARD_SITE_ID, "FORMAT_DATE" => $FORMAT_DATE, "FORMAT_DATETIME" => $FORMAT_DATETIME, "FORMAT_NAME" => $FORMAT_NAME, "CHARSET" => $CHARSET));
        $cultureId = $addResult->getId();
    }
    $arFields = array("LID" => WIZARD_SITE_ID, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => WIZARD_SITE_NAME, "DIR" => WIZARD_SITE_DIR, "SITE_NAME" => WIZARD_SITE_NAME, "SERVER_NAME" => $SERVER_NAME, "EMAIL" => $EMAIL, "LANGUAGE_ID" => $LANGUAGE_ID, "DOC_ROOT" => $DOC_ROOT, "CULTURE_ID" => $cultureId);
    $obSite = new CSite();
    $result = $obSite->Add($arFields);
    if ($result) {
        COption::SetOptionString("main", "wizard_site_id", WIZARD_SITE_ID);
        COption::SetOptionString("extranet", "extranet_site", WIZARD_SITE_ID);
    }
    CExtranetWizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "/", array("SITE_DIR" => WIZARD_SITE_DIR));
    CExtranetWizardServices::ReplaceMacrosRecursive(WIZARD_TEMPLATE_ABSOLUTE_PATH . "/", array("SITE_DIR" => WIZARD_SITE_DIR));
    CUrlRewriter::Add(array("SITE_ID" => WIZARD_SITE_ID, "CONDITION" => "#^" . WIZARD_SITE_DIR . "workgroups/#", "ID" => "bitrix:socialnetwork_group", "PATH" => WIZARD_SITE_DIR . "workgroups/index.php"));
    CUrlRewriter::Add(array("SITE_ID" => WIZARD_SITE_ID, "CONDITION" => "#^" . WIZARD_SITE_DIR . "workgroups/create/#", "ID" => "bitrix:extranet.group_create", "PATH" => WIZARD_SITE_DIR . "workgroups/create/index.php"));
    CUrlRewriter::Add(array("SITE_ID" => WIZARD_SITE_ID, "CONDITION" => "#^" . WIZARD_SITE_DIR . "contacts/personal/#", "ID" => "bitrix:socialnetwork_user", "PATH" => WIZARD_SITE_DIR . "contacts/personal.php"));
} else {
    COption::SetOptionString("main", "wizard_site_id", WIZARD_SITE_ID);
    $siteName = COption::GetOptionString("main", "site_name", "", WIZARD_SITE_ID, true);
    if (strlen($siteName) > 0) {
        $arFields = array("NAME" => $siteName);
        $obSite = new CSite();
        $obSite->Update(WIZARD_SITE_ID, $arFields);
    }
}