From 57cf37314b20554ec430b663658bd4f585fd8d71 Mon Sep 17 00:00:00 2001 From: ReimuHakurei Date: Mon, 31 Jul 2023 01:13:44 -0500 Subject: [PATCH 1/6] Merge pull request #11 from russauld/master Fix broken link in PHP session security banner --- classes/Misc.php | 2 +- lang/english.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Misc.php b/classes/Misc.php index ff75df75a..058c1358c 100644 --- a/classes/Misc.php +++ b/classes/Misc.php @@ -1351,7 +1351,7 @@ function printTopbar() { $reqvars = $this->getRequestVars('table'); if (!$conf['extra_session_security']) { - echo '

', htmlspecialchars($lang['sessionsecuritywarning']), '

'; + echo '

', htmlspecialchars($lang['sessionsecuritywarning']), '

'; } echo "
"; diff --git a/lang/english.php b/lang/english.php index 440df3bba..bd23e9bcd 100644 --- a/lang/english.php +++ b/lang/english.php @@ -807,7 +807,7 @@ $lang['strloading'] = 'Loading...'; $lang['strerrorloading'] = 'Error Loading'; $lang['strclicktoreload'] = 'Click to reload'; - $lang['sessionsecuritywarning'] = 'You are running phpPgAdmin without session security.'; + $lang['sessionsecuritywarning'] = 'You are running phpPgAdmin without session security. Enable it in the config file.'; // Autovacuum $lang['strautovacuum'] = 'Autovacuum'; From 6112b49223bdf87175038d014a25ebab52e235d2 Mon Sep 17 00:00:00 2001 From: ReimuHakurei Date: Sat, 5 Aug 2023 19:11:16 +0000 Subject: [PATCH 2/6] Session security will now be treated as enabled by default (if the config entry does not exist, it will be enabled) --- classes/Misc.php | 2 +- lang/english.php | 31 +++++++++++++++---------------- libraries/lib.inc.php | 4 ++-- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/classes/Misc.php b/classes/Misc.php index 058c1358c..98e5c028f 100644 --- a/classes/Misc.php +++ b/classes/Misc.php @@ -1350,7 +1350,7 @@ function printTopbar() { $server_info = $this->getServerInfo(); $reqvars = $this->getRequestVars('table'); - if (!$conf['extra_session_security']) { + if (isset($conf['extra_session_security']) && $conf['extra_session_security'] === false) { echo ''; } diff --git a/lang/english.php b/lang/english.php index bd23e9bcd..1ca841376 100644 --- a/lang/english.php +++ b/lang/english.php @@ -21,7 +21,7 @@ $lang['strreportbug'] = 'Report a Bug'; $lang['strviewfaq'] = 'View online FAQ'; $lang['strviewfaq_url'] = 'http://phppgadmin.sourceforge.net/doku.php?id=faq'; - + // Basic strings $lang['strlogin'] = 'Login'; $lang['strloginfailed'] = 'Login failed'; @@ -150,11 +150,11 @@ $lang['strgotoppage'] = 'back to top'; $lang['strtheme'] = 'Theme'; $lang['strcluster'] = 'Cluster'; - + // Admin $lang['stradminondatabase'] = 'The following administrative tasks apply on the whole %s database.'; $lang['stradminontable'] = 'The following administrative tasks apply on the table %s.'; - + // User-supplied SQL history $lang['strhistory'] = 'History'; $lang['strnohistory'] = 'No history.'; @@ -165,7 +165,7 @@ $lang['strnodatabaseselected'] = 'Please, select a database.'; // Database sizes - $lang['strnoaccess'] = 'No Access'; + $lang['strnoaccess'] = 'No Access'; $lang['strsize'] = 'Size'; $lang['strbytes'] = 'bytes'; $lang['strkb'] = 'kB'; @@ -276,7 +276,7 @@ // Columns $lang['strcolprop'] = 'Column properties'; $lang['strnotableprovided'] = 'No table provided!'; - + // Users $lang['struser'] = 'User'; $lang['strusers'] = 'Users'; @@ -303,7 +303,7 @@ $lang['strpasswordchangedbad'] = 'Failed to change password.'; $lang['strpasswordshort'] = 'Password is too short.'; $lang['strpasswordconfirm'] = 'Password does not match confirmation.'; - + // Groups $lang['strgroup'] = 'Group'; $lang['strgroups'] = 'Groups'; @@ -435,7 +435,7 @@ $lang['strnosequences'] = 'No sequences found.'; $lang['strcreatesequence'] = 'Create sequence'; $lang['strlastvalue'] = 'Last value'; - $lang['strincrementby'] = 'Increment by'; + $lang['strincrementby'] = 'Increment by'; $lang['strstartvalue'] = 'Start value'; $lang['strrestartvalue'] = 'Restart value'; $lang['strmaxvalue'] = 'Max value'; @@ -463,7 +463,7 @@ $lang['strsequencenextval'] = 'Sequence incremented.'; $lang['strsequencenextvalbad'] = 'Sequence increment failed.'; $lang['strspecifysequencetodrop'] = 'You must specify at least one sequence to drop.'; - + // Indexes $lang['strindex'] = 'Index'; $lang['strindexes'] = 'Indexes'; @@ -674,9 +674,9 @@ $lang['strconfdropdomain'] = 'Are you sure you want to drop the domain "%s"?'; $lang['strdomainneedsname'] = 'You must give a name for your domain.'; $lang['strdomaincreated'] = 'Domain created.'; - $lang['strdomaincreatedbad'] = 'Domain creation failed.'; + $lang['strdomaincreatedbad'] = 'Domain creation failed.'; $lang['strdomainaltered'] = 'Domain altered.'; - $lang['strdomainalteredbad'] = 'Domain alteration failed.'; + $lang['strdomainalteredbad'] = 'Domain alteration failed.'; // Operators $lang['stroperator'] = 'Operator'; @@ -712,18 +712,18 @@ $lang['strimplicit'] = 'Implicit'; $lang['strinassignment'] = 'In assignment'; $lang['strbinarycompat'] = '(Binary compatible)'; - + // Conversions $lang['strconversions'] = 'Conversions'; $lang['strnoconversions'] = 'No conversions found.'; $lang['strsourceencoding'] = 'Source encoding'; $lang['strtargetencoding'] = 'Target encoding'; - + // Languages $lang['strlanguages'] = 'Languages'; $lang['strnolanguages'] = 'No languages found.'; $lang['strtrusted'] = 'Trusted'; - + // Info $lang['strnoinfo'] = 'No information available.'; $lang['strreferringtables'] = 'Referring tables'; @@ -807,7 +807,7 @@ $lang['strloading'] = 'Loading...'; $lang['strerrorloading'] = 'Error Loading'; $lang['strclicktoreload'] = 'Click to reload'; - $lang['sessionsecuritywarning'] = 'You are running phpPgAdmin without session security. Enable it in the config file.'; + $lang['sessionsecuritywarning'] = 'You are running phpPgAdmin with session security disabled. This is a potential security risk!'; // Autovacuum $lang['strautovacuum'] = 'Autovacuum'; @@ -845,7 +845,7 @@ $lang['strpreparedxacts'] = 'Prepared transactions'; $lang['strxactid'] = 'Transaction ID'; $lang['strgid'] = 'Global ID'; - + // Fulltext search $lang['strfulltext'] = 'Full Text Search'; $lang['strftsconfig'] = 'FTS configuration'; @@ -904,4 +904,3 @@ $lang['strpluginnotfound'] = 'Error: plugin \'%s\' not found. Check if this plugin exists in the plugins/ directory, or if this plugins has a plugin.php file. Plugin\'s names are case sensitive'; $lang['stractionnotfound'] = 'Error: action \'%s\' not found in the \'%s\' plugin, or it was not specified as an action.'; $lang['strhooknotfound'] = 'Error: hook \'%s\' is not avaliable.'; -?> diff --git a/libraries/lib.inc.php b/libraries/lib.inc.php index ae0d73317..d13405daf 100644 --- a/libraries/lib.inc.php +++ b/libraries/lib.inc.php @@ -54,9 +54,9 @@ // Session start: if extra_session_security is on, make sure cookie_samesite // is on (exit if we fail); otherwise, just start the session $our_session_name = 'PPA_ID'; - if ($conf['extra_session_security']) { + if (($conf['extra_session_security'] ?? true) === true) { if (version_compare(phpversion(), '7.3', '<')) { - exit('PHPPgAdmin cannot be fully secured while running under PHP versions before 7.3. Please upgrade PHP if possible. If you cannot upgrade, and you\'re willing to assume the risk of CSRF attacks, you can change the value of "extra_session_security" to false in your config.inc.php file.'); + exit('phpPgAdmin cannot be fully secured while running under PHP versions before 7.3. Please upgrade PHP if possible. If you cannot upgrade, and you\'re willing to assume the risk of CSRF attacks, you can change the value of "extra_session_security" to false in your config.inc.php file.'); } if (ini_get('session.auto_start')) { From a1352e35e2d8c1b947ac529c926158039dd2c9f5 Mon Sep 17 00:00:00 2001 From: ReimuHakurei Date: Sat, 5 Aug 2023 19:13:31 +0000 Subject: [PATCH 3/6] Use verbatim GPL 2.0 licence text --- LICENSE | 349 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 338 insertions(+), 11 deletions(-) diff --git a/LICENSE b/LICENSE index cbbbe7545..d159169d1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,12 +1,339 @@ -Copyright (c) 2002 - 2019 The phpPgAdmin Project - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License -for more details. + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. From bda5bd78eb36edd94af3b0101a4d346d4faa9747 Mon Sep 17 00:00:00 2001 From: ReimuHakurei Date: Sat, 5 Aug 2023 19:39:29 +0000 Subject: [PATCH 4/6] Whitespace and formatting cleanup. --- admin.php | 82 ++++++++++--------- all_db.php | 204 ++++++++++++++++++++++++------------------------ constraints.php | 2 - display.php | 19 ++--- fulltext.php | 22 +++--- functions.php | 44 +++++------ schemas.php | 56 ++++++------- sequences.php | 6 +- tables.php | 14 ++-- views.php | 183 +++++++++++++++++++++---------------------- 10 files changed, 309 insertions(+), 323 deletions(-) diff --git a/admin.php b/admin.php index a8740a283..c19a0d672 100644 --- a/admin.php +++ b/admin.php @@ -1,7 +1,7 @@ printTrail($type); $misc->printTitle($lang['strclusterindex'], 'pg.index.cluster'); - + echo "
\n"; - + if ($type == 'table') { echo "

