function get_db_fields($arr, $level = 0) { global $query; if (is_array($arr)) { foreach ($arr as $key => $item) { if (is_array($item)) { if (array_key_exists("field", $item) && array_key_exists("datatype", $item)) { $query .= "`" . $item["field"] . "` " . $item["datatype"] . " NOT NULL,"; } } if (is_array($arr[$key])) { get_db_fields($arr[$key], $level + 1); } } } }
$abs_directory = "/"; } else { $abs_directory = ""; for ($i = 1; $i < sizeof($abs_directory_array) - 1; $i++) { $abs_directory = $abs_directory . "/" . $abs_directory_array[$i]; } $max_i = sizeof($abs_directory_array) - 1; $abs_file = $abs_directory_array[$max_i]; } # Top template include 'templates/open.page.php'; # Save data? print "<br>\n"; if ($_REQUEST['action'] == "save") { # Clean the data $config_fields = get_db_fields($infrespconfig); foreach ($_REQUEST as $name => $value) { $name = strtolower($name); if ($config_fields['hash'][$name] == TRUE) { $form[$name] = MakeSafe($value); } } if (!is_numeric($form['add_sub_size'])) { $form['add_sub_size'] = 5; } if (!is_numeric($form['subs_per_page'])) { $form['subs_per_page'] = 25; } if (!is_numeric($form['last_activity_trim'])) { $form['last_activity_trim'] = 6; }
} # Check for empty addy fields if (isEmpty($form['emailaddy'])) { $form['emailaddy'] = "user@domain"; } if ($form['emailaddy'] == "user@domain") { $form['enabled'] = 0; } # Update the row DB_Update_Array($infrespbouncers, $form, "BouncerID = '{$bouncer_id}'"); # Done! Take us back... // print "<p class=\"big_header\">Bouncer changed!</p>\n"; inf_resp_message_box('Bouncer updated!'); } elseif ($action == "do_create") { # Grab and clean form data $fields = get_db_fields($infrespbouncers); foreach ($_REQUEST as $name => $value) { $name = strtolower($name); if ($fields['hash'][$name] == TRUE) { $form[$name] = MakeSafe($value); } } unset($form['bouncerid']); # Bounds checking if ($form['enabled'] != 1) { $form['enabled'] = 0; } if (!is_numeric($form['port'])) { $form['port'] = 110; } $form['mailtype'] = strtolower($form['mailtype']);