home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / url_generating.lib.php < prev    next >
Encoding:
PHP Script  |  2003-11-26  |  2.7 KB  |  88 lines

  1. <?php
  2. /* $Id: url_generating.lib.php,v 2.2 2003/11/26 22:52:23 rabus Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5.  
  6. /**
  7.  * URL/hidden inputs generating.
  8.  */
  9.  
  10.  
  11. /**
  12.  * Generates text with hidden inputs.
  13.  *
  14.  * @param   string   optional database name
  15.  * @param   string   optional table name
  16.  * @param   int      indenting level
  17.  *
  18.  * @return  string   string with input fields
  19.  *
  20.  * @global  string   the current language
  21.  * @global  string   the current conversion charset
  22.  * @global  string   the current server
  23.  * @global  array    the configuration array
  24.  * @global  boolean  whether recoding is allowed or not
  25.  *
  26.  * @access  public
  27.  *
  28.  * @author  nijel
  29.  */
  30. function PMA_generate_common_hidden_inputs ($db = '', $table = '', $indent = 0)
  31. {
  32.     global $lang, $convcharset, $server;
  33.     global $cfg, $allow_recoding;
  34.  
  35.     $spaces = '';
  36.     for ($i = 0; $i < $indent; $i++) {
  37.         $spaces .= '    ';
  38.     }
  39.  
  40.     $result = $spaces . '<input type="hidden" name="lang" value="' . $lang . '" />' . "\n"
  41.             . $spaces . '<input type="hidden" name="server" value="' . $server . '" />' . "\n";
  42.     if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)
  43.         $result .= $spaces . '<input type="hidden" name="convcharset" value="' . $convcharset . '" />'  . "\n";
  44.     if (!empty($db))
  45.         $result .= $spaces . '<input type="hidden" name="db" value="'.htmlspecialchars($db).'" />' . "\n";
  46.     if (!empty($table))
  47.         $result .= $spaces . '<input type="hidden" name="table" value="'.htmlspecialchars($table).'" />' . "\n";
  48.     return $result;
  49. }
  50.  
  51. /**
  52.  * Generates text with URL parameters.
  53.  *
  54.  * @param   string   optional database name
  55.  * @param   string   optional table name
  56.  * @param   string   character to use instead of '&' for deviding
  57.  *                   multiple URL parameters from each other
  58.  *
  59.  * @return  string   string with URL parameters
  60.  *
  61.  * @global  string   the current language
  62.  * @global  string   the current conversion charset
  63.  * @global  string   the current server
  64.  * @global  array    the configuration array
  65.  * @global  boolean  whether recoding is allowed or not
  66.  *
  67.  * @access  public
  68.  *
  69.  * @author  nijel
  70.  */
  71. function PMA_generate_common_url ($db = '', $table = '', $amp = '&')
  72. {
  73.     global $lang, $convcharset, $server;
  74.     global $cfg, $allow_recoding;
  75.  
  76.     $result = 'lang=' . $lang
  77.        . $amp . 'server=' . $server;
  78.     if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)
  79.         $result .= $amp . 'convcharset=' . $convcharset;
  80.     if (!empty($db))
  81.         $result .= $amp . 'db='.urlencode($db);
  82.     if (!empty($table))
  83.         $result .= $amp . 'table='.urlencode($table);
  84.     return $result;
  85. }
  86.  
  87. ?>
  88.