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.228 and 1.229

version 1.228, 2024/11/20 07:21:07 version 1.229, 2025/07/08 06:37:14
Line 19 
Line 19 
  * http://platon.sk/projects/phpMyEdit/   * http://platon.sk/projects/phpMyEdit/
  */   */
   
 /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.227 2024/11/11 09:01:20 igor Exp $ */  /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.228 2024/11/20 07:21:07 igor 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 218  class phpMyEdit
Line 218  class phpMyEdit
         function nav_buttons()       { return stristr($this->navigation, 'B'); }          function nav_buttons()       { return stristr($this->navigation, 'B'); }
         function nav_text_links()    { return stristr($this->navigation, 'T'); }          function nav_text_links()    { return stristr($this->navigation, 'T'); }
         function nav_graphic_links() { return stristr($this->navigation, 'G'); }          function nav_graphic_links() { return stristr($this->navigation, 'G'); }
         function nav_up()            { return (stristr($this->navigation, 'U') && !($this->buttons[$this->page_type]['up'] ?? true === false)); }          function nav_up() {
         function nav_down()          { return (stristr($this->navigation, 'D') && !($this->buttons[$this->page_type]['down'] ?? true === false)); }                  $up_button = true; // default TRUE
                   if (isset($this->buttons[$this->page_type]['up'])) {
                           $up_button = $this->buttons[$this->page_type]['up'];
                   }
                   return stristr($this->navigation, 'U') && !($up_button === false);
           }
           function nav_down() {
                   $down_button = true; // DEFAULT TRUE
                   if (isset($this->buttons[$this->page_type]['down'])) {
                           $down_button = $this->buttons[$this->page_type]['down'];
                   }
                   return stristr($this->navigation, 'D') && !($down_button === false);
           }
   
         /*          /*
          * functions for indicating whether operations are enabled           * functions for indicating whether operations are enabled
Line 498  class phpMyEdit
Line 510  class phpMyEdit
   
         function set_values($field_num, $prepend = null, $append = null, $strict = false) /* {{{ */          function set_values($field_num, $prepend = null, $append = null, $strict = false) /* {{{ */
         {          {
                 return (array) $prepend + (array) ($this->fdd[$field_num]['values2'] ?? array())                  $values2 = (isset($this->fdd[$field_num]['values2']))
                           ? $this->fdd[$field_num]['values2']
                           : array();
                   return (array) $prepend + (array) ($values2)
                         + (isset($this->fdd[$field_num]['values']['table']) || $strict                          + (isset($this->fdd[$field_num]['values']['table']) || $strict
                                         ? $this->set_values_from_table($field_num, $strict)                                          ? $this->set_values_from_table($field_num, $strict)
                                         : array())                                          : array())
Line 547  class phpMyEdit
Line 562  class phpMyEdit
                                         'column'      => $key, // OLD: $column,                                          'column'      => $key, // OLD: $column,
                                         'description' => $desc);                                          'description' => $desc);
                         $qparts['where'] = $this->substituteVars($this->fdd[$field_num]['values']['filters'], $ar);                          $qparts['where'] = $this->substituteVars($this->fdd[$field_num]['values']['filters'], $ar);
                         if ($this->fdd[$field_num]['values']['orderby'] ?? false) {                          if (isset($this->fdd[$field_num]['values']['orderby'])
                                   && $this->fdd[$field_num]['values']['orderby'])
                           {
                                 $qparts['orderby'] = $this->substituteVars($this->fdd[$field_num]['values']['orderby'], $ar);                                  $qparts['orderby'] = $this->substituteVars($this->fdd[$field_num]['values']['orderby'], $ar);
                         }                          }
                 } else { /* simple value extraction */                  } else { /* simple value extraction */
Line 881  class phpMyEdit
Line 898  class phpMyEdit
                                         $ids  = array();                                          $ids  = array();
                                         $ar   = array();                                          $ar   = array();
                                         $ar[$this->fqn($k)] = array('oper' => 'LIKE', 'value' => "'$afilter'");                                          $ar[$this->fqn($k)] = array('oper' => 'LIKE', 'value' => "'$afilter'");
                                         if (is_array($this->fdd[$k]['values2'] ?? null)) {                                          if (isset($this->fdd[$k]['values2'])
                                                   && is_array($this->fdd[$k]['values2']))
                                           {
                                                 foreach ($this->fdd[$k]['values2'] as $key => $val) {                                                  foreach ($this->fdd[$k]['values2'] as $key => $val) {
                                                         if (strlen($m) > 0 && stristr($val, $m)) {                                                          if (strlen($m) > 0 && stristr($val, $m)) {
                                                                 $ids[] = '"'.addslashes($key).'"';                                                                  $ids[] = '"'.addslashes($key).'"';
Line 1132  function '.$this->js['prefix'].'filter_h
Line 1151  function '.$this->js['prefix'].'filter_h
                                 continue;                                  continue;
                         }                          }
                         if ($this->hidden($k)) {                          if ($this->hidden($k)) {
                                 echo $this->htmlHiddenData($this->fds[$k], $this->fdd[$k]['default'] ?? null);                                  $default = isset($this->fdd[$k]['default'])
                                           ? $this->fdd[$k]['default']
                                           : null;
                                   echo $this->htmlHiddenData($this->fds[$k], $default);
                                 continue;                                  continue;
                         }                          }
                         $css_postfix    = @$this->fdd[$k]['css']['postfix'];                          $css_postfix    = @$this->fdd[$k]['css']['postfix'];
Line 1179  function '.$this->js['prefix'].'filter_h
Line 1201  function '.$this->js['prefix'].'filter_h
                                 echo ($this->readonly($k) ? ' disabled' : '');                                  echo ($this->readonly($k) ? ' disabled' : '');
                                 echo ' name="',$this->cgi['prefix']['data'].$this->fds[$k],'"';                                  echo ' name="',$this->cgi['prefix']['data'].$this->fds[$k],'"';
                                 echo $len_props,' value="';                                  echo $len_props,' value="';
                                 if($escape) echo $this->_htmlspecialchars(@$this->fdd[$k]['default']);                                  if($escape) {
                             else echo $this->fdd[$k]['default'] ?? '';                                          echo $this->_htmlspecialchars(@$this->fdd[$k]['default']);
                                   } else {
                                           if (isset($this->fdd[$k]['default'])) {
                                                   echo $this->fdd[$k]['default'];
                                           }
                                   }
                                 echo '" />';                                  echo '" />';
                         }                          }
                         echo '</td>',"\n";                          echo '</td>',"\n";
Line 1261  function '.$this->js['prefix'].'filter_h
Line 1288  function '.$this->js['prefix'].'filter_h
                                 }                                  }
                                 if ($this->guidance) {                                  if ($this->guidance) {
                                         $css_class_name = $this->getCSSclass('help', null, true, $css_postfix);                                          $css_class_name = $this->getCSSclass('help', null, true, $css_postfix);
                                         $cell_value     = $this->fdd[$k]['help'] ?? '&nbsp;';                                          $cell_value     = isset($this->fdd[$k]['help']) ? $this->fdd[$k]['help'] : '&nbsp;';
                                         echo '<td class="',$css_class_name,'">',$cell_value,'</td>',"\n";                                          echo '<td class="',$css_class_name,'">',$cell_value,'</td>',"\n";
                                 }                                  }
                                 echo '</tr>',"\n";                                  echo '</tr>',"\n";
Line 1297  function '.$this->js['prefix'].'filter_h
Line 1324  function '.$this->js['prefix'].'filter_h
                         echo include($this->fdd[$k]['php']);                          echo include($this->fdd[$k]['php']);
                 } else {                  } else {
                         $len_props = '';                          $len_props = '';
                         $maxlen = intval($this->fdd[$k]['maxlen'] ?? 0);                          $maxlen = (isset($this->fdd[$k]['maxlen'])) ? intval($this->fdd[$k]['maxlen']) : 0;
                         $size   = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60);                          $size   = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60);
                         if ($size > 0) {                          if ($size > 0) {
                                 $len_props .= ' size="'.$size.'"';                                  $len_props .= ' size="'.$size.'"';
Line 2101  function '.$this->js['prefix'].'filter_h
Line 2128  function '.$this->js['prefix'].'filter_h
                 $nav_fnc = 'nav_'.$position;                  $nav_fnc = 'nav_'.$position;
                 if(! $this->$nav_fnc())                  if(! $this->$nav_fnc())
                         return;                          return;
                 $buttons = (is_array($this->buttons[$this->page_type][$position] ?? null))                  $buttons = (isset($this->buttons[$this->page_type][$position])
                                   && is_array($this->buttons[$this->page_type][$position]))
                         ? $this->buttons[$this->page_type][$position]                          ? $this->buttons[$this->page_type][$position]
                         : $this->default_buttons[$this->page_type];                          : $this->default_buttons[$this->page_type];
                 foreach ($buttons as $name) {                  foreach ($buttons as $name) {
Line 2289  function '.$this->js['prefix'].'filter_h
Line 2317  function '.$this->js['prefix'].'filter_h
                                                 $vals, $selected, $multiple, $readonly, $strip_tags, $escape);                                                  $vals, $selected, $multiple, $readonly, $strip_tags, $escape);
                         } elseif ($this->fdd[$fd]['select'] == 'N' || $this->fdd[$fd]['select'] == 'T') {                          } elseif ($this->fdd[$fd]['select'] == 'N' || $this->fdd[$fd]['select'] == 'T') {
                                 $len_props = '';                                  $len_props = '';
                                 $maxlen = intval($this->fdd[$k]['maxlen'] ?? 0);                                  $maxlen = isset($this->fdd[$k]['maxlen']) ? intval($this->fdd[$k]['maxlen']) : 0;
                                 //$maxlen > 0 || $maxlen = intval($this->sql_field_len($res, $fields["qf$k"]));                                  //$maxlen > 0 || $maxlen = intval($this->sql_field_len($res, $fields["qf$k"]));
                                 $maxlen > 0 || $maxlen = 500;                                  $maxlen > 0 || $maxlen = 500;
                                 $size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size']                                  $size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size']
Line 3102  function '.$this->js['prefix'].'filter_h
Line 3130  function '.$this->js['prefix'].'filter_h
                                         continue;                                          continue;
                                 }                                  }
                                 // Make field backups                                  // Make field backups
                                 $this->fdd[$column][$col_ar[0] .'~'] = $this->fdd[$column][$col_ar[0]] ?? null;                                  $this->fdd[$column][$col_ar[0] .'~'] = isset($this->fdd[$column][$col_ar[0]]) ? $this->fdd[$column][$col_ar[0]] : null;
                                 $this->fdd[$column][$col_option.'~'] = $this->fdd[$column][$col_option] ?? null;                                  $this->fdd[$column][$col_option.'~'] = isset($this->fdd[$column][$col_option]) ? $this->fdd[$column][$col_option] : null;
                                 // Set particular field                                  // Set particular field
                                 $this->fdd[$column][$col_ar[0]] = $this->fdd[$column][$col_option];                                  $this->fdd[$column][$col_ar[0]] = $this->fdd[$column][$col_option];
                                 unset($this->fdd[$column][$col_option]);                                  unset($this->fdd[$column][$col_option]);
Line 3369  function '.$this->js['prefix'].'filter_h
Line 3397  function '.$this->js['prefix'].'filter_h
                         $this->un  = $opts['un'];                          $this->un  = $opts['un'];
                         $this->pw  = $opts['pw'];                          $this->pw  = $opts['pw'];
                         $this->db  = $opts['db'];                          $this->db  = $opts['db'];
                         $this->ssl = $opts['ssl'] ?? 0;                          $this->ssl = isset($opts['ssl']) ? $opts['ssl'] : 0;
                 }                  }
                 $this->tb  = $opts['tb'];                  $this->tb  = $opts['tb'];
                 // Other variables                  // Other variables

Legend:
Removed from v.1.228  
changed lines
  Added in v.1.229

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