当前位置: 首页>>代码示例>>PHP>>正文


PHP CUrlRewriter类代码示例

本文整理汇总了PHP中CUrlRewriter的典型用法代码示例。如果您正苦于以下问题:PHP CUrlRewriter类的具体用法?PHP CUrlRewriter怎么用?PHP CUrlRewriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CUrlRewriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: BXDeleteFromSystem

function BXDeleteFromSystem($absoluteFilePath, $path, $site)
{
    $io = CBXVirtualIo::GetInstance();
    $f = $io->GetFile($absoluteFilePath);
    $f->MarkWritable();
    if (COption::GetOptionInt("main", "disk_space") > 0) {
        $file_size = $f->GetFileSize();
        $quota = new CDiskQuota();
        $quota->UpdateDiskQuota("file", $file_size, "delete");
    }
    $sucess = $io->Delete($absoluteFilePath);
    if (!$sucess) {
        return false;
    }
    if (COption::GetOptionString($module_id, "log_page", "Y") == "Y") {
        $res_log['path'] = substr($path, 1);
        CEventLog::Log("content", "PAGE_DELETE", "main", "", serialize($res_log));
    }
    $GLOBALS["APPLICATION"]->RemoveFileAccessPermission(array($site, $path));
    if (CModule::IncludeModule("search")) {
        CSearch::DeleteIndex("main", $site . "|" . $path);
    }
    //Delete from rewrite rule
    CUrlRewriter::Delete(array("SITE_ID" => $site, "PATH" => $path));
    if (class_exists("\\Bitrix\\Main\\Application", false)) {
        \Bitrix\Main\Component\ParametersTable::deleteByFilter(array("SITE_ID" => $site, "REAL_PATH" => $path));
    }
    return true;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:29,代码来源:file_delete.php

示例2: 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;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:30,代码来源:index.php

示例3: 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;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:39,代码来源: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;
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:files.php

示例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;
 }
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:24,代码来源:urlrewriter.php

示例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"));
    }
}
开发者ID:webgksupport,项目名称:alpina,代码行数:30,代码来源:books-books.php

示例7: __GetSEFRealUrl

 function __GetSEFRealUrl($url)
 {
     $arResult = CUrlRewriter::GetList(array('QUERY' => $url));
     if (is_array($arResult) && count($arResult) > 0) {
         return $arResult[0]['PATH'];
     } else {
         return false;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:component_ajax.php

示例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));
             }
         }
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:26,代码来源:main.php

示例9: defined

        $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);
    }
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:site.php

示例10: InstallFiles

 function InstallFiles()
 {
     global $APPLICATION;
     if ($_ENV["COMPUTERNAME"] != 'BX') {
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/install/admin", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/admin", true);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/install/components", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", true, true);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/install/js", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/js", true, true);
         CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/disk/install/tools/', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/tools', true, true);
         CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/disk/install/services/', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/services', true, true);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/install/images", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/images", true, true);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/install/public", $_SERVER["DOCUMENT_ROOT"] . "/", true, true);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/install/webdav", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/webdav", true, true);
         CUrlRewriter::add(array("CONDITION" => "#^/docs/pub/(?<hash>[0-9a-f]{32})/(?<action>[0-9a-zA-Z]+)/\\?#", "RULE" => "hash=\$1&action=\$2&", "ID" => "bitrix:disk.external.link", "PATH" => "/docs/pub/index.php"));
         CUrlRewriter::add(array("CONDITION" => "#^/disk/(?<action>[0-9a-zA-Z]+)/(?<fileId>[0-9]+)/\\?#", "RULE" => "action=\$1&fileId=\$2&", "ID" => "bitrix:disk.services", "PATH" => "/bitrix/services/disk/index.php"));
         $APPLICATION->SetFileAccessPermission('/bitrix/tools/disk/', array('*' => 'R'));
         $APPLICATION->SetFileAccessPermission('/bitrix/services/disk/', array('*' => 'R'));
         $APPLICATION->SetFileAccessPermission('/docs/pub/', array('*' => 'R'));
         $APPLICATION->SetFileAccessPermission('/bitrix/admin/disk_bizproc_activity_settings.php', array('2' => 'R'));
         $APPLICATION->SetFileAccessPermission('/bitrix/admin/disk_bizproc_selector.php', array('2' => 'R'));
         $APPLICATION->SetFileAccessPermission('/bitrix/admin/disk_bizproc_wf_settings.php', array('2' => 'R'));
     }
     return true;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:23,代码来源:index.php

