diff --git a/db_tracking.php b/db_tracking.php index f69ea41aed..4077f75748 100644 --- a/db_tracking.php +++ b/db_tracking.php @@ -57,11 +57,6 @@ if ($num_tables == 0 && count($data['ddlog']) == 0) { // --------------------------------------------------------------------------- -/* - * Display top menu links - */ -require_once 'libraries/db_links.inc.php'; - // Prepare statement to get HEAD version $all_tables_query = ' SELECT table_name, MAX(version) as version FROM ' . PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' . diff --git a/libraries/Menu.class.php b/libraries/Menu.class.php new file mode 100644 index 0000000000..5dc6f891e9 --- /dev/null +++ b/libraries/Menu.class.php @@ -0,0 +1,504 @@ +server = $server; + $this->db = $db; + $this->table = $table; + } + + /** + * Prints the menu and the breadcrumbs + * + * @return void + */ + public static function getInstance() + { + if (empty(self::$instance)) { + self::$instance = new PMA_Menu( + $GLOBALS['server'], + $GLOBALS['db'], + $GLOBALS['table'] + ); + } + return self::$instance; + } + + /** + * Prints the menu and the breadcrumbs + * + * @return void + */ + public function display() + { + echo $this->_getBreadcrumbs(); + echo $this->_getMenu(); + if (! empty($GLOBALS['message'])) { + PMA_showMessage($GLOBALS['message']); + unset($GLOBALS['message']); + } + } + + /** + * Returns the menu as HTML + * + * @return string HTML formatted menubar + */ + private function _getMenu() + { + $tabs = ''; + $url_params = array('db' => $this->db); + if (strlen($this->table)) { + $tabs = $this->_getTableTabs(); + $url_params['table'] = $this->table; + } else if (strlen($this->db)) { + $tabs = $this->_getDbTabs(); + } else { + $tabs = $this->_getServerTabs(); + } + return PMA_generate_html_tabs($tabs, $url_params); + } + + /** + * Returns the breadcrumbs as HTML + * + * @return string HTML formatted breadcrumbs + */ + private function _getBreadcrumbs() + { + $retval = ''; + $tbl_is_view = PMA_Table::isView($this->db, $this->table); + $server_info = ! empty($GLOBALS['cfg']['Server']['verbose']) + ? $GLOBALS['cfg']['Server']['verbose'] + : $GLOBALS['cfg']['Server']['host']; + $server_info .= empty($GLOBALS['cfg']['Server']['port']) + ? '' + : ':' . $GLOBALS['cfg']['Server']['port']; + + $separator = " »"; + $item = ''; + + if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) { + $item .= '%4$s: '; + } + $item .= '%3$s'; + $retval .= "
"; + $retval .= "
"; + if ($GLOBALS['cfg']['NavigationBarIconic']) { + $retval .= PMA_getImage( + 's_host.png', + '', + array('class' => 'item') + ); + } + $retval .= sprintf( + $item, + $GLOBALS['cfg']['DefaultTabServer'], + PMA_generate_common_url(), + htmlspecialchars($server_info), + __('Server') + ); + + if (strlen($this->db)) { + $retval .= $separator; + if ($GLOBALS['cfg']['NavigationBarIconic']) { + $retval .= PMA_getImage( + 's_db.png', + '', + array('class' => 'item') + ); + } + $retval .= sprintf( + $item, + $GLOBALS['cfg']['DefaultTabDatabase'], + PMA_generate_common_url($this->db), + htmlspecialchars($this->db), + __('Database') + ); + // if the table is being dropped, $_REQUEST['purge'] is set to '1' + // so do not display the table name in upper div + if ( + strlen($this->table) + && + ! (isset($_REQUEST['purge']) && $_REQUEST['purge'] == '1') + ) { + include_once './libraries/tbl_info.inc.php'; + + $retval .= $separator; + if ($GLOBALS['cfg']['NavigationBarIconic']) { + $icon = $tbl_is_view ? 'b_views.png' : 's_tbl.png'; + $retval .= PMA_getImage( + $icon, + '', + array('class' => 'item') + ); + } + $retval .= sprintf( + $item, + $GLOBALS['cfg']['DefaultTabTable'], + PMA_generate_common_url($this->db, $this->table), + str_replace(' ', ' ', htmlspecialchars($this->table)), + $tbl_is_view ? __('View') : __('Table') + ); + + /** + * Displays table comment + */ + if (! empty($show_comment) + && ! isset($GLOBALS['avoid_show_comment']) + ) { + if (strstr($show_comment, '; InnoDB free')) { + $show_comment = preg_replace( + '@; InnoDB free:.*?$@', + '', + $show_comment + ); + } + $retval .= 'db); + /** + * Displays table comment + */ + if (! empty($comment)) { + $retval .= '"' + . htmlspecialchars($comment) + . '"'; + } // end if + } + } + } + $retval .= '
'; + $retval .= '
'; + return $retval; + } + + /** + * Returns the table tabs as an array + * + * @return array Data for generating table tabs + */ + private function _getTableTabs() + { + $db_is_information_schema = PMA_is_system_schema($this->db); + $tbl_is_view = PMA_Table::isView($this->db, $this->table); + + $table_status = PMA_Table::sGetStatusInfo($this->db, $this->table); + $table_info_num_rows = 0; + if (isset($table_status['Rows'])) { + $table_info_num_rows = $table_status['Rows']; + } + + $tabs = array(); + + $tabs['browse']['icon'] = 'b_browse.png'; + $tabs['browse']['text'] = __('Browse'); + $tabs['browse']['link'] = 'sql.php'; + $tabs['browse']['args']['pos'] = 0; + + $tabs['structure']['icon'] = 'b_props.png'; + $tabs['structure']['link'] = 'tbl_structure.php'; + $tabs['structure']['text'] = __('Structure'); + + $tabs['sql']['icon'] = 'b_sql.png'; + $tabs['sql']['link'] = 'tbl_sql.php'; + $tabs['sql']['text'] = __('SQL'); + + $tabs['search']['icon'] = 'b_search.png'; + $tabs['search']['text'] = __('Search'); + $tabs['search']['link'] = 'tbl_select.php'; + + if (! $db_is_information_schema) { + $tabs['insert']['icon'] = 'b_insrow.png'; + $tabs['insert']['link'] = 'tbl_change.php'; + $tabs['insert']['text'] = __('Insert'); + } + + $tabs['export']['icon'] = 'b_tblexport.png'; + $tabs['export']['link'] = 'tbl_export.php'; + $tabs['export']['args']['single_table'] = 'true'; + $tabs['export']['text'] = __('Export'); + + /** + * Don't display "Import" and "Operations" + * for views and information_schema + */ + if (! $tbl_is_view && ! $db_is_information_schema) { + $tabs['import']['icon'] = 'b_tblimport.png'; + $tabs['import']['link'] = 'tbl_import.php'; + $tabs['import']['text'] = __('Import'); + + $tabs['operation']['icon'] = 'b_tblops.png'; + $tabs['operation']['link'] = 'tbl_operations.php'; + $tabs['operation']['text'] = __('Operations'); + } + if (PMA_Tracker::isActive()) { + $tabs['tracking']['icon'] = 'eye.png'; + $tabs['tracking']['text'] = __('Tracking'); + $tabs['tracking']['link'] = 'tbl_tracking.php'; + } + if (! $db_is_information_schema + && ! PMA_DRIZZLE + && PMA_currentUserHasPrivilege('TRIGGER', $this->db, $this->table) + && ! $tbl_is_view + ) { + $tabs['triggers']['link'] = 'tbl_triggers.php'; + $tabs['triggers']['text'] = __('Triggers'); + $tabs['triggers']['icon'] = 'b_triggers.png'; + } + + /** + * Views support a limited number of operations + */ + if ($tbl_is_view && ! $db_is_information_schema) { + $tabs['operation']['icon'] = 'b_tblops.png'; + $tabs['operation']['link'] = 'view_operations.php'; + $tabs['operation']['text'] = __('Operations'); + } + + if ($table_info_num_rows == 0 && ! $tbl_is_view) { + $tabs['browse']['warning'] = __('Table seems to be empty!'); + $tabs['search']['warning'] = __('Table seems to be empty!'); + } + return $tabs; + } + + /** + * Returns the db tabs as an array + * + * @return array Data for generating db tabs + */ + private function _getDbTabs() + { + $db_is_information_schema = PMA_is_system_schema($this->db); + $num_tables = count(PMA_DBI_get_tables($this->db)); + $is_superuser = PMA_isSuperuser(); + + /** + * Gets the relation settings + */ + $cfgRelation = PMA_getRelationsParam(); + + $tabs = array(); + + /** + * export, search and qbe links if there is at least one table + */ + if ($num_tables == 0) { + $tabs['qbe']['warning'] = __('Database seems to be empty!'); + $tabs['search']['warning'] = __('Database seems to be empty!'); + $tabs['export']['warning'] = __('Database seems to be empty!'); + } + + $tabs['structure']['link'] = 'db_structure.php'; + $tabs['structure']['text'] = __('Structure'); + $tabs['structure']['icon'] = 'b_props.png'; + + $tabs['sql']['link'] = 'db_sql.php'; + $tabs['sql']['args']['db_query_force'] = 1; + $tabs['sql']['text'] = __('SQL'); + $tabs['sql']['icon'] = 'b_sql.png'; + + $tabs['search']['text'] = __('Search'); + $tabs['search']['icon'] = 'b_search.png'; + $tabs['search']['link'] = 'db_search.php'; + + $tabs['qbe']['text'] = __('Query'); + $tabs['qbe']['icon'] = 's_db.png'; + $tabs['qbe']['link'] = 'db_qbe.php'; + + $tabs['export']['text'] = __('Export'); + $tabs['export']['icon'] = 'b_export.png'; + $tabs['export']['link'] = 'db_export.php'; + + if (! $db_is_information_schema) { + $tabs['import']['link'] = 'db_import.php'; + $tabs['import']['text'] = __('Import'); + $tabs['import']['icon'] = 'b_import.png'; + + $tabs['operation']['link'] = 'db_operations.php'; + $tabs['operation']['text'] = __('Operations'); + $tabs['operation']['icon'] = 'b_tblops.png'; + + if ($is_superuser && ! PMA_DRIZZLE) { + $tabs['privileges']['link'] = 'server_privileges.php'; + $tabs['privileges']['args']['checkprivs'] = $this->db; + // stay on database view + $tabs['privileges']['args']['viewing_mode'] = 'db'; + $tabs['privileges']['text'] = __('Privileges'); + $tabs['privileges']['icon'] = 's_rights.png'; + } + if (! PMA_DRIZZLE) { + $tabs['routines']['link'] = 'db_routines.php'; + $tabs['routines']['text'] = __('Routines'); + $tabs['routines']['icon'] = 'b_routines.png'; + } + if (PMA_MYSQL_INT_VERSION >= 50106 + && ! PMA_DRIZZLE + && PMA_currentUserHasPrivilege('EVENT', $this->db) + ) { + $tabs['events']['link'] = 'db_events.php'; + $tabs['events']['text'] = __('Events'); + $tabs['events']['icon'] = 'b_events.png'; + } + if (! PMA_DRIZZLE + && PMA_currentUserHasPrivilege('TRIGGER', $this->db) + ) { + $tabs['triggers']['link'] = 'db_triggers.php'; + $tabs['triggers']['text'] = __('Triggers'); + $tabs['triggers']['icon'] = 'b_triggers.png'; + } + } + + if (PMA_Tracker::isActive()) { + $tabs['tracking']['text'] = __('Tracking'); + $tabs['tracking']['icon'] = 'eye.png'; + $tabs['tracking']['link'] = 'db_tracking.php'; + } + + if (! $db_is_information_schema && $cfgRelation['designerwork']) { + $tabs['designer']['text'] = __('Designer'); + $tabs['designer']['icon'] = 'b_relations.png'; + $tabs['designer']['link'] = 'pmd_general.php'; + } + + return $tabs; + } + + /** + * Returns the server tabs as an array + * + * @return array Data for generating server tabs + */ + private function _getServerTabs() + { + $is_superuser = PMA_isSuperuser(); + $binary_logs = null; + if (! PMA_DRIZZLE){ + $binary_logs = PMA_DBI_fetch_result( + 'SHOW MASTER LOGS', + 'Log_name', + null, + null, + PMA_DBI_QUERY_STORE + ); + } + + $tabs = array(); + + $tabs['databases']['icon'] = 's_db.png'; + $tabs['databases']['link'] = 'server_databases.php'; + $tabs['databases']['text'] = __('Databases'); + + $tabs['sql']['icon'] = 'b_sql.png'; + $tabs['sql']['link'] = 'server_sql.php'; + $tabs['sql']['text'] = __('SQL'); + + $tabs['status']['icon'] = 's_status.png'; + $tabs['status']['link'] = 'server_status.php'; + $tabs['status']['text'] = __('Status'); + + if ($is_superuser && ! PMA_DRIZZLE) { + $tabs['rights']['icon'] = 's_rights.png'; + $tabs['rights']['link'] = 'server_privileges.php'; + $tabs['rights']['text'] = __('Users'); + } + + $tabs['export']['icon'] = 'b_export.png'; + $tabs['export']['link'] = 'server_export.php'; + $tabs['export']['text'] = __('Export'); + + $tabs['import']['icon'] = 'b_import.png'; + $tabs['import']['link'] = 'server_import.php'; + $tabs['import']['text'] = __('Import'); + + $tabs['settings']['icon'] = 'b_tblops.png'; + $tabs['settings']['link'] = 'prefs_manage.php'; + $tabs['settings']['text'] = __('Settings'); + $tabs['settings']['active'] = in_array( + basename($GLOBALS['PMA_PHP_SELF']), + array('prefs_forms.php', 'prefs_manage.php') + ); + + $tabs['synchronize']['icon'] = 's_sync.png'; + $tabs['synchronize']['link'] = 'server_synchronize.php'; + $tabs['synchronize']['text'] = __('Synchronize'); + + if (! empty($binary_logs)) { + $tabs['binlog']['icon'] = 's_tbl.png'; + $tabs['binlog']['link'] = 'server_binlog.php'; + $tabs['binlog']['text'] = __('Binary log'); + } + + if ($is_superuser && ! PMA_DRIZZLE) { + $tabs['replication']['icon'] = 's_replication.png'; + $tabs['replication']['link'] = 'server_replication.php'; + $tabs['replication']['text'] = __('Replication'); + } + + $tabs['vars']['icon'] = 's_vars.png'; + $tabs['vars']['link'] = 'server_variables.php'; + $tabs['vars']['text'] = __('Variables'); + + $tabs['charset']['icon'] = 's_asci.png'; + $tabs['charset']['link'] = 'server_collations.php'; + $tabs['charset']['text'] = __('Charsets'); + + if (PMA_DRIZZLE) { + $tabs['plugins']['icon'] = 'b_engine.png'; + $tabs['plugins']['link'] = 'server_plugins.php'; + $tabs['plugins']['text'] = __('Plugins'); + } else { + $tabs['engine']['icon'] = 'b_engine.png'; + $tabs['engine']['link'] = 'server_engines.php'; + $tabs['engine']['text'] = __('Engines'); + } + return $tabs; + } +} + +?> diff --git a/libraries/db_info.inc.php b/libraries/db_info.inc.php index 5d1efc2ed8..ab9a278cb7 100644 --- a/libraries/db_info.inc.php +++ b/libraries/db_info.inc.php @@ -283,10 +283,10 @@ if (! isset($total_num_tables)) { unset($each_table, $tbl_group_sql, $db_info_result); /** - * Displays top menu links - * If in an Ajax request, we do not need to show this + * If coming from a Show MySQL link on the home page, + * put something in $sub_part */ -if ($GLOBALS['is_ajax_request'] != true) { - include './libraries/db_links.inc.php'; +if (empty($sub_part)) { + $sub_part = '_structure'; } ?> diff --git a/libraries/db_links.inc.php b/libraries/db_links.inc.php deleted file mode 100644 index aa09d79b5a..0000000000 --- a/libraries/db_links.inc.php +++ /dev/null @@ -1,158 +0,0 @@ -= 50106 && ! PMA_DRIZZLE) { - if (PMA_currentUserHasPrivilege('EVENT', $db)) { - $tabs[] =& $tab_events; - } - } - if (!PMA_DRIZZLE) { - if (PMA_currentUserHasPrivilege('TRIGGER', $db)) { - $tabs[] =& $tab_triggers; - } - } -} -if (PMA_Tracker::isActive()) { - $tabs[] =& $tab_tracking; -} -if (! $db_is_information_schema) { - if ($cfgRelation['designerwork']) { - $tabs[] =& $tab_designer; - } -} - -$url_params['db'] = $db; - -echo PMA_generate_html_tabs($tabs, $url_params); -unset($tabs); - -/** - * Displays a message - */ -if (!empty($message)) { - PMA_showMessage($message); - unset($message); -} -?> diff --git a/libraries/header.inc.php b/libraries/header.inc.php index 7b4a32c1be..4f66d1256f 100644 --- a/libraries/header.inc.php +++ b/libraries/header.inc.php @@ -8,8 +8,8 @@ if (! defined('PHPMYADMIN')) { exit; } -require_once './libraries/common.inc.php'; require_once './libraries/RecentTable.class.php'; +require_once 'libraries/Menu.class.php'; /** @@ -96,7 +96,12 @@ if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) { PMA_userprefs_autoload_header(); } - if (!defined('PMA_DISPLAY_HEADING')) { + // add recently used table and reload the navigation + if (strlen($GLOBALS['table']) && $GLOBALS['cfg']['LeftRecentTable'] > 0) { + PMA_addRecentTable($GLOBALS['db'], $GLOBALS['table']); + } + + if (! defined('PMA_DISPLAY_HEADING')) { define('PMA_DISPLAY_HEADING', 1); } @@ -109,110 +114,11 @@ if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) { /** * Display heading if needed. Design can be set in css file. */ - if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0) { - $server_info = ! empty($GLOBALS['cfg']['Server']['verbose']) - ? $GLOBALS['cfg']['Server']['verbose'] - : $GLOBALS['cfg']['Server']['host']; - $server_info .= empty($GLOBALS['cfg']['Server']['port']) - ? '' - : ':' . $GLOBALS['cfg']['Server']['port']; - - $separator = " »\n"; - $item = ''; - - if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) { - $item .= '%4$s: '; - } - $item .= '%3$s' . "\n"; - echo "
\n"; - echo "
\n"; - if ($GLOBALS['cfg']['NavigationBarIconic']) { - echo PMA_getImage('s_host.png', '', array('class' => 'item')) . "\n"; - } - printf( - $item, - $GLOBALS['cfg']['DefaultTabServer'], - PMA_generate_common_url(), - htmlspecialchars($server_info), - __('Server') - ); - - if (strlen($GLOBALS['db'])) { - - echo $separator; - if ($GLOBALS['cfg']['NavigationBarIconic']) { - echo PMA_getImage('s_db.png', '', array('class' => 'item')) . "\n"; - } - printf( - $item, - $GLOBALS['cfg']['DefaultTabDatabase'], - PMA_generate_common_url($GLOBALS['db']), - htmlspecialchars($GLOBALS['db']), - __('Database') - ); - // if the table is being dropped, $_REQUEST['purge'] is set to '1' - // so do not display the table name in upper div - if (strlen($GLOBALS['table']) && ! (isset($_REQUEST['purge']) && $_REQUEST['purge'] == '1')) { - include_once './libraries/tbl_info.inc.php'; - - echo $separator; - if ($GLOBALS['cfg']['NavigationBarIconic']) { - $icon = isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views.png' : 's_tbl.png'; - echo PMA_getImage($icon, '', array('class' => 'item')) . "\n"; - } - printf( - $item, - $GLOBALS['cfg']['DefaultTabTable'], - PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']), - str_replace(' ', ' ', htmlspecialchars($GLOBALS['table'])), - (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? __('View') : __('Table')) - ); - - /** - * Displays table comment - */ - if (!empty($show_comment) && ! isset($GLOBALS['avoid_show_comment'])) { - if (strstr($show_comment, '; InnoDB free')) { - $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment); - } - echo '' - .'"' . htmlspecialchars($show_comment) - .'"' . "\n"; - } // end if - - // add recently used table and reload the navigation - if ($GLOBALS['cfg']['LeftRecentTable'] > 0) { - PMA_addRecentTable($GLOBALS['db'], $GLOBALS['table']); - } - } else { - // no table selected, display database comment if present - /** - * Settings for relations stuff - */ - include_once './libraries/relation.lib.php'; - $cfgRelation = PMA_getRelationsParam(); - - // Get additional information about tables for tooltip is done - // in libraries/db_info.inc.php only once - if ($cfgRelation['commwork']) { - $comment = PMA_getDbComment($GLOBALS['db']); - /** - * Displays table comment - */ - if (! empty($comment)) { - echo '"' - . htmlspecialchars($comment) - . '"' . "\n"; - } // end if - } - } - } - echo '
'; - echo '
'; + PMA_Menu::getInstance()->display(); } } + /** * Sets a variable to remember headers have been sent */ diff --git a/libraries/mult_submits.inc.php b/libraries/mult_submits.inc.php index 9cdb39dbdb..8e422b07da 100644 --- a/libraries/mult_submits.inc.php +++ b/libraries/mult_submits.inc.php @@ -145,16 +145,14 @@ if (!empty($submit_mult) && !empty($what)) { include_once './libraries/header.inc.php'; if (strlen($table)) { - include './libraries/tbl_common.php'; + include './libraries/tbl_common.inc.php'; $url_query .= '&goto=tbl_sql.php&back=tbl_sql.php'; include './libraries/tbl_info.inc.php'; - include_once './libraries/tbl_links.inc.php'; } elseif (strlen($db)) { include './libraries/db_common.inc.php'; include './libraries/db_info.inc.php'; } else { include_once './libraries/server_common.inc.php'; - include_once './libraries/server_links.inc.php'; } // Builds the query diff --git a/libraries/rte/rte_main.inc.php b/libraries/rte/rte_main.inc.php index bdb43b8a20..fa5226bda9 100644 --- a/libraries/rte/rte_main.inc.php +++ b/libraries/rte/rte_main.inc.php @@ -23,8 +23,7 @@ if ($GLOBALS['is_ajax_request'] != true) { * Displays the header and tabs */ if (! empty($table) && in_array($table, PMA_DBI_get_tables($db))) { - include_once './libraries/tbl_common.php'; - include_once './libraries/tbl_links.inc.php'; + include_once './libraries/tbl_common.inc.php'; } else { $table = ''; include_once './libraries/db_common.inc.php'; diff --git a/libraries/server_common.inc.php b/libraries/server_common.inc.php index 50460520e7..b84e4af908 100644 --- a/libraries/server_common.inc.php +++ b/libraries/server_common.inc.php @@ -53,4 +53,6 @@ if ($is_superuser && ! PMA_DRIZZLE) { $binary_logs = PMA_DRIZZLE ? null : PMA_DBI_fetch_result('SHOW MASTER LOGS', 'Log_name', null, null, PMA_DBI_QUERY_STORE); + +PMA_checkParameters(array('is_superuser', 'url_query'), false); ?> diff --git a/libraries/server_links.inc.php b/libraries/server_links.inc.php deleted file mode 100644 index 3d6b6be4df..0000000000 --- a/libraries/server_links.inc.php +++ /dev/null @@ -1,126 +0,0 @@ - diff --git a/libraries/tbl_common.php b/libraries/tbl_common.inc.php similarity index 67% rename from libraries/tbl_common.php rename to libraries/tbl_common.inc.php index 4b8172f5d2..5e3cd5a7e7 100644 --- a/libraries/tbl_common.php +++ b/libraries/tbl_common.inc.php @@ -25,6 +25,10 @@ $db_is_information_schema = PMA_is_system_schema($db); */ $url_query = PMA_generate_common_url($db, $table); +/** + * Set parameters for links + */ +$url_params = array(); $url_params['db'] = $db; $url_params['table'] = $table; @@ -40,4 +44,14 @@ $err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params); */ require_once './libraries/db_table_exists.lib.php'; +/** + * Displays headers + */ +require_once './libraries/header.inc.php'; + +if (PMA_Tracker::isActive() and PMA_Tracker::isTracked($GLOBALS["db"], $GLOBALS["table"])) { + $msg = PMA_Message::notice(''.sprintf(__('Tracking of %s is activated.'), htmlspecialchars($GLOBALS["db"] . '.' . $GLOBALS["table"])).''); + $msg->display(); +} + ?> diff --git a/libraries/tbl_links.inc.php b/libraries/tbl_links.inc.php deleted file mode 100644 index 37684792da..0000000000 --- a/libraries/tbl_links.inc.php +++ /dev/null @@ -1,138 +0,0 @@ - $db,)); -$err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params); - -/** - * Displays headers - */ -require_once './libraries/header.inc.php'; - -/** - * Ensure that $db_is_information_schema is not null - */ -if (! isset($db_is_information_schema)) { - $db_is_information_schema = false; -} - -/** - * Displays links - */ -$tabs = array(); - -$tabs['browse']['icon'] = 'b_browse.png'; -$tabs['browse']['text'] = __('Browse'); -$tabs['browse']['link'] = 'sql.php'; -$tabs['browse']['args']['pos'] = 0; - -$tabs['structure']['icon'] = 'b_props.png'; -$tabs['structure']['link'] = 'tbl_structure.php'; -$tabs['structure']['text'] = __('Structure'); - -$tabs['sql']['icon'] = 'b_sql.png'; -$tabs['sql']['link'] = 'tbl_sql.php'; -$tabs['sql']['text'] = __('SQL'); - -$tabs['search']['icon'] = 'b_search.png'; -$tabs['search']['text'] = __('Search'); -$tabs['search']['link'] = 'tbl_select.php'; - -if (!$db_is_information_schema) { - $tabs['insert']['icon'] = 'b_insrow.png'; - $tabs['insert']['link'] = 'tbl_change.php'; - $tabs['insert']['text'] = __('Insert'); -} - -$tabs['export']['icon'] = 'b_tblexport.png'; -$tabs['export']['link'] = 'tbl_export.php'; -$tabs['export']['args']['single_table'] = 'true'; -$tabs['export']['text'] = __('Export'); - -/** - * Don't display "Import" and "Operations" - * for views and information_schema - */ -if (! $tbl_is_view && !$db_is_information_schema) { - $tabs['import']['icon'] = 'b_tblimport.png'; - $tabs['import']['link'] = 'tbl_import.php'; - $tabs['import']['text'] = __('Import'); - - $tabs['operation']['icon'] = 'b_tblops.png'; - $tabs['operation']['link'] = 'tbl_operations.php'; - $tabs['operation']['text'] = __('Operations'); -} -if (PMA_Tracker::isActive()) { - $tabs['tracking']['icon'] = 'eye.png'; - $tabs['tracking']['text'] = __('Tracking'); - $tabs['tracking']['link'] = 'tbl_tracking.php'; -} -if (!$db_is_information_schema && !PMA_DRIZZLE) { - if (PMA_currentUserHasPrivilege('TRIGGER', $db, $table) && ! PMA_Table::isView($db, $table)) { - $tabs['triggers']['link'] = 'tbl_triggers.php'; - $tabs['triggers']['text'] = __('Triggers'); - $tabs['triggers']['icon'] = 'b_triggers.png'; - } -} - -/** - * Views support a limited number of operations - */ -if ($tbl_is_view && !$db_is_information_schema) { - $tabs['operation']['icon'] = 'b_tblops.png'; - $tabs['operation']['link'] = 'view_operations.php'; - $tabs['operation']['text'] = __('Operations'); -} - -if ($table_info_num_rows == 0 && !$tbl_is_view) { - $tabs['browse']['warning'] = __('Table seems to be empty!'); - $tabs['search']['warning'] = __('Table seems to be empty!'); -} - -echo PMA_generate_html_tabs($tabs, $url_params); -unset($tabs); - -if (PMA_Tracker::isActive() and PMA_Tracker::isTracked($GLOBALS["db"], $GLOBALS["table"])) { - $msg = PMA_Message::notice(''.sprintf(__('Tracking of %s is activated.'), htmlspecialchars($GLOBALS["db"] . '.' . $GLOBALS["table"])).''); - $msg->display(); -} - -/** - * Displays a message - */ -if (!empty($message)) { - PMA_showMessage($message); - unset($message); -} - -?> diff --git a/libraries/user_preferences.inc.php b/libraries/user_preferences.inc.php index 42deeb886c..3c2a12f14c 100644 --- a/libraries/user_preferences.inc.php +++ b/libraries/user_preferences.inc.php @@ -8,10 +8,6 @@ if (!defined('PHPMYADMIN')) { exit; } - -// show server tabs -require './libraries/server_links.inc.php'; - // build user preferences menu $form_param = filter_input(INPUT_GET, 'form'); diff --git a/main.php b/main.php index 6a0e2489ba..a5735825a4 100644 --- a/main.php +++ b/main.php @@ -41,7 +41,6 @@ $common_url_query = PMA_generate_common_url('', ''); if ($server > 0) { include 'libraries/server_common.inc.php'; include 'libraries/StorageEngine.class.php'; - include 'libraries/server_links.inc.php'; // Use the verbose name of the server instead of the hostname // if a value is set diff --git a/server_binlog.php b/server_binlog.php index db5313d774..1b21133643 100644 --- a/server_binlog.php +++ b/server_binlog.php @@ -16,11 +16,6 @@ require_once 'libraries/common.inc.php'; */ require_once 'libraries/server_common.inc.php'; -/** - * Displays the links - */ -require_once 'libraries/server_links.inc.php'; - $url_params = array(); /** diff --git a/server_collations.php b/server_collations.php index 076b79ca43..5e7844345b 100644 --- a/server_collations.php +++ b/server_collations.php @@ -16,12 +16,6 @@ require_once 'libraries/common.inc.php'; require 'libraries/server_common.inc.php'; -/** - * Displays the links - */ -require 'libraries/server_links.inc.php'; - - /** * Displays the sub-page heading */ diff --git a/server_databases.php b/server_databases.php index ce1011b6ac..e3a032764b 100644 --- a/server_databases.php +++ b/server_databases.php @@ -120,12 +120,6 @@ if ((isset($_REQUEST['drop_selected_dbs']) || isset($_REQUEST['query_type'])) } } -/** - * Displays the links - */ -require 'libraries/server_links.inc.php'; - - /** * Displays the sub-page heading */ diff --git a/server_engines.php b/server_engines.php index 1c26dc6942..c50723ce78 100644 --- a/server_engines.php +++ b/server_engines.php @@ -17,12 +17,6 @@ require_once 'libraries/common.inc.php'; require 'libraries/server_common.inc.php'; require 'libraries/StorageEngine.class.php'; - -/** - * Displays the links - */ -require 'libraries/server_links.inc.php'; - /** * Did the user request information about a certain storage engine? */ diff --git a/server_export.php b/server_export.php index fa14bbb058..3f5d50b7cf 100644 --- a/server_export.php +++ b/server_export.php @@ -9,14 +9,10 @@ * Does the common work */ require_once 'libraries/common.inc.php'; +require 'libraries/server_common.inc.php'; $GLOBALS['js_include'][] = 'export.js'; -/** - * Displays the links - */ -require 'libraries/server_links.inc.php'; - $export_page_title = __('View dump (schema) of databases') . "\n"; $checkall_url = 'server_export.php?' . PMA_generate_common_url() diff --git a/server_import.php b/server_import.php index c1028cdf2f..ef6200d468 100644 --- a/server_import.php +++ b/server_import.php @@ -17,12 +17,6 @@ $GLOBALS['js_include'][] = 'import.js'; */ require 'libraries/server_common.inc.php'; - -/** - * Displays the links - */ -require 'libraries/server_links.inc.php'; - $import_type = 'server'; require 'libraries/display_import.lib.php'; /** diff --git a/server_plugins.php b/server_plugins.php index 26fec2fe11..04d638fa67 100644 --- a/server_plugins.php +++ b/server_plugins.php @@ -22,12 +22,6 @@ $GLOBALS['js_include'][] = 'server_plugins.js'; */ require 'libraries/server_common.inc.php'; - -/** - * Displays the links - */ -require 'libraries/server_links.inc.php'; - /** * Displays the sub-page heading */ diff --git a/server_privileges.php b/server_privileges.php index 0002c6afd4..2c2c48bc28 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -173,7 +173,7 @@ if (isset($dbname)) { * Checks if the user is allowed to do what he tries to... */ if (! $is_superuser) { - include 'libraries/server_links.inc.php'; + include 'libraries/header.inc.php'; echo '

' . "\n" . PMA_getIcon('b_usrlist.png') . __('Privileges') . "\n" @@ -1656,7 +1656,10 @@ if (isset($viewing_mode) && $viewing_mode == 'db') { include 'libraries/db_info.inc.php'; echo "\n"; } else { - include 'libraries/server_links.inc.php'; + if (! empty($GLOBALS['message'])) { + PMA_showMessage($GLOBALS['message']); + unset($GLOBALS['message']); + } } diff --git a/server_replication.php b/server_replication.php index d2be1a32f7..7f10eeed72 100644 --- a/server_replication.php +++ b/server_replication.php @@ -25,7 +25,7 @@ require_once 'libraries/server_synchronize.lib.php'; * Checks if the user is allowed to do what he tries to... */ if (! $is_superuser) { - include 'libraries/server_links.inc.php'; + include 'libraries/header.inc.php'; echo '

' . "\n" . PMA_getIcon('s_replication.png') . __('Replication') . "\n" @@ -181,10 +181,7 @@ if (isset($GLOBALS['sr_take_action'])) { } unset($refresh); } -/** - * Displays the links - */ -require 'libraries/server_links.inc.php'; + echo '
'; echo '

'; diff --git a/server_sql.php b/server_sql.php index 538759066d..82924a22f0 100644 --- a/server_sql.php +++ b/server_sql.php @@ -20,13 +20,6 @@ $GLOBALS['js_include'][] = 'sql.js'; require_once 'libraries/server_common.inc.php'; require_once 'libraries/sql_query_form.lib.php'; - -/** - * Displays the links - */ -require 'libraries/server_links.inc.php'; - - /** * Query box, bookmark, insert data from textfile */ diff --git a/server_status.php b/server_status.php index ffb0cdefdb..f068bbad87 100644 --- a/server_status.php +++ b/server_status.php @@ -772,13 +772,6 @@ PMA_AddJSVar( */ require 'libraries/server_common.inc.php'; - - -/** - * Displays the links - */ -require 'libraries/server_links.inc.php'; - ?>

'CASCADE', 'SET_NULL' => 'SET NULL', diff --git a/tbl_select.php b/tbl_select.php index 4120c23590..5109479086 100644 --- a/tbl_select.php +++ b/tbl_select.php @@ -57,7 +57,7 @@ foreach ($post_params as $one_post_param) { */ if (! isset($param) || $param[0] == '') { // Gets some core libraries - include_once 'libraries/tbl_common.php'; + include_once 'libraries/tbl_common.inc.php'; //$err_url = 'tbl_select.php' . $err_url; $url_query .= '&goto=tbl_select.php&back=tbl_select.php'; @@ -66,11 +66,6 @@ if (! isset($param) || $param[0] == '') { */ include_once 'libraries/tbl_info.inc.php'; - /** - * Displays top menu links - */ - include_once 'libraries/tbl_links.inc.php'; - if (! isset($goto)) { $goto = $GLOBALS['cfg']['DefaultTabTable']; } diff --git a/tbl_sql.php b/tbl_sql.php index 6342ffb9ea..3420a051af 100644 --- a/tbl_sql.php +++ b/tbl_sql.php @@ -17,7 +17,7 @@ $GLOBALS['js_include'][] = 'functions.js'; $GLOBALS['js_include'][] = 'makegrid.js'; $GLOBALS['js_include'][] = 'sql.js'; -require 'libraries/tbl_common.php'; +require 'libraries/tbl_common.inc.php'; $url_query .= '&goto=tbl_sql.php&back=tbl_sql.php'; require_once 'libraries/sql_query_form.lib.php'; @@ -33,11 +33,6 @@ $back = 'tbl_sql.php'; */ require_once 'libraries/tbl_info.inc.php'; -/** - * Displays top menu links - */ -require_once 'libraries/tbl_links.inc.php'; - /** * Query box, bookmark, insert data from textfile */ diff --git a/tbl_structure.php b/tbl_structure.php index 97f0ee84d4..e8e1e07a40 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -70,7 +70,6 @@ if (! empty($submit_mult) && isset($_REQUEST['selected_fld'])) { $action = 'tbl_structure.php'; include 'libraries/mult_submits.inc.php'; //require_once 'libraries/header.inc.php'; - //require_once 'libraries/tbl_links.inc.php'; if (empty($message)) { $message = PMA_Message::success(); @@ -86,7 +85,7 @@ $cfgRelation = PMA_getRelationsParam(); /** * Runs common work */ -require_once 'libraries/tbl_common.php'; +require_once 'libraries/tbl_common.inc.php'; $url_query .= '&goto=tbl_structure.php&back=tbl_structure.php'; $url_params['goto'] = 'tbl_structure.php'; $url_params['back'] = 'tbl_structure.php'; @@ -101,10 +100,6 @@ $url_params['back'] = 'tbl_structure.php'; */ require_once 'libraries/tbl_info.inc.php'; -/** - * Displays top menu links - */ -require_once 'libraries/tbl_links.inc.php'; require_once 'libraries/Index.class.php'; // 2. Gets table keys and retains them @@ -727,14 +722,6 @@ if (! $tbl_is_view && ! $db_is_information_schema) { 20) { - include 'libraries/tbl_links.inc.php'; -} // end if (count($fields) > 20) - /** * Displays indexes */ diff --git a/tbl_tracking.php b/tbl_tracking.php index 711065b3de..4740d135b2 100644 --- a/tbl_tracking.php +++ b/tbl_tracking.php @@ -9,7 +9,7 @@ require_once './libraries/common.inc.php'; define('TABLE_MAY_BE_ABSENT', true); -require './libraries/tbl_common.php'; +require './libraries/tbl_common.inc.php'; $url_query .= '&goto=tbl_tracking.php&back=tbl_tracking.php'; $url_params['goto'] = 'tbl_tracking.php';; $url_params['back'] = 'tbl_tracking.php'; @@ -146,10 +146,6 @@ if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'sqldumpfil * Gets tables informations */ -/** - * Displays top menu links - */ -require_once './libraries/tbl_links.inc.php'; echo '
'; /** diff --git a/tbl_zoom_select.php b/tbl_zoom_select.php index 3eacd335d4..41726f8537 100644 --- a/tbl_zoom_select.php +++ b/tbl_zoom_select.php @@ -138,7 +138,7 @@ $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values')); */ // Gets some core libraries -require_once './libraries/tbl_common.php'; +require_once './libraries/tbl_common.inc.php'; $url_query .= '&goto=tbl_select.php&back=tbl_select.php'; /** @@ -146,11 +146,6 @@ $url_query .= '&goto=tbl_select.php&back=tbl_select.php'; */ require_once './libraries/tbl_info.inc.php'; -/** - * Displays top menu links - */ -require_once './libraries/tbl_links.inc.php'; - if (! isset($goto)) { $goto = $GLOBALS['cfg']['DefaultTabTable']; } diff --git a/view_create.php b/view_create.php index eb2bb5cee9..385890c2f5 100644 --- a/view_create.php +++ b/view_create.php @@ -93,14 +93,6 @@ if (PMA_isValid($_REQUEST['view'], 'array')) { $view = array_merge($view, $_REQUEST['view']); } -/** - * Displays top menu links - * We use db links because a VIEW is not necessarily on a single table - */ -$num_tables = 0; -if ($GLOBALS['is_ajax_request'] != true) { - include_once './libraries/db_links.inc.php'; -} $url_params['db'] = $GLOBALS['db']; $url_params['reload'] = 1; diff --git a/view_operations.php b/view_operations.php index 66599ef30c..45a74b7ebf 100644 --- a/view_operations.php +++ b/view_operations.php @@ -15,7 +15,7 @@ $pma_table = new PMA_Table($GLOBALS['table'], $GLOBALS['db']); /** * Runs common work */ -require './libraries/tbl_common.php'; +require './libraries/tbl_common.inc.php'; $url_query .= '&goto=view_operations.php&back=view_operations.php'; $url_params['goto'] = $url_params['back'] = 'view_operations.php'; @@ -47,11 +47,6 @@ if (isset($_REQUEST['submitoptions'])) { } } -/** - * Displays top menu links - */ -require_once './libraries/tbl_links.inc.php'; - if (isset($result)) { // set to success by default, because result set could be empty // (for example, a table rename)