Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Nedeľa, 25. október 2026

Rozdiely pre Metafox/lib/phpMyEdit/phpMyEdit.class.php medzi verziami 1.12 a 1.13

verzia 1.12, 2015/09/07 16:03:26 verzia 1.13, 2017/06/08 14:52:24
Riadok 19 
Riadok 19 
  * http://platon.sk/projects/phpMyEdit/   * http://platon.sk/projects/phpMyEdit/
  */   */
   
 /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.220 2015/09/07 16:02:40 igor Exp $ */  /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.222 2017/06/08 11:56:19 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.
Riadok 35 
Riadok 35 
           original table view (Pass 1).            original table view (Pass 1).
 */  */
   
   define('FETCH_ASSOC', 0);
   define('FETCH_NUM',   1);
   define('FETCH_BOTH',  2);
   
   
 class phpMyEdit_timer /* {{{ */  class phpMyEdit_timer /* {{{ */
 {  {
         var $startTime;          var $startTime;
Riadok 319  class phpMyEdit
Riadok 324  class phpMyEdit
         function sql_connect() /* {{{ */          function sql_connect() /* {{{ */
         {          {
                 $flags = $this->ssl > 0 ? MYSQL_CLIENT_SSL : null;                  $flags = $this->ssl > 0 ? MYSQL_CLIENT_SSL : null;
                 $this->dbh = @ini_get('allow_persistent')                  if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
                   ? @mysql_pconnect($this->hn, $this->un, $this->pw, $flags)                          $this->dbh = @ini_get('allow_persistent')
                   : @mysql_connect($this->hn, $this->un, $this->pw, false, $flags);                                  ? mysqli_connect('p:'.$this->hn, $this->un, $this->pw, $flags)
                                   : mysqli_connect($this->hn, $this->un, $this->pw, $flags);
                   } else { // FOR OLD PHP
                           $this->dbh = @ini_get('allow_persistent')
                                   ? @mysql_pconnect($this->hn, $this->un, $this->pw, $flags)
                                   : @mysql_connect($this->hn, $this->un, $this->pw, false, $flags);
                   }
         } /* }}} */          } /* }}} */
   
   
         function sql_disconnect() /* {{{ */          function sql_disconnect() /* {{{ */
         {          {
                 if ($this->close_dbh) {                  if ($this->close_dbh) {
                         @mysql_close($this->dbh);                          if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
                                   mysqli_close($this->dbh);
                           } else { // FOR OLD PHP
                                   @mysql_close($this->dbh);
                           }
                         $this->dbh = null;                          $this->dbh = null;
                 }                  }
         } /* }}} */          } /* }}} */
   
         function sql_fetch(&$res, $type = 'a') /* {{{ */          function sql_fetch(&$res, $type = 'a') /* {{{ */
         {          {
                 if($type == 'n') $type = MYSQL_NUM;                  if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
                 else $type = MYSQL_ASSOC;                          if($type == 'n') $type = MYSQLI_NUM;
                 return @mysql_fetch_array($res, $type);                          else $type = MYSQLI_ASSOC;
                           return mysqli_fetch_array($res, $type);
                   } else { // FOR OLD PHP
                           if($type == 'n') $type = MYSQL_NUM;
                           else $type = MYSQL_ASSOC;
                           return @mysql_fetch_array($res, $type);
                   }
         } /* }}} */          } /* }}} */
   
         function sql_free_result(&$res) /* {{{ */          function sql_free_result(&$res) /* {{{ */
         {          {
                 return @mysql_free_result($res);                  if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
                           return mysqli_free_result($res);
                   } else { // FOR OLD PHP
                           return @mysql_free_result($res);
                   }
         } /* }}} */          } /* }}} */
   
         function sql_affected_rows(&$dbh) /* {{{ */          function sql_affected_rows(&$dbh) /* {{{ */
         {          {
                 return @mysql_affected_rows($dbh);                  if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
                           return mysqli_affected_rows($dbh);
                   } else { // FOR OLD PHP
                           return @mysql_affected_rows($dbh);
                   }
         } /* }}} */          } /* }}} */
   
         function sql_field_len(&$res,$field) /* {{{ */          function sql_field_len(&$res,$field) /* {{{ */
         {          {
                 return @mysql_field_len($res, $field);                  if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
                           return mysqli_fetch_field_direct($res, $field)->max_length;
                   } else { // FOR OLD PHP
                           return @mysql_field_len($res, $field);
                   }
         } /* }}} */          } /* }}} */
   
         function sql_insert_id() /* {{{ */          function sql_insert_id() /* {{{ */
         {          {
                 return mysql_insert_id($this->dbh);                  if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
                           return mysqli_insert_id($this->dbh);
                   } else {
                           return mysql_insert_id($this->dbh);
                   }
         } /* }}} */          } /* }}} */
   
         function sql_limit($start, $more = null) /* {{{ */          function sql_limit($start, $more = null) /* {{{ */
