~hexmode/+junk/main

« back to all changes in this revision

Viewing changes to install-files/apps/phpmyadmin2.10.1/libraries/tbl_links.inc.php

  • Committer: Mark A. Hershberger
  • Date: 2008-01-05 19:38:56 UTC
  • Revision ID: hershberger@spawn-xp-20080105193856-6rnzgwa4nehue3qj
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/* $Id: tbl_links.inc.php 9624 2006-10-27 08:53:20Z nijel $ */
 
3
// vim: expandtab sw=4 ts=4 sts=4:
 
4
 
 
5
// Check parameters
 
6
 
 
7
require_once('./libraries/common.lib.php');
 
8
 
 
9
PMA_checkParameters(array('db', 'table'));
 
10
 
 
11
/**
 
12
 * Prepares links
 
13
 */
 
14
require_once('./libraries/bookmark.lib.php');
 
15
 
 
16
 
 
17
/**
 
18
 * Set parameters for links
 
19
 */
 
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);
 
23
}
 
24
$url_params['db']    = $db;
 
25
$url_params['table'] = $table;
 
26
 
 
27
/**
 
28
 * Defines the urls to return to in case of error in a sql statement
 
29
 */
 
30
$err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url( array( 'db' => $db, ) );
 
31
$err_url   = $cfg['DefaultTabTable'] . PMA_generate_common_url( $url_params );
 
32
 
 
33
/**
 
34
 * Displays headers
 
35
 */
 
36
$js_to_run = 'functions.js';
 
37
require_once('./libraries/header.inc.php');
 
38
 
 
39
/**
 
40
 * Displays links
 
41
 */
 
42
$tabs = array();
 
43
 
 
44
$tabs['browse']['icon'] = 'b_browse.png';
 
45
$tabs['browse']['text'] = $strBrowse;
 
46
$tabs['browse']['link'] = 'sql.php';
 
47
$tabs['browse']['args']['pos'] = 0;
 
48
 
 
49
$tabs['structure']['icon'] = 'b_props.png';
 
50
$tabs['structure']['link'] = 'tbl_structure.php';
 
51
$tabs['structure']['text'] = $strStructure;
 
52
 
 
53
$tabs['sql']['icon'] = 'b_sql.png';
 
54
$tabs['sql']['link'] = 'tbl_sql.php';
 
55
$tabs['sql']['text'] = $strSQL;
 
56
 
 
57
$tabs['search']['icon'] = 'b_search.png';
 
58
$tabs['search']['text'] = $strSearch;
 
59
$tabs['search']['link'] = 'tbl_select.php';
 
60
 
 
61
if ( ! (isset($db_is_information_schema) && $db_is_information_schema) ) {
 
62
    $tabs['insert']['icon'] = 'b_insrow.png';
 
63
    $tabs['insert']['link'] = 'tbl_change.php';
 
64
    $tabs['insert']['text'] = $strInsert;
 
65
}
 
66
 
 
67
$tabs['export']['icon'] = 'b_tblexport.png';
 
68
$tabs['export']['link'] = 'tbl_export.php';
 
69
$tabs['export']['args']['single_table'] = 'true';
 
70
$tabs['export']['text'] = $strExport;
 
71
 
 
72
/**
 
73
 * Don't display "Import", "Operations" and "Empty"
 
74
 * for views and information_schema
 
75
 */
 
76
if ( ! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema )) {
 
77
    $tabs['import']['icon'] = 'b_tblimport.png';
 
78
    $tabs['import']['link'] = 'tbl_import.php';
 
79
    $tabs['import']['text'] = $strImport;
 
80
 
 
81
    $tabs['operation']['icon'] = 'b_tblops.png';
 
82
    $tabs['operation']['link'] = 'tbl_operations.php';
 
83
    $tabs['operation']['text'] = $strOperations;
 
84
 
 
85
    $ln8_stt = (PMA_MYSQL_INT_VERSION >= 40000)
 
86
             ? 'TRUNCATE TABLE '
 
87
             : 'DELETE FROM ';
 
88
    $tabs['empty']['link']  = 'sql.php';
 
89
    $tabs['empty']['args']['sql_query'] = $ln8_stt . PMA_backquote($table);
 
90
    $tabs['empty']['args']['zero_rows'] = sprintf($strTableHasBeenEmptied, htmlspecialchars($table));
 
91
    $tabs['empty']['attr']  = 'onclick="return confirmLink(this, \'' . $ln8_stt . PMA_jsFormat($table) . '\')"';
 
92
    $tabs['empty']['args']['goto'] = 'tbl_structure.php';
 
93
    $tabs['empty']['class'] = 'caution';
 
94
    $tabs['empty']['icon'] = 'b_empty.png';
 
95
    $tabs['empty']['text'] = $strEmpty;
 
96
    if ($table_info_num_rows == 0) {
 
97
        $tabs['empty']['warning'] = $strTableIsEmpty;
 
98
    }
 
99
}
 
100
 
 
101
/**
 
102
 * no drop in information_schema
 
103
 */
 
104
if ( ! (isset($db_is_information_schema) && $db_is_information_schema) ) {
 
105
    $tabs['drop']['icon'] = 'b_deltbl.png';
 
106
    $tabs['drop']['link'] = 'sql.php';
 
107
    $tabs['drop']['text'] = $strDrop;
 
108
    $tabs['drop']['args']['reload']     = 1;
 
109
    $tabs['drop']['args']['purge']      = 1;
 
110
    $drop_command = 'DROP ' . ($tbl_is_view ? 'VIEW' : 'TABLE');
 
111
    $tabs['drop']['args']['sql_query']  = $drop_command . ' ' . PMA_backquote($table);
 
112
    $tabs['drop']['args']['goto']       = 'db_structure.php';
 
113
    $tabs['drop']['args']['zero_rows']  = sprintf(($tbl_is_view ? $strViewHasBeenDropped : $strTableHasBeenDropped), htmlspecialchars($table));
 
114
    $tabs['drop']['attr'] = 'onclick="return confirmLink(this, \'' . $drop_command . ' ' . PMA_jsFormat($table) . '\')"';
 
115
    unset($drop_command);
 
116
    $tabs['drop']['class'] = 'caution';
 
117
}
 
118
 
 
119
if ($table_info_num_rows == 0 && !$tbl_is_view) {
 
120
    $tabs['browse']['warning'] = $strTableIsEmpty;
 
121
    $tabs['search']['warning'] = $strTableIsEmpty;
 
122
}
 
123
 
 
124
echo PMA_getTabs( $tabs );
 
125
unset( $tabs );
 
126
 
 
127
/**
 
128
 * Displays a message
 
129
 */
 
130
if (!empty($message)) {
 
131
    PMA_showMessage($message);
 
132
    unset($message);
 
133
}
 
134
 
 
135
?><br />