本文整理汇总了PHP中CSite::GetSiteDocRoot方法的典型用法代码示例。如果您正苦于以下问题:PHP CSite::GetSiteDocRoot方法的具体用法?PHP CSite::GetSiteDocRoot怎么用?PHP CSite::GetSiteDocRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSite
的用法示例。
在下文中一共展示了CSite::GetSiteDocRoot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateWizardIndex
function CreateWizardIndex($wizardName, &$errorMessage)
{
$indexContent = '<' . '?' . 'define("WIZARD_DEFAULT_SITE_ID", "' . (defined("WIZARD_DEFAULT_SITE_ID") ? WIZARD_DEFAULT_SITE_ID : "s1") . '");' . 'require(' . '$' . '_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");' . 'require_once(' . '$' . '_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/wizard.php");' . '$' . 'wizard = new CWizard("' . $wizardName . '");' . '$' . 'wizard->Install();' . 'require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php");' . '?' . '>';
$p = $_SERVER["DOCUMENT_ROOT"] . "/index.php";
if (defined("WIZARD_DEFAULT_SITE_ID")) {
$rsSite = CSite::GetList($by = "sort", $order = "asc", array("ID" => WIZARD_DEFAULT_SITE_ID));
$arSite = $rsSite->GetNext();
$p = CSite::GetSiteDocRoot($arSite["LID"]) . $arSite["DIR"] . "/index.php";
}
$handler = @fopen($p, "wb");
if (!$handler) {
$errorMessage = InstallGetMessage("INST_WIZARD_INDEX_ACCESS_ERROR");
return false;
}
$success = @fwrite($handler, $indexContent);
if (!$success) {
$errorMessage = InstallGetMessage("INST_WIZARD_INDEX_ACCESS_ERROR");
return false;
}
if (defined("BX_FILE_PERMISSIONS")) {
@chmod($_SERVER["DOCUMENT_ROOT"] . "/index.php", BX_FILE_PERMISSIONS);
}
fclose($handler);
return true;
}
示例2: ParseFile
function ParseFile($file)
{
$docRoot = CSite::GetSiteDocRoot(self::$curSite);
$file = str_replace("//", "/", $file);
$io = CBXVirtualIo::GetInstance();
$bIsDir = $io->DirectoryExists($file);
if (is_link($file)) {
return;
}
if ($bIsDir) {
// Skip 'bitrix' and 'upload' folders
if ($file == $docRoot . '/bitrix' || $file == $docRoot . '/upload' || $file == $docRoot . '/images') {
return;
}
$oDir = new CFilemanUtilDir($file, array('obj' => $this, 'site' => self::$curSite, 'callBack' => "ParseFile", 'checkBreak' => "CheckBreak", 'checkSubdirs' => false));
$bSuccess = $oDir->Start();
$bBreak = $oDir->bBreak;
$nextPath = $oDir->nextPath;
if ($bBreak) {
$this->ParseStop(CFilemanUtils::TrimPath($nextPath, $docRoot), self::$curSite);
}
} else {
if (self::$bSkip) {
if ($file == $docRoot . self::$lastPath) {
self::$bSkip = false;
} else {
return;
}
// Files was handled earlier
}
$fileName = $io->ExtractNameFromPath($file);
// Skip files stating from dot '.' or any non .php files
if (GetFileExtension($fileName) != 'php' || preg_match('/^\\..*/i' . BX_UTF_PCRE_MODIFIER, $fileName)) {
return;
}
// 1. Get file content
$fTmp = $io->GetFile($file);
$fileContent = $fTmp->GetContents();
$fileContent = str_replace("\r", "", $fileContent);
$fileContent = str_replace("\n", "", $fileContent);
// Find files with needed components
$pattern = array('intranet.event_calendar', 'socialnetwork', 'socialnetwork_user', 'socialnetwork_group');
foreach ($pattern as $p) {
if (preg_match('/includecomponent\\([\\n\\t\\r\\s]*("|\')bitrix:' . $p . '/i' . BX_UTF_PCRE_MODIFIER, $fileContent)) {
$this->FetchParams($fileContent);
break;
}
}
}
}
示例3: __construct
public function __construct($arParams)
{
$this->SITE_ID = $arParams["SITE_ID"];
$this->REWRITE = $arParams["REWRITE"];
$this->ModuleBlogGroup = '[' . $this->SITE_ID . '] ' . GetMessage("IDEA_BLOG_GROUP_NAME");
$this->ModuleBlogUrl .= "_" . $this->SITE_ID;
//NULL CACHE
BXClearCache(True, '/' . $this->SITE_ID . '/idea/');
BXClearCache(True, '/' . SITE_ID . '/idea/');
global $CACHE_MANAGER;
if (CACHED_b_user_field_enum !== false) {
$CACHE_MANAGER->CleanDir("b_user_field_enum");
}
//Statuses List (for demo)
$this->arResult["SETTINGS"]["STATUS"] = CIdeaManagment::getInstance()->Idea()->GetStatusList();
foreach ($this->arResult["SETTINGS"]["STATUS"] as $arStatus) {
$this->arResult["SETTINGS"]["STATUS_ID"][$arStatus["XML_ID"]] = $arStatus["ID"];
}
//Lang List
$l = CLanguage::GetList($by = "sort", $order = "asc");
while ($r = $l->Fetch()) {
$this->arResult["SETTINGS"]["LANG"][] = $r;
}
//Sites List
$oSites = CSite::GetList($b = "", $o = "", array("ACTIVE" => "Y"));
while ($site = $oSites->Fetch()) {
$this->arResult["SETTINGS"]["SITE"][$site["LID"]] = 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"]);
}
if (array_key_exists($this->SITE_ID, $this->arResult["SETTINGS"]["SITE"])) {
$this->PublicDir = str_replace(array("#SITE_DIR#"), array($this->arResult["SETTINGS"]["SITE"][$this->SITE_ID]["DIR"]), $this->PublicDir);
}
$site = CFileMan::__CheckSite($this->SITE_ID);
$this->DOCUMENT_ROOT = CSite::GetSiteDocRoot($site);
$this->IO = CBXVirtualIo::GetInstance();
//SetDefault
$this->arResult["INSTALLATION"]["IBLOCK_TYPE_INSTALL"] = true;
$this->arResult["INSTALLATION"]["IBLOCK_INSTALL"] = true;
$this->arResult["INSTALLATION"]["BLOG_GROUP_INSTALL"] = true;
$this->arResult["INSTALLATION"]["BLOG_INSTALL"] = true;
$this->CheckParams();
}
示例4: GetEventInfo
function GetEventInfo($row, $arParams, $arUser)
{
$site = CFileMan::__CheckSite($site);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$DESCRIPTION = unserialize($row['DESCRIPTION']);
if (empty($DESCRIPTION['path'])) {
$DESCRIPTION['path'] = $_SERVER['HTTP_HOST'];
$fileURL = SITE_DIR;
} else {
if ((is_file($DOC_ROOT . "/" . $DESCRIPTION['path']) || is_dir($DOC_ROOT . "/" . $DESCRIPTION['path'])) && !strrpos($DESCRIPTION['path'], " ")) {
$fileURL = SITE_DIR . $DESCRIPTION['path'];
}
}
$EventName = $DESCRIPTION['path'];
switch ($row['AUDIT_TYPE_ID']) {
case "PAGE_ADD":
$EventPrint = GetMessage("LOG_PAGE_ADD");
break;
case "PAGE_EDIT":
$EventPrint = GetMessage("LOG_PAGE_EDIT");
break;
case "PAGE_DELETE":
$EventPrint = GetMessage("LOG_PAGE_DELETE");
break;
case "MENU_ADD":
$EventPrint = GetMessage("LOG_MENU_ADD", array("#MENU#" => $DESCRIPTION['menu_name']));
break;
case "MENU_EDIT":
$EventPrint = GetMessage("LOG_MENU_EDIT", array("#MENU#" => $DESCRIPTION['menu_name']));
break;
case "MENU_DELETE":
$EventPrint = GetMessage("LOG_MENU_DELETE", array("#MENU#" => $DESCRIPTION['menu_name']));
break;
case "FILE_ADD":
$EventPrint = GetMessage("LOG_FILE_ADD");
break;
case "FILE_EDIT":
$EventPrint = GetMessage("LOG_FILE_EDIT");
break;
case "FILE_DELETE":
$EventPrint = GetMessage("LOG_FILE_DELETE", array("#FILENAME#" => $DESCRIPTION['file_name']));
break;
case "FILE_MOVE":
$EventPrint = GetMessage("LOG_FILE_MOVE", array("#SECTION#" => $DESCRIPTION["copy_to"]));
break;
case "FILE_COPY":
$EventPrint = GetMessage("LOG_FILE_COPY", array("#SECTION#" => $DESCRIPTION["copy_to"]));
break;
case "FILE_RENAME":
$EventPrint = GetMessage("LOG_FILE_RENAME");
break;
case "SECTION_ADD":
$EventPrint = GetMessage("LOG_SECTION_ADD");
break;
case "SECTION_EDIT":
$EventPrint = GetMessage("LOG_SECTION_EDIT");
break;
case "SECTION_DELETE":
$EventPrint = GetMessage("LOG_SECTION_DELETE");
break;
case "SECTION_MOVE":
$EventPrint = GetMessage("LOG_SECTION_MOVE", array("#SECTION#" => $DESCRIPTION["copy_to"]));
break;
case "SECTION_COPY":
$EventPrint = GetMessage("LOG_SECTION_COPY", array("#SECTION#" => $DESCRIPTION["copy_to"]));
break;
case "SECTION_RENAME":
$EventPrint = GetMessage("LOG_SECTION_RENAME");
break;
}
return array("eventType" => $EventPrint, "eventName" => $EventName, "eventURL" => $fileURL);
}
示例5: elseif
if ($createNewFolder && (!$USER->CanDoOperation("fileman_admin_folders") || !$USER->CanDoOperation("fileman_admin_files"))) {
$popupWindow->ShowError(GetMessage("PAGE_NEW_ACCESS_DENIED"));
} elseif (!$USER->CanDoOperation("fileman_admin_files")) {
$popupWindow->ShowError(GetMessage("PAGE_NEW_ACCESS_DENIED"));
}
if (!$USER->CanDoOperation("fileman_edit_existent_files")) {
$canEditNewPage = false;
}
}
$io = CBXVirtualIo::GetInstance();
//Page path
$path = "/";
if (isset($_REQUEST["path"]) && strlen($_REQUEST["path"]) > 0) {
$path = $io->CombinePath("/", $_REQUEST["path"]);
}
$documentRoot = CSite::GetSiteDocRoot($site);
//Site ID
$site = SITE_ID;
if (isset($_REQUEST["site"]) && $_REQUEST["site"] != '') {
$obSite = CSite::GetByID($_REQUEST["site"]);
if ($arSite = $obSite->Fetch()) {
$site = $arSite["ID"];
}
}
//Check permissions
if ($createNewFolder && (!$USER->CanDoFileOperation("fm_create_new_folder", array($site, $path)) || !$USER->CanDoFileOperation("fm_create_new_file", array($site, $path)))) {
$popupWindow->ShowError(GetMessage("PAGE_NEW_ACCESS_DENIED"));
} elseif (!$USER->CanDoFileOperation("fm_create_new_file", array($site, $path))) {
$popupWindow->ShowError(GetMessage("PAGE_NEW_ACCESS_DENIED"));
} elseif (!$io->DirectoryExists($documentRoot . $path)) {
$popupWindow->ShowError(GetMessage("PAGE_NEW_FOLDER_NOT_FOUND") . " (" . htmlspecialcharsbx($path) . ")");
示例6: Search
public static function Search($arQuery, $arTypes = array())
{
global $DB;
$err_mess = CMedialibCollection::GetErrorMess() . "<br>Function: CMedialibItem::Search<br>Line: ";
$strSql = "SELECT\n\t\t\t\t\tMI.*, MI.*,MCI.COLLECTION_ID, F.HEIGHT, F.WIDTH, F.FILE_SIZE, F.CONTENT_TYPE, F.SUBDIR, F.FILE_NAME, F.HANDLER_ID,\n\t\t\t\t\t" . $DB->DateToCharFunction("MI.DATE_UPDATE") . " as DATE_UPDATE2\n\t\t\t\tFROM b_medialib_item MI\n\t\t\t\tINNER JOIN b_medialib_collection_item MCI ON (MI.ID=MCI.ITEM_ID)\n\t\t\t\tINNER JOIN b_file F ON (F.ID=MI.SOURCE_ID)\n\t\t\t\tWHERE 1=1";
$l = count($arQuery);
if ($l == 0) {
return array();
}
for ($i = 0; $i < $l; $i++) {
$strSql .= " AND MI.SEARCHABLE_CONTENT LIKE '%" . $DB->ForSql($arQuery[$i]) . "%'";
}
$strSql .= " ORDER BY MI.ID DESC";
$res = $DB->Query($strSql, false, $err_mess);
$arResult = array();
$rootPath = CSite::GetSiteDocRoot(false);
$tmbW = COption::GetOptionInt('fileman', "ml_thumb_width", 140);
$tmbH = COption::GetOptionInt('fileman', "ml_thumb_height", 105);
$elId2Index = array();
$colId2Index = array();
$arCol = CMedialibCollection::GetList(array('arFilter' => array('ACTIVE' => 'Y', "TYPES" => $arTypes)));
for ($i = 0, $l = count($arCol); $i < $l; $i++) {
$colId2Index[$arCol[$i]['ID']] = $i;
}
while ($arRes = $res->Fetch()) {
$colId = $arRes['COLLECTION_ID'];
if (!isset($colId2Index[$colId]) || !CMedialibCollection::IsViewable($arCol[$colId2Index[$colId]], $arCol)) {
continue;
}
if (isset($elId2Index[$arRes['ID']])) {
$arResult[$elId2Index[$arRes['ID']]]['collections'][] = $colId;
} else {
$elId2Index[$arRes['ID']] = count($arResult);
$arRes['collections'] = array($colId);
$arRes['perm'] = array('edit' => true, 'del' => true);
CMedialibItem::GenerateThumbnail($arRes, array('rootPath' => $rootPath, 'width' => $tmbW, 'height' => $tmbH));
$arRes['PATH'] = CFile::GetFileSRC($arRes);
$arResult[] = $arRes;
}
}
return $arResult;
}
示例7: IncludeModuleLangFile
##############################################
*/
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/translate/prolog.php";
if (!$USER->CanDoOperation('edit_php')) {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/translate/include.php";
IncludeModuleLangFile(__FILE__);
define("HELP_FILE", "translate_list.php");
/***************************************************************************
GET | POST
***************************************************************************/
$strError = "";
$file = Rel2Abs("/", $file);
$abs_path = CSite::GetSiteDocRoot(false) . htmlspecialcharsbx($file);
if (strpos($file, "/bitrix/") !== 0 || strpos($file, "/lang/") === false || GetFileExtension($file) != "php") {
$strError = GetMessage("trans_edit_err") . "<br>";
}
$APPLICATION->SetTitle(GetMessage("TRANS_TITLE"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
if ($strError == "") {
$aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("TRANS_TITLE"), "ICON" => "translate_edit", "TITLE" => GetMessage("TRANS_TITLE_TITLE")));
$tabControl = new CAdminTabControl("tabControl", $aTabs);
$chain = "";
$arPath = array();
$path_back = dirname($file);
$arSlash = explode("/", $path_back);
if (is_array($arSlash)) {
$arSlash_tmp = $arSlash;
$lang_key = array_search("lang", $arSlash) + 1;
示例8: SiteRelativeToAbsolutePath
public function SiteRelativeToAbsolutePath($relativePath, $site = null)
{
if ((string)$site === "")
{
$site = SITE_ID;
}
else
{
$dbSite = CSite::GetByID($site);
$site = "";
if ($arSite = $dbSite->Fetch())
$site = $_REQUEST["site"];
if ((string)$site === "")
$site = SITE_ID;
}
$basePath = CSite::GetSiteDocRoot($site);
return $this->CombinePath($basePath, $relativePath);
}
示例9: array
HTML
****************************************************************************/
$aMenu = array();
$aMenu[] = array("TEXT" => GetMessage("TRANS_LIST"), "LINK" => "/bitrix/admin/translate_list.php?lang=" . LANGUAGE_ID . "&path=/" . implode("/", $arPath) . "/" . "&" . bitrix_sessid_get(), "TITLE" => GetMessage("TRANS_LIST_TITLE"), "ICON" => "btn_list");
$context = new CAdminContextMenu($aMenu);
$context->Show();
?>
<p><?php
echo $chain;
?>
</p>
<?php
$_corrupt = false;
$_strMess = '';
foreach ($arDirFiles as $_file) {
$_content = $APPLICATION->GetFileContent(CSite::GetSiteDocRoot(false) . $_file);
$_len = strlen($_content);
if (($_pos = strrpos($_content, '>')) !== false) {
if ($_len > $_pos + 1) {
$_corrupt = true;
$_strMess .= '<a class="text" href="translate_edit_php.php?lang=' . LANGUAGE_ID . '&file=' . $_file . '">' . $_file . "</a><br/>";
}
}
}
if (!$_corrupt) {
CAdminMessage::ShowMessage(array('MESSAGE' => GetMessage('TR_FILES_NOT_FOUND'), 'TYPE' => 'OK'));
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
} else {
CAdminMessage::ShowMessage(GetMessage('TR_FILES_FOUND'));
}
示例10: ShowHTMLEditControl
function ShowHTMLEditControl($name, $content, $arParams = array())
{
global $USER;
// We have to avoid of showing HTML-editor with probably unsecure content when loosing the session [mantis:#0007986]
if ($_SERVER["REQUEST_METHOD"] == "POST" && !check_bitrix_sessid()) {
return;
}
CUtil::InitJSCore(array('window', 'ajax'));
$relPath = isset($arParams["path"]) ? $arParams["path"] : "/";
$site = isset($arParams["site"]) ? $arParams["site"] : "";
$__path = Rel2Abs("/", $relPath);
$site = CFileMan::__CheckSite($site);
$name = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "", $name);
if (!isset($arParams["limit_php_access"])) {
$arParams["limit_php_access"] = false;
}
$arParams["light_mode"] = defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 || isset($arParams["light_mode"]) && $arParams["light_mode"] == 'Y';
$io = CBXVirtualIo::GetInstance();
$direction_rtl = false;
if ($site) {
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$abs_path = $DOC_ROOT . $__path;
if ($io->FileExists($abs_path)) {
$relPath = substr($relPath, 0, strrpos($relPath, "/"));
if ($relPath == "") {
$relPath = "/";
}
}
}
static $bFirstUsed;
$template = $arParams["templateID"];
if (!isset($template) && defined('SITE_TEMPLATE_ID')) {
$template = SITE_TEMPLATE_ID;
}
if (!isset($template) && isset($_GET['siteTemplateId'])) {
$template = $_GET['siteTemplateId'];
}
if (!isset($template) && isset($site)) {
$dbSiteRes = CSite::GetTemplateList($site);
$SITE_TEMPLATE = array();
while ($arSiteRes = $dbSiteRes->Fetch()) {
if ($arSiteRes['CONDITION'] == "" || !isset($template)) {
$template = $arSiteRes['TEMPLATE'];
}
}
}
if (isset($arParams['use_editor_3'])) {
$useEditor3 = $arParams['use_editor_3'] == "Y";
} else {
$useEditor3 = COption::GetOptionString('fileman', "use_editor_3", "Y") == "Y";
}
if ($useEditor3) {
$Editor = new CHTMLEditor();
$Editor->Show(array('name' => $name, 'id' => $name, 'siteId' => $arParams["site"], 'width' => $arParams["width"], 'height' => $arParams["height"], 'content' => $content, 'bAllowPhp' => !$arParams["bWithoutPHP"] && $USER->CanDoOperation('edit_php'), "limitPhpAccess" => $arParams["limit_php_access"], "display" => $arParams['bDisplay'], "componentFilter" => isset($arParams['componentFilter']) ? $arParams['componentFilter'] : false, "setFocusAfterShow" => isset($arParams['setFocusAfterShow']) ? $arParams['setFocusAfterShow'] : true, "relPath" => $relPath, "templateId" => $template));
return;
}
//Taskbars
$arTaskbars = isset($arParams["arTaskbars"]) ? $arParams["arTaskbars"] : array();
//Toolbars
$arToolbars = isset($arParams["arToolbars"]) ? $arParams["arToolbars"] : false;
// Toolbar config
$arParams["toolbarConfig"] = is_array($arParams["toolbarConfig"]) ? $arParams["toolbarConfig"] : false;
$arParams["use_advanced_php_parser"] = COption::GetOptionString("fileman", "use_advanced_php_parser", "Y");
$arParams["ar_entities"] = COption::GetOptionString("fileman", "ar_entities", 'umlya,greek,other');
if ($arParams["ar_entities"] == 'none') {
$arParams["ar_entities"] = '';
}
if (!isset($arParams["usePspell"])) {
$arParams["usePspell"] = COption::GetOptionString("fileman", "use_pspell", "N");
}
if (!isset($arParams["useCustomSpell"])) {
$arParams["useCustomSpell"] = COption::GetOptionString("fileman", "use_custom_spell", "Y");
}
$arParams['allowRenderComp2'] = COption::GetOptionString('fileman', "allow_render_components", "N") == 'Y';
$arParams['renderComponents'] = $arParams['allowRenderComp2'] && CUserOptions::GetOption('fileman', "render_components", "Y") == 'Y';
$lca = COption::GetOptionString("fileman", "use_lca", "N");
$styleList_render_style = COption::GetOptionString("fileman", "render_styles_in_classlist", "Y") == 'Y' ? 'true' : 'false';
$arAdditionalParams = isset($arParams["arAdditionalParams"]) ? $arParams["arAdditionalParams"] : array();
$arResult = CFileman::GetAllTemplateParams($template, $site, $arParams["bWithoutPHP"] != true, $arAdditionalParams);
$arParams["TEMPLATE"] = $arResult;
if ($bUseOnlyDefinedStyles && !is_set($arResult, "STYLES_TITLE")) {
$bUseOnlyDefinedStyles = false;
}
$arParams["body_class"] = COption::GetOptionString("fileman", "editor_body_class", "");
$arParams["body_id"] = COption::GetOptionString("fileman", "editor_body_id", "");
?>
<script bxrunfirst="true">
var relPath = "<?php
echo CUtil::JSEscape($relPath);
?>
";
var <?php
echo 'ar_' . $name . '_taskbars';
?>
= {};
<?php
for ($k = 0, $l = count($arTaskbars); $k < $l; $k++) {
echo 'ar_' . $name . '_taskbars["' . $arTaskbars[$k] . '"] = true;';
}
if ($arToolbars !== false) {
//.........这里部分代码省略.........
示例11: SetFilePermission
function SetFilePermission($path, $permissions)
{
$originalPath = $path;
CMain::InitPathVars($site, $path);
$documentRoot = CSite::GetSiteDocRoot($site);
$path = rtrim($path, "/");
if (strlen($path) <= 0)
$path = "/";
if( ($position = strrpos($path, "/")) !== false)
{
$pathFile = substr($path, $position+1);
$pathDir = substr($path, 0, $position);
}
else
return false;
if ($pathFile == "" && $pathDir == "")
$pathFile = "/";
$PERM = Array();
if(file_exists($documentRoot.$pathDir."/.access.php"))
@include($documentRoot.$pathDir."/.access.php");
if (!isset($PERM[$pathFile]) || !is_array($PERM[$pathFile]))
$arPermisson = $permissions;
else
$arPermisson = $permissions + $PERM[$pathFile];
return $GLOBALS["APPLICATION"]->SetFileAccessPermission($originalPath, $arPermisson);
}
示例12: IncludeModuleLangFile
##############################################
*/
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/translate/prolog.php";
if (!$USER->CanDoOperation('edit_php')) {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/translate/include.php";
IncludeModuleLangFile(__FILE__);
define("HELP_FILE", "translate_list.php");
/***************************************************************************
GET | POST
***************************************************************************/
$strError = "";
$file = Rel2Abs("/", $file);
$abs_path = CSite::GetSiteDocRoot($site) . $file;
if (strpos($file, "/bitrix/") !== 0 || strpos($file, "/lang/") === false) {
$strError = GetMessage("trans_edit_err") . "<br>";
}
if ($strError == "") {
$aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("TRANS_TITLE"), "ICON" => "translate_edit", "TITLE" => GetMessage("TRANS_TITLE_TITLE")));
$tabControl = new CAdminTabControl("tabControl", $aTabs);
// form a way to get back
$chain = "";
$arPath = array();
$path_back = dirname($file);
$arSlash = explode("/", $path_back);
if (is_array($arSlash)) {
$arSlash_tmp = $arSlash;
$lang_key = array_search("lang", $arSlash) + 1;
unset($arSlash_tmp[$lang_key]);
示例13: array
$db_msg = CEventMessage::GetList($o = "", $b = "", array("SITE_ID" => $_POST["SITE_MESSAGE_LINK_E_SITE"]));
while ($ar_msg = $db_msg->Fetch()) {
$msg_id = $ar_msg["ID"];
$db_msg_sites = CEventMessage::GetSite($ar_msg["ID"]);
$ar_msg = array("NAME" => $ar_msg["NAME"], "LID" => array($LID));
while ($ar_msg_sites = $db_msg_sites->Fetch()) {
$ar_msg["LID"][] = $ar_msg_sites["SITE_ID"];
}
$em->Update($msg_id, $ar_msg);
}
}
if ($bNew && $_POST["START_SITE_WIZARD"] == "Y") {
$rsSite = CSite::GetList($by = "sort", $order = "asc", array("ID" => $LID));
$arSite = $rsSite->GetNext();
$siteDir = "/" . ltrim(rtrim($arSite["DIR"], "/") . "/", "/");
$p = CSite::GetSiteDocRoot($LID) . $siteDir;
CheckDirPath($p);
$indexContent = '<' . '?' . 'define("B_PROLOG_INCLUDED", true);' . 'define("WIZARD_DEFAULT_SITE_ID", "' . $LID . '");' . 'define("WIZARD_DEFAULT_TONLY", true);' . 'define("PRE_LANGUAGE_ID","' . $arSite["LANGUAGE_ID"] . '");' . 'define("PRE_INSTALL_CHARSET","' . $arSite["CHARSET"] . '");' . 'include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/install/wizard/wizard.php");' . '?' . '>';
$handler = fopen($p . "index.php", "wb");
fwrite($handler, $indexContent);
fclose($handler);
$u = "";
$domains = explode("\n", str_replace("\r", "", $arSite["DOMAINS"]));
if (!empty($domains) && $domains[0] != '') {
$u .= "http://" . $domains[0];
}
$u .= $siteDir;
LocalRedirect($u);
}
if ($_POST["save"] != '') {
LocalRedirect(BX_ROOT . "/admin/site_admin.php?lang=" . LANGUAGE_ID);
示例14: 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;
}
示例15: GetDirList
function GetDirList($path, &$arDirs, &$arFiles, $arFilter = array(), $sort = array(), $type = "DF", $bLogical = false, $task_mode = false)
{
global $USER, $APPLICATION;
CMain::InitPathVars($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$arDirs = array();
$arFiles = array();
$exts = strtolower($arFilter["EXTENSIONS"]);
$arexts = explode(",", $exts);
if (isset($arFilter["TYPE"])) {
$type = strtoupper($arFilter["TYPE"]);
}
$io = CBXVirtualIo::GetInstance();
$path = $io->CombinePath("/", $path);
$abs_path = $io->CombinePath($DOC_ROOT, $path);
if (!$io->DirectoryExists($abs_path)) {
return false;
}
$date_format = CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL"));
$tzOffset = CTimeZone::GetOffset();
$dir = $io->GetDirectory($abs_path);
$arChildren = $dir->GetChildren();
foreach ($arChildren as $child) {
$arFile = array();
if (($type == "F" || $type == "") && $child->IsDirectory()) {
continue;
}
if (($type == "D" || $type == "") && !$child->IsDirectory()) {
continue;
}
$file = $child->GetName();
if ($bLogical) {
if ($child->IsDirectory()) {
$sSectionName = "";
$fsn = $io->CombinePath($abs_path, $file, ".section.php");
if (!$io->FileExists($fsn)) {
continue;
}
include $io->GetPhysicalName($fsn);
$arFile["LOGIC_NAME"] = $sSectionName;
} else {
if (CFileMan::GetFileTypeEx($file) != "php") {
continue;
}
if ($file == '.section.php') {
continue;
}
if (!preg_match('/^\\.(.*)?\\.menu\\.(php|html|php3|php4|php5|php6|phtml)$/', $file, $regs)) {
$f = $io->GetFile($abs_path . "/" . $file);
$filesrc = $f->GetContents();
$title = PHPParser::getPageTitle($filesrc);
if ($title === false) {
continue;
}
$arFile["LOGIC_NAME"] = $title;
}
}
}
$arFile["PATH"] = $abs_path . "/" . $file;
$arFile["ABS_PATH"] = $path . "/" . $file;
$arFile["NAME"] = $file;
$arPerm = $APPLICATION->GetFileAccessPermission(array($site, $path . "/" . $file), $USER->GetUserGroupArray(), $task_mode);
if ($task_mode) {
$arFile["PERMISSION"] = $arPerm[0];
if (count($arPerm[1]) > 0) {
$arFile["PERMISSION_EX"] = $arPerm[1];
}
} else {
$arFile["PERMISSION"] = $arPerm;
}
$arFile["TIMESTAMP"] = $child->GetModificationTime() + $tzOffset;
$arFile["DATE"] = date($date_format, $arFile["TIMESTAMP"]);
if (isset($arFilter["TIMESTAMP_1"]) && strtotime($arFile["DATE"]) < strtotime($arFilter["TIMESTAMP_1"])) {
continue;
}
if (isset($arFilter["TIMESTAMP_2"]) && strtotime($arFile["DATE"]) > strtotime($arFilter["TIMESTAMP_2"])) {
continue;
}
if (is_set($arFilter, "MIN_PERMISSION") && $arFile["PERMISSION"] < $arFilter["MIN_PERMISSION"] && !$task_mode) {
continue;
}
if (!$child->IsDirectory() && $arFile["PERMISSION"] <= "R" && !$task_mode) {
continue;
}
if ($bLogical) {
if (strlen($arFilter["NAME"]) > 0 && strpos($arFile["LOGIC_NAME"], $arFilter["NAME"]) === false) {
continue;
}
} else {
if (strlen($arFilter["NAME"]) > 0 && strpos($arFile["NAME"], $arFilter["NAME"]) === false) {
continue;
}
}
//if(strlen($arFilter["NAME"])>0 && strpos($arFile["NAME"], $arFilter["NAME"])===false)
// continue;
if (substr($arFile["ABS_PATH"], 0, strlen(BX_ROOT . "/modules")) == BX_ROOT . "/modules" && !$USER->CanDoOperation('edit_php') && !$task_mode) {
continue;
}
if ($arFile["PERMISSION"] == "U" && !$task_mode) {
$ftype = GetFileType($arFile["NAME"]);
//.........这里部分代码省略.........