Merge branch 'master' of https://github.com/phpmyadmin/phpmyadmin into 0616_server_replication
This commit is contained in:
commit
c6fb4c4d5f
106
libraries/StringCType.class.php
Normal file
106
libraries/StringCType.class.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?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 CType
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class PMA_StringCType
|
||||
{
|
||||
/**
|
||||
* Checks if a character is an alphanumeric one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an alphanumeric one or not
|
||||
*/
|
||||
public static function isAlnum($c)
|
||||
{
|
||||
return ctype_alnum($c);
|
||||
} // end of the "isAlnum()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is an alphabetic one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an alphabetic one or not
|
||||
*/
|
||||
public static function isAlpha($c)
|
||||
{
|
||||
return ctype_alpha($c);
|
||||
} // end of the "isAlpha()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is a digit
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is a digit or not
|
||||
*/
|
||||
public static function isDigit($c)
|
||||
{
|
||||
return ctype_digit($c);
|
||||
} // end of the "isDigit()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is an upper alphabetic one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an upper alphabetic one or not
|
||||
*/
|
||||
public static function isUpper($c)
|
||||
{
|
||||
return ctype_upper($c);
|
||||
} // end of the "isUpper()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is a lower alphabetic one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is a lower alphabetic one or not
|
||||
*/
|
||||
public static function isLower($c)
|
||||
{
|
||||
return ctype_lower($c);
|
||||
} // end of the "PisLower()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is a space one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is a space one or not
|
||||
*/
|
||||
public static function isSpace($c)
|
||||
{
|
||||
return ctype_space($c);
|
||||
} // end of the "isSpace()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is an hexadecimal digit
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an hexadecimal digit or not
|
||||
*/
|
||||
public static function isHexDigit($c)
|
||||
{
|
||||
return ctype_xdigit($c);
|
||||
} // end of the "isHexDigit()" function
|
||||
}
|
||||
?>
|
||||
135
libraries/StringNativeType.class.php
Normal file
135
libraries/StringNativeType.class.php
Normal file
@ -0,0 +1,135 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
class PMA_StringNativeType
|
||||
{
|
||||
/**
|
||||
* Checks if a character is an alphanumeric one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an alphanumeric one or not
|
||||
*/
|
||||
public static function isAlnum($c)
|
||||
{
|
||||
return (self::isUpper($c) || self::isLower($c) || self::isDigit($c));
|
||||
} // end of the "isAlnum()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is an alphabetic one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an alphabetic one or not
|
||||
*/
|
||||
public static function isAlpha($c)
|
||||
{
|
||||
return ($GLOBALS['PMA_StringType']::isUpper($c) || $GLOBALS['PMA_StringType']::isLower($c));
|
||||
} // end of the "isAlpha()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is a digit
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is a digit or not
|
||||
*/
|
||||
public static function isDigit($c)
|
||||
{
|
||||
$ord_zero = 48; //ord('0');
|
||||
$ord_nine = 57; //ord('9');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
|
||||
} // end of the "isDigit()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is an upper alphabetic one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an upper alphabetic one or not
|
||||
*/
|
||||
public static function isUpper($c)
|
||||
{
|
||||
$ord_zero = 65; //ord('A');
|
||||
$ord_nine = 90; //ord('Z');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
|
||||
} // end of the "isUpper()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is a lower alphabetic one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is a lower alphabetic one or not
|
||||
*/
|
||||
public static function isLower($c)
|
||||
{
|
||||
$ord_zero = 97; //ord('a');
|
||||
$ord_nine = 122; //ord('z');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
|
||||
} // end of the "isLower()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is a space one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is a space one or not
|
||||
*/
|
||||
public static function isSpace($c)
|
||||
{
|
||||
$ord_space = 32; //ord(' ')
|
||||
$ord_tab = 9; //ord('\t')
|
||||
$ord_CR = 13; //ord('\n')
|
||||
$ord_NOBR = 160; //ord('U+00A0);
|
||||
$ord_c = ord($c);
|
||||
|
||||
return ($ord_c == $ord_space
|
||||
|| $ord_c == $ord_NOBR
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_tab, $ord_CR));
|
||||
} // end of the "isSpace()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is an hexadecimal digit
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an hexadecimal digit or not
|
||||
*/
|
||||
public static function isHexDigit($c)
|
||||
{
|
||||
$ord_Aupper = 65; //ord('A');
|
||||
$ord_Fupper = 70; //ord('F');
|
||||
$ord_Alower = 97; //ord('a');
|
||||
$ord_Flower = 102; //ord('f');
|
||||
$ord_zero = 48; //ord('0');
|
||||
$ord_nine = 57; //ord('9');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return (PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Aupper, $ord_Fupper)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Alower, $ord_Flower));
|
||||
} // end of the "isHexDigit()" function
|
||||
}
|
||||
?>
|
||||
@ -87,8 +87,7 @@ if ($GLOBALS['cfg']['RememberSorting']
|
||||
}
|
||||
|
||||
// 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)
|
||||
if (! ($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'])
|
||||
|
||||
@ -317,7 +317,7 @@ function PMA_SQP_parse($sql)
|
||||
}
|
||||
|
||||
// Checks for white space
|
||||
if (PMA_STR_isSpace($c)) {
|
||||
if ($GLOBALS['PMA_StringType']::isSpace($c)) {
|
||||
$this_was_space = true;
|
||||
$count2++;
|
||||
continue;
|
||||
@ -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($GLOBALS['PMA_String']::substr($sql, $count2 + 1, 1)));
|
||||
var_dump($GLOBALS['PMA_StringType']::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,7 +503,7 @@ function PMA_SQP_parse($sql)
|
||||
if (PMA_STR_isSqlIdentifier($c, false)
|
||||
|| $c == '@'
|
||||
|| ($c == '.'
|
||||
&& PMA_STR_isDigit($GLOBALS['PMA_String']::substr($sql, $count2 + 1, 1))
|
||||
&& $GLOBALS['PMA_StringType']::isDigit($GLOBALS['PMA_String']::substr($sql, $count2 + 1, 1))
|
||||
&& ($previous_was_space || $previous_was_bracket || $previous_was_listsep))
|
||||
) {
|
||||
/* DEBUG
|
||||
@ -524,7 +524,7 @@ function PMA_SQP_parse($sql)
|
||||
$is_digit = (
|
||||
!$is_identifier
|
||||
&& !$is_sql_variable
|
||||
&& PMA_STR_isDigit($c)
|
||||
&& $GLOBALS['PMA_StringType']::isDigit($c)
|
||||
);
|
||||
$is_hex_digit = (
|
||||
$is_digit
|
||||
@ -592,7 +592,7 @@ function PMA_SQP_parse($sql)
|
||||
$is_float_digit = false;
|
||||
}
|
||||
}
|
||||
if (($is_hex_digit && PMA_STR_isHexDigit($c2)) || ($is_digit && PMA_STR_isDigit($c2))) {
|
||||
if (($is_hex_digit && $GLOBALS['PMA_StringType']::isHexDigit($c2)) || ($is_digit && $GLOBALS['PMA_StringType']::isDigit($c2))) {
|
||||
$count2++;
|
||||
continue;
|
||||
} else {
|
||||
|
||||
@ -32,9 +32,11 @@ if (@function_exists('mb_strlen')) {
|
||||
* Load ctype handler.
|
||||
*/
|
||||
if (@extension_loaded('ctype')) {
|
||||
include './libraries/string_type_ctype.lib.php';
|
||||
include './libraries/StringCType.class.php';
|
||||
$PMA_StringType = new PMA_StringCType();
|
||||
} else {
|
||||
include './libraries/string_type_native.lib.php';
|
||||
include './libraries/String_NativeType.class.php';
|
||||
$PMA_StringType = new PMA_StringNativeType();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,8 +94,8 @@ function PMA_STR_numberInRangeInclusive($num, $lower, $upper)
|
||||
* @return boolean whether the character is an SQL identifier or not
|
||||
*/
|
||||
function PMA_STR_isSqlIdentifier($c, $dot_is_valid = false)
|
||||
{
|
||||
return (PMA_STR_isAlnum($c)
|
||||
{
|
||||
return ($GLOBALS['PMA_StringType']::isAlnum($c)
|
||||
|| ($ord_c = ord($c)) && $ord_c >= 192 && $ord_c != 215 && $ord_c != 249
|
||||
|| $c == '_'
|
||||
|| $c == '$'
|
||||
|
||||
@ -1,104 +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 CType
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a character is an alphanumeric one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an alphanumeric one or not
|
||||
*/
|
||||
function PMA_STR_isAlnum($c)
|
||||
{
|
||||
return ctype_alnum($c);
|
||||
} // end of the "PMA_STR_isAlnum()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is an alphabetic one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an alphabetic one or not
|
||||
*/
|
||||
function PMA_STR_isAlpha($c)
|
||||
{
|
||||
return ctype_alpha($c);
|
||||
} // end of the "PMA_STR_isAlpha()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is a digit
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is a digit or not
|
||||
*/
|
||||
function PMA_STR_isDigit($c)
|
||||
{
|
||||
return ctype_digit($c);
|
||||
} // end of the "PMA_STR_isDigit()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is an upper alphabetic one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an upper alphabetic one or not
|
||||
*/
|
||||
function PMA_STR_isUpper($c)
|
||||
{
|
||||
return ctype_upper($c);
|
||||
} // end of the "PMA_STR_isUpper()" function
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a character is a lower alphabetic one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is a lower alphabetic one or not
|
||||
*/
|
||||
function PMA_STR_isLower($c)
|
||||
{
|
||||
return ctype_lower($c);
|
||||
} // end of the "PMA_STR_isLower()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is a space one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is a space one or not
|
||||
*/
|
||||
function PMA_STR_isSpace($c)
|
||||
{
|
||||
return ctype_space($c);
|
||||
} // end of the "PMA_STR_isSpace()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is an hexadecimal digit
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an hexadecimal digit or not
|
||||
*/
|
||||
function PMA_STR_isHexDigit($c)
|
||||
{
|
||||
return ctype_xdigit($c);
|
||||
} // end of the "PMA_STR_isHexDigit()" function
|
||||
|
||||
?>
|
||||
@ -1,133 +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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a character is an alphanumeric one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an alphanumeric one or not
|
||||
*/
|
||||
function PMA_STR_isAlnum($c)
|
||||
{
|
||||
return (PMA_STR_isUpper($c) || PMA_STR_isLower($c) || PMA_STR_isDigit($c));
|
||||
} // end of the "PMA_STR_isAlnum()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is an alphabetic one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an alphabetic one or not
|
||||
*/
|
||||
function PMA_STR_isAlpha($c)
|
||||
{
|
||||
return (PMA_STR_isUpper($c) || PMA_STR_isLower($c));
|
||||
} // end of the "PMA_STR_isAlpha()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is a digit
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is a digit or not
|
||||
*/
|
||||
function PMA_STR_isDigit($c)
|
||||
{
|
||||
$ord_zero = 48; //ord('0');
|
||||
$ord_nine = 57; //ord('9');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
|
||||
} // end of the "PMA_STR_isDigit()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is an upper alphabetic one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an upper alphabetic one or not
|
||||
*/
|
||||
function PMA_STR_isUpper($c)
|
||||
{
|
||||
$ord_zero = 65; //ord('A');
|
||||
$ord_nine = 90; //ord('Z');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
|
||||
} // end of the "PMA_STR_isUpper()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is a lower alphabetic one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is a lower alphabetic one or not
|
||||
*/
|
||||
function PMA_STR_isLower($c)
|
||||
{
|
||||
$ord_zero = 97; //ord('a');
|
||||
$ord_nine = 122; //ord('z');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
|
||||
} // end of the "PMA_STR_isLower()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is a space one
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is a space one or not
|
||||
*/
|
||||
function PMA_STR_isSpace($c)
|
||||
{
|
||||
$ord_space = 32; //ord(' ')
|
||||
$ord_tab = 9; //ord('\t')
|
||||
$ord_CR = 13; //ord('\n')
|
||||
$ord_NOBR = 160; //ord('U+00A0);
|
||||
$ord_c = ord($c);
|
||||
|
||||
return ($ord_c == $ord_space
|
||||
|| $ord_c == $ord_NOBR
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_tab, $ord_CR));
|
||||
} // end of the "PMA_STR_isSpace()" function
|
||||
|
||||
/**
|
||||
* Checks if a character is an hexadecimal digit
|
||||
*
|
||||
* @param string $c character to check for
|
||||
*
|
||||
* @return boolean whether the character is an hexadecimal digit or not
|
||||
*/
|
||||
function PMA_STR_isHexDigit($c)
|
||||
{
|
||||
$ord_Aupper = 65; //ord('A');
|
||||
$ord_Fupper = 70; //ord('F');
|
||||
$ord_Alower = 97; //ord('a');
|
||||
$ord_Flower = 102; //ord('f');
|
||||
$ord_zero = 48; //ord('0');
|
||||
$ord_nine = 57; //ord('9');
|
||||
$ord_c = ord($c);
|
||||
|
||||
return (PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Aupper, $ord_Fupper)
|
||||
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Alower, $ord_Flower));
|
||||
} // end of the "PMA_STR_isHexDigit()" function
|
||||
|
||||
?>
|
||||
@ -12,20 +12,6 @@
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/pmd_common.php';
|
||||
|
||||
/**
|
||||
* Sets globals from $_GET
|
||||
*/
|
||||
$get_params = array(
|
||||
'db',
|
||||
'table',
|
||||
'token'
|
||||
);
|
||||
foreach ($get_params as $one_get_param) {
|
||||
if (isset($_GET[$one_get_param])) {
|
||||
$GLOBALS[$one_get_param] = $_GET[$one_get_param];
|
||||
}
|
||||
}
|
||||
|
||||
$script_display_field = get_tables_info();
|
||||
$tab_column = get_columns_info();
|
||||
$script_tables = get_script_tabs();
|
||||
@ -35,8 +21,8 @@ $tables_pk_or_unique_keys = get_pk_or_unique_keys();
|
||||
$tables_all_keys = get_all_keys();
|
||||
|
||||
$params = array('lang' => $GLOBALS['lang']);
|
||||
if (isset($GLOBALS['db'])) {
|
||||
$params['db'] = $GLOBALS['db'];
|
||||
if (isset($_GET['db'])) {
|
||||
$params['db'] = $_GET['db'];
|
||||
}
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
@ -60,10 +46,10 @@ echo '<div id="script_server" class="hide">';
|
||||
echo htmlspecialchars($GLOBALS['server']);
|
||||
echo '</div>';
|
||||
echo '<div id="script_db" class="hide">';
|
||||
echo htmlspecialchars($GLOBALS['db']);
|
||||
echo htmlspecialchars($_GET['db']);
|
||||
echo '</div>';
|
||||
echo '<div id="script_token" class="hide">';
|
||||
echo htmlspecialchars($GLOBALS['token']);
|
||||
echo htmlspecialchars($_GET['token']);
|
||||
echo '</div>';
|
||||
echo '<div id="script_tables" class="hide">';
|
||||
echo htmlspecialchars(json_encode($script_tables));
|
||||
@ -295,7 +281,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
|
||||
echo 'style="display: none;"';
|
||||
}
|
||||
echo '>';
|
||||
$display_field = PMA_getDisplayField($db, $GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]);
|
||||
$display_field = PMA_getDisplayField($_GET['db'], $GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]);
|
||||
for ($j = 0, $id_cnt = count($tab_column[$t_n]["COLUMN_ID"]); $j < $id_cnt; $j++) {
|
||||
?>
|
||||
<tr id="id_tr_<?php
|
||||
@ -864,7 +850,7 @@ if (! empty($_REQUEST['query'])) {
|
||||
echo '<textarea cols="80" name="sql_query" id="textSqlquery" rows="15"></textarea><div id="tblfooter">';
|
||||
echo ' <input type="submit" name="submit_sql" class="btn" />';
|
||||
echo ' <input type="button" name="cancel" value="' . __('Cancel') . '" onclick="closebox()" class="btn" />';
|
||||
echo PMA_generate_common_hidden_inputs($GLOBALS['db']);
|
||||
echo PMA_generate_common_hidden_inputs($_GET['db']);
|
||||
echo '</div></p>';
|
||||
echo '</form></div>';
|
||||
|
||||
|
||||
11
po/ug.po
11
po/ug.po
@ -7,16 +7,15 @@ msgstr ""
|
||||
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
|
||||
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
|
||||
"POT-Creation-Date: 2013-06-20 08:22+0200\n"
|
||||
"PO-Revision-Date: 2012-11-05 10:16+0200\n"
|
||||
"Last-Translator: Michal Čihař <michal@cihar.com>\n"
|
||||
"Language-Team: Uighur <http://l10n.cihar.com/projects/phpmyadmin/master/ug/"
|
||||
">\n"
|
||||
"PO-Revision-Date: 2013-06-20 20:19+0200\n"
|
||||
"Last-Translator: gheni <gheni@yahoo.cn>\n"
|
||||
"Language-Team: Uighur <http://l10n.cihar.com/projects/phpmyadmin/master/ug/>\n"
|
||||
"Language: ug\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Weblate 1.3-dev\n"
|
||||
"X-Generator: Weblate 1.6-dev\n"
|
||||
|
||||
#: browse_foreigners.php:51 browse_foreigners.php:75 js/messages.php:335
|
||||
#: libraries/DisplayResults.class.php:809
|
||||
@ -108,6 +107,8 @@ msgid ""
|
||||
"The %s file is not available on this system, please visit www.phpmyadmin.net "
|
||||
"for more information."
|
||||
msgstr ""
|
||||
"The %s file is not available on this system, please visit www.phpmyadmin.net "
|
||||
"for more information."
|
||||
|
||||
#: db_create.php:60
|
||||
#, php-format
|
||||
|
||||
404
po/zh_TW.po
404
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
4
sql.php
4
sql.php
@ -319,7 +319,9 @@ if ($is_remember_sorting_order) {
|
||||
|
||||
$sql_limit_to_append = '';
|
||||
// Do append a "LIMIT" clause?
|
||||
if ($is_append_limit_clause) {
|
||||
if (($_SESSION['tmp_user_values']['max_rows'] != 'all')
|
||||
&& $is_append_limit_clause
|
||||
) {
|
||||
$sql_limit_to_append = ' LIMIT ' . $_SESSION['tmp_user_values']['pos']
|
||||
. ', ' . $_SESSION['tmp_user_values']['max_rows'] . " ";
|
||||
$full_sql_query = PMA_getSqlWithLimitClause(
|
||||
|
||||
184
test/libraries/PMA_StringMB_test.php
Normal file
184
test/libraries/PMA_StringMB_test.php
Normal file
@ -0,0 +1,184 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Tests for Specialized String Functions (multi-byte) for phpMyAdmin
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/StringMB.class.php';
|
||||
|
||||
/**
|
||||
* Tests for Specialized String Functions (multi-byte) for phpMyAdmin
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class PMA_String_Mb_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $internal_encoding;
|
||||
|
||||
/**
|
||||
* Setup function for test cases
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->internal_encoding = mb_internal_encoding();
|
||||
}
|
||||
|
||||
/**
|
||||
* TearDown function for tests, restores internal encoding
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
mb_internal_encoding($this->internal_encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringMB::strlen
|
||||
*
|
||||
* @param integer $length Length of the string
|
||||
* @param string $str String to check for
|
||||
* @param string $encoding Encoding of the string
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider mbStrlenData
|
||||
*/
|
||||
public function testMbStrlen($length, $str, $encoding)
|
||||
{
|
||||
mb_internal_encoding($encoding);
|
||||
$this->assertEquals(
|
||||
$length,
|
||||
PMA_StringMB::strlen($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testMbStrlen
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function mbStrlenData()
|
||||
{
|
||||
return array(
|
||||
array(2, "ab", "UTF-8"),
|
||||
array(9, "åèö - doo", "UTF-8"),
|
||||
array(12, "åèö - doo", "ISO-8859-1")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringMB::substr
|
||||
*
|
||||
* @param string $str Expected substring
|
||||
* @param string $haystack String to check in
|
||||
* @param int $start Starting position of substring
|
||||
* @param int $length Length of substring
|
||||
* @param string $encoding Encoding of the string
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider mbSubStrData
|
||||
*/
|
||||
public function testMbSubStr($str, $haystack, $start, $length, $encoding)
|
||||
{
|
||||
mb_internal_encoding($encoding);
|
||||
$this->assertEquals(
|
||||
$str,
|
||||
PMA_StringMB::substr($haystack, $start, $length)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testMbSubStr
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function mbSubStrData()
|
||||
{
|
||||
return array(
|
||||
array("b", "ab", 1, 1, "UTF-8"),
|
||||
array("èö", "åèö - doo", 1, 2, "UTF-8"),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringMB::strpos
|
||||
*
|
||||
* @param int $pos Expected position
|
||||
* @param string $haystack String to search in
|
||||
* @param string $needle String to search for
|
||||
* @param int $offset Search offset
|
||||
* @param string $encoding Encoding to test against
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider mbStrposData
|
||||
*/
|
||||
public function testMbStrpos($pos, $haystack, $needle, $offset, $encoding)
|
||||
{
|
||||
mb_internal_encoding($encoding);
|
||||
$this->assertEquals(
|
||||
$pos,
|
||||
PMA_StringMB::strpos($haystack, $needle, $offset)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testMbStrpos
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function mbStrposData()
|
||||
{
|
||||
return array(
|
||||
array(1, "ab", "b", 0, "UTF-8"),
|
||||
array(2, "åèö - doo", "ö", 0, "UTF-8"),
|
||||
array(6, "åèöè", "è", 3, "ISO-8859-1")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringMB::strtolower
|
||||
*
|
||||
* @param string $expected Expected lowercased string
|
||||
* @param string $string String to convert to lowercase
|
||||
* @param string $encoding Encoding to test against
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider mbStrToLowerData
|
||||
*/
|
||||
public function testMbStrToLower($expected, $string, $encoding)
|
||||
{
|
||||
mb_internal_encoding($encoding);
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringMB::strtolower($string)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testMbStrpos
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function mbStrToLowerData()
|
||||
{
|
||||
return array(
|
||||
array("mary had a", "Mary Had A", "UTF-8"),
|
||||
array("τάχιστη", "Τάχιστη", "UTF-8")
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
151
test/libraries/PMA_StringNative_test.php
Normal file
151
test/libraries/PMA_StringNative_test.php
Normal file
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Tests for Specialized String Functions (native) for phpMyAdmin
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/StringNative.class.php';
|
||||
|
||||
/**
|
||||
* Tests for Specialized String Functions (native) for phpMyAdmin
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class PMA_StringNative_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Test for PMA_StringNative::strlen
|
||||
*
|
||||
* @param integer $length Length of the string
|
||||
* @param string $str String to check for
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider nativeStrlenData
|
||||
*/
|
||||
public function testNativeStrlen($length, $str)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$length,
|
||||
PMA_StringNative::strlen($str)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testNativeStrlen
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function nativeStrlenData()
|
||||
{
|
||||
return array(
|
||||
array(2, "ab"),
|
||||
array(9, "test data"),
|
||||
array(0, "")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringNative::substr
|
||||
*
|
||||
* @param string $str Expected substring
|
||||
* @param string $haystack String to check in
|
||||
* @param int $start Starting position of substring
|
||||
* @param int $length Length of substring
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider nativeSubStrData
|
||||
*/
|
||||
public function testNativeSubStr($str, $haystack, $start, $length)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$str,
|
||||
PMA_StringNative::substr($haystack, $start, $length)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testNativeSubStr
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function nativeSubStrData()
|
||||
{
|
||||
return array(
|
||||
array("b", "ab", 1, 1),
|
||||
array("data", "testdata", 4, 4)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringNative::strpos
|
||||
*
|
||||
* @param int $pos Expected position
|
||||
* @param string $haystack String to search in
|
||||
* @param string $needle String to search for
|
||||
* @param int $offset Search offset
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider nativeStrposData
|
||||
*/
|
||||
public function testNativeStrpos($pos, $haystack, $needle, $offset)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$pos,
|
||||
PMA_StringNative::strpos($haystack, $needle, $offset)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testNativeStrpos
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function nativeStrposData()
|
||||
{
|
||||
return array(
|
||||
array(1, "ab", "b", 0),
|
||||
array(4, "test data", " ", 0)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_StringNative::strtolower
|
||||
*
|
||||
* @param string $expected Expected lowercased string
|
||||
* @param string $string String to convert to lowercase
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider nativeStrToLowerData
|
||||
*/
|
||||
public function testNativeStrToLower($expected, $string)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_StringNative::strtolower($string)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testNativeStrpos
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function nativeStrToLowerData()
|
||||
{
|
||||
return array(
|
||||
array("mary had a", "Mary Had A", "UTF-8"),
|
||||
array("test string", "TEST STRING", "UTF-8")
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
148
test/libraries/PMA_string_test.php
Normal file
148
test/libraries/PMA_string_test.php
Normal file
@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Tests for Specialized String Functions for phpMyAdmin
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/string.lib.php';
|
||||
require_once 'libraries/StringNativeType.class.php';
|
||||
/**
|
||||
* Tests for Specialized String Functions for phpMyAdmin
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class PMA_String_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup function for test cases
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$GLOBALS['PMA_StringType'] = new PMA_StringNativeType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Str_charIsEscaped
|
||||
*
|
||||
* @param boolean $expected Expected value from test
|
||||
* @param string $str String to check for
|
||||
* @param integer $pos Character to check for
|
||||
* @param integer $start Starting position of string
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider charIsEscapedData
|
||||
*/
|
||||
public function testCharIsEscaped($expected, $str, $pos, $start)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_STR_charIsEscaped($str, $pos, $start)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testCharIsEscaped
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function charIsEscapedData()
|
||||
{
|
||||
return array(
|
||||
array(false, 'test', -1, 0),
|
||||
array(false, 'test', 5, 3),
|
||||
array(false, 'test', 3, 5),
|
||||
array(true, '\\test', 1, -1),
|
||||
array(false, '\\\\test', 2, -1),
|
||||
array(true, '\\\\tes\\t', 6, 0)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_STR_numberInRangeInclusive
|
||||
*
|
||||
* @param bool $expected Expected value from test
|
||||
* @param integer $num Number to check for
|
||||
* @param integer $lower Lower bound
|
||||
* @param integer $upper Upper bound
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider numberInRangeData
|
||||
*/
|
||||
public function testNumberInRangeInclusive(
|
||||
$expected, $num, $lower, $upper
|
||||
) {
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_STR_numberInRangeInclusive($num, $lower, $upper)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testNumberInRangeInclusive
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function numberInRangeData()
|
||||
{
|
||||
return array(
|
||||
array(true, 2, 2, 3),
|
||||
array(true, 5, 4, 5),
|
||||
array(true, 50, 0, 100),
|
||||
array(false, -1, 0, 20),
|
||||
array(false, 31, 0, 30)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_STR_isSqlIdentifier
|
||||
*
|
||||
* @param boolean $expected Expected value from test
|
||||
* @param string $c Character to check for
|
||||
* @param boolean $dot_is_valid whether the dot character is valid or not
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
* @dataProvider isSqlIdentifierData
|
||||
*/
|
||||
public function testIsSqlIdentifier($expected, $c, $dot_is_valid = false)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_STR_isSqlIdentifier($c, $dot_is_valid)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testIsSqlIdentifier
|
||||
*
|
||||
* @return array Test data
|
||||
*/
|
||||
public function isSqlIdentifierData()
|
||||
{
|
||||
return array(
|
||||
array(true, '2'),
|
||||
array(true, 'a'),
|
||||
array(true, '.', true),
|
||||
array(false, '.'),
|
||||
array(true, chr(192)),
|
||||
array(false, chr(215)),
|
||||
array(false, chr(249)),
|
||||
array(true, '_'),
|
||||
array(true, '$')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user