Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, October 15, 2026

Diff for phpMyEdit/phpMyEdit.class.php between version 1.49 and 1.50

version 1.49, 2003/02/15 11:23:57 version 1.50, 2003/02/15 19:56:16
Line 19 
Line 19 
  * http://www.platon.sk/projects/phpMyEdit/   * http://www.platon.sk/projects/phpMyEdit/
  */   */
   
 /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.48 2003/02/12 00:08:48 nepto Exp $ */  /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.49 2003/02/15 11:23:57 nepto Exp $ */
   
 /*      phpMyEdit intro {{{ */  /*      phpMyEdit intro {{{ */
 /*  /*
Line 529  class phpMyEdit
Line 529  class phpMyEdit
                 return false;                  return false;
         } /* }}} */          } /* }}} */
   
         /*  
          * functions for get/post/query args  
          */  
   
         function gather_post_vars() /* {{{ */  
         {  
                 global $HTTP_POST_VARS;  
                 foreach ($HTTP_POST_VARS as $key => $val) {  
                         if ($val != '' && $val != '*') {  
                                 $pv[$key] = $val;  
                         }  
                 }  
                 $this->pv = $pv;  
         } /* }}} */  
   
         function gather_query_opts() /* {{{ */          function gather_query_opts() /* {{{ */
         {          {
                 // gathers query options into an array, $this->query_opts                  // gathers query options into an array, $this->query_opts
                 $query_opts = array();  
                 $qo = array();                  $qo = array();
                 for ($k = 0; $k < $this->num_fds; $k++) {                  for ($k = 0; $k < $this->num_fds; $k++) {
                         $type = $this->fdd[$k]['type'];                          $type = $this->fdd[$k]['type'];
Line 560  class phpMyEdit
Line 544  class phpMyEdit
                         if ($m == '' && $mi == '') {                          if ($m == '' && $mi == '') {
                                 continue;                                  continue;
                         }                          }
                         if ($mi != '' /* && ($this->fdd[$k]['values']['description'] || $this->fdd[$k]['values']['column']) */) {                          if (is_array($m) || is_array($mi)) {
                                   is_array($mi) && $m = $mi;
                                   if (in_array('*', $m)) {
                                           continue;
                                   }
                                   $qf_op = '';
                                   foreach (array_keys($m) as $key) {
                                           if ($qf_op == '') {
                                                   $qf_op   = 'IN';
                                                   $qf_val  = '"'.addslashes($m[$key]).'"';
                                                   $afilter = ' IN ("'.addslashes($m[$key]).'"'; // )
                                           } else {
                                                   $afilter = $afilter.',"'.addslashes($m[$key]).'"';
                                                   $qf_val .= ',"'.addslashes($m[$key]).'"';
                                           }
                                   }
                                   $afilter = $afilter.')';
                                   // XXX: $dont_desc and $dont_cols hack
                                   $dont_desc = isset($this->fdd[$k]['values']['description']);
                                   $dont_cols = isset($this->fdd[$k]['values']['column']);
                                   $qo[$this->fqn($k, false, $dont_desc, $dont_cols)] =
                                           array('oper'  => $qf_op, 'value' => "($qf_val)"); // )
                           } else if ($mi != '' /* && ($this->fdd[$k]['values']['description'] || $this->fdd[$k]['values']['column']) */) {
                                 $afilter = addslashes($mi);                                  $afilter = addslashes($mi);
                                 if ($afilter != '*') {                                  if ($afilter != '*') {
                                         $qo[$this->fqn($k, false, true, true)] = array('oper'  => '=', 'value' => "'$afilter'");                                          $qo[$this->fqn($k, false, true, true)] = array('oper'  => '=', 'value' => "'$afilter'");
                                 }                                  }
                         } else if (is_array($m)) {  
                                 // TODO: is_array($mi)  
                                 if (!in_array('*',$m)){  
                                         $qf_op = '';  
                                         foreach (array_keys($m) as $key) {  
                                                 if ($qf_op == '') {  
                                                         $qf_op   = 'IN';  
                                                         $qf_val  = '"'.addslashes($m[$key]).'"';  
                                                         $afilter = ' IN ("'.addslashes($m[$key]).'"';  
                                                 } else {  
                                                         $afilter = $afilter.',"'.addslashes($m[$key]).'"';  
                                                         $qf_val .= ',"'.addslashes($m[$key]).'"';  
                                                 }  
                                         }  
                                         $afilter = $afilter.')';  
                                         // XXX: $dont_desc and $dont_cols hack  
                                         $dont_desc = isset($this->fdd[$k]['values']['description']);  
                                         $dont_cols = isset($this->fdd[$k]['values']['column']);  
                                         $qo[$this->fqn($k, false, $dont_desc, $dont_cols)] =  
                                                 array('oper'  => $qf_op, 'value' => "($qf_val)");  
                                 }  
                         } else {                          } else {
                                 $afilter = addslashes($m);                                  $afilter = addslashes($m);
                                 if ($afilter != '*') {                                  if ($afilter == '*') {
                                         if ($this->col_is_string($k)                                          continue;
                                                         || $this->fdd[$k]['values']['description']                                  }
                                                         || $this->fdd[$k]['values']['column']) {                                  if ($this->col_is_string($k)
                                                 $afilter = '%'.str_replace('*', '%', $afilter).'%';                                                  || $this->fdd[$k]['values']['description']
                                                 $ids  = array();                                                  || $this->fdd[$k]['values']['column']) {
                                                 $ar   = array();                                          $afilter = '%'.str_replace('*', '%', $afilter).'%';
                                                 $ar[$this->fqn($k)] = array('oper'  => 'LIKE', 'value' => "'$afilter'");                                          $ids  = array();
                                                 if (is_array($this->fdd[$k]['values2'])) {                                          $ar   = array();
                                                         foreach ($this->fdd[$k]['values2'] as $key => $val) {                                          $ar[$this->fqn($k)] = array('oper'  => 'LIKE', 'value' => "'$afilter'");
                                                                 if (stristr($val, $m)) {                                          if (is_array($this->fdd[$k]['values2'])) {
                                                                         $ids[] = '"'.addslashes($key).'"';                                                  foreach ($this->fdd[$k]['values2'] as $key => $val) {
                                                                 }                                                          if (stristr($val, $m)) {
                                                         }                                                                  $ids[] = '"'.addslashes($key).'"';
                                                         if (count($ids) > 0) {  
                                                                 $ar[$this->fqn($k, false, true, true)]  
                                                                         = array('oper'  => 'IN', 'value' => '('.join(',', $ids).')');  
                                                         }                                                          }
                                                 }                                                  }
                                                 $qo[] = $ar;                                                  if (count($ids) > 0) {
                                         } elseif ($this->col_is_number($k) && ($mc != '')) {                                                          $ar[$this->fqn($k, false, true, true)]
                                                 if ($mc != '') {                                                                  = array('oper'  => 'IN', 'value' => '('.join(',', $ids).')');
                                                         $qo[$this->fqn($k)] = array('oper'  => $mc, 'value' => "'$afilter'");  
                                                 }                                                  }
                                         } elseif ($this->col_is_date($k)) {  
                                                 $afilter = '%'.str_replace ('*', '%', $afilter).'%';  
                                                 $qo[$this->fqn($k)] = array('oper'  => 'like', 'value' => "'$afilter'");  
                                         } elseif($this->col_has_values($k)) {  
                                                 //debug_var('col_is_string',$this->fdd[$k]['name'].'::'.$this->fdd[$k]['type']);  
                                                 $qo[$this->fqn($k)] = array( 'oper'  => '=', 'value' => "'$afilter'");  
                                         } else {  
                                                 // unknown (to mysql/php interface) field type  
                                                 // message the filter for a string comparison  
                                                 $afilter = '%'.str_replace ('*', '%', $afilter).'%';  
                                                 $qo[$this->fqn($k)] = array('oper'  => 'like', 'value' => "'$afilter'");  
                                         }                                          }
                                           $qo[] = $ar;
                                   } elseif ($this->col_is_number($k) && ($mc != '')) {
                                           if ($mc != '') {
                                                   $qo[$this->fqn($k)] = array('oper'  => $mc, 'value' => "'$afilter'");
                                           }
                                   } elseif ($this->col_is_date($k)) {
                                           $afilter = '%'.str_replace ('*', '%', $afilter).'%';
                                           $qo[$this->fqn($k)] = array('oper'  => 'like', 'value' => "'$afilter'");
                                   } elseif($this->col_has_values($k)) {
                                           //debug_var('col_is_string',$this->fdd[$k]['name'].'::'.$this->fdd[$k]['type']);
                                           $qo[$this->fqn($k)] = array( 'oper'  => '=', 'value' => "'$afilter'");
                                   } else {
                                           // unknown (to mysql/php interface) field type
                                           // message the filter for a string comparison
                                           $afilter = '%'.str_replace ('*', '%', $afilter).'%';
                                           $qo[$this->fqn($k)] = array('oper'  => 'like', 'value' => "'$afilter'");
                                 }                                  }
                         }                          }
                 } // for                  } // for
                 $this->query_opts = $qo;                  $this->query_opts = $qo;
         } // gather_query_opts  /* }}} */  
   
         function gather_get_vars() /* {{{ */  
         {  
                 global $HTTP_SERVER_VARS;  
                 $vals = array();  
                 $parts = split('&',$HTTP_SERVER_VARS['QUERY_STRING']);  
                 if (count($parts) > 0) {  
                         foreach ($parts as $part) {  
                                 list($key,$val) = split('=',$part,2);  
                                 $vals[$key] = $val;  
                         }  
                 }  
                 $this->get_opts = $vals;  
         } /* }}} */  
   
         function unify_opts() /* {{{ */  
         {  
                 $all_opts = array();  
                 if (count($this->qo) > 0) {  
                         foreach ($this->qo as $key=>$val)  
                                 $all_opts[$key] = $val;  
                 }  
                 if (count($this->pv) > 0) {  
                         foreach ($this->pv as $key=>$val)  
                                 $all_opts[$key] = $val;  
                 }  
                 if (count($this->get_opts) > 0) {  
                         foreach ($this->get_opts as $key=>$val)  
                                 $all_opts[$key] = $val;  
                 }  
                 $this->all_opts = $all_opts;  
         } /* }}} */          } /* }}} */
   
         /*          /*
Line 802  function phpMyEdit_form_control(theForm)
Line 756  function phpMyEdit_form_control(theForm)
                                 foreach ($required_ar as $field_num) {                                  foreach ($required_ar as $field_num) {
                                         if ($this->col_has_values($field_num)) {                                          if ($this->col_has_values($field_num)) {
                                                 $condition = 'theForm.%s.selectedIndex == -1';                                                  $condition = 'theForm.%s.selectedIndex == -1';
                                                 $multiple  = $this->fdd[$field_num]['select'] == 'M'                                                  $multiple  = ($this->fdd[$field_num]['select'] == 'M'
                                                         || $this->col_is_set($field_num);                                                                  || $this->col_is_set($field_num))
                                                           && ! $this->fdd[$k]['values']['table'];
                                         } else {                                          } else {
                                                 $condition = 'phpMyEdit_trim(theForm.%s.value) == ""';                                                  $condition = 'phpMyEdit_trim(theForm.%s.value) == ""';
                                                 $multiple  = false;                                                  $multiple  = false;
Line 870  function phpMyEdit_form_control(theForm)
Line 825  function phpMyEdit_form_control(theForm)
                         echo '<td>'.$this->fdd[$k]['name'].'</td>'."\n";                          echo '<td>'.$this->fdd[$k]['name'].'</td>'."\n";
                         if ($this->col_has_values($k) && !$this->readonly($k)) {                          if ($this->col_has_values($k) && !$this->readonly($k)) {
                                 echo '<td>'."\n";                                  echo '<td>'."\n";
                                 $multiple = $this->fdd[$k]['select'] == 'M' || $this->col_is_set($k);                                  $multiple = ($this->fdd[$k]['select'] == 'M' || $this->col_is_set($k))
                                                   && ! $this->fdd[$k]['values']['table'];
                                 $vals = isset($this->fdd[$k]['values']['table'])                                  $vals = isset($this->fdd[$k]['values']['table'])
                                         ? $this->set_values_from_table($k)                                          ? $this->set_values_from_table($k)
                                         : (array) $this->fdd[$k]['values2'] + (array) $this->fdd[$k]['values'];                                          : (array) $this->fdd[$k]['values2'] + (array) $this->fdd[$k]['values'];
Line 1014  function phpMyEdit_form_control(theForm)
Line 970  function phpMyEdit_form_control(theForm)
                 echo '<td>'."\n";                  echo '<td>'."\n";
   
                 if ($this->col_has_values($k) && !$this->readonly($k)) {                  if ($this->col_has_values($k) && !$this->readonly($k)) {
                         $multiple = $this->fdd[$k]['select'] == 'M' || $this->col_is_set($k);                          $multiple = ($this->fdd[$k]['select'] == 'M' || $this->col_is_set($k))
                                           && ! $this->fdd[$k]['values']['table'];
                         $vals = isset($this->fdd[$k]['values']['table'])                          $vals = isset($this->fdd[$k]['values']['table'])
                                 ? $this->set_values_from_table($k)                                  ? $this->set_values_from_table($k)
                                 : (array) $this->fdd[$k]['values2'] + (array) $this->fdd[$k]['values'];                                  : (array) $this->fdd[$k]['values2'] + (array) $this->fdd[$k]['values'];
Line 1295  function phpMyEdit_form_control(theForm)
Line 1252  function phpMyEdit_form_control(theForm)
                         foreach (array($l => $m, $lc => $mc, $li => $mi) as $name => $value) {                          foreach (array($l => $m, $lc => $mc, $li => $mi) as $name => $value) {
                                 if (is_array($value)) {                                  if (is_array($value)) {
                                         foreach ($value as $key => $val) {                                          foreach ($value as $key => $val) {
                                                 if ($key == '' || $val == '') {                                                  if ($key === '' || $val === '') {
                                                         continue;                                                          continue;
                                                 }                                                  }
                                                 $this->qfn = $this->qfn.'&'.$name.'['.$key.']='.rawurlencode($val);                                                  $this->qfn  .= '&'.$name.'['.rawurlencode($key).']='.rawurlencode($val);
                                                 $hidden_qfs .= '<input type="hidden" name="'.$name.'['.$key                                                  $hidden_qfs .= '<input type="hidden" name="'.$name.'['.$key
                                                         .']" value="'.htmlspecialchars($val).'">'."\n";                                                          .']" value="'.htmlspecialchars($val).'">'."\n";
                                         }                                          }
                                 } else {                                  } else {
                                         if ($value != '') {                                          if ($value != '') {
                                                 $this->qfn   = $this->qfn.'&'.$name.'='.rawurlencode($value);                                                  $this->qfn  .= '&'.$name.'='.rawurlencode($value);
                                                 $hidden_qfs .= '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'">'."\n";                                                  $hidden_qfs .= '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'">'."\n";
                                         }                                          }
                                 }                                  }
Line 1313  function phpMyEdit_form_control(theForm)
Line 1270  function phpMyEdit_form_control(theForm)
                 return $hidden_qfs;                  return $hidden_qfs;
         } /* }}} */          } /* }}} */
   
         function plain2web($x) /* {{{ */  
         {  
                 if (isset($x)) {  
                         if (is_array($x)) {  
                                 for ($n=0; $n<count($x); $n++) {  
                                         $x[$n] = $this->plain2web($x[$n]);  
                                 }  
                         } else {  
                                 $x = rawurlencode($x);  
                         }  
                 }  
                 return $x;  
         } /* }}} */  
   
         function get_cgi_var($name, $default_value = null) /* {{{ */          function get_cgi_var($name, $default_value = null) /* {{{ */
         {          {
                 if (isset($this) && isset($this->cgi['overwrite'][$name])) {                  if (isset($this) && isset($this->cgi['overwrite'][$name])) {
Line 1693  function phpMyEdit_form_control(theForm)
Line 1636  function phpMyEdit_form_control(theForm)
                         }                          }
   
                         // if we have any aggregates going on, then we have to list all results                          // if we have any aggregates going on, then we have to list all results
                         $var_to_total  = 'qf'.$k.'_aggr';  //                      $var_to_total  = 'qf'.$k.'_aggr';
                         $$var_to_total = $this->get_cgi_var($var_to_total);  //                      $$var_to_total = $this->get_cgi_var($var_to_total);
                         if ($$var_to_total != '') {  //                      if ($$var_to_total != '') {
                                 $listall = true;  //                              $listall = true;
                         }  //                      }
                 } // for                  } // for
   
                 echo '</tr>'."\n";                  echo '</tr>'."\n";
Line 1772  function phpMyEdit_form_control(theForm)
Line 1715  function phpMyEdit_form_control(theForm)
                 }                  }
                 $row = @mysql_fetch_array($res, MYSQL_ASSOC);                  $row = @mysql_fetch_array($res, MYSQL_ASSOC);
   
                 /*                  /* FILTER {{{
                  * FILTER  
                  *                   *
                  * Draw the filter and fill it with any data typed in last pass and stored                   * Draw the filter and fill it with any data typed in last pass and stored
                  * in the array parameter keyword 'filter'. Prepare the SQL WHERE clause.                   * in the array parameter keyword 'filter'. Prepare the SQL WHERE clause.
                  */                   */
   
                 if ($row != false && $this->fl) {                  if ($this->fl) {
                         echo '<tr>';                          // Filter row retrieval
                         echo '<td colspan='.$sys_cols.' align="center">';                          $fields     = false;
                         echo '<input type="submit" name="filter" value="'                          $filter_row = $row;
                                 .$this->labels['Query'].'"></td>'."\n";                          if (! is_array($filter_row)) {
                                   unset($qparts['where']);
                                   $query = $this->query_make($qparts);
                                   $res   = $this->myquery($query, __LINE__);
                                   if ($res == false) {
                                           $this->error('invalid SQL query', $query);
                                           return false;
                                   }
                                   $filter_row = @mysql_fetch_array($res, MYSQL_ASSOC);
                           }
                         /* Variable $fields is used to get index of particular field in                          /* Variable $fields is used to get index of particular field in
                            result. That index can be passed in example to mysql_field_len()                             result. That index can be passed in example to mysql_field_len()
                            function. Use field names as indexes to $fields array. */                             function. Use field names as indexes to $fields array. */
                         $fields = array_flip(array_keys($row));                          if (is_array($filter_row)) {
                         for ($k = 0; $k < $this->num_fds; $k++) {                                  $fields = array_flip(array_keys($filter_row));
                                 $this->field_name = $this->fds[$k];                          }
                                 $fd               = $this->field_name;  
                                 $this->field      = $this->fdd[$fd];  
                                 $l  = 'qf'.$k;  
                                 $lc = 'qf'.$k.'_comp';  
                                 $li = 'qf'.$k.'_id';  
                                 $m  = $this->get_cgi_var($l,  '');  
                                 $mc = $this->get_cgi_var($lc, '');  
                                 $mi = $this->get_cgi_var($li, '');  
   
                                 $widthStyle = '';                          if ($fields != false) {
                                 if (isset($this->fdd[$fd]['width'])) {                                  echo '<tr>';
                                         $widthStyle = ' STYLE=\'width: "'.(6*$this->fdd[$fd]['width']).'px"\'';                                  echo '<td colspan='.$sys_cols.' align="center">';
                                 }                                  echo '<input type="submit" name="filter" value="'
                                 $opened = false;                                          .$this->labels['Query'].'"></td>'."\n";
                                 if ($this->displayed[$k]) {  
                                         echo '<td'.$widthStyle.'>';                                  for ($k = 0; $k < $this->num_fds; $k++) {
                                         $opened = true;                                          $this->field_name = $this->fds[$k];
                                 }                                          $fd               = $this->field_name;
                                 $type = $this->fdd[$fd]['type'];                                          $this->field      = $this->fdd[$fd];
                                 if ($this->col_has_values($k)) {                                          $l  = 'qf'.$k;
                                         $type = 'string';                                          $lc = 'qf'.$k.'_comp';
                                 }                                          $li = 'qf'.$k.'_id';
                                 /* if ( stristr($this->fdd[$fd]['options'],'L') or                                          $m  = $this->get_cgi_var($l,  '');
                                         !isset ($this->fdd[$fd]['options'])) */                                          $mc = $this->get_cgi_var($lc, '');
                                 if (! $this->displayed[$k]) {                                          $mi = $this->get_cgi_var($li, '');
                                         continue;  
                                 }                                          $widthStyle = '';
                                 if ($this->fdd[$fd]['select'] == 'D' or $this->fdd[$fd]['select'] == 'M') {                                          if (isset($this->fdd[$fd]['width'])) {
                                         /*                                                  $widthStyle = ' STYLE=\'width: "'.(6*$this->fdd[$fd]['width']).'px"\'';
                                          * Multiple fields processing                                          }
                                          * Default size is 2 and array required for values.                                          $opened = false;
                                          */                                          if ($this->displayed[$k]) {
                                         $multiple = $this->fdd[$fd]['select'] == 'M';                                                  echo '<td'.$widthStyle.'>';
                                         $selected = $mi;                                                  $opened = true;
                                         $x = isset($this->fdd[$k]['values']['table']) || !$this->col_has_values($k)                                          }
                                                 ? $this->set_values_from_table($k, array('*' => '*'))                                          $type = $this->fdd[$fd]['type'];
                                                 : array('*' => '*') + (array) $this->fdd[$k]['values2'] + (array) $this->fdd[$k]['values'];                                          if ($this->col_has_values($k)) {
                                         echo $this->htmlSelect($l.'_id', $x, $selected, $multiple);                                                  $type = 'string';
                                 } elseif ($this->fdd[$fd]['select'] == 'T') {                                          }
                                         // this is where we put the comparison selects                                          /* if ( stristr($this->fdd[$fd]['options'],'L') or
                                         if (! $this->password($k) && ! $this->hidden($k)) {                                             !isset ($this->fdd[$fd]['options'])) */
                                                 $size_ml_props = '';                                          if (! $this->displayed[$k]) {
                                                 if ($type != 'blob') {                                                  continue;
                                                         $maxlen = intval($this->fdd[$k]['maxlen']);                                          }
                                                         $maxlen > 0 || $maxlen = intval(@mysql_field_len($res, $fields["qf$k"]));                                          if ($this->fdd[$fd]['select'] == 'D' or $this->fdd[$fd]['select'] == 'M') {
                                                         $size   = $maxlen < 30 ? min($maxlen, 8) : 12;                                                  // Multiple fields processing
                                                         $size   && $size_ml_props .= ' size="'.$size.'"';                                                  // Default size is 2 and array required for values.
                                                         $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';                                                  $multiple = $this->fdd[$fd]['select'] == 'M';
                                                         if (0) {                                                  $selected = $mi;
                                                                 echo $this->fdd[$fd]['name'],'|qf',$k,'|';                                                  $x = isset($this->fdd[$k]['values']['table']) || !$this->col_has_values($k)
                                                                 echo mysql_field_len($res, $fields["qf$k"]);                                                          ? $this->set_values_from_table($k, array('*' => '*'))
                                                                 echo "|size=$size|maxlen=$maxlen<br>\n";                                                          : array('*' => '*') + (array) $this->fdd[$k]['values2'] + (array) $this->fdd[$k]['values'];
                                                   echo $this->htmlSelect($l.'_id', $x, $selected, $multiple);
                                           } elseif ($this->fdd[$fd]['select'] == 'T') {
                                                   // This is where we put the comparison selects
                                                   if (! $this->password($k) && ! $this->hidden($k)) {
                                                           $size_ml_props = '';
                                                           if ($type != 'blob') {
                                                                   $maxlen = intval($this->fdd[$k]['maxlen']);
                                                                   $maxlen > 0 || $maxlen = intval(@mysql_field_len($res, $fields["qf$k"]));
                                                                   $size   = $maxlen < 30 ? min($maxlen, 8) : 12;
                                                                   $size   && $size_ml_props .= ' size="'.$size.'"';
                                                                   $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';
                                                                   if (0) {
                                                                           echo $this->fdd[$fd]['name'],'|qf',$k,'|';
                                                                           echo mysql_field_len($res, $fields["qf$k"]);
                                                                           echo "|size=$size|maxlen=$maxlen<br>\n";
                                                                   }
                                                           }
                                                           if ($this->col_is_string($k)) {
                                                                   // it's treated as a string
                                                                   echo '<input type="text" name="qf'.$k.'"';
                                                                   echo ' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>';
                                                           } elseif ($this->col_is_date($k)) {
                                                                   // it's a date
                                                                   // it's treated as a string
                                                                   echo '<input type="text" name="qf'.$k.'"';
                                                                   echo ' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>';
                                                           } elseif ($this->col_is_number($k)) {
                                                                   // it's a number
                                                                   echo $this->htmlSelect($l.'_comp',$comp_ops,$mc);
                                                                   // it's treated as a string
                                                                   echo '<input type="text" name="qf'.$k.'"'
                                                                           .' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>';
                                                           } else {
                                                                   // type is 'unknown' or not set, it's treated as a string
                                                                   echo '<input type="text" name="qf'.$k.'"';
                                                                   echo ' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>';
                                                         }                                                          }
                                                 }  
                                                 if ($this->col_is_string($k)) {  
                                                         // it's treated as a string  
                                                         echo '<input type="text" name="qf'.$k.'"';  
                                                         echo ' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>';  
                                                 } elseif ($this->col_is_date($k)) {  
                                                         // it's a date  
                                                         // it's treated as a string  
                                                         echo '<input type="text" name="qf'.$k.'"';  
                                                         echo ' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>';  
                                                 } elseif ($this->col_is_number($k)) {  
                                                         // it's a number  
                                                         echo $this->htmlSelect($l.'_comp',$comp_ops,$mc);  
                                                         // it's treated as a string  
                                                         echo '<input type="text" name="qf'.$k.'"'  
                                                                 .' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>';  
                                                 } else {                                                  } else {
                                                         // type is 'unknown' or not set, it's treated as a string                                                          echo '&nbsp;';
                                                         echo '<input type="text" name="qf'.$k.'"';  
                                                         echo ' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>';  
                                                 }                                                  }
                                         } else {  
                                                 echo '&nbsp;';  
                                         }  
   
                                         // if it's int or real and if not password or hidden, display aggr options                                                  // if it's int or real and if not password or hidden, display aggr options
                                         /* XXX Disabled until we have time to work on this                                                  /* XXX Disabled until we have time to work on this
   
                                            if ((! $this->password($k) && ! $this->hidden($k))                                                     if ((! $this->password($k) && ! $this->hidden($k))
                                            && (($this->col_is_number($k)) && (! isset($this->fdd[$k]['values'])))) {                                                     && (($this->col_is_number($k)) && (! isset($this->fdd[$k]['values'])))) {
   
                                            $var_to_total = 'qf'.$k.'_aggr';                                                     $var_to_total = 'qf'.$k.'_aggr';
                                            global $$var_to_total;                                                     global $$var_to_total;
                                            $aggr_function = $$var_to_total;                                                     $aggr_function = $$var_to_total;
                                            if (isset($$var_to_total)) {                                                     if (isset($$var_to_total)) {
                                            $vars_to_total[] = $this->fqn($k);                                                     $vars_to_total[] = $this->fqn($k);
                                            $aggr_from_clause .=                                                     $aggr_from_clause .=
                                            ' '.$aggr_function.'('.                                                     ' '.$aggr_function.'('.
                                            $this->fqn($k).                                                     $this->fqn($k).
                                            ') as '.$var_to_total;                                                     ') as '.$var_to_total;
                                            }                                                     }
                                            echo '<br>Aggr: ';                                                     echo '<br>Aggr: ';
                                            echo $this->htmlSelect($var_to_total,$this->sql_aggrs,$$var_to_total);                                                     echo $this->htmlSelect($var_to_total,$this->sql_aggrs,$$var_to_total);
                                            if ($$var_to_total != '') {                                                     if ($$var_to_total != '') {
                                            $listall = true;                                                     $listall = true;
                                            }                                                     }
                                            } else {                                                     } else {
                                            echo '&nbsp;';                                                     echo '&nbsp;';
                                            }                                                     }
                                          */                                                   */
                                         echo '</td>'."\n";                                                  echo '</td>'."\n";
                                 } else {                                          } else {
                                         echo '<td>&nbsp;</td>'."\n";                                                  echo '<td>&nbsp;</td>'."\n";
                                 } // if elseif else                                          }
                         } // for                                  }
                         echo '</tr>'."\n";                                  echo '</tr>'."\n";
                 }                          }
                   } // }}}
   
   
                 /*                  /*
                  * Display sorting sequence                   * Display sorting sequence
                  */                   */
   
                 if ($qparts['orderby'] && $this->display['sort']) {                  if ($qparts['orderby'] && $this->display['sort']) {
                         $cgi_persist = $this->cgi['persist'];                          //$cgi_persist = $this->cgi['persist'];
                         $cgi_persist != '' && $cgi_persist[0] = '?';                          //$cgi_persist != '' && $cgi_persist[0] = '?';
                         echo '<tr><td colspan='.$sys_cols.' align="center">'                          echo '<tr><td colspan=',$sys_cols,' align="center">','<a class="pme_a_t" href="';
                                 .'<a class="pme_a_t" href="'.$this->get_server_var('PHP_SELF')                          echo htmlspecialchars($this->get_server_var('PHP_SELF').'?fl='.$this->fl.'&fm='.$this->fm
                                 .$cgi_persist.'">' .$this->labels['Clear'].'</a></td>';                                          .$this->qfn.$this->cgi['persist']);
                         echo '<td colspan="'.$this->num_fields_displayed.'">'                          echo '">',$this->labels['Clear'],'</a></td>',"\n";
                                 .$this->labels['Sorted By'].': <i>'                          echo '<td colspan="'.$this->num_fields_displayed.'">',$this->labels['Sorted By'],': <i>';
                                 .join(', ', $sort_fields_w).'</i></td></tr>'."\n";                          echo join(', ', $sort_fields_w),'</i></td></tr>',"\n";
                 }                  }
   
                 /*                  /*
Line 1923  function phpMyEdit_form_control(theForm)
Line 1882  function phpMyEdit_form_control(theForm)
   
                 $text_query = $this->make_where_from_query_opts(null, true);                  $text_query = $this->make_where_from_query_opts(null, true);
                 if ($text_query != '' && $this->display['query']) {                  if ($text_query != '' && $this->display['query']) {
                         echo '<tr><td colspan='.$sys_cols.' align="center">'                          echo '<tr><td colspan=',$sys_cols,' align="center">','<a class="pme_a_t" href="';
                                 .'<a class="pme_a_t" href="'.$this->get_server_var('PHP_SELF')                          echo htmlspecialchars($this->get_server_var('PHP_SELF').'?fl='.$this->fl.'&fm='.$this->fm
                                 .'?'.$this->get_sfn_cgi_vars().'&fl='.$this->fl.'&fm='.$this->fm                                          .'&'.$this->get_sfn_cgi_vars().$this->cgi['persist']);
                                 .$this->cgi['persist'].'">'.$this->labels['Clear'].'</a></td>';                          echo '">',$this->labels['Clear'],'</a></td>',"\n";
                         echo '<td colspan="'.$this->num_fields_displayed.'">'                          echo '<td colspan="',$this->num_fields_displayed.'">',$this->labels['Current Query'],': <i>';
                                 .$this->labels['Current Query'].': <i>'                          echo htmlspecialchars($text_query),'</i></td></tr>',"\n";
                                 .htmlspecialchars($text_query).'</i></td></tr>'."\n";  
                 }                  }
   
                 if ($this->nav_text_links() || $this->nav_graphic_links()) {                  if ($this->nav_text_links() || $this->nav_graphic_links()) {
                         // gather query & GET options to preserve for Update/Delete links  
                         $qstrparts = array();                          $qstrparts = array();
                         if (count($this->qo) > 0) {                          strlen($this->fl)             > 0 && $qstrparts[] = 'fl='.$this->fl;
                                 foreach ($this->qo as $key=>$val) {                          strlen($this->fm)             > 0 && $qstrparts[] = 'fm='.$this->fm;
                                         if ($key != '' && $key != 'operation' && ! is_array($val))                          count($this->sfn)             > 0 && $qstrparts[] = $this->get_sfn_cgi_vars();
                                                 $qstrparts[] = "$key=$val";                          strlen($this->cgi['persist']) > 0 && $qstrparts[] = $this->cgi['persist'];
                                 }  
                         }  
                         if (count($this->get_opts) > 0) {  
                                 foreach ($this->get_opts as $key=>$val) {  
                                         if ($key != '' && $key != 'operation' && ! is_array($val))  
                                                 $qstrparts[] = "$key=$val";  
                                 }  
                         }  
   
                         // preserve sort field number, filter row, and first record to display  
                         isset($this->sfn) && $qstrparts[] = $this->get_sfn_cgi_vars();  
                         isset($this->fl)  && $qstrparts[] = 'fl='.$this->fl;  
                         isset($this->fm)  && $qstrparts[] = 'fm='.$this->fm;  
   
                         // do we need to preserve filter (filter query) and sw (filter display/hide button)?  
   
                         $qpview      = $qstrparts;                          $qpview      = $qstrparts;
                         $qpview[]    = 'operation='.$this->labels['View'];  
                         $qpviewStr   = '?'.join('&',$qpview).$this->qfn;  
                         $qpcopy      = $qstrparts;                          $qpcopy      = $qstrparts;
                         $qpcopy[]    = 'operation='.$this->labels['Copy'];  
                         $qpcopyStr   = '?'.join('&',$qpcopy).$this->qfn;  
                         $qpchange    = $qstrparts;                          $qpchange    = $qstrparts;
                         $qpchange[]  = 'operation='.$this->labels['Change'];  
                         $qpchangeStr = '?'.join('&',$qpchange).$this->qfn;  
                         $qpdelete    = $qstrparts;                          $qpdelete    = $qstrparts;
                           $qpview[]    = 'operation='.$this->labels['View'];
                           $qpcopy[]    = 'operation='.$this->labels['Copy'];
                           $qpchange[]  = 'operation='.$this->labels['Change'];
                         $qpdelete[]  = 'operation='.$this->labels['Delete'];                          $qpdelete[]  = 'operation='.$this->labels['Delete'];
                           $qpviewStr   = '?'.join('&',$qpview).$this->qfn;
                           $qpcopyStr   = '?'.join('&',$qpcopy).$this->qfn;
                           $qpchangeStr = '?'.join('&',$qpchange).$this->qfn;
                         $qpdeleteStr = '?'.join('&',$qpdelete).$this->qfn;                          $qpdeleteStr = '?'.join('&',$qpdelete).$this->qfn;
                 }                  }
   
Line 1980  function phpMyEdit_form_control(theForm)
Line 1921  function phpMyEdit_form_control(theForm)
                         echo '<tr class="'.(($rowCount++%2)?'pme_tr_o':'pme_tr_e')."\">\n";                          echo '<tr class="'.(($rowCount++%2)?'pme_tr_o':'pme_tr_e')."\">\n";
                         if ($sys_cols) {                          if ($sys_cols) {
                                 $key_rec    = $row['qf'.$this->key_num];                                  $key_rec    = $row['qf'.$this->key_num];
                                 $qviewStr   = $qpviewStr  .'&rec='.$key_rec.$this->cgi['persist'];                                  $qviewStr   = $qpviewStr   . '&rec='.$key_rec;
                                 $qcopyStr   = $qpcopyStr  .'&rec='.$key_rec.$this->cgi['persist'];                                  $qcopyStr   = $qpcopyStr   . '&rec='.$key_rec;
                                 $qchangeStr = $qpchangeStr.'&rec='.$key_rec.$this->cgi['persist'];                                  $qchangeStr = $qpchangeStr . '&rec='.$key_rec;
                                 $qdeleteStr = $qpdeleteStr.'&rec='.$key_rec.$this->cgi['persist'];                                  $qdeleteStr = $qpdeleteStr . '&rec='.$key_rec;
                                 if ($select_recs) {                                  if ($select_recs) {
                                         if (! $this->nav_buttons() || $sys_cols > 1) {                                          if (! $this->nav_buttons() || $sys_cols > 1) {
                                                 echo '<td style="white-space:nowrap;text-align:center;" width="1%">';                                                  echo '<td style="white-space:nowrap;text-align:center;" width="1%">';
Line 3055  function phpMyEdit_form_control(theForm)
Line 2996  function phpMyEdit_form_control(theForm)
                 }                  }
   
                 $this->gather_query_opts();                  $this->gather_query_opts();
                 $this->gather_get_vars();  
                 $this->gather_post_vars();  
                 $this->unify_opts();  
   
                 // Call to Action                  // Call to Action
                 // Moved this from the setup.php generated file to here                  // Moved this from the setup.php generated file to here

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.50

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top