start QA_11

This commit is contained in:
Marc Delisle
2007-07-18 15:55:11 +00:00
parent e2599e32c5
commit 609d38a9cd
689 changed files with 212947 additions and 0 deletions

9
CREDITS Normal file
View File

@@ -0,0 +1,9 @@
$Id$
phpMyAdmin - Credits
====================
Please have a look to the Documentation.txt or
Documentation.html files.

362
ChangeLog Normal file
View File

@@ -0,0 +1,362 @@
----------------------
phpMyAdmin - ChangeLog
----------------------
$Id$
$HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyAdmin/ChangeLog $
+ [import] support handling of DELIMITER to mimic mysql CLI, thanks to fb1
+ improved PHP 6 compatibility
- bug #1674914 [structure] changing definition of a TIMESTAMP field
- bug #1615530 [upload] added more specific error message if field upload fails
- bug #1627210, #1083301, #1482401 [data] warning on duplicate indexes
- bug #1668724 JavaScript focus login Opera
- bug #1666657 [auth] Cookie password delete on timeout / inactivity
- bug #1648802 different mysql library and server version
- bug #1662976 [auth] Authentication fails when controluser/pass is set
- bug #1643758 [import] Error #1264 importing NULL values in MySQL 5.0
- bug #1523747 [innodb] make warning about row count more visible
- bug #1676012 [auth] strip non-US-ASCII characters (RFC2616)
- bug #1679440 Added FAQ entry about header errors under IIS caused by
an end-of-line character
- [gui] avoid displaying a wide selector in server selection
- bug #1614004 [relation] foreign key spanning multiple columns are
incorrectly displayed
- bug #1681598 [interface] Edit next row
- bug #1688053 [export] Wrong export of binary character fields
- bug #1498281 [parser] Wrong primary key used for displaying results
with subquery
- bug #1699772 Visual space bug in table name (in browser)
- bug #1699532 Cause of data manipulation issues: implemented changes
as suggested by crisp_; still have to work on updating an ENUM value
+ [core] added PMA_fatalError() and made use of it
. [core] added PMA_isValid() and PMA_ifSetOr() for variable handling
. [i18n] use generic $strOptions
. [core] get rid of $propicon
. [core] globalized variables to be includable inside function in
libraries/select_lang.lib.php
+ [doc] changed all documentation in config.inc.php to phpDocumentor style
+ [data] support for CREATE VIEW from query results
+ [gui] dropped css/ folder and moved into root of PMA
+ [l10n] new: Sinhala, Macedonian
+ [export] YAML export (see yaml.org), thanks to Bryce Thornton
+ [upload] moved file upload functionality into own class
+ [upload] make use of $cfg['TempDir'] for file uploads
+ [server] improved display of binary logs
+ [data] better error handling in tbl_create.php
+ [routines] from Patch #1649881, thanks to Mike Beck
+ [querywindow] store sql history in session
+ [querywindow] sql history now without db too
+ [querywindow] tweaks in sql history view
+ [export] Native Excel (Spreadsheet_Excel_Writer) improvements,
thanks to Christian Schmidt
+ [doc] requirement of mcrypt on 64-bit, thanks to Isaac Bennetch
+ [lang] Danish update, thanks to Finn Sorensen
+ RFE #1435922 [gui] navigation frame shows listing of databases when none selected
+ [data] support BIT datatype (under mysqli), thanks to Christian Schmidt
+ [display] automatic confirmation for sort by key, thanks to Juergen Wind
+ [data] can now choose the number of insert rows
+ RFE #1704779 [gui] link documentation from login page
+ RFE #1513345 [setup] check control user connection during setup
+ [structure] TRIGGERS: display/edit/drop/SQL export
+ [browse] store browse state in session per query
+ [lang] Turkish update, thanks to Burak Yavuz
+ [lang] Galician update, thanks to Xosé Calvo
+ [lang] Brazilian-Portuguese update, thanks to Airon Luis Pereira
+ [gui] Insert/Edit: no longer display the Go button each 15 lines
but just at the end of a row
+ [gui] Query window: use verbose server name if any
+ [auth] patch #1712514 specify host for single signon, thanks to Thierry
+ [gui] Navigator for the db list in the navigation panel
+ [gui] Navigator for the table list in the content panel
- bug #1727138 HTML not encoded (more than 1000 characters)
+ [display] Support for MySQL 5.0.37 profiling
+ RFE #1743983 [gui] Replace $max_characters by a configurable param:
$cfg['MaxCharactersInDisplayedSQL']
- bug #1746186 LeftLogoLink fails if set to some external site
. [transformations]: remove "auto-detect" MIME-type that was never implemented
+ [display] patch #1749705, Allow multibyte characters in number formatting,
thanks to garas
- bug #1747215 Export emits blanks at line ends
- bug #1751172 Do not export data when exporting a single VIEW
+ [lang] Swedish update, thanks to Björn T. Hallberg
+ [lang] Russian update, thanks to Victor Volkov and the php-myadmin.ru users
+ [privileges] Support password hashing on the Edit Privileges interface
2.10.3.0 (not yet released)
- bug #1734285 Copy database with VIEWs
- bug #1722502 DROP TABLE in export VIEW
- bug #1729027 Sorting results of VIEW browsing
- bug #1733012 Unwanted table alias in delete button
- bug #1736405 Pretty printer and HTML line breaks
- bug #1745257 Invalid DB name is still displayed
- bug #1730367 Calendar "Go" has no effect
- patch #1750500 Smaller file for favicon.ico, thanks to Thijs Kinkhorst
- bug #1748633 Incorrect parameter validation for VIEWs
+ [lang] Russian revision, thanks to Victor Volkov and the users of
php-myadmin.ru
- Do not try to delete an internal relation if we just deleted an InnoDB one
2.10.2.0 (2007-06-15)
+ [data] display all warnings, not only last one
- typo in fix for bug #1671813
- bug #1714908 Inserted Row Count is wrong
- bug #1712570 Deleting last record freezes
- bug #1717339 Missing header when deleting a checked column,
thanks to Michael Keck
- bug #1717477 Warning on Query page when db is empty
- bug #1721002 db rename -> undefined cfgRelation, thanks to Jürgen Wind
- bug #1721571 CREATE database privilege not always detected,
thanks to Gordon McNaughton
- bug #1715709 export in SQL format always includes procedures and functions
- bug #1722502 DROP TABLE in export view structure
- bug #1718787 Multi-server setup breaks Designer
- bug #1724401 Column truncation in repair table output
- patch #1726500 Wrong position of </tbody>, thanks to Jürgen Wind
- bug #1728590 Detected failing session_start fails, thanks to Jürgen Wind
- RFE #1714760 Obey ShowCreateDb on the Databases tab
- patch #1733762 Typo in message "INSERT DELAY", thanks to Victor Volkov
- patch #1730171 Dead message strLanguageFileNotFound, thanks to Victor Volkov
- patch #1731280 Avoid negative exponent in gmp_pow(), thanks to anosek
2.10.1.0 (2007-04-23)
=====================
- bug #1541147 [js] '#' in database names not correctly handled by queywindow.js
- bug #1671403 [parser] using "client" as table name
- bug #1672379 [core] Call to undefined function PMA_removeCookie()
- bug [core] undefined variable in libraries/tbl_replace_fields.inc.php
- bug [gui] query window icon did not work, thanks to Jürgen Wind - windkiel
. [general] use PMA_getenv('PHP_SELF')
- bug #1676033 [core] pow(int,int) causes overflow
- bug #1680952 [core] undefined function PMA_getUvaCondition()
- bug #1596328 [export] drop support for POSTGRESQL compatibility mode
- bug #1609443 [privileges] Grant all priv. on wildcard name (fix message)
- bug #1567317 [sqp] Syntax highlighter: extra spaces
- bug #1239401 [sqp] table dot numeric field name
- bug #1672789 [sqp] Undefined offset: 4 in sqlparser.lib.php #1674
- bug #1682044 [export] Export file even if file not selected
- bug #1664212 querywindow loses url encoded characters
- replaced ctype_digit() with is_numeric()
+ [config] clean cookies on phpMyAdmin upgrade
- bug #1674972 [export] no export with %afm%
- bug #1667887 HTML maxlength
- bug #1679055 #1050 - Table '<table name>' already exists
- patch #1681620 [interface] support reordering of $cfg['ColumnTypes'],
thanks to Leonard den Ottolander
- bug #1690718 Can't edit if BLOB and no PK
- bug #1672636 [export] PDF export too wide
+ [lang] brazilian-portuguese update, thanks to Airon Luis Pereira
- patch #1698964 javascript typo, thanks to Corey Hollaway
- bug #1703897 [css] undefined index 'js_frame'
- bug #1690561 Blobs being cleared on Edit of row
- bug #1679801 [core] XSS vulnerability in PMA_sanitize(), thanks to sp3x SecurityReason
- bug #1704467 XSS vulnerability in browse_foreigners.php, thanks to sp3x SecurityReason
2.10.0.2 (2007-03-02)
=====================
+ bug #1671813 CVE-2006-1549 deep recursion crash
2.10.0.1 (2007-03-01)
=====================
. [config] set $cfg['Servers'][$i]['ssl'] default value to false,
we got reports from some users having problems with the default value of true
2.10.0.0 (2007-02-28)
=====================
- bug #1659176 [general] memory error displaying a table with large BLOBs
- bug #1668662 [install] can create the new pma_designer_coords table
+ [gui] navi logo now links to main page by default, with still the possibility
of having an external URL
2007-02-25 Marc Delisle <lem9@users.sourceforge.net>
* libraries/common.lib.php: bug #1667466, undefined variable when
export + save on server
* server_status.php: bug #1665930, undefined PHP_SELF
2007-02-24 Marc Delisle <lem9@users.sourceforge.net>
* libraries/config.default.php: RFE #1621437, HEX and UNHEX were not
available for a BINARY field
2007-02-21 Marc Delisle <lem9@users.sourceforge.net>
* pmd/scripts/move.js: bug #1650770, Designer and Mac OSX,
thanks to Ivan Kirillov
2007-02-17 Marc Delisle <lem9@users.sourceforge.net>
* Documentation.html: patch #1659347, missing doc for some config,
thanks to Isaac Bennetch
* libraries/export/sql.php: bug #1663336, undefined variable
2007-02-16 Marc Delisle <lem9@users.sourceforge.net>
* libraries/common.lib.php, footer.inc.php: avoid generating big links
after an upload into a BLOB
2007-02-14 Marc Delisle <lem9@users.sourceforge.net>
* libraries/common.lib.php: white page after uploading a 700 Kio BLOB
* add a warning on main page if mcrypt can't be loaded (bug 1658160)
2007-02-12 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* libraries/database_interface.lib.php: bug #1616486 server_databases does
not show all databases
* libraries/sqlparser.data.php: MySQL function and column names, reserved
and forbidden words updated,
bug #1657045 Spatial functions not supported
bug #1657037 Missing column type "geometry"
2007-02-09 Marc Delisle <lem9@users.sourceforge.net>
* main.php: some links should open a new page
* Documentation.html, libraries/navigation_header.inc.php,
libraries/config.default.php: $cfg['LeftLogoLinkWindow'] to decide
in which window the logo-linked page will appear
2007-02-09 Michal Čihař <michal@cihar.com>
* lang/czech: Fix syntax error (sorry for that).
2007-02-08 Marc Delisle <lem9@users.sourceforge.net>
* themes/darkblue_orange/img/logo_left.png,
themes/original/img/logo_left.png: smaller PMA logo for navi
2007-02-08 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* themes/*/css/theme_right.css.php: bug #1653769 browsing highlight disabling
doesn't work
2007-02-06 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* pmd_general.php, pmd_pdf.php, pmd_save_pos.php: fixed short open tags
patch #1652886 thanks to Martin Thielecke - mthie
* tbl_change.php: fixed escaping of field names in HTML and JavaScript
* libraries/common.lib.php: PMA_backquote() did not quote 0
* tbl_change.php: bug #1652810 - slashes are not escaped properly
2007-02-05 Marc Delisle <lem9@users.sourceforge.net>
* lang/japanese: Update, thanks to Ishigaki Kenichi - tcool.
2007-02-05 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* lang/german: updated
2007-02-03 Marc Delisle <lem9@users.sourceforge.net>
* pmd/scripts/move.js: display problems in Opera, thanks to Maxim Bulygin
2007-02-02 Marc Delisle <lem9@users.sourceforge.net>
* tbl_replace.php: Calendar icon does not work on "Insert another new row"
2007-02-01 Marc Delisle <lem9@users.sourceforge.net>
* libraries/import.lib.php: bug #1626064, too much quoting on import
2007-02-01 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* libraries/display_tbl.lib.php: bug #1644740 - $cfg['Order'] = 'SMART'
overwritten
* libraries/Theme.class.php: removed __wakeup() due to some requirements are
not fulfilled at this point - also thanks to Jürgen Wind - windkiel
2007-01-31 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* libraries/session.inc.php:
bug #1630871 - Detecting a missing write permission on sessions directory
2007-01-30 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* libraries/sqlparser.lib.php PMA_SQP_analyze():
bug #1647785 - do not pass variables by reference
2007-01-29 Marc Delisle <lem9@users.sourceforge.net>
* lang/catalan update, thanks to Xavier Navarro (xavin)
* pmd_general.php: possibility of quotes in Designer messages,
thanks to Ivan Kirillov
2007-01-26 Michal Čihař <michal@cihar.com>
* libraries/common.lib.php, libraries/js_escape.lib.php,
test/escape_js_string.php, test/core.lib.php: Move java script escaping
to separate library, make it safer on </script> escaping and add
testcase for it.
* test/theme.php: Move to test package.
2007-01-22 Marc Delisle <lem9@users.sourceforge.net>
* pmd/*: button for direct/angular links, thanks to Ivan Kirillov
2007-01-22 Michal Čihař <michal@cihar.com>
* lang/czech: Updated.
2007-01-21 Marc Delisle <lem9@users.sourceforge.net>
* libraries/Table.class.php: on a MySQL 5.0.33 server with 4400 databases,
one of which having 400 tables, it took more than 3 minutes just to
see the database structure (some accesses to INFORMATION_SCHEMA are
just too slow) so I changed PMA_Table::isView() to avoid calling
INFORMATION_SCHEMA
2007-01-20 Marc Delisle <lem9@users.sourceforge.net>
* libraries/sqlparser.lib.php: bug #1638267, wrong reserved word
recognition
* server_privileges.php: bug #1635377, superfluous backslash,
thanks to Hanut
2007-01-19 Marc Delisle <lem9@users.sourceforge.net>
* pmd*, lang/*: Designer now supports set/unset of the display field,
thanks to Ivan Kirillov
2007-01-18 Michal Čihař <michal@cihar.com>
* lang/czech: Updated.
* libraries/auth/cookie.auth.lib.php: Make server switching honour more
server settings (patch #1630104).
2007-01-17 Marc Delisle <lem9@users.sourceforge.net>
* lang/turkish: update, thanks to Burak Yavuz - bourock
2007-01-16 Marc Delisle <lem9@users.sourceforge.net>
### 2.9.2 released from QA_2_9
2007-01-12 Marc Delisle <lem9@users.sourceforge.net>
* (many files): Designer, two features (snap to grid / display field)
thanks to Ivan Kirillov
* libraries/Theme_Manager.class.php: patch #1611684, force a change
of a session variable to avoid phpmyadmin.css.php caching problems,
thanks to Christian Schmidt
2007-01-11 Marc Delisle <lem9@users.sourceforge.net>
* lang/estonian: Update, thanks to Marko Ellermaa - uhuu
2007-01-09 Michal Čihař <michal@cihar.com>
* index.php: Properly escape strings written in JS code.
* libraries/Theme_Manager.class.php: Avoid trigger error here, parameter
comes from user and it might lead to path disclossure.
* libraries/common.lib.php:
- Properly escape </script> in JS code.
- Check db, table and sql_query params to be string.
2007-01-08 Marc Delisle <lem9@users.sourceforge.net>
* libraries/session.inc.php: prevent attack on session name cookie
2007-01-05 Marc Delisle <lem9@users.sourceforge.net>
* libraries/session.inc.php: bug #1538132, remove the setting of
session.save_handler to 'files'
* pmd_general.php: patch #1627831,
English language improvements, thanks to Isaac Bennetch
* pmd_general.php, pmd_relation_new.php, lang/*: abstract messages
2007-01-04 Marc Delisle <lem9@users.sourceforge.net>
* pmd/scripts/move.js: avoid text selection when moving a table object
under MSIE 6, thanks to Ivan Kirillov
* libraries/db_links.inc.php: better icon for Designer, thanks to I.K.
2007-01-02 Marc Delisle <lem9@users.sourceforge.net>
* Designer: various fixes and improvements (for example support
for MSIE 6), thanks to Ivan Kirillov
* pdf_pages.php: undefined $pdf_page_number when no auto layout
* server_privileges.php: bug #1614087, deleting a user having a
global GRANT privilege fails under MySQL 4.1.x
2007-01-02 Michal Čihař <michal@cihar.com>
* libraries/common.lib.php: Add <div> to allow selecting whole SQL by
tripple click (patch #1611591).
* libraries/export/sql.php: DELIMITER should not be commented out (bug
#1612870).
--- Older ChangeLogs can be found on our project website ---
http://www.phpmyadmin.net/old-stuff/ChangeLogs/
# vim: et ts=4 sw=4 sts=4
# vim: ft=changelog fenc=utf-8 encoding=utf-8
# vim: fde=getline(v\:lnum-1)=~'^\\s*$'&&getline(v\:lnum)=~'\\S'?'>1'\:1&&v\:lnum>8&&getline(v\:lnum)!~'^#'
# vim: fdn=1 fdm=expr

4396
Documentation.html Normal file

File diff suppressed because it is too large Load Diff

9
INSTALL Normal file
View File

@@ -0,0 +1,9 @@
$Id$
phpMyAdmin - Installation
-------------------------
Please have a look to the Documentation.txt or
Documentation.html files.

340
LICENSE Normal file
View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, 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 Library 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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 St, 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.
<signature of Ty Coon>, 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 Library General
Public License instead of this License.

74
README Normal file
View File

@@ -0,0 +1,74 @@
$Id$
phpMyAdmin - Readme
===================
A set of PHP-scripts to manage MySQL over the web.
Version 2.11.0-dev
------------------
http://www.phpmyadmin.net/
Copyright (C) 1998-2000 Tobias Ratschiller <tobias_at_ratschiller.com>
Copyright (C) 2001-2006 Marc Delisle <DelislMa_at_CollegeSherbrooke.qc.ca>
Olivier Müller <om_at_omnis.ch>
Robin Johnson <robbat2_at_users.sourceforge.net>
Alexander M. Turek <me_at_derrabus.de>
Michal Čihař <michal_at_cihar.com>
Garvin Hicking <me_at_supergarv.de>
Michael Keck <mkkeck_at_users.sourceforge.net>
Sebastian Mendel <cybot_tm_at_users.sourceforge.net>
[check Documentation.txt/.html file for more details]
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2,
as published by the Free Software Foundation.
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 St, Fifth Floor, Boston, MA 02110-1301 USA
Requirements:
php 4.1.0 or later
MySQL 3.23.32 or later
a web-browser (doh!)
Summary:
phpMyAdmin is intended to handle the administration of MySQL over the web.
For a summary of features, please see the Documentation.txt/.html file.
Download:
You can get the newest version at http://www.phpmyadmin.net/.
Credits:
Please see the Documentation.txt/.html file.
Installation:
Please see the Documentation.txt/.html file.
ChangeLog:
Now in ChangeLog
Documentation:
Basic documentation available in Documentation.txt/.html
Support:
See reference about support forums under http://www.phpmyadmin.net/
Enjoy!
The phpMyAdmin Devel team
PS: Please, don't send us emails with question like "How do I compile
PHP with MySQL-support". We just don't have the time to be your
free helpdesk.
Please send your questions to the appropriate mailinglists / forums.
Before contacting us, please read the Documentation.html (esp. the
FAQ part).

10
TODO Normal file
View File

@@ -0,0 +1,10 @@
$Id$
phpMyAdmin - Todo
=================
We are currently using the Sourceforge Tracker as Todo list:
http://sourceforge.net/tracker/?atid=377411&group_id=23067&func=browse
-- swix/20010704

303
browse_foreigners.php Normal file
View File

@@ -0,0 +1,303 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* display selection for relational field values
*
* @version $Id$
*/
/**
* Gets a core script and starts output buffering work
*/
require_once './libraries/common.inc.php';
PMA_checkParameters(array('db', 'table', 'field'));
require_once './libraries/ob.lib.php';
PMA_outBufferPre();
require_once './libraries/header_http.inc.php';
$field = urldecode($field);
/**
* Displays the frame
*/
$per_page = 200;
require_once './libraries/relation.lib.php'; // foreign keys
require_once './libraries/transformations.lib.php'; // Transformations
$cfgRelation = PMA_getRelationsParam();
$foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE);
$override_total = TRUE;
if (!isset($pos)) {
$pos = 0;
}
$foreign_limit = 'LIMIT ' . $pos . ', ' . $per_page . ' ';
if (isset($foreign_navig) && $foreign_navig == $strShowAll) {
unset($foreign_limit);
}
require './libraries/get_foreign.lib.php';
if (isset($pk)) {
$pk_uri = '&amp;pk=' . urlencode($pk);
?>
<input type="hidden" name="pk" value="<?php echo urlencode($pk); ?>" />
<?php
} else {
$pk_uri = '';
}
$gotopage = '';
$showall = '';
// $the_total comes from get_foreign.lib.php
if (isset($disp_row) && is_array($disp_row)) {
if ($cfg['ShowAll'] && ($the_total > $per_page)) {
$showall = '<input type="submit" name="foreign_navig" value="' . $strShowAll . '" />';
}
$session_max_rows = $per_page;
$pageNow = @floor($pos / $session_max_rows) + 1;
$nbTotalPage = @ceil($the_total / $session_max_rows);
if ($the_total > $per_page) {
$gotopage = PMA_pageselector(
'browse_foreigners.php?field=' . urlencode($field) .
'&amp;' . PMA_generate_common_url($db, $table)
. $pk_uri .
'&amp;fieldkey=' . (isset($fieldkey) ? $fieldkey : '') .
'&amp;foreign_filter=' . (isset($foreign_filter) ? htmlspecialchars($foreign_filter) : '') .
'&amp;',
$session_max_rows,
$pageNow,
$nbTotalPage,
200,
5,
5,
20,
10,
$GLOBALS['strPageNumber']
);
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="<?php echo $available_languages[$lang][2]; ?>"
lang="<?php echo $available_languages[$lang][2]; ?>"
dir="<?php echo $text_dir; ?>">
<head>
<title>phpMyAdmin</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
<link rel="stylesheet" type="text/css"
href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&amp;js_frame=right&amp;nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" />
<script src="./js/functions.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
self.focus();
function formupdate(field, key) {
if (opener && opener.document && opener.document.insertForm) {
var field = 'field_' + field;
<?php if (isset($pk)) { ?>
var element_name = field + '[multi_edit][<?php echo urlencode($pk); ?>][]';
<?php } else { ?>
var element_name = field + '[]';
<?php } ?>
<?php if (isset($fieldkey) && is_numeric($fieldkey)) { ?>
var element_name_alt = field + '[<?php echo $fieldkey; ?>]';
<?php } else { ?>
var element_name_alt = field + '[0]';
<?php } ?>
if (opener.document.insertForm.elements[element_name]) {
// Edit/Insert form
opener.document.insertForm.elements[element_name].value = key;
self.close();
return false;
} else if (opener.document.insertForm.elements[element_name_alt]) {
// Search form
opener.document.insertForm.elements[element_name_alt].value = key;
self.close();
return false;
}
}
alert('<?php echo PMA_jsFormat($strWindowNotFound); ?>');
}
//]]>
</script>
</head>
<body id="body_browse_foreigners">
<form action="browse_foreigners.php" method="post">
<fieldset>
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="field" value="<?php echo urlencode($field); ?>" />
<input type="hidden" name="fieldkey"
value="<?php echo isset($fieldkey) ? $fieldkey : ''; ?>" />
<?php if (isset($pk)) { ?>
<input type="hidden" name="pk" value="<?php echo urlencode($pk); ?>" />
<?php } ?>
<span class="formelement">
<label for="input_foreign_filter"><?php echo $strSearch . ':'; ?></label>
<input type="text" name="foreign_filter" id="input_foreign_filter"
value="<?php echo isset($foreign_filter) ? htmlspecialchars($foreign_filter) : ''; ?>" />
<input type="submit" name="submit_foreign_filter" value="<?php echo $strGo;?>" />
</span>
<span class="formelement">
<?php echo $gotopage; ?>
</span>
<span class="formelement">
<?php echo $showall; ?>
</span>
</fieldset>
</form>
<table width="100%">
<?php
if (isset($disp_row) && is_array($disp_row)) {
$header = '<tr>
<th>' . $strKeyname . '</th>
<th>' . $strDescription . '</th>
<td width="20%"></td>
<th>' . $strDescription . '</th>
<th>' . $strKeyname . '</th>
</tr>';
echo '<thead>' . $header . '</thead>' . "\n"
.'<tfoot>' . $header . '</tfoot>' . "\n"
.'<tbody>' . "\n";
$values = array();
$keys = array();
foreach ($disp_row as $relrow) {
if ($foreign_display != FALSE) {
$values[] = $relrow[$foreign_display];
} else {
$values[] = '';
}
$keys[] = $relrow[$foreign_field];
}
asort($keys);
$hcount = 0;
$odd_row = true;
$val_ordered_current_row = 0;
$val_ordered_current_equals_data = false;
$key_ordered_current_equals_data = false;
foreach ($keys as $key_ordered_current_row => $value) {
//for ($i = 0; $i < $count; $i++) {
$hcount++;
if ($cfg['RepeatCells'] > 0 && $hcount > $cfg['RepeatCells']) {
echo $header;
$hcount = 0;
$odd_row = true;
}
$key_ordered_current_key = $keys[$key_ordered_current_row];
$key_ordered_current_val = $values[$key_ordered_current_row];
$val_ordered_current_key = $keys[$val_ordered_current_row];
$val_ordered_current_val = $values[$val_ordered_current_row];
$val_ordered_current_row++;
if (PMA_strlen($val_ordered_current_val) <= $cfg['LimitChars']) {
$val_ordered_current_val = htmlspecialchars($val_ordered_current_val);
$val_ordered_current_val_title = '';
} else {
$val_ordered_current_val_title =
htmlspecialchars($val_ordered_current_val);
$val_ordered_current_val =
htmlspecialchars(PMA_substr($val_ordered_current_val, 0,
$cfg['LimitChars']) . '...');
}
if (PMA_strlen($key_ordered_current_val) <= $cfg['LimitChars']) {
$key_ordered_current_val = htmlspecialchars($key_ordered_current_val);
$key_ordered_current_val_title = '';
} else {
$key_ordered_current_val_title =
htmlspecialchars($key_ordered_current_val);
$key_ordered_current_val =
htmlspecialchars(PMA_substr($key_ordered_current_val, 0,
$cfg['LimitChars']) . '...');
}
if (! empty($data)) {
$val_ordered_current_equals_data = $val_ordered_current_key == $data;
$key_ordered_current_equals_data = $key_ordered_current_key == $data;
}
?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
<td nowrap="nowrap">
<?php
echo ($key_ordered_current_equals_data ? '<b>' : '')
.'<a href="#" title="' . $strUseThisValue
. ($key_ordered_current_val_title != '' ? ': ' . $key_ordered_current_val_title : '') . '"'
.' onclick="formupdate(\'' . md5($field) . '\', \''
. htmlspecialchars($key_ordered_current_key) . '\'); return false;">'
.htmlspecialchars($key_ordered_current_key) . '</a>' . ($key_ordered_current_equals_data ? '</b>' : '');
?></td>
<td>
<?php
echo ($key_ordered_current_equals_data ? '<b>' : '')
. '<a href="#" title="' . $strUseThisValue . ($key_ordered_current_val_title != '' ? ': '
. $key_ordered_current_val_title : '') . '" onclick="formupdate(\''
. md5($field) . '\', \'' . htmlspecialchars($key_ordered_current_key) . '\'); return false;">'
. $key_ordered_current_val . '</a>' . ($key_ordered_current_equals_data ? '</b>' : '');
?></td>
<td width="20%">
<img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>"
alt="" width="1" height="1"></td>
<td>
<?php
echo ($val_ordered_current_equals_data ? '<b>' : '')
. '<a href="#" title="' . $strUseThisValue . ($val_ordered_current_val_title != '' ? ': '
. $val_ordered_current_val_title : '') . '" onclick="formupdate(\'' . md5($field)
. '\', \'' . htmlspecialchars($val_ordered_current_key) . '\'); return false;">'
. $val_ordered_current_val . '</a>' . ($val_ordered_current_equals_data ? '</b>' : '');
?></td>
<td nowrap="nowrap">
<?php
echo ($val_ordered_current_equals_data ? '<b>' : '') . '<a href="#" title="'
. $strUseThisValue . ($val_ordered_current_val_title != '' ? ': ' . $val_ordered_current_val_title : '')
. '" onclick="formupdate(\'' . md5($field) . '\', \''
. htmlspecialchars($val_ordered_current_key) . '\'); return false;">' . htmlspecialchars($val_ordered_current_key)
. '</a>' . ($val_ordered_current_equals_data ? '</b>' : '');
?></td>
</tr>
<?php
} // end while
}
?>
</tbody>
</table>
</body>
</html>
<?php
/**
* Close MySql connections
*/
if (isset($controllink) && $controllink) {
@PMA_DBI_close($controllink);
}
if (isset($userlink) && $userlink) {
@PMA_DBI_close($userlink);
}
?>

29
calendar.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @version $Id$
*/
/**
*
*/
require_once './libraries/common.inc.php';
require_once './libraries/header_http.inc.php';
$page_title = $strCalendar;
require './libraries/header_meta_style.inc.php';
?>
<script type="text/javascript" src="./js/tbl_change.js"></script>
<script type="text/javascript">
//<![CDATA[
var month_names = new Array("<?php echo implode('","', $month); ?>");
var day_names = new Array("<?php echo implode('","', $day_of_week); ?>");
var submit_text = "<?php echo $strGo . ' (' . $strTime . ')'; ?>";
//]]>
</script>
</head>
<body onload="initCalendar();">
<div id="calendar_data"></div>
<div id="clock_data"></div>
</body>
</html>

87
changelog.php Normal file
View File

@@ -0,0 +1,87 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Simple script to set correct charset for changelog
*
* @version $Id$
*/
$changelog = htmlspecialchars(file_get_contents('ChangeLog'));
$replaces = array(
'@(http://[./a-zA-Z0-9.-]*[/a-zA-Z0-9])@'
=> '<a href="\\1">\\1</a>',
// sourceforge users
'/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*)@users.sourceforge.net&gt;/i'
=> '\\1 <a href="https://sourceforge.net/users/\\3/">\\2</a>',
'/thanks to ([^\(\r\n]+) \(([-\w]+)\)/i'
=> 'thanks to <a href="https://sourceforge.net/users/\\2/">\\1</a>',
'/thanks to ([^\(\r\n]+) -\s+([-\w]+)/i'
=> 'thanks to <a href="https://sourceforge.net/users/\\2/">\\1</a>',
// mail adresse
'/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*@.*)&gt;/i'
=> '\\1 <a href="mailto:\\3">\\2</a>',
// linking patches
'/patch\s*#?([0-9]{6,})/i'
=> '<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=\\1&amp;group_id=23067&amp;atid=377410">patch #\\1</a>',
// linking RFE
'/(?:rfe|feature)\s*#?([0-9]{6,})/i'
=> '<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=\\1&amp;group_id=23067&amp;atid=377411">RFE #\\1</a>',
// linking files
'/(\s+)([\\/a-z_0-9\.]+\.(?:php3?|html|pl|js|sh))/i'
=> '\\1<a href="http://svn.sourceforge.net/viewvc/phpmyadmin/trunk/phpMyAdmin/\\2?annotate=HEAD">\\2</a>',
// FAQ entries
'/FAQ ([0-9]+)\.([0-9a-z]+)/i'
=> '<a href="http://localhost/phpMyAdmin/Documentation.html#faq\\1_\\2">FAQ \\1.\\2</a>',
// linking bugs
'/bug\s*#?([0-9]{6,})/i'
=> '<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=\\1&amp;group_id=23067&amp;atid=377408">bug #\\1</a>',
// all other 6+ digit numbers are treated as bugs
'/(?<!BUG|RFE|patch) #?([0-9]{6,})/i'
=> ' <a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=\\1&amp;group_id=23067&amp;atid=377408">bug #\\1</a>',
// CVE/CAN entries
'/((CAN|CVE)-[0-9]+-[0-9]+)/'
=> '<a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>',
// Highlight releases (with links)
'/(( ### )(([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+) (.*)))/'
=> '<a name="\\4_\\5_\\6_\\7"></a>\\2<a href="http://svn.sourceforge.net/viewvc/phpmyadmin/tags/RELEASE_\\4_\\5_\\6_\\7/phpMyAdmin">\\4.\\5.\\6.\\7 \\8</a>',
'/(( ### )(([0-9]+)\.([0-9]+)\.([0-9]+) (.*)))/'
=> '<a name="\\4_\\5_\\6_\\7"></a>\\2<a href="http://svn.sourceforge.net/viewvc/phpmyadmin/tags/RELEASE_\\4_\\5_\\6/phpMyAdmin">\\4.\\5.\\6 \\7</a>',
// Highlight releases (not linkable)
'/( ### )(.*)/'
=> '\\1<b>\\2</b>',
);
header('Content-type: text/html; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?'.'>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<title>phpMyAdmin - ChangeLog</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>phpMyAdmin - ChangeLog</h1>
<?php
echo '<pre>';
echo preg_replace(array_keys($replaces), $replaces, $changelog);
echo '</pre>';
?>
</body>
</html>

26
chk_rel.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @version $Id$
*/
/**
* Gets some core libraries
*/
require_once './libraries/common.inc.php';
require_once './libraries/db_common.inc.php';
require_once './libraries/relation.lib.php';
/**
* Gets the relation settings
*/
$cfgRelation = PMA_getRelationsParam(TRUE);
/**
* Displays the footer
*/
require_once './libraries/footer.inc.php';
?>

60
config.sample.inc.php Normal file
View File

@@ -0,0 +1,60 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* phpMyAdmin sample configuration, you can use it as base for
* manual configuration. For easier setup you can use scripts/setup.php
*
* All directives are explained in Documentation.html and on phpMyAdmin
* wiki <http://wiki.cihar.com>.
*
* @version $Id$
*/
/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
/*
* Servers configuration
*/
$i = 0;
/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';
/* User for advanced features */
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Advanced phpMyAdmin features */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma_relation';
// $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
// $cfg['Servers'][$i]['history'] = 'pma_history';
// $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
/*
* End of servers configuration
*/
/*
* Directories for saving/loading files from server
*/
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>

12
contrib/README Normal file
View File

@@ -0,0 +1,12 @@
$Id$
This directory contains various stuff contributed by users that might be
useful to other. There is no guarantee it will work for you.
Current content of this directory:
packaging - Contains files needed for creating packages for various
distributions. Please prefer official packages from your vendor if
possible.
vim: expandtab ts=4 sw=4 sts=4 tw=78

View File

@@ -0,0 +1,12 @@
#
# MySQL server administration.
#
Alias /phpMyAdmin /var/www/myadmin
<Directory /var/www/myadmin>
DirectoryIndex index.php
Options Indexes Includes ExecCGI
AllowOverride None
Order deny,allow
Allow from all
</Directory>

View File

@@ -0,0 +1,163 @@
%define _myadminpath /var/www/myadmin
%define pkgrelease rc1
%define microrelease 1
Name: phpMyAdmin
Version: 2.8.0
Release: %{pkgrelease}.%{microrelease}
License: GPL
Group: Applications/Databases/Interfaces
Source0: http://prdownloads.sourceforge.net/phpmyadmin/%{name}-%{version}-%{pkgrelease}.tar.bz2
Source1: phpMyAdmin-http.conf
URL: http://sourceforge.net/projects/phpmyadmin/
Requires: mysql
Requires: php-mysql
Buildarch: noarch
BuildRoot: %{_tmppath}/%{name}-root
Summary: phpMyAdmin - web-based MySQL administration
%description
phpMyAdmin can manage a whole MySQL-server (needs a super-user) but
also a single database. To accomplish the latter you'll need a
properly set up MySQL-user which can read/write only the desired
database. It's up to you to look up the appropiate part in the MySQL
manual. Currently phpMyAdmin can:
- create and drop databases
- create, copy, drop and alter tables
- delete, edit and add fields
- execute any SQL-statement, even batch-queries
- manage keys on fields
- load text files into tables
- create (*) and read dumps of tables
- export (*) and import data to CSV values
- administer multiple servers and single databases
- check referencial integrity
- create complex queries automatically connecting required tables
- create PDF graphics of your database layout
- communicate in more than 38 different languages
%prep
%setup -q -n %{name}-%{version}-%{pkgrelease}
%build
%install
[ "${RPM_BUILD_ROOT}" != "/" ] && [ -d "${RPM_BUILD_ROOT}" ] && \
rm -rf "${RPM_BUILD_ROOT}"
# Create directories.
install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/{css,js,lang,libraries,themes}
install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/libraries/{auth,dbg,dbi,engines}
install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/libraries/{export,tcpdf,import}
install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/libraries/transformations
install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/libraries/tcpdf/font
install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/themes/{darkblue_orange,original}
install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/themes/darkblue_orange/{css,img}
install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/themes/original/{css,img}
# Install files.
install libraries/config.default.php \
"${RPM_BUILD_ROOT}%{_myadminpath}"/config.inc.php
install *.{php,ico} "${RPM_BUILD_ROOT}%{_myadminpath}"/
install ChangeLog LICENSE README "${RPM_BUILD_ROOT}%{_myadminpath}"/
install Documentation.html docs.css "${RPM_BUILD_ROOT}%{_myadminpath}"/
install css/* "${RPM_BUILD_ROOT}%{_myadminpath}/css"/
install js/* "${RPM_BUILD_ROOT}%{_myadminpath}/js"/
install lang/*.php "${RPM_BUILD_ROOT}%{_myadminpath}/lang"/
install libraries/*.php "${RPM_BUILD_ROOT}%{_myadminpath}/libraries"/
install libraries/auth/*.php "${RPM_BUILD_ROOT}%{_myadminpath}/libraries/auth"/
install libraries/dbg/*.php "${RPM_BUILD_ROOT}%{_myadminpath}/libraries/dbg"/
install libraries/dbi/*.php "${RPM_BUILD_ROOT}%{_myadminpath}/libraries/dbi"/
install libraries/engines/*.php \
"${RPM_BUILD_ROOT}%{_myadminpath}/libraries/engines"/
install libraries/export/*.php \
"${RPM_BUILD_ROOT}%{_myadminpath}/libraries/export"/
install libraries/tcpdf/*.php "${RPM_BUILD_ROOT}%{_myadminpath}/libraries/tcpdf"/
install libraries/tcpdf/font/*.{php,z} \
"${RPM_BUILD_ROOT}%{_myadminpath}/libraries/tcpdf/font"/
install libraries/import/*.php \
"${RPM_BUILD_ROOT}%{_myadminpath}/libraries/import"/
install libraries/transformations/*.php \
"${RPM_BUILD_ROOT}%{_myadminpath}/libraries/transformations"/
install themes/darkblue_orange/*.{php,png} \
"${RPM_BUILD_ROOT}%{_myadminpath}/themes/darkblue_orange"/
install themes/darkblue_orange/css/*.php \
"${RPM_BUILD_ROOT}%{_myadminpath}/themes/darkblue_orange/css"/
install themes/darkblue_orange/img/*.{png,ico} \
"${RPM_BUILD_ROOT}%{_myadminpath}/themes/darkblue_orange/img"/
install themes/original/*.{php,png} \
"${RPM_BUILD_ROOT}%{_myadminpath}/themes/original"/
install themes/original/css/*.php \
"${RPM_BUILD_ROOT}%{_myadminpath}/themes/original/css"/
install themes/original/img/*.{png,ico} \
"${RPM_BUILD_ROOT}%{_myadminpath}/themes/original/img"/
# Create documentation directories.
DOCROOT="${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}"
install -d "${DOCROOT}"
install -d "${DOCROOT}"/{lang,scripts,transformations}
# Install documentation files.
install RELEASE-DATE-* "${DOCROOT}"/
install CREDITS ChangeLog INSTALL LICENSE "${DOCROOT}"/
install README TODO "${DOCROOT}"/
install Documentation.* docs.css "${DOCROOT}"/
install translators.html "${DOCROOT}"/
install lang/*.sh "${DOCROOT}"/lang/
install scripts/* "${DOCROOT}"/scripts/
install libraries/tcpdf/README "${DOCROOT}"/README.tcpdf
install libraries/import/README "${DOCROOT}"/README.import
install libraries/transformations/README "${DOCROOT}"/transformations/
install libraries/transformations/TEMPLATE* "${DOCROOT}"/transformations/
install libraries/transformations/*.sh "${DOCROOT}"/transformations/
# Install configuration file for Apache.
install -d "${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf.d"
install "%{SOURCE1}" \
"${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf.d/phpMyAdmin.conf"
# Generate non-configuration file list.
(cd "${RPM_BUILD_ROOT}"; ls -d ."%{_myadminpath}"/*) |
sed -e '/\/config\.inc\.php$/d' -e 's/^.//' > files.list
%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && [ -d "${RPM_BUILD_ROOT}" ] && \
rm -rf "${RPM_BUILD_ROOT}"
%files -f files.list
%defattr(644, root, root, 755)
%doc %{_docdir}/%{name}-%{version}
%dir %{_myadminpath}
%attr(640,root,apache) %config(noreplace) %verify(not size mtime md5) %{_myadminpath}/config.inc.php
%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/httpd/conf.d/*
%changelog
* Thu Feb 23 2006 Patrick Monnerat <pm@datasphere.ch>
- Version 2.8.0-rc1.1.
* Thu Dec 22 2005 Patrick Monnerat <patrick.monnerat@econophone.ch>
- Path "nullpw" to allow trying connection with null password after failure.
- Version 2.7.0-pl1.1.
* Mon Aug 22 2005 Patrick Monnerat <patrick.monnerat@econophone.ch>
- Version 2.6.3-pl1.
* Wed Jul 21 2004 Patrick Monnerat <patrick.monnerat@econophone.ch>
- Version 2.5.7-pl1.
* Fri Nov 22 2002 Patrick Monnerat <patrick.monnerat@econophone.ch>
- Version 2.3.0-rc1.

49
db_create.php Normal file
View File

@@ -0,0 +1,49 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @version $Id$
*/
/**
* Gets some core libraries
*/
require_once './libraries/common.inc.php';
$js_to_run = 'functions.js';
require_once './libraries/mysql_charsets.lib.php';
PMA_checkParameters(array('db'));
/**
* Defines the url to return to in case of error in a sql statement
*/
$err_url = 'main.php?' . PMA_generate_common_url();
/**
* Builds and executes the db creation sql query
*/
$sql_query = 'CREATE DATABASE ' . PMA_backquote($db);
if (!empty($db_collation) && PMA_MYSQL_INT_VERSION >= 40101) {
list($db_charset) = explode('_', $db_collation);
if (in_array($db_charset, $mysql_charsets) && in_array($db_collation, $mysql_collations[$db_charset])) {
$sql_query .= ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);
}
unset($db_charset, $db_collation);
}
$sql_query .= ';';
$result = PMA_DBI_try_query($sql_query);
if (! $result) {
$message = PMA_DBI_getError();
// avoid displaying the not-created db name in header or navi panel
$GLOBALS['db'] = '';
$GLOBALS['table'] = '';
require_once './libraries/header.inc.php';
require_once './main.php';
} else {
$message = $strDatabase . ' ' . htmlspecialchars($db) . ' ' . $strHasBeenCreated;
require_once './libraries/header.inc.php';
require_once './' . $cfg['DefaultTabDatabase'];
}
?>

326
db_datadict.php Normal file
View File

@@ -0,0 +1,326 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @version $Id$
*/
/**
* Gets the variables sent or posted to this script, then displays headers
*/
require_once './libraries/common.inc.php';
if (!isset($selected_tbl)) {
require_once './libraries/header.inc.php';
}
/**
* Gets the relations settings
*/
require_once './libraries/relation.lib.php';
require_once './libraries/transformations.lib.php';
$cfgRelation = PMA_getRelationsParam();
/**
* Check parameters
*/
PMA_checkParameters(array('db'));
/**
* Defines the url to return to in case of error in a sql statement
*/
if (strlen($table)) {
$err_url = 'tbl_sql.php?' . PMA_generate_common_url($db, $table);
} else {
$err_url = 'db_sql.php?' . PMA_generate_common_url($db);
}
if ($cfgRelation['commwork']) {
$comment = PMA_getComments($db);
/**
* Displays DB comment
*/
if (is_array($comment)) {
?>
<p> <?php echo $strDBComment; ?>
<i><?php echo htmlspecialchars(implode(' ', $comment)); ?></i></p>
<?php
} // end if
}
/**
* Selects the database and gets tables names
*/
PMA_DBI_select_db($db);
$rowset = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
$count = 0;
while ($row = PMA_DBI_fetch_assoc($rowset)) {
$myfieldname = 'Tables_in_' . htmlspecialchars($db);
$table = $row[$myfieldname];
if ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) {
$comments = PMA_getComments($db, $table);
}
if ($count != 0) {
echo '<div style="page-break-before: always;">' . "\n";
} else {
echo '<div>' . "\n";
}
echo '<h2>' . $table . '</h2>' . "\n";
/**
* Gets table informations
*/
// The 'show table' statement works correct since 3.23.03
$showtable = PMA_DBI_get_tables_full($db, $table);
$num_rows = (isset($showtable[$table]['TABLE_ROWS']) ? $showtable[$table]['TABLE_ROWS'] : 0);
$show_comment = (isset($showtable[$table]['TABLE_COMMENT']) ? $showtable[$table]['TABLE_COMMENT'] : '');
unset($showtable);
/**
* Gets table keys and retains them
*/
PMA_DBI_select_db($db);
$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);
// We need this to correctly learn if a TIMESTAMP is NOT NULL, since
// SHOW FULL FIELDS or INFORMATION_SCHEMA incorrectly says NULL
// and SHOW CREATE TABLE says NOT NULL (tested
// in MySQL 4.0.25 and 5.0.21, http://bugs.mysql.com/20910).
$show_create_table = PMA_DBI_fetch_value(
'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
0, 1);
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
// 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
*/
if (!empty($show_comment)) {
echo $strTableComments . ': ' . $show_comment . '<br /><br />';
}
/**
* Displays the table structure
*/
?>
<table width="100%" class="print">
<tr><th width="50"><?php echo $strField; ?></th>
<th width="80"><?php echo $strType; ?></th>
<?php /* <th width="50"><?php echo $strAttr; ?></th>*/ ?>
<th width="40"><?php echo $strNull; ?></th>
<th width="70"><?php echo $strDefault; ?></th>
<?php /* <th width="50"><?php echo $strExtra; ?></th>*/ ?>
<?php
if ($have_rel) {
echo ' <th>' . $strLinksTo . '</th>' . "\n";
}
if ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) {
echo ' <th>' . $strComments . '</th>' . "\n";
}
if ($cfgRelation['mimework']) {
echo ' <th>MIME</th>' . "\n";
}
?>
</tr>
<?php
$odd_row = true;
while ($row = PMA_DBI_fetch_assoc($result)) {
$type = $row['Type'];
// reformat mysql query output - staybyte - 9. June 2001
// loic1: 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 {
$binary = stristr($row['Type'], 'binary');
$unsigned = stristr($row['Type'], 'unsigned');
$zerofill = stristr($row['Type'], 'zerofill');
$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 = ' ';
}
}
$strAttribute = ' ';
if ($binary) {
$strAttribute = 'BINARY';
}
if ($unsigned) {
$strAttribute = 'UNSIGNED';
}
if ($zerofill) {
$strAttribute = 'UNSIGNED ZEROFILL';
}
if (!isset($row['Default'])) {
if ($row['Null'] != '' && $row['Null'] != 'NO') {
$row['Default'] = '<i>NULL</i>';
}
} else {
$row['Default'] = htmlspecialchars($row['Default']);
}
$field_name = htmlspecialchars($row['Field']);
// here, we have a TIMESTAMP that SHOW FULL FIELDS reports as having the
// NULL attribute, but SHOW CREATE TABLE says the contrary. Believe
// the latter.
/**
* @todo merge this logic with the one in tbl_structure.php
* or move it in a function similar to PMA_DBI_get_columns_full()
* but based on SHOW CREATE TABLE because information_schema
* cannot be trusted in this case (MySQL bug)
*/
if (!empty($analyzed_sql[0]['create_table_fields'][$field_name]['type']) && $analyzed_sql[0]['create_table_fields'][$field_name]['type'] == 'TIMESTAMP' && $analyzed_sql[0]['create_table_fields'][$field_name]['timestamp_not_null']) {
$row['Null'] = '';
}
?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
<td nowrap="nowrap">
<?php
if (isset($pk_array[$row['Field']])) {
echo '<u>' . $field_name . '</u>';
} else {
echo $field_name;
}
?>
</td>
<td<?php echo $type_nowrap; ?> xml:lang="en" dir="ltr"><?php echo $type; ?></td>
<?php /* <td<?php echo $type_nowrap; ?>><?php echo $strAttribute; ?></td>*/ ?>
<td><?php echo (($row['Null'] == '' || $row['Null'] == 'NO') ? $strNo : $strYes); ?></td>
<td nowrap="nowrap"><?php if (isset($row['Default'])) { echo $row['Default']; } ?></td>
<?php /* <td<?php echo $type_nowrap; ?>><?php echo $row['Extra']; ?></td>*/ ?>
<?php
if ($have_rel) {
echo ' <td>';
if (isset($res_rel[$field_name])) {
echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field']);
}
echo '</td>' . "\n";
}
if ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) {
echo ' <td>';
if (isset($comments[$field_name])) {
echo htmlspecialchars($comments[$field_name]);
}
echo '</td>' . "\n";
}
if ($cfgRelation['mimework']) {
$mime_map = PMA_getMIME($db, $table, true);
echo ' <td>';
if (isset($mime_map[$field_name])) {
echo htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype']));
}
echo '</td>' . "\n";
}
?>
</tr>
<?php
} // end while
PMA_DBI_free_result($result);
$count++;
?>
</table>
</div>
<?php
} //ends main while
/**
* Displays the footer
*/
?>
<script type="text/javascript">
//<![CDATA[
function printPage()
{
document.getElementById('print').style.visibility = 'hidden';
// Do print the page
if (typeof(window.print) != 'undefined') {
window.print();
}
document.getElementById('print').style.visibility = '';
}
//]]>
</script>
<?php
echo '<br /><br /><input type="button" id="print" value="' . $strPrint . '" onclick="printPage()" />';
require_once './libraries/footer.inc.php';
?>

