Merge branch 'master' of https://github.com/phpmyadmin/phpmyadmin into 0616_server_replication

This commit is contained in:
xmujay 2013-06-20 22:14:20 +08:00
commit 79af5a3cd7
103 changed files with 34891 additions and 35565 deletions

View File

@ -19,11 +19,13 @@ phpMyAdmin - ChangeLog
+ rfe #1433 Support relations with ndbcluster
- bug #3962 Proper escaping of JSON export
+ rfe #1328 Optional ReCAPTCHA support
+ rfe #1434 Improvements to the table browsing navigation bar
4.0.5.0 (not yet released)
- bug #3977 Not detected configuration storage
- bug #3970 Pressing enter in the filter field reloads page
- bug #3984 Cannot insert in this table (PHP < 5.4)
- bug #3989 Reloading privileges does not update the interface
4.0.4.0 (2013-06-17)
- bug #3959 Using DefaultTabDatabase in NavigationTree for Database Click

View File

@ -241,7 +241,7 @@ if (is_array($foreignData['disp_row'])) {
$val_ordered_current_row++;
if (PMA_strlen($val_ordered_current_val) <= $cfg['LimitChars']) {
if ($GLOBALS['PMA_String']::strlen($val_ordered_current_val) <= $cfg['LimitChars']) {
$val_ordered_current_val = htmlspecialchars(
$val_ordered_current_val
);
@ -251,11 +251,11 @@ if (is_array($foreignData['disp_row'])) {
$val_ordered_current_val
);
$val_ordered_current_val = htmlspecialchars(
PMA_substr($val_ordered_current_val, 0, $cfg['LimitChars'])
$GLOBALS['PMA_String']::substr($val_ordered_current_val, 0, $cfg['LimitChars'])
. '...'
);
}
if (PMA_strlen($key_ordered_current_val) <= $cfg['LimitChars']) {
if ($GLOBALS['PMA_String']::strlen($key_ordered_current_val) <= $cfg['LimitChars']) {
$key_ordered_current_val = htmlspecialchars(
$key_ordered_current_val
);
@ -265,7 +265,7 @@ if (is_array($foreignData['disp_row'])) {
$key_ordered_current_val
);
$key_ordered_current_val = htmlspecialchars(
PMA_substr(
$GLOBALS['PMA_String']::substr(
$key_ordered_current_val, 0, $cfg['LimitChars']
) . '...'
);

View File

@ -1559,11 +1559,11 @@ Browse mode
.. config:option:: $cfg['MaxRows']
:type: integer
:default: 30
:default: 25
Number of rows displayed when browsing a result set and no LIMIT
clause is used. If the result set contains more rows, "Previous" and
"Next" links will be shown.
"Next" links will be shown. Possible values: 25,50,100,250,500.
.. config:option:: $cfg['Order']

View File

@ -128,7 +128,7 @@ var AJAX = {
// leave the browser deal with it natively (e.g: file download)
// or leave an existing ajax event handler present elsewhere deal with it
var href = $(this).attr('href');
if (event.shiftKey || event.ctrlKey) {
if (typeof event != 'undefined' && (event.shiftKey || event.ctrlKey)) {
return true;
} else if ($(this).attr('target')) {
return true;

View File

@ -1634,7 +1634,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
e.preventDefault();
// get the click count and increase
var clicks = $cell.data('clicks');
clicks = (clicks === null) ? 1 : clicks + 1;
clicks = (typeof clicks === 'undefined') ? 1 : clicks + 1;
if (clicks == 1) {
// if there are no previous clicks,

View File

@ -170,7 +170,6 @@ AJAX.registerTeardown('server_privileges.js', function () {
$("#fieldset_add_user_login input[name='username']").die("focusout");
$("#fieldset_add_user a.ajax").die("click");
$('form[name=usersForm]').unbind('submit');
$("#reload_privileges_anchor.ajax").die("click");
$("#fieldset_delete_user_footer #buttonGo.ajax").die('click');
$("a.edit_user_anchor.ajax").die('click');
$("#edit_user_dialog").find("form.ajax").die('submit');
@ -252,29 +251,6 @@ AJAX.registerOnload('server_privileges.js', function () {
});//end of Add New User AJAX event handler
/**
* Ajax event handler for 'Reload Privileges' anchor
*
* @see PMA_ajaxShowMessage()
* @memberOf jQuery
* @name reload_privileges_click
*/
$("#reload_privileges_anchor.ajax").live("click", function (event) {
event.preventDefault();
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strReloadingPrivileges);
$.get($(this).attr("href"), {'ajax_request': true}, function (data) {
if (data.success === true) {
PMA_ajaxRemoveMessage($msgbox);
} else {
PMA_ajaxShowMessage(data.error, false);
}
}); //end $.get()
}); //end of Reload Privileges Ajax event handler
/**
* AJAX handler for 'Revoke User'
*

View File

@ -456,7 +456,7 @@ class PMA_Config
}
$commit = false;
if ( !isset($_SESSION['PMA_VERSION_COMMITDATA_' . $hash])) {
if (! isset($_SESSION['PMA_VERSION_COMMITDATA_' . $hash])) {
$git_file_name = $git_folder . '/objects/' . substr($hash, 0, 2)
. '/' . substr($hash, 2);
if (file_exists($git_file_name) ) {
@ -469,7 +469,9 @@ class PMA_Config
} else {
$pack_names = array();
// work with packed data
if ($packs = @file_get_contents($git_folder . '/objects/info/packs')) {
if (file_exists($git_folder . '/objects/info/packs')
&& $packs = @file_get_contents($git_folder . '/objects/info/packs')
) {
// File exists. Read it, parse the file to get the names of the
// packs. (to look for them in .git/object/pack directory later)
foreach (explode("\n", $packs) as $line) {

View File

@ -874,8 +874,8 @@ class PMA_DisplayResults
/**
* Prepare feilds followed by Show button for table navigation
* Start row, Number of rows, Headers every
* Prepare fields followed by Show button for table navigation
* Start row, Number of rows
*
* @param string $html_sql_query the sql encoded by html special
* characters
@ -898,22 +898,26 @@ class PMA_DisplayResults
. 'value="' . $html_sql_query . '" />'
. '<input type="hidden" name="goto" value="' . $this->__get('goto')
. '" />'
. '<input type="submit" name="navig"'
. ' class="ajax"'
. ' value="' . __('Show:') . '" />'
. __('Start row:') . ' ' . "\n"
. '<input type="text" name="pos" size="3" value="'
. '<input type="hidden" name="pos" size="3" value="'
. (($pos_next >= $this->__get('unlim_num_rows')) ? 0 : $pos_next)
. '" class="textfield" onfocus="this.select()" />'
. __('Number of rows:') . ' ' . "\n"
. '<input type="text" name="session_max_rows" size="3" value="'
. (($_SESSION['tmp_user_values']['max_rows'] != self::ALL_ROWS)
? $_SESSION['tmp_user_values']['max_rows']
: $GLOBALS['cfg']['MaxRows'])
. '" class="textfield" onfocus="this.select()" />';
. '" />'
. __('Number of rows:') . ' '
. '<select name="session_max_rows" class="autosubmit">';
$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>';
if ($GLOBALS['cfg']['ShowDisplayDirection']) {
// Display mode (horizontal/vertical and repeat headers)
// Display mode (horizontal/vertical)
$additional_fields_html .= __('Mode:') . ' ' . "\n";
$choices = array(
'horizontal' => __('horizontal'),
@ -929,13 +933,6 @@ class PMA_DisplayResults
unset($choices);
}
$additional_fields_html .= sprintf(
__('Headers every %s rows'),
'<input type="text" size="3" name="repeat_cells" value="'
. $_SESSION['tmp_user_values']['repeat_cells']
. '" class="textfield" onfocus="this.select()" /> '
);
return $additional_fields_html;
} // end of the '_getAdditionalFieldsForTableNavigation()' function
@ -3657,11 +3654,11 @@ class PMA_DisplayResults
// if a transform function for blob is set, none of these
// replacements will be made
if ((PMA_strlen($column) > $GLOBALS['cfg']['LimitChars'])
if (($GLOBALS['PMA_String']::strlen($column) > $GLOBALS['cfg']['LimitChars'])
&& ($_SESSION['tmp_user_values']['display_text'] == self::DISPLAY_PARTIAL_TEXT)
&& ! $this->_isNeedToSyntaxHighlight(strtolower($meta->name))
) {
$column = PMA_substr($column, 0, $GLOBALS['cfg']['LimitChars'])
$column = $GLOBALS['PMA_String']::substr($column, 0, $GLOBALS['cfg']['LimitChars'])
. '...';
$is_field_truncated = true;
}
@ -3748,10 +3745,10 @@ class PMA_DisplayResults
// Convert to WKT format
$wktval = PMA_Util::asWKT($column);
if ((PMA_strlen($wktval) > $GLOBALS['cfg']['LimitChars'])
if (($GLOBALS['PMA_String']::strlen($wktval) > $GLOBALS['cfg']['LimitChars'])
&& ($_SESSION['tmp_user_values']['display_text'] == self::DISPLAY_PARTIAL_TEXT)
) {
$wktval = PMA_substr($wktval, 0, $GLOBALS['cfg']['LimitChars'])
$wktval = $GLOBALS['PMA_String']::substr($wktval, 0, $GLOBALS['cfg']['LimitChars'])
. '...';
$is_field_truncated = true;
}
@ -3772,11 +3769,11 @@ class PMA_DisplayResults
$wkbval = $this->_displayBinaryAsPrintable($column, 'binary', 8);
if ((PMA_strlen($wkbval) > $GLOBALS['cfg']['LimitChars'])
if (($GLOBALS['PMA_String']::strlen($wkbval) > $GLOBALS['cfg']['LimitChars'])
&& ($_SESSION['tmp_user_values']['display_text'] == self::DISPLAY_PARTIAL_TEXT)
) {
$wkbval
= PMA_substr($wkbval, 0, $GLOBALS['cfg']['LimitChars'])
= $GLOBALS['PMA_String']::substr($wkbval, 0, $GLOBALS['cfg']['LimitChars'])
. '...';
$is_field_truncated = true;
}
@ -3859,12 +3856,12 @@ class PMA_DisplayResults
// Cut all fields to $GLOBALS['cfg']['LimitChars']
// (unless it's a link-type transformation)
if (PMA_strlen($column) > $GLOBALS['cfg']['LimitChars']
if ($GLOBALS['PMA_String']::strlen($column) > $GLOBALS['cfg']['LimitChars']
&& ($_SESSION['tmp_user_values']['display_text'] == self::DISPLAY_PARTIAL_TEXT)
&& gettype($transformation_plugin) == "object"
&& ! strpos($transformation_plugin->getName(), 'Link') === true
) {
$column = PMA_substr($column, 0, $GLOBALS['cfg']['LimitChars'])
$column = $GLOBALS['PMA_String']::substr($column, 0, $GLOBALS['cfg']['LimitChars'])
. '...';
$is_field_truncated = true;
}
@ -4229,11 +4226,7 @@ class PMA_DisplayResults
= $GLOBALS['cfg']['DefaultDisplay'];
}
if (PMA_isValid($_REQUEST['repeat_cells'], 'numeric')) {
$_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells']
= $_REQUEST['repeat_cells'];
unset($_REQUEST['repeat_cells']);
} elseif (
if (
empty($_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells'])
) {
$_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells']
@ -6015,7 +6008,7 @@ class PMA_DisplayResults
) {
$content = bin2hex($content);
if ($hexlength !== null) {
$content = PMA_substr($content, $hexlength);
$content = $GLOBALS['PMA_String']::substr($content, $hexlength);
}
} else {
$content = htmlspecialchars(

View File

@ -0,0 +1,74 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Specialized String Class for phpMyAdmin
*
* Defines a set of function callbacks that have a pure C version available if
* the "ctype" extension is available, but otherwise have PHP versions to use
* (that are slower).
*
* The SQL Parser code relies heavily on these functions.
*
* @package PhpMyAdmin-String
* @subpackage MB
*/
if (! defined('PHPMYADMIN')) {
exit;
}
class PMA_StringMB
{
/**
* Returns length of string depending on current charset.
*
* @param string $string string to count
*
* @return int string length
*/
public static function strlen($string)
{
return mb_strlen($string);
}
/**
* Returns substring from string, works depending on current charset.
*
* @param string $string string to count
* @param int $start start of substring
* @param int $length length of substring
*
* @return string the sub string
*/
public static function substr($string, $start, $length = 2147483647)
{
return mb_substr($string, $start, $length);
}
/**
* Returns postion of $needle in $haystack or false if not found
*
* @param string $haystack the string being checked
* @param string $needle the string to find in haystack
* @param int $offset the search offset
*
* @return integer position of $needle in $haystack or false
*/
public static function strpos($haystack, $needle, $offset = 0)
{
return mb_strpos($haystack, $needle, $offset);
}
/**
* Make a string lowercase
*
* @param string $string the string being lowercased
*
* @return string the lower case string
*/
public static function strtolower($string)
{
return mb_strtolower($string);
}
}
?>

View File

@ -0,0 +1,73 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Specialized String Class for phpMyAdmin
*
* Defines a set of function callbacks that have a pure C version available if
* the "ctype" extension is available, but otherwise have PHP versions to use
* (that are slower).
*
* The SQL Parser code relies heavily on these functions.
*
* @package PhpMyAdmin-String
* @subpackage Native
*/
if (! defined('PHPMYADMIN')) {
exit;
}
class PMA_StringNative
{
/**
* Returns length of string depending on current charset.
*
* @param string $string string to count
*
* @return int string length
*/
public static function strlen($string)
{
return strlen($string);
}
/**
* Returns substring from string, works depending on current charset.
*
* @param string $string string to count
* @param int $start start of substring
* @param int $length length of substring
*
* @return string the sub string
*/
public static function substr($string, $start, $length = 2147483647)
{
return substr($string, $start, $length);
}
/**
* Returns postion of $needle in $haystack or false if not found
*
* @param string $haystack the string being checked
* @param string $needle the string to find in haystack
* @param int $offset the search offset
*
* @return integer position of $needle in $haystack or false
*/
public static function strpos($haystack, $needle, $offset = 0)
{
return strpos($haystack, $needle, $offset);
}
/**
* Make a string lowercase
*
* @param string $string the string being lowercased
*
* @return string the lower case string
*/
public static function strtolower($string)
{
return strtolower($string);
}
};
?>

View File

@ -747,8 +747,8 @@ class PMA_Util
* - use PMA_Response() to transmit the message and exit
*/
if (isset($GLOBALS['is_ajax_request'])
&& $GLOBALS['is_ajax_request'] == true
) {
&& $GLOBALS['is_ajax_request'] == true
) {
$response = PMA_Response::getInstance();
$response->isSuccess(false);
$response->addJSON('message', $error_msg);
@ -3318,7 +3318,9 @@ class PMA_Util
/* Fetch columns list if required */
if (strpos($string, '@COLUMNS@') !== false) {
$columns_list = $GLOBALS['dbi']->getColumns($GLOBALS['db'], $GLOBALS['table']);
$columns_list = $GLOBALS['dbi']->getColumns(
$GLOBALS['db'], $GLOBALS['table']
);
// sometimes the table no longer exists at this point
if (! is_null($columns_list)) {

View File

@ -1040,10 +1040,11 @@ $cfg['ShowAll'] = false;
/**
* Number of rows displayed when browsing a result set. If the result
* set contains more rows, "Previous" and "Next".
* Possible values: 25,50,100,250,500
*
* @global integer $cfg['MaxRows']
*/
$cfg['MaxRows'] = 30;
$cfg['MaxRows'] = 25;
/**
* default for 'ORDER BY' clause (valid values are 'ASC', 'DESC' or 'SMART' -ie

View File

@ -50,6 +50,7 @@ $cfg_db['NavigationBarIconic'] = array(
false => __('Text'),
'both' => __('Both')
);
$cfg_db['MaxRows'] = array(25,50,100,250,500);
$cfg_db['Order'] = array('ASC', 'DESC', 'SMART');
$cfg_db['RowActionLinks'] = array(
'none' => __('Nowhere'),

View File

@ -886,12 +886,9 @@ class PMA_NavigationTree
'indexes'
);
$parent = $node->parents(false, true);
$isNewView = $parent[0]->real_name == 'views' && $node->isNew == true;
if ($parent[0]->type == Node::CONTAINER
&& (in_array($parent[0]->real_name, $haveAjax)
|| ($parent[0]->real_name == 'views'
&& $node->isNew == true
)
)
&& (in_array($parent[0]->real_name, $haveAjax) || $isNewView)
) {
$linkClass = ' class="ajax"';
}

View File

@ -82,7 +82,9 @@ class Node_Database extends Node
);
$query .= "%'";
}
$retval = $GLOBALS['dbi']->numRows($GLOBALS['dbi']->tryQuery($query));
$retval = $GLOBALS['dbi']->numRows(
$GLOBALS['dbi']->tryQuery($query)
);
}
break;
case 'views':
@ -113,7 +115,9 @@ class Node_Database extends Node
);
$query .= "%'";
}
$retval = $GLOBALS['dbi']->numRows($GLOBALS['dbi']->tryQuery($query));
$retval = $GLOBALS['dbi']->numRows(
$GLOBALS['dbi']->tryQuery($query)
);
}
break;
case 'procedures':
@ -141,7 +145,9 @@ class Node_Database extends Node
);
$query .= "%'";
}
$retval = $GLOBALS['dbi']->numRows($GLOBALS['dbi']->tryQuery($query));
$retval = $GLOBALS['dbi']->numRows(
$GLOBALS['dbi']->tryQuery($query)
);
}
break;
case 'functions':
@ -169,7 +175,9 @@ class Node_Database extends Node
);
$query .= "%'";
}
$retval = $GLOBALS['dbi']->numRows($GLOBALS['dbi']->tryQuery($query));
$retval = $GLOBALS['dbi']->numRows(
$GLOBALS['dbi']->tryQuery($query)
);
}
break;
case 'events':
@ -196,7 +204,9 @@ class Node_Database extends Node
);
$query .= "%'";
}
$retval = $GLOBALS['dbi']->numRows($GLOBALS['dbi']->tryQuery($query));
$retval = $GLOBALS['dbi']->numRows(
$GLOBALS['dbi']->tryQuery($query)
);
}
break;
default:

View File

@ -69,14 +69,18 @@ class Node_Table extends Node
$db = PMA_Util::backquote($db);
$table = PMA_Util::backquote($table);
$query = "SHOW COLUMNS FROM $table FROM $db";
$retval = (int)$GLOBALS['dbi']->numRows($GLOBALS['dbi']->tryQuery($query));
$retval = (int)$GLOBALS['dbi']->numRows(
$GLOBALS['dbi']->tryQuery($query)
);
}
break;
case 'indexes':
$db = PMA_Util::backquote($db);
$table = PMA_Util::backquote($table);
$query = "SHOW INDEXES FROM $table FROM $db";
$retval = (int)$GLOBALS['dbi']->numRows($GLOBALS['dbi']->tryQuery($query));
$retval = (int)$GLOBALS['dbi']->numRows(
$GLOBALS['dbi']->tryQuery($query)
);
break;
case 'triggers':
if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
@ -91,7 +95,9 @@ class Node_Table extends Node
$db = PMA_Util::backquote($db);
$table = PMA_Util::sqlAddSlashes($table);
$query = "SHOW TRIGGERS FROM $db WHERE `Table` = '$table'";
$retval = (int)$GLOBALS['dbi']->numRows($GLOBALS['dbi']->tryQuery($query));
$retval = (int)$GLOBALS['dbi']->numRows(
$GLOBALS['dbi']->tryQuery($query)
);
}
break;
default:

View File

@ -334,7 +334,7 @@ function PMA_getSqlQueryAndCreateDbBeforeCopy()
'SHOW VARIABLES LIKE "lower_case_table_names"', 0, 1
);
if ($lower_case_table_names === '1') {
$_REQUEST['newname'] = PMA_strtolower($_REQUEST['newname']);
$_REQUEST['newname'] = $GLOBALS['PMA_String']::strtolower($_REQUEST['newname']);
}
}

View File

@ -73,6 +73,31 @@ $is_count = isset($analyzed_sql[0]['queryflags']['is_count']);
// check for a real SELECT ... FROM
$is_select = isset($analyzed_sql[0]['queryflags']['select_from']);
// checks whether the sorting order should be remembered
if ($GLOBALS['cfg']['RememberSorting']
&& ! ($is_count || $is_export || $is_func || $is_analyse)
&& isset($analyzed_sql[0]['select_expr'])
&& (count($analyzed_sql[0]['select_expr']) == 0)
&& isset($analyzed_sql[0]['queryflags']['select_from'])
&& count($analyzed_sql[0]['table_ref']) == 1
) {
$is_remember_sorting_order = true;
} else {
$is_remember_sorting_order = false;
}
// checks whether a LIMIT clause should be added to the query
if (($_SESSION['tmp_user_values']['max_rows'] != 'all')
&& ! ($is_count || $is_export || $is_func || $is_analyse)
&& isset($analyzed_sql[0]['queryflags']['select_from'])
&& ! isset($analyzed_sql[0]['queryflags']['offset'])
&& empty($analyzed_sql[0]['limit_clause'])
) {
$is_append_limit_clause = true;
} else {
$is_append_limit_clause = false;
}
// If the query is a Select, extract the db and table names and modify
// $db and $table, to have correct page headers, links and left frame.
// db and table name may be enclosed with backquotes, db is optionnal,

View File

@ -64,9 +64,9 @@ abstract class SubstringTransformationsPlugin extends TransformationsPlugin
$newtext = '';
if ($options[1] != 'all') {
$newtext = PMA_substr($buffer, $options[0], $options[1]);
$newtext = $GLOBALS['PMA_String']::substr($buffer, $options[0], $options[1]);
} else {
$newtext = PMA_substr($buffer, $options[0]);
$newtext = $GLOBALS['PMA_String']::substr($buffer, $options[0]);
}
$length = strlen($newtext);

View File

@ -970,7 +970,7 @@ function PMA_buildForeignDropdown($foreign, $data, $mode)
}
foreach ($foreign as $key => $value) {
if (PMA_strlen($value) <= $GLOBALS['cfg']['LimitChars']) {
if ($GLOBALS['PMA_String']::strlen($value) <= $GLOBALS['cfg']['LimitChars']) {
$vtitle = '';
$value = htmlspecialchars($value);
} else {

View File

@ -234,9 +234,9 @@ function PMA_getAllLogItemInfo($result, $dontlimitchars)
$odd_row = true;
while ($value = $GLOBALS['dbi']->fetchAssoc($result)) {
if (! $dontlimitchars
&& PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']
&& $GLOBALS['PMA_String']::strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']
) {
$value['Info'] = PMA_substr(
$value['Info'] = $GLOBALS['PMA_String']::substr(
$value['Info'], 0, $GLOBALS['cfg']['LimitChars']
) . '...';
}

View File

@ -2991,8 +2991,7 @@ function PMA_getHtmlForDisplayUserOverviewPage($link_edit, $pmaThemeImage,
PMA_Message::NOTICE
);
$flushLink = '<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;'
. 'flush_privileges=1" id="reload_privileges_anchor" '
. 'class="' . $conditional_class . '">';
. 'flush_privileges=1" id="reload_privileges_anchor">';
$flushnote->addParam(
$flushLink,
false

View File

@ -648,4 +648,56 @@ function PMA_getHtmlForOptionsList($values, $selected_values)
}
return $options;
}
/**
* Get HTML for the Bookmark form
*
* @param string $db the current database
* @param string $goto goto page url
* @param string $bkm_sql_query the query to be bookmarked
* @param string $bkm_user the user creating the bookmark
*/
function PMA_getHtmlForBookmark($db, $goto, $bkm_sql_query, $bkm_user)
{
$html = '<form action="sql.php" method="post"'
. ' onsubmit="return ! emptyFormElements(this, \'bkm_fields[bkm_label]\');"'
. ' id="bookmarkQueryForm">';
$html .= PMA_generate_common_hidden_inputs();
$html .= '<input type="hidden" name="goto" value="' . $goto . '" />';
$html .= '<input type="hidden" name="bkm_fields[bkm_database]"'
. ' value="' . htmlspecialchars($db) . '" />';
$html .= '<input type="hidden" name="bkm_fields[bkm_user]"'
. ' value="' . $bkm_user . '" />';
$html .= '<input type="hidden" name="bkm_fields[bkm_sql_query]"' . ' value="'
. $bkm_sql_query
. '" />';
$html .= '<fieldset>';
$html .= '<legend>';
$html .= PMA_Util::getIcon(
'b_bookmark.png', __('Bookmark this SQL query'), true
);
$html .= '</legend>';
$html .= '<div class="formelement">';
$html .= '<label for="fields_label_">' . __('Label:') . '</label>';
$html .= '<input type="text" id="fields_label_"'
. ' name="bkm_fields[bkm_label]" value="" />';
$html .= '</div>';
$html .= '<div class="formelement">';
$html .= '<input type="checkbox" name="bkm_all_users"'
. ' id="bkm_all_users" value="true" />';
$html .= '<label for="bkm_all_users">'
. __('Let every user access this bookmark')
. '</label>';
$html .= '</div>';
$html .= '<div class="clearfloat"></div>';
$html .= '</fieldset>';
$html .= '<fieldset class="tblFooters">';
$html .= '<input type="hidden" name="store_bkm" value="1" />';
$html .= '<input type="submit"'
. ' value="' . __('Bookmark this SQL query') . '" />';
$html .= '</fieldset>';
$html .= '</form>';
return $html;
}
?>

View File

@ -229,7 +229,7 @@ function PMA_SQP_parse($sql)
$sql = str_replace("\r\n", "\n", $sql);
$sql = str_replace("\r", "\n", $sql);
$len = PMA_strlen($sql);
$len = $GLOBALS['PMA_String']::strlen($sql);
if ($len == 0) {
return array();
}
@ -295,7 +295,7 @@ function PMA_SQP_parse($sql)
$this_was_quote = false;
while ($count2 < $len) {
$c = PMA_substr($sql, $count2, 1);
$c = $GLOBALS['PMA_String']::substr($sql, $count2, 1);
$count1 = $count2;
$previous_was_space = $this_was_space;
@ -327,11 +327,11 @@ function PMA_SQP_parse($sql)
// MySQL style #
// C style /* */
// ANSI style --
$next_c = PMA_substr($sql, $count2 + 1, 1);
$next_c = $GLOBALS['PMA_String']::substr($sql, $count2 + 1, 1);
if (($c == '#')
|| (($count2 + 1 < $len) && ($c == '/') && ($next_c == '*'))
|| (($count2 + 2 == $len) && ($c == '-') && ($next_c == '-'))
|| (($count2 + 2 < $len) && ($c == '-') && ($next_c == '-') && ((PMA_substr($sql, $count2 + 2, 1) <= ' ')))
|| (($count2 + 2 < $len) && ($c == '-') && ($next_c == '-') && (($GLOBALS['PMA_String']::substr($sql, $count2 + 2, 1) <= ' ')))
) {
$count2++;
$pos = 0;
@ -341,24 +341,24 @@ function PMA_SQP_parse($sql)
$type = 'mysql';
case '-':
$type = 'ansi';
$pos = PMA_strpos($sql, "\n", $count2);
$pos = $GLOBALS['PMA_String']::strpos($sql, "\n", $count2);
break;
case '/':
$type = 'c';
$pos = PMA_strpos($sql, '*/', $count2);
$pos = $GLOBALS['PMA_String']::strpos($sql, '*/', $count2);
$pos += 2;
break;
default:
break;
} // end switch
$count2 = ($pos < $count2) ? $len : $pos;
$str = PMA_substr($sql, $count1, $count2 - $count1);
$str = $GLOBALS['PMA_String']::substr($sql, $count1, $count2 - $count1);
PMA_SQP_arrayAdd($sql_array, 'comment_' . $type, $str, $arraysize);
continue;
} // end if
// Checks for something inside quotation marks
if (PMA_strpos($quote_list, $c) !== false) {
if ($GLOBALS['PMA_String']::strpos($quote_list, $c) !== false) {
$startquotepos = $count2;
$quotetype = $c;
$count2++;
@ -366,7 +366,7 @@ function PMA_SQP_parse($sql)
$oldpos = 0;
do {
$oldpos = $pos;
$pos = PMA_strpos(' ' . $sql, $quotetype, $oldpos + 1) - 1;
$pos = $GLOBALS['PMA_String']::strpos(' ' . $sql, $quotetype, $oldpos + 1) - 1;
// ($pos === false)
if ($pos < 0) {
if ($c == '`') {
@ -381,7 +381,7 @@ function PMA_SQP_parse($sql)
*
* SELECT * FROM `table`
*/
$pos_quote_separator = PMA_strpos(
$pos_quote_separator = $GLOBALS['PMA_String']::strpos(
' ' . $sql, $GLOBALS['sql_delimiter'], $oldpos + 1
) - 1;
if ($pos_quote_separator < 0) {
@ -391,8 +391,8 @@ function PMA_SQP_parse($sql)
$pos = $len;
} else {
$len += 1;
$sql = PMA_substr($sql, 0, $pos_quote_separator)
. '`' . PMA_substr($sql, $pos_quote_separator);
$sql = $GLOBALS['PMA_String']::substr($sql, 0, $pos_quote_separator)
. '`' . $GLOBALS['PMA_String']::substr($sql, $pos_quote_separator);
$sql_array['raw'] = $sql;
$pos = $pos_quote_separator;
}
@ -427,8 +427,8 @@ function PMA_SQP_parse($sql)
$pos ++;
continue;
} elseif (($pos + 1 < $len)
&& (PMA_substr($sql, $pos, 1) == $quotetype)
&& (PMA_substr($sql, $pos + 1, 1) == $quotetype)
&& ($GLOBALS['PMA_String']::substr($sql, $pos, 1) == $quotetype)
&& ($GLOBALS['PMA_String']::substr($sql, $pos + 1, 1) == $quotetype)
) {
$pos = $pos + 2;
continue;
@ -456,27 +456,27 @@ function PMA_SQP_parse($sql)
default:
break;
} // end switch
$data = PMA_substr($sql, $count1, $count2 - $count1);
$data = $GLOBALS['PMA_String']::substr($sql, $count1, $count2 - $count1);
PMA_SQP_arrayAdd($sql_array, $type, $data, $arraysize);
continue;
}
// Checks for brackets
if (PMA_strpos($bracket_list, $c) !== false) {
if ($GLOBALS['PMA_String']::strpos($bracket_list, $c) !== false) {
// All bracket tokens are only one item long
$this_was_bracket = true;
$count2++;
$type_type = '';
if (PMA_strpos('([{', $c) !== false) {
if ($GLOBALS['PMA_String']::strpos('([{', $c) !== false) {
$type_type = 'open';
} else {
$type_type = 'close';
}
$type_style = '';
if (PMA_strpos('()', $c) !== false) {
if ($GLOBALS['PMA_String']::strpos('()', $c) !== false) {
$type_style = 'round';
} elseif (PMA_strpos('[]', $c) !== false) {
} elseif ($GLOBALS['PMA_String']::strpos('[]', $c) !== false) {
$type_style = 'square';
} else {
$type_style = 'curly';
@ -492,7 +492,7 @@ function PMA_SQP_parse($sql)
var_dump(PMA_STR_isSqlIdentifier($c, false));
var_dump($c == '@');
var_dump($c == '.');
var_dump(PMA_STR_isDigit(PMA_substr($sql, $count2 + 1, 1)));
var_dump(PMA_STR_isDigit($GLOBALS['PMA_String']::substr($sql, $count2 + 1, 1)));
var_dump($previous_was_space);
var_dump($previous_was_bracket);
var_dump($previous_was_listsep);
@ -503,11 +503,11 @@ function PMA_SQP_parse($sql)
if (PMA_STR_isSqlIdentifier($c, false)
|| $c == '@'
|| ($c == '.'
&& PMA_STR_isDigit(PMA_substr($sql, $count2 + 1, 1))
&& PMA_STR_isDigit($GLOBALS['PMA_String']::substr($sql, $count2 + 1, 1))
&& ($previous_was_space || $previous_was_bracket || $previous_was_listsep))
) {
/* DEBUG
echo PMA_substr($sql, $count2);
echo $GLOBALS['PMA_String']::substr($sql, $count2);
echo '<hr />';
*/
@ -530,7 +530,7 @@ function PMA_SQP_parse($sql)
$is_digit
&& $c == '0'
&& $count2 < $len
&& PMA_substr($sql, $count2, 1) == 'x'
&& $GLOBALS['PMA_String']::substr($sql, $count2, 1) == 'x'
);
$is_float_digit = $c == '.';
$is_float_digit_exponent = false;
@ -560,8 +560,8 @@ function PMA_SQP_parse($sql)
unset($pos);
}
while (($count2 < $len) && PMA_STR_isSqlIdentifier(PMA_substr($sql, $count2, 1), ($is_sql_variable || $is_digit))) {
$c2 = PMA_substr($sql, $count2, 1);
while (($count2 < $len) && PMA_STR_isSqlIdentifier($GLOBALS['PMA_String']::substr($sql, $count2, 1), ($is_sql_variable || $is_digit))) {
$c2 = $GLOBALS['PMA_String']::substr($sql, $count2, 1);
if ($is_sql_variable && ($c2 == '.')) {
$count2++;
continue;
@ -575,7 +575,7 @@ function PMA_SQP_parse($sql)
$debugstr = __('Invalid Identifer')
. ' @ ' . ($count1+1) . "\n"
. 'STR: ' . htmlspecialchars(
PMA_substr($sql, $count1, $count2 - $count1)
$GLOBALS['PMA_String']::substr($sql, $count1, $count2 - $count1)
);
PMA_SQP_throwError($debugstr, $sql);
return $sql_array;
@ -604,7 +604,7 @@ function PMA_SQP_parse($sql)
} // end while
$l = $count2 - $count1;
$str = PMA_substr($sql, $count1, $l);
$str = $GLOBALS['PMA_String']::substr($sql, $count1, $l);
$type = '';
if ($is_digit || $is_float_digit || $is_hex_digit) {
@ -629,15 +629,15 @@ function PMA_SQP_parse($sql)
}
// Checks for punct
if (PMA_strpos($allpunct_list, $c) !== false) {
while (($count2 < $len) && PMA_strpos($allpunct_list, PMA_substr($sql, $count2, 1)) !== false) {
if ($GLOBALS['PMA_String']::strpos($allpunct_list, $c) !== false) {
while (($count2 < $len) && $GLOBALS['PMA_String']::strpos($allpunct_list, $GLOBALS['PMA_String']::substr($sql, $count2, 1)) !== false) {
$count2++;
}
$l = $count2 - $count1;
if ($l == 1) {
$punct_data = $c;
} else {
$punct_data = PMA_substr($sql, $count1, $l);
$punct_data = $GLOBALS['PMA_String']::substr($sql, $count1, $l);
}
// Special case, sometimes, althought two characters are
@ -678,12 +678,12 @@ function PMA_SQP_parse($sql)
if (($first == ',') || ($first == ';') || ($first == '.') || ($first == '*')) {
$count2 = $count1 + 1;
$punct_data = $first;
} elseif (($last2 == '/*') || (($last2 == '--') && ($count2 == $len || PMA_substr($sql, $count2, 1) <= ' '))) {
} elseif (($last2 == '/*') || (($last2 == '--') && ($count2 == $len || $GLOBALS['PMA_String']::substr($sql, $count2, 1) <= ' '))) {
$count2 -= 2;
$punct_data = PMA_substr($sql, $count1, $count2 - $count1);
$punct_data = $GLOBALS['PMA_String']::substr($sql, $count1, $count2 - $count1);
} elseif (($last == '-') || ($last == '+') || ($last == '!')) {
$count2--;
$punct_data = PMA_substr($sql, $count1, $count2 - $count1);
$punct_data = $GLOBALS['PMA_String']::substr($sql, $count1, $count2 - $count1);
} elseif ($last != '~') {
/**
* @todo for negation operator, split in 2 tokens ?
@ -706,7 +706,7 @@ function PMA_SQP_parse($sql)
$count2++;
$debugstr = 'C1 C2 LEN: ' . $count1 . ' ' . $count2 . ' ' . $len . "\n"
. 'STR: ' . PMA_substr($sql, $count1, $count2 - $count1) . "\n";
. 'STR: ' . $GLOBALS['PMA_String']::substr($sql, $count1, $count2 - $count1) . "\n";
PMA_SQP_bug($debugstr, $sql);
return $sql_array;
@ -1809,10 +1809,10 @@ function PMA_SQP_analyze($arr)
$seen_order_by = true;
// Here we assume that the ORDER BY keywords took
// exactly 8 characters.
// We use PMA_substr() to be charset-safe; otherwise
// We use $GLOBALS['PMA_String']::substr() to be charset-safe; otherwise
// if the table name contains accents, the unsorted
// query would be missing some characters.
$unsorted_query = PMA_substr(
$unsorted_query = $GLOBALS['PMA_String']::substr(
$arr['raw'], 0, $arr[$i]['pos'] - 8
);
$in_order_by = true;

View File

@ -21,9 +21,11 @@ if (! defined('PHPMYADMIN')) {
*/
if (@function_exists('mb_strlen')) {
mb_internal_encoding('utf-8');
include './libraries/string_mb.lib.php';
include './libraries/StringMB.class.php';
$PMA_String = new PMA_StringMB();
} else {
include './libraries/string_native.lib.php';
include './libraries/StringNative.class.php';
$PMA_String = new PMA_StringNative();
}
/**
@ -48,7 +50,7 @@ function PMA_STR_charIsEscaped($string, $pos, $start = 0)
{
$pos = max(intval($pos), 0);
$start = max(intval($start), 0);
$len = PMA_strlen($string);
$len = $GLOBALS['PMA_String']::strlen($string);
// Base case:
// Check for string length or invalid input or special case of input
// (pos == $start)
@ -58,7 +60,7 @@ function PMA_STR_charIsEscaped($string, $pos, $start = 0)
$pos--;
$escaped = false;
while ($pos >= $start && PMA_substr($string, $pos, 1) == '\\') {
while ($pos >= $start && $GLOBALS['PMA_String']::substr($string, $pos, 1) == '\\') {
$escaped = !$escaped;
$pos--;
} // end while

View File

@ -1,71 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Specialized String Functions for phpMyAdmin
*
* Defines a set of function callbacks that have a pure C version available if
* the "ctype" extension is available, but otherwise have PHP versions to use
* (that are slower).
*
* The SQL Parser code relies heavily on these functions.
*
* @package PhpMyAdmin-String
* @subpackage MB
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Returns length of string depending on current charset.
*
* @param string $string string to count
*
* @return int string length
*/
function PMA_strlen($string)
{
return mb_strlen($string);
}
/**
* Returns substring from string, works depending on current charset.
*
* @param string $string string to count
* @param int $start start of substring
* @param int $length length of substring
*
* @return string the sub string
*/
function PMA_substr($string, $start, $length = 2147483647)
{
return mb_substr($string, $start, $length);
}
/**
* Returns postion of $needle in $haystack or false if not found
*
* @param string $haystack the string being checked
* @param string $needle the string to find in haystack
* @param int $offset the search offset
*
* @return integer position of $needle in $haystack or false
*/
function PMA_strpos($haystack, $needle, $offset = 0)
{
return mb_strpos($haystack, $needle, $offset);
}
/**
* Make a string lowercase
*
* @param string $string the string being lowercased
*
* @return string the lower case string
*/
function PMA_strtolower($string)
{
return mb_strtolower($string);
}
?>

View File

@ -1,71 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Specialized String Functions for phpMyAdmin
*
* Defines a set of function callbacks that have a pure C version available if
* the "ctype" extension is available, but otherwise have PHP versions to use
* (that are slower).
*
* The SQL Parser code relies heavily on these functions.
*
* @package PhpMyAdmin-String
* @subpackage Native
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Returns length of string depending on current charset.
*
* @param string $string string to count
*
* @return int string length
*/
function PMA_strlen($string)
{
return strlen($string);
}
/**
* Returns substring from string, works depending on current charset.
*
* @param string $string string to count
* @param int $start start of substring
* @param int $length length of substring
*
* @return string the sub string
*/
function PMA_substr($string, $start, $length = 2147483647)
{
return substr($string, $start, $length);
}
/**
* Returns postion of $needle in $haystack or false if not found
*
* @param string $haystack the string being checked
* @param string $needle the string to find in haystack
* @param int $offset the search offset
*
* @return integer position of $needle in $haystack or false
*/
function PMA_strpos($haystack, $needle, $offset = 0)
{
return strpos($haystack, $needle, $offset);
}
/**
* Make a string lowercase
*
* @param string $string the string being lowercased
*
* @return string the lower case string
*/
function PMA_strtolower($string)
{
return strtolower($string);
}
?>

View File

@ -22,11 +22,6 @@ if (! $cfgRelation['designerwork']) {
*/
$post_params = array(
'die_save_pos',
'server',
't_h',
't_v',
't_x',
't_y'
);
foreach ($post_params as $one_post_param) {
@ -35,7 +30,7 @@ foreach ($post_params as $one_post_param) {
}
}
foreach ($t_x as $key => $value) {
foreach ($_POST['t_x'] as $key => $value) {
// table name decode (post PDF exp/imp)
$KEY = empty($_POST['IS_AJAX']) ? urldecode($key) : $key;
list($DB,$TAB) = explode(".", $KEY);
@ -54,10 +49,10 @@ foreach ($t_x as $key => $value) {
. ' VALUES ('
. '\'' . PMA_Util::sqlAddSlashes($DB) . '\', '
. '\'' . PMA_Util::sqlAddSlashes($TAB) . '\', '
. '\'' . PMA_Util::sqlAddSlashes($t_x[$key]) . '\', '
. '\'' . PMA_Util::sqlAddSlashes($t_y[$key]) . '\', '
. '\'' . PMA_Util::sqlAddSlashes($t_v[$key]) . '\', '
. '\'' . PMA_Util::sqlAddSlashes($t_h[$key]) . '\')',
. '\'' . PMA_Util::sqlAddSlashes($_POST['t_x'][$key]) . '\', '
. '\'' . PMA_Util::sqlAddSlashes($_POST['t_y'][$key]) . '\', '
. '\'' . PMA_Util::sqlAddSlashes($_POST['t_v'][$key]) . '\', '
. '\'' . PMA_Util::sqlAddSlashes($_POST['t_h'][$key]) . '\')',
true, PMA_DatabaseInterface::QUERY_STORE
);
}

939
po/af.po

File diff suppressed because it is too large Load Diff

976
po/ar.po

File diff suppressed because it is too large Load Diff

941
po/az.po

File diff suppressed because it is too large Load Diff

953
po/be.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

920
po/bg.po

File diff suppressed because it is too large Load Diff

953
po/bn.po

File diff suppressed because it is too large Load Diff

945
po/br.po

File diff suppressed because it is too large Load Diff

960
po/bs.po

File diff suppressed because it is too large Load Diff

968
po/ca.po

File diff suppressed because it is too large Load Diff

902
po/ckb.po

File diff suppressed because it is too large Load Diff

944
po/cs.po

File diff suppressed because it is too large Load Diff

955
po/cy.po

File diff suppressed because it is too large Load Diff

952
po/da.po

File diff suppressed because it is too large Load Diff

984
po/de.po

File diff suppressed because it is too large Load Diff

958
po/el.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

959
po/es.po

File diff suppressed because it is too large Load Diff

947
po/et.po

File diff suppressed because it is too large Load Diff

947
po/eu.po

File diff suppressed because it is too large Load Diff

937
po/fa.po

File diff suppressed because it is too large Load Diff

970
po/fi.po

File diff suppressed because it is too large Load Diff

952
po/fr.po

File diff suppressed because it is too large Load Diff

968
po/gl.po

File diff suppressed because it is too large Load Diff

949
po/he.po

File diff suppressed because it is too large Load Diff

961
po/hi.po

File diff suppressed because it is too large Load Diff

957
po/hr.po

File diff suppressed because it is too large Load Diff

949
po/hu.po

File diff suppressed because it is too large Load Diff

895
po/hy.po

File diff suppressed because it is too large Load Diff

895
po/ia.po

File diff suppressed because it is too large Load Diff

1308
po/id.po

File diff suppressed because it is too large Load Diff

968
po/it.po

File diff suppressed because it is too large Load Diff

961
po/ja.po

File diff suppressed because it is too large Load Diff

965
po/ka.po

File diff suppressed because it is too large Load Diff

899
po/kk.po

File diff suppressed because it is too large Load Diff

895
po/kn.po

File diff suppressed because it is too large Load Diff

965
po/ko.po

File diff suppressed because it is too large Load Diff

922
po/lt.po

File diff suppressed because it is too large Load Diff

949
po/lv.po

File diff suppressed because it is too large Load Diff

949
po/mk.po

File diff suppressed because it is too large Load Diff

899
po/ml.po

File diff suppressed because it is too large Load Diff

953
po/mn.po

File diff suppressed because it is too large Load Diff

939
po/ms.po

File diff suppressed because it is too large Load Diff

974
po/nb.po

File diff suppressed because it is too large Load Diff

973
po/nl.po

File diff suppressed because it is too large Load Diff

895
po/pa.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

966
po/pl.po

File diff suppressed because it is too large Load Diff

946
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

969
po/ro.po

File diff suppressed because it is too large Load Diff

958
po/ru.po

File diff suppressed because it is too large Load Diff

950
po/si.po

File diff suppressed because it is too large Load Diff

910
po/sk.po

File diff suppressed because it is too large Load Diff

959
po/sl.po

File diff suppressed because it is too large Load Diff

944
po/sq.po

File diff suppressed because it is too large Load Diff

947
po/sr.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

956
po/sv.po

File diff suppressed because it is too large Load Diff

915
po/ta.po

File diff suppressed because it is too large Load Diff

941
po/te.po

File diff suppressed because it is too large Load Diff

943
po/th.po

File diff suppressed because it is too large Load Diff

895
po/tk.po

File diff suppressed because it is too large Load Diff

949
po/tr.po

File diff suppressed because it is too large Load Diff

949
po/tt.po

File diff suppressed because it is too large Load Diff

937
po/ug.po

File diff suppressed because it is too large Load Diff

966
po/uk.po

File diff suppressed because it is too large Load Diff

962
po/ur.po

File diff suppressed because it is too large Load Diff

971
po/uz.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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