Rename tbl_* files to drop useless _properties part.
[phpmyadmin/crack.git] / libraries / tbl_links.inc.php
blob799b3cf78c41475b1a7b83410b0bc1c9e0e6818c
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 // Check parameters
7 require_once('./libraries/common.lib.php');
9 PMA_checkParameters(array('db', 'table'));
11 /**
12 * Prepares links
14 require_once('./libraries/bookmark.lib.php');
17 /**
18 * Set parameters for links
20 if (empty($url_query)
21 || (isset($_POST['table']) && isset($_POST['new_name']) && $_POST['table'] != $_POST['new_name'])) {
22 $url_query = PMA_generate_common_url($db, $table);
24 $url_params['db'] = $db;
25 $url_params['table'] = $table;
27 /**
28 * Defines the urls to return to in case of error in a sql statement
30 $err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url( array( 'db' => $db, ) );
31 $err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url( $url_params );
33 /**
34 * Displays headers
36 $js_to_run = 'functions.js';
37 require_once('./libraries/header.inc.php');
39 /**
40 * Displays links
42 $tabs = array();
44 $tabs['browse']['icon'] = 'b_browse.png';
45 $tabs['browse']['text'] = $strBrowse;
47 $tabs['structure']['icon'] = 'b_props.png';
48 $tabs['structure']['link'] = 'tbl_structure.php';
49 $tabs['structure']['text'] = $strStructure;
51 $tabs['sql']['icon'] = 'b_sql.png';
52 $tabs['sql']['link'] = 'tbl_sql.php';
53 $tabs['sql']['text'] = $strSQL;
55 $tabs['search']['icon'] = 'b_search.png';
56 $tabs['search']['text'] = $strSearch;
58 if ( ! (isset($db_is_information_schema) && $db_is_information_schema) ) {
59 $tabs['insert']['icon'] = 'b_insrow.png';
60 $tabs['insert']['link'] = 'tbl_change.php';
61 $tabs['insert']['text'] = $strInsert;
64 $tabs['export']['icon'] = 'b_tblexport.png';
65 $tabs['export']['link'] = 'tbl_export.php';
66 $tabs['export']['args']['single_table'] = 'true';
67 $tabs['export']['text'] = $strExport;
69 /**
70 * Don't display "Import", "Operations" and "Empty"
71 * for views and information_schema
73 if ( ! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema )) {
74 $tabs['import']['icon'] = 'b_tblimport.png';
75 $tabs['import']['link'] = 'tbl_import.php';
76 $tabs['import']['text'] = $strImport;
78 $tabs['operation']['icon'] = 'b_tblops.png';
79 $tabs['operation']['link'] = 'tbl_operations.php';
80 $tabs['operation']['text'] = $strOperations;
82 if ($table_info_num_rows > 0) {
83 $ln8_stt = (PMA_MYSQL_INT_VERSION >= 40000)
84 ? 'TRUNCATE TABLE '
85 : 'DELETE FROM ';
86 $tabs['empty']['link'] = 'sql.php';
87 $tabs['empty']['args']['sql_query'] = $ln8_stt . PMA_backquote($table);
88 $tabs['empty']['args']['zero_rows'] = sprintf($strTableHasBeenEmptied, htmlspecialchars($table));
89 $tabs['empty']['attr'] = 'onclick="return confirmLink(this, \'' . $ln8_stt . PMA_jsFormat($table) . '\')"';
90 $tabs['empty']['args']['goto'] = 'tbl_structure.php';
91 $tabs['empty']['class'] = 'caution';
93 $tabs['empty']['icon'] = 'b_empty.png';
94 $tabs['empty']['text'] = $strEmpty;
97 /**
98 * no drop in information_schema
100 if ( ! (isset($db_is_information_schema) && $db_is_information_schema) ) {
101 $tabs['drop']['icon'] = 'b_deltbl.png';
102 $tabs['drop']['link'] = 'sql.php';
103 $tabs['drop']['text'] = $strDrop;
104 $tabs['drop']['args']['reload'] = 1;
105 $tabs['drop']['args']['purge'] = 1;
106 $drop_command = 'DROP ' . ($tbl_is_view ? 'VIEW' : 'TABLE');
107 $tabs['drop']['args']['sql_query'] = $drop_command . ' ' . PMA_backquote($table);
108 $tabs['drop']['args']['goto'] = 'db_details_structure.php';
109 $tabs['drop']['args']['zero_rows'] = sprintf(($tbl_is_view ? $strViewHasBeenDropped : $strTableHasBeenDropped), htmlspecialchars($table));
110 $tabs['drop']['attr'] = 'onclick="return confirmLink(this, \'' . $drop_command . ' ' . PMA_jsFormat($table) . '\')"';
111 unset($drop_command);
112 $tabs['drop']['class'] = 'caution';
115 if ($table_info_num_rows > 0 || $tbl_is_view) {
116 $tabs['browse']['link'] = 'sql.php';
117 $tabs['browse']['args']['pos'] = 0;
118 $tabs['search']['link'] = 'tbl_select.php';
121 echo PMA_getTabs( $tabs );
122 unset( $tabs );
125 * Displays a message
127 if (!empty($message)) {
128 PMA_showMessage($message);
129 unset($message);
132 ?><br />