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

Diff for phpMyEdit/phpMyEdit.class.php between version 1.188 and 1.189

version 1.188, 2006/09/08 16:30:31 version 1.189, 2006/11/26 13:25:59
Line 19 
Line 19 
  * http://platon.sk/projects/phpMyEdit/   * http://platon.sk/projects/phpMyEdit/
  */   */
   
 /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.187 2006-09-08 16:18:03 michal Exp $ */  /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.188 2006-09-08 16:30:31 michal 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 311  class phpMyEdit
Line 311  class phpMyEdit
                 global $debug_query;                  global $debug_query;
                 if ($debug_query || $debug) {                  if ($debug_query || $debug) {
                         $line = intval($line);                          $line = intval($line);
                         echo '<h4>MySQL query at line ',$line,'</h4>',htmlspecialchars($qry),'<hr />',"\n";                          echo '<h4>MySQL query at line ',$line,'</h4>',htmlspecialchars($qry),'<hr size="1" />',"\n";
                 }                  }
                 if (isset($this->db)) {                  if (isset($this->db)) {
                         $ret = @mysql_db_query($this->db, $qry, $this->dbh);                          $ret = @mysql_db_query($this->db, $qry, $this->dbh);
Line 320  class phpMyEdit
Line 320  class phpMyEdit
                 }                  }
                 if (! $ret) {                  if (! $ret) {
                         echo '<h4>MySQL error ',mysql_errno($this->dbh),'</h4>';                          echo '<h4>MySQL error ',mysql_errno($this->dbh),'</h4>';
                         echo htmlspecialchars(mysql_error($this->dbh)),'<hr />',"\n";                          echo htmlspecialchars(mysql_error($this->dbh)),'<hr size="1" />',"\n";
                 }                  }
                 return $ret;                  return $ret;
         } /* }}} */          } /* }}} */
Line 980  function '.$this->js['prefix'].'filter_h
Line 980  function '.$this->js['prefix'].'filter_h
                                 }                                  }
                         } elseif (isset ($this->fdd[$k]['textarea'])) {                          } elseif (isset ($this->fdd[$k]['textarea'])) {
                                 echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"';                                  echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"';
                                 echo ($this->readonly($k) ? ' disabled="disabled"' : '');                                  echo ($this->readonly($k) ? ' disabled' : '');
                                 if (intval($this->fdd[$k]['textarea']['rows']) > 0) {                                  if (intval($this->fdd[$k]['textarea']['rows']) > 0) {
                                         echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';                                          echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';
                                 }                                  }
Line 1000  function '.$this->js['prefix'].'filter_h
Line 1000  function '.$this->js['prefix'].'filter_h
                                 echo include($this->fdd[$k]['php']);                                  echo include($this->fdd[$k]['php']);
                         } else {                          } else {
                                 // Simple edit box required                                  // Simple edit box required
                                 $size_ml_props = '';                                  $len_props = '';
                                 $maxlen = intval($this->fdd[$k]['maxlen']);                                  $maxlen = intval($this->fdd[$k]['maxlen']);
                                 $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);
                                 $size   && $size_ml_props .= ' size="'.$size.'"';                                  if ($size > 0) {
                                 $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';                                          $len_props .= ' size="'.$size.'"';
                                   }
                                   if ($maxlen > 0) {
                                           $len_props .= ' maxlength="'.$maxlen.'"';
                                   }
                                 echo '<input class="',$css_class_name,'" ';                                  echo '<input class="',$css_class_name,'" ';
                                 echo ($this->password($k) ? 'type="password"' : 'type="text"');                                  echo ($this->password($k) ? 'type="password"' : 'type="text"');
                                 echo ($this->readonly($k) ? ' disabled="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 $size_ml_props,' value="';                                  echo $len_props,' value="';
                                 if($escape) echo htmlspecialchars($this->fdd[$k]['default']);                                  if($escape) echo htmlspecialchars($this->fdd[$k]['default']);
                             else echo $this->fdd[$k]['default'];                              else echo $this->fdd[$k]['default'];
                                 echo '" />';                                  echo '" />';
Line 1124  function '.$this->js['prefix'].'filter_h
Line 1128  function '.$this->js['prefix'].'filter_h
                         }                          }
                 } elseif (isset($this->fdd[$k]['textarea'])) {                  } elseif (isset($this->fdd[$k]['textarea'])) {
                         echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"';                          echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"';
                         echo ($this->readonly($k) ? ' disabled="disabled"' : '');                          echo ($this->readonly($k) ? ' disabled' : '');
                         if (intval($this->fdd[$k]['textarea']['rows']) > 0) {                          if (intval($this->fdd[$k]['textarea']['rows']) > 0) {
                                 echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';                                  echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';
                         }                          }
Line 1143  function '.$this->js['prefix'].'filter_h
Line 1147  function '.$this->js['prefix'].'filter_h
                 } 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 {
                         $size_ml_props = '';                          $len_props = '';
                         $maxlen = intval($this->fdd[$k]['maxlen']);                          $maxlen = intval($this->fdd[$k]['maxlen']);
                         $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);
                         $size   && $size_ml_props .= ' size="'.$size.'"';                          if ($size > 0) {
                         $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';                                  $len_props .= ' size="'.$size.'"';
                         echo '<input class="',$css_class_name,'" type="text" ';                          }
                         echo ($this->readonly($k) ? 'disabled="disabled" ' : '');                          if ($maxlen > 0) {
                         echo 'name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="';                                  $len_props .= ' maxlength="'.$maxlen.'"';
                           }
                           echo '<input class="',$css_class_name,'" type="text"';
                           echo ($this->readonly($k) ? ' disabled' : '');
                           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 '" />',"\n";                          echo '"',$len_props,' />',"\n";
                 }                  }
                 echo '</td>',"\n";                  echo '</td>',"\n";
         } /* }}} */          } /* }}} */