示例11: OnChangeFileComponent

	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
						)
					);
				}
			}
		}
	}
开发者ID:nProfessor,项目名称:Mytb,代码行数:33,代码来源:main.php

示例12: array

<?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']));
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:index.php

示例13: ReindexFile

 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;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:29,代码来源:urlrewriter.php

示例14: GetULRsFromIBlockID

 public static function GetULRsFromIBlockID($IBLOCK_ID, $params = array())
 {
     $IBLOCK_ID = intval($IBLOCK_ID);
     if ($IBLOCK_ID <= 0) {
         return false;
     }
     $params = is_array($params) ? $params : array();
     $params["path"] = trim(!!$params["path"] ? $params["path"] : (!!$params["PATH"] ? $params["PATH"] : ""));
     if (empty($params["path"])) {
         $params["path"] = CIBlock::GetArrayByID($IBLOCK_ID, "DETAIL_PAGE_URL");
     }
     // Params for socialnetwork
     static $arExtranetSite = false;
     static $defSite = false;
     $params["SECTION_ID"] = intval($params["SECTION_ID"]);
     // root section id
     $params["ELEMENT_ID"] = intval($params["ELEMENT_ID"]);
     $arSection = is_array($params["SECTION"]) ? $params["SECTION"] : array();
     // root section
     $arElement = is_array($params["ELEMENT"]) ? $params["ELEMENT"] : array();
     if (empty($arSection)) {
         if ($params["SECTION_ID"] > 0) {
             $arSection = CIBlockSection::GetList(array(), array("ID" => $params["SECTION_ID"], 'CHECK_PERMISSIONS' => 'N'), false, array('ID', 'IBLOCK_ID', 'SOCNET_GROUP_ID', 'CREATED_BY'))->fetch();
         } else {
             if ($params["ELEMENT_ID"] > 0 && empty($arElement)) {
                 $arElement = CIBlockElement::GetList(array(), array('ID' => $params["ELEMENT_ID"]), false, false, array('ID', 'IBLOCK_SECTION_ID', 'IBLOCK_CODE', 'IBLOCK_ID'))->fetch();
             }
             if (!empty($arElement) && $arElement["IBLOCK_SECTION_ID"] > 0) {
                 $res = CWebDavSymlinkHelper::getNavChain($IBLOCK_ID, $arElement["IBLOCK_SECTION_ID"]);
                 if (!!$res) {
                     $arSection = reset($res);
                 }
             }
         }
     }
     if (empty($arSection) || $arSection["IBLOCK_ID"] != $IBLOCK_ID) {
         $arSection = array();
         $arElement = array();
     }
     // Params for socialnetwork /
     if (strpos($params["path"], "#SITE_DIR#") !== false) {
         $params["path"] = str_replace("#SITE_DIR#", SITE_DIR, $params["path"]);
     } else {
         if (array_key_exists("SITE_ID", $params) && CModule::IncludeModule('extranet') && CExtranet::GetExtranetSiteID() == $params["SITE_ID"]) {
             if ($arExtranetSite === false) {
                 $rsSites = CSite::GetByID(SITE_ID);
                 $arExtranetSite = $rsSites->Fetch();
                 unset($rsSites);
             }
             if ($arExtranetSite) {
                 if ($defSite === false) {
                     $defSite = CSite::GetDefSite();
                 }
                 $params["path"] = $arExtranetSite["DIR"] . $params["path"];
             }
         }
     }
     $SEF_FOLDER = "/";
     $SEF_URL_TEMPLATES = array();
     $arUrlRewrite = CUrlRewriter::GetList(!empty($params["path"]) ? array("QUERY" => str_replace("//", "/", $params["path"])) : array());
     $entity = false;
     foreach ($arUrlRewrite as $arRule) {
         if (!in_array($arRule["ID"], array("bitrix:webdav", "bitrix:socialnetwork", "bitrix:socialnetwork_user", "bitrix:socialnetwork_group"))) {
             continue;
         }
         $arComponents = WDGetComponentsOnPage($arRule["PATH"]);
         $firstMet = !empty($params["path"]);
         foreach ($arComponents as $arComponent) {
             if ($arComponent["COMPONENT_NAME"] == $arRule["ID"]) {
                 $SEF_FOLDER = $arComponent["PARAMS"]["SEF_FOLDER"];
                 if (strpos($arRule["ID"], "bitrix:socialnetwork") === 0) {
                     if ($arRule["ID"] == "bitrix:socialnetwork" && $arComponent["PARAMS"]["FILES_GROUP_IBLOCK_ID"] == $arComponent["PARAMS"]["FILES_USER_IBLOCK_ID"] && ($firstMet || $arComponent["PARAMS"]["FILES_USER_IBLOCK_ID"] == $IBLOCK_ID)) {
                         $entity = $arSection["SOCNET_GROUP_ID"] > 0 ? "group" : "user";
                     } else {
                         if (($firstMet || $arComponent["PARAMS"]["FILES_USER_IBLOCK_ID"] == $IBLOCK_ID) && ($arRule["ID"] == "bitrix:socialnetwork_user" || $arRule["ID"] == "bitrix:socialnetwork")) {
                             $entity = "user";
                         } else {
                             if (($firstMet || $arComponent["PARAMS"]["FILES_GROUP_IBLOCK_ID"] == $IBLOCK_ID) && ($arRule["ID"] == "bitrix:socialnetwork_group" || $arRule["ID"] == "bitrix:socialnetwork")) {
                                 $entity = "group";
                             }
                         }
                     }
                     if (!!$entity) {
                         $SEF_URL_TEMPLATES = $entity == "user" ? array("path" => $arComponent["PARAMS"]["SEF_URL_TEMPLATES"]["user_files"], "view" => "user/#user_id#/files/element/view/#element_id#/", "edit" => "user/#user_id#/files/element/edit/#element_id#/#action#/", "history" => "user/#user_id#/files/element/history/#element_id#/", "history_get" => "user/#user_id#/files/element/historyget/#element_id#/#element_name#") : array("path" => $arComponent["PARAMS"]["SEF_URL_TEMPLATES"]["group_files"], "view" => "group/#group_id#/files/element/view/#element_id#/", "edit" => "group/#group_id#/files/element/edit/#element_id#/#action#/", "history" => "group/#group_id#/files/element/history/#element_id#/", "history_get" => "group/#group_id#/files/element/historyget/#element_id#/#element_name#");
                     }
                 } else {
                     if ($arRule["ID"] == "bitrix:webdav" && ($firstMet || $arComponent["PARAMS"]["IBLOCK_ID"] == $IBLOCK_ID)) {
                         $entity = "lib";
                         $SEF_URL_TEMPLATES = array("path" => $arComponent["PARAMS"]["SEF_URL_TEMPLATES"]["sections"], "view" => $arComponent["PARAMS"]["SEF_URL_TEMPLATES"]["element"], "edit" => $arComponent["PARAMS"]["SEF_URL_TEMPLATES"]["element_edit"], "history" => $arComponent["PARAMS"]["SEF_URL_TEMPLATES"]["element_history"], "history_get" => $arComponent["PARAMS"]["SEF_URL_TEMPLATES"]["element_history_get"]);
                     }
                 }
                 if (!!$entity) {
                     $SEF_URL_TEMPLATES["component"] = $arRule["ID"];
                     break 2;
                 }
             }
         }
     }
     $repl = array("#id#", "#ELEMENT_ID#", "#element_id#", "#name#", "#ELEMENT_NAME#", "#element_name#", "#action#", "//");
     $patt = array("#ELEMENT_ID#", "#ELEMENT_ID#", "#ELEMENT_ID#", "#ELEMENT_NAME#", "#ELEMENT_NAME#", "#ELEMENT_NAME#", "#ACTION#", "/");
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:iblock.php

示例15: 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"));
}
开发者ID:Satariall,项目名称:izurit,代码行数:25,代码来源:services-faq.php


注:本文中的CUrlRewriter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。