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; }
function InstallDB($install_wizard = true) { global $DB, $DBType, $APPLICATION; $arCurPhpVer = Explode(".", PhpVersion()); if (IntVal($arCurPhpVer[0]) < 5) { return true; } $errors = null; if (!$DB->Query("SELECT 'x' FROM b_dav_locks", true)) { $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/dav/install/db/" . $DBType . "/install.sql"); } if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } RegisterModule("dav"); RegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", 50, "/modules/dav/prolog_before.php"); RegisterModuleDependences("main", "OnAfterUserAdd", "dav", "CDavExchangeMail", "handleUserChange"); RegisterModuleDependences("main", "OnAfterUserUpdate", "dav", "CDavExchangeMail", "handleUserChange"); RegisterModuleDependences("main", "OnBeforeUserTypeDelete", "dav", "CDavExchangeMail", "handleUserTypeDelete"); RegisterModuleDependences("main", "OnApplicationsBuildList", "main", '\\Bitrix\\Dav\\Application', "onApplicationsBuildList", 100, "modules/dav/lib/application.php"); // main here is not a mistake $arUrlRewrite = array(); if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/urlrewrite.php")) { include $_SERVER['DOCUMENT_ROOT'] . "/urlrewrite.php"; } $rule = array("CONDITION" => "#^/\\.well-known#", "RULE" => "", "ID" => "", "PATH" => "/bitrix/groupdav.php"); $canAdd = true; foreach ($arUrlRewrite as $r) { if ($r["CONDITION"] == $rule["CONDITION"]) { $canAdd = false; break; } } if ($canAdd) { CUrlRewriter::Add($rule); } return true; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } //Library include_once dirname(__FILE__) . "/iblock_tools.php"; __IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__))); //Parameters if (!is_array($arParams)) { $arParams = array(); } if (strlen($arParams["site_id"]) <= 0) { $arParams["site_id"] = "s1"; } //Install themes iblock DEMO_IBlock_ImportXML("010_services_services-themes_" . LANGUAGE_ID . ".xml", $arParams["site_id"], false, true); //Import XML if ($IBLOCK_ID = DEMO_IBlock_ImportXML("020_news_content-news_" . LANGUAGE_ID . ".xml", $arParams["site_id"], false, true)) { //Set Some IBLOCK FIELDS CIBlock::SetFields($IBLOCK_ID, array("ACTIVE_FROM" => array("DEFAULT_VALUE" => "=now"), "PREVIEW_PICTURE" => array("DEFAULT_VALUE" => array("FROM_DETAIL" => "Y", "SCALE" => "Y", "WIDTH" => 200, "HEIGHT" => 200, "IGNORE_ERRORS" => "N")), "DETAIL_PICTURE" => array("DEFAULT_VALUE" => array("SCALE" => "Y", "WIDTH" => 400, "HEIGHT" => 400, "IGNORE_ERRORS" => "N")))); DEMO_IBlock_EditFormLayout($IBLOCK_ID, array("edit1" => array("TITLE" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_TAB_TITLE"), "FIELDS" => array("ACTIVE" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_ACTIVE"), "ACTIVE_FROM" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_ACTIVE_FROM"), "SECTIONS" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_SECTIONS"), "NAME" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_NAME"), "PREVIEW_TEXT" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_PREVIEW_TEXT"), "DETAIL_TEXT" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_DETAIL_TEXT"), "DETAIL_PICTURE" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_DETAIL_PICTURE"), "TAGS" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_TAGS"), "PROPERTY_" . CIBlockCMLImport::GetPropertyByXML_ID($IBLOCK_ID, "content-news-property-themes") => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_PROPERTY_THEMES"), "PROPERTY_" . CIBlockCMLImport::GetPropertyByXML_ID($IBLOCK_ID, "content-news-property-source") => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_PROPERTY_SOURCE"), "edit1_csection1" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_edit1_csection1"), "PROPERTY_" . CIBlockCMLImport::GetPropertyByXML_ID($IBLOCK_ID, "content-news-property-keywords") => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_PROPERTY_KEYWORDS"), "PROPERTY_" . CIBlockCMLImport::GetPropertyByXML_ID($IBLOCK_ID, "content-news-property-description") => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_PROPERTY_DESCRIPTION"), "PROPERTY_" . CIBlockCMLImport::GetPropertyByXML_ID($IBLOCK_ID, "content-news-property-browser_title") => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_PROPERTY_BROWSER_TITLE"), "edit1_csection2" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_edit1_csection2"), "WF_STATUS_ID" => GetMessage("DEMO_IBLOCK_CONTENT_NEWS_FIELD_WF_STATUS_ID"))))); //Create directory and copy files $search = array("#IBLOCK.ID(XML_ID=content-news)#"); $replace = array($IBLOCK_ID); DEMO_IBlock_CopyFiles("/public/content/news/", "/content/news/", false, $search, $replace); //Add menu item DEMO_IBlock_AddMenuItem("/content/.left.menu.php", array(GetMessage("DEMO_IBLOCK_CONTENT_NEWS_MENU"), "/content/news/", array(), array(), "")); CUrlRewriter::Add(array("CONDITION" => "#^/content/news/#", "RULE" => "", "ID" => "bitrix:news", "PATH" => "/content/news/index.php")); }
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "brands/", array("SITE_DIR" => WIZARD_SITE_DIR)); WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "catalog/", array("SITE_DIR" => WIZARD_SITE_DIR)); WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "favorites/", array("SITE_DIR" => WIZARD_SITE_DIR)); WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "login/", array("SITE_DIR" => WIZARD_SITE_DIR)); WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "news/", array("SITE_DIR" => WIZARD_SITE_DIR)); WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "personal/", array("SITE_DIR" => WIZARD_SITE_DIR)); WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "search/", array("SITE_DIR" => WIZARD_SITE_DIR)); CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "_index.php", array("SITE_DIR" => WIZARD_SITE_DIR)); $arUrlRewrite = array(); if (file_exists(WIZARD_SITE_ROOT_PATH . "/urlrewrite.php")) { include WIZARD_SITE_ROOT_PATH . "/urlrewrite.php"; } $arNewUrlRewrite = array(array("CONDITION" => "#^" . WIZARD_SITE_DIR . "about/#", "RULE" => "", "ID" => "bitrix:news", "PATH" => "" . WIZARD_SITE_DIR . "about/index.php"), array("CONDITION" => "#^" . WIZARD_SITE_DIR . "blog/#", "RULE" => "", "ID" => "bitrix:news", "PATH" => "" . WIZARD_SITE_DIR . "blog/index.php"), array("CONDITION" => "#^" . WIZARD_SITE_DIR . "news/#", "RULE" => "", "ID" => "bitrix:news", "PATH" => "" . WIZARD_SITE_DIR . "news/index.php"), array("CONDITION" => "#^" . WIZARD_SITE_DIR . "brands/([0-9]+)/#", "RULE" => "brand_id=\$1", "ID" => "", "PATH" => "" . WIZARD_SITE_DIR . "brands/detail.php"), array("CONDITION" => "#^" . WIZARD_SITE_DIR . "catalog/#", "RULE" => "", "ID" => "bitrix:catalog", "PATH" => "" . WIZARD_SITE_DIR . "catalog/index.php"), array("CONDITION" => "#^" . WIZARD_SITE_DIR . "delivery/#", "RULE" => "", "ID" => "", "PATH" => "" . WIZARD_SITE_DIR . "adults/index.php"), array("CONDITION" => "#^" . WIZARD_SITE_DIR . "guaranty/#", "RULE" => "", "ID" => "", "PATH" => "" . WIZARD_SITE_DIR . "adults/index.php"), array("CONDITION" => "#^" . WIZARD_SITE_DIR . "kredit/#", "RULE" => "", "ID" => "", "PATH" => "" . WIZARD_SITE_DIR . "adults/index.php"), array("CONDITION" => "#^" . WIZARD_SITE_DIR . "oplata/#", "RULE" => "", "ID" => "", "PATH" => "" . WIZARD_SITE_DIR . "adults/index.php"), array("CONDITION" => "#^" . WIZARD_SITE_DIR . "personal/order/#", "RULE" => "", "ID" => "bitrix:sale.personal.order", "PATH" => "" . WIZARD_SITE_DIR . "personal/order/index.php")); foreach ($arNewUrlRewrite as $arUrl) { if (!in_array($arUrl, $arUrlRewrite)) { CUrlRewriter::Add($arUrl); } } } function ___writeToAreasFile($fn, $text) { if (file_exists($fn) && !is_writable($abs_path) && defined("BX_FILE_PERMISSIONS")) { @chmod($abs_path, BX_FILE_PERMISSIONS); } $fd = @fopen($fn, "wb"); if (!$fd) { return false; } if (false === fwrite($fd, $text)) { fclose($fd); return false;
function ReindexFile($path, $SEARCH_SESS_ID = "", $max_file_size = 0) { global $APPLICATION; CMain::InitPathVars($site, $path); $DOC_ROOT = CSite::GetSiteDocRoot($site); if (!CUrlRewriter::CheckPath($path)) { return 0; } if ($max_file_size > 0 && filesize($DOC_ROOT . "/" . $path) > $max_file_size * 1024) { return 0; } $filesrc = $APPLICATION->GetFileContent($DOC_ROOT . "/" . $path); if (!$filesrc || $filesrc == "") { return 0; } $arComponents = PHPParser::ParseScript($filesrc); for ($i = 0, $cnt = count($arComponents); $i < $cnt; $i++) { if ($arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y") { $arFields = array("SITE_ID" => $site, "CONDITION" => "#^" . $arComponents[$i]["DATA"]["PARAMS"]["SEF_FOLDER"] . "#", "RULE" => "", "ID" => $arComponents[$i]["DATA"]["COMPONENT_NAME"], "PATH" => $path); CUrlRewriter::Add($arFields); } } return true; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } //Library include_once dirname(__FILE__) . "/iblock_tools.php"; //Parameters if (!is_array($arParams)) { $arParams = array(); } if (strlen($arParams["site_id"]) <= 0) { $arParams["site_id"] = "s1"; } $_SESSION["DEMO_IBLOCK_BOOKS"] = CIBlockCMLImport::GetIBlockByXML_ID("books-books"); //Import XML if ($_SESSION["DEMO_IBLOCK_BOOKS"] === false) { $iblock_id = DEMO_IBlock_ImportXML("080_books_books-books_" . LANGUAGE_ID . ".xml", $arParams["site_id"], false, false); if ($iblock_id > 0) { $arLabels = array(); $rsLanguages = CLanguage::GetList($b = "sort", $o = "asc"); while ($arLang = $rsLanguages->Fetch()) { __IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/books-books.php", $arLang["LANGUAGE_ID"])); $arLabels[$arLang["LANGUAGE_ID"]] = GetMessage("DEMO_IBLOCK_ESTORE_BOOKS_BROWSER_TITLE"); } $obUserField = new CUserTypeEntity(); $obUserField->Add(array("ENTITY_ID" => "IBLOCK_" . $iblock_id . "_SECTION", "FIELD_NAME" => "UF_BROWSER_TITLE", "USER_TYPE_ID" => "string", "XML_ID" => "books_sections-books-property-browser_title", "SORT" => 100, "MULTIPLE" => "N", "MANDATORY" => "N", "SHOW_FILTER" => "S", "SHOW_IN_LIST" => "Y", "EDIT_IN_LIST" => "Y", "IS_SEARCHABLE" => "Y", "EDIT_FORM_LABEL" => $arLabels, "LIST_COLUMN_LABEL" => $arLabels, "LIST_FILTER_LABEL" => $arLabels)); CUrlRewriter::Add(array("CONDITION" => "#^/e-store/books/#", "RULE" => "", "ID" => "bitrix:catalog", "PATH" => "/e-store/books/index.php")); } }
function UndoFileDelete($Params, $type) { global $APPLICATION; $documentRoot = CSite::GetSiteDocRoot($Params['site']); // Restore file if (strlen($Params['path']) > 0) { $APPLICATION->SaveFileContent($documentRoot . $Params['path'], $Params['content']); } // Update disk quota if (COption::GetOptionInt("main", "disk_space") > 0) { $io = CBXVirtualIo::GetInstance(); $f = $io->GetFile($documentRoot . $Params['path']); $file_size = $f->GetFileSize(); $quota = new CDiskQuota(); $quota->UpdateDiskQuota("file", $file_size, "delete"); } // Restore file access permissions if (is_array($Params['perm']) && count($Params['perm']) > 0) { for ($i = 0, $l = count($Params['perm']); $i < $l; $i++) { $permFile = $Params['perm'][$i]['permFile']; $permContent = $APPLICATION->GetFileContent($permFile); $permContent = substr($permContent, 0, strpos($permContent, "?" . ">")); $permContent .= "\$PERM[\"" . EscapePHPString($Params['perm'][$i]['file']) . "\"][\"" . EscapePHPString($Params['perm'][$i]['group']) . "\"]=\"" . EscapePHPString($Params['perm'][$i]['perm']) . "\";\n"; $permContent .= "?" . ">\n"; $APPLICATION->SaveFileContent($permFile, $permContent); } } // Restore menu if (is_array($Params['menu']) && count($Params['menu']) > 0) { for ($i = 0, $l = count($Params['menu']); $i < $l; $i++) { $menuFile = $Params['menu'][$i]['menuFile']; $menuIndex = $Params['menu'][$i]['menuIndex']; $menuItem = $Params['menu'][$i]['menuItem']; $arMenu = CFileman::GetMenuArray($documentRoot . $menuFile); $arFound = false; if (count($arMenu["aMenuLinks"]) <= $menuIndex) { $arMenu["aMenuLinks"][] = $menuItem; } else { $arMenu["aMenuLinks"] = array_merge(array_slice($arMenu["aMenuLinks"], 0, $menuIndex), array($menuItem), array_slice($arMenu["aMenuLinks"], $menuIndex)); } CFileMan::SaveMenu(array($Params['site'], $menuFile), $arMenu["aMenuLinks"], $arMenu["sMenuTemplate"]); } } // Restore UrlRewriter if (is_array($Params['SEF']) && count($Params['SEF']) > 0) { for ($i = 0, $l = count($Params['SEF']); $i < $l; $i++) { CUrlRewriter::Add(array("SITE_ID" => $Params['site'], "CONDITION" => $Params['SEF'][$i]["CONDITION"], "ID" => $Params['SEF'][$i]["ID"], "PATH" => $Params['SEF'][$i]["PATH"], "RULE" => $Params['SEF'][$i]["RULE"])); } } $GLOBALS["CACHE_MANAGER"]->CleanDir("menu"); }
function OnChangeFileComponent($path, $site) { /** @global CMain $APPLICATION */ global $APPLICATION; // kind of optimization if (!HasScriptExtension($path)) { return; } $docRoot = CSite::GetSiteDocRoot($site); CUrlRewriter::Delete(array("SITE_ID" => $site, "PATH" => $path, "ID" => "NULL")); if (class_exists("\\Bitrix\\Main\\Application", false)) { \Bitrix\Main\Component\ParametersTable::deleteByFilter(array("SITE_ID" => $site, "REAL_PATH" => $path)); } $fileSrc = $APPLICATION->GetFileContent($docRoot . $path); $arComponents = PHPParser::ParseScript($fileSrc); for ($i = 0, $cnt = count($arComponents); $i < $cnt; $i++) { if (class_exists("\\Bitrix\\Main\\Application", false)) { \Bitrix\Main\Component\ParametersTable::add(array('SITE_ID' => $site, 'COMPONENT_NAME' => $arComponents[$i]["DATA"]["COMPONENT_NAME"], 'TEMPLATE_NAME' => $arComponents[$i]["DATA"]["TEMPLATE_NAME"], 'REAL_PATH' => $path, 'SEF_MODE' => $arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y" ? \Bitrix\Main\Component\ParametersTable::SEF_MODE : \Bitrix\Main\Component\ParametersTable::NOT_SEF_MODE, 'SEF_FOLDER' => $arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y" ? $arComponents[$i]["DATA"]["PARAMS"]["SEF_FOLDER"] : null, 'START_CHAR' => $arComponents[$i]["START"], 'END_CHAR' => $arComponents[$i]["END"], 'PARAMETERS' => serialize($arComponents[$i]["DATA"]["PARAMS"]))); } if (isset($arComponents[$i]["DATA"]["PARAMS"]) && is_array($arComponents[$i]["DATA"]["PARAMS"])) { if (array_key_exists("SEF_MODE", $arComponents[$i]["DATA"]["PARAMS"]) && $arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y") { CUrlRewriter::Add(array("SITE_ID" => $site, "CONDITION" => "#^" . $arComponents[$i]["DATA"]["PARAMS"]["SEF_FOLDER"] . "#", "ID" => $arComponents[$i]["DATA"]["COMPONENT_NAME"], "PATH" => $path)); } } } }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } //Library include_once dirname(__FILE__) . "/iblock_tools.php"; __IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__))); //Parameters if (!is_array($arParams)) { $arParams = array(); } if (strlen($arParams["site_id"]) <= 0) { $arParams["site_id"] = "s1"; } //Import XML if ($IBLOCK_ID = DEMO_IBlock_ImportXML("060_services_services-faq_" . LANGUAGE_ID . ".xml", $arParams["site_id"], false, true)) { //Create directory and copy files $search = array("#IBLOCK.ID(XML_ID=services-faq)#"); $replace = array($IBLOCK_ID); DEMO_IBlock_CopyFiles("/public/content/faq/", "/content/faq/", false, $search, $replace); //Add menu item DEMO_IBlock_AddMenuItem("/content/.left.menu.php", array(GetMessage("DEMO_IBLOCK_CONTENT_FAQ_MENU"), "/content/faq/", array(), array(), "")); CUrlRewriter::Add(array("CONDITION" => "#^/content/faq/#", "RULE" => "", "ID" => "bitrix:support.faq", "PATH" => "/content/faq/index.php")); }
if (!is_array($arParams)) { $arParams = array(); } if (strlen($arParams["site_id"]) <= 0) { $arParams["site_id"] = "s1"; } //Import XML if ($IBLOCK_ID = CIBlockCMLImport::GetIBlockByXML_ID("content-news")) { //Create directory and copy files $rsElements = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $IBLOCK_ID), false, array("nTopSize" => 1), array("ID")); $arElement = $rsElements->Fetch(); $search = array("#IBLOCK.ID(XML_ID=content-news)#", "#IBLOCK_ELEMENT.ID(IBLOCK_XML_ID=content-news)#"); $replace = array($IBLOCK_ID, $arElement["ID"]); CopyDirFiles(dirname(__FILE__) . "/public/language/" . LANGUAGE_ID . "/examples/", $_SERVER["DOCUMENT_ROOT"] . "/examples", false, false); CopyDirFiles(dirname(__FILE__) . "/public/language/" . LANGUAGE_ID . "/examples/custom-registration/", $_SERVER["DOCUMENT_ROOT"] . "/examples/custom-registration", false, true); CopyDirFiles(dirname(__FILE__) . "/public/language/" . LANGUAGE_ID . "/examples/download/", $_SERVER["DOCUMENT_ROOT"] . "/examples/download", false, true); CopyDirFiles(dirname(__FILE__) . "/public/language/" . LANGUAGE_ID . "/examples/menu/", $_SERVER["DOCUMENT_ROOT"] . "/examples/menu", false, true); CopyDirFiles(dirname(__FILE__) . "/public/language/" . LANGUAGE_ID . "/examples/rss/", $_SERVER["DOCUMENT_ROOT"] . "/examples/rss", false, true); CopyDirFiles(dirname(__FILE__) . "/public/language/" . LANGUAGE_ID . "/examples/sef/", $_SERVER["DOCUMENT_ROOT"] . "/examples/sef", false, true); CopyDirFiles(dirname(__FILE__) . "/public/language/" . LANGUAGE_ID . "/examples/feedback/", $_SERVER["DOCUMENT_ROOT"] . "/examples/feedback", false, true); CopyDirFiles(dirname(__FILE__) . "/bitrix/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix", false, true); DEMO_IBlock_CopyFiles(array(dirname(__FILE__), "/public/language/" . LANGUAGE_ID . "/examples/my-components/"), "/examples/my-components/", false, $search, $replace); CopyDirFiles(dirname(__FILE__) . "/public/language/" . LANGUAGE_ID . "/upload/", $_SERVER["DOCUMENT_ROOT"] . "/upload", false, true); $CONDITION = "#^/examples/my-components/news/#"; $arResult = CUrlRewriter::GetList(array("SITE_ID" => $arParams["site_id"], "CONDITION" => $CONDITION)); if (count($arResult) <= 0) { CUrlRewriter::Add(array("SITE_ID" => $arParams["site_id"], "CONDITION" => $CONDITION, "ID" => "demo:news", "PATH" => "/examples/my-components/news_sef.php")); } //Add menu item DEMO_IBlock_AddMenuItem("/.top.menu.php", array(GetMessage("DEMO_EXAMPLES_MENU"), "/examples/", array(), array(), "")); }
function DoInstall() { global $DOCUMENT_ROOT, $APPLICATION, $DB, $DBType, $step, $install; if ($APPLICATION->GetGroupRight('main') < 'W') { return; } $licenceDB = $DB->Query("SELECT * FROM b_option WHERE `MODULE_ID`='{$this->MODULE_ID}' AND `NAME`='~bsm_stop_date'"); if ($licenceDB->Fetch()) { $DB->Query("DELETE FROM b_option WHERE `MODULE_ID`='{$this->MODULE_ID}' AND `NAME`='~bsm_stop_date'"); } if (!isset($step) || $step < 1) { $APPLICATION->IncludeAdminFile(GetMessage('ACRIT_EXPORTPRO_RECOMMENDED'), $DOCUMENT_ROOT . "/bitrix/modules/{$this->MODULE_ID}/install/step.php"); } elseif ($step == 3 && $install == 'Y') { $this->InstallFiles(); $this->InstallDB(); RegisterModule(self::MODULE_ID); $this->InstallEvents(); $urlRewriter = new CUrlRewriter(); foreach ($this->siteArray as $siteID => $siteDir) { $urlRewriter->Add(array('SITE_ID' => $siteID, 'CONDITION' => '#^/acrit.exportpro/(.*)#', 'PATH' => '/acrit.exportpro/index.php', 'RULE' => 'path=$1')); } $APPLICATION->IncludeAdminFile(GetMessage('MOD_INST_OK'), $DOCUMENT_ROOT . "/bitrix/modules/{$this->MODULE_ID}/install/step3.php"); } elseif ($step == 2) { CheckDirPath(__DIR__ . '/db/category'); CopyDirFiles(__DIR__ . '/db/', __DIR__ . '/db/category'); $APPLICATION->IncludeAdminFile(GetMessage('MOD_INST_OK'), $DOCUMENT_ROOT . "/bitrix/modules/{$this->MODULE_ID}/install/step2.php"); } }
} if (!defined("WIZARD_SITE_ID")) { return; } if (!defined("WIZARD_SITE_DIR")) { return; } if (!IsModuleInstalled("mobile")) { DeleteDirFilesEx(WIZARD_SITE_PATH . "/mobile/"); return; } if (WIZARD_IS_RERUN !== true) { $arAppTempalate = array("SORT" => 1, "CONDITION" => "CSite::InDir('" . WIZARD_SITE_DIR . "mobile/')", "TEMPLATE" => "mobile_app"); $arFields = array("TEMPLATE" => array()); $dbTemplates = CSite::GetTemplateList(WIZARD_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"] = WIZARD_SITE_ID; $obSite->Update(WIZARD_SITE_ID, $arFields); CUrlRewriter::Add(array("SITE_ID" => WIZARD_SITE_ID, "CONDITION" => "#^" . WIZARD_SITE_DIR . "mobile/webdav#", "ID" => "bitrix:mobile.webdav.file.list", "PATH" => WIZARD_SITE_DIR . "mobile/webdav/index.php")); }
die; } //Library include_once dirname(__FILE__) . "/iblock_tools.php"; __IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__))); //Parameters if (!is_array($arParams)) { $arParams = array(); } if (strlen($arParams["site_id"]) <= 0) { $arParams["site_id"] = "s1"; } //Import XML if ($IBLOCK_ID = DEMO_IBlock_ImportXML("200_lists_lists-clients_" . LANGUAGE_ID . ".xml", $arParams["site_id"], false, true)) { //Create directory and copy files $search = array("#IBLOCK.ID(XML_ID=lists-clients_)#"); $replace = array($IBLOCK_ID); DEMO_IBlock_CopyFiles("/public/personal/lists/", "/personal/lists/"); //Add menu item DEMO_IBlock_AddMenuItem("/personal/.left.menu.php", array(GetMessage("DEMO_IBLOCK_LISTS_MENU"), "/personal/lists/", array(), array(), "")); CUrlRewriter::Add(array("CONDITION" => "#^/personal/lists/#", "RULE" => "", "ID" => "bitrix:lists", "PATH" => "/personal/lists/index.php")); $arProperties = array("PERSON", "PHONE"); foreach ($arProperties as $propertyName) { ${$propertyName . "_PROPERTY_ID"} = 0; $properties = CIBlockProperty::GetList(array(), array("ACTIVE" => "Y", "IBLOCK_ID" => $IBLOCK_ID, "CODE" => $propertyName)); if ($arProperty = $properties->Fetch()) { ${$propertyName . "_PROPERTY_ID"} = $arProperty["ID"]; } } CUserOptions::SetOption("form", "form_element_" . $IBLOCK_ID, array('tabs' => GetMessage("DEMO_IBLOCK_LISTS_CLIENT_TAB", array("PROPERTY_PERSON" => "PROPERTY_" . $PERSON_PROPERTY_ID, "PROPERTY_PHONE" => "PROPERTY_" . $PHONE_PROPERTY_ID))), true); }
static function UpdateUrlRewrite($url) { CUrlRewriter::Delete(array("ID" => "bitrix:webdav.extlinks")); $arU = array("CONDITION" => "#^" . $url . "/#", "RULE" => "", "ID" => "bitrix:webdav.extlinks", "PATH" => $url . "/extlinks.php"); CUrlRewriter::Add($arU); }
$absMenuPath = $io->RelativeToAbsolutePath($menuFolder); $absFile = $absPath . '/' . $fileName; $arReplace = array('#TITLE#' => GetMessage('MEETING_MODULE_NAME'), '#PATH#' => $meeting_folder . '/', '#RESERVE_MEETING_IBLOCK_ID#' => 0, '#RESERVE_VMEETING_IBLOCK_ID#' => 0); $site = CSite::GetSiteByFullPath($absPath); if (CModule::IncludeModule('iblock')) { $arXMLID = array("meeting_rooms_" . $site => '#RESERVE_MEETING_IBLOCK_ID#', "video-meeting_" . $site => '#RESERVE_VMEETING_IBLOCK_ID#'); $rsIBlock = CIBlock::GetList(array(), array("XML_ID" => array_keys($arXMLID), "TYPE" => "events")); while ($arIBlock = $rsIBlock->Fetch()) { $arReplace[$arXMLID[$arIBlock['XML_ID']]] = $arIBlock['ID']; } } if ($io->CreateDirectory($absPath)) { $c = str_replace(array_keys($arReplace), array_values($arReplace), file_get_contents(dirname(__FILE__) . "/public/index.php")); if ($f = $io->GetFile($absFile)) { $f->PutContents($c); CUrlRewriter::Add(array('CONDITION' => '#^' . $meeting_folder . '/#', 'RULE' => '', 'ID' => 'bitrix:meetings', 'PATH' => $meeting_folder . '/' . $fileName)); } if (CModule::IncludeModule('fileman')) { $absMenuFile = $absMenuPath . '/.left.menu.php'; $menuFile = $menuFolder . '/.left.menu.php'; $arResult = CFileMan::GetMenuArray($absMenuFile); $arMenuItems = $arResult["aMenuLinks"]; $menuTemplate = $arResult["sMenuTemplate"]; $menuItemPosition = 1; foreach ($arMenuItems as $item) { if ($item[0] == GetMessage('MEETING_MODULE_NAME') || $item[1] == $meeting_folder . '/') { $menuItemPosition = -1; break; } } if ($menuItemPosition > 0) {
private function CopyPublucFiles() { $target = $this->DOCUMENT_ROOT . $this->PublicDir; $source = $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/idea/install/public/idea/"; CopyDirFiles($source, $target, $this->REWRITE, true); if (file_exists($target . 'index.php')) { $arReplacePageIndex = array("IDEA_SEF_FOLDER" => $this->PublicDir, "IDEA_BLOG_CODE" => $this->ModuleBlogUrl, "IDEA_IBLOCK_CATEGORY" => $this->arResult["INSTALLATION"]["IBLOCK_ID"], "IDEA_BIND_DEFAULT" => $this->arResult["SETTINGS"]["STATUS_ID"]["NEW"]); $arReplaceFolderSection = array("IDEA_FOLDER_NAME" => GetMessage("IDEA_PUBLIC_FOLDER_TITLE")); //For Easy replace require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/wizard_util.php"; CWizardUtil::ReplaceMacros($target . 'index.php', $arReplacePageIndex); CWizardUtil::ReplaceMacros($target . '.section.php', $arReplaceFolderSection); //Add Sef $arFields = array("CONDITION" => "#^" . $this->PublicDir . "#", "RULE" => "", "ID" => "bitrix:idea", "PATH" => $this->PublicDir . "index.php", "SITE_ID" => $this->SITE_ID); CUrlRewriter::Add($arFields); } }
public static function ReindexFile($path, $SEARCH_SESS_ID = "", $max_file_size = 0) { global $APPLICATION; CMain::InitPathVars($site, $path); $DOC_ROOT = CSite::GetSiteDocRoot($site); if (!CUrlRewriter::CheckPath($path)) { return 0; } if ($max_file_size > 0 && filesize($DOC_ROOT . "/" . $path) > $max_file_size * 1024) { return 0; } $filesrc = $APPLICATION->GetFileContent($DOC_ROOT . "/" . $path); if (!$filesrc || $filesrc == "") { return 0; } $arComponents = PHPParser::ParseScript($filesrc); for ($i = 0, $cnt = count($arComponents); $i < $cnt; $i++) { if ($arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y") { if (array_key_exists("SEF_RULE", $arComponents[$i]["DATA"]["PARAMS"])) { $ruleMaker = new \Bitrix\Main\UrlRewriterRuleMaker(); $ruleMaker->process($arComponents[$i]["DATA"]["PARAMS"]["SEF_RULE"]); CUrlRewriter::Add(array("SITE_ID" => $site, "CONDITION" => $ruleMaker->getCondition(), "RULE" => $ruleMaker->getRule(), "ID" => $arComponents[$i]["DATA"]["COMPONENT_NAME"], "PATH" => $path)); } else { CUrlRewriter::Add(array("SITE_ID" => $site, "CONDITION" => "#^" . $arComponents[$i]["DATA"]["PARAMS"]["SEF_FOLDER"] . "#", "RULE" => "", "ID" => $arComponents[$i]["DATA"]["COMPONENT_NAME"], "PATH" => $path)); } } } return true; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule("meeting") || !CModule::IncludeModule("iblock")) { return; } $arXMLID = array("meeting_rooms_" . WIZARD_SITE_ID => 'RESERVE_MEETING_IBLOCK_ID', "video-meeting_" . WIZARD_SITE_ID => 'RESERVE_VMEETING_IBLOCK_ID'); $rsIBlock = CIBlock::GetList(array(), array("XML_ID" => array_keys($arXMLID), "TYPE" => "events")); $arReplace = array(); while ($arIBlock = $rsIBlock->Fetch()) { $arReplace[$arXMLID[$arIBlock['XML_ID']]] = $arIBlock['ID']; } CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/services/meeting/index.php", $arReplace); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'services/meeting/#', 'RULE' => '', 'ID' => 'bitrix:meetings', 'PATH' => WIZARD_SITE_DIR . '/services/meeting/index.php')); if (!WIZARD_IS_RERUN) { $arFields = array('TITLE' => GetMessage('MEETING_TITLE'), 'DATE_START' => ConvertTimeStamp(time() + 86400), 'DURATION' => 3600, 'DESCRIPTION' => GetMessage('MEETING_DESCRIPTION'), 'PLACE' => GetMessage('MEETING_PLACE'), 'USERS' => array(1 => CMeeting::ROLE_OWNER, 477 => CMeeting::ROLE_KEEPER, 11 => CMeeting::ROLE_MEMBER, rand(12, 476) => CMeeting::ROLE_MEMBER, rand(12, 476) => CMeeting::ROLE_MEMBER, rand(12, 476) => CMeeting::ROLE_MEMBER, rand(12, 476) => CMeeting::ROLE_MEMBER, rand(12, 476) => CMeeting::ROLE_MEMBER, rand(12, 476) => CMeeting::ROLE_MEMBER)); $MEETING_ID = CMeeting::Add($arFields); $arResponsible = array(1 => 1, 11, $arFields['USERS'][rand(3, 9)]); for ($i = 1; $i <= 3; $i++) { CMeetingItem::Add(array('MEETING_ID' => $MEETING_ID, 'TITLE' => GetMessage('MEETING_ITEM_TITLE_' . $i), 'SORT' => 100 * $i, 'RESPONSIBLE' => $arResponsible[$i])); } /* $iblockCode = "calendar_employees"; $iblockType = "events"; $rsIBlock = CIBlock::GetList(array(), array("CODE" => $iblockCode, "TYPE" => $iblockType)); if ($arIBlock = $rsIBlock->Fetch()) { CMeeting::AddEvent($MEETING_ID, $arFields, array("CALENDAR_IBLOCK_ID" => $arIBlock['ID']));
function OnChangeFileComponent($path, $site) { require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/php_parser.php"); global $APPLICATION; $docRoot = CSite::GetSiteDocRoot($site); CUrlRewriter::Delete( array("SITE_ID" => $site, "PATH" => $path, "ID" => "NULL") ); $fileSrc = $APPLICATION->GetFileContent($docRoot.$path); $arComponents = PHPParser::ParseScript($fileSrc); for ($i = 0, $cnt = count($arComponents); $i < $cnt; $i++) { if (isset($arComponents[$i]["DATA"]["PARAMS"]) && is_array($arComponents[$i]["DATA"]["PARAMS"])) { if (array_key_exists("SEF_MODE", $arComponents[$i]["DATA"]["PARAMS"]) && $arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y") { CUrlRewriter::Add( array( "SITE_ID" => $site, "CONDITION" => "#^".$arComponents[$i]["DATA"]["PARAMS"]["SEF_FOLDER"]."#", "ID" => $arComponents[$i]["DATA"]["COMPONENT_NAME"], "PATH" => $path ) ); } } } }
function InstallFiles() { global $install_public, $public_rewrite, $public_dir; if($_ENV["COMPUTERNAME"]!='BX') { CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/blog/install/admin", $_SERVER["DOCUMENT_ROOT"]."/bitrix/admin", true); CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/blog/install/images", $_SERVER["DOCUMENT_ROOT"]."/bitrix/images/blog", true, True); CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/blog/install/themes", $_SERVER["DOCUMENT_ROOT"]."/bitrix/themes", true, true); CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/blog/install/components", $_SERVER["DOCUMENT_ROOT"]."/bitrix/components", true, true); CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/blog/install/public/templates", $_SERVER["DOCUMENT_ROOT"]."/bitrix/templates", true, true); } $install_public = (($install_public == "Y") ? "Y" : "N"); $errors = false; $arSite = Array(); $public_installed = false; $dbSites = CSite::GetList(($b = ""), ($o = ""), Array("ACTIVE" => "Y")); while ($site = $dbSites->Fetch()) { $arSite[] = Array( "LANGUAGE_ID" => $site["LANGUAGE_ID"], "ABS_DOC_ROOT" => $site["ABS_DOC_ROOT"], "DIR" => $site["DIR"], "SITE_ID" => $site["LID"], "SERVER_NAME" =>$site["SERVER_NAME"], "NAME" => $site["NAME"] ); } foreach($arSite as $fSite) { global ${"install_public_".$fSite["SITE_ID"]}; global ${"public_path_".$fSite["SITE_ID"]}; global ${"public_rewrite_".$fSite["SITE_ID"]}; global ${"is404_".$fSite["SITE_ID"]}; if (${"install_public_".$fSite["SITE_ID"]} == "Y" && !empty(${"public_path_".$fSite["SITE_ID"]})) { $public_dir = ${"public_path_".$fSite["SITE_ID"]}; $bReWritePublicFiles = ${"public_rewrite_".$fSite["SITE_ID"]}; $folder = (${"is404_".$fSite["SITE_ID"]}=="Y")?"SEF":"NSEF"; CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/blog/install/public/".$folder, $fSite['ABS_DOC_ROOT'].$fSite["DIR"].$public_dir, $bReWritePublicFiles, true); if ($folder == "SEF") { if (file_exists($fSite['ABS_DOC_ROOT'].$fSite["DIR"].$public_dir."/index.php")) { if (!function_exists("file_get_contents")) { function file_get_contents($filename) { $fd = fopen("$filename", "rb"); $content = fread($fd, filesize($filename)); fclose($fd); return $content; } } $file = file_get_contents($fSite['ABS_DOC_ROOT'].$fSite["DIR"].$public_dir."/index.php"); if ($file) { $file = str_replace("#SEF_FOLDER#", "/".$public_dir."/", $file); if ($f = fopen($fSite['ABS_DOC_ROOT'].$fSite["DIR"].$public_dir."/index.php", "w")) { @fwrite($f, $file); @fclose($f); } } } $arFields = array( "CONDITION" => "#^/".$public_dir."/#", "RULE" => "", "ID" => "bitrix:blog", "PATH" => "/".$public_dir."/index.php" ); CUrlRewriter::Add($arFields); } $public_installed = true; } } return true; }
$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); } }
@fwrite($f, $file); @fclose($f); } } } if (file_exists($arSite['ABS_DOC_ROOT'] . $arSite["DIR"] . $installPath . "/.left.menu.php")) { $file = file_get_contents($arSite['ABS_DOC_ROOT'] . $arSite["DIR"] . $installPath . "/.left.menu.php"); if ($file) { $file = str_replace("#SEF_FOLDER#", "/" . $installPath . "/", $file); if ($f = fopen($arSite['ABS_DOC_ROOT'] . $arSite["DIR"] . $installPath . "/.left.menu.php", "w")) { @fwrite($f, $file); @fclose($f); } } } if (file_exists($arSite['ABS_DOC_ROOT'] . $arSite["DIR"] . $installPath . "/sect_inc.php")) { $file = file_get_contents($arSite['ABS_DOC_ROOT'] . $arSite["DIR"] . $installPath . "/sect_inc.php"); if ($file) { $file = str_replace("#SEF_FOLDER#", "/" . $installPath . "/", $file); if ($f = fopen($arSite['ABS_DOC_ROOT'] . $arSite["DIR"] . $installPath . "/sect_inc.php", "w")) { @fwrite($f, $file); @fclose($f); } } } if ($folder == "SEF") { $arFields = array("CONDITION" => "#^/" . $installPath . "/#", "RULE" => "", "ID" => "bitrix:socialnetwork", "PATH" => "/" . $installPath . "/index.php"); CUrlRewriter::Add($arFields); } } // ------------------ -------------------------------
function OnChangeFileComponent($path, $site) { require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/php_parser.php"; global $APPLICATION; $docRoot = CSite::GetSiteDocRoot($site); CUrlRewriter::Delete(array("SITE_ID" => $site, "PATH" => $path, "ID" => "NULL")); if (class_exists("\\Bitrix\\Main\\Application", false)) { \Bitrix\Main\Component\ParametersTable::deleteByFilter(array("SITE_ID" => $site, "REAL_PATH" => $path)); } $fileSrc = $APPLICATION->GetFileContent($docRoot . $path); $arComponents = PHPParser::ParseScript($fileSrc); for ($i = 0, $cnt = count($arComponents); $i < $cnt; $i++) { if (class_exists("\\Bitrix\\Main\\Application", false)) { \Bitrix\Main\Component\ParametersTable::add(array('SITE_ID' => $site, 'COMPONENT_NAME' => $arComponents[$i]["DATA"]["COMPONENT_NAME"], 'TEMPLATE_NAME' => $arComponents[$i]["DATA"]["TEMPLATE_NAME"], 'REAL_PATH' => $path, 'SEF_MODE' => $arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y" ? Component\ParametersTable::SEF_MODE : Component\ParametersTable::NOT_SEF_MODE, 'SEF_FOLDER' => $arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y" ? $arComponents[$i]["DATA"]["PARAMS"]["SEF_FOLDER"] : null, 'START_CHAR' => $arComponents[$i]["START"], 'END_CHAR' => $arComponents[$i]["END"], 'PARAMETERS' => serialize($arComponents[$i]["DATA"]["PARAMS"]))); } if (isset($arComponents[$i]["DATA"]["PARAMS"]) && is_array($arComponents[$i]["DATA"]["PARAMS"])) { if (array_key_exists("SEF_MODE", $arComponents[$i]["DATA"]["PARAMS"]) && $arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y") { CUrlRewriter::Add(array("SITE_ID" => $site, "CONDITION" => "#^" . $arComponents[$i]["DATA"]["PARAMS"]["SEF_FOLDER"] . "#", "ID" => $arComponents[$i]["DATA"]["COMPONENT_NAME"], "PATH" => $path)); } } } }
if (StrLen($CONDITION) <= 0) { $aMsg[] = array("id" => "CONDITION", "text" => GetMessage("MURL_NO_USL")); } if (empty($aMsg)) { if ($CONDITION_OLD != $CONDITION) { $arResult = CUrlRewriter::GetList(array("SITE_ID" => $site_id, "CONDITION" => $CONDITION)); if (count($arResult) > 0) { $aMsg[] = array("id" => "CONDITION", "text" => str_replace("#CONDITION#", htmlspecialcharsbx($CONDITION), GetMessage("MURL_DUPL_CONDITION"))); } } } if (empty($aMsg)) { if (StrLen($CONDITION_OLD) > 0) { CUrlRewriter::Update(array("SITE_ID" => $site_id, "CONDITION" => $CONDITION_OLD), array("CONDITION" => $CONDITION, "ID" => $ID, "PATH" => $FILE_PATH, "RULE" => $RULE)); } else { CUrlRewriter::Add(array("SITE_ID" => $site_id, "CONDITION" => $CONDITION, "ID" => $ID, "PATH" => $FILE_PATH, "RULE" => $RULE)); } } if (empty($aMsg)) { if (strlen($apply) <= 0) { LocalRedirect("/bitrix/admin/urlrewrite_list.php?lang=" . LANG . "&filter_site_id=" . UrlEncode($site_id) . "&" . GetFilterParams("filter_", false)); } } else { $message = new CAdminMessage(GetMessage("SAE_ERROR"), new CAdminException($aMsg)); $bVarsFromForm = true; } } if (StrLen($CONDITION) > 0) { $APPLICATION->SetTitle(GetMessage("MURL_EDIT")); } else { $APPLICATION->SetTitle(GetMessage("MURL_ADD"));
/** * Installs service * @return bool */ public static function install() { $settings = static::getSettings(); if (empty($settings)) { $res = Bitrix\Sale\TradingPlatformTable::add(array("CODE" => static::TRADING_PLATFORM_CODE, "ACTIVE" => "N", "NAME" => GetMessage("SALE_YMH_NAME"), "DESCRIPTION" => GetMessage("SALE_YMH_DESCRIPTION"), "SETTINGS" => "")); $b = "sort"; $o = "asc"; $dbSites = \CSite::GetList($b, $o, array("ACTIVE" => "Y")); while ($site = $dbSites->Fetch()) { \CUrlRewriter::Add(array("CONDITION" => "#^/bitrix/services/ymarket/#", "RULE" => "", "ID" => "", "PATH" => "/bitrix/services/ymarket/index.php", "SITE_ID" => $site["ID"])); } } else { $res = true; } return $res ? true : false; }
CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/quote/#', 'RULE' => '', 'ID' => 'bitrix:crm.quote', 'PATH' => WIZARD_SITE_DIR . 'crm/quote/index.php')); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/invoice/#', 'RULE' => '', 'ID' => 'bitrix:crm.invoice', 'PATH' => WIZARD_SITE_DIR . 'crm/invoice/index.php')); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/configs/fields/#', 'RULE' => '', 'ID' => 'bitrix:crm.config.fields', 'PATH' => WIZARD_SITE_DIR . 'crm/configs/fields/index.php')); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/configs/bp/#', 'RULE' => '', 'ID' => 'bitrix:crm.config.bp', 'PATH' => WIZARD_SITE_DIR . 'crm/configs/bp/index.php')); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/configs/perms/#', 'RULE' => '', 'ID' => 'bitrix:crm.config.perms', 'PATH' => WIZARD_SITE_DIR . 'crm/configs/perms/index.php')); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/product/#', 'RULE' => '', 'ID' => 'bitrix:crm.product', 'PATH' => WIZARD_SITE_DIR . 'crm/product/index.php')); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/configs/currency/#', 'RULE' => '', 'ID' => 'bitrix:crm.currency', 'PATH' => WIZARD_SITE_DIR . 'crm/configs/currency/index.php')); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/configs/tax/#', 'RULE' => '', 'ID' => 'bitrix:crm.config.tax', 'PATH' => WIZARD_SITE_DIR . 'crm/configs/tax/index.php')); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/configs/locations/#', 'RULE' => '', 'ID' => 'bitrix:crm.config.locations', 'PATH' => WIZARD_SITE_DIR . 'crm/configs/locations/index.php')); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/configs/ps/#', 'RULE' => '', 'ID' => 'bitrix:crm.config.ps', 'PATH' => WIZARD_SITE_DIR . 'crm/configs/ps/index.php')); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/reports/report/#', 'RULE' => '', 'ID' => 'bitrix:crm.report', 'PATH' => WIZARD_SITE_DIR . 'crm/reports/report/index.php')); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/configs/mailtemplate/#', 'RULE' => '', 'ID' => 'bitrix:crm.mail_template', 'PATH' => WIZARD_SITE_DIR . 'crm/configs/mailtemplate/index.php')); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/configs/exch1c/#', 'RULE' => '', 'ID' => 'bitrix:crm.config.exch1c', 'PATH' => WIZARD_SITE_DIR . 'crm/configs/exch1c/index.php')); CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/quote/#', 'RULE' => '', 'ID' => 'bitrix:crm.quote', 'PATH' => WIZARD_SITE_DIR . 'crm/quote/index.php')); CUrlRewriter::Add(array("CONDITION" => '#^' . WIZARD_SITE_DIR . 'crm/configs/measure/#', "RULE" => '', "ID" => 'bitrix:crm.config.measure', "PATH" => WIZARD_SITE_DIR . 'crm/configs/measure/index.php')); CUrlRewriter::Add(array("CONDITION" => '#^' . WIZARD_SITE_DIR . 'crm/configs/productprops/#', "RULE" => '', "ID" => "bitrix:crm.config.productprops", "PATH" => WIZARD_SITE_DIR . 'crm/configs/productprops/index.php')); } if (!WIZARD_IS_RERUN || COption::GetOptionString("crm", "form_features") == "Y") { // desktop on CRM index page $arOptions["GADGETS"] = array("CRM_MY_ACTIVITIES@1494" => array("COLUMN" => "0", "HIDE" => "N", "SETTINGS" => array("TITLE_STD" => GetMessage('CRM_GADGET_MY_ACTIVITY'), "SORT_BY" => "DESC", "ITEM_COUNT" => "5")), "CRM_DEAL_LIST@9562" => array("COLUMN" => "1", "ROW" => "0", "HIDE" => "N", "SETTINGS" => array("TITLE_STD" => GetMessage('CRM_GADGET_MY_DEAL_TITLE'), "STAGE_ID" => "WON", "ONLY_MY" => "N", "SORT" => "DATE_MODIFY", "SORT_BY" => "DESC", "DEAL_COUNT" => "3")), "CRM_LEAD_LIST@27424" => array("COLUMN" => "1", "ROW" => "2", "HIDE" => "N", "SETTINGS" => array("TITLE_STD" => GetMessage('CRM_GADGET_MY_LEAD_TITLE'), "STATUS_ID" => array("NEW", "ASSIGNED", "DETAILS", "CANNOT_CONTACT", "IN_PROCESS", "ON_HOLD", "RESTORED", "JUNK"), "ONLY_MY" => "N", "DATE_CREATE", "SORT_BY" => "DESC", "LEAD_COUNT" => "3")), "desktop-actions" => array("COLUMN" => 2, "ROW" => 0, "HIDE" => "N")); WizardServices::SetUserOption('intranet', '~gadgets_crm', $arOptions, $common = true); } if (WIZARD_INSTALL_DEMO_DATA && WIZARD_SITE_ID == "s1") { $CCrmRole = new CCrmRole(); $arRoles = array('adm' => array('NAME' => GetMessage('CRM_ROLE_ADMIN'), 'RELATION' => array('LEAD' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'DEAL' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'CONTACT' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'COMPANY' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'QUOTE' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'INVOICE' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'CONFIG' => array('WRITE' => array('-' => 'X')))), 'dir' => array('NAME' => GetMessage('CRM_ROLE_DIRECTOR'), 'RELATION' => array('LEAD' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'DEAL' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'CONTACT' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'COMPANY' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'QUOTE' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'INVOICE' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')))), 'chif' => array('NAME' => GetMessage('CRM_ROLE_CHIF'), 'RELATION' => array('LEAD' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')), 'DEAL' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')), 'CONTACT' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')), 'COMPANY' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'QUOTE' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')), 'INVOICE' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')))), 'man' => array('NAME' => GetMessage('CRM_ROLE_MAN'), 'RELATION' => array('LEAD' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')), 'DEAL' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')), 'CONTACT' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')), 'COMPANY' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'QUOTE' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')), 'INVOICE' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A'))))); $iRoleIDAdm = $iRoleIDDir = $iRoleIDChif = $iRoleIDMan = 0; $obRole = CCrmRole::GetList(array(), array()); while ($arRole = $obRole->Fetch()) { if ($arRole['NAME'] == GetMessage('CRM_ROLE_ADMIN')) { $iRoleIDAdm = $arRole['ID']; } else {
} } COption::SetOptionString("wiki", "socnet_iblock_type_id", $IBLOCK_TYPE_ID, false); COption::SetOptionString("wiki", "socnet_iblock_id", $SOCNET_ID, false); COption::SetOptionString("wiki", "socnet_enable", 'Y', false); CWikiSocnet::EnableSocnet(true); if (IsModuleInstalled("forum")) { CModule::IncludeModule("forum"); $arGroupID = array("GENERAL" => 0, "COMMENTS" => 0, "HIDDEN" => 0); $dbExistsGroup = CForumGroup::GetListEx(array(), array("LID" => LANGUAGE_ID)); while ($arExistsGroup = $dbExistsGroup->Fetch()) { foreach ($arGroupID as $xmlID => $ID) { if ($arExistsGroup["NAME"] == GetMessage($xmlID . "_GROUP_NAME")) { $arGroupID[$xmlID] = $arExistsGroup["ID"]; } } } $arFields = array("ACTIVE" => "Y", "NAME" => GetMessage('WIKI_FORUM_SOCNET_NAME'), "FORUM_GROUP_ID" => $arGroupID["HIDDEN"], "GROUP_ID" => array(1 => "Y", 2 => 'E', 3 => 'M', WIZARD_PORTAL_ADMINISTRATION_GROUP => "M", WIZARD_DIRECTION_GROUP => "M", WIZARD_PERSONNEL_DEPARTMENT_GROUP => "M", WIZARD_EMPLOYEES_GROUP => "M"), "SITES" => array(WIZARD_SITE_ID => WIZARD_SITE_DIR . "community/forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/#message#MESSAGE_ID#")); $SOCNET_FORUM_ID = CForumNew::Add($arFields); COption::SetOptionString("wiki", "socnet_forum_id", $SOCNET_FORUM_ID, false); COption::SetOptionString("wiki", "socnet_use_review", "Y", false); COption::SetOptionString("wiki", "socnet_use_captcha", "Y", false); COption::SetOptionString("wiki", "socnet_message_per_page", 10, false); } else { COption::SetOptionString("wiki", "socnet_use_review", "N", false); } } CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/services/wiki.php", $arReplaceParam); if (WIZARD_INSTALL_DEMO_DATA) { CUrlRewriter::Add(array("CONDITION" => "#^" . WIZARD_SITE_DIR . "services/wiki/#", "RULE" => "", "ID" => "bitrix:wiki", "PATH" => WIZARD_SITE_DIR . "services/wiki.php")); }