~ubuntu-branches/ubuntu/dapper/phpmyadmin/dapper

« back to all changes in this revision

Viewing changes to libraries/sql_query_form.lib.php

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Roszatycki
  • Date: 2006-04-14 14:47:28 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20060414144728-beg0typednbav31s
Tags: 4:2.8.0.3-1
* New upstream release.
* Security fix: XSS vulnerability (calling directly css files under themes)
  See: http://www.phpmyadmin.net/home_page/security.php?issue=PMASA-2006-1
  See: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-1678
  Closes: #362567.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
/* $Id: sql_query_form.lib.php,v 1.23 2005/11/16 18:54:53 lem9 Exp $ */
 
2
/* $Id: sql_query_form.lib.php,v 1.29.2.1 2006/02/18 13:54:37 cybot_tm Exp $ */
3
3
// vim: expandtab sw=4 ts=4 sts=4:
4
4
/**
5
5
 * functions for displaying the sql query form
6
 
 * 
 
6
 *
7
7
 * @usedby  server_sql.php
8
8
 * @usedby  db_details.php
9
9
 * @usedby  tbl_properties.php
11
11
 * @usedby  querywindow.php
12
12
 */
13
13
 
14
 
require_once('./libraries/file_listing.php'); // used for file listing
 
14
require_once './libraries/file_listing.php'; // used for file listing
 
15
require_once './libraries/bookmark.lib.php'; // used for file listing
15
16
 
16
17
/**
17
18
 * prints the sql query boxes
18
 
 * 
 
19
 *
19
20
 * @usedby  server_sql.php
20
21
 * @usedby  db_details.php
21
22
 * @usedby  tbl_properties.php
54
55
 * @param   boolean|string  $query          query to display in the textarea
55
56
 *                                          or true to display last executed
56
57
 * @param   boolean|string  $display_tab    sql|files|history|full|FALSE
57
 
 *                                          what part to display 
 
58
 *                                          what part to display
58
59
 *                                          false if not inside querywindow
59
60
 */
60
 
