예제 #1
0
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;
}
예제 #2
0
 function InstallFiles()
 {
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mobile/public/mobile/", $_SERVER["DOCUMENT_ROOT"] . "/mobile/", True, True);
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mobile/install/templates/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/templates/", True, True);
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mobile/install/components/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", true, true);
     $default_site_id = CSite::GetDefSite();
     if ($default_site_id) {
         $arAppTempalate = array("SORT" => 1, "CONDITION" => "CSite::InDir('/mobile/')", "TEMPLATE" => "mobile_app");
         $arFields = array("TEMPLATE" => array());
         $dbTemplates = CSite::GetTemplateList($default_site_id);
         $mobileAppFound = false;
         while ($template = $dbTemplates->Fetch()) {
             if ($template["TEMPLATE"] == "mobile_app") {
                 $mobileAppFound = true;
                 $template = $arAppTempalate;
             }
             $arFields["TEMPLATE"][] = array("TEMPLATE" => $template['TEMPLATE'], "SORT" => $template['SORT'], "CONDITION" => $template['CONDITION']);
         }
         if (!$mobileAppFound) {
             $arFields["TEMPLATE"][] = $arAppTempalate;
         }
         $obSite = new CSite();
         $arFields["LID"] = $default_site_id;
         $obSite->Update($default_site_id, $arFields);
     }
     CUrlRewriter::ReindexFile("/mobile/webdav/index.php");
     CUrlRewriter::ReindexFile("/mobile/disk/index.php");
     CUrlRewriter::Add(array("CONDITION" => "#^/mobile/disk/(?<hash>[0-9]+)/download#", "RULE" => "download=1&objectId=\$1", "ID" => "bitrix:mobile.disk.file.detail", "PATH" => "/mobile/disk/index.php"));
     return true;
 }
예제 #3
0
 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;
 }
예제 #4
0
    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
0
 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
0
<?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
0
 function __GetSEFRealUrl($url)
 {
     $arResult = CUrlRewriter::GetList(array('QUERY' => $url));
     if (is_array($arResult) && count($arResult) > 0) {
         return $arResult[0]['PATH'];
     } else {
         return false;
     }
 }
예제 #8
0
 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
0
        $CHARSET = defined("BX_UTF") ? "UTF-8" : "windows-1251";
        $SERVER_NAME = $_SERVER["SERVER_NAME"];
    }
    $culture = CultureTable::getRow(array('filter' => array("=FORMAT_DATE" => $FORMAT_DATE, "=FORMAT_DATETIME" => $FORMAT_DATETIME, "=FORMAT_NAME" => $FORMAT_NAME, "=CHARSET" => $CHARSET)));
    if ($culture) {
        $cultureId = $culture["ID"];
    } else {
        $addResult = CultureTable::add(array("NAME" => WIZARD_SITE_ID, "CODE" => WIZARD_SITE_ID, "FORMAT_DATE" => $FORMAT_DATE, "FORMAT_DATETIME" => $FORMAT_DATETIME, "FORMAT_NAME" => $FORMAT_NAME, "CHARSET" => $CHARSET));
        $cultureId = $addResult->getId();
    }
    $arFields = array("LID" => WIZARD_SITE_ID, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => WIZARD_SITE_NAME, "DIR" => WIZARD_SITE_DIR, "SITE_NAME" => WIZARD_SITE_NAME, "SERVER_NAME" => $SERVER_NAME, "EMAIL" => $EMAIL, "LANGUAGE_ID" => $LANGUAGE_ID, "DOC_ROOT" => $DOC_ROOT, "CULTURE_ID" => $cultureId);
    $obSite = new CSite();
    $result = $obSite->Add($arFields);
    if ($result) {
        COption::SetOptionString("main", "wizard_site_id", WIZARD_SITE_ID);
        COption::SetOptionString("extranet", "extranet_site", WIZARD_SITE_ID);
    }
    CExtranetWizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "/", array("SITE_DIR" => WIZARD_SITE_DIR));
    CExtranetWizardServices::ReplaceMacrosRecursive(WIZARD_TEMPLATE_ABSOLUTE_PATH . "/", array("SITE_DIR" => WIZARD_SITE_DIR));
    CUrlRewriter::Add(array("SITE_ID" => WIZARD_SITE_ID, "CONDITION" => "#^" . WIZARD_SITE_DIR . "workgroups/#", "ID" => "bitrix:socialnetwork_group", "PATH" => WIZARD_SITE_DIR . "workgroups/index.php"));
    CUrlRewriter::Add(array("SITE_ID" => WIZARD_SITE_ID, "CONDITION" => "#^" . WIZARD_SITE_DIR . "workgroups/create/#", "ID" => "bitrix:extranet.group_create", "PATH" => WIZARD_SITE_DIR . "workgroups/create/index.php"));
    CUrlRewriter::Add(array("SITE_ID" => WIZARD_SITE_ID, "CONDITION" => "#^" . WIZARD_SITE_DIR . "contacts/personal/#", "ID" => "bitrix:socialnetwork_user", "PATH" => WIZARD_SITE_DIR . "contacts/personal.php"));
} else {
    COption::SetOptionString("main", "wizard_site_id", WIZARD_SITE_ID);
    $siteName = COption::GetOptionString("main", "site_name", "", WIZARD_SITE_ID, true);
    if (strlen($siteName) > 0) {
        $arFields = array("NAME" => $siteName);
        $obSite = new CSite();
        $obSite->Update(WIZARD_SITE_ID, $arFields);
    }
}
예제 #10
0
 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;
 }
