From df6ef79e930a1e43ca0d5554e24d0867c0559b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Tue, 12 Sep 2017 17:51:58 -0300 Subject: Move PMA_printListItem to PhpMyAdmin\Core class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- index.php | 113 ++++++++++++++++++++++---------------------------------------- 1 file changed, 39 insertions(+), 74 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index bb14dce20f..87eac0acd8 100644 --- a/index.php +++ b/index.php @@ -5,8 +5,8 @@ * * @package PhpMyAdmin */ - use PhpMyAdmin\Charsets; +use PhpMyAdmin\Config; use PhpMyAdmin\Core; use PhpMyAdmin\Display\GitRevision; use PhpMyAdmin\LanguageManager; @@ -17,6 +17,7 @@ use PhpMyAdmin\Response; use PhpMyAdmin\Sanitize; use PhpMyAdmin\ThemeManager; use PhpMyAdmin\Url; +use PhpMyAdmin\Util; /** * Gets some core libraries and displays a top message if required @@ -68,11 +69,11 @@ if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) { if (! empty($_REQUEST['db'])) { $page = null; if (! empty($_REQUEST['table'])) { - $page = PhpMyAdmin\Util::getScriptNameForOption( + $page = Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabTable'], 'table' ); } else { - $page = PhpMyAdmin\Util::getScriptNameForOption( + $page = Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabDatabase'], 'database' ); } @@ -107,7 +108,7 @@ $show_query = '1'; // Any message to display? if (! empty($message)) { - echo PhpMyAdmin\Util::getMessage($message); + echo Util::getMessage($message); unset($message); } if (isset($_SESSION['partial_logout'])) { @@ -183,7 +184,7 @@ if ($server > 0 || count($cfg['Servers']) > 1 ) { echo '
  • '; include_once 'libraries/select_server.lib.php'; - echo PhpMyAdmin\Util::getImage('s_host.png') , " " + echo Util::getImage('s_host.png') , " " , PMA_selectServer(true, true); echo '
  • '; } @@ -198,8 +199,8 @@ if ($server > 0 || count($cfg['Servers']) > 1 if ($cfg['Server']['auth_type'] != 'config') { if ($cfg['ShowChgPassword']) { $conditional_class = 'ajax'; - PMA_printListItem( - PhpMyAdmin\Util::getImage('s_passwd.png') . " " . __( + Core::printListItem( + Util::getImage('s_passwd.png') . " " . __( 'Change password' ), 'li_change_password', @@ -216,10 +217,10 @@ if ($server > 0 || count($cfg['Servers']) > 1 echo '
    ' , "\n" . Url::getHiddenInputs(null, null, 4, 'collation_connection') . ' ' . "\n" @@ -246,7 +247,7 @@ $language_manager = LanguageManager::getInstance(); if (empty($cfg['Lang']) && $language_manager->hasChoice()) { echo '
  • '; - echo PhpMyAdmin\Util::getImage('s_lang.png') , " " + echo Util::getImage('s_lang.png') , " " , $language_manager->getSelectorDisplay(); echo '
  • '; } @@ -255,12 +256,12 @@ if (empty($cfg['Lang']) && $language_manager->hasChoice()) { if ($GLOBALS['cfg']['ThemeManager']) { echo '
  • '; - echo PhpMyAdmin\Util::getImage('s_theme.png') , " " + echo Util::getImage('s_theme.png') , " " , ThemeManager::getInstance()->getHtmlSelectBox(); echo '
  • '; } echo '
  • '; -echo PhpMyAdmin\Config::getFontsizeForm(); +echo Config::getFontsizeForm(); echo '
  • '; echo ''; @@ -269,8 +270,8 @@ echo ''; if ($server > 0) { echo '
      '; - PMA_printListItem( - PhpMyAdmin\Util::getImage('b_tblops.png') . " " . __( + Core::printListItem( + Util::getImage('b_tblops.png') . " " . __( 'More settings' ), 'li_user_preferences', @@ -295,29 +296,29 @@ if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) { echo '
      '; echo '

      ' , __('Database server') , '

      '; echo '
        ' , "\n"; - PMA_printListItem( + Core::printListItem( __('Server:') . ' ' . $server_info, 'li_server_info' ); - PMA_printListItem( - __('Server type:') . ' ' . PhpMyAdmin\Util::getServerType(), + Core::printListItem( + __('Server type:') . ' ' . Util::getServerType(), 'li_server_type' ); - PMA_printListItem( - __('Server connection:') . ' ' . PhpMyAdmin\Util::getServerSSL(), + Core::printListItem( + __('Server connection:') . ' ' . Util::getServerSSL(), 'li_server_type' ); - PMA_printListItem( + Core::printListItem( __('Server version:') . ' ' . $GLOBALS['dbi']->getVersionString() . ' - ' . $GLOBALS['dbi']->getVersionComment(), 'li_server_version' ); - PMA_printListItem( + Core::printListItem( __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(), 'li_mysql_proto' ); - PMA_printListItem( + Core::printListItem( __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host), 'li_user_info' ); @@ -339,35 +340,35 @@ if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) { echo '

        ' , __('Web server') , '

        '; echo '
          '; if ($GLOBALS['cfg']['ShowServerInfo']) { - PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software'); + Core::printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software'); if ($server > 0) { $client_version_str = $GLOBALS['dbi']->getClientInfo(); if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) { $client_version_str = 'libmysql - ' . $client_version_str; } - PMA_printListItem( + Core::printListItem( __('Database client version:') . ' ' . $client_version_str, 'li_mysql_client_version' ); $php_ext_string = __('PHP extension:') . ' '; - $extensions = PhpMyAdmin\Util::listPHPExtensions(); + $extensions = Util::listPHPExtensions(); foreach ($extensions as $extension) { $php_ext_string .= ' ' . $extension - . PhpMyAdmin\Util::showPHPDocu('book.' . $extension . '.php'); + . Util::showPHPDocu('book.' . $extension . '.php'); } - PMA_printListItem( + Core::printListItem( $php_ext_string, 'li_used_php_extension' ); $php_version_string = __('PHP version:') . ' ' . phpversion(); - PMA_printListItem( + Core::printListItem( $php_version_string, 'li_used_php_version' ); @@ -375,7 +376,7 @@ if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) { } if ($cfg['ShowPhpInfo']) { - PMA_printListItem( + Core::printListItem( __('Show PHP information'), 'li_phpinfo', 'phpinfo.php' . $common_url_query, @@ -394,7 +395,7 @@ $class = null; if ($GLOBALS['cfg']['VersionCheck']) { $class = 'jsversioncheck'; } -PMA_printListItem( +Core::printListItem( __('Version information:') . ' ' . PMA_VERSION . '', 'li_pma_version', null, @@ -403,44 +404,44 @@ PMA_printListItem( null, $class ); -PMA_printListItem( +Core::printListItem( __('Documentation'), 'li_pma_docs', - PhpMyAdmin\Util::getDocuLink('index'), + Util::getDocuLink('index'), null, '_blank' ); // does not work if no target specified, don't know why -PMA_printListItem( +Core::printListItem( __('Official Homepage'), 'li_pma_homepage', Core::linkURL('https://www.phpmyadmin.net/'), null, '_blank' ); -PMA_printListItem( +Core::printListItem( __('Contribute'), 'li_pma_contribute', Core::linkURL('https://www.phpmyadmin.net/contribute/'), null, '_blank' ); -PMA_printListItem( +Core::printListItem( __('Get support'), 'li_pma_support', Core::linkURL('https://www.phpmyadmin.net/support/'), null, '_blank' ); -PMA_printListItem( +Core::printListItem( __('List of changes'), 'li_pma_changes', 'changelog.php' . Url::getCommon(), null, '_blank' ); -PMA_printListItem( +Core::printListItem( __('License'), 'li_pma_license', 'license.php' . Url::getCommon(), @@ -573,7 +574,7 @@ if ($server > 0) { . 'to set it up there.' ); } - $msg = PhpMyAdmin\Message::notice($msg_text); + $msg = Message::notice($msg_text); $msg->addParamHtml(''); $msg->addParamHtml(''); /* Show error if user has configured something, notice elsewhere */ @@ -638,39 +639,3 @@ if (@file_exists('libraries/language_stats.inc.php')) { ); } } - -/** - * prints list item for main page - * - * @param string $name displayed text - * @param string $listId id, used for css styles - * @param string $url make item as link with $url as target - * @param string $mysql_help_page display a link to MySQL's manual - * @param string $target special target for $url - * @param string $a_id id for the anchor, - * used for jQuery to hook in functions - * @param string $class class for the li element - * @param string $a_class class for the anchor element - * - * @return void - */ -function PMA_printListItem($name, $listId = null, $url = null, - $mysql_help_page = null, $target = null, $a_id = null, $class = null, - $a_class = null -) { - echo PhpMyAdmin\Template::get('list/item') - ->render( - array( - 'content' => $name, - 'id' => $listId, - 'class' => $class, - 'url' => array( - 'href' => $url, - 'target' => $target, - 'id' => $a_id, - 'class' => $a_class, - ), - 'mysql_help_page' => $mysql_help_page, - ) - ); -} -- cgit v1.2.3 From 99642bf6e2c94d7f2fbe8fe3b3af933f671c9a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Tue, 12 Sep 2017 23:12:28 -0300 Subject: Refactor select_server functions to static methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 87eac0acd8..ba59c03d5e 100644 --- a/index.php +++ b/index.php @@ -15,6 +15,7 @@ use PhpMyAdmin\RecentFavoriteTable; use PhpMyAdmin\Relation; use PhpMyAdmin\Response; use PhpMyAdmin\Sanitize; +use PhpMyAdmin\Server\Select; use PhpMyAdmin\ThemeManager; use PhpMyAdmin\Url; use PhpMyAdmin\Util; @@ -183,9 +184,8 @@ if ($server > 0 || count($cfg['Servers']) > 1 || ($server == 0 && count($cfg['Servers']) == 1))) ) { echo '
        • '; - include_once 'libraries/select_server.lib.php'; echo Util::getImage('s_host.png') , " " - , PMA_selectServer(true, true); + , Select::render(true, true); echo '
        • '; } -- cgit v1.2.3