Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin...
[phpmyadmin/thilanka.git] / libraries / db_links.inc.php
blob2210899de87322e38cfb913bf6ff5052a04176d9
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package phpMyAdmin
6 */
7 if (! defined('PHPMYADMIN')) {
8 exit;
11 /**
14 require_once './libraries/common.inc.php';
16 /**
17 * Gets the relation settings
19 $cfgRelation = PMA_getRelationsParam();
21 /**
22 * If coming from a Show MySQL link on the home page,
23 * put something in $sub_part
25 if (empty($sub_part)) {
26 $sub_part = '_structure';
29 /**
30 * Checks for superuser privileges
32 $is_superuser = PMA_isSuperuser();
34 /**
35 * Prepares links
38 /**
39 * export, search and qbe links if there is at least one table
41 if ($num_tables == 0) {
42 $tab_qbe['warning'] = __('Database seems to be empty!');
43 $tab_search['warning'] = __('Database seems to be empty!');
44 $tab_export['warning'] = __('Database seems to be empty!');
47 $tab_structure['link'] = 'db_structure.php';
48 $tab_structure['text'] = __('Structure');
49 $tab_structure['icon'] = 'ic_b_props';
51 $tab_sql['link'] = 'db_sql.php';
52 $tab_sql['args']['db_query_force'] = 1;
53 $tab_sql['text'] = __('SQL');
54 $tab_sql['icon'] = 'ic_b_sql';
56 $tab_export['text'] = __('Export');
57 $tab_export['icon'] = 'ic_b_export';
58 $tab_export['link'] = 'db_export.php';
60 $tab_search['text'] = __('Search');
61 $tab_search['icon'] = 'ic_b_search';
62 $tab_search['link'] = 'db_search.php';
64 if (PMA_Tracker::isActive())
66 $tab_tracking['text'] = __('Tracking');
67 $tab_tracking['icon'] = 'ic_eye';
68 $tab_tracking['link'] = 'db_tracking.php';
71 $tab_qbe['text'] = __('Query');
72 $tab_qbe['icon'] = 'ic_s_db';
73 $tab_qbe['link'] = 'db_qbe.php';
75 if ($cfgRelation['designerwork']) {
76 $tab_designer['text'] = __('Designer');
77 $tab_designer['icon'] = 'ic_b_relations';
78 $tab_designer['link'] = 'pmd_general.php';
81 if (! $db_is_information_schema) {
82 $tab_import['link'] = 'db_import.php';
83 $tab_import['text'] = __('Import');
84 $tab_import['icon'] = 'ic_b_import';
85 $tab_operation['link'] = 'db_operations.php';
86 $tab_operation['text'] = __('Operations');
87 $tab_operation['icon'] = 'ic_b_tblops';
88 if ($is_superuser) {
89 $tab_privileges['link'] = 'server_privileges.php';
90 $tab_privileges['args']['checkprivs'] = $db;
91 // stay on database view
92 $tab_privileges['args']['viewing_mode'] = 'db';
93 $tab_privileges['text'] = __('Privileges');
94 $tab_privileges['icon'] = 'ic_s_rights';
96 $tab_routines['link'] = 'db_routines.php';
97 $tab_routines['text'] = __('Routines');
98 $tab_routines['icon'] = 'ic_b_routines';
100 $tab_events['link'] = 'db_events.php';
101 $tab_events['text'] = __('Events');
102 $tab_events['icon'] = 'ic_b_events';
104 $tab_triggers['link'] = 'db_triggers.php';
105 $tab_triggers['text'] = __('Triggers');
106 $tab_triggers['icon'] = 'ic_b_triggers';
110 * Displays tab links
112 $tabs = array();
113 $tabs[] =& $tab_structure;
114 $tabs[] =& $tab_sql;
115 $tabs[] =& $tab_search;
116 $tabs[] =& $tab_qbe;
117 $tabs[] =& $tab_export;
118 if (! $db_is_information_schema) {
119 $tabs[] =& $tab_import;
120 $tabs[] =& $tab_operation;
121 if ($is_superuser) {
122 $tabs[] =& $tab_privileges;
124 if (!PMA_DRIZZLE) {
125 $tabs[] =& $tab_routines;
127 if (PMA_MYSQL_INT_VERSION >= 50106 && ! PMA_DRIZZLE) {
128 if (PMA_currentUserHasPrivilege('EVENT', $db)) {
129 $tabs[] =& $tab_events;
132 if (!PMA_DRIZZLE) {
133 if (PMA_currentUserHasPrivilege('TRIGGER', $db)) {
134 $tabs[] =& $tab_triggers;
138 if (PMA_Tracker::isActive()) {
139 $tabs[] =& $tab_tracking;
141 if (! $db_is_information_schema) {
142 if ($cfgRelation['designerwork']) {
143 $tabs[] =& $tab_designer;
147 $url_params['db'] = $db;
149 echo PMA_generate_html_tabs($tabs, $url_params);
150 unset($tabs);
153 * Displays a message
155 if (!empty($message)) {
156 PMA_showMessage($message);
157 unset($message);