Riadok 387  class phpMyEdit
Riadok 424  class phpMyEdit
                         echo '<h4>MySQL query at line ',$line,'</h4>',$this->_htmlspecialchars($qry),'<hr size="1" />',"\n";                          echo '<h4>MySQL query at line ',$line,'</h4>',$this->_htmlspecialchars($qry),'<hr size="1" />',"\n";
                 }                  }
                 if (isset($this->db)) {                  if (isset($this->db)) {
                         $ret = @mysql_db_query($this->db, $qry, $this->dbh);                          if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
                                   mysqli_select_db($this->dbh, $this->db);
                                   $ret = mysqli_query($this->dbh, $qry);
                           } else { // FOR OLD PHP
                                   $ret = @mysql_db_query($this->db, $qry, $this->dbh);
                           }
                 } else {                  } else {
                         $ret = @mysql_query($qry, $this->dbh);                          if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
                                   $ret = mysqli_query($this->dbh, $qry);
                           } else { // FOR OLD PHP
                                   $ret = @mysql_query($qry, $this->dbh);
                           }
                 }                  }
                 if (! $ret) {                  if (! $ret) {
                         echo '<h4>MySQL error ',mysql_errno($this->dbh),'</h4>';                          if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
                         echo $this->_htmlspecialchars(mysql_error($this->dbh)),'<hr size="1" />',"\n";                                  echo '<h4>MySQL error ',mysqli_errno($this->dbh),'</h4>';
                                   echo $this->_htmlspecialchars(mysqli_error($this->dbh)),'<hr size="1" />',"\n";
                           } else {
                                   echo '<h4>MySQL error ',mysql_errno($this->dbh),'</h4>';
                                   echo $this->_htmlspecialchars(mysql_error($this->dbh)),'<hr size="1" />',"\n";
                           }
                 }                  }
                 return $ret;                  return $ret;
         } /* }}} */          } /* }}} */
   
           function sql_fetch_array($result, $result_type = FETCH_BOTH) /* {{{ */
           {
                   if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
                           switch($result_type) {
                                   default:
                                   case FETCH_BOTH:  $type = MYSQLI_BOTH; break;
                                   case FETCH_NUM:   $type = MYSQLI_NUM; break;
                                   case FETCH_ASSOC: $type = MYSQLI_ASSOC; break;
                           }
                           return mysqli_fetch_array($result, $type);
                   } else { // FOR OLD PHP
                           switch($result_type) {
                                   default:
                                   case FETCH_BOTH:  $type = MYSQL_BOTH; break;
                                   case FETCH_NUM:   $type = MYSQL_NUM; break;
                                   case FETCH_ASSOC: $type = MYSQL_ASSOC; break;
                           }
                           return mysql_fetch_array($result, $type);
                   }
           } /* }}} */
   
         /* end of sql functions */          /* end of sql functions */
   
         function make_language_labels($language) /* {{{ */          function make_language_labels($language) /* {{{ */