", sprintf($lang['strconfclustertable'], $misc->printVal($_REQUEST['object'])), "

\n"; echo "\n"; @@ -41,7 +41,7 @@ function doCluster($type, $confirm=false) { } } echo "\n"; - + echo $misc->form; echo "\n"; //TODO @@ -84,7 +84,7 @@ function doCluster($type, $confirm=false) { } } } - + /** * Show confirmation of reindex and perform reindex */ @@ -111,9 +111,9 @@ function doReindex($type, $confirm=false) { else { $misc->printTrail($type); $misc->printTitle($lang['strreindex'], 'pg.reindex'); - + echo "\n"; - + if ($type == 'table') { echo "

", sprintf($lang['strconfreindextable'], $misc->printVal($_REQUEST['object'])), "

\n"; echo "\n"; @@ -124,10 +124,10 @@ function doReindex($type, $confirm=false) { } } echo "\n"; - + if ($data->hasForceReindex()) echo "

\n"; - + echo $misc->form; echo "\n"; //TODO @@ -162,7 +162,7 @@ function doReindex($type, $confirm=false) { } } } - + /** * Show confirmation of analyze and perform analyze */ @@ -189,9 +189,9 @@ function doAnalyze($type, $confirm=false) { else { $misc->printTrail($type); $misc->printTitle($lang['stranalyze'], 'pg.analyze'); - + echo "\n"; - + if ($type == 'table') { echo "

", sprintf($lang['strconfanalyzetable'], $misc->printVal($_REQUEST['object'])), "

\n"; echo "\n"; @@ -266,7 +266,7 @@ function doVacuum($type, $confirm = false) { $misc->printTitle($lang['strvacuum'], 'pg.vacuum'); echo "\n"; - + if ($type == 'table') { echo "

", sprintf($lang['strconfvacuumtable'], $misc->printVal($_REQUEST['object'])), "

\n"; echo "\n"; @@ -320,14 +320,14 @@ function doVacuum($type, $confirm = false) { */ function doEditAutovacuum($type, $confirm, $msg='') { global $script, $data, $misc, $lang; - + if (empty($_REQUEST['table'])) { doAdmin($type, '', $lang['strspecifyeditvacuumtable']); return; } - + $script = ($type == 'database')? 'database.php' : 'tables.php'; - + if ($confirm) { $misc->printTrail($type); $misc->printTitle(sprintf($lang['streditvacuumtable'], $misc->printVal($_REQUEST['table']))); @@ -337,7 +337,7 @@ function doEditAutovacuum($type, $confirm, $msg='') { doAdmin($type, '', $lang['strspecifyeditvacuumtable']); return; } - + $old_val = $data->getTableAutovacuum($_REQUEST['table']); $defaults = $data->getAutovacuum(); $old_val = $old_val->fields; @@ -401,14 +401,14 @@ function doEditAutovacuum($type, $confirm, $msg='') { $status = $data->saveAutovacuum($_REQUEST['table'], $_POST['autovacuum_enabled'], $_POST['autovacuum_vacuum_threshold'], $_POST['autovacuum_vacuum_scale_factor'], $_POST['autovacuum_analyze_threshold'], $_POST['autovacuum_analyze_scale_factor'], $_POST['autovacuum_vacuum_cost_delay'], $_POST['autovacuum_vacuum_cost_limit']); - + if ($status == 0) doAdmin($type, '', sprintf($lang['strsetvacuumtablesaved'], $_REQUEST['table'])); else doEditAutovacuum($type, true, $lang['strsetvacuumtablefail']); } } - + /** * confirm drop autovacuum params for a table and drop it */ @@ -419,11 +419,11 @@ function doDropAutovacuum($type, $confirm) { doAdmin($type, '', $lang['strspecifydelvacuumtable']); return; } - + if ($confirm) { $misc->printTrail($type); $misc->printTabs($type,'admin'); - + $script = ($type == 'database')? 'database.php' : 'tables.php'; printf("

{$lang['strdelvacuumtable']}

\n", @@ -436,7 +436,7 @@ function doDropAutovacuum($type, $confirm) { echo "\n"; echo "\n"; echo "
\n"; - + echo "
\n"; echo "\n"; echo "\n"; @@ -445,9 +445,9 @@ function doDropAutovacuum($type, $confirm) { echo "
\n"; } else { - + $status = $data->dropAutovacuum($_POST['table']); - + if ($status == 0) { doAdmin($type, '', sprintf($lang['strvacuumtablereset'], $misc->printVal($_POST['table']))); } @@ -461,19 +461,19 @@ function doDropAutovacuum($type, $confirm) { * * $Id: admin.php */ - + function doAdmin($type, $msg = '') { - global $script, $data, $misc, $lang; + global $script, $data, $misc, $lang; $misc->printTrail($type); $misc->printTabs($type,'admin'); $misc->printMsg($msg); - + if ($type == 'database') printf("