예제 #11
0
파일: main.php 프로젝트: nProfessor/Mytb
	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
						)
					);
				}
			}
		}
	}
예제 #12
0
<?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']));
예제 #13
0
 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;
 }
예제 #14
0
 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#", "/");
     if ($entity != "lib") {
         $repl[] = "#SOCNET_USER_ID#";
         $patt[] = "#USER_ID#";
         $repl[] = "#socnet_user_id#";
         $patt[] = "#USER_ID#";
         $repl[] = "#user_id#";
         $patt[] = "#USER_ID#";
         $repl[] = "#SOCNET_GROUP_ID#";
         $patt[] = "#GROUP_ID#";
         $repl[] = "#socnet_group_id#";
         $patt[] = "#GROUP_ID#";
         $repl[] = "#group_id#";
         $patt[] = "#GROUP_ID#";
         $repl[] = "#SOCNET_OBJECT_ID#";
         $patt[] = "#SOCNET_OBJECT#";
         $repl[] = "#socnet_object_id#";
         $patt[] = "#SOCNET_OBJECT#";
         $repl[] = "#socnet_object#";
         $patt[] = "#SOCNET_OBJECT#";
         if (!empty($arSection)) {
             $repl[] = "#USER_ID#";
             $patt[] = $arSection["CREATED_BY"];
             $repl[] = "#GROUP_ID#";
             $patt[] = $arSection["SOCNET_GROUP_ID"];
             $patt[] = "#SOCNET_OBJECT#";
             $patt[] = $arSection["SOCNET_GROUP_ID"] > 0 ? "group" : "user";
         }
     }
     if (!empty($arElement)) {
         $repl[] = "#ID#";
         $patt[] = $arElement["ID"];
         $repl[] = "#ELEMENT_ID#";
         $patt[] = $arElement["ID"];
         $repl[] = "#NAME#";
         $patt[] = $arElement["NAME"];
         $repl[] = "#ELEMENT_NAME#";
         $patt[] = $arElement["NAME"];
     }
     foreach ($SEF_URL_TEMPLATES as $key => $val) {
         $SEF_URL_TEMPLATES[$key] = str_replace($repl, $patt, $SEF_FOLDER . "/" . $val);
     }
     $SEF_URL_TEMPLATES["path"] = str_replace(array("#path#", "#PATH#"), "", $SEF_URL_TEMPLATES["path"]);
     $SEF_URL_TEMPLATES["delete_dropped"] = str_replace("#ACTION#", "delete_dropped", $SEF_URL_TEMPLATES["edit"]);
     $SEF_URL_TEMPLATES["edit"] = str_replace("#ACTION#", "edit", $SEF_URL_TEMPLATES["edit"]);
     $SEF_URL_TEMPLATES["entity"] = $entity;
     return $SEF_URL_TEMPLATES;
 }
예제 #15
0
<?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"));
}
예제 #16
0
$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) {
예제 #17
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);
     }
 }