75
db_export.php Normal file
View File

@@ -0,0 +1,75 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* dumps a database
*
* @version $Id$
* @uses libraries/db_common.inc.php
* @uses libraries/db_info.inc.php
* @uses libraries/display_export.lib.php
* @uses $tables from libraries/db_info.inc.php
*/
/**
* Gets some core libraries
*/
require_once './libraries/common.inc.php';
$sub_part = '_export';
require_once './libraries/db_common.inc.php';
$url_query .= '&amp;goto=db_export.php';
require_once './libraries/db_info.inc.php';
/**
* Displays the form
*/
$export_page_title = $strViewDumpDB;
// exit if no tables in db found
if ($num_tables < 1) {
echo '<div class="warning">' . $strNoTablesFound . '</div>';
require './libraries/footer.inc.php';
exit;
} // end if
$multi_values = '<div align="center"><select name="table_select[]" size="6" multiple="multiple">';
$multi_values .= "\n";
foreach ($tables as $each_table) {
// ok we show also views
//if (PMA_MYSQL_INT_VERSION >= 50000 && is_null($each_table['Engine'])) {
// Don't offer to export views yet.
// continue;
//}
if (! empty($unselectall)
|| (isset($tmp_select)
&& false !== strpos($tmp_select, '|' . $each_table['Name'] . '|'))) {
$is_selected = '';
} else {
$is_selected = ' selected="selected"';
}
$table_html = htmlspecialchars($each_table['Name']);
$multi_values .= ' <option value="' . $table_html . '"'
. $is_selected . '>'
. str_replace(' ', '&nbsp;', $table_html) . '</option>' . "\n";
} // end for
$multi_values .= "\n";
$multi_values .= '</select></div>';
$checkall_url = 'db_export.php?'
. PMA_generate_common_url($db)
. '&amp;goto=db_export.php';
$multi_values .= '<br />
<a href="' . $checkall_url . '" onclick="setSelectOptions(\'dump\', \'table_select[]\', true); return false;">' . $strSelectAll . '</a>
/
<a href="' . $checkall_url . '&amp;unselectall=1" onclick="setSelectOptions(\'dump\', \'table_select[]\', false); return false;">' . $strUnselectAll . '</a>';
$export_type = 'database';
require_once './libraries/display_export.lib.php';
/**
* Displays the footer
*/
require_once './libraries/footer.inc.php';
?>

