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

Diff for Metafox/lib/phpMyEdit/phpMyEdit.class.php between version 1.7 and 1.8

version 1.7, 2010/12/13 17:32:46 version 1.8, 2011/11/22 16:06:59
Line 19 
Line 19 
  * http://platon.sk/projects/phpMyEdit/   * http://platon.sk/projects/phpMyEdit/
  */   */
   
 /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.213 2010-09-20 01:08:46 nepto Exp $ */  /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.216 2011-01-09 19:02:27 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 120  class phpMyEdit
Line 120  class phpMyEdit
         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)
         var $cur_tab;   // current selected tab          var $cur_tab;   // current selected tab
           var $page_type; // current page type
   
         // Operation          // Operation
         var $navop;             // navigation buttons/operations          var $navop;             // navigation buttons/operations
Line 147  class phpMyEdit
Line 148  class phpMyEdit
         var $notify;            // change notification e-mail adresses          var $notify;            // change notification e-mail adresses
         var $logtable;          // name of optional logtable          var $logtable;          // name of optional logtable
         var $navigation;        // navigation style          var $navigation;        // navigation style
           var $buttons;
         var $tabs;                      // TAB names          var $tabs;                      // TAB names
         var $timer = null;      // phpMyEdit_timer object          var $timer = null;      // phpMyEdit_timer object
         var $sd; var $ed;       // sql start and end delimiters '`' in case of MySQL          var $sd; var $ed;       // sql start and end delimiters '`' in case of MySQL
Line 192  class phpMyEdit
Line 194  class phpMyEdit
         function col_has_multiple($k)          function col_has_multiple($k)
         { return $this->col_has_multiple_select($k) || $this->col_has_checkboxes($k); }          { return $this->col_has_multiple_select($k) || $this->col_has_checkboxes($k); }
         function col_has_multiple_select($k)          function col_has_multiple_select($k)
         { return $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table']; }          { return $this->fdd[$k]['select'] == 'M' && ! @$this->fdd[$k]['values']['table']; }
         function col_has_checkboxes($k)          function col_has_checkboxes($k)
         { return $this->fdd[$k]['select'] == 'C' && ! $this->fdd[$k]['values']['table']; }          { return $this->fdd[$k]['select'] == 'C' && ! @$this->fdd[$k]['values']['table']; }
         function col_has_radio_buttons($k)          function col_has_radio_buttons($k)
         { return $this->fdd[$k]['select'] == 'O' && ! $this->fdd[$k]['values']['table']; }          { return $this->fdd[$k]['select'] == 'O' && ! @$this->fdd[$k]['values']['table']; }
         function col_has_datemask($k)          function col_has_datemask($k)
         { return isset($this->fdd[$k]['datemask']) || isset($this->fdd[$k]['strftimemask']); }          { return isset($this->fdd[$k]['datemask']) || isset($this->fdd[$k]['strftimemask']); }
   
Line 214  class phpMyEdit
Line 216  class phpMyEdit
          * functions for indicating whether operations are enabled           * functions for indicating whether operations are enabled
          */           */
   
           function listall()        { return $this->inc <= 0; }
         function add_enabled()    { return stristr($this->options, 'A'); }          function add_enabled()    { return stristr($this->options, 'A'); }
         function change_enabled() { return stristr($this->options, 'C'); }          function change_enabled() { return stristr($this->options, 'C'); }
         function delete_enabled() { return stristr($this->options, 'D'); }          function delete_enabled() { return stristr($this->options, 'D'); }
Line 221  class phpMyEdit
Line 224  class phpMyEdit
         function view_enabled()   { return stristr($this->options, 'V'); }          function view_enabled()   { return stristr($this->options, 'V'); }
         function copy_enabled()   { return stristr($this->options, 'P') && $this->add_enabled(); }          function copy_enabled()   { return stristr($this->options, 'P') && $this->add_enabled(); }
         function tabs_enabled()   { return $this->display['tabs'] && count($this->tabs) > 0; }          function tabs_enabled()   { return $this->display['tabs'] && count($this->tabs) > 0; }
         function hidden($k)       { return stristr($this->fdd[$k]['input'],'H'); }          function hidden($k)       { return stristr(@$this->fdd[$k]['input'],'H'); }
         function password($k)     { return stristr($this->fdd[$k]['input'],'W'); }          function password($k)     { return stristr(@$this->fdd[$k]['input'],'W'); }
         function readonly($k)     { return stristr($this->fdd[$k]['input'],'R') || $this->virtual($k);     }          function readonly($k)     { return stristr(@$this->fdd[$k]['input'],'R') || $this->virtual($k);     }
         function virtual($k)      { return stristr($this->fdd[$k]['input'],'V') && $this->col_has_sql($k); }          function virtual($k)      { return stristr(@$this->fdd[$k]['input'],'V') && $this->col_has_sql($k); }
   
         function add_operation()    { return $this->operation == $this->labels['Add']    && $this->add_enabled();    }          function add_operation()    { return $this->operation == $this->labels['Add']    && $this->add_enabled();    }
         function change_operation() { return $this->operation == $this->labels['Change'] && $this->change_enabled(); }          function change_operation() { return $this->operation == $this->labels['Change'] && $this->change_enabled(); }
Line 510  class phpMyEdit
Line 513  class phpMyEdit
                                 || $this->change_operation()) {                                  || $this->change_operation()) {
                                 $ret = $this->sd.'PMEtable0'.$this->ed.'.'.$this->sd.$this->fds[$field].$this->ed;                                  $ret = $this->sd.'PMEtable0'.$this->ed.'.'.$this->sd.$this->fds[$field].$this->ed;
                 } else {                  } else {
                         if ($this->fdd[$this->fds[$field]]['values']['description'] && ! $dont_desc) {                          if (isset($this->fdd[$this->fds[$field]]['values']['description']) && ! $dont_desc) {
                                 $desc = &$this->fdd[$this->fds[$field]]['values']['description'];                                  $desc = &$this->fdd[$this->fds[$field]]['values']['description'];
                                 if (is_array($desc) && is_array($desc['columns'])) {                                  if (is_array($desc) && is_array($desc['columns'])) {
                                         $ret      = 'CONCAT('; // )                                          $ret      = 'CONCAT('; // )
Line 533  class phpMyEdit
Line 536  class phpMyEdit
                                 } else {                                  } else {
                                         $ret = $this->sd.'PMEjoin'.$field.$this->ed.'.'.$this->sd.$this->fdd[$this->fds[$field]]['values']['description'].$this->ed;                                          $ret = $this->sd.'PMEjoin'.$field.$this->ed.'.'.$this->sd.$this->fdd[$this->fds[$field]]['values']['description'].$this->ed;
                                 }                                  }
                         // TODO: remove me  
                         } elseif (0 && $this->fdd[$this->fds[$field]]['values']['column'] && ! $dont_cols) {  
                                 $ret = $this->sd.'PMEjoin'.$field.$this->ed.'.'.$this->fdd[$this->fds[$field]]['values']['column'];  
                         } else {                          } else {
                                 $ret = $this->sd.'PMEtable0'.$this->ed.'.'.$this->sd.$this->fds[$field].$this->ed;                                  $ret = $this->sd.'PMEtable0'.$this->ed.'.'.$this->sd.$this->fds[$field].$this->ed;
                         }                          }
                         // TODO: not neccessary, remove me!  
                         if (is_array($this->fdd[$this->fds[$field]]['values2'])) {  
                         }  
                 }                  }
                 return $ret;                  return $ret;
         } /* }}} */          } /* }}} */