{$lang['stradminondatabase']}

\n", $misc->printVal($_REQUEST['object'])); else printf("

{$lang['stradminontable']}

\n", $misc->printVal($_REQUEST['object'])); - + echo "\n"; echo "\n"; echo ""; - echo ""; + echo ""; // Vacuum echo "\n"; echo "\n"; // Analyze @@ -519,7 +519,7 @@ function doAdmin($type, $msg = '') { echo "

\n"; echo "\n"; echo "\n"; - + // Cluster if ($data->hasRecluster()){ $disabled = ''; @@ -539,7 +539,7 @@ function doAdmin($type, $msg = '') { echo "\n"; echo "\n"; } - + // Reindex echo "\n\t\t\n"; echo "\t\t\n\n"; + echo "
"; @@ -490,13 +490,13 @@ function doAdmin($type, $msg = '') { echo ""; $misc->printHelp($lang['strreindex'],'pg.index.reindex'); echo "
\n"; echo "
\n"; - + echo "

\n"; echo $misc->form; if ($type == 'table') { @@ -504,7 +504,7 @@ function doAdmin($type, $msg = '') { echo "\n"; } echo "

\n"; - echo "
\n"; + echo "\n"; echo "
\n"; echo "
\n"; @@ -566,20 +566,20 @@ function doAdmin($type, $msg = '') { echo "

{$lang['strvacuumpertable']}

"; echo '

' . (($defaults['autovacuum'] == 'on') ? $lang['strturnedon'] : $lang['strturnedoff'] ) . '

'; echo "

{$lang['strnotdefaultinred']}

"; - + function enlight($f, $p) { if ( isset($f[$p[0]]) and ($f[$p[0]] != $p[1])) return "". htmlspecialchars($f[$p[0]]) .""; return htmlspecialchars($p[1]); } - + $columns = array( 'namespace' => array( 'title' => $lang['strschema'], 'field' => field('nspname'), 'url' => "redirect.php?subject=schema&{$misc->href}&", 'vars' => array('schema' => 'nspname'), - ), + ), 'relname' => array( 'title' => $lang['strtable'], 'field' => field('relname'), @@ -622,7 +622,7 @@ function enlight($f, $p) { 'type' => 'verbatim' ), ); - + // Maybe we need to check permissions here? $columns['actions'] = array('title' => $lang['stractions']); @@ -666,7 +666,7 @@ function enlight($f, $p) { } $misc->printTable($autovac, $columns, $actions, 'admin-admin', $lang['strnovacuumconf']); - + if (($type == 'table') and ($autovac->recordCount() == 0)) { echo "
"; echo "href}&table=", htmlspecialchars($_REQUEST['table']) @@ -674,10 +674,10 @@ function enlight($f, $p) { } } } - + function adminActions($action, $type) { global $script; - + if ($type == 'database') { $_REQUEST['object'] = $_REQUEST['database']; $script = 'database.php'; @@ -749,5 +749,3 @@ function adminActions($action, $type) { } return true; } - -?> diff --git a/all_db.php b/all_db.php index b63fe45d3..7bfab892e 100644 --- a/all_db.php +++ b/all_db.php @@ -89,36 +89,34 @@ function doDrop($confirm) { } if ($confirm) { + $misc->printTrail('database'); + $misc->printTitle($lang['strdrop'], 'pg.database.drop'); - $misc->printTrail('database'); - $misc->printTitle($lang['strdrop'], 'pg.database.drop'); - - echo "\n"; - //If multi drop - if (isset($_REQUEST['ma'])) { + echo "\n"; - foreach($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); - echo "

", sprintf($lang['strconfdropdatabase'], $misc->printVal($a['database'])), "

\n"; - printf('', htmlspecialchars($a['database'])); - } + // If multi drop + if (isset($_REQUEST['ma'])) { + foreach($_REQUEST['ma'] as $v) { + $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + echo "

", sprintf($lang['strconfdropdatabase'], $misc->printVal($a['database'])), "

\n"; + printf('', htmlspecialchars($a['database'])); + } } else { - echo "

", sprintf($lang['strconfdropdatabase'], $misc->printVal($_REQUEST['dropdatabase'])), "

\n"; - echo "\n"; - }// END if multi drop + echo "

", sprintf($lang['strconfdropdatabase'], $misc->printVal($_REQUEST['dropdatabase'])), "

