コード例 #1
0
ファイル: Misc.php プロジェクト: netcon-source/phppgadmin
 /**
  * Returns URL given an action associative array.
  * NOTE: this function does not html-escape, only url-escape
  * @param $action An associative array of the follow properties:
  *			'url'  => The first part of the URL (before the ?)
  *			'urlvars' => Associative array of (URL variable => field name)
  *						these are appended to the URL
  * @param $fields Field data from which 'urlfield' and 'vars' are obtained.
  */
 function getActionUrl(&$action, &$fields)
 {
     $url = value($action['url'], $fields);
     if ($url === false) {
         return '';
     }
     if (!empty($action['urlvars'])) {
         $urlvars = value($action['urlvars'], $fields);
     } else {
         $urlvars = array();
     }
     /* set server, database and schema parameter if not presents */
     if (isset($urlvars['subject'])) {
         $subject = value($urlvars['subject'], $fields);
     } else {
         $subject = '';
     }
     if (isset($_REQUEST['server']) and !isset($urlvars['server']) and $subject != 'root') {
         $urlvars['server'] = $_REQUEST['server'];
         if (isset($_REQUEST['database']) and !isset($urlvars['database']) and $subject != 'server') {
             $urlvars['database'] = $_REQUEST['database'];
             if (isset($_REQUEST['schema']) and !isset($urlvars['schema']) and $subject != 'database') {
                 $urlvars['schema'] = $_REQUEST['schema'];
             }
         }
     }
     $sep = '?';
     foreach ($urlvars as $var => $varfield) {
         $url .= $sep . value_url($var, $fields) . '=' . value_url($varfield, $fields);
         $sep = '&';
     }
     return $url;
 }
コード例 #2
0
ファイル: decorator.inc.php プロジェクト: hardikk/HNH
 function value($fields)
 {
     $url = value($this->b, $fields);
     if ($url === false) {
         return '';
     }
     if (!empty($this->q)) {
         $queryVars = value($this->q, $fields);
         $sep = '?';
         foreach ($queryVars as $var => $value) {
             $url .= $sep . value_url($var, $fields) . '=' . value_url($value, $fields);
             $sep = '&';
         }
     }
     return $url;
 }
コード例 #3
0
ファイル: Misc.php プロジェクト: hardikk/HNH
 /**
  * Display a URL given an action associative array.
  * @param $action An associative array of the follow properties:
  *			'url'  => The first part of the URL (before the ?)
  *			'urlvars' => Associative array of (URL variable => field name)
  *						these are appended to the URL
  *			'urlfn' => Function to apply to URL before display
  * @param $fields Field data from which 'urlfield' and 'vars' are obtained.
  * @param $attr If supplied then the URL will be quoted and prefixed with
  *				'$attr='.
  */
 function printActionUrl(&$action, &$fields, $attr = null)
 {
     $url = value($action['url'], $fields);
     if ($url === false) {
         return '';
     }
     if (!empty($action['urlvars'])) {
         $urlvars = value($action['urlvars'], $fields);
     } else {
         $urlvars = array();
     }
     if (isset($urlvars['subject'])) {
         $subject = value($urlvars['subject'], $fields);
         if (isset($_REQUEST['server']) && $subject != 'root') {
             $urlvars['server'] = $_REQUEST['server'];
             if (isset($_REQUEST['database']) && $subject != 'server') {
                 $urlvars['database'] = $_REQUEST['database'];
                 if (isset($_REQUEST['schema']) && $subject != 'database') {
                     $urlvars['schema'] = $_REQUEST['schema'];
                 }
             }
         }
     }
     $sep = '?';
     foreach ($urlvars as $var => $varfield) {
         $url .= $sep . value_url($var, $fields) . '=' . value_url($varfield, $fields);
         $sep = '&';
     }
     $url = htmlentities($url);
     if ($attr !== null && $url != '') {
         return ' ' . $attr . '="' . $url . '"';
     } else {
         return $url;
     }
 }