/** * Allow execution of arbitrary SQL statements on a database */ function doDefault() { global $data, $misc; global $lang; if (!isset($_SESSION['sqlquery'])) { $_SESSION['sqlquery'] = ''; } $misc->printHeader($lang['strsql']); // Bring to the front always echo "<body onload=\"window.focus();\">\n"; $misc->printTabs($misc->getNavTabs('popup'), 'sql'); echo "<form action=\"sql.php\" method=\"post\" target=\"detail\">\n"; _printConnection(); echo "\n"; if (!isset($_REQUEST['search_path'])) { $_REQUEST['search_path'] = implode(',', $data->getSearchPath()); } echo "<p><label>"; $misc->printHelp($lang['strsearchpath'], 'pg.schema.search_path'); echo ": <input type=\"text\" name=\"search_path\" size=\"50\" value=\"", htmlspecialchars($_REQUEST['search_path']), "\" /></label></p>\n"; echo "<textarea style=\"width:98%;\" rows=\"10\" cols=\"50\" name=\"query\">", htmlspecialchars($_SESSION['sqlquery']), "</textarea>\n"; echo "<p><label for=\"paginate\"><input type=\"checkbox\" id=\"paginate\" name=\"paginate\"", isset($_REQUEST['paginate']) ? ' checked="checked"' : '', " /> {$lang['strpaginate']}</label> <span style='color: red'>Make sure this option is switched off for UPDATE queries</span></p>\n"; echo "<p><input type=\"submit\" value=\"{$lang['strexecute']}\" />\n"; echo "<input type=\"reset\" value=\"{$lang['strreset']}\" /></p>\n"; echo "</form>\n"; // Default focus $misc->setFocus('forms[0].query'); }
/** * Allow execution of arbitrary SQL statements on a database */ function doDefault() { global $data, $misc; global $lang; if (!isset($_SESSION['sqlquery'])) { $_SESSION['sqlquery'] = ''; } $misc->printHeader($lang['strsql']); // Bring to the front always echo "<body onload=\"window.focus();\">\n"; $misc->printTabs($misc->getNavTabs('popup'), 'sql'); echo "<form action=\"sql.php\" method=\"post\" enctype=\"multipart/form-data\" target=\"detail\">\n"; _printConnection(); echo "\n"; if (!isset($_REQUEST['search_path'])) { $_REQUEST['search_path'] = implode(',', $data->getSearchPath()); } echo "<p><label>"; $misc->printHelp($lang['strsearchpath'], 'pg.schema.search_path'); echo ": <input type=\"text\" name=\"search_path\" size=\"50\" value=\"", htmlspecialchars($_REQUEST['search_path']), "\" /></label></p>\n"; 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"' : '', " /> {$lang['strpaginate']}</label></p>\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"; // Default focus $misc->setFocus('forms[0].query'); }