Line 1163  function '.$this->js['prefix'].'filter_h
Line 1171  function '.$this->js['prefix'].'filter_h
                 $css_postfix = @$this->fdd[$k]['css']['postfix'];                  $css_postfix = @$this->fdd[$k]['css']['postfix'];
                 echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'"';                  echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'"';
                 echo $this->getColAttributes($k),">\n";                  echo $this->getColAttributes($k),">\n";
                 $size_ml_props = '';                  $len_props = '';
                 $maxlen = intval($this->fdd[$k]['maxlen']);                  $maxlen = intval($this->fdd[$k]['maxlen']);
                 $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);
                 $size   && $size_ml_props .= ' size="'.$size.'"';                  if ($size > 0) {
                 $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';                          $len_props .= ' size="'.$size.'"';
                 echo '<input class="',$this->getCSSclass('value', null, true, $css_postfix),'" type="password" ';                  }
                 echo ($this->readonly($k) ? 'disabled="disabled" ' : '');                  if ($maxlen > 0) {
                 echo 'name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="';                          $len_props .= ' maxlength="'.$maxlen.'"';
                 echo htmlspecialchars($row["qf$k"]),'" ',$size_ml_props,' />',"\n";                  }
                   echo '<input class="',$this->getCSSclass('value', null, true, $css_postfix),'" type="password"';
                   echo ($this->readonly($k) ? ' disabled' : '');
                   echo ' name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="';
                   echo htmlspecialchars($row["qf$k"]),'"',$len_props,' />',"\n";
                 echo '</td>',"\n";                  echo '</td>',"\n";
         } /* }}} */          } /* }}} */
   
Line 1395  function '.$this->js['prefix'].'filter_h
Line 1407  function '.$this->js['prefix'].'filter_h
         {          {
                 // Note that <input disabled> isn't valid HTML, but most browsers support it                  // Note that <input disabled> isn't valid HTML, but most browsers support it
                 if($disabled == -1) return;                  if($disabled == -1) return;
                 $markdisabled = $disabled ? ' disabled="disabled"' : '';                  $markdisabled = $disabled ? ' disabled' : '';
                 $ret = '<input'.$markdisabled.' type="submit" class="'.$css_class_name                  $ret = '<input'.$markdisabled.' type="submit" class="'.$css_class_name
                         .'" name="'.$this->cgi['prefix']['sys'].ltrim($markdisabled).$name                          .'" name="'.$this->cgi['prefix']['sys'].ltrim($markdisabled).$name
                         .'" value="'.(isset($this->labels[$label]) ? $this->labels[$label] : $label);                          .'" value="'.(isset($this->labels[$label]) ? $this->labels[$label] : $label);
Line 1455  function '.$this->js['prefix'].'filter_h
Line 1467  function '.$this->js['prefix'].'filter_h
                                 $selected = explode(',', $selected);                                  $selected = explode(',', $selected);
                         }                          }
                 }                  }
                 $ret .= '"'.($readonly ? ' disabled="disabled"' : '').$js.'>'."\n";                  $ret .= '"'.($readonly ? ' disabled' : '')." $js>\n";
                 if (! is_array($selected)) {                  if (! is_array($selected)) {
                         $selected = $selected === null ? array() : array($selected);                          $selected = $selected === null ? array() : array($selected);
                 }                  }
