sorry, wrong version checked in
[phpmyadmin/arisferyanto.git] / libraries / url_generating.lib.php
blob8fd94dcd0bf989438bb2672e4b74a82aece88c00
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * URL/hidden inputs generating.
8 */
11 /**
12 * Generates text with hidden inputs.
14 * @param string optional database name
15 * @param string optional table name
16 * @param int indenting level
18 * @return string string with input fields
20 * @global string the current language
21 * @global string the current conversion charset
22 * @global string the current connection collation
23 * @global string the current server
24 * @global array the configuration array
25 * @global boolean whether recoding is allowed or not
27 * @access public
29 * @author nijel
31 function PMA_generate_common_hidden_inputs ($db = '', $table = '', $indent = 0, $skip = array())
33 global $lang, $convcharset, $collation_connection, $server;
34 global $cfg, $allow_recoding;
36 if (!is_array($skip)) {
37 $skip = array($skip);
40 $spaces = '';
41 for ($i = 0; $i < $indent; $i++) {
42 $spaces .= ' ';
45 $result = $spaces . '<input type="hidden" name="lang" value="' . $lang . '" />' . "\n"
46 . $spaces . '<input type="hidden" name="server" value="' . $server . '" />' . "\n";
47 if (!in_array('convcharset', $skip) && isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)
48 $result .= $spaces . '<input type="hidden" name="convcharset" value="' . $convcharset . '" />' . "\n";
49 if (!in_array('collation_connection', $skip) && isset($collation_connection))
50 $result .= $spaces . '<input type="hidden" name="collation_connection" value="' . $collation_connection . '" />' . "\n";
51 if (!in_array('db', $skip) && !empty($db))
52 $result .= $spaces . '<input type="hidden" name="db" value="'.htmlspecialchars($db).'" />' . "\n";
53 if (!in_array('table', $skip) && !empty($table))
54 $result .= $spaces . '<input type="hidden" name="table" value="'.htmlspecialchars($table).'" />' . "\n";
55 return $result;
58 /**
59 * Generates text with URL parameters.
61 * @param string optional database name
62 * @param string optional table name
63 * @param string character to use instead of '&amp;' for deviding
64 * multiple URL parameters from each other
66 * @return string string with URL parameters
68 * @global string the current language
69 * @global string the current conversion charset
70 * @global string the current connection collation
71 * @global string the current server
72 * @global array the configuration array
73 * @global boolean whether recoding is allowed or not
75 * @access public
77 * @author nijel
79 function PMA_generate_common_url ($db = '', $table = '', $amp = '&amp;')
81 global $lang, $convcharset, $collation_connection, $server;
82 global $cfg, $allow_recoding;
84 $result = 'lang=' . $lang
85 . $amp . 'server=' . $server;
86 if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)
87 $result .= $amp . 'convcharset=' . urlencode($convcharset);
88 if (isset($collation_connection))
89 $result .= $amp . 'collation_connection=' . urlencode($collation_connection);
90 if (!empty($db))
91 $result .= $amp . 'db='.urlencode($db);
92 if (!empty($table))
93 $result .= $amp . 'table='.urlencode($table);
94 return $result;