本文整理汇总了PHP中CIBlockElement::DeleteFile方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElement::DeleteFile方法的具体用法?PHP CIBlockElement::DeleteFile怎么用?PHP CIBlockElement::DeleteFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElement
的用法示例。
在下文中一共展示了CIBlockElement::DeleteFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckFields
function CheckFields(&$arFields, $ID = false, $bCheckDiskQuota = true)
{
global $DB, $APPLICATION, $USER;
$this->LAST_ERROR = "";
$APPLICATION->ResetException();
if ($ID === false) {
$db_events = GetModuleEvents("iblock", "OnStartIBlockElementAdd", true);
} else {
$arFields["ID"] = $ID;
$db_events = GetModuleEvents("iblock", "OnStartIBlockElementUpdate", true);
}
foreach ($db_events as $arEvent) {
$bEventRes = ExecuteModuleEventEx($arEvent, array(&$arFields));
if ($bEventRes === false) {
break;
}
}
if (($ID === false || is_set($arFields, "NAME")) && strlen($arFields["NAME"]) <= 0) {
$this->LAST_ERROR .= GetMessage("IBLOCK_BAD_ELEMENT_NAME") . "<br>";
}
if (isset($arFields["ACTIVE_FROM"]) && $arFields["ACTIVE_FROM"] != '' && !$DB->IsDate($arFields["ACTIVE_FROM"], false, LANG, "FULL")) {
$this->LAST_ERROR .= GetMessage("IBLOCK_BAD_ACTIVE_FROM") . "<br>";
}
if (isset($arFields["ACTIVE_TO"]) && $arFields["ACTIVE_TO"] != '' && !$DB->IsDate($arFields["ACTIVE_TO"], false, LANG, "FULL")) {
$this->LAST_ERROR .= GetMessage("IBLOCK_BAD_ACTIVE_TO") . "<br>";
}
if (is_set($arFields, "PREVIEW_PICTURE")) {
if (is_array($arFields["PREVIEW_PICTURE"]) && array_key_exists("bucket", $arFields["PREVIEW_PICTURE"]) && is_object($arFields["PREVIEW_PICTURE"]["bucket"])) {
//This is trusted image from xml import
} elseif (is_array($arFields["PREVIEW_PICTURE"])) {
$error = CFile::CheckImageFile($arFields["PREVIEW_PICTURE"]);
if (strlen($error) > 0) {
$this->LAST_ERROR .= $error . "<br>";
} elseif (($error = CFile::checkForDb($arFields, "PREVIEW_PICTURE")) !== "") {
$this->LAST_ERROR .= GetMessage("IBLOCK_ERR_PREVIEW_PICTURE") . "<br>" . $error . "<br>";
}
} elseif (intval($arFields["PREVIEW_PICTURE"]) > 0) {
if (intval($arFields["WF_PARENT_ELEMENT_ID"]) <= 0 || CIBlockElement::DeleteFile($arFields["PREVIEW_PICTURE"], $ID, "PREVIEW", intval($arFields["WF_PARENT_ELEMENT_ID"]), $arFields["IBLOCK_ID"], true) <= 0) {
$this->LAST_ERROR .= GetMessage("IBLOCK_ERR_PREVIEW_PICTURE") . "<br>";
}
}
}
if (is_set($arFields, "DETAIL_PICTURE")) {
if (is_array($arFields["DETAIL_PICTURE"]) && array_key_exists("bucket", $arFields["DETAIL_PICTURE"]) && is_object($arFields["DETAIL_PICTURE"]["bucket"])) {
//This is trusted image from xml import
} elseif (is_array($arFields["DETAIL_PICTURE"])) {
$error = CFile::CheckImageFile($arFields["DETAIL_PICTURE"]);
if (strlen($error) > 0) {
$this->LAST_ERROR .= $error . "<br>";
} elseif (($error = CFile::checkForDb($arFields, "DETAIL_PICTURE")) !== "") {
$this->LAST_ERROR .= GetMessage("IBLOCK_ERR_DETAIL_PICTURE") . "<br>" . $error . "<br>";
}
} elseif (intval($arFields["DETAIL_PICTURE"]) > 0) {
if (intval($arFields["WF_PARENT_ELEMENT_ID"]) <= 0 || CIBlockElement::DeleteFile($arFields["DETAIL_PICTURE"], $ID, "DETAIL", intval($arFields["WF_PARENT_ELEMENT_ID"]), $arFields["IBLOCK_ID"], true) <= 0) {
$this->LAST_ERROR .= GetMessage("IBLOCK_ERR_DETAIL_PICTURE") . "<br>";
}
}
}
if (array_key_exists("TAGS", $arFields) && CModule::IncludeModule('search')) {
$arFields["TAGS"] = implode(", ", tags_prepare($arFields["TAGS"]));
}
if ($ID === false && !is_set($arFields, "IBLOCK_ID")) {
$this->LAST_ERROR .= GetMessage("IBLOCK_BAD_BLOCK_ID") . "<br>";
}
if ($ID !== false && is_set($arFields, "XML_ID") && strlen($arFields["XML_ID"]) <= 0) {
$this->LAST_ERROR .= GetMessage("IBLOCK_BAD_EXTERNAL_CODE") . "<br>";
}
//Find out IBLOCK_ID from fields or from element
$IBLOCK_ID = intval($arFields["IBLOCK_ID"]);
if ($IBLOCK_ID <= 0) {
$IBLOCK_ID = 0;
$res = $DB->Query("SELECT IBLOCK_ID FROM b_iblock_element WHERE ID=" . IntVal($ID));
if ($ar = $res->Fetch()) {
$IBLOCK_ID = (int) $ar["IBLOCK_ID"];
}
}
//Read iblock metadata
static $IBLOCK_CACHE = array();
if (!isset($IBLOCK_CACHE[$IBLOCK_ID])) {
if ($IBLOCK_ID > 0) {
$IBLOCK_CACHE[$IBLOCK_ID] = CIBlock::GetArrayByID($IBLOCK_ID);
} else {
$IBLOCK_CACHE[$IBLOCK_ID] = false;
}
}
if ($IBLOCK_CACHE[$IBLOCK_ID]) {
$arFields["IBLOCK_ID"] = $IBLOCK_ID;
} else {
$this->LAST_ERROR .= GetMessage("IBLOCK_BAD_BLOCK_ID") . "<br>";
}
if (is_set($arFields, 'IBLOCK_SECTION') && !empty($arFields['IBLOCK_SECTION'])) {
if (!is_array($arFields['IBLOCK_SECTION'])) {
$arFields['IBLOCK_SECTION'] = array($arFields['IBLOCK_SECTION']);
}
$arFields['IBLOCK_SECTION'] = array_filter($arFields['IBLOCK_SECTION']);
}
if ($IBLOCK_CACHE[$IBLOCK_ID]) {
$ar = $IBLOCK_CACHE[$IBLOCK_ID]["FIELDS"];
if (is_array($ar)) {
$WF_PARENT_ELEMENT_ID = isset($arFields["WF_PARENT_ELEMENT_ID"]) ? intval($arFields["WF_PARENT_ELEMENT_ID"]) : 0;
//.........这里部分代码省略.........