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


PHP CBXVirtualIo类代码示例

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


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

示例1: Delete

 /**
  * <p>Метод удаляет файл из таблицы зарегистрированных файлов (b_file) и с диска. Статичный метод.</p>
  *
  *
  * @param int $id  Цифровой идентификатор файла.
  *
  * @return mixed 
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?
  * // удаляем изображение формы
  * $arFilter = array("ID" =&gt; 1, "ID_EXACT_MATCH" =&gt; "Y");
  * $rsForm = CForm::GetList($by, $order, $arFilter, $is_filtered);
  * if ($arForm = $rsForm-&gt;Fetch())
  * {
  *     if (intval($arForm["IMAGE_ID"])&gt;0) <b>CFile::Delete</b>($arForm["IMAGE_ID"]);	
  * }
  * ?&gt;
  * </pre>
  *
  *
  * <h4>See Also</h4> 
  * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/functions/file/deletedirfiles.php">DeleteDirFiles</a> </li>
  * <li> <a href="http://dev.1c-bitrix.ru/api_help/main/functions/file/deletedirfilesex.php">DeleteDirFilesEx</a> </li>
  * </ul><a name="examples"></a>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/main/reference/cfile/delete.php
  * @author Bitrix
  */
 public static function Delete($ID)
 {
     global $DB;
     $io = CBXVirtualIo::GetInstance();
     $ID = intval($ID);
     if ($ID <= 0) {
         return;
     }
     $res = CFile::GetByID($ID);
     if ($res = $res->Fetch()) {
         $delete_size = 0;
         $upload_dir = COption::GetOptionString("main", "upload_dir", "upload");
         $dname = $_SERVER["DOCUMENT_ROOT"] . "/" . $upload_dir . "/" . $res["SUBDIR"];
         $fname = $dname . "/" . $res["FILE_NAME"];
         $file = $io->GetFile($fname);
         if ($file->isExists() && $file->unlink()) {
             $delete_size += $res["FILE_SIZE"];
         }
         $delete_size += CFile::ResizeImageDelete($res);
         $DB->Query("DELETE FROM b_file WHERE ID = " . $ID);
         $directory = $io->GetDirectory($dname);
         if ($directory->isExists() && $directory->isEmpty()) {
             $directory->rmdir();
         }
         CFile::CleanCache($ID);
         foreach (GetModuleEvents("main", "OnFileDelete", true) as $arEvent) {
             ExecuteModuleEventEx($arEvent, array($res));
         }
         /****************************** QUOTA ******************************/
         if ($delete_size > 0 && COption::GetOptionInt("main", "disk_space") > 0) {
             CDiskQuota::updateDiskQuota("file", $delete_size, "delete");
         }
         /****************************** QUOTA ******************************/
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:67,代码来源:file.php

示例2: BXCreateSection

function BXCreateSection(&$fileContent, &$sectionFileContent, &$absoluteFilePath, &$sectionPath)
{
    //Check quota
    $quota = new CDiskQuota();
    if (!$quota->CheckDiskQuota(array("FILE_SIZE" => strlen($fileContent) + strlen($sectionFileContent)))) {
        $GLOBALS["APPLICATION"]->ThrowException($quota->LAST_ERROR, "BAD_QUOTA");
        return false;
    }
    $io = CBXVirtualIo::GetInstance();
    //Create dir
    if (!$io->CreateDirectory($absoluteFilePath)) {
        $GLOBALS["APPLICATION"]->ThrowException(GetMessage("PAGE_NEW_FOLDER_CREATE_ERROR") . "<br /> (" . htmlspecialcharsbx($absoluteFilePath) . ")", "DIR_NOT_CREATE");
        return false;
    }
    //Create .section.php
    $f = $io->GetFile($absoluteFilePath . "/.section.php");
    if (!$GLOBALS["APPLICATION"]->SaveFileContent($absoluteFilePath . "/.section.php", $sectionFileContent)) {
        return false;
    }
    //Create index.php
    if (!$GLOBALS["APPLICATION"]->SaveFileContent($absoluteFilePath . "/index.php", $fileContent)) {
        return false;
    } else {
        if (COption::GetOptionString($module_id, "log_page", "Y") == "Y") {
            $res_log['path'] = $sectionPath . "/index.php";
            CEventLog::Log("content", "PAGE_ADD", "main", "", serialize($res_log));
        }
    }
    return true;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:30,代码来源:file_new.php

示例3: __construct

 public function __construct($strArchiveName, $bCompress = false, $start_time = -1, $max_exec_time = -1, $pos = 0, $stepped = false)
 {
     $this->io = CBXVirtualIo::GetInstance();
     $this->max_exec_time = $max_exec_time;
     $this->start_time = $start_time;
     $this->file_pos = $pos;
     $this->_bCompress = $bCompress;
     $this->stepped = $stepped;
     self::$bMbstring = extension_loaded("mbstring");
     if (!$bCompress) {
         if (@file_exists($this->io->GetPhysicalName($strArchiveName))) {
             if ($fp = @fopen($this->io->GetPhysicalName($strArchiveName), "rb")) {
                 $data = fread($fp, 2);
                 fclose($fp);
                 if ($data == "‹") {
                     $this->_bCompress = True;
                 }
             }
         } else {
             if (substr($strArchiveName, -2) == 'gz') {
                 $this->_bCompress = True;
             }
         }
     } else {
         $this->_bCompress = True;
     }
     $this->_strArchiveName = $strArchiveName;
     $this->_arErrors = array();
 }
开发者ID:ASDAFF,项目名称:open_bx,代码行数:29,代码来源:tar_gz.php

示例4: __get_folder_tree

 function __get_folder_tree($path, $bCheckFolders = false)
 {
     static $io = false;
     if ($io === false) {
         $io = CBXVirtualIo::GetInstance();
     }
     $path = $io->CombinePath($path, '/');
     $arSection = array();
     $bCheckFolders = $bCheckFolders === true;
     $dir = $io->GetDirectory($path);
     if (!$dir->IsExists()) {
         return false;
     }
     $arChildren = $dir->GetChildren();
     foreach ($arChildren as $node) {
         if ($node->IsDirectory()) {
             if ($bCheckFolders) {
                 return true;
             }
             $filename = $node->GetName();
             if (preg_match("/^\\..*/", $filename)) {
                 continue;
             }
             $arSection[$filename] = array("NAME" => $filename, "HAS_DIR" => __get_folder_tree($node->GetPathWithName(), true));
         }
     }
     if ($bCheckFolders) {
         return false;
     }
     uasort($arSection, "__sort_array_folder");
     return $arSection;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:32,代码来源:disk_sections_tree.php

示例5: GetInstance

 /**
  * Returns proxy class instance (singleton pattern)
  *
  * @static
  * @return CBXVirtualIo - Proxy class instance
  */
 public static function GetInstance()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:14,代码来源:virtual_io.php

示例6: GetAbsoluteRoot

 public static function GetAbsoluteRoot()
 {
     $io = CBXVirtualIo::GetInstance();
     if (defined('BX_TEMPORARY_FILES_DIRECTORY')) {
         return BX_TEMPORARY_FILES_DIRECTORY;
     } else {
         return $io->CombinePath($_SERVER["DOCUMENT_ROOT"], COption::GetOptionString("main", "upload_dir", "upload"), "tmp");
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:file_temp.php

示例7: GetAccessArrTmp

function GetAccessArrTmp($path)
{
    global $DOC_ROOT;
    $io = CBXVirtualIo::GetInstance();
    if ($io->DirectoryExists($DOC_ROOT . $path)) {
        @(include $io->GetPhysicalName($DOC_ROOT . $path . "/.access.php"));
        return $PERM;
    }
    return array();
}
开发者ID:spas-viktor,项目名称:books,代码行数:10,代码来源:fileman_access.php

示例8: BXDeleteFromMenu

function BXDeleteFromMenu($documentRoot, $path, $site)
{
	if (!CModule::IncludeModule("fileman"))
		return false;

	if (!$GLOBALS["USER"]->CanDoOperation("fileman_edit_menu_elements") || !$GLOBALS["USER"]->CanDoOperation("fileman_edit_existent_files"))
		return false;

	$arMenuTypes = GetMenuTypes($site);
	if (empty($arMenuTypes))
		return false;

	$currentPath = $path;
	$result = array();

	$io = CBXVirtualIo::GetInstance();

	while (true)
	{
		$currentPath = rtrim($currentPath, "/");

		if (strlen($currentPath) <= 0)
		{
			$currentPath = "/";
			$slash = "";
		}
		else
		{
			//Find parent folder
			$position = strrpos($currentPath, "/");
			if ($position === false)
				break;
			$currentPath = substr($currentPath, 0, $position);
			$slash = "/";
		}

		foreach ($arMenuTypes as $menuType => $menuDesc)
		{
			$menuFile = $currentPath.$slash.".".$menuType.".menu.php";

			if ($io->FileExists($documentRoot.$menuFile) && $GLOBALS["USER"]->CanDoFileOperation("fm_edit_existent_file", Array($site, $menuFile)))
			{
				$arFound = BXDeleteFromMenuFile($menuFile, $documentRoot, $site, $path);
				if ($arFound)
					$result[] = $arFound;
			}
		}

		if (strlen($currentPath)<=0)
			break;
	}

	return $result;
}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:54,代码来源:file_delete.php

示例9: IsCanDeletePage

 function IsCanDeletePage($currentFilePath, $documentRoot, $filemanExists)
 {
     $io = CBXVirtualIo::GetInstance();
     if (!$io->FileExists($documentRoot . $currentFilePath) || !$GLOBALS["USER"]->CanDoFileOperation("fm_delete_file", array(SITE_ID, $currentFilePath))) {
         return false;
     }
     if ($filemanExists) {
         return $GLOBALS["USER"]->CanDoOperation("fileman_admin_files");
     }
     return true;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:11,代码来源:top_panel.php

示例10: findCorrectFile

 function findCorrectFile($path, &$strWarn, $warning = false)
 {
     $arUrl = CHTTP::ParseURL($path);
     if ($arUrl && is_array($arUrl)) {
         if (isset($arUrl['host'], $arUrl['scheme'])) {
             if (strpos($arUrl['host'], 'xn--') !== false) {
                 // Do nothing
             } else {
                 $originalPath = $path;
                 $path = $arUrl['scheme'] . '://' . $arUrl['host'];
                 $arErrors = array();
                 if (defined("BX_UTF")) {
                     $punicodedPath = CBXPunycode::ToUnicode($path, $arErrors);
                 } else {
                     $punicodedPath = CBXPunycode::ToASCII($path, $arErrors);
                 }
                 if ($pathPunicoded == $path) {
                     return $originalPath;
                 } else {
                     $path = $punicodedPath;
                 }
                 if ($arUrl['port'] && ($arUrl['scheme'] != 'http' || $arUrl['port'] != 80) && ($arUrl['scheme'] != 'https' || $arUrl['port'] != 443)) {
                     $path .= ':' . $arUrl['port'];
                 }
                 $path .= $arUrl['path_query'];
             }
         } else {
             $DOC_ROOT = $_SERVER["DOCUMENT_ROOT"];
             $path = Rel2Abs("/", $path);
             $path_ = $path;
             $io = CBXVirtualIo::GetInstance();
             if (!$io->FileExists($DOC_ROOT . $path)) {
                 if (CModule::IncludeModule('clouds')) {
                     $path = CCloudStorage::FindFileURIByURN($path, "component:player");
                     if ($path == "") {
                         if ($warning) {
                             $strWarn .= $warning . "<br />";
                         }
                         $path = $path_;
                     }
                 } else {
                     if ($warning) {
                         $strWarn .= $warning . "<br />";
                     }
                     $path = $path_;
                 }
             } elseif (strpos($_SERVER['HTTP_HOST'], 'xn--') !== false) {
                 $path = CHTTP::URN2URI($path);
             }
         }
     }
     return $path;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:53,代码来源:component.php

示例11: __construct

 public function __construct($pzipname)
 {
     $this->io = CBXVirtualIo::GetInstance();
     $this->zipname = $this->_convertWinPath($pzipname, false);
     $this->step_time = 30;
     $this->arPackedFiles = array();
     $this->arPackedFilesData = array();
     $this->_errorReset();
     $this->fileSystemEncoding = $this->_getfileSystemEncoding();
     self::$bMbstring = extension_loaded("mbstring");
     return;
 }
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:12,代码来源:zip.php

示例12: checkFields

 private static function checkFields(&$arFields, $actionType = self::CHECK_TYPE_ADD)
 {
     global $APPLICATION;
     $aMsg = array();
     if (isset($arFields['TYPE']) && !in_array($arFields['TYPE'], array(self::TYPE_SMILE, self::TYPE_ICON))) {
         $aMsg[] = array("id" => "TYPE", "text" => GetMessage("MAIN_SMILE_TYPE_ERROR"));
     } else {
         if ($actionType == self::CHECK_TYPE_ADD && !isset($arFields['TYPE'])) {
             $arFields['TYPE'] = self::TYPE_SMILE;
         }
     }
     if ($actionType == self::CHECK_TYPE_ADD && (!isset($arFields['SET_ID']) || intval($arFields['SET_ID']) <= 0)) {
         $aMsg[] = array("id" => "SET_ID", "text" => GetMessage("MAIN_SMILE_SET_ID_ERROR"));
     }
     if ($actionType == self::CHECK_TYPE_ADD && (!isset($arFields['SORT']) || intval($arFields['SORT']) <= 0)) {
         $arFields['SORT'] = 300;
     }
     if ($actionType == self::CHECK_TYPE_ADD && $arFields['TYPE'] == self::TYPE_SMILE && (!isset($arFields['TYPING']) || strlen($arFields['TYPING']) <= 0)) {
         $aMsg[] = array("id" => "TYPING", "text" => GetMessage("MAIN_SMILE_TYPING_ERROR"));
     }
     if ($actionType == self::CHECK_TYPE_UPDATE && $arFields['TYPE'] == self::TYPE_SMILE && (isset($arFields['TYPING']) && strlen($arFields['TYPING']) <= 0)) {
         $aMsg[] = array("id" => "TYPING", "text" => GetMessage("MAIN_SMILE_TYPING_ERROR"));
     }
     if (isset($arFields['CLICKABLE']) && $arFields['CLICKABLE'] != 'N') {
         $arFields['CLICKABLE'] = 'Y';
     }
     if (isset($arFields['IMAGE_DEFINITION']) && !in_array($arFields['IMAGE_DEFINITION'], array(self::IMAGE_SD, self::IMAGE_HD, self::IMAGE_UHD))) {
         $arFields['IMAGE_DEFINITION'] = self::IMAGE_SD;
     }
     if (isset($arFields['HIDDEN']) && $arFields['HIDDEN'] != 'Y') {
         $arFields['HIDDEN'] = 'N';
     }
     if ($actionType == self::CHECK_TYPE_ADD && (!isset($arFields['IMAGE']) || strlen($arFields['IMAGE']) <= 0)) {
         $aMsg[] = array("id" => "IMAGE", "text" => GetMessage("MAIN_SMILE_IMAGE_ERROR"));
     }
     if (isset($arFields['IMAGE']) && (!in_array(strtolower(GetFileExtension($arFields['IMAGE'])), array('png', 'jpg', 'gif')) || !CBXVirtualIo::GetInstance()->ValidateFilenameString($arFields['IMAGE']))) {
         $aMsg[] = array("id" => "IMAGE", "text" => GetMessage("MAIN_SMILE_IMAGE_ERROR"));
     }
     if (isset($arFields['IMAGE']) && (!isset($arFields['IMAGE_WIDTH']) || intval($arFields['IMAGE_WIDTH']) <= 0)) {
         $aMsg["IMAGE_XY"] = array("id" => "IMAGE_XY", "text" => GetMessage("MAIN_SMILE_IMAGE_XY_ERROR"));
     }
     if (isset($arFields['IMAGE']) && (!isset($arFields['IMAGE_HEIGHT']) || intval($arFields['IMAGE_HEIGHT']) <= 0)) {
         $aMsg["IMAGE_XY"] = array("id" => "IMAGE_XY", "text" => GetMessage("MAIN_SMILE_IMAGE_XY_ERROR"));
     }
     if (!empty($aMsg)) {
         $e = new CAdminException($aMsg);
         $APPLICATION->ThrowException($e);
         return false;
     }
     return true;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:51,代码来源:smile.php

示例13: checkDicPath

 private function checkDicPath()
 {
     global $USER;
     $dics_path = $_SERVER["DOCUMENT_ROOT"] . COption::GetOptionString('fileman', "user_dics_path", "/bitrix/modules/fileman/u_dics");
     $custom_path = $dics_path . '/' . $this->lang;
     if (COption::GetOptionString('fileman', "use_separeted_dics", "Y") == "Y") {
         $custom_path = $custom_path . '/' . $USER->GetID();
     }
     $io = CBXVirtualIo::GetInstance();
     if (!$io->DirectoryExists($custom_path)) {
         $io->CreateDirectory($custom_path);
     }
     return $custom_path;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:14,代码来源:spellchecker.php

示例14: PatchHtaccess

 function PatchHtaccess($path)
 {
     if (strtoupper(substr(PHP_OS, 0, 3)) === "WIN") {
         $io = CBXVirtualIo::GetInstance();
         $fnhtaccess = $io->CombinePath($path, '.htaccess');
         if ($io->FileExists($fnhtaccess)) {
             $ffhtaccess = $io->GetFile($fnhtaccess);
             $ffhtaccessContent = $ffhtaccess->GetContents();
             if (strpos($ffhtaccessContent, "/bitrix/virtual_file_system.php") === false) {
                 $ffhtaccessContent = preg_replace('/RewriteEngine On/is', "RewriteEngine On\r\n\r\n" . "RewriteCond %{REQUEST_FILENAME} -f [OR]\r\n" . "RewriteCond %{REQUEST_FILENAME} -l [OR]\r\n" . "RewriteCond %{REQUEST_FILENAME} -d\r\n" . "RewriteCond %{REQUEST_FILENAME} [\\xC2-\\xDF][\\x80-\\xBF] [OR]\r\n" . "RewriteCond %{REQUEST_FILENAME} \\xE0[\\xA0-\\xBF][\\x80-\\xBF] [OR]\r\n" . "RewriteCond %{REQUEST_FILENAME} [\\xE1-\\xEC\\xEE\\xEF][\\x80-\\xBF]{2} [OR]\r\n" . "RewriteCond %{REQUEST_FILENAME} \\xED[\\x80-\\x9F][\\x80-\\xBF] [OR]\r\n" . "RewriteCond %{REQUEST_FILENAME} \\xF0[\\x90-\\xBF][\\x80-\\xBF]{2} [OR]\r\n" . "RewriteCond %{REQUEST_FILENAME} [\\xF1-\\xF3][\\x80-\\xBF]{3} [OR]\r\n" . "RewriteCond %{REQUEST_FILENAME} \\xF4[\\x80-\\x8F][\\x80-\\xBF]{2}\r\n" . "RewriteCond %{REQUEST_FILENAME} !/bitrix/virtual_file_system.php\$\r\n" . "RewriteRule ^(.*)\$ /bitrix/virtual_file_system.php [L]", $ffhtaccessContent);
                 $ffhtaccess->PutContents($ffhtaccessContent);
             }
         }
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:15,代码来源:utils.php

示例15: __construct

 public function __construct($pzipname)
 {
     $this->io = CBXVirtualIo::GetInstance();
     //protecting against creating malicious php file with gzdeflate
     $pzipname = GetDirPath($this->_convertWinPath($pzipname, false)) . $this->io->RandomizeInvalidFilename(GetFileName($pzipname));
     if (HasScriptExtension($pzipname)) {
         $pzipname = RemoveScriptExtension($pzipname) . ".zip";
     }
     $this->zipname = $pzipname;
     $this->step_time = 30;
     $this->arPackedFiles = array();
     $this->_errorReset();
     $this->fileSystemEncoding = $this->_getfileSystemEncoding();
     self::$bMbstring = extension_loaded("mbstring");
     return;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:16,代码来源:zip.php


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