/** * Обработчик действия: Удаление группы изображений из альбома. */ function DeleteImages() { if (!empty($_REQUEST['checkimg']) && !empty($_GET['idalb'])) { if ($album = A::$DB->getRowById($_GET['idalb'], SECTION . "_albums")) { foreach ($_REQUEST['checkimg'] as $id) { DelRegImage((int) $id); if ($album['idimg'] == $id) { A::$DB->Update(SECTION . "_albums", array('idimg' => 0), "id=" . $album['id']); $album['idimg'] = 0; } } } } return true; }
function fcategory_dataset_prepare($dataset) { if ($structure = getStructureByPlugin('fcategory')) { A::$DB->query("SELECT * FROM {$structure} WHERE idsec=" . SECTION_ID . " ORDER BY sort"); while ($row = A::$DB->fetchRow()) { switch ($row['type']) { case "int": $_REQUEST[$row['field']] = isset($_REQUEST[$row['field']]) ? (int) $_REQUEST[$row['field']] : 0; $dataset->fields[] = $row['field']; break; case "select": $_REQUEST[$row['field']] = isset($_REQUEST[$row['field']]) ? (int) $_REQUEST[$row['field']] : 0; $options = loadList($row['property']); if (!isset($options[$_REQUEST[$row['field']]]) && !empty($_REQUEST[$row['field'] . "_txt"])) { if ($string = trim($_REQUEST[$row['field'] . "_txt"])) { if ($plugin = getPluginByStructure($row['property'])) { if (function_exists("{$plugin}_add")) { $_REQUEST[$row['field']] = call_user_func("{$plugin}_add", $row['property'], $string); } } } } $dataset->fields[] = $row['field']; break; case "mselect": if (!empty($_REQUEST[$row['field']]) && is_array($_REQUEST[$row['field']])) { $values = array(); foreach ($_REQUEST[$row['field']] as $sid) { $values[] = sprintf("%04d", (int) $sid); } $_REQUEST[$row['field']] = implode(",", $values); } else { $_REQUEST[$row['field']] = ""; } $dataset->fields[] = $row['field']; break; case "float": $_REQUEST[$row['field']] = isset($_REQUEST[$row['field']]) ? (double) $_REQUEST[$row['field']] : 0; $dataset->fields[] = $row['field']; break; case "bool": $_REQUEST[$row['field']] = isset($_REQUEST[$row['field']]) ? "Y" : "N"; $dataset->fields[] = $row['field']; break; case "date": $_REQUEST[$row['field']] = isset($_REQUEST[$row['field']]) ? (int) $_REQUEST[$row['field']] : mktime(0, 0, 0, (int) $_REQUEST[$row['field'] . 'Month'], (int) $_REQUEST[$row['field'] . 'Day'], (int) $_REQUEST[$row['field'] . 'Year']); $dataset->fields[] = $row['field']; break; case "string": case "text": case "format": $_REQUEST[$row['field']] = isset($_REQUEST[$row['field']]) ? trim($_REQUEST[$row['field']]) : ""; $dataset->fields[] = $row['field']; break; case "image": if (empty(A::$REGFILES)) { A::$REGFILES = getSectionByModule('pages'); } if (empty($dataset->data) || empty($_REQUEST['parent_id'])) { $_REQUEST[$row['field']] = UploadImage($row['field'], !empty($_REQUEST['name']) ? $_REQUEST['name'] : ""); } else { $_REQUEST[$row['field']] = UploadImage($row['field'], !empty($_REQUEST['name']) ? $_REQUEST['name'] : "", $dataset->data[$row['field']]); if (isset($_REQUEST[$row['field'] . '_del'])) { DelRegImage($dataset->data[$row['field']]); $_REQUEST[$row['field']] = 0; } } $dataset->fields[] = $row['field']; break; case "file": if (empty(A::$REGFILES)) { A::$REGFILES = getSectionByModule('pages'); } if (empty($dataset->data) || empty($_REQUEST['parent_id'])) { $_REQUEST[$row['field']] = UploadFile($row['field'], !empty($_REQUEST['name']) ? $_REQUEST['name'] : ""); } else { $_REQUEST[$row['field']] = UploadFile($row['field'], !empty($_REQUEST['name']) ? $_REQUEST['name'] : "", $dataset->data[$row['field']]); if (isset($_REQUEST[$row['field'] . '_del'])) { DelRegFile($dataset->data[$row['field']]); $_REQUEST[$row['field']] = 0; } } $dataset->fields[] = $row['field']; break; } } A::$DB->free(); } }