Riadok 1100  function '.$this->js['prefix'].'filter_h
Riadok 1172  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'], $escape);                                  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 {
Riadok 1119  function '.$this->js['prefix'].'filter_h
Riadok 1191  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) echo $this->_htmlspecialchars(@$this->fdd[$k]['default']);
                             else echo $this->fdd[$k]['default'];                              else echo $this->fdd[$k]['default'];
                                 echo '" />';                                  echo '" />';
                         }                          }
Riadok 1422  function '.$this->js['prefix'].'filter_h
Riadok 1494  function '.$this->js['prefix'].'filter_h
                         $value = intval($row["qf$k".'_timestamp']);                          $value = intval($row["qf$k".'_timestamp']);
                         $value = $value ? @strftime($this->fdd[$k]['strftimemask'], $value) : '';                          $value = $value ? @strftime($this->fdd[$k]['strftimemask'], $value) : '';
                 } else if ($this->is_values2($k, $row["qf$k"])) {                  } else if ($this->is_values2($k, $row["qf$k"])) {
                         $value = $row['qf'.$k.'_idx'];                          $value = @$row['qf'.$k.'_idx'];
                         if ($this->fdd[$k]['select'] == 'M') {                          if ($this->fdd[$k]['select'] == 'M') {
                                 $value_ar  = explode(',', $value);                                  $value_ar  = explode(',', $value);
                                 $value_ar2 = array();                                  $value_ar2 = array();
Riadok 2057  function '.$this->js['prefix'].'filter_h
Riadok 2129  function '.$this->js['prefix'].'filter_h
                 if (in_array($name, array('add','view','change','copy','delete'))) {                  if (in_array($name, array('add','view','change','copy','delete'))) {
                         $enabled_fnc = $name.'_enabled';                          $enabled_fnc = $name.'_enabled';
                         $enabled     = $this->$enabled_fnc();                          $enabled     = $this->$enabled_fnc();
                         if ($name != 'add' && ! $this->total_recs && strstr('LF', $this->page_type))                          if ($name != 'add' && ! @$this->total_recs && strstr('LF', $this->page_type))
                                 $enabled = false;                                  $enabled = false;
                         return $this->htmlSubmit('operation', ucfirst($name),                          return $this->htmlSubmit('operation', ucfirst($name),
                                         $this->getCSSclass($name, $position), false, $enabled ? 0 : $disabled);                                          $this->getCSSclass($name, $position), false, $enabled ? 0 : $disabled);
Riadok 2687  function '.$this->js['prefix'].'filter_h
Riadok 2759  function '.$this->js['prefix'].'filter_h
                 // Creating array of changed keys ($changed)                  // Creating array of changed keys ($changed)
                 $changed = array_keys($newvals);                  $changed = array_keys($newvals);
                 // Before trigger, newvals can be efectively changed                  // Before trigger, newvals can be efectively changed
                 if ($this->exec_triggers('insert', 'before', $oldvals, $changed, $newvals) == false) {                  if ($this->exec_triggers('insert', 'before', isset($oldvals) ? $oldvals : null, $changed, $newvals) == false) {
                         return false;                          return false;
                 }                  }
                 // Real query (no additional query in this method)                  // Real query (no additional query in this method)
Riadok 2735  function '.$this->js['prefix'].'filter_h
Riadok 2807  function '.$this->js['prefix'].'filter_h
                         $this->myquery($query, __LINE__);                          $this->myquery($query, __LINE__);
                 }                  }
                 // After trigger                  // After trigger
                 if ($this->exec_triggers('insert', 'after', $oldvals, $changed, $newvals) == false) {                  if ($this->exec_triggers('insert', 'after', isset($oldvals) ? $oldvals : null, $changed, $newvals) == false) {
                         return false;                          return false;
                 }                  }
                 return true;                  return true;
Riadok 2771  function '.$this->js['prefix'].'filter_h
Riadok 2843  function '.$this->js['prefix'].'filter_h
                 $this->sql_free_result($res);                  $this->sql_free_result($res);
                 // Creating array of changed keys ($changed)                  // Creating array of changed keys ($changed)
                 foreach ($newvals as $fd => $value) {                  foreach ($newvals as $fd => $value) {
                         if ($value != $oldvals[$fd])                          if ($value != @$oldvals[$fd])
                                 $changed[] = $fd;                                  $changed[] = $fd;
                 }                  }
                 // Before trigger                  // Before trigger
                 if ($this->exec_triggers('update', 'before', $oldvals, $changed, $newvals) == false) {                  if ($this->exec_triggers('update', 'before', isset($oldvals) ? $oldvals : null, $changed, $newvals) == false) {
                         return false;                          return false;
                 }                  }
                 // Build the real query respecting changes to the newvals array                  // Build the real query respecting changes to the newvals array
Riadok 2840  function '.$this->js['prefix'].'filter_h
Riadok 2912  function '.$this->js['prefix'].'filter_h
                         }                          }
                 }                  }
                 // After trigger                  // After trigger
                 if ($this->exec_triggers('update', 'after', $oldvals, $changed, $newvals) == false) {                  if ($this->exec_triggers('update', 'after', isset($oldvals) ? $oldvals : null, $changed, $newvals) == false) {
                         return false;                          return false;
                 }                  }
                 return true;                  return true;
