global $USER;
if ($USER->isAuthorized()) {
CModule::IncludeModule('iblock');
$file_id = htmlspecialchars($_REQUEST['file_id']);
$check = htmlspecialchars($_REQUEST['check']);
$user = htmlspecialchars($_REQUEST['user']);
$iblock_id = 1;
$result['error'] = '';
$result['status'] = false;
if($user == $USER->GetID()){
$file_prop = CIBlockElement::GetProperty($iblock_id, $check, array("sort" => "asc"), array("CODE" => "IMAGES"));
$n = 0;
while ($file_ob = $file_prop->GetNext()) {
if($file_ob['VALUE'] == $file_id) {
CIBlockElement::SetPropertyValueCode($check, 'IMAGES', array($file_ob['PROPERTY_VALUE_ID'] => array('del' => 'Y')));
}
}
$result['status'] = true;
}
echo json_encode($result);
}