Git
Threads by month
- ----- 2025 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
July 2011
- 6 participants
- 320 discussions

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-7267-ge15d5de
by Piotr Przybylski 06 Jul '11
by Piotr Przybylski 06 Jul '11
06 Jul '11
The branch, master has been updated
via e15d5de30991885663c3538b46e4de02d41dd74b (commit)
from c8b2cf6bf30e9704b3d7d1582c43df26ad2a97ca (commit)
- Log -----------------------------------------------------------------
commit e15d5de30991885663c3538b46e4de02d41dd74b
Author: Piotr Przybylski <piotrprz(a)gmail.com>
Date: Wed Jul 6 19:29:54 2011 +0200
Add TO_SECONDS and UUID_SHORT to MySQL function list (only for supported versions)
-----------------------------------------------------------------------
Summary of changes:
libraries/data_mysql.inc.php | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/libraries/data_mysql.inc.php b/libraries/data_mysql.inc.php
index e457d57..d504d15 100644
--- a/libraries/data_mysql.inc.php
+++ b/libraries/data_mysql.inc.php
@@ -226,9 +226,11 @@ if ($cfg['ShowFunctionFields']) {
'SQRT',
'TAN',
'TO_DAYS',
+ 'TO_SECONDS',
'TIME_TO_SEC',
'UNCOMPRESSED_LENGTH',
'UNIX_TIMESTAMP',
+ 'UUID_SHORT',
'WEEK',
'WEEKDAY',
'WEEKOFYEAR',
@@ -256,6 +258,14 @@ if ($cfg['ShowFunctionFields']) {
'MPolyFromWKB',
),
);
+ // $restrict_functions holds all known functions, remove these that are unavailable on current server
+ if (PMA_MYSQL_INT_VERSION < 50500) {
+ $restrict_functions['FUNC_NUMBER'] = array_diff($restrict_functions['FUNC_NUMBER'], array('TO_SECONDS'));
+ }
+ if (PMA_MYSQL_INT_VERSION < 50120) {
+ $restrict_functions['FUNC_NUMBER'] = array_diff($restrict_functions['FUNC_NUMBER'], array('UUID_SHORT'));
+ }
+
if (empty($cfg['RestrictFunctions'])) {
$cfg['RestrictFunctions'] = $restrict_functions;
}
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-6554-g66158f6
by Piotr Przybylski 06 Jul '11
by Piotr Przybylski 06 Jul '11
06 Jul '11
The branch, master has been updated
via 66158f66c291b0ad1e627205d9381beeed061ded (commit)
via 511cf978f6a910a3d7376884d42d1c502298aeba (commit)
via 866d1da95a853cd35920253e53432c4f55ad61bf (commit)
via 87a539aea7240e7563e47927f10000368a921e90 (commit)
via c9df5b273323d9e8af0f86d7ce72e0e6d1728b0d (commit)
from 9e34ccf57cfc97c3cac6d7f9ceecd6e1cc89e10d (commit)
- Log -----------------------------------------------------------------
commit 66158f66c291b0ad1e627205d9381beeed061ded
Author: Piotr Przybylski <piotrprz(a)gmail.com>
Date: Wed Jul 6 17:46:18 2011 +0200
Move DefaultFunctions back to config.default.php
commit 511cf978f6a910a3d7376884d42d1c502298aeba
Author: Piotr Przybylski <piotrprz(a)gmail.com>
Date: Wed Jul 6 17:35:22 2011 +0200
Infer $cfg['Functions'] from $cfg['RestrictFunctions']
commit 866d1da95a853cd35920253e53432c4f55ad61bf
Author: Piotr Przybylski <piotrprz(a)gmail.com>
Date: Wed Jul 6 17:11:04 2011 +0200
Move ColumnTypes, AttributeTypes, Functions, RestrictColumnTypes, RestrictFunctions and DefaultFunctions to a separate file
commit 87a539aea7240e7563e47927f10000368a921e90
Author: Piotr Przybylski <piotrprz(a)gmail.com>
Date: Wed Jul 6 17:00:33 2011 +0200
Remove *Operators configuration variables
commit c9df5b273323d9e8af0f86d7ce72e0e6d1728b0d
Author: Piotr Przybylski <piotrprz(a)gmail.com>
Date: Wed Jul 6 16:33:27 2011 +0200
Removed unused variables
-----------------------------------------------------------------------
Summary of changes:
Documentation.html | 17 --
db_routines.php | 1 +
libraries/common.lib.php | 6 +-
libraries/config.default.php | 447 ++------------------------------------
libraries/data_mysql.inc.php | 276 +++++++++++++++++++++++
libraries/tbl_properties.inc.php | 3 +
tbl_change.php | 3 +
tbl_select.php | 74 +++++--
8 files changed, 356 insertions(+), 471 deletions(-)
create mode 100644 libraries/data_mysql.inc.php
diff --git a/Documentation.html b/Documentation.html
index 29054a2..0b3bd92 100644
--- a/Documentation.html
+++ b/Documentation.html
@@ -2392,23 +2392,6 @@ setfacl -d -m "g:www-data:rwx" tmp
<code>first_timestamp</code>, which is used for first timestamp column
in table.</dd>
- <dt id="cfg_NumOperators">$cfg['NumOperators'] array</dt>
- <dd>Operators available for search operations on numeric and date columns.
- </dd>
-
- <dt id="cfg_TextOperators">$cfg['TextOperators'] array</dt>
- <dd>Operators available for search operations on character columns.
- Note that we put <code>LIKE</code> by default instead of
- <code>LIKE %...%</code>, to avoid unintended performance problems
- in case of huge tables.</dd>
-
- <dt id="cfg_EnumOperators">$cfg['EnumOperators'] array</dt>
- <dd>Operators available for search operations on ENUM columns.</dd>
-
- <dt id="cfg_NullOperators">$cfg['NullOperators'] array</dt>
- <dd>Additional operators available for search operations when the
- column can be null.</dd>
-
</dl>
<!-- TRANSFORMATIONS -->
diff --git a/db_routines.php b/db_routines.php
index b9417fd..422ec76 100644
--- a/db_routines.php
+++ b/db_routines.php
@@ -13,6 +13,7 @@ require_once './libraries/common.inc.php';
require_once './libraries/common.lib.php';
require_once './libraries/db_routines.lib.php';
require_once './libraries/mysql_charsets.lib.php';
+require_once './libraries/data_mysql.inc.php';
/**
* Include JavaScript libraries
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 61f3102..6d64cb6 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -2872,7 +2872,7 @@ function PMA_getSupportedDatatypes($html = false, $selected = '')
foreach ($cfg['ColumnTypes'] as $key => $value) {
if (is_array($value)) {
$retval .= "<optgroup label='" . htmlspecialchars($key) . "'>";
- foreach ($value as $subkey => $subvalue) {
+ foreach ($value as $subvalue) {
if ($subvalue == $selected) {
$retval .= "<option selected='selected'>";
$retval .= $subvalue;
@@ -2896,9 +2896,9 @@ function PMA_getSupportedDatatypes($html = false, $selected = '')
}
} else {
$retval = array();
- foreach ($cfg['ColumnTypes'] as $key => $value) {
+ foreach ($cfg['ColumnTypes'] as $value) {
if (is_array($value)) {
- foreach ($value as $subkey => $subvalue) {
+ foreach ($value as $subvalue) {
if ($subvalue !== '-') {
$retval[] = $subvalue;
}
diff --git a/libraries/config.default.php b/libraries/config.default.php
index 809a48d..d54dc5a 100644
--- a/libraries/config.default.php
+++ b/libraries/config.default.php
@@ -2740,379 +2740,50 @@ $cfg['DBG']['sql'] = false;
*/
/**
- * Column types;
- * VARCHAR, TINYINT, TEXT and DATE are listed first, based on estimated popularity
+ * Column types
+ *
+ * Fill in this array to overwrite data from data_*.inc.php files
*
* @global array $cfg['ColumnTypes']
*/
-$cfg['ColumnTypes'] = array(
- // most used
- 'INT',
- 'VARCHAR',
- 'TEXT',
- 'DATE',
-
- // numeric
- 'NUMERIC' => array(
- 'TINYINT',
- 'SMALLINT',
- 'MEDIUMINT',
- 'INT',
- 'BIGINT',
- '-',
- 'DECIMAL',
- 'FLOAT',
- 'DOUBLE',
- 'REAL',
- '-',
- 'BIT',
- 'BOOLEAN',
- 'SERIAL',
- ),
-
-
- // Date/Time
- 'DATE and TIME' => array(
- 'DATE',
- 'DATETIME',
- 'TIMESTAMP',
- 'TIME',
- 'YEAR',
- ),
-
- // Text
- 'STRING' => array(
- 'CHAR',
- 'VARCHAR',
- '-',
- 'TINYTEXT',
- 'TEXT',
- 'MEDIUMTEXT',
- 'LONGTEXT',
- '-',
- 'BINARY',
- 'VARBINARY',
- '-',
- 'TINYBLOB',
- 'MEDIUMBLOB',
- 'BLOB',
- 'LONGBLOB',
- '-',
- 'ENUM',
- 'SET',
- ),
-
- 'SPATIAL' => array(
- 'GEOMETRY',
- 'POINT',
- 'LINESTRING',
- 'POLYGON',
- 'MULTIPOINT',
- 'MULTILINESTRING',
- 'MULTIPOLYGON',
- 'GEOMETRYCOLLECTION',
- ),
-);
+$cfg['ColumnTypes'] = array();
/**
* Attributes
*
+ * Fill in this array to overwrite data from data_*.inc.php files
+ *
* @global array $cfg['AttributeTypes']
*/
-$cfg['AttributeTypes'] = array(
- '',
- 'BINARY',
- 'UNSIGNED',
- 'UNSIGNED ZEROFILL',
- 'on update CURRENT_TIMESTAMP',
-);
-
+$cfg['AttributeTypes'] = array();
if ($cfg['ShowFunctionFields']) {
/**
* Available functions
*
+ * Fill in this array to overwrite data from data_*.inc.php files
+ *
* @global array $cfg['Functions']
*/
- $cfg['Functions'] = array(
- 'ABS',
- 'ACOS',
- 'ASCII',
- 'ASIN',
- 'ATAN',
- 'BIN',
- 'BIT_COUNT',
- 'BIT_LENGTH',
- 'CEILING',
- 'CHAR',
- 'CHAR_LENGTH',
- 'COMPRESS',
- 'CONNECTION_ID',
- 'COS',
- 'COT',
- 'CRC32',
- 'CURDATE',
- 'CURRENT_USER',
- 'CURTIME',
- 'DATABASE',
- 'DATE',
- 'DAYNAME',
- 'DAYOFMONTH',
- 'DAYOFWEEK',
- 'DAYOFYEAR',
- 'DEGREES',
- 'DES_DECRYPT',
- 'DES_ENCRYPT',
- 'ENCRYPT',
- 'EXP',
- 'FLOOR',
- 'FROM_DAYS',
- 'FROM_UNIXTIME',
- 'HEX',
- 'HOUR',
- 'INET_ATON',
- 'INET_NTOA',
- 'LAST_DAY',
- 'LENGTH',
- 'LN',
- 'LOAD_FILE',
- 'LOG',
- 'LOG10',
- 'LOG2',
- 'LOWER',
- 'LTRIM',
- 'MD5',
- 'MICROSECOND',
- 'MINUTE',
- 'MONTH',
- 'MONTHNAME',
- 'NOW',
- 'OCT',
- 'OLD_PASSWORD',
- 'ORD',
- 'PASSWORD',
- 'PI',
- 'QUARTER',
- 'QUOTE',
- 'RADIANS',
- 'RAND',
- 'REVERSE',
- 'ROUND',
- 'RTRIM',
- 'SECOND',
- 'SEC_TO_TIME',
- 'SHA1',
- 'SIGN',
- 'SIN',
- 'SOUNDEX',
- 'SPACE',
- 'SQRT',
- 'SYSDATE',
- 'TAN',
- 'TIME',
- 'TIMESTAMP',
- 'TIME_TO_SEC',
- 'TO_DAYS',
- 'TRIM',
- 'UNCOMPRESS',
- 'UNCOMPRESSED_LENGTH',
- 'UNHEX',
- 'UNIX_TIMESTAMP',
- 'UPPER',
- 'USER',
- 'UTC_DATE',
- 'UTC_TIME',
- 'UTC_TIMESTAMP',
- 'UUID',
- 'VERSION',
- 'WEEK',
- 'WEEKDAY',
- 'WEEKOFYEAR',
- 'YEAR',
- 'YEARWEEK',
- );
+ $cfg['Functions'] = array();
/**
* Which column types will be mapped to which Group?
*
+ * Fill in this array to overwrite data from data_*.inc.php files
+ *
* @global array $cfg['RestrictColumnTypes']
*/
- $cfg['RestrictColumnTypes'] = array(
- 'TINYINT' => 'FUNC_NUMBER',
- 'SMALLINT' => 'FUNC_NUMBER',
- 'MEDIUMINT' => 'FUNC_NUMBER',
- 'INT' => 'FUNC_NUMBER',
- 'BIGINT' => 'FUNC_NUMBER',
- 'DECIMAL' => 'FUNC_NUMBER',
- 'FLOAT' => 'FUNC_NUMBER',
- 'DOUBLE' => 'FUNC_NUMBER',
- 'REAL' => 'FUNC_NUMBER',
- 'BIT' => 'FUNC_NUMBER',
- 'BOOLEAN' => 'FUNC_NUMBER',
- 'SERIAL' => 'FUNC_NUMBER',
-
- 'DATE' => 'FUNC_DATE',
- 'DATETIME' => 'FUNC_DATE',
- 'TIMESTAMP' => 'FUNC_DATE',
- 'TIME' => 'FUNC_DATE',
- 'YEAR' => 'FUNC_DATE',
-
- 'CHAR' => 'FUNC_CHAR',
- 'VARCHAR' => 'FUNC_CHAR',
- 'TINYTEXT' => 'FUNC_CHAR',
- 'TEXT' => 'FUNC_CHAR',
- 'MEDIUMTEXT' => 'FUNC_CHAR',
- 'LONGTEXT' => 'FUNC_CHAR',
- 'BINARY' => 'FUNC_CHAR',
- 'VARBINARY' => 'FUNC_CHAR',
- 'TINYBLOB' => 'FUNC_CHAR',
- 'MEDIUMBLOB' => 'FUNC_CHAR',
- 'BLOB' => 'FUNC_CHAR',
- 'LONGBLOB' => 'FUNC_CHAR',
- 'ENUM' => '',
- 'SET' => '',
-
- 'GEOMETRY' => 'FUNC_SPATIAL',
- 'POINT' => 'FUNC_SPATIAL',
- 'LINESTRING' => 'FUNC_SPATIAL',
- 'POLYGON' => 'FUNC_SPATIAL',
- 'MULTIPOINT' => 'FUNC_SPATIAL',
- 'MULTILINESTRING' => 'FUNC_SPATIAL',
- 'MULTIPOLYGON' => 'FUNC_SPATIAL',
- 'GEOMETRYCOLLECTION' => 'FUNC_SPATIAL',
-
- );
+ $cfg['RestrictColumnTypes'] = array();
/**
* Map above defined groups to any function
*
+ * Fill in this array to overwrite data from data_*.inc.php files
+ *
* @global array $cfg['RestrictFunctions']
*/
- $cfg['RestrictFunctions'] = array(
- 'FUNC_CHAR' => array(
- 'BIN',
- 'CHAR',
- 'CURRENT_USER',
- 'COMPRESS',
- 'DATABASE',
- 'DAYNAME',
- 'DES_DECRYPT',
- 'DES_ENCRYPT',
- 'ENCRYPT',
- 'HEX',
- 'INET_NTOA',
- 'LOAD_FILE',
- 'LOWER',
- 'LTRIM',
- 'MD5',
- 'MONTHNAME',
- 'OLD_PASSWORD',
- 'PASSWORD',
- 'QUOTE',
- 'REVERSE',
- 'RTRIM',
- 'SHA1',
- 'SOUNDEX',
- 'SPACE',
- 'TRIM',
- 'UNCOMPRESS',
- 'UNHEX',
- 'UPPER',
- 'USER',
- 'UUID',
- ),
-
- 'FUNC_DATE' => array(
- 'CURDATE',
- 'CURTIME',
- 'DATE',
- 'FROM_DAYS',
- 'FROM_UNIXTIME',
- 'LAST_DAY',
- 'NOW',
- 'SEC_TO_TIME',
- 'SYSDATE',
- 'TIME',
- 'TIMESTAMP',
- 'UTC_DATE',
- 'UTC_TIME',
- 'UTC_TIMESTAMP',
- 'YEAR',
- ),
-
- 'FUNC_NUMBER' => array(
- 'ABS',
- 'ACOS',
- 'ASCII',
- 'ASIN',
- 'ATAN',
- 'BIT_LENGTH',
- 'BIT_COUNT',
- 'CEILING',
- 'CHAR_LENGTH',
- 'CONNECTION_ID',
- 'COS',
- 'COT',
- 'CRC32',
- 'DAYOFMONTH',
- 'DAYOFWEEK',
- 'DAYOFYEAR',
- 'DEGREES',
- 'EXP',
- 'FLOOR',
- 'HOUR',
- 'INET_ATON',
- 'LENGTH',
- 'LN',
- 'LOG',
- 'LOG2',
- 'LOG10',
- 'MICROSECOND',
- 'MINUTE',
- 'MONTH',
- 'OCT',
- 'ORD',
- 'PI',
- 'QUARTER',
- 'RADIANS',
- 'RAND',
- 'ROUND',
- 'SECOND',
- 'SIGN',
- 'SIN',
- 'SQRT',
- 'TAN',
- 'TO_DAYS',
- 'TIME_TO_SEC',
- 'UNCOMPRESSED_LENGTH',
- 'UNIX_TIMESTAMP',
- 'WEEK',
- 'WEEKDAY',
- 'WEEKOFYEAR',
- 'YEARWEEK',
- ),
-
- 'FUNC_SPATIAL' => array(
- 'GeomFromText',
- 'GeomFromWKB',
-
- 'GeomCollFromText',
- 'LineFromText',
- 'MLineFromText',
- 'PointFromText',
- 'MPointFromText',
- 'PolyFromText',
- 'MPolyFromText',
-
- 'GeomCollFromWKB',
- 'LineFromWKB',
- 'MLineFromWKB',
- 'PointFromWKB',
- 'MPointFromWKB',
- 'PolyFromWKB',
- 'MPolyFromWKB',
- ),
- );
+ $cfg['RestrictFunctions'] = array();
/**
* Default functions for above defined groups
@@ -3126,90 +2797,6 @@ if ($cfg['ShowFunctionFields']) {
'first_timestamp' => 'NOW',
'pk_char36' => 'UUID',
);
-} // end if
-
-/**
- * Search operators
- *
- * @global array $cfg['NumOperators']
- */
-$cfg['NumOperators'] = array(
- '=',
- '>',
- '>=',
- '<',
- '<=',
- '!=',
- 'LIKE',
- 'NOT LIKE',
- 'IN (...)',
- 'NOT IN (...)',
- 'BETWEEN',
- 'NOT BETWEEN',
-);
-
-/**
- * Search operators
- *
- * @global array $cfg['TextOperators']
- */
-$cfg['TextOperators'] = array(
- 'LIKE',
- 'LIKE %...%',
- 'NOT LIKE',
- '=',
- '!=',
- 'REGEXP',
- 'REGEXP ^...$',
- 'NOT REGEXP',
- "= ''",
- "!= ''",
- 'IN (...)',
- 'NOT IN (...)',
- 'BETWEEN',
- 'NOT BETWEEN',
-);
-
-/**
- * Search operators
- *
- * @global array $cfg['EnumOperators']
- */
-$cfg['EnumOperators'] = array(
- '=',
- '!=',
-);
-
-/**
- * Search operators
- *
- * @global array $cfg['SetOperators']
- */
-$cfg['SetOperators'] = array(
- 'IN',
- 'NOT IN',
-);
-
-/**
- * Search operators
- *
- * @global array $cfg['NullOperators']
- */
-$cfg['NullOperators'] = array(
- 'IS NULL',
- 'IS NOT NULL',
-);
-
-/**
- * Search operators
- *
- * @global array $cfg['UnaryOperators']
- */
-$cfg['UnaryOperators'] = array(
- 'IS NULL' => 1,
- 'IS NOT NULL' => 1,
- "= ''" => 1,
- "!= ''" => 1
-);
+}
?>
diff --git a/libraries/data_mysql.inc.php b/libraries/data_mysql.inc.php
new file mode 100644
index 0000000..e457d57
--- /dev/null
+++ b/libraries/data_mysql.inc.php
@@ -0,0 +1,276 @@
+<?php
+/**
+ * Column types and functions supported by MySQL
+ *
+ * @package phpMyAdmin
+ */
+
+// VARCHAR, TINYINT, TEXT and DATE are listed first, based on estimated popularity
+$cfg['ColumnTypes'] = !empty($cfg['ColumnTypes']) ? $cfg['ColumnTypes'] : array(
+ // most used
+ 'INT',
+ 'VARCHAR',
+ 'TEXT',
+ 'DATE',
+
+ // numeric
+ 'NUMERIC' => array(
+ 'TINYINT',
+ 'SMALLINT',
+ 'MEDIUMINT',
+ 'INT',
+ 'BIGINT',
+ '-',
+ 'DECIMAL',
+ 'FLOAT',
+ 'DOUBLE',
+ 'REAL',
+ '-',
+ 'BIT',
+ 'BOOLEAN',
+ 'SERIAL',
+ ),
+
+
+ // Date/Time
+ 'DATE and TIME' => array(
+ 'DATE',
+ 'DATETIME',
+ 'TIMESTAMP',
+ 'TIME',
+ 'YEAR',
+ ),
+
+ // Text
+ 'STRING' => array(
+ 'CHAR',
+ 'VARCHAR',
+ '-',
+ 'TINYTEXT',
+ 'TEXT',
+ 'MEDIUMTEXT',
+ 'LONGTEXT',
+ '-',
+ 'BINARY',
+ 'VARBINARY',
+ '-',
+ 'TINYBLOB',
+ 'MEDIUMBLOB',
+ 'BLOB',
+ 'LONGBLOB',
+ '-',
+ 'ENUM',
+ 'SET',
+ ),
+
+ 'SPATIAL' => array(
+ 'GEOMETRY',
+ 'POINT',
+ 'LINESTRING',
+ 'POLYGON',
+ 'MULTIPOINT',
+ 'MULTILINESTRING',
+ 'MULTIPOLYGON',
+ 'GEOMETRYCOLLECTION',
+ ),
+);
+
+$cfg['AttributeTypes'] = !empty($cfg['AttributeTypes']) ? $cfg['AttributeTypes'] : array(
+ '',
+ 'BINARY',
+ 'UNSIGNED',
+ 'UNSIGNED ZEROFILL',
+ 'on update CURRENT_TIMESTAMP',
+);
+
+if ($cfg['ShowFunctionFields']) {
+ $cfg['RestrictColumnTypes'] = !empty($cfg['RestrictColumnTypes']) ? $cfg['RestrictColumnTypes'] : array(
+ 'TINYINT' => 'FUNC_NUMBER',
+ 'SMALLINT' => 'FUNC_NUMBER',
+ 'MEDIUMINT' => 'FUNC_NUMBER',
+ 'INT' => 'FUNC_NUMBER',
+ 'BIGINT' => 'FUNC_NUMBER',
+ 'DECIMAL' => 'FUNC_NUMBER',
+ 'FLOAT' => 'FUNC_NUMBER',
+ 'DOUBLE' => 'FUNC_NUMBER',
+ 'REAL' => 'FUNC_NUMBER',
+ 'BIT' => 'FUNC_NUMBER',
+ 'BOOLEAN' => 'FUNC_NUMBER',
+ 'SERIAL' => 'FUNC_NUMBER',
+
+ 'DATE' => 'FUNC_DATE',
+ 'DATETIME' => 'FUNC_DATE',
+ 'TIMESTAMP' => 'FUNC_DATE',
+ 'TIME' => 'FUNC_DATE',
+ 'YEAR' => 'FUNC_DATE',
+
+ 'CHAR' => 'FUNC_CHAR',
+ 'VARCHAR' => 'FUNC_CHAR',
+ 'TINYTEXT' => 'FUNC_CHAR',
+ 'TEXT' => 'FUNC_CHAR',
+ 'MEDIUMTEXT' => 'FUNC_CHAR',
+ 'LONGTEXT' => 'FUNC_CHAR',
+ 'BINARY' => 'FUNC_CHAR',
+ 'VARBINARY' => 'FUNC_CHAR',
+ 'TINYBLOB' => 'FUNC_CHAR',
+ 'MEDIUMBLOB' => 'FUNC_CHAR',
+ 'BLOB' => 'FUNC_CHAR',
+ 'LONGBLOB' => 'FUNC_CHAR',
+ 'ENUM' => '',
+ 'SET' => '',
+
+ 'GEOMETRY' => 'FUNC_SPATIAL',
+ 'POINT' => 'FUNC_SPATIAL',
+ 'LINESTRING' => 'FUNC_SPATIAL',
+ 'POLYGON' => 'FUNC_SPATIAL',
+ 'MULTIPOINT' => 'FUNC_SPATIAL',
+ 'MULTILINESTRING' => 'FUNC_SPATIAL',
+ 'MULTIPOLYGON' => 'FUNC_SPATIAL',
+ 'GEOMETRYCOLLECTION' => 'FUNC_SPATIAL',
+
+ );
+
+ $restrict_functions = array(
+ 'FUNC_CHAR' => array(
+ 'BIN',
+ 'CHAR',
+ 'CURRENT_USER',
+ 'COMPRESS',
+ 'DATABASE',
+ 'DAYNAME',
+ 'DES_DECRYPT',
+ 'DES_ENCRYPT',
+ 'ENCRYPT',
+ 'HEX',
+ 'INET_NTOA',
+ 'LOAD_FILE',
+ 'LOWER',
+ 'LTRIM',
+ 'MD5',
+ 'MONTHNAME',
+ 'OLD_PASSWORD',
+ 'PASSWORD',
+ 'QUOTE',
+ 'REVERSE',
+ 'RTRIM',
+ 'SHA1',
+ 'SOUNDEX',
+ 'SPACE',
+ 'TRIM',
+ 'UNCOMPRESS',
+ 'UNHEX',
+ 'UPPER',
+ 'USER',
+ 'UUID',
+ 'VERSION',
+ ),
+
+ 'FUNC_DATE' => array(
+ 'CURDATE',
+ 'CURTIME',
+ 'DATE',
+ 'FROM_DAYS',
+ 'FROM_UNIXTIME',
+ 'LAST_DAY',
+ 'NOW',
+ 'SEC_TO_TIME',
+ 'SYSDATE',
+ 'TIME',
+ 'TIMESTAMP',
+ 'UTC_DATE',
+ 'UTC_TIME',
+ 'UTC_TIMESTAMP',
+ 'YEAR',
+ ),
+
+ 'FUNC_NUMBER' => array(
+ 'ABS',
+ 'ACOS',
+ 'ASCII',
+ 'ASIN',
+ 'ATAN',
+ 'BIT_LENGTH',
+ 'BIT_COUNT',
+ 'CEILING',
+ 'CHAR_LENGTH',
+ 'CONNECTION_ID',
+ 'COS',
+ 'COT',
+ 'CRC32',
+ 'DAYOFMONTH',
+ 'DAYOFWEEK',
+ 'DAYOFYEAR',
+ 'DEGREES',
+ 'EXP',
+ 'FLOOR',
+ 'HOUR',
+ 'INET_ATON',
+ 'LENGTH',
+ 'LN',
+ 'LOG',
+ 'LOG2',
+ 'LOG10',
+ 'MICROSECOND',
+ 'MINUTE',
+ 'MONTH',
+ 'OCT',
+ 'ORD',
+ 'PI',
+ 'QUARTER',
+ 'RADIANS',
+ 'RAND',
+ 'ROUND',
+ 'SECOND',
+ 'SIGN',
+ 'SIN',
+ 'SQRT',
+ 'TAN',
+ 'TO_DAYS',
+ 'TIME_TO_SEC',
+ 'UNCOMPRESSED_LENGTH',
+ 'UNIX_TIMESTAMP',
+ 'WEEK',
+ 'WEEKDAY',
+ 'WEEKOFYEAR',
+ 'YEARWEEK',
+ ),
+
+ 'FUNC_SPATIAL' => array(
+ 'GeomFromText',
+ 'GeomFromWKB',
+
+ 'GeomCollFromText',
+ 'LineFromText',
+ 'MLineFromText',
+ 'PointFromText',
+ 'MPointFromText',
+ 'PolyFromText',
+ 'MPolyFromText',
+
+ 'GeomCollFromWKB',
+ 'LineFromWKB',
+ 'MLineFromWKB',
+ 'PointFromWKB',
+ 'MPointFromWKB',
+ 'PolyFromWKB',
+ 'MPolyFromWKB',
+ ),
+ );
+ if (empty($cfg['RestrictFunctions'])) {
+ $cfg['RestrictFunctions'] = $restrict_functions;
+ }
+
+ if (empty($cfg['Functions'])) {
+ // build a list of functions based on $restrict_functions
+ $cfg['Functions'] = array();
+ foreach ($restrict_functions as $cat => $functions) {
+ if ($cat != 'FUNC_SPATIAL') {
+ $cfg['Functions'] = array_merge($cfg['Functions'], $functions);
+ }
+ }
+ sort($cfg['Functions']);
+ }
+ unset($restrict_functions);
+} // end if
+
+?>
\ No newline at end of file
diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php
index 4cfd48a..f4ade94 100644
--- a/libraries/tbl_properties.inc.php
+++ b/libraries/tbl_properties.inc.php
@@ -27,6 +27,9 @@ require_once './libraries/StorageEngine.class.php';
*/
require_once './libraries/Partition.class.php';
+// load additional configuration variables
+require_once './libraries/data_mysql.inc.php';
+
if (is_int($cfg['DefaultPropDisplay'])) {
if ($num_fields <= $cfg['DefaultPropDisplay']) {
$display_type = 'vertical';
diff --git a/tbl_change.php b/tbl_change.php
index 94c7da0..7d5bba3 100644
--- a/tbl_change.php
+++ b/tbl_change.php
@@ -19,6 +19,9 @@ require_once './libraries/common.lib.php';
*/
require_once './libraries/db_table_exists.lib.php';
+// load additional configuration variables
+require_once './libraries/data_mysql.inc.php';
+
/**
* Sets global variables.
* Here it's better to use a if, instead of the '?' operator
diff --git a/tbl_select.php b/tbl_select.php
index 33b7e48..52e8b93 100644
--- a/tbl_select.php
+++ b/tbl_select.php
@@ -129,31 +129,57 @@ if (! isset($param) || $param[0] == '') {
<td><?php echo $fields_collation[$i]; ?></td>
<td><select name="func[]">
<?php
+ // determine valid operators
if (strncasecmp($fields_type[$i], 'enum', 4) == 0) {
- foreach ($GLOBALS['cfg']['EnumOperators'] as $fc) {
- echo "\n" . ' '
- . '<option value="' . htmlspecialchars($fc) . '">'
- . htmlspecialchars($fc) . '</option>';
- }
+ // enum operators
+ $operators = array(
+ '=',
+ '!=',
+ );
} elseif (preg_match('@char|blob|text|set@i', $fields_type[$i])) {
- foreach ($GLOBALS['cfg']['TextOperators'] as $fc) {
- echo "\n" . ' '
- . '<option value="' . htmlspecialchars($fc) . '">'
- . htmlspecialchars($fc) . '</option>';
- }
+ // text operators
+ $operators = array(
+ 'LIKE',
+ 'LIKE %...%',
+ 'NOT LIKE',
+ '=',
+ '!=',
+ 'REGEXP',
+ 'REGEXP ^...$',
+ 'NOT REGEXP',
+ "= ''",
+ "!= ''",
+ 'IN (...)',
+ 'NOT IN (...)',
+ 'BETWEEN',
+ 'NOT BETWEEN',
+ );
} else {
- foreach ($GLOBALS['cfg']['NumOperators'] as $fc) {
- echo "\n" . ' '
- . '<option value="' . htmlspecialchars($fc) . '">'
- . htmlspecialchars($fc) . '</option>';
- }
+ // numeric operators
+ $operators = array(
+ '=',
+ '>',
+ '>=',
+ '<',
+ '<=',
+ '!=',
+ 'LIKE',
+ 'NOT LIKE',
+ 'IN (...)',
+ 'NOT IN (...)',
+ 'BETWEEN',
+ 'NOT BETWEEN',
+ );
} // end if... else...
+
+ // if field can be NULL, add IS NULL and IS NOT NULL
if ($fields_null[$i]) {
- foreach ($GLOBALS['cfg']['NullOperators'] as $fc) {
- echo "\n" . ' '
- . '<option value="' . htmlspecialchars($fc) . '">'
- . htmlspecialchars($fc) . '</option>';
- }
+ $operators[] = 'IS NULL';
+ $operators[] = 'IS NOT NULL';
+ }
+ foreach ($operators as $op) {
+ echo "\n" . ' '
+ . '<option value="' . htmlspecialchars($op) . '">' . htmlspecialchars($op) . '</option>';
}
?>
@@ -327,11 +353,17 @@ else {
$sql_query .= ' WHERE ' . $where;
} else {
$w = $charsets = array();
+ $unary_operators = array(
+ 'IS NULL' => 1,
+ 'IS NOT NULL' => 1,
+ "= ''" => 1,
+ "!= ''" => 1
+ );
$cnt_func = count($func);
reset($func);
while (list($i, $func_type) = each($func)) {
list($charsets[$i]) = explode('_', $collations[$i]);
- if (isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) {
+ if (isset($unary_operators[$func_type])) {
$fields[$i] = '';
$w[] = PMA_backquote($names[$i]) . ' ' . $func_type;
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-6549-g9e34ccf
by Rouslan Placella 06 Jul '11
by Rouslan Placella 06 Jul '11
06 Jul '11
The branch, master has been updated
via 9e34ccf57cfc97c3cac6d7f9ceecd6e1cc89e10d (commit)
from e9126d231887cfdeeed096648201f9e0d2f0b6f5 (commit)
- Log -----------------------------------------------------------------
commit 9e34ccf57cfc97c3cac6d7f9ceecd6e1cc89e10d
Author: Rouslan Placella <rouslan(a)placella.com>
Date: Wed Jul 6 15:01:39 2011 +0100
Fix for bug #3354356 - Timepicker does not work in AJAX dialogs
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
themes/original/jquery/jquery-ui-1.8.override.css | 1 +
themes/pmahomme/jquery/jquery-ui-1.8.override.css | 1 +
3 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4ae25e9..4df55e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,6 +33,7 @@ phpMyAdmin - ChangeLog
+ Shift/click support in database Structure
+ Show/hide column in table Browse
- bug #3353856 [AJAX] AJAX dialogs use wrong font-size
+- bug #3354356 [interface] Timepicker does not work in AJAX dialogs
3.4.4.0 (not yet released)
- bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes
diff --git a/themes/original/jquery/jquery-ui-1.8.override.css b/themes/original/jquery/jquery-ui-1.8.override.css
index 4aee6fb..2835781 100644
--- a/themes/original/jquery/jquery-ui-1.8.override.css
+++ b/themes/original/jquery/jquery-ui-1.8.override.css
@@ -5,3 +5,4 @@
/* Component containers
----------------------------------*/
.ui-widget { font-size: 1em; }
+#ui-timepicker-div { z-index: 1003; }
diff --git a/themes/pmahomme/jquery/jquery-ui-1.8.override.css b/themes/pmahomme/jquery/jquery-ui-1.8.override.css
index 4aee6fb..2835781 100644
--- a/themes/pmahomme/jquery/jquery-ui-1.8.override.css
+++ b/themes/pmahomme/jquery/jquery-ui-1.8.override.css
@@ -5,3 +5,4 @@
/* Component containers
----------------------------------*/
.ui-widget { font-size: 1em; }
+#ui-timepicker-div { z-index: 1003; }
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-6548-ge9126d2
by Marc Delisle 06 Jul '11
by Marc Delisle 06 Jul '11
06 Jul '11
The branch, master has been updated
via e9126d231887cfdeeed096648201f9e0d2f0b6f5 (commit)
via c97ef9d53c554a4e5de6180247ca6d63709db77f (commit)
from 39cb55a0defbf2634b2bc097f96e0d559303f5f7 (commit)
- Log -----------------------------------------------------------------
commit e9126d231887cfdeeed096648201f9e0d2f0b6f5
Merge: 39cb55a0defbf2634b2bc097f96e0d559303f5f7 c97ef9d53c554a4e5de6180247ca6d63709db77f
Author: Marc Delisle <marc(a)infomarc.info>
Date: Wed Jul 6 08:17:45 2011 -0400
Merge commit 'c97ef9d53c554a4e5de6180247ca6d63709db77f'
commit c97ef9d53c554a4e5de6180247ca6d63709db77f
Author: Aris Feryanto <aris_feryanto(a)yahoo.com>
Date: Wed Jul 6 09:54:38 2011 +0800
Show/hide column: fix bug - column resizer border's height not updated after toggling column visibility
-----------------------------------------------------------------------
Summary of changes:
js/makegrid.js | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/js/makegrid.js b/js/makegrid.js
index 8b1bd7c..11bfa09 100644
--- a/js/makegrid.js
+++ b/js/makegrid.js
@@ -215,6 +215,7 @@
$cb.css('left', $this.position().left + $this.outerWidth(true))
.show();
}
+ $(this.cRsz).css('height', $(this.t).height());
},
/**
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, unittesting, updated. RELEASE_3_4_3_1-6561-gf81c001
by Herman van Rink 06 Jul '11
by Herman van Rink 06 Jul '11
06 Jul '11
The branch, unittesting has been updated
via f81c001f76af2f39cbdc15002feefaa3821676ec (commit)
via 60a2e5b3f312adf7acbe1c9ee01c21a70f9d07cf (commit)
via 2e93b81172585e694c8dfdb4aa41a9272b90971e (commit)
via 91709ec0c18074299b9e8560653018a9ff9206d3 (commit)
via 39cb55a0defbf2634b2bc097f96e0d559303f5f7 (commit)
via 82f83dac2f6b07bef76f6c3fb795ce7c0c417af8 (commit)
via 70c70db1392e703346434e65d59110a6ba321367 (commit)
via a88054dae9a969c0c9ec6477fce130b70a777749 (commit)
via 39cb4d4798f495db25bf65dda95fc8c4e9893367 (commit)
via 064d399d878f36a0a26f6db890b947bccb3ef8ab (commit)
via 2ec0de3a9f8d77c750f02c27ba8d83b407a87ea5 (commit)
from fc5a9a6131f9bec3c7f8c91666f483b9487c1132 (commit)
- Log -----------------------------------------------------------------
commit f81c001f76af2f39cbdc15002feefaa3821676ec
Merge: 60a2e5b3f312adf7acbe1c9ee01c21a70f9d07cf 2e93b81172585e694c8dfdb4aa41a9272b90971e
Author: Herman van Rink <rink(a)initfour.nl>
Date: Wed Jul 6 11:03:46 2011 +0200
Merge remote-tracking branch 'zarubin/master' into unittesting
commit 60a2e5b3f312adf7acbe1c9ee01c21a70f9d07cf
Merge: fc5a9a6131f9bec3c7f8c91666f483b9487c1132 39cb55a0defbf2634b2bc097f96e0d559303f5f7
Author: Herman van Rink <rink(a)initfour.nl>
Date: Wed Jul 6 10:30:43 2011 +0200
Merge branch 'master' into unittesting
commit 2e93b81172585e694c8dfdb4aa41a9272b90971e
Merge: 91709ec0c18074299b9e8560653018a9ff9206d3 fc5a9a6131f9bec3c7f8c91666f483b9487c1132
Author: Zarubin Stas <zarubin(a)zsv.org.ua>
Date: Wed Jul 6 11:30:43 2011 +0300
Merge remote-tracking branch 'upstream/unittesting'
commit 91709ec0c18074299b9e8560653018a9ff9206d3
Author: Zarubin Stas <zarubin(a)zsv.org.ua>
Date: Wed Jul 6 10:47:10 2011 +0300
New PHPUnit tests for common.lib.php
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 3 +
js/db_routines.js | 4 +-
js/functions.js | 2 +-
js/indexes.js | 12 +-
libraries/RecentTable.class.php | 4 +-
libraries/common.lib.php | 4 +-
libraries/header_meta_style.inc.php | 7 +
tbl_indexes.php | 14 +-
test/bootstrap-dist.php | 2 +
test/libraries/common/PMA_ajaxResponse_test.php | 71 ++
.../libraries/common/PMA_browseUploadFile_test.php | 48 ++
.../common/PMA_buildActionTitles_test.php | 42 ++
test/libraries/common/PMA_cache_test.php | 14 +
.../PMA_contains_nonprintable_ascii_test.php | 37 +
.../common/PMA_convert_bit_default_value_test.php | 33 +
.../common/PMA_displayMaximumUploadSize_test.php | 41 ++
.../common/PMA_display_html_checkbox_test.php | 55 ++
.../common/PMA_display_html_radio_test.php | 188 +++++
.../common/PMA_escapeMySqlWildcards_test.php | 2 +
.../PMA_extractValueFromFormattedSize_test.php | 37 +
.../common/PMA_foreignKeySupported_test.php | 2 +
.../common/PMA_formatNumberByteDown_test.php | 5 +-
test/libraries/common/PMA_formatSql_test.php | 743 ++++++++++++++++++++
.../common/PMA_generateHiddenMaxFileSize_test.php | 40 +
.../common/PMA_generate_html_dropdown_test.php | 69 ++
test/libraries/common/PMA_getIcon_test.php | 74 ++
.../common/PMA_getTitleForTarget_test.php | 43 ++
.../common/PMA_localisedDateTimespan_test.php | 2 +-
test/libraries/common/PMA_pow_test.php | 2 +
.../common/PMA_printableBitValue_test.php | 1 +
.../libraries/common/PMA_quoting_slashing_test.php | 7 +-
.../common/PMA_showMessage_test_disabled.php | 45 ++
.../libraries/common/PMA_stringOperations_test.php | 1 +
.../common/PMA_unsupportedDatatypes_test.php | 32 +
test/libraries/common/PMA_whichCrlf_test.php | 1 +
themes/original/jquery/jquery-ui-1.8.override.css | 7 +
themes/pmahomme/jquery/jquery-ui-1.8.override.css | 7 +
37 files changed, 1675 insertions(+), 26 deletions(-)
create mode 100644 test/libraries/common/PMA_ajaxResponse_test.php
create mode 100644 test/libraries/common/PMA_browseUploadFile_test.php
create mode 100644 test/libraries/common/PMA_buildActionTitles_test.php
create mode 100644 test/libraries/common/PMA_contains_nonprintable_ascii_test.php
create mode 100644 test/libraries/common/PMA_convert_bit_default_value_test.php
create mode 100644 test/libraries/common/PMA_displayMaximumUploadSize_test.php
create mode 100644 test/libraries/common/PMA_display_html_checkbox_test.php
create mode 100644 test/libraries/common/PMA_display_html_radio_test.php
create mode 100644 test/libraries/common/PMA_extractValueFromFormattedSize_test.php
create mode 100644 test/libraries/common/PMA_formatSql_test.php
create mode 100644 test/libraries/common/PMA_generateHiddenMaxFileSize_test.php
create mode 100644 test/libraries/common/PMA_generate_html_dropdown_test.php
create mode 100644 test/libraries/common/PMA_getIcon_test.php
create mode 100644 test/libraries/common/PMA_getTitleForTarget_test.php
create mode 100644 test/libraries/common/PMA_showMessage_test_disabled.php
create mode 100644 test/libraries/common/PMA_unsupportedDatatypes_test.php
create mode 100644 themes/original/jquery/jquery-ui-1.8.override.css
create mode 100644 themes/pmahomme/jquery/jquery-ui-1.8.override.css
diff --git a/ChangeLog b/ChangeLog
index 312e148..4ae25e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,7 @@ phpMyAdmin - ChangeLog
+ Display direction (horizontal/vertical) no longer displayed by default
+ Shift/click support in database Structure
+ Show/hide column in table Browse
+- bug #3353856 [AJAX] AJAX dialogs use wrong font-size
3.4.4.0 (not yet released)
- bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes
@@ -39,6 +40,8 @@ phpMyAdmin - ChangeLog
- bug #3348995 [config] $cfg['Export']['asfile'] set to false does not select asText option
- bug #3340151 [export] Working SQL query exports error page
- bug #3353649 [interface] "Create an index on X columns" form not validated
+- bug #3350790 [interface] JS error in Table->Structure->Index->Edit
+- bug #3353811 [interface] Info message has "error" class
3.4.3.1 (2011-07-02)
- [security] Fixed possible session manipulation in swekey authentication, see PMASA-2011-5
diff --git a/js/db_routines.js b/js/db_routines.js
index 95254ca..ceb0962 100644
--- a/js/db_routines.js
+++ b/js/db_routines.js
@@ -308,7 +308,7 @@ $(document).ready(function() {
/**
* Display the dialog to the user
*/
- $ajaxDialog = $('<div style="font-size: 0.9em;">'+data.message+'</div>').dialog({
+ $ajaxDialog = $('<div>'+data.message+'</div>').dialog({
width: 700, // TODO: make a better decision about the size
height: 550, // of the dialog based on the size of the viewport
buttons: button_options,
@@ -529,7 +529,7 @@ $(document).ready(function() {
/**
* Display the dialog to the user
*/
- $ajaxDialog = $('<div style="font-size: 0.9em;">'+data.message+'</div>').dialog({
+ $ajaxDialog = $('<div>'+data.message+'</div>').dialog({
width: 650, // TODO: make a better decision about the size
// of the dialog based on the size of the viewport
buttons: button_options,
diff --git a/js/functions.js b/js/functions.js
index e25ec98..9cdb44e 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -2445,7 +2445,7 @@ $(document).ready(function() {
/**
* Display the dialog to the user
*/
- var $ajaxDialog = $('<div style="font-size: 0.9em;">'+data.message+'</div>').dialog({
+ var $ajaxDialog = $('<div>'+data.message+'</div>').dialog({
width: 500,
buttons: button_options,
title: data.title
diff --git a/js/indexes.js b/js/indexes.js
index 9b64d92..ef6f877 100644
--- a/js/indexes.js
+++ b/js/indexes.js
@@ -17,24 +17,24 @@ function checkIndexName()
}
// Gets the elements pointers
- var the_idx_name = document.forms['index_frm'].elements['index'];
- var the_idx_type = document.forms['index_frm'].elements['index_type'];
+ var the_idx_name = document.forms['index_frm'].elements['index[Key_name]'];
+ var the_idx_type = document.forms['index_frm'].elements['index[Index_type]'];
// Index is a primary key
if (the_idx_type.options[0].value == 'PRIMARY' && the_idx_type.options[0].selected) {
- document.forms['index_frm'].elements['index'].value = 'PRIMARY';
+ document.forms['index_frm'].elements['index[Key_name]'].value = 'PRIMARY';
if (typeof(the_idx_name.disabled) != 'undefined') {
- document.forms['index_frm'].elements['index'].disabled = true;
+ document.forms['index_frm'].elements['index[Key_name]'].disabled = true;
}
}
// Other cases
else {
if (the_idx_name.value == 'PRIMARY') {
- document.forms['index_frm'].elements['index'].value = '';
+ document.forms['index_frm'].elements['index[Key_name]'].value = '';
}
if (typeof(the_idx_name.disabled) != 'undefined') {
- document.forms['index_frm'].elements['index'].disabled = false;
+ document.forms['index_frm'].elements['index[Key_name]'].disabled = false;
}
}
diff --git a/libraries/RecentTable.class.php b/libraries/RecentTable.class.php
index f844bbc..bfb6081 100644
--- a/libraries/RecentTable.class.php
+++ b/libraries/RecentTable.class.php
@@ -142,7 +142,7 @@ class PMA_RecentTable
$html = '<option value="">(' . __('Recent tables') . ') ...</option>';
if (count($this->tables)) {
foreach ($this->tables as $table) {
- $html .= '<option value="' . $table . '">' . $table . '</option>';
+ $html .= '<option value="' . htmlspecialchars($table) . '">' . htmlspecialchars($table) . '</option>';
}
} else {
$html .= '<option value="">' . __('There are no recent tables') . '</option>';
@@ -158,7 +158,7 @@ class PMA_RecentTable
public function getHtmlSelect()
{
$html = '<input type="hidden" name="goto" id="LeftDefaultTabTable" value="' .
- $GLOBALS['cfg']['LeftDefaultTabTable'] . '" />';
+ htmlspecialchars($GLOBALS['cfg']['LeftDefaultTabTable']) . '" />';
$html .= '<select name="table" id="recentTable">';
$html .= $this->getHtmlSelectOption();
$html .= '</select>';
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 61f3102..af4d3b2 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -2774,7 +2774,9 @@ function PMA_ajaxResponse($message, $success = true, $extra_data = array())
header("Content-Type: application/json");
echo json_encode($response);
- exit;
+
+ if(!defined('TESTSUITE'))
+ exit;
}
/**
diff --git a/libraries/header_meta_style.inc.php b/libraries/header_meta_style.inc.php
index 5e5c533..e78b653 100644
--- a/libraries/header_meta_style.inc.php
+++ b/libraries/header_meta_style.inc.php
@@ -48,4 +48,11 @@ if ($GLOBALS['text_dir'] == 'ltr') {
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>phpmyadmin.css.php<?php echo PMA_generate_common_url(array('server' => $GLOBALS['server'])); ?>&js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>print.css" media="print" />
<link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['pmaThemePath']; ?>/jquery/jquery-ui-1.8.custom.css" />
+<?php
+ if (is_readable($GLOBALS['pmaThemePath'] . '/jquery/jquery-ui-1.8.override.css')) {
+?>
+ <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['pmaThemePath']; ?>/jquery/jquery-ui-1.8.override.css" />
+<?php
+ }
+?>
<meta name="robots" content="noindex,nofollow" />
diff --git a/tbl_indexes.php b/tbl_indexes.php
index 995ee24..7e9bec6 100644
--- a/tbl_indexes.php
+++ b/tbl_indexes.php
@@ -140,8 +140,8 @@ if (isset($_REQUEST['index']) && is_array($_REQUEST['index'])) {
?>
<form action="./tbl_indexes.php" method="post" name="index_frm" id="index_frm" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''); ?>
- onsubmit="if (typeof(this.elements['index'].disabled) != 'undefined') {
- this.elements['index'].disabled = false}">
+ onsubmit="if (typeof(this.elements['index[Key_name]'].disabled) != 'undefined') {
+ this.elements['index[Key_name]'].disabled = false}">
<?php
$form_params = array(
'db' => $db,
@@ -168,7 +168,9 @@ if (isset($_REQUEST['create_index'])) {
}
?>
</legend>
-
+<?php
+PMA_Message::notice(__('("PRIMARY" <b>must</b> be the name of and <b>only of</b> a primary key!)'))->display();
+?>
<div class="formelement">
<label for="input_index_name"><?php echo __('Index name:'); ?></label>
<input type="text" name="index[Key_name]" id="input_index_name" size="25"
@@ -183,11 +185,7 @@ if (isset($_REQUEST['create_index'])) {
<?php echo PMA_showMySQLDocu('SQL-Syntax', 'ALTER_TABLE'); ?>
</div>
-
-<br class="clearfloat" />
-<?php
-PMA_Message::error(__('("PRIMARY" <b>must</b> be the name of and <b>only of</b> a primary key!)'))->display();
-?>
+<br class="clearfloat" /><br />
<table id="index_columns">
<thead>
diff --git a/test/bootstrap-dist.php b/test/bootstrap-dist.php
index 366d104..fac9b27 100644
--- a/test/bootstrap-dist.php
+++ b/test/bootstrap-dist.php
@@ -7,6 +7,8 @@ set_include_path(get_include_path() . PATH_SEPARATOR . dirname(realpath("../inde
define('PHPMYADMIN', 1);
define('TESTSUITE', 1);
+session_start();
+
// You can put some additional code that should run before tests here
?>
diff --git a/test/libraries/common/PMA_ajaxResponse_test.php b/test/libraries/common/PMA_ajaxResponse_test.php
new file mode 100644
index 0000000..9d5a842
--- /dev/null
+++ b/test/libraries/common/PMA_ajaxResponse_test.php
@@ -0,0 +1,71 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_ajaxResponse from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_ajaxResponse_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_ajaxResponse_test extends PHPUnit_Extensions_OutputTestCase
+{
+ function testAjaxResponseText()
+ {
+ $message = 'text';
+
+ $this->expectOutputString('{"success":true,"message":"' . $message . '"}');
+ PMA_ajaxResponse($message);
+ }
+
+ function testAjaxResponseTextWithExtra()
+ {
+ $message = 'text';
+ $exra = array('str_val' => 'te\x/t"1', 'int_val' => 10);
+
+ $this->expectOutputString('{"success":true,"message":"' . $message . '","str_val":"te\\\\x\/t\"1","int_val":10}');
+ PMA_ajaxResponse($message, true, $exra);
+ }
+
+ function testAjaxResponseTextError()
+ {
+ $message = 'error_text';
+
+ $this->expectOutputString('{"success":false,"error":"' . $message . '"}');
+ PMA_ajaxResponse($message, false);
+ }
+
+ function testAjaxResponseMessage()
+ {
+ $message = new PMA_Message("Message Text", 1);
+
+ $this->expectOutputString('{"success":true,"message":"<div class=\"success\">Message Text<\/div>"}');
+ PMA_ajaxResponse($message);
+ }
+
+ function testAjaxResponseMessageWithExtra()
+ {
+
+ $message = new PMA_Message("Message Text", 1);
+ $exra = array('str_val' => 'te\x/t"1', 'int_val' => 10);
+
+ $this->expectOutputString('{"success":true,"message":"<div class=\"success\">Message Text<\/div>","str_val":"te\\\\x\/t\"1","int_val":10}');
+ PMA_ajaxResponse($message, true, $exra);
+ }
+
+ function testAjaxResponseMessageError()
+ {
+
+ $message = new PMA_Message("Error Message Text", 1);
+
+ // TODO: class for output div should be "error"
+ $this->expectOutputString('{"success":false,"error":"<div class=\"success\">Error Message Text<\/div>"}');
+ PMA_ajaxResponse($message, false);
+ }
+
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_browseUploadFile_test.php b/test/libraries/common/PMA_browseUploadFile_test.php
new file mode 100644
index 0000000..45b8407
--- /dev/null
+++ b/test/libraries/common/PMA_browseUploadFile_test.php
@@ -0,0 +1,48 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_browseUploadFile from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_browseUploadFile_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_browseUploadFile_test extends PHPUnit_Extensions_OutputTestCase{
+
+ /*
+ * Data provider for test
+ */
+ public function dataProvider() {
+ return array(
+ array(10, __('B'), "10"),
+ array(100, __('B'), "100"),
+ array(1024, __('B'), "1,024"),
+ array(102400, __('KiB'), "100"),
+ array(10240000, __('MiB'), "10"),
+ array(2147483648, __('MiB'), "2,048"),
+ array(21474836480, __('GiB'), "20")
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ * @return void
+ */
+ function testBrowseUploadFile($size, $unit, $res){
+
+ $this->expectOutputString('<label for="radio_import_file">' . __("Browse your computer:") . '</label>'
+ . '<div id="upload_form_status" style="display: none;"></div>'
+ . '<div id="upload_form_status_info" style="display: none;"></div>'
+ . '<input type="file" name="import_file" id="input_import_file" />'
+ . "(" . __('Max: '). $res . $unit .")" . "\n"
+ . '<input type="hidden" name="MAX_FILE_SIZE" value="' .$size . '" />' . "\n");
+
+ PMA_browseUploadFile($size);
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_buildActionTitles_test.php b/test/libraries/common/PMA_buildActionTitles_test.php
new file mode 100644
index 0000000..130a972
--- /dev/null
+++ b/test/libraries/common/PMA_buildActionTitles_test.php
@@ -0,0 +1,42 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_buildActionTitles from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_buildActionTitles_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_buildActionTitles_test extends PHPUnit_Framework_TestCase{
+
+ function testBuildActionTitles(){
+ $titles = array();
+
+ $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse'), true);
+ $titles['NoBrowse'] = PMA_getIcon('bd_browse.png', __('Browse'), true);
+ $titles['Search'] = PMA_getIcon('b_select.png', __('Search'), true);
+ $titles['NoSearch'] = PMA_getIcon('bd_select.png', __('Search'), true);
+ $titles['Insert'] = PMA_getIcon('b_insrow.png', __('Insert'), true);
+ $titles['NoInsert'] = PMA_getIcon('bd_insrow.png', __('Insert'), true);
+ $titles['Structure'] = PMA_getIcon('b_props.png', __('Structure'), true);
+ $titles['Drop'] = PMA_getIcon('b_drop.png', __('Drop'), true);
+ $titles['NoDrop'] = PMA_getIcon('bd_drop.png', __('Drop'), true);
+ $titles['Empty'] = PMA_getIcon('b_empty.png', __('Empty'), true);
+ $titles['NoEmpty'] = PMA_getIcon('bd_empty.png', __('Empty'), true);
+ $titles['Edit'] = PMA_getIcon('b_edit.png', __('Edit'), true);
+ $titles['NoEdit'] = PMA_getIcon('bd_edit.png', __('Edit'), true);
+ $titles['Export'] = PMA_getIcon('b_export.png', __('Export'), true);
+ $titles['NoExport'] = PMA_getIcon('bd_export.png', __('Export'), true);
+ $titles['Execute'] = PMA_getIcon('b_nextpage.png', __('Execute'), true);
+ $titles['NoExecute'] = PMA_getIcon('bd_nextpage.png', __('Execute'), true);
+
+ $this->assertEquals($titles, PMA_buildActionTitles());
+
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_cache_test.php b/test/libraries/common/PMA_cache_test.php
index 9fd96a9..2284078 100644
--- a/test/libraries/common/PMA_cache_test.php
+++ b/test/libraries/common/PMA_cache_test.php
@@ -5,6 +5,7 @@
*
* @package phpMyAdmin-test
* @version $Id: PMA_cache_test.php
+ * @group common.lib-tests
*/
/*
@@ -90,5 +91,18 @@ class PMA_cache_test extends PHPUnit_Framework_TestCase
PMA_cacheUnset('test_data_2', true);
$this->assertArrayNotHasKey('test_data_2', $_SESSION['cache']['server_server']);
}
+
+ /**
+ * Test clearing user cache
+ */
+ public function testClearUserCache()
+ {
+ $GLOBALS['server'] = 'server';
+ PMA_cacheSet('is_superuser', 'yes', true);
+ $this->assertEquals('yes', $_SESSION['cache']['server_server']['is_superuser']);
+
+ PMA_clearUserCache();
+ $this->assertArrayNotHasKey('is_superuser', $_SESSION['cache']['server_server']);
+ }
}
?>
diff --git a/test/libraries/common/PMA_contains_nonprintable_ascii_test.php b/test/libraries/common/PMA_contains_nonprintable_ascii_test.php
new file mode 100644
index 0000000..8f4059e
--- /dev/null
+++ b/test/libraries/common/PMA_contains_nonprintable_ascii_test.php
@@ -0,0 +1,37 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_contains_nonprintable_ascii from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_contains_nonprintable_ascii.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_contains_nonprintable_ascii extends PHPUnit_Framework_TestCase{
+
+ function dataProvider(){
+ return array(
+ array("normal string", 0),
+ array("new\nline", 1),
+ array("tab\tspace", 1),
+ array("escape" . chr(27) . "char", 1),
+ array("chars%$\r\n",1),
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ */
+ function testContainsNonPrintableAscii($str, $res){
+ $this->assertEquals($res,PMA_contains_nonprintable_ascii($str));
+ }
+
+}
+
+// PMA_contains_nonprintable_ascii
\ No newline at end of file
diff --git a/test/libraries/common/PMA_convert_bit_default_value_test.php b/test/libraries/common/PMA_convert_bit_default_value_test.php
new file mode 100644
index 0000000..d54ab2d
--- /dev/null
+++ b/test/libraries/common/PMA_convert_bit_default_value_test.php
@@ -0,0 +1,33 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_convert_bit_default_value from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_convert_bit_default_value_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_convert_bit_default_value_test extends PHPUnit_Framework_TestCase{
+
+ function dataProvider(){
+ return array(
+ array("b'",""),
+ array("b'01'","01"),
+ array("b'010111010'","010111010")
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ */
+ function testConvert_bit_default_value_test($bit, $val){
+ $this->assertEquals($val, PMA_convert_bit_default_value($bit));
+
+ }
+}
diff --git a/test/libraries/common/PMA_displayMaximumUploadSize_test.php b/test/libraries/common/PMA_displayMaximumUploadSize_test.php
new file mode 100644
index 0000000..ad93ddb
--- /dev/null
+++ b/test/libraries/common/PMA_displayMaximumUploadSize_test.php
@@ -0,0 +1,41 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_displayMaximumUploadSize from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_displayMaximumUploadSize_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_displayMaximumUploadSize_test extends PHPUnit_Framework_TestCase{
+
+ /*
+ * Data provider for test
+ */
+ public function dataProvider() {
+ return array(
+ array(10, __('B'), "10"),
+ array(100, __('B'), "100"),
+ array(1024, __('B'), "1,024"),
+ array(102400, __('KiB'), "100"),
+ array(10240000, __('MiB'), "10"),
+ array(2147483648, __('MiB'), "2,048"),
+ array(21474836480, __('GiB'), "20")
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ * @return void
+ */
+ function testMaximumUploadSize($size, $unit, $res){
+ $this->assertEquals("(" . __('Max: '). $res . $unit .")", PMA_displayMaximumUploadSize($size));
+
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_display_html_checkbox_test.php b/test/libraries/common/PMA_display_html_checkbox_test.php
new file mode 100644
index 0000000..c779d72
--- /dev/null
+++ b/test/libraries/common/PMA_display_html_checkbox_test.php
@@ -0,0 +1,55 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_display_html_checkbox from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_display_html_checkbox_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_display_html_checkbox_test extends PHPUnit_Extensions_OutputTestCase
+{
+ function testDisplayHtmlCheckbox()
+ {
+ $name = "test_display_html_checkbox";
+ $label = "text_label_for_checkbox";
+
+ $this->expectOutputString('<input type="checkbox" name="' . $name . '" id="' . $name . '" /><label for="' . $name . '">' . $label . '</label>');
+ PMA_display_html_checkbox($name,$label,false,false);
+ }
+
+ function testDisplayHtmlCheckboxChecked()
+ {
+ $name = "test_display_html_checkbox";
+ $label = "text_label_for_checkbox";
+
+ $this->expectOutputString('<input type="checkbox" name="' . $name . '" id="' . $name . '" checked="checked" /><label for="' . $name . '">' . $label . '</label>');
+ PMA_display_html_checkbox($name,$label,true,false);
+ }
+
+ function testDisplayHtmlCheckboxOnclick()
+ {
+ $name = "test_display_html_checkbox";
+ $label = "text_label_for_checkbox";
+
+ $this->expectOutputString('<input type="checkbox" name="' . $name . '" id="' . $name . '" onclick="this.form.submit();" /><label for="' . $name . '">' . $label . '</label>');
+ PMA_display_html_checkbox($name,$label,false,true);
+ }
+
+ function testDisplayHtmlCheckboxCheckedOnclick()
+ {
+ $name = "test_display_html_checkbox";
+ $label = "text_label_for_checkbox";
+
+ $this->expectOutputString('<input type="checkbox" name="' . $name . '" id="' . $name . '" checked="checked" onclick="this.form.submit();" /><label for="' . $name . '">' . $label . '</label>');
+ PMA_display_html_checkbox($name,$label,true,true);
+ }
+}
+
+//PMA_display_html_checkbox
\ No newline at end of file
diff --git a/test/libraries/common/PMA_display_html_radio_test.php b/test/libraries/common/PMA_display_html_radio_test.php
new file mode 100644
index 0000000..c5f2d4b
--- /dev/null
+++ b/test/libraries/common/PMA_display_html_radio_test.php
@@ -0,0 +1,188 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_display_html_radio from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_display_html_radio_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_display_html_radio_test extends PHPUnit_Extensions_OutputTestCase
+{
+ function testDisplayHtmlRadioEmpty()
+ {
+ $name = "test_display_radio";
+ $choices = array();
+
+ $this->expectOutputString("");
+ PMA_display_html_radio($name,$choices);
+ }
+
+ function testDisplayHtmlRadio()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value_2'=>'choice_2');
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . $choice_label . '</label>';
+ $out .= '<br />';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices);
+ }
+
+ function testDisplayHtmlRadioWithChecked()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value_2'=>'choice_2');
+ $checked_choice = "value_2";
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ if ($choice_value == $checked_choice) {
+ $out .= ' checked="checked"';
+ }
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . $choice_label . '</label>';
+ $out .= '<br />';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices,$checked_choice);
+ }
+
+ function testDisplayHtmlRadioWithCheckedWithClass()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value_2'=>'choice_2');
+ $checked_choice = "value_2";
+ $class = "test_class";
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<div class="' . $class . '">';
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ if ($choice_value == $checked_choice) {
+ $out .= ' checked="checked"';
+ }
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . $choice_label . '</label>';
+ $out .= '<br />';
+ $out .= '</div>';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices,$checked_choice,true,false,$class);
+ }
+
+ function testDisplayHtmlRadioWithoutBR()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value&_<2>'=>'choice_2');
+ $checked_choice = "choice_2";
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ if ($choice_value == $checked_choice) {
+ $out .= ' checked="checked"';
+ }
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . $choice_label . '</label>';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices,$checked_choice,false);
+ }
+
+ function testDisplayHtmlRadioEscapeLabelEscapeLabel()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value_&2'=>'choice&_<2>');
+ $checked_choice = "value_2";
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ if ($choice_value == $checked_choice) {
+ $out .= ' checked="checked"';
+ }
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . htmlspecialchars($choice_label) . '</label>';
+ $out .= '<br />';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices,$checked_choice,true,true);
+ }
+
+ function testDisplayHtmlRadioEscapeLabelNotEscapeLabel()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value_&2'=>'choice&_<2>');
+ $checked_choice = "value_2";
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ if ($choice_value == $checked_choice) {
+ $out .= ' checked="checked"';
+ }
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . $choice_label . '</label>';
+ $out .= '<br />';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices,$checked_choice,true,false);
+ }
+
+ function testDisplayHtmlRadioEscapeLabelEscapeLabelWithClass()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value_&2'=>'choice&_<2>');
+ $checked_choice = "value_2";
+ $class = "test_class";
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<div class="' . $class . '">';
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ if ($choice_value == $checked_choice) {
+ $out .= ' checked="checked"';
+ }
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . htmlspecialchars($choice_label) . '</label>';
+ $out .= '<br />';
+ $out .= '</div>';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices,$checked_choice,true,true,$class);
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_escapeMySqlWildcards_test.php b/test/libraries/common/PMA_escapeMySqlWildcards_test.php
index 8a65356..c77a841 100644
--- a/test/libraries/common/PMA_escapeMySqlWildcards_test.php
+++ b/test/libraries/common/PMA_escapeMySqlWildcards_test.php
@@ -4,6 +4,8 @@
* Test for MySQL Wildcards escaping/unescaping
*
* @package phpMyAdmin-test
+ * @version $Id: PMA_escapeMySqlWildcards_test.php
+ * @group common.lib-tests
*/
/*
diff --git a/test/libraries/common/PMA_extractValueFromFormattedSize_test.php b/test/libraries/common/PMA_extractValueFromFormattedSize_test.php
new file mode 100644
index 0000000..038a36e
--- /dev/null
+++ b/test/libraries/common/PMA_extractValueFromFormattedSize_test.php
@@ -0,0 +1,37 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_extractValueFromFormattedSize from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_extractValueFromFormattedSize_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_extractValueFromFormattedSize_test extends PHPUnit_Framework_TestCase{
+
+ function testExtractValueFromFormattedSizeNoFormat(){
+
+ $this->assertEquals(-1,PMA_extractValueFromFormattedSize(100));
+ }
+
+ function testExtractValueFromFormattedSizeGB(){
+
+ $this->assertEquals(10737418240,PMA_extractValueFromFormattedSize("10GB"));
+ }
+
+ function testExtractValueFromFormattedSizeMB(){
+
+ $this->assertEquals(15728640,PMA_extractValueFromFormattedSize("15MB"));
+ }
+
+ function testExtractValueFromFormattedSizeK(){
+
+ $this->assertEquals(262144,PMA_extractValueFromFormattedSize("256K"));
+ }
+}
diff --git a/test/libraries/common/PMA_foreignKeySupported_test.php b/test/libraries/common/PMA_foreignKeySupported_test.php
index 8f02aa5..e0ebd2e 100644
--- a/test/libraries/common/PMA_foreignKeySupported_test.php
+++ b/test/libraries/common/PMA_foreignKeySupported_test.php
@@ -4,6 +4,8 @@
* Test for supporting foreign key
*
* @package phpMyAdmin-test
+ * @version $Id: PMA_foreignKeySupported_test.php
+ * @group common.lib-tests
*/
/*
diff --git a/test/libraries/common/PMA_formatNumberByteDown_test.php b/test/libraries/common/PMA_formatNumberByteDown_test.php
index ae0ce62..d800e1d 100644
--- a/test/libraries/common/PMA_formatNumberByteDown_test.php
+++ b/test/libraries/common/PMA_formatNumberByteDown_test.php
@@ -5,6 +5,7 @@
*
* @package phpMyAdmin-test
* @version $Id: PMA_formatNumberByteDown_test.php
+ * @group common.lib-tests
*/
/*
@@ -75,9 +76,9 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
*/
public function formatByteDownDataProvider() {
return array(
- array(10, 2, 2, array('10', 'B')),
+ array(10, 2, 2, array('10', __('B'))),
array(100, 2, 0, array('0', __('KiB'))),
- array(100, 3, 0, array('100', 'B')),
+ array(100, 3, 0, array('100', __('B'))),
array(100, 2, 2, array('0.10', __('KiB'))),
array(1034, 3, 2, array('1.01', __('KiB'))),
array(100233, 3, 3, array('97.884', __('KiB'))),
diff --git a/test/libraries/common/PMA_formatSql_test.php b/test/libraries/common/PMA_formatSql_test.php
new file mode 100644
index 0000000..51e58a1
--- /dev/null
+++ b/test/libraries/common/PMA_formatSql_test.php
@@ -0,0 +1,743 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_formatSql from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_formatSql_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_formatSql_test extends PHPUnit_Framework_TestCase{
+
+ /**
+ * temporary variable for globals array
+ */
+ protected $tmpCfg;
+
+ /**
+ * temporary variable for session array
+ */
+ protected $tmpSession;
+
+ /**
+ * storing globals and session
+ */
+ public function setUp() {
+ global $cfg;
+ $this->tmpCfg = $cfg;
+ }
+
+ /**
+ * recovering globals and session
+ */
+ public function tearDown() {
+ global $cfg;
+ $cfg = $this->tmpCfg;
+ }
+
+ function testFormatSQLNotArray(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'html';
+ $sql = "SELECT * FROM tTable;";
+ $this->assertEquals("<pre>\n$sql\n</pre>",PMA_formatSql($sql));
+ }
+
+ function testFormatSQLfmTypeHtml_1(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'html';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $sql = array (
+ 'raw' => 'SELECT 1;',
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'digit_integer',
+ 'data' => '1',
+ 'pos' => 8,
+ ),
+ 2 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 3,
+ );
+ $unparsed = "SELECT 1;";
+ $expected = '<span class="syntax"><span class="inner_sql"><span class="syntax_alpha syntax_alpha_reservedWord">SELECT</span></a> <span class="syntax_digit syntax_digit_integer">1</span> <span class="syntax_punct syntax_punct_queryend">;</span><br /><br /></span></span>';
+
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+ }
+
+ function testFormatSQLfmTypeHtml_2(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'html';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $unparsed = "SELECT * from `tTable`;";
+ $sql = array (
+ 'raw' => $unparsed,
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'from',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 5,
+ );
+ $expected = '<span class="syntax"><span class="inner_sql"><span class="syntax_alpha syntax_alpha_reservedWord">SELECT</span></a> <span class="syntax_punct">*</span> <br /><span class="syntax_alpha syntax_alpha_reservedWord">FROM</span> <span class="syntax_quote syntax_quote_backtick">`tTable`</span> <span class="syntax_punct syntax_punct_queryend">;</span><br /><br /></span></span>';
+
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+ }
+
+ function testFormatSQLfmTypeHtml_3(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'html';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $unparsed = 'SELECT * FROM `tTable_A` A INNER JOIN `tTable_B` B ON B.ID = A.ID;';
+ $sql = array (
+ 'raw' => $unparsed,
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'FROM',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable_A`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'A',
+ 'pos' => 26,
+ 'forbidden' => false,
+ ),
+ 5 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'INNER',
+ 'pos' => 32,
+ 'forbidden' => true,
+ ),
+ 6 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'JOIN',
+ 'pos' => 37,
+ 'forbidden' => true,
+ ),
+ 7 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable_B`',
+ 'pos' => 0,
+ ),
+ 8 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'B',
+ 'pos' => 50,
+ 'forbidden' => false,
+ ),
+ 9 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'ON',
+ 'pos' => 53,
+ 'forbidden' => true,
+ ),
+ 10 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'B',
+ 'pos' => 55,
+ 'forbidden' => false,
+ ),
+ 11 =>
+ array (
+ 'type' => 'punct_qualifier',
+ 'data' => '.',
+ 'pos' => 0,
+ ),
+ 12 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'ID',
+ 'pos' => 58,
+ 'forbidden' => false,
+ ),
+ 13 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '=',
+ 'pos' => 0,
+ ),
+ 14 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'A',
+ 'pos' => 62,
+ 'forbidden' => false,
+ ),
+ 15 =>
+ array (
+ 'type' => 'punct_qualifier',
+ 'data' => '.',
+ 'pos' => 0,
+ ),
+ 16 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'ID',
+ 'pos' => 65,
+ 'forbidden' => false,
+ ),
+ 17 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 18,
+ );
+
+ $expected = '<span class="syntax"><span class="inner_sql"><span class="syntax_alpha syntax_alpha_reservedWord">SELECT</span></a> <span class="syntax_punct">*</span> <br /><span class="syntax_alpha syntax_alpha_reservedWord">FROM</span> <span class="syntax_quote syntax_quote_backtick">`tTable_A`</span> <span class="syntax_alpha syntax_alpha_identifier">A</span><br /><span class="syntax_alpha syntax_alpha_reservedWord">INNER</span> <span class="syntax_alpha syntax_alpha_reservedWord">JOIN</span> <span class="syntax_quote syntax_quote_backtick">`tTable_B`</span> <span class="syntax_alpha syntax_alpha_identifier">B</span> <span class="syntax_alpha syntax_alpha_reservedWord">ON</span> <span class="syntax_alpha syntax_alpha_identifier">B</span><span class="syntax_punct syntax_punct_qualifier">.</span><span class="syntax_alpha syntax_alpha_identifier">ID</span> <span class="syntax_punct">=</span></a> <span class="syntax_alpha syntax_alpha_identifier">A</span><span class="syntax_punct syntax_punct_qualifier">.</span><span class="syntax_alpha syntax_alpha_identifier">ID</span><span class="syntax_punct syntax_punct_queryend">;</span><br /><br /></span></span>';
+
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+ }
+
+ function testFormatSQLfmTypeText_1(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'text';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $sql = array (
+ 'raw' => 'SELECT 1;',
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'digit_integer',
+ 'data' => '1',
+ 'pos' => 8,
+ ),
+ 2 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 3,
+ );
+ $unparsed = "SELECT 1;";
+ $expected = '<span class="inner_sql">SELECT</a> 1 ;<br /><br /></span>';
+
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+ }
+
+ function testFormatSQLfmTypeText_2(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'text';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $unparsed = "SELECT * from `tTable`;";
+ $sql = array (
+ 'raw' => $unparsed,
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'from',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 5,
+ );
+ $expected = '<span class="inner_sql">SELECT</a> * <br />FROM `tTable` ;<br /><br /></span>';
+
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+ }
+
+ function testFormatSQLfmTypeText_3(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'text';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $unparsed = 'SELECT * FROM `tTable_A` A INNER JOIN `tTable_B` B ON B.ID = A.ID;';
+ $sql = array (
+ 'raw' => $unparsed,
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'FROM',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable_A`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'A',
+ 'pos' => 26,
+ 'forbidden' => false,
+ ),
+ 5 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'INNER',
+ 'pos' => 32,
+ 'forbidden' => true,
+ ),
+ 6 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'JOIN',
+ 'pos' => 37,
+ 'forbidden' => true,
+ ),
+ 7 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable_B`',
+ 'pos' => 0,
+ ),
+ 8 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'B',
+ 'pos' => 50,
+ 'forbidden' => false,
+ ),
+ 9 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'ON',
+ 'pos' => 53,
+ 'forbidden' => true,
+ ),
+ 10 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'B',
+ 'pos' => 55,
+ 'forbidden' => false,
+ ),
+ 11 =>
+ array (
+ 'type' => 'punct_qualifier',
+ 'data' => '.',
+ 'pos' => 0,
+ ),
+ 12 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'ID',
+ 'pos' => 58,
+ 'forbidden' => false,
+ ),
+ 13 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '=',
+ 'pos' => 0,
+ ),
+ 14 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'A',
+ 'pos' => 62,
+ 'forbidden' => false,
+ ),
+ 15 =>
+ array (
+ 'type' => 'punct_qualifier',
+ 'data' => '.',
+ 'pos' => 0,
+ ),
+ 16 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'ID',
+ 'pos' => 65,
+ 'forbidden' => false,
+ ),
+ 17 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 18,
+ );
+ $expected = '<span class="inner_sql">SELECT</a> * <br />FROM `tTable_A` A<br />INNER JOIN `tTable_B` B ON B.ID =</a> A.ID;<br /><br /></span>';
+
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+ }
+
+ function testFormatSQLfmTypeNone_1(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'none';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $sql = array (
+ 'raw' => 'SELECT 1;',
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'digit_integer',
+ 'data' => '1',
+ 'pos' => 8,
+ ),
+ 2 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 3,
+ );
+ $unparsed = "SELECT 1;";
+
+ $expected = "<span class=\"inner_sql\"><pre>\nSELECT 1;\n</pre></span>";
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+
+ $expected = "SELECT 1;";
+ $this->assertEquals($expected,PMA_formatSql($sql));
+ }
+
+ function testFormatSQLfmTypeNone_2(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'none';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $unparsed = "SELECT * from `tTable`;";
+ $sql = array (
+ 'raw' => $unparsed,
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'from',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 5,
+ );
+
+ $expected = "<span class=\"inner_sql\"><pre>\nSELECT * from `tTable`;\n</pre></span>";
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+
+ $expected = "SELECT * from `tTable`;";
+ $this->assertEquals($expected,PMA_formatSql($sql));
+ }
+
+ function testFormatSQLfmTypeNone_3(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'none';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $unparsed = 'SELECT * FROM `tTable_A` A INNER JOIN `tTable_B` B ON B.ID = A.ID;';
+ $sql = array (
+ 'raw' => $unparsed,
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'FROM',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable_A`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'A',
+ 'pos' => 26,
+ 'forbidden' => false,
+ ),
+ 5 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'INNER',
+ 'pos' => 32,
+ 'forbidden' => true,
+ ),
+ 6 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'JOIN',
+ 'pos' => 37,
+ 'forbidden' => true,
+ ),
+ 7 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable_B`',
+ 'pos' => 0,
+ ),
+ 8 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'B',
+ 'pos' => 50,
+ 'forbidden' => false,
+ ),
+ 9 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'ON',
+ 'pos' => 53,
+ 'forbidden' => true,
+ ),
+ 10 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'B',
+ 'pos' => 55,
+ 'forbidden' => false,
+ ),
+ 11 =>
+ array (
+ 'type' => 'punct_qualifier',
+ 'data' => '.',
+ 'pos' => 0,
+ ),
+ 12 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'ID',
+ 'pos' => 58,
+ 'forbidden' => false,
+ ),
+ 13 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '=',
+ 'pos' => 0,
+ ),
+ 14 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'A',
+ 'pos' => 62,
+ 'forbidden' => false,
+ ),
+ 15 =>
+ array (
+ 'type' => 'punct_qualifier',
+ 'data' => '.',
+ 'pos' => 0,
+ ),
+ 16 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'ID',
+ 'pos' => 65,
+ 'forbidden' => false,
+ ),
+ 17 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 18,
+ );
+
+ $expected = "<span class=\"inner_sql\"><pre>\nSELECT * FROM `tTable_A` A INNER JOIN `tTable_B` B ON B.ID = A.ID;\n</pre></span>";
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+
+ $expected = 'SELECT * FROM `tTable_A` A INNER JOIN `tTable_B` B ON B.ID = A.ID;';
+ $this->assertEquals($expected,PMA_formatSql($sql));
+ }
+
+ function testFormatSQLWithoutType(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = '';
+ $cfg['MySQLManualType'] = 'viewable';
+ $sql = array (
+ 'raw' => 'SELECT 1;',
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'digit_integer',
+ 'data' => '1',
+ 'pos' => 8,
+ ),
+ 2 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 3,
+ );
+ $this->assertEmpty(PMA_formatSql($sql));
+ }
+
+ function testFormatSQLError(){
+ global $SQP_errorString;
+ $SQP_errorString = true;
+ $sql = array("raw" => "& \" < >");
+ $this->assertEquals("& " < >",PMA_formatSql($sql));
+ $SQP_errorString = false;
+ }
+}
diff --git a/test/libraries/common/PMA_generateHiddenMaxFileSize_test.php b/test/libraries/common/PMA_generateHiddenMaxFileSize_test.php
new file mode 100644
index 0000000..3cd6810
--- /dev/null
+++ b/test/libraries/common/PMA_generateHiddenMaxFileSize_test.php
@@ -0,0 +1,40 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_generateHiddenMaxFileSize from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_generateHiddenMaxFileSize_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_generateHiddenMaxFileSize_test extends PHPUnit_Framework_TestCase{
+
+ /*
+ * Data provider for test
+ */
+ public function dataProvider() {
+ return array(
+ array(10),
+ array("100"),
+ array(1024),
+ array("1024Mb"),
+ array(2147483648),
+ array("some_string")
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ * @return void
+ */
+ function test_generateHiddenMaxFileSize($size){
+ $this->assertEquals(PMA_generateHiddenMaxFileSize($size),
+ '<input type="hidden" name="MAX_FILE_SIZE" value="' .$size . '" />');
+ }
+}
diff --git a/test/libraries/common/PMA_generate_html_dropdown_test.php b/test/libraries/common/PMA_generate_html_dropdown_test.php
new file mode 100644
index 0000000..8e27c20
--- /dev/null
+++ b/test/libraries/common/PMA_generate_html_dropdown_test.php
@@ -0,0 +1,69 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_generate_html_dropdown_test from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_display_html_checkbox_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_generate_html_dropdown_test extends PHPUnit_Framework_TestCase
+{
+ function testGenerateHtmlDropdownEmpty()
+ {
+ $name = "test_dropdown_name";
+ $choices = array();
+ $active_choice = null;
+ $id = "test_<dropdown>_name";
+
+ $result = '<select name="' . htmlspecialchars($name) . '" id="' . htmlspecialchars($id) . '"></select>';
+
+ $this->assertEquals($result, PMA_generate_html_dropdown($name,$choices,$active_choice,$id));
+ }
+
+ function testGenerateHtmlDropdown()
+ {
+ $name = "&test_dropdown_name";
+ $choices = array("value_1" => "label_1", "value&_2\"" => "label_2");
+ $active_choice = null;
+ $id = "test_<dropdown>_name";
+
+ $result = '<select name="' . htmlspecialchars($name) . '" id="' . htmlspecialchars($id) . '">';
+ foreach ($choices as $one_choice_value => $one_choice_label) {
+ $result .= '<option value="' . htmlspecialchars($one_choice_value) . '"';
+ if ($one_choice_value == $active_choice) {
+ $result .= ' selected="selected"';
+ }
+ $result .= '>' . htmlspecialchars($one_choice_label) . '</option>';
+ }
+ $result .= '</select>';
+
+ $this->assertEquals($result, PMA_generate_html_dropdown($name,$choices,$active_choice,$id));
+ }
+
+ function testGenerateHtmlDropdownWithActive()
+ {
+ $name = "&test_dropdown_name";
+ $choices = array("value_1" => "label_1", "value&_2\"" => "label_2");
+ $active_choice = "value&_2\"";
+ $id = "test_<dropdown>_name";
+
+ $result = '<select name="' . htmlspecialchars($name) . '" id="' . htmlspecialchars($id) . '">';
+ foreach ($choices as $one_choice_value => $one_choice_label) {
+ $result .= '<option value="' . htmlspecialchars($one_choice_value) . '"';
+ if ($one_choice_value == $active_choice) {
+ $result .= ' selected="selected"';
+ }
+ $result .= '>' . htmlspecialchars($one_choice_label) . '</option>';
+ }
+ $result .= '</select>';
+
+ $this->assertEquals($result, PMA_generate_html_dropdown($name,$choices,$active_choice,$id));
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_getIcon_test.php b/test/libraries/common/PMA_getIcon_test.php
new file mode 100644
index 0000000..7835aca
--- /dev/null
+++ b/test/libraries/common/PMA_getIcon_test.php
@@ -0,0 +1,74 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_getIcon() from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_getIcon_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_getIcon_test extends PHPUnit_Framework_TestCase{
+
+ function testGetIconWithoutPropertiesIconic(){
+
+ $GLOBALS['cfg']['PropertiesIconic'] = false;
+ $GLOBALS['pmaThemeImage'] = 'theme/';
+
+ $this->assertEquals('<span class="nowrap"></span>',
+ PMA_getIcon('b_comment.png') );
+ }
+
+ function testGetIconWithPropertiesIconic(){
+
+ $GLOBALS['cfg']['PropertiesIconic'] = true;
+ $GLOBALS['pmaThemeImage'] = 'theme/';
+
+ $this->assertEquals('<span class="nowrap"><img src="'.$GLOBALS['pmaThemeImage']
+ . 'b_comment.png" title="" alt="" class="icon" width="16" height="16" /></span>',
+ PMA_getIcon('b_comment.png') );
+ }
+
+ function testGetIconAlternate(){
+
+ $GLOBALS['cfg']['PropertiesIconic'] = true;
+ $GLOBALS['pmaThemeImage'] = 'theme/';
+ $alternate_text = 'alt_str';
+
+ $this->assertEquals('<span class="nowrap"><img src="'.$GLOBALS['pmaThemeImage']
+ .'b_comment.png" title="' . $alternate_text . '" alt="' . $alternate_text
+ . '" class="icon" width="16" height="16" /></span>',
+ PMA_getIcon('b_comment.png',$alternate_text) );
+ }
+
+ function testGetIconWithContainer(){
+
+ $GLOBALS['cfg']['PropertiesIconic'] = true;
+ $GLOBALS['pmaThemeImage'] = 'theme/';
+ $alternate_text = 'alt_str';
+
+ $this->assertEquals('<span class="nowrap"><img src="'.$GLOBALS['pmaThemeImage']
+ .'b_comment.png" title="' . $alternate_text . '" alt="' . $alternate_text
+ . '" class="icon" width="16" height="16" /></span>',
+ PMA_getIcon('b_comment.png',$alternate_text, true) );
+
+ }
+
+ function testGetIconWithContainerAndForceText(){
+
+ $GLOBALS['cfg']['PropertiesIconic'] = true;
+ $GLOBALS['pmaThemeImage'] = 'theme/';
+ $alternate_text = 'alt_str';
+
+ $this->assertEquals('<span class="nowrap"><img src="'.$GLOBALS['pmaThemeImage']
+ .'b_comment.png" title="' . $alternate_text . '" alt="' . $alternate_text
+ . '" class="icon" width="16" height="16" /> ' . $alternate_text . '</span>',
+ PMA_getIcon('b_comment.png',$alternate_text, true, true) );
+
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_getTitleForTarget_test.php b/test/libraries/common/PMA_getTitleForTarget_test.php
new file mode 100644
index 0000000..1756681
--- /dev/null
+++ b/test/libraries/common/PMA_getTitleForTarget_test.php
@@ -0,0 +1,43 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_getTitleForTarget from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_getTitleForTarget_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_getTitleForTarget_test extends PHPUnit_Framework_TestCase{
+
+ function dataProvider(){
+ return array(
+ array('tbl_structure.php', __('Structure')),
+ array('tbl_sql.php', __('SQL'),),
+ array('tbl_select.php', __('Search'),),
+ array('tbl_change.php', __('Insert')),
+ array('sql.php', __('Browse')),
+ array('db_structure.php', __('Structure')),
+ array('db_sql.php', __('SQL')),
+ array('db_search.php', __('Search')),
+ array('db_operations.php', __('Operations')),
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ * @return void
+ */
+ function testGetTitleForTarget($target, $result){
+
+ $this->assertEquals($result,PMA_getTitleForTarget($target));
+ }
+
+}
+
+//PMA_getTitleForTarget
\ No newline at end of file
diff --git a/test/libraries/common/PMA_localisedDateTimespan_test.php b/test/libraries/common/PMA_localisedDateTimespan_test.php
index 6443b65..7ec0364 100644
--- a/test/libraries/common/PMA_localisedDateTimespan_test.php
+++ b/test/libraries/common/PMA_localisedDateTimespan_test.php
@@ -5,13 +5,13 @@
*
* @package phpMyAdmin-test
* @version $Id: PMA_localisedDateTimespan_test.php
+ * @group common.lib-tests
*/
/*
* Include to test.
*/
require_once 'libraries/common.lib.php';
-require_once 'libraries/php-gettext/gettext.inc';
class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase
{
diff --git a/test/libraries/common/PMA_pow_test.php b/test/libraries/common/PMA_pow_test.php
index c37dd0d..ff55e16 100644
--- a/test/libraries/common/PMA_pow_test.php
+++ b/test/libraries/common/PMA_pow_test.php
@@ -4,6 +4,8 @@
* Tests for PMA_pow() function from common.lib.php
*
* @package phpMyAdmin-test
+ * @version $Id: PMA_pow_test.php
+ * @group common.lib-tests
*/
/*
diff --git a/test/libraries/common/PMA_printableBitValue_test.php b/test/libraries/common/PMA_printableBitValue_test.php
index 54ad1ff..d211981 100644
--- a/test/libraries/common/PMA_printableBitValue_test.php
+++ b/test/libraries/common/PMA_printableBitValue_test.php
@@ -5,6 +5,7 @@
*
* @package phpMyAdmin-test
* @version $Id: PMA_printableBitValue_test.php
+ * @group common.lib-tests
*/
/*
diff --git a/test/libraries/common/PMA_quoting_slashing_test.php b/test/libraries/common/PMA_quoting_slashing_test.php
index a6ee615..f63539f 100644
--- a/test/libraries/common/PMA_quoting_slashing_test.php
+++ b/test/libraries/common/PMA_quoting_slashing_test.php
@@ -5,12 +5,14 @@
*
* @package phpMyAdmin-test
* @version $Id: PMA_quoting_slashing_test.php
+ * @group common.lib-tests
*/
/*
* Include to test.
*/
require_once 'libraries/common.lib.php';
+require_once 'libraries/sqlparser.data.php';
class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
{
@@ -88,9 +90,8 @@ class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
* @dataProvider backquoteDataProvider
*/
public function testBackquote($a, $b) {
- //$this->assertEquals($a, PMA_backquote($a, false));
- //$this->assertEquals($b, PMA_backquote($a));
- $this->markTestSkipped("Fix test for PMA_backquote() ");
+ $this->assertEquals($a, PMA_backquote($a, false));
+ $this->assertEquals($b, PMA_backquote($a));
}
}
?>
diff --git a/test/libraries/common/PMA_showMessage_test_disabled.php b/test/libraries/common/PMA_showMessage_test_disabled.php
new file mode 100644
index 0000000..7508564
--- /dev/null
+++ b/test/libraries/common/PMA_showMessage_test_disabled.php
@@ -0,0 +1,45 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_showMessage from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_showMessage_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+include 'libraries/core.lib.php';
+include 'libraries/vendor_config.php';
+include 'libraries/config.default.php';
+include 'libraries/database_interface.lib.php';
+include 'libraries/Table.class.php';
+require 'libraries/php-gettext/gettext.inc';
+
+class PMA_showMessage_test extends PHPUnit_Framework_TestCase
+{
+ protected $backupGlobals = FALSE;
+
+ function testShowMessageNotAjax(){
+// global $cfg, $GLOBALS;
+
+// $GLOBALS['sql_query'] = "SELECT * FROM tTable";
+// $GLOBALS['table'] = 'tbl1';
+// $cfg['SQP']['fmtType'] = 'none';
+// $cfg['ShowTooltip'] = false;
+// $cfg['ShowSQL'] = true;
+// $cfg['MaxCharactersInDisplayedSQL'] = 1000;
+//
+// print_r($cfg);
+
+ $GLOBALS['is_ajax_request'] = false;
+ $GLOBALS['db'] = 'db';
+ $GLOBALS['table'] = 'table';
+
+ $this->assertEquals("",PMA_showMessage("msg"));
+ $this->assertTrue(true);
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_stringOperations_test.php b/test/libraries/common/PMA_stringOperations_test.php
index 6af1748..f57a2b4 100644
--- a/test/libraries/common/PMA_stringOperations_test.php
+++ b/test/libraries/common/PMA_stringOperations_test.php
@@ -5,6 +5,7 @@
*
* @package phpMyAdmin-test
* @version $Id: PMA_stringOperations_test.php
+ * @group common.lib-tests
*/
/*
diff --git a/test/libraries/common/PMA_unsupportedDatatypes_test.php b/test/libraries/common/PMA_unsupportedDatatypes_test.php
new file mode 100644
index 0000000..686e4ee
--- /dev/null
+++ b/test/libraries/common/PMA_unsupportedDatatypes_test.php
@@ -0,0 +1,32 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_unsupportedDatatypes from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_unsupportedDatatypes_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_unsupportedDatatypes_test extends PHPUnit_Framework_TestCase
+{
+
+ function testNotSupportedDataTypes()
+ {
+ $no_support_types = array('geometry',
+ 'point',
+ 'linestring',
+ 'polygon',
+ 'multipoint',
+ 'multilinestring',
+ 'multipolygon',
+ 'geometrycollection'
+ );
+ $this->assertEquals($no_support_types, PMA_unsupportedDatatypes());
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_whichCrlf_test.php b/test/libraries/common/PMA_whichCrlf_test.php
index 6d8e25a..52d8323 100644
--- a/test/libraries/common/PMA_whichCrlf_test.php
+++ b/test/libraries/common/PMA_whichCrlf_test.php
@@ -5,6 +5,7 @@
*
* @package phpMyAdmin-test
* @version $Id: PMA_whichCrlf_test.php
+ * @group common.lib-tests
*/
/*
diff --git a/themes/original/jquery/jquery-ui-1.8.override.css b/themes/original/jquery/jquery-ui-1.8.override.css
new file mode 100644
index 0000000..4aee6fb
--- /dev/null
+++ b/themes/original/jquery/jquery-ui-1.8.override.css
@@ -0,0 +1,7 @@
+/**
+ * Use this file to override styles set by jquery-ui-1.8.custom.css
+ */
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-size: 1em; }
diff --git a/themes/pmahomme/jquery/jquery-ui-1.8.override.css b/themes/pmahomme/jquery/jquery-ui-1.8.override.css
new file mode 100644
index 0000000..4aee6fb
--- /dev/null
+++ b/themes/pmahomme/jquery/jquery-ui-1.8.override.css
@@ -0,0 +1,7 @@
+/**
+ * Use this file to override styles set by jquery-ui-1.8.custom.css
+ */
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-size: 1em; }
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, unittesting, updated. RELEASE_3_4_3_1-6550-gfc5a9a6
by Herman van Rink 06 Jul '11
by Herman van Rink 06 Jul '11
06 Jul '11
The branch, unittesting has been updated
via fc5a9a6131f9bec3c7f8c91666f483b9487c1132 (commit)
from d17aab53e4fd3a9f45428e86864c8a985e2a0100 (commit)
- Log -----------------------------------------------------------------
commit fc5a9a6131f9bec3c7f8c91666f483b9487c1132
Author: Herman van Rink <rink(a)initfour.nl>
Date: Wed Jul 6 10:27:52 2011 +0200
Added htaccess and README to test directory
-----------------------------------------------------------------------
Summary of changes:
test/.htaccess | 4 ++++
test/README | 11 +++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
create mode 100644 test/.htaccess
create mode 100644 test/README
diff --git a/test/.htaccess b/test/.htaccess
new file mode 100644
index 0000000..70a1177
--- /dev/null
+++ b/test/.htaccess
@@ -0,0 +1,4 @@
+# This folder does not require access over HTTP
+# (the following directive denies access by default)
+# For more information see: http://httpd.apache.org/docs/current/mod/mod_authz_host.html#allow
+Order allow,deny
diff --git a/test/README b/test/README
new file mode 100644
index 0000000..a7e287a
--- /dev/null
+++ b/test/README
@@ -0,0 +1,11 @@
+PhpMyAdmin test suite
+=====================
+
+This directory is protected from web visitors by a .htaccess file.
+
+For more information on allowing http access to this directory see:
+http://httpd.apache.org/docs/current/mod/mod_authz_host.html#allow
+
+Please visit the wiki for more information on unit testing:
+https://wiki.phpmyadmin.net/pma/UnitTesting
+
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-6546-g39cb55a
by Herman van Rink 05 Jul '11
by Herman van Rink 05 Jul '11
05 Jul '11
The branch, master has been updated
via 39cb55a0defbf2634b2bc097f96e0d559303f5f7 (commit)
via 82f83dac2f6b07bef76f6c3fb795ce7c0c417af8 (commit)
from 70c70db1392e703346434e65d59110a6ba321367 (commit)
- Log -----------------------------------------------------------------
commit 39cb55a0defbf2634b2bc097f96e0d559303f5f7
Merge: 82f83dac2f6b07bef76f6c3fb795ce7c0c417af8 70c70db1392e703346434e65d59110a6ba321367
Author: Herman van Rink <rink(a)initfour.nl>
Date: Tue Jul 5 14:46:24 2011 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 82f83dac2f6b07bef76f6c3fb795ce7c0c417af8
Author: Herman van Rink <rink(a)initfour.nl>
Date: Tue Jul 5 14:46:13 2011 +0200
Fixed XSS in unreleased RecentTable class
-----------------------------------------------------------------------
Summary of changes:
libraries/RecentTable.class.php | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libraries/RecentTable.class.php b/libraries/RecentTable.class.php
index f844bbc..bfb6081 100644
--- a/libraries/RecentTable.class.php
+++ b/libraries/RecentTable.class.php
@@ -142,7 +142,7 @@ class PMA_RecentTable
$html = '<option value="">(' . __('Recent tables') . ') ...</option>';
if (count($this->tables)) {
foreach ($this->tables as $table) {
- $html .= '<option value="' . $table . '">' . $table . '</option>';
+ $html .= '<option value="' . htmlspecialchars($table) . '">' . htmlspecialchars($table) . '</option>';
}
} else {
$html .= '<option value="">' . __('There are no recent tables') . '</option>';
@@ -158,7 +158,7 @@ class PMA_RecentTable
public function getHtmlSelect()
{
$html = '<input type="hidden" name="goto" id="LeftDefaultTabTable" value="' .
- $GLOBALS['cfg']['LeftDefaultTabTable'] . '" />';
+ htmlspecialchars($GLOBALS['cfg']['LeftDefaultTabTable']) . '" />';
$html .= '<select name="table" id="recentTable">';
$html .= $this->getHtmlSelectOption();
$html .= '</select>';
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-6544-g70c70db
by Rouslan Placella 05 Jul '11
by Rouslan Placella 05 Jul '11
05 Jul '11
The branch, master has been updated
via 70c70db1392e703346434e65d59110a6ba321367 (commit)
from a88054dae9a969c0c9ec6477fce130b70a777749 (commit)
- Log -----------------------------------------------------------------
commit 70c70db1392e703346434e65d59110a6ba321367
Author: Rouslan Placella <rouslan(a)placella.com>
Date: Tue Jul 5 13:00:21 2011 +0100
Fix for bug #3353856 - AJAX dialogs use wrong font-size
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
js/db_routines.js | 4 ++--
js/functions.js | 2 +-
libraries/header_meta_style.inc.php | 7 +++++++
themes/original/jquery/jquery-ui-1.8.override.css | 7 +++++++
themes/pmahomme/jquery/jquery-ui-1.8.override.css | 7 +++++++
6 files changed, 25 insertions(+), 3 deletions(-)
create mode 100644 themes/original/jquery/jquery-ui-1.8.override.css
create mode 100644 themes/pmahomme/jquery/jquery-ui-1.8.override.css
diff --git a/ChangeLog b/ChangeLog
index ff4f0ae..4ae25e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,7 @@ phpMyAdmin - ChangeLog
+ Display direction (horizontal/vertical) no longer displayed by default
+ Shift/click support in database Structure
+ Show/hide column in table Browse
+- bug #3353856 [AJAX] AJAX dialogs use wrong font-size
3.4.4.0 (not yet released)
- bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes
diff --git a/js/db_routines.js b/js/db_routines.js
index 95254ca..ceb0962 100644
--- a/js/db_routines.js
+++ b/js/db_routines.js
@@ -308,7 +308,7 @@ $(document).ready(function() {
/**
* Display the dialog to the user
*/
- $ajaxDialog = $('<div style="font-size: 0.9em;">'+data.message+'</div>').dialog({
+ $ajaxDialog = $('<div>'+data.message+'</div>').dialog({
width: 700, // TODO: make a better decision about the size
height: 550, // of the dialog based on the size of the viewport
buttons: button_options,
@@ -529,7 +529,7 @@ $(document).ready(function() {
/**
* Display the dialog to the user
*/
- $ajaxDialog = $('<div style="font-size: 0.9em;">'+data.message+'</div>').dialog({
+ $ajaxDialog = $('<div>'+data.message+'</div>').dialog({
width: 650, // TODO: make a better decision about the size
// of the dialog based on the size of the viewport
buttons: button_options,
diff --git a/js/functions.js b/js/functions.js
index e25ec98..9cdb44e 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -2445,7 +2445,7 @@ $(document).ready(function() {
/**
* Display the dialog to the user
*/
- var $ajaxDialog = $('<div style="font-size: 0.9em;">'+data.message+'</div>').dialog({
+ var $ajaxDialog = $('<div>'+data.message+'</div>').dialog({
width: 500,
buttons: button_options,
title: data.title
diff --git a/libraries/header_meta_style.inc.php b/libraries/header_meta_style.inc.php
index 5e5c533..e78b653 100644
--- a/libraries/header_meta_style.inc.php
+++ b/libraries/header_meta_style.inc.php
@@ -48,4 +48,11 @@ if ($GLOBALS['text_dir'] == 'ltr') {
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>phpmyadmin.css.php<?php echo PMA_generate_common_url(array('server' => $GLOBALS['server'])); ?>&js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>print.css" media="print" />
<link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['pmaThemePath']; ?>/jquery/jquery-ui-1.8.custom.css" />
+<?php
+ if (is_readable($GLOBALS['pmaThemePath'] . '/jquery/jquery-ui-1.8.override.css')) {
+?>
+ <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['pmaThemePath']; ?>/jquery/jquery-ui-1.8.override.css" />
+<?php
+ }
+?>
<meta name="robots" content="noindex,nofollow" />
diff --git a/themes/original/jquery/jquery-ui-1.8.override.css b/themes/original/jquery/jquery-ui-1.8.override.css
new file mode 100644
index 0000000..4aee6fb
--- /dev/null
+++ b/themes/original/jquery/jquery-ui-1.8.override.css
@@ -0,0 +1,7 @@
+/**
+ * Use this file to override styles set by jquery-ui-1.8.custom.css
+ */
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-size: 1em; }
diff --git a/themes/pmahomme/jquery/jquery-ui-1.8.override.css b/themes/pmahomme/jquery/jquery-ui-1.8.override.css
new file mode 100644
index 0000000..4aee6fb
--- /dev/null
+++ b/themes/pmahomme/jquery/jquery-ui-1.8.override.css
@@ -0,0 +1,7 @@
+/**
+ * Use this file to override styles set by jquery-ui-1.8.custom.css
+ */
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-size: 1em; }
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, unittesting, created. RELEASE_3_4_3_1-6549-gd17aab5
by Herman van Rink 05 Jul '11
by Herman van Rink 05 Jul '11
05 Jul '11
The branch, unittesting has been created
at d17aab53e4fd3a9f45428e86864c8a985e2a0100 (commit)
- Log -----------------------------------------------------------------
commit d17aab53e4fd3a9f45428e86864c8a985e2a0100
Author: Herman van Rink <rink(a)initfour.nl>
Date: Tue Jul 5 08:36:18 2011 +0200
Disabled two blowfish tests due to differences in the initialization factor between systems
commit cf5d62b7ca87c463d831ad0a8c2c31aca5c0b606
Author: Herman van Rink <rink(a)initfour.nl>
Date: Tue Jul 5 08:35:15 2011 +0200
Code style
commit 0c5c137403311e0e34f9ca32eea6f9f6672f4ed6
Merge: 9e8e70f0a1d21eaab1b3256c2249721150a93c7e 7087e74c63dd4460e3dff2d8986978aa014ce23b
Author: Herman van Rink <rink(a)initfour.nl>
Date: Tue Jul 5 08:24:41 2011 +0200
Merge remote-tracking branch 'zarubin/master' into unittesting
commit 7087e74c63dd4460e3dff2d8986978aa014ce23b
Merge: e31ee99f7e1f3a2ddde3cdca06af6ab0fa437ece 64e4f9fe0ed661e16172cc354e5dfd0b9111342e
Author: Zarubin Stas <zarubin(a)zsv.org.ua>
Date: Mon Jul 4 04:02:38 2011 +0300
Merge remote-tracking branch 'upstream/master'
commit e31ee99f7e1f3a2ddde3cdca06af6ab0fa437ece
Merge: f05749656d8aad37cf52c11fc9fa5d187c3f8f8c d5dd8a2d37f0fab931df449d4c6a744821a78afb
Author: Zarubin Stas <zarubin.stas(a)gmail.com>
Date: Fri Jul 1 22:39:49 2011 +0300
Merge remote-tracking branch 'upstream/master'
commit f05749656d8aad37cf52c11fc9fa5d187c3f8f8c
Author: Zarubin Stas <zarubin.stas(a)gmail.com>
Date: Fri Jul 1 22:36:54 2011 +0300
Fix for PMA_headerLocation_test
commit 0e2e973f6c91418b26e65e639d597e56bf5cfde9
Author: Zarubin Stas <zarubin.stas(a)gmail.com>
Date: Fri Jul 1 18:53:24 2011 +0300
Set is_ajax_request to true to avoid notice - "Automatically appended backtick to the end of query!" for queries with unclosed quotes
commit d8372daa55fc91ee035a07dcef83dd96d1ace837
Author: Zarubin Stas <zarubin.stas(a)gmail.com>
Date: Wed Jun 29 20:20:27 2011 +0300
Add Apache Ant build configuration.
commit 52b0206a0c910f90e298613d0037646e43045c12
Merge: f7d7102d2fc595f837f778fe18488251bf980229 46c40093d7f21906e8c92cf1c5de7f1f2936ff35
Author: Zarubin Stas <zarubin.stas(a)gmail.com>
Date: Wed Jun 29 20:10:05 2011 +0300
Merge remote-tracking branch 'upstream/master'
commit f7d7102d2fc595f837f778fe18488251bf980229
Author: Zarubin Stas <zarubin.stas(a)gmail.com>
Date: Wed Jun 29 20:06:27 2011 +0300
- Unit Test grouped by library directory
- Added configuration file phpunit.xml.dist and bootstraper-dist.php
- Ignoring phpunit.xml, bootstraper.php and build/
-----------------------------------------------------------------------
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-6543-ga88054d
by Rouslan Placella 04 Jul '11
by Rouslan Placella 04 Jul '11
04 Jul '11
The branch, master has been updated
via a88054dae9a969c0c9ec6477fce130b70a777749 (commit)
via 39cb4d4798f495db25bf65dda95fc8c4e9893367 (commit)
from 064d399d878f36a0a26f6db890b947bccb3ef8ab (commit)
- Log -----------------------------------------------------------------
commit a88054dae9a969c0c9ec6477fce130b70a777749
Merge: 064d399d878f36a0a26f6db890b947bccb3ef8ab 39cb4d4798f495db25bf65dda95fc8c4e9893367
Author: Rouslan Placella <rouslan(a)placella.com>
Date: Mon Jul 4 19:04:29 2011 +0100
Merge branch 'QA_3_4'
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
tbl_indexes.php | 10 ++++------
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3842abc..ff4f0ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -40,6 +40,7 @@ phpMyAdmin - ChangeLog
- bug #3340151 [export] Working SQL query exports error page
- bug #3353649 [interface] "Create an index on X columns" form not validated
- bug #3350790 [interface] JS error in Table->Structure->Index->Edit
+- bug #3353811 [interface] Info message has "error" class
3.4.3.1 (2011-07-02)
- [security] Fixed possible session manipulation in swekey authentication, see PMASA-2011-5
diff --git a/tbl_indexes.php b/tbl_indexes.php
index 6491c10..7e9bec6 100644
--- a/tbl_indexes.php
+++ b/tbl_indexes.php
@@ -168,7 +168,9 @@ if (isset($_REQUEST['create_index'])) {
}
?>
</legend>
-
+<?php
+PMA_Message::notice(__('("PRIMARY" <b>must</b> be the name of and <b>only of</b> a primary key!)'))->display();
+?>
<div class="formelement">
<label for="input_index_name"><?php echo __('Index name:'); ?></label>
<input type="text" name="index[Key_name]" id="input_index_name" size="25"
@@ -183,11 +185,7 @@ if (isset($_REQUEST['create_index'])) {
<?php echo PMA_showMySQLDocu('SQL-Syntax', 'ALTER_TABLE'); ?>
</div>
-
-<br class="clearfloat" />
-<?php
-PMA_Message::error(__('("PRIMARY" <b>must</b> be the name of and <b>only of</b> a primary key!)'))->display();
-?>
+<br class="clearfloat" /><br />
<table id="index_columns">
<thead>
hooks/post-receive
--
phpMyAdmin
1
0