本文整理汇总了PHP中CUrlRewriter::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CUrlRewriter::Add方法的具体用法?PHP CUrlRewriter::Add怎么用?PHP CUrlRewriter::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUrlRewriter
的用法示例。
在下文中一共展示了CUrlRewriter::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InstallFiles
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;
}
示例2: InstallDB
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;
}
示例3: dirname
<?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"));
}
示例4: array
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;
示例5: ReindexFile
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;
}
示例6: dirname
<?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"));
}
}
示例7: UndoFileDelete
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");
}
示例8: OnChangeFileComponent
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));
}
}
}
}
示例9: dirname
<?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"));
}
示例10: array
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(), ""));
}
示例11: DoInstall
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");
}
}
示例12: DeleteDirFilesEx
}
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"));
}
示例13: dirname
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);
}
示例14: UpdateUrlRewrite
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);
}
示例15: array
$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) {