version 1.93, 2003/08/16 14:01:17 |
version 1.94, 2003/08/18 20:31:58 |
|
|
* http://www.platon.sk/projects/phpMyEdit/ |
* http://www.platon.sk/projects/phpMyEdit/ |
*/ |
*/ |
|
|
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.92 2003/08/16 01:41:26 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.93 2003/08/16 14:01:17 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. |
|
|
return $values; |
return $values; |
} /* }}} */ |
} /* }}} */ |
|
|
/* |
function fqn($field, $dont_desc = false, $dont_cols = false) /* {{{ */ |
* get the table/field name |
|
*/ |
|
function fqn($field, $use_qfx = false, $dont_desc = false, $dont_cols = false) /* {{{ */ |
|
{ |
{ |
is_numeric($field) || $field = array_search($field, $this->fds); |
is_numeric($field) || $field = array_search($field, $this->fds); |
// use_qfx |
// if read SQL expression exists use it |
if ($use_qfx) |
if (isset($this->fdd[$field]['sql'])) |
return 'qf'.$field; |
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() |
|| $this->copy_operation() |
|| $this->copy_operation() |
|| $this->change_operation()) { |
|| $this->change_operation()) { |
$ret = 'PMEtable0.'.$this->fds[$field]; |
$ret = 'PMEtable0.'.$this->fds[$field]; |
} else { |
} else { |
if (isset($this->fdd[$field]['sql'])) { |
if ($this->fdd[$this->fds[$field]]['values']['description'] && ! $dont_desc) { |
$ret = $this->fdd[$field]['sql']; |
|
} elseif ($this->fdd[$this->fds[$field]]['values']['description'] && ! $dont_desc) { |
|
$desc = &$this->fdd[$this->fds[$field]]['values']['description']; |
$desc = &$this->fdd[$this->fds[$field]]['values']['description']; |
if (is_array($desc) && is_array($desc['columns'])) { |
if (is_array($desc) && is_array($desc['columns'])) { |
$ret = 'CONCAT('; // ) |
$ret = 'CONCAT('; // ) |
|
|
} |
} |
$fields[] = $this->fqn($k).' AS qf'.$k; |
$fields[] = $this->fqn($k).' AS qf'.$k; |
if ($this->col_has_values($k)) { |
if ($this->col_has_values($k)) { |
$fields[] = $this->fqn($k, false, true, true).' AS qf'.$k.'_idx'; |
$fields[] = $this->fqn($k, true, true).' AS qf'.$k.'_idx'; |
} |
} |
if ($this->col_has_datemask($k)) { |
if ($this->col_has_datemask($k)) { |
$fields[] = 'UNIX_TIMESTAMP('.$this->fqn($k).') AS qf'.$k.'_timestamp'; |
$fields[] = 'UNIX_TIMESTAMP('.$this->fqn($k).') AS qf'.$k.'_timestamp'; |
|
|
// XXX: $dont_desc and $dont_cols hack |
// XXX: $dont_desc and $dont_cols hack |
$dont_desc = isset($this->fdd[$k]['values']['description']); |
$dont_desc = isset($this->fdd[$k]['values']['description']); |
$dont_cols = isset($this->fdd[$k]['values']['column']); |
$dont_cols = isset($this->fdd[$k]['values']['column']); |
$qo[$this->fqn($k, false, $dont_desc, $dont_cols)] = |
$qo[$this->fqn($k, $dont_desc, $dont_cols)] = |
array('oper' => $qf_op, 'value' => "($qf_val)"); // ) |
array('oper' => $qf_op, 'value' => "($qf_val)"); // ) |
} |
} |
} else if (isset($mi)) { |
} else if (isset($mi)) { |
|
|
continue; |
continue; |
} |
} |
$afilter = addslashes($mi); |
$afilter = addslashes($mi); |
$qo[$this->fqn($k, false, true, true)] = array('oper' => '=', 'value' => "'$afilter'"); |
$qo[$this->fqn($k, true, true)] = array('oper' => '=', 'value' => "'$afilter'"); |
$this->qfn .= '&'.$li.'='.rawurlencode($mi); |
$this->qfn .= '&'.$li.'='.rawurlencode($mi); |
} else if (isset($m)) { |
} else if (isset($m)) { |
if ($m == '*') { |
if ($m == '*') { |
|
|
} |
} |
} |
} |
if (count($ids) > 0) { |
if (count($ids) > 0) { |
$ar[$this->fqn($k, false, true, true)] |
$ar[$this->fqn($k, true, true)] |
= array('oper' => 'IN', 'value' => '('.join(',', $ids).')'); |
= array('oper' => 'IN', 'value' => '('.join(',', $ids).')'); |
} |
} |
} |
} |