Git
Threads by month
- ----- 2025 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 11 participants
- 38616 discussions

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_5_1-7899-g55a3736
by Michal Čihař 23 Aug '10
by Michal Čihař 23 Aug '10
23 Aug '10
The branch, master has been updated
via 55a373668bcc61412a1ff03aaf4854f684e96f44 (commit)
via 027164ff8d795d3191efc3f40e08ffee37e80c8c (commit)
via 152df38d332545665203d9c23cb4f5cbcb6ab9e3 (commit)
via fb6a06021c22bba776851297b5a7aa9035c9c223 (commit)
from 3959481120ea4037c3c1b6926bbabc86ea4381b7 (commit)
- Log -----------------------------------------------------------------
commit 55a373668bcc61412a1ff03aaf4854f684e96f44
Merge: 152df38d332545665203d9c23cb4f5cbcb6ab9e3 027164ff8d795d3191efc3f40e08ffee37e80c8c
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon Aug 23 11:18:55 2010 +0200
Merge remote branch 'pootle/master'
commit 027164ff8d795d3191efc3f40e08ffee37e80c8c
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:18:53 2010 +0200
Translation update done using Pootle.
commit 152df38d332545665203d9c23cb4f5cbcb6ab9e3
Merge: 3959481120ea4037c3c1b6926bbabc86ea4381b7 fb6a06021c22bba776851297b5a7aa9035c9c223
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon Aug 23 11:18:52 2010 +0200
Merge remote branch 'pootle/master'
commit fb6a06021c22bba776851297b5a7aa9035c9c223
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:18:42 2010 +0200
Translation update done using Pootle.
-----------------------------------------------------------------------
Summary of changes:
po/lt.po | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/po/lt.po b/po/lt.po
index 99ca421..0ad36de 100644
--- a/po/lt.po
+++ b/po/lt.po
@@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.4.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel(a)lists.sourceforge.net\n"
"POT-Creation-Date: 2010-08-22 23:05+0200\n"
-"PO-Revision-Date: 2010-08-23 11:17+0200\n"
+"PO-Revision-Date: 2010-08-23 11:18+0200\n"
"Last-Translator: Kęstutis <forkik(a)gmail.com>\n"
"Language-Team: lithuanian <lt(a)li.org>\n"
"Language: lt\n"
@@ -9044,13 +9044,12 @@ msgstr "Ištrinti duomenis arba lentelę"
#: tbl_operations.php:657
msgid "Empty the table (TRUNCATE)"
-msgstr ""
+msgstr "Ištrinti lentelės duomenis (TRUNCATE)"
#: tbl_operations.php:677
-#, fuzzy
#| msgid "Go to database"
msgid "Delete the table (DROP)"
-msgstr "Eiti į duomenų bazę"
+msgstr "Ištrinti lentelę (DROP)"
#: tbl_operations.php:698
#, fuzzy
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_5_1-7895-g3959481
by Michal Čihař 23 Aug '10
by Michal Čihař 23 Aug '10
23 Aug '10
The branch, master has been updated
via 3959481120ea4037c3c1b6926bbabc86ea4381b7 (commit)
via c2d705331d06c3be4a04446a82987ed44610940c (commit)
via 81cd8d4175af319b8180729b53c528df414b99e1 (commit)
via 0645663aa937f616976d7fe829213a42609bb92a (commit)
via db827e229ffcf6fd52e2f4b05916231aadb798fb (commit)
via da36397dd70b42e2aba3bdbf55cf5959be08f50a (commit)
via 3e2b8fe7140708f49df86d8026f54dfecc86c3f7 (commit)
via 81bf59310cc125e310ee38397b019c1a8b4356fa (commit)
via 2890df8b2ffda85404a3604127500007753566d5 (commit)
via ea107627b881d2719db29a8f4a393af30c6f5732 (commit)
via 70b56bef7417452de885b27e852b0323806a13d3 (commit)
via eb7f55d5803459dcca3795d27a7a96f338d50846 (commit)
via 174d5826e750b28943614879065fece99e7eba20 (commit)
via e8ba625da58baebcee3e3e62ed3dc726f4c667bd (commit)
via 154fea2579e06e6693da02e72f214b9067f19bfd (commit)
via 42dcb785f5cbc4bf33482793ad4ef5b870388a22 (commit)
via 40aefa257b5d3b57c1b8e5f0ece2adb67f4837ff (commit)
via ea922c88e097439222ede1587bcc548a5eaadab9 (commit)
via e470277b034445f2f767c6c6f88029c80506b50e (commit)
via cb71a7f4e74f17c9e83546c96ad712d8de06502f (commit)
via e0470f3367926e52f87cb4ce8b9905f244dfcfa9 (commit)
via 2b6569a049b3f8e372e2fd8e6e69c77e99e2ee26 (commit)
via 3b4ee978b8c28fdbe4c13f65c7ddbb3215c32181 (commit)
via ebd92e0738f4294996663e6c80cff64105ceebf5 (commit)
via 1457fcc863346e734f0a5f3c0501b2c89a60f4d2 (commit)
via d0aab2f0fd159cee5eeeecde8c9e0deafdfd75bd (commit)
via 1b479a8448c7ed7f5fb967a05dc85c5c9c39cf72 (commit)
via a2a7ba979036c32dc98d7dc95bf52162eb964b1f (commit)
via 26eaa224645854f838299c8ec691449238b20851 (commit)
via 613020079ce062e892e9c9b6e3bd639f3a126b77 (commit)
via 75a17915968fe51fc8b613485afe20fe50189b65 (commit)
via 2b756b2486de645107379846c83003ef049d5dce (commit)
via 046dee02e2ff465a619c392d6607e6a20efd23d5 (commit)
via 4638e3c3d1009e449670aad37994c647fb8dea77 (commit)
via 7a56cdd3cbbc66a76813a83044cb4b451611c6d0 (commit)
from 03d3062a65e70d31ed82a3dfef8c426c36b4fe3e (commit)
- Log -----------------------------------------------------------------
commit 3959481120ea4037c3c1b6926bbabc86ea4381b7
Merge: 03d3062a65e70d31ed82a3dfef8c426c36b4fe3e c2d705331d06c3be4a04446a82987ed44610940c
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon Aug 23 11:18:26 2010 +0200
Merge remote branch 'pootle/master'
commit c2d705331d06c3be4a04446a82987ed44610940c
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:17:36 2010 +0200
Translation update done using Pootle.
commit 81cd8d4175af319b8180729b53c528df414b99e1
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:17:18 2010 +0200
Translation update done using Pootle.
commit 0645663aa937f616976d7fe829213a42609bb92a
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:13:05 2010 +0200
Translation update done using Pootle.
commit db827e229ffcf6fd52e2f4b05916231aadb798fb
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:12:44 2010 +0200
Translation update done using Pootle.
commit da36397dd70b42e2aba3bdbf55cf5959be08f50a
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:09:53 2010 +0200
Translation update done using Pootle.
commit 3e2b8fe7140708f49df86d8026f54dfecc86c3f7
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:08:46 2010 +0200
Translation update done using Pootle.
commit 81bf59310cc125e310ee38397b019c1a8b4356fa
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:07:58 2010 +0200
Translation update done using Pootle.
commit 2890df8b2ffda85404a3604127500007753566d5
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:07:40 2010 +0200
Translation update done using Pootle.
commit ea107627b881d2719db29a8f4a393af30c6f5732
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:07:20 2010 +0200
Translation update done using Pootle.
commit 70b56bef7417452de885b27e852b0323806a13d3
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:06:52 2010 +0200
Translation update done using Pootle.
commit eb7f55d5803459dcca3795d27a7a96f338d50846
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:06:19 2010 +0200
Translation update done using Pootle.
commit 174d5826e750b28943614879065fece99e7eba20
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:05:40 2010 +0200
Translation update done using Pootle.
commit e8ba625da58baebcee3e3e62ed3dc726f4c667bd
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:05:22 2010 +0200
Translation update done using Pootle.
commit 154fea2579e06e6693da02e72f214b9067f19bfd
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:04:50 2010 +0200
Translation update done using Pootle.
commit 42dcb785f5cbc4bf33482793ad4ef5b870388a22
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:04:02 2010 +0200
Translation update done using Pootle.
commit 40aefa257b5d3b57c1b8e5f0ece2adb67f4837ff
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:03:50 2010 +0200
Translation update done using Pootle.
commit ea922c88e097439222ede1587bcc548a5eaadab9
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:03:16 2010 +0200
Translation update done using Pootle.
commit e470277b034445f2f767c6c6f88029c80506b50e
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:02:49 2010 +0200
Translation update done using Pootle.
commit cb71a7f4e74f17c9e83546c96ad712d8de06502f
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:00:48 2010 +0200
Translation update done using Pootle.
commit e0470f3367926e52f87cb4ce8b9905f244dfcfa9
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 11:00:01 2010 +0200
Translation update done using Pootle.
commit 2b6569a049b3f8e372e2fd8e6e69c77e99e2ee26
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:59:46 2010 +0200
Translation update done using Pootle.
commit 3b4ee978b8c28fdbe4c13f65c7ddbb3215c32181
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:58:40 2010 +0200
Translation update done using Pootle.
commit ebd92e0738f4294996663e6c80cff64105ceebf5
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:57:30 2010 +0200
Translation update done using Pootle.
commit 1457fcc863346e734f0a5f3c0501b2c89a60f4d2
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:57:25 2010 +0200
Translation update done using Pootle.
commit d0aab2f0fd159cee5eeeecde8c9e0deafdfd75bd
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:56:33 2010 +0200
Translation update done using Pootle.
commit 1b479a8448c7ed7f5fb967a05dc85c5c9c39cf72
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:55:54 2010 +0200
Translation update done using Pootle.
commit a2a7ba979036c32dc98d7dc95bf52162eb964b1f
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:54:08 2010 +0200
Translation update done using Pootle.
commit 26eaa224645854f838299c8ec691449238b20851
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:54:00 2010 +0200
Translation update done using Pootle.
commit 613020079ce062e892e9c9b6e3bd639f3a126b77
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:52:29 2010 +0200
Translation update done using Pootle.
commit 75a17915968fe51fc8b613485afe20fe50189b65
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:46:06 2010 +0200
Translation update done using Pootle.
commit 2b756b2486de645107379846c83003ef049d5dce
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:45:01 2010 +0200
Translation update done using Pootle.
commit 046dee02e2ff465a619c392d6607e6a20efd23d5
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:41:02 2010 +0200
Translation update done using Pootle.
commit 4638e3c3d1009e449670aad37994c647fb8dea77
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:37:02 2010 +0200
Translation update done using Pootle.
commit 7a56cdd3cbbc66a76813a83044cb4b451611c6d0
Author: Kęstutis <forkik(a)gmail.com>
Date: Mon Aug 23 10:32:56 2010 +0200
Translation update done using Pootle.
-----------------------------------------------------------------------
Summary of changes:
po/lt.po | 76 +++++++++++++++++++++++++++++++++++++------------------------
1 files changed, 46 insertions(+), 30 deletions(-)
diff --git a/po/lt.po b/po/lt.po
index 1f41bfd..99ca421 100644
--- a/po/lt.po
+++ b/po/lt.po
@@ -4,15 +4,15 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.4.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel(a)lists.sourceforge.net\n"
"POT-Creation-Date: 2010-08-22 23:05+0200\n"
-"PO-Revision-Date: 2010-08-20 23:06+0200\n"
+"PO-Revision-Date: 2010-08-23 11:17+0200\n"
"Last-Translator: Kęstutis <forkik(a)gmail.com>\n"
"Language-Team: lithuanian <lt(a)li.org>\n"
"Language: lt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n"
-"%100<10 || n%100>=20) ? 1 : 2);\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%"
+"100<10 || n%100>=20) ? 1 : 2);\n"
"X-Generator: Pootle 2.0.5\n"
#: browse_foreigners.php:36 browse_foreigners.php:57
@@ -7521,6 +7521,8 @@ msgid ""
"This server is not configured as master in a replication process. Would you "
"like to <a href=\"%s\">configure</a> it?"
msgstr ""
+"Šis serveris nėra sukonfigūruotas kaip pagrindinio serverio dauginimo "
+"procesas. Ar Jūs norėtumėte <a href=\"%s\">sukonfigūruoti</a> jį?"
#: server_replication.php:215
msgid "Master configuration"
@@ -7534,6 +7536,11 @@ msgid ""
"ignore all databases by default and allow only certain databases to be "
"replicated. Please select the mode:"
msgstr ""
+"Šis serveris nesukonfigūruotas kaip pagrindinio serverio dauginimo procesas. "
+"Jūs galite pasirinkti vieną iš dviejų: dauginti visas duombazes ir "
+"ignoruoti kažkurias (naudinga kai Jūs dauginate didžiąją dalį duombazių) "
+"arba Jūs galite pasirinkti ignoruoti visas duombazes ir pasirinkti kažkurias "
+"duombazes dauginimui. Prašome pasirinkti režimą:"
#: server_replication.php:219
msgid "Replicate all databases; Ignore:"
@@ -7637,9 +7644,8 @@ msgid "Skip current error"
msgstr "Praleisti šią klaidą"
#: server_replication.php:335
-#, fuzzy
msgid "Skip next"
-msgstr "Praleisti toliau"
+msgstr "Praleisti sekančius"
#: server_replication.php:338
msgid "errors."
@@ -7674,9 +7680,8 @@ msgid ""
msgstr ""
#: server_status.php:42
-#, fuzzy
msgid "How many temporary files mysqld has created."
-msgstr "Kiek daug laikinų failų mysqld sukūrė."
+msgstr "Kiek laikinųjų failų mysqld sukūrė."
#: server_status.php:43
msgid ""
@@ -8213,11 +8218,11 @@ msgstr "Užklausų saugykla"
#: server_status.php:362
msgid "Threads"
-msgstr ""
+msgstr "Gijos"
#: server_status.php:364
msgid "Temporary data"
-msgstr ""
+msgstr "Laikini duomenys"
#: server_status.php:365
#, fuzzy
@@ -8280,20 +8285,28 @@ msgid ""
"This MySQL server works as <b>master</b> and <b>slave</b> in <b>replication</"
"b> process."
msgstr ""
+"Šis MySQL serveris veikia kaip <b>pagrindinis</b> ir kaip <b>pavaldusis</b> "
+"serveris <b>dauginimo</b> procese."
#: server_status.php:472
msgid "This MySQL server works as <b>master</b> in <b>replication</b> process."
msgstr ""
+"Šis MySQL serveris veikia kaip <b>pagrindinis</b> serveris <b>dauginimo</b> "
+"procese."
#: server_status.php:474
msgid "This MySQL server works as <b>slave</b> in <b>replication</b> process."
msgstr ""
+"Šis MySQL serveris veikia kaip <b>pavaldusis</b> serveris <b>dauginimo</b> "
+"procese."
#: server_status.php:476
msgid ""
"For further information about replication status on the server, please visit "
"the <a href=#replication>replication section</a>."
msgstr ""
+"Daugiau informacijos apie dauginimo serverio būseną prašome aplankyti <a "
+"href=#replication>dauginimo skyrelį</a>."
#: server_status.php:493
msgid ""
@@ -8365,7 +8378,7 @@ msgstr "Užklausos tipas"
#: server_status.php:831
msgid "Replication status"
-msgstr "Replikacijos būsena"
+msgstr "Dauginimo būsena"
#: server_synchronize.php:92
#, fuzzy
@@ -8381,7 +8394,7 @@ msgstr "Nepavyko prisijungti prie MySQL serverio"
#: tbl_get_field.php:19
#, php-format
msgid "'%s' database does not exist."
-msgstr "'%s' duomenų bazė neegzistuoja."
+msgstr "„%s“ duomenų bazė neegzistuoja."
#: server_synchronize.php:263
msgid "Structure Synchronization"
@@ -8617,9 +8630,8 @@ msgid "Ignore errors"
msgstr "Ignoruoti klaidas"
#: setup/lib/form_processing.lib.php:49
-#, fuzzy
msgid "Show form"
-msgstr "Rodyti spalvą"
+msgstr "Rodyti formą"
#: setup/lib/index.lib.php:118 setup/lib/index.lib.php:125
#: setup/lib/index.lib.php:142 setup/lib/index.lib.php:149
@@ -8638,14 +8650,16 @@ msgid ""
"Reading of version failed. Maybe you're offline or the upgrade server does "
"not respond."
msgstr ""
+"Nepavyko nuskaityti versijos. Galbūt Jūs esate atsijungęs arba serveris "
+"neatsako."
#: setup/lib/index.lib.php:143
msgid "Got invalid version string from server"
-msgstr ""
+msgstr "Gautas netinkamas versijos formatas iš serverio"
#: setup/lib/index.lib.php:150
msgid "Unparsable version string"
-msgstr ""
+msgstr "Nesuprantama versijos eilutė"
#: setup/lib/index.lib.php:158
#, php-format
@@ -8653,6 +8667,8 @@ msgid ""
"A newer version of phpMyAdmin is available and you should consider "
"upgrading. The newest version is %s, released on %s."
msgstr ""
+"Nauja phpMyAdmin versija prieinama ir Jūs turėtumėte apsvarstyti "
+"atnaujinimą. Naujausia versija yra %s, išleista %s."
#: setup/lib/index.lib.php:162
#, php-format
@@ -8660,10 +8676,12 @@ msgid ""
"You are using Git version, run [kbd]git pull[/kbd] :-)[br]The latest stable "
"version is %s, released on %s."
msgstr ""
+"Jūs naudojate Git versiją, paleiskite [kbd]git pull[/kbd] :-)[br]Naujausia "
+"stabili versija yra %s, išleista %s."
#: setup/lib/index.lib.php:165
msgid "No newer stable version is available"
-msgstr ""
+msgstr "Prieinama naujesnė stabili versija"
#: setup/lib/index.lib.php:250
msgid ""
@@ -8774,6 +8792,7 @@ msgstr ""
#: setup/lib/index.lib.php:283
msgid "You should use SSL connections if your web server supports it"
msgstr ""
+"Jūs turėtumėte naudoti SSL prisijungimus jeigu Jūsų serveris juos palaiko"
#: setup/lib/index.lib.php:293
msgid "You should use mysqli for performance reasons"
@@ -8841,11 +8860,11 @@ msgstr "Ignoruoti"
#, fuzzy
#| msgid " Because of its length,<br /> this field might not be editable "
msgid " Because of its length,<br /> this column might not be editable "
-msgstr " Tai yra jo ilgis,<br /> šis laukelis neredaguojamas "
+msgstr "Dėl jo ilgio,<br /> šis laukelis neredaguojamas "
#: tbl_change.php:835
msgid "Remove BLOB Repository Reference"
-msgstr ""
+msgstr "Panaikinti BLOB saugyklos rodyklę"
#: tbl_change.php:841
msgid "Binary - do not edit"
@@ -8853,20 +8872,19 @@ msgstr "Dvejetainis - nekeisti"
#: tbl_change.php:889
msgid "Upload to BLOB repository"
-msgstr ""
+msgstr "Įkelti BLOB saugyklą"
#: tbl_change.php:1026
msgid "Insert as new row"
-msgstr "Įterpti naują įrašą"
+msgstr "Įterpti kaip naują įrašą"
#: tbl_change.php:1027
msgid "Insert as new row and ignore errors"
msgstr "Įterpti kaip naują eilutę ir ignoruoti klaidas"
#: tbl_change.php:1028
-#, fuzzy
msgid "Show insert query"
-msgstr "Rodoma SQL užklausa"
+msgstr "Rodyti įterptą užklausą"
#: tbl_change.php:1043
msgid "Go back to previous page"
@@ -8901,9 +8919,9 @@ msgid "Table %s already exists!"
msgstr "Lentelė %s jau yra!"
#: tbl_create.php:241
-#, fuzzy, php-format
+#, php-format
msgid "Table %1$s has been created."
-msgstr "Duomenų bazė %1$s sukurta."
+msgstr "Sukurta %1$s lentelė."
#: tbl_export.php:24
msgid "View dump (schema) of table"
@@ -8915,7 +8933,7 @@ msgstr "Pirminio rakto pavadinimas turi būti \"PRIMARY\"!"
#: tbl_indexes.php:74
msgid "Can't rename index to PRIMARY!"
-msgstr "Indeksą pervadinti PIRMINIU nepavyko!"
+msgstr "Negalima pervadinti indekso į PRIMARY!"
#: tbl_indexes.php:90
msgid "No index parts defined!"
@@ -8949,7 +8967,7 @@ msgstr "Įterpti indeksui papildomus %s stulpelį(ius)"
#: tbl_indexes.php:254 tbl_structure.php:681 tbl_structure.php:692
msgid "Column count has to be larger than zero."
-msgstr ""
+msgstr "Stulpelių skaičius turi būti didesnis negu nulis."
#: tbl_move_copy.php:44
msgid "Can't move table to same one!"
@@ -9015,16 +9033,14 @@ msgid "Table %s has been flushed"
msgstr "Lentelės buferis %s išvalytas"
#: tbl_operations.php:633
-#, fuzzy
#| msgid "Flush the table (\"FLUSH\")"
msgid "Flush the table (FLUSH)"
-msgstr "Išvalyti lentelę (\"FLUSH\")"
+msgstr "Išvalyti ir perkrauti lentelę (FLUSH)"
#: tbl_operations.php:642
-#, fuzzy
#| msgid "Dumping data for table"
msgid "Delete data or table"
-msgstr "Sukurta duomenų kopija lentelei"
+msgstr "Ištrinti duomenis arba lentelę"
#: tbl_operations.php:657
msgid "Empty the table (TRUNCATE)"
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_5_1-7860-g03d3062
by Michal Čihař 23 Aug '10
by Michal Čihař 23 Aug '10
23 Aug '10
The branch, master has been updated
via 03d3062a65e70d31ed82a3dfef8c426c36b4fe3e (commit)
via 4a75c9b26e6e63349fd128ae3c4a831729a02dcb (commit)
from 5a51858352ac30b99e38a082ec697119983a15df (commit)
- Log -----------------------------------------------------------------
commit 03d3062a65e70d31ed82a3dfef8c426c36b4fe3e
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon Aug 23 11:17:15 2010 +0200
Credits and changelog for Lori.
commit 4a75c9b26e6e63349fd128ae3c4a831729a02dcb
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon Aug 23 11:14:30 2010 +0200
Changelog and credits for schema export.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 3 +++
Documentation.html | 12 ++++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6c7aa06..f4964a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -104,8 +104,11 @@ $Id$
thanks to Isaac Bennetch - ibennetch
- patch #3038312 [export] JSON export,
thanks to Hauke Henningsen - blubberkeks152
+- rfe #1494550 [interface] Editor for SET/ENUM fields.
+- rfe #2649375 [interface] Simplified interface to backup/restore.
- rfe #2973909 Users preferences
- [relations] Dropped WYSIWYG-PDF configuration variable.
+- rfe #806035, #686260 [relations] Export relations to Dia, SVG and others
3.3.6.0 (not yet released)
- bug #3033063 [core] Navi gets wrong db name
diff --git a/Documentation.html b/Documentation.html
index a05df47..e6084bc 100644
--- a/Documentation.html
+++ b/Documentation.html
@@ -4861,6 +4861,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
<li>Replication support</li>
</ul></li>
+<li>Muhammad Adnan (Google Summer of Code 2010)
+<ul>
+ <li>Relation schema export to multiple formats</li>
+</ul></li>
+
+<li>Lori Lee (Google Summer of Code 2010)
+<ul>
+ <li>User interface improvements</li>
+ <li>ENUM/SET editor</li>
+ <li>Simplified interface for export/import</li>
+</ul></li>
+
<li>Barrie Leslie
<ul>
<li>BLOBstreaming support with PBMS PHP extension</li>
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_5_1-7858-g5a51858
by Michal Čihař 23 Aug '10
by Michal Čihař 23 Aug '10
23 Aug '10
The branch, master has been updated
via 5a51858352ac30b99e38a082ec697119983a15df (commit)
from 8a011f77b8c75edb5f5461a69de39bbea66596c5 (commit)
- Log -----------------------------------------------------------------
commit 5a51858352ac30b99e38a082ec697119983a15df
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon Aug 23 11:05:12 2010 +0200
[relations] Dropped WYSIWYG-PDF configuration variable.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
Documentation.html | 55 +++++++++++++++++---------------
js/functions.js | 6 ++--
libraries/config.default.php | 8 -----
libraries/schema/User_Schema.class.php | 16 ++++-----
5 files changed, 40 insertions(+), 46 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0ddca1c..6c7aa06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -105,6 +105,7 @@ $Id$
- patch #3038312 [export] JSON export,
thanks to Hauke Henningsen - blubberkeks152
- rfe #2973909 Users preferences
+- [relations] Dropped WYSIWYG-PDF configuration variable.
3.3.6.0 (not yet released)
- bug #3033063 [core] Navi gets wrong db name
diff --git a/Documentation.html b/Documentation.html
index 0b0a29b..a05df47 100644
--- a/Documentation.html
+++ b/Documentation.html
@@ -2138,32 +2138,6 @@ setfacl -d -m "g:www-data:rwx" tmp
any row counting.
</dd>
- <dt id="wysiwyg">
- <span id="cfg_WYSIWYG-PDF">$cfg['WYSIWYG-PDF'] </span>boolean</dt>
- <dd>Utilizes a WYSIWYG editing control to easily place elements of a
- <abbr title="Portable Document Format">PDF</abbr>
- page. By clicking on the button 'toggle scratchboard' on the page
- where you edit x/y coordinates of those elements you can activate a
- scratchboard where all your elements are placed. By clicking on an
- element, you can move them around in the pre-defined area and the x/y
- coordinates will get updated dynamically. Likewise, when entering a
- new position directly into the input field, the new position in the
- scratchboard changes after your cursor leaves the input field.<br />
- You have to click on the 'OK'-button below the tables to save the new
- positions. If you want to place a new element, first add it to the
- table of elements and then you can drag the new element around.<br />
- By changing the paper size and the orientation you can change the size
- of the scratchboard as well. You can do so by just changing the
- dropdown field below, and the scratchboard will resize automatically,
- without interfering with the current placement of the elements.<br />
- If ever an element gets out of range you can either enlarge the paper
- size or click on the 'reset' button to place all elements below each
- other.<br />
- <b>NOTE:</b> You have to use a recent browser like IE6 or Mozilla to
- get this control to work. The basic Drag&Drop script functionality
- was kindly borrowed from www.youngpup.net and is underlying so
- specific license.</dd>
-
<dt id="cfg_NaturalOrder">$cfg['NaturalOrder'] boolean</dt>
<dd>Sorts database and table names according to natural order (for example,
t1, t2, t10). Currently implemented in the left panel (Light mode)
@@ -4362,6 +4336,35 @@ chmod o+rwx tmp
<dd>phpMyAdmin with version</dd>
</dl>
+<h4 id="wysiwyg">
+ <a href="#wysiwyg">6.28 How can I easily edit relational schema for export?</a></h4>
+
+ <p>
+ By clicking on the button 'toggle scratchboard' on the page
+ where you edit x/y coordinates of those elements you can activate a
+ scratchboard where all your elements are placed. By clicking on an
+ element, you can move them around in the pre-defined area and the x/y
+ coordinates will get updated dynamically. Likewise, when entering a
+ new position directly into the input field, the new position in the
+ scratchboard changes after your cursor leaves the input field.
+ </p>
+ <p>
+ You have to click on the 'OK'-button below the tables to save the new
+ positions. If you want to place a new element, first add it to the
+ table of elements and then you can drag the new element around.
+ </p>
+ <p>
+ By changing the paper size and the orientation you can change the size
+ of the scratchboard as well. You can do so by just changing the
+ dropdown field below, and the scratchboard will resize automatically,
+ without interfering with the current placement of the elements.
+ </p>
+ <p>
+ If ever an element gets out of range you can either enlarge the paper
+ size or click on the 'reset' button to place all elements below each
+ other.
+ <p>
+
<h3 id="faqproject">phpMyAdmin project</h3>
<h4 id="faq7_1">
diff --git a/js/functions.js b/js/functions.js
index 9702f3a..f76d630 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -1421,7 +1421,7 @@ function getElement(e,f){
}
/**
- * Refresh the WYSIWYG-PDF scratchboard after changes have been made
+ * Refresh the WYSIWYG scratchboard after changes have been made
*/
function refreshDragOption(e) {
var elm = $('#' + e);
@@ -1431,7 +1431,7 @@ function refreshDragOption(e) {
}
/**
- * Refresh/resize the WYSIWYG-PDF scratchboard
+ * Refresh/resize the WYSIWYG scratchboard
*/
function refreshLayout() {
var elm = $('#pdflayout')
@@ -1453,7 +1453,7 @@ function refreshLayout() {
}
/**
- * Show/hide the WYSIWYG-PDF scratchboard
+ * Show/hide the WYSIWYG scratchboard
*/
function ToggleDragDrop(e) {
var elm = $('#' + e);
diff --git a/libraries/config.default.php b/libraries/config.default.php
index 9c5ea62..b637e58 100644
--- a/libraries/config.default.php
+++ b/libraries/config.default.php
@@ -2333,14 +2333,6 @@ $cfg['MaxExactCount'] = 20000;
$cfg['MaxExactCountViews'] = 0;
/**
- * Utilize DHTML/JS capabilities to allow WYSIWYG editing of
- * the PDF page editor. Requires an IE6/Gecko based browser.
- *
- * @global boolean $cfg['WYSIWYG-PDF']
- */
-$cfg['WYSIWYG-PDF'] = true;
-
-/**
* Sort table and database in natural order
*
* @global boolean $cfg['NaturalOrder']
diff --git a/libraries/schema/User_Schema.class.php b/libraries/schema/User_Schema.class.php
index 31aa6de..3139b0a 100644
--- a/libraries/schema/User_Schema.class.php
+++ b/libraries/schema/User_Schema.class.php
@@ -224,15 +224,13 @@ class PMA_User_Schema
$array_sh_page[] = $temp_sh_page;
}
/*
- * Display WYSIWYG-PDF parts?
+ * Display WYSIWYG parts
*/
- if ($cfg['WYSIWYG-PDF']) {
- if (!isset($_POST['with_field_names']) && !isset($_POST['showwysiwyg'])) {
- $with_field_names = TRUE;
- }
- $this->_displayScratchboardTables($array_sh_page,$draginit,$reset_draginit);
+ if (!isset($_POST['with_field_names']) && !isset($_POST['showwysiwyg'])) {
+ $with_field_names = TRUE;
}
+ $this->_displayScratchboardTables($array_sh_page,$draginit,$reset_draginit);
?>
<form method="post" action="schema_edit.php" name="edcoord">
@@ -280,10 +278,10 @@ class PMA_User_Schema
. "\n" . ' <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . __('Delete');
echo "\n" . ' </td>';
echo "\n" . ' <td>'
- . "\n" . ' <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'x\', this.value)"' : '') . ' name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
+ . "\n" . ' <input type="text" onchange="dragPlace(' . $i . ', \'x\', this.value)" name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
echo "\n" . ' </td>';
echo "\n" . ' <td>'
- . "\n" . ' <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'y\', this.value)"' : '') . ' name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
+ . "\n" . ' <input type="text" onchange="dragPlace(' . $i . ', \'y\', this.value)" name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
echo "\n" . ' </td>';
echo "\n" . ' </tr>';
$i++;
@@ -319,7 +317,7 @@ class PMA_User_Schema
echo "\n" . ' </table>' . "\n";
echo "\n" . ' <input type="hidden" name="c_table_rows" value="' . ($i + 1) . '" />';
- echo ($cfg['WYSIWYG-PDF'] ? "\n" . ' <input type="hidden" id="showwysiwyg" name="showwysiwyg" value="' . ((isset($showwysiwyg) && $showwysiwyg == '1') ? '1' : '0') . '" />' : '');
+ echo "\n" . ' <input type="hidden" id="showwysiwyg" name="showwysiwyg" value="' . ((isset($showwysiwyg) && $showwysiwyg == '1') ? '1' : '0') . '" />';
echo "\n" . ' <input type="checkbox" name="with_field_names" ' . (isset($with_field_names) ? 'checked="checked"' : ''). ' />' . __('Column names') . '<br />';
echo "\n" . ' <input type="submit" value="' . __('Save') . '" />';
echo "\n" . '</form>' . "\n\n";
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_5_1-7857-g8a011f7
by Michal Čihař 23 Aug '10
by Michal Čihař 23 Aug '10
23 Aug '10
The branch, master has been updated
via 8a011f77b8c75edb5f5461a69de39bbea66596c5 (commit)
via f84659efcba18bf33e0d59187044d3b4ab285bfb (commit)
via 1c20d31e65f5862f429df22b14d2bd33247bd2ed (commit)
via ab03dc8d5ce6ab25bf39726bbe894987002533b7 (commit)
via 2ea03801ebf3c2862f25f5a79a5e93c33e682757 (commit)
via dd809980808b5707cf72223009171ab0b320fb2a (commit)
via 8a827e52614960f90c4d741ee6f89123424363c4 (commit)
via 13abea596a0c951c78e3161b95e38d99cb2f615d (commit)
via 5fb5678a50f155041edd5a3fad6c93ff6e1df3ee (commit)
via 75623e5066071c91b12e5b2e565dd9907e790180 (commit)
via 27fe8e4658cc8a79cfce17ac359dfdf7b41ba98b (commit)
via afcf1e6bbee7c7a1720df0e61b2ef64a925b8f0b (commit)
via d579653dc5fd6af2dac343b8b750806354dc405a (commit)
via 4a4ddeadcf85f11edf580894d754ade80cb975be (commit)
via 381ba1be0f921788bfd1f99baae0ff149cf239bb (commit)
via d6c630c64e279e85cc9b2062e3b499c1567ded7e (commit)
via 36ba514c5109c679fcee0e4139b2411a4c5803ce (commit)
via ae877a1de6a6cfe36beeb139456ea8c45277822a (commit)
via 03b1bbf9b3910fe3ffe9539d639bf300ff4c51da (commit)
via b95a14c0de93965cd5eb29edcedae60d7cf97e8b (commit)
via 224abbaf5efd89c7fecf4b2c01ef45297a4a444b (commit)
via 1cdf881f42a49988300b898caf7e16f2b6c5fdc3 (commit)
via 03d37b45f1ec22cfc9a7c46ee9d9f549980d10bb (commit)
via 2a5a6e39b1eb888bd01d3c00af69b2b4a77dccbf (commit)
via 821b8b134e27813e1eb686c0c8948bacbbfea131 (commit)
via 6f750d73797e1034804956ce90a6c00e1e17e943 (commit)
via 2c42e1bccba5b848bca81de475343d2876d5e029 (commit)
via bdf033115b18c271c3398b8c60ba372a92d6f4ac (commit)
via a7e3c0475cacadbc8ca6e477bd4d733f510c5d36 (commit)
via 14b26e314a159c4b282e02940d3c44563f302251 (commit)
via 9595dce3b824ab5c35706d470b4d34ce355bab51 (commit)
via cc4ace1f22921439d1fd7ec6cb23316c76d53bd6 (commit)
via ac3909d990a2a4e7f65e1aecdd2a25dc6d99d5cf (commit)
via 5a884f2f4dd655d32ac338b2b210bd867e546847 (commit)
via 4adc0c15cd1d03c51b88bbd792aea3bb1e57ed09 (commit)
via 2ca3d4d8f444d5dc9f4ea632015fbfadbb9481c4 (commit)
via 6fc9576f3ed0da066365eb8dfb6b804d04748c4e (commit)
via 45399cbadd638b30cea9473e834201b963afa31d (commit)
via f9c29173bfb080910e15ac46c6a34f8be8aac51e (commit)
via 9fb8619f2ace178e5d4d4dc055ce7e5358b9bcd8 (commit)
via 459eeb12300e8c10f750bab57320634406db2c03 (commit)
via 79c6f847fd9b50c8e25361a482b29ee798c3fb7d (commit)
via 07cee82af681ca5602c704e438eff39c83825db3 (commit)
via 1ca552a8e14306b723019b2268c8aab7c20bb06c (commit)
via cd41a8dc281561d00fe66237fe335d944582ae07 (commit)
via 39db171819a65a49699180705b2ecae2968b4c2c (commit)
via c62004a8c91cf9c7f704da0e3899e6595d6ea1f2 (commit)
via 737fb9df271d723111b82dbfcbec74f168275f71 (commit)
via ba9924054be621d2bad7d977eb05180c01e31b8c (commit)
via 188c7b8d38fdffa19ed0cefe8ca0af047495adba (commit)
via 1ef5f8564e1013ed737b7491aa6fe806612dea8d (commit)
via cba214aee41a6da0e24b559d32fbb15a1d6bbb64 (commit)
via dd217e8dffe87efeb6f01a9ee4210c3c3f6ab394 (commit)
via 7660295dca0850f3918abcda3559db5a86c73ab6 (commit)
via 9befa3965e3b9e82532a1bc43e199e269f73a925 (commit)
via 8dc2149272811636fcb90f809c936a8b068356eb (commit)
via 0e9f6247e4d2d554b5eb59f637e6b9edaed5cda4 (commit)
via fc838dd0cbd085e7d09c40b0b89e038671cfff97 (commit)
via 589eef328048df3e74e3a713c8de06e304688c96 (commit)
via d38b380c3205b29fe7d5e89f1502aac67f3c2179 (commit)
via 3805338674202055aa7724e42b23c894b06bd4c0 (commit)
via 5d7998984d8dbf6d2065d06bb9c93668a852ec4a (commit)
via 7d125e01a822a26571e4938eb1e97beac6056a73 (commit)
via 14e6af7d8aeb05ea32ee7defa9aee335041bd3cc (commit)
via 793468f14075b64d8c4f992b6fe2b1d3bcd3341b (commit)
from d5912b19e4d2083d7703c48aa0320a565f24a5da (commit)
- Log -----------------------------------------------------------------
commit 8a011f77b8c75edb5f5461a69de39bbea66596c5
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon Aug 23 10:55:57 2010 +0200
Better name for schema export script.
commit f84659efcba18bf33e0d59187044d3b4ab285bfb
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon Aug 23 10:55:19 2010 +0200
Better file name for schema edit page.
commit 1c20d31e65f5862f429df22b14d2bd33247bd2ed
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon Aug 23 10:52:46 2010 +0200
No upper case in box title.
commit ab03dc8d5ce6ab25bf39726bbe894987002533b7
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon Aug 23 10:50:17 2010 +0200
Whitespace cleanup.
commit 2ea03801ebf3c2862f25f5a79a5e93c33e682757
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon Aug 23 10:33:05 2010 +0200
Better size of Dia export.
commit dd809980808b5707cf72223009171ab0b320fb2a
Merge: d5912b19e4d2083d7703c48aa0320a565f24a5da 8a827e52614960f90c4d741ee6f89123424363c4
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon Aug 23 10:21:22 2010 +0200
Merge remote branch 'adnan/export_branch'
commit 8a827e52614960f90c4d741ee6f89123424363c4
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Fri Aug 20 12:13:30 2010 +0500
TCPDF: removed ob_get_contents() [was added for debugging]
commit 13abea596a0c951c78e3161b95e38d99cb2f615d
Merge: 5fb5678a50f155041edd5a3fad6c93ff6e1df3ee a590931896df99fde96f37d8e77a45eeb254749c
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Fri Aug 20 11:34:36 2010 +0500
Merge remote branch 'origin/master' into export_branch
commit 5fb5678a50f155041edd5a3fad6c93ff6e1df3ee
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Fri Aug 20 11:11:51 2010 +0500
DIA Relation Schema: scale diagram fix
commit 75623e5066071c91b12e5b2e565dd9907e790180
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Fri Aug 20 11:09:37 2010 +0500
EPS Relation Schema: missing lines fix
commit 27fe8e4658cc8a79cfce17ac359dfdf7b41ba98b
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Aug 19 17:32:43 2010 +0500
Indenation fix in functions.js
commit afcf1e6bbee7c7a1720df0e61b2ef64a925b8f0b
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Aug 19 17:31:01 2010 +0500
Automatic Foreign/Internal Layout fix
commit d579653dc5fd6af2dac343b8b750806354dc405a
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Aug 18 19:31:29 2010 +0500
Removed debug commented code
commit 4a4ddeadcf85f11edf580894d754ade80cb975be
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Aug 18 18:05:01 2010 +0500
Fixed mime types and improve comments
commit 381ba1be0f921788bfd1f99baae0ff149cf239bb
Merge: d6c630c64e279e85cc9b2062e3b499c1567ded7e 1f248cc2549a2f5c1a47d209f2062ccb1fa4682c
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Aug 18 17:03:35 2010 +0500
Merge remote branch 'origin/master' into export_branch
commit d6c630c64e279e85cc9b2062e3b499c1567ded7e
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Aug 18 15:58:24 2010 +0500
Proper Error handling of Schema
commit 36ba514c5109c679fcee0e4139b2411a4c5803ce
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Aug 18 15:55:06 2010 +0500
Eval security issue & Indentation fixed
commit ae877a1de6a6cfe36beeb139456ea8c45277822a
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Aug 18 12:27:02 2010 +0500
UserInterface show/hide Schema Generation Options Available
commit 03b1bbf9b3910fe3ffe9539d639bf300ff4c51da
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Aug 18 12:22:56 2010 +0500
User Interface change in Schema Generation Options Box
commit b95a14c0de93965cd5eb29edcedae60d7cf97e8b
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Tue Aug 17 22:26:15 2010 +0500
TCPDF: merge conflict fixed
commit 224abbaf5efd89c7fecf4b2c01ef45297a4a444b
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Tue Aug 17 21:02:54 2010 +0500
TCPDF: reverted back from 14b26e3
commit 1cdf881f42a49988300b898caf7e16f2b6c5fdc3
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Tue Aug 17 20:41:15 2010 +0500
handling headers issue in schema export
commit 03d37b45f1ec22cfc9a7c46ee9d9f549980d10bb
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Tue Aug 17 15:23:06 2010 +0500
Removing previous schema generation code which was duplicating
commit 2a5a6e39b1eb888bd01d3c00af69b2b4a77dccbf
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Mon Aug 16 17:53:30 2010 +0500
EPS Relation Schema Class: adding boundingbox and pages commands
commit 821b8b134e27813e1eb686c0c8948bacbbfea131
Merge: 6f750d73797e1034804956ce90a6c00e1e17e943 b51a217c36b45194f79915992a599338b3bac9ef
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Mon Aug 16 04:52:53 2010 +0500
Merge remote branch 'origin/master' into export_branch
commit 6f750d73797e1034804956ce90a6c00e1e17e943
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Mon Aug 16 04:49:45 2010 +0500
Visio Relation Schema Class
commit 2c42e1bccba5b848bca81de475343d2876d5e029
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Sun Aug 15 15:06:26 2010 +0500
EPS Relation Schema Class
commit bdf033115b18c271c3398b8c60ba372a92d6f4ac
Merge: a7e3c0475cacadbc8ca6e477bd4d733f510c5d36 887e2be664f04827fe164d724d233598a251bcb9
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Mon Aug 2 10:46:50 2010 +0500
Merge remote branch 'origin/master' into export_branch
commit a7e3c0475cacadbc8ca6e477bd4d733f510c5d36
Merge: 14b26e314a159c4b282e02940d3c44563f302251 873ad99ed2fa8e5a46f1a92faccb8e163c0f0bc3
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jul 22 16:03:50 2010 +0500
Merge Origin: Conflicts in js/functions.js
commit 14b26e314a159c4b282e02940d3c44563f302251
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Jul 21 16:12:49 2010 +0500
TCPDF Class: Clean output buffer before downloading file
commit 9595dce3b824ab5c35706d470b4d34ce355bab51
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Jul 21 16:11:08 2010 +0500
PDF + SVG + Dia Schema: Notices Fix + Prompt User for Download Files
commit cc4ace1f22921439d1fd7ec6cb23316c76d53bd6
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Jul 21 16:08:48 2010 +0500
Export Relation Schema: fixing notices
commit ac3909d990a2a4e7f65e1aecdd2a25dc6d99d5cf
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Tue Jul 20 16:22:50 2010 +0500
TCPDF Class [Tabs removed Commit]: Reverted back
commit 5a884f2f4dd655d32ac338b2b210bd867e546847
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jul 15 01:01:16 2010 +0500
export_relation_schema.php: improved documentation
commit 4adc0c15cd1d03c51b88bbd792aea3bb1e57ed09
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jul 15 00:59:30 2010 +0500
User Schema + pdf Relation Schema Class: Improved documentation
commit 2ca3d4d8f444d5dc9f4ea632015fbfadbb9481c4
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Jul 14 22:46:51 2010 +0500
Export Relation Schema Class: Improved documentation + handling requests
commit 6fc9576f3ed0da066365eb8dfb6b804d04748c4e
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Jul 14 20:36:13 2010 +0500
Svg Schema Class: removed global vars + improved documentation
commit 45399cbadd638b30cea9473e834201b963afa31d
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Jul 14 06:10:05 2010 +0500
Dia Schema Class: download fileName added + improved documentation
commit f9c29173bfb080910e15ac46c6a34f8be8aac51e
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Wed Jul 14 02:32:57 2010 +0500
Dia Schem Class: documented + implemented
commit 9fb8619f2ace178e5d4d4dc055ce7e5358b9bcd8
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Sat Jul 10 15:44:17 2010 +0500
PDF Schema File: Relation_Stats class structured
commit 459eeb12300e8c10f750bab57320634406db2c03
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Fri Jul 9 15:31:18 2010 +0500
TCPDF Class: tabs removed
commit 79c6f847fd9b50c8e25361a482b29ee798c3fb7d
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Fri Jul 9 15:15:49 2010 +0500
Pdf Schema Class: Reduce global variables + added attributes in Export Relation Schema
commit 07cee82af681ca5602c704e438eff39c83825db3
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Fri Jul 9 14:39:03 2010 +0500
User Schema Class: big switch into several methods + reduce global variables
commit 1ca552a8e14306b723019b2268c8aab7c20bb06c
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jul 8 12:23:51 2010 +0500
SVG Schema Class: spaces around = , fixed.
commit cd41a8dc281561d00fe66237fe335d944582ae07
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jul 8 12:05:52 2010 +0500
SVG Schema Class
commit 39db171819a65a49699180705b2ecae2968b4c2c
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Sat Jul 3 23:50:13 2010 +0500
because of changes in User Schema etc PDF Schema wasn't working, It is fixed now
commit c62004a8c91cf9c7f704da0e3899e6595d6ea1f2
Merge: 737fb9df271d723111b82dbfcbec74f168275f71 3e9e18aebb5d551f260e178f2f311384c2653b28
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Sat Jul 3 23:47:15 2010 +0500
Merge remote branch 'origin/master' into export_branch
commit 737fb9df271d723111b82dbfcbec74f168275f71
Merge: ba9924054be621d2bad7d977eb05180c01e31b8c 9e857f9f84591eedf3be50668356411eb52da0fa
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Sat Jul 3 13:54:41 2010 +0500
Merge remote branch 'origin/master' into export_branch
commit ba9924054be621d2bad7d977eb05180c01e31b8c
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Sat Jul 3 13:52:43 2010 +0500
export_relation_schema.php: commenting improved
commit 188c7b8d38fdffa19ed0cefe8ca0af047495adba
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Fri Jul 2 16:31:32 2010 +0500
User_Schema class : removed tabs + commented code + organized structure, Delete listing of schema classes in process relation schema file
commit 1ef5f8564e1013ed737b7491aa6fe806612dea8d
Merge: cba214aee41a6da0e24b559d32fbb15a1d6bbb64 7d4c3174f7e28a17fbacab91b67eb7cc1ff4ed0a
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Fri Jul 2 16:23:58 2010 +0500
Merge remote branch 'origin/master' into export_branch
commit cba214aee41a6da0e24b559d32fbb15a1d6bbb64
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Sat Jun 26 11:16:11 2010 +0500
Export Relation Schema: deleting wrong name files
commit dd217e8dffe87efeb6f01a9ee4210c3c3f6ab394
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Fri Jun 25 19:14:47 2010 +0500
Export Relation Schema: renaming files + renaming classes according to pear standards
commit 7660295dca0850f3918abcda3559db5a86c73ab6
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jun 24 20:39:46 2010 +0500
Schema Classes structure, PDF and SVG
commit 9befa3965e3b9e82532a1bc43e199e269f73a925
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jun 24 20:37:39 2010 +0500
Schema Classes structure
commit 8dc2149272811636fcb90f809c936a8b068356eb
Merge: 0e9f6247e4d2d554b5eb59f637e6b9edaed5cda4 1be2d538dfae929582b9ff6b4a6bdc643609da9e
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jun 24 20:32:35 2010 +0500
Merge remote branch 'origin/master' into export_branch
commit 0e9f6247e4d2d554b5eb59f637e6b9edaed5cda4
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jun 24 20:26:14 2010 +0500
Revert "schema classes structure"
This reverts commit 589eef328048df3e74e3a713c8de06e304688c96.
commit fc838dd0cbd085e7d09c40b0b89e038671cfff97
Merge: 589eef328048df3e74e3a713c8de06e304688c96 6bb0cef5360aa53ebef4df12dac3f80c4fd60273
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jun 24 18:31:54 2010 +0500
Merge remote branch 'origin/master' into export_branch
commit 589eef328048df3e74e3a713c8de06e304688c96
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jun 24 18:31:42 2010 +0500
schema classes structure
commit d38b380c3205b29fe7d5e89f1502aac67f3c2179
Merge: 3805338674202055aa7724e42b23c894b06bd4c0 aeb14a271ab439b0f62940049aa07edf1240f46b
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Mon Jun 7 05:01:59 2010 +0500
Merge remote branch 'origin/master' into export_branch
commit 3805338674202055aa7724e42b23c894b06bd4c0
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jun 3 17:51:05 2010 +0500
Rename libraries/classes to libraries/schema
commit 5d7998984d8dbf6d2065d06bb9c93668a852ec4a
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jun 3 17:09:57 2010 +0500
adding classes to libraries dir
commit 7d125e01a822a26571e4938eb1e97beac6056a73
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jun 3 17:07:01 2010 +0500
moved classes to libraries directory
commit 14e6af7d8aeb05ea32ee7defa9aee335041bd3cc
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jun 3 16:01:12 2010 +0500
done
commit 793468f14075b64d8c4f992b6fe2b1d3bcd3341b
Author: Adnan <hiddenpearls(a)gmail.com>
Date: Thu Jun 3 15:28:00 2010 +0500
classes structure
-----------------------------------------------------------------------
Summary of changes:
db_operations.php | 10 +-
js/functions.js | 48 +-
libraries/display_pdf_schema.lib.php | 71 -
libraries/schema/Dia_Relation_Schema.class.php | 779 ++++++++++++
libraries/schema/Eps_Relation_Schema.class.php | 858 +++++++++++++
libraries/schema/Export_Relation_Schema.class.php | 223 ++++
libraries/schema/Pdf_Relation_Schema.class.php | 1352 ++++++++++++++++++++
libraries/schema/Svg_Relation_Schema.class.php | 854 +++++++++++++
libraries/schema/User_Schema.class.php | 821 ++++++++++++
libraries/schema/Visio_Relation_Schema.class.php | 599 +++++++++
libraries/tcpdf/tcpdf.php | 3 +
pdf_pages.php | 559 --------
pdf_schema.php | 1404 ---------------------
schema_edit.php | 140 ++
schema_export.php | 49 +
15 files changed, 5729 insertions(+), 2041 deletions(-)
delete mode 100644 libraries/display_pdf_schema.lib.php
create mode 100644 libraries/schema/Dia_Relation_Schema.class.php
create mode 100644 libraries/schema/Eps_Relation_Schema.class.php
create mode 100644 libraries/schema/Export_Relation_Schema.class.php
create mode 100644 libraries/schema/Pdf_Relation_Schema.class.php
create mode 100644 libraries/schema/Svg_Relation_Schema.class.php
create mode 100644 libraries/schema/User_Schema.class.php
create mode 100644 libraries/schema/Visio_Relation_Schema.class.php
delete mode 100644 pdf_pages.php
delete mode 100644 pdf_schema.php
create mode 100644 schema_edit.php
create mode 100644 schema_export.php
diff --git a/db_operations.php b/db_operations.php
index 53a2821..fe4d1cc 100644
--- a/db_operations.php
+++ b/db_operations.php
@@ -520,15 +520,15 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?>
WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$test_rs = PMA_query_as_controluser($test_query, null, PMA_DBI_QUERY_STORE);
- if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
- include('./libraries/display_pdf_schema.lib.php');
- } // end if
- echo '<fieldset><a href="pdf_pages.php?' . $url_query . '">';
+ /*
+ * Export Relational Schema View
+ */
+ echo '<fieldset><a href="schema_edit.php?' . $url_query . '">';
if ($cfg['PropertiesIconic']) {
echo '<img class="icon" src="' . $pmaThemeImage . 'b_edit.png"'
.' alt="" width="16" height="16" />';
}
- echo __('Edit PDF Pages') . '</a></fieldset>';
+ echo __('Export Relational Schema View') . '</a></fieldset>';
} // end if
/**
diff --git a/js/functions.js b/js/functions.js
index 75ffee5..9702f3a 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -1436,8 +1436,11 @@ function refreshDragOption(e) {
function refreshLayout() {
var elm = $('#pdflayout')
var orientation = $('#orientation_opt').val();
- var paper = $('#paper_opt').val();
-
+ if($('#paper_opt').length==1){
+ var paper = $('#paper_opt').val();
+ }else{
+ var paper = 'A4';
+ }
if (orientation == 'P') {
posa = 'x';
posb = 'y';
@@ -1687,6 +1690,47 @@ $(document).ready(function(){
insertQuery(evt.target.id);
return false;
});
+
+ $("#export_type").change(function(){
+ if($("#export_type").val()=='svg'){
+ $("#show_grid_opt").attr("disabled","disabled");
+ $("#orientation_opt").attr("disabled","disabled");
+ $("#with_doc").attr("disabled","disabled");
+ $("#show_table_dim_opt").removeAttr("disabled");
+ $("#all_table_same_wide").removeAttr("disabled");
+ $("#paper_opt").removeAttr("disabled","disabled");
+ $("#show_color_opt").removeAttr("disabled","disabled");
+ //$(this).css("background-color","yellow");
+ }else if($("#export_type").val()=='dia'){
+ $("#show_grid_opt").attr("disabled","disabled");
+ $("#with_doc").attr("disabled","disabled");
+ $("#show_table_dim_opt").attr("disabled","disabled");
+ $("#all_table_same_wide").attr("disabled","disabled");
+ $("#paper_opt").removeAttr("disabled","disabled");
+ $("#show_color_opt").removeAttr("disabled","disabled");
+ $("#orientation_opt").removeAttr("disabled","disabled");
+ }else if($("#export_type").val()=='eps'){
+ $("#show_grid_opt").attr("disabled","disabled");
+ $("#orientation_opt").removeAttr("disabled");
+ $("#with_doc").attr("disabled","disabled");
+ $("#show_table_dim_opt").attr("disabled","disabled");
+ $("#all_table_same_wide").attr("disabled","disabled");
+ $("#paper_opt").attr("disabled","disabled");
+ $("#show_color_opt").attr("disabled","disabled");
+
+ }else if($("#export_type").val()=='pdf'){
+ $("#show_grid_opt").removeAttr("disabled");
+ $("#orientation_opt").removeAttr("disabled");
+ $("#with_doc").removeAttr("disabled","disabled");
+ $("#show_table_dim_opt").removeAttr("disabled","disabled");
+ $("#all_table_same_wide").removeAttr("disabled","disabled");
+ $("#paper_opt").removeAttr("disabled","disabled");
+ $("#show_color_opt").removeAttr("disabled","disabled");
+ }else{
+ // nothing
+ }
+ });
+
$('#sqlquery').focus();
if ($('#input_username')) {
if ($('#input_username').val() == '') {
diff --git a/libraries/display_pdf_schema.lib.php b/libraries/display_pdf_schema.lib.php
deleted file mode 100644
index ad12fc3..0000000
--- a/libraries/display_pdf_schema.lib.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<!-- PDF schema -->
-<form method="post" action="pdf_schema.php">
-<fieldset>
- <legend>
- <?php
- echo PMA_generate_common_hidden_inputs($db);
- if ($cfg['PropertiesIconic']) {
- echo '<img class="icon" src="' . $pmaThemeImage . 'b_view.png"'
- .' alt="" width="16" height="16" />';
- }
- echo __('Display PDF schema');
- ?>:
- </legend>
- <?php
- if (isset($test_rs)) {
- ?>
- <label for="pdf_page_number_opt"><?php echo __('Page number:'); ?></label>
- <select name="pdf_page_number" id="pdf_page_number_opt">
- <?php
- while ($pages = @PMA_DBI_fetch_assoc($test_rs)) {
- echo ' <option value="' . $pages['page_nr'] . '">'
- . $pages['page_nr'] . ': ' . htmlspecialchars($pages['page_descr']) . '</option>' . "\n";
- } // end while
- PMA_DBI_free_result($test_rs);
- unset($test_rs);
- ?>
- </select><br />
- <?php } else { ?>
- <input type="hidden" name="pdf_page_number" value="<?php echo htmlspecialchars($chpage); ?>" />
- <?php } ?>
-
- <input type="checkbox" name="show_grid" id="show_grid_opt" />
- <label for="show_grid_opt"><?php echo __('Show grid'); ?></label><br />
- <input type="checkbox" name="show_color" id="show_color_opt"
- checked="checked" />
- <label for="show_color_opt"><?php echo __('Show color'); ?></label><br />
- <input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" />
- <label for="show_table_dim_opt"><?php echo __('Show dimension of tables'); ?>
- </label><br />
- <input type="checkbox" name="all_tab_same_wide" id="all_tab_same_wide" />
- <label for="all_tab_same_wide"><?php echo __('Display all tables with the same width'); ?>
- </label><br />
- <input type="checkbox" name="with_doc" id="with_doc" checked="checked" />
- <label for="with_doc"><?php echo __('Data Dictionary'); ?></label><br />
- <input type="checkbox" name="show_keys" id="show_keys" />
- <label for="show_keys"><?php echo __('Only show keys'); ?></label><br />
-
- <label for="orientation_opt"><?php echo __('Data Dictionary Format'); ?></label>
- <select name="orientation" id="orientation_opt">
- <option value="L"><?php echo __('Landscape');?></option>
- <option value="P"><?php echo __('Portrait');?></option>
- </select><br />
-
- <label for="paper_opt"><?php echo __('Paper size'); ?></label>
- <select name="paper" id="paper_opt">
- <?php
- foreach ($cfg['PDFPageSizes'] AS $key => $val) {
- echo '<option value="' . $val . '"';
- if ($val == $cfg['PDFDefaultPageSize']) {
- echo ' selected="selected"';
- }
- echo ' >' . $val . '</option>' . "\n";
- }
- ?>
- </select>
-</fieldset>
-<fieldset class="tblFooters">
- <input type="submit" value="<?php echo __('Go'); ?>" />
-</fieldset>
-</form>
-
diff --git a/libraries/schema/Dia_Relation_Schema.class.php b/libraries/schema/Dia_Relation_Schema.class.php
new file mode 100644
index 0000000..6b8affa
--- /dev/null
+++ b/libraries/schema/Dia_Relation_Schema.class.php
@@ -0,0 +1,779 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ *
+ * @version $Id$
+ * @package phpMyAdmin
+ */
+
+include_once("Export_Relation_Schema.class.php");
+
+/**
+ * This Class inherits the XMLwriter class and
+ * helps in developing structure of DIA Schema Export
+ *
+ * @name PMA_DIA
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ * @access public
+ * @see http://php.net/manual/en/book.xmlwriter.php
+ */
+
+class PMA_DIA extends XMLWriter
+{
+ public $title;
+ public $author;
+ public $font;
+ public $fontSize;
+
+ /**
+ * The "PMA_DIA" constructor
+ *
+ * Upon instantiation This starts writing the Dia XML document
+ *
+ * @return void
+ * @see XMLWriter::openMemory(),XMLWriter::setIndent(),XMLWriter::startDocument()
+ */
+ function __construct()
+ {
+ $this->openMemory();
+ /*
+ * Set indenting using three spaces,
+ * so output is formatted
+ */
+
+ $this->setIndent(TRUE);
+ $this->setIndentString(' ');
+ /*
+ * Create the XML document
+ */
+
+ $this->startDocument('1.0','UTF-8');
+ }
+
+ /**
+ * Starts Dia Document
+ *
+ * dia document starts by first initializing dia:diagram tag
+ * then dia:diagramdata contains all the attributes that needed
+ * to define the document, then finally a Layer starts which
+ * holds all the objects.
+ *
+ * @param string paper The size of the paper/document
+ * @param float topMargin top margin of the paper/document in cm
+ * @param float bottomMargin bottom margin of the paper/document in cm
+ * @param float leftMargin left margin of the paper/document in cm
+ * @param float rightMargin right margin of the paper/document in cm
+ * @param string portrait document will be portrait or landscape
+ * @return void
+ * @access public
+ * @see XMLWriter::startElement(),XMLWriter::writeAttribute(),XMLWriter::writeRaw()
+ */
+ function startDiaDoc($paper,$topMargin,$bottomMargin,$leftMargin,$rightMargin,$portrait)
+ {
+ if($portrait == 'P'){
+ $isPortrait='true';
+ }else{
+ $isPortrait='false';
+ }
+ $this->startElement('dia:diagram');
+ $this->writeAttribute('xmlns:dia', 'http://www.lysator.liu.se/~alla/dia/');
+ $this->startElement('dia:diagramdata');
+ $this->writeRaw (
+ '<dia:attribute name="background">
+ <dia:color val="#ffffff"/>
+ </dia:attribute>
+ <dia:attribute name="pagebreak">
+ <dia:color val="#000099"/>
+ </dia:attribute>
+ <dia:attribute name="paper">
+ <dia:composite type="paper">
+ <dia:attribute name="name">
+ <dia:string>#'.$paper.'#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="tmargin">
+ <dia:real val="'.$topMargin.'"/>
+ </dia:attribute>
+ <dia:attribute name="bmargin">
+ <dia:real val="'.$bottomMargin.'"/>
+ </dia:attribute>
+ <dia:attribute name="lmargin">
+ <dia:real val="'.$leftMargin.'"/>
+ </dia:attribute>
+ <dia:attribute name="rmargin">
+ <dia:real val="'.$rightMargin.'"/>
+ </dia:attribute>
+ <dia:attribute name="is_portrait">
+ <dia:boolean val="'.$isPortrait.'"/>
+ </dia:attribute>
+ <dia:attribute name="scaling">
+ <dia:real val="1"/>
+ </dia:attribute>
+ <dia:attribute name="fitto">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ </dia:composite>
+ </dia:attribute>
+ <dia:attribute name="grid">
+ <dia:composite type="grid">
+ <dia:attribute name="width_x">
+ <dia:real val="1"/>
+ </dia:attribute>
+ <dia:attribute name="width_y">
+ <dia:real val="1"/>
+ </dia:attribute>
+ <dia:attribute name="visible_x">
+ <dia:int val="1"/>
+ </dia:attribute>
+ <dia:attribute name="visible_y">
+ <dia:int val="1"/>
+ </dia:attribute>
+ <dia:composite type="color"/>
+ </dia:composite>
+ </dia:attribute>
+ <dia:attribute name="color">
+ <dia:color val="#d8e5e5"/>
+ </dia:attribute>
+ <dia:attribute name="guides">
+ <dia:composite type="guides">
+ <dia:attribute name="hguides"/>
+ <dia:attribute name="vguides"/>
+ </dia:composite>
+ </dia:attribute>');
+ $this->endElement();
+ $this->startElement('dia:layer');
+ $this->writeAttribute('name', 'Background');
+ $this->writeAttribute('visible', 'true');
+ $this->writeAttribute('active', 'true');
+
+ }
+
+ /**
+ * Ends Dia Document
+ *
+ * @return void
+ * @access public
+ * @see XMLWriter::endElement(),XMLWriter::endDocument()
+ */
+ function endDiaDoc()
+ {
+ $this->endElement();
+ $this->endDocument();
+ }
+
+ /**
+ * Output Dia Document for download
+ *
+ * @param string fileName name of the dia document
+ * @return void
+ * @access public
+ * @see XMLWriter::flush()
+ */
+ function showOutput($fileName)
+ {
+ if(ob_get_clean()){
+ ob_end_clean();
+ }
+ header('Content-type: application/x-dia-diagram');
+ header('Content-Disposition: attachment; filename="'.$fileName.'.dia"');
+ $output = $this->flush();
+ print $output;
+ }
+}
+
+/**
+ * Table preferences/statistics
+ *
+ * This class preserves the table co-ordinates,fields
+ * and helps in drawing/generating the Tables in dia XML document.
+ *
+ * @name Table_Stats
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ * @see PMA_DIA
+ */
+class Table_Stats
+{
+ /**
+ * Defines properties
+ */
+ public $tableName;
+ public $fields = array();
+ public $x, $y;
+ public $primary = array();
+ public $tableId;
+ public $tableColor;
+
+ /**
+ * The "Table_Stats" constructor
+ *
+ * @param string table_name The table name
+ * @param integer pageNumber The current page number (from the
+ * $cfg['Servers'][$i]['table_coords'] table)
+ * @param boolean showKeys Whether to display ONLY keys or not
+ * @return void
+ * @global object The current dia document
+ * @global array The relations settings
+ * @global string The current db name
+ * @see PMA_DIA
+ */
+ function __construct($tableName, $pageNumber, $showKeys = false)
+ {
+ global $dia, $cfgRelation, $db;
+
+ $this->tableName = $tableName;
+ $sql = 'DESCRIBE ' . PMA_backquote($tableName);
+ $result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE);
+ if (!$result || !PMA_DBI_num_rows($result)) {
+ $dia->dieSchema($pageNumber,"DIA",sprintf(__('The %s table doesn\'t exist!'), $tableName));
+ }
+ /*
+ * load fields
+ * check to see if it will load all fields or only the foreign keys
+ */
+ if ($showKeys) {
+ $indexes = PMA_Index::getFromTable($this->tableName, $db);
+ $all_columns = array();
+ foreach ($indexes as $index) {
+ $all_columns = array_merge($all_columns, array_flip(array_keys($index->getColumns())));
+ }
+ $this->fields = array_keys($all_columns);
+ } else {
+ while ($row = PMA_DBI_fetch_row($result)) {
+ $this->fields[] = $row[0];
+ }
+ }
+
+ $sql = 'SELECT x, y FROM '
+ . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
+ . ' AND table_name = \'' . PMA_sqlAddslashes($tableName) . '\''
+ . ' AND pdf_page_number = ' . $pageNumber;
+ $result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
+ if (!$result || !PMA_DBI_num_rows($result)) {
+ $dia->dieSchema($pageNumber,"DIA",sprintf(__('Please configure the coordinates for table %s'), $tableName));
+ }
+ list($this->x, $this->y) = PMA_DBI_fetch_row($result);
+ $this->x = (double) $this->x;
+ $this->y = (double) $this->y;
+ /*
+ * displayfield
+ */
+ $this->displayfield = PMA_getDisplayField($db, $tableName);
+ /*
+ * index
+ */
+ $result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($tableName) . ';', null, PMA_DBI_QUERY_STORE);
+ if (PMA_DBI_num_rows($result) > 0) {
+ while ($row = PMA_DBI_fetch_assoc($result)) {
+ if ($row['Key_name'] == 'PRIMARY') {
+ $this->primary[] = $row['Column_name'];
+ }
+ }
+ }
+ /**
+ * Every object in Dia document needs an ID to identify
+ * so, we used a static variable to keep the things unique
+ */
+ PMA_Dia_Relation_Schema::$objectId += 1;
+ $this->tableId = PMA_Dia_Relation_Schema::$objectId;
+ }
+
+ /**
+ * Do draw the table
+ *
+ * Tables are generated using object type Database - Table
+ * primary fields are underlined in tables. Dia object
+ * is used to generate the XML of Dia Document. Database Table
+ * Object and their attributes are involved in the combination
+ * of displaing Database - Table on Dia Document.
+
+ * @param boolean changeColor Whether to show color for tables text or not
+ if changeColor is true then an array of $listOfColors
+ will be used to choose the random colors for tables text
+ we can change/add more colors to this array
+ @return void
+ * @global object The current Dia document
+ * @access public
+ * @see PMA_DIA
+ */
+ public function tableDraw($changeColor)
+ {
+ global $dia;
+
+ if ($changeColor) {
+ $listOfColors = array(
+ 'FF0000',
+ '000099',
+ '00FF00'
+ );
+ shuffle($listOfColors);
+ $this->tableColor = '#'.$listOfColors[0].'';
+ } else {
+ $this->tableColor = '#000000';
+ }
+
+ $factor = 0.1;
+
+ $dia->startElement('dia:object');
+ $dia->writeAttribute('type', 'Database - Table');
+ $dia->writeAttribute('version', '0');
+ $dia->writeAttribute('id', ''.$this->tableId.'');
+ $dia->writeRaw(
+ '<dia:attribute name="obj_pos">
+ <dia:point val="'.($this->x * $factor).','.($this->y * $factor).'"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="'.($this->x * $factor).','.($this->y * $factor).';9.97,9.2"/>
+ </dia:attribute>
+ <dia:attribute name="meta">
+ <dia:composite type="dict"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="'.($this->x * $factor).','.($this->y * $factor).'"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="5.9199999999999999"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="3.5"/>
+ </dia:attribute>
+ <dia:attribute name="text_colour">
+ <dia:color val="'.$this->tableColor.'"/>
+ </dia:attribute>
+ <dia:attribute name="line_colour">
+ <dia:color val="#000000"/>
+ </dia:attribute>
+ <dia:attribute name="fill_colour">
+ <dia:color val="#ffffff"/>
+ </dia:attribute>
+ <dia:attribute name="line_width">
+ <dia:real val="0.10000000000000001"/>
+ </dia:attribute>
+ <dia:attribute name="name">
+ <dia:string>#'.$this->tableName.'#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="comment">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="visible_comment">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="tagging_comment">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="underline_primary_key">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ <dia:attribute name="bold_primary_keys">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ <dia:attribute name="normal_font">
+ <dia:font family="monospace" style="0" name="Courier"/>
+ </dia:attribute>
+ <dia:attribute name="name_font">
+ <dia:font family="sans" style="80" name="Helvetica-Bold"/>
+ </dia:attribute>
+ <dia:attribute name="comment_font">
+ <dia:font family="sans" style="0" name="Helvetica"/>
+ </dia:attribute>
+ <dia:attribute name="normal_font_height">
+ <dia:real val="0.80000000000000004"/>
+ </dia:attribute>
+ <dia:attribute name="name_font_height">
+ <dia:real val="0.69999999999999996"/>
+ </dia:attribute>
+ <dia:attribute name="comment_font_height">
+ <dia:real val="0.69999999999999996"/>
+ </dia:attribute>'
+ );
+
+ $dia->startElement('dia:attribute');
+ $dia->writeAttribute('name', 'attributes');
+
+ foreach ($this->fields as $field) {
+ $dia->writeRaw(
+ '<dia:composite type="table_attribute">
+ <dia:attribute name="name">
+ <dia:string>#'.$field.'#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="type">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="comment">
+ <dia:string>##</dia:string>
+ </dia:attribute>'
+ );
+ unset($pm);
+ $pm = 'false';
+ if (in_array($field, $this->primary)) {
+ $pm = 'true';
+ }
+ if ($field == $this->displayfield) {
+ $pm = 'false';
+ }
+ $dia->writeRaw(
+ '<dia:attribute name="primary_key">
+ <dia:boolean val="'.$pm.'"/>
+ </dia:attribute>
+ <dia:attribute name="nullable">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="unique">
+ <dia:boolean val="'.$pm.'"/>
+ </dia:attribute>
+ </dia:composite>'
+ );
+ }
+ $dia->endElement();
+ $dia->endElement();
+ }
+}
+
+/**
+ * Relation preferences/statistics
+ *
+ * This class fetches the table master and foreign fields positions
+ * and helps in generating the Table references and then connects
+ * master table's master field to foreign table's foreign key
+ * in dia XML document.
+ *
+ * @name Relation_Stats
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ * @see PMA_DIA
+ */
+class Relation_Stats
+{
+ /**
+ * Defines properties
+ */
+ public $srcConnPointsRight;
+ public $srcConnPointsLeft;
+ public $destConnPointsRight;
+ public $destConnPointsLeft;
+ public $masterTableId;
+ public $foreignTableId;
+ public $masterTablePos;
+ public $foreignTablePos;
+ public $referenceColor;
+
+ /**
+ * The "Relation_Stats" constructor
+ *
+ * @param string master_table The master table name
+ * @param string master_field The relation field in the master table
+ * @param string foreign_table The foreign table name
+ * @param string foreigh_field The relation field in the foreign table
+ * @return void
+ * @see Relation_Stats::_getXy
+ */
+ function __construct($master_table, $master_field, $foreign_table, $foreign_field)
+ {
+ $src_pos = $this->_getXy($master_table, $master_field);
+ $dest_pos = $this->_getXy($foreign_table, $foreign_field);
+ $this->srcConnPointsLeft = $src_pos[0];
+ $this->srcConnPointsRight = $src_pos[1];
+ $this->destConnPointsLeft = $dest_pos[0];
+ $this->destConnPointsRight = $dest_pos[1];
+ $this->masterTablePos = $src_pos[2];
+ $this->foreignTablePos = $dest_pos[2];
+ $this->masterTableId = $master_table->tableId;
+ $this->foreignTableId = $foreign_table->tableId;
+ }
+
+ /**
+ * Each Table object have connection points
+ * which is used to connect to other objects in Dia
+ * we detect the position of key in fields and
+ * then determines its left and right connection
+ * points.
+ *
+ * @param string table The current table name
+ * @param string column The relation column name
+ * @return array Table right,left connection points and key position
+ * @access private
+ */
+ private function _getXy($table, $column)
+ {
+ $pos = array_search($column, $table->fields);
+ // left, right, position
+ $value = 12;
+ if($pos != 0)
+ {
+ return array($pos + $value + $pos, $pos + $value + $pos + 1, $pos);
+ }
+ return array($pos + $value , $pos + $value + 1, $pos);
+ }
+
+ /**
+ * Draws relation references
+ *
+ * connects master table's master field to foreign table's
+ * forein field using Dia object type Database - Reference
+ * Dia object is used to generate the XML of Dia Document.
+ * Database reference Object and their attributes are involved
+ * in the combination of displaing Database - reference on Dia Document.
+ *
+ * @param boolean changeColor Whether to use one color per relation or not
+ if changeColor is true then an array of $listOfColors
+ will be used to choose the random colors for references
+ lines. we can change/add more colors to this array
+ * @return void
+ * @global object The current Dia document
+ * @access public
+ * @see PMA_PDF
+ */
+ public function relationDraw($changeColor)
+ {
+ global $dia;
+
+ PMA_Dia_Relation_Schema::$objectId += 1;
+ /*
+ * if source connection points and destination connection
+ * points are same then return it false and don't draw that
+ * relation
+ */
+ if ( $this->srcConnPointsRight == $this->destConnPointsRight ){
+ if ( $this->srcConnPointsLeft == $this->destConnPointsLeft ){
+ return false;
+ }
+ }
+
+ if ($changeColor) {
+ $listOfColors = array(
+ 'FF0000',
+ '000099',
+ '00FF00'
+ );
+ shuffle($listOfColors);
+ $this->referenceColor = '#'.$listOfColors[0].'';
+ } else {
+ $this->referenceColor = '#000000';
+ }
+
+ $dia->writeRaw(
+ '<dia:object type="Database - Reference" version="0" id="'.PMA_Dia_Relation_Schema::$objectId.'">
+ <dia:attribute name="obj_pos">
+ <dia:point val="3.27,18.9198"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="2.27,8.7175;17.7679,18.9198"/>
+ </dia:attribute>
+ <dia:attribute name="meta">
+ <dia:composite type="dict"/>
+ </dia:attribute>
+ <dia:attribute name="orth_points">
+ <dia:point val="3.27,18.9198"/>
+ <dia:point val="2.27,18.9198"/>
+ <dia:point val="2.27,14.1286"/>
+ <dia:point val="17.7679,14.1286"/>
+ <dia:point val="17.7679,9.3375"/>
+ <dia:point val="16.7679,9.3375"/>
+ </dia:attribute>
+ <dia:attribute name="orth_orient">
+ <dia:enum val="0"/>
+ <dia:enum val="1"/>
+ <dia:enum val="0"/>
+ <dia:enum val="1"/>
+ <dia:enum val="0"/>
+ </dia:attribute>
+ <dia:attribute name="orth_autoroute">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ <dia:attribute name="text_colour">
+ <dia:color val="#000000"/>
+ </dia:attribute>
+ <dia:attribute name="line_colour">
+ <dia:color val="'.$this->referenceColor.'"/>
+ </dia:attribute>
+ <dia:attribute name="line_width">
+ <dia:real val="0.10000000000000001"/>
+ </dia:attribute>
+ <dia:attribute name="line_style">
+ <dia:enum val="0"/>
+ <dia:real val="1"/>
+ </dia:attribute>
+ <dia:attribute name="corner_radius">
+ <dia:real val="0"/>
+ </dia:attribute>
+ <dia:attribute name="end_arrow">
+ <dia:enum val="22"/>
+ </dia:attribute>
+ <dia:attribute name="end_arrow_length">
+ <dia:real val="0.5"/>
+ </dia:attribute>
+ <dia:attribute name="end_arrow_width">
+ <dia:real val="0.5"/>
+ </dia:attribute>
+ <dia:attribute name="start_point_desc">
+ <dia:string>#1#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="end_point_desc">
+ <dia:string>#n#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="normal_font">
+ <dia:font family="monospace" style="0" name="Courier"/>
+ </dia:attribute>
+ <dia:attribute name="normal_font_height">
+ <dia:real val="0.59999999999999998"/>
+ </dia:attribute>
+ <dia:connections>
+ <dia:connection handle="0" to="'.$this->masterTableId.'" connection="'.$this->srcConnPointsRight.'"/>
+ <dia:connection handle="1" to="'.$this->foreignTableId.'" connection="'.$this->destConnPointsRight.'"/>
+ </dia:connections>
+ </dia:object>'
+ );
+ }
+}
+
+/**
+ * Dia Relation Schema Class
+ *
+ * Purpose of this class is to generate the Dia XML Document
+ * which is used for representing the database diagrams in Dia IDE
+ * This class uses Database Table and Reference Objects of Dia and with
+ * the combination of these objects actually helps in preparing Dia XML.
+ *
+ * Dia XML is generated by using XMLWriter php extension and this class
+ * inherits Export_Relation_Schema class has common functionality added
+ * to this class
+ *
+ * @name Dia_Relation_Schema
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ */
+class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
+{
+ /**
+ * Defines properties
+ */
+ private $_tables = array();
+ private $_relations = array();
+ private $_topMargin = 2.8222000598907471;
+ private $_bottomMargin = 2.8222000598907471;
+ private $_leftMargin = 2.8222000598907471;
+ private $_rightMargin = 2.8222000598907471;
+ public static $objectId = 0;
+
+ /**
+ * The "PMA_Dia_Relation_Schema" constructor
+ *
+ * Upon instantiation This outputs the Dia XML document
+ * that user can download
+ *
+ * @return void
+ * @see PMA_DIA,Table_Stats,Relation_Stats
+ */
+ function __construct()
+ {
+ global $dia,$db;
+
+ $this->setPageNumber($_POST['pdf_page_number']);
+ $this->setShowGrid(isset($_POST['show_grid']));
+ $this->setShowColor($_POST['show_color']);
+ $this->setShowKeys(isset($_POST['show_keys']));
+ $this->setOrientation(isset($_POST['orientation']));
+ $this->setPaper($_POST['paper']);
+ $this->setExportType($_POST['export_type']);
+
+ $dia = new PMA_DIA();
+ $dia->startDiaDoc($this->paper,$this->_topMargin,$this->_bottomMargin,$this->_leftMargin,$this->_rightMargin,$this->orientation);
+ $alltables = $this->getAllTables($db,$this->pageNumber);
+ foreach ($alltables as $table) {
+ if (!isset($this->tables[$table])) {
+ $this->tables[$table] = new Table_Stats($table, $this->pageNumber, $this->showKeys);
+ }
+ }
+
+ $seen_a_relation = false;
+ foreach ($alltables as $one_table) {
+ $exist_rel = PMA_getForeigners($db, $one_table, '', 'both');
+ if ($exist_rel) {
+ $seen_a_relation = true;
+ foreach ($exist_rel as $master_field => $rel) {
+ /* put the foreign table on the schema only if selected
+ * by the user
+ * (do not use array_search() because we would have to
+ * to do a === FALSE and this is not PHP3 compatible)
+ */
+ if (in_array($rel['foreign_table'], $alltables)) {
+ $this->_addRelation($one_table, $master_field, $rel['foreign_table'], $rel['foreign_field'],$this->showKeys);
+ }
+ }
+ }
+ }
+ $this->_drawTables($this->showColor);
+
+ if ($seen_a_relation) {
+ $this->_drawRelations($this->showColor);
+ }
+ $dia->endDiaDoc();
+ $dia->showOutput($db.'-'.$this->pageNumber);
+ exit();
+ }
+
+ /**
+ * Defines relation objects
+ *
+ * @param string masterTable The master table name
+ * @param string masterField The relation field in the master table
+ * @param string foreignTable The foreign table name
+ * @param string foreignField The relation field in the foreign table
+ * @return void
+ * @access private
+ * @see Table_Stats::__construct(),Relation_Stats::__construct()
+ */
+ private function _addRelation($masterTable, $masterField, $foreignTable, $foreignField, $showKeys)
+ {
+ if (!isset($this->tables[$masterTable])) {
+ $this->tables[$masterTable] = new Table_Stats($masterTable, $this->pageNumber, $showKeys);
+ }
+ if (!isset($this->tables[$foreignTable])) {
+ $this->tables[$foreignTable] = new Table_Stats($foreignTable, $this->pageNumber, $showKeys);
+ }
+ $this->_relations[] = new Relation_Stats($this->tables[$masterTable], $masterField, $this->tables[$foreignTable], $foreignField);
+ }
+
+ /**
+ * Draws relation references
+ *
+ * connects master table's master field to
+ * foreign table's forein field using Dia object
+ * type Database - Reference
+ *
+ * @param boolean changeColor Whether to use one color per relation or not
+ * @return void
+ * @access private
+ * @see Relation_Stats::relationDraw()
+ */
+ private function _drawRelations($changeColor)
+ {
+ foreach ($this->_relations as $relation) {
+ $relation->relationDraw($changeColor);
+ }
+ }
+
+ /**
+ * Draws tables
+ *
+ * Tables are generated using Dia object type Database - Table
+ * primary fields are underlined and bold in tables
+ *
+ * @param boolean changeColor Whether to show color for tables text or not
+ * @return void
+ * @access private
+ * @see Table_Stats::tableDraw()
+ */
+ private function _drawTables($changeColor)
+ {
+ foreach ($this->tables as $table) {
+ $table->tableDraw($changeColor);
+ }
+ }
+}
+?>
diff --git a/libraries/schema/Eps_Relation_Schema.class.php b/libraries/schema/Eps_Relation_Schema.class.php
new file mode 100644
index 0000000..e783cbd
--- /dev/null
+++ b/libraries/schema/Eps_Relation_Schema.class.php
@@ -0,0 +1,858 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ *
+ * @version $Id$
+ * @package phpMyAdmin
+ */
+
+include_once("Export_Relation_Schema.class.php");
+
+/**
+ * This Class is EPS Library and
+ * helps in developing structure of EPS Schema Export
+ *
+ * @name PMA_EPS
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ * @access public
+ * @see http://php.net/manual/en/book.xmlwriter.php
+ */
+
+class PMA_EPS
+{
+ public $font;
+ public $fontSize;
+ public $stringCommands;
+
+ /**
+ * The "PMA_EPS" constructor
+ *
+ * Upon instantiation This starts writing the EPS Document.
+ * %!PS-Adobe-3.0 EPSF-3.0 This is the MUST first comment to include
+ * it shows/tells that the Post Script document is purely under
+ * Document Structuring Convention [DSC] and is Compliant
+ * Encapsulated Post Script Document
+ *
+ * @return void
+ * @access public
+ */
+ function __construct()
+ {
+ $this->stringCommands = "";
+ $this->stringCommands .= "%!PS-Adobe-3.0 EPSF-3.0 \n";
+ }
+
+ /**
+ * Set document title
+ *
+ * @param string value sets the title text
+ * @return void
+ * @access public
+ */
+ function setTitle($value)
+ {
+ $this->stringCommands .= '%%Title: ' . $value . "\n";
+ }
+
+ /**
+ * Set document author
+ *
+ * @param string value sets the author
+ * @return void
+ * @access public
+ */
+ function setAuthor($value)
+ {
+ $this->stringCommands .= '%%Creator: ' . $value . "\n";
+ }
+
+ /**
+ * Set document creation date
+ *
+ * @param string value sets the date
+ * @return void
+ * @access public
+ */
+ function setDate($value)
+ {
+ $this->stringCommands .= '%%CreationDate: ' . $value . "\n";
+ }
+
+ /**
+ * Set document orientation
+ *
+ * @param string value sets the author
+ * @return void
+ * @access public
+ */
+ function setOrientation($value)
+ {
+ $this->stringCommands .= "%%PageOrder: Ascend \n";
+ if($value == "L"){
+ $value = "Landscape";
+ $this->stringCommands .= '%%Orientation: ' . $value . "\n";
+ }else{
+ $value = "Portrait";
+ $this->stringCommands .= '%%Orientation: ' . $value . "\n";
+ }
+ $this->stringCommands .= "%%EndComments \n";
+ $this->stringCommands .= "%%Pages 1 \n";
+ $this->stringCommands .= "%%BoundingBox: 72 150 144 170 \n";
+ }
+
+ /**
+ * Set the font and size
+ *
+ * font can be set whenever needed in EPS
+ *
+ * @param string value sets the font name e.g Arial
+ * @param integer value sets the size of the font e.g 10
+ * @return void
+ * @access public
+ */
+ function setFont($value,$size)
+ {
+ $this->font = $value;
+ $this->fontSize = $size;
+ $this->stringCommands .= "/".$value." findfont % Get the basic font\n";
+ $this->stringCommands .= "".$size." scalefont % Scale the font to $size points\n";
+ $this->stringCommands .= "setfont % Make it the current font\n";
+ }
+
+ /**
+ * Get the font
+ *
+ * @return string return the font name e.g Arial
+ * @access public
+ */
+ function getFont()
+ {
+ return $this->font;
+ }
+
+ /**
+ * Get the font Size
+ *
+ * @return string return the size of the font e.g 10
+ * @access public
+ */
+ function getFontSize()
+ {
+ return $this->fontSize;
+ }
+
+ /**
+ * Draw the line
+ *
+ * drawing the lines from x,y source to x,y destination and set the
+ * width of the line. lines helps in showing relationships of tables
+ *
+ * @param integer x_from The x_from attribute defines the start
+ left position of the element
+ * @param integer y_from The y_from attribute defines the start
+ right position of the element
+ * @param integer x_to The x_to attribute defines the end
+ left position of the element
+ * @param integer y_to The y_to attribute defines the end
+ right position of the element
+ * @param integer lineWidth sets the width of the line e.g 2
+ * @return void
+ * @access public
+ */
+ function line($x_from=0, $y_from=0, $x_to=0, $y_to=0, $lineWidth=0)
+ {
+ $this->stringCommands .= $lineWidth . " setlinewidth \n";
+ $this->stringCommands .= $x_from . ' ' . $y_from . " moveto \n";
+ $this->stringCommands .= $x_to . ' ' . $y_to . " lineto \n";
+ $this->stringCommands .= "stroke \n";
+ }
+
+ /**
+ * Draw the rectangle
+ *
+ * drawing the rectangle from x,y source to x,y destination and set the
+ * width of the line. rectangles drawn around the text shown of fields
+ *
+ * @param integer x_from The x_from attribute defines the start
+ left position of the element
+ * @param integer y_from The y_from attribute defines the start
+ right position of the element
+ * @param integer x_to The x_to attribute defines the end
+ left position of the element
+ * @param integer y_to The y_to attribute defines the end
+ right position of the element
+ * @param integer lineWidth sets the width of the line e.g 2
+ * @return void
+ * @access public
+ */
+ function rect($x_from, $y_from, $x_to, $y_to, $lineWidth)
+ {
+ $this->stringCommands .= $lineWidth . " setlinewidth \n";
+ $this->stringCommands .= "newpath \n";
+ $this->stringCommands .= $x_from . " " . $y_from . " moveto \n";
+ $this->stringCommands .= "0 " . $y_to . " rlineto \n";
+ $this->stringCommands .= $x_to . " 0 rlineto \n";
+ $this->stringCommands .= "0 -" . $y_to . " rlineto \n";
+ $this->stringCommands .= "closepath \n";
+ $this->stringCommands .= "stroke \n";
+ }
+
+ /**
+ * Set the current point
+ *
+ * The moveto operator takes two numbers off the stack and treats
+ * them as x and y coordinates to which to move. The coordinates
+ * specified become the current point.
+ *
+ * @param integer x The x attribute defines the
+ left position of the element
+ * @param integer y The y attribute defines the
+ right position of the element
+ * @return void
+ * @access public
+ */
+ function moveTo($x, $y)
+ {
+ $this->stringCommands .= $x . ' ' . $y . " moveto \n";
+ }
+
+ /**
+ * Output/Display the text
+ *
+ * @param string text The string to be displayed
+ * @return void
+ * @access public
+ */
+ function show($text)
+ {
+ $this->stringCommands .= '(' . $text . ") show \n";
+ }
+
+ /**
+ * Output the text at specified co-ordinates
+ *
+ * @param string text The string to be displayed
+ * @param integer x The x attribute defines the
+ left position of the element
+ * @param integer y The y attribute defines the
+ right position of the element
+ * @return void
+ * @access public
+ */
+ function showXY($text, $x, $y)
+ {
+ $this->moveTo($x, $y);
+ $this->show($text);
+ }
+
+ /**
+ * get width of string/text
+ *
+ * EPS text width is calcualted depending on font name
+ * and font size. It is very important to know the width of text
+ * because rectangle is drawn around it.
+ *
+ * This is a bit hardcore method. I didn't found any other better than this.
+ * if someone found better than this. would love to hear that method
+ *
+ * @param string text string that width will be calculated
+ * @param integer font name of the font like Arial,sans-serif etc
+ * @param integer fontSize size of font
+ * @return integer width of the text
+ * @access public
+ */
+ function getStringWidth($text,$font,$fontSize)
+ {
+ /*
+ * Start by counting the width, giving each character a modifying value
+ */
+ $count = 0;
+ $count = $count + ((strlen($text) - strlen(str_replace(array("i","j","l"),"",$text)))*0.23);//ijl
+ $count = $count + ((strlen($text) - strlen(str_replace(array("f"),"",$text)))*0.27);//f
+ $count = $count + ((strlen($text) - strlen(str_replace(array("t","I"),"",$text)))*0.28);//tI
+ $count = $count + ((strlen($text) - strlen(str_replace(array("r"),"",$text)))*0.34);//r
+ $count = $count + ((strlen($text) - strlen(str_replace(array("1"),"",$text)))*0.49);//1
+ $count = $count + ((strlen($text) - strlen(str_replace(array("c","k","s","v","x","y","z","J"),"",$text)))*0.5);//cksvxyzJ
+ $count = $count + ((strlen($text) - strlen(str_replace(array("a","b","d","e","g","h","n","o","p","q","u","L","0","2","3","4","5","6","7","8","9"),"",$text)))*0.56);//abdeghnopquL023456789
+ $count = $count + ((strlen($text) - strlen(str_replace(array("F","T","Z"),"",$text)))*0.61);//FTZ
+ $count = $count + ((strlen($text) - strlen(str_replace(array("A","B","E","K","P","S","V","X","Y"),"",$text)))*0.67);//ABEKPSVXY
+ $count = $count + ((strlen($text) - strlen(str_replace(array("w","C","D","H","N","R","U"),"",$text)))*0.73);//wCDHNRU
+ $count = $count + ((strlen($text) - strlen(str_replace(array("G","O","Q"),"",$text)))*0.78);//GOQ
+ $count = $count + ((strlen($text) - strlen(str_replace(array("m","M"),"",$text)))*0.84);//mM
+ $count = $count + ((strlen($text) - strlen(str_replace("W","",$text)))*.95);//W
+ $count = $count + ((strlen($text) - strlen(str_replace(" ","",$text)))*.28);//" "
+ $text = str_replace(" ","",$text);//remove the " "'s
+ $count = $count + (strlen(preg_replace("/[a-z0-9]/i","",$text))*0.3); //all other chrs
+
+ $modifier = 1;
+ $font = strtolower($font);
+ switch($font){
+ /*
+ * no modifier for arial and sans-serif
+ */
+ case 'arial':
+ case 'sans-serif':
+ break;
+ /*
+ * .92 modifer for time, serif, brushscriptstd, and californian fb
+ */
+ case 'times':
+ case 'serif':
+ case 'brushscriptstd':
+ case 'californian fb':
+ $modifier = .92;
+ break;
+ /*
+ * 1.23 modifier for broadway
+ */
+ case 'broadway':
+ $modifier = 1.23;
+ break;
+ }
+ $textWidth = $count*$fontSize;
+ return ceil($textWidth*$modifier);
+ }
+
+ /**
+ * Ends EPS Document
+ *
+ * @return void
+ * @access public
+ */
+ function endEpsDoc()
+ {
+ $this->stringCommands .= "showpage \n";
+ }
+
+ /**
+ * Output EPS Document for download
+ *
+ * @param string fileName name of the eps document
+ * @return void
+ * @access public
+ */
+ function showOutput($fileName)
+ {
+ // if(ob_get_clean()){
+ //ob_end_clean();
+ //}
+ header('Content-type: image/x-eps');
+ header('Content-Disposition: attachment; filename="'.$fileName.'.eps"');
+ $output = $this->stringCommands;
+ print $output;
+ }
+}
+
+/**
+ * Table preferences/statistics
+ *
+ * This class preserves the table co-ordinates,fields
+ * and helps in drawing/generating the Tables in EPS.
+ *
+ * @name Table_Stats
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ * @see PMA_EPS
+ */
+class Table_Stats
+{
+ /**
+ * Defines properties
+ */
+
+ private $_tableName;
+ private $_showInfo = false;
+
+ public $width = 0;
+ public $height;
+ public $fields = array();
+ public $heightCell = 0;
+ public $currentCell = 0;
+ public $x, $y;
+ public $primary = array();
+
+ /**
+ * The "Table_Stats" constructor
+ *
+ * @param string tableName The table name
+ * @param string font The font name
+ * @param integer fontSize The font size
+ * @param integer same_wide_width The max width among tables
+ * @param boolean showKeys Whether to display keys or not
+ * @param boolean showInfo Whether to display table position or not
+ * @global object The current eps document
+ * @global integer The current page number (from the
+ * $cfg['Servers'][$i]['table_coords'] table)
+ * @global array The relations settings
+ * @global string The current db name
+ * @access private
+ * @see PMA_EPS, Table_Stats::Table_Stats_setWidth,
+ Table_Stats::Table_Stats_setHeight
+ */
+ function __construct($tableName, $font, $fontSize, $pageNumber, &$same_wide_width, $showKeys = false, $showInfo = false)
+ {
+ global $eps, $cfgRelation, $db;
+
+ $this->_tableName = $tableName;
+ $sql = 'DESCRIBE ' . PMA_backquote($tableName);
+ $result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE);
+ if (!$result || !PMA_DBI_num_rows($result)) {
+ $eps->dieSchema($pageNumber,"EPS",sprintf(__('The %s table doesn\'t exist!'), $tableName));
+ }
+
+ /*
+ * load fields
+ * check to see if it will load all fields or only the foreign keys
+ */
+ if ($showKeys) {
+ $indexes = PMA_Index::getFromTable($this->_tableName, $db);
+ $all_columns = array();
+ foreach ($indexes as $index) {
+ $all_columns = array_merge($all_columns, array_flip(array_keys($index->getColumns())));
+ }
+ $this->fields = array_keys($all_columns);
+ } else {
+ while ($row = PMA_DBI_fetch_row($result)) {
+ $this->fields[] = $row[0];
+ }
+ }
+
+ $this->_showInfo = $showInfo;
+
+ // height and width
+ $this->_setHeightTable($fontSize);
+
+ // setWidth must me after setHeight, because title
+ // can include table height which changes table width
+ $this->_setWidthTable($font,$fontSize);
+ if ($same_wide_width < $this->width) {
+ $same_wide_width = $this->width;
+ }
+
+ // x and y
+ $sql = 'SELECT x, y FROM '
+ . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
+ . ' AND table_name = \'' . PMA_sqlAddslashes($tableName) . '\''
+ . ' AND pdf_page_number = ' . $pageNumber;
+ $result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
+
+ if (!$result || !PMA_DBI_num_rows($result)) {
+ $eps->dieSchema($pageNumber,"EPS",sprintf(__('Please configure the coordinates for table %s'), $tableName));
+ }
+ list($this->x, $this->y) = PMA_DBI_fetch_row($result);
+ $this->x = (double) $this->x;
+ $this->y = (double) $this->y;
+ // displayfield
+ $this->displayfield = PMA_getDisplayField($db, $tableName);
+ // index
+ $result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($tableName) . ';', null, PMA_DBI_QUERY_STORE);
+ if (PMA_DBI_num_rows($result) > 0) {
+ while ($row = PMA_DBI_fetch_assoc($result)) {
+ if ($row['Key_name'] == 'PRIMARY') {
+ $this->primary[] = $row['Column_name'];
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns title of the current table,
+ * title can have the dimensions/co-ordinates of the table
+ *
+ * @return string The relation/table name
+ * @access private
+ */
+ private function _getTitle()
+ {
+ return ($this->_showInfo ? sprintf('%.0f', $this->width) . 'x' . sprintf('%.0f', $this->heightCell) : '') . ' ' . $this->_tableName;
+ }
+
+ /**
+ * Sets the width of the table
+ *
+ * @param string font The font name
+ * @param integer fontSize The font size
+ * @global object The current eps document
+ * @return void
+ * @access private
+ * @see PMA_EPS
+ */
+ private function _setWidthTable($font,$fontSize)
+ {
+ global $eps;
+
+ foreach ($this->fields as $field) {
+ $this->width = max($this->width, $eps->getStringWidth($field,$font,$fontSize));
+ }
+ $this->width += $eps->getStringWidth(' ',$font,$fontSize);
+ /*
+ * it is unknown what value must be added, because
+ * table title is affected by the tabe width value
+ */
+ while ($this->width < $eps->getStringWidth($this->_getTitle(),$font,$fontSize)) {
+ $this->width += 7;
+ }
+ }
+
+ /**
+ * Sets the height of the table
+ *
+ * @param integer fontSize The font size
+ * @return void
+ * @access private
+ */
+ private function _setHeightTable($fontSize)
+ {
+ $this->heightCell = $fontSize + 4;
+ $this->height = (count($this->fields) + 1) * $this->heightCell;
+ }
+
+ /**
+ * Draw the table
+ *
+ * @param boolean showColor Whether to display color
+ * @global object The current eps document
+ * @return void
+ * @access public
+ * @see PMA_EPS,PMA_EPS::line,PMA_EPS::rect
+ */
+ public function tableDraw($showColor)
+ {
+ global $eps;
+ //echo $this->_tableName.'<br />';
+ $eps->rect($this->x,$this->y + 12,
+ $this->width,$this->heightCell,
+ 1
+ );
+ $eps->showXY($this->_getTitle(),$this->x + 5,$this->y + 14);
+ foreach ($this->fields as $field) {
+ $this->currentCell += $this->heightCell;
+ $showColor = 'none';
+ if ($showColor) {
+ if (in_array($field, $this->primary)) {
+ $showColor = '#0c0';
+ }
+ if ($field == $this->displayfield) {
+ $showColor = 'none';
+ }
+ }
+ $eps->rect($this->x,$this->y + 12 + $this->currentCell,
+ $this->width, $this->heightCell,1);
+ $eps->showXY($field, $this->x + 5, $this->y + 14 + $this->currentCell);
+ }
+ }
+}
+
+/**
+ * Relation preferences/statistics
+ *
+ * This class fetches the table master and foreign fields positions
+ * and helps in generating the Table references and then connects
+ * master table's master field to foreign table's foreign key
+ * in EPS document.
+ *
+ * @name Relation_Stats
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ * @see PMA_EPS
+ */
+class Relation_Stats
+{
+ /**
+ * Defines properties
+ */
+ public $xSrc, $ySrc;
+ public $srcDir ;
+ public $destDir;
+ public $xDest, $yDest;
+ public $wTick = 10;
+
+ /**
+ * The "Relation_Stats" constructor
+ *
+ * @param string master_table The master table name
+ * @param string master_field The relation field in the master table
+ * @param string foreign_table The foreign table name
+ * @param string foreigh_field The relation field in the foreign table
+ * @see Relation_Stats::_getXy
+ */
+ function __construct($master_table, $master_field, $foreign_table, $foreign_field)
+ {
+ $src_pos = $this->_getXy($master_table, $master_field);
+ $dest_pos = $this->_getXy($foreign_table, $foreign_field);
+ /*
+ * [0] is x-left
+ * [1] is x-right
+ * [2] is y
+ */
+ $src_left = $src_pos[0] - $this->wTick;
+ $src_right = $src_pos[1] + $this->wTick;
+ $dest_left = $dest_pos[0] - $this->wTick;
+ $dest_right = $dest_pos[1] + $this->wTick;
+
+ $d1 = abs($src_left - $dest_left);
+ $d2 = abs($src_right - $dest_left);
+ $d3 = abs($src_left - $dest_right);
+ $d4 = abs($src_right - $dest_right);
+ $d = min($d1, $d2, $d3, $d4);
+
+ if ($d == $d1) {
+ $this->xSrc = $src_pos[0];
+ $this->srcDir = -1;
+ $this->xDest = $dest_pos[0];
+ $this->destDir = -1;
+ } elseif ($d == $d2) {
+ $this->xSrc = $src_pos[1];
+ $this->srcDir = 1;
+ $this->xDest = $dest_pos[0];
+ $this->destDir = -1;
+ } elseif ($d == $d3) {
+ $this->xSrc = $src_pos[0];
+ $this->srcDir = -1;
+ $this->xDest = $dest_pos[1];
+ $this->destDir = 1;
+ } else {
+ $this->xSrc = $src_pos[1];
+ $this->srcDir = 1;
+ $this->xDest = $dest_pos[1];
+ $this->destDir = 1;
+ }
+ $this->ySrc = $src_pos[2] + 10;
+ $this->yDest = $dest_pos[2] + 10;
+ }
+
+ /**
+ * Gets arrows coordinates
+ *
+ * @param string table The current table name
+ * @param string column The relation column name
+ * @return array Arrows coordinates
+ * @access private
+ */
+ private function _getXy($table, $column)
+ {
+ $pos = array_search($column, $table->fields);
+ // x_left, x_right, y
+ return array($table->x, $table->x + $table->width, $table->y + ($pos + 1.5) * $table->heightCell);
+ }
+
+ /**
+ * draws relation links and arrows
+ * shows foreign key relations
+ *
+ * @param boolean changeColor Whether to use one color per relation or not
+ * @global object The current EPS document
+ * @access public
+ * @see PMA_EPS
+ */
+ public function relationDraw($changeColor)
+ {
+ global $eps;
+
+ if ($changeColor) {
+ $listOfColors = array(
+ 'red',
+ 'grey',
+ 'black',
+ 'yellow',
+ 'green',
+ 'cyan',
+ ' orange'
+ );
+ shuffle($listOfColors);
+ $color = $listOfColors[0];
+ } else {
+ $color = 'black';
+ }
+ // draw a line like -- to foreign field
+ $eps->line($this->xSrc,$this->ySrc,
+ $this->xSrc + $this->srcDir * $this->wTick,$this->ySrc,
+ 1
+ );
+ // draw a line like -- to master field
+ $eps->line($this->xDest + $this->destDir * $this->wTick, $this->yDest,
+ $this->xDest, $this->yDest,
+ 1
+ );
+ // draw a line that connects to master field line and foreign field line
+ $eps->line($this->xSrc + $this->srcDir * $this->wTick,$this->ySrc,
+ $this->xDest + $this->destDir * $this->wTick, $this->yDest,
+ 1
+ );
+ $root2 = 2 * sqrt(2);
+ $eps->line($this->xSrc + $this->srcDir * $this->wTick * 0.75, $this->ySrc,
+ $this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick ,
+ $this->ySrc + $this->wTick / $root2 ,
+ 1
+ );
+ $eps->line($this->xSrc + $this->srcDir * $this->wTick * 0.75, $this->ySrc,
+ $this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick ,
+ $this->ySrc - $this->wTick / $root2 ,
+ 1
+ );
+ $eps->line($this->xDest + $this->destDir * $this->wTick / 2 , $this->yDest ,
+ $this->xDest + $this->destDir * (0.5 + 1 / $root2) * $this->wTick,
+ $this->yDest + $this->wTick / $root2 ,
+ 1);
+ $eps->line($this->xDest + $this->destDir * $this->wTick / 2 ,
+ $this->yDest , $this->xDest + $this->destDir * (0.5 + 1 / $root2) * $this->wTick ,
+ $this->yDest - $this->wTick / $root2 ,
+ 1
+ );
+ }
+}
+/*
+* end of the "Relation_Stats" class
+*/
+
+/**
+ * EPS Relation Schema Class
+ *
+ * Purpose of this class is to generate the EPS Document
+ * which is used for representing the database diagrams.
+ * This class uses post script commands and with
+ * the combination of these commands actually helps in preparing EPS Document.
+ *
+ * This class inherits Export_Relation_Schema class has common functionality added
+ * to this class
+ *
+ * @name Eps_Relation_Schema
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ */
+class PMA_Eps_Relation_Schema extends PMA_Export_Relation_Schema
+{
+ private $tables = array();
+ private $_relations = array();
+
+ /**
+ * The "PMA_EPS_Relation_Schema" constructor
+ *
+ * Upon instantiation This starts writing the EPS document
+ * user will be prompted for download as .eps extension
+ *
+ * @return void
+ * @see PMA_EPS
+ */
+ function __construct()
+ {
+ global $eps,$db;
+
+ $this->setPageNumber($_POST['pdf_page_number']);
+ $this->setShowColor(isset($_POST['show_color']));
+ $this->setShowKeys(isset($_POST['show_keys']));
+ $this->setTableDimension(isset($_POST['show_table_dimension']));
+ $this->setAllTableSameWidth(isset($_POST['all_table_same_wide']));
+ $this->setOrientation($_POST['orientation']);
+ $this->setExportType($_POST['export_type']);
+
+ $eps = new PMA_EPS();
+ $eps->setTitle(sprintf(__('Schema of the %s database - Page %s'), $db, $this->pageNumber));
+ $eps->setAuthor('phpMyAdmin ' . PMA_VERSION);
+ $eps->setDate(date("j F Y, g:i a"));
+ $eps->setOrientation($this->orientation);
+ $eps->setFont('Verdana','10');
+
+
+
+ $alltables = $this->getAllTables($db,$this->pageNumber);
+
+ foreach ($alltables AS $table) {
+ if (!isset($this->tables[$table])) {
+ $this->tables[$table] = new Table_Stats($table,$eps->getFont(),$eps->getFontSize(), $this->pageNumber, $this->_tablewidth, $this->showKeys, $this->tableDimension);
+ }
+
+ if ($this->sameWide) {
+ $this->tables[$table]->width = $this->_tablewidth;
+ }
+ }
+
+ $seen_a_relation = false;
+ foreach ($alltables as $one_table) {
+ $exist_rel = PMA_getForeigners($db, $one_table, '', 'both');
+ if ($exist_rel) {
+ $seen_a_relation = true;
+ foreach ($exist_rel as $master_field => $rel) {
+ /* put the foreign table on the schema only if selected
+ * by the user
+ * (do not use array_search() because we would have to
+ * to do a === FALSE and this is not PHP3 compatible)
+ */
+ if (in_array($rel['foreign_table'], $alltables)) {
+ $this->_addRelation($one_table,$eps->getFont(),$eps->getFontSize(), $master_field, $rel['foreign_table'], $rel['foreign_field'], $this->tableDimension);
+ }
+ }
+ }
+ }
+ if ($seen_a_relation) {
+ $this->_drawRelations($this->showColor);
+ }
+
+ $this->_drawTables($this->showColor);
+ $eps->endEpsDoc();
+ $eps->showOutput($db.'-'.$this->pageNumber);
+ exit();
+ }
+
+ /**
+ * Defines relation objects
+ *
+ * @param string masterTable The master table name
+ * @param string masterField The relation field in the master table
+ * @param string foreignTable The foreign table name
+ * @param string foreignField The relation field in the foreign table
+ * @param boolean showInfo Whether to display table position or not
+ * @return void
+ * @access private
+ * @see _setMinMax,Table_Stats::__construct(),Relation_Stats::__construct()
+ */
+ private function _addRelation($masterTable,$font,$fontSize, $masterField, $foreignTable, $foreignField, $showInfo)
+ {
+ if (!isset($this->tables[$masterTable])) {
+ $this->tables[$masterTable] = new Table_Stats($masterTable, $font, $fontSize, $this->pageNumber, $this->_tablewidth, false, $showInfo);
+ }
+ if (!isset($this->tables[$foreignTable])) {
+ $this->tables[$foreignTable] = new Table_Stats($foreignTable,$font,$fontSize,$this->pageNumber, $this->_tablewidth, false, $showInfo);
+ }
+ $this->_relations[] = new Relation_Stats($this->tables[$masterTable], $masterField, $this->tables[$foreignTable], $foreignField);
+ }
+
+ /**
+ * Draws relation arrows and lines
+ * connects master table's master field to
+ * foreign table's forein field
+ *
+ * @param boolean changeColor Whether to use one color per relation or not
+ * @return void
+ * @access private
+ * @see Relation_Stats::relationDraw()
+ */
+ private function _drawRelations($changeColor)
+ {
+ foreach ($this->_relations as $relation) {
+ $relation->relationDraw($changeColor);
+ }
+ }
+
+ /**
+ * Draws tables
+ *
+ * @param boolean changeColor Whether to show color for primary fields or not
+ * @return void
+ * @access private
+ * @see Table_Stats::Table_Stats_tableDraw()
+ */
+ private function _drawTables($changeColor)
+ {
+ foreach ($this->tables as $table) {
+ $table->tableDraw($changeColor);
+ }
+ }
+}
+?>
\ No newline at end of file
diff --git a/libraries/schema/Export_Relation_Schema.class.php b/libraries/schema/Export_Relation_Schema.class.php
new file mode 100644
index 0000000..af9b4de
--- /dev/null
+++ b/libraries/schema/Export_Relation_Schema.class.php
@@ -0,0 +1,223 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ *
+ * @version $Id$
+ * @package phpMyAdmin
+ */
+
+/**
+ * This class is inherited by all schema classes
+ * It contains those methods which are common in them
+ * it works like factory pattern
+ *
+ * @name Export Relation Schema
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ */
+
+class PMA_Export_Relation_Schema
+{
+ private $_pageTitle;
+ public $showGrid;
+ public $showColor;
+ public $tableDimension;
+ public $sameWide;
+ public $withDoc;
+ public $showKeys;
+ public $orientation;
+ public $paper;
+ public $pageNumber;
+
+ /**
+ * Set Page Number
+ *
+ * @param integer value Page Number of the document to be created
+ * @return void
+ * @access public
+ */
+ public function setPageNumber($value)
+ {
+ $this->pageNumber = isset($value) ? $value : 1;
+ }
+
+ /**
+ * Set Show Grid
+ *
+ * @param boolean value show grid of the document or not
+ * @return void
+ * @access public
+ */
+ public function setShowGrid($value)
+ {
+ $this->showGrid = (isset($value) && $value == 'on') ? 1 : 0;
+ }
+
+ public function setShowColor($value)
+ {
+ $this->showColor = (isset($value) && $value == 'on') ? 1 : 0;
+ }
+
+ /**
+ * Set Table Dimension
+ *
+ * @param boolean value show table co-ordinates or not
+ * @return void
+ * @access public
+ */
+ public function setTableDimension($value)
+ {
+ $this->tableDimension = (isset($value) && $value == 'on') ? 1 : 0;
+ }
+
+ /**
+ * Set same width of All Tables
+ *
+ * @param boolean value set same width of all tables or not
+ * @return void
+ * @access public
+ */
+ public function setAllTableSameWidth($value)
+ {
+ $this->sameWide = (isset($value) && $value == 'on') ? 1 : 0;
+ }
+
+ /**
+ * Set Data Dictionary
+ *
+ * @param boolean value show selected database data dictionary or not
+ * @return void
+ * @access public
+ */
+ public function setWithDataDictionary($value)
+ {
+ $this->withDoc = (isset($value) && $value == 'on') ? 1 : 0;
+ }
+
+ /**
+ * Set Show only keys
+ *
+ * @param boolean value show only keys or not
+ * @return void
+ * @access public
+ */
+ public function setShowKeys($value)
+ {
+ $this->showKeys = (isset($value) && $value == 'on') ? 1 : 0;
+ }
+
+ /**
+ * Set Orientation
+ *
+ * @param string value Orientation will be portrait or landscape
+ * @return void
+ * @access public
+ */
+ public function setOrientation($value)
+ {
+ $this->orientation = (isset($value) && $value == 'P') ? 'P' : 'L';
+ }
+
+ /**
+ * Set type of paper
+ *
+ * @param string value paper type can be A4 etc
+ * @return void
+ * @access public
+ */
+ public function setPaper($value)
+ {
+ $this->paper = isset($value) ? $value : 'A4';
+ }
+
+ /**
+ * Set title of the page
+ *
+ * @param string value title of the page displayed at top of the document
+ * @return void
+ * @access public
+ */
+ public function setPageTitle($title)
+ {
+ $this->_pageTitle=$title;
+ }
+
+ /**
+ * Set type of export relational schema
+ *
+ * @param string value can be pdf,svg,dia,visio,eps etc
+ * @return void
+ * @access public
+ */
+ public function setExportType($value)
+ {
+ $this->exportType=$value;
+ }
+
+ /**
+ * get all tables involved or included in page
+ *
+ * @param string db name of the database
+ * @param integer pageNumber page number whose tables will be fetched in an array
+ * @return Array an array of tables
+ * @access public
+ */
+ public function getAllTables($db,$pageNumber)
+ {
+ global $cfgRelation;
+ // Get All tables
+ $tab_sql = 'SELECT table_name FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
+ . ' AND pdf_page_number = ' . $pageNumber;
+
+ $tab_rs = PMA_query_as_controluser($tab_sql, null, PMA_DBI_QUERY_STORE);
+ if (!$tab_rs || !PMA_DBI_num_rows($tab_rs) > 0) {
+ $this->_die('',__('No tables'));
+ }
+ while ($curr_table = @PMA_DBI_fetch_assoc($tab_rs)) {
+ $alltables[] = PMA_sqlAddslashes($curr_table['table_name']);
+ }
+ return $alltables;
+ }
+
+ /**
+ * Displays an error message
+ *
+ * @param integer pageNumber ID of the page choosen
+ * @param string type Schema Type
+ * @param string error_message the error mesage
+ * @global array the PMA configuration array
+ * @global integer the current server id
+ * @global string the current language
+ * @global string the charset to convert to
+ * @global string the current database name
+ * @global string the current charset
+ * @global string the current text direction
+ * @global string a localized string
+ * @global string an other localized string
+ * @access public
+ * @return void
+ */
+ function dieSchema($pageNumber, $type = '', $error_message = '')
+ {
+ global $cfg;
+ global $server, $lang, $convcharset, $db;
+ global $charset, $text_dir;
+
+ require_once './libraries/header.inc.php';
+ echo "<p><strong>" . __("SCHEMA ERROR: ") . $type ."</strong></p>" . "\n";
+ if (!empty($error_message)) {
+ $error_message = htmlspecialchars($error_message);
+ }
+ echo '<p>' . "\n";
+ echo ' ' . $error_message . "\n";
+ echo '</p>' . "\n";
+ echo '<a href="schema_edit.php?' . PMA_generate_common_url($db).'&do=selectpage&chpage='.$pageNumber.'&action_choose=0'
+ . '">' . __('Back') . '</a>';
+ echo "\n";
+ require_once './libraries/footer.inc.php';
+ exit();
+ }
+}
+?>
diff --git a/libraries/schema/Pdf_Relation_Schema.class.php b/libraries/schema/Pdf_Relation_Schema.class.php
new file mode 100644
index 0000000..78e6387
--- /dev/null
+++ b/libraries/schema/Pdf_Relation_Schema.class.php
@@ -0,0 +1,1352 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ *
+ * @version $Id$
+ * @package phpMyAdmin
+ */
+
+include_once("Export_Relation_Schema.class.php");
+
+/**
+ * Font used in PDF.
+ *
+ * @todo Make this configuratble (at least Sans/Serif).
+ */
+define('PMA_PDF_FONT', 'DejaVuSans');
+require_once './libraries/tcpdf/tcpdf.php';
+
+/**
+ * Extends the "TCPDF" class and helps
+ * in developing the structure of PDF Schema Export
+ *
+ * @name PMA_PDF
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ * @access public
+ * @see TCPDF
+ */
+class PMA_PDF extends TCPDF
+{
+ /**
+ * Defines properties
+ */
+ var $_xMin;
+ var $_yMin;
+ var $leftMargin = 10;
+ var $topMargin = 10;
+ var $scale;
+ var $PMA_links;
+ var $Outlines = array();
+ var $def_outlines;
+ var $Alias = array();
+ var $widths;
+
+ public function getFh()
+ {
+ return $this->fh;
+ }
+
+ public function getFw()
+ {
+ return $this->fw;
+ }
+
+ public function setCMargin($c_margin)
+ {
+ $this->cMargin = $c_margin;
+ }
+
+ function SetAlias($name, $value)
+ {
+ $this->Alias[$name] = $value ;
+ }
+
+ function _putpages()
+ {
+ if (count($this->Alias) > 0) {
+ $nb = $this->page;
+ foreach ($this->Alias as $alias => $value) {
+ for ($n = 1;$n <= $nb;$n++)
+ $this->pages[$n]=str_replace($alias, $value, $this->pages[$n]);
+ }
+ }
+ parent::_putpages();
+ }
+
+ // added because tcpdf for PHP 5 has a protected $buffer
+ public function getBuffer()
+ {
+ return $this->buffer;
+ }
+
+ public function getState()
+ {
+ return $this->state;
+ }
+
+ /**
+ * Sets the scaling factor, defines minimum coordinates and margins
+ *
+ * @param float scale The scaling factor
+ * @param float _xMin The minimum X coordinate
+ * @param float _yMin The minimum Y coordinate
+ * @param float leftMargin The left margin
+ * @param float topMargin The top margin
+ * @access public
+ */
+ function PMA_PDF_setScale($scale = 1, $xMin = 0, $yMin = 0, $leftMargin = -1, $topMargin = -1)
+ {
+ $this->scale = $scale;
+ $this->_xMin = $xMin;
+ $this->_yMin = $yMin;
+ if ($this->leftMargin != -1) {
+ $this->leftMargin = $leftMargin;
+ }
+ if ($this->topMargin != -1) {
+ $this->topMargin = $topMargin;
+ }
+ }
+
+ /**
+ * Outputs a scaled cell
+ *
+ * @param float w The cell width
+ * @param float h The cell height
+ * @param string txt The text to output
+ * @param mixed border Whether to add borders or not
+ * @param integer ln Where to put the cursor once the output is done
+ * @param string align Align mode
+ * @param integer fill Whether to fill the cell with a color or not
+ * @access public
+ * @see TCPDF::Cell()
+ */
+ function PMA_PDF_cellScale($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = '')
+ {
+ $h = $h / $this->scale;
+ $w = $w / $this->scale;
+ $this->Cell($w, $h, $txt, $border, $ln, $align, $fill, $link);
+ }
+
+ /**
+ * Draws a scaled line
+ *
+ * @param float x1 The horizontal position of the starting point
+ * @param float y1 The vertical position of the starting point
+ * @param float x2 The horizontal position of the ending point
+ * @param float y2 The vertical position of the ending point
+ * @access public
+ * @see TCPDF::Line()
+ */
+ function PMA_PDF_lineScale($x1, $y1, $x2, $y2)
+ {
+ $x1 = ($x1 - $this->_xMin) / $this->scale + $this->leftMargin;
+ $y1 = ($y1 - $this->_yMin) / $this->scale + $this->topMargin;
+ $x2 = ($x2 - $this->_xMin) / $this->scale + $this->leftMargin;
+ $y2 = ($y2 - $this->_yMin) / $this->scale + $this->topMargin;
+ $this->Line($x1, $y1, $x2, $y2);
+ }
+
+ /**
+ * Sets x and y scaled positions
+ *
+ * @param float x The x position
+ * @param float y The y position
+ * @access public
+ * @see TCPDF::SetXY()
+ */
+ function PMA_PDF_setXyScale($x, $y)
+ {
+ $x = ($x - $this->_xMin) / $this->scale + $this->leftMargin;
+ $y = ($y - $this->_yMin) / $this->scale + $this->topMargin;
+ $this->SetXY($x, $y);
+ }
+
+ /**
+ * Sets the X scaled positions
+ *
+ * @param float x The x position
+ * @access public
+ * @see TCPDF::SetX()
+ */
+ function PMA_PDF_setXScale($x)
+ {
+ $x = ($x - $this->_xMin) / $this->scale + $this->leftMargin;
+ $this->SetX($x);
+ }
+
+ /**
+ * Sets the scaled font size
+ *
+ * @param float size The font size (in points)
+ * @access public
+ * @see TCPDF::SetFontSize()
+ */
+ function PMA_PDF_setFontSizeScale($size)
+ {
+ // Set font size in points
+ $size = $size / $this->scale;
+ $this->SetFontSize($size);
+ }
+
+ /**
+ * Sets the scaled line width
+ *
+ * @param float width The line width
+ * @access public
+ * @see TCPDF::SetLineWidth()
+ */
+ function PMA_PDF_setLineWidthScale($width)
+ {
+ $width = $width / $this->scale;
+ $this->SetLineWidth($width);
+ }
+
+ /**
+ * Displays an error message
+ *
+ * @param string error_message the error mesage
+ * @access public
+ * @see PMA_Export_Relation_Schema::dieSchema
+ */
+ function Error($error_message = '')
+ {
+ PMA_Export_Relation_Schema::dieSchema($error_message);
+ }
+
+ function Header()
+ {
+ // We only show this if we find something in the new pdf_pages table
+
+ // This function must be named "Header" to work with the TCPDF library
+ global $cfgRelation, $db, $pdf_page_number, $with_doc;
+ if ($with_doc) {
+ $test_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
+ . ' AND page_nr = \'' . $pdf_page_number . '\'';
+ $test_rs = PMA_query_as_controluser($test_query);
+ $pages = @PMA_DBI_fetch_assoc($test_rs);
+ $this->SetFont('', 'B', 14);
+ $this->Cell(0, 6, ucfirst($pages['page_descr']), 'B', 1, 'C');
+ $this->SetFont('', '');
+ $this->Ln();
+ }
+ }
+
+ function Footer()
+ {
+ // This function must be named "Footer" to work with the TCPDF library
+ global $with_doc;
+ if ($with_doc) {
+ $this->SetY(-15);
+ $this->SetFont('', '', 14);
+ $this->Cell(0, 6, __('Page number:') . ' ' . $this->PageNo() . '/{nb}', 'T', 0, 'C');
+ $this->Cell(0, 6, PMA_localisedDate(), 0, 1, 'R');
+ $this->SetY(20);
+ }
+ }
+
+ function Bookmark($txt, $level = 0, $y = 0)
+ {
+ // Add a bookmark
+ $this->Outlines[0][] = $level;
+ $this->Outlines[1][] = $txt;
+ $this->Outlines[2][] = $this->page;
+ if ($y == -1) {
+ $y = $this->GetY();
+ }
+ $this->Outlines[3][] = round($this->hPt - $y * $this->k, 2);
+ }
+
+ function _putbookmarks()
+ {
+ if (count($this->Outlines) > 0) {
+ // Save object number
+ $memo_n = $this->n;
+ // Take the number of sub elements for an outline
+ $nb_outlines = sizeof($this->Outlines[0]);
+ $first_level = array();
+ $parent = array();
+ $parent[0] = 1;
+ for ($i = 0; $i < $nb_outlines; $i++) {
+ $level = $this->Outlines[0][$i];
+ $kids = 0;
+ $last = -1;
+ $prev = -1;
+ $next = -1;
+ if ($i > 0) {
+ $cursor = $i-1;
+ // Take the previous outline in the same level
+ while ($this->Outlines[0][$cursor] > $level && $cursor > 0)
+ $cursor--;
+ if ($this->Outlines[0][$cursor] == $level) {
+ $prev = $cursor;
+ }
+ }
+ if ($i < $nb_outlines-1) {
+ $cursor = $i + 1;
+ while (isset($this->Outlines[0][$cursor]) && $this->Outlines[0][$cursor] > $level) {
+ // Take the immediate kid in level + 1
+ if ($this->Outlines[0][$cursor] == $level + 1) {
+ $kids++;
+ $last = $cursor;
+ }
+ $cursor++;
+ }
+ $cursor = $i + 1;
+ // Take the next outline in the same level
+ while ($this->Outlines[0][$cursor] > $level && ($cursor + 1 < sizeof($this->Outlines[0])))
+ $cursor++;
+ if ($this->Outlines[0][$cursor] == $level) {
+ $next = $cursor;
+ }
+ }
+ $this->_newobj();
+ $parent[$level + 1] = $this->n;
+ if ($level == 0) {
+ $first_level[] = $this->n;
+ }
+ $this->_out('<<');
+ $this->_out('/Title (' . $this->Outlines[1][$i] . ')');
+ $this->_out('/Parent ' . $parent[$level] . ' 0 R');
+ if ($prev != -1) {
+ $this->_out('/Prev ' . ($memo_n + $prev + 1) . ' 0 R');
+ }
+ if ($next != -1) {
+ $this->_out('/Next ' . ($this->n + $next - $i) . ' 0 R');
+ }
+ $this->_out('/Dest [' . (1 + (2 * $this->Outlines[2][$i])) . ' 0 R /XYZ null ' . $this->Outlines[3][$i] . ' null]');
+ if ($kids > 0) {
+ $this->_out('/First ' . ($this->n + 1) . ' 0 R');
+ $this->_out('/Last ' . ($this->n + $last - $i) . ' 0 R');
+ $this->_out('/Count -' . $kids);
+ }
+ $this->_out('>>');
+ $this->_out('endobj');
+ }
+ // First page of outlines
+ $this->_newobj();
+ $this->def_outlines = $this->n;
+ $this->_out('<<');
+ $this->_out('/Type');
+ $this->_out('/Outlines');
+ $this->_out('/First ' . $first_level[0] . ' 0 R');
+ $this->_out('/Last ' . $first_level[sizeof($first_level)-1] . ' 0 R');
+ $this->_out('/Count ' . sizeof($first_level));
+ $this->_out('>>');
+ $this->_out('endobj');
+ }
+ }
+
+ function _putresources()
+ {
+ parent::_putresources();
+ $this->_putbookmarks();
+ }
+
+ function _putcatalog()
+ {
+ parent::_putcatalog();
+ if (count($this->Outlines) > 0) {
+ $this->_out('/Outlines ' . $this->def_outlines . ' 0 R');
+ $this->_out('/PageMode /UseOutlines');
+ }
+ }
+
+ function SetWidths($w)
+ {
+ // column widths
+ $this->widths = $w;
+ }
+
+ function Row($data, $links)
+ {
+ // line height
+ $nb = 0;
+ $data_cnt = count($data);
+ for ($i = 0;$i < $data_cnt;$i++)
+ $nb = max($nb, $this->NbLines($this->widths[$i], $data[$i]));
+ $il = $this->FontSize;
+ $h = ($il + 1) * $nb;
+ // page break if necessary
+ $this->CheckPageBreak($h);
+ // draw the cells
+ $data_cnt = count($data);
+ for ($i = 0;$i < $data_cnt;$i++) {
+ $w = $this->widths[$i];
+ // save current position
+ $x = $this->GetX();
+ $y = $this->GetY();
+ // draw the border
+ $this->Rect($x, $y, $w, $h);
+ if (isset($links[$i])) {
+ $this->Link($x, $y, $w, $h, $links[$i]);
+ }
+ // print text
+ $this->MultiCell($w, $il + 1, $data[$i], 0, 'L');
+ // go to right side
+ $this->SetXY($x + $w, $y);
+ }
+ // go to line
+ $this->Ln($h);
+ }
+
+ function CheckPageBreak($h)
+ {
+ // if height h overflows, manual page break
+ if ($this->GetY() + $h > $this->PageBreakTrigger) {
+ $this->AddPage($this->CurOrientation);
+ }
+ }
+
+ function NbLines($w, $txt)
+ {
+ // compute number of lines used by a multicell of width w
+ $cw = &$this->CurrentFont['cw'];
+ if ($w == 0) {
+ $w = $this->w - $this->rMargin - $this->x;
+ }
+ $wmax = ($w-2 * $this->cMargin) * 1000 / $this->FontSize;
+ $s = str_replace("\r", '', $txt);
+ $nb = strlen($s);
+ if ($nb > 0 and $s[$nb-1] == "\n") {
+ $nb--;
+ }
+ $sep = -1;
+ $i = 0;
+ $j = 0;
+ $l = 0;
+ $nl = 1;
+ while ($i < $nb) {
+ $c = $s[$i];
+ if ($c == "\n") {
+ $i++;
+ $sep = -1;
+ $j = $i;
+ $l = 0;
+ $nl++;
+ continue;
+ }
+ if ($c == ' ') {
+ $sep = $i;
+ }
+ $l += isset($cw[ord($c)])?$cw[ord($c)]:0 ;
+ if ($l > $wmax) {
+ if ($sep == -1) {
+ if ($i == $j) {
+ $i++;
+ }
+ } else {
+ $i = $sep + 1;
+ }
+ $sep = -1;
+ $j = $i;
+ $l = 0;
+ $nl++;
+ } else {
+ $i++;
+ }
+ }
+ return $nl;
+ }
+}
+
+/**
+ * Table preferences/statistics
+ *
+ * This class preserves the table co-ordinates,fields
+ * and helps in drawing/generating the Tables in PDF document.
+ *
+ * @name Table_Stats
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ * @see PMA_PDF
+ */
+class Table_Stats
+{
+ /**
+ * Defines properties
+ */
+ private $_tableName;
+ private $_showInfo = false;
+
+ public $nb_fiels;
+ public $width = 0;
+ public $height;
+ public $fields = array();
+ public $heightCell = 6;
+ public $x, $y;
+ public $primary = array();
+
+ /**
+ * The "Table_Stats" constructor
+ *
+ * @param string table_name The table name
+ * @param integer fontSize The font size
+ * @param integer pageNumber The current page number (from the
+ * $cfg['Servers'][$i]['table_coords'] table)
+ * @param integer sameWideWidth The max. with among tables
+ * @param boolean showKeys Whether to display keys or not
+ * @param boolean showInfo Whether to display table position or not
+ * @global object The current PDF document
+ * @global array The relations settings
+ * @global string The current db name
+ * @see PMA_PDF, Table_Stats::Table_Stats_setWidth,
+ Table_Stats::Table_Stats_setHeight
+ */
+ function __construct($tableName, $fontSize, $pageNumber, &$sameWideWidth, $showKeys = false, $showInfo = false)
+ {
+ global $pdf, $cfgRelation, $db;
+
+ $this->_tableName = $tableName;
+ $sql = 'DESCRIBE ' . PMA_backquote($tableName);
+ $result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE);
+ if (!$result || !PMA_DBI_num_rows($result)) {
+ $pdf->Error(sprintf(__('The %s table doesn\'t exist!'), $tableName));
+ }
+ // load fields
+ //check to see if it will load all fields or only the foreign keys
+ if ($showKeys) {
+ $indexes = PMA_Index::getFromTable($this->_tableName, $db);
+ $all_columns = array();
+ foreach ($indexes as $index) {
+ $all_columns = array_merge($all_columns, array_flip(array_keys($index->getColumns())));
+ }
+ $this->fields = array_keys($all_columns);
+ } else {
+ while ($row = PMA_DBI_fetch_row($result)) {
+ $this->fields[] = $row[0];
+ }
+ }
+
+ $this->_showInfo = $showInfo;
+ $this->_setHeight();
+ /*
+ * setWidth must me after setHeight, because title
+ * can include table height which changes table width
+ */
+ $this->_setWidth($fontSize);
+ if ($sameWideWidth < $this->width) {
+ $sameWideWidth = $this->width;
+ }
+ $sql = 'SELECT x, y FROM '
+ . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
+ . ' AND table_name = \'' . PMA_sqlAddslashes($tableName) . '\''
+ . ' AND pdf_page_number = ' . $pageNumber;
+ $result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
+ if (!$result || !PMA_DBI_num_rows($result)) {
+ $pdf->Error(sprintf(__('Please configure the coordinates for table %s'), $tableName));
+ }
+ list($this->x, $this->y) = PMA_DBI_fetch_row($result);
+ $this->x = (double) $this->x;
+ $this->y = (double) $this->y;
+ /*
+ * displayfield
+ */
+ $this->displayfield = PMA_getDisplayField($db, $tableName);
+ /*
+ * index
+ */
+ $result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($tableName) . ';', null, PMA_DBI_QUERY_STORE);
+ if (PMA_DBI_num_rows($result) > 0) {
+ while ($row = PMA_DBI_fetch_assoc($result)) {
+ if ($row['Key_name'] == 'PRIMARY') {
+ $this->primary[] = $row['Column_name'];
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns title of the current table,
+ * title can have the dimensions of the table
+ *
+ * @access private
+ */
+ private function _getTitle()
+ {
+ return ($this->_showInfo ? sprintf('%.0f', $this->width) . 'x' . sprintf('%.0f', $this->height) : '') . ' ' . $this->_tableName;
+ }
+
+ /**
+ * Sets the width of the table
+ *
+ * @param integer fontSize The font size
+ * @global object The current PDF document
+ * @access private
+ * @see PMA_PDF
+ */
+ function _setWidth($fontSize)
+ {
+ global $pdf;
+
+ foreach ($this->fields as $field) {
+ $this->width = max($this->width, $pdf->GetStringWidth($field));
+ }
+ $this->width += $pdf->GetStringWidth(' ');
+ $pdf->SetFont($fontSize, 'B');
+ /*
+ * it is unknown what value must be added, because
+ * table title is affected by the tabe width value
+ */
+ while ($this->width < $pdf->GetStringWidth($this->_getTitle())) {
+ $this->width += 5;
+ }
+ $pdf->SetFont($fontSize, '');
+ }
+
+ /**
+ * Sets the height of the table
+ *
+ * @access private
+ */
+ private function _setHeight()
+ {
+ $this->height = (count($this->fields) + 1) * $this->heightCell;
+ }
+
+ /**
+ * Do draw the table
+ *
+ * @param integer fontSize The font size
+ * @param boolean setColor Whether to display color
+ * @global object The current PDF document
+ * @access public
+ * @see PMA_PDF
+ */
+ public function tableDraw($fontSize, $withDoc, $setColor = 0)
+ {
+ global $pdf, $withDoc;
+
+ $pdf->PMA_PDF_setXyScale($this->x, $this->y);
+ $pdf->SetFont($fontSize, 'B');
+ if ($setColor) {
+ $pdf->SetTextColor(200);
+ $pdf->SetFillColor(0, 0, 128);
+ }
+ if ($withDoc) {
+ $pdf->SetLink($pdf->PMA_links['RT'][$this->_tableName]['-'], -1);
+ } else {
+ $pdf->PMA_links['doc'][$this->_tableName]['-'] = '';
+ }
+
+ $pdf->PMA_PDF_cellScale($this->width, $this->heightCell, $this->_getTitle(), 1, 1, 'C', $setColor, $pdf->PMA_links['doc'][$this->_tableName]['-']);
+ $pdf->PMA_PDF_setXScale($this->x);
+ $pdf->SetFont($fontSize, '');
+ $pdf->SetTextColor(0);
+ $pdf->SetFillColor(255);
+
+ foreach ($this->fields as $field) {
+ if ($setColor) {
+ if (in_array($field, $this->primary)) {
+ $pdf->SetFillColor(215, 121, 123);
+ }
+ if ($field == $this->displayfield) {
+ $pdf->SetFillColor(142, 159, 224);
+ }
+ }
+ if ($withDoc) {
+ $pdf->SetLink($pdf->PMA_links['RT'][$this->_tableName][$field], -1);
+ } else {
+ $pdf->PMA_links['doc'][$this->_tableName][$field] = '';
+ }
+
+ $pdf->PMA_PDF_cellScale($this->width, $this->heightCell, ' ' . $field, 1, 1, 'L', $setColor, $pdf->PMA_links['doc'][$this->_tableName][$field]);
+ $pdf->PMA_PDF_setXScale($this->x);
+ $pdf->SetFillColor(255);
+ }
+ /*if ($pdf->PageNo() > 1) {
+ $pdf->PMA_PDF_die(__('The scale factor is too small to fit the schema on one page'));
+ } */
+ }
+}
+
+/**
+ * Relation preferences/statistics
+ *
+ * This class fetches the table master and foreign fields positions
+ * and helps in generating the Table references and then connects
+ * master table's master field to foreign table's foreign key
+ * in PDF document.
+ *
+ * @name Relation_Stats
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ * @see PMA_PDF::SetDrawColor,PMA_PDF::PMA_PDF_setLineWidthScale,PMA_PDF::PMA_PDF_lineScale
+ */
+class Relation_Stats
+{
+ /**
+ * Defines properties
+ */
+ public $xSrc, $ySrc;
+ public $srcDir;
+ public $destDir;
+ public $xDest, $yDest;
+ public $wTick = 5;
+
+ /**
+ * The "Relation_Stats" constructor
+ *
+ * @param string master_table The master table name
+ * @param string master_field The relation field in the master table
+ * @param string foreign_table The foreign table name
+ * @param string foreigh_field The relation field in the foreign table
+ * @see Relation_Stats::_getXy
+ */
+ function __construct($master_table, $master_field, $foreign_table, $foreign_field)
+ {
+ $src_pos = $this->_getXy($master_table, $master_field);
+ $dest_pos = $this->_getXy($foreign_table, $foreign_field);
+ /*
+ * [0] is x-left
+ * [1] is x-right
+ * [2] is y
+ */
+ $src_left = $src_pos[0] - $this->wTick;
+ $src_right = $src_pos[1] + $this->wTick;
+ $dest_left = $dest_pos[0] - $this->wTick;
+ $dest_right = $dest_pos[1] + $this->wTick;
+
+ $d1 = abs($src_left - $dest_left);
+ $d2 = abs($src_right - $dest_left);
+ $d3 = abs($src_left - $dest_right);
+ $d4 = abs($src_right - $dest_right);
+ $d = min($d1, $d2, $d3, $d4);
+
+ if ($d == $d1) {
+ $this->xSrc = $src_pos[0];
+ $this->srcDir = -1;
+ $this->xDest = $dest_pos[0];
+ $this->destDir = -1;
+ } elseif ($d == $d2) {
+ $this->xSrc = $src_pos[1];
+ $this->srcDir = 1;
+ $this->xDest = $dest_pos[0];
+ $this->destDir = -1;
+ } elseif ($d == $d3) {
+ $this->xSrc = $src_pos[0];
+ $this->srcDir = -1;
+ $this->xDest = $dest_pos[1];
+ $this->destDir = 1;
+ } else {
+ $this->xSrc = $src_pos[1];
+ $this->srcDir = 1;
+ $this->xDest = $dest_pos[1];
+ $this->destDir = 1;
+ }
+ $this->ySrc = $src_pos[2];
+ $this->yDest = $dest_pos[2];
+ }
+
+ /**
+ * Gets arrows coordinates
+ *
+ * @param string table The current table name
+ * @param string column The relation column name
+ * @return array Arrows coordinates
+ * @access private
+ */
+ private function _getXy($table, $column)
+ {
+ $pos = array_search($column, $table->fields);
+ // x_left, x_right, y
+ return array($table->x, $table->x + + $table->width, $table->y + ($pos + 1.5) * $table->heightCell);
+ }
+
+ /**
+ * draws relation links and arrows
+ * shows foreign key relations
+ *
+ * @param boolean changeColor Whether to use one color per relation or not
+ * @param integer i The id of the link to draw
+ * @global object The current PDF document
+ * @access public
+ * @see PMA_PDF
+ */
+ public function relationDraw($changeColor, $i)
+ {
+ global $pdf;
+
+ if ($changeColor) {
+ $d = $i % 6;
+ $j = ($i - $d) / 6;
+ $j = $j % 4;
+ $j++;
+ $case = array(
+ array(1, 0, 0),
+ array(0, 1, 0),
+ array(0, 0, 1),
+ array(1, 1, 0),
+ array(1, 0, 1),
+ array(0, 1, 1)
+ );
+ list ($a, $b, $c) = $case[$d];
+ $e = (1 - ($j - 1) / 6);
+ $pdf->SetDrawColor($a * 255 * $e, $b * 255 * $e, $c * 255 * $e);
+ } else {
+ $pdf->SetDrawColor(0);
+ }
+ $pdf->PMA_PDF_setLineWidthScale(0.2);
+ $pdf->PMA_PDF_lineScale($this->xSrc, $this->ySrc, $this->xSrc + $this->srcDir * $this->wTick, $this->ySrc);
+ $pdf->PMA_PDF_lineScale($this->xDest + $this->destDir * $this->wTick, $this->yDest, $this->xDest, $this->yDest);
+ $pdf->PMA_PDF_setLineWidthScale(0.1);
+ $pdf->PMA_PDF_lineScale($this->xSrc + $this->srcDir * $this->wTick, $this->ySrc, $this->xDest + $this->destDir * $this->wTick, $this->yDest);
+ /*
+ * Draws arrows ->
+ */
+ $root2 = 2 * sqrt(2);
+ $pdf->PMA_PDF_lineScale($this->xSrc + $this->srcDir * $this->wTick * 0.75, $this->ySrc, $this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick, $this->ySrc + $this->wTick / $root2);
+ $pdf->PMA_PDF_lineScale($this->xSrc + $this->srcDir * $this->wTick * 0.75, $this->ySrc, $this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick, $this->ySrc - $this->wTick / $root2);
+
+ $pdf->PMA_PDF_lineScale($this->xDest + $this->destDir * $this->wTick / 2, $this->yDest, $this->xDest + $this->destDir * (0.5 + 1 / $root2) * $this->wTick, $this->yDest + $this->wTick / $root2);
+ $pdf->PMA_PDF_lineScale($this->xDest + $this->destDir * $this->wTick / 2, $this->yDest, $this->xDest + $this->destDir * (0.5 + 1 / $root2) * $this->wTick, $this->yDest - $this->wTick / $root2);
+ $pdf->SetDrawColor(0);
+ }
+}
+
+/**
+ * Pdf Relation Schema Class
+ *
+ * Purpose of this class is to generate the PDF Document. PDF is widely
+ * used format for documenting text,fonts,images and 3d vector graphics.
+ *
+ * This class inherits Export_Relation_Schema class has common functionality added
+ * to this class
+ *
+ * @name Pdf_Relation_Schema
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ */
+class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
+{
+ /**
+ * Defines properties
+ */
+ private $_tables = array();
+ private $_relations = array();
+ private $_ff = PMA_PDF_FONT;
+ private $_xMax = 0;
+ private $_yMax = 0;
+ private $scale;
+ private $_xMin = 100000;
+ private $_yMin = 100000;
+ private $topMargin = 10;
+ private $bottomMargin = 10;
+ private $leftMargin = 10;
+ private $rightMargin = 10;
+ private $_tablewidth;
+
+ /**
+ * The "PMA_Pdf_Relation_Schema" constructor
+ *
+ * @global object The current PDF Schema document
+ * @global string The current db name
+ * @global array The relations settings
+ * @access private
+ * @see PMA_PDF
+ */
+ function __construct()
+ {
+ global $pdf,$db,$cfgRelation;
+
+ $this->setPageNumber($_POST['pdf_page_number']);
+ $this->setShowGrid(isset($_POST['show_grid']));
+ $this->setShowColor(isset($_POST['show_color']));
+ $this->setShowKeys(isset($_POST['show_keys']));
+ $this->setTableDimension(isset($_POST['show_table_dimension']));
+ $this->setAllTableSameWidth(isset($_POST['all_table_same_wide']));
+ $this->setWithDataDictionary($_POST['with_doc']);
+ $this->setOrientation($_POST['orientation']);
+ $this->setPaper($_POST['paper']);
+ $this->setExportType($_POST['export_type']);
+
+ // Initializes a new document
+ $pdf = new PMA_PDF('L', 'mm', $this->paper);
+ $pdf->SetTitle(sprintf(__('Schema of the %s database - Page %s'), $GLOBALS['db'], $this->pageNumber));
+ $pdf->setCMargin(0);
+ $pdf->Open();
+ $pdf->SetAuthor('phpMyAdmin ' . PMA_VERSION);
+ $pdf->AliasNbPages();
+ $pdf->AddFont('DejaVuSans', '', 'dejavusans.php');
+ $pdf->AddFont('DejaVuSans', 'B', 'dejavusansb.php');
+ $pdf->AddFont('DejaVuSerif', '', 'dejavuserif.php');
+ $pdf->AddFont('DejaVuSerif', 'B', 'dejavuserifb.php');
+ $pdf->SetFont($this->_ff, '', 14);
+ $pdf->SetAutoPageBreak('auto');
+ $alltables = $this->getAllTables($db,$this->pageNumber);
+
+ if ($this->withDoc) {
+ $pdf->SetAutoPageBreak('auto', 15);
+ $pdf->setCMargin(1);
+ $this->dataDictionaryDoc($alltables);
+ $pdf->SetAutoPageBreak('auto');
+ $pdf->setCMargin(0);
+ }
+
+ $pdf->Addpage();
+
+ if ($this->withDoc) {
+ $pdf->SetLink($pdf->PMA_links['RT']['-'], -1);
+ $pdf->Bookmark(__('Relational schema'));
+ $pdf->SetAlias('{00}', $pdf->PageNo()) ;
+ $this->topMargin = 28;
+ $this->bottomMargin = 28;
+ }
+
+ /* snip */
+ foreach ($alltables as $table) {
+ if (!isset($this->tables[$table])) {
+ $this->tables[$table] = new Table_Stats($table, $this->_ff, $this->pageNumber, $this->_tablewidth, $this->showKeys, $this->tableDimension);
+ }
+ if ($this->sameWide) {
+ $this->tables[$table]->width = $this->_tablewidth;
+ }
+ $this->_setMinMax($this->tables[$table]);
+ }
+
+ // Defines the scale factor
+ $this->scale = ceil(
+ max(
+ ($this->_xMax - $this->_xMin) / ($pdf->getFh() - $this->rightMargin - $this->leftMargin),
+ ($this->_yMax - $this->_yMin) / ($pdf->getFw() - $this->topMargin - $this->bottomMargin))
+ * 100) / 100;
+
+ $pdf->PMA_PDF_setScale($this->scale, $this->_xMin, $this->_yMin, $this->leftMargin, $this->topMargin);
+ // Builds and save the PDF document
+ $pdf->PMA_PDF_setLineWidthScale(0.1);
+
+ if ($this->showGrid) {
+ $pdf->SetFontSize(10);
+ $this->_strokeGrid();
+ }
+ $pdf->PMA_PDF_setFontSizeScale(14);
+ // previous logic was checking master tables and foreign tables
+ // but I think that looping on every table of the pdf page as a master
+ // and finding its foreigns is OK (then we can support innodb)
+ $seen_a_relation = false;
+ foreach ($alltables as $one_table) {
+ $exist_rel = PMA_getForeigners($db, $one_table, '', 'both');
+ if ($exist_rel) {
+ $seen_a_relation = true;
+ foreach ($exist_rel as $master_field => $rel) {
+ // put the foreign table on the schema only if selected
+ // by the user
+ // (do not use array_search() because we would have to
+ // to do a === FALSE and this is not PHP3 compatible)
+ if (in_array($rel['foreign_table'], $alltables)) {
+ $this->_addRelation($one_table, $master_field, $rel['foreign_table'], $rel['foreign_field'], $this->tableDimension);
+ }
+ } // end while
+ } // end if
+ } // end while
+
+ if ($seen_a_relation) {
+ $this->_drawRelations($this->showColor);
+ }
+ $this->_drawTables($this->showColor);
+ $this->_showOutput($this->pageNumber);
+ exit();
+ }
+
+ /**
+ * Sets X and Y minimum and maximum for a table cell
+ *
+ * @param string table The table name of which sets XY co-ordinates
+ * @access private
+ */
+ private function _setMinMax($table)
+ {
+ $this->_xMax = max($this->_xMax, $table->x + $table->width);
+ $this->_yMax = max($this->_yMax, $table->y + $table->height);
+ $this->_xMin = min($this->_xMin, $table->x);
+ $this->_yMin = min($this->_yMin, $table->y);
+ }
+
+ /**
+ * Defines relation objects
+ *
+ * @param string master_table The master table name
+ * @param string master_field The relation field in the master table
+ * @param string foreign_table The foreign table name
+ * @param string foreign_field The relation field in the foreign table
+ * @param boolean show_info Whether to display table position or not
+ * @access private
+ * @see _setMinMax
+ */
+ private function _addRelation($masterTable, $masterField, $foreignTable, $foreignField, $showInfo)
+ {
+ if (!isset($this->tables[$masterTable])) {
+ $this->tables[$masterTable] = new Table_Stats($masterTable, $this->_ff, $this->pageNumber, $this->_tablewidth, false, $showInfo);
+ $this->_setMinMax($this->tables[$masterTable]);
+ }
+ if (!isset($this->tables[$foreignTable])) {
+ $this->tables[$foreignTable] = new Table_Stats($foreignTable, $this->_ff, $this->pageNumber, $this->_tablewidth, false, $showInfo);
+ $this->_setMinMax($this->tables[$foreignTable]);
+ }
+ $this->relations[] = new Relation_Stats($this->tables[$masterTable], $masterField, $this->tables[$foreignTable], $foreignField);
+ }
+
+ /**
+ * Draws the grid
+ *
+ * @global object the current PMA_PDF instance
+ * @access private
+ * @see PMA_PDF
+ */
+ private function _strokeGrid()
+ {
+ global $pdf;
+
+ $pdf->SetMargins(0, 0);
+ $pdf->SetDrawColor(200, 200, 200);
+ // Draws horizontal lines
+ for ($l = 0; $l < 21; $l++) {
+ $pdf->line(0, $l * 10, $pdf->getFh(), $l * 10);
+ // Avoid duplicates
+ if ($l > 0) {
+ $pdf->SetXY(0, $l * 10);
+ $label = (string) sprintf('%.0f', ($l * 10 - $this->topMargin) * $this->scale + $this->_yMin);
+ $pdf->Cell(5, 5, ' ' . $label);
+ } // end if
+ } // end for
+ // Draws vertical lines
+ for ($j = 0; $j < 30 ;$j++) {
+ $pdf->line($j * 10, 0, $j * 10, $pdf->getFw());
+ $pdf->SetXY($j * 10, 0);
+ $label = (string) sprintf('%.0f', ($j * 10 - $this->leftMargin) * $this->scale + $this->_xMin);
+ $pdf->Cell(5, 7, $label);
+ }
+ }
+
+ /**
+ * Draws relation arrows
+ *
+ * @param boolean changeColor Whether to use one color per relation or not
+ * @access private
+ * @see Relation_Stats::relationdraw()
+ */
+ private function _drawRelations($changeColor)
+ {
+ $i = 0;
+ foreach ($this->relations as $relation) {
+ $relation->relationDraw($changeColor, $i);
+ $i++;
+ }
+ }
+
+ /**
+ * Draws tables
+ *
+ * @param boolean changeColor Whether to display table position or not
+ * @access private
+ * @see Table_Stats::tableDraw()
+ */
+ private function _drawTables($changeColor = 0)
+ {
+ foreach ($this->tables as $table) {
+ $table->tableDraw($this->_ff, $this->withDoc, $changeColor);
+ }
+ }
+
+ /**
+ * Ouputs the PDF document to a file
+ * or sends the output to browser
+ *
+ * @global object The current PDF document
+ * @global string The current database name
+ * @global integer The current page number (from the
+ * $cfg['Servers'][$i]['table_coords'] table)
+ * @access private
+ * @see PMA_PDF
+ */
+ private function _showOutput($pageNumber)
+ {
+ global $pdf, $db, $cfgRelation;
+
+ $pdf->SetFontSize(14);
+ $pdf->SetLineWidth(0.2);
+ $pdf->SetDisplayMode('fullpage');
+ // Get the name of this pdfpage to use as filename (Mike Beck)
+ $_name_sql = 'SELECT page_descr FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
+ . ' WHERE page_nr = ' . $pageNumber;
+ $_name_rs = PMA_query_as_controluser($_name_sql);
+ if ($_name_rs) {
+ $_name_row = PMA_DBI_fetch_row($_name_rs);
+ $filename = $_name_row[0] . '.pdf';
+ }
+ if (empty($filename)) {
+ $filename = $pageNumber . '.pdf';
+ }
+ // instead of $pdf->Output():
+ $pdfData = $pdf->getPDFData();
+ header('Content-Type: application/pdf');
+ header('Content-Length: '.strlen($pdfData).'');
+ header('Content-disposition: attachment; filename="'.$filename.'"');
+ echo $pdfData;
+ }
+
+ public function dataDictionaryDoc($alltables)
+ {
+ global $db, $pdf, $orientation, $paper;
+ // TOC
+ $pdf->addpage($GLOBALS['orientation']);
+ $pdf->Cell(0, 9, __('Table of contents'), 1, 0, 'C');
+ $pdf->Ln(15);
+ $i = 1;
+ foreach ($alltables as $table) {
+ $pdf->PMA_links['doc'][$table]['-'] = $pdf->AddLink();
+ $pdf->SetX(10);
+ // $pdf->Ln(1);
+ $pdf->Cell(0, 6, __('Page number:') . ' {' . sprintf("%02d", $i + 1) . '}', 0, 0, 'R', 0, $pdf->PMA_links['doc'][$table]['-']);
+ $pdf->SetX(10);
+ $pdf->Cell(0, 6, $i . ' ' . $table, 0, 1, 'L', 0, $pdf->PMA_links['doc'][$table]['-']);
+ // $pdf->Ln(1);
+ $result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';');
+ while ($row = PMA_DBI_fetch_assoc($result)) {
+ $pdf->SetX(20);
+ $field_name = $row['Field'];
+ $pdf->PMA_links['doc'][$table][$field_name] = $pdf->AddLink();
+ // $pdf->Cell(0, 6, $field_name,0,1,'L',0, $pdf->PMA_links['doc'][$table][$field_name]);
+ }
+ $lasttable = $table;
+ $i++;
+ }
+ $pdf->PMA_links['RT']['-'] = $pdf->AddLink();
+ $pdf->SetX(10);
+ $pdf->Cell(0, 6, __('Page number:') . ' {' . sprintf("%02d", $i + 1) . '}', 0, 0, 'R', 0, $pdf->PMA_links['doc'][$lasttable]['-']);
+ $pdf->SetX(10);
+ $pdf->Cell(0, 6, $i + 1 . ' ' . __('Relational schema'), 0, 1, 'L', 0, $pdf->PMA_links['RT']['-']);
+ $z = 0;
+ foreach ($alltables as $table) {
+ $z++;
+ $pdf->addpage($GLOBALS['orientation']);
+ $pdf->Bookmark($table);
+ $pdf->SetAlias('{' . sprintf("%02d", $z) . '}', $pdf->PageNo()) ;
+ $pdf->PMA_links['RT'][$table]['-'] = $pdf->AddLink();
+ $pdf->SetLink($pdf->PMA_links['doc'][$table]['-'], -1);
+ $pdf->SetFont('', 'B', 18);
+ $pdf->Cell(0, 8, $z . ' ' . $table, 1, 1, 'C', 0, $pdf->PMA_links['RT'][$table]['-']);
+ $pdf->SetFont('', '', 8);
+ $pdf->ln();
+
+ $cfgRelation = PMA_getRelationsParam();
+ $comments = PMA_getComments($db, $table);
+ if ($cfgRelation['mimework']) {
+ $mime_map = PMA_getMIME($db, $table, true);
+ }
+
+ /**
+ * Gets table informations
+ */
+ $showtable = PMA_Table::sGetStatusInfo($db, $table);
+ $num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
+ $show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
+ $create_time = (isset($showtable['Create_time']) ? PMA_localisedDate(strtotime($showtable['Create_time'])) : '');
+ $update_time = (isset($showtable['Update_time']) ? PMA_localisedDate(strtotime($showtable['Update_time'])) : '');
+ $check_time = (isset($showtable['Check_time']) ? PMA_localisedDate(strtotime($showtable['Check_time'])) : '');
+
+ /**
+ * Gets table keys and retains them
+ */
+ $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';');
+ $primary = '';
+ $indexes = array();
+ $lastIndex = '';
+ $indexes_info = array();
+ $indexes_data = array();
+ $pk_array = array(); // will be use to emphasis prim. keys in the table
+ // view
+ while ($row = PMA_DBI_fetch_assoc($result)) {
+ // Backups the list of primary keys
+ if ($row['Key_name'] == 'PRIMARY') {
+ $primary .= $row['Column_name'] . ', ';
+ $pk_array[$row['Column_name']] = 1;
+ }
+ // Retains keys informations
+ if ($row['Key_name'] != $lastIndex) {
+ $indexes[] = $row['Key_name'];
+ $lastIndex = $row['Key_name'];
+ }
+ $indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index'];
+ $indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique'];
+ if (isset($row['Cardinality'])) {
+ $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality'];
+ }
+ // I don't know what does following column mean....
+ // $indexes_info[$row['Key_name']]['Packed'] = $row['Packed'];
+ $indexes_info[$row['Key_name']]['Comment'] = $row['Comment'];
+
+ $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name'];
+ if (isset($row['Sub_part'])) {
+ $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part'];
+ }
+ } // end while
+ if ($result) {
+ PMA_DBI_free_result($result);
+ }
+
+ /**
+ * Gets fields properties
+ */
+ $result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE);
+ $fields_cnt = PMA_DBI_num_rows($result);
+ // Check if we can use Relations (Mike Beck)
+ if (!empty($cfgRelation['relation'])) {
+ // Find which tables are related with the current one and write it in
+ // an array
+ $res_rel = PMA_getForeigners($db, $table);
+
+ if (count($res_rel) > 0) {
+ $have_rel = true;
+ } else {
+ $have_rel = false;
+ }
+ } else {
+ $have_rel = false;
+ } // end if
+
+ /**
+ * Displays the comments of the table if MySQL >= 3.23
+ */
+
+ $break = false;
+ if (!empty($show_comment)) {
+ $pdf->Cell(0, 3, __('Table comments') . ' : ' . $show_comment, 0, 1);
+ $break = true;
+ }
+
+ if (!empty($create_time)) {
+ $pdf->Cell(0, 3, __('Creation') . ': ' . $create_time, 0, 1);
+ $break = true;
+ }
+
+ if (!empty($update_time)) {
+ $pdf->Cell(0, 3, __('Last update') . ': ' . $update_time, 0, 1);
+ $break = true;
+ }
+
+ if (!empty($check_time)) {
+ $pdf->Cell(0, 3, __('Last check') . ': ' . $check_time, 0, 1);
+ $break = true;
+ }
+
+ if ($break == true) {
+ $pdf->Cell(0, 3, '', 0, 1);
+ $pdf->Ln();
+ }
+
+ $pdf->SetFont('', 'B');
+ if (isset($orientation) && $orientation == 'L') {
+ $pdf->Cell(25, 8, ucfirst(__('Column')), 1, 0, 'C');
+ $pdf->Cell(20, 8, ucfirst(__('Type')), 1, 0, 'C');
+ $pdf->Cell(20, 8, ucfirst(__('Attributes')), 1, 0, 'C');
+ $pdf->Cell(10, 8, ucfirst(__('Null')), 1, 0, 'C');
+ $pdf->Cell(20, 8, ucfirst(__('Default')), 1, 0, 'C');
+ $pdf->Cell(25, 8, ucfirst(__('Extra')), 1, 0, 'C');
+ $pdf->Cell(45, 8, ucfirst(__('Links to')), 1, 0, 'C');
+
+ if ($paper == 'A4') {
+ $comments_width = 67;
+ } else {
+ // this is really intended for 'letter'
+ /**
+ * @todo find optimal width for all formats
+ */
+ $comments_width = 50;
+ }
+ $pdf->Cell($comments_width, 8, ucfirst(__('Comments')), 1, 0, 'C');
+ $pdf->Cell(45, 8, 'MIME', 1, 1, 'C');
+ $pdf->SetWidths(array(25, 20, 20, 10, 20, 25, 45, $comments_width, 45));
+ } else {
+ $pdf->Cell(20, 8, ucfirst(__('Column')), 1, 0, 'C');
+ $pdf->Cell(20, 8, ucfirst(__('Type')), 1, 0, 'C');
+ $pdf->Cell(20, 8, ucfirst(__('Attributes')), 1, 0, 'C');
+ $pdf->Cell(10, 8, ucfirst(__('Null')), 1, 0, 'C');
+ $pdf->Cell(15, 8, ucfirst(__('Default')), 1, 0, 'C');
+ $pdf->Cell(15, 8, ucfirst(__('Extra')), 1, 0, 'C');
+ $pdf->Cell(30, 8, ucfirst(__('Links to')), 1, 0, 'C');
+ $pdf->Cell(30, 8, ucfirst(__('Comments')), 1, 0, 'C');
+ $pdf->Cell(30, 8, 'MIME', 1, 1, 'C');
+ $pdf->SetWidths(array(20, 20, 20, 10, 15, 15, 30, 30, 30));
+ }
+ $pdf->SetFont('', '');
+
+ while ($row = PMA_DBI_fetch_assoc($result)) {
+ $type = $row['Type'];
+ // reformat mysql query output
+ // set or enum types: slashes single quotes inside options
+ if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) {
+ $tmp[2] = substr(preg_replace("@([^,])''@", "\\1\\'", ',' . $tmp[2]), 1);
+ $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
+ $type_nowrap = '';
+
+ $binary = 0;
+ $unsigned = 0;
+ $zerofill = 0;
+ } else {
+ $type_nowrap = ' nowrap="nowrap"';
+ $type = preg_replace('@BINARY@i', '', $type);
+ $type = preg_replace('@ZEROFILL@i', '', $type);
+ $type = preg_replace('@UNSIGNED@i', '', $type);
+ if (empty($type)) {
+ $type = ' ';
+ }
+
+ $binary = stristr($row['Type'], 'BINARY');
+ $unsigned = stristr($row['Type'], 'UNSIGNED');
+ $zerofill = stristr($row['Type'], 'ZEROFILL');
+ }
+ $attribute = ' ';
+ if ($binary) {
+ $attribute = 'BINARY';
+ }
+ if ($unsigned) {
+ $attribute = 'UNSIGNED';
+ }
+ if ($zerofill) {
+ $attribute = 'UNSIGNED ZEROFILL';
+ }
+ if (!isset($row['Default'])) {
+ if ($row['Null'] != '' && $row['Null'] != 'NO') {
+ $row['Default'] = 'NULL';
+ }
+ }
+ $field_name = $row['Field'];
+ // $pdf->Ln();
+ $pdf->PMA_links['RT'][$table][$field_name] = $pdf->AddLink();
+ $pdf->Bookmark($field_name, 1, -1);
+ $pdf->SetLink($pdf->PMA_links['doc'][$table][$field_name], -1);
+ $pdf_row = array($field_name,
+ $type,
+ $attribute,
+ ($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes'),
+ ((isset($row['Default'])) ? $row['Default'] : ''),
+ $row['Extra'],
+ ((isset($res_rel[$field_name])) ? $res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field'] : ''),
+ ((isset($comments[$field_name])) ? $comments[$field_name] : ''),
+ ((isset($mime_map) && isset($mime_map[$field_name])) ? str_replace('_', '/', $mime_map[$field_name]['mimetype']) : '')
+ );
+ $links[0] = $pdf->PMA_links['RT'][$table][$field_name];
+ if (isset($res_rel[$field_name]['foreign_table']) AND
+ isset($res_rel[$field_name]['foreign_field']) AND
+ isset($pdf->PMA_links['doc'][$res_rel[$field_name]['foreign_table']][$res_rel[$field_name]['foreign_field']])
+ )
+ {
+ $links[6] = $pdf->PMA_links['doc'][$res_rel[$field_name]['foreign_table']][$res_rel[$field_name]['foreign_field']];
+ } else {
+ unset($links[6]);
+ }
+ $pdf->Row($pdf_row, $links);
+ } // end while
+ $pdf->SetFont('', '', 14);
+ PMA_DBI_free_result($result);
+ } //end each
+ }
+}
+?>
\ No newline at end of file
diff --git a/libraries/schema/Svg_Relation_Schema.class.php b/libraries/schema/Svg_Relation_Schema.class.php
new file mode 100644
index 0000000..a0bba96
--- /dev/null
+++ b/libraries/schema/Svg_Relation_Schema.class.php
@@ -0,0 +1,854 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ *
+ * @version $Id$
+ * @package phpMyAdmin
+ */
+
+include_once("Export_Relation_Schema.class.php");
+
+/**
+ * This Class inherits the XMLwriter class and
+ * helps in developing structure of SVG Schema Export
+ *
+ * @name PMA_SVG
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ * @access public
+ * @see http://php.net/manual/en/book.xmlwriter.php
+ */
+
+class PMA_SVG extends XMLWriter
+{
+ public $title;
+ public $author;
+ public $font;
+ public $fontSize;
+
+ /**
+ * The "PMA_SVG" constructor
+ *
+ * Upon instantiation This starts writing the Svg XML document
+ *
+ * @return void
+ * @see XMLWriter::openMemory(),XMLWriter::setIndent(),XMLWriter::startDocument()
+ */
+ function __construct()
+ {
+ $this->openMemory();
+ /*
+ * Set indenting using three spaces,
+ * so output is formatted
+ */
+
+ $this->setIndent(TRUE);
+ $this->setIndentString(' ');
+ /*
+ * Create the XML document
+ */
+
+ $this->startDocument('1.0','UTF-8');
+ $this->startDtd('svg','-//W3C//DTD SVG 1.1//EN','http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
+ $this->endDtd();
+ }
+
+ /**
+ * Set document title
+ *
+ * @param string value sets the title text
+ * @return void
+ * @access public
+ */
+ function setTitle($value)
+ {
+ $this->title = $value;
+ }
+
+ /**
+ * Set document author
+ *
+ * @param string value sets the author
+ * @return void
+ * @access public
+ */
+ function setAuthor($value)
+ {
+ $this->author = $value;
+ }
+
+ /**
+ * Set document font
+ *
+ * @param string value sets the font e.g Arial, Sans-serif etc
+ * @return void
+ * @access public
+ */
+ function setFont($value)
+ {
+ $this->font = $value;
+ }
+
+ /**
+ * Get document font
+ *
+ * @return string returns the font name
+ * @access public
+ */
+ function getFont()
+ {
+ return $this->font;
+ }
+
+ /**
+ * Set document font size
+ *
+ * @param string value sets the font size in pixels
+ * @return void
+ * @access public
+ */
+ function setFontSize($value)
+ {
+ $this->fontSize = $value;
+ }
+
+ /**
+ * Get document font size
+ *
+ * @return string returns the font size
+ * @access public
+ */
+ function getFontSize()
+ {
+ return $this->fontSize;
+ }
+
+ /**
+ * Starts Svg Document
+ *
+ * svg document starts by first initializing svg tag
+ * which contains all the attributes and namespace that needed
+ * to define the svg document
+ *
+ * @param integer width total width of the Svg document
+ * @param integer height total height of the Svg document
+ * @return void
+ * @access public
+ * @see XMLWriter::startElement(),XMLWriter::writeAttribute()
+ */
+ function startSvgDoc($width,$height)
+ {
+ $this->startElement('svg');
+ $this->writeAttribute('width', $width);
+ $this->writeAttribute('height', $height);
+ $this->writeAttribute('xmlns', 'http://www.w3.org/2000/svg');
+ $this->writeAttribute('version', '1.1');
+ }
+
+ /**
+ * Ends Svg Document
+ *
+ * @return void
+ * @access public
+ * @see XMLWriter::endElement(),XMLWriter::endDocument()
+ */
+ function endSvgDoc()
+ {
+ $this->endElement();
+ $this->endDocument();
+ }
+
+ /**
+ * output Svg Document
+ *
+ * svg document prompted to the user for download
+ * Svg document saved in .svg extension and can be
+ * easily changeable by using any svg IDE
+ *
+ * @return void
+ * @access public
+ * @see XMLWriter::startElement(),XMLWriter::writeAttribute()
+ */
+ function showOutput($fileName)
+ {
+ //ob_get_clean();
+ header('Content-type: image/svg+xml');
+ header('Content-Disposition: attachment; filename="'.$fileName.'.svg"');
+ $output = $this->flush();
+ print $output;
+ }
+
+ /**
+ * Draws Svg elements
+ *
+ * SVG has some predefined shape elements like rectangle & text
+ * and other elements who have x,y co-ordinates are drawn.
+ * specify their width and height and can give styles too.
+ *
+ * @param string name Svg element name
+ * @param integer x The x attribute defines the left position of the element
+ (e.g. x="0" places the element 0 pixels from the left of
+ the browser window)
+ * @param integer y The y attribute defines the top position of the element
+ (e.g. y="0" places the element 0 pixels from the top of
+ the browser window)
+ * @param integer width The width attribute defines the width the element
+ * @param integer height The height attribute defines the height the element
+ * @param string text The text attribute defines the text the element
+ * @param string styles The style attribute defines the style the element
+ styles can be defined like CSS styles
+ * @return void
+ * @access public
+ * @see XMLWriter::startElement(),XMLWriter::writeAttribute(),XMLWriter::text(),XMLWriter::endElement()
+ */
+ function printElement($name,$x,$y,$width = '',$height = '',$text = '',$styles = '')
+ {
+ $this->startElement($name);
+ $this->writeAttribute('width',$width);
+ $this->writeAttribute('height',$height);
+ $this->writeAttribute('x', $x);
+ $this->writeAttribute('y', $y);
+ $this->writeAttribute('style', $styles);
+ if(isset($text)){
+ $this->writeAttribute('font-family', $this->font);
+ $this->writeAttribute('font-size', $this->fontSize);
+ $this->text($text);
+ }
+ $this->endElement();
+ }
+
+ /**
+ * Draws Svg Line element
+ *
+ * Svg line element is drawn for connecting the tables.
+ * arrows are also drawn by specify its start and ending
+ * co-ordinates
+ *
+ * @param string name Svg element name i.e line
+ * @param integer x1 The x1 attribute defines the start of the line on the x-axis
+ * @param integer y1 The y1 attribute defines the start of the line on the y-axis
+ * @param integer x2 The x2 attribute defines the end of the line on the x-axis
+ * @param integer y2 The y2 attribute defines the end of the line on the y-axis
+ * @param string styles The style attribute defines the style the element
+ styles can be defined like CSS styles
+ * @return void
+ * @access public
+ * @see XMLWriter::startElement(),XMLWriter::writeAttribute(),XMLWriter::endElement()
+ */
+ function printElementLine($name,$x1,$y1,$x2,$y2,$styles)
+ {
+ $this->startElement($name);
+ $this->writeAttribute('x1',$x1);
+ $this->writeAttribute('y1',$y1);
+ $this->writeAttribute('x2', $x2);
+ $this->writeAttribute('y2', $y2);
+ $this->writeAttribute('style', $styles);
+ $this->endElement();
+ }
+
+ /**
+ * get width of string/text
+ *
+ * Svg text element width is calcualted depending on font name
+ * and font size. It is very important to know the width of text
+ * because rectangle is drawn around it.
+ *
+ * This is a bit hardcore method. I didn't found any other than this.
+ *
+ * @param string text string that width will be calculated
+ * @param integer font name of the font like Arial,sans-serif etc
+ * @param integer fontSize size of font
+ * @return integer width of the text
+ * @access public
+ */
+ function getStringWidth($text,$font,$fontSize)
+ {
+ /*
+ * Start by counting the width, giving each character a modifying value
+ */
+ $count = 0;
+ $count = $count + ((strlen($text) - strlen(str_replace(array("i","j","l"),"",$text)))*0.23);//ijl
+ $count = $count + ((strlen($text) - strlen(str_replace(array("f"),"",$text)))*0.27);//f
+ $count = $count + ((strlen($text) - strlen(str_replace(array("t","I"),"",$text)))*0.28);//tI
+ $count = $count + ((strlen($text) - strlen(str_replace(array("r"),"",$text)))*0.34);//r
+ $count = $count + ((strlen($text) - strlen(str_replace(array("1"),"",$text)))*0.49);//1
+ $count = $count + ((strlen($text) - strlen(str_replace(array("c","k","s","v","x","y","z","J"),"",$text)))*0.5);//cksvxyzJ
+ $count = $count + ((strlen($text) - strlen(str_replace(array("a","b","d","e","g","h","n","o","p","q","u","L","0","2","3","4","5","6","7","8","9"),"",$text)))*0.56);//abdeghnopquL023456789
+ $count = $count + ((strlen($text) - strlen(str_replace(array("F","T","Z"),"",$text)))*0.61);//FTZ
+ $count = $count + ((strlen($text) - strlen(str_replace(array("A","B","E","K","P","S","V","X","Y"),"",$text)))*0.67);//ABEKPSVXY
+ $count = $count + ((strlen($text) - strlen(str_replace(array("w","C","D","H","N","R","U"),"",$text)))*0.73);//wCDHNRU
+ $count = $count + ((strlen($text) - strlen(str_replace(array("G","O","Q"),"",$text)))*0.78);//GOQ
+ $count = $count + ((strlen($text) - strlen(str_replace(array("m","M"),"",$text)))*0.84);//mM
+ $count = $count + ((strlen($text) - strlen(str_replace("W","",$text)))*.95);//W
+ $count = $count + ((strlen($text) - strlen(str_replace(" ","",$text)))*.28);//" "
+ $text = str_replace(" ","",$text);//remove the " "'s
+ $count = $count + (strlen(preg_replace("/[a-z0-9]/i","",$text))*0.3); //all other chrs
+
+ $modifier = 1;
+ $font = strtolower($font);
+ switch($font){
+ /*
+ * no modifier for arial and sans-serif
+ */
+ case 'arial':
+ case 'sans-serif':
+ break;
+ /*
+ * .92 modifer for time, serif, brushscriptstd, and californian fb
+ */
+ case 'times':
+ case 'serif':
+ case 'brushscriptstd':
+ case 'californian fb':
+ $modifier = .92;
+ break;
+ /*
+ * 1.23 modifier for broadway
+ */
+ case 'broadway':
+ $modifier = 1.23;
+ break;
+ }
+ $textWidth = $count*$fontSize;
+ return ceil($textWidth*$modifier);
+ }
+}
+
+/**
+ * Table preferences/statistics
+ *
+ * This class preserves the table co-ordinates,fields
+ * and helps in drawing/generating the Tables in SVG XML document.
+ *
+ * @name Table_Stats
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ * @see PMA_SVG
+ */
+class Table_Stats
+{
+ /**
+ * Defines properties
+ */
+
+ private $_tableName;
+ private $_showInfo = false;
+
+ public $width = 0;
+ public $height;
+ public $fields = array();
+ public $heightCell = 0;
+ public $currentCell = 0;
+ public $x, $y;
+ public $primary = array();
+
+ /**
+ * The "Table_Stats" constructor
+ *
+ * @param string table_name The table name
+ * @param integer ff The font size
+ * @param integer samewidth The max. with among tables
+ * @param boolean show_keys Whether to display keys or not
+ * @param boolean show_info Whether to display table position or not
+ * @global object The current SVG image document
+ * @global integer The current page number (from the
+ * $cfg['Servers'][$i]['table_coords'] table)
+ * @global array The relations settings
+ * @global string The current db name
+ * @access private
+ * @see PMA_SVG, Table_Stats::Table_Stats_setWidth,
+ Table_Stats::Table_Stats_setHeight
+ */
+ function __construct($tableName, $font, $fontSize, $pageNumber, &$same_wide_width, $showKeys = false, $showInfo = false)
+ {
+ global $svg, $cfgRelation, $db;
+
+ $this->_tableName = $tableName;
+ $sql = 'DESCRIBE ' . PMA_backquote($tableName);
+ $result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE);
+ if (!$result || !PMA_DBI_num_rows($result)) {
+ $svg->dieSchema($pageNumber,"SVG",sprintf(__('The %s table doesn\'t exist!'), $tableName));
+ }
+
+ /*
+ * load fields
+ * check to see if it will load all fields or only the foreign keys
+ */
+
+ if ($showKeys) {
+ $indexes = PMA_Index::getFromTable($this->_tableName, $db);
+ $all_columns = array();
+ foreach ($indexes as $index) {
+ $all_columns = array_merge($all_columns, array_flip(array_keys($index->getColumns())));
+ }
+ $this->fields = array_keys($all_columns);
+ } else {
+ while ($row = PMA_DBI_fetch_row($result)) {
+ $this->fields[] = $row[0];
+ }
+ }
+
+ $this->_showInfo = $showInfo;
+
+ // height and width
+ $this->_setHeightTable($fontSize);
+
+ // setWidth must me after setHeight, because title
+ // can include table height which changes table width
+ $this->_setWidthTable($font,$fontSize);
+ if ($same_wide_width < $this->width) {
+ $same_wide_width = $this->width;
+ }
+
+ // x and y
+ $sql = 'SELECT x, y FROM '
+ . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
+ . ' AND table_name = \'' . PMA_sqlAddslashes($tableName) . '\''
+ . ' AND pdf_page_number = ' . $pageNumber;
+ $result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
+
+ if (!$result || !PMA_DBI_num_rows($result)) {
+ $svg->dieSchema($pageNumber,"SVG",sprintf(__('Please configure the coordinates for table %s'), $tableName));
+ }
+ list($this->x, $this->y) = PMA_DBI_fetch_row($result);
+ $this->x = (double) $this->x;
+ $this->y = (double) $this->y;
+ // displayfield
+ $this->displayfield = PMA_getDisplayField($db, $tableName);
+ // index
+ $result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($tableName) . ';', null, PMA_DBI_QUERY_STORE);
+ if (PMA_DBI_num_rows($result) > 0) {
+ while ($row = PMA_DBI_fetch_assoc($result)) {
+ if ($row['Key_name'] == 'PRIMARY') {
+ $this->primary[] = $row['Column_name'];
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns title of the current table,
+ * title can have the dimensions/co-ordinates of the table
+ *
+ * @access private
+ */
+ private function _getTitle()
+ {
+ return ($this->_showInfo ? sprintf('%.0f', $this->width) . 'x' . sprintf('%.0f', $this->heightCell) : '') . ' ' . $this->_tableName;
+ }
+
+ /**
+ * Sets the width of the table
+ *
+ * @param string font The font size
+ * @param integer fontSize The font size
+ * @global object The current SVG image document
+ * @access private
+ * @see PMA_SVG
+ */
+ function _setWidthTable($font,$fontSize)
+ {
+ global $svg;
+
+ foreach ($this->fields as $field) {
+ $this->width = max($this->width, $svg->getStringWidth($field,$font,$fontSize));
+ }
+ $this->width += $svg->getStringWidth(' ',$font,$fontSize);
+ /*
+ * it is unknown what value must be added, because
+ * table title is affected by the tabe width value
+ */
+ while ($this->width < $svg->getStringWidth($this->_getTitle(),$font,$fontSize)) {
+ $this->width += 7;
+ }
+ }
+
+ /**
+ * Sets the height of the table
+ *
+ * @access private
+ */
+ function _setHeightTable($fontSize)
+ {
+ $this->heightCell = $fontSize + 4;
+ $this->height = (count($this->fields) + 1) * $this->heightCell;
+ }
+
+ /**
+ * draw the table
+ *
+ * @param boolean showColor Whether to display color
+ * @global object The current SVG image document
+ * @access public
+ * @see PMA_SVG,PMA_SVG::printElement
+ */
+ public function tableDraw($showColor)
+ {
+ global $svg;
+ //echo $this->_tableName.'<br />';
+ $svg->printElement('rect',$this->x,$this->y,
+ $this->width,$this->heightCell,
+ NULL,'fill:red;stroke:black;'
+ );
+ $svg->printElement('text',$this->x + 5,$this->y+ 14,
+ $this->width,$this->heightCell,
+ $this->_getTitle(),
+ 'fill:none;stroke:black;'
+ );
+ foreach ($this->fields as $field) {
+ $this->currentCell += $this->heightCell;
+ $showColor = 'none';
+ if ($showColor) {
+ if (in_array($field, $this->primary)) {
+ $showColor = '#0c0';
+ }
+ if ($field == $this->displayfield) {
+ $showColor = 'none';
+ }
+ }
+ $svg->printElement('rect', $this->x,$this->y + $this->currentCell,
+ $this->width, $this->heightCell,
+ NULL,
+ 'fill:'.$showColor.';stroke:black;'
+ );
+ $svg->printElement('text', $this->x + 5, $this->y + 14 + $this->currentCell,
+ $this->width, $this->heightCell,
+ $field,
+ 'fill:none;stroke:black;'
+ );
+ }
+ }
+}
+
+
+/**
+ * Relation preferences/statistics
+ *
+ * This class fetches the table master and foreign fields positions
+ * and helps in generating the Table references and then connects
+ * master table's master field to foreign table's foreign key
+ * in SVG XML document.
+ *
+ * @name Relation_Stats
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ * @see PMA_SVG::printElementLine
+ */
+class Relation_Stats
+{
+ /**
+ * Defines properties
+ */
+ public $xSrc, $ySrc;
+ public $srcDir ;
+ public $destDir;
+ public $xDest, $yDest;
+ public $wTick = 10;
+
+ /**
+ * The "Relation_Stats" constructor
+ *
+ * @param string master_table The master table name
+ * @param string master_field The relation field in the master table
+ * @param string foreign_table The foreign table name
+ * @param string foreigh_field The relation field in the foreign table
+ * @see Relation_Stats::_getXy
+ */
+ function __construct($master_table, $master_field, $foreign_table, $foreign_field)
+ {
+ $src_pos = $this->_getXy($master_table, $master_field);
+ $dest_pos = $this->_getXy($foreign_table, $foreign_field);
+ /*
+ * [0] is x-left
+ * [1] is x-right
+ * [2] is y
+ */
+ $src_left = $src_pos[0] - $this->wTick;
+ $src_right = $src_pos[1] + $this->wTick;
+ $dest_left = $dest_pos[0] - $this->wTick;
+ $dest_right = $dest_pos[1] + $this->wTick;
+
+ $d1 = abs($src_left - $dest_left);
+ $d2 = abs($src_right - $dest_left);
+ $d3 = abs($src_left - $dest_right);
+ $d4 = abs($src_right - $dest_right);
+ $d = min($d1, $d2, $d3, $d4);
+
+ if ($d == $d1) {
+ $this->xSrc = $src_pos[0];
+ $this->srcDir = -1;
+ $this->xDest = $dest_pos[0];
+ $this->destDir = -1;
+ } elseif ($d == $d2) {
+ $this->xSrc = $src_pos[1];
+ $this->srcDir = 1;
+ $this->xDest = $dest_pos[0];
+ $this->destDir = -1;
+ } elseif ($d == $d3) {
+ $this->xSrc = $src_pos[0];
+ $this->srcDir = -1;
+ $this->xDest = $dest_pos[1];
+ $this->destDir = 1;
+ } else {
+ $this->xSrc = $src_pos[1];
+ $this->srcDir = 1;
+ $this->xDest = $dest_pos[1];
+ $this->destDir = 1;
+ }
+ $this->ySrc = $src_pos[2];
+ $this->yDest = $dest_pos[2];
+ }
+
+ /**
+ * Gets arrows coordinates
+ *
+ * @param string table The current table name
+ * @param string column The relation column name
+ * @return array Arrows coordinates
+ * @access private
+ */
+ function _getXy($table, $column)
+ {
+ $pos = array_search($column, $table->fields);
+ // x_left, x_right, y
+ return array($table->x, $table->x + $table->width, $table->y + ($pos + 1.5) * $table->heightCell);
+ }
+
+ /**
+ * draws relation links and arrows
+ * shows foreign key relations
+ *
+ * @param boolean changeColor Whether to use one color per relation or not
+ * @global object The current SVG image document
+ * @access public
+ * @see PMA_SVG
+ */
+ public function relationDraw($changeColor)
+ {
+ global $svg;
+
+ if ($changeColor) {
+ $listOfColors = array(
+ 'red',
+ 'grey',
+ 'black',
+ 'yellow',
+ 'green',
+ 'cyan',
+ ' orange'
+ );
+ shuffle($listOfColors);
+ $color = $listOfColors[0];
+ } else {
+ $color = 'black';
+ }
+
+ $svg->printElementLine('line',$this->xSrc,$this->ySrc,
+ $this->xSrc + $this->srcDir * $this->wTick,$this->ySrc,
+ 'fill:'.$color.';stroke:black;stroke-width:2;'
+ );
+ $svg->printElementLine('line',$this->xDest + $this->destDir * $this->wTick, $this->yDest,
+ $this->xDest, $this->yDest,
+ 'fill:'.$color.';stroke:black;stroke-width:2;'
+ );
+ $svg->printElementLine('line',$this->xSrc + $this->srcDir * $this->wTick,$this->ySrc,
+ $this->xDest + $this->destDir * $this->wTick, $this->yDest,
+ 'fill:'.$color.';stroke:'.$color.';stroke-width:1;'
+ );
+ $root2 = 2 * sqrt(2);
+ $svg->printElementLine('line',$this->xSrc + $this->srcDir * $this->wTick * 0.75, $this->ySrc,
+ $this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick ,
+ $this->ySrc + $this->wTick / $root2 ,
+ 'fill:'.$color.';stroke:black;stroke-width:2;'
+ );
+ $svg->printElementLine('line',$this->xSrc + $this->srcDir * $this->wTick * 0.75, $this->ySrc,
+ $this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick ,
+ $this->ySrc - $this->wTick / $root2 ,
+ 'fill:'.$color.';stroke:black;stroke-width:2;'
+ );
+ $svg->printElementLine('line',$this->xDest + $this->destDir * $this->wTick / 2 , $this->yDest ,
+ $this->xDest + $this->destDir * (0.5 + 1 / $root2) * $this->wTick,
+ $this->yDest + $this->wTick / $root2 ,
+ 'fill:'.$color.';stroke:black;stroke-width:2;');
+ $svg->printElementLine('line',$this->xDest + $this->destDir * $this->wTick / 2 ,
+ $this->yDest , $this->xDest + $this->destDir * (0.5 + 1 / $root2) * $this->wTick ,
+ $this->yDest - $this->wTick / $root2 ,
+ 'fill:'.$color.';stroke:black;stroke-width:2;'
+ );
+ }
+}
+/*
+* end of the "Relation_Stats" class
+*/
+
+/**
+ * Svg Relation Schema Class
+ *
+ * Purpose of this class is to generate the SVG XML Document because
+ * SVG defines the graphics in XML format which is used for representing
+ * the database diagrams as vector image. This class actually helps
+ * in preparing SVG XML format.
+ *
+ * SVG XML is generated by using XMLWriter php extension and this class
+ * inherits Export_Relation_Schema class has common functionality added
+ * to this class
+ *
+ * @name Svg_Relation_Schema
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ */
+class PMA_Svg_Relation_Schema extends PMA_Export_Relation_Schema
+{
+
+ private $tables = array();
+ private $_relations = array();
+ private $_xMax = 0;
+ private $_yMax = 0;
+ private $scale;
+ private $_xMin = 100000;
+ private $_yMin = 100000;
+ private $t_marg = 10;
+ private $b_marg = 10;
+ private $l_marg = 10;
+ private $r_marg = 10;
+ private $_tablewidth;
+
+ /**
+ * The "PMA_Svg_Relation_Schema" constructor
+ *
+ * Upon instantiation This starts writing the SVG XML document
+ * user will be prompted for download as .svg extension
+ *
+ * @return void
+ * @see PMA_SVG
+ */
+ function __construct()
+ {
+ global $svg,$db;
+
+ $this->setPageNumber($_POST['pdf_page_number']);
+ $this->setShowColor(isset($_POST['show_color']));
+ $this->setShowKeys(isset($_POST['show_keys']));
+ $this->setTableDimension(isset($_POST['show_table_dimension']));
+ $this->setAllTableSameWidth(isset($_POST['all_table_same_wide']));
+ $this->setExportType($_POST['export_type']);
+
+ $svg = new PMA_SVG();
+ $svg->setTitle(sprintf(__('Schema of the %s database - Page %s'), $db, $this->pageNumber));
+ $svg->SetAuthor('phpMyAdmin ' . PMA_VERSION);
+ $svg->setFont('Arial');
+ $svg->setFontSize('16px');
+ $svg->startSvgDoc('1000px','1000px');
+ $alltables = $this->getAllTables($db,$this->pageNumber);
+
+ foreach ($alltables AS $table) {
+ if (!isset($this->tables[$table])) {
+ $this->tables[$table] = new Table_Stats($table,$svg->getFont(),$svg->getFontSize(), $this->pageNumber, $this->_tablewidth, $this->showKeys, $this->tableDimension);
+ }
+
+ if ($this->sameWide) {
+ $this->tables[$table]->width = $this->_tablewidth;
+ }
+ $this->_setMinMax($this->tables[$table]);
+ }
+ $seen_a_relation = false;
+ foreach ($alltables as $one_table) {
+ $exist_rel = PMA_getForeigners($db, $one_table, '', 'both');
+ if ($exist_rel) {
+ $seen_a_relation = true;
+ foreach ($exist_rel as $master_field => $rel) {
+ /* put the foreign table on the schema only if selected
+ * by the user
+ * (do not use array_search() because we would have to
+ * to do a === FALSE and this is not PHP3 compatible)
+ */
+ if (in_array($rel['foreign_table'], $alltables)) {
+ $this->_addRelation($one_table,$svg->getFont(),$svg->getFontSize(), $master_field, $rel['foreign_table'], $rel['foreign_field'], $this->tableDimension);
+ }
+ }
+ }
+ }
+ if ($seen_a_relation) {
+ $this->_drawRelations($this->showColor);
+ }
+
+ $this->_drawTables($this->showColor);
+ $svg->endSvgDoc();
+ $svg->showOutput($db.'-'.$this->pageNumber);
+ exit();
+ }
+
+ /**
+ * Sets X and Y minimum and maximum for a table cell
+ *
+ * @param string table The table name
+ * @access private
+ */
+ private function _setMinMax($table)
+ {
+ $this->_xMax = max($this->_xMax, $table->x + $table->width);
+ $this->_yMax = max($this->_yMax, $table->y + $table->height);
+ $this->_xMin = min($this->_xMin, $table->x);
+ $this->_yMin = min($this->_yMin, $table->y);
+ }
+
+ /**
+ * Defines relation objects
+ *
+ * @param string masterTable The master table name
+ * @param string masterField The relation field in the master table
+ * @param string foreignTable The foreign table name
+ * @param string foreignField The relation field in the foreign table
+ * @param boolean showInfo Whether to display table position or not
+ * @access private
+ * @see _setMinMax,Table_Stats::__construct(),Relation_Stats::__construct()
+ */
+ private function _addRelation($masterTable,$font,$fontSize, $masterField, $foreignTable, $foreignField, $showInfo)
+ {
+ if (!isset($this->tables[$masterTable])) {
+ $this->tables[$masterTable] = new Table_Stats($masterTable, $font, $fontSize, $this->pageNumber, $this->_tablewidth, false, $showInfo);
+ $this->_setMinMax($this->tables[$masterTable]);
+ }
+ if (!isset($this->tables[$foreignTable])) {
+ $this->tables[$foreignTable] = new Table_Stats($foreignTable,$font,$fontSize,$this->pageNumber, $this->_tablewidth, false, $showInfo);
+ $this->_setMinMax($this->tables[$foreignTable]);
+ }
+ $this->_relations[] = new Relation_Stats($this->tables[$masterTable], $masterField, $this->tables[$foreignTable], $foreignField);
+ }
+
+ /**
+ * Draws relation arrows and lines
+ * connects master table's master field to
+ * foreign table's forein field
+ *
+ * @param boolean changeColor Whether to use one color per relation or not
+ * @access private
+ * @see Relation_Stats::relationDraw()
+ */
+ private function _drawRelations($changeColor)
+ {
+ foreach ($this->_relations as $relation) {
+ $relation->relationDraw($changeColor);
+ }
+ }
+
+ /**
+ * Draws tables
+ *
+ * @param boolean changeColor Whether to show color for primary fields or not
+ * @access private
+ * @see Table_Stats::Table_Stats_tableDraw()
+ */
+ private function _drawTables($changeColor)
+ {
+ foreach ($this->tables as $table) {
+ $table->tableDraw($changeColor);
+ }
+ }
+}
+?>
diff --git a/libraries/schema/User_Schema.class.php b/libraries/schema/User_Schema.class.php
new file mode 100644
index 0000000..31aa6de
--- /dev/null
+++ b/libraries/schema/User_Schema.class.php
@@ -0,0 +1,821 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ *
+ * @version $Id$
+ * @package phpMyAdmin
+ */
+
+/**
+ * This Class interacts with the user to gather the information
+ * about their tables for which they want to export the relational schema
+ * export options are shown to user from they can choose
+ *
+ * @name User_Schema
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ */
+
+class PMA_User_Schema
+{
+
+ public $choosenPage;
+ public $autoLayoutForeign;
+ public $autoLayoutInternal;
+ public $pageNumber;
+ public $c_table_rows;
+ public $action;
+
+ public function setAction($value)
+ {
+ $this->action = $value;
+ }
+ /**
+ * This function will process the user defined pages
+ * and tables which will be exported as Relational schema
+ * you can set the table positions on the paper via scratchboard
+ * for table positions, put the x,y co-ordinates
+ *
+ * @param string $this->action It tells what the Schema is supposed to do
+ * create and select a page, generate schema etc
+ * @access public
+ */
+
+ public function processUserPreferences()
+ {
+ global $action_choose,$db,$cfgRelation,$cfg,$query_default_option;
+
+ if (isset($this->action)) {
+ switch ($this->action) {
+ case 'selectpage':
+ $this->choosenPage = $_REQUEST['chpage'];
+ if ($action_choose=="1") {
+ $this->deleteCoordinates($db, $cfgRelation, $this->choosenPage, $query_default_option);
+ $this->deletePages($db, $cfgRelation, $this->choosenPage, $query_default_option);
+ $this->choosenPage = 0;
+ }
+ break;
+ case 'createpage':
+ $this->pageNumber = PMA_REL_create_page($_POST['newpage'], $cfgRelation, $db, $query_default_option);
+ $this->autoLayoutForeign = isset($_POST['auto_layout_foreign']) ? "1":NULL;
+ $this->autoLayoutInternal = isset($_POST['auto_layout_internal']) ? "1":NULL;
+ $this->processRelations($db, $this->pageNumber,$cfgRelation,$query_default_option);
+ break;
+ case 'edcoord':
+ $this->choosenPage = $_POST['chpage'];
+ $this->c_table_rows = $_POST['c_table_rows'];
+ $this->_editCoordinates($db, $cfgRelation,$query_default_option);
+ break;
+ case 'deleteCrap':
+ $this->_deleteTableRows($delrow,$cfgRelation,$db,$this->choosenPage);
+ break;
+ case 'process_export':
+ $this->_processExportSchema();
+ break;
+
+ } // end switch
+ } // end if (isset($do))
+
+ }
+
+ /**
+ * shows/displays the HTML FORM to create the page
+ *
+ * @param string db name of the selected database
+ * @return void
+ * @access public
+ */
+ public function createPage($db)
+ {
+ ?>
+ <form method="post" action="schema_edit.php" name="frm_create_page">
+ <fieldset>
+ <legend>
+ <?php echo __('Create a page') . "\n"; ?>
+ </legend>
+ <?php echo PMA_generate_common_hidden_inputs($db); ?>
+ <input type="hidden" name="do" value="createpage" />
+ <table>
+ <tr>
+ <td><label for="id_newpage"><?php echo __('Page name'); ?></label></td>
+ <td><input type="text" name="newpage" id="id_newpage" size="20" maxlength="50" /></td>
+ </tr>
+ <tr>
+ <td><?php echo __('Automatic layout based on'); ?></td>
+ <td>
+ <input type="checkbox" name="auto_layout_internal" id="id_auto_layout_internal" /><label for="id_auto_layout_internal">
+ <?php echo __('Internal relations'); ?></label><br />
+ <?php
+ /*
+ * Check to see whether INNODB and PBXT storage engines are Available in MYSQL PACKAGE
+ * If available, then provide AutoLayout for Foreign Keys in Schema View
+ */
+
+ if (PMA_StorageEngine::isValid('InnoDB') || PMA_StorageEngine::isValid('PBXT')) {
+ ?>
+ <input type="checkbox" name="auto_layout_foreign" id="id_auto_layout_foreign" /><label for="id_auto_layout_foreign">
+ <?php echo __('FOREIGN KEY'); ?></label><br />
+ <?php
+ }
+ ?>
+ </td></tr>
+ </table>
+ </fieldset>
+ <fieldset class="tblFooters">
+ <input type="submit" value="<?php echo __('Go'); ?>" />
+ </fieldset>
+ </form>
+ <?php
+ }
+
+ /**
+ * shows/displays the created page names in a drop down list
+ * User can select any page number and edit it using dashboard etc
+ *
+ * @return void
+ * @access public
+ */
+ public function selectPage()
+ {
+ global $db,$table,$query_default_option,$cfgRelation;
+ $page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
+ $page_rs = PMA_query_as_controluser($page_query, FALSE, $query_default_option);
+ if ($page_rs && PMA_DBI_num_rows($page_rs) > 0) {
+ ?>
+ <form method="get" action="schema_edit.php" name="frm_select_page">
+ <fieldset>
+ <legend>
+ <?php echo __('Please choose a page to edit') . "\n"; ?>
+ </legend>
+ <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
+ <input type="hidden" name="do" value="selectpage" />
+ <select name="chpage" id="chpage" onchange="this.form.submit()">
+ <option value="0"><?php echo __('Select page'); ?></option>
+ <?php
+ while ($curr_page = PMA_DBI_fetch_assoc($page_rs)) {
+ echo "\n" . ' '
+ . '<option value="' . $curr_page['page_nr'] . '"';
+ if (isset($this->choosenPage) && $this->choosenPage == $curr_page['page_nr']) {
+ echo ' selected="selected"';
+ }
+ echo '>' . $curr_page['page_nr'] . ': ' . htmlspecialchars($curr_page['page_descr']) . '</option>';
+ } // end while
+ echo "\n";
+ ?>
+ </select>
+ <?php
+ $choices = array(
+ '0' => __('Edit'),
+ '1' => __('Delete')
+ );
+ PMA_display_html_radio('action_choose', $choices, '0', false);
+ unset($choices);
+ ?>
+ </fieldset>
+ <fieldset class="tblFooters">
+ <input type="submit" value="<?php echo __('Go'); ?>" /><br />
+ </fieldset>
+ </form>
+ <?php
+ } // end IF
+ echo "\n";
+ } // end function
+
+ /**
+ * A dashboard is displayed to AutoLayout the position of tables
+ * users can drag n drop the tables and change their positions
+ *
+ * @return void
+ * @access public
+ */
+ public function showTableDashBoard()
+ {
+ global $db,$cfgRelation,$table,$cfg,$with_field_names,$query_default_option;
+ /*
+ * We will need an array of all tables in this db
+ */
+ $selectboxall = array('--');
+ $alltab_rs = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
+ while ($val = @PMA_DBI_fetch_row($alltab_rs)) {
+ $selectboxall[] = $val[0];
+ }
+
+ /*
+ * Now if we already have chosen a page number then we should
+ * show the tables involved
+ */
+
+ if (isset($this->choosenPage) && $this->choosenPage > 0) {
+ echo "\n";
+ ?>
+ <h2><?php echo __('Select Tables') ;?></h2>
+ <?php
+ $page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
+ . ' AND pdf_page_number = \'' . PMA_sqlAddslashes($this->choosenPage) . '\'';
+ $page_rs = PMA_query_as_controluser($page_query, FALSE, $query_default_option);
+ $array_sh_page = array();
+ $draginit = '';
+ $reset_draginit = '';
+ $i = 0;
+ while ($temp_sh_page = @PMA_DBI_fetch_assoc($page_rs)) {
+ $array_sh_page[] = $temp_sh_page;
+ }
+ /*
+ * Display WYSIWYG-PDF parts?
+ */
+
+ if ($cfg['WYSIWYG-PDF']) {
+ if (!isset($_POST['with_field_names']) && !isset($_POST['showwysiwyg'])) {
+ $with_field_names = TRUE;
+ }
+ $this->_displayScratchboardTables($array_sh_page,$draginit,$reset_draginit);
+ }
+ ?>
+
+ <form method="post" action="schema_edit.php" name="edcoord">
+ <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
+ <input type="hidden" name="chpage" value="<?php echo htmlspecialchars($this->choosenPage); ?>" />
+ <input type="hidden" name="do" value="edcoord" />
+ <table border="0">
+ <tr>
+ <th><?php echo __('Table'); ?></th>
+ <th><?php echo __('Delete'); ?></th>
+ <th>X</th>
+ <th>Y</th>
+ </tr>
+ <?php
+ if (isset($ctable)) {
+ unset($ctable);
+ }
+
+ $i = 0;
+ $odd_row = true;
+ foreach ($array_sh_page as $dummy_sh_page => $sh_page) {
+ $_mtab = $sh_page['table_name'];
+ $tabExist[$_mtab] = FALSE;
+ echo "\n" . ' <tr class="';
+ if ($odd_row) {
+ echo 'odd';
+ } else {
+ echo 'even';
+ }
+ echo '">';
+ $odd_row != $odd_row;
+ echo "\n" . ' <td>'
+ . "\n" . ' <select name="c_table_' . $i . '[name]">';
+ foreach ($selectboxall as $key => $value) {
+ echo "\n" . ' <option value="' . htmlspecialchars($value) . '"';
+ if ($value == $sh_page['table_name']) {
+ echo ' selected="selected"';
+ $tabExist[$_mtab] = TRUE;
+ }
+ echo '>' . htmlspecialchars($value) . '</option>';
+ }
+ echo "\n" . ' </select>'
+ . "\n" . ' </td>';
+ echo "\n" . ' <td>'
+ . "\n" . ' <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . __('Delete');
+ echo "\n" . ' </td>';
+ echo "\n" . ' <td>'
+ . "\n" . ' <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'x\', this.value)"' : '') . ' name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
+ echo "\n" . ' </td>';
+ echo "\n" . ' <td>'
+ . "\n" . ' <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'y\', this.value)"' : '') . ' name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
+ echo "\n" . ' </td>';
+ echo "\n" . ' </tr>';
+ $i++;
+ }
+ /*
+ * Add one more empty row
+ */
+ echo "\n" . ' <tr class="';
+ if ($odd_row) {
+ echo 'odd';
+ } else {
+ echo 'even';
+ }
+ $odd_row != $odd_row;
+ echo '">';
+ echo "\n" . ' <td>'
+ . "\n" . ' <select name="c_table_' . $i . '[name]">';
+ foreach ($selectboxall as $key => $value) {
+ echo "\n" . ' <option value="' . htmlspecialchars($value) . '">' . htmlspecialchars($value) . '</option>';
+ }
+ echo "\n" . ' </select>'
+ . "\n" . ' </td>';
+ echo "\n" . ' <td>'
+ . "\n" . ' <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . __('Delete');
+ echo "\n" . ' </td>';
+ echo "\n" . ' <td>'
+ . "\n" . ' <input type="text" name="c_table_' . $i . '[x]" value="' . (isset($sh_page['x'])?$sh_page['x']:'') . '" />';
+ echo "\n" . ' </td>';
+ echo "\n" . ' <td>'
+ . "\n" . ' <input type="text" name="c_table_' . $i . '[y]" value="' . (isset($sh_page['y'])?$sh_page['y']:'') . '" />';
+ echo "\n" . ' </td>';
+ echo "\n" . ' </tr>';
+ echo "\n" . ' </table>' . "\n";
+
+ echo "\n" . ' <input type="hidden" name="c_table_rows" value="' . ($i + 1) . '" />';
+ echo ($cfg['WYSIWYG-PDF'] ? "\n" . ' <input type="hidden" id="showwysiwyg" name="showwysiwyg" value="' . ((isset($showwysiwyg) && $showwysiwyg == '1') ? '1' : '0') . '" />' : '');
+ echo "\n" . ' <input type="checkbox" name="with_field_names" ' . (isset($with_field_names) ? 'checked="checked"' : ''). ' />' . __('Column names') . '<br />';
+ echo "\n" . ' <input type="submit" value="' . __('Save') . '" />';
+ echo "\n" . '</form>' . "\n\n";
+ } // end if
+
+ $this->_deleteTables($db, $this->choosenPage, isset($tabExist));
+ }
+
+ /**
+ * show Export relational schema generation options
+ * user can select export type of his own choice
+ * and the attributes related to it
+ *
+ * @return void
+ * @access public
+ */
+
+ public function displaySchemaGenerationOptions()
+ {
+ global $cfg,$pmaThemeImage,$db,$test_rs,$chpage;
+ ?>
+ <form method="post" action="schema_export.php">
+ <fieldset>
+ <legend>
+ <?php
+ echo PMA_generate_common_hidden_inputs($db);
+ if ($cfg['PropertiesIconic']) {
+ echo '<img class="icon" src="' . $pmaThemeImage . 'b_view.png"'
+ .' alt="" width="16" height="16" />';
+ }
+ echo __('Display relational schema');
+ ?>:
+ </legend>
+ <select name="export_type" id="export_type">
+ <option value="pdf" selected="selected"><?php echo __('PDF');?></option>
+ <option value="svg"><?php echo __('SVG');?></option>
+ <option value="dia"><?php echo __('DIA');?></option>
+ <option value="visio"><?php echo __('VISIO');?></option>
+ <option value="eps"><?php echo __('EPS');?></option>
+ </select>
+ <label><?php echo __('Select Export Relational Type');?></label><br />
+ <?php
+ if (isset($test_rs)) {
+ ?>
+ <label for="pdf_page_number_opt"><?php echo __('Page number:'); ?></label>
+ <select name="pdf_page_number" id="pdf_page_number_opt">
+ <?php
+ while ($pages = @PMA_DBI_fetch_assoc($test_rs)) {
+ echo ' <option value="' . $pages['page_nr'] . '">'
+ . $pages['page_nr'] . ': ' . htmlspecialchars($pages['page_descr']) . '</option>' . "\n";
+ } // end while
+ PMA_DBI_free_result($test_rs);
+ unset($test_rs);
+ ?>
+ </select><br />
+ <?php } else { ?>
+ <input type="hidden" name="pdf_page_number" value="<?php echo htmlspecialchars($this->choosenPage); ?>" />
+ <?php } ?>
+ <input type="hidden" name="do" value="process_export" />
+ <input type="hidden" name="chpage" value="<?php echo $chpage; ?>" />
+ <input type="checkbox" name="show_grid" id="show_grid_opt" />
+ <label for="show_grid_opt"><?php echo __('Show grid'); ?></label><br />
+ <input type="checkbox" name="show_color" id="show_color_opt" checked="checked" />
+ <label for="show_color_opt"><?php echo __('Show color'); ?></label><br />
+ <input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" />
+ <label for="show_table_dim_opt"><?php echo __('Show dimension of tables'); ?>
+ </label><br />
+ <input type="checkbox" name="all_table_same_wide" id="all_table_same_wide" />
+ <label for="all_table_same_wide"><?php echo __('Display all tables with the same width'); ?>
+ </label><br />
+ <input type="checkbox" name="with_doc" id="with_doc" checked="checked" />
+ <label for="with_doc"><?php echo __('Data Dictionary'); ?></label><br />
+ <input type="checkbox" name="show_keys" id="show_keys" />
+ <label for="show_keys"><?php echo __('Only show keys'); ?></label><br />
+ <select name="orientation" id="orientation_opt">
+ <option value="L"><?php echo __('Landscape');?></option>
+ <option value="P"><?php echo __('Portrait');?></option>
+ </select>
+ <label for="orientation_opt"><?php echo __('Orientation'); ?></label>
+ <br />
+ <select name="paper" id="paper_opt">
+ <?php
+ foreach ($cfg['PDFPageSizes'] as $key => $val) {
+ echo '<option value="' . $val . '"';
+ if ($val == $cfg['PDFDefaultPageSize']) {
+ echo ' selected="selected"';
+ }
+ echo ' >' . $val . '</option>' . "\n";
+ }
+ ?>
+ </select>
+ <label for="paper_opt"><?php echo __('Paper size'); ?></label>
+ </fieldset>
+ <fieldset class="tblFooters">
+ <input type="submit" value="<?php echo __('Go'); ?>" />
+ </fieldset>
+ </form>
+ <?php
+ }
+
+ /**
+ * Check if there are tables that need to be deleted in dashboard,
+ * if there are, ask the user for allowance
+ *
+ * @param string db name of database selected
+ * @param integer chpage selected page
+ * @param array tabExist
+ * @return void
+ * @access private
+ */
+ private function _deleteTables($db, $chpage, $tabExist)
+ {
+ $_strtrans = '';
+ $_strname = '';
+ $shoot = FALSE;
+ if (!empty($tabExist) && is_array($tabExist)) {
+ foreach ($tabExist as $key => $value) {
+ if (!$value) {
+ $_strtrans .= '<input type="hidden" name="delrow[]" value="' . htmlspecialchars($key) . '" />' . "\n";
+ $_strname .= '<li>' . htmlspecialchars($key) . '</li>' . "\n";
+ $shoot = TRUE;
+ }
+ }
+ if ($shoot) {
+ echo '<form action="schema_edit.php" method="post">' . "\n"
+ . PMA_generate_common_hidden_inputs($db, $table)
+ . '<input type="hidden" name="do" value="deleteCrap" />' . "\n"
+ . '<input type="hidden" name="chpage" value="' . htmlspecialchars($chpage) . '" />' . "\n"
+ . __('The current page has references to tables that no longer exist. Would you like to delete those references?')
+ . '<ul>' . "\n"
+ . $_strname
+ . '</ul>' . "\n"
+ . $_strtrans
+ . '<input type="submit" value="' . __('Go') . '" />' . "\n"
+ . '</form>';
+ }
+ }
+
+ }
+
+ /**
+ * Check if there are tables that need to be deleted in dashboard,
+ * if there are, ask the user for allowance
+ *
+ * @return void
+ * @access private
+ */
+ private function _displayScratchboardTables($array_sh_page,$draginit,$reset_draginit)
+ {
+ global $with_field_names,$cfg,$db;
+ ?>
+ <script type="text/javascript" src="./js/dom-drag.js"></script>
+ <form method="post" action="schema_edit.php" name="dragdrop">
+ <input type="button" name="dragdrop" value="<?php echo __('Toggle scratchboard'); ?>" onclick="ToggleDragDrop('pdflayout');" />
+ <input type="button" name="dragdropreset" value="<?php echo __('Reset'); ?>" onclick="resetDrag();" />
+ </form>
+ <div id="pdflayout" class="pdflayout" style="visibility: hidden;">
+ <?php
+ $i = 0;
+ foreach ($array_sh_page as $key => $temp_sh_page) {
+ $drag_x = $temp_sh_page['x'];
+ $drag_y = $temp_sh_page['y'];
+
+ $draginit .= ' Drag.init(getElement("table_' . $i . '"), null, 0, parseInt(myid.style.width)-2, 0, parseInt(myid.style.height)-5);' . "\n";
+ $draginit .= ' getElement("table_' . $i . '").onDrag = function (x, y) { document.edcoord.elements["c_table_' . $i . '[x]"].value = parseInt(x); document.edcoord.elements["c_table_' . $i . '[y]"].value = parseInt(y) }' . "\n";
+ $draginit .= ' getElement("table_' . $i . '").style.left = "' . $drag_x . 'px";' . "\n";
+ $draginit .= ' getElement("table_' . $i . '").style.top = "' . $drag_y . 'px";' . "\n";
+ $reset_draginit .= ' getElement("table_' . $i . '").style.left = "2px";' . "\n";
+ $reset_draginit .= ' getElement("table_' . $i . '").style.top = "' . (15 * $i) . 'px";' . "\n";
+ $reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[x]"].value = "2"' . "\n";
+ $reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[y]"].value = "' . (15 * $i) . '"' . "\n";
+
+ $local_query = 'SHOW FIELDS FROM '
+ . PMA_backquote($temp_sh_page['table_name'])
+ . ' FROM ' . PMA_backquote($db);
+ $fields_rs = PMA_DBI_query($local_query);
+ unset($local_query);
+ $fields_cnt = PMA_DBI_num_rows($fields_rs);
+
+ echo '<div id="table_' . $i . '" class="pdflayout_table"><u>' . $temp_sh_page['table_name'] . '</u>';
+ if (isset($with_field_names)) {
+ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
+ echo '<br />' . htmlspecialchars($row['Field']) . "\n";
+ }
+ }
+ echo '</div>' . "\n";
+ PMA_DBI_free_result($fields_rs);
+ unset($fields_rs);
+ $i++;
+ }
+ ?>
+ </div>
+ <script type="text/javascript">
+ //<![CDATA[
+ function PDFinit() {
+ refreshLayout();
+ myid = getElement('pdflayout');
+ <?php echo $draginit; ?>
+ }
+
+ function resetDrag() {
+ <?php echo $reset_draginit; ?>
+ }
+ //]]>
+ </script>
+ <?php
+ }
+
+ /**
+ * delete the table rows with table co-ordinates
+ *
+ * @param int delrow delete selected table from list of tables
+ * @param array cfgRelation relation settings
+ * @param string db database name
+ * @param integer chpage selected page for adding relations etc
+ * @return void
+ * @access private
+ */
+ private function _deleteTableRows($delrow,$cfgRelation,$db,$chpage)
+ {
+ foreach ($delrow as $current_row) {
+ $del_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' ' . "\n"
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . "\n"
+ . ' AND table_name = \'' . PMA_sqlAddslashes($current_row) . '\'' . "\n"
+ . ' AND pdf_page_number = \'' . PMA_sqlAddslashes($chpage) . '\'';
+ echo $del_query;
+ PMA_query_as_controluser($del_query, FALSE, $query_default_option);
+ }
+ }
+
+ /**
+ * get all the export options and verify
+ * call and include the appropriate Schema Class depending on $export_type
+ *
+ * @return void
+ * @access private
+ */
+ private function _processExportSchema()
+ {
+ /**
+ * Settings for relation stuff
+ */
+ require_once './libraries/transformations.lib.php';
+ require_once './libraries/Index.class.php';
+ /**
+ * default is PDF
+ */
+ global $db,$export_type;
+ $export_type = isset($export_type) ? $export_type : 'pdf';
+ PMA_DBI_select_db($db);
+
+ include("./libraries/schema/".ucfirst($export_type)."_Relation_Schema.class.php");
+ $obj_schema = eval("new PMA_".ucfirst($export_type)."_Relation_Schema();");
+ }
+
+ /**
+ * delete X and Y coordinates
+ *
+ * @param string db The database name
+ * @param array cfgRelation relation settings
+ * @param integer choosePage selected page for adding relations etc
+ * @return void
+ * @access private
+ */
+ public function deleteCoordinates($db, $cfgRelation, $choosePage, $query_default_option)
+ {
+ $query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
+ . ' AND pdf_page_number = \'' . PMA_sqlAddslashes($choosePage) . '\'';
+ PMA_query_as_controluser($query, FALSE, $query_default_option);
+ }
+
+ /**
+ * delete pages
+ *
+ * @param string db The database name
+ * @param array cfgRelation relation settings
+ * @param integer choosePage selected page for adding relations etc
+ * @return void
+ * @access private
+ */
+ public function deletePages($db, $cfgRelation, $choosePage, $query_default_option)
+ {
+ $query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
+ . ' AND page_nr = \'' . PMA_sqlAddslashes($choosePage) . '\'';
+ PMA_query_as_controluser($query, FALSE, $query_default_option);
+ }
+
+ /**
+ * process internal and foreign key relations
+ *
+ * @param string db The database name
+ * @param array cfgRelation relation settings
+ * @param integer pageNumber document number/Id
+ * @return void
+ * @access private
+ */
+ public function processRelations($db, $pageNumber, $cfgRelation, $query_default_option)
+ {
+ /*
+ * A u t o m a t i c l a y o u t
+ *
+ * There are 2 kinds of relations in PMA
+ * 1) Internal Relations 2) Foreign Key Relations
+ */
+ if (isset($this->autoLayoutInternal) || isset($this->autoLayoutForeign)) {
+ $all_tables = array();
+ }
+
+ if (isset($this->autoLayoutForeign)) {
+ /*
+ * get the tables list
+ * who support FOREIGN KEY, it's not
+ * important that we group together InnoDB tables
+ * and PBXT tables, as this logic is just to put
+ * the tables on the layout, not to determine relations
+ */
+ $tables = PMA_DBI_get_tables_full($db);
+ $foreignkey_tables = array();
+ foreach($tables as $table_name => $table_properties) {
+ if (PMA_foreignkey_supported($table_properties['ENGINE'])) {
+ $foreignkey_tables[] = $table_name;
+ }
+ }
+ $all_tables = $foreignkey_tables;
+ /*
+ * could be improved by finding the tables which have the
+ * most references keys and placing them at the beginning
+ * of the array (so that they are all center of schema)
+ */
+ unset($tables, $foreignkey_tables);
+ }
+
+ if (isset($this->autoLayoutInternal)) {
+ /*
+ * get the tables list who support Internal Relations;
+ * This type of relations will be created when
+ * you setup the PMA tables correctly
+ */
+ $master_tables = 'SELECT COUNT(master_table), master_table'
+ . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
+ . ' WHERE master_db = \'' . $db . '\''
+ . ' GROUP BY master_table'
+ . ' ORDER BY ' . PMA_backquote('COUNT(master_table)') . ' DESC ';
+ $master_tables_rs = PMA_query_as_controluser($master_tables, FALSE, $query_default_option);
+ if ($master_tables_rs && PMA_DBI_num_rows($master_tables_rs) > 0) {
+ /* first put all the master tables at beginning
+ * of the list, so they are near the center of
+ * the schema
+ */
+ while (list(, $master_table) = PMA_DBI_fetch_row($master_tables_rs)) {
+ $all_tables[] = $master_table;
+ }
+
+ /* Now for each master, add its foreigns into an array
+ * of foreign tables, if not already there
+ * (a foreign might be foreign for more than
+ * one table, and might be a master itself)
+ */
+
+ $foreign_tables = array();
+ foreach ($all_tables as $master_table) {
+ $foreigners = PMA_getForeigners($db, $master_table);
+ foreach ($foreigners as $foreigner) {
+ if (!in_array($foreigner['foreign_table'], $foreign_tables)) {
+ $foreign_tables[] = $foreigner['foreign_table'];
+ }
+ }
+ }
+
+ /*
+ * Now merge the master and foreign arrays/tables
+ */
+ foreach ($foreign_tables as $foreign_table) {
+ if (!in_array($foreign_table, $all_tables)) {
+ $all_tables[] = $foreign_table;
+ }
+ }
+ }
+ }
+
+ if (isset($this->autoLayoutInternal) || isset($this->autoLayoutForeign)) {
+ $this->addRelationCoordinates($all_tables,$pageNumber,$db, $cfgRelation,$query_default_option);
+ }
+
+ $this->choosenPage = $pageNumber;
+ }
+
+ /**
+ * Add X and Y coordinates for a table
+ *
+ * @param string db The database name
+ * @param array cfgRelation relation settings
+ * @param integer pageNumber document number/Id
+ * @param array all_tables A list of all tables involved
+ * @return void
+ * @access private
+ */
+ public function addRelationCoordinates($all_tables,$pageNumber,$db, $cfgRelation,$query_default_option)
+ {
+ /*
+ * Now generate the coordinates for the schema
+ * in a clockwise spiral and add to co-ordinates table
+ */
+ $pos_x = 300;
+ $pos_y = 300;
+ $delta = 110;
+ $delta_mult = 1.10;
+ $direction = "right";
+ foreach ($all_tables as $current_table) {
+ /*
+ * save current table's coordinates
+ */
+ $insert_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
+ . '(db_name, table_name, pdf_page_number, x, y) '
+ . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($current_table) . '\',' . $pageNumber . ',' . $pos_x . ',' . $pos_y . ')';
+ PMA_query_as_controluser($insert_query, FALSE, $query_default_option);
+
+ /*
+ * compute for the next table
+ */
+ switch ($direction) {
+ case 'right':
+ $pos_x += $delta;
+ $direction = "down";
+ $delta *= $delta_mult;
+ break;
+ case 'down':
+ $pos_y += $delta;
+ $direction = "left";
+ $delta *= $delta_mult;
+ break;
+ case 'left':
+ $pos_x -= $delta;
+ $direction = "up";
+ $delta *= $delta_mult;
+ break;
+ case 'up':
+ $pos_y -= $delta;
+ $direction = "right";
+ $delta *= $delta_mult;
+ break;
+ }
+ }
+ }
+
+ /**
+ * update X and Y coordinates for a table
+ *
+ * @param string db The database name
+ * @param array cfgRelation relation settings
+ * @return void
+ * @access private
+ */
+ private function _editCoordinates($db, $cfgRelation,$query_default_option)
+ {
+ for ($i = 0; $i < $this->c_table_rows; $i++) {
+ $arrvalue = 'c_table_' . $i;
+ global $$arrvalue;
+ $arrvalue = $$arrvalue;
+ if (!isset($arrvalue['x']) || $arrvalue['x'] == '') {
+ $arrvalue['x'] = 0;
+ }
+ if (!isset($arrvalue['y']) || $arrvalue['y'] == '') {
+ $arrvalue['y'] = 0;
+ }
+ if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
+ $test_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
+ . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
+ . ' AND pdf_page_number = \'' . PMA_sqlAddslashes($this->choosenPage) . '\'';
+ $test_rs = PMA_query_as_controluser($test_query, FALSE, $query_default_option);
+ //echo $test_query;
+ if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
+ if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
+ $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
+ . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
+ . ' AND pdf_page_number = \'' . PMA_sqlAddslashes($this->choosenPage) . '\'';
+ } else {
+ $ch_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
+ . 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
+ . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
+ . ' AND pdf_page_number = \'' . PMA_sqlAddslashes($this->choosenPage) . '\'';
+ }
+ } else {
+ $ch_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
+ . '(db_name, table_name, pdf_page_number, x, y) '
+ . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\', \'' . PMA_sqlAddslashes($this->choosenPage) . '\',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
+ }
+ //echo $ch_query;
+ PMA_query_as_controluser($ch_query, FALSE, $query_default_option);
+ } // end if
+ } // end for
+ }
+}
+?>
diff --git a/libraries/schema/Visio_Relation_Schema.class.php b/libraries/schema/Visio_Relation_Schema.class.php
new file mode 100644
index 0000000..e3aaba1
--- /dev/null
+++ b/libraries/schema/Visio_Relation_Schema.class.php
@@ -0,0 +1,599 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ *
+ * @version $Id$
+ * @package phpMyAdmin
+ */
+
+include_once("Export_Relation_Schema.class.php");
+
+/**
+ * This Class inherits the XMLwriter class and
+ * helps in developing structure of MS Visio Schema Export
+ *
+ * @name PMA_VISIO
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ * @access public
+ * @see http://php.net/manual/en/book.xmlwriter.php
+ */
+
+class PMA_VISIO extends XMLWriter
+{
+ public $title;
+ public $author;
+ public $font;
+ public $fontSize;
+
+ /**
+ * The "PMA_VISIO" constructor
+ *
+ * Upon instantiation This starts writing the Visio XML .VDX document
+ *
+ * @return void
+ * @see XMLWriter::openMemory(),XMLWriter::setIndent(),XMLWriter::startDocument()
+ */
+ function __construct()
+ {
+ $this->openMemory();
+ /*
+ * Set indenting using three spaces,
+ * so output is formatted
+ */
+
+ $this->setIndent(TRUE);
+ $this->setIndentString(' ');
+ /*
+ * Create the XML document
+ */
+
+ $this->startDocument('1.0','UTF-8');
+ }
+
+ /**
+ * Starts Visio XML .VDX Document
+ *
+ * Visio XML document starts by first initializing VisioDocument tag
+ * then DocumentProperties & DocumentSettings contains all the
+ * attributes that needed to define the document. Order of elements
+ * should be maintained while generating XML of Visio.
+ *
+ * @return void
+ * @access public
+ * @see XMLWriter::startElement(),XMLWriter::writeAttribute(),_documentProperties,_documentSettings
+ */
+ function startVisioDoc()
+ {
+ $this->startElement('VisioDocument');
+ $this->writeAttribute('xmlns', 'http://schemas.microsoft.com/visio/2003/core');
+ $this->writeAttribute('xmlns:vx', 'http://schemas.microsoft.com/visio/2006/extension');
+ $this->writeAttribute('xml:space', 'preserve');
+ $this->_documentProperties();
+ $this->_documentSettings();
+ }
+
+ /**
+ * Set document title
+ *
+ * @param string value sets the title text
+ * @return void
+ * @access public
+ */
+ function setTitle($value)
+ {
+ $this->title = $value;
+ }
+
+ /**
+ * Set document author
+ *
+ * @param string value sets the author
+ * @return void
+ * @access public
+ */
+ function setAuthor($value)
+ {
+ $this->author = $value;
+ }
+
+ /**
+ * Sets Visio XML .VDX Document Properties
+ *
+ * DocumentProperties tag contains document property elements such as
+ the document's Title,Subject,Creator and templates tags
+ *
+ * @return void
+ * @access private
+ * @see XMLWriter::startElement(),XMLWriter::endElement(),XMLWriter::writeRaw()
+ */
+ private function _documentProperties()
+ {
+ $this->startElement('DocumentProperties');
+ $this->writeRaw('<Title>'.$this->title.'</Title>');
+ $this->writeRaw('<Subject>'.$this->title.'</Subject>');
+ $this->writeRaw('<Creator>'.$this->author.'</Creator>');
+ $this->writeRaw('<Company>phpMyAdmin</Company>');
+ $this->writeRaw('<Template>c:\program files\microsoft office\office12\1033\DBMODL_U.VST</Template>');
+ $this->endElement();
+ }
+
+ /**
+ * Sets Visio XML .VDX Document Settings
+ *
+ * DocumentSettings tag contains elements that specify document settings.
+ *
+ * @return void
+ * @access private
+ * @see XMLWriter::startElement(),XMLWriter::endElement()
+ */
+ private function _documentSettings()
+ {
+ $this->startElement('DocumentSettings');
+ $this->endElement();
+ }
+
+ /**
+ * Ends Visio XML Document
+ *
+ * @return void
+ * @access public
+ * @see XMLWriter::endElement(),XMLWriter::endDocument()
+ */
+ function endVisioDoc()
+ {
+ $this->endElement();
+ $this->endDocument();
+ }
+
+ /**
+ * Output Visio XML .VDX Document for download
+ *
+ * @param string fileName name of the Visio XML document
+ * @return void
+ * @access public
+ * @see XMLWriter::flush()
+ */
+ function showOutput($fileName)
+ {
+ //if(ob_get_clean()){
+ //ob_end_clean();
+ //}
+ header('Content-type: application/visio');
+ header('Content-Disposition: attachment; filename="'.$fileName.'.vdx"');
+ $output = $this->flush();
+ print $output;
+ }
+}
+
+
+/**
+ * Draws tables schema
+ */
+class Table_Stats
+{
+ /**
+ * Defines properties
+ */
+
+ private $_tableName;
+ private $_showInfo = false;
+
+ public $width = 0;
+ public $height;
+ public $fields = array();
+ public $heightCell = 0;
+ public $currentCell = 0;
+ public $x, $y;
+ public $primary = array();
+
+ /**
+ * The "Table_Stats" constructor
+ *
+ * @param string tableName The table name
+ * @param integer same_wide_width The max. with among tables
+ * @param boolean showKeys Whether to display keys or not
+ * @param boolean showInfo Whether to display table position or not
+ * @global object The current Visio XML document
+ * @global integer The current page number (from the
+ * $cfg['Servers'][$i]['table_coords'] table)
+ * @global array The relations settings
+ * @global string The current db name
+ * @access private
+ * @see PMA_VISIO, Table_Stats::Table_Stats_setWidth,
+ Table_Stats::Table_Stats_setHeight
+ */
+ function __construct($tableName, $pageNumber, &$same_wide_width, $showKeys = false, $showInfo = false)
+ {
+ global $visio, $cfgRelation, $db;
+
+ $this->_tableName = $tableName;
+ $sql = 'DESCRIBE ' . PMA_backquote($tableName);
+ $result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE);
+ if (!$result || !PMA_DBI_num_rows($result)) {
+ $visio->dieSchema($pageNumber,"VISIO",sprintf(__('The %s table doesn\'t exist!'), $tableName));
+ }
+
+ /*
+ * load fields
+ * check to see if it will load all fields or only the foreign keys
+ */
+
+ if ($showKeys) {
+ $indexes = PMA_Index::getFromTable($this->_tableName, $db);
+ $all_columns = array();
+ foreach ($indexes as $index) {
+ $all_columns = array_merge($all_columns, array_flip(array_keys($index->getColumns())));
+ }
+ $this->fields = array_keys($all_columns);
+ } else {
+ while ($row = PMA_DBI_fetch_row($result)) {
+ $this->fields[] = $row[0];
+ }
+ }
+
+ $this->_showInfo = $showInfo;
+
+ // height and width
+ $this->_setHeightTable($fontSize);
+
+ // setWidth must me after setHeight, because title
+ // can include table height which changes table width
+ $this->_setWidthTable($font,$fontSize);
+ if ($same_wide_width < $this->width) {
+ $same_wide_width = $this->width;
+ }
+
+ // x and y
+ $sql = 'SELECT x, y FROM '
+ . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
+ . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
+ . ' AND table_name = \'' . PMA_sqlAddslashes($tableName) . '\''
+ . ' AND pdf_page_number = ' . $pageNumber;
+ $result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
+
+ if (!$result || !PMA_DBI_num_rows($result)) {
+ $visio->dieSchema($pageNumber,"VISIO",sprintf(__('Please configure the coordinates for table %s'), $tableName));
+ }
+ list($this->x, $this->y) = PMA_DBI_fetch_row($result);
+ $this->x = (double) $this->x;
+ $this->y = (double) $this->y;
+ // displayfield
+ $this->displayfield = PMA_getDisplayField($db, $tableName);
+ // index
+ $result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($tableName) . ';', null, PMA_DBI_QUERY_STORE);
+ if (PMA_DBI_num_rows($result) > 0) {
+ while ($row = PMA_DBI_fetch_assoc($result)) {
+ if ($row['Key_name'] == 'PRIMARY') {
+ $this->primary[] = $row['Column_name'];
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns title of the current table,
+ * title can have the dimensions/co-ordinates of the table
+ *
+ * @access private
+ */
+ private function _getTitle()
+ {
+ return ($this->_showInfo ? sprintf('%.0f', $this->width) . 'x' . sprintf('%.0f', $this->heightCell) : '') . ' ' . $this->_tableName;
+ }
+
+ /**
+ * Sets the width of the table
+ *
+ * @param string font The font name
+ * @param integer fontSize The font size
+ * @global object The current Visio XML document
+ * @access private
+ * @see PMA_VISIO
+ */
+ function _setWidthTable($font,$fontSize)
+ {
+ global $visio;
+
+ }
+
+ /**
+ * Sets the height of the table
+ *
+ * @access private
+ */
+ function _setHeightTable($fontSize)
+ {
+ $this->heightCell = $fontSize + 4;
+ $this->height = (count($this->fields) + 1) * $this->heightCell;
+ }
+
+ /**
+ * draw the table
+ *
+ * @param boolean showColor Whether to display color
+ * @global object The current Visio XML document
+ * @access public
+ * @see PMA_VISIO
+ */
+ public function tableDraw($showColor)
+ {
+ global $visio;
+ //echo $this->_tableName.'<br />';
+
+ foreach ($this->fields as $field) {
+ $this->currentCell += $this->heightCell;
+ $showColor = 'none';
+ if ($showColor) {
+ if (in_array($field, $this->primary)) {
+ $showColor = '#0c0';
+ }
+ if ($field == $this->displayfield) {
+ $showColor = 'none';
+ }
+ }
+ // code here for drawing table diagrams
+ }
+ }
+}
+
+/**
+ * Draws relation links
+ *
+ * @access public
+ * @see PMA_VISIO
+ */
+class Relation_Stats
+{
+ /**
+ * Defines properties
+ */
+ public $xSrc, $ySrc;
+ public $srcDir ;
+ public $destDir;
+ public $xDest, $yDest;
+ public $wTick = 10;
+
+ /**
+ * The "Relation_Stats" constructor
+ *
+ * @param string master_table The master table name
+ * @param string master_field The relation field in the master table
+ * @param string foreign_table The foreign table name
+ * @param string foreigh_field The relation field in the foreign table
+ * @see Relation_Stats::_getXy
+ */
+ function __construct($master_table, $master_field, $foreign_table, $foreign_field)
+ {
+ $src_pos = $this->_getXy($master_table, $master_field);
+ $dest_pos = $this->_getXy($foreign_table, $foreign_field);
+ /*
+ * [0] is x-left
+ * [1] is x-right
+ * [2] is y
+ */
+ $src_left = $src_pos[0] - $this->wTick;
+ $src_right = $src_pos[1] + $this->wTick;
+ $dest_left = $dest_pos[0] - $this->wTick;
+ $dest_right = $dest_pos[1] + $this->wTick;
+
+ $d1 = abs($src_left - $dest_left);
+ $d2 = abs($src_right - $dest_left);
+ $d3 = abs($src_left - $dest_right);
+ $d4 = abs($src_right - $dest_right);
+ $d = min($d1, $d2, $d3, $d4);
+
+ if ($d == $d1) {
+ $this->xSrc = $src_pos[0];
+ $this->srcDir = -1;
+ $this->xDest = $dest_pos[0];
+ $this->destDir = -1;
+ } elseif ($d == $d2) {
+ $this->xSrc = $src_pos[1];
+ $this->srcDir = 1;
+ $this->xDest = $dest_pos[0];
+ $this->destDir = -1;
+ } elseif ($d == $d3) {
+ $this->xSrc = $src_pos[0];
+ $this->srcDir = -1;
+ $this->xDest = $dest_pos[1];
+ $this->destDir = 1;
+ } else {
+ $this->xSrc = $src_pos[1];
+ $this->srcDir = 1;
+ $this->xDest = $dest_pos[1];
+ $this->destDir = 1;
+ }
+ $this->ySrc = $src_pos[2];
+ $this->yDest = $dest_pos[2];
+ }
+
+ /**
+ * Gets arrows coordinates
+ *
+ * @param string table The current table name
+ * @param string column The relation column name
+ * @return array Arrows coordinates
+ * @access private
+ */
+ function _getXy($table, $column)
+ {
+ $pos = array_search($column, $table->fields);
+ // x_left, x_right, y
+ return array($table->x, $table->x + $table->width, $table->y + ($pos + 1.5) * $table->heightCell);
+ }
+
+ /**
+ * draws relation links and arrows
+ * shows foreign key relations
+ *
+ * @param boolean changeColor Whether to use one color per relation or not
+ * @global object The current Visio XML document
+ * @access public
+ * @see PMA_VISIO
+ */
+ public function relationDraw($changeColor)
+ {
+ global $visio;
+
+ if ($changeColor) {
+ $listOfColors = array(
+ 'red',
+ 'grey',
+ 'black',
+ 'yellow',
+ 'green',
+ 'cyan',
+ ' orange'
+ );
+ shuffle($listOfColors);
+ $color = $listOfColors[0];
+ } else {
+ $color = 'black';
+ }
+
+ // code here for making connections b/w relation objects
+
+ }
+}
+/*
+* end of the "Relation_Stats" class
+*/
+
+/**
+ * Visio Relation Schema Class
+ *
+ * Purpose of this class is to generate the Visio XML .VDX Document
+ * which is used for representing the database diagrams in any version of MS Visio IDE.
+ * This class uses Software and Database Template and Database model diagram of Visio
+ * and with the combination of these objects actually helps in preparing Visio XML .VDX document.
+ *
+ * Visio XML is generated by using XMLWriter php extension and this class
+ * inherits Export_Relation_Schema class has common functionality added
+ * to this class
+ *
+ * @name Visio_Relation_Schema
+ * @author Muhammad Adnan <hiddenpearls(a)gmail.com>
+ * @copyright
+ * @license
+ */
+class PMA_Visio_Relation_Schema extends PMA_Export_Relation_Schema
+{
+ /**
+ * The "PMA_Visio_Relation_Schema" constructor
+ *
+ * Upon instantiation This outputs the Visio XML document
+ * that user can download
+ *
+ * @return void
+ * @see PMA_VISIO,Table_Stats,Relation_Stats
+ */
+ function __construct()
+ {
+ global $visio,$db;
+
+ $this->setPageNumber($_POST['pdf_page_number']);
+ $this->setShowGrid(isset($_POST['show_grid']));
+ $this->setShowColor($_POST['show_color']);
+ $this->setShowKeys(isset($_POST['show_keys']));
+ $this->setOrientation(isset($_POST['orientation']));
+ $this->setPaper($_POST['paper']);
+ $this->setExportType($_POST['export_type']);
+
+ $visio = new PMA_VISIO();
+ $visio->setTitle(sprintf(__('Schema of the %s database - Page %s'), $db, $this->pageNumber));
+ $visio->SetAuthor('phpMyAdmin ' . PMA_VERSION);
+ $visio->startVisioDoc();
+ $alltables = $this->getAllTables($db,$this->pageNumber);
+
+ foreach ($alltables as $table) {
+ if (!isset($this->tables[$table])) {
+ $this->tables[$table] = new Table_Stats($table, $this->pageNumber, $this->showKeys);
+ }
+ }
+
+ $seen_a_relation = false;
+ foreach ($alltables as $one_table) {
+ $exist_rel = PMA_getForeigners($db, $one_table, '', 'both');
+ if ($exist_rel) {
+ $seen_a_relation = true;
+ foreach ($exist_rel as $master_field => $rel) {
+ /* put the foreign table on the schema only if selected
+ * by the user
+ * (do not use array_search() because we would have to
+ * to do a === FALSE and this is not PHP3 compatible)
+ */
+ if (in_array($rel['foreign_table'], $alltables)) {
+ $this->_addRelation($one_table, $master_field, $rel['foreign_table'], $rel['foreign_field'],$this->showKeys);
+ }
+ }
+ }
+ }
+ $this->_drawTables($this->showColor);
+
+ if ($seen_a_relation) {
+ $this->_drawRelations($this->showColor);
+ }
+ $visio->endVisioDoc();
+ $visio->showOutput($db.'-'.$this->pageNumber);
+ exit();
+ }
+
+ /**
+ * Defines relation objects
+ *
+ * @param string masterTable The master table name
+ * @param string masterField The relation field in the master table
+ * @param string foreignTable The foreign table name
+ * @param string foreignField The relation field in the foreign table
+ * @return void
+ * @access private
+ * @see Table_Stats::__construct(),Relation_Stats::__construct()
+ */
+ private function _addRelation($masterTable, $masterField, $foreignTable, $foreignField, $showKeys)
+ {
+ if (!isset($this->tables[$masterTable])) {
+ $this->tables[$masterTable] = new Table_Stats($masterTable, $this->pageNumber, $showKeys);
+ }
+ if (!isset($this->tables[$foreignTable])) {
+ $this->tables[$foreignTable] = new Table_Stats($foreignTable, $this->pageNumber, $showKeys);
+ }
+ $this->_relations[] = new Relation_Stats($this->tables[$masterTable], $masterField, $this->tables[$foreignTable], $foreignField);
+ }
+
+ /**
+ * Draws relation references
+ *
+ * connects master table's master field to
+ * foreign table's forein field.
+ *
+ * @param boolean changeColor Whether to use one color per relation or not
+ * @return void
+ * @access private
+ * @see Relation_Stats::relationDraw()
+ */
+ private function _drawRelations($changeColor)
+ {
+ foreach ($this->_relations as $relation) {
+ $relation->relationDraw($changeColor);
+ }
+ }
+
+ /**
+ * Draws tables
+ *
+ *
+ * @param boolean changeColor Whether to show color for tables text or not
+ * @return void
+ * @access private
+ * @see Table_Stats::tableDraw()
+ */
+ private function _drawTables($changeColor)
+ {
+ foreach ($this->tables as $table) {
+ $table->tableDraw($changeColor);
+ }
+ }
+}
+?>
\ No newline at end of file
diff --git a/libraries/tcpdf/tcpdf.php b/libraries/tcpdf/tcpdf.php
index 26f2dc1..a6b707a 100644
--- a/libraries/tcpdf/tcpdf.php
+++ b/libraries/tcpdf/tcpdf.php
@@ -2980,6 +2980,7 @@ if(!class_exists('TCPDF', false)) {
if(ob_get_contents()) {
$this->Error('Some data has already been output, can\'t send PDF file');
}
+
if(php_sapi_name()!='cli') {
//We send to a browser
header('Content-Type: application/pdf');
@@ -2997,6 +2998,7 @@ if(!class_exists('TCPDF', false)) {
if(ob_get_contents()) {
$this->Error('Some data has already been output, can\'t send PDF file');
}
+
if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')) {
header('Content-Type: application/force-download');
} else {
@@ -3005,6 +3007,7 @@ if(!class_exists('TCPDF', false)) {
if(headers_sent()) {
$this->Error('Some data has already been output to browser, can\'t send PDF file');
}
+ header('Content-Type: application/pdf');
header('Content-Length: '.strlen($this->buffer));
header('Content-disposition: attachment; filename="'.$name.'"');
echo $this->buffer;
diff --git a/pdf_pages.php b/pdf_pages.php
deleted file mode 100644
index 75d4622..0000000
--- a/pdf_pages.php
+++ /dev/null
@@ -1,559 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- *
- * @package phpMyAdmin
- */
-
-/**
- * Gets some core libraries
- */
-require_once './libraries/common.inc.php';
-require_once './libraries/db_common.inc.php';
-require './libraries/StorageEngine.class.php';
-
-$active_page = 'db_operations.php';
-require_once './libraries/db_common.inc.php';
-$url_query .= '&goto=pdf_pages.php';
-require_once './libraries/db_info.inc.php';
-
-/**
- * Settings for relation stuff
- */
-$cfgRelation = PMA_getRelationsParam();
-
-// This is to avoid "Command out of sync" errors. Before switching this to
-// a value of 0 (for MYSQLI_USE_RESULT), please check the logic
-// to free results wherever needed.
-$query_default_option = PMA_DBI_QUERY_STORE;
-
-/**
- * Now in ./libraries/relation.lib.php we check for all tables
- * that we need, but if we don't find them we are quiet about it
- * so people can work without.
- * This page is absolutely useless if you didn't set up your tables
- * correctly, so it is a good place to see which tables we can and
- * complain ;-)
- */
-if (!$cfgRelation['relwork']) {
- echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'relation', 'config.inc.php') . '<br />' . "\n"
- . PMA_showDocu('relation') . "\n";
- require './libraries/footer.inc.php';
-}
-
-if (!$cfgRelation['displaywork']) {
- echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_info', 'config.inc.php') . '<br />' . "\n"
- . PMA_showDocu('table_info') . "\n";
- require './libraries/footer.inc.php';
-}
-
-if (!isset($cfgRelation['table_coords'])){
- echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_coords', 'config.inc.php') . '<br />' . "\n"
- . PMA_showDocu('table_coords') . "\n";
- require './libraries/footer.inc.php';
-}
-if (!isset($cfgRelation['pdf_pages'])) {
- echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'pdf_page', 'config.inc.php') . '<br />' . "\n"
- . PMA_showDocu('pdf_pages') . "\n";
- require './libraries/footer.inc.php';
-}
-
-if ($cfgRelation['pdfwork']) {
- // Now is the time to work on all changes
- if (isset($do)) {
- switch ($do) {
- case 'choosepage':
- if ($action_choose=="1") {
- $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
- . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
- . ' AND pdf_page_number = \'' . PMA_sqlAddslashes($chpage) . '\'';
- PMA_query_as_controluser($ch_query, FALSE, $query_default_option);
-
- $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
- . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
- . ' AND page_nr = \'' . PMA_sqlAddslashes($chpage) . '\'';
- PMA_query_as_controluser($ch_query, FALSE, $query_default_option);
-
- unset($chpage);
- }
- break;
- case 'createpage':
- $pdf_page_number = PMA_REL_create_page($newpage, $cfgRelation, $db, $query_default_option);
-
- // A u t o m a t i c l a y o u t
- // ================================
- if (isset($auto_layout_internal) || isset($auto_layout_foreign)) {
- $all_tables = array();
- }
-
- if (isset($auto_layout_foreign)) {
- // get the tables list
- $tables = PMA_DBI_get_tables_full($db);
- // find the ones who support FOREIGN KEY; it's not
- // important that we group together InnoDB tables
- // and PBXT tables, as this logic is just to put
- // the tables on the layout, not to determine relations
- $foreignkey_tables = array();
- foreach($tables as $table_name => $table_properties) {
- if (PMA_foreignkey_supported($table_properties['ENGINE'])) {
- $foreignkey_tables[] = $table_name;
- }
- }
- $all_tables = $foreignkey_tables;
- // could be improved by finding the tables which have the
- // most references keys and placing them at the beginning
- // of the array (so that they are all center of schema)
- unset($tables, $foreignkey_tables);
- } // endif auto_layout_foreign
-
- if (isset($auto_layout_internal)) {
- // get the tables that have relations, by descending
- // number of links
- $master_tables = 'SELECT COUNT(master_table), master_table'
- . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
- . ' WHERE master_db = \'' . $db . '\''
- . ' GROUP BY master_table'
- . ' ORDER BY ' . PMA_backquote('COUNT(master_table)') . ' DESC ';
- $master_tables_rs = PMA_query_as_controluser($master_tables, FALSE, $query_default_option);
- if ($master_tables_rs && PMA_DBI_num_rows($master_tables_rs) > 0) {
- // first put all the master tables at beginning
- // of the list, so they are near the center of
- // the schema
- while (list(, $master_table) = PMA_DBI_fetch_row($master_tables_rs)) {
- $all_tables[] = $master_table;
- }
-
- // then for each master, add its foreigns into an array
- // of foreign tables, if not already there
- // (a foreign might be foreign for more than
- // one table, and might be a master itself)
-
- $foreign_tables = array();
- foreach ($all_tables AS $master_table) {
- $foreigners = PMA_getForeigners($db, $master_table);
- foreach ($foreigners AS $foreigner) {
- if (!in_array($foreigner['foreign_table'], $foreign_tables)) {
- $foreign_tables[] = $foreigner['foreign_table'];
- }
- }
- }
-
- // then merge the arrays
- foreach ($foreign_tables AS $foreign_table) {
- if (!in_array($foreign_table, $all_tables)) {
- $all_tables[] = $foreign_table;
- }
- }
- } // endif there are master tables
- } // endif auto_layout_internal
-
- if (isset($auto_layout_internal) || isset($auto_layout_foreign)) {
- // now generate the coordinates for the schema,
- // in a clockwise spiral
-
- $pos_x = 300;
- $pos_y = 300;
- $delta = 110;
- $delta_mult = 1.10;
- $direction = "right";
- foreach ($all_tables AS $current_table) {
-
- // save current table's coordinates
- $insert_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
- . '(db_name, table_name, pdf_page_number, x, y) '
- . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($current_table) . '\',' . $pdf_page_number . ',' . $pos_x . ',' . $pos_y . ')';
- PMA_query_as_controluser($insert_query, FALSE, $query_default_option);
-
- // compute for the next table
- switch ($direction) {
- case 'right':
- $pos_x += $delta;
- $direction = "down";
- $delta *= $delta_mult;
- break;
- case 'down':
- $pos_y += $delta;
- $direction = "left";
- $delta *= $delta_mult;
- break;
- case 'left':
- $pos_x -= $delta;
- $direction = "up";
- $delta *= $delta_mult;
- break;
- case 'up':
- $pos_y -= $delta;
- $direction = "right";
- $delta *= $delta_mult;
- break;
- } // end switch
- } // end foreach
- } // end if some auto-layout to do
-
- $chpage = $pdf_page_number;
-
- break;
-
- case 'edcoord':
- for ($i = 0; $i < $c_table_rows; $i++) {
- $arrvalue = 'c_table_' . $i;
- $arrvalue = $$arrvalue;
- if (!isset($arrvalue['x']) || $arrvalue['x'] == '') {
- $arrvalue['x'] = 0;
- }
- if (!isset($arrvalue['y']) || $arrvalue['y'] == '') {
- $arrvalue['y'] = 0;
- }
- if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
- $test_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
- . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
- . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
- . ' AND pdf_page_number = \'' . PMA_sqlAddslashes($chpage) . '\'';
- $test_rs = PMA_query_as_controluser($test_query, FALSE, $query_default_option);
- if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
- if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
- $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
- . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
- . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
- . ' AND pdf_page_number = \'' . PMA_sqlAddslashes($chpage) . '\'';
- } else {
- $ch_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
- . 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
- . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
- . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
- . ' AND pdf_page_number = \'' . PMA_sqlAddslashes($chpage) . '\'';
- }
- } else {
- $ch_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
- . '(db_name, table_name, pdf_page_number, x, y) '
- . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\', \'' . PMA_sqlAddslashes($chpage) . '\',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
- }
- PMA_query_as_controluser($ch_query, FALSE, $query_default_option);
- } // end if
- } // end for
- break;
- case 'deleteCrap':
- foreach ($delrow AS $current_row) {
- $d_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' ' . "\n"
- . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . "\n"
- . ' AND table_name = \'' . PMA_sqlAddslashes($current_row) . '\'' . "\n"
- . ' AND pdf_page_number = \'' . PMA_sqlAddslashes($chpage) . '\'';
- PMA_query_as_controluser($d_query, FALSE, $query_default_option);
- }
- break;
- } // end switch
- } // end if (isset($do))
-
- // We will need an array of all tables in this db
- $selectboxall = array('--');
- $alltab_rs = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
- while ($val = @PMA_DBI_fetch_row($alltab_rs)) {
- $selectboxall[] = $val[0];
- }
-
- // Now first show some possibility to choose a page for the pdf
- $page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
- . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
- $page_rs = PMA_query_as_controluser($page_query, FALSE, $query_default_option);
-
- if ($page_rs && PMA_DBI_num_rows($page_rs) > 0) {
- ?>
-<form method="get" action="pdf_pages.php" name="selpage">
- <fieldset>
- <legend>
- <?php echo __('Please choose a page to edit') . "\n"; ?>
- </legend>
- <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
- <input type="hidden" name="do" value="choosepage" />
- <select name="chpage" onchange="this.form.submit()">
- <?php
- while ($curr_page = PMA_DBI_fetch_assoc($page_rs)) {
- echo "\n" . ' '
- . '<option value="' . $curr_page['page_nr'] . '"';
- if (isset($chpage) && $chpage == $curr_page['page_nr']) {
- echo ' selected="selected"';
- }
- echo '>' . $curr_page['page_nr'] . ': ' . htmlspecialchars($curr_page['page_descr']) . '</option>';
- } // end while
- echo "\n";
- ?>
- </select>
-<?php
- $choices = array(
- '0' => __('Edit'),
- '1' => __('Delete'));
- PMA_display_html_radio('action_choose', $choices, '0', false);
- unset($choices);
-?>
- </fieldset>
- <fieldset class="tblFooters">
- <input type="submit" value="<?php echo __('Go'); ?>" /><br />
- </fieldset>
-</form>
- <?php
- }
- echo "\n";
-
- // Possibility to create a new page:
- ?>
-<form method="post" action="pdf_pages.php" name="crpage">
- <fieldset>
- <legend>
- <?php echo __('Create a page') . "\n"; ?>
- </legend>
- <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
- <input type="hidden" name="do" value="createpage" />
- <table>
- <tr>
- <td><label for="id_newpage"><?php echo __('Page name'); ?></label></td>
- <td><input type="text" name="newpage" id="id_newpage" size="20" maxlength="50" /></td>
- </tr>
- <tr>
- <td><?php echo __('Automatic layout based on'); ?></td>
- <td>
- <input type="checkbox" name="auto_layout_internal" id="id_auto_layout_internal" /><label for="id_auto_layout_internal"><?php echo __('Internal relations'); ?></label><br />
-<?php
- if (PMA_StorageEngine::isValid('InnoDB') || PMA_StorageEngine::isValid('PBXT')) {
-?>
- <input type="checkbox" name="auto_layout_foreign" id="id_auto_layout_foreign" /><label for="id_auto_layout_foreign">FOREIGN KEY</label><br />
-<?php
- }
-?>
- </td></tr>
- </table>
- </fieldset>
- <fieldset class="tblFooters">
- <input type="submit" value="<?php echo __('Go'); ?>" />
- </fieldset>
-</form>
- <?php
- // Now if we already have chosen a page number then we should show the
- // tables involved
- if (isset($chpage) && $chpage > 0) {
- echo "\n";
- ?>
-<hr />
-
-<h2><?php echo __('Select Tables') ;?></h2>
-
-<?php
-$page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
- . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
- . ' AND pdf_page_number = \'' . PMA_sqlAddslashes($chpage) . '\'';
-$page_rs = PMA_query_as_controluser($page_query, FALSE, $query_default_option);
-$array_sh_page = array();
-$draginit = '';
-$reset_draginit = '';
-$i = 0;
-while ($temp_sh_page = @PMA_DBI_fetch_assoc($page_rs)) {
- $array_sh_page[] = $temp_sh_page;
-}
-
-// Display WYSIWYG-PDF parts?
-if ($cfg['WYSIWYG-PDF']) {
- if (!isset($_POST['with_field_names']) && !isset($_POST['showwysiwyg'])) {
- $with_field_names = TRUE;
- }
-?>
-<script type="text/javascript" src="./js/dom-drag.js"></script>
-<form method="post" action="pdf_pages.php" name="dragdrop">
-<input type="button" name="dragdrop" value="<?php echo __('Toggle scratchboard'); ?>" onclick="ToggleDragDrop('pdflayout');" />
- <input type="button" name="dragdropreset" value="<?php echo __('Reset'); ?>" onclick="resetDrag();" />
-</form>
-<div id="pdflayout" class="pdflayout" style="visibility: hidden;">
-<?php
-foreach ($array_sh_page AS $key => $temp_sh_page) {
- $drag_x = $temp_sh_page['x'];
- $drag_y = $temp_sh_page['y'];
-
- $draginit .= ' Drag.init(getElement("table_' . $i . '"), null, 0, parseInt(myid.style.width)-2, 0, parseInt(myid.style.height)-5);' . "\n";
- $draginit .= ' getElement("table_' . $i . '").onDrag = function (x, y) { document.edcoord.elements["c_table_' . $i . '[x]"].value = parseInt(x); document.edcoord.elements["c_table_' . $i . '[y]"].value = parseInt(y) }' . "\n";
- $draginit .= ' getElement("table_' . $i . '").style.left = "' . $drag_x . 'px";' . "\n";
- $draginit .= ' getElement("table_' . $i . '").style.top = "' . $drag_y . 'px";' . "\n";
- $reset_draginit .= ' getElement("table_' . $i . '").style.left = "2px";' . "\n";
- $reset_draginit .= ' getElement("table_' . $i . '").style.top = "' . (15 * $i) . 'px";' . "\n";
- $reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[x]"].value = "2"' . "\n";
- $reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[y]"].value = "' . (15 * $i) . '"' . "\n";
-
- $local_query = 'SHOW FIELDS FROM '
- . PMA_backquote($temp_sh_page['table_name'])
- . ' FROM ' . PMA_backquote($db);
- $fields_rs = PMA_DBI_query($local_query);
- unset($local_query);
- $fields_cnt = PMA_DBI_num_rows($fields_rs);
-
- echo '<div id="table_' . $i . '" class="pdflayout_table"><u>' . $temp_sh_page['table_name'] . '</u>';
- if (isset($with_field_names)) {
- while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
- echo '<br />' . htmlspecialchars($row['Field']) . "\n";
- }
- }
- echo '</div>' . "\n";
- PMA_DBI_free_result($fields_rs);
- unset($fields_rs);
-
- $i++;
-}
-?>
-</div>
-<script type="text/javascript">
-//<![CDATA[
-function PDFinit() {
- refreshLayout();
- myid = getElement('pdflayout');
- <?php echo $draginit; ?>
-}
-
-function resetDrag() {
- <?php echo $reset_draginit; ?>
-}
-//]]>
-</script>
-<?php
-} // end if WYSIWYG-PDF
-?>
-
-<form method="post" action="pdf_pages.php" name="edcoord">
- <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
- <input type="hidden" name="chpage" value="<?php echo htmlspecialchars($chpage); ?>" />
- <input type="hidden" name="do" value="edcoord" />
- <table border="0">
- <tr>
- <th><?php echo __('Table'); ?></th>
- <th><?php echo __('Delete'); ?></th>
- <th>X</th>
- <th>Y</th>
- </tr>
- <?php
- if (isset($ctable)) {
- unset($ctable);
- }
-
-
- $i = 0;
- $odd_row = true;
- foreach ($array_sh_page AS $dummy_sh_page => $sh_page) {
- $_mtab = $sh_page['table_name'];
- $tabExist[$_mtab] = FALSE;
- echo "\n" . ' <tr class="';
- if ($odd_row) {
- echo 'odd';
- } else {
- echo 'even';
- }
- echo '">';
- $odd_row != $odd_row;
- echo "\n" . ' <td>'
- . "\n" . ' <select name="c_table_' . $i . '[name]">';
- foreach ($selectboxall AS $key => $value) {
- echo "\n" . ' <option value="' . htmlspecialchars($value) . '"';
- if ($value == $sh_page['table_name']) {
- echo ' selected="selected"';
- $tabExist[$_mtab] = TRUE;
- }
- echo '>' . htmlspecialchars($value) . '</option>';
- } // end while
- echo "\n" . ' </select>'
- . "\n" . ' </td>';
- echo "\n" . ' <td>'
- . "\n" . ' <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . __('Delete');
- echo "\n" . ' </td>';
- echo "\n" . ' <td>'
- . "\n" . ' <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'x\', this.value)"' : '') . ' name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
- echo "\n" . ' </td>';
- echo "\n" . ' <td>'
- . "\n" . ' <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'y\', this.value)"' : '') . ' name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
- echo "\n" . ' </td>';
- echo "\n" . ' </tr>';
- $i++;
- } // end while
- // Do one more empty row
- echo "\n" . ' <tr class="';
- if ($odd_row) {
- echo 'odd';
- } else {
- echo 'even';
- }
- $odd_row != $odd_row;
- echo '">';
- echo "\n" . ' <td>'
- . "\n" . ' <select name="c_table_' . $i . '[name]">';
- foreach ($selectboxall AS $key => $value) {
- echo "\n" . ' <option value="' . htmlspecialchars($value) . '">' . htmlspecialchars($value) . '</option>';
- }
- echo "\n" . ' </select>'
- . "\n" . ' </td>';
- echo "\n" . ' <td>'
- . "\n" . ' <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . __('Delete');
- echo "\n" . ' </td>';
- echo "\n" . ' <td>'
- . "\n" . ' <input type="text" name="c_table_' . $i . '[x]" value="' . (isset($sh_page['x'])?$sh_page['x']:'') . '" />';
- echo "\n" . ' </td>';
- echo "\n" . ' <td>'
- . "\n" . ' <input type="text" name="c_table_' . $i . '[y]" value="' . (isset($sh_page['y'])?$sh_page['y']:'') . '" />';
- echo "\n" . ' </td>';
- echo "\n" . ' </tr>';
- echo "\n" . ' </table>' . "\n";
-
- echo "\n" . ' <input type="hidden" name="c_table_rows" value="' . ($i + 1) . '" />';
- echo ($cfg['WYSIWYG-PDF'] ? "\n" . ' <input type="hidden" id="showwysiwyg" name="showwysiwyg" value="' . ((isset($showwysiwyg) && $showwysiwyg == '1') ? '1' : '0') . '" />' : '');
- echo "\n" . ' <input type="checkbox" name="with_field_names" ' . (isset($with_field_names) ? 'checked="checked"' : ''). ' />' . __('Column names') . '<br />';
- echo "\n" . ' <input type="submit" value="' . __('Save') . '" />';
- echo "\n" . '</form>' . "\n\n";
- } // end if
-
- // Check if there are tables that need to be deleted,
- // if there are, ask the user for allowance
- $_strtrans = '';
- $_strname = '';
- $shoot = FALSE;
- if (!empty($tabExist) && is_array($tabExist)) {
- foreach ($tabExist AS $key => $value) {
- if (!$value) {
- $_strtrans .= '<input type="hidden" name="delrow[]" value="' . htmlspecialchars($key) . '" />' . "\n";
- $_strname .= '<li>' . htmlspecialchars($key) . '</li>' . "\n";
- $shoot = TRUE;
- }
- }
- if ($shoot) {
- echo '<form action="pdf_pages.php" method="post">' . "\n"
- . PMA_generate_common_hidden_inputs($db, $table)
- . '<input type="hidden" name="do" value="deleteCrap" />' . "\n"
- . '<input type="hidden" name="chpage" value="' . htmlspecialchars($chpage) . '" />' . "\n"
- . __('The current page has references to tables that no longer exist. Would you like to delete those references?')
- . '<ul>' . "\n"
- . $_strname
- . '</ul>' . "\n"
- . $_strtrans
- . '<input type="submit" value="' . __('Go') . '" />' . "\n"
- . '</form>';
- }
- }
- // ------------------------------------
- // d i s p l a y p d f s c h e m a
- // ------------------------------------
-
- if (isset($do)
- && ($do == 'edcoord'
- || ($do == 'choosepage' && isset($chpage))
- || ($do == 'createpage' && isset($chpage)))) {
- include('./libraries/display_pdf_schema.lib.php');
- if ((isset($showwysiwyg) && $showwysiwyg == '1')) {
-?>
-<script type="text/javascript">
-//<![CDATA[
-ToggleDragDrop('pdflayout');
-//]]>
-</script>
-<?php
- }
- } // end if
-} // end if ($cfgRelation['pdfwork'])
-
-
-/**
- * Displays the footer
- */
-echo "\n";
-require './libraries/footer.inc.php';
-?>
diff --git a/pdf_schema.php b/pdf_schema.php
deleted file mode 100644
index dd7426f..0000000
--- a/pdf_schema.php
+++ /dev/null
@@ -1,1404 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- *
- * @package phpMyAdmin
- */
-
-/**
- * Gets some core scripts
- */
-require_once './libraries/common.inc.php';
-
-/**
- * Settings for relation stuff
- */
-require_once './libraries/transformations.lib.php';
-require_once './libraries/Index.class.php';
-
-$cfgRelation = PMA_getRelationsParam();
-
-/**
- * Now in ./libraries/relation.lib.php we check for all tables
- * that we need, but if we don't find them we are quiet about it
- * so people can work without.
- * This page is absolutely useless if you didn't set up your tables
- * correctly, so it is a good place to see which tables we can and
- * complain ;-)
- */
-if (!$cfgRelation['pdfwork']) {
- echo '<font color="red">' . __('Error') . '</font><br />' . "\n";
- $url_to_goto = '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $url_query . '">';
- echo sprintf(__('The phpMyAdmin configuration storage has been deactivated. To find out why click %shere%s.'), $url_to_goto, '</a>') . "\n";
-}
-
-/**
- * Font used in PDF.
- *
- * @todo Make this configuratble (at least Sans/Serif).
- */
-define('PMA_PDF_FONT', 'DejaVuSans');
-require_once './libraries/tcpdf/tcpdf.php';
-
-/**
- * Extends the "FPDF" class and prepares the work
- *
- * @access public
- * @see FPDF
- * @package phpMyAdmin
- */
-class PMA_PDF extends TCPDF {
- /**
- * Defines private properties
- */
- var $x_min;
- var $y_min;
- var $l_marg = 10;
- var $t_marg = 10;
- var $scale;
- var $PMA_links;
- var $Outlines = array();
- var $def_outlines;
- var $Alias = array();
- var $widths;
-
- public function getFh()
- {
- return $this->fh;
- }
-
- public function getFw()
- {
- return $this->fw;
- }
-
- public function setCMargin($c_margin)
- {
- $this->cMargin = $c_margin;
- }
-
- function SetAlias($name, $value)
- {
- $this->Alias[$name] = $value ;
- }
-
- function _putpages()
- {
- if (count($this->Alias) > 0) {
- $nb = $this->page;
- foreach ($this->Alias AS $alias => $value) {
- for ($n = 1;$n <= $nb;$n++)
- $this->pages[$n]=str_replace($alias, $value, $this->pages[$n]);
- }
- }
- parent::_putpages();
- }
-
- /**
- * Sets the scaling factor, defines minimum coordinates and margins
- *
- * @param float scale The scaling factor
- * @param float x_min The minimum X coordinate
- * @param float y_min The minimum Y coordinate
- * @param float l_marg The left margin
- * @param float t_marg The top margin
- * @access public
- */
- function PMA_PDF_setScale($scale = 1, $x_min = 0, $y_min = 0, $l_marg = -1, $t_marg = -1)
- {
- $this->scale = $scale;
- $this->x_min = $x_min;
- $this->y_min = $y_min;
- if ($this->l_marg != -1) {
- $this->l_marg = $l_marg;
- }
- if ($this->t_marg != -1) {
- $this->t_marg = $t_marg;
- }
- } // end of the "PMA_PDF_setScale" function
- /**
- * Outputs a scaled cell
- *
- * @param float w The cell width
- * @param float h The cell height
- * @param string txt The text to output
- * @param mixed border Whether to add borders or not
- * @param integer ln Where to put the cursor once the output is done
- * @param string align Align mode
- * @param integer fill Whether to fill the cell with a color or not
- * @access public
- * @see FPDF::Cell()
- */
- function PMA_PDF_cellScale($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = '')
- {
- $h = $h / $this->scale;
- $w = $w / $this->scale;
- $this->Cell($w, $h, $txt, $border, $ln, $align, $fill, $link);
- } // end of the "PMA_PDF_cellScale" function
- /**
- * Draws a scaled line
- *
- * @param float x1 The horizontal position of the starting point
- * @param float y1 The vertical position of the starting point
- * @param float x2 The horizontal position of the ending point
- * @param float y2 The vertical position of the ending point
- * @access public
- * @see FPDF::Line()
- */
- function PMA_PDF_lineScale($x1, $y1, $x2, $y2)
- {
- $x1 = ($x1 - $this->x_min) / $this->scale + $this->l_marg;
- $y1 = ($y1 - $this->y_min) / $this->scale + $this->t_marg;
- $x2 = ($x2 - $this->x_min) / $this->scale + $this->l_marg;
- $y2 = ($y2 - $this->y_min) / $this->scale + $this->t_marg;
- $this->Line($x1, $y1, $x2, $y2);
- } // end of the "PMA_PDF_lineScale" function
- /**
- * Sets x and y scaled positions
- *
- * @param float x The x position
- * @param float y The y position
- * @access public
- * @see FPDF::SetXY()
- */
- function PMA_PDF_setXyScale($x, $y)
- {
- $x = ($x - $this->x_min) / $this->scale + $this->l_marg;
- $y = ($y - $this->y_min) / $this->scale + $this->t_marg;
- $this->SetXY($x, $y);
- } // end of the "PMA_PDF_setXyScale" function
- /**
- * Sets the X scaled positions
- *
- * @param float x The x position
- * @access public
- * @see FPDF::SetX()
- */
- function PMA_PDF_setXScale($x)
- {
- $x = ($x - $this->x_min) / $this->scale + $this->l_marg;
- $this->SetX($x);
- } // end of the "PMA_PDF_setXScale" function
- /**
- * Sets the scaled font size
- *
- * @param float size The font size (in points)
- * @access public
- * @see FPDF::SetFontSize()
- */
- function PMA_PDF_setFontSizeScale($size)
- {
- // Set font size in points
- $size = $size / $this->scale;
- $this->SetFontSize($size);
- } // end of the "PMA_PDF_setFontSizeScale" function
- /**
- * Sets the scaled line width
- *
- * @param float width The line width
- * @access public
- * @see FPDF::SetLineWidth()
- */
- function PMA_PDF_setLineWidthScale($width)
- {
- $width = $width / $this->scale;
- $this->SetLineWidth($width);
- } // end of the "PMA_PDF_setLineWidthScale" function
- /**
- * Displays an error message
- *
- * @param string error_message the error mesage
- * @global array the PMA configuration array
- * @global integer the current server id
- * @global string the current language
- * @global string the charset to convert to
- * @global string the current database name
- * @global string the current charset
- * @global string the current text direction
- * @global string a localized string
- * @global string an other localized string
- * @access public
- */
- function PMA_PDF_die($error_message = '')
- {
- global $cfg;
- global $server, $lang, $db;
- global $charset, $text_dir;
-
- require_once './libraries/header.inc.php';
-
- echo '<p><strong>PDF - ' . __('Error') . '</strong></p>' . "\n";
- if (!empty($error_message)) {
- $error_message = htmlspecialchars($error_message);
- }
- echo '<p>' . "\n";
- echo ' ' . $error_message . "\n";
- echo '</p>' . "\n";
-
- echo '<a href="db_structure.php?' . PMA_generate_common_url($db)
- . '">' . __('Back') . '</a>';
- echo "\n";
-
- require './libraries/footer.inc.php';
- } // end of the "PMA_PDF_die()" function
- /**
- * Aliases the "Error()" function from the FPDF class to the
- * "PMA_PDF_die()" one
- *
- * @param string error_message the error mesage
- * @access public
- * @see PMA_PDF_die
- */
- function Error($error_message = '')
- {
- $this->PMA_PDF_die($error_message);
- } // end of the "Error()" method
- function Header()
- {
- // We only show this if we find something in the new pdf_pages table
-
- // This function must be named "Header" to work with the FPDF library
- global $cfgRelation, $db, $pdf_page_number, $with_doc;
- if ($with_doc) {
- $test_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
- . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
- . ' AND page_nr = \'' . $pdf_page_number . '\'';
- $test_rs = PMA_query_as_controluser($test_query);
- $pages = @PMA_DBI_fetch_assoc($test_rs);
- $this->SetFont('', 'B', 14);
- $this->Cell(0, 6, ucfirst($pages['page_descr']), 'B', 1, 'C');
- $this->SetFont('', '');
- $this->Ln();
- }
- }
- function Footer()
- {
- // This function must be named "Footer" to work with the FPDF library
- global $with_doc;
- if ($with_doc) {
- $this->SetY(-15);
- $this->SetFont('', '', 14);
- $this->Cell(0, 6, __('Page number:') . ' ' . $this->PageNo() . '/{nb}', 'T', 0, 'C');
- $this->Cell(0, 6, PMA_localisedDate(), 0, 1, 'R');
- $this->SetY(20);
- }
- }
- function Bookmark($txt, $level = 0, $y = 0)
- {
- // Add a bookmark
- $this->Outlines[0][] = $level;
- $this->Outlines[1][] = $txt;
- $this->Outlines[2][] = $this->page;
- if ($y == -1) {
- $y = $this->GetY();
- }
- $this->Outlines[3][] = round($this->hPt - $y * $this->k, 2);
- }
-
- function _putbookmarks()
- {
- if (count($this->Outlines) > 0) {
- // Save object number
- $memo_n = $this->n;
- // Take the number of sub elements for an outline
- $nb_outlines = sizeof($this->Outlines[0]);
- $first_level = array();
- $parent = array();
- $parent[0] = 1;
- for ($i = 0; $i < $nb_outlines; $i++) {
- $level = $this->Outlines[0][$i];
- $kids = 0;
- $last = -1;
- $prev = -1;
- $next = -1;
- if ($i > 0) {
- $cursor = $i-1;
- // Take the previous outline in the same level
- while ($this->Outlines[0][$cursor] > $level && $cursor > 0)
- $cursor--;
- if ($this->Outlines[0][$cursor] == $level) {
- $prev = $cursor;
- }
- }
- if ($i < $nb_outlines-1) {
- $cursor = $i + 1;
- while (isset($this->Outlines[0][$cursor]) && $this->Outlines[0][$cursor] > $level) {
- // Take the immediate kid in level + 1
- if ($this->Outlines[0][$cursor] == $level + 1) {
- $kids++;
- $last = $cursor;
- }
- $cursor++;
- }
- $cursor = $i + 1;
- // Take the next outline in the same level
- while ($this->Outlines[0][$cursor] > $level && ($cursor + 1 < sizeof($this->Outlines[0])))
- $cursor++;
- if ($this->Outlines[0][$cursor] == $level) {
- $next = $cursor;
- }
- }
- $this->_newobj();
- $parent[$level + 1] = $this->n;
- if ($level == 0) {
- $first_level[] = $this->n;
- }
- $this->_out('<<');
- $this->_out('/Title (' . $this->Outlines[1][$i] . ')');
- $this->_out('/Parent ' . $parent[$level] . ' 0 R');
- if ($prev != -1) {
- $this->_out('/Prev ' . ($memo_n + $prev + 1) . ' 0 R');
- }
- if ($next != -1) {
- $this->_out('/Next ' . ($this->n + $next - $i) . ' 0 R');
- }
- $this->_out('/Dest [' . (1 + (2 * $this->Outlines[2][$i])) . ' 0 R /XYZ null ' . $this->Outlines[3][$i] . ' null]');
- if ($kids > 0) {
- $this->_out('/First ' . ($this->n + 1) . ' 0 R');
- $this->_out('/Last ' . ($this->n + $last - $i) . ' 0 R');
- $this->_out('/Count -' . $kids);
- }
- $this->_out('>>');
- $this->_out('endobj');
- }
- // First page of outlines
- $this->_newobj();
- $this->def_outlines = $this->n;
- $this->_out('<<');
- $this->_out('/Type');
- $this->_out('/Outlines');
- $this->_out('/First ' . $first_level[0] . ' 0 R');
- $this->_out('/Last ' . $first_level[sizeof($first_level)-1] . ' 0 R');
- $this->_out('/Count ' . sizeof($first_level));
- $this->_out('>>');
- $this->_out('endobj');
- }
- }
-
- function _putresources()
- {
- parent::_putresources();
- $this->_putbookmarks();
- }
-
- function _putcatalog()
- {
- parent::_putcatalog();
- if (count($this->Outlines) > 0) {
- $this->_out('/Outlines ' . $this->def_outlines . ' 0 R');
- $this->_out('/PageMode /UseOutlines');
- }
- }
- function SetWidths($w)
- {
- // column widths
- $this->widths = $w;
- }
-
- function Row($data, $links)
- {
- // line height
- $nb = 0;
- $data_cnt = count($data);
- for ($i = 0;$i < $data_cnt;$i++)
- $nb = max($nb, $this->NbLines($this->widths[$i], $data[$i]));
- $il = $this->FontSize;
- $h = ($il + 1) * $nb;
- // page break if necessary
- $this->CheckPageBreak($h);
- // draw the cells
- $data_cnt = count($data);
- for ($i = 0;$i < $data_cnt;$i++) {
- $w = $this->widths[$i];
- // save current position
- $x = $this->GetX();
- $y = $this->GetY();
- // draw the border
- $this->Rect($x, $y, $w, $h);
- if (isset($links[$i])) {
- $this->Link($x, $y, $w, $h, $links[$i]);
- }
- // print text
- $this->MultiCell($w, $il + 1, $data[$i], 0, 'L');
- // go to right side
- $this->SetXY($x + $w, $y);
- }
- // go to line
- $this->Ln($h);
- }
-
- function CheckPageBreak($h)
- {
- // if height h overflows, manual page break
- if ($this->GetY() + $h > $this->PageBreakTrigger) {
- $this->AddPage($this->CurOrientation);
- }
- }
-
- function NbLines($w, $txt)
- {
- // compute number of lines used by a multicell of width w
- $cw = &$this->CurrentFont['cw'];
- if ($w == 0) {
- $w = $this->w - $this->rMargin - $this->x;
- }
- $wmax = ($w-2 * $this->cMargin) * 1000 / $this->FontSize;
- $s = str_replace("\r", '', $txt);
- $nb = strlen($s);
- if ($nb > 0 and $s[$nb-1] == "\n") {
- $nb--;
- }
- $sep = -1;
- $i = 0;
- $j = 0;
- $l = 0;
- $nl = 1;
- while ($i < $nb) {
- $c = $s[$i];
- if ($c == "\n") {
- $i++;
- $sep = -1;
- $j = $i;
- $l = 0;
- $nl++;
- continue;
- }
- if ($c == ' ') {
- $sep = $i;
- }
- $l += isset($cw[ord($c)])?$cw[ord($c)]:0 ;
- if ($l > $wmax) {
- if ($sep == -1) {
- if ($i == $j) {
- $i++;
- }
- } else {
- $i = $sep + 1;
- }
- $sep = -1;
- $j = $i;
- $l = 0;
- $nl++;
- } else {
- $i++;
- }
- }
- return $nl;
- }
-} // end of the "PMA_PDF" class
-
-
-/**
- * Draws tables schema
- *
- * @access private
- * @see PMA_RT
- * @package phpMyAdmin
- */
-class PMA_RT_Table {
- /**
- * Defines private properties
- */
- var $nb_fiels;
- var $table_name;
- var $width = 0;
- var $height;
- var $fields = array();
- var $height_cell = 6;
- var $x, $y;
- var $primary = array();
- var $show_info = false;
-
- /**
- * Returns title of the current table,
- * title can have the dimensions of the table
- *
- * @access private
- */
- function getTitle()
- {
- return ($this->show_info ? sprintf('%.0f', $this->width) . 'x' . sprintf('%.0f', $this->height) : '') . ' ' . $this->table_name;
- } // end of the "getTitle" function
- /**
- * Sets the width of the table
- *
- * @param integer ff The font size
- * @global object The current PDF document
- * @access private
- * @see PMA_PDF
- */
- function PMA_RT_Table_setWidth($ff)
- {
- global $pdf;
-
- foreach ($this->fields AS $field) {
- $this->width = max($this->width, $pdf->GetStringWidth($field));
- }
- $this->width += $pdf->GetStringWidth(' ');
- $pdf->SetFont($ff, 'B');
- // it is unknown what value must be added, because
- // table title is affected by the tabe width value
- while ($this->width < $pdf->GetStringWidth($this->getTitle())) {
- $this->width += 5;
- }
- $pdf->SetFont($ff, '');
- } // end of the "PMA_RT_Table_setWidth()" method
- /**
- * Sets the height of the table
- *
- * @access private
- */
- function PMA_RT_Table_setHeight()
- {
- $this->height = (count($this->fields) + 1) * $this->height_cell;
- } // end of the "PMA_RT_Table_setHeight()" method
- /**
- * Do draw the table
- *
- * @param integer ff The font size
- * @param boolean setcolortWhether to display color
- * @global object The current PDF document
- * @access private
- * @see PMA_PDF
- */
- function PMA_RT_Table_draw($ff, $setcolor = 0)
- {
- global $pdf, $with_doc;
-
- $pdf->PMA_PDF_setXyScale($this->x, $this->y);
- $pdf->SetFont($ff, 'B');
- if ($setcolor) {
- $pdf->SetTextColor(200);
- $pdf->SetFillColor(0, 0, 128);
- }
- if ($with_doc) {
- $pdf->SetLink($pdf->PMA_links['RT'][$this->table_name]['-'], -1);
- } else {
- $pdf->PMA_links['doc'][$this->table_name]['-'] = '';
- }
-
- $pdf->PMA_PDF_cellScale($this->width, $this->height_cell, $this->getTitle(), 1, 1, 'C', $setcolor, $pdf->PMA_links['doc'][$this->table_name]['-']);
- $pdf->PMA_PDF_setXScale($this->x);
- $pdf->SetFont($ff, '');
- $pdf->SetTextColor(0);
- $pdf->SetFillColor(255);
-
- foreach ($this->fields AS $field) {
- if ($setcolor) {
- if (in_array($field, $this->primary)) {
- $pdf->SetFillColor(215, 121, 123);
- }
- if ($field == $this->displayfield) {
- $pdf->SetFillColor(142, 159, 224);
- }
- }
- if ($with_doc) {
- $pdf->SetLink($pdf->PMA_links['RT'][$this->table_name][$field], -1);
- } else {
- $pdf->PMA_links['doc'][$this->table_name][$field] = '';
- }
-
- $pdf->PMA_PDF_cellScale($this->width, $this->height_cell, ' ' . $field, 1, 1, 'L', $setcolor, $pdf->PMA_links['doc'][$this->table_name][$field]);
- $pdf->PMA_PDF_setXScale($this->x);
- $pdf->SetFillColor(255);
- } // end while
- /*if ($pdf->PageNo() > 1) {
- $pdf->PMA_PDF_die(__('The scale factor is too small to fit the schema on one page'));
- } */
- } // end of the "PMA_RT_Table_draw()" method
- /**
- * The "PMA_RT_Table" constructor
- *
- * @param string table_name The table name
- * @param integer ff The font size
- * @param integer same_width The max. with among tables
- * @param boolean show_keys Whether to display keys or not
- * @param boolean show_info Whether to display table position or not
- * @global object The current PDF document
- * @global integer The current page number (from the
- * $cfg['Servers'][$i]['table_coords'] table)
- * @global array The relations settings
- * @global string The current db name
- * @access private
- * @see PMA_PDF, PMA_RT_Table::PMA_RT_Table_setWidth,
- PMA_RT_Table::PMA_RT_Table_setHeight
- */
- function __construct($table_name, $ff, &$same_wide_width, $show_keys = false, $show_info = false)
- {
- global $pdf, $pdf_page_number, $cfgRelation, $db;
-
- $this->table_name = $table_name;
- $sql = 'DESCRIBE ' . PMA_backquote($table_name);
- $result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE);
- if (!$result || !PMA_DBI_num_rows($result)) {
- $pdf->PMA_PDF_die(sprintf(__('The %s table doesn\'t exist!'), $table_name));
- }
- // load fields
- //check to see if it will load all fields or only the foreign keys
- if ($show_keys) {
- $indexes = PMA_Index::getFromTable($this->table_name, $db);
- $all_columns = array();
- foreach ($indexes as $index) {
- $all_columns = array_merge($all_columns, array_flip(array_keys($index->getColumns())));
- }
- $this->fields = array_keys($all_columns);
- } else {
- while ($row = PMA_DBI_fetch_row($result)) {
- $this->fields[] = $row[0];
- }
- }
-
- $this->show_info = $show_info;
-
- // height and width
- $this->PMA_RT_Table_setHeight();
- // setWidth must me after setHeight, because title
- // can include table height which changes table width
- $this->PMA_RT_Table_setWidth($ff);
- if ($same_wide_width < $this->width) {
- $same_wide_width = $this->width;
- }
- // x and y
- $sql = 'SELECT x, y FROM '
- . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
- . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
- . ' AND table_name = \'' . PMA_sqlAddslashes($table_name) . '\''
- . ' AND pdf_page_number = ' . $pdf_page_number;
- $result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
-
- if (!$result || !PMA_DBI_num_rows($result)) {
- $pdf->PMA_PDF_die(sprintf(__('Please configure the coordinates for table %s'), $table_name));
- }
- list($this->x, $this->y) = PMA_DBI_fetch_row($result);
- $this->x = (double) $this->x;
- $this->y = (double) $this->y;
- // displayfield
- $this->displayfield = PMA_getDisplayField($db, $table_name);
- // index
- $result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($table_name) . ';', null, PMA_DBI_QUERY_STORE);
- if (PMA_DBI_num_rows($result) > 0) {
- while ($row = PMA_DBI_fetch_assoc($result)) {
- if ($row['Key_name'] == 'PRIMARY') {
- $this->primary[] = $row['Column_name'];
- }
- }
- } // end if
- } // end of the "PMA_RT_Table()" method
-} // end class "PMA_RT_Table"
-/**
- * Draws relation links
- *
- * @access private
- * @see PMA_RT
- * @package phpMyAdmin
- */
-class PMA_RT_Relation {
- /**
- * Defines private properties
- */
- var $x_src, $y_src;
- var $src_dir ;
- var $dest_dir;
- var $x_dest, $y_dest;
- var $w_tick = 5;
-
- /**
- * Gets arrows coordinates
- *
- * @param string table The current table name
- * @param string column The relation column name
- * @return array Arrows coordinates
- * @access private
- */
- function PMA_RT_Relation_getXy($table, $column)
- {
- $pos = array_search($column, $table->fields);
- // x_left, x_right, y
- return array($table->x, $table->x + + $table->width, $table->y + ($pos + 1.5) * $table->height_cell);
- } // end of the "PMA_RT_Relation_getXy()" method
- /**
- * Do draws relation links
- *
- * @param boolean change_color Whether to use one color per relation or not
- * @param integer i The id of the link to draw
- * @global object The current PDF document
- * @access private
- * @see PMA_PDF
- */
- function PMA_RT_Relation_draw($change_color, $i)
- {
- global $pdf;
-
- if ($change_color) {
- $d = $i % 6;
- $j = ($i - $d) / 6;
- $j = $j % 4;
- $j++;
- $case = array(
- array(1, 0, 0),
- array(0, 1, 0),
- array(0, 0, 1),
- array(1, 1, 0),
- array(1, 0, 1),
- array(0, 1, 1)
- );
- list ($a, $b, $c) = $case[$d];
- $e = (1 - ($j - 1) / 6);
- $pdf->SetDrawColor($a * 255 * $e, $b * 255 * $e, $c * 255 * $e);
- } else {
- $pdf->SetDrawColor(0);
- } // end if... else...
- $pdf->PMA_PDF_setLineWidthScale(0.2);
- $pdf->PMA_PDF_lineScale($this->x_src, $this->y_src, $this->x_src + $this->src_dir * $this->w_tick, $this->y_src);
- $pdf->PMA_PDF_lineScale($this->x_dest + $this->dest_dir * $this->w_tick, $this->y_dest, $this->x_dest, $this->y_dest);
- $pdf->PMA_PDF_setLineWidthScale(0.1);
- $pdf->PMA_PDF_lineScale($this->x_src + $this->src_dir * $this->w_tick, $this->y_src, $this->x_dest + $this->dest_dir * $this->w_tick, $this->y_dest);
- // arrow
- $root2 = 2 * sqrt(2);
- $pdf->PMA_PDF_lineScale($this->x_src + $this->src_dir * $this->w_tick * 0.75, $this->y_src, $this->x_src + $this->src_dir * (0.75 - 1 / $root2) * $this->w_tick, $this->y_src + $this->w_tick / $root2);
- $pdf->PMA_PDF_lineScale($this->x_src + $this->src_dir * $this->w_tick * 0.75, $this->y_src, $this->x_src + $this->src_dir * (0.75 - 1 / $root2) * $this->w_tick, $this->y_src - $this->w_tick / $root2);
-
- $pdf->PMA_PDF_lineScale($this->x_dest + $this->dest_dir * $this->w_tick / 2, $this->y_dest, $this->x_dest + $this->dest_dir * (0.5 + 1 / $root2) * $this->w_tick, $this->y_dest + $this->w_tick / $root2);
- $pdf->PMA_PDF_lineScale($this->x_dest + $this->dest_dir * $this->w_tick / 2, $this->y_dest, $this->x_dest + $this->dest_dir * (0.5 + 1 / $root2) * $this->w_tick, $this->y_dest - $this->w_tick / $root2);
- $pdf->SetDrawColor(0);
- } // end of the "PMA_RT_Relation_draw()" method
- /**
- * The "PMA_RT_Relation" constructor
- *
- * @param string master_table The master table name
- * @param string master_field The relation field in the master table
- * @param string foreign_table The foreign table name
- * @param string foreigh_field The relation field in the foreign table
- * @access private
- * @see PMA_RT_Relation::PMA_RT_Relation_getXy
- */
- function __construct($master_table, $master_field, $foreign_table, $foreign_field)
- {
- $src_pos = $this->PMA_RT_Relation_getXy($master_table, $master_field);
- $dest_pos = $this->PMA_RT_Relation_getXy($foreign_table, $foreign_field);
- $src_left = $src_pos[0] - $this->w_tick;
- $src_right = $src_pos[1] + $this->w_tick;
- $dest_left = $dest_pos[0] - $this->w_tick;
- $dest_right = $dest_pos[1] + $this->w_tick;
-
- $d1 = abs($src_left - $dest_left);
- $d2 = abs($src_right - $dest_left);
- $d3 = abs($src_left - $dest_right);
- $d4 = abs($src_right - $dest_right);
- $d = min($d1, $d2, $d3, $d4);
-
- if ($d == $d1) {
- $this->x_src = $src_pos[0];
- $this->src_dir = -1;
- $this->x_dest = $dest_pos[0];
- $this->dest_dir = -1;
- } elseif ($d == $d2) {
- $this->x_src = $src_pos[1];
- $this->src_dir = 1;
- $this->x_dest = $dest_pos[0];
- $this->dest_dir = -1;
- } elseif ($d == $d3) {
- $this->x_src = $src_pos[0];
- $this->src_dir = -1;
- $this->x_dest = $dest_pos[1];
- $this->dest_dir = 1;
- } else {
- $this->x_src = $src_pos[1];
- $this->src_dir = 1;
- $this->x_dest = $dest_pos[1];
- $this->dest_dir = 1;
- }
- $this->y_src = $src_pos[2];
- $this->y_dest = $dest_pos[2];
- } // end of the "PMA_RT_Relation()" method
-} // end of the "PMA_RT_Relation" class
-/**
- * Draws and send the database schema
- *
- * @access public
- * @see PMA_PDF
- * @package phpMyAdmin
- */
-class PMA_RT {
- /**
- * Defines private properties
- */
- var $tables = array();
- var $relations = array();
- var $ff = PMA_PDF_FONT;
- var $x_max = 0;
- var $y_max = 0;
- var $scale;
- var $x_min = 100000;
- var $y_min = 100000;
- var $t_marg = 10;
- var $b_marg = 10;
- var $l_marg = 10;
- var $r_marg = 10;
- var $tablewidth;
- var $same_wide = 0;
-
- /**
- * Sets X and Y minimum and maximum for a table cell
- *
- * @param string table The table name
- * @access private
- */
- function PMA_RT_setMinMax($table)
- {
- $this->x_max = max($this->x_max, $table->x + $table->width);
- $this->y_max = max($this->y_max, $table->y + $table->height);
- $this->x_min = min($this->x_min, $table->x);
- $this->y_min = min($this->y_min, $table->y);
- } // end of the "PMA_RT_setMinMax()" method
- /**
- * Defines relation objects
- *
- * @param string master_table The master table name
- * @param string master_field The relation field in the master table
- * @param string foreign_table The foreign table name
- * @param string foreign_field The relation field in the foreign table
- * @param boolean show_info Whether to display table position or not
- * @access private
- * @see PMA_RT_setMinMax
- */
- function PMA_RT_addRelation($master_table, $master_field, $foreign_table, $foreign_field, $show_info)
- {
- if (!isset($this->tables[$master_table])) {
- $this->tables[$master_table] = new PMA_RT_Table($master_table, $this->ff, $this->tablewidth, false, $show_info);
- $this->PMA_RT_setMinMax($this->tables[$master_table]);
- }
- if (!isset($this->tables[$foreign_table])) {
- $this->tables[$foreign_table] = new PMA_RT_Table($foreign_table, $this->ff, $this->tablewidth, false, $show_info);
- $this->PMA_RT_setMinMax($this->tables[$foreign_table]);
- }
- $this->relations[] = new PMA_RT_Relation($this->tables[$master_table], $master_field, $this->tables[$foreign_table], $foreign_field);
- } // end of the "PMA_RT_addRelation()" method
- /**
- * Draws the grid
- *
- * @global object the current PMA_PDF instance
- * @access private
- * @see PMA_PDF
- */
- function PMA_RT_strokeGrid()
- {
- global $pdf;
-
- $pdf->SetMargins(0, 0);
- $pdf->SetDrawColor(200, 200, 200);
- // Draws horizontal lines
- for ($l = 0; $l < 21; $l++) {
- $pdf->line(0, $l * 10, $pdf->getFh(), $l * 10);
- // Avoid duplicates
- if ($l > 0) {
- $pdf->SetXY(0, $l * 10);
- $label = (string) sprintf('%.0f', ($l * 10 - $this->t_marg) * $this->scale + $this->y_min);
- $pdf->Cell(5, 5, ' ' . $label);
- } // end if
- } // end for
- // Draws vertical lines
- for ($j = 0; $j < 30 ;$j++) {
- $pdf->line($j * 10, 0, $j * 10, $pdf->getFw());
- $pdf->SetXY($j * 10, 0);
- $label = (string) sprintf('%.0f', ($j * 10 - $this->l_marg) * $this->scale + $this->x_min);
- $pdf->Cell(5, 7, $label);
- } // end for
- } // end of the "PMA_RT_strokeGrid()" method
- /**
- * Draws relation arrows
- *
- * @param boolean change_color Whether to use one color per relation or not
- * @access private
- * @see PMA_RT_Relation::PMA_RT_Relation_draw()
- */
- function PMA_RT_drawRelations($change_color)
- {
- $i = 0;
- foreach ($this->relations AS $relation) {
- $relation->PMA_RT_Relation_draw($change_color, $i);
- $i++;
- } // end while
- } // end of the "PMA_RT_drawRelations()" method
- /**
- * Draws tables
- *
- * @param boolean draw_color Whether to display table position or not
- * @access private
- * @see PMA_RT_Table::PMA_RT_Table_draw()
- */
- function PMA_RT_drawTables($draw_color = 0)
- {
- foreach ($this->tables AS $table) {
- $table->PMA_RT_Table_draw($this->ff, $draw_color);
- }
- } // end of the "PMA_RT_drawTables()" method
- /**
- * Ouputs the PDF document to a file
- *
- * @global object The current PDF document
- * @global string The current database name
- * @global integer The current page number (from the
- * $cfg['Servers'][$i]['table_coords'] table)
- * @access private
- * @see PMA_PDF
- */
- function PMA_RT_showRt()
- {
- global $pdf, $db, $pdf_page_number, $cfgRelation;
-
- $pdf->SetFontSize(14);
- $pdf->SetLineWidth(0.2);
- $pdf->SetDisplayMode('fullpage');
- // Get the name of this pdfpage to use as filename (Mike Beck)
- $_name_sql = 'SELECT page_descr FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
- . ' WHERE page_nr = ' . $pdf_page_number;
- $_name_rs = PMA_query_as_controluser($_name_sql);
- if ($_name_rs) {
- $_name_row = PMA_DBI_fetch_row($_name_rs);
- $filename = $_name_row[0] . '.pdf';
- }
- // i don't know if there is a chance for this to happen, but rather be on the safe side:
- if (empty($filename)) {
- $filename = $pdf_page_number . '.pdf';
- }
- // $pdf->Output($db . '_' . $filename, TRUE);
- $pdf->Output($db . '_' . $filename, 'I'); // destination: Inline
- } // end of the "PMA_RT_showRt()" method
- /**
- * The "PMA_RT" constructor
- *
- * @param integer which_rel The page number to draw (from the
- * $cfg['Servers'][$i]['table_coords'] table)
- * @param boolean show_info Whether to display table position or not
- * @param boolean change_color Was originally whether to use one color per
- * relation or not, now enables/disables color
- * everywhere, due to some problems printing with color
- * @param boolean show_grid Whether to draw grids or not
- * @param boolean all_tab_same_wide Whether all tables should have the same width or not
- * @param boolean show_keys Wheter to show all field or only the keys
- * @global object The current PDF document
- * @global string The current db name
- * @global array The relations settings
- * @access private
- * @see PMA_PDF
- */
- function __construct($which_rel, $show_info = 0, $change_color = 0, $show_grid = 0, $all_tab_same_wide = 0, $orientation = 'L', $paper = 'A4', $show_keys = 0)
- {
- global $pdf, $db, $cfgRelation, $with_doc;
-
- $this->same_wide = $all_tab_same_wide;
- // Initializes a new document
- $pdf = new PMA_PDF('L', 'mm', $paper);
- $pdf->SetTitle(sprintf(__('Schema of the %s database - Page %s'), $GLOBALS['db'], $which_rel));
- $pdf->setCMargin(0);
- $pdf->Open();
- $pdf->SetAuthor('phpMyAdmin ' . PMA_VERSION);
- $pdf->AliasNbPages();
- $pdf->AddFont('DejaVuSans', '', 'dejavusans.php');
- $pdf->AddFont('DejaVuSans', 'B', 'dejavusansb.php');
- $pdf->AddFont('DejaVuSerif', '', 'dejavuserif.php');
- $pdf->AddFont('DejaVuSerif', 'B', 'dejavuserifb.php');
- $this->ff = PMA_PDF_FONT;
- $pdf->SetFont($this->ff, '', 14);
- $pdf->SetAutoPageBreak('auto');
- // Gets tables on this page
- $tab_sql = 'SELECT table_name FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
- . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
- . ' AND pdf_page_number = ' . $which_rel;
- $tab_rs = PMA_query_as_controluser($tab_sql, null, PMA_DBI_QUERY_STORE);
- if (!$tab_rs || !PMA_DBI_num_rows($tab_rs) > 0) {
- $pdf->PMA_PDF_die(__('No tables'));
- // die('No tables');
- } while ($curr_table = @PMA_DBI_fetch_assoc($tab_rs)) {
- $alltables[] = PMA_sqlAddslashes($curr_table['table_name']);
- // $intable = '\'' . implode('\', \'', $alltables) . '\'';
- }
- // make doc //
- if ($with_doc) {
- $pdf->SetAutoPageBreak('auto', 15);
- $pdf->setCMargin(1);
- PMA_RT_DOC($alltables);
- $pdf->SetAutoPageBreak('auto');
- $pdf->setCMargin(0);
- }
-
- $pdf->Addpage();
-
- if ($with_doc) {
- $pdf->SetLink($pdf->PMA_links['RT']['-'], -1);
- $pdf->Bookmark(__('Relational schema'));
- $pdf->SetAlias('{00}', $pdf->PageNo()) ;
- $this->t_marg = 18;
- $this->b_marg = 18;
- }
-
- /* snip */
-
- foreach ($alltables AS $table) {
- if (!isset($this->tables[$table])) {
- $this->tables[$table] = new PMA_RT_Table($table, $this->ff, $this->tablewidth, $show_keys, $show_info);
- }
-
- if ($this->same_wide) {
- $this->tables[$table]->width = $this->tablewidth;
- }
- $this->PMA_RT_setMinMax($this->tables[$table]);
- }
- // Defines the scale factor
- $this->scale = ceil(
- max(
- ($this->x_max - $this->x_min) / ($pdf->getFh() - $this->r_marg - $this->l_marg),
- ($this->y_max - $this->y_min) / ($pdf->getFw() - $this->t_marg - $this->b_marg))
- * 100) / 100;
-
- $pdf->PMA_PDF_setScale($this->scale, $this->x_min, $this->y_min, $this->l_marg, $this->t_marg);
- // Builds and save the PDF document
- $pdf->PMA_PDF_setLineWidthScale(0.1);
-
- if ($show_grid) {
- $pdf->SetFontSize(10);
- $this->PMA_RT_strokeGrid();
- }
- $pdf->PMA_PDF_setFontSizeScale(14);
- // $sql = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
- // . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\' '
- // . ' AND foreign_db = \'' . PMA_sqlAddslashes($db) . '\' '
- // . ' AND master_table IN (' . $intable . ')'
- // . ' AND foreign_table IN (' . $intable . ')';
- // $result = PMA_query_as_controluser($sql);
-
- // previous logic was checking master tables and foreign tables
- // but I think that looping on every table of the pdf page as a master
- // and finding its foreigns is OK (then we can support innodb)
- $seen_a_relation = false;
- foreach ($alltables AS $one_table) {
- $exist_rel = PMA_getForeigners($db, $one_table, '', 'both');
- if ($exist_rel) {
- $seen_a_relation = true;
- foreach ($exist_rel AS $master_field => $rel) {
- // put the foreign table on the schema only if selected
- // by the user
- // (do not use array_search() because we would have to
- // to do a === FALSE and this is not PHP3 compatible)
- if (in_array($rel['foreign_table'], $alltables)) {
- $this->PMA_RT_addRelation($one_table, $master_field, $rel['foreign_table'], $rel['foreign_field'], $show_info);
- }
- } // end while
- } // end if
- } // end while
- // also show tables without relations
- // $norelations = TRUE;
- // if ($result && PMA_DBI_num_rows($result) > 0) {
- // $norelations = FALSE;
- // while ($row = PMA_DBI_fetch_assoc($result)) {
- // $this->PMA_RT_addRelation($row['master_table'], $row['master_field'], $row['foreign_table'], $row['foreign_field']);
- // }
- // }
- // if ($norelations == FALSE) {
- if ($seen_a_relation) {
- $this->PMA_RT_drawRelations($change_color);
- }
-
- $this->PMA_RT_drawTables($change_color);
-
- $this->PMA_RT_showRt();
- } // end of the "PMA_RT()" method
-} // end of the "PMA_RT" class
-
-function PMA_RT_DOC($alltables)
-{
- global $db, $pdf, $orientation, $paper;
- // TOC
- $pdf->addpage($GLOBALS['orientation']);
- $pdf->Cell(0, 9, __('Table of contents'), 1, 0, 'C');
- $pdf->Ln(15);
- $i = 1;
- foreach ($alltables AS $table) {
- $pdf->PMA_links['doc'][$table]['-'] = $pdf->AddLink();
- $pdf->SetX(10);
- // $pdf->Ln(1);
- $pdf->Cell(0, 6, __('Page number:') . ' {' . sprintf("%02d", $i + 1) . '}', 0, 0, 'R', 0, $pdf->PMA_links['doc'][$table]['-']);
- $pdf->SetX(10);
- $pdf->Cell(0, 6, $i . ' ' . $table, 0, 1, 'L', 0, $pdf->PMA_links['doc'][$table]['-']);
- // $pdf->Ln(1);
- $result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';');
- while ($row = PMA_DBI_fetch_assoc($result)) {
- $pdf->SetX(20);
- $field_name = $row['Field'];
- $pdf->PMA_links['doc'][$table][$field_name] = $pdf->AddLink();
- // $pdf->Cell(0, 6, $field_name,0,1,'L',0, $pdf->PMA_links['doc'][$table][$field_name]);
- }
- $lasttable = $table;
- $i++;
- }
- $pdf->PMA_links['RT']['-'] = $pdf->AddLink();
- $pdf->SetX(10);
- $pdf->Cell(0, 6, __('Page number:') . ' {' . sprintf("%02d", $i + 1) . '}', 0, 0, 'R', 0, $pdf->PMA_links['doc'][$lasttable]['-']);
- $pdf->SetX(10);
- $pdf->Cell(0, 6, $i + 1 . ' ' . __('Relational schema'), 0, 1, 'L', 0, $pdf->PMA_links['RT']['-']);
- $z = 0;
- foreach ($alltables AS $table) {
- $z++;
- $pdf->addpage($GLOBALS['orientation']);
- $pdf->Bookmark($table);
- $pdf->SetAlias('{' . sprintf("%02d", $z) . '}', $pdf->PageNo()) ;
- $pdf->PMA_links['RT'][$table]['-'] = $pdf->AddLink();
- $pdf->SetLink($pdf->PMA_links['doc'][$table]['-'], -1);
- $pdf->SetFont('', 'B', 18);
- $pdf->Cell(0, 8, $z . ' ' . $table, 1, 1, 'C', 0, $pdf->PMA_links['RT'][$table]['-']);
- $pdf->SetFont('', '', 8);
- $pdf->ln();
-
- $cfgRelation = PMA_getRelationsParam();
- $comments = PMA_getComments($db, $table);
- if ($cfgRelation['mimework']) {
- $mime_map = PMA_getMIME($db, $table, true);
- }
-
- /**
- * Gets table informations
- */
- $showtable = PMA_Table::sGetStatusInfo($db, $table);
- $num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
- $show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
- $create_time = (isset($showtable['Create_time']) ? PMA_localisedDate(strtotime($showtable['Create_time'])) : '');
- $update_time = (isset($showtable['Update_time']) ? PMA_localisedDate(strtotime($showtable['Update_time'])) : '');
- $check_time = (isset($showtable['Check_time']) ? PMA_localisedDate(strtotime($showtable['Check_time'])) : '');
-
- /**
- * Gets table keys and retains them
- */
- $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';');
- $primary = '';
- $indexes = array();
- $lastIndex = '';
- $indexes_info = array();
- $indexes_data = array();
- $pk_array = array(); // will be use to emphasis prim. keys in the table
- // view
- while ($row = PMA_DBI_fetch_assoc($result)) {
- // Backups the list of primary keys
- if ($row['Key_name'] == 'PRIMARY') {
- $primary .= $row['Column_name'] . ', ';
- $pk_array[$row['Column_name']] = 1;
- }
- // Retains keys informations
- if ($row['Key_name'] != $lastIndex) {
- $indexes[] = $row['Key_name'];
- $lastIndex = $row['Key_name'];
- }
- $indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index'];
- $indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique'];
- if (isset($row['Cardinality'])) {
- $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality'];
- }
- // I don't know what does following column mean....
- // $indexes_info[$row['Key_name']]['Packed'] = $row['Packed'];
- $indexes_info[$row['Key_name']]['Comment'] = $row['Comment'];
-
- $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name'];
- if (isset($row['Sub_part'])) {
- $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part'];
- }
- } // end while
- if ($result) {
- PMA_DBI_free_result($result);
- }
-
- /**
- * Gets fields properties
- */
- $result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE);
- $fields_cnt = PMA_DBI_num_rows($result);
- // Check if we can use Relations (Mike Beck)
- if (!empty($cfgRelation['relation'])) {
- // Find which tables are related with the current one and write it in
- // an array
- $res_rel = PMA_getForeigners($db, $table);
-
- if (count($res_rel) > 0) {
- $have_rel = true;
- } else {
- $have_rel = false;
- }
- } else {
- $have_rel = false;
- } // end if
- /**
- * Displays the comments of the table if MySQL >= 3.23
- */
-
- $break = false;
- if (!empty($show_comment)) {
- $pdf->Cell(0, 3, __('Table comments') . ' : ' . $show_comment, 0, 1);
- $break = true;
- }
-
- if (!empty($create_time)) {
- $pdf->Cell(0, 3, __('Creation') . ': ' . $create_time, 0, 1);
- $break = true;
- }
-
- if (!empty($update_time)) {
- $pdf->Cell(0, 3, __('Last update') . ': ' . $update_time, 0, 1);
- $break = true;
- }
-
- if (!empty($check_time)) {
- $pdf->Cell(0, 3, __('Last check') . ': ' . $check_time, 0, 1);
- $break = true;
- }
-
- if ($break == true) {
- $pdf->Cell(0, 3, '', 0, 1);
- $pdf->Ln();
- }
-
- $pdf->SetFont('', 'B');
- if (isset($orientation) && $orientation == 'L') {
- $pdf->Cell(25, 8, ucfirst(__('Column')), 1, 0, 'C');
- $pdf->Cell(20, 8, ucfirst(__('Type')), 1, 0, 'C');
- $pdf->Cell(20, 8, ucfirst(__('Attributes')), 1, 0, 'C');
- $pdf->Cell(10, 8, ucfirst(__('Null')), 1, 0, 'C');
- $pdf->Cell(20, 8, ucfirst(__('Default')), 1, 0, 'C');
- $pdf->Cell(25, 8, ucfirst(__('Extra')), 1, 0, 'C');
- $pdf->Cell(45, 8, ucfirst(__('Links to')), 1, 0, 'C');
-
- if ($paper == 'A4') {
- $comments_width = 67;
- } else {
- // this is really intended for 'letter'
- /**
- * @todo find optimal width for all formats
- */
- $comments_width = 50;
- }
- $pdf->Cell($comments_width, 8, ucfirst(__('Comments')), 1, 0, 'C');
- $pdf->Cell(45, 8, 'MIME', 1, 1, 'C');
- $pdf->SetWidths(array(25, 20, 20, 10, 20, 25, 45, $comments_width, 45));
- } else {
- $pdf->Cell(20, 8, ucfirst(__('Column')), 1, 0, 'C');
- $pdf->Cell(20, 8, ucfirst(__('Type')), 1, 0, 'C');
- $pdf->Cell(20, 8, ucfirst(__('Attributes')), 1, 0, 'C');
- $pdf->Cell(10, 8, ucfirst(__('Null')), 1, 0, 'C');
- $pdf->Cell(15, 8, ucfirst(__('Default')), 1, 0, 'C');
- $pdf->Cell(15, 8, ucfirst(__('Extra')), 1, 0, 'C');
- $pdf->Cell(30, 8, ucfirst(__('Links to')), 1, 0, 'C');
- $pdf->Cell(30, 8, ucfirst(__('Comments')), 1, 0, 'C');
- $pdf->Cell(30, 8, 'MIME', 1, 1, 'C');
- $pdf->SetWidths(array(20, 20, 20, 10, 15, 15, 30, 30, 30));
- }
- $pdf->SetFont('', '');
-
- while ($row = PMA_DBI_fetch_assoc($result)) {
- $type = $row['Type'];
- // reformat mysql query output
- // set or enum types: slashes single quotes inside options
- if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) {
- $tmp[2] = substr(preg_replace("@([^,])''@", "\\1\\'", ',' . $tmp[2]), 1);
- $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
- $type_nowrap = '';
-
- $binary = 0;
- $unsigned = 0;
- $zerofill = 0;
- } else {
- $type_nowrap = ' nowrap="nowrap"';
- $type = preg_replace('@BINARY@i', '', $type);
- $type = preg_replace('@ZEROFILL@i', '', $type);
- $type = preg_replace('@UNSIGNED@i', '', $type);
- if (empty($type)) {
- $type = ' ';
- }
-
- $binary = stristr($row['Type'], 'BINARY');
- $unsigned = stristr($row['Type'], 'UNSIGNED');
- $zerofill = stristr($row['Type'], 'ZEROFILL');
- }
- $attribute = ' ';
- if ($binary) {
- $attribute = 'BINARY';
- }
- if ($unsigned) {
- $attribute = 'UNSIGNED';
- }
- if ($zerofill) {
- $attribute = 'UNSIGNED ZEROFILL';
- }
- if (!isset($row['Default'])) {
- if ($row['Null'] != '' && $row['Null'] != 'NO') {
- $row['Default'] = 'NULL';
- }
- }
- $field_name = $row['Field'];
- // $pdf->Ln();
- $pdf->PMA_links['RT'][$table][$field_name] = $pdf->AddLink();
- $pdf->Bookmark($field_name, 1, -1);
- $pdf->SetLink($pdf->PMA_links['doc'][$table][$field_name], -1);
- $pdf_row = array($field_name,
- $type,
- $attribute,
- ($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes'),
- ((isset($row['Default'])) ? $row['Default'] : ''),
- $row['Extra'],
- ((isset($res_rel[$field_name])) ? $res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field'] : ''),
- ((isset($comments[$field_name])) ? $comments[$field_name] : ''),
- ((isset($mime_map) && isset($mime_map[$field_name])) ? str_replace('_', '/', $mime_map[$field_name]['mimetype']) : '')
- );
- $links[0] = $pdf->PMA_links['RT'][$table][$field_name];
- if (isset($res_rel[$field_name]['foreign_table']) AND
- isset($res_rel[$field_name]['foreign_field']) AND
- isset($pdf->PMA_links['doc'][$res_rel[$field_name]['foreign_table']][$res_rel[$field_name]['foreign_field']])
- )
- {
- $links[6] = $pdf->PMA_links['doc'][$res_rel[$field_name]['foreign_table']][$res_rel[$field_name]['foreign_field']];
- } else {
- unset($links[6]);
- }
- $pdf->Row($pdf_row, $links);
-
- /*$pdf->Cell(20, 8, $field_name, 1, 0, 'L', 0, $pdf->PMA_links['RT'][$table][$field_name]);
- //echo ' ' . $field_name . ' ' . "\n";
- }
- $pdf->Cell(20, 8, $type, 1, 0, 'L');
- $pdf->Cell(20, 8, $attribute, 1, 0, 'L');
- $pdf->Cell(15, 8, , 1, 0, 'L');
- $pdf->Cell(15, 8, ((isset($row['Default'])) ? $row['Default'] : ''),1,0,'L');
- $pdf->Cell(15, 8, $row['Extra'], 1, 0, 'L');
- if ($have_rel) {
- if (isset($res_rel[$field_name])) {
- $pdf->Cell(30, 8, $res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field'],1,0,'L');
- }
- }
- if ($cfgRelation['commwork']) {
- if (isset($comments[$field_name])) {
- $pdf->Cell(0, 8, $comments[$field_name], 1, 0, 'L');
- }
- } */
- } // end while
- $pdf->SetFont('', '', 14);
- PMA_DBI_free_result($result);
- } //end each
-} // end function PMA_RT_DOC
-
-/**
- * Main logic
- */
-if (!isset($pdf_page_number)) {
- $pdf_page_number = 1;
-}
-
-$show_grid = (isset($show_grid) && $show_grid == 'on') ? 1 : 0;
-$show_color = (isset($show_color) && $show_color == 'on') ? 1 : 0;
-$show_table_dimension = (isset($show_table_dimension) && $show_table_dimension == 'on') ? 1 : 0;
-$all_tab_same_wide = (isset($all_tab_same_wide) && $all_tab_same_wide == 'on') ? 1 : 0;
-$with_doc = (isset($with_doc) && $with_doc == 'on') ? 1 : 0;
-$orientation = (isset($orientation) && $orientation == 'P') ? 'P' : 'L';
-$paper = isset($paper) ? $paper : 'A4';
-$show_keys = (isset($show_keys) && $show_keys == 'on') ? 1 : 0;
-PMA_DBI_select_db($db);
-
-$rt = new PMA_RT($pdf_page_number, $show_table_dimension, $show_color, $show_grid, $all_tab_same_wide, $orientation, $paper, $show_keys);
-
-?>
diff --git a/schema_edit.php b/schema_edit.php
new file mode 100644
index 0000000..fb15d00
--- /dev/null
+++ b/schema_edit.php
@@ -0,0 +1,140 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ *
+ * @version $Id$
+ * @package phpMyAdmin
+ */
+
+/**
+ * Gets some core libraries
+ */
+
+require_once './libraries/common.inc.php';
+require_once './libraries/db_common.inc.php';
+require './libraries/StorageEngine.class.php';
+
+$active_page = 'db_operations.php';
+require_once './libraries/db_common.inc.php';
+$url_query .= '&goto=schema_edit.php';
+require_once './libraries/db_info.inc.php';
+
+/**
+ * Includ settings for relation stuff
+ * get all variables needed for exporting relational schema
+ * in $cfgRelation
+ */
+require_once './libraries/relation.lib.php';
+$cfgRelation = PMA_getRelationsParam();
+
+/**
+ * This is to avoid "Command out of sync" errors. Before switching this to
+ * a value of 0 (for MYSQLI_USE_RESULT), please check the logic
+ * to free results wherever needed.
+ */
+$query_default_option = PMA_DBI_QUERY_STORE;
+
+/**
+ * Now in ./libraries/relation.lib.php we check for all tables
+ * that we need, but if we don't find them we are quiet about it
+ * so people can't work without relational variables.
+ * This page is absolutely useless if you didn't set up your tables
+ * correctly, so it is a good place to see which tables we can and
+ * complain ;-)
+ */
+if (!$cfgRelation['relwork']) {
+ echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'relation', 'config.inc.php') . '<br />' . "\n"
+ . PMA_showDocu('relation') . "\n";
+ require_once './libraries/footer.inc.php';
+}
+
+if (!$cfgRelation['displaywork']) {
+ echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_info', 'config.inc.php') . '<br />' . "\n"
+ . PMA_showDocu('table_info') . "\n";
+ require_once './libraries/footer.inc.php';
+}
+
+if (!isset($cfgRelation['table_coords'])){
+ echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_coords', 'config.inc.php') . '<br />' . "\n"
+ . PMA_showDocu('table_coords') . "\n";
+ require_once './libraries/footer.inc.php';
+}
+if (!isset($cfgRelation['pdf_pages'])) {
+ echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'pdf_page', 'config.inc.php') . '<br />' . "\n"
+ . PMA_showDocu('pdf_pages') . "\n";
+ require_once './libraries/footer.inc.php';
+}
+
+if ($cfgRelation['pdfwork']) {
+
+ /**
+ * User object created for presenting the HTML options
+ * so, user can interact with it and perform export of relations schema
+ */
+
+ require_once './libraries/schema/User_Schema.class.php';
+ $user_schema = new PMA_User_Schema();
+
+ /**
+ * This function will process the user defined pages
+ * and tables which will be exported as Relational schema
+ * you can set the table positions on the paper via scratchboard
+ * for table positions, put the x,y co-ordinates
+ *
+ * @param string $do It tells what the Schema is supposed to do
+ * create and select a page, generate schema etc
+ */
+ if(isset($_REQUEST['do'])){
+ $user_schema->setAction($_REQUEST['do']);
+ $user_schema->processUserPreferences();
+ }
+
+ /**
+ * Show some possibility to select a page for the export of relation schema
+ * Lists all pages created before and can select and edit from them
+ */
+
+ $user_schema->selectPage();
+
+ /**
+ * Create a new page where relations will be drawn
+ */
+
+ $user_schema->createPage($db);
+
+ /**
+ * After selection of page or creating a page
+ * It will show you the list of tables
+ * A dashboard will also be shown where you can position the tables
+ */
+
+ $user_schema->showTableDashBoard();
+
+ if (isset($_REQUEST['do'])
+ && ($_REQUEST['do'] == 'edcoord'
+ || ($_REQUEST['do']== 'selectpage' && isset($user_schema->choosenPage) && $user_schema->choosenPage != 0)
+ || ($_REQUEST['do'] == 'createpage' && isset($user_schema->choosenPage) && $user_schema->choosenPage != 0))) {
+
+ /**
+ * show Export schema generation options
+ */
+ $user_schema->displaySchemaGenerationOptions();
+
+ if ((isset($showwysiwyg) && $showwysiwyg == '1')) {
+ ?>
+ <script type="text/javascript">
+ //<![CDATA[
+ ToggleDragDrop('pdflayout');
+ //]]>
+ </script>
+ <?php
+ }
+ } // end if
+} // end if ($cfgRelation['pdfwork'])
+
+/**
+ * Displays the footer
+ */
+echo "\n";
+require_once './libraries/footer.inc.php';
+?>
diff --git a/schema_export.php b/schema_export.php
new file mode 100644
index 0000000..9f74fea
--- /dev/null
+++ b/schema_export.php
@@ -0,0 +1,49 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ *
+ * @version $Id$
+ * @package phpMyAdmin
+ */
+
+/**
+ * Gets some core libraries
+ */
+require_once './libraries/common.inc.php';
+require './libraries/StorageEngine.class.php';
+
+/**
+ * Include settings for relation stuff
+ * get all variables needed for exporting relational schema
+ * in $cfgRelation
+ */
+require_once './libraries/relation.lib.php';
+$cfgRelation = PMA_getRelationsParam();
+
+require_once './libraries/transformations.lib.php';
+require_once './libraries/Index.class.php';
+
+/**
+ * This is to avoid "Command out of sync" errors. Before switching this to
+ * a value of 0 (for MYSQLI_USE_RESULT), please check the logic
+ * to free results wherever needed.
+ */
+$query_default_option = PMA_DBI_QUERY_STORE;
+
+include_once("./libraries/schema/Export_Relation_Schema.class.php");
+
+/**
+ * get all the export options and verify
+ * call and include the appropriate Schema Class depending on $export_type
+ * default is PDF
+ */
+global $db,$export_type;
+$export_type = isset($export_type) ? $export_type : 'pdf';
+PMA_DBI_select_db($db);
+
+$path = PMA_securePath(ucfirst($export_type));
+if (!file_exists('./libraries/schema/' . $path . '_Relation_Schema.class.php')) {
+ PMA_Export_Relation_Schema::dieSchema($_POST['chpage'],$export_type,__('File doesn\'t exist'));
+}
+include("./libraries/schema/".$path."_Relation_Schema.class.php");
+$obj_schema = eval("new PMA_".$path."_Relation_Schema();");
\ No newline at end of file
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_5_1-7260-ge6c7aaa
by Marc Delisle 22 Aug '10
by Marc Delisle 22 Aug '10
22 Aug '10
The branch, master has been updated
via e6c7aaad340854ae1aab19582c1f5529df165102 (commit)
from 4a1b6af94429616de009866b11b525356dd6a37d (commit)
- Log -----------------------------------------------------------------
commit e6c7aaad340854ae1aab19582c1f5529df165102
Author: Marc Delisle <marc(a)infomarc.info>
Date: Sun Aug 22 08:52:15 2010 -0400
simplify logic and rename parameter
-----------------------------------------------------------------------
Summary of changes:
sql.php | 10 ++++------
tbl_structure.php | 2 +-
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/sql.php b/sql.php
index a3ae0cf..12c6ac5 100644
--- a/sql.php
+++ b/sql.php
@@ -178,8 +178,7 @@ if ($do_confirm) {
<input type="hidden" name="back" value="<?php echo isset($back) ? PMA_sanitize($back, true) : ''; ?>" />
<input type="hidden" name="reload" value="<?php echo isset($reload) ? PMA_sanitize($reload, true) : 0; ?>" />
<input type="hidden" name="purge" value="<?php echo isset($purge) ? PMA_sanitize($purge, true) : ''; ?>" />
- <input type="hidden" name="cpurge" value="<?php echo isset($cpurge) ? PMA_sanitize($cpurge, true) : ''; ?>" />
- <input type="hidden" name="purgekey" value="<?php echo isset($purgekey) ? PMA_sanitize($purgekey, true) : ''; ?>" />
+ <input type="hidden" name="dropped_column" value="<?php echo isset($dropped_column) ? PMA_sanitize($dropped_column, true) : ''; ?>" />
<input type="hidden" name="show_query" value="<?php echo isset($show_query) ? PMA_sanitize($show_query, true) : ''; ?>" />
<?php
echo '<fieldset class="confirmation">' . "\n"
@@ -465,12 +464,11 @@ if (isset($GLOBALS['show_as_php']) || !empty($GLOBALS['validatequery'])) {
} // end if ($purge)
// If a column gets dropped, do relation magic.
- if (isset($cpurge) && $cpurge == '1' && isset($purgekey)
- && strlen($db) && strlen($table) && !empty($purgekey)) {
+ if (isset($dropped_column) && strlen($db) && strlen($table) && !empty($dropped_column)) {
require_once './libraries/relation_cleanup.lib.php';
- PMA_relationsCleanupColumn($db, $table, $purgekey);
+ PMA_relationsCleanupColumn($db, $table, $dropped_column);
- } // end if column PMA_* purge
+ } // end if column was dropped
} // end else "didn't ask to see php code"
// No rows returned -> move back to the calling page
diff --git a/tbl_structure.php b/tbl_structure.php
index c9c7fd3..e1b29f9 100644
--- a/tbl_structure.php
+++ b/tbl_structure.php
@@ -392,7 +392,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
<?php echo $titles['Change']; ?></a>
</td>
<td align="center" class="drop">
- <a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP ' . PMA_backquote($row['Field'])); ?>&cpurge=1&purgekey=<?php echo urlencode($row['Field']); ?>&zero_rows=<?php echo urlencode(sprintf(__('Column %s has been dropped'), htmlspecialchars($row['Field']))); ?>"
+ <a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP ' . PMA_backquote($row['Field'])); ?>&dropped_column=<?php echo urlencode($row['Field']); ?>&zero_rows=<?php echo urlencode(sprintf(__('Column %s has been dropped'), htmlspecialchars($row['Field']))); ?>"
onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table); ?> DROP <?php echo PMA_jsFormat($row['Field']); ?>')">
<?php echo $titles['Drop']; ?></a>
</td>
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin website branch, master, updated. 4879bee1c7309200dbccffcce54e540b1ecf5965
by Marc Delisle 21 Aug '10
by Marc Delisle 21 Aug '10
21 Aug '10
The branch, master has been updated
via 4879bee1c7309200dbccffcce54e540b1ecf5965 (commit)
via 7f26369cc2610ad6b7be4641c337d255b40ca230 (commit)
from a20fe8aefed968b4ce51ac258197e5fa61fbc6a7 (commit)
- Log -----------------------------------------------------------------
commit 4879bee1c7309200dbccffcce54e540b1ecf5965
Author: Marc Delisle <marc(a)infomarc.info>
Date: Sat Aug 21 13:19:38 2010 -0400
now 62 languages
commit 7f26369cc2610ad6b7be4641c337d255b40ca230
Author: Aung Khant <aungkhant(a)yehg.net>
Date: Sat Aug 21 13:16:18 2010 -0400
some security advices were shown under the list of advices instead of on the right side
-----------------------------------------------------------------------
Summary of changes:
css/style.css | 5 ++---
templates/index.tpl | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/css/style.css b/css/style.css
index efd063f..02580fc 100644
--- a/css/style.css
+++ b/css/style.css
@@ -58,8 +58,7 @@ div.demo#body {
#body {
margin: 2em 1em 1em 1em;
- padding: 0px;
- float: left;
+ padding-top:1%;
}
a {
@@ -194,7 +193,7 @@ ul.dllist li {
#left {
margin: 2em 1em 1em 1em;
float: left;
- padding: 0 2em 0 2em;
+ padding: 0pt 2em;
}
#left ul {
margin: 0;
diff --git a/templates/index.tpl b/templates/index.tpl
index f8c29e4..1033f06 100644
--- a/templates/index.tpl
+++ b/templates/index.tpl
@@ -48,7 +48,7 @@ and Spanish.
<p>
To ease usage to a wide range of people, phpMyAdmin is translated into <a
-href="${base_url}translations.${file_ext}">58 languages</a> and supports both LTR
+href="${base_url}translations.${file_ext}">62 languages</a> and supports both LTR
and RTL languages.
</p>
hooks/post-receive
--
phpMyAdmin website
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_5_1-7257-g2c345d1
by Marc Delisle 21 Aug '10
by Marc Delisle 21 Aug '10
21 Aug '10
The branch, master has been updated
via 2c345d10873d4be23b3e1b5e80f86b669b1510d6 (commit)
from 82acbb2ba3c9aed9f934650575666920e2fd9bab (commit)
- Log -----------------------------------------------------------------
commit 2c345d10873d4be23b3e1b5e80f86b669b1510d6
Author: Marc Delisle <marc(a)infomarc.info>
Date: Sat Aug 21 08:09:24 2010 -0400
credit for user preferences; new terminology (configuration storage)
-----------------------------------------------------------------------
Summary of changes:
Documentation.html | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Documentation.html b/Documentation.html
index 7077d2a..0b0a29b 100644
--- a/Documentation.html
+++ b/Documentation.html
@@ -1155,7 +1155,8 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE</pre>
To allow the usage of this functionality:
<ul>
- <li>set up <a href="#pmadb">pmadb</a> and the linked-tables infrastructure</li>
+ <li>set up <a href="#pmadb">pmadb</a> and the phpMyAdmin
+ configuration storage</li>
<li>put the table name in <tt>$cfg['Servers'][$i]['userconfig']</tt></li>
</ul>
</dd>
@@ -4831,9 +4832,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
<li>BLOBstreaming support</li>
</ul></li>
-<li>Piotr Przybylski (Google Summer of Code 2008)
+<li>Piotr Przybylski (Google Summer of Code 2008 and 2010)
<ul>
<li>improved setup script</li>
+ <li>user preferences</li>
</ul></li>
<li>Derek Schaefer (Google Summer of Code 2009)
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_5_1-7256-g82acbb2
by Marc Delisle 21 Aug '10
by Marc Delisle 21 Aug '10
21 Aug '10
The branch, master has been updated
via 82acbb2ba3c9aed9f934650575666920e2fd9bab (commit)
via a5417a0ce7ebc603871360d0b391881280c8536d (commit)
via e3446960163f00125b516712c720a178093f46f2 (commit)
via b8cee3086bb34bc231b62c6884bb3192c2046595 (commit)
via 98cbab04113cac9de1aa8aea07dd92d8ae7f03b7 (commit)
via 97c939f8df0ae8e2ccd1357c78e2dfeda2383fad (commit)
via e6170b2dc211a19d43ff4e4f6d17f8598b2d6905 (commit)
via bcaec734418959fb0ce5e60a25ccddfa7cc75cb6 (commit)
via 4c39f5012e14f3c08e8da67dc05ca445d7a6b2f9 (commit)
via 60329f14cbc865e5c312602529966e128a0402da (commit)
via f7c3ea158aaad28aea233fb859403d3db27812c3 (commit)
via 9d4c5409c608af3900dd4f8889b69e17666dfbd5 (commit)
via 5dc9f17d39e9766333dc11bf3208678abce18080 (commit)
via a6b34a5977fd68e7da5e4703dbff487fbb579e5b (commit)
via 8b78fcec2696efa1fc0dbf2f501e8fea02b79c71 (commit)
via 1d265c58936ba3cbf2378566182104f6340a458b (commit)
via 4c430acc7175165a82f31a8051e493bd1da4a690 (commit)
via 4a5ffa7a12c687b46346be9052a3d2fdaeecebee (commit)
via e3f6715c44cf5923a8b9e6e68c8c362c69feaeef (commit)
via 53e8d75c0f9a2713cdee01d7075930a045b6dde5 (commit)
via 279724d6f85f0fe3eb4bb59665e7f01ce8d1b593 (commit)
via 9a733070032a5f00f368c85450e8000fa5e02aca (commit)
via 30413def3ef24a4ce11d1426030ad1f14f2fbca7 (commit)
via e76b4f8721528b3530e92e025845a6557bb94b06 (commit)
via 23d74c9996853164f2f7b707336e70dd334599a0 (commit)
via dcc352a9dce00acc50b919521deaae314c048fd4 (commit)
via 7f75e7515fbd03a031ffcd35167147f2f51adc0b (commit)
via 157c4fb775783486b980075aba0982b69a77eab3 (commit)
via 9adc2597c5e94c42979c45aef46700b318ef0384 (commit)
via 5a3ec082d80402d96f0288697b700f5ff9f19b7b (commit)
via ac3e9e323b3f33ec5804862943e63ab2e10f4a93 (commit)
via 65e0676ab4836603343951cf6b455e4d7756cfb5 (commit)
via 9d62971e110d26d15909b91d02c066435699dbcd (commit)
via edaf7ce86c10bafdf1eb554ed03910ec7b7be691 (commit)
via b2674e9d59c6670feb26be1ecb0d9b51f3889a3d (commit)
via 812748a50d622ef30aca0d44cb022d4676708698 (commit)
via 7db978de3fd4ae2543190dd3f61eb58beeaaa21e (commit)
via 8d24baad94ce2b358d62e6ebb57296192b90af04 (commit)
via b39567f38183b05c9a1c7511782ea148ba1c892e (commit)
via 5afd385f307759f6e7d5e4460ecf630390ff5d63 (commit)
via 2d67cb58c42193308ace1cace3e463ff19c5714f (commit)
via 2e55d85ab5adff22e6c766b2c857fd60a62416cd (commit)
via c8b6acdf59b9c18d94abcbb58af216683bf23658 (commit)
via 7399ce3e6137742af746cbc08389a3e29e186a13 (commit)
via 7ac7e24d8cc97cb3c0234b0058661770c0d0f44c (commit)
via 7b0135ed6a4dea645c5c18859cb6f08906504153 (commit)
via 600bdbd57ea7fd974381323c99d5a5abd92a50df (commit)
via cc9b5c9028d04234b033377631b0bdcf4695f09a (commit)
via 43a7629da9bdc90910833915aac5df92d1ddea32 (commit)
via a8ed8e61233ff0b6517b901160e99689ad7a92fd (commit)
via c0ba57f040b78736a351701a549a3f7b33157020 (commit)
via fab6eb09ea605c6be550a80a49f9f1aee87820de (commit)
via 52550eff13b6dca702539946fbdd1ac12e80f107 (commit)
via c67340d023eaeb147e0b28155a55db64c8e1598a (commit)
via 8c28b69aba4d630feff0ba2e8c291bdcea158251 (commit)
via 4376f6ce14cf264a8cfd5ef529d8dc6b7947a31f (commit)
via cf99d6511ffd6abe85c77b64b0182b23f2a8bf59 (commit)
via b71edb53806b7bb2867db6ab391a11a7e91ccade (commit)
via a7fe3f362c3cb81ca04922049725af6242921438 (commit)
via afca401bc8677482585b6eca60e7ceda0804c68b (commit)
via c5bef4d2dafb5535a83c9aad4dad7cc933a3e7dc (commit)
via 0b30a339fa24a2f03db8f9f4149f01019f74ce82 (commit)
via 995fcba961442a209a7b087c3e532aeb8f0720b3 (commit)
via 7a5fd6281078b234c665e64cea968641c4aceec0 (commit)
via 60285cd6650e055b999c05e23cdca101b829036d (commit)
via 030abc511430327aedd764e1486e9c5bb24efbda (commit)
via e7dd9a7c678f5b680dcaa93f7bf337e058df4677 (commit)
via 57a8d902f4016b8b4e6d5f8cf866c54a4ba93f96 (commit)
via b3ae73f2aa53072a85fccd24f0debcc094ab0813 (commit)
via 74eb921e68335c1a4a928251767814d6b478b6b3 (commit)
via 625b9edca8c8451e5aa4ed7f532af217f800065c (commit)
via 956315e0b2e06a90544f721763894708b427bb66 (commit)
via e6b551dc7176e94989291647ab728218ea71c5f1 (commit)
via 3137cc2f1d1e18a14c0dce9b63d34472f781dd49 (commit)
via bcaecbf10a4cf84b38b14a776ce02911c6e13725 (commit)
via 5717683ef16e7d35a0991e93bbf0459b0f1dfa4f (commit)
via 104ac11c1d2184a15a5cd7ae2a521728fe73b5b2 (commit)
via 104b40cb11ff09d3cf65e2848c61606863448a34 (commit)
via 54c322544cbd774ff7858cdff0644f6f7b3250f1 (commit)
via a9f39a92e7331a0a71e6da1b60987fd4d964375a (commit)
via 93d49e8ca860cd92b643e5257fc7e41075558cee (commit)
via 68d9c401138e184575ad30bb4cae9f5e5be9d11a (commit)
via d63fa35c0f4147859370adbda34fbb27c811634d (commit)
via 9dc47ecc41865486a595cbc300451600137fb255 (commit)
via 7c5a298f271260e47ee690c11eec3c37c1f08b43 (commit)
via 47cd7c9a20071fe527b5dd06f9ab69340593fe5e (commit)
via a3d46e16e2891fc766cda9dd85aff6df8c5746ca (commit)
via 2fab9fbf28a26cb59ecd8d14a0181ab4773bd245 (commit)
via 9130ebb7b64f0a5d010e8af92b04a8cf006cccbf (commit)
via 49c2562eaeb563b4cb2fe156f9ddc17211036d3c (commit)
via b13dee72f389bfda1eb3769e8d0abb54239fc057 (commit)
via 83f1397f0f612191759bfe9f82b8b9369be15a5a (commit)
via c91c105da82609b81c28e002ae278d61ce019b24 (commit)
via e842432c7ec268f9cf1780995281a8db7de5490e (commit)
via e5238f384573ffe1e96a36314b811bf03822c665 (commit)
via d09c35f5a83da6753f6cb9efcbea453b6933ed55 (commit)
via 0dc5d2e2b19bce4efd325c76544cef38d3d179f8 (commit)
via 3a8de5a7162edde4c3dee33f1cb63bcb14137d25 (commit)
via b68ba42f9f3a9017b25d7ac6668543c4ccde108c (commit)
via 9f44d864b6763682b858f6d9ff03401d8c236a28 (commit)
via f920e44af4f640a3170759adcfadc62d167c7f3c (commit)
via d68f2db90463d3d93be96a8531505706aae5618e (commit)
via 114869eb7a3d8b74f0c3ad4827dac6807335ab34 (commit)
via 3ff76ffcf52b07a788f081f3f1f12f59d5e64bcb (commit)
via b2e232b582c4245da4ac76b9b4cd853a8b899500 (commit)
via 02bb83cad3121b9ce9f9e66f3b11e9e3ca950e4a (commit)
via c7b304b6e62cdcd331c0cdc8aa4f884644f0f085 (commit)
via eb31291dcaa405c93089e4d11f0d644aadf7bd9c (commit)
via ca9c13c80cfed1cd96d27076c76f0fc2fac0b7ad (commit)
via 3b3f8bff6978d05d01afb79eb0fbad6b2b41ea97 (commit)
via a90b0a21f242bb552451118e5f0101345d1cdb15 (commit)
via 2e1fd2677fffa08315e277bd39626531d0701931 (commit)
via b2ecf178038524b7b245e6c507118eb6ad432a31 (commit)
via 082604eed3c0241c68ef157f5f2379826585f1b5 (commit)
via 4572e3ec8220b53a62a40e0d90747baaac013135 (commit)
via 03e66cd0d419947f3fcd617e4412e2e53179472b (commit)
via 3ed35399589e18a6b3bec155d4f7bd74047a9c7a (commit)
via 65911c57e1cfffefbbdd2e86b3f0d2e1204c80b4 (commit)
via 6b2f774ba83a856eb39040059a1d2ed78645aa4b (commit)
via 65863ae2292b6a6cb16d82516a3922f2b00e9dfe (commit)
via 101bbeefb60f8eb4bee5a9a692cab305ecc8336f (commit)
via 0f540aca0404a43094f552ccbc576db21749c9b2 (commit)
via 7661627a76c721ab2ab39f6a4ca03227b41841b8 (commit)
from 7be82362080f862de054c85646fb54b3bf6402b9 (commit)
- Log -----------------------------------------------------------------
commit 82acbb2ba3c9aed9f934650575666920e2fd9bab
Merge: 7be82362080f862de054c85646fb54b3bf6402b9 a5417a0ce7ebc603871360d0b391881280c8536d
Author: Marc Delisle <marc(a)infomarc.info>
Date: Sat Aug 21 07:46:57 2010 -0400
fix merge conflicts
commit a5417a0ce7ebc603871360d0b391881280c8536d
Author: Crack <piotrprz(a)gmail.com>
Date: Thu Aug 19 20:35:49 2010 +0200
add custom-no-form to Export/method
commit e3446960163f00125b516712c720a178093f46f2
Author: Crack <piotrprz(a)gmail.com>
Date: Thu Aug 19 16:36:41 2010 +0200
account for changes introduced when merging lori/gsoc branch
commit b8cee3086bb34bc231b62c6884bb3192c2046595
Merge: 98cbab04113cac9de1aa8aea07dd92d8ae7f03b7 772d80787ddead09cb5f00a45738ef48693ba5b4
Author: Crack <piotrprz(a)gmail.com>
Date: Thu Aug 19 14:45:18 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
Conflicts:
js/functions.js
js/tooltip.js
libraries/config.default.php
libraries/config.values.php
libraries/display_export.lib.php
setup/lib/forms.inc.php
setup/lib/messages.inc.php
themes/darkblue_orange/css/theme_right.css.php
themes/original/css/theme_right.css.php
commit 98cbab04113cac9de1aa8aea07dd92d8ae7f03b7
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Aug 8 22:10:48 2010 +0200
second part of error message display changes
commit 97c939f8df0ae8e2ccd1357c78e2dfeda2383fad
Merge: e6170b2dc211a19d43ff4e4f6d17f8598b2d6905 c24571f826c39dc7ff623d6392d0a49e7dfe02e3
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Aug 6 15:24:15 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit e6170b2dc211a19d43ff4e4f6d17f8598b2d6905
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Aug 6 15:17:53 2010 +0200
comments
output escaping
commit bcaec734418959fb0ce5e60a25ccddfa7cc75cb6
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Aug 6 14:56:52 2010 +0200
sort messages
commit 4c39f5012e14f3c08e8da67dc05ca445d7a6b2f9
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Aug 6 14:46:01 2010 +0200
restore cache'ing in phpmyadmin.css.php
commit 60329f14cbc865e5c312602529966e128a0402da
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Aug 6 14:36:26 2010 +0200
blacklist and settings debug code shown if $cfg['DBG']['php'] is true
commit f7c3ea158aaad28aea233fb859403d3db27812c3
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Aug 6 13:57:59 2010 +0200
info about setup script in "manage your settings", it seems many people still don't know it exists
commit 9d4c5409c608af3900dd4f8889b69e17666dfbd5
Author: Crack <piotrprz(a)gmail.com>
Date: Thu Aug 5 21:01:59 2010 +0200
fix import merge
fix <select> handling (hopefully this time for real)
commit 5dc9f17d39e9766333dc11bf3208678abce18080
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Aug 4 16:02:54 2010 +0200
fix <select> value setting
commit a6b34a5977fd68e7da5e4703dbff487fbb579e5b
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Aug 4 15:27:47 2010 +0200
fix generation of theme unique value
refresh session cache for config after save
commit 8b78fcec2696efa1fc0dbf2f501e8fea02b79c71
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Aug 4 14:35:09 2010 +0200
remove unneeded file
commit 1d265c58936ba3cbf2378566182104f6340a458b
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Aug 4 00:57:11 2010 +0200
fix regular expression validation when phpMyAdmin custom error handler is set
commit 4c430acc7175165a82f31a8051e493bd1da4a690
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Aug 3 00:57:14 2010 +0200
add missing .htaccess
commit 4a5ffa7a12c687b46346be9052a3d2fdaeecebee
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Aug 3 00:55:57 2010 +0200
File comments:
- remove @license and @version from comments
- add vim settings
- change descriptions in form definition files
commit e3f6715c44cf5923a8b9e6e68c8c362c69feaeef
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Aug 3 00:37:39 2010 +0200
bugfix: use true/false for boolean values read from <select>s instead of 1/0
commit 53e8d75c0f9a2713cdee01d7075930a045b6dde5
Merge: 279724d6f85f0fe3eb4bb59665e7f01ce8d1b593 887e2be664f04827fe164d724d233598a251bcb9
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Aug 1 23:19:21 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
Conflicts:
libraries/db_links.inc.php
libraries/tbl_links.inc.php
commit 279724d6f85f0fe3eb4bb59665e7f01ce8d1b593
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Aug 1 22:52:15 2010 +0200
bugfix: user preferences don't work correctly without output buffering
commit 9a733070032a5f00f368c85450e8000fa5e02aca
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Aug 1 21:55:04 2010 +0200
allow users to set only_db and hide_db
commit 30413def3ef24a4ce11d1426030ad1f14f2fbca7
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Aug 1 21:46:33 2010 +0200
bugfix: removed superfluous ob_end_clean() which caused page rendering to fail when OBGzip was enabled
commit e76b4f8721528b3530e92e025845a6557bb94b06
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 31 21:54:38 2010 +0200
fix array definition code
commit 23d74c9996853164f2f7b707336e70dd334599a0
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jul 30 20:31:47 2010 +0200
fix config download from index.php in setup script
commit dcc352a9dce00acc50b919521deaae314c048fd4
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jul 30 20:25:22 2010 +0200
refactor config file generation out of ConfigFile class
commit 7f75e7515fbd03a031ffcd35167147f2f51adc0b
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jul 30 19:45:53 2010 +0200
improve formatting in generated config file
commit 157c4fb775783486b980075aba0982b69a77eab3
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jul 30 19:44:59 2010 +0200
fixed some fields not saving due to equality conversions (eg. 0 == 'auto')
fix user preferences menu display when tabs don't fit on screen
commit 9adc2597c5e94c42979c45aef46700b318ef0384
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jul 30 00:47:20 2010 +0200
short comments for inputs:
- information whether SQL validator is enabled for Validate link
- information about required extensions (SOAP, compression)
- information for constrained values (eg. MaxDbList)
commit 5a3ec082d80402d96f0288697b700f5ff9f19b7b
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jul 27 23:15:23 2010 +0200
fix user preferences in phpmyadmin.css.php
fix css for LightTabs
fix values in <select> lists
commit ac3e9e323b3f33ec5804862943e63ab2e10f4a93
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jul 27 22:12:53 2010 +0200
keep selected tab after save
change pmadb to phpMyAdmin configuration storage in warning string
commit 65e0676ab4836603343951cf6b455e4d7756cfb5
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jul 27 19:45:01 2010 +0200
remove SQL Validator from user preferences
commit 9d62971e110d26d15909b91d02c066435699dbcd
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jul 26 22:34:13 2010 +0200
clean up config JavaScript
commit edaf7ce86c10bafdf1eb554ed03910ec7b7be691
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jul 26 21:30:57 2010 +0200
translate "More" tab
cleanup code
commit b2674e9d59c6670feb26be1ecb0d9b51f3889a3d
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jul 26 20:56:19 2010 +0200
change tab order in server, db and table menus
commit 812748a50d622ef30aca0d44cb022d4676708698
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jul 26 20:34:31 2010 +0200
Changes to conform to latest merge:
- use require instead if require_once for footer.inc.php
- rename pmadb to phpMyAdmin configuration storage
commit 7db978de3fd4ae2543190dd3f61eb58beeaaa21e
Merge: 8d24baad94ce2b358d62e6ebb57296192b90af04 41bc587ed4494d21e7b69647a1235d2ca405c8ea
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jul 26 20:24:57 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
Conflicts:
libraries/config.values.php
commit 8d24baad94ce2b358d62e6ebb57296192b90af04
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Jul 25 22:58:52 2010 +0200
run submenu code only when #topmenu is present
todo update
commit b39567f38183b05c9a1c7511782ea148ba1c892e
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Jul 25 22:58:14 2010 +0200
revert disable/* options
commit 5afd385f307759f6e7d5e4460ecf630390ff5d63
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Jul 25 22:10:38 2010 +0200
create menu for menu tabs which don't fit in one line
fix tooltip.js error when not in pma frame
commit 2d67cb58c42193308ace1cace3e463ff19c5714f
Merge: 2e55d85ab5adff22e6c766b2c857fd60a62416cd 084c0dbcf51dea488d99b7bfffffa23832ace4f3
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 24 18:34:52 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
Conflicts:
libraries/relation.lib.php
commit 2e55d85ab5adff22e6c766b2c857fd60a62416cd
Author: Crack <piotrprz(a)gmail.com>
Date: Thu Jul 22 20:04:16 2010 +0200
Developers tab no longer depends on UserprefsDisallow, introduced UserprefsDeveloperTab setting
commit c8b6acdf59b9c18d94abcbb58af216683bf23658
Author: Crack <piotrprz(a)gmail.com>
Date: Thu Jul 22 17:02:17 2010 +0200
remove debug
use proper function to cancel event
commit 7399ce3e6137742af746cbc08389a3e29e186a13
Author: Crack <piotrprz(a)gmail.com>
Date: Thu Jul 22 12:37:51 2010 +0200
a few changes on preferences manage page
fix JS date generation on preferences export to localStorage
commit 7ac7e24d8cc97cb3c0234b0058661770c0d0f44c
Author: Crack <piotrprz(a)gmail.com>
Date: Thu Jul 22 01:29:36 2010 +0200
more styling for disabled options
new "Developer" tab (by default all options are disabled, users can't modify them)
fixed UserprefsDisallow export in setup script
commit 7b0135ed6a4dea645c5c18859cb6f08906504153
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Jul 21 16:11:02 2010 +0200
fix port number validation
correct naming mistake (authentication != authorization)
setup script: move server authentication settings to new tab
commit 600bdbd57ea7fd974381323c99d5a5abd92a50df
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Jul 21 14:01:53 2010 +0200
Setup script: AllowThirdPartyFraming
User preferences and setup script: new tab - Warnings, with options to disable mcrypt, Suhosin and pmadb warnings
commit cc9b5c9028d04234b033377631b0bdcf4695f09a
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Jul 21 01:21:32 2010 +0200
mark fields that user can disable in setup script
commit 43a7629da9bdc90910833915aac5df92d1ddea32
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jul 20 21:57:05 2010 +0200
Users can disable: AllowUserDropDatabase, UseDbSearch, QueryHistoryDB, ShowPhpInfo, ShowChgPassword
Users can change: QueryHistoryMax (must be lower than value from file config)
commit a8ed8e61233ff0b6517b901160e99689ad7a92fd
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jul 20 16:36:22 2010 +0200
SQL Validator forms
commit c0ba57f040b78736a351701a549a3f7b33157020
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jul 20 12:42:18 2010 +0200
add config options for charset in Import and Export
commit fab6eb09ea605c6be550a80a49f9f1aee87820de
Merge: 52550eff13b6dca702539946fbdd1ac12e80f107 79a23fcd01ee2bd7ca2f5e5cb89bc993492597fa
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jul 20 12:30:03 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 52550eff13b6dca702539946fbdd1ac12e80f107
Merge: c67340d023eaeb147e0b28155a55db64c8e1598a d7192b3a95bbaef2fccbd34ab57accb077085b4d
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jul 20 12:19:21 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
Resolved conflicts:
setup/lib/forms.inc.php
setup/lib/messages.inc.php
commit c67340d023eaeb147e0b28155a55db64c8e1598a
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jul 19 23:57:12 2010 +0200
save lang and collation_connection to user preferences
commit 8c28b69aba4d630feff0ba2e8c291bdcea158251
Merge: 4376f6ce14cf264a8cfd5ef529d8dc6b7947a31f d0106c29edc5eba444c984f74fabad51639b9315
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jul 19 16:16:12 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 4376f6ce14cf264a8cfd5ef529d8dc6b7947a31f
Merge: cf99d6511ffd6abe85c77b64b0182b23f2a8bf59 e0d1e92336a43b0b2997ff11f15957156cbb35f4
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jul 19 16:04:50 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit cf99d6511ffd6abe85c77b64b0182b23f2a8bf59
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 17 22:43:38 2010 +0200
fix restore-default not showing after page load
setup script comments for fields that set constraints on user preferences (MaxDbLost, MaxTableList)
commit b71edb53806b7bb2867db6ab391a11a7e91ccade
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 17 14:23:15 2010 +0200
add missing @uses comments
commit a7fe3f362c3cb81ca04922049725af6242921438
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 17 14:02:19 2010 +0200
allow multiple validators for one field
users can set MaxDbList and MaxTableList, values are bounded by the original value
commit afca401bc8677482585b6eca60e7ceda0804c68b
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 17 11:39:30 2010 +0200
parametrized validators
valdiation by regular expressions
shorter text fields for numeric inputs
commit c5bef4d2dafb5535a83c9aad4dad7cc933a3e7dc
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jul 16 20:28:11 2010 +0200
fix "restore default" button, should be visible only when field has custom value
added missing validations for setup script
added two field descriptions
added SkipLockedTables to user preferences
commit 0b30a339fa24a2f03db8f9f4149f01019f74ce82
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jul 16 11:30:51 2010 +0200
css for Darkblue/orange
commit 995fcba961442a209a7b087c3e532aeb8f0720b3
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jul 16 11:30:21 2010 +0200
fix theme changing
commit 7a5fd6281078b234c665e64cea968641c4aceec0
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Jul 14 21:28:24 2010 +0200
allow users to easily work with preferences stored in session (when pmadb is disabled): after logging in, user is presented with a message asking whether settings from localStorage should be loaded
commit 60285cd6650e055b999c05e23cdca101b829036d
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Jul 14 17:07:19 2010 +0200
add missing string escapes
don't create <a> tag if LeftLogoLink is empty
commit 030abc511430327aedd764e1486e9c5bb24efbda
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jul 13 23:15:22 2010 +0200
add missing validation for TextareaRows
fix warning in FormDisplay while importing settings
commit e7dd9a7c678f5b680dcaa93f7bf337e058df4677
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jul 13 22:59:21 2010 +0200
allow to partially import broken configs - show message with error list and import only correct values
commit 57a8d902f4016b8b4e6d5f8cf866c54a4ba93f96
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jul 13 22:17:19 2010 +0200
fix ThemeDefault and fontsize export
commit b3ae73f2aa53072a85fccd24f0debcc094ab0813
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jul 12 19:24:07 2010 +0200
ui fixes
commit 74eb921e68335c1a4a928251767814d6b478b6b3
Merge: 625b9edca8c8451e5aa4ed7f532af217f800065c ce2cad288666f2bfd71dc21ae8e0277288834657
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jul 12 14:04:16 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 625b9edca8c8451e5aa4ed7f532af217f800065c
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jul 12 14:02:45 2010 +0200
show message when preferences are saved to localStorage
commit 956315e0b2e06a90544f721763894708b427bb66
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 10 21:51:54 2010 +0200
bugfix: show warning only when pmadb is unavailable
commit e6b551dc7176e94989291647ab728218ea71c5f1
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 10 12:09:34 2010 +0200
bugfixes: allow to work with multiple servers, fix boolean values in select fields
commit 3137cc2f1d1e18a14c0dce9b63d34472f781dd49
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 10 00:06:50 2010 +0200
add date information when importing from localStorage
commit bcaecbf10a4cf84b38b14a776ce02911c6e13725
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jul 9 20:37:04 2010 +0200
allow user preferences to work without pmadb, but warn users about that
commit 5717683ef16e7d35a0991e93bbf0459b0f1dfa4f
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jul 9 19:37:49 2010 +0200
basic import/export for localStorage, needs to be polished
commit 104ac11c1d2184a15a5cd7ae2a521728fe73b5b2
Author: Crack <piotrprz(a)gmail.com>
Date: Thu Jul 8 19:01:09 2010 +0200
import and export for user preferences (currently JSON file only)
add preferences reset
commit 104b40cb11ff09d3cf65e2848c61606863448a34
Author: Crack <piotrprz(a)gmail.com>
Date: Thu Jul 8 12:36:09 2010 +0200
rename file
commit 54c322544cbd774ff7858cdff0644f6f7b3250f1
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Jul 7 01:27:05 2010 +0200
move user preferences to top level server menu
commit a9f39a92e7331a0a71e6da1b60987fd4d964375a
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jul 6 18:20:33 2010 +0200
saving of theme and font size
commit 93d49e8ca860cd92b643e5257fc7e41075558cee
Merge: 68d9c401138e184575ad30bb4cae9f5e5be9d11a 3e9e18aebb5d551f260e178f2f311384c2653b28
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jul 5 19:37:03 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 68d9c401138e184575ad30bb4cae9f5e5be9d11a
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Jul 4 21:56:46 2010 +0200
moved Import by LOAD DATA settings to CSV category
moved PMA_array_* functions to core.lib.php
moved PMA_read_userprefs_fieldnames() to user_preferences.lib.php
server/database/table filename templates are saved to pmadb when "remember template" is checked
commit d63fa35c0f4147859370adbda34fbb27c811634d
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Jul 4 00:18:04 2010 +0200
finished messages.inc.php cleanup
commit 9dc47ecc41865486a595cbc300451600137fb255
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Jul 4 00:04:55 2010 +0200
rename $strSetup* variables to $strConfig*
commit 7c5a298f271260e47ee690c11eec3c37c1f08b43
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 3 23:27:02 2010 +0200
moved validate.lib.php
commit 47cd7c9a20071fe527b5dd06f9ab69340593fe5e
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 3 23:22:20 2010 +0200
styling
moved some options (SQL Queries and SQL Box forms)
commit a3d46e16e2891fc766cda9dd85aff6df8c5746ca
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 3 22:50:06 2010 +0200
sort messages
commit 2fab9fbf28a26cb59ecd8d14a0181ab4773bd245
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 3 22:45:14 2010 +0200
Export options
commit 9130ebb7b64f0a5d010e8af92b04a8cf006cccbf
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 3 19:02:54 2010 +0200
allow to group fields in forms
commit 49c2562eaeb563b4cb2fe156f9ddc17211036d3c
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jul 3 13:45:48 2010 +0200
more flexible <select> declaration
fix array export in ConfigFile
commit b13dee72f389bfda1eb3769e8d0abb54239fc057
Author: Crack <piotrprz(a)gmail.com>
Date: Thu Jul 1 22:24:18 2010 +0200
Import settings
commit 83f1397f0f612191759bfe9f82b8b9369be15a5a
Merge: c91c105da82609b81c28e002ae278d61ce019b24 4986ee01742944b1c648cdcac0360cff653c12f8
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jun 28 16:42:29 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit c91c105da82609b81c28e002ae278d61ce019b24
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Jun 27 12:43:54 2010 +0200
added missing file
commit e842432c7ec268f9cf1780995281a8db7de5490e
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jun 26 01:04:17 2010 +0200
User preferences:
- add icons to category tabs
- user overrides were unavailable in CSS files
- apply saved configuration immediately after save, reload navigation frame if it's affected
- disabled overrides marked in user preferences forms
commit e5238f384573ffe1e96a36314b811bf03822c665
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jun 21 19:12:25 2010 +0200
add $cfg['UserprefsDisallow'] and allow setting it in setup script
correct IE opacity issue for "restore default value" button
fix regressions introduced in previous commit
commit d09c35f5a83da6753f6cb9efcbea453b6933ed55
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jun 21 18:46:23 2010 +0200
setup script - better config file generation
commit 0dc5d2e2b19bce4efd325c76544cef38d3d179f8
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jun 21 16:24:34 2010 +0200
markers for field errors
commit 3a8de5a7162edde4c3dee33f1cb63bcb14137d25
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jun 21 15:24:07 2010 +0200
make form definition structure the same for setup script and user preferences
commit b68ba42f9f3a9017b25d7ac6668543c4ccde108c
Author: Crack <piotrprz(a)gmail.com>
Date: Mon Jun 21 01:05:45 2010 +0200
Better error handling
commit 9f44d864b6763682b858f6d9ff03401d8c236a28
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Jun 20 21:34:13 2010 +0200
user preferences saving and integration
commit f920e44af4f640a3170759adcfadc62d167c7f3c
Merge: d68f2db90463d3d93be96a8531505706aae5618e 7f77f618d9effc18e1563e5be56a22a206a8a436
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Jun 20 18:45:41 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit d68f2db90463d3d93be96a8531505706aae5618e
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jun 18 20:22:34 2010 +0200
add warnings if pma_userconfig is not present
commit 114869eb7a3d8b74f0c3ad4827dac6807335ab34
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jun 18 19:36:00 2010 +0200
updated paths
commit 3ff76ffcf52b07a788f081f3f1f12f59d5e64bcb
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jun 18 19:33:24 2010 +0200
moved forms definition files
commit b2e232b582c4245da4ac76b9b4cd853a8b899500
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jun 18 17:53:53 2010 +0200
Added pmadb table for preferences storage
Removed some messages from messages.inc.php
commit 02bb83cad3121b9ce9f9e66f3b11e9e3ca950e4a
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Jun 16 23:54:57 2010 +0200
add new settings to setup script
commit c7b304b6e62cdcd331c0cdc8aa4f884644f0f085
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Jun 16 23:54:35 2010 +0200
improve js validators
add missing validations and language strings
commit eb31291dcaa405c93089e4d11f0d644aadf7bd9c
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Jun 16 23:50:44 2010 +0200
docs typo
commit ca9c13c80cfed1cd96d27076c76f0fc2fac0b7ad
Merge: 3b3f8bff6978d05d01afb79eb0fbad6b2b41ea97 0963eb36edc3e902ae12899ca306b5ce057136f3
Author: Crack <piotrprz(a)gmail.com>
Date: Wed Jun 16 13:02:14 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 3b3f8bff6978d05d01afb79eb0fbad6b2b41ea97
Merge: a90b0a21f242bb552451118e5f0101345d1cdb15 f1d89536703373c41b888b68414a55ec9642e9ef
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Jun 13 15:03:58 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit a90b0a21f242bb552451118e5f0101345d1cdb15
Author: Crack <piotrprz(a)gmail.com>
Date: Sun Jun 13 15:01:37 2010 +0200
removed some messages from messages.inc.php (validation, some other error messages)
User preferences:
added translations and values for some fields
validation for DefaultPropDisplay
commit 2e1fd2677fffa08315e277bd39626531d0701931
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jun 12 23:48:07 2010 +0200
Configuration forms styling
commit b2ecf178038524b7b245e6c507118eb6ad432a31
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jun 12 12:42:29 2010 +0200
Split setup/scripts.js into generic and setup script specific parts
commit 082604eed3c0241c68ef157f5f2379826585f1b5
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jun 11 23:42:36 2010 +0200
Fixed JSDoc
commit 4572e3ec8220b53a62a40e0d90747baaac013135
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jun 11 22:00:52 2010 +0200
Fix paths in config templates
commit 03e66cd0d419947f3fcd617e4412e2e53179472b
Author: Crack <piotrprz(a)gmail.com>
Date: Fri Jun 11 17:11:15 2010 +0200
Display forms
commit 3ed35399589e18a6b3bec155d4f7bd74047a9c7a
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jun 5 19:25:54 2010 +0200
Setup script refactoring: moved ConfigFile, Form, FormDisplay
Config db overrides and validation info stored in config.values.php
commit 65911c57e1cfffefbbdd2e86b3f0d2e1204c80b4
Merge: 6b2f774ba83a856eb39040059a1d2ed78645aa4b f50d6694e79bb1f8268e44123e8b6935f10a365a
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jun 5 16:59:16 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 6b2f774ba83a856eb39040059a1d2ed78645aa4b
Author: Crack <piotrprz(a)gmail.com>
Date: Sat Jun 5 15:42:55 2010 +0200
Add category tabs to preferences page
Setup script refactoring
commit 65863ae2292b6a6cb16d82516a3922f2b00e9dfe
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jun 1 14:33:02 2010 +0200
List of fields to add, divided into categories
commit 101bbeefb60f8eb4bee5a9a692cab305ecc8336f
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jun 1 14:32:10 2010 +0200
link to user preferences on main page (not working yet)
commit 0f540aca0404a43094f552ccbc576db21749c9b2
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jun 1 14:31:11 2010 +0200
Setup script: moved LeftDefaultTabTable, added MainPageIconic
commit 7661627a76c721ab2ab39f6a4ca03227b41841b8
Author: Crack <piotrprz(a)gmail.com>
Date: Tue Jun 1 14:24:15 2010 +0200
doc fix
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 1 +
Documentation.html | 31 +-
config.sample.inc.php | 1 +
export.php | 9 +-
setup/scripts.js => js/config.js | 559 ++++++++++---------
js/functions.js | 98 ++++-
js/messages.php | 3 +
libraries/Config.class.php | 187 ++++++-
libraries/common.inc.php | 3 +
libraries/common.lib.php | 4 +-
libraries/config.default.php | 77 +++-
libraries/config.values.php | 189 +++++++
libraries/config/ConfigFile.class.php | 486 ++++++++++++++++
{setup/lib => libraries/config}/Form.class.php | 80 ++-
.../lib => libraries/config}/FormDisplay.class.php | 305 +++++++++--
libraries/config/FormDisplay.tpl.php | 429 ++++++++++++++
libraries/config/config_functions.lib.php | 100 ++++
libraries/config/messages.inc.php | 498 +++++++++++++++++
libraries/config/setup.forms.php | 368 ++++++++++++
libraries/config/user_preferences.forms.php | 268 +++++++++
{setup/lib => libraries/config}/validate.lib.php | 177 +++++--
libraries/core.lib.php | 85 +++
libraries/db_links.inc.php | 14 +-
libraries/display_export.lib.php | 26 +-
libraries/export/sql.php | 2 +-
libraries/footer.inc.php | 8 +
libraries/header.inc.php | 14 +
libraries/header_meta_style.inc.php | 2 +-
libraries/header_scripts.inc.php | 2 +-
libraries/navigation_header.inc.php | 34 +-
libraries/relation.lib.php | 13 +-
libraries/server_links.inc.php | 50 +-
libraries/tbl_links.inc.php | 14 +-
libraries/user_preferences.inc.php | 72 +++
libraries/user_preferences.lib.php | 316 +++++++++++
main.php | 8 +
prefs_forms.php | 89 +++
prefs_manage.php | 337 +++++++++++
scripts/create_tables.sql | 15 +
scripts/find_unused_messages.sh | 2 +-
setup/config.php | 22 +-
{libraries => setup/frames}/.htaccess | 0
setup/frames/config.inc.php | 10 +-
setup/frames/form.inc.php | 35 +-
setup/frames/index.inc.php | 21 +-
setup/frames/menu.inc.php | 15 +-
setup/frames/servers.inc.php | 20 +-
setup/index.php | 2 +-
setup/lib/ConfigFile.class.php | 322 -----------
setup/lib/ConfigGenerator.class.php | 151 +++++
setup/lib/FormDisplay.tpl.php | 293 ----------
setup/lib/common.inc.php | 220 +-------
setup/lib/config_info.inc.php | 144 -----
setup/lib/form_processing.lib.php | 13 +-
setup/lib/forms.inc.php | 183 ------
setup/lib/index.lib.php | 147 +++---
setup/lib/messages.inc.php | 381 -------------
setup/scripts.js | 586 +-------------------
setup/styles.css | 66 ++-
setup/validate.php | 10 +-
themes/darkblue_orange/css/theme_right.css.php | 334 +++++++++++-
themes/darkblue_orange/img/b_more.png | Bin 0 -> 963 bytes
themes/original/css/theme_right.css.php | 343 +++++++++++-
themes/original/img/b_more.png | Bin 0 -> 1005 bytes
64 files changed, 5521 insertions(+), 2773 deletions(-)
copy setup/scripts.js => js/config.js (57%)
create mode 100644 libraries/config.values.php
create mode 100644 libraries/config/ConfigFile.class.php
rename {setup/lib => libraries/config}/Form.class.php (67%)
rename {setup/lib => libraries/config}/FormDisplay.class.php (61%)
create mode 100644 libraries/config/FormDisplay.tpl.php
create mode 100644 libraries/config/config_functions.lib.php
create mode 100644 libraries/config/messages.inc.php
create mode 100644 libraries/config/setup.forms.php
create mode 100644 libraries/config/user_preferences.forms.php
rename {setup/lib => libraries/config}/validate.lib.php (62%)
create mode 100644 libraries/user_preferences.inc.php
create mode 100644 libraries/user_preferences.lib.php
create mode 100644 prefs_forms.php
create mode 100644 prefs_manage.php
copy {libraries => setup/frames}/.htaccess (100%)
delete mode 100644 setup/lib/ConfigFile.class.php
create mode 100644 setup/lib/ConfigGenerator.class.php
delete mode 100644 setup/lib/FormDisplay.tpl.php
delete mode 100644 setup/lib/config_info.inc.php
delete mode 100644 setup/lib/forms.inc.php
delete mode 100644 setup/lib/messages.inc.php
create mode 100644 themes/darkblue_orange/img/b_more.png
create mode 100644 themes/original/img/b_more.png
diff --git a/.gitignore b/.gitignore
index 3e12f7d..a773f8e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@ phpmyadmin.wpj
.settings
.buildpath
.cache
+.idea
*.sw[op]
# Locales
locale
diff --git a/Documentation.html b/Documentation.html
index a782847..7077d2a 100644
--- a/Documentation.html
+++ b/Documentation.html
@@ -1139,6 +1139,26 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE</pre>
<br/><br/>
</dd>
+ <dt id="userconfig">
+ <span id="cfg_Servers_userconfig">$cfg['Servers'][$i]['userconfig']</span> string
+ </dt>
+ <dd>
+ Since release 3.4.x phpMyAdmin allows users to set most preferences by themselves
+ and store them in the database.
+ <br /><br />
+
+ If you don't allow for storing preferences in <a href="#pmadb">pmadb</a>, users can
+ still personalize phpMyAdmin, but settings will be saved in browser's local storage,
+ or, it is is unavailable, until the end of session.
+ <br /><br />
+
+ To allow the usage of this functionality:
+
+ <ul>
+ <li>set up <a href="#pmadb">pmadb</a> and the linked-tables infrastructure</li>
+ <li>put the table name in <tt>$cfg['Servers'][$i]['userconfig']</tt></li>
+ </ul>
+ </dd>
<dt id="designer_coords">
<span id="cfg_Servers_designer_coords">$cfg['Servers'][$i]['designer_coords']</span> string
@@ -1183,7 +1203,7 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE</pre>
<span id="cfg_Servers_AllowDeny_order">$cfg['Servers'][$i]['AllowDeny']['order']</span> string
</dt>
<dd>If your rule order is empty, then <abbr title="Internet Protocol">IP</abbr>
- authentication is disabled.<br /><br />
+ authorization is disabled.<br /><br />
If your rule order is set to <tt>'deny,allow'</tt> then the system applies
all deny rules followed by allow rules. Access is allowed by default. Any
@@ -1195,7 +1215,7 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE</pre>
default. Any client which does not match an Allow directive or does
match a Deny directive will be denied access to the server.<br /><br />
- If your rule order is set to 'explicit', the authentication is
+ If your rule order is set to 'explicit', authorization is
performed in a similar fashion to rule order 'deny,allow', with the
added restriction that your host/username combination <b>must</b> be
listed in the <i>allow</i> rules, and not listed in the <i>deny</i>
@@ -2153,6 +2173,11 @@ setfacl -d -m "g:www-data:rwx" tmp
closed state. A value of <tt>'open'</tt> does the reverse. To completely
disable all visual sliders, use <tt>'disabled'</tt>.</dd>
+ <dt id="cfg_UserprefsDisallow">$cfg['UserprefsDisallow'] array</dt>
+ <dd>Contains names of configuration options (keys in <tt>$cfg</tt> array)
+ that users can't set through user preferences. For possible values, refer
+ to <tt>libraries/config/user_preferences.forms.php</tt>.</dd>
+
<dt id="cfg_TitleTable">$cfg['TitleTable'] string</dt>
<dt id="cfg_TitleDatabase">$cfg['TitleDatabase'] string</dt>
<dt id="cfg_TitleServer">$cfg['TitleServer'] string</dt>
@@ -3483,7 +3508,7 @@ have either the <a href="http://pecl.php.net/package/APC">APC</a> extension
<h4 id="faq3_15">
<a href="#faq3_15">3.15 When I import an Excel spreadsheet, some cells with calculations do not display correctly.</a></h4>
<p>
- phpMyAdmin uses the <a href="http://www.codeplex.com/PHPExcel/" target="_blank">PHPExcel</a> library to parse Excel XLS and XLSX spreadsheets.
+ phpMyAdmin uses the <a href="http://www.codeplex.com/PHPExcel/">PHPExcel</a> library to parse Excel XLS and XLSX spreadsheets.
Therefore, any limitations that are listed on their page regarding Excel calculations will also apply here.
<br /><br />
PHPExcel will be kept up to date so as to make all improvements available to phpMyAdmin users.
diff --git a/config.sample.inc.php b/config.sample.inc.php
index da403fd..41f6466 100644
--- a/config.sample.inc.php
+++ b/config.sample.inc.php
@@ -49,6 +49,7 @@ $cfg['Servers'][$i]['AllowNoPassword'] = false;
// $cfg['Servers'][$i]['history'] = 'pma_history';
// $cfg['Servers'][$i]['tracking'] = 'pma_tracking';
// $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
+// $cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';
diff --git a/export.php b/export.php
index 1a5d6e6..2615496 100644
--- a/export.php
+++ b/export.php
@@ -256,15 +256,18 @@ if ($asfile) {
$pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
if ($export_type == 'server') {
if (isset($remember_template)) {
- $GLOBALS['PMA_Config']->setCookie('pma_server_filename_template', $filename_template);
+ $GLOBALS['PMA_Config']->setUserValue('pma_server_filename_template',
+ 'Export/file_template_server', $filename_template);
}
} elseif ($export_type == 'database') {
if (isset($remember_template)) {
- $GLOBALS['PMA_Config']->setCookie('pma_db_filename_template', $filename_template);
+ $GLOBALS['PMA_Config']->setUserValue('pma_db_filename_template',
+ 'Export/file_template_database', $filename_template);
}
} else {
if (isset($remember_template)) {
- $GLOBALS['PMA_Config']->setCookie('pma_table_filename_template', $filename_template);
+ $GLOBALS['PMA_Config']->setUserValue('pma_table_filename_template',
+ 'Export/file_template_table', $filename_template);
}
}
$filename = PMA_expandUserString($filename_template);
diff --git a/setup/scripts.js b/js/config.js
similarity index 57%
copy from setup/scripts.js
copy to js/config.js
index 7298e63..1b0cedd 100644
--- a/setup/scripts.js
+++ b/js/config.js
@@ -1,14 +1,7 @@
/**
- * functions used in setup script
- *
- * @version $Id$
+ * Functions used in configuration forms and on user preferences pages
*/
-// show this window in top frame
-if (top != self) {
- window.top.location.href = location;
-}
-
// default values for fields
var defaultValues = {};
@@ -18,7 +11,7 @@ var PMA_messages = {};
/**
* Returns field type
*
- * @param Element field
+ * @param {Element} field
*/
function getFieldType(field) {
field = $(field);
@@ -42,9 +35,9 @@ function getFieldType(field) {
* o boolean - if field_type is 'checkbox'
* o Array of values - if field_type is 'select'
*
- * @param Element field
- * @param String field_type see getFieldType
- * @param mixed value
+ * @param {Element} field
+ * @param {String} field_type see {@link #getFieldType}
+ * @param {String|Boolean} [value]
*/
function setFieldValue(field, field_type, value) {
field = $(field);
@@ -80,9 +73,9 @@ function setFieldValue(field, field_type, value) {
* o boolean - if type is 'checkbox'
* o Array of values - if type is 'select'
*
- * @param Element field
- * @param String field_type see getFieldType
- * @return mixed
+ * @param {Element} field
+ * @param {String} field_type returned by {@link #getFieldType}
+ * @type Boolean|String|String[]
*/
function getFieldValue(field, field_type) {
field = $(field);
@@ -101,6 +94,7 @@ function getFieldValue(field, field_type) {
}
return items;
}
+ return null;
}
/**
@@ -127,8 +121,8 @@ function getAllValues() {
/**
* Checks whether field has its default value
*
- * @param Element field
- * @param String type
+ * @param {Element} field
+ * @param {String} type
* @return boolean
*/
function checkFieldDefault(field, type) {
@@ -160,43 +154,13 @@ function checkFieldDefault(field, type) {
/**
* Returns element's id prefix
- * @param Element element
+ * @param {Element} element
*/
function getIdPrefix(element) {
return $(element).attr('id').replace(/[^-]+$/, '');
}
// ------------------------------------------------------------------
-// Messages
-//
-
-// stores hidden message ids
-var hiddenMessages = [];
-
-$(function() {
- var hidden = hiddenMessages.length;
- for (var i = 0; i < hidden; i++) {
- $('#'+hiddenMessages[i]).css('display', 'none');
- }
- if (hidden > 0) {
- var link = $('#show_hidden_messages');
- link.click(function(e) {
- e.preventDefault();
- for (var i = 0; i < hidden; i++) {
- $('#'+hiddenMessages[i]).show(500);
- }
- $(this).remove();
- });
- link.html(link.html().replace('#MSG_COUNT', hidden));
- link.css('display', '');
- }
-});
-
-//
-// END: Messages
-// ------------------------------------------------------------------
-
-// ------------------------------------------------------------------
// Form validation and field operations
//
@@ -206,171 +170,88 @@ var validate = {};
// form validator list
var validators = {
// regexp: numeric value
- _regexp_numeric: new RegExp('^[0-9]*$'),
+ _regexp_numeric: /^[0-9]+$/,
+ // regexp: extract parts from PCRE expression
+ _regexp_pcre_extract: /(.)(.*)\1(.*)?/,
/**
* Validates positive number
*
- * @param boolean isKeyUp
+ * @param {boolean} isKeyUp
*/
validate_positive_number: function (isKeyUp) {
+ if (isKeyUp && this.value == '') {
+ return true;
+ }
var result = this.value != '0' && validators._regexp_numeric.test(this.value);
return result ? true : PMA_messages['error_nan_p'];
},
/**
* Validates non-negative number
*
- * @param boolean isKeyUp
+ * @param {boolean} isKeyUp
*/
validate_non_negative_number: function (isKeyUp) {
+ if (isKeyUp && this.value == '') {
+ return true;
+ }
var result = validators._regexp_numeric.test(this.value);
return result ? true : PMA_messages['error_nan_nneg'];
},
/**
* Validates port number
*
- * @param boolean isKeyUp
+ * @param {boolean} isKeyUp
*/
validate_port_number: function(isKeyUp) {
- var result = validators._regexp_numeric.test(this.value) && this.value != '0';
- if (!result || this.value > 65536) {
- result = PMA_messages['error_incorrect_port'];
+ if (this.value == '') {
+ return true;
}
- return result;
+ var result = validators._regexp_numeric.test(this.value) && this.value != '0';
+ return result && this.value <= 65535 ? true : PMA_messages['error_incorrect_port'];
},
- // field validators
- _field: {
- /**
- * hide_db field
- *
- * @param boolean isKeyUp
- */
- hide_db: function(isKeyUp) {
- if (!isKeyUp && this.value != '') {
- var data = {};
- data[this.id] = this.value;
- ajaxValidate(this, 'Servers/1/hide_db', data);
- }
+ /**
+ * Validates value according to given regular expression
+ *
+ * @param {boolean} isKeyUp
+ * @param {string} regexp
+ */
+ validate_by_regex: function(isKeyUp, regexp) {
+ if (isKeyUp && this.value == '') {
return true;
- },
- /**
- * TrustedProxies field
- *
- * @param boolean isKeyUp
- */
- TrustedProxies: function(isKeyUp) {
- if (!isKeyUp && this.value != '') {
- var data = {};
- data[this.id] = this.value;
- ajaxValidate(this, 'TrustedProxies', data);
- }
+ }
+ // convert PCRE regexp
+ var parts = regexp.match(validators._regexp_pcre_extract);
+ var valid = this.value.match(new RegExp(parts[2], parts[3])) != null;
+ return valid ? true : PMA_messages['error_invalid_value'];
+ },
+ /**
+ * Validates upper bound for numeric inputs
+ *
+ * @param {boolean} isKeyUp
+ * @param {int} max_value
+ */
+ validate_upper_bound: function(isKeyUp, max_value) {
+ var val = parseInt(this.value);
+ if (isNaN(val)) {
return true;
}
+ return val <= max_value ? true : PMA_messages['error_value_lte'].replace('%s', max_value);
+ },
+ // field validators
+ _field: {
},
// fieldset validators
_fieldset: {
- /**
- * Validates Server fieldset
- *
- * @param boolean isKeyUp
- */
- Server: function(isKeyUp) {
- if (!isKeyUp) {
- ajaxValidate(this, 'Server', getAllValues());
- }
- return true;
- },
- /**
- * Validates Server_login_options fieldset
- *
- * @param boolean isKeyUp
- */
- Server_login_options: function(isKeyUp) {
- return validators._fieldset.Server.apply(this, [isKeyUp]);
- },
- /**
- * Validates Server_pmadb fieldset
- *
- * @param boolean isKeyUp
- */
- Server_pmadb: function(isKeyUp) {
- if (isKeyUp) {
- return true;
- }
-
- var prefix = getIdPrefix($(this).find('input'));
- var pmadb_active = $('#' + prefix + 'pmadb').val() != '';
- if (pmadb_active) {
- ajaxValidate(this, 'Server_pmadb', getAllValues());
- }
-
- return true;
- }
}
};
/**
- * Calls server-side validation procedures
- *
- * @param Element parent input field in <fieldset> or <fieldset>
- * @param String id validator id
- * @param Object values values hash (element_id: value)
- */
-function ajaxValidate(parent, id, values) {
- parent = $(parent);
- // ensure that parent is a fieldset
- if (parent.attr('tagName') != 'FIELDSET') {
- parent = parent.closest('fieldset');
- if (parent.length == 0) {
- return false;
- }
- }
-
- if (parent.data('ajax') != null) {
- parent.data('ajax').abort();
- }
-
- parent.data('ajax', $.ajax({
- url: 'validate.php',
- cache: false,
- type: 'POST',
- data: {
- token: parent.closest('form').find('input[name=token]').val(),
- id: id,
- values: $.toJSON(values)
- },
- success: function(response) {
- if (response == null) {
- return;
- }
-
- var error = {};
- if (typeof response != 'object') {
- error[parent.id] = [response];
- } else if (typeof response['error'] != 'undefined') {
- error[parent.id] = [response['error']];
- } else {
- for (key in response) {
- var value = response[key];
- error[key] = jQuery.isArray(value) ? value : [value];
- }
- }
- displayErrors(error);
- },
- complete: function() {
- parent.removeData('ajax');
- }
- }));
-
- return true;
-}
-
-/**
* Registers validator for given field
*
- * @param String id field id
- * @param String type validator (key in validators object)
- * @param boolean onKeyUp whether fire on key up
- * @param mixed params validation function parameters
+ * @param {String} id field id
+ * @param {String} type validator (key in validators object)
+ * @param {boolean} onKeyUp whether fire on key up
+ * @param {Array} params validation function parameters
*/
function validateField(id, type, onKeyUp, params) {
if (typeof validators[type] == 'undefined') {
@@ -385,9 +266,10 @@ function validateField(id, type, onKeyUp, params) {
/**
* Returns valdiation functions associated with form field
*
- * @param String field_id form field id
- * @param boolean onKeyUpOnly see validateField
- * @return Array array of [function, paramseters to be passed to function]
+ * @param {String} field_id form field id
+ * @param {boolean} onKeyUpOnly see validateField
+ * @type Array
+ * @return array of [function, paramseters to be passed to function]
*/
function getFieldValidators(field_id, onKeyUpOnly) {
// look for field bound validator
@@ -417,10 +299,10 @@ function getFieldValidators(field_id, onKeyUpOnly) {
* WARNING: created DOM elements must be identical with the ones made by
* display_input() in FormDisplay.tpl.php!
*
- * @param Object error list (key: field id, value: error array)
+ * @param {Object} error_list list of errors in the form {field id: error array}
*/
function displayErrors(error_list) {
- for (field_id in error_list) {
+ for (var field_id in error_list) {
var errors = error_list[field_id];
var field = $('#'+field_id);
var isFieldset = field.attr('tagName') == 'FIELDSET';
@@ -433,6 +315,13 @@ function displayErrors(error_list) {
return item != '';
});
+ // CSS error class
+ if (!isFieldset) {
+ // checkboxes uses parent <span> for marking
+ var fieldMarker = (field.attr('type') == 'checkbox') ? field.parent() : field;
+ fieldMarker[errors.length ? 'addClass' : 'removeClass']('field-error');
+ }
+
if (errors.length) {
// if error container doesn't exist, create it
if (errorCnt.length == 0) {
@@ -460,15 +349,15 @@ function displayErrors(error_list) {
/**
* Validates fieldset and puts errors in 'errors' object
*
- * @param Element field
- * @param boolean isKeyUp
- * @param Object errors
+ * @param {Element} fieldset
+ * @param {boolean} isKeyUp
+ * @param {Object} errors
*/
function validate_fieldset(fieldset, isKeyUp, errors) {
fieldset = $(fieldset);
if (fieldset.length && typeof validators._fieldset[fieldset.attr('id')] != 'undefined') {
var fieldset_errors = validators._fieldset[fieldset.attr('id')].apply(fieldset[0], [isKeyUp]);
- for (field_id in fieldset_errors) {
+ for (var field_id in fieldset_errors) {
if (typeof errors[field_id] == 'undefined') {
errors[field_id] = [];
}
@@ -483,9 +372,9 @@ function validate_fieldset(fieldset, isKeyUp, errors) {
/**
* Validates form field and puts errors in 'errors' object
*
- * @param Element field
- * @param boolean isKeyUp
- * @param Object errors
+ * @param {Element} field
+ * @param {boolean} isKeyUp
+ * @param {Object} errors
*/
function validate_field(field, isKeyUp, errors) {
field = $(field);
@@ -493,7 +382,11 @@ function validate_field(field, isKeyUp, errors) {
errors[field_id] = [];
var functions = getFieldValidators(field_id, isKeyUp);
for (var i = 0; i < functions.length; i++) {
- var result = functions[i][0].apply(field[0], [isKeyUp, functions[i][1]]);
+ var args = functions[i][1] != null
+ ? functions[i][1].slice(0)
+ : [];
+ args.unshift(isKeyUp);
+ var result = functions[i][0].apply(field[0], args);
if (result !== true) {
if (typeof result == 'string') {
result = [result];
@@ -506,8 +399,8 @@ function validate_field(field, isKeyUp, errors) {
/**
* Validates form field and parent fieldset
*
- * @param Element field
- * @param boolean isKeyUp
+ * @param {Element} field
+ * @param {boolean} isKeyUp
*/
function validate_field_and_fieldset(field, isKeyUp) {
field = $(field);
@@ -520,7 +413,7 @@ function validate_field_and_fieldset(field, isKeyUp) {
/**
* Marks field depending on its value (system default or custom)
*
- * @param Element field
+ * @param {Element} field
*/
function markField(field) {
field = $(field);
@@ -536,12 +429,12 @@ function markField(field) {
/**
* Enables or disables the "restore default value" button
*
- * @param Element field
- * @param bool display
+ * @param {Element} field
+ * @param {boolean} display
*/
function setRestoreDefaultBtn(field, display) {
- var el = $(field).closest('td').find('.restore-default');
- el.css('display', (el.css('display') ? '' : 'none'));
+ var el = $(field).closest('td').find('.restore-default img');
+ el[display ? 'show' : 'hide']();
}
$(function() {
@@ -565,7 +458,7 @@ $(function() {
// disable textarea spellcheck
if (tagName == 'TEXTAREA') {
el.attr('spellcheck', false);
- }
+ }
});
// check whether we've refreshed a page and browser remembered modified
@@ -581,7 +474,7 @@ $(function() {
$('fieldset').each(function(){
validate_fieldset(this, false, errors);
});
-
+
displayErrors(errors);
} else if (check_page_refresh) {
check_page_refresh.val('1');
@@ -599,62 +492,43 @@ $(function() {
/**
* Sets active tab
*
- * @param Element tab_link
+ * @param {String} tab_id
*/
-function setTab(tab_link) {
- var tabs_menu = $(tab_link).closest('.tabs');
-
- var links = tabs_menu.find('a');
- var contents, link;
- for (var i = 0, imax = links.length; i < imax; i++) {
- link = $(links[i]);
- contents = $(link.attr('href'));
- if (links[i] == tab_link) {
- link.addClass('active');
- contents.css('display', 'block');
- } else {
- link.removeClass('active');
- contents.css('display', 'none');
- }
- }
- location.hash = 'tab_' + $(tab_link).attr('href').substr(1);
+function setTab(tab_id) {
+ $('.tabs a').removeClass('active').filter('[href=' + tab_id + ']').addClass('active');
+ $('.tabs_contents fieldset').hide().filter(tab_id).show();
+ location.hash = 'tab_' + tab_id.substr(1);
+ $('.config-form input[name=tab_hash]').val(location.hash);
}
$(function() {
var tabs = $('.tabs');
- var url_tab = location.hash.match(/^#tab_.+/)
- ? $('a[href$="' + location.hash.substr(5) + '"]') : null;
- if (url_tab) {
- url_tab = url_tab[0];
+ if (!tabs.length) {
+ return;
}
// add tabs events and activate one tab (the first one or indicated by location hash)
- for (var i = 0, imax = tabs.length; i < imax; i++) {
- var links = $(tabs[i]).find('a');
- var selected_tab = links[0];
- for (var j = 0, jmax = links.length; j < jmax; j++) {
- $(links[j]).click(function(e) {
- e.preventDefault();
- setTab(this);
- });
- if (links[j] == url_tab) {
- selected_tab = links[j];
- }
- }
- setTab(selected_tab);
- }
+ tabs.find('a')
+ .click(function(e) {
+ e.preventDefault();
+ setTab($(this).attr('href'));
+ })
+ .filter(':first')
+ .addClass('active');
+ $('.tabs_contents fieldset').hide().filter(':first').show();
+
// tab links handling, check each 200ms
// (works with history in FF, further browser support here would be an overkill)
- var prev_hash = location.hash;
- setInterval(function() {
+ var prev_hash;
+ var tab_check_fnc = function() {
if (location.hash != prev_hash) {
prev_hash = location.hash;
- var url_tab = location.hash.match(/^#tab_.+/)
- ? $('a[href$="' + location.hash.substr(5) + '"]') : null;
- if (url_tab) {
- setTab(url_tab[0]);
+ if (location.hash.match(/^#tab_.+/) && $('#' + location.hash.substr(5)).length) {
+ setTab('#' + location.hash.substr(5));
}
}
- }, 200);
+ };
+ tab_check_fnc();
+ setInterval(tab_check_fnc, 200);
});
//
@@ -666,7 +540,7 @@ $(function() {
//
$(function() {
- $('input[type=button]').click(function(e) {
+ $('input[type=button][name=submit_reset]').click(function() {
var fields = $(this).closest('fieldset').find('input, select, textarea');
for (var i = 0, imax = fields.length; i < imax; i++) {
setFieldValue(fields[i], getFieldType(fields[i]));
@@ -685,7 +559,7 @@ $(function() {
/**
* Restores field's default value
*
- * @param String field_id
+ * @param {String} field_id
*/
function restoreField(field_id) {
var field = $('#'+field_id);
@@ -696,34 +570,179 @@ function restoreField(field_id) {
}
$(function() {
- $('.restore-default, .set-value').each(function() {
- var link = $(this);
- link.css('opacity', 0.25);
- if (!link.hasClass('restore-default')) {
- // restore-default is handled by markField
- link.css('display', '');
- }
- link.bind({
- mouseenter: function() {$(this).css('opacity', 1);},
- mouseleave: function() {$(this).css('opacity', 0.25);},
- click: function(e) {
- e.preventDefault();
- var href = $(this).attr('href').substr(1);
- var field_id;
- if ($(this).hasClass('restore-default')) {
- field_id = href;
- restoreField(field_id);
- } else {
- field_id = href.match(/^[^=]+/)[0];
- var value = href.match(/=(.+)$/)[1];
- setFieldValue($('#'+field_id), 'text', value);
- }
- $('#'+field_id).trigger('change');
+ $('.tabs_contents')
+ .delegate('.restore-default, .set-value', 'mouseenter', function(){$(this).css('opacity', 1)})
+ .delegate('.restore-default, .set-value', 'mouseleave', function(){$(this).css('opacity', 0.25)})
+ .delegate('.restore-default, .set-value', 'click', function(e) {
+ e.preventDefault();
+ var href = $(this).attr('href');
+ var field_sel;
+ if ($(this).hasClass('restore-default')) {
+ field_sel = href;
+ restoreField(field_sel.substr(1));
+ } else {
+ field_sel = href.match(/^[^=]+/)[0];
+ var value = href.match(/=(.+)$/)[1];
+ setFieldValue($(field_sel), 'text', value);
}
- });
- });
+ $(field_sel).trigger('change');
+ })
+ .find('.restore-default, .set-value')
+ // inline-block for IE so opacity inheritance works
+ .css({display: 'inline-block', opacity: 0.25});
});
//
// END: "Restore default" and "set value" buttons
// ------------------------------------------------------------------
+
+// ------------------------------------------------------------------
+// User preferences import/export
+//
+
+$(function() {
+ offerPrefsAutoimport();
+ var radios = $('#import_local_storage, #export_local_storage');
+ if (!radios.length) {
+ return;
+ }
+
+ // enable JavaScript dependent fields
+ radios
+ .attr('disabled', false)
+ .add('#export_text_file, #import_text_file')
+ .click(function(){
+ var enable_id = $(this).attr('id');
+ var disable_id = enable_id.match(/local_storage$/)
+ ? enable_id.replace(/local_storage$/, 'text_file')
+ : enable_id.replace(/text_file$/, 'local_storage');
+ $('#opts_'+disable_id).addClass('disabled').find('input').attr('disabled', true);
+ $('#opts_'+enable_id).removeClass('disabled').find('input').attr('disabled', false);
+ });
+
+ // detect localStorage state
+ var ls_supported = window.localStorage || false;
+ var ls_exists = ls_supported ? (window.localStorage['config'] || false) : false;
+ $('.localStorage-'+(ls_supported ? 'un' : '')+'supported').hide();
+ $('.localStorage-'+(ls_exists ? 'empty' : 'exists')).hide();
+ if (ls_exists) {
+ updatePrefsDate();
+ }
+ $('form.prefs-form').change(function(){
+ var form = $(this);
+ var disabled = false;
+ if (!ls_supported) {
+ disabled = form.find('input[type=radio][value$=local_storage]').attr('checked');
+ } else if (!ls_exists && form.attr('name') == 'prefs_import'
+ && $('#import_local_storage')[0].checked) {
+ disabled = true;
+ }
+ form.find('input[type=submit]').attr('disabled', disabled);
+ }).submit(function(e) {
+ var form = $(this);
+ if (form.attr('name') == 'prefs_export' && $('#export_local_storage')[0].checked) {
+ e.preventDefault();
+ // use AJAX to read JSON settings and save them
+ savePrefsToLocalStorage(form);
+ } else if (form.attr('name') == 'prefs_import' && $('#import_local_storage')[0].checked) {
+ // set 'json' input and submit form
+ form.find('input[name=json]').val(window.localStorage['config']);
+ }
+ });
+
+ $('.click-hide-message').live('click', function(){
+ var div = $(this);
+ div.hide().parent('.group').css('height', '');
+ div.next('form').show();
+ });
+});
+
+/**
+ * Saves user preferences to localStorage
+ *
+ * @param {Element} form
+ */
+function savePrefsToLocalStorage(form)
+{
+ form = $(form);
+ var submit = form.find('input[type=submit]');
+ submit.attr('disabled', true);
+ $.ajax({
+ url: 'prefs_manage.php',
+ cache: false,
+ type: 'POST',
+ data: {
+ token: form.find('input[name=token]').val(),
+ submit_get_json: true
+ },
+ success: function(response) {
+ window.localStorage['config'] = response.prefs;
+ window.localStorage['config_mtime'] = response.mtime;
+ window.localStorage['config_mtime_local'] = (new Date()).toUTCString();
+ updatePrefsDate();
+ $('.localStorage-empty').hide();
+ $('.localStorage-exists').show();
+ var group = form.parent('.group');
+ group.css('height', group.height() + 'px');
+ form.hide('fast');
+ form.prev('.click-hide-message').show('fast');
+ },
+ complete: function() {
+ submit.attr('disabled', false);
+ }
+ });
+}
+
+/**
+ * Updates preferences timestamp in Import form
+ */
+function updatePrefsDate()
+{
+ var d = new Date(window.localStorage['config_mtime_local']);
+ var msg = PMA_messages['strSavedOn'].replace('__DATE__', formatDate(d));
+ $('#opts_import_local_storage .localStorage-exists').html(msg);
+}
+
+/**
+ * Returns date formatted as YYYY-MM-DD HH:II
+ *
+ * @param {Date} d
+ */
+function formatDate(d)
+{
+ return d.getFullYear() + '-'
+ + (d.getMonth() < 10 ? '0'+d.getMonth() : d.getMonth())
+ + '-' + (d.getDate() < 10 ? '0'+d.getDate() : d.getDate())
+ + ' ' + (d.getHours() < 10 ? '0'+d.getHours() : d.getHours())
+ + ':' + (d.getMinutes() < 10 ? '0'+d.getMinutes() : d.getMinutes());
+}
+
+/**
+ * Prepares message which informs that localStorage preferences are available and can be imported
+ */
+function offerPrefsAutoimport()
+{
+ var has_config = (window.localStorage || false) && (window.localStorage['config'] || false);
+ var cnt = $('#prefs_autoload');
+ if (!cnt.length || !has_config) {
+ return;
+ }
+ cnt.find('a').click(function(e) {
+ e.preventDefault();
+ var a = $(this);
+ if (a.attr('href') == '#no') {
+ cnt.remove();
+ $.post('main.php', {
+ token: cnt.find('input[name=token]').val(),
+ prefs_autoload: 'hide'});
+ return;
+ }
+ cnt.find('input[name=json]').val(window.localStorage['config']);
+ cnt.find('form').submit();
+ });
+ cnt.show();
+}
+
+//
+// END: User preferences import/export
+// ------------------------------------------------------------------
\ No newline at end of file
diff --git a/js/functions.js b/js/functions.js
index 2d57f3b..75ffee5 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -1893,4 +1893,100 @@ $(document).ready(function() {
style: { background: '#ffffcc' }
});
});
-});
\ No newline at end of file
+});
+
+function menuResize()
+{
+ var cnt = $('#topmenu');
+ var wmax = cnt.width() - 5; // 5 px margin for jumping menu in Chrome
+ var submenu = cnt.find('.submenu');
+ var submenu_w = submenu.outerWidth(true);
+ var submenu_ul = submenu.find('ul');
+ var li = cnt.find('> li');
+ var li2 = submenu_ul.find('li');
+ var more_shown = li2.length > 0;
+ var w = more_shown ? submenu_w : 0;
+
+ // hide menu items
+ var hide_start = 0;
+ for (var i = 0; i < li.length-1; i++) { // li.length-1: skip .submenu element
+ var el = $(li[i]);
+ var el_width = el.outerWidth(true);
+ el.data('width', el_width);
+ w += el_width;
+ if (w > wmax) {
+ w -= el_width;
+ if (w + submenu_w < wmax) {
+ hide_start = i;
+ } else {
+ hide_start = i-1;
+ w -= $(li[i-1]).data('width');
+ }
+ break;
+ }
+ }
+
+ if (hide_start > 0) {
+ for (var i = hide_start; i < li.length-1; i++) {
+ $(li[i])[more_shown ? 'prependTo' : 'appendTo'](submenu_ul);
+ }
+ submenu.show();
+ } else if (more_shown) {
+ w -= submenu_w;
+ // nothing hidden, maybe something can be restored
+ for (var i = 0; i < li2.length; i++) {
+ //console.log(li2[i], submenu_w);
+ w += $(li2[i]).data('width');
+ // item fits or (it is the last item and it would fit if More got removed)
+ if (w+submenu_w < wmax || (i == li2.length-1 && w < wmax)) {
+ $(li2[i]).insertBefore(submenu);
+ if (i == li2.length-1) {
+ submenu.hide();
+ }
+ continue;
+ }
+ break;
+ }
+ }
+ if (submenu.find('.tabactive').length) {
+ submenu.addClass('active').find('> a').removeClass('tab').addClass('tabactive');
+ } else {
+ submenu.removeClass('active').find('> a').addClass('tab').removeClass('tabactive');
+ }
+}
+
+$(function() {
+ var topmenu = $('#topmenu');
+ if (topmenu.length == 0) {
+ return;
+ }
+ // create submenu container
+ var link = $('<a />', {href: '#', 'class': 'tab'})
+ .text(PMA_messages['strMore'])
+ .click(function(e) {
+ e.preventDefault();
+ });
+ var img = topmenu.find('li:first-child img');
+ if (img.length) {
+ img.clone().attr('src', img.attr('src').replace(/\/[^\/]+$/, '/b_more.png')).prependTo(link);
+ }
+ var submenu = $('<li />', {'class': 'submenu'})
+ .append(link)
+ .append($('<ul />'))
+ .mouseenter(function() {
+ if ($(this).find('ul .tabactive').length == 0) {
+ $(this).addClass('submenuhover').find('> a').addClass('tabactive');
+ }
+ })
+ .mouseleave(function() {
+ if ($(this).find('ul .tabactive').length == 0) {
+ $(this).removeClass('submenuhover').find('> a').removeClass('tabactive');
+ }
+ })
+ .hide();
+ topmenu.append(submenu);
+
+ // populate submenu and register resize event
+ $(window).resize(menuResize);
+ menuResize();
+});
diff --git a/js/messages.php b/js/messages.php
index 4999002..94e1e67 100644
--- a/js/messages.php
+++ b/js/messages.php
@@ -66,6 +66,9 @@ $js_messages['strChangeDisplay'] = __('Choose column to display');
$js_messages['strGeneratePassword'] = __('Generate password');
$js_messages['strGenerate'] = __('Generate');
+/* navigation tabs */
+$js_messages['strMore'] = __('More');
+
echo "var PMA_messages = new Array();\n";
foreach ($js_messages as $name => $js_message) {
PMA_printJsValue("PMA_messages['" . $name . "']", $js_message);
diff --git a/libraries/Config.class.php b/libraries/Config.class.php
index 7389b9f..16fe5a1 100644
--- a/libraries/Config.class.php
+++ b/libraries/Config.class.php
@@ -24,6 +24,11 @@ class PMA_Config
var $default_source = './libraries/config.default.php';
/**
+ * @var array default configuration settings
+ */
+ var $default = array();
+
+ /**
* @var array configuration settings
*/
var $settings = array();
@@ -320,6 +325,7 @@ class PMA_Config
$this->default_server = $cfg['Servers'][1];
unset($cfg['Servers']);
+ $this->default = $cfg;
$this->settings = PMA_array_merge_recursive($this->settings, $cfg);
$this->error_config_default_file = false;
@@ -409,6 +415,176 @@ class PMA_Config
}
/**
+ * Loads user preferences and merges them with current config
+ * must be called after control connection has been estabilished
+ *
+ * @uses $GLOBALS['cfg']
+ * @uses $GLOBALS['collation_connection']
+ * @uses $GLOBALS['lang']
+ * @uses $_SESSION['cache']['server_$server']['config_mtime']
+ * @uses $_SESSION['cache']['server_$server']['userprefs']
+ * @uses $_SESSION['cache']['server_$server']['userprefs_mtime']
+ * @uses $_SESSION['PMA_Theme_Manager']
+ * @uses PMA_apply_userprefs()
+ * @uses PMA_array_merge_recursive()
+ * @uses PMA_load_userprefs()
+ * @return boolean
+ */
+ function loadUserPreferences()
+ {
+ // index.php should load these settings, so that phpmyadmin.css.php
+ // will have everything avaiable in session cache
+ $server = isset($GLOBALS['server'])
+ ? $GLOBALS['server']
+ : (!empty($GLOBALS['cfg']['ServerDefault']) ? $GLOBALS['cfg']['ServerDefault'] : 0);
+ $cache_key = 'server_' . $server;
+ if ($server > 0 && !defined('PMA_MINIMUM_COMMON')) {
+ $config_mtime = max($this->default_source_mtime, $this->source_mtime);
+ // cache user preferences, use database only when needed
+ if (!isset($_SESSION['cache'][$cache_key]['userprefs'])
+ || $_SESSION['cache'][$cache_key]['config_mtime'] < $config_mtime) {
+ // load required libraries
+ require_once './libraries/user_preferences.lib.php';
+ $prefs = PMA_load_userprefs();
+ $_SESSION['cache'][$cache_key]['userprefs'] = PMA_apply_userprefs($prefs['config_data']);
+ $_SESSION['cache'][$cache_key]['userprefs_mtime'] = $prefs['mtime'];
+ $_SESSION['cache'][$cache_key]['userprefs_type'] = $prefs['type'];
+ $_SESSION['cache'][$cache_key]['config_mtime'] = $config_mtime;
+ }
+ } else if ($server == 0 || !isset($_SESSION['cache'][$cache_key]['userprefs'])) {
+ $this->set('user_preferences', false);
+ return;
+ }
+ $config_data = $_SESSION['cache'][$cache_key]['userprefs'];
+ // type is 'db' or 'session'
+ $this->set('user_preferences', $_SESSION['cache'][$cache_key]['userprefs_type']);
+ $this->set('user_preferences_mtime', $_SESSION['cache'][$cache_key]['userprefs_mtime']);
+
+ // backup some settings
+ $org_fontsize = $this->settings['fontsize'];
+ // load config array
+ $this->settings = PMA_array_merge_recursive($this->settings, $config_data);
+ $GLOBALS['cfg'] = PMA_array_merge_recursive($GLOBALS['cfg'], $config_data);
+ if (defined('PMA_MINIMUM_COMMON')) {
+ return;
+ }
+
+ // settings below start really working on next page load, but
+ // changes are made only in index.php so everything is set when
+ // in frames
+
+ // save theme
+ $tmanager = $_SESSION['PMA_Theme_Manager'];
+ if ($tmanager->getThemeCookie() || isset($_REQUEST['set_theme'])) {
+ if ((!isset($config_data['ThemeDefault']) && $tmanager->theme->getId() != 'original')
+ || isset($config_data['ThemeDefault']) && $config_data['ThemeDefault'] != $tmanager->theme->getId()) {
+ // new theme was set in common.inc.php
+ $this->setUserValue(null, 'ThemeDefault', $tmanager->theme->getId(), 'original');
+ }
+ } else {
+ // no cookie - read default from settings
+ if ($this->settings['ThemeDefault'] != $tmanager->theme->getId()
+ && $tmanager->checkTheme($this->settings['ThemeDefault'])) {
+ $tmanager->setActiveTheme($this->settings['ThemeDefault']);
+ $tmanager->setThemeCookie();
+ }
+ }
+
+ // save font size
+ if ((!isset($config_data['fontsize']) && $org_fontsize != '82%')
+ || isset($config_data['fontsize']) && $org_fontsize != $config_data['fontsize']) {
+ $this->setUserValue(null, 'fontsize', $org_fontsize, '82%');
+ }
+
+ // save language
+ if (isset($_COOKIE['pma_lang']) || isset($_POST['lang'])) {
+ if ((!isset($config_data['lang']) && $GLOBALS['lang'] != 'en')
+ || isset($config_data['lang']) && $GLOBALS['lang'] != $config_data['lang']) {
+ $this->setUserValue(null, 'lang', $GLOBALS['lang'], 'en');
+ }
+ } else {
+ // read language from settings
+ if (isset($config_data['lang']) && PMA_langSet($config_data['lang'])) {
+ $this->setCookie('pma_lang', $GLOBALS['lang']);
+ }
+ }
+
+ // save connection collation
+ if (isset($_COOKIE['pma_collation_connection']) || isset($_POST['collation_connection'])) {
+ if ((!isset($config_data['collation_connection']) && $GLOBALS['collation_connection'] != 'utf8_general_ci')
+ || isset($config_data['collation_connection']) && $GLOBALS['collation_connection'] != $config_data['collation_connection']) {
+ $this->setUserValue(null, 'collation_connection', $GLOBALS['collation_connection'], 'utf8_general_ci');
+ }
+ } else {
+ // read collation from settings
+ if (isset($config_data['collation_connection'])) {
+ $GLOBALS['collation_connection'] = $config_data['collation_connection'];
+ $this->setCookie('pma_collation_connection', $GLOBALS['collation_connection']);
+ }
+ }
+ }
+
+ /**
+ * Sets config value which is stored in user preferences (if available) or in a cookie.
+ *
+ * If user preferences are not yet initialized, option is applied to global config and
+ * added to a update queue, which is processed by {@link loadUserPreferences()}
+ *
+ * @uses $GLOBALS['cfg']
+ * @uses PMA_array_read()
+ * @uses PMA_array_write()
+ * @uses PMA_persist_option()
+ * @param string $cookie_name can be null
+ * @param string $cfg_path
+ * @param mixed $new_cfg_value
+ * @param mixed $default_value
+ */
+ function setUserValue($cookie_name, $cfg_path, $new_cfg_value, $default_value = null)
+ {
+ // use permanent user preferences if possible
+ $prefs_type = $this->get('user_preferences');
+ if ($prefs_type) {
+ require_once './libraries/user_preferences.lib.php';
+ if ($default_value === null) {
+ $default_value = PMA_array_read($cfg_path, $this->default);
+ }
+ PMA_persist_option($cfg_path, $new_cfg_value, $default_value);
+ }
+ if ($prefs_type != 'db' && $cookie_name) {
+ // fall back to cookies
+ if ($default_value === null) {
+ $default_value = PMA_array_read($cfg_path, $this->settings);
+ }
+ $this->setCookie($cookie_name, $new_cfg_value, $default_value);
+ }
+ PMA_array_write($cfg_path, $GLOBALS['cfg'], $new_cfg_value);
+ PMA_array_write($cfg_path, $this->settings, $new_cfg_value);
+ }
+
+ /**
+ * Reads value stored by {@link setUserValue()}
+ *
+ * @param string $cookie_name
+ * @param mixed $cfg_value
+ * @return mixed
+ */
+ function getUserValue($cookie_name, $cfg_value)
+ {
+ $cookie_exists = isset($_COOKIE) && !empty($_COOKIE[$cookie_name]);
+ $prefs_type = $this->get('user_preferences');
+ if ($prefs_type == 'db') {
+ // permanent user preferences value exists, remove cookie
+ if ($cookie_exists) {
+ $this->removeCookie($cookie_name);
+ }
+ } else if ($cookie_exists) {
+ return $_COOKIE[$cookie_name];
+ }
+ // return value from $cfg array
+ return $cfg_value;
+ }
+
+ /**
* set source
* @param string $source
*/
@@ -537,6 +713,7 @@ class PMA_Config
$fontsize +
$this->source_mtime +
$this->default_source_mtime +
+ $this->get('user_preferences_mtime') +
$_SESSION['PMA_Theme']->mtime_info +
$_SESSION['PMA_Theme']->filesize_info)
. (isset($_SESSION['tmp_user_values']['custom_color']) ? substr($_SESSION['tmp_user_values']['custom_color'],1,6) : '');
@@ -726,10 +903,10 @@ class PMA_Config
{
$new_fontsize = '';
- if (isset($_GET['fontsize'])) {
- $new_fontsize = $_GET['fontsize'];
- } elseif (isset($_POST['fontsize'])) {
- $new_fontsize = $_POST['fontsize'];
+ if (isset($_GET['set_fontsize'])) {
+ $new_fontsize = $_GET['set_fontsize'];
+ } elseif (isset($_POST['set_fontsize'])) {
+ $new_fontsize = $_POST['set_fontsize'];
} elseif (isset($_COOKIE['pma_fontsize'])) {
$new_fontsize = $_COOKIE['pma_fontsize'];
}
@@ -1011,7 +1188,7 @@ class PMA_Config
$options = PMA_Config::_getFontsizeOptions($current_size);
$return = '<label for="select_fontsize">' . __('Font size') . ':</label>' . "\n";
- $return .= '<select name="fontsize" id="select_fontsize" onchange="this.form.submit();">' . "\n";
+ $return .= '<select name="set_fontsize" id="select_fontsize" onchange="this.form.submit();">' . "\n";
foreach ($options as $option) {
$return .= '<option value="' . $option . '"';
if ($option == $current_size) {
diff --git a/libraries/common.inc.php b/libraries/common.inc.php
index a728c5a..ab22f17 100644
--- a/libraries/common.inc.php
+++ b/libraries/common.inc.php
@@ -956,6 +956,9 @@ if (! defined('PMA_MINIMUM_COMMON')) {
} // end if !defined('PMA_MINIMUM_COMMON')
+// load user preferences
+$GLOBALS['PMA_Config']->loadUserPreferences();
+
// remove sensitive values from session
$GLOBALS['PMA_Config']->set('blowfish_secret', '');
$GLOBALS['PMA_Config']->set('Servers', '');
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 23b3eee..741d8cb 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -1576,7 +1576,7 @@ function PMA_generate_html_tab($tab, $url_params = array())
$defaults = array(
'text' => '',
'class' => '',
- 'active' => false,
+ 'active' => null,
'link' => '',
'sep' => '?',
'attr' => '',
@@ -1595,7 +1595,7 @@ function PMA_generate_html_tab($tab, $url_params = array())
} elseif (! empty($tab['active'])
|| PMA_isValid($GLOBALS['active_page'], 'identical', $tab['link'])) {
$tab['class'] = 'active';
- } elseif (empty($GLOBALS['active_page'])
+ } elseif (is_null($tab['active']) && empty($GLOBALS['active_page'])
&& basename($GLOBALS['PMA_PHP_SELF']) == $tab['link']
&& empty($tab['warning'])) {
$tab['class'] = 'active';
diff --git a/libraries/config.default.php b/libraries/config.default.php
index 691a0f7..9c5ea62 100644
--- a/libraries/config.default.php
+++ b/libraries/config.default.php
@@ -341,6 +341,15 @@ $cfg['Servers'][$i]['designer_coords'] = '';
$cfg['Servers'][$i]['tracking'] = '';
/**
+ * table to store user preferences
+ * - leave blank to disable server storage
+ * SUGGESTED: 'pma_userconfig'
+ *
+ * @global string $cfg['Servers'][$i]['userconfig']
+ */
+$cfg['Servers'][$i]['userconfig'] = '';
+
+/**
* set to false if you know that your pma_* tables are up to date.
* This prevents compatibility checks and thereby increases performance.
*
@@ -1064,6 +1073,13 @@ $cfg['Export'] = array();
$cfg['Export']['format'] = 'sql';
/**
+ * quick/custom/custom-no-form
+ *
+ * @global string $cfg['Export']['format']
+ */
+$cfg['Export']['method'] = 'quick';
+
+/**
* none/zip/gzip/bzip2
*
* @global string $cfg['Export']['compression']
@@ -1148,6 +1164,13 @@ $cfg['Export']['file_template_server'] = '@SERVER@';
$cfg['Export']['codegen_structure_or_data'] = 'data';
/**
+ *
+ *
+ * @global $cfg['Export']['codegen_format']
+ */
+$cfg['Export']['codegen_format'] = 0;
+
+/**
*
*
* @global boolean $cfg['Export']['ods_columns']
@@ -1339,6 +1362,13 @@ $cfg['Export']['csv_terminated'] = 'AUTO';
/**
*
*
+ * @global string $cfg['Export']['csv_removeCRLF']
+ */
+$cfg['Export']['csv_removeCRLF'] = false;
+
+/**
+ *
+ *
* @global boolean $cfg['Export']['excel_columns']
*/
$cfg['Export']['excel_columns'] = false;
@@ -1360,6 +1390,13 @@ $cfg['Export']['excel_edition'] = 'win';
/**
*
*
+ * @global string $cfg['Export']['excel_removeCRLF']
+ */
+$cfg['Export']['excel_removeCRLF'] = false;
+
+/**
+ *
+ *
* @global string $cfg['Export']['excel_structure_or_data']
*/
$cfg['Export']['excel_structure_or_data'] = 'data';
@@ -1616,7 +1653,7 @@ $cfg['Export']['sql_hex_for_blob'] = true;
*
* @global string $cfg['Export']['sql_type']
*/
-$cfg['Export']['sql_type'] = 'insert';
+$cfg['Export']['sql_type'] = 'INSERT';
/**
*
@@ -1673,6 +1710,7 @@ $cfg['Export']['pdf_report_title'] = '';
*@global string $cfg['Export']['xml_structure_or_data']
*/
$cfg['Export']['xml_structure_or_data'] = 'data';
+
/**
* Export schema for each structure
*
@@ -1728,6 +1766,7 @@ $cfg['Export']['xml_export_contents'] = true;
* @global string $cfg['Export']['yaml_structure_or_data']
*/
$cfg['Export']['yaml_structure_or_data'] = 'data';
+
/*******************************************************************************
* Import defaults
*/
@@ -1759,7 +1798,7 @@ $cfg['Import']['allow_interrupt'] = true;
*
* @global integer $cfg['Import']['skip_queries']
*/
-$cfg['Import']['skip_queries'] = '0';
+$cfg['Import']['skip_queries'] = 0;
/**
*
@@ -1785,6 +1824,13 @@ $cfg['Import']['csv_replace'] = false;
/**
*
*
+ * @global boolean $cfg['Import']['csv_ignore']
+ */
+$cfg['Import']['csv_ignore'] = false;
+
+/**
+ *
+ *
* @global string $cfg['Import']['csv_terminated']
*/
$cfg['Import']['csv_terminated'] = ',';
@@ -1834,6 +1880,13 @@ $cfg['Import']['ldi_replace'] = false;
/**
*
*
+ * @global boolean $cfg['Import']['ldi_ignore']
+ */
+$cfg['Import']['ldi_ignore'] = false;
+
+/**
+ *
+ *
* @global string $cfg['Import']['ldi_terminated']
*/
$cfg['Import']['ldi_terminated'] = ';';
@@ -1916,6 +1969,13 @@ $cfg['Import']['xls_col_names'] = false;
$cfg['Import']['xls_empty_rows'] = true;
/**
+ *
+ *
+ * @global string $cfg['Import']['xlsx_col_names']
+ */
+$cfg['Import']['xlsx_col_names'] = false;
+
+/**
* Link to the official MySQL documentation.
* Be sure to include no trailing slash on the path.
* See http://dev.mysql.com/doc/ for more information
@@ -2171,7 +2231,7 @@ $cfg['DefaultDisplay'] = 'horizontal';
/**
* default display direction for altering/creating columns (tbl_properties)
* (horizontal|vertical|<number>)
- * number indicates maximal number for which vertical model is used
+ * number indicates maximum number for which vertical model is used
*
* @global integer $cfg['DefaultPropDisplay']
*/
@@ -2295,7 +2355,18 @@ $cfg['NaturalOrder'] = true;
*/
$cfg['InitialSlidersState'] = 'closed';
+/**
+ * User preferences: disallow these settings
+ * For possible setting names look in libraries/config/user_preferences.forms.php
+ *
+ * @global array $cfg['UserprefsDisallow']
+ */
+$cfg['UserprefsDisallow'] = array();
+/**
+ * User preferences: enable the Developer tab
+ */
+$cfg['UserprefsDeveloperTab'] = false;
/*******************************************************************************
* Window title settings
diff --git a/libraries/config.values.php b/libraries/config.values.php
new file mode 100644
index 0000000..dea8a23
--- /dev/null
+++ b/libraries/config.values.php
@@ -0,0 +1,189 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Database with allowed values for configuration stored in the $cfg array,
+ * used by setup script and user preferences to generate forms.
+ *
+ * @package phpMyAdmin
+ */
+
+if (!defined('PHPMYADMIN')) {
+ exit;
+}
+
+/**
+ * Value meaning:
+ * o array - select field, array contains allowed values
+ * o string - type override
+ *
+ * Use normal array, paths won't be expanded
+ */
+$cfg_db = array();
+
+$cfg_db['Servers'] = array(1 => array(
+ 'port' => 'integer',
+ 'connect_type' => array('tcp', 'socket'),
+ 'extension' => array('mysql', 'mysqli'),
+ 'auth_type' => array('config', 'http', 'signon', 'cookie'),
+ 'AllowDeny' => array(
+ 'order' => array('', 'deny,allow', 'allow,deny', 'explicit')),
+ 'only_db' => 'array'));
+$cfg_db['RecodingEngine'] = array('auto', 'iconv', 'recode', 'none');
+$cfg_db['OBGzip'] = array('auto', true, false);
+$cfg_db['MemoryLimit'] = 'short_string';
+$cfg_db['ShowTooltipAliasTB'] = array('nested', true, false);
+$cfg_db['DisplayDatabasesList'] = array('auto', true, false);
+$cfg_db['LeftLogoLinkWindow'] = array('main', 'new');
+$cfg_db['LeftDefaultTabTable'] = array(
+ 'tbl_structure.php', // fields list
+ 'tbl_sql.php', // SQL form
+ 'tbl_select.php', // search page
+ 'tbl_change.php', // insert row page
+ 'sql.php'); // browse page
+$cfg_db['LeftFrameDBSeparator'] = 'short_string';
+$cfg_db['LeftFrameTableSeparator'] = 'short_string';
+$cfg_db['NavigationBarIconic'] = array(true, false, 'both');
+$cfg_db['Order'] = array('ASC', 'DESC', 'SMART');
+$cfg_db['ProtectBinary'] = array(false, 'blob', 'all');
+$cfg_db['DefaultDisplay'] = array('horizontal', 'vertical', 'horizontalflipped');
+$cfg_db['CharEditing'] = array('input', 'textarea');
+$cfg_db['PropertiesIconic'] = array(true, false, 'both');
+$cfg_db['DefaultTabServer'] = array(
+ 'main.php', // the welcome page (recommended for multiuser setups)
+ 'server_databases.php', // list of databases
+ 'server_status.php', // runtime information
+ 'server_variables.php', // MySQL server variables
+ 'server_privileges.php', // user management
+ 'server_processlist.php'); // process list
+$cfg_db['DefaultTabDatabase'] = array(
+ 'db_structure.php', // tables list
+ 'db_sql.php', // SQL form
+ 'db_search.php', // search query
+ 'db_operations.php'); // operations on database
+$cfg_db['DefaultTabTable'] = array(
+ 'tbl_structure.php', // fields list
+ 'tbl_sql.php', // SQL form
+ 'tbl_select.php', // search page
+ 'tbl_change.php', // insert row page
+ 'sql.php'); // browse page
+$cfg_db['QueryWindowDefTab'] = array(
+ 'sql', // SQL
+ 'files', // Import files
+ 'history', // SQL history
+ 'full'); // All (SQL and SQL history)
+$cfg_db['InitialSlidersState'] = array('open', 'closed');
+$cfg_db['Import']['format'] = array(
+ 'csv', // CSV
+ 'docsql', // DocSQL
+ 'ldi', // CSV using LOAD DATA
+ 'sql'); // SQL
+$cfg_db['Import']['charset'] = array_merge(array(''), $GLOBALS['cfg']['AvailableCharsets']);
+$cfg_db['Import']['sql_compatibility'] = $cfg_db['Export']['sql_compatibility'] = array(
+ 'NONE', 'ANSI', 'DB2', 'MAXDB', 'MYSQL323', 'MYSQL40', 'MSSQL', 'ORACLE',
+ // removed; in MySQL 5.0.33, this produces exports that
+ // can't be read by POSTGRESQL (see our bug #1596328)
+ //'POSTGRESQL',
+ 'TRADITIONAL');
+$cfg_db['Import']['csv_terminated'] = 'short_string';
+$cfg_db['Import']['csv_enclosed'] = 'short_string';
+$cfg_db['Import']['csv_escaped'] = 'short_string';
+$cfg_db['Import']['ldi_terminated'] = 'short_string';
+$cfg_db['Import']['ldi_enclosed'] = 'short_string';
+$cfg_db['Import']['ldi_escaped'] = 'short_string';
+$cfg_db['Import']['ldi_local_option'] = array('auto', true, false);
+$cfg_db['Export']['_sod_select'] = array(
+ 'structure' => __('structure'),
+ 'data' => __('data'),
+ 'structure_and_data' => __('structure and data'));
+$cfg_db['Export']['method'] = array(
+ 'quick' => __('Quick - display only the minimal options to configure'),
+ 'custom' => __('Custom - display all possible options to configure'),
+ 'custom-no-form' => __('Custom - like above, but without the quick/custom choice'));
+$cfg_db['Export']['format'] = array('codegen', 'csv', 'excel', 'htmlexcel',
+ 'htmlword', 'latex', 'ods', 'odt', 'pdf', 'sql', 'texytext', 'xls', 'xml',
+ 'yaml');
+$cfg_db['Export']['compression'] = array('none', 'zip', 'gzip', 'bzip2');
+$cfg_db['Export']['charset'] = array_merge(array(''), $GLOBALS['cfg']['AvailableCharsets']);
+$cfg_db['Export']['codegen_format'] = array('#', 'NHibernate C# DO', 'NHibernate XML');
+$cfg_db['Export']['csv_separator'] = 'short_string';
+$cfg_db['Export']['csv_terminated'] = 'short_string';
+$cfg_db['Export']['csv_enclosed'] = 'short_string';
+$cfg_db['Export']['csv_escaped'] = 'short_string';
+$cfg_db['Export']['csv_null'] = 'short_string';
+$cfg_db['Export']['excel_null'] = 'short_string';
+$cfg_db['Export']['excel_edition'] = array('win' => 'Windows',
+ 'mac_excel2003' => 'Excel 2003 / Macintosh', 'mac_excel2008' => 'Excel 2008 / Macintosh');
+$cfg_db['Export']['sql_structure_or_data'] = $cfg_db['Export']['_sod_select'];
+$cfg_db['Export']['sql_type'] = array('INSERT', 'UPDATE', 'REPLACE');
+$cfg_db['Export']['sql_insert_syntax'] = array(
+ 'complete' => __('complete inserts'),
+ 'extended' => __('extended inserts'),
+ 'both' => __('both of the above'),
+ 'none' => __('neither of the above'));
+$cfg_db['Export']['xls_null'] = 'short_string';
+$cfg_db['Export']['xlsx_null'] = 'short_string';
+$cfg_db['Export']['htmlword_structure_or_data'] = $cfg_db['Export']['_sod_select'];
+$cfg_db['Export']['htmlword_null'] = 'short_string';
+$cfg_db['Export']['ods_null'] = 'short_string';
+$cfg_db['Export']['odt_null'] = 'short_string';
+$cfg_db['Export']['odt_structure_or_data'] = $cfg_db['Export']['_sod_select'];
+$cfg_db['Export']['texytext_structure_or_data'] = $cfg_db['Export']['_sod_select'];
+$cfg_db['Export']['texytext_null'] = 'short_string';
+
+/**
+ * Default values overrides
+ * Use only full paths
+ */
+$cfg_db['_overrides'] = array();
+$cfg_db['_overrides']['Servers/1/extension'] = extension_loaded('mysqli')
+ ? 'mysqli' : 'mysql';
+
+/**
+ * Basic validator assignments (functions from libraries/config/validate.lib.php and 'validators'
+ * object in js/config.js)
+ * Use only full paths and form ids
+ */
+$cfg_db['_validators'] = array(
+ 'CharTextareaCols' => 'validate_positive_number',
+ 'CharTextareaRows' => 'validate_positive_number',
+ 'DefaultPropDisplay' => array(array('validate_by_regex', '/^(?:horizontal|vertical|\d+)$/')),
+ 'ExecTimeLimit' => 'validate_non_negative_number',
+ 'Export/sql_max_query_size' => 'validate_positive_number',
+ 'ForeignKeyMaxLimit' => 'validate_positive_number',
+ 'Import/csv_enclosed' => array(array('validate_by_regex', '/^.?$/')),
+ 'Import/csv_escaped' => array(array('validate_by_regex', '/^.$/')),
+ 'Import/csv_terminated' => array(array('validate_by_regex', '/^.$/')),
+ 'Import/ldi_enclosed' => array(array('validate_by_regex', '/^.?$/')),
+ 'Import/ldi_escaped' => array(array('validate_by_regex', '/^.$/')),
+ 'Import/ldi_terminated' => array(array('validate_by_regex', '/^.$/')),
+ 'Import/skip_queries' => 'validate_non_negative_number',
+ 'InsertRows' => 'validate_positive_number',
+ 'LeftFrameTableLevel' => 'validate_positive_number',
+ 'LimitChars' => 'validate_positive_number',
+ 'LoginCookieValidity' => 'validate_positive_number',
+ 'LoginCookieStore' => 'validate_non_negative_number',
+ 'MaxDbList' => 'validate_positive_number',
+ 'MaxCharactersInDisplayedSQL' => 'validate_positive_number',
+ 'MaxRows' => 'validate_positive_number',
+ 'MaxTableList' => 'validate_positive_number',
+ 'MemoryLimit' => array(array('validate_by_regex', '/^\d+(?:[kmg])?$/i')),
+ 'QueryHistoryMax' => 'validate_positive_number',
+ 'QueryWindowWidth' => 'validate_positive_number',
+ 'QueryWindowHeight' => 'validate_positive_number',
+ 'RepeatCells' => 'validate_non_negative_number',
+ 'Server' => 'validate_server',
+ 'Server_pmadb' => 'validate_pmadb',
+ 'Servers/1/port' => 'validate_port_number',
+ 'Servers/1/hide_db' => 'validate_regex',
+ 'TextareaCols' => 'validate_positive_number',
+ 'TextareaRows' => 'validate_positive_number',
+ 'TrustedProxies' => 'validate_trusted_proxies');
+
+/**
+ * Additional validators used for user preferences
+ */
+$cfg_db['_userValidators'] = array(
+ 'MaxDbList' => array(array('validate_upper_bound', 'value:MaxDbList')),
+ 'MaxTableList' => array(array('validate_upper_bound', 'value:MaxTableList')),
+ 'QueryHistoryMax' => array(array('validate_upper_bound', 'value:QueryHistoryMax')),);
+?>
\ No newline at end of file
diff --git a/libraries/config/ConfigFile.class.php b/libraries/config/ConfigFile.class.php
new file mode 100644
index 0000000..41ffe4b
--- /dev/null
+++ b/libraries/config/ConfigFile.class.php
@@ -0,0 +1,486 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Config file management
+ *
+ * @package phpMyAdmin
+ */
+
+/**
+ * Config file management class.
+ * Stores its data in $_SESSION
+ *
+ * @package phpMyAdmin
+ */
+class ConfigFile
+{
+ /**
+ * Stores default PMA config from config.default.php
+ * @var array
+ */
+ private $cfg;
+
+ /**
+ * Stores allowed values for non-standard fields
+ * @var array
+ */
+ private $cfgDb;
+
+ /**
+ * Keys which will be always written to config file
+ * @var array
+ */
+ private $persistKeys = array();
+
+ /**
+ * Changes keys while updating config in {@link updateWithGlobalConfig()} or reading
+ * by {@link getConfig()} or {@link getConfigArray()}
+ * @var array
+ */
+ private $cfgUpdateReadMapping = array();
+
+ /**
+ * Key filter for {@link set()}
+ * @var array|null
+ */
+ private $setFilter;
+
+ /**
+ * Instance id (key in $_SESSION array, separate for each server - ConfigFile{server id})
+ * @var string
+ */
+ private $id;
+
+ /**
+ * Result for {@link _flattenArray()}
+ * @var array
+ */
+ private $_flattenArrayResult;
+
+ /**
+ * ConfigFile instance
+ * @var ConfigFile
+ */
+ private static $_instance;
+
+ /**
+ * Private constructor, use {@link getInstance()}
+ *
+ * @uses PMA_array_write()
+ */
+ private function __construct()
+ {
+ // load default config values
+ $cfg = &$this->cfg;
+ require './libraries/config.default.php';
+ $cfg['fontsize'] = '82%';
+
+ // load additional config information
+ $cfg_db = &$this->cfgDb;
+ require './libraries/config.values.php';
+
+ // apply default values overrides
+ if (count($cfg_db['_overrides'])) {
+ foreach ($cfg_db['_overrides'] as $path => $value) {
+ PMA_array_write($path, $cfg, $value);
+ }
+ }
+
+ $this->id = 'ConfigFile' . $GLOBALS['server'];
+ if (!isset($_SESSION[$this->id])) {
+ $_SESSION[$this->id] = array();
+ }
+ }
+
+ /**
+ * Returns class instance
+ *
+ * @return ConfigFile
+ */
+ public static function getInstance()
+ {
+ if (is_null(self::$_instance)) {
+ self::$_instance = new ConfigFile();
+ }
+ return self::$_instance;
+ }
+
+ /**
+ * Sets names of config options which will be placed in config file even if they are set
+ * to their default values (use only full paths)
+ *
+ * @param array $keys
+ */
+ public function setPersistKeys($keys)
+ {
+ // checking key presence is much faster than searching so move values to keys
+ $this->persistKeys = array_flip($keys);
+ }
+
+ /**
+ * Returns flipped array set by {@link setPersistKeys()}
+ *
+ * @return array
+ */
+ public function getPersistKeysMap()
+ {
+ return $this->persistKeys;
+ }
+
+ /**
+ * By default ConfigFile allows setting of all configuration keys, use this method
+ * to set up a filter on {@link set()} method
+ *
+ * @param array|null $keys array of allowed keys or null to remove filter
+ */
+ public function setAllowedKeys($keys)
+ {
+ if ($keys === null) {
+ $this->setFilter = null;
+ return;
+ }
+ // checking key presence is much faster than searching so move values to keys
+ $this->setFilter = array_flip($keys);
+ }
+
+ /**
+ * Sets path mapping for updating config in {@link updateWithGlobalConfig()} or reading
+ * by {@link getConfig()} or {@link getConfigArray()}
+ * @var array
+ */
+ public function setCfgUpdateReadMapping(array $mapping)
+ {
+ $this->cfgUpdateReadMapping = $mapping;
+ }
+
+ /**
+ * Resets configuration data
+ */
+ public function resetConfigData()
+ {
+ $_SESSION[$this->id] = array();
+ }
+
+ /**
+ * Sets configuration data (overrides old data)
+ *
+ * @param array $cfg
+ */
+ public function setConfigData(array $cfg)
+ {
+ $_SESSION[$this->id] = $cfg;
+ }
+
+ /**
+ * Sets config value
+ *
+ * @uses PMA_array_remove()
+ * @uses PMA_array_write()
+ * @param string $path
+ * @param mixed $value
+ * @param string $canonical_path
+ */
+ public function set($path, $value, $canonical_path = null)
+ {
+ if ($canonical_path === null) {
+ $canonical_path = $this->getCanonicalPath($path);
+ }
+ // apply key whitelist
+ if ($this->setFilter !== null && !isset($this->setFilter[$canonical_path])) {
+ return;
+ }
+ // remove if the path isn't protected and it's empty or has a default value
+ $default_value = $this->getDefault($canonical_path);
+ if (!isset($this->persistKeys[$canonical_path])
+ && (($value === $default_value) || (empty($value) && empty($default_value)))) {
+ PMA_array_remove($path, $_SESSION[$this->id]);
+ } else {
+ PMA_array_write($path, $_SESSION[$this->id], $value);
+ }
+ }
+
+ /**
+ * Flattens multidimensional array, changes indices to paths (eg. 'key/subkey').
+ * Used as array_walk() callback.
+ *
+ * @param mixed $value
+ * @param mixed $key
+ * @param mixed $prefix
+ */
+ private function _flattenArray($value, $key, $prefix)
+ {
+ // no recursion for numeric arrays
+ if (is_array($value) && !isset($value[0])) {
+ $prefix .= $key . '/';
+ array_walk($value, array($this, '_flattenArray'), $prefix);
+ } else {
+ $this->_flattenArrayResult[$prefix . $key] = $value;
+ }
+ }
+
+ /**
+ * Returns default config in a flattened array
+ *
+ * @return array
+ */
+ public function getFlatDefaultConfig()
+ {
+ $this->_flattenArrayResult = array();
+ array_walk($this->cfg, array($this, '_flattenArray'), '');
+ $flat_cfg = $this->_flattenArrayResult;
+ $this->_flattenArrayResult = null;
+ return $flat_cfg;
+ }
+
+ /**
+ * Updates config with values read from given array
+ * (config will contain differences to defaults from config.defaults.php).
+ *
+ * @param array $cfg
+ */
+ public function updateWithGlobalConfig(array $cfg)
+ {
+ // load config array and flatten it
+ $this->_flattenArrayResult = array();
+ array_walk($cfg, array($this, '_flattenArray'), '');
+ $flat_cfg = $this->_flattenArrayResult;
+ $this->_flattenArrayResult = null;
+
+ // save values
+ // map for translating a few user preferences paths, should be complemented
+ // by code reading from generated config to perform inverse mapping
+ foreach ($flat_cfg as $path => $value) {
+ if (isset($this->cfgUpdateReadMapping[$path])) {
+ $path = $this->cfgUpdateReadMapping[$path];
+ }
+ $this->set($path, $value, $path);
+ }
+ }
+
+ /**
+ * Returns config value or $default if it's not set
+ *
+ * @uses PMA_array_read()
+ * @param string $path
+ * @param mixed $default
+ * @return mixed
+ */
+ public function get($path, $default = null)
+ {
+ return PMA_array_read($path, $_SESSION[$this->id], $default);
+ }
+
+ /**
+ * Returns default config value or $default it it's not set ie. it doesn't
+ * exist in config.default.php ($cfg) and config.values.php
+ * ($_cfg_db['_overrides'])
+ *
+ * @uses PMA_array_read()
+ * @param string $canonical_path
+ * @param mixed $default
+ * @return mixed
+ */
+ public function getDefault($canonical_path, $default = null)
+ {
+ return PMA_array_read($canonical_path, $this->cfg, $default);
+ }
+
+ /**
+ * Returns config value, if it's not set uses the default one; returns
+ * $default if the path isn't set and doesn't contain a default value
+ *
+ * @uses PMA_array_read()
+ * @param string $path
+ * @param mixed $default
+ * @return mixed
+ */
+ public function getValue($path, $default = null)
+ {
+ $v = PMA_array_read($path, $_SESSION[$this->id], null);
+ if ($v !== null) {
+ return $v;
+ }
+ $path = $this->getCanonicalPath($path);
+ return $this->getDefault($path, $default);
+ }
+
+ /**
+ * Returns canonical path
+ *
+ * @param string $path
+ * @return string
+ */
+ public function getCanonicalPath($path) {
+ return preg_replace('#^Servers/([\d]+)/#', 'Servers/1/', $path);
+ }
+
+ /**
+ * Returns config database entry for $path ($cfg_db in config_info.php)
+ *
+ * @uses PMA_array_read()
+ * @param string $path
+ * @param mixed $default
+ * @return mixed
+ */
+ public function getDbEntry($path, $default = null)
+ {
+ return PMA_array_read($path, $this->cfgDb, $default);
+ }
+
+ /**
+ * Returns server count
+ *
+ * @return int
+ */
+ public function getServerCount()
+ {
+ return isset($_SESSION[$this->id]['Servers'])
+ ? count($_SESSION[$this->id]['Servers'])
+ : 0;
+ }
+
+ /**
+ * Returns server list
+ *
+ * @return array|null
+ */
+ public function getServers()
+ {
+ return isset($_SESSION[$this->id]['Servers'])
+ ? $_SESSION[$this->id]['Servers']
+ : null;
+ }
+
+ /**
+ * Returns DSN of given server
+ *
+ * @param integer $server
+ * @return string
+ */
+ function getServerDSN($server)
+ {
+ if (!isset($_SESSION[$this->id]['Servers'][$server])) {
+ return '';
+ }
+
+ $path = 'Servers/' . $server;
+ $dsn = $this->getValue("$path/extension") . '://';
+ if ($this->getValue("$path/auth_type") == 'config') {
+ $dsn .= $this->getValue("$path/user");
+ if (!$this->getValue("$path/nopassword")) {
+ $dsn .= ':***';
+ }
+ $dsn .= '@';
+ }
+ if ($this->getValue("$path/connect_type") == 'tcp') {
+ $dsn .= $this->getValue("$path/host");
+ $port = $this->getValue("$path/port");
+ if ($port) {
+ $dsn .= ':' . $port;
+ }
+ } else {
+ $dsn .= $this->getValue("$path/socket");
+ }
+ return $dsn;
+ }
+
+ /**
+ * Returns server name
+ *
+ * @param int $id
+ * @return string
+ */
+ public function getServerName($id)
+ {
+ if (!isset($_SESSION[$this->id]['Servers'][$id])) {
+ return '';
+ }
+ $verbose = $this->get("Servers/$id/verbose");
+ if (!empty($verbose)) {
+ return $verbose;
+ }
+ $host = $this->get("Servers/$id/host");
+ return empty($host) ? 'localhost' : $host;
+ }
+
+ /**
+ * Removes server
+ *
+ * @param int $server
+ */
+ public function removeServer($server)
+ {
+ if (!isset($_SESSION[$this->id]['Servers'][$server])) {
+ return;
+ }
+ $last_server = $this->getServerCount();
+
+ for ($i = $server; $i < $last_server; $i++) {
+ $_SESSION[$this->id]['Servers'][$i] = $_SESSION[$this->id]['Servers'][$i+1];
+ }
+ unset($_SESSION[$this->id]['Servers'][$last_server]);
+
+ if (isset($_SESSION[$this->id]['ServerDefault'])
+ && $_SESSION[$this->id]['ServerDefault'] >= 0) {
+ unset($_SESSION[$this->id]['ServerDefault']);
+ }
+ }
+
+ /**
+ * Returns config file path, relative to phpMyAdmin's root path
+ *
+ * @return string
+ */
+ public function getFilePath()
+ {
+ // Load paths
+ if (!defined('SETUP_CONFIG_FILE')) {
+ require_once './libraries/vendor_config.php';
+ }
+
+ return SETUP_CONFIG_FILE;
+ }
+
+ /**
+ * Returns configuration array (full, multidimensional format)
+ *
+ * @return array
+ */
+ public function getConfig()
+ {
+ $c = $_SESSION[$this->id];
+ foreach ($this->cfgUpdateReadMapping as $map_to => $map_from) {
+ PMA_array_write($map_to, $c, PMA_array_read($map_from, $c));
+ PMA_array_remove($map_from, $c);
+ }
+ return $c;
+ }
+
+ /**
+ * Returns configuration array (flat format)
+ *
+ * @return array
+ */
+ public function getConfigArray()
+ {
+ $this->_flattenArrayResult = array();
+ array_walk($_SESSION[$this->id], array($this, '_flattenArray'), '');
+ $c = $this->_flattenArrayResult;
+ $this->_flattenArrayResult = null;
+
+ $persistKeys = array_diff(array_keys($this->persistKeys), array_keys($c));
+ foreach ($persistKeys as $k) {
+ $c[$k] = $this->getDefault($k);
+ }
+
+ foreach ($this->cfgUpdateReadMapping as $map_to => $map_from) {
+ if (!isset($c[$map_from])) {
+ continue;
+ }
+ $c[$map_to] = $c[$map_from];
+ unset($c[$map_from]);
+ }
+ return $c;
+ }
+}
+?>
\ No newline at end of file
diff --git a/setup/lib/Form.class.php b/libraries/config/Form.class.php
similarity index 67%
rename from setup/lib/Form.class.php
rename to libraries/config/Form.class.php
index 1e1fad4..b53d86f 100644
--- a/setup/lib/Form.class.php
+++ b/libraries/config/Form.class.php
@@ -1,17 +1,16 @@
<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Form handling code.
*
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
+ * @package phpMyAdmin
*/
/**
* Base class for forms, loads default configuration options, checks allowed
* values etc.
*
- * @package phpMyAdmin-setup
+ * @package phpMyAdmin
*/
class Form
{
@@ -46,21 +45,16 @@ class Form
private $fieldsTypes;
/**
- * Cached forms
- * @var array
- */
- private static $_forms;
-
- /**
* Constructor, reads default config values
*
* @param string $form_name
+ * @param array $form
* @param int $index arbitrary index, stored in Form::$index
*/
- public function __construct($form_name, $index = null)
+ public function __construct($form_name, array $form, $index = null)
{
$this->index = $index;
- $this->loadForm($form_name);
+ $this->loadForm($form_name, $form);
}
/**
@@ -80,6 +74,8 @@ class Form
/**
* Returns allowed values for select fields
*
+ * @uses ConfigFile::getDbEntry()
+ * @uses ConfigFile::getInstance()
* @param string $option_path
* @return array
*/
@@ -94,12 +90,33 @@ class Form
trigger_error("$option_path - not a static value list", E_USER_ERROR);
return array();
}
+ // convert array('#', 'a', 'b') to array('a', 'b')
+ if (isset($value[0]) && $value[0] === '#') {
+ // remove first element ('#')
+ array_shift($value);
+ } else {
+ // convert value list array('a', 'b') to array('a' => 'a', 'b' => 'b')
+ $has_string_keys = false;
+ $keys = array();
+ for ($i = 0; $i < count($value); $i++) {
+ if (!isset($value[$i])) {
+ $has_string_keys = true;
+ break;
+ }
+ $keys[] = is_bool($value[$i]) ? (int)$value[$i] : $value[$i];
+ }
+ if (!$has_string_keys) {
+ $value = array_combine($keys, $value);
+ }
+ }
+
+ // $value has keys and value names, return it
return $value;
}
/**
* array_walk callback function, reads path of form fields from
- * array (see file comment in forms.inc.php)
+ * array (see file comment in setup.forms.php or user_preferences.forms.inc)
*
* @param mixed $value
* @param mixed $key
@@ -108,41 +125,33 @@ class Form
private function _readFormPathsCallback($value, $key, $prefix)
{
if (is_array($value)) {
- $prefix .= (empty($prefix) ? '' : '/') . $key;
+ $prefix .= $key . '/';
array_walk($value, array($this, '_readFormPathsCallback'), $prefix);
} else {
if (!is_int($key)) {
- $this->default[$prefix . '/' . $key] = $value;
+ $this->default[$prefix . $key] = $value;
$value = $key;
}
- $this->fields[] = $prefix . '/' . $value;
+ $this->fields[] = $prefix . $value;
}
}
/**
* Reads form paths to {@link $fields}
+ *
+ * @param array $form
*/
- protected function readFormPaths()
+ protected function readFormPaths($form)
{
- if (is_null(self::$_forms)) {
- $forms =& self::$_forms;
- require './setup/lib/forms.inc.php';
- }
-
- if (!isset(self::$_forms[$this->name])) {
- return;
- }
-
// flatten form fields' paths and save them to $fields
$this->fields = array();
- array_walk(self::$_forms[$this->name], array($this, '_readFormPathsCallback'), '');
+ array_walk($form, array($this, '_readFormPathsCallback'), '');
// $this->fields is an array of the form: [0..n] => 'field path'
// change numeric indexes to contain field names (last part of the path)
$paths = $this->fields;
$this->fields = array();
foreach ($paths as $path) {
- $path = ltrim($path, '/');
$key = ltrim(substr($path, strrpos($path, '/')), '/');
$this->fields[$key] = $path;
}
@@ -151,11 +160,19 @@ class Form
/**
* Reads fields' types to $this->fieldsTypes
+ *
+ * @uses ConfigFile::getDbEntry()
+ * @uses ConfigFile::getDefault()
+ * @uses ConfigFile::getInstance()
*/
protected function readTypes()
{
$cf = ConfigFile::getInstance();
foreach ($this->fields as $name => $path) {
+ if (strpos($name, ':group:') === 0) {
+ $this->fieldsTypes[$name] = 'group';
+ continue;
+ }
$v = $cf->getDbEntry($path);
if ($v !== null) {
$type = is_array($v) ? 'select' : $v;
@@ -171,12 +188,13 @@ class Form
* config file
*
* @param string $form_name
+ * @param array $form
*/
- public function loadForm($form_name)
+ public function loadForm($form_name, $form)
{
$this->name = $form_name;
- $this->readFormPaths();
+ $this->readFormPaths($form);
$this->readTypes();
}
}
-?>
+?>
\ No newline at end of file
diff --git a/setup/lib/FormDisplay.class.php b/libraries/config/FormDisplay.class.php
similarity index 61%
rename from setup/lib/FormDisplay.class.php
rename to libraries/config/FormDisplay.class.php
index 7b6bfeb..5a08f5e 100644
--- a/setup/lib/FormDisplay.class.php
+++ b/libraries/config/FormDisplay.class.php
@@ -1,4 +1,5 @@
<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Form management class, displays and processes forms
*
@@ -8,16 +9,14 @@
* o translated_path - work_path modified for HTML field name, a path with
* slashes changed to hyphens, eg. Servers-4-verbose
*
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
+ * @package phpMyAdmin
*/
/**
* Core libraries.
*/
-require_once './setup/lib/FormDisplay.tpl.php';
-require_once './setup/lib/validate.lib.php';
+require_once './libraries/config/FormDisplay.tpl.php';
+require_once './libraries/config/validate.lib.php';
require_once './libraries/js_escape.lib.php';
/**
@@ -28,7 +27,7 @@ class FormDisplay
{
/**
* Form list
- * @var array
+ * @var Form[]
*/
private $forms = array();
@@ -58,25 +57,49 @@ class FormDisplay
* Will be looked up in $GLOBALS: str{value} or strSetup{value}
* @var array
*/
- private $js_lang_strings = array('error_nan_p', 'error_nan_nneg',
- 'error_incorrect_port');
+ private $js_lang_strings = array();
/**
* Tells whether forms have been validated
* @var bool
*/
- private $is_valdiated = true;
+ private $is_validated = true;
+
+ /**
+ * Dictionary with user preferences keys
+ * @var array
+ */
+ private $userprefs_keys;
+
+ /**
+ * Dictionary with disallowed user preferences keys
+ * @var array
+ */
+ private $userprefs_disallow;
+
+ public function __construct()
+ {
+ $this->js_lang_strings = array(
+ 'error_nan_p' => __('Not a positive number'),
+ 'error_nan_nneg' => __('Not a non-negative number'),
+ 'error_incorrect_port' => __('Not a valid port number'),
+ 'error_invalid_value' => __('Incorrect value'),
+ 'error_value_lte' => __('Value must be equal or lower than %s'));
+ // initialize validators
+ PMA_config_get_validators();
+ }
/**
* Registers form in form manager
*
* @param string $form_name
+ * @param array $form
* @param int $server_id 0 if new server, validation; >= 1 if editing a server
*/
- public function registerForm($form_name, $server_id = null)
+ public function registerForm($form_name, array $form, $server_id = null)
{
- $this->forms[$form_name] = new Form($form_name, $server_id);
- $this->is_valdiated = false;
+ $this->forms[$form_name] = new Form($form_name, $form, $server_id);
+ $this->is_validated = false;
foreach ($this->forms[$form_name]->fields as $path) {
$work_path = $server_id === null
? $path
@@ -90,12 +113,12 @@ class FormDisplay
* Processes forms, returns true on successful save
*
* @param bool $allow_partial_save allows for partial form saving on failed validation
+ * @param bool $check_form_submit whether check for $_POST['submit_save']
* @return boolean
*/
- public function process($allow_partial_save = true)
+ public function process($allow_partial_save = true, $check_form_submit = true)
{
- // gather list of forms to save
- if (!isset($_POST['submit_save'])) {
+ if ($check_form_submit && !isset($_POST['submit_save'])) {
return false;
}
@@ -108,10 +131,14 @@ class FormDisplay
/**
* Runs validation for all registered forms
+ *
+ * @uses ConfigFile::getInstance()
+ * @uses ConfigFile::getValue()
+ * @uses PMA_config_validate()
*/
private function _validate()
{
- if ($this->is_valdiated) {
+ if ($this->is_validated) {
return;
}
@@ -130,7 +157,7 @@ class FormDisplay
}
// run validation
- $errors = validate($paths, $values, false);
+ $errors = PMA_config_validate($paths, $values, false);
// change error keys from canonical paths to work paths
if (is_array($errors) && count($errors) > 0) {
@@ -145,13 +172,25 @@ class FormDisplay
$this->errors[$work_path] = $error_list;
}
}
- $this->is_valdiated = true;
+ $this->is_validated = true;
}
-
/**
* Outputs HTML for forms
*
+ * @uses ConfigFile::getInstance()
+ * @uses ConfigFile::get()
+ * @uses display_fieldset_bottom()
+ * @uses display_fieldset_top()
+ * @uses display_form_bottom()
+ * @uses display_form_top()
+ * @uses display_js()
+ * @uses display_tabs_bottom()
+ * @uses display_tabs_top()
+ * @uses js_validate()
+ * @uses PMA_config_get_validators()
+ * @uses PMA_jsFormat()
+ * @uses PMA_lang()
* @param bool $tabbed_form
* @param bool $show_restore_default whether show "restore default" button besides the input field
*/
@@ -162,7 +201,7 @@ class FormDisplay
$js = array();
$js_default = array();
$tabbed_form = $tabbed_form && (count($this->forms) > 1);
- $validators = ConfigFile::getInstance()->getDbEntry('_validators');
+ $validators = PMA_config_get_validators();
display_form_top();
@@ -187,10 +226,13 @@ class FormDisplay
$this->_validate();
}
+ // user preferences
+ $this->_loadUserprefsInfo();
+
// display forms
foreach ($this->forms as $form) {
/* @var $form Form */
- $form_desc = isset($GLOBALS["strSetupForm_{$form->name}_desc"])
+ $form_desc = isset($GLOBALS["strConfigForm_{$form->name}_desc"])
? PMA_lang("Form_{$form->name}_desc")
: '';
$form_errors = isset($this->errors[$form->name])
@@ -201,9 +243,14 @@ class FormDisplay
foreach ($form->fields as $field => $path) {
$work_path = array_search($path, $this->system_paths);
$translated_path = $this->translated_paths[$work_path];
+ // always true/false for user preferences display
+ // otherwise null
+ $userprefs_allow = isset($this->userprefs_keys[$path])
+ ? !isset($this->userprefs_disallow[$path])
+ : null;
// display input
$this->_displayFieldInput($form, $field, $path, $work_path,
- $translated_path, $show_restore_default, $js_default);
+ $translated_path, $show_restore_default, $userprefs_allow, $js_default);
// register JS validators for this field
if (isset($validators[$path])) {
js_validate($translated_path, $validators[$path], $js);
@@ -221,35 +268,45 @@ class FormDisplay
if (!$js_lang_sent) {
$js_lang_sent = true;
$js_lang = array();
- foreach ($this->js_lang_strings as $str) {
- $lang = isset($GLOBALS["strSetup$str"])
- ? $GLOBALS["strSetup$str"]
- : filter_input($GLOBALS["str$str"]); // null if not set
- $js_lang[] = "'$str': '" . PMA_jsFormat($lang, false) . '\'';
+ foreach ($this->js_lang_strings as $strName => $strValue) {
+ $js_lang[] = "'$strName': '" . PMA_jsFormat($strValue, false) . '\'';
}
- $js[] = '$.extend(PMA_messages, {' . implode(",\n\t", $js_lang) . '})';
+ $js[] = "$.extend(PMA_messages, {\n\t" . implode(",\n\t", $js_lang) . '})';
}
- $js[] = '$.extend(defaultValues, {' . implode(",\n\t", $js_default) . '})';
+ $js[] = "$.extend(defaultValues, {\n\t" . implode(",\n\t", $js_default) . '})';
display_js($js);
}
/**
* Prepares data for input field display and outputs HTML code
*
+ * @uses ConfigFile::get()
+ * @uses ConfigFile::getDefault()
+ * @uses ConfigFile::getInstance()
+ * @uses display_group_footer()
+ * @uses display_group_header()
+ * @uses display_input()
+ * @uses Form::getOptionType()
+ * @uses Form::getOptionValueList()
+ * @uses PMA_escapeJsString()
+ * @uses PMA_lang_desc()
+ * @uses PMA_lang_name()
* @param Form $form
* @param string $field field name as it appears in $form
* @param string $system_path field path, eg. Servers/1/verbose
* @param string $work_path work path, eg. Servers/4/verbose
* @param string $translated_path work path changed so that it can be used as XHTML id
* @param bool $show_restore_default whether show "restore default" button besides the input field
+ * @param mixed $userprefs_allow whether user preferences are enabled for this field
+ * (null - no support, true/false - enabled/disabled)
* @param array &$js_default array which stores JavaScript code to be displayed
*/
private function _displayFieldInput(Form $form, $field, $system_path, $work_path,
- $translated_path, $show_restore_default, array &$js_default)
+ $translated_path, $show_restore_default, $userprefs_allow, array &$js_default)
{
$name = PMA_lang_name($system_path);
- $description = PMA_lang_desc($system_path);
+ $description = PMA_lang_name($system_path, 'desc', '');
$cf = ConfigFile::getInstance();
$value = $cf->get($work_path);
@@ -263,7 +320,9 @@ class FormDisplay
$opts = array(
'doc' => $this->getDocLink($system_path),
'wiki' => $this->getWikiLink($system_path),
- 'show_restore_default' => $show_restore_default);
+ 'show_restore_default' => $show_restore_default,
+ 'userprefs_allow' => $userprefs_allow,
+ 'userprefs_comment' => PMA_lang_name($system_path, 'cmt', ''));
if (isset($form->default[$system_path])) {
$opts['setvalue'] = $form->default[$system_path];
}
@@ -275,28 +334,33 @@ class FormDisplay
case 'string':
$type = 'text';
break;
- case 'double':
- $type = 'text';
+ case 'short_string':
+ $type = 'short_text';
break;
+ case 'double':
case 'integer':
- $type = 'text';
+ $type = 'number_text';
break;
case 'boolean':
$type = 'checkbox';
break;
case 'select':
$type = 'select';
- $opts['values'] = array();
- $values = $form->getOptionValueList($form->fields[$field]);
- foreach ($values as $v) {
- $opts['values'][$v] = $v;
- }
+ $opts['values'] = $form->getOptionValueList($form->fields[$field]);
break;
case 'array':
$type = 'list';
$value = (array) $value;
$value_default = (array) $value_default;
break;
+ case 'group':
+ $text = substr($field, 7);
+ if ($text != 'end') {
+ display_group_header($text);
+ } else {
+ display_group_footer();
+ }
+ return;
case 'NULL':
trigger_error("Field $system_path has no type", E_USER_WARNING);
return;
@@ -310,11 +374,14 @@ class FormDisplay
}
}
}
+ $this->_setComments($system_path, $opts);
// send default value to form's JS
$js_line = '\'' . $translated_path . '\': ';
switch ($type) {
case 'text':
+ case 'short_text':
+ case 'number_text':
$js_line .= '\'' . PMA_escapeJsString($value_default) . '\'';
break;
case 'checkbox':
@@ -338,6 +405,9 @@ class FormDisplay
/**
* Displays errors
+ *
+ * @uses display_errors()
+ * @uses PMA_lang_name()
*/
public function displayErrors()
{
@@ -351,7 +421,7 @@ class FormDisplay
$path = $this->system_paths[$system_path];
$name = PMA_lang_name($path);
} else {
- $name = $GLOBALS["strSetupForm_$system_path"];
+ $name = $GLOBALS["strConfigForm_$system_path"];
}
display_errors($name, $error_list);
}
@@ -359,6 +429,11 @@ class FormDisplay
/**
* Reverts erroneous fields to their default values
+ *
+ * @uses ConfigFile::getDefault()
+ * @uses ConfigFile::getInstance()
+ * @uses ConfigFile::set()
+ *
*/
public function fixErrors()
{
@@ -386,11 +461,17 @@ class FormDisplay
*/
private function _validateSelect(&$value, array $allowed)
{
- foreach ($allowed as $v) {
- if ($value == $v) {
- settype($value, gettype($v));
- return true;
- }
+ $value_cmp = is_bool($value)
+ ? (int) $value
+ : $value;
+ foreach ($allowed as $vk => $v) {
+ // equality comparison only if both values are numeric or not numeric
+ // (allows to skip 0 == 'string' equalling to true) or identity (for string-string)
+ if (($vk == $value && !(is_numeric($value_cmp) xor is_numeric($vk)))
+ || $vk === $value) {
+ settype($value, gettype($v));
+ return true;
+ }
}
return false;
}
@@ -398,6 +479,13 @@ class FormDisplay
/**
* Validates and saves form data to session
*
+ * @uses ConfigFile::get()
+ * @uses ConfigFile::getInstance()
+ * @uses ConfigFile::getServerCount()
+ * @uses ConfigFile::set()
+ * @uses Form::getOptionType()
+ * @uses Form::getOptionValueList()
+ * @uses PMA_lang_name()
* @param array|string $forms array of form names
* @param bool $allow_partial_save allows for partial form saving on failed validation
* @return boolean true on success (no errors and all saved)
@@ -410,6 +498,11 @@ class FormDisplay
$values = array();
$to_save = array();
+ $is_setup_script = defined('PMA_SETUP') && PMA_SETUP;
+ if ($is_setup_script) {
+ $this->_loadUserprefsInfo();
+ }
+
$this->errors = array();
foreach ($forms as $form) {
/* @var $form Form */
@@ -426,23 +519,38 @@ class FormDisplay
foreach ($form->fields as $field => $system_path) {
$work_path = array_search($system_path, $this->system_paths);
$key = $this->translated_paths[$work_path];
+ $type = $form->getOptionType($field);
+
+ // skip groups
+ if ($type == 'group') {
+ continue;
+ }
// ensure the value is set
if (!isset($_POST[$key])) {
// checkboxes aren't set by browsers if they're off
- if ($form->getOptionType($field) == 'boolean') {
+ if ($type == 'boolean') {
$_POST[$key] = false;
} else {
- $this->errors[$form->name][] = PMA_lang(
- 'error_missing_field_data',
+ $this->errors[$form->name][] = sprintf(
+ __('Missing data for %s'),
'<i>' . PMA_lang_name($system_path) . '</i>');
$result = false;
continue;
}
}
+ // user preferences allow/disallow
+ if ($is_setup_script && isset($this->userprefs_keys[$system_path])) {
+ if (isset($this->userprefs_disallow[$system_path])
+ && isset($_POST[$key . '-userprefs-allow'])) {
+ unset($this->userprefs_disallow[$system_path]);
+ } else if (!isset($_POST[$key . '-userprefs-allow'])) {
+ $this->userprefs_disallow[$system_path] = true;
+ }
+ }
+
// cast variables to correct type
- $type = $form->getOptionType($field);
switch ($type) {
case 'double':
settype($_POST[$key], 'float');
@@ -461,11 +569,14 @@ class FormDisplay
}
break;
case 'string':
+ case 'short_string':
$_POST[$key] = trim($_POST[$key]);
break;
case 'array':
// eliminate empty values and ensure we have an array
- $post_values = explode("\n", $_POST[$key]);
+ $post_values = is_array($_POST[$key])
+ ? $_POST[$key]
+ : explode("\n", $_POST[$key]);
$_POST[$key] = array();
foreach ($post_values as $v) {
$v = trim($v);
@@ -509,6 +620,9 @@ class FormDisplay
}
$cf->set($work_path, $values[$path], $path);
}
+ if ($is_setup_script) {
+ $cf->set('UserprefsDisallow', array_keys($this->userprefs_disallow));
+ }
}
// don't look for non-critical errors
@@ -540,7 +654,7 @@ class FormDisplay
if ($test == 'Import' || $test == 'Export') {
return '';
}
- return '../Documentation.html#cfg_' . self::_getOptName($path);
+ return 'Documentation.html#cfg_' . $this->_getOptName($path);
}
/**
@@ -551,7 +665,7 @@ class FormDisplay
*/
public function getWikiLink($path)
{
- $opt_name = self::_getOptName($path);
+ $opt_name = $this->_getOptName($path);
if (substr($opt_name, 0, 7) == 'Servers') {
$opt_name = substr($opt_name, 8);
if (strpos($opt_name, 'AllowDeny') === 0) {
@@ -577,9 +691,88 @@ class FormDisplay
* @param string $path
* @return string
*/
- private static function _getOptName($path)
+ private function _getOptName($path)
+ {
+ return str_replace(array('Servers/1/', '/'), array('Servers/', '_'), $path);
+ }
+
+ /**
+ * Fills out {@link userprefs_keys} and {@link userprefs_disallow}
+ *
+ * @uses PMA_read_userprefs_fieldnames()
+ */
+ private function _loadUserprefsInfo()
+ {
+ if ($this->userprefs_keys === null) {
+ $this->userprefs_keys = array_flip(PMA_read_userprefs_fieldnames());
+ // read real config for user preferences display
+ $userprefs_disallow = defined('PMA_SETUP') && PMA_SETUP
+ ? ConfigFile::getInstance()->get('UserprefsDisallow', array())
+ : $GLOBALS['cfg']['UserprefsDisallow'];
+ $this->userprefs_disallow = array_flip($userprefs_disallow);
+ }
+ }
+
+ /**
+ * Sets field comments and warnings based on current environment
+ *
+ * @param string $system_path
+ * @param array $opts
+ */
+ private function _setComments($system_path, array &$opts)
{
- return str_replace(array('Servers/1/', '/'), array('Servers/', '_'), $path);
+ // RecodingEngine - mark unavailable types
+ if ($system_path == 'RecodingEngine') {
+ $comment = '';
+ if (!function_exists('iconv')) {
+ $opts['values']['iconv'] .= ' (' . __('unavailable') . ')';
+ $comment = sprintf(__('"%s" requires %s extension'), 'iconv', 'iconv');
+ }
+ if (!function_exists('recode_string')) {
+ $opts['values']['recode'] .= ' (' . __('unavailable') . ')';
+ $comment .= ($comment ? ", " : '') . sprintf(__('"%s" requires %s extension'),
+ 'recode', 'recode');
+ }
+ $opts['comment'] = $comment;
+ $opts['comment_warning'] = true;
+ }
+ // ZipDump, GZipDump, BZipDump - check function availability
+ if ($system_path == 'ZipDump' || $system_path == 'GZipDump' || $system_path == 'BZipDump') {
+ $comment = '';
+ $funcs = array(
+ 'ZipDump' => array('zip_open', 'gzcompress'),
+ 'GZipDump' => array('gzopen', 'gzencode'),
+ 'BZipDump' => array('bzopen', 'bzcompress'));
+ if (!function_exists($funcs[$system_path][0])) {
+ $comment = sprintf(__('import will not work, missing function (%s)'),
+ $funcs[$system_path][0]);
+ }
+ if (!function_exists($funcs[$system_path][1])) {
+ $comment .= ($comment ? '; ' : '') . sprintf(__('export will not work, missing function (%s)'),
+ $funcs[$system_path][1]);
+ }
+ $opts['comment'] = $comment;
+ $opts['comment_warning'] = true;
+ }
+ if ($system_path == 'SQLQuery/Validate' && !$GLOBALS['cfg']['SQLValidator']['use']) {
+ $opts['comment'] = __('SQL Validator is disabled');
+ $opts['comment_warning'] = true;
+ }
+ if ($system_path == 'SQLValidator/use') {
+ if (!class_exists('SOAPClient')) {
+ @include_once 'SOAP/Client.php';
+ if (!class_exists('SOAP_Client')) {
+ $opts['comment'] = __('SOAP extension not found');
+ $opts['comment_warning'] = true;
+ }
+ }
+ }
+ if (!defined('PMA_SETUP') || !PMA_SETUP) {
+ if (($system_path == 'MaxDbList' || $system_path == 'MaxTableList'
+ || $system_path == 'QueryHistoryMax')) {
+ $opts['comment'] = sprintf(__('maximum %s'), $GLOBALS['cfg'][$system_path]);
+ }
+ }
}
}
-?>
+?>
\ No newline at end of file
diff --git a/libraries/config/FormDisplay.tpl.php b/libraries/config/FormDisplay.tpl.php
new file mode 100644
index 0000000..40c59d1
--- /dev/null
+++ b/libraries/config/FormDisplay.tpl.php
@@ -0,0 +1,429 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Form templates
+ *
+ * @package phpMyAdmin
+ */
+
+/**
+ * Displays top part of the form
+ *
+ * @uses PMA_generate_common_hidden_inputs()
+ * @uses PMA_getHiddenFields()
+ * @param string $action default: $_SERVER['REQUEST_URI']
+ * @param string $method 'post' or 'get'
+ * @param array $hidden_fields array of form hidden fields (key: field name)
+ */
+function display_form_top($action = null, $method = 'post', $hidden_fields = null)
+{
+ static $has_check_page_refresh = false;
+
+ if ($action === null) {
+ $action = $_SERVER['REQUEST_URI'];
+ }
+ if ($method != 'post') {
+ $method = 'get';
+ }
+?>
+<form method="<?php echo $method ?>" action="<?php echo htmlspecialchars($action) ?>" class="config-form">
+<input type="hidden" name="tab_hash" value="" />
+<?php
+ // we do validation on page refresh when browser remembers field values,
+ // add a field with known value which will be used for checks
+ if (!$has_check_page_refresh) {
+ $has_check_page_refresh = true;
+ echo '<input type="hidden" name="check_page_refresh" id="check_page_refresh"'
+ . ' value="" />' . "\n";
+ }
+ echo PMA_generate_common_hidden_inputs('', '', 0, 'server') . "\n";
+ echo PMA_getHiddenFields((array)$hidden_fields);
+}
+
+/**
+ * Displays form tabs which are given by an array indexed by fieldset id
+ * ({@link display_fieldset_top}), with values being tab titles.
+ *
+ * @param array $tabs
+ */
+function display_tabs_top($tabs)
+{
+?>
+<ul class="tabs">
+<?php foreach ($tabs as $tab_id => $tab_name): ?>
+ <li><a href="#<?php echo $tab_id ?>"><?php echo $tab_name ?></a></li>
+<?php endforeach; ?>
+</ul>
+<br clear="right" />
+<div class="tabs_contents">
+<?php
+}
+
+
+/**
+ * Displays top part of a fieldset
+ *
+ * @param string $title
+ * @param string $description
+ * @param array $errors
+ * @param array $attributes
+ */
+function display_fieldset_top($title = '', $description = '', $errors = null, $attributes = array())
+{
+ global $_FormDisplayGroup;
+
+ $_FormDisplayGroup = false;
+
+ $attributes = array_merge(array('class' => 'optbox'), $attributes);
+ foreach ($attributes as $k => &$attr) {
+ $attr = $k . '="' . htmlspecialchars($attr) . '"';
+ }
+
+ echo '<fieldset ' . implode(' ', $attributes) . '>';
+ echo '<legend>' . $title . '</legend>';
+ if (!empty($description)) {
+ echo '<p>' . $description . '</p>';
+ }
+ // this must match with displayErrors() in scripts.js
+ if (is_array($errors) && count($errors) > 0) {
+ echo '<dl class="errors">';
+ foreach ($errors as $error) {
+ echo '<dd>' . $error . '</dd>';
+ }
+ echo '</dl>';
+ }
+?>
+<table width="100%" cellspacing="0">
+<?php
+}
+
+/**
+ * Displays input field
+ *
+ * $opts keys:
+ * o doc - (string) documentation link
+ * o errors - error array
+ * o setvalue - (string) shows button allowing to set poredefined value
+ * o show_restore_default - (boolean) whether show "restore default" button
+ * o userprefs_allow - whether user preferences are enabled for this field (null - no support,
+ * true/false - enabled/disabled)
+ * o userprefs_comment - (string) field comment
+ * o values - key - value paris for <select> fields
+ * o values_escaped - (boolean) tells whether values array is already escaped (defaults to false)
+ * o values_disabled - (array)list of disabled values (keys from values)
+ * o comment - (string) tooltip comment
+ * o comment_warning - (bool) whether this comments warns about something
+ * o wiki - (string) wiki link
+ *
+ * @uses $GLOBALS['_FormDisplayGroup']
+ * @uses $GLOBALS['cfg']['ThemePath']
+ * @uses $_SESSION['PMA_Theme']
+ * @uses display_group_footer()
+ * @param string $path
+ * @param string $name
+ * @param string $description
+ * @param string $type
+ * @param mixed $value
+ * @param bool $value_is_default
+ * @param array $opts
+ */
+function display_input($path, $name, $description = '', $type, $value, $value_is_default = true, $opts = null)
+{
+ global $_FormDisplayGroup;
+ static $base_dir, $img_path;
+
+ $is_setup_script = defined('PMA_SETUP') && PMA_SETUP;
+ if ($base_dir === null) {
+ $base_dir = $is_setup_script ? '../' : '';
+ $img_path = $is_setup_script
+ ? '../' . ltrim($GLOBALS['cfg']['ThemePath'], './') . '/original/img/'
+ : $_SESSION['PMA_Theme']->img_path;
+ }
+ $has_errors = isset($opts['errors']) && !empty($opts['errors']);
+ $option_is_disabled = !$is_setup_script && isset($opts['userprefs_allow']) && !$opts['userprefs_allow'];
+ $name_id = 'name="' . htmlspecialchars($path) . '" id="' . htmlspecialchars($path) . '"';
+ $field_class = $type == 'checkbox' ? 'checkbox' : '';
+ if (!$value_is_default) {
+ $field_class .= ($field_class == '' ? '' : ' ') . ($has_errors ? 'custom field-error' : 'custom');
+ }
+ $field_class = $field_class ? ' class="' . $field_class . '"' : '';
+ $tr_class = $_FormDisplayGroup ? 'group-field' : '';
+ if (isset($opts['setvalue']) && $opts['setvalue'] == ':group') {
+ unset($opts['setvalue']);
+ $tr_class = 'group-header-field';
+ if ($_FormDisplayGroup) {
+ display_group_footer();
+ }
+ $_FormDisplayGroup = true;
+ }
+ if ($option_is_disabled) {
+ $tr_class .= ($tr_class ? ' ' : '') . 'disabled-field';
+ }
+ $tr_class = $tr_class ? ' class="' . $tr_class . '"' : '';
+?>
+<tr<?php echo $tr_class ?>>
+ <th>
+ <label for="<?php echo htmlspecialchars($path) ?>"><?php echo $name ?></label>
+ <?php if (!empty($opts['doc']) || !empty($opts['wiki'])) { ?>
+ <span class="doc">
+ <?php if (!empty($opts['doc'])) { ?><a href="<?php echo $base_dir . $opts['doc'] ?>" target="documentation"><img class="icon" src="<?php echo $img_path ?>b_help.png" width="11" height="11" alt="Doc" title="<?php echo __('Documentation') ?>" /></a><?php } ?>
+ <?php if (!empty($opts['wiki'])){ ?><a href="<?php echo $opts['wiki'] ?>" target="wiki"><img class="icon" src="<?php echo $img_path ?>b_info.png" width="11" height="11" alt="Wiki" title="Wiki" /></a><?php } ?>
+ </span>
+ <?php } ?>
+ <?php if ($option_is_disabled) { ?>
+ <span class="disabled-notice" title="<?php echo __('This setting is disabled, it will not be applied to your configuration') ?>"><?php echo __('Disabled') ?></span>
+ <?php } ?>
+ <?php if (!empty($description)) { ?><small><?php echo $description ?></small><?php } ?>
+ </th>
+ <td>
+ <?php
+ switch ($type) {
+ case 'text':
+ echo '<input type="text" size="60" ' . $name_id . $field_class
+ . ' value="' . htmlspecialchars($value) . '" />';
+ break;
+ case 'short_text':
+ echo '<input type="text" size="25" ' . $name_id . $field_class
+ . ' value="' . htmlspecialchars($value) . '" />';
+ break;
+ case 'number_text':
+ echo '<input type="text" size="15" ' . $name_id . $field_class
+ . ' value="' . htmlspecialchars($value) . '" />';
+ break;
+ case 'checkbox':
+ echo '<span' . $field_class . '><input type="checkbox" ' . $name_id
+ . ($value ? ' checked="checked"' : '') . ' /></span>';
+ break;
+ case 'select':
+ echo '<select ' . $name_id . $field_class . '>';
+ $escape = !(isset($opts['values_escaped']) && $opts['values_escaped']);
+ $values_disabled = isset($opts['values_disabled'])
+ ? array_flip($opts['values_disabled']) : array();
+ foreach ($opts['values'] as $opt_value_key => $opt_value) {
+ // set names for boolean values
+ if (is_bool($opt_value)) {
+ $opt_value = strtolower($opt_value ? __('Yes') : __('No'));
+ }
+ // escape if necessary
+ if ($escape) {
+ $display = htmlspecialchars($opt_value);
+ $display_value = htmlspecialchars($opt_value_key);
+ } else {
+ $display = $opt_value;
+ $display_value = $opt_value_key;
+ }
+ // compare with selected value
+ // boolean values are cast to integers when used as array keys
+ $selected = is_bool($value)
+ ? (int) $value === $opt_value_key
+ : $opt_value_key === $value;
+ echo '<option value="' . $display_value . '"'
+ . ($selected ? ' selected="selected"' : '')
+ . (isset($values_disabled[$opt_value_key]) ? ' disabled="disabled"' : '')
+ . '>' . $display . '</option>';
+ }
+ echo '</select>';
+ break;
+ case 'list':
+ echo '<textarea cols="40" rows="5" ' . $name_id . $field_class . '>'
+ . htmlspecialchars(implode("\n", $value))
+ . '</textarea>';
+ break;
+ }
+ if (isset($opts['comment']) && $opts['comment']) {
+ $class = 'field-comment-mark';
+ if (isset($opts['comment_warning']) && $opts['comment_warning']) {
+ $class .= ' field-comment-warning';
+ }
+ ?>
+ <span class="<?php echo $class ?>" title="<?php echo htmlspecialchars($opts['comment']) ?>">i</span>
+ <?php
+ }
+ if ($is_setup_script && isset($opts['userprefs_comment']) && $opts['userprefs_comment']) {
+ ?>
+ <a class="userprefs-comment" title="<?php echo htmlspecialchars($opts['userprefs_comment']) ?>"><img alt="comment" src="<?php echo $img_path ?>b_tblops.png" width="16" height="16" /></a>
+ <?php
+ }
+ if (isset($opts['setvalue']) && $opts['setvalue']) {
+ ?>
+ <a class="set-value" href="#<?php echo htmlspecialchars("$path={$opts['setvalue']}") ?>" title="<?php echo sprintf(__('Set value: %s'), htmlspecialchars($opts['setvalue'])) ?>" style="display:none"><img alt="set-value" src="<?php echo $img_path ?>b_edit.png" width="16" height="16" /></a>
+ <?php
+ }
+ if (isset($opts['show_restore_default']) && $opts['show_restore_default']) {
+ ?>
+ <a class="restore-default" href="#<?php echo $path ?>" title="<?php echo __('Restore default value') ?>" style="display:none"><img alt="restore-default" src="<?php echo $img_path ?>s_reload.png" width="16" height="16" /></a>
+ <?php
+ }
+ // this must match with displayErrors() in scripts/config.js
+ if ($has_errors) {
+ echo "\n <dl class=\"inline_errors\">";
+ foreach ($opts['errors'] as $error) {
+ echo '<dd>' . htmlspecialchars($error) . '</dd>';
+ }
+ echo '</dl>';
+ }
+ ?>
+ </td>
+ <?php
+ if ($is_setup_script && isset($opts['userprefs_allow'])) {
+ ?>
+ <td class="userprefs-allow" title="<?php echo __('Allow users to customize this value') ?>">
+ <input type="checkbox" name="<?php echo $path ?>-userprefs-allow" <?php if ($opts['userprefs_allow']) echo 'checked="checked"' ?> />
+ </td>
+ <?php
+ } else if ($is_setup_script) {
+ echo '<td> </td>';
+ }
+ ?>
+</tr>
+<?php
+}
+
+/**
+ * Display group header
+ *
+ * @uses $GLOBALS['_FormDisplayGroup']
+ * @uses display_group_footer()
+ * @param string $header_text
+ */
+function display_group_header($header_text)
+{
+ global $_FormDisplayGroup;
+
+ if ($_FormDisplayGroup) {
+ display_group_footer();
+ }
+ $_FormDisplayGroup = true;
+ if (!$header_text) {
+ return;
+ }
+ $colspan = 2;
+ if (defined('PMA_SETUP') && PMA_SETUP) {
+ $colspan++;
+ }
+?>
+<tr class="group-header">
+ <th colspan="<?php echo $colspan ?>">
+ <?php echo $header_text ?>
+ </th>
+</tr>
+<?php
+}
+
+/**
+ * Display group footer
+ *
+ * @uses $GLOBALS['_FormDisplayGroup']
+ */
+function display_group_footer()
+{
+ global $_FormDisplayGroup;
+
+ $_FormDisplayGroup = false;
+}
+
+/**
+ * Displays bottom part of a fieldset
+ */
+function display_fieldset_bottom()
+{
+ $colspan = 2;
+ if (defined('PMA_SETUP') && PMA_SETUP) {
+ $colspan++;
+ }
+?>
+<tr>
+ <td colspan="<?php echo $colspan ?>" class="lastrow">
+ <input type="submit" name="submit_save" value="<?php echo __('Save') ?>" class="green" />
+ <input type="button" name="submit_reset" value="<?php echo __('Reset') ?>" />
+ </td>
+</tr>
+</table>
+</fieldset>
+
+<?php
+}
+
+/**
+ * Displays simple bottom part of a fieldset (without submit buttons)
+ */
+function display_fieldset_bottom_simple()
+{
+?>
+</table>
+</fieldset>
+
+<?php
+}
+
+/**
+ * Closes form tabs
+ */
+function display_tabs_bottom()
+{
+ echo "</div>\n";
+}
+
+/**
+ * Displays bottom part of the form
+ */
+function display_form_bottom()
+{
+ echo "</form>\n";
+}
+
+/**
+ * Appends JS validation code to $js_array
+ *
+ * @uses PMA_escapeJsString()
+ * @param string $field_id
+ * @param string|array $validator
+ * @param array $js_array
+ */
+function js_validate($field_id, $validators, &$js_array)
+{
+ foreach ((array)$validators as $validator) {
+ $validator = (array)$validator;
+ $v_name = array_shift($validator);
+ $v_args = array();
+ foreach ($validator as $arg) {
+ $v_args[] = PMA_escapeJsString($arg);
+ }
+ $v_args = $v_args ? ", ['" . implode("', '", $v_args) . "']" : '';
+ $js_array[] = "validateField('$field_id', '$v_name', true$v_args)";
+ }
+}
+
+/**
+ * Displays JavaScript code
+ *
+ * @param array $js_array
+ */
+function display_js($js_array)
+{
+ if (empty($js_array)) {
+ return;
+ }
+?>
+<script type="text/javascript">
+<?php echo implode(";\n", $js_array) . ";\n" ?>
+</script>
+<?php
+}
+
+/**
+ * Displays error list
+ *
+ * @param string $name
+ * @param array $error_list
+ */
+function display_errors($name, $error_list)
+{
+ echo '<dl>';
+ echo '<dt>' . htmlspecialchars($name) . '</dt>';
+ foreach ($error_list as $error) {
+ echo '<dd>' . htmlspecialchars($error) . '</dd>';
+ }
+ echo '</dl>';
+}
+?>
\ No newline at end of file
diff --git a/libraries/config/config_functions.lib.php b/libraries/config/config_functions.lib.php
new file mode 100644
index 0000000..6f9aabb
--- /dev/null
+++ b/libraries/config/config_functions.lib.php
@@ -0,0 +1,100 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Common config manipulation functions
+ *
+ * @package phpMyAdmin
+ */
+
+/**
+ * Returns sanitized language string, taking into account our special codes
+ * for formatting. Takes variable number of arguments.
+ * Based on PMA_sanitize from sanitize.lib.php.
+ *
+ * @param string $lang_key key in $GLOBALS WITHOUT 'strSetup' prefix
+ * @param mixed $args arguments for sprintf
+ * @return string
+ */
+function PMA_lang($lang_key)
+{
+ static $search, $replace;
+
+ // some quick cache'ing
+ if ($search === null) {
+ $replace_pairs = array(
+ '<' => '<',
+ '>' => '>',
+ '[em]' => '<em>',
+ '[/em]' => '</em>',
+ '[strong]' => '<strong>',
+ '[/strong]' => '</strong>',
+ '[code]' => '<code>',
+ '[/code]' => '</code>',
+ '[kbd]' => '<kbd>',
+ '[/kbd]' => '</kbd>',
+ '[br]' => '<br />',
+ '[sup]' => '<sup>',
+ '[/sup]' => '</sup>');
+ if (defined('PMA_SETUP')) {
+ $replace_pairs['[a(a)Documentation.html'] = '[a@../Documentation.html';
+ }
+ $search = array_keys($replace_pairs);
+ $replace = array_values($replace_pairs);
+ }
+ $message = isset($GLOBALS["strConfig$lang_key"]) ? $GLOBALS["strConfig$lang_key"] : $lang_key;
+ $message = str_replace($search, $replace, $message);
+ // replace [a@"$1"]$2[/a] with <a href="$1">$2</a>
+ $message = preg_replace('#\[a@("?)([^\]]+)\1\]([^\[]+)\[/a\]#e',
+ "PMA_lang_link_replace('$2', '$3')", $message);
+
+ if (func_num_args() == 1) {
+ return $message;
+ } else {
+ $args = func_get_args();
+ array_shift($args);
+ return vsprintf($message, $args);
+ }
+}
+
+/**
+ * Returns translated field name/description or comment
+ *
+ * @param string $canonical_path
+ * @param string $type 'name', 'desc' or 'cmt'
+ * @param mixed $default
+ * @return string
+ */
+function PMA_lang_name($canonical_path, $type = 'name', $default = 'key')
+{
+ $lang_key = str_replace(
+ array('Servers/1/', '/'),
+ array('Servers/', '_'),
+ $canonical_path) . '_' . $type;
+ return isset($GLOBALS["strConfig$lang_key"])
+ ? ($type == 'desc' ? PMA_lang($lang_key) : $GLOBALS["strConfig$lang_key"])
+ : ($default == 'key' ? $lang_key : $default);
+}
+
+/**
+ * Wraps link in <a> tags and replaces argument separator in internal links
+ * to the one returned by PMA_get_arg_separator()
+ *
+ * @param string $link
+ * @param string $text
+ * @return string
+ */
+function PMA_lang_link_replace($link, $text)
+{
+ static $separator;
+
+ if (!isset($separator)) {
+ $separator = PMA_get_arg_separator('html');
+ }
+
+ if (!preg_match('#^http://#', $link)) {
+ $link = str_replace('&', $separator, $link);
+ }
+
+ return '<a href="' . $link . '">' . $text . '</a>';
+}
+?>
\ No newline at end of file
diff --git a/libraries/config/messages.inc.php b/libraries/config/messages.inc.php
new file mode 100644
index 0000000..7dc5c14
--- /dev/null
+++ b/libraries/config/messages.inc.php
@@ -0,0 +1,498 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Messages for phpMyAdmin.
+ *
+ * This file is here for easy transition to Gettext. You should not add any
+ * new messages here, use instead gettext directly in your template/PHP
+ * file.
+ *
+ * @package phpMyAdmin
+ */
+
+if (!function_exists('__')) {
+ die('Bad invocation!');
+}
+
+$strConfigAllowArbitraryServer_desc = __('If enabled user can enter any MySQL server in login form for cookie auth');
+$strConfigAllowArbitraryServer_name = __('Allow login to any MySQL server');
+$strConfigAllowThirdPartyFraming_desc = __('Enabling this allows a page located on a different domain to call phpMyAdmin inside a frame, and is a potential [strong]security hole[/strong] allowing cross-frame scripting attacks');
+$strConfigAllowThirdPartyFraming_name = __('Allow third party framing');
+$strConfigAllowUserDropDatabase_name = __('Show "Drop database" link to normal users');
+$strConfigblowfish_secret_desc = __('Secret passphrase used for encrypting cookies in [kbd]cookie[/kbd] authentication');
+$strConfigblowfish_secret_name = __('Blowfish secret');
+$strConfigBrowseMarkerEnable_desc = __('Highlight selected rows');
+$strConfigBrowseMarkerEnable_name = __('Row marker');
+$strConfigBrowsePointerEnable_desc = __('Highlight row pointed by the mouse cursor');
+$strConfigBrowsePointerEnable_name = __('Highlight pointer');
+$strConfigBZipDump_desc = __('Enable [a@http://en.wikipedia.org/wiki/Bzip2]bzip2[/a] compression for import and export operations');
+$strConfigBZipDump_name = __('Bzip2');
+$strConfigCharEditing_desc = __('Defines which type of editing controls should be used for CHAR and VARCHAR columns; [kbd]input[/kbd] - allows limiting of input length, [kbd]textarea[/kbd] - allows newlines in columns');
+$strConfigCharEditing_name = __('CHAR columns editing');
+$strConfigCharTextareaCols_desc = __('Number of columns for CHAR/VARCHAR textareas');
+$strConfigCharTextareaCols_name = __('CHAR textarea columns');
+$strConfigCharTextareaRows_desc = __('Number of rows for CHAR/VARCHAR textareas');
+$strConfigCharTextareaRows_name = __('CHAR textarea rows');
+$strConfigCheckConfigurationPermissions_name = __('Check config file permissions');
+$strConfigCompressOnFly_desc = __('Compress gzip/bzip2 exports on the fly without the need for much memory; if you encounter problems with created gzip/bzip2 files disable this feature');
+$strConfigCompressOnFly_name = __('Compress on the fly');
+$strConfigConfigurationFile = __('Configuration file');
+$strConfigConfirm_desc = __('Whether a warning ("Are your really sure...") should be displayed when you\'re about to lose data');
+$strConfigConfirm_name = __('Confirm DROP queries');
+$strConfigCtrlArrowsMoving_name = __('Field navigation using Ctrl+Arrows');
+$strConfigDBG_php_name = __('Debug PHP');
+$strConfigDBG_sql_name = __('Debug SQL');
+$strConfigDefaultDisplay_name = __('Default display direction');
+$strConfigDefaultPropDisplay_desc = __('[kbd]horizontal[/kbd], [kbd]vertical[/kbd] or a number that indicates maximum number for which vertical model is used');
+$strConfigDefaultPropDisplay_name = __('Display direction for altering/creating columns');
+$strConfigDefaultTabDatabase_desc = __('Tab that is displayed when entering a database');
+$strConfigDefaultTabDatabase_name = __('Default database tab');
+$strConfigDefaultTabServer_desc = __('Tab that is displayed when entering a server');
+$strConfigDefaultTabServer_name = __('Default server tab');
+$strConfigDefaultTabTable_desc = __('Tab that is displayed when entering a table');
+$strConfigDefaultTabTable_name = __('Default table tab');
+$strConfigDisplayBinaryAsHex_desc = __('Show binary contents as HEX by default');
+$strConfigDisplayBinaryAsHex_name = __('Show binary contents as HEX');
+$strConfigDisplayDatabasesList_desc = __('Show database listing as a list instead of a drop down');
+$strConfigDisplayDatabasesList_name = __('Display databases as a list');
+$strConfigDisplayServersList_desc = __('Show server listing as a list instead of a drop down');
+$strConfigDisplayServersList_name = __('Display servers as a list');
+$strConfigEditInWindow_desc = __('Edit SQL queries in popup window');
+$strConfigEditInWindow_name = __('Edit in window');
+$strConfigError_Handler_display_name = __('Display errors');
+$strConfigError_Handler_gather_name = __('Gather errors');
+$strConfigErrorIconic_desc = __('Show icons for warning, error and information messages');
+$strConfigErrorIconic_name = __('Iconic errors');
+$strConfigExecTimeLimit_desc = __('Set the number of seconds a script is allowed to run ([kbd]0[/kbd] for no limit)');
+$strConfigExecTimeLimit_name = __('Maximum execution time');
+$strConfigExport_asfile_name = __('Save as file');
+$strConfigExport_charset_name = __('Character set of the file');
+$strConfigExport_codegen_format_name = __('Format');
+$strConfigExport_compression_name = __('Compression');
+$strConfigExport_csv_columns_name = __('Put columns names in the first row');
+$strConfigExport_csv_enclosed_name = __('Columns enclosed by');
+$strConfigExport_csv_escaped_name = __('Columns escaped by');
+$strConfigExport_csv_null_name = __('Replace NULL by');
+$strConfigExport_csv_removeCRLF_name = __('Remove CRLF characters within columns');
+$strConfigExport_csv_separator_name = __('Columns terminated by');
+$strConfigExport_csv_terminated_name = __('Lines terminated by');
+$strConfigExport_excel_columns_name = __('Put columns names in the first row');
+$strConfigExport_excel_edition_name = __('Excel edition');
+$strConfigExport_excel_null_name = __('Replace NULL by');
+$strConfigExport_excel_removeCRLF_name = __('Remove CRLF characters within columns');
+$strConfigExport_file_template_database_name = __('Database name template');
+$strConfigExport_file_template_server_name = __('Server name template');
+$strConfigExport_file_template_table_name = __('Table name template');
+$strConfigExport_format_name = __('Format');
+$strConfigExport_htmlword_columns_name = __('Put columns names in the first row');
+$strConfigExport_htmlword_null_name = __('Replace NULL by');
+$strConfigExport_htmlword_structure_or_data_name = __('Dump table');
+$strConfigExport_latex_caption_name = __('Include table caption');
+$strConfigExport_latex_columns_name = __('Put columns names in the first row');
+$strConfigExport_latex_comments_name = __('Comments');
+$strConfigExport_latex_data_caption_name = __('Table caption');
+$strConfigExport_latex_data_continued_caption_name = __('Continued table caption');
+$strConfigExport_latex_data_label_name = __('Label key');
+$strConfigExport_latex_mime_name = __('MIME type');
+$strConfigExport_latex_null_name = __('Replace NULL by');
+$strConfigExport_latex_relation_name = __('Relations');
+$strConfigExport_latex_structure_caption_name = __('Table caption');
+$strConfigExport_latex_structure_continued_caption_name = __('Continued table caption');
+$strConfigExport_latex_structure_label_name = __('Label key');
+$strConfigExport_latex_structure_or_data_name = __('Dump table');
+$strConfigExport_method_name = __('Export method');
+$strConfigExport_ods_columns_name = __('Put columns names in the first row');
+$strConfigExport_ods_null_name = __('Replace NULL by');
+$strConfigExport_odt_columns_name = __('Put columns names in the first row');
+$strConfigExport_odt_comments_name = __('Comments');
+$strConfigExport_odt_mime_name = __('MIME type');
+$strConfigExport_odt_null_name = __('Replace NULL by');
+$strConfigExport_odt_relation_name = __('Relations');
+$strConfigExport_odt_structure_or_data_name = __('Dump table');
+$strConfigExport_onserver_name = __('Save on server');
+$strConfigExport_onserver_overwrite_name = __('Overwrite existing file(s)');
+$strConfigExport_remember_file_template_name = __('Remember file name template');
+$strConfigExport_sql_auto_increment_name = __('Add AUTO_INCREMENT value');
+$strConfigExport_sql_backquotes_name = __('Enclose table and column names with backquotes');
+$strConfigExport_sql_compatibility_name = __('SQL compatibility mode');
+$strConfigExport_sql_create_table_statements_name = __('Syntax to use when inserting data');
+$strConfigExport_sql_dates_name = __('Creation/Update/Check dates');
+$strConfigExport_sql_delayed_name = __('Use delayed inserts');
+$strConfigExport_sql_disable_fk_name = __('Disable foreign key checks');
+$strConfigExport_sql_drop_database_name = sprintf(__('Add %s'), 'DROP DATABASE');
+$strConfigExport_sql_drop_table_name = sprintf(__('Add %s'), 'DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT');
+$strConfigExport_sql_hex_for_blob_name = __('Use hexadecimal for BLOB');
+$strConfigExport_sql_if_not_exists_name = sprintf(__('Add %s'), 'IF NOT EXISTS');
+$strConfigExport_sql_ignore_name = __('Use ignore inserts');
+$strConfigExport_sql_include_comments_name = __('Comments');
+$strConfigExport_sql_max_query_size_name = __('Maximal length of created query');
+$strConfigExport_sql_mime_name = __('MIME type');
+$strConfigExport_sql_procedure_function_name = sprintf(__('Add %s'), 'CREATE PROCEDURE / FUNCTION / EVENT');
+$strConfigExport_sql_relation_name = __('Relations');
+$strConfigExport_sql_structure_or_data_name = __('Dump table');
+$strConfigExport_sql_type_name = __('Export type');
+$strConfigExport_sql_use_transaction_name = __('Enclose export in a transaction');
+$strConfigExport_sql_utc_time_name = __('Export time in UTC');
+$strConfigExport_texytext_columns_name = __('Put columns names in the first row');
+$strConfigExport_texytext_null_name = __('Replace NULL by');
+$strConfigExport_texytext_structure_or_data_name = __('Dump table');
+$strConfigExport_xls_columns_name = __('Put columns names in the first row');
+$strConfigExport_xls_null_name = __('Replace NULL by');
+$strConfigExport_xlsx_columns_name = __('Put columns names in the first row');
+$strConfigExport_xlsx_null_name = __('Replace NULL by');
+$strConfigForceSSL_desc = __('Force secured connection while using phpMyAdmin');
+$strConfigForceSSL_name = __('Force SSL connection');
+$strConfigForeignKeyDropdownOrder_desc = __('Sort order for items in a foreign-key dropdown box; [kbd]content[/kbd] is the referenced data, [kbd]id[/kbd] is the key value');
+$strConfigForeignKeyDropdownOrder_name = __('Foreign key dropdown order');
+$strConfigForeignKeyMaxLimit_desc = __('A dropdown will be used if fewer items are present');
+$strConfigForeignKeyMaxLimit_name = __('Foreign key limit');
+$strConfigForm_Browse = __('Browse mode');
+$strConfigForm_Browse_desc = __('Customize browse mode');
+$strConfigForm_CodeGen = 'CodeGen';
+$strConfigForm_CodeGen_desc = __('Customize default options');
+$strConfigForm_Csv = __('CSV');
+$strConfigForm_Csv_desc = __('Customize default options');
+$strConfigForm_Developer = __('Developer');
+$strConfigForm_Developer_desc = __('Settings for phpMyAdmin developers');
+$strConfigForm_Edit = __('Edit mode');
+$strConfigForm_Edit_desc = __('Customize edit mode');
+$strConfigForm_Export = __('Export');
+$strConfigForm_Export_defaults = __('Export defaults');
+$strConfigForm_Export_defaults_desc = __('Customize default export options');
+$strConfigForm_Features = __('Features');
+$strConfigForm_General = __('General');
+$strConfigForm_General_desc = __('Set some commonly used options');
+$strConfigForm_Import = __('Import');
+$strConfigForm_Import_defaults = __('Import defaults');
+$strConfigForm_Import_defaults_desc = __('Customize default common import options');
+$strConfigForm_Import_export = __('Import / export');
+$strConfigForm_Import_export_desc = __('Set import and export directories and compression options');
+$strConfigForm_Latex = __('LaTeX');
+$strConfigForm_Latex_desc = __('Customize default options');
+$strConfigForm_Left_databases = __('Databases');
+$strConfigForm_Left_databases_desc = __('Databases display options');
+$strConfigForm_Left_frame = __('Navigation frame');
+$strConfigForm_Left_frame_desc = __('Customize appearance of the navigation frame');
+$strConfigForm_Left_servers = __('Servers');
+$strConfigForm_Left_servers_desc = __('Servers display options');
+$strConfigForm_Left_tables = __('Tables');
+$strConfigForm_Left_tables_desc = __('Tables display options');
+$strConfigForm_Main_frame = __('Main frame');
+$strConfigForm_Microsoft_Office = __('Microsoft Office');
+$strConfigForm_Microsoft_Office_desc = __('Customize default options');
+$strConfigForm_Open_Document = __('Open Document');
+$strConfigForm_Open_Document_desc = __('Customize default options');
+$strConfigForm_Other_core_settings = __('Other core settings');
+$strConfigForm_Other_core_settings_desc = __('Settings that didn\'t fit enywhere else');
+$strConfigForm_Page_titles = __('Page titles');
+$strConfigForm_Page_titles_desc = __('Specify browser\'s title bar text. Refer to [a(a)Documentation.html#cfg_TitleTable]documentation[/a] for magic strings that can be used to get special values.');
+$strConfigForm_Query_window = __('Query window');
+$strConfigForm_Query_window_desc = __('Customize query window options');
+$strConfigForm_Security = __('Security');
+$strConfigForm_Security_desc = __('Please note that phpMyAdmin is just a user interface and its features do not limit MySQL');
+$strConfigForm_Server = __('Basic settings');
+$strConfigForm_Server_auth = __('Authentication');
+$strConfigForm_Server_auth_desc = __('Authentication settings');
+$strConfigForm_Server_config = __('Server configuration');
+$strConfigForm_Server_config_desc = __('Advanced server configuration, do not change these options unless you know what they are for');
+$strConfigForm_Server_desc = __('Enter server connection parameters');
+$strConfigForm_Server_pmadb = __('Configuration storage');
+$strConfigForm_Server_pmadb_desc = __('Configure phpMyAdmin configuration storage to gain access to additional features, see [a(a)Documentation.html#linked-tables]phpMyAdmin configuration storage[/a] in documentation');
+$strConfigForm_Server_tracking = __('Changes tracking');
+$strConfigForm_Server_tracking_desc = __('Tracking of changes made in database. Requires configured PMA database.');
+$strConfigFormset_Export = __('Customize export options');
+$strConfigFormset_Features = __('Features');
+$strConfigFormset_Import = __('Customize import defaults');
+$strConfigFormset_Left_frame = __('Customize navigation frame');
+$strConfigFormset_Main_frame = __('Customize main frame');
+$strConfigFormset_Sql_queries = __('SQL queries');
+$strConfigForm_Sql = __('SQL');
+$strConfigForm_Sql_box = __('SQL Query box');
+$strConfigForm_Sql_box_desc = __('Customize links shown in SQL Query boxes');
+$strConfigForm_Sql_desc = __('Customize default options');
+$strConfigForm_Sql_queries = __('SQL queries');
+$strConfigForm_Sql_queries_desc = __('SQL queries settings');
+$strConfigForm_Sql_validator = __('SQL Validator');
+$strConfigForm_Sql_validator_desc = __('If you wish to use the SQL Validator service, you should be aware that [strong]all SQL statements are stored anonymously for statistical purposes[/strong].[br][em][a@http://sqlvalidator.mimer.com/]Mimer SQL Validator[/a], Copyright 2002 Upright Database Technology. All rights reserved.[/em]');
+$strConfigForm_Startup = __('Startup');
+$strConfigForm_Startup_desc = __('Customize startup page');
+$strConfigForm_Tabs = __('Tabs');
+$strConfigForm_Tabs_desc = __('Choose how you want tabs to work');
+$strConfigForm_Text_fields = __('Text fields');
+$strConfigForm_Text_fields_desc = __('Customize text input fields');
+$strConfigForm_Texy = __('Texy! text');
+$strConfigForm_Texy_desc = __('Customize default options');
+$strConfigForm_Warnings = __('Warnings');
+$strConfigForm_Warnings_desc = __('Disable some of the warnings shown by phpMyAdmin');
+$strConfigGZipDump_desc = __('Enable [a@http://en.wikipedia.org/wiki/Gzip]gzip[/a] compression for import and export operations');
+$strConfigGZipDump_name = __('GZip');
+$strConfigIconvExtraParams_name = __('Extra parameters for iconv');
+$strConfigIgnoreMultiSubmitErrors_desc = __('If enabled, phpMyAdmin continues computing multiple-statement queries even if one of the queries failed');
+$strConfigIgnoreMultiSubmitErrors_name = __('Ignore multiple statement errors');
+$strConfigImport_allow_interrupt_desc = __('Allow interrupt of import in case script detects it is close to time limit. This might be good way to import large files, however it can break transactions.');
+$strConfigImport_allow_interrupt_name = __('Partial import: allow interrupt');
+$strConfigImport_charset_name = __('Character set of the file');
+$strConfigImport_csv_col_names_name = __('Lines terminated by');
+$strConfigImport_csv_enclosed_name = __('Columns enclosed by');
+$strConfigImport_csv_escaped_name = __('Columns escaped by');
+$strConfigImport_csv_ignore_name = __('Ignore duplicate rows');
+$strConfigImport_csv_replace_name = __('Replace table data with file');
+$strConfigImport_csv_terminated_name = __('Columns terminated by');
+$strConfigImport_format_desc = __('Default format; be aware that this list depends on location (database, table) and only SQL is always available');
+$strConfigImport_format_name = __('Format of imported file');
+$strConfigImport_ldi_enclosed_name = __('Columns enclosed by');
+$strConfigImport_ldi_escaped_name = __('Columns escaped by');
+$strConfigImport_ldi_ignore_name = __('Ignore duplicate rows');
+$strConfigImport_ldi_local_option_name = __('Use LOCAL keyword');
+$strConfigImport_ldi_replace_name = __('Replace table data with file');
+$strConfigImport_ldi_terminated_name = __('Columns terminated by');
+$strConfigImport_ods_col_names_name = __('Column names in first row');
+$strConfigImport_ods_empty_rows_name = __('Do not import empty rows');
+$strConfigImport_ods_recognize_currency_name = __('Import currencies ($5.00 to 5.00)');
+$strConfigImport_ods_recognize_percentages_name = __('Import percentages as proper decimals (12.00% to .12)');
+$strConfigImport_skip_queries_desc = __('Number of queries to skip from start');
+$strConfigImport_skip_queries_name = __('Partial import: skip queries');
+$strConfigImport_sql_compatibility_name = __('SQL compatibility mode');
+$strConfigImport_sql_no_auto_value_on_zero_name = __('Do not use AUTO_INCREMENT for zero values');
+$strConfigImport_xls_col_names_name = __('Column names in first row');
+$strConfigImport_xlsx_col_names_name = __('Column names in first row');
+$strConfigInitialSlidersState_name = __('Initial state for sliders');
+$strConfigInsertRows_desc = __('How many rows can be inserted at one time');
+$strConfigInsertRows_name = __('Number of inserted rows');
+$strConfigLeftDefaultTabTable_name = __('Target for quick access icon');
+$strConfigLeftDisplayLogo_desc = __('Show logo in left frame');
+$strConfigLeftDisplayLogo_name = __('Display logo');
+$strConfigLeftDisplayServers_desc = __('Display server choice at the top of the left frame');
+$strConfigLeftDisplayServers_name = __('Display servers selection');
+$strConfigLeftFrameDBSeparator_desc = __('String that separates databases into different tree levels');
+$strConfigLeftFrameDBSeparator_name = __('Database tree separator');
+$strConfigLeftFrameDBTree_desc = __('Only light version; display databases in a tree (determined by the separator defined below)');
+$strConfigLeftFrameDBTree_name = __('Display databases in a tree');
+$strConfigLeftFrameLight_desc = __('Disable this if you want to see all databases at once');
+$strConfigLeftFrameLight_name = __('Use light version');
+$strConfigLeftFrameTableLevel_name = __('Maximum table tree depth');
+$strConfigLeftFrameTableSeparator_desc = __('String that separates tables into different tree levels');
+$strConfigLeftFrameTableSeparator_name = __('Table tree separator');
+$strConfigLeftLogoLink_desc = __('URL where logo in the navigation frame will point to');
+$strConfigLeftLogoLink_name = __('Logo link URL');
+$strConfigLeftLogoLinkWindow_desc = __('Open the linked page in the main window ([kbd]main[/kbd]) or in a new one ([kbd]new[/kbd])');
+$strConfigLeftLogoLinkWindow_name = __('Logo link target');
+$strConfigLeftPointerEnable_desc = __('Highlight server under the mouse cursor');
+$strConfigLeftPointerEnable_name = __('Enable highlighting');
+$strConfigLightTabs_desc = __('Use less graphically intense tabs');
+$strConfigLightTabs_name = __('Light tabs');
+$strConfigLimitChars_desc = __('Maximum number of characters shown in any non-numeric column on browse view');
+$strConfigLimitChars_name = __('Limit column characters');
+$strConfigLoginCookieDeleteAll_desc = __('If TRUE, logout deletes cookies for all servers; when set to FALSE, logout only occurs for the current server. Setting this to FALSE makes it easy to forget to log out from other servers when connected to multiple servers.');
+$strConfigLoginCookieDeleteAll_name = __('Delete all cookies on logout');
+$strConfigLoginCookieRecall_desc = __('Define whether the previous login should be recalled or not in cookie authentication mode');
+$strConfigLoginCookieRecall_name = __('Recall user name');
+$strConfigLoginCookieStore_desc = __('Defines how long (in seconds) a login cookie should be stored in browser. The default of 0 means that it will be kept for the existing session only, and will be deleted as soon as you close the browser window. This is recommended for non-trusted environments.');
+$strConfigLoginCookieStore_name = __('Login cookie store');
+$strConfigLoginCookieValidity_desc = __('Define how long (in seconds) a login cookie is valid');
+$strConfigLoginCookieValidity_name = __('Login cookie validity');
+$strConfigLongtextDoubleTextarea_desc = __('Double size of textarea for LONGTEXT fields');
+$strConfigLongtextDoubleTextarea_name = __('Bigger textarea for LONGTEXT');
+$strConfigMainPageIconic_name = __('Use icons on main page');
+$strConfigMaxCharactersInDisplayedSQL_desc = __('Maximum number of characters used when a SQL query is displayed');
+$strConfigMaxCharactersInDisplayedSQL_name = __('Maximum displayed SQL length');
+$strConfigMaxDbList_cmt = __('Users cannot set a higher value');
+$strConfigMaxDbList_desc = __('Maximum number of databases displayed in left frame and database list');
+$strConfigMaxDbList_name = __('Maximum databases');
+$strConfigMaxRows_desc = __('Number of rows displayed when browsing a result set. If the result set contains more rows, "Previous" and "Next" links will be shown.');
+$strConfigMaxRows_name = __('Maximum number of rows to display');
+$strConfigMaxTableList_cmt = __('Users cannot set a higher value');
+$strConfigMaxTableList_desc = __('Maximum number of tables displayed in table list');
+$strConfigMaxTableList_name = __('Maximum tables');
+$strConfigMcryptDisableWarning_desc = __('Disable the default warning that is displayed if mcrypt is missing for cookie authentication');
+$strConfigMcryptDisableWarning_name = __('mcrypt warning');
+$strConfigMemoryLimit_desc = __('The number of bytes a script is allowed to allocate, eg. [kbd]32M[/kbd] ([kbd]0[/kbd] for no limit)');
+$strConfigMemoryLimit_name = __('Memory limit');
+$strConfigModifyDeleteAtLeft_name = __('Show left delete link');
+$strConfigModifyDeleteAtRight_name = __('Show right delete link');
+$strConfigNaturalOrder_desc = __('Use natural order for sorting table and database names');
+$strConfigNaturalOrder_name = __('Natural order');
+$strConfigNavigationBarIconic_desc = __('Use only icons, only text or both');
+$strConfigNavigationBarIconic_name = __('Iconic navigation bar');
+$strConfigOBGzip_desc = __('use GZip output buffering for increased speed in HTTP transfers');
+$strConfigOBGzip_name = __('GZip output buffering');
+$strConfigOrder_desc = __('[kbd]SMART[/kbd] - i.e. descending order for columns of type TIME, DATE, DATETIME and TIMESTAMP, ascending order otherwise');
+$strConfigOrder_name = __('Default sorting order');
+$strConfigPersistentConnections_desc = __('Use persistent connections to MySQL databases');
+$strConfigPersistentConnections_name = __('Persistent connections');
+$strConfigPmaNoRelation_DisableWarning_desc = __('Disable the default warning that is displayed on the database details Structure page if any of the required tables for the relation features could not be found');
+$strConfigPmaNoRelation_DisableWarning_name = __('Missing phpMyAdmin configuration storage tables');
+$strConfigPropertiesIconic_desc = __('Use only icons, only text or both');
+$strConfigPropertiesIconic_name = __('Iconic table operations');
+$strConfigProtectBinary_desc = __('Disallow BLOB and BINARY columns from editing');
+$strConfigProtectBinary_name = __('Protect binary columns');
+$strConfigQueryHistoryDB_desc = __('Enable if you want DB-based query history (requires phpMyAdmin configuration storage). If disabled, this utilizes JS-routines to display query history (lost by window close).');
+$strConfigQueryHistoryDB_name = __('Permanent query history');
+$strConfigQueryHistoryMax_cmt = __('Users cannot set a higher value');
+$strConfigQueryHistoryMax_desc = __('How many queries are kept in history');
+$strConfigQueryHistoryMax_name = __('Query history length');
+$strConfigQueryWindowDefTab_desc = __('Tab displayed when opening a new query window');
+$strConfigQueryWindowDefTab_name = __('Default query window tab');
+$strConfigQueryWindowHeight_desc = __('Query window height (in pixels)');
+$strConfigQueryWindowHeight_name = __('Query window height');
+$strConfigQueryWindowWidth_desc = __('Query window height (in pixels)');
+$strConfigQueryWindowWidth_name = __('Query window width');
+$strConfigRecodingEngine_desc = __('Select which functions will be used for character set conversion');
+$strConfigRecodingEngine_name = __('Recoding engine');
+$strConfigRepeatCells_desc = __('Repeat the headers every X cells, [kbd]0[/kbd] deactivates this feature');
+$strConfigRepeatCells_name = __('Repeat headers');
+$strConfigReplaceHelpImg_desc = __('Show help button instead of Documentation text');
+$strConfigReplaceHelpImg_name = __('Show help button');
+$strConfigRestoreDefaultValue = __('Restore default value');
+$strConfigSaveDir_desc = __('Directory where exports can be saved on server');
+$strConfigSaveDir_name = __('Save directory');
+$strConfigServers_AllowDeny_order_desc = __('Leave blank if not used');
+$strConfigServers_AllowDeny_order_name = __('Host authorization order');
+$strConfigServers_AllowDeny_rules_desc = __('Leave blank for defaults');
+$strConfigServers_AllowDeny_rules_name = __('Host authorization rules');
+$strConfigServers_AllowNoPassword_name = __('Allow logins without a password');
+$strConfigServers_AllowRoot_name = __('Allow root login');
+$strConfigServers_auth_http_realm_desc = __('HTTP Basic Auth Realm name to display when doing HTTP Auth');
+$strConfigServers_auth_http_realm_name = __('HTTP Realm');
+$strConfigServers_auth_swekey_config_desc = __('The path for the config file for [a@http://swekey.com]SweKey hardware authentication[/a] (not located in your document root; suggested: /etc/swekey.conf)');
+$strConfigServers_auth_swekey_config_name = __('SweKey config file');
+$strConfigServers_auth_type_desc = __('Authentication method to use');
+$strConfigServers_auth_type_name = __('Authentication type');
+$strConfigServers_bookmarktable_desc = __('Leave blank for no [a@http://wiki.phpmyadmin.net/pma/bookmark]bookmark[/a] support, suggested: [kbd]pma_bookmark[/kbd]');
+$strConfigServers_bookmarktable_name = __('Bookmark table');
+$strConfigServers_column_info_desc = __('Leave blank for no column comments/mime types, suggested: [kbd]pma_column_info[/kbd]');
+$strConfigServers_column_info_name = __('Column information table');
+$strConfigServers_compress_desc = __('Compress connection to MySQL server');
+$strConfigServers_compress_name = __('Compress connection');
+$strConfigServers_connect_type_desc = __('How to connect to server, keep [kbd]tcp[/kbd] if unsure');
+$strConfigServers_connect_type_name = __('Connection type');
+$strConfigServers_controlpass_name = __('Control user password');
+$strConfigServers_controluser_desc = __('A special MySQL user configured with limited permissions, more information available on [a@http://wiki.phpmyadmin.net/pma/controluser]wiki[/a]');
+$strConfigServers_controluser_name = __('Control user');
+$strConfigServers_CountTables_desc = __('Count tables when showing database list');
+$strConfigServers_CountTables_name = __('Count tables');
+$strConfigServers_designer_coords_desc = __('Leave blank for no Designer support, suggested: [kbd]pma_designer_coords[/kbd]');
+$strConfigServers_designer_coords_name = __('Designer table');
+$strConfigServers_DisableIS_desc = __('More information on [a@http://sf.net/support/tracker.php?aid=1849494]PMA bug tracker[/a] and [a@http://bugs.mysql.com/19588]MySQL Bugs[/a]');
+$strConfigServers_DisableIS_name = __('Disable use of INFORMATION_SCHEMA');
+$strConfigServers_extension_desc = __('What PHP extension to use; you should use mysqli if supported');
+$strConfigServers_extension_name = __('PHP extension to use');
+$strConfigServers_hide_db_desc = __('Hide databases matching regular expression (PCRE)');
+$strConfigServers_hide_db_name = __('Hide databases');
+$strConfigServers_history_desc = __('Leave blank for no SQL query history support, suggested: [kbd]pma_history[/kbd]');
+$strConfigServers_history_name = __('SQL query history table');
+$strConfigServers_host_desc = __('Hostname where MySQL server is running');
+$strConfigServers_host_name = __('Server hostname');
+$strConfigServers_LogoutURL_name = __('Logout URL');
+$strConfigServers_nopassword_desc = __('Try to connect without password');
+$strConfigServers_nopassword_name = __('Connect without password');
+$strConfigServers_only_db_desc = __('You can use MySQL wildcard characters (% and _), escape them if you want to use their literal instances, i.e. use [kbd]\'my\_db\'[/kbd] and not [kbd]\'my_db\'[/kbd]. Using this option you can sort database list, just enter their names in order and use [kbd]*[/kbd] at the end to show the rest in alphabetical order.');
+$strConfigServers_only_db_name = __('Show only listed databases');
+$strConfigServers_password_desc = __('Leave empty if not using config auth');
+$strConfigServers_password_name = __('Password for config auth');
+$strConfigServers_pdf_pages_desc = __('Leave blank for no PDF schema support, suggested: [kbd]pma_pdf_pages[/kbd]');
+$strConfigServers_pdf_pages_name = __('PDF schema: pages table');
+$strConfigServers_pmadb_desc = __('Database used for relations, bookmarks, and PDF features. See [a@http://wiki.phpmyadmin.net/pma/pmadb]pmadb[/a] for complete information. Leave blank for no support. Suggested: [kbd]phpmyadmin[/kbd]');
+$strConfigServers_pmadb_name = __('Database name');
+$strConfigServers_port_desc = __('Port on which MySQL server is listening, leave empty for default');
+$strConfigServers_port_name = __('Server port');
+$strConfigServers_relation_desc = __('Leave blank for no [a@http://wiki.phpmyadmin.net/pma/relation]relation-links[/a] support, suggested: [kbd]pma_relation[/kbd]');
+$strConfigServers_relation_name = __('Relation table');
+$strConfigServers_ShowDatabasesCommand_desc = __('SQL command to fetch available databases');
+$strConfigServers_ShowDatabasesCommand_name = __('SHOW DATABASES command');
+$strConfigServers_SignonSession_desc = __('See [a@http://wiki.phpmyadmin.net/pma/auth_types#signon]authentication types[/a] for an example');
+$strConfigServers_SignonSession_name = __('Signon session name');
+$strConfigServers_SignonURL_name = __('Signon URL');
+$strConfigServers_socket_desc = __('Socket on which MySQL server is listening, leave empty for default');
+$strConfigServers_socket_name = __('Server socket');
+$strConfigServers_ssl_desc = __('Enable SSL for connection to MySQL server');
+$strConfigServers_ssl_name = __('Use SSL');
+$strConfigServers_table_coords_desc = __('Leave blank for no PDF schema support, suggested: [kbd]pma_table_coords[/kbd]');
+$strConfigServers_table_coords_name = __('PDF schema: table coordinates');
+$strConfigServers_table_info_desc = __('Table to describe the display columns, leave blank for no support; suggested: [kbd]pma_table_info[/kbd]');
+$strConfigServers_table_info_name = __('Display columns table');
+$strConfigServers_tracking_add_drop_database_desc = __('Whether a DROP DATABASE IF EXISTS statement will be added as first line to the log when creating a database.');
+$strConfigServers_tracking_add_drop_database_name = __('Add DROP DATABASE');
+$strConfigServers_tracking_add_drop_table_desc = __('Whether a DROP TABLE IF EXISTS statement will be added as first line to the log when creating a table.');
+$strConfigServers_tracking_add_drop_table_name = __('Add DROP TABLE');
+$strConfigServers_tracking_add_drop_view_desc = __('Whether a DROP VIEW IF EXISTS statement will be added as first line to the log when creating a view.');
+$strConfigServers_tracking_add_drop_view_name = __('Add DROP VIEW');
+$strConfigServers_tracking_default_statements_desc = __('Defines the list of statements the auto-creation uses for new versions.');
+$strConfigServers_tracking_default_statements_name = __('Statements to track');
+$strConfigServers_tracking_desc = __('Leave blank for no SQL query tracking support, suggested: [kbd]pma_tracking[/kbd]');
+$strConfigServers_tracking_name = __('SQL query tracking table');
+$strConfigServers_tracking_version_auto_create_desc = __('Whether the tracking mechanism creates versions for tables and views automatically.');
+$strConfigServers_tracking_version_auto_create_name = __('Automatically create versions');
+$strConfigServers_userconfig_desc = __('Leave blank for no user preferences storage in database, suggested: [kbd]pma_config[/kbd]');
+$strConfigServers_userconfig_name = __('User preferences storage table');
+$strConfigServers_user_desc = __('Leave empty if not using config auth');
+$strConfigServers_user_name = __('User for config auth');
+$strConfigServers_verbose_check_desc = __('Disable if you know that your pma_* tables are up to date. This prevents compatibility checks and thereby increases performance');
+$strConfigServers_verbose_check_name = __('Verbose check');
+$strConfigServers_verbose_desc = __('A user-friendly description of this server. Leave blank to display the hostname instead.');
+$strConfigServers_verbose_name = __('Verbose name of this server');
+$strConfigShowAll_desc = __('Whether a user should be displayed a "show all (rows)" button');
+$strConfigShowAll_name = __('Allow to display all the rows');
+$strConfigShowChgPassword_desc = __('Please note that enabling this has no effect with [kbd]config[/kbd] authentication mode because the password is hard coded in the configuration file; this does not limit the ability to execute the same command directly');
+$strConfigShowChgPassword_name = __('Show password change form');
+$strConfigShowCreateDb_name = __('Show create database form');
+$strConfigShowFieldTypesInDataEditView_desc = __('Defines whether or not type fields should be initially displayed in edit/insert mode');
+$strConfigShowFieldTypesInDataEditView_name = __('Show field types');
+$strConfigShowFunctionFields_desc = __('Display the function fields in edit/insert mode');
+$strConfigShowFunctionFields_name = __('Show function fields');
+$strConfigShowPhpInfo_desc = __('Shows link to [a@http://php.net/manual/function.phpinfo.php]phpinfo()[/a] output');
+$strConfigShowPhpInfo_name = __('Show phpinfo() link');
+$strConfigShowServerInfo_name = __('Show detailed MySQL server information');
+$strConfigShowSQL_desc = __('Defines whether SQL queries generated by phpMyAdmin should be displayed');
+$strConfigShowSQL_name = __('Show SQL queries');
+$strConfigShowStats_desc = __('Allow to display database and table statistics (eg. space usage)');
+$strConfigShowStats_name = __('Show statistics');
+$strConfigShowTooltipAliasDB_desc = __('If tooltips are enabled and a database comment is set, this will flip the comment and the real name');
+$strConfigShowTooltipAliasDB_name = __('Display database comment instead of its name');
+$strConfigShowTooltipAliasTB_desc = __('When setting this to [kbd]nested[/kbd], the alias of the table name is only used to split/nest the tables according to the $cfg[\'LeftFrameTableSeparator\'] directive, so only the folder is called like the alias, the table name itself stays unchanged');
+$strConfigShowTooltipAliasTB_name = __('Display table comment instead of its name');
+$strConfigShowTooltip_name = __('Display table comments in tooltips');
+$strConfigSkipLockedTables_desc = __('Mark used tables and make it possible to show databases with locked tables');
+$strConfigSkipLockedTables_name = __('Skip locked tables');
+$strConfigSQLQuery_Edit_name = __('Edit');
+$strConfigSQLQuery_Explain_name = __('Explain SQL');
+$strConfigSQLQuery_Refresh_name = __('Refresh');
+$strConfigSQLQuery_ShowAsPHP_name = __('Create PHP Code');
+$strConfigSQLQuery_Validate_desc = __('Requires SQL Validator to be enabled');
+$strConfigSQLQuery_Validate_name = __('Validate SQL');
+$strConfigSQLValidator_password_name = __('Password');
+$strConfigSQLValidator_use_desc = __('[strong]Warning:[/strong] requires PHP SOAP extension or PEAR SOAP to be installed');
+$strConfigSQLValidator_use_name = __('Enable SQL Validator');
+$strConfigSQLValidator_username_desc = __('If you have a custom username, specify it here (defaults to [kbd]anonymous[/kbd])');
+$strConfigSQLValidator_username_name = __('Username');
+$strConfigSuggestDBName_desc = __('Suggest a database name on the "Create Database" form (if possible) or keep the text field empty');
+$strConfigSuggestDBName_name = __('Suggest new database name');
+$strConfigSuhosinDisableWarning_desc = __('A warning is displayed on the main page if Suhosin is detected');
+$strConfigSuhosinDisableWarning_name = __('Suhosin warning');
+$strConfigTextareaCols_desc = __('Textarea size (columns) in edit mode, this value will be emphasized for SQL query textareas (*2) and for query window (*1.25)');
+$strConfigTextareaCols_name = __('Textarea columns');
+$strConfigTextareaRows_desc = __('Textarea size (rows) in edit mode, this value will be emphasized for SQL query textareas (*2) and for query window (*1.25)');
+$strConfigTextareaRows_name = __('Textarea rows');
+$strConfigTitleDatabase_desc = __('Title of browser window when a database is selected');
+$strConfigTitleDatabase_name = __('Database');
+$strConfigTitleDefault_desc = __('Title of browser window when nothing is selected');
+$strConfigTitleDefault_name = __('Default title');
+$strConfigTitleServer_desc = __('Title of browser window when a server is selected');
+$strConfigTitleServer_name = __('Server');
+$strConfigTitleTable_desc = __('Title of browser window when a table is selected');
+$strConfigTitleTable_name = __('Table');
+$strConfigTrustedProxies_desc = __('Input proxies as [kbd]IP: trusted HTTP header[/kbd]. The following example specifies that phpMyAdmin should trust a HTTP_X_FORWARDED_FOR (X-Forwarded-For) header coming from the proxy 1.2.3.4:[br][kbd]1.2.3.4: HTTP_X_FORWARDED_FOR[/kbd]');
+$strConfigTrustedProxies_name = __('List of trusted proxies for IP allow/deny');
+$strConfigUploadDir_desc = __('Directory on server where you can upload files for import');
+$strConfigUploadDir_name = __('Upload directory');
+$strConfigUseDbSearch_desc = __('Allow for searching inside the entire database');
+$strConfigUseDbSearch_name = __('Use database search');
+$strConfigUserprefsDeveloperTab_desc = __('When disabled, users cannot set any of the options below, regardless of the checkbox on the right');
+$strConfigUserprefsDeveloperTab_name = __('Enable the Developer tab in settings');
+$strConfigVerboseMultiSubmit_desc = __('Show affected rows of each statement on multiple-statement queries. See libraries/import.lib.php for defaults on how many queries a statement may contain.');
+$strConfigVerboseMultiSubmit_name = __('Verbose multiple statements');
+$strConfigVersionCheckLink = __('Check for latest version');
+$strConfigZipDump_desc = __('Enable [a@http://en.wikipedia.org/wiki/ZIP_(file_format)]ZIP[/a] compression for import and export operations');
+$strConfigZipDump_name = __('ZIP');
+
+?>
\ No newline at end of file
diff --git a/libraries/config/setup.forms.php b/libraries/config/setup.forms.php
new file mode 100644
index 0000000..af8d284
--- /dev/null
+++ b/libraries/config/setup.forms.php
@@ -0,0 +1,368 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * List of avaible forms, each form is described as an array of fields to display.
+ * Fields MUST have their counterparts in the $cfg array.
+ *
+ * There are two possible notations:
+ * $forms['Form group']['Form name'] = array('Servers' => array(1 => array('host')));
+ * can be written as
+ * $forms['Form group']['Form name'] = array('Servers/1/host');
+ *
+ * You can assign default values set by special button ("set value: ..."), eg.:
+ * 'Servers/1/pmadb' => 'phpmyadmin'
+ *
+ * To group options, use:
+ * ':group:' . __('group name') // just define a group
+ * or
+ * 'option' => ':group' // group starting from this option
+ * End group blocks with:
+ * ':group:end'
+ *
+ * @package phpMyAdmin-setup
+ */
+
+$forms = array();
+$forms['_config.php'] = array(
+ 'DefaultLang',
+ 'ServerDefault');
+$forms['Servers']['Server'] = array('Servers' => array(1 => array(
+ 'verbose',
+ 'host',
+ 'port',
+ 'socket',
+ 'ssl',
+ 'connect_type',
+ 'extension',
+ 'compress',
+ 'nopassword')));
+$forms['Servers']['Server_auth'] = array('Servers' => array(1 => array(
+ 'auth_type',
+ ':group:' . __('Config authentication'),
+ 'user',
+ 'password',
+ ':group:end',
+ ':group:' . __('Cookie authentication'),
+ 'auth_swekey_config' => './swekey.conf',
+ ':group:end',
+ ':group:' . __('HTTP authentication'),
+ 'auth_http_realm',
+ ':group:end',
+ ':group:' . __('Signon authentication'),
+ 'SignonSession',
+ 'SignonURL',
+ 'LogoutURL')));
+$forms['Servers']['Server_config'] = array('Servers' => array(1 => array(
+ 'only_db',
+ 'hide_db',
+ 'AllowRoot',
+ 'AllowNoPassword',
+ 'DisableIS',
+ 'AllowDeny/order',
+ 'AllowDeny/rules',
+ 'ShowDatabasesCommand',
+ 'CountTables')));
+$forms['Servers']['Server_pmadb'] = array('Servers' => array(1 => array(
+ 'pmadb' => 'phpmyadmin',
+ 'controluser',
+ 'controlpass',
+ 'verbose_check',
+ 'bookmarktable' => 'pma_bookmark',
+ 'relation' => 'pma_relation',
+ 'userconfig' => 'pma_userconfig',
+ 'table_info' => 'pma_table_info',
+ 'column_info' => 'pma_column_info',
+ 'history' => 'pma_history',
+ 'tracking' => 'pma_tracking',
+ 'table_coords' => 'pma_table_coords',
+ 'pdf_pages' => 'pma_pdf_pages',
+ 'designer_coords' => 'pma_designer_coords')));
+$forms['Servers']['Server_tracking'] = array('Servers' => array(1 => array(
+ 'tracking_version_auto_create',
+ 'tracking_default_statements',
+ 'tracking_add_drop_view',
+ 'tracking_add_drop_table',
+ 'tracking_add_drop_database',
+)));
+$forms['Features']['Import_export'] = array(
+ 'UploadDir',
+ 'SaveDir',
+ 'RecodingEngine' => ':group',
+ 'IconvExtraParams',
+ ':group:end',
+ 'ZipDump',
+ 'GZipDump',
+ 'BZipDump',
+ 'CompressOnFly');
+$forms['Features']['Security'] = array(
+ 'blowfish_secret',
+ 'ForceSSL',
+ 'CheckConfigurationPermissions',
+ 'TrustedProxies',
+ 'AllowUserDropDatabase',
+ 'AllowArbitraryServer',
+ 'LoginCookieRecall',
+ 'LoginCookieValidity',
+ 'LoginCookieStore',
+ 'LoginCookieDeleteAll');
+$forms['Features']['Page_titles'] = array(
+ 'TitleDefault',
+ 'TitleTable',
+ 'TitleDatabase',
+ 'TitleServer');
+$forms['Features']['Warnings'] = array(
+ 'PmaNoRelation_DisableWarning',
+ 'SuhosinDisableWarning',
+ 'McryptDisableWarning');
+$forms['Features']['Developer'] = array(
+ 'UserprefsDeveloperTab',
+ 'Error_Handler/display',
+ 'Error_Handler/gather',
+ 'DBG/sql',
+ 'DBG/php');
+$forms['Features']['Other_core_settings'] = array(
+ 'NaturalOrder',
+ 'InitialSlidersState',
+ 'ErrorIconic',
+ 'ReplaceHelpImg',
+ 'MaxDbList',
+ 'MaxTableList',
+ 'OBGzip',
+ 'PersistentConnections',
+ 'ExecTimeLimit',
+ 'MemoryLimit',
+ 'SkipLockedTables',
+ 'UseDbSearch',
+ 'AllowThirdPartyFraming');
+$forms['Sql_queries']['Sql_queries'] = array(
+ 'ShowSQL',
+ 'Confirm',
+ 'QueryHistoryDB',
+ 'QueryHistoryMax',
+ 'IgnoreMultiSubmitErrors',
+ 'VerboseMultiSubmit',
+ 'MaxCharactersInDisplayedSQL',
+ 'EditInWindow',
+ //'QueryWindowWidth', // overridden in theme
+ //'QueryWindowHeight',
+ 'QueryWindowDefTab');
+$forms['Sql_queries']['Sql_box'] = array('SQLQuery' => array(
+ 'Edit',
+ 'Explain',
+ 'ShowAsPHP',
+ 'Validate',
+ 'Refresh'));
+$forms['Sql_queries']['Sql_validator'] = array('SQLValidator' => array(
+ 'use',
+ 'username',
+ 'password'));
+$forms['Left_frame']['Left_frame'] = array(
+ 'LeftFrameLight',
+ 'LeftDisplayLogo',
+ 'LeftLogoLink',
+ 'LeftLogoLinkWindow',
+ 'LeftPointerEnable');
+$forms['Left_frame']['Left_servers'] = array(
+ 'LeftDisplayServers',
+ 'DisplayServersList');
+$forms['Left_frame']['Left_databases'] = array(
+ 'DisplayDatabasesList',
+ 'LeftFrameDBTree',
+ 'LeftFrameDBSeparator',
+ 'ShowTooltipAliasDB');
+$forms['Left_frame']['Left_tables'] = array(
+ 'LeftDefaultTabTable',
+ 'LeftFrameTableSeparator',
+ 'LeftFrameTableLevel',
+ 'ShowTooltip',
+ 'ShowTooltipAliasTB');
+$forms['Main_frame']['Startup'] = array(
+ 'MainPageIconic',
+ 'ShowCreateDb' => ':group',
+ 'SuggestDBName',
+ ':group:end',
+ 'ShowStats',
+ 'ShowServerInfo',
+ 'ShowPhpInfo',
+ 'ShowChgPassword');
+$forms['Main_frame']['Browse'] = array(
+ 'NavigationBarIconic',
+ 'ShowAll',
+ 'MaxRows',
+ 'Order',
+ 'BrowsePointerEnable',
+ 'BrowseMarkerEnable',
+ 'RepeatCells',
+ 'LimitChars',
+ 'ModifyDeleteAtLeft',
+ 'ModifyDeleteAtRight',
+ 'DefaultDisplay');
+$forms['Main_frame']['Edit'] = array(
+ 'ProtectBinary',
+ 'ShowFunctionFields',
+ 'ShowFieldTypesInDataEditView',
+ 'CharEditing',
+ 'CharTextareaCols',
+ 'CharTextareaRows',
+ 'TextareaCols',
+ 'TextareaRows',
+ 'LongtextDoubleTextarea',
+ 'InsertRows',
+ 'ForeignKeyDropdownOrder',
+ 'ForeignKeyMaxLimit',
+ 'DefaultPropDisplay');
+$forms['Main_frame']['Tabs'] = array(
+ 'LightTabs',
+ 'PropertiesIconic',
+ 'DefaultTabServer',
+ 'DefaultTabDatabase',
+ 'DefaultTabTable',
+ 'QueryWindowDefTab');
+$forms['Import']['Import_defaults'] = array('Import' => array(
+ 'format',
+ 'charset',
+ 'allow_interrupt',
+ 'skip_queries'));
+$forms['Import']['Sql'] = array('Import' => array(
+ 'sql_compatibility',
+ 'sql_no_auto_value_on_zero'));
+$forms['Import']['Csv'] = array('Import' => array(
+ ':group:' . __('CSV'),
+ 'csv_replace',
+ 'csv_ignore',
+ 'csv_terminated',
+ 'csv_enclosed',
+ 'csv_escaped',
+ 'csv_col_names',
+ ':group:end',
+ ':group:' . __('CSV using LOAD DATA'),
+ 'ldi_replace',
+ 'ldi_ignore',
+ 'ldi_terminated',
+ 'ldi_enclosed',
+ 'ldi_escaped',
+ 'ldi_local_option',
+ ':group:end'));
+$forms['Import']['Microsoft_Office'] = array('Import' => array(
+ ':group:' . __('Excel 97-2003 XLS Workbook'),
+ 'xls_col_names',
+ ':group:end',
+ ':group:' . __('Excel 2007 XLSX Workbook'),
+ 'xlsx_col_names'));
+$forms['Import']['Open_Document'] = array('Import' => array(
+ ':group:' . __('Open Document Spreadsheet'),
+ 'ods_col_names',
+ 'ods_empty_rows',
+ 'ods_recognize_percentages',
+ 'ods_recognize_currency'));
+$forms['Export']['Export_defaults'] = array('Export' => array(
+ 'method',
+ 'format',
+ 'compression',
+ 'charset',
+ 'asfile' => ':group',
+ 'onserver',
+ 'onserver_overwrite',
+ ':group:end',
+ 'remember_file_template',
+ 'file_template_table',
+ 'file_template_database',
+ 'file_template_server'));
+$forms['Export']['Sql'] = array('Export' => array(
+ 'sql_include_comments' => ':group',
+ 'sql_dates',
+ 'sql_relation',
+ 'sql_mime',
+ ':group:end',
+ 'sql_use_transaction',
+ 'sql_disable_fk',
+ 'sql_compatibility',
+ ':group:' . __('Database export options'),
+ 'sql_drop_database',
+ 'sql_structure_or_data',
+ ':group:end',
+ ':group:' . __('Structure'),
+ 'sql_drop_table',
+ 'sql_procedure_function',
+ 'sql_create_table_statements' => ':group',
+ 'sql_if_not_exists',
+ 'sql_auto_increment',
+ ':group:end',
+ 'sql_backquotes',
+ ':group:end',
+ ':group:' . __('Data'),
+ 'sql_delayed',
+ 'sql_ignore',
+ 'sql_type',
+ 'sql_insert_syntax',
+ 'sql_max_query_size',
+ 'sql_hex_for_blob',
+ 'sql_utc_time'));
+$forms['Export']['CodeGen'] = array('Export' => array(
+ 'codegen_format'));
+$forms['Export']['Csv'] = array('Export' => array(
+ ':group:' . __('CSV'),
+ 'csv_separator',
+ 'csv_enclosed',
+ 'csv_escaped',
+ 'csv_terminated',
+ 'csv_null',
+ 'csv_removeCRLF',
+ 'csv_columns',
+ ':group:end',
+ ':group:' . __('CSV for MS Excel'),
+ 'excel_null',
+ 'excel_removeCRLF',
+ 'excel_columns',
+ 'excel_edition'));
+$forms['Export']['Latex'] = array('Export' => array(
+ 'latex_caption',
+ 'latex_structure_or_data',
+ ':group:' . __('Structure'),
+ 'latex_structure_caption',
+ 'latex_structure_continued_caption',
+ 'latex_structure_label',
+ 'latex_relation',
+ 'latex_comments',
+ 'latex_mime',
+ ':group:end',
+ ':group:' . __('Data'),
+ 'latex_columns',
+ 'latex_data_caption',
+ 'latex_data_continued_caption',
+ 'latex_data_label',
+ 'latex_null'));
+$forms['Export']['Microsoft_Office'] = array('Export' => array(
+ ':group:' . __('Excel 97-2003 XLS Workbook'),
+ 'xls_null',
+ 'xls_columns',
+ ':group:end',
+ ':group:' . __('Excel 2007 XLSX Workbook'),
+ 'xlsx_null',
+ 'xlsx_columns',
+ ':group:end',
+ ':group:' . __('Microsoft Word 2000'),
+ 'htmlword_structure_or_data',
+ 'htmlword_null',
+ 'htmlword_columns'));
+$forms['Export']['Open_Document'] = array('Export' => array(
+ ':group:' . __('Open Document Spreadsheet'),
+ 'ods_columns',
+ 'ods_null',
+ ':group:end',
+ ':group:' . __('Open Document Text'),
+ 'odt_structure_or_data',
+ ':group:' . __('Structure'),
+ 'odt_relation',
+ 'odt_comments',
+ 'odt_mime',
+ ':group:end',
+ ':group:' . __('Data'),
+ 'odt_columns',
+ 'odt_null'));
+$forms['Export']['Texy'] = array('Export' => array(
+ 'texytext_structure_or_data',
+ ':group:' . __('Data'),
+ 'texytext_null',
+ 'texytext_columns'));
+?>
\ No newline at end of file
diff --git a/libraries/config/user_preferences.forms.php b/libraries/config/user_preferences.forms.php
new file mode 100644
index 0000000..564f093
--- /dev/null
+++ b/libraries/config/user_preferences.forms.php
@@ -0,0 +1,268 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * List of avaible forms, each form is described as an array of fields to display.
+ * Fields MUST have their counterparts in the $cfg array.
+ *
+ * To define form field, use the notatnion below:
+ * $forms['Form group']['Form name'] = array('Option/path');
+ *
+ * You can assign default values set by special button ("set value: ..."), eg.:
+ * 'Servers/1/pmadb' => 'phpmyadmin'
+ *
+ * To group options, use:
+ * ':group:' . __('group name') // just define a group
+ * or
+ * 'option' => ':group' // group starting from this option
+ * End group blocks with:
+ * ':group:end'
+ *
+ * @package phpMyAdmin
+ */
+
+$forms = array();
+$forms['Features']['General'] = array(
+ 'NaturalOrder',
+ 'InitialSlidersState',
+ 'ErrorIconic',
+ 'ReplaceHelpImg',
+ 'Servers/1/only_db', // saves to Server/only_db
+ 'Servers/1/hide_db', // saves to Server/hide_db
+ 'SkipLockedTables',
+ 'MaxDbList',
+ 'MaxTableList');
+$forms['Features']['Text_fields'] = array(
+ 'CharEditing',
+ 'CharTextareaCols',
+ 'CharTextareaRows',
+ 'TextareaCols',
+ 'TextareaRows',
+ 'LongtextDoubleTextarea');
+$forms['Features']['Page_titles'] = array(
+ 'TitleDefault',
+ 'TitleTable',
+ 'TitleDatabase',
+ 'TitleServer');
+$forms['Features']['Warnings'] = array(
+ 'PmaNoRelation_DisableWarning',
+ 'SuhosinDisableWarning',
+ 'McryptDisableWarning');
+// settings from this form are treated specially, see prefs_forms.php and user_preferences.lib.php
+$forms['Features']['Developer'] = array(
+ 'Error_Handler/display',
+ 'Error_Handler/gather',
+ 'DBG/sql',
+ 'DBG/php');
+$forms['Sql_queries']['Sql_queries'] = array(
+ 'ShowSQL',
+ 'Confirm',
+ 'QueryHistoryMax',
+ 'IgnoreMultiSubmitErrors',
+ 'VerboseMultiSubmit',
+ 'MaxCharactersInDisplayedSQL',
+ 'EditInWindow',
+ //'QueryWindowWidth', // overridden in theme
+ //'QueryWindowHeight',
+ 'QueryWindowDefTab');
+$forms['Sql_queries']['Sql_box'] = array(
+ 'SQLQuery/Edit',
+ 'SQLQuery/Explain',
+ 'SQLQuery/ShowAsPHP',
+ 'SQLQuery/Validate',
+ 'SQLQuery/Refresh');
+$forms['Left_frame']['Left_frame'] = array(
+ 'LeftFrameLight',
+ 'LeftDisplayLogo',
+ 'LeftLogoLink',
+ 'LeftLogoLinkWindow',
+ 'LeftPointerEnable');
+$forms['Left_frame']['Left_databases'] = array(
+ 'DisplayDatabasesList',
+ 'LeftFrameDBTree',
+ 'LeftFrameDBSeparator',
+ 'ShowTooltipAliasDB');
+$forms['Left_frame']['Left_tables'] = array(
+ 'LeftDefaultTabTable',
+ 'LeftFrameTableSeparator',
+ 'LeftFrameTableLevel',
+ 'ShowTooltip',
+ 'ShowTooltipAliasTB');
+$forms['Main_frame']['Startup'] = array(
+ 'MainPageIconic',
+ 'ShowCreateDb' => ':group',
+ 'SuggestDBName',
+ ':group:end',
+ 'ShowStats',
+ 'ShowServerInfo');
+$forms['Main_frame']['Browse'] = array(
+ 'NavigationBarIconic',
+ 'ShowAll',
+ 'MaxRows',
+ 'Order',
+ 'DisplayBinaryAsHex',
+ 'BrowsePointerEnable',
+ 'BrowseMarkerEnable',
+ 'RepeatCells',
+ 'LimitChars',
+ 'ModifyDeleteAtLeft',
+ 'ModifyDeleteAtRight',
+ 'DefaultDisplay');
+$forms['Main_frame']['Edit'] = array(
+ 'ProtectBinary',
+ 'ShowFunctionFields',
+ 'ShowFieldTypesInDataEditView',
+ 'InsertRows',
+ 'ForeignKeyDropdownOrder',
+ 'ForeignKeyMaxLimit',
+ 'CtrlArrowsMoving',
+ 'DefaultPropDisplay');
+$forms['Main_frame']['Tabs'] = array(
+ 'LightTabs',
+ 'PropertiesIconic',
+ 'DefaultTabServer',
+ 'DefaultTabDatabase',
+ 'DefaultTabTable');
+$forms['Import']['Import_defaults'] = array(
+ 'Import/format',
+ 'Import/charset',
+ 'Import/allow_interrupt',
+ 'Import/skip_queries');
+$forms['Import']['Sql'] = array(
+ 'Import/sql_compatibility',
+ 'Import/sql_no_auto_value_on_zero');
+$forms['Import']['Csv'] = array(
+ ':group:' . __('CSV'),
+ 'Import/csv_replace',
+ 'Import/csv_ignore',
+ 'Import/csv_terminated',
+ 'Import/csv_enclosed',
+ 'Import/csv_escaped',
+ 'Import/csv_col_names',
+ ':group:end',
+ ':group:' . __('CSV using LOAD DATA'),
+ 'Import/ldi_replace',
+ 'Import/ldi_ignore',
+ 'Import/ldi_terminated',
+ 'Import/ldi_enclosed',
+ 'Import/ldi_escaped',
+ 'Import/ldi_local_option');
+$forms['Import']['Microsoft_Office'] = array(
+ ':group:' . __('Excel 97-2003 XLS Workbook'),
+ 'Import/xls_col_names',
+ ':group:end',
+ ':group:' . __('Excel 2007 XLSX Workbook'),
+ 'Import/xlsx_col_names');
+$forms['Import']['Open_Document'] = array(
+ ':group:' . __('Open Document Spreadsheet'),
+ 'Import/ods_col_names',
+ 'Import/ods_empty_rows',
+ 'Import/ods_recognize_percentages',
+ 'Import/ods_recognize_currency');
+$forms['Export']['Export_defaults'] = array(
+ 'Export/method',
+ 'Export/format',
+ 'Export/compression',
+ 'Export/charset',
+ 'Export/asfile',
+ 'Export/remember_file_template',
+ 'Export/file_template_table',
+ 'Export/file_template_database',
+ 'Export/file_template_server');
+$forms['Export']['Sql'] = array(
+ 'Export/sql_include_comments' => ':group',
+ 'Export/sql_dates',
+ 'Export/sql_relation',
+ 'Export/sql_mime',
+ ':group:end',
+ 'Export/sql_use_transaction',
+ 'Export/sql_disable_fk',
+ 'Export/sql_compatibility',
+ ':group:' . __('Database export options'),
+ 'Export/sql_drop_database',
+ 'Export/sql_structure_or_data',
+ ':group:end',
+ ':group:' . __('Structure'),
+ 'Export/sql_drop_table',
+ 'Export/sql_procedure_function',
+ 'Export/sql_create_table_statements' => ':group',
+ 'Export/sql_if_not_exists',
+ 'Export/sql_auto_increment',
+ ':group:end',
+ 'Export/sql_backquotes',
+ ':group:end',
+ ':group:' . __('Data'),
+ 'Export/sql_delayed',
+ 'Export/sql_ignore',
+ 'Export/sql_type',
+ 'Export/sql_insert_syntax',
+ 'Export/sql_max_query_size',
+ 'Export/sql_hex_for_blob',
+ 'Export/sql_utc_time');
+$forms['Export']['CodeGen'] = array(
+ 'Export/codegen_format');
+$forms['Export']['Csv'] = array(
+ ':group:' . __('CSV'),
+ 'Export/csv_separator',
+ 'Export/csv_enclosed',
+ 'Export/csv_escaped',
+ 'Export/csv_terminated',
+ 'Export/csv_null',
+ 'Export/csv_removeCRLF',
+ 'Export/csv_columns',
+ ':group:end',
+ ':group:' . __('CSV for MS Excel'),
+ 'Export/excel_null',
+ 'Export/excel_removeCRLF',
+ 'Export/excel_columns',
+ 'Export/excel_edition');
+$forms['Export']['Latex'] = array(
+ 'Export/latex_caption',
+ 'Export/latex_structure_or_data',
+ ':group:' . __('Structure'),
+ 'Export/latex_structure_caption',
+ 'Export/latex_structure_continued_caption',
+ 'Export/latex_structure_label',
+ 'Export/latex_relation',
+ 'Export/latex_comments',
+ 'Export/latex_mime',
+ ':group:end',
+ ':group:' . __('Data'),
+ 'Export/latex_columns',
+ 'Export/latex_data_caption',
+ 'Export/latex_data_continued_caption',
+ 'Export/latex_data_label',
+ 'Export/latex_null');
+$forms['Export']['Microsoft_Office'] = array(
+ ':group:' . __('Excel 97-2003 XLS Workbook'),
+ 'Export/xls_null',
+ 'Export/xls_columns',
+ ':group:end',
+ ':group:' . __('Excel 2007 XLSX Workbook'),
+ 'Export/xlsx_null',
+ 'Export/xlsx_columns',
+ ':group:end',
+ ':group:' . __('Microsoft Word 2000'),
+ 'Export/htmlword_structure_or_data',
+ 'Export/htmlword_null',
+ 'Export/htmlword_columns');
+$forms['Export']['Open_Document'] = array(
+ ':group:' . __('Open Document Spreadsheet'),
+ 'Export/ods_columns',
+ 'Export/ods_null',
+ ':group:end',
+ ':group:' . __('Open Document Text'),
+ 'Export/odt_structure_or_data',
+ ':group:' . __('Structure'),
+ 'Export/odt_relation',
+ 'Export/odt_comments',
+ 'Export/odt_mime',
+ ':group:end',
+ ':group:' . __('Data'),
+ 'Export/odt_columns',
+ 'Export/odt_null');
+$forms['Export']['Texy'] = array(
+ 'Export/texytext_structure_or_data',
+ ':group:' . __('Data'),
+ 'Export/texytext_null',
+ 'Export/texytext_columns');
+?>
\ No newline at end of file
diff --git a/setup/lib/validate.lib.php b/libraries/config/validate.lib.php
similarity index 62%
rename from setup/lib/validate.lib.php
rename to libraries/config/validate.lib.php
index c69b9f4..7c35fff 100644
--- a/setup/lib/validate.lib.php
+++ b/libraries/config/validate.lib.php
@@ -1,4 +1,5 @@
<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Various validation functions
*
@@ -9,14 +10,49 @@
* assigned to a form element (formset name or field path). Even if there are
* no errors, key must be set with an empty value.
*
- * Valdiation functions are assigned in $cfg_db['_validators'] (config_info.inc.php).
+ * Valdiation functions are assigned in $cfg_db['_validators'] (config.values.php).
*
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
+ * @package phpMyAdmin
*/
/**
+ * Returns validator list
+ *
+ * @uses ConfigFile::getDbEntry()
+ * @uses ConfigFile::getInstance()
+ * @return array
+ */
+function PMA_config_get_validators()
+{
+ static $validators = null;
+
+ if ($validators === null) {
+ $cf = ConfigFile::getInstance();
+ $validators = $cf->getDbEntry('_validators', array());
+ if (!defined('PMA_SETUP') || !PMA_SETUP) {
+ $uvs = $cf->getDbEntry('_userValidators', array());
+ foreach ($uvs as $field => $uv_list) {
+ $uv_list = (array)$uv_list;
+ foreach ($uv_list as &$uv) {
+ if (!is_array($uv)) {
+ continue;
+ }
+ for ($i = 1; $i < count($uv); $i++) {
+ if (substr($uv[$i], 0, 6) == 'value:') {
+ $uv[$i] = PMA_array_read(substr($uv[$i], 6), $GLOBALS['cfg']);
+ }
+ }
+ }
+ $validators[$field] = isset($validators[$field])
+ ? array_merge((array)$validators[$field], $uv_list)
+ : $uv_list;
+ }
+ }
+ }
+ return $validators;
+}
+
+/**
* Runs validation $validator_id on values $values and returns error list.
*
* Return values:
@@ -25,18 +61,21 @@
* cleanup in HTML documen
* o false - when no validators match name(s) given by $validator_id
*
+ * @uses ConfigFile::getCanonicalPath()
+ * @uses ConfigFile::getInstance()
+ * @uses PMA_config_get_validators()
* @param string|array $validator_id
* @param array $values
* @param bool $isPostSource tells whether $values are directly from POST request
* @return bool|array
*/
-function validate($validator_id, &$values, $isPostSource)
+function PMA_config_validate($validator_id, &$values, $isPostSource)
{
// find validators
- $cf = ConfigFile::getInstance();
$validator_id = (array) $validator_id;
- $validators = $cf->getDbEntry('_validators');
+ $validators = PMA_config_get_validators();
$vids = array();
+ $cf = ConfigFile::getInstance();
foreach ($validator_id as &$vid) {
$vid = $cf->getCanonicalPath($vid);
if (isset($validators[$vid])) {
@@ -60,18 +99,25 @@ function validate($validator_id, &$values, $isPostSource)
// validate
$result = array();
foreach ($vids as $vid) {
- $r = call_user_func($validators[$vid], $vid, $arguments);
- // merge results
- if (is_array($r)) {
- foreach ($r as $key => $error_list) {
- // skip empty values if $isPostSource is false
- if (!$isPostSource && empty($error_list)) {
- continue;
- }
- if (!isset($result[$key])) {
- $result[$key] = array();
+ // call appropriate validation functions
+ foreach ((array)$validators[$vid] as $validator) {
+ $vdef = (array) $validator;
+ $vname = array_shift($vdef);
+ $args = array_merge(array($vid, &$arguments), $vdef);
+ $r = call_user_func_array($vname, $args);
+
+ // merge results
+ if (is_array($r)) {
+ foreach ($r as $key => $error_list) {
+ // skip empty values if $isPostSource is false
+ if (!$isPostSource && empty($error_list)) {
+ continue;
+ }
+ if (!isset($result[$key])) {
+ $result[$key] = array();
+ }
+ $result[$key] = array_merge($result[$key], (array)$error_list);
}
- $result[$key] = array_merge($result[$key], (array)$error_list);
}
}
}
@@ -86,6 +132,16 @@ function validate($validator_id, &$values, $isPostSource)
}
/**
+ * Empty error handler, used to temporarily restore PHP internal error handler
+ *
+ * @return bool
+ */
+function PMA_null_error_handler()
+{
+ return false;
+}
+
+/**
* Ensures that $php_errormsg variable will be registered in case of an error
* and enables output buffering (when $start = true).
* Called with $start = false disables output buffering end restores
@@ -95,17 +151,25 @@ function validate($validator_id, &$values, $isPostSource)
*/
function test_php_errormsg($start = true)
{
- static $old_html_errors, $old_track_errors;
+ static $old_html_errors, $old_track_errors, $old_error_reporting;
+ static $old_display_errors;
if ($start) {
$old_html_errors = ini_get('html_errors');
$old_track_errors = ini_get('track_errors');
+ $old_display_errors = ini_get('display_errors');
+ $old_error_reporting = error_reporting(E_ALL);
ini_set('html_errors', false);
ini_set('track_errors', true);
+ ini_set('display_errors', true);
+ set_error_handler("PMA_null_error_handler");
ob_start();
} else {
ob_end_clean();
+ restore_error_handler();
+ error_reporting($old_error_reporting);
ini_set('html_errors', $old_html_errors);
ini_set('track_errors', $old_track_errors);
+ ini_set('display_errors', $old_display_errors);
}
}
@@ -131,14 +195,14 @@ function test_db_connection($extension, $connect_type, $host, $port, $socket, $u
if ($extension == 'mysql') {
$conn = @mysql_connect($host . $socket . $port, $user, $pass);
if (!$conn) {
- $error = PMA_lang('error_connection');
+ $error = __('Could not connect to MySQL server');
} else {
mysql_close($conn);
}
} else {
$conn = @mysqli_connect($host, $user, $pass, null, $port, $socket);
if (!$conn) {
- $error = PMA_lang('error_connection');
+ $error = __('Could not connect to MySQL server');
} else {
mysqli_close($conn);
}
@@ -153,6 +217,7 @@ function test_db_connection($extension, $connect_type, $host, $port, $socket, $u
/**
* Validate server config
*
+ * @uses test_db_connection()
* @param string $path
* @param array $values
* @return array
@@ -162,15 +227,15 @@ function validate_server($path, $values)
$result = array('Server' => '', 'Servers/1/user' => '', 'Servers/1/SignonSession' => '', 'Servers/1/SignonURL' => '');
$error = false;
if ($values['Servers/1/auth_type'] == 'config' && empty($values['Servers/1/user'])) {
- $result['Servers/1/user'] = PMA_lang('error_empty_user_for_config_auth');
+ $result['Servers/1/user'] = __('Empty username while using config authentication method');
$error = true;
}
if ($values['Servers/1/auth_type'] == 'signon' && empty($values['Servers/1/SignonSession'])) {
- $result['Servers/1/SignonSession'] = PMA_lang('error_empty_signon_session');
+ $result['Servers/1/SignonSession'] = __('Empty signon session name while using signon authentication method');
$error = true;
}
if ($values['Servers/1/auth_type'] == 'signon' && empty($values['Servers/1/SignonURL'])) {
- $result['Servers/1/SignonURL'] = PMA_lang('error_empty_signon_url');
+ $result['Servers/1/SignonURL'] = __('Empty signon URL while using signon authentication method');
$error = true;
}
@@ -187,13 +252,14 @@ function validate_server($path, $values)
/**
* Validate pmadb config
*
+ * @uses test_db_connection()
* @param string $path
* @param array $values
* @return array
*/
function validate_pmadb($path, $values)
{
- $tables = array('Servers/1/bookmarktable', 'Servers/1/relation', 'Servers/1/table_info', 'Servers/1/table_coords', 'Servers/1/pdf_pages', 'Servers/1/column_info', 'Servers/1/history', 'Servers/1/designer_coords');
+ //$tables = array('Servers/1/bookmarktable', 'Servers/1/relation', 'Servers/1/table_info', 'Servers/1/table_coords', 'Servers/1/pdf_pages', 'Servers/1/column_info', 'Servers/1/history', 'Servers/1/designer_coords');
$result = array('Server_pmadb' => '', 'Servers/1/controluser' => '', 'Servers/1/controlpass' => '');
$error = false;
@@ -203,15 +269,17 @@ function validate_pmadb($path, $values)
$result = array();
if ($values['Servers/1/controluser'] == '') {
- $result['Servers/1/controluser'] = PMA_lang('error_empty_pmadb_user');
+ $result['Servers/1/controluser'] = __('Empty phpMyAdmin control user while using pmadb');
$error = true;
}
if ($values['Servers/1/controlpass'] == '') {
- $result['Servers/1/controlpass'] = PMA_lang('error_empty_pmadb_password');
+ $result['Servers/1/controlpass'] = __('Empty phpMyAdmin control user password while using pmadb');
$error = true;
}
if (!$error) {
- $test = test_db_connection($values['Servers/1/extension'], $values['Servers/1/connect_type'], $values['Servers/1/host'], $values['Servers/1/port'], $values['Servers/1/socket'], $values['Servers/1/controluser'], $values['Servers/1/controlpass'], 'Server_pmadb');
+ $test = test_db_connection($values['Servers/1/extension'], $values['Servers/1/connect_type'],
+ $values['Servers/1/host'], $values['Servers/1/port'], $values['Servers/1/socket'],
+ $values['Servers/1/controluser'], $values['Servers/1/controlpass'], 'Server_pmadb');
if ($test !== true) {
$result = array_merge($result, $test);
}
@@ -223,6 +291,7 @@ function validate_pmadb($path, $values)
/**
* Validates regular expression
*
+ * @uses test_php_errormsg()
* @param string $path
* @param array $values
* @return array
@@ -239,7 +308,6 @@ function validate_regex($path, $values)
$matches = array();
preg_match($values[$path], '', $matches);
- ob_end_clean();
test_php_errormsg(false);
@@ -283,14 +351,14 @@ function validate_trusted_proxies($path, $values)
$matches = array();
// we catch anything that may (or may not) be an IP
if (!preg_match("/^(.+):(?:[ ]?)\\w+$/", $line, $matches)) {
- $result[$path][] = PMA_lang('error_incorrect_value') . ': ' . $line;
+ $result[$path][] = __('Incorrect value') . ': ' . $line;
continue;
}
// now let's check whether we really have an IP address
if (filter_var($matches[1], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false
&& filter_var($matches[1], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) {
$ip = htmlspecialchars(trim($matches[1]));
- $result[$path][] = PMA_lang('error_incorrect_ip_address', $ip);
+ $result[$path][] = sprintf(__('Incorrect IP address: %s'), $ip);
continue;
}
}
@@ -298,7 +366,6 @@ function validate_trusted_proxies($path, $values)
return $result;
}
-
/**
* Tests integer value
*
@@ -307,17 +374,17 @@ function validate_trusted_proxies($path, $values)
* @param bool $allow_neg allow negative values
* @param bool $allow_zero allow zero
* @param int $max_value max allowed value
- * @param string $error_lang_key error message key: $GLOBALS["strSetup$error_lang_key"]
+ * @param string $error_string error message key: $GLOBALS["strConfig$error_lang_key"]
* @return string empty string if test is successful
*/
-function test_number($path, $values, $allow_neg, $allow_zero, $max_value, $error_lang_key)
+function test_number($path, $values, $allow_neg, $allow_zero, $max_value, $error_string)
{
if ($values[$path] === '') {
return '';
}
if (intval($values[$path]) != $values[$path] || (!$allow_neg && $values[$path] < 0) || (!$allow_zero && $values[$path] == 0) || $values[$path] > $max_value) {
- return PMA_lang($error_lang_key);
+ return $error_string;
}
return '';
@@ -326,36 +393,68 @@ function test_number($path, $values, $allow_neg, $allow_zero, $max_value, $error
/**
* Validates port number
*
+ * @uses test_number()
* @param string $path
* @param array $values
* @return array
*/
function validate_port_number($path, $values)
{
- return array($path => test_number($path, $values, false, false, 65536, 'error_incorrect_port'));
+ return array($path => test_number($path, $values, false, false, 65535, __('Not a valid port number')));
}
/**
* Validates positive number
*
+ * @uses test_number()
* @param string $path
* @param array $values
* @return array
*/
function validate_positive_number($path, $values)
{
- return array($path => test_number($path, $values, false, false, PHP_INT_MAX, 'error_nan_p'));
+ return array($path => test_number($path, $values, false, false, PHP_INT_MAX, __('Not a positive number')));
}
/**
* Validates non-negative number
*
+ * @uses test_number()
* @param string $path
* @param array $values
* @return array
*/
function validate_non_negative_number($path, $values)
{
- return array($path => test_number($path, $values, false, true, PHP_INT_MAX, 'error_nan_nneg'));
+ return array($path => test_number($path, $values, false, true, PHP_INT_MAX, __('Not a non-negative number')));
+}
+
+/**
+ * Validates value according to given regular expression
+ * Pattern and modifiers must be a valid for PCRE <b>and</b> JavaScript RegExp
+ *
+ * @param string $path
+ * @param array $values
+ * @param string $regex
+ * @return void
+ */
+function validate_by_regex($path, $values, $regex)
+{
+ $result = preg_match($regex, $values[$path]);
+ return array($path => ($result ? '' : __('Incorrect value')));
+}
+
+/**
+ * Validates upper bound for numeric inputs
+ *
+ * @param string $path
+ * @param array $values
+ * @param int $max_value
+ * @return array
+ */
+function validate_upper_bound($path, $values, $max_value)
+{
+ $result = $values[$path] <= $max_value;
+ return array($path => ($result ? '' : sprintf(__('Value must be equal or lower than %s'), $max_value)));
}
-?>
+?>
\ No newline at end of file
diff --git a/libraries/core.lib.php b/libraries/core.lib.php
index 8bfc035..97d443a 100644
--- a/libraries/core.lib.php
+++ b/libraries/core.lib.php
@@ -574,4 +574,89 @@ function PMA_sendHeaderLocation($uri)
}
}
}
+
+/**
+ * Returns value of an element in $array given by $path.
+ * $path is a string describing position of an element in an associative array,
+ * eg. Servers/1/host refers to $array[Servers][1][host]
+ *
+ * @param string $path
+ * @param array $array
+ * @param mixed $default
+ * @return mixed array element or $default
+ */
+function PMA_array_read($path, $array, $default = null)
+{
+ $keys = explode('/', $path);
+ $value =& $array;
+ foreach ($keys as $key) {
+ if (!isset($value[$key])) {
+ return $default;
+ }
+ $value =& $value[$key];
+ }
+ return $value;
+}
+
+/**
+ * Stores value in an array
+ *
+ * @param string $path
+ * @param array &$array
+ * @param mixed $value
+ */
+function PMA_array_write($path, &$array, $value)
+{
+ $keys = explode('/', $path);
+ $last_key = array_pop($keys);
+ $a =& $array;
+ foreach ($keys as $key) {
+ if (!isset($a[$key])) {
+ $a[$key] = array();
+ }
+ $a =& $a[$key];
+ }
+ $a[$last_key] = $value;
+}
+
+/**
+ * Removes value from an array
+ *
+ * @param string $path
+ * @param array &$array
+ * @param mixed $value
+ */
+function PMA_array_remove($path, &$array)
+{
+ $keys = explode('/', $path);
+ $keys_last = array_pop($keys);
+ $path = array();
+ $depth = 0;
+
+ $path[0] =& $array;
+ $found = true;
+ // go as deep as required or possible
+ foreach ($keys as $key) {
+ if (!isset($path[$depth][$key])) {
+ $found = false;
+ break;
+ }
+ $depth++;
+ $path[$depth] =& $path[$depth-1][$key];
+ }
+ // if element found, remove it
+ if ($found) {
+ unset($path[$depth][$keys_last]);
+ $depth--;
+ }
+
+ // remove empty nested arrays
+ for (; $depth >= 0; $depth--) {
+ if (!isset($path[$depth+1]) || count($path[$depth+1]) == 0) {
+ unset($path[$depth][$keys[$depth]]);
+ } else {
+ break;
+ }
+ }
+}
?>
diff --git a/libraries/db_links.inc.php b/libraries/db_links.inc.php
index 0dfa5a8..7eaf343 100644
--- a/libraries/db_links.inc.php
+++ b/libraries/db_links.inc.php
@@ -102,21 +102,23 @@ $tabs = array();
$tabs[] =& $tab_structure;
$tabs[] =& $tab_sql;
$tabs[] =& $tab_search;
-if (PMA_Tracker::isActive()) {
- $tabs[] =& $tab_tracking;
-}
$tabs[] =& $tab_qbe;
$tabs[] =& $tab_export;
if (! $db_is_information_schema) {
$tabs[] =& $tab_import;
- if ($cfgRelation['designerwork']) {
- $tabs[] =& $tab_designer;
- }
$tabs[] =& $tab_operation;
if ($is_superuser) {
$tabs[] =& $tab_privileges;
}
}
+if (PMA_Tracker::isActive()) {
+ $tabs[] =& $tab_tracking;
+}
+if (! $db_is_information_schema) {
+ if ($cfgRelation['designerwork']) {
+ $tabs[] =& $tab_designer;
+ }
+}
$url_params['db'] = $db;
diff --git a/libraries/display_export.lib.php b/libraries/display_export.lib.php
index 62641f3..ad52bac 100644
--- a/libraries/display_export.lib.php
+++ b/libraries/display_export.lib.php
@@ -69,7 +69,7 @@ if(isset($_GET['export_method'])) {
$cfg['Export']['method'] = 'quick';
}
// The export method (quick, custom or custom-no-form)
-echo '<input type="hidden" name="export_method" value="' . $cfg['Export']['method'] . '" />';
+echo '<input type="hidden" name="export_method" value="' . htmlspecialchars($cfg['Export']['method']) . '" />';
if(isset($_GET['sql_query'])) {
@@ -255,23 +255,17 @@ if(isset($_GET['sql_query'])) {
echo $_GET['filename_template'];
} else {
if ($export_type == 'database') {
- if (isset($_COOKIE) && !empty($_COOKIE['pma_db_filename_template'])) {
- echo htmlspecialchars($_COOKIE['pma_db_filename_template']);
- } else {
- echo $GLOBALS['cfg']['Export']['file_template_database'];
- }
+ echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
+ 'pma_db_filename_template',
+ $GLOBALS['cfg']['Export']['file_template_database']));
} elseif ($export_type == 'table') {
- if (isset($_COOKIE) && !empty($_COOKIE['pma_table_filename_template'])) {
- echo htmlspecialchars($_COOKIE['pma_table_filename_template']);
- } else {
- echo $GLOBALS['cfg']['Export']['file_template_table'];
- }
+ echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
+ 'pma_table_filename_template',
+ $GLOBALS['cfg']['Export']['file_template_table']));
} else {
- if (isset($_COOKIE) && !empty($_COOKIE['pma_server_filename_template'])) {
- echo htmlspecialchars($_COOKIE['pma_server_filename_template']);
- } else {
- echo $GLOBALS['cfg']['Export']['file_template_server'];
- }
+ echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
+ 'pma_server_filename_template',
+ $GLOBALS['cfg']['Export']['file_template_server']));
}
}
echo '"';
diff --git a/libraries/export/sql.php b/libraries/export/sql.php
index 2d6708d..ade857f 100644
--- a/libraries/export/sql.php
+++ b/libraries/export/sql.php
@@ -109,7 +109,7 @@ if (isset($plugin_list)) {
/* begin CREATE TABLE statements*/
$plugin_list['sql']['options'][] =
array('type' => 'begin_subgroup', 'subgroup_header' => array('type' => 'bool', 'name' => 'create_table_statements', 'text' => __('<code>CREATE TABLE</code> options:')));
- $plugin_list['sql']['options'][] =
+ $plugin_list['sql']['options'][] =
array('type' => 'bool', 'name' => 'if_not_exists', 'text' => '<code>IF NOT EXISTS</code>');
$plugin_list['sql']['options'][] =
array('type' => 'bool', 'name' => 'auto_increment', 'text' => '<code>AUTO_INCREMENT</code>');
diff --git a/libraries/footer.inc.php b/libraries/footer.inc.php
index 715cf3b..dfa7ab9 100644
--- a/libraries/footer.inc.php
+++ b/libraries/footer.inc.php
@@ -115,7 +115,15 @@ if (window.parent.refreshNavigation) {
window.parent.refreshNavigation();
}
<?php
+ } else if (isset($_GET['reload_left_frame']) && $_GET['reload_left_frame'] == '1') {
+ // reload left frame (used by user preferences)
+ ?>
+ if (window.parent && window.parent.frame_navigation) {
+ window.parent.frame_navigation.location.reload();
+ }
+ <?php
}
+
?>
// set current db, table and sql query in the querywindow
if (window.parent.reload_querywindow) {
diff --git a/libraries/header.inc.php b/libraries/header.inc.php
index c6f7107..ea159a3 100644
--- a/libraries/header.inc.php
+++ b/libraries/header.inc.php
@@ -21,6 +21,14 @@ if (empty($GLOBALS['is_header_sent'])) {
require_once './libraries/ob.lib.php';
PMA_outBufferPre();
+ // if database storage for user preferences is transient, offer to load
+ // exported settings from localStorage (detection will be done in JavaScript)
+ $userprefs_offer_import = $GLOBALS['PMA_Config']->get('user_preferences') == 'session'
+ && !isset($_SESSION['userprefs_autoload']);
+ if ($userprefs_offer_import) {
+ $GLOBALS['js_include'][] = 'config.js';
+ }
+
// For re-usability, moved http-headers and stylesheets
// to a seperate file. It can now be included by header.inc.php,
// querywindow.php.
@@ -58,6 +66,12 @@ if (empty($GLOBALS['is_header_sent'])) {
PMA_Message::notice(__('Cookies must be enabled past this point.'))->display();
}
+ // offer to load user preferences from localStorage
+ if ($userprefs_offer_import) {
+ require_once './libraries/user_preferences.lib.php';
+ PMA_userprefs_autoload_header();
+ }
+
if (!defined('PMA_DISPLAY_HEADING')) {
define('PMA_DISPLAY_HEADING', 1);
}
diff --git a/libraries/header_meta_style.inc.php b/libraries/header_meta_style.inc.php
index 55e7991..46cca27 100644
--- a/libraries/header_meta_style.inc.php
+++ b/libraries/header_meta_style.inc.php
@@ -53,7 +53,7 @@ if ($GLOBALS['text_dir'] == 'ltr') {
<?php
}
?>
- <link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
+ <link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>phpmyadmin.css.php<?php echo PMA_generate_common_url(array('server' => $GLOBALS['server'])); ?>&js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>print.css" media="print" />
<link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['pmaThemePath']; ?>/jquery/jquery-ui-1.8.custom.css" />
<meta name="robots" content="noindex,nofollow" />
diff --git a/libraries/header_scripts.inc.php b/libraries/header_scripts.inc.php
index 94aff1a..8126dd3 100644
--- a/libraries/header_scripts.inc.php
+++ b/libraries/header_scripts.inc.php
@@ -59,7 +59,7 @@ foreach ($GLOBALS['js_include'] as $js_script_file) {
// Updates the title of the frameset if possible (ns4 does not allow this)
if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
&& typeof(parent.document.title) == 'string') {
- parent.document.title = '<?php echo PMA_sanitize(PMA_escapeJsString($title)); ?>';
+ parent.document.title = '<?php echo PMA_sanitize(PMA_escapeJsString(htmlspecialchars($title))); ?>';
}
<?php
diff --git a/libraries/navigation_header.inc.php b/libraries/navigation_header.inc.php
index d6cb383..6c5b266 100644
--- a/libraries/navigation_header.inc.php
+++ b/libraries/navigation_header.inc.php
@@ -29,22 +29,26 @@ if ($GLOBALS['cfg']['LeftDisplayLogo']) {
.'alt="' . $logo . '" id="imgpmalogo" />';
}
- echo '<div id="pmalogo">' . "\n"
- .'<a href="' . $GLOBALS['cfg']['LeftLogoLink'];
- switch ($GLOBALS['cfg']['LeftLogoLinkWindow']) {
- case 'new':
- echo '" target="_blank"';
- break;
- case 'main':
- // do not add our parameters for an external link
- if (substr(strtolower($GLOBALS['cfg']['LeftLogoLink']), 0, 4) !== 'http') {
- echo '?' . $query_url . '" target="frame_content"';
- } else {
- echo '"';
- }
+ echo '<div id="pmalogo">' . "\n";
+ if ($GLOBALS['cfg']['LeftLogoLink']) {
+ echo '<a href="' . htmlspecialchars($GLOBALS['cfg']['LeftLogoLink']);
+ switch ($GLOBALS['cfg']['LeftLogoLinkWindow']) {
+ case 'new':
+ echo '" target="_blank"';
+ break;
+ case 'main':
+ // do not add our parameters for an external link
+ if (substr(strtolower($GLOBALS['cfg']['LeftLogoLink']), 0, 4) !== '://') {
+ echo '?' . $query_url . '" target="frame_content"';
+ } else {
+ echo '" target="_blank"';
+ }
+ }
+ echo '>' . $logo . '</a>' . "\n";
+ } else {
+ echo $logo . "\n";
}
- echo '>' . $logo . '</a>' . "\n"
- .'</div>' . "\n";
+ echo '</div>' . "\n";
} // end of display logo
?>
<div id="leftframelinks">
diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php
index e6ebdc5..74800fe 100644
--- a/libraries/relation.lib.php
+++ b/libraries/relation.lib.php
@@ -136,6 +136,10 @@ function PMA_printRelationsParamDiagnostic($cfgRelation)
PMA_printDiagMessageForFeature(__('Tracking'), 'trackingwork', $messages);
+ PMA_printDiagMessageForParameter('userconfig', isset($cfgRelation['userconfig']), $messages, 'userconfig');
+
+ PMA_printDiagMessageForFeature(__('User preferences'), 'userconfigwork', $messages);
+
echo '</table>' . "\n";
echo '<p>' . __('Quick steps to setup advanced features:') . '</p>';
@@ -212,6 +216,7 @@ function PMA__getRelationsParam()
$cfgRelation['historywork'] = false;
$cfgRelation['trackingwork'] = false;
$cfgRelation['designerwork'] = false;
+ $cfgRelation['userconfigwork'] = false;
$cfgRelation['allworks'] = false;
$cfgRelation['user'] = null;
$cfgRelation['db'] = null;
@@ -262,6 +267,8 @@ function PMA__getRelationsParam()
$cfgRelation['history'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['tracking']) {
$cfgRelation['tracking'] = $curr_table[0];
+ } elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['userconfig']) {
+ $cfgRelation['userconfig'] = $curr_table[0];
}
} // end while
PMA_DBI_free_result($tab_rs);
@@ -316,6 +323,10 @@ function PMA__getRelationsParam()
$cfgRelation['trackingwork'] = true;
}
+ if (isset($cfgRelation['userconfig'])) {
+ $cfgRelation['userconfigwork'] = true;
+ }
+
// we do not absolutely need that the internal relations or the PDF
// schema feature be activated
if (isset($cfgRelation['designer_coords'])) {
@@ -329,7 +340,7 @@ function PMA__getRelationsParam()
if ($cfgRelation['relwork'] && $cfgRelation['displaywork']
&& $cfgRelation['pdfwork'] && $cfgRelation['commwork']
&& $cfgRelation['mimework'] && $cfgRelation['historywork']
- && $cfgRelation['trackingwork']
+ && $cfgRelation['trackingwork'] && $cfgRelation['userconfigwork']
&& $cfgRelation['bookmarkwork'] && $cfgRelation['designerwork']) {
$cfgRelation['allworks'] = true;
}
diff --git a/libraries/server_links.inc.php b/libraries/server_links.inc.php
index c5d384f..5cd7a67 100644
--- a/libraries/server_links.inc.php
+++ b/libraries/server_links.inc.php
@@ -47,6 +47,29 @@ $tabs['status']['icon'] = 's_status.png';
$tabs['status']['link'] = 'server_status.php';
$tabs['status']['text'] = __('Status');
+if (! empty($binary_logs)) {
+ $tabs['binlog']['icon'] = 's_tbl.png';
+ $tabs['binlog']['link'] = 'server_binlog.php';
+ $tabs['binlog']['text'] = __('Binary log');
+}
+$tabs['process']['icon'] = 's_process.png';
+$tabs['process']['link'] = 'server_processlist.php';
+$tabs['process']['text'] = __('Processes');
+
+if ($is_superuser) {
+ $tabs['rights']['icon'] = 's_rights.png';
+ $tabs['rights']['link'] = 'server_privileges.php';
+ $tabs['rights']['text'] = __('Privileges');
+}
+
+$tabs['export']['icon'] = 'b_export.png';
+$tabs['export']['link'] = 'server_export.php';
+$tabs['export']['text'] = __('Export');
+
+$tabs['import']['icon'] = 'b_import.png';
+$tabs['import']['link'] = 'server_import.php';
+$tabs['import']['text'] = __('Import');
+
$tabs['vars']['icon'] = 's_vars.png';
$tabs['vars']['link'] = 'server_variables.php';
$tabs['vars']['text'] = __('Variables');
@@ -60,36 +83,21 @@ $tabs['engine']['link'] = 'server_engines.php';
$tabs['engine']['text'] = __('Engines');
if ($is_superuser) {
- $tabs['rights']['icon'] = 's_rights.png';
- $tabs['rights']['link'] = 'server_privileges.php';
- $tabs['rights']['text'] = __('Privileges');
-
$tabs['replication']['icon'] = 's_replication.png';
$tabs['replication']['link'] = 'server_replication.php';
$tabs['replication']['text'] = __('Replication');
}
-if (! empty($binary_logs)) {
- $tabs['binlog']['icon'] = 's_tbl.png';
- $tabs['binlog']['link'] = 'server_binlog.php';
- $tabs['binlog']['text'] = __('Binary log');
-}
-$tabs['process']['icon'] = 's_process.png';
-$tabs['process']['link'] = 'server_processlist.php';
-$tabs['process']['text'] = __('Processes');
-
-$tabs['export']['icon'] = 'b_export.png';
-$tabs['export']['link'] = 'server_export.php';
-$tabs['export']['text'] = __('Export');
-
-$tabs['import']['icon'] = 'b_import.png';
-$tabs['import']['link'] = 'server_import.php';
-$tabs['import']['text'] = __('Import');
-
$tabs['synchronize']['icon'] = 's_sync.png';
$tabs['synchronize']['link'] = 'server_synchronize.php';
$tabs['synchronize']['text'] = __('Synchronize');
+$tabs['settings']['icon'] = 'b_tblops.png';
+$tabs['settings']['link'] = 'prefs_manage.php';
+$tabs['settings']['text'] = __('Settings');
+$tabs['settings']['active'] = in_array(basename($GLOBALS['PMA_PHP_SELF']),
+ array('prefs_forms.php', 'prefs_manage.php'));
+
echo PMA_generate_html_tabs($tabs, array());
unset($tabs);
diff --git a/libraries/tbl_links.inc.php b/libraries/tbl_links.inc.php
index 22789f3..bc72d21 100644
--- a/libraries/tbl_links.inc.php
+++ b/libraries/tbl_links.inc.php
@@ -61,13 +61,6 @@ $tabs['search']['icon'] = 'b_search.png';
$tabs['search']['text'] = __('Search');
$tabs['search']['link'] = 'tbl_select.php';
-if(PMA_Tracker::isActive())
-{
- $tabs['tracking']['icon'] = 'eye.png';
- $tabs['tracking']['text'] = __('Tracking');
- $tabs['tracking']['link'] = 'tbl_tracking.php';
-}
-
if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
$tabs['insert']['icon'] = 'b_insrow.png';
$tabs['insert']['link'] = 'tbl_change.php';
@@ -92,6 +85,13 @@ if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_
$tabs['operation']['link'] = 'tbl_operations.php';
$tabs['operation']['text'] = __('Operations');
}
+if(PMA_Tracker::isActive()) {
+ $tabs['tracking']['icon'] = 'eye.png';
+ $tabs['tracking']['text'] = __('Tracking');
+ $tabs['tracking']['link'] = 'tbl_tracking.php';
+}
+if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema)) {
+}
/**
* Views support a limited number of operations
diff --git a/libraries/user_preferences.inc.php b/libraries/user_preferences.inc.php
new file mode 100644
index 0000000..b86e4a1
--- /dev/null
+++ b/libraries/user_preferences.inc.php
@@ -0,0 +1,72 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Common header for user preferences pages
+ *
+ * @package phpMyAdmin
+ */
+if (!defined('PHPMYADMIN')) {
+ exit;
+}
+
+// show server tabs
+require './libraries/server_links.inc.php';
+
+// build user preferences menu
+
+$form_param = filter_input(INPUT_GET, 'form');
+if (!isset($forms[$form_param])) {
+ $forms_keys = array_keys($forms);
+ $form_param = array_shift($forms_keys);
+}
+$tabs_icons = array(
+ 'Features' => 'b_tblops.png',
+ 'Sql_queries' => 'b_sql.png',
+ 'Left_frame' => 'b_select.png',
+ 'Main_frame' => 'b_props.png',
+ 'Import' => 'b_import.png',
+ 'Export' => 'b_export.png');
+echo '<ul id="topmenu2">';
+echo PMA_generate_html_tab(array(
+ 'link' => 'prefs_manage.php',
+ 'text' => __('Manage your settings'))) . "\n";
+echo '<li> </li>' . "\n";
+$script_name = basename($GLOBALS['PMA_PHP_SELF']);
+foreach (array_keys($forms) as $formset) {
+ $tab = array(
+ 'link' => 'prefs_forms.php',
+ 'text' => PMA_lang('Form_' . $formset),
+ 'icon' => $tabs_icons[$formset],
+ 'active' => ($script_name == 'prefs_forms.php' && $formset == $form_param));
+ echo PMA_generate_html_tab($tab, array('form' => $formset)) . "\n";
+}
+echo '</ul><div class="clearfloat"></div>';
+
+// show "configuration saved" message and reload navigation frame if needed
+if (!empty($_GET['saved'])) {
+ $message = PMA_Message::rawSuccess(__('Configuration has been saved'));
+ $message->display();
+}
+
+// debug info
+if ($cfg['DBG']['php']) {
+ $arr = ConfigFile::getInstance()->getConfigArray();
+ $arr2 = array();
+ foreach ($arr as $k => $v) {
+ $arr2[] = "<b>$k</b> " . var_export($v, true);
+ }
+ $arr2 = implode(', ', $arr2);
+ $arr2 .= '<br />Blacklist: ' . (empty($cfg['UserprefsDisallow'])
+ ? '<i>empty</i>'
+ : implode(', ', $cfg['UserprefsDisallow']));
+ $msg = PMA_Message::notice('Settings: ' . $arr2);
+ $msg->display();
+}
+
+// warn about using session storage for settings
+$cfgRelation = PMA_getRelationsParam();
+if (!$cfgRelation['userconfigwork']) {
+ $msg = __('Your preferences will be saved for current session only. Storing them permanently requires %sphpMyAdmin configuration storage%s.');
+ $msg = PMA_sanitize(sprintf($msg, '[a@./Documentation.html#linked-tables@_blank]', '[/a]'));
+ PMA_Message::notice($msg)->display();
+}
diff --git a/libraries/user_preferences.lib.php b/libraries/user_preferences.lib.php
new file mode 100644
index 0000000..c513a19
--- /dev/null
+++ b/libraries/user_preferences.lib.php
@@ -0,0 +1,316 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Functions for displaying user preferences pages
+ *
+ * @package phpMyAdmin
+ */
+
+/**
+ * Common initialization for user preferences modification pages
+ *
+ * @uses ConfigFile::getInstance()
+ * @uses ConfigFile::resetConfigData()
+ * @uses ConfigFile::setAllowedKeys()
+ * @uses ConfigFile::setCfgUpdateReadMapping()
+ * @uses ConfigFile::updateWithGlobalConfig()
+ * @uses PMA_read_userprefs_fieldnames()
+ */
+function PMA_userprefs_pageinit()
+{
+ $forms_all_keys = PMA_read_userprefs_fieldnames($GLOBALS['forms']);
+ $cf = ConfigFile::getInstance();
+ $cf->resetConfigData(); // start with a clean instance
+ $cf->setAllowedKeys($forms_all_keys);
+ $cf->setCfgUpdateReadMapping(array(
+ 'Server/hide_db' => 'Servers/1/hide_db',
+ 'Server/only_db' => 'Servers/1/only_db'));
+ $cf->updateWithGlobalConfig($GLOBALS['cfg']);
+}
+
+/**
+ * Loads user preferences
+ *
+ * Returns an array:
+ * * config_data - path => value pairs
+ * * mtime - last modification time
+ * * type - 'db' (config read from pmadb) or 'session' (read from user session)
+ *
+ * @uses $_SESSION['userconfig']
+ * @uses $GLOBALS['controllink']
+ * @uses PMA_array_merge_recursive
+ * @uses PMA_backquote()
+ * @uses PMA_DBI_fetch_single_row()
+ * @uses PMA_getRelationsParam()
+ * @uses PMA_sqlAddslashes()
+ * @uses $GLOBALS['controllink']
+ * @return array
+ */
+function PMA_load_userprefs()
+{
+ $cfgRelation = PMA_getRelationsParam();
+ if (!$cfgRelation['userconfigwork']) {
+ // no pmadb table, use session storage
+ if (!isset($_SESSION['userconfig'])) {
+ $_SESSION['userconfig'] = array(
+ 'db' => array(),
+ 'ts' => time());
+ }
+ return array(
+ 'config_data' => $_SESSION['userconfig']['db'],
+ 'mtime' => $_SESSION['userconfig']['ts'],
+ 'type' => 'session');
+ }
+ // load configuration from pmadb
+ $query_table = PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['userconfig']);
+ $query = '
+ SELECT `config_data`, UNIX_TIMESTAMP(`timevalue`) ts
+ FROM ' . $query_table . '
+ WHERE `username` = \'' . PMA_sqlAddslashes($cfgRelation['user']) . '\'';
+ $row = PMA_DBI_fetch_single_row($query, 'ASSOC', $GLOBALS['controllink']);
+ return array(
+ 'config_data' => $row ? unserialize($row['config_data']) : array(),
+ 'mtime' => $row ? $row['ts'] : time(),
+ 'type' => 'db');
+}
+
+/**
+ * Saves user preferences
+ *
+ * @uses $_SESSION['cache'][...]['userprefs']
+ * @uses $_SESSION['userconfig']
+ * @uses $GLOBALS['cfg']['ServerDefault']
+ * @uses $GLOBALS['controllink']
+ * @uses $GLOBALS['server']
+ * @uses ConfigFile::getConfigArray()
+ * @uses ConfigFile::getInstance()
+ * @uses PMA_backquote()
+ * @uses PMA_DBI_fetch_value
+ * @uses PMA_DBI_getError()
+ * @uses PMA_DBI_try_query()
+ * @uses PMA_Message::addMessage()
+ * @uses PMA_Message::error()
+ * @uses PMA_Message::rawError()
+ * @uses PMA_sqlAddslashes()
+ * @uses PMA_getRelationsParam()
+ * @param array $config_data
+ * @return true|PMA_Message
+ */
+function PMA_save_userprefs(array $config_array)
+{
+ $cfgRelation = PMA_getRelationsParam();
+ $server = isset($GLOBALS['server'])
+ ? $GLOBALS['server']
+ : $GLOBALS['cfg']['ServerDefault'];
+ $cache_key = 'server_' . $server;
+ if (!$cfgRelation['userconfigwork']) {
+ // no pmadb table, use session storage
+ $_SESSION['userconfig'] = array(
+ 'db' => $config_array,
+ 'ts' => time());
+ if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
+ unset($_SESSION['cache'][$cache_key]['userprefs']);
+ }
+ return true;
+ }
+
+ // save configuration to pmadb
+ $query_table = PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['userconfig']);
+ $query = '
+ SELECT `username`
+ FROM ' . $query_table . '
+ WHERE `username` = \'' . PMA_sqlAddslashes($cfgRelation['user']) . '\'';
+
+ $has_config = PMA_DBI_fetch_value($query, 0, 0, $GLOBALS['controllink']);
+ $config_data = serialize($config_array);
+ if ($has_config) {
+ $query = '
+ UPDATE ' . $query_table . '
+ SET `config_data` = \'' . PMA_sqlAddslashes($config_data) . '\'
+ WHERE `username` = \'' . PMA_sqlAddslashes($cfgRelation['user']) . '\'';
+ } else {
+ $query = '
+ INSERT INTO ' . $query_table . ' (`username`, `config_data`)
+ VALUES (\'' . PMA_sqlAddslashes($cfgRelation['user']) . '\',
+ \'' . PMA_sqlAddslashes($config_data) . '\')';
+ }
+ if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
+ unset($_SESSION['cache'][$cache_key]['userprefs']);
+ }
+ if (!PMA_DBI_try_query($query, $GLOBALS['controllink'])) {
+ $message = PMA_Message::error(__('Could not save configuration'));
+ $message->addMessage('<br /><br />');
+ $message->addMessage(PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink'])));
+ return $message;
+ }
+ return true;
+}
+
+/**
+ * Returns a user preferences array filtered by $cfg['UserprefsDisallow']
+ * (blacklist) and keys from user preferences form (whitelist)
+ *
+ * @uses PMA_array_write()
+ * @uses PMA_read_userprefs_fieldnames()
+ * @param array $config_data path => value pairs
+ * @return array
+ */
+function PMA_apply_userprefs(array $config_data)
+{
+ $cfg = array();
+ $blacklist = array_flip($GLOBALS['cfg']['UserprefsDisallow']);
+ if (!$GLOBALS['cfg']['UserprefsDeveloperTab']) {
+ // disallow everything in the Developers tab
+ $blacklist['Error_Handler/display'] = true;
+ $blacklist['Error_Handler/gather'] = true;
+ $blacklist['DBG/sql'] = true;
+ $blacklist['DBG/php'] = true;
+ }
+ $whitelist = array_flip(PMA_read_userprefs_fieldnames());
+ // whitelist some additional fields which are custom handled
+ $whitelist['ThemeDefault'] = true;
+ $whitelist['fontsize'] = true;
+ $whitelist['lang'] = true;
+ $whitelist['collation_connection'] = true;
+ $whitelist['Server/hide_db'] = true;
+ $whitelist['Server/only_db'] = true;
+ foreach ($config_data as $path => $value) {
+ if (!isset($whitelist[$path]) || isset($blacklist[$path])) {
+ continue;
+ }
+ PMA_array_write($path, $cfg, $value);
+ }
+ return $cfg;
+}
+
+/**
+ * Reads user preferences field names
+ *
+ * @param array|null $forms
+ * @return array
+ */
+function PMA_read_userprefs_fieldnames(array $forms = null)
+{
+ static $names;
+
+ // return cached results
+ if ($names !== null) {
+ return $names;
+ }
+ if (is_null($forms)) {
+ $forms = array();
+ include 'libraries/config/user_preferences.forms.php';
+ }
+ $names = array();
+ foreach ($forms as $formset) {
+ foreach ($formset as $form) {
+ foreach ($form as $k => $v) {
+ $names[] = is_int($k) ? $v : $k;
+ }
+ }
+ }
+ return $names;
+}
+
+/**
+ * Updates one user preferences option (loads and saves to database).
+ *
+ * No validation is done!
+ *
+ * @uses PMA_load_userprefs()
+ * @uses PMA_save_userprefs()
+ * @param string $cfg_name
+ * @param mixed $value
+ * @return void
+ */
+function PMA_persist_option($path, $value, $default_value)
+{
+ $prefs = PMA_load_userprefs();
+ if ($value === $default_value) {
+ if (isset($prefs['config_data'][$path])) {
+ unset($prefs['config_data'][$path]);
+ } else {
+ return;
+ }
+ } else {
+ $prefs['config_data'][$path] = $value;
+ }
+ PMA_save_userprefs($prefs['config_data']);
+}
+
+/**
+ * Redirects after saving new user preferences
+ *
+ * @uses ConfigFile::getConfigArray()
+ * @uses ConfigFile::getInstance()
+ * @uses PMA_generate_common_url()
+ * @uses PMA_sendHeaderLocation()
+ * @param array $forms
+ * @param array $old_settings
+ * @param string $file_name
+ * @param array $params
+ * @param string $hash
+ */
+function PMA_userprefs_redirect(array $forms, array $old_settings, $file_name, $params = null, $hash = null)
+{
+ $reload_left_frame = isset($params['reload_left_frame']) && $params['reload_left_frame'];
+ if (!$reload_left_frame) {
+ // compute differences and check whether left frame should be refreshed
+ $old_settings = isset($old_settings['config_data'])
+ ? $old_settings['config_data']
+ : array();
+ $new_settings = ConfigFile::getInstance()->getConfigArray();
+ $diff_keys = array_keys(array_diff_assoc($old_settings, $new_settings)
+ + array_diff_assoc($new_settings, $old_settings));
+ $check_keys = array('NaturalOrder', 'MainPageIconic', 'DefaultTabDatabase',
+ 'Server/hide_db', 'Server/only_db');
+ $check_keys = array_merge($check_keys, $forms['Left_frame']['Left_frame'],
+ $forms['Left_frame']['Left_databases']);
+ $diff = array_intersect($check_keys, $diff_keys);
+ $reload_left_frame = !empty($diff);
+ }
+
+ // redirect
+ $url_params = array(
+ 'saved' => 1,
+ 'reload_left_frame' => $reload_left_frame);
+ if (is_array($params)) {
+ $url_params = array_merge($params, $url_params);
+ }
+ if ($hash) {
+ $hash = '#' . urlencode($hash);
+ }
+ PMA_sendHeaderLocation($GLOBALS['cfg']['PmaAbsoluteUri'] . $file_name
+ . PMA_generate_common_url($url_params, '&') . $hash);
+}
+
+/**
+ * Shows form which allows to quickly load settings stored in browser's local storage
+ *
+ * @uses $_REQUEST['prefs_autoload']
+ * @uses $_SESSION['userprefs_autoload']
+ * @uses PMA_generate_common_hidden_inputs()
+ */
+function PMA_userprefs_autoload_header()
+{
+ if (isset($_REQUEST['prefs_autoload']) && $_REQUEST['prefs_autoload'] == 'hide') {
+ $_SESSION['userprefs_autoload'] = true;
+ exit;
+ }
+ $script_name = basename(basename($GLOBALS['PMA_PHP_SELF']));
+ $return_url = $script_name . '?' . http_build_query($_GET, '', '&');
+ ?>
+ <div id="prefs_autoload" class="notice" style="display:none">
+ <form action="prefs_manage.php" method="post">
+ <?php echo PMA_generate_common_hidden_inputs() . "\n"; ?>
+ <input type="hidden" name="json" value="" />
+ <input type="hidden" name="submit_import" value="1" />
+ <input type="hidden" name="return_url" value="<?php echo htmlspecialchars($return_url) ?>" />
+ <?php echo __('Your browser has phpMyAdmin configuration for this domain. Would you like to import it for current session?') ?>
+ <br />
+ <a href="#yes"><?php echo __('Yes') ?></a> / <a href="#no"><?php echo __('No') ?></a>
+ </form>
+ </div>
+ <?php
+}
+?>
\ No newline at end of file
diff --git a/main.php b/main.php
index f81b0e4..3feefe5 100644
--- a/main.php
+++ b/main.php
@@ -143,6 +143,14 @@ echo PMA_Config::getFontsizeForm();
echo '</li>';
echo '</ul>';
+
+// User preferences
+
+echo '<ul>';
+echo PMA_printListItem(__('More settings'), 'li_user_preferences',
+ './prefs_manage.php?' . $common_url_query);
+echo '<ul>';
+
echo '</div>';
diff --git a/prefs_forms.php b/prefs_forms.php
new file mode 100644
index 0000000..40ea171
--- /dev/null
+++ b/prefs_forms.php
@@ -0,0 +1,89 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * User preferences page
+ *
+ * @package phpMyAdmin
+ */
+
+/**
+ * Gets some core libraries and displays a top message if required
+ */
+require_once './libraries/common.inc.php';
+require_once './libraries/user_preferences.lib.php';
+require_once './libraries/config/config_functions.lib.php';
+require_once './libraries/config/messages.inc.php';
+require_once './libraries/config/ConfigFile.class.php';
+require_once './libraries/config/Form.class.php';
+require_once './libraries/config/FormDisplay.class.php';
+require './libraries/config/user_preferences.forms.php';
+
+PMA_userprefs_pageinit();
+
+// handle form processing
+
+$form_param = filter_input(INPUT_GET, 'form');
+if (!isset($forms[$form_param])) {
+ $forms_keys = array_keys($forms);
+ $form_param = array_shift($forms_keys);
+}
+
+$form_display = new FormDisplay();
+foreach ($forms[$form_param] as $form_name => $form) {
+ // skip Developer form if no setting is available
+ if ($form_name == 'Developer' && !$GLOBALS['cfg']['UserprefsDeveloperTab']) {
+ continue;
+ }
+ $form_display->registerForm($form_name, $form, 1);
+}
+
+if (isset($_POST['revert'])) {
+ // revert erroneous fields to their default values
+ $form_display->fixErrors();
+ // redirect
+ $url_params = array('form' => $form_param);
+ PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'prefs_forms.php'
+ . PMA_generate_common_url($url_params, '&'));
+ exit;
+}
+
+$error = null;
+if ($form_display->process(false) && !$form_display->hasErrors()) {
+ // save settings
+ $old_settings = PMA_load_userprefs();
+ $result = PMA_save_userprefs(ConfigFile::getInstance()->getConfigArray());
+ if ($result === true) {
+ // reload config
+ $GLOBALS['PMA_Config']->loadUserPreferences();
+ $hash = ltrim(filter_input(INPUT_POST, 'tab_hash'), '#');
+ PMA_userprefs_redirect($forms, $old_settings, 'prefs_forms.php', array(
+ 'form' => $form_param), $hash);
+ exit;
+ } else {
+ $error = $result;
+ }
+}
+
+// display forms
+$GLOBALS['js_include'][] = 'config.js';
+require './libraries/header.inc.php';
+require './libraries/user_preferences.inc.php';
+if ($error) {
+ $error->display();
+}
+if ($form_display->hasErrors()) {
+ // form has errors
+ ?>
+ <div class="warning config-form">
+ <b><?php echo __('Cannot save settings, submitted form contains errors') ?></b>
+ <?php $form_display->displayErrors(); ?>
+ </div>
+ <?php
+}
+$form_display->display(true, true);
+
+/**
+ * Displays the footer
+ */
+require './libraries/footer.inc.php';
+?>
\ No newline at end of file
diff --git a/prefs_manage.php b/prefs_manage.php
new file mode 100644
index 0000000..d678f8a
--- /dev/null
+++ b/prefs_manage.php
@@ -0,0 +1,337 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * User preferences management page
+ *
+ * @package phpMyAdmin
+ */
+
+/**
+ * Gets some core libraries and displays a top message if required
+ */
+require_once './libraries/common.inc.php';
+require_once './libraries/user_preferences.lib.php';
+require_once './libraries/config/config_functions.lib.php';
+require_once './libraries/config/messages.inc.php';
+require_once './libraries/config/ConfigFile.class.php';
+require_once './libraries/config/Form.class.php';
+require_once './libraries/config/FormDisplay.class.php';
+require './libraries/config/user_preferences.forms.php';
+
+PMA_userprefs_pageinit();
+
+$error = '';
+if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') == 'text_file') {
+ // export to JSON file
+ $filename = 'phpMyAdmin-config-' . urlencode(PMA_getenv('HTTP_HOST')) . '.json';
+ header('Content-Type: application/json');
+ header('Content-Disposition: attachment; filename="' . $filename . '"');
+ header('Expires: ' . date(DATE_RFC1123));
+ $settings = PMA_load_userprefs();
+ echo json_encode($settings['config_data']);
+ return;
+} else if (isset($_POST['submit_get_json'])) {
+ $settings = PMA_load_userprefs();
+ header('Content-Type: application/json');
+ echo json_encode(array(
+ 'prefs' => json_encode($settings['config_data']),
+ 'mtime' => $settings['mtime']));
+ return;
+} else if (isset($_POST['submit_import'])) {
+ // load from JSON file
+ $json = '';
+ if (filter_input(INPUT_POST, 'import_type') == 'text_file'
+ && isset($_FILES['import_file'])
+ && $_FILES['import_file']['error'] == UPLOAD_ERR_OK
+ && is_uploaded_file($_FILES['import_file']['tmp_name'])) {
+ // read JSON from uploaded file
+ $open_basedir = @ini_get('open_basedir');
+ $file_to_unlink = '';
+ $import_file = $_FILES['import_file']['tmp_name'];
+
+ // If we are on a server with open_basedir, we must move the file
+ // before opening it. The doc explains how to create the "./tmp"
+ // directory
+ if (!empty($open_basedir)) {
+ $tmp_subdir = (PMA_IS_WINDOWS ? '.\\tmp\\' : './tmp/');
+ if (is_writable($tmp_subdir)) {
+ $import_file_new = tempnam($tmp_subdir, 'prefs');
+ if (move_uploaded_file($import_file, $import_file_new)) {
+ $import_file = $import_file_new;
+ $file_to_unlink = $import_file_new;
+ }
+ }
+ }
+ $json = file_get_contents($import_file);
+ if ($file_to_unlink) {
+ unlink($file_to_unlink);
+ }
+ } else {
+ // read from POST value (json)
+ $json = filter_input(INPUT_POST, 'json');
+ }
+
+ // hide header message
+ $_SESSION['userprefs_autoload'] = true;
+
+ $config = json_decode($json, true);
+ $return_url = filter_input(INPUT_POST, 'return_url');
+ if (!is_array($config)) {
+ $error = __('Could not import configuration');
+ } else {
+ // sanitize input values: treat them as though they came from HTTP POST request
+ $form_display = new FormDisplay();
+ foreach ($forms as $formset_id => $formset) {
+ foreach ($formset as $form_name => $form) {
+ $form_display->registerForm($formset_id . ': ' . $form_name, $form);
+ }
+ }
+ $cf = ConfigFile::getInstance();
+ $new_config = $cf->getFlatDefaultConfig();
+ if (!empty($_POST['import_merge'])) {
+ $new_config = array_merge($new_config, $cf->getConfigArray());
+ }
+ $new_config = array_merge($new_config, $config);
+ $_POST_bak = $_POST;
+ foreach ($new_config as $k => $v) {
+ $_POST[str_replace('/', '-', $k)] = $v;
+ }
+ $cf->resetConfigData();
+ $all_ok = $form_display->process(true, false);
+ $all_ok = $all_ok && !$form_display->hasErrors();
+ $_POST = $_POST_bak;
+
+ if (!$all_ok && isset($_POST['fix_errors'])) {
+ $form_display->fixErrors();
+ $all_ok = true;
+ }
+ if (!$all_ok) {
+ // mimic original form and post json in a hidden field
+ require './libraries/header.inc.php';
+ require './libraries/user_preferences.inc.php';
+ $msg = PMA_Message::warning(__('Configuration contains incorrect data for some fields.'));
+ $msg->display();
+ echo '<div class="config-form">';
+ $form_display->displayErrors();
+ echo '</div>';
+ ?>
+ <form action="prefs_manage.php" method="post">
+ <?php echo PMA_generate_common_hidden_inputs() . "\n"; ?>
+ <input type="hidden" name="json" value="<?php echo htmlspecialchars($json) ?>" />
+ <input type="hidden" name="fix_errors" value="1" />
+ <?php if (!empty($_POST['import_merge'])): ?>
+ <input type="hidden" name="import_merge" value="1" />
+ <?php endif; ?>
+ <?php if ($return_url): ?>
+ <input type="hidden" name="return_url" value="<?php echo htmlspecialchars($return_url) ?>" />
+ <?php endif; ?>
+ <p><?php echo __('Do you want to import remaining settings?') ?></p>
+ <input type="submit" name="submit_import" value="<?php echo __('Yes') ?>" />
+ <input type="submit" name="submit_ignore" value="<?php echo __('No') ?>" />
+ </form>
+ <?php
+ require './libraries/footer.inc.php';
+ return;
+ }
+
+ // check for ThemeDefault and fontsize
+ $params = array();
+ if (isset($config['ThemeDefault'])
+ && $_SESSION['PMA_Theme_Manager']->theme->getId() != $config['ThemeDefault']
+ && $_SESSION['PMA_Theme_Manager']->checkTheme($config['ThemeDefault'])) {
+ $_SESSION['PMA_Theme_Manager']->setActiveTheme($config['ThemeDefault']);
+ $_SESSION['PMA_Theme_Manager']->setThemeCookie();
+ $params['reload_left_frame'] = true;
+ }
+ if (isset($config['fontsize'])
+ && $config['fontsize'] != $GLOBALS['PMA_Config']->get('fontsize')) {
+ $params['set_fontsize'] = $config['fontsize'];
+ $params['reload_left_frame'] = true;
+ }
+ if (isset($config['lang'])
+ && $config['lang'] != $GLOBALS['lang']) {
+ $params['lang'] = $config['lang'];
+ $params['reload_left_frame'] = true;
+ }
+ if (isset($config['collation_connection'])
+ && $config['collation_connection'] != $GLOBALS['collation_connection']) {
+ $params['collation_connection'] = $config['collation_connection'];
+ $params['reload_left_frame'] = true;
+ }
+
+ // save settings
+ $old_settings = PMA_load_userprefs();
+ $result = PMA_save_userprefs($cf->getConfigArray());
+ if ($result === true) {
+ if ($return_url) {
+ $query = explode('&', parse_url($return_url, PHP_URL_QUERY));
+ $return_url = parse_url($return_url, PHP_URL_PATH);
+ foreach ($query as $q) {
+ $pos = strpos($q, '=');
+ $k = substr($q, 0, $pos);
+ if ($k == 'token') {
+ continue;
+ }
+ $params[$k] = substr($q, $pos+1);
+ }
+ } else {
+ $return_url = 'prefs_manage.php';
+ }
+ // reload config
+ $GLOBALS['PMA_Config']->loadUserPreferences();
+ PMA_userprefs_redirect($forms, $old_settings, $return_url, $params);
+ exit;
+ } else {
+ $error = $result;
+ }
+ }
+} else if (isset($_POST['submit_clear'])) {
+ $old_settings = PMA_load_userprefs();
+ $result = PMA_save_userprefs(array());
+ if ($result === true) {
+ $params = array();
+ if ($_SESSION['PMA_Theme_Manager']->theme->getId() != 'original') {
+ $GLOBALS['PMA_Config']->removeCookie($_SESSION['PMA_Theme_Manager']->getThemeCookieName());
+ unset($_SESSION['PMA_Theme_Manager']);
+ unset($_SESSION['PMA_Theme']);
+ $params['reload_left_frame'] = true;
+ }
+ if ($GLOBALS['PMA_Config']->get('fontsize') != '82%') {
+ $GLOBALS['PMA_Config']->removeCookie('pma_fontsize');
+ $params['reload_left_frame'] = true;
+ }
+ $GLOBALS['PMA_Config']->removeCookie('pma_collaction_connection');
+ $GLOBALS['PMA_Config']->removeCookie('pma_lang');
+ PMA_userprefs_redirect($forms, $old_settings, 'prefs_manage.php', $params);
+ exit;
+ } else {
+ $error = $result;
+ }
+ exit;
+}
+
+$GLOBALS['js_include'][] = 'config.js';
+require './libraries/header.inc.php';
+require './libraries/user_preferences.inc.php';
+if ($error) {
+ if (!$error instanceof PMA_Message) {
+ $error = PMA_Message::error($error);
+ }
+ $error->display();
+}
+?>
+<script type="text/javascript">
+<?php
+PMA_printJsValue("PMA_messages['strSavedOn']", __('Saved on: __DATE__'));
+?>
+</script>
+<div id="maincontainer">
+ <div id="main_pane_left">
+ <div class="group">
+ <h2><?php echo __('Import') ?></h2>
+ <form class="group-cnt prefs-form" name="prefs_import" action="prefs_manage.php" method="post" enctype="multipart/form-data">
+ <?php
+ echo PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
+ echo PMA_generate_common_hidden_inputs() . "\n";
+ ?>
+ <input type="hidden" name="json" value="" />
+ <input type="radio" id="import_text_file" name="import_type" value="text_file" checked="checked" />
+ <label for="import_text_file"><?php echo __('Import from file') ?></label>
+ <div id="opts_import_text_file" class="prefsmanage_opts">
+ <label for="input_import_file"><?php echo __('Location of the text file'); ?></label>
+ <input type="file" name="import_file" id="input_import_file" />
+ </div>
+ <input type="radio" id="import_local_storage" name="import_type" value="local_storage" disabled="disabled" />
+ <label for="import_local_storage"><?php echo __('Import from browser\'s storage') ?></label>
+ <div id="opts_import_local_storage" class="prefsmanage_opts disabled">
+ <div class="localStorage-supported">
+ <?php echo __('Settings will be imported from your browser\'s local storage.') ?>
+ <br />
+ <span class="localStorage-exists">
+ <?php echo __('Saved on: __DATE__') ?>
+ </span>
+ <span class="localStorage-empty">
+ <?php PMA_Message::notice(__('You have no saved settings!'))->display() ?>
+ </span>
+ </div>
+ <span class="localStorage-unsupported">
+ <?php PMA_Message::notice(__('This feature is not supported by your web browser'))->display() ?>
+ </span>
+ </div>
+
+ <input type="checkbox" id="import_merge" name="import_merge" />
+ <label for="import_merge"><?php echo __('Merge with current configuration') ?></label>
+ <br /><br />
+ <input type="submit" name="submit_import" value="<?php echo __('Go'); ?>" />
+ </form>
+ </div>
+ <?php
+ if (file_exists('./setup/index.php')) {
+ // show only if setup script is available, allows to disable this message
+ // by simply removing setup directory
+ ?>
+ <div class="group">
+ <h2><?php echo __('More settings') ?></h2>
+ <div class="group-cnt">
+ <?php
+ echo sprintf(__('You can set more settings by modifying config.inc.php, eg. by using %sSetup script%s.'), '<a href="setup/index.php">', '</a>');
+ echo PMA_showDocu('setup_script');
+ ?>
+ </div>
+ </div>
+ <?php
+ }
+ ?>
+ </div>
+ <div id="main_pane_right">
+ <div class="group">
+ <h2><?php echo __('Export') ?></h2>
+ <div class="click-hide-message group-cnt" style="display:none">
+ <?php
+ $message = PMA_Message::rawSuccess(__('Configuration has been saved'));
+ $message->display();
+ ?>
+ </div>
+ <form class="group-cnt prefs-form" name="prefs_export" action="prefs_manage.php" method="post">
+ <?php echo PMA_generate_common_hidden_inputs() . "\n" ?>
+ <div style="padding-bottom:0.5em">
+ <input type="radio" id="export_text_file" name="export_type" value="text_file" checked="checked" />
+ <label for="export_text_file"><?php echo __('Save as file') ?></label>
+ <br />
+ <input type="radio" id="export_local_storage" name="export_type" value="local_storage" disabled="disabled" />
+ <label for="export_local_storage"><?php echo __('Save to browser\'s storage') ?></label>
+ </div>
+ <div id="opts_export_local_storage" class="prefsmanage_opts disabled">
+ <span class="localStorage-supported">
+ <?php echo __('Settings will be saved in your browser\'s local storage.') ?>
+ <span class="localStorage-exists">
+ <br /><b><?php echo __('Existing settings will be overwritten!') ?></b>
+ </span>
+ </span>
+ <span class="localStorage-unsupported">
+ <?php PMA_Message::notice(__('This feature is not supported by your web browser'))->display() ?>
+ </span>
+ </div>
+ <br />
+ <input type="submit" name="submit_export" value="<?php echo __('Go'); ?>" />
+ </form>
+ </div>
+ <div class="group">
+ <h2><?php echo __('Reset') ?></h2>
+ <form class="group-cnt prefs-form" name="prefs_reset" action="prefs_manage.php" method="post">
+ <?php echo PMA_generate_common_hidden_inputs() . "\n" ?>
+ <?php echo __('You can reset all your settings and restore them to default values') ?>
+ <br /><br />
+ <input type="submit" name="submit_clear" value="<?php echo __('Reset') ?>" />
+ </form>
+
+ </div>
+ </div>
+ <br class="clearfloat" />
+</div>
+<?php
+/**
+ * Displays the footer
+ */
+require './libraries/footer.inc.php';
+?>
\ No newline at end of file
diff --git a/scripts/create_tables.sql b/scripts/create_tables.sql
index e4d0fc8..ca7325a 100644
--- a/scripts/create_tables.sql
+++ b/scripts/create_tables.sql
@@ -192,3 +192,18 @@ CREATE TABLE IF NOT EXISTS `pma_tracking` (
`tracking_active` int(1) unsigned NOT NULL default '1',
PRIMARY KEY (`db_name`,`table_name`,`version`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=COMPACT;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma_userconfig`
+--
+
+CREATE TABLE IF NOT EXISTS `pma_userconfig` (
+ `username` varchar(64) NOT NULL,
+ `timevalue` timestamp NOT NULL,
+ `config_data` text NOT NULL,
+ PRIMARY KEY (`username`)
+)
+ ENGINE=MyISAM COMMENT='User preferences storage for phpMyAdmin'
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
diff --git a/scripts/find_unused_messages.sh b/scripts/find_unused_messages.sh
index ea8394b..bf01ffc 100755
--- a/scripts/find_unused_messages.sh
+++ b/scripts/find_unused_messages.sh
@@ -29,7 +29,7 @@ echo
echo Not used messages present in messages file:
echo
-diff $tmp1 $tmp2 | awk '/^</ {print $2}' | grep -Ev '(strSetup.*_(desc|name)|strSetupForm_|strSetupFormset_)'
+diff $tmp1 $tmp2 | awk '/^</ {print $2}' | grep -Ev '(strConfig.*_(desc|name)|strConfigForm_|strConfigFormset_)'
rm -f $tmp1 $tmp2
diff --git a/setup/config.php b/setup/config.php
index e2bd132..fa18106 100644
--- a/setup/config.php
+++ b/setup/config.php
@@ -1,21 +1,23 @@
<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Front controller for config view / download and clear
*
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
+ * @package phpMyAdmin-setup
*/
/**
* Core libraries.
*/
require './lib/common.inc.php';
-require_once './setup/lib/Form.class.php';
-require_once './setup/lib/FormDisplay.class.php';
+require_once './libraries/config/Form.class.php';
+require_once './libraries/config/FormDisplay.class.php';
+require_once './setup/lib/ConfigGenerator.class.php';
+
+require './libraries/config/setup.forms.php';
$form_display = new FormDisplay();
-$form_display->registerForm('_config.php');
+$form_display->registerForm('_config.php', $forms['_config.php']);
$form_display->save('_config.php');
$config_file_path = ConfigFile::getInstance()->getFilePath();
@@ -27,7 +29,7 @@ if (PMA_ifSetOr($_POST['submit_clear'], '')) {
//
// Clear current config and return to main page
//
- $_SESSION['ConfigFile'] = array();
+ ConfigFile::getInstance()->resetConfigData();
// drop post data
header('HTTP/1.1 303 See Other');
header('Location: index.php');
@@ -38,13 +40,13 @@ if (PMA_ifSetOr($_POST['submit_clear'], '')) {
//
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename="config.inc.php"');
- echo ConfigFile::getInstance()->getConfigFile();
+ echo ConfigGenerator::getConfigFile();
exit;
} elseif (PMA_ifSetOr($_POST['submit_save'], '')) {
//
// Save generated config file on the server
//
- file_put_contents($config_file_path, ConfigFile::getInstance()->getConfigFile());
+ file_put_contents($config_file_path, ConfigGenerator::getConfigFile());
header('HTTP/1.1 303 See Other');
header('Location: index.php');
exit;
@@ -54,7 +56,7 @@ if (PMA_ifSetOr($_POST['submit_clear'], '')) {
//
$cfg = array();
require_once $config_file_path;
- $_SESSION['ConfigFile'] = $cfg;
+ ConfigFile::getInstance()->setConfigData($cfg);
header('HTTP/1.1 303 See Other');
header('Location: index.php');
exit;
diff --git a/libraries/.htaccess b/setup/frames/.htaccess
similarity index 100%
copy from libraries/.htaccess
copy to setup/frames/.htaccess
diff --git a/setup/frames/config.inc.php b/setup/frames/config.inc.php
index 4e925d9..e56898f 100644
--- a/setup/frames/config.inc.php
+++ b/setup/frames/config.inc.php
@@ -1,10 +1,9 @@
<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Config file view and save screen
*
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
+ * @package phpMyAdmin-setup
*/
if (!defined('PHPMYADMIN')) {
@@ -14,8 +13,9 @@ if (!defined('PHPMYADMIN')) {
/**
* Core libraries.
*/
-require_once './setup/lib/FormDisplay.class.php';
+require_once './libraries/config/FormDisplay.class.php';
require_once './setup/lib/index.lib.php';
+require_once './setup/lib/ConfigGenerator.class.php';
$config_readable = false;
$config_writable = false;
@@ -29,7 +29,7 @@ check_config_rw($config_readable, $config_writable, $config_exists);
<tr>
<td>
<textarea cols="50" rows="20" name="textconfig" id="textconfig" spellcheck="false"><?php
- echo htmlspecialchars(ConfigFile::getInstance()->getConfigFile())
+ echo htmlspecialchars(ConfigGenerator::getConfigFile())
?></textarea>
</td>
</tr>
diff --git a/setup/frames/form.inc.php b/setup/frames/form.inc.php
index 019b110..27429b4 100644
--- a/setup/frames/form.inc.php
+++ b/setup/frames/form.inc.php
@@ -1,10 +1,9 @@
<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Form edit view
*
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
+ * @package phpMyAdmin-setup
*/
if (!defined('PHPMYADMIN')) {
@@ -14,36 +13,24 @@ if (!defined('PHPMYADMIN')) {
/**
* Core libraries.
*/
-require_once './setup/lib/Form.class.php';
-require_once './setup/lib/FormDisplay.class.php';
+require_once './libraries/config/Form.class.php';
+require_once './libraries/config/FormDisplay.class.php';
require_once './setup/lib/form_processing.lib.php';
-$formsets = array(
- 'features' => array(
- 'forms' => array('Import_export', 'Security', 'Sql_queries', 'Other_core_settings')),
- 'left_frame' => array(
- 'forms' => array('Left_frame', 'Left_servers', 'Left_databases', 'Left_tables')),
- 'main_frame' => array(
- 'forms' => array('Startup', 'Browse', 'Edit', 'Tabs', 'Sql_box')),
- 'import' => array(
- 'forms' => array('Import_defaults')),
- 'export' => array(
- 'forms' => array('Export_defaults'))
-);
+require './libraries/config/setup.forms.php';
$formset_id = filter_input(INPUT_GET, 'formset');
$mode = filter_input(INPUT_GET, 'mode');
-if (!isset($formsets[$formset_id])) {
+if (!isset($forms[$formset_id])) {
die('Incorrect formset, check $formsets array in setup/frames/form.inc.php');
}
-$formset = $formsets[$formset_id];
-if (isset($GLOBALS['strSetupFormset_' . $formset_id])) {
- echo '<h2>' . $GLOBALS['strSetupFormset_' . $formset_id] . '</h2>';
+if (isset($GLOBALS['strConfigFormset_' . $formset_id])) {
+ echo '<h2>' . $GLOBALS['strConfigFormset_' . $formset_id] . '</h2>';
}
$form_display = new FormDisplay();
-foreach ($formset['forms'] as $form_name) {
- $form_display->registerForm($form_name);
+foreach ($forms[$formset_id] as $form_name => $form) {
+ $form_display->registerForm($form_name, $form);
}
process_formset($form_display);
-?>
+?>
\ No newline at end of file
diff --git a/setup/frames/index.inc.php b/setup/frames/index.inc.php
index 43b6574..1b1285c 100644
--- a/setup/frames/index.inc.php
+++ b/setup/frames/index.inc.php
@@ -2,9 +2,7 @@
/**
* Overview (main page)
*
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
+ * @package phpMyAdmin-setup
*/
if (!defined('PHPMYADMIN')) {
@@ -15,7 +13,7 @@ if (!defined('PHPMYADMIN')) {
* Core libraries.
*/
require_once './libraries/display_select_lang.lib.php';
-require_once './setup/lib/FormDisplay.class.php';
+require_once './libraries/config/FormDisplay.class.php';
require_once './setup/lib/index.lib.php';
// prepare unfiltered language list
@@ -48,7 +46,8 @@ $config_writable = false;
$config_exists = false;
check_config_rw($config_readable, $config_writable, $config_exists);
if (!$config_writable || !$config_readable) {
- messages_set('error', 'config_rw', 'CannotLoadConfig', PMA_lang('CannotLoadConfigMsg'));
+ messages_set('error', 'config_rw', __('Cannot load or save configuration'),
+ PMA_lang(__('Please create web server writable folder [em]config[/em] in phpMyAdmin top level directory as described in [a(a)Documentation.html#setup_script]documentation[/a] Otherwise you will be only able to download or display it.')));
}
//
// Check https connection
@@ -56,11 +55,13 @@ if (!$config_writable || !$config_readable) {
$is_https = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
if (!$is_https) {
$text = __('You are not using a secure connection; all data (including potentially sensitive information, like passwords) is transferred unencrypted!');
+
if (!empty($_SERVER['REQUEST_URI']) && !empty($_SERVER['HTTP_HOST'])) {
- $text .= ' ' . PMA_lang('InsecureConnectionMsg2',
+ $strInsecureConnectionMsg2 = __('If your server is also configured to accept HTTPS requests follow [a@%s]this link[/a] to use a secure connection.');
+ $text .= ' ' . PMA_lang($strInsecureConnectionMsg2,
'https://' . htmlspecialchars($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']));
}
- messages_set('warning', 'no_https', 'InsecureConnection', $text);
+ messages_set('warning', 'no_https', __('Insecure connection'), $text);
}
?>
@@ -110,10 +111,10 @@ display_form_top('index.php', 'get', array(
<tr>
<th>#</th>
<th><?php echo __('Name') ?></th>
- <th>Authentication type</th>
+ <th><?php echo __('Authentication type') ?></th>
<th colspan="2">DSN</th>
</tr>
-<?php foreach ($_SESSION['ConfigFile']['Servers'] as $id => $server): ?>
+<?php foreach ($cf->getServers() as $id => $server): ?>
<tr>
<td><?php echo $id ?></td>
<td><?php echo $cf->getServerName($id) ?></td>
@@ -186,7 +187,7 @@ if ($cf->getServerCount() > 0) {
}
$opts['values_disabled'][] = '-';
- foreach ($_SESSION['ConfigFile']['Servers'] as $id => $server) {
+ foreach ($cf->getServers() as $id => $server) {
$opts['values'][(string)$id] = $cf->getServerName($id) . " [$id]";
}
} else {
diff --git a/setup/frames/menu.inc.php b/setup/frames/menu.inc.php
index 1da3851..4a1ae9c 100644
--- a/setup/frames/menu.inc.php
+++ b/setup/frames/menu.inc.php
@@ -2,9 +2,7 @@
/**
* Menu items
*
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
+ * @package phpMyAdmin-setup
*/
if (!defined('PHPMYADMIN')) {
@@ -15,9 +13,10 @@ $separator = PMA_get_arg_separator('html');
?>
<ul>
<li><a href="index.php"><?php echo __('Overview') ?></a></li>
- <li><a href="?page=form<?php echo $separator ?>formset=features"><?php echo __('Features') ?></a></li>
- <li><a href="?page=form<?php echo $separator ?>formset=left_frame"><?php echo __('Navigation frame') ?></a></li>
- <li><a href="?page=form<?php echo $separator ?>formset=main_frame"><?php echo __('Main frame') ?></a></li>
- <li><a href="?page=form<?php echo $separator ?>formset=import"><?php echo __('Import') ?></a></li>
- <li><a href="?page=form<?php echo $separator ?>formset=export"><?php echo __('Export') ?></a></li>
+ <li><a href="?page=form<?php echo $separator ?>formset=Features"><?php echo __('Features') ?></a></li>
+ <li><a href="?page=form<?php echo $separator ?>formset=Sql_queries"><?php echo __('SQL queries') ?></a></li>
+ <li><a href="?page=form<?php echo $separator ?>formset=Left_frame"><?php echo __('Navigation frame') ?></a></li>
+ <li><a href="?page=form<?php echo $separator ?>formset=Main_frame"><?php echo __('Main frame') ?></a></li>
+ <li><a href="?page=form<?php echo $separator ?>formset=Import"><?php echo __('Import') ?></a></li>
+ <li><a href="?page=form<?php echo $separator ?>formset=Export"><?php echo __('Export') ?></a></li>
</ul>
diff --git a/setup/frames/servers.inc.php b/setup/frames/servers.inc.php
index 17ff2f9..081c416 100644
--- a/setup/frames/servers.inc.php
+++ b/setup/frames/servers.inc.php
@@ -2,9 +2,7 @@
/**
* Server create and edit view
*
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
+ * @package phpMyAdmin-setup
*/
if (!defined('PHPMYADMIN')) {
@@ -14,10 +12,12 @@ if (!defined('PHPMYADMIN')) {
/**
* Core libraries.
*/
-require_once './setup/lib/Form.class.php';
-require_once './setup/lib/FormDisplay.class.php';
+require_once './libraries/config/Form.class.php';
+require_once './libraries/config/FormDisplay.class.php';
require_once './setup/lib/form_processing.lib.php';
+require './libraries/config/setup.forms.php';
+
$mode = filter_input(INPUT_GET, 'mode');
$id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
@@ -41,10 +41,8 @@ if (isset($page_title)) {
echo '<h2>' . $page_title . '</h2>';
}
$form_display = new FormDisplay();
-$form_display->registerForm('Server', $id);
-$form_display->registerForm('Server_login_options', $id);
-$form_display->registerForm('Server_config', $id);
-$form_display->registerForm('Server_pmadb', $id);
-$form_display->registerForm('Server_tracking', $id);
+foreach ($forms['Servers'] as $form_name => $form) {
+ $form_display->registerForm($form_name, $form, $id);
+}
process_formset($form_display);
-?>
+?>
\ No newline at end of file
diff --git a/setup/index.php b/setup/index.php
index 0d16e5f..7d78928 100644
--- a/setup/index.php
+++ b/setup/index.php
@@ -5,7 +5,6 @@
* @package phpMyAdmin-setup
* @copyright Copyright (c) 2008, Piotr Przybylski <piotrprz(a)gmail.com>
* @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
*/
/**
@@ -37,6 +36,7 @@ require './libraries/header_http.inc.php';
<script type="text/javascript" src="../js/jquery/jquery-1.4.2.js"></script>
<script type="text/javascript" src="../js/jquery/jquery-ui-1.8.custom.js"></script>
<script type="text/javascript" src="../js/jquery/jquery.json-2.2.js"></script>
+<script type="text/javascript" src="../js/config.js"></script>
<script type="text/javascript" src="scripts.js"></script>
</head>
<body>
diff --git a/setup/lib/ConfigFile.class.php b/setup/lib/ConfigFile.class.php
deleted file mode 100644
index e7e7b28..0000000
--- a/setup/lib/ConfigFile.class.php
+++ /dev/null
@@ -1,322 +0,0 @@
-<?php
-/**
- * Config file management and generation
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
- * @package phpMyAdmin-setup
- */
-
-/**
- * Config file management and generation class
- *
- * @package phpMyAdmin-setup
- */
-class ConfigFile
-{
- /**
- * Stores default PMA config from config.default.php
- * @var array
- */
- private $cfg;
-
- /**
- * Stores allowed values for non-standard fields
- * @var array
- */
- private $cfgDb;
-
- /**
- * Keys which will be always written to config file
- * @var array
- */
- private $persistKeys;
-
- /**
- * ConfigFile instance
- * @var ConfigFile
- */
- private static $_instance;
-
- /**
- * Private constructor, use {@link getInstance()}
- */
- private function __construct()
- {
- // load default config values
- $cfg = &$this->cfg;
- require './libraries/config.default.php';
-
- // load additionsl config information
- $cfg_db = &$this->cfgDb;
- $persist_keys = array();
- require './setup/lib/config_info.inc.php';
-
- // apply default values overrides
- if (count($cfg_db['_overrides'])) {
- foreach ($cfg_db['_overrides'] as $path => $value) {
- array_write($path, $cfg, $value);
- }
- }
-
- // checking key presence is much faster than searching so move values to keys
- $this->persistKeys = array_flip($persist_keys);
- }
-
- /**
- * Returns class instance
- *
- * @return ConfigFile
- */
- public static function getInstance()
- {
- if (is_null(self::$_instance)) {
- self::$_instance = new ConfigFile();
- }
- return self::$_instance;
- }
-
- /**
- * Sets config value
- *
- * @param string $path
- * @param mixed $value
- * @param string $canonical_path
- */
- public function set($path, $value, $canonical_path = null)
- {
- if ($canonical_path === null) {
- $canonical_path = $this->getCanonicalPath($path);
- }
- // remove if the path isn't protected and it's empty or has a default value
- $default_value = $this->getDefault($canonical_path);
- if (!isset($this->persistKeys[$canonical_path])
- && (($value == $default_value) || (empty($value) && empty($default_value)))) {
- array_remove($path, $_SESSION['ConfigFile']);
- } else {
- array_write($path, $_SESSION['ConfigFile'], $value);
- }
- }
-
- /**
- * Returns config value or $default if it's not set
- *
- * @param string $path
- * @param mixed $default
- * @return mixed
- */
- public function get($path, $default = null)
- {
- return array_read($path, $_SESSION['ConfigFile'], $default);
- }
-
- /**
- * Returns default config value or $default it it's not set ie. it doesn't
- * exist in config.default.php ($cfg) and config_info.inc.php
- * ($_cfg_db['_overrides'])
- *
- * @param string $canonical_path
- * @param mixed $default
- * @return mixed
- */
- public function getDefault($canonical_path, $default = null)
- {
- return array_read($canonical_path, $this->cfg, $default);
- }
-
- /**
- * Returns config value, if it's not set uses the default one; returns
- * $default if the path isn't set and doesn't contain a default value
- *
- * @param string $path
- * @param mixed $default
- * @return mixed
- */
- public function getValue($path, $default = null)
- {
- $v = array_read($path, $_SESSION['ConfigFile'], null);
- if ($v !== null) {
- return $v;
- }
- $path = $this->getCanonicalPath($path);
- return $this->getDefault($path, $default);
- }
-
- /**
- * Returns canonical path
- *
- * @param string $path
- * @return string
- */
- public function getCanonicalPath($path) {
- return preg_replace('#^Servers/([\d]+)/#', 'Servers/1/', $path);
- }
-
- /**
- * Returns config database entry for $path ($cfg_db in config_info.php)
- *
- * @param string $path
- * @param mixed $default
- * @return mixed
- */
- public function getDbEntry($path, $default = null)
- {
- return array_read($path, $this->cfgDb, $default);
- }
-
- /**
- * Returns server count
- *
- * @return int
- */
- public function getServerCount()
- {
- return isset($_SESSION['ConfigFile']['Servers'])
- ? count($_SESSION['ConfigFile']['Servers'])
- : 0;
- }
-
- /**
- * Returns DSN of given server
- *
- * @param integer $server
- * @return string
- */
- function getServerDSN($server)
- {
- if (!isset($_SESSION['ConfigFile']['Servers'][$server])) {
- return '';
- }
-
- $path = 'Servers/' . $server;
- $dsn = $this->getValue("$path/extension") . '://';
- if ($this->getValue("$path/auth_type") == 'config') {
- $dsn .= $this->getValue("$path/user");
- if (!$this->getValue("$path/nopassword")) {
- $dsn .= ':***';
- }
- $dsn .= '@';
- }
- if ($this->getValue("$path/connect_type") == 'tcp') {
- $dsn .= $this->getValue("$path/host");
- $port = $this->getValue("$path/port");
- if ($port) {
- $dsn .= ':' . $port;
- }
- } else {
- $dsn .= $this->getValue("$path/socket");
- }
- return $dsn;
- }
-
- /**
- * Returns server name
- *
- * @param int $id
- * @return string
- */
- public function getServerName($id)
- {
- if (!isset($_SESSION['ConfigFile']['Servers'][$id])) {
- return '';
- }
- $verbose = $this->get("Servers/$id/verbose");
- if (!empty($verbose)) {
- return $verbose;
- }
- $host = $this->get("Servers/$id/host");
- return empty($host) ? 'localhost' : $host;
- }
-
- /**
- * Removes server
- *
- * @param int $server
- */
- public function removeServer($server)
- {
- if (!isset($_SESSION['ConfigFile']['Servers'][$server])) {
- return;
- }
- $last_server = $this->getServerCount();
-
- for ($i = $server; $i < $last_server; $i++) {
- $_SESSION['ConfigFile']['Servers'][$i] = $_SESSION['ConfigFile']['Servers'][$i+1];
- }
- unset($_SESSION['ConfigFile']['Servers'][$last_server]);
-
- if (isset($_SESSION['ConfigFile']['ServerDefault'])
- && $_SESSION['ConfigFile']['ServerDefault'] >= 0) {
- unset($_SESSION['ConfigFile']['ServerDefault']);
- }
- }
-
- /**
- * Returns config file path
- *
- * @return unknown
- */
- public function getFilePath()
- {
- return $this->getDbEntry('_config_file_path');
- }
-
- /**
- * Creates config file
- *
- * @return string
- */
- public function getConfigFile()
- {
- $crlf = (isset($_SESSION['eol']) && $_SESSION['eol'] == 'win') ? "\r\n" : "\n";
- $c = $_SESSION['ConfigFile'];
-
- // header
- $ret = '<?php' . $crlf
- . '/*' . $crlf
- . ' * Generated configuration file' . $crlf
- . ' * Generated by: phpMyAdmin '
- . $GLOBALS['PMA_Config']->get('PMA_VERSION')
- . ' setup script by Piotr Przybylski <piotrprz(a)gmail.com>' . $crlf
- . ' * Date: ' . date(DATE_RFC1123) . $crlf
- . ' */' . $crlf . $crlf;
-
- // servers
- if ($this->getServerCount() > 0) {
- $ret .= "/* Servers configuration */$crlf\$i = 0;" . $crlf . $crlf;
- foreach ($c['Servers'] as $id => $server) {
- $ret .= '/* Server: ' . strtr($this->getServerName($id), '*/', '-') . " [$id] */" . $crlf
- . '$i++;' . $crlf;
- foreach ($server as $k => $v) {
- $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
- $ret .= "\$cfg['Servers'][\$i]['$k'] = "
- . var_export($v, true) . ';' . $crlf;
- }
- $ret .= $crlf;
- }
- $ret .= '/* End of servers configuration */' . $crlf . $crlf;
- }
- unset($c['Servers']);
-
- // other settings
- $persistKeys = $this->persistKeys;
- foreach ($c as $k => $v) {
- $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
- $ret .= "\$cfg['$k'] = " . var_export($v, true) . ';' . $crlf;
- if (isset($persistKeys[$k])) {
- unset($persistKeys[$k]);
- }
- }
- // keep 1d array keys which are present in $persist_keys (config_info.inc.php)
- foreach (array_keys($persistKeys) as $k) {
- if (strpos($k, '/') === false) {
- $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
- $ret .= "\$cfg['$k'] = " . var_export($this->getDefault($k), true) . ';' . $crlf;
- }
- }
- $ret .= '?>';
-
- return $ret;
- }
-}
-?>
diff --git a/setup/lib/ConfigGenerator.class.php b/setup/lib/ConfigGenerator.class.php
new file mode 100644
index 0000000..ddad7f1
--- /dev/null
+++ b/setup/lib/ConfigGenerator.class.php
@@ -0,0 +1,151 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Config file generator
+ *
+ * @package phpMyAdmin-setup
+ */
+
+/**
+ * Config file generation class
+ *
+ * @package phpMyAdmin
+ */
+class ConfigGenerator
+{
+ /**
+ * Creates config file
+ *
+ * @return string
+ */
+ public static function getConfigFile()
+ {
+ $cf = ConfigFile::getInstance();
+
+ $crlf = (isset($_SESSION['eol']) && $_SESSION['eol'] == 'win') ? "\r\n" : "\n";
+ $c = $cf->getConfig();
+
+ // header
+ $ret = '<?php' . $crlf
+ . '/*' . $crlf
+ . ' * Generated configuration file' . $crlf
+ . ' * Generated by: phpMyAdmin '
+ . $GLOBALS['PMA_Config']->get('PMA_VERSION')
+ . ' setup script by Piotr Przybylski <piotrprz(a)gmail.com>' . $crlf
+ . ' * Date: ' . date(DATE_RFC1123) . $crlf
+ . ' */' . $crlf . $crlf;
+
+ // servers
+ if ($cf->getServerCount() > 0) {
+ $ret .= "/* Servers configuration */$crlf\$i = 0;" . $crlf . $crlf;
+ foreach ($c['Servers'] as $id => $server) {
+ $ret .= '/* Server: ' . strtr($cf->getServerName($id), '*/', '-') . " [$id] */" . $crlf
+ . '$i++;' . $crlf;
+ foreach ($server as $k => $v) {
+ $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
+ $ret .= "\$cfg['Servers'][\$i]['$k'] = "
+ . (is_array($v) && self::_isZeroBasedArray($v)
+ ? self::_exportZeroBasedArray($v, $crlf)
+ : var_export($v, true))
+ . ';' . $crlf;
+ }
+ $ret .= $crlf;
+ }
+ $ret .= '/* End of servers configuration */' . $crlf . $crlf;
+ }
+ unset($c['Servers']);
+
+ // other settings
+ $persistKeys = $cf->getPersistKeysMap();
+
+ foreach ($c as $k => $v) {
+ $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
+ $ret .= self::_getVarExport($k, $v, $crlf);
+ if (isset($persistKeys[$k])) {
+ unset($persistKeys[$k]);
+ }
+ }
+ // keep 1d array keys which are present in $persist_keys (config.values.php)
+ foreach (array_keys($persistKeys) as $k) {
+ if (strpos($k, '/') === false) {
+ $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
+ $ret .= self::_getVarExport($k, $cf->getDefault($k), $crlf);
+ }
+ }
+ $ret .= '?>';
+
+ return $ret;
+ }
+
+ /**
+ * Returns exported configuration variable
+ *
+ * @param string $var_name
+ * @param mixed $var_value
+ * @param string $crlf
+ * @return string
+ */
+ private static function _getVarExport($var_name, $var_value, $crlf)
+ {
+ if (!is_array($var_value) || empty($var_value)) {
+ return "\$cfg['$var_name'] = " . var_export($var_value, true) . ';' . $crlf;
+ }
+ $ret = '';
+ if (self::_isZeroBasedArray($var_value)) {
+ $ret = "\$cfg['$var_name'] = " . self::_exportZeroBasedArray($var_value, $crlf)
+ . ';' . $crlf;
+ } else {
+ // string keys: $cfg[key][subkey] = value
+ foreach ($var_value as $k => $v) {
+ $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
+ $ret .= "\$cfg['$var_name']['$k'] = " . var_export($v, true) . ';' . $crlf;
+ }
+ }
+ return $ret;
+ }
+
+ /**
+ * Check whether $array is a continuous 0-based array
+ *
+ * @param array $array
+ * @return boolean
+ */
+ private static function _isZeroBasedArray(array $array)
+ {
+ for ($i = 0; $i < count($array); $i++) {
+ if (!isset($array[$i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Exports continuous 0-based array
+ *
+ * @param array $array
+ * @param string $crlf
+ * @return string
+ */
+ private static function _exportZeroBasedArray(array $array, $crlf)
+ {
+ $retv = array();
+ foreach ($array as $v) {
+ $retv[] = var_export($v, true);
+ }
+ $ret = "array(";
+ if (count($retv) <= 4) {
+ // up to 4 values - one line
+ $ret .= implode(', ', $retv);
+ } else {
+ // more than 4 values - value per line
+ $imax = count($retv)-1;
+ for ($i = 0; $i <= $imax; $i++) {
+ $ret .= ($i < $imax ? ($i > 0 ? ',' : '') : '') . $crlf . ' ' . $retv[$i];
+ }
+ }
+ $ret .= ')';
+ return $ret;
+ }
+}
+?>
\ No newline at end of file
diff --git a/setup/lib/FormDisplay.tpl.php b/setup/lib/FormDisplay.tpl.php
deleted file mode 100644
index f6cb5a5..0000000
--- a/setup/lib/FormDisplay.tpl.php
+++ /dev/null
@@ -1,293 +0,0 @@
-<?php
-/**
- * Form templates
- *
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
- */
-
-/**
- * Displays top part of the form
- *
- * @param string $action default: $_SERVER['REQUEST_URI']
- * @param string $method 'post' or 'get'
- * @param array $hidden_fields array of form hidden fields (key: field name)
- */
-function display_form_top($action = null, $method = 'post', $hidden_fields = null)
-{
- static $has_check_page_refresh = false;
-
- if ($action === null) {
- $action = $_SERVER['REQUEST_URI'];
- }
- if ($method != 'post') {
- $method = 'get';
- }
-?>
-<form method="<?php echo $method ?>" action="<?php echo htmlspecialchars($action) ?>">
-<?php
- // we do validation on page refresh when browser remembers field values,
- // add a field with known value which will be used for checks
- if (!$has_check_page_refresh) {
- $has_check_page_refresh = true;
- echo '<input type="hidden" name="check_page_refresh" id="check_page_refresh"'
- . ' value="" />' . "\n";
- }
- echo PMA_generate_common_hidden_inputs() . "\n";
- echo PMA_getHiddenFields((array)$hidden_fields);
-}
-
-/**
- * Displays form tabs which are given by an array indexed by fieldset id
- * ({@link display_fieldset_top}), with values being tab titles.
- *
- * @param array $tabs
- */
-function display_tabs_top($tabs) {
-?>
-<ul class="tabs">
-<?php foreach ($tabs as $tab_id => $tab_name): ?>
- <li><a href="#<?php echo $tab_id ?>"><?php echo $tab_name ?></a></li>
-<?php endforeach; ?>
-</ul>
-<br clear="right" />
-<div class="tabs_contents">
-<?php
-}
-
-
-/**
- * Displays top part of a fieldset
- *
- * @param string $title
- * @param string $description
- * @param array $errors
- * @param array $attributes
- */
-function display_fieldset_top($title = '', $description = '', $errors = null, $attributes = array())
-{
- $attributes = array_merge(array('class' => 'optbox'), $attributes);
- foreach ($attributes as $k => &$attr) {
- $attr = $k . '="' . htmlspecialchars($attr) . '"';
- }
-
- echo '<fieldset ' . implode(' ', $attributes) . '>';
- echo '<legend>' . $title . '</legend>';
- if (!empty($description)) {
- echo '<p>' . $description . '</p>';
- }
- // this must match with displayErrors() in scripts.js
- if (is_array($errors) && count($errors) > 0) {
- echo '<dl class="errors">';
- foreach ($errors as $error) {
- echo '<dd>' . $error . '</dd>';
- }
- echo '</dl>';
- }
-?>
-<table width="100%" cellspacing="0">
-<?php
-}
-
-/**
- * Displays input field
- *
- * $opts keys:
- * o doc - (string) documentation link
- * o errors - error array
- * o setvalue - (string) shows button allowing to set poredefined value
- * o show_restore_default - (boolean) whether show "restore default" button
- * o values - key - value paris for <select> fields
- * o values_escaped - (boolean) tells whether values array is already escaped (defaults to false)
- * o values_disabled - (array)list of disabled values (keys from values)
- * o wiki - (string) wiki link
- *
- * @param string $path
- * @param string $name
- * @param string $description
- * @param string $type
- * @param mixed $value
- * @param bool $value_is_default
- * @param array $opts
- */
-function display_input($path, $name, $description = '', $type, $value, $value_is_default = true, $opts = null)
-{
- $field_class = $value_is_default ? '' : ' class="custom"';
- $name_id = 'name="' . $path . '" id="' . $path . '"';
-?>
-<tr>
- <th>
- <label for="<?php echo htmlspecialchars($path) ?>"><?php echo $name ?></label>
- <?php if (!empty($opts['doc']) || !empty($opts['wiki'])): ?>
- <span class="doc">
- <?php if (!empty($opts['doc'])) { ?><a href="<?php echo $opts['doc'] ?>" target="documentation"><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath'] ?>/original/img/b_help.png" width="11" height="11" alt="Doc" title="<?php echo __('Documentation') ?>" /></a><?php } ?>
- <?php if (!empty($opts['wiki'])){ ?><a href="<?php echo $opts['wiki'] ?>" target="wiki"><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath'] ?>/original/img/b_info.png" width="11" height="11" alt="Wiki" title="Wiki" /></a><?php } ?>
- </span>
- <?php endif; ?>
- <?php if (!empty($description)) { ?><small><?php echo $description ?></small><?php } ?>
-
- </th>
- <td>
- <?php
- switch ($type) {
- case 'text':
- echo '<input type="text" size="50" ' . $name_id . $field_class
- . ' value="' . htmlspecialchars($value) . '" />';
- break;
- case 'checkbox':
- echo '<span class="checkbox' . ($value_is_default ? '' : ' custom')
- . '"><input type="checkbox" ' . $name_id
- . ($value ? ' checked="checked"' : '') . ' /></span>';
- break;
- case 'select':
- echo '<select ' . $name_id . $field_class . '>';
- $escape = !(isset($opts['values_escaped']) && $opts['values_escaped']);
- $values_disabled = isset($opts['values_disabled'])
- ? array_flip($opts['values_disabled']) : array();
- foreach ($opts['values'] as $opt_value => $opt_name) {
- // set names for boolean values
- if (is_bool($opt_name)) {
- $opt_name = $GLOBALS['strSetup' . ($opt_value ? 'True' : 'False')];
- }
- // cast boolean values to integers
- $display_value = is_bool($opt_value) ? (int) $opt_value : $opt_value;
- // escape if necessary
- if ($escape) {
- $display = htmlspecialchars($opt_name);
- $display_value = htmlspecialchars($display_value);
- } else {
- $display = $opt_name;
- }
- // compare with selected value
- // boolean values are cast to integers when used as array keys
- $selected = is_bool($value)
- ? (int) $value === $opt_value
- : $opt_value === $value;
- echo '<option value="' . $display_value . '"'
- . ($selected ? ' selected="selected"' : '')
- . (isset($values_disabled[$opt_value]) ? ' disabled="disabled"' : '')
- . '>' . $display . '</option>';
- }
- echo '</select>';
- break;
- case 'list':
- echo '<textarea cols="40" rows="5" ' . $name_id . $field_class . '>'
- . htmlspecialchars(implode("\n", $value))
- . '</textarea>';
- break;
- }
- if (isset($opts['setvalue']) && $opts['setvalue']) {
- ?>
- <a class="set-value" href="#<?php echo "$path={$opts['setvalue']}" ?>" title="<?php echo sprintf(__('Set value: %s'), htmlspecialchars($opts['setvalue'])) ?>" style="display:none"><img alt="set-value" src="../<?php echo $GLOBALS['cfg']['ThemePath'] ?>/original/img/b_edit.png" width="16" height="16" /></a>
- <?php
- }
- if (isset($opts['show_restore_default']) && $opts['show_restore_default']) {
- ?>
- <a class="restore-default" href="#<?php echo $path ?>" title="<?php echo __('Restore default value') ?>" style="display:none"><img alt="restore-default" src="../<?php echo $GLOBALS['cfg']['ThemePath'] ?>/original/img/s_reload.png" width="16" height="16" /></a>
- <?php
- }
- // this must match with displayErrors() in scripts.js
- if (isset($opts['errors']) && !empty($opts['errors'])) {
- echo "\n <dl class=\"inline_errors\">";
- foreach ($opts['errors'] as $error) {
- echo '<dd>' . htmlspecialchars($error) . '</dd>';
- }
- echo '</dl>';
- }
- ?>
-
- </td>
-</tr>
-<?php
-}
-
-/**
- * Displays bottom part of a fieldset
- *
- * @param array $js_array
- */
-function display_fieldset_bottom()
-{
-?>
-<tr>
- <td colspan="2" class="lastrow">
- <input type="submit" name="submit_save" value="<?php echo __('Save') ?>" class="green" />
- <input type="button" name="submit_reset" value="<?php echo __('Reset') ?>" />
- </td>
-</tr>
-</table>
-</fieldset>
-
-<?php
-}
-
-/**
- * Displays simple bottom part of a fieldset (without submit buttons)
- */
-function display_fieldset_bottom_simple()
-{
-?>
-</table>
-</fieldset>
-
-<?php
-}
-
-/**
- * Closes form tabs
- */
-function display_tabs_bottom() {
- echo "</div>\n";
-}
-
-/**
- * Displays bottom part of the form
- */
-function display_form_bottom()
-{
- echo "</form>\n";
-}
-
-/**
- * Appends JS validation code to $js_array
- *
- * @param string $field_id
- * @param string $validator
- * @param array $js_array
- */
-function js_validate($field_id, $validator, &$js_array) {
- $js_array[] = "validateField('$field_id', '$validator', true)";
-}
-
-/**
- * Displays JavaScript code
- *
- * @param array $js_array
- */
-function display_js($js_array) {
- if (empty($js_array)) {
- return;
- }
-?>
-<script type="text/javascript">
-<?php echo implode(";\n", $js_array) . ";\n" ?>
-</script>
-<?php
-}
-
-/**
- * Displays error list
- *
- * @param string $name
- * @param array $error_list
- */
-function display_errors($name, $error_list) {
- echo '<dl>';
- echo '<dt>' . htmlspecialchars($name) . '</dt>';
- foreach ($error_list as $error) {
- echo '<dd>' . htmlspecialchars($error) . '</dd>';
- }
- echo '</dl>';
-}
-?>
diff --git a/setup/lib/common.inc.php b/setup/lib/common.inc.php
index 2d1f1f6..8b43caf 100644
--- a/setup/lib/common.inc.php
+++ b/setup/lib/common.inc.php
@@ -1,10 +1,9 @@
<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Loads libraries/common.inc.php and preforms some additional actions
*
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
+ * @package phpMyAdmin-setup
*/
/**
@@ -20,9 +19,11 @@ if (!file_exists('./libraries/common.inc.php')) {
}
require_once './libraries/common.inc.php';
+require_once './libraries/config/config_functions.lib.php';
+require_once './libraries/config/messages.inc.php';
+require_once './libraries/config/ConfigFile.class.php';
require_once './libraries/url_generating.lib.php';
-require_once './setup/lib/messages.inc.php';
-require_once './setup/lib/ConfigFile.class.php';
+require_once './libraries/user_preferences.lib.php';
// use default error handler
restore_error_handler();
@@ -30,201 +31,22 @@ restore_error_handler();
// Save current language in a cookie, required since we use PMA_MINIMUM_COMMON
$GLOBALS['PMA_Config']->setCookie('pma_lang', $GLOBALS['lang']);
-if (!isset($_SESSION['ConfigFile'])) {
- $_SESSION['ConfigFile'] = array();
-}
+ConfigFile::getInstance()->setPersistKeys(array(
+ 'DefaultLang',
+ 'ServerDefault',
+ 'UploadDir',
+ 'SaveDir',
+ 'Servers/1/verbose',
+ 'Servers/1/host',
+ 'Servers/1/port',
+ 'Servers/1/socket',
+ 'Servers/1/extension',
+ 'Servers/1/connect_type',
+ 'Servers/1/auth_type',
+ 'Servers/1/user',
+ 'Servers/1/password'));
// allows for redirection even after sending some data
ob_start();
-/**
- * Returns value of an element in $array given by $path.
- * $path is a string describing position of an element in an associative array,
- * eg. Servers/1/host refers to $array[Servers][1][host]
- *
- * @param string $path
- * @param array $array
- * @param mixed $default
- * @return mixed array element or $default
- */
-function array_read($path, $array, $default = null)
-{
- $keys = explode('/', $path);
- $value =& $array;
- foreach ($keys as $key) {
- if (!isset($value[$key])) {
- return $default;
- }
- $value =& $value[$key];
- }
- return $value;
-}
-
-/**
- * Stores value in an array
- *
- * @param string $path
- * @param array &$array
- * @param mixed $value
- */
-function array_write($path, &$array, $value)
-{
- $keys = explode('/', $path);
- $last_key = array_pop($keys);
- $a =& $array;
- foreach ($keys as $key) {
- if (!isset($a[$key])) {
- $a[$key] = array();
- }
- $a =& $a[$key];
- }
- $a[$last_key] = $value;
-}
-
-/**
- * Removes value from an array
- *
- * @param string $path
- * @param array &$array
- * @param mixed $value
- */
-function array_remove($path, &$array)
-{
- $keys = explode('/', $path);
- $keys_last = array_pop($keys);
- $path = array();
- $depth = 0;
-
- $path[0] =& $array;
- $found = true;
- // go as deep as required or possible
- foreach ($keys as $key) {
- if (!isset($path[$depth][$key])) {
- $found = false;
- break;
- }
- $depth++;
- $path[$depth] =& $path[$depth-1][$key];
- }
- // if element found, remove it
- if ($found) {
- unset($path[$depth][$keys_last]);
- $depth--;
- }
-
- // remove empty nested arrays
- for (; $depth >= 0; $depth--) {
- if (!isset($path[$depth+1]) || count($path[$depth+1]) == 0) {
- unset($path[$depth][$keys[$depth]]);
- } else {
- break;
- }
- }
-}
-
-/**
- * Returns sanitized language string, taking into account our special codes
- * for formatting. Takes variable number of arguments.
- * Based on PMA_sanitize from sanitize.lib.php.
- *
- * @param string $lang_key key in $GLOBALS WITHOUT 'strSetup' prefix
- * @param mixed $args arguments for sprintf
- * @return string
- */
-function PMA_lang($lang_key)
-{
- static $search, $replace;
-
- // some quick cache'ing
- if ($search === null) {
- $replace_pairs = array(
- '<' => '<',
- '>' => '>',
- '[em]' => '<em>',
- '[/em]' => '</em>',
- '[strong]' => '<strong>',
- '[/strong]' => '</strong>',
- '[code]' => '<code>',
- '[/code]' => '</code>',
- '[kbd]' => '<kbd>',
- '[/kbd]' => '</kbd>',
- '[br]' => '<br />',
- '[sup]' => '<sup>',
- '[/sup]' => '</sup>');
- $search = array_keys($replace_pairs);
- $replace = array_values($replace_pairs);
- }
- if (!isset($GLOBALS["strSetup$lang_key"])) {
- return $lang_key;
- }
- $message = str_replace($search, $replace, $GLOBALS["strSetup$lang_key"]);
- // replace [a@"$1"]$2[/a] with <a href="$1">$2</a>
- $message = preg_replace('#\[a@("?)([^\]]+)\1\]([^\[]+)\[/a\]#e',
- "PMA_lang_link_replace('$2', '$3')", $message);
-
- if (func_num_args() == 1) {
- return $message;
- } else {
- $args = func_get_args();
- array_shift($args);
- return vsprintf($message, $args);
- }
-}
-
-/**
- * Returns translated field name
- *
- * @param string $canonical_path
- * @return string
- */
-function PMA_lang_name($canonical_path)
-{
- $lang_key = str_replace(
- array('Servers/1/', '/'),
- array('Servers/', '_'),
- $canonical_path) . '_name';
- return isset($GLOBALS["strSetup$lang_key"])
- ? $GLOBALS["strSetup$lang_key"]
- : $lang_key;
-}
-
-/**
- * Returns translated field description
- *
- * @param string $canonical_path
- * @return string
- */
-function PMA_lang_desc($canonical_path)
-{
- $lang_key = str_replace(
- array('Servers/1/', '/'),
- array('Servers/', '_'),
- $canonical_path) . '_desc';
- return isset($GLOBALS["strSetup$lang_key"])
- ? PMA_lang($lang_key)
- : '';
-}
-
-/**
- * Wraps link in <a> tags and replaces argument separator in internal links
- * to the one returned by PMA_get_arg_separator()
- *
- * @param string $link
- * @param string $text
- * @return string
- */
-function PMA_lang_link_replace($link, $text)
-{
- static $separator;
-
- if (!isset($separator)) {
- $separator = PMA_get_arg_separator('html');
- }
-
- if (!preg_match('#^http://#', $link)) {
- $link = str_replace('&', $separator, $link);
- }
-
- return '<a href="' . $link . '">' . $text . '</a>';
-}
-?>
+?>
\ No newline at end of file
diff --git a/setup/lib/config_info.inc.php b/setup/lib/config_info.inc.php
deleted file mode 100644
index 71f2e23..0000000
--- a/setup/lib/config_info.inc.php
+++ /dev/null
@@ -1,144 +0,0 @@
-<?php
-/**
- * Description of options with non-standard values, list of persistent options
- * and validator assignments.
- *
- * By default data types are taken from config.default.php, here we define
- * only allowed values for select fields and type overrides.
- *
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
- */
-
-if (!defined('PHPMYADMIN')) {
- exit;
-}
-
-$cfg_db = array();
-
-// path to config file, relative to phpMyAdmin's root path
-$cfg_db['_config_file_path'] = SETUP_CONFIG_FILE;
-
-/**
- * Value meaning:
- * o array - select field, array contains allowed values
- * o string - type override
- *
- * Use normal array, paths won't be expanded
- */
-$cfg_db['Servers'] = array(1 => array(
- 'port' => 'integer',
- 'connect_type' => array('tcp', 'socket'),
- 'extension' => array('mysql', 'mysqli'),
- 'auth_type' => array('config', 'http', 'signon', 'cookie'),
- 'AllowDeny' => array(
- 'order' => array('', 'deny,allow', 'allow,deny', 'explicit')),
- 'only_db' => 'array'));
-$cfg_db['RecodingEngine'] = array('auto', 'iconv', 'recode', 'none');
-$cfg_db['OBGzip'] = array('auto', true, false);
-$cfg_db['ShowTooltipAliasTB'] = array('nested', true, false);
-$cfg_db['DisplayDatabasesList'] = array('auto', true, false);
-$cfg_db['LeftLogoLinkWindow'] = array('main', 'new');
-$cfg_db['LeftDefaultTabTable'] = array(
- 'tbl_structure.php', // fields list
- 'tbl_sql.php', // SQL form
- 'tbl_select.php', // search page
- 'tbl_change.php', // insert row page
- 'sql.php'); // browse page
-$cfg_db['NavigationBarIconic'] = array(true, false, 'both');
-$cfg_db['Order'] = array('ASC', 'DESC', 'SMART');
-$cfg_db['ProtectBinary'] = array(false, 'blob', 'all');
-$cfg_db['CharEditing'] = array('input', 'textarea');
-$cfg_db['PropertiesIconic'] = array(true, false, 'both');
-$cfg_db['DefaultTabServer'] = array(
- 'main.php', // the welcome page (recommended for multiuser setups)
- 'server_databases.php', // list of databases
- 'server_status.php', // runtime information
- 'server_variables.php', // MySQL server variables
- 'server_privileges.php', // user management
- 'server_processlist.php'); // process list
-$cfg_db['DefaultTabDatabase'] = array(
- 'db_structure.php', // tables list
- 'db_sql.php', // SQL form
- 'db_search.php', // search query
- 'db_operations.php'); // operations on database
-$cfg_db['DefaultTabTable'] = array(
- 'tbl_structure.php', // fields list
- 'tbl_sql.php', // SQL form
- 'tbl_select.php', // search page
- 'tbl_change.php', // insert row page
- 'sql.php'); // browse page
-$cfg_db['QueryWindowDefTab'] = array(
- 'sql', // SQL
- 'files', // Import files
- 'history', // SQL history
- 'full'); // All (SQL and SQL history)
-$cfg_db['Import']['format'] = array(
- 'csv', // CSV
- 'docsql', // DocSQL
- 'ldi', // CSV using LOAD DATA
- 'sql'); // SQL
-$cfg_db['Import']['sql_compatibility'] = array(
- 'NONE', 'ANSI', 'DB2', 'MAXDB', 'MYSQL323', 'MYSQL40', 'MSSQL', 'ORACLE',
- // removed; in MySQL 5.0.33, this produces exports that
- // can't be read by POSTGRESQL (see our bug #1596328)
- //'POSTGRESQL',
- 'TRADITIONAL');
-$cfg_db['Import']['ldi_local_option'] = array('auto', true, false);
-$cfg_db['Export']['format'] = array('codegen', 'csv', 'excel', 'htmlexcel',
- 'htmlword', 'latex', 'ods', 'odt', 'pdf', 'sql', 'texytext', 'xls', 'xml',
- 'yaml');
-$cfg_db['Export']['compression'] = array('none', 'zip', 'gzip', 'bzip2');
-$cfg_db['Export']['charset'] = array_merge(array(''), $GLOBALS['cfg']['AvailableCharsets']);
-$cfg_db['Export']['method'] = array('quick', 'custom', 'custom-no-form');
-
-/**
- * Config options which will be placed in config file even if they are set
- * to their default values (use only full paths)
- */
-$persist_keys = array(
- 'DefaultLang',
- 'ServerDefault',
- 'UploadDir',
- 'SaveDir',
- 'Servers/1/verbose',
- 'Servers/1/host',
- 'Servers/1/port',
- 'Servers/1/socket',
- 'Servers/1/extension',
- 'Servers/1/connect_type',
- 'Servers/1/auth_type',
- 'Servers/1/user',
- 'Servers/1/password');
-
-/**
- * Default values overrides
- * Use only full paths
- */
-$cfg_db['_overrides'] = array();
-$cfg_db['_overrides']['Servers/1/extension'] = extension_loaded('mysqli')
- ? 'mysqli' : 'mysql';
-
-/**
- * Validator assignments (functions from validate.lib.php and 'validators'
- * object in scripts.js)
- * Use only full paths and form ids
- */
-$cfg_db['_validators'] = array(
- 'Server' => 'validate_server',
- 'Server_pmadb' => 'validate_pmadb',
- 'Servers/1/port' => 'validate_port_number',
- 'Servers/1/hide_db' => 'validate_regex',
- 'TrustedProxies' => 'validate_trusted_proxies',
- 'LoginCookieValidity' => 'validate_positive_number',
- 'LoginCookieStore' => 'validate_non_negative_number',
- 'QueryHistoryMax' => 'validate_positive_number',
- 'LeftFrameTableLevel' => 'validate_positive_number',
- 'MaxRows' => 'validate_positive_number',
- 'CharTextareaCols' => 'validate_positive_number',
- 'CharTextareaRows' => 'validate_positive_number',
- 'InsertRows' => 'validate_positive_number',
- 'ForeignKeyMaxLimit' => 'validate_positive_number',
- 'Import/skip_queries' => 'validate_non_negative_number');
-?>
diff --git a/setup/lib/form_processing.lib.php b/setup/lib/form_processing.lib.php
index 7128a61..7bad38c 100644
--- a/setup/lib/form_processing.lib.php
+++ b/setup/lib/form_processing.lib.php
@@ -1,10 +1,9 @@
<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Formset processing library
*
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
+ * @package phpMyAdmin-setup
*/
/**
@@ -41,13 +40,13 @@ function process_formset(FormDisplay $form_display) {
?>
<div class="warning">
<h4><?php echo __('Warning') ?></h4>
- <?php echo PMA_lang('error_form') ?><br />
- <a href="?page=<?php echo $page . $formset . $id . $separator ?>mode=revert"><?php echo PMA_lang('RevertErroneousFields') ?></a>
+ <?php echo __('Submitted form contains errors') ?><br />
+ <a href="?page=<?php echo $page . $formset . $id . $separator ?>mode=revert"><?php echo __('Try to revert erroneous fields to their default values') ?></a>
</div>
<?php $form_display->displayErrors() ?>
- <a class="btn" href="index.php"><?php echo PMA_lang('IgnoreErrors') ?></a>
+ <a class="btn" href="index.php"><?php echo __('Ignore errors') ?></a>
- <a class="btn" href="?page=<?php echo $page . $formset . $id . $separator ?>mode=edit"><?php echo PMA_lang('ShowForm') ?></a>
+ <a class="btn" href="?page=<?php echo $page . $formset . $id . $separator ?>mode=edit"><?php echo __('Show form') ?></a>
<?php
} else {
// drop post data
diff --git a/setup/lib/forms.inc.php b/setup/lib/forms.inc.php
deleted file mode 100644
index 3219709..0000000
--- a/setup/lib/forms.inc.php
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
-/**
- * List of avaible forms, each form is described as an array of fields to display.
- * Fields MUST have their counterparts in the $cfg array.
- *
- * There are two possible notations:
- * $forms['Form name'] = array('Servers' => array(1 => array('host')));
- * can be written as
- * $forms['Form name'] = array('Servers/1/host');
- *
- * You can assign default values set by special button ("set value: ..."), eg.:
- * $forms['Server_pmadb'] = array('Servers' => array(1 => array(
- * 'pmadb' => 'phpmyadmin')));
- *
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
- */
-
-$forms = array();
-$forms['_config.php'] = array(
- 'DefaultLang',
- 'ServerDefault');
-$forms['Server'] = array('Servers' => array(1 => array(
- 'verbose',
- 'host',
- 'port',
- 'socket',
- 'ssl',
- 'connect_type',
- 'extension',
- 'compress',
- 'auth_type',
- 'auth_http_realm',
- 'user',
- 'password',
- 'nopassword',
- 'auth_swekey_config' => './swekey.conf')));
-$forms['Server_login_options'] = array('Servers' => array(1 => array(
- 'SignonSession',
- 'SignonURL',
- 'LogoutURL')));
-$forms['Server_config'] = array('Servers' => array(1 => array(
- 'only_db',
- 'hide_db',
- 'AllowRoot',
- 'AllowNoPassword',
- 'DisableIS',
- 'AllowDeny/order',
- 'AllowDeny/rules',
- 'ShowDatabasesCommand',
- 'CountTables')));
-$forms['Server_pmadb'] = array('Servers' => array(1 => array(
- 'pmadb' => 'phpmyadmin',
- 'controluser',
- 'controlpass',
- 'verbose_check',
- 'bookmarktable' => 'pma_bookmark',
- 'relation' => 'pma_relation',
- 'table_info' => 'pma_table_info',
- 'table_coords' => 'pma_table_coords',
- 'pdf_pages' => 'pma_pdf_pages',
- 'column_info' => 'pma_column_info',
- 'history' => 'pma_history',
- 'tracking' => 'pma_tracking',
- 'designer_coords' => 'pma_designer_coords')));
-$forms['Server_tracking'] = array('Servers' => array(1 => array(
- 'tracking_version_auto_create',
- 'tracking_default_statements',
- 'tracking_add_drop_view',
- 'tracking_add_drop_table',
- 'tracking_add_drop_database',
-)));
-$forms['Import_export'] = array(
- 'UploadDir',
- 'SaveDir',
- 'RecodingEngine',
- 'IconvExtraParams',
- 'ZipDump',
- 'GZipDump',
- 'BZipDump',
- 'CompressOnFly');
-$forms['Security'] = array(
- 'blowfish_secret',
- 'ForceSSL',
- 'CheckConfigurationPermissions',
- 'TrustedProxies',
- 'AllowUserDropDatabase',
- 'AllowArbitraryServer',
- 'LoginCookieRecall',
- 'LoginCookieValidity',
- 'LoginCookieStore',
- 'LoginCookieDeleteAll');
-$forms['Sql_queries'] = array(
- 'ShowSQL',
- 'Confirm',
- 'QueryHistoryDB',
- 'QueryHistoryMax',
- 'IgnoreMultiSubmitErrors',
- 'VerboseMultiSubmit');
-$forms['Other_core_settings'] = array(
- 'MaxDbList',
- 'MaxTableList',
- 'MaxCharactersInDisplayedSQL',
- 'OBGzip',
- 'PersistentConnections',
- 'ExecTimeLimit',
- 'MemoryLimit',
- 'SkipLockedTables',
- 'UseDbSearch');
-$forms['Left_frame'] = array(
- 'LeftFrameLight',
- 'LeftDisplayLogo',
- 'LeftLogoLink',
- 'LeftLogoLinkWindow',
- 'LeftDefaultTabTable',
- 'LeftPointerEnable');
-$forms['Left_servers'] = array(
- 'LeftDisplayServers',
- 'DisplayServersList');
-$forms['Left_databases'] = array(
- 'DisplayDatabasesList',
- 'LeftFrameDBTree',
- 'LeftFrameDBSeparator',
- 'ShowTooltipAliasDB');
-$forms['Left_tables'] = array(
- 'LeftFrameTableSeparator',
- 'LeftFrameTableLevel',
- 'ShowTooltip',
- 'ShowTooltipAliasTB');
-$forms['Startup'] = array(
- 'ShowStats',
- 'ShowPhpInfo',
- 'ShowServerInfo',
- 'ShowChgPassword',
- 'ShowCreateDb',
- 'SuggestDBName');
-$forms['Browse'] = array(
- 'NavigationBarIconic',
- 'ShowAll',
- 'MaxRows',
- 'Order',
- 'BrowsePointerEnable',
- 'BrowseMarkerEnable');
-$forms['Edit'] = array(
- 'ProtectBinary',
- 'ShowFunctionFields',
- 'CharEditing',
- 'CharTextareaCols',
- 'CharTextareaRows',
- 'InsertRows',
- 'ForeignKeyDropdownOrder',
- 'ForeignKeyMaxLimit');
-$forms['Tabs'] = array(
- 'LightTabs',
- 'PropertiesIconic',
- 'DefaultTabServer',
- 'DefaultTabDatabase',
- 'DefaultTabTable',
- 'QueryWindowDefTab');
-$forms['Sql_box'] = array('SQLQuery' => array(
- 'Edit',
- 'Explain',
- 'ShowAsPHP',
- 'Validate',
- 'Refresh'));
-$forms['Import_defaults'] = array('Import' => array(
- 'format',
- 'allow_interrupt',
- 'skip_queries'));
-$forms['Export_defaults'] = array('Export' => array(
- 'format',
- 'method',
- 'compression',
- 'asfile',
- 'charset',
- 'onserver',
- 'onserver_overwrite',
- 'remember_file_template',
- 'file_template_table',
- 'file_template_database',
- 'file_template_server'));
-?>
diff --git a/setup/lib/index.lib.php b/setup/lib/index.lib.php
index 115cc9f..17c9cf6 100644
--- a/setup/lib/index.lib.php
+++ b/setup/lib/index.lib.php
@@ -1,14 +1,12 @@
<?php
-
+/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Various checks and message functions used on index page.
*
* Security checks are the idea of Aung Khant <aungkhant[at]yehg.net>, http://yehg.net/lab
* Version check taken from the old setup script by Michal Čihař <michal(a)cihar.com>
*
- * @package phpMyAdmin-setup
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
+ * @package phpMyAdmin-setup
*/
if (!defined('PHPMYADMIN')) {
@@ -44,7 +42,6 @@ function messages_begin()
function messages_set($type, $id, $title, $message)
{
$fresh = !isset($_SESSION['messages'][$type][$id]);
- $title = PMA_lang($title);
$_SESSION['messages'][$type][$id] = array(
'fresh' => $fresh,
'active' => true,
@@ -118,15 +115,15 @@ function PMA_version_check()
$data = curl_exec($ch);
curl_close($ch);
} else {
- messages_set('error', $message_id, 'VersionCheck',
- PMA_lang('VersionCheckWrapperError'));
+ messages_set('error', $message_id, __('Version check'),
+ __('Neither URL wrapper nor CURL is available. Version check is not possible.'));
return;
}
}
if (empty($data)) {
- messages_set('error', $message_id, 'VersionCheck',
- PMA_lang('VersionCheckDataError'));
+ messages_set('error', $message_id, __('Version check'),
+ __('Reading of version failed. Maybe you\'re offline or the upgrade server does not respond.'));
return;
}
@@ -142,30 +139,30 @@ function PMA_version_check()
$version_upstream = version_to_int($version);
if ($version_upstream === false) {
- messages_set('error', $message_id, 'VersionCheck',
- PMA_lang('VersionCheckInvalid'));
+ messages_set('error', $message_id, __('Version check'),
+ __('Got invalid version string from server'));
return;
}
$version_local = version_to_int($GLOBALS['PMA_Config']->get('PMA_VERSION'));
if ($version_local === false) {
- messages_set('error', $message_id, 'VersionCheck',
- PMA_lang('VersionCheckUnparsable'));
+ messages_set('error', $message_id, __('Version check'),
+ __('Unparsable version string'));
return;
}
if ($version_upstream > $version_local) {
$version = htmlspecialchars($version);
$date = htmlspecialchars($date);
- messages_set('notice', $message_id, 'VersionCheck',
- PMA_lang('VersionCheckNewAvailable', $version, $date));
+ messages_set('notice', $message_id, __('Version check'),
+ sprintf(__('A newer version of phpMyAdmin is available and you should consider upgrading. The newest version is %s, released on %s.'), $version, $date));
} else {
if ($version_local % 100 == 0) {
- messages_set('notice', $message_id, 'VersionCheck',
- PMA_lang('VersionCheckNewAvailableSvn', $version, $date));
+ messages_set('notice', $message_id, __('Version check'),
+ PMA_sanitize(sprintf(__('You are using Git version, run [kbd]git pull[/kbd] :-)[br]The latest stable version is %s, released on %s.'), $version, $date)));
} else {
- messages_set('notice', $message_id, 'VersionCheck',
- PMA_lang('VersionCheckNone'));
+ messages_set('notice', $message_id, __('Version check'),
+ __('No newer stable version is available'));
}
}
}
@@ -200,7 +197,7 @@ function version_to_int($version)
$added = 0;
break;
default:
- messages_set('notice', 'version_match', 'VersionCheck',
+ messages_set('notice', 'version_match', __('Version check'),
'Unknown version part: ' . htmlspecialchars($matches[6]));
$added = 0;
break;
@@ -249,6 +246,19 @@ function perform_config_checks()
$blowfish_secret = $cf->get('blowfish_secret');
$blowfish_secret_set = false;
$cookie_auth_used = false;
+
+ $strAllowArbitraryServerWarning = __('This [a@?page=form&formset=features#tab_Security]option[/a] should be disabled as it allows attackers to bruteforce login to any MySQL server. If you feel this is necessary, use [a@?page=form&formset=features#tab_Security]trusted proxies list[/a]. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.');
+ $strBlowfishSecretMsg = __('You didn\'t have blowfish secret set and have enabled cookie authentication, so a key was automatically generated for you. It is used to encrypt cookies; you don\'t need to remember it.');
+ $strBZipDumpWarning = __('[a@?page=form&formset=features#tab_Import_export]Bzip2 compression and decompression[/a] requires functions (%s) which are unavailable on this system.');
+ $strDirectoryNotice = __('This value should be double checked to ensure that this directory is neither world accessible nor readable or writable by other users on your server.');
+ $strForceSSLNotice = __('This [a@?page=form&formset=features#tab_Security]option[/a] should be enabled if your web server supports it');
+ $strGZipDumpWarning = __('[a@?page=form&formset=features#tab_Import_export]GZip compression and decompression[/a] requires functions (%s) which are unavailable on this system.');
+ $strLoginCookieValidityWarning = __('[a@?page=form&formset=features#tab_Security]Login cookie validity[/a] should be set to 1800 seconds (30 minutes) at most. Values larger than 1800 may pose a security risk such as impersonation.');
+ $strSecurityInfoMsg = __('If you feel this is necessary, use additional protection settings - [a@?page=servers&mode=edit&id=%1$d#tab_Server_config]host authentication[/a] settings and [a@?page=form&formset=features#tab_Security]trusted proxies list[/a]. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.');
+ $strServerAuthConfigMsg = __('You set the [kbd]config[/kbd] authentication type and included username and password for auto-login, which is not a desirable option for live hosts. Anyone who knows or guesses your phpMyAdmin URL can directly access your phpMyAdmin panel. Set [a@?page=servers&mode=edit&id=%1$d#tab_Server]authentication type[/a] to [kbd]cookie[/kbd] or [kbd]http[/kbd].');
+ $strZipDumpExportWarning = __('[a@?page=form&formset=features#tab_Import_export]Zip compression[/a] requires functions (%s) which are unavailable on this system.');
+ $strZipDumpImportWarning = __('[a@?page=form&formset=features#tab_Import_export]Zip decompression[/a] requires functions (%s) which are unavailable on this system.');
+
for ($i = 1, $server_cnt = $cf->getServerCount(); $i <= $server_cnt; $i++) {
$cookie_auth_server = ($cf->getValue("Servers/$i/auth_type") == 'cookie');
$cookie_auth_used |= $cookie_auth_server;
@@ -268,9 +278,9 @@ function perform_config_checks()
// should be enabled if possible
//
if (!$cf->getValue("Servers/$i/ssl")) {
- $title = PMA_lang_name('Servers/1/ssl') . " ($server_name)";
+ $title = PMA_lang(PMA_lang_name('Servers/1/ssl')) . " ($server_name)";
messages_set('notice', "Servers/$i/ssl", $title,
- PMA_lang('ServerSslMsg'));
+ __('You should use SSL connections if your web server supports it'));
}
//
@@ -278,9 +288,9 @@ function perform_config_checks()
// warn about using 'mysql'
//
if ($cf->getValue("Servers/$i/extension") == 'mysql') {
- $title = PMA_lang_name('Servers/1/extension') . " ($server_name)";
+ $title = PMA_lang(PMA_lang_name('Servers/1/extension')) . " ($server_name)";
messages_set('notice', "Servers/$i/extension", $title,
- PMA_lang('ServerExtensionMsg'));
+ __('You should use mysqli for performance reasons'));
}
//
@@ -288,12 +298,12 @@ function perform_config_checks()
// warn about full user credentials if 'auth_type' is 'config'
//
if ($cf->getValue("Servers/$i/auth_type") == 'config'
- && $cf->getValue("Servers/$i/user") != ''
- && $cf->getValue("Servers/$i/password") != '') {
- $title = PMA_lang_name('Servers/1/auth_type') . " ($server_name)";
+ && $cf->getValue("Servers/$i/user") != ''
+ && $cf->getValue("Servers/$i/password") != '') {
+ $title = PMA_lang(PMA_lang_name('Servers/1/auth_type')) . " ($server_name)";
messages_set('warning', "Servers/$i/auth_type", $title,
- PMA_lang('ServerAuthConfigMsg', $i) . ' ' .
- PMA_lang('ServerSecurityInfoMsg', $i));
+ PMA_lang($strServerAuthConfigMsg, $i) . ' ' .
+ PMA_lang($strSecurityInfoMsg, $i));
}
//
@@ -302,11 +312,11 @@ function perform_config_checks()
// serious security flaw
//
if ($cf->getValue("Servers/$i/AllowRoot")
- && $cf->getValue("Servers/$i/AllowNoPassword")) {
- $title = PMA_lang_name('Servers/1/AllowNoPassword') . " ($server_name)";
+ && $cf->getValue("Servers/$i/AllowNoPassword")) {
+ $title = PMA_lang(PMA_lang_name('Servers/1/AllowNoPassword')) . " ($server_name)";
messages_set('warning', "Servers/$i/AllowNoPassword", $title,
- PMA_lang('ServerNoPasswordMsg') . ' ' .
- PMA_lang('ServerSecurityInfoMsg', $i));
+ __('You allow for connecting to the server without a password.') . ' ' .
+ PMA_lang($strSecurityInfoMsg, $i));
}
}
@@ -317,25 +327,27 @@ function perform_config_checks()
if ($cookie_auth_used) {
if ($blowfish_secret_set) {
// 'cookie' auth used, blowfish_secret was generated
- messages_set('notice', 'blowfish_secret_created', 'blowfish_secret_name',
- PMA_lang('BlowfishSecretMsg'));
+ messages_set('notice', 'blowfish_secret_created',
+ PMA_lang(PMA_lang_name('blowfish_secret')),
+ $strBlowfishSecretMsg);
} else {
$blowfish_warnings = array();
// check length
if (strlen($blowfish_secret) < 8) {
// too short key
- $blowfish_warnings[] = PMA_lang('BlowfishSecretLengthMsg');
+ $blowfish_warnings[] = __('Key is too short, it should have at least 8 characters');
}
// check used characters
$has_digits = (bool) preg_match('/\d/', $blowfish_secret);
$has_chars = (bool) preg_match('/\S/', $blowfish_secret);
$has_nonword = (bool) preg_match('/\W/', $blowfish_secret);
if (!$has_digits || !$has_chars || !$has_nonword) {
- $blowfish_warnings[] = PMA_lang('BlowfishSecretCharsMsg');
+ $blowfish_warnings[] = PMA_lang(__('Key should contain letters, numbers [em]and[/em] special characters'));
}
if (!empty($blowfish_warnings)) {
messages_set('warning', 'blowfish_warnings' . count($blowfish_warnings),
- 'blowfish_secret_name', implode("<br />", $blowfish_warnings));
+ PMA_lang(PMA_lang_name('blowfish_secret')),
+ implode("<br />", $blowfish_warnings));
}
}
}
@@ -345,8 +357,9 @@ function perform_config_checks()
// should be enabled if possible
//
if (!$cf->getValue('ForceSSL')) {
- messages_set('notice', 'ForceSSL', 'ForceSSL_name',
- PMA_lang('ForceSSLMsg'));
+ messages_set('notice', 'ForceSSL',
+ PMA_lang(PMA_lang_name('ForceSSL')),
+ PMA_lang($strForceSSLNotice));
}
//
@@ -354,8 +367,9 @@ function perform_config_checks()
// should be disabled
//
if ($cf->getValue('AllowArbitraryServer')) {
- messages_set('warning', 'AllowArbitraryServer', 'AllowArbitraryServer_name',
- PMA_lang('AllowArbitraryServerMsg'));
+ messages_set('warning', 'AllowArbitraryServer',
+ PMA_lang(PMA_lang_name('AllowArbitraryServer')),
+ PMA_lang($strAllowArbitraryServerWarning));
}
//
@@ -363,8 +377,9 @@ function perform_config_checks()
// should be at most 1800 (30 min)
//
if ($cf->getValue('LoginCookieValidity') > 1800) {
- messages_set('warning', 'LoginCookieValidity', 'LoginCookieValidity_name',
- PMA_lang('LoginCookieValidityMsg'));
+ messages_set('warning', 'LoginCookieValidity',
+ PMA_lang(PMA_lang_name('LoginCookieValidity')),
+ PMA_lang($strLoginCookieValidityWarning));
}
//
@@ -372,8 +387,9 @@ function perform_config_checks()
// should not be world-accessible
//
if ($cf->getValue('SaveDir') != '') {
- messages_set('notice', 'SaveDir', 'SaveDir_name',
- PMA_lang('DirectoryNotice'));
+ messages_set('notice', 'SaveDir',
+ PMA_lang(PMA_lang_name('SaveDir')),
+ PMA_lang($strDirectoryNotice));
}
//
@@ -381,8 +397,9 @@ function perform_config_checks()
// should not be world-accessible
//
if ($cf->getValue('TempDir') != '') {
- messages_set('notice', 'TempDir', 'TempDir_name',
- PMA_lang('DirectoryNotice'));
+ messages_set('notice', 'TempDir',
+ PMA_lang(PMA_lang_name('TempDir')),
+ PMA_lang($strDirectoryNotice));
}
//
@@ -390,9 +407,10 @@ function perform_config_checks()
// requires zlib functions
//
if ($cf->getValue('GZipDump')
- && (@!function_exists('gzopen') || @!function_exists('gzencode'))) {
- messages_set('warning', 'GZipDump', 'GZipDump_name',
- PMA_lang('GZipDumpWarning', 'gzencode'));
+ && (@!function_exists('gzopen') || @!function_exists('gzencode'))) {
+ messages_set('warning', 'GZipDump',
+ PMA_lang(PMA_lang_name('GZipDump')),
+ PMA_lang($strGZipDumpWarning, 'gzencode'));
}
//
@@ -400,15 +418,16 @@ function perform_config_checks()
// requires bzip2 functions
//
if ($cf->getValue('BZipDump')
- && (!@function_exists('bzopen') || !@function_exists('bzcompress'))) {
+ && (!@function_exists('bzopen') || !@function_exists('bzcompress'))) {
$functions = @function_exists('bzopen')
- ? '' :
- 'bzopen';
+ ? '' :
+ 'bzopen';
$functions .= @function_exists('bzcompress')
- ? ''
- : ($functions ? ', ' : '') . 'bzcompress';
- messages_set('warning', 'BZipDump', 'BZipDump_name',
- PMA_lang('BZipDumpWarning', $functions));
+ ? ''
+ : ($functions ? ', ' : '') . 'bzcompress';
+ messages_set('warning', 'BZipDump',
+ PMA_lang(PMA_lang_name('BZipDump')),
+ PMA_lang($strBZipDumpWarning, $functions));
}
//
@@ -416,8 +435,9 @@ function perform_config_checks()
// requires zip_open in import
//
if ($cf->getValue('ZipDump') && !@function_exists('zip_open')) {
- messages_set('warning', 'ZipDump_import', 'ZipDump_name',
- PMA_lang('ZipDumpImportWarning', 'zip_open'));
+ messages_set('warning', 'ZipDump_import',
+ PMA_lang(PMA_lang_name('ZipDump')),
+ PMA_lang($strZipDumpImportWarning, 'zip_open'));
}
//
@@ -425,8 +445,9 @@ function perform_config_checks()
// requires gzcompress in export
//
if ($cf->getValue('ZipDump') && !@function_exists('gzcompress')) {
- messages_set('warning', 'ZipDump_export', 'ZipDump_name',
- PMA_lang('ZipDumpExportWarning', 'gzcompress'));
+ messages_set('warning', 'ZipDump_export',
+ PMA_lang(PMA_lang_name('ZipDump')),
+ PMA_lang($strZipDumpExportWarning, 'gzcompress'));
}
}
-?>
+?>
\ No newline at end of file
diff --git a/setup/lib/messages.inc.php b/setup/lib/messages.inc.php
deleted file mode 100644
index 4284485..0000000
--- a/setup/lib/messages.inc.php
+++ /dev/null
@@ -1,381 +0,0 @@
-<?php
-/* $Id$ */
-/**
- * Messages for phpMyAdmin.
- *
- * This file is here for easy transition to Gettext. You should not add any
- * new messages here, use instead gettext directly in your template/PHP
- * file.
- */
-
-if (!function_exists('__')) {
- die('Bad invocation!');
-}
-
-
-$strSetupAllowArbitraryServer_desc = __('If enabled user can enter any MySQL server in login form for cookie auth');
-$strSetupAllowArbitraryServerMsg = __('This [a@?page=form&formset=features#tab_Security]option[/a] should be disabled as it allows attackers to bruteforce login to any MySQL server. If you feel this is necessary, use [a@?page=form&formset=features#tab_Security]trusted proxies list[/a]. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.');
-$strSetupAllowArbitraryServer_name = __('Allow login to any MySQL server');
-$strSetupAllowUserDropDatabase_name = __('Show "Drop database" link to normal users');
-$strSetupBlowfishSecretCharsMsg = __('Key should contain letters, numbers [em]and[/em] special characters');
-$strSetupblowfish_secret_desc = __('Secret passphrase used for encrypting cookies in [kbd]cookie[/kbd] authentication');
-$strSetupBlowfishSecretLengthMsg = __('Key is too short, it should have at least 8 characters');
-$strSetupBlowfishSecretMsg = __('You didn\'t have blowfish secret set and have enabled cookie authentication, so a key was automatically generated for you. It is used to encrypt cookies; you don\'t need to remember it.');
-$strSetupblowfish_secret_name = __('Blowfish secret');
-$strSetupBrowseMarkerEnable_desc = __('Highlight selected rows');
-$strSetupBrowseMarkerEnable_name = __('Row marker');
-$strSetupBrowsePointerEnable_desc = __('Highlight row pointed by the mouse cursor');
-$strSetupBrowsePointerEnable_name = __('Highlight pointer');
-$strSetupBZipDump_desc = __('Enable [a@http://en.wikipedia.org/wiki/Bzip2]bzip2[/a] compression for import and export operations');
-$strSetupBZipDump_name = __('Bzip2');
-$strSetupBZipDumpWarning = __('[a@?page=form&formset=features#tab_Import_export]Bzip2 compression and decompression[/a] requires functions (%s) which are unavailable on this system.');
-$strSetupCannotLoadConfig = __('Cannot load or save configuration');
-$strSetupCannotLoadConfigMsg = __('Please create web server writable folder [em]config[/em] in phpMyAdmin top level directory as described in [a@../Documentation.html#setup_script]documentation[/a]. Otherwise you will be only able to download or display it.');
-$strSetupCharEditing_desc = __('Defines which type of editing controls should be used for CHAR and VARCHAR columns; [kbd]input[/kbd] - allows limiting of input length, [kbd]textarea[/kbd] - allows newlines in columns');
-$strSetupCharEditing_name = __('CHAR columns editing');
-$strSetupCharTextareaCols_desc = __('Number of columns for CHAR/VARCHAR textareas');
-$strSetupCharTextareaCols_name = __('CHAR textarea columns');
-$strSetupCharTextareaRows_desc = __('Number of rows for CHAR/VARCHAR textareas');
-$strSetupCharTextareaRows_name = __('CHAR textarea rows');
-$strSetupCheckConfigurationPermissions_name = __('Check config file permissions');
-$strSetupClear = __('Clear');
-$strSetupCompressOnFly_desc = __('Compress gzip/bzip2 exports on the fly without the need for much memory; if you encounter problems with created gzip/bzip2 files disable this feature');
-$strSetupCompressOnFly_name = __('Compress on the fly');
-$strSetupConfigurationFile = __('Configuration file');
-$strSetupConfirm_desc = __('Whether a warning ("Are your really sure...") should be displayed when you\'re about to lose data');
-$strSetupConfirm_name = __('Confirm DROP queries');
-$strSetupDefaultLanguage = __('Default language');
-$strSetupDefaultServer = __('Default server');
-$strSetupDefaultTabDatabase_desc = __('Tab that is displayed when entering a database');
-$strSetupDefaultTabDatabase_name = __('Default database tab');
-$strSetupDefaultTabServer_desc = __('Tab that is displayed when entering a server');
-$strSetupDefaultTabServer_name = __('Default server tab');
-$strSetupDefaultTabTable_desc = __('Tab that is displayed when entering a table');
-$strSetupDefaultTabTable_name = __('Default table tab');
-$strSetupDirectoryNotice = __('This value should be double checked to ensure that this directory is neither world accessible nor readable or writable by other users on your server.');
-$strSetupDisplayDatabasesList_desc = __('Show database listing as a list instead of a drop down');
-$strSetupDisplayDatabasesList_name = __('Display databases as a list');
-$strSetupDisplay = __('Display');
-$strSetupDisplayServersList_desc = __('Show server listing as a list instead of a drop down');
-$strSetupDisplayServersList_name = __('Display servers as a list');
-$strSetupDonateLink = __('Donate');
-$strSetupDownload = __('Download');
-$strSetupEndOfLine = __('End of line');
-$strSetuperror_connection = __('Could not connect to MySQL server');
-$strSetuperror_empty_pmadb_password = __('Empty phpMyAdmin control user password while using pmadb');
-$strSetuperror_empty_pmadb_user = __('Empty phpMyAdmin control user while using pmadb');
-$strSetuperror_empty_signon_session = __('Empty signon session name while using signon authentication method');
-$strSetuperror_empty_signon_url = __('Empty signon URL while using signon authentication method');
-$strSetuperror_empty_user_for_config_auth = __('Empty username while using config authentication method');
-$strSetuperror_form = __('Submitted form contains errors');
-$strSetuperror_incorrect_ip_address = __('Incorrect IP address: %s');
-$strSetuperror_incorrect_port = __('Not a valid port number');
-$strSetuperror_incorrect_value = __('Incorrect value');
-$strSetuperror_missing_field_data = __('Missing data for %s');
-$strSetuperror_nan_nneg = __('Not a non-negative number');
-$strSetuperror_nan_p = __('Not a positive number');
-$strSetupExecTimeLimit_desc = __('Set the number of seconds a script is allowed to run ([kbd]0[/kbd] for no limit)');
-$strSetupExecTimeLimit_name = __('Maximum execution time');
-$strSetupExport_asfile_name = __('Save as file');
-$strSetupExport_charset_name = __('Character set of the file');
-$strSetupExport_compression_name = __('Compression');
-$strSetupExport_file_template_database_name = __('Database name template');
-$strSetupExport_file_template_server_name = __('Server name template');
-$strSetupExport_file_template_table_name = __('Table name template');
-$strSetupExport_format_name = __('Format');
-$strSetupExport_method_name = __('Method');
-$strSetupExport_onserver_name = __('Save on server');
-$strSetupExport_onserver_overwrite_name = __('Overwrite existing file(s)');
-$strSetupExport_remember_file_template_name = __('Remember file name template');
-$strSetupFalse = __('no');
-$strSetupForceSSL_desc = __('Force secured connection while using phpMyAdmin');
-$strSetupForceSSLMsg = __('This [a@?page=form&formset=features#tab_Security]option[/a] should be enabled if your web server supports it');
-$strSetupForceSSL_name = __('Force SSL connection');
-$strSetupForeignKeyDropdownOrder_desc = __('Sort order for items in a foreign-key dropdown box; [kbd]content[/kbd] is the referenced data, [kbd]id[/kbd] is the key value');
-$strSetupForeignKeyDropdownOrder_name = __('Foreign key dropdown order');
-$strSetupForeignKeyMaxLimit_desc = __('A dropdown will be used if fewer items are present');
-$strSetupForeignKeyMaxLimit_name = __('Foreign key limit');
-$strSetupForm_Browse = __('Browse mode');
-$strSetupForm_Browse_desc = __('Customize browse mode');
-$strSetupForm_Edit_desc = __('Customize edit mode');
-$strSetupForm_Edit = __('Edit mode');
-$strSetupForm_Export_defaults_desc = __('Customize default export options');
-$strSetupForm_Export_defaults = __('Export defaults');
-$strSetupForm_Import_defaults_desc = __('Customize default common import options');
-$strSetupForm_Import_defaults = __('Import defaults');
-$strSetupForm_Import_export_desc = __('Set import and export directories and compression options');
-$strSetupForm_Import_export = __('Import / export');
-$strSetupForm_Left_databases = __('Databases');
-$strSetupForm_Left_databases_desc = __('Databases display options');
-$strSetupForm_Left_frame_desc = __('Customize appearance of the navigation frame');
-$strSetupForm_Left_frame = __('Navigation frame');
-$strSetupForm_Left_servers_desc = __('Servers display options');
-$strSetupForm_Left_servers = __('Servers');
-$strSetupForm_Left_tables_desc = __('Tables display options');
-$strSetupForm_Left_tables = __('Tables');
-$strSetupForm_Main_frame = __('Main frame');
-$strSetupForm_Other_core_settings_desc = __('Settings that didn\'t fit enywhere else');
-$strSetupForm_Other_core_settings = __('Other core settings');
-$strSetupForm_Query_window_desc = __('Customize query window options');
-$strSetupForm_Query_window = __('Query window');
-$strSetupForm_Security_desc = __('Please note that phpMyAdmin is just a user interface and its features do not limit MySQL');
-$strSetupForm_Security = __('Security');
-$strSetupForm_Server = __('Basic settings');
-$strSetupForm_Server_config_desc = __('Advanced server configuration, do not change these options unless you know what they are for');
-$strSetupForm_Server_config = __('Server configuration');
-$strSetupForm_Server_desc = __('Enter server connection parameters');
-$strSetupForm_Server_login_options_desc = __('Enter login options for signon authentication');
-$strSetupForm_Server_login_options = __('Signon login options');
-$strSetupForm_Server_pmadb_desc = __('Configure phpMyAdmin database to gain access to additional features, see [a@../Documentation.html#linked-tables]phpMyAdmin configuration storage[/a] in documentation');
-$strSetupForm_Server_pmadb = __('PMA database');
-$strSetupForm_Server_tracking_desc = __('Tracking of changes made in database. Requires configured PMA database.');
-$strSetupForm_Server_tracking = __('Changes tracking');
-$strSetupFormset_customization = __('Customization');
-$strSetupFormset_export = __('Customize export options');
-$strSetupFormset_features = __('Features');
-$strSetupFormset_import = __('Customize import defaults');
-$strSetupFormset_left_frame = __('Customize navigation frame');
-$strSetupFormset_main_frame = __('Customize main frame');
-$strSetupForm_Sql_box_desc = __('Customize links shown in SQL Query boxes');
-$strSetupForm_Sql_box = __('SQL Query box');
-$strSetupForm_Sql_queries_desc = __('SQL queries settings, for SQL Query box options see [a@?page=form&formset=main_frame#tab_Sql_box]Navigation frame[/a] settings');
-$strSetupForm_Sql_queries = __('SQL queries');
-$strSetupForm_Startup_desc = __('Customize startup page');
-$strSetupForm_Startup = __('Startup');
-$strSetupForm_Tabs_desc = __('Choose how you want tabs to work');
-$strSetupForm_Tabs = __('Tabs');
-$strSetupGZipDump_desc = __('Enable [a@http://en.wikipedia.org/wiki/Gzip]gzip[/a] compression for import and export operations');
-$strSetupGZipDump_name = __('GZip');
-$strSetupGZipDumpWarning = __('[a@?page=form&formset=features#tab_Import_export]GZip compression and decompression[/a] requires functions (%s) which are unavailable on this system.');
-$strSetupHomepageLink = __('phpMyAdmin homepage');
-$strSetupIconvExtraParams_name = __('Extra parameters for iconv');
-$strSetupIgnoreErrors = __('Ignore errors');
-$strSetupIgnoreMultiSubmitErrors_desc = __('If enabled, phpMyAdmin continues computing multiple-statement queries even if one of the queries failed');
-$strSetupIgnoreMultiSubmitErrors_name = __('Ignore multiple statement errors');
-$strSetupImport_allow_interrupt_desc = __('Allow interrupt of import in case script detects it is close to time limit. This might be good way to import large files, however it can break transactions.');
-$strSetupImport_allow_interrupt_name = __('Partial import: allow interrupt');
-$strSetupImport_format_desc = __('Default format; be aware that this list depends on location (database, table) and only SQL is always available');
-$strSetupImport_format_name = __('Format of imported file');
-$strSetupImport_skip_queries_desc = __('Number of queries to skip from start');
-$strSetupImport_skip_queries_name = __('Partial import: skip queries');
-$strSetupInsecureConnection = __('Insecure connection');
-$strSetupInsecureConnectionMsg1 = __('You are not using a secure connection; all data (including potentially sensitive information, like passwords) is transferred unencrypted!');
-$strSetupInsecureConnectionMsg2 = __('If your server is also configured to accept HTTPS requests follow [a@%s]this link[/a] to use a secure connection.');
-$strSetupInsertRows_desc = __('How many rows can be inserted at one time');
-$strSetupInsertRows_name = __('Number of inserted rows');
-$strSetupLeftDefaultTabTable_name = __('Target for quick access icon');
-$strSetupLeftDisplayLogo_desc = __('Show logo in left frame');
-$strSetupLeftDisplayLogo_name = __('Display logo');
-$strSetupLeftDisplayServers_desc = __('Display server choice at the top of the left frame');
-$strSetupLeftDisplayServers_name = __('Display servers selection');
-$strSetupLeftFrameDBSeparator_desc = __('String that separates databases into different tree levels');
-$strSetupLeftFrameDBSeparator_name = __('Database tree separator');
-$strSetupLeftFrameDBTree_desc = __('Only light version; display databases in a tree (determined by the separator defined below)');
-$strSetupLeftFrameDBTree_name = __('Display databases in a tree');
-$strSetupLeftFrameLight_desc = __('Disable this if you want to see all databases at once');
-$strSetupLeftFrameLight_name = __('Use light version');
-$strSetupLeftFrameTableLevel_name = __('Maximum table tree depth');
-$strSetupLeftFrameTableSeparator_desc = __('String that separates tables into different tree levels');
-$strSetupLeftFrameTableSeparator_name = __('Table tree separator');
-$strSetupLeftLogoLink_name = __('Logo link URL');
-$strSetupLeftLogoLinkWindow_desc = __('Open the linked page in the main window ([kbd]main[/kbd]) or in a new one ([kbd]new[/kbd])');
-$strSetupLeftLogoLinkWindow_name = __('Logo link target');
-$strSetupLeftPointerEnable_desc = __('Highlight server under the mouse cursor');
-$strSetupLeftPointerEnable_name = __('Enable highlighting');
-$strSetupLetUserChoose = __('let the user choose');
-$strSetupLightTabs_desc = __('Use less graphically intense tabs');
-$strSetupLightTabs_name = __('Light tabs');
-$strSetupLoad = __('Load');
-$strSetupLoginCookieDeleteAll_desc = __('If TRUE, logout deletes cookies for all servers; when set to FALSE, logout only occurs for the current server. Setting this to FALSE makes it easy to forget to log out from other servers when connected to multiple servers.');
-$strSetupLoginCookieDeleteAll_name = __('Delete all cookies on logout');
-$strSetupLoginCookieRecall_desc = __('Define whether the previous login should be recalled or not in cookie authentication mode');
-$strSetupLoginCookieRecall_name = __('Recall user name');
-$strSetupLoginCookieStore_desc = __('Defines how long (in seconds) a login cookie should be stored in browser. The default of 0 means that it will be kept for the existing session only, and will be deleted as soon as you close the browser window. This is recommended for non-trusted environments.');
-$strSetupLoginCookieStore_name = __('Login cookie store');
-$strSetupLoginCookieValidity_desc = __('Define how long (in seconds) a login cookie is valid');
-$strSetupLoginCookieValidityMsg = __('[a@?page=form&formset=features#tab_Security]Login cookie validity[/a] should be set to 1800 seconds (30 minutes) at most. Values larger than 1800 may pose a security risk such as impersonation.');
-$strSetupLoginCookieValidity_name = __('Login cookie validity');
-$strSetupMaxCharactersInDisplayedSQL_desc = __('Maximum number of characters used when a SQL query is displayed');
-$strSetupMaxCharactersInDisplayedSQL_name = __('Maximum displayed SQL length');
-$strSetupMaxDbList_desc = __('Maximum number of databases displayed in left frame and database list');
-$strSetupMaxDbList_name = __('Maximum databases');
-$strSetupMaxRows_desc = __('Number of rows displayed when browsing a result set. If the result set contains more rows, "Previous" and "Next" links will be shown.');
-$strSetupMaxRows_name = __('Maximum number of rows to display');
-$strSetupMaxTableList_desc = __('Maximum number of tables displayed in table list');
-$strSetupMaxTableList_name = __('Maximum tables');
-$strSetupMemoryLimit_desc = __('The number of bytes a script is allowed to allocate, eg. [kbd]32M[/kbd] ([kbd]0[/kbd] for no limit)');
-$strSetupMemoryLimit_name = __('Memory limit');
-$strSetupNavigationBarIconic_desc = __('Use only icons, only text or both');
-$strSetupNavigationBarIconic_name = __('Iconic navigation bar');
-$strSetupNewServer = __('New server');
-$strSetupNoServers = __('There are no configured servers');
-$strSetupOBGzip_desc = __('use GZip output buffering for increased speed in HTTP transfers');
-$strSetupOBGzip_name = __('GZip output buffering');
-$strSetupOptionNone = __('- none -');
-$strSetupOrder_desc = __('[kbd]SMART[/kbd] - i.e. descending order for columns of type TIME, DATE, DATETIME and TIMESTAMP, ascending order otherwise');
-$strSetupOrder_name = __('Default sorting order');
-$strSetupOverview = __('Overview');
-$strSetupPersistentConnections_desc = __('Use persistent connections to MySQL databases');
-$strSetupPersistentConnections_name = __('Persistent connections');
-$strSetupPropertiesIconic_desc = __('Use only icons, only text or both');
-$strSetupPropertiesIconic_name = __('Iconic table operations');
-$strSetupProtectBinary_desc = __('Disallow BLOB and BINARY columns from editing');
-$strSetupProtectBinary_name = __('Protect binary columns');
-$strSetupQueryHistoryDB_desc = __('Enable if you want DB-based query history (requires pmadb). If disabled, this utilizes JS-routines to display query history (lost by window close).');
-$strSetupQueryHistoryDB_name = __('Permanent query history');
-$strSetupQueryHistoryMax_desc = __('How many queries are kept in history');
-$strSetupQueryHistoryMax_name = __('Query history length');
-$strSetupQueryWindowDefTab_desc = __('Tab displayed when opening a new query window');
-$strSetupQueryWindowDefTab_name = __('Default query window tab');
-$strSetupRecodingEngine_desc = __('Select which functions will be used for character set conversion');
-$strSetupRecodingEngine_name = __('Recoding engine');
-$strSetupRestoreDefaultValue = __('Restore default value');
-$strSetupRevertErroneousFields = __('Try to revert erroneous fields to their default values');
-$strSetupSaveDir_desc = __('Directory where exports can be saved on server');
-$strSetupSaveDir_name = __('Save directory');
-$strSetupServerAuthConfigMsg = __('You set the [kbd]config[/kbd] authentication type and included username and password for auto-login, which is not a desirable option for live hosts. Anyone who knows or guesses your phpMyAdmin URL can directly access your phpMyAdmin panel. Set [a@?page=servers&mode=edit&id=%1$d#tab_Server]authentication type[/a] to [kbd]cookie[/kbd] or [kbd]http[/kbd].');
-$strSetupServerExtensionMsg = __('You should use mysqli for performance reasons');
-$strSetupServerNoPasswordMsg = __('You allow for connecting to the server without a password.');
-$strSetupServersAdd = __('Add a new server');
-$strSetupServers_AllowDeny_order_desc = __('Leave blank if not used');
-$strSetupServers_AllowDeny_order_name = __('Host authentication order');
-$strSetupServers_AllowDeny_rules_desc = __('Leave blank for defaults');
-$strSetupServers_AllowDeny_rules_name = __('Host authentication rules');
-$strSetupServers_AllowNoPassword_name = __('Allow logins without a password');
-$strSetupServers_AllowRoot_name = __('Allow root login');
-$strSetupServers_auth_http_realm_desc = __('HTTP Basic Auth Realm name to display when doing HTTP Auth');
-$strSetupServers_auth_http_realm_name = __('HTTP Realm');
-$strSetupServers_auth_swekey_config_desc = __('The path for the config file for [a@http://swekey.com]SweKey hardware authentication[/a] (not located in your document root; suggested: /etc/swekey.conf)');
-$strSetupServers_auth_swekey_config_name = __('SweKey config file');
-$strSetupServers_auth_type_desc = __('Authentication method to use');
-$strSetupServers_auth_type_name = __('Authentication type');
-$strSetupServers_bookmarktable_desc = __('Leave blank for no [a@http://wiki.phpmyadmin.net/pma/bookmark]bookmark[/a] support, suggested: [kbd]pma_bookmark[/kbd]');
-$strSetupServers_bookmarktable_name = __('Bookmark table');
-$strSetupServers_column_info_desc = __('Leave blank for no column comments/mime types, suggested: [kbd]pma_column_info[/kbd]');
-$strSetupServers_column_info_name = __('Column information table');
-$strSetupServers_compress_desc = __('Compress connection to MySQL server');
-$strSetupServers_compress_name = __('Compress connection');
-$strSetupServers_connect_type_desc = __('How to connect to server, keep [kbd]tcp[/kbd] if unsure');
-$strSetupServers_connect_type_name = __('Connection type');
-$strSetupServers_controlpass_name = __('Control user password');
-$strSetupServers_controluser_desc = __('A special MySQL user configured with limited permissions, more information available on [a@http://wiki.phpmyadmin.net/pma/controluser]wiki[/a]');
-$strSetupServers_controluser_name = __('Control user');
-$strSetupServers_CountTables_desc = __('Count tables when showing database list');
-$strSetupServers_CountTables_name = __('Count tables');
-$strSetupServers_designer_coords_desc = __('Leave blank for no Designer support, suggested: [kbd]pma_designer_coords[/kbd]');
-$strSetupServers_designer_coords_name = __('Designer table');
-$strSetupServers_DisableIS_desc = __('More information on [a@http://sf.net/support/tracker.php?aid=1849494]PMA bug tracker[/a] and [a@http://bugs.mysql.com/19588]MySQL Bugs[/a]');
-$strSetupServers_DisableIS_name = __('Disable use of INFORMATION_SCHEMA');
-$strSetupServerSecurityInfoMsg = __('If you feel this is necessary, use additional protection settings - [a@?page=servers&mode=edit&id=%1$d#tab_Server_config]host authentication[/a] settings and [a@?page=form&formset=features#tab_Security]trusted proxies list[/a]. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.');
-$strSetupServersEdit = __('Edit server');
-$strSetupServers_extension_desc = __('What PHP extension to use; you should use mysqli if supported');
-$strSetupServers_extension_name = __('PHP extension to use');
-$strSetupServers_hide_db_desc = __('Hide databases matching regular expression (PCRE)');
-$strSetupServers_hide_db_name = __('Hide databases');
-$strSetupServers_history_desc = __('Leave blank for no SQL query history support, suggested: [kbd]pma_history[/kbd]');
-$strSetupServers_history_name = __('SQL query history table');
-$strSetupServers_tracking_desc = __('Leave blank for no SQL query tracking support, suggested: [kbd]pma_tracking[/kbd]');
-$strSetupServers_tracking_name = __('SQL query tracking table');
-$strSetupServers_host_desc = __('Hostname where MySQL server is running');
-$strSetupServers_host_name = __('Server hostname');
-$strSetupServers_LogoutURL_name = __('Logout URL');
-$strSetupServers_nopassword_desc = __('Try to connect without password');
-$strSetupServers_nopassword_name = __('Connect without password');
-$strSetupServers_only_db_desc = __('You can use MySQL wildcard characters (% and _), escape them if you want to use their literal instances, i.e. use \'my\_db\' and not \'my_db\'');
-$strSetupServers_only_db_name = __('Show only listed databases');
-$strSetupServers_password_desc = __('Leave empty if not using config auth');
-$strSetupServers_password_name = __('Password for config auth');
-$strSetupServers_pdf_pages_desc = __('Leave blank for no PDF schema support, suggested: [kbd]pma_pdf_pages[/kbd]');
-$strSetupServers_pdf_pages_name = __('PDF schema: pages table');
-$strSetupServers_pmadb_desc = __('Database used for relations, bookmarks, and PDF features. See [a@http://wiki.phpmyadmin.net/pma/pmadb]pmadb[/a] for complete information. Leave blank for no support. Suggested: [kbd]phpmyadmin[/kbd]');
-$strSetupServers_pmadb_name = __('PMA database');
-$strSetupServers_port_desc = __('Port on which MySQL server is listening, leave empty for default');
-$strSetupServers_port_name = __('Server port');
-$strSetupServers_relation_desc = __('Leave blank for no [a@http://wiki.phpmyadmin.net/pma/relation]relation-links[/a] support, suggested: [kbd]pma_relation[/kbd]');
-$strSetupServers_relation_name = __('Relation table');
-$strSetupServers_ShowDatabasesCommand_desc = __('SQL command to fetch available databases');
-$strSetupServers_ShowDatabasesCommand_name = __('SHOW DATABASES command');
-$strSetupServers_SignonSession_desc = __('See [a@http://wiki.phpmyadmin.net/pma/auth_types#signon]authentication types[/a] for an example');
-$strSetupServers_SignonSession_name = __('Signon session name');
-$strSetupServers_SignonURL_name = __('Signon URL');
-$strSetupServers_tracking_version_auto_create_desc = __('Whether the tracking mechanism creates versions for tables and views automatically.');
-$strSetupServers_tracking_version_auto_create_name = __('Automatically create versions');
-$strSetupServers_tracking_default_statements_desc = __('Defines the list of statements the auto-creation uses for new versions.');
-$strSetupServers_tracking_default_statements_name = __('Statements to track');
-$strSetupServers_tracking_add_drop_view_desc = __('Whether a DROP VIEW IF EXISTS statement will be added as first line to the log when creating a view.');
-$strSetupServers_tracking_add_drop_view_name = __('Add DROP VIEW');
-$strSetupServers_tracking_add_drop_table_desc = __('Whether a DROP TABLE IF EXISTS statement will be added as first line to the log when creating a table.');
-$strSetupServers_tracking_add_drop_table_name = __('Add DROP TABLE');
-$strSetupServers_tracking_add_drop_database_desc = __('Whether a DROP DATABASE IF EXISTS statement will be added as first line to the log when creating a database.');
-$strSetupServers_tracking_add_drop_database_name = __('Add DROP DATABASE');
-$strSetupServerSslMsg = __('You should use SSL connections if your web server supports it');
-$strSetupServers_socket_desc = __('Socket on which MySQL server is listening, leave empty for default');
-$strSetupServers_socket_name = __('Server socket');
-$strSetupServers_ssl_desc = __('Enable SSL for connection to MySQL server');
-$strSetupServers_ssl_name = __('Use SSL');
-$strSetupServers_table_coords_desc = __('Leave blank for no PDF schema support, suggested: [kbd]pma_table_coords[/kbd]');
-$strSetupServers_table_coords_name = __('PDF schema: table coordinates');
-$strSetupServers_table_info_desc = __('Table to describe the display columns, leave blank for no support; suggested: [kbd]pma_table_info[/kbd]');
-$strSetupServers_table_info_name = __('Display columns table');
-$strSetupServers_user_desc = __('Leave empty if not using config auth');
-$strSetupServers_user_name = __('User for config auth');
-$strSetupServers_verbose_check_desc = __('Disable if you know that your pma_* tables are up to date. This prevents compatibility checks and thereby increases performance');
-$strSetupServers_verbose_check_name = __('Verbose check');
-$strSetupServers_verbose_desc = __('A user-friendly description of this server. Leave blank to display the hostname instead.');
-$strSetupServers_verbose_name = __('Verbose name of this server');
-$strSetupSetValue = __('Set value: %s');
-$strSetupShowAll_desc = __('Whether a user should be displayed a "show all (rows)" button');
-$strSetupShowAll_name = __('Allow to display all the rows');
-$strSetupShowChgPassword_desc = __('Please note that enabling this has no effect with [kbd]config[/kbd] authentication mode because the password is hard coded in the configuration file; this does not limit the ability to execute the same command directly');
-$strSetupShowChgPassword_name = __('Show password change form');
-$strSetupShowCreateDb_name = __('Show create database form');
-$strSetupShowForm = __('Show form');
-$strSetupShowFunctionFields_desc = __('Display the function fields in edit/insert mode');
-$strSetupShowFunctionFields_name = __('Show function fields');
-$strSetupShowHiddenMessages = __('Show hidden messages (#MSG_COUNT)');
-$strSetupShowPhpInfo_desc = __('Shows link to [a@http://php.net/manual/function.phpinfo.php]phpinfo()[/a] output');
-$strSetupShowPhpInfo_name = __('Show phpinfo() link');
-$strSetupShowServerInfo_name = __('Show detailed MySQL server information');
-$strSetupShowSQL_desc = __('Defines whether SQL queries generated by phpMyAdmin should be displayed');
-$strSetupShowSQL_name = __('Show SQL queries');
-$strSetupShowStats_desc = __('Allow to display database and table statistics (eg. space usage)');
-$strSetupShowStats_name = __('Show statistics');
-$strSetupShowTooltipAliasDB_desc = __('If tooltips are enabled and a database comment is set, this will flip the comment and the real name');
-$strSetupShowTooltipAliasDB_name = __('Display database comment instead of its name');
-$strSetupShowTooltipAliasTB_desc = __('When setting this to [kbd]nested[/kbd], the alias of the table name is only used to split/nest the tables according to the $cfg[\'LeftFrameTableSeparator\'] directive, so only the folder is called like the alias, the table name itself stays unchanged');
-$strSetupShowTooltipAliasTB_name = __('Display table comment instead of its name');
-$strSetupShowTooltip_name = __('Display table comments in tooltips');
-$strSetupSkipLockedTables_desc = __('Mark used tables and make it possible to show databases with locked tables');
-$strSetupSkipLockedTables_name = __('Skip locked tables');
-$strSetupSQLQuery_Edit_name = __('Edit');
-$strSetupSQLQuery_Explain_name = __('Explain SQL');
-$strSetupSQLQuery_Refresh_name = __('Refresh');
-$strSetupSQLQuery_ShowAsPHP_name = __('Create PHP Code');
-$strSetupSQLQuery_Validate_name = __('Validate SQL');
-$strSetupSuggestDBName_desc = __('Suggest a database name on the "Create Database" form (if possible) or keep the text field empty');
-$strSetupSuggestDBName_name = __('Suggest new database name');
-$strSetupTrue = __('yes');
-$strSetupTrustedProxies_desc = __('Input proxies as [kbd]IP: trusted HTTP header[/kbd]. The following example specifies that phpMyAdmin should trust a HTTP_X_FORWARDED_FOR (X-Forwarded-For) header coming from the proxy 1.2.3.4:[br][kbd]1.2.3.4: HTTP_X_FORWARDED_FOR[/kbd]');
-$strSetupTrustedProxies_name = __('List of trusted proxies for IP allow/deny');
-$strSetupUploadDir_desc = __('Directory on server where you can upload files for import');
-$strSetupUploadDir_name = __('Upload directory');
-$strSetupUseDbSearch_desc = __('Allow for searching inside the entire database');
-$strSetupUseDbSearch_name = __('Use database search');
-$strSetupVerboseMultiSubmit_desc = __('Show affected rows of each statement on multiple-statement queries. See libraries/import.lib.php for defaults on how many queries a statement may contain.');
-$strSetupVerboseMultiSubmit_name = __('Verbose multiple statements');
-$strSetupVersionCheckDataError = __('Reading of version failed. Maybe you\'re offline or the upgrade server does not respond.');
-$strSetupVersionCheckInvalid = __('Got invalid version string from server');
-$strSetupVersionCheckLink = __('Check for latest version');
-$strSetupVersionCheckNewAvailable = __('A newer version of phpMyAdmin is available and you should consider upgrading. The newest version is %s, released on %s.');
-$strSetupVersionCheckNewAvailableSvn = __('You are using Git version, run [kbd]git pull[/kbd] :-)[br]The latest stable version is %s, released on %s.');
-$strSetupVersionCheckNone = __('No newer stable version is available');
-$strSetupVersionCheckUnparsable = __('Unparsable version string');
-$strSetupVersionCheck = __('Version check');
-$strSetupVersionCheckWrapperError = __('Neither URL wrapper nor CURL is available. Version check is not possible.');
-$strSetupWarning = __('Warning');
-$strSetupZipDump_desc = __('Enable [a@http://en.wikipedia.org/wiki/ZIP_(file_format)]ZIP[/a] compression for import and export operations');
-$strSetupZipDumpExportWarning = __('[a@?page=form&formset=features#tab_Import_export]Zip compression[/a] requires functions (%s) which are unavailable on this system.');
-$strSetupZipDumpImportWarning = __('[a@?page=form&formset=features#tab_Import_export]Zip decompression[/a] requires functions (%s) which are unavailable on this system.');
-$strSetupZipDump_name = __('ZIP');
-
-?>
diff --git a/setup/scripts.js b/setup/scripts.js
index 7298e63..f223e04 100644
--- a/setup/scripts.js
+++ b/setup/scripts.js
@@ -1,7 +1,5 @@
/**
- * functions used in setup script
- *
- * @version $Id$
+ * Functions used in Setup configuration forms
*/
// show this window in top frame
@@ -9,163 +7,6 @@ if (top != self) {
window.top.location.href = location;
}
-// default values for fields
-var defaultValues = {};
-
-// language strings
-var PMA_messages = {};
-
-/**
- * Returns field type
- *
- * @param Element field
- */
-function getFieldType(field) {
- field = $(field);
- var tagName = field.attr('tagName');
- if (tagName == 'INPUT') {
- return field.attr('type');
- } else if (tagName == 'SELECT') {
- return 'select';
- } else if (tagName == 'TEXTAREA') {
- return 'text';
- }
- return '';
-}
-
-/**
- * Sets field value
- *
- * value must be of type:
- * o undefined (omitted) - restore default value (form default, not PMA default)
- * o String - if field_type is 'text'
- * o boolean - if field_type is 'checkbox'
- * o Array of values - if field_type is 'select'
- *
- * @param Element field
- * @param String field_type see getFieldType
- * @param mixed value
- */
-function setFieldValue(field, field_type, value) {
- field = $(field);
- switch (field_type) {
- case 'text':
- field.attr('value', (value != undefined ? value : field.attr('defaultValue')));
- break;
- case 'checkbox':
- field.attr('checked', (value != undefined ? value : field.attr('defaultChecked')));
- break;
- case 'select':
- var options = field.attr('options');
- var i, imax = options.length;
- if (value == undefined) {
- for (i = 0; i < imax; i++) {
- options[i].selected = options[i].defaultSelected;
- }
- } else {
- for (i = 0; i < imax; i++) {
- options[i].selected = (value.indexOf(options[i].value) != -1);
- }
- }
- break;
- }
- markField(field);
-}
-
-/**
- * Gets field value
- *
- * Will return one of:
- * o String - if type is 'text'
- * o boolean - if type is 'checkbox'
- * o Array of values - if type is 'select'
- *
- * @param Element field
- * @param String field_type see getFieldType
- * @return mixed
- */
-function getFieldValue(field, field_type) {
- field = $(field);
- switch (field_type) {
- case 'text':
- return field.attr('value');
- case 'checkbox':
- return field.attr('checked');
- case 'select':
- var options = field.attr('options');
- var i, imax = options.length, items = [];
- for (i = 0; i < imax; i++) {
- if (options[i].selected) {
- items.push(options[i].value);
- }
- }
- return items;
- }
-}
-
-/**
- * Returns values for all fields in fieldsets
- */
-function getAllValues() {
- var elements = $('fieldset input, fieldset select, fieldset textarea');
- var values = {};
- var type, value;
- for (var i = 0; i < elements.length; i++) {
- type = getFieldType(elements[i]);
- value = getFieldValue(elements[i], type);
- if (typeof value != 'undefined') {
- // we only have single selects, fatten array
- if (type == 'select') {
- value = value[0];
- }
- values[elements[i].name] = value;
- }
- }
- return values;
-}
-
-/**
- * Checks whether field has its default value
- *
- * @param Element field
- * @param String type
- * @return boolean
- */
-function checkFieldDefault(field, type) {
- field = $(field);
- var field_id = field.attr('id');
- if (typeof defaultValues[field_id] == 'undefined') {
- return true;
- }
- var isDefault = true;
- var currentValue = getFieldValue(field, type);
- if (type != 'select') {
- isDefault = currentValue == defaultValues[field_id];
- } else {
- // compare arrays, will work for our representation of select values
- if (currentValue.length != defaultValues[field_id].length) {
- isDefault = false;
- }
- else {
- for (var i = 0; i < currentValue.length; i++) {
- if (currentValue[i] != defaultValues[field_id][i]) {
- isDefault = false;
- break;
- }
- }
- }
- }
- return isDefault;
-}
-
-/**
- * Returns element's id prefix
- * @param Element element
- */
-function getIdPrefix(element) {
- return $(element).attr('id').replace(/[^-]+$/, '');
-}
-
// ------------------------------------------------------------------
// Messages
//
@@ -200,49 +41,13 @@ $(function() {
// Form validation and field operations
//
-// form validator assignments
-var validate = {};
-
-// form validator list
-var validators = {
- // regexp: numeric value
- _regexp_numeric: new RegExp('^[0-9]*$'),
- /**
- * Validates positive number
- *
- * @param boolean isKeyUp
- */
- validate_positive_number: function (isKeyUp) {
- var result = this.value != '0' && validators._regexp_numeric.test(this.value);
- return result ? true : PMA_messages['error_nan_p'];
- },
- /**
- * Validates non-negative number
- *
- * @param boolean isKeyUp
- */
- validate_non_negative_number: function (isKeyUp) {
- var result = validators._regexp_numeric.test(this.value);
- return result ? true : PMA_messages['error_nan_nneg'];
- },
- /**
- * Validates port number
- *
- * @param boolean isKeyUp
- */
- validate_port_number: function(isKeyUp) {
- var result = validators._regexp_numeric.test(this.value) && this.value != '0';
- if (!result || this.value > 65536) {
- result = PMA_messages['error_incorrect_port'];
- }
- return result;
- },
+$.extend(true, validators, {
// field validators
_field: {
/**
* hide_db field
*
- * @param boolean isKeyUp
+ * @param {boolean} isKeyUp
*/
hide_db: function(isKeyUp) {
if (!isKeyUp && this.value != '') {
@@ -255,7 +60,7 @@ var validators = {
/**
* TrustedProxies field
*
- * @param boolean isKeyUp
+ * @param {boolean} isKeyUp
*/
TrustedProxies: function(isKeyUp) {
if (!isKeyUp && this.value != '') {
@@ -271,7 +76,7 @@ var validators = {
/**
* Validates Server fieldset
*
- * @param boolean isKeyUp
+ * @param {boolean} isKeyUp
*/
Server: function(isKeyUp) {
if (!isKeyUp) {
@@ -282,7 +87,7 @@ var validators = {
/**
* Validates Server_login_options fieldset
*
- * @param boolean isKeyUp
+ * @param {boolean} isKeyUp
*/
Server_login_options: function(isKeyUp) {
return validators._fieldset.Server.apply(this, [isKeyUp]);
@@ -290,7 +95,7 @@ var validators = {
/**
* Validates Server_pmadb fieldset
*
- * @param boolean isKeyUp
+ * @param {boolean} isKeyUp
*/
Server_pmadb: function(isKeyUp) {
if (isKeyUp) {
@@ -306,14 +111,14 @@ var validators = {
return true;
}
}
-};
+});
/**
* Calls server-side validation procedures
*
- * @param Element parent input field in <fieldset> or <fieldset>
- * @param String id validator id
- * @param Object values values hash (element_id: value)
+ * @param {Element} parent input field in <fieldset> or <fieldset>
+ * @param {String} id validator id
+ * @param {Object} values values hash {element1_id: value, ...}
*/
function ajaxValidate(parent, id, values) {
parent = $(parent);
@@ -324,7 +129,7 @@ function ajaxValidate(parent, id, values) {
return false;
}
}
-
+
if (parent.data('ajax') != null) {
parent.data('ajax').abort();
}
@@ -349,7 +154,7 @@ function ajaxValidate(parent, id, values) {
} else if (typeof response['error'] != 'undefined') {
error[parent.id] = [response['error']];
} else {
- for (key in response) {
+ for (var key in response) {
var value = response[key];
error[key] = jQuery.isArray(value) ? value : [value];
}
@@ -364,366 +169,27 @@ function ajaxValidate(parent, id, values) {
return true;
}
-/**
- * Registers validator for given field
- *
- * @param String id field id
- * @param String type validator (key in validators object)
- * @param boolean onKeyUp whether fire on key up
- * @param mixed params validation function parameters
- */
-function validateField(id, type, onKeyUp, params) {
- if (typeof validators[type] == 'undefined') {
- return;
- }
- if (typeof validate[id] == 'undefined') {
- validate[id] = [];
- }
- validate[id].push([type, params, onKeyUp]);
-}
-
-/**
- * Returns valdiation functions associated with form field
- *
- * @param String field_id form field id
- * @param boolean onKeyUpOnly see validateField
- * @return Array array of [function, paramseters to be passed to function]
- */
-function getFieldValidators(field_id, onKeyUpOnly) {
- // look for field bound validator
- var name = field_id.match(/[^-]+$/)[0];
- if (typeof validators._field[name] != 'undefined') {
- return [[validators._field[name], null]];
- }
-
- // look for registered validators
- var functions = [];
- if (typeof validate[field_id] != 'undefined') {
- // validate[field_id]: array of [type, params, onKeyUp]
- for (var i = 0, imax = validate[field_id].length; i < imax; i++) {
- if (onKeyUpOnly && !validate[field_id][i][2]) {
- continue;
- }
- functions.push([validators[validate[field_id][i][0]], validate[field_id][i][1]]);
- }
- }
-
- return functions;
-}
-
-/**
- * Displays errors for given form fields
- *
- * WARNING: created DOM elements must be identical with the ones made by
- * display_input() in FormDisplay.tpl.php!
- *
- * @param Object error list (key: field id, value: error array)
- */
-function displayErrors(error_list) {
- for (field_id in error_list) {
- var errors = error_list[field_id];
- var field = $('#'+field_id);
- var isFieldset = field.attr('tagName') == 'FIELDSET';
- var errorCnt = isFieldset
- ? field.find('dl.errors')
- : field.siblings('.inline_errors');
-
- // remove empty errors (used to clear error list)
- errors = $.grep(errors, function(item) {
- return item != '';
- });
-
- if (errors.length) {
- // if error container doesn't exist, create it
- if (errorCnt.length == 0) {
- if (isFieldset) {
- errorCnt = $('<dl class="errors" />');
- field.find('table').before(errorCnt);
- } else {
- errorCnt = $('<dl class="inline_errors" />');
- field.closest('td').append(errorCnt);
- }
- }
-
- var html = '';
- for (var i = 0, imax = errors.length; i < imax; i++) {
- html += '<dd>' + errors[i] + '</dd>';
- }
- errorCnt.html(html);
- } else if (errorCnt !== null) {
- // remove useless error container
- errorCnt.remove();
- }
- }
-}
-
-/**
- * Validates fieldset and puts errors in 'errors' object
- *
- * @param Element field
- * @param boolean isKeyUp
- * @param Object errors
- */
-function validate_fieldset(fieldset, isKeyUp, errors) {
- fieldset = $(fieldset);
- if (fieldset.length && typeof validators._fieldset[fieldset.attr('id')] != 'undefined') {
- var fieldset_errors = validators._fieldset[fieldset.attr('id')].apply(fieldset[0], [isKeyUp]);
- for (field_id in fieldset_errors) {
- if (typeof errors[field_id] == 'undefined') {
- errors[field_id] = [];
- }
- if (typeof fieldset_errors[field_id] == 'string') {
- fieldset_errors[field_id] = [fieldset_errors[field_id]];
- }
- $.merge(errors[field_id], fieldset_errors[field_id]);
- }
- }
-}
-
-/**
- * Validates form field and puts errors in 'errors' object
- *
- * @param Element field
- * @param boolean isKeyUp
- * @param Object errors
- */
-function validate_field(field, isKeyUp, errors) {
- field = $(field);
- var field_id = field.attr('id');
- errors[field_id] = [];
- var functions = getFieldValidators(field_id, isKeyUp);
- for (var i = 0; i < functions.length; i++) {
- var result = functions[i][0].apply(field[0], [isKeyUp, functions[i][1]]);
- if (result !== true) {
- if (typeof result == 'string') {
- result = [result];
- }
- $.merge(errors[field_id], result);
- }
- }
-}
-
-/**
- * Validates form field and parent fieldset
- *
- * @param Element field
- * @param boolean isKeyUp
- */
-function validate_field_and_fieldset(field, isKeyUp) {
- field = $(field);
- var errors = {};
- validate_field(field, isKeyUp, errors);
- validate_fieldset(field.closest('fieldset'), isKeyUp, errors);
- displayErrors(errors);
-}
-
-/**
- * Marks field depending on its value (system default or custom)
- *
- * @param Element field
- */
-function markField(field) {
- field = $(field);
- var type = getFieldType(field);
- var isDefault = checkFieldDefault(field, type);
-
- // checkboxes uses parent <span> for marking
- var fieldMarker = (type == 'checkbox') ? field.parent() : field;
- setRestoreDefaultBtn(field, !isDefault);
- fieldMarker[isDefault ? 'removeClass' : 'addClass']('custom');
-}
-
-/**
- * Enables or disables the "restore default value" button
- *
- * @param Element field
- * @param bool display
- */
-function setRestoreDefaultBtn(field, display) {
- var el = $(field).closest('td').find('.restore-default');
- el.css('display', (el.css('display') ? '' : 'none'));
-}
-
-$(function() {
- // register validators and mark custom values
- var elements = $('input[id], select[id], textarea[id]');
- $('input[id], select[id], textarea[id]').each(function(){
- markField(this);
- var el = $(this);
- el.bind('change', function() {
- validate_field_and_fieldset(this, false);
- markField(this);
- });
- var tagName = el.attr('tagName');
- // text fields can be validated after each change
- if (tagName == 'INPUT' && el.attr('type') == 'text') {
- el.keyup(function() {
- validate_field_and_fieldset(el, true);
- markField(el);
- });
- }
- // disable textarea spellcheck
- if (tagName == 'TEXTAREA') {
- el.attr('spellcheck', false);
- }
- });
-
- // check whether we've refreshed a page and browser remembered modified
- // form values
- var check_page_refresh = $('#check_page_refresh');
- if (check_page_refresh.length == 0 || check_page_refresh.val() == '1') {
- // run all field validators
- var errors = {};
- for (var i = 0; i < elements.length; i++) {
- validate_field(elements[i], false, errors);
- }
- // run all fieldset validators
- $('fieldset').each(function(){
- validate_fieldset(this, false, errors);
- });
-
- displayErrors(errors);
- } else if (check_page_refresh) {
- check_page_refresh.val('1');
- }
-});
-
//
// END: Form validation and field operations
// ------------------------------------------------------------------
// ------------------------------------------------------------------
-// Tabbed forms
-//
-
-/**
- * Sets active tab
- *
- * @param Element tab_link
- */
-function setTab(tab_link) {
- var tabs_menu = $(tab_link).closest('.tabs');
-
- var links = tabs_menu.find('a');
- var contents, link;
- for (var i = 0, imax = links.length; i < imax; i++) {
- link = $(links[i]);
- contents = $(link.attr('href'));
- if (links[i] == tab_link) {
- link.addClass('active');
- contents.css('display', 'block');
- } else {
- link.removeClass('active');
- contents.css('display', 'none');
- }
- }
- location.hash = 'tab_' + $(tab_link).attr('href').substr(1);
-}
-
-$(function() {
- var tabs = $('.tabs');
- var url_tab = location.hash.match(/^#tab_.+/)
- ? $('a[href$="' + location.hash.substr(5) + '"]') : null;
- if (url_tab) {
- url_tab = url_tab[0];
- }
- // add tabs events and activate one tab (the first one or indicated by location hash)
- for (var i = 0, imax = tabs.length; i < imax; i++) {
- var links = $(tabs[i]).find('a');
- var selected_tab = links[0];
- for (var j = 0, jmax = links.length; j < jmax; j++) {
- $(links[j]).click(function(e) {
- e.preventDefault();
- setTab(this);
- });
- if (links[j] == url_tab) {
- selected_tab = links[j];
- }
- }
- setTab(selected_tab);
- }
- // tab links handling, check each 200ms
- // (works with history in FF, further browser support here would be an overkill)
- var prev_hash = location.hash;
- setInterval(function() {
- if (location.hash != prev_hash) {
- prev_hash = location.hash;
- var url_tab = location.hash.match(/^#tab_.+/)
- ? $('a[href$="' + location.hash.substr(5) + '"]') : null;
- if (url_tab) {
- setTab(url_tab[0]);
- }
- }
- }, 200);
-});
-
-//
-// END: Tabbed forms
-// ------------------------------------------------------------------
-
-// ------------------------------------------------------------------
-// Form reset buttons
+// User preferences allow/disallow UI
//
$(function() {
- $('input[type=button]').click(function(e) {
- var fields = $(this).closest('fieldset').find('input, select, textarea');
- for (var i = 0, imax = fields.length; i < imax; i++) {
- setFieldValue(fields[i], getFieldType(fields[i]));
- }
- });
+ $('.userprefs-allow').click(function(e) {
+ if (this != e.target) {
+ return;
+ }
+ var el = $(this).find('input');
+ if (el.attr('disabled')) {
+ return;
+ }
+ el.attr('checked', !el.attr('checked'));
+ });
});
//
-// END: Form reset buttons
-// ------------------------------------------------------------------
-
-// ------------------------------------------------------------------
-// "Restore default" and "set value" buttons
-//
-
-/**
- * Restores field's default value
- *
- * @param String field_id
- */
-function restoreField(field_id) {
- var field = $('#'+field_id);
- if (field.length == 0 || defaultValues[field_id] == undefined) {
- return;
- }
- setFieldValue(field, getFieldType(field), defaultValues[field_id]);
-}
-
-$(function() {
- $('.restore-default, .set-value').each(function() {
- var link = $(this);
- link.css('opacity', 0.25);
- if (!link.hasClass('restore-default')) {
- // restore-default is handled by markField
- link.css('display', '');
- }
- link.bind({
- mouseenter: function() {$(this).css('opacity', 1);},
- mouseleave: function() {$(this).css('opacity', 0.25);},
- click: function(e) {
- e.preventDefault();
- var href = $(this).attr('href').substr(1);
- var field_id;
- if ($(this).hasClass('restore-default')) {
- field_id = href;
- restoreField(field_id);
- } else {
- field_id = href.match(/^[^=]+/)[0];
- var value = href.match(/=(.+)$/)[1];
- setFieldValue($('#'+field_id), 'text', value);
- }
- $('#'+field_id).trigger('change');
- }
- });
- });
-});
-
-//
-// END: "Restore default" and "set value" buttons
-// ------------------------------------------------------------------
+// END: User preferences allow/disallow UI
+// ------------------------------------------------------------------
\ No newline at end of file
diff --git a/setup/styles.css b/setup/styles.css
index d5a399d..0cadd10 100644
--- a/setup/styles.css
+++ b/setup/styles.css
@@ -195,6 +195,11 @@ ul.tabs li a:hover, ul.tabs li a:active {
margin-bottom: -3px;
}
+.userprefs-comment {
+ cursor: help;
+ float: right;
+}
+
/* forms */
fieldset {
@@ -253,10 +258,6 @@ fieldset th {
vertical-align: top;
}
-fieldset th small {
- display: block;
-}
-
fieldset .doc {
margin-left: 1em;
}
@@ -266,27 +267,50 @@ fieldset td {
vertical-align: top;
}
+fieldset td.userprefs-allow {
+ padding: 0;
+ vertical-align: middle;
+ text-align: center;
+ width: 3em;
+}
+
+fieldset td.userprefs-allow:hover {
+ cursor: pointer;
+ background-color: #EEE;
+}
+
fieldset th small {
+ display: block;
font-weight: normal;
font-family: sans-serif;
font-size: x-small;
color: #666;
}
-fieldset th, fieldset td {
+fieldset th, fieldset td, .form .lastrow {
border-top: 1px #555 dotted;
}
+fieldset .group-header th {
+ background: #EAEDFF;
+ border: none;
+}
+
+fieldset .group-header + tr th, fieldset .group-header + tr td,
+fieldset p + table tr:first-child td, fieldset p + table tr:first-child th {
+ border-top: none;
+}
+
+fieldset .group-field th {
+ padding-left: 1em;
+}
+
fieldset .lastrow, .form .lastrow {
background: #F7FBFF;
padding: 0.5em;
text-align: center;
}
-.form .lastrow {
- border-top: 1px #555 dotted;
-}
-
fieldset .lastrow input, .form .lastrow input {
font-weight: bold;
}
@@ -314,16 +338,20 @@ fieldset.simple .lastrow {
span.checkbox {
padding: 2px;
+ display: inline-block;
}
.custom { /* customized field */
background: #FFC;
}
-span.checkbox.custom {
+.checkbox.custom {
padding: 1px;
border: 1px #EDEC90 solid;
- background: #FFC;
+}
+
+.field-error {
+ border-color: #C11 !important;
}
input[type="text"], select, textarea {
@@ -335,6 +363,22 @@ input[type="text"]:focus, select:focus, textarea:focus {
background: #F7FBFF;
}
+.field-comment {
+
+ position: relative;
+}
+
+.field-comment-mark {
+ cursor: help;
+ padding: 0 0.2em;
+ font-weight: bold;
+ font-style: italic;
+}
+
+.field-comment-warning {
+ color: #A00;
+}
+
.green { /* default form button */
color: #080;
}
diff --git a/setup/validate.php b/setup/validate.php
index 68781bc..beeba71 100644
--- a/setup/validate.php
+++ b/setup/validate.php
@@ -1,11 +1,9 @@
<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Validation callback.
*
- * @package phpMyAdmin-setup
- * @copyright Copyright (c) 2008, Piotr Przybylski <piotrprz(a)gmail.com>
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
+ * @package phpMyAdmin-setup
*/
/**
@@ -14,7 +12,7 @@
require './lib/common.inc.php';
$validators = array();
-require './setup/lib/validate.lib.php';
+require './libraries/config/validate.lib.php';
header('Content-type: application/json');
@@ -24,7 +22,7 @@ if (!($values instanceof stdClass)) {
die('Wrong data');
}
$values = (array)$values;
-$result = validate($vids, $values, true);
+$result = PMA_config_validate($vids, $values, true);
if ($result === false) {
$result = 'Wrong data or no validation for ' . $vids;
}
diff --git a/themes/darkblue_orange/css/theme_right.css.php b/themes/darkblue_orange/css/theme_right.css.php
index c15f796..73f1c37 100644
--- a/themes/darkblue_orange/css/theme_right.css.php
+++ b/themes/darkblue_orange/css/theme_right.css.php
@@ -647,48 +647,88 @@ form.login label {
/* specific elements */
/* topmenu */
-ul#topmenu {
+ul#topmenu, ul#topmenu2, ul.tabs {
font-weight: bold;
list-style-type: none;
margin: 0;
padding: 0;
}
-ul#topmenu li {
+ul#topmenu2 {
+ margin: 0.25em 0.5em 0;
+ height: 2em;
+ clear: both;
+}
+
+ul#topmenu li, ul#topmenu2 li {
float: <?php echo $left; ?>;
margin: 0;
padding: 0;
vertical-align: middle;
}
-#topmenu img {
+#topmenu img, #topmenu2 img {
vertical-align: middle;
margin-<?php echo $right; ?>: 0.1em;
}
/* default tab styles */
-.tab, .tabcaution, .tabactive {
+ul#topmenu a, ul#topmenu span {
display: block;
margin: 0.2em 0.2em 0 0.2em;
padding: 0.2em 0.2em 0 0.2em;
white-space: nowrap;
}
+ul#topmenu ul a {
+ margin: 0;
+ padding-bottom: 0.2em;
+}
+
+ul#topmenu .submenu {
+ position: relative;
+}
+
+ul#topmenu ul {
+ padding: 0;
+ margin: 0;
+ position: absolute;
+ right: 0;
+ list-style-type: none;
+ display: none;
+ border: 1px #666 solid;
+}
+
+ul#topmenu li:hover ul, ul#topmenu .submenuhover ul {
+ display: block;
+}
+
+ul#topmenu ul li {
+ width: 100%;
+}
+
+ul#topmenu2 a {
+ display: block;
+ margin: 0.1em;
+ padding: 0.2em;
+ white-space: nowrap;
+}
+
/* disabled tabs */
-span.tab {
+ul#topmenu span.tab {
color: #666666;
}
/* disabled drop/empty tabs */
-span.tabcaution {
+ul#topmenu span.tabcaution {
color: #ff6666;
}
/* enabled drop/empty tabs */
-a.tabcaution {
+ul#topmenu a.tabcaution {
color: #FF0000;
}
-a.tabcaution:hover {
+ul#topmenu a.tabcaution:hover {
color: #FFFFFF;
background-color: #FF0000;
}
@@ -702,52 +742,83 @@ fieldset.caution a:hover {
<?php if ($GLOBALS['cfg']['LightTabs']) { ?>
/* active tab */
-a.tabactive {
+ul#topmenu a.tabactive, ul#topmenu2 a.tabactive {
color: black;
}
+
+ul#topmenu ul {
+ background: <?php echo $GLOBALS['cfg']['MainBackground']; ?>;
+}
<?php } else { ?>
#topmenu {
margin-top: 0.5em;
padding: 0.1em 0.3em 0.1em 0.3em;
}
-ul#topmenu li {
+ul#topmenu ul {
+ -moz-box-shadow: 2px 2px 3px #666;
+ -webkit-box-shadow: 2px 2px 3px #666;
+ box-shadow: 2px 2px 3px #666;
+}
+
+ul#topmenu > li {
border-bottom: 1pt solid black;
}
/* default tab styles */
-.tab, .tabcaution, .tabactive {
+ul#topmenu a, ul#topmenu span {
background-color: <?php echo $GLOBALS['cfg']['BgOne']; ?>;
- border: 1pt solid <?php echo $GLOBALS['cfg']['BgTwo']; ?>;
- border-bottom: 0;
+ border: 0 solid <?php echo $GLOBALS['cfg']['BgTwo']; ?>;
+ border-width: 1pt 1pt 0 1pt;
-moz-border-radius: 0.4em 0.4em 0 0;
border-radius: 0.4em 0.4em 0 0;
}
+ul#topmenu ul a {
+ border-width: 1pt 0 0 0;
+ -moz-border-radius: 0;
+ border-radius: 0;
+}
+
+ul#topmenu ul li:first-child a {
+ border-width: 0;
+}
+
/* enabled hover/active tabs */
-a.tab:hover,
-a.tabcaution:hover,
-.tabactive,
-.tabactive:hover {
+ul#topmenu > li > a:hover,
+ul#topmenu > li > .tabactive {
margin: 0;
padding: 0.2em 0.4em 0.2em 0.4em;
text-decoration: none;
}
-a.tab:hover,
-.tabactive {
+ul#topmenu ul a:hover,
+ul#topmenu ul .tabactive {
+ text-decoration: none;
+}
+
+ul#topmenu a.tab:hover,
+ul#topmenu .tabactive {
background-color: <?php echo $GLOBALS['cfg']['MainBackground']; ?>;
}
+ul#topmenu2 a.tab:hover,
+ul#topmenu2 a.tabactive {
+ background-color: <?php echo $GLOBALS['cfg']['BgOne']; ?>;
+ -moz-border-radius: 0.3em;
+ border-radius: 0.3em;
+ text-decoration: none;
+}
+
/* to be able to cancel the bottom border, use <li class="active"> */
-ul#topmenu li.active {
+ul#topmenu > li.active {
border-bottom: 1pt solid <?php echo $GLOBALS['cfg']['MainBackground']; ?>;
}
/* disabled drop/empty tabs */
-span.tab,
+ul#topmenu span.tab,
a.warning,
-span.tabcaution {
+ul#topmenu span.tabcaution {
cursor: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>error.ico), default;
}
<?php } ?>
@@ -1146,6 +1217,10 @@ li#li_switch_dbstats {
li#li_flush_privileges {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_reload.png);
}
+
+li#li_user_preferences {
+ list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>b_tblops.png);
+}
/* END iconic view for ul items */
<?php } /* end if $GLOBALS['cfg']['MainPageIconic'] */ ?>
@@ -1270,6 +1345,12 @@ code.sql, div.sqlvalidate {
margin-top: 0;
}
+.group-cnt {
+ padding: 0 0 0 0.5em;
+ display: inline-block;
+ width: 98%;
+}
+
/* for elements that should be revealed only via js */
.hide {
display: none;
@@ -1496,4 +1577,211 @@ a.close_enum_editor {
td.more_opts {
display: none;
white-space: nowrap;
-}
\ No newline at end of file
+}
+
+/* config forms */
+.config-form ul.tabs {
+ margin: 1.1em 0.2em 0;
+ padding: 0 0 0.3em 0;
+ list-style: none;
+ font-weight: bold;
+}
+
+.config-form ul.tabs li {
+ float: <?php echo $left; ?>;
+}
+
+.config-form ul.tabs li a {
+ display: block;
+ margin: 0.1em 0.2em 0;
+ padding: 0.1em 0.4em;
+ white-space: nowrap;
+ text-decoration: none;
+ border: 1px solid <?php echo $GLOBALS['cfg']['BgTwo']; ?>;
+ border-bottom: none;
+}
+
+.config-form ul.tabs li a:hover,
+.config-form ul.tabs li a:active,
+.config-form ul.tabs li a.active {
+ margin: 0;
+ padding: 0.1em 0.6em 0.2em;
+}
+
+.config-form ul.tabs li a.active {
+ background-color: <?php echo $GLOBALS['cfg']['BgOne']; ?>;
+}
+
+.config-form fieldset {
+ margin-top: 0;
+ padding: 0;
+ clear: both;
+ /*border-color: <?php echo $GLOBALS['cfg']['BgTwo']; ?>;*/
+}
+
+.config-form legend {
+ display: none;
+}
+
+.config-form fieldset p {
+ margin: 0;
+ padding: 0.5em;
+}
+
+.config-form fieldset .errors { /* form error list */
+ margin: 0 -2px 1em -2px;
+ padding: 0.5em 1.5em;
+ background: #FBEAD9;
+ border: 0 #C83838 solid;
+ border-width: 1px 0;
+ list-style: none;
+ font-family: sans-serif;
+ font-size: small;
+}
+
+.config-form fieldset .inline_errors { /* field error list */
+ margin: 0.3em 0.3em 0.3em 0;
+ padding: 0;
+ list-style: none;
+ color: #9A0000;
+ font-size: small;
+}
+
+.config-form fieldset th {
+ padding: 0.3em 0.3em 0.3em 0.5em;
+ text-align: left;
+ vertical-align: top;
+ width: 40%;
+ background: transparent;
+}
+
+.config-form fieldset .doc, .config-form fieldset .disabled-notice {
+ margin-left: 1em;
+}
+
+.config-form fieldset .disabled-notice {
+ font-size: 80%;
+ text-transform: uppercase;
+ color: #E00;
+ cursor: help;
+}
+
+.config-form fieldset td {
+ padding-top: 0.3em;
+ padding-bottom: 0.3em;
+ vertical-align: top;
+}
+
+.config-form fieldset th small {
+ display: block;
+ font-weight: normal;
+ font-family: sans-serif;
+ font-size: x-small;
+ color: #444;
+}
+
+.config-form fieldset th, .config-form fieldset td {
+ border-top: 1px <?php echo $GLOBALS['cfg']['BgTwo']; ?> solid;
+}
+
+fieldset .group-header th {
+ background: <?php echo $GLOBALS['cfg']['BgTwo']; ?>;
+}
+
+fieldset .group-header + tr th {
+ padding-top: 0.6em;
+}
+
+fieldset .group-field th {
+ padding-left: 1.5em;
+}
+
+fieldset .disabled-field th,
+fieldset .disabled-field th small,
+fieldset .disabled-field td {
+ color: #777;
+ background-color: #eee;
+}
+
+.config-form .lastrow {
+ border-top: 1px #000 solid;
+}
+
+.config-form .lastrow {
+ background: <?php echo $GLOBALS['cfg']['ThBackground']; ?>;;
+ padding: 0.5em;
+ text-align: center;
+}
+
+.config-form .lastrow input {
+ font-weight: bold;
+}
+
+/* form elements */
+
+.config-form span.checkbox {
+ padding: 2px;
+ display: inline-block;
+}
+
+.config-form .custom { /* customized field */
+ background: #FFC;
+}
+
+.config-form span.checkbox.custom {
+ padding: 1px;
+ border: 1px #EDEC90 solid;
+ background: #FFC;
+}
+
+.config-form .field-error {
+ border-color: #A11 !important;
+}
+
+.config-form input[type="text"],
+.config-form select,
+.config-form textarea {
+ border: 1px #A7A6AA solid;
+ height: auto;
+}
+
+.config-form input[type="text"]:focus,
+.config-form select:focus,
+.config-form textarea:focus {
+ border: 1px #6676FF solid;
+ background: #F7FBFF;
+}
+
+.config-form .field-comment-mark {
+ font-family: serif;
+ color: #00A;
+ cursor: help;
+ padding: 0 0.2em;
+ font-weight: bold;
+ font-style: italic;
+}
+
+.config-form .field-comment-warning {
+ color: #A00;
+}
+
+/* error list */
+.config-form dd {
+ margin-left: 0.5em;
+}
+
+.config-form dd:before {
+ content: "\25B8 ";
+}
+
+.click-hide-message {
+ cursor: pointer;
+}
+
+.prefsmanage_opts {
+ margin-<?php echo $left; ?>: 2em;
+}
+
+#prefs_autoload {
+ margin-bottom: 0.5em;
+}
diff --git a/themes/darkblue_orange/img/b_more.png b/themes/darkblue_orange/img/b_more.png
new file mode 100644
index 0000000..161e0ff
Binary files /dev/null and b/themes/darkblue_orange/img/b_more.png differ
diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php
index 13a1152..1d6da61 100644
--- a/themes/original/css/theme_right.css.php
+++ b/themes/original/css/theme_right.css.php
@@ -16,7 +16,7 @@ if (!defined('PMA_MINIMUM_COMMON')) {
/* general tags */
html {
font-size: <?php echo (null !== $GLOBALS['PMA_Config']->get('fontsize') ? $GLOBALS['PMA_Config']->get('fontsize') : (
- isset($_COOKIE['pma_fontsize']) ? $_COOKIE['pma_fontsize'] : '84%'));?>;
+ isset($_COOKIE['pma_fontsize']) ? $_COOKIE['pma_fontsize'] : '82%'));?>;
}
input, select, textarea {
@@ -59,7 +59,7 @@ a:visited,
a:active {
text-decoration: none;
color: #0000FF;
- cursor: pointer;
+ cursor: pointer;
}
a:hover {
@@ -523,7 +523,6 @@ fieldset.confirmation legend {
<?php } ?>
<?php } ?>
}
-
/* end messageboxes */
@@ -625,48 +624,88 @@ form.login label {
/* specific elements */
/* topmenu */
-ul#topmenu {
+ul#topmenu, ul#topmenu2, ul.tabs {
font-weight: bold;
list-style-type: none;
margin: 0;
padding: 0;
}
-ul#topmenu li {
+ul#topmenu2 {
+ margin: 0.25em 0.5em 0;
+ height: 2em;
+ clear: both;
+}
+
+ul#topmenu li, ul#topmenu2 li {
float: <?php echo $left; ?>;
margin: 0;
padding: 0;
vertical-align: middle;
}
-#topmenu img {
+#topmenu img, #topmenu2 img {
vertical-align: middle;
margin-<?php echo $right; ?>: 0.1em;
}
/* default tab styles */
-.tab, .tabcaution, .tabactive {
+ul#topmenu a, ul#topmenu span {
display: block;
margin: 0.2em 0.2em 0 0.2em;
padding: 0.2em 0.2em 0 0.2em;
white-space: nowrap;
}
+ul#topmenu ul a {
+ margin: 0;
+ padding-bottom: 0.2em;
+}
+
+ul#topmenu .submenu {
+ position: relative;
+}
+
+ul#topmenu ul {
+ margin: 0;
+ padding: 0;
+ position: absolute;
+ right: 0;
+ list-style-type: none;
+ display: none;
+ border: 1px #666 solid;
+}
+
+ul#topmenu li:hover ul, ul#topmenu .submenuhover ul {
+ display: block;
+}
+
+ul#topmenu ul li {
+ width: 100%;
+}
+
+ul#topmenu2 a {
+ display: block;
+ margin: 0.1em;
+ padding: 0.2em;
+ white-space: nowrap;
+}
+
/* disabled tabs */
-span.tab {
+ul#topmenu span.tab {
color: #666666;
}
/* disabled drop/empty tabs */
-span.tabcaution {
+ul#topmenu span.tabcaution {
color: #ff6666;
}
/* enabled drop/empty tabs */
-a.tabcaution {
+ul#topmenu a.tabcaution {
color: #FF0000;
}
-a.tabcaution:hover {
+ul#topmenu a.tabcaution:hover {
color: #FFFFFF;
background-color: #FF0000;
}
@@ -680,52 +719,83 @@ fieldset.caution a:hover {
<?php if ($GLOBALS['cfg']['LightTabs']) { ?>
/* active tab */
-a.tabactive {
+ul#topmenu a.tabactive, ul#topmenu2 a.tabactive {
color: black;
}
+
+ul#topmenu ul {
+ background: <?php echo $GLOBALS['cfg']['MainBackground']; ?>;
+}
<?php } else { ?>
#topmenu {
margin-top: 0.5em;
padding: 0.1em 0.3em 0.1em 0.3em;
}
-ul#topmenu li {
+ul#topmenu ul {
+ -moz-box-shadow: 2px 2px 3px #666;
+ -webkit-box-shadow: 2px 2px 3px #666;
+ box-shadow: 2px 2px 3px #666;
+}
+
+ul#topmenu > li {
border-bottom: 1pt solid black;
}
/* default tab styles */
-.tab, .tabcaution, .tabactive {
+ul#topmenu a, ul#topmenu span {
background-color: <?php echo $GLOBALS['cfg']['BgOne']; ?>;
- border: 1pt solid <?php echo $GLOBALS['cfg']['BgTwo']; ?>;
- border-bottom: 0;
+ border: 0 solid <?php echo $GLOBALS['cfg']['BgTwo']; ?>;
+ border-width: 1pt 1pt 0 1pt;
-moz-border-radius: 0.4em 0.4em 0 0;
border-radius: 0.4em 0.4em 0 0;
}
+ul#topmenu ul a {
+ border-width: 1pt 0 0 0;
+ -moz-border-radius: 0;
+ border-radius: 0;
+}
+
+ul#topmenu ul li:first-child a {
+ border-width: 0;
+}
+
/* enabled hover/active tabs */
-a.tab:hover,
-a.tabcaution:hover,
-.tabactive,
-.tabactive:hover {
+ul#topmenu > li > a:hover,
+ul#topmenu > li > .tabactive {
margin: 0;
padding: 0.2em 0.4em 0.2em 0.4em;
text-decoration: none;
}
-a.tab:hover,
-.tabactive {
+ul#topmenu ul a:hover,
+ul#topmenu ul .tabactive {
+ text-decoration: none;
+}
+
+ul#topmenu a.tab:hover,
+ul#topmenu .tabactive {
background-color: <?php echo $GLOBALS['cfg']['MainBackground']; ?>;
}
+ul#topmenu2 a.tab:hover,
+ul#topmenu2 a.tabactive {
+ background-color: <?php echo $GLOBALS['cfg']['BgOne']; ?>;
+ -moz-border-radius: 0.3em;
+ border-radius: 0.3em;
+ text-decoration: none;
+}
+
/* to be able to cancel the bottom border, use <li class="active"> */
-ul#topmenu li.active {
+ul#topmenu > li.active {
border-bottom: 1pt solid <?php echo $GLOBALS['cfg']['MainBackground']; ?>;
}
/* disabled drop/empty tabs */
-span.tab,
+ul#topmenu span.tab,
a.warning,
-span.tabcaution {
+ul#topmenu span.tabcaution {
cursor: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>error.ico), default;
}
<?php } ?>
@@ -1097,6 +1167,10 @@ li#li_switch_dbstats {
li#li_flush_privileges {
list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_reload.png);
}
+
+li#li_user_preferences {
+ list-style-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>b_tblops.png);
+}
/* END iconic view for ul items */
<?php } /* end if $GLOBALS['cfg']['MainPageIconic'] */ ?>
@@ -1220,11 +1294,17 @@ code.sql, div.sqlvalidate {
}
.group h2 {
- background: <?php echo $GLOBALS['cfg']['ThBackground']; ?>;
+ background: <?php echo $GLOBALS['cfg']['ThBackground']; ?>;
padding: 0.1em 0.3em;
margin-top: 0;
}
+.group-cnt {
+ padding: 0 0 0 0.5em;
+ display: inline-block;
+ width: 98%;
+}
+
/* for elements that should be revealed only via js */
.hide {
display: none;
@@ -1423,8 +1503,6 @@ a.close_enum_editor {
width: 100%;
}
-#enum_editor input, #enum_editor_no_js input {
- float: bottom;
}
#enum_editor_output {
@@ -1452,4 +1530,211 @@ iframe.IE_hack {
display: none;
border: 0;
filter: alpha(opacity=0);
-}
\ No newline at end of file
+}
+
+/* config forms */
+.config-form ul.tabs {
+ margin: 1.1em 0.2em 0;
+ padding: 0 0 0.3em 0;
+ list-style: none;
+ font-weight: bold;
+}
+
+.config-form ul.tabs li {
+ float: <?php echo $left; ?>;
+}
+
+.config-form ul.tabs li a {
+ display: block;
+ margin: 0.1em 0.2em 0;
+ padding: 0.1em 0.4em;
+ white-space: nowrap;
+ text-decoration: none;
+ border: 1px solid <?php echo $GLOBALS['cfg']['BgTwo']; ?>;
+ border-bottom: none;
+}
+
+.config-form ul.tabs li a:hover,
+.config-form ul.tabs li a:active,
+.config-form ul.tabs li a.active {
+ margin: 0;
+ padding: 0.1em 0.6em 0.2em;
+}
+
+.config-form ul.tabs li a.active {
+ background-color: <?php echo $GLOBALS['cfg']['BgOne']; ?>;
+}
+
+.config-form fieldset {
+ margin-top: 0;
+ padding: 0;
+ clear: both;
+ /*border-color: <?php echo $GLOBALS['cfg']['BgTwo']; ?>;*/
+}
+
+.config-form legend {
+ display: none;
+}
+
+.config-form fieldset p {
+ margin: 0;
+ padding: 0.5em;
+}
+
+.config-form fieldset .errors { /* form error list */
+ margin: 0 -2px 1em -2px;
+ padding: 0.5em 1.5em;
+ background: #FBEAD9;
+ border: 0 #C83838 solid;
+ border-width: 1px 0;
+ list-style: none;
+ font-family: sans-serif;
+ font-size: small;
+}
+
+.config-form fieldset .inline_errors { /* field error list */
+ margin: 0.3em 0.3em 0.3em 0;
+ padding: 0;
+ list-style: none;
+ color: #9A0000;
+ font-size: small;
+}
+
+.config-form fieldset th {
+ padding: 0.3em 0.3em 0.3em 0.5em;
+ text-align: left;
+ vertical-align: top;
+ width: 40%;
+ background: transparent;
+}
+
+.config-form fieldset .doc, .config-form fieldset .disabled-notice {
+ margin-left: 1em;
+}
+
+.config-form fieldset .disabled-notice {
+ font-size: 80%;
+ text-transform: uppercase;
+ color: #E00;
+ cursor: help;
+}
+
+.config-form fieldset td {
+ padding-top: 0.3em;
+ padding-bottom: 0.3em;
+ vertical-align: top;
+}
+
+.config-form fieldset th small {
+ display: block;
+ font-weight: normal;
+ font-family: sans-serif;
+ font-size: x-small;
+ color: #444;
+}
+
+.config-form fieldset th, .config-form fieldset td {
+ border-top: 1px <?php echo $GLOBALS['cfg']['BgTwo']; ?> solid;
+}
+
+fieldset .group-header th {
+ background: <?php echo $GLOBALS['cfg']['BgTwo']; ?>;
+}
+
+fieldset .group-header + tr th {
+ padding-top: 0.6em;
+}
+
+fieldset .group-field th {
+ padding-left: 1.5em;
+}
+
+fieldset .disabled-field th,
+fieldset .disabled-field th small,
+fieldset .disabled-field td {
+ color: #666;
+ background-color: #ddd;
+}
+
+.config-form .lastrow {
+ border-top: 1px #000 solid;
+}
+
+.config-form .lastrow {
+ background: <?php echo $GLOBALS['cfg']['ThBackground']; ?>;;
+ padding: 0.5em;
+ text-align: center;
+}
+
+.config-form .lastrow input {
+ font-weight: bold;
+}
+
+/* form elements */
+
+.config-form span.checkbox {
+ padding: 2px;
+ display: inline-block;
+}
+
+.config-form .custom { /* customized field */
+ background: #FFC;
+}
+
+.config-form span.checkbox.custom {
+ padding: 1px;
+ border: 1px #EDEC90 solid;
+ background: #FFC;
+}
+
+.config-form .field-error {
+ border-color: #A11 !important;
+}
+
+.config-form input[type="text"],
+.config-form select,
+.config-form textarea {
+ border: 1px #A7A6AA solid;
+ height: auto;
+}
+
+.config-form input[type="text"]:focus,
+.config-form select:focus,
+.config-form textarea:focus {
+ border: 1px #6676FF solid;
+ background: #F7FBFF;
+}
+
+.config-form .field-comment-mark {
+ font-family: serif;
+ color: #007;
+ cursor: help;
+ padding: 0 0.2em;
+ font-weight: bold;
+ font-style: italic;
+}
+
+.config-form .field-comment-warning {
+ color: #A00;
+}
+
+/* error list */
+.config-form dd {
+ margin-left: 0.5em;
+}
+
+.config-form dd:before {
+ content: "\25B8 ";
+}
+
+.click-hide-message {
+ cursor: pointer;
+}
+
+.prefsmanage_opts {
+ margin-<?php echo $left; ?>: 2em;
+}
+
+#prefs_autoload {
+ margin-bottom: 0.5em;
+}
diff --git a/themes/original/img/b_more.png b/themes/original/img/b_more.png
new file mode 100644
index 0000000..4a12e8c
Binary files /dev/null and b/themes/original/img/b_more.png differ
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, TESTING, updated. RELEASE_3_3_6RC1-10-gd206c6b
by Marc Delisle 20 Aug '10
by Marc Delisle 20 Aug '10
20 Aug '10
The branch, TESTING has been updated
via d206c6b775d3774ce942d12e6109e6bfe652ef6b (commit)
via 1e7bc7d691fa8abcdde87a70ed6cef6f30cbe107 (commit)
via 8b53799f0da2992b41c1895a8e9f7db10fd2a82f (commit)
via 41145feb12e1fe2f7af54c1ccb89a714c39bfb12 (commit)
via 893abac3e516b3f6143925a5f24c8bc463639167 (commit)
via a29323a1a6d1a3d4e65d80f0719b4199c18c3f4a (commit)
via e8cf1ac6773cf868ff79ed286494ea13b58da528 (commit)
via 9e2a3f207b0d983d7c2998670232e7c0632146fb (commit)
via 80cca2d68c0995a5c499f8b4ca8fa9d1a7c15fa6 (commit)
via dda6de20d25f4622b36407c46e87d59d7820131c (commit)
via 789d3a4131c9af4cd22c8a1d4104eaa5e87aae25 (commit)
via 04c2f9d25444479ca4ddcbe83f58a06c13572fa4 (commit)
via d42dab9dd48e337f9b4e8f59f16e04db908ce5e8 (commit)
via 158517d7644b83459dc67210e66c0c8b96c3d4cd (commit)
via fd1d214d35270f881ae4a12555b1a0f467e2381a (commit)
via e6e78a1fa450674f784b7d03d31793d7384913cd (commit)
via 7951b2bacc63d7dc408ead0cf2fcb126c001d17e (commit)
via 4317af25ef788f0aae1a498e1ce8b9d708f347ac (commit)
via e43fe5a8f100c772602aae71da9c529a542db493 (commit)
via 049fc7fef7548c2ba603196937c6dcaf9ff9bf00 (commit)
via 83d458aa05286397198bcd0674eeeb610849ef5a (commit)
via 053d6ca88e1a72a839f517b22f3389f59575baf7 (commit)
via 368cf8d74f77cf71d279c1c87f4feac4c862c44f (commit)
via 8b592a365bc46992223ea041dce3e992dba3c839 (commit)
via ef500cd23fd863e62bf810537776b45a4ed76c34 (commit)
via 828d008838565b1980c67e82ff48eb087a0bcb9a (commit)
from fbfc4d6e6d1be2314ed1d3e13142b1bb861fbfab (commit)
- Log -----------------------------------------------------------------
commit d206c6b775d3774ce942d12e6109e6bfe652ef6b
Merge: fbfc4d6e6d1be2314ed1d3e13142b1bb861fbfab 1e7bc7d691fa8abcdde87a70ed6cef6f30cbe107
Author: Marc Delisle <marc(a)infomarc.info>
Date: Fri Aug 20 13:06:33 2010 -0400
Merge branch 'MAINT_3_3_6' into TESTING
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 14 ++++
Documentation.html | 63 ++++------------
README | 4 +-
js/functions.js | 12 ++-
lang/brazilian_portuguese-utf-8.inc.php | 12 ++--
lang/german-utf-8.inc.php | 2 +-
lang/slovenian-utf-8.inc.php | 48 ++++++------
lang/turkish-utf-8.inc.php | 124 +++++++++++++++---------------
lang/ukrainian-utf-8.inc.php | 26 +++---
libraries/Config.class.php | 2 +-
libraries/common.lib.php | 75 +------------------
libraries/core.lib.php | 72 ++++++++++++++++++
libraries/database_interface.lib.php | 2 +-
libraries/dbi/mysqli.dbi.lib.php | 3 +-
libraries/header.inc.php | 5 +-
libraries/session.inc.php | 3 +-
libraries/sql_query_form.lib.php | 2 +-
libraries/tbl_links.inc.php | 1 -
server_privileges.php | 5 +
sql.php | 3 +
themes/.gitignore | 27 +++++++
translators.html | 4 +-
22 files changed, 266 insertions(+), 243 deletions(-)
create mode 100644 themes/.gitignore
diff --git a/ChangeLog b/ChangeLog
index 4183ff5..81670e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,20 @@ phpMyAdmin - ChangeLog
$Id$
$HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyAdmin/… $
+3.3.6.0 (not yet released)
+- bug #3033063 [core] Navi gets wrong db name
+- bug #3031705 [core] Fix generating condition for real numbers by comparing
+ them to string.
+- bug #3034026 [confirmation] TRUNCATE queries get no confirmation request
+- bug #3036132 [core] Triggers not fetched if dbname has an hyphen
+- patch #3039269 [dbi] Wrong variable checked for nopassword option,
+ thanks to Will Palmer - wpalmer
+- bug #3040226 [XHTML] LockFromUpdate checkbox not checked by default
+- bug [doc] Withdraw or edit FAQ entries related to older MySQL or PHP
+- bug #3042706 [pmadb] Relations, bookmarks, etc deleted after table drop
+- bug #3044189 [doc] Cleared documentation for hide_db.
+- bug #3042495 [core] Move PMA_sendHeaderLocation to core.lib.php.
+
3.3.5.1 (2010-10-20)
- [core] Fixed various XSS issues, see PMASA-2010-5 for more details.
diff --git a/Documentation.html b/Documentation.html
index 289d02a..3ef61da 100644
--- a/Documentation.html
+++ b/Documentation.html
@@ -10,7 +10,7 @@ vim: expandtab ts=4 sw=4 sts=4 tw=78
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>phpMyAdmin 3.3.5.1 - Documentation</title>
+ <title>phpMyAdmin 3.3.6-rc1 - Documentation</title>
<link rel="stylesheet" type="text/css" href="docs.css" />
</head>
@@ -18,7 +18,7 @@ vim: expandtab ts=4 sw=4 sts=4 tw=78
<div id="header">
<h1>
<a href="http://www.phpmyadmin.net/">php<span class="myadmin">MyAdmin</span></a>
- 3.3.5.1
+ 3.3.6-rc1
Documentation
</h1>
</div>
@@ -369,7 +369,7 @@ rm -rf config # remove not needed directory
is version-specific.</p>
<p> If you have upgraded your MySQL server from a version previous to 4.1.2 to
- version 4.1.2 or newer and if you use the pmadb/linked table infrastructure,
+ version 5.x or newer and if you use the pmadb/linked table infrastructure,
you should run the SQL script found in
<tt>scripts/upgrade_tables_mysql_4_1_2+.sql</tt>.</p>
@@ -380,8 +380,7 @@ rm -rf config # remove not needed directory
where you want to give users access to their own database and don't want
them to play around with others.<br />
Nevertheless be aware that MS Internet Explorer seems to be really buggy
- about cookies, at least till version 6, and PHP 4.1.1 is also a bit buggy
- in this area!<br />
+ about cookies, at least till version 6.<br />
Even in a <b>single-user environment</b>, you might prefer to use
<abbr title="HyperText Transfer Protocol">HTTP</abbr> or cookie mode so
that your user/password pair are not in clear in the configuration file.
@@ -835,7 +834,7 @@ since this link provides funding for phpMyAdmin.
For example, to hide all databases starting with the letter "a", use<br />
<pre>$cfg['Servers'][$i]['hide_db'] = '^a';</pre>
and to hide both "db1" and "db2" use <br />
- <pre>$cfg['Servers'][$i]['hide_db'] = '(db1|db2)';</pre>
+ <pre>$cfg['Servers'][$i]['hide_db'] = '^(db1|db2)$';</pre>
More information on regular expressions can be found in the
<a href="http://php.net/manual/en/reference.pcre.pattern.syntax.php">
PCRE pattern syntax</a> portion of the PHP reference manual.
@@ -2573,18 +2572,14 @@ setfacl -d -m "g:www-data:rwx" tmp
<h3 id="faqserver">Server</h3>
<h4 id="faq1_1">
- <a href="#faq1_1">1.1 I'm running PHP 4+ and my server is crashing each time a specific
+ <a href="#faq1_1">1.1 My server is crashing each time a specific
action is required or phpMyAdmin sends a blank page or a page full of
cryptic characters to my browser, what can I do?</a></h4>
-<p> There are some known PHP bugs with output buffering and compression.<br />
- Try to set the <a href="#cfg_OBGzip" class="configrule">$cfg['OBGzip']</a>
+<p> Try to set the <a href="#cfg_OBGzip" class="configrule">$cfg['OBGzip']</a>
directive to <tt>FALSE</tt> in your <i>config.inc.php</i> file and the
<tt>zlib.output_compression</tt> directive to <tt>Off</tt> in your php
- configuration file.<br />
- Furthermore, we know about such problems connected to the release
- candidates of PHP 4.2.0 (tested with PHP 4.2.0 RC1 to RC4) together with
- MS Internet Explorer. Please upgrade to the release version PHP 4.2.0.</p>
+ configuration file.<br /></p>
<h4 id="faq1_2">
<a href="#faq1_2">1.2 My Apache server crashes when using phpMyAdmin.</a></h4>
@@ -2597,14 +2592,7 @@ setfacl -d -m "g:www-data:rwx" tmp
support groups.</p>
<h4 id="faq1_3">
- <a href="#faq1_3">1.3 I'm running phpMyAdmin with "cookie" authentication
- mode under PHP 4.2.0 or 4.2.1 loaded as an Apache 2 module but can't enter the
- script: I'm always displayed the login screen.</a></h4>
-
-<p> This is a known PHP bug (see this
- <a href="http://bugs.php.net/bug.php?id=16626">bug report</a>) from the
- official PHP bug database. It means there is and won't be any phpMyAdmin
- fix against it because there is no way to code a fix.</p>
+ <a href="#faq1_3">1.3 (withdrawn).</a></h4>
<h4 id="faq1_4">
<a href="#faq1_4">1.4 Using phpMyAdmin on
@@ -2647,11 +2635,8 @@ setfacl -d -m "g:www-data:rwx" tmp
<p> These features are based on the <tt>gzencode()</tt> and <tt>bzcompress()</tt>
PHP functions to be more independent of the platform (Unix/Windows, Safe Mode
- or not, and so on). So, you must have PHP4 >= 4.0.4 and Zlib/Bzip2
- support (<tt>--with-zlib</tt> and <tt>--with-bz2</tt>).<br />
- We faced PHP crashes when trying to download a dump with MS Internet
- Explorer when phpMyAdmin is run with a release candidate of PHP 4.2.0. In
- this case you should switch to the release version of PHP 4.2.0.</p>
+ or not, and so on). So, you must have Zlib/Bzip2
+ support (<tt>--with-zlib</tt> and <tt>--with-bz2</tt>).<br /></p>
<h4 id="faq1_8">
<a href="#faq1_8">1.8 I cannot insert a text file in a table, and I get
@@ -2820,15 +2805,7 @@ setfacl -d -m "g:www-data:rwx" tmp
</p>
<h4 id="faq1_18">
- <a href="#faq1_18">1.18 I'm running MySQL <= 4.0.1 having
- <tt>lower_case_table_names</tt> set to 1. If I create a new table with a
- capital letter in its name it is changed to lowercase as it should. But
- if I try to DROP this table MySQL is unable to find the corresponding
- file.</a></h4>
-
-<p> This is a bug of MySQL <= 4.0.1. Please upgrade to at least
- MySQL 4.0.2 or turn off your <tt>lower_case_table_names</tt>
- directive.</p>
+ <a href="#faq1_18">1.18 (withdrawn).
<h4 id="faq1_19">
<a href="#faq1_19">1.19 I can't run the "display relations" feature because the
@@ -2884,11 +2861,7 @@ setfacl -d -m "g:www-data:rwx" tmp
<pre>SHOW VARIABLES LIKE 'lower_case_table_names';</pre>
<h4 id="faq1_24">
- <a href="#faq1_24">1.24 Some characters are being truncated in my queries, or I
- get characters randomly added. I am running PHP 4.2.3.</a></h4>
-
-<p> This is a <a href="http://bugs.php.net/bug.php?id=19404">PHP 4.2.3 bug</a>.
- </p>
+ <a href="#faq1_24">1.24 (withdrawn).</a></h4>
<h4 id="faq1_25">
<a href="#faq1_25">1.25 I am running Apache with mod_gzip-1.3.26.1a on Windows XP,
@@ -3702,11 +3675,7 @@ $cfg['Servers'][$i]['AllowDeny']['rules'] = array(
</a></h4>
<p>
MS Internet Explorer seems to be really buggy about cookies, at least till
- version 6. And thanks to Andrew Zivolup we've traced also a PHP 4.1.1 bug
- in this area!
- <br />
- Then, if you're running PHP 4.1.1, try to upgrade or downgrade... it may
- work!
+ version 6.
</p>
<h4 id="faq5_5">
@@ -4222,11 +4191,11 @@ INSERT INTO REL_towns VALUES ('M', 'Montréal');
</pre>
<h4 id="faq6_20">
- <a href="#faq6_20">6.20 In MySQL 4, I see a lot of databases which are not mine, and cannot
+ <a href="#faq6_20">6.20 I see a lot of databases which are not mine, and cannot
access them.
</a></h4>
-<p> Upgrading to MySQL 4 usually gives users those global privileges: CREATE
+<p> You have one of these global privileges: CREATE
TEMPORARY TABLES, SHOW DATABASES, LOCK TABLES. Those privileges also
enable users to see all the database names.
See this <a href="http://bugs.mysql.com/179">bug report</a>.<br /><br />
diff --git a/README b/README
index 072d0d9..141934b 100644
--- a/README
+++ b/README
@@ -5,8 +5,8 @@ phpMyAdmin - Readme
A set of PHP-scripts to manage MySQL over the web.
- Version 3.3.5.1
- ---------------
+ Version 3.3.6-rc1
+ -----------------
http://www.phpmyadmin.net/
Copyright (C) 1998-2000 Tobias Ratschiller <tobias_at_ratschiller.com>
diff --git a/js/functions.js b/js/functions.js
index 8c924e0..93cee60 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -152,7 +152,7 @@ function confirmQuery(theForm1, sqlQuery1)
} // end if
} // end if
- // Confirms a "DROP/DELETE/ALTER" statement
+ // Confirms a "DROP/DELETE/ALTER/TRUNCATE" statement
//
// TODO: find a way (if possible) to use the parser-analyser
// for this kind of verification
@@ -162,22 +162,24 @@ function confirmQuery(theForm1, sqlQuery1)
var do_confirm_re_0 = new RegExp('^\\s*DROP\\s+(IF EXISTS\\s+)?(TABLE|DATABASE|PROCEDURE)\\s', 'i');
var do_confirm_re_1 = new RegExp('^\\s*ALTER\\s+TABLE\\s+((`[^`]+`)|([A-Za-z0-9_$]+))\\s+DROP\\s', 'i');
var do_confirm_re_2 = new RegExp('^\\s*DELETE\\s+FROM\\s', 'i');
+ var do_confirm_re_3 = new RegExp('^\\s*TRUNCATE\\s', 'i');
+
if (do_confirm_re_0.test(sqlQuery1.value)
|| do_confirm_re_1.test(sqlQuery1.value)
- || do_confirm_re_2.test(sqlQuery1.value)) {
+ || do_confirm_re_2.test(sqlQuery1.value)
+ || do_confirm_re_3.test(sqlQuery1.value)) {
var message = (sqlQuery1.value.length > 100)
? sqlQuery1.value.substr(0, 100) + '\n ...'
: sqlQuery1.value;
var is_confirmed = confirm(PMA_messages['strDoYouReally'] + ' :\n' + message);
- // drop/delete/alter statement is confirmed -> update the
+ // statement is confirmed -> update the
// "is_js_confirmed" form field so the confirm test won't be
// run on the server side and allows to submit the form
if (is_confirmed) {
theForm1.elements['is_js_confirmed'].value = 1;
return true;
}
- // "DROP/DELETE/ALTER" statement is rejected -> do not submit
- // the form
+ // statement is rejected -> do not submit the form
else {
window.focus();
sqlQuery1.focus();
diff --git a/lang/brazilian_portuguese-utf-8.inc.php b/lang/brazilian_portuguese-utf-8.inc.php
index f9cca11..38afd61 100644
--- a/lang/brazilian_portuguese-utf-8.inc.php
+++ b/lang/brazilian_portuguese-utf-8.inc.php
@@ -1097,7 +1097,7 @@ $strForeignKeyRelationAdded = 'FOREIGN KEY relation added'; //to translate
$strFullStart = 'Full start'; //to translate
$strFullStop = 'Full stop'; //to translate
-$strGetMoreThemes = 'Get more themes!'; //to translate
+$strGetMoreThemes = 'Obter mais temas!';
$strGoToDatabase = 'Go to database'; //to translate
$strGoToTable = 'Go to table'; //to translate
$strGoToView = 'Go to view'; //to translate
@@ -1570,11 +1570,11 @@ $strTableRemoveIndex = 'Remove index(s)'; //to translate
$strTableUpdateRow = 'Update row(s)'; //to translate
$strTargetDatabaseHasBeenSynchronized = 'Target database has been synchronized with source database'; //to translate
$strTrackingActivated = 'Tracking of %s.%s is activated.'; //to translate
-$strTrackingActivateNow = 'Activate now'; //to translate
+$strTrackingActivateNow = 'Ativar agora';
$strTrackingActivateTrackingFor = 'Activate tracking for %s.%s'; //to translate
$strTrackingCommentOut = 'Comment out these two lines if you do not need them.'; //to translate
$strTrackingCreateVersion = 'Create version'; //to translate
-$strTrackingCreateVersionOf = 'Create version %s of %s.%s'; //to translate
+$strTrackingCreateVersionOf = 'Criar versão %s de %s.%s';
$strTrackingDatabaseLog = 'Database Log'; //to translate
$strTrackingDataDefinitionStatement = 'Data definition statement'; //to translate
$strTrackingDataManipulationStatement = 'Data manipulation statement'; //to translate
@@ -1585,15 +1585,15 @@ $strTrackingExportAs = 'Export as %s'; //to translate
$strTrackingIsActive = 'Tracking is active.'; //to translate
$strTrackingIsNotActive = 'Tracking is not active.'; //to translate
$strTrackingMechanism = 'Tracking Mechanism'; //to translate
-$strTrackingReportClose = 'Close'; //to translate
+$strTrackingReportClose = 'Fechar';
$strTrackingReportForTable = 'Tracking report for table `%s`'; //to translate
$strTrackingReport = 'Tracking report'; //to translate
$strTrackingShowLogDateUsers = 'Show %s with dates from %s to %s by user %s %s'; //to translate
-$strTrackingShowVersions = 'Show versions'; //to translate
+$strTrackingShowVersions = 'Exibir versões';
$strTrackingSQLDumpFile = 'SQL dump (file download)'; //to translate
$strTrackingSQLDump = 'SQL dump'; //to translate
$strTrackingSQLExecuted = 'SQL statements executed.'; //to translate
-$strTrackingSQLExecutionAlert = 'This option will replace your table and contained data.'; //to translate
+$strTrackingSQLExecutionAlert = 'Esta opção irá substituir sua tabela e os dados nela contidos.';
$strTrackingSQLExecution = 'SQL execution'; //to translate
$strTrackingSQLExported = 'SQL statements exported. Please copy the dump or execute it.'; //to translate
$strTrackingStatements = 'Tracking statements'; //to translate
diff --git a/lang/german-utf-8.inc.php b/lang/german-utf-8.inc.php
index bf32f9f..52c7ff6 100644
--- a/lang/german-utf-8.inc.php
+++ b/lang/german-utf-8.inc.php
@@ -290,7 +290,7 @@ $strEditPDFPages = 'PDF-Seiten bearbeiten';
$strEditPrivileges = 'Rechte ändern';
$strEffective = 'Effektiv';
$strEmpty = 'Leeren';
-$strEmptyResultSet = 'MySQL lieferte ein leeres Resultat zurück (d. h. null Zeilen).';
+$strEmptyResultSet = 'MySQL lieferte ein leeres Resultat zurück (d.h. null Zeilen).';
$strEnabled = 'Aktiviert';
$strEncloseInTransaction = 'Export in einer Transaktion zusammenfassen';
$strEndCut = 'AUSSCHNITTSENDE';
diff --git a/lang/slovenian-utf-8.inc.php b/lang/slovenian-utf-8.inc.php
index 9a95f7a..96c1fd3 100644
--- a/lang/slovenian-utf-8.inc.php
+++ b/lang/slovenian-utf-8.inc.php
@@ -197,18 +197,18 @@ $strCheckTable = 'Preveri tabelo';
$strChoosePage = 'Izberite stran za urejanje';
$strDanish = 'Dansko';
-$strDatabaseEmpty = 'Ime podatkovne zbirke je prazno!';
+$strDatabaseEmpty = 'Ime zbirke podatkov je prazno!';
$strDatabaseExportOptions = 'Možnosti za izvoz zbirke podatkov';
$strDatabaseHasBeenCreated = 'Podatkovna zbirka %1$s je ustvarjena.';
$strDatabaseHasBeenDropped = 'Podatkovna zbirka %s je zavržena.';
$strDatabaseNotExisting = 'Podatkovna zbirka \'%s\' ne obstaja.';
$strDatabase = 'Podatkovna zbirka';
-$strDatabasesDropped = '%s podatkovne zbirke so uspešno zavržene.';
+$strDatabasesDropped = '%s zbirke podatkov so uspešno zavržene.';
$strDatabases = 'podatkovne baze';
$strDatabase_src = 'Izvorna zbirka podatkov';
$strDatabasesStatsDisable = 'Onemogoči statistiko';
$strDatabasesStatsEnable = 'Omogoči statistiko';
-$strDatabasesStatsHeavyTraffic = 'Obvestilo: Omogočitev statistike podatkovne zbirke lahko povzroči močno povečan promet med spletnim in podatkovnim strežnikom.';
+$strDatabasesStatsHeavyTraffic = 'Obvestilo: Omogočitev statistike zbirke podatkov lahko povzroči močno povečan promet med spletnim in podatkovnim strežnikom.';
$strDatabasesStats = 'Statistika zbirk podatkov';
$strDatabase_trg = 'Ciljna zbirka podatkov';
$strDataDict = 'Slovar podatkov';
@@ -258,7 +258,7 @@ $strDoNotAutoIncrementZeroValues = 'Ne uporabi AUTO_INCREMENT za ničelne vredno
$strDownloadFile = 'Prenesi datoteko';
$strDoYouReally = 'Ali res želite ';
$strDropDatabaseStrongWarning = 'S tem dejanjem boste UNIČILI celotno zbirko podatkov!';
-$strDropUsersDb = 'Izbriši podatkovne zbirke, ki imajo enako ime kot uporabniki.';
+$strDropUsersDb = 'Izbriši zbirke podatkov, ki imajo enako ime kot uporabniki.';
$strDrop = 'Zavrzi';
$strDumpAllRows = 'Odloži vse vrstice';
$strDumpingData = 'Odloži podatke za tabelo';
@@ -312,7 +312,7 @@ $strFields = 'Polja';
$strFieldsTerminatedBy = 'Polja zaključena z';
$strFileAlreadyExists = 'Datoteka %s že obstaja na strežniku, spremenite ime novi ali prepišite obstoječo datoteko.';
$strFileCouldNotBeRead = 'Ne morem prebrati datoteke';
-$strFileNameTemplateDescriptionDatabase = 'ime podatkovne zbirke';
+$strFileNameTemplateDescriptionDatabase = 'ime zbirke podatkov';
$strFileNameTemplateDescriptionServer = 'ime strežnika';
$strFileNameTemplateDescriptionTable = 'ime tabele';
$strFileNameTemplateDescription = 'Vrednost je prevedena z uporabo %1$sstrftime%2$s, tako da lahko uporabljate nize za zapis časa. Dodatno bo prišlo še do naslednjih pretvorb: %3$s. Ostalo besedilo bo ostalo takšno, kot je.';
@@ -392,7 +392,7 @@ $strImportODSCurrency = 'Uvozi denarne enote ($5.00 v 5.00)';
$strImportODSPercents = 'Uvozi odstotke kot ustrezne decimalne vrednosti (12.00% v ,12)';
$strImportProceedingFile = 'Datoteka je v obdelavi, prosim, počakajte.';
$strImportSuccessfullyFinished = 'Uvažanje je uspešno zaključeno, izvedenih je bilo %d poizvedb.';
-$strImportUploadInfoNotAvailable = 'Prosim, bodite potrpežljivi, datoteka za nalaga. Podrobnosti o nalaganju niso na voljo.';
+$strImportUploadInfoNotAvailable = 'Prosim, bodite potrpežljivi, datoteka se nalaga. Podrobnosti o nalaganju niso na voljo.';
$strImport = 'Uvozi';
$strImportXLS = 'Excelov delovni zvezek 97-2003 XLS';
$strImportXLSX = 'Excelov delovni zvezek 2007 XLSX';
@@ -597,9 +597,9 @@ $strPasswordNotSame = 'Gesli se ne ujemata!';
$strPBXTDataFileGrowSizeDesc = 'Velikost rasti datotek za ravnanje s podatki (.xtd).';
$strPBXTDataFileGrowSize = 'Velikost rasti podatkovnih datotek';
$strPBXTDataLogThresholdDesc = 'Največja velikost podatkovnega dnevnika. Privzeta vrednost je 64 MB. PBXT lahko ustvari največ 32000 podatkovnih dnevnikov, katere uporabljajo vse tabele. Tako se lahko ta vrednost poveča za povečanje skupne količine podatkov, ki so lahko shranjeni v zbirki podatkov.';
-$strPBXTDataLogThreshold = 'Omejitev podatkovnega dnevnika';
+$strPBXTDataLogThreshold = 'Prag podatkovnega dnevnika';
$strPBXTGarbageThresholdDesc = 'Odstotek smeti v dnevniški datoteki, preden je ta stisnjena. Vrednost je med 1 in 99. Privzeto je 50.';
-$strPBXTGarbageThreshold = 'Omejitev smeti';
+$strPBXTGarbageThreshold = 'Prag smeti';
$strPBXTCheckpointFrequencyDesc = 'Količina podatkov, zapisanih v dnevnik transakcij, preden se izvede nadzorna točka. Privzeta vrednost je 24 MB.';
$strPBXTCheckpointFrequency = 'Pogostnost nadzornih točk';
$strPBXTIndexCacheSizeDesc = 'Količina pomnilnika uporabljena za predpomnjenje indeksov. Privzeta vrednost je 32 MB. Tukaj dodeljen pomnilnik se uporablja samo za predpomnjenje strani indeksov.';
@@ -611,7 +611,7 @@ $strPBXTLogCacheSize = 'Velikost predpomnilnika dnevnika';
$strPBXTLogFileCountDesc = 'Število datotek transakcijskih dnevnikov (pbxt/system/xlog*.xt), ki jih vzdržuje sistem. Če število dnevnikov presega to vrednost, bodo stari dnevniki izbrani, v naprotnem primeru pa bodo preimenovani in dodeljena jim bo naslednja najvišja številka.';
$strPBXTLogFileCount = 'Število dnevniških datotek';
$strPBXTLogFileThresholdDesc = 'Velikost dnevnika transakcij pred prehodom in ustvarjanjem novega dnevnika. Privzeta vrednost je 16 MB.';
-$strPBXTLogFileThreshold = 'Omejitev dnevniške datoetke';
+$strPBXTLogFileThreshold = 'Prag dnevniške datoteke';
$strPBXTRecordCacheSizeDesc = 'Količina dodeljenega spomina zapisljivemu predpomnilniku, uporabljenemu za predpomnjenje podatkov tabele. Privzeta vrednost je 32 MB. Ta spomin se uporablja za predpomnjenje sprememb datotek oprimkov podatkov (.xtd) in kazalcev vrstic (.xtr).';
$strPBXTRecordCacheSize = 'Velikost predpomnilnika zapisov';
$strPBXTRowFileGrowSizeDesc = 'Velikost rasti datotek kazalca vrstic (.xtr).';
@@ -671,7 +671,7 @@ $strPrivDescInsert = 'Omogoča vstavljanje in zamenjavo podatkov.';
$strPrivDescLockTables = 'Omogoča zaklepanje tabel za trenutno temo.';
$strPrivDescMaxConnections = 'Omeji število povezav, ki jih uporabnik lahko odpre v eni uri.';
$strPrivDescMaxQuestions = 'Omeji število poizved, ki jih uporabnik lahko pošlje strežniku v eni uri.';
-$strPrivDescMaxUpdates = 'Omeji število ukazov za spremembo tabel ali podatkovne zbirke, ki jih uporabnik lahko izvrši v eni uri.';
+$strPrivDescMaxUpdates = 'Omeji število ukazov za spremembo tabel ali zbirke podatkov, ki jih uporabnik lahko izvrši v eni uri.';
$strPrivDescMaxUserConnections = 'Omeji število sočasnih povezav, ki jih lahko ima uporabnik.';
$strPrivDescProcess = 'Omogoča ogled procesov vseh uporabnikov';
$strPrivDescReferences = 'V tej različici MySQL nima pomena.';
@@ -847,7 +847,7 @@ $strSetupAllowArbitraryServer_name = 'Dovoli prijavo v kateri koli strežnik MyS
$strSetupAllowUserDropDatabase_name = 'Pokaži povezavo »Zavrzi zbirko podatkov« normalnim uporabnikom';
$strSetupblowfish_secret_desc = 'Skrivno geslo, ki se uporabi pri šifriranju piškotkov v overovitvi [kbd]cookie[/kbd]';
$strSetupBlowfishSecretCharsMsg = 'Ključ naj vsebuje črke, številke [em]in[/em] posebne znake';
-$strSetupBlowfishSecretLengthMsg = 'Ključ je prekratek, ima naj vsaj 8 znakov.';
+$strSetupBlowfishSecretLengthMsg = 'Ključ je prekratek, ima naj vsaj 8 znakov';
$strSetupBlowfishSecretMsg = 'Ker niste določili skrivnega gesla (blowfish) in imate omogočeno overovitev s piškotki, je bil ključ za vas samodejno ustvarjen. Uporablja se pri šifriranju piškotkov; ne rabite si ga zapomniti.';
$strSetupblowfish_secret_name = 'Skrivno geslo (blowfish)';
$strSetupBrowseMarkerEnable_desc = 'Poudari izbrane vrstice';
@@ -860,7 +860,7 @@ $strSetupBZipDumpWarning = '[a@?page=form&formset=features#tab_Import_export
$strSetupCannotLoadConfigMsg = 'Prosimo, na spletnem strežniku ustvarite zapisljivo mapo [em]config[/em] v najvišjem nivoju mape phpMyAdmina, kot opisuje [a@../Documentation.html#setup_script]dokumentacija[/a]. V naprotnem primeru jo boste lahko samo prenesli ali jo prikazali.';
$strSetupCannotLoadConfig = 'Ne morem naložiti ali shraniti konfiguracije';
$strSetupClear = 'Počisti';
-$strSetupCompressOnFly_desc = 'Stisne izvoze gzip/bzip2 med izvajanjem, brez večje porabe spomina; če naletite na težave z ustvarjenimi datotekami gzip/bzip2, to funkcijo onemogočite.';
+$strSetupCompressOnFly_desc = 'Stisne izvoze gzip/bzip2 med izvajanjem, brez večje porabe spomina; če naletite na težave z ustvarjenimi datotekami gzip/bzip2, to funkcijo onemogočite';
$strSetupCompressOnFly_name = 'Stisni med izvajanjem';
$strSetupConfigurationFile = 'Konfiguracijska datoteka';
$strSetupConfirm_desc = 'Ali se naj prikaže opozorilo ("Ali res želite ..."), ko boste izgubili podatke';
@@ -869,8 +869,8 @@ $strSetupDefaultCharset_desc = 'Privzet nabor znakov uporabljen za pretvorbe';
$strSetupDefaultCharset_name = 'Privzet nabor znakov';
$strSetupDefaultLanguage = 'Privzet jezik';
$strSetupDefaultServer = 'Privzet strežnik';
-$strSetupDefaultTabDatabase_desc = 'Zavihek, ki se prikaže ob odprtju podatkovne zbirke';
-$strSetupDefaultTabDatabase_name = 'Privzet zavihek podatkovne zbirke';
+$strSetupDefaultTabDatabase_desc = 'Zavihek, ki se prikaže ob odprtju zbirke podatkov';
+$strSetupDefaultTabDatabase_name = 'Privzet zavihek zbirke podatkov';
$strSetupDefaultTabServer_desc = 'Zavihek, ki se prikaže ob odprtju strežnika';
$strSetupDefaultTabServer_name = 'Privzet zavihek strežnika';
$strSetupDefaultTabTable_desc = 'Zavihek, ki se prikaže ob odprtju tabele';
@@ -901,7 +901,7 @@ $strSetupExecTimeLimit_desc = 'Nastavi število sekund, ko se skript lahko izvaj
$strSetupExecTimeLimit_name = 'Najdaljši čas izvajanja';
$strSetupExport_asfile_name = 'Shrani kot datoteko';
$strSetupExport_compression_name = 'Stiskanje';
-$strSetupExport_file_template_database_name = 'Predloga imena podatkovne zbirke';
+$strSetupExport_file_template_database_name = 'Predloga imena zbirke podatkov';
$strSetupExport_file_template_server_name = 'Predloga imena strežnika';
$strSetupExport_file_template_table_name = 'Predloga imena tabele';
$strSetupExport_format_name = 'Oblika';
@@ -928,7 +928,7 @@ $strSetupForm_Import_defaults = 'Privzete možnosti uvoza';
$strSetupForm_Import_export_desc = 'Nastavi mape za uvoz in izvoz ter možnosti stiskanja';
$strSetupForm_Import_export = 'Uvoz / izvoz';
$strSetupForm_Left_databases_desc = 'Možnosti prikaza podatkovnih zbirk';
-$strSetupForm_Left_databases = 'Podatkovne zbirke';
+$strSetupForm_Left_databases = 'Zbirke podatkov';
$strSetupForm_Left_frame_desc = 'Prilagodite prikaz navigacijskega okvirja';
$strSetupForm_Left_frame = 'Navigacijski okvir';
$strSetupForm_Left_servers_desc = 'Možnosti prikaza strežnikov';
@@ -1023,7 +1023,7 @@ $strSetupMaxDbList_desc = 'Največje število podatkovnih zbirk prikazanih v lev
$strSetupMaxDbList_name = 'Največ podatkovnih zbirk';
$strSetupMaxCharactersInDisplayedSQL_desc = 'Največje število znakov pri prikazu poizvedbe SQL';
$strSetupMaxCharactersInDisplayedSQL_name = 'Največja dolžina prikazanega SQL';
-$strSetupMaxRows_desc = 'Število prikazanih vrstic med brskanjem po množici rezultatov. Če množica rezultatov vsebuje več vrstic, se prikažeta povezavi "Prejšnja" in "Naslednja"';
+$strSetupMaxRows_desc = 'Število prikazanih vrstic med brskanjem po množici rezultatov. Če množica rezultatov vsebuje več vrstic, se prikažeta povezavi »Prejšnja« in »Naslednja«.';
$strSetupMaxRows_name = 'Največje število vrstic za prikaz';
$strSetupMaxTableList_desc = 'Največje število tabel prikazanih na seznamu tabel';
$strSetupMaxTableList_name = 'Največ tabel';
@@ -1125,7 +1125,7 @@ $strSetupServers_table_coords_name = 'PDF-shema: koordinate tabel';
$strSetupServers_user_desc = 'Pustite prazno, če ne uporabljate overovitve config';
$strSetupServers_user_name = 'Uporabnik za overovitev config';
$strSetupServers_verbose_desc = 'Uporabniku prijazen opis tega strežnika. Pustite prazno, če se naj namesto tega prikaže ime gostitelja.';
-$strSetupServers_verbose_check_desc = 'Onemogočite, če veste, da so vaše tabele pma_* ažurirane. To prepreči preverjanja združljivosti in tako poveča zmogljivost.';
+$strSetupServers_verbose_check_desc = 'Onemogočite, če veste, da so vaše tabele pma_* ažurirane. To prepreči preverjanja združljivosti in tako poveča zmogljivost';
$strSetupServers_verbose_check_name = 'Preverjanje razširitve';
$strSetupServers_verbose_name = 'Razširjeno ime tega strežnika';
$strSetupSetValue = 'Določi vrednost: %s';
@@ -1143,7 +1143,7 @@ $strSetupShowPhpInfo_name = 'Prikaži povezavo phpinfo()';
$strSetupShowServerInfo_name = 'Prikaži podrobne informacije o strežniku MySQL';
$strSetupShowSQL_desc = 'Določi, ali se naj poizvedbe SQL, ki jih ustvari phpMyAdmin, prikažejo';
$strSetupShowSQL_name = 'Pokaži poizvedbe SQL';
-$strSetupShowStats_desc = 'Dovoli prikaz statistike podatkovne zbirke in tabele (npr. poraba prostora)';
+$strSetupShowStats_desc = 'Dovoli prikaz statistike zbirke podatkov in tabele (npr. poraba prostora)';
$strSetupShowStats_name = 'Pokaži statistiko';
$strSetupShowTooltipAliasDB_desc = 'Če so zaslonski namigi omogočeni in ima zbirka podatkov določen komentar, bo to zamenjalo komentar in pravo ime';
$strSetupShowTooltipAliasDB_name = 'Prikaži komentar zbirke podatkov namesto njenega imena';
@@ -1221,7 +1221,7 @@ $strShowStatusHandler_read_rnd_nextDescr = 'Število zahtev za branje naslednje
$strShowStatusHandler_rollbackDescr = 'Število notranjih izjav ROLLBACK.';
$strShowStatusHandler_updateDescr = 'Število zahtev za posodobitev vrstice v tabeli.';
$strShowStatusHandler_writeDescr = 'Število zahtev za vstavitev vrstice v tabelo.';
-$strShowStatusInnodb_buffer_pool_pages_dataDescr = 'Število strani, ki vsebujejo podatke (umazane ali čiste)';
+$strShowStatusInnodb_buffer_pool_pages_dataDescr = 'Število strani, ki vsebujejo podatke (umazane ali čiste).';
$strShowStatusInnodb_buffer_pool_pages_dirtyDescr = 'Število trenutno umazanih strani.';
$strShowStatusInnodb_buffer_pool_pages_flushedDescr = 'Število strani zaloge medpomnilnika, za katere je bila zaprošena izplaknitev.';
$strShowStatusInnodb_buffer_pool_pages_freeDescr = 'Število prostih strani.';
@@ -1429,7 +1429,7 @@ $strTrackingActivateTrackingFor = 'Aktiviraj sledenje %s.%s';
$strTrackingCommentOut = 'Če teh dveh vrstic ne potrebujete, ju dajte v komentar.';
$strTrackingCreateVersionOf = 'Ustvari različico %s tabele %s.%s';
$strTrackingCreateVersion = 'Ustvari različico';
-$strTrackingDatabaseLog = 'Dnevnik podatkovne zbirke';
+$strTrackingDatabaseLog = 'Dnevnik zbirke podatkov';
$strTrackingDataDefinitionStatement = 'Stavek opredeljevanja podatkov';
$strTrackingDataManipulationStatement = 'Stavek upravljanja s podatki';
$strTrackingDate = 'Datum';
@@ -1477,7 +1477,7 @@ $strTransactionCoordinator = 'Koordinator transakcij';
$strTransformation_application_octetstream__download = 'Prikaži povezavo za prenos dvojiških podatkov polja. Prva možnost je ime dvojiške datoteke. Druga možnost je možno ime polja v vrstici tabele, ki vsebuje to ime datoteke. Če vnesete drugo možnost, mora biti prva možnost prazna.';
$strTransformation_application_octetstream__hex = 'Prikaže šestnajstiško predstavljene podatke. Izbirni prvi parameter določa pogostost dodajanja presledkov (privzeto na 2 polzloga).';
$strTransformation_image_jpeg__inline = 'Prikaže sličico, na katero lahko kliknete. Možnosti sta največja širina in višina v slikovnih pikah. Prvotna razmerja se obdržijo.';
-$strTransformation_image_jpeg__link = 'Pokaže povezavo na grafiko (neposredni BLOB prenos, ipd.).';
+$strTransformation_image_jpeg__link = 'Pokaže povezavo za prenos slike.';
$strTransformation_image_png__inline = 'Pokaži sliko/jpeg: vključeno';
$strTransformation_text_plain__external = 'SAMO ZA LINUX: Zažene zunanjo aplikacijo in podaja podatke za fielddata preko standardnega vhoda. Vrne standardni izhod aplikacije. Privzeto je Tidy, za tiskanje HTML-kode. Zaradi varnostnih razlogov morate ročno urediti datoteko libraries/transformations/text_plain__external.inc.php in vstaviti orodja za zaganjanje. Prva možnost je številka programa, ki ga želite uporabiti, druga možnost pa so parametri za program. Če tretji parameter nastavite na 1, bo s pomočjo htmlspecialchars() pretvoril izhod (Privzeto: 1). Če nastavite četrti parameter na 1, bo v celico z vsebino (content cell) vnesel NOWRAP in tako prikazal celoten izhod brez preoblikovanja (Privzeto: 1).';
$strTransformation_text_plain__formatted = 'Prikaže vsebino polja takšno, kot je, brez obdelave s htmlspecialchars(). Zatorej se za polje predvideva, da vsebuje veljaven HTML.';
@@ -1532,8 +1532,8 @@ $strValidatorError = 'Ne morem inicializirati preverjevalnika SQL. Prosimo, prev
$strValue = 'Vrednost';
$strVar = 'Spremenljivka';
$strVersionInformation = 'Podatki o različici';
-$strViewDumpDatabases = 'Pokaži povzetek stanja podatkovnih baz';
-$strViewDumpDB = 'Preglej povzetek stanja podatkovne baze';
+$strViewDumpDatabases = 'Pokaži povzetek stanja zbirk podatkov';
+$strViewDumpDB = 'Preglej povzetek stanja zbirke podatkov';
$strViewDump = 'Preglej povzetek stanja tabele';
$strViewHasAtLeast = 'Pogled ima vsaj toliko vrstic. Prosimo, oglejte si %sdokumentacijo%s.';
$strViewHasBeenDropped = 'Pogled %s je zavržen';
diff --git a/lang/turkish-utf-8.inc.php b/lang/turkish-utf-8.inc.php
index 9d39c63..1ffc70e 100644
--- a/lang/turkish-utf-8.inc.php
+++ b/lang/turkish-utf-8.inc.php
@@ -52,7 +52,7 @@ $strAfterInsertNewInsert = 'Yeni başka bir satır ekle';
$strAfterInsertNext = 'Sonraki satırı düzenle';
$strAfterInsertSame = 'Bu sayfaya geri dön';
$strAfter = '%s tablosundan sonra';
-$strAllowInterrupt = 'Küçük programcığın PHP zaman aşımı sınırına yaklaşıldığını algılaması durumunda içeri aktarımı kesmeye izin ver. Bu büyük dosyaların içeri aktarımı için iyi bir yol olabilir, ancak hareketleri kesebilir.';
+$strAllowInterrupt = 'Betiğin PHP zaman aşımı sınırına yaklaşıldığını algılaması durumunda içe aktarımı kesmeye izin verir. Bu büyük dosyaların içe aktarımı için iyi bir yol olabilir, ancak bu işlemleri bozabilir.';
$strAllTableSameWidth = 'Bütün tablolar aynı genişlikte gösterilsin';
$strAll = 'Tümü';
$strAlterOrderBy = 'Tablo sıralamasını şuna göre değiştir';
@@ -126,8 +126,8 @@ $strBzip = '"bzip olarak"';
$strCalendar = 'Takvim';
$strCancel = 'İptal';
-$strCanNotLoadExportPlugins = 'Dışarı aktarma eklentileri yüklenemedi, lütfen kurulumunuzu kontrol edin!';
-$strCanNotLoadImportPlugins = 'İçeri aktarma eklentileri yüklenemedi, lütfen kurulumunuzu kontrol edin!';
+$strCanNotLoadExportPlugins = 'Dışa aktarma eklentileri yüklenemedi, lütfen kurulumunuzu kontrol edin!';
+$strCanNotLoadImportPlugins = 'İçe aktarma eklentileri yüklenemedi, lütfen kurulumunuzu kontrol edin!';
$strCannotLogin = 'MySQL sunucusuna oturum açılamıyor';
$strCantLoad = '[a@http://php.net/%1$s@Documentation][em]%1$s[/em][/a] uzantısı yüklenemiyor. Lütfen PHP yapılandırmanızı kontrol edin.';
$strCantLoadRecodeIconv = 'Karakter grubu dönüşümü için gerekli olan iconv veya recode uzantıları yüklenemedi. Ya PHP\'yi bu uzantıları etkinleştirmek için yapılandırın ya da phpMyAdmin içinde karakter grubu dönüşümünü etkisizleştirin.';
@@ -149,7 +149,7 @@ $strComment = 'Yorum';
$strCompatibleHashing = 'MySQL 4.0 uyumlu';
$strCompleteInserts = 'Bütün eklemeler';
$strCompression = 'Sıkıştırma';
-$strCompressionWillBeDetected = 'İçeri aktarılmış dosya sıkıştırması otomatik olarak bu dosya türlerinden algılanacak: %s';
+$strCompressionWillBeDetected = 'İçe aktarılmış dosya sıkıştırması otomatik olarak bu dosya türlerinden algılanacak: %s';
$strConfigDefaultFileError = 'Varsayılan yapılandırma bundan yüklenemedi: "%1$s"';
$strConfigDirectoryWarning = 'Kur betiği tarafından kullanılan dizin [code]yapılandırması[/code] hala phpMyAdmin dizininiz içinde mevcut. Birkez phpMyAdmin yapılandırıldı mı bunu kaldırmalısınız.';
$strConfigFileError = 'phpMyAdmin yapılandırma dosyanızı okuyamadı!<br />Bu, eğer PHP, içinde ayrıştırma hatası bulursa ya da dosyayı bulamazsa meydana gelebilir.<br />Lütfen aşağıdaki bağlantıyı kullanarak yapılandırma dosyasını doğrudan çağırın ve aldığınız PHP hata mesaj(larını)ı okuyun. Çoğu durumda herhangi bir yerde tırnak veya noktalı virgül eksiktir.<br />Eğer boş bir sayfa karşınıza çıkıyorsa, her şey yolunda demektir.';
@@ -201,10 +201,10 @@ $strChangeCopyUser = 'Otutum Açma Bilgisini değiştir / Kullanıcıyı kopyala
$strChange = 'Değiştir';
$strChangeDisplay = 'Göstermek için alan seçin';
$strChangePassword = 'Parola değiştir';
-$strCharset = 'Karakter grubu';
+$strCharset = 'Karakter Grubu';
$strCharsetOfFile = 'Dosyanın karakter grubu:';
$strCharsetsAndCollations = 'Karakter Grupları ve Karşılaştırmalar';
-$strCharsets = 'Karakter grupları';
+$strCharsets = 'Karakter Grupları';
$strCheckAll = 'Tümünü Seç';
$strCheckOverhead = 'Ek yükü olan tabloları kontrol et';
$strCheckPrivsLong = '"%s" veritabanı için yetkileri kontrol et.';
@@ -215,7 +215,7 @@ $strChoosePage = 'Lütfen düzenlemek için sayfa seçin';
$strDanish = 'Danca';
$strDatabaseEmpty = 'Veritabanı adı boş!';
-$strDatabaseExportOptions = 'Veritabanı dışarı aktarma seçenekleri';
+$strDatabaseExportOptions = 'Veritabanı dışa aktarma seçenekleri';
$strDatabaseHasBeenCreated = 'Veritabanı %1$s oluşturuldu.';
$strDatabaseHasBeenDropped = '%s veritabanı kaldırıldı.';
$strDatabaseNotExisting = '\'%s\' veritabanı mevcut değil.';
@@ -291,7 +291,7 @@ $strEffective = 'Etkili';
$strEmpty = 'Boşalt';
$strEmptyResultSet = 'MySQL boş bir sonuç kümesi döndürdü (örn. sıfır satır).';
$strEnabled = 'Etkin';
-$strEncloseInTransaction = 'İşlem içinde dışarı aktarmayı kapsa';
+$strEncloseInTransaction = 'İşlem içinde dışa aktarmayı kapsa';
$strEndCut = 'END CUT';
$strEndRaw = 'END RAW';
$strEnd = 'Son';
@@ -315,9 +315,9 @@ $strEvents = 'Olaylar';
$strExcelEdition = 'Excel yapısı';
$strExecuteBookmarked = 'İşaretlenmiş sorguyu çalıştır';
$strExplain = 'SQL\'i açıkla';
-$strExport = 'Dışarı Aktar';
-$strExportImportToScale = 'Ölçeklemek için İçeri/Dışarı Aktar';
-$strExportMustBeFile = 'Seçili dışarı aktarma türü dosyaya kaydedilmelidir!';
+$strExport = 'Dışa Aktar';
+$strExportImportToScale = 'Ölçeklemek için içe/dışa aktar';
+$strExportMustBeFile = 'Seçili dışa aktarma türü dosyaya kaydedilmelidir!';
$strExtendedInserts = 'Genişletilmiş eklemeler';
$strExtra = 'Ekstra';
@@ -338,7 +338,7 @@ $strFileNameTemplateDescriptionTable = 'tablo adı';
$strFileNameTemplate = 'Dosya adı şablonu';
$strFileNameTemplateRemember = 'şablonu hatırla';
$strFiles = 'Dosyalar';
-$strFileToImport = 'İçeri aktarmak için dosya';
+$strFileToImport = 'İçe aktarmak için dosya';
$strFlushPrivilegesNote = 'Not: phpMyAdmin kullanıcıların yetkilerini doğrudan MySQL\'in yetki tablolarından alır. Bu tabloların içerikleri, eğer elle değiştirildiyse sunucunun kullandığı yetkilerden farklı olabilir. Bu durumda devam etmeden önce %syetkileri yeniden yüklemeniz%s gerekir.';
$strFlushQueryCache = 'Sorgu önbelleğini temizle';
$strFlushTables = 'Tüm tabloları temizle (kapat)';
@@ -401,21 +401,21 @@ $strIgnoreDuplicates = 'Kopya satırları yoksay';
$strIgnoreInserts = 'Yoksayılan eklemeleri kullan';
$strIgnore = 'Yoksay';
$strImportColNames = 'İlk sıradaki sütun isimleri';
-$strImportEmptyRows = 'Boş sıraları içeri aktarma';
-$strImportExportCoords = 'PDF şeması için düzenlemeleri İçeri/Dışarı Aktar';
-$strImportFiles = 'Dosyaları içeri aktar';
+$strImportEmptyRows = 'Boş satırları içe aktarma';
+$strImportExportCoords = 'PDF şeması için düzenlemeleri içe/dışa aktar';
+$strImportFiles = 'Dosyaları içe aktar';
$strImportFormat = 'İçeri aktarılmış dosyanın biçimi';
-$strImport = 'İçeri Aktar';
+$strImport = 'İçe Aktar';
$strImportLargeFileUploading = 'Gönderilen dosya muhtemelen en fazla izin verilen boyuttan büyük veya bu webkit tabanlı (Safari, Google Chrome, Arora vs.) tarayıcılardaki bilinen bir hatadır.';
$strImportNoticePt1 = 'Aşağıdaki yapılar ya oluşturuldu ya da değiştirildi. Buyurun:';
$strImportNoticePt2 = 'İsmine tıklayarak yapının içeriklerini görüntüleyin';
$strImportNoticePt3 = 'Uyan "Seçenekler" bağlantısına tıklayarak bunun herhangi bir ayarını değiştirin';
$strImportNoticePt4 = 'Aşağıdaki "Yapı" bağlantısıyla bunun yapısını düzenleyin';
$strImportODS = 'Açık Kaynaklı Tablolama Belgesi';
-$strImportODSCurrency = 'Parasalları içeri aktar ($5.00\'dan 5.00\'a)';
-$strImportODSPercents = 'Yüzdeleri doğru ondalık olarak içeri aktar (%12.00\'dan .12\'ye)';
+$strImportODSCurrency = 'Parasalları içe aktar ($5.00\'ı 5.00\'a)';
+$strImportODSPercents = 'Yüzdeleri doğru ondalık olarak içe aktar (%12.00\'ı .12\'ye)';
$strImportProceedingFile = 'Dosya işleme alındı, lütfen sabırlı olun.';
-$strImportSuccessfullyFinished = 'İçeri aktarma başarılı olarak bitti, %d sorgu çalıştırıldı.';
+$strImportSuccessfullyFinished = 'İçe aktarma başarılı olarak bitti, %d sorgu çalıştırıldı.';
$strImportUploadInfoNotAvailable = 'Lütfen sabırlı olun, dosya gönderilmekte. Gönderme ile ilgili ayrıntılar mevcut değil.';
$strImportXLS = 'Excel 97-2003 XLS Kitabı';
$strImportXLSX = 'Excel 2007 XLSX Kitabı';
@@ -449,11 +449,11 @@ $strInvalidColumnCount = 'Sütun sayısı sıfırdan büyük olmalı.';
$strInvalidColumn = 'Geçersiz sütun (%s) belirlenmiş!';
$strInvalidCSVFieldCount = 'CSV girişinde %d. satırda geçersiz alan sayısı.';
$strInvalidCSVFormat = 'CSV girişinin %d. satırında geçersiz biçim.';
-$strInvalidCSVParameter = 'CSV girişi için geçersiz parametre: %s';
+$strInvalidCSVParameter = 'CSV içe aktarma için geçersiz parametre: %s';
$strInvalidDatabase = 'Geçersiz veritabanı';
$strInvalidFieldAddCount = 'En az bir alan eklemek zorundasınız.';
$strInvalidFieldCount = 'Tablonun en az bir alanı olmalı.';
-$strInvalidLDIImport = 'Bu eklenti sıkıştırılmış içeri aktarım dosyalarını desteklemez!';
+$strInvalidLDIImport = 'Bu eklenti sıkıştırılmış içe aktarım dosyalarını desteklemez!';
$strInvalidRowNumber = '%d geçerli bir satır sayısı değil.';
$strInvalidServerHostname = '%1$s sunucusu için geçersiz anamakine. Lütfen yapılandırmanızı gözden geçirin.';
$strInvalidServerIndex = 'Geçersiz sunucu indeksi: "%s"';
@@ -555,7 +555,7 @@ $strNext = 'Sonraki';
$strNoActivity = '%s saniye içinde hiçbir işlem yapılmadı, lütfen yeniden oturum açın';
$strNoDatabasesSelected = 'Veritabanı seçilmedi.';
$strNoDatabases = 'Veritabanı yok';
-$strNoDataReceived = 'İçeri aktarmak için veri alınmadı. Ya dosya adı gönderilmedi ya da PHP yapılandırmanız tarafından izin verilen en fazla boyut aşıldı. [a@./Documentation.html#faq1_16@Documentation]SSS 1.16[/a]\'ya bakın.';
+$strNoDataReceived = 'İçe aktarmak için veri alınmadı. Ya dosya adı gönderilmedi ya da PHP yapılandırmanız tarafından izin verilen en fazla boyut aşıldı. [a@./Documentation.html#faq1_16@Documentation]SSS 1.16[/a]\'ya bakın.';
$strNoDescription = 'Açıklama yok';
$strNoDetailsForEngine = 'Bu depolama motoru için ayrıntılı durum bilgisi mevcut değil.';
$strNoDropDatabases = '"DROP DATABASE" ifadesi etkisizleştirildi.';
@@ -608,7 +608,7 @@ $strPacked = 'Paketlendi';
$strPageNumber = 'Sayfa numarası:';
$strPagesToBeFlushed = 'Temizlenen sayfalar';
$strPaperSize = 'Kağıt boyutu';
-$strPartialImport = 'Kısmi içeri aktarma';
+$strPartialImport = 'Kısmi içe aktarma';
$strPartialText = 'Kısmi Metinler';
$strPartition = 'Bölüm %s';
$strPartitionDefinition = 'PARTITION tanımı';
@@ -622,9 +622,9 @@ $strPassword = 'Parola';
$strPBXTDataFileGrowSizeDesc = 'İşlenen veri (.xtd) dosyalarının büyüme boyutu.';
$strPBXTDataFileGrowSize = 'Veri dosyası büyüme boyutu';
$strPBXTDataLogThresholdDesc = 'Veri günlük dosyasının en fazla boyutu. Varsayılan değer 64MB\'tır. PBXT tüm tablolar tarafından kullanılan en fazla 32000 veri günlüğü oluşturabilir. Bu yüzden veritabanında depolanabilir toplam veri miktarını arttırmak için bu değişkenin değeri arttırılabilir.';
-$strPBXTDataLogThreshold = 'Veri günlüğü başı';
-$strPBXTGarbageThreshold = 'Artık başı';
-$strPBXTGarbageThresholdDesc = 'Küçültülmeden önce veri günlük dosyasındaki artık yüzdesi. Bu 1 ile 99 arasında bir değerdir. Varsayılan değer 50\'dir.';
+$strPBXTDataLogThreshold = 'Veri günlüğü eşiği';
+$strPBXTGarbageThreshold = 'Artık eşiği';
+$strPBXTGarbageThresholdDesc = 'Ufaltılmadan önce veri günlük dosyasındaki artık yüzdesidir. Bu 1 ile 99 arasında bir değerdir. Varsayılan değer 50\'dir.';
$strPBXTCheckpointFrequencyDesc = 'Kontrol noktası oluşturulmadan önce işlem günlüğüne yazılan veri miktarı. Varsayılan değer 24MB\'tır.';
$strPBXTCheckpointFrequency = 'Kontrol noktası sıklığı';
$strPBXTIndexCacheSizeDesc = 'Bu, indeks önbelleğine ayrılmış bellek miktarıdır. Varsayılan değer 32MB\'tır. Burada ayrılmış bellek sadece indeks sayfalarının önbelleklenmesi için kullanılır.';
@@ -636,7 +636,7 @@ $strPBXTLogCacheSize = 'Günlük önbellek boyutu';
$strPBXTLogFileCountDesc = 'Bu, sistemin bakacağı işlem günlük dosyalarının (pbxt/system/xlog*.xt) sayısıdır. Eğer günlük sayısı bu değeri geçerse eski günlükler silinecektir, diğer taraftan yeniden adlandırılır ve bir sonraki en yüksek numara verilir.';
$strPBXTLogFileCount = 'Günlük dosyası sayısı';
$strPBXTLogFileThresholdDesc = 'Yuvarlamadan önceki işlem günlüğü boyutu ve yeni günlük oluşturma. Varsayılan değer 16MB\'tır.';
-$strPBXTLogFileThreshold = 'Günlük dosyası başı';
+$strPBXTLogFileThreshold = 'Günlük dosyası eşiği';
$strPBXTRecordCacheSizeDesc = 'Bu, önbellek tablosu verisi olarak kullanılmak üzere kayıt önbelleğine ayrılmış veri miktarıdır. Varsayılan değer 32MB\'tır. Bu bellek, tanıtıcı veri (.xtd) ve sıra işaretçisi (.xtr) dosyalarında önbellek değişimleri için kullanılır.';
$strPBXTRecordCacheSize = 'Kayıt önbellek boyutu';
$strPBXTRowFileGrowSizeDesc = 'Satır gösterge (.xtr) dosyalarının büyüme boyutu.';
@@ -689,7 +689,7 @@ $strPrivDescDropTbl = 'Tabloların kaldırılmasına izin verir.';
$strPrivDescEvent = 'Olay zamanlayıcısı için olayları ayarlamaya izin verir';
$strPrivDescExecute = 'Depolanmış işlemlerin çalıştırılmasına izin verir; bu MySQL sürümünde etkisi yoktur.';
$strPrivDescExecute5 = 'Depolanan yordamların yürütülmesine izin verir.';
-$strPrivDescFile = 'Verinin içeri ve dışarı aktarılmasına izin verir.';
+$strPrivDescFile = 'Verinin içe ve dışa aktarılmasına izin verir.';
$strPrivDescGrant = 'Yetki tablolarını yeniden yüklemeden yeni kullanıcıların ve yetkilerin eklenmesine izin verir.';
$strPrivDescIndex = 'İndekslerin oluşturulmasına ve kaldırılmasına izin verir.';
$strPrivDescInsert = 'Verinin eklenmesine ve yerinin değiştirilmesine izin verir.';
@@ -890,13 +890,13 @@ $strSetupBrowseMarkerEnable_desc = 'Seçili satırları vurgular';
$strSetupBrowseMarkerEnable_name = 'Satır işaretleyicisi';
$strSetupBrowsePointerEnable_desc = 'Vurgulanan satır fare imleci tarafından işaret edilir';
$strSetupBrowsePointerEnable_name = 'Vurgulama işaretçisi';
-$strSetupBZipDump_desc = 'İçeri ve dışarı aktarma işlemleri için [a@http://en.wikipedia.org/wiki/Bzip2]bzip2[/a] sıkıştırma etkin';
+$strSetupBZipDump_desc = 'İçe ve dışa aktarma işlemleri için [a@http://en.wikipedia.org/wiki/Bzip2]bzip2[/a] sıkıştırma etkin';
$strSetupBZipDump_name = 'Bzip2';
$strSetupBZipDumpWarning = '[a@?page=form&formset=features#tab_Import_export]Bzip2 sıkıştırması ve açması[/a] bu sistemde mevcut olmayan işlevleri (%s) gerektirir.';
$strSetupCannotLoadConfigMsg = 'Lütfen [a@../Documentation.html#setup_script]belge[/a] içinde açıklandığı gibi phpMyAdmin en yüksek düzey dizininde web sunucusu yazılabilir klasörü olarak [em]config[/em] oluşturun. Yoksa sadece indirmenize veya görüntülemenize izin verecektir.';
$strSetupCannotLoadConfig = 'Yapılandırma yüklenemiyor veya kaydedilemiyor';
$strSetupClear = 'Temizle';
-$strSetupCompressOnFly_desc = 'Daha fazla belleğe gerek kalmadan gzip/bzip2 dışarı aktarmalarını anında sıkıştırır; eğer gzip/bzip2 dosyalarını oluşturmada sorunlarla karşılaşırsanız bu özelliği etkisizleştirin';
+$strSetupCompressOnFly_desc = 'Daha fazla belleğe gerek kalmadan gzip/bzip2 dışa aktarmalarını anında sıkıştırır; eğer gzip/bzip2 dosyalarını oluşturmada sorunlarla karşılaşırsanız bu özelliği etkisizleştirin';
$strSetupCompressOnFly_name = 'Anında sıkıştır';
$strSetupConfigurationFile = 'Yapılandırma dosyası';
$strSetupConfirm_desc = 'Veri kaybı yaşamamanız için bir uyarı ("... yapmak istediğiniz için emin misiniz?") görüntülenip görüntülenmeyeceğidir';
@@ -957,12 +957,12 @@ $strSetupForm_Browse_desc = 'Gözatma modunu özelleştirir';
$strSetupForm_Browse = 'Gözatma modu';
$strSetupForm_Edit_desc = 'Düzenleme modunu özelleştirir';
$strSetupForm_Edit = 'Düzenleme modu';
-$strSetupForm_Export_defaults_desc = 'Varsayılan dışarı aktarma seçeneklerini özelleştirir';
-$strSetupForm_Export_defaults = 'Dışarı aktarma varsayılanları';
-$strSetupForm_Import_defaults_desc = 'Varsayılan genel içeri aktarma seçeneklerini özelleştirir';
-$strSetupForm_Import_defaults = 'İçeri aktarma varsayılanları';
-$strSetupForm_Import_export_desc = 'İçeri aktarma ve dışarı aktarma dizinlerini ve sıkıştırma seçeneklerini ayarlar';
-$strSetupForm_Import_export = 'İçeri Aktar / Dışarı Aktar';
+$strSetupForm_Export_defaults_desc = 'Varsayılan dışa aktarma seçeneklerini özelleştirir';
+$strSetupForm_Export_defaults = 'Dışa aktarma varsayılanları';
+$strSetupForm_Import_defaults_desc = 'Varsayılan genel içe aktarma seçeneklerini özelleştirir';
+$strSetupForm_Import_defaults = 'İçe aktarma varsayılanları';
+$strSetupForm_Import_export_desc = 'İçe ve dışa aktarma dizinlerini ve sıkıştırma seçeneklerini ayarlar';
+$strSetupForm_Import_export = 'İçe Aktar / Dışa Aktar';
$strSetupForm_Left_databases_desc = 'Veritabanlarının görüntü seçenekleri';
$strSetupForm_Left_databases = 'Veritabanları';
$strSetupForm_Left_frame_desc = 'Rehber çerçevesinin görünümünü özelleştirir';
@@ -987,9 +987,9 @@ $strSetupForm_Server_pmadb_desc = 'İlave özelliklere erişim kazanmak için ph
$strSetupForm_Server_pmadb = 'PMA veritabanı';
$strSetupForm_Server = 'Temel ayarlar';
$strSetupFormset_customization = 'Özelleştirme';
-$strSetupFormset_export = 'Dışarı aktarma seçeneklerini özelleştir';
+$strSetupFormset_export = 'Dışa aktarma seçeneklerini özelleştir';
$strSetupFormset_features = 'Özellikler';
-$strSetupFormset_import = 'İçeri aktarma varsayılanlarını özelleştir';
+$strSetupFormset_import = 'İçe aktarma varsayılanlarını özelleştir';
$strSetupFormset_left_frame = 'Rehber çerçeveyi özelleştir';
$strSetupFormset_main_frame = 'Ana çerçeveyi özelleştir';
$strSetupForm_Sql_box_desc = 'SQL Sorgu kutularında gösterilecek bağlantıları özelleştirir';
@@ -1000,7 +1000,7 @@ $strSetupForm_Startup = 'Başlangıç';
$strSetupForm_Startup_desc = 'Başlangıç sayfasını özelleştirir';
$strSetupForm_Tabs_desc = 'Sekmelerin nasıl çalışmasını istiyorsanız seçin';
$strSetupForm_Tabs = 'Sekmeler';
-$strSetupGZipDump_desc = 'İçeri ve dışarı aktarma işlemleri için [a@http://en.wikipedia.org/wiki/Gzip]gzip[/a] sıkıştırma etkin';
+$strSetupGZipDump_desc = 'İçe ve dışa aktarma işlemleri için [a@http://en.wikipedia.org/wiki/Gzip]gzip[/a] sıkıştırma etkin';
$strSetupGZipDump_name = 'GZip';
$strSetupGZipDumpWarning = '[a@?page=form&formset=features#tab_Import_export]GZip sıkıştırması ve açması[/a] bu sistemde mevcut olmayan işlevleri (%s) gerektirir.';
$strSetupHomepageLink = 'phpMyAdmin ana sayfası';
@@ -1015,12 +1015,12 @@ $strSetupIconvExtraParams_name = 'Iconv için ilave parametreler';
$strSetupIgnoreErrors = 'Hataları yoksay';
$strSetupIgnoreMultiSubmitErrors_desc = 'Eğer etkinleştirilirse, phpMyAdmin çoklu ifade sorgularını hesaplamaya devam eder, eğer sorgulardan biri başarısız olsa bile';
$strSetupIgnoreMultiSubmitErrors_name = 'Çoklu ifade hatalarını yoksay';
-$strSetupImport_allow_interrupt_desc = 'İçeri aktarmayı yarıda kesmeye izin verildiği takdirde betik, kapatma zaman sınırını saptar. Bu büyük dosyaları içeri aktarmak için iyi bir yol olabilir, ancak bu işlemleri bozabilir.';
-$strSetupImport_allow_interrupt_name = 'Kısmi içeri aktarma: yarıda kesmeye izin ver';
+$strSetupImport_allow_interrupt_desc = 'Betiğin zaman sınırına yaklaşıldığını algılaması durumunda içe aktarımı kesmeye izin verir. Bu büyük dosyaları içe aktarmak için iyi bir yol olabilir, ancak bu işlemleri bozabilir.';
+$strSetupImport_allow_interrupt_name = 'Kısmi içe aktarma: yarıda kesmeye izin ver';
$strSetupImport_format_desc = 'Varsayılan biçim; bu liste yerine göre (veritabanı, tablo) değişir ve sadece her zaman SQL vardır';
-$strSetupImport_format_name = 'İçeri aktarılmış dosyanın biçimi';
+$strSetupImport_format_name = 'İçe aktarılmış dosyanın biçimi';
$strSetupImport_skip_queries_desc = 'Başlangıçtan atlanacak kayıt (sorgu) sayısı';
-$strSetupImport_skip_queries_name = 'Kısmi içeri aktarma: sorguları atla';
+$strSetupImport_skip_queries_name = 'Kısmi içe aktarma: sorguları atla';
$strSetupInsecureConnection = 'Güvensiz bağlantı';
$strSetupInsecureConnectionMsg1 = 'Güvenli bağlantı kullanmıyorsunuz; tüm veri (parola gibi hassas olabilecek bilgiler dahil) şifresiz olarak aktarılır!';
$strSetupInsecureConnectionMsg2 = 'Eğer sunucunuz aynı zamanda HTTPS isteklerini kabul etmek için yapılandırılmışsa güvenli bağlantı kullanmak için [a@%s]bu bağlantıyı[/a] takip edin.';
@@ -1094,7 +1094,7 @@ $strSetupRecodingEngine_desc = 'Karakter grubu dönüştürme için kullanılaca
$strSetupRecodingEngine_name = 'Kaydetme motoru';
$strSetupRestoreDefaultValue = 'Varsayılan değeri geri yükle';
$strSetupRevertErroneousFields = 'Hatalı alanları varsayılan değerlerine döndürmeyi dene';
-$strSetupSaveDir_desc = 'Dışarı aktarmaların sunucu üzerinde kaydedilebileceği dizin';
+$strSetupSaveDir_desc = 'Dışa aktarmaların sunucu üzerinde kaydedilebileceği dizin';
$strSetupSaveDir_name = 'Kayıt dizini';
$strSetupServerAuthConfigMsg = '[kbd]Yapılandırma[/kbd] kimlik denetimi türünü ayarladınız ve buna otomatik oturum açma için kullanıcı adı ve parola dahildir, canlı anamakineler için istenmeyen bir seçenektir. phpMyAdmin URL\'nizi bilen veya tahmin eden herhangi biri doğrudan phpMyAdmin panelinize erişebilir. [a@?page=servers&mode=edit&id=%1$d#tab_Server]Kimlik denetimi türünü[/a] [kbd]tanımlama bilgisine[/kbd] ya da [kbd]http[/kbd] olarak ayarlayın.';
$strSetupServerExtensionMsg = 'Verim almak için mysqli kullanmalısınız';
@@ -1206,7 +1206,7 @@ $strSetupSuggestDBName_name = 'Yeni veritabanı adı öner';
$strSetupTrue = 'evet';
$strSetupTrustedProxies_desc = 'Proksileri [kbd]IP: güvenilir HTTP başlığı[/kbd] olarak girin. Aşağıdaki örnek phpMyAdmin\'in proksi 1.2.3.4\'ten gelen HTTP_X_FORWARDED_FOR (X-Forwarded-For) başlığına güvenmesini belirler:[br][kbd]1.2.3.4: HTTP_X_FORWARDED_FOR[/kbd]';
$strSetupTrustedProxies_name = 'IP İzin Verme/Reddetme için güvenilir proksi listesi';
-$strSetupUploadDir_desc = 'İçeri aktarmak için dosyaları gönderebileceğiniz sunucu üzerindeki dizin';
+$strSetupUploadDir_desc = 'İçe aktarmak için dosyaları gönderebileceğiniz sunucu üzerindeki dizin';
$strSetupUploadDir_name = 'Gönderme dizini';
$strSetupUseDbSearch_desc = 'Tüm veritabanı içinde aramaya izin verir';
$strSetupUseDbSearch_name = 'Veritabanı aramayı kullan';
@@ -1222,7 +1222,7 @@ $strSetupVersionCheck = 'Sürüm kontrolü';
$strSetupVersionCheckUnparsable = 'Eşleştirilemez sürüm dizgisi';
$strSetupVersionCheckWrapperError = 'Ne URL ne de CURL mevcut. Sürüm kontrolü mümkün değil.';
$strSetupWarning = 'Uyarı';
-$strSetupZipDump_desc = 'İçeri ve dışarı aktarma işlemleri için [a@http://en.wikipedia.org/wiki/ZIP_(file_format)]ZIP[/a] sıkıştırma etkin';
+$strSetupZipDump_desc = 'İçe ve dışa aktarma işlemleri için [a@http://en.wikipedia.org/wiki/ZIP_(file_format)]ZIP[/a] sıkıştırma etkin';
$strSetupZipDumpExportWarning = '[a@?page=form&formset=features#tab_Import_export]Zip sıkıştırması[/a] bu sistemde mevcut olmayan işlevleri (%s) gerektirir.';
$strSetupZipDumpImportWarning = '[a@?page=form&formset=features#tab_Import_export]Zip açması[/a] bu sistemde mevcut olmayan işlevleri (%s) gerektirir.';
$strSetupZipDump_name = 'ZIP';
@@ -1374,7 +1374,7 @@ $strSpaceUsage = 'Alan kullanımı';
$strSpanish = 'İspanyolca';
$strSplitWordsWithSpace = 'Kelimeler boşlukla ayrılır (" ").';
$strSQLCompatibility = 'SQL uyumluluk kipi';
-$strSQLExportType = 'Dışarı aktarma türü';
+$strSQLExportType = 'Dışa aktarma türü';
$strSQLParserBugMessage = 'SQL ayrıştırıcısında bir hata bulabilme ihtimaliniz var. Lütfen sorgunuzu yakından dikkatli bir şekilde gözden geçirin ve tırnakların doğru ve uyumsuz olmadığını kontrol edin. Diğer muhtemel hata nedenleri tırnaklı metin alanının dışında binari ile dosya gönderiyor olmanız olabilir. Aynı zamanda sorgunuzu MySQL komut satırı arabiriminde deneyebilirsiniz. Eğer hata varsa, aşağıdaki MySQL sunucu hata çıktısı, sorunu teşhis etmenizde ayrıca size yardımcı olabilir. Eğer hala sorunlarınız varsa ya da komut satırı arabirimi başarılı olduğunda ayrıştırıcı başarısızsa, lütfen sorunlara neden olan SQL sorgu girişinizi tek bir sorguya indirgeyin ve aşağıdaki CUT bölümü içindeki veri yığını ile birlikte hata raporunu gönderin:';
$strSQLParserUserError = 'SQL sorgunuzda bir hata olduğu görünüyor. MySQL sunucusu hata çıktısı aşağıdadır, eğer varsa, sorunu teşhis etmenizde ayrıca size yardımcı olabilir';
$strSQLQuery = 'SQL sorgusu';
@@ -1410,8 +1410,8 @@ $strSuccess = 'SQL sorgunuz başarılı olarak çalıştırıldı';
$strSuhosin = 'Sunucu Suhosin ile çalışıyor. Lütfen olası sorunlar için %sdocumentation%s belgesinden yararlanın.';
$strSum = 'Toplam';
$strSwedish = 'İsveççe';
-$strSwekeyAuthenticating = 'Kimlik denetleniyor...';
-$strSwekeyAuthFailed = 'Donanım kimlik denetimi başarısız';
+$strSwekeyAuthenticating = 'Kimlik doğrulanıyor...';
+$strSwekeyAuthFailed = 'Donanım kimlik doğrulama başarısız';
$strSwekeyNoKey = 'Geçerli kimlik denetimi anahtarı takılı değil';
$strSwekeyNoKeyId = '%s dosyası herhangi bir anahtar kimliği içermiyor';
$strSwitchToDatabase = 'Kopyalanmış veritabanına geç';
@@ -1461,9 +1461,9 @@ $strTheme = 'Tema / Stil';
$strThisHost = 'Bu Anamakine';
$strThreads = 'İşlemler';
$strThreadSuccessfullyKilled = '%s işlemi başarılı olarak sonlandırıldı.';
-$strTimeoutInfo = 'Önceki içeri aktarma zaman aşımına uğradı, sonradan yeniden gönderim %d konumundan devam edecek.';
-$strTimeoutNothingParsed = 'Ancak son çalıştırmada hiç veri ayrıştırılmadı, bu genellikle, php zaman sınırlarını arttırmadığınız sürece phpMyAdmin\'in bu içeri aktarmayı biteremeyeceği anlamına gelir.';
-$strTimeoutPassed = 'Küçük program zaman aşımı geçti, eğer içeri aktarmayı bitirmek istiyorsanız, lütfen aynı dosyayı yeniden gönderin ve içeri aktarma devam edecektir.';
+$strTimeoutInfo = 'Önceki içe aktarma zaman aşımına uğradı, sonradan yeniden gönderim %d konumundan devam edecek.';
+$strTimeoutNothingParsed = 'Ancak son çalıştırmada hiç veri ayrıştırılmadı, bu genellikle, php zaman sınırlarını arttırmadığınız sürece phpMyAdmin\'in bu içe aktarmayı biteremeyeceği anlamına gelir.';
+$strTimeoutPassed = 'Betik zaman aşımı geçti, eğer içe aktarmayı bitirmek istiyorsanız, lütfen aynı dosyayı yeniden gönderin ve içe aktarma devam edecektir.';
$strTime = 'Süre';
$strToFromPage = 'sayfadan/sayfaya';
$strToggleScratchboard = 'Karalama panosunu değiştir';
@@ -1483,7 +1483,7 @@ $strTrackingDataManipulationStatement = 'Veri işleme ifadesi';
$strTrackingDate = 'Tarih';
$strTrackingDeactivateNow = 'Hemen devre dışı bırak';
$strTrackingDeactivateTrackingFor = '%s.%s için izlemeyi devre dışı bırak';
-$strTrackingExportAs = '%s olarak dışarı aktar';
+$strTrackingExportAs = '%s olarak dışa aktar';
$strTrackingIsActive = 'İzleme aktif.';
$strTrackingIsNotActive = 'İzleme aktif değil.';
$strTracking = 'İzleme';
@@ -1498,7 +1498,7 @@ $strTrackingSQLDump = 'SQL yığını';
$strTrackingSQLExecuted = 'SQL ifadeleri çalıştırıldı.';
$strTrackingSQLExecutionAlert = 'Bu seçenek tablolarınızı ve içerdiği veriyi değiştirecektir.';
$strTrackingSQLExecution = 'SQL çalıştırma';
-$strTrackingSQLExported = 'SQL ifadeleri dışarı aktarıldı. Lütfen yığını kopyalayın ya da çalıştırın.';
+$strTrackingSQLExported = 'SQL ifadeleri dışa aktarıldı. Lütfen yığını kopyalayın ya da çalıştırın.';
$strTrackingStatements = 'İzleme ifadeleri';
$strTrackingStatusActive = 'aktif';
$strTrackingStatusNotActive = 'aktif değil';
@@ -1590,7 +1590,7 @@ $strViewHasAtLeast = 'Bu görünüm en az bu satır sayısı kadar olur. Lütfen
$strViewHasBeenDropped = '%s görünümü kaldırıldı';
$strViewImage = 'Resmi göster';
$strViewName = 'GÖRÜNÜM adı';
-$strViewVideo = 'Videoyu göster';
+$strViewVideo = 'Görüntüyü göster';
$strWebServerUploadDirectoryError = 'Gönderme işi için ayarladığınız dizine ulaşılamıyor';
$strWebServerUploadDirectory = 'web sunucusu gönderme dizini';
@@ -1605,13 +1605,13 @@ $strWriteRequests = 'Yazma istekleri';
$strWrongUser = 'Yanlış kullanıcı adı/parola girdiniz. Erişim engellendi.';
$strXMLError = 'Belirlenmiş XML dosyası ya kusurlu ya da tamamlanmamış. Lütfen sorunu düzeltin ve tekrar deneyin.';
-$strXMLExportContents = 'İçerikleri dışarı aktar';
-$strXMLExportFunctions = 'İşlevleri dışarı aktar';
-$strXMLExportProcedures = 'İşlemleri dışarı aktar';
-$strXMLExportStructs = 'Yapı Şemalarını dışarı aktar (önerilir)';
-$strXMLExportTables = 'Tabloları dışarı aktar';
-$strXMLExportTriggers = 'Tetikleyicileri dışarı aktar';
-$strXMLExportViews = 'Görünümleri dışarı aktar';
+$strXMLExportContents = 'İçerikleri dışa aktar';
+$strXMLExportFunctions = 'İşlevleri dışa aktar';
+$strXMLExportProcedures = 'İşlemleri dışa aktar';
+$strXMLExportStructs = 'Yapı Şemalarını dışa aktar (önerilir)';
+$strXMLExportTables = 'Tabloları dışa aktar';
+$strXMLExportTriggers = 'Tetikleyicileri dışa aktar';
+$strXMLExportViews = 'Görünümleri dışa aktar';
$strXML = 'XML';
$strYes = 'Evet';
diff --git a/lang/ukrainian-utf-8.inc.php b/lang/ukrainian-utf-8.inc.php
index 28bdbc5..3dd9109 100644
--- a/lang/ukrainian-utf-8.inc.php
+++ b/lang/ukrainian-utf-8.inc.php
@@ -126,7 +126,7 @@ $strChoosePage = 'Прошу вибрати сторінку для редагу
$strDanish = 'Данське';
$strDatabaseExportOptions = 'Налаштування експорту бази даних';
$strDatabaseHasBeenDropped = 'Базу даних %s знищено.';
-$strDatabasesDropped = '%s баз(а\и) даних успішно знищено.';
+$strDatabasesDropped = '%s база(и) даних успішно знищено.';
$strDatabasesStatsDisable = 'Заборонити статистику';
$strDatabasesStatsEnable = 'Дозволити статистику';
$strDatabasesStatsHeavyTraffic = 'Примітка: Активізація збору статистики бази даних може спричинити значний трафік між веб сервером та базою даних MySQL.';
@@ -553,7 +553,7 @@ $strUnicode = 'Юнікод';
$strUnique = 'Унікальне';
$strUnknown = 'невідоме';
$strUnselectAll = 'Зняти всі відмітки';
-$strUpdatePrivMessage = 'Було змінено привілеї для';
+$strUpdatePrivMessage = 'Ви оновили привілеї для %s.';
$strUpdateProfileMessage = 'Профіль було поновлено.';
$strUpdateQuery = 'Доповнити запит';
$strUpdComTab = 'За інформацією як поновити Вашу таблицю Column_comments прошу дивитись у Документації';
@@ -598,7 +598,7 @@ $strZip = 'запакувати в "zip"';
$strAccessDeniedCreateConfig = 'Probably reason of this is that you did not create configuration file. You might want to use %1$ssetup script%2$s to create one.'; //to translate
$strActions = 'Actions'; //to translate
$strAddAutoIncrement = 'Add AUTO_INCREMENT value'; //to translate
-$strAddClause = 'Add %s'; //to translate
+$strAddClause = 'Додати %s';
$strAddConstraints = 'Add constraints'; //to translate
$strAddFields = 'Add %s field(s)'; //to translate
$strAddHeaderComment = 'Add custom comment into header (\\n splits lines)'; //to translate
@@ -607,7 +607,7 @@ $strAfterInsertSame = 'Go back to this page'; //to translate
$strAllowInterrupt = 'Allow interrupt of import in case script detects it is close to time limit. This might be good way to import large files, however it can break transactions.'; //to translate
$strAnalyze = 'Analyze'; //to translate
$strAndSmall = 'and'; //to translate
-$strAndThen = 'and then'; //to translate
+$strAndThen = 'і потім';
$strAngularLinks = 'Angular links'; //to translate
$strApplyChanges = 'Apply Selected Changes'; //to translate
$strApproximateCount = 'May be approximate. See FAQ 3.11'; //to translate
@@ -661,7 +661,7 @@ $strConstraintsForDumped = 'Constraints for dumped tables'; //to translate
$strConstraintsForTable = 'Constraints for table'; //to translate
$strControluserFailed = 'Connection for controluser as defined in your configuration failed.'; //to translate
$strCopy = 'Copy'; //to translate
-$strCopyDatabaseOK = 'Database %s has been copied to %s'; //to translate
+$strCopyDatabaseOK = 'Базу даних %s скопійовано в %s';
$strCouldNotConnectSource = 'Could not connect to the source'; //to translate
$strCouldNotConnectTarget = 'Could not connect to the target'; //to translate
$strCreateDatabaseBeforeCopying = 'CREATE DATABASE before copying'; //to translate
@@ -680,17 +680,17 @@ $strCzechSlovak = 'Czech-Slovak'; //to translate
$strCheck = 'Check'; //to translate
$strCheckOverhead = 'Check tables with overhead'; //to translate
-$strDatabaseEmpty = 'The database name is empty!'; //to translate
-$strDatabaseHasBeenCreated = 'Database %1$s has been created.'; //to translate
+$strDatabaseEmpty = 'Ім\'я бази даних порожнє!';
+$strDatabaseHasBeenCreated = 'Базу даних %1$s створено.';
$strDatabaseNotExisting = '\'%s\' database does not exist.'; //to translate
$strDatabase_src = 'Source database'; //to translate
$strDatabase_trg = 'Target database'; //to translate
$strDataDiff = 'Data Difference'; //to translate
$strDataPages = 'Pages containing data'; //to translate
$strDataSyn = 'Data Synchronization'; //to translate
-$strDBCopy = 'Copy database to'; //to translate
+$strDBCopy = 'Копіювати базу даних в';
$strDbIsEmpty = 'Database seems to be empty!'; //to translate
-$strDBRename = 'Rename database to'; //to translate
+$strDBRename = 'Перейменувати базу даних в';
$strDefaultEngine = '%s is the default storage engine on this MySQL server.'; //to translate
$strDefragment = 'Defragment table'; //to translate
$strDelayedInserts = 'Use delayed inserts'; //to translate
@@ -957,7 +957,7 @@ $strReload = 'Reload'; //to translate
$strRemoteServer = 'Remote server'; //to translate
$strRemoveCRLF = 'Remove CRLF characters within fields'; //to translate
$strRemovePartitioning = 'Remove partitioning'; //to translate
-$strRenameDatabaseOK = 'Database %s has been renamed to %s'; //to translate
+$strRe
nameDatabaseOK = 'Базу даних %s перейменовано в %s';
$strRepair = 'Repair'; //to translate
$strReplicationAddLines = 'Now, add the following lines at the end of your my.cnf and please restart the MySQL server afterwards.'; //to translate
$strReplicationAddSlaveUser = 'Add slave replication user'; //to translate
@@ -1508,7 +1508,7 @@ $strSwekeyAuthenticating = 'Authenticating...'; //to translate
$strSwekeyAuthFailed = 'Hardware authentication failed'; //to translate
$strSwekeyNoKeyId = 'File %s does not contain any key id'; //to translate
$strSwekeyNoKey = 'No valid authentication key plugged'; //to translate
-$strSwitchToDatabase = 'Switch to copied database'; //to translate
+$strSwitchToDatabase = 'Перейти до скопійованої бази даних';
$strSynchronizationNote = 'Target database will be completely synchronized with source database. Source database will remain unchanged.'; //to translate
$strSynchronizeDb = 'Synchronize Databases'; //to translate
$strSynchronize = 'Synchronize'; //to translate
@@ -1612,7 +1612,7 @@ $strUploadErrorUnknown = 'Unknown error in file upload.'; //to translate
$strUploadLimit = 'You probably tried to upload too large file. Please refer to %sdocumentation%s for ways to workaround this limit.'; //to translate
$strUploadsNotAllowed = 'File uploads are not allowed on this server.'; //to translate
$strUseTabKey = 'Use TAB key to move from value to value, or CTRL+arrows to move anywhere'; //to translate
-$strUseThisValue = 'Use this value'; //to translate
+$strUseThisValue = 'Використовувати це значення';
$strVersionInformation = 'Version information'; //to translate
$strViewHasAtLeast = 'This view has at least this number of rows. Please refer to %sdocumentation%s.'; //to translate
@@ -1624,7 +1624,7 @@ $strView = 'View'; //to translate
$strWebServer = 'Web server'; //to translate
$strWiki = 'Wiki'; //to translate
-$strWindowNotFound = 'The target browser window could not be updated. Maybe you have closed the parent window or your browser is blocking cross-window updates of your security settings'; //to translate
+$strWindowNotFound = 'Активне вікно оглядача неможливо оновити. Можливо ви закрили батьківське вікно, або налаштування безпеки Вашого оглядача блокують між-віконні оновлення.';
$strWriteRequests = 'Write requests'; //to translate
$strXMLError = 'The XML file specified was either malformed or incomplete. Please correct the issue and try again.'; //to translate
diff --git a/libraries/Config.class.php b/libraries/Config.class.php
index 0ac18b2..2dab78d 100644
--- a/libraries/Config.class.php
+++ b/libraries/Config.class.php
@@ -92,7 +92,7 @@ class PMA_Config
*/
function checkSystem()
{
- $this->set('PMA_VERSION', '3.3.5.1');
+ $this->set('PMA_VERSION', '3.3.6-rc1');
/**
* @deprecated
*/
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 4a9c789..d5b38cc 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -684,78 +684,6 @@ function PMA_mysqlDie($error_message = '', $the_query = '',
} // end of the 'PMA_mysqlDie()' function
/**
- * Send HTTP header, taking IIS limits into account (600 seems ok)
- *
- * @uses PMA_IS_IIS
- * @uses PMA_COMING_FROM_COOKIE_LOGIN
- * @uses PMA_get_arg_separator()
- * @uses SID
- * @uses strlen()
- * @uses strpos()
- * @uses header()
- * @uses session_write_close()
- * @uses headers_sent()
- * @uses function_exists()
- * @uses debug_print_backtrace()
- * @uses trigger_error()
- * @uses defined()
- * @param string $uri the header to send
- * @return boolean always true
- */
-function PMA_sendHeaderLocation($uri)
-{
- if (PMA_IS_IIS && strlen($uri) > 600) {
- require_once './libraries/js_escape.lib.php';
-
- echo '<html><head><title>- - -</title>' . "\n";
- echo '<meta http-equiv="expires" content="0">' . "\n";
- echo '<meta http-equiv="Pragma" content="no-cache">' . "\n";
- echo '<meta http-equiv="Cache-Control" content="no-cache">' . "\n";
- echo '<meta http-equiv="Refresh" content="0;url=' . htmlspecialchars($uri) . '">' . "\n";
- echo '<script type="text/javascript">' . "\n";
- echo '//<![CDATA[' . "\n";
- echo 'setTimeout("window.location = unescape(\'"' . PMA_escapeJsString($uri) . '"\')", 2000);' . "\n";
- echo '//]]>' . "\n";
- echo '</script>' . "\n";
- echo '</head>' . "\n";
- echo '<body>' . "\n";
- echo '<script type="text/javascript">' . "\n";
- echo '//<![CDATA[' . "\n";
- echo 'document.write(\'<p><a href="' . htmlspecialchars($uri) . '">' . $GLOBALS['strGo'] . '</a></p>\');' . "\n";
- echo '//]]>' . "\n";
- echo '</script></body></html>' . "\n";
-
- } else {
- if (SID) {
- if (strpos($uri, '?') === false) {
- header('Location: ' . $uri . '?' . SID);
- } else {
- $separator = PMA_get_arg_separator();
- header('Location: ' . $uri . $separator . SID);
- }
- } else {
- session_write_close();
- if (headers_sent()) {
- if (function_exists('debug_print_backtrace')) {
- echo '<pre>';
- debug_print_backtrace();
- echo '</pre>';
- }
- trigger_error('PMA_sendHeaderLocation called when headers are already sent!', E_USER_ERROR);
- }
- // bug #1523784: IE6 does not like 'Refresh: 0', it
- // results in a blank page
- // but we need it when coming from the cookie login panel)
- if (PMA_IS_IIS && defined('PMA_COMING_FROM_COOKIE_LOGIN')) {
- header('Refresh: 0; ' . $uri);
- } else {
- header('Location: ' . $uri);
- }
- }
- }
-}
-
-/**
* returns array with tables of given db with extended information and grouped
*
* @uses $cfg['LeftFrameTableSeparator']
@@ -2026,7 +1954,8 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row, $force
$condition .= 'IS NULL AND';
} else {
// timestamp is numeric on some MySQL 4.1
- if ($meta->numeric && $meta->type != 'timestamp') {
+ // for real we use CONCAT above and it should compare to string
+ if ($meta->numeric && $meta->type != 'timestamp' && $meta->type != 'real') {
$condition .= '= ' . $row[$i] . ' AND';
} elseif (($meta->type == 'blob' || $meta->type == 'string')
// hexify only if this is a true not empty BLOB or a BINARY
diff --git a/libraries/core.lib.php b/libraries/core.lib.php
index a449710..f7f9da4 100644
--- a/libraries/core.lib.php
+++ b/libraries/core.lib.php
@@ -591,4 +591,76 @@ function PMA_setCookie($cookie, $value, $default = null, $validity = null, $http
// cookie has already $value as value
return true;
}
+
+/**
+ * Send HTTP header, taking IIS limits into account (600 seems ok)
+ *
+ * @uses PMA_IS_IIS
+ * @uses PMA_COMING_FROM_COOKIE_LOGIN
+ * @uses PMA_get_arg_separator()
+ * @uses SID
+ * @uses strlen()
+ * @uses strpos()
+ * @uses header()
+ * @uses session_write_close()
+ * @uses headers_sent()
+ * @uses function_exists()
+ * @uses debug_print_backtrace()
+ * @uses trigger_error()
+ * @uses defined()
+ * @param string $uri the header to send
+ * @return boolean always true
+ */
+function PMA_sendHeaderLocation($uri)
+{
+ if (PMA_IS_IIS && strlen($uri) > 600) {
+ require_once './libraries/js_escape.lib.php';
+
+ echo '<html><head><title>- - -</title>' . "\n";
+ echo '<meta http-equiv="expires" content="0">' . "\n";
+ echo '<meta http-equiv="Pragma" content="no-cache">' . "\n";
+ echo '<meta http-equiv="Cache-Control" content="no-cache">' . "\n";
+ echo '<meta http-equiv="Refresh" content="0;url=' . htmlspecialchars($uri) . '">' . "\n";
+ echo '<script type="text/javascript">' . "\n";
+ echo '//<![CDATA[' . "\n";
+ echo 'setTimeout("window.location = unescape(\'"' . PMA_escapeJsString($uri) . '"\')", 2000);' . "\n";
+ echo '//]]>' . "\n";
+ echo '</script>' . "\n";
+ echo '</head>' . "\n";
+ echo '<body>' . "\n";
+ echo '<script type="text/javascript">' . "\n";
+ echo '//<![CDATA[' . "\n";
+ echo 'document.write(\'<p><a href="' . htmlspecialchars($uri) . '">' . $GLOBALS['strGo'] . '</a></p>\');' . "\n";
+ echo '//]]>' . "\n";
+ echo '</script></body></html>' . "\n";
+
+ } else {
+ if (SID) {
+ if (strpos($uri, '?') === false) {
+ header('Location: ' . $uri . '?' . SID);
+ } else {
+ $separator = PMA_get_arg_separator();
+ header('Location: ' . $uri . $separator . SID);
+ }
+ } else {
+ session_write_close();
+ if (headers_sent()) {
+ if (function_exists('debug_print_backtrace')) {
+ echo '<pre>';
+ debug_print_backtrace();
+ echo '</pre>';
+ }
+ trigger_error('PMA_sendHeaderLocation called when headers are already sent!', E_USER_ERROR);
+ }
+ // bug #1523784: IE6 does not like 'Refresh: 0', it
+ // results in a blank page
+ // but we need it when coming from the cookie login panel)
+ if (PMA_IS_IIS && defined('PMA_COMING_FROM_COOKIE_LOGIN')) {
+ header('Refresh: 0; ' . $uri);
+ } else {
+ header('Location: ' . $uri);
+ }
+ }
+ }
+}
?>
diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php
index 3c0408d..300a925 100644
--- a/libraries/database_interface.lib.php
+++ b/libraries/database_interface.lib.php
@@ -1405,7 +1405,7 @@ function PMA_DBI_get_triggers($db, $table, $delimiter = '//')
// instead of WHERE EVENT_OBJECT_SCHEMA='dbname'
$triggers = PMA_DBI_fetch_result("SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, ACTION_TIMING, ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA= '" . PMA_sqlAddslashes($db,true) . "' and EVENT_OBJECT_TABLE = '" . PMA_sqlAddslashes($table, true) . "';");
} else {
- $triggers = PMA_DBI_fetch_result("SHOW TRIGGERS FROM " . PMA_sqlAddslashes($db,true) . " LIKE '" . PMA_sqlAddslashes($table, true) . "';");
+ $triggers = PMA_DBI_fetch_result("SHOW TRIGGERS FROM " . PMA_backquote(PMA_sqlAddslashes($db,true)) . " LIKE '" . PMA_sqlAddslashes($table, true) . "';");
}
if ($triggers) {
diff --git a/libraries/dbi/mysqli.dbi.lib.php b/libraries/dbi/mysqli.dbi.lib.php
index 52f7601..9672385 100644
--- a/libraries/dbi/mysqli.dbi.lib.php
+++ b/libraries/dbi/mysqli.dbi.lib.php
@@ -110,9 +110,8 @@ function PMA_DBI_connect($user, $password, $is_controluser = false, $server = nu
if (!$server) {
$return_value = @mysqli_real_connect($link, $GLOBALS['cfg']['Server']['host'], $user, $password, false, $server_port, $server_socket, $client_flags);
-
// Retry with empty password if we're allowed to
- if ($return_value == false && isset($cfg['Server']['nopassword']) && $cfg['Server']['nopassword'] && !$is_controluser) {
+ if ($return_value == false && isset($GLOBALS['cfg']['Server']['nopassword']) && $GLOBALS['cfg']['Server']['nopassword'] && !$is_controluser) {
$return_value = @mysqli_real_connect($link, $GLOBALS['cfg']['Server']['host'], $user, '', false, $server_port, $server_socket, $client_flags);
}
} else {
diff --git a/libraries/header.inc.php b/libraries/header.inc.php
index 932fb80..0f63a94 100644
--- a/libraries/header.inc.php
+++ b/libraries/header.inc.php
@@ -106,7 +106,10 @@ if (empty($GLOBALS['is_header_sent'])) {
$GLOBALS['strDatabase'],
's_db.png');
- if (strlen($GLOBALS['table'])) {
+ // if the table is being dropped, $_REQUEST['purge'] is set
+ // (it always contains "1")
+ // so do not display the table name in upper div
+ if (strlen($GLOBALS['table']) && ! (isset($_REQUEST['purge']))) {
require_once './libraries/tbl_info.inc.php';
echo $separator;
diff --git a/libraries/session.inc.php b/libraries/session.inc.php
index d222394..f1ae661 100644
--- a/libraries/session.inc.php
+++ b/libraries/session.inc.php
@@ -101,5 +101,6 @@ function PMA_secureSession()
{
// prevent session fixation and XSS
session_regenerate_id(true);
+ $_SESSION[' PMA_token '] = md5(uniqid(rand(), true));
}
-?>
\ No newline at end of file
+?>
diff --git a/libraries/sql_query_form.lib.php b/libraries/sql_query_form.lib.php
index 97a15e3..5286d17 100644
--- a/libraries/sql_query_form.lib.php
+++ b/libraries/sql_query_form.lib.php
@@ -364,7 +364,7 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter
?>
<script type="text/javascript">
//<![CDATA[
- document.writeln(' <input type="checkbox" name="LockFromUpdate" value="1" id="checkbox_lock" /> <label for="checkbox_lock"><?php echo $GLOBALS['strQueryWindowLock']; ?></label> ');
+ document.writeln(' <input type="checkbox" name="LockFromUpdate" checked="checked" id="checkbox_lock" /> <label for="checkbox_lock"><?php echo $GLOBALS['strQueryWindowLock']; ?></label> ');
//]]>
</script>
<?php
diff --git a/libraries/tbl_links.inc.php b/libraries/tbl_links.inc.php
index 4731501..b6c9121 100644
--- a/libraries/tbl_links.inc.php
+++ b/libraries/tbl_links.inc.php
@@ -114,7 +114,6 @@ if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_
if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
$tabs['drop']['icon'] = 'b_deltbl.png';
$tabs['drop']['link'] = 'sql.php';
- $tabs['drop']['url_params'] = array('table' => NULL);
$tabs['drop']['text'] = $strDrop;
$tabs['drop']['args']['reload'] = 1;
$tabs['drop']['args']['purge'] = 1;
diff --git a/server_privileges.php b/server_privileges.php
index d43896b..44e9be7 100644
--- a/server_privileges.php
+++ b/server_privileges.php
@@ -942,6 +942,8 @@ if (isset($_REQUEST['adduser_submit']) || isset($_REQUEST['change_copy'])) {
$message = PMA_Message::rawError(PMA_DBI_getError());
break;
}
+ // this is needed in case tracking is on:
+ $GLOBALS['db'] = $username;
$GLOBALS['reload'] = TRUE;
PMA_reloadNavigation();
@@ -1255,6 +1257,9 @@ if (isset($_REQUEST['delete']) || (isset($_REQUEST['change_copy']) && $_REQUEST[
}
}
}
+ // tracking sets this, causing the deleted db to be shown in navi
+ unset($GLOBALS['db']);
+
$sql_query = join("\n", $queries);
if (! empty($drop_user_error)) {
$message = PMA_Message::rawError($drop_user_error);
diff --git a/sql.php b/sql.php
index 15b1beb..b728184 100644
--- a/sql.php
+++ b/sql.php
@@ -459,6 +459,9 @@ if (isset($GLOBALS['show_as_php']) || !empty($GLOBALS['validatequery'])) {
if (strlen($table) && strlen($db)) {
PMA_relationsCleanupTable($db, $table);
+ // this is to avoid counting rows for nothing, below
+ // (do not unset as $table is used further down in the logic)
+ $table = '';
} elseif (strlen($db)) {
PMA_relationsCleanupDatabase($db);
} else {
diff --git a/themes/.gitignore b/themes/.gitignore
new file mode 100644
index 0000000..2676970
--- /dev/null
+++ b/themes/.gitignore
@@ -0,0 +1,27 @@
+aqua
+aqua_brushed
+arctic_ocean
+cactica_blues
+clearview3
+crimson_gray
+dark_lime
+darkblue_gray
+garvblue
+graphivore
+green_orange
+grid
+hillside
+openphpnuke
+original_small
+paradice
+pixeline
+silk
+silkline
+smooth_yellow
+very_small
+xampp
+xp_basic
+xp_blue
+xp_dirty
+xp_green
+xp_silver
diff --git a/translators.html b/translators.html
index eb8c6ff..f4d3a4b 100644
--- a/translators.html
+++ b/translators.html
@@ -11,7 +11,7 @@
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>phpMyAdmin 3.3.5.1 - Official translators</title>
+ <title>phpMyAdmin 3.3.6-rc1 - Official translators</title>
<link rel="stylesheet" type="text/css" href="docs.css" />
</head>
@@ -19,7 +19,7 @@
<div id="header">
<h1>
<a href="http://www.phpmyadmin.net/">php<span class="myadmin">MyAdmin</span></a>
- 3.3.5.1
+ 3.3.6-rc1
official translators list
</h1>
</div>
hooks/post-receive
--
phpMyAdmin
1
0