\n"; + echo "\n"; + } echo "\n"; - echo $misc->form; + echo $misc->form; echo "\n"; echo "\n"; echo "\n"; - } // END confirm - else { - //If multi drop - if (is_array($_REQUEST['dropdatabase'])) { - $msg = ''; - foreach($_REQUEST['dropdatabase'] as $d) { + } else { + // If multi drop + if (is_array($_REQUEST['dropdatabase'])) { + $msg = ''; + foreach($_REQUEST['dropdatabase'] as $d) { $status = $data->dropDatabase($d); if ($status == 0) $msg.= sprintf('%s: %s
', htmlentities($d, ENT_QUOTES, 'UTF-8'), $lang['strdatabasedropped']); @@ -126,20 +124,20 @@ function doDrop($confirm) { doDefault(sprintf('%s%s: %s
', $msg, htmlentities($d, ENT_QUOTES, 'UTF-8'), $lang['strdatabasedroppedbad'])); return; } - }// Everything went fine, back to Default page... - $_reload_drop_database = true; - doDefault($msg); - } else { - $status = $data->dropDatabase($_POST['dropdatabase']); - if ($status == 0) { - $_reload_drop_database = true; - doDefault($lang['strdatabasedropped']); - } - else - doDefault($lang['strdatabasedroppedbad']); - } - }//END DROP - }// END FUNCTION + } // Everything went fine, back to Default page... + $_reload_drop_database = true; + doDefault($msg); + } else { + $status = $data->dropDatabase($_POST['dropdatabase']); + if ($status == 0) { + $_reload_drop_database = true; + doDefault($lang['strdatabasedropped']); + } else { + doDefault($lang['strdatabasedroppedbad']); + } + } + } + } /** @@ -156,7 +154,7 @@ function doCreate($msg = '') { if (!isset($_POST['formName'])) $_POST['formName'] = ''; // Default encoding is that in language file if (!isset($_POST['formEncoding'])) { - $_POST['formEncoding'] = ''; + $_POST['formEncoding'] = ''; } if (!isset($_POST['formTemplate'])) $_POST['formTemplate'] = 'template1'; if (!isset($_POST['formSpc'])) $_POST['formSpc'] = ''; @@ -177,15 +175,15 @@ function doCreate($msg = '') { echo "\t
{$lang['strtemplatedb']}\n"; echo "\t\t\t\n"; echo "\t\t\t\t\n"; foreach ($data->codemap as $key => $value) { - echo "\t\t\t\t\n"; } @@ -282,9 +280,9 @@ function doSaveCreate() { if ($status == 0) { $_reload_browser = true; doDefault($lang['strdatabasecreated']); - } - else + } else { doCreate($lang['strdatabasecreatedbad']); + } } } @@ -397,51 +395,51 @@ function doDefault($msg = '') { $actions = array( 'multiactions' => array( - 'keycols' => array('database' => 'datname'), - 'url' => 'all_db.php', - 'default' => null, + 'keycols' => array('database' => 'datname'), + 'url' => 'all_db.php', + 'default' => null, ), 'drop' => array( - 'content' => $lang['strdrop'], - 'attr'=> array ( - 'href' => array ( - 'url' => 'all_db.php', - 'urlvars' => array ( - 'subject' => 'database', - 'action' => 'confirm_drop', - 'dropdatabase' => field('datname') - ) - ) - ), - 'multiaction' => 'confirm_drop', + 'content' => $lang['strdrop'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'all_db.php', + 'urlvars' => array ( + 'subject' => 'database', + 'action' => 'confirm_drop', + 'dropdatabase' => field('datname') + ) + ) + ), + 'multiaction' => 'confirm_drop', ), 'privileges' => array( - 'content' => $lang['strprivileges'], - 'attr'=> array ( - 'href' => array ( - 'url' => 'privileges.php', - 'urlvars' => array ( - 'subject' => 'database', - 'database' => field('datname') - ) + 'content' => $lang['strprivileges'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'privileges.php', + 'urlvars' => array ( + 'subject' => 'database', + 'database' => field('datname') + ) + ) ) - ) ) ); if ($data->hasAlterDatabase() ) { - $actions['alter'] = array( - 'content' => $lang['stralter'], - 'attr'=> array ( - 'href' => array ( - 'url' => 'all_db.php', - 'urlvars' => array ( - 'subject' => 'database', - 'action' => 'confirm_alter', - 'alterdatabase' => field('datname') + $actions['alter'] = array( + 'content' => $lang['stralter'], + 'attr'=> array ( + 'href' => array ( + 'url' => 'all_db.php', + 'urlvars' => array ( + 'subject' => 'database', + 'action' => 'confirm_alter', + 'alterdatabase' => field('datname') + ) + ) ) - ) - ) - ); + ); } if (!$data->hasTablespaces()) unset($columns['tablespace']); @@ -452,18 +450,18 @@ function doDefault($msg = '') { $misc->printTable($databases, $columns, $actions, 'all_db-databases', $lang['strnodatabases']); $navlinks = array ( - 'create' => array ( - 'attr'=> array ( - 'href' => array ( - 'url' => 'all_db.php', - 'urlvars' => array ( - 'action' => 'create', - 'server' => $_REQUEST['server'] - ) - ) - ), - 'content' => $lang['strcreatedatabase'] - ) + 'create' => array ( + 'attr'=> array ( + 'href' => array ( + 'url' => 'all_db.php', + 'urlvars' => array ( + 'action' => 'create', + 'server' => $_REQUEST['server'] + ) + ) + ), + 'content' => $lang['strcreatedatabase'] + ) ); $misc->printNavLinks($navlinks, 'all_db-databases', get_defined_vars()); } @@ -479,17 +477,19 @@ function doTree() { 'text' => field('datname'), 'icon' => 'Database', 'toolTip'=> field('datcomment'), - 'action' => url('redirect.php', - $reqvars, - array('database' => field('datname')) - ), - 'branch' => url('database.php', - $reqvars, - array( - 'action' => 'tree', - 'database' => field('datname') - ) - ), + 'action' => url( + 'redirect.php', + $reqvars, + array('database' => field('datname')) + ), + 'branch' => url( + 'database.php', + $reqvars, + array( + 'action' => 'tree', + 'database' => field('datname') + ) + ), ); $misc->printTree($databases, $attrs, 'databases'); @@ -532,5 +532,3 @@ function doTree() { } $misc->printFooter(); - -?> diff --git a/constraints.php b/constraints.php index dcc3e94e8..8ca35d988 100644 --- a/constraints.php +++ b/constraints.php @@ -639,5 +639,3 @@ function getIcon($f) { } $misc->printFooter(); - -?> diff --git a/display.php b/display.php index 3c93a4273..1a7817aff 100644 --- a/display.php +++ b/display.php @@ -850,22 +850,20 @@ function doBrowse($msg = '') { $lang['strtables'].': '.$_REQUEST[$_REQUEST['subject']], $scripts ); - } - else if ($_REQUEST['subject'] == 'view') { + } else if ($_REQUEST['subject'] == 'view') { $misc->printHeader( $lang['strviews'].': '.$_REQUEST[$_REQUEST['subject']], $scripts ); + } else if ($_REQUEST['subject'] == 'column') { + $misc->printHeader( + $lang['strcolumn'].': '.$_REQUEST[$_REQUEST['subject']], + $scripts + ); } - else if ($_REQUEST['subject'] == 'column') { - $misc->printHeader( - $lang['strcolumn'].': '.$_REQUEST[$_REQUEST['subject']], - $scripts - ); - } - } - else + } else { $misc->printHeader($lang['strqueryresults']); + } $misc->printBody(); @@ -890,4 +888,3 @@ function doBrowse($msg = '') { } $misc->printFooter(); -?> diff --git a/fulltext.php b/fulltext.php index 4f54bca62..40910c8b3 100644 --- a/fulltext.php +++ b/fulltext.php @@ -88,7 +88,7 @@ function doDefault($msg = '') { 'content' => $lang['strftscreateconfig'] ) ); - + $misc->printNavLinks($navlinks, 'fulltext-fulltext', get_defined_vars()); } @@ -222,7 +222,7 @@ function doCreateConfig($msg = '') { $data->fieldClean($ftsparsers->fields['schema']); $data->fieldClean($ftsparsers->fields['name']); $parsername = $ftsparsers->fields['schema'] .'.'. $ftsparsers->fields['name']; - + $ftsparsers_[$parsername] = serialize(array( 'parser' => $ftsparsers->fields['name'], 'schema' => $ftsparsers->fields['schema'] @@ -259,7 +259,7 @@ function doSaveCreateConfig() { $err = ''; // Check that they've given a name - if ($_POST['formName'] == '') $err .= "{$lang['strftsconfigneedsname']}
"; + if ($_POST['formName'] == '') $err .= "{$lang['strftsconfigneedsname']}
"; if (($_POST['formParser'] != '') && ($_POST['formTemplate'] != '')) $err .= "{$lang['strftscantparsercopy']}
"; if ($err != '') return doCreateConfig($err); @@ -640,7 +640,7 @@ function doCreateDict($msg = '') { echo "\n"; echo "

\n"; echo "\n", - "\n"; - + echo "\n"; // Output table header @@ -95,7 +95,7 @@ function doSelectRows($confirm, $msg = '') { if (!isset($_POST['show'])) $_POST['show'] = array(); if (!isset($_POST['values'])) $_POST['values'] = array(); if (!isset($_POST['nulls'])) $_POST['nulls'] = array(); - + // Verify that they haven't supplied a value for unary operators foreach ($_POST['ops'] as $k => $v) { if ($data->selectOps[$v] == 'p' && $_POST['values'][$k] != '') { @@ -103,7 +103,7 @@ function doSelectRows($confirm, $msg = '') { return; } } - + if (sizeof($_POST['show']) == 0) doSelectRows(true, $lang['strselectneedscol']); else { @@ -119,7 +119,7 @@ function doSelectRows($confirm, $msg = '') { } } - + /** * Show confirmation of drop and perform actual drop */ @@ -132,12 +132,12 @@ function doDrop($confirm) { exit(); } - if ($confirm) { + if ($confirm) { $misc->printTrail('view'); $misc->printTitle($lang['strdrop'],'pg.view.drop'); - + echo "\n"; - + //If multi drop if (isset($_REQUEST['ma'])) { foreach($_REQUEST['ma'] as $v) { @@ -150,9 +150,9 @@ function doDrop($confirm) { echo "

", sprintf($lang['strconfdropview'], $misc->printVal($_REQUEST['view'])), "

\n"; echo "\n"; } - + echo "\n"; - + echo $misc->form; echo "