27
db_import.php Normal file
View File

@@ -0,0 +1,27 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @version $Id$
*/
/**
*
*/
require_once './libraries/common.inc.php';
/**
* Gets tables informations and displays top links
*/
require './libraries/db_common.inc.php';
require './libraries/db_info.inc.php';
$import_type = 'database';
require './libraries/display_import.lib.php';
/**
* Displays the footer
*/
require './libraries/footer.inc.php';
?>

478
db_operations.php Normal file
View File

@@ -0,0 +1,478 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* handles miscellaneous db operations:
* - move/rename
* - copy
* - changing collation
* - changing comment
* - adding tables
* - viewing PDF schemas
*
* @version $Id$
*/
/**
* requirements
*/
require_once './libraries/common.inc.php';
require_once './libraries/Table.class.php';
require_once './libraries/mysql_charsets.lib.php';
/**
* Rename/move or copy database
*/
if (strlen($db) &&
((isset($db_rename) && $db_rename == 'true') ||
(isset($db_copy) && $db_copy == 'true'))) {
if (isset($db_rename) && $db_rename == 'true') {
$move = true;
} else {
$move = false;
}
if (!isset($newname) || !strlen($newname)) {
$message = $strDatabaseEmpty;
} else {
$sql_query = ''; // in case target db exists
if ($move ||
(isset($create_database_before_copying) && $create_database_before_copying)) {
$local_query = 'CREATE DATABASE ' . PMA_backquote($newname);
if (isset($db_collation)) {
$local_query .= ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);
}
$local_query .= ';';
$sql_query = $local_query;
PMA_DBI_query($local_query);
// rebuild the database list because PMA_Table::moveCopy
// checks in this list if the target db exists
$GLOBALS['PMA_List_Database']->build();
}
if (isset($GLOBALS['add_constraints'])) {
$GLOBALS['sql_constraints_query_full_db'] = '';
}
$tables_full = PMA_DBI_get_tables_full($db);
$views = array();
foreach ($tables_full as $each_table => $tmp) {
// to be able to rename a db containing views, we
// first collect in $views all the views we find and we
// will handle them after the tables
/**
* @todo support a view of a view
*/
if (PMA_Table::isView($db, $each_table)) {
$views[] = $each_table;
continue;
}
$back = $sql_query;
$sql_query = '';
// value of $what for this table only
$this_what = $what;
if (!isset($tables_full[$each_table]['Engine'])) {
$tables_full[$each_table]['Engine'] = $tables_full[$each_table]['Type'];
}
// do not copy the data from a Merge table
// note: on the calling FORM, 'data' means 'structure and data'
if ($tables_full[$each_table]['Engine'] == 'MRG_MyISAM') {
if ($this_what == 'data') {
$this_what = 'structure';
}
if ($this_what == 'dataonly') {
$this_what = 'nocopy';
}
}
if ($this_what != 'nocopy') {
PMA_Table::moveCopy($db, $each_table, $newname, $each_table,
isset($this_what) ? $this_what : 'data', $move, 'db_copy');
if (isset($GLOBALS['add_constraints'])) {
$GLOBALS['sql_constraints_query_full_db'] .= $GLOBALS['sql_constraints_query'];
unset($GLOBALS['sql_constraints_query']);
}
}
$sql_query = $back . $sql_query;
} // end (foreach)
unset($each_table);
// handle the views
foreach ($views as $view) {
PMA_Table::moveCopy($db, $view, $newname, $view,
'structure', $move, 'db_copy');
}
unset($view, $views);
// now that all tables exist, create all the accumulated constraints
if (isset($GLOBALS['add_constraints'])) {
/**
* @todo this works with mysqli but not with mysql, because
* mysql extension does not accept more than one statement; maybe
* interface with the sql import plugin that handles statement delimiter
*/
PMA_DBI_query($GLOBALS['sql_constraints_query_full_db']);
// and prepare to display them
$GLOBALS['sql_query'] .= "\n" . $GLOBALS['sql_constraints_query_full_db'];
unset($GLOBALS['sql_constraints_query_full_db']);
}
// Duplicate the bookmarks for this db (done once for each db)
if ($db != $newname) {
$get_fields = array('user', 'label', 'query');
$where_fields = array('dbase' => $db);
$new_fields = array('dbase' => $newname);
PMA_Table::duplicateInfo('bookmarkwork', 'bookmark', $get_fields,
$where_fields, $new_fields);
}
if ($move) {
// cleanup pmadb stuff for this db
require_once './libraries/relation_cleanup.lib.php';
PMA_relationsCleanupDatabase($db);
$local_query = 'DROP DATABASE ' . PMA_backquote($db) . ';';
$sql_query .= "\n" . $local_query;
PMA_DBI_query($local_query);
$message = sprintf($strRenameDatabaseOK, htmlspecialchars($db),
htmlspecialchars($newname));
} else {
$message = sprintf($strCopyDatabaseOK, htmlspecialchars($db),
htmlspecialchars($newname));
}
$reload = true;
/* Change database to be used */
if ($move) {
$db = $newname;
} else {
if (isset($switch_to_new) && $switch_to_new == 'true') {
PMA_setCookie('pma_switch_to_new', 'true');
$db = $newname;
} else {
PMA_setCookie('pma_switch_to_new', '');
}
}
}
}
/**
* Settings for relations stuff
*/
require_once './libraries/relation.lib.php';
$cfgRelation = PMA_getRelationsParam();
/**
* Check if comments were updated
* (must be done before displaying the menu tabs)
*/
if ($cfgRelation['commwork'] && isset($db_comment) && $db_comment == 'true') {
PMA_SetComment($db, '', '(db_comment)', $comment);
}
/**
* Prepares the tables list if the user where not redirected to this script
* because there is no table in the database ($is_info is true)
*/
if (empty($is_info)) {
require './libraries/db_common.inc.php';
$url_query .= '&amp;goto=db_operations.php';
// Gets the database structure
$sub_part = '_structure';
require './libraries/db_info.inc.php';
echo "\n";
}
if (PMA_MYSQL_INT_VERSION >= 40101) {
$db_collation = PMA_getDbCollation($db);
}
if (PMA_MYSQL_INT_VERSION < 50002
|| (PMA_MYSQL_INT_VERSION >= 50002 && $db != 'information_schema')) {
$is_information_schema = false;
} else {
$is_information_schema = true;
}
if (!$is_information_schema) {
require './libraries/display_create_table.lib.php';
if ($cfgRelation['commwork']) {
/**
* database comment
*/
?>
<form method="post" action="db_operations.php">
<?php echo PMA_generate_common_hidden_inputs($db); ?>
<input type="hidden" name="db_comment" value="true" />
<fieldset>
<legend>
<?php
if ($cfg['PropertiesIconic']) {
echo '<img class="icon" src="' . $pmaThemeImage . 'b_comment.png"'
.' alt="" border="0" width="16" height="16" hspace="2" align="middle" />';
}
echo $strDBComment;
$comment = PMA_getComments($db);
?>
</legend>
<input type="text" name="comment" class="textfield" size="30"
value="<?php
echo (isset($comment) && is_array($comment)
? htmlspecialchars(implode(' ', $comment))
: ''); ?>" />
<input type="submit" value="<?php echo $strGo; ?>" />
</fieldset>
</form>
<?php
}
/**
* rename database
*/
?>
<form method="post" action="db_operations.php"
onsubmit="return emptyFormElements(this, 'newname')">
<input type="hidden" name="what" value="data" />
<input type="hidden" name="db_rename" value="true" />
<?php echo PMA_generate_common_hidden_inputs($db); ?>
<fieldset>
<legend>
<?php
if ($cfg['PropertiesIconic']) {
echo '<img class="icon" src="' . $pmaThemeImage . 'b_edit.png"'
.' alt="" width="16" height="16" />';
}
echo $strDBRename . ':';
?>
</legend>
<input type="text" name="newname" size="30" class="textfield" value="" />
<input type="submit" value="<?php echo $strGo; ?>" />
</fieldset>
</form>
<?php
/**
* Copy database
*/
?>
<form method="post" action="db_operations.php"
onsubmit="return emptyFormElements(this, 'newname')">
<?php
if (isset($db_collation)) {
echo '<input type="hidden" name="db_collation" value="' . $db_collation
.'" />' . "\n";
}
echo '<input type="hidden" name="db_copy" value="true" />' . "\n";
echo PMA_generate_common_hidden_inputs($db);
?>
<fieldset>
<legend>
<?php
if ($cfg['PropertiesIconic']) {
echo '<img class="icon" src="' . $pmaThemeImage . 'b_edit.png"'
.' alt="" width="16" height="16" />';
}
echo $strDBCopy . ':';
if (PMA_MYSQL_INT_VERSION >= 50000) {
$drop_clause = 'DROP TABLE / DROP VIEW';
} else {
$drop_clause = 'DROP TABLE';
}
?>
</legend>
<input type="text" name="newname" size="30" class="textfield" value="" /><br />
<input type="radio" name="what" value="structure"
id="radio_copy_structure" style="vertical-align: middle" />
<label for="radio_copy_structure"><?php echo $strStrucOnly; ?></label><br />
<input type="radio" name="what" value="data" id="radio_copy_data"
checked="checked" style="vertical-align: middle" />
<label for="radio_copy_data"><?php echo $strStrucData; ?></label><br />
<input type="radio" name="what" value="dataonly"
id="radio_copy_dataonly" style="vertical-align: middle" />
<label for="radio_copy_dataonly"><?php echo $strDataOnly; ?></label><br />
<input type="checkbox" name="create_database_before_copying" value="1"
id="checkbox_create_database_before_copying"
style="vertical-align: middle" checked="checked" />
<label for="checkbox_create_database_before_copying">
<?php echo $strCreateDatabaseBeforeCopying; ?></label><br />
<input type="checkbox" name="drop_if_exists" value="true"
id="checkbox_drop" style="vertical-align: middle" />
<label for="checkbox_drop"><?php echo sprintf($strAddClause, $drop_clause); ?></label><br />
<input type="checkbox" name="sql_auto_increment" value="1"
id="checkbox_auto_increment" style="vertical-align: middle" />
<label for="checkbox_auto_increment">
<?php echo $strAddAutoIncrement; ?></label><br />
<input type="checkbox" name="add_constraints" value="1"
id="checkbox_constraints" style="vertical-align: middle" />
<label for="checkbox_constraints">
<?php echo $strAddConstraints; ?></label><br />
<?php
unset($drop_clause);
if (isset($_COOKIE) && isset($_COOKIE['pma_switch_to_new'])
&& $_COOKIE['pma_switch_to_new'] == 'true') {
$pma_switch_to_new = 'true';
}
?>
<input type="checkbox" name="switch_to_new" value="true"
id="checkbox_switch"
<?php echo ((isset($pma_switch_to_new) && $pma_switch_to_new == 'true') ? ' checked="checked"' : ''); ?>
style="vertical-align: middle" />
<label for="checkbox_switch"><?php echo $strSwitchToDatabase; ?></label>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="submit_copy" value="<?php echo $strGo; ?>" />
</fieldset>
</form>
<?php
/**
* Change database charset
*/
if (PMA_MYSQL_INT_VERSION >= 40101) {
// MySQL supports setting default charsets / collations for databases since
// version 4.1.1.
echo '<form method="post" action="./db_operations.php">' . "\n"
. PMA_generate_common_hidden_inputs($db, $table)
. '<fieldset>' . "\n"
. ' <legend>';
if ($cfg['PropertiesIconic']) {
echo '<img class="icon" src="' . $pmaThemeImage . 's_asci.png"'
.' alt="" width="16" height="16" />';
}
echo ' <label for="select_db_collation">' . $strCollation . ':</label>' . "\n"
. ' </legend>' . "\n"
. PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION,
'db_collation', 'select_db_collation', $db_collation, false, 3)
. ' <input type="submit" name="submitcollation"'
. ' value="' . $strGo . '" style="vertical-align: middle" />' . "\n"
. '</fieldset>' . "\n"
. '</form>' . "\n";
}
if ($num_tables > 0
&& !$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == false) {
/* Show error if user has configured something, notice elsewhere */
if (!empty($cfg['Servers'][$server]['pmadb'])) {
echo '<div class="error"><h1>' . $strError . '</h1>';
} else {
echo '<div class="notice">';
}
printf($strRelationNotWorking, '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $url_query . '">', '</a>');
echo '</div>';
} // end if
} // end if (!$is_information_schema)
// not sure about leaving the PDF dialog for information_schema
if ($num_tables > 0 && strlen($table)) {
$takeaway = $url_query . '&amp;table=' . urlencode($table);
} else {
$takeaway = '';
}
if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?>
<!-- Work on PDF Pages -->
<?php
// We only show this if we find something in the new pdf_pages table
$test_query = '
SELECT *
FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) . '
WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$test_rs = PMA_query_as_cu($test_query, null, PMA_DBI_QUERY_STORE);
if ($test_rs && PMA_DBI_num_rows($test_rs) > 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 $strDisplayPDF;
?>:
</legend>
<label for="pdf_page_number_opt"><?php echo $strPageNumber; ?></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'] . ': ' . $pages['page_descr'] . '</option>' . "\n";
} // end while
PMA_DBI_free_result($test_rs);
unset($test_rs);
?>
</select><br />
<input type="checkbox" name="show_grid" id="show_grid_opt" />
<label for="show_grid_opt"><?php echo $strShowGrid; ?></label><br />
<input type="checkbox" name="show_color" id="show_color_opt"
checked="checked" />
<label for="show_color_opt"><?php echo $strShowColor; ?></label><br />
<input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" />
<label for="show_table_dim_opt"><?php echo $strShowTableDimension; ?>
</label><br />
<input type="checkbox" name="all_tab_same_wide" id="all_tab_same_wide" />
<label for="all_tab_same_wide"><?php echo $strAllTableSameWidth; ?>
</label><br />
<input type="checkbox" name="with_doc" id="with_doc" checked="checked" />
<label for="with_doc"><?php echo $strDataDict; ?></label><br />
<label for="orientation_opt"><?php echo $strShowDatadictAs; ?></label>
<select name="orientation" id="orientation_opt">
<option value="L"><?php echo $strLandscape;?></option>
<option value="P"><?php echo $strPortrait;?></option>
</select><br />
<label for="paper_opt"><?php echo $strPaperSize; ?></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 $strGo; ?>" />
</fieldset>
</form>
<?php
} // end if
?>
<ul>
<li>
<?php
echo '<a href="pdf_pages.php?' . $takeaway . '">';
if ($cfg['PropertiesIconic']) {
echo '<img class="icon" src="' . $pmaThemeImage . 'b_edit.png"'
.' alt="" width="16" height="16" />';
}
echo $strEditPDFPages . '</a>';
?>
</li>
</ul>
<?php
} // end if
/**
* Displays the footer
*/
require_once './libraries/footer.inc.php';
?>

269
db_printview.php Normal file
View File

