summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJehan-Guillaume2015-02-12 11:38:57 +0000
committerJehan-Guillaume2015-02-12 11:38:57 +0000
commit319edabbbc91bcb8db69b5fe3f11414abe31142a (patch)
tree94fe91f7d529183e59df83ca44e94349fe644111
parent904a8266c39ea91f827750c03c1bb638641b8081 (diff)
Add file upload capability to SQL popup window
This feature was accessible only from the main SQL page, but not from the popup when upsing the top SQL link.
-rwxr-xr-xdatabase.php4
-rw-r--r--sqledit.php15
2 files changed, 15 insertions, 4 deletions
diff --git a/database.php b/database.php
index db45594f..cdd53c60 100755
--- a/database.php
+++ b/database.php
@@ -599,9 +599,9 @@
}
echo "<p><input type=\"checkbox\" id=\"paginate\" name=\"paginate\"", (isset($_REQUEST['paginate']) ? ' checked="checked"' : ''), " /><label for=\"paginate\">{$lang['strpaginate']}</label></p>\n";
- echo "<p><input type=\"submit\" name=\"execute\" value=\"{$lang['strexecute']}\" />\n";
+ echo "<p><input type=\"submit\" name=\"execute\" accesskey=\"r\" value=\"{$lang['strexecute']}\" />\n";
echo $misc->form;
- echo "<input type=\"reset\" value=\"{$lang['strreset']}\" /></p>\n";
+ echo "<input type=\"reset\" accesskey=\"q\" value=\"{$lang['strreset']}\" /></p>\n";
echo "</form>\n";
// Default focus
diff --git a/sqledit.php b/sqledit.php
index ac244821..124371d2 100644
--- a/sqledit.php
+++ b/sqledit.php
@@ -104,7 +104,7 @@
$misc->printTabs($misc->getNavTabs('popup'), 'sql');
- echo "<form action=\"sql.php\" method=\"post\" target=\"detail\">\n";
+ echo "<form action=\"sql.php\" method=\"post\" enctype=\"multipart/form-data\" target=\"detail\">\n";
_printConnection();
echo "\n";
if (!isset($_REQUEST['search_path']))
@@ -117,9 +117,20 @@
echo "<textarea style=\"width:98%;\" rows=\"10\" cols=\"50\" name=\"query\">",
htmlspecialchars($_SESSION['sqlquery']), "</textarea>\n";
+
+ // Check that file uploads are enabled
+ if (ini_get('file_uploads')) {
+ // Don't show upload option if max size of uploads is zero
+ $max_size = $misc->inisizeToBytes(ini_get('upload_max_filesize'));
+ if (is_double($max_size) && $max_size > 0) {
+ echo "<p><input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"{$max_size}\" />\n";
+ echo "<label for=\"script\">{$lang['struploadscript']}</label> <input id=\"script\" name=\"script\" type=\"file\" /></p>\n";
+ }
+ }
+
echo "<p><label for=\"paginate\"><input type=\"checkbox\" id=\"paginate\" name=\"paginate\"", (isset($_REQUEST['paginate']) ? ' checked="checked"' : ''), " />&nbsp;{$lang['strpaginate']}</label></p>\n";
- echo "<p><input type=\"submit\" accesskey=\"r\" value=\"{$lang['strexecute']}\" />\n";
+ echo "<p><input type=\"submit\" name=\"execute\" accesskey=\"r\" value=\"{$lang['strexecute']}\" />\n";
echo "<input type=\"reset\" accesskey=\"q\" value=\"{$lang['strreset']}\" /></p>\n";
echo "</form>\n";