\n"; echo "\n"; @@ -192,41 +192,41 @@ function doDrop($confirm) { doDefault($lang['strviewdroppedbad']); } } - + } - + /** * Sets up choices for table linkage, and which fields to select for the view we're creating */ function doSetParamsCreate($msg = '') { global $data, $misc; global $lang; - + // Check that they've chosen tables for the view definition if (!isset($_POST['formTables']) ) doWizardCreate($lang['strviewneedsdef']); else { // Initialise variables if (!isset($_REQUEST['formView'])) $_REQUEST['formView'] = ''; if (!isset($_REQUEST['formComment'])) $_REQUEST['formComment'] = ''; - + $misc->printTrail('schema'); $misc->printTitle($lang['strcreateviewwiz'], 'pg.view.create'); $misc->printMsg($msg); - + $tblCount = sizeof($_POST['formTables']); //unserialize our schema/table information and store in arrSelTables for ($i = 0; $i < $tblCount; $i++) { $arrSelTables[] = unserialize($_POST['formTables'][$i]); } - + $linkCount = $tblCount; - + //get linking keys $rsLinkKeys = $data->getLinkingKeys($arrSelTables); $linkCount = $rsLinkKeys->recordCount() > $tblCount ? $rsLinkKeys->recordCount() : $tblCount; - + $arrFields = array(); //array that will hold all our table/field names - + //if we have schemas we need to specify the correct schema for each table we're retrieiving //with getTableAttributes $curSchema = $data->_schema; @@ -234,21 +234,21 @@ function doSetParamsCreate($msg = '') { if ($data->_schema != $arrSelTables[$i]['schemaname']) { $data->setSchema($arrSelTables[$i]['schemaname']); } - + $attrs = $data->getTableAttributes($arrSelTables[$i]['tablename']); while (!$attrs->EOF) { $arrFields["{$arrSelTables[$i]['schemaname']}.{$arrSelTables[$i]['tablename']}.{$attrs->fields['attname']}"] = serialize(array( - 'schemaname' => $arrSelTables[$i]['schemaname'], - 'tablename' => $arrSelTables[$i]['tablename'], - 'fieldname' => $attrs->fields['attname']) + 'schemaname' => $arrSelTables[$i]['schemaname'], + 'tablename' => $arrSelTables[$i]['tablename'], + 'fieldname' => $attrs->fields['attname']) ); $attrs->moveNext(); } - + $data->setSchema($curSchema); } asort($arrFields); - + echo "\n"; echo "
\n"; echo ""; @@ -263,7 +263,7 @@ function doSetParamsCreate($msg = '') { htmlspecialchars($_REQUEST['formComment']), "\n"; echo "\n\n"; echo "
{$lang['strviewname']}
\n"; - + // Output selector for fields to be retrieved from view echo "\n"; echo ""; @@ -273,7 +273,7 @@ function doSetParamsCreate($msg = '') { echo "
{$lang['strcolumns']}
"; echo "
"; echo "

"; - + // Output the Linking keys combo boxes echo "\n"; echo ""; @@ -282,7 +282,7 @@ function doSetParamsCreate($msg = '') { // Initialise variables if (!isset($formLink[$i]['operator'])) $formLink[$i]['operator'] = 'INNER JOIN'; echo "\n
{$lang['strviewlink']}
\n"; - + if (!$rsLinkKeys->EOF) { $curLeftLink = htmlspecialchars(serialize(array('schemaname' => $rsLinkKeys->fields['p_schema'], 'tablename' => $rsLinkKeys->fields['p_table'], 'fieldname' => $rsLinkKeys->fields['p_field']) ) ); $curRightLink = htmlspecialchars(serialize(array('schemaname' => $rsLinkKeys->fields['f_schema'], 'tablename' => $rsLinkKeys->fields['f_table'], 'fieldname' => $rsLinkKeys->fields['f_field']) ) ); @@ -292,7 +292,7 @@ function doSetParamsCreate($msg = '') { $curLeftLink = ''; $curRightLink = ''; } - + echo GUI::printCombo($arrFields, "formLink[$i][leftlink]", true, $curLeftLink, false ); echo GUI::printCombo($data->joinOps, "formLink[$i][operator]", true, $formLink[$i]['operator']); echo GUI::printCombo($arrFields, "formLink[$i][rightlink]", true, $curRightLink, false ); @@ -300,14 +300,14 @@ function doSetParamsCreate($msg = '') { $rowClass = $rowClass == 'data1' ? 'data2' : 'data1'; } echo "
\n
\n"; - + // Build list of available operators (infix only) $arrOperators = array(); foreach ($data->selectOps as $k => $v) { if ($v == 'i') $arrOperators[$k] = $k; } - // Output additional conditions, note that this portion of the wizard treats the right hand side as literal values + // Output additional conditions, note that this portion of the wizard treats the right hand side as literal values //(not as database objects) so field names will be treated as strings, use the above linking keys section to perform joins echo "\n"; echo ""; @@ -322,36 +322,36 @@ function doSetParamsCreate($msg = '') { } echo "
{$lang['strviewconditions']}
\n"; echo "

\n"; - + foreach ($arrSelTables as $curTable) { echo "\n"; } - + echo $misc->form; echo "\n"; echo "

\n"; echo "\n"; } } - + /** * Display a wizard where they can enter a new view */ function doWizardCreate($msg = '') { global $data, $misc; global $lang; - + $tables = $data->getTables(true); - + $misc->printTrail('schema'); $misc->printTitle($lang['strcreateviewwiz'], 'pg.view.create'); $misc->printMsg($msg); - + echo "
\n"; echo "\n"; - echo ""; - echo "\n"; + echo "\n\n\n"; - echo "
{$lang['strtables']}
\n"; - + echo "
{$lang['strtables']}
\n"; + $arrTables = array(); while (!$tables->EOF) { $arrTmp = array(); @@ -359,25 +359,25 @@ function doWizardCreate($msg = '') { $arrTmp['tablename'] = $tables->fields['relname']; $arrTables[$tables->fields['nspname'] . '.' . $tables->fields['relname']] = serialize($arrTmp); $tables->moveNext(); - } - echo GUI::printCombo($arrTables, 'formTables[]', false, '', true); - - echo "
\n"; + } + echo GUI::printCombo($arrTables, 'formTables[]', false, '', true); + + echo "
\n"; echo "

\n"; echo $misc->form; echo "\n"; echo "

\n"; echo "\n"; } - + /** * Displays a screen where they can enter a new view */ function doCreate($msg = '') { global $data, $misc, $conf; global $lang; - + if (!isset($_REQUEST['formView'])) $_REQUEST['formView'] = ''; if (!isset($_REQUEST['formDefinition'])) { if (isset($_SESSION['sqlquery'])) @@ -385,11 +385,11 @@ function doCreate($msg = '') { else $_REQUEST['formDefinition'] = 'SELECT '; } if (!isset($_REQUEST['formComment'])) $_REQUEST['formComment'] = ''; - + $misc->printTrail('schema'); $misc->printTitle($lang['strcreateview'], 'pg.view.create'); $misc->printMsg($msg); - + echo "
\n"; echo "\n"; echo "\t\n\t\t\n"; @@ -408,17 +408,17 @@ function doCreate($msg = '') { echo "

