• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CDiskQuota类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: BXDeleteFromSystem

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;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:29,代码来源:file_delete.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: 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


示例4: processActionDefault

 protected function processActionDefault()
 {
     $pathToAjax = isset($this->arParams['AJAX_PATH']) ? $this->arParams['AJAX_PATH'] : '/bitrix/components/bitrix/disk.bitrix24disk/ajax.php';
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $quota = CDiskQuota::getDiskQuota();
     $this->arResult['showDiskQuota'] = false;
     //$quota !== true; //now without quota
     $this->arResult['diskSpace'] = (double) COption::getOptionInt('main', 'disk_space') * 1024 * 1024;
     $this->arResult['quota'] = $quota;
     $this->arResult['ajaxIndex'] = $pathToAjax;
     $this->arResult['ajaxStorageIndex'] = '/desktop_app/storage.php';
     $this->arResult['isInstalledDisk'] = \Bitrix\Disk\Desktop::isDesktopDiskInstall();
     $this->arResult['personalLibIndex'] = '/company/personal/user/' . $this->getUser()->getId() . '/disk/path/';
     $this->arResult['isInstalledPull'] = (bool) isModuleInstalled('pull');
     $this->arResult['currentUser'] = array('id' => $this->getUser()->getId(), 'formattedName' => $this->getUser()->getFormattedName());
     Asset::getInstance()->addJs('/bitrix/components/bitrix/disk.bitrix24disk/disk.js');
     $this->includeComponentTemplate();
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:18,代码来源:class.php


示例5: DELETE

 function DELETE($options)
 {
     $io = self::GetIo();
     if (isset($options['path'])) {
         $options['path'] = $this->_udecode($options['path']);
     }
     $this->IsDir($options);
     if ($this->arParams["not_found"]) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("WD_FILE_ERROR3"), "DESTINATION_FILE_OR_FOLDER_IS_NOT_FOUND");
         return "404 Not found";
     }
     if (!$this->CheckRights("DELETE", true, $options["path"])) {
         $this->ThrowAccessDenied();
         return "403 Forbidden";
     }
     $quota = false;
     if (COption::GetOptionInt("main", "disk_space") > 0) {
         $quota = new CDiskQuota();
     }
     $trashPath = $this->GetMetaID("TRASH");
     $arPath = explode("/", $this->arParams["item_id"]);
     if (!$this->arParams["is_dir"]) {
         //$file = $io->CombinePath($this->real_path_full, $this->arParams["item_id"]);
         //$path = $io->CombinePath($this->real_path, $this->arParams["item_id"]);
         $file = CWebDavBase::CleanRelativePathString($this->arParams["item_id"], $this->real_path_full);
         $path = CWebDavBase::CleanRelativePathString($this->arParams["item_id"], $this->real_path);
         if ($file === false || $path === false) {
             return "404 Not found";
         }
         $arPath = explode("/", $this->arParams["item_id"]);
         if ($arPath[1] != $this->meta_names["TRASH"]["name"] && !isset($options['force'])) {
             return $this->_move_to_trash($options, $this->arParams);
         } else {
             // in trash or options[force]
             $oFile = $io->GetFile($file);
             $file_size = $oFile->GetFileSize();
             if ($io->Delete($file)) {
                 $this->_delete_props($this->arParams['item_id']);
                 $GLOBALS["APPLICATION"]->RemoveFileAccessPermission(array(SITE_ID, $path));
                 if (CModule::IncludeModule("search")) {
                     CSearch::DeleteIndex("main", SITE_ID . "|" . $path);
                 }
                 if ($quota) {
                     $quota->updateDiskQuota("file", $file_size, "delete");
                 }
             } else {
                 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("WD_FILE_ERROR3"), "DESTINATION_FILE_OR_FOLDER_IS_NOT_FOUND");
                 return "404 Not found";
             }
         }
     } else {
         if ($arPath[1] != $this->meta_names["TRASH"]["name"] && !isset($options['force'])) {
             return $this->_move_to_trash($options, $this->arParams);
         } else {
             $params = $this->GetFilesAndFolders($this->arParams["item_id"]);
             if (empty($params)) {
                 return true;
             }
             rsort($params, SORT_STRING);
             foreach ($params as $file) {
                 $path = str_replace($this->real_path_full, "", $file);
                 $path = $io->CombinePath("/", $path);
                 $file = $io->CombinePath($this->real_path_full, $path);
                 if (!$io->ValidatePathString($file)) {
                     return "404 Not found";
                 }
                 if ($io->FileExists($file)) {
                     //$path = str_replace($_SERVER['DOCUMENT_ROOT'], "", $file);
                     $oFile = $io->GetFile($file);
                     $file_size = $oFile->GetFileSize();
                     if ($io->Delete($file)) {
                         $this->_delete_props(str_replace(array($this->real_path_full, "///", "//"), "/", $file));
                         $GLOBALS["APPLICATION"]->RemoveFileAccessPermission(array(SITE_ID, $path));
                         if (CModule::IncludeModule("search")) {
                             CSearch::DeleteIndex("main", SITE_ID . "|" . $path);
                         }
                         if ($quota) {
                             $quota->updateDiskQuota("file", $file_size, "delete");
                         }
                     } else {
                         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("WD_FILE_ERROR3"), "DESTINATION_FILE_OR_FOLDER_IS_NOT_FOUND");
                         return "404 Not found";
                     }
                 } elseif ($io->DirectoryExists($file)) {
                     $path = str_replace($_SERVER['DOCUMENT_ROOT'], "", $file);
                     if ($io->Delete($file)) {
                         $this->_delete_props(str_replace(array($this->real_path_full, "///", "//"), "/", $file));
                         $GLOBALS["APPLICATION"]->RemoveFileAccessPermission(array(SITE_ID, $path));
                     } else {
                         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("WD_FILE_ERROR3"), "DESTINATION_FILE_OR_FOLDER_IS_NOT_FOUND");
                         return "404 Not found";
                     }
                 }
             }
             if ($path == $trashPath) {
                 $trashID = $this->GetMetaID('TRASH');
             }
         }
     }
     clearstatcache();
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:file.php


