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

Diff for phpMyEdit/phpMyEdit.class.php between version 1.182 and 1.183

version 1.182, 2006/09/04 13:37:32 version 1.183, 2006/09/04 18:24:59
Line 19 
Line 19 
  * http://platon.sk/projects/phpMyEdit/   * http://platon.sk/projects/phpMyEdit/
  */   */
   
 /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.181 2006-06-21 18:12:05 nepto Exp $ */  /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.182 2006-09-04 13:37:32 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 188  class phpMyEdit
Line 188  class phpMyEdit
         function col_has_php($k)    { return isset($this->fdd[$k]['php']); }          function col_has_php($k)    { return isset($this->fdd[$k]['php']); }
         function col_has_URL($k)    { return isset($this->fdd[$k]['URL'])          function col_has_URL($k)    { return isset($this->fdd[$k]['URL'])
                 || isset($this->fdd[$k]['URLprefix']) || isset($this->fdd[$k]['URLpostfix']); }                  || isset($this->fdd[$k]['URLprefix']) || isset($this->fdd[$k]['URLpostfix']); }
           function col_has_multiple($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)
           { return $this->fdd[$k]['select'] == 'C' && ! $this->fdd[$k]['values']['table']; }
           function col_has_radio_buttons($k)
           { 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 641  class phpMyEdit
Line 647  class phpMyEdit
                                 if (in_array('*', $m)) {                                  if (in_array('*', $m)) {
                                         continue;                                          continue;
                                 }                                  }
                                 if ($this->col_has_values($k) && $this->col_has_multiple_select($k)) {                                  if ($this->col_has_values($k) && $this->col_has_multiple($k)) {
                                         foreach (array_keys($m) as $key) {                                          foreach (array_keys($m) as $key) {
                                                 $m[$key] = addslashes($m[$key]);                                                  $m[$key] = addslashes($m[$key]);
                                         }                                          }
Line 958  function '.$this->js['prefix'].'filter_h
Line 964  function '.$this->js['prefix'].'filter_h
                         if ($this->col_has_values($k)) {                          if ($this->col_has_values($k)) {
                                 $vals       = $this->set_values($k);                                  $vals       = $this->set_values($k);
                                 $selected   = @$this->fdd[$k]['default'];                                  $selected   = @$this->fdd[$k]['default'];
                                 $multiple   = $this->col_has_multiple_select($k);                                  $multiple   = $this->col_has_multiple($k);
                                 $readonly   = $this->readonly($k);                                  $readonly   = $this->readonly($k);
                                 $strip_tags = true;                                  $strip_tags = true;
                                 $escape     = true;                                  $escape     = true;
                                 echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name,                                  if ($this->col_has_checkboxes($k) || $this->col_has_radio_buttons($k)) {
                                                 $vals, $selected, $multiple, $readonly, $strip_tags, $escape);                                          echo $this->htmlRadioCheck($this->cgi['prefix']['data'].$this->fds[$k],
                                                           $css_class_name, $vals, $selected, $multiple, $readonly,
                                                           $strip_tags, $escape);
                                   } else {
                                           echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k],
                                                           $css_class_name, $vals, $selected, $multiple, $readonly,
                                                           $strip_tags, $escape);
                                   }
                         } 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' : '');                                  echo ($this->readonly($k) ? ' disabled' : '');
Line 1089  function '.$this->js['prefix'].'filter_h
Line 1102  function '.$this->js['prefix'].'filter_h
                 echo $this->getColAttributes($k),">\n";                  echo $this->getColAttributes($k),">\n";
                 if ($this->col_has_values($k)) {                  if ($this->col_has_values($k)) {
                         $vals       = $this->set_values($k);                          $vals       = $this->set_values($k);
                         $multiple   = $this->col_has_multiple_select($k);                          $multiple   = $this->col_has_multiple($k);
                         $readonly   = $this->readonly($k);                          $readonly   = $this->readonly($k);
                         $strip_tags = true;                          $strip_tags = true;
                         $escape     = true;                          $escape     = true;
                         echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name,                          if ($this->col_has_checkboxes($k) || $this->col_has_radio_buttons($k)) {
                                         $vals, $row["qf$k"], $multiple, $readonly, $strip_tags, $escape);                                  echo $this->htmlRadioCheck($this->cgi['prefix']['data'].$this->fds[$k],
                                                   $css_class_name, $vals, $row["qf$k"], $multiple, $readonly,
                                                   $strip_tags, $escape);
                           } else {
                                   echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k],
                                                   $css_class_name, $vals, $row["qf$k"], $multiple, $readonly,
                                                   $strip_tags, $escape);
                           }
                 } 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' : '');                          echo ($this->readonly($k) ? ' disabled' : '');
Line 1441  function '.$this->js['prefix'].'filter_h
Line 1461  function '.$this->js['prefix'].'filter_h
                 return $ret;                  return $ret;
         } /* }}} */          } /* }}} */
   
           /**
            * Creates HTML checkboxes or radio buttons
            *
            * @param       name            element name
            * @param       css                     CSS class name
            * @param       kv_array        key => value array
            * @param       selected        selected key (it can be single string, array of
            *                                              keys or multiple values separated by comma)
            * @param       multiple        bool for multiple selection (checkboxes)
            * @param       readonly        bool for readonly/disabled selection
            * @param       strip_tags      bool for stripping tags from values
            * @param       escape          bool for HTML escaping values
            * @param       js              string to be in the <select >, ususally onChange='..';
            */
           function htmlRadioCheck($name, $css, $kv_array, $selected = null, /* ...) {{{ */
                           /* booleans: */ $multiple = false, $readonly = false, $strip_tags = false, $escape = true, $js = NULL)
           {
                   $ret = '';
                   if ($multiple) {
                           if (! is_array($selected) && $selected !== null) {
                                   $selected = explode(',', $selected);
                           }
                   }
                   if (! is_array($selected)) {
                           $selected = $selected === null ? array() : array($selected);
                   }
                   $found = false;
                   foreach ($kv_array as $key => $value) {
                           $ret .= '<input type="'.($multiple ? 'checkbox' : 'radio').'" name="';
                           $ret .= htmlspecialchars($name).'[]" value="'.htmlspecialchars($key).'"';
                           if ((! $found || $multiple) && in_array((string) $key, $selected, 1)
                                           || (count($selected) == 0 && ! $found && ! $multiple)) {
                                   $ret  .= ' checked';
                                   $found = true;
                           }
                           if ($readonly) {
                                   $ret .= ' disabled';
                           }
                           $strip_tags && $value = strip_tags($value);
                           $escape     && $value = htmlspecialchars($value);
                           $ret .= '>'.$value.'<br>'."\n";
                   }
                   return $ret;
           } /* }}} */
   
     /**      /**
      * Returns original variables HTML code for use in forms or links.       * Returns original variables HTML code for use in forms or links.
      *       *

Legend:
Removed from v.1.182  
changed lines
  Added in v.1.183

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