Line 1511  function '.$this->js['prefix'].'filter_h
Line 1523  function '.$this->js['prefix'].'filter_h
                                 $found = true;                                  $found = true;
                         }                          }
                         if ($readonly) {                          if ($readonly) {
                                 $ret .= ' disabled="disabled"';                                  $ret .= ' disabled';
                         }                          }
                         $strip_tags && $value = strip_tags($value);                          $strip_tags && $value = strip_tags($value);
                         $escape     && $value = htmlspecialchars($value);                          $escape     && $value = htmlspecialchars($value);
Line 1774  function '.$this->js['prefix'].'filter_h
Line 1786  function '.$this->js['prefix'].'filter_h
         {          {
                 if (($but_str = $this->display_buttons($position)) === null)                  if (($but_str = $this->display_buttons($position)) === null)
                         return;                          return;
                 if($position == 'down') echo '<hr class="'.$this->getCSSclass('hr', 'down').'" />'."\n";                  if($position == 'down') echo '<hr size="1" class="'.$this->getCSSclass('hr', 'down').'" />'."\n";
                 echo '<table summary="navigation" class="',$this->getCSSclass('navigation', $position),'">',"\n";                  echo '<table summary="navigation" class="',$this->getCSSclass('navigation', $position),'">',"\n";
                 echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";                  echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";
                 echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";                  echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";
Line 1799  function '.$this->js['prefix'].'filter_h
Line 1811  function '.$this->js['prefix'].'filter_h
                         echo '&nbsp; ',$this->labels['Records'],':&nbsp;',$this->total_recs;                          echo '&nbsp; ',$this->labels['Records'],':&nbsp;',$this->total_recs;
                 if($this->display['num_pages'] || $this->display['num_records']) echo '</td>';                  if($this->display['num_pages'] || $this->display['num_records']) echo '</td>';
                 echo '</tr></table>',"\n";                  echo '</tr></table>',"\n";
                 if($position == 'up') echo '<hr class="'.$this->getCSSclass('hr', 'up').'" />'."\n";                  if($position == 'up') echo '<hr size="1" class="'.$this->getCSSclass('hr', 'up').'" />'."\n";
         } /* }}} */          } /* }}} */
   
         /*          /*
Line 1811  function '.$this->js['prefix'].'filter_h
Line 1823  function '.$this->js['prefix'].'filter_h
                         return;                          return;
                 if ($position == 'down') {                  if ($position == 'down') {
                         if ($this->tabs_enabled()) $this->display_tab_labels('down');                          if ($this->tabs_enabled()) $this->display_tab_labels('down');
                         echo '<hr class="',$this->getCSSclass('hr', 'down'),'" />',"\n";                          echo '<hr size="1" class="',$this->getCSSclass('hr', 'down'),'" />',"\n";
                 }                  }
                 echo '<table summary="navigation" class="',$this->getCSSclass('navigation', $position),'">',"\n";                  echo '<table summary="navigation" class="',$this->getCSSclass('navigation', $position),'">',"\n";
                 echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";                  echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";
Line 1825  function '.$this->js['prefix'].'filter_h
Line 1837  function '.$this->js['prefix'].'filter_h
                 echo '</tr></table>',"\n";                  echo '</tr></table>',"\n";
                 if ($position == 'up') {                  if ($position == 'up') {
                         if ($this->tabs_enabled()) $this->display_tab_labels('up');                          if ($this->tabs_enabled()) $this->display_tab_labels('up');
                         echo '<hr class="',$this->getCSSclass('hr', 'up'),'" />',"\n";                          echo '<hr size="1" class="',$this->getCSSclass('hr', 'up'),'" />',"\n";
                 }                  }
         } /* }}} */          } /* }}} */
   
