version 1.3, 2002/08/07 19:32:01 |
version 1.4, 2002/08/07 22:13:30 |
Line 196 class phpMyEdit { |
|
Line 196 class phpMyEdit { |
|
{ |
{ |
// just try the first language and variant |
// just try the first language and variant |
// this isn't content-negotiation rfc compliant |
// this isn't content-negotiation rfc compliant |
$language = substr($language,0,5); |
$language = strtoupper(substr($language,0,5)); |
|
|
// try the full language w/ variant |
// try the full language w/ variant |
$ret = @include($this->dir['lang'].'PME.lang.'.$language.'.inc'); |
$ret = @include($this->dir['lang'].'PME.lang.'.$language.'.inc'); |
Line 235 class phpMyEdit { |
|
Line 235 class phpMyEdit { |
|
if ($this->fdd[$field_num]['values']['orderby']) |
if ($this->fdd[$field_num]['values']['orderby']) |
$qparts['orderby'] = $this->fdd[$field_num]['values']['orderby']; |
$qparts['orderby'] = $this->fdd[$field_num]['values']['orderby']; |
$res = $this->myquery($this->query_make($qparts),__LINE__); |
$res = $this->myquery($this->query_make($qparts),__LINE__); |
$values = Array(); |
$values = array(); |
if ($prepend != '') |
if ($prepend != '') |
$values[$prepend[0]] = $prepend[1]; |
$values[$prepend[0]] = $prepend[1]; |
while ($row = mysql_fetch_row($res)) { |
while ($row = mysql_fetch_row($res)) { |
Line 272 class phpMyEdit { |
|
Line 272 class phpMyEdit { |
|
|
|
function create_column_list() /* {{{ */ |
function create_column_list() /* {{{ */ |
{ |
{ |
$fields = Array(); |
$fields = array(); |
for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
if ($this->col_is_date($k)) { |
if ($this->col_is_date($k)) { |
//$fields[] = 'DATE_FORMAT('.$this->fqn($k).',"%Y%m%d%H%i%s") AS qf'.$k; |
//$fields[] = 'DATE_FORMAT('.$this->fqn($k).',"%Y%m%d%H%i%s") AS qf'.$k; |
Line 358 class phpMyEdit { |
|
Line 358 class phpMyEdit { |
|
{ |
{ |
if ($qp == '') |
if ($qp == '') |
$qp = $this->query_opts; |
$qp = $this->query_opts; |
$where = Array(); |
$where = array(); |
foreach ($qp as $field => $ov) { |
foreach ($qp as $field => $ov) { |
$where[] = sprintf('%s %s %s',$field,$ov['oper'],$ov['value']); |
$where[] = sprintf('%s %s %s',$field,$ov['oper'],$ov['value']); |
} |
} |
Line 376 class phpMyEdit { |
|
Line 376 class phpMyEdit { |
|
{ |
{ |
if ($qp == '') |
if ($qp == '') |
$qp = $this->query_opts; |
$qp = $this->query_opts; |
$where = Array(); |
$where = array(); |
foreach ($qp as $field => $ov) { |
foreach ($qp as $field => $ov) { |
$where[] = sprintf('%s %s %s',$field,$ov['oper'],$ov['value']); |
$where[] = sprintf('%s %s %s',$field,$ov['oper'],$ov['value']); |
} |
} |
Line 428 class phpMyEdit { |
|
Line 428 class phpMyEdit { |
|
{ |
{ |
// gathers query options into an array, $this->query_opts |
// gathers query options into an array, $this->query_opts |
|
|
$query_opts = Array(); |
$query_opts = array(); |
$qo = Array(); |
$qo = array(); |
|
|
for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
// get the field name and value |
// get the field name and value |
Line 460 class phpMyEdit { |
|
Line 460 class phpMyEdit { |
|
} |
} |
$afilter = $afilter.')'; |
$afilter = $afilter.')'; |
$qo[$this->fqn($k)] = |
$qo[$this->fqn($k)] = |
Array( 'oper' => $qf_op, 'value' => '('.$qf_val.')'); |
array( 'oper' => $qf_op, 'value' => '('.$qf_val.')'); |
} |
} |
} else { |
} else { |
$afilter = $m; |
$afilter = $m; |
if ($afilter != '*') { |
if ($afilter != '*') { |
if ($this->fdd[$k]['values']['description']) { |
if ($this->fdd[$k]['values']['description']) { |
$qo[$this->fqn($k)] = |
$qo[$this->fqn($k)] = |
Array( 'oper' => '=', 'value' => "'".$afilter."'"); |
array( 'oper' => '=', 'value' => "'".$afilter."'"); |
} elseif ($this->fdd[$k]['values']['column']) { |
} elseif ($this->fdd[$k]['values']['column']) { |
$qo[$this->fqn($k)] = |
$qo[$this->fqn($k)] = |
Array( 'oper' => '=', 'value' => "'".$afilter."'"); |
array( 'oper' => '=', 'value' => "'".$afilter."'"); |
} elseif ($this->col_is_string($k)) { |
} elseif ($this->col_is_string($k)) { |
// massage the filter for a string comparison |
// massage the filter for a string comparison |
if (($afilter != '') AND ($afilter != '*')) { |
if (($afilter != '') AND ($afilter != '*')) { |
$afilter = addslashes(addslashes('%' |
$afilter = addslashes(addslashes('%' |
.str_replace ('*', '%', $afilter).'%')); |
.str_replace ('*', '%', $afilter).'%')); |
$qo[$this->fqn($k)] = |
$qo[$this->fqn($k)] = |
Array('oper' => 'like', 'value' => "'".$afilter."'"); |
array('oper' => 'like', 'value' => "'".$afilter."'"); |
} |
} |
} elseif ($this->col_is_number($k) && ($$lc != '')) { |
} elseif ($this->col_is_number($k) && ($$lc != '')) { |
if ($$lc != '') { |
if ($$lc != '') { |
$qo[$this->fqn($k)] = |
$qo[$this->fqn($k)] = |
Array('oper' => $mc, 'value' => $afilter); |
array('oper' => $mc, 'value' => $afilter); |
} |
} |
} elseif ($this->col_is_date($k)) { |
} elseif ($this->col_is_date($k)) { |
#if ($$lc != '') { |
#if ($$lc != '') { |
Line 491 class phpMyEdit { |
|
Line 491 class phpMyEdit { |
|
# $val = $this->mdate_getFromPost($k); |
# $val = $this->mdate_getFromPost($k); |
# if ($val != '') { |
# if ($val != '') { |
# $qo[$this->fqn($k)] = |
# $qo[$this->fqn($k)] = |
# Array( 'oper' => $mc, 'value' => '"'.$val.'"'); |
# array( 'oper' => $mc, 'value' => '"'.$val.'"'); |
# } |
# } |
#} |
#} |
# massage the filter for a string comparison |
# massage the filter for a string comparison |
Line 499 class phpMyEdit { |
|
Line 499 class phpMyEdit { |
|
$afilter = addslashes(addslashes('%' |
$afilter = addslashes(addslashes('%' |
.str_replace ('*', '%', $afilter).'%')); |
.str_replace ('*', '%', $afilter).'%')); |
$qo[$this->fqn($k)] = |
$qo[$this->fqn($k)] = |
Array('oper' => 'like', 'value' => "'".$afilter."'"); |
array('oper' => 'like', 'value' => "'".$afilter."'"); |
} |
} |
} elseif($this->fdd[$k]['values']) { |
} elseif($this->fdd[$k]['values']) { |
//debug_var('col_is_string',$this->fdd[$k]['name'].'::'.$this->fdd[$k]['type']); |
//debug_var('col_is_string',$this->fdd[$k]['name'].'::'.$this->fdd[$k]['type']); |
$qo[$this->fqn($k)] = |
$qo[$this->fqn($k)] = |
Array( 'oper' => '=', 'value' => "'".$afilter."'"); |
array( 'oper' => '=', 'value' => "'".$afilter."'"); |
} else { |
} else { |
// unknown (to mysql/php interface) field type massage the filter for a string comparison |
// unknown (to mysql/php interface) field type massage the filter for a string comparison |
$afilter = addslashes(addslashes('%'.str_replace ('*', '%', $afilter).'%')); |
$afilter = addslashes(addslashes('%'.str_replace ('*', '%', $afilter).'%')); |
$qo[$this->fqn($k)] = |
$qo[$this->fqn($k)] = |
Array('oper' => 'like', 'value' => "'".$afilter."'"); |
array('oper' => 'like', 'value' => "'".$afilter."'"); |
} |
} |
} |
} |
} |
} |
Line 522 class phpMyEdit { |
|
Line 522 class phpMyEdit { |
|
function gather_get_vars() /* {{{ */ |
function gather_get_vars() /* {{{ */ |
{ |
{ |
global $HTTP_SERVER_VARS; |
global $HTTP_SERVER_VARS; |
$vals = Array(); |
$vals = array(); |
$parts = split('&',$HTTP_SERVER_VARS['QUERY_STRING']); |
$parts = split('&',$HTTP_SERVER_VARS['QUERY_STRING']); |
if (count($parts) > 0) { |
if (count($parts) > 0) { |
foreach ($parts as $part) { |
foreach ($parts as $part) { |
Line 535 class phpMyEdit { |
|
Line 535 class phpMyEdit { |
|
|
|
function unify_opts() /* {{{ */ |
function unify_opts() /* {{{ */ |
{ |
{ |
$all_opts = Array(); |
$all_opts = array(); |
if (count($this->qo) > 0) { |
if (count($this->qo) > 0) { |
foreach ($this->qo as $key=>$val) |
foreach ($this->qo as $key=>$val) |
$all_opts[$key] = $val; |
$all_opts[$key] = $val; |
|
|
if (isset ($this->fdd[$k]['values'])) { |
if (isset ($this->fdd[$k]['values'])) { |
echo ' <td>' ."\n"; |
echo ' <td>' ."\n"; |
if (isset($this->fdd[$k]['values']['table'])) { |
if (isset($this->fdd[$k]['values']['table'])) { |
$vals = array_merge(Array(''=>''),$this->set_values_from_table($k)); |
$vals = array_merge(array(''=>''),$this->set_values_from_table($k)); |
} else { |
} else { |
$vals = array_merge(Array(''=>''),$this->fdd[$k]['values']); |
$vals = array_merge(array(''=>''),$this->fdd[$k]['values']); |
} |
} |
echo $this->htmlSelect($this->fds[$k],$vals,''); |
echo $this->htmlSelect($this->fds[$k],$vals,''); |
echo ' </td>'."\n"; |
echo ' </td>'."\n"; |
|
|
if ($nat_sort) |
if ($nat_sort) |
uasort($kv_array,"strnatcasecmp"); |
uasort($kv_array,"strnatcasecmp"); |
if (! is_array($selected)) |
if (! is_array($selected)) |
$selected = Array($selected); |
$selected = array($selected); |
$ret = '<select name="'.htmlspecialchars($var); |
$ret = '<select name="'.htmlspecialchars($var); |
if ($multiple != '') |
if ($multiple != '') |
$ret .= '[]" multiple size="'.$this->multiple; |
$ret .= '[]" multiple size="'.$this->multiple; |
|
|
* Display the MySQL table in an HTML table |
* Display the MySQL table in an HTML table |
*/ |
*/ |
|
|
$comp_ops = Array( |
$comp_ops = array( |
''=>'','%3C'=>'%3C','%3C%3D'=>'%3C%3D', |
''=>'','%3C'=>'%3C','%3C%3D'=>'%3C%3D', |
'%3D'=>'%3D','%3E%3D'=>'%3E%3D','%3E'=>'%3E'); |
'%3D'=>'%3D','%3E%3D'=>'%3E%3D','%3E'=>'%3E'); |
echo '<form action="'.$this->page_name.'" method="POST">'."\n"; |
echo '<form action="'.$this->page_name.'" method="POST">'."\n"; |
|
|
$qfsec = "qf".$k."_se"; |
$qfsec = "qf".$k."_se"; |
global $$qfmont,$$qfday,$$qfminu,$$qfsec; |
global $$qfmont,$$qfday,$$qfminu,$$qfsec; |
foreach ( |
foreach ( |
Array( |
array( |
$qfyear=>$$qfyear,$qfmonth=>$$qfmonth, |
$qfyear=>$$qfyear,$qfmonth=>$$qfmonth, |
$qfday=>$$qfday,$qfhour=>$$qfhour, |
$qfday=>$$qfday,$qfhour=>$$qfhour, |
$qfminute=>$$qfminute,$qfsecond=>$$qfsecond |
$qfminute=>$$qfminute,$qfsecond=>$$qfsecond |
|
|
is_numeric($this->sfn) || |
is_numeric($this->sfn) || |
isset($this->default_sort_columns) |
isset($this->default_sort_columns) |
) { |
) { |
$raw_sort_fields = Array(); |
$raw_sort_fields = array(); |
$sort_fields = Array(); |
$sort_fields = array(); |
$sort_fields_w = Array(); |
$sort_fields_w = array(); |
//if ($this->sfn != '') |
//if ($this->sfn != '') |
if (is_numeric($this->sfn)) { |
if (is_numeric($this->sfn)) { |
if (isset($this->fdd[$this->sfn]['expression'])) { |
if (isset($this->fdd[$this->sfn]['expression'])) { |
|
|
if ($m != '') |
if ($m != '') |
$selected = $m; |
$selected = $m; |
if ($this->fdd[$k]['values']['table']) |
if ($this->fdd[$k]['values']['table']) |
$x = $this->set_values_from_table($k,Array('*'=>'*')); |
$x = $this->set_values_from_table($k,array('*'=>'*')); |
elseif ($this->fdd[$k]['values']) |
elseif ($this->fdd[$k]['values']) |
$x = array_merge(Array('*'=>'*'),$this->fdd[$k]['values']); |
$x = array_merge(array('*'=>'*'),$this->fdd[$k]['values']); |
echo $this->htmlSelect($l,$x,$selected,$multiple=''); |
echo $this->htmlSelect($l,$x,$selected,$multiple=''); |
} elseif ($this->fdd[$fd]['select'] == 'T') { |
} elseif ($this->fdd[$fd]['select'] == 'T') { |
// this is where we put the comparison selects |
// this is where we put the comparison selects |
|
|
|
|
if ($this->actionStyle == 'link' || $this->actionStyle == 'graphic') { |
if ($this->actionStyle == 'link' || $this->actionStyle == 'graphic') { |
// gather query & GET options to preserve for Update/Delete links |
// gather query & GET options to preserve for Update/Delete links |
$qstrparts = Array(); |
$qstrparts = array(); |
if (count($this->qo) > 0) { |
if (count($this->qo) > 0) { |
foreach ($this->qo as $key=>$val) { |
foreach ($this->qo as $key=>$val) { |
if ($key != '' && $key != 'operation' && ! is_array($val) ) |
if ($key != '' && $key != 'operation' && ! is_array($val) ) |
|
|
|
|
// preserve sort field number, filter row, and first record to display |
// preserve sort field number, filter row, and first record to display |
if (isset($this->sfn)) |
if (isset($this->sfn)) |
$qstrparts[] = "sfn=".($this->sort_asc?'':'-').$this->sfn; |
$qstrparts[] = 'sfn='.($this->sort_asc?'':'-').$this->sfn; |
if (isset($this->fl)) |
if (isset($this->fl)) |
$qstrparts[] = "fl=".$this->fl; |
$qstrparts[] = 'fl='.$this->fl; |
if (isset($this->fm)) |
if (isset($this->fm)) |
$qstrparts[] = "fm=".$this->fm; |
$qstrparts[] = 'fm='.$this->fm; |
|
|
// do we need to preserve filter (filter query) and sw (filter display/hide button)? |
// do we need to preserve filter (filter query) and sw (filter display/hide button)? |
|
|
$qpview = $qstrparts; |
$qpview = $qstrparts; |
$qpview[] = 'operation='.$this->labels['Display']; |
$qpview[] = 'operation='.$this->labels['Display']; |
$qpviewStr = '?'.join('&',$qpview); |
$qpviewStr = '?'.join('&',$qpview); |
|
|
$qpcopy = $qstrparts; |
$qpcopy = $qstrparts; |
$qpcopy[] = 'operation='.$this->labels['Copy']; |
$qpcopy[] = 'operation='.$this->labels['Copy']; |
$qpcopyStr = '?'.join('&',$qpcopy); |
$qpcopyStr = '?'.join('&',$qpcopy); |
|
|
$qpchange = $qstrparts; |
$qpchange = $qstrparts; |
$qpchange[] = 'operation=Change'; |
$qpchange[] = 'operation='.$this->labels['Change']; |
$qpchangeStr = '?'.join('&',$qpchange); |
$qpchangeStr = '?'.join('&',$qpchange); |
|
|
$qpdel = $qstrparts; |
$qpdelete = $qstrparts; |
$qpdel[] = 'operation=Delete'; |
$qpdelete[] = 'operation='.$this->labels['Delete']; |
$qpdelStr = '?'.join('&',$qpdel); |
$qpdeleteStr = '?'.join('&',$qpdelete); |
} |
} |
|
|
while ($row = mysql_fetch_array ($res)) { |
while ($row = mysql_fetch_array ($res)) { |
|
|
} |
} |
echo ' />'; |
echo ' />'; |
} elseif ($this->actionStyle == 'graphic') { |
} elseif ($this->actionStyle == 'graphic') { |
if ($this->view_enabled()) echo "<a class=\"pme_a_t\" href=\"".$this->page_name."$qviewStr\"><img src=\"".$this->url['images']."pme-view.gif\" height=15 width=16 border=none alt=\"".$this->labels['Display']."\"></a> "; |
if ($this->view_enabled()) { |
if ($this->change_enabled()) echo "<a class=\"pme_a_t\" href=\"".$this->page_name."$qchangeStr\"><img src=\"".$this->url['images']."pme-change.gif\" height=15 width=16 border=none alt=\"".$this->labels['Change']."\"></a> "; |
echo '<a class="pme_a_t" href="'; |
if ($this->copy_enabled() ) echo "<a class=\"pme_a_t\" href=\"".$this->page_name."$qcopyStr\"><img src=\"".$this->url['images']."pme-copy.gif\" height=15 width=16 border=none alt=\"".$this->labels['Copy']."\"></a> "; |
echo htmlspecialchars($this->page_name.$qviewStr); |
if ($this->delete_enabled()) echo "<a class=\"pme_a_t\" href=\"".$this->page_name."$qdelStr\"><img src=\"".$this->url['images']."pme-delete.gif\" height=15 width=16 border=none alt=\"".$this->labels['Delete']."\"></a> "; |
echo '"><img src="'.$this->url['images'].'pme-view.png"'; |
|
echo ' height=15 width=16 border=none alt="'.htmlspecialchars($this->labels['Display']).'"></a> '; |
|
} |
|
if ($this->change_enabled()) { |
|
echo '<a class="pme_a_t" href="'; |
|
echo htmlspecialchars($this->page_name.$qchangeStr); |
|
echo '"><img src="'.$this->url['images'].'pme-change.png"'; |
|
echo ' height=15 width=16 border=none alt="'.htmlspecialchars($this->labels['Change']).'"></a> '; |
|
} |
|
if ($this->copy_enabled()) { |
|
echo '<a class="pme_a_t" href="'; |
|
echo htmlspecialchars($this->page_name.$qcopyStr); |
|
echo '"><img src="'.$this->url['images'].'pme-copy.png"'; |
|
echo ' height=15 width=16 border=none alt="'.htmlspecialchars($this->labels['Copy']).'"></a> '; |
|
} |
|
if ($this->delete_enabled()) { |
|
echo '<a class="pme_a_t" href="'; |
|
echo htmlspecialchars($this->page_name.$qdeleteStr); |
|
echo '"><img src="'.$this->url['images'].'pme-delete.png"'; |
|
echo ' height=15 width=16 border=none alt="'.htmlspecialchars($this->labels['Delete']).'"></a> '; |
|
} |
} else { |
} else { |
if ($this->view_enabled()) echo "<a class=\"pme_a_t\" href=\"".$this->page_name."$qviewStr\">V</a> "; |
if ($this->view_enabled()) |
if ($this->change_enabled()) echo "<a class=\"pme_a_t\" href=\"".$this->page_name."$qchangeStr\">U</a> "; |
echo '<a class="pme_a_t" href="'.htmlspecialchars($this->page_name.$qviewStr).'">V</a> '; |
if ($this->copy_enabled() ) echo "<a class=\"pme_a_t\" href=\"".$this->page_name."$qcopyStr\">C</a> "; |
if ($this->change_enabled()) |
if ($this->delete_enabled()) echo "<a class=\"pme_a_t\" href=\"".$this->page_name."$qdelStr\">D</a> "; |
echo '<a class="pme_a_t" href="'.htmlspecialchars($this->page_name.$qchangeStr).'">U</a> '; |
|
if ($this->copy_enabled()) |
|
echo '<a class="pme_a_t" href="'.htmlspecialchars($this->page_name.$qcopyStr).'">C</a> '; |
|
if ($this->delete_enabled()) |
|
echo '<a class="pme_a_t" href="'.htmlspecialchars($this->page_name.$qdeleteStr).'">D</a>'; |
} |
} |
} elseif ($this->filter_enabled()) { |
} elseif ($this->filter_enabled()) { |
echo ' '; |
echo ' '; |
|
|
if ($$var_to_total) { |
if ($$var_to_total) { |
// do the aggregate query if necessary |
// do the aggregate query if necessary |
//if ($vars_to_total) { |
//if ($vars_to_total) { |
$qp = Array(); |
$qp = array(); |
$qp['type'] = 'select'; |
$qp['type'] = 'select'; |
$qp['select'] = $aggr_from_clause; |
$qp['select'] = $aggr_from_clause; |
$qp['from'] = $this->create_join_clause (); |
$qp['from'] = $this->create_join_clause (); |
|
|
echo "\n".'<tr>'."\n".'<td> </td>'."\n"; |
echo "\n".'<tr>'."\n".'<td> </td>'."\n"; |
/* |
/* |
echo '<td>'; |
echo '<td>'; |
echo printArray($qp_aggr); |
echo printarray($qp_aggr); |
echo printArray($vars_to_total); |
echo printarray($vars_to_total); |
echo '</td>'; |
echo '</td>'; |
echo '<td colspan="'.($this->num_fds-1).'">'.$var_to_total.' '.$$var_to_total.'</td>'; |
echo '<td colspan="'.($this->num_fds-1).'">'.$var_to_total.' '.$$var_to_total.'</td>'; |
*/ |
*/ |
|
|
//phpinfo(); |
//phpinfo(); |
/* |
/* |
foreach ( |
foreach ( |
Array( |
array( |
// '1999-12-31'=>'%Y-%m-%d', |
// '1999-12-31'=>'%Y-%m-%d', |
// '99-Mar-31'=>'%y-%M-%d', |
// '99-Mar-31'=>'%y-%M-%d', |
// '99-1-31'=>'%y-%n-%d' |
// '99-1-31'=>'%y-%n-%d' |
|
|
if ($this->change_operation()) { |
if ($this->change_operation()) { |
echo '<input type="submit" name="savechange" value="'.$this->labels['Save'].'" />'."\n"; |
echo '<input type="submit" name="savechange" value="'.$this->labels['Save'].'" />'."\n"; |
echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();" />'."\n"; |
echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();" />'."\n"; |
} |
} elseif ($this->add_operation() or $this->more_operation()) { |
elseif ($this->add_operation() or $this->more_operation()) { |
|
echo '<input type="submit" name="saveadd" value="'.$this->labels['Save'].'" />'."\n"; |
echo '<input type="submit" name="saveadd" value="'.$this->labels['Save'].'" />'."\n"; |
echo '<input type="submit" name="moreadd" value="'.$this->labels['More'].'" />'."\n"; |
echo '<input type="submit" name="moreadd" value="'.$this->labels['More'].'" />'."\n"; |
echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();" />'."\n"; |
echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();" />'."\n"; |
} |
} elseif ($this->copy_operation()) { |
elseif ($this->copy_operation()) { |
|
echo '<input type="submit" name="saveadd" value="'.$this->labels['Save'].'" />'."\n"; |
echo '<input type="submit" name="saveadd" value="'.$this->labels['Save'].'" />'."\n"; |
echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();" />'."\n"; |
echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();" />'."\n"; |
} |
} elseif ($this->delete_operation()) { |
elseif ($this->delete_operation()) { |
|
echo '<input type="submit" name="savedelete" value="'.$this->labels['Delete'].'" />'."\n"; |
echo '<input type="submit" name="savedelete" value="'.$this->labels['Delete'].'" />'."\n"; |
echo '<input type="submit" name="cancel" value="'.$this->labels['Cancel'].'" />'."\n"; |
echo '<input type="submit" name="cancel" value="'.$this->labels['Cancel'].'" />'."\n"; |
} |
} elseif ($this->view_operation()) { |
elseif ($this->view_operation()) { |
|
if ($this->change_enabled()) { |
if ($this->change_enabled()) { |
echo '<input type="submit" name="operation" value="'.$this->labels['Change'].'" />'."\n"; |
echo '<input type="submit" name="operation" value="'.$this->labels['Change'].'" />'."\n"; |
} |
} |
|
|
$key_col_val = ''; |
$key_col_val = ''; |
$qry = ''; |
$qry = ''; |
for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
if ( $this->displayed($k) ) |
if ($this->displayed($k)) { |
{ |
|
$fd = $this->fds[$k]; |
$fd = $this->fds[$k]; |
if ($fd == $this->key) { |
if ($fd == $this->key) { |
$key_col_val = addslashes($this->encode($this->fdd[$k],$fn)); |
$key_col_val = addslashes($this->encode($this->fdd[$k],$fn)); |
|
|
$tim = false; |
$tim = false; |
// do the main operation |
// do the main operation |
$val = ') VALUES ('; |
$val = ') VALUES ('; |
$vals = Array(); |
$vals = array(); |
for ($k = 0; $k < $this->num_fds; $k++) |
for ($k = 0; $k < $this->num_fds; $k++) { |
{ |
|
$type = $this->fdd[$k]['type']; |
$type = $this->fdd[$k]['type']; |
if ( $this->displayed($k) ) |
if ( $this->displayed($k) ) { |
{ |
|
$fd = $this->fds[$k]; |
$fd = $this->fds[$k]; |
$fn = $this->get_http_post_var_by_name($fd); |
$fn = $this->get_http_post_var_by_name($fd); |
/* |
/* |
|
|
$tia = include($this->triggers['insert']['after']); |
$tia = include($this->triggers['insert']['after']); |
} |
} |
// notify list |
// notify list |
$kv = Array(); |
$kv = array(); |
if (($this->notify['insert'])) { |
if (($this->notify['insert'])) { |
$user = $REMOTE_USER; |
$user = $REMOTE_USER; |
if (! $user) |
if (! $user) |
|
|
$res_old = $this->myquery($qry_old_rec,__LINE__); |
$res_old = $this->myquery($qry_old_rec,__LINE__); |
$oldvalues = mysql_fetch_array($res_old); |
$oldvalues = mysql_fetch_array($res_old); |
// update the data |
// update the data |
//echo "\n<h4>$qry</h4>\n"; |
//echo "\n<h4>$qry</h4>\n"; |
$res = $this->myquery($qry,__LINE__); |
$res = $this->myquery($qry,__LINE__); |
// find and accumulate the changes |
// find and accumulate the changes |
$changes=Array(); |
$changes=array(); |
for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
if ($this->displayed($k)) { |
if ($this->displayed($k)) { |
if ($oldvalues[$this->fds[$k]] != stripslashes($newvalues[$this->fds[$k]])) { |
if ($oldvalues[$this->fds[$k]] != stripslashes($newvalues[$this->fds[$k]])) { |
$changes[$this->fds[$k]] = Array(); |
$changes[$this->fds[$k]] = array(); |
$changes[$this->fds[$k]]['was'] = $oldvalues[$this->fds[$k]]; |
$changes[$this->fds[$k]]['was'] = $oldvalues[$this->fds[$k]]; |
$changes[$this->fds[$k]]['is' ] = $newvalues[$this->fds[$k]]; |
$changes[$this->fds[$k]]['is' ] = $newvalues[$this->fds[$k]]; |
} |
} |
Line 2386 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
Line 2403 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
set_magic_quotes_runtime(0); // let's do explicit quoting ... it's safer |
set_magic_quotes_runtime(0); // let's do explicit quoting ... it's safer |
|
|
// XXX fix this to use col_is_[type] |
// XXX fix this to use col_is_[type] |
if (in_array($this->key_type,Array('string','blob','date','time','datetime','timestamp','year'))) |
if (in_array($this->key_type,array('string','blob','date','time','datetime','timestamp','year'))) |
{ |
{ |
$this->key_delim = '"'; |
$this->key_delim = '"'; |
} else { |
} else { |
Line 2498 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
Line 2515 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
/* |
/* |
* Instance class variables |
* Instance class variables |
*/ |
*/ |
$this->hn = $opts['hn']; |
$this->hn = $opts['hn']; |
$this->hn = $opts['hn']; |
$this->hn = $opts['hn']; |
$this->un = $opts['un']; |
$this->un = $opts['un']; |
$this->pw = $opts['pw']; |
$this->pw = $opts['pw']; |
$this->db = $opts['db']; |
$this->db = $opts['db']; |
$this->tb = $opts['tb']; |
$this->tb = $opts['tb']; |
$this->key = $opts['key']; |
$this->key = $opts['key']; |
$this->key_type = $opts['key_type']; |
$this->key_type = $opts['key_type']; |
$this->inc = $opts['inc']; |
$this->inc = $opts['inc']; |
$this->options = $opts['options']; |
$this->options = $opts['options']; |
$this->multiple = $opts['multiple']; |
$this->multiple = $opts['multiple']; |
|
$this->fdd = $opts['fdd']; |
if (!isset($this->multiple)) |
if (!isset($this->multiple)) |
$this->multiple=2; |
$this->multiple=2; |
$this->display_sort = $opts['display_sort']; |
$this->display_sort = $opts['display_sort']; |
$this->display_query = $opts['display_query']; |
$this->display_query = $opts['display_query']; |
$this->fdd = $opts['fdd']; |
|
if ($opts['language']) { |
if ($opts['language']) { |
$this->labels = $this->make_language_labels($opts['language']); |
$this->labels = $this->make_language_labels($opts['language']); |
} else { |
} else { |
Line 2600 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
Line 2617 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
if ($this->displayed($field_num)) |
if ($this->displayed($field_num)) |
$num_fields_displayed++; |
$num_fields_displayed++; |
if (is_array($aval['values']) && (! $aval['values']['table'])) { |
if (is_array($aval['values']) && (! $aval['values']['table'])) { |
$values = Array(); |
$values = array(); |
foreach ($aval['values'] as $val) { |
foreach ($aval['values'] as $val) { |
$values[$val]=$val; |
$values[$val]=$val; |
} |
} |
Line 2627 $this->key_num = array_search($this->key |
|
Line 2644 $this->key_num = array_search($this->key |
|
*/ |
*/ |
|
|
// code to use this is commented out |
// code to use this is commented out |
$this->sql_aggrs = Array(''=>'','sum'=>'Total','avg'=>'Average','min'=>'Minimum','max'=>'Maximum','count'=>'Count'); |
$this->sql_aggrs = array(''=>'','sum'=>'Total','avg'=>'Average','min'=>'Minimum','max'=>'Maximum','count'=>'Count'); |
|
|
// to support quick type checking |
// to support quick type checking |
$this->stringTypes = Array('string','blob','set','enum'); |
$this->stringTypes = array('string','blob','set','enum'); |
$this->numberTypes = Array('int','real'); |
$this->numberTypes = array('int','real'); |
$this->dateTypes = Array('date','datetime','timestamp','time','year'); |
$this->dateTypes = array('date','datetime','timestamp','time','year'); |
|
|
// mdate constants |
// mdate constants |
$this->mdate_masks = Array( |
$this->mdate_masks = array( |
'date'=>'%Y-%m-%d', |
'date'=>'%Y-%m-%d', |
'datetime'=>'%Y-%m-%d %H:%i:%s', |
'datetime'=>'%Y-%m-%d %H:%i:%s', |
'timestamp'=>'%Y%m%d%H%i%s', |
'timestamp'=>'%Y%m%d%H%i%s', |
Line 2644 $this->mdate_masks = Array( |
|
Line 2661 $this->mdate_masks = Array( |
|
|
|
$this->mdate_daterange = range(date('Y')-10,date('Y')+10); |
$this->mdate_daterange = range(date('Y')-10,date('Y')+10); |
|
|
$this->months_short = Array( |
$this->months_short = array( |
'~~PME~~'=>0, |
'~~PME~~'=>0, |
'Jan'=>1, 'Feb'=>2, 'Mar'=>3, 'Apr'=>4, |
'Jan'=>1, 'Feb'=>2, 'Mar'=>3, 'Apr'=>4, |
'May'=>5, 'Jun'=>6, 'Jul'=>7, 'Aug'=>8, |
'May'=>5, 'Jun'=>6, 'Jul'=>7, 'Aug'=>8, |
'Sep'=>9, 'Oct'=>10, 'Nov'=>11, 'Dec'=>12); |
'Sep'=>9, 'Oct'=>10, 'Nov'=>11, 'Dec'=>12); |
$this->months_long = Array( |
$this->months_long = array( |
'~~PME~~'=>0, |
'~~PME~~'=>0, |
'January'=>1,'February'=>2,'March'=>3, |
'January'=>1,'February'=>2,'March'=>3, |
'April'=>4,'May'=>5,'June'=>6, |
'April'=>4,'May'=>5,'June'=>6, |