示例6: CheckFields

 public function CheckFields(&$arFields, $ID = false)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION;
     $this->LAST_ERROR = "";
     $NAME = isset($arFields["NAME"]) ? $arFields["NAME"] : "";
     if (($ID === false || array_key_exists("NAME", $arFields)) && strlen($NAME) <= 0) {
         $this->LAST_ERROR .= GetMessage("IBLOCK_BAD_NAME") . "<br>";
     }
     if ($ID === false && !is_set($arFields, "IBLOCK_TYPE_ID")) {
         $this->LAST_ERROR .= GetMessage("IBLOCK_BAD_BLOCK_TYPE") . "<br>";
     }
     if ($ID === false) {
         //For new record take default values
         $WORKFLOW = array_key_exists("WORKFLOW", $arFields) ? $arFields["WORKFLOW"] : "Y";
         $BIZPROC = array_key_exists("BIZPROC", $arFields) ? $arFields["BIZPROC"] : "N";
     } else {
         //For existing one read old values
         $arIBlock = CIBlock::GetArrayByID($ID);
         $WORKFLOW = array_key_exists("WORKFLOW", $arFields) ? $arFields["WORKFLOW"] : $arIBlock["WORKFLOW"];
         $BIZPROC = array_key_exists("BIZPROC", $arFields) ? $arFields["BIZPROC"] : $arIBlock["BIZPROC"];
         if ($BIZPROC != "Y") {
             $BIZPROC = "N";
         }
         //This is cache compatibility issue
     }
     if ($WORKFLOW == "Y" && $BIZPROC == "Y") {
         $this->LAST_ERROR .= GetMessage("IBLOCK_BAD_WORKFLOW_AND_BIZPROC") . "<br>";
     }
     if (is_set($arFields, "IBLOCK_TYPE_ID")) {
         $r = CIBlockType::GetByID($arFields["IBLOCK_TYPE_ID"]);
         if (!$r->Fetch()) {
             $this->LAST_ERROR .= GetMessage("IBLOCK_BAD_BLOCK_TYPE_ID") . "<br>";
         }
     }
     if (is_array($arFields["PICTURE"]) && array_key_exists("bucket", $arFields["PICTURE"]) && is_object($arFields["PICTURE"]["bucket"])) {
         //This is trusted image from xml import
     } elseif (isset($arFields["PICTURE"]) && is_array($arFields["PICTURE"]) && isset($arFields["PICTURE"]["name"])) {
         $error = CFile::CheckImageFile($arFields["PICTURE"]);
         if (strlen($error) > 0) {
             $this->LAST_ERROR .= $error . "<br>";
         }
     }
     if ($ID === false && !is_set($arFields, "LID") || is_set($arFields, "LID") && (is_array($arFields["LID"]) && count($arFields["LID"]) <= 0 || !is_array($arFields["LID"]) && strlen($arFields["LID"]) <= 0)) {
         $this->LAST_ERROR .= GetMessage("IBLOCK_BAD_SITE_ID_NA") . "<br>";
     } elseif (is_set($arFields, "LID")) {
         if (!is_array($arFields["LID"])) {
             $arFields["LID"] = array($arFields["LID"]);
         }
         foreach ($arFields["LID"] as $v) {
             $r = CSite::GetByID($v);
             if (!$r->Fetch()) {
                 $this->LAST_ERROR .= "'" . $v . "' - " . GetMessage("IBLOCK_BAD_SITE_ID") . "<br>";
             }
         }
     }
     $APPLICATION->ResetException();
     if ($ID === false) {
         $db_events = GetModuleEvents("iblock", "OnBeforeIBlockAdd", true);
     } else {
         $arFields["ID"] = $ID;
         $db_events = GetModuleEvents("iblock", "OnBeforeIBlockUpdate", true);
     }
     foreach ($db_events as $arEvent) {
         $bEventRes = ExecuteModuleEventEx($arEvent, array(&$arFields));
         if ($bEventRes === false) {
             if ($err = $APPLICATION->GetException()) {
                 $this->LAST_ERROR .= $err->GetString() . "<br>";
             } else {
                 $APPLICATION->ThrowException("Unknown error");
                 $this->LAST_ERROR .= "Unknown error.<br>";
             }
             break;
         }
     }
     /****************************** QUOTA ******************************/
     if (empty($this->LAST_ERROR) && COption::GetOptionInt("main", "disk_space") > 0) {
         $quota = new CDiskQuota();
         if (!$quota->checkDiskQuota($arFields)) {
             $this->LAST_ERROR = $quota->LAST_ERROR;
         }
     }
     /****************************** QUOTA ******************************/
     if (strlen($this->LAST_ERROR) > 0) {
         return false;
     }
     return true;
 }
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:88,代码来源:iblock.php