@@ -0,0 +1,269 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @version $Id$
*/
/**
*
*/
require_once './libraries/common.inc.php';
/**
* Gets the variables sent or posted to this script, then displays headers
*/
$print_view = true;
require_once './libraries/header.inc.php';
PMA_checkParameters(array('db'));
/**
* Defines the url to return to in case of error in a sql statement
*/
$err_url = 'db_sql.php?' . PMA_generate_common_url($db);
/**
* Settings for relations stuff
*/
require_once './libraries/relation.lib.php';
$cfgRelation = PMA_getRelationsParam();
/**
* Gets the list of the table in the current db and informations about these
* tables if possible
*
* @todo merge this speedup _optionaly_ into PMA_DBI_get_tables_full()
*
// staybyte: speedup view on locked tables - 11 June 2001
// Special speedup for newer MySQL Versions (in 4.0 format changed)
if ($cfg['SkipLockedTables'] == true) {
$result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
// Blending out tables in use
if ($result != false && PMA_DBI_num_rows($result) > 0) {
while ($tmp = PMA_DBI_fetch_row($result)) {
// if in use memorize tablename
if (preg_match('@in_use=[1-9]+@i', $tmp[0])) {
$sot_cache[$tmp[0]] = true;
}
}
PMA_DBI_free_result($result);
if (isset($sot_cache)) {
$result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
if ($result != false && PMA_DBI_num_rows($result) > 0) {
while ($tmp = PMA_DBI_fetch_row($result)) {
if (!isset($sot_cache[$tmp[0]])) {
$sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';');
$sts_tmp = PMA_DBI_fetch_assoc($sts_result);
$tables[] = $sts_tmp;
} else { // table in use
$tables[] = array('Name' => $tmp[0]);
}
}
PMA_DBI_free_result($result);
$sot_ready = true;
}
}
unset($tmp, $result);
}
}
if (! isset($sot_ready)) {
$result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
if (PMA_DBI_num_rows($result) > 0) {
while ($sts_tmp = PMA_DBI_fetch_assoc($result)) {
$tables[] = $sts_tmp;
}
PMA_DBI_free_result($result);
unset($res);
}
}
*/
/**
* If there is at least one table, displays the printer friendly view, else
* an error message
*/
$tables = PMA_DBI_get_tables_full($db);
$num_tables = count($tables);
echo '<br />';
// 1. No table
if ($num_tables == 0) {
echo $strNoTablesFound;
}
// 2. Shows table informations on mysql >= 3.23.03 - staybyte - 11 June 2001
else {
?>
<table>
<thead>
<tr>
<th><?php echo $strTable; ?></th>
<th><?php echo $strRecords; ?></th>
<th><?php echo $strType; ?></th>
<?php
if ($cfg['ShowStats']) {
echo '<th>' . $strSize . '</th>';
}
?>
<th><?php echo $strComments; ?></th>
</tr>
</thead>
<tbody>
<?php
$sum_entries = $sum_size = 0;
$odd_row = true;
foreach ($tables as $sts_data) {
if (strtoupper($sts_data['ENGINE']) == 'MRG_MYISAM'
|| strtoupper($sts_data['ENGINE']) == 'FEDERATED') {
$merged_size = true;
} else {
$merged_size = false;
}
$sum_entries += $sts_data['TABLE_ROWS'];
?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
<th>
<?php echo htmlspecialchars($sts_data['TABLE_NAME']); ?>
</th>
<?php
if (isset($sts_data['TABLE_ROWS'])) {
?>
<td align="right">
<?php
if ($merged_size) {
echo '<i>' . PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . '</i>' . "\n";
} else {
echo PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . "\n";
}
?>
</td>
<td nowrap="nowrap">
<?php echo $sts_data['ENGINE']; ?>
</td>
<?php
if ($cfg['ShowStats']) {
$tblsize = $sts_data['Data_length'] + $sts_data['Index_length'];
$sum_size += $tblsize;
list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1);
?>
<td align="right" nowrap="nowrap">
<?php echo $formated_size . ' ' . $unit; ?>
</td>
<?php
} // end if
} else {
?>
<td colspan="3" align="center">
<?php echo $strInUse; ?>
</td>
<?php
}
?>
<td>
<?php
if (! empty($sts_data['Comment'])) {
echo $sts_data['Comment'];
$needs_break = '<br />';
} else {
$needs_break = '';
}
if (! empty($sts_data['Create_time'])
|| ! empty($sts_data['Update_time'])
|| ! empty($sts_data['Check_time'])) {
echo $needs_break;
?>
<table width="100%">
<?php
if (! empty($sts_data['Create_time'])) {
?>
<tr>
<td align="right"><?php echo $strStatCreateTime . ': '; ?></td>
<td align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Create_time'])); ?></td>
</tr>
<?php
}
if (! empty($sts_data['Update_time'])) {
?>
<tr>
<td align="right"><?php echo $strStatUpdateTime . ': '; ?></td>
<td align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Update_time'])); ?></td>
</tr>
<?php
}
if (! empty($sts_data['Check_time'])) {
?>
<tr>
<td align="right"><?php echo $strStatCheckTime . ': '; ?></td>
<td align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Check_time'])); ?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
</td>
</tr>
<?php
}
?>
<tr>
<th align="center">
<?php echo sprintf($strTables, PMA_formatNumber($num_tables, 0)); ?>
</th>
<th align="right" nowrap="nowrap">
<?php echo PMA_formatNumber($sum_entries, 0); ?>
</th>
<th align="center">
--
</th>
<?php
if ($cfg['ShowStats']) {
list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
?>
<th align="right" nowrap="nowrap">
<?php echo $sum_formated . ' ' . $unit; ?>
</th>
<?php
}
?>
<th>&nbsp;</th>
</tr>
</tbody>
</table>
<?php
}
/**
* Displays the footer
*/
?>
<script type="text/javascript">
//<![CDATA[
function printPage()
{
// Do print the page
if (typeof(window.print) != 'undefined') {
window.print();
}
}
//]]>
</script>
<br /><br />
<input type="button" class="print_ignore"
id="print" value="<?php echo $strPrint; ?>" onclick="printPage()" />
<?php
require_once './libraries/footer.inc.php';
?>

1038
db_qbe.php Normal file

File diff suppressed because it is too large Load Diff

372
db_search.php Normal file
View File

@@ -0,0 +1,372 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* searchs the entire database
*
* @todo make use of UNION when searching multiple tables
* @todo display executed query, optional?
* @uses $cfg['UseDbSearch']
* @uses $GLOBALS['db']
* @uses $GLOBALS['strAccessDenied']
* @uses $GLOBALS['strSearchOption1']
* @uses $GLOBALS['strSearchOption2']
* @uses $GLOBALS['strSearchOption3']
* @uses $GLOBALS['strSearchOption4']
* @uses $GLOBALS['strSearchResultsFor']
* @uses $GLOBALS['strNumSearchResultsInTable']
* @uses $GLOBALS['strBrowse']
* @uses $GLOBALS['strDelete']
* @uses $GLOBALS['strNumSearchResultsTotal']
* @uses $GLOBALS['strSearchFormTitle']
* @uses $GLOBALS['strSearchNeedle']
* @uses $GLOBALS['strSearchType']
* @uses $GLOBALS['strSplitWordsWithSpace']
* @uses $GLOBALS['strSearchInTables']
* @uses $GLOBALS['strUnselectAll']
* @uses $GLOBALS['strSelectAll']
* @uses PMA_DBI_get_tables()
* @uses PMA_sqlAddslashes()
* @uses PMA_getSearchSqls()
* @uses PMA_DBI_fetch_value()
* @uses PMA_linkOrButton()
* @uses PMA_generate_common_url()
* @uses PMA_generate_common_hidden_inputs()
* @uses PMA_showMySQLDocu()
* @uses $_REQUEST['search_str']
* @uses $_REQUEST['submit_search']
* @uses $_REQUEST['search_option']
* @uses $_REQUEST['table_select']
* @uses $_REQUEST['unselectall']
* @uses $_REQUEST['selectall']
* @uses is_string()
* @uses htmlspecialchars()
* @uses array_key_exists()
* @uses is_array()
* @uses array_intersect()
* @uses sprintf()
* @uses in_array()
* @version $Id$
* @author Thomas Chaumeny <chaume92 at aol.com>
*/
/**
*
*/
require_once './libraries/common.inc.php';
/**
* Gets some core libraries and send headers
*/
require './libraries/db_common.inc.php';
/**
* init
*/
// If config variable $GLOBALS['cfg']['Usedbsearch'] is on false : exit.
if (! $GLOBALS['cfg']['UseDbSearch']) {
PMA_mysqlDie($GLOBALS['strAccessDenied'], '', false, $err_url);
} // end if
$url_query .= '&amp;goto=db_search.php';
$url_params['goto'] = 'db_search.php';
/**
* @global array list of tables from the current database
* but do not clash with $tables coming from db_info.inc.php
*/
$tables_names_only = PMA_DBI_get_tables($GLOBALS['db']);
$search_options = array(
'1' => $GLOBALS['strSearchOption1'],
'2' => $GLOBALS['strSearchOption2'],
'3' => $GLOBALS['strSearchOption3'],
'4' => $GLOBALS['strSearchOption4'],
);
if (empty($_REQUEST['search_str']) || ! is_string($_REQUEST['search_str'])) {
unset($_REQUEST['submit_search']);
$searched = '';
} else {
$searched = htmlspecialchars($_REQUEST['search_str']);
$search_str = PMA_sqlAddslashes($_REQUEST['search_str'], true);
}
if (empty($_REQUEST['search_option']) || ! is_string($_REQUEST['search_option'])
|| ! array_key_exists($_REQUEST['search_option'], $search_options)) {
$search_option = 1;
unset($_REQUEST['submit_search']);
} else {
$search_option = (int) $_REQUEST['search_option'];
$option_str = $search_options[$_REQUEST['search_option']];
}
$tables_selected = array();
if (empty($_REQUEST['table_select']) || ! is_array($_REQUEST['table_select'])) {
unset($_REQUEST['submit_search']);
} elseif (! isset($_REQUEST['selectall']) && ! isset($_REQUEST['unselectall'])) {
$tables_selected = array_intersect($_REQUEST['table_select'], $tables_names_only);
}
if (isset($_REQUEST['selectall'])) {
$tables_selected = $tables_names_only;
} elseif (isset($_REQUEST['unselectall'])) {
$tables_selected = array();
}
/**
* Displays top links
*/
$sub_part = '';
require './libraries/db_info.inc.php';
/**
* 1. Main search form has been submitted
*/
if (isset($_REQUEST['submit_search'])) {
/**
* Builds the SQL search query
*
* @todo can we make use of fulltextsearch IN BOOLEAN MODE for this?
* @uses PMA_DBI_query
* PMA_MYSQL_INT_VERSION
* PMA_backquote
* PMA_DBI_free_result
* PMA_DBI_fetch_assoc
* $GLOBALS['db']
* explode
* count
* strlen
* @param string the table name
* @param string the string to search
* @param integer type of search (1 -> 1 word at least, 2 -> all words,
* 3 -> exact string, 4 -> regexp)
*
* @return array 3 SQL querys (for count, display and delete results)
*
* @global string the url to return to in case of errors
* @global string charset connection
*/
function PMA_getSearchSqls($table, $search_str, $search_option)
{
global $err_url, $charset_connection;
// Statement types
$sqlstr_select = 'SELECT';
$sqlstr_delete = 'DELETE';
// Fields to select
$res = PMA_DBI_query('SHOW ' . (PMA_MYSQL_INT_VERSION >= 40100 ? 'FULL ' : '') . 'FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($GLOBALS['db']) . ';');
while ($current = PMA_DBI_fetch_assoc($res)) {
if (PMA_MYSQL_INT_VERSION >= 40100) {
list($current['Charset']) = explode('_', $current['Collation']);
}
$current['Field'] = PMA_backquote($current['Field']);
$tblfields[] = $current;
} // while
PMA_DBI_free_result($res);
unset($current, $res);
// Table to use
$sqlstr_from = ' FROM ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($table);
$search_words = (($search_option > 2) ? array($search_str) : explode(' ', $search_str));
$search_wds_cnt = count($search_words);
$like_or_regex = (($search_option == 4) ? 'REGEXP' : 'LIKE');
$automatic_wildcard = (($search_option <3) ? '%' : '');
$fieldslikevalues = array();
foreach ($search_words as $search_word) {
// Eliminates empty values
// In MySQL 4.1, if a field has no collation we get NULL in Charset
// but in MySQL 5.0.x we get ''
if (strlen($search_word) === 0) {
continue;
}
$thefieldlikevalue = array();
foreach ($tblfields as $tblfield) {
if (PMA_MYSQL_INT_VERSION >= 40100
&& $tblfield['Charset'] != $charset_connection
&& $tblfield['Charset'] != 'NULL'
&& $tblfield['Charset'] != '') {
$prefix = 'CONVERT(_utf8 ';
$suffix = ' USING ' . $tblfield['Charset'] . ') COLLATE ' . $tblfield['Collation'];
} else {
$prefix = $suffix = '';
}
$thefieldlikevalue[] = $tblfield['Field']
. ' ' . $like_or_regex . ' '
. $prefix
. "'"
. $automatic_wildcard
. $search_word
. $automatic_wildcard . "'"
. $suffix;
} // end for
$fieldslikevalues[] = implode(' OR ', $thefieldlikevalue);
} // end for
$implode_str = ($search_option == 1 ? ' OR ' : ' AND ');
$sqlstr_where = ' WHERE (' . implode(') ' . $implode_str . ' (', $fieldslikevalues) . ')';
unset($fieldslikevalues);
// Builds complete queries
$sql['select_fields'] = $sqlstr_select . ' * ' . $sqlstr_from . $sqlstr_where;
// here, I think we need to still use the COUNT clause, even for
// VIEWs, anyway we have a WHERE clause that should limit results
$sql['select_count'] = $sqlstr_select . ' COUNT(*) AS `count`' . $sqlstr_from . $sqlstr_where;
$sql['delete'] = $sqlstr_delete . $sqlstr_from . $sqlstr_where;
return $sql;
} // end of the "PMA_getSearchSqls()" function
/**
* Displays the results
*/
$this_url_params = array(
'db' => $GLOBALS['db'],
'goto' => 'db_sql.php',
'pos' => 0,
'is_js_confirmed' => 0,
);
// Displays search string
echo '<br />' . "\n"
.'<table class="data">' . "\n"
.'<caption class="tblHeaders">' . "\n"
.sprintf($GLOBALS['strSearchResultsFor'],
$searched, $option_str) . "\n"
.'</caption>' . "\n";
$num_search_result_total = 0;
$odd_row = true;
foreach ($tables_selected as $each_table) {
// Gets the SQL statements
$newsearchsqls = PMA_getSearchSqls($each_table,
$search_str, $search_option);
// Executes the "COUNT" statement
$res_cnt = PMA_DBI_fetch_value($newsearchsqls['select_count']);
$num_search_result_total += $res_cnt;
$sql_query .= $newsearchsqls['select_count'];
echo '<tr class="' . ($odd_row ? 'odd' : 'even') . '">'
.'<td>' . sprintf($GLOBALS['strNumSearchResultsInTable'], $res_cnt,
htmlspecialchars($each_table)) . "</td>\n";
if ($res_cnt > 0) {
$this_url_params['sql_query'] = $newsearchsqls['select_fields'];
echo '<td>' . PMA_linkOrButton(
'sql.php' . PMA_generate_common_url($this_url_params),
$GLOBALS['strBrowse'], '') . "</td>\n";
$this_url_params['sql_query'] = $newsearchsqls['delete'];
echo '<td>' . PMA_linkOrButton(
'sql.php' . PMA_generate_common_url($this_url_params),
$GLOBALS['strDelete'], $newsearchsqls['delete']) . "</td>\n";
} else {
echo '<td>&nbsp;</td>' . "\n"
.'<td>&nbsp;</td>' . "\n";
}// end if else
$odd_row = ! $odd_row;
echo '</tr>' . "\n";
} // end for
echo '</table>' . "\n";
if (count($tables_selected) > 1) {
echo '<p>' . sprintf($GLOBALS['strNumSearchResultsTotal'],
$num_search_result_total) . '</p>' . "\n";
}
} // end 1.
/**
* 2. Displays the main search form
*/
?>
<a name="db_search"></a>
<form method="post" action="db_search.php" name="db_search">
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db']); ?>
<fieldset>
<legend><?php echo $GLOBALS['strSearchFormTitle']; ?></legend>
<table class="formlayout">
<tr><td><?php echo $GLOBALS['strSearchNeedle']; ?></td>
<td><input type="text" name="search_str" size="60"
value="<?php echo $searched; ?>" /></td>
</tr>
<tr><td align="right" valign="top">
<?php echo $GLOBALS['strSearchType']; ?></td>
<td><input type="radio" id="search_option_1" name="search_option"
value="1"<?php if ($search_option == 1) echo ' checked="checked"'; ?> />
<label for="search_option_1">
<?php echo $GLOBALS['strSearchOption1']; ?></label><sup>1</sup><br />
<input type="radio" id="search_option_2" name="search_option"
value="2"<?php if ($search_option == 2) echo ' checked="checked"'; ?> />
<label for="search_option_2">
<?php echo $GLOBALS['strSearchOption2']; ?></label><sup>1</sup><br />
<input type="radio" id="search_option_3" name="search_option"
value="3"<?php if ($search_option == 3) echo ' checked="checked"'; ?> />
<label for="search_option_3">
<?php echo $GLOBALS['strSearchOption3']; ?></label><br />
<input type="radio" id="search_option_4" name="search_option"
value="4"<?php if ($search_option == 4) echo ' checked="checked"'; ?> />
<label for="search_option_4">
<?php echo $GLOBALS['strSearchOption4']; ?></label>
<?php echo PMA_showMySQLDocu('Regexp', 'Regexp'); ?><br />
<br />
<sup>1</sup><?php echo $GLOBALS['strSplitWordsWithSpace']; ?></td>
</tr>
<tr><td align="right" valign="top">
<?php echo $GLOBALS['strSearchInTables']; ?></td>
<td rowspan="2">
<?php
echo ' <select name="table_select[]" size="6" multiple="multiple">' . "\n";
foreach ($tables_names_only as $each_table) {
if (in_array($each_table, $tables_selected)) {
$is_selected = ' selected="selected"';
} else {
$is_selected = '';
}
echo ' <option value="' . htmlspecialchars($each_table) . '"'
. $is_selected . '>'
. str_replace(' ', '&nbsp;', htmlspecialchars($each_table)) . '</option>' . "\n";
} // end while
echo ' </select>' . "\n";
$alter_select =
'<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('selectall' => 1))) . '#db_search"'
. ' onclick="setSelectOptions(\'db_search\', \'table_select[]\', true); return false;">' . $GLOBALS['strSelectAll'] . '</a>'
. '&nbsp;/&nbsp;'
. '<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('unselectall' => 1))) . '#db_search"'
. ' onclick="setSelectOptions(\'db_search\', \'table_select[]\', false); return false;">' . $GLOBALS['strUnselectAll'] . '</a>';
?>
</td>
</tr>
<tr><td align="right" valign="bottom">
<?php echo $alter_select; ?></td></tr>
</tr>
</table>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="submit_search" value="<?php echo $GLOBALS['strGo']; ?>"
id="buttonGo" />
</fieldset>
</form>
<?php
/**
* Displays the footer
*/
require_once './libraries/footer.inc.php';
?>

40
db_sql.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @version $Id$
*/
/**
*
*/
require_once './libraries/common.inc.php';
/**
* Runs common work
*/
require './libraries/db_common.inc.php';
require_once './libraries/sql_query_form.lib.php';
/**
* Gets informations about the database and, if it is empty, move to the
* "db_structure.php" script where table can be created
*/
require './libraries/db_info.inc.php';
if ($num_tables == 0 && empty($db_query_force)) {
$sub_part = '';
$is_info = TRUE;
require './db_structure.php';
exit();
}
/**
* Query box, bookmark, insert data from textfile
*/
PMA_sqlQueryForm(true, false, isset($_REQUEST['delimiter']) ? $_REQUEST['delimiter'] : ';');
/**
* Displays the footer
*/
require_once './libraries/footer.inc.php';
?>

554
db_structure.php Normal file
View File

@@ -0,0 +1,554 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @version $Id$
*/
/**
*
*/
require_once './libraries/common.inc.php';
require_once './libraries/Table.class.php';
/**
* Prepares the tables list if the user where not redirected to this script
* because there is no table in the database ($is_info is true)
*/
if (empty($is_info)) {
// Drops/deletes/etc. multiple tables if required
if ((!empty($submit_mult) && isset($selected_tbl))
|| isset($mult_btn)) {
$action = 'db_structure.php';
$err_url = 'db_structure.php?'. PMA_generate_common_url($db);
require './libraries/mult_submits.inc.php';
$message = $strSuccess;
}
require './libraries/db_common.inc.php';
$url_query .= '&amp;goto=db_structure.php';
// Gets the database structure
$sub_part = '_structure';
require './libraries/db_info.inc.php';
}
// 1. No tables
if ($num_tables == 0) {
echo '<p>' . $strNoTablesFound . '</p>' . "\n";
if (empty($db_is_information_schema)) {
require './libraries/display_create_table.lib.php';
} // end if (Create Table dialog)
/**
* Displays the footer
*/
require_once './libraries/footer.inc.php';
exit;
}
// else
// 2. Shows table informations - staybyte - 11 June 2001
require_once './libraries/bookmark.lib.php';
if (PMA_MYSQL_INT_VERSION >= 40101) {
require_once './libraries/mysql_charsets.lib.php';
$db_collation = PMA_getDbCollation($db);
}
// Display function
/**
* void PMA_TableHeader([bool $db_is_information_schema = false])
* display table header (<table><thead>...</thead><tbody>)
*
* @uses PMA_showHint()
* @uses PMA_MYSQL_INT_VERSION
* @uses $GLOBALS['cfg']['PropertiesNumColumns']
* @uses $GLOBALS['is_show_stats']
* @uses $GLOBALS['strTable']
* @uses $GLOBALS['strAction']
* @uses $GLOBALS['strRecords']
* @uses $GLOBALS['strApproximateCount']
* @uses $GLOBALS['strType']
* @uses $GLOBALS['strCollation']
* @uses $GLOBALS['strSize']
* @uses $GLOBALS['strOverhead']
* @uses $GLOBALS['structure_tbl_col_cnt']
* @param boolean $db_is_information_schema
*/
function PMA_TableHeader($db_is_information_schema = false)
{
$cnt = 0; // Let's count the columns...
if ($db_is_information_schema) {
$action_colspan = 3;
} else {
$action_colspan = 6;
}
echo '<table class="data" style="float: left;">' . "\n"
.'<thead>' . "\n"
.'<tr><td></td>' . "\n"
.' <th>' . $GLOBALS['strTable'] . '</th>' . "\n"
.' <th colspan="' . $action_colspan . '">' . "\n"
.' ' . $GLOBALS['strAction'] . "\n"
.' </th>'
.' <th>' . $GLOBALS['strRecords']
.PMA_showHint($GLOBALS['strApproximateCount']) . "\n"
.' </th>' . "\n";
if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) {
echo ' <th>' . $GLOBALS['strType'] . '</th>' . "\n";
$cnt++;
if (PMA_MYSQL_INT_VERSION >= 40100) {
echo ' <th>' . $GLOBALS['strCollation'] . '</th>' . "\n";
$cnt++;
}
}
if ($GLOBALS['is_show_stats']) {
echo ' <th>' . $GLOBALS['strSize'] . '</th>' . "\n"
. ' <th>' . $GLOBALS['strOverhead'] . '</th>' . "\n";
$cnt += 2;
}
echo '</tr>' . "\n";
echo '</thead>' . "\n";
echo '<tbody>' . "\n";
$GLOBALS['structure_tbl_col_cnt'] = $cnt + $action_colspan + 3;
} // end function PMA_TableHeader()
$titles = array();
if (true == $cfg['PropertiesIconic']) {
$titles['Browse'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_browse.png" alt="' . $strBrowse . '" title="' . $strBrowse . '" />';
$titles['NoBrowse'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_browse.png" alt="' . $strBrowse . '" title="' . $strBrowse . '" />';
$titles['Search'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_select.png" alt="' . $strSearch . '" title="' . $strSearch . '" />';
$titles['NoSearch'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_select.png" alt="' . $strSearch . '" title="' . $strSearch . '" />';
$titles['Insert'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_insrow.png" alt="' . $strInsert . '" title="' . $strInsert . '" />';
$titles['NoInsert'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_insrow.png" alt="' . $strInsert . '" title="' . $strInsert . '" />';
$titles['Structure'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_props.png" alt="' . $strStructure . '" title="' . $strStructure . '" />';
$titles['Drop'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />';
$titles['NoDrop'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />';
$titles['Empty'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_empty.png" alt="' . $strEmpty . '" title="' . $strEmpty . '" />';
$titles['NoEmpty'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_empty.png" alt="' . $strEmpty . '" title="' . $strEmpty . '" />';
if ('both' === $cfg['PropertiesIconic']) {
$titles['Browse'] .= $strBrowse;
$titles['Search'] .= $strSearch;
$titles['NoBrowse'] .= $strBrowse;
$titles['NoSearch'] .= $strSearch;
$titles['Insert'] .= $strInsert;
$titles['NoInsert'] .= $strInsert;
$titles['Structure'] .= $strStructure;
$titles['Drop'] .= $strDrop;
$titles['NoDrop'] .= $strDrop;
$titles['Empty'] .= $strEmpty;
$titles['NoEmpty'] .= $strEmpty;
}
} else {
$titles['Browse'] = $strBrowse;
$titles['Search'] = $strSearch;
$titles['NoBrowse'] = $strBrowse;
$titles['NoSearch'] = $strSearch;
$titles['Insert'] = $strInsert;
$titles['NoInsert'] = $strInsert;
$titles['Structure'] = $strStructure;
$titles['Drop'] = $strDrop;
$titles['NoDrop'] = $strDrop;
$titles['Empty'] = $strEmpty;
$titles['NoEmpty'] = $strEmpty;
}
/**
* Displays the tables list
*/
$_url_params = array(
'pos' => $pos,
'db' => $db);
PMA_listNavigator($total_num_tables, $pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList']);
?>
<form method="post" action="db_structure.php" name="tablesForm" id="tablesForm">
<?php
echo PMA_generate_common_hidden_inputs($db);
PMA_TableHeader($db_is_information_schema);
$i = $sum_entries = 0;
$sum_size = (double) 0;
$overhead_size = (double) 0;
$overhead_check = '';
$checked = !empty($checkall) ? ' checked="checked"' : '';
$num_columns = $cfg['PropertiesNumColumns'] > 1 ? ceil($num_tables / $cfg['PropertiesNumColumns']) + 1 : 0;
$row_count = 0;
$hidden_fields = array();
$odd_row = true;
$at_least_one_view_exceeds_max_count = false;
$sum_row_count_pre = '';
foreach ($tables as $keyname => $each_table) {
if ($each_table['TABLE_ROWS'] === null || $each_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount']) {
$each_table['TABLE_ROWS'] = PMA_Table::countRecords($db,
$each_table['TABLE_NAME'], $return = true, $force_exact = true);
}
$table_encoded = urlencode($each_table['TABLE_NAME']);
// MySQL < 5.0.13 returns "view", >= 5.0.13 returns "VIEW"
$table_is_view = ($each_table['TABLE_TYPE'] === 'VIEW'
|| $each_table['TABLE_TYPE'] === 'SYSTEM VIEW');
$alias = (!empty($tooltip_aliasname) && isset($tooltip_aliasname[$each_table['TABLE_NAME']]))
? str_replace(' ', '&nbsp;', htmlspecialchars($tooltip_truename[$each_table['TABLE_NAME']]))
: str_replace(' ', '&nbsp;', htmlspecialchars($each_table['TABLE_NAME']));
$truename = (!empty($tooltip_truename) && isset($tooltip_truename[$each_table['TABLE_NAME']]))
? str_replace(' ', '&nbsp;', htmlspecialchars($tooltip_truename[$each_table['TABLE_NAME']]))
: str_replace(' ', '&nbsp;', htmlspecialchars($each_table['TABLE_NAME']));
// Sets parameters for links
$tbl_url_query = $url_query . '&amp;table=' . $table_encoded;
$i++;
$row_count++;
if ($table_is_view) {
$hidden_fields[] = '<input type="hidden" name="views[]" value="' . $table_encoded . '" />';
}
if ($each_table['TABLE_ROWS'] > 0) {
$browse_table = '<a href="sql.php?' . $tbl_url_query . '&amp;pos=0">' . $titles['Browse'] . '</a>';
$search_table = '<a href="tbl_select.php?' . $tbl_url_query . '">' . $titles['Search'] . '</a>';
} else {
$browse_table = $titles['NoBrowse'];
$search_table = $titles['NoSearch'];
}
if (! $db_is_information_schema) {
if (! empty($each_table['TABLE_ROWS'])) {
$empty_table = '<a href="sql.php?' . $tbl_url_query
. '&amp;sql_query=';
if (PMA_MYSQL_INT_VERSION >= 40000) {
$empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME']))
. '&amp;zero_rows='
. urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($each_table['TABLE_NAME'])))
. '" onclick="return confirmLink(this, \'TRUNCATE ';
} else {
$empty_table .= urlencode('DELETE FROM ' . PMA_backquote($each_table['TABLE_NAME']))
. '&amp;zero_rows='
. urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($each_table['TABLE_NAME'])))
. '" onclick="return confirmLink(this, \'DELETE FROM ';
}
$empty_table .= PMA_jsFormat($each_table['TABLE_NAME']) . '\')">' . $titles['Empty'] . '</a>';
} else {
$empty_table = $titles['NoEmpty'];
}
$drop_query = 'DROP '
. ($table_is_view ? 'VIEW' : 'TABLE')
. ' ' . PMA_backquote($each_table['TABLE_NAME']);
$drop_message = sprintf(
$table_is_view ? $strViewHasBeenDropped : $strTableHasBeenDropped,
str_replace(' ', '&nbsp;', htmlspecialchars($each_table['TABLE_NAME'])));
}
// loic1: Patch from Joshua Nye <josh at boxcarmedia.com> to get valid
// statistics whatever is the table type
if (isset($each_table['TABLE_ROWS'])) {
// MyISAM, ISAM or Heap table: Row count, data size and index size
// is accurate.
if (preg_match('@^(MyISAM|ISAM|HEAP|MEMORY)$@', $each_table['ENGINE'])) {
if ($is_show_stats) {
$tblsize = doubleval($each_table['Data_length']) + doubleval($each_table['Index_length']);
$sum_size += $tblsize;
list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0);
if (isset($each_table['Data_free']) && $each_table['Data_free'] > 0) {
list($formatted_overhead, $overhead_unit) = PMA_formatByteDown($each_table['Data_free'], 3, ($each_table['Data_free'] > 0) ? 1 : 0);
$overhead_size += $each_table['Data_free'];
}
}
$sum_entries += $each_table['TABLE_ROWS'];
} elseif ($each_table['ENGINE'] == 'InnoDB') {
// InnoDB table: Row count is not accurate but data and index
// sizes are.
if ($is_show_stats) {
$tblsize = $each_table['Data_length'] + $each_table['Index_length'];
$sum_size += $tblsize;
list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0);
}
//$display_rows = ' - ';
$sum_entries += $each_table['TABLE_ROWS'];
} elseif (preg_match('@^(MRG_MyISAM|BerkeleyDB)$@', $each_table['ENGINE'])) {
// Merge or BerkleyDB table: Only row count is accurate.
if ($is_show_stats) {
$formatted_size = ' - ';
$unit = '';
}
$sum_entries += $each_table['TABLE_ROWS'];
} else {
// Unknown table type.
if ($is_show_stats) {
$formatted_size = 'unknown';
$unit = '';
}
}
if (PMA_MYSQL_INT_VERSION >= 40100) {
if (isset($each_table['Collation'])) {
$collation = '<dfn title="'
. PMA_getCollationDescr($each_table['Collation']) . '">'
. $each_table['Collation'] . '</dfn>';
} else {
$collation = '---';
}
}
if ($is_show_stats) {
if (isset($formatted_overhead)) {
$overhead = '<a href="tbl_structure.php?'
. $tbl_url_query . '#showusage">' . $formatted_overhead
. ' ' . $overhead_unit . '</a>' . "\n";
unset($formatted_overhead);
$overhead_check .=
"document.getElementById('checkbox_tbl_$i').checked = true;";
} else {
$overhead = '-';
}
} // end if
} // end if (isset($each_table['TABLE_ROWS'])
if ($num_columns > 0 && $num_tables > $num_columns
&& (($row_count % $num_columns) == 0)) {
$row_count = 1;
$odd_row = true;
?>
</tr>
</tbody>
</table>
<?php
PMA_TableHeader();
}
?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
<td align="center">
<input type="checkbox" name="selected_tbl[]"
value="<?php echo $table_encoded; ?>"
id="checkbox_tbl_<?php echo $i; ?>"<?php echo $checked; ?> /></td>
<th><label for="checkbox_tbl_<?php echo $i; ?>"
title="<?php echo $alias; ?>"><?php echo $truename; ?></label>
</th>
<td align="center"><?php echo $browse_table; ?></td>
<td align="center">
<a href="tbl_structure.php?<?php echo $tbl_url_query; ?>">
<?php echo $titles['Structure']; ?></a></td>
<td align="center"><?php echo $search_table; ?></td>
<?php if (! $db_is_information_schema) { ?>
<td align="center">
<a href="tbl_change.php?<?php echo $tbl_url_query; ?>">
<?php echo $titles['Insert']; ?></a></td>
<td align="center"><?php echo $empty_table; ?></td>
<td align="center">
<a href="sql.php?<?php echo $tbl_url_query;
?>&amp;reload=1&amp;purge=1&amp;sql_query=<?php
echo urlencode($drop_query); ?>&amp;zero_rows=<?php
echo urlencode($drop_message); ?>"
onclick="return confirmLink(this, '<?php echo PMA_jsFormat($drop_query, false); ?>')">
<?php echo $titles['Drop']; ?></a></td>
<?php } // end if (! $db_is_information_schema)
// there is a null value in the ENGINE
// - when the table needs to be repaired, or
// - when it's a view
// so ensure that we'll display "in use" below for a table
// that needs to be repaired
if (isset($each_table['TABLE_ROWS']) && ($each_table['ENGINE'] != null || $table_is_view)) {
if ($table_is_view && $each_table['TABLE_ROWS'] >= $cfg['MaxExactCountViews']) {
$at_least_one_view_exceeds_max_count = true;
$row_count_pre = '~';
$sum_row_count_pre = '~';
$show_superscript = '<sup>1</sup>';
} elseif($each_table['ENGINE'] == 'InnoDB') {
// InnoDB table: Row count is not accurate
$row_count_pre = '~';
$sum_row_count_pre = '~';
$show_superscript = '';
} else {
$row_count_pre = '';
$show_superscript = '';
}
?>
<td class="value"><?php echo $row_count_pre . PMA_formatNumber($each_table['TABLE_ROWS'], 0) . $show_superscript; ?></td>
<?php if (!($cfg['PropertiesNumColumns'] > 1)) { ?>
<td nowrap="nowrap"><?php echo ($table_is_view ? $strView : $each_table['ENGINE']); ?></td>
<?php if (isset($collation)) { ?>
<td nowrap="nowrap"><?php echo $collation ?></td>
<?php } ?>
<?php } ?>
<?php if ($is_show_stats) { ?>
<td class="value"><a
href="tbl_structure.php?<?php echo $tbl_url_query; ?>#showusage"
><?php echo $formatted_size . ' ' . $unit; ?></a></td>
<td class="value"><?php echo $overhead; ?></td>
<?php } // end if ?>
<?php } elseif ($table_is_view) { ?>
<td class="value">-</td>
<td><?php echo $strView; ?></td>
<td>---</td>
<?php if ($is_show_stats) { ?>
<td class="value">-</td>
<td class="value">-</td>
<?php } ?>
<?php } else { ?>
<td colspan="<?php echo ($structure_tbl_col_cnt - ($db_is_information_schema ? 5 : 8)) ?>"
align="center">
<?php echo $strInUse; ?></td>
<?php } // end if (isset($each_table['TABLE_ROWS'])) else ?>
</tr>
<?php
} // end foreach
// Show Summary
if ($is_show_stats) {
list($sum_formatted, $unit) = PMA_formatByteDown($sum_size, 3, 1);
list($overhead_formatted, $overhead_unit) =
PMA_formatByteDown($overhead_size, 3, 1);
}
?>
</tbody>
<tbody>
<tr><td></td>
<th align="center" nowrap="nowrap">
<?php echo sprintf($strTables, PMA_formatNumber($num_tables, 0)); ?>
</th>
<th colspan="<?php echo ($db_is_information_schema ? 3 : 6) ?>" align="center">
<?php echo $strSum; ?></th>
<th class="value"><?php echo $sum_row_count_pre . PMA_formatNumber($sum_entries, 0); ?></th>
<?php
if (!($cfg['PropertiesNumColumns'] > 1)) {
$default_engine = PMA_DBI_get_default_engine();
echo ' <th align="center">' . "\n"
. ' <dfn title="'
. sprintf($strDefaultEngine, $default_engine) . '">' .$default_engine . '</dfn></th>' . "\n";
// Have to account for old MySQL with no collation (bug 1554885)
if (PMA_MYSQL_INT_VERSION >= 40100) {
// we got a case where $db_collation was empty
echo ' <th align="center">' . "\n";
if (! empty($db_collation)) {
echo ' <dfn title="'
. PMA_getCollationDescr($db_collation) . ' (' . $strDefault . ')">' . $db_collation
. '</dfn>';
}
echo '</th>';
}
}
if ($is_show_stats) {
?>
<th class="value"><?php echo $sum_formatted . ' ' . $unit; ?></th>
<th class="value"><?php echo $overhead_formatted . ' ' . $overhead_unit; ?></th>
<?php
}
?>
</tr>
</tbody>
</table>
<div class="clearfloat">
<?php
// Check all tables url
$checkall_url = 'db_structure.php?' . PMA_generate_common_url($db);
?>
<img class="selectallarrow" src="<?php echo $pmaThemeImage .'arrow_'.$text_dir.'.png'; ?>"
width="38" height="22" alt="<?php echo $strWithChecked; ?>" />
<a href="<?php echo $checkall_url; ?>&amp;checkall=1"
onclick="if (markAllRows('tablesForm')) return false;">
<?php echo $strCheckAll; ?></a>
/
<a href="<?php echo $checkall_url; ?>"
onclick="if (unMarkAllRows('tablesForm')) return false;">
<?php echo $strUncheckAll; ?></a>
<?php if ($overhead_check != '') { ?>
/
<a href="#" onclick="unMarkAllRows('tablesForm');
<?php echo $overhead_check; ?> return false;">
<?php echo $strCheckOverhead; ?></a>
<?php } ?>
<select name="submit_mult" onchange="this.form.submit();" style="margin: 0 3em 0 3em;">
<?php
echo ' <option value="' . $strWithChecked . '" selected="selected">'
. $strWithChecked . '</option>' . "\n";
echo ' <option value="' . $strEmpty . '" >'
. $strEmpty . '</option>' . "\n";
echo ' <option value="' . $strDrop . '" >'
. $strDrop . '</option>' . "\n";
echo ' <option value="' . $strPrintView . '" >'
. $strPrintView . '</option>' . "\n";
echo ' <option value="' . $strCheckTable . '" >'
. $strCheckTable . '</option>' . "\n";
echo ' <option value="' . $strOptimizeTable . '" >'
. $strOptimizeTable . '</option>' . "\n";
echo ' <option value="' . $strRepairTable . '" >'
. $strRepairTable . '</option>' . "\n";
echo ' <option value="' . $strAnalyzeTable . '" >'
. $strAnalyzeTable . '</option>' . "\n";
?>
</select>
<script type="text/javascript">
<!--
// Fake js to allow the use of the <noscript> tag
//-->
</script>
<noscript>
<input type="submit" value="<?php echo $strGo; ?>" />
</noscript>
<?php echo implode("\n", $hidden_fields) . "\n"; ?>
</div>
</form>
<?php
// Notice about row count for views
if ($at_least_one_view_exceeds_max_count && !$db_is_information_schema) {
echo '<div class="notice">' . "\n";
echo '<sup>1</sup>' . PMA_sanitize(sprintf($strViewMaxExactCount, PMA_formatNumber($cfg['MaxExactCountViews'], 0), '[a@./Documentation.html#cfg_MaxExactCountViews@_blank]', '[/a]')) . "\n";
echo '</div>' . "\n";
}
?>
<hr />
<?php
// Routines
require './libraries/db_routines.inc.php';
/**
* Work on the database
* redesigned 2004-05-08 by mkkeck
*/
/* DATABASE WORK */
/* Printable view of a table */
echo '<p>';
echo '<a href="db_printview.php?' . $url_query . '">';
if ($cfg['PropertiesIconic']) {
echo '<img class="icon" src="' . $pmaThemeImage
.'b_print.png" width="16" height="16" alt="" />';
}
echo $strPrintView . '</a> ';
echo '<a href="./db_datadict.php?' . $url_query . '">';
if ($cfg['PropertiesIconic']) {
echo '<img class="icon" src="' . $pmaThemeImage
.'b_tblanalyse.png" width="16" height="16" alt="" />';
}
echo $strDataDict . '</a>';
echo '</p>';
if (empty($db_is_information_schema)) {
require './libraries/display_create_table.lib.php';
} // end if (Create Table dialog)
/**
* Displays the footer
*/
require_once './libraries/footer.inc.php';
?>

277
docs.css Normal file
View File

@@ -0,0 +1,277 @@
/* $Id$ */
/* Stylesheet for phpMyAdmin documentation */
/* vim: expandtab ts=4 sw=4 sts=4 tw=78
*/
body {
background-color: #ffffff;
font-family: sans-serif;
color: #000000;
margin: 0;
padding: 2em 0 2em 0;
}
img {
border: 0;
}
abbr, acronym {
border-bottom: 1px dotted;
}
abbr, acronym {
cursor: help;
}
a {
text-decoration: none;
color: #000099;
background-color: #ffffff;
/* font-weight: normal;*/
}
a:hover {
/* background-color: #99CCFF;*/
color: #000099;
background-color: #ffffff;
text-decoration: underline;
/* font-weight: bolder */
}
sup {
font-size: 0.7em;
}
sup:before {
content: ' [';
}
sup:after {
content: ']';
}
ul.header {
width: 100%;
background-color: #ddeeff;
color: #000000;
text-align: center;
padding: 0 0 2px 0;
border-bottom: 1px solid #000000;
font-weight: bold;
left: 0;
top: 0;
position: fixed;
margin: 0;
/* following MSIE hack was originally written by Riki Fridrich
* <http://www.fczbkk.com> */
/* position: expression("absolute");*/
/* width: expression(document.body.clientWidth);*/
/* top: expression(document.body.scrollTop + this.offsetHeight - this.offsetHeight);*/
}
ul.header li {
margin: 0;
padding: 0;
display: inline;
}
ul.header li:before {
content: ' - ';
}
ul.header li:first-child:before {
content: '';
}
ul.header a {
text-decoration: none;
font-size: medium;
color: #000099;
background-color: #ddeeff;
font-weight: normal;
}
ul.header a:hover {
color: #000099;
background-color: #99CCFF;
/* font-weight: bolder;*/
}
h1 {
text-align: center;
padding-left: 8%;
margin-top: 1em;
color: #000000;
background-color: #ddeeff;
font-size: x-large;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
clear: both;
}
h2 {
padding-left: 8%;
padding-top: 2em;
margin-top: 1em;
color: #000000;
background-color: #ddeeff;
font-size: large;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
clear: both;
/* counter-reset: heading3;
counter-increment: heading2; */
}
/*h2:before {
content: counter(heading2) '. ';
} */
h3 {
padding-left: 10%;
padding-top: 3em;
margin-top: 1em;
color: #000000;
background-color: #ddeeff;
font-size: medium;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
clear: both;
/* counter-reset: heading4;
counter-increment: heading3; */
}
/*h3:before {
content: counter(heading2) '.' counter(heading3) '. ';
} */
h4, h5 {
padding: 3em 0 0 0;
margin: 10px 5% 2px 5%;
font-weight: bold;
color: #000099;
background-color: #ffffff;
/* counter-increment: heading4; */
}
/* h4:before {
content: counter(heading2) '.' counter(heading3) '.' counter(heading4) '. ';
}
h5 {
counter-increment: heading5;
}
h5:before {
content: counter(heading2) '.' counter(heading3) '.' counter(heading4) counter(heading5,lower-alpha);
} */
p {
margin: 2px 5% 1em 5%;
}
table {
margin: 2px 5% 2px 5%;
border: none;
}
table tr,table td,table th {
border: none;
}
table.translators {
text-align: center;
display: table; margin-left: auto; margin-right: auto;
border-collapse: collapse;
}
table.translators th {
color: #000000;
background-color: #d3dce3;
}
table.translators td, table.translators th {
border: 1px solid #000000;
padding: 5px;
}
ul {
margin: 2px 5% 2px 5%;
}
pre {
margin: 1em 5% 1em 5%;
border: 1px solid silver;
color: #000000;
background-color: #eeeeee;
padding: 0.5em;
}
/* no more intend inside li */
li pre {
margin: 1em 0 1em 0;
}
pre.wrap {
white-space: normal;
}
dl {
margin: 1em 6% 1em 6%;
}
dt {
font-weight: bold;
margin-left: 2em;
padding-top: 3em;
}
dd {
margin-left: 4em;
margin-bottom: 1em;
}
ol {
margin: 1em 6% 1em 6%;
}
li {
margin-bottom: 1em;
}
.configrule {
font-family: monospace;
}
dt.configrule {
font-weight: bold;
}
.important {
color: #bb0000;
background-color: #ffeeee;
padding: 0 0.5em 0 0.5em;
}
p.important {
border: 1px dotted #ff0000;
padding: 0.5em;
}
.important:first-word {
font-weight: bold;
}
p.footnote {
margin: 0 5% 2px 7%;
padding-top: 3em;
}
p.footnote:first-line {
margin-left: -2%;
}
p#bottom {
text-align: right;
}
p#bottom img {
margin: 1em;
}

83
error.php Normal file
View File

@@ -0,0 +1,83 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* phpMyAdmin fatal error display page
*
* @version $Id$
*/
/* Input sanitizing */
require_once './libraries/sanitizing.lib.php';
/* Get variables */
if (! empty($_REQUEST['lang']) && is_string($_REQUEST['lang'])) {
$lang = htmlspecialchars($_REQUEST['lang']);
} else {
$lang = 'en';
}
if (! empty($_REQUEST['dir']) && is_string($_REQUEST['dir'])) {
$dir = htmlspecialchars($_REQUEST['dir']);
} else {
$dir = 'ltr';
}
if (! empty($_REQUEST['type']) && is_string($_REQUEST['type'])) {
$type = htmlspecialchars($_REQUEST['type']);
} else {
$type = 'error';
}
// force utf-8 to avoid XSS with crafted URL and utf-7 in charset parameter
$charset = 'utf-8';
header('Content-Type: text/html; charset=' . $charset);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $lang; ?>" dir="<?php echo $dir; ?>">
<head>
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<title>phpMyAdmin</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
<style type="text/css">
<!--
html {
padding: 0;
margin: 0;
}
body {
font-family: sans-serif;
font-size: small;
color: #000000;
background-color: #F5F5F5;
margin: 1em;
}
h1 {
margin: 0;
padding: 0.3em;
font-size: 1.4em;
font-weight: bold;
color: #ffffff;
background-color: #ff0000;
}
p {
margin: 0;
padding: 0.5em;
border: 0.1em solid red;
background-color: #ffeeee;
}
//-->
</style>
</head>
<body>
<h1>phpMyAdmin - <?php echo $type; ?></h1>
<p><?php
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
echo PMA_sanitize(stripslashes($_REQUEST['error']));
} else {
echo PMA_sanitize($_REQUEST['error']);
}
?></p>
</body>
</html>

671
export.php Normal file
View File

@@ -0,0 +1,671 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @todo too much die here, or?
* @version $Id$
*/
/**
* Get the variables sent or posted to this script and a core script
*/
require_once './libraries/common.inc.php';
require_once './libraries/zip.lib.php';
require_once './libraries/plugin_interface.lib.php';
PMA_checkParameters(array('what', 'export_type'));
// Scan plugins
$export_list = PMA_getPlugins('./libraries/export/', array('export_type' => $export_type, 'single_table' => isset($single_table)));
// Backward compatbility
$type = $what;
// Check export type
if (!isset($export_list[$type])) {
die('Bad type!');
}
/**
* valid compression methods
*/
$compression_methods = array(
'zip',
'gzip',
'bzip',
);
/**
* init and variable checking
*/
$compression = false;
$onserver = false;
$save_on_server = false;
$buffer_needed = false;
if (empty($_REQUEST['asfile'])) {
$asfile = false;
} else {
$asfile = true;
if (in_array($_REQUEST['compression'], $compression_methods)) {
$compression = $_REQUEST['compression'];
$buffer_needed = true;
}
if (!empty($_REQUEST['onserver'])) {
$onserver = $_REQUEST['onserver'];
// Will we save dump on server?
$save_on_server = ! empty($cfg['SaveDir']) && $onserver;
}
}
// Does export require to be into file?
if (isset($export_list[$type]['force_file']) && ! $asfile) {
$message = $strExportMustBeFile;
$GLOBALS['show_error_header'] = true;
$js_to_run = 'functions.js';
require_once './libraries/header.inc.php';
if ($export_type == 'server') {
$active_page = 'server_export.php';
require './server_export.php';
} elseif ($export_type == 'database') {
$active_page = 'db_export.php';
require './db_export.php';
} else {
$active_page = 'tbl_export.php';
require './tbl_export.php';
}
exit();
}
// Generate error url and check for needed variables
if ($export_type == 'server') {
$err_url = 'server_export.php?' . PMA_generate_common_url();
} elseif ($export_type == 'database' && strlen($db)) {
$err_url = 'db_export.php?' . PMA_generate_common_url($db);
// Check if we have something to export
if (isset($table_select)) {
$tables = $table_select;
} else {
$tables = array();
}
} elseif ($export_type == 'table' && strlen($db) && strlen($table)) {
$err_url = 'tbl_export.php?' . PMA_generate_common_url($db, $table);
} else {
die('Bad parameters!');
}
// Get the functions specific to the export type
require './libraries/export/' . PMA_securePath($type) . '.php';
/**
* Increase time limit for script execution and initializes some variables
*/
@set_time_limit($cfg['ExecTimeLimit']);
if (!empty($cfg['MemoryLimit'])) {
@ini_set('memory_limit', $cfg['MemoryLimit']);
}
// Start with empty buffer
$dump_buffer = '';
$dump_buffer_len = 0;
// We send fake headers to avoid browser timeout when buffering
$time_start = time();
/**
* Output handler for all exports, if needed buffering, it stores data into
* $dump_buffer, otherwise it prints thems out.
*
* @param string the insert statement
*
* @return bool Whether output suceeded
*/
function PMA_exportOutputHandler($line)
{
global $time_start, $dump_buffer, $dump_buffer_len, $save_filename;
// Kanji encoding convert feature
if ($GLOBALS['output_kanji_conversion']) {
$line = PMA_kanji_str_conv($line, $GLOBALS['knjenc'], isset($GLOBALS['xkana']) ? $GLOBALS['xkana'] : '');
}
// If we have to buffer data, we will perform everything at once at the end
if ($GLOBALS['buffer_needed']) {
$dump_buffer .= $line;
if ($GLOBALS['onfly_compression']) {
$dump_buffer_len += strlen($line);
if ($dump_buffer_len > $GLOBALS['memory_limit']) {
if ($GLOBALS['output_charset_conversion']) {
$dump_buffer = PMA_convert_string($GLOBALS['charset'], $GLOBALS['charset_of_file'], $dump_buffer);
}
// as bzipped
if ($GLOBALS['compression'] == 'bzip' && @function_exists('bzcompress')) {
$dump_buffer = bzcompress($dump_buffer);
}
// as a gzipped file
elseif ($GLOBALS['compression'] == 'gzip' && @function_exists('gzencode')) {
// without the optional parameter level because it bug
$dump_buffer = gzencode($dump_buffer);
}
if ($GLOBALS['save_on_server']) {
$write_result = @fwrite($GLOBALS['file_handle'], $dump_buffer);
if (!$write_result || ($write_result != strlen($dump_buffer))) {
$GLOBALS['message'] = sprintf($GLOBALS['strNoSpace'], htmlspecialchars($save_filename));
$GLOBALS['show_error_header'] = true;
return false;
}
} else {
echo $dump_buffer;
}
$dump_buffer = '';
$dump_buffer_len = 0;
}
} else {
$time_now = time();
if ($time_start >= $time_now + 30) {
$time_start = $time_now;
header('X-pmaPing: Pong');
} // end if
}
} else {
if ($GLOBALS['asfile']) {
if ($GLOBALS['save_on_server'] && strlen($line) > 0) {
$write_result = @fwrite($GLOBALS['file_handle'], $line);
if (!$write_result || ($write_result != strlen($line))) {
$GLOBALS['message'] = sprintf($GLOBALS['strNoSpace'], htmlspecialchars($save_filename));
$GLOBALS['show_error_header'] = true;
return false;
}
$time_now = time();
if ($time_start >= $time_now + 30) {
$time_start = $time_now;
header('X-pmaPing: Pong');
} // end if
} else {
// We export as file - output normally
if ($GLOBALS['output_charset_conversion']) {
$line = PMA_convert_string($GLOBALS['charset'], $GLOBALS['charset_of_file'], $line);
}
echo $line;
}
} else {
// We export as html - replace special chars
echo htmlspecialchars($line);
}
}
return true;
} // end of the 'PMA_exportOutputHandler()' function
// Defines the default <CR><LF> format. For SQL always use \n as MySQL wants this on all platforms.
if ($what == 'sql') {
$crlf = "\n";
} else {
$crlf = PMA_whichCrlf();
}
$output_kanji_conversion = function_exists('PMA_kanji_str_conv') && $type != 'xls';
// Do we need to convert charset?
$output_charset_conversion = $asfile &&
$cfg['AllowAnywhereRecoding'] && $allow_recoding
&& isset($charset_of_file) && $charset_of_file != $charset
&& $type != 'xls';
// Use on fly compression?
$onfly_compression = $GLOBALS['cfg']['CompressOnFly'] && ($compression == 'gzip' | $compression == 'bzip');
if ($onfly_compression) {
$memory_limit = trim(@ini_get('memory_limit'));
// 2 MB as default
if (empty($memory_limit)) {
$memory_limit = 2 * 1024 * 1024;
}
if (strtolower(substr($memory_limit, -1)) == 'm') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024;
} elseif (strtolower(substr($memory_limit, -1)) == 'k') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024;
} elseif (strtolower(substr($memory_limit, -1)) == 'g') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
} else {
$memory_limit = (int)$memory_limit;
}
// Some of memory is needed for other thins and as treshold.
// Nijel: During export I had allocated (see memory_get_usage function)
// approx 1.2MB so this comes from that.
if ($memory_limit > 1500000) {
$memory_limit -= 1500000;
}
// Some memory is needed for compression, assume 1/3
$memory_limit /= 8;
}
// Generate filename and mime type if needed
if ($asfile) {
$pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
if ($export_type == 'server') {
if (isset($remember_template)) {
PMA_setCookie('pma_server_filename_template', $filename_template);
}
$filename = str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template));
} elseif ($export_type == 'database') {
if (isset($remember_template)) {
PMA_setCookie('pma_db_filename_template', $filename_template);
}
$filename = str_replace('__DB__', $db, str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template)));
} else {
if (isset($remember_template)) {
PMA_setCookie('pma_table_filename_template', $filename_template);
}
$filename = str_replace('__TABLE__', $table, str_replace('__DB__', $db, str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template))));
}
// convert filename to iso-8859-1, it is safer
if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)) {
$filename = PMA_convert_string($charset, 'iso-8859-1', $filename);
} else {
$filename = PMA_convert_string($convcharset, 'iso-8859-1', $filename);
}
// Grab basic dump extension and mime type
$filename .= '.' . $export_list[$type]['extension'];
$mime_type = $export_list[$type]['mime_type'];
// If dump is going to be compressed, set correct encoding or mime_type and add
// compression to extension
$content_encoding = '';
if ($compression == 'bzip') {
$filename .= '.bz2';
// browsers don't like this:
//$content_encoding = 'x-bzip2';
$mime_type = 'application/x-bzip2';
} elseif ($compression == 'gzip') {
$filename .= '.gz';
// Needed to avoid recompression by server modules like mod_gzip.
// It seems necessary to check about zlib.output_compression
// to avoid compressing twice
if (!@ini_get('zlib.output_compression')) {
$content_encoding = 'x-gzip';
$mime_type = 'application/x-gzip';
}
} elseif ($compression == 'zip') {
$filename .= '.zip';
$mime_type = 'application/zip';
}
}
// Open file on server if needed
if ($save_on_server) {
$save_filename = PMA_userDir($cfg['SaveDir']) . preg_replace('@[/\\\\]@', '_', $filename);
unset($message);
if (file_exists($save_filename) && empty($onserverover)) {
$message = sprintf($strFileAlreadyExists, htmlspecialchars($save_filename));
$GLOBALS['show_error_header'] = true;
} else {
if (is_file($save_filename) && !is_writable($save_filename)) {
$message = sprintf($strNoPermission, htmlspecialchars($save_filename));
$GLOBALS['show_error_header'] = true;
} else {
if (!$file_handle = @fopen($save_filename, 'w')) {
$message = sprintf($strNoPermission, htmlspecialchars($save_filename));
$GLOBALS['show_error_header'] = true;
}
}
}
if (isset($message)) {
$js_to_run = 'functions.js';
require_once './libraries/header.inc.php';
if ($export_type == 'server') {
$active_page = 'server_export.php';
require './server_export.php';
} elseif ($export_type == 'database') {
$active_page = 'db_export.php';
require './db_export.php';
} else {
$active_page = 'tbl_export.php';
require './tbl_export.php';
}
exit();
}
}
/**
* Send headers depending on whether the user chose to download a dump file
* or not
*/
if (!$save_on_server) {
if ($asfile) {
// Download
if (!empty($content_encoding)) {
header('Content-Encoding: ' . $content_encoding);
}
header('Content-Type: ' . $mime_type);
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// lem9: Tested behavior of
// IE 5.50.4807.2300
// IE 6.0.2800.1106 (small glitch, asks twice when I click Open)
// IE 6.0.2900.2180
// Firefox 1.0.6
// in http and https
header('Content-Disposition: attachment; filename="' . $filename . '"');
if (PMA_USR_BROWSER_AGENT == 'IE') {
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header('Pragma: no-cache');
}
} else {
// HTML
if ($export_type == 'database') {
$num_tables = count($tables);
if ($num_tables == 0) {
$message = $strNoTablesFound;
$js_to_run = 'functions.js';
require_once './libraries/header.inc.php';
$active_page = 'db_export.php';
require './db_export.php';
exit();
}
}
$backup_cfgServer = $cfg['Server'];
require_once './libraries/header.inc.php';
$cfg['Server'] = $backup_cfgServer;
unset($backup_cfgServer);
echo "\n" . '<div align="' . $cell_align_left . '">' . "\n";
//echo ' <pre>' . "\n";
echo ' <form name="nofunction">' . "\n"
// remove auto-select for now: there is no way to select
// only a part of the text; anyway, it should obey
// $cfg['TextareaAutoSelect']
//. ' <textarea name="sqldump" cols="50" rows="30" onclick="this.select();" id="textSQLDUMP" wrap="OFF">' . "\n";
. ' <textarea name="sqldump" cols="50" rows="30" id="textSQLDUMP" wrap="OFF">' . "\n";
} // end download
}
// Fake loop just to allow skip of remain of this code by break, I'd really
// need exceptions here :-)
do {
// Add possibly some comments to export
if (!PMA_exportHeader()) {
break;
}
// Will we need relation & co. setup?
$do_relation = isset($GLOBALS[$what . '_relation']);
$do_comments = isset($GLOBALS[$what . '_comments']);
$do_mime = isset($GLOBALS[$what . '_mime']);
if ($do_relation || $do_comments || $do_mime) {
require_once './libraries/relation.lib.php';
$cfgRelation = PMA_getRelationsParam();
}
if ($do_mime) {
require_once './libraries/transformations.lib.php';
}
// Include dates in export?
$do_dates = isset($GLOBALS[$what . '_dates']);
/**
* Builds the dump
*/
// Gets the number of tables if a dump of a database has been required
if ($export_type == 'server') {
if (isset($db_select)) {
$tmp_select = implode($db_select, '|');
$tmp_select = '|' . $tmp_select . '|';
}
// Walk over databases
foreach ($GLOBALS['PMA_List_Database']->items as $current_db) {
if ((isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|'))
|| !isset($tmp_select)) {
if (!PMA_exportDBHeader($current_db)) {
break 2;
}
if (!PMA_exportDBCreate($current_db)) {
break 2;
}
$tables = PMA_DBI_get_tables($current_db);
$views = array();
foreach ($tables as $table) {
// if this is a view, collect it for later; views must be exported
// after the tables
$is_view = PMA_Table::isView($current_db, $table);
if ($is_view) {
$views[] = $table;
}
if (isset($GLOBALS[$what . '_structure'])) {
// for a view, export a stand-in definition of the table
// to resolve view dependencies
if (!PMA_exportStructure($current_db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, $is_view ? 'stand_in' : 'create_table', $export_type)) {
break 3;
}
}
if (isset($GLOBALS[$what . '_data']) && ! $is_view) {
$local_query = 'SELECT * FROM ' . PMA_backquote($current_db) . '.' . PMA_backquote($table);
if (!PMA_exportData($current_db, $table, $crlf, $err_url, $local_query)) {
break 3;
}
}
}
foreach($views as $view) {
// no data export for a view
if (isset($GLOBALS[$what . '_structure'])) {
if (!PMA_exportStructure($current_db, $view, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, 'create_view', $export_type)) {
break 3;
}
}
}
if (!PMA_exportDBFooter($current_db)) {
break 2;
}
}
}
} elseif ($export_type == 'database') {
if (!PMA_exportDBHeader($db)) {
break;
}
$i = 0;
$views = array();
// $tables contains the choices from the user (via $table_select)
foreach ($tables as $table) {
// if this is a view, collect it for later; views must be exported after
// the tables
$is_view = PMA_Table::isView($db, $table);
if ($is_view) {
$views[] = $table;
}
if (isset($GLOBALS[$what . '_structure'])) {
// for a view, export a stand-in definition of the table
// to resolve view dependencies
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, $is_view ? 'stand_in' : 'create_table', $export_type)) {
break 2;
}
}
if (isset($GLOBALS[$what . '_data']) && ! $is_view) {
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) {
break 2;
}
}
}
foreach ($views as $view) {
// no data export for a view
if (isset($GLOBALS[$what . '_structure'])) {
if (!PMA_exportStructure($db, $view, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, 'create_view', $export_type)) {
break 2;
}
}
}
if (!PMA_exportDBFooter($db)) {
break;
}
} else {
if (!PMA_exportDBHeader($db)) {
break;
}
// We export just one table
if ($limit_to > 0 && $limit_from >= 0) {
$add_query = ' LIMIT '
. (($limit_from > 0) ? $limit_from . ', ' : '')
. $limit_to;
} else {
$add_query = '';
}
$is_view = PMA_Table::isView($db, $table);
if (isset($GLOBALS[$what . '_structure'])) {
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, $is_view ? 'create_view' : 'create_table', $export_type)) {
break;
}
}
// If this is an export of a single view, we have to export data;
// for example, a PDF report
if (isset($GLOBALS[$what . '_data'])) {
if (!empty($sql_query)) {
// only preg_replace if needed
if (!empty($add_query)) {
// remove trailing semicolon before adding a LIMIT
$sql_query = preg_replace('%;\s*$%', '', $sql_query);
}
$local_query = $sql_query . $add_query;
PMA_DBI_select_db($db);
} else {
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query;
}
if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) {
break;
}
}
if (!PMA_exportDBFooter($db)) {
break;
}
}
if (!PMA_exportFooter()) {
break;
}
} while (false);
// End of fake loop
if ($save_on_server && isset($message)) {
$js_to_run = 'functions.js';
require_once './libraries/header.inc.php';
if ($export_type == 'server') {
$active_page = 'server_export.php';
require './server_export.php';
} elseif ($export_type == 'database') {
$active_page = 'db_export.php';
require './db_export.php';
} else {
$active_page = 'tbl_export.php';
require './tbl_export.php';
}
exit();
}
/**
* Send the dump as a file...
*/
if (!empty($asfile)) {
// Convert the charset if required.
if ($output_charset_conversion) {
$dump_buffer = PMA_convert_string($GLOBALS['charset'], $GLOBALS['charset_of_file'], $dump_buffer);
}
// Do the compression
// 1. as a gzipped file
if ($compression == 'zip') {
if (@function_exists('gzcompress')) {
$zipfile = new zipfile();
$zipfile -> addFile($dump_buffer, substr($filename, 0, -4));
$dump_buffer = $zipfile -> file();
}
}
// 2. as a bzipped file
elseif ($compression == 'bzip') {
if (@function_exists('bzcompress')) {
$dump_buffer = bzcompress($dump_buffer);
if ($dump_buffer === -8) {
require_once './libraries/header.inc.php';
echo sprintf($strBzError, '<a href="http://bugs.php.net/bug.php?id=17300" target="_blank">17300</a>');
require_once './libraries/footer.inc.php';
}
}
}
// 3. as a gzipped file
elseif ($compression == 'gzip') {
if (@function_exists('gzencode')) {
// without the optional parameter level because it bug
$dump_buffer = gzencode($dump_buffer);
}
}
/* If ve saved on server, we have to close file now */
if ($save_on_server) {
$write_result = @fwrite($file_handle, $dump_buffer);
fclose($file_handle);
if (strlen($dump_buffer) !=0 && (!$write_result || ($write_result != strlen($dump_buffer)))) {
$message = sprintf($strNoSpace, htmlspecialchars($save_filename));
} else {
$message = sprintf($strDumpSaved, htmlspecialchars($save_filename));
}
$js_to_run = 'functions.js';
require_once './libraries/header.inc.php';
if ($export_type == 'server') {
$active_page = 'server_export.php';
require_once './server_export.php';
} elseif ($export_type == 'database') {
$active_page = 'db_export.php';
require_once './db_export.php';
} else {
$active_page = 'tbl_export.php';
require_once './tbl_export.php';
}
exit();
} else {
echo $dump_buffer;
}
}
/**
* Displays the dump...
*/
else {
/**
* Close the html tags and add the footers in dump is displayed on screen
*/
//echo ' </pre>' . "\n";
echo '</textarea>' . "\n"
. ' </form>' . "\n";
echo '</div>' . "\n";
echo "\n";
?>
<script type="text/javascript">
//<![CDATA[
var bodyWidth=null; var bodyHeight=null;
if (document.getElementById('textSQLDUMP')) {
bodyWidth = self.innerWidth;
bodyHeight = self.innerHeight;
if (!bodyWidth && !bodyHeight) {
if (document.compatMode && document.compatMode == "BackCompat") {
bodyWidth = document.body.clientWidth;
bodyHeight = document.body.clientHeight;
} else if (document.compatMode && document.compatMode == "CSS1Compat") {
bodyWidth = document.documentElement.clientWidth;
bodyHeight = document.documentElement.clientHeight;
}
}
document.getElementById('textSQLDUMP').style.width=(bodyWidth-50) + 'px';
document.getElementById('textSQLDUMP').style.height=(bodyHeight-100) + 'px';
}
//]]>
</script>
<?php
require_once './libraries/footer.inc.php';
} // end if
?>

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

416
import.php Normal file
View File

@@ -0,0 +1,416 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Core script for import, this is just the glue around all other stuff
*
* @version $Id$
*/
/**
* Get the variables sent or posted to this script and a core script
*/
require_once './libraries/common.inc.php';
$js_to_run = 'functions.js';
// default values
$GLOBALS['reload'] = false;
// Are we just executing plain query or sql file? (eg. non import, but query box/window run)
if (!empty($sql_query)) {
// run SQL query
$import_text = $sql_query;
$import_type = 'query';
$format = 'sql';
// refresh left frame on changes in table or db structure
if (preg_match('/^(CREATE|ALTER|DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i', $sql_query)) {
$GLOBALS['reload'] = true;
}
$sql_query = '';
} elseif (!empty($sql_localfile)) {
// run SQL file on server
$local_import_file = $sql_localfile;
$import_type = 'queryfile';
$format = 'sql';
unset($sql_localfile);
} elseif (!empty($sql_file)) {
// run uploaded SQL file
$import_file = $sql_file;
$import_type = 'queryfile';
$format = 'sql';
unset($sql_file);
} elseif (!empty($id_bookmark)) {
// run bookmark
$import_type = 'query';
$format = 'sql';
}
// If we didn't get any parameters, either user called this directly, or
// upload limit has been reached, let's assume the second possibility.
if ($_POST == array() && $_GET == array()) {
require_once './libraries/header.inc.php';
$show_error_header = TRUE;
PMA_showMessage(sprintf($strUploadLimit, '[a@./Documentation.html#faq1_16@_blank]', '[/a]'));
require './libraries/footer.inc.php';
}
// Check needed parameters
PMA_checkParameters(array('import_type', 'format'));
// We don't want anything special in format
$format = PMA_securePath($format);
// Import functions
require_once './libraries/import.lib.php';
// Create error and goto url
if ($import_type == 'table') {
$err_url = 'tbl_import.php?' . PMA_generate_common_url($db, $table);
$goto = 'tbl_import.php';
} elseif ($import_type == 'database') {
$err_url = 'db_import.php?' . PMA_generate_common_url($db);
$goto = 'db_import.php';
} elseif ($import_type == 'server') {
$err_url = 'server_import.php?' . PMA_generate_common_url();
$goto = 'server_import.php';
} else {
if (empty($goto) || !preg_match('@^(server|db|tbl)(_[a-z]*)*\.php$@i', $goto)) {
if (strlen($table) && strlen($db)) {
$goto = 'tbl_structure.php';
} elseif (strlen($db)) {
$goto = 'db_structure.php';
} else {
$goto = 'server_sql.php';
}
}
if (strlen($table) && strlen($db)) {
$common = PMA_generate_common_url($db, $table);
} elseif (strlen($db)) {
$common = PMA_generate_common_url($db);
} else {
$common = PMA_generate_common_url();
}
$err_url = $goto
. '?' . $common
. (preg_match('@^tbl_[a-z]*\.php$@', $goto) ? '&amp;table=' . urlencode($table) : '');
}
if (strlen($db)) {
PMA_DBI_select_db($db);
}
@set_time_limit($cfg['ExecTimeLimit']);
if (!empty($cfg['MemoryLimit'])) {
@ini_set('memory_limit', $cfg['MemoryLimit']);
}
$timestamp = time();
if (isset($allow_interrupt)) {
$maximum_time = ini_get('max_execution_time');
} else {
$maximum_time = 0;
}
// set default values
$timeout_passed = FALSE;
$error = FALSE;
$read_multiply = 1;
$finished = FALSE;
$offset = 0;
$max_sql_len = 0;
$file_to_unlink = '';
$sql_query = '';
$sql_query_disabled = FALSE;
$go_sql = FALSE;
$executed_queries = 0;
$run_query = TRUE;
$charset_conversion = FALSE;
$reset_charset = FALSE;
$bookmark_created = FALSE;
// Bookmark Support: get a query back from bookmark if required
if (!empty($id_bookmark)) {
require_once './libraries/bookmark.lib.php';
switch ($action_bookmark) {
case 0: // bookmarked query that have to be run
$import_text = PMA_queryBookmarks($db, $cfg['Bookmark'], $id_bookmark, 'id', isset($action_bookmark_all));
if (isset($bookmark_variable) && !empty($bookmark_variable)) {
$import_text = preg_replace('|/\*(.*)\[VARIABLE\](.*)\*/|imsU', '${1}' . PMA_sqlAddslashes($bookmark_variable) . '${2}', $import_text);
}
// refresh left frame on changes in table or db structure
if (preg_match('/^(CREATE|ALTER|DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i', $import_text)) {
$GLOBALS['reload'] = true;
}
break;
case 1: // bookmarked query that have to be displayed
$import_text = PMA_queryBookmarks($db, $cfg['Bookmark'], $id_bookmark);
$run_query = FALSE;
break;
case 2: // bookmarked query that have to be deleted
$import_text = PMA_queryBookmarks($db, $cfg['Bookmark'], $id_bookmark);
PMA_deleteBookmarks($db, $cfg['Bookmark'], $id_bookmark);
$run_query = FALSE;
$error = TRUE; // this is kind of hack to skip processing the query
break;
}
} // end bookmarks reading
// Do no run query if we show PHP code
if (isset($GLOBALS['show_as_php'])) {
$run_query = FALSE;
$go_sql = TRUE;
}
// Store the query as a bookmark before executing it if bookmarklabel was given
if (!empty($bkm_label) && !empty($import_text)) {
require_once './libraries/bookmark.lib.php';
$bfields = array(
'dbase' => $db,
'user' => $cfg['Bookmark']['user'],
'query' => urlencode($import_text),
'label' => $bkm_label
);
// Should we replace bookmark?
if (isset($bkm_replace)) {
$bookmarks = PMA_listBookmarks($db, $cfg['Bookmark']);
foreach ($bookmarks as $key => $val) {
if ($val == $bkm_label) {
PMA_deleteBookmarks($db, $cfg['Bookmark'], $key);
}
}
}
PMA_addBookmarks($bfields, $cfg['Bookmark'], isset($bkm_all_users));
$bookmark_created = TRUE;
} // end store bookmarks
// We can not read all at once, otherwise we can run out of memory
$memory_limit = trim(@ini_get('memory_limit'));
// 2 MB as default
if (empty($memory_limit)) {
$memory_limit = 2 * 1024 * 1024;
}
// In case no memory limit we work on 10MB chunks
if ($memory_limit = -1) {
$memory_limit = 10 * 1024 * 1024;
}
// Calculate value of the limit
if (strtolower(substr($memory_limit, -1)) == 'm') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024;
} elseif (strtolower(substr($memory_limit, -1)) == 'k') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024;
} elseif (strtolower(substr($memory_limit, -1)) == 'g') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
} else {
$memory_limit = (int)$memory_limit;
}
$read_limit = $memory_limit / 8; // Just to be sure, there might be lot of memory needed for uncompression
// handle filenames
if (!empty($local_import_file) && !empty($cfg['UploadDir'])) {
// sanitize $local_import_file as it comes from a POST
$local_import_file = PMA_securePath($local_import_file);
$import_file = PMA_userDir($cfg['UploadDir']) . $local_import_file;
} elseif (empty($import_file) || !is_uploaded_file($import_file)) {
$import_file = 'none';
}
// Do we have file to import?
if ($import_file != 'none' && !$error) {
// work around open_basedir and other limitations
$open_basedir = @ini_get('open_basedir');
// 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/');
// function is_writeable() is valid on PHP3 and 4
if (is_writeable($tmp_subdir)) {
$import_file_new = $tmp_subdir . basename($import_file);
if (move_uploaded_file($import_file, $import_file_new)) {
$import_file = $import_file_new;
$file_to_unlink = $import_file_new;
}
}
}
// Handle file compression
$compression = PMA_detectCompression($import_file);
if ($compression === FALSE) {
$message = $strFileCouldNotBeRead;
$show_error_header = TRUE;
$error = TRUE;
} else {
switch ($compression) {
case 'application/bzip2':
if ($cfg['BZipDump'] && @function_exists('bzopen')) {
$import_handle = @bzopen($import_file, 'r');
} else {
$message = sprintf($strUnsupportedCompressionDetected, $compression);
$show_error_header = TRUE;
$error = TRUE;
}
break;
case 'application/gzip':
if ($cfg['GZipDump'] && @function_exists('gzopen')) {
$import_handle = @gzopen($import_file, 'r');
} else {
$message = sprintf($strUnsupportedCompressionDetected, $compression);
$show_error_header = TRUE;
$error = TRUE;
}
break;
case 'application/zip':
if ($cfg['GZipDump'] && @function_exists('gzinflate')) {
include_once './libraries/unzip.lib.php';
$import_handle = new SimpleUnzip();
$import_handle->ReadFile($import_file);
if ($import_handle->Count() == 0) {
$message = $strNoFilesFoundInZip;
$show_error_header = TRUE;
$error = TRUE;
} elseif ($import_handle->GetError(0) != 0) {
$message = $strErrorInZipFile . ' ' . $import_handle->GetErrorMsg(0);
$show_error_header = TRUE;
$error = TRUE;
} else {
$import_text = $import_handle->GetData(0);
}
// We don't need to store it further
$import_handle = '';
} else {
$message = sprintf($strUnsupportedCompressionDetected, $compression);
$show_error_header = TRUE;
$error = TRUE;
}
break;
case 'none':
$import_handle = @fopen($import_file, 'r');
break;
default:
$message = sprintf($strUnsupportedCompressionDetected, $compression);
$show_error_header = TRUE;
$error = TRUE;
break;
}
}
if (!$error && $import_handle === FALSE) {
$message = $strFileCouldNotBeRead;
$show_error_header = TRUE;
$error = TRUE;
}
} elseif (!$error) {
if (!isset($import_text) || empty($import_text)) {
$message = $strNoDataReceived;
$show_error_header = TRUE;
$error = TRUE;
}
}
// Convert the file's charset if necessary
if ($cfg['AllowAnywhereRecoding'] && $allow_recoding
&& isset($charset_of_file)) {
if ($charset_of_file != $charset) {
$charset_conversion = TRUE;
}
} elseif (PMA_MYSQL_INT_VERSION >= 40100
&& isset($charset_of_file) && $charset_of_file != 'utf8') {
PMA_DBI_query('SET NAMES \'' . $charset_of_file . '\'');
// We can not show query in this case, it is in different charset
$sql_query_disabled = TRUE;
$reset_charset = TRUE;
}
// Something to skip?
if (!$error && isset($skip)) {
$original_skip = $skip;
while ($skip > 0) {
PMA_importGetNextChunk($skip < $read_limit ? $skip : $read_limit);
$read_multiply = 1; // Disable read progresivity, otherwise we eat all memory!
$skip -= $read_limit;
}
unset($skip);
}
if (!$error) {
// Check for file existance
if (!file_exists('./libraries/import/' . $format . '.php')) {
$error = TRUE;
$message = $strCanNotLoadImportPlugins;
$show_error_header = TRUE;
} else {
// Do the real import
$plugin_param = $import_type;
require './libraries/import/' . $format . '.php';
}
}
// Cleanup temporary file
if ($file_to_unlink != '') {
unlink($file_to_unlink);
}
// Reset charset back, if we did some changes
if ($reset_charset) {
PMA_DBI_query('SET CHARACTER SET utf8');
PMA_DBI_query('SET SESSION collation_connection =\'' . $collation_connection . '\'');
}
// Show correct message
if (!empty($id_bookmark) && $action_bookmark == 2) {
$message = $strBookmarkDeleted;
$display_query = $import_text;
$error = FALSE; // unset error marker, it was used just to skip processing
} elseif (!empty($id_bookmark) && $action_bookmark == 1) {
$message = $strShowingBookmark;
} elseif ($bookmark_created) {
$special_message = '[br]' . sprintf($strBookmarkCreated, htmlspecialchars($bkm_label));
} elseif ($finished && !$error) {
if ($import_type == 'query') {
$message = $strSuccess;
} else {
$message = sprintf($strImportSuccessfullyFinished, $executed_queries);
}
}
// Did we hit timeout? Tell it user.
if ($timeout_passed) {
$message = $strTimeoutPassed;
if ($offset == 0 || (isset($original_skip) && $original_skip == $offset)) {
$message .= ' ' . $strTimeoutNothingParsed;
}
}
// Parse and analyze the query, for correct db and table name
// in case of a query typed in the query window
require_once './libraries/parse_analyze.lib.php';
// There was an error?
if (isset($my_die)) {
foreach ($my_die AS $key => $die) {
PMA_mysqlDie($die['error'], $die['sql'], '', $err_url, $error);
}
}
if ($go_sql) {
require './sql.php';
} else {
$active_page = $goto;
require './' . $goto;
}
exit();
?>

