本文整理汇总了PHP中CSite::GetSiteByFullPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CSite::GetSiteByFullPath方法的具体用法?PHP CSite::GetSiteByFullPath怎么用?PHP CSite::GetSiteByFullPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSite
的用法示例。
在下文中一共展示了CSite::GetSiteByFullPath方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
else
$url = 'local_arc_name='.htmlspecialcharsbx($name);
if ($url)
echo '<script>document.location = "/restore.php?Step=1&'.$url.'";</script>';
echo '<script>EndDump();</script>';
die();
}
}
$DB->Query("UNLOCK TABLES",true);
######### Admin list #######
$arFilterFields = array();
$lAdmin->InitFilter($arFilterFields);
$lAdmin->BeginPrologContent();
$site = CSite::GetSiteByFullPath(DOCUMENT_ROOT);
if ($arID = $lAdmin->GroupAction())
{
foreach ($arID as $ID)
{
if (strlen($ID) <= 0)
continue;
if ($APPLICATION->GetFileAccessPermission(array($site, $path."/".$ID))< "W")
continue;
switch ($_REQUEST['action'])
{
case "delete":
if (preg_match('#^([0-9]+)_(.+)$#', $ID, $regs))
{
示例2: RecurseIndex
function RecurseIndex($path = array(), $max_execution_time = 0, &$NS)
{
CMain::InitPathVars($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$abs_path = $DOC_ROOT . $path;
if (strlen($site) <= 0) {
return 0;
}
if (!file_exists($abs_path) || !is_dir($abs_path)) {
return 0;
}
$handle = @opendir($abs_path);
while (false !== ($file = @readdir($handle))) {
if ($file == "." || $file == "..") {
continue;
}
$full_path = $path . "/" . $file;
if (is_dir($abs_path . "/" . $file)) {
if ($full_path == "/bitrix" || $full_path == "/" . COption::GetOptionString("main", "upload_dir", "upload")) {
continue;
}
//this is not first step and we had stopped here, so go on to reindex
if ($max_execution_time <= 0 || strlen($NS["FLG"]) <= 0 || strlen($NS["FLG"]) > 0 && substr($NS["ID"] . "/", 0, strlen($site . "|" . $full_path . "/")) == $site . "|" . $full_path . "/") {
$new_site = CSite::GetSiteByFullPath($DOC_ROOT . $full_path);
if (CUrlRewriter::RecurseIndex(array($new_site, $full_path), $max_execution_time, $NS) === false) {
return false;
}
} else {
//all done
continue;
}
} else {
//not the first step and we found last file from previos one
if ($max_execution_time > 0 && strlen($NS["FLG"]) > 0 && $NS["ID"] == $site . "|" . $full_path) {
$NS["FLG"] = "";
} elseif (strlen($NS["FLG"]) <= 0) {
$ID = CUrlRewriter::ReindexFile(array($site, $full_path), $NS["SESS_ID"], $NS["max_file_size"]);
if ($ID) {
$NS["CNT"] = intval($NS["CNT"]) + 1;
}
}
if ($max_execution_time > 0 && getmicrotime() - START_EXEC_TIME > $max_execution_time) {
$NS["FLG"] = "Y";
$NS["ID"] = $site . "|" . $full_path;
return false;
}
}
}
return true;
}
示例3: require_once
require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_before.php");
require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/fileman/prolog.php");
if (!$USER->CanDoOperation('fileman_view_file_structure'))
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/fileman/include.php");
if(CModule::IncludeModule("compression"))
CCompress::Disable2048Spaces();
if (isset($_GET['path']))
{
$site = CFileMan::__CheckSite($site);
if(!$site)
$site = CSite::GetSiteByFullPath($_SERVER["DOCUMENT_ROOT"].$path);
$io = CBXVirtualIo::GetInstance();
$documentRoot = CSite::GetSiteDocRoot($site);
$path = $io->CombinePath("/", $path);
$abs_path = $documentRoot.$path;
$arPath = Array($site, $path);
if ($io->FileExists($abs_path) && $USER->CanDoFileOperation('fm_view_file', $arPath))
{
$width = isset($width) ? 'width="'.htmlspecialcharsex($width).'"' : '';
$height = isset($height) ? 'height="'.htmlspecialcharsex($height).'"' : '';
?>
<HTML><HEAD></HEAD><BODY>
<embed id="flash_preview" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="preview_flash"
示例4: CopyEx
function CopyEx($path_from, $path_to, $bDeleteAfterCopy = false, $bOverride = false)
{
global $APPLICATION, $USER;
CMain::InitPathVars($site_from, $path_from);
$DOC_ROOT_FROM = CSite::GetSiteDocRoot($site_from);
CMain::InitPathVars($site_to, $path_to);
$DOC_ROOT_TO = CSite::GetSiteDocRoot($site_to);
$strWarning = '';
//check: if we copy to the same directory
if (strpos($DOC_ROOT_TO . $path_to . "/", $DOC_ROOT_FROM . $path_from . "/") === 0) {
return GetMessage("FILEMAN_LIB_BAD_FOLDER") . ": \"" . $path_from . "\".\n";
}
$io = CBXVirtualIo::GetInstance();
if ($io->DirectoryExists($DOC_ROOT_FROM . $path_from)) {
// Minimal access - read/listing for copying files
if (!$USER->CanDoFileOperation('fm_view_listing', array($site_from, $path_from))) {
return GetMessage("FILEMAN_FILEMAN_FOLDER_READ_DENY") . " \"" . $path_from . "\".\n";
}
if ($bDeleteAfterCopy && !$USER->CanDoFileOperation('fm_delete_folder', array($site_from, $path_from))) {
return GetMessage("FILEMAN_FILEMAN_FOLDER_DEL_DENY") . " \"" . $path_from . "\".\n";
}
//Check: folder exist or not
$strWarTmp = CFileMan::CreateDir(array($site_to, $path_to));
if (strlen($strWarTmp) > 0) {
return $strWarTmp;
}
$APPLICATION->CopyFileAccessPermission(array($site_from, $path_from), array($site_to, $path_to));
} else {
// If we can write this file
if (!$USER->CanDoFileOperation('fm_create_new_file', array($site_to, $path_to))) {
return GetMessage("FILEMAN_FILEMAN_FILE_WRITE_DENY") . " \"" . $path_to . "\".\n";
}
// If we can't read source-file
if (!$USER->CanDoFileOperation('fm_view_file', array($site_from, $path_from))) {
return GetMessage("FILEMAN_FILEMAN_FILE_READ_DENY") . " \"" . $path_from . "\".\n";
}
// Copying php or system file without PHP or LPA access
if (!($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', $arPath) || !(HasScriptExtension($Elem["NAME"]) || substr($Elem["NAME"], 0, 1) == "."))) {
return GetMessage("FILEMAN_FILEMAN_FILE_READ_DENY") . " \"" . $path_from . "\".\n";
}
// If we can't move source-file
if ($bDeleteAfterCopy && !$USER->CanDoFileOperation('fm_delete_file', array($site_from, $path_from))) {
return GetMessage("FILEMAN_FILEMAN_FILE_DEL_DENY") . " \"" . $path_from . "\".\n";
}
//Check if folder already exist and trying to create if not
$p = strrpos($path_to, "/");
$path_to_dir = substr($path_to, 0, $p);
$strWarTmp = CFileMan::CreateDir(array($site_to, $path_to_dir));
if (strlen($strWarTmp) > 0) {
return $strWarTmp;
}
if ($io->FileExists($DOC_ROOT_TO . $path_to) || $io->DirectoryExists($DOC_ROOT_TO . $path_to)) {
if ($bOverride) {
$strWarn = CFileMan::DeleteEx(array($site_to, $path_to));
if ($strWarn != "") {
return $strWarn;
}
} else {
return GetMessage("FILEMAN_FILEMAN_FILE_WITH_NAME") . " \"" . $path_to . "\" " . GetMessage("FILEMAN_FILEMAN_ALREADY_EXISTS") . "!\n";
}
}
$APPLICATION->CopyFileAccessPermission(array($site_from, $path_from), array($site_to, $path_to));
//************************** Quota **************************//
if (COption::GetOptionInt("main", "disk_space") > 0) {
$f = $io->GetFile($DOC_ROOT_FROM . $path_from);
$size = $f->GetFileSize();
$quota = new CDiskQuota();
if (!$quota->checkDiskQuota(array("FILE_SIZE" => $size))) {
return $quota->LAST_ERROR;
}
}
//************************** Quota **************************//
// Copy file
if (DEBUG_FILE_MAN) {
echo "copy(" . $DOC_ROOT_FROM . $path_from . "," . $DOC_ROOT_TO . $path_to . ");<br>";
}
if (!$io->Copy($DOC_ROOT_FROM . $path_from, $DOC_ROOT_TO . $path_to)) {
$strWarning .= GetMessage('FILEMAN_COPY_ERROR', array('#PATH_FROM#' => htmlspecialcharsex($path_from), '#PATH_TO#' => htmlspecialcharsex($path_to)));
}
//************************** Quota **************************//
if (COption::GetOptionInt("main", "disk_space") > 0) {
$quota->updateDiskQuota("file", $size, "copy");
}
//************************** Quota **************************//
if (CModule::IncludeModule("search")) {
$site = CSite::GetSiteByFullPath($DOC_ROOT_TO . $path_to);
CSearch::ReIndexFile(array($site_to, $path_to), $site);
}
if ($bDeleteAfterCopy && strlen($strWarning) <= 0) {
// If was command "delete after copy"?
$strWarning .= CFileMan::DeleteFile(array($site_from, $path_from));
}
return $strWarning;
}
// Recursive
$d = $io->GetDirectory($DOC_ROOT_FROM . $path_from);
$arChildren = $d->GetChildren();
foreach ($arChildren as $child) {
$fn = $child->GetName();
if ($child->IsDirectory()) {
//.........这里部分代码省略.........
示例5: CheckFields
function CheckFields()
{
global $DB, $strError, $FILENAME, $APPLICATION, $ID, $BODY, $USER, $SITE_ID, $STATUS_ID, $DOC_ROOT;
$str = "";
$arMsg = array();
$SCRIPT_FILE_TYPE = GetFileType($FILENAME);
$FILENAME = trim($FILENAME);
$FILENAME = "/" . ltrim(_normalizePath($FILENAME), "/");
$io = CBXVirtualIo::GetInstance();
if (strlen($FILENAME) <= 0) {
$arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_FORGOT_FILENAME"));
} elseif (!$io->ValidatePathString($FILENAME)) {
$arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_FILE_NAME_NOT_VALID"));
} elseif ($SCRIPT_FILE_TYPE != "SOURCE") {
$arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_INCORRECT_FILETYPE"));
} else {
$SITE_ID = CWorkflow::__CheckSite($SITE_ID);
if (!$SITE_ID) {
$SITE_ID = CSite::GetSiteByFullPath($_SERVER['DOCUMENT_ROOT'] . $FILENAME);
}
if (!$USER->CanDoFileOperation('fm_edit_in_workflow', array($SITE_ID, $FILENAME))) {
$s = str_replace("#FILENAME#", "{$FILENAME}", GetMessage("FLOW_ACCESS_DENIED"));
$arMsg[] = array("id" => "FILENAME", "text" => $s . ": " . GetMessage("FLOW_MIN_RIGHTS"));
} elseif ($STATUS_ID == 1 && !($USER->CanDoFileOperation('fm_edit_existent_file', array($SITE_ID, $FILENAME)) && $USER->CanDoFileOperation('fm_create_new_file', array($SITE_ID, $FILENAME)))) {
$arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_ACCESS_DENIED_FOR_FILE_WRITE", array("#FILENAME#" => $FILENAME)));
} else {
$z = CWorkflow::GetByFilename($FILENAME, $SITE_ID);
if ($zr = $z->Fetch()) {
if ($zr["ID"] != $ID && $zr["STATUS_ID"] != 1) {
$arMsg[] = array("id" => "FILENAME", "text" => str_replace("#FILENAME#", $FILENAME, GetMessage("FLOW_FILENAME_EXIST")));
}
}
}
}
if (!CWorkflow::IsAdmin()) {
$arGroups = $USER->GetUserGroupArray();
if (!is_array($arGroups)) {
$arGroups = array(2);
}
$arFilter = array("GROUP_ID" => $arGroups, "PERMISSION_TYPE_1" => 1, "ID_EXACT_MATCH" => "Y", "ID" => $STATUS_ID);
$rsStatuses = CWorkflowStatus::GetList($by = "s_c_sort", $strOrder, $arFilter, $is_filtered, array("ID"));
if (!$rsStatuses->Fetch()) {
$arMsg[] = array("id" => "STATUS_ID", "text" => GetMessage("FLOW_ERROR_WRONG_STATUS"));
}
}
$bIsPhp = IsPHP($BODY);
if ($bIsPhp) {
if ($USER->CanDoFileOperation('fm_lpa', array($SITE_ID, $FILENAME)) && !$USER->CanDoOperation('edit_php')) {
if (CModule::IncludeModule("fileman")) {
$old_res = CFileman::ParseFileContent($APPLICATION->GetFileContent($DOC_ROOT . $FILENAME), true);
$old_BODY = $old_res["CONTENT"];
$BODY = CMain::ProcessLPA($BODY, $old_BODY);
} else {
$arMsg[] = array("id" => "BODY", "text" => "Error! Fileman is not included!");
}
} else {
if (!$USER->CanDoOperation('edit_php')) {
$arMsg[] = array("id" => "BODY", "text" => GetMessage("FLOW_PHP_IS_NOT_AVAILABLE"));
}
}
}
if (!empty($arMsg)) {
$e = new CAdminException($arMsg);
$GLOBALS["APPLICATION"]->ThrowException($e);
return false;
}
return true;
}
示例6: SaveFileContent
function SaveFileContent($abs_path, $strContent)
{
$strContent = str_replace("\r\n", "\n", $strContent);
$file = array();
$this->ResetException();
foreach (GetModuleEvents("main", "OnBeforeChangeFile", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($abs_path, &$strContent)) == false) {
if (!$this->GetException()) {
$this->ThrowException(GetMessage("main_save_file_handler_error", array("#HANDLER#" => $arEvent["TO_NAME"])));
}
return false;
}
}
$io = CBXVirtualIo::GetInstance();
$fileIo = $io->GetFile($abs_path);
$io->CreateDirectory($fileIo->GetPath());
if ($fileIo->IsExists()) {
$file["exists"] = true;
if (!$fileIo->IsWritable()) {
$fileIo->MarkWritable();
}
$file["size"] = $fileIo->GetFileSize();
}
/****************************** QUOTA ******************************/
if (COption::GetOptionInt("main", "disk_space") > 0) {
$quota = new CDiskQuota();
if (false === $quota->checkDiskQuota(array("FILE_SIZE" => intVal(strLen($strContent) - intVal($file["size"]))))) {
$this->ThrowException($quota->LAST_ERROR, "BAD_QUOTA");
return false;
}
}
/****************************** QUOTA ******************************/
if ($fileIo->PutContents($strContent)) {
$fileIo->MarkWritable();
} else {
if ($file["exists"]) {
$this->ThrowException(GetMessage("MAIN_FILE_NOT_CREATE"), "FILE_NOT_CREATE");
} else {
$this->ThrowException(GetMessage("MAIN_FILE_NOT_OPENED"), "FILE_NOT_OPEN");
}
return false;
}
bx_accelerator_reset();
$site = CSite::GetSiteByFullPath($abs_path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
//Fix for name case under Windows
$abs_path = strtolower($abs_path);
$DOC_ROOT = strtolower($DOC_ROOT);
}
if (strpos($abs_path, $DOC_ROOT) === 0 && $site !== false) {
$DOC_ROOT = rtrim($DOC_ROOT, "/\\");
$path = "/" . ltrim(substr($abs_path, strlen($DOC_ROOT)), "/\\");
foreach (GetModuleEvents("main", "OnChangeFile", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($path, $site));
}
}
/****************************** QUOTA ******************************/
if (COption::GetOptionInt("main", "disk_space") > 0) {
$fs = $fileIo->GetFileSize();
CDiskQuota::updateDiskQuota("files", intVal($fs - intVal($file["size"])), "update");
}
/****************************** QUOTA ******************************/
return true;
}
示例7: array
global $meeting_folder;
// $folder = $_REQUEST["install_public_path"];
// $folder = str_replace('\\', '/', $folder);
$meeting_folder = '/services/meeting/';
$io = CBXVirtualIo::GetInstance();
if (substr($meeting_folder, -4) != '.php') {
$meeting_folder .= (substr($meeting_folder, -1) == '/' ? '' : '/') . 'index.php';
}
$fileName = $io->ExtractNameFromPath($meeting_folder);
$meeting_folder = $io->ExtractPathFromPath($meeting_folder);
$menuFolder = $io->ExtractPathFromPath($meeting_folder);
$absPath = $io->RelativeToAbsolutePath($meeting_folder);
$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';
示例8: getCurTemplate
private static function getCurTemplate($path, $mp_mode = false)
{
if (!$mp_mode) {
$dbSiteRes = CSite::GetTemplateList(CSite::GetSiteByFullPath($path, true));
if (($arSiteRes = $dbSiteRes->Fetch()) !== false) {
return $arSiteRes['TEMPLATE'];
}
}
return '.default';
}
示例9: CheckBackup
function CheckBackup()
{
$arCount = 0;
$arResult = array();
$arResult["STATUS"] = false;
$bMcrypt = function_exists('mcrypt_encrypt');
$bBitrixCloud = $bMcrypt && CModule::IncludeModule('bitrixcloud') && CModule::IncludeModule('clouds');
$site = CSite::GetSiteByFullPath(DOCUMENT_ROOT);
$path = BX_ROOT . "/backup";
$arTmpFiles = array();
$arFilter = array();
GetDirList(array($site, $path), $arDir, $arTmpFiles, $arFilter, array('sort' => 'asc'), "F");
foreach ($arTmpFiles as $ar) {
if (strpos($ar['NAME'], ".enc.gz") || strpos($ar['NAME'], ".tar.gz") || strpos($ar['NAME'], ".tar") || strpos($ar['NAME'], ".enc")) {
$arCount++;
}
}
if ($bBitrixCloud) {
$backup = CBitrixCloudBackup::getInstance();
try {
foreach ($backup->listFiles() as $ar) {
if (strpos($ar['FILE_NAME'], ".enc.gz") || strpos($ar['FILE_NAME'], ".tar.gz") || strpos($ar['FILE_NAME'], ".tar") || strpos($ar['FILE_NAME'], ".enc")) {
$arCount++;
}
}
} catch (Exception $e) {
}
}
if ($arCount > 0) {
$arResult["STATUS"] = true;
$arResult["MESSAGE"]["PREVIEW"] = GetMessage("CL_FOUND_BACKUP", array("#count#" => $arCount));
} else {
$arResult["MESSAGE"]["PREVIEW"] = GetMessage("CL_NOT_FOUND_BACKUP");
}
return $arResult;
}
示例10: foreach
foreach ($arPropTypes_tmp as $k => $v) {
if (is_set($arDefProps, $k)) {
$arAllPropFields_tmp[] = $arDefProps[$k];
}
}
if (is_array($arAllPropFields)) {
foreach ($arAllPropFields as $v) {
$arAllPropFields_tmp[] = $v;
}
}
$arAllPropFields = $arAllPropFields_tmp;
unset($arPropTypes_tmp);
unset($arAllPropFields_tmp);
unset($arDefProps);
$tagFindPath = $_SERVER["DOCUMENT_ROOT"] . $path . '/_';
$documentSite = CSite::GetSiteByFullPath($tagFindPath);
for ($i = 0, $l = count($arAllPropFields); $i < $l; $i++) {
$arProp = $arAllPropFields[$i];
?>
<tr>
<td valign="top" <?php
if (!$arProp["NAME"]) {
echo 'nowrap';
}
?>
>
<input type="hidden" id="H_CODE_<?php
echo $i;
?>
" name="H_CODE_<?php
echo $i;