Line 554  class phpMyEdit
Line 551  class phpMyEdit
                 $qparts['type']   = 'select';                  $qparts['type']   = 'select';
                 $qparts['select'] = $this->get_SQL_column_list();                  $qparts['select'] = $this->get_SQL_column_list();
                 // Even if the key field isn't displayed, we still need its value                  // Even if the key field isn't displayed, we still need its value
                 if ($select_recs) {                  if (!in_array ($this->key, $this->fds)) {
                         if (!in_array ($this->key, $this->fds)) {                          $qparts['select'] .= ','.$this->fqn($this->key);
                                 $qparts['select'] .= ','.$this->fqn($this->key);  
                         }  
                 }                  }
                 $qparts['from']  = $this->get_SQL_join_clause();                  $qparts['from']  = @$this->get_SQL_join_clause();
                 $qparts['where'] = $this->get_SQL_where_from_query_opts();                  $qparts['where'] = $this->get_SQL_where_from_query_opts();
                 // build up the ORDER BY clause                  // build up the ORDER BY clause
                 if (isset($this->sfn)) {                  if (isset($this->sfn)) {
Line 589  class phpMyEdit
Line 584  class phpMyEdit
                                 $qparts['orderby'] = join(',', $sort_fields);                                  $qparts['orderby'] = join(',', $sort_fields);
                         }                          }
                 }                  }
                 $qparts['limit'] = $listall ? '' : $this->sql_limit($this->fm,$this->inc);                  $qparts['limit'] = $this->listall() ? '' : $this->sql_limit($this->fm,$this->inc);
                 $this->sort_fields_w = $sort_fields_w; // due to display sorting sequence                  $this->sort_fields_w = $sort_fields_w; // due to display sorting sequence
                 return $qparts;                  return $qparts;
         } /* }}} */          } /* }}} */
   
   
         function get_SQL_main_list_query($qparts) /* {{{ */          function get_SQL_main_list_query($qparts) /* {{{ */
         {          {
                 return $this->get_SQL_query($qparts);                  return $this->get_SQL_query($qparts);
         } /* }}} */          } /* }}} */
   
   
   
         function get_SQL_query($parts) /* {{{ */          function get_SQL_query($parts) /* {{{ */
         {          {
                 foreach ($parts as $k => $v) {                  foreach ($parts as $k => $v) {
                         $parts[$k] = trim($parts[$k]);                          $parts[$k] = trim($parts[$k]);
                 }                  }
                 switch ($parts['type']) {                  switch (strtoupper($parts['type'])) {
                         case 'select':                          case 'SELECT':
                                 $ret  = 'SELECT ';                                  $ret  = 'SELECT ';
                                 if ($parts['DISTINCT'])  
                                         $ret .= 'DISTINCT ';  
                                 $ret .= $parts['select'];                                  $ret .= $parts['select'];
                                 $ret .= ' FROM '.$parts['from'];                                  $ret .= ' FROM '.$parts['from'];
                                 if ($parts['where'] != '')                                  if (strlen(@$parts['where']) > 0) {
                                         $ret .= ' WHERE '.$parts['where'];                                          $ret .= ' WHERE '.$parts['where'];
                                 if ($parts['groupby'] != '')                                  }
                                   if (strlen(@$parts['groupby']) > 0) {
                                         $ret .= ' GROUP BY '.$parts['groupby'];                                          $ret .= ' GROUP BY '.$parts['groupby'];
                                 if ($parts['having'] != '')                                  }
                                   if (strlen(@$parts['having']) > 0) {
                                         $ret .= ' HAVING '.$parts['having'];                                          $ret .= ' HAVING '.$parts['having'];
                                 if ($parts['orderby'] != '')                                  }
                                   if (strlen(@$parts['orderby']) > 0) {
                                         $ret .= ' ORDER BY '.$parts['orderby'];                                          $ret .= ' ORDER BY '.$parts['orderby'];
                                 if ($parts['limit'] != '')                                  }
                                   if (strlen(@$parts['limit']) > 0) {
                                         $ret .= ' '.$parts['limit'];                                          $ret .= ' '.$parts['limit'];
                                 if ($parts['procedure'] != '')                                  }
                                   if (strlen(@$parts['procedure']) > 0) {
                                         $ret .= ' PROCEDURE '.$parts['procedure'];                                          $ret .= ' PROCEDURE '.$parts['procedure'];
                                   }
                                 break;                                  break;
                         case 'update':                          case 'UPDATE':
                                 $ret  = 'UPDATE '.$parts['table'];                                  $ret  = 'UPDATE '.$parts['table'];
                                 $ret .= ' SET '.$parts['fields'];                                  $ret .= ' SET '.$parts['fields'];
                                 if ($parts['where'] != '')                                  if ($parts['where'] != '')
                                         $ret .= ' WHERE '.$parts['where'];                                          $ret .= ' WHERE '.$parts['where'];
                                 break;                                  break;
                         case 'insert':                          case 'INSERT':
                                 $ret  = 'INSERT INTO '.$parts['table'];                                  $ret  = 'INSERT INTO '.$parts['table'];
                                 $ret .= ' VALUES '.$parts['values'];                                  $ret .= ' VALUES '.$parts['values'];
                                 break;                                  break;
                         case 'delete':                          case 'DELETE':
                                 $ret  = 'DELETE FROM '.$parts['table'];                                  $ret  = 'DELETE FROM '.$parts['table'];
                                 if ($parts['where'] != '')                                  if ($parts['where'] != '')
                                         $ret .= ' WHERE '.$parts['where'];                                          $ret .= ' WHERE '.$parts['where'];
Line 674  class phpMyEdit
Line 670  class phpMyEdit
                 $join_clause = $this->sd.$this->tb.$this->ed." AS $main_table";                  $join_clause = $this->sd.$this->tb.$this->ed." AS $main_table";
                 for ($k = 0, $numfds = sizeof($this->fds); $k < $numfds; $k++) {                  for ($k = 0, $numfds = sizeof($this->fds); $k < $numfds; $k++) {
                         $main_column = $this->fds[$k];                          $main_column = $this->fds[$k];
                         if($this->fdd[$main_column]['values']['db']) {                          if (isset($this->fdd[$main_column]['values']['db'])) {
                                 $dbp = $this->sd.$this->fdd[$main_column]['values']['db'].$this->ed.'.';                                  $dbp = $this->sd.$this->fdd[$main_column]['values']['db'].$this->ed.'.';
                         } else {                          } else {
                                 //$dbp = $this->dbp;                                  //$dbp = $this->dbp;
Line 914  function '.$this->js['prefix'].'show_tab
Line 910  function '.$this->js['prefix'].'show_tab
                         $first_required = true;                          $first_required = true;
                         for ($k = 0; $k < $this->num_fds; $k++) {                          for ($k = 0; $k < $this->num_fds; $k++) {
                                 if ($this->displayed[$k] && ! $this->readonly($k) && ! $this->hidden($k)                                  if ($this->displayed[$k] && ! $this->readonly($k) && ! $this->hidden($k)
                                                 && ($this->fdd[$k]['js']['required'] || isset($this->fdd[$k]['js']['regexp']))) {                                                  && (@$this->fdd[$k]['js']['required'] || isset($this->fdd[$k]['js']['regexp']))) {
                                         if ($first_required) {                                          if ($first_required) {
                                                 $first_required = false;                                                  $first_required = false;
                                                 echo '<script type="text/javascript"><!--',"\n";                                                  echo '<script type="text/javascript"><!--',"\n";
Line 1100  function '.$this->js['prefix'].'filter_h
Line 1096  function '.$this->js['prefix'].'filter_h
                                                         $strip_tags, $escape);                                                          $strip_tags, $escape);
                                 }                                  }
                         } elseif (isset ($this->fdd[$k]['textarea'])) {                          } elseif (isset ($this->fdd[$k]['textarea'])) {
                                 echo $this->htmlTextarea($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, $k, $this->fdd[$k]['default']);                                  echo $this->htmlTextarea($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, $k, $this->fdd[$k]['default'], $escape);
                         } elseif ($this->col_has_php($k)) {                          } elseif ($this->col_has_php($k)) {
                                 echo include($this->fdd[$k]['php']);                                  echo include($this->fdd[$k]['php']);
                         } else {                          } else {
Line 1140  function '.$this->js['prefix'].'filter_h
Line 1136  function '.$this->js['prefix'].'filter_h
                  */                   */
   
                 $qparts['type']   = 'select';                  $qparts['type']   = 'select';
                 $qparts['select'] = $this->get_SQL_column_list();                  $qparts['select'] = @$this->get_SQL_column_list();
                 $qparts['from']   = $this->get_SQL_join_clause();                  $qparts['from']   = @$this->get_SQL_join_clause();
                 $qparts['where']  = '('.$this->fqn($this->key).'='                  $qparts['where']  = '('.$this->fqn($this->key).'='
                         .$this->key_delim.$this->rec.$this->key_delim.')';                          .$this->key_delim.$this->rec.$this->key_delim.')';
   
Line 1232  function '.$this->js['prefix'].'filter_h
Line 1228  function '.$this->js['prefix'].'filter_h
                                                 $strip_tags, $escape);                                                  $strip_tags, $escape);
                         }                          }
                 } elseif (isset($this->fdd[$k]['textarea'])) {                  } elseif (isset($this->fdd[$k]['textarea'])) {
                         echo $this->htmlTextarea($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, $k, $row["qf$k"]);                          echo $this->htmlTextarea($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, $k, $row["qf$k"], $escape);
                 } elseif ($this->col_has_php($k)) {                  } elseif ($this->col_has_php($k)) {
                         echo include($this->fdd[$k]['php']);                          echo include($this->fdd[$k]['php']);
                 } else {                  } else {
Line 1248  function '.$this->js['prefix'].'filter_h
Line 1244  function '.$this->js['prefix'].'filter_h
                         echo '<input class="',$css_class_name,'" type="text"';                          echo '<input class="',$css_class_name,'" type="text"';
                         echo ($this->readonly($k) ? ' disabled' : '');                          echo ($this->readonly($k) ? ' disabled' : '');
                         echo ' name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="';                          echo ' name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="';
                         if($escape) echo htmlspecialchars($row["qf$k"]);                          if ($escape) echo htmlspecialchars($row["qf$k"]);
                         else echo $row["qf$k"];                          else echo $row["qf$k"];
                         echo '"',$len_props,' />',"\n";                          echo '"',$len_props,' />',"\n";
                 }                  }
Line 1460  function '.$this->js['prefix'].'filter_h
Line 1456  function '.$this->js['prefix'].'filter_h
                                 $value = number_format($value, $nbDec, $decPoint, $thSep);                                  $value = number_format($value, $nbDec, $decPoint, $thSep);
                         }                          }
                 }                  }
                 if (intval($this->fdd[$k]['trimlen']) > 0 && strlen($value) > $this->fdd[$k]['trimlen']) {                  if (intval(@$this->fdd[$k]['trimlen']) > 0 && strlen($value) > $this->fdd[$k]['trimlen']) {
                         $value = ereg_replace("[\r\n\t ]+",' ',$value);                          $value = ereg_replace("[\r\n\t ]+",' ',$value);
                         $value = substr($value, 0, $this->fdd[$k]['trimlen'] - 3).'...';                          $value = substr($value, 0, $this->fdd[$k]['trimlen'] - 3).'...';
                 }                  }
