Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 35 lines (31 sloc) 1.209 kb
f491811 Basic view
jakubvrana authored
1 <?php
79d1902 Substitute table name to $TABLE
jakubvrana authored
2 $TABLE = $_GET["view"];
0ed4c1d Use SHOW TABLES in navigation for performance
jakubvrana authored
3 $dropped = false;
4 if ($_POST && !$error) {
ef867e6 @vrana Trim identifiers (bug #3405309)
authored
5 $name = trim($_POST["name"]);
32d5b9c Inform about dropped routine, trigger and view
jakubvrana authored
6 $dropped = drop_create(
60c7ed9 @vrana MS SQL schema support
authored
7 "DROP VIEW " . table($TABLE),
ef867e6 @vrana Trim identifiers (bug #3405309)
authored
8 "CREATE VIEW " . table($name) . " AS\n$_POST[select]",
9 ($_POST["drop"] ? substr(ME, 0, -1) : ME . "table=" . urlencode($name)),
32d5b9c Inform about dropped routine, trigger and view
jakubvrana authored
10 lang('View has been dropped.'),
11 lang('View has been altered.'),
12 lang('View has been created.'),
13 $TABLE
14 );
0ed4c1d Use SHOW TABLES in navigation for performance
jakubvrana authored
15 }
36d6864 Whitespace
jakubvrana authored
16
7352c28 Replace strlen() by != ""
jakubvrana authored
17 page_header(($TABLE != "" ? lang('Alter view') : lang('Create view')), $error, array("table" => $TABLE), $TABLE);
0ed4c1d Use SHOW TABLES in navigation for performance
jakubvrana authored
18
b7e1cb0 @vrana Save bytes
authored
19 $row = $_POST;
20 if (!$row && $TABLE != "") {
79d1902 Substitute table name to $TABLE
jakubvrana authored
21 $row = view($TABLE);
22 $row["name"] = $TABLE;
0ed4c1d Use SHOW TABLES in navigation for performance
jakubvrana authored
23 }
24 ?>
25
26 <form action="" method="post">
faaa14e @vrana Print textarea as last field
authored
27 <p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64">
6fffbbd Disable spell checking in SQL textareas
jakubvrana authored
28 <p><?php textarea("select", $row["select"]); ?>
0ed4c1d Use SHOW TABLES in navigation for performance
jakubvrana authored
29 <p>
30 <?php if ($dropped) { // old view was dropped but new wasn't created ?><input type="hidden" name="dropped" value="1"><?php } ?>
31 <input type="submit" value="<?php echo lang('Save'); ?>">
52a67a9 @vrana Drop view from alter
authored
32 <?php if ($_GET["view"] != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
740ae10 @vrana Don't send incomplete forms
authored
33 <input type="hidden" name="token" value="<?php echo $token; ?>">
0ed4c1d Use SHOW TABLES in navigation for performance
jakubvrana authored
34 </form>
Something went wrong with that request. Please try again.