Skip to content
Newer
Older
100644 38 lines (34 sloc) 1.22 KB
6420c58 Schema support for PostgreSQL
jakubvrana authored
1 <?php
2 if ($_POST && !$error) {
3 $link = preg_replace('~ns=[^&]*&~', '', ME) . "ns=";
4 if ($_POST["drop"]) {
5 query_redirect("DROP SCHEMA " . idf_escape($_GET["ns"]), $link, lang('Schema has been dropped.'));
6 } else {
ef867e6 @vrana Trim identifiers (bug #3405309)
authored
7 $name = trim($_POST["name"]);
8 $link .= urlencode($name);
6420c58 Schema support for PostgreSQL
jakubvrana authored
9 if ($_GET["ns"] == "") {
ef867e6 @vrana Trim identifiers (bug #3405309)
authored
10 query_redirect("CREATE SCHEMA " . idf_escape($name), $link, lang('Schema has been created.'));
11 } elseif ($_GET["ns"] != $name) {
12 query_redirect("ALTER SCHEMA " . idf_escape($_GET["ns"]) . " RENAME TO " . idf_escape($name), $link, lang('Schema has been altered.')); //! sp_rename in MS SQL
6420c58 Schema support for PostgreSQL
jakubvrana authored
13 } else {
14 redirect($link);
15 }
16 }
17 }
18
19 page_header($_GET["ns"] != "" ? lang('Alter schema') : lang('Create schema'), $error);
20
b7e1cb0 @vrana Save bytes
authored
21 $row = $_POST;
22 if (!$row) {
23 $row = array("name" => $_GET["ns"]);
6420c58 Schema support for PostgreSQL
jakubvrana authored
24 }
25 ?>
26
27 <form action="" method="post">
27b5e46 @vrana Autofocus in create schema
authored
28 <p><input id="name" name="name" value="<?php echo h($row["name"]); ?>">
29 <script type='text/javascript'>document.getElementById('name').focus();</script>
6420c58 Schema support for PostgreSQL
jakubvrana authored
30 <input type="submit" value="<?php echo lang('Save'); ?>">
31 <?php
32 if ($_GET["ns"] != "") {
a93bc19 @vrana Create confirm function
authored
33 echo "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n";
6420c58 Schema support for PostgreSQL
jakubvrana authored
34 }
35 ?>
740ae10 @vrana Don't send incomplete forms
authored
36 <input type="hidden" name="token" value="<?php echo $token; ?>">
6420c58 Schema support for PostgreSQL
jakubvrana authored
37 </form>
Something went wrong with that request. Please try again.