Line 1624  function '.$this->js['prefix'].'filter_h
Line 1620  function '.$this->js['prefix'].'filter_h
                 return $ret;                  return $ret;
         } /* }}} */          } /* }}} */
   
         function htmlTextarea($name, $css, $k, $value = null, $js = NULL)          function htmlTextarea($name, $css, $k, $value = null, $escape = true) /* {{{ */
         {          {
                 $ret = '<textarea class="'.$css.'" name="'.$name.'"';                  $ret = '<textarea class="'.$css.'" name="'.$name.'"';
                 $ret .= ($this->readonly($k) ? ' disabled' : '');                  $ret .= ($this->readonly($k) ? ' disabled' : '');
Line 1640  function '.$this->js['prefix'].'filter_h
Line 1636  function '.$this->js['prefix'].'filter_h
                         $ret .= ' wrap="virtual"';                          $ret .= ' wrap="virtual"';
                 }                  }
                 $ret .= '>';                  $ret .= '>';
                 if($escape) $ret .= htmlspecialchars($value);                  if ($escape) {
                 else $ret .= $value;                          $ret .= htmlspecialchars($value);
                   } else {
                           $ret .= $value;
                   }
                 $ret .= '</textarea>'."\n";                  $ret .= '</textarea>'."\n";
                 return $ret;                  return $ret;
         } /* }}} */          } /* }}} */