示例7: UploadFile

 function UploadFile($Params)
 {
     $buffer = 'parent.oWaitWindow.Hide();';
     $F = $Params['file'];
     $io = CBXVirtualIo::GetInstance();
     if (isset($F["tmp_name"]) && strlen($F["tmp_name"]) > 0 && strlen($F["name"]) > 0 || is_uploaded_file($F["tmp_name"])) {
         global $APPLICATION, $USER;
         $strWarning = '';
         $filename = $Params['filename'];
         $path = $Params['path'];
         $site = $Params['site'];
         $upload_and_open = $Params['upload_and_open'];
         $rootPath = CSite::GetSiteDocRoot($site);
         if ($filename == '') {
             $filename = $F["name"];
         }
         $pathto = Rel2Abs($path, $filename);
         if (strlen($filename) > 0 && ($mess = self::CheckFileName($filename)) !== true) {
             $strWarning = $mess;
         }
         if ($strWarning == '') {
             $fn = $io->ExtractNameFromPath($pathto);
             if ($APPLICATION->GetFileAccessPermission(array($site, $pathto)) > "R" && ($USER->IsAdmin() || !HasScriptExtension($fn) && substr($fn, 0, 1) != "." && $io->ValidateFilenameString($fn))) {
                 if (!$io->FileExists($rootPath . $pathto) || $_REQUEST["rewrite"] == "Y") {
                     //************************** Quota **************************//
                     $bQuota = true;
                     if (COption::GetOptionInt("main", "disk_space") > 0) {
                         $bQuota = false;
                         $quota = new CDiskQuota();
                         if ($quota->checkDiskQuota(array("FILE_SIZE" => filesize($F["tmp_name"])))) {
                             $bQuota = true;
                         }
                     }
                     //************************** Quota **************************//
                     if ($bQuota) {
                         $io->Copy($F["tmp_name"], $rootPath . $pathto);
                         $flTmp = $io->GetFile($rootPath . $pathto);
                         $flTmp->MarkWritable();
                         if (COption::GetOptionInt("main", "disk_space") > 0) {
                             CDiskQuota::updateDiskQuota("file", $flTmp->GetFileSize(), "copy");
                         }
                         $buffer = 'setTimeout(function(){parent.oBXDialogControls.Uploader.OnAfterUpload("' . $filename . '", ' . ($upload_and_open == "Y" ? 'true' : 'false') . ');}, 50);';
                     } else {
                         $strWarning = $quota->LAST_ERROR;
                     }
                 } else {
                     $strWarning = GetMessage("FD_LOAD_EXIST_ALERT");
                 }
             } else {
                 $strWarning = GetMessage("FD_LOAD_DENY_ALERT");
             }
         }
     } else {
         $strWarning = GetMessage("FD_LOAD_ERROR_ALERT");
     }
     if ($strWarning != '') {
         $buffer = 'alert("' . addslashes(htmlspecialcharsex($strWarning)) . '");';
     }
     return '<script>' . $buffer . '</script>';
 }
