| version 1.63, 2003/03/29 15:41:18 |
version 1.64, 2003/03/30 01:12:30 |
|
|
| * http://www.platon.sk/projects/phpMyEdit/ |
* http://www.platon.sk/projects/phpMyEdit/ |
| */ |
*/ |
| |
|
| /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.62 2003/03/29 01:44:53 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.63 2003/03/29 15:41:18 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. |
|
|
| */ |
*/ |
| |
|
| function col_has_values($k) { return isset($this->fdd[$k]['values']) || isset($this->fdd[$k]['values2']); } |
function col_has_values($k) { return isset($this->fdd[$k]['values']) || isset($this->fdd[$k]['values2']); } |
| |
function col_has_URL($k) { return isset($this->fdd[$k]['URL']) |
| |
|| isset($this->fdd[$k]['URLprefix']) || isset($this->fdd[$k]['URLpostfix']); } |
| |
|
| /* |
/* |
| * functions for indicating whether navigation style is enabled |
* functions for indicating whether navigation style is enabled |
|
|
| if (isset($this->fdd[$field]['expression'])) { |
if (isset($this->fdd[$field]['expression'])) { |
| $ret = $this->fdd[$field]['expression']; |
$ret = $this->fdd[$field]['expression']; |
| } elseif ($this->fdd[$this->fds[$field]]['values']['description'] && ! $dont_desc) { |
} elseif ($this->fdd[$this->fds[$field]]['values']['description'] && ! $dont_desc) { |
| // Changed 06/08/02 Shaun Johnston |
|
| $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('; // ) |
|
|
| 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, false, true, true).' AS qf'.$k.'_idx'; |
| } |
} |
| |
if (@$this->fdd[$k]['datemask']) { |
| |
$fields[] = 'UNIX_TIMESTAMP('.$this->fqn($k).') AS qf'.$k.'_timestamp'; |
| |
} |
| } |
} |
| return join(',', $fields); |
return join(',', $fields); |
| } /* }}} */ |
} /* }}} */ |
| Line 931 function phpMyEdit_form_control(theForm) |
|
| Line 935 function phpMyEdit_form_control(theForm) |
|
| |
|
| function display_delete_field($row, $k) /* {{{ */ |
function display_delete_field($row, $k) /* {{{ */ |
| { |
{ |
| echo '<td class="',$this->getCSSclass('value', '', true),'">'; |
$css_class_name = $this->getCSSclass('value', '', true); |
| if ($this->is_values2($k, $row["qf$k"])) { |
echo '<td class="',$css_class_name,'">'; |
| echo nl2br($this->htmlDisplay($k, $this->fdd[$k]['values2'][$row['qf'.$k.'_idx']], |
if (@$this->fdd[$k]['datemask']) { |
| true, true, true, false)); |
$value = $row["qf$k".'_timestamp']; |
| |
$value = @date($this->fdd[$k]['datemask'], $value); |
| |
} else if (@$this->fdd[$k]['strftimemask']) { |
| |
$value = $row["qf$k".'_timestamp']; |
| |
$value = @strftime($this->fdd[$k]['strftimemask'], $value); |
| |
} else if ($this->is_values2($k, $row["qf$k"])) { |
| |
$value = $this->fdd[$k]['values2'][$row['qf'.$k.'_idx']]; |
| |
} else { |
| |
$value = $row["qf$k"]; |
| |
} |
| |
$value = $this->htmlDisplay($this->fdd[$k], $value, true, true, true, false); |
| |
if ($this->col_has_URL($k)) { |
| |
$key_rec = $row['qf'.$this->key_num]; |
| |
echo $this->urlDisplay($k, $value, $css_class_name, $key_rec); |
| } else { |
} else { |
| echo nl2br($this->htmlDisplay($this->fdd[$k], $row["qf$k"])); |
echo nl2br(htmlspecialchars($value)); |
| } |
} |
| echo '</td>',"\n"; |
echo '</td>',"\n"; |
| } /* }}} */ |
} /* }}} */ |
| Line 979 function phpMyEdit_form_control(theForm) |
|
| Line 996 function phpMyEdit_form_control(theForm) |
|
| } /* }}} */ |
} /* }}} */ |
| |
|
| /** |
/** |
| |
* Print URL |
| |
*/ |
| |
function urlDisplay($k, $value, $css, $key) /* {{{ */ |
| |
{ |
| |
$ret = ''; |
| |
$name = $this->fds[$k]; |
| |
$page = $this->page_name; |
| |
$url = 'rec='.$key.'&fm='.$this->fm.'&fl='.$this->fl; |
| |
$url .= '&qfn='.rawurlencode($this->qfn).$this->qfn; |
| |
$url .= '&'.$this->get_sfn_cgi_vars().$this->cgi['persist']; |
| |
$urllink = isset($this->fdd[$k]['URL']) |
| |
? eval('return "'.$this->fdd[$k]['URL'].'";') |
| |
: $value; |
| |
$urldisp = isset($this->fdd[$k]['URLdisp']) |
| |
? eval('return "'.$this->fdd[$k]['URLdisp'].'";') |
| |
: $value; |
| |
$target = isset($this->fdd[$k]['URLtarget']) |
| |
? 'target="'.htmlspecialchars($this->fdd[$k]['URLtarget']).'" ' |
| |
: ''; |
| |
$prefix = @$this->fdd[$k]['URLprefix']; |
| |
$postfix = @$this->fdd[$k]['URLpostfix']; |
| |
if (strlen($prefix) > 0 && strncmp($prefix, $urllink, strlen($prefix))) { |
| |
$urllink = $prefix.$urllink; |
| |
} |
| |
if (strlen($postfix) > 0 && strcmp($postfix, substr($urllink, -strlen($postfix)))) { |
| |
$urllink .= $postfix; |
| |
} |
| |
if (strlen($urllink) <= 0 || strlen($urldisp) <= 0) { |
| |
$ret = ' '; |
| |
} else { |
| |
$urllink = htmlspecialchars($urllink); |
| |
$urldisp = htmlspecialchars($urldisp); |
| |
$ret = '<a '.$target.'class="'.$css.'" href="'.$urllink.'">'.$urldisp.'</a>'; |
| |
} |
| |
return $ret; |
| |
} /* }}} */ |
| |
|
| |
/** |
| * Creates HTML hidden input element |
* Creates HTML hidden input element |
| * |
* |
| * @param name element name |
* @param name element name |
| Line 1814 function phpMyEdit_form_control(theForm) |
|
| Line 1869 function phpMyEdit_form_control(theForm) |
|
| echo '<td class="',$css_class_name,'" colspan=',$sys_cols,'> </td>',"\n"; |
echo '<td class="',$css_class_name,'" colspan=',$sys_cols,'> </td>',"\n"; |
| } |
} |
| } |
} |
| // Calculate the url query string for optional URL support |
|
| $urlqueryproto = 'fm='.$this->fm |
|
| .'&sfn='.$this->get_sfn_cgi_vars() |
|
| .'&fl='.$this->fl |
|
| .'&qfn='.$this->qfn; |
|
| for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
| $fd = $this->fds[$k]; |
$fd = $this->fds[$k]; |
| if (! $this->displayed[$k]) { |
if (! $this->displayed[$k]) { |
| Line 1833 function phpMyEdit_form_control(theForm) |
|
| Line 1883 function phpMyEdit_form_control(theForm) |
|
| $colattrs = @$this->fdd[$fd]['colattrs']; |
$colattrs = @$this->fdd[$fd]['colattrs']; |
| if ($colattrs != '') |
if ($colattrs != '') |
| $colattrs = ' '.$colattrs; |
$colattrs = ' '.$colattrs; |
| if ($this->fdd[$fd]['nowrap']) |
if (@$this->fdd[$fd]['nowrap']) |
| $colattrs .= ' nowrap'; |
$colattrs .= ' nowrap'; |
| if (isset($this->fdd[$fd]['width'])) { |
if (isset($this->fdd[$fd]['width'])) { |
| $colattrs .= ' width="'.$this->fdd[$fd]['width'].'"'; |
$colattrs .= ' width="'.$this->fdd[$fd]['width'].'"'; |
| } |
} |
| echo '<td class="',$css_class_name,'"',$colattrs,'>'; |
echo '<td class="',$css_class_name,'"',$colattrs,'>'; |
| // displayable |
if (@$this->fdd[$k]['datemask']) { |
| if (isset($this->fdd[$k]['URL']) |
$value = $row["qf$k".'_timestamp']; |
| || isset($this->fdd[$k]['URLprefix']) |
$value = @date($this->fdd[$k]['datemask'], $value); |
| || isset($this->fdd[$k]['URLpostfix'])) { |
} else if (@$this->fdd[$k]['strftimemask']) { |
| /* It's an URL |
$value = $row["qf$k".'_timestamp']; |
| Put some conveniences in the namespace for the user |
$value = @strftime($this->fdd[$k]['strftimemask'], $value); |
| to be able to use in the URL string. */ |
} else if ($this->is_values2($k, $row["qf$k"])) { |
| $key = $key_rec; |
$value = $this->fdd[$k]['values2'][$row['qf'.$k.'_idx']]; |
| $name = $this->fds[$k]; |
|
| $value = $row["qf$k"]; |
|
| $page = $this->page_name; |
|
| $urlstr = $urlqueryproto.'&rec='.$key.$this->cgi['persist']; |
|
| $urllink = isset($this->fdd[$k]['URL']) |
|
| ? eval('return "'.$this->fdd[$k]['URL'].'";') |
|
| : $value; |
|
| $urldisp = isset($this->fdd[$k]['URLdisp']) |
|
| ? eval('return "'.$this->fdd[$k]['URLdisp'].'";') |
|
| : $value; |
|
| $target = isset($this->fdd[$k]['URLtarget']) |
|
| ? 'target="'.htmlspecialchars($this->fdd[$k]['URLtarget']).'" ' |
|
| : ''; |
|
| isset($this->fdd[$k]['URLprefix']) && $urllink = $this->fdd[$k]['URLprefix'].$urllink; |
|
| isset($this->fdd[$k]['URLpostfix']) && $urllink .= $this->fdd[$k]['URLpostfix']; |
|
| if (strlen($urllink) <= 0 || strlen($urldisp) <= 0) { |
|
| echo ' '; |
|
| } else { |
|
| $urllink = htmlspecialchars($urllink); |
|
| $urldisp = htmlspecialchars($urldisp); |
|
| echo '<a ',$target,'class="',$css_class_name,'" href="',$urllink,'">',$urldisp,'</a>'; |
|
| } |
|
| } elseif (isset($this->fdd[$k]['datemask'])) { |
|
| $shortdisp = $row["qf$k"]; |
|
| if ($this->fdd[$k]['strip_tags']) { |
|
| $shortdisp = strip_tags($shortdisp); |
|
| } |
|
| if (isset($this->fdd[$k]['trimlen']) |
|
| && strlen($shortdisp) > $this->fdd[$k]['trimlen']) { |
|
| $shortdisp = ereg_replace("[\r\n\t ]+", ' ', $shortdisp); |
|
| $shortdisp = substr($shortdisp,0,$this->fdd[$k]['trimlen']-3).'...'; |
|
| } |
|
| echo nl2br($this->htmlDisplay($this->fdd[$k], $shortdisp)); |
|
| } else { |
} else { |
| // it's a normal field |
$value = $row["qf$k"]; |
| if ($this->is_values2($k, $row["qf$k"])) { |
if (@$this->fdd[$k]['strip_tags']) { |
| $escape_flag = false; |
$value = strip_tags($value); |
| $shortdisp = $this->fdd[$k]['values2'][$row['qf'.$k.'_idx']]; |
|
| } else { |
|
| $escape_flag = true; |
|
| $shortdisp = $row["qf$k"]; |
|
| if ($this->fdd[$k]['strip_tags']) { |
|
| $shortdisp = strip_tags($shortdisp); |
|
| } |
|
| if (isset($this->fdd[$k]['trimlen']) |
|
| && strlen($shortdisp) > $this->fdd[$k]['trimlen']) { |
|
| $shortdisp = ereg_replace("[\r\n\t ]+",' ',$shortdisp); |
|
| $shortdisp = substr($shortdisp,0,$this->fdd[$k]['trimlen']-3).'...'; |
|
| } |
|
| } |
} |
| echo nl2br($this->htmlDisplay($this->fdd[$k], $shortdisp, |
} |
| true, true, true, $escape_flag)); |
if (isset($this->fdd[$k]['trimlen']) && strlen($value) > $this->fdd[$k]['trimlen']) { |
| |
$value = ereg_replace("[\r\n\t ]+",' ',$value); |
| |
$value = substr($value,0,$this->fdd[$k]['trimlen']-3).'...'; |
| |
} |
| |
$value = $this->htmlDisplay($this->fdd[$k], $value, true, true, true, false); |
| |
if ($this->col_has_URL($k)) { |
| |
echo $this->urlDisplay($k, $value, $css_class_name, $key_rec); |
| |
} else { |
| |
echo nl2br(htmlspecialchars($value)); |
| } |
} |
| echo '</td>'."\n"; |
echo '</td>'."\n"; |
| } |
} |
| Line 2017 function phpMyEdit_form_control(theForm) |
|
| Line 2030 function phpMyEdit_form_control(theForm) |
|
| } |
} |
| } |
} |
| $vals_quoted = array(); |
$vals_quoted = array(); |
| $values = array(); |
$newvals = array(); |
| for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
| if ($this->processed($k)) { |
if ($this->processed($k)) { |
| if ($this->readonly($k)) { |
if ($this->readonly($k)) { |
| Line 2025 function phpMyEdit_form_control(theForm) |
|
| Line 2038 function phpMyEdit_form_control(theForm) |
|
| } else { |
} else { |
| $fn = $this->get_cgi_var($this->fds[$k]); |
$fn = $this->get_cgi_var($this->fds[$k]); |
| } |
} |
| $values[$this->fds[$k]] = is_array($fn) ? join(',',$fn) : $fn; |
$newvals[$this->fds[$k]] = is_array($fn) ? join(',',$fn) : $fn; |
| $vals_quoted[$k] = addslashes($this->encode($this->fdd[$k],$values[$this->fds[$k]])); |
$vals_quoted[$k] = addslashes($this->encode($this->fdd[$k],$newvals[$this->fds[$k]])); |
| $vals_quoted[$k] = "'".$vals_quoted[$k]."'"; |
$vals_quoted[$k] = "'".$vals_quoted[$k]."'"; |
| } |
} |
| } |
} |
| Line 2046 function phpMyEdit_form_control(theForm) |
|
| Line 2059 function phpMyEdit_form_control(theForm) |
|
| } |
} |
| // Notify list |
// Notify list |
| if (@$this->notify['insert'] || @$this->notify['all']) { |
if (@$this->notify['insert'] || @$this->notify['all']) { |
| $this->email_notify(false, $values); |
$this->email_notify(false, $newvals); |
| } |
} |
| // Note change in log table |
// Note change in log table |
| if ($this->logtable) { |
if ($this->logtable) { |
| Line 2055 function phpMyEdit_form_control(theForm) |
|
| Line 2068 function phpMyEdit_form_control(theForm) |
|
| .' VALUES (NOW(), "%s", "%s", "insert", "%s", "%s", "", "", "%s")', |
.' VALUES (NOW(), "%s", "%s", "insert", "%s", "%s", "", "", "%s")', |
| $this->logtable, addslashes($this->get_server_var('REMOTE_USER')), |
$this->logtable, addslashes($this->get_server_var('REMOTE_USER')), |
| addslashes($this->get_server_var('REMOTE_ADDR')), addslashes($this->tb), |
addslashes($this->get_server_var('REMOTE_ADDR')), addslashes($this->tb), |
| addslashes($key_col_val), addslashes(serialize($values))); |
addslashes($key_col_val), addslashes(serialize($newvals))); |
| $this->myquery($query, __LINE__); |
$this->myquery($query, __LINE__); |
| } |
} |
| // After trigger |
// After trigger |
| Line 2070 function phpMyEdit_form_control(theForm) |
|
| Line 2083 function phpMyEdit_form_control(theForm) |
|
| |
|
| function do_change_record() /* {{{ */ |
function do_change_record() /* {{{ */ |
| { |
{ |
| // Before trigger |
|
| if (isset($this->triggers['update']['before'])) { |
|
| $ret = include($this->triggers['update']['before']); |
|
| if ($ret == false) { |
|
| return false; |
|
| } |
|
| } |
|
| // Preparing queries |
// Preparing queries |
| $query_real = ''; |
$query_real = ''; |
| $query_oldrec = ''; |
$query_oldrec = ''; |
| Line 2087 function phpMyEdit_form_control(theForm) |
|
| Line 2093 function phpMyEdit_form_control(theForm) |
|
| $key_col_val = addslashes($this->get_cgi_var($fd)); |
$key_col_val = addslashes($this->get_cgi_var($fd)); |
| } |
} |
| $fn = $this->get_cgi_var($fd); |
$fn = $this->get_cgi_var($fd); |
| $newValue = is_array($fn) ? join(',',$fn) : $fn; |
$newValue = $newvals[$this->fds[$k]] = is_array($fn) ? join(',',$fn) : $fn; |
| $newValue = addslashes($this->encode($this->fdd[$k], $newValue)); |
$newValue = addslashes($this->encode($this->fdd[$k], $newValue)); |
| if ($query_real == '') { |
if ($query_real == '') { |
| $query_real = 'UPDATE '.$this->tb.' SET '.$fd.'=\''.$newValue.'\''; |
$query_real = 'UPDATE '.$this->tb.' SET '.$fd.'=\''.$newValue.'\''; |
| Line 2096 function phpMyEdit_form_control(theForm) |
|
| Line 2102 function phpMyEdit_form_control(theForm) |
|
| $query_real .= ','.$fd.'=\''.$newValue.'\''; |
$query_real .= ','.$fd.'=\''.$newValue.'\''; |
| $query_oldrec .= ','.$fd; |
$query_oldrec .= ','.$fd; |
| } |
} |
| $newvalues[$this->fds[$k]] = $fn; |
|
| } |
} |
| } |
} |
| $where_part = " WHERE (".$this->key.'='.$this->key_delim.$this->rec.$this->key_delim.')'; |
$where_part = " WHERE (".$this->key.'='.$this->key_delim.$this->rec.$this->key_delim.')'; |
| $query_real .= $where_part; |
$query_real .= $where_part; |
| $query_oldrec .= ' FROM ' . $this->tb . $where_part; |
$query_oldrec .= ' FROM ' . $this->tb . $where_part; |
| // Additional query (must go before real query) |
// Additional query (must go before real query) |
| if (@$this->notify['update'] || @$this->notify['all'] || $this->logtable) { |
$res_old = $this->myquery($query_oldrec, __LINE__); |
| $res_old = $this->myquery($query_oldrec, __LINE__); |
$oldvals = @mysql_fetch_array($res_old, MYSQL_ASSOC); |
| $oldvalues = @mysql_fetch_array($res_old, MYSQL_ASSOC); |
@mysql_free_result($res); |
| for ($k = 0; $k < $this->num_fds; $k++) { |
// Before trigger |
| if (is_array(@$newvalues[$this->fds[$k]])) { |
if (isset($this->triggers['update']['before'])) { |
| $newvalues[$this->fds[$k]] = join(',', $newvalues[$this->fds[$k]]); |
$ret = include($this->triggers['update']['before']); |
| } |
if ($ret == false) { |
| if (! $this->processed($k) || $this->readonly($k) |
return false; |
| || $oldvalues[$this->fds[$k]] == $newvalues[$this->fds[$k]]) { |
} |
| // Removing the same values |
} |
| unset($oldvalues[$this->fds[$k]]); |
// Removing the same values |
| unset($newvalues[$this->fds[$k]]); |
for ($k = 0; $k < $this->num_fds; $k++) { |
| } |
if (! $this->processed($k) || $this->readonly($k) |
| |
|| $oldvals[$this->fds[$k]] == $newvals[$this->fds[$k]]) { |
| |
unset($oldvals[$this->fds[$k]]); |
| |
unset($newvals[$this->fds[$k]]); |
| } |
} |
| } |
} |
| // Real query |
// Real query |
| Line 2126 function phpMyEdit_form_control(theForm) |
|
| Line 2134 function phpMyEdit_form_control(theForm) |
|
| } |
} |
| // Notify list |
// Notify list |
| if (@$this->notify['update'] || @$this->notify['all']) { |
if (@$this->notify['update'] || @$this->notify['all']) { |
| $this->email_notify($oldvalues, $newvalues); |
$this->email_notify($oldvals, $newvals); |
| } |
} |
| // Note change in log table |
// Note change in log table |
| if ($this->logtable) { |
if ($this->logtable) { |
| foreach (array_keys($newvalues) as $key) { |
foreach (array_keys($newvals) as $key) { |
| $qry = sprintf('INSERT INTO %s' |
$qry = sprintf('INSERT INTO %s' |
| .' (updated, user, host, operation, tab, rowkey, col, oldval, newval)' |
.' (updated, user, host, operation, tab, rowkey, col, oldval, newval)' |
| .' VALUES (NOW(), "%s", "%s", "update", "%s", "%s", "%s", "%s", "%s")', |
.' VALUES (NOW(), "%s", "%s", "update", "%s", "%s", "%s", "%s", "%s")', |
| $this->logtable, addslashes($this->get_server_var('REMOTE_USER')), |
$this->logtable, addslashes($this->get_server_var('REMOTE_USER')), |
| addslashes($this->get_server_var('REMOTE_ADDR')), addslashes($this->tb), |
addslashes($this->get_server_var('REMOTE_ADDR')), addslashes($this->tb), |
| addslashes($key_col_val), addslashes($key), |
addslashes($key_col_val), addslashes($key), |
| addslashes($oldvalues[$key]), addslashes($newvalues[$key])); |
addslashes($oldvals[$key]), addslashes($newvals[$key])); |
| $this->myquery($qry, __LINE__); |
$this->myquery($qry, __LINE__); |
| } |
} |
| } |
} |
| Line 2153 function phpMyEdit_form_control(theForm) |
|
| Line 2161 function phpMyEdit_form_control(theForm) |
|
| |
|
| function do_delete_record() /* {{{ */ |
function do_delete_record() /* {{{ */ |
| { |
{ |
| // Before trigger |
|
| if (isset($this->triggers['delete']['before'])) { |
|
| $ret = include($this->triggers['delete']['before']); |
|
| if ($ret == false) { |
|
| return false; |
|
| } |
|
| } |
|
| // Preparing queries |
// Preparing queries |
| for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
| if ($this->processed($k)) { |
if ($this->processed($k)) { |
| Line 2169 function phpMyEdit_form_control(theForm) |
|
| Line 2170 function phpMyEdit_form_control(theForm) |
|
| } |
} |
| } |
} |
| // Additional query |
// Additional query |
| if (@$this->notify['delete'] || @$this->notify['all'] || $this->logtable) { |
$query = 'SELECT * FROM '.$this->tb.' WHERE ('.$this->key.' = ' |
| $query = 'SELECT * FROM '.$this->tb.' WHERE ('.$this->key.' = ' |
.$this->key_delim.$this->rec.$this->key_delim.')'; // ) |
| .$this->key_delim.$this->rec.$this->key_delim.')'; // ) |
$res = $this->myquery($query, __LINE__); |
| $res = $this->myquery($query, __LINE__); |
$oldvals = @mysql_fetch_array($res, MYSQL_ASSOC); |
| $oldrow = @mysql_fetch_array($res, MYSQL_ASSOC); |
@mysql_free_result($res); |
| |
// Before trigger |
| |
if (isset($this->triggers['delete']['before'])) { |
| |
$ret = include($this->triggers['delete']['before']); |
| |
if ($ret == false) { |
| |
return false; |
| |
} |
| } |
} |
| // Real query |
// Real query |
| $query = 'DELETE FROM '.$this->tb.' WHERE ('.$this->key.' = ' |
$query = 'DELETE FROM '.$this->tb.' WHERE ('.$this->key.' = ' |
| Line 2185 function phpMyEdit_form_control(theForm) |
|
| Line 2192 function phpMyEdit_form_control(theForm) |
|
| } |
} |
| // Notify list |
// Notify list |
| if (@$this->notify['delete'] || @$this->notify['all']) { |
if (@$this->notify['delete'] || @$this->notify['all']) { |
| $this->email_notify($oldrow, false); |
$this->email_notify($oldvals, false); |
| } |
} |
| // Note change in log table |
// Note change in log table |
| if ($this->logtable) { |
if ($this->logtable) { |
| Line 2194 function phpMyEdit_form_control(theForm) |
|
| Line 2201 function phpMyEdit_form_control(theForm) |
|
| .' VALUES (NOW(), "%s", "%s", "delete", "%s", "%s", "%s", "%s", "")', |
.' VALUES (NOW(), "%s", "%s", "delete", "%s", "%s", "%s", "%s", "")', |
| $this->logtable, addslashes($this->get_server_var('REMOTE_USER')), |
$this->logtable, addslashes($this->get_server_var('REMOTE_USER')), |
| addslashes($this->get_server_var('REMOTE_ADDR')), addslashes($this->tb), |
addslashes($this->get_server_var('REMOTE_ADDR')), addslashes($this->tb), |
| addslashes($key_col_val), addslashes($key), addslashes(serialize($oldrow))); |
addslashes($key_col_val), addslashes($key), addslashes(serialize($oldvals))); |
| $this->myquery($query, __LINE__); |
$this->myquery($query, __LINE__); |
| } |
} |
| // After trigger |
// After trigger |
| Line 2233 function phpMyEdit_form_control(theForm) |
|
| Line 2240 function phpMyEdit_form_control(theForm) |
|
| } |
} |
| $addr = $this->get_server_var('REMOTE_ADDR'); |
$addr = $this->get_server_var('REMOTE_ADDR'); |
| $user = $this->get_server_var('REMOTE_USER'); |
$user = $this->get_server_var('REMOTE_USER'); |
| $body = 'This notification e-mail is automatically generated by phpMyEdit.'."\n\n".$body; |
$body = 'This notification e-mail was automatically generated by phpMyEdit.'."\n\n".$body; |
| $body .= ' table '.$this->tb.' in MySQL database '.$this->db.' on '.$this->page_name; |
$body .= ' table '.$this->tb.' in MySQL database '.$this->db.' on '.$this->page_name; |
| $body .= ' by '.($user == '' ? 'unknown user' : "user $user").' from '.$addr; |
$body .= ' by '.($user == '' ? 'unknown user' : "user $user").' from '.$addr; |
| $body .= ' at '.date('d/M/Y H:i').' with the following fields:'."\n\n"; |
$body .= ' at '.date('d/M/Y H:i').' with the following fields:'."\n\n"; |