예제 #18
0
        }
    }
    foreach ($arID as $ID) {
        if (strlen($ID) <= 0) {
            continue;
        }
        switch ($_REQUEST['action']) {
            case "delete":
                @set_time_limit(0);
                CUrlRewriter::Delete(array("SITE_ID" => $filter_site_id, "CONDITION" => $ID));
                break;
        }
    }
}
// инициализация списка - выборка данных
$arResultList = CUrlRewriter::GetList($arFilter, array($by => $order));
$dbResultList = new CDBResult();
$dbResultList->InitFromArray($arResultList);
$dbResultList = new CAdminResult($dbResultList, $sTableID);
$dbResultList->NavStart();
// установке параметров списка
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("SAA_NAV")));
// заголовок списка
$lAdmin->AddHeaders(array(array("id" => "CONDITION", "content" => GetMessage("MURL_USL"), "sort" => "CONDITION", "default" => true), array("id" => "ID", "content" => GetMessage("MURL_COMPONENT"), "sort" => "ID", "default" => true), array("id" => "PATH", "content" => GetMessage("MURL_FILE"), "sort" => "PATH", "default" => true), array("id" => "RULE", "content" => GetMessage("MURL_RULE"), "sort" => "RULE", "default" => true)));
$arVisibleColumns = $lAdmin->GetVisibleHeaderColumns();
// построение списка
while ($arResult = $dbResultList->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_CONDITION, $arResult, "urlrewrite_edit.php?CONDITION=" . UrlEncode($arResult["CONDITION"]) . "&lang=" . LANG . "&site_id=" . UrlEncode($filter_site_id), GetMessage("MURL_EDIT"));
    $row->AddField("CONDITION", $f_CONDITION);
    $row->AddField("ID", $f_ID);
    $row->AddField("PATH", $f_PATH);
예제 #19
0
 /**
  * Sets right search path for comments, likes etc.
  * http://jabber.bx/view.php?id=25340
  * @param int $forumID - forum's ID were comments saving (for example $arParams['FORUM_ID'])
  * @param str $rightPath - wich path must leads to the comment ( for example: "/comment/#MESSAGE_ID#/" )
  * @param str $urlRewriterPath - wich path leads to curent module (complex component) ( for example: "/services/wiki.php" )
  * @return bool true|false
  */
 static function SetCommentPath($forumID, $rightPath, $urlRewriterPath)
 {
     if (!$forumID || !CModule::IncludeModule('forum') || !$rightPath || !$urlRewriterPath) {
         return false;
     }
     $arRewriter = CUrlRewriter::GetList(array("PATH" => $urlRewriterPath));
     //http://jabber.bx/view.php?id=25340
     if (!is_array($arRewriter) || empty($arRewriter)) {
         return false;
     }
     $rewriteCondition = str_replace(array("#", "^"), "", $arRewriter[0]["CONDITION"]);
     $rightCommentsPath = $rewriteCondition . $rightPath;
     $arActualCommentsPath = CWikiUtils::GetCommentPath($forumID);
     if (!is_array($arActualCommentsPath)) {
         return false;
     }
     $arUpdateForum = array();
     foreach ($arActualCommentsPath as $site => $path) {
         if ($path != $rightCommentsPath) {
             $arUpdateForum["SITES"][$site] = $rightCommentsPath;
         }
     }
     if (!empty($arUpdateForum)) {
         CForumNew::Update($forumID, $arUpdateForum);
     }
     return true;
 }