function PMA_sqlQueryForm( $query = true, $display_tab = false ) {
 
61
function PMA_sqlQueryForm($query = true, $display_tab = false)
 
62
{
61
63
    // check tab to display if inside querywindow
62
 
    if ( ! $display_tab ) {
 
64
    if (! $display_tab) {
63
65
        $display_tab = 'full';
64
66
        $is_querywindow = false;
65
67
    } else {
66
68
        $is_querywindow = true;
67
69
    }
68
 
    
 
70
 
69
71
    // query to show
70
 
    if ( true === $query  ) {
71
 
        $query = empty( $GLOBALS['sql_query'] ) ? '' : $GLOBALS['sql_query'];
 
72
    if (true === $query) {
 
73
        $query = empty($GLOBALS['sql_query']) ? '' : $GLOBALS['sql_query'];
72
74
    }
73
 
    
 
75
 
74
76
    // set enctype to multipart for file uploads
75
 
    if ( $GLOBALS['is_upload'] ) {
 
77
    if ($GLOBALS['is_upload']) {
76
78
        $enctype = ' enctype="multipart/form-data"';
77
79
    } else {
78
80
        $enctype = '';
79
81
    }
80
 
    
 
82
 
81
83
    $table  = '';
82
84
    $db     = '';
83
 
    if ( empty( $GLOBALS['db'] ) ) {
 
85
    if (! isset($GLOBALS['db']) || ! strlen($GLOBALS['db'])) {
84
86
        // prepare for server related
85
 
        $goto   = empty( $GLOBALS['goto'] ) ? 
 
87
        $goto   = empty($GLOBALS['goto']) ?
86
88
                    'server_sql.php' : $GLOBALS['goto'];
87
 
    }
88
 
    elseif ( empty( $GLOBALS['table'] ) ) {
 
89
    } elseif (! isset($GLOBALS['table']) || ! strlen($GLOBALS['table'])) {
89
90
        // prepare for db related
90
91
        $db     = $GLOBALS['db'];
91
 
        $goto   = empty( $GLOBALS['goto'] ) ? 
 
92
        $goto   = empty($GLOBALS['goto']) ?
92
93
                    'db_details.php' : $GLOBALS['goto'];
93
94
    } else {
94
95
        $table  = $GLOBALS['table'];
95
96
        $db     = $GLOBALS['db'];
96
 
        $goto   = empty( $GLOBALS['goto'] ) ? 
 
97
        $goto   = empty($GLOBALS['goto']) ?
97
98
                    'tbl_properties.php' : $GLOBALS['goto'];
98
99
    }
99
 
    
100
 
    
 
100
 
 
101
 
101
102
    // start output
102
 
    if ( $is_querywindow ) {
 
103
    if ($is_querywindow) {
103
104
        ?>
104
 
        <form method="post" id="sqlqueryform"
105
 
              target="phpmain<?php echo md5( $GLOBALS['cfg']['PmaAbsoluteUri'] ); ?>"
 
105
        <form method="post" id="sqlqueryform" target="frame_content"
106
106
              action="import.php"<?php echo $enctype; ?> name="sqlform"
107
 
              onsubmit="this.target=window.opener.frames[1].name;
 
107
              onsubmit="var save_name = window.opener.parent.frames[1].name;
 
108
                        window.opener.parent.frames[1].name = save_name + '<?php echo time(); ?>';
 
109
                        this.target = window.opener.parent.frames[1].name;
108
110
                        return checkSqlQuery( this );" >
109
111
        <?php
110
112
    } else {
111
113
        echo '<form method="post" action="import.php" ' . $enctype . ' id="sqlqueryform"'
112
114
            .' onsubmit="return checkSqlQuery(this)" name="sqlform">' . "\n";
113
115
    }
114
 
    
115
 
    if ( $is_querywindow ) {
 
116
 
 
117
    if ($is_querywindow) {
116
118
        echo '<input type="hidden" name="focus_querywindow" value="true" />'
117
119
            ."\n";
118
 
        if ( $display_tab != 'sql' && $display_tab != 'full' ) {
 
120
        if ($display_tab != 'sql' && $display_tab != 'full') {
119
121
            echo '<input type="hidden" name="sql_query" value="" />' . "\n";
120
122
            echo '<input type="hidden" name="show_query" value="1" />' . "\n";
121
123
        }
122
124
    }
123
125
    echo '<input type="hidden" name="is_js_confirmed" value="0" />' . "\n"
124
 
        .PMA_generate_common_hidden_inputs( $db, $table ) . "\n"
 
126
        .PMA_generate_common_hidden_inputs($db, $table) . "\n"
125
127
        .'<input type="hidden" name="pos" value="0" />' . "\n"
126
 
        .'<input type="hidden" name="goto" value="' 
127
 
        .htmlspecialchars( $goto ) . '" />' . "\n"
128
 
        .'<input type="hidden" name="zero_rows" value="' 
129
 
        . htmlspecialchars( $GLOBALS['strSuccess'] ) . '" />' . "\n"
130
 
        .'<input type="hidden" name="prev_sql_query" value="' 
131
 
        . htmlspecialchars( $query ) . '" />' . "\n";
 
128
        .'<input type="hidden" name="goto" value="'
 
129
        .htmlspecialchars($goto) . '" />' . "\n"
 
130
        .'<input type="hidden" name="zero_rows" value="'
 
131
        . htmlspecialchars($GLOBALS['strSuccess']) . '" />' . "\n"
 
132
        .'<input type="hidden" name="prev_sql_query" value="'
 
133
        . htmlspecialchars($query) . '" />' . "\n";
132
134
 
133
135
    // display querybox
134
 
    if ( $display_tab === 'full' || $display_tab === 'sql' ) {
135
 
        PMA_sqlQueryFormInsert( $query, $is_querywindow );
 
136
    if ($display_tab === 'full' || $display_tab === 'sql') {
 
137
        PMA_sqlQueryFormInsert($query, $is_querywindow);
136
138
    }
137
 
    
 
139
 
138
140
    // display uploads
139
 
    if ( $display_tab === 'files' && $GLOBALS['is_upload'] ) {
 
141
    if ($display_tab === 'files' && $GLOBALS['is_upload']) {
140
142
        PMA_sqlQueryFormUpload();
141
143
    }
142
 
    
 
144
 
143
145
    // Bookmark Support
144
 
    if ( $display_tab === 'full' || $display_tab === 'history' ) {
145
 
        if ( ! empty( $GLOBALS['cfg']['Bookmark'] )
 
146
    if ($display_tab === 'full' || $display_tab === 'history') {
 
147
        if (! empty( $GLOBALS['cfg']['Bookmark'])
146
148
          && $GLOBALS['cfg']['Bookmark']['db']
147
 
          && $GLOBALS['cfg']['Bookmark']['table'] ) {
 
149
          && $GLOBALS['cfg']['Bookmark']['table']) {
148
150
            PMA_sqlQueryFormBookmark();
149
151
        }
150
152
    }
151
 
    
 
153
 
152
154
    // Encoding setting form appended by Y.Kawada
153
 
    if ( function_exists('PMA_set_enc_form') ) {
 
155
    if (function_exists('PMA_set_enc_form')) {
154
156
        echo PMA_set_enc_form('    ');
155
157
    }
156
 
    
 
158
 
157
159
    echo '</form>' . "\n";
158
160
}
159
161
 
160
162
/**
161
163
 * prints querybox fieldset
162
164
 *
163
 
 * @usedby  PMA_sqlQueryForm() 
 
165
 * @usedby  PMA_sqlQueryForm()
164
166
 * @uses    $GLOBALS['text_dir']
165
167
 * @uses    $GLOBALS['cfg']['TextareaAutoSelect']
166
168
 * @uses    $GLOBALS['cfg']['TextareaCols']
176
178
 * @param   string      $query          query to display in the textarea
177
179
 * @param   boolean     $is_querywindow if inside querywindow or not
178
180
 */
179
 
function PMA_sqlQueryFormInsert( $query = '', $is_querywindow = false ) {
180
 
    
 
181
function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false)
 
182
{
 
183
 
181
184
    // enable auto select text in textarea
182
 
    if ( $GLOBALS['cfg']['TextareaAutoSelect'] ) {
 
185
    if ($GLOBALS['cfg']['TextareaAutoSelect']) {
183
186
        $auto_sel = ' onfocus="selectContent( this, sql_box_locked, true )"';
184
187
    } else {
185
188
        $auto_sel = '';
186
189
    }
187
 
    
 
190
 
188
191
    // enable locking if inside query window
189
 
    if ( $is_querywindow ) {
 
192
    if ($is_querywindow) {
190
193
        $locking = ' onkeypress="document.sqlform.elements[\'LockFromUpdate\'].'
191
194
            .'checked = true;"';
192
195
    } else {
193
196
        $locking = '';
194
197
    }
195
 
    
 
198
 
196
199
    $table          = '';
197
200
    $db             = '';
198
201
    $fields_list    = array();
199
 
    if ( empty( $GLOBALS['db'] ) ) {
 
202
    if (! isset($GLOBALS['db']) || ! strlen($GLOBALS['db'])) {
200
203
        // prepare for server related
201
 
        $legend = sprintf( $GLOBALS['strRunSQLQueryOnServer'],
 
204
        $legend = sprintf($GLOBALS['strRunSQLQueryOnServer'],
202
205
            htmlspecialchars(
203
 
                $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['host'] ) );
204
 
    }
205
 
    elseif ( empty( $GLOBALS['table'] ) ) {
 
206
                $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['host']));
 
207
    } elseif (! isset($GLOBALS['table']) || ! strlen($GLOBALS['table'])) {
206
208
        // prepare for db related
207
209
        $db     = $GLOBALS['db'];
208
210
        // if you want navigation:
209
 
        $strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] 
210
 
            . '?' . PMA_generate_common_url( $db ) . '"';
211
 
        if ( $is_querywindow ) {
 
211
        $strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase']
 
212
            . '?' . PMA_generate_common_url($db) . '"';
 
213
        if ($is_querywindow) {
212
214
            $strDBLink .= ' target="_self"'
213
215
                . ' onclick="this.target=window.opener.frames[1].name"';
214
216
        }
215
217
        $strDBLink .= '>'
216
 
            . htmlspecialchars( $db ) . '</a>';
 
218
            . htmlspecialchars($db) . '</a>';
217
219
        // else use
218
 
        // $strDBLink = htmlspecialchars( $db );
219
 
        $legend = sprintf( $GLOBALS['strRunSQLQuery'], $strDBLink );
220
 
        if ( empty( $query ) ) {
221
 
            $query = str_replace( '%d', 
222
 
                PMA_backquote( $db ), $GLOBALS['cfg']['DefaultQueryDatabase'] );
 
220
        // $strDBLink = htmlspecialchars($db);
 
221
        $legend = sprintf($GLOBALS['strRunSQLQuery'], $strDBLink);
 
222
        if (empty($query)) {
 
223
            $query = str_replace('%d',
 
224
                PMA_backquote($db), $GLOBALS['cfg']['DefaultQueryDatabase']);
223
225
        }
224
226
    } else {
225
227
        $table  = $GLOBALS['table'];
227
229
        // Get the list and number of fields
228
230
        // we do a try_query here, because we could be in the query window,
229
231
        // trying to synchonize and the table has not yet been created
230
 
        $fields_list = PMA_DBI_fetch_result( 
231
 
            'SHOW FULL COLUMNS FROM ' . PMA_backquote( $db ) 
232
 
            . '.' . PMA_backquote( $GLOBALS['table'] ));
233
 
        
234
 
        $strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] 
235
 
            . '?' . PMA_generate_common_url( $db ) . '"';
236
 
        if ( $is_querywindow ) {
 
232
        $fields_list = PMA_DBI_fetch_result(
 
233
            'SHOW FULL COLUMNS FROM ' . PMA_backquote($db)
 
234
            . '.' . PMA_backquote($GLOBALS['table']));
 
235
 
 
236
        $strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase']
 
237
            . '?' . PMA_generate_common_url($db) . '"';
 
238
        if ($is_querywindow) {
237
239
            $strDBLink .= ' target="_self"'
238
240
                . ' onclick="this.target=window.opener.frames[1].name"';
239
241
        }
240
242
        $strDBLink .= '>'
241
 
            . htmlspecialchars( $db ) . '</a>';
 
243
            . htmlspecialchars($db) . '</a>';
242
244
        // else use
243
 
        // $strDBLink = htmlspecialchars( $db );
244
 
        $legend = sprintf( $GLOBALS['strRunSQLQuery'], $strDBLink );
245
 
        if ( empty( $query ) && count( $fields_list ) ) {
 
245
        // $strDBLink = htmlspecialchars($db);
 
246
        $legend = sprintf($GLOBALS['strRunSQLQuery'], $strDBLink);
 
247
        if (empty($query) && count($fields_list)) {
246
248
            $field_names = array();
247
 
            foreach ( $fields_list as $field ) {
 
249
            foreach ($fields_list as $field) {
248
250
                $field_names[] = PMA_backquote($field['Field']);
249
251
            }
250
252
            $query =
251
 
                str_replace( '%d', PMA_backquote( $db ),
252
 
                    str_replace( '%t', PMA_backquote( $table ),
253
 
                        str_replace( '%f',
254
 
                            implode( ', ', $field_names ),
255
 
                            $GLOBALS['cfg']['DefaultQueryTable'] ) ) );
 
253
                str_replace('%d', PMA_backquote($db),
 
254
                    str_replace('%t', PMA_backquote($table),
 
255
                        str_replace('%f',
 
256
                            implode(', ', $field_names ),
 
257
                            $GLOBALS['cfg']['DefaultQueryTable'])));
256
258
            unset($field_names);
257
259
        }
258
260
    }
259
 
    $legend .= ': ' . PMA_showMySQLDocu( 'SQL-Syntax', 'SELECT' );
 
261
    $legend .= ': ' . PMA_showMySQLDocu('SQL-Syntax', 'SELECT');
260
262
 
261
 
    if ( count( $fields_list ) ) {
 
263
    if (count($fields_list)) {
262
264
        $sqlquerycontainer_id = 'sqlquerycontainer';
263
265
    } else {
264
266
        $sqlquerycontainer_id = 'sqlquerycontainerfull';
265
267
    }
266
 
    
 
268
 
267
269
    echo '<a name="querybox"></a>' . "\n"
268
270
        .'<div id="queryboxcontainer">' . "\n"
269
271
        .'<fieldset id="querybox">' . "\n";
271
273
    echo '<div id="queryfieldscontainer">' . "\n";
272
274
    echo '<div id="' . $sqlquerycontainer_id . '">' . "\n"
273
275
        .'<textarea name="sql_query" id="sqlquery"'
274
 
        .'  cols="' . $GLOBALS['cfg']['TextareaCols'] . '"' 
275
 
        .'  rows="' . $GLOBALS['cfg']['TextareaRows'] . '"' 
276
 
        .'  dir="' . $GLOBALS['text_dir'] . '"' 
277
 
        .$auto_sel . $locking . '>' . $query . '</textarea>' . "\n";
 
276
        .'  cols="' . $GLOBALS['cfg']['TextareaCols'] . '"'
 
277
        .'  rows="' . $GLOBALS['cfg']['TextareaRows'] . '"'
 
278
        .'  dir="' . $GLOBALS['text_dir'] . '"'
 
279
        .$auto_sel . $locking . '>' . htmlspecialchars($query) . '</textarea>' . "\n";
278
280
    echo '</div>' . "\n";
279
 
        
280
 
    if ( count( $fields_list ) ) {
 
281
 
 
282
    if (count($fields_list)) {
281
283
        echo '<div id="tablefieldscontainer">' . "\n"
282
284
            .'<label>' . $GLOBALS['strFields'] . '</label>' . "\n"
283
285
            .'<select id="tablefields" name="dummy" '
284
286
            .'size="' . ($GLOBALS['cfg']['TextareaRows'] - 2) . '" '
285
287
            .'multiple="multiple" ondblclick="insertValueQuery()">' . "\n";
286
 
        foreach ( $fields_list as $field ) {
287
 
            echo '<option value="' 
288
 
                .PMA_backquote( htmlspecialchars( $field['Field'] ) ) . '"';
289
 
            if ( ! empty( $field['Field'] )  && isset($field['Comment']) ) {
290
 
                echo ' title="' . htmlspecialchars( $field['Comment'] ) . '"';
 
288
        foreach ($fields_list as $field) {
 
289
            echo '<option value="'
 
290
                .PMA_backquote(htmlspecialchars($field['Field'])) . '"';
 
291
            if (isset($field['Field']) && strlen($field['Field']) && isset($field['Comment'])) {
 
292
                echo ' title="' . htmlspecialchars($field['Comment']) . '"';
291
293
            }
292
294
            echo '>' . htmlspecialchars( $field['Field'] ) . '</option>' . "\n";
293
295
        }
305
307
        echo '</div>' . "\n"
306
308
            .'</div>' . "\n";
307
309
    }
308
 
    
 
310
 
309
311
    echo '<div class="clearfloat"></div>' . "\n";
310
312
    echo '</div>' . "\n";
311
 
    
312
 
    if ( ! empty( $GLOBALS['cfg']['Bookmark'] )
 
313
 
 
314
    if (! empty($GLOBALS['cfg']['Bookmark'])
313
315
      && $GLOBALS['cfg']['Bookmark']['db']
314
 
      && $GLOBALS['cfg']['Bookmark']['table'] ) {
 
316
      && $GLOBALS['cfg']['Bookmark']['table']) {
315
317
        ?>
316
318
        <div id="bookmarkoptions">
317
319
        <div class="formelement">
320
322
        <input type="text" name="bkm_label" id="bkm_label" value="" />
321
323
        </div>
322
324
        <div class="formelement">
323
 
        <input type="checkbox" name="bkm_all_users" id="id_bkm_all_users" 
 
325
        <input type="checkbox" name="bkm_all_users" id="id_bkm_all_users"
324
326
            value="true" />
325
327
        <label for="id_bkm_all_users">
326
328
            <?php echo $GLOBALS['strBookmarkAllUsers']; ?></label>
327
329
        </div>
328
330
        <div class="formelement">
329
 
        <input type="checkbox" name="bkm_replace" id="id_bkm_replace" 
 
331
        <input type="checkbox" name="bkm_replace" id="id_bkm_replace"
330
332
            value="true" />
331
333
        <label for="id_bkm_replace">
332
334
            <?php echo $GLOBALS['strBookmarkReplace']; ?></label>
334
336
        </div>
335
337
        <?php
336
338
    }
337
 
    
 
339
 
338
340
    echo '<div class="clearfloat"></div>' . "\n";
339
341
    echo '</fieldset>' . "\n"
340
342
        .'</div>' . "\n";
341
 
    
 
343
 
342
344
    echo '<fieldset id="queryboxfooter" class="tblFooters">' . "\n";
343
345
    echo '<div class="formelement">' . "\n";
344
 
    if ( $is_querywindow ) {
 
346
    if ($is_querywindow) {
345
347
        ?>
346
 
        <script type="text/javascript">
 
348
        <script type="text/javascript" language="javascript">
347
349
        //<![CDATA[
348
350
            document.writeln(' <input type="checkbox" name="LockFromUpdate" value="1" id="checkbox_lock" /> <label for="checkbox_lock"><?php echo $GLOBALS['strQueryWindowLock']; ?></label> ');
349
351
        //]]>
354
356
    echo '<div class="formelement">' . "\n";
355
357
    echo '<input type="checkbox" name="show_query" value="1" '
356
358
        .'id="checkbox_show_query" checked="checked" />' . "\n"
357
 
        .'<label for="checkbox_show_query">' . $GLOBALS['strShowThisQuery'] 
 
359
        .'<label for="checkbox_show_query">' . $GLOBALS['strShowThisQuery']
358
360
        .'</label>' . "\n";
359
361
    echo '</div>' . "\n";
360
362
    echo '<input type="submit" name="SQL" value="' . $GLOBALS['strGo'] . '" />'
365
367
 
366
368
/**
367
369
 * prints bookmark fieldset
368
 
 * 
 
370
 *
369
371
 * @usedby  PMA_sqlQueryForm()
370
372
 * @uses    PMA_listBookmarks()
371
373
 * @uses    $GLOBALS['db']
382
384
 * @uses    count()
383
385
 * @uses    htmlspecialchars()
384
386
 */
385
 
function PMA_sqlQueryFormBookmark() {
 
387
function PMA_sqlQueryFormBookmark()
 
388
{
386
389
    $bookmark_list = PMA_listBookmarks(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', $GLOBALS['cfg']['Bookmark'] );
387
 
    if ( ! $bookmark_list || count( $bookmark_list ) < 1 ) {
 
390
    if (! $bookmark_list || count($bookmark_list) < 1) {
388
391
        return;
389
392
    }
390
 
    
 
393
 
391
394
    echo '<fieldset id="bookmarkoptions">';
392
395
    echo '<legend>';
393
396
    echo $GLOBALS['strBookmarkQuery'] . '</legend>' . "\n";
394
397
    echo '<div class="formelement">';
395
398
    echo '<select name="id_bookmark">' . "\n";
396
399
    echo '<option value=""></option>' . "\n";
397
 
    foreach ( $bookmark_list as $key => $value ) {
398
 
        echo '<option value="' . htmlspecialchars( $key ) . '">' 
399
 
            .htmlspecialchars( $value ) . '</option>' . "\n";
 
400
    foreach ($bookmark_list as $key => $value) {
 
401
        echo '<option value="' . htmlspecialchars($key) . '">'
 
402
            .htmlspecialchars($value) . '</option>' . "\n";
400
403
    }
401
404
    // &nbsp; is required for correct display with styles/line height
402
405
    echo '</select>&nbsp;' . "\n";
403
406
    echo '</div>' . "\n";
404
407
    echo '<div class="formelement">' . "\n";
405
408
    echo $GLOBALS['strVar'];
406
 
    if ( $GLOBALS['cfg']['ReplaceHelpImg'] ) {
 
409
    if ($GLOBALS['cfg']['ReplaceHelpImg']) {
407
410
        echo ' <a href="./Documentation.html#faqbookmark"'
408
411
            .' target="documentation">'
409
412
            .'<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png"'
413
416
        echo ' (<a href="./Documentation.html#faqbookmark"'
414
417
            .' target="documentation">' . $GLOBALS['strDocu'] . '</a>): ';
415
418
    }
416
 
    echo '<input type="text" name="bookmark_variable" class="textfield"' 
 
419
    echo '<input type="text" name="bookmark_variable" class="textfield"'
417
420
        .' size="10" />' . "\n";
418
421
    echo '</div>' . "\n";
419
422
    echo '<div class="formelement">' . "\n";
432
435
    echo '</div>' . "\n";
433
436
    echo '<div class="clearfloat"></div>' . "\n";
434
437
    echo '</fieldset>' . "\n";
435
 
    
 
438
 
436
439
    echo '<fieldset id="bookmarkoptionsfooter" class="tblFooters">' . "\n";
437
440
    echo '<input type="submit" name="SQL" value="' . $GLOBALS['strGo'] . '" />';
438
441
    echo '<div class="clearfloat"></div>' . "\n";
441
444
 
442
445
/**
443
446
 * prints bookmark fieldset
444
 
 * 
 
447
 *
445
448
 * @usedby  PMA_sqlQueryForm()
446
449
 * @uses    $GLOBALS['cfg']['GZipDump']
447
450
 * @uses    $GLOBALS['cfg']['BZipDump']
470
473
 * @uses    PMA_CSDROPDOWN_CHARSET
471
474
 * @uses    empty()
472
475
 */
473
 
function PMA_sqlQueryFormUpload() {
 
476
function PMA_sqlQueryFormUpload(){
474
477
    $errors = array ();
475
478
 
476
479
    $matcher = '@\.sql(\.(' . PMA_supportedDecompressions() . '))?$@'; // we allow only SQL here
487
490
    echo $GLOBALS['strLocationTextfile'] . '</legend>';
488
491
    echo '<div class="formelement">';
489
492
    echo '<input type="file" name="sql_file" class="textfield" /> ';
490
 
    echo PMA_displayMaximumUploadSize( $GLOBALS['max_upload_size'] );
 
493
    echo PMA_displayMaximumUploadSize($GLOBALS['max_upload_size']);
491
494
    // some browsers should respect this :)
492
 
    echo PMA_generateHiddenMaxFileSize( $GLOBALS['max_upload_size'] ) . "\n";
 
495
    echo PMA_generateHiddenMaxFileSize($GLOBALS['max_upload_size']) . "\n";
493
496
    echo '</div>';
494
 
    
 
497
 
495
498
    if ($files === FALSE) {
496
499
        $errors[$GLOBALS['strError']] = $GLOBALS['strWebServerUploadDirectoryError'];
497
500
    } elseif (!empty($files)) {
514
517
      && $GLOBALS['allow_recoding'] ) {
515
518
        echo $GLOBALS['strCharsetOfFile'] . "\n"
516
519
             . '<select name="charset_of_file" size="1">' . "\n";
517
 
        foreach( $GLOBALS['cfg']['AvailableCharsets'] as $temp_charset ) {
 
520
        foreach ($GLOBALS['cfg']['AvailableCharsets'] as $temp_charset) {
518
521
            echo '<option value="' . $temp_charset . '"';
519
 
            if ( $temp_charset == $GLOBALS['charset'] ) {
 
522
            if ($temp_charset == $GLOBALS['charset']) {
520
523
                echo ' selected="selected"';
521
524
            }
522
525
            echo '>' . $temp_charset . '</option>' . "\n";
523
526
        }
524
527
        echo '</select>' . "\n";
525
 
    } elseif ( PMA_MYSQL_INT_VERSION >= 40100 ) {
 
528
    } elseif (PMA_MYSQL_INT_VERSION >= 40100) {
526
529
        echo $GLOBALS['strCharsetOfFile'] . "\n";
527
 
        echo PMA_generateCharsetDropdownBox( PMA_CSDROPDOWN_CHARSET,
528
 
                'charset_of_file', NULL, 'utf8', FALSE );
 
530
        echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET,
 
531
                'charset_of_file', null, 'utf8', FALSE);
529
532
    } // end if (recoding)
530
533
    echo '<input type="submit" name="SQL" value="' . $GLOBALS['strGo']
531
534
        .'" />' . "\n";
532
535
    echo '<div class="clearfloat"></div>' . "\n";
533
536
    echo '</fieldset>';
534
 
    
535
 
    foreach( $errors as $error => $message ) {
 
537
 
 
538
    foreach ( $errors as $error => $message ) {
536
539
        echo '<div>' . $error . '</div>';
537
540
        echo '<div>' . $message . '</div>';
538
541
    }