Riadok 2858  function '.$this->js['prefix'].'filter_h
Riadok 2930  function '.$this->js['prefix'].'filter_h
                 $changed = is_array($oldvals) ? array_keys($oldvals) : array();                  $changed = is_array($oldvals) ? array_keys($oldvals) : array();
                 $newvals = array();                  $newvals = array();
                 // Before trigger                  // Before trigger
                 if ($this->exec_triggers('delete', 'before', $oldvals, $changed, $newvals) == false) {                  if ($this->exec_triggers('delete', 'before', isset($oldvals) ? $oldvals : null, $changed, $newvals) == false) {
                         return false;                          return false;
                 }                  }
                 // Real query                  // Real query
Riadok 2884  function '.$this->js['prefix'].'filter_h
Riadok 2956  function '.$this->js['prefix'].'filter_h
                         $this->myquery($query, __LINE__);                          $this->myquery($query, __LINE__);
                 }                  }
                 // After trigger                  // After trigger
                 if ($this->exec_triggers('delete', 'after', $oldvals, $changed, $newvals) == false) {                  if ($this->exec_triggers('delete', 'after', isset($oldvals) ? $oldvals : null, $changed, $newvals) == false) {
                         return false;                          return false;
                 }                  }
                 return true;                  return true;
Riadok 3122  function '.$this->js['prefix'].'filter_h
Riadok 3194  function '.$this->js['prefix'].'filter_h
                         }                          }
                         // move 'HWR' flags from ['options'] into ['input']                          // move 'HWR' flags from ['options'] into ['input']
                         if (isset($this->fdd[$column]['options'])) {                          if (isset($this->fdd[$column]['options'])) {
                                 stristr($this->fdd[$column]['options'], 'H') && $this->fdd[$column]['input'] .= 'H';                                  stristr($this->fdd[$column]['options'], 'H') && @$this->fdd[$column]['input'] .= 'H';
                                 stristr($this->fdd[$column]['options'], 'W') && $this->fdd[$column]['input'] .= 'W';                                  stristr($this->fdd[$column]['options'], 'W') && @$this->fdd[$column]['input'] .= 'W';
                                 stristr($this->fdd[$column]['options'], 'R') && $this->fdd[$column]['input'] .= 'R';                                  stristr($this->fdd[$column]['options'], 'R') && @$this->fdd[$column]['input'] .= 'R';
                         }                          }
                 }                  }
         } /* }}} */          } /* }}} */

Legend:
Odstranené z verzie1.12  
zmenené riadky
  Pridané vo verzii1.13

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok