Merge branch 'master' into string_width

Conflicts:
	test/classes/schema/Svg_test.php
This commit is contained in:
Dieter Adriaenssens 2013-11-28 16:32:49 +01:00
commit 0fe2acc424
465 changed files with 153466 additions and 128067 deletions

6
.gitignore vendored
View File

@ -28,8 +28,8 @@ web.config
/locale/
# Backups
*~
# Javascript sources
/sources/
# Javascript line counts
/js/line_counts.php
# API documentation
/apidoc/
# Demo server
@ -41,3 +41,5 @@ phpunit.xml
/build/
# Netbeans ide stuff
/nbproject/
# Eclipse ide stuff
/.pydevproject

21
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,21 @@
# Contributing to phpMyAdmin
As an open source project, phpMyAdmin welcomes contributions of many forms.
## Bug reporting
Please report [bugs on SourceForge.net][1].
[1]: https://sourceforge.net/p/phpmyadmin/bugs/new/
## Patches submission
Patches are welcome either as [pull requests on GitHub][2].
[2]: https://github.com/phpmyadmin/phpmyadmin/pulls
## More information
You can find more information on our website:
http://www.phpmyadmin.net/home_page/improve.php

View File

@ -1,6 +1,8 @@
phpMyAdmin - ChangeLog
======================
4.2.0.0 (not yet released)
4.1.0.0 (not yet released)
+ rfe #499 On user creation, warn if the user already exists
+ Use indeterminate check all checkbox in server privileges
@ -42,8 +44,48 @@ phpMyAdmin - ChangeLog
- bug #4068 Headline in operations not readable in IE10
- bug #4000 "Table does not contain unique column" message appears after adding a unique column
+ rfe #1428 add 'new database' entry to nav tree
+ rfe #1457 Stone Age icon found
+ rfe #1463 Filter tables and databases by regular expression
+ Change the proxy variable names in the config to remove the VersionCheck prefix from them
+ Added an Error Reporting Component
+ Javascript files are no longer uglified
- bug #4145 Config screen fails to validate MemoryLimit = -1 (new default)
- bug #4123 Double config including
- bug #4134 After deleting all rows on a page, it returns to a blank page
+ Dropped configuration directive: DisableIS, ShowDatabasesCommand
- bug #4152 Not possible to enter % for search in date fields
- bug #3931 IN Clause search does not permit multiple values
- bug #4086 Clicking OK from edit popup opens new tab
- bug #2983 unknown table status: TABLE_TYPE
- bug #4030 ORDER BY SUM(`field`) does not sort DESC
- bug #4133 CSV import breaks when no blank line at end of file
- bug #4153 Unable to import if newline encoding is MAC style
- bug #4096 horizontal scrollbar should not overflow on the left column
- bug #4159 bug with navigation between database and table filter
4.0.8.0 (not yet released)
4.0.10.0 (not yet released)
- bug #4150 Clicking database name in query window opens a new tab
- bug #4141 Wrong page is shown after editing; also, do not show a modal
dialog for multi-row edit
- bug #3939 PHP NavigationTree error when paging through list
- bug #4075 Support A10 Networks load balancer
- bug #4083 row deleting isn't binlogs friendly
- bug #4163 Setup script does not recognize manually-configured server
- bug #4158 Events page says no privileges with ALL PRIVILEGES
4.0.9.0 (2013-11-04)
- bug #4104 Can't edit updatable view when searching
- bug #4108 Missing refresh by deleting databases
- bug #3995 Drizzle server charset notice
- bug #3911 Filtering database names includes empty groupings
- bug #3678 Does not display or manipulate bit(64) fields appropriately
- bug #4129 Unneeded navi panel refresh
- bug #4120 SSL redirects to port 80
- bug #4144 DROP DATABASE displays wrong database name
- bug #4059 Running delete query asks for confirmation but says it was already executed
- bug #4147 Accessibility: Images without Alt nor title attribute
4.0.8.0 (2013-10-06)
- bug #3988 Rename view is not working
- bug #4041 Interaction between linkified fields and grid editing
- bug #3975 Table grouping isn't implemented properly
@ -56,10 +98,14 @@ phpMyAdmin - ChangeLog
- bug #4103 Tracking report: cannot delete a statement
- bug #3996 Drizzle navigation doesn't expand
- bug #4074 GIS column editor: point not displayed
- bug #4109 Drizzle tables in navigation are shown as views
- bug #4095 NUL symbols added to the end of database dump file
- bug #4105 More disappears in table Structure
- bug #3992 Multi-row edit doesn't clear values when checking NULL
4.0.7.0 (2013-09-23)
- bug #3993 Sorting in database overview with statistics doesn't work
- bug Handle the situation where PHP_SELF is not set
- bug Handle the situation where PHP_SELF is not set
- bug #4080 Overwrite existing file not obeyed
- bug #3929 Database-specific privileges are not copied when cloning user
- bug #3997 Error handling in case MySQL extension is missing
@ -261,7 +307,7 @@ VerboseMultiSubmit, ReplaceHelpImg
+ Removed the "Synchronize" feature
+ Improved layout of server variables page
+ rfe #1052091 [config] Double-underscores in PMA table names
+ Improved the "More" dropdown on the table structure page
+ Improved the "" dropdown on the table structure page
+ [interface] Added "scroll to top" link in menubar
+ [designer] Fullscreen mode for the designer
+ Upgraded jquery to v1.8.3 and jquery-ui to v1.9.2

View File

