Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Monday, November 30, 2026

Diff for Metafox/lib/phpMyEdit/phpMyEdit.class.php between version 1.5 and 1.6

version 1.5, 2007/09/02 23:08:44 version 1.6, 2007/09/16 20:15:42
Line 19 
Line 19 
  * http://platon.sk/projects/phpMyEdit/   * http://platon.sk/projects/phpMyEdit/
  */   */
   
 /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.199 2007-09-02 21:48:32 nepto Exp $ */  /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.204 2007-09-16 12:57:07 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 394  class phpMyEdit
Line 394  class phpMyEdit
   
                 // try the full language w/ variant                  // try the full language w/ variant
                 $file = $this->dir['lang'].'PME.lang.'.$language.'.inc';                  $file = $this->dir['lang'].'PME.lang.'.$language.'.inc';
                   while (! file_exists($file)) {
                 if (! file_exists($file)) {                          $pos = strrpos($language, '-');
                         // try the language w/o variant                          if ($pos === false) {
                         $file = $this->dir['lang'].'PME.lang.'.substr($language,0,2).'.inc';                                  $file = $this->dir['lang'].'PME.lang.EN.inc';
                 }                                  break;
                 if (! file_exists($file)) {                          }
                         // default to classical English                          $language = substr($language, 0, $pos);
                         $file = $this->dir['lang'].'PME.lang.EN.inc';                          $file = $this->dir['lang'].'PME.lang.'.$language.'.inc';
                 }                  }
                 $ret = @include($file);                  $ret = @include($file);
                 if (! is_array($ret)) {                  if (! is_array($ret)) {
Line 495  class phpMyEdit
Line 495  class phpMyEdit
         {          {
                 is_numeric($field) || $field = array_search($field, $this->fds);                  is_numeric($field) || $field = array_search($field, $this->fds);
                 // if read SQL expression exists use it                  // if read SQL expression exists use it
                 if ($this->col_has_sql($field))                  if ($this->col_has_sql($field) && !$this->col_has_values($field))
                         return $this->fdd[$field]['sql'];                          return $this->fdd[$field]['sql'];
                 // on copy/change always use simple key retrieving                  // on copy/change always use simple key retrieving
                 if ($this->add_operation()                  if ($this->add_operation()
Line 524  class phpMyEdit
Line 524  class phpMyEdit
                                 } else if (is_array($desc)) {                                  } else if (is_array($desc)) {
                                         // TODO                                          // TODO
                                 } else {                                  } else {
                                         $ret = 'PMEjoin'.$field.'.'.$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                          // TODO: remove me
                         } elseif (0 && $this->fdd[$this->fds[$field]]['values']['column'] && ! $dont_cols) {                          } elseif (0 && $this->fdd[$this->fds[$field]]['values']['column'] && ! $dont_cols) {
                                 $ret = 'PMEjoin'.$field.'.'.$this->fdd[$this->fds[$field]]['values']['column'];                                  $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;
                         }                          }
Line 567  class phpMyEdit
Line 567  class phpMyEdit
                                 if ($parts['orderby'] != '')                                  if ($parts['orderby'] != '')
                                         $ret .= ' ORDER BY '.$parts['orderby'];                                          $ret .= ' ORDER BY '.$parts['orderby'];
                                 if ($parts['limit'] != '')                                  if ($parts['limit'] != '')
                                         $ret .= ' LIMIT '.$parts['limit'];                                          $ret .= ' '.$parts['limit'];
                                 if ($parts['procedure'] != '')                                  if ($parts['procedure'] != '')
                                         $ret .= ' PROCEDURE '.$parts['procedure'];                                          $ret .= ' PROCEDURE '.$parts['procedure'];
                                 break;                                  break;
Line 602  class phpMyEdit
Line 602  class phpMyEdit
                         }                          }
                         $fields[] = $this->fqn($k).' AS '.$this->sd.'qf'.$k.$this->ed; // no delimiters here, or maybe some yes                          $fields[] = $this->fqn($k).' AS '.$this->sd.'qf'.$k.$this->ed; // no delimiters here, or maybe some yes
                         if ($this->col_has_values($k)) {                          if ($this->col_has_values($k)) {
                                 $fields[] = $this->fqn($k, true, true).' AS '.$this->sd.'qf'.$k.'_idx'.$this->ed;                                  if($this->col_has_sql($k)) $fields[] = $this->fdd[$k]['sql'].' AS '.$this->sd.'qf'.$k.'_idx'.$this->ed;
                                   else $fields[] = $this->fqn($k, true, true).' AS '.$this->sd.'qf'.$k.'_idx'.$this->ed;
                         }                          }
                         if ($this->col_has_datemask($k)) {                          if ($this->col_has_datemask($k)) {
                                 $fields[] = 'UNIX_TIMESTAMP('.$this->fqn($k).') AS '.$this->sd.'qf'.$k.'_timestamp'.$this->ed;                                  $fields[] = 'UNIX_TIMESTAMP('.$this->fqn($k).') AS '.$this->sd.'qf'.$k.'_timestamp'.$this->ed;
Line 620  class phpMyEdit
Line 621  class phpMyEdit
                         if($this->fdd[$main_column]['values']['db']) {                          if($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;
                         }                          }
                         $table       = $this->sd.$this->fdd[$main_column]['values']['table'].$this->ed;                          $table       = $this->sd.$this->fdd[$main_column]['values']['table'].$this->ed;
                         $join_column = $this->sd.$this->fdd[$main_column]['values']['column'].$this->ed;                          $join_column = $this->sd.$this->fdd[$main_column]['values']['column'].$this->ed;
Line 637  class phpMyEdit
Line 638  class phpMyEdit
                                 $join_clause .= isset($this->fdd[$main_column]['values']['join'])                                  $join_clause .= isset($this->fdd[$main_column]['values']['join'])
                                         ? $this->substituteVars($this->fdd[$main_column]['values']['join'], $ar)                                          ? $this->substituteVars($this->fdd[$main_column]['values']['join'], $ar)
                                         : "$join_table.$join_column = $main_table.".$this->sd.$main_column.$this->ed;                                          : "$join_table.$join_column = $main_table.".$this->sd.$main_column.$this->ed;
                                 if (isset($this->fdd[$main_column]['values']['filters'])) {  
                                         $join_clause .= ' AND ';  
                                         $join_clause .= $this->substituteVars($this->fdd[$main_column]['values']['filters'], $ar);  
                                 }  
                                 $join_clause .= ')';                                  $join_clause .= ')';
                         }                          }
                 }                  }
Line 1537  function '.$this->js['prefix'].'filter_h
Line 1534  function '.$this->js['prefix'].'filter_h
                 }                  }
                 $ret .= '"'.($readonly ? ' 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((string)$selected);
                   } else {
                           foreach($selected as $val) $selecte2[]=(string)$val;
                           $selected = $selected2;
                 }                  }
                 $found = false;                  $found = false;
                 foreach ($kv_array as $key => $value) {                  foreach ($kv_array as $key => $value) {
                         $ret .= '<option value="'.htmlspecialchars($key).'"';                          $ret .= '<option value="'.htmlspecialchars($key).'"';
                         if ((! $found || $multiple) && in_array(/* (string) see #446 */ $key, $selected, 1)                          if ((! $found || $multiple) && in_array((string)$key, $selected, 1)
                                         || (count($selected) == 0 && ! $found && ! $multiple)) {                                          || (count($selected) == 0 && ! $found && ! $multiple)) {
                                 $ret  .= ' selected="selected"';                                  $ret  .= ' selected="selected"';
                                 $found = true;                                  $found = true;

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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