172
index.php Normal file
View File

@@ -0,0 +1,172 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* forms frameset
*
* @version $Id$
* @uses $GLOBALS['strNoFrames']
* @uses $GLOBALS['cfg']['QueryHistoryDB']
* @uses $GLOBALS['cfg']['Server']['user']
* @uses $GLOBALS['cfg']['DefaultTabServer'] as src for the mainframe
* @uses $GLOBALS['cfg']['DefaultTabDatabase'] as src for the mainframe
* @uses $GLOBALS['cfg']['NaviWidth'] for navi frame width
* @uses $GLOBALS['collation_connection'] from $_REQUEST (grab_globals.lib.php)
* or common.inc.php
* @uses $GLOBALS['available_languages'] from common.inc.php (select_lang.lib.php)
* @uses $GLOBALS['db']
* @uses $GLOBALS['charset']
* @uses $GLOBALS['lang']
* @uses $GLOBALS['text_dir']
* @uses $_ENV['HTTP_HOST']
* @uses PMA_getRelationsParam()
* @uses PMA_purgeHistory()
* @uses PMA_generate_common_url()
* @uses PMA_VERSION
* @uses session_write_close()
* @uses time()
* @uses PMA_getenv()
* @uses header() to send charset
*/
/**
* Gets core libraries and defines some variables
*/
require_once './libraries/common.inc.php';
/**
* Includes the ThemeManager if it hasn't been included yet
*/
require_once './libraries/relation.lib.php';
// free the session file, for the other frames to be loaded
session_write_close();
// Gets the host name
// loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
if (empty($HTTP_HOST)) {
if (PMA_getenv('HTTP_HOST')) {
$HTTP_HOST = PMA_getenv('HTTP_HOST');
} else {
$HTTP_HOST = '';
}
}
// purge querywindow history
$cfgRelation = PMA_getRelationsParam();
if ($GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork']) {
PMA_purgeHistory($GLOBALS['cfg']['Server']['user']);
}
unset($cfgRelation);
/**
* pass variables to child pages
*/
$drops = array('lang', 'server', 'convcharset', 'collation_connection',
'db', 'table');
foreach ($drops as $each_drop) {
if (! array_key_exists($each_drop, $_GET)) {
unset($_GET[$each_drop]);
}
}
unset($drops, $each_drop);
if (! strlen($GLOBALS['db'])) {
$main_target = $GLOBALS['cfg']['DefaultTabServer'];
} elseif (! strlen($GLOBALS['table'])) {
$_GET['db'] = $GLOBALS['db'];
$main_target = $GLOBALS['cfg']['DefaultTabDatabase'];
} else {
$_GET['db'] = $GLOBALS['db'];
$_GET['table'] = $GLOBALS['table'];
$main_target = $GLOBALS['cfg']['DefaultTabTable'];
}
$url_query = PMA_generate_common_url($_GET);
if (isset($GLOBALS['target']) && is_string($GLOBALS['target']) && !empty($GLOBALS['target']) && in_array($GLOBALS['target'], $goto_whitelist)) {
$main_target = $GLOBALS['target'];
}
$main_target .= $url_query;
$lang_iso_code = $GLOBALS['available_languages'][$GLOBALS['lang']][2];
// start output
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="<?php echo $lang_iso_code; ?>"
lang="<?php echo $lang_iso_code; ?>"
dir="<?php echo $GLOBALS['text_dir']; ?>">
<head>
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<title>phpMyAdmin <?php echo PMA_VERSION; ?> -
<?php echo htmlspecialchars($HTTP_HOST); ?></title>
<meta http-equiv="Content-Type"
content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
<script type="text/javascript"">
// <![CDATA[
// definitions used in querywindow.js
var common_query = '<?php echo PMA_escapeJsString(PMA_generate_common_url('', '', '&'));?>';
var opendb_url = '<?php echo PMA_escapeJsString($GLOBALS['cfg']['DefaultTabDatabase']); ?>';
var safari_browser = <?php echo PMA_USR_BROWSER_AGENT == 'SAFARI' ? 'true' : 'false' ?>;
var querywindow_height = <?php echo PMA_escapeJsString($GLOBALS['cfg']['QueryWindowHeight']); ?>;
var querywindow_width = <?php echo PMA_escapeJsString($GLOBALS['cfg']['QueryWindowWidth']); ?>;
var collation_connection = '<?php echo PMA_escapeJsString($GLOBALS['collation_connection']); ?>';
var lang = '<?php echo PMA_escapeJsString($GLOBALS['lang']); ?>';
var server = '<?php echo PMA_escapeJsString($GLOBALS['server']); ?>';
var table = '<?php echo PMA_escapeJsString($GLOBALS['table']); ?>';
var db = '<?php echo PMA_escapeJsString($GLOBALS['db']); ?>';
var text_dir = '<?php echo PMA_escapeJsString($GLOBALS['text_dir']); ?>';
var pma_absolute_uri = '<?php echo PMA_escapeJsString($GLOBALS['cfg']['PmaAbsoluteUri']); ?>';
// ]]>
</script>
<script src="./js/querywindow.js" type="text/javascript"></script>
</head>
<frameset cols="<?php
if ($GLOBALS['text_dir'] === 'rtl') {
echo '*,';
}
echo $GLOBALS['cfg']['NaviWidth'];
if ($GLOBALS['text_dir'] === 'ltr') {
echo ',*';
}
?>" rows="*" id="mainFrameset">
<?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
<frame frameborder="0" id="frame_navigation"
src="navigation.php<?php echo $url_query; ?>"
name="frame_navigation" />
<?php } ?>
<frame frameborder="0" id="frame_content"
src="<?php echo $main_target; ?>"
name="frame_content" />
<?php if ($GLOBALS['text_dir'] === 'rtl') { ?>
<frame frameborder="0" id="frame_navigation"
src="navigation.php<?php echo $url_query; ?>"
name="frame_navigation" />
<?php } ?>
<noframes>
<body>
<p><?php echo $GLOBALS['strNoFrames']; ?></p>
</body>
</noframes>
</frameset>
<script type="text/javascript">
// <![CDATA[
<?php if ($GLOBALS['text_dir'] === 'ltr') { ?>
var frame_content = window.frames[1];
var frame_navigation = window.frames[0];
<?php } else { ?>
var frame_content = window.frames[0];
var frame_navigation = window.frames[1];
<?php } ?>
// ]]>
</script>
</html>

121
js/dom-drag.js Normal file
View File

@@ -0,0 +1,121 @@
/**************************************************
* dom-drag.js
* 09.25.2001
* www.youngpup.net
**************************************************
* 10.28.2001 - fixed minor bug where events
* sometimes fired off the handle, not the root.
**************************************************/
var Drag = {
obj : null,
init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
{
o.onmousedown = Drag.start;
o.hmode = bSwapHorzRef ? false : true ;
o.vmode = bSwapVertRef ? false : true ;
o.root = oRoot && oRoot != null ? oRoot : o ;
if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left = "0px";
if (o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top = "0px";
if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px";
if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";
o.minX = typeof minX != 'undefined' ? minX : null;
o.minY = typeof minY != 'undefined' ? minY : null;
o.maxX = typeof maxX != 'undefined' ? maxX : null;
o.maxY = typeof maxY != 'undefined' ? maxY : null;
o.xMapper = fXMapper ? fXMapper : null;
o.yMapper = fYMapper ? fYMapper : null;
o.root.onDragStart = new Function();
o.root.onDragEnd = new Function();
o.root.onDrag = new Function();
},
start : function(e)
{
var o = Drag.obj = this;
e = Drag.fixE(e);
var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
o.root.onDragStart(x, y);
o.lastMouseX = e.clientX;
o.lastMouseY = e.clientY;
if (o.hmode) {
if (o.minX != null) o.minMouseX = e.clientX - x + o.minX;
if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX;
} else {
if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
}
if (o.vmode) {
if (o.minY != null) o.minMouseY = e.clientY - y + o.minY;
if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY;
} else {
if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
}
document.onmousemove = Drag.drag;
document.onmouseup = Drag.end;
return false;
},
drag : function(e)
{
e = Drag.fixE(e);
var o = Drag.obj;
var ey = e.clientY;
var ex = e.clientX;
var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
var nx, ny;
if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);
nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));
if (o.xMapper) nx = o.xMapper(y)
else if (o.yMapper) ny = o.yMapper(x)
Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
Drag.obj.lastMouseX = ex;
Drag.obj.lastMouseY = ey;
Drag.obj.root.onDrag(nx, ny);
return false;
},
end : function()
{
document.onmousemove = null;
document.onmouseup = null;
Drag.obj.root.onDragEnd( parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]),
parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
Drag.obj = null;
},
fixE : function(e)
{
if (typeof e == 'undefined') e = window.event;
if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
return e;
}
};

1219
js/functions.js Normal file

File diff suppressed because it is too large Load Diff

91
js/indexes.js Normal file
View File

@@ -0,0 +1,91 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* function used for index manipulation pages
*
* @version $Id$
*/
/**
* Ensures a value submitted in a form is numeric and is in a range
*
* @param object the form
* @param string the name of the form field to check
* @param integer the minimum authorized value
* @param integer the maximum authorized value
*
* @return boolean whether a valid number has been submitted or not
*/
function checkFormElementInRange(theForm, theFieldName, message, min, max)
{
var theField = theForm.elements[theFieldName];
var val = parseInt(theField.value);
if (typeof(min) == 'undefined') {
min = 0;
}
if (typeof(max) == 'undefined') {
max = Number.MAX_VALUE;
}
// It's not a number
if (isNaN(val)) {
theField.select();
alert(errorMsg1);
theField.focus();
return false;
}
// It's a number but it is not between min and max
else if (val < min || val > max) {
theField.select();
alert(message.replace('%d', val));
theField.focus();
return false;
}
// It's a valid number
else {
theField.value = val;
}
return true;
} // end of the 'checkFormElementInRange()' function
/**
* Ensures indexes names are valid according to their type and, for a primary
* key, lock index name to 'PRIMARY'
*
* @return boolean false if there is no index form, true else
*/
function checkIndexName()
{
if (typeof(document.forms['index_frm']) == 'undefined') {
return false;
}
// Gets the elements pointers
var the_idx_name = document.forms['index_frm'].elements['index'];
var the_idx_type = document.forms['index_frm'].elements['index_type'];
// Index is a primary key
if (the_idx_type.options[0].value == 'PRIMARY' && the_idx_type.options[0].selected) {
document.forms['index_frm'].elements['index'].value = 'PRIMARY';
if (typeof(the_idx_name.disabled) != 'undefined') {
document.forms['index_frm'].elements['index'].disabled = true;
}
}
// Other cases
else {
if (the_idx_name.value == 'PRIMARY') {
document.forms['index_frm'].elements['index'].value = '';
}
if (typeof(the_idx_name.disabled) != 'undefined') {
document.forms['index_frm'].elements['index'].disabled = false;
}
}
return true;
} // end of the 'checkIndexName()' function
onload = checkIndexName;

59
js/keyhandler.js Normal file
View File

@@ -0,0 +1,59 @@
/**
* Allows moving around inputs/select by Ctrl+arrows
*
* @param object event data
*/
function onKeyDownArrowsHandler(e) {
e = e||window.event;
var o = (e.srcElement||e.target);
if (!o) return;
if (o.tagName != "TEXTAREA" && o.tagName != "INPUT" && o.tagName != "SELECT") return;
if (navigator.userAgent.toLowerCase().indexOf('applewebkit/') != -1) {
if (e.ctrlKey || e.shiftKey || !e.altKey) return;
} else {
if (!e.ctrlKey || e.shiftKey || e.altKey) return;
}
if (!o.id) return;
var pos = o.id.split("_");
if (pos[0] != "field" || typeof pos[2] == "undefined") return;
var x = pos[2], y=pos[1];
// skip non existent fields
for (i=0; i<10; i++)
{
if (switch_movement) {
switch(e.keyCode) {
case 38: x--; break; // up
case 40: x++; break; // down
case 37: y--; break; // left
case 39: y++; break; // right
default: return;
}
} else {
switch(e.keyCode) {
case 38: y--; break; // up
case 40: y++; break; // down
case 37: x--; break; // left
case 39: x++; break; // right
default: return;
}
}
var id = "field_" + y + "_" + x;
var nO = document.getElementById(id);
if (!nO) {
var id = "field_" + y + "_" + x + "_0";
var nO = document.getElementById(id);
}
if (nO) break;
}
if (!nO) return;
nO.focus();
if (nO.tagName != 'SELECT') {
nO.select();
}
e.returnValue = false;
}

137
js/navigation.js Normal file
View File

@@ -0,0 +1,137 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* function used in or for navigation frame
*/
/**
* init
*/
var today = new Date();
var expires = new Date(today.getTime() + (56 * 86400000));
var pma_navi_width;
var pma_saveframesize_timeout = null;
/**
* opens/closes (hides/shows) tree elements
*
* @param string id id of the element in the DOM
* @param boolean only_open do not close/hide element
*/
function toggle(id, only_open) {
var el = document.getElementById('subel' + id);
if (! el) {
return false;
}
var img = document.getElementById('el' + id + 'Img');
if (el.style.display == 'none' || only_open) {
el.style.display = '';
if (img) {
img.src = image_minus;
img.alt = '-';
}
} else {
el.style.display = 'none';
if (img) {
img.src = image_plus;
img.alt = '+';
}
}
return true;
}
function PMA_callFunctionDelayed(myfunction, delay)
{
if (typeof pma_saveframesize_timeout == "number") {
window.clearTimeout(pma_saveframesize_timeout);
pma_saveframesize_timeout = null;
}
}
/**
* saves current navigation frame width in a cookie
* usally called on resize of the navigation frame
*/
function PMA_saveFrameSizeReal()
{
pma_navi_width = document.getElementById('body_leftFrame').offsetWidth
//alert('from DOM: ' + typeof(pma_navi_width) + ' : ' + pma_navi_width);
if (pma_navi_width > 0) {
PMA_setCookie('pma_navi_width', pma_navi_width, expires);
//alert('framesize saved');
}
}
/**
* calls PMA_saveFrameSizeReal with delay
*/
function PMA_saveFrameSize()
{
//alert(typeof(pma_saveframesize_timeout) + ' : ' + pma_saveframesize_timeout);
if (typeof pma_saveframesize_timeout == "number") {
window.clearTimeout(pma_saveframesize_timeout);
pma_saveframesize_timeout = null;
}
pma_saveframesize_timeout = window.setTimeout(PMA_saveFrameSizeReal, 2000);
}
/**
* sets navigation frame width to the value stored in the cookie
* usally called on document load
*/
function PMA_setFrameSize()
{
pma_navi_width = PMA_getCookie('pma_navi_width');
//alert('from cookie: ' + typeof(pma_navi_width) + ' : ' + pma_navi_width);
if (pma_navi_width != null) {
if (parent.text_dir == 'ltr') {
parent.document.getElementById('mainFrameset').cols = pma_navi_width + ',*';
} else {
parent.document.getElementById('mainFrameset').cols = '*,' + pma_navi_width;
}
//alert('framesize set');
}
}
/**
* retrieves a named value from cookie
*
* @param string name name of the value to retrieve
* @return string value value for the given name from cookie
*/
function PMA_getCookie(name) {
var start = document.cookie.indexOf(name + "=");
var len = start + name.length + 1;
if ((!start) && (name != document.cookie.substring(0, name.length))) {
return null;
}
if (start == -1) {
return null;
}
var end = document.cookie.indexOf(";", len);
if (end == -1) {
end = document.cookie.length;
}
return unescape(document.cookie.substring(len,end));
}
/**
* stores a named value into cookie
*
* @param string name name of value
* @param string value value to be stored
* @param Date expires expire time
* @param string path
* @param string domain
* @param boolean secure
*/
function PMA_setCookie(name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape(value) +
( (expires) ? ";expires=" + expires.toGMTString() : "") +
( (path) ? ";path=" + path : "") +
( (domain) ? ";domain=" + domain : "") +
( (secure) ? ";secure" : "");
}

370
js/querywindow.js Normal file
View File

@@ -0,0 +1,370 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* functions used by and for querywindow
*
* @version $Id$
*/
/**
* holds the browser query window
*/
var querywindow = '';
/**
* holds the query to be load from a new query window
*/
var query_to_load = '';
/**
* sets current selected db
*
* @param string db name
*/
function setDb(new_db) {
//alert('setDb(' + new_db + ')');
if (new_db != db) {
// db has changed
//alert( new_db + '(' + new_db.length + ') : ' + db );
var old_db = db;
db = new_db;
if (window.frame_navigation.document.getElementById(db) == null) {
// db is unknown, reload complete left frame
refreshNavigation();
} else {
unmarkDbTable(old_db);
markDbTable(db);
}
// TODO: add code to expand db in lightview mode
// refresh querywindow
refreshQuerywindow();
}
}
/**
* sets current selected table (called from navigation.php)
*
* @param string table name
*/
function setTable(new_table) {
//alert('setTable(' + new_table + ')');
if (new_table != table) {
// table has changed
//alert( new_table + '(' + new_table.length + ') : ' + table );
table = new_table;
if (window.frame_navigation.document.getElementById(db + '.' + table) == null
&& table != '') {
// table is unknown, reload complete left frame
refreshNavigation();
}
// TODO: add code to expand table in lightview mode
// refresh querywindow
refreshQuerywindow();
}
}
/**
* reloads mian frame
*
* @uses goTo()
* @uses opendb_url
* @uses db
* @uses server
* @uses table
* @uses lang
* @uses collation_connection
* @uses encodeURIComponent()
* @param string url name of page to be loaded
*/
function refreshMain(url) {
if (! url) {
if (db) {
url = opendb_url;
} else {
url = 'main.php';
}
}
goTo(url + '?server=' + encodeURIComponent(server) +
'&db=' + encodeURIComponent(db) +
'&table=' + encodeURIComponent(table) +
'&lang=' + encodeURIComponent(lang) +
'&collation_connection=' + encodeURIComponent(collation_connection),
'main');
}
/**
* reloads navigation frame
*
* @uses goTo()
* @uses db
* @uses server
* @uses table
* @uses lang
* @uses collation_connection
* @uses encodeURIComponent()
*/
function refreshNavigation() {
goTo('navigation.php?server=' + encodeURIComponent(server) +
'&db=' + encodeURIComponent(db) +
'&table=' + encodeURIComponent(table) +
'&lang=' + encodeURIComponent(lang) +
'&collation_connection=' + encodeURIComponent(collation_connection)
);
}
/**
* adds class to element
*/
function addClass(element, classname)
{
if (element != null) {
element.className += ' ' + classname;
//alert('set class: ' + classname + ', now: ' + element.className);
}
}
/**
* removes class from element
*/
function removeClass(element, classname)
{
if (element != null) {
element.className = element.className.replace(' ' + classname, '');
// if there is no other class anem there is no leading space
element.className = element.className.replace(classname, '');
//alert('removed class: ' + classname + ', now: ' + element.className);
}
}
function unmarkDbTable(db, table)
{
var element_reference = window.frame_navigation.document.getElementById(db);
if (element_reference != null) {
//alert('remove from: ' + db);
removeClass(element_reference.parentNode, 'marked');
}
element_reference = window.frame_navigation.document.getElementById(db + '.' + table);
if (element_reference != null) {
//alert('remove from: ' + db + '.' + table);
removeClass(element_reference.parentNode, 'marked');
}
}
function markDbTable(db, table)
{
var element_reference = window.frame_navigation.document.getElementById(db);
if (element_reference != null) {
addClass(element_reference.parentNode, 'marked');
// scrolldown
element_reference.focus();
// opera marks the text, we dont want this ...
element_reference.blur();
}
element_reference = window.frame_navigation.document.getElementById(db + '.' + table);
if (element_reference != null) {
addClass(element_reference.parentNode, 'marked');
// scrolldown
element_reference.focus();
// opera marks the text, we dont want this ...
element_reference.blur();
}
// return to main frame ...
window.frame_content.focus();
}
/**
* sets current selected server, table and db (called from libraries/footer.inc.php)
*/
function setAll( new_lang, new_collation_connection, new_server, new_db, new_table ) {
//alert('setAll( ' + new_lang + ', ' + new_collation_connection + ', ' + new_server + ', ' + new_db + ', ' + new_table + ' )');
if (new_server != server || new_lang != lang
|| new_collation_connection != collation_connection) {
// something important has changed
server = new_server;
db = new_db;
table = new_table;
collation_connection = new_collation_connection;
lang = new_lang;
refreshNavigation();
} else if (new_db != db || new_table != table) {
// save new db and table
var old_db = db;
var old_table = table;
db = new_db;
table = new_table;
if (window.frame_navigation.document.getElementById(db) == null
&& window.frame_navigation.document.getElementById(db + '.' + table) == null ) {
// table or db is unknown, reload complete left frame
refreshNavigation();
} else {
unmarkDbTable(old_db, old_table);
markDbTable(db, table);
}
// TODO: add code to expand db in lightview mode
// refresh querywindow
refreshQuerywindow();
}
}
function reload_querywindow(db, table, sql_query)
{
if ( ! querywindow.closed && querywindow.location ) {
if ( ! querywindow.document.sqlform.LockFromUpdate
|| ! querywindow.document.sqlform.LockFromUpdate.checked ) {
querywindow.document.getElementById('hiddenqueryform').db.value = db;
querywindow.document.getElementById('hiddenqueryform').table.value = table;
if (sql_query) {
querywindow.document.getElementById('hiddenqueryform').sql_query.value = sql_query;
}
querywindow.document.getElementById('hiddenqueryform').submit();
}
}
}
/**
* brings query window to front and inserts query to be edited
*/
function focus_querywindow(sql_query)
{
/* if ( querywindow && !querywindow.closed && querywindow.location) { */
if ( !querywindow || querywindow.closed || !querywindow.location) {
// we need first to open the window and cannot pass the query with it
// as we dont know if the query exceeds max url length
/* url = 'querywindow.php?' + common_query + '&db=' + db + '&table=' + table + '&sql_query=SELECT * FROM'; */
query_to_load = sql_query;
open_querywindow();
insertQuery(0);
} else {
//var querywindow = querywindow;
if ( querywindow.document.getElementById('hiddenqueryform').querydisplay_tab != 'sql' ) {
querywindow.document.getElementById('hiddenqueryform').querydisplay_tab.value = "sql";
querywindow.document.getElementById('hiddenqueryform').sql_query.value = sql_query;
querywindow.document.getElementById('hiddenqueryform').submit();
querywindow.focus();
} else {
querywindow.focus();
}
}
return true;
}
/**
* inserts query string into query window textarea
* called from script tag in querywindow
*/
function insertQuery() {
if (query_to_load != '' && querywindow.document && querywindow.document.getElementById && querywindow.document.getElementById('sqlquery')) {
querywindow.document.getElementById('sqlquery').value = query_to_load;
query_to_load = '';
return true;
}
return false;
}
function open_querywindow( url ) {
if ( ! url ) {
url = 'querywindow.php?' + common_query + '&db=' + encodeURIComponent(db) + '&table=' + encodeURIComponent(table);
}
if (!querywindow.closed && querywindow.location) {
goTo( url, 'query' );
querywindow.focus();
} else {
querywindow = window.open( url + '&init=1', '',
'toolbar=0,location=0,directories=0,status=1,menubar=0,' +
'scrollbars=yes,resizable=yes,' +
'width=' + querywindow_width + ',' +
'height=' + querywindow_height );
}
if ( ! querywindow.opener ) {
querywindow.opener = window.window;
}
if ( window.focus ) {
querywindow.focus();
}
return true;
}
function refreshQuerywindow( url ) {
if ( ! querywindow.closed && querywindow.location ) {
if ( ! querywindow.document.sqlform.LockFromUpdate
|| ! querywindow.document.sqlform.LockFromUpdate.checked ) {
open_querywindow( url )
}
}
}
/**
* opens new url in target frame, with default beeing left frame
* valid is 'main' and 'querywindow' all others leads to 'left'
*
* @param string targeturl new url to load
* @param string target frame where to load the new url
*/
function goTo(targeturl, target) {
if ( target == 'main' ) {
target = window.frame_content;
} else if ( target == 'query' ) {
target = querywindow;
//return open_querywindow( targeturl );
} else if ( ! target ) {
target = window.frame_navigation;
}
if ( target ) {
if ( target.location.href == targeturl ) {
return true;
} else if ( target.location.href == pma_absolute_uri + targeturl ) {
return true;
}
if ( safari_browser ) {
target.location.href = targeturl;
} else {
target.location.replace(targeturl);
}
}
return true;
}
// opens selected db in main frame
function openDb(new_db) {
//alert('opendb(' + new_db + ')');
setDb(new_db);
setTable('');
refreshMain(opendb_url);
return true;
}
function updateTableTitle( table_link_id, new_title ) {
//alert('updateTableTitle');
if ( window.parent.frame_navigation.document.getElementById(table_link_id) ) {
var left = window.parent.frame_navigation.document;
left.getElementById(table_link_id).title = new_title;
new_title = left.getElementById('icon_' + table_link_id).alt + ': ' + new_title;
left.getElementById('browse_' + table_link_id).title = new_title;
return true;
}
return false;
}

97
js/server_privileges.js Normal file
View File

@@ -0,0 +1,97 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* function used in server privilege pages
*
* @version $Id$
*/
/**
* Validates the password field in a form
*
* @param object the form
*
* @return boolean whether the field value is valid or not
*/
function checkPassword(the_form)
{
// Did the user select 'no password'?
if (typeof(the_form.elements['nopass']) != 'undefined' && the_form.elements['nopass'][0].checked) {
return true;
} else if (typeof(the_form.elements['pred_password']) != 'undefined' && (the_form.elements['pred_password'].value == 'none' || the_form.elements['pred_password'].value == 'keep')) {
return true;
}
// Validates
if (the_form.elements['pma_pw'].value == '') {
alert(jsPasswordEmpty);
the_form.elements['pma_pw2'].value = '';
the_form.elements['pma_pw'].focus();
return false;
} else if (the_form.elements['pma_pw'].value != the_form.elements['pma_pw2'].value) {
alert(jsPasswordNotSame);
the_form.elements['pma_pw'].value = '';
the_form.elements['pma_pw2'].value = '';
the_form.elements['pma_pw'].focus();
return false;
} // end if...else if
return true;
} // end of the 'checkPassword()' function
/**
* Validates the "add a user" form
*
* @return boolean whether the form is validated or not
*/
function checkAddUser(the_form)
{
if (the_form.elements['pred_hostname'].value == 'userdefined' && the_form.elements['hostname'].value == '') {
alert(jsHostEmpty);
the_form.elements['hostname'].focus();
return false;
}
if (the_form.elements['pred_username'].value == 'userdefined' && the_form.elements['username'].value == '') {
alert(jsUserEmpty);
the_form.elements['username'].focus();
return false;
}
return checkPassword(the_form);
} // end of the 'checkAddUser()' function
/**
* Generate a new password, which may then be copied to the form
* with suggestPasswordCopy().
*
* @param string the form name
*
* @return boolean always true
*/
function suggestPassword() {
var pwchars = "abcdefhjmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWYXZ.,:";
var passwordlength = 16; // do we want that to be dynamic? no, keep it simple :)
var passwd = document.getElementById('generated_pw');
passwd.value = '';
for ( i = 0; i < passwordlength; i++ ) {
passwd.value += pwchars.charAt( Math.floor( Math.random() * pwchars.length ) )
}
return passwd.value;
}
/**
* Copy the generated password (or anything in the field) to the form
*
* @param string the form name
*
* @return boolean always true
*/
function suggestPasswordCopy() {
document.getElementById('text_pma_pw').value = document.getElementById('generated_pw').value;
document.getElementById('text_pma_pw2').value = document.getElementById('generated_pw').value;
return true;
}

345
js/tbl_change.js Normal file
View File

@@ -0,0 +1,345 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* function used in table data manipulation pages
*
* @version $Id$
*/
/**
* Modify from controls when the "NULL" checkbox is selected
*
* @param string the MySQL field type
* @param string the urlencoded field name
* @param string the md5 hashed field name
*
* @return boolean always true
*/
function nullify(theType, urlField, md5Field, multi_edit)
{
var rowForm = document.forms['insertForm'];
if (typeof(rowForm.elements['funcs' + multi_edit + '[' + urlField + ']']) != 'undefined') {
rowForm.elements['funcs' + multi_edit + '[' + urlField + ']'].selectedIndex = -1;
}
// "SET" field , "ENUM" field with more than 20 characters
// or foreign key field
if (theType == 1 || theType == 3 || theType == 4) {
rowForm.elements['field_' + md5Field + multi_edit + '[]'].selectedIndex = -1;
}
// Other "ENUM" field
else if (theType == 2) {
var elts = rowForm.elements['field_' + md5Field + multi_edit + '[]'];
// when there is just one option in ENUM:
if (elts.checked) {
elts.checked = false;
} else {
var elts_cnt = elts.length;
for (var i = 0; i < elts_cnt; i++ ) {
elts[i].checked = false;
} // end for
} // end if
}
// Other field types
else /*if (theType == 5)*/ {
rowForm.elements['fields' + multi_edit + '[' + urlField + ']'].value = '';
} // end if... else if... else
return true;
} // end of the 'nullify()' function
/**
* Unchecks the "NULL" control when a function has been selected or a value
* entered
*
* @param string the urlencoded field name
*
* @return boolean always true
*/
function unNullify(urlField, multi_edit)
{
var rowForm = document.forms['insertForm'];
if (typeof(rowForm.elements['fields_null[multi_edit][' + multi_edit + '][' + urlField + ']']) != 'undefined') {
rowForm.elements['fields_null[multi_edit][' + multi_edit + '][' + urlField + ']'].checked = false
} // end if
if (typeof(rowForm.elements['insert_ignore_' + multi_edit]) != 'undefined') {
rowForm.elements['insert_ignore_' + multi_edit].checked = false
} // end if
return true;
} // end of the 'unNullify()' function
var day;
var month;
var year;
var hour;
var minute;
var second;
var clock_set = 0;
/**
* Opens calendar window.
*
* @param string calendar.php parameters
* @param string form name
* @param string field name
* @param string edit type - date/timestamp
*/
function openCalendar(params, form, field, type) {
window.open("./calendar.php?" + params, "calendar", "width=400,height=200,status=yes");
dateField = eval("document." + form + "." + field);
dateType = type;
}
/**
* Formats number to two digits.
*
* @param int number to format.
* @param string type of number
*/
function formatNum2(i, valtype) {
f = (i < 10 ? '0' : '') + i;
if (valtype && valtype != '') {
switch(valtype) {
case 'month':
f = (f > 12 ? 12 : f);
break;
case 'day':
f = (f > 31 ? 31 : f);
break;
case 'hour':
f = (f > 24 ? 24 : f);
break;
default:
case 'second':
case 'minute':
f = (f > 59 ? 59 : f);
break;
}
}
return f;
}
/**
* Formats number to two digits.
*
* @param int number to format.
* @param int default value
* @param string type of number
*/
function formatNum2d(i, default_v, valtype) {
i = parseInt(i, 10);
if (isNaN(i)) return default_v;
return formatNum2(i, valtype)
}
/**
* Formats number to four digits.
*
* @param int number to format.
*/
function formatNum4(i) {
i = parseInt(i, 10)
return (i < 1000 ? i < 100 ? i < 10 ? '000' : '00' : '0' : '') + i;
}
/**
* Initializes calendar window.
*/
function initCalendar() {
if (!year && !month && !day) {
/* Called for first time */
if (window.opener.dateField.value) {
value = window.opener.dateField.value;
if (window.opener.dateType == 'datetime' || window.opener.dateType == 'date') {
if (window.opener.dateType == 'datetime') {
parts = value.split(' ');
value = parts[0];
if (parts[1]) {
time = parts[1].split(':');
hour = parseInt(time[0],10);
minute = parseInt(time[1],10);
second = parseInt(time[2],10);
}
}
date = value.split("-");
day = parseInt(date[2],10);
month = parseInt(date[1],10) - 1;
year = parseInt(date[0],10);
} else {
year = parseInt(value.substr(0,4),10);
month = parseInt(value.substr(4,2),10) - 1;
day = parseInt(value.substr(6,2),10);
hour = parseInt(value.substr(8,2),10);
minute = parseInt(value.substr(10,2),10);
second = parseInt(value.substr(12,2),10);
}
}
if (isNaN(year) || isNaN(month) || isNaN(day) || day == 0) {
dt = new Date();
year = dt.getFullYear();
month = dt.getMonth();
day = dt.getDate();
}
if (isNaN(hour) || isNaN(minute) || isNaN(second)) {
dt = new Date();
hour = dt.getHours();
minute = dt.getMinutes();
second = dt.getSeconds();
}
} else {
/* Moving in calendar */
if (month > 11) {
month = 0;
year++;
}
if (month < 0) {
month = 11;
year--;
}
}
if (document.getElementById) {
cnt = document.getElementById("calendar_data");
} else if (document.all) {
cnt = document.all["calendar_data"];
}
cnt.innerHTML = "";
str = ""
//heading table
str += '<table class="calendar"><tr><th width="50%">';
str += '<form method="NONE" onsubmit="return 0">';
str += '<a href="javascript:month--; initCalendar();">&laquo;</a> ';
str += '<select id="select_month" name="monthsel" onchange="month = parseInt(document.getElementById(\'select_month\').value); initCalendar();">';
for (i =0; i < 12; i++) {
if (i == month) selected = ' selected="selected"';
else selected = '';
str += '<option value="' + i + '" ' + selected + '>' + month_names[i] + '</option>';
}
str += '</select>';
str += ' <a href="javascript:month++; initCalendar();">&raquo;</a>';
str += '</form>';
str += '</th><th width="50%">';
str += '<form method="NONE" onsubmit="return 0">';
str += '<a href="javascript:year--; initCalendar();">&laquo;</a> ';
str += '<select id="select_year" name="yearsel" onchange="year = parseInt(document.getElementById(\'select_year\').value); initCalendar();">';
for (i = year - 25; i < year + 25; i++) {
if (i == year) selected = ' selected="selected"';
else selected = '';
str += '<option value="' + i + '" ' + selected + '>' + i + '</option>';
}
str += '</select>';
str += ' <a href="javascript:year++; initCalendar();">&raquo;</a>';
str += '</form>';
str += '</th></tr></table>';
str += '<table class="calendar"><tr>';
for (i = 0; i < 7; i++) {
str += "<th>" + day_names[i] + "</th>";
}
str += "</tr>";
var firstDay = new Date(year, month, 1).getDay();
var lastDay = new Date(year, month + 1, 0).getDate();
str += "<tr>";
dayInWeek = 0;
for (i = 0; i < firstDay; i++) {
str += "<td>&nbsp;</td>";
dayInWeek++;
}
for (i = 1; i <= lastDay; i++) {
if (dayInWeek == 7) {
str += "</tr><tr>";
dayInWeek = 0;
}
dispmonth = 1 + month;
if (window.opener.dateType == 'datetime' || window.opener.dateType == 'date') {
actVal = "" + formatNum4(year) + "-" + formatNum2(dispmonth, 'month') + "-" + formatNum2(i, 'day');
} else {
actVal = "" + formatNum4(year) + formatNum2(dispmonth, 'month') + formatNum2(i, 'day');
}
if (i == day) {
style = ' class="selected"';
current_date = actVal;
} else {
style = '';
}
str += "<td" + style + "><a href=\"javascript:returnDate('" + actVal + "');\">" + i + "</a></td>"
dayInWeek++;
}
for (i = dayInWeek; i < 7; i++) {
str += "<td>&nbsp;</td>";
}
str += "</tr></table>";
cnt.innerHTML = str;
// Should we handle time also?
if (window.opener.dateType != 'date' && !clock_set) {
if (document.getElementById) {
cnt = document.getElementById("clock_data");
} else if (document.all) {
cnt = document.all["clock_data"];
}
str = '';
init_hour = hour;
init_minute = minute;
init_second = second;
str += '<fieldset>';
str += '<form method="NONE" class="clock" onsubmit="returnDate(\'' + current_date + '\')">';
str += '<input id="hour" type="text" size="2" maxlength="2" onblur="this.value=formatNum2d(this.value, init_hour, \'hour\'); init_hour = this.value;" value="' + formatNum2(hour, 'hour') + '" />:';
str += '<input id="minute" type="text" size="2" maxlength="2" onblur="this.value=formatNum2d(this.value, init_minute, \'minute\'); init_minute = this.value;" value="' + formatNum2(minute, 'minute') + '" />:';
str += '<input id="second" type="text" size="2" maxlength="2" onblur="this.value=formatNum2d(this.value, init_second, \'second\'); init_second = this.value;" value="' + formatNum2(second, 'second') + '" />';
str += '&nbsp;&nbsp;';
str += '<input type="submit" value="' + submit_text + '"/>';
str += '</form>';
str += '</fieldset>';
cnt.innerHTML = str;
clock_set = 1;
}
}
/**
* Returns date from calendar.
*
* @param string date text
*/
function returnDate(d) {
txt = d;
if (window.opener.dateType != 'date') {
// need to get time
h = parseInt(document.getElementById('hour').value,10);
m = parseInt(document.getElementById('minute').value,10);
s = parseInt(document.getElementById('second').value,10);
if (window.opener.dateType == 'datetime') {
txt += ' ' + formatNum2(h, 'hour') + ':' + formatNum2(m, 'minute') + ':' + formatNum2(s, 'second');
} else {
// timestamp
txt += formatNum2(h, 'hour') + formatNum2(m, 'minute') + formatNum2(s, 'second');
}
}
window.opener.dateField.value = txt;
window.close();
}

197
js/tooltip.js Normal file
View File

@@ -0,0 +1,197 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Displays the Tooltips (hints), if we have some
* 2005-01-20 added by Michael Keck (mkkeck)
*
* @version $Id$
*/
/**
*
*/
var ttXpos = 0, ttYpos = 0;
var ttXadd = 10, ttYadd = -10;
var ttDisplay = 0, ttHoldIt = 0;
// Check if browser does support dynamic content and dhtml
var ttNS4 = (document.layers) ? 1 : 0; // the old Netscape 4
var ttIE4 = (document.all) ? 1 : 0; // browser wich uses document.all
var ttDOM = (document.getElementById) ? 1 : 0; // DOM-compatible browsers
if (ttDOM) { // if DOM-compatible, set the others to false
ttNS4 = 0;
ttIE4 = 0;
}
var myTooltipContainer = null;
if ( (ttDOM) || (ttIE4) || (ttNS4) ) {
// mouse-event
if ( ttNS4 ) {
document.captureEvents(Event.MOUSEMOVE);
} else {
document.onmousemove = mouseMove;
}
}
/**
* init the tooltip and write the text into it
*
* @param string theText tooltip content
*/
function textTooltip(theText) {
if (ttDOM || ttIE4) { // document.getEelementById || document.all
myTooltipContainer.innerHTML = ""; // we should empty it first
myTooltipContainer.innerHTML = theText;
} else if (ttNS4) { // document.layers
var layerNS4 = myTooltipContainer.document;
layerNS4.write(theText);
layerNS4.close();
}
}
/**
* @var integer
*/
var ttTimerID = 0;
/**
* swap the Tooltip // show and hide
*
* @param boolean stat view status
*/
function swapTooltip(stat) {
if (ttHoldIt!=1) {
if (stat!='default') {
if (stat=='true')
showTooltip(true);
else if (stat=='false')
showTooltip(false);
} else {
if (ttDisplay)
ttTimerID = setTimeout("showTooltip(false);",500);
else
showTooltip(true);
}
} else {
if (ttTimerID) {
clearTimeout(ttTimerID);
ttTimerID = 0;
}
showTooltip(true);
}
}
/**
* show / hide the Tooltip
*
* @param boolean stat view status
*/
function showTooltip(stat) {
if (stat==false) {
if (ttNS4)
myTooltipContainer.visibility = "hide";
else
myTooltipContainer.style.visibility = "hidden";
ttDisplay = 0;
} else {
if (ttNS4)
myTooltipContainer.visibility = "show";
else
myTooltipContainer.style.visibility = "visible";
ttDisplay = 1;
}
}
/**
* hold it, if we create or move the mouse over the tooltip
*/
function holdTooltip() {
ttHoldIt = 1;
swapTooltip('true');
ttHoldIt = 0;
}
/**
* move the tooltip to mouse position
*
* @param integer posX horiz. position
* @param integer posY vert. position
*/
function moveTooltip(posX, posY) {
if (ttDOM || ttIE4) {
myTooltipContainer.style.left = posX + "px";
myTooltipContainer.style.top = posY + "px";
} else if (ttNS4) {
myTooltipContainer.left = posX;
myTooltipContainer.top = posY;
}
}
/**
* build the tooltip
*
* @param string theText tooltip content
*/
function pmaTooltip( theText ) {
// reference to TooltipContainer
if ( null == myTooltipContainer ) {
if (ttNS4) {
myTooltipContainer = document.TooltipContainer;
} else if (ttIE4) {
myTooltipContainer = document.all('TooltipContainer');
} else if (ttDOM) {
myTooltipContainer = document.getElementById('TooltipContainer');
} else {
return;
}
if ( typeof( myTooltipContainer ) == 'undefined' ) {
return;
}
}
var plusX=0, plusY=0, docX=0, docY=0;
var divHeight = myTooltipContainer.clientHeight;
var divWidth = myTooltipContainer.clientWidth;
if (navigator.appName.indexOf("Explorer")!=-1) {
if (document.documentElement && document.documentElement.scrollTop) {
plusX = document.documentElement.scrollLeft;
plusY = document.documentElement.scrollTop;
docX = document.documentElement.offsetWidth + plusX;
docY = document.documentElement.offsetHeight + plusY;
} else {
plusX = document.body.scrollLeft;
plusY = document.body.scrollTop;
docX = document.body.offsetWidth + plusX;
docY = document.body.offsetHeight + plusY;
}
} else {
docX = document.body.clientWidth;
docY = document.body.clientHeight;
}
ttXpos = ttXpos + plusX;
ttYpos = ttYpos + plusY;
if ((ttXpos + divWidth) > docX)
ttXpos = ttXpos - (divWidth + (ttXadd * 2));
if ((ttYpos + divHeight) > docY)
ttYpos = ttYpos - (divHeight + (ttYadd * 2));
textTooltip(theText);
moveTooltip((ttXpos + ttXadd), (ttYpos + ttYadd));
holdTooltip();
}
/**
* register mouse moves
*
* @param event e
*/
function mouseMove(e) {
if ( typeof( event ) != 'undefined' ) {
ttXpos = event.x;
ttYpos = event.y;
} else {
ttXpos = e.pageX;
ttYpos = e.pageY;
}
}

196
js/user_password.js Normal file
View File

@@ -0,0 +1,196 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* function used for password change form
*
* @version $Id$
*/
/**
* Validates the password field in a form
*
* @param object the form
*
* @return boolean whether the field value is valid or not
*/
function checkPassword(the_form)
{
// Gets the elements pointers
if (the_form.name == 'addUserForm' || the_form.name == 'chgPassword') {
var pswd_index = 1;
var pswd1_name = 'pma_pw';
var pswd2_name = 'pma_pw2';
} else {
pswd_index = 2;
pswd1_name = 'new_pw';
pswd2_name = 'new_pw2';
}
// Validates
if (the_form.elements['nopass'][pswd_index].checked) {
if (the_form.elements[pswd1_name].value == '') {
alert(jsPasswordEmpty);
the_form.elements[pswd2_name].value = '';
the_form.elements[pswd1_name].focus();
return false;
} else if (the_form.elements[pswd1_name].value != the_form.elements[pswd2_name].value) {
alert(jsPasswordNotSame);
the_form.elements[pswd1_name].value = '';
the_form.elements[pswd2_name].value = '';
the_form.elements[pswd1_name].focus();
return false;
} // end if...else if
} // end if
return true;
} // end of the 'checkPassword()' function
/**
* Validates the "add an user" form
*
* @return boolean whether the form is validated or not
*/
function checkAddUser()
{
var the_form = document.forms['addUserForm'];
if (the_form.elements['anyhost'][1].checked && the_form.elements['host'].value == '') {
alert(jsHostEmpty);
the_form.elements['host'].focus();
return false;
}
if (the_form.elements['anyuser'][1].checked && the_form.elements['pma_user'].value == '') {
alert(jsUserEmpty);
the_form.elements['pma_user'].focus();
return false;
}
return checkPassword(the_form);
} // end of the 'checkAddUser()' function
/**
* Validates the "update a profile" form
*
* @return boolean whether the form is validated or not
*/
function checkUpdProfile()
{
var the_form = document.forms['updUserForm'];
if (the_form.elements['anyhost'][1].checked && the_form.elements['new_server'].value == '') {
alert(jsHostEmpty);
the_form.elements['new_server'].focus();
return false;
}
if (the_form.elements['anyuser'][1].checked && the_form.elements['new_user'].value == '') {
alert(jsUserEmpty);
the_form.elements['new_user'].focus();
return false;
}
return checkPassword(the_form);
} // end of the 'checkUpdProfile()' function
/**
* Gets the list of selected options in combo
*
* @param object the form to check
*
* @return string the list of selected options
*/
function getSelected(the_field) {
var the_list = '';
var opts = the_field.options;
var opts_cnt = opts.length;
for (var i = 0; i < opts_cnt; i++) {
if (opts[i].selected) {
the_list += opts[i].text + ', ';
}
} // end for
return the_list.substring(0, the_list.length - 2);
} // end of the 'getSelected()' function
/**
* Reloads the page to get tables names in a database or fields names in a
* table
*
* @param object the input text box to build the query from
*/
function change(the_field) {
var l = location.href;
var lpos = l.indexOf('?lang');
var box_name = the_field.name;
var the_form = the_field.form.elements;
var sel_idx = null;
if (box_name == 'newdb') {
the_form['anydb'][0].checked = true;
the_form['anytable'][0].checked = true;
the_form['anycolumn'][0].checked = true;
if (typeof(the_form['dbgrant']) != 'undefined') {
the_form['dbgrant'].selectedIndex = -1;
}
if (typeof(the_form['tablegrant']) != 'undefined') {
the_form['tablegrant'].selectedIndex = -1;
}
if (typeof(the_form['colgrant']) != 'undefined') {
the_form['colgrant'].selectedIndex = -1;
}
}
else {
if (lpos <= 0) {
l += '?lang=' + the_form['lang'].value
+ '&convcharset=' . the_form['convcharset'].value
+ '&server=' + the_form['server'].value
+ '&grants=1'
+ '&host=' + escape(the_form['host'].value)
+ '&pma_user=' + escape(the_form['pma_user'].value);
sel_idx = the_form['dbgrant'].selectedIndex;
if (sel_idx > 0) {
l += '&dbgrant=' + escape(the_form['dbgrant'].options[sel_idx].text);
}
sel_idx = the_form['tablegrant'].selectedIndex;
if (sel_idx > 0) {
l += '&tablegrant=' + escape(the_form['tablegrant'].options[sel_idx].text);
}
}
var lpos = l.indexOf('&' + box_name);
if (lpos > 0) {
l = l.substring(0, lpos);
} // end if
location.href = l + '&' + box_name + '=' + escape(getSelected(the_field));
}
} // end of the 'change()' function
/**
* Checks/unchecks all privileges
*
* @param string the form name
* @param boolean whether to check or to uncheck the element
*
* @return boolean always true
*/
function checkForm(the_form, do_check) {
var elts = document.forms[the_form].elements;
var elts_cnt = elts.length;
for (var i = 0; i < elts_cnt; i++) {
var whichElt = elts[i].name;
if (whichElt.indexOf('_priv') >= 0) {
document.forms[the_form].elements[whichElt].checked = do_check;
} // end if
} // end for
return true;
} // end of the 'checkForm()' function

32
lang/add_message.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
# $Id$
#
# Shell script that adds a message to all message files (Lem9)
#
# Example: add_message.sh '$strNewMessage' 'new message contents'
#
if [ $# -ne 2 ] ; then
echo "usage: add_message.sh '\$strNewMessage' 'new message contents'"
exit 1
fi
for file in *.inc.php
do
echo $file " "
grep -v '?>' ${file} > ${file}.new
case $file in
english*)
echo "$1 = '"$2"';" >> ${file}.new
;;
*)
echo "$1 = '"$2"'; //to translate" >> ${file}.new
;;
esac
echo "?>" >> ${file}.new
rm $file
mv ${file}.new $file
done
./sort_lang.sh english*
echo " "
echo "Message added to all message files (including english)"

32
lang/add_message_file.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
# $Id$
#
# Shell script that adds a message file to all message files
# adding "//to translate" on each line
#
# Example: add_message_file.sh xxx
#
if [ $# -ne 1 ] ; then
echo "usage: add_message_file.sh filename"
exit 1
fi
for file in *.inc.php
do
echo $file " "
grep -v '?>' ${file} > ${file}.new
case $file in
english*)
sed -n 's/\(.*\);/\1;/p' $1 >> ${file}.new
;;
*)
sed -n 's/\(.*\);/\1; \/\/to translate/p' $1 >> ${file}.new
;;
esac
echo "?>" >> ${file}.new
rm $file
mv ${file}.new $file
done
./sort_lang.sh english*
echo " "
echo "Messages added to add message files (including english)"

File diff suppressed because it is too large Load Diff

1055
lang/afrikaans-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1054
lang/albanian-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

1056
lang/arabic-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1048
lang/basque-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1054
lang/bosnian-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1051
lang/bulgarian-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1027
lang/catalan-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

62
lang/check_lang.sh Executable file
View File

@@ -0,0 +1,62 @@
#!/bin/sh
# $Id$
##
# Shell script to check that all language files are syncronized
# Catches duplicate/missing strings
#
# Robin Johnson <robbat2@users.sourceforge.net>
# August 9, 2002
##
MASTER="english-iso-8859-1.inc.php"
TMPDIR="tmp-check"
FILEPAT="*.inc.php"
STRINGMATCH='^[[:space:]]*\$[[:alnum:]_]+[[:blank:]]+='
IGNOREMATCH='strEncto|strKanjiEncodConvert|strXkana|allow_recoding|doc_lang'
if [ "`which diffstat`" = "" ] ; then
echo 'You need diffstat to use this!'
exit 1
fi
rm -rf $TMPDIR
mkdir -p $TMPDIR
# Build the list of variables in each file
echo "Building data"
for f in $FILEPAT;
do
awk "/$STRINGMATCH/ && ! /$IGNOREMATCH/ { print \$1 }" $f | sort > $TMPDIR/$f
done
# Build the diff files used for checking
# And if there are no differences, delete the empty files
echo "Comparing data"
for f in $FILEPAT;
do
if [ ! $MASTER = $f ]; then
if diff -u $TMPDIR/$MASTER $TMPDIR/$f >$TMPDIR/$f.diff ; then
rm -f $TMPDIR/$f.diff $TMPDIR/$f
fi
fi
done
# Cleanup
rm -f $TMPDIR/$MASTER
# Build the nice difference table
echo "Differences"
diffstat -f 0 $TMPDIR/*.diff >$TMPDIR/diffstat 2>/dev/null
echo "Dupe Miss Filename"
head -n -1 $TMPDIR/diffstat | \
while read filename sep change add plus sub minus edits exclaim;
do
echo "$add $sub $filename";
done
echo
echo "Dupe = Duplicate Variables"
echo "Miss = Missing Variables"
echo "For exact problem listings, look in the $TMPDIR/ directory"
echo "Please remember to remove '$TMPDIR/' once you are done"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1029
lang/croatian-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1030
lang/czech-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1030
lang/danish-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1052
lang/dutch-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1030
lang/english-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1036
lang/estonian-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1033
lang/finnish-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1027
lang/french-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1029
lang/galician-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

1056
lang/georgian-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1033
lang/german-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1053
lang/greek-utf-8.inc.php Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More