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.5 and 1.6

version 1.5, 2002/08/08 21:36:33 version 1.6, 2002/08/09 23:18:48
Line 117  class phpMyEdit {
Line 117  class phpMyEdit {
         var $fm;        // first record to display          var $fm;        // first record to display
         var $fl;        // is the filter row displayed (boolean)          var $fl;        // is the filter row displayed (boolean)
   
         var $options;   // Options for users: A(dd) C(hange) D(elete) F(ilter) U(nsorted)          var $options;   // Options for users: A(dd) C(hange) D(elete) F(ilter) V(iew) co(P)y U(nsorted)
         var $fdd;       // field definitions          var $fdd;       // field definitions
         var $qfn;       // value of all filters used during the last pass          var $qfn;       // value of all filters used during the last pass
         var $sfn;       // sort field number (- = descending sort order)          var $sfn;       // sort field number (- = descending sort order)
Line 228  class phpMyEdit {
Line 228  class phpMyEdit {
                 $qparts['type']   = 'select';                  $qparts['type']   = 'select';
                 $qparts['select'] = 'DISTINCT '.$key;                  $qparts['select'] = 'DISTINCT '.$key;
                 if ($desc) {                  if ($desc) {
                         $qparts['select'] .= ','.$desc;                          //- $qparts['select'] .= ','.$desc;
                         $qparts['orderby'] = $desc;                          //- $qparts['orderby'] = $desc;
                           //      Changes 08/08/02 Shaun Johnston
                           if (is_array($desc)) {
                                   $qparts['select'] .= ',CONCAT('; // )
                                   $num_cols = sizeof($desc['columns']);
                                   for ($i = 0; $i <= $num_cols; $i++) {
                                           $qparts['select'] .= $desc['columns'][$i];
                                           if ($desc['divs'][$i]) {
                                                   $qparts['select'] .= ',"'.$desc['divs'][$i].'"';
                                           }
                                           if ($i < ($num_cols - 1)) {
                                                   $qparts['select'] .= ',';
                                           }
                                   }
                                   $qparts['select'] .= ') AS select_alias_'.$field_num;
                                   $qparts['orderby'] = $desc['orderby'];
                           } else {
                                   $qparts['select'] .= ','.$desc;
                                   $qparts['orderby'] = $desc;
                           }
                 } else {                  } else {
                         $qparts['orderby'] = $key;                          $qparts['orderby'] = $key;
                 }                  }
Line 270  class phpMyEdit {
Line 289  class phpMyEdit {
                         if (isset($this->fdd[$field]['expression'])) {                          if (isset($this->fdd[$field]['expression'])) {
                                 $ret = $this->fdd[$field]['expression'];                                  $ret = $this->fdd[$field]['expression'];
                         } elseif ($this->fdd[$this->fds[$field]]['values']['description']) {                          } elseif ($this->fdd[$this->fds[$field]]['values']['description']) {
                                 $ret = 'JoinTable'.$field.'.'.$this->fdd[$this->fds[$field]]['values']['description'];                                  //      Changed 06/08/02 Shaun Johnston
                                   $desc = $this->fdd[$this->fds[$field]]['values']['description'];
                                   if (is_array($desc)) {
                                           $ret = 'CONCAT('; // )
                                           $num_cols = sizeof($desc['columns']);
                                           for ($i = 0; $i < $num_cols; $i++) {
                                                   $ret .= 'JoinTable'.$field.'.'.$desc['columns'][$i];
                                                   if ($desc['divs'][$i]) {
                                                           $ret .= ',"'.$desc['divs'][$i].'"';
                                                   }
                                                   if ($i < ($num_cols - 1)) {
                                                           $ret .= ',';
                                                   }
                                           }
                                           $ret .= ')';
                                   } else {
                                           $ret = 'JoinTable'.$field.'.'.$this->fdd[$this->fds[$field]]['values']['description'];
                                   }
                         } elseif ($this->fdd[$this->fds[$field]]['values']['column']) {                          } elseif ($this->fdd[$this->fds[$field]]['values']['column']) {
                                 $ret = 'JoinTable'.$field.'.'.$this->fdd[$this->fds[$field]]['values']['column'];                                  $ret = 'JoinTable'.$field.'.'.$this->fdd[$this->fds[$field]]['values']['column'];
                         } else {                          } else {
Line 608  class phpMyEdit {
Line 644  class phpMyEdit {
                         and $this->add_enabled();                          and $this->add_enabled();
         }          }
   
         function display_operation() {  #       function display_operation() {
                 return ($this->operation  == $this->labels['Delete']  #               return ($this->operation  == $this->labels['Delete']
                                 /* or $this->savedelete == $this->labels['Save'] */)  #                               /* or $this->savedelete == $this->labels['Save'] */)
                         and $this->delete_enabled();  #                       and $this->delete_enabled();
         }  #       }
   
         function change_operation() {          function change_operation() {
                 return ($this->operation  == $this->labels['Change']                  return ($this->operation  == $this->labels['Change']
Line 633  class phpMyEdit {
Line 669  class phpMyEdit {
         }          }
   
         function view_operation() {          function view_operation() {
                 return $this->operation  == $this->labels['Display'];                  return $this->operation  == $this->labels['Display']
                           and $this->view_enabled();
         }          }
   
         function filter_operation() {          function filter_operation() {
Line 651  class phpMyEdit {
Line 688  class phpMyEdit {
                         ( ! $this->hidden($k) && (                          ( ! $this->hidden($k) && (
                         ( $this->add_operation()     and stristr($this->fdd[$k]['options'],'A')) ||                          ( $this->add_operation()     and stristr($this->fdd[$k]['options'],'A')) ||
                         ( $this->more_operation()    and stristr($this->fdd[$k]['options'],'A')) ||                          ( $this->more_operation()    and stristr($this->fdd[$k]['options'],'A')) ||
                         ( $this->display_operation() and stristr($this->fdd[$k]['options'],'V')) ||                          ( $this->view_operation()    and stristr($this->fdd[$k]['options'],'V')) ||
                         ( $this->change_operation()  and stristr($this->fdd[$k]['options'],'C')) ||                          ( $this->change_operation()  and stristr($this->fdd[$k]['options'],'C')) ||
                         ( $this->delete_operation()  and stristr($this->fdd[$k]['options'],'D')) ||                          ( $this->delete_operation()  and stristr($this->fdd[$k]['options'],'D')) ||
                         ( $this->filter_operation()  and stristr($this->fdd[$k]['options'],'F')) ||                          ( $this->filter_operation()  and stristr($this->fdd[$k]['options'],'F')) ||
                         ( stristr($this->fdd[$k]['options'],'L') and                          ( stristr($this->fdd[$k]['options'],'L') and
                          ! $this->add_operation() &&                           ! $this->add_operation() &&
                          ! $this->more_operation() &&                           ! $this->more_operation() &&
                          ! $this->display_operation() &&                           ! $this->view_operation() &&
                          ! $this->change_operation() &&                           ! $this->change_operation() &&
                          ! $this->delete_operation() &&                           ! $this->delete_operation() &&
                          ! $this->filter_operation())                           ! $this->filter_operation())
Line 748  return true;
Line 785  return true;
                                 if (isset ($this->fdd[$k]['values'])) {                                  if (isset ($this->fdd[$k]['values'])) {
                                         echo '    <td>' ."\n";                                          echo '    <td>' ."\n";
                                         if (isset($this->fdd[$k]['values']['table'])) {                                          if (isset($this->fdd[$k]['values']['table'])) {
                                                 $vals = array_merge(array(''=>''),$this->set_values_from_table($k));                                                  $vals = array(''=>'') + $this->set_values_from_table($k);
                                         } else {                                          } else {
                                                 $vals = array_merge(array(''=>''),$this->fdd[$k]['values']);                                                  $vals = array(''=>'') + $this->fdd[$k]['values'];
                                         }                                          }
                                         echo $this->htmlSelect($this->fds[$k],$vals,'');                                          echo $this->htmlSelect($this->fds[$k],$vals,'');
                                         echo '    </td>'."\n";                                          echo '    </td>'."\n";
Line 1423  return true;
Line 1460  return true;
                         isset($this->default_sort_columns)                          isset($this->default_sort_columns)
                 ) {                  ) {
                         $raw_sort_fields = array();                          $raw_sort_fields = array();
                         $sort_fields = array();                          $sort_fields     = array();
                         $sort_fields_w = array();                          $sort_fields_w   = array();
                         //if ($this->sfn != '')                          //if ($this->sfn != '')
                         if (is_numeric($this->sfn)) {                          if (is_numeric($this->sfn)) {
                                 if (isset($this->fdd[$this->sfn]['expression'])) {                                  if (isset($this->fdd[$this->sfn]['expression'])) {
                                         $raw_sort_field = 'qf'.$this->sfn;                                          $raw_sort_field = 'qf'.$this->sfn;
                                         $sort_field = 'qf'.$this->sfn;                                          $sort_field     = 'qf'.$this->sfn;
                                         $sort_field_w = $this->sfn.'(expression)';                                          $sort_field_w   = $this->sfn.'(expression)';
                                 } else {                                  } else {
                                         $raw_sort_field = $this->fqn($this->sfn);                                          $raw_sort_field = $this->fqn($this->sfn);
                                         $sort_field = $this->fqn($this->sfn);                                          $sort_field     = $this->fqn($this->sfn);
                                         $sort_field_w = $this->fdd[$this->sfn]['name'];                                          $sort_field_w   = $this->fdd[$this->sfn]['name'];
                                 }                                  }
                                 if ( ! $this->sort_asc) {                                  if ( ! $this->sort_asc) {
                                         $sort_field .= ' DESC';                                          $sort_field .= ' DESC';
Line 1500  return true;
Line 1537  return true;
                         echo '      <td align="center"><input type="submit" name="filter" value="Go!" /></td>'."\n";                          echo '      <td align="center"><input type="submit" name="filter" value="Go!" /></td>'."\n";
                         for ($k = 0; $k < $this->num_fds; $k++) {                          for ($k = 0; $k < $this->num_fds; $k++) {
                                 $this->field_name = $this->fds[$k];                                  $this->field_name = $this->fds[$k];
                                 $fd = $this->field_name;                                  $fd               = $this->field_name;
                                 $this->field = $this->fdd[$fd];                                  $this->field      = $this->fdd[$fd];
                                 $l = 'qf'.$k;                                  $l   = 'qf'.$k;
                                 global $$l;                                  $lc  = 'qf'.$k.'_comp';
                                 $lc = 'qf'.$k.'_comp';                                  $$l  = $this->get_cgi_var($l);
                                 global $$lc;                                  $$lc = $this->get_cgi_var($lc);
                                 $mc = $this->web2plain($$lc);                                  $m   = $this->web2plain($$l);  // get the field name and value
                                 $m = $this->web2plain($$l);                                  $mc  = $this->web2plain($$lc); // get the comparison operator for numeric/date types
   
                                 $widthStyle = '';                                  $widthStyle = '';
                                 if (isset($this->fdd[$fd]['width']));                                  if (isset($this->fdd[$fd]['width']));
Line 1535  return true;
Line 1572  return true;
                                         $this->displayed($k)                                          $this->displayed($k)
                                 ) {                                  ) {
                                         if ($this->fdd[$fd]['select'] == 'D' or $this->fdd[$fd]['select'] == 'M') {                                          if ($this->fdd[$fd]['select'] == 'D' or $this->fdd[$fd]['select'] == 'M') {
 /*                                                  /*
                                                 Multiple fields processing - default size is 2 and array required for values                                                   * Multiple fields processing - default size is 2 and array required for values
 */                                                   */
                                                 $selected = '';                                                  $selected = '';
                                                 if ($m != '')                                                  if ($m != '') {
                                                         $selected = $m;                                                          $selected = $m;
                                                 if ($this->fdd[$k]['values']['table'])                                                  }
                                                         $x = $this->set_values_from_table($k,array('*'=>'*'));                                                  if ($this->fdd[$k]['values']['table']) {
                                                 elseif ($this->fdd[$k]['values'])                                                          $x = $this->set_values_from_table($k, array('*' => '*'));
                                                         $x = array_merge(array('*'=>'*'),$this->fdd[$k]['values']);                                                  } elseif ($this->fdd[$k]['values']) {
                                                           $x = array('*' => '*') + $this->fdd[$k]['values'];
                                                   }
                                                 echo $this->htmlSelect($l,$x,$selected,$multiple='');                                                  echo $this->htmlSelect($l,$x,$selected,$multiple='');
                                         } elseif ($this->fdd[$fd]['select'] == 'T') {                                          } elseif ($this->fdd[$fd]['select'] == 'T') {
                                                 // this is where we put the comparison selects                                                  // this is where we put the comparison selects
Line 1909  return true;
Line 1948  return true;
                                 $qp['from'] = $this->create_join_clause ();                                  $qp['from'] = $this->create_join_clause ();
                                 $qp['where'] = $this->make_where_from_query_opts();                                  $qp['where'] = $this->make_where_from_query_opts();
                                 $tot_query = $this->query_make($qp);                                  $tot_query = $this->query_make($qp);
 //$this->elog('TOT_QRY: '.$tot_query,__LINE__);                                  //$this->elog('TOT_QRY: '.$tot_query,__LINE__);
                                 $totals_result = $this->myquery($tot_query,__LINE__);                                  $totals_result = $this->myquery($tot_query,__LINE__);
                                 $tot_row=mysql_fetch_array($totals_result);                                  $tot_row=mysql_fetch_array($totals_result);
                         //}                          //}
Line 1927  return true;
Line 1966  return true;
                                 $fd = $this->fds[$k];                                  $fd = $this->fds[$k];
                                 if (stristr($this->fdd[$fd]['options'],'L') or !isset($this->fdd[$fd]['options'])) {                                  if (stristr($this->fdd[$fd]['options'],'L') or !isset($this->fdd[$fd]['options'])) {
                                         echo '<td>';                                          echo '<td>';
                                         $aggr_var = 'qf'.$k.'_aggr';                                          $aggr_var  = 'qf'.$k.'_aggr';
                                         global $$aggr_var;                                          $$aggr_var = $this->get_cgi_var($aggr_var);
                                         if ($$aggr_var) {                                          if ($$aggr_var) {
                                                 echo $this->sql_aggrs[$$aggr_var].': '.$tot_row[$aggr_var];                                                  echo $this->sql_aggrs[$$aggr_var].': '.$tot_row[$aggr_var];
                                         } else {                                          } else {
Line 2034  return true;
Line 2073  return true;
                 echo '  <input type="hidden" name="fm" value="'.$this->fm.'" />'."\n";                  echo '  <input type="hidden" name="fm" value="'.$this->fm.'" />'."\n";
                 echo '  <input type="hidden" name="sfn" value="'.$this->sfn.'" />'."\n";                  echo '  <input type="hidden" name="sfn" value="'.$this->sfn.'" />'."\n";
                 echo '  <input type="hidden" name="fl" value="'.$this->fl.'" />'."\n";                  echo '  <input type="hidden" name="fl" value="'.$this->fl.'" />'."\n";
 /*  
                 preserve the values of any filter fields qf0..qfn for Pass 3                  /*
 */                   * preserve the values of any filter fields qf0..qfn for Pass 3
                    */
                 for ($k = 0; $k < $this->num_fds; $k++) {                  for ($k = 0; $k < $this->num_fds; $k++) {
                         $l = 'qf'.$k;                          $l    = 'qf'.$k;
                         global $$l;                          $lc   = 'qf'.$k.'_comp';
                         $lc = 'qf'.$k.'_comp';                          $$l   = $this->get_cgi_var($l);
                         global $$lc;                          $$lc  = $this->get_cgi_var($lc);
                         $m = $this->web2plain($$l);                          $m    = $this->web2plain($$l);  // get the field name and value
                         $mc = $this->web2plain($$lc);                          $mc   = $this->web2plain($$lc); // get the comparison operator for numeric/date types
                         if (isset ($m)) {                          if (isset ($m)) {
                                 if (is_array($m)) // multiple selection has been used                                  if (is_array($m)) { // multiple selection has been used
                                 {  
                                         if (!in_array('*',$m)) {        // one '*' in a multiple selection is all you need                                          if (!in_array('*',$m)) {        // one '*' in a multiple selection is all you need
                                                 for ($n=0; $n<count($m); $n++) {                                                  for ($n=0; $n<count($m); $n++) {
                                                         if ($this->plain2web($m[$n]) != '') {                                                          if ($this->plain2web($m[$n]) != '') {
                                                                 echo '  <input type="hidden" name="qf'.$k.'['.$n.']" value="'.$this->plain2web($m[$n]).'">'."\n";                                                                  echo '  <input type="hidden" name="qf'.$k.'['.$n.']" value="'
                                                                           .$this->plain2web($m[$n]).'">'."\n";
                                                         }                                                          }
                                                 }                                                  }
                                         }                                          }
Line 2342  echo '<h5>'.mysql_affected_rows ().' '.$
Line 2382  echo '<h5>'.mysql_affected_rows ().' '.$
   
         function do_delete_record() /* {{{ */          function do_delete_record() /* {{{ */
         {          {
                 global $REMOTE_USER, $REMOTE_ADDR;                  global $HTTP_SERVER_VARS;
                 $tdb = true;                  $REMOTE_USER = $HTTP_SERVER_VARS['REMOTE_USER'];
                   $REMOTE_ADDR = $HTTP_SERVER_VARS['REMOTE_ADDR'];
                   $tdb         = true;
                 // check for a before-add trigger                  // check for a before-add trigger
                 if (isset($this->triggers['delete']['before'])) {                  if (isset($this->triggers['delete']['before'])) {
                         $tdb = include($this->triggers['delete']['before']);                          $tdb = include($this->triggers['delete']['before']);
Line 2492  echo '<h5>'.mysql_affected_rows ().' '.$
Line 2534  echo '<h5>'.mysql_affected_rows ().' '.$
                  */                   */
                 if ( ($this->add_operation() or $this->more_operation() or                  if ( ($this->add_operation() or $this->more_operation() or
                         $this->change_operation() or $this->delete_operation() or                          $this->change_operation() or $this->delete_operation() or
                         $this->display_operation() or $this->view_operation() or                          $this->view_operation() or $this->copy_operation())
                         $this->copy_operation())  
                 and ($listit) ) {                  and ($listit) ) {
                         $this->display_record();                          $this->display_record();
                 }                  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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