query("DROP $routine " . idf_escape($_GET["procedure"])))) { if ($_POST["drop"]) { redirect(substr($SELF, 0, -1), lang('Routine has been dropped.')); } $dropped = true; } $error = $mysql->error; if (!$_POST["drop"]) { $set = array(); $fields = array_filter((array) $_POST["fields"], 'strlen'); ksort($fields); foreach ($fields as $field) { if (strlen($field["field"])) { $set[] = (in_array($field["inout"], $inout) ? "$field[inout] " : "") . idf_escape($field["field"]) . process_type($field, "CHARACTER SET"); } } query_redirect("CREATE $routine " . idf_escape($_POST["name"]) . " (" . implode(", ", $set) . ")" . (isset($_GET["function"]) ? " RETURNS" . process_type($_POST["returns"], "CHARACTER SET") : "") . " $_POST[definition]" , substr($SELF, 0, -1), (strlen($_GET["procedure"]) ? lang('Routine has been altered.') : lang('Routine has been created.'))); } } page_header((strlen($_GET["procedure"]) ? (isset($_GET["function"]) ? lang('Alter function') : lang('Alter procedure')) . ": " . htmlspecialchars($_GET["procedure"]) : (isset($_GET["function"]) ? lang('Create function') : lang('Create procedure'))), $error); $collations = get_vals("SHOW CHARACTER SET"); $row = array("fields" => array()); if ($_POST) { $row = $_POST; $row["fields"] = (array) $row["fields"]; process_fields($row["fields"]); } elseif (strlen($_GET["procedure"])) { $row = routine($_GET["procedure"], $routine); $row["name"] = $_GET["procedure"]; } ?>