예제 #20
0
    function OnBeforeProlog()
    {
        global $USER, $APPLICATION;
        if (isset($_SERVER["PHP_AUTH_USER"]) && (!defined("NOT_CHECK_PERMISSIONS") || NOT_CHECK_PERMISSIONS !== true) && (CWebDavBase::IsDavHeaders("check_all") || !$USER->IsAuthorized())) {
            if (strlen($_SERVER["PHP_AUTH_USER"]) > 0 and strlen($_SERVER["PHP_AUTH_PW"]) > 0) {
                if (strpos($_SERVER["PHP_AUTH_USER"], $_SERVER['HTTP_HOST'] . "\\") === 0) {
                    $_SERVER["PHP_AUTH_USER"] = str_replace($_SERVER['HTTP_HOST'] . "\\", "", $_SERVER["PHP_AUTH_USER"]);
                } elseif (strpos($_SERVER["PHP_AUTH_USER"], $_SERVER['SERVER_NAME'] . "\\") === 0) {
                    $_SERVER["PHP_AUTH_USER"] = str_replace($_SERVER['SERVER_NAME'] . "\\", "", $_SERVER["PHP_AUTH_USER"]);
                }
                $arAuthResult = $USER->Login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"], "N");
                $APPLICATION->arAuthResult = $arAuthResult;
            }
        }
        if (($_SERVER['REQUEST_METHOD'] == 'OPTIONS' || $_SERVER['REQUEST_METHOD'] == 'PROPFIND') && (strlen($_SERVER["REAL_FILE_PATH"]) <= 0 && substr($_SERVER['REQUEST_URI'], -1, 1) == '/' || strpos($_SERVER['REQUEST_URI'], 'personal') !== false && strlen($_SERVER["REAL_FILE_PATH"]) <= 0 && !file_exists($_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI']))) {
            $res = CUrlRewriter::GetList(array("QUERY" => $_SERVER['REQUEST_URI']));
            $good_res = true;
            $file_path = "";
            foreach ($res as $res_detail) {
                if (strpos($res_detail["ID"], "webdav") !== false || strpos($res_detail["ID"], "socialnetwork") !== false) {
                    $good_res = !$USER->IsAuthorized();
                    break;
                }
            }
            if ($good_res) {
                header("MS-Author-Via: DAV");
                if (strpos($_SERVER['HTTP_USER_AGENT'], "Microsoft-WebDAV-MiniRedir") !== false && $_SERVER['REQUEST_METHOD'] == "OPTIONS") {
                    CWebDavBase::base_OPTIONS();
                    die;
                }
                if ($_SERVER['REQUEST_METHOD'] != 'PROPFIND') {
                    if (!$USER->IsAuthorized()) {
                        CWebDavBase::SetAuthHeader();
                        die;
                    }
                    CWebDavBase::base_OPTIONS();
                    die;
                }
                if ($_SERVER['REQUEST_METHOD'] == 'PROPFIND') {
                    if (!$USER->IsAuthorized()) {
                        CWebDavBase::SetAuthHeader();
                        die;
                    }
                    CWebDavBase::SetStatus('207 Multi-Status');
                    echo '<?xml version="1.0" encoding="utf-8" ?>
<D:multistatus xmlns:D="DAV:" xmlns:Office="urn:schemas-microsoft-com:office:office" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:Z="urn:schemas-microsoft-com:">
<D:response>
	<D:href>http://' . htmlspecialcharsbx($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) . '</D:href>
	<D:propstat>
		<D:prop>
			<D:displayname></D:displayname>
			<D:lockdiscovery/><D:supportedlock/>
			<D:isFolder>t</D:isFolder>
			<D:iscollection>1</D:iscollection>
			<D:ishidden>0</D:ishidden>
			<D:getcontenttype>application/octet-stream</D:getcontenttype>
			<D:getcontentlength>0</D:getcontentlength>
			<D:resourcetype><D:collection/></D:resourcetype>
			<Repl:authoritative-directory>t</Repl:authoritative-directory>
			<D:getlastmodified>2008-10-29T13:58:59Z</D:getlastmodified>
			<D:creationdate>2008-10-29T13:58:59Z</D:creationdate>
			<Repl:repl-uid>rid:{D77F5F6A-44A9-4015-AB49-4D3A439808C1}</Repl:repl-uid>
			<Repl:resourcetag>rt:D77F5F6A-44A9-4015-AB49-4D3A439808C1@00000000000</Repl:resourcetag>
			<D:getetag>&quot;{D77F5F6A-44A9-4015-AB49-4D3A439808C1},0&quot;</D:getetag>
		</D:prop>
		<D:status>HTTP/1.1 200 OK</D:status>
	</D:propstat>
</D:response>
</D:multistatus>';
                    die;
                }
            }
        } elseif (CWebDavBase::IsDavHeaders("check_all")) {
            if (!$USER->IsAuthorized()) {
                $res = CUrlRewriter::GetList(array("QUERY" => $_SERVER['REQUEST_URI']));
                $good_res = true;
                $file_path = "";
                foreach ($res as $res_detail) {
                    if (strpos($res_detail["ID"], "webdav") !== false || strpos($res_detail["ID"], "socialnetwork") !== false) {
                        $good_res = !$USER->IsAuthorized();
                        break;
                    }
                }
                if ($good_res) {
                    CWebDavBase::SetAuthHeader();
                    die;
                }
            }
            return true;
        }
    }
예제 #21
0
 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");
 }
예제 #22
0
	require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_js.php");

	if(strlen($Next)<=0 || !CheckSerializedData($_REQUEST['NS']))
	{
		$NS = array(
			"max_execution_time" => $max_execution_time,
			"stepped" => $stepped,
			"max_file_size" => $max_file_size
		);
		if($site_id!="")
			$NS["SITE_ID"] = $site_id;
	}
	else
		$NS = unserialize($_REQUEST['NS']);

	$res = CUrlRewriter::ReIndexAll(($NS["stepped"]=="Y"? $NS["max_execution_time"]:0), $NS);

	if(is_array($res)):
		//$res["STAT"]=$NS["STAT"];
		//$res["STAT"][]=$res["CNT"]-$NS["CNT"];
		//$perfomance = "<br>",implode($res["STAT"],", ");
		CAdminMessage::ShowMessage(array(
			"MESSAGE"=>GetMessage("url_rewrite_mess_title"),
			"DETAILS"=>GetMessage("MURL_REINDEX_TOTAL")." <b>".$res["CNT"]."</b>",
			"HTML"=>true,
			"TYPE"=>"OK",
		));
	?>
		<input type="hidden" id="NS" name="NS" value="<?php 
echo htmlspecialcharsbx(serialize($res));
?>
예제 #23
0
파일: index.php 프로젝트: nycmic/bittest
	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;
	}
