本文整理汇总了PHP中CBXVirtualIo类的典型用法代码示例。如果您正苦于以下问题:PHP CBXVirtualIo类的具体用法?PHP CBXVirtualIo怎么用?PHP CBXVirtualIo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBXVirtualIo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: Delete
/**
* <p>Метод удаляет файл из таблицы зарегистрированных файлов (b_file) и с диска. Статичный метод.</p>
*
*
* @param int $id Цифровой идентификатор файла.
*
* @return mixed
*
* <h4>Example</h4>
* <pre>
* <?
* // удаляем изображение формы
* $arFilter = array("ID" => 1, "ID_EXACT_MATCH" => "Y");
* $rsForm = CForm::GetList($by, $order, $arFilter, $is_filtered);
* if ($arForm = $rsForm->Fetch())
* {
* if (intval($arForm["IMAGE_ID"])>0) <b>CFile::Delete</b>($arForm["IMAGE_ID"]);
* }
* ?>
* </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
示例16: __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();
}
开发者ID:webgksupport,项目名称:alpina,代码行数:41,代码来源:step1.php
示例17: __makeFileArray
function __makeFileArray($data, $del = false)
{
global $APPLICATION;
$emptyFile = array("name" => null, "type" => null, "tmp_name" => null, "error" => 4, "size" => 0);
$result = false;
if ($del) {
$result = $emptyFile + array("del" => "Y");
} elseif (is_null($data)) {
$result = $emptyFile;
} elseif (is_string($data)) {
$io = CBXVirtualIo::GetInstance();
$normPath = $io->CombinePath("/", $data);
$absPath = $io->CombinePath($_SERVER["DOCUMENT_ROOT"], $normPath);
if ($io->ValidatePathString($absPath) && $io->FileExists($absPath)) {
$perm = $APPLICATION->GetFileAccessPermission($normPath);
if ($perm >= "W") {
$result = CFile::MakeFileArray($io->GetPhysicalName($absPath));
}
}
if ($result === false) {
$result = $emptyFile;
}
} elseif (is_array($data)) {
if (is_uploaded_file($data["tmp_name"])) {
$result = $data;
} else {
$emptyFile = array("name" => null, "type" => null, "tmp_name" => null, "error" => 4, "size" => 0);
if ($data == $emptyFile) {
$result = $emptyFile;
}
}
if ($result === false) {
$result = $emptyFile;
}
} else {
$result = $emptyFile;
}
return $result;
}
开发者ID:Satariall,项目名称:izurit,代码行数:39,代码来源:vote_question_list.php
示例18: UnZip
public static function UnZip($file_name, $last_zip_entry = "", $start_time = 0, $interval = 0)
{
global $APPLICATION;
$io = CBXVirtualIo::GetInstance();
//Function and securioty checks
if (!function_exists("zip_open")) {
return false;
}
$dir_name = substr($file_name, 0, strrpos($file_name, "/") + 1);
if (strlen($dir_name) <= strlen($_SERVER["DOCUMENT_ROOT"])) {
return false;
}
$hZip = zip_open($file_name);
if (!$hZip) {
return false;
}
//Skip from last step
if ($last_zip_entry) {
while ($entry = zip_read($hZip)) {
if (zip_entry_name($entry) == $last_zip_entry) {
break;
}
}
}
$io = CBXVirtualIo::GetInstance();
//Continue unzip
while ($entry = zip_read($hZip)) {
$entry_name = zip_entry_name($entry);
//Check for directory
zip_entry_open($hZip, $entry);
if (zip_entry_filesize($entry)) {
$file_name = trim(str_replace("\\", "/", trim($entry_name)), "/");
$file_name = $APPLICATION->ConvertCharset($file_name, "cp866", LANG_CHARSET);
$file_name = preg_replace("#^import_files/tmp/webdata/\\d+/\\d+/import_files/#", "import_files/", $file_name);
$bBadFile = HasScriptExtension($file_name) || IsFileUnsafe($file_name) || !$io->ValidatePathString("/" . $file_name);
if (!$bBadFile) {
$file_name = $io->GetPhysicalName($dir_name . rel2abs("/", $file_name));
CheckDirPath($file_name);
$fout = fopen($file_name, "wb");
if (!$fout) {
return false;
}
while ($data = zip_entry_read($entry, 102400)) {
$data_len = function_exists('mb_strlen') ? mb_strlen($data, 'latin1') : strlen($data);
$result = fwrite($fout, $data);
if ($result !== $data_len) {
return false;
}
}
}
}
zip_entry_close($entry);
//Jump to next step
if ($interval > 0 && time() - $start_time > $interval) {
zip_close($hZip);
return $entry_name;
}
}
zip_close($hZip);
return true;
}
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:61,代码来源:cml2.php
示例19: intval
if (!isset($defCatalogAvailCurrencies)) {
$defCatalogAvailCurrencies = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_CURRENCY);
}
$NUM_CATALOG_LEVELS = intval(COption::GetOptionString("catalog", "num_catalog_levels"));
$max_execution_time = intval($max_execution_time);
if ($max_execution_time <= 0) {
$max_execution_time = 0;
}
if (defined('BX_CAT_CRON') && true == BX_CAT_CRON) {
$max_execution_time = 0;
}
if (defined("CATALOG_LOAD_NO_STEP") && CATALOG_LOAD_NO_STEP) {
$max_execution_time = 0;
}
$bAllLinesLoaded = true;
$io = CBXVirtualIo::GetInstance();
if (!function_exists('CSVCheckTimeout')) {
function CSVCheckTimeout($max_execution_time)
{
return $max_execution_time <= 0 || getmicrotime() - START_EXEC_TIME <= $max_execution_time;
}
}
$DATA_FILE_NAME = "";
if (strlen($URL_DATA_FILE) > 0) {
$URL_DATA_FILE = Rel2Abs("/", $URL_DATA_FILE);
if (file_exists($_SERVER["DOCUMENT_ROOT"] . $URL_DATA_FILE) && is_file($_SERVER["DOCUMENT_ROOT"] . $URL_DATA_FILE)) {
$DATA_FILE_NAME = $URL_DATA_FILE;
}
}
if (strlen($DATA_FILE_NAME) <= 0) {
$strImportErrorMessage .= GetMessage("CATI_NO_DATA_FILE") . "<br>";
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:csv_new_run.php
示例20: Init
/**
* <p>Инициализирует (заполняет пунктами) объект класса CMenu. Возвращает "true" если в каталоге сайта найден файл меню <nobr><b>.</b><i>тип меню</i><b>.menu.php</b></nobr> (поиск идет вверх по иерархии начиная с каталога <i>dir</i>), и "false" в противном случае.</p>
*
*
*
*
* @param string $InitDir Папка, начиная с которой, объект будет искать файл <nobr><b>.</b><i>тип
* меню</i><b>.menu.php</b></nobr> (файл с параметрами и пунктами меню).
*
*
*
* @param bool $MenuExt = false Если значение - "true", то для формирования массива меню, помимо
* файлов <nobr><b>.</b><i>тип меню</i><b>.menu.php</b></nobr> будут также подключаться
* файлы с именами вида <nobr><b>.</b><i>тип меню</i><b>.menu_ext.php</b></nobr>. В которых
* вы можете манипулировать массивом меню <b>$aMenuLinks</b> произвольно, по
* вашему усмотрению (например, дополнять пункты меню значениями из
* инфо-блоков).<br>Необязателен. По умолчанию - "false".
*
*
*
* @param string $template = false Шаблон для вывода меню. <br>Необязателен. По умолчанию - "false", что
* означает искать шаблон меню сначала в файле <nobr><b>/bitrix/templates/</b><i>ID
* текущего шаблона сайта</i><b>/</b><i>тип меню</i><b>.menu_template.php</b></nobr>, затем
* если шаблон не будет найден, то искать в файле
* <nobr><b>/bitrix/templates/.default/</b><i>тип меню</i><b>.menu_template.php</b></nobr>. В самом
* шаблоне меню вам будут доступны следующие предустановленные
* переменные: <ul> <li> <b>$arMENU</b> - копия массива меню </li> <li> <b>$arMENU_LINK</b> -
* ссылка на текущий массив меню </li> <li> <b>$TEXT</b> - текст текущего
* пункта меню </li> <li> <b>$LINK</b> - ссылка текущего пункта меню </li> <li>
* <b>$SELECTED</b> - выбран ли пункт меню в данный момент </li> <li> <b>$PERMISSION</b> -
* доступ на страницу указанную в $LINK, возможны следующие значения:
* <ul> <li> <b>D</b> - доступ запрещён </li> <li> <b>R</b> - чтение (право просмотра
* содержимого файла) </li> <li> <b>U</b> - документооборот (право на
* редактирование файла в режиме документооборота) </li> <li> <b>W</b> -
* запись (право на прямое редактирование) </li> <li> <b>X</b> - полный доступ
* (право на прямое редактирование файла и право на изменение прав
* доступа на данных файл) </li> </ul> </li> <li> <b>$ADDITIONAL_LINKS</b> -
* дополнительные ссылки для подсветки меню </li> <li> <b>$ITEM_TYPE</b> - "D" -
* директория (если $LINK заканчивается на "/"), иначе "P" - страница </li> <li>
* <b>$ITEM_INDEX</b> - порядковый номер пункта меню </li> <li> <b>$PARAMS</b> -
* параметры пунктов меню </li> </ul> При этом в шаблоне для построения
* меню необходимо будет инициализировать следующие перменные: <ul>
* <li> <b>$sMenuProlog</b> - HTML который будет добавлен перед пунктами меню </li>
* <li> <b>$sMenuEpilog</b> - HTML который будет добавлен после пунктов меню </li> <li>
* <b>$sMenuBody</b> - HTML представляющий из себя один пункт меню </li> <li>
* <b>$sMenu</b> - HTML представляющий из себя все меню целиком (только для
* функций GetMenuHtmlEx) </li> </ul>
*
*
*
* @param onlyCurrentDi $r = false Если значение - "true", то отключается поиск файла меню в
* родительских каталогах.
*
*
*
* @return bool
*
*
* <h4>Example</h4>
* <pre>
* <?
* $lm = new CMenu("left");
* <b>$lm->Init</b>($APPLICATION->GetCurDir(), true);
* $lm->template = "/bitrix/templates/demo/left.menu_template.php";
* echo $lm->GetMenuHtml();
* ?>
* </pre>
*
*
*
* <h4>See Also</h4>
* <ul> <li><a href="https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=43&CHAPTER_ID=04708"
* >Меню</a></li> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cmain/getmenu.php">CMain::GetMenu</a>
* </li> </ul></b<a name="examples"></a>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/main/reference/cmenu/init.php
* @author Bitrix
*/
public function Init($InitDir, $bMenuExt = false, $template = false, $onlyCurrentDir = false)
{
global $USER;
if ($this->debug !== false && $_SESSION["SESS_SHOW_INCLUDE_TIME_EXEC"] == "Y" && ($USER->IsAdmin() || $_SESSION["SHOW_SQL_STAT"] == "Y")) {
$this->debug = new CDebugInfo(false);
$this->debug->Start();
}
$io = CBXVirtualIo::GetInstance();
$aMenuLinks = array();
$bFounded = false;
if ($template === false) {
$sMenuTemplate = '';
} else {
$sMenuTemplate = $template;
}
$InitDir = str_replace("\\", "/", $InitDir);
$Dir = $InitDir;
$site_dir = false;
if (defined("SITE_DIR") && SITE_DIR != '') {
$site_dir = SITE_DIR;
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:menu.php
注:本文中的CBXVirtualIo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论