\n"; echo "\n"; } - + /** * Actually creates the new view in the database */ function doSaveCreate() { global $data, $lang, $_reload_browser; - + // Check that they've given a name and a definition if ($_POST['formView'] == '') doCreate($lang['strviewneedsname']); elseif ($_POST['formDefinition'] == '') doCreate($lang['strviewneedsdef']); - else { + else { $status = $data->createView($_POST['formView'], $_POST['formDefinition'], false, $_POST['formComment']); if ($status == 0) { $_reload_browser = true; @@ -427,19 +427,19 @@ function doSaveCreate() { else doCreate($lang['strviewcreatedbad']); } - } + } /** * Actually creates the new wizard view in the database */ function doSaveCreateWiz() { global $data, $lang, $_reload_browser; - - // Check that they've given a name and fields they want to select - + + // Check that they've given a name and fields they want to select + if (!strlen($_POST['formView']) ) doSetParamsCreate($lang['strviewneedsname']); else if (!isset($_POST['formFields']) || !count($_POST['formFields']) ) doSetParamsCreate($lang['strviewneedsfields']); - else { + else { $selFields = ''; if (! empty($_POST['dblFldMeth']) ) @@ -474,35 +474,35 @@ function doSaveCreateWiz() { if (strlen($curLink['leftlink']) && strlen($curLink['rightlink']) && strlen($curLink['operator'])) { $arrLinks[] = $curLink; } - } + } // We must perform some magic to make sure that we have a valid join order $count = sizeof($arrLinks); $arrJoined = array(); - $arrUsedTbls = array(); + $arrUsedTbls = array(); // If we have at least one join condition, output it if ($count > 0) { $j = 0; - while ($j < $count) { + while ($j < $count) { foreach ($arrLinks as $curLink) { - + $arrLeftLink = unserialize($curLink['leftlink']); $arrRightLink = unserialize($curLink['rightlink']); $data->fieldArrayClean($arrLeftLink); $data->fieldArrayClean($arrRightLink); - + $tbl1 = "\"{$arrLeftLink['schemaname']}\".\"{$arrLeftLink['tablename']}\""; $tbl2 = "\"{$arrRightLink['schemaname']}\".\"{$arrRightLink['tablename']}\""; - + if ( (!in_array($curLink, $arrJoined) && in_array($tbl1, $arrUsedTbls)) || !count($arrJoined) ) { - + // Make sure for multi-column foreign keys that we use a table alias tables joined to more than once // This can (and should be) more optimized for multi-column foreign keys $adj_tbl2 = in_array($tbl2, $arrUsedTbls) ? "$tbl2 AS alias_ppa_" . mktime() : $tbl2; - + $linkFields .= strlen($linkFields) ? "{$curLink['operator']} $adj_tbl2 ON (\"{$arrLeftLink['schemaname']}\".\"{$arrLeftLink['tablename']}\".\"{$arrLeftLink['fieldname']}\" = \"{$arrRightLink['schemaname']}\".\"{$arrRightLink['tablename']}\".\"{$arrRightLink['fieldname']}\") " : "$tbl1 {$curLink['operator']} $adj_tbl2 ON (\"{$arrLeftLink['schemaname']}\".\"{$arrLeftLink['tablename']}\".\"{$arrLeftLink['fieldname']}\" = \"{$arrRightLink['schemaname']}\".\"{$arrRightLink['tablename']}\".\"{$arrRightLink['fieldname']}\") "; - + $arrJoined[] = $curLink; if (!in_array($tbl1, $arrUsedTbls) ) $arrUsedTbls[] = $tbl1; if (!in_array($tbl2, $arrUsedTbls) ) $arrUsedTbls[] = $tbl2; @@ -512,8 +512,8 @@ function doSaveCreateWiz() { } } } - - //if linkfields has no length then either _POST['formLink'] was not set, or there were no join conditions + + //if linkfields has no length then either _POST['formLink'] was not set, or there were no join conditions //just select from all selected tables - a cartesian join do a if (!strlen($linkFields) ) { foreach ($_POST['formTables'] as $curTable) { @@ -522,7 +522,7 @@ function doSaveCreateWiz() { $linkFields .= strlen($linkFields) ? ", \"{$arrTmp['schemaname']}\".\"{$arrTmp['tablename']}\"" : "\"{$arrTmp['schemaname']}\".\"{$arrTmp['tablename']}\""; } } - + $addConditions = ''; if (is_array($_POST['formCondition']) ) { foreach ($_POST['formCondition'] as $curCondition) { @@ -534,12 +534,12 @@ function doSaveCreateWiz() { } } } - + $viewQuery = "SELECT $selFields FROM $linkFields "; - + //add where from additional conditions if (strlen($addConditions) ) $viewQuery .= ' WHERE ' . $addConditions; - + $status = $data->createView($_POST['formView'], $viewQuery, false, $_POST['formComment']); if ($status == 0) { $_reload_browser = true; @@ -549,20 +549,20 @@ function doSaveCreateWiz() { doSetParamsCreate($lang['strviewcreatedbad']); } } - + /** * Show default list of views in the database */ function doDefault($msg = '') { global $data, $misc, $conf; global $lang; - + $misc->printTrail('schema'); $misc->printTabs('schema','views'); $misc->printMsg($msg); - + $views = $data->getViews(); - + $columns = array( 'view' => array( 'title' => $lang['strview'], @@ -582,7 +582,7 @@ function doDefault($msg = '') { 'field' => field('relcomment'), ), ); - + $actions = array( 'multiactions' => array( 'keycols' => array('view' => 'relname'), @@ -648,9 +648,9 @@ function doDefault($msg = '') { ) ), ); - + $misc->printTable($views, $columns, $actions, 'views-views', $lang['strnoviews']); - + $navlinks = array ( 'create' => array ( 'attr'=> array ( @@ -684,17 +684,17 @@ function doDefault($msg = '') { $misc->printNavLinks($navlinks, 'views-views', get_defined_vars()); } - + /** * Generate XML for the browser tree. */ function doTree() { global $misc, $data; - + $views = $data->getViews(); - + $reqvars = $misc->getRequestVars('view'); - + $attrs = array( 'text' => field('relname'), 'icon' => 'View', @@ -708,11 +708,11 @@ function doTree() { ) ) ); - + $misc->printTree($views, $attrs, 'views'); exit; } - + function doSubTree() { global $misc, $data; @@ -737,10 +737,10 @@ function doSubTree() { $misc->printTree($items, $attrs, 'view'); exit; } - + if ($action == 'tree') doTree(); if ($action == 'subtree') dosubTree(); - + $misc->printHeader($lang['strviews']); $misc->printBody(); @@ -776,12 +776,11 @@ function doSubTree() { break; case 'confirm_drop': doDrop(true); - break; + break; default: doDefault(); break; - } + } $misc->printFooter(); - -?> + From 98c4680dd6f28e5013998e97f1563cca6575062b Mon Sep 17 00:00:00 2001 From: ReimuHakurei Date: Sat, 5 Aug 2023 19:49:29 +0000 Subject: [PATCH 5/6] Security fix: Replace all calls to unserialize() with calls to phpMyAdmin's safeUnserialize wrapper. --- admin.php | 8 ++-- all_db.php | 2 +- constraints.php | 8 ++-- display.php | 4 +- fulltext.php | 10 ++--- functions.php | 2 +- libraries/lib.inc.php | 90 +++++++++++++++++++++++++++++++++++++++++++ schemas.php | 2 +- sequences.php | 8 ++-- tables.php | 8 ++-- views.php | 16 ++++---- 11 files changed, 124 insertions(+), 34 deletions(-) diff --git a/admin.php b/admin.php index c19a0d672..b3c2cbd7f 100644 --- a/admin.php +++ b/admin.php @@ -20,7 +20,7 @@ function doCluster($type, $confirm=false) { echo "
\n"; foreach($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + $a = safeUnserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo "

", sprintf($lang['strconfclustertable'], $misc->printVal($a['table'])), "

\n"; echo "\n"; } @@ -103,7 +103,7 @@ function doReindex($type, $confirm=false) { echo "\n"; foreach($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + $a = safeUnserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo "

", sprintf($lang['strconfreindextable'], $misc->printVal($a['table'])), "

\n"; echo "\n"; } @@ -181,7 +181,7 @@ function doAnalyze($type, $confirm=false) { echo "\n"; foreach($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + $a = safeUnserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo "

", sprintf($lang['strconfanalyzetable'], $misc->printVal($a['table'])), "

\n"; echo "\n"; } @@ -256,7 +256,7 @@ function doVacuum($type, $confirm = false) { echo "\n"; foreach($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + $a = safeUnserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo "

", sprintf($lang['strconfvacuumtable'], $misc->printVal($a['table'])), "

\n"; echo "\n"; } diff --git a/all_db.php b/all_db.php index 7bfab892e..4853ec6c0 100644 --- a/all_db.php +++ b/all_db.php @@ -97,7 +97,7 @@ function doDrop($confirm) { // If multi drop if (isset($_REQUEST['ma'])) { foreach($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + $a = safeUnserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo "

", sprintf($lang['strconfdropdatabase'], $misc->printVal($a['database'])), "

\n"; printf('', htmlspecialchars($a['database'])); } diff --git a/constraints.php b/constraints.php index 8ca35d988..bd1c41e18 100644 --- a/constraints.php +++ b/constraints.php @@ -38,7 +38,7 @@ function addForeignKey($stage, $msg = '') { if (!isset($_POST['match'])) $_POST['match'] = null; if (!isset($_POST['deferrable'])) $_POST['deferrable'] = null; if (!isset($_POST['initially'])) $_POST['initially'] = null; - $_REQUEST['target'] = unserialize($_REQUEST['target']); + $_REQUEST['target'] = safeUnserialize($_REQUEST['target']); $misc->printTrail('table'); $misc->printTitle($lang['straddfk'],'pg.constraint.foreign_key'); @@ -129,16 +129,16 @@ function addForeignKey($stage, $msg = '') { break; case 3: // Unserialize target - $_POST['target'] = unserialize($_POST['target']); + $_POST['target'] = safeUnserialize($_POST['target']); // Check that they've given at least one column - if (isset($_POST['SourceColumnList'])) $temp = unserialize($_POST['SourceColumnList']); + if (isset($_POST['SourceColumnList'])) $temp = safeUnserialize($_POST['SourceColumnList']); if (!isset($_POST['IndexColumnList']) || !is_array($_POST['IndexColumnList']) || sizeof($_POST['IndexColumnList']) == 0 || !isset($temp) || !is_array($temp) || sizeof($temp) == 0) addForeignKey(2, $lang['strfkneedscols']); else { $status = $data->addForeignKey($_POST['table'], $_POST['target']['schemaname'], $_POST['target']['tablename'], - unserialize($_POST['SourceColumnList']), $_POST['IndexColumnList'], $_POST['upd_action'], $_POST['del_action'], + safeUnserialize($_POST['SourceColumnList']), $_POST['IndexColumnList'], $_POST['upd_action'], $_POST['del_action'], $_POST['match'], $_POST['deferrable'], $_POST['initially'], $_POST['name']); if ($status == 0) doDefault($lang['strfkadded']); diff --git a/display.php b/display.php index 1a7817aff..46664495d 100644 --- a/display.php +++ b/display.php @@ -31,7 +31,7 @@ function doEditRow($confirm, $msg = '') { if (is_array($_REQUEST['key'])) $key = $_REQUEST['key']; else - $key = unserialize(urldecode($_REQUEST['key'])); + $key = safeUnserialize(urldecode($_REQUEST['key'])); if ($confirm) { $misc->printTrail($_REQUEST['subject']); @@ -238,7 +238,7 @@ function doDelRow($confirm) { echo "\n"; } else { - $status = $data->deleteRow($_POST['table'], unserialize(urldecode($_POST['key']))); + $status = $data->deleteRow($_POST['table'], safeUnserialize(urldecode($_POST['key']))); if ($status == 0) doBrowse($lang['strrowdeleted']); elseif ($status == -2) diff --git a/fulltext.php b/fulltext.php index 40910c8b3..564f8051c 100644 --- a/fulltext.php +++ b/fulltext.php @@ -264,9 +264,9 @@ function doSaveCreateConfig() { if ($err != '') return doCreateConfig($err); - if ($_POST['formParser'] != '') $formParser = unserialize($_POST['formParser']); + if ($_POST['formParser'] != '') $formParser = safeUnserialize($_POST['formParser']); else $formParser = ''; - if ($_POST['formTemplate'] != '') $formTemplate = unserialize($_POST['formTemplate']); + if ($_POST['formTemplate'] != '') $formTemplate = safeUnserialize($_POST['formTemplate']); else $formTemplate = ''; $status = $data->createFtsConfiguration($_POST['formName'], $formParser, $formTemplate, $_POST['formComment']); @@ -667,7 +667,7 @@ function doSaveCreateDict() { if(!isset($_POST['formIsTemplate'])) $_POST['formIsTemplate'] = false; if(isset($_POST['formTemplate'])) - $formTemplate = unserialize($_POST['formTemplate']); + $formTemplate = safeUnserialize($_POST['formTemplate']); else $formTemplate = ''; if(!isset($_POST['formLexize'])) $_POST['formLexize'] = ''; @@ -773,7 +773,7 @@ function doDropMapping($confirm) { if (isset($_REQUEST['ma'])) { foreach($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + $a = safeUnserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo "

", sprintf($lang['strconfdropftsmapping'], $misc->printVal($a['mapping']), $misc->printVal($_REQUEST['ftscfg'])), "

\n"; printf('', htmlspecialchars($a['mapping'])); } @@ -835,7 +835,7 @@ function doAlterMapping($msg = '') { $ma_mappings = array(); $ma_mappings_names = array(); foreach($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + $a = safeUnserialize(htmlspecialchars_decode($v, ENT_QUOTES)); printf('', htmlspecialchars($a['mapping'])); $ma_mappings[] = $data->getFtsMappingByName($_POST['ftscfg'], $a['mapping']); $ma_mappings_names[] = $a['mapping']; diff --git a/functions.php b/functions.php index 8dc0a11f0..516cce201 100644 --- a/functions.php +++ b/functions.php @@ -426,7 +426,7 @@ function doDrop($confirm) { //If multi drop if (isset($_REQUEST['ma'])) { foreach($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + $a = safeUnserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo "

", sprintf($lang['strconfdropfunction'], $misc->printVal($a['function'])), "

\n"; echo '\n"; echo "\n"; diff --git a/libraries/lib.inc.php b/libraries/lib.inc.php index d13405daf..c575a3059 100644 --- a/libraries/lib.inc.php +++ b/libraries/lib.inc.php @@ -286,3 +286,93 @@ } $plugin_manager = new PluginManager($_language); + + /** + * Safe unserializer wrapper + * + * It does not unserialize data containing objects + * + * Function from phpMyAdmin version 5.2.1 + * + * @param string $data Data to unserialize + * + * @return mixed|null + */ + function safeUnserialize(string $data) { + /* validate serialized data */ + $length = strlen($data); + $depth = 0; + for ($i = 0; $i < $length; $i++) { + $value = $data[$i]; + + switch ($value) { + case '}': + /* end of array */ + if ($depth <= 0) { + return null; + } + + $depth--; + break; + case 's': + /* string */ + // parse sting length + $strlen = intval(substr($data, $i + 2)); + // string start + $i = strpos($data, ':', $i + 2); + if ($i === false) { + return null; + } + + // skip string, quotes and ; + $i += 2 + $strlen + 1; + if ($data[$i] !== ';') { + return null; + } + + break; + + case 'b': + case 'i': + case 'd': + /* bool, integer or double */ + // skip value to separator + $i = strpos($data, ';', $i); + if ($i === false) { + return null; + } + + break; + case 'a': + /* array */ + // find array start + $i = strpos($data, '{', $i); + if ($i === false) { + return null; + } + + // remember nesting + $depth++; + break; + case 'N': + /* null */ + // skip to end + $i = strpos($data, ';', $i); + if ($i === false) { + return null; + } + + break; + default: + /* any other elements are not wanted */ + return null; + } + } + + // check unterminated arrays + if ($depth > 0) { + return null; + } + + return unserialize($data); + } diff --git a/schemas.php b/schemas.php index e0ae867ec..5a27f0c7d 100644 --- a/schemas.php +++ b/schemas.php @@ -274,7 +274,7 @@ function doDrop($confirm) { //If multi drop if (isset($_REQUEST['ma'])) { foreach($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + $a = safeUnserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo '

', sprintf($lang['strconfdropschema'], $misc->printVal($a['nsp'])), "

\n"; echo '\n"; } diff --git a/sequences.php b/sequences.php index d0c9bc71a..eae0bf321 100644 --- a/sequences.php +++ b/sequences.php @@ -297,18 +297,18 @@ function doDrop($confirm, $msg = '') { doDefault($lang['strspecifysequencetodrop']); exit(); } - + if ($confirm) { $misc->printTrail('sequence'); $misc->printTitle($lang['strdrop'],'pg.sequence.drop'); $misc->printMsg($msg); - + echo "
\n"; - + //If multi drop if (isset($_REQUEST['ma'])) { foreach($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + $a = safeUnserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo "

", sprintf($lang['strconfdropsequence'], $misc->printVal($a['sequence'])), "

\n"; printf('', htmlspecialchars($a['sequence'])); } diff --git a/tables.php b/tables.php index 40ab90717..68096dbee 100644 --- a/tables.php +++ b/tables.php @@ -330,7 +330,7 @@ function doCreateLike($confirm, $msg = '') { if (!isset($_REQUEST['tablespace'])) $_REQUEST['tablespace'] = ''; - $status = $data->createTableLike($_REQUEST['name'], unserialize($_REQUEST['like']), isset($_REQUEST['withdefaults']), + $status = $data->createTableLike($_REQUEST['name'], safeUnserialize($_REQUEST['like']), isset($_REQUEST['withdefaults']), isset($_REQUEST['withconstraints']), isset($_REQUEST['withindexes']), $_REQUEST['tablespace']); if ($status == 0) { @@ -563,7 +563,7 @@ function doInsertRow($confirm, $msg = '') { else { if (!isset($_POST['values'])) $_POST['values'] = array(); if (!isset($_POST['nulls'])) $_POST['nulls'] = array(); - $_POST['fields'] = unserialize(htmlspecialchars_decode($_POST['fields'], ENT_QUOTES)); + $_POST['fields'] = safeUnserialize(htmlspecialchars_decode($_POST['fields'], ENT_QUOTES)); if ($_SESSION['counter']++ == $_POST['protection_counter']) { $status = $data->insertRow($_POST['table'], $_POST['fields'], $_POST['values'], @@ -604,7 +604,7 @@ function doEmpty($confirm) { echo "\n"; foreach ($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + $a = safeUnserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo "

", sprintf($lang['strconfemptytable'], $misc->printVal($a['table'])), "

\n"; printf('', htmlspecialchars($a['table'])); } @@ -669,7 +669,7 @@ function doDrop($confirm) { echo "\n"; foreach($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + $a = safeUnserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo "

", sprintf($lang['strconfdroptable'], $misc->printVal($a['table'])), "

\n"; printf('', htmlspecialchars($a['table'])); } diff --git a/views.php b/views.php index d70a8edb4..4e5e7f25c 100644 --- a/views.php +++ b/views.php @@ -141,7 +141,7 @@ function doDrop($confirm) { //If multi drop if (isset($_REQUEST['ma'])) { foreach($_REQUEST['ma'] as $v) { - $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); + $a = safeUnserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo "

", sprintf($lang['strconfdropview'], $misc->printVal($a['view'])), "

\n"; echo '\n"; } @@ -214,9 +214,9 @@ function doSetParamsCreate($msg = '') { $misc->printMsg($msg); $tblCount = sizeof($_POST['formTables']); - //unserialize our schema/table information and store in arrSelTables + // Unserialize our schema/table information and store in arrSelTables for ($i = 0; $i < $tblCount; $i++) { - $arrSelTables[] = unserialize($_POST['formTables'][$i]); + $arrSelTables[] = safeUnserialize($_POST['formTables'][$i]); } $linkCount = $tblCount; @@ -446,7 +446,7 @@ function doSaveCreateWiz() { $tmpHsh = array(); foreach ($_POST['formFields'] as $curField) { - $arrTmp = unserialize($curField); + $arrTmp = safeUnserialize($curField); $data->fieldArrayClean($arrTmp); if (! empty($_POST['dblFldMeth']) ) { // doublon control if (empty($tmpHsh[$arrTmp['fieldname']])) { // field does not exist @@ -486,8 +486,8 @@ function doSaveCreateWiz() { while ($j < $count) { foreach ($arrLinks as $curLink) { - $arrLeftLink = unserialize($curLink['leftlink']); - $arrRightLink = unserialize($curLink['rightlink']); + $arrLeftLink = safeUnserialize($curLink['leftlink']); + $arrRightLink = safeUnserialize($curLink['rightlink']); $data->fieldArrayClean($arrLeftLink); $data->fieldArrayClean($arrRightLink); @@ -517,7 +517,7 @@ function doSaveCreateWiz() { //just select from all selected tables - a cartesian join do a if (!strlen($linkFields) ) { foreach ($_POST['formTables'] as $curTable) { - $arrTmp = unserialize($curTable); + $arrTmp = safeUnserialize($curTable); $data->fieldArrayClean($arrTmp); $linkFields .= strlen($linkFields) ? ", \"{$arrTmp['schemaname']}\".\"{$arrTmp['tablename']}\"" : "\"{$arrTmp['schemaname']}\".\"{$arrTmp['tablename']}\""; } @@ -527,7 +527,7 @@ function doSaveCreateWiz() { if (is_array($_POST['formCondition']) ) { foreach ($_POST['formCondition'] as $curCondition) { if (strlen($curCondition['field']) && strlen($curCondition['txt']) ) { - $arrTmp = unserialize($curCondition['field']); + $arrTmp = safeUnserialize($curCondition['field']); $data->fieldArrayClean($arrTmp); $addConditions .= strlen($addConditions) ? " AND \"{$arrTmp['schemaname']}\".\"{$arrTmp['tablename']}\".\"{$arrTmp['fieldname']}\" {$curCondition['operator']} '{$curCondition['txt']}' " : " \"{$arrTmp['schemaname']}\".\"{$arrTmp['tablename']}\".\"{$arrTmp['fieldname']}\" {$curCondition['operator']} '{$curCondition['txt']}' "; From ca494f6bbf1c99079a29a582c826aae0a1c2ff0f Mon Sep 17 00:00:00 2001 From: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com> Date: Mon, 18 Sep 2023 09:21:40 +0200 Subject: [PATCH 6/6] Update version --- composer.lock | 2 +- libraries/lib.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.lock b/composer.lock index e8ff962a5..bb8a17de7 100644 --- a/composer.lock +++ b/composer.lock @@ -80,5 +80,5 @@ "ext-mbstring": "*" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/libraries/lib.inc.php b/libraries/lib.inc.php index c575a3059..bdccacc55 100644 --- a/libraries/lib.inc.php +++ b/libraries/lib.inc.php @@ -16,7 +16,7 @@ $appName = 'phpPgAdmin'; // Application version - $appVersion = '7.14.5-hestiacp'; + $appVersion = '7.14.6-hestiacp'; // PostgreSQL and PHP minimum version global $postgresqlMinVer;
{$lang['strname']}