Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, March 29, 2024

Diff for phpMyEdit/phpMyEdit.class.php between version 1.77 and 1.78

version 1.77, 2003/04/26 22:13:31 version 1.78, 2003/04/28 22:18:36
Line 19 
Line 19 
  * http://www.platon.sk/projects/phpMyEdit/   * http://www.platon.sk/projects/phpMyEdit/
  */   */
   
 /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.76 2003/04/20 21:39:16 nepto Exp $ */  /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.77 2003/04/26 22:13:31 nepto Exp $ */
   
 /*  This is a generic table editing program. The table and fields to be  /*  This is a generic table editing program. The table and fields to be
         edited are defined in the calling program.          edited are defined in the calling program.
Line 156  class phpMyEdit
Line 156  class phpMyEdit
         function col_has_values($k) { return isset($this->fdd[$k]['values']) || isset($this->fdd[$k]['values2']); }          function col_has_values($k) { return isset($this->fdd[$k]['values']) || isset($this->fdd[$k]['values2']); }
         function col_has_URL($k)    { return isset($this->fdd[$k]['URL'])          function col_has_URL($k)    { return isset($this->fdd[$k]['URL'])
                 || isset($this->fdd[$k]['URLprefix']) || isset($this->fdd[$k]['URLpostfix']); }                  || isset($this->fdd[$k]['URLprefix']) || isset($this->fdd[$k]['URLpostfix']); }
           function col_has_multiple_select($k)
           { return $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table']; }
   
         /*          /*
          * functions for indicating whether navigation style is enabled           * functions for indicating whether navigation style is enabled
Line 532  class phpMyEdit
Line 534  class phpMyEdit
                                 }                                  }
                                 $where[] = '('.join(' OR ', $tmp_where).')';                                  $where[] = '('.join(' OR ', $tmp_where).')';
                         } else {                          } else {
                                 $where[] = sprintf('%s %s %s', $field, $ov['oper'], $ov['value']);                                  if (is_array($ov['value'])) {
                                           $tmp_ov_val = '';
                                           foreach ($ov['value'] as $ov_val) {
                                                   strlen($tmp_ov_val) > 0 && $tmp_ov_val .= ' OR ';
                                                   $tmp_ov_val .= sprintf('FIND_IN_SET("%s",%s)', $ov_val, $field);
                                           }
                                           $where[] = "($tmp_ov_val)";
                                   } else {
                                           $where[] = sprintf('%s %s %s', $field, $ov['oper'], $ov['value']);
                                   }
                         }                          }
                 }                  }
                 // Add any coder specified filters                  // Add any coder specified filters
Line 577  class phpMyEdit
Line 588  class phpMyEdit
                                 if (in_array('*', $m)) {                                  if (in_array('*', $m)) {
                                         continue;                                          continue;
                                 }                                  }
                                 $qf_op = '';                                  if ($this->col_has_values($k) && $this->col_has_multiple_select($k)) {
                                 foreach (array_keys($m) as $key) {                                          foreach (array_keys($m) as $key) {
                                         if ($qf_op == '') {                                                  $m[$key] = addslashes($m[$key]);
                                                 $qf_op   = 'IN';                                          }
                                                 $qf_val  = '"'.addslashes($m[$key]).'"';                                          $qo[$this->fqn($k)] = array('value' => $m);
                                                 $afilter = ' IN ("'.addslashes($m[$key]).'"'; // )                                  } else {
                                         } else {                                          $qf_op = '';
                                                 $afilter = $afilter.',"'.addslashes($m[$key]).'"';                                          foreach (array_keys($m) as $key) {
                                                 $qf_val .= ',"'.addslashes($m[$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]).'"';
                                                   }
                                                   $this->qfn .= '&'.$l.'['.rawurlencode($key).']='.rawurlencode($m[$key]);
                                         }                                          }
                                         $this->qfn .= '&'.$l.'['.rawurlencode($key).']='.rawurlencode($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)"); // )
                                 }                                  }
                                 $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 (isset($mi)) {                          } else if (isset($mi)) {
                                 if ($mi == '*') {                                  if ($mi == '*') {
                                         continue;                                          continue;
Line 693  function phpMyEdit_form_control(theForm)
Line 711  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->col_has_multiple_select($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 766  function phpMyEdit_form_control(theForm)
Line 783  function phpMyEdit_form_control(theForm)
                         if ($this->col_has_values($k)) {                          if ($this->col_has_values($k)) {
                                 $vals       = $this->set_values($k);                                  $vals       = $this->set_values($k);
                                 $selected   = @$this->fdd[$k]['default'];                                  $selected   = @$this->fdd[$k]['default'];
                                 $multiple   = $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table'];                                  $multiple   = $this->col_has_multiple_select($k);
                                 $readonly   = $this->readonly($k);                                  $readonly   = $this->readonly($k);
                                 $strip_tags = true;                                  $strip_tags = true;
                                 $escape     = true;                                  $escape     = true;
Line 887  function phpMyEdit_form_control(theForm)
Line 904  function phpMyEdit_form_control(theForm)
                 echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'">',"\n";                  echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'">',"\n";
                 if ($this->col_has_values($k)) {                  if ($this->col_has_values($k)) {
                         $vals       = $this->set_values($k);                          $vals       = $this->set_values($k);
                         $multiple   = $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table'];                          $multiple   = $this->col_has_multiple_select($k);
                         $readonly   = $this->readonly($k);                          $readonly   = $this->readonly($k);
                         $strip_tags = true;                          $strip_tags = true;
                         $escape     = true;                          $escape     = true;
Line 1720  function phpMyEdit_form_control(theForm)
Line 1737  function phpMyEdit_form_control(theForm)
                                         } else if ($this->fdd[$fd]['select'] == 'D' || $this->fdd[$fd]['select'] == 'M') {                                          } else if ($this->fdd[$fd]['select'] == 'D' || $this->fdd[$fd]['select'] == 'M') {
                                                 // Multiple fields processing                                                  // Multiple fields processing
                                                 // Default size is 2 and array required for values.                                                  // Default size is 2 and array required for values.
                                                 $vals       = $this->set_values($k, array('*' => '*'), null, true);                                                  $from_table = ! $this->col_has_values($k) || isset($this->fdd[$k]['values']['table']);
                                                   $vals       = $this->set_values($k, array('*' => '*'), null, $from_table);
                                                 $selected   = $mi;                                                  $selected   = $mi;
                                                 $multiple   = $this->fdd[$fd]['select'] == 'M';                                                  $multiple   = $this->col_has_multiple_select($k);
                                                   $multiple  |= $this->fdd[$fd]['select'] == 'M';
                                                 $readonly   = false;                                                  $readonly   = false;
                                                 $strip_tags = true;                                                  $strip_tags = true;
                                                 $escape     = true;                                                  $escape     = true;

Legend:
Removed from v.1.77  
changed lines
  Added in v.1.78

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