예제 #24
0
 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));
             }
         }
     }
 }
예제 #25
0
                @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);
    }
}
// ------------------  -------------------------------
예제 #26
0
 /**
  * Uninstalls service
  * @param bool $deleteRecord Delete, or not table record about this service
  */
 public static function unInstall($deleteRecord = true)
 {
     static::eventsStop();
     $settings = static::getSettings();
     if (!empty($settings)) {
         if ($deleteRecord) {
             Bitrix\Sale\TradingPlatformTable::delete(static::TRADING_PLATFORM_CODE);
         } else {
             static::setActivity(false);
         }
     }
     \CUrlRewriter::Delete(array("CONDITION" => "#^/bitrix/services/ymarket/#", "PATH" => "/bitrix/services/ymarket/index.php"));
 }
예제 #27
0
    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"));
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$arResultList = CUrlRewriter::GetList(array("SITE_ID" => $site_id, "CONDITION" => $CONDITION));
if (count($arResultList) <= 0) {
    unset($CONDITION);
    $arResult = array();
    $str_CONDITION_OLD = "";
    $str_CONDITION = "";
    $str_ID = "";
    $str_FILE_PATH = "";
    $str_RULE = "";
} else {
    $arResult = $arResultList[0];
    $str_CONDITION_OLD = htmlspecialcharsbx($arResult["CONDITION"]);
    $str_CONDITION = htmlspecialcharsbx($arResult["CONDITION"]);
    $str_ID = htmlspecialcharsbx($arResult["ID"]);
    $str_FILE_PATH = htmlspecialcharsbx($arResult["PATH"]);
    $str_RULE = htmlspecialcharsbx($arResult["RULE"]);
예제 #28
0
             if ($_SERVER["REQUEST_METHOD"] == $method) {
                 return true;
             }
         }
         if (strpos($_SERVER['HTTP_USER_AGENT'], "Microsoft Office") !== false && strpos($_SERVER['HTTP_USER_AGENT'], "Outlook") === false || strpos($_SERVER['HTTP_USER_AGENT'], "MiniRedir") !== false || strpos($_SERVER['HTTP_USER_AGENT'], "WebDAVFS") !== false || strpos($_SERVER['HTTP_USER_AGENT'], "davfs2") !== false || strpos($_SERVER['HTTP_USER_AGENT'], "Sardine") !== false || strpos($_SERVER['HTTP_USER_AGENT'], "gvfs") !== false || strpos($_SERVER['HTTP_USER_AGENT'], "LibreOffice") !== false) {
             return true;
         }
         return false;
     }
 }
 $bNeedInclude = true;
 if ($_SERVER["REQUEST_METHOD"] == "HEAD") {
     $res = strtolower($_SERVER["HTTP_USER_AGENT"]);
     if (strpos($res, "microsoft") === false && strlen($_SERVER["REAL_FILE_PATH"]) <= 0 && substr($_SERVER['REQUEST_URI'], -1, 1) == '/') {
         $bNeedInclude = false;
         $res = CUrlRewriter::GetList(array("QUERY" => $_SERVER['REQUEST_URI']));
         foreach ($res as $res_detail) {
             if (strpos($res_detail["ID"], "webdav") !== false || strpos($res_detail["ID"], "disk") !== false || strpos($res_detail["ID"], "socialnetwork") !== false) {
                 $bNeedInclude = true;
                 break;
             }
         }
     }
 }
 if (__webdavIsDavHeaders() && $bNeedInclude) {
     if (CModule::includeModule('ldap') && CLdapUtil::isBitrixVMAuthSupported()) {
         CLdapUtil::bitrixVMAuthorize();
     }
     if (!$_SERVER['PHP_AUTH_USER'] || !$_SERVER['PHP_AUTH_USER']) {
         $res = !empty($_SERVER['REDIRECT_REMOTE_USER']) ? $_SERVER['REDIRECT_REMOTE_USER'] : $_SERVER['REMOTE_USER'];
         if (!empty($res) && preg_match('/(?<=(basic\\s))(.*)$/is', $res, $matches)) {
예제 #29
0
    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 {
예제 #30
0
<?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"));
}