Line 1980  function '.$this->js['prefix'].'filter_h
Line 1992  function '.$this->js['prefix'].'filter_h
                         echo '[<b>',htmlspecialchars($this->qfn),'</b>]';                          echo '[<b>',htmlspecialchars($this->qfn),'</b>]';
                         echo '[<b>',htmlspecialchars($this->prev_qfn),'</b>]<br />';                          echo '[<b>',htmlspecialchars($this->prev_qfn),'</b>]<br />';
                         echo 'comparsion <u>',($this->qfn == $this->prev_qfn ? 'proved' : 'failed'),'</u>';                          echo 'comparsion <u>',($this->qfn == $this->prev_qfn ? 'proved' : 'failed'),'</u>';
                         echo '<hr />';                          echo '<hr size="1" />';
                 }                  }
                 /*                  /*
                  * If user is allowed to Change/Delete records, we need an extra column                   * If user is allowed to Change/Delete records, we need an extra column
Line 2188  function '.$this->js['prefix'].'filter_h
Line 2200  function '.$this->js['prefix'].'filter_h
                                                 echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_id', $css_class_name,                                                  echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_id', $css_class_name,
                                                                 $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') {
                                                 $size_ml_props = '';                                                  $len_props = '';
                                                 $maxlen = intval($this->fdd[$k]['maxlen']);                                                  $maxlen = intval($this->fdd[$k]['maxlen']);
                                                 $maxlen > 0 || $maxlen = intval(@mysql_field_len($res, $fields["qf$k"]));                                                  $maxlen > 0 || $maxlen = intval(@mysql_field_len($res, $fields["qf$k"]));
                                                 $size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size']                                                  $size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size']
                                                         : ($maxlen < 30 ? min($maxlen, 8) : 12);                                                          : ($maxlen < 30 ? min($maxlen, 8) : 12);
                                                 $size   && $size_ml_props .= ' size="'.$size.'"';                                                  $len_props .= ' size="'.$size.'"';
                                                 $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';                                                  $len_props .= ' maxlength="'.$maxlen.'"';
                                                 if ($this->fdd[$fd]['select'] == 'N') {                                                  if ($this->fdd[$fd]['select'] == 'N') {
                                                         $mc = in_array($mc, $this->comp_ops) ? $mc : '=';                                                          $mc = in_array($mc, $this->comp_ops) ? $mc : '=';
                                                         echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_comp',                                                          echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_comp',
                                                                         $css_class_name, $this->comp_ops, $mc);                                                                          $css_class_name, $this->comp_ops, $mc);
                                                 }                                                  }
                                                 echo '<input class="',$css_class_name,'" value="',htmlspecialchars(@$m);                                                  echo '<input class="',$css_class_name,'" value="',htmlspecialchars(@$m);
                                                 echo '" type="text" name="'.$this->cgi['prefix']['sys'].'qf'.$k.'"',$size_ml_props;                                                  echo '" type="text" name="'.$this->cgi['prefix']['sys'].'qf'.$k.'"',$len_props;
                                                 echo ' onkeypress="return '.$this->js['prefix'].'filter_handler(this.form, event);" />';                                                  echo ' onkeypress="return '.$this->js['prefix'].'filter_handler(this.form, event);" />';
                                         } else {                                          } else {
                                                 echo '&nbsp;';                                                  echo '&nbsp;';
Line 2687  function '.$this->js['prefix'].'filter_h
Line 2699  function '.$this->js['prefix'].'filter_h
                 $oldvals = @mysql_fetch_array($res, MYSQL_ASSOC);                  $oldvals = @mysql_fetch_array($res, MYSQL_ASSOC);
                 @mysql_free_result($res);                  @mysql_free_result($res);
                 // Creating array of changed keys ($changed)                  // Creating array of changed keys ($changed)
                 $changed = array_keys($oldvals);                  $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', $oldvals, $changed, $newvals) == false) {
Line 2968  function '.$this->js['prefix'].'filter_h
Line 2980  function '.$this->js['prefix'].'filter_h
         {          {
                 echo '<h1>phpMyEdit error: ',htmlspecialchars($message),'</h1>',"\n";                  echo '<h1>phpMyEdit error: ',htmlspecialchars($message),'</h1>',"\n";
                 if ($additional_info != '') {                  if ($additional_info != '') {
                         echo '<hr />',htmlspecialchars($additional_info);                          echo '<hr size="1" />',htmlspecialchars($additional_info);
                 }                  }
                 return false;                  return false;
         } /* }}} */          } /* }}} */

Legend:
Removed from v.1.188  
changed lines
  Added in v.1.189

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