@ -493,7 +493,7 @@ class PMAStandard_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_
* @param PHP_CodeSniffer_CommentParser_DocElement $tagElement The doc comment
* element.
*
* @return void
* @return string|int
*/
protected function getIndentation($tagName, $tagElement)
{

2
README
View File

@ -1,7 +1,7 @@
phpMyAdmin - Readme
===================
Version 4.1-dev
Version 4.2.0-dev
A set of PHP-scripts to manage MySQL over the web.

View File

@ -43,8 +43,8 @@ $foreign_limit = PMA_getForeignLimit(
$foreignData = PMA_getForeignData(
$foreigners, $_REQUEST['field'], true,
isset($_REQUEST['foreign_filter'])
? $_REQUEST['foreign_filter']
isset($_REQUEST['foreign_filter'])
? $_REQUEST['foreign_filter']
: '',
isset($foreign_limit) ? $foreign_limit : null
);

View File

@ -138,6 +138,13 @@ $cfg['SaveDir'] = '';
*/
//$cfg['QueryHistoryMax'] = 100;
/**
* Should error reporting be enabled for JavaScript errors
*
* default = 'ask'
*/
//$cfg['SendErrorReports'] = 'ask';
/*
* You can find more configuration options in the documentation
* in the doc/ folder or at <http://docs.phpmyadmin.net/>.

View File

@ -172,6 +172,7 @@ if (strlen($db)
'sql_query',
PMA_Util::getMessage(null, $sql_query)
);
$response->addJSON('db', $db);
exit;
}
}

View File

@ -35,8 +35,8 @@ $back = 'db_sql.php';
$response->addHTML(
PMA_getHtmlForSqlQueryForm(
true, false,
isset($_REQUEST['delimiter'])
? htmlspecialchars($_REQUEST['delimiter'])
isset($_REQUEST['delimiter'])
? htmlspecialchars($_REQUEST['delimiter'])
: ';'
)
);

View File

@ -49,7 +49,7 @@ copyright = u'2012 - 2013, The phpMyAdmin devel team'
# built documents.
#
# The short X.Y version.
version = '4.1-dev'
version = '4.2.0-dev'
# The full version, including alpha/beta/rc tags.
release = version

View File

@ -123,6 +123,27 @@ Basic settings
Show warning about incomplete translations on certain threshold.
.. config:option:: $cfg['SendErrorReports']
:type: string
:default: ``'ask'``
Sets the default behavior for JavaScript error reporting.
Whenever an error is detected in the JavaScript execution, an error report
may be sent to the phpMyAdmin team if the user agrees.
The default setting of ``'ask'`` will ask the user everytime there is a new
error report. However you can set this parameter to ``'always'`` to send error
reports without asking for confirmation or you can set it to ``'never'`` to
never send error reports.
This directive is available both in the configuration file and in users
preferences. If the person in charge of a multi-user installation prefers
to disable this feature for all users, a value of ``'never'`` should be
set, and the :config:option:`$cfg['UserprefsDisallow']` directive should
contain ``'SendErrorReports'`` in one of its array values.
.. config:option:: $cfg['AllowThirdPartyFraming']
:type: boolean
@ -989,38 +1010,6 @@ Server connection settings
* ``xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xx[yyy-zzz]`` (partial :term:`IPv6` address range)
.. config:option:: $cfg['Servers'][$i]['DisableIS']
:type: boolean
:default: true
Disable using ``INFORMATION_SCHEMA`` to retrieve information (use
``SHOW`` commands instead), because of speed issues when many
databases are present. Currently used in some parts of the code, more
to come.
.. config:option:: $cfg['Servers'][$i]['ShowDatabasesCommand']
:type: string
:default: ``'SHOW DATABASES'``
On a server with a huge number of databases, the default ``SHOW DATABASES``
command used to fetch the name of available databases will probably be too
slow, so it can be replaced by faster commands. You can use ``#user#``
string will be replaced by current user.
When using ``false``, it will disable fetching databases from the server,
only databases in :config:option:`$cfg['Servers'][$i]['only_db']` will be
displayed.
Examples:
* ``'SHOW DATABASES'``
* ``"SHOW DATABASES LIKE '#user#\_%'"``
* ``'SELECT DISTINCT TABLE_SCHEMA FROM information_schema.SCHEMA_PRIVILEGES'``
* ``'SELECT SCHEMA_NAME FROM information_schema.SCHEMATA'``
* ``false``
.. config:option:: $cfg['Servers'][$i]['SignonScript']
:type: string
@ -1072,9 +1061,6 @@ Server connection settings
if not, this setting is ignored silently). You have to provide
:config:option:`$cfg['Servers'][$i]['StatusCacheLifetime']`.
Takes effect only if :config:option:`$cfg['Servers'][$i]['DisableIS']` is
``true``.
.. config:option:: $cfg['Servers'][$i]['StatusCacheLifetime']
:type: integer
@ -1111,17 +1097,18 @@ Generic settings
This setting can be adjusted by your vendor.
.. config:option:: $cfg['VersionCheckProxyUrl']
.. config:option:: $cfg['ProxyUrl']
:type: string
:default: ""
The url of the proxy to be used when retrieving the information about
the latest version of phpMyAdmin. You need this if the server where
phpMyAdmin is installed does not have direct access to the internet.
The url of the proxy to be used when phpmyadmin needs to access the outside
intenet such as when retrieving the latest version info or submitting error
reports. You need this if the server where phpMyAdmin is installed does not
have direct access to the internet.
The format is: "hostname:portnumber"
.. config:option:: $cfg['VersionCheckProxyUser']
.. config:option:: $cfg['ProxyUser']
:type: string
:default: ""
@ -1131,7 +1118,7 @@ Generic settings
Authentication will be performed. No other types of authentication
are currently supported.
.. config:option:: $cfg['VersionCheckProxyPass']
.. config:option:: $cfg['ProxyPass']
:type: string
:default: ""
@ -1146,14 +1133,6 @@ Generic settings
The maximum number of database names to be displayed in the main panel's
database list.
.. config:option:: $cfg['MaxNavigationItems']
:type: integer
:default: 250
The number of items that can be displayed on each page of the
navigation tree.
.. config:option:: $cfg['MaxTableList']
:type: integer
@ -1205,7 +1184,7 @@ Generic settings
.. note::
In some setups (like separate SSL proxy or loadballancer) you might
In some setups (like separate SSL proxy or load balancer) you might
have to set :config:option:`$cfg['PmaAbsoluteUri']` for correct
redirection.
@ -1417,6 +1396,14 @@ Cookie authentication options
Navigation panel setup
----------------------
.. config:option:: $cfg['MaxNavigationItems']
:type: integer
:default: 250
The number of items that can be displayed on each page of the
navigation tree.
.. config:option:: $cfg['NavigationTreeEnableGrouping']
:type: boolean

View File

@ -23,6 +23,8 @@ Credits, in chronological order
* current project maintainer
* maintains content on our website
* Olivier Müller <om\_at\_omnis.ch>
* started SourceForge phpMyAdmin project in March 2001
@ -134,6 +136,8 @@ Credits, in chronological order
* Czech language file updates
* created current website for phpMyAdmin
* Christophe Gesché from the "MySQL Form Generator for PHPMyAdmin"
(http://sf.net/projects/phpmysqlformgen/)
@ -342,6 +346,14 @@ Credits, in chronological order
* phpseclib
* Bin Zu (Google Summer of Code 2013)
* Refactoring
* Supun Nakandala (Google Summer of Code 2013)
* Refactoring
And also to the following people who have contributed minor changes,
enhancements, bugfixes or support for a new language since version
2.1.0:

View File

@ -37,10 +37,10 @@ PHP
Database
--------
phpMyAdmin support MySQL compatible databases.
phpMyAdmin supports MySQL-compatible databases.
* MySQL 5.0 or newer
* MariaDB 5.0 or newer
* MySQL 5.5 or newer
* MariaDB 5.5 or newer
* Drizzle
.. seealso:: :ref:`faq1_17`

View File

@ -114,8 +114,8 @@ Quick Install
some advanced features.
Manually creating file
----------------------
Manually creating the file
--------------------------
To manually create the file, simply use your text editor to create the
file :file:`config.inc.php` (you can copy :file:`config.sample.inc.php` to get
@ -186,14 +186,15 @@ On other platforms, simply create the folder and ensure that your web
server has read and write access to it. :ref:`faq1_26` can help with
this.
Next, open ``setup/`` in your browser. Note that **changes are
not saved to disk until explicitly choose ``Save``** from the
*Configuration* area of the screen. Normally the script saves the new
Next, open ``setup/`` in your browser. If you have an existing configuration,
use the ``Load`` button to bring its content inside the setup panel.
Note that **changes are not saved to disk until explicitly choose ``Save``**
from the *Configuration* area of the screen. Normally the script saves the new
:file:`config.inc.php` to the ``config/`` directory, but if the webserver does
not have the proper permissions you may see the error "Cannot load or
save configuration." Ensure that the ``config/`` directory exists and
has the proper permissions - or use the ``Download`` link to save the
config file locally and upload (via FTP or some similar means) to the
config file locally and upload it (via FTP or some similar means) to the
proper location.
Once the file has been saved, it must be moved out of the ``config/``

95
error_report.php Normal file
View File

@ -0,0 +1,95 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Handle error report submission
*
* @package PhpMyAdmin
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/error_report.lib.php';
$response = PMA_Response::getInstance();
if (isset($_REQUEST['send_error_report'])
&& $_REQUEST['send_error_report'] == true
) {
$server_response = PMA_sendErrorReport(PMA_getReportData(false));
if ($server_response === false) {
$success = false;
} else {
$decoded_response = json_decode($server_response, true);
$success = !empty($decoded_response) ? $decoded_response["success"] : false;
}
if (isset($_REQUEST['automatic'])
&& $_REQUEST['automatic'] === "true"
) {
if ($success) {
$response->addJSON(
'message',
PMA_Message::error(
__(
'An error has been detected and an error report has been '
.'automatically submitted based on your settings.'
)
. '<br />'
. __('You may want to refresh the page.')
)
);
} else {
$response->addJSON(
'message',
PMA_Message::error(
__(
'An error has been detected and an error report has been '
. 'generated but failed to be sent.'
)
. ' '
. __(
'If you experience any '
. 'problems please submit a bug report manually.'
)
. '<br />'
. __('You may want to refresh the page.')
)
);
}
} else {
if ($success) {
$response->addJSON(
'message',
PMA_Message::success(
__('Thank you for submitting this report.')
. '<br />'
. __('You may want to refresh the page.')
)
);
} else {
$response->addJSON(
'message',
PMA_Message::error(
__('Thank you for submitting this report.')
. ' '
. __('Unfortunately the submission failed.')
. ' '
. __(
'If you experience any '
. 'problems please submit a bug report manually.'
)
. '<br />'
. __('You may want to refresh the page.')
)
);
}
if (isset($_REQUEST['always_send'])
&& $_REQUEST['always_send'] === "true"
) {
PMA_persistOption("SendErrorReports", "always", "ask");
}
}
} elseif (! empty($_REQUEST['get_settings'])) {
$response->addJSON('report_setting', $GLOBALS['cfg']['SendErrorReports']);
} else {
$response->addHTML(PMA_getErrorReportForm());
}

View File

@ -37,7 +37,7 @@ $AUTH_MAP = array(
*
* @return void
*/
function show_page($contents)
function Show_page($contents)
{
header('Content-Type: text/html; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
@ -93,7 +93,7 @@ OpenID: <input type="text" name="identifier" /><br />
</form>
</body>
</html>';
show_page($content);
Show_page($content);
exit;
}
@ -113,7 +113,7 @@ try {
$contents = "<div class='relyingparty_results'>\n";
$contents .= "<pre>" . $e->getMessage() . "</pre>\n";
$contents .= "</div class='relyingparty_results'>";
show_page($contents);
Show_page($contents);
exit;
}
@ -125,7 +125,7 @@ if (isset($_POST['start'])) {
$contents = "<div class='relyingparty_results'>\n";
$contents .= "<pre>" . $e->getMessage() . "</pre>\n";
$contents .= "</div class='relyingparty_results'>";
show_page($contents);
Show_page($contents);
exit;
}
@ -154,7 +154,7 @@ if (isset($_POST['start'])) {
/* Redirect to phpMyAdmin (should use absolute URL here!) */
header('Location: ../index.php');
} else {
show_page('<p>User not allowed!</p>');
Show_page('<p>User not allowed!</p>');
exit;
}
}

View File

@ -12,7 +12,7 @@
if (!defined('TESTSUITE')) {
/**
* If we are sending the export file (as opposed to just displaying it
* as text), we have to bypass the usual PMA_Response mechanism
* as text), we have to bypass the usual PMA_Response mechanism
*/
if ($_POST['output_format'] == 'sendit') {
define('PMA_BYPASS_GET_INSTANCE', 1);
@ -334,7 +334,7 @@ function PMA_exportOutputHandler($line)
}
if ($GLOBALS['save_on_server']) {
$write_result = @fwrite($GLOBALS['file_handle'], $dump_buffer);
if (! $write_result || ($write_result != strlen($dump_buffer))) {
if ($write_result != strlen($dump_buffer)) {
$GLOBALS['message'] = PMA_Message::error(
__('Insufficient space to save the file %s.')
);
@ -398,7 +398,8 @@ if (!defined('TESTSUITE')) {
$crlf = PMA_Util::whichCrlf();
}
$output_kanji_conversion = function_exists('PMA_Kanji_strConv') && $type != 'xls';
$output_kanji_conversion = function_exists('PMA_Kanji_strConv')
&& $type != 'xls';
// Do we need to convert charset?
$output_charset_conversion = $asfile
@ -411,17 +412,16 @@ if (!defined('TESTSUITE')) {
&& ($compression == 'gzip' || $compression == 'bzip2');
if ($onfly_compression) {
$memory_limit = trim(@ini_get('memory_limit'));
$memory_limit_num = (int)substr($memory_limit, 0, -1);
// 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)) == 'm') {
$memory_limit = $memory_limit_num * 1024 * 1024;
} elseif (strtolower(substr($memory_limit, -1)) == 'k') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024;
$memory_limit = $memory_limit_num * 1024;
} elseif (strtolower(substr($memory_limit, -1)) == 'g') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
$memory_limit = $memory_limit_num * 1024 * 1024 * 1024;
} else {
$memory_limit = (int)$memory_limit;
}
@ -508,19 +508,28 @@ if (!defined('TESTSUITE')) {
&& $_REQUEST['quick_export_onserverover'] != 'saveitover'))
) {
$message = PMA_Message::error(
__('File %s already exists on server, change filename or check overwrite option.')
__(
'File %s already exists on server, '
. 'change filename or check overwrite option.'
)
);
$message->addParam($save_filename);
} else {
if (is_file($save_filename) && ! is_writable($save_filename)) {
$message = PMA_Message::error(
__('The web server does not have permission to save the file %s.')
__(
'The web server does not have permission '
. 'to save the file %s.'
)
);
$message->addParam($save_filename);
} else {
if (! $file_handle = @fopen($save_filename, 'w')) {
$message = PMA_Message::error(
__('The web server does not have permission to save the file %s.')
__(
'The web server does not have permission '
. 'to save the file %s.'
)
);
$message->addParam($save_filename);
}
@ -559,7 +568,9 @@ if (!defined('TESTSUITE')) {
if ($export_type == 'database') {
$num_tables = count($tables);
if ($num_tables == 0) {
$message = PMA_Message::error(__('No tables found in database.'));
$message = PMA_Message::error(
__('No tables found in database.')
);
$active_page = 'db_export.php';
include 'db_export.php';
exit();
@ -587,7 +598,9 @@ if (!defined('TESTSUITE')) {
// Convert the multiple select elements from an array to a string
if ($export_type == 'server' && isset($_REQUEST['db_select'])) {
$_REQUEST['db_select'] = implode(",", $_REQUEST['db_select']);
} elseif ($export_type == 'database' && isset($_REQUEST['table_select'])) {
} elseif ($export_type == 'database'
&& isset($_REQUEST['table_select'])
) {
$_REQUEST['table_select'] = implode(",", $_REQUEST['table_select']);
}
@ -597,12 +610,9 @@ if (!defined('TESTSUITE')) {
$back_button .= '&amp;repopulate=1">Back</a> ]</p>';
echo $back_button;
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";
echo '<form name="nofunction">' . "\n";
echo '<textarea name="sqldump" cols="50" rows="30" '
. 'id="textSQLDUMP" wrap="OFF">' . "\n";
} // end download
}
@ -629,6 +639,8 @@ if (!defined('TESTSUITE')) {
// Include dates in export?
$do_dates = isset($GLOBALS[$what . '_dates']);
$whatStrucOrData = $GLOBALS[$what . '_structure_or_data'];
/**
* Builds the dump
*/
@ -650,7 +662,7 @@ if (!defined('TESTSUITE')) {
break 2;
}
if (method_exists($export_plugin, 'exportRoutines')
&& strpos($GLOBALS['sql_structure_or_data'], 'structure') !== false
&& strpos($whatStrucOrData, 'structure') !== false
&& isset($GLOBALS['sql_procedure_function'])
) {
$export_plugin->exportRoutines($current_db);
@ -665,8 +677,8 @@ if (!defined('TESTSUITE')) {
if ($is_view) {
$views[] = $table;
}
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
// for a view, export a stand-in definition of the table
// to resolve view dependencies
@ -679,20 +691,23 @@ if (!defined('TESTSUITE')) {
}
}
// if this is a view or a merge table, don't export data
if (($GLOBALS[$what . '_structure_or_data'] == 'data'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data')
if (($whatStrucOrData == 'data'
|| $whatStrucOrData == 'structure_and_data')
&& ! ($is_view || PMA_Table::isMerge($current_db, $table))
) {
$local_query = 'SELECT * FROM ' . PMA_Util::backquote($current_db)
$local_query = 'SELECT * FROM '
. PMA_Util::backquote($current_db)
. '.' . PMA_Util::backquote($table);
if (! $export_plugin->exportData($current_db, $table, $crlf, $err_url, $local_query)) {
if (! $export_plugin->exportData(
$current_db, $table, $crlf, $err_url, $local_query
)) {
break 3;
}
}
// now export the triggers (needs to be done after the data
// because triggers can modify already imported tables)
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
if (! $export_plugin->exportStructure(
$current_db, $table, $crlf, $err_url,
@ -705,8 +720,8 @@ if (!defined('TESTSUITE')) {
}
foreach ($views as $view) {
// no data export for a view
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
if (! $export_plugin->exportStructure(
$current_db, $view, $crlf, $err_url,
@ -739,16 +754,17 @@ if (!defined('TESTSUITE')) {
$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
// 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 ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
// for a view, export a stand-in definition of the table
// to resolve view dependencies
@ -761,20 +777,22 @@ if (!defined('TESTSUITE')) {
}
}
// if this is a view or a merge table, don't export data
if (($GLOBALS[$what . '_structure_or_data'] == 'data'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data')
if (($whatStrucOrData == 'data'
|| $whatStrucOrData == 'structure_and_data')
&& ! ($is_view || PMA_Table::isMerge($db, $table))
) {
$local_query = 'SELECT * FROM ' . PMA_Util::backquote($db)
. '.' . PMA_Util::backquote($table);
if (! $export_plugin->exportData($db, $table, $crlf, $err_url, $local_query)) {
if (! $export_plugin->exportData(
$db, $table, $crlf, $err_url, $local_query
)) {
break 2;
}
}
// now export the triggers (needs to be done after the data because
// triggers can modify already imported tables)
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
if (! $export_plugin->exportStructure(
$db, $table, $crlf, $err_url,
@ -787,8 +805,8 @@ if (!defined('TESTSUITE')) {
}
foreach ($views as $view) {
// no data export for a view
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
if (! $export_plugin->exportStructure(
$db, $view, $crlf, $err_url,
@ -809,7 +827,11 @@ if (!defined('TESTSUITE')) {
}
// We export just one table
// $allrows comes from the form when "Dump all rows" has been selected
if (isset($allrows) && $allrows == '0' && $limit_to > 0 && $limit_from >= 0) {
if (isset($allrows)
&& $allrows == '0'
&& $limit_to > 0
&& $limit_from >= 0
) {
$add_query = ' LIMIT '
. (($limit_from > 0) ? $limit_from . ', ' : '')
. $limit_to;
@ -818,8 +840,8 @@ if (!defined('TESTSUITE')) {
}
$is_view = PMA_Table::isView($db, $table);
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
if (! $export_plugin->exportStructure(
$db, $table, $crlf, $err_url,
@ -832,8 +854,8 @@ if (!defined('TESTSUITE')) {
// If this is an export of a single view, we have to export data;
// for example, a PDF report
// if it is a merge table, no data is exported
if (($GLOBALS[$what . '_structure_or_data'] == 'data'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data')
if (($whatStrucOrData == 'data'
|| $whatStrucOrData == 'structure_and_data')
&& ! PMA_Table::isMerge($db, $table)
) {
if (! empty($sql_query)) {
@ -848,14 +870,16 @@ if (!defined('TESTSUITE')) {
$local_query = 'SELECT * FROM ' . PMA_Util::backquote($db)
. '.' . PMA_Util::backquote($table) . $add_query;
}
if (! $export_plugin->exportData($db, $table, $crlf, $err_url, $local_query)) {
if (! $export_plugin->exportData(
$db, $table, $crlf, $err_url, $local_query
)) {
break;
}
}
// now export the triggers (needs to be done after the data because
// triggers can modify already imported tables)
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
if (! $export_plugin->exportStructure(
$db, $table, $crlf, $err_url,
@ -954,7 +978,6 @@ if (!defined('TESTSUITE')) {
}
exit();
} else {
PMA_Response::getInstance()->disable();
echo $dump_buffer;
}
} else {

View File

@ -12,7 +12,7 @@
*
* @param string $variable variable to be escaped
*
* @return escaped variable
* @return string escaped variable
*/
function escape($variable)
{
@ -22,6 +22,7 @@ function escape($variable)
require_once 'libraries/common.inc.php';
require_once 'libraries/gis/pma_gis_factory.php';
require_once 'libraries/gis/pma_gis_visualization.php';
require_once 'libraries/tbl_gis_visualization.lib.php';
// Get data if any posted
$gis_data = array();

View File

@ -71,13 +71,20 @@ if (! empty($sql_query)) {
}
// refresh navigation panel only
if (preg_match('/^(CREATE|ALTER)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i', $sql_query)) {
if (preg_match(
'/^(CREATE|ALTER)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
$sql_query
)) {
$ajax_reload['reload'] = true;
}
// do a dynamic reload if table is RENAMED
// (by sending the instruction to the AJAX response handler)
if (preg_match('/^RENAME\s+TABLE\s+(.*?)\s+TO\s+(.*?)($|;|\s)/i', $sql_query, $rename_table_names)) {
if (preg_match(
'/^RENAME\s+TABLE\s+(.*?)\s+TO\s+(.*?)($|;|\s)/i',
$sql_query,
$rename_table_names
)) {
$ajax_reload['table_name'] = PMA_Util::unQuote($rename_table_names[2]);
$ajax_reload['reload'] = true;
}
@ -255,12 +262,19 @@ if (! empty($id_bookmark)) {
}
// refresh navigation and main panels
if (preg_match('/^(DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i', $import_text)) {
if (preg_match(
'/^(DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
$import_text
)) {
$GLOBALS['reload'] = true;
}
// refresh navigation panel only
if (preg_match('/^(CREATE|ALTER)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i', $import_text)) {
if (preg_match(
'/^(CREATE|ALTER)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
$import_text
)
) {
$ajax_reload['reload'] = true;
}
break;
@ -409,12 +423,12 @@ if ($import_file != 'none' && ! $error) {
* Load interface for zip extension.
*/
include_once 'libraries/zip_extension.lib.php';
$result = PMA_getZipContents($import_file);
if (! empty($result['error'])) {
$message = PMA_Message::rawError($result['error']);
$zipResult = PMA_getZipContents($import_file);
if (! empty($zipResult['error'])) {
$message = PMA_Message::rawError($zipResult['error']);
$error = true;
} else {
$import_text = $result['data'];
$import_text = $zipResult['data'];
}
} else {
$message = PMA_Message::error(
@ -610,7 +624,8 @@ if ($go_sql) {
include_once 'libraries/parse_analyze.inc.php';
PMA_executeQueryAndSendQueryResponse(
$analyzed_sql_results, false, $db, $table, null, null, null, false, null,
$analyzed_sql_results, false, $db, $table, null, $import_text, null,
$analyzed_sql_results['is_affected'], null,
null, null, null, $goto, $pmaThemeImage, null, null, null, $sql_query,
null, null
);

View File

@ -1,6 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Import progress bar backend
*
* @package PhpMyAdmin
*/

View File

@ -271,9 +271,11 @@ if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
echo ' <li id="li_select_mysql_charset">';
echo ' ' . __('Server charset:') . ' '
. ' <span lang="en" dir="ltr">'
. ' ' . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']]
. ' (' . $mysql_charset_map['utf-8'] . ')'
. ' <span lang="en" dir="ltr">';
if (! PMA_DRIZZLE) {
echo ' ' . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']];
}
echo ' (' . $mysql_charset_map['utf-8'] . ')'
. ' </span>'
. ' </li>'
. ' </ul>'

View File

@ -146,8 +146,8 @@ var AJAX = {
return true;
} else if (href && href.match(/^mailto/)) {
return true;
} else if ($(this).hasClass('ui-datepicker-next')
|| $(this).hasClass('ui-datepicker-prev')
} else if ($(this).hasClass('ui-datepicker-next') ||
$(this).hasClass('ui-datepicker-prev')
) {
return true;
}
@ -261,6 +261,9 @@ var AJAX = {
.not('#page_content')
.not('#selflink')
.not('#session_debug')
.not('#pma_header')
.not('#pma_footer')
.not('#pma_demo')
.remove();
// Replace #page_content with new content
if (data.message && data.message.length > 0) {
@ -274,7 +277,7 @@ var AJAX = {
$('#selflink > a').attr('href', data._selflink);
}
if (data._scripts) {
AJAX.scriptHandler.load(data._scripts);
AJAX.scriptHandler.load(data._scripts, data._params.token);
}
if (data._selflink && data._scripts && data._menuHash && data._params) {
AJAX.cache.add(
@ -355,7 +358,7 @@ var AJAX = {
*
* @return void
*/
load: function (files) {
load: function (files, token) {
var self = this;
self._scriptsToBeLoaded = [];
self._scriptsToBeFired = [];
@ -377,16 +380,11 @@ var AJAX = {
request.push("scripts[]=" + script);
}
}
request.push("token=" + token);
request.push("call_done=1");
// Download the composite js file, if necessary
if (needRequest) {
$.ajax({
url: "js/get_scripts.js.php?" + request.join("&"),
cache: true,
success: function () {
self.done();
},
dataType: "script"
});
this.appendScript("js/get_scripts.js.php?" + request.join("&"));
} else {
self.done();
}
@ -397,11 +395,26 @@ var AJAX = {
* @return void
*/
done: function () {
if (typeof ErrorReport !== 'undefined') {
ErrorReport.wrap_global_functions();
}
for (var i in this._scriptsToBeFired) {
AJAX.fireOnload(this._scriptsToBeFired[i]);
}
AJAX.active = false;
},
/**
* Appends a script element to the head to load the scripts
*
* @return void
*/
appendScript: function (url) {
var head = document.head || document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
head.appendChild(script);
},
/**
* Fires all the teardown event handlers for the current page
* and rebinds all forms and links to the request handler
@ -505,8 +518,7 @@ AJAX.cache = {
if (rel === 'newpage' ||
(
typeof rel === 'undefined' && (
typeof this.pages[this.current - 1] === 'undefined'
||
typeof this.pages[this.current - 1] === 'undefined' ||
this.pages[this.current - 1].hash !== hash
)
)
@ -545,7 +557,7 @@ AJAX.cache = {
$('#selflink').html(record.selflink);
AJAX.cache.menus.replace(AJAX.cache.menus.get(record.menu));
PMA_commonParams.setAll(record.params);
AJAX.scriptHandler.load(record.scripts);
AJAX.scriptHandler.load(record.scripts, record.params.token);
AJAX.cache.current = ++index;
});
}
@ -811,11 +823,11 @@ $(document).ajaxError(function (event, request, settings) {
var errorCode = $.sprintf(PMA_messages.strErrorCode, request.status);
var errorText = $.sprintf(PMA_messages.strErrorText, request.statusText);
PMA_ajaxShowMessage(
'<div class="error">'
+ PMA_messages.strErrorProcessingRequest
+ '<div>' + errorCode + '</div>'
+ '<div>' + errorText + '</div>'
+ '</div>',
'<div class="error">' +
PMA_messages.strErrorProcessingRequest +
'<div>' + errorCode + '</div>' +
'<div>' + errorText + '</div>' +
'</div>',
false
);
AJAX.active = false;

View File

@ -41,9 +41,9 @@ var PMA_commonParams = (function () {
for (var i in obj) {
if (params[i] !== undefined && params[i] !== obj[i]) {
reload = true;
}
if (i == 'db' || i == 'table') {
updateNavigation = true;
if (i == 'db' || i == 'table') {
updateNavigation = true;
}
}
params[i] = obj[i];
}
@ -74,12 +74,15 @@ var PMA_commonParams = (function () {
* @return self For chainability
*/
set: function (name, value) {
var updateNavigation = false;
if (params[name] !== undefined && params[name] !== value) {
PMA_querywindow.refresh();
PMA_reloadNavigation();
if (name == 'db' || name == 'table') {
updateNavigation = true;
}
}
params[name] = value;
if (name == 'db' || name == 'table') {
if (updateNavigation) {
PMA_showCurrentNavigation();
}
return this;
@ -195,8 +198,8 @@ var PMA_querywindow = (function ($, window) {
if (! querywindow.closed && querywindow.location) {
var href = querywindow.location.href;
if (href != url
&& href != PMA_commonParams.get('pma_absolute_uri') + url
if (href != url &&
href != PMA_commonParams.get('pma_absolute_uri') + url
) {
if (PMA_commonParams.get('safari_browser')) {
querywindow.location.href = targeturl;
@ -209,10 +212,10 @@ var PMA_querywindow = (function ($, window) {
querywindow = window.open(
url + '&init=1',
'',
'toolbar=0,location=0,directories=0,status=1,'
+ 'menubar=0,scrollbars=yes,resizable=yes,'
+ 'width=' + PMA_commonParams.get('querywindow_width') + ','
+ 'height=' + PMA_commonParams.get('querywindow_height')
'toolbar=0,location=0,directories=0,status=1,' +
'menubar=0,scrollbars=yes,resizable=yes,' +
'width=' + PMA_commonParams.get('querywindow_width') + ',' +
'height=' + PMA_commonParams.get('querywindow_height')
);
}
if (! querywindow.opener) {

View File

@ -61,6 +61,7 @@ function setFieldValue(field, field_type, value)
field = $(field);
switch (field_type) {
case 'text':
case 'number':
//TODO: replace to .val()
field.attr('value', (value !== undefined ? value : field.attr('defaultValue')));
break;
@ -102,6 +103,7 @@ function getFieldValue(field, field_type)
field = $(field);
switch (field_type) {
case 'text':
case 'number':
return field.prop('value');
case 'checkbox':
return field.prop('checked');
@ -415,7 +417,7 @@ function validate_field(field, isKeyUp, errors)
errors[field_id] = [];
var functions = getFieldValidators(field_id, isKeyUp);
for (var i = 0; i < functions.length; i++) {
if (functions[i][1] !== null) {
if (typeof functions[i][1] !== 'undefined' && functions[i][1] !== null) {
args = functions[i][1].slice(0);
} else {
args = [];
@ -681,8 +683,9 @@ AJAX.registerOnload('config.js', function () {
var disabled = false;
if (!ls_supported) {
disabled = form.find('input[type=radio][value$=local_storage]').prop('checked');
} else if (!ls_exists && form.attr('name') == 'prefs_import'
&& $('#import_local_storage')[0].checked) {
} else if (!ls_exists && form.attr('name') == 'prefs_import' &&
$('#import_local_storage')[0].checked
) {
disabled = true;
}
form.find('input[type=submit]').prop('disabled', disabled);
@ -724,20 +727,25 @@ function savePrefsToLocalStorage(form)
type: 'POST',
data: {
ajax_request: true,
server: form.find('input[name=server]').val(),
token: form.find('input[name=token]').val(),
submit_get_json: true
},
success: function (response) {
window.localStorage['config'] = response.prefs;
window.localStorage['config_mtime'] = response.mtime;
window.localStorage['config_mtime_local'] = (new Date()).toUTCString();
updatePrefsDate();
$('div.localStorage-empty').hide();
$('div.localStorage-exists').show();
var group = form.parent('.group');
group.css('height', group.height() + 'px');
form.hide('fast');
form.prev('.click-hide-message').show('fast');
success: function (data) {
if (data.success === true) {
window.localStorage['config'] = data.prefs;
window.localStorage['config_mtime'] = data.mtime;
window.localStorage['config_mtime_local'] = (new Date()).toUTCString();
updatePrefsDate();
$('div.localStorage-empty').hide();
$('div.localStorage-exists').show();
var group = form.parent('.group');
group.css('height', group.height() + 'px');
form.hide('fast');
form.prev('.click-hide-message').show('fast');
} else {
PMA_ajaxShowMessage(data.error);
}
},
complete: function () {
submit.prop('disabled', false);

View File

@ -79,13 +79,13 @@ AJAX.registerOnload('db_operations.js', function () {
// use messages that stay on screen
$('div.success, div.error').fadeOut();
if (data.success === true) {
PMA_commonParams.set('db', data.newname);
if ($("#checkbox_switch").is(":checked")) {
PMA_commonParams.set('db', data.newname);
PMA_commonActions.refreshMain(false, function () {
PMA_ajaxShowMessage(data.message);
});
} else {
PMA_commonParams.set('db', data.db);
PMA_ajaxShowMessage(data.message);
}
PMA_reloadNavigation();

307
js/error_report.js Normal file
View File

@ -0,0 +1,307 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* general function, usually for data manipulation pages
*
*/
var ErrorReport = {
/**
* @var object stores the last exception info
*/
_last_exception: null,
/**
* handles thrown error exceptions based on user preferences
*
* @return void
*/
error_handler: function (exception) {
ErrorReport._last_exception = exception;
$.get("error_report.php", {
ajax_request: true,
token: PMA_commonParams.get('token'),
get_settings: true
}, function (data) {
if (!data.success === true) {
PMA_ajaxShowMessage(data.error, false);
return;
}
if (data.report_setting == "ask") {
ErrorReport._showErrorNotification();
} else if (data.report_setting == "always") {
report_data = ErrorReport._get_report_data(exception);
post_data = $.extend(report_data, {
send_error_report: true,
automatic: true
});
$.post("error_report.php", post_data, function (data) {
if (data.success === false) {
//in the case of an error, show the error message returned.
PMA_ajaxShowMessage(data.error, false);
} else {
PMA_ajaxShowMessage(data.message, false);
}
});
}
});
},
/**
* Shows the modal dialog previewing the report
*
* @param object error report info
*
* @return void
*/
_showReportDialog: function (exception) {
var report_data = ErrorReport._get_report_data(exception);
/*Remove the hidden dialogs if there are*/
if ($('#error_report_dialog').length !== 0) {
$('#error_report_dialog').remove();
}
var $div = $('<div id="error_report_dialog"></div>');
var button_options = {};
button_options[PMA_messages.strSendErrorReport] = function () {
$dialog = $(this);
post_data = $.extend(report_data, {
send_error_report: true,
description: $("#report_description").val(),
always_send: $("#always_send_checkbox")[0].checked
});
$.post("error_report.php", post_data, function (data) {
$dialog.dialog('close');
if (data.success === false) {
//in the case of an error, show the error message returned.
PMA_ajaxShowMessage(data.error, false);
} else {
PMA_ajaxShowMessage(data.message, 3000);
}
});
};
button_options[PMA_messages.strCancel] = function () {
$(this).dialog('close');
};
$.post("error_report.php", report_data, function (data) {
if (data.success === false) {
//in the case of an error, show the error message returned.
PMA_ajaxShowMessage(data.error, false);
} else {
// Show dialog if the request was successful
$div
.append(data.message)
.dialog({
title: PMA_messages.strSubmitErrorReport,
width: 650,
modal: true,
buttons: button_options,
close: function () {
$(this).remove();
}
});
}
}); // end $.get()
},
/**
* Shows the small notification that asks for user permission
*
* @return void
*/
_showErrorNotification: function () {
ErrorReport._removeErrorNotification();
$div = $(
'<div style="position:fixed;bottom:0;left:0;right:0;margin:0;' +
'z-index:1000" class="error" id="error_notification"></div>'
).append(
PMA_getImage("s_error.png") + PMA_messages.strErrorOccurred
);
$buttons = $('<div style="float:right"></div>');
button_html = '<button id="show_error_report">';
button_html += PMA_messages.strShowReportDetails;
button_html += '</button>';
button_html += '<a id="change_error_settings">';
button_html += PMA_getImage('s_cog.png', PMA_messages.strChangeReportSettings);
button_html += '</a>';
button_html += '<a href="#" id="ignore_error">';
button_html += PMA_getImage('b_close.png', PMA_messages.strIgnore);
button_html += '</a>';
$buttons.html(button_html);
$div.append($buttons);
$div.appendTo(document.body);
$("#change_error_settings").on("click", ErrorReport._redirect_to_settings);
$("#show_error_report").on("click", ErrorReport._createReportDialog);
$("#ignore_error").on("click", ErrorReport._removeErrorNotification);
},
/**
* Removes the notification if it was displayed before
*
* @return void
*/
_removeErrorNotification: function () {
$("#error_notification").fadeOut(function () {
$(this).remove();
});
},
/**
* Shows the modal dialog previewing the report
*
* @return void
*/
_createReportDialog: function () {
ErrorReport._removeErrorNotification();
ErrorReport._showReportDialog(ErrorReport._last_exception);
},
/**
* Returns the needed info about stored microhistory
*
* @return object
*/
_get_microhistory: function () {
cached_pages = AJAX.cache.pages.slice(-7);
remove = ["common_query", "table", "db", "token", "pma_absolute_uri"];
return {
pages: cached_pages.map(function (page) {
simplepage = {
hash: page.hash
};
if (page.params) {
simplepage.params = $.extend({}, page.params);
$.each(simplepage.params, function (param) {
if ($.inArray(param, remove) != -1) {
delete simplepage.params[param];
}
});
}
return simplepage;
}),
current_index: AJAX.cache.current -
(AJAX.cache.pages.length - cached_pages.length)
};
},
/**
* Redirects to the settings page containing error report
* preferences
*
* @return void
*/
_redirect_to_settings: function () {
window.location.href = "prefs_forms.php?token=" + PMA_commonParams.get('token');
},
/**
* Returns the report data to send to the server
*
* @param object exception info
*
* @return object
*/
_get_report_data: function (exception) {
var report_data = {
"ajax_request": true,
"token": PMA_commonParams.get('token'),
"exception": exception,
"current_url": window.location.href,
"microhistory": ErrorReport._get_microhistory()
};
if (typeof AJAX.cache.pages[this.current - 1] === 'undefined') {
report_data.scripts = AJAX.cache.pages[AJAX.cache.current - 1].scripts.map(
function (script) {
return script.name;
}
);
}
return report_data;
},
/**
* Wraps all global functions that start with PMA_
*
* @return void
*/
wrap_global_functions: function () {
for (var key in window) {
var global = window[key];
if (typeof(global) === "function" && key.indexOf("PMA_") === 0) {
window[key] = ErrorReport.wrap_function(global);
}
}
},
/**
* Wraps given function in error reporting code and returns wrapped function
*
* @param function function to be wrapped
*
* @return function
*/
wrap_function: function (func) {
if (!func.wrapped) {
var new_func = function () {
try {
return func.apply(this, arguments);
} catch (x) {
TraceKit.report(x);
}
};
new_func.wrapped = true;
return new_func;
} else {
return func;
}
},
/**
* Automatically wraps the callback in AJAX.registerOnload
*
* @return void
*/
_wrap_ajax_onload_callback: function () {
var oldOnload = AJAX.registerOnload;
AJAX.registerOnload = function (file, func) {
func = ErrorReport.wrap_function(func);
oldOnload.call(this, file, func);
};
},
/**
* Automatically wraps the callback in $.fn.on
*
* @return void
*/
_wrap_$_on_callback: function () {
var oldOn = $.fn.on;
$.fn.on = function () {
for (var i = 1; i <= 3; i++) {
if (typeof(arguments[i]) === "function") {
arguments[i] = ErrorReport.wrap_function(arguments[i]);
break;
}
}
return oldOn.apply(this, arguments);
};
},
/**
* Wraps all global functions that start with PMA_
* also automatically wraps the callback in AJAX.registerOnload
*
* @return void
*/
set_up_error_reporting: function () {
ErrorReport.wrap_global_functions();
ErrorReport._wrap_ajax_onload_callback();
ErrorReport._wrap_$_on_callback();
}
};
TraceKit.report.subscribe(ErrorReport.error_handler);
ErrorReport.set_up_error_reporting();
$(function () {
ErrorReport.wrap_global_functions();
});

View File

@ -209,6 +209,7 @@ function PMA_addDatepicker($this_element, options)
showButtonPanel: false,
dateFormat: 'yy-mm-dd', // yy means year with four digits
timeFormat: 'HH:mm:ss.lc',
constrainInput: false,
altFieldTimeOnly: false,
showAnim: '',
beforeShow: function (input, inst) {
@ -340,9 +341,12 @@ function confirmQuery(theForm1, sqlQuery1)
do_confirm_re_1.test(sqlQuery1.value) ||
do_confirm_re_2.test(sqlQuery1.value) ||
do_confirm_re_3.test(sqlQuery1.value)) {
var message = (sqlQuery1.value.length > 100)
? sqlQuery1.value.substr(0, 100) + '\n ...'
: sqlQuery1.value;
var message;
if (sqlQuery1.value.length > 100) {
message = sqlQuery1.value.substr(0, 100) + '\n ...';
} else {
message = sqlQuery1.value;
}
var is_confirmed = confirm($.sprintf(PMA_messages.strDoYouReally, message));
// statement is confirmed -> update the
// "is_js_confirmed" form field so the confirm test won't be
@ -395,8 +399,7 @@ function checkSqlQuery(theForm)
}
if (isEmpty && typeof(theForm.elements['id_bookmark']) != 'undefined' &&
(theForm.elements['id_bookmark'].value !== null || theForm.elements['id_bookmark'].value !== '') &&
theForm.elements['id_bookmark'].selectedIndex !== 0
) {
theForm.elements['id_bookmark'].selectedIndex !== 0) {
return true;
}
// Checks for "DROP/DELETE/ALTER" statements
@ -1353,8 +1356,7 @@ AJAX.registerOnload('functions.js', function () {
var $form = $(this).prev('form');
var sql_query = $form.find("input[name='sql_query']").val();
var $inner_sql = $(this).parent().prev().find('.inner_sql');
var $sql_highlight = $(this).parent().prev().find('.sql-highlight');
var $inner_sql = $(this).parent().prev().find('code.sql');
var old_text = $inner_sql.html();
var new_content = "<textarea name=\"sql_query_edit\" id=\"sql_query_edit\">" + sql_query + "</textarea>\n";
@ -1367,7 +1369,6 @@ AJAX.registerOnload('functions.js', function () {
}
$editor_area.html(new_content);
$inner_sql.hide();
$sql_highlight.hide();
bindCodeMirrorToInlineEditor();
return false;
@ -1385,13 +1386,16 @@ AJAX.registerOnload('functions.js', function () {
var $fake_form = $('<form>', {action: 'import.php', method: 'post'})
.append($form.find("input[name=server], input[name=db], input[name=table], input[name=token]").clone())
.append($('<input/>', {type: 'hidden', name: 'show_query', value: 1}))
.append($('<input/>', {type: 'hidden', name: 'is_js_confirmed', value: 0}))
.append($('<input/>', {type: 'hidden', name: 'sql_query', value: sql_query}));
if (! checkSqlQuery($fake_form[0])) {
return false;
}
$fake_form.appendTo($('body')).submit();
});
$("input#sql_query_edit_discard").live('click', function () {
$('div#inline_editor_outer')
.siblings('.sql-highlight').show();
$('div#inline_editor_outer').siblings('code.sql').show();
$('div#inline_editor_outer').remove();
});
@ -1771,12 +1775,12 @@ function PMA_createProfilingChartJqplot(target, data)
}
},
highlighter: {
show:true,
show: true,
tooltipLocation: 'se',
sizeAdjust: 0,
tooltipAxes: 'pieref',
useAxesFormatters: false,
formatString:'%s, %.9Ps'
formatString: '%s, %.9Ps'
},
legend: {
show: true,
@ -3421,7 +3425,13 @@ function PMA_slidingMessage(msg, $obj)
.children()
.remove();
$obj
.append('<div style="display: none;">' + msg + '</div>')
.append('<div>' + msg + '</div>');
// highlight any sql before taking height;
PMA_highlightSQL($obj);
$obj.find('div')
.first()
.hide();
$obj
.animate({
height: $obj.find('div').first().height()
})
@ -3432,12 +3442,15 @@ function PMA_slidingMessage(msg, $obj)
} else {
// Object does not already have a message
// inside it, so we simply slide it down
$obj.width('100%')
.html('<div>' + msg + '</div>');
// highlight any sql before taking height;
PMA_highlightSQL($obj);
var h = $obj
.width('100%')
.html('<div style="display: none;">' + msg + '</div>')
.find('div')
.first()
.height();
.find('div')
.first()
.hide()
.height();
$obj
.find('div')
.first()

View File

@ -1,13 +1,17 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Concatenates reveral js files to reduce the number of
* Concatenates several js files to reduce the number of
* http requests sent to the server
*
* @package PhpMyAdmin
*/
chdir('..');
// Close session early as we won't write anything there
session_write_close();
// Send correct type
header('Content-Type: text/javascript; charset=UTF-8');
// Enable browser cache for 1 hour
@ -17,16 +21,16 @@ if (! empty($_GET['scripts']) && is_array($_GET['scripts'])) {
foreach ($_GET['scripts'] as $script) {
// Sanitise filename
$script_name = 'js';
$path = explode("/", $script);
foreach ($path as $index => $filename) {
if (! preg_match("@^\.+$@", $filename)
&& preg_match("@^[\w\.-]+$@", $filename)
) {
// Disallow "." and ".." alone
// Allow alphanumeric, "." and "-" chars only
// Allow alphanumeric, "." and "-" chars only, no files starting
// with .
if (preg_match("@^[\w][\w\.-]+$@", $filename)) {
$script_name .= DIRECTORY_SEPARATOR . $filename;
}
}
// Output file contents
if (preg_match("@\.js$@", $script_name) && is_readable($script_name)) {
readfile($script_name);
@ -35,4 +39,7 @@ if (! empty($_GET['scripts']) && is_array($_GET['scripts'])) {
}
}
if (isset($_GET['call_done'])) {
echo "AJAX.scriptHandler.done();";
}
?>

View File

@ -42,8 +42,9 @@ function prepareJSVersion() {
$button.addClass('addJs').removeClass('add');
var classes = $button.attr('class');
$button.replaceWith(
'<a class="' + classes + '" name="' + $button.attr('name')
+ '" href="#">+ ' + $button.val() + '</a>'
'<a class="' + classes +
'" name="' + $button.attr('name') +
'" href="#">+ ' + $button.val() + '</a>'
);
});
}
@ -56,11 +57,12 @@ function prepareJSVersion() {
* @returns the HTML for a data point
*/
function addDataPoint(pointNumber, prefix) {
return '<br/>' + $.sprintf(PMA_messages.strPointN, (pointNumber + 1)) + ': '
+ '<label for="x">' + PMA_messages.strX + '</label>'
+ '<input type="text" name="' + prefix + '[' + pointNumber + '][x]" value=""/>'
+ '<label for="y">' + PMA_messages.strY + '</label>'
+ '<input type="text" name="' + prefix + '[' + pointNumber + '][y]" value=""/>';
return '<br/>' +
$.sprintf(PMA_messages.strPointN, (pointNumber + 1)) + ': ' +
'<label for="x">' + PMA_messages.strX + '</label>' +
'<input type="text" name="' + prefix + '[' + pointNumber + '][x]" value=""/>' +
'<label for="y">' + PMA_messages.strY + '</label>' +
'<input type="text" name="' + prefix + '[' + pointNumber + '][y]" value=""/>';
}
/**
@ -174,8 +176,11 @@ function openGISEditor() {
$gis_editor.css({"top": popupOffsetTop, "left": popupOffsetLeft, "width": popupWidth, "height": popupHeight});
$backgrouond.css({"opacity" : "0.7"});
$gis_editor.append('<div id="gis_data_editor"><img class="ajaxIcon" id="loadingMonitorIcon" src="'
+ pmaThemeImage + 'ajax_clock_small.gif" alt=""/></div>'
$gis_editor.append(
'<div id="gis_data_editor">' +
'<img class="ajaxIcon" id="loadingMonitorIcon" src="' +
pmaThemeImage + 'ajax_clock_small.gif" alt=""/>' +
'</div>'
);
// Make it appear
@ -326,8 +331,8 @@ AJAX.registerOnload('gis_data_editor.js', function () {
for (var i = 0; i < noOfPoints; i++) {
html += addDataPoint(i, (prefix + '[' + noOfLines + ']'));
}
html += '<a class="addPoint addJs" name="' + prefix + '[' + noOfLines + '][add_point]" href="#">+ '
+ PMA_messages.strAddPoint + '</a><br/>';
html += '<a class="addPoint addJs" name="' + prefix + '[' + noOfLines + '][add_point]" href="#">+ ' +
PMA_messages.strAddPoint + '</a><br/>';
$a.before(html);
$noOfLinesInput.val(noOfLines + 1);
@ -347,16 +352,16 @@ AJAX.registerOnload('gis_data_editor.js', function () {
// Add the new polygon
var html = PMA_messages.strPolygon + ' ' + (noOfPolygons + 1) + ':<br/>';
html += '<input type="hidden" name="' + prefix + '[' + noOfPolygons + '][no_of_lines]" value="1"/>'
+ '<br/>' + PMA_messages.strOuterRing + ':'
+ '<input type="hidden" name="' + prefix + '[' + noOfPolygons + '][0][no_of_points]" value="4"/>';
html += '<input type="hidden" name="' + prefix + '[' + noOfPolygons + '][no_of_lines]" value="1"/>' +
'<br/>' + PMA_messages.strOuterRing + ':' +
'<input type="hidden" name="' + prefix + '[' + noOfPolygons + '][0][no_of_points]" value="4"/>';
for (var i = 0; i < 4; i++) {
html += addDataPoint(i, (prefix + '[' + noOfPolygons + '][0]'));
}
html += '<a class="addPoint addJs" name="' + prefix + '[' + noOfPolygons + '][0][add_point]" href="#">+ '
+ PMA_messages.strAddPoint + '</a><br/>'
+ '<a class="addLine addJs" name="' + prefix + '[' + noOfPolygons + '][add_line]" href="#">+ '
+ PMA_messages.strAddInnerRing + '</a><br/><br/>';
html += '<a class="addPoint addJs" name="' + prefix + '[' + noOfPolygons + '][0][add_point]" href="#">+ ' +
PMA_messages.strAddPoint + '</a><br/>' +
'<a class="addLine addJs" name="' + prefix + '[' + noOfPolygons + '][add_line]" href="#">+ ' +
PMA_messages.strAddInnerRing + '</a><br/><br/>';
$a.before(html);
$noOfPolygonsInput.val(noOfPolygons + 1);
@ -375,12 +380,12 @@ AJAX.registerOnload('gis_data_editor.js', function () {
var html1 = PMA_messages.strGeometry + ' ' + (noOfGeoms + 1) + ':<br/>';
var $geomType = $("select[name='gis_data[" + (noOfGeoms - 1) + "][gis_type]']").clone();
$geomType.attr('name', 'gis_data[' + noOfGeoms + '][gis_type]').val('POINT');
var html2 = '<br/>' + PMA_messages.strPoint + ' :'
+ '<label for="x"> ' + PMA_messages.strX + ' </label>'
+ '<input type="text" name="gis_data[' + noOfGeoms + '][POINT][x]" value=""/>'
+ '<label for="y"> ' + PMA_messages.strY + ' </label>'
+ '<input type="text" name="gis_data[' + noOfGeoms + '][POINT][y]" value=""/>'
+ '<br/><br/>';
var html2 = '<br/>' + PMA_messages.strPoint + ' :' +
'<label for="x"> ' + PMA_messages.strX + ' </label>' +
'<input type="text" name="gis_data[' + noOfGeoms + '][POINT][x]" value=""/>' +
'<label for="y"> ' + PMA_messages.strY + ' </label>' +
'<input type="text" name="gis_data[' + noOfGeoms + '][POINT][y]" value=""/>' +
'<br/><br/>';
$a.before(html1);
$geomType.insertBefore($a);

View File

@ -2,3 +2,8 @@ jQuery and jQuery UI source
===========================
This directory contains source code for jQuery and jQuery UI.
phpMyAdmin Developers: When updating the minified/concatened version of
jQuery one directory back (i.e., in js/jquery/), make certain that the
material under this directory is the complete, corresponding source for the
minified/concatenated version.

View File

@ -567,8 +567,8 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$(g.cEdit).find('.edit_area').empty().hide();
// reposition the cEdit element
$(g.cEdit).css({
top: $cell.position().top,
left: $cell.position().left
top: $cell.offset().top,
left: $cell.offset().left
})
.show()
.find('.edit_box')
@ -703,6 +703,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// empty all edit area, then rebuild it based on $td classes
$editArea.empty();
$editArea.removeClass('edit_area_right');
// add show data row link if the data resulted by 'browse distinct values' in table structure
if ($td.find('input').hasClass('data_browse_link')) {
@ -723,7 +724,12 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
g.wasEditedCellNull = false;
if ($td.is(':not(.not_null)')) {
// append a null checkbox
$editArea.append('<div class="null_div">Null :<input type="checkbox"></div>');
$editArea.append('<div class="null_div">Null:<input type="checkbox"></div>');
if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}
var $checkbox = $editArea.find('.null_div input');
// check if current <td> is NULL
if ($td.is('.null')) {
@ -822,6 +828,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$editArea.find('span.curr_value').change(function () {
$(g.cEdit).find('.edit_box').val($(this).text());
});
if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}
}); // end $.post()
$editArea.show();
@ -829,6 +839,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$(g.cEdit).find('.edit_box').val($(this).val());
});
g.isEditCellTextEditable = true;
if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}
}
else if ($td.is('.enum')) {
//handle enum fields
@ -852,12 +866,19 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$editArea.removeClass('edit_area_loading');
$editArea.append(data.dropdown);
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}
}); // end $.post()
$editArea.show();
$editArea.find('select').live('change', function (e) {
$(g.cEdit).find('.edit_box').val($(this).val());
});
if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}
}
else if ($td.is('.set')) {
//handle set fields
@ -882,12 +903,19 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$editArea.removeClass('edit_area_loading');
$editArea.append(data.select);
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}
}); // end $.post()
$editArea.show();
$editArea.find('select').live('change', function (e) {
$(g.cEdit).find('.edit_box').val($(this).val());
});
if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}
}
else if ($td.is('.truncated, .transformed')) {
if ($td.is('.to_be_saved')) { // cell has been edited
@ -1432,6 +1460,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// register events
$(t).find('th.draggable')
.mousedown(function (e) {
$('#sqlqueryresults').addClass("turnOffSelect");
if (g.visibleHeadersCount > 1) {
g.dragStartReorder(e, this);
}
@ -1714,7 +1743,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
});
// attach to global div
$(g.gDiv).append(g.cEdit);
$(g.gDiv).after(g.cEdit);
// add hint for grid editing feature when hovering "Edit" link in each table row
if (PMA_messages.strGridEditFeatureHint !== undefined) {
@ -1830,6 +1859,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
g.dragMove(e);
});
$(document).mouseup(function (e) {
$('#sqlqueryresults').removeClass("turnOffSelect");
g.dragEnd(e);
});
}

View File

@ -143,7 +143,10 @@ $js_messages['strEnableVar'] = __('Enable %s');
$js_messages['strDisableVar'] = __('Disable %s');
/* l10n: %d seconds */
$js_messages['setSetLongQueryTime'] = __('Set long_query_time to %ds');
$js_messages['strNoSuperUser'] = __('You can\'t change these variables. Please log in as root or contact your database administrator.');
$js_messages['strNoSuperUser'] = __(
'You can\'t change these variables. Please log in as root or contact'
. ' your database administrator.'
);
$js_messages['strChangeSettings'] = __('Change settings');
$js_messages['strCurrentSettings'] = __('Current settings');
@ -155,7 +158,9 @@ $js_messages['strUnit'] = __('Unit');
$js_messages['strFromSlowLog'] = __('From slow log');
$js_messages['strFromGeneralLog'] = __('From general log');
$js_messages['strServerLogError'] = __('The database name is not known for this query in the server\'s logs.');
$js_messages['strServerLogError'] = __(
'The database name is not known for this query in the server\'s logs.'
);
$js_messages['strAnalysingLogsTitle'] = __('Analysing logs');
$js_messages['strAnalysingLogs'] = __('Analysing & loading logs. This may take a while.');
$js_messages['strCancelRequest'] = __('Cancel request');
@ -194,7 +199,9 @@ $js_messages['strReloadPage'] = __('Reload page');
$js_messages['strAffectedRows'] = __('Affected rows:');
$js_messages['strFailedParsingConfig'] = __('Failed parsing config file. It doesn\'t seem to be valid JSON code.');
$js_messages['strFailedParsingConfig'] = __(
'Failed parsing config file. It doesn\'t seem to be valid JSON code.'
);
$js_messages['strFailedBuildingGrid'] = __('Failed building chart grid with imported config. Resetting to default config…');
$js_messages['strImport'] = __('Import');
$js_messages['strImportDialogTitle'] = __('Import monitor configuration');
@ -235,7 +242,9 @@ $js_messages['strRenamingDatabases'] = __('Renaming Databases');
$js_messages['strReloadDatabase'] = __('Reload Database');
$js_messages['strCopyingDatabase'] = __('Copying Database');
$js_messages['strChangingCharset'] = __('Changing Charset');
$js_messages['strTableMustHaveAtleastOneColumn'] = __('Table must have at least one column');
$js_messages['strTableMustHaveAtleastOneColumn'] = __(
'Table must have at least one column'
);
$js_messages['strYes'] = __('Yes');
$js_messages['strNo'] = __('No');
@ -333,7 +342,10 @@ $js_messages['strSelectReferencedKey'] = __('Select referenced key');
$js_messages['strSelectForeignKey'] = __('Select Foreign Key');
$js_messages['strPleaseSelectPrimaryOrUniqueKey'] = __('Please select the primary key or a unique key');
$js_messages['strChangeDisplay'] = __('Choose column to display');
$js_messages['strLeavingDesigner'] = __('You haven\'t saved the changes in the layout. They will be lost if you don\'t save them. Do you want to continue?');
$js_messages['strLeavingDesigner'] = __(
'You haven\'t saved the changes in the layout. They will be lost if you'
. ' don\'t save them. Do you want to continue?'
);
/* Visual query builder (js/pmd/move.js) */
$js_messages['strAddOption'] = __('Add an option for column ');
@ -346,7 +358,9 @@ $js_messages['strColOrderHint'] = __('Drag to reorder');
$js_messages['strSortHint'] = __('Click to sort');
$js_messages['strColMarkHint'] = __('Click to mark/unmark');
$js_messages['strColNameCopyHint'] = __('Double-click to copy column name');
$js_messages['strColVisibHint'] = __('Click the drop-down arrow<br />to toggle column\'s visibility');
$js_messages['strColVisibHint'] = __(
'Click the drop-down arrow<br />to toggle column\'s visibility'
);
$js_messages['strShowAllCol'] = __('Show all');
$js_messages['strAlertNonUnique'] = __('This table does not contain a unique column. Features related to the grid edit, checkbox, Edit, Copy and Delete links may not work after saving.');
@ -390,13 +404,24 @@ $js_messages['strUpToDate'] = __('up to date');
$js_messages['strCreateView'] = __('Create view');
/* Error Reporting */
$js_messages['strSendErrorReport'] = __("Send Error Report");
$js_messages['strSubmitErrorReport'] = __("Submit Error Report");
$js_messages['strErrorOccurred'] = __(
"A fatal JavaScript error has occurred. Would you like to send an error report?"
);
$js_messages['strChangeReportSettings'] = __("Change Report Settings");
$js_messages['strShowReportDetails'] = __("Show Report Details");
$js_messages['strIgnore'] = __("Ignore");
echo "var PMA_messages = new Array();\n";
foreach ($js_messages as $name => $js_message) {
PMA_printJsValue("PMA_messages['" . $name . "']", $js_message);
}
/* Calendar */
echo "var themeCalendarImage = '" . $GLOBALS['pmaThemeImage'] . 'b_calendar.png' . "';\n";
echo "var themeCalendarImage = '" . $GLOBALS['pmaThemeImage']
. 'b_calendar.png' . "';\n";
/* Image path */
echo "var pmaThemeImage = '" . $GLOBALS['pmaThemeImage'] . "';\n";
@ -520,8 +545,13 @@ PMA_printJsValue(
/* l10n: Column header for week of the year in calendar */
PMA_printJsValue("$.datepicker.regional['']['weekHeader']", __('Wk'));
/* l10n: Month-year order for calendar, use either "calendar-month-year" or "calendar-year-month". */
PMA_printJsValue("$.datepicker.regional['']['showMonthAfterYear']", (__('calendar-month-year') == 'calendar-year-month'));
/* l10n: Month-year order for calendar, use either "calendar-month-year"
* or "calendar-year-month".
*/
PMA_printJsValue(
"$.datepicker.regional['']['showMonthAfterYear']",
(__('calendar-month-year') == 'calendar-year-month')
);
/* l10n: Year suffix for calendar, "none" is empty. */
$year_suffix = _pgettext('Year suffix', 'none');
PMA_printJsValue(

View File

@ -133,10 +133,11 @@ $(function () {
});
/** Export Routines, Triggers and Events */
$('li.procedure div:eq(1) a.ajax img,'
+ ' li.function div:eq(1) a.ajax img,'
+ ' li.trigger div:eq(1) a.ajax img,'
+ ' li.event div:eq(1) a.ajax img').live('click', function (event) {
$('li.procedure div:eq(1) a.ajax img,' +
' li.function div:eq(1) a.ajax img,' +
' li.trigger div:eq(1) a.ajax img,' +
' li.event div:eq(1) a.ajax img'
).live('click', function (event) {
event.preventDefault();
var dialog = new RTE.object();
dialog.exportDialog($(this).parent());
@ -264,7 +265,7 @@ function expandTreeNode($expandElem, callback)
$icon.hide();
$throbber.insertBefore($icon);
loadChildNodes($expandElem, function(data) {
loadChildNodes($expandElem, function (data) {
if (data.success === true) {
var $destination = $expandElem.closest('li');
$icon.removeClass('ic_b_plus').addClass('ic_b_minus');
@ -277,7 +278,7 @@ function expandTreeNode($expandElem, callback)
.click();
}
if (callback && typeof callback == 'function') {
callback.call();
callback.call();
}
} else {
PMA_ajaxShowMessage(data.error, false);
@ -353,7 +354,7 @@ function loadChildNodes($expandElem, callback) {
$destination.find('div.list_container').remove(); // FIXME: Hack, there shouldn't be a list container there
$destination.append(data.message);
if (callback && typeof callback == 'function') {
callback(data);
callback(data);
}
}
});
@ -366,169 +367,178 @@ function loadChildNodes($expandElem, callback) {
*/
function PMA_showCurrentNavigation()
{
var db = PMA_commonParams.get('db');
var table = PMA_commonParams.get('table');
$('#pma_navigation_tree')
.find('li.selected')
.removeClass('selected');
if (db) {
var $dbItem = findLoadedItem(
$('#pma_navigation_tree > div'), db, 'database', !table
);
if ($dbItem) {
var $expander = $dbItem.children('div:first').children('a.expander');
// if not loaded or loaded but collapsed
if (! $expander.hasClass('loaded')
|| $expander.find('img').is('.ic_b_plus')
) {
expandTreeNode($expander, function() {
handleTableOrDb(table, $dbItem);
});
} else {
handleTableOrDb(table, $dbItem);
}
}
}
var db = PMA_commonParams.get('db');
var table = PMA_commonParams.get('table');
$('#pma_navigation_tree')
.find('li.selected')
.removeClass('selected');
if (db) {
var $dbItem = findLoadedItem(
$('#pma_navigation_tree > div'), db, 'database', !table
);
if ($dbItem) {
var $expander = $dbItem.children('div:first').children('a.expander');
// if not loaded or loaded but collapsed
if (! $expander.hasClass('loaded') ||
$expander.find('img').is('.ic_b_plus')
) {
expandTreeNode($expander, function () {
handleTableOrDb(table, $dbItem);
});
} else {
handleTableOrDb(table, $dbItem);
}
}
}
function handleTableOrDb(table, $dbItem) {
if (table) {
loadAndHighlightTableOrView($dbItem, table);
} else {
var $container = $dbItem.children('div.list_container');
var $tableContainer = $container.children('ul').children('li.tableContainer');
if ($tableContainer.length > 0) {
var $expander = $tableContainer.children('div:first').children('a.expander');
expandTreeNode($expander, function() {
scrollToView($dbItem, $('#pma_navigation_tree_content'));
});
} else {
scrollToView($dbItem, $('#pma_navigation_tree_content'));
}
}
}
function handleTableOrDb(table, $dbItem) {
if (table) {
loadAndHighlightTableOrView($dbItem, table);
} else {
var $container = $dbItem.children('div.list_container');
var $tableContainer = $container.children('ul').children('li.tableContainer');
if ($tableContainer.length > 0) {
var $expander = $tableContainer.children('div:first').children('a.expander');
expandTreeNode($expander, function () {
scrollToView($dbItem, $('#pma_navigation_tree_content'));
});
} else {
scrollToView($dbItem, $('#pma_navigation_tree_content'));
}
}
}
function findLoadedItem($container, name, clazz, doSelect) {
var ret = false;
$container.children('ul').children('li').each(function() {
var $li = $(this);
// this is a navigation group, recurse
if ($li.is('.navGroup')) {
var $container = $li.children('div.list_container');
var $childRet = findLoadedItem(
$container, name, clazz, doSelect
);
if ($childRet) {
ret = $childRet;
return false;
}
} else { // this is a real navigation item
// name and class matches
if ($li.is('.' + clazz) && $li.children('a').text() == name) {
if (doSelect) {
$li.addClass('selected');
}
// taverse up and expand and parent navigation groups
$li.parents('.navGroup').each(function() {
$cont = $(this).children('div.list_container');
if (! $cont.is(':visible')) {
$(this)
.children('div:first')
.children('a.expander')
.click();
}
});
ret = $li;
return false;
}
}
});
return ret;
}
function findLoadedItem($container, name, clazz, doSelect) {
var ret = false;
$container.children('ul').children('li').each(function () {
var $li = $(this);
// this is a navigation group, recurse
if ($li.is('.navGroup')) {
var $container = $li.children('div.list_container');
var $childRet = findLoadedItem(
$container, name, clazz, doSelect
);
if ($childRet) {
ret = $childRet;
return false;
}
} else { // this is a real navigation item
// name and class matches
if (((clazz && $li.is('.' + clazz)) || ! clazz) &&
$li.children('a').text() == name) {
if (doSelect) {
$li.addClass('selected');
}
// taverse up and expand and parent navigation groups
$li.parents('.navGroup').each(function () {
$cont = $(this).children('div.list_container');
if (! $cont.is(':visible')) {
$(this)
.children('div:first')
.children('a.expander')
.click();
}
});
ret = $li;
return false;
}
}
});
return ret;
}
function loadAndHighlightTableOrView($dbItem, table) {
var $container = $dbItem.children('div.list_container');
var $tableContainer = $container
.children('ul')
.children('li.tableContainer');
var $viewContainer = $container
.children('ul')
.children('li.viewContainer');
function loadAndHighlightTableOrView($dbItem, table) {
var $container = $dbItem.children('div.list_container');
var $tableContainer = $container
.children('ul')
.children('li.tableContainer');
var $viewContainer = $container
.children('ul')
.children('li.viewContainer');
if ($tableContainer.length > 0) {
var $expander = $tableContainer
.children('div:first')
.children('a.expander');
if ($tableContainer.length > 0) {
var $expander = $tableContainer
.children('div:first')
.children('a.expander');
if (! $expander.hasClass('loaded') ) {
loadChildNodes($expander, function(data) {
highlightTableOrView($tableContainer, $viewContainer, table);
});
} else {
highlightTableOrView($tableContainer, $viewContainer, table);
}
} else if ($viewContainer.length > 0) {
highlightView($viewContainer, table);
} else {
// no containers, highlight the item
var $table = findLoadedItem($container, table, 'table', true);
scrollToView($table, $('#pma_navigation_tree_content'));
}
}
if (! $expander.hasClass('loaded')) {
loadChildNodes($expander, function (data) {
highlightTableOrView($tableContainer, $viewContainer, table);
});
} else {
highlightTableOrView($tableContainer, $viewContainer, table);
}
} else if ($viewContainer.length > 0) {
highlightView($viewContainer, table);
} else {
// no containers, highlight the item
var $tableOrView = findLoadedItem($container, table, null, true);
if ($tableOrView){
scrollToView($tableOrView, $('#pma_navigation_tree_content'));
}
}
}
function highlightTableOrView($tableContainer, $viewContainer, table)
{
if (isItemInContainer($tableContainer, table, 'table')) {
var $expander = $tableContainer
.children('div:first')
.children('a.expander');
if ($expander.find('img').is('.ic_b_plus')) {
expandTreeNode($expander);
}
var $table = findLoadedItem(
$tableContainer.children('div.list_container'),
table, 'table', true
);
scrollToView($table, $('#pma_navigation_tree_content'));
} else if ($viewContainer.length > 0) {
highlightView($viewContainer, table);
}
}
function highlightTableOrView($tableContainer, $viewContainer, table)
{
if (isItemInContainer($tableContainer, table, 'table')) {
var $expander = $tableContainer
.children('div:first')
.children('a.expander');
if ($expander.find('img').is('.ic_b_plus')) {
expandTreeNode($expander);
}
var $table = findLoadedItem(
$tableContainer.children('div.list_container'),
table, 'table', true
);
if ($table) {
scrollToView($table, $('#pma_navigation_tree_content'));
}
} else if ($viewContainer.length > 0) {
highlightView($viewContainer, table);
}
}
function isItemInContainer($container, name, clazz)
{
$items = $container.find('li.' + clazz);
var found = false;
$items.each(function() {
if ($(this).children('a').text() == name) {
found = true;
return false;
}
});
return found;
}
function isItemInContainer($container, name, clazz)
{
$items = $container.find('li.' + clazz);
var found = false;
$items.each(function () {
if ($(this).children('a').text() == name) {
found = true;
return false;
}
});
return found;
}
function highlightView($viewContainer, view) {
var $expander = $viewContainer
.children('div:first')
.children('a.expander');
if (! $expander.hasClass('loaded')
|| $expander.find('img').is('.ic_b_plus')
) {
expandTreeNode($expander, function() {
var $view = findLoadedItem(
$viewContainer.children('div.list_container'),
view, 'view', true
);
scrollToView($view, $('#pma_navigation_tree_content'));
});
} else {
var $view = findLoadedItem(
$viewContainer.children('div.list_container'),
view, 'view', true
);
scrollToView($view, $('#pma_navigation_tree_content'));
}
}
function highlightView($viewContainer, view) {
var $expander = $viewContainer
.children('div:first')
.children('a.expander');
if (! $expander.hasClass('loaded') ||
$expander.find('img').is('.ic_b_plus')
) {
expandTreeNode($expander, function () {
var $view = findLoadedItem(
$viewContainer.children('div.list_container'),
view, 'view', true
);
if ($view) {
scrollToView($view, $('#pma_navigation_tree_content'));
}
});
} else {
var $view = findLoadedItem(
$viewContainer.children('div.list_container'),
view, 'view', true
);
if ($view) {
scrollToView($view, $('#pma_navigation_tree_content'));
}
}
}
}
/**
@ -553,8 +563,8 @@ function PMA_reloadNavigation(callback) {
// various levels, if necessary.
var count = 0;
$('#pma_navigation_tree').find('a.expander:visible').each(function () {
if ($(this).find('img').is('.ic_b_minus')
&& $(this).closest('li').find('div.list_container .ic_b_minus').length === 0
if ($(this).find('img').is('.ic_b_minus') &&
$(this).closest('li').find('div.list_container .ic_b_minus').length === 0
) {
params['n' + count + '_aPath'] = $(this).find('span.aPath').text();
params['n' + count + '_vPath'] = $(this).find('span.vPath').text();
@ -829,7 +839,7 @@ var ResizeHandler = function () {
event.data.resize_handler.panel_width = width;
};
/**
* Even thandler for resizing the navigation tree height on window resize
* Event handler for resizing the navigation tree height on window resize
*
* @return void
*/
@ -909,9 +919,9 @@ var PMA_fastFilter = {
this.timeout = null;
var $filterInput = $this.find('li.fast_filter input.searchClause');
if ($filterInput.length !== 0
&& $filterInput.val() !== ''
&& $filterInput.val() != $filterInput[0].defaultValue
if ($filterInput.length !== 0 &&
$filterInput.val() !== '' &&
$filterInput.val() != $filterInput[0].defaultValue
) {
this.request();
}
@ -951,8 +961,8 @@ var PMA_fastFilter = {
.closest('div.list_container');
}
var searchClause2 = '';
if ($filterInput.length !== 0
&& $filterInput.first().val() != $filterInput[0].defaultValue
if ($filterInput.length !== 0 &&
$filterInput.first().val() != $filterInput[0].defaultValue
) {
searchClause2 = $filterInput.val();
}
@ -991,28 +1001,65 @@ var PMA_fastFilter = {
var str = '';
if ($(this).val() != this.defaultValue && $(this).val() !== '') {
$obj.find('div.pageselector').hide();
str = $(this).val().toLowerCase();
str = $(this).val();
}
$obj.find('li > a').not('.container').each(function () {
if ($(this).text().toLowerCase().indexOf(str) != -1) {
$(this).parent().show().removeClass('hidden');
} else {
$(this).parent().hide().addClass('hidden');
}
});
var container_filter = function ($curr, str) {
$curr.children('li').children('a.container').each(function () {
var $group = $(this).parent().children('ul');
if ($group.children('li').children('a.container').length > 0) {
container_filter($group); // recursive
}
$group.parent().show().removeClass('hidden');
if ($group.children().not('.hidden').length === 0) {
$group.parent().hide().addClass('hidden');
/**
* FIXME at the server level a value match is done while on
* the client side it is a regex match. These two should be aligned
*/
// regex used for filtering.
var regex;
try {
regex = new RegExp(str, 'i');
} catch (err) {
return;
}
// this is the div that houses the items to be filtered by this filter.
var outerContainer;
if ($(this).closest('li.fast_filter').is('.db_fast_filter')) {
outerContainer = $('#pma_navigation_tree_content');
} else {
outerContainer = $obj;
}
// filters items that are directly under the div as well as grouped in
// groups. Does not filter child items (i.e. a database search does
// not filter tables)
var item_filter = function($curr) {
$curr.children('ul').children('li.navGroup').each(function() {
$(this).children('div.list_container').each(function() {
item_filter($(this)); // recursive
});
});
$curr.children('ul').children('li').children('a').not('.container').each(function() {
if (regex.test($(this).text())) {
$(this).parent().show().removeClass('hidden');
} else {
$(this).parent().hide().addClass('hidden');
}
});
};
container_filter($obj, str);
item_filter(outerContainer);
// hides containers that does not have any visible children
var container_filter = function ($curr) {
$curr.children('ul').children('li.navGroup').each(function() {
var $group = $(this);
$group.children('div.list_container').each(function() {
container_filter($(this)); // recursive
});
$group.show().removeClass('hidden');
if ($group.children('div.list_container').children('ul')
.children('li').not('.hidden').length === 0) {
$group.hide().addClass('hidden');
}
});
};
container_filter(outerContainer);
if ($(this).val() != this.defaultValue && $(this).val() !== '') {
if (! $obj.data('fastFilter')) {
$obj.data(

View File

@ -109,9 +109,9 @@ function display(init, finit)
}
str += '<td style="padding-left: 5px;" class="right">' + PMA_getImage('b_sbrowse.png', 'column name') + '</td><td width="175" style="padding-left: 5px">' + history_array[i].get_column_name();
if (history_array[i].get_type() == "GroupBy" || history_array[i].get_type() == "OrderBy") {
str += '</td><td class="center">' + PMA_getImage('b_info.png', detail(i)) + '<td title="' + detail(i) + '">' + history_array[i].get_type() + '</td></td><td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_delete(' + i + ')>' + PMA_getImage('b_drop.png', 'Delete') + '</td></tr></thead>';
str += '</td><td class="center">' + PMA_getImage('s_info.png', detail(i)) + '<td title="' + detail(i) + '">' + history_array[i].get_type() + '</td></td><td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_delete(' + i + ')>' + PMA_getImage('b_drop.png', 'Delete') + '</td></tr></thead>';
} else {
str += '</td><td class="center">' + PMA_getImage('b_info.png', detail(i)) + '</td><td title="' + detail(i) + '">' + history_array[i].get_type() + '</td><td <td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_edit(' + i + ')>' + PMA_getImage('b_edit.png', PMA_messages.strEdit) + '</td><td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_delete(' + i + ')><img src="themes/original/img/b_drop.png" title="Delete"></td></tr></thead>';
str += '</td><td class="center">' + PMA_getImage('s_info.png', detail(i)) + '</td><td title="' + detail(i) + '">' + history_array[i].get_type() + '</td><td <td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_edit(' + i + ')>' + PMA_getImage('b_edit.png', PMA_messages.strEdit) + '</td><td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_delete(' + i + ')><img src="themes/original/img/b_drop.png" title="Delete"></td></tr></thead>';
}
i++;
if (i >= history_array.length) {

View File

@ -278,8 +278,9 @@ RTE.COMMON = {
});
// If this is the first item being added, remove
// the "No items" message and show the list.
if ($('table.data').find('tr').has('td').length > 0
&& $('#nothing2display').is(':visible')) {
if ($('table.data').find('tr').has('td').length > 0 &&
$('#nothing2display').is(':visible')
) {
$('#nothing2display').hide("slow", function () {
$('table.data').show("slow");
});
@ -526,8 +527,9 @@ RTE.ROUTINE = {
var $inputtyp = $(this).find('select[name^=item_param_type]');
var $inputlen = $(this).find('input[name^=item_param_length]');
if ($inputtyp.length && $inputlen.length) {
if (($inputtyp.val() === 'ENUM' || $inputtyp.val() === 'SET' || $inputtyp.val().substr(0, 3) === 'VAR')
&& $inputlen.val() === '') {
if (($inputtyp.val() === 'ENUM' || $inputtyp.val() === 'SET' || $inputtyp.val().substr(0, 3) === 'VAR') &&
$inputlen.val() === ''
) {
$inputlen.focus();
isSuccess = false;
return false;
@ -543,8 +545,9 @@ RTE.ROUTINE = {
// be set, if the type is SET, ENUM, VARCHAR or VARBINARY.
var $returntyp = this.$ajaxDialog.find('select[name=item_returntype]');
var $returnlen = this.$ajaxDialog.find('input[name=item_returnlength]');
if (($returntyp.val() === 'ENUM' || $returntyp.val() === 'SET' || $returntyp.val().substr(0, 3) === 'VAR')
&& $returnlen.val() === '') {
if (($returntyp.val() === 'ENUM' || $returntyp.val() === 'SET' || $returntyp.val().substr(0, 3) === 'VAR') &&
$returnlen.val() === ''
) {
$returnlen.focus();
alert(PMA_messages.strFormEmpty);
return false;

View File

@ -74,6 +74,10 @@ AJAX.registerOnload('server_databases.js', function () {
$rowsToRemove.remove();
$form.find('tbody').PMA_sort_table('.name');
if ($form.find('tbody').find('tr').length == 0) {
// user just dropped the last db on this page
PMA_commonActions.refreshMain();
}
PMA_reloadNavigation();
} else {
$form.find('tr.removeMe').removeClass('removeMe');

View File

@ -47,7 +47,7 @@ AJAX.registerOnload('server_status_advisor.js', function () {
}
if (data.run.errors.length > 0) {
$cnt.append('<b>Errors occured while executing rule expressions:</b><br />- ');
$cnt.append('<b>Errors occurred while executing rule expressions:</b><br />- ');
$cnt.append(data.run.errors.join('<br/>- '));
$cnt.append('<p></p>');
}

View File

@ -915,8 +915,8 @@ AJAX.registerOnload('server_status_monitor.js', function () {
$('input[name="chartType"]').change(function () {
$('#chartVariableSettings').toggle(this.checked && this.value == 'variable');
var title = $('input[name="chartTitle"]').val();
if (title == PMA_messages.strChartTitle
|| title == $('label[for="' + $('input[name="chartTitle"]').data('lastRadio') + '"]').text()
if (title == PMA_messages.strChartTitle ||
title == $('label[for="' + $('input[name="chartTitle"]').data('lastRadio') + '"]').text()
) {
$('input[name="chartTitle"]')
.data('lastRadio', $(this).attr('id'))
@ -1186,13 +1186,14 @@ AJAX.registerOnload('server_status_monitor.js', function () {
}
};
if (settings.title === PMA_messages.strSystemCPUUsage
|| settings.title === PMA_messages.strQueryCacheEfficiency) {
if (settings.title === PMA_messages.strSystemCPUUsage ||
settings.title === PMA_messages.strQueryCacheEfficiency
) {
settings.axes.yaxis.tickOptions = {
formatString: "%d %%"
};
} else if (settings.title === PMA_messages.strSystemMemory
|| settings.title === PMA_messages.strSystemSwap
} else if (settings.title === PMA_messages.strSystemMemory ||
settings.title === PMA_messages.strSystemSwap
) {
settings.stackSeries = true;
settings.axes.yaxis.tickOptions = {
@ -1202,17 +1203,18 @@ AJAX.registerOnload('server_status_monitor.js', function () {
settings.axes.yaxis.tickOptions = {
formatter: $.jqplot.byteFormatter(1) // KiB
};
} else if (settings.title === PMA_messages.strQuestions
|| settings.title === PMA_messages.strConnections
} else if (settings.title === PMA_messages.strQuestions ||
settings.title === PMA_messages.strConnections
) {
settings.axes.yaxis.tickOptions = {
formatter: function (format, val) {
if (Math.abs(val) >= 1000000)
return $.jqplot.sprintf("%.3g M", val/1000000);
else if (Math.abs(val) >= 1000)
return $.jqplot.sprintf("%.3g k", val/1000);
else
if (Math.abs(val) >= 1000000) {
return $.jqplot.sprintf("%.3g M", val / 1000000);
} else if (Math.abs(val) >= 1000) {
return $.jqplot.sprintf("%.3g k", val / 1000);
} else {
return $.jqplot.sprintf("%d", val);
}
}
};
}
@ -1226,9 +1228,11 @@ AJAX.registerOnload('server_status_monitor.js', function () {
$('#chartGrid').append('<tr></tr>');
}
$('#chartGrid tr:last').append('<td><div id="gridChartContainer'
+ runtime.chartAI + '" class=""><div class="ui-state-default monitorChart" id="'
+ 'gridchart' + runtime.chartAI + '"></div></div></td>');
$('#chartGrid tr:last').append(
'<td><div id="gridChartContainer' + runtime.chartAI + '" class="">' +
'<div class="ui-state-default monitorChart" id="' +
'gridchart' + runtime.chartAI + '"></div></div></td>'
);
}
// Set series' data as [0,0], smooth lines won't plot with data array having null values.
@ -1549,9 +1553,11 @@ AJAX.registerOnload('server_status_monitor.js', function () {
elem.nodes[j].transformFn,
chartData[key][j],
// Check if first iteration (oldChartData==null), or if newly added chart oldChartData[key]==null
(oldChartData === null
|| oldChartData[key] === null
|| oldChartData[key] === undefined ? null : oldChartData[key][j])
(
oldChartData === null ||
oldChartData[key] === null ||
oldChartData[key] === undefined ? null : oldChartData[key][j]
)
);
// Otherwise use original value and apply differential and divisor if given,
@ -1560,9 +1566,9 @@ AJAX.registerOnload('server_status_monitor.js', function () {
value = parseFloat(chartData[key][j][0].value);
if (elem.nodes[j].display == 'differential') {
if (oldChartData === null
|| oldChartData[key] === null
|| oldChartData[key] === undefined
if (oldChartData === null ||
oldChartData[key] === null ||
oldChartData[key] === undefined
) {
continue;
}
@ -1583,8 +1589,9 @@ AJAX.registerOnload('server_status_monitor.js', function () {
elem.maxYLabel = 0.5;
}
// free old data point values and update maxYLabel
if (elem.chart.series[j].data.length > runtime.gridMaxPoints
&& elem.chart.series[j].data[0][0] < runtime.xmin) {
if (elem.chart.series[j].data.length > runtime.gridMaxPoints &&
elem.chart.series[j].data[0][0] < runtime.xmin
) {
// check if the next freeable point is highest
if (elem.maxYLabel <= elem.chart.series[j].data[0][1]) {
elem.chart.series[j].data.splice(0, elem.chart.series[j].data.length - runtime.gridMaxPoints);
@ -1593,8 +1600,8 @@ AJAX.registerOnload('server_status_monitor.js', function () {
elem.chart.series[j].data.splice(0, elem.chart.series[j].data.length - runtime.gridMaxPoints);
}
}
if (elem.title === PMA_messages.strSystemMemory
|| elem.title === PMA_messages.strSystemSwap
if (elem.title === PMA_messages.strSystemMemory ||
elem.title === PMA_messages.strSystemSwap
) {
total += value;
}
@ -1608,15 +1615,15 @@ AJAX.registerOnload('server_status_monitor.js', function () {
(runtime.xmax - tickInterval * 3), (runtime.xmax - tickInterval * 2),
(runtime.xmax - tickInterval), runtime.xmax];
if (elem.title !== PMA_messages.strSystemCPUUsage
&& elem.title !== PMA_messages.strQueryCacheEfficiency
&& elem.title !== PMA_messages.strSystemMemory
&& elem.title !== PMA_messages.strSystemSwap
if (elem.title !== PMA_messages.strSystemCPUUsage &&
elem.title !== PMA_messages.strQueryCacheEfficiency &&
elem.title !== PMA_messages.strSystemMemory &&
elem.title !== PMA_messages.strSystemSwap
) {
elem.chart['axes']['yaxis']['max'] = Math.ceil(elem.maxYLabel * 1.1);
elem.chart['axes']['yaxis']['tickInterval'] = Math.ceil(elem.maxYLabel * 1.1 / 5);
} else if (elem.title === PMA_messages.strSystemMemory
|| elem.title === PMA_messages.strSystemSwap
} else if (elem.title === PMA_messages.strSystemMemory ||
elem.title === PMA_messages.strSystemSwap
) {
elem.chart['axes']['yaxis']['max'] = Math.ceil(total * 1.1 / 100) * 100;
elem.chart['axes']['yaxis']['tickInterval'] = Math.ceil(total * 1.1 / 5);
@ -2141,8 +2148,9 @@ AJAX.registerOnload('server_status_monitor.js', function () {
data = data.message;
}
if (data.error) {
if(data.error.indexOf('1146') != -1 || data.error.indexOf('1046') != -1)
if (data.error.indexOf('1146') != -1 || data.error.indexOf('1046') != -1) {
data.error = PMA_messages['strServerLogError'];
}
$('#queryAnalyzerDialog div.placeHolder').html('<div class="error">' + data.error + '</div>');
return;
}

View File

@ -89,9 +89,9 @@ AJAX.registerOnload('server_status_variables.js', function () {
odd_row = false;
$('#serverstatusvariables th.name').each(function () {
if ((textFilter === null || textFilter.exec($(this).text()))
&& (! alertFilter || $(this).next().find('span.attention').length > 0)
&& (categoryFilter.length === 0 || $(this).parent().hasClass('s_' + categoryFilter))
if ((textFilter === null || textFilter.exec($(this).text())) &&
(! alertFilter || $(this).next().find('span.attention').length > 0) &&
(categoryFilter.length === 0 || $(this).parent().hasClass('s_' + categoryFilter))
) {
odd_row = ! odd_row;
$(this).parent().css('display', '');

View File

@ -9,6 +9,10 @@ AJAX.registerTeardown('server_user_groups.js', function () {
* Bind event handlers
*/
AJAX.registerOnload('server_user_groups.js', function () {
// update the checkall checkbox on Edit user group page
$(checkboxes_sel).trigger("change");
$("a.deleteUserGroup.ajax").live('click', function (event) {
event.preventDefault();
var $link = $(this);

183
js/sql.js
View File

@ -78,9 +78,6 @@ AJAX.registerTeardown('sql.js', function () {
$("#pageselector").die('change');
$("#table_results.ajax").find("a[title=Sort]").die('click');
$("#displayOptionsForm.ajax").die('submit');
$("#resultsForm.ajax .mult_submit[value=edit]").die('click');
$("#insertForm .insertRowTable.ajax input[type=submit]").die('click');
$("#buttonYes.ajax").die('click');
$('a.browse_foreign').die('click');
$('th.column_heading.pointer').die('hover');
$('th.column_heading.marker').die('click');
@ -268,6 +265,12 @@ AJAX.registerOnload('sql.js', function () {
// delete
if ('2' == data.action_bookmark) {
$("#id_bookmark option[value='" + data.id_bookmark + "']").remove();
// if there are no bookmarked queries now (only the empty option),
// remove the bookmark section
if ($('#id_bookmark option').length == 1) {
$('#fieldsetBookmarkOptions').hide();
$('#fieldsetBookmarkOptionsFooter').hide();
}
}
$sqlqueryresults
.show()
@ -366,180 +369,6 @@ AJAX.registerOnload('sql.js', function () {
PMA_init_slider();
}); // end $.post()
}); //end displayOptionsForm handler
/**
* Ajax Event for table row change
* */
$("#resultsForm.ajax .mult_submit[value=edit]").live('click', function (event) {
event.preventDefault();
/*Check whether at least one row is selected*/
if ($("#table_results tbody tr, #table_results tbody tr td").hasClass("marked")) {
var $div = $('<div id="change_row_dialog"></div>');
/**
* @var button_options Object that stores the options passed to jQueryUI
* dialog
*/
var button_options = {};
// in the following function we need to use $(this)
button_options[PMA_messages.strCancel] = function () {
$(this).dialog('close');
};
var button_options_error = {};
button_options_error[PMA_messages.strOK] = function () {
$(this).dialog('close');
};
var $form = $("#resultsForm");
var $msgbox = PMA_ajaxShowMessage();
$.get($form.attr('action'), $form.serialize() + "&ajax_request=true&submit_mult=row_edit", function (data) {
//in the case of an error, show the error message returned.
if (data.success !== undefined && data.success === false) {
$div
.append(data.error)
.dialog({
title: PMA_messages.strChangeTbl,
height: 230,
width: 900,
open: PMA_verifyColumnsProperties,
close: function (event, ui) {
$(this).remove();
},
buttons : button_options_error
}); // end dialog options
} else {
$div
.append(data.message)
.dialog({
title: PMA_messages.strChangeTbl,
height: 600,
width: 900,
open: PMA_verifyColumnsProperties,
close: function (event, ui) {
$(this).remove();
},
buttons : button_options
})
//Remove the top menu container from the dialog
.find("#topmenucontainer").hide()
; // end dialog options
$("table.insertRowTable").addClass("ajax");
$("#buttonYes").addClass("ajax");
}
PMA_ajaxRemoveMessage($msgbox);
}); // end $.get()
} else {
PMA_ajaxShowMessage(PMA_messages.strNoRowSelected);
}
});
/**
* Checks whether at least one row is selected for deletion or export
*/
$("#resultsForm.ajax .mult_submit[value=delete]," +
"#resultsForm.ajax .mult_submit[value=export]").live('click', function (event) {
/*Check whether at least one row is selected*/
if (!$("#table_results tbody tr, #table_results tbody tr td").hasClass("marked")) {
event.preventDefault();
PMA_ajaxShowMessage(PMA_messages.strNoRowSelected);
}
});
/**
* Click action for "Go" button in ajax dialog insertForm -> insertRowTable
*/
$("#insertForm .insertRowTable.ajax input[type=submit]").live('click', function (event) {
event.preventDefault();
/**
* @var the_form object referring to the insert form
*/
var $form = $("#insertForm");
PMA_prepareForAjaxRequest($form);
//User wants to submit the form
$.post($form.attr('action'), $form.serialize(), function (data) {
if (data.success === true) {
PMA_ajaxShowMessage(data.message);
if ($("#pageselector").length !== 0) {
$("#pageselector").trigger('change');
} else {
$("input[name=navig].ajax").trigger('click');
}
} else {
PMA_ajaxShowMessage(data.error, false);
$("#table_results tbody tr.marked .multi_checkbox " +
", #table_results tbody tr td.marked .multi_checkbox").prop("checked", false);
$("#table_results tbody tr.marked .multi_checkbox " +
", #table_results tbody tr td.marked .multi_checkbox").removeClass("last_clicked");
$("#table_results tbody tr" +
", #table_results tbody tr td").removeClass("marked");
}
if ($("#change_row_dialog").length > 0) {
$("#change_row_dialog").dialog("close").remove();
}
/**Update the row count at the tableForm*/
$("#result_query").remove();
$("#sqlqueryresults").prepend(data.sql_query);
$("#result_query .notice").remove();
$("#result_query").prepend((data.message));
}); // end $.post()
}); // end insert table button "Go"
/**$("#buttonYes.ajax").live('click'
* Click action for #buttonYes button in ajax dialog insertForm
*/
$("#buttonYes.ajax").live('click', function (event) {
event.preventDefault();
/**
* @var the_form object referring to the insert form
*/
var $form = $("#insertForm");
/**Get the submit type in the form*/
var selected_submit_type = $("#insertForm").find("#actions_panel .control_at_footer option:selected").val();
$("#result_query").remove();
PMA_prepareForAjaxRequest($form);
//User wants to submit the form
$.post($form.attr('action'), $form.serialize(), function (data) {
if (data.success === true) {
PMA_ajaxShowMessage(data.message);
if (selected_submit_type == "showinsert") {
$("#sqlqueryresults").prepend(data.sql_query);
$("#result_query .notice").remove();
$("#result_query").prepend(data.message);
$("#table_results tbody tr.marked .multi_checkbox " +
", #table_results tbody tr td.marked .multi_checkbox").prop("checked", false);
$("#table_results tbody tr.marked .multi_checkbox " +
", #table_results tbody tr td.marked .multi_checkbox").removeClass("last_clicked");
$("#table_results tbody tr" +
", #table_results tbody tr td").removeClass("marked");
} else {
if ($("#pageselector").length !== 0) {
$("#pageselector").trigger('change');
} else {
$("input[name=navig].ajax").trigger('click');
}
$("#result_query").remove();
$("#sqlqueryresults").prepend(data.sql_query);
$("#result_query .notice").remove();
$("#result_query").prepend((data.message));
}
} else {
PMA_ajaxShowMessage(data.error, false);
$("#table_results tbody tr.marked .multi_checkbox " +
", #table_results tbody tr td.marked .multi_checkbox").prop("checked", false);
$("#table_results tbody tr.marked .multi_checkbox " +
", #table_results tbody tr td.marked .multi_checkbox").removeClass("last_clicked");
$("#table_results tbody tr" +
", #table_results tbody tr td").removeClass("marked");
}
if ($("#change_row_dialog").length > 0) {
$("#change_row_dialog").dialog("close").remove();
}
}); // end $.post()
});
}); // end $()

View File

@ -153,15 +153,15 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
var target = evt.target || evt.srcElement;
//To generate the textbox that can take the salt
var new_salt_box = "<br><input type=text name=salt[multi_edit][" + multi_edit + "][" + urlField + "]"
+" id=salt_"+target.id+" placeholder='enter Salt'>";
var new_salt_box = "<br><input type=text name=salt[multi_edit][" + multi_edit + "][" + urlField + "]" +
" id=salt_" + target.id + " placeholder='enter Salt'>";
//If AES_ENCRYPT is Selected then append the new textbox for salt
if (target.value == "AES_ENCRYPT" && !($("#salt_"+target.id).length)) {
if (target.value == "AES_ENCRYPT" && !($("#salt_" + target.id).length)) {
$("input[name='fields[multi_edit][" + multi_edit + "][" + urlField + "]']").after(new_salt_box);
} else {
//The value of the select is no longer AES_ENCRYPT, remove the textbox for salt
$("#salt_"+target.id).remove();
$("#salt_" + target.id).remove();
}
// Unchecks the corresponding "NULL" control
@ -236,7 +236,7 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
AJAX.registerTeardown('tbl_change.js', function () {
$('span.open_gis_editor').die('click');
$("input[name='gis_data[save]']").die('click');
$('input.checkbox_null').unbind('click');
$('input.checkbox_null').die('click');
$('select[name="submit_type"]').unbind('change');
$("#insert_rows").die('change');
});
@ -289,7 +289,7 @@ AJAX.registerOnload('tbl_change.js', function () {
* "Continue insertion" are handled in the "Continue insertion" code
*
*/
$('input.checkbox_null').bind('click', function (e) {
$('input.checkbox_null').live('click', function (e) {
nullify(
// use hidden fields populated by tbl_change.php
$(this).siblings('.nullify_code').val(),
@ -505,3 +505,23 @@ AJAX.registerOnload('tbl_change.js', function () {
}
});
});
function changeValueFieldType(elem, searchIndex)
{
var fieldsValue = $("select#fieldID_" + searchIndex);
if (0 == fieldsValue.size()) {
return;
}
var type = $(elem).val();
if (
'IN (...)' == type
|| 'NOT IN (...)' == type
|| 'BETWEEN' == type
|| 'NOT BETWEEN' == type
) {
$("#fieldID_" + searchIndex).attr('multiple', '');
} else {
$("#fieldID_" + searchIndex).removeAttr('multiple');
}
}

View File

@ -6,6 +6,135 @@ var temp_chart_title;
var currentChart = null;
var currentSettings = null;
function extractDate(dateString) {
var matches, match;
var dateTimeRegExp = /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/;
var dateRegExp = /[0-9]{4}-[0-9]{2}-[0-9]{2}/;
matches = dateTimeRegExp.exec(dateString);
if (matches !== null && matches.length > 0) {
match = matches[0];
return new Date(match.substr(0, 4), match.substr(5, 2), match.substr(8, 2), match.substr(11, 2), match.substr(14, 2), match.substr(17, 2));
} else {
matches = dateRegExp.exec(dateString);
if (matches !== null && matches.length > 0) {
match = matches[0];
return new Date(match.substr(0, 4), match.substr(5, 2), match.substr(8, 2));
}
}
return null;
}
function PMA_queryChart(data, columnNames, settings) {
if ($('#querychart').length === 0) {
return;
}
var jqPlotSettings = {
title : {
text : settings.title,
escapeHtml: true
},
grid : {
drawBorder : false,
shadow : false,
background : 'rgba(0,0,0,0)'
},
legend : {
show : true,
placement : 'outsideGrid',
location : 'e'
},
axes : {
xaxis : {
label : settings.xaxisLabel
},
yaxis : {
label : settings.yaxisLabel
}
},
stackSeries : settings.stackSeries,
highlighter: {
show: true,
showTooltip: true,
tooltipAxes: 'xy'
}
};
// create the chart
var factory = new JQPlotChartFactory();
var chart = factory.createChart(settings.type, "querychart");
// create the data table and add columns
var dataTable = new DataTable();
if (settings.type == 'timeline') {
dataTable.addColumn(ColumnType.DATE, columnNames[settings.mainAxis]);
} else {
dataTable.addColumn(ColumnType.STRING, columnNames[settings.mainAxis]);
}
$.each(settings.selectedSeries, function (index, element) {
dataTable.addColumn(ColumnType.NUMBER, columnNames[element]);
});
// set data to the data table
var columnsToExtract = [ settings.mainAxis ];
$.each(settings.selectedSeries, function (index, element) {
columnsToExtract.push(element);
});
var values = [], newRow, row, col;
for (var i = 0; i < data.length; i++) {
row = data[i];
newRow = [];
for (var j = 0; j < columnsToExtract.length; j++) {
col = columnNames[columnsToExtract[j]];
if (j === 0) {
if (settings.type == 'timeline') { // first column is date type
newRow.push(extractDate(row[col]));
} else { // first column is string type
newRow.push(row[col]);
}
} else { // subsequent columns are of type, number
newRow.push(parseFloat(row[col]));
}
}
values.push(newRow);
}
dataTable.setData(values);
// draw the chart and return the chart object
chart.draw(dataTable, jqPlotSettings);
return chart;
}
function drawChart() {
currentSettings.width = $('#resizer').width() - 20;
currentSettings.height = $('#resizer').height() - 20;
// todo: a better way using .redraw() ?
if (currentChart !== null) {
currentChart.destroy();
}
var columnNames = [];
$('select[name="chartXAxis"] option').each(function () {
columnNames.push($(this).text());
});
try {
currentChart = PMA_queryChart(chart_data, columnNames, currentSettings);
} catch (err) {
PMA_ajaxShowMessage(err.message, false);
}
}
function getSelectedSeries() {
var val = $('select[name="chartSeries"]').val() || [];
var ret = [];
$.each(val, function (i, v) {
ret.push(parseInt(v, 10));
});
return ret;
}
/**
* Unbind all event handlers before tearing down a page
*/
@ -191,132 +320,3 @@ $("#tblchartform").live('submit', function (event) {
return false;
}); // end
function drawChart() {
currentSettings.width = $('#resizer').width() - 20;
currentSettings.height = $('#resizer').height() - 20;
// todo: a better way using .redraw() ?
if (currentChart !== null) {
currentChart.destroy();
}
var columnNames = [];
$('select[name="chartXAxis"] option').each(function () {
columnNames.push($(this).text());
});
try {
currentChart = PMA_queryChart(chart_data, columnNames, currentSettings);
} catch (err) {
PMA_ajaxShowMessage(err.message, false);
}
}
function getSelectedSeries() {
var val = $('select[name="chartSeries"]').val() || [];
var ret = [];
$.each(val, function (i, v) {
ret.push(parseInt(v, 10));
});
return ret;
}
function extractDate(dateString) {
var matches, match;
var dateTimeRegExp = /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/;
var dateRegExp = /[0-9]{4}-[0-9]{2}-[0-9]{2}/;
matches = dateTimeRegExp.exec(dateString);
if (matches !== null && matches.length > 0) {
match = matches[0];
return new Date(match.substr(0, 4), match.substr(5, 2), match.substr(8, 2), match.substr(11, 2), match.substr(14, 2), match.substr(17, 2));
} else {
matches = dateRegExp.exec(dateString);
if (matches !== null && matches.length > 0) {
match = matches[0];
return new Date(match.substr(0, 4), match.substr(5, 2), match.substr(8, 2));
}
}
return null;
}
function PMA_queryChart(data, columnNames, settings) {
if ($('#querychart').length === 0) {
return;
}
var jqPlotSettings = {
title : {
text : settings.title,
escapeHtml: true
},
grid : {
drawBorder : false,
shadow : false,
background : 'rgba(0,0,0,0)'
},
legend : {
show : true,
placement : 'outsideGrid',
location : 'e'
},
axes : {
xaxis : {
label : settings.xaxisLabel
},
yaxis : {
label : settings.yaxisLabel
}
},
stackSeries : settings.stackSeries,
highlighter: {
show: true,
showTooltip: true,
tooltipAxes: 'xy'
}
};
// create the chart
var factory = new JQPlotChartFactory();
var chart = factory.createChart(settings.type, "querychart");
// create the data table and add columns
var dataTable = new DataTable();
if (settings.type == 'timeline') {
dataTable.addColumn(ColumnType.DATE, columnNames[settings.mainAxis]);
} else {
dataTable.addColumn(ColumnType.STRING, columnNames[settings.mainAxis]);
}
$.each(settings.selectedSeries, function (index, element) {
dataTable.addColumn(ColumnType.NUMBER, columnNames[element]);
});
// set data to the data table
var columnsToExtract = [ settings.mainAxis ];
$.each(settings.selectedSeries, function (index, element) {
columnsToExtract.push(element);
});
var values = [], newRow, row, col;
for (var i = 0; i < data.length; i++) {
row = data[i];
newRow = [];
for (var j = 0; j < columnsToExtract.length; j++) {
col = columnNames[columnsToExtract[j]];
if (j === 0) {
if (settings.type == 'timeline') { // first column is date type
newRow.push(extractDate(row[col]));
} else { // first column is string type
newRow.push(row[col]);
}
} else { // subsequent columns are of type, number
newRow.push(parseFloat(row[col]));
}
}
values.push(newRow);
}
dataTable.setData(values);
// draw the chart and return the chart object
chart.draw(dataTable, jqPlotSettings);
return chart;
}

View File

@ -5,7 +5,7 @@
*/
function show_hide_clauses($thisDropdown)
{
if ($thisDropdown.val() == '') {
if ($thisDropdown.val() === '') {
$thisDropdown.parent().nextAll('span').hide();
} else {
if ($thisDropdown.is('select[name^="destination_foreign_column"]')) {
@ -14,6 +14,20 @@ function show_hide_clauses($thisDropdown)
}
}
/**
* Sets dropdown options to values
*/
function setDropdownValues($dropdown, values) {
$dropdown.empty();
var optionsAsString = '';
// add an empty string to the beginning for empty selection
values.unshift('');
$.each(values, function () {
optionsAsString += "<option value='" + this + "'>" + this + "</option>";
});
$dropdown.append($(optionsAsString));
}
/**
* Retrieves and populates dropdowns to the left based on the selected value
*
@ -37,7 +51,7 @@ function getDropdownValues($dropdown) {
if ($dropdown.is('select[name^="destination' + foreign + '_db"]')) {
foreignDb = $dropdown.val();
// if no database is selected empty table and column dropdowns
if (foreignDb == '') {
if (foreignDb === '') {
setDropdownValues($tableDd, []);
setDropdownValues($columnDd, []);
return;
@ -47,22 +61,26 @@ function getDropdownValues($dropdown) {
.find('select[name^="destination' + foreign + '_db"]').val();
foreignTable = $dropdown.val();
// if no table is selected empty the column dropdown
if (foreignTable == '') {
if (foreignTable === '') {
setDropdownValues($columnDd, []);
return;
}
}
var $msgbox = PMA_ajaxShowMessage();
var $form = $dropdown.parents('form');
var url = 'tbl_relation.php?getDropdownValues=true&ajax_request=true'
+ '&token=' + $form.find('input[name="token"]').val()
+ '&db=' + $form.find('input[name="db"]').val()
+ '&table=' + $form.find('input[name="table"]').val()
+ '&foreign=' + (foreign != '')
+ '&foreignDb=' + encodeURIComponent(foreignDb)
+ (foreignTable !== null ?
var url = 'tbl_relation.php?getDropdownValues=true&ajax_request=true' +
'&token=' + $form.find('input[name="token"]').val() +
'&db=' + $form.find('input[name="db"]').val() +
'&table=' + $form.find('input[name="table"]').val() +
'&foreign=' + (foreign !== '') +
'&foreignDb=' + encodeURIComponent(foreignDb) +
(foreignTable !== null ?
'&foreignTable=' + encodeURIComponent(foreignTable) : ''
);
var $server = $form.find('input[name="server"]');
if ($server.length > 0) {
url += '&server=' + $form.find('input[name="server"]').val();
}
$.ajax({
url: url,
datatype: 'json',
@ -70,7 +88,7 @@ function getDropdownValues($dropdown) {
PMA_ajaxRemoveMessage($msgbox);
if (data.success) {
// if the changed dropdown is a database selector
if (foreignTable == null) {
if (foreignTable === null) {
// set values for table and column dropdowns
setDropdownValues($tableDd, data.tables);
setDropdownValues($columnDd, []);
@ -85,26 +103,16 @@ function getDropdownValues($dropdown) {
});
}
function setDropdownValues($dropdown, values) {
$dropdown.empty();
var optionsAsString = '';
// add an empty string to the beginning for empty selection
values.unshift('');
$.each(values, function () {
optionsAsString += "<option value='" + this + "'>" + this + "</option>";
})
$dropdown.append($(optionsAsString));
}
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('tbl_relation.js', function () {
$('select[name^="destination_foreign"]').unbind('change');
$('select[name^="destination_db"],'
+ ' select[name^="destination_table"],'
+ ' select[name^="destination_foreign_db"],'
+ ' select[name^="destination_foreign_table"]').unbind('change');
$('select[name^="destination_db"],' +
' select[name^="destination_table"],' +
' select[name^="destination_foreign_db"],' +
' select[name^="destination_foreign_table"]'
).unbind('change');
});
AJAX.registerOnload('tbl_relation.js', function () {
@ -117,11 +125,11 @@ AJAX.registerOnload('tbl_relation.js', function () {
show_hide_clauses($(this));
});
$('select[name^="destination_db"],'
+ ' select[name^="destination_table"],'
+ ' select[name^="destination_foreign_db"],'
+ ' select[name^="destination_foreign_table"]')
.change(function () {
$('select[name^="destination_db"],' +
' select[name^="destination_table"],' +
' select[name^="destination_foreign_db"],' +
' select[name^="destination_foreign_table"]'
).change(function () {
getDropdownValues($(this));
});
});

View File

@ -53,7 +53,7 @@ function PMA_tbl_structure_menu_resizer_callback() {
/**
* Reload fields table
*/
function reloadFieldForm(message) {
function reloadFieldForm() {
$.post($("#fieldsForm").attr('action'), $("#fieldsForm").serialize() + "&ajax_request=true", function (form_data) {
var $temp_div = $("<div id='temp_div'><div>").append(form_data.message);
$("#fieldsForm").replaceWith($temp_div.find("#fieldsForm"));
@ -62,9 +62,6 @@ function reloadFieldForm(message) {
$("#moveColumns").removeClass("move-active");
/* reinitialise the more options in table */
$('#fieldsForm ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer_callback);
setTimeout(function () {
PMA_ajaxShowMessage(message);
}, 500);
});
$('#page_content').show();
}
@ -119,6 +116,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
.show();
PMA_highlightSQL($('#page_content'));
$("#result_query .notice").remove();
reloadFieldForm();
$form.remove();
PMA_ajaxRemoveMessage($msg);
PMA_reloadNavigation();

View File

@ -368,7 +368,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
// other
} else {
// type explicitly identified
if (sqlTypes[key] != null) {
if (sqlTypes[key] !== null) {
if (sqlTypes[key] == 'bit') {
sql_query += "b'" + value + "', ";
}

1114
js/tracekit/tracekit.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -83,7 +83,7 @@ class Advisor
/**
* Executes advisor rules
*
* @return void
* @return boolean
*/
function runRules()
{
@ -264,7 +264,7 @@ class Advisor
*
* @param array $matches List of matched elements form preg_replace_callback
*
* @return Replacement value
* @return string Replacement value
*/
private function _replaceLinkURL($matches)
{
@ -276,7 +276,7 @@ class Advisor
*
* @param array $matches List of matched elements form preg_replace_callback
*
* @return Replacement value
* @return string Replacement value
*/
private function _ruleExprEvaluateFired($matches)
{
@ -300,7 +300,7 @@ class Advisor
*
* @param array $matches List of matched elements form preg_replace_callback
*
* @return Replacement value
* @return string Replacement value
*/
private function _ruleExprEvaluateVariable($matches)
{
@ -323,7 +323,9 @@ class Advisor
* that string position, but still evaluates the
* whole expr
*
* @return result of evaluated expression
* @return string result of evaluated expression
*
* @throws Exception
*/
function ruleExprEvaluate($expr, $ignoreUntil = 0)
{
@ -459,9 +461,9 @@ class Advisor
* Formats interval like 10 per hour
*
* @param integer $num number to format
* @param intefer $precision required precision
* @param integer $precision required precision
*
* @return formatted string
* @return string formatted string
*/
function ADVISOR_bytime($num, $precision)
{

View File

@ -15,6 +15,11 @@ if (! defined('PHPMYADMIN')) {
*/
require_once './libraries/vendor_config.php';
/**
* Indication for error handler (see end of this file).
*/
$GLOBALS['pma_config_loading'] = false;
/**
* Configuration class
*
@ -32,6 +37,11 @@ class PMA_Config
*/
var $default = array();
/**
* @var array configuration settings, without user preferences applied
*/
var $base_settings = array();
/**
* @var array configuration settings
*/
@ -93,6 +103,8 @@ class PMA_Config
$this->checkSystem();
$this->isHttps();
$this->base_settings = $this->settings;
}
/**
@ -102,7 +114,7 @@ class PMA_Config
*/
function checkSystem()
{
$this->set('PMA_VERSION', '4.1-dev');
$this->set('PMA_VERSION', '4.2.0-dev');
/**
* @deprecated
*/
@ -202,6 +214,13 @@ class PMA_Config
)) {
$this->set('PMA_USR_BROWSER_VER', $log_version[2]);
$this->set('PMA_USR_BROWSER_AGENT', 'IE');
} elseif (preg_match(
'@Trident/(7)\.0@',
$HTTP_USER_AGENT,
$log_version
)) {
$this->set('PMA_USR_BROWSER_VER', intval($log_version[1]) + 4);
$this->set('PMA_USR_BROWSER_AGENT', 'IE');
} elseif (preg_match(
'@OmniWeb/([0-9].[0-9]{1,2})@',
$HTTP_USER_AGENT,
@ -718,7 +737,7 @@ class PMA_Config
* @param mixed $link curl link
* @param boolean $get_body whether to retrieve body of document
*
* @return test result or data
* @return string|boolean test result or data
*/
function checkHTTP($link, $get_body = false)
{
@ -776,7 +795,7 @@ class PMA_Config
}
/**
* loads configuration from $source, usally the config file
* loads configuration from $source, usually the config file
* should be called on object creation
*
* @param string $source config file
@ -991,30 +1010,34 @@ class PMA_Config
}
// save connection collation
if (isset($_COOKIE['pma_collation_connection'])
|| isset($_POST['collation_connection'])
) {
if ((! isset($config_data['collation_connection'])
&& $GLOBALS['collation_connection'] != 'utf8_general_ci')
|| isset($config_data['collation_connection'])
&& $GLOBALS['collation_connection'] != $config_data['collation_connection']
if (!PMA_DRIZZLE) {
// just to shorten the lines
$collation = 'collation_connection';
if (isset($_COOKIE['pma_collation_connection'])
|| isset($_POST[$collation])
) {
$this->setUserValue(
null,
'collation_connection',
$GLOBALS['collation_connection'],
'utf8_general_ci'
);
}
} else {
// read collation from settings
if (isset($config_data['collation_connection'])) {
$GLOBALS['collation_connection']
= $config_data['collation_connection'];
$this->setCookie(
'pma_collation_connection',
if ((! isset($config_data[$collation])
&& $GLOBALS[$collation] != 'utf8_general_ci')
|| isset($config_data[$collation])
&& $GLOBALS[$collation] != $config_data[$collation]
) {
$this->setUserValue(
null,
$collation,
$GLOBALS[$collation],
'utf8_general_ci'
);
}
} else {
// read collation from settings
if (isset($config_data['collation_connection'])) {
$GLOBALS['collation_connection']
);
= $config_data['collation_connection'];
$this->setCookie(
'pma_collation_connection',
$GLOBALS['collation_connection']
);
}
}
}
}
@ -1288,7 +1311,7 @@ class PMA_Config
// And finally the path could be already set from REQUEST_URI
if (empty($url['path'])) {
// we got a case with nginx + php-fpm where PHP_SELF
// was not set, so PMA_PHP_SELF was not set as well
// was not set, so PMA_PHP_SELF was not set as well
if (isset($GLOBALS['PMA_PHP_SELF'])) {
$path = parse_url($GLOBALS['PMA_PHP_SELF']);
} else {
@ -1349,6 +1372,13 @@ class PMA_Config
}
$pma_absolute_uri .= $path;
// This is to handle the case of a reverse proxy
if ($this->get('ForceSSL')) {
$this->set('PmaAbsoluteUri', $pma_absolute_uri);
$pma_absolute_uri = $this->getSSLUri();
$this->isHttps();
}
// We used to display a warning if PmaAbsoluteUri wasn't set, but now
// the autodetect code works well enough that we don't display the
// warning at all. The user can still set PmaAbsoluteUri manually.
@ -1395,12 +1425,7 @@ class PMA_Config
}
// Reconstruct URL using parsed parts
if ($this->get('SSLPort')) {
$port_number = $this->get('SSLPort');
} else {
$port_number = 443;
}
return 'https://' . $parsed['host'] . ':' . $port_number . $parsed['path'];
return 'https://' . $parsed['host'] . ':443' . $parsed['path'];
}
/**
@ -1554,6 +1579,11 @@ class PMA_Config
$url['scheme'] = PMA_getenv('HTTP_SCHEME');
} elseif (PMA_getenv('HTTPS')
&& strtolower(PMA_getenv('HTTPS')) == 'on'
) {
$url['scheme'] = 'https';
// A10 Networks load balancer:
} elseif (PMA_getenv('HTTP_HTTPS_FROM_LB')
&& strtolower(PMA_getenv('HTTP_HTTPS_FROM_LB')) == 'on'
) {
$url['scheme'] = 'https';
} elseif (PMA_getenv('HTTP_X_FORWARDED_PROTO')) {
@ -1867,7 +1897,6 @@ function PMA_Config_fatalErrorHandler()
}
if (!defined('TESTSUITE')) {
$GLOBALS['pma_config_loading'] = false;
register_shutdown_function('PMA_Config_fatalErrorHandler');
}

View File

@ -307,7 +307,7 @@ class PMA_DbQbe
* @param integer $column_number Column Number (0,1,2) or more
* @param string $selected Selected criteria column name
*
* @return HTML for select options
* @return string HTML for select options
*/
private function _showColumnSelectCell($column_number, $selected = '')
{
@ -333,7 +333,7 @@ class PMA_DbQbe
* @param string $asc_selected Selected criteria 'Ascending'
* @param string $desc_selected Selected criteria 'Descending'
*
* @return HTML for select options
* @return string HTML for select options
*/
private function _getSortSelectCell($column_number, $asc_selected = '',
$desc_selected = ''
@ -356,7 +356,7 @@ class PMA_DbQbe
/**
* Provides search form's row containing column select options
*
* @return HTML for search table's row
* @return string HTML for search table's row
*/
private function _getColumnNamesRow()
{
@ -398,7 +398,7 @@ class PMA_DbQbe
/**
* Provides search form's row containing sort(ASC/DESC) select options
*
* @return HTML for search table's row
* @return string HTML for search table's row
*/
private function _getSortRow()
{
@ -460,7 +460,7 @@ class PMA_DbQbe
/**
* Provides search form's row containing SHOW checkboxes
*
* @return HTML for search table's row
* @return string HTML for search table's row
*/
private function _getShowRow()
{
@ -505,7 +505,7 @@ class PMA_DbQbe
/**
* Provides search form's row containing criteria Inputboxes
*
* @return HTML for search table's row
* @return string HTML for search table's row
*/
private function _getCriteriaInputboxRow()
{
@ -548,7 +548,9 @@ class PMA_DbQbe
$html_output .= '<td class="center">';
$html_output .= '<input type="hidden"'
. ' name="prev_criteria[' . $new_column_count . ']"'
. ' value="' . htmlspecialchars($this->_curCriteria[$new_column_count]) . '" />';
. ' value="'
. htmlspecialchars($this->_curCriteria[$new_column_count])
. '" />';
$html_output .= '<input type="text"'
. ' name="criteria[' . $new_column_count . ']"'
. ' value="' . htmlspecialchars($tmp_criteria) . '"'
@ -567,7 +569,7 @@ class PMA_DbQbe
*
* @param string $type Whether row or column
*
* @return HTML for footer options
* @return string HTML for footer options
*/
private function _getFootersOptions($type)
{
@ -591,7 +593,7 @@ class PMA_DbQbe
/**
* Provides search form table's footer options
*
* @return HTML for table footer
* @return string HTML for table footer
*/
private function _getTableFooters()
{
@ -609,7 +611,7 @@ class PMA_DbQbe
/**
* Provides a select list of database tables
*
* @return HTML for table select list
* @return string HTML for table select list
*/
private function _getTablesList()
{
@ -645,7 +647,7 @@ class PMA_DbQbe
* @param integer $column_number Column Number (0,1,2) or more
* @param array $selected Selected criteria column name
*
* @return HTML for modification cell
* @return string HTML for modification cell
*/
private function _getAndOrColCell($column_number, $selected = null)
{
@ -672,14 +674,18 @@ class PMA_DbQbe
* Provides search form's row containing column modifications options
* (For modifying search form's table columns)
*
* @return HTML for search table's row
* @return string HTML for search table's row
*/
private function _getModifyColumnsRow()
{
$html_output = '<tr class="even noclick">';
$html_output .= '<th>' . __('Modify:') . '</th>';
$new_column_count = 0;
for ($column_index = 0; $column_index < $this->_criteria_column_count; $column_index++) {
for (
$column_index = 0;
$column_index < $this->_criteria_column_count;
$column_index++
) {
if (! empty($this->_criteriaColumnInsert)
&& isset($this->_criteriaColumnInsert[$column_index])
&& $this->_criteriaColumnInsert[$column_index] == 'on'
@ -725,7 +731,7 @@ class PMA_DbQbe
* @param integer $row_index Number of criteria row
* @param string $checked_options If checked
*
* @return HTML
* @return string HTML
*/
private function _getInsDelAndOrCell($row_index, $checked_options)
{
@ -774,7 +780,7 @@ class PMA_DbQbe
* @param integer $new_row_index New row index if rows are added/deleted
* @param integer $row_index Row index
*
* @return HTML table rows
* @return string HTML table rows
*/
private function _getInputboxRow($new_row_index, $row_index)
{
@ -823,14 +829,18 @@ class PMA_DbQbe
* Provides rows for criteria inputbox Insert/Delete options
* with AND/OR relationship modification options
*
* @return HTML table rows
* @return string HTML table rows
*/
private function _getInsDelAndOrCriteriaRows()
{
$html_output = '';
$new_row_count = 0;
$odd_row = true;
for ($row_index = 0; $row_index <= $this->_criteria_row_count; $row_index++) {
for (
$row_index = 0;
$row_index <= $this->_criteria_row_count;
$row_index++
) {
if (isset($this->_criteriaRowInsert[$row_index])
&& $this->_criteriaRowInsert[$row_index] == 'on'
) {
@ -883,7 +893,7 @@ class PMA_DbQbe
/**
* Provides SELECT clause for building SQL query
*
* @return Select clause
* @return string Select clause
*/
private function _getSelectClause()
{
@ -907,20 +917,25 @@ class PMA_DbQbe
/**
* Provides WHERE clause for building SQL query
*
* @return Where clause
* @return string Where clause
*/
private function _getWhereClause()
{
$where_clause = '';
$criteria_cnt = 0;
for ($column_index = 0; $column_index < $this->_criteria_column_count; $column_index++) {
for (
$column_index = 0;
$column_index < $this->_criteria_column_count;
$column_index++
) {
if (! empty($this->_curField[$column_index])
&& ! empty($this->_curCriteria[$column_index])
&& $column_index
&& isset($last_where)
&& isset($this->_curAndOrCol)
) {
$where_clause .= ' ' . strtoupper($this->_curAndOrCol[$last_where]) . ' ';
$where_clause .= ' '
. strtoupper($this->_curAndOrCol[$last_where]) . ' ';
}
if (! empty($this->_curField[$column_index])
&& ! empty($this->_curCriteria[$column_index])
@ -938,16 +953,25 @@ class PMA_DbQbe
if (! isset($this->_curAndOrRow)) {
$this->_curAndOrRow = array();
}
for ($row_index = 0; $row_index <= $this->_criteria_row_count; $row_index++) {
for (
$row_index = 0;
$row_index <= $this->_criteria_row_count;
$row_index++
) {
$criteria_cnt = 0;
$qry_orwhere = '';
$last_orwhere = '';
for ($column_index = 0; $column_index < $this->_criteria_column_count; $column_index++) {
for (
$column_index = 0;
$column_index < $this->_criteria_column_count;
$column_index++
) {
if (! empty($this->_curField[$column_index])
&& ! empty(${'curOr' . $row_index}[$column_index])
&& $column_index
) {
$qry_orwhere .= ' ' . strtoupper($this->_curAndOrCol[$last_orwhere]) . ' ';
$qry_orwhere .= ' '
. strtoupper($this->_curAndOrCol[$last_orwhere]) . ' ';
}
if (! empty($this->_curField[$column_index])
&& ! empty(${'curOr' . $row_index}[$column_index])
@ -983,13 +1007,17 @@ class PMA_DbQbe
/**
* Provides ORDER BY clause for building SQL query
*
* @return Order By clause
* @return string Order By clause
*/
private function _getOrderByClause()
{
$orderby_clause = '';
$orderby_clauses = array();
for ($column_index = 0; $column_index < $this->_criteria_column_count; $column_index++) {
for (
$column_index = 0;
$column_index < $this->_criteria_column_count;
$column_index++
) {
// if all columns are chosen with * selector,
// then sorting isn't available
// Fix for Bug #570698
@ -1182,7 +1210,11 @@ class PMA_DbQbe
$where_clause_columns = array();
$where_clause_tables = array();
// Now we need all tables that we have in the where clause
for ($column_index = 0; $column_index < count($this->_criteria); $column_index++) {
for (
$column_index = 0;
$column_index < count($this->_criteria);
$column_index++
) {
$current_table = explode('.', $_POST['criteriaColumn'][$column_index]);
if (empty($current_table[0]) || empty($current_table[1])) {
continue;

View File

@ -41,7 +41,7 @@ class PMA_DatabaseInterface
/**
* Constructor
*
* @param object $ext PMA_DBI_Extension object to be used for database queries
* @param PMA_DBI_Extension $ext Object to be used for database queries
*/
public function __construct(PMA_DBI_Extension $ext)
{
@ -198,7 +198,7 @@ class PMA_DatabaseInterface
/**
* converts charset of a mysql message, usually coming from mysql_error(),
* into PMA charset, usally UTF-8
* into PMA charset, usually UTF-8
* uses language to charset mapping from mysql/share/errmsg.txt
* and charset names to ISO charset from information_schema.CHARACTER_SETS
*
@ -327,157 +327,164 @@ class PMA_DatabaseInterface
$tables = array();
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
// get table information from information_schema
if ($table) {
if (true === $tbl_is_group) {
$sql_where_table = 'AND t.`TABLE_NAME` LIKE \''
. PMA_Util::escapeMysqlWildcards(
PMA_Util::sqlAddSlashes($table)
)
. '%\'';
// get table information from information_schema
if ($table) {
if (true === $tbl_is_group) {
$sql_where_table = 'AND t.`TABLE_NAME` LIKE \''
. PMA_Util::escapeMysqlWildcards(
PMA_Util::sqlAddSlashes($table)
)
. '%\'';
} else {
$sql_where_table = 'AND t.`TABLE_NAME` = \''
. PMA_Util::sqlAddSlashes($table) . '\'';
}
} else {
$sql_where_table = '';
}
if ($tble_type) {
if ($tble_type == 'view') {
if (PMA_DRIZZLE) {
$sql_where_table .= " AND t.`TABLE_TYPE` != 'BASE'";
} else {
$sql_where_table = 'AND t.`TABLE_NAME` = \''
. PMA_Util::sqlAddSlashes($table) . '\'';
$sql_where_table .= " AND t.`TABLE_TYPE` != 'BASE TABLE'";
}
} else {
$sql_where_table = '';
}
if ($tble_type) {
if ($tble_type == 'view') {
$sql_where_table .= " AND t.`TABLE_TYPE` = 'VIEW'";
} else if ($tble_type == 'table') {
$sql_where_table .= " AND t.`TABLE_TYPE` != 'VIEW'";
} else if ($tble_type == 'table') {
if (PMA_DRIZZLE) {
$sql_where_table .= " AND t.`TABLE_TYPE` = 'BASE'";
} else {
$sql_where_table .= " AND t.`TABLE_TYPE` = 'BASE TABLE'";
}
}
}
// for PMA bc:
// `SCHEMA_FIELD_NAME` AS `SHOW_TABLE_STATUS_FIELD_NAME`
//
// on non-Windows servers,
// added BINARY in the WHERE clause to force a case sensitive
// comparison (if we are looking for the db Aa we don't want
// to find the db aa)
$this_databases = array_map('PMA_Util::sqlAddSlashes', $databases);
// for PMA bc:
// `SCHEMA_FIELD_NAME` AS `SHOW_TABLE_STATUS_FIELD_NAME`
//
// on non-Windows servers,
// added BINARY in the WHERE clause to force a case sensitive
// comparison (if we are looking for the db Aa we don't want
// to find the db aa)
$this_databases = array_map('PMA_Util::sqlAddSlashes', $databases);
if (PMA_DRIZZLE) {
$engine_info = PMA_Util::cacheGet('drizzle_engines', true);
$stats_join = "LEFT JOIN (SELECT 0 NUM_ROWS) AS stat ON false";
if (isset($engine_info['InnoDB'])
&& $engine_info['InnoDB']['module_library'] == 'innobase'
) {
$stats_join = "LEFT JOIN data_dictionary.INNODB_SYS_TABLESTATS"
. " stat ON (t.ENGINE = 'InnoDB' AND stat.NAME"
. " = (t.TABLE_SCHEMA || '/') || t.TABLE_NAME)";
}
// data_dictionary.table_cache may not contain any data
// for some tables, it's just a table cache
// auto_increment == 0 is cast to NULL because currently
// (2011.03.13 GA)
// Drizzle doesn't provide correct value
$sql = "
SELECT t.*,
t.TABLE_SCHEMA AS `Db`,
t.TABLE_NAME AS `Name`,
t.TABLE_TYPE AS `TABLE_TYPE`,
t.ENGINE AS `Engine`,
t.ENGINE AS `Type`,
t.TABLE_VERSION AS `Version`,-- VERSION
t.ROW_FORMAT AS `Row_format`,
coalesce(tc.ROWS, stat.NUM_ROWS)
AS `Rows`,-- TABLE_ROWS,
coalesce(tc.ROWS, stat.NUM_ROWS)
AS `TABLE_ROWS`,
tc.AVG_ROW_LENGTH AS `Avg_row_length`, -- AVG_ROW_LENGTH
tc.TABLE_SIZE AS `Data_length`, -- DATA_LENGTH
NULL AS `Max_data_length`, -- MAX_DATA_LENGTH
NULL AS `Index_length`, -- INDEX_LENGTH
NULL AS `Data_free`, -- DATA_FREE
nullif(t.AUTO_INCREMENT, 0)
AS `Auto_increment`,
t.TABLE_CREATION_TIME AS `Create_time`, -- CREATE_TIME
t.TABLE_UPDATE_TIME AS `Update_time`, -- UPDATE_TIME
NULL AS `Check_time`, -- CHECK_TIME
t.TABLE_COLLATION AS `Collation`,
NULL AS `Checksum`, -- CHECKSUM
NULL AS `Create_options`, -- CREATE_OPTIONS
t.TABLE_COMMENT AS `Comment`
FROM data_dictionary.TABLES t
LEFT JOIN data_dictionary.TABLE_CACHE tc
ON tc.TABLE_SCHEMA = t.TABLE_SCHEMA AND tc.TABLE_NAME
= t.TABLE_NAME
$stats_join
WHERE t.TABLE_SCHEMA IN ('" . implode("', '", $this_databases) . "')
" . $sql_where_table;
} else {
$sql = '
SELECT *,
`TABLE_SCHEMA` AS `Db`,
`TABLE_NAME` AS `Name`,
`TABLE_TYPE` AS `TABLE_TYPE`,
`ENGINE` AS `Engine`,
`ENGINE` AS `Type`,
`VERSION` AS `Version`,
`ROW_FORMAT` AS `Row_format`,
`TABLE_ROWS` AS `Rows`,
`AVG_ROW_LENGTH` AS `Avg_row_length`,
`DATA_LENGTH` AS `Data_length`,
`MAX_DATA_LENGTH` AS `Max_data_length`,
`INDEX_LENGTH` AS `Index_length`,
`DATA_FREE` AS `Data_free`,
`AUTO_INCREMENT` AS `Auto_increment`,
`CREATE_TIME` AS `Create_time`,
`UPDATE_TIME` AS `Update_time`,
`CHECK_TIME` AS `Check_time`,
`TABLE_COLLATION` AS `Collation`,
`CHECKSUM` AS `Checksum`,
`CREATE_OPTIONS` AS `Create_options`,
`TABLE_COMMENT` AS `Comment`
FROM `information_schema`.`TABLES` t
WHERE ' . (PMA_IS_WINDOWS ? '' : 'BINARY') . ' `TABLE_SCHEMA`
IN (\'' . implode("', '", $this_databases) . '\')
' . $sql_where_table;
if (PMA_DRIZZLE) {
$engine_info = PMA_Util::cacheGet('drizzle_engines', true);
$stats_join = "LEFT JOIN (SELECT 0 NUM_ROWS) AS stat ON false";
if (isset($engine_info['InnoDB'])
&& $engine_info['InnoDB']['module_library'] == 'innobase'
) {
$stats_join = "LEFT JOIN data_dictionary.INNODB_SYS_TABLESTATS"
. " stat ON (t.ENGINE = 'InnoDB' AND stat.NAME"
. " = (t.TABLE_SCHEMA || '/') || t.TABLE_NAME)";
}
// Sort the tables
$sql .= " ORDER BY $sort_by $sort_order";
// data_dictionary.table_cache may not contain any data
// for some tables, it's just a table cache
// auto_increment == 0 is cast to NULL because currently
// (2011.03.13 GA)
// Drizzle doesn't provide correct value
$sql = "
SELECT t.*,
t.TABLE_SCHEMA AS `Db`,
t.TABLE_NAME AS `Name`,
t.TABLE_TYPE AS `TABLE_TYPE`,
t.ENGINE AS `Engine`,
t.ENGINE AS `Type`,
t.TABLE_VERSION AS `Version`,-- VERSION
t.ROW_FORMAT AS `Row_format`,
coalesce(tc.ROWS, stat.NUM_ROWS)
AS `Rows`,-- TABLE_ROWS,
coalesce(tc.ROWS, stat.NUM_ROWS)
AS `TABLE_ROWS`,
tc.AVG_ROW_LENGTH AS `Avg_row_length`, -- AVG_ROW_LENGTH
tc.TABLE_SIZE AS `Data_length`, -- DATA_LENGTH
NULL AS `Max_data_length`, -- MAX_DATA_LENGTH
NULL AS `Index_length`, -- INDEX_LENGTH
NULL AS `Data_free`, -- DATA_FREE
nullif(t.AUTO_INCREMENT, 0)
AS `Auto_increment`,
t.TABLE_CREATION_TIME AS `Create_time`, -- CREATE_TIME
t.TABLE_UPDATE_TIME AS `Update_time`, -- UPDATE_TIME
NULL AS `Check_time`, -- CHECK_TIME
t.TABLE_COLLATION AS `Collation`,
NULL AS `Checksum`, -- CHECKSUM
NULL AS `Create_options`, -- CREATE_OPTIONS
t.TABLE_COMMENT AS `Comment`
FROM data_dictionary.TABLES t
LEFT JOIN data_dictionary.TABLE_CACHE tc
ON tc.TABLE_SCHEMA = t.TABLE_SCHEMA AND tc.TABLE_NAME
= t.TABLE_NAME
$stats_join
WHERE t.TABLE_SCHEMA IN ('" . implode("', '", $this_databases) . "')
" . $sql_where_table;
} else {
$sql = '
SELECT *,
`TABLE_SCHEMA` AS `Db`,
`TABLE_NAME` AS `Name`,
`TABLE_TYPE` AS `TABLE_TYPE`,
`ENGINE` AS `Engine`,
`ENGINE` AS `Type`,
`VERSION` AS `Version`,
`ROW_FORMAT` AS `Row_format`,
`TABLE_ROWS` AS `Rows`,
`AVG_ROW_LENGTH` AS `Avg_row_length`,
`DATA_LENGTH` AS `Data_length`,
`MAX_DATA_LENGTH` AS `Max_data_length`,
`INDEX_LENGTH` AS `Index_length`,
`DATA_FREE` AS `Data_free`,
`AUTO_INCREMENT` AS `Auto_increment`,
`CREATE_TIME` AS `Create_time`,
`UPDATE_TIME` AS `Update_time`,
`CHECK_TIME` AS `Check_time`,
`TABLE_COLLATION` AS `Collation`,
`CHECKSUM` AS `Checksum`,
`CREATE_OPTIONS` AS `Create_options`,
`TABLE_COMMENT` AS `Comment`
FROM `information_schema`.`TABLES` t
WHERE ' . (PMA_IS_WINDOWS ? '' : 'BINARY') . ' `TABLE_SCHEMA`
IN (\'' . implode("', '", $this_databases) . '\')
' . $sql_where_table;
}
if ($limit_count) {
$sql .= ' LIMIT ' . $limit_count . ' OFFSET ' . $limit_offset;
}
// Sort the tables
$sql .= " ORDER BY $sort_by $sort_order";
$tables = $this->fetchResult(
$sql, array('TABLE_SCHEMA', 'TABLE_NAME'), null, $link
);
unset($sql_where_table, $sql);
if ($limit_count) {
$sql .= ' LIMIT ' . $limit_count . ' OFFSET ' . $limit_offset;
}
if (PMA_DRIZZLE) {
// correct I_S and D_D names returned by D_D.TABLES -
// Drizzle generally uses lower case for them,
// but TABLES returns uppercase
foreach ((array)$database as $db) {
$db_upper = strtoupper($db);
if (!isset($tables[$db]) && isset($tables[$db_upper])) {
$tables[$db] = $tables[$db_upper];
unset($tables[$db_upper]);
}
$tables = $this->fetchResult(
$sql, array('TABLE_SCHEMA', 'TABLE_NAME'), null, $link
);
unset($sql_where_table, $sql);
if (PMA_DRIZZLE) {
// correct I_S and D_D names returned by D_D.TABLES -
// Drizzle generally uses lower case for them,
// but TABLES returns uppercase
foreach ((array)$database as $db) {
$db_upper = strtoupper($db);
if (!isset($tables[$db]) && isset($tables[$db_upper])) {
$tables[$db] = $tables[$db_upper];
unset($tables[$db_upper]);
}
}
}
if ($sort_by == 'Name' && $GLOBALS['cfg']['NaturalOrder']) {
// here, the array's first key is by schema name
foreach ($tables as $one_database_name => $one_database_tables) {
uksort($one_database_tables, 'strnatcasecmp');
if ($sort_by == 'Name' && $GLOBALS['cfg']['NaturalOrder']) {
// here, the array's first key is by schema name
foreach ($tables as $one_database_name => $one_database_tables) {
uksort($one_database_tables, 'strnatcasecmp');
if ($sort_order == 'DESC') {
$one_database_tables = array_reverse($one_database_tables);
}
$tables[$one_database_name] = $one_database_tables;
if ($sort_order == 'DESC') {
$one_database_tables = array_reverse($one_database_tables);
}
$tables[$one_database_name] = $one_database_tables;
}
} // end (get information from table schema)
}
// end (get information from table schema)
// If permissions are wrong on even one database directory,
// information_schema does not return any table info for any database
@ -673,6 +680,13 @@ class PMA_DatabaseInterface
// we would lose a db name thats consists only of numbers
foreach ($tables as $one_database => $its_tables) {
if (isset(PMA_Table::$cache[$one_database])) {
// the + operator does not do the intended effect
// when the cache for one table already exists
if ($table
&& isset(PMA_Table::$cache[$one_database][$table])
) {
unset(PMA_Table::$cache[$one_database][$table]);
}
PMA_Table::$cache[$one_database]
= PMA_Table::$cache[$one_database] + $tables[$one_database];
} else {
@ -766,167 +780,112 @@ class PMA_DatabaseInterface
$apply_limit_and_order_manual = true;
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
/**
* if $GLOBALS['cfg']['NaturalOrder'] is enabled, we cannot use LIMIT
* cause MySQL does not support natural ordering,
* we have to do it afterward
*/
$limit = '';
if (! $GLOBALS['cfg']['NaturalOrder']) {
if ($limit_count) {
$limit = ' LIMIT ' . $limit_count . ' OFFSET ' . $limit_offset;
}
$apply_limit_and_order_manual = false;
/**
* if $GLOBALS['cfg']['NaturalOrder'] is enabled, we cannot use LIMIT
* cause MySQL does not support natural ordering,
* we have to do it afterward
*/
$limit = '';
if (! $GLOBALS['cfg']['NaturalOrder']) {
if ($limit_count) {
$limit = ' LIMIT ' . $limit_count . ' OFFSET ' . $limit_offset;
}
// get table information from information_schema
if ($database) {
$sql_where_schema = 'WHERE `SCHEMA_NAME` LIKE \''
. PMA_Util::sqlAddSlashes($database) . '\'';
} else {
$sql_where_schema = '';
}
if (PMA_DRIZZLE) {
// data_dictionary.table_cache may not contain any data for some
// tables, it's just a table cache
$sql = 'SELECT
s.SCHEMA_NAME,
s.DEFAULT_COLLATION_NAME';
if ($force_stats) {
// no TABLE_CACHE data, stable results are better than
// constantly changing
$sql .= ',
COUNT(t.TABLE_SCHEMA) AS SCHEMA_TABLES,
SUM(stat.NUM_ROWS) AS SCHEMA_TABLE_ROWS';
}
$sql .= '
FROM data_dictionary.SCHEMAS s';
if ($force_stats) {
$engine_info = PMA_Util::cacheGet('drizzle_engines', true);
$stats_join = "LEFT JOIN (SELECT 0 NUM_ROWS) AS stat ON false";
if (isset($engine_info['InnoDB'])
&& $engine_info['InnoDB']['module_library'] == 'innobase'
) {
$stats_join
= "LEFT JOIN data_dictionary.INNODB_SYS_TABLESTATS stat"
. " ON (t.ENGINE = 'InnoDB' AND stat.NAME"
. " = (t.TABLE_SCHEMA || '/') || t.TABLE_NAME)";
}
$sql .= "
LEFT JOIN data_dictionary.TABLES t
ON t.TABLE_SCHEMA = s.SCHEMA_NAME
$stats_join";
}
$sql .= $sql_where_schema . '
GROUP BY s.SCHEMA_NAME
ORDER BY ' . PMA_Util::backquote($sort_by) . ' ' . $sort_order
. $limit;
} else {
$sql = 'SELECT
s.SCHEMA_NAME,
s.DEFAULT_COLLATION_NAME';
if ($force_stats) {
$sql .= ',
COUNT(t.TABLE_SCHEMA) AS SCHEMA_TABLES,
SUM(t.TABLE_ROWS) AS SCHEMA_TABLE_ROWS,
SUM(t.DATA_LENGTH) AS SCHEMA_DATA_LENGTH,
SUM(t.MAX_DATA_LENGTH) AS SCHEMA_MAX_DATA_LENGTH,
SUM(t.INDEX_LENGTH) AS SCHEMA_INDEX_LENGTH,
SUM(t.DATA_LENGTH + t.INDEX_LENGTH)
AS SCHEMA_LENGTH,
SUM(t.DATA_FREE) AS SCHEMA_DATA_FREE';
}
$sql .= '
FROM `information_schema`.SCHEMATA s';
if ($force_stats) {
$sql .= '
LEFT JOIN `information_schema`.TABLES t
ON BINARY t.TABLE_SCHEMA = BINARY s.SCHEMA_NAME';
}
$sql .= $sql_where_schema . '
GROUP BY BINARY s.SCHEMA_NAME
ORDER BY BINARY ' . PMA_Util::backquote($sort_by)
. ' ' . $sort_order
. $limit;
}
$databases = $this->fetchResult($sql, 'SCHEMA_NAME', null, $link);
$mysql_error = $this->getError($link);
if (! count($databases) && $GLOBALS['errno']) {
PMA_Util::mysqlDie($mysql_error, $sql);
}
// display only databases also in official database list
// f.e. to apply hide_db and only_db
$drops = array_diff(
array_keys($databases), (array) $GLOBALS['pma']->databases
);
if (count($drops)) {
foreach ($drops as $drop) {
unset($databases[$drop]);
}
unset($drop);
}
unset($sql_where_schema, $sql, $drops);
} else {
foreach ($GLOBALS['pma']->databases as $database_name) {
// MySQL forward compatibility
// so pma could use this array as if every server is of version >5.0
// todo : remove and check the rest of the code for usage,
// MySQL 5.0 or higher is required for current PMA version
$databases[$database_name]['SCHEMA_NAME'] = $database_name;
if ($force_stats) {
include_once './libraries/mysql_charsets.inc.php';
$databases[$database_name]['DEFAULT_COLLATION_NAME']
= PMA_getDbCollation($database_name);
// get additional info about tables
$databases[$database_name]['SCHEMA_TABLES'] = 0;
$databases[$database_name]['SCHEMA_TABLE_ROWS'] = 0;
$databases[$database_name]['SCHEMA_DATA_LENGTH'] = 0;
$databases[$database_name]['SCHEMA_MAX_DATA_LENGTH'] = 0;
$databases[$database_name]['SCHEMA_INDEX_LENGTH'] = 0;
$databases[$database_name]['SCHEMA_LENGTH'] = 0;
$databases[$database_name]['SCHEMA_DATA_FREE'] = 0;
$res = $this->query(
'SHOW TABLE STATUS FROM '
. PMA_Util::backquote($database_name) . ';'
);
while ($row = $this->fetchAssoc($res)) {
$databases[$database_name]['SCHEMA_TABLES']++;
$databases[$database_name]['SCHEMA_TABLE_ROWS']
+= $row['Rows'];
$databases[$database_name]['SCHEMA_DATA_LENGTH']
+= $row['Data_length'];
$databases[$database_name]['SCHEMA_MAX_DATA_LENGTH']
+= $row['Max_data_length'];
$databases[$database_name]['SCHEMA_INDEX_LENGTH']
+= $row['Index_length'];
// for InnoDB, this does not contain the number of
// overhead bytes but the total free space
if ('InnoDB' != $row['Engine']) {
$databases[$database_name]['SCHEMA_DATA_FREE']
+= $row['Data_free'];
}
$databases[$database_name]['SCHEMA_LENGTH']
+= $row['Data_length'] + $row['Index_length'];
}
$this->freeResult($res);
unset($res);
}
}
$apply_limit_and_order_manual = false;
}
// get table information from information_schema
if ($database) {
$sql_where_schema = 'WHERE `SCHEMA_NAME` LIKE \''
. PMA_Util::sqlAddSlashes($database) . '\'';
} else {
$sql_where_schema = '';
}
if (PMA_DRIZZLE) {
// data_dictionary.table_cache may not contain any data for some
// tables, it's just a table cache
$sql = 'SELECT
s.SCHEMA_NAME,
s.DEFAULT_COLLATION_NAME';
if ($force_stats) {
// no TABLE_CACHE data, stable results are better than
// constantly changing
$sql .= ',
COUNT(t.TABLE_SCHEMA) AS SCHEMA_TABLES,
SUM(stat.NUM_ROWS) AS SCHEMA_TABLE_ROWS';
}
$sql .= '
FROM data_dictionary.SCHEMAS s';
if ($force_stats) {
$engine_info = PMA_Util::cacheGet('drizzle_engines', true);
$stats_join = "LEFT JOIN (SELECT 0 NUM_ROWS) AS stat ON false";
if (isset($engine_info['InnoDB'])
&& $engine_info['InnoDB']['module_library'] == 'innobase'
) {
$stats_join
= "LEFT JOIN data_dictionary.INNODB_SYS_TABLESTATS stat"
. " ON (t.ENGINE = 'InnoDB' AND stat.NAME"
. " = (t.TABLE_SCHEMA || '/') || t.TABLE_NAME)";
}
$sql .= "
LEFT JOIN data_dictionary.TABLES t
ON t.TABLE_SCHEMA = s.SCHEMA_NAME
$stats_join";
}
$sql .= $sql_where_schema . '
GROUP BY s.SCHEMA_NAME
ORDER BY ' . PMA_Util::backquote($sort_by) . ' ' . $sort_order
. $limit;
} else {
$sql = 'SELECT
s.SCHEMA_NAME,
s.DEFAULT_COLLATION_NAME';
if ($force_stats) {
$sql .= ',
COUNT(t.TABLE_SCHEMA) AS SCHEMA_TABLES,
SUM(t.TABLE_ROWS) AS SCHEMA_TABLE_ROWS,
SUM(t.DATA_LENGTH) AS SCHEMA_DATA_LENGTH,
SUM(t.MAX_DATA_LENGTH) AS SCHEMA_MAX_DATA_LENGTH,
SUM(t.INDEX_LENGTH) AS SCHEMA_INDEX_LENGTH,
SUM(t.DATA_LENGTH + t.INDEX_LENGTH)
AS SCHEMA_LENGTH,
SUM(t.DATA_FREE) AS SCHEMA_DATA_FREE';
}
$sql .= '
FROM `information_schema`.SCHEMATA s';
if ($force_stats) {
$sql .= '
LEFT JOIN `information_schema`.TABLES t
ON BINARY t.TABLE_SCHEMA = BINARY s.SCHEMA_NAME';
}
$sql .= $sql_where_schema . '
GROUP BY BINARY s.SCHEMA_NAME
ORDER BY BINARY ' . PMA_Util::backquote($sort_by)
. ' ' . $sort_order
. $limit;
}
$databases = $this->fetchResult($sql, 'SCHEMA_NAME', null, $link);
$mysql_error = $this->getError($link);
if (! count($databases) && $GLOBALS['errno']) {
PMA_Util::mysqlDie($mysql_error, $sql);
}
// display only databases also in official database list
// f.e. to apply hide_db and only_db
$drops = array_diff(
array_keys($databases), (array) $GLOBALS['pma']->databases
);
if (count($drops)) {
foreach ($drops as $drop) {
unset($databases[$drop]);
}
unset($drop);
}
unset($sql_where_schema, $sql, $drops);
/**
* apply limit and order manually now
@ -999,107 +958,81 @@ class PMA_DatabaseInterface
) {
$columns = array();
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$sql_wheres = array();
$array_keys = array();
$sql_wheres = array();
$array_keys = array();
// get columns information from information_schema
if (null !== $database) {
$sql_wheres[] = '`TABLE_SCHEMA` = \''
. PMA_Util::sqlAddSlashes($database) . '\' ';
} else {
$array_keys[] = 'TABLE_SCHEMA';
}
if (null !== $table) {
$sql_wheres[] = '`TABLE_NAME` = \''
. PMA_Util::sqlAddSlashes($table) . '\' ';
} else {
$array_keys[] = 'TABLE_NAME';
}
if (null !== $column) {
$sql_wheres[] = '`COLUMN_NAME` = \''
. PMA_Util::sqlAddSlashes($column) . '\' ';
} else {
$array_keys[] = 'COLUMN_NAME';
}
// for PMA bc:
// `[SCHEMA_FIELD_NAME]` AS `[SHOW_FULL_COLUMNS_FIELD_NAME]`
if (PMA_DRIZZLE) {
$sql = "SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME,
column_name AS `Field`,
(CASE
WHEN character_maximum_length > 0
THEN concat(lower(data_type), '(', character_maximum_length, ')')
WHEN numeric_precision > 0 OR numeric_scale > 0
THEN concat(lower(data_type), '(', numeric_precision,
',', numeric_scale, ')')
WHEN enum_values IS NOT NULL
THEN concat(lower(data_type), '(', enum_values, ')')
ELSE lower(data_type) END)
AS `Type`,
collation_name AS `Collation`,
(CASE is_nullable
WHEN 1 THEN 'YES'
ELSE 'NO' END) AS `Null`,
(CASE
WHEN is_used_in_primary THEN 'PRI'
ELSE '' END) AS `Key`,
column_default AS `Default`,
(CASE
WHEN is_auto_increment THEN 'auto_increment'
WHEN column_default_update
THEN 'on update ' || column_default_update
ELSE '' END) AS `Extra`,
NULL AS `Privileges`,
column_comment AS `Comment`
FROM data_dictionary.columns";
} else {
$sql = '
SELECT *,
`COLUMN_NAME` AS `Field`,
`COLUMN_TYPE` AS `Type`,
`COLLATION_NAME` AS `Collation`,
`IS_NULLABLE` AS `Null`,
`COLUMN_KEY` AS `Key`,
`COLUMN_DEFAULT` AS `Default`,
`EXTRA` AS `Extra`,
`PRIVILEGES` AS `Privileges`,
`COLUMN_COMMENT` AS `Comment`
FROM `information_schema`.`COLUMNS`';
}
if (count($sql_wheres)) {
$sql .= "\n" . ' WHERE ' . implode(' AND ', $sql_wheres);
}
$columns = $this->fetchResult($sql, $array_keys, null, $link);
unset($sql_wheres, $sql);
// get columns information from information_schema
if (null !== $database) {
$sql_wheres[] = '`TABLE_SCHEMA` = \''
. PMA_Util::sqlAddSlashes($database) . '\' ';
} else {
if (null === $database) {
foreach ($GLOBALS['pma']->databases as $database) {
$columns[$database] = $this->getColumnsFull(
$database, null, null, $link
);
}
return $columns;
} elseif (null === $table) {
$tables = $this->getTables($database);
foreach ($tables as $table) {
$columns[$table] = $this->getColumnsFull(
$database, $table, null, $link
);
}
return $columns;
}
$sql = 'SHOW FULL COLUMNS FROM '
. PMA_Util::backquote($database) . '.' . PMA_Util::backquote($table);
if (null !== $column) {
$sql .= " LIKE '" . PMA_Util::sqlAddSlashes($column, true) . "'";
}
$columns = $this->fetchResult($sql, 'Field', null, $link);
$array_keys[] = 'TABLE_SCHEMA';
}
if (null !== $table) {
$sql_wheres[] = '`TABLE_NAME` = \''
. PMA_Util::sqlAddSlashes($table) . '\' ';
} else {
$array_keys[] = 'TABLE_NAME';
}
if (null !== $column) {
$sql_wheres[] = '`COLUMN_NAME` = \''
. PMA_Util::sqlAddSlashes($column) . '\' ';
} else {
$array_keys[] = 'COLUMN_NAME';
}
// for PMA bc:
// `[SCHEMA_FIELD_NAME]` AS `[SHOW_FULL_COLUMNS_FIELD_NAME]`
if (PMA_DRIZZLE) {
$sql = "SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME,
column_name AS `Field`,
(CASE
WHEN character_maximum_length > 0
THEN concat(lower(data_type), '(', character_maximum_length, ')')
WHEN numeric_precision > 0 OR numeric_scale > 0
THEN concat(lower(data_type), '(', numeric_precision,
',', numeric_scale, ')')
WHEN enum_values IS NOT NULL
THEN concat(lower(data_type), '(', enum_values, ')')
ELSE lower(data_type) END)
AS `Type`,
collation_name AS `Collation`,
(CASE is_nullable
WHEN 1 THEN 'YES'
ELSE 'NO' END) AS `Null`,
(CASE
WHEN is_used_in_primary THEN 'PRI'
ELSE '' END) AS `Key`,
column_default AS `Default`,
(CASE
WHEN is_auto_increment THEN 'auto_increment'
WHEN column_default_update
THEN 'on update ' || column_default_update
ELSE '' END) AS `Extra`,
NULL AS `Privileges`,
column_comment AS `Comment`
FROM data_dictionary.columns";
} else {
$sql = '
SELECT *,
`COLUMN_NAME` AS `Field`,
`COLUMN_TYPE` AS `Type`,
`COLLATION_NAME` AS `Collation`,
`IS_NULLABLE` AS `Null`,
`COLUMN_KEY` AS `Key`,
`COLUMN_DEFAULT` AS `Default`,
`EXTRA` AS `Extra`,
`PRIVILEGES` AS `Privileges`,
`COLUMN_COMMENT` AS `Comment`
FROM `information_schema`.`COLUMNS`';
}
if (count($sql_wheres)) {
$sql .= "\n" . ' WHERE ' . implode(' AND ', $sql_wheres);
}
$columns = $this->fetchResult($sql, $array_keys, null, $link);
unset($sql_wheres, $sql);
$ordinal_position = 1;
foreach ($columns as $column_name => $each_column) {
@ -1347,12 +1280,15 @@ class PMA_DatabaseInterface
WHERE table_schema = '" . PMA_Util::sqlAddSlashes($database) . "'
AND table_name = '" . PMA_Util::sqlAddSlashes($table) . "'
";
if ($where) {
$sql = "SELECT * FROM (" . $sql . ") A WHERE (" . $where . ")";
}
} else {
$sql = 'SHOW INDEXES FROM ' . PMA_Util::backquote($database) . '.'
. PMA_Util::backquote($table);
}
if ($where) {
$sql .= (PMA_DRIZZLE ? ' AND (' : ' WHERE (') . $where . ')';
if ($where) {
$sql .= ' WHERE (' . $where . ')';
}
}
return $sql;
}
@ -1945,37 +1881,22 @@ class PMA_DatabaseInterface
}
$result = array();
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
// Note: in http://dev.mysql.com/doc/refman/5.0/en/faqs-triggers.html
// their example uses WHERE TRIGGER_SCHEMA='dbname' so let's use this
// instead of WHERE EVENT_OBJECT_SCHEMA='dbname'
$query = 'SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION'
. ', EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT'
. ', EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER'
. ' FROM information_schema.TRIGGERS'
. ' WHERE TRIGGER_SCHEMA= \'' . PMA_Util::sqlAddSlashes($db) . '\'';
// Note: in http://dev.mysql.com/doc/refman/5.0/en/faqs-triggers.html
// their example uses WHERE TRIGGER_SCHEMA='dbname' so let's use this
// instead of WHERE EVENT_OBJECT_SCHEMA='dbname'
$query = 'SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION'
. ', EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT'
. ', EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER'
. ' FROM information_schema.TRIGGERS'
. ' WHERE TRIGGER_SCHEMA= \'' . PMA_Util::sqlAddSlashes($db) . '\'';
if (! empty($table)) {
$query .= " AND EVENT_OBJECT_TABLE = '"
. PMA_Util::sqlAddSlashes($table) . "';";
}
} else {
$query = "SHOW TRIGGERS FROM " . PMA_Util::backquote($db);
if (! empty($table)) {
$query .= " LIKE '" . PMA_Util::sqlAddSlashes($table, true) . "';";
}
if (! empty($table)) {
$query .= " AND EVENT_OBJECT_TABLE = '"
. PMA_Util::sqlAddSlashes($table) . "';";
}
if ($triggers = $this->fetchResult($query)) {
foreach ($triggers as $trigger) {
if ($GLOBALS['cfg']['Server']['DisableIS']) {
$trigger['TRIGGER_NAME'] = $trigger['Trigger'];
$trigger['ACTION_TIMING'] = $trigger['Timing'];
$trigger['EVENT_MANIPULATION'] = $trigger['Event'];
$trigger['EVENT_OBJECT_TABLE'] = $trigger['Table'];
$trigger['ACTION_STATEMENT'] = $trigger['Statement'];
$trigger['DEFINER'] = $trigger['Definer'];
}
$one_result = array();
$one_result['name'] = $trigger['TRIGGER_NAME'];
$one_result['table'] = $trigger['EVENT_OBJECT_TABLE'];
@ -2285,7 +2206,7 @@ class PMA_DatabaseInterface
}
/**
* returns last error message or false if no errors occured
* returns last error message or false if no errors occurred
*
* @param object $link connection link
*

View File

@ -103,7 +103,10 @@ class PMA_DbSearch
if (empty($_REQUEST['criteriaSearchType'])
|| ! is_string($_REQUEST['criteriaSearchType'])
|| ! array_key_exists($_REQUEST['criteriaSearchType'], $this->_searchTypes)
|| ! array_key_exists(
$_REQUEST['criteriaSearchType'],
$this->_searchTypes
)
) {
$this->_criteriaSearchType = 1;
unset($_REQUEST['submit_search']);
@ -172,7 +175,8 @@ class PMA_DbSearch
// Gets where clause for the query
$where_clause = $this->_getWhereClause($table);
// Builds complete queries
$sql['select_columns'] = $sqlstr_select . ' * ' . $sqlstr_from . $where_clause;
$sql['select_columns'] = $sqlstr_select . ' * ' . $sqlstr_from
. $where_clause;
// 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`'
@ -418,7 +422,8 @@ class PMA_DbSearch
$html_output .= '<tr>';
$html_output .= '<td class="right vtop">' . __('Inside tables:') . '</td>';
$html_output .= '<td rowspan="2">';
$html_output .= '<select name="criteriaTables[]" size="6" multiple="multiple">';
$html_output .= '<select name="criteriaTables[]" size="6"'
. ' multiple="multiple">';
foreach ($this->_tables_names_only as $each_table) {
if (in_array($each_table, $this->_criteriaTables)) {
$is_selected = ' selected="selected"';
@ -434,18 +439,23 @@ class PMA_DbSearch
$html_output .= '</td></tr>';
// Displays 'select all' and 'unselect all' links
$alter_select = '<a href="#" '
. 'onclick="setSelectOptions(\'db_search\', \'criteriaTables[]\', true); return false;">'
. 'onclick="setSelectOptions(\'db_search\','
. ' \'criteriaTables[]\', true); return false;">'
. __('Select All') . '</a> &nbsp;/&nbsp;';
$alter_select .= '<a href="#" '
. 'onclick="setSelectOptions(\'db_search\', \'criteriaTables[]\', false); return false;">'
. 'onclick="setSelectOptions(\'db_search\','
. ' \'criteriaTables[]\', false); return false;">'
. __('Unselect All') . '</a>';
$html_output .= '<tr><td class="right vbottom">' . $alter_select . '</td></tr>';
$html_output .= '<tr><td class="right vbottom">'
. $alter_select . '</td></tr>';
// Inputbox for column name entry
$html_output .= '<tr>';
$html_output .= '<td class="right">' . __('Inside column:') . '</td>';
$html_output .= '<td><input type="text" name="criteriaColumnName" size="60"'
. 'value="'
. (! empty($this->_criteriaColumnName) ? htmlspecialchars($this->_criteriaColumnName) : '')
. (! empty($this->_criteriaColumnName)
? htmlspecialchars($this->_criteriaColumnName)
: '')
. '" /></td>';
$html_output .= '</tr>';
$html_output .= '</table>';
@ -479,8 +489,8 @@ class PMA_DbSearch
$html_output .= '</div>';
$html_output .= '<br class="clearfloat" />';
$html_output .= '<div id="sqlqueryform">';
$html_output .= '<!-- this sqlqueryform div is used to load the delete form in'
. ' the db search -->';
$html_output .= '<!-- this sqlqueryform div is used to load the delete'
. ' form in the db search -->';
$html_output .= '</div>';
$html_output .= '<!-- toggle query box link-->';
$html_output .= '<a id="togglequerybox"></a>';

View File

@ -159,7 +159,7 @@ class PMA_DisplayResults
/**
* This variable contains the column transformation information
* for some of the system databases.
* One element of this array represent all relavant columns in all tables in
* One element of this array represent all relevant columns in all tables in
* one specific database
*/
public $transformation_info;
@ -170,7 +170,7 @@ class PMA_DisplayResults
*
* @param string $property name of the property
*
* @return if property exist, value of the relavant property
* @return mixed|void if property exist, value of the relevant property
*/
public function __get($property)
{
@ -184,7 +184,7 @@ class PMA_DisplayResults
* Set values for any property of this class
*
* @param string $property name of the property
* @param any $value value to set
* @param mixed $value value to set
*
* @return void
*/
@ -252,17 +252,17 @@ class PMA_DisplayResults
if ($cfgRelation['db']) {
$this->transformation_info[$cfgRelation['db']] = array();
$relDb = &$this->transformation_info[$cfgRelation['db']];
if ($cfgRelation['history']) {
if (! empty($cfgRelation['history'])) {
$relDb[$cfgRelation['history']] = array(
'sqlquery' => $sql_highlighting_data
);
}
if ($cfgRelation['bookmark']) {
if (! empty($cfgRelation['bookmark'])) {
$relDb[$cfgRelation['bookmark']] = array(
'query' => $sql_highlighting_data
);
}
if ($cfgRelation['tracking']) {
if (! empty($cfgRelation['tracking'])) {
$relDb[$cfgRelation['tracking']] = array(
'schema_sql' => $sql_highlighting_data,
'data_sql' => $sql_highlighting_data
@ -274,28 +274,28 @@ class PMA_DisplayResults
/**
* Set properties which were not initialized at the constructor
*
* @param type $unlim_num_rows integer the total number of rows returned by
* @param integer $unlim_num_rows the total number of rows returned by
* the SQL query without any appended
* "LIMIT" clause programmatically
* @param type $fields_meta array meta information about fields
* @param type $is_count boolean
* @param type $is_export integer
* @param type $is_func boolean
* @param type $is_analyse integer
* @param type $num_rows integer total no. of rows returned by SQL query
* @param type $fields_cnt integer total no.of fields returned by SQL query
* @param type $querytime double time taken for execute the SQL query
* @param type $pmaThemeImage string path for theme images directory
* @param type $text_dir string
* @param type $is_maint boolean
* @param type $is_explain boolean
* @param type $is_show boolean
* @param type $showtable array table definitions
* @param type $printview string
* @param type $url_query string URL query
* @param type $editable boolean whether the resutls set is editable
* @param array $fields_meta meta information about fields
* @param boolean $is_count statement is SELECT COUNT
* @param integer $is_export statement contains INTO OUTFILE
* @param boolean $is_func statement contains a function like SUM()
* @param integer $is_analyse statement contains PROCEDURE ANALYSE
* @param integer $num_rows total no. of rows returned by SQL query
* @param integer $fields_cnt total no.of fields returned by SQL query
* @param double $querytime time taken for execute the SQL query
* @param string $pmaThemeImage path for theme images directory
* @param string $text_dir text direction
* @param boolean $is_maint statement contains a maintenance command
* @param boolean $is_explain statement contains EXPLAIN
* @param boolean $is_show statement contains SHOW
* @param array $showtable table definitions
* @param string $printview print view was requested
* @param string $url_query URL query
* @param boolean $editable whether the results set is editable
*
* @return void
* @return void
*
* @see sql.php
*/
@ -646,8 +646,8 @@ class PMA_DisplayResults
. '<td class="navigation_separator"></td>';
// Move to the beginning or to the previous page
if ($_SESSION['tmp_user_values']['pos']
&& ($_SESSION['tmp_user_values']['max_rows'] != self::ALL_ROWS)
if ($_SESSION['tmpval']['pos']
&& ($_SESSION['tmpval']['max_rows'] != self::ALL_ROWS)
) {
$table_navigation_html
@ -660,16 +660,16 @@ class PMA_DisplayResults
$nbTotalPage = 1;
//page redirection
// (unless we are showing all records)
if ($_SESSION['tmp_user_values']['max_rows'] != self::ALL_ROWS) { //if1
if ($_SESSION['tmpval']['max_rows'] != self::ALL_ROWS) { //if1
$pageNow = @floor(
$_SESSION['tmp_user_values']['pos']
/ $_SESSION['tmp_user_values']['max_rows']
$_SESSION['tmpval']['pos']
/ $_SESSION['tmpval']['max_rows']
) + 1;
$nbTotalPage = @ceil(
$this->__get('unlim_num_rows')
/ $_SESSION['tmp_user_values']['max_rows']
/ $_SESSION['tmpval']['max_rows']
);
if ($nbTotalPage > 1) { //if2
@ -690,7 +690,7 @@ class PMA_DisplayResults
$table_navigation_html .= PMA_Util::pageselector(
'pos',
$_SESSION['tmp_user_values']['max_rows'],
$_SESSION['tmpval']['max_rows'],
$pageNow, $nbTotalPage, 200, 5, 5, 20, 10
);
@ -712,12 +712,12 @@ class PMA_DisplayResults
} // end show all
// Move to the next page or to the last one
$endpos = $_SESSION['tmp_user_values']['pos']
+ $_SESSION['tmp_user_values']['max_rows'];
$endpos = $_SESSION['tmpval']['pos']
+ $_SESSION['tmpval']['max_rows'];
if (($endpos < $this->__get('unlim_num_rows'))
&& ($this->__get('num_rows') >= $_SESSION['tmp_user_values']['max_rows'])
&& ($_SESSION['tmp_user_values']['max_rows'] != self::ALL_ROWS)
&& ($this->__get('num_rows') >= $_SESSION['tmpval']['max_rows'])
&& ($_SESSION['tmpval']['max_rows'] != self::ALL_ROWS)
) {
$table_navigation_html
@ -853,11 +853,11 @@ class PMA_DisplayResults
/**
* Prepare move farward buttons - next and last
* Prepare move forward buttons - next and last
*
* @param string $html_sql_query the sql encoded by html special characters
* @param string $html_sql_query the sql encoded by htmlspecialchars()
* @param integer $pos_next the offset for the "next" page
* @param boolean $is_innodb whether its InnoDB or not
* @param boolean $is_innodb whether it's InnoDB or not
*
* @return string $buttons_html html content
*
@ -889,11 +889,12 @@ class PMA_DisplayResults
$input_for_real_end = $onclick = '';
}
$maxRows = $_SESSION['tmpval']['max_rows'];
$onsubmit = 'onsubmit="return '
. ($_SESSION['tmp_user_values']['pos']
+ $_SESSION['tmp_user_values']['max_rows']
. ($_SESSION['tmpval']['pos']
+ $maxRows
< $this->__get('unlim_num_rows')
&& $this->__get('num_rows') >= $_SESSION['tmp_user_values']['max_rows'])
&& $this->__get('num_rows') >= $maxRows)
? 'true'
: 'false' . '"';
@ -903,8 +904,8 @@ class PMA_DisplayResults
_pgettext('Last page', 'End'),
@((ceil(
$this->__get('unlim_num_rows')
/ $_SESSION['tmp_user_values']['max_rows']
)- 1) * $_SESSION['tmp_user_values']['max_rows']),
/ $_SESSION['tmpval']['max_rows']
)- 1) * $maxRows),
$html_sql_query, $onsubmit, $input_for_real_end, $onclick
);
@ -917,8 +918,7 @@ class PMA_DisplayResults
* Prepare fields for table navigation
* Number of rows
*
* @param string $html_sql_query the sql encoded by html special
* characters
* @param string $html_sql_query the sql encoded by htmlspecialchars()
* @param string $id_for_direction_dropdown the id for the direction dropdown
*
* @return string $additional_fields_html html content
@ -939,36 +939,34 @@ class PMA_DisplayResults
. '" />'
. '<input type="hidden" name="pos" size="3" value="'
// Do not change the position when changing the number of rows
. $_SESSION['tmp_user_values']['pos']
. '" />'
. __('Number of rows:') . ' '
. '<select name="session_max_rows" class="autosubmit">';
. $_SESSION['tmpval']['pos'] . '" />';
$numberOfRowsChoices = array(25, 50, 100, 250, 500);
foreach ($numberOfRowsChoices as $oneNumberOfRowsChoice) {
$additional_fields_html .= '<option value="'
. $oneNumberOfRowsChoice . '"';
if ($oneNumberOfRowsChoice == $_SESSION['tmp_user_values']['max_rows']) {
$additional_fields_html .= ' selected="selected"';
}
$additional_fields_html .= '>' . $oneNumberOfRowsChoice . '</option>';
}
$additional_fields_html .= '</select>';
$numberOfRowsChoices = array(
'25' => 25,
'50' => 50,
'100' => 100,
'250' => 250,
'500' => 500
);
$additional_fields_html .= __('Number of rows:') . ' ';
$additional_fields_html .= PMA_Util::getDropdown(
'session_max_rows', $numberOfRowsChoices,
$_SESSION['tmpval']['max_rows'], '', 'autosubmit'
);
if ($GLOBALS['cfg']['ShowDisplayDirection']) {
// Display mode (horizontal/vertical)
$additional_fields_html .= __('Mode:') . ' ' . "\n";
$choices = array(
'horizontal' => __('horizontal'),
'horizontalflipped' => __('horizontal (rotated headers)'),
'vertical' => __('vertical')
);
'horizontal' => __('horizontal'),
'horizontalflipped' => __('horizontal (rotated headers)'),
'vertical' => __('vertical')
);
$additional_fields_html .= PMA_Util::getDropdown(
'disp_direction', $choices,
$_SESSION['tmp_user_values']['disp_direction'],
$id_for_direction_dropdown
$_SESSION['tmpval']['disp_direction'],
$id_for_direction_dropdown, 'autosubmit'
);
unset($choices);
}
@ -981,18 +979,20 @@ class PMA_DisplayResults
/**
* Get the headers of the results table
*
* @param array &$is_display which elements to display
* @param array $analyzed_sql the analyzed query
* @param string $sort_expression sort expression
* @param string $sort_expression_nodirection sort expression without direction
* @param string $sort_direction sort direction
* @param boolean $is_limited_display with limited operations or not
* @param array &$is_display which elements to display
* @param array|string $analyzed_sql the analyzed query
* @param string $sort_expression sort expression
* @param string $sort_expression_nodirection sort expression
* without direction
* @param string $sort_direction sort direction
* @param boolean $is_limited_display with limited operations
* or not
*
* @return string html content
* @return string html content
*
* @access private
* @access private
*
* @see getTable()
* @see getTable()
*/
private function _getTableHeaders(
&$is_display, $analyzed_sql = '',
@ -1013,10 +1013,10 @@ class PMA_DisplayResults
$sql_md5 = md5($this->__get('sql_query'));
$session_max_rows = $is_limited_display
? 0
: $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'];
: $_SESSION['tmpval']['query'][$sql_md5]['max_rows'];
$direction = isset($_SESSION['tmp_user_values']['disp_direction'])
? $_SESSION['tmp_user_values']['disp_direction']
$direction = isset($_SESSION['tmpval']['disp_direction'])
? $_SESSION['tmpval']['disp_direction']
: '';
if ($analyzed_sql == '') {
@ -1095,7 +1095,7 @@ class PMA_DisplayResults
if ($GLOBALS['cfgRelation']['commwork']
&& $GLOBALS['cfgRelation']['mimework']
&& $GLOBALS['cfg']['BrowseMIME']
&& ! $_SESSION['tmp_user_values']['hide_transformation']
&& ! $_SESSION['tmpval']['hide_transformation']
) {
include_once './libraries/transformations.lib.php';
$this->__set(
@ -1396,7 +1396,7 @@ class PMA_DisplayResults
$span = $this->__get('num_rows') + 1 + floor(
$this->__get('num_rows')
/ $_SESSION['tmp_user_values']['repeat_cells']
/ $_SESSION['tmpval']['repeat_cells']
);
$button_html .= '<tr><th colspan="' . $span . '"></th></tr>';
@ -1617,9 +1617,10 @@ class PMA_DisplayResults
'F' => __('Full texts')
);
// pftext means "partial or full texts" (done to reduce line lengths)
$options_html .= PMA_Util::getRadioFields(
'display_text', $choices,
$_SESSION['tmp_user_values']['display_text']
'pftext', $choices,
$_SESSION['tmpval']['pftext']
)
. '</div>';
@ -1634,7 +1635,7 @@ class PMA_DisplayResults
$options_html .= PMA_Util::getRadioFields(
'relational_display', $choices,
$_SESSION['tmp_user_values']['relational_display']
$_SESSION['tmpval']['relational_display']
)
. '</div>';
}
@ -1642,17 +1643,17 @@ class PMA_DisplayResults
$options_html .= '<div class="formelement">'
. PMA_Util::getCheckbox(
'display_binary', __('Show binary contents'),
! empty($_SESSION['tmp_user_values']['display_binary']), false
! empty($_SESSION['tmpval']['display_binary']), false
)
. '<br />'
. PMA_Util::getCheckbox(
'display_blob', __('Show BLOB contents'),
! empty($_SESSION['tmp_user_values']['display_blob']), false
! empty($_SESSION['tmpval']['display_blob']), false
)
. '<br />'
. PMA_Util::getCheckbox(
'display_binary_as_hex', __('Show binary contents as HEX'),
! empty($_SESSION['tmp_user_values']['display_binary_as_hex']), false
! empty($_SESSION['tmpval']['display_binary_as_hex']), false
)
. '</div>';
@ -1663,7 +1664,7 @@ class PMA_DisplayResults
$options_html .= '<div class="formelement">'
. PMA_Util::getCheckbox(
'hide_transformation', __('Hide browser transformation'),
! empty($_SESSION['tmp_user_values']['hide_transformation']), false
! empty($_SESSION['tmpval']['hide_transformation']), false
)
. '</div>';
@ -1676,8 +1677,8 @@ class PMA_DisplayResults
);
$options_html .= PMA_Util::getRadioFields(
'geometry_display', $choices,
$_SESSION['tmp_user_values']['geometry_display']
'geoOption', $choices,
$_SESSION['tmpval']['geoOption']
)
. '</div>';
}
@ -1716,15 +1717,15 @@ class PMA_DisplayResults
'full_text_button' => 1
);
if ($_SESSION['tmp_user_values']['display_text'] == self::DISPLAY_FULL_TEXT) {
if ($_SESSION['tmpval']['pftext'] == self::DISPLAY_FULL_TEXT) {
// currently in fulltext mode so show the opposite link
$tmp_image_file = $this->__get('pma_theme_image') . 's_partialtext.png';
$tmp_txt = __('Partial texts');
$url_params_full_text['display_text'] = self::DISPLAY_PARTIAL_TEXT;
$url_params_full_text['pftext'] = self::DISPLAY_PARTIAL_TEXT;
} else {
$tmp_image_file = $this->__get('pma_theme_image') . 's_fulltext.png';
$tmp_txt = __('Full texts');
$url_params_full_text['display_text'] = self::DISPLAY_FULL_TEXT;
$url_params_full_text['pftext'] = self::DISPLAY_FULL_TEXT;
}
$tmp_image = '<img class="fulltext" src="' . $tmp_image_file . '" alt="'
@ -1978,6 +1979,10 @@ class PMA_DisplayResults
$new_sort_expression_nodirection = $sort_expression_nodirection;
}
//Back quotes are removed in next comparison, so remove them from value
//to compare.
$name_to_use_in_sort = str_replace('`', '', $name_to_use_in_sort);
$is_in_sort = false;
$sort_name = str_replace('`', '', $sort_tbl) . $name_to_use_in_sort;
@ -2401,7 +2406,7 @@ class PMA_DisplayResults
/**
* Adds the relavant classes.
* Adds the relevant classes.
*
* @param string $class class of table cell
* @param bool $condition_field whether to add CSS class condition
@ -2536,9 +2541,9 @@ class PMA_DisplayResults
$odd_row = true;
$directionCondition
= ($_SESSION['tmp_user_values']['disp_direction']
= ($_SESSION['tmpval']['disp_direction']
== self::DISP_DIR_HORIZONTAL)
|| ($_SESSION['tmp_user_values']['disp_direction']
|| ($_SESSION['tmpval']['disp_direction']
== self::DISP_DIR_HORIZONTAL_FLIPPED);
while ($row = $GLOBALS['dbi']->fetchRow($dt_result)) {
@ -2742,7 +2747,7 @@ class PMA_DisplayResults
$relation_class = isset($map[$meta->name]) ? 'relation' : '';
$hide_class = ($col_visib && ! $col_visib[$currentColumn]
// hide per <td> only if the display dir is not vertical
&& ($_SESSION['tmp_user_values']['disp_direction']
&& ($_SESSION['tmpval']['disp_direction']
!= self::DISP_DIR_VERTICAL))
? 'hide'
: '';
@ -2832,7 +2837,6 @@ class PMA_DisplayResults
if ($this->_isNeedToSyntaxHighlight($meta->name)
&& (trim($row[$i]) != '')
) {
$row[$i] = PMA_Util::formatSql($row[$i]);
include_once $this->transformation_info[strtolower($this->__get('db'))][strtolower($this->__get('table'))][strtolower($meta->name)][0];
$transformation_plugin = new $this->transformation_info
@ -3144,8 +3148,9 @@ class PMA_DisplayResults
// Special case 1 - when executing routines, according
// to the type of the routine, url param changes
if (!empty($row_info['routine_type'])) {
if (strtolower($row_info['routine_type']) == self::ROUTINE_PROCEDURE
|| strtolower($row_info['routine_type']) == self::ROUTINE_FUNCTION
$lowerRoutineType = strtolower($row_info['routine_type']);
if ($lowerRoutineType == self::ROUTINE_PROCEDURE
|| $lowerRoutineType == self::ROUTINE_FUNCTION
) {
$linking_url_params['edit_item'] = 1;
}
@ -3271,8 +3276,8 @@ class PMA_DisplayResults
$support_html = '';
if ((($row_no != 0) && ($_SESSION['tmp_user_values']['repeat_cells'] != 0))
&& !($row_no % $_SESSION['tmp_user_values']['repeat_cells'])
if ((($row_no != 0) && ($_SESSION['tmpval']['repeat_cells'] != 0))
&& !($row_no % $_SESSION['tmpval']['repeat_cells'])
&& $directionCondition
) {
@ -3524,7 +3529,8 @@ class PMA_DisplayResults
$class = 'data ' . $grid_edit_class . ' ' . $not_null_class . ' '
. $relation_class . ' ' . $hide_class . ' ' . $field_type_class;
if (($_SESSION['tmp_user_values']['disp_direction'] == self::DISP_DIR_VERTICAL)
$disp_direction = $_SESSION['tmpval']['disp_direction'];
if (($disp_direction == self::DISP_DIR_VERTICAL)
&& (! isset($printview) || ($printview != '1'))
) {
// the row number corresponds to a data row, not HTML table row
@ -3690,8 +3696,9 @@ class PMA_DisplayResults
// if a transform function for blob is set, none of these
// replacements will be made
if (($GLOBALS['PMA_String']->strlen($column) > $GLOBALS['cfg']['LimitChars'])
&& ($_SESSION['tmp_user_values']['display_text'] == self::DISPLAY_PARTIAL_TEXT)
$limitChars = $GLOBALS['cfg']['LimitChars'];
if (($GLOBALS['PMA_String']->strlen($column) > $limitChars)
&& ($_SESSION['tmpval']['pftext'] == self::DISPLAY_PARTIAL_TEXT)
&& ! $this->_isNeedToSyntaxHighlight(strtolower($meta->name))
) {
$column = $GLOBALS['PMA_String']->substr(
@ -3753,6 +3760,9 @@ class PMA_DisplayResults
$is_field_truncated, $analyzed_sql
) {
$pftext = $_SESSION['tmpval']['pftext'];
$limitChars = $GLOBALS['cfg']['LimitChars'];
if (! isset($column) || is_null($column)) {
$cell = $this->_buildNullDisplay($class, $condition_field, $meta);
@ -3760,7 +3770,7 @@ class PMA_DisplayResults
} elseif ($column != '') {
// Display as [GEOMETRY - (size)]
if ($_SESSION['tmp_user_values']['geometry_display'] == self::GEOMETRY_DISP_GEOM) {
if ($_SESSION['tmpval']['geoOption'] == self::GEOMETRY_DISP_GEOM) {
$geometry_text = $this->_handleNonPrintableContents(
strtoupper(self::GEOMETRY_FIELD),
@ -3772,9 +3782,7 @@ class PMA_DisplayResults
$class, $condition_field, $geometry_text
);
} elseif ($_SESSION['tmp_user_values']['geometry_display']
== self::GEOMETRY_DISP_WKT
) {
} elseif ($_SESSION['tmpval']['geoOption'] == self::GEOMETRY_DISP_WKT) {
// Prepare in Well Known Text(WKT) format.
$where_comparison = ' = ' . $column;
@ -3782,11 +3790,11 @@ class PMA_DisplayResults
// Convert to WKT format
$wktval = PMA_Util::asWKT($column);
if (($GLOBALS['PMA_String']->strlen($wktval) > $GLOBALS['cfg']['LimitChars'])
&& ($_SESSION['tmp_user_values']['display_text'] == self::DISPLAY_PARTIAL_TEXT)
if (($GLOBALS['PMA_String']->strlen($wktval) > $limitChars)
&& ($pftext == self::DISPLAY_PARTIAL_TEXT)
) {
$wktval = $GLOBALS['PMA_String']->substr(
$wktval, 0, $GLOBALS['cfg']['LimitChars']
$wktval, 0, $limitChars
) . '...';
$is_field_truncated = true;
}
@ -3801,14 +3809,14 @@ class PMA_DisplayResults
} else {
// Prepare in Well Known Binary (WKB) format.
if ($_SESSION['tmp_user_values']['display_binary']) {
if ($_SESSION['tmpval']['display_binary']) {
$where_comparison = ' = ' . $column;
$wkbval = $this->_displayBinaryAsPrintable($column, 'binary', 8);
if (($GLOBALS['PMA_String']->strlen($wkbval) > $GLOBALS['cfg']['LimitChars'])
&& ($_SESSION['tmp_user_values']['display_text'] == self::DISPLAY_PARTIAL_TEXT)
if (($GLOBALS['PMA_String']->strlen($wkbval) > $limitChars)
&& ($pftext == self::DISPLAY_PARTIAL_TEXT)
) {
$wkbval = $GLOBALS['PMA_String']->substr(
$wkbval, 0, $GLOBALS['cfg']['LimitChars']
@ -3877,6 +3885,7 @@ class PMA_DisplayResults
$is_field_truncated, $analyzed_sql, &$dt_result, $col_index
) {
$limitChars = $GLOBALS['cfg']['LimitChars'];
$is_analyse = $this->__get('is_analyse');
$field_flags = $GLOBALS['dbi']->fieldFlags($dt_result, $col_index);
if (stristr($field_flags, self::BINARY_FIELD)
@ -3894,8 +3903,8 @@ class PMA_DisplayResults
// Cut all fields to $GLOBALS['cfg']['LimitChars']
// (unless it's a link-type transformation)
if ($GLOBALS['PMA_String']->strlen($column) > $GLOBALS['cfg']['LimitChars']
&& ($_SESSION['tmp_user_values']['display_text'] == self::DISPLAY_PARTIAL_TEXT)
if ($GLOBALS['PMA_String']->strlen($column) > $limitChars
&& ($_SESSION['tmpval']['pftext'] == self::DISPLAY_PARTIAL_TEXT)
&& ! (gettype($transformation_plugin) == "object"
&& strpos($transformation_plugin->getName(), 'Link') !== false)
) {
@ -3920,7 +3929,7 @@ class PMA_DisplayResults
&& !(isset($is_analyse) && $is_analyse)
) {
if ($_SESSION['tmp_user_values']['display_binary']) {
if ($_SESSION['tmpval']['display_binary']) {
// user asked to see the real contents of BINARY
// fields
@ -4075,8 +4084,8 @@ class PMA_DisplayResults
foreach ($vertical_display['rowdata'][$key] as $subval) {
if (($cell_displayed != 0)
&& ($_SESSION['tmp_user_values']['repeat_cells'] != 0)
&& ! ($cell_displayed % $_SESSION['tmp_user_values']['repeat_cells'])
&& ($_SESSION['tmpval']['repeat_cells'] != 0)
&& ! ($cell_displayed % $_SESSION['tmpval']['repeat_cells'])
) {
$vertical_table_html .= $val;
}
@ -4193,11 +4202,11 @@ class PMA_DisplayResults
* @param string $dir _left / _right
* @param array $is_display display mode
*
* @return $checkBoxes_html html content
* @return String $checkBoxes_html html content
*
* @access private
* @access private
*
* @see _getVerticalTable()
* @see _getVerticalTable()
*/
private function _getCheckBoxesForMultipleRowOperations($dir, $is_display)
{
@ -4209,8 +4218,8 @@ class PMA_DisplayResults
foreach ($vertical_display['row_delete'] as $val) {
if (($cell_displayed != 0)
&& ($_SESSION['tmp_user_values']['repeat_cells'] != 0)
&& !($cell_displayed % $_SESSION['tmp_user_values']['repeat_cells'])
&& ($_SESSION['tmpval']['repeat_cells'] != 0)
&& !($cell_displayed % $_SESSION['tmpval']['repeat_cells'])
) {
$checkBoxes_html .= '<th'
@ -4251,8 +4260,8 @@ class PMA_DisplayResults
$sql_md5 = md5($this->__get('sql_query'));
$query = array();
if (isset($_SESSION['tmp_user_values']['query'][$sql_md5])) {
$query = $_SESSION['tmp_user_values']['query'][$sql_md5];
if (isset($_SESSION['tmpval']['query'][$sql_md5])) {
$query = $_SESSION['tmpval']['query'][$sql_md5];
}
$query['sql'] = $this->__get('sql_query');
@ -4295,16 +4304,16 @@ class PMA_DisplayResults
}
if (PMA_isValid(
$_REQUEST['display_text'],
$_REQUEST['pftext'],
array(
self::DISPLAY_PARTIAL_TEXT, self::DISPLAY_FULL_TEXT
)
)
) {
$query['display_text'] = $_REQUEST['display_text'];
unset($_REQUEST['display_text']);
} elseif (empty($query['display_text'])) {
$query['display_text'] = self::DISPLAY_PARTIAL_TEXT;
$query['pftext'] = $_REQUEST['pftext'];
unset($_REQUEST['pftext']);
} elseif (empty($query['pftext'])) {
$query['pftext'] = self::DISPLAY_PARTIAL_TEXT;
}
if (PMA_isValid(
@ -4321,17 +4330,17 @@ class PMA_DisplayResults
}
if (PMA_isValid(
$_REQUEST['geometry_display'],
$_REQUEST['geoOption'],
array(
self::GEOMETRY_DISP_WKT, self::GEOMETRY_DISP_WKB,
self::GEOMETRY_DISP_GEOM
)
)
) {
$query['geometry_display'] = $_REQUEST['geometry_display'];
unset($_REQUEST['geometry_display']);
} elseif (empty($query['geometry_display'])) {
$query['geometry_display'] = self::GEOMETRY_DISP_GEOM;
$query['geoOption'] = $_REQUEST['geoOption'];
unset($_REQUEST['geoOption']);
} elseif (empty($query['geoOption'])) {
$query['geoOption'] = self::GEOMETRY_DISP_GEOM;
}
if (isset($_REQUEST['display_binary'])) {
@ -4385,41 +4394,41 @@ class PMA_DisplayResults
// move current query to the last position, to be removed last
// so only least executed query will be removed if maximum remembered
// queries limit is reached
unset($_SESSION['tmp_user_values']['query'][$sql_md5]);
$_SESSION['tmp_user_values']['query'][$sql_md5] = $query;
unset($_SESSION['tmpval']['query'][$sql_md5]);
$_SESSION['tmpval']['query'][$sql_md5] = $query;
// do not exceed a maximum number of queries to remember
if (count($_SESSION['tmp_user_values']['query']) > 10) {
array_shift($_SESSION['tmp_user_values']['query']);
if (count($_SESSION['tmpval']['query']) > 10) {
array_shift($_SESSION['tmpval']['query']);
//echo 'deleting one element ...';
}
// populate query configuration
$_SESSION['tmp_user_values']['display_text']
= $query['display_text'];
$_SESSION['tmp_user_values']['relational_display']
$_SESSION['tmpval']['pftext']
= $query['pftext'];
$_SESSION['tmpval']['relational_display']
= $query['relational_display'];
$_SESSION['tmp_user_values']['geometry_display']
= $query['geometry_display'];
$_SESSION['tmp_user_values']['display_binary'] = isset(
$_SESSION['tmpval']['geoOption']
= $query['geoOption'];
$_SESSION['tmpval']['display_binary'] = isset(
$query['display_binary']
);
$_SESSION['tmp_user_values']['display_binary_as_hex'] = isset(
$_SESSION['tmpval']['display_binary_as_hex'] = isset(
$query['display_binary_as_hex']
);
$_SESSION['tmp_user_values']['display_blob'] = isset(
$_SESSION['tmpval']['display_blob'] = isset(
$query['display_blob']
);
$_SESSION['tmp_user_values']['hide_transformation'] = isset(
$_SESSION['tmpval']['hide_transformation'] = isset(
$query['hide_transformation']
);
$_SESSION['tmp_user_values']['pos']
$_SESSION['tmpval']['pos']
= $query['pos'];
$_SESSION['tmp_user_values']['max_rows']
$_SESSION['tmpval']['max_rows']
= $query['max_rows'];
$_SESSION['tmp_user_values']['repeat_cells']
$_SESSION['tmpval']['repeat_cells']
= $query['repeat_cells'];
$_SESSION['tmp_user_values']['disp_direction']
$_SESSION['tmpval']['disp_direction']
= $query['disp_direction'];
}
@ -4599,7 +4608,7 @@ class PMA_DisplayResults
);
// vertical output case
if ($_SESSION['tmp_user_values']['disp_direction'] == self::DISP_DIR_VERTICAL) {
if ($_SESSION['tmpval']['disp_direction'] == self::DISP_DIR_VERTICAL) {
$table_html .= $this->_getVerticalTable($analyzed_sql, $is_display);
} // end if
@ -4657,16 +4666,16 @@ class PMA_DisplayResults
private function _getOffsets()
{
if ($_SESSION['tmp_user_values']['max_rows'] == self::ALL_ROWS) {
if ($_SESSION['tmpval']['max_rows'] == self::ALL_ROWS) {
$pos_next = 0;
$pos_prev = 0;
} else {
$pos_next = $_SESSION['tmp_user_values']['pos']
+ $_SESSION['tmp_user_values']['max_rows'];
$pos_next = $_SESSION['tmpval']['pos']
+ $_SESSION['tmpval']['max_rows'];
$pos_prev = $_SESSION['tmp_user_values']['pos']
- $_SESSION['tmp_user_values']['max_rows'];
$pos_prev = $_SESSION['tmpval']['pos']
- $_SESSION['tmpval']['max_rows'];
if ($pos_prev < 0) {
$pos_prev = 0;
@ -4881,16 +4890,16 @@ class PMA_DisplayResults
$last_shown_rec = $limit_data['start'] + $total - 1;
}
} elseif (($_SESSION['tmp_user_values']['max_rows'] == self::ALL_ROWS)
} elseif (($_SESSION['tmpval']['max_rows'] == self::ALL_ROWS)
|| ($pos_next > $total)
) {
$first_shown_rec = $_SESSION['tmp_user_values']['pos'];
$first_shown_rec = $_SESSION['tmpval']['pos'];
$last_shown_rec = $total - 1;
} else {
$first_shown_rec = $_SESSION['tmp_user_values']['pos'];
$first_shown_rec = $_SESSION['tmpval']['pos'];
$last_shown_rec = $pos_next - 1;
}
@ -5017,7 +5026,7 @@ class PMA_DisplayResults
$url_query = $this->__get('url_query');
$delete_text = ($del_link == self::DELETE_ROW) ? __('Delete') : __('Kill');
if ($_SESSION['tmp_user_values']['disp_direction'] != self::DISP_DIR_VERTICAL) {
if ($_SESSION['tmpval']['disp_direction'] != self::DISP_DIR_VERTICAL) {
$links_html .= '<img class="selectallarrow" width="38" height="22"'
. ' src="' . $this->__get('pma_theme_image') . 'arrow_'
@ -5248,9 +5257,9 @@ class PMA_DisplayResults
)
. "\n";
if ($_SESSION['tmp_user_values']['display_text']) {
if ($_SESSION['tmpval']['pftext']) {
$_url_params['display_text'] = self::DISPLAY_FULL_TEXT;
$_url_params['pftext'] = self::DISPLAY_FULL_TEXT;
$results_operations_html
.= PMA_Util::linkOrButton(
@ -5265,7 +5274,7 @@ class PMA_DisplayResults
'print_view'
)
. "\n";
unset($_url_params['display_text']);
unset($_url_params['pftext']);
}
} // end displays "printable view"
}
@ -5421,25 +5430,24 @@ class PMA_DisplayResults
$result = '[' . $category;
if (is_null($content)) {
if (isset($content)) {
$size = strlen($content);
$display_size = PMA_Util::formatByteDown($size, 3, 1);
$result .= ' - '. $display_size[0] . ' ' . $display_size[1];
} else {
$result .= ' - NULL';
$size = 0;
} elseif (isset($content)) {
$size = strlen($content);
$display_size
= PMA_Util::formatByteDown($size, 3, 1);
$result .= ' - '. $display_size[0] . ' ' . $display_size[1];
}
$result .= ']';
// if we want to use a text transformation on a BLOB column
if (gettype($transformation_plugin) == "object"
&& (strpos($transformation_plugin->getMIMESubtype(), 'Octetstream')
// if we want to use a text transformation on a BLOB column
|| strpos($transformation_plugin->getMIMEtype(), 'Text') !== false)
) {
$result = $content;
@ -5457,7 +5465,7 @@ class PMA_DisplayResults
$result = $this->$default_function($result, array(), $meta);
if (stristr($meta->type, self::BLOB_FIELD)
&& $_SESSION['tmp_user_values']['display_blob']
&& $_SESSION['tmpval']['display_blob']
) {
// in this case, restart from the original $content
$result = $this->_displayBinaryAsPrintable($content, 'blob');
@ -5513,6 +5521,7 @@ class PMA_DisplayResults
$transform_options, $is_field_truncated
) {
$relational_display = $_SESSION['tmpval']['relational_display'];
$printview = $this->__get('printview');
$result = '<td class="'
. $this->_addClass(
@ -5593,7 +5602,7 @@ class PMA_DisplayResults
} else {
if ($_SESSION['tmp_user_values']['relational_display'] == self::RELATIONAL_KEY) {
if ($relational_display == self::RELATIONAL_KEY) {
// user chose "relational key" in the display options, so
// the title contains the display field
@ -5637,7 +5646,7 @@ class PMA_DisplayResults
);
} else {
if ($_SESSION['tmp_user_values']['relational_display'] == self::RELATIONAL_DISPLAY_COLUMN) {
if ($relational_display == self::RELATIONAL_DISPLAY_COLUMN) {
// user chose "relational display field" in the
// display options, so show display field in the cell
$result .= $this->$default_function($dispval);
@ -5956,12 +5965,12 @@ class PMA_DisplayResults
*
* @param string $buffer String to process
*
* @return Escaped and cleaned up text suitable for html.
* @return String Escaped and cleaned up text suitable for html.
*
* @access private
* @access private
*
* @see _getDataCellForBlobField(), _getRowData(),
* _handleNonPrintableContents()
* @see _getDataCellForBlobField(), _getRowData(),
* _handleNonPrintableContents()
*/
private function _mimeDefaultFunction($buffer)
{
@ -5984,7 +5993,7 @@ class PMA_DisplayResults
* @param string $binary_or_blob binary' or 'blob'
* @param int $hexlength optional, get substring
*
* @return Displayable version of the binary string
* @return String Displayable version of the binary string
*
* @access private
*
@ -5997,7 +6006,7 @@ class PMA_DisplayResults
) {
if ((PMA_PHP_INT_VERSION < 50400)
|| (($binary_or_blob === 'binary')
&& $_SESSION['tmp_user_values']['display_binary_as_hex']
&& $_SESSION['tmpval']['display_binary_as_hex']
&& PMA_Util::containsNonPrintableAscii($content))
) {
$content = bin2hex($content);
@ -6015,4 +6024,5 @@ class PMA_DisplayResults
return $content;
}
}
?>

View File

@ -67,14 +67,14 @@ class PMA_Error extends PMA_Message
);
/**
* The file in which the error occured
* The file in which the error occurred
*
* @var string
*/
protected $file = '';
/**
* The line in which the error occured
* The line in which the error occurred
*
* @var integer
*/

View File

@ -106,7 +106,7 @@ class PMA_Error_Handler
}
/**
* Error handler - called when errors are triggered/occured
* Error handler - called when errors are triggered/occurred
*
* This calls the addError() function, escaping the error string
*
@ -317,7 +317,7 @@ class PMA_Error_Handler
/**
* renders errors not displayed
*
* @return void
* @return string
*/
public function getDispErrors()
{
@ -404,7 +404,7 @@ class PMA_Error_Handler
}
/**
* whether use errors occured or not
* whether use errors occurred or not
*
* @return boolean
*/
@ -414,7 +414,7 @@ class PMA_Error_Handler
}
/**
* whether errors occured or not
* whether errors occurred or not
*
* @return boolean
*/

View File

@ -77,7 +77,7 @@ class PMA_File
/**
* constructor
*
* @param string $name file name
* @param boolean|string $name file name or false
*
* @access public
*/
@ -100,7 +100,7 @@ class PMA_File
}
/**
* deletes file if it is temporary, usally from a moved upload file
* deletes file if it is temporary, usually from a moved upload file
*
* @access public
* @return boolean success
@ -379,7 +379,7 @@ class PMA_File
* Checks whether there was any error.
*
* @access public
* @return boolean whether an error occured or not
* @return boolean whether an error occurred or not
*/
public function isError()
{
@ -571,7 +571,7 @@ class PMA_File
/**
* Returns the file handle
*
* @return object file handle
* @return resource file handle
*/
public function getHandle()
{

View File

@ -52,8 +52,6 @@ class PMA_Footer
/**
* Creates a new class instance
*
* @return new PMA_Footer object
*/
public function __construct()
{
@ -63,11 +61,11 @@ class PMA_Footer
}
/**
* Adds the message for demo server to error messages
* Returns the message for demo server to error messages
*
* @return string
*/
private function _addDemoMessage()
private function _getDemoMessage()
{
$message = '<a href="/">' . __('phpMyAdmin Demo Server') . '</a>: ';
if (file_exists('./revision-info.php')) {
@ -83,13 +81,7 @@ class PMA_Footer
$message .= __('Git information missing!');
}
$GLOBALS['error_handler']->addError(
$message,
E_USER_NOTICE,
'',
'',
false
);
return PMA_Message::notice($message)->getDisplay();
}
/**
@ -266,9 +258,6 @@ class PMA_Footer
if (! $this->_isAjax) {
$retval .= "</div>";
}
if ($GLOBALS['cfg']['DBG']['demo']) {
$this->_addDemoMessage();
}
if (! $this->_isAjax && ! $this->_isMinimal) {
if (PMA_getenv('SCRIPT_NAME')
&& empty($_POST)
@ -298,12 +287,19 @@ class PMA_Footer
$retval .= $this->_getDebugMessage();
$retval .= $this->getErrorMessages();
$retval .= $this->_scripts->getDisplay();
if ($GLOBALS['cfg']['DBG']['demo']) {
$retval .= '<div id="pma_demo">';
$retval .= $this->_getDemoMessage();
$retval .= '</div>';
}
// Include possible custom footers
if (file_exists(CUSTOM_FOOTER_FILE)) {
$retval .= '<div id="pma_footer">';
ob_start();
include CUSTOM_FOOTER_FILE;
$retval .= ob_get_contents();
ob_end_clean();
$retval .= '</div>';
}
}
if (! $this->_isAjax) {

View File

@ -106,8 +106,6 @@ class PMA_Header
/**
* Creates a new class instance
*
* @return new PMA_Header object
*/
public function __construct()
{
@ -165,6 +163,10 @@ class PMA_Header
}
$this->_scripts->addFile('rte.js');
if ($GLOBALS['cfg']['SendErrorReports'] !== 'never') {
$this->_scripts->addFile('tracekit/tracekit.js');
$this->_scripts->addFile('error_report.js');
}
// Here would not be a good place to add CodeMirror because
// the user preferences have not been merged at this point
@ -376,10 +378,12 @@ class PMA_Header
}
// Include possible custom headers
if (file_exists(CUSTOM_HEADER_FILE)) {
$retval .= '<div id="pma_header">';
ob_start();
include CUSTOM_HEADER_FILE;
$retval .= ob_get_contents();
ob_end_clean();
$retval .= '</div>';
}
// offer to load user preferences from localStorage
if ($this->_userprefsOfferImport) {
@ -470,6 +474,8 @@ class PMA_Header
. "img-src 'self' data: "
. $GLOBALS['cfg']['CSPAllow']
. ($https ? "" : $mapTilesUrls)
// for reCAPTCHA
. " https://www.google.com"
. ";"
);
if (PMA_USR_BROWSER_AGENT == 'SAFARI'
@ -483,6 +489,8 @@ class PMA_Header
. "img-src 'self' data: "
. $GLOBALS['cfg']['CSPAllow']
. ($https ? "" : $mapTilesUrls)
// for reCAPTCHA
. " https://www.google.com"
. ";"
);
} else {
@ -500,6 +508,8 @@ class PMA_Header
. "img-src 'self' data: "
. $GLOBALS['cfg']['CSPAllow']
. ($https ? "" : $mapTilesUrls)
// for reCAPTCHA
. " https://www.google.com"
. ";"
);
}

View File

@ -104,7 +104,7 @@ class PMA_Index
* @param string $table table name
* @param string $index_name index name
*
* @return object corresponding Index object
* @return PMA_Index corresponding Index object
*/
static public function singleton($schema, $table, $index_name = '')
{
@ -176,11 +176,12 @@ class PMA_Index
$_raw_indexes = $GLOBALS['dbi']->getTableIndexes($schema, $table);
foreach ($_raw_indexes as $_each_index) {
$_each_index['Schema'] = $schema;
if (! isset(PMA_Index::$_registry[$schema][$table][$_each_index['Key_name']])) {
$keyName = $_each_index['Key_name'];
if (! isset(PMA_Index::$_registry[$schema][$table][$keyName])) {
$key = new PMA_Index($_each_index);
PMA_Index::$_registry[$schema][$table][$_each_index['Key_name']] = $key;
PMA_Index::$_registry[$schema][$table][$keyName] = $key;
} else {
$key = PMA_Index::$_registry[$schema][$table][$_each_index['Key_name']];
$key = PMA_Index::$_registry[$schema][$table][$keyName];
}
$key->addColumn($_each_index);
@ -400,7 +401,9 @@ class PMA_Index
continue;
}
$html_options .= '<option value="' . $each_index_choice . '"'
. (($this->_choice == $each_index_choice) ? ' selected="selected"' : '')
. (($this->_choice == $each_index_choice)
? ' selected="selected"'
: '')
. '>'. $each_index_choice . '</option>' . "\n";
}
@ -891,6 +894,12 @@ class PMA_Index_Column
return $this->_seq_in_index;
}
/**
* Returns the number of indexed characters if the column is only
* partly indexed
*
* @return int the number of indexed characters
*/
public function getSubPart()
{
return $this->_sub_part;

View File

@ -24,6 +24,13 @@ abstract class PMA_List extends ArrayObject
*/
protected $item_empty = '';
/**
* PMA_List constructor
*
* @param array $array The input parameter accepts an array or an Object.
* @param int $flags Flags to control the behaviour of the ArrayObject object.
* @param string $iterator_class Specify the class that will be used for iteration of the ArrayObject object. ArrayIterator is the default class used.
*/
public function __construct(
$array = array(), $flags = 0, $iterator_class = "ArrayIterator"
) {
@ -33,7 +40,7 @@ abstract class PMA_List extends ArrayObject
/**
* returns item only if there is only one in the list
*
* @return single item
* @return PMA_List single item
*/
public function getSingleItem()
{

View File

@ -50,24 +50,16 @@ class PMA_List_Database extends PMA_List
protected $db_link_control = null;
/**
* @var boolean whether SHOW DATABASES is disabled or not
* @var boolean whether we can retrieve the list of databases
* @access protected
*/
protected $show_databases_disabled = false;
/**
* @var string command to retrieve databases from server
* @access protected
*/
protected $command = null;
protected $can_retrieve_databases = true;
/**
* Constructor
*
* @param mixed $db_link_user user database link resource|object
* @param mixed $db_link_control control database link resource|object
*
* @return void
*/
public function __construct($db_link_user = null, $db_link_control = null)
{
@ -100,27 +92,21 @@ class PMA_List_Database extends PMA_List
/**
* retrieves database list from server
*
* @param string $like_db_name usally a db_name containing wildcards
* @param string $like_db_name usually a db_name containing wildcards
*
* @return array
* @todo we could also search mysql tables if all fail?
*/
protected function retrieve($like_db_name = null)
{
if ($this->show_databases_disabled) {
if (! $this->can_retrieve_databases) {
return array();
}
$command = "SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`"
. " WHERE TRUE";
if (null !== $like_db_name) {
$command = "SHOW DATABASES LIKE '" . $like_db_name . "'";
} elseif (null === $this->command) {
$command = str_replace(
'#user#', $GLOBALS['cfg']['Server']['user'],
$GLOBALS['cfg']['Server']['ShowDatabasesCommand']
);
$this->command = $command;
} else {
$command = $this->command;
$command .= " AND `SCHEMA_NAME` LIKE '" . $like_db_name . "'";
}
$database_list = $GLOBALS['dbi']->fetchResult(
@ -130,7 +116,7 @@ class PMA_List_Database extends PMA_List
if ($GLOBALS['errno'] !== 0) {
// failed to get database list, try the control user
// (hopefully there is one and he has SHOW DATABASES right)
// (hopefully there is one and he has the necessary rights)
$this->db_link = $this->db_link_control;
$database_list = $GLOBALS['dbi']->fetchResult(
$command, null, null, $this->db_link
@ -140,10 +126,10 @@ class PMA_List_Database extends PMA_List
if ($GLOBALS['errno'] !== 0) {
// failed! we will display a warning that phpMyAdmin could not
// safely retrieve database list, the admin has to setup a control
// user or allow SHOW DATABASES
// safely retrieve database list, the admin has to setup a
// control user
$GLOBALS['error_showdatabases'] = true;
$this->show_databases_disabled = true;
$this->can_retrieve_databases = false;
}
}
@ -204,13 +190,10 @@ class PMA_List_Database extends PMA_List
continue;
}
if (! $this->show_databases_disabled) {
if ($this->can_retrieve_databases) {
$items = array_merge($items, $this->retrieve($each_only_db));
continue;
}
// @todo induce error, about not using wildcards
// with SHOW DATABASE disabled?
}
$this->exchangeArray($items);
@ -231,97 +214,5 @@ class PMA_List_Database extends PMA_List
return $this->getEmpty();
}
/**
* this is just a backup, if all is fine this can be deleted later
*
* @deprecated
* @return void
*/
protected function checkAgainstPrivTables()
{
// 1. get allowed dbs from the "mysql.db" table
// User can be blank (anonymous user)
$local_query = "
SELECT DISTINCT `Db` FROM `mysql`.`db`
WHERE `Select_priv` = 'Y'
AND `User`
IN ('"
. PMA_Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user'])
. "', '')";
$tmp_mydbs = $GLOBALS['dbi']->fetchResult(
$local_query, null, null, $GLOBALS['controllink']
);
$dblist = array();
if ($tmp_mydbs) {
// Will use as associative array of the following 2 code
// lines:
// the 1st is the only line intact from before
// correction,
// the 2nd replaces $dblist[] = $row['Db'];
// Code following those 2 lines in correction continues
// populating $dblist[], as previous code did. But it is
// now populated with actual database names instead of
// with regular expressions.
$tmp_alldbs = $GLOBALS['dbi']->query(
'SHOW DATABASES;', $GLOBALS['controllink']
);
// all databases cases - part 2
if (isset($tmp_mydbs['%'])) {
while ($tmp_row = $GLOBALS['dbi']->fetchRow($tmp_alldbs)) {
$dblist[] = $tmp_row[0];
} // end while
} else {
while ($tmp_row = $GLOBALS['dbi']->fetchRow($tmp_alldbs)) {
$tmp_db = $tmp_row[0];
if (isset($tmp_mydbs[$tmp_db]) && $tmp_mydbs[$tmp_db] == 1) {
$dblist[] = $tmp_db;
$tmp_mydbs[$tmp_db] = 0;
} elseif (! isset($dblist[$tmp_db])) {
foreach ($tmp_mydbs as $tmp_matchpattern => $tmp_value) {
// fixed bad regexp
// TODO: db names may contain characters
// that are regexp instructions
$re = '(^|(\\\\\\\\)+|[^\])';
$tmp_regex = preg_replace(
'/' . addcslashes($re, '/') . '%/',
'\\1.*',
preg_replace(
'/' . addcslashes($re, '/') . '_/',
'\\1.{1}',
$tmp_matchpattern
)
);
$tmp_regex = '/^' . addcslashes($tmp_regex, '/') . '$/';
if (preg_match($tmp_regex, $tmp_db)) {
$dblist[] = $tmp_db;
break;
}
} // end while
} // end if ... elseif ...
} // end while
} // end else
$GLOBALS['dbi']->freeResult($tmp_alldbs);
unset($tmp_mydbs);
} // end if
// 2. get allowed dbs from the "mysql.tables_priv" table
$local_query = 'SELECT DISTINCT `Db` FROM `mysql`.`tables_priv`';
$local_query .= ' WHERE `Table_priv` LIKE \'%Select%\'';
$local_query .= ' AND `User` = \'';
$local_query .= PMA_Util::sqlAddSlashes(
$GLOBALS['cfg']['Server']['user']
) . '\'';
$rs = $GLOBALS['dbi']->tryQuery($local_query, $GLOBALS['controllink']);
if ($rs && @$GLOBALS['dbi']->numRows($rs)) {
while ($row = $GLOBALS['dbi']->fetchAssoc($rs)) {
if (!in_array($row['Db'], $dblist)) {
$dblist[] = $row['Db'];
}
} // end while
$GLOBALS['dbi']->freeResult($rs);
} // end if
}
}
?>

View File

@ -44,8 +44,6 @@ class PMA_Menu
* @param int $server Server id
* @param string $db Database name
* @param string $table Table name
*
* @return New PMA_Table
*/
public function __construct($server, $db, $table)
{
@ -357,7 +355,11 @@ class PMA_Menu
}
if (! $db_is_information_schema
&& ! PMA_DRIZZLE
&& PMA_Util::currentUserHasPrivilege('TRIGGER', $this->_db, $this->_table)
&& PMA_Util::currentUserHasPrivilege(
'TRIGGER',
$this->_db,
$this->_table
)
&& ! $tbl_is_view
) {
$tabs['triggers']['link'] = 'tbl_triggers.php';

View File

@ -22,8 +22,6 @@ class PMA_OutputBuffering
/**
* Initializes class
*
* @return void
*/
private function __construct()
{
@ -119,7 +117,7 @@ class PMA_OutputBuffering
/**
* Gets buffer content
*
* @return buffer content
* @return string buffer content
*/
public function getContents()
{

View File

@ -38,7 +38,6 @@ class PMA_PDF extends TCPDF
* temporary data on filesystem (slower).
* @param boolean $pdfa If TRUE set the document to PDF/A mode.
*
* @return void
* @access public
*/
public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4',

View File

@ -47,8 +47,6 @@ class PMA_RecentTable
/**
* Creates a new instance of PMA_RecentTable
*
* @return New PMA_RecentTable
*/
public function __construct()
{
@ -60,11 +58,11 @@ class PMA_RecentTable
. PMA_Util::backquote($GLOBALS['cfg']['Server']['recent']);
}
$server_id = $GLOBALS['server'];
if (! isset($_SESSION['tmp_user_values']['recent_tables'][$server_id])) {
$_SESSION['tmp_user_values']['recent_tables'][$server_id]
if (! isset($_SESSION['tmpval']['recent_tables'][$server_id])) {
$_SESSION['tmpval']['recent_tables'][$server_id]
= isset($this->_pmaTable) ? $this->getFromDb() : array();
}
$this->tables =& $_SESSION['tmp_user_values']['recent_tables'][$server_id];
$this->tables =& $_SESSION['tmpval']['recent_tables'][$server_id];
}
/**
@ -141,11 +139,11 @@ class PMA_RecentTable
public function trim()
{
$max = max($GLOBALS['cfg']['NumRecentTables'], 0);
$trimming_occured = count($this->tables) > $max;
$trimming_occurred = count($this->tables) > $max;
while (count($this->tables) > $max) {
array_pop($this->tables);
}
return $trimming_occured;
return $trimming_occurred;
}
/**

View File

@ -92,8 +92,6 @@ class PMA_Response
/**
* Creates a new class instance
*
* @return new PMA_Response object
*/
private function __construct()
{
@ -186,7 +184,7 @@ class PMA_Response
/**
* Returns a PMA_Header object
*
* @return object
* @return PMA_Header
*/
public function getHeader()
{
@ -196,7 +194,7 @@ class PMA_Response
/**
* Returns a PMA_Footer object
*
* @return object
* @return PMA_Footer
*/
public function getFooter()
{
@ -321,8 +319,9 @@ class PMA_Response
if (empty($GLOBALS['error_message'])) {
// set current db, table and sql query in the querywindow
$query = '';
$maxChars = $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'];
if (isset($GLOBALS['sql_query'])
&& strlen($GLOBALS['sql_query']) < $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']
&& strlen($GLOBALS['sql_query']) < $maxChars
) {
$query = PMA_escapeJsString($GLOBALS['sql_query']);
}

View File

@ -67,7 +67,7 @@ class PMA_Scripts
}
}
if ($include) {
$params[] = "scripts[]=" . $value['filename'];
$scripts[] = "scripts[]=" . $value['filename'];
}
} else {
$dynamic_scripts .= "<script type='text/javascript' src='js/"
@ -76,8 +76,8 @@ class PMA_Scripts
}
$static_scripts = sprintf(
'<script type="text/javascript" '
. 'src="js/get_scripts.js.php?%s"></script>',
implode("&", $params)
. 'src="js/get_scripts.js.php%s&%s"></script>',
PMA_URL_getCommon(array(), 'none'), implode("&", $scripts)
);
return $static_scripts . $dynamic_scripts;
}

View File

@ -50,8 +50,6 @@ class PMA_ServerStatusData
/**
* Constructor
*
* @return object
*/
public function __construct()
{

View File

@ -138,7 +138,7 @@ class PMA_StorageEngine
*
* @param string $engine The engine ID
*
* @return object The engine plugin
* @return PMA_StorageEngine The engine plugin
*/
static public function getEngine($engine)
{

View File

@ -74,7 +74,7 @@ class PMA_StringMB implements PMA_StringByte
}
/**
* Get the ordinal value of a multibyte string
* Get the ordinal value of a multibyte string
* (Adapted from http://www.php.net/manual/en/function.ord.php#72463)
*
* @param string $string the string for which ord is required
@ -84,9 +84,9 @@ class PMA_StringMB implements PMA_StringByte
public function ord($string)
{
$str = mb_convert_encoding($string, "UCS-4BE", "UTF-8");
$substr = mb_substr($str, 0, 1, "UCS-4BE");
$val = unpack("N", $substr);
return $val[1];
$substr = mb_substr($str, 0, 1, "UCS-4BE");
$val = unpack("N", $substr);
return $val[1];
}
}
?>

View File

@ -57,7 +57,7 @@ class PMA_Table
var $uiprefs;
/**
* @var array errors occured
* @var array errors occurred
*/
var $errors = array();
@ -92,7 +92,7 @@ class PMA_Table
/**
* return the last error
*
* @return the last error
* @return string the last error
*/
function getLastError()
{
@ -102,7 +102,7 @@ class PMA_Table
/**
* return the last message
*
* @return the last message
* @return string the last message
*/
function getLastMessage()
{
@ -182,7 +182,7 @@ class PMA_Table
* @param string $db database
* @param string $table table
*
* @return whether the given is a view
* @return boolean whether the given is a view
*/
static public function isView($db = null, $table = null)
{
@ -192,7 +192,6 @@ class PMA_Table
// use cached data or load information with SHOW command
if (isset(PMA_Table::$cache[$db][$table])
|| $GLOBALS['cfg']['Server']['DisableIS']
) {
$type = PMA_Table::sGetStatusInfo($db, $table, 'TABLE_TYPE');
return $type == 'VIEW';
@ -267,7 +266,9 @@ class PMA_Table
}
} else {
$show_create_table = $GLOBALS['dbi']->fetchValue(
'SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table),
'SHOW CREATE TABLE '
. PMA_Util::backquote($db)
. '.' . PMA_Util::backquote($table),
0,
1
);
@ -373,7 +374,12 @@ class PMA_Table
$disable_error = true;
}
if (! isset(PMA_Table::$cache[$db][$table]) || $force_read) {
if (! isset(PMA_Table::$cache[$db][$table])
|| $force_read
// sometimes there is only one entry (ExactRows) so
// we have to get the table's details
|| count(PMA_Table::$cache[$db][$table]) == 1
) {
$GLOBALS['dbi']->getTablesFull($db, $table);
}
@ -487,7 +493,8 @@ class PMA_Table
. PMA_Util::sqlAddSlashes($default_value) . '\'';
}
} else {
$query .= ' DEFAULT \'' . PMA_Util::sqlAddSlashes($default_value) . '\'';
$query .= ' DEFAULT \''
. PMA_Util::sqlAddSlashes($default_value) . '\'';
}
break;
case 'NULL' :
@ -739,12 +746,13 @@ class PMA_Table
$new_table_query = 'INSERT IGNORE INTO '
. PMA_Util::backquote($GLOBALS['cfgRelation']['db'])
. '.' . PMA_Util::backquote($GLOBALS['cfgRelation'][$pma_table]) . '
(' . implode(', ', $select_parts) . ',
' . implode(', ', $new_parts) . ')
VALUES
(\'' . implode('\', \'', $value_parts) . '\',
\'' . implode('\', \'', $new_value_parts) . '\')';
. '.'
. PMA_Util::backquote($GLOBALS['cfgRelation'][$pma_table])
. ' (' . implode(', ', $select_parts)
. ', ' . implode(', ', $new_parts)
. ') VALUES (\''
. implode('\', \'', $value_parts) . '\', \''
. implode('\', \'', $new_value_parts) . '\')';
PMA_queryAsControlUser($new_table_query);
$last_id = $GLOBALS['dbi']->insertId();
@ -1038,13 +1046,19 @@ class PMA_Table
// Get all comments and MIME-Types for current table
$comments_copy_rs = PMA_queryAsControlUser(
'SELECT column_name, comment'
. ($GLOBALS['cfgRelation']['mimework'] ? ', mimetype, transformation, transformation_options' : '')
. ' FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db'])
. '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['column_info'])
. ($GLOBALS['cfgRelation']['mimework']
? ', mimetype, transformation, transformation_options'
: '')
. ' FROM '
. PMA_Util::backquote($GLOBALS['cfgRelation']['db'])
. '.'
. PMA_Util::backquote($GLOBALS['cfgRelation']['column_info'])
. ' WHERE '
. ' db_name = \'' . PMA_Util::sqlAddSlashes($source_db) . '\''
. ' db_name = \''
. PMA_Util::sqlAddSlashes($source_db) . '\''
. ' AND '
. ' table_name = \'' . PMA_Util::sqlAddSlashes($source_table) . '\''
. ' table_name = \''
. PMA_Util::sqlAddSlashes($source_table) . '\''
);
// Write every comment as new copied entry. [MIME]
@ -1512,15 +1526,15 @@ class PMA_Table
{
$server_id = $GLOBALS['server'];
// set session variable if it's still undefined
if (! isset($_SESSION['tmp_user_values']['table_uiprefs'][$server_id][$this->db_name][$this->name])) {
if (! isset($_SESSION['tmpval']['table_uiprefs'][$server_id][$this->db_name][$this->name])) {
// check whether we can get from pmadb
$_SESSION['tmp_user_values']['table_uiprefs'][$server_id][$this->db_name][$this->name]
$_SESSION['tmpval']['table_uiprefs'][$server_id][$this->db_name][$this->name]
= (strlen($GLOBALS['cfg']['Server']['pmadb'])
&& strlen($GLOBALS['cfg']['Server']['table_uiprefs']))
? $this->getUiPrefsFromDb()
: array();
}
$this->uiprefs =& $_SESSION['tmp_user_values']['table_uiprefs'][$server_id]
$this->uiprefs =& $_SESSION['tmpval']['table_uiprefs'][$server_id]
[$this->db_name][$this->name];
}
@ -1550,7 +1564,11 @@ class PMA_Table
$avail_columns = $this->getColumns();
foreach ($avail_columns as $each_col) {
// check if $each_col ends with $colname
if (substr_compare($each_col, $colname, strlen($each_col) - strlen($colname)) === 0) {
if (substr_compare(
$each_col,
$colname,
strlen($each_col) - strlen($colname)
) === 0) {
return $this->uiprefs[$property];
}
}
@ -1567,7 +1585,10 @@ class PMA_Table
&& isset($this->uiprefs[$property])
) {
// check if the table has not been modified
if (self::sGetStatusInfo($this->db_name, $this->name, 'Create_time') == $this->uiprefs['CREATE_TIME']) {
if (self::sGetStatusInfo(
$this->db_name,
$this->name, 'Create_time'
) == $this->uiprefs['CREATE_TIME']) {
return $this->uiprefs[$property];
} else {
// remove the property, since the table has been modified

View File

@ -171,7 +171,7 @@ class PMA_TableSearch
/**
* Sets the table header for displaying a table in query-by-example format.
*
* @return HTML content, the tags and content for table header
* @return string HTML content, the tags and content for table header
*/
private function _getTableHeader()
{
@ -227,11 +227,12 @@ class PMA_TableSearch
* @param int $column_index Column's index
* @param bool $in_fbs Whether we are in 'function based search'
*
* @return HTML elements.
* @return string HTML elements.
*/
private function _getGeometricalInputBox($column_index, $in_fbs)
{
$html_output = '<input type="text" name="criteriaValues[' . $column_index . ']"'
$html_output = '<input type="text" name="criteriaValues['
. $column_index . ']"'
. ' size="40" class="textfield" id="field_' . $column_index . '" />';
if ($in_fbs) {
@ -259,7 +260,7 @@ class PMA_TableSearch
* @param string $column_id Column's inputbox's id
* @param bool $in_zoom_search_edit Whether we are in zoom search edit
*
* @return HTML elements.
* @return string HTML elements.
*/
private function _getForeignKeyInputBox($foreignData, $column_name,
$column_index, $titles, $foreignMaxLimit, $criteriaValues, $column_id,
@ -276,7 +277,8 @@ class PMA_TableSearch
$html_output .= '</select>';
} elseif ($foreignData['foreign_link'] == true) {
$html_output .= '<input type="text" id="' . $column_id . $column_index . '"'
$html_output .= '<input type="text" id="' . $column_id
. $column_index . '"'
. ' name="criteriaValues[' . $column_index . ']" id="field_'
. md5($column_name) . '[' . $column_index .']" class="textfield"'
. (isset($criteriaValues[$column_index])
@ -309,7 +311,7 @@ EOT;
* @param string $column_id Column's inputbox's id
* @param bool $in_zoom_search_edit Whether we are in zoom search edit
*
* @return HTML elements.
* @return string HTML elements.
*/
private function _getEnumSetInputBox($column_index, $criteriaValues,
$column_type, $column_id, $in_zoom_search_edit = false
@ -500,7 +502,8 @@ EOT;
// If the function takes two parameters
// create gis data from the criteria input
$gis_data = PMA_Util::createGISData($criteriaValues);
$where = $geom_func . '(' . PMA_Util::backquote($names) . ',' . $gis_data . ')';
$where = $geom_func . '(' . PMA_Util::backquote($names)
. ',' . $gis_data . ')';
return $where;
}
@ -576,27 +579,52 @@ EOT;
$criteriaValues = '^' . $criteriaValues . '$';
}
if ($func_type == 'IN (...)'
|| $func_type == 'NOT IN (...)'
|| $func_type == 'BETWEEN'
|| $func_type == 'NOT BETWEEN'
if ('IN (...)' == $func_type
|| 'NOT IN (...)' == $func_type
|| 'BETWEEN' == $func_type
|| 'NOT BETWEEN' == $func_type
) {
$func_type = str_replace(' (...)', '', $func_type);
//Don't explode if this is already an array
//(Case for (NOT) IN/BETWEEN.)
if (is_array($criteriaValues)) {
$values = $criteriaValues;
} else {
$values = explode(',', $criteriaValues);
}
// quote values one by one
$values = explode(',', $criteriaValues);
foreach ($values as &$value) {
$emptyKey = false;
foreach ($values as $key => &$value) {
if ('' === $value) {
$emptyKey = $key;
$value = 'NULL';
continue;
}
$value = $quot . PMA_Util::sqlAddSlashes(trim($value))
. $quot;
}
if ($func_type == 'BETWEEN' || $func_type == 'NOT BETWEEN') {
if ('BETWEEN' == $func_type || 'NOT BETWEEN' == $func_type) {
$where = $backquoted_name . ' ' . $func_type . ' '
. (isset($values[0]) ? $values[0] : '')
. ' AND ' . (isset($values[1]) ? $values[1] : '');
} else {
$where = $backquoted_name . ' ' . $func_type
. ' (' . implode(',', $values) . ')';
} else { //[NOT] IN
if (false !== $emptyKey) {
unset($values[$emptyKey]);
}
$wheres = array();
if (!empty($values)) {
$wheres[] = $backquoted_name . ' ' . $func_type
. ' (' . implode(',', $values) . ')';
}
if (false !== $emptyKey) {
$wheres[] = $backquoted_name . ' IS NULL';
}
$where = implode(' OR ', $wheres);
if (1 < count($wheres)) {
$where = '(' . $where . ')';
}
}
} else {
if ($func_type == 'LIKE %...%' || $func_type == 'LIKE') {
@ -677,7 +705,9 @@ EOT;
// else continue to form the where clause from column criteria values
$fullWhereClause = $charsets = array();
reset($_POST['criteriaColumnOperators']);
while (list($column_index, $operator) = each($_POST['criteriaColumnOperators'])) {
while (list($column_index, $operator) = each(
$_POST['criteriaColumnOperators']
)) {
list($charsets[$column_index]) = explode(
'_', $_POST['criteriaColumnCollations'][$column_index]
);
@ -780,7 +810,8 @@ EOT;
. '</option>' . "\n";
} // end for
$html_output .= '</select>'
. '<input type="checkbox" name="distinct" value="DISTINCT" id="oDistinct" />'
. '<input type="checkbox" name="distinct" value="DISTINCT"'
. ' id="oDistinct" />'
. '<label for="oDistinct">DISTINCT</label></fieldset>';
/**
@ -853,8 +884,10 @@ EOT;
&& $dataLabel == htmlspecialchars($this->_columnNames[$j])
) {
$html_output .= '<option value="'
. htmlspecialchars($this->_columnNames[$j]) . '" selected="selected">'
. htmlspecialchars($this->_columnNames[$j]) . '</option>';
. htmlspecialchars($this->_columnNames[$j])
. '" selected="selected">'
. htmlspecialchars($this->_columnNames[$j])
. '</option>';
} else {
$html_output .= '<option value="'
. htmlspecialchars($this->_columnNames[$j]) . '" >'
@ -901,7 +934,9 @@ EOT;
$type = $this->_columnTypes[$column_index];
$collation = $this->_columnCollations[$column_index];
//Gets column's comparison operators depending on column type
$func = '<select name="criteriaColumnOperators[' . $search_index . ']">';
$func = '<select name="criteriaColumnOperators['
. $search_index . ']" onchange="changeValueFieldType(this, '
. $search_index . ')">';
$func .= $GLOBALS['PMA_Types']->getTypeOperatorsHtml(
preg_replace('@\(.*@s', '', $this->_columnTypes[$column_index]),
$this->_columnNullFlags[$column_index], $selected_operator
@ -934,8 +969,14 @@ EOT;
$odd_row = true;
$html_output = '';
// for every column present in table
for ($column_index = 0; $column_index < count($this->_columnNames); $column_index++) {
$html_output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
for (
$column_index = 0;
$column_index < count($this->_columnNames);
$column_index++
) {
$html_output .= '<tr class="noclick '
. ($odd_row ? 'odd' : 'even')
. '">';
$odd_row = !$odd_row;
//If 'Function' column is present
$html_output .= $this->_getGeomFuncHtml($column_index);
@ -989,7 +1030,9 @@ EOT;
$html_output .= __("Additional search criteria");
$html_output .= '</td></tr>';
}
$html_output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
$html_output .= '<tr class="noclick '
. ($odd_row ? 'odd' : 'even')
. '">';
$odd_row = ! $odd_row;
//Select options for column names
$html_output .= '<th><select name="criteriaColumnNames[]" id="'
@ -1001,8 +1044,10 @@ EOT;
&& $_POST['criteriaColumnNames'][$i] == htmlspecialchars($this->_columnNames[$j])
) {
$html_output .= '<option value="'
. htmlspecialchars($this->_columnNames[$j]) . '" selected="selected">'
. htmlspecialchars($this->_columnNames[$j]) . '</option>';
. htmlspecialchars($this->_columnNames[$j])
. '" selected="selected">'
. htmlspecialchars($this->_columnNames[$j])
. '</option>';
} else {
$html_output .= '<option value="'
. htmlspecialchars($this->_columnNames[$j]) . '">'
@ -1035,7 +1080,8 @@ EOT;
$html_output .= '</tr>';
//Displays hidden fields
$html_output .= '<tr><td>';
$html_output .= '<input type="hidden" name="criteriaColumnTypes[' . $i . ']"'
$html_output
.= '<input type="hidden" name="criteriaColumnTypes[' . $i . ']"'
. ' id="types_' . $i . '" ';
if (isset($_POST['criteriaColumnTypes'][$i])) {
$html_output .= 'value="' . $_POST['criteriaColumnTypes'][$i] . '" ';
@ -1199,13 +1245,17 @@ EOT;
public function getZoomResultsForm($goto, $data)
{
$html_output = '';
$titles['Browse'] = PMA_Util::getIcon('b_browse.png', __('Browse foreign values'));
$titles['Browse'] = PMA_Util::getIcon(
'b_browse.png',
__('Browse foreign values')
);
$html_output .= '<form method="post" action="tbl_zoom_select.php"'
. ' name="displayResultForm" id="zoom_display_form"'
. ' class="ajax"' . '>';
$html_output .= PMA_URL_getHiddenInputs($this->_db, $this->_table);
$html_output .= '<input type="hidden" name="goto" value="' . $goto . '" />';
$html_output .= '<input type="hidden" name="back" value="tbl_zoom_select.php" />';
$html_output
.= '<input type="hidden" name="back" value="tbl_zoom_select.php" />';
$html_output .= '<fieldset id="displaySection">';
$html_output .= '<legend>' . __('Browse/Edit the points') . '</legend>';
@ -1237,16 +1287,29 @@ EOT;
$html_output .= '<tbody>';
$odd_row = true;
for ($column_index = 0; $column_index < count($this->_columnNames); $column_index++) {
for (
$column_index = 0;
$column_index < count($this->_columnNames);
$column_index++
) {
$fieldpopup = $this->_columnNames[$column_index];
$foreignData = PMA_getForeignData($this->_foreigners, $fieldpopup, false, '', '');
$html_output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
$foreignData = PMA_getForeignData(
$this->_foreigners,
$fieldpopup,
false,
'',
''
);
$html_output
.= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
$odd_row = ! $odd_row;
//Display column Names
$html_output .= '<th>' . htmlspecialchars($this->_columnNames[$column_index])
$html_output
.= '<th>' . htmlspecialchars($this->_columnNames[$column_index])
. '</th>';
//Null checkbox if column can be null
$html_output .= '<th>' . (($this->_columnNullFlags[$column_index] == 'YES')
$html_output .= '<th>'
. (($this->_columnNullFlags[$column_index] == 'YES')
? '<input type="checkbox" class="checkbox_null"'
. ' name="criteriaColumnNullFlags[' . $column_index . ']"'
. ' id="edit_fields_null_id_' . $column_index . '" />'
@ -1271,7 +1334,7 @@ EOT;
/**
* Displays the 'Find and Replace' form
*
* @return HTML for 'Find and Replace' form
* @return string HTML for 'Find and Replace' form
*/
function _getSearchAndReplaceHTML()
{
@ -1301,7 +1364,7 @@ EOT;
* @param string $replaceWith string to replace with
* @param string $charSet character set of the connection
*
* @return HTML for prviewing strings found and their replacements
* @return string HTML for prviewing strings found and their replacements
*/
function getReplacePreview($columnIndex, $find, $replaceWith, $charSet)
{

View File

@ -122,7 +122,7 @@ class PMA_Theme
*
* @param string $folder path to theme
*
* @return object PMA_Theme
* @return PMA_Theme|false
* @static
* @access public
*/

View File

@ -61,7 +61,6 @@ class PMA_Theme_Manager
* Constructor for Theme Manager class
*
* @access public
* @return void
*/
public function __construct()
{
@ -114,7 +113,7 @@ class PMA_Theme_Manager
* Initialise the class
*
* @access public
* @return void
* @return boolean|void
*/
public function init()
{
@ -426,7 +425,7 @@ class PMA_Theme_Manager
/**
* returns PMA_Theme object for fall back theme
*
* @return object PMA_Theme
* @return PMA_Theme fall back theme
* @access public
*/
public function getFallBackTheme()

View File

@ -272,6 +272,29 @@ class PMA_Types
'DATE',
);
}
/**
* Returns an array of integer types
*
* @return string[] integer types
*/
public function getIntegerTypes()
{
return array();
}
/**
* Returns the min and max values of a given integer type
*
* @param string $type integer type
* @param boolean $signed whether signed
*
* @return string[] min and max values
*/
public function getIntegerRange($type, $signed = true)
{
return array('', '');
}
}
/**
@ -685,6 +708,48 @@ class PMA_Types_MySQL extends PMA_Types
return $ret;
}
/**
* Returns an array of integer types
*
* @return string[] integer types
*/
public function getIntegerTypes()
{
return array('tinyint', 'smallint', 'mediumint', 'int', 'bigint');
}
/**
* Returns the min and max values of a given integer type
*
* @param string $type integer type
* @param boolean $signed whether signed
*
* @return string[] min and max values
*/
public function getIntegerRange($type, $signed = true)
{
static $min_max_data = array(
'unsigned' => array(
'tinyint' => array('0', '255'),
'smallint' => array('0', '65535'),
'mediumint' => array('0', '16777215'),
'int' => array('0', '4294967295'),
'bigint' => array('0', '18446744073709551615')
),
'signed' => array(
'tinyint' => array('-128', '127'),
'smallint' => array('-32768', '32767'),
'mediumint' => array('-8388608', '8388607'),
'int' => array('-2147483648', '2147483647'),
'bigint' => array('-9223372036854775808', '9223372036854775807')
)
);
$relevantArray = $signed
? $min_max_data['signed']
: $min_max_data['unsigned'];
return isset($relevantArray[$type]) ? $relevantArray[$type] : array('', '');
}
}
/**
@ -983,4 +1048,31 @@ class PMA_Types_Drizzle extends PMA_Types
return $ret;
}
/**
* Returns an array of integer types
*
* @return string[] integer types
*/
public function getIntegerTypes()
{
return array('integer', 'bigint');
}
/**
* Returns the min and max values of a given integer type
*
* @param string $type integer type
* @param boolean $signed whether signed (ignored for Drizzle)
*
* @return string[] min and max values
*/
public function getIntegerRange($type, $signed = true)
{
static $min_max_data = array(
'integer' => array('-2147483648', '2147483647'),
'bigint' => array('-9223372036854775808', '9223372036854775807')
);
return isset($min_max_data[$type]) ? $min_max_data[$type] : array('', '');
}
}

View File

@ -389,9 +389,9 @@ class PMA_Util
* @param string $sql_query raw SQL string
* @param boolean $truncate truncate the query if it is too long
*
* @return string the formatted sql
* @return string the formatted sql
*
* @global array the configuration array
* @global array $cfg the configuration array
*
* @access public
* @todo move into PMA_Sql
@ -408,9 +408,9 @@ class PMA_Util
$cfg['MaxCharactersInDisplayedSQL']
) . '[...]';
}
return '<span class="inner_sql"><pre>' . "\n"
return '<code class="sql"><pre>' . "\n"
. htmlspecialchars($sql_query) . "\n"
. '</pre></span>';
. '</pre></code>';
} // end of the "formatSql()" function
/**
@ -596,10 +596,10 @@ class PMA_Util
*
* @return mixed
*
* @global string the curent table
* @global string the current db
* @global string $table the curent table
* @global string $db the current db
*
* @access public
* @access public
*/
public static function mysqlDie(
$error_message = '', $the_query = '',
@ -1279,7 +1279,7 @@ class PMA_Util
if (! empty($GLOBALS['validatequery'])) {
$retval .= '<div class="sqlvalidate">';
} else {
$retval .= '<code class="sql">';
$retval .= '<div class="sqlOuter">';
}
if ($query_too_big) {
$retval .= $shortened_query_base;
@ -1291,11 +1291,7 @@ class PMA_Util
if (! empty($GLOBALS['show_as_php'])) {
$retval .= '";';
}
if (! empty($GLOBALS['validatequery'])) {
$retval .= '</div>';
} else {
$retval .= '</code>';
}
$retval .= '</div>';
$retval .= '<div class="tools">';
$retval .= '<form action="sql.php" method="post">';
@ -2051,10 +2047,10 @@ class PMA_Util
*
* @return void
*
* @global string path to current script
* @global boolean flag whether any special variable was required
* @global boolean $checked_special flag whether any special variable
* was required
*
* @access public
* @access public
*/
public static function checkParameters($params, $request = true)
{
@ -2096,7 +2092,7 @@ class PMA_Util
* @param array $row current row
* @param boolean $force_unique generate condition only on pk or unique
*
* @access public
* @access public
*
* @return array the calculated condition and whether condition is unique
*/
@ -2610,7 +2606,7 @@ class PMA_Util
* @param string $minimum_version of this component
* @param string $bugref bug reference for this component
*
* @return void
* @return String
*/
public static function getExternalBug(
$functionality, $component, $minimum_version, $bugref
@ -2708,15 +2704,20 @@ class PMA_Util
* @param string $id id of the select element; can be different in
* case the dropdown is present more than once
* on the page
* @param string $class class for the select element
*
* @return string html content
*
* @todo support titles
*/
public static function getDropdown($select_name, $choices, $active_choice, $id)
{
$result = '<select name="' . htmlspecialchars($select_name) . '" id="'
. htmlspecialchars($id) . '">';
public static function getDropdown(
$select_name, $choices, $active_choice, $id, $class = ''
) {
$result = '<select'
. ' name="' . htmlspecialchars($select_name) . '"'
. ' id="' . htmlspecialchars($id) . '"'
. (! empty($class) ? ' class="' . htmlspecialchars($class) . '"' : '')
. '>';
foreach ($choices as $one_choice_value => $one_choice_label) {
$result .= '<option value="' . htmlspecialchars($one_choice_value) . '"';
@ -2912,19 +2913,41 @@ class PMA_Util
* Converts a bit value to printable format;
* in MySQL a BIT field can be from 1 to 64 bits so we need this
* function because in PHP, decbin() supports only 32 bits
* on 32-bit servers
*
* @param numeric $value coming from a BIT field
* @param number $value coming from a BIT field
* @param integer $length length
*
* @return string the printable value
*/
public static function printableBitValue($value, $length)
{
$printable = '';
for ($i = 0, $len_ceiled = ceil($length / 8); $i < $len_ceiled; $i++) {
$printable .= sprintf('%08d', decbin(ord(substr($value, $i, 1))));
// if running on a 64-bit server or the length is safe for decbin()
if (PHP_INT_SIZE == 8 || $length < 33) {
$printable = decbin($value);
} else {
// FIXME: does not work for the leftmost bit of a 64-bit value
$i = 0;
$printable = '';
while ($value >= pow(2, $i)) {
$i++;
}
if ($i != 0) {
$i = $i - 1;
}
while ($i >= 0) {
if ($value - pow(2, $i) < 0) {
$printable = '0' . $printable;
} else {
$printable = '1' . $printable;
$value = $value - pow(2, $i);
}
$i--;
}
$printable = strrev($printable);
}
$printable = substr($printable, -$length);
$printable = str_pad($printable, $length, '0', STR_PAD_LEFT);
return $printable;
}
@ -3178,14 +3201,14 @@ class PMA_Util
* Formats user string, expanding @VARIABLES@, accepting strftime format
* string.
*
* @param string $string Text where to do expansion.
* @param function $escape Function to call for escaping variable values.
* @param string $string Text where to do expansion.
* @param array|string $escape Function to call for escaping variable values.
* Can also be an array of:
* - the escape method name
* - the class that contains the method
* - location of the class (for inclusion)
* @param array $updates Array with overrides for default parameters
* (obtained from GLOBALS).
* @param array $updates Array with overrides for default parameters
* (obtained from GLOBALS).
*
* @return string
*/
@ -3285,7 +3308,7 @@ class PMA_Util
*
* @param string $max_upload_size maximum upload size
*
* @return void
* @return String
*/
public static function getBrowseUploadFileBlock($max_upload_size)
{
@ -3315,7 +3338,7 @@ class PMA_Util
* @param array $import_list array of import plugins
* @param string $uploaddir upload directory
*
* @return void
* @return String
*/
public static function getSelectUploadFileBlock($import_list, $uploaddir)
{
@ -3804,7 +3827,7 @@ class PMA_Util
$username .= str_replace("'", "''", $user[1]);
$username .= "''";
// Prepage the query
// Prepare the query
$query = "SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`%s` "
. "WHERE GRANTEE='%s' AND PRIVILEGE_TYPE='%s'";
@ -3823,9 +3846,19 @@ class PMA_Util
// If a database name was provided and user does not have the
// required global privilege, try database-wise permissions.
if ($db !== null) {
// need to escape wildcards in db and table names, see bug #3518484
// need to escape wildcards in db and table names, see bug #3566
// (wildcard characters appear as being quoted with a backslash
// when querying TABLE_SCHEMA.SCHEMA_PRIVILEGES)
$db = str_replace(array('%', '_'), array('\%', '\_'), $db);
$query .= " AND TABLE_SCHEMA='%s'";
/*
* This is to take into account a wildcard db privilege
* so we replace % by .* and _ by . to be able to compare
* with REGEXP.
*
* Also, we need to double the inner % to please sprintf().
*/
$query .= " AND '%s' REGEXP"
. " REPLACE(REPLACE(TABLE_SCHEMA, '_', '.'), '%%', '.*')";
$schema_privileges = $GLOBALS['dbi']->fetchValue(
sprintf(
$query,
@ -3893,7 +3926,7 @@ class PMA_Util
*
* @param string $limit_clause limit clause
*
* @return array Start and length attributes of the limit clause
* @return array|void Start and length attributes of the limit clause
*/
public static function analyzeLimitClause($limit_clause)
{
@ -3915,7 +3948,7 @@ class PMA_Util
/**
* Prepare HTML code for display button.
*
* @return void
* @return String
*/
public static function getButton()
{
@ -4133,7 +4166,7 @@ class PMA_Util
/**
* Returns information with latest version from phpmyadmin.net
*
* @return JSON decoded object with the data
* @return String JSON decoded object with the data
*/
public static function getLatestVersion()
{
@ -4161,12 +4194,12 @@ class PMA_Util
'timeout' => $connection_timeout,
)
);
if (strlen($cfg['VersionCheckProxyUrl'])) {
$context['http']['proxy'] = $cfg['VersionCheckProxyUrl'];
if (strlen($cfg['VersionCheckProxyUser'])) {
if (strlen($cfg['ProxyUrl'])) {
$context['http']['proxy'] = $cfg['ProxyUrl'];
if (strlen($cfg['ProxyUser'])) {
$auth = base64_encode(
$cfg['VersionCheckProxyUser'] . ':'
. $cfg['VersionCheckProxyPass']
$cfg['ProxyUser'] . ':'
. $cfg['ProxyPass']
);
$context['http']['header']
= 'Proxy-Authorization: Basic ' . $auth;
@ -4179,18 +4212,18 @@ class PMA_Util
);
} else if (function_exists('curl_init')) {
$curl_handle = curl_init($file);
if (strlen($cfg['VersionCheckProxyUrl'])) {
if (strlen($cfg['ProxyUrl'])) {
curl_setopt(
$curl_handle,
CURLOPT_PROXY,
$cfg['VersionCheckProxyUrl']
$cfg['ProxyUrl']
);
if (strlen($cfg['VersionCheckProxyUser'])) {
if (strlen($cfg['ProxyUser'])) {
curl_setopt(
$curl_handle,
CURLOPT_PROXYUSERPWD,
$cfg['VersionCheckProxyUser']
. ':' . $cfg['VersionCheckProxyPass']
$cfg['ProxyUser']
. ':' . $cfg['ProxyPass']
);
}
}
@ -4314,4 +4347,5 @@ class PMA_Util
}
}
}
?>

View File

@ -10,7 +10,23 @@
* @package bfShapeFiles
* @version 0.0.2
* @link http://bfshapefiles.sourceforge.net/
* @license http://www.gnu.org/copyleft/gpl.html GPLv2
* @license http://www.gnu.org/licenses/gpl-2.0.html GPLv2-or-later
*
* Copyright 2006-2007 Ovidio <ovidio AT users.sourceforge.net>
*
* 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.
*
* 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, you can download one from
* http://www.gnu.org/copyleft/gpl.html.
*
*/
function loadData($type, $data) {
if (!$data) return $data;

View File

@ -49,7 +49,7 @@ function PMA_Bookmark_getParams()
*
* @access public
*
* @global resource the controluser db connection handle
* @global resource $controllink the controluser db connection handle
*/
function PMA_Bookmark_getList($db)
{
@ -105,7 +105,7 @@ function PMA_Bookmark_getList($db)
*
* @access public
*
* @global resource the controluser db connection handle
* @global resource $controllink the controluser db connection handle
*
*/
function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = false,
@ -148,7 +148,7 @@ function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = fal
*
* @access public
*
* @global resource the controluser db connection handle
* @global resource $controllink the controluser db connection handle
*/
function PMA_Bookmark_save($bkm_fields, $all_users = false)
{
@ -186,7 +186,7 @@ function PMA_Bookmark_save($bkm_fields, $all_users = false)
*
* @access public
*
* @global resource the controluser db connection handle
* @global resource $controllink the controluser db connection handle
*/
function PMA_Bookmark_delete($db, $id)
{

View File

@ -11,14 +11,14 @@ if (! defined('PHPMYADMIN')) {
/**
* Function to get html for relational field selection
*
*
* @param string $db current database
* @param string $table current table
* @param string $field field
* @param array $foreignData foreign column data
* @param string $fieldkey field key
* @param array $data data
*
*
* @return string
*/
function PMA_getHtmlForRelationalFieldSelection($db, $table, $field, $foreignData,
@ -26,7 +26,7 @@ function PMA_getHtmlForRelationalFieldSelection($db, $table, $field, $foreignDat
) {
$gotopage = PMA_getHtmlForGotoPage($foreignData);
$showall = PMA_getHtmlForShowAll($foreignData);
$output = '<form action="browse_foreigners.php" method="post">'
. '<fieldset>'
. PMA_URL_getHiddenInputs($db, $table)
@ -43,9 +43,9 @@ function PMA_getHtmlForRelationalFieldSelection($db, $table, $field, $foreignDat
. '<label for="input_foreign_filter">' . __('Search:') . '</label>'
. '<input type="text" name="foreign_filter" '
. 'id="input_foreign_filter" value="'
. (isset($_REQUEST['foreign_filter'])
? htmlspecialchars($_REQUEST['foreign_filter'])
: '')
. (isset($_REQUEST['foreign_filter'])
? htmlspecialchars($_REQUEST['foreign_filter'])
: '')
. '" />'
. '<input type="submit" name="submit_foreign_filter" value="'
. __('Go') . '" />'
@ -157,12 +157,12 @@ function PMA_getHtmlForRelationalFieldSelection($db, $table, $field, $foreignDat
$key_ordered_current_key, $key_ordered_current_val,
$key_ordered_current_val_title, $field
);
$output .= PMA_getHtmlForColumnElement(
'', $key_ordered_current_equals_data, $key_ordered_current_key,
$key_ordered_current_val, $key_ordered_current_val_title, $field
);
$output .= '<td width="20%">'
. '<img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png" alt=""'
. ' width="1" height="1" /></td>';
@ -182,7 +182,7 @@ function PMA_getHtmlForRelationalFieldSelection($db, $table, $field, $foreignDat
}
$output .= '</tbody>'
. '</table>';
return $output;
}
@ -195,7 +195,7 @@ function PMA_getHtmlForRelationalFieldSelection($db, $table, $field, $foreignDat
* @param string $currentVal current value
* @param string $currentTitle current title
* @param string $field field
*
*
* @return string
*/
function PMA_getHtmlForColumnElement($cssClass, $currentEqualsData, $currentKey,
@ -215,16 +215,16 @@ function PMA_getHtmlForColumnElement($cssClass, $currentEqualsData, $currentKey,
} else {
$output .= $currentVal;
}
$output .= '</a>' . ($currentEqualsData ? '</strong>' : '') . '</td>';
return $output;
}
/**
* Function to get javascript code to handle display selection for relational
* field values
*
*
* @return string
*/
function PMA_getJsScriptToHandleSelectRelationalFields()
@ -282,7 +282,7 @@ EOC;
/**
* Function to get formatted error message for javascript
*
*
* @return string
*/
function PMA_getJsError()
@ -299,7 +299,7 @@ function PMA_getJsError()
/**
* Function to get the field key
*
*
* @return string
*/
function PMA_getFieldKey()
@ -309,13 +309,13 @@ function PMA_getFieldKey()
} else {
$fieldkey = $_REQUEST['fieldkey'];
}
return $fieldkey;
}
/**
* Function to get the element name
*
*
* @return string
*/
function PMA_getElementName()
@ -337,15 +337,15 @@ function PMA_getElementName()
} else {
$element_name .= "var element_name = field + '[]'";
}
return $element_name;
}
/**
* Function to get html for show all case
*
*
* @param array $foreignData foreign data
*
*
* @return string
*/
function PMA_getHtmlForShowAll($foreignData)
@ -359,15 +359,15 @@ function PMA_getHtmlForShowAll($foreignData)
. __('Show all') . '" />';
}
}
return $showall;
}
/**
* Function to get html for the goto page option
*
*
* @param array $foreignData foreign data
*
*
* @return string
*/
function PMA_getHtmlForGotoPage($foreignData)
@ -399,9 +399,9 @@ function PMA_getHtmlForGotoPage($foreignData)
/**
* Function to get foreign limit
*
*
* @param string $foreign_navig foreign navigation
*
*
* @return string
*/
function PMA_getForeignLimit($foreign_navig)

View File

@ -165,6 +165,7 @@ function PMA_buildHtmlForDb(
. 'PMA_commonActions.setDb(\''
. PMA_jsFormat($current['SCHEMA_NAME']) . '\');'
. '" href="server_privileges.php?' . $url_query
. '&amp;db=' . urlencode($current['SCHEMA_NAME'])
. '&amp;checkprivsdb=' . urlencode($current['SCHEMA_NAME'])
. '" title="'
. sprintf(

View File

@ -104,7 +104,7 @@ function PMA_convertString($src_charset, $dest_charset, $what)
);
case PMA_CHARSET_MB:
return mb_convert_encoding(
$message, $dest_charset, $src_charset
$what, $dest_charset, $src_charset
);
default:
return $what;

View File

@ -752,8 +752,8 @@ if (! defined('PMA_MINIMUM_COMMON')) {
foreach ($cfg['Servers'] as $i => $server) {
if ($server['host'] == $_REQUEST['server']
|| $server['verbose'] == $_REQUEST['server']
|| $PMA_String::strtolower($server['verbose']) == $PMA_String::strtolower($_REQUEST['server'])
|| md5($PMA_String::strtolower($server['verbose'])) == $PMA_String::strtolower($_REQUEST['server'])
|| $PMA_String->strtolower($server['verbose']) == $PMA_String->strtolower($_REQUEST['server'])
|| md5($PMA_String->strtolower($server['verbose'])) == $PMA_String->strtolower($_REQUEST['server'])
) {
$_REQUEST['server'] = $i;
break;
@ -846,7 +846,10 @@ if (! defined('PMA_MINIMUM_COMMON')) {
* the required auth type plugin
*/
$auth_class = "Authentication" . ucfirst($cfg['Server']['auth_type']);
if (! file_exists('./libraries/plugins/auth/' . $auth_class . '.class.php')) {
if (! file_exists(
'./libraries/plugins/auth/'
. $auth_class . '.class.php'
)) {
PMA_fatalError(
__('Invalid authentication method set in configuration:')
. ' ' . $cfg['Server']['auth_type']
@ -918,7 +921,9 @@ if (! defined('PMA_MINIMUM_COMMON')) {
}
// is a login without password allowed?
if (! $cfg['Server']['AllowNoPassword'] && $cfg['Server']['password'] == '') {
if (! $cfg['Server']['AllowNoPassword']
&& $cfg['Server']['password'] == ''
) {
$login_without_password_is_forbidden = true;
PMA_logUser($cfg['Server']['user'], 'empty-denied');
$auth_plugin->authFails();
@ -1004,9 +1009,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
}
if (PMA_DRIZZLE) {
// DisableIS must be set to false for Drizzle, it maps SHOW commands
// to INFORMATION_SCHEMA queries anyway so it's fast on large servers
$cfg['Server']['DisableIS'] = false;
// SHOW OPEN TABLES is not supported by Drizzle
$cfg['SkipLockedTables'] = false;
}
@ -1032,12 +1034,12 @@ if (! defined('PMA_MINIMUM_COMMON')) {
/**
* some resetting has to be done when switching servers
*/
if (isset($_SESSION['tmp_user_values']['previous_server'])
&& $_SESSION['tmp_user_values']['previous_server'] != $GLOBALS['server']
if (isset($_SESSION['tmpval']['previous_server'])
&& $_SESSION['tmpval']['previous_server'] != $GLOBALS['server']
) {
unset($_SESSION['tmp_user_values']['navi_limit_offset']);
unset($_SESSION['tmpval']['navi_limit_offset']);
}
$_SESSION['tmp_user_values']['previous_server'] = $GLOBALS['server'];
$_SESSION['tmpval']['previous_server'] = $GLOBALS['server'];
} // end server connecting

View File

@ -513,41 +513,6 @@ $cfg['Servers'][$i]['AllowDeny']['order'] = '';
*/
$cfg['Servers'][$i]['AllowDeny']['rules'] = array();
/**
* Disable use of INFORMATION_SCHEMA. Is always 'false' for Drizzle.
*
* @see https://sourceforge.net/p/phpmyadmin/bugs/2606/
* @see http://bugs.mysql.com/19588
* @global boolean $cfg['Servers'][$i]['DisableIS']
*/
$cfg['Servers'][$i]['DisableIS'] = true;
/**
* SQL command to fetch available databases
*
* by default most user will be fine with SHOW DATABASES,
* for servers with a huge amount of databases it is possible to
* define a command which executes faster but with less information
*
* especially when accessing database servers from ISPs changing this command
* can result in a great speed improvement
*
* false will disable fetching databases from the server, only databases in
* $cfg['Servers'][$i]['only_db'] will be displayed
*
* #user# will be replaced by current user
*
* examples:
* 'SHOW DATABASES'
* "SHOW DATABASES LIKE '#user#\_%'"
* 'SELECT DISTINCT TABLE_SCHEMA FROM information_schema.SCHEMA_PRIVILEGES'
* 'SELECT SCHEMA_NAME FROM information_schema.SCHEMATA'
* false
*
* @global array $cfg['Servers'][$i]['ShowDatabasesCommand']
*/
$cfg['Servers'][$i]['ShowDatabasesCommand'] = 'SHOW DATABASES';
/**
* Whether the tracking mechanism creates
* versions for tables and views automatically.
@ -601,7 +566,6 @@ $cfg['Servers'][$i]['tracking_add_drop_database'] = true;
* (in some cases TABLE STATUS can be very slow, so you may want to cache it).
* APC is used (if the PHP extension is available, if not, this setting is ignored
* silently). You have to provide StatusCacheLifetime.
* Takes effect only if DisableIS is true.
*
* @global array $cfg['Servers'][$i]['StatusCacheDatabases']
*/
@ -644,13 +608,14 @@ if (defined('VERSION_CHECK_DEFAULT')) {
/**
* The url of the proxy to be used when retrieving the information about
* the latest version of phpMyAdmin. You need this if the server where
* phpMyAdmin is installed does not have direct access to the internet.
* the latest version of phpMyAdmin or error reporting. You need this if
* the server where phpMyAdmin is installed does not have direct access to
* the internet.
* The format is: "hostname:portnumber"
*
* @global string $cfg['VersionCheckProxyUrl']
* @global string $cfg['ProxyUrl']
*/
$cfg['VersionCheckProxyUrl'] = "";
$cfg['ProxyUrl'] = "";
/**
* The username for authenticating with the proxy. By default, no
@ -658,16 +623,16 @@ $cfg['VersionCheckProxyUrl'] = "";
* Authentication will be performed. No other types of authentication
* are currently supported.
*
* @global string $cfg['VersionCheckProxyUser']
* @global string $cfg['ProxyUser']
*/
$cfg['VersionCheckProxyUser'] = "";
$cfg['ProxyUser'] = "";
/**
* The password for authenticating with the proxy.
*
* @global string $cfg['VersionCheckProxyPass']
* @global string $cfg['ProxyPass']
*/
$cfg['VersionCheckProxyPass'] = "";
$cfg['ProxyPass'] = "";
/**
* maximum number of db's displayed in database list
@ -676,13 +641,6 @@ $cfg['VersionCheckProxyPass'] = "";
*/
$cfg['MaxDbList'] = 100;
/**
* maximum number of items displayed in navigation panel
*
* @global integer $cfg['MaxDbList']
*/
$cfg['MaxNavigationItems'] = 250;
/**
* maximum number of tables displayed in table list
*
@ -906,6 +864,13 @@ $cfg['Error_Handler']['gather'] = false;
* Navigation panel setup
*/
/**
* maximum number of items displayed in navigation panel
*
* @global integer $cfg['MaxDbList']
*/
$cfg['MaxNavigationItems'] = 250;
/**
* turn the select-based light menu into a tree
*
@ -2832,6 +2797,16 @@ $cfg['LinkLengthLimit'] = 1000;
*/
$cfg['DisableMultiTableMaintenance'] = false;
/**
* Whether or not to query the user before sending the error report to
* the phpMyAdmin team when a JavaScript error occurs
*
* Available options
* (ask | always | never)
*
* @global string $cfg['SendErrorReports']
*/
$cfg['SendErrorReports'] = 'ask';
/*******************************************************************************
* If you wish to use the SQL Validator service, you should be aware of the

View File

@ -107,6 +107,11 @@ $cfg_db['InitialSlidersState'] = array(
'closed' => __('Closed'),
'disabled' => __('Disabled')
);
$cfg_db['SendErrorReports'] = array(
'ask' => __('Ask before sending error reports'),
'always' => __('Always send error reports'),
'never' => __('Never send error reports')
);
$cfg_db['Import']['format'] = array(
'csv', // CSV
'docsql', // DocSQL
@ -220,7 +225,7 @@ $cfg_db['_validators'] = array(
'MaxCharactersInDisplayedSQL' => 'validatePositiveNumber',
'MaxRows' => 'validatePositiveNumber',
'MaxTableList' => 'validatePositiveNumber',
'MemoryLimit' => array(array('validateByRegex', '/^\d+(?:[kmg])?$/i')),
'MemoryLimit' => array(array('validateByRegex', '/^(-1|(\d+(?:[kmg])?))$/i')),
'NavigationTreeTableLevel' => 'validatePositiveNumber',
'QueryHistoryMax' => 'validatePositiveNumber',
'QueryWindowWidth' => 'validatePositiveNumber',

View File

@ -18,13 +18,7 @@ class ConfigFile
* Stores default PMA config from config.default.php
* @var array
*/
private $_cfg;
/**
* Stores original PMA_Config object, not modified by user preferences
* @var PMA_Config
*/
private $_orgCfgObject;
private $_defaultCfg;
/**
* Stores allowed values for non-standard fields
@ -32,6 +26,18 @@ class ConfigFile
*/
private $_cfgDb;
/**
* Stores original PMA config, not modified by user preferences
* @var PMA_Config
*/
private $_baseCfg;
/**
* Whether we are currently working in PMA Setup context
* @var bool
*/
private $_isInSetup;
/**
* Keys which will be always written to config file
* @var array
@ -65,25 +71,19 @@ class ConfigFile
private $_flattenArrayResult;
/**
* ConfigFile instance
* @var ConfigFile
*/
private static $_instance;
/**
* Private constructor, use {@link getInstance()}
* Constructor
*
* @param array $base_config base configuration read from
* {@link PMA_Config::$base_config},
* use only when not in PMA Setup
*/
private function __construct()
public function __construct(array $base_config = null)
{
// load default config values
$cfg = &$this->_cfg;
$cfg = &$this->_defaultCfg;
include './libraries/config.default.php';
$cfg['fontsize'] = '82%';
// create PMA_Config to read config.inc.php values
$this->_orgCfgObject = new PMA_Config(CONFIG_FILE);
// load additional config information
$cfg_db = &$this->_cfgDb;
include './libraries/config.values.php';
@ -95,35 +95,14 @@ class ConfigFile
}
}
$this->_baseCfg = $base_config;
$this->_isInSetup = is_null($base_config);
$this->_id = 'ConfigFile' . $GLOBALS['server'];
if (!isset($_SESSION[$this->_id])) {
$_SESSION[$this->_id] = array();
}
}
/**
* Returns class instance
*
* @return ConfigFile
*/
public static function getInstance()
{
if (is_null(self::$_instance)) {
self::$_instance = new ConfigFile();
}
return self::$_instance;
}
/**
* Returns PMA_Config without user preferences applied
*
* @return PMA_Config
*/
public function getOrgConfigObj()
{
return $this->_orgCfgObject;
}
/**
* Sets names of config options which will be placed in config file even if
* they are set to their default values (use only full paths)
@ -132,7 +111,7 @@ class ConfigFile
*
* @return void
*/
public function setPersistKeys($keys)
public function setPersistKeys(array $keys)
{
// checking key presence is much faster than searching so move values
// to keys
@ -173,8 +152,8 @@ class ConfigFile
* {@link updateWithGlobalConfig()} or reading
* by {@link getConfig()} or {@link getConfigArray()}
*
* @param array $mapping Contains the mapping of "Server/config options"
* to "Server/1/config options"
* @param array $mapping Contains the mapping of "Server/config options"
* to "Server/1/config options"
*
* @return void
*/
@ -225,21 +204,28 @@ class ConfigFile
) {
return;
}
// remove if the path isn't protected and it's empty or has a default
// value
// if the path isn't protected it may be removed
if (!isset($this->_persistKeys[$canonical_path])) {
$default_value = $this->getDefault($canonical_path);
// we need original config values not overwritten by user
// preferences to allow for overwriting options set in
// config.inc.php with default values
$instance_default_value = PMA_arrayRead(
$canonical_path,
$this->_orgCfgObject->settings
);
if (($value === $default_value && (defined('PMA_SETUP')
|| $instance_default_value === $default_value))
|| (empty($value) && empty($default_value) && (defined('PMA_SETUP')))
) {
$remove_path = $value === $default_value;
if ($this->_isInSetup) {
// remove if it has a default value or is empty
$remove_path = $remove_path
|| (empty($value) && empty($default_value));
} else {
// get original config values not overwritten by user
// preferences to allow for overwriting options set in
// config.inc.php with default values
$instance_default_value = PMA_arrayRead(
$canonical_path,
$this->_baseCfg
);
// remove if it has a default value and base config (config.inc.php)
// uses default value
$remove_path = $remove_path
&& ($instance_default_value === $default_value);
}
if ($remove_path) {
PMA_arrayRemove($path, $_SESSION[$this->_id]);
return;
}
@ -277,7 +263,7 @@ class ConfigFile
public function getFlatDefaultConfig()
{
$this->_flattenArrayResult = array();
array_walk($this->_cfg, array($this, '_flattenArray'), '');
array_walk($this->_defaultCfg, array($this, '_flattenArray'), '');
$flat_cfg = $this->_flattenArrayResult;
$this->_flattenArrayResult = null;
return $flat_cfg;
@ -313,8 +299,8 @@ class ConfigFile
/**
* Returns config value or $default if it's not set
*
* @param string $path
* @param mixed $default
* @param string $path Path of config file
* @param mixed $default Default values
*
* @return mixed
*/
@ -335,7 +321,7 @@ class ConfigFile
*/
public function getDefault($canonical_path, $default = null)
{
return PMA_arrayRead($canonical_path, $this->_cfg, $default);
return PMA_arrayRead($canonical_path, $this->_defaultCfg, $default);
}
/**
@ -372,8 +358,8 @@ class ConfigFile
/**
* Returns config database entry for $path ($cfg_db in config_info.php)
*
* @param string $path
* @param mixed $default
* @param string $path path of the variable in config db
* @param mixed $default default value
*
* @return mixed
*/
@ -409,7 +395,7 @@ class ConfigFile
/**
* Returns DSN of given server
*
* @param integer $server
* @param integer $server server index
*
* @return string
*/
@ -443,7 +429,7 @@ class ConfigFile
/**
* Returns server name
*
* @param int $id
* @param int $id server index
*
* @return string
*/
@ -463,7 +449,7 @@ class ConfigFile
/**
* Removes server
*
* @param int $server
* @param int $server server index
*
* @return void
*/
@ -481,7 +467,7 @@ class ConfigFile
unset($_SESSION[$this->_id]['Servers'][$last_server]);
if (isset($_SESSION[$this->_id]['ServerDefault'])
&& $_SESSION[$this->_id]['ServerDefault'] >= 0
&& $_SESSION[$this->_id]['ServerDefault'] == $last_server
) {
unset($_SESSION[$this->_id]['ServerDefault']);
}
@ -511,8 +497,10 @@ class ConfigFile
{
$c = $_SESSION[$this->_id];
foreach ($this->_cfgUpdateReadMapping as $map_to => $map_from) {
PMA_arrayWrite($map_to, $c, PMA_arrayRead($map_from, $c));
PMA_arrayRemove($map_from, $c);
if (PMA_arrayKeyExists($map_to, $c)) {
PMA_arrayWrite($map_to, $c, PMA_arrayRead($map_from, $c));
PMA_arrayRemove($map_from, $c);
}
}
return $c;
}
@ -534,7 +522,7 @@ class ConfigFile
array_keys($c)
);
foreach ($persistKeys as $k) {
$c[$k] = $this->getDefault($k);
$c[$k] = $this->getDefault($this->getCanonicalPath($k));
}
foreach ($this->_cfgUpdateReadMapping as $map_to => $map_from) {

View File

@ -44,16 +44,25 @@ class Form
*/
private $_fieldsTypes;
/**
* ConfigFile instance
* @var ConfigFile
*/
private $_configFile;
/**
* Constructor, reads default config values
*
* @param string $form_name Form name
* @param array $form Form data
* @param int $index arbitrary index, stored in Form::$index
* @param string $form_name Form name
* @param array $form Form data
* @param ConfigFile $cf Config file instance
* @param int $index arbitrary index, stored in Form::$index
*/
public function __construct($form_name, array $form, $index = null)
{
public function __construct(
$form_name, array $form, ConfigFile $cf, $index = null
) {
$this->index = $index;
$this->_configFile = $cf;
$this->loadForm($form_name, $form);
}
@ -81,7 +90,7 @@ class Form
*/
public function getOptionValueList($option_path)
{
$value = ConfigFile::getInstance()->getDbEntry($option_path);
$value = $this->_configFile->getDbEntry($option_path);
if ($value === null) {
trigger_error("$option_path - select options not defined", E_USER_ERROR);
return array();
@ -175,7 +184,7 @@ class Form
*/
protected function readTypes()
{
$cf = ConfigFile::getInstance();
$cf = $this->_configFile;
foreach ($this->fields as $name => $path) {
if (strpos($name, ':group:') === 0) {
$this->_fieldsTypes[$name] = 'group';

View File

@ -27,6 +27,12 @@ require_once './libraries/js_escape.lib.php';
*/
class FormDisplay
{
/**
* ConfigFile instance
* @var ConfigFile
*/
private $_configFile;
/**
* Form list
* @var Form[]
@ -81,8 +87,10 @@ class FormDisplay
/**
* Constructor
*
* @param ConfigFile $cf Config file instance
*/
public function __construct()
public function __construct(ConfigFile $cf)
{
$this->_jsLangStrings = array(
'error_nan_p' => __('Not a positive number'),
@ -90,8 +98,19 @@ class FormDisplay
'error_incorrect_port' => __('Not a valid port number'),
'error_invalid_value' => __('Incorrect value'),
'error_value_lte' => __('Value must be equal or lower than %s'));
$this->_configFile = $cf;
// initialize validators
PMA_Validator::getValidators();
PMA_Validator::getValidators($this->_configFile);
}
/**
* Returns {@link ConfigFile} associated with this instance
*
* @return ConfigFile
*/
public function getConfigFile()
{
return $this->_configFile;
}
/**
@ -105,7 +124,9 @@ class FormDisplay
*/
public function registerForm($form_name, array $form, $server_id = null)
{
$this->_forms[$form_name] = new Form($form_name, $form, $server_id);
$this->_forms[$form_name] = new Form(
$form_name, $form, $this->_configFile, $server_id
);
$this->_isValidated = false;
foreach ($this->_forms[$form_name]->fields as $path) {
$work_path = $server_id === null
@ -149,7 +170,6 @@ class FormDisplay
return;
}
$cf = ConfigFile::getInstance();
$paths = array();
$values = array();
foreach ($this->_forms as $form) {
@ -158,13 +178,15 @@ class FormDisplay
// collect values and paths
foreach ($form->fields as $path) {
$work_path = array_search($path, $this->_systemPaths);
$values[$path] = $cf->getValue($work_path);
$values[$path] = $this->_configFile->getValue($work_path);
$paths[] = $path;
}
}
// run validation
$errors = PMA_Validator::validate($paths, $values, false);
$errors = PMA_Validator::validate(
$this->_configFile, $paths, $values, false
);
// change error keys from canonical paths to work paths
if (is_array($errors) && count($errors) > 0) {
@ -198,7 +220,7 @@ class FormDisplay
$js = array();
$js_default = array();
$tabbed_form = $tabbed_form && (count($this->_forms) > 1);
$validators = PMA_Validator::getValidators();
$validators = PMA_Validator::getValidators($this->_configFile);
PMA_displayFormTop();
@ -315,9 +337,8 @@ class FormDisplay
$name = PMA_langName($system_path);
$description = PMA_langName($system_path, 'desc', '');
$cf = ConfigFile::getInstance();
$value = $cf->get($work_path);
$value_default = $cf->getDefault($system_path);
$value = $this->_configFile->get($work_path);
$value_default = $this->_configFile->getDefault($system_path);
$value_is_default = false;
if ($value === null || $value === $value_default) {
$value = $value_default;
@ -326,7 +347,6 @@ class FormDisplay
$opts = array(
'doc' => $this->getDocLink($system_path),
'wiki' => $this->getWikiLink($system_path),
'show_restore_default' => $show_restore_default,
'userprefs_allow' => $userprefs_allow,
'userprefs_comment' => PMA_langName($system_path, 'cmt', ''));
@ -456,7 +476,7 @@ class FormDisplay
return;
}
$cf = ConfigFile::getInstance();
$cf = $this->_configFile;
foreach (array_keys($this->_errors) as $work_path) {
if (!isset($this->_systemPaths[$work_path])) {
continue;
@ -508,7 +528,6 @@ class FormDisplay
public function save($forms, $allow_partial_save = true)
{
$result = true;
$cf = ConfigFile::getInstance();
$forms = (array) $forms;
$values = array();
@ -528,7 +547,7 @@ class FormDisplay
}
// get current server id
$change_index = $form->index === 0
? $cf->getServerCount() + 1
? $this->_configFile->getServerCount() + 1
: false;
// grab POST values
foreach ($form->fields as $field => $system_path) {
@ -646,10 +665,10 @@ class FormDisplay
}
$values[$path] = $proxies;
}
$cf->set($work_path, $values[$path], $path);
$this->_configFile->set($work_path, $values[$path], $path);
}
if ($is_setup_script) {
$cf->set(
$this->_configFile->set(
'UserprefsDisallow',
array_keys($this->_userprefsDisallow)
);
@ -692,35 +711,6 @@ class FormDisplay
);
}
/**
* Returns link to wiki
*
* @param string $path Path to wiki
*
* @return string
*/
public function getWikiLink($path)
{
$opt_name = $this->_getOptName($path);
if (substr($opt_name, 0, 7) == 'Servers') {
$opt_name = substr($opt_name, 8);
if (strpos($opt_name, 'AllowDeny') === 0) {
$opt_name = str_replace('_', '_.28', $opt_name) . '.29';
}
}
$test = substr($path, 0, 6);
if ($test == 'Import') {
$opt_name = substr($opt_name, 7);
if ($opt_name == 'format') {
$opt_name = 'format_2';
}
}
if ($test == 'Export') {
$opt_name = substr($opt_name, 7);
}
return PMA_linkURL('http://wiki.phpmyadmin.net/pma/Config#' . $opt_name);
}
/**
* Changes path so it can be used in URLs
*
@ -744,7 +734,7 @@ class FormDisplay
$this->_userprefsKeys = array_flip(PMA_readUserprefsFieldNames());
// read real config for user preferences display
$userprefs_disallow = defined('PMA_SETUP')
? ConfigFile::getInstance()->get('UserprefsDisallow', array())
? $this->_configFile->get('UserprefsDisallow', array())
: $GLOBALS['cfg']['UserprefsDisallow'];
$this->_userprefsDisallow = array_flip($userprefs_disallow);
}

View File

@ -115,7 +115,6 @@ function PMA_displayFieldsetTop($title = '', $description = '', $errors = null,
* o values_disabled - (array)list of disabled values (keys from values)
* o comment - (string) tooltip comment
* o comment_warning - (bool) whether this comments warns about something
* o wiki - (string) wiki link
*
* @param string $path config option path
* @param string $name config option name
@ -147,7 +146,6 @@ function PMA_displayInput($path, $name, $type, $value, $description = '',
$icon_init = array(
'edit' => array('b_edit.png', ''),
'help' => array('b_help.png', __('Documentation')),
'info' => array('b_info.png', __('Wiki')),
'reload' => array('s_reload.png', ''),
'tblops' => array('b_tblops.png', '')
);
@ -204,18 +202,11 @@ function PMA_displayInput($path, $name, $type, $value, $description = '',
echo '<th>';
echo '<label for="' . htmlspecialchars($path) . '">' . $name . '</label>';
if (! empty($opts['doc']) || ! empty($opts['wiki'])) {
if (! empty($opts['doc'])) {
echo '<span class="doc">';
if (! empty($opts['doc'])) {
echo '<a href="' . $opts['doc']
. '" target="documentation">' . $icons['help'] . '</a>';
echo "\n";
}
if (! empty($opts['wiki'])) {
echo '<a href="' . $opts['wiki']
. '" target="wiki">' . $icons['info'] . '</a>';
echo "\n";
}
echo '<a href="' . $opts['doc']
. '" target="documentation">' . $icons['help'] . '</a>';
echo "\n";
echo '</span>';
}

View File

@ -25,21 +25,21 @@ class PMA_Validator
/**
* Returns validator list
*
* @param ConfigFile $cf Config file instance
*
* @return array
*/
public static function getValidators()
public static function getValidators(ConfigFile $cf)
{
static $validators = null;
if ($validators === null) {
$cf = ConfigFile::getInstance();
$validators = $cf->getDbEntry('_validators', array());
if (!defined('PMA_SETUP')) {
// not in setup script: load additional validators for user
// preferences we need original config values not overwritten
// by user preferences, creating a new PMA_Config instance is a
// better idea than hacking into its code
$org_cfg = $cf->getOrgConfigObj();
$uvs = $cf->getDbEntry('_userValidators', array());
foreach ($uvs as $field => $uv_list) {
$uv_list = (array)$uv_list;
@ -50,7 +50,8 @@ class PMA_Validator
for ($i = 1; $i < count($uv); $i++) {
if (substr($uv[$i], 0, 6) == 'value:') {
$uv[$i] = PMA_arrayRead(
substr($uv[$i], 6), $org_cfg->settings
substr($uv[$i], 6),
$GLOBALS['PMA_Config']->base_settings
);
}
}
@ -73,6 +74,7 @@ class PMA_Validator
* cleanup in HTML documen
* o false - when no validators match name(s) given by $validator_id
*
* @param ConfigFile $cf Config file instance
* @param string|array $validator_id ID of validator(s) to run
* @param array &$values Values to validate
* @param bool $isPostSource tells whether $values are directly from
@ -80,13 +82,13 @@ class PMA_Validator
*
* @return bool|array
*/
public static function validate($validator_id, &$values, $isPostSource)
{
public static function validate(
ConfigFile $cf, $validator_id, &$values, $isPostSource
) {
// find validators
$validator_id = (array) $validator_id;
$validators = static::getValidators();
$validators = static::getValidators($cf);
$vids = array();
$cf = ConfigFile::getInstance();
foreach ($validator_id as &$vid) {
$vid = $cf->getCanonicalPath($vid);
if (isset($validators[$vid])) {

View File

@ -395,8 +395,6 @@ $strConfigServers_controlport_desc = __('An alternate port to connect to the hos
$strConfigServers_controlport_name = __('Control port');
$strConfigServers_designer_coords_desc = __('Leave blank for no Designer support, suggested: [kbd]pma__designer_coords[/kbd]');
$strConfigServers_designer_coords_name = __('Designer table');
$strConfigServers_DisableIS_desc = __('More information on [a@https://sourceforge.net/p/phpmyadmin/bugs/2606/]PMA bug tracker[/a] and [a@http://bugs.mysql.com/19588]MySQL Bugs[/a]');
$strConfigServers_DisableIS_name = __('Disable use of INFORMATION_SCHEMA');
$strConfigServers_extension_desc = __('What PHP extension to use; you should use mysqli if supported');
$strConfigServers_extension_name = __('PHP extension to use');
$strConfigServers_hide_db_desc = __('Hide databases matching regular expression (PCRE)');
@ -424,8 +422,6 @@ $strConfigServers_recent_desc = __('Leave blank for no "persistent" recently use
$strConfigServers_recent_name = __('Recently used table');
$strConfigServers_relation_desc = __('Leave blank for no [a@http://wiki.phpmyadmin.net/pma/relation]relation-links[/a] support, suggested: [kbd]pma__relation[/kbd]');
$strConfigServers_relation_name = __('Relation table');
$strConfigServers_ShowDatabasesCommand_desc = __('SQL command to fetch available databases');
$strConfigServers_ShowDatabasesCommand_name = __('SHOW DATABASES command');
$strConfigServers_SignonSession_desc = __('See [a@http://wiki.phpmyadmin.net/pma/auth_types#signon]authentication types[/a] for an example');
$strConfigServers_SignonSession_name = __('Signon session name');
$strConfigServers_SignonURL_name = __('Signon URL');
@ -529,12 +525,12 @@ $strConfigUserprefsDeveloperTab_name = __('Enable the Developer tab in settings'
$strConfigVersionCheckLink = __('Check for latest version');
$strConfigVersionCheck_desc = __('Enables check for latest version on main phpMyAdmin page');
$strConfigVersionCheck_name = __('Version check');
$strConfigVersionCheckProxyUrl_desc = __('The url of the proxy to be used when retrieving the information about the latest version of phpMyAdmin. You need this if the server where phpMyAdmin is installed does not have direct access to the internet. The format is: "hostname:portnumber"');
$strConfigVersionCheckProxyUrl_name = __('Version check proxy url');
$strConfigVersionCheckProxyUser_desc = __('The username for authenticating with the proxy. By default, no authentication is performed. If a username is supplied, Basic Authentication will be performed. No other types of authentication are currently supported.');
$strConfigVersionCheckProxyUser_name = __('Version check proxy username');
$strConfigVersionCheckProxyPass_desc = __('The password for authenticating with the proxy');
$strConfigVersionCheckProxyPass_name = __('Version check proxy password');
$strConfigProxyUrl_desc = __('The url of the proxy to be used when retrieving the information about the latest version of phpMyAdmin or when submitting error reports. You need this if the server where phpMyAdmin is installed does not have direct access to the internet. The format is: "hostname:portnumber"');
$strConfigProxyUrl_name = __('Proxy url');
$strConfigProxyUser_desc = __('The username for authenticating with the proxy. By default, no authentication is performed. If a username is supplied, Basic Authentication will be performed. No other types of authentication are currently supported.');
$strConfigProxyUser_name = __('Proxy username');
$strConfigProxyPass_desc = __('The password for authenticating with the proxy');
$strConfigProxyPass_name = __('Proxy password');
$strConfigZipDump_desc = __('Enable [a@http://en.wikipedia.org/wiki/ZIP_(file_format)]ZIP[/a] compression for import and export operations');
$strConfigZipDump_name = __('ZIP');
@ -543,4 +539,7 @@ $strConfigCaptchaLoginPublicKey_name = __('Public key for reCaptcha');
$strConfigCaptchaLoginPrivateKey_desc = __('Enter your private key for your domain reCaptcha service');
$strConfigCaptchaLoginPrivateKey_name = __('Private key for reCaptcha');
$strConfigSendErrorReports_desc = __('Choose the default action when sending error reports');
$strConfigSendErrorReports_name = __('Send error reports');
?>

View File

@ -57,10 +57,8 @@ $forms['Servers']['Server_config'] = array('Servers' => array(1 => array(
'hide_db',
'AllowRoot',
'AllowNoPassword',
'DisableIS',
'AllowDeny/order',
'AllowDeny/rules',
'ShowDatabasesCommand')));
'AllowDeny/rules')));
$forms['Servers']['Server_pmadb'] = array('Servers' => array(1 => array(
'pmadb' => 'phpmyadmin',
'controlhost',
@ -143,9 +141,10 @@ $forms['Features']['Other_core_settings'] = array(
'DisableMultiTableMaintenance',
'UseDbSearch',
'VersionCheck',
'VersionCheckProxyUrl',
'VersionCheckProxyUser',
'VersionCheckProxyPass',
'SendErrorReports',
'ProxyUrl',
'ProxyUser',
'ProxyPass',
'AllowThirdPartyFraming',
);
$forms['Sql_queries']['Sql_queries'] = array(

View File

@ -33,7 +33,8 @@ $forms['Features']['General'] = array(
'MaxDbList',
'MaxTableList',
'NumRecentTables',
'ShowHint');
'ShowHint',
'SendErrorReports');
$forms['Features']['Text_fields'] = array(
'CharEditing',
'MinSizeForInputField',

View File

@ -201,7 +201,7 @@ function PMA_securePath($path)
* @param string|array $message_args arguments applied to $error_message
* @param boolean $delete_session whether to delete session cookie
*
* @return exit
* @return void
*/
function PMA_fatalError(
$error_message, $message_args = null, $delete_session = true
@ -466,8 +466,8 @@ function PMA_arrayWalkRecursive(&$array, $function, $apply_to_keys_also = false)
/**
* boolean phpMyAdmin.PMA_checkPageValidity(string &$page, array $whitelist)
*
* checks given given $page against given $whitelist and returns true if valid
* it ignores optionaly query paramters in $page (script.php?ignored)
* checks given $page against given $whitelist and returns true if valid
* it optionally ignores query parameters in $page (script.php?ignored)
*
* @param string &$page page to check
* @param array $whitelist whitelist to check page against
@ -654,6 +654,28 @@ function PMA_downloadHeader($filename, $mimetype, $length = 0, $no_cache = true)
}
}
/**
* Checks whether element given by $path exists in $array.
* $path is a string describing position of an element in an associative array,
* eg. Servers/1/host refers to $array[Servers][1][host]
*
* @param string $path path in the arry
* @param array $array the array
*
* @return mixed array element or $default
*/
function PMA_arrayKeyExists($path, $array)
{
$keys = explode('/', $path);
$value =& $array;
foreach ($keys as $key) {
if (! isset($value[$key])) {
return false;
}
$value =& $value[$key];
}
return true;
}
/**
* Returns value of an element in $array given by $path.

View File

@ -43,7 +43,7 @@ function PMA_getIndexedColumns()
return array(
$field_cnt, $field_primary, $field_index, $field_unique,
$field_fulltext
$field_fulltext
);
}
@ -184,7 +184,7 @@ function PMA_getStatementPrefix($is_create_tbl = true)
}
/**
* Returns sql statement according to the column and index specifications as
* Returns sql statement according to the column and index specifications as
* requested
*
* @param boolean $is_create_tbl true if requirement is to get the statement
@ -238,10 +238,10 @@ function PMA_getColumnCreationStatements($is_create_tbl = true)
/**
* Function to get table creation sql query
*
*
* @param string $db database name
* @param string $table table name
*
*
* @return string
*/
function PMA_getTableCreationQuery($db, $table)
@ -278,7 +278,7 @@ function PMA_getTableCreationQuery($db, $table)
/**
* Function to get the number of fields for the table creation form
*
*
* @return int
*/
function PMA_getNumberOfFieldsFromRequest()
@ -298,11 +298,11 @@ function PMA_getNumberOfFieldsFromRequest()
/**
* Function to execute the column creation statement
*
*
* @param string $db current database
* @param string $table current table
* @param string $err_url error page url
*
*
* @return array
*/
function PMA_tryColumnCreationQuery($db, $table, $err_url)

View File

@ -18,16 +18,16 @@ if (! defined('PHPMYADMIN')) {
/**
* limits for table list
*/
if (! isset($_SESSION['tmp_user_values']['table_limit_offset'])
|| $_SESSION['tmp_user_values']['table_limit_offset_db'] != $db
if (! isset($_SESSION['tmpval']['table_limit_offset'])
|| $_SESSION['tmpval']['table_limit_offset_db'] != $db
) {
$_SESSION['tmp_user_values']['table_limit_offset'] = 0;
$_SESSION['tmp_user_values']['table_limit_offset_db'] = $db;
$_SESSION['tmpval']['table_limit_offset'] = 0;
$_SESSION['tmpval']['table_limit_offset_db'] = $db;
}
if (isset($_REQUEST['pos'])) {
$_SESSION['tmp_user_values']['table_limit_offset'] = (int) $_REQUEST['pos'];
$_SESSION['tmpval']['table_limit_offset'] = (int) $_REQUEST['pos'];
}
$pos = $_SESSION['tmp_user_values']['table_limit_offset'];
$pos = $_SESSION['tmpval']['table_limit_offset'];
PMA_Util::checkParameters(array('db'));
@ -51,29 +51,11 @@ if ($GLOBALS['dbi']->isSystemSchema($db)) {
*/
$tables = array();
// When used in Nested table group mode,
// only show tables matching the given groupname
$tbl_group_sql = "";
$whereAdded = false;
if (PMA_isValid($_REQUEST['tbl_group'])) {
$tbl_group_sql .= " WHERE " . PMA_Util::backquote('Tables_in_' . $db) . " LIKE "
. "'" . PMA_Util::escapeMysqlWildcards($_REQUEST['tbl_group']) . "%'";
$whereAdded = true;
}
if (PMA_isValid($_REQUEST['tbl_type'], array('table', 'view'))) {
$tbl_group_sql .= $whereAdded ? " AND" : " WHERE";
if ($_REQUEST['tbl_type'] == 'view') {
$tbl_group_sql .= " `Table_type` = 'VIEW'";
} else {
$tbl_group_sql .= " `Table_type` != 'VIEW'";
}
}
$tooltip_truename = array();
$tooltip_aliasname = array();
// Special speedup for newer MySQL Versions (in 4.0 format changed)
if (true === $cfg['SkipLockedTables']) {
if (true === $cfg['SkipLockedTables'] && ! PMA_DRIZZLE) {
$db_info_result = $GLOBALS['dbi']->query(
'SHOW OPEN TABLES FROM ' . PMA_Util::backquote($db) . ';'
);
@ -89,10 +71,32 @@ if (true === $cfg['SkipLockedTables']) {
$GLOBALS['dbi']->freeResult($db_info_result);
if (isset($sot_cache)) {
$db_info_result = false;
$tblGroupSql = "";
$whereAdded = false;
if (PMA_isValid($_REQUEST['tbl_group'])) {
$tblGroupSql .= " WHERE "
. PMA_Util::backquote('Tables_in_' . $db)
. " LIKE '"
. PMA_Util::escapeMysqlWildcards($_REQUEST['tbl_group'])
. "%'";
$whereAdded = true;
}
if (PMA_isValid($_REQUEST['tbl_type'], array('table', 'view'))) {
$tblGroupSql .= $whereAdded ? " AND" : " WHERE";
if ($_REQUEST['tbl_type'] == 'view') {
$tblGroupSql .= " `Table_type` != 'BASE TABLE'";
} else {
$tblGroupSql .= " `Table_type` = 'BASE TABLE'";
}
}
$db_info_result = $GLOBALS['dbi']->query(
'SHOW FULL TABLES FROM ' . PMA_Util::backquote($db) . $tbl_group_sql,
'SHOW FULL TABLES FROM ' . PMA_Util::backquote($db) . $tblGroupSql,
null, PMA_DatabaseInterface::QUERY_STORE
);
unset($tblGroupSql, $whereAdded);
if ($db_info_result && $GLOBALS['dbi']->numRows($db_info_result) > 0) {
while ($tmp = $GLOBALS['dbi']->fetchRow($db_info_result)) {
if (! isset($sot_cache[$tmp[0]])) {
@ -110,7 +114,12 @@ if (true === $cfg['SkipLockedTables']) {
}
$tables[$sts_tmp['Name']] = $sts_tmp;
} else { // table in use
$tables[$tmp[0]] = array('Name' => $tmp[0]);
$tables[$tmp[0]] = array(
'TABLE_NAME' => $tmp[0],
'ENGINE' => '',
'TABLE_TYPE' => '',
'TABLE_ROWS' => 0,
);
}
}
if ($GLOBALS['cfg']['NaturalOrder']) {
@ -209,7 +218,7 @@ if (! isset($total_num_tables)) {
/**
* cleanup
*/
unset($each_table, $tbl_group_sql, $db_info_result);
unset($each_table, $db_info_result);
/**
* If coming from a Show MySQL link on the home page,

View File

@ -367,7 +367,7 @@ class PMA_DBI_Drizzle implements PMA_DBI_Extension
}
/**
* returns last error message or false if no errors occured
* returns last error message or false if no errors occurred
*
* @param PMA_DrizzleCon $link connection object
*

View File

@ -312,16 +312,17 @@ $GLOBALS['dummy_queries'] = array(
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.'
. '`SCHEMA_PRIVILEGES`'
. ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\''
. ' AND PRIVILEGE_TYPE=\'TRIGGER\''
. ' AND TABLE_SCHEMA=\'pma\\\\_test\'',
. ' AND PRIVILEGE_TYPE=\'TRIGGER\' AND \'pma\\\\_test\''
. ' REGEXP REPLACE(REPLACE(TABLE_SCHEMA, \'_\', \'.\'), \'%\', \'.*\')',
'result' => array(),
),
array(
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.'
. '`TABLE_PRIVILEGES`'
. ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\''
. ' AND PRIVILEGE_TYPE=\'TRIGGER\''
. ' AND TABLE_SCHEMA=\'pma\\\\_test\' AND TABLE_NAME=\'table1\'',
. ' AND PRIVILEGE_TYPE=\'TRIGGER\' AND \'pma\\\\_test\''
. ' REGEXP REPLACE(REPLACE(TABLE_SCHEMA, \'_\', \'.\'), \'%\', \'.*\')'
. ' AND TABLE_NAME=\'table1\'',
'result' => array(),
),
array(
@ -335,8 +336,8 @@ $GLOBALS['dummy_queries'] = array(
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.'
. '`SCHEMA_PRIVILEGES`'
. ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\''
. ' AND PRIVILEGE_TYPE=\'EVENT\' AND TABLE_SCHEMA=\'pma\\\\_test\'',
. ' AND PRIVILEGE_TYPE=\'EVENT\' AND \'pma\\\\_test\''
. ' REGEXP REPLACE(REPLACE(TABLE_SCHEMA, \'_\', \'.\'), \'%\', \'.*\')',
'result' => array(),
),
array(
@ -693,7 +694,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
*
* @param object $link the connection object
*
* @return boo false
* @return boolean false
*/
public function nextResult($link = null)
{
@ -745,7 +746,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
}
/**
* returns last error message or false if no errors occured
* returns last error message or false if no errors occurred
*
* @param object $link connection link
*

View File

@ -49,7 +49,7 @@ interface PMA_DBI_Extension
* @param object $link connection object
* @param int $options query options
*
* @return result object|bool
* @return object|bool result
*/
public function realQuery($query, $link, $options);
@ -121,7 +121,7 @@ interface PMA_DBI_Extension
/**
* Prepare next result from multi_query
*
* @param objecy $link the connection object
* @param object $link the connection object
*
* @return bool true or false
*/
@ -160,7 +160,7 @@ interface PMA_DBI_Extension
public function getClientInfo();
/**
* returns last error message or false if no errors occured
* returns last error message or false if no errors occurred
*
* @param object $link connection link
*

View File

@ -315,7 +315,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
*
* @param object $link the connection object
*
* @return boo false
* @return boolean false
*/
public function nextResult($link = null)
{
@ -375,7 +375,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
}
/**
* returns last error message or false if no errors occured
* returns last error message or false if no errors occurred
*
* @param resource $link mysql link
*

View File

@ -463,7 +463,7 @@ class PMA_DBI_Mysqli implements PMA_DBI_Extension
}
/**
* returns last error message or false if no errors occured
* returns last error message or false if no errors occurred
*
* @param resource $link mysql link
*

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