Translation update done using Pootle.
[phpmyadmin/dkf.git] / libraries / db_links.inc.php
blob1010eac930fc5e85e8e167f92299e14f11eefcca
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /**
15 require_once './libraries/common.inc.php';
17 require_once './libraries/relation.lib.php';
18 /**
19 * Gets the relation settings
21 $cfgRelation = PMA_getRelationsParam();
23 /**
24 * If coming from a Show MySQL link on the home page,
25 * put something in $sub_part
27 if (empty($sub_part)) {
28 $sub_part = '_structure';
31 /**
32 * Checks for superuser privileges
34 $is_superuser = PMA_isSuperuser();
36 /**
37 * Prepares links
39 // Drop link if allowed
40 // Don't even try to drop information_schema. You won't be able to. Believe me. You won't.
41 // Don't allow to easilly drop mysql database, RFE #1327514.
42 if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && ! $db_is_information_schema && ($db != 'mysql')) {
43 $tab_drop['link'] = 'sql.php';
44 $tab_drop['args']['sql_query'] = 'DROP DATABASE ' . PMA_backquote($db);
45 $tab_drop['args']['zero_rows'] = sprintf(__('Database %s has been dropped.'), htmlspecialchars(PMA_backquote($db)));
46 $tab_drop['args']['goto'] = 'main.php';
47 $tab_drop['args']['back'] = 'db' . $sub_part . '.php';
48 $tab_drop['args']['reload'] = 1;
49 $tab_drop['args']['purge'] = 1;
50 $tab_drop['attr'] = 'onclick="return confirmLinkDropDB(this, \'DROP DATABASE ' . PMA_jsFormat($db) . '\')"';
53 /**
54 * export, search and qbe links if there is at least one table
56 if ($num_tables == 0) {
57 $tab_qbe['warning'] = __('Database seems to be empty!');
58 $tab_search['warning'] = __('Database seems to be empty!');
59 $tab_export['warning'] = __('Database seems to be empty!');
62 $tab_structure['link'] = 'db_structure.php';
63 $tab_structure['text'] = __('Structure');
64 $tab_structure['icon'] = 'b_props.png';
66 $tab_sql['link'] = 'db_sql.php';
67 $tab_sql['args']['db_query_force'] = 1;
68 $tab_sql['text'] = __('SQL');
69 $tab_sql['icon'] = 'b_sql.png';
71 $tab_export['text'] = __('Export');
72 $tab_export['icon'] = 'b_export.png';
73 $tab_export['link'] = 'db_export.php';
75 $tab_search['text'] = __('Search');
76 $tab_search['icon'] = 'b_search.png';
77 $tab_search['link'] = 'db_search.php';
79 if(PMA_Tracker::isActive())
81 $tab_tracking['text'] = __('Tracking');
82 $tab_tracking['icon'] = 'eye.png';
83 $tab_tracking['link'] = 'db_tracking.php';
86 $tab_qbe['text'] = __('Query');
87 $tab_qbe['icon'] = 's_db.png';
88 $tab_qbe['link'] = 'db_qbe.php';
90 if ($cfgRelation['designerwork']) {
91 $tab_designer['text'] = __('Designer');
92 $tab_designer['icon'] = 'b_relations.png';
93 $tab_designer['link'] = 'pmd_general.php';
96 if (! $db_is_information_schema) {
97 $tab_import['link'] = 'db_import.php';
98 $tab_import['text'] = __('Import');
99 $tab_import['icon'] = 'b_import.png';
100 $tab_drop['text'] = __('Drop');
101 $tab_drop['icon'] = 'b_deltbl.png';
102 $tab_drop['class'] = 'caution';
103 $tab_operation['link'] = 'db_operations.php';
104 $tab_operation['text'] = __('Operations');
105 $tab_operation['icon'] = 'b_tblops.png';
106 if ($is_superuser) {
107 $tab_privileges['link'] = 'server_privileges.php';
108 $tab_privileges['args']['checkprivs'] = $db;
109 // stay on database view
110 $tab_privileges['args']['viewing_mode'] = 'db';
111 $tab_privileges['text'] = __('Privileges');
112 $tab_privileges['icon'] = 's_rights.png';
117 * Displays tab links
119 $tabs = array();
120 $tabs[] =& $tab_structure;
121 $tabs[] =& $tab_sql;
122 $tabs[] =& $tab_search;
123 if (PMA_Tracker::isActive()) {
124 $tabs[] =& $tab_tracking;
126 $tabs[] =& $tab_qbe;
127 $tabs[] =& $tab_export;
128 if (! $db_is_information_schema) {
129 $tabs[] =& $tab_import;
130 if ($cfgRelation['designerwork']) {
131 $tabs[] =& $tab_designer;
133 $tabs[] =& $tab_operation;
134 if ($is_superuser) {
135 $tabs[] =& $tab_privileges;
137 if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
138 $tabs[] =& $tab_drop;
142 $url_params['db'] = $db;
144 echo PMA_generate_html_tabs($tabs, $url_params);
145 unset($tabs);
148 * Displays a message
150 if (!empty($message)) {
151 PMA_showMessage($message);
152 unset($message);