Git
Threads by month
- ----- 2026 -----
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- 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
- 9 participants
- 39110 discussions
[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
[Phpmyadmin-git] [SCM] phpMyAdmin branch, QA_3_4, updated. RELEASE_3_4_3_1-20-g39cb4d4
by Rouslan Placella 04 Jul '11
by Rouslan Placella 04 Jul '11
04 Jul '11
The branch, QA_3_4 has been updated
via 39cb4d4798f495db25bf65dda95fc8c4e9893367 (commit)
from 2ec0de3a9f8d77c750f02c27ba8d83b407a87ea5 (commit)
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
tbl_indexes.php | 10 ++++------
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 377449c..00f3ba4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,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 e2ef288..54923a0 100644
--- a/tbl_indexes.php
+++ b/tbl_indexes.php
@@ -161,7 +161,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"
@@ -176,11 +178,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>
<thead>
hooks/post-receive
--
phpMyAdmin
1
0
[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-6541-g064d399
by Rouslan Placella 04 Jul '11
by Rouslan Placella 04 Jul '11
04 Jul '11
The branch, master has been updated
via 064d399d878f36a0a26f6db890b947bccb3ef8ab (commit)
via 2ec0de3a9f8d77c750f02c27ba8d83b407a87ea5 (commit)
from 9e8e70f0a1d21eaab1b3256c2249721150a93c7e (commit)
- Log -----------------------------------------------------------------
commit 064d399d878f36a0a26f6db890b947bccb3ef8ab
Merge: 9e8e70f0a1d21eaab1b3256c2249721150a93c7e 2ec0de3a9f8d77c750f02c27ba8d83b407a87ea5
Author: Rouslan Placella <rouslan(a)placella.com>
Date: Mon Jul 4 13:03:14 2011 +0100
Merge branch 'QA_3_4'
Conflicts:
tbl_indexes.php
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
js/indexes.js | 12 ++++++------
tbl_indexes.php | 4 ++--
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 312e148..3842abc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,6 +39,7 @@ 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
3.4.3.1 (2011-07-02)
- [security] Fixed possible session manipulation in swekey authentication, see PMASA-2011-5
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/tbl_indexes.php b/tbl_indexes.php
index 995ee24..6491c10 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,
hooks/post-receive
--
phpMyAdmin
1
0
[Phpmyadmin-git] [SCM] phpMyAdmin branch, QA_3_4, updated. RELEASE_3_4_3_1-19-g2ec0de3
by Rouslan Placella 04 Jul '11
by Rouslan Placella 04 Jul '11
04 Jul '11
The branch, QA_3_4 has been updated
via 2ec0de3a9f8d77c750f02c27ba8d83b407a87ea5 (commit)
from c4ecddb5a2df58f26675f0162d8f2335b71bfbd5 (commit)
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
js/indexes.js | 12 ++++++------
tbl_indexes.php | 4 ++--
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 459bd1f..377449c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ 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
3.4.3.1 (2011-07-02)
- [security] Fixed possible session manipulation in swekey authentication, see PMASA-2011-5
diff --git a/js/indexes.js b/js/indexes.js
index a15b249..c7bed94 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/tbl_indexes.php b/tbl_indexes.php
index 46e5e1c..e2ef288 100644
--- a/tbl_indexes.php
+++ b/tbl_indexes.php
@@ -133,8 +133,8 @@ if (isset($_REQUEST['index']) && is_array($_REQUEST['index'])) {
?>
<form action="./tbl_indexes.php" method="post" name="index_frm"
- 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,
hooks/post-receive
--
phpMyAdmin
1
0
[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-6539-g9e8e70f
by Rouslan Placella 04 Jul '11
by Rouslan Placella 04 Jul '11
04 Jul '11
The branch, master has been updated
via 9e8e70f0a1d21eaab1b3256c2249721150a93c7e (commit)
via c4ecddb5a2df58f26675f0162d8f2335b71bfbd5 (commit)
from bc828427c771ccf1197b2e0295dbd4f968e5752c (commit)
- Log -----------------------------------------------------------------
commit 9e8e70f0a1d21eaab1b3256c2249721150a93c7e
Merge: bc828427c771ccf1197b2e0295dbd4f968e5752c c4ecddb5a2df58f26675f0162d8f2335b71bfbd5
Author: Rouslan Placella <rouslan(a)placella.com>
Date: Mon Jul 4 12:32:23 2011 +0100
Merge branch 'QA_3_4'
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
tbl_structure.php | 8 ++------
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 25516fe..312e148 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -38,6 +38,7 @@ phpMyAdmin - ChangeLog
- bug #3323101 [parser] Invalid escape sequence in SQL parser
- 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
3.4.3.1 (2011-07-02)
- [security] Fixed possible session manipulation in swekey authentication, see PMASA-2011-5
diff --git a/tbl_structure.php b/tbl_structure.php
index 10cc8d3..afca2ea 100644
--- a/tbl_structure.php
+++ b/tbl_structure.php
@@ -723,7 +723,7 @@ if (! $tbl_is_view && ! $db_is_information_schema && 'ARCHIVE' != $tbl_type) {
?>
</div>
<form action="./tbl_indexes.php" method="post"
- onsubmit="return checkFormElementInRange(this, 'idx_num_fields',
+ onsubmit="return checkFormElementInRange(this, 'added_fields',
'<?php echo str_replace('\'', '\\\'', __('Column count has to be larger than zero.')); ?>',
1)">
<fieldset>
@@ -732,11 +732,7 @@ if (! $tbl_is_view && ! $db_is_information_schema && 'ARCHIVE' != $tbl_type) {
echo sprintf(__('Create an index on %s columns'),
'<input type="text" size="2" name="added_fields" value="1" />');
?>
- <input type="submit" name="create_index" value="<?php echo __('Go'); ?>"
- onclick="return checkFormElementInRange(this.form,
- 'idx_num_fields',
- '<?php echo str_replace('\'', '\\\'', __('Column count has to be larger than zero.')); ?>',
- 1)" />
+ <input type="submit" name="create_index" value="<?php echo __('Go'); ?>" />
</fieldset>
</form>
<br />
hooks/post-receive
--
phpMyAdmin
1
0