开发者ID:spas-viktor,项目名称:books,代码行数:60,代码来源:file_dialog.php


示例8: UndoNewFile

    function UndoNewFile($Params, $type)
    {
        global $APPLICATION;
        $documentRoot = CSite::GetSiteDocRoot($Params['site']);
        $io = CBXVirtualIo::GetInstance();
        // Delete file
        $f = $io->GetFile($Params['absPath']);
        $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($Params['absPath']);
        if (!$sucess) {
            return;
        }
        $APPLICATION->RemoveFileAccessPermission(array($Params['site'], $Params['path']));
        if (CModule::IncludeModule("search")) {
            CSearch::DeleteIndex("main", $Params['site'] . "|" . $Params['path']);
        }
        // Find and clean file from menu
        if ($Params['menu']) {
            $arMenu = CFileman::GetMenuArray($documentRoot . $Params['menu']['menuFile']);
            if (!empty($arMenu["aMenuLinks"])) {
                $found = false;
                foreach ($arMenu["aMenuLinks"] as $menuIndex => $arItem) {
                    if ($arItem[1] == $Params['menu']['menuPath'] && $arItem[0] == $Params['menu']['menuName']) {
                        unset($arMenu["aMenuLinks"][$menuIndex]);
                        $found = true;
                        break;
                    }
                }
                if ($found) {
                    CFileMan::SaveMenu(array($Params['site'], $Params['menu']['menuFile']), $arMenu["aMenuLinks"], $arMenu["sMenuTemplate"]);
                }
            }
        }
        if (isset($Params['public']) && $Params['public'] == 'Y') {
            ?>
			<script type="text/javascript">
				window.location = '<?php 
            echo CUtil::JSEscape(CHTTP::URN2URI(GetDirPath($Params['path'])));
            ?>
';
			</script>
		<?php 
        }
        $GLOBALS["CACHE_MANAGER"]->CleanDir("menu");
    }
开发者ID:Satariall,项目名称:izurit,代码行数:50,代码来源:fileman.php