Line 1896  function '.$this->js['prefix'].'filter_h
Line 1895  function '.$this->js['prefix'].'filter_h
         /*          /*
          * Display buttons at top and bottom of page           * Display buttons at top and bottom of page
          */           */
         function display_list_table_buttons($position, $listall = false) /* {{{ */          function display_list_table_buttons($position) /* {{{ */
         {          {
                 if (($but_str = $this->display_buttons($position)) === null)                  if (($but_str = $this->display_buttons($position)) === null)
                         return;                          return;
Line 1912  function '.$this->js['prefix'].'filter_h
Line 1911  function '.$this->js['prefix'].'filter_h
                 if($this->display['num_pages'] || $this->display['num_records'])                  if($this->display['num_pages'] || $this->display['num_records'])
                         echo '<td class="',$this->getCSSclass('stats', $position),'">',"\n";                          echo '<td class="',$this->getCSSclass('stats', $position),'">',"\n";
                 if($this->display['num_pages']) {                  if($this->display['num_pages']) {
                         if ($listall) {                          if ($this->listall()) {
                                 echo $this->labels['Page'],':&nbsp;1&nbsp;',$this->labels['of'],'&nbsp;1';                                  echo $this->labels['Page'],':&nbsp;1&nbsp;',$this->labels['of'],'&nbsp;1';
                         } else {                          } else {
                                 $current_page = intval($this->fm / $this->inc) + 1;                                  $current_page = intval($this->fm / $this->inc) + 1;
Line 1957  function '.$this->js['prefix'].'filter_h
Line 1956  function '.$this->js['prefix'].'filter_h
   
         function display_buttons($position) /* {{{ */          function display_buttons($position) /* {{{ */
         {          {
                   $ret = '';
                 $nav_fnc = 'nav_'.$position;                  $nav_fnc = 'nav_'.$position;
                 if(! $this->$nav_fnc())                  if(! $this->$nav_fnc())
                         return;                          return;
Line 2004  function '.$this->js['prefix'].'filter_h
Line 2004  function '.$this->js['prefix'].'filter_h
                         return $this->htmlSubmit($name.$this->page_types[$this->page_type], $value,                          return $this->htmlSubmit($name.$this->page_types[$this->page_type], $value,
                                         $this->getCSSclass($name, $position), $validation);                                          $this->getCSSclass($name, $position), $validation);
                 }                  }
                 $listall = $this->inc <= 0;                  if ($this->listall()) {
                 if ($listall) {  
                         $disabledprev = true;                          $disabledprev = true;
                         $disablednext = true;                          $disablednext = true;
                         $total_pages  = 1;                          $total_pages  = 1;
Line 2032  function '.$this->js['prefix'].'filter_h
Line 2031  function '.$this->js['prefix'].'filter_h
                         return $ret;                          return $ret;
                 }                  }
                 if ($name == 'goto_combo') {                  if ($name == 'goto_combo') {
                         $disabledgoto = !($listall || ($disablednext && $disabledprev)) ? '' : ' disabled';                          $disabledgoto = !($this->listall() || ($disablednext && $disabledprev)) ? '' : ' disabled';
                         if ($disablegoto != '' && $disabled < 0) return;                          if ($disabledgoto != '' && $disabled < 0) return;
                         $kv_array = array();                          $kv_array = array();
                         for ($i = 0; $i < $total_pages; $i++) {                          for ($i = 0; $i < $total_pages; $i++) {
                                 $kv_array[$this->inc * $i] = $i + 1;                                  $kv_array[$this->inc * $i] = $i + 1;
Line 2045  function '.$this->js['prefix'].'filter_h
Line 2044  function '.$this->js['prefix'].'filter_h
                 }                  }
                 if ($name == 'goto') {                  if ($name == 'goto') {
                         return $this->htmlSubmit('navop', 'Go to', $this->getCSSclass('goto', $position),                          return $this->htmlSubmit('navop', 'Go to', $this->getCSSclass('goto', $position),
                                         false, ($listall || ($disablednext && $disabledprev)) ? $disabled : 0);                                          false, ($this->listall() || ($disablednext && $disabledprev)) ? $disabled : 0);
                 }                  }
                 if (in_array($name, array('first','prev','next','last','<<','<','>','>>'))) {                  if (in_array($name, array('first','prev','next','last','<<','<','>','>>'))) {
                         $disabled_var = 'disabled'.$name;                          $disabled_var = 'disabled'.$name;
Line 2065  function '.$this->js['prefix'].'filter_h
Line 2064  function '.$this->js['prefix'].'filter_h
         function number_of_recs() /* {{{ */          function number_of_recs() /* {{{ */
         {          {
                 $count_parts = array(                  $count_parts = array(
                                 'type'   => 'select',                                  'type'   => 'SELECT',
                                 'select' => 'count(*)',                                  'select' => 'COUNT(*)',
                                 'from'   => $this->get_SQL_join_clause(),                                  'from'   => @$this->get_SQL_join_clause(),
                                 'where'  => $this->get_SQL_where_from_query_opts());                                  'where'  => @$this->get_SQL_where_from_query_opts());
                 $res = $this->myquery($this->get_SQL_main_list_query($count_parts), __LINE__);                  $res = $this->myquery($this->get_SQL_main_list_query($count_parts), __LINE__);
                 $row = $this->sql_fetch($res, 'n');                  $row = $this->sql_fetch($res, 'n');
                 $this->total_recs = $row[0];                  $this->total_recs = $row[0];
Line 2251  function '.$this->js['prefix'].'filter_h
Line 2250  function '.$this->js['prefix'].'filter_h
                  */                   */
                 $select_recs = $this->key != '' &&                  $select_recs = $this->key != '' &&
                         ($this->change_enabled() || $this->delete_enabled() || $this->view_enabled());                          ($this->change_enabled() || $this->delete_enabled() || $this->view_enabled());
                 // Are we doing a listall?  
                 $listall = $this->inc <= 0;  
                 /*                  /*
                  * Display the SQL table in an HTML table                   * Display the SQL table in an HTML table
                  */                   */
Line 2260  function '.$this->js['prefix'].'filter_h
Line 2257  function '.$this->js['prefix'].'filter_h
                 echo $this->get_origvars_html($this->get_sfn_cgi_vars());                  echo $this->get_origvars_html($this->get_sfn_cgi_vars());
                 echo $this->htmlHiddenSys('fl', $this->fl);                  echo $this->htmlHiddenSys('fl', $this->fl);
                 // Display buttons at top and/or bottom of page.                  // Display buttons at top and/or bottom of page.
                 $this->display_list_table_buttons('up', $listall);                  $this->display_list_table_buttons('up');
                 if ($this->cgi['persist'] != '') {                  if ($this->cgi['persist'] != '') {
                         echo $this->get_origvars_html($this->cgi['persist']);                          echo $this->get_origvars_html($this->cgi['persist']);
                 }                  }
Line 2376  function '.$this->js['prefix'].'filter_h
Line 2373  function '.$this->js['prefix'].'filter_h
                         echo '<tr class="',$this->getCSSclass('row', null, 'next'),'">',"\n";                          echo '<tr class="',$this->getCSSclass('row', null, 'next'),'">',"\n";
                         if ($this->sys_cols) { /* {{{ */                          if ($this->sys_cols) { /* {{{ */
                                 $key_rec     = $row['qf'.$this->key_num];                                  $key_rec     = $row['qf'.$this->key_num];
                                 $queryAppend = htmlspecialchars('&'.$this->cgi['prefix']['sys'].'rec'.'='.$key_rec);  
                                 $viewQuery   = $qpviewStr   . $queryAppend;  
                                 $copyQuery   = $qpcopyStr   . $queryAppend;  
                                 $changeQuery = $qpchangeStr . $queryAppend;  
                                 $deleteQuery = $qpdeleteStr . $queryAppend;  
                                 $viewTitle   = htmlspecialchars($this->labels['View']);  
                                 $changeTitle = htmlspecialchars($this->labels['Change']);  
                                 $copyTitle   = htmlspecialchars($this->labels['Copy']);  
                                 $deleteTitle = htmlspecialchars($this->labels['Delete']);  
                                 $css_class_name = $this->getCSSclass('navigation', null, true);                                  $css_class_name = $this->getCSSclass('navigation', null, true);
                                 if ($select_recs) {                                  if ($select_recs) {
                                         if (! $this->nav_buttons() || $this->sys_cols > 1) {                                          if (! $this->nav_buttons() || $this->sys_cols > 1) {
                                                 echo '<td class="',$css_class_name,'">';                                                  echo '<td class="',$css_class_name,'">';
                                         }                                          }
                                           if ($this->nav_text_links() || $this->nav_graphic_links()) {
                                                   $queryAppend = htmlspecialchars('&'.$this->cgi['prefix']['sys'].'rec'.'='.$key_rec);
                                                   $viewQuery   = $qpviewStr   . $queryAppend;
                                                   $copyQuery   = $qpcopyStr   . $queryAppend;
                                                   $changeQuery = $qpchangeStr . $queryAppend;
                                                   $deleteQuery = $qpdeleteStr . $queryAppend;
                                                   $viewTitle   = htmlspecialchars($this->labels['View']);
                                                   $changeTitle = htmlspecialchars($this->labels['Change']);
                                                   $copyTitle   = htmlspecialchars($this->labels['Copy']);
                                                   $deleteTitle = htmlspecialchars($this->labels['Delete']);
                                           }
                                         if ($this->nav_graphic_links()) {                                          if ($this->nav_graphic_links()) {
                                                 $printed_out = false;                                                  $printed_out = false;
                                                 if ($this->view_enabled()) {                                                  if ($this->view_enabled()) {
Line 2489  function '.$this->js['prefix'].'filter_h
Line 2488  function '.$this->js['prefix'].'filter_h
                  * XXX this feature does not work yet!!!                   * XXX this feature does not work yet!!!
                  */                   */
                 // aggregates listing (if any)                  // aggregates listing (if any)
                 if ($$var_to_total) {                  if (0 && $$var_to_total) {
                         // do the aggregate query if necessary                          // do the aggregate query if necessary
                         //if ($vars_to_total) {                          //if ($vars_to_total) {
                                 $qp = array();                                  $qp = array();
                                 $qp['type'] = 'select';                                  $qp['type'] = 'select';
                                 $qp['select'] = $aggr_from_clause;                                  $qp['select'] = $aggr_from_clause;
                                 $qp['from']   = $this->get_SQL_join_clause();                                  $qp['from']   = @$this->get_SQL_join_clause();
                                 $qp['where']  = $this->get_SQL_where_from_query_opts();                                  $qp['where']  = @$this->get_SQL_where_from_query_opts();
                                 $tot_query    = $this->get_SQL_query($qp);                                  $tot_query    = @$this->get_SQL_query($qp);
                                 $totals_result = $this->myquery($tot_query,__LINE__);                                  $totals_result = $this->myquery($tot_query,__LINE__);
                                 $tot_row       = $this->sql_fetch($totals_result);                                  $tot_row       = $this->sql_fetch($totals_result);
                         //}                          //}
Line 2528  function '.$this->js['prefix'].'filter_h
Line 2527  function '.$this->js['prefix'].'filter_h
                         echo '</tr>',"\n";                          echo '</tr>',"\n";
                 }                  }
                 echo '</table>',"\n"; // end of table rows listing                  echo '</table>',"\n"; // end of table rows listing
                 $this->display_list_table_buttons('down', $listall);                  $this->display_list_table_buttons('down');
                 $this->form_end();                  $this->form_end();
         } /* }}} */          } /* }}} */
   
Line 3151  function '.$this->js['prefix'].'filter_h
Line 3150  function '.$this->js['prefix'].'filter_h
                 // Save/More Button - database operations                  // Save/More Button - database operations
                 if ($this->saveadd == $this->labels['Save'] || $this->savecopy == $this->labels['Save']) {                  if ($this->saveadd == $this->labels['Save'] || $this->savecopy == $this->labels['Save']) {
                         $this->add_enabled() && $this->do_add_record();                          $this->add_enabled() && $this->do_add_record();
                         unset($this->saveadd);                          $this->saveadd  = null; // unset($this->saveadd)
                         unset($this->savecopy);                          $this->savecopy = null; // unset($this->savecopy)
                         $this->recreate_fdd();                          $this->recreate_fdd();
                 }                  }
                 elseif ($this->moreadd == $this->labels['More']) {                  elseif ($this->moreadd == $this->labels['More']) {
Line 3164  function '.$this->js['prefix'].'filter_h
Line 3163  function '.$this->js['prefix'].'filter_h
                 }                  }
                 elseif ($this->savechange == $this->labels['Save']) {                  elseif ($this->savechange == $this->labels['Save']) {
                         $this->change_enabled() && $this->do_change_record();                          $this->change_enabled() && $this->do_change_record();
                         unset($this->savechange);                          $this->savechange = null; // unset($this->savechange)
                         $this->recreate_fdd();                          $this->recreate_fdd();
                 }                  }
                 elseif ($this->morechange == $this->labels['Apply']) {                  elseif ($this->morechange == $this->labels['Apply']) {
Line 3176  function '.$this->js['prefix'].'filter_h
Line 3175  function '.$this->js['prefix'].'filter_h
                 }                  }
                 elseif ($this->savedelete == $this->labels['Delete']) {                  elseif ($this->savedelete == $this->labels['Delete']) {
                         $this->delete_enabled() && $this->do_delete_record();                          $this->delete_enabled() && $this->do_delete_record();
                         unset($this->savedelete);                          $this->savedelete = null; // unset($this->savedelete)
                         $this->recreate_fdd();                          $this->recreate_fdd();
                 }                  }
   
Line 3213  function '.$this->js['prefix'].'filter_h
Line 3212  function '.$this->js['prefix'].'filter_h
          */           */
         function phpMyEdit($opts) /* {{{ */          function phpMyEdit($opts) /* {{{ */
         {          {
                 // Set desirable error reporting level  
                 $error_reporting = error_reporting(E_ALL & ~E_NOTICE);  
                 // Database handle variables                  // Database handle variables
                 $this->sql_delimiter();                  $this->sql_delimiter();
                 if (isset($opts['dbh'])) {                  if (isset($opts['dbh'])) {
Line 3291  function '.$this->js['prefix'].'filter_h
Line 3288  function '.$this->js['prefix'].'filter_h
                 if (! $this->nav_up() && ! $this->nav_down()) {                  if (! $this->nav_up() && ! $this->nav_down()) {
                         $this->navigation .= 'D'; // down position is default                          $this->navigation .= 'D'; // down position is default
                 }                  }
                 $this->buttons = $opts['buttons'];                  $this->buttons = @$opts['buttons'];
                 // Language labels (must go after navigation)                  // Language labels (must go after navigation)
                 $this->labels = $this->make_language_labels(isset($opts['language'])                  $this->labels = $this->make_language_labels(isset($opts['language'])
                                 ? $opts['language'] : $this->get_server_var('HTTP_ACCEPT_LANGUAGE'));                                  ? $opts['language'] : $this->get_server_var('HTTP_ACCEPT_LANGUAGE'));
Line 3387  function '.$this->js['prefix'].'filter_h
Line 3384  function '.$this->js['prefix'].'filter_h
                 // Call to action                  // Call to action
                 !isset($opts['execute']) && $opts['execute'] = 1;                  !isset($opts['execute']) && $opts['execute'] = 1;
                 $opts['execute'] && $this->execute();                  $opts['execute'] && $this->execute();
                 // Restore original error reporting level  
                 error_reporting($error_reporting);  
         } /* }}} */          } /* }}} */
   
 }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

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