From b5af308b9daa4d3839e21aa9aa9ed0d7c3620fed Mon Sep 17 00:00:00 2001
From: Mitchell Rysavy
Date: Tue, 26 Nov 2024 02:49:39 +0000
Subject: [PATCH] Update sqlbuddy
---
htdocs/sqlbuddy/LICENSE | 36 +-
htdocs/sqlbuddy/README.md | 68 +
htdocs/sqlbuddy/ajaxcreatetable.php | 72 +-
htdocs/sqlbuddy/ajaxfulltext.php | 126 +-
htdocs/sqlbuddy/ajaximportfile.php | 338 +--
htdocs/sqlbuddy/ajaxquery.php | 72 +-
htdocs/sqlbuddy/ajaxsavecolumnedit.php | 74 +-
htdocs/sqlbuddy/ajaxsaveedit.php | 256 +-
htdocs/sqlbuddy/ajaxsaveuseredit.php | 258 +-
htdocs/sqlbuddy/browse.php | 138 +-
htdocs/sqlbuddy/config.php | 126 +-
htdocs/sqlbuddy/css/common.css | 1774 ++++++------
htdocs/sqlbuddy/css/navigation.css | 186 +-
htdocs/sqlbuddy/css/print.css | 52 +-
htdocs/sqlbuddy/dboverview.php | 1153 ++++----
htdocs/sqlbuddy/edit.php | 418 +--
htdocs/sqlbuddy/editcolumn.php | 376 +--
htdocs/sqlbuddy/edituser.php | 506 ++--
htdocs/sqlbuddy/export.php | 1352 ++++-----
htdocs/sqlbuddy/functions.php | 1125 ++++----
htdocs/sqlbuddy/home.php | 620 ++---
htdocs/sqlbuddy/import.php | 174 +-
htdocs/sqlbuddy/includes/browse.php | 802 +++---
.../sqlbuddy/includes/class/GetTextReader.php | 154 +-
htdocs/sqlbuddy/includes/class/Sql-php4.php | 846 +++---
htdocs/sqlbuddy/includes/class/Sql.php | 998 +++----
htdocs/sqlbuddy/includes/types.php | 158 +-
htdocs/sqlbuddy/index.php | 42 +-
htdocs/sqlbuddy/insert.php | 496 ++--
htdocs/sqlbuddy/js/core.js | 1676 +++++------
htdocs/sqlbuddy/js/helpers.js | 2478 ++++++++---------
htdocs/sqlbuddy/js/mootools-1.2-core.js | 482 ++--
htdocs/sqlbuddy/js/movement.js | 410 +--
htdocs/sqlbuddy/locale/ar_DZ.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/bg_BG.pot | 667 +++++
htdocs/sqlbuddy/locale/bn_BD.pot | 667 +++++
htdocs/sqlbuddy/locale/ca_AD.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/cs_CZ.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/da_DK.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/de_DE.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/el_GR.pot | 667 +++++
htdocs/sqlbuddy/locale/en_US.pot | 1329 ++++-----
htdocs/sqlbuddy/locale/eo_EO.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/es_AR.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/es_ES.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/et_EE.pot | 667 +++++
htdocs/sqlbuddy/locale/fa_IR.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/fi_FI.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/fr_FR.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/gl_ES.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/he_IL.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/hr_HR.pot | 667 +++++
htdocs/sqlbuddy/locale/hu_HU.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/id_ID.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/it_IT.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/ja_JP.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/ko_KR.pot | 667 +++++
htdocs/sqlbuddy/locale/lo_LA.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/lt_LT.pot | 667 +++++
htdocs/sqlbuddy/locale/lv_LV.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/ms_ID.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/nl_NL.pot | 1333 ++++-----
htdocs/sqlbuddy/locale/no_NO.pot | 667 +++++
htdocs/sqlbuddy/locale/pl_PL.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/pt_BR.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/pt_PT.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/ro_RO.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/ru_RU.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/sk_SK.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/sl_SL.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/sp_RS.pot | 1334 ++++-----
htdocs/sqlbuddy/locale/sq_AL.pot | 668 +++++
htdocs/sqlbuddy/locale/sr_RS.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/sv_SE.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/th_TH.pot | 667 +++++
htdocs/sqlbuddy/locale/tl_PH.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/tr_TR.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/uk_UA.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/vi_VN.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/zh_CN.pot | 1331 ++++-----
htdocs/sqlbuddy/locale/zh_TW.pot | 1331 ++++-----
htdocs/sqlbuddy/login.php | 532 ++--
htdocs/sqlbuddy/logout.php | 80 +-
htdocs/sqlbuddy/query.php | 154 +-
htdocs/sqlbuddy/serve.php | 230 +-
htdocs/sqlbuddy/structure.php | 1548 +++++-----
htdocs/sqlbuddy/themes/bittersweet/css/ie.css | 86 +-
.../sqlbuddy/themes/bittersweet/css/main.css | 308 +-
htdocs/sqlbuddy/themes/classic/css/ie.css | 60 +-
htdocs/sqlbuddy/themes/classic/css/main.css | 220 +-
htdocs/sqlbuddy/users.php | 878 +++---
91 files changed, 43027 insertions(+), 36163 deletions(-)
create mode 100644 htdocs/sqlbuddy/README.md
create mode 100644 htdocs/sqlbuddy/locale/bg_BG.pot
create mode 100644 htdocs/sqlbuddy/locale/bn_BD.pot
create mode 100644 htdocs/sqlbuddy/locale/el_GR.pot
create mode 100644 htdocs/sqlbuddy/locale/et_EE.pot
create mode 100644 htdocs/sqlbuddy/locale/hr_HR.pot
create mode 100644 htdocs/sqlbuddy/locale/ko_KR.pot
create mode 100644 htdocs/sqlbuddy/locale/lt_LT.pot
create mode 100644 htdocs/sqlbuddy/locale/no_NO.pot
create mode 100644 htdocs/sqlbuddy/locale/sq_AL.pot
create mode 100644 htdocs/sqlbuddy/locale/th_TH.pot
diff --git a/htdocs/sqlbuddy/LICENSE b/htdocs/sqlbuddy/LICENSE
index c999e6d2c..69acd93f3 100755
--- a/htdocs/sqlbuddy/LICENSE
+++ b/htdocs/sqlbuddy/LICENSE
@@ -1,19 +1,19 @@
-Copyright (c) 2008 Calvin Lough
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+Copyright (c) 2008 Calvin Lough
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/README.md b/htdocs/sqlbuddy/README.md
new file mode 100644
index 000000000..0a5c49159
--- /dev/null
+++ b/htdocs/sqlbuddy/README.md
@@ -0,0 +1,68 @@
+| :warning: SQL Buddy is no longer actively maintained. |
+|-------------------------------------------------------------------|
+
+This software is still free to use under the license provided below, but users should be aware
+that it is not currently maintained. No additional releases, including security releases, will
+be made available. Caveat emptor.
+
+
+SQL Buddy
+===========
+
+SQL Buddy is a phpMyAdmin alternative with a focus on usability.
+
+![Screenshot 1](https://raw.github.com/calvinlough/sqlbuddy/gh-pages/images/screenshot1.png)
+![Screenshot 2](https://raw.github.com/calvinlough/sqlbuddy/gh-pages/images/screenshot2.png)
+![Screenshot 3](https://raw.github.com/calvinlough/sqlbuddy/gh-pages/images/screenshot3.png)
+
+## Features
+
+* Create and drop databases and tables
+* View, edit, insert and delete table rows
+* Execute custom SQL and view the output
+* Import and export databases and tables to SQL and CSV formats
+* Add, edit and delete MySQL users
+* Ships with 47 translations (including Esperanto!)
+
+## Download
+
+**[Download v1.3.3](https://github.com/calvinlough/sqlbuddy/raw/gh-pages/sqlbuddy.zip)**
+
+## Installation
+
+* Download the file above and unzip it
+* Upload the sqlbuddy folder to your web server
+* Point your browser to the sqlbuddy folder
+* Log in using your existing MySQL credentials
+
+## Requirements
+
+* PHP 4.3+
+* MySQL 4+
+
+## Help
+
+If you need help, a forum is available at http://groups.google.com/group/sql-buddy/topics
+
+## License
+
+Copyright © 2013 Calvin Lough
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/htdocs/sqlbuddy/ajaxcreatetable.php b/htdocs/sqlbuddy/ajaxcreatetable.php
index 12f6ffb3a..b2809fe90 100755
--- a/htdocs/sqlbuddy/ajaxcreatetable.php
+++ b/htdocs/sqlbuddy/ajaxcreatetable.php
@@ -1,37 +1,37 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-if (isset($db))
- $conn->selectDB($db);
-
-if (isset($_POST['query'])) {
-
- $queryList = splitQueryText($_POST['query']);
-
- foreach ($queryList as $query) {
- $sql = $conn->query($query) or ($dbError = $conn->error());
- }
-
- if (isset($dbError)) {
- echo $dbError;
- }
-
-}
-
+
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+if (isset($db))
+ $conn->selectDB($db);
+
+if (isset($_POST['query'])) {
+
+ $queryList = splitQueryText($_POST['query']);
+
+ foreach ($queryList as $query) {
+ $sql = $conn->query($query) or ($dbError = $conn->error());
+ }
+
+ if (isset($dbError)) {
+ echo $dbError;
+ }
+
+}
+
?>
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/ajaxfulltext.php b/htdocs/sqlbuddy/ajaxfulltext.php
index eedebbeac..4a18b3195 100755
--- a/htdocs/sqlbuddy/ajaxfulltext.php
+++ b/htdocs/sqlbuddy/ajaxfulltext.php
@@ -1,64 +1,64 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-if (isset($db))
- $conn->selectDB($db);
-
-if (isset($_POST['query'])) {
-
- $queryList = splitQueryText($_POST['query']);
-
- foreach ($queryList as $query) {
- $sql = $conn->query($query);
- }
-}
-
-if ($conn->getAdapter() == "mysql") {
- $structureSql = $conn->describeTable($table);
-
- while ($structureRow = $conn->fetchAssoc($structureSql)) {
- $types[$structureRow['Field']] = $structureRow['Type'];
- }
-}
-
-if ($conn->isResultSet($sql)) {
-
- $row = $conn->fetchAssoc($sql);
-
- foreach ($row as $key => $value) {
- echo "" . $key . "
";
- echo "";
-
- $curtype = $types[$key];
-
- if (strpos(" ", $curtype) > 0) {
- $curtype = substr($curtype, 0, strpos(" ", $curtype));
- }
-
- if ($value && isset($binaryDTs) && in_array($curtype, $binaryDTs)) {
- echo '(' . __("binary data") . ') ';
- } else {
- echo nl2br(htmlentities($value, ENT_QUOTES, 'UTF-8'));
- }
-
- echo "
";
- }
-}
-
+
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+if (isset($db))
+ $conn->selectDB($db);
+
+if (isset($_POST['query'])) {
+
+ $queryList = splitQueryText($_POST['query']);
+
+ foreach ($queryList as $query) {
+ $sql = $conn->query($query);
+ }
+}
+
+if ($conn->getAdapter() == "mysql") {
+ $structureSql = $conn->describeTable($table);
+
+ while ($structureRow = $conn->fetchAssoc($structureSql)) {
+ $types[$structureRow['Field']] = $structureRow['Type'];
+ }
+}
+
+if ($conn->isResultSet($sql)) {
+
+ $row = $conn->fetchAssoc($sql);
+
+ foreach ($row as $key => $value) {
+ echo "" . $key . "
";
+ echo "";
+
+ $curtype = $types[$key];
+
+ if (strpos(" ", $curtype) > 0) {
+ $curtype = substr($curtype, 0, strpos(" ", $curtype));
+ }
+
+ if ($value && isset($binaryDTs) && in_array($curtype, $binaryDTs)) {
+ echo '(' . __("binary data") . ') ';
+ } else {
+ echo nl2br(htmlentities($value, ENT_QUOTES, 'UTF-8'));
+ }
+
+ echo "
";
+ }
+}
+
?>
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/ajaximportfile.php b/htdocs/sqlbuddy/ajaximportfile.php
index 816fefeb3..7171d6c27 100755
--- a/htdocs/sqlbuddy/ajaximportfile.php
+++ b/htdocs/sqlbuddy/ajaximportfile.php
@@ -1,170 +1,170 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-if (isset($db))
- $conn->selectDB($db);
-
-function stripCommentLines($in) {
- if (substr($in, 0, 2) == "--")
- $in = '';
-
- return $in;
-}
-
-if (isset($_POST) || isset($_FILES)) {
-
- if (isset($_FILES['INPUTFILE']['tmp_name']))
- $file = $_FILES['INPUTFILE']['tmp_name'];
-
- if (isset($_POST['FORMAT']))
- $format = $_POST['FORMAT'];
-
- if (!(isset($format) && $format == "CSV"))
- $format = "SQL";
-
- if (isset($_POST['IGNOREFIRST']))
- $ignoreFirst = $_POST['IGNOREFIRST'];
-
- $first = true;
-
- // for csv
- if (isset($format) && $format == "CSV" && isset($table)) {
- $columnCount = 0;
-
- $structureSQL = $conn->describeTable($table);
-
- if ($conn->isResultSet($structureSQL)) {
- while ($structureRow = $conn->fetchAssoc($structureSQL)) {
- $columnCount++;
- }
- }
- }
-
- $insertCount = 0;
- $skipCount = 0;
-
- if (isset($file) && is_uploaded_file($file)) {
- if (isset($format) && $format == "SQL") {
- $lines = file($file);
-
- // the file() function doesn't handle mac line endings correctly
- if (sizeof($lines) == 1 && strpos($lines[0], "\r") > 0) {
- $lines = explode("\r", $lines[0]);
- }
-
- $commentFree = array_map("stripCommentLines", $lines);
-
- $contents = trim(implode('', $commentFree));
-
- $statements = splitQueryText($contents);
- } else {
- $statements = file($file);
-
- // see previous comment
- if (sizeof($statements) == 1 && strpos($statements[0], "\r") > 0) {
- $statements = explode("\r", $statements[0]);
- }
- }
-
- foreach ($statements as $statement) {
- $statement = trim($statement);
-
- if ($statement) {
- if (isset($format) && $format == "SQL") {
- $importQuery = $conn->query($statement) or ($dbErrors[] = $conn->error());
-
- $affected = (int)($conn->affectedRows($importQuery));
- $insertCount += $affected;
- } else if (isset($format) && $format == "CSV" && isset($table)) {
- if (!(isset($ignoreFirst) && $first)) {
- preg_match_all('/"(([^"]|"")*)"/i', $statement, $matches);
-
- $rawValues = $matches[1];
-
- for ($i=0; $iescapeString($rawValues[$i]);
- }
-
- $values = implode("','", $rawValues);
-
- // make sure that the counts match up
- if (sizeof($rawValues) == $columnCount) {
-
- if ($conn->getAdapter() == "sqlite")
- $importQuery = $conn->query("INSERT INTO '$table' VALUES ('$values')") or ($dbErrors[] = $conn->error());
- else
- $importQuery = $conn->query("INSERT INTO `$table` VALUES ('$values')") or ($dbErrors[] = $conn->error());
-
- $affected = (int)($conn->affectedRows($importQuery));
-
- $insertCount += $affected;
- } else {
- $skipCount++;
- }
- }
- $first = false;
- }
- }
- }
- }
-
- $message = "";
-
- if (!isset($statements)) {
- $message .= __("Either the file could not be read or it was empty") . " ";
- } else if ($format == "SQL") {
- $message .= sprintf(__p("%d statement was executed from the file", "%d statements were executed from the file", $insertCount), $insertCount) . ". ";
- } else if ($format == "CSV") {
- if (isset($insertCount) && $insertCount > 0) {
- $message .= sprintf(__p("%d row was inserted into the database from the file", "%d rows were inserted into the database from the file", $insertCount), $insertCount) . ". ";
- }
- if (isset($skipCount) && $skipCount > 0) {
- $message .= sprintf(__p("%d row had to be skipped because the number of values was incorrect", "%d rows had to be skipped because the number of values was incorrect", $skipCount), $skipCount) . ". ";
- }
- }
-
- if (isset($dbErrors)) {
- $message .= __("The following errors were reported") . ": ";
- foreach ($dbErrors as $merr) {
- $message .= " - " . $merr . " ";
- }
- }
-
- ?>
-
-
-
-
-
-
-
-
-
-
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+if (isset($db))
+ $conn->selectDB($db);
+
+function stripCommentLines($in) {
+ if (substr($in, 0, 2) == "--")
+ $in = '';
+
+ return $in;
+}
+
+if (isset($_POST) || isset($_FILES)) {
+
+ if (isset($_FILES['INPUTFILE']['tmp_name']))
+ $file = $_FILES['INPUTFILE']['tmp_name'];
+
+ if (isset($_POST['FORMAT']))
+ $format = $_POST['FORMAT'];
+
+ if (!(isset($format) && $format == "CSV"))
+ $format = "SQL";
+
+ if (isset($_POST['IGNOREFIRST']))
+ $ignoreFirst = $_POST['IGNOREFIRST'];
+
+ $first = true;
+
+ // for csv
+ if (isset($format) && $format == "CSV" && isset($table)) {
+ $columnCount = 0;
+
+ $structureSQL = $conn->describeTable($table);
+
+ if ($conn->isResultSet($structureSQL)) {
+ while ($structureRow = $conn->fetchAssoc($structureSQL)) {
+ $columnCount++;
+ }
+ }
+ }
+
+ $insertCount = 0;
+ $skipCount = 0;
+
+ if (isset($file) && is_uploaded_file($file)) {
+ if (isset($format) && $format == "SQL") {
+ $lines = file($file);
+
+ // the file() function doesn't handle mac line endings correctly
+ if (sizeof($lines) == 1 && strpos($lines[0], "\r") > 0) {
+ $lines = explode("\r", $lines[0]);
+ }
+
+ $commentFree = array_map("stripCommentLines", $lines);
+
+ $contents = trim(implode('', $commentFree));
+
+ $statements = splitQueryText($contents);
+ } else {
+ $statements = file($file);
+
+ // see previous comment
+ if (sizeof($statements) == 1 && strpos($statements[0], "\r") > 0) {
+ $statements = explode("\r", $statements[0]);
+ }
+ }
+
+ foreach ($statements as $statement) {
+ $statement = trim($statement);
+
+ if ($statement) {
+ if (isset($format) && $format == "SQL") {
+ $importQuery = $conn->query($statement) or ($dbErrors[] = $conn->error());
+
+ $affected = (int)($conn->affectedRows($importQuery));
+ $insertCount += $affected;
+ } else if (isset($format) && $format == "CSV" && isset($table)) {
+ if (!(isset($ignoreFirst) && $first)) {
+ preg_match_all('/"(([^"]|"")*)"/i', $statement, $matches);
+
+ $rawValues = $matches[1];
+
+ for ($i=0; $iescapeString($rawValues[$i]);
+ }
+
+ $values = implode("','", $rawValues);
+
+ // make sure that the counts match up
+ if (sizeof($rawValues) == $columnCount) {
+
+ if ($conn->getAdapter() == "sqlite")
+ $importQuery = $conn->query("INSERT INTO '$table' VALUES ('$values')") or ($dbErrors[] = $conn->error());
+ else
+ $importQuery = $conn->query("INSERT INTO `$table` VALUES ('$values')") or ($dbErrors[] = $conn->error());
+
+ $affected = (int)($conn->affectedRows($importQuery));
+
+ $insertCount += $affected;
+ } else {
+ $skipCount++;
+ }
+ }
+ $first = false;
+ }
+ }
+ }
+ }
+
+ $message = "";
+
+ if (!isset($statements)) {
+ $message .= __("Either the file could not be read or it was empty") . " ";
+ } else if ($format == "SQL") {
+ $message .= sprintf(__p("%d statement was executed from the file", "%d statements were executed from the file", $insertCount), $insertCount) . ". ";
+ } else if ($format == "CSV") {
+ if (isset($insertCount) && $insertCount > 0) {
+ $message .= sprintf(__p("%d row was inserted into the database from the file", "%d rows were inserted into the database from the file", $insertCount), $insertCount) . ". ";
+ }
+ if (isset($skipCount) && $skipCount > 0) {
+ $message .= sprintf(__p("%d row had to be skipped because the number of values was incorrect", "%d rows had to be skipped because the number of values was incorrect", $skipCount), $skipCount) . ". ";
+ }
+ }
+
+ if (isset($dbErrors)) {
+ $message .= __("The following errors were reported") . ": ";
+ foreach ($dbErrors as $merr) {
+ $message .= " - " . $merr . " ";
+ }
+ }
+
+ ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/ajaxquery.php b/htdocs/sqlbuddy/ajaxquery.php
index 23ced5703..f318eb916 100755
--- a/htdocs/sqlbuddy/ajaxquery.php
+++ b/htdocs/sqlbuddy/ajaxquery.php
@@ -1,37 +1,37 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-if (isset($db))
- $conn->selectDB($db);
-
-if (isset($_POST['query'])) {
- $queryList = splitQueryText($_POST['query']);
-
- foreach ($queryList as $query) {
- $sql = $conn->query($query);
- }
-}
-
-//return the first field from the first row
-if (!isset($_POST['silent']) && $conn->isResultSet($sql)) {
- $row = $conn->fetchArray($sql);
- echo nl2br(htmlentities($row[0], ENT_QUOTES, 'UTF-8'));
-}
-
+
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+if (isset($db))
+ $conn->selectDB($db);
+
+if (isset($_POST['query'])) {
+ $queryList = splitQueryText($_POST['query']);
+
+ foreach ($queryList as $query) {
+ $sql = $conn->query($query);
+ }
+}
+
+//return the first field from the first row
+if (!isset($_POST['silent']) && $conn->isResultSet($sql)) {
+ $row = $conn->fetchArray($sql);
+ echo nl2br(htmlentities($row[0], ENT_QUOTES, 'UTF-8'));
+}
+
?>
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/ajaxsavecolumnedit.php b/htdocs/sqlbuddy/ajaxsavecolumnedit.php
index 42a688c55..4b50dfe51 100755
--- a/htdocs/sqlbuddy/ajaxsavecolumnedit.php
+++ b/htdocs/sqlbuddy/ajaxsavecolumnedit.php
@@ -1,38 +1,38 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-if (isset($db))
- $conn->selectDB($db);
-
-if (isset($_POST['runQuery'])) {
- $query = $_POST['runQuery'];
-
- $conn->query($query) or ($dbError = $conn->error());
-
- echo "{\n";
- echo " \"formupdate\": \"" . $_GET['form'] . "\",\n";
- echo " \"errormess\": \"";
- if (isset($dbError))
- echo $dbError;
- echo "\"\n";
- echo '}';
-
-}
-
+
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+if (isset($db))
+ $conn->selectDB($db);
+
+if (isset($_POST['runQuery'])) {
+ $query = $_POST['runQuery'];
+
+ $conn->query($query) or ($dbError = $conn->error());
+
+ echo "{\n";
+ echo " \"formupdate\": \"" . $_GET['form'] . "\",\n";
+ echo " \"errormess\": \"";
+ if (isset($dbError))
+ echo $dbError;
+ echo "\"\n";
+ echo '}';
+
+}
+
?>
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/ajaxsaveedit.php b/htdocs/sqlbuddy/ajaxsaveedit.php
index 0af82d31f..632e61d1c 100755
--- a/htdocs/sqlbuddy/ajaxsaveedit.php
+++ b/htdocs/sqlbuddy/ajaxsaveedit.php
@@ -1,130 +1,128 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-if (isset($db))
- $conn->selectDB($db);
-
-if ($_POST && isset($table)) {
-
- $insertChoice = "";
-
- if (isset($_POST['SB_INSERT_CHOICE'])) {
- $insertChoice = $_POST['SB_INSERT_CHOICE'];
- }
-
- $structureSql = $conn->describeTable($table);
-
- if ($conn->getAdapter() == "mysql") {
- while ($structureRow = $conn->fetchAssoc($structureSql)) {
- $pairs[$structureRow['Field']] = '';
- $types[$structureRow['Field']] = $structureRow['Type'];
- $nulls[$structureRow['Field']] = (isset($structureRow['Null'])) ? $structureRow['Null'] : "YES";
- }
- } else if ($conn->getAdapter() == "sqlite") {
- foreach ($structureRow as $column) {
- $pairs[$column[0]] = '';
- }
- }
-
- foreach ($_POST as $key=>$value) {
- if ($key != "SB_INSERT_CHOICE") {
- if (is_array($value)) {
- $value = implode(",", $value);
- }
-
- $pairs[$key] = $conn->escapeString($value);
- }
- }
-
- if (isset($pairs)) {
-
- if ($insertChoice != "INSERT") {
- $updates = "";
-
- foreach ($pairs as $keyname=>$value) {
- if ($conn->getAdapter() == "mysql") {
- if (isset($types) && substr($value, 0, 2) == "0x" && isset($binaryDTs) && in_array($types[$keyname], $binaryDTs)) {
- $updates .= "`" . $keyname . "`=" . $value . ",";
- } else if (!$value && $nulls[$keyname] == "YES") {
- $updates .= "`" . $keyname . "`=NULL,";
- } else {
- $updates .= "`" . $keyname . "`='" . $value . "',";
- }
- } else if ($conn->getAdapter() == "sqlite") {
- $updates .= "'" . $keyname . "'='" . $value . "',";
- }
- }
-
- $updates = substr($updates, 0, -1);
-
- if (isset($_GET['queryPart']))
- $queryPart = $_GET['queryPart'];
- else
- $queryPart = "";
-
- if ($conn->getAdapter() == "mysql") {
- $query = "UPDATE `$table` SET " . $updates . " " . $queryPart;
- } else if ($conn->getAdapter() == "sqlite") {
- $query = "UPDATE '$table' SET " . $updates . " " . $queryPart;
- }
-
- } else {
- $columns = "";
- $values = "";
-
- foreach ($pairs as $keyname=>$value) {
-
- if ($conn->getAdapter() == "mysql") {
- $columns .= "`" . $keyname . "`,";
- } else if ($conn->getAdapter() == "sqlite") {
- $columns .= "'" . $keyname . "',";
- }
-
- if (isset($types) && substr($value, 0, 2) == "0x" && isset($binaryDTs) && in_array($types[$keyname], $binaryDTs)) {
- $values .= $value . ",";
- } else {
- $values .= "'" . $value . "',";
- }
-
- }
-
- $columns = substr($columns, 0, -1);
- $values = substr($values, 0, -1);
-
- if ($conn->getAdapter() == "mysql") {
- $query = "INSERT INTO `$table` ($columns) VALUES ($values)";
- } else if ($conn->getAdapter() == "sqlite") {
- $query = "INSERT INTO '$table' ($columns) VALUES ($values)";
- }
- }
-
- $conn->query($query) or ($dbError = $conn->error());
-
- echo "{\n";
- echo " \"formupdate\": \"" . $_GET['form'] . "\",\n";
- echo " \"errormess\": \"";
- if (isset($dbError))
- echo $dbError;
- echo "\"\n";
- echo '}';
-
- }
-}
-
+
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+if (isset($db))
+ $conn->selectDB($db);
+
+if ($_POST && isset($table)) {
+
+ $insertChoice = "";
+
+ if (isset($_POST['SB_INSERT_CHOICE'])) {
+ $insertChoice = $_POST['SB_INSERT_CHOICE'];
+ }
+
+ $structureSql = $conn->describeTable($table);
+
+ if ($conn->getAdapter() == "mysql") {
+ while ($structureRow = $conn->fetchAssoc($structureSql)) {
+ $pairs[$structureRow['Field']] = '';
+ $types[$structureRow['Field']] = $structureRow['Type'];
+ $nulls[$structureRow['Field']] = (isset($structureRow['Null'])) ? $structureRow['Null'] : "YES";
+ }
+ } else if ($conn->getAdapter() == "sqlite") {
+ foreach ($structureRow as $column) {
+ $pairs[$column[0]] = '';
+ }
+ }
+
+ foreach ($_POST as $key=>$value) {
+ if ($key != "SB_INSERT_CHOICE") {
+ if (is_array($value)) {
+ $value = implode(",", $value);
+ }
+
+ $pairs[$key] = $conn->escapeString($value);
+ }
+ }
+
+ if (isset($pairs)) {
+
+ if ($insertChoice != "INSERT") {
+ $updates = "";
+
+ foreach ($pairs as $keyname=>$value) {
+ if ($conn->getAdapter() == "mysql") {
+ if (isset($types) && substr($value, 0, 2) == "0x" && isset($binaryDTs) && in_array($types[$keyname], $binaryDTs)) {
+ $updates .= "`" . $keyname . "`=" . $value . ",";
+ } else if (!$value && !($value != '' && (int)$value == 0) && $nulls[$keyname] == "YES") {
+ $updates .= "`" . $keyname . "`=NULL,";
+ } else {
+ $updates .= "`" . $keyname . "`='" . $value . "',";
+ }
+ }
+ }
+
+ $updates = substr($updates, 0, -1);
+
+ if (isset($_GET['queryPart']))
+ $queryPart = $_GET['queryPart'];
+ else
+ $queryPart = "";
+
+ if ($conn->getAdapter() == "mysql") {
+ $query = "UPDATE `$table` SET " . $updates . " " . $queryPart;
+ } else if ($conn->getAdapter() == "sqlite") {
+ $query = "UPDATE '$table' SET " . $updates . " " . $queryPart;
+ }
+
+ } else {
+ $columns = "";
+ $values = "";
+
+ foreach ($pairs as $keyname=>$value) {
+
+ if ($conn->getAdapter() == "mysql") {
+ $columns .= "`" . $keyname . "`,";
+ } else if ($conn->getAdapter() == "sqlite") {
+ $columns .= "'" . $keyname . "',";
+ }
+
+ if (isset($types) && substr($value, 0, 2) == "0x" && isset($binaryDTs) && in_array($types[$keyname], $binaryDTs)) {
+ $values .= $value . ",";
+ } else {
+ $values .= "'" . $value . "',";
+ }
+
+ }
+
+ $columns = substr($columns, 0, -1);
+ $values = substr($values, 0, -1);
+
+ if ($conn->getAdapter() == "mysql") {
+ $query = "INSERT INTO `$table` ($columns) VALUES ($values)";
+ } else if ($conn->getAdapter() == "sqlite") {
+ $query = "INSERT INTO '$table' ($columns) VALUES ($values)";
+ }
+ }
+
+ $conn->query($query) or ($dbError = $conn->error());
+
+ echo "{\n";
+ echo " \"formupdate\": \"" . $_GET['form'] . "\",\n";
+ echo " \"errormess\": \"";
+ if (isset($dbError))
+ echo $dbError;
+ echo "\"\n";
+ echo '}';
+
+ }
+}
+
?>
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/ajaxsaveuseredit.php b/htdocs/sqlbuddy/ajaxsaveuseredit.php
index 76b024e0d..e56f2a98f 100755
--- a/htdocs/sqlbuddy/ajaxsaveuseredit.php
+++ b/htdocs/sqlbuddy/ajaxsaveuseredit.php
@@ -1,130 +1,130 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-$conn->selectDB("mysql");
-
-function removeAdminPrivs($priv) {
- if ($priv == "FILE" || $priv == "PROCESS" || $priv == "RELOAD" || $priv == "SHUTDOWN" || $priv == "SUPER")
- return false;
- else
- return true;
-}
-
-if (isset($_GET['user']))
- $user = $_GET['user'];
-
-if (isset($_POST['NEWPASS']))
- $newPass = $_POST['NEWPASS'];
-
-if (isset($_POST['CHOICE']))
- $choice = $_POST['CHOICE'];
-
-if (isset($_POST['ACCESSLEVEL']))
- $accessLevel = $_POST['ACCESSLEVEL'];
-else
- $accessLevel = "GLOBAL";
-
-if ($accessLevel != "LIMITED")
- $accessLevel = "GLOBAL";
-
-if (isset($_POST['DBLIST']))
- $dbList = $_POST['DBLIST'];
-else
- $dbList = array();
-
-if (isset($_POST['PRIVILEGES']))
- $privileges = $_POST['PRIVILEGES'];
-else
- $privileges = array();
-
-if (isset($_POST['GRANTOPTION']))
- $grantOption = $_POST['GRANTOPTION'];
-
-if (isset($user) && ($accessLevel == "GLOBAL" || ($accessLevel == "LIMITED" && sizeof($dbList) > 0))) {
-
- if ($choice == "ALL") {
- $privList = "ALL";
- } else {
- if (isset($privileges) && count($privileges) > 0)
- $privList = implode(", ", $privileges);
- else
- $privList = "USAGE";
-
- if (sizeof($privileges) > 0) {
- if ($accessLevel == "LIMITED") {
- $privileges = array_filter($privileges, "removeAdminPrivs");
- }
-
- $privList = implode(", ", $privileges);
- } else {
- $privList = "USAGE";
- }
-
- }
-
- $split = explode("@", $user);
-
- if (isset($split[0]))
- $name = $split[0];
-
- if (isset($split[1]))
- $host = $split[1];
-
- if (isset($name) && isset($host)) {
- $user = "'" . $name . "'@'" . $host . "'";
-
- if ($accessLevel == "LIMITED") {
- $conn->query("DELETE FROM `db` WHERE `User`='$name' AND `Host`='$host'");
-
- foreach ($dbList as $theDb) {
- $query = "GRANT " . $privList . " ON `$theDb`.* TO " . $user;
-
- if (isset($grantOption))
- $query .= " WITH GRANT OPTION";
-
- $conn->query($query) or ($dbError = $conn->error());
- }
- } else {
- $conn->query("REVOKE ALL PRIVILEGES ON *.* FROM " . $user);
- $conn->query("REVOKE GRANT OPTION ON *.* FROM " . $user);
-
- $query = "GRANT " . $privList . " ON *.* TO " . $user;
-
- if (isset($grantOption))
- $query .= " WITH GRANT OPTION";
-
- $conn->query($query) or ($dbError = $conn->error());
- }
-
- if (isset($newPass))
- $conn->query("SET PASSWORD FOR '$name'@'$host' = PASSWORD('$newPass')") or ($dbError = $conn->error());
-
- $conn->query("FLUSH PRIVILEGES") or ($dbError = $conn->error());
-
- echo "{\n";
- echo " \"formupdate\": \"" . $_GET['form'] . "\",\n";
- echo " \"errormess\": \"";
- if (isset($dbError))
- echo $dbError;
- echo "\"\n";
- echo '}';
- }
-}
-
+
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+$conn->selectDB("mysql");
+
+function removeAdminPrivs($priv) {
+ if ($priv == "FILE" || $priv == "PROCESS" || $priv == "RELOAD" || $priv == "SHUTDOWN" || $priv == "SUPER")
+ return false;
+ else
+ return true;
+}
+
+if (isset($_GET['user']))
+ $user = $_GET['user'];
+
+if (isset($_POST['NEWPASS']))
+ $newPass = $_POST['NEWPASS'];
+
+if (isset($_POST['CHOICE']))
+ $choice = $_POST['CHOICE'];
+
+if (isset($_POST['ACCESSLEVEL']))
+ $accessLevel = $_POST['ACCESSLEVEL'];
+else
+ $accessLevel = "GLOBAL";
+
+if ($accessLevel != "LIMITED")
+ $accessLevel = "GLOBAL";
+
+if (isset($_POST['DBLIST']))
+ $dbList = $_POST['DBLIST'];
+else
+ $dbList = array();
+
+if (isset($_POST['PRIVILEGES']))
+ $privileges = $_POST['PRIVILEGES'];
+else
+ $privileges = array();
+
+if (isset($_POST['GRANTOPTION']))
+ $grantOption = $_POST['GRANTOPTION'];
+
+if (isset($user) && ($accessLevel == "GLOBAL" || ($accessLevel == "LIMITED" && sizeof($dbList) > 0))) {
+
+ if ($choice == "ALL") {
+ $privList = "ALL";
+ } else {
+ if (isset($privileges) && count($privileges) > 0)
+ $privList = implode(", ", $privileges);
+ else
+ $privList = "USAGE";
+
+ if (sizeof($privileges) > 0) {
+ if ($accessLevel == "LIMITED") {
+ $privileges = array_filter($privileges, "removeAdminPrivs");
+ }
+
+ $privList = implode(", ", $privileges);
+ } else {
+ $privList = "USAGE";
+ }
+
+ }
+
+ $split = explode("@", $user);
+
+ if (isset($split[0]))
+ $name = $split[0];
+
+ if (isset($split[1]))
+ $host = $split[1];
+
+ if (isset($name) && isset($host)) {
+ $user = "'" . $name . "'@'" . $host . "'";
+
+ if ($accessLevel == "LIMITED") {
+ $conn->query("DELETE FROM `db` WHERE `User`='$name' AND `Host`='$host'");
+
+ foreach ($dbList as $theDb) {
+ $query = "GRANT " . $privList . " ON `$theDb`.* TO " . $user;
+
+ if (isset($grantOption))
+ $query .= " WITH GRANT OPTION";
+
+ $conn->query($query) or ($dbError = $conn->error());
+ }
+ } else {
+ $conn->query("REVOKE ALL PRIVILEGES ON *.* FROM " . $user);
+ $conn->query("REVOKE GRANT OPTION ON *.* FROM " . $user);
+
+ $query = "GRANT " . $privList . " ON *.* TO " . $user;
+
+ if (isset($grantOption))
+ $query .= " WITH GRANT OPTION";
+
+ $conn->query($query) or ($dbError = $conn->error());
+ }
+
+ if (isset($newPass))
+ $conn->query("SET PASSWORD FOR '$name'@'$host' = PASSWORD('$newPass')") or ($dbError = $conn->error());
+
+ $conn->query("FLUSH PRIVILEGES") or ($dbError = $conn->error());
+
+ echo "{\n";
+ echo " \"formupdate\": \"" . $_GET['form'] . "\",\n";
+ echo " \"errormess\": \"";
+ if (isset($dbError))
+ echo $dbError;
+ echo "\"\n";
+ echo '}';
+ }
+}
+
?>
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/browse.php b/htdocs/sqlbuddy/browse.php
index 99892b4d5..50e19e888 100755
--- a/htdocs/sqlbuddy/browse.php
+++ b/htdocs/sqlbuddy/browse.php
@@ -1,70 +1,70 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-requireDatabaseAndTableBeDefined();
-
-if (isset($db))
- $conn->selectDB($db);
-
-//run delete queries
-
-if (isset($_POST['runQuery'])) {
- $runQuery = $_POST['runQuery'];
-
- $queryList = splitQueryText($runQuery);
- foreach ($queryList as $query) {
- $conn->query($query);
- }
-}
-
-if ($conn->getAdapter() == "sqlite") {
- $query = "SELECT * FROM '$table'";
-} else {
- $query = "SELECT * FROM `$table`";
-}
-
-$queryTable = $table;
-
-if (isset($_POST['s']))
- $start = (int)($_POST['s']);
-else
- $start = 0;
-
-if (isset($_POST['sortKey']))
- $sortKey = $_POST['sortKey'];
-
-if (isset($_POST['sortDir']))
- $sortDir = $_POST['sortDir'];
-else if (isset($sortKey))
- $sortDir = "ASC";
-
-if (isset($_POST['view']) && $_POST['view'] == "1")
- $view = 1;
-else
- $view = 0;
-
-if (isset($sortKey) && $sortKey != "" && isset($sortDir) && $sortDir != "") {
- $sort = "ORDER BY `" . $sortKey . "` " . $sortDir;
-} else {
- $sort = "";
-}
-
-require "includes/browse.php";
-
+
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+requireDatabaseAndTableBeDefined();
+
+if (isset($db))
+ $conn->selectDB($db);
+
+//run delete queries
+
+if (isset($_POST['runQuery'])) {
+ $runQuery = $_POST['runQuery'];
+
+ $queryList = splitQueryText($runQuery);
+ foreach ($queryList as $query) {
+ $conn->query($query);
+ }
+}
+
+if ($conn->getAdapter() == "sqlite") {
+ $query = "SELECT * FROM '$table'";
+} else {
+ $query = "SELECT * FROM `$table`";
+}
+
+$queryTable = $table;
+
+if (isset($_POST['s']))
+ $start = (int)($_POST['s']);
+else
+ $start = 0;
+
+if (isset($_POST['sortKey']))
+ $sortKey = $_POST['sortKey'];
+
+if (isset($_POST['sortDir']))
+ $sortDir = $_POST['sortDir'];
+else if (isset($sortKey))
+ $sortDir = "ASC";
+
+if (isset($_POST['view']) && $_POST['view'] == "1")
+ $view = 1;
+else
+ $view = 0;
+
+if (isset($sortKey) && $sortKey != "" && isset($sortDir) && $sortDir != "") {
+ $sort = "ORDER BY `" . $sortKey . "` " . $sortDir;
+} else {
+ $sort = "";
+}
+
+require "includes/browse.php";
+
?>
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/config.php b/htdocs/sqlbuddy/config.php
index c36bfd620..986acb0b6 100755
--- a/htdocs/sqlbuddy/config.php
+++ b/htdocs/sqlbuddy/config.php
@@ -1,64 +1,64 @@
-
-
-*/
-
-
-/* The values below are for the login.php page */
-
-$sbconfig['DefaultAdapter'] = "mysql";
-$sbconfig['DefaultHost'] = "localhost";
-$sbconfig['DefaultUser'] = "root";
-
-/*
-* If you want to enable automatic login, you can include your password below. To
-* automatically connect to SQLite, include the filename of the database instead.
-* Note: This is generally not recommended because it means that anyone with the
-* proper url will have access to your data. It should only be used on machines
-* that are not accessible from the internet (local testing boxes) or if you have
-* set up some other form of authentication. Use as your own discretion.
-*/
-
-// MySQL
-// $sbconfig['DefaultPass'] = "";
-
-// SQLite
-// $sbconfig['DefaultDatabase'] = "";
-
-/*
-* By default, when you view the homepage of your SQL Buddy installation, a check is
-* performed to see if a newer version of the application is available. No personal
-* information is sent about your installation and the response from the server is sent
-* as plain text. If, for some reason, you want to disable this behaviour, set this option
-* to true to disable automatic checking for updates. To learn about new versions, you can
-* always check the projects website at http://www.sqlbuddy.com/
-*/
-
-$sbconfig['EnableUpdateCheck'] = true;
-
-/*
-* This controls how many rows are displayed at once on the browse tab. If you are on a local
-* machine or have a fast internet connection, you could increase this value.
-*/
-
-$sbconfig['RowsPerPage'] = 100;
-
-/*
-* When set to true, the server will attempt to compress all content before it is sent to the
-* browser. Although unlikely, there is a chance that using gzip will cause issues on certain setups.
-* If you are having trouble getting pages to load properly, you could try disabling gzip.
-*/
-
-$sbconfig['EnableGzip'] = true;
-
+
+
+*/
+
+
+/* The values below are for the login.php page */
+
+$sbconfig['DefaultAdapter'] = "mysql";
+$sbconfig['DefaultHost'] = "localhost";
+$sbconfig['DefaultUser'] = "root";
+
+/*
+* If you want to enable automatic login, you can include your password below. To
+* automatically connect to SQLite, include the filename of the database instead.
+* Note: This is generally not recommended because it means that anyone with the
+* proper url will have access to your data. It should only be used on machines
+* that are not accessible from the internet (local testing boxes) or if you have
+* set up some other form of authentication. Use as your own discretion.
+*/
+
+// MySQL
+// $sbconfig['DefaultPass'] = "";
+
+// SQLite
+// $sbconfig['DefaultDatabase'] = "";
+
+/*
+* By default, when you view the homepage of your SQL Buddy installation, a check is
+* performed to see if a newer version of the application is available. No personal
+* information is sent about your installation and the response from the server is sent
+* as plain text. If, for some reason, you want to disable this behaviour, set this option
+* to true to disable automatic checking for updates. To learn about new versions, you can
+* always check the projects website at http://www.sqlbuddy.com/
+*/
+
+$sbconfig['EnableUpdateCheck'] = true;
+
+/*
+* This controls how many rows are displayed at once on the browse tab. If you are on a local
+* machine or have a fast internet connection, you could increase this value.
+*/
+
+$sbconfig['RowsPerPage'] = 100;
+
+/*
+* When set to true, the server will attempt to compress all content before it is sent to the
+* browser. Although unlikely, there is a chance that using gzip will cause issues on certain setups.
+* If you are having trouble getting pages to load properly, you could try disabling gzip.
+*/
+
+$sbconfig['EnableGzip'] = true;
+
?>
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/css/common.css b/htdocs/sqlbuddy/css/common.css
index b6345d75a..bccc92a44 100755
--- a/htdocs/sqlbuddy/css/common.css
+++ b/htdocs/sqlbuddy/css/common.css
@@ -1,888 +1,888 @@
-body {
-text-align: center;
-background: url(../images/initLoad.png) no-repeat 50% 125px;
-font: 12px/17px arial, sans-serif;
-color: rgb(50, 50, 50);
-}
-
-* {
-margin: 0; padding: 0;
-}
-
-table {
-border-spacing: 0;
-}
-
-a {
-text-decoration: none;
-color: #3A6D96;
-cursor: pointer;
-}
-a:hover {
-color: rgb(60, 60, 60);
-}
-a img {
-border: 0;
-display: block;
-}
-
-p {
-margin: 3px 0 5px;
-}
-
-h3 {
-font-size: 13px;
-}
-h4 {
-font-size: 13px;
-margin: 0 0 5px 0;
-border-bottom: 1px solid rgb(220, 220, 220);
-}
-
-ul {
-padding-left: 20px;
-}
-
-li {
-list-style-type: square;
-}
-
-input, textarea, select {
-font-family: arial, sans-serif;
-color: rgb(50, 50, 50);
-}
-.text, textarea {
-padding: 1px;
-font-size: 13px;
-width: 175px;
-}
-textarea {
-height: 80px;
-line-height: 15px;
-}
-select {
-font-size: 12px;
-}
-select[multiple] {
-border-color: rgb(195, 195, 195) rgb(235, 235, 235) rgb(225, 225, 225) rgb(215, 215, 215);
-border-width: 1px;
-border-style: solid;
-}
-option {
-padding: 1px 5px;
-}
-label {
-margin: 0 5px 0 0;
-vertical-align: middle;
-}
-label input {
-margin: 0 5px 2px 0;
-vertical-align: middle;
-}
-.inputbutton {
-background: url(../images/button.png);
-padding: 2px 5px 4px;
-font-size: 12px;
-line-height: 18px;
-width: 60px;
-height: 22px;
-border: 0;
-color: rgb(60, 60, 60);
-outline-width: thin;
-}
-.inputbutton:active {
-background: url(../images/button.png) 0 22px;
-color: rgb(80, 80, 80);
-}
-
-#headerlogo {
-width: 161px;
-padding: 10px 15px 2px;
-float: left;
-}
-#headerlogo a {
-outline: none;
-}
-#headerlogo img {
-display: inline;
-}
-#headerinfo {
-padding: 7px 18px 0;
-width: 175px;
-text-align: right;
-float: right;
-color: white;
-}
-#headerinfo a {
-margin-left: 10px;
-outline: none;
-}
-
-#load {
-color: rgb(190, 190, 190);
-}
-
-#container {
-width: 100%;
-line-height: 18px;
-text-align: left;
-}
-
-#bottom {
-width: 100%;
-opacity: 0;
-clear: left;
-padding-top: 6px;
-min-height: 350px;
-}
-#leftside {
-vertical-align: top;
-width: 180px;
-float: left;
-}
-#rightside {
-vertical-align: top;
-margin-left: 180px;
-padding: 0 6px 5px 0;
-}
-#sidemenu {
-display: block;
-padding: 10px 0 0 5px;
-}
-
-#content {
-width: 100%;
-}
-#innercontent {
-padding: 8px 10px 10px;
-}
-
-.grid {
-border-width: 1px;
-border-style: solid;
-border-color: rgb(225, 225, 225) rgb(210, 210, 210) rgb(210, 210, 210) rgb(210, 210, 210);
-background: url(../images/schemaHeader.png) top repeat-x;
-}
-
-.gridheader {
-height: 18px;
-border-bottom: 1px solid rgb(150, 150, 150);
-border-right: 1px solid #fff;
-overflow: hidden;
-}
-.gridheaderinner {
-padding-left: 1px;
-}
-
-.headertitle {
-background: #EEEEEE url(../images/schemaHeader.png) top;
-padding: 0 5px 0 6px;
-width: 200px;
-cursor: pointer;
-overflow: hidden;
-display: block;
-float: left;
-color: rgb(90, 90, 90);
-}
-
-.columnresizer {
-border-right: 1px solid rgb(255, 255, 255);
-border-left: 1px solid rgb(185, 185, 185);
-width: 0;
-height: 18px;
-cursor: ew-resize;
-}
-
-.emptyvoid {
-background: #EEEEEE url(../images/schemaHeader.png) top;
-height: 16px;
-width: 14px;
-padding: 1px 4px;
-float: left;
-border-bottom: 1px solid rgb(150, 150, 150);
-border-right: 1px solid rgb(205, 205, 205);
-}
-
-.impotent .headertitle, .impotent .columnresizer {
-cursor: default;
-}
-.nosort .headertitle {
-cursor: default;
-}
-
-.browse {
-line-height: 17px;
-min-width: 100%;
-width: 100%;
-}
-.browse table td {
-border-right: 1px solid rgb(200, 200, 200);
-vertical-align: top;
-}
-
-.item {
-padding: 2px 6px;
-width: 200px;
-overflow: hidden;
-max-height: 16px;
-}
-.longtext {
-width: 300px;
-}
-.numeric {
-width: 150px;
-}
-.binary {
-font-style: italic;
-color: #AAAA8F;
-}
-.structure .headertitle, .structure .item, .dboverview .headertitle, .dboverview .item {
-width: 150px;
-}
-
-.leftchecks {
-width: 22px;
-position: absolute;
-overflow: hidden;
-border-right: 1px solid rgb(185, 185, 185);
-}
-.manip {
-padding-top: 1px;
-vertical-align: top;
-height: 19px;
-}
-.manip:last-child {
-border-bottom: 0 !important;
-}
-.manip dt {
-width: 15px;
-padding: 0 1px 0 5px;
-float: left;
-}
-.manip dd {
-width: 15px;
-padding: 2px 0 0 0;
-float: left;
-}
-.manip dd a {
-background: url(../images/info.png) no-repeat;
-width: 13px;
-height: 13px;
-display: block;
-cursor: default;
-}
-.manip dd a:hover {
-background: url(../images/infoHover.png) no-repeat;
-}
-.browsetab .leftchecks {
-width: 38px;
-}
-
-.withchecks {
-margin-left: 22px;
-border-left: 1px solid rgb(240, 240, 240);
-}
-.withinfo {
-margin-left: 39px;
-}
-
-.sort {
-color: steelblue;
-}
-.sortasc {
-background: url(../images/sortasc.gif) no-repeat right 6px;
-margin-right: 1px;
-}
-.sortdesc {
-background: url(../images/sortdesc.gif) no-repeat right 5px;
-margin-right: 1px;
-}
-
-.alternator {
-border-bottom: 1px solid #f0f0ff;
-}
-.alternator2 {
-background: #f0f0ff;
-border-bottom: 1px solid transparent;
-}
-.highlighted {
-background: #F5F5B8 !important;
-border-bottom: 1px solid #E5E6AD !important;
-}
-
-.gridscroll {
-overflow: auto;
-min-height: 21px;
-}
-
-.gridscroll .browse:last-child {
-border-bottom: 0 !important;
-}
-
-.browsenav {
-width: 100%;
-padding: 2px 0 3px;
-}
-.browsenav td {
-color: rgb(125, 125, 125);
-}
-.browsenav a {
-outline: none;
-}
-.browsenav .options {
-padding-left: 7px;
-}
-.browsenav .options a {
-margin: 0 1px;
-}
-.browsenav .right {
-padding-right: 8px;
-text-align: right;
-}
-.browsenav .right a {
-padding-left: 10px;
-}
-.browsenav .paginator {
-padding: 0 3px 0 5px;
-}
-.browsenav .paginator a {
-color: rgb(125, 125, 125);
-padding-left: 5px;
-}
-.browsenav .paginator a.selected {
-font-weight: bold;
-color: rgb(150, 150, 150);
-}
-
-.insert {
-margin: 8px 6px;
-width: 350px;
-}
-.insert td {
-padding: 1px 6px 0;
-}
-.insert .inputarea {
-padding-bottom: 8px;
-}
-.insert .text {
-width: 325px;
-}
-.insert textarea {
-width: 325px;
-}
-.insertseperator {
-width: 348px;
-margin: 12px 5px;
-border-bottom: 2px solid #ccc;
-}
-.insertmessage {
-margin: 1px 4px;
-padding: 4px 8px;
-color: rgb(75, 75, 75);
-width: 332px;
-}
-
-.edit {
-border-bottom: 1px solid rgb(175, 175, 175);
-margin-bottom: 17px;
-}
-form:last-child .edit {
-border-bottom: 0 !important;
-}
-
-.fieldheader {
-color: rgb(110, 110, 110);
-}
-.fieldheader .fieldheadertitle {
-width: 345px;
-display: block;
-float: left;
-}
-.fieldheader a.fieldclose {
-width: 14px;
-height: 16px;
-padding-right: 4px;
-display: block;
-float: right;
-background: url(../images/close.png) no-repeat 0 1px;
-}
-.fieldheader a.fieldclose:hover {
-background: url(../images/closeHover.png) no-repeat 0 1px;
-}
-.secondaryheader {
-color: rgb(100, 100, 100);
-padding-right: 8px !important;
-vertical-align: top;
-}
-.secondaryheader a {
-color: rgb(100, 100, 100);
-}
-
-#fieldlist .fieldbox:first-child .fieldclose {
-display: none;
-}
-
-.structure .inputbox {
-width: 500px;
-margin-top: 15px;
-}
-.structure .secondaryheader {
-width: 65px;
-}
-.structure .grid {
-margin-bottom: 15px;
-}
-
-.columnheader {
-color: rgb(125, 125, 125);
-padding: 3px 0 0 7px;
-cursor: pointer;
-}
-.column .text {
-font-size: 12px;
-}
-
-.paneheader {
-margin: 7px 0 0;
-color: rgb(115, 115, 115);
-}
-.paneheader a {
-color: rgb(115, 115, 115);
-}
-
-.dboverview .column1 {
-width: 200px;
-}
-.dboverview .inputbox {
-width: 500px;
-}
-.dboverview .inputbox .secondaryheader {
-width: 80px;
-}
-
-.overview {
-margin: 0px 0 5px 0;
-border-bottom: 1px solid rgb(220, 220, 220);
-padding: 0 0 3px 0;
-}
-.inputbox .overview td {
-padding: 7px 0 3px;
-}
-.overview .fieldheader {
-border-bottom: 1px solid rgb(220, 220, 220);
-padding-bottom: 2px;
-}
-.overview .text, .overview select, .overview option {
-width: 135px;
-}
-
-.editcolumn {
-margin-left: 4px;
-padding: 12px 0;
-width: 430px;
-}
-.editcolumn table {
-width: 100%;
-}
-.editcolumn td {
-padding: 1px 6px 0;
-}
-.editcolumn .inputarea {
-padding-bottom: 8px;
-}
-.editcolumn .text {
-width: 325px;
-font-size: 12px !important;
-}
-
-.edituser {
-margin: 0 0 4px 13px;
-padding: 12px 0;
-width: 335px;
-border-bottom: 1px solid rgb(175, 175, 175);
-}
-form:last-child .edituser {
-border-bottom: 0 !important;
-}
-.edituser .edit {
-border-bottom: 0;
-margin-bottom: 0;
-}
-.edituser .secondaryheader {
-width: 110px;
-}
-
-.users {
-padding: 5px 7px 7px;
-width: 550px;
-}
-.users .inputbox {
-width: 335px;
-}
-.users .secondaryheader {
-width: 110px;
-}
-.privpane {
-background: rgb(240, 240, 240);
-padding: 1px 0px 8px 12px;
-margin-top: 5px;
-}
-#dbaccesspane {
-padding-top: 5px !important;
-}
-.privpane td {
-padding: 1px 0 !important;
-}
-
-.export {
-padding: 7px 7px 5px 14px;
-width: 375px;
-}
-.export h4 {
-padding-bottom: 3px;
-}
-.export .secondaryheader {
-width: 110px;
-}
-.export .message {
-color: rgb(100, 100, 100);
-line-height: 14px;
-}
-.export table {
-width: 100%;
-}
-.export td {
-padding: 5px 0;
-}
-.export select {
-width: 100%;
-}
-.export .text {
-font-size: 12px;
-width: 100px;
-}
-.exportseperator {
-margin: 7px 0;
-border-bottom: 1px solid rgb(210, 210, 210);
-}
-#EXPORTWRAPPER {
-padding: 7px;
-}
-#EXPORTWRAPPER strong {
-color: #646464;
-}
-#EXPORTRESULTS {
-width: 100%;
-max-width: 100%;
-height: 250px;
-font-size: 12px;
-margin-top: 3px;
-}
-
-.import {
-padding: 7px 7px 5px 14px;
-width: 350px;
-}
-.import h4 {
-padding-bottom: 3px;
-}
-.import .secondaryheader {
-width: 80px;
-}
-.import table {
-width: 100%;
-}
-.import td {
-padding: 5px 0;
-}
-.import .text {
-font-size: 12px;
-width: 100px;
-}
-
-.inputbox {
-padding: 0 7px 5px;
-}
-.inputbox h4 {
-margin-bottom: 5px;
-padding-bottom: 2px;
-}
-.inputbox table {
-width: 100%;
-}
-.inputbox td {
-padding: 5px 0;
-}
-.inputbox .text, .inputbox textarea, .inputbox select[multiple] {
-font-size: 12px;
-}
-
-.fulltextwin {
-position: absolute;
-text-align: left;
-color: rgb(240, 240, 240);
-width: 475px;
-}
-.fulltextheader {
-height: 21px;
-}
-.fulltextheader td {
-padding: 2px 0;
-}
-.headertl {
-width: 19px;
-background: url(../images/window-header-left.png) no-repeat;
-}
-.headertr {
-width: 19px;
-background: url(../images/window-header-right.png) no-repeat;
-}
-.headercenter {
-background: url(../images/window-header-center.png) repeat-x;
-}
-
-.fulltextheader p {
-margin: 0 !important;
-padding-left: 2px;
-}
-.fulltextheader img {
-margin-top: 1px;
-}
-.mainl {
-width: 13px;
-background: url(../images/window-shadow-left.png) repeat-y;
-}
-.maincenter {
-background: url(../images/window-center.png);
-padding: 5px 5px 0 8px;
-}
-.fulltextcontent {
-overflow: auto;
-min-height: 100px;
-padding-right: 5px;
-}
-.mainr {
-width: 13px;
-background: url(../images/window-shadow-right.png) repeat-y;
-}
-.fulltexttitle {
-color: rgb(175, 175, 175);
-font-weight: bold;
-}
-.fulltextbody {
-margin-bottom: 10px;
-line-height: 15px;
-}
-.fulltextfooter {
-width: 100%;
-}
-.fulltextfooter td {
-height: 19px;
-}
-.footerbl {
-width: 15px;
-background: url(../images/window-shadow-bottom-left.png) no-repeat -1px;
-}
-.footerbr {
-width: 15px;
-background: url(../images/window-shadow-bottom-right.png) no-repeat;
-}
-.footermiddle {
-width: auto;
-background: url(../images/window-shadow-bottom.png) repeat-x;
-}
-
-.dialog {
-width: 475px;
-}
-.dialog .fulltextcontent {
-min-height: 25px;
-}
-.dialog .maincenter {
-padding: 5px 2px 0px 8px !important
-}
-.buttons {
-padding: 7px 0 5px;
-}
-.windowbutton {
-background: url(../images/window-button.png);
-padding: 3px 5px 4px;
-width: 60px;
-height: 22px;
-border: 0;
-color: white;
-outline-color: rgb(130, 130, 130);
-outline-width: thin;
-}
-.resizeHandle {
-float: right;
-margin-bottom: -1px;
-}
-
-#QUERY {
-width: 550px;
-font-size: 12px;
-display: block;
-margin: 2px 0 0;
-}
-
-.querybox {
-font-family: "courier new";
-background: rgb(90, 90, 90);
-padding: 4px 6px 2px;
-margin: 10px 0 1px 0;
-max-height: 75px;
-overflow: auto;
-font-weight: normal;
-}
-
-.clearer {
-height: 0;
-line-height: 0;
-clear: both;
-}
-
-#loginform {
-margin: 0 auto;
-width: 330px;
-margin-top: 115px;
-}
-#loginform .loginspacer {
-padding: 13px 18px 13px 14px;
-}
-#loginform table {
-width: 100%;
-}
-.loginheader {
-border-bottom: 1px solid #E1E1E1;
-padding-bottom: 8px !important;
-float: left;
-width: 100%;
-margin-bottom: 10px;
-}
-.loginheader h3 {
-font-size: 13px;
-float: left;
-}
-.loginheader a {
-float: right;
-text-align: right;
-}
-#loginform td {
-padding: 5px 5px;
-line-height: 14px;
-}
-#loginform .field {
-width: 85px;
-text-align: right;
-color: #4A7496;
-}
-#loginform select {
-width: 165px;
-}
-#loginform .text {
-width: 160px;
-color: rgb(70, 70, 70);
-font-size: 13px;
-}
-#loginform .errormess {
-color: #AA3939;
-padding: 0 0 5px;
-text-align: center;
-}
-
-.errormessage {
-background: rgb(255, 245, 245);
-border: 1px solid rgb(230, 210, 210);
-padding: 7px 9px;
-line-height: 15px;
-color: rgb(80, 80, 80);
-}
-.errormessage strong {
-color: #EB4A4A;
-display: block;
-margin-bottom: 3px;
-}
-.errormessage p {
-margin-bottom: 0;
-}
-.statusmessage {
-padding: 4px 0;
-color: rgb(125, 125, 125);
-}
-
-.hometable {
-margin: 7px 0 0 10px;
-width: 475px;
-}
-.hometable p {
-line-height: 15px;
-}
-.hometable table td {
-padding-top: 7px;
-}
-.hometable .text {
-width: 130px;
-}
-.hometable select {
-width: 135px;
-}
-.hometable .inputfield {
-color: rgb(140, 140, 140);
-width: 95px;
-padding-right: 7px;
-text-align: right;
-}
-
-.keyboardtable {
-width: 445px;
-margin-top: 7px;
-border-right: 1px solid rgb(200, 200, 200);
-border-bottom: 1px solid rgb(200, 200, 200);
-}
-.keyboardtable td, .keyboardtable th {
-padding: 1px 10px 1px 5px !important;
-border-left: 1px solid rgb(200, 200, 200);
-border-top: 1px solid rgb(200, 200, 200);
-}
-.keyboardtable th {
-color: rgb(125, 125, 125);
-font-weight: normal;
-text-align: left;
-}
-
-dl.information {
-width: 200px;
-}
-dl.information dt {
-float: left;
-width: 100px;
-clear: left;
-color: rgb(125, 125, 125);
-}
-dl.information dd {
-float: left;
-width: 100px;
-}
-
-.morelink:hover {
-text-decoration: underline;
-}
-
-.errorpage {
-padding: 6px 10px 3px;
-width: 450px;
-}
-.errorpage h4 {
-font-weight: bold;
-}
-
-.goto {
-cursor: pointer;
-margin-top: 2px;
-opacity: 0.7;
-float: right;
-}
-.goto:hover {
-opacity: 1;
+body {
+text-align: center;
+background: url(../images/initLoad.png) no-repeat 50% 125px;
+font: 12px/17px arial, sans-serif;
+color: rgb(50, 50, 50);
+}
+
+* {
+margin: 0; padding: 0;
+}
+
+table {
+border-spacing: 0;
+}
+
+a {
+text-decoration: none;
+color: #3A6D96;
+cursor: pointer;
+}
+a:hover {
+color: rgb(60, 60, 60);
+}
+a img {
+border: 0;
+display: block;
+}
+
+p {
+margin: 3px 0 5px;
+}
+
+h3 {
+font-size: 13px;
+}
+h4 {
+font-size: 13px;
+margin: 0 0 5px 0;
+border-bottom: 1px solid rgb(220, 220, 220);
+}
+
+ul {
+padding-left: 20px;
+}
+
+li {
+list-style-type: square;
+}
+
+input, textarea, select {
+font-family: arial, sans-serif;
+color: rgb(50, 50, 50);
+}
+.text, textarea {
+padding: 1px;
+font-size: 13px;
+width: 175px;
+}
+textarea {
+height: 80px;
+line-height: 15px;
+}
+select {
+font-size: 12px;
+}
+select[multiple] {
+border-color: rgb(195, 195, 195) rgb(235, 235, 235) rgb(225, 225, 225) rgb(215, 215, 215);
+border-width: 1px;
+border-style: solid;
+}
+option {
+padding: 1px 5px;
+}
+label {
+margin: 0 5px 0 0;
+vertical-align: middle;
+}
+label input {
+margin: 0 5px 2px 0;
+vertical-align: middle;
+}
+.inputbutton {
+background: url(../images/button.png);
+padding: 2px 5px 4px;
+font-size: 12px;
+line-height: 18px;
+width: 60px;
+height: 22px;
+border: 0;
+color: rgb(60, 60, 60);
+outline-width: thin;
+}
+.inputbutton:active {
+background: url(../images/button.png) 0 22px;
+color: rgb(80, 80, 80);
+}
+
+#headerlogo {
+width: 161px;
+padding: 10px 15px 2px;
+float: left;
+}
+#headerlogo a {
+outline: none;
+}
+#headerlogo img {
+display: inline;
+}
+#headerinfo {
+padding: 7px 18px 0;
+width: 175px;
+text-align: right;
+float: right;
+color: white;
+}
+#headerinfo a {
+margin-left: 10px;
+outline: none;
+}
+
+#load {
+color: rgb(190, 190, 190);
+}
+
+#container {
+width: 100%;
+line-height: 18px;
+text-align: left;
+}
+
+#bottom {
+width: 100%;
+opacity: 0;
+clear: left;
+padding-top: 6px;
+min-height: 350px;
+}
+#leftside {
+vertical-align: top;
+width: 180px;
+float: left;
+}
+#rightside {
+vertical-align: top;
+margin-left: 180px;
+padding: 0 6px 5px 0;
+}
+#sidemenu {
+display: block;
+padding: 10px 0 0 5px;
+}
+
+#content {
+width: 100%;
+}
+#innercontent {
+padding: 8px 10px 10px;
+}
+
+.grid {
+border-width: 1px;
+border-style: solid;
+border-color: rgb(225, 225, 225) rgb(210, 210, 210) rgb(210, 210, 210) rgb(210, 210, 210);
+background: url(../images/schemaHeader.png) top repeat-x;
+}
+
+.gridheader {
+height: 18px;
+border-bottom: 1px solid rgb(150, 150, 150);
+border-right: 1px solid #fff;
+overflow: hidden;
+}
+.gridheaderinner {
+padding-left: 1px;
+}
+
+.headertitle {
+background: #EEEEEE url(../images/schemaHeader.png) top;
+padding: 0 5px 0 6px;
+width: 200px;
+cursor: pointer;
+overflow: hidden;
+display: block;
+float: left;
+color: rgb(90, 90, 90);
+}
+
+.columnresizer {
+border-right: 1px solid rgb(255, 255, 255);
+border-left: 1px solid rgb(185, 185, 185);
+width: 0;
+height: 18px;
+cursor: ew-resize;
+}
+
+.emptyvoid {
+background: #EEEEEE url(../images/schemaHeader.png) top;
+height: 16px;
+width: 14px;
+padding: 1px 4px;
+float: left;
+border-bottom: 1px solid rgb(150, 150, 150);
+border-right: 1px solid rgb(205, 205, 205);
+}
+
+.impotent .headertitle, .impotent .columnresizer {
+cursor: default;
+}
+.nosort .headertitle {
+cursor: default;
+}
+
+.browse {
+line-height: 17px;
+min-width: 100%;
+width: 100%;
+}
+.browse table td {
+border-right: 1px solid rgb(200, 200, 200);
+vertical-align: top;
+}
+
+.item {
+padding: 2px 6px;
+width: 200px;
+overflow: hidden;
+max-height: 16px;
+}
+.longtext {
+width: 300px;
+}
+.numeric {
+width: 150px;
+}
+.binary {
+font-style: italic;
+color: #AAAA8F;
+}
+.structure .headertitle, .structure .item, .dboverview .headertitle, .dboverview .item {
+width: 150px;
+}
+
+.leftchecks {
+width: 22px;
+position: absolute;
+overflow: hidden;
+border-right: 1px solid rgb(185, 185, 185);
+}
+.manip {
+padding-top: 1px;
+vertical-align: top;
+height: 19px;
+}
+.manip:last-child {
+border-bottom: 0 !important;
+}
+.manip dt {
+width: 15px;
+padding: 0 1px 0 5px;
+float: left;
+}
+.manip dd {
+width: 15px;
+padding: 2px 0 0 0;
+float: left;
+}
+.manip dd a {
+background: url(../images/info.png) no-repeat;
+width: 13px;
+height: 13px;
+display: block;
+cursor: default;
+}
+.manip dd a:hover {
+background: url(../images/infoHover.png) no-repeat;
+}
+.browsetab .leftchecks {
+width: 38px;
+}
+
+.withchecks {
+margin-left: 22px;
+border-left: 1px solid rgb(240, 240, 240);
+}
+.withinfo {
+margin-left: 39px;
+}
+
+.sort {
+color: steelblue;
+}
+.sortasc {
+background: url(../images/sortasc.gif) no-repeat right 6px;
+margin-right: 1px;
+}
+.sortdesc {
+background: url(../images/sortdesc.gif) no-repeat right 5px;
+margin-right: 1px;
+}
+
+.alternator {
+border-bottom: 1px solid #f0f0ff;
+}
+.alternator2 {
+background: #f0f0ff;
+border-bottom: 1px solid transparent;
+}
+.highlighted {
+background: #F5F5B8 !important;
+border-bottom: 1px solid #E5E6AD !important;
+}
+
+.gridscroll {
+overflow: auto;
+min-height: 21px;
+}
+
+.gridscroll .browse:last-child {
+border-bottom: 0 !important;
+}
+
+.browsenav {
+width: 100%;
+padding: 2px 0 3px;
+}
+.browsenav td {
+color: rgb(125, 125, 125);
+}
+.browsenav a {
+outline: none;
+}
+.browsenav .options {
+padding-left: 7px;
+}
+.browsenav .options a {
+margin: 0 1px;
+}
+.browsenav .right {
+padding-right: 8px;
+text-align: right;
+}
+.browsenav .right a {
+padding-left: 10px;
+}
+.browsenav .paginator {
+padding: 0 3px 0 5px;
+}
+.browsenav .paginator a {
+color: rgb(125, 125, 125);
+padding-left: 5px;
+}
+.browsenav .paginator a.selected {
+font-weight: bold;
+color: rgb(150, 150, 150);
+}
+
+.insert {
+margin: 8px 6px;
+width: 350px;
+}
+.insert td {
+padding: 1px 6px 0;
+}
+.insert .inputarea {
+padding-bottom: 8px;
+}
+.insert .text {
+width: 325px;
+}
+.insert textarea {
+width: 325px;
+}
+.insertseperator {
+width: 348px;
+margin: 12px 5px;
+border-bottom: 2px solid #ccc;
+}
+.insertmessage {
+margin: 1px 4px;
+padding: 4px 8px;
+color: rgb(75, 75, 75);
+width: 332px;
+}
+
+.edit {
+border-bottom: 1px solid rgb(175, 175, 175);
+margin-bottom: 17px;
+}
+form:last-child .edit {
+border-bottom: 0 !important;
+}
+
+.fieldheader {
+color: rgb(110, 110, 110);
+}
+.fieldheader .fieldheadertitle {
+width: 345px;
+display: block;
+float: left;
+}
+.fieldheader a.fieldclose {
+width: 14px;
+height: 16px;
+padding-right: 4px;
+display: block;
+float: right;
+background: url(../images/close.png) no-repeat 0 1px;
+}
+.fieldheader a.fieldclose:hover {
+background: url(../images/closeHover.png) no-repeat 0 1px;
+}
+.secondaryheader {
+color: rgb(100, 100, 100);
+padding-right: 8px !important;
+vertical-align: top;
+}
+.secondaryheader a {
+color: rgb(100, 100, 100);
+}
+
+#fieldlist .fieldbox:first-child .fieldclose {
+display: none;
+}
+
+.structure .inputbox {
+width: 500px;
+margin-top: 15px;
+}
+.structure .secondaryheader {
+width: 65px;
+}
+.structure .grid {
+margin-bottom: 15px;
+}
+
+.columnheader {
+color: rgb(125, 125, 125);
+padding: 3px 0 0 7px;
+cursor: pointer;
+}
+.column .text {
+font-size: 12px;
+}
+
+.paneheader {
+margin: 7px 0 0;
+color: rgb(115, 115, 115);
+}
+.paneheader a {
+color: rgb(115, 115, 115);
+}
+
+.dboverview .column1 {
+width: 200px;
+}
+.dboverview .inputbox {
+width: 500px;
+}
+.dboverview .inputbox .secondaryheader {
+width: 80px;
+}
+
+.overview {
+margin: 0px 0 5px 0;
+border-bottom: 1px solid rgb(220, 220, 220);
+padding: 0 0 3px 0;
+}
+.inputbox .overview td {
+padding: 7px 0 3px;
+}
+.overview .fieldheader {
+border-bottom: 1px solid rgb(220, 220, 220);
+padding-bottom: 2px;
+}
+.overview .text, .overview select, .overview option {
+width: 135px;
+}
+
+.editcolumn {
+margin-left: 4px;
+padding: 12px 0;
+width: 430px;
+}
+.editcolumn table {
+width: 100%;
+}
+.editcolumn td {
+padding: 1px 6px 0;
+}
+.editcolumn .inputarea {
+padding-bottom: 8px;
+}
+.editcolumn .text {
+width: 325px;
+font-size: 12px !important;
+}
+
+.edituser {
+margin: 0 0 4px 13px;
+padding: 12px 0;
+width: 335px;
+border-bottom: 1px solid rgb(175, 175, 175);
+}
+form:last-child .edituser {
+border-bottom: 0 !important;
+}
+.edituser .edit {
+border-bottom: 0;
+margin-bottom: 0;
+}
+.edituser .secondaryheader {
+width: 110px;
+}
+
+.users {
+padding: 5px 7px 7px;
+width: 550px;
+}
+.users .inputbox {
+width: 335px;
+}
+.users .secondaryheader {
+width: 110px;
+}
+.privpane {
+background: rgb(240, 240, 240);
+padding: 1px 0px 8px 12px;
+margin-top: 5px;
+}
+#dbaccesspane {
+padding-top: 5px !important;
+}
+.privpane td {
+padding: 1px 0 !important;
+}
+
+.export {
+padding: 7px 7px 5px 14px;
+width: 375px;
+}
+.export h4 {
+padding-bottom: 3px;
+}
+.export .secondaryheader {
+width: 110px;
+}
+.export .message {
+color: rgb(100, 100, 100);
+line-height: 14px;
+}
+.export table {
+width: 100%;
+}
+.export td {
+padding: 5px 0;
+}
+.export select {
+width: 100%;
+}
+.export .text {
+font-size: 12px;
+width: 100px;
+}
+.exportseperator {
+margin: 7px 0;
+border-bottom: 1px solid rgb(210, 210, 210);
+}
+#EXPORTWRAPPER {
+padding: 7px;
+}
+#EXPORTWRAPPER strong {
+color: #646464;
+}
+#EXPORTRESULTS {
+width: 100%;
+max-width: 100%;
+height: 250px;
+font-size: 12px;
+margin-top: 3px;
+}
+
+.import {
+padding: 7px 7px 5px 14px;
+width: 350px;
+}
+.import h4 {
+padding-bottom: 3px;
+}
+.import .secondaryheader {
+width: 80px;
+}
+.import table {
+width: 100%;
+}
+.import td {
+padding: 5px 0;
+}
+.import .text {
+font-size: 12px;
+width: 100px;
+}
+
+.inputbox {
+padding: 0 7px 5px;
+}
+.inputbox h4 {
+margin-bottom: 5px;
+padding-bottom: 2px;
+}
+.inputbox table {
+width: 100%;
+}
+.inputbox td {
+padding: 5px 0;
+}
+.inputbox .text, .inputbox textarea, .inputbox select[multiple] {
+font-size: 12px;
+}
+
+.fulltextwin {
+position: absolute;
+text-align: left;
+color: rgb(240, 240, 240);
+width: 475px;
+}
+.fulltextheader {
+height: 21px;
+}
+.fulltextheader td {
+padding: 2px 0;
+}
+.headertl {
+width: 19px;
+background: url(../images/window-header-left.png) no-repeat;
+}
+.headertr {
+width: 19px;
+background: url(../images/window-header-right.png) no-repeat;
+}
+.headercenter {
+background: url(../images/window-header-center.png) repeat-x;
+}
+
+.fulltextheader p {
+margin: 0 !important;
+padding-left: 2px;
+}
+.fulltextheader img {
+margin-top: 1px;
+}
+.mainl {
+width: 13px;
+background: url(../images/window-shadow-left.png) repeat-y;
+}
+.maincenter {
+background: url(../images/window-center.png);
+padding: 5px 5px 0 8px;
+}
+.fulltextcontent {
+overflow: auto;
+min-height: 100px;
+padding-right: 5px;
+}
+.mainr {
+width: 13px;
+background: url(../images/window-shadow-right.png) repeat-y;
+}
+.fulltexttitle {
+color: rgb(175, 175, 175);
+font-weight: bold;
+}
+.fulltextbody {
+margin-bottom: 10px;
+line-height: 15px;
+}
+.fulltextfooter {
+width: 100%;
+}
+.fulltextfooter td {
+height: 19px;
+}
+.footerbl {
+width: 15px;
+background: url(../images/window-shadow-bottom-left.png) no-repeat -1px;
+}
+.footerbr {
+width: 15px;
+background: url(../images/window-shadow-bottom-right.png) no-repeat;
+}
+.footermiddle {
+width: auto;
+background: url(../images/window-shadow-bottom.png) repeat-x;
+}
+
+.dialog {
+width: 475px;
+}
+.dialog .fulltextcontent {
+min-height: 25px;
+}
+.dialog .maincenter {
+padding: 5px 2px 0px 8px !important
+}
+.buttons {
+padding: 7px 0 5px;
+}
+.windowbutton {
+background: url(../images/window-button.png);
+padding: 3px 5px 4px;
+width: 60px;
+height: 22px;
+border: 0;
+color: white;
+outline-color: rgb(130, 130, 130);
+outline-width: thin;
+}
+.resizeHandle {
+float: right;
+margin-bottom: -1px;
+}
+
+#QUERY {
+width: 550px;
+font-size: 12px;
+display: block;
+margin: 2px 0 0;
+}
+
+.querybox {
+font-family: "courier new";
+background: rgb(90, 90, 90);
+padding: 4px 6px 2px;
+margin: 10px 0 1px 0;
+max-height: 75px;
+overflow: auto;
+font-weight: normal;
+}
+
+.clearer {
+height: 0;
+line-height: 0;
+clear: both;
+}
+
+#loginform {
+margin: 0 auto;
+width: 330px;
+margin-top: 115px;
+}
+#loginform .loginspacer {
+padding: 13px 18px 13px 14px;
+}
+#loginform table {
+width: 100%;
+}
+.loginheader {
+border-bottom: 1px solid #E1E1E1;
+padding-bottom: 8px !important;
+float: left;
+width: 100%;
+margin-bottom: 10px;
+}
+.loginheader h3 {
+font-size: 13px;
+float: left;
+}
+.loginheader a {
+float: right;
+text-align: right;
+}
+#loginform td {
+padding: 5px 5px;
+line-height: 14px;
+}
+#loginform .field {
+width: 85px;
+text-align: right;
+color: #4A7496;
+}
+#loginform select {
+width: 165px;
+}
+#loginform .text {
+width: 160px;
+color: rgb(70, 70, 70);
+font-size: 13px;
+}
+#loginform .errormess {
+color: #AA3939;
+padding: 0 0 5px;
+text-align: center;
+}
+
+.errormessage {
+background: rgb(255, 245, 245);
+border: 1px solid rgb(230, 210, 210);
+padding: 7px 9px;
+line-height: 15px;
+color: rgb(80, 80, 80);
+}
+.errormessage strong {
+color: #EB4A4A;
+display: block;
+margin-bottom: 3px;
+}
+.errormessage p {
+margin-bottom: 0;
+}
+.statusmessage {
+padding: 4px 0;
+color: rgb(125, 125, 125);
+}
+
+.hometable {
+margin: 7px 0 0 10px;
+width: 475px;
+}
+.hometable p {
+line-height: 15px;
+}
+.hometable table td {
+padding-top: 7px;
+}
+.hometable .text {
+width: 130px;
+}
+.hometable select {
+width: 135px;
+}
+.hometable .inputfield {
+color: rgb(140, 140, 140);
+width: 95px;
+padding-right: 7px;
+text-align: right;
+}
+
+.keyboardtable {
+width: 445px;
+margin-top: 7px;
+border-right: 1px solid rgb(200, 200, 200);
+border-bottom: 1px solid rgb(200, 200, 200);
+}
+.keyboardtable td, .keyboardtable th {
+padding: 1px 10px 1px 5px !important;
+border-left: 1px solid rgb(200, 200, 200);
+border-top: 1px solid rgb(200, 200, 200);
+}
+.keyboardtable th {
+color: rgb(125, 125, 125);
+font-weight: normal;
+text-align: left;
+}
+
+dl.information {
+width: 200px;
+}
+dl.information dt {
+float: left;
+width: 100px;
+clear: left;
+color: rgb(125, 125, 125);
+}
+dl.information dd {
+float: left;
+width: 100px;
+}
+
+.morelink:hover {
+text-decoration: underline;
+}
+
+.errorpage {
+padding: 6px 10px 3px;
+width: 450px;
+}
+.errorpage h4 {
+font-weight: bold;
+}
+
+.goto {
+cursor: pointer;
+margin-top: 2px;
+opacity: 0.7;
+float: right;
+}
+.goto:hover {
+opacity: 1;
}
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/css/navigation.css b/htdocs/sqlbuddy/css/navigation.css
index 9b5d2e69d..fdc07ed07 100755
--- a/htdocs/sqlbuddy/css/navigation.css
+++ b/htdocs/sqlbuddy/css/navigation.css
@@ -1,94 +1,94 @@
-.dblistheader {
-padding: 0px 0px 0px 7px;
-outline: none;
-text-transform: uppercase;
-font-size: 10px;
-color: rgb(175, 175, 175);
-}
-
-.dblist {
-width: 100%;
-line-height: 17px;
-padding-bottom: 6px;
-}
-.dblist ul {
-padding: 0px;
-}
-.dblist ul li {
-list-style-type: none;
-}
-.dblist ul li a {
-display: block;
-outline: none;
-border-width: 1px 0 1px 1px;
-border-style: solid;
-border-color: transparent;
-}
-.dblist ul li a .menutext {
-padding: 1px 6px 0px 0px;
-margin-left: 16px;
-border: 0;
-}
-.dblist ul li a .menutoggler {
-width: 12px;
-height: 14px;
-margin: 3px 4px 0px 2px;
-float: left;
-background: transparent url(../images/closedArrow.png) no-repeat 4px 3px;
-}
-.dblist ul li a .menuicon {
-height: 14px;
-margin: 0px 5px 0px 6px;
-float: left;
-font-size: 10px;
-padding-top: 1px;
-}
-.dblist ul li.expanded a .menutoggler{
-background: transparent url(../images/openArrow.png) no-repeat 3px 3px;
-}
-.dblist ul li.expanded .sublist {
-display: block;
-}
-
-.sublist {
-border: 0px !important;
-overflow: hidden;
-}
-.sublist li a {
-padding: 1px 6px 0px 22px !important;
-margin-left: 7px;
-overflow-x: hidden;
-}
-.sublist li.loading a {
-background: url(../images/loading.gif) no-repeat 0 0 !important;
-}
-.subcount {
-padding-left: 5px;
-font-size: 11px;
-}
-
-#toptabs {
-padding-top: 7px;
-float: left;
-}
-#toptabs ul {
-padding: 0;
-}
-#toptabs ul li {
-list-style-type: none;
-float: left;
-}
-#toptabs ul li a {
-margin: 0 5px 0 15px;
-outline: none;
-}
-#toptabs ul li a .rowcount {
-font-weight: normal;
-padding-left: 3px;
-}
-#toptabs ul li.selected a {
-cursor: default;
-}
-#toptabs ul li.deactivated a {
-cursor: default;
+.dblistheader {
+padding: 0px 0px 0px 7px;
+outline: none;
+text-transform: uppercase;
+font-size: 10px;
+color: rgb(175, 175, 175);
+}
+
+.dblist {
+width: 100%;
+line-height: 17px;
+padding-bottom: 6px;
+}
+.dblist ul {
+padding: 0px;
+}
+.dblist ul li {
+list-style-type: none;
+}
+.dblist ul li a {
+display: block;
+outline: none;
+border-width: 1px 0 1px 1px;
+border-style: solid;
+border-color: transparent;
+}
+.dblist ul li a .menutext {
+padding: 1px 6px 0px 0px;
+margin-left: 16px;
+border: 0;
+}
+.dblist ul li a .menutoggler {
+width: 12px;
+height: 14px;
+margin: 3px 4px 0px 2px;
+float: left;
+background: transparent url(../images/closedArrow.png) no-repeat 4px 3px;
+}
+.dblist ul li a .menuicon {
+height: 14px;
+margin: 0px 5px 0px 6px;
+float: left;
+font-size: 10px;
+padding-top: 1px;
+}
+.dblist ul li.expanded a .menutoggler{
+background: transparent url(../images/openArrow.png) no-repeat 3px 3px;
+}
+.dblist ul li.expanded .sublist {
+display: block;
+}
+
+.sublist {
+border: 0px !important;
+overflow: hidden;
+}
+.sublist li a {
+padding: 1px 6px 0px 22px !important;
+margin-left: 7px;
+overflow-x: hidden;
+}
+.sublist li.loading a {
+background: url(../images/loading.gif) no-repeat 0 0 !important;
+}
+.subcount {
+padding-left: 5px;
+font-size: 11px;
+}
+
+#toptabs {
+padding-top: 7px;
+float: left;
+}
+#toptabs ul {
+padding: 0;
+}
+#toptabs ul li {
+list-style-type: none;
+float: left;
+}
+#toptabs ul li a {
+margin: 0 5px 0 15px;
+outline: none;
+}
+#toptabs ul li a .rowcount {
+font-weight: normal;
+padding-left: 3px;
+}
+#toptabs ul li.selected a {
+cursor: default;
+}
+#toptabs ul li.deactivated a {
+cursor: default;
}
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/css/print.css b/htdocs/sqlbuddy/css/print.css
index 38d77463f..16333ff33 100755
--- a/htdocs/sqlbuddy/css/print.css
+++ b/htdocs/sqlbuddy/css/print.css
@@ -1,27 +1,27 @@
-#header {
-display: none;
-}
-
-.inputbutton, .inputbutton:active {
-background: default !important;
-border: default !important;
-line-height: inherit !important;
-width: auto !important;
-height: auto !important;
-}
-
-#innercontent a {
-color: #3A6D96 !important;
-}
-
-.leftchecks, .emptyvoid {
-display: none !important;
-}
-.gridscroll, .gridheader {
-max-height: none !important;
-max-width: none !important;
-overflow: none !important;
-}
-.withinfo, .withchecks {
-margin-left: 0 !important;
+#header {
+display: none;
+}
+
+.inputbutton, .inputbutton:active {
+background: default !important;
+border: default !important;
+line-height: inherit !important;
+width: auto !important;
+height: auto !important;
+}
+
+#innercontent a {
+color: #3A6D96 !important;
+}
+
+.leftchecks, .emptyvoid {
+display: none !important;
+}
+.gridscroll, .gridheader {
+max-height: none !important;
+max-width: none !important;
+overflow: none !important;
+}
+.withinfo, .withchecks {
+margin-left: 0 !important;
}
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/dboverview.php b/htdocs/sqlbuddy/dboverview.php
index 1082c5e41..d1c429189 100755
--- a/htdocs/sqlbuddy/dboverview.php
+++ b/htdocs/sqlbuddy/dboverview.php
@@ -1,578 +1,577 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-if (isset($db)) {
-
-$conn->selectDB($db);
-
-//run delete queries
-
-if (isset($_POST['runQuery'])) {
-
- $runQuery = $_POST['runQuery'];
-
- $queryList = splitQueryText($runQuery);
-
- foreach ($queryList as $query) {
- $query = trim($query);
-
- if ($query != "") {
- $conn->query($query) or ($dbError = $conn->error());
-
- // make a list of the tables that were dropped/emptied
- if (substr($query, 0, 10) == "DROP TABLE")
- $droppedList[] = substr($query, 12, -1);
-
- if (substr($query, 0, 10) == "TRUNCATE `")
- $emptiedList[] = substr($query, 10, -1);
-
- if (substr($query, 0, 13) == "DELETE FROM '")
- $emptiedList[] = substr($query, 13, -1);
-
- }
- }
-}
-
-// if tables were dropped, remove them from the side menu
-if (isset($droppedList) && isset($db)) {
- ?>
-
-
-
-
-
-
-
- ';
- echo __("Error performing operation");
- echo ' ' . $dbError . '
';
-}
-
-?>
-
-
-
-
-
-listTables();
-
-if ($conn->isResultSet($tableSql)) {
-
- echo '';
-
- echo '
';
-
- echo '
';
-
- echo '
';
-
- echo '';
-
- echo '
';
-
- $tableSql = $conn->listTables();
-
- echo '
';
- echo '
';
-
- echo '
';
-
-}
-
-if ($conn->getAdapter() != "sqlite") {
-
-?>
-
-
-
-query("SHOW VARIABLES LIKE 'character_set_database'");
-
-if ($conn->isResultSet($currentCharSql)) {
- $currentChar = $conn->result($currentCharSql, 0, "Value");
-}
-
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+if (isset($db)) {
+
+$conn->selectDB($db);
+
+//run delete queries
+
+if (isset($_POST['runQuery'])) {
+
+ $runQuery = $_POST['runQuery'];
+
+ $queryList = splitQueryText($runQuery);
+
+ foreach ($queryList as $query) {
+ $query = trim($query);
+
+ if ($query != "") {
+ $conn->query($query) or ($dbError = $conn->error());
+
+ // make a list of the tables that were dropped/emptied
+ if (substr($query, 0, 10) == "DROP TABLE")
+ $droppedList[] = substr($query, 12, -1);
+
+ if (substr($query, 0, 10) == "TRUNCATE `")
+ $emptiedList[] = substr($query, 10, -1);
+
+ if (substr($query, 0, 13) == "DELETE FROM '")
+ $emptiedList[] = substr($query, 13, -1);
+
+ }
+ }
+}
+
+// if tables were dropped, remove them from the side menu
+if (isset($droppedList) && isset($db)) {
+ ?>
+
+
+
+
+
+
+
+ ';
+ echo __("Error performing operation");
+ echo ' ' . $dbError . '
';
+}
+
+?>
+
+
+
+
+
+listTables();
+
+if ($conn->isResultSet($tableSql)) {
+
+ echo '';
+
+ echo '
';
+
+ echo '
';
+
+ echo '
';
+
+ echo '';
+
+ echo '
';
+
+ $tableSql = $conn->listTables();
+
+ echo '
';
+ echo '
';
+
+ echo '
';
+
+}
+
+if ($conn->getAdapter() != "sqlite") {
+
+?>
+
+
+
+query("SHOW VARIABLES LIKE 'character_set_database'");
+
+if ($conn->isResultSet($currentCharSql)) {
+ $currentChar = $conn->result($currentCharSql, 0, "Value");
+}
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/edit.php b/htdocs/sqlbuddy/edit.php
index 34542f39e..92d507c11 100755
--- a/htdocs/sqlbuddy/edit.php
+++ b/htdocs/sqlbuddy/edit.php
@@ -1,210 +1,210 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-requireDatabaseAndTableBeDefined();
-
-if (isset($db))
- $conn->selectDB($db);
-
-if (isset($table))
- $structureSql = $conn->describeTable($table);
-
-if (isset($_POST['editParts'])) {
- $editParts = $_POST['editParts'];
- $editParts = explode("; ", $editParts);
-
- $totalParts = count($editParts);
- $counter = 0;
-
- $firstField = true;
-
- ?>
-
-
-
-
-
-
-
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+requireDatabaseAndTableBeDefined();
+
+if (isset($db))
+ $conn->selectDB($db);
+
+if (isset($table))
+ $structureSql = $conn->describeTable($table);
+
+if (isset($_POST['editParts'])) {
+ $editParts = $_POST['editParts'];
+ $editParts = explode("; ", $editParts);
+
+ $totalParts = count($editParts);
+ $counter = 0;
+
+ $firstField = true;
+
+ ?>
+
+
+
+
+
+
+ isResultSet($structureSql) && $conn->getAdapter() == "mysql") {
+
+ $dataSql = $conn->query("SELECT * FROM `" . $table . "` " . $part);
+ $dataRow = $conn->fetchAssoc($dataSql);
+
+ while ($structureRow = $conn->fetchAssoc($structureSql)) {
+
+ preg_match("/^([a-z]+)(.([0-9]+).)?(.*)?$/", $structureRow['Type'], $matches);
+
+ $curtype = $matches[1];
+ $cursizeQuotes = $matches[2];
+ $cursize = $matches[3];
+ $curextra = $matches[4];
+
+ echo '';
+ echo '';
+ echo ' ';
+ echo '';
+ echo '';
+
+ $showLargeEditor[] = "text";
+ $showLargeEditor[] = "mediumtext";
+ $showLargeEditor[] = "longtext";
+
+ if (in_array($curtype, $showLargeEditor)) {
+ echo '' . htmlentities($dataRow[$structureRow['Field']], ENT_QUOTES, 'UTF-8') . ' ';
+ }
+ elseif ($curtype == "enum") {
+ $trimmed = substr($structureRow['Type'], 6, -2);
+ $listOptions = explode("','", $trimmed);
+ echo '';
+ echo ' - - - - - ';
+ foreach ($listOptions as $option) {
+ echo '' . $option . ' ';
+ }
+ echo ' ';
+ }
+ elseif ($curtype == "set") {
+ $trimmed = substr($structureRow['Type'], 5, -2);
+ $listOptions = explode("','", $trimmed);
+ foreach ($listOptions as $option) {
+ $id = $option . rand(1, 1000);
+ echo ' -1)
+ echo ' checked="checked"';
+
+ echo '>' . $option . ' ';
+ }
+ } else {
+ echo ' ';
+ }
+
+ $firstField = false;
+
+ ?>
+
+
+
+
+ describeTable($table);
+
+ } else if (sizeof($structureSql) > 0 && $conn->getAdapter() == "sqlite") {
+
+ $dataSql = $conn->query("SELECT * FROM '" . $table . "' " . $part);
+ $dataRow = $conn->fetchAssoc($dataSql);
+
+ foreach ($structureSql as $column) {
+
+ echo '';
+ echo '';
+ echo ' ';
+ echo '';
+ echo '';
+
+ if (strpos($column[1], "text") !== false) {
+ echo '' . $dataRow[$column[0]] . ' ';
+ } else {
+ echo ' ';
+ }
+
+ $firstField = false;
+
+ ?>
+
+
+
+
+ describeTable($table);
+
+ }
+
+ ?>
+
+
+
+
+
+
+
+
+ " />
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/editcolumn.php b/htdocs/sqlbuddy/editcolumn.php
index 88e079d75..cae875757 100755
--- a/htdocs/sqlbuddy/editcolumn.php
+++ b/htdocs/sqlbuddy/editcolumn.php
@@ -1,189 +1,189 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-requireDatabaseAndTableBeDefined();
-
-if (isset($db))
- $conn->selectDB($db);
-
-if (isset($db))
- $structureSql = $conn->query("SHOW FULL FIELDS FROM `$table`");
-
-if (isset($_POST['editParts']) && $conn->isResultSet($structureSql)) {
-
- $editParts = $_POST['editParts'];
-
- $editParts = explode("; ", $editParts);
-
- $totalParts = count($editParts);
- $counter = 0;
-
- $firstField = true;
-
- ?>
-
- fetchAssoc($structureSql)) {
- if (in_array($structureRow['Field'], $editParts)) {
- echo '';
- echo '
-
-
-
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+requireDatabaseAndTableBeDefined();
+
+if (isset($db))
+ $conn->selectDB($db);
+
+if (isset($db))
+ $structureSql = $conn->query("SHOW FULL FIELDS FROM `$table`");
+
+if (isset($_POST['editParts']) && $conn->isResultSet($structureSql)) {
+
+ $editParts = $_POST['editParts'];
+
+ $editParts = explode("; ", $editParts);
+
+ $totalParts = count($editParts);
+ $counter = 0;
+
+ $firstField = true;
+
+ ?>
+
+ fetchAssoc($structureSql)) {
+ if (in_array($structureRow['Field'], $editParts)) {
+ echo '';
+ echo '
+
+
+
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/edituser.php b/htdocs/sqlbuddy/edituser.php
index 248b0ee96..50615b3e6 100755
--- a/htdocs/sqlbuddy/edituser.php
+++ b/htdocs/sqlbuddy/edituser.php
@@ -1,254 +1,254 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-$conn->selectDB("mysql");
-
-if (isset($_POST['editParts'])) {
- $editParts = $_POST['editParts'];
-
- $editParts = explode("; ", $editParts);
-
- $totalParts = count($editParts);
- $counter = 0;
-
- $firstField = true;
-
- foreach ($editParts as $part) {
- $part = trim($part);
-
- if ($part != "" && $part != ";") {
-
- list($user, $host) = explode("@", $part);
-
- $userSQL = $conn->query("SELECT * FROM `user` WHERE `User`='" . $user . "' AND `Host`='" . $host . "'");
- $dbuserSQL = $conn->query("SELECT * FROM `db` WHERE `User`='" . $user . "' AND `Host`='" . $host . "'");
-
- if ($conn->isResultSet($userSQL)) {
-
- $allPrivs = true;
-
- $dbShowList = array();
-
- if ($conn->isResultSet($dbuserSQL)) {
-
- $accessLevel = "LIMITED";
-
- while ($dbuserRow = $conn->fetchAssoc($dbuserSQL)) {
- $selectedPrivs = array();
-
- $dbShowList[] = $dbuserRow['Db'];
-
- foreach ($dbuserRow as $key=>$value) {
- if (substr($key, -5) == "_priv" && $key != "Grant_priv" && $value == "N") {
- $allPrivs = false;
- }
-
- if ($value == "N")
- $selectedPrivs[$key] = $value;
- }
-
- if (isset($thePrivList)) {
- $thePrivList = array_merge($thePrivList, $selectedPrivs);
- } else {
- $thePrivList = $dbuserRow;
- }
- }
- } else {
- $accessLevel = "GLOBAL";
-
- $userRow = $conn->fetchAssoc($userSQL);
-
- foreach ($userRow as $key=>$value) {
- if (substr($key, -5) == "_priv" && $key != "Grant_priv" && $value == "N") {
- $allPrivs = false;
- }
- }
-
- $thePrivList = $userRow;
- }
-
- echo '';
- echo '
-
-
-
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+$conn->selectDB("mysql");
+
+if (isset($_POST['editParts'])) {
+ $editParts = $_POST['editParts'];
+
+ $editParts = explode("; ", $editParts);
+
+ $totalParts = count($editParts);
+ $counter = 0;
+
+ $firstField = true;
+
+ foreach ($editParts as $part) {
+ $part = trim($part);
+
+ if ($part != "" && $part != ";") {
+
+ list($user, $host) = explode("@", $part);
+
+ $userSQL = $conn->query("SELECT * FROM `user` WHERE `User`='" . $user . "' AND `Host`='" . $host . "'");
+ $dbuserSQL = $conn->query("SELECT * FROM `db` WHERE `User`='" . $user . "' AND `Host`='" . $host . "'");
+
+ if ($conn->isResultSet($userSQL)) {
+
+ $allPrivs = true;
+
+ $dbShowList = array();
+
+ if ($conn->isResultSet($dbuserSQL)) {
+
+ $accessLevel = "LIMITED";
+
+ while ($dbuserRow = $conn->fetchAssoc($dbuserSQL)) {
+ $selectedPrivs = array();
+
+ $dbShowList[] = $dbuserRow['Db'];
+
+ foreach ($dbuserRow as $key=>$value) {
+ if (substr($key, -5) == "_priv" && $key != "Grant_priv" && $value == "N") {
+ $allPrivs = false;
+ }
+
+ if ($value == "N")
+ $selectedPrivs[$key] = $value;
+ }
+
+ if (isset($thePrivList)) {
+ $thePrivList = array_merge($thePrivList, $selectedPrivs);
+ } else {
+ $thePrivList = $dbuserRow;
+ }
+ }
+ } else {
+ $accessLevel = "GLOBAL";
+
+ $userRow = $conn->fetchAssoc($userSQL);
+
+ foreach ($userRow as $key=>$value) {
+ if (substr($key, -5) == "_priv" && $key != "Grant_priv" && $value == "N") {
+ $allPrivs = false;
+ }
+ }
+
+ $thePrivList = $userRow;
+ }
+
+ echo '';
+ echo '
+
+
+
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/export.php b/htdocs/sqlbuddy/export.php
index 506252186..b8797d286 100755
--- a/htdocs/sqlbuddy/export.php
+++ b/htdocs/sqlbuddy/export.php
@@ -1,677 +1,677 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-if ($_POST) {
-
- $outputBuffer = "";
-
- if (isset($db)) {
- $dbs[] = $db;
-
- if (isset($table))
- $tables[] = $table;
- else if (isset($_POST['EXPORTTABLE']))
- $tables = $_POST['EXPORTTABLE'];
- } else {
- if (isset($_POST['EXPORTDB']))
- $dbs = $_POST['EXPORTDB'];
- $exportDb = true;
- }
-
- if (isset($_POST['FORMAT']))
- $format = strtoupper($_POST['FORMAT']);
-
- if (isset($_POST['STRUCTURE']))
- $exportStructure = $_POST['STRUCTURE'];
-
- if (isset($_POST['DATA']))
- $exportData = $_POST['DATA'];
-
- if (isset($_POST['DELIMITER']))
- $delimiter = $_POST['DELIMITER'];
-
- if (isset($_POST['FIELDNAMES']))
- $printFieldnames = $_POST['FIELDNAMES'];
-
- if (isset($_POST['INSERTTYPE']))
- $insertType = $_POST['INSERTTYPE'];
-
- if (isset($_POST['OUTPUT']))
- $output = $_POST['OUTPUT'];
-
- if (isset($_POST['OUTPUTFILETEXT'])) {
- $outputFile = "exports/" . basename($_POST['OUTPUTFILETEXT']);
- }
-
- if (!isset($delimiter) || $delimiter == "TAB")
- $delimiter = "\t";
- else if ($delimiter == "SEMICOLON")
- $delimiter = ";";
- else if ($delimiter == "SPACE")
- $delimiter = " ";
- else
- $delimiter = ",";
-
- // for the next three - it has to be one or the other
- // this way, if we get fed garbage, just go with a default
- if (!isset($format) || $format != "CSV")
- $format = "SQL";
-
- if (!isset($output) || $output != "FILE" || !isset($outputFile))
- $output = "BROWSER";
-
- if (!isset($insertType) || $insertType != "COMPLETE")
- $insertType = "COMPACT";
-
- if (isset($format) && $format == "SQL" && !isset($exportStructure) && !isset($exportData)) {
- $error = __("You must export either structure, data, or both") . ".";
- } else if (!isset($dbs)) {
- $error = __("Please select the databases that you would like to export") . ".";
- } else if (isset($db) && !isset($tables)) {
- $error = __("Please select the tables that you would like to export") . ".";
- } else {
-
- if ($format == "SQL") {
-
- $version = $conn->getVersion();
-
- $outputBuffer .= "--\r\n";
-
- if ($conn->getAdapter() == "mysql")
- $outputBuffer .= "-- MySQL " . $version . "\r\n";
- else if ($conn->getAdapter() == "sqlite")
- $outputBuffer .= "-- SQLite " . $version . "\r\n";
-
- $outputBuffer .= "-- " . date("r") . "\r\n";
- $outputBuffer .= "--\r\n\r\n";
- }
-
- foreach ($dbs as $d) {
-
- $conn->selectDB($d);
-
- // this checks to see if we are exporting an entire db with all tables
- if (isset($exportDb) && $exportDb == true) {
-
- if ($format == "SQL") {
-
- $outputBuffer .= "CREATE DATABASE `$d`";
-
- if ($conn->hasCharsetSupport())
- {
- $currentChar = "";
- $currentCharSql = $conn->query("SHOW VARIABLES LIKE 'character_set_database'");
-
- if ($conn->isResultSet($currentCharSql)) {
- $currentChar = $conn->result($currentCharSql, 0, "Value");
-
- $outputBuffer .= " DEFAULT CHARSET " . $currentChar;
- }
- }
-
- $outputBuffer .= ";\r\n\r\n";
-
- $outputBuffer .= "USE `$d`;\r\n\r\n";
-
- }
-
- $tableSql = $conn->listTables();
-
- $tables = "";
-
- if ($conn->isResultSet($tableSql)) {
- while ($tableRow = $conn->fetchArray($tableSql)) {
- $tables[] = $tableRow[0];
- }
- }
- }
-
- foreach ($tables as $t) {
-
- if ($format == "SQL") {
-
- if ($conn->getAdapter() == "mysql")
- $structureSQL = $conn->query("SHOW FULL FIELDS FROM `$t`");
- else
- $structureSQL = $conn->describeTable($t);
-
- $tableEngine = "";
- $tableCharset = "";
- $autoIncrement = "";
-
- if (isset($exportStructure)) {
-
- if ($conn->isResultSet($structureSQL)) {
-
- if ($conn->getAdapter() == "mysql") {
-
- $outputBuffer .= "CREATE TABLE `$t` (";
-
- $infoSql = $conn->query("SHOW TABLE STATUS LIKE '$t'");
-
- if ($conn->isResultSet($infoSql) == 1) {
-
- $infoRow = $conn->fetchAssoc($infoSql);
-
- $tableEngine = (array_key_exists("Type", $infoRow)) ? $infoRow['Type'] : $infoRow['Engine'];
-
- if (array_key_exists('Collation', $infoRow) && isset($collationList)) {
- $tableCharset = $collationList[$infoRow['Collation']];
- }
-
- if (array_key_exists('Auto_increment', $infoRow))
- {
- $autoIncrement = $infoRow['Auto_increment'];
- }
- }
-
- } else if ($conn->getAdapter() == "sqlite") {
-
- $outputBuffer .= "CREATE TABLE '$t' (";
- }
-
- $first = true;
-
- if ($conn->getAdapter() == "mysql") {
-
- while ($structureRow = $conn->fetchassoc($structureSQL)) {
-
- if (!$first)
- $outputBuffer .= ",";
-
- $outputBuffer .= "\r\n `" . $structureRow['Field'] . "` " . $structureRow['Type'];
-
- if (isset($collationList) && isset($structureRow['Collation']) && $structureRow['Collation'] != "NULL" && !is_null($structureRow['Collation'])) {
- if ($collationList[$structureRow['Collation']] != $tableCharset) {
- $outputBuffer .= " CHARSET " . $collationList[$structureRow['Collation']];
- }
- }
-
- if (isset($structureRow['Null']) && $structureRow['Null'] != "YES")
- $outputBuffer .= " not null";
-
- if (isset($structureRow['Default']) && $structureRow['Default'] == "CURRENT_TIMESTAMP") {
- $outputBuffer .= " default CURRENT_TIMESTAMP";
- } else if (isset($structureRow['Default']) && $structureRow['Default'] != "") {
- $outputBuffer .= " default '" . $structureRow['Default'] . "'";
- }
-
- if (isset($structureRow['Extra']) && $structureRow['Extra'] != "")
- $outputBuffer .= " " . $structureRow['Extra'];
-
- $first = false;
- }
-
- } else if ($conn->getAdapter() == "sqlite") {
-
- foreach ($structureSQL as $structureRow) {
-
- if (!$first)
- $outputBuffer .= ",";
-
- $outputBuffer .= "\r\n " . $structureRow[0] . " " . $structureRow[1];
-
- $first = false;
- }
-
- }
-
- // dont forget about the keys
- if ($conn->getAdapter() == "mysql") {
- $keySQL = $conn->query("SHOW INDEX FROM `$t`");
-
- if ($conn->isResultSet($keySQL)) {
- $currentKey = "";
- while ($keyRow = $conn->fetchAssoc($keySQL)) {
- // if this is the start of a key
- if ($keyRow['Key_name'] != $currentKey) {
- // finish off the last key first, if necessary
- if ($currentKey != "")
- $outputBuffer .= ")";
-
- if ($keyRow['Key_name'] == "PRIMARY")
- $outputBuffer .= ",\r\n PRIMARY KEY (";
- elseif ($keyRow['Non_unique'] == "0")
- $outputBuffer .= ",\r\n UNIQUE KEY (";
- else
- $outputBuffer .= ",\r\n KEY `" . $keyRow['Key_name'] . "` (";
-
- $outputBuffer .= "`" . $keyRow['Column_name'] . "`";
- } else {
- $outputBuffer .= ",`" . $keyRow['Column_name'] . "`";
- }
-
- $currentKey = $keyRow['Key_name'];
- }
-
- if (isset($currentKey) && $currentKey != "")
- $outputBuffer .= ")";
- }
- }
-
- $outputBuffer .= "\r\n)";
-
- if ($conn->getAdapter() == "mysql") {
- if ($tableEngine) {
- $outputBuffer .= ' ENGINE=' . $tableEngine;
- }
-
- if ($tableCharset) {
- $outputBuffer .= ' DEFAULT CHARSET=' . $tableCharset;
- }
-
- if ($autoIncrement)
- {
- $outputBuffer .= ' AUTO_INCREMENT=' . $autoIncrement;
- }
- }
-
- $outputBuffer .= ";\r\n\r\n";
- }
- }
-
- if ($conn->getAdapter() == "mysql")
- $structureSQL = $conn->query("SHOW FULL FIELDS FROM `$t`");
- else
- $structureSQL = $conn->describeTable($t);
-
- if (isset($exportData)) {
-
- $columnList = array();
-
- if ($conn->getAdapter() == "mysql") {
-
- $dataSQL = $conn->query("SELECT * FROM `$t`");
-
- // put the column names in an array
- if ($conn->isResultSet($structureSQL)) {
- while ($structureRow = $conn->fetchAssoc($structureSQL)) {
- $columnList[] = $structureRow['Field'];
- $type[] = $structureRow['Type'];
- }
- }
-
- $columnImplosion = implode("`, `", $columnList);
-
- if ($conn->isResultSet($dataSQL)) {
-
- if ($insertType == "COMPACT")
- $outputBuffer .= "INSERT INTO `$t` (`$columnImplosion`) VALUES \r\n";
-
- $firstLine = true;
-
- while ($dataRow = $conn->fetchAssoc($dataSQL)) {
-
- if ($insertType == "COMPLETE") {
- $outputBuffer .= "INSERT INTO `$t` (`$columnImplosion`) VALUES ";
- } else {
- if (!$firstLine)
- $outputBuffer .= ",\r\n";
- }
-
- $outputBuffer .= "(";
-
- $first = true;
-
- for ($i=0; $iescapeString($currentData) . "'";
- }
-
- $first = false;
- }
-
- $outputBuffer .= ")";
-
- if ($insertType == "COMPLETE")
- $outputBuffer .= ";\r\n";
-
- $firstLine = false;
-
- }
-
- if ($insertType == "COMPACT")
- $outputBuffer .= ";\r\n";
-
- } else {
- $outputBuffer .= "-- [" . sprintf(__("Table `%s` is empty"), $t) . "]\r\n";
- }
-
- } else if ($conn->getAdapter() == "sqlite") {
-
- $dataSQL = $conn->query("SELECT * FROM '$t'");
-
- // put the column names in an array
- if ($conn->isResultSet($structureSQL)) {
- foreach ($structureSQL as $structureRow) {
- $columnList[] = $structureRow[0];
- $type[] = $structureRow[1];
- }
- }
-
- $columnImplosion = implode("', '", $columnList);
-
- if ($conn->isResultSet($dataSQL)) {
-
- $firstLine = true;
-
- while ($dataRow = $conn->fetchAssoc($dataSQL)) {
-
- $outputBuffer .= "INSERT INTO '$t' ('$columnImplosion') VALUES (";
-
- $first = true;
-
- for ($i=0; $iescapeString($currentData) . "'";
-
- $first = false;
- }
-
- $outputBuffer .= ");\r\n";
-
- $firstLine = false;
-
- }
-
- } else {
- $outputBuffer .= "-- [" . sprintf(__("Table `%s` is empty"), $t) . "]\r\n";
- }
-
- }
- }
-
- $outputBuffer .= "\r\n";
-
- } else if ($format == "CSV") {
-
- if (isset($printFieldnames)) {
- $structureSQL = $conn->describeTable($t);
-
- if ($conn->isResultSet($structureSQL)) {
- $first = true;
-
- if ($conn->getAdapter() == "mysql") {
-
- while ($structureRow = $conn->fetchArray($structureSQL)) {
- if (!$first)
- $outputBuffer .= $delimiter;
-
- $outputBuffer .= "\"" . $structureRow[0] . "\"";
-
- $first = false;
- }
-
- } else if ($conn->getAdapter() == "sqlite") {
-
- foreach ($structureSQL as $structureRow) {
- if (!$first)
- $outputBuffer .= $delimiter;
-
- $outputBuffer .= "\"" . $structureRow[0] . "\"";
-
- $first = false;
- }
-
- }
-
- $outputBuffer .= "\r\n";
- }
- }
-
- if ($conn->getAdapter() == "mysql") {
- $dataSQL = $conn->query("SELECT * FROM `$t`");
- } else if ($conn->getAdapter() == "sqlite") {
- $dataSQL = $conn->query("SELECT * FROM '$t'");
- }
-
- if ($conn->isResultSet($dataSQL)) {
- while ($dataRow = $conn->fetchArray($dataSQL)) {
- $data = array();
- foreach ($dataRow as $each) {
- $data[] = "\"" . formatDataForCSV($each) . "\"";
- }
-
- $dataLine = implode($delimiter, $data);
-
- $outputBuffer .= $dataLine . "\r\n";
- }
- }
-
- }
-
- }
-
- }
-
- $outputBuffer = trim($outputBuffer);
-
- if ($outputBuffer) {
- if ($output == "BROWSER") {
- echo "";
- echo "
" . __("Results:") . " [
" . __("Select all") . " ]";
- echo "
" . htmlentities($outputBuffer, ENT_QUOTES, 'UTF-8') . " ";
- echo "
";
- } else {
-
- if (!$handle = @fopen($outputFile, "w")) {
- $error = __("The file could not be opened") . ".";
- } else {
- if (fwrite($handle, $outputBuffer) === false) {
- $error = __("Could not write to file") . ".";
- } else {
- echo '';
- echo __("Successfully wrote content to file") . '.
' . __("Download") . ' ' . __("Note") . ': ' . __("If this is a public server, you should delete this file from the server after you download it") . '.
';
- }
- }
-
- @fclose($handle);
-
- }
- }
-
- }
-}
-
-if (isset($error)) {
- echo '' . $error . '
';
-}
-
-?>
-
-';
-
- ?>
-
-
-
-
-
-
-
-
-
-
-
+
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+if ($_POST) {
+
+ $outputBuffer = "";
+
+ if (isset($db)) {
+ $dbs[] = $db;
+
+ if (isset($table))
+ $tables[] = $table;
+ else if (isset($_POST['EXPORTTABLE']))
+ $tables = $_POST['EXPORTTABLE'];
+ } else {
+ if (isset($_POST['EXPORTDB']))
+ $dbs = $_POST['EXPORTDB'];
+ $exportDb = true;
+ }
+
+ if (isset($_POST['FORMAT']))
+ $format = strtoupper($_POST['FORMAT']);
+
+ if (isset($_POST['STRUCTURE']))
+ $exportStructure = $_POST['STRUCTURE'];
+
+ if (isset($_POST['DATA']))
+ $exportData = $_POST['DATA'];
+
+ if (isset($_POST['DELIMITER']))
+ $delimiter = $_POST['DELIMITER'];
+
+ if (isset($_POST['FIELDNAMES']))
+ $printFieldnames = $_POST['FIELDNAMES'];
+
+ if (isset($_POST['INSERTTYPE']))
+ $insertType = $_POST['INSERTTYPE'];
+
+ if (isset($_POST['OUTPUT']))
+ $output = $_POST['OUTPUT'];
+
+ if (isset($_POST['OUTPUTFILETEXT'])) {
+ $outputFile = "exports/" . basename($_POST['OUTPUTFILETEXT']);
+ }
+
+ if (!isset($delimiter) || $delimiter == "TAB")
+ $delimiter = "\t";
+ else if ($delimiter == "SEMICOLON")
+ $delimiter = ";";
+ else if ($delimiter == "SPACE")
+ $delimiter = " ";
+ else
+ $delimiter = ",";
+
+ // for the next three - it has to be one or the other
+ // this way, if we get fed garbage, just go with a default
+ if (!isset($format) || $format != "CSV")
+ $format = "SQL";
+
+ if (!isset($output) || $output != "FILE" || !isset($outputFile))
+ $output = "BROWSER";
+
+ if (!isset($insertType) || $insertType != "COMPLETE")
+ $insertType = "COMPACT";
+
+ if (isset($format) && $format == "SQL" && !isset($exportStructure) && !isset($exportData)) {
+ $error = __("You must export either structure, data, or both") . ".";
+ } else if (!isset($dbs)) {
+ $error = __("Please select the databases that you would like to export") . ".";
+ } else if (isset($db) && !isset($tables)) {
+ $error = __("Please select the tables that you would like to export") . ".";
+ } else {
+
+ if ($format == "SQL") {
+
+ $version = $conn->getVersion();
+
+ $outputBuffer .= "--\r\n";
+
+ if ($conn->getAdapter() == "mysql")
+ $outputBuffer .= "-- MySQL " . $version . "\r\n";
+ else if ($conn->getAdapter() == "sqlite")
+ $outputBuffer .= "-- SQLite " . $version . "\r\n";
+
+ $outputBuffer .= "-- " . date("r") . "\r\n";
+ $outputBuffer .= "--\r\n\r\n";
+ }
+
+ foreach ($dbs as $d) {
+
+ $conn->selectDB($d);
+
+ // this checks to see if we are exporting an entire db with all tables
+ if (isset($exportDb) && $exportDb == true) {
+
+ if ($format == "SQL") {
+
+ $outputBuffer .= "CREATE DATABASE `$d`";
+
+ if ($conn->hasCharsetSupport())
+ {
+ $currentChar = "";
+ $currentCharSql = $conn->query("SHOW VARIABLES LIKE 'character_set_database'");
+
+ if ($conn->isResultSet($currentCharSql)) {
+ $currentChar = $conn->result($currentCharSql, 0, "Value");
+
+ $outputBuffer .= " DEFAULT CHARSET " . $currentChar;
+ }
+ }
+
+ $outputBuffer .= ";\r\n\r\n";
+
+ $outputBuffer .= "USE `$d`;\r\n\r\n";
+
+ }
+
+ $tableSql = $conn->listTables();
+
+ $tables = "";
+
+ if ($conn->isResultSet($tableSql)) {
+ while ($tableRow = $conn->fetchArray($tableSql)) {
+ $tables[] = $tableRow[0];
+ }
+ }
+ }
+
+ foreach ($tables as $t) {
+
+ if ($format == "SQL") {
+
+ if ($conn->getAdapter() == "mysql")
+ $structureSQL = $conn->query("SHOW FULL FIELDS FROM `$t`");
+ else
+ $structureSQL = $conn->describeTable($t);
+
+ $tableEngine = "";
+ $tableCharset = "";
+ $autoIncrement = "";
+
+ if (isset($exportStructure)) {
+
+ if ($conn->isResultSet($structureSQL)) {
+
+ if ($conn->getAdapter() == "mysql") {
+
+ $outputBuffer .= "CREATE TABLE `$t` (";
+
+ $infoSql = $conn->query("SHOW TABLE STATUS LIKE '$t'");
+
+ if ($conn->isResultSet($infoSql) == 1) {
+
+ $infoRow = $conn->fetchAssoc($infoSql);
+
+ $tableEngine = (array_key_exists("Type", $infoRow)) ? $infoRow['Type'] : $infoRow['Engine'];
+
+ if (array_key_exists('Collation', $infoRow) && isset($collationList)) {
+ $tableCharset = $collationList[$infoRow['Collation']];
+ }
+
+ if (array_key_exists('Auto_increment', $infoRow))
+ {
+ $autoIncrement = $infoRow['Auto_increment'];
+ }
+ }
+
+ } else if ($conn->getAdapter() == "sqlite") {
+
+ $outputBuffer .= "CREATE TABLE '$t' (";
+ }
+
+ $first = true;
+
+ if ($conn->getAdapter() == "mysql") {
+
+ while ($structureRow = $conn->fetchassoc($structureSQL)) {
+
+ if (!$first)
+ $outputBuffer .= ",";
+
+ $outputBuffer .= "\r\n `" . $structureRow['Field'] . "` " . $structureRow['Type'];
+
+ if (isset($collationList) && isset($structureRow['Collation']) && $structureRow['Collation'] != "NULL" && !is_null($structureRow['Collation'])) {
+ if ($collationList[$structureRow['Collation']] != $tableCharset) {
+ $outputBuffer .= " CHARSET " . $collationList[$structureRow['Collation']];
+ }
+ }
+
+ if (isset($structureRow['Null']) && $structureRow['Null'] != "YES")
+ $outputBuffer .= " not null";
+
+ if (isset($structureRow['Default']) && $structureRow['Default'] == "CURRENT_TIMESTAMP") {
+ $outputBuffer .= " default CURRENT_TIMESTAMP";
+ } else if (isset($structureRow['Default']) && $structureRow['Default'] != "") {
+ $outputBuffer .= " default '" . $structureRow['Default'] . "'";
+ }
+
+ if (isset($structureRow['Extra']) && $structureRow['Extra'] != "")
+ $outputBuffer .= " " . $structureRow['Extra'];
+
+ $first = false;
+ }
+
+ } else if ($conn->getAdapter() == "sqlite") {
+
+ foreach ($structureSQL as $structureRow) {
+
+ if (!$first)
+ $outputBuffer .= ",";
+
+ $outputBuffer .= "\r\n " . $structureRow[0] . " " . $structureRow[1];
+
+ $first = false;
+ }
+
+ }
+
+ // dont forget about the keys
+ if ($conn->getAdapter() == "mysql") {
+ $keySQL = $conn->query("SHOW INDEX FROM `$t`");
+
+ if ($conn->isResultSet($keySQL)) {
+ $currentKey = "";
+ while ($keyRow = $conn->fetchAssoc($keySQL)) {
+ // if this is the start of a key
+ if ($keyRow['Key_name'] != $currentKey) {
+ // finish off the last key first, if necessary
+ if ($currentKey != "")
+ $outputBuffer .= ")";
+
+ if ($keyRow['Key_name'] == "PRIMARY")
+ $outputBuffer .= ",\r\n PRIMARY KEY (";
+ elseif ($keyRow['Non_unique'] == "0")
+ $outputBuffer .= ",\r\n UNIQUE KEY (";
+ else
+ $outputBuffer .= ",\r\n KEY `" . $keyRow['Key_name'] . "` (";
+
+ $outputBuffer .= "`" . $keyRow['Column_name'] . "`";
+ } else {
+ $outputBuffer .= ",`" . $keyRow['Column_name'] . "`";
+ }
+
+ $currentKey = $keyRow['Key_name'];
+ }
+
+ if (isset($currentKey) && $currentKey != "")
+ $outputBuffer .= ")";
+ }
+ }
+
+ $outputBuffer .= "\r\n)";
+
+ if ($conn->getAdapter() == "mysql") {
+ if ($tableEngine) {
+ $outputBuffer .= ' ENGINE=' . $tableEngine;
+ }
+
+ if ($tableCharset) {
+ $outputBuffer .= ' DEFAULT CHARSET=' . $tableCharset;
+ }
+
+ if ($autoIncrement)
+ {
+ $outputBuffer .= ' AUTO_INCREMENT=' . $autoIncrement;
+ }
+ }
+
+ $outputBuffer .= ";\r\n\r\n";
+ }
+ }
+
+ if ($conn->getAdapter() == "mysql")
+ $structureSQL = $conn->query("SHOW FULL FIELDS FROM `$t`");
+ else
+ $structureSQL = $conn->describeTable($t);
+
+ if (isset($exportData)) {
+
+ $columnList = array();
+
+ if ($conn->getAdapter() == "mysql") {
+
+ $dataSQL = $conn->query("SELECT * FROM `$t`");
+
+ // put the column names in an array
+ if ($conn->isResultSet($structureSQL)) {
+ while ($structureRow = $conn->fetchAssoc($structureSQL)) {
+ $columnList[] = $structureRow['Field'];
+ $type[] = $structureRow['Type'];
+ }
+ }
+
+ $columnImplosion = implode("`, `", $columnList);
+
+ if ($conn->isResultSet($dataSQL)) {
+
+ if ($insertType == "COMPACT")
+ $outputBuffer .= "INSERT INTO `$t` (`$columnImplosion`) VALUES \r\n";
+
+ $firstLine = true;
+
+ while ($dataRow = $conn->fetchAssoc($dataSQL)) {
+
+ if ($insertType == "COMPLETE") {
+ $outputBuffer .= "INSERT INTO `$t` (`$columnImplosion`) VALUES ";
+ } else {
+ if (!$firstLine)
+ $outputBuffer .= ",\r\n";
+ }
+
+ $outputBuffer .= "(";
+
+ $first = true;
+
+ for ($i=0; $iescapeString($currentData) . "'";
+ }
+
+ $first = false;
+ }
+
+ $outputBuffer .= ")";
+
+ if ($insertType == "COMPLETE")
+ $outputBuffer .= ";\r\n";
+
+ $firstLine = false;
+
+ }
+
+ if ($insertType == "COMPACT")
+ $outputBuffer .= ";\r\n";
+
+ } else {
+ $outputBuffer .= "-- [" . sprintf(__("Table `%s` is empty"), $t) . "]\r\n";
+ }
+
+ } else if ($conn->getAdapter() == "sqlite") {
+
+ $dataSQL = $conn->query("SELECT * FROM '$t'");
+
+ // put the column names in an array
+ if ($conn->isResultSet($structureSQL)) {
+ foreach ($structureSQL as $structureRow) {
+ $columnList[] = $structureRow[0];
+ $type[] = $structureRow[1];
+ }
+ }
+
+ $columnImplosion = implode("', '", $columnList);
+
+ if ($conn->isResultSet($dataSQL)) {
+
+ $firstLine = true;
+
+ while ($dataRow = $conn->fetchAssoc($dataSQL)) {
+
+ $outputBuffer .= "INSERT INTO '$t' ('$columnImplosion') VALUES (";
+
+ $first = true;
+
+ for ($i=0; $iescapeString($currentData) . "'";
+
+ $first = false;
+ }
+
+ $outputBuffer .= ");\r\n";
+
+ $firstLine = false;
+
+ }
+
+ } else {
+ $outputBuffer .= "-- [" . sprintf(__("Table `%s` is empty"), $t) . "]\r\n";
+ }
+
+ }
+ }
+
+ $outputBuffer .= "\r\n";
+
+ } else if ($format == "CSV") {
+
+ if (isset($printFieldnames)) {
+ $structureSQL = $conn->describeTable($t);
+
+ if ($conn->isResultSet($structureSQL)) {
+ $first = true;
+
+ if ($conn->getAdapter() == "mysql") {
+
+ while ($structureRow = $conn->fetchArray($structureSQL)) {
+ if (!$first)
+ $outputBuffer .= $delimiter;
+
+ $outputBuffer .= "\"" . $structureRow[0] . "\"";
+
+ $first = false;
+ }
+
+ } else if ($conn->getAdapter() == "sqlite") {
+
+ foreach ($structureSQL as $structureRow) {
+ if (!$first)
+ $outputBuffer .= $delimiter;
+
+ $outputBuffer .= "\"" . $structureRow[0] . "\"";
+
+ $first = false;
+ }
+
+ }
+
+ $outputBuffer .= "\r\n";
+ }
+ }
+
+ if ($conn->getAdapter() == "mysql") {
+ $dataSQL = $conn->query("SELECT * FROM `$t`");
+ } else if ($conn->getAdapter() == "sqlite") {
+ $dataSQL = $conn->query("SELECT * FROM '$t'");
+ }
+
+ if ($conn->isResultSet($dataSQL)) {
+ while ($dataRow = $conn->fetchArray($dataSQL)) {
+ $data = array();
+ foreach ($dataRow as $each) {
+ $data[] = "\"" . formatDataForCSV($each) . "\"";
+ }
+
+ $dataLine = implode($delimiter, $data);
+
+ $outputBuffer .= $dataLine . "\r\n";
+ }
+ }
+
+ }
+
+ }
+
+ }
+
+ $outputBuffer = trim($outputBuffer);
+
+ if ($outputBuffer) {
+ if ($output == "BROWSER") {
+ echo "";
+ echo "
" . __("Results:") . " [
" . __("Select all") . " ]";
+ echo "
" . htmlentities($outputBuffer, ENT_QUOTES, 'UTF-8') . " ";
+ echo "
";
+ } else {
+
+ if (!$handle = @fopen($outputFile, "w")) {
+ $error = __("The file could not be opened") . ".";
+ } else {
+ if (fwrite($handle, $outputBuffer) === false) {
+ $error = __("Could not write to file") . ".";
+ } else {
+ echo '';
+ echo __("Successfully wrote content to file") . '.
' . __("Download") . ' ' . __("Note") . ': ' . __("If this is a public server, you should delete this file from the server after you download it") . '.
';
+ }
+ }
+
+ @fclose($handle);
+
+ }
+ }
+
+ }
+}
+
+if (isset($error)) {
+ echo '' . $error . '
';
+}
+
+?>
+
+';
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/functions.php b/htdocs/sqlbuddy/functions.php
index e0d8b748b..775fd44fa 100755
--- a/htdocs/sqlbuddy/functions.php
+++ b/htdocs/sqlbuddy/functions.php
@@ -1,559 +1,568 @@
-
-
-*/
-
-error_reporting(E_ALL);
-
-if (function_exists('date_default_timezone_set'))
- date_default_timezone_set('Greenwich');
-
-if (!session_id())
- session_start();
-
-define("MAIN_DIR", dirname(__FILE__) . "/");
-define("INCLUDES_DIR", MAIN_DIR . "includes/");
-
-include MAIN_DIR . "config.php";
-include INCLUDES_DIR . "types.php";
-include INCLUDES_DIR . "class/GetTextReader.php";
-
-if (version_compare(PHP_VERSION, "5.0.0", "<"))
- include INCLUDES_DIR . "class/Sql-php4.php";
-else
- include INCLUDES_DIR . "class/Sql.php";
-
-define("VERSION_NUMBER", "1.3.2");
-define("PREVIEW_CHAR_SIZE", 75);
-
-$adapterList[] = "mysql";
-
-if (function_exists("sqlite_open") || (class_exists("PDO") && in_array("sqlite", PDO::getAvailableDrivers()))) {
- $adapterList[] = "sqlite";
-}
-
-$cookieLength = time() + (60*24*60*60);
-
-$langList['ms_ID'] = "Bahasa Melayu";
-$langList['ca_AD'] = "Català";
-$langList['cs_CZ'] = "Čeština";
-$langList['sr_RS'] = "Српски ћирилица";
-$langList['da_DK'] = "Danish";
-$langList['de_DE'] = "Deutsch";
-$langList['en_US'] = "English";
-$langList['es_ES'] = "Español";
-$langList['es_AR'] = "Español (Argentina)";
-$langList['eo_EO'] = "Esperanto";
-$langList['fr_FR'] = "Français";
-$langList['gl_ES'] = "Galego";
-$langList['id_ID'] = "Indonesian";
-$langList['it_IT'] = "Italiano";
-$langList['he_IL'] = "Ivrit";
-$langList['lo_LA'] = "Lao";
-$langList['lv_LV'] = "Latviešu";
-$langList['hu_HU'] = "Magyar";
-$langList['nl_NL'] = "Nederlands";
-$langList['pl_PL'] = "Polski";
-$langList['pt_BR'] = "Português (Brasil)";
-$langList['pt_PT'] = "Português (Portugal)";
-$langList['ru_RU'] = "Русский";
-$langList['ro_RO'] = "Română";
-$langList['sk_SK'] = "Slovenčina";
-$langList['sl_SL'] = "Slovenščina";
-$langList['sp_RS'] = "Srpski";
-$langList['fi_FI'] = "Suomi";
-$langList['sv_SE'] = "Svenska";
-$langList['tl_PH'] = "Tagalog";
-$langList['vi_VN'] = "Tiếng Việt";
-$langList['tr_TR'] = "Türkçe";
-$langList['uk_UA'] = "Українська";
-$langList['ar_DZ'] = "العربية";
-$langList['fa_IR'] = "فارسی";
-$langList['zh_CN'] = "中文 (简体)";
-$langList['zh_TW'] = "中文 (繁體)";
-$langList['ja_JP'] = "日本語";
-
-if (isset($_COOKIE['sb_lang']) && array_key_exists($_COOKIE['sb_lang'], $langList)) {
- $lang = preg_replace("/[^a-z0-9_]/i", "", $_COOKIE['sb_lang']);
-} else {
- $lang = "en_US";
-}
-
-if ($lang != "en_US") {
- // extend the cookie length
- setcookie("sb_lang", $lang, $cookieLength);
-} else if (isset($_COOKIE['sb_lang'])) {
- // cookie not needed for en_US
- setcookie("sb_lang", "", time() - 10000);
-}
-
-$themeList["classic"] = "Classic";
-$themeList["bittersweet"] = "Bittersweet";
-
-if (isset($_COOKIE['sb_theme'])) {
- $currentTheme = preg_replace("/[^a-z0-9_]/i", "", $_COOKIE['sb_theme']);
-
- if (array_key_exists($currentTheme, $themeList)) {
- $theme = $currentTheme;
-
- // extend the cookie length
- setcookie("sb_theme", $theme, $cookieLength);
- } else {
- $theme = "bittersweet";
- setcookie("sb_theme", "", time() - 10000);
- }
-} else {
- $theme = "bittersweet";
-}
-
-$gt = new GetTextReader($lang . ".pot");
-
-if (isset($_SESSION['SB_LOGIN_STRING'])) {
- $user = (isset($_SESSION['SB_LOGIN_USER'])) ? $_SESSION['SB_LOGIN_USER'] : "";
- $pass = (isset($_SESSION['SB_LOGIN_PASS'])) ? $_SESSION['SB_LOGIN_PASS'] : "";
- $conn = new SQL($_SESSION['SB_LOGIN_STRING'], $user, $pass);
-}
-
-// unique identifer for this session, to validate ajax requests.
-// document root is included because it is likely a difficult value
-// for potential attackers to guess
-$requestKey = substr(md5(session_id() . $_SERVER["DOCUMENT_ROOT"]), 0, 16);
-
-if (isset($conn) && $conn->isConnected()) {
- if (isset($_GET['db']))
- $db = $conn->escapeString($_GET['db']);
-
- if (isset($_GET['table']))
- $table = $conn->escapeString($_GET['table']);
-
- if ($conn->hasCharsetSupport()) {
-
- $charsetSql = $conn->listCharset();
- if ($conn->isResultSet($charsetSql)) {
- while ($charsetRow = $conn->fetchAssoc($charsetSql)) {
- $charsetList[] = $charsetRow['Charset'];
- }
- }
-
- $collationSql = $conn->listCollation();
- if ($conn->isResultSet($collationSql)) {
- while ($collationRow = $conn->fetchAssoc($collationSql)) {
- $collationList[$collationRow['Collation']] = $collationRow['Charset'];
- }
- }
- }
-}
-
-// undo magic quotes, if necessary
-if (get_magic_quotes_gpc()) {
- $_GET = stripslashesFromArray($_GET);
- $_POST = stripslashesFromArray($_POST);
- $_COOKIE = stripslashesFromArray($_COOKIE);
- $_REQUEST = stripslashesFromArray($_REQUEST);
-}
-
-function stripslashesFromArray($value) {
- $value = is_array($value) ?
- array_map('stripslashesFromArray', $value) :
- stripslashes($value);
-
- return $value;
-}
-
-function loginCheck($validateReq = true) {
- if (!isset($_SESSION['SB_LOGIN'])){
- if (isset($_GET['ajaxRequest']))
- redirect("login.php?timeout=1");
- else
- redirect("login.php");
- exit;
- }
- if ($validateReq) {
- if (!validateRequest()) {
- exit;
- }
- }
-
- startOutput();
-}
-
-function redirect($url) {
- if (isset($_GET['ajaxRequest']) || headers_sent()) {
- global $requestKey;
- ?>
-
- isConnected()) {
- $conn->disconnect();
- unset($conn);
- }
-}
-
-function outputPage() {
-
-global $requestKey;
-global $sbconfig;
-global $conn;
-global $lang;
-
-?>
-
-
-
- SQL Buddy
-
- " media="all" />
- " media="all" />
- " media="print" />
- " media="all" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PREVIEW_CHAR_SIZE) {
- $text = utf8_substr($text, 0, PREVIEW_CHAR_SIZE) . " [...] ";
- }
- return $text;
-}
-
-function formatDataForCSV($text) {
- $text = str_replace('"', '""', $text);
- return $text;
-}
-
-function splitQueryText($query) {
- // the regex needs a trailing semicolon
- $query = trim($query);
-
- if (substr($query, -1) != ";")
- $query .= ";";
-
- // i spent 3 days figuring out this line
- preg_match_all("/(?>[^;']|(''|(?>'([^']|\\')*[^\\\]')))+;/ixU", $query, $matches, PREG_SET_ORDER);
-
- $querySplit = "";
-
- foreach ($matches as $match) {
- // get rid of the trailing semicolon
- $querySplit[] = substr($match[0], 0, -1);
- }
-
- return $querySplit;
-}
-
-function memoryFormat($bytes) {
- if ($bytes < 1024)
- $dataString = $bytes . " B";
- else if ($bytes < (1024 * 1024))
- $dataString = round($bytes / 1024) . " KB";
- else if ($bytes < (1024 * 1024 * 1024))
- $dataString = round($bytes / (1024 * 1024)) . " MB";
- else
- $dataString = round($bytes / (1024 * 1024 * 1024)) . " GB";
-
- return $dataString;
-}
-
-function themeFile($filename) {
- global $theme;
- return smartCaching("themes/" . $theme . "/" . $filename);
-}
-
-function smartCaching($filename) {
- return $filename . "?ver=" . str_replace(".", "_", VERSION_NUMBER);
-}
-
-function __($t) {
- global $gt;
- return $gt->getTranslation($t);
-}
-
-function __p($singular, $plural, $count) {
- global $gt;
- if ($count == 1) {
- return $gt->getTranslation($singular);
- } else {
- return $gt->getTranslation($plural);
- }
-}
-
-function utf8_substr($str, $from, $len) {
-# utf8 substr
-# www.yeap.lv
- return preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$from.'}'.
- '((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$len.'}).*#s',
- '$1',$str);
-}
-
-function utf8_strlen($str) {
- $i = 0;
- $count = 0;
- $len = strlen ($str);
- while ($i < $len) {
- $chr = ord ($str[$i]);
- $count++;
- $i++;
- if ($i >= $len)
- break;
-
- if ($chr & 0x80) {
- $chr <<= 1;
- while ($chr & 0x80) {
- $i++;
- $chr <<= 1;
- }
- }
- }
- return $count;
-}
-
-function microtime_float() {
- list($usec, $sec) = explode(" ", microtime());
- return ((float)$usec + (float)$sec);
-}
-
+
+
+*/
+
+error_reporting(E_ALL);
+
+if (function_exists('date_default_timezone_set'))
+ date_default_timezone_set('Greenwich');
+
+if (!session_id())
+ session_start();
+
+define("MAIN_DIR", dirname(__FILE__) . "/");
+define("INCLUDES_DIR", MAIN_DIR . "includes/");
+
+include MAIN_DIR . "config.php";
+include INCLUDES_DIR . "types.php";
+include INCLUDES_DIR . "class/GetTextReader.php";
+
+if (version_compare(PHP_VERSION, "5.0.0", "<"))
+ include INCLUDES_DIR . "class/Sql-php4.php";
+else
+ include INCLUDES_DIR . "class/Sql.php";
+
+define("VERSION_NUMBER", "1.3.3");
+define("PREVIEW_CHAR_SIZE", 75);
+
+$adapterList[] = "mysql";
+
+if (function_exists("sqlite_open") || (class_exists("PDO") && in_array("sqlite", PDO::getAvailableDrivers()))) {
+ $adapterList[] = "sqlite";
+}
+
+$cookieLength = time() + (60*24*60*60);
+
+$langList['id_ID'] = "Bahasa Indonesia";
+$langList['ms_ID'] = "Bahasa Melayu";
+$langList['ca_AD'] = "Català";
+$langList['cs_CZ'] = "Čeština";
+$langList['sr_RS'] = "Српски ћирилица";
+$langList['da_DK'] = "Dansk";
+$langList['de_DE'] = "Deutsch";
+$langList['et_EE'] = "Eesti keel";
+$langList['en_US'] = "English";
+$langList['es_ES'] = "Español";
+$langList['es_AR'] = "Español (Argentina)";
+$langList['eo_EO'] = "Esperanto";
+$langList['fr_FR'] = "Français";
+$langList['gl_ES'] = "Galego";
+$langList['hr_HR'] = "Hrvatski";
+$langList['it_IT'] = "Italiano";
+$langList['ko_KR'] = "한국어";
+$langList['lo_LA'] = "Lao";
+$langList['lv_LV'] = "Latviešu";
+$langList['hu_HU'] = "Magyar";
+$langList['nl_NL'] = "Nederlands";
+$langList['no_NO'] = "Norsk";
+$langList['pl_PL'] = "Polski";
+$langList['pt_BR'] = "Português (Brasil)";
+$langList['pt_PT'] = "Português (Portugal)";
+$langList['ru_RU'] = "Русский";
+$langList['ro_RO'] = "Română";
+$langList['sq_AL'] = "Shqip";
+$langList['sk_SK'] = "Slovenčina";
+$langList['sl_SL'] = "Slovenščina";
+$langList['sp_RS'] = "Srpski";
+$langList['fi_FI'] = "Suomi";
+$langList['sv_SE'] = "Svenska";
+$langList['tl_PH'] = "Tagalog";
+$langList['vi_VN'] = "Tiếng Việt";
+$langList['tr_TR'] = "Türkçe";
+$langList['uk_UA'] = "Українська";
+$langList['ar_DZ'] = "العربية";
+$langList['fa_IR'] = "فارسی";
+$langList['he_IL'] = "עִבְרִית";
+$langList['bg_BG'] = "български език";
+$langList['bn_BD'] = "বাংলা";
+$langList['el_GR'] = "ελληνικά";
+$langList['th_TH'] = "ภาษาไทย";
+$langList['zh_CN'] = "中文 (简体)";
+$langList['zh_TW'] = "中文 (繁體)";
+$langList['ja_JP'] = "日本語";
+
+if (isset($_COOKIE['sb_lang']) && array_key_exists($_COOKIE['sb_lang'], $langList)) {
+ $lang = preg_replace("/[^a-z0-9_]/i", "", $_COOKIE['sb_lang']);
+} else {
+ $lang = "en_US";
+}
+
+if ($lang != "en_US") {
+ // extend the cookie length
+ setcookie("sb_lang", $lang, $cookieLength);
+} else if (isset($_COOKIE['sb_lang'])) {
+ // cookie not needed for en_US
+ setcookie("sb_lang", "", time() - 10000);
+}
+
+$themeList["classic"] = "Classic";
+$themeList["bittersweet"] = "Bittersweet";
+
+if (isset($_COOKIE['sb_theme'])) {
+ $currentTheme = preg_replace("/[^a-z0-9_]/i", "", $_COOKIE['sb_theme']);
+
+ if (array_key_exists($currentTheme, $themeList)) {
+ $theme = $currentTheme;
+
+ // extend the cookie length
+ setcookie("sb_theme", $theme, $cookieLength);
+ } else {
+ $theme = "bittersweet";
+ setcookie("sb_theme", "", time() - 10000);
+ }
+} else {
+ $theme = "bittersweet";
+}
+
+$gt = new GetTextReader($lang . ".pot");
+
+if (isset($_SESSION['SB_LOGIN_STRING'])) {
+ $user = (isset($_SESSION['SB_LOGIN_USER'])) ? $_SESSION['SB_LOGIN_USER'] : "";
+ $pass = (isset($_SESSION['SB_LOGIN_PASS'])) ? $_SESSION['SB_LOGIN_PASS'] : "";
+ $conn = new SQL($_SESSION['SB_LOGIN_STRING'], $user, $pass);
+}
+
+// unique identifer for this session, to validate ajax requests.
+// document root is included because it is likely a difficult value
+// for potential attackers to guess
+$requestKey = substr(md5(session_id() . $_SERVER["DOCUMENT_ROOT"]), 0, 16);
+
+if (isset($conn) && $conn->isConnected()) {
+ if (isset($_GET['db']))
+ $db = $conn->escapeString($_GET['db']);
+
+ if (isset($_GET['table']))
+ $table = $conn->escapeString($_GET['table']);
+
+ if ($conn->hasCharsetSupport()) {
+
+ $charsetSql = $conn->listCharset();
+ if ($conn->isResultSet($charsetSql)) {
+ while ($charsetRow = $conn->fetchAssoc($charsetSql)) {
+ $charsetList[] = $charsetRow['Charset'];
+ }
+ }
+
+ $collationSql = $conn->listCollation();
+ if ($conn->isResultSet($collationSql)) {
+ while ($collationRow = $conn->fetchAssoc($collationSql)) {
+ $collationList[$collationRow['Collation']] = $collationRow['Charset'];
+ }
+ }
+ }
+}
+
+// undo magic quotes, if necessary
+if (get_magic_quotes_gpc()) {
+ $_GET = stripslashesFromArray($_GET);
+ $_POST = stripslashesFromArray($_POST);
+ $_COOKIE = stripslashesFromArray($_COOKIE);
+ $_REQUEST = stripslashesFromArray($_REQUEST);
+}
+
+function stripslashesFromArray($value) {
+ $value = is_array($value) ?
+ array_map('stripslashesFromArray', $value) :
+ stripslashes($value);
+
+ return $value;
+}
+
+function loginCheck($validateReq = true) {
+ if (!isset($_SESSION['SB_LOGIN'])){
+ if (isset($_GET['ajaxRequest']))
+ redirect("login.php?timeout=1");
+ else
+ redirect("login.php");
+ exit;
+ }
+ if ($validateReq) {
+ if (!validateRequest()) {
+ exit;
+ }
+ }
+
+ startOutput();
+}
+
+function redirect($url) {
+ if (isset($_GET['ajaxRequest']) || headers_sent()) {
+ global $requestKey;
+ ?>
+
+ isConnected()) {
+ $conn->disconnect();
+ unset($conn);
+ }
+}
+
+function outputPage() {
+
+global $requestKey;
+global $sbconfig;
+global $conn;
+global $lang;
+
+?>
+
+
+
+ SQL Buddy
+
+ " media="all" />
+ " media="all" />
+ " media="print" />
+ " media="all" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PREVIEW_CHAR_SIZE) {
+ $text = utf8_substr($text, 0, PREVIEW_CHAR_SIZE) . " [...] ";
+ }
+ return $text;
+}
+
+function formatDataForCSV($text) {
+ $text = str_replace('"', '""', $text);
+ return $text;
+}
+
+function splitQueryText($query) {
+ // the regex needs a trailing semicolon
+ $query = trim($query);
+
+ if (substr($query, -1) != ";")
+ $query .= ";";
+
+ // i spent 3 days figuring out this line
+ preg_match_all("/(?>[^;']|(''|(?>'([^']|\\')*[^\\\]')))+;/ixU", $query, $matches, PREG_SET_ORDER);
+
+ $querySplit = "";
+
+ foreach ($matches as $match) {
+ // get rid of the trailing semicolon
+ $querySplit[] = substr($match[0], 0, -1);
+ }
+
+ return $querySplit;
+}
+
+function memoryFormat($bytes) {
+ if ($bytes < 1024)
+ $dataString = $bytes . " B";
+ else if ($bytes < (1024 * 1024))
+ $dataString = round($bytes / 1024) . " KB";
+ else if ($bytes < (1024 * 1024 * 1024))
+ $dataString = round($bytes / (1024 * 1024)) . " MB";
+ else
+ $dataString = round($bytes / (1024 * 1024 * 1024)) . " GB";
+
+ return $dataString;
+}
+
+function themeFile($filename) {
+ global $theme;
+ return smartCaching("themes/" . $theme . "/" . $filename);
+}
+
+function smartCaching($filename) {
+ return $filename . "?ver=" . str_replace(".", "_", VERSION_NUMBER);
+}
+
+function __($t) {
+ global $gt;
+ return $gt->getTranslation($t);
+}
+
+function __p($singular, $plural, $count) {
+ global $gt;
+ if ($count == 1) {
+ return $gt->getTranslation($singular);
+ } else {
+ return $gt->getTranslation($plural);
+ }
+}
+
+function utf8_substr($str, $from, $len) {
+# utf8 substr
+# www.yeap.lv
+ return preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$from.'}'.
+ '((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$len.'}).*#s',
+ '$1',$str);
+}
+
+function utf8_strlen($str) {
+ $i = 0;
+ $count = 0;
+ $len = strlen ($str);
+ while ($i < $len) {
+ $chr = ord ($str[$i]);
+ $count++;
+ $i++;
+ if ($i >= $len)
+ break;
+
+ if ($chr & 0x80) {
+ $chr <<= 1;
+ while ($chr & 0x80) {
+ $i++;
+ $chr <<= 1;
+ }
+ }
+ }
+ return $count;
+}
+
+function microtime_float() {
+ list($usec, $sec) = explode(" ", microtime());
+ return ((float)$usec + (float)$sec);
+}
+
?>
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/home.php b/htdocs/sqlbuddy/home.php
index 139befefe..7b9720e77 100755
--- a/htdocs/sqlbuddy/home.php
+++ b/htdocs/sqlbuddy/home.php
@@ -1,311 +1,311 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-?>
-';
- windowHeader.set('html', windowHeaderContent);
- windowMain.appendChild(windowHeader);
-
- if (options.isDialog && f(options.dialogAction) != "") {
- content += '';
- } else if (options.isDismissible) {
- content += '';
- }
-
- var windowInner = new Element('div');
- windowInner.className = 'fulltextinner';
- var innerContent = '' + content + '
';
-
- if (!(options.isDialog || options.isDismissible)) {
- innerContent += '';
- }
-
- innerContent += '
';
-
- windowInner.set('html', innerContent);
- windowMain.appendChild(windowInner);
- textWindow.appendChild(windowMain);
-
- var windowFooter = new Element('div');
- windowFooter.className = 'fulltextfooter';
- var footerCode = '';
- windowFooter.set('html', footerCode);
-
- textWindow.appendChild(windowFooter);
- document.body.appendChild(textWindow);
-
- if (options.isDialog == true && f(options.dialogAction) != "") {
- var okayClick = $(windowId + 'Click');
- okayClick.addEvent("click", function() {
- closeWindow(windowId);
- eval(options.dialogAction);
- });
- okayClick.focus();
- } else if (options.isDismissible == true) {
- var okayClick = $(windowId + 'Click');
- okayClick.focus();
- } else if (!(options.isDialog || options.isDismissible)) {
- var resizeHandle = $('resize' + windowId);
- resizeHandle.addEvent("mousedown", startResize);
- }
-
- return windowId;
-}
-
-function show(a) {
- $(a).style.display = '';
-}
-
-function hide(a) {
- $(a).style.display = 'none';
-}
-
-function runKeyboardShortcuts(e) {
- var event = new Event(e);
- if (!((event.target.nodeName == "INPUT" && (event.target.type == "text" || event.target.type == "password")) || (event.target.nodeName == "TEXTAREA") || event.meta || event.control)) {
- if (event.key == "a") {
- checkAll();
- } else if (event.key == "n") {
- checkNone();
- } else if (event.key == "e") {
- if (sb.page == "browse.php" || sb.page == "structure.php" || sb.page == "users.php")
- editSelectedRows();
- } else if (event.key == "d") {
- if (sb.page == "structure.php")
- deleteSelectedColumns();
- else if (sb.page == "users.php")
- deleteSelectedUsers();
- else if (sb.page == "browse.php")
- deleteSelectedRows();
- else if (sb.page == "dboverview.php")
- dropSelectedTables();
- } else if (event.key == "r") {
- sb.loadPage();
- } else if (event.key == "f" && sb.page == "browse.php") {
- if ($('firstNav'))
- eval($('firstNav').get("onclick"));
- } else if (event.key == "g" && sb.page == "browse.php") {
- if ($('prevNav'))
- eval($('prevNav').get("onclick"));
- } else if (event.key == "h" && sb.page == "browse.php") {
- if ($('nextNav'))
- eval($('nextNav').get("onclick"));
- } else if (event.key == "l" && sb.page == "browse.php") {
- if ($('lastNav'))
- eval($('lastNav').get("onclick"));
- } else if (event.key == "q") {
- var tabId = 0;
- while (sb.getTabUrl(tabId) != "query.php") {
- tabId++;
- }
- topTabLoad(tabId);
-
- event.stop();
- event.stopPropagation();
- } else if (event.key == "o" && sb.page == "dboverview.php") {
- optimizeSelectedTables();
- }
-
- } else if (event.target.nodeName == "TEXTAREA" && event.control && event.key == "enter") {
- var curr = $(event.target);
- while (curr && curr.get('tag') != "form") {
- curr = $(curr.parentNode);
- }
-
- if (curr) {
- currButton = $E("input[type=submit]", curr);
- if (currButton) {
- currButton.click();
- }
- }
- }
-}
-
-function getWindowWidth() {
- if (window.innerWidth)
- return window.innerWidth;
- else
- return document.documentElement.clientWidth;
-}
-
-function getWindowHeight() {
- if (window.innerHeight)
- return window.innerHeight;
- else
- return document.documentElement.clientHeight;
-}
-
-function getScrollbarWidth() {
-
- var outer = new Element('div');
- outer.style.position = 'absolute';
- outer.style.top = '-1000px';
- outer.style.left = '-1000px';
- outer.style.width = '100px';
- outer.style.height = '50px';
- outer.style.overflow = 'hidden';
-
- var inner = new Element('div');
- inner.style.width = '100%';
- inner.style.height = '200px';
-
- outer.appendChild(inner);
- document.body.appendChild(outer);
-
- var w1 = inner.offsetWidth;
- outer.style.overflow = "auto";
- var w2 = inner.offsetWidth;
-
- document.body.removeChild(outer);
-
- return (w1 - w2);
-};
-
-function addAnimation(id, finish) {
- var elem = $(id);
-
- //remove duplicates
- for (var i in animationStack) {
- if (animationStack[i][0] == elem)
- animationStack.splice(i, 1);
- }
-
- var start = elem.offsetHeight;
-
- var change = finish - start;
-
- var totalFrames = 15;
-
- if (window.gecko)
- totalFrames -= 5;
-
- animationStack.push([elem, start, change, 0, totalFrames]);
- if (animationStack.length == 1)
- animate();
-}
-
-function animate() {
- var j, elem, start, change, currentFrame, totalFrames;
- for (var i = 0; i < animationStack.length; i++) {
-
- j = parseInt(i);
-
- elem = animationStack[j][0];
- start = animationStack[j][1];
- change = animationStack[j][2];
- animationStack[j][3] += 1;
- currentFrame = animationStack[j][3];
- totalFrames = animationStack[j][4];
-
- var newHeight = sineInOut(currentFrame, start, change, totalFrames);
-
- elem.style.height = newHeight + "px";
-
- if (currentFrame >= totalFrames) {
- animationStack.splice(j, 1);
-
- //if the menu is expanded, take off the explicit height attribute
- if (elem.style.height != "0px") {
- elem.style.height = '';
- }
- }
- }
- if (animationStack.length > 0)
- setTimeout('animate()', 25);
-}
-
-function sineInOut(t, b, c, d) {
- return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
+var sb;
+
+var shiftPressed;
+var lastActiveRow = -1;
+var clearPanesOnLoad = false;
+
+var activeWindow;
+var animationStack = [];
+
+var viewportSize = [0, 0];
+
+function f(g) {
+ if (g == undefined || g == "undefined" || g == null)
+ return "";
+ else
+ return g;
+}
+
+var $E = function(selector, filter) {
+ return ($(filter) || document).getElement(selector);
+};
+
+var $ES = function(selector, filter) {
+ return ($(filter) || document).getElements(selector);
+};
+
+window.addEvent("domready", function() {
+ document.addEvent("keydown", function(e) {
+ var ev = new Event(e);
+ if (ev.shift)
+ shiftPressed = true;
+ });
+
+ document.addEvent("keyup", function() {
+ shiftPressed = false;
+ });
+
+ // to disable keyboard shortcuts, comment out the following line
+ window.addEvent("keydown", runKeyboardShortcuts);
+
+ sb = new Page();
+
+ initializeSidemenu();
+
+ sb.loadHash();
+ sb.loadPage();
+
+ (function(){ sb.preload(); }).delay(500);
+ (function(){ sb.checkHashState(); }).periodical(75);
+ (function(){
+ var winWidth = getWindowWidth();
+ var winHeight = getWindowHeight();
+ if (viewportSize[0] != winWidth || viewportSize[1] != winHeight) {
+ viewportSize = [winWidth, winHeight];
+ sizePage();
+ }
+ }).periodical(175);
+ (function(){ autoExpandTextareas(); }).periodical(500);
+});
+
+function Page() {
+ this.page = "home.php";
+ this.db;
+ this.table;
+ this.topTabSet = 0;
+ this.topTab = 0;
+ this.s;
+ this.view;
+ this.sortDir;
+ this.sortKey;
+
+ this.$GUID = 1;
+
+ this.pane;
+ this.grid;
+ this.gridHeader;
+ this.leftChecks;
+
+ this.hashMemory = "";
+
+ this.submenuHeights = [];
+ this.submenuIds = [];
+ this.tableRowCounts = [];
+
+ this.topTabs = [new TopTabGroup("Main"), new TopTabGroup("Database"), new TopTabGroup("Table")];
+
+ if (showUsersMenu) {
+ this.topTabs[0].addTab(gettext("Home"), "home.php").addTab(gettext("Users"), "users.php").addTab(gettext("Query"), "query.php").addTab(gettext("Import"), "import.php").addTab(gettext("Export"), "export.php");
+ } else {
+ this.topTabs[0].addTab(gettext("Home"), "home.php").addTab(gettext("Query"), "query.php").addTab(gettext("Import"), "import.php").addTab(gettext("Export"), "export.php");
+ }
+
+ this.topTabs[1].addTab(gettext("Overview"), "dboverview.php").addTab(gettext("Query"), "query.php").addTab(gettext("Import"), "import.php").addTab(gettext("Export"), "export.php");
+ this.topTabs[2].addTab(gettext("Browse"), "browse.php").addTab(gettext("Structure"), "structure.php").addTab(gettext("Insert"), "insert.php").addTab(gettext("Query"), "query.php").addTab(gettext("Import"), "import.php").addTab(gettext("Export"), "export.php");
+
+}
+
+Page.prototype.loadPage = function() {
+ if (this.page == "browse.php" && parseInt(this.tableRowCounts[this.db + "_" + this.table]) == 0) {
+ this.page = "structure.php";
+ this.topTab = 1;
+ }
+
+ var pageUrl = "";
+ if (f(this.s))
+ pageUrl += "s=" + this.s + "&";
+ if (f(this.sortDir))
+ pageUrl += "sortDir=" + this.sortDir + "&";
+ if (f(this.sortKey))
+ pageUrl += "sortKey=" + this.sortKey + "&";
+ pageUrl = pageUrl.substring(0, pageUrl.length - 1);
+
+ if (this.page == "editcolumn.php") {
+ this.page = "structure.php";
+ this.topTab = 1;
+ } else if (this.page == "edituser.php") {
+ this.page = "users.php";
+ this.topTab = 1;
+ } else if (this.page == "edit.php") {
+ this.page = "browse.php";
+ this.topTab = 0;
+ }
+
+ clearPanesOnLoad = true;
+ var x = new XHR({url: this.page, onSuccess: finishTabLoad}).send(pageUrl);
+}
+
+Page.prototype.refreshTopTabSet = function(setNum) {
+ if (f(setNum))
+ this.topTabSet = setNum;
+
+ var topTabsElem = $E('#toptabs ul');
+ topTabsElem.empty();
+ var loopStop = this.topTabs[this.topTabSet].tabCounter;
+ var browseIsActive = true;
+ var currentTab, rowCount, tabId, tabLiObj, tabAObj, tabACount;
+
+ for (var i=0; i ");
+
+ if (m == 1)
+ prompter += gettext("The following query will be run:");
+ else
+ prompter += gettext("The following queries will be run:");
+
+ prompter += " " + formattedQuery + "
";
+ }
+
+ buildList = encodeURIComponent(buildList.replace(/\n/g, ""));
+ buildList = buildList.replace(/'/g, "\\'");
+
+ buildUrl = parameter + "=" + buildList;
+
+ if (sb.page == "browse.php") {
+ if (f(sb.view))
+ buildUrl += "&view=" + sb.view;
+
+ if (f(sb.s))
+ buildUrl += "&s=" + sb.s;
+
+ if (f(sb.sortKey))
+ buildUrl += "&sortKey=" + sb.sortKey
+
+ if (f(sb.sortDir))
+ buildUrl += "&sortDir=" + sb.sortDir;
+ }
+
+ showDialog(gettext("Confirm"),
+ prompter,
+ "var x = new XHR({url: \"" + sb.page + "\", onSuccess: finishTabLoad}).send(\"" + buildUrl + "\");"
+ );
+ }
+ }
+}
+
+function showDialog(title, content, action) {
+ createWindow(title, content, {isDialog: true, dialogAction: action});
+}
+
+function submitForm(formId) {
+ var theForm = $(formId);
+ var action = theForm.get("action");
+
+ if (!action)
+ action = sb.page;
+
+ var x = new XHR({url: action, onSuccess: finishTabLoad}).send(theForm.toQueryString());
+}
+
+var XHR = new Class({
+
+ Extends: Request,
+
+ initialize: function(options) {
+
+ if (!options.url)
+ options.url = sb.page;
+
+ if (options.url.indexOf("?") == -1)
+ options.url += "?ajaxRequest=" + sb.$GUID++;
+ else
+ options.url += "&ajaxRequest=" + sb.$GUID++;
+
+ options.url += "&requestKey=" + requestKey;
+
+ if (f(sb.db))
+ options.url += "&db=" + sb.db;
+ if (f(sb.table))
+ options.url += "&table=" + sb.table;
+
+ this.parent(options);
+
+ if (options && options.showLoader != false) {
+ show('load');
+
+ this.addEvent("onSuccess", function() {
+ hide('load');
+ });
+
+ this.addEvent("onFailure", function() {
+ hide('load');
+ createWindow(gettext("Error"), gettext("There was an error receiving data from the server."), {isDismissible: true});
+ });
+ }
+ },
+
+ // redefined to avoid auto script execution
+ success: function(text, xml) {
+ this.onSuccess(text, xml);
+ }
+
+});
+
+function gettext(str) {
+ if (f(getTextArr[str]) != "")
+ return getTextArr[str];
+ else
+ return str;
+}
+
+function printf() {
+ var argv = printf.arguments;
+ var argc = parseInt(argv.length);
+
+ var inputString = argv[0];
+
+ for (var i=1; i ' + title + '
';
+ windowHeader.set('html', windowHeaderContent);
+ windowMain.appendChild(windowHeader);
+
+ if (options.isDialog && f(options.dialogAction) != "") {
+ content += '';
+ } else if (options.isDismissible) {
+ content += '';
+ }
+
+ var windowInner = new Element('div');
+ windowInner.className = 'fulltextinner';
+ var innerContent = '' + content + '
';
+
+ if (!(options.isDialog || options.isDismissible)) {
+ innerContent += '';
+ }
+
+ innerContent += '
';
+
+ windowInner.set('html', innerContent);
+ windowMain.appendChild(windowInner);
+ textWindow.appendChild(windowMain);
+
+ var windowFooter = new Element('div');
+ windowFooter.className = 'fulltextfooter';
+ var footerCode = '';
+ windowFooter.set('html', footerCode);
+
+ textWindow.appendChild(windowFooter);
+ document.body.appendChild(textWindow);
+
+ if (options.isDialog == true && f(options.dialogAction) != "") {
+ var okayClick = $(windowId + 'Click');
+ okayClick.addEvent("click", function() {
+ closeWindow(windowId);
+ eval(options.dialogAction);
+ });
+ okayClick.focus();
+ } else if (options.isDismissible == true) {
+ var okayClick = $(windowId + 'Click');
+ okayClick.focus();
+ } else if (!(options.isDialog || options.isDismissible)) {
+ var resizeHandle = $('resize' + windowId);
+ resizeHandle.addEvent("mousedown", startResize);
+ }
+
+ return windowId;
+}
+
+function show(a) {
+ $(a).style.display = '';
+}
+
+function hide(a) {
+ $(a).style.display = 'none';
+}
+
+function runKeyboardShortcuts(e) {
+ var event = new Event(e);
+ if (!((event.target.nodeName == "INPUT" && (event.target.type == "text" || event.target.type == "password")) || (event.target.nodeName == "TEXTAREA") || event.meta || event.control)) {
+ if (event.key == "a") {
+ checkAll();
+ } else if (event.key == "n") {
+ checkNone();
+ } else if (event.key == "e") {
+ if (sb.page == "browse.php" || sb.page == "structure.php" || sb.page == "users.php")
+ editSelectedRows();
+ } else if (event.key == "d") {
+ if (sb.page == "structure.php")
+ deleteSelectedColumns();
+ else if (sb.page == "users.php")
+ deleteSelectedUsers();
+ else if (sb.page == "browse.php")
+ deleteSelectedRows();
+ else if (sb.page == "dboverview.php")
+ dropSelectedTables();
+ } else if (event.key == "r") {
+ sb.loadPage();
+ } else if (event.key == "f" && sb.page == "browse.php") {
+ if ($('firstNav'))
+ eval($('firstNav').get("onclick"));
+ } else if (event.key == "g" && sb.page == "browse.php") {
+ if ($('prevNav'))
+ eval($('prevNav').get("onclick"));
+ } else if (event.key == "h" && sb.page == "browse.php") {
+ if ($('nextNav'))
+ eval($('nextNav').get("onclick"));
+ } else if (event.key == "l" && sb.page == "browse.php") {
+ if ($('lastNav'))
+ eval($('lastNav').get("onclick"));
+ } else if (event.key == "q") {
+ var tabId = 0;
+ while (sb.getTabUrl(tabId) != "query.php") {
+ tabId++;
+ }
+ topTabLoad(tabId);
+
+ event.stop();
+ event.stopPropagation();
+ } else if (event.key == "o" && sb.page == "dboverview.php") {
+ optimizeSelectedTables();
+ }
+
+ } else if (event.target.nodeName == "TEXTAREA" && event.control && event.key == "enter") {
+ var curr = $(event.target);
+ while (curr && curr.get('tag') != "form") {
+ curr = $(curr.parentNode);
+ }
+
+ if (curr) {
+ currButton = $E("input[type=submit]", curr);
+ if (currButton) {
+ currButton.click();
+ }
+ }
+ }
+}
+
+function getWindowWidth() {
+ if (window.innerWidth)
+ return window.innerWidth;
+ else
+ return document.documentElement.clientWidth;
+}
+
+function getWindowHeight() {
+ if (window.innerHeight)
+ return window.innerHeight;
+ else
+ return document.documentElement.clientHeight;
+}
+
+function getScrollbarWidth() {
+
+ var outer = new Element('div');
+ outer.style.position = 'absolute';
+ outer.style.top = '-1000px';
+ outer.style.left = '-1000px';
+ outer.style.width = '100px';
+ outer.style.height = '50px';
+ outer.style.overflow = 'hidden';
+
+ var inner = new Element('div');
+ inner.style.width = '100%';
+ inner.style.height = '200px';
+
+ outer.appendChild(inner);
+ document.body.appendChild(outer);
+
+ var w1 = inner.offsetWidth;
+ outer.style.overflow = "auto";
+ var w2 = inner.offsetWidth;
+
+ document.body.removeChild(outer);
+
+ return (w1 - w2);
+};
+
+function addAnimation(id, finish) {
+ var elem = $(id);
+
+ //remove duplicates
+ for (var i in animationStack) {
+ if (animationStack[i][0] == elem)
+ animationStack.splice(i, 1);
+ }
+
+ var start = elem.offsetHeight;
+
+ var change = finish - start;
+
+ var totalFrames = 15;
+
+ if (window.gecko)
+ totalFrames -= 5;
+
+ animationStack.push([elem, start, change, 0, totalFrames]);
+ if (animationStack.length == 1)
+ animate();
+}
+
+function animate() {
+ var j, elem, start, change, currentFrame, totalFrames;
+ for (var i = 0; i < animationStack.length; i++) {
+
+ j = parseInt(i);
+
+ elem = animationStack[j][0];
+ start = animationStack[j][1];
+ change = animationStack[j][2];
+ animationStack[j][3] += 1;
+ currentFrame = animationStack[j][3];
+ totalFrames = animationStack[j][4];
+
+ var newHeight = sineInOut(currentFrame, start, change, totalFrames);
+
+ elem.style.height = newHeight + "px";
+
+ if (currentFrame >= totalFrames) {
+ animationStack.splice(j, 1);
+
+ //if the menu is expanded, take off the explicit height attribute
+ if (elem.style.height != "0px") {
+ elem.style.height = '';
+ }
+ }
+ }
+ if (animationStack.length > 0)
+ setTimeout('animate()', 25);
+}
+
+function sineInOut(t, b, c, d) {
+ return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
}
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/js/helpers.js b/htdocs/sqlbuddy/js/helpers.js
index 7cb8294ac..23b9b2d61 100755
--- a/htdocs/sqlbuddy/js/helpers.js
+++ b/htdocs/sqlbuddy/js/helpers.js
@@ -1,1240 +1,1240 @@
-function clearPanes() {
- $('innercontent').empty();
-}
-
-function toggleMenuClick(e) {
- var event = new Event(e);
- var menuId = event.target.parentNode.parentNode.id;
- toggleMenu(menuId.substring(2));
-}
-
-function toggleMenu(b, forceExpand) {
- b = parseInt(b);
- var menuId = "db" + b;
- var menu = $(menuId);
- var sub = "sublist" + b;
-
- if (!menu.hasClass("expanded")) {
- // accordion
- var openMenus = $ES(".expanded");
- for (var m=0; m= 0 && lastActiveRow != rowId) {
- if (context) {
- var grid = $E('.gridscroll', $(context));
- var checks = $E('.leftchecks', $(context)).childNodes;
- } else {
- var grid = sb.grid;
- var checks = sb.leftChecks.childNodes;
- }
-
- if (rowId < lastActiveRow) {
- for (var i=rowId+1; ilastActiveRow; i--) {
- checks[i].firstChild.firstChild.checked = checks[rowId].firstChild.firstChild.checked;
- highlightDataRow(i, context);
- }
- }
- }
- lastActiveRow = rowId;
-}
-
-function highlightDataRow(i, context) {
- if (context) {
- var grid = $(context);
- var rows = $E('.gridscroll', grid).childNodes;
- var lc = $E('.leftchecks', grid).childNodes;
- } else {
- var rows = sb.grid.childNodes;
- var lc = sb.leftChecks.childNodes;
- }
-
- if (lc[i].firstChild.firstChild.checked == true) {
- if (rows[i].className.indexOf("highlighted") == -1) {
- rows[i].className += " highlighted";
- lc[i].className += " highlighted";
- }
- } else {
- if (rows[i].className.indexOf("highlighted") != -1) {
- rows[i].className = rows[i].className.replace("highlighted", "");
- lc[i].className = lc[i].className.replace("highlighted", "");
- }
- }
-}
-
-function editSelectedRows() {
- var grid = sb.grid;
- if (f(grid)) {
- var editParts = "";
- var count = 0;
- var inputs = $ES("input", sb.leftChecks);
- for (var i=0; i 0) {
- if (sb.page == "structure.php")
- var loadPage = "editcolumn.php";
- else if (sb.page == "users.php")
- var loadPage = "edituser.php";
- else
- var loadPage = "edit.php";
-
- editParts = editParts.substring(0, editParts.length - 2);
- sb.topTabs[sb.topTabSet].addTab("Edit", loadPage, true);
- sb.page = loadPage;
- var x = new XHR({url: loadPage, onSuccess: finishTabLoad}).send("editParts=" + editParts);
- }
- }
-}
-
-function saveEdit(formId) {
- var form = $(formId);
- var queryPart = form.get("querypart");
- var x = new XHR({url: "ajaxsaveedit.php?queryPart=" + queryPart + "&form=" + formId, onSuccess: updateAfterEdit}).send(form.toQueryString());
-}
-
-function saveColumnEdit(formId) {
- var form = $(formId);
- var changes = getFieldSummary(form);
- var columnQuery = "ALTER TABLE `" + sb.table + "` CHANGE `" + form.get("querypart") + "` " + changes;
- var x = new XHR({url: "ajaxsavecolumnedit.php?form=" + formId, onSuccess: updateAfterEdit}).send("runQuery=" + columnQuery);
-}
-
-function saveUserEdit(formId) {
- var form = $(formId);
- var x = new XHR({url: "ajaxsaveuseredit.php?form=" + formId + "&user=" + form.get("querypart"), onSuccess: updateAfterEdit}).send(form.toQueryString());
-}
-
-function updateAfterEdit(json) {
- var response = eval('(' + json + ')');
- var formu = $(response.formupdate);
- if (response.errormess == "") {
- showUpdateMessage(formu);
- } else {
- var errHandle = $E('.errormessage', formu);
- errHandle.style.display = '';
- errHandle.set('text', response.errormess);
- }
- sizePage();
- clearPanesOnLoad = true;
-}
-
-function showUpdateMessage(formu) {
- // hide other messages
- hideUpdateMessages();
-
- formu.innerHTML = "";
- var updateId = sb.$GUID++;
- var updateDiv = new Element("div", {
- 'class': 'insertmessage',
- 'id': 'update' + updateId
- }).set('text', gettext("Your changes were saved to the database."));
- formu.appendChild(updateDiv);
- yellowFade($('update' + updateId));
- setTimeout(hideUpdateMessages, 1250);
-}
-
-function hideUpdateMessages() {
- var updates = $ES(".insertmessage");
- var edits = $ES(".edit");
-
- if (edits.length == 0) {
- updates[0].set('text', gettext("Redirecting..."));
-
- for (var i=1; i" + emptyQuery + "",
- "var x = new XHR({url: \"ajaxquery.php\", onSuccess: emptyTableCallback}).send(\"query=" + encodeURIComponent(emptyQuery) + "&silent=1\")"
- );
- }
-}
-
-function emptyTableCallback() {
- sb.tableRowCounts[sb.db + "_" + sb.table] = "0";
- subTabLoad(sb.db, sb.table);
-}
-
-function confirmDropTable() {
- var table = sb.table;
- if (f(table)) {
- var dropQuery = "DROP TABLE " + returnQuote() + table + returnQuote();
- var targ = $(getSubMenuId(sb.db, sb.table));
- while (!targ.hasClass("sublist")) {
- targ = targ.parentNode;
- }
- var toRecalculate = targ.id;
- showDialog(gettext("Confirm"),
- printf(gettext("Are you sure you want to drop the '%s' table? This will delete the table and all data inside of it. The following query will be run:"), table) + "" + dropQuery + "
",
- "var x = new XHR({url: \"ajaxquery.php\"}).send(\"query=" + dropQuery + "&silent=1\"); $(getSubMenuId(sb.db, sb.table)).dispose(); databaseLoad(sb.db); recalculateSubmenuHeight(\"" + toRecalculate + "\");"
- );
- }
-}
-
-function optimizeTable() {
- if (sb.table) {
- var optimizeQuery = "OPTIMIZE TABLE `" + sb.table + "`;";
- var x = new XHR({url: "ajaxquery.php", onSuccess: function(){ sb.loadPage() } }).send("query=" + optimizeQuery + "&silent=1");
- }
-}
-
-function confirmDropDatabase() {
- var db = sb.db;
- if (f(db)) {
- var dropQuery = "DROP DATABASE `" + db + "`";
- showDialog(gettext("Confirm"),
- printf(gettext("Are you sure you want to drop the database '%s'? This will delete the database, the tables inside the database, and all data inside of the tables. The following query will be run:"), db) + "" + dropQuery + "
",
- "var x = new XHR({url: \"ajaxquery.php\"}).send(\"query=" + dropQuery + "&silent=1\"); $(getSubMenuId(sb.db, sb.table)).dispose(); sideMainClick(\"home.php\",\"hometab\");"
- );
- }
-}
-
-function editTable() {
- var newName = $('RENAME').value;
- var charSelect = $('RECHARSET');
- if (charSelect)
- var newCharset = charSelect.options[charSelect.selectedIndex].value;
-
- var runQuery = "";
-
- if (newName != sb.table && adapter == "mysql") {
- runQuery += "RENAME TABLE `" + sb.table + "` TO `" + newName + "`;";
- } else if (newName != sb.table && adapter == "sqlite") {
- runQuery += "ALTER TABLE '" + sb.table + "' RENAME TO '" + newName + "';";
- }
-
- if (f(newCharset) != "") {
- runQuery += "ALTER TABLE `" + sb.table + "` CHARSET " + newCharset + ";";
- }
-
- if (f(runQuery) != "") {
- $('RENAME').blur();
- var x = new XHR({url: "ajaxquery.php", onSuccess: editTableCallback}).send("query=" + runQuery + "&silent=1");
- }
-
- // defined interally on purpose
- function editTableCallback() {
- if (f(newName) != "" && newName != sb.table) {
- var submenuItem = $(sb.submenuIds[sb.db + '_' + sb.table]);
- submenuItem.firstChild.set('text', newName);
- submenuItem.firstChild.href = "#page=browse&db=" + sb.db + "&table=" + newName + "&topTabSet=2";
- var subacount = new Element('span');
- subacount.className = "subcount";
- subacount.appendText("(" + approximateNumber(sb.tableRowCounts[sb.db + '_' + sb.table]) + ")");
- submenuItem.firstChild.appendChild(subacount);
-
- sb.submenuIds[sb.db + '_' + newName] = sb.submenuIds[sb.db + '_' + sb.table];
- sb.submenuIds[sb.db + '_' + sb.table] = '';
- sb.tableRowCounts[sb.db + '_' + newName] = sb.tableRowCounts[sb.db + '_' + sb.table];
- sb.tableRowCounts[sb.db + '_' + sb.table] = '';
- sb.table = newName;
- sb.setHash();
- }
-
- $('editTableMessage').set('text', gettext("Successfully saved changes."));
- yellowFade($('editTableMessage'));
- var clearTable = function() {
- $('editTableMessage').empty();
- };
-
- clearTable.delay(2000);
-
- clearPanesOnLoad = true;
- }
-}
-
-function editDatabase() {
- var charSelect = $('DBRECHARSET');
- var newCharset = charSelect.options[charSelect.selectedIndex].value;
-
- if (f(newCharset) != "") {
- var runQuery = "ALTER DATABASE `" + sb.db + "` CHARSET " + newCharset + ";";
- var x = new XHR({url: "ajaxquery.php", onSuccess: editDatabaseCallback}).send("query=" + runQuery + "&silent=1");
- }
-
- function editDatabaseCallback() {
- $('editDatabaseMessage').set('text', gettext("Successfully saved changes."));
- yellowFade($('editDatabaseMessage'));
-
- var clearDatabase = function() {
- $('editDatabaseMessage').empty();
- };
-
- clearDatabase.delay(2000);
-
- clearPanesOnLoad = true;
- }
-}
-
-function runJavascriptContent() {
- var scripts = $ES("script", sb.pane);
- for (var i=0; i 0) {
- for (var i=0; i" + name + "";
- else if (adapter == "sqlite")
- fieldBuild = name;
- else
- fieldBuild = "`" + name + "`";
-
- if (adapter == "sqlite") {
- if (f(type))
- fieldBuild += " " + type;
- if (f(size) && f(type))
- fieldBuild += "(" + size + ")";
- if (f(notnull))
- fieldBuild += " not null";
- if (f(key))
- fieldBuild += " " + key + " key";
- if (f(auto))
- fieldBuild += " autoincrement";
- if (f(unique))
- fieldBuild += " unique";
- if (f(defaultval))
- fieldBuild += " default '" + defaultval + "'";
- } else {
- if (f(type))
- fieldBuild += " " + type;
- if (f(values) && (type == "set" || type == "enum"))
- fieldBuild += values + "";
- if (f(size) && f(type))
- fieldBuild += "(" + size + ")";
- if (f(unsign))
- fieldBuild += " unsigned";
- if (f(binary))
- fieldBuild += " binary";
- if (f(charset))
- fieldBuild += " charset " + charset;
- if (f(notnull))
- fieldBuild += " not null";
- if (f(defaultval))
- fieldBuild += " default '" + defaultval + "'";
- if (f(auto))
- fieldBuild += " auto_increment";
- if (f(key))
- fieldBuild += " " + key + " key";
- }
-
- }
- }
- return fieldBuild;
-}
-
-function addTableField() {
- var fieldList = $('fieldlist');
- var toCopy = $E('.fieldbox', fieldList).innerHTML;
-
- if (f(toCopy)) {
- var newField = new Element('div');
- newField.set('html', toCopy);
- newField.className = "fieldbox";
- fieldList.appendChild(newField);
-
- clearForm(newField);
-
- var valueLine = $E(".valueline", newField);
- if (f(valueLine))
- valueLine.style.display = 'none';
-
- if (!Browser.Engine.trident) {
- var newHeader = $E(".fieldheader", newField).childNodes[1];
- newHeader.set('html', '<' + gettext("New field") + '>');
- }
-
- }
- sizePage();
-}
-
-function clearForm(elem) {
- var inputs = elem.getElementsByTagName("input");
- for (var i=0; i 0) {
-
- $('TABLENAME').style.border = "";
-
- if (adapter == "sqlite") {
- var createQuery = "CREATE TABLE " + tableName + " (";
- } else {
- var createQuery = "CREATE TABLE `" + tableName + "` (";
- }
-
- for (var i=0; i= 0 || obj.value.indexOf("text") >= 0 || obj.value == "enum" || obj.value == "set") {
- charsetToggle[0].style.display = '';
- charsetToggle[1].style.display = '';
- } else {
- charsetToggle[0].style.display = 'none';
- charsetToggle[1].style.display = 'none';
- }
- }
-
- sizePage();
-}
-
-function exportFilePrep() {
- var oft = $('OUTPUTFILETEXT');
- if ($('OUTPUTFILE').checked) {
-
- defaultFilename = gettext("Export").toLowerCase();
-
- if ($('SQLTOGGLE').checked) {
- if (oft.value == "" || oft.value == defaultFilename + ".csv")
- oft.value = defaultFilename + ".sql";
- oft.focus();
- } else {
- if (oft.value == "" || oft.value == defaultFilename + ".sql")
- oft.value = defaultFilename + ".csv";
- oft.focus();
- }
- }
-}
-
-function startImport() {
- $('importLoad').style.display = '';
- $('importForm').setAttribute("target", "importFrame");
-}
-
-function updateAfterImport(message) {
- $('importLoad').style.display = 'none';
- $('importMessage').style.display = '';
- $('importMessage').innerHTML = message;
- clearPanesOnLoad = true;
-}
-
-function paneCheckAll(elemId) {
- var elem = $(elemId);
- var inputs = elem.getElementsByTagName("input");
- for (var i=0; i 0) {
- win.style.opacity = opacities.pop();
- var nextWin = function(){ closeWindowCallback(winId, speed, opacities); };
- nextWin.delay(speed);
- } else {
- win.dispose();
- }
-}
-
-function switchLanguage() {
- var langSelect = $('langSwitcher');
- var lang = langSelect.options[langSelect.selectedIndex].value;
- var defaultLang = "en_US";
-
- if (lang != defaultLang) {
- var co = Cookie.write("sb_lang", lang, {duration: 60});
- } else if (Cookie.read("sb_lang")) {
- Cookie.dispose("sb_lang");
- }
- location.reload(true);
-}
-
-function switchTheme() {
- var themeSelect = $('themeSwitcher');
- var theme = themeSelect.options[themeSelect.selectedIndex].value;
- var defaultTheme = "bittersweet";
-
- if (theme != defaultTheme) {
- var co = Cookie.write("sb_theme", theme, {duration: 60});
- } else if (Cookie.read("sb_theme")) {
- Cookie.dispose("sb_theme");
- }
- location.reload(true);
-}
-
-function quoteModifier(mod) {
- return returnQuote() + mod + returnQuote();
-}
-
-function returnQuote() {
- if (adapter == "sqlite") {
- return "'";
- } else if (adapter == "mysql") {
- return "`";
- }
-}
-
-function autoExpandTextareas() {
- var taList = document.getElementsByTagName("textarea");
- if (taList.length > 0 && sb.page != "export.php") {
- var sizeDiv = new Element('div');
- sizeDiv.id = "sizeDiv";
- sizeDiv.style.visibility = "hidden";
- sizeDiv.style.position = "absolute";
- sizeDiv.style.lineHeight = "15px";
- sizeDiv.style.fontSize = "13px";
- sizeDiv.style.padding = "2px";
- document.body.appendChild(sizeDiv);
-
- for (var i=0; i ') + ' ');
-
- var newHeight = theDiv.clientHeight + 5;
-
- if (newHeight < 80) {
- newHeight = 80;
- } else if (newHeight > 300) {
- newHeight = 300;
- }
-
- taList[i].style.height = newHeight + "px";
- }
-
- document.body.removeChild(sizeDiv);
- }
-}
-
-function yellowFade(el, curr) {
- if (!curr)
- curr = 175;
-
- el.style.background = 'rgb(255, 255, '+ (curr+=3) +')';
-
- if (curr < 255)
- setTimeout(function(){ yellowFade(el, curr) }, 25);
+function clearPanes() {
+ $('innercontent').empty();
+}
+
+function toggleMenuClick(e) {
+ var event = new Event(e);
+ var menuId = event.target.parentNode.parentNode.id;
+ toggleMenu(menuId.substring(2));
+}
+
+function toggleMenu(b, forceExpand) {
+ b = parseInt(b);
+ var menuId = "db" + b;
+ var menu = $(menuId);
+ var sub = "sublist" + b;
+
+ if (!menu.hasClass("expanded")) {
+ // accordion
+ var openMenus = $ES(".expanded");
+ for (var m=0; m= 0 && lastActiveRow != rowId) {
+ if (context) {
+ var grid = $E('.gridscroll', $(context));
+ var checks = $E('.leftchecks', $(context)).childNodes;
+ } else {
+ var grid = sb.grid;
+ var checks = sb.leftChecks.childNodes;
+ }
+
+ if (rowId < lastActiveRow) {
+ for (var i=rowId+1; ilastActiveRow; i--) {
+ checks[i].firstChild.firstChild.checked = checks[rowId].firstChild.firstChild.checked;
+ highlightDataRow(i, context);
+ }
+ }
+ }
+ lastActiveRow = rowId;
+}
+
+function highlightDataRow(i, context) {
+ if (context) {
+ var grid = $(context);
+ var rows = $E('.gridscroll', grid).childNodes;
+ var lc = $E('.leftchecks', grid).childNodes;
+ } else {
+ var rows = sb.grid.childNodes;
+ var lc = sb.leftChecks.childNodes;
+ }
+
+ if (lc[i].firstChild.firstChild.checked == true) {
+ if (rows[i].className.indexOf("highlighted") == -1) {
+ rows[i].className += " highlighted";
+ lc[i].className += " highlighted";
+ }
+ } else {
+ if (rows[i].className.indexOf("highlighted") != -1) {
+ rows[i].className = rows[i].className.replace("highlighted", "");
+ lc[i].className = lc[i].className.replace("highlighted", "");
+ }
+ }
+}
+
+function editSelectedRows() {
+ var grid = sb.grid;
+ if (f(grid)) {
+ var editParts = "";
+ var count = 0;
+ var inputs = $ES("input", sb.leftChecks);
+ for (var i=0; i 0) {
+ if (sb.page == "structure.php")
+ var loadPage = "editcolumn.php";
+ else if (sb.page == "users.php")
+ var loadPage = "edituser.php";
+ else
+ var loadPage = "edit.php";
+
+ editParts = editParts.substring(0, editParts.length - 2);
+ sb.topTabs[sb.topTabSet].addTab("Edit", loadPage, true);
+ sb.page = loadPage;
+ var x = new XHR({url: loadPage, onSuccess: finishTabLoad}).send("editParts=" + editParts);
+ }
+ }
+}
+
+function saveEdit(formId) {
+ var form = $(formId);
+ var queryPart = form.get("querypart");
+ var x = new XHR({url: "ajaxsaveedit.php?queryPart=" + queryPart + "&form=" + formId, onSuccess: updateAfterEdit}).send(form.toQueryString());
+}
+
+function saveColumnEdit(formId) {
+ var form = $(formId);
+ var changes = getFieldSummary(form);
+ var columnQuery = "ALTER TABLE `" + sb.table + "` CHANGE `" + form.get("querypart") + "` " + changes;
+ var x = new XHR({url: "ajaxsavecolumnedit.php?form=" + formId, onSuccess: updateAfterEdit}).send("runQuery=" + columnQuery);
+}
+
+function saveUserEdit(formId) {
+ var form = $(formId);
+ var x = new XHR({url: "ajaxsaveuseredit.php?form=" + formId + "&user=" + form.get("querypart"), onSuccess: updateAfterEdit}).send(form.toQueryString());
+}
+
+function updateAfterEdit(json) {
+ var response = eval('(' + json + ')');
+ var formu = $(response.formupdate);
+ if (response.errormess == "") {
+ showUpdateMessage(formu);
+ } else {
+ var errHandle = $E('.errormessage', formu);
+ errHandle.style.display = '';
+ errHandle.set('text', response.errormess);
+ }
+ sizePage();
+ clearPanesOnLoad = true;
+}
+
+function showUpdateMessage(formu) {
+ // hide other messages
+ hideUpdateMessages();
+
+ formu.innerHTML = "";
+ var updateId = sb.$GUID++;
+ var updateDiv = new Element("div", {
+ 'class': 'insertmessage',
+ 'id': 'update' + updateId
+ }).set('text', gettext("Your changes were saved to the database."));
+ formu.appendChild(updateDiv);
+ yellowFade($('update' + updateId));
+ setTimeout(hideUpdateMessages, 1250);
+}
+
+function hideUpdateMessages() {
+ var updates = $ES(".insertmessage");
+ var edits = $ES(".edit");
+
+ if (edits.length == 0) {
+ updates[0].set('text', gettext("Redirecting..."));
+
+ for (var i=1; i" + emptyQuery + "",
+ "var x = new XHR({url: \"ajaxquery.php\", onSuccess: emptyTableCallback}).send(\"query=" + encodeURIComponent(emptyQuery) + "&silent=1\")"
+ );
+ }
+}
+
+function emptyTableCallback() {
+ sb.tableRowCounts[sb.db + "_" + sb.table] = "0";
+ subTabLoad(sb.db, sb.table);
+}
+
+function confirmDropTable() {
+ var table = sb.table;
+ if (f(table)) {
+ var dropQuery = "DROP TABLE " + returnQuote() + table + returnQuote();
+ var targ = $(getSubMenuId(sb.db, sb.table));
+ while (!targ.hasClass("sublist")) {
+ targ = targ.parentNode;
+ }
+ var toRecalculate = targ.id;
+ showDialog(gettext("Confirm"),
+ printf(gettext("Are you sure you want to drop the '%s' table? This will delete the table and all data inside of it. The following query will be run:"), table) + "" + dropQuery + "
",
+ "var x = new XHR({url: \"ajaxquery.php\"}).send(\"query=" + dropQuery + "&silent=1\"); $(getSubMenuId(sb.db, sb.table)).dispose(); databaseLoad(sb.db); recalculateSubmenuHeight(\"" + toRecalculate + "\");"
+ );
+ }
+}
+
+function optimizeTable() {
+ if (sb.table) {
+ var optimizeQuery = "OPTIMIZE TABLE `" + sb.table + "`;";
+ var x = new XHR({url: "ajaxquery.php", onSuccess: function(){ sb.loadPage() } }).send("query=" + optimizeQuery + "&silent=1");
+ }
+}
+
+function confirmDropDatabase() {
+ var db = sb.db;
+ if (f(db)) {
+ var dropQuery = "DROP DATABASE `" + db + "`";
+ showDialog(gettext("Confirm"),
+ printf(gettext("Are you sure you want to drop the database '%s'? This will delete the database, the tables inside the database, and all data inside of the tables. The following query will be run:"), db) + "" + dropQuery + "
",
+ "var x = new XHR({url: \"ajaxquery.php\"}).send(\"query=" + dropQuery + "&silent=1\"); $(getSubMenuId(sb.db, sb.table)).dispose(); sideMainClick(\"home.php\",\"hometab\");"
+ );
+ }
+}
+
+function editTable() {
+ var newName = $('RENAME').value;
+ var charSelect = $('RECHARSET');
+ if (charSelect)
+ var newCharset = charSelect.options[charSelect.selectedIndex].value;
+
+ var runQuery = "";
+
+ if (newName != sb.table && adapter == "mysql") {
+ runQuery += "RENAME TABLE `" + sb.table + "` TO `" + newName + "`;";
+ } else if (newName != sb.table && adapter == "sqlite") {
+ runQuery += "ALTER TABLE '" + sb.table + "' RENAME TO '" + newName + "';";
+ }
+
+ if (f(newCharset) != "") {
+ runQuery += "ALTER TABLE `" + sb.table + "` CHARSET " + newCharset + ";";
+ }
+
+ if (f(runQuery) != "") {
+ $('RENAME').blur();
+ var x = new XHR({url: "ajaxquery.php", onSuccess: editTableCallback}).send("query=" + runQuery + "&silent=1");
+ }
+
+ // defined interally on purpose
+ function editTableCallback() {
+ if (f(newName) != "" && newName != sb.table) {
+ var submenuItem = $(sb.submenuIds[sb.db + '_' + sb.table]);
+ submenuItem.firstChild.set('text', newName);
+ submenuItem.firstChild.href = "#page=browse&db=" + sb.db + "&table=" + newName + "&topTabSet=2";
+ var subacount = new Element('span');
+ subacount.className = "subcount";
+ subacount.appendText("(" + approximateNumber(sb.tableRowCounts[sb.db + '_' + sb.table]) + ")");
+ submenuItem.firstChild.appendChild(subacount);
+
+ sb.submenuIds[sb.db + '_' + newName] = sb.submenuIds[sb.db + '_' + sb.table];
+ sb.submenuIds[sb.db + '_' + sb.table] = '';
+ sb.tableRowCounts[sb.db + '_' + newName] = sb.tableRowCounts[sb.db + '_' + sb.table];
+ sb.tableRowCounts[sb.db + '_' + sb.table] = '';
+ sb.table = newName;
+ sb.setHash();
+ }
+
+ $('editTableMessage').set('text', gettext("Successfully saved changes."));
+ yellowFade($('editTableMessage'));
+ var clearTable = function() {
+ $('editTableMessage').empty();
+ };
+
+ clearTable.delay(2000);
+
+ clearPanesOnLoad = true;
+ }
+}
+
+function editDatabase() {
+ var charSelect = $('DBRECHARSET');
+ var newCharset = charSelect.options[charSelect.selectedIndex].value;
+
+ if (f(newCharset) != "") {
+ var runQuery = "ALTER DATABASE `" + sb.db + "` CHARSET " + newCharset + ";";
+ var x = new XHR({url: "ajaxquery.php", onSuccess: editDatabaseCallback}).send("query=" + runQuery + "&silent=1");
+ }
+
+ function editDatabaseCallback() {
+ $('editDatabaseMessage').set('text', gettext("Successfully saved changes."));
+ yellowFade($('editDatabaseMessage'));
+
+ var clearDatabase = function() {
+ $('editDatabaseMessage').empty();
+ };
+
+ clearDatabase.delay(2000);
+
+ clearPanesOnLoad = true;
+ }
+}
+
+function runJavascriptContent() {
+ var scripts = $ES("script", sb.pane);
+ for (var i=0; i 0) {
+ for (var i=0; i" + name + "";
+ else if (adapter == "sqlite")
+ fieldBuild = name;
+ else
+ fieldBuild = "`" + name + "`";
+
+ if (adapter == "sqlite") {
+ if (f(type))
+ fieldBuild += " " + type;
+ if (f(size) && f(type))
+ fieldBuild += "(" + size + ")";
+ if (f(notnull))
+ fieldBuild += " not null";
+ if (f(key))
+ fieldBuild += " " + key + " key";
+ if (f(auto))
+ fieldBuild += " autoincrement";
+ if (f(unique))
+ fieldBuild += " unique";
+ if (f(defaultval))
+ fieldBuild += " default '" + defaultval + "'";
+ } else {
+ if (f(type))
+ fieldBuild += " " + type;
+ if (f(values) && (type == "set" || type == "enum"))
+ fieldBuild += values + "";
+ if (f(size) && f(type))
+ fieldBuild += "(" + size + ")";
+ if (f(unsign))
+ fieldBuild += " unsigned";
+ if (f(binary))
+ fieldBuild += " binary";
+ if (f(charset))
+ fieldBuild += " charset " + charset;
+ if (f(notnull))
+ fieldBuild += " not null";
+ if (f(defaultval))
+ fieldBuild += " default '" + defaultval + "'";
+ if (f(auto))
+ fieldBuild += " auto_increment";
+ if (f(key))
+ fieldBuild += " " + key + " key";
+ }
+
+ }
+ }
+ return fieldBuild;
+}
+
+function addTableField() {
+ var fieldList = $('fieldlist');
+ var toCopy = $E('.fieldbox', fieldList).innerHTML;
+
+ if (f(toCopy)) {
+ var newField = new Element('div');
+ newField.set('html', toCopy);
+ newField.className = "fieldbox";
+ fieldList.appendChild(newField);
+
+ clearForm(newField);
+
+ var valueLine = $E(".valueline", newField);
+ if (f(valueLine))
+ valueLine.style.display = 'none';
+
+ if (!Browser.Engine.trident) {
+ var newHeader = $E(".fieldheader", newField).childNodes[1];
+ newHeader.set('html', '<' + gettext("New field") + '>');
+ }
+
+ }
+ sizePage();
+}
+
+function clearForm(elem) {
+ var inputs = elem.getElementsByTagName("input");
+ for (var i=0; i 0) {
+
+ $('TABLENAME').style.border = "";
+
+ if (adapter == "sqlite") {
+ var createQuery = "CREATE TABLE " + tableName + " (";
+ } else {
+ var createQuery = "CREATE TABLE `" + tableName + "` (";
+ }
+
+ for (var i=0; i= 0 || obj.value.indexOf("text") >= 0 || obj.value == "enum" || obj.value == "set") {
+ charsetToggle[0].style.display = '';
+ charsetToggle[1].style.display = '';
+ } else {
+ charsetToggle[0].style.display = 'none';
+ charsetToggle[1].style.display = 'none';
+ }
+ }
+
+ sizePage();
+}
+
+function exportFilePrep() {
+ var oft = $('OUTPUTFILETEXT');
+ if ($('OUTPUTFILE').checked) {
+
+ defaultFilename = gettext("Export").toLowerCase();
+
+ if ($('SQLTOGGLE').checked) {
+ if (oft.value == "" || oft.value == defaultFilename + ".csv")
+ oft.value = defaultFilename + ".sql";
+ oft.focus();
+ } else {
+ if (oft.value == "" || oft.value == defaultFilename + ".sql")
+ oft.value = defaultFilename + ".csv";
+ oft.focus();
+ }
+ }
+}
+
+function startImport() {
+ $('importLoad').style.display = '';
+ $('importForm').setAttribute("target", "importFrame");
+}
+
+function updateAfterImport(message) {
+ $('importLoad').style.display = 'none';
+ $('importMessage').style.display = '';
+ $('importMessage').innerHTML = message;
+ clearPanesOnLoad = true;
+}
+
+function paneCheckAll(elemId) {
+ var elem = $(elemId);
+ var inputs = elem.getElementsByTagName("input");
+ for (var i=0; i 0) {
+ win.style.opacity = opacities.pop();
+ var nextWin = function(){ closeWindowCallback(winId, speed, opacities); };
+ nextWin.delay(speed);
+ } else {
+ win.dispose();
+ }
+}
+
+function switchLanguage() {
+ var langSelect = $('langSwitcher');
+ var lang = langSelect.options[langSelect.selectedIndex].value;
+ var defaultLang = "en_US";
+
+ if (lang != defaultLang) {
+ var co = Cookie.write("sb_lang", lang, {duration: 60});
+ } else if (Cookie.read("sb_lang")) {
+ Cookie.dispose("sb_lang");
+ }
+ location.reload(true);
+}
+
+function switchTheme() {
+ var themeSelect = $('themeSwitcher');
+ var theme = themeSelect.options[themeSelect.selectedIndex].value;
+ var defaultTheme = "bittersweet";
+
+ if (theme != defaultTheme) {
+ var co = Cookie.write("sb_theme", theme, {duration: 60});
+ } else if (Cookie.read("sb_theme")) {
+ Cookie.dispose("sb_theme");
+ }
+ location.reload(true);
+}
+
+function quoteModifier(mod) {
+ return returnQuote() + mod + returnQuote();
+}
+
+function returnQuote() {
+ if (adapter == "sqlite") {
+ return "'";
+ } else if (adapter == "mysql") {
+ return "`";
+ }
+}
+
+function autoExpandTextareas() {
+ var taList = document.getElementsByTagName("textarea");
+ if (taList.length > 0 && sb.page != "export.php") {
+ var sizeDiv = new Element('div');
+ sizeDiv.id = "sizeDiv";
+ sizeDiv.style.visibility = "hidden";
+ sizeDiv.style.position = "absolute";
+ sizeDiv.style.lineHeight = "15px";
+ sizeDiv.style.fontSize = "13px";
+ sizeDiv.style.padding = "2px";
+ document.body.appendChild(sizeDiv);
+
+ for (var i=0; i ') + ' ');
+
+ var newHeight = theDiv.clientHeight + 5;
+
+ if (newHeight < 80) {
+ newHeight = 80;
+ } else if (newHeight > 300) {
+ newHeight = 300;
+ }
+
+ taList[i].style.height = newHeight + "px";
+ }
+
+ document.body.removeChild(sizeDiv);
+ }
+}
+
+function yellowFade(el, curr) {
+ if (!curr)
+ curr = 175;
+
+ el.style.background = 'rgb(255, 255, '+ (curr+=3) +')';
+
+ if (curr < 255)
+ setTimeout(function(){ yellowFade(el, curr) }, 25);
}
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/js/mootools-1.2-core.js b/htdocs/sqlbuddy/js/mootools-1.2-core.js
index da8b02170..ee90d355c 100755
--- a/htdocs/sqlbuddy/js/mootools-1.2-core.js
+++ b/htdocs/sqlbuddy/js/mootools-1.2-core.js
@@ -1,242 +1,242 @@
-//MooTools, , My Object Oriented (JavaScript) Tools. Copyright (c) 2006-2008 Valerio Proietti, , MIT Style License.
-
-var MooTools={version:"1.2.0",build:""};var Native=function(J){J=J||{};var F=J.afterImplement||function(){};var G=J.generics;G=(G!==false);var H=J.legacy;
-var E=J.initialize;var B=J.protect;var A=J.name;var C=E||H;C.constructor=Native;C.$family={name:"native"};if(H&&E){C.prototype=H.prototype;}C.prototype.constructor=C;
-if(A){var D=A.toLowerCase();C.prototype.$family={name:D};Native.typize(C,D);}var I=function(M,K,N,L){if(!B||L||!M.prototype[K]){M.prototype[K]=N;}if(G){Native.genericize(M,K,B);
-}F.call(M,K,N);return M;};C.implement=function(L,K,N){if(typeof L=="string"){return I(this,L,K,N);}for(var M in L){I(this,M,L[M],K);}return this;};C.alias=function(M,K,N){if(typeof M=="string"){M=this.prototype[M];
-if(M){I(this,K,M,N);}}else{for(var L in M){this.alias(L,M[L],K);}}return this;};return C;};Native.implement=function(D,C){for(var B=0,A=D.length;B-1:this.indexOf(A)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,"");},clean:function(){return this.replace(/\s+/g," ").trim();
-},camelCase:function(){return this.replace(/-\D/g,function(A){return A.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(A){return("-"+A.charAt(0).toLowerCase());
-});},capitalize:function(){return this.replace(/\b[a-z]/g,function(A){return A.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1");
-},toInt:function(A){return parseInt(this,A||10);},toFloat:function(){return parseFloat(this);},hexToRgb:function(B){var A=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
-return(A)?A.slice(1).hexToRgb(B):null;},rgbToHex:function(B){var A=this.match(/\d{1,3}/g);return(A)?A.rgbToHex(B):null;},stripScripts:function(B){var A="";
-var C=this.replace(/
-
-
-
-
-
-
-
+
+
+*/
+
+include "functions.php";
+
+$adapter = (isset($sbconfig['DefaultAdapter'])) ? $sbconfig['DefaultAdapter'] : "mysql";
+$host = (isset($sbconfig['DefaultHost'])) ? $sbconfig['DefaultHost'] : "localhost";
+$user = (isset($sbconfig['DefaultUser'])) ? $sbconfig['DefaultUser'] : "root";
+$pass = (isset($sbconfig['DefaultPass'])) ? $sbconfig['DefaultPass'] : "";
+
+// SQLite only
+$database = (isset($sbconfig['DefaultDatabase'])) ? $sbconfig['DefaultDatabase'] : "";
+
+if ($_POST) {
+ if (isset($_POST['ADAPTER']))
+ $adapter = $_POST['ADAPTER'];
+
+ if (isset($_POST['HOST']))
+ $host = $_POST['HOST'];
+
+ if (isset($_POST['USER']))
+ $user = $_POST['USER'];
+
+ if (isset($_POST['PASS']))
+ $pass = $_POST['PASS'];
+
+ if (isset($_POST['DATABASE']))
+ $database = $_POST['DATABASE'];
+}
+
+if (!in_array($adapter, $adapterList)) {
+ $adapter = "mysql";
+}
+
+if (($adapter != "sqlite" && $host && $user && ($pass || $_POST)) || ($adapter == "sqlite" && $database)) {
+
+ if ($adapter == "sqlite") {
+ $connString = "sqlite:database=$database";
+ $connCheck = new SQL($connString);
+ $user = "";
+ $pass = "";
+ } else {
+ $connString = "$adapter:host=$host";
+ $connCheck = new SQL($connString, $user, $pass);
+ }
+
+ if ($connCheck->isConnected()) {
+ $_SESSION['SB_LOGIN'] = true;
+ $_SESSION['SB_LOGIN_STRING'] = $connString;
+ $_SESSION['SB_LOGIN_USER'] = $user;
+ $_SESSION['SB_LOGIN_PASS'] = $pass;
+
+ $path = $_SERVER["SCRIPT_NAME"];
+ $pathSplit = explode("/", $path);
+
+ $redirect = "";
+
+ for ($i=0; $i
+
+
+
+ SQL Buddy
+
+ " />
+ " />
+ " media="print" />
+ " />
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/logout.php b/htdocs/sqlbuddy/logout.php
index 813835423..14daaef39 100755
--- a/htdocs/sqlbuddy/logout.php
+++ b/htdocs/sqlbuddy/logout.php
@@ -1,41 +1,41 @@
-
-
-*/
-
-if (!session_id())
- session_start();
-
-if (isset($_SESSION['SB_LOGIN'])) {
- $_SESSION['SB_LOGIN'] = null;
- unset($GLOBALS['_SESSION']['SB_LOGIN']);
-}
-
-if (isset($_SESSION['SB_LOGIN_STRING'])) {
- $_SESSION['SB_LOGIN_STRING'] = null;
- unset($GLOBALS['_SESSION']['SB_LOGIN_STRING']);
-}
-
-if (isset($_SESSION['SB_LOGIN_USER'])) {
- $_SESSION['SB_LOGIN_USER'] = null;
- unset($GLOBALS['_SESSION']['SB_LOGIN_USER']);
-}
-
-if (isset($_SESSION['SB_LOGIN_PASS'])) {
- $_SESSION['SB_LOGIN_PASS'] = null;
- unset($GLOBALS['_SESSION']['SB_LOGIN_PASS']);
-}
-
-header("Location: login.php");
-
+
+
+*/
+
+if (!session_id())
+ session_start();
+
+if (isset($_SESSION['SB_LOGIN'])) {
+ $_SESSION['SB_LOGIN'] = null;
+ unset($GLOBALS['_SESSION']['SB_LOGIN']);
+}
+
+if (isset($_SESSION['SB_LOGIN_STRING'])) {
+ $_SESSION['SB_LOGIN_STRING'] = null;
+ unset($GLOBALS['_SESSION']['SB_LOGIN_STRING']);
+}
+
+if (isset($_SESSION['SB_LOGIN_USER'])) {
+ $_SESSION['SB_LOGIN_USER'] = null;
+ unset($GLOBALS['_SESSION']['SB_LOGIN_USER']);
+}
+
+if (isset($_SESSION['SB_LOGIN_PASS'])) {
+ $_SESSION['SB_LOGIN_PASS'] = null;
+ unset($GLOBALS['_SESSION']['SB_LOGIN_PASS']);
+}
+
+header("Location: login.php");
+
?>
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/query.php b/htdocs/sqlbuddy/query.php
index 81e58e7f6..1141b81d1 100755
--- a/htdocs/sqlbuddy/query.php
+++ b/htdocs/sqlbuddy/query.php
@@ -1,78 +1,78 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-if (isset($db))
- $conn->selectDB($db);
-
-if (isset($_POST['query']))
- $query = $_POST['query'];
-
-echo '';
-
-if (isset($db)) {
- echo '
' . sprintf(__("Run a query on the %s database"), $db) . '. ';
-}
-
-if (isset($query)) {
- $displayQuery = $query;
-} else if (isset($db) && isset($table) && $conn->getAdapter() == "mysql") {
- $displayQuery = "SELECT * FROM `$table` LIMIT 100";
-} else if (isset($db) && isset($table) && $conn->getAdapter() == "sqlite") {
- $displayQuery = "SELECT * FROM '$table' LIMIT 100";
-}
-
-?>
-
-
-
-
-
-
-
-';
-
- require "includes/browse.php";
-
- echo '';
-}
-
-?>
-
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/serve.php b/htdocs/sqlbuddy/serve.php
index fcec1b681..685c9b821 100755
--- a/htdocs/sqlbuddy/serve.php
+++ b/htdocs/sqlbuddy/serve.php
@@ -1,116 +1,116 @@
-
-
-*/
-
-include "config.php";
-
-function compressCSS($input) {
- // remove comments
- $input = preg_replace("/\/\*.*\*\//Us", "", $input);
-
- // remove unnecessary characters
- $input = str_replace(":0px", ":0", $input);
- $input = str_replace(":0em", ":0", $input);
- $input = str_replace(" 0px", " 0", $input);
- $input = str_replace(" 0em", " 0", $input);
- $input = str_replace(";}", "}", $input);
-
- // remove spaces, etc
- $input = preg_replace('/\s\s+/', ' ', $input);
- $input = str_replace(" {", "{", $input);
- $input = str_replace("{ ", "{", $input);
- $input = str_replace("\n{", "{", $input);
- $input = str_replace("{\n", "{", $input);
- $input = str_replace(" }", "}", $input);
- $input = str_replace("} ", "}", $input);
- $input = str_replace(": ", ":", $input);
- $input = str_replace(" :", ":", $input);
- $input = str_replace(";\n", ";", $input);
- $input = str_replace(" ;", ";", $input);
- $input = str_replace("; ", ";", $input);
- $input = str_replace(", ", ",", $input);
-
- return trim($input);
-}
-
-function compressJS($input) {
-
- // remove comments
- $input = preg_replace("/\/\/.*\n/Us", "", $input);
- $input = preg_replace("/\/\*.*\*\//Us", "", $input);
-
- // remove spaces, etc
- $input = preg_replace("/\t/", "", $input);
- $input = preg_replace("/\n\n+/m", "\n", $input);
- $input = str_replace(";\n", ";", $input);
- $input = str_replace(" = ", "=", $input);
- $input = str_replace(" == ", "==", $input);
- $input = str_replace(" || ", "||", $input);
- $input = str_replace(" && ", "&&", $input);
- $input = str_replace(")\n{", "){", $input);
- $input = str_replace("if (", "if(", $input);
-
- return trim($input);
-}
-
-if (isset($_GET['file'])) {
-
- $filename = $_GET['file'];
-
- if (!(strpos($filename, "css/") === 0 || strpos($filename, "themes/") === 0 || strpos($filename, "js/") === 0))
- exit;
-
- if (strpos($filename, "..") !== false)
- exit;
-
- if (file_exists($filename)) {
- if (extension_loaded('zlib') && ((isset($sbconfig['EnableGzip']) && $sbconfig['EnableGzip'] == true) || !isset($sbconfig['EnableGzip']))) {
- ob_start("ob_gzhandler");
- } else {
- ob_start();
- }
-
- $last_modified_time = filemtime($filename);
- $etag = md5_file($filename);
-
- header("Last-Modified: " . gmdate("D, d M Y H:i:s", $last_modified_time) . " GMT");
- header("Expires: " . gmdate("D, d M Y H:i:s", time()+24*60*60*60) . " GMT");
- header("Etag: $etag");
-
- if ((array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER) && @strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time) || (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag)) {
- header("HTTP/1.1 304 Not Modified");
- exit;
- }
-
- $contents = file_get_contents($filename);
-
- if (substr($filename, -4) == ".css") {
- header("Content-Type: text/css; charset=utf-8");
- $contents = compressCSS($contents);
- } else if (substr($filename, -3) == ".js" && strpos($filename, "mootools") === false) {
- header("Content-Type: application/x-javascript; charset=utf-8");
- $contents = compressJS($contents);
- } else if (substr($filename, -3) == ".js") {
- header("Content-Type: application/x-javascript; charset=utf-8");
- }
-
- echo $contents;
-
- ob_end_flush();
- } else {
- echo "File doesn't exist!";
- }
-}
-
+
+
+*/
+
+include "config.php";
+
+function compressCSS($input) {
+ // remove comments
+ $input = preg_replace("/\/\*.*\*\//Us", "", $input);
+
+ // remove unnecessary characters
+ $input = str_replace(":0px", ":0", $input);
+ $input = str_replace(":0em", ":0", $input);
+ $input = str_replace(" 0px", " 0", $input);
+ $input = str_replace(" 0em", " 0", $input);
+ $input = str_replace(";}", "}", $input);
+
+ // remove spaces, etc
+ $input = preg_replace('/\s\s+/', ' ', $input);
+ $input = str_replace(" {", "{", $input);
+ $input = str_replace("{ ", "{", $input);
+ $input = str_replace("\n{", "{", $input);
+ $input = str_replace("{\n", "{", $input);
+ $input = str_replace(" }", "}", $input);
+ $input = str_replace("} ", "}", $input);
+ $input = str_replace(": ", ":", $input);
+ $input = str_replace(" :", ":", $input);
+ $input = str_replace(";\n", ";", $input);
+ $input = str_replace(" ;", ";", $input);
+ $input = str_replace("; ", ";", $input);
+ $input = str_replace(", ", ",", $input);
+
+ return trim($input);
+}
+
+function compressJS($input) {
+
+ // remove comments
+ $input = preg_replace("/\/\/.*\n/Us", "", $input);
+ $input = preg_replace("/\/\*.*\*\//Us", "", $input);
+
+ // remove spaces, etc
+ $input = preg_replace("/\t/", "", $input);
+ $input = preg_replace("/\n\n+/m", "\n", $input);
+ $input = str_replace(";\n", ";", $input);
+ $input = str_replace(" = ", "=", $input);
+ $input = str_replace(" == ", "==", $input);
+ $input = str_replace(" || ", "||", $input);
+ $input = str_replace(" && ", "&&", $input);
+ $input = str_replace(")\n{", "){", $input);
+ $input = str_replace("if (", "if(", $input);
+
+ return trim($input);
+}
+
+if (isset($_GET['file'])) {
+
+ $filename = $_GET['file'];
+
+ if (!(strpos($filename, "css/") === 0 || strpos($filename, "themes/") === 0 || strpos($filename, "js/") === 0))
+ exit;
+
+ if (strpos($filename, "..") !== false)
+ exit;
+
+ if (file_exists($filename)) {
+ if (extension_loaded('zlib') && ((isset($sbconfig['EnableGzip']) && $sbconfig['EnableGzip'] == true) || !isset($sbconfig['EnableGzip']))) {
+ ob_start("ob_gzhandler");
+ } else {
+ ob_start();
+ }
+
+ $last_modified_time = filemtime($filename);
+ $etag = md5_file($filename);
+
+ header("Last-Modified: " . gmdate("D, d M Y H:i:s", $last_modified_time) . " GMT");
+ header("Expires: " . gmdate("D, d M Y H:i:s", time()+24*60*60*60) . " GMT");
+ header("Etag: $etag");
+
+ if ((array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER) && @strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time) || (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag)) {
+ header("HTTP/1.1 304 Not Modified");
+ exit;
+ }
+
+ $contents = file_get_contents($filename);
+
+ if (substr($filename, -4) == ".css") {
+ header("Content-Type: text/css; charset=utf-8");
+ $contents = compressCSS($contents);
+ } else if (substr($filename, -3) == ".js" && strpos($filename, "mootools") === false) {
+ header("Content-Type: application/x-javascript; charset=utf-8");
+ $contents = compressJS($contents);
+ } else if (substr($filename, -3) == ".js") {
+ header("Content-Type: application/x-javascript; charset=utf-8");
+ }
+
+ echo $contents;
+
+ ob_end_flush();
+ } else {
+ echo "File doesn't exist!";
+ }
+}
+
?>
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/structure.php b/htdocs/sqlbuddy/structure.php
index 858559f5e..969f047cf 100755
--- a/htdocs/sqlbuddy/structure.php
+++ b/htdocs/sqlbuddy/structure.php
@@ -1,775 +1,775 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-requireDatabaseAndTableBeDefined();
-
-if (isset($db))
- $conn->selectDB($db);
-
-if (isset($_POST)) {
-
- // process form - add index
- if (isset($_POST['INDEXTYPE']))
- $indexType = $_POST['INDEXTYPE'];
-
- if (isset($_POST['INDEXCOLUMNLIST']))
- $indexColumnList = $_POST['INDEXCOLUMNLIST'];
-
- if (isset($indexType) && isset($indexColumnList) && $indexType && $indexColumnList) {
- $indexColumnList = implode("`, `", $indexColumnList);
-
- $indexQuery = "ALTER TABLE `$table` ADD ";
-
- if ($indexType == "INDEX")
- $indexQuery .= "INDEX";
- else if ($indexType == "UNIQUE")
- $indexQuery .= "UNIQUE";
-
- $indexQuery .= " (`" . $indexColumnList . "`)";
-
- $conn->query($indexQuery) or ($dbError = $conn->error());
- }
-
- ?>
-
-
-
- query($query) or ($dbError = $conn->error());
- }
-}
-
-if (isset($dbError)) {
- echo '' . __("Error performing operation") . ' ' . $dbError . '
';
-}
-
-$structureSql = $conn->describeTable($table);
-
-if ($conn->getAdapter() == "mysql" && $conn->isResultSet($structureSql)) {
-
-?>
-
-
-
-
-
-
-
- ';
-
- echo '
';
-
- echo '';
-
- echo '';
-
- $structureSql = $conn->describeTable($table);
-
- echo '';
- echo '';
-
- ?>
-
-
-
-
-
- query("SHOW INDEX FROM `$table`");
-
- if ($conn->isResultSet($indexListSQL)) {
-
- ?>
-
-
-
-
-
- fetchAssoc($indexListSQL)) {
- if (!array_key_exists($indexListRow['Key_name'], $indexList)) {
- $indexList[$indexListRow['Key_name']] = $indexListRow['Column_name'];
- } else {
- $indexList[$indexListRow['Key_name']] .= ", " . $indexListRow['Column_name'];
- }
- }
-
- echo '
';
-
- echo '
';
-
- echo '';
-
- echo '
';
-
- echo '
';
- echo '
';
-
- $m++;
-
- }
-
- ?>
-
-
-
-
-
-
-
-
-
-
-
- query("SHOW TABLE STATUS LIKE '$table'");
-
- if ($conn->isResultSet($infoSql) == 1) {
-
- $infoRow = $conn->fetchAssoc($infoSql);
-
- ?>
-
-
-
- ' . __("Storage engine") . ':' . $engine . ' ';
-
- if (array_key_exists('Collation', $infoRow) && isset($collationList) && array_key_exists($infoRow['Collation'], $collationList)) {
- echo '' . ("Charset") . ': ' . $collationList[$infoRow['Collation']] . ' ';
- }
-
- echo '' . __("Rows") . ': ' . number_format($infoRow['Rows']) . ' ';
- echo '' . __("Size") . ': ' . memoryFormat($infoRow['Data_length']) . ' ';
- echo '' . __("Overhead") . ': ' . memoryFormat($infoRow['Data_free']) . ' ';
- echo '' . __("Auto Increment") . ': ' . number_format($infoRow['Auto_increment']) . ' ';
-
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-getAdapter() == "sqlite" && sizeof($structureSql) > 0) {
-
-?>
-
-
-
-
-
-
-
-
- ' . __("Columns") . '';
-
- ?>
-
-
-
-
-
- ';
-
- echo '';
-
- echo '';
- echo '';
-
- if (version_compare($conn->getVersion(), "3.1.3", ">")) {
-
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tableRowCount($table);
-
- ?>
-
-
-
- ' . __("Rows") . ':' . number_format($rowCount) . ' ';
-
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+*/
+
+include "functions.php";
+
+loginCheck();
+
+requireDatabaseAndTableBeDefined();
+
+if (isset($db))
+ $conn->selectDB($db);
+
+if (isset($_POST)) {
+
+ // process form - add index
+ if (isset($_POST['INDEXTYPE']))
+ $indexType = $_POST['INDEXTYPE'];
+
+ if (isset($_POST['INDEXCOLUMNLIST']))
+ $indexColumnList = $_POST['INDEXCOLUMNLIST'];
+
+ if (isset($indexType) && isset($indexColumnList) && $indexType && $indexColumnList) {
+ $indexColumnList = implode("`, `", $indexColumnList);
+
+ $indexQuery = "ALTER TABLE `$table` ADD ";
+
+ if ($indexType == "INDEX")
+ $indexQuery .= "INDEX";
+ else if ($indexType == "UNIQUE")
+ $indexQuery .= "UNIQUE";
+
+ $indexQuery .= " (`" . $indexColumnList . "`)";
+
+ $conn->query($indexQuery) or ($dbError = $conn->error());
+ }
+
+ ?>
+
+
+
+ query($query) or ($dbError = $conn->error());
+ }
+}
+
+if (isset($dbError)) {
+ echo '' . __("Error performing operation") . ' ' . $dbError . '
';
+}
+
+$structureSql = $conn->describeTable($table);
+
+if ($conn->getAdapter() == "mysql" && $conn->isResultSet($structureSql)) {
+
+?>
+
+
+
+
+
+
+
+ ';
+
+ echo '
';
+
+ echo '';
+
+ echo '';
+
+ $structureSql = $conn->describeTable($table);
+
+ echo '';
+ echo '';
+
+ ?>
+
+
+
+
+
+ query("SHOW INDEX FROM `$table`");
+
+ if ($conn->isResultSet($indexListSQL)) {
+
+ ?>
+
+
+
+
+
+ fetchAssoc($indexListSQL)) {
+ if (!array_key_exists($indexListRow['Key_name'], $indexList)) {
+ $indexList[$indexListRow['Key_name']] = $indexListRow['Column_name'];
+ } else {
+ $indexList[$indexListRow['Key_name']] .= ", " . $indexListRow['Column_name'];
+ }
+ }
+
+ echo '
';
+
+ echo '
';
+
+ echo '';
+
+ echo '
';
+
+ echo '
';
+ echo '
';
+
+ $m++;
+
+ }
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+ query("SHOW TABLE STATUS LIKE '$table'");
+
+ if ($conn->isResultSet($infoSql) == 1) {
+
+ $infoRow = $conn->fetchAssoc($infoSql);
+
+ ?>
+
+
+
+ ' . __("Storage engine") . ':' . $engine . ' ';
+
+ if (array_key_exists('Collation', $infoRow) && isset($collationList)) {
+ echo '' . ("Charset") . ': ' . $collationList[$infoRow['Collation']] . ' ';
+ }
+
+ echo '' . __("Rows") . ': ' . number_format($infoRow['Rows']) . ' ';
+ echo '' . __("Size") . ': ' . memoryFormat($infoRow['Data_length']) . ' ';
+ echo '' . __("Overhead") . ': ' . memoryFormat($infoRow['Data_free']) . ' ';
+ echo '' . __("Auto Increment") . ': ' . number_format($infoRow['Auto_increment']) . ' ';
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+getAdapter() == "sqlite" && sizeof($structureSql) > 0) {
+
+?>
+
+
+
+
+
+
+
+
+ ' . __("Columns") . '';
+
+ ?>
+
+
+
+
+
+ ';
+
+ echo '';
+
+ echo '';
+ echo '';
+
+ if (version_compare($conn->getVersion(), "3.1.3", ">")) {
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tableRowCount($table);
+
+ ?>
+
+
+
+ ' . __("Rows") . ':' . number_format($rowCount) . ' ';
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/themes/bittersweet/css/ie.css b/htdocs/sqlbuddy/themes/bittersweet/css/ie.css
index 7965211c3..b0e6c8782 100755
--- a/htdocs/sqlbuddy/themes/bittersweet/css/ie.css
+++ b/htdocs/sqlbuddy/themes/bittersweet/css/ie.css
@@ -1,44 +1,44 @@
-#header {
-padding-bottom: 4px;
-}
-
-#rightside {
-padding-bottom: 0 !important;
-}
-
-.leftchecks {
-margin-left: -22px !important;
-}
-.browsetab .leftchecks {
-margin-left: -38px !important;
-}
-
-.manip {
-padding-top: 0 !important;
-padding-bottom: 1px !important;
-}
-.manip dt {
-padding: 0 5px 0 1px !important;
-}
-
-.browsetab .gridheader, .users .gridheader {
-margin-top: -15px;
-}
-
-.dblist {
-float: none !important;
-}
-.dblist ul li {
-float: none !important;
-}
-
-.sublist {
-width: 225px;
-}
-
-#leftside {
-width: 225px !important;
-}
-#rightside {
-margin-left: 225px !important;
+#header {
+padding-bottom: 4px;
+}
+
+#rightside {
+padding-bottom: 0 !important;
+}
+
+.leftchecks {
+margin-left: -22px !important;
+}
+.browsetab .leftchecks {
+margin-left: -38px !important;
+}
+
+.manip {
+padding-top: 0 !important;
+padding-bottom: 1px !important;
+}
+.manip dt {
+padding: 0 5px 0 1px !important;
+}
+
+.browsetab .gridheader, .users .gridheader {
+margin-top: -15px;
+}
+
+.dblist {
+float: none !important;
+}
+.dblist ul li {
+float: none !important;
+}
+
+.sublist {
+width: 225px;
+}
+
+#leftside {
+width: 225px !important;
+}
+#rightside {
+margin-left: 225px !important;
}
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/themes/bittersweet/css/main.css b/htdocs/sqlbuddy/themes/bittersweet/css/main.css
index 4937196e9..dd69ca055 100755
--- a/htdocs/sqlbuddy/themes/bittersweet/css/main.css
+++ b/htdocs/sqlbuddy/themes/bittersweet/css/main.css
@@ -1,155 +1,155 @@
-body {
-background: rgb(255, 255, 255) url(../images/initLoad-dark.png) no-repeat 50% 125px;
-}
-
-#header {
-background: rgb(80, 80, 80) url(../images/header.png) repeat-x;
-}
-
-#headerlogo {
-width: 185px !important;
-}
-#leftside {
-width: 205px !important;
-overflow-y: hidden;
-}
-#rightside {
-margin-left: 205px !important;
-}
-#sidemenu {
-overflow-x: hidden;
-}
-
-#bottom {
-background: transparent url(../../../images/window-shadow-bottom.png) repeat-x scroll 0px -7px;
-}
-
-#innercontent a {
-color: steelBlue;
-}
-#innercontent a:hover {
-color: rgb(50, 50, 50);
-}
-
-h3, h4 {
-color: rgb(135, 135, 115);
-text-transform: uppercase;
-font-weight: normal;
-}
-h3 {
-font-size: 12px;
-}
-h4 {
-border-bottom: 1px solid rgb(210, 210, 210);
-line-height: 1.3;
-font-size: 14px;
-}
-
-#headerinfo a {
-color: rgb(200, 200, 200) !important;
-text-decoration: none;
-}
-#headerinfo a:hover {
-color: rgb(250, 250, 250) !important;
-}
-
-.grid {
-border-color: rgb(220, 220, 220) rgb(190, 190, 190) rgb(190, 190, 190) rgb(190, 190, 190);
-}
-
-.alternator {
-border-bottom-color: transparent;
-background: white;
-}
-.alternator2 {
-background: rgb(245, 245, 245);
-}
-.highlighted {
-border-bottom-color: rgb(210, 210, 210) !important;
-background: rgb(230, 230, 215) !important;
-}
-
-.paginator a {
-color: rgb(125, 125, 125) !important;
-}
-
-.dblistheader {
-color: rgb(150, 150, 150) !important;
-}
-.dblist {
-float: left;
-}
-.dblist ul li {
-float: left;
-clear: left;
-}
-.dblist ul li a {
-display: inline !important;
-border-width: 0 !important;
-}
-.dblist ul li a .menutext {
-color: rgb(80, 80, 80);
-margin-left: 0 !important;
-float: left;
-}
-.dblist ul li a:hover .menutext {
-color: rgb(40, 40, 40);
-}
-.dblist ul li a .menuicon {
-color: rgb(150, 150, 150) !important;
-}
-.dblist ul li.selected>a {
-font-weight: bold;
-}
-.sublist {
-float: left;
-clear: left;
-line-height: 18px;
-}
-.sublist li a {
-color: rgb(80, 80, 80);
-}
-.sublist li a:hover {
-color: rgb(40, 40, 40);
-}
-.subcount {
-color: rgb(150, 150, 150);
-}
-
-#loginform {
-padding: 3px;
-border: 1px solid rgb(200, 200, 200);
-}
-#loginform .loginspacer {
-background: #E9EBDF !important;
-padding: 10px 15px 10px 11px !important;
-}
-.loginheader {
-border-bottom-color: rgb(200, 200, 200);
-}
-#loginform .field {
-color: #777;
-}
-
-#toptabs ul li a {
-color: rgb(220, 220, 220);
-}
-#toptabs ul li a .rowcount {
-color: rgb(175, 175, 175);
-}
-#toptabs ul li a:hover {
-color: rgb(250, 250, 250);
-}
-#toptabs ul li.selected a {
-color: rgb(250, 250, 250);
-font-weight: bold;
-}
-#toptabs ul li.selected a .rowcount {
-color: rgb(225, 225, 225);
-}
-#toptabs ul li.deactivated a {
-color: rgb(135, 135, 135) !important;
-}
-#toptabs ul li.deactivated a .rowcount {
-color: rgb(175, 175, 175) !important;
+body {
+background: rgb(255, 255, 255) url(../images/initLoad-dark.png) no-repeat 50% 125px;
+}
+
+#header {
+background: rgb(80, 80, 80) url(../images/header.png) repeat-x;
+}
+
+#headerlogo {
+width: 185px !important;
+}
+#leftside {
+width: 205px !important;
+overflow-y: hidden;
+}
+#rightside {
+margin-left: 205px !important;
+}
+#sidemenu {
+overflow-x: hidden;
+}
+
+#bottom {
+background: transparent url(../../../images/window-shadow-bottom.png) repeat-x scroll 0px -7px;
+}
+
+#innercontent a {
+color: steelBlue;
+}
+#innercontent a:hover {
+color: rgb(50, 50, 50);
+}
+
+h3, h4 {
+color: rgb(135, 135, 115);
+text-transform: uppercase;
+font-weight: normal;
+}
+h3 {
+font-size: 12px;
+}
+h4 {
+border-bottom: 1px solid rgb(210, 210, 210);
+line-height: 1.3;
+font-size: 14px;
+}
+
+#headerinfo a {
+color: rgb(200, 200, 200) !important;
+text-decoration: none;
+}
+#headerinfo a:hover {
+color: rgb(250, 250, 250) !important;
+}
+
+.grid {
+border-color: rgb(220, 220, 220) rgb(190, 190, 190) rgb(190, 190, 190) rgb(190, 190, 190);
+}
+
+.alternator {
+border-bottom-color: transparent;
+background: white;
+}
+.alternator2 {
+background: rgb(245, 245, 245);
+}
+.highlighted {
+border-bottom-color: rgb(210, 210, 210) !important;
+background: rgb(230, 230, 215) !important;
+}
+
+.paginator a {
+color: rgb(125, 125, 125) !important;
+}
+
+.dblistheader {
+color: rgb(150, 150, 150) !important;
+}
+.dblist {
+float: left;
+}
+.dblist ul li {
+float: left;
+clear: left;
+}
+.dblist ul li a {
+display: inline !important;
+border-width: 0 !important;
+}
+.dblist ul li a .menutext {
+color: rgb(80, 80, 80);
+margin-left: 0 !important;
+float: left;
+}
+.dblist ul li a:hover .menutext {
+color: rgb(40, 40, 40);
+}
+.dblist ul li a .menuicon {
+color: rgb(150, 150, 150) !important;
+}
+.dblist ul li.selected>a {
+font-weight: bold;
+}
+.sublist {
+float: left;
+clear: left;
+line-height: 18px;
+}
+.sublist li a {
+color: rgb(80, 80, 80);
+}
+.sublist li a:hover {
+color: rgb(40, 40, 40);
+}
+.subcount {
+color: rgb(150, 150, 150);
+}
+
+#loginform {
+padding: 3px;
+border: 1px solid rgb(200, 200, 200);
+}
+#loginform .loginspacer {
+background: #E9EBDF !important;
+padding: 10px 15px 10px 11px !important;
+}
+.loginheader {
+border-bottom-color: rgb(200, 200, 200);
+}
+#loginform .field {
+color: #777;
+}
+
+#toptabs ul li a {
+color: rgb(220, 220, 220);
+}
+#toptabs ul li a .rowcount {
+color: rgb(175, 175, 175);
+}
+#toptabs ul li a:hover {
+color: rgb(250, 250, 250);
+}
+#toptabs ul li.selected a {
+color: rgb(250, 250, 250);
+font-weight: bold;
+}
+#toptabs ul li.selected a .rowcount {
+color: rgb(225, 225, 225);
+}
+#toptabs ul li.deactivated a {
+color: rgb(135, 135, 135) !important;
+}
+#toptabs ul li.deactivated a .rowcount {
+color: rgb(175, 175, 175) !important;
}
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/themes/classic/css/ie.css b/htdocs/sqlbuddy/themes/classic/css/ie.css
index 3af70b392..749d8557b 100755
--- a/htdocs/sqlbuddy/themes/classic/css/ie.css
+++ b/htdocs/sqlbuddy/themes/classic/css/ie.css
@@ -1,31 +1,31 @@
-#header {
-padding-bottom: 4px;
-}
-
-#rightside {
-padding-bottom: 0 !important;
-}
-
-.leftchecks {
-margin-left: -22px !important;
-}
-.browsetab .leftchecks {
-margin-left: -38px !important;
-}
-
-.manip {
-padding-top: 0 !important;
-padding-bottom: 1px !important;
-}
-.manip dt {
-padding: 0 5px 0 1px !important;
-}
-
-.browsetab .gridheader, .users .gridheader {
-margin-top: -15px;
-}
-
-.sublist li a {
-padding-top: 0 !important;
-padding-bottom: 1px !important;
+#header {
+padding-bottom: 4px;
+}
+
+#rightside {
+padding-bottom: 0 !important;
+}
+
+.leftchecks {
+margin-left: -22px !important;
+}
+.browsetab .leftchecks {
+margin-left: -38px !important;
+}
+
+.manip {
+padding-top: 0 !important;
+padding-bottom: 1px !important;
+}
+.manip dt {
+padding: 0 5px 0 1px !important;
+}
+
+.browsetab .gridheader, .users .gridheader {
+margin-top: -15px;
+}
+
+.sublist li a {
+padding-top: 0 !important;
+padding-bottom: 1px !important;
}
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/themes/classic/css/main.css b/htdocs/sqlbuddy/themes/classic/css/main.css
index ad4b781b6..109923426 100755
--- a/htdocs/sqlbuddy/themes/classic/css/main.css
+++ b/htdocs/sqlbuddy/themes/classic/css/main.css
@@ -1,111 +1,111 @@
-html {
-background: rgb(125, 125, 125) url(../images/shading.png);
-}
-
-#header {
-background: url(../images/header.png) repeat-x bottom;
-border-bottom: 1px solid rgb(150, 150, 150);
-}
-
-h3, h4 {
-color: steelblue;
-}
-
-#innercontent {
-background: white;
-border-color: rgb(75, 75, 75);
-border-width: 0 2px;
-border-style: solid;
-}
-
-.corners {
-background: rgb(75, 75, 75);
-height: 2px;
-}
-.corners div {
-width: 4px;
-height: 4px;
-background-repeat: no-repeat;
-}
-.tl {
-background: url(../images/corner-tl.png);
-float: left;
-}
-.tr {
-background: url(../images/corner-tr.png);
-float: right;
-}
-.bl {
-background: url(../images/corner-bl.png);
-float: left;
-margin-top: -2px;
-}
-.br {
-background: url(../images/corner-br.png);
-float: right;
-margin-top: -2px;
-}
-
-#headerinfo a {
-color: rgb(215, 215, 215) !important;
-text-shadow: rgb(50, 50, 50) 0 1px 0;
-}
-#headerinfo a:hover {
-color: #fff !important;
-}
-
-#loginform {
-padding: 7px;
-background: url(../../../images/transparent.png);
-}
-#loginform .loginspacer {
-background: white;
-}
-
-.dblistheader {
-color: rgb(220, 220, 220);
-text-shadow: rgb(75, 75, 75) 0px 1px 0px;
-}
-
-.dblist ul li a .menutext {
-color: #fff;
-}
-.dblist ul li a .menuicon {
-color: rgb(220, 220, 220);
-}
-.dblist ul li.selected>a {
-background: rgb(90, 90, 90) !important;
-border-color: rgb(70, 70, 70);
-}
-.sublist li a {
-color: #fff;
-}
-.subcount {
-color: rgb(200, 200, 200);
-}
-
-#toptabs ul li a {
-color: rgb(215, 215, 215);
-text-shadow: rgb(50, 50, 50) 0 1px 0;
-font-weight: bold;
-}
-#toptabs ul li a .rowcount {
-color: rgb(235, 235, 235);
-}
-#toptabs ul li a:hover {
-color: #fff;
-}
-#toptabs ul li.selected a {
-color: #fff;
-font-weight: bold;
-text-shadow: rgb(50, 50, 50) 0 1px 0;
-}
-#toptabs ul li.selected a .rowcount {
-color: rgb(235, 235, 235);
-}
-#toptabs ul li.deactivated a {
-color: rgb(175, 175, 175) !important;
-}
-#toptabs ul li.deactivated a .rowcount {
-color: rgb(175, 175, 175) !important;
+html {
+background: rgb(125, 125, 125) url(../images/shading.png);
+}
+
+#header {
+background: url(../images/header.png) repeat-x bottom;
+border-bottom: 1px solid rgb(150, 150, 150);
+}
+
+h3, h4 {
+color: steelblue;
+}
+
+#innercontent {
+background: white;
+border-color: rgb(75, 75, 75);
+border-width: 0 2px;
+border-style: solid;
+}
+
+.corners {
+background: rgb(75, 75, 75);
+height: 2px;
+}
+.corners div {
+width: 4px;
+height: 4px;
+background-repeat: no-repeat;
+}
+.tl {
+background: url(../images/corner-tl.png);
+float: left;
+}
+.tr {
+background: url(../images/corner-tr.png);
+float: right;
+}
+.bl {
+background: url(../images/corner-bl.png);
+float: left;
+margin-top: -2px;
+}
+.br {
+background: url(../images/corner-br.png);
+float: right;
+margin-top: -2px;
+}
+
+#headerinfo a {
+color: rgb(215, 215, 215) !important;
+text-shadow: rgb(50, 50, 50) 0 1px 0;
+}
+#headerinfo a:hover {
+color: #fff !important;
+}
+
+#loginform {
+padding: 7px;
+background: url(../../../images/transparent.png);
+}
+#loginform .loginspacer {
+background: white;
+}
+
+.dblistheader {
+color: rgb(220, 220, 220);
+text-shadow: rgb(75, 75, 75) 0px 1px 0px;
+}
+
+.dblist ul li a .menutext {
+color: #fff;
+}
+.dblist ul li a .menuicon {
+color: rgb(220, 220, 220);
+}
+.dblist ul li.selected>a {
+background: rgb(90, 90, 90) !important;
+border-color: rgb(70, 70, 70);
+}
+.sublist li a {
+color: #fff;
+}
+.subcount {
+color: rgb(200, 200, 200);
+}
+
+#toptabs ul li a {
+color: rgb(215, 215, 215);
+text-shadow: rgb(50, 50, 50) 0 1px 0;
+font-weight: bold;
+}
+#toptabs ul li a .rowcount {
+color: rgb(235, 235, 235);
+}
+#toptabs ul li a:hover {
+color: #fff;
+}
+#toptabs ul li.selected a {
+color: #fff;
+font-weight: bold;
+text-shadow: rgb(50, 50, 50) 0 1px 0;
+}
+#toptabs ul li.selected a .rowcount {
+color: rgb(235, 235, 235);
+}
+#toptabs ul li.deactivated a {
+color: rgb(175, 175, 175) !important;
+}
+#toptabs ul li.deactivated a .rowcount {
+color: rgb(175, 175, 175) !important;
}
\ No newline at end of file
diff --git a/htdocs/sqlbuddy/users.php b/htdocs/sqlbuddy/users.php
index 910a68a5d..8902eb9b4 100755
--- a/htdocs/sqlbuddy/users.php
+++ b/htdocs/sqlbuddy/users.php
@@ -1,440 +1,440 @@
-
-
-*/
-
-include "functions.php";
-
-loginCheck();
-
-function removeAdminPrivs($priv) {
- if ($priv == "FILE" || $priv == "PROCESS" || $priv == "RELOAD" || $priv == "SHUTDOWN" || $priv == "SUPER")
- return false;
- else
- return true;
-}
-
-if ($_POST) {
-
- if (isset($_POST['NEWHOST']))
- $newHost = $_POST['NEWHOST'];
- else
- $newHost = "localhost";
-
- if (isset($_POST['NEWNAME']))
- $newName = $_POST['NEWNAME'];
-
- if (isset($_POST['NEWPASS']))
- $newPass = $_POST['NEWPASS'];
-
- if (isset($_POST['ACCESSLEVEL']))
- $accessLevel = $_POST['ACCESSLEVEL'];
- else
- $accessLevel = "GLOBAL";
-
- if ($accessLevel != "LIMITED")
- $accessLevel = "GLOBAL";
-
- if (isset($_POST['DBLIST']))
- $dbList = $_POST['DBLIST'];
- else
- $dbList = array();
-
- if (isset($_POST['NEWCHOICE']))
- $newChoice = $_POST['NEWCHOICE'];
-
- if (isset($_POST['NEWPRIVILEGES']))
- $newPrivileges = $_POST['NEWPRIVILEGES'];
-
- if (isset($newName) && ($accessLevel == "GLOBAL" || ($accessLevel == "LIMITED" && sizeof($dbList) > 0))) {
-
- if ($newChoice == "ALL") {
- $privList = "ALL";
- } else {
-
- if (sizeof($newPrivileges) > 0) {
- if ($accessLevel == "LIMITED") {
- $newPrivileges = array_filter($newPrivileges, "removeAdminPrivs");
- }
-
- $privList = implode(", ", $newPrivileges);
-
- } else {
- $privList = "USAGE";
- }
- }
-
- if ($accessLevel == "LIMITED") {
- foreach ($dbList as $theDb) {
- $newQuery = "GRANT " . $privList;
-
- $newQuery .= " ON `$theDb`.*";
-
- $newQuery .= " TO '" . $newName . "'@'" . $newHost . "'";
-
- if ($newPass)
- $newQuery .= " IDENTIFIED BY '" . $newPass . "'";
-
- if (isset($_POST['GRANTOPTION']))
- $newQuery .= " WITH GRANT OPTION";
-
- $conn->query($newQuery) or ($dbError = $conn->error());
- }
- } else {
- $newQuery = "GRANT " . $privList;
-
- $newQuery .= " ON *.*";
-
- $newQuery .= " TO '" . $newName . "'@'" . $newHost . "'";
-
- if ($newPass)
- $newQuery .= " IDENTIFIED BY '" . $newPass . "'";
-
- if (isset($_POST['GRANTOPTION']))
- $newQuery .= " WITH GRANT OPTION";
-
- $conn->query($newQuery) or ($dbError = $conn->error());
- }
-
- $conn->query("FLUSH PRIVILEGES") or ($dbError = $conn->error());
-
- }
-}
-
-$connected = $conn->selectDB("mysql");
-
-// delete users
-if (isset($_POST['deleteUsers']) && $connected) {
- $deleteUsers = $_POST['deleteUsers'];
-
- // boom!
- $userList = explode(";", $deleteUsers);
-
- foreach ($userList as $each) {
- $split = explode("@", $each, 2);
-
- if (isset($split[0]))
- $user = trim($split[0]);
-
- if (isset($split[1]))
- $host = trim($split[1]);
-
- if (isset($user) && isset($host)) {
- $conn->query("REVOKE ALL PRIVILEGES ON *.* FROM '$user'@'$host'");
- $conn->query("REVOKE GRANT OPTION ON *.* FROM '$user'@'$host'");
- $conn->query("DELETE FROM `user` WHERE `User`='$user' AND `Host`='$host'");
- $conn->query("DELETE FROM `db` WHERE `User`='$user' AND `Host`='$host'");
- $conn->query("DELETE FROM `tables_priv` WHERE `User`='$user' AND `Host`='$host'");
- $conn->query("DELETE FROM `columns_priv` WHERE `User`='$user' AND `Host`='$host'");
- }
- }
- $conn->query("FLUSH PRIVILEGES");
-}
-
-if (isset($dbError)) {
- echo '';
- echo '
' . __("Error performing operation") . ' ' . $dbError . '
';
- echo '
';
-}
-
-?>
-
-
-
-query("SELECT * FROM `user`");
-
- if ($conn->isResultSet($userSql)) {
-
- ?>
-
-
-
- ';
-
- echo '
';
-
- echo '';
-
- echo '
';
-
- $userSql = $conn->query("SELECT * FROM `user`");
-
- echo '
';
- echo '
';
-
- }
-
- $hasPermissions = false;
-
- // check to see if this user has proper permissions to manage users
- $checkSql = $conn->query("SELECT `Grant_priv` FROM `user` WHERE `Host`='" . $conn->getOptionValue("host") . "' AND `User`='" . $_SESSION['SB_LOGIN_USER'] . "' LIMIT 1");
-
- if ($conn->isResultSet($checkSql)) {
- $grantValue = $conn->result($checkSql, 0, "Grant_priv");
-
- if ($grantValue == "Y") {
- $hasPermissions = true;
- }
- }
-
- if ($hasPermissions) {
-
- ?>
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file