示例9: processActionGetDiskQuota

 public function processActionGetDiskQuota()
 {
     $this->enableIgnoreQuotaError();
     $quota = CDiskQuota::GetDiskQuota();
     if ($quota === true) {
         return $this->sendResponse(array('status' => static::STATUS_UNLIMITED, 'quota' => null));
     }
     return $this->sendResponse(array('status' => static::STATUS_LIMITED, 'quota' => $quota === false ? 0 : $quota));
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:diskdispatcher.php


示例10: CheckFields


//.........这里部分代码省略.........
                             break;
                         }
                     }
                     $bError = $bCount <= 0;
                 }
             }
             if ($arProperty["IS_REQUIRED"] == "Y" && $arProperty['PROPERTY_TYPE'] != 'F') {
                 $len = 0;
                 foreach ($property_values as $key2 => $property_value) {
                     if (array_key_exists("GetLength", $arUserType)) {
                         $len += call_user_func_array($arUserType["GetLength"], array($arProperty, array("VALUE" => $property_value)));
                     } else {
                         $len += strlen($property_value);
                     }
                     if ($len > 0) {
                         break;
                     }
                 }
                 $bError = $len <= 0;
             }
             if ($bError) {
                 $this->LAST_ERROR .= GetMessage("IBLOCK_BAD_PROPERTY", array("#PROPERTY#" => $arProperty["NAME"])) . "<br>";
             }
             // check file properties for correctness
             if ($arProperty['PROPERTY_TYPE'] == 'F') {
                 $bImageOnly = False;
                 $arImageExtentions = explode(",", strtoupper(CFile::GetImageExtensions()));
                 if (strlen($arProperty["FILE_TYPE"])) {
                     $bImageOnly = True;
                     $arAvailTypes = explode(",", strtoupper($arProperty["FILE_TYPE"]));
                     foreach ($arAvailTypes as $avail_type) {
                         if (!in_array(trim($avail_type), $arImageExtentions)) {
                             $bImageOnly = False;
                             break;
                         }
                     }
                 }
                 foreach ($property_values as $key2 => $property_value) {
                     if (!is_array($property_value) && intval($property_value) > 0 && intval($arFields["WF_PARENT_ELEMENT_ID"]) > 0) {
                         if (CIBlockElement::DeleteFile($property_value, $ID, "PROPERTY", intval($arFields["WF_PARENT_ELEMENT_ID"]), $arFields["IBLOCK_ID"], true) <= 0) {
                             $this->LAST_ERROR .= GetMessage("IBLOCK_ERR_FILE_PROPERTY") . "<br>";
                         }
                     } elseif (is_array($property_value)) {
                         if (is_object($property_value["bucket"])) {
                             //This is trusted image from xml import
                             $error = "";
                         } else {
                             if ($bImageOnly) {
                                 $error = CFile::CheckImageFile($property_value);
                             } else {
                                 $error = CFile::CheckFile($property_value, 0, false, $arProperty["FILE_TYPE"]);
                             }
                         }
                         //For user without edit php permissions
                         //we allow only pictures upload
                         if (!is_object($USER) || !$USER->IsAdmin()) {
                             if (HasScriptExtension($property_value["name"])) {
                                 $error = GetMessage("FILE_BAD_TYPE") . " (" . $property_value["name"] . ").";
                             }
                         }
                         if (strlen($error) > 0) {
                             $this->LAST_ERROR .= $error . "<br>";
                         }
                     }
                 }
             }
         }
     }
     $APPLICATION->ResetException();
     if ($ID === false) {
         $db_events = GetModuleEvents("iblock", "OnBeforeIBlockElementAdd", true);
     } else {
         $arFields["ID"] = $ID;
         $db_events = GetModuleEvents("iblock", "OnBeforeIBlockElementUpdate", true);
     }
     foreach ($db_events as $arEvent) {
         $bEventRes = ExecuteModuleEventEx($arEvent, array(&$arFields));
         if ($bEventRes === false) {
             if ($err = $APPLICATION->GetException()) {
                 $this->LAST_ERROR .= $err->GetString() . "<br>";
             } else {
                 $APPLICATION->ThrowException("Unknown error");
                 $this->LAST_ERROR .= "Unknown error.<br>";
             }
             break;
         }
     }
     /****************************** QUOTA ******************************/
     if ($bCheckDiskQuota && empty($this->LAST_ERROR) && COption::GetOptionInt("main", "disk_space") > 0) {
         $quota = new CDiskQuota();
         if (!$quota->checkDiskQuota($arFields)) {
             $this->LAST_ERROR = $quota->LAST_ERROR;
         }
     }
     /****************************** QUOTA ******************************/
     if (!empty($this->LAST_ERROR)) {
         return false;
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:iblockelement.php


示例11: GetPanelHtml

	function GetPanelHtml()
	{
		global $USER, $APPLICATION, $DB;

		$hkInstance = CHotKeys::getInstance();

		if ($APPLICATION->ShowPanel === false || (!$USER->IsAuthorized() && $APPLICATION->ShowPanel !== true))
			return "";

		CTopPanel::InitPanelIcons();

		$arPanelButtons = &$APPLICATION->arPanelButtons;
		usort($arPanelButtons, array("CTopPanel", "SortButtons"));

		$bShowPanel = false;
		foreach($arPanelButtons as $key=>$arValue)
		{
			if(trim($arValue["HREF"]) <> "" || is_array($arValue["MENU"]) && !empty($arValue["MENU"]))
			{
				//we have at least one button to show
				$bShowPanel = true;
				break;
			}
		}

		if($bShowPanel == false)
		{
			$arCodes = unserialize(COption::GetOptionString("main", "show_panel_for_users"));
			if($USER->CanAccess($arCodes))
			{
				//we have settings in the main module options
				$bShowPanel = true;
			}
		}

		if ($bShowPanel == false && $APPLICATION->ShowPanel !== true)
			return "";

		$APPLICATION->PanelShowed = true;


		if ($_GET["back_url_admin"] <> "" && strpos($_GET["back_url_admin"], "/") === 0)
			$_SESSION["BACK_URL_ADMIN"] = $_GET["back_url_admin"];

		$aUserOpt = CUserOptions::GetOption("admin_panel", "settings");
		$aUserOptGlobal = CUserOptions::GetOption("global", "settings");

		$toggleModeSet = false;
		if (isset($_GET["bitrix_include_areas"]) && $_GET["bitrix_include_areas"] <> "")
		{
			$APPLICATION->SetShowIncludeAreas($_GET["bitrix_include_areas"]=="Y");
			$toggleModeSet = true;
		}

		$showMode = $APPLICATION->GetPublicShowMode();

		$params = DeleteParam(array("bitrix_include_areas", "bitrix_show_mode", "back_url_admin"));
		$href = $APPLICATION->GetCurPage();
		$hrefEnc = htmlspecialcharsbx($href);

		$toggleModeDynamic = $aUserOptGlobal['panel_dynamic_mode'] == 'Y';
		$toggleMode = $toggleModeDynamic && !$toggleModeSet
			? $aUserOpt['edit'] == 'on'
			: $APPLICATION->GetShowIncludeAreas() == 'Y';

		//Save if changed
		$old_edit = $aUserOpt['edit'];
		$aUserOpt['edit'] = $toggleMode ? 'on' : 'off';
		if($old_edit !== $aUserOpt['edit'])
			CUserOptions::SetOption('admin_panel', 'settings', $aUserOpt);

		$toggleModeLink = $hrefEnc.'?bitrix_include_areas='.($toggleMode ? 'N' : 'Y').($params<>""? "&amp;".htmlspecialcharsbx($params):"");

		$maxQuotaMB = COption::GetOptionInt("main", "disk_space", 0);
		$maxQuota = $maxQuotaMB*1048576;//*1024*1024
		if($maxQuota > 0)
		{
			$quota = new CDiskQuota();
			$free = $quota->GetDiskQuota();
			$freeMB = intval($free/1048576);
		}

		$result = CTopPanel::ShowPanelScripts(true);
		$result .= '
	<!--[if lte IE 7]>
	<style type="text/css">#bx-panel {display:none !important;}</style>
	<div id="bx-panel-error">'.GetMessage("top_panel_browser").'</div><![endif]-->
	<script type="text/javascript">BX.admin.dynamic_mode='.($toggleModeDynamic ? 'true' : 'false').'; BX.admin.dynamic_mode_show_borders = '.($toggleMode ? 'true' : 'false').';</script>
	<div style="display:none; overflow:hidden;" id="bx-panel-back"></div>
	<div id="bx-panel"'.($aUserOpt["collapsed"] == "on" ? ' class="bx-panel-folded"':'').'>
		<div id="bx-panel-top">
			<div id="bx-panel-top-gutter"></div>
			<div id="bx-panel-tabs">
	';
		$result .= '
				<a id="bx-panel-menu" href="" '.CTopPanel::AddAttrHint(GetMessage('top_panel_start_menu_tooltip_title'), GetMessage('top_panel_start_menu_tooltip')).'><span id="bx-panel-menu-icon"></span><span id="bx-panel-menu-text">'.GetMessage("top_panel_menu").'</span></a><a id="bx-panel-view-tab"><span>'.GetMessage("top_panel_site").'</span></a><a id="bx-panel-admin-tab" href="'.(
						$_SESSION["BACK_URL_ADMIN"] <> ""
						? htmlspecialcharsbx($_SESSION["BACK_URL_ADMIN"]).(strpos($_SESSION["BACK_URL_ADMIN"], "?") !== false? "&amp;":"?")
						: '/bitrix/admin/index.php?lang='.LANGUAGE_ID.'&amp;'
					).'back_url_pub='.urlencode($href.($params<>""? "?".$params:"")).'"><span>'.GetMessage("top_panel_admin").'</span></a>';
//.........这里部分代码省略.........
开发者ID:nProfessor,项目名称:Mytb,代码行数:101,代码来源:top_panel.php


示例12: getDiskSpace

 private function getDiskSpace()
 {
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $freeSpace = CDiskQuota::GetDiskQuota();
     return array($freeSpace === false ? 0 : $freeSpace, (double) COption::GetOptionInt('main', 'disk_space', 0) * 1024 * 1024);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:6,代码来源:class.php


示例13: array

		$f = $io->GetFile($abs_path);
		$arUndoParams = array(
			'module' => 'fileman',
			'undoType' => 'delete_menu',
			'undoHandler' => 'CFileman::UndoFileDelete',
			'arContent' => array(
				'site' => $site,
				'path' => $menufilename,
				'content' => $f->GetContents(),
				'perm' => CFileMan::FetchFileAccessPerm($arPath_m, true),
			)
		);

		if (COption::GetOptionInt("main", "disk_space") > 0)
		{
			$quota = new CDiskQuota();
			$quota->UpdateDiskQuota("file", $f->GetFileSize(), "delete");
		}

		$f->MarkWritable();
		$success = $io->Delete($abs_path);

		if(COption::GetOptionString($module_id, "log_menu", "Y")=="Y")
		{
			$mt = COption::GetOptionString("fileman", "menutypes", $default_value, $site);
			$mt = unserialize(str_replace("\\", "", $mt));
			$res_log['menu_name'] = $mt[$name];
			$res_log['path'] = substr($path, 1);
			CEventLog::Log(
				"content",
				"MENU_DELETE",
开发者ID:ASDAFF,项目名称:open_bx,代码行数:31,代码来源:menu_edit.php


示例14: onEpilogHtmlCache

	private static function onEpilogHtmlCache()
	{
		global $USER;

		$bAutorized = is_object($USER) && $USER->IsAuthorized();
		if(!$bAutorized && defined("HTML_PAGES_FILE"))
		{
			@setcookie(session_name(), "", time()-360000, "/");
		}

		$bExcludeByFile = $_SERVER["SCRIPT_NAME"] == "/bitrix/admin/get_start_menu.php";

		$posts = 0;
		$bytes = 0.0;
		$all_clean = false;

		//Check if modifyng action happend
		if(($_SERVER["REQUEST_METHOD"] === "POST") || ($bAutorized && check_bitrix_sessid() && !$bExcludeByFile))
		{
			//if it was admin post
			if(strncmp($_SERVER["REQUEST_URI"], "/bitrix/", 8) === 0)
			{
				//Then will clean all the cache
				$bytes = \Bitrix\Main\Data\StaticHtmlFileStorage::deleteRecursive("/");
				$all_clean = true;
			}
			//check if it was SEF post
			elseif(array_key_exists("SEF_APPLICATION_CUR_PAGE_URL", $_REQUEST) && file_exists($_SERVER['DOCUMENT_ROOT']."/urlrewrite.php"))
			{
				$arUrlRewrite = array();
				include($_SERVER['DOCUMENT_ROOT']."/urlrewrite.php");
				foreach($arUrlRewrite as $val)
				{
					if(preg_match($val["CONDITION"], $_SERVER["REQUEST_URI"]) > 0)
					{
						if (strlen($val["RULE"]) > 0)
							$url = preg_replace($val["CONDITION"], (StrLen($val["PATH"]) > 0 ? $val["PATH"]."?" : "").$val["RULE"], $_SERVER["REQUEST_URI"]);
						else
							$url = $val["PATH"];

						$pos=strpos($url, "?");
						if($pos !== false)
						{
							$url = substr($url, 0, $pos);
						}
						$url = substr($url, 0, strrpos($url, "/")+1);
						$bytes = \Bitrix\Main\Data\StaticHtmlFileStorage::deleteRecursive($url);
						break;
					}
				}
			}
			//public page post
			else
			{
				$folder = substr($_SERVER["REQUEST_URI"], 0, strrpos($_SERVER["REQUEST_URI"], "/"));
				$bytes = \Bitrix\Main\Data\StaticHtmlFileStorage::deleteRecursive($folder);
			}
			$posts++;
		}

		if($bytes > 0.0 && class_exists("cdiskquota"))
		{
			CDiskQuota::updateDiskQuota("file", $bytes, "delete");
		}

		if($posts || $bytes)
		{
			self::writeStatistic(
				0, //hit
				0, //miss
				0, //quota
				$posts, //posts
				($all_clean? false: -$bytes) //files
			);
		}
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:76,代码来源:cache_html.php


示例15: updateQuota

	/**
	 * Update disk quota and cache statistic
	 * @param float $bytes positive or negative value
	 */
	public static function updateQuota($bytes)
	{
		if ($bytes == 0.0)
		{
			return;
		}

		if (class_exists("cdiskquota"))
		{
			CDiskQuota::updateDiskQuota("file", abs($bytes), $bytes > 0.0 ? "copy" : "delete");
		}

		CHTMLPagesCache::writeStatistic(0, 0, 0, 0, $bytes);
	}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:18,代码来源:cache_html.php


示例16: ResizeImageGet

 function ResizeImageGet($file, $arSize, $resizeType = BX_RESIZE_IMAGE_PROPORTIONAL, $bInitSizes = false, $arFilters = false, $bImmediate = false, $jpgQuality = false)
 {
     if (!is_array($file) && intval($file) > 0) {
         $file = CFile::GetFileArray($file);
     }
     if (!is_array($file) || !array_key_exists("FILE_NAME", $file) || strlen($file["FILE_NAME"]) <= 0) {
         return false;
     }
     if ($resizeType != BX_RESIZE_IMAGE_EXACT && $resizeType != BX_RESIZE_IMAGE_PROPORTIONAL_ALT) {
         $resizeType = BX_RESIZE_IMAGE_PROPORTIONAL;
     }
     if (!is_array($arSize)) {
         $arSize = array();
     }
     if (!array_key_exists("width", $arSize) || intval($arSize["width"]) <= 0) {
         $arSize["width"] = 0;
     }
     if (!array_key_exists("height", $arSize) || intval($arSize["height"]) <= 0) {
         $arSize["height"] = 0;
     }
     $arSize["width"] = intval($arSize["width"]);
     $arSize["height"] = intval($arSize["height"]);
     $uploadDirName = COption::GetOptionString("main", "upload_dir", "upload");
     $imageFile = "/" . $uploadDirName . "/" . $file["SUBDIR"] . "/" . $file["FILE_NAME"];
     $arImageSize = false;
     $bFilters = is_array($arFilters) && !empty($arFilters);
     if (($arSize["width"] <= 0 || $arSize["width"] >= $file["WIDTH"]) && ($arSize["height"] <= 0 || $arSize["height"] >= $file["HEIGHT"])) {
         if ($bFilters) {
             //Only filters. Leave size unchanged
             $arSize["width"] = $file["WIDTH"];
             $arSize["height"] = $file["HEIGHT"];
             $resizeType = BX_RESIZE_IMAGE_PROPORTIONAL;
         } else {
             global $arCloudImageSizeCache;
             $arCloudImageSizeCache[$file["SRC"]] = array($file["WIDTH"], $file["HEIGHT"]);
             return array("src" => $file["SRC"], "width" => intval($file["WIDTH"]), "height" => intval($file["HEIGHT"]), "size" => $file["FILE_SIZE"]);
         }
     }
     $io = CBXVirtualIo::GetInstance();
     $cacheImageFile = "/" . $uploadDirName . "/resize_cache/" . $file["SUBDIR"] . "/" . $arSize["width"] . "_" . $arSize["height"] . "_" . $resizeType . (is_array($arFilters) ? md5(serialize($arFilters)) : "") . "/" . $file["FILE_NAME"];
     $cacheImageFileCheck = $cacheImageFile;
     if ($file["CONTENT_TYPE"] == "image/bmp") {
         $cacheImageFileCheck .= ".jpg";
     }
     static $cache = array();
     $cache_id = $cacheImageFileCheck;
     if (isset($cache[$cache_id])) {
         return $cache[$cache_id];
     } elseif (!file_exists($io->GetPhysicalName($_SERVER["DOCUMENT_ROOT"] . $cacheImageFileCheck))) {
         /****************************** QUOTA ******************************/
         $bDiskQuota = true;
         if (COption::GetOptionInt("main", "disk_space") > 0) {
             $quota = new CDiskQuota();
             $bDiskQuota = $quota->checkDiskQuota($file);
         }
         /****************************** QUOTA ******************************/
         if ($bDiskQuota) {
             if (!is_array($arFilters)) 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CDiv类代码示例发布时间:2022-05-23
下一篇:
PHP CDbTestCase类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap