$config_id) { $option_id = (int)$option_id; $config_id = (int)$config_id; if ($option_id <= 0 || $config_id <= 0) continue; $opt_def = get_record($db_link, "config_options", "id = ?", [$option_id]); if ($opt_def) { LOG_INFO($db_link, WEB_config_remove_option . " id: " . $config_id . " name: " . ($opt_def["option_name"] ?? '')); } delete_record($db_link, "config", "id = ?", [$config_id]); } } header("Location: " . $_SERVER["REQUEST_URI"]); exit; } if (getPOST("save")) { $fid = getPOST("f_id", null, []); $f_config_value = getPOST("f_config_value", null, []); if (!empty($fid) && is_array($fid)) { foreach ($fid as $option_id => $config_id) { $option_id = (int)$option_id; $config_id = (int)$config_id; if ($option_id <= 0 || $config_id <= 0) continue; $value = trim($f_config_value[$config_id] ?? ''); $option = get_record($db_link, "config_options", "id = ?", [$option_id]); if (!$option) continue; $new = []; if ($option_id == 29) { // Пароль — шифруем $new['value'] = crypt_string($value); } else { // Обычное значение $new['value'] = $value; LOG_INFO($db_link, WEB_config_set_option . " id: " . $config_id . " name: " . ($option["option_name"] ?? '') . " = " . $value); } if (!empty($new)) { update_record($db_link, "config", "id = ?", $new, [$config_id]); } } } header("Location: " . $_SERVER["REQUEST_URI"]); exit; } if (getPOST("create")) { $new_option = (int)getPOST("f_new_option", null, 0); if ($new_option > 0) { $opt_def = get_record($db_link, "config_options", "id = ?", [$new_option]); if ($opt_def) { $new = [ 'option_id' => $new_option, 'value' => get_option($db_link, $new_option) ]; LOG_INFO($db_link, WEB_config_add_option . " id: " . $new_option . " name: " . ($opt_def["option_name"] ?? '') . " = " . ($new['value'] ?? '')); insert_record($db_link, "config", $new); } } header("Location: " . $_SERVER["REQUEST_URI"]); exit; } unset($_POST); fix_auth_rules($db_link); require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/header.php"); print_control_submenu($page_url); ?>