diff --git a/ChangeLog b/ChangeLog index 849fd5bc5d..336c41e147 100644 --- a/ChangeLog +++ b/ChangeLog @@ -54,6 +54,7 @@ phpMyAdmin - ChangeLog - bug #4066 varchar field not truncated in table browse mode + rfe #1435 Opening database should expand it in the navigation menu - (performance) Removed ShowTooltip directive +- bug #4046 Exporting huge Tables causes memory-Problems 4.0.5.0 (2013-08-04) - bug #3977 Not detected configuration storage diff --git a/export.php b/export.php index d2c07a4450..256e65fea9 100644 --- a/export.php +++ b/export.php @@ -10,8 +10,8 @@ * Get the variables sent or posted to this script and a core script */ if (!defined('TESTSUITE')) { + define('PMA_BYPASS_GET_INSTANCE', 1); require_once 'libraries/common.inc.php'; - require_once 'libraries/zip.lib.php'; require_once 'libraries/plugin_interface.lib.php'; diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 505c30be51..2436308b9f 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -731,8 +731,10 @@ if (@file_exists($_SESSION['PMA_Theme']->getLayoutFile())) { } if (! defined('PMA_MINIMUM_COMMON')) { - // get a dummy object to ensure that the class is instanciated - PMA_Response::getInstance(); + if (! defined('PMA_BYPASS_GET_INSTANCE')) { + // get a dummy object to ensure that the class is instanciated + PMA_Response::getInstance(); + } /** * Character set conversion. @@ -1060,7 +1062,9 @@ if (! defined('PMA_MINIMUM_COMMON')) { * Inclusion of profiling scripts is needed on various * pages like sql, tbl_sql, db_sql, tbl_select */ - $response = PMA_Response::getInstance(); + if (! defined('PMA_BYPASS_GET_INSTANCE')) { + $response = PMA_Response::getInstance(); + } if (isset($_SESSION['profiling'])) { $header = $response->getHeader(); $scripts = $header->getScripts(); @@ -1079,7 +1083,7 @@ if (! defined('PMA_MINIMUM_COMMON')) { * There is no point in even attempting to process * an ajax request if there is a token mismatch */ - if ($response->isAjax() && $token_mismatch) { + if (isset($response) && $response->isAjax() && $token_mismatch) { $response->isSuccess(false); $response->addJSON( 'message', diff --git a/po/ko.po b/po/ko.po index 87d6ed6cf5..8432869dd0 100644 --- a/po/ko.po +++ b/po/ko.po @@ -4,10 +4,9 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.1-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2013-08-18 06:16-0400\n" -"PO-Revision-Date: 2013-08-16 04:26+0200\n" -"Last-Translator: philip lim \n" -"Language-Team: Korean \n" +"PO-Revision-Date: 2013-08-31 13:16+0200\n" +"Last-Translator: Dong-bum Kim \n" +"Language-Team: Korean \n" "Language: ko\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -4830,7 +4829,7 @@ msgstr "데이터베이스 표시 선택사항" #: libraries/config/messages.inc.php:180 setup/frames/menu.inc.php:21 msgid "Navigation panel" -msgstr "" +msgstr "네비게이션 패널" #: libraries/config/messages.inc.php:181 msgid "Customize appearance of the navigation panel" @@ -5165,7 +5164,7 @@ msgstr "" #: libraries/config/messages.inc.php:273 msgid "Limit column characters" -msgstr "" +msgstr "컬럼 문자 제한" #: libraries/config/messages.inc.php:274 msgid "" @@ -5224,7 +5223,7 @@ msgstr "LONGTEXT의 경우 더 큰 textarea를 사용" #: libraries/config/messages.inc.php:284 msgid "Maximum number of characters used when a SQL query is displayed" -msgstr "" +msgstr "SQL 쿼리 출력시 사용할 문자수" #: libraries/config/messages.inc.php:285 msgid "Maximum displayed SQL length" @@ -5480,7 +5479,7 @@ msgstr "MySQL 예약어 경고" #: libraries/config/messages.inc.php:342 msgid "How to display the menu tabs" -msgstr "" +msgstr "메뉴탭 보여주기 방식" #: libraries/config/messages.inc.php:344 msgid "How to display various action links" @@ -5488,7 +5487,7 @@ msgstr "" #: libraries/config/messages.inc.php:345 msgid "Disallow BLOB and BINARY columns from editing" -msgstr "" +msgstr "BLOB, 바이너리 컬럼 편집 허용 안함" #: libraries/config/messages.inc.php:346 msgid "Protect binary columns" @@ -5511,7 +5510,7 @@ msgstr "" #: libraries/config/messages.inc.php:351 msgid "Query history length" -msgstr "" +msgstr "쿼리 기록 길이" #: libraries/config/messages.inc.php:352 msgid "Tab displayed when opening a new query window" @@ -5584,7 +5583,7 @@ msgstr "사용하지 않으면 빈칸으로 두세요" #: libraries/config/messages.inc.php:370 msgid "Host authorization order" -msgstr "" +msgstr "호스트 인증 지시" #: libraries/config/messages.inc.php:371 msgid "Leave blank for defaults" @@ -5752,7 +5751,7 @@ msgstr "SQL 쿼리 히스토리 테이블" #: libraries/config/messages.inc.php:406 msgid "Hostname where MySQL server is running" -msgstr "" +msgstr "MySQL 서버가 구동중인 호스트의 이름" #: libraries/config/messages.inc.php:407 msgid "Server hostname" @@ -5959,10 +5958,9 @@ msgid "Defines the list of statements the auto-creation uses for new versions." msgstr "" #: libraries/config/messages.inc.php:449 -#, fuzzy #| msgid "Statements" msgid "Statements to track" -msgstr "명세" +msgstr "문장 추적" #: libraries/config/messages.inc.php:450 msgid "" @@ -6060,7 +6058,7 @@ msgstr "" #: libraries/config/messages.inc.php:465 msgid "Verbose name of this server" -msgstr "" +msgstr "이 서버 이름 보기" #: libraries/config/messages.inc.php:466 msgid "Whether a user should be displayed a "show all (rows)" button" @@ -6068,7 +6066,7 @@ msgstr "" #: libraries/config/messages.inc.php:467 msgid "Allow to display all the rows" -msgstr "" +msgstr "모든 행 보기 허용" #: libraries/config/messages.inc.php:468 msgid "" @@ -6186,7 +6184,7 @@ msgstr "질의 상자 숨기기" #: libraries/config/messages.inc.php:492 msgid "Allow to display database and table statistics (eg. space usage)" -msgstr "" +msgstr "데이터베이스와 테이블 상태 출력 허용 (사용량 등)" #: libraries/config/messages.inc.php:493 msgid "Show statistics" diff --git a/po/zh_CN.po b/po/zh_CN.po index 129be80176..b5740986e0 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.1-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2013-08-18 06:16-0400\n" -"PO-Revision-Date: 2013-08-30 16:07+0200\n" +"PO-Revision-Date: 2013-08-31 03:56+0200\n" "Last-Translator: shanyan baishui \n" "Language-Team: Simplified Chinese " "\n" @@ -4297,27 +4297,27 @@ msgstr "默认显示模式" #: libraries/config/messages.inc.php:50 msgid "Tab that is displayed when entering a database" -msgstr "当进入数据库时默认显示的选项卡" +msgstr "当进入数据库时默认显示的标签页" #: libraries/config/messages.inc.php:51 msgid "Default database tab" -msgstr "数据库默认选项卡" +msgstr "数据库默认标签页" #: libraries/config/messages.inc.php:52 msgid "Tab that is displayed when entering a server" -msgstr "当进入服务器时默认显示的选项卡" +msgstr "当进入服务器时默认显示的标签页" #: libraries/config/messages.inc.php:53 msgid "Default server tab" -msgstr "服务器默认选项卡" +msgstr "服务器默认标签页" #: libraries/config/messages.inc.php:54 msgid "Tab that is displayed when entering a table" -msgstr "当进入表时默认显示的选项卡" +msgstr "当进入表时默认显示的标签页" #: libraries/config/messages.inc.php:55 msgid "Default table tab" -msgstr "表默认选项卡" +msgstr "表默认标签页" #: libraries/config/messages.inc.php:56 msgid "Whether the table structure actions should be hidden" @@ -5097,7 +5097,7 @@ msgstr "SQL 最大显示长度" #: libraries/config/messages.inc.php:286 libraries/config/messages.inc.php:293 #: libraries/config/messages.inc.php:349 msgid "Users cannot set a higher value" -msgstr "用户不能设置更大的值" +msgstr "用户设置不能超过该值" #: libraries/config/messages.inc.php:287 msgid "Maximum number of databases displayed in database list" @@ -5110,20 +5110,18 @@ msgstr "最大数据库数量" #: libraries/config/messages.inc.php:289 msgid "" "The number of items that can be displayed on each page of the navigation tree" -msgstr "导航树上每页能显示的项目数量" +msgstr "每页导航树所能显示的最大项数" #: libraries/config/messages.inc.php:290 msgid "Maximum items in branch" -msgstr "分支中最大项目数" +msgstr "节点中最大项数" #: libraries/config/messages.inc.php:291 msgid "" "Number of rows displayed when browsing a result set. If the result set " "contains more rows, "Previous" and "Next" links will be " "shown." -msgstr "" -"浏览一个结果集时一次显示的最多行数。如果结果集超过此值,将会显示 "上一页" -"" 和 "下一页" 的链接。" +msgstr "浏览结果集时显示的行数。若结果集总行数超过该值,将会显示 "上一页" 和 "下一页" 的链接。" #: libraries/config/messages.inc.php:292 msgid "Maximum number of rows to display" @@ -5131,11 +5129,11 @@ msgstr "显示的最多行数" #: libraries/config/messages.inc.php:294 msgid "Maximum number of tables displayed in table list" -msgstr "在数据表列表中最多显示的数据表个数" +msgstr "在表列表中最多显示的表个数" #: libraries/config/messages.inc.php:295 msgid "Maximum tables" -msgstr "最大数据表数量" +msgstr "最大表数量" #: libraries/config/messages.inc.php:296 msgid "" @@ -5151,7 +5149,7 @@ msgstr "mcrypt 警告" msgid "" "The number of bytes a script is allowed to allocate, eg. [kbd]32M[/kbd] " "([kbd]0[/kbd] for no limit)" -msgstr "一个脚本可分配到的内存大小,例 [kbd]32MB[/kbd] ([kbd]0[/kbd]为不限制)" +msgstr "一个脚本可分配的内存大小,如 [kbd]32MB[/kbd]([kbd]0[/kbd] 为无限制)" #: libraries/config/messages.inc.php:299 msgid "Memory limit" @@ -5159,33 +5157,33 @@ msgstr "内存限制" #: libraries/config/messages.inc.php:300 msgid "Show logo in navigation panel" -msgstr "在导航面板中显示 logo" +msgstr "在导航面板中显示徽标" #: libraries/config/messages.inc.php:301 msgid "Display logo" -msgstr "显示 logo" +msgstr "显示徽标" #: libraries/config/messages.inc.php:302 msgid "URL where logo in the navigation panel will point to" -msgstr "导航面板中 logo 指向的链接地址" +msgstr "导航面板中徽标指向的链接地址" #: libraries/config/messages.inc.php:303 msgid "Logo link URL" -msgstr "Logo 链接地址" +msgstr "徽标链接地址" #: libraries/config/messages.inc.php:304 msgid "" "Open the linked page in the main window ([kbd]main[/kbd]) or in a new one " "([kbd]new[/kbd])" -msgstr "在主窗口 ([kbd]main[/kbd]) 或新窗口 ([kbd]new[/kbd]) 打开目标页面" +msgstr "在主窗口([kbd]main[/kbd])或新窗口([kbd]new[/kbd])打开目标页面" #: libraries/config/messages.inc.php:305 msgid "Logo link target" -msgstr "Logo 链接目标" +msgstr "徽标链接目标" #: libraries/config/messages.inc.php:306 msgid "Display server choice at the top of the navigation panel" -msgstr "在导航面板的顶部显示可选服务器" +msgstr "在导航面板顶部显示可选的服务器" #: libraries/config/messages.inc.php:307 msgid "Display servers selection" diff --git a/test/libraries/PMA_server_databases_test.php b/test/libraries/PMA_server_databases_test.php index 5a7d62f473..c65754c751 100644 --- a/test/libraries/PMA_server_databases_test.php +++ b/test/libraries/PMA_server_databases_test.php @@ -198,4 +198,51 @@ class PMA_ServerDatabases_Test extends PHPUnit_Framework_TestCase $html ); } + + /** + * Test for PMA_getListForSortDatabase + * + * @return void + */ + public function testPMAGetListForSortDatabase() + { + //$_REQUEST['sort_by'] and $_REQUEST['sort_order'] are empty + list($sort_by, $sort_order) = PMA_getListForSortDatabase(); + $this->assertEquals( + 'SCHEMA_NAME', + $sort_by + ); + $this->assertEquals( + 'asc', + $sort_order + ); + + // $_REQUEST['sort_by'] = 'DEFAULT_COLLATION_NAME' + // and $_REQUEST['sort_order'] is not 'desc' + $_REQUEST['sort_by'] = 'DEFAULT_COLLATION_NAME'; + $_REQUEST['sort_order'] = 'abc'; + list($sort_by, $sort_order) = PMA_getListForSortDatabase(); + $this->assertEquals( + 'DEFAULT_COLLATION_NAME', + $sort_by + ); + $this->assertEquals( + 'asc', + $sort_order + ); + + // $_REQUEST['sort_by'] = 'DEFAULT_COLLATION_NAME' + // and $_REQUEST['sort_order'] is 'desc' + $_REQUEST['sort_by'] = 'DEFAULT_COLLATION_NAME'; + $_REQUEST['sort_order'] = 'desc'; + list($sort_by, $sort_order) = PMA_getListForSortDatabase(); + $this->assertEquals( + 'DEFAULT_COLLATION_NAME', + $sort_by + ); + $this->assertEquals( + 'desc', + $sort_order + ); + } } diff --git a/test/libraries/PMA_server_privileges_test.php b/test/libraries/PMA_server_privileges_test.php index 492d785d76..0e27d21de4 100644 --- a/test/libraries/PMA_server_privileges_test.php +++ b/test/libraries/PMA_server_privileges_test.php @@ -20,6 +20,7 @@ require_once 'libraries/sqlparser.lib.php'; require_once 'libraries/js_escape.lib.php'; require_once 'libraries/Message.class.php'; require_once 'libraries/Response.class.php'; +require_once 'libraries/relation.lib.php'; require_once 'libraries/server_privileges.lib.php'; /** @@ -53,11 +54,15 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase $GLOBALS['cfg']['LimitChars'] = 100; $GLOBALS['cfg']['DBG']['sql'] = false; $GLOBALS['cfg']['AllowThirdPartyFraming'] = false; + $GLOBALS['cfg']['Server']['pmadb'] = 'pmadb'; + $GLOBALS['cfg']['Server']['usergroups'] = 'usergroups'; + $GLOBALS['cfg']['Server']['users'] = 'users'; $GLOBALS['table'] = "table"; $GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF'); $GLOBALS['pmaThemeImage'] = 'image'; $GLOBALS['server'] = 1; + $GLOBALS['username'] = "pma_username"; //$_POST $_POST['pred_password'] = 'none'; @@ -107,7 +112,7 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase $_REQUEST['tablename'] = "PMA_tablename"; $_REQUEST['dbname'] = "PMA_dbname"; list( - $username, $hostname, $dbname, $tablename, + $username, $hostname, $dbname, $tablename, $db_and_table, $dbname_is_wildcard ) = PMA_getDataForDBInfo(); $this->assertEquals( @@ -139,7 +144,7 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase $_REQUEST['pred_tablename'] = "PMA_pred__tablename"; $_REQUEST['pred_dbname'] = "PMA_pred_dbname"; list( - $username, $hostname, $dbname, $tablename, + $username, $hostname, $dbname, $tablename, $db_and_table, $dbname_is_wildcard ) = PMA_getDataForDBInfo(); $this->assertEquals( @@ -161,6 +166,162 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase } + /** + * Test for PMA_wildcardEscapeForGrant + * + * @return void + */ + public function testPMAWildcardEscapeForGrant() + { + $dbname = ''; + $tablename = ''; + $db_and_table = PMA_wildcardEscapeForGrant($dbname, $tablename); + $this->assertEquals( + '*.*', + $db_and_table + ); + + $dbname = 'dbname'; + $tablename = ''; + $db_and_table = PMA_wildcardEscapeForGrant($dbname, $tablename); + $this->assertEquals( + '`dbname`.*', + $db_and_table + ); + + $dbname = 'dbname'; + $tablename = 'tablename'; + $db_and_table = PMA_wildcardEscapeForGrant($dbname, $tablename); + $this->assertEquals( + '`dbname`.`tablename`', + $db_and_table + ); + } + + /** + * Test for PMA_rangeOfUsers + * + * @return void + */ + public function testPMARangeOfUsers() + { + $ret = PMA_rangeOfUsers("INIT"); + $this->assertEquals( + " WHERE `User` LIKE 'INIT%' OR `User` LIKE 'init%'", + $ret + ); + } + + /** + * Test for PMA_getGrantsArray + * + * @return void + */ + public function testPMAGetGrantsArray() + { + $ret = PMA_getGrantsArray(); + $this->assertEquals( + array( + 'Select_priv', + 'SELECT', + __('Allows reading data.') + ), + $ret[0] + ); + $this->assertEquals( + array( + 'Insert_priv', + 'INSERT', + __('Allows inserting and replacing data.') + ), + $ret[1] + ); + } + + /** + * Test for PMA_getHtmlForDisplayColumnPrivileges + * + * @return void + */ + public function testPMAGetHtmlForDisplayColumnPrivileges() + { + $columns = array( + 'row1' => 'name1' + ); + $row = array( + 'name_for_select' => 'Y' + ); + $name_for_select = 'name_for_select'; + $priv_for_header = 'priv_for_header'; + $name = 'name'; + $name_for_dfn = 'name_for_dfn'; + $name_for_current = 'name_for_current'; + + $html = PMA_getHtmlForDisplayColumnPrivileges( + $columns, $row, $name_for_select, + $priv_for_header, $name, $name_for_dfn, $name_for_current + ); + //$name + $this->assertContains( + $name, + $html + ); + //$name_for_dfn + $this->assertContains( + $name_for_dfn, + $html + ); + //$priv_for_header + $this->assertContains( + $priv_for_header, + $html + ); + //$name_for_select + $this->assertContains( + $name_for_select, + $html + ); + //$columns and $row + $this->assertContains( + htmlspecialchars('row1'), + $html + ); + //$columns and $row + $this->assertContains( + _pgettext('None privileges', 'None'), + $html + ); + + } + + /** + * Test for PMA_getHtmlToChooseUserGroup + * + * @return void + */ + public function testPMAGetHtmlToChooseUserGroup() + { + $username = "pma_username"; + + //PMA_getHtmlToChooseUserGroup + $html = PMA_getHtmlToChooseUserGroup($username); + $this->assertContains( + '
$username); + $html_output = PMA_URL_getHiddenInputs($params); + $this->assertContains( + $html_output, + $html + ); + //__('User group') + $this->assertContains( + __('User group'), + $html + ); + } /** * Test for PMA_getDataForChangeOrCopyUser