| version 1.51, 2003/02/17 21:15:58 |
version 1.52, 2003/02/18 00:21:11 |
|
|
| * http://www.platon.sk/projects/phpMyEdit/ |
* http://www.platon.sk/projects/phpMyEdit/ |
| */ |
*/ |
| |
|
| /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.50 2003/02/15 19:56:16 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.51 2003/02/17 21:15:58 nepto Exp $ */ |
| |
|
| /* phpMyEdit intro {{{ */ |
/* phpMyEdit intro {{{ */ |
| /* |
/* |
|
|
| if ($table) { |
if ($table) { |
| $qparts['select'] = 'DISTINCT '.$key; |
$qparts['select'] = 'DISTINCT '.$key; |
| if ($desc) { |
if ($desc) { |
| //- $qparts['select'] .= ','.$desc; |
|
| //- $qparts['orderby'] = $desc; |
|
| // Changes 08/08/02 Shaun Johnston |
|
| if (is_array($desc)) { |
if (is_array($desc)) { |
| $qparts['select'] .= ',CONCAT('; // ) |
$qparts['select'] .= ',CONCAT('; // ) |
| $num_cols = sizeof($desc['columns']); |
$num_cols = sizeof($desc['columns']); |
|
|
| $table = $this->fdd[$field]['values']['table']; |
$table = $this->fdd[$field]['values']['table']; |
| $id = $this->fdd[$field]['values']['column']; |
$id = $this->fdd[$field]['values']['column']; |
| $desc = $this->fdd[$field]['values']['description']; |
$desc = $this->fdd[$field]['values']['description']; |
| |
|
| if ($desc != '' && $id != '') { |
if ($desc != '' && $id != '') { |
| $alias = 'JoinTable'.$k; |
$alias = 'JoinTable'.$k; |
| if (!in_array($alias,$tbs)) { |
if (!in_array($alias,$tbs)) { |
| Line 797 function phpMyEdit_form_control(theForm) |
|
| Line 793 function phpMyEdit_form_control(theForm) |
|
| return true; |
return true; |
| }'."\n\n"; |
}'."\n\n"; |
| echo '// --></script>' . "\n"; |
echo '// --></script>' . "\n"; |
| echo '<form action="'.$page_name.'" method="POST" onSubmit="return phpMyEdit_form_control(this);">'."\n"; |
echo '<form class="TODO-class" action="',$page_name,'" method="POST"'; |
| |
echo ' onSubmit="return phpMyEdit_form_control(this);">',"\n"; |
| return true; |
return true; |
| } |
} |
| } |
} |
| |
|
| echo '<form action="'.$page_name.'" method="POST">'."\n"; |
echo '<form class="TODO-class" action="',$page_name,'" method="POST">',"\n"; |
| return true; |
return true; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| Line 821 function phpMyEdit_form_control(theForm) |
|
| Line 818 function phpMyEdit_form_control(theForm) |
|
| if (! $this->displayed[$k]) { |
if (! $this->displayed[$k]) { |
| continue; |
continue; |
| } |
} |
| echo '<tr>'."\n"; |
echo '<tr class="TODO-class">'."\n"; |
| echo '<td>'.$this->fdd[$k]['name'].'</td>'."\n"; |
echo '<td class="TODO-class">'.$this->fdd[$k]['name'].'</td>'."\n"; |
| if ($this->col_has_values($k) && !$this->readonly($k)) { |
if ($this->col_has_values($k) && !$this->readonly($k)) { |
| echo '<td>'."\n"; |
echo '<td class="TODO-class">'."\n"; |
| $multiple = ($this->fdd[$k]['select'] == 'M' || $this->col_is_set($k)) |
$multiple = ($this->fdd[$k]['select'] == 'M' || $this->col_is_set($k)) |
| && ! $this->fdd[$k]['values']['table']; |
&& ! $this->fdd[$k]['values']['table']; |
| $vals = isset($this->fdd[$k]['values']['table']) |
$vals = isset($this->fdd[$k]['values']['table']) |
| Line 833 function phpMyEdit_form_control(theForm) |
|
| Line 830 function phpMyEdit_form_control(theForm) |
|
| echo $this->htmlSelect($this->fds[$k], $vals, '', $multiple); |
echo $this->htmlSelect($this->fds[$k], $vals, '', $multiple); |
| echo '</td>'."\n"; |
echo '</td>'."\n"; |
| } elseif (isset ($this->fdd[$k]['textarea']) && !$this->readonly($k)) { |
} elseif (isset ($this->fdd[$k]['textarea']) && !$this->readonly($k)) { |
| echo '<td><textarea '; |
echo '<td class="TODO-class"><textarea class="TODO-class" '; |
| if (isset ($this->fdd[$k]['textarea']['rows'])) { |
if (isset ($this->fdd[$k]['textarea']['rows'])) { |
| echo 'rows="'.$this->fdd[$k]['textarea']['rows'].'" '; |
echo 'rows="'.$this->fdd[$k]['textarea']['rows'].'" '; |
| } |
} |
| Line 847 function phpMyEdit_form_control(theForm) |
|
| Line 844 function phpMyEdit_form_control(theForm) |
|
| echo '</textarea></td>'."\n"; |
echo '</textarea></td>'."\n"; |
| } else { |
} else { |
| // Simple edit box required |
// Simple edit box required |
| echo '<td>'; |
echo '<td class="TODO-class">'; |
| $size_ml_props = ''; |
$size_ml_props = ''; |
| if ($this->fdd[$k]['type'] != 'blob') { |
if ($this->fdd[$k]['type'] != 'blob') { |
| $maxlen = intval($this->fdd[$k]['maxlen']); |
$maxlen = intval($this->fdd[$k]['maxlen']); |
| Line 858 function phpMyEdit_form_control(theForm) |
|
| Line 855 function phpMyEdit_form_control(theForm) |
|
| } |
} |
| if ($this->col_is_string($k) || $this->col_is_number($k)) { |
if ($this->col_is_string($k) || $this->col_is_number($k)) { |
| // string type |
// string type |
| echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
echo '<input class="TODO-class" type="text" '.($this->readonly($k)?'disabled ':'') |
| .' name="'.$this->fds[$k].'"'.$size_ml_props.' value="' |
.' name="'.$this->fds[$k].'"'.$size_ml_props.' value="' |
| .$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'], |
.$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'], |
| false, false, false) |
false, false, false) |
| Line 870 function phpMyEdit_form_control(theForm) |
|
| Line 867 function phpMyEdit_form_control(theForm) |
|
| //$value = time(); |
//$value = time(); |
| //echo $this->mdate_disperse($k,$value,true); |
//echo $this->mdate_disperse($k,$value,true); |
| // string type |
// string type |
| echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
echo '<input class="TODO-class" type="text" '.($this->readonly($k)?'disabled ':'') |
| .' name="'.$this->fds[$k].'"'.$size_ml_props.' value="' |
.' name="'.$this->fds[$k].'"'.$size_ml_props.' value="' |
| .$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'], |
.$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'], |
| false, false, false) |
false, false, false) |
| .'">'; |
.'">'; |
| } else { |
} else { |
| // unknown type |
// unknown type |
| echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
echo '<input class="TODO-class" type="text" '.($this->readonly($k)?'disabled ':'') |
| .' name="'.$this->fds[$k].'" value="' |
.' name="'.$this->fds[$k].'" value="' |
| .$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'], |
.$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'], |
| false, false, false) |
false, false, false) |
| Line 887 function phpMyEdit_form_control(theForm) |
|
| Line 884 function phpMyEdit_form_control(theForm) |
|
| } |
} |
| if ($this->guidance) { |
if ($this->guidance) { |
| if ($this->fdd[$k]['help']) |
if ($this->fdd[$k]['help']) |
| echo '<td>'.$this->fdd[$k]['help'].'</td>'."\n"; |
echo '<td class="TODO-class">'.$this->fdd[$k]['help'].'</td>'."\n"; |
| else |
else |
| echo '<td> </td>'."\n"; |
echo '<td class="TODO-class"> </td>'."\n"; |
| } |
} |
| echo '</tr>'."\n"; |
echo '</tr>'."\n"; |
| } |
} |
| Line 923 function phpMyEdit_form_control(theForm) |
|
| Line 920 function phpMyEdit_form_control(theForm) |
|
| if (! $this->displayed[$k]) { |
if (! $this->displayed[$k]) { |
| continue; |
continue; |
| } |
} |
| echo '<tr>'; |
echo '<tr class="TODO-class">'; |
| echo '<td>'.$this->fdd[$k]['name'].'</td>'."\n"; |
echo '<td class="TODO-class">'.$this->fdd[$k]['name'].'</td>'."\n"; |
| /* There are two possibilities of readonly fields handling: |
/* There are two possibilities of readonly fields handling: |
| 1. Display plain text |
1. Display plain text |
| 2. Display disabled input field |
2. Display disabled input field |
| Line 937 function phpMyEdit_form_control(theForm) |
|
| Line 934 function phpMyEdit_form_control(theForm) |
|
| echo $this->display_change_field($row, $k); |
echo $this->display_change_field($row, $k); |
| } |
} |
| if ($this->guidance) { |
if ($this->guidance) { |
| if ($this->fdd[$k]['help']) |
if ($this->fdd[$k]['help']) { |
| echo '<td>'.$this->fdd[$k]['help'].'</td>'."\n"; |
echo '<td class="TODO-class">'.$this->fdd[$k]['help'].'</td>'."\n"; |
| else |
} else { |
| echo '<td> </td>'."\n"; |
echo '<td class="TODO-class"> </td>'."\n"; |
| |
} |
| } |
} |
| echo '</tr>'."\n"; |
echo '</tr>'."\n"; |
| } elseif ($this->delete_operation() || $this->view_operation()) { |
} elseif ($this->delete_operation() || $this->view_operation()) { |
| if (! $this->displayed[$k]) { |
if (! $this->displayed[$k]) { |
| continue; |
continue; |
| } |
} |
| echo '<tr>'."\n"; |
echo '<tr class="TODO-class">'."\n"; |
| echo '<td>'.$this->fdd[$k]['name'].'</td>'."\n"; |
echo '<td class="TODO-class">'.$this->fdd[$k]['name'].'</td>'."\n"; |
| if ($this->password($k)) { |
if ($this->password($k)) { |
| echo '<td><i>'.$this->labels['hidden'].'</i></td>'; |
echo '<td class="TODO-class">'.$this->labels['hidden'].'</td>'; |
| } else { |
} else { |
| $this->display_delete_field($row, $k); |
$this->display_delete_field($row, $k); |
| } |
} |
| if ($this->guidance) { |
if ($this->guidance) { |
| if ($this->fdd[$k]['help']) |
if ($this->fdd[$k]['help']) |
| echo '<td>'.$this->fdd[$k]['help'].'</td>'."\n"; |
echo '<td class="TODO-class">'.$this->fdd[$k]['help'].'</td>'."\n"; |
| else |
else |
| echo '<td> </td>'."\n"; |
echo '<td class="TODO-class"> </td>'."\n"; |
| } |
} |
| echo '</tr>'."\n"; |
echo '</tr>'."\n"; |
| } |
} |
| Line 967 function phpMyEdit_form_control(theForm) |
|
| Line 965 function phpMyEdit_form_control(theForm) |
|
| |
|
| function display_change_field($row, $k) /* {{{ */ |
function display_change_field($row, $k) /* {{{ */ |
| { |
{ |
| echo '<td>'."\n"; |
echo '<td class="TODO-class">'."\n"; |
| |
|
| if ($this->col_has_values($k) && !$this->readonly($k)) { |
if ($this->col_has_values($k) && !$this->readonly($k)) { |
| $multiple = ($this->fdd[$k]['select'] == 'M' || $this->col_is_set($k)) |
$multiple = ($this->fdd[$k]['select'] == 'M' || $this->col_is_set($k)) |
| && ! $this->fdd[$k]['values']['table']; |
&& ! $this->fdd[$k]['values']['table']; |
| Line 977 function phpMyEdit_form_control(theForm) |
|
| Line 974 function phpMyEdit_form_control(theForm) |
|
| : (array) $this->fdd[$k]['values2'] + (array) $this->fdd[$k]['values']; |
: (array) $this->fdd[$k]['values2'] + (array) $this->fdd[$k]['values']; |
| echo $this->htmlSelect($this->fds[$k], $vals, $row["qf$k"], $multiple); |
echo $this->htmlSelect($this->fds[$k], $vals, $row["qf$k"], $multiple); |
| } elseif (isset($this->fdd[$k]['textarea']) && !$this->readonly($k)) { |
} elseif (isset($this->fdd[$k]['textarea']) && !$this->readonly($k)) { |
| echo '<textarea name="'.$this->fds[$k].'"'; |
echo '<textarea class="TODO-class" name="'.$this->fds[$k].'"'; |
| // rows attr |
// rows attr |
| if (isset($this->fdd[$k]['textarea']['rows'])) { |
if (isset($this->fdd[$k]['textarea']['rows'])) { |
| echo ' rows="'.$this->fdd[$k]['textarea']['rows'].'"'; |
echo ' rows="'.$this->fdd[$k]['textarea']['rows'].'"'; |
| Line 1007 function phpMyEdit_form_control(theForm) |
|
| Line 1004 function phpMyEdit_form_control(theForm) |
|
| } |
} |
| if ($this->col_is_string($k) || $this->col_is_number($k)) { |
if ($this->col_is_string($k) || $this->col_is_number($k)) { |
| // string type |
// string type |
| echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
echo '<input class="TODO-class" type="text" '.($this->readonly($k)?'disabled ':'') |
| .'name="'.$this->fds[$k].'" value="' |
.'name="'.$this->fds[$k].'" value="' |
| .$this->htmlDisplay($this->fdd[$k], $row["qf$k"], false, true, false) |
.$this->htmlDisplay($this->fdd[$k], $row["qf$k"], false, true, false) |
| .'" '.$size_ml_props.'>'; |
.'" '.$size_ml_props.'>'; |
| } elseif ($this->col_is_date($k)) { |
} elseif ($this->col_is_date($k)) { |
| # date type, get date components |
echo '<input class="TODO-class" type="text" '.($this->readonly($k)?'disabled ':'') |
| #$value = $this->mdate_from_mysql($row[$k]); |
|
| #if ($this->readonly($k)) { |
|
| # $mask = $this->fdd[$k]['datemask']; |
|
| # if (! $mask) |
|
| # $mask = $this->mdate_masks[$this->fdd[$k]['type']]; |
|
| # echo $this->mdate_format($value,$mask); |
|
| #} else { |
|
| # echo $this->mdate_disperse($k,$value,true); |
|
| #} |
|
| // string type |
|
| echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
|
| .'name="'.$this->fds[$k].'" value="' |
.'name="'.$this->fds[$k].'" value="' |
| .$this->htmlDisplay($this->fdd[$k], $row["qf$k"], false, true, false) |
.$this->htmlDisplay($this->fdd[$k], $row["qf$k"], false, true, false) |
| .'" '.$size_ml_props.'>'; |
.'" '.$size_ml_props.'>'; |
| } else { |
} else { |
| // unknown type |
// unknown type |
| echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
echo '<input class="TODO-class" type="text" '.($this->readonly($k)?'disabled ':'') |
| .'name="'.$this->fds[$k].'" value="' |
.'name="'.$this->fds[$k].'" value="' |
| .$this->htmlDisplay($this->fdd[$k],$row["qf$k"], false, true, false).'">'; |
.$this->htmlDisplay($this->fdd[$k],$row["qf$k"], false, true, false).'">'; |
| } |
} |
| Line 1040 function phpMyEdit_form_control(theForm) |
|
| Line 1026 function phpMyEdit_form_control(theForm) |
|
| |
|
| function display_password_field($row, $k) /* {{{ */ |
function display_password_field($row, $k) /* {{{ */ |
| { |
{ |
| echo '<td>'."\n"; |
echo '<td class="TODO-class">'."\n"; |
| $size_ml_props = ''; |
$size_ml_props = ''; |
| if ($this->fdd[$k]['type'] != 'blob') { |
if ($this->fdd[$k]['type'] != 'blob') { |
| $maxlen = intval($this->fdd[$k]['maxlen']); |
$maxlen = intval($this->fdd[$k]['maxlen']); |
| Line 1049 function phpMyEdit_form_control(theForm) |
|
| Line 1035 function phpMyEdit_form_control(theForm) |
|
| $size && $size_ml_props .= ' size="'.$size.'"'; |
$size && $size_ml_props .= ' size="'.$size.'"'; |
| $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
| } |
} |
| echo '<input type="password" '.($this->readonly($k)?'disabled ':'') |
echo '<input class="TODO-class" type="password" '.($this->readonly($k)?'disabled ':'') |
| .'name="'.$this->fds[$k].'" value="' |
.'name="'.$this->fds[$k].'" value="' |
| .$this->htmlDisplay($this->fdd[$k], $row["qf$k"], false, true, false) |
.$this->htmlDisplay($this->fdd[$k], $row["qf$k"], false, true, false) |
| .'" '.$size_ml_props.'>'; |
.'" '.$size_ml_props.'>'; |
| Line 1058 function phpMyEdit_form_control(theForm) |
|
| Line 1044 function phpMyEdit_form_control(theForm) |
|
| |
|
| function display_delete_field($row, $k) /* {{{ */ |
function display_delete_field($row, $k) /* {{{ */ |
| { |
{ |
| echo '<td>'; |
echo '<td class="TODO-class">'; |
| if ($this->is_values2($k, $row["qf$k"])) { |
if ($this->is_values2($k, $row["qf$k"])) { |
| echo nl2br($this->htmlDisplay($k, $this->fdd[$k]['values2'][$row['qf'.$k.'_idx']], |
echo nl2br($this->htmlDisplay($k, $this->fdd[$k]['values2'][$row['qf'.$k.'_idx']], |
| true, true, true, false)); |
true, true, true, false)); |
| Line 1077 function phpMyEdit_form_control(theForm) |
|
| Line 1063 function phpMyEdit_form_control(theForm) |
|
| function htmlHidden($name, $value) /* {{{ */ |
function htmlHidden($name, $value) /* {{{ */ |
| { |
{ |
| // Here are purpously not used htmlspecialchars() |
// Here are purpously not used htmlspecialchars() |
| return '<input type=hidden name="'.$name.'" value="'.$value.'">'."\n"; |
return '<input type="hidden" name="'.$name.'" value="'.$value.'">'."\n"; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| /** |
/** |
| Line 1092 function phpMyEdit_form_control(theForm) |
|
| Line 1078 function phpMyEdit_form_control(theForm) |
|
| */ |
*/ |
| function htmlSelect($name, $kv_array, $selected = null, $multiple = false, $nat_sort = false) /* {{{ */ |
function htmlSelect($name, $kv_array, $selected = null, $multiple = false, $nat_sort = false) /* {{{ */ |
| { |
{ |
| $ret = '<select name="'.htmlspecialchars($name); |
$ret = '<select class="TODO-class" name="'.htmlspecialchars($name); |
| if ($multiple) { |
if ($multiple) { |
| $ret .= '[]" multiple size="'.$this->multiple; |
$ret .= '[]" multiple size="'.$this->multiple; |
| !is_array($selected) && $selected = explode(',', $selected); |
!is_array($selected) && $selected = explode(',', $selected); |
| Line 1411 function phpMyEdit_form_control(theForm) |
|
| Line 1397 function phpMyEdit_form_control(theForm) |
|
| */ |
*/ |
| function display_list_table_buttons($total_recs) /* {{{ */ |
function display_list_table_buttons($total_recs) /* {{{ */ |
| { |
{ |
| // Are we doing a listall? |
$listall = $this->inc <= 0; // Are we doing a listall? |
| $listall = $this->inc <= 0; |
echo '<table class="TODO-class">'; |
| |
echo '<tr class="TODO-class"><td class="TODO-class">' . "\n"; |
| // note that <input disabled isn\'t valid HTML but most browsers support it |
// Note that <input disabled isn't valid HTML, but most browsers support it |
| // TODO: classify this table and cells |
|
| echo '<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border:0;padding:0;">'; |
|
| echo '<tr><td align=left style="text-align:left;border:0;">' . "\n"; |
|
| $disabled = ($this->fm > 0 && ! $listall) ? '' : ' disabled'; |
$disabled = ($this->fm > 0 && ! $listall) ? '' : ' disabled'; |
| echo '<input'.$disabled.' type="submit" name="'.ltrim($disabled).'prev" value="' |
echo '<input'.$disabled.' class="TODO-class" type="submit" name="'.ltrim($disabled).'prev" value="' |
| .$this->labels['Prev'].'"> '; |
.$this->labels['Prev'].'"> '; |
| if ($this->add_enabled ()) { |
if ($this->add_enabled ()) { |
| echo '<input type="submit" name="operation" value="'.$this->labels['Add'].'"> '; |
echo '<input class="TODO-class" type="submit" name="operation" value="'.$this->labels['Add'].'"> '; |
| } |
} |
| |
|
| if ($this->nav_buttons()) { |
if ($this->nav_buttons()) { |
| if ($this->view_enabled()) { |
if ($this->view_enabled()) { |
| echo '<input'; |
echo '<input class="TODO-class"'; |
| if (! $total_recs) { echo ' disabled'; } |
if (! $total_recs) { echo ' disabled'; } |
| echo ' type="submit" name="operation" value="'.$this->labels['View'].'"> '; |
echo ' type="submit" name="operation" value="'.$this->labels['View'].'"> '; |
| } |
} |
| if ($this->change_enabled()) { |
if ($this->change_enabled()) { |
| echo '<input'; |
echo '<input class="TODO-class"'; |
| if (! $total_recs) { echo ' disabled'; } |
if (! $total_recs) { echo ' disabled'; } |
| echo ' type="submit" name="operation" value="'.$this->labels['Change'].'"> '; |
echo ' type="submit" name="operation" value="'.$this->labels['Change'].'"> '; |
| } |
} |
| if ($this->copy_enabled()) { |
if ($this->copy_enabled()) { |
| echo '<input'; |
echo '<input class="TODO-class"'; |
| if (! $total_recs) { echo ' disabled'; } |
if (! $total_recs) { echo ' disabled'; } |
| echo ' type="submit" name="operation" value="'.$this->labels['Copy'].'"> '; |
echo ' type="submit" name="operation" value="'.$this->labels['Copy'].'"> '; |
| } |
} |
| if ($this->delete_enabled()) { |
if ($this->delete_enabled()) { |
| echo '<input'; |
echo '<input class="TODO-class"'; |
| if (! $total_recs) { echo ' disabled'; } |
if (! $total_recs) { echo ' disabled'; } |
| echo ' type="submit" name="operation" value="'.$this->labels['Delete'].'"> '; |
echo ' type="submit" name="operation" value="'.$this->labels['Delete'].'"> '; |
| } // if else |
} // if else |
| } |
} |
| |
|
| $disabled = ($this->fm + $this->inc < $total_recs && ! $listall) ? '' : ' disabled'; |
$disabled = ($this->fm + $this->inc < $total_recs && ! $listall) ? '' : ' disabled'; |
| echo '<input'.$disabled.' type="submit" name="'.ltrim($disabled).'next" value="' |
echo '<input'.$disabled.' class="TODO-class" type="submit" name="'.ltrim($disabled).'next" value="' |
| .$this->labels['Next'].'">'; |
.$this->labels['Next'].'">'; |
| |
|
| // Message is now written here |
// Message is now written here |
| echo '</td><td align="center" style="text-align:center;border:0;" ><b>'.$this->message.'</b></td>'; |
echo '</td><td class="TODO-class">'.$this->message.'</td>'; |
| |
|
| // display page and records statistics |
// display page and records statistics |
| echo '<td align="right" style="text-align:right;border:0;" >' . "\n"; |
echo '<td class="TODO-class">' . "\n"; |
| if ($listall) { |
if ($listall) { |
| echo $this->labels['Page'].': 1 '.$this->labels['of'].' 1'; |
echo $this->labels['Page'].': 1 '.$this->labels['of'].' 1'; |
| } else { |
} else { |
| Line 1474 function phpMyEdit_form_control(theForm) |
|
| Line 1457 function phpMyEdit_form_control(theForm) |
|
| */ |
*/ |
| function display_record_buttons() /* {{{ */ |
function display_record_buttons() /* {{{ */ |
| { |
{ |
| // TODO: classify this table and cells |
echo '<table class="TODO-class">'; |
| echo '<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border:0;">'; |
echo '<tr class="TODO-class"><td class="TODO-class">' . "\n"; |
| echo '<tr><td align="left" style="text-align:left;border:0;">' . "\n"; |
|
| if ($this->change_operation()) { |
if ($this->change_operation()) { |
| echo '<input type="submit" name="savechange" value="'.$this->labels['Save'].'">'."\n"; |
echo '<input class="TODO-class" type="submit" name="savechange" value="'.$this->labels['Save'].'">'."\n"; |
| echo '<input type="submit" name="morechange" value="'.$this->labels['Apply'].'">'."\n"; |
echo '<input class="TODO-class" type="submit" name="morechange" value="'.$this->labels['Apply'].'">'."\n"; |
| echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();">'."\n"; |
echo '<input class="TODO-class" type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();">'."\n"; |
| } elseif ($this->add_operation()) { |
} elseif ($this->add_operation()) { |
| echo '<input type="submit" name="saveadd" value="'.$this->labels['Save'].'">'."\n"; |
echo '<input class="TODO-class" type="submit" name="saveadd" value="'.$this->labels['Save'].'">'."\n"; |
| echo '<input type="submit" name="moreadd" value="'.$this->labels['More'].'">'."\n"; |
echo '<input class="TODO-class" 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 class="TODO-class" 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 class="TODO-class" 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 class="TODO-class" 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 class="TODO-class" type="submit" name="savedelete" value="'.$this->labels['Delete'].'">'."\n"; |
| echo '<input type="submit" name="cancel" value="'.$this->labels['Cancel'].'">'."\n"; |
echo '<input class="TODO-class" 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 class="TODO-class" type="submit" name="operation" value="'.$this->labels['Change'].'">'."\n"; |
| } |
} |
| echo '<input type="submit" name="cancel" value="'.$this->labels['Cancel'].'">'."\n"; |
echo '<input class="TODO-class" type="submit" name="cancel" value="'.$this->labels['Cancel'].'">'."\n"; |
| } |
} |
| // Message is now written here |
// Message is now written here |
| echo '</td><td align="center" style="text-align:center;border:0;" ><b>'.$this->message.'</b></td>'; |
echo '</td><td class="TODO-class">'.$this->message.'</td>'; |
| echo '</td></tr></table>'."\n"; |
echo '</td></tr></table>'."\n"; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| Line 1525 function phpMyEdit_form_control(theForm) |
|
| Line 1507 function phpMyEdit_form_control(theForm) |
|
| * If user is allowed to Change/Delete records, we need an extra column |
* If user is allowed to Change/Delete records, we need an extra column |
| * to allow users to select a record |
* to allow users to select a record |
| */ |
*/ |
| |
|
| $select_recs = $this->key != '' && |
$select_recs = $this->key != '' && |
| ($this->change_enabled() || $this->delete_enabled() || $this->view_enabled()); |
($this->change_enabled() || $this->delete_enabled() || $this->view_enabled()); |
| |
|
| // Are we doing a listall? |
// Are we doing a listall? |
| $listall = $this->inc <= 0; |
$listall = $this->inc <= 0; |
| |
|
| /* |
/* |
| * Display the MySQL table in an HTML table |
* Display the MySQL table in an HTML table |
| */ |
*/ |
| |
|
| //$comp_ops = array( |
|
| // ''=>'','%3C'=>'%3C','%3C%3D'=>'%3C%3D', |
|
| // '%3D'=>'%3D','%3E%3D'=>'%3E%3D','%3E'=>'%3E'); |
|
| $comp_ops = array( |
$comp_ops = array( |
| ''=>'','<'=>'<','<='=>'<=', |
''=>'','<'=>'<','<='=>'<=', |
| '='=>'=','>='=>'>=','>'=>'>'); |
'='=>'=','>='=>'>=','>'=>'>'); |
| echo '<form action="'.$this->page_name.'" method="POST">'."\n"; |
echo '<form class="TODO-class" action="',$this->page_name,'" method="POST">',"\n"; |
| echo $this->get_origvars_html($this->get_sfn_cgi_vars()); |
echo $this->get_origvars_html($this->get_sfn_cgi_vars()); |
| echo '<input type="hidden" name="fl" value="'.$this->fl.'">'."\n"; |
echo '<input type="hidden" name="fl" value="'.$this->fl.'">'."\n"; |
| |
|
| $prev_qfn = $this->qfn; |
$prev_qfn = $this->qfn; |
| $hidden_qfs = $this->get_qf_hidden_fields(); |
$hidden_qfs = $this->get_qf_hidden_fields(); |
| // if sort sequence has changed, restart listing |
// if sort sequence has changed, restart listing |
| $this->qfn != $prev_qfn && $this->fm = 0; |
$this->qfn != $prev_qfn && $this->fm = 0; |
| |
|
| if (0) { // TODO: delete me! |
if (0) { // TODO: delete me! |
| echo '$this->qfn vs. $prev_qfn comparsion:::::'; |
echo '$this->qfn vs. $prev_qfn comparsion:::::'; |
| echo '<b>'.htmlspecialchars($this->qfn).'</b>:::::'; |
echo '<b>'.htmlspecialchars($this->qfn).'</b>:::::'; |
| Line 1558 function phpMyEdit_form_control(theForm) |
|
| Line 1531 function phpMyEdit_form_control(theForm) |
|
| echo 'comparsion <u>'.($this->qfn == $prev_qfn ? 'proved' : 'failed').'</u>'; |
echo 'comparsion <u>'.($this->qfn == $prev_qfn ? 'proved' : 'failed').'</u>'; |
| echo '<hr>'; |
echo '<hr>'; |
| } |
} |
| |
|
| // Display buttons at top and/or bottom of page. |
// Display buttons at top and/or bottom of page. |
| // Setup query to get num_rows. (sparky) |
// Setup query to get num_rows. (sparky) |
| $total_recs = 0; |
$total_recs = 0; |
| Line 1570 function phpMyEdit_form_control(theForm) |
|
| Line 1542 function phpMyEdit_form_control(theForm) |
|
| $res = $this->myquery($this->query_make($count_parts), __LINE__); |
$res = $this->myquery($this->query_make($count_parts), __LINE__); |
| $row = @mysql_fetch_array($res, MYSQL_ASSOC); |
$row = @mysql_fetch_array($res, MYSQL_ASSOC); |
| $total_recs = $row['num_rows']; |
$total_recs = $row['num_rows']; |
| |
|
| if ($this->nav_up()) { |
if ($this->nav_up()) { |
| $this->display_list_table_buttons($total_recs); |
$this->display_list_table_buttons($total_recs); |
| echo '<hr>'."\n"; |
echo '<hr class="TODO-class">'."\n"; |
| } |
} |
| |
|
| if ($this->cgi['persist'] != '') { |
if ($this->cgi['persist'] != '') { |
| echo $this->get_origvars_html($this->cgi['persist']); |
echo $this->get_origvars_html($this->cgi['persist']); |
| } |
} |
| Line 1584 function phpMyEdit_form_control(theForm) |
|
| Line 1554 function phpMyEdit_form_control(theForm) |
|
| } |
} |
| echo '<input type=hidden name=qfn value="'.htmlspecialchars($this->qfn).'">'."\n"; |
echo '<input type=hidden name=qfn value="'.htmlspecialchars($this->qfn).'">'."\n"; |
| echo '<input type=hidden name=fm value="'.htmlspecialchars($this->fm).'">'."\n"; |
echo '<input type=hidden name=fm value="'.htmlspecialchars($this->fm).'">'."\n"; |
| echo '<table width="100%" border="1" cellpadding="1" cellspacing="0"'; |
echo '<table class="TODO-class" summary="',$this->tb,'">',"\n"; |
| echo ' summary="'.$this->tb.'">'."\n"; |
echo '<tr class="TODO-class">',"\n"; |
| echo '<tr>'."\n"; |
|
| |
|
| /* |
/* |
| * System (navigation, selection) columns counting |
* System (navigation, selection) columns counting |
| */ |
*/ |
| Line 1597 function phpMyEdit_form_control(theForm) |
|
| Line 1565 function phpMyEdit_form_control(theForm) |
|
| $sys_cols += intval($this->nav_buttons() |
$sys_cols += intval($this->nav_buttons() |
| && ($this->nav_text_links() || $this->nav_graphic_links())); |
&& ($this->nav_text_links() || $this->nav_graphic_links())); |
| } |
} |
| |
|
| /* |
/* |
| * We need an initial column(s) (sys columns) |
* We need an initial column(s) (sys columns) |
| * if we have filters, Changes or Deletes enabled |
* if we have filters, Changes or Deletes enabled |
| */ |
*/ |
| if ($sys_cols) { |
if ($sys_cols) { |
| echo '<th colspan="'.$sys_cols.'" align="center" width="1%" nowrap="nowrap">'; |
echo '<th class="TODO-class" colspan="'.$sys_cols.'">'; |
| if ($this->filter_enabled()) { |
if ($this->filter_enabled()) { |
| if ($this->fl) { |
if ($this->fl) { |
| echo '<input type=submit name=sw value="'.$this->labels['Hide'].'">'; |
echo '<input class="TODO-class" type=submit name=sw value="'.$this->labels['Hide'].'">'; |
| echo '<input type=submit name=sw value="'.$this->labels['Clear'].'">'; |
echo '<input class="TODO-class" type=submit name=sw value="'.$this->labels['Clear'].'">'; |
| } else { |
} else { |
| echo '<input type=submit name=sw value="'.$this->labels['Search'].'">'; |
echo '<input class="TODO-class" type=submit name=sw value="'.$this->labels['Search'].'">'; |
| } |
} |
| } else { |
} else { |
| echo ' '; |
echo ' '; |
| } |
} |
| echo '</th>'."\n"; |
echo '</th>'."\n"; |
| } |
} |
| |
|
| 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]) { |
| $fdn = $this->fdd[$fd]['name']; |
$fdn = $this->fdd[$fd]['name']; |
| $w = isset($this->fdd[$fd]['width']) ? ' width="'.$this->fdd[$fd]['width'].'"' : ''; |
$w = isset($this->fdd[$fd]['width']) ? ' width="'.$this->fdd[$fd]['width'].'"' : ''; |
| if (! $this->fdd[$fd]['sort'] || $this->hidden($fd) || $this->password($fd)) { |
if (! $this->fdd[$fd]['sort'] || $this->hidden($fd) || $this->password($fd)) { |
| echo '<th'.$w.'>'.$fdn.'</th>'."\n"; |
echo '<th'.$w.' class="TODO-class">'.$fdn.'</th>'."\n"; |
| } else { |
} else { |
| // Clicking on the current sort field reverses the sort order |
// Clicking on the current sort field reverses the sort order |
| $new_sfn = $this->sfn; |
$new_sfn = $this->sfn; |
| array_unshift($new_sfn, in_array("$k", $new_sfn, 1) ? "-$k" : $k); |
array_unshift($new_sfn, in_array("$k", $new_sfn, 1) ? "-$k" : $k); |
| echo '<th'.$w.'><a href="'; |
echo '<th'.$w.' class="TODO-class"><a class="TODO-class" href="'; |
| echo htmlspecialchars($this->page_name.'?fm=0&fl='.$this->fl.'&' |
echo htmlspecialchars($this->page_name.'?fm=0&fl='.$this->fl.'&' |
| .$this->get_sfn_cgi_vars($new_sfn).$this->cgi['persist'].$this->qfn); |
.$this->get_sfn_cgi_vars($new_sfn).$this->cgi['persist'].$this->qfn); |
| echo '">',$fdn,'</a></th>',"\n"; |
echo '">',$fdn,'</a></th>',"\n"; |
| } |
} |
| } |
} |
| |
} |
| // if we have any aggregates going on, then we have to list all results |
|
| // $var_to_total = 'qf'.$k.'_aggr'; |
|
| // $$var_to_total = $this->get_cgi_var($var_to_total); |
|
| // if ($$var_to_total != '') { |
|
| // $listall = true; |
|
| // } |
|
| } // for |
|
| |
|
| echo '</tr>'."\n"; |
echo '</tr>'."\n"; |
| |
|
| |
|
| /* |
/* |
| * Prepare the SQL Query from the data definition file |
* Prepare the SQL Query from the data definition file |
| */ |
*/ |
| Line 1665 function phpMyEdit_form_control(theForm) |
|
| Line 1622 function phpMyEdit_form_control(theForm) |
|
| //$raw_sort_fields = array(); |
//$raw_sort_fields = array(); |
| $sort_fields = array(); |
$sort_fields = array(); |
| $sort_fields_w = array(); |
$sort_fields_w = array(); |
| |
|
| foreach ($this->sfn as $field) { |
foreach ($this->sfn as $field) { |
| if ($field[0] == '-') { |
if ($field[0] == '-') { |
| $field = substr($field, 1); |
$field = substr($field, 1); |
| Line 1720 function phpMyEdit_form_control(theForm) |
|
| Line 1676 function phpMyEdit_form_control(theForm) |
|
| * Draw the filter and fill it with any data typed in last pass and stored |
* Draw the filter and fill it with any data typed in last pass and stored |
| * in the array parameter keyword 'filter'. Prepare the SQL WHERE clause. |
* in the array parameter keyword 'filter'. Prepare the SQL WHERE clause. |
| */ |
*/ |
| |
|
| if ($this->fl) { |
if ($this->fl) { |
| // Filter row retrieval |
// Filter row retrieval |
| $fields = false; |
$fields = false; |
| Line 1741 function phpMyEdit_form_control(theForm) |
|
| Line 1696 function phpMyEdit_form_control(theForm) |
|
| if (is_array($filter_row)) { |
if (is_array($filter_row)) { |
| $fields = array_flip(array_keys($filter_row)); |
$fields = array_flip(array_keys($filter_row)); |
| } |
} |
| |
|
| if ($fields != false) { |
if ($fields != false) { |
| echo '<tr>'; |
echo '<tr class="TODO-class">'; |
| echo '<td colspan='.$sys_cols.' align="center">'; |
echo '<td class="TODO-class" colspan="',$sys_cols,'">'; |
| echo '<input type="submit" name="filter" value="' |
echo '<input class="TODO-class" type="submit" name="filter" value="' |
| .$this->labels['Query'].'"></td>'."\n"; |
.$this->labels['Query'].'"></td>'."\n"; |
| |
|
| for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
| Line 1759 function phpMyEdit_form_control(theForm) |
|
| Line 1713 function phpMyEdit_form_control(theForm) |
|
| $mc = $this->get_cgi_var($lc, ''); |
$mc = $this->get_cgi_var($lc, ''); |
| $mi = $this->get_cgi_var($li, ''); |
$mi = $this->get_cgi_var($li, ''); |
| |
|
| $widthStyle = ''; |
|
| if (isset($this->fdd[$fd]['width'])) { |
if (isset($this->fdd[$fd]['width'])) { |
| $widthStyle = ' STYLE=\'width: "'.(6*$this->fdd[$fd]['width']).'px"\''; |
$widthStyle = ' STYLE=\'width: "'.(6*$this->fdd[$fd]['width']).'px"\''; |
| } |
} |
| Line 1796 function phpMyEdit_form_control(theForm) |
|
| Line 1749 function phpMyEdit_form_control(theForm) |
|
| $size = $maxlen < 30 ? min($maxlen, 8) : 12; |
$size = $maxlen < 30 ? min($maxlen, 8) : 12; |
| $size && $size_ml_props .= ' size="'.$size.'"'; |
$size && $size_ml_props .= ' size="'.$size.'"'; |
| $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
| if (0) { |
|
| echo $this->fdd[$fd]['name'],'|qf',$k,'|'; |
|
| echo mysql_field_len($res, $fields["qf$k"]); |
|
| echo "|size=$size|maxlen=$maxlen<br>\n"; |
|
| } |
|
| } |
} |
| if ($this->col_is_string($k)) { |
if ($this->col_is_string($k)) { |
| // it's treated as a string |
// it's treated as a string |
| echo '<input type="text" name="qf'.$k.'"'; |
echo '<input class="TODO-class" type="text" name="qf'.$k.'"'; |
| echo ' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>'; |
echo ' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>'; |
| } elseif ($this->col_is_date($k)) { |
} elseif ($this->col_is_date($k)) { |
| // it's a date |
// it's a date |
| // it's treated as a string |
// it's treated as a string |
| echo '<input type="text" name="qf'.$k.'"'; |
echo '<input class="TODO-class" type="text" name="qf'.$k.'"'; |
| echo ' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>'; |
echo ' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>'; |
| } elseif ($this->col_is_number($k)) { |
} elseif ($this->col_is_number($k)) { |
| // it's a number |
// it's a number |
| echo $this->htmlSelect($l.'_comp',$comp_ops,$mc); |
echo $this->htmlSelect($l.'_comp',$comp_ops,$mc); |
| // it's treated as a string |
// it's treated as a string |
| echo '<input type="text" name="qf'.$k.'"' |
echo '<input class="TODO-class" type="text" name="qf'.$k.'"' |
| .' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>'; |
.' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>'; |
| } else { |
} else { |
| // type is 'unknown' or not set, it's treated as a string |
// type is 'unknown' or not set, it's treated as a string |
| echo '<input type="text" name="qf'.$k.'"'; |
echo '<input class="TODO-class" type="text" name="qf'.$k.'"'; |
| echo ' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>'; |
echo ' value="'.htmlspecialchars($m).'"'.$size_ml_props.'>'; |
| } |
} |
| } else { |
} else { |
| echo ' '; |
echo ' '; |
| } |
} |
| |
|
| // if it's int or real and if not password or hidden, display aggr options |
|
| /* XXX Disabled until we have time to work on this |
|
| |
|
| if ((! $this->password($k) && ! $this->hidden($k)) |
|
| && (($this->col_is_number($k)) && (! isset($this->fdd[$k]['values'])))) { |
|
| |
|
| $var_to_total = 'qf'.$k.'_aggr'; |
|
| global $$var_to_total; |
|
| $aggr_function = $$var_to_total; |
|
| if (isset($$var_to_total)) { |
|
| $vars_to_total[] = $this->fqn($k); |
|
| $aggr_from_clause .= |
|
| ' '.$aggr_function.'('. |
|
| $this->fqn($k). |
|
| ') as '.$var_to_total; |
|
| } |
|
| echo '<br>Aggr: '; |
|
| echo $this->htmlSelect($var_to_total,$this->sql_aggrs,$$var_to_total); |
|
| if ($$var_to_total != '') { |
|
| $listall = true; |
|
| } |
|
| } else { |
|
| echo ' '; |
|
| } |
|
| */ |
|
| echo '</td>'."\n"; |
echo '</td>'."\n"; |
| } else { |
} else { |
| echo '<td> </td>'."\n"; |
echo '<td class="TODO-class"> </td>'."\n"; |
| } |
} |
| } |
} |
| echo '</tr>'."\n"; |
echo '</tr>'."\n"; |
| } |
} |
| } // }}} |
} // }}} |
| |
|
| |
|
| /* |
/* |
| * Display sorting sequence |
* Display sorting sequence |
| */ |
*/ |
| |
|
| if ($qparts['orderby'] && $this->display['sort']) { |
if ($qparts['orderby'] && $this->display['sort']) { |
| //$cgi_persist = $this->cgi['persist']; |
echo '<tr class="TODO-class"><td class="TODO-class" colspan=',$sys_cols,'>','<a class="TODO-class" href="'; |
| //$cgi_persist != '' && $cgi_persist[0] = '?'; |
|
| echo '<tr><td colspan=',$sys_cols,' align="center">','<a class="pme_a_t" href="'; |
|
| echo htmlspecialchars($this->get_server_var('PHP_SELF').'?fl='.$this->fl.'&fm='.$this->fm |
echo htmlspecialchars($this->get_server_var('PHP_SELF').'?fl='.$this->fl.'&fm='.$this->fm |
| .$this->qfn.$this->cgi['persist']); |
.$this->qfn.$this->cgi['persist']); |
| echo '">',$this->labels['Clear'],'</a></td>',"\n"; |
echo '">',$this->labels['Clear'],'</a></td>',"\n"; |
| echo '<td colspan="'.$this->num_fields_displayed.'">',$this->labels['Sorted By'],': <i>'; |
echo '<td class="TODO-class" colspan="'.$this->num_fields_displayed.'">',$this->labels['Sorted By']; |
| echo join(', ', $sort_fields_w),'</i></td></tr>',"\n"; |
echo ':',join(', ', $sort_fields_w),'</td></tr>',"\n"; |
| } |
} |
| |
|
| /* |
/* |
| * Display the current query |
* Display the current query |
| */ |
*/ |
| |
|
| $text_query = $this->make_where_from_query_opts(null, true); |
$text_query = $this->make_where_from_query_opts(null, true); |
| if ($text_query != '' && $this->display['query']) { |
if ($text_query != '' && $this->display['query']) { |
| echo '<tr><td colspan=',$sys_cols,' align="center">','<a class="pme_a_t" href="'; |
echo '<tr class="TODO-class"><td class="TODO-class" colspan=',$sys_cols,'>','<a class="TODO-class" href="'; |
| echo htmlspecialchars($this->get_server_var('PHP_SELF').'?fl='.$this->fl.'&fm='.$this->fm |
echo htmlspecialchars($this->get_server_var('PHP_SELF').'?fl='.$this->fl.'&fm='.$this->fm |
| .'&'.$this->get_sfn_cgi_vars().$this->cgi['persist']); |
.'&'.$this->get_sfn_cgi_vars().$this->cgi['persist']); |
| echo '">',$this->labels['Clear'],'</a></td>',"\n"; |
echo '">',$this->labels['Clear'],'</a></td>',"\n"; |
| echo '<td colspan="',$this->num_fields_displayed.'">',$this->labels['Current Query'],': <i>'; |
echo '<td class="TODO-class" colspan="',$this->num_fields_displayed.'">',$this->labels['Current Query']; |
| echo htmlspecialchars($text_query),'</i></td></tr>',"\n"; |
echo ': ',htmlspecialchars($text_query),'</td></tr>',"\n"; |
| } |
} |
| |
|
| if ($this->nav_text_links() || $this->nav_graphic_links()) { |
if ($this->nav_text_links() || $this->nav_graphic_links()) { |
| Line 1909 function phpMyEdit_form_control(theForm) |
|
| Line 1826 function phpMyEdit_form_control(theForm) |
|
| $qpchangeStr = '?'.join('&',$qpchange).$this->qfn; |
$qpchangeStr = '?'.join('&',$qpchange).$this->qfn; |
| $qpdeleteStr = '?'.join('&',$qpdelete).$this->qfn; |
$qpdeleteStr = '?'.join('&',$qpdelete).$this->qfn; |
| } |
} |
| |
|
| $fetched = true; |
$fetched = true; |
| $first = true; |
$first = true; |
| $rowCount = 0; |
$rowCount = 0; |
| |
|
| while ((!$fetched && ($row = @mysql_fetch_array($res, MYSQL_ASSOC)) != false) |
while ((!$fetched && ($row = @mysql_fetch_array($res, MYSQL_ASSOC)) != false) |
| || ($fetched && $row != false)) { |
|| ($fetched && $row != false)) { |
| $fetched = false; |
$fetched = false; |
| |
echo '<tr class="TODO-class">',"\n"; |
| echo '<tr class="'.(($rowCount++%2)?'pme_tr_o':'pme_tr_e')."\">\n"; |
|
| if ($sys_cols) { |
if ($sys_cols) { |
| $key_rec = $row['qf'.$this->key_num]; |
$key_rec = $row['qf'.$this->key_num]; |
| $qviewStr = $qpviewStr . '&rec='.$key_rec; |
$qviewStr = $qpviewStr . '&rec='.$key_rec; |
| Line 1927 function phpMyEdit_form_control(theForm) |
|
| Line 1842 function phpMyEdit_form_control(theForm) |
|
| $qdeleteStr = $qpdeleteStr . '&rec='.$key_rec; |
$qdeleteStr = $qpdeleteStr . '&rec='.$key_rec; |
| if ($select_recs) { |
if ($select_recs) { |
| if (! $this->nav_buttons() || $sys_cols > 1) { |
if (! $this->nav_buttons() || $sys_cols > 1) { |
| echo '<td style="white-space:nowrap;text-align:center;" width="1%">'; |
echo '<td class="TODO-class">'; |
| } |
} |
| if ($this->nav_graphic_links()) { |
if ($this->nav_graphic_links()) { |
| $printed_out = false; |
$printed_out = false; |
| if ($this->view_enabled()) { |
if ($this->view_enabled()) { |
| $printed_out = true; |
$printed_out = true; |
| echo '<a class="pme_a_t" href="'; |
echo '<a class="TODO-class" href="'; |
| echo htmlspecialchars($this->page_name.$qviewStr); |
echo htmlspecialchars($this->page_name.$qviewStr); |
| echo '"><img src="'.$this->url['images'].'pme-view.png"'; |
echo '"><img class="TODO-class" src="'.$this->url['images'].'pme-view.png"'; |
| echo ' height="15" width="16" border="0" alt="' |
echo ' height="15" width="16" border="0" alt="' |
| .htmlspecialchars($this->labels['View']).'"></a>'; |
.htmlspecialchars($this->labels['View']).'"></a>'; |
| } |
} |
| if ($this->change_enabled()) { |
if ($this->change_enabled()) { |
| $printed_out && print(' '); |
$printed_out && print(' '); |
| $printed_out = true; |
$printed_out = true; |
| echo '<a class="pme_a_t" href="'; |
echo '<a class="TODO-class" href="'; |
| echo htmlspecialchars($this->page_name.$qchangeStr); |
echo htmlspecialchars($this->page_name.$qchangeStr); |
| echo '"><img src="'.$this->url['images'].'pme-change.png"'; |
echo '"><img class="TODO-class" src="'.$this->url['images'].'pme-change.png"'; |
| echo ' height="15" width="16" border="0" alt="' |
echo ' height="15" width="16" border="0" alt="' |
| .htmlspecialchars($this->labels['Change']).'"></a>'; |
.htmlspecialchars($this->labels['Change']).'"></a>'; |
| } |
} |
| if ($this->copy_enabled()) { |
if ($this->copy_enabled()) { |
| $printed_out && print(' '); |
$printed_out && print(' '); |
| $printed_out = true; |
$printed_out = true; |
| echo '<a class="pme_a_t" href="'; |
echo '<a class="TODO-class" href="'; |
| echo htmlspecialchars($this->page_name.$qcopyStr); |
echo htmlspecialchars($this->page_name.$qcopyStr); |
| echo '"><img src="'.$this->url['images'].'pme-copy.png"'; |
echo '"><img class="TODO-class" src="'.$this->url['images'].'pme-copy.png"'; |
| echo ' height="15" width="16" border="0" alt="' |
echo ' height="15" width="16" border="0" alt="' |
| .htmlspecialchars($this->labels['Copy']).'"></a>'; |
.htmlspecialchars($this->labels['Copy']).'"></a>'; |
| } |
} |
| if ($this->delete_enabled()) { |
if ($this->delete_enabled()) { |
| $printed_out && print(' '); |
$printed_out && print(' '); |
| $printed_out = true; |
$printed_out = true; |
| echo '<a class="pme_a_t" href="'; |
echo '<a class="TODO-class" href="'; |
| echo htmlspecialchars($this->page_name.$qdeleteStr); |
echo htmlspecialchars($this->page_name.$qdeleteStr); |
| echo '"><img src="'.$this->url['images'].'pme-delete.png"'; |
echo '"><img class="TODO-class" src="'.$this->url['images'].'pme-delete.png"'; |
| echo ' height="15" width="16" border="0" alt="' |
echo ' height="15" width="16" border="0" alt="' |
| .htmlspecialchars($this->labels['Delete']).'"></a>'; |
.htmlspecialchars($this->labels['Delete']).'"></a>'; |
| } |
} |
| } |
} |
| if ($this->nav_text_links()) { |
if ($this->nav_text_links()) { |
| if ($this->nav_graphic_links()) { |
if ($this->nav_graphic_links()) { |
| echo '<br>'; |
echo '<br class="TODO-class">'; |
| } |
} |
| $printed_out = false; |
$printed_out = false; |
| if ($this->view_enabled()) { |
if ($this->view_enabled()) { |
| $printed_out = true; |
$printed_out = true; |
| echo '<a class="pme_a_t" href="' |
echo '<a class="TODO-class" href="' |
| .htmlspecialchars($this->page_name.$qviewStr).'">V</a> '; |
.htmlspecialchars($this->page_name.$qviewStr).'">V</a> '; |
| } |
} |
| if ($this->change_enabled()) { |
if ($this->change_enabled()) { |
| $printed_out && print(' '); |
$printed_out && print(' '); |
| $printed_out = true; |
$printed_out = true; |
| echo '<a class="pme_a_t" href="' |
echo '<a class="TODO-class" href="' |
| .htmlspecialchars($this->page_name.$qchangeStr).'">C</a> '; |
.htmlspecialchars($this->page_name.$qchangeStr).'">C</a> '; |
| } |
} |
| if ($this->copy_enabled()) { |
if ($this->copy_enabled()) { |
| $printed_out && print(' '); |
$printed_out && print(' '); |
| $printed_out = true; |
$printed_out = true; |
| echo '<a class="pme_a_t" href="' |
echo '<a class="TODO-class" href="' |
| .htmlspecialchars($this->page_name.$qcopyStr).'">P</a> '; |
.htmlspecialchars($this->page_name.$qcopyStr).'">P</a> '; |
| } |
} |
| if ($this->delete_enabled()) { |
if ($this->delete_enabled()) { |
| $printed_out && print(' '); |
$printed_out && print(' '); |
| $printed_out = true; |
$printed_out = true; |
| echo '<a class="pme_a_t" href="' |
echo '<a class="TODO-class" href="' |
| .htmlspecialchars($this->page_name.$qdeleteStr).'">D</a>'; |
.htmlspecialchars($this->page_name.$qdeleteStr).'">D</a>'; |
| } |
} |
| } |
} |
| Line 2000 function phpMyEdit_form_control(theForm) |
|
| Line 1915 function phpMyEdit_form_control(theForm) |
|
| echo '</td>'."\n"; |
echo '</td>'."\n"; |
| } |
} |
| if ($this->nav_buttons()) { |
if ($this->nav_buttons()) { |
| echo '<td align="center" width="1">'; |
echo '<td class="TODO-class">'; |
| echo '<input type=radio name=rec value="'.htmlspecialchars($key_rec).'"'; |
echo '<input class="TODO-class" type=radio name=rec value="'.htmlspecialchars($key_rec).'"'; |
| if ($first) { |
if ($first) { |
| echo ' checked'; |
echo ' checked'; |
| $first = false; |
$first = false; |
| Line 2009 function phpMyEdit_form_control(theForm) |
|
| Line 1924 function phpMyEdit_form_control(theForm) |
|
| echo '></td>'."\n"; |
echo '></td>'."\n"; |
| } |
} |
| } elseif ($this->filter_enabled()) { |
} elseif ($this->filter_enabled()) { |
| echo '<td colspan='.$sys_cols.'> </td>'."\n"; |
echo '<td class="TODO-class" colspan='.$sys_cols.'> </td>'."\n"; |
| } |
} |
| } |
} |
| |
|
| // Calculate the url query string for optional URL support |
// Calculate the url query string for optional URL support |
| $urlqueryproto = 'fm='.$this->fm |
$urlqueryproto = 'fm='.$this->fm |
| .'&sfn='.$this->get_sfn_cgi_vars() |
.'&sfn='.$this->get_sfn_cgi_vars() |
| Line 2024 function phpMyEdit_form_control(theForm) |
|
| Line 1938 function phpMyEdit_form_control(theForm) |
|
| continue; |
continue; |
| } |
} |
| if ($this->hidden($k) || $this->password($k)) { |
if ($this->hidden($k) || $this->password($k)) { |
| echo '<td><i>'.$this->labels['hidden'].'</i></td>'."\n"; |
echo '<td class="TODO-class">'.$this->labels['hidden'].'</td>'."\n"; |
| continue; |
continue; |
| } |
} |
| // XXX: echo 'displayed: '.$k.'-'.$fd; |
|
| |
|
| /* TODO: what's this?! |
|
| |
|
| if ((trim($row[$k]) == '') or ($row[$k] == 'NULL')) { |
|
| echo '<td> </td>'."\n"; |
|
| } else { */ |
|
| |
|
| // display the contents |
// display the contents |
| $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']) |
| Line 2044 function phpMyEdit_form_control(theForm) |
|
| Line 1950 function phpMyEdit_form_control(theForm) |
|
| 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'.$colattrs.'>'; |
echo '<td class="TODO-class"'.$colattrs.'>'; |
| // displayable |
// displayable |
| if (isset($this->fdd[$k]['URL']) |
if (isset($this->fdd[$k]['URL']) |
| || isset($this->fdd[$k]['URLprefix']) |
|| isset($this->fdd[$k]['URLprefix']) |
| Line 2073 function phpMyEdit_form_control(theForm) |
|
| Line 1979 function phpMyEdit_form_control(theForm) |
|
| } else { |
} else { |
| $urllink = htmlspecialchars($urllink); |
$urllink = htmlspecialchars($urllink); |
| $urldisp = htmlspecialchars($urldisp); |
$urldisp = htmlspecialchars($urldisp); |
| echo '<a '.$target.'class="pme_a_u" href="'.$urllink.'">'.$urldisp.'</a>'; |
echo '<a '.$target.'class="TODO-class" href="'.$urllink.'">'.$urldisp.'</a>'; |
| } |
} |
| } elseif (isset($this->fdd[$k]['datemask'])) { |
} elseif (isset($this->fdd[$k]['datemask'])) { |
| // display date according to a mask if any |
|
| //echo $this->mdate_set($row[$k],$this->fdd[$k]['type'],$this->fdd[$k]['datemask']); |
|
| //echo |
|
| // $this->mdate_displayPlain( |
|
| // $this->mdate_from_mysql( |
|
| // $row[$k]), |
|
| // ( |
|
| // $this->fdd[$k]['datemask']? |
|
| // $this->fdd[$k]['datemask'] |
|
| // : |
|
| // $this->mdate_masks[$this->fdd[$k]['type']] |
|
| // ) |
|
| // ); |
|
| //echo $row[$k]; |
|
| // it's a normal field |
|
| $shortdisp = $row["qf$k"]; |
$shortdisp = $row["qf$k"]; |
| if ($this->fdd[$k]['strip_tags']) { |
if ($this->fdd[$k]['strip_tags']) { |
| $shortdisp = strip_tags($shortdisp); |
$shortdisp = strip_tags($shortdisp); |
| Line 2122 function phpMyEdit_form_control(theForm) |
|
| Line 2013 function phpMyEdit_form_control(theForm) |
|
| true, true, true, $escape_flag)); |
true, true, true, $escape_flag)); |
| } |
} |
| echo '</td>'."\n"; |
echo '</td>'."\n"; |
| } // for |
} |
| |
|
| echo '</tr>'."\n"; |
echo '</tr>'."\n"; |
| } // while |
} |
| |
|
| |
|
| /* |
/* |
| * Display and accumulate column aggregation info, do totalling query |
* Display and accumulate column aggregation info, do totalling query |
| Line 2147 function phpMyEdit_form_control(theForm) |
|
| Line 2036 function phpMyEdit_form_control(theForm) |
|
| $tot_row = @mysql_fetch_array($totals_result, MYSQL_ASSOC); |
$tot_row = @mysql_fetch_array($totals_result, MYSQL_ASSOC); |
| //} |
//} |
| $qp_aggr = $qp; |
$qp_aggr = $qp; |
| echo "\n".'<tr>'."\n".'<td> </td>'."\n"; |
echo "\n".'<tr class="TODO-class">'."\n".'<td class="TODO-class"> </td>'."\n"; |
| /* |
/* |
| echo '<td>'; |
echo '<td>'; |
| echo printarray($qp_aggr); |
echo printarray($qp_aggr); |
| Line 2172 function phpMyEdit_form_control(theForm) |
|
| Line 2061 function phpMyEdit_form_control(theForm) |
|
| } |
} |
| echo '</tr>'."\n"; |
echo '</tr>'."\n"; |
| } |
} |
| |
|
| |
|
| echo '</table>'."\n"; // end of table rows listing |
echo '</table>'."\n"; // end of table rows listing |
| |
|
| |
|
| if ($this->nav_down()) { |
if ($this->nav_down()) { |
| echo '<hr>'."\n"; |
echo '<hr class="TODO-class">'."\n"; |
| $this->display_list_table_buttons($total_recs); |
$this->display_list_table_buttons($total_recs); |
| } |
} |
| |
|
| echo '</form>'."\n"; |
echo '</form>'."\n"; |
| //phpinfo(); |
|
| /* |
|
| foreach ( |
|
| array( |
|
| // '1999-12-31'=>'%Y-%m-%d', |
|
| // '99-Mar-31'=>'%y-%M-%d', |
|
| // '99-1-31'=>'%y-%n-%d' |
|
| // 'March 8, 1999'=>'%F %j, %Y' |
|
| // 'March 8, 1999 09:17:32'=>'%F %j, %Y %H:%i:%s' |
|
| 'March 8, 1999 9:17:32'=>'%F %j, %Y %G:%i:%s' |
|
| ) as $val=>$mask |
|
| ) { |
|
| echo "<br>\n"; |
|
| debug_var('val,mask',"$val::$mask"); |
|
| debug_var('mdate_parse',date('Y m d H:i:s',$this->mdate_parse($val,$mask))); |
|
| } |
|
| */ |
|
| } /* }}} */ |
} /* }}} */ |
| |
|
| function display_record() /* {{{ */ |
function display_record() /* {{{ */ |
| { |
{ |
| $this->create_javascripts(); |
$this->create_javascripts(); |
| |
|
| if ($this->cgi['persist'] != '') { |
if ($this->cgi['persist'] != '') { |
| echo $this->get_origvars_html($this->cgi['persist']); |
echo $this->get_origvars_html($this->cgi['persist']); |
| } |
} |
| Line 2215 function phpMyEdit_form_control(theForm) |
|
| Line 2081 function phpMyEdit_form_control(theForm) |
|
| echo '<input type="hidden" name="rec" value="'.($this->copy_operation()?'':$this->rec).'">'."\n"; |
echo '<input type="hidden" name="rec" value="'.($this->copy_operation()?'':$this->rec).'">'."\n"; |
| echo '<input type="hidden" name="fm" value="'.$this->fm.'">'."\n"; |
echo '<input type="hidden" name="fm" value="'.$this->fm.'">'."\n"; |
| echo '<input type="hidden" name="fl" value="'.$this->fl.'">'."\n"; |
echo '<input type="hidden" name="fl" value="'.$this->fl.'">'."\n"; |
| |
|
| if ($this->nav_up()) { |
if ($this->nav_up()) { |
| $this->display_record_buttons(); |
$this->display_record_buttons(); |
| echo '<hr>'."\n"; |
echo '<hr class="TODO-class">'."\n"; |
| } |
} |
| echo '<table width="100%" border="1" cellpadding="1" cellspacing="0" summary="'.$this->tb.'">'."\n"; |
echo '<table class="TODO-class" summary="'.$this->tb.'">'."\n"; |
| if ($this->add_operation()) { |
if ($this->add_operation()) { |
| $this->display_add_record(); |
$this->display_add_record(); |
| } else { |
} else { |
| Line 2228 function phpMyEdit_form_control(theForm) |
|
| Line 2093 function phpMyEdit_form_control(theForm) |
|
| } |
} |
| echo '</table>'."\n"; |
echo '</table>'."\n"; |
| if ($this->nav_down()) { |
if ($this->nav_down()) { |
| echo '<hr>'."\n"; |
echo '<hr class="TODO-class">'."\n"; |
| $this->display_record_buttons(); |
$this->display_record_buttons(); |
| } |
} |
| echo '</form>'."\n"; |
echo '</form>'."\n"; |
| Line 2515 function phpMyEdit_form_control(theForm) |
|
| Line 2380 function phpMyEdit_form_control(theForm) |
|
| function recreate_fdd() /* {{{ */ |
function recreate_fdd() /* {{{ */ |
| { |
{ |
| // TODO: one level deeper browsing |
// TODO: one level deeper browsing |
| |
|
| $action_letter = 'L'; // list by default |
$action_letter = 'L'; // list by default |
| $this->filter_operation() && $action_letter = 'F'; |
$this->filter_operation() && $action_letter = 'F'; |
| $this->view_operation() && $action_letter = 'V'; |
$this->view_operation() && $action_letter = 'V'; |
| Line 2523 function phpMyEdit_form_control(theForm) |
|
| Line 2387 function phpMyEdit_form_control(theForm) |
|
| $this->add_operation() && $action_letter = 'A'; |
$this->add_operation() && $action_letter = 'A'; |
| $this->change_operation() && $action_letter = 'C'; |
$this->change_operation() && $action_letter = 'C'; |
| $this->copy_operation() && $action_letter = 'P'; |
$this->copy_operation() && $action_letter = 'P'; |
| |
|
| // Restore backups (if exists) |
// Restore backups (if exists) |
| foreach (array_keys($this->fdd) as $column) { |
foreach (array_keys($this->fdd) as $column) { |
| foreach (array_keys($this->fdd[$column]) as $col_option) { |
foreach (array_keys($this->fdd[$column]) as $col_option) { |
| Line 2535 function phpMyEdit_form_control(theForm) |
|
| Line 2398 function phpMyEdit_form_control(theForm) |
|
| unset($this->fdd[$column][$col_option]); |
unset($this->fdd[$column][$col_option]); |
| } |
} |
| } |
} |
| |
|
| foreach (array_keys($this->fdd) as $column) { |
foreach (array_keys($this->fdd) as $column) { |
| foreach (array_keys($this->fdd[$column]) as $col_option) { |
foreach (array_keys($this->fdd[$column]) as $col_option) { |
| if (! strchr($col_option, '|')) |
if (! strchr($col_option, '|')) { |
| continue; |
continue; |
| |
} |
| $col_ar = explode('|', $col_option, 2); |
$col_ar = explode('|', $col_option, 2); |
| if (! stristr($col_ar[1], $action_letter)) |
if (! stristr($col_ar[1], $action_letter)) { |
| continue; |
continue; |
| |
} |
| // Make field backups |
// Make field backups |
| $this->fdd[$column][$col_ar[0] .'~'] = $this->fdd[$column][$col_ar[0]]; |
$this->fdd[$column][$col_ar[0] .'~'] = $this->fdd[$column][$col_ar[0]]; |
| $this->fdd[$column][$col_option.'~'] = $this->fdd[$column][$col_option]; |
$this->fdd[$column][$col_option.'~'] = $this->fdd[$column][$col_option]; |
| Line 2561 function phpMyEdit_form_control(theForm) |
|
| Line 2424 function phpMyEdit_form_control(theForm) |
|
| $this->fds = array(); |
$this->fds = array(); |
| $this->displayed = array(); |
$this->displayed = array(); |
| $this->guidance = false; |
$this->guidance = false; |
| |
|
| foreach ($this->fdd as $akey => $aval) { |
foreach ($this->fdd as $akey => $aval) { |
| if (preg_match('/^\d*$/', $akey)) /* skipping numeric keys */ |
if (preg_match('/^\d*$/', $akey)) { // skipping numeric keys |
| continue; |
continue; |
| |
} |
| $this->fds[$field_num] = $akey; |
$this->fds[$field_num] = $akey; |
| |
|
| /* We must use here displayed() function, because displayed[] array |
/* We must use here displayed() function, because displayed[] array |
| is not created yet. We will simultaneously create that array as well. */ |
is not created yet. We will simultaneously create that array as well. */ |
| if ($this->displayed[$field_num] = $this->displayed($field_num)) { |
if ($this->displayed[$field_num] = $this->displayed($field_num)) { |
| Line 2589 function phpMyEdit_form_control(theForm) |
|
| Line 2450 function phpMyEdit_form_control(theForm) |
|
| var_dump($this->displayed); |
var_dump($this->displayed); |
| echo '</pre><hr>'; |
echo '</pre><hr>'; |
| } |
} |
| |
|
| $this->num_fds = $field_num; |
$this->num_fds = $field_num; |
| $this->num_fields_displayed = $num_fields_displayed; |
$this->num_fields_displayed = $num_fields_displayed; |
| $this->key_num = array_search($this->key, $this->fds); |
$this->key_num = array_search($this->key, $this->fds); |
| |
|
| /* Adds first displayed column into sorting fields by replacing last |
/* Adds first displayed column into sorting fields by replacing last |
| array entry. Also remove duplicite values and change column names to |
array entry. Also remove duplicite values and change column names to |
| their particular field numbers. |
their particular field numbers. |
| Line 2663 function phpMyEdit_form_control(theForm) |
|
| Line 2522 function phpMyEdit_form_control(theForm) |
|
| $this->error('no table defined'); |
$this->error('no table defined'); |
| return false; |
return false; |
| } |
} |
| |
if ($this->dbh = @mysql_pconnect($this->hn, $this->un, $this->pw)) { |
| if ($this->dbh = @mysql_pconnect($this->hn, $this->un, $this->pw)) ; |
} else { |
| else { |
|
| $this->error('could not connect to MySQL'); |
$this->error('could not connect to MySQL'); |
| return false; |
return false; |
| } |
} |
| |
|
| return true; |
return true; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| Line 2679 function phpMyEdit_form_control(theForm) |
|
| Line 2536 function phpMyEdit_form_control(theForm) |
|
| function disconnect() /* {{{ */ |
function disconnect() /* {{{ */ |
| { |
{ |
| @mysql_close($this->dbh); |
@mysql_close($this->dbh); |
| |
unset($this->dbh); |
| } /* }}} */ |
} /* }}} */ |
| |
|
| /* |
/* |
| Line 2702 function phpMyEdit_form_control(theForm) |
|
| Line 2560 function phpMyEdit_form_control(theForm) |
|
| |
|
| // Let's do explicit quoting - it's safer |
// Let's do explicit quoting - it's safer |
| set_magic_quotes_runtime(0); |
set_magic_quotes_runtime(0); |
| |
|
| // Checking if language file inclusion was successful |
// Checking if language file inclusion was successful |
| if (! is_array($this->labels)) { |
if (! is_array($this->labels)) { |
| $this->error('could not locate language files'); |
$this->error('could not locate language files'); |
| return false; |
return false; |
| } |
} |
| |
|
| // Database connection |
// Database connection |
| if ($this->connect() == false) { |
if ($this->connect() == false) { |
| return false; |
return false; |
| Line 2765 function phpMyEdit_form_control(theForm) |
|
| Line 2621 function phpMyEdit_form_control(theForm) |
|
| } |
} |
| |
|
| $this->disconnect(); |
$this->disconnect(); |
| |
|
| if ($this->display['time'] && $this->timer != null) { |
if ($this->display['time'] && $this->timer != null) { |
| echo $this->timer->end() . ' miliseconds'; |
echo $this->timer->end() . ' miliseconds'; |
| } |
} |
| Line 2776 function phpMyEdit_form_control(theForm) |
|
| Line 2631 function phpMyEdit_form_control(theForm) |
|
| */ |
*/ |
| function phpMyEdit($opts) /* {{{ */ |
function phpMyEdit($opts) /* {{{ */ |
| { |
{ |
| /* |
// 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']; |
| Line 2804 function phpMyEdit_form_control(theForm) |
|
| Line 2657 function phpMyEdit_form_control(theForm) |
|
| if ($this->display['time']) { |
if ($this->display['time']) { |
| $this->timer = new phpMyEdit_timer(); |
$this->timer = new phpMyEdit_timer(); |
| } |
} |
| |
// Creating directory variables |
| /* |
|
| * Creating directory variables |
|
| */ |
|
| $this->dir['root'] = dirname(__FILE__) |
$this->dir['root'] = dirname(__FILE__) |
| . (strlen(dirname(__FILE__)) > 0 ? '/' : ''); |
. (strlen(dirname(__FILE__)) > 0 ? '/' : ''); |
| $this->dir['lang'] = $this->dir['root'].'lang/'; |
$this->dir['lang'] = $this->dir['root'].'lang/'; |
| |
// Creating URL variables |
| /* |
|
| * Creting URL variables |
|
| */ |
|
| $this->url['images'] = 'images/'; |
$this->url['images'] = 'images/'; |
| isset($opts['url']['images']) && $this->url['images'] = $opts['url']['images']; |
isset($opts['url']['images']) && $this->url['images'] = $opts['url']['images']; |
| |
|
| |
// Navigation |
| // alternate row background colors |
|
| /* What's this?! |
|
| |
|
| if (isset($opts['bgcolorOdd'])) { |
|
| $this->bgcolorOdd = 'White'; |
|
| } else { |
|
| $this->bgcolorOdd = $opts['bgcolorOdd']; |
|
| } |
|
| if (isset($opts['bgColorEven'])) { |
|
| $this->bgcolorEven = 'Silver'; |
|
| } else { |
|
| $this->bgcolorEven = $opts['bgcolorEven']; |
|
| } |
|
| */ |
|
| |
|
| // navigation |
|
| $this->navigation = @$opts['navigation']; |
$this->navigation = @$opts['navigation']; |
| if (! $this->nav_buttons() && ! $this->nav_text_links() && ! $this->nav_graphic_links()) { |
if (! $this->nav_buttons() && ! $this->nav_text_links() && ! $this->nav_graphic_links()) { |
| $this->navigation .= 'B'; // buttons are default |
$this->navigation .= 'B'; // buttons are default |
| Line 2842 function phpMyEdit_form_control(theForm) |
|
| Line 2673 function phpMyEdit_form_control(theForm) |
|
| if (! $this->nav_up() && ! $this->nav_down()) { |
if (! $this->nav_up() && ! $this->nav_down()) { |
| $this->navigation .= 'D'; // down position is default |
$this->navigation .= 'D'; // down position is default |
| } |
} |
| |
// Language labels (must go after navigation) |
| // language labels (must go after navigation) |
|
| $this->labels = $this->make_language_labels(isset($opts['language']) |
$this->labels = $this->make_language_labels(isset($opts['language']) |
| ? $opts['language'] : $this->get_server_var('HTTP_ACCEPT_LANGUAGE')); |
? $opts['language'] : $this->get_server_var('HTTP_ACCEPT_LANGUAGE')); |
| |
|
| // CGI variables |
// CGI variables |
| $this->cgi['append'] = @$opts['cgi']['append']; |
$this->cgi['append'] = @$opts['cgi']['append']; |
| $this->cgi['overwrite'] = @$opts['cgi']['overwrite']; |
$this->cgi['overwrite'] = @$opts['cgi']['overwrite']; |
| Line 2856 function phpMyEdit_form_control(theForm) |
|
| Line 2685 function phpMyEdit_form_control(theForm) |
|
| $this->cgi['persist'] .= '&'.urlencode($key).'='.urlencode($val); |
$this->cgi['persist'] .= '&'.urlencode($key).'='.urlencode($val); |
| } |
} |
| } |
} |
| |
// Find the URL to post forms |
| /* |
|
| * Find the URL to post forms |
|
| */ |
|
| |
|
| $this->page_name = basename($this->get_server_var('PHP_SELF')); |
$this->page_name = basename($this->get_server_var('PHP_SELF')); |
| |
// Sorting variables |
| /* |
|
| * Sorting variables |
|
| */ |
|
| $this->sfn = $this->get_cgi_var('sfn'); |
$this->sfn = $this->get_cgi_var('sfn'); |
| isset($this->sfn) || $this->sfn = array(); |
isset($this->sfn) || $this->sfn = array(); |
| is_array($this->sfn) || $this->sfn = array($this->sfn); |
is_array($this->sfn) || $this->sfn = array($this->sfn); |
| Line 2873 function phpMyEdit_form_control(theForm) |
|
| Line 2695 function phpMyEdit_form_control(theForm) |
|
| is_array($opts['sort_field']) || $opts['sort_field'] = array($opts['sort_field']); |
is_array($opts['sort_field']) || $opts['sort_field'] = array($opts['sort_field']); |
| $this->sfn = array_merge($this->sfn, $opts['sort_field']); |
$this->sfn = array_merge($this->sfn, $opts['sort_field']); |
| $this->sfn[] = '0'; // this last entry will be replaced in recreate_displayed() |
$this->sfn[] = '0'; // this last entry will be replaced in recreate_displayed() |
| |
// Form variables all around |
| /* |
|
| * Form variables all around |
|
| */ |
|
| |
|
| $this->operation = $this->get_cgi_var('operation'); |
$this->operation = $this->get_cgi_var('operation'); |
| $this->apply = $this->get_cgi_var('apply'); |
$this->apply = $this->get_cgi_var('apply'); |
| $this->fl = intval($this->get_cgi_var('fl')); |
$this->fl = intval($this->get_cgi_var('fl')); |
| $this->fm = intval($this->get_cgi_var('fm')); |
$this->fm = intval($this->get_cgi_var('fm')); |
| $this->qfn = $this->get_cgi_var('qfn'); |
$this->qfn = $this->get_cgi_var('qfn'); |
| $this->sw = $this->get_cgi_var('sw'); |
$this->sw = $this->get_cgi_var('sw'); |
| $this->rec = $this->get_cgi_var('rec', ''); // Fixed #523390 [7/8/2002] [2/2] |
$this->rec = $this->get_cgi_var('rec', ''); |
| $this->prev = $this->get_cgi_var('prev'); |
$this->prev = $this->get_cgi_var('prev'); |
| $this->next = $this->get_cgi_var('next'); |
$this->next = $this->get_cgi_var('next'); |
| $this->saveadd = $this->get_cgi_var('saveadd'); |
$this->saveadd = $this->get_cgi_var('saveadd'); |
| Line 2892 function phpMyEdit_form_control(theForm) |
|
| Line 2710 function phpMyEdit_form_control(theForm) |
|
| $this->savechange = $this->get_cgi_var('savechange'); |
$this->savechange = $this->get_cgi_var('savechange'); |
| $this->morechange = $this->get_cgi_var('morechange'); |
$this->morechange = $this->get_cgi_var('morechange'); |
| $this->savedelete = $this->get_cgi_var('savedelete'); |
$this->savedelete = $this->get_cgi_var('savedelete'); |
| |
// Filter setting |
| /* |
|
| * Filter setting |
|
| */ |
|
| if (isset($this->sw)) { |
if (isset($this->sw)) { |
| $this->sw == $this->labels['Search'] && $this->fl = 1; |
$this->sw == $this->labels['Search'] && $this->fl = 1; |
| $this->sw == $this->labels['Hide'] && $this->fl = 0; |
$this->sw == $this->labels['Hide'] && $this->fl = 0; |
| $this->sw == $this->labels['Clear'] && $this->fl = 0; |
$this->sw == $this->labels['Clear'] && $this->fl = 0; |
| } |
} |
| |
// Specific $fdd modifications depending on performed action |
| /* |
|
| * Specific $fdd modifications depending on performed action |
|
| */ |
|
| |
|
| $this->recreate_fdd(); |
$this->recreate_fdd(); |
| |
// Extract SQL Field Names and number of fields |
| /* |
|
| * Extract SQL Field Names and number of fields |
|
| */ |
|
| |
|
| $this->recreate_displayed(); |
$this->recreate_displayed(); |
| |
// Clear action |
| /* |
|
| * Clear action |
|
| */ |
|
| if ($this->sw == $this->labels['Clear']) { |
if ($this->sw == $this->labels['Clear']) { |
| for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
| $this->cgi['overwrite']["qf$k"] = ''; |
$this->cgi['overwrite']["qf$k"] = ''; |
| Line 2924 function phpMyEdit_form_control(theForm) |
|
| Line 2728 function phpMyEdit_form_control(theForm) |
|
| $this->cgi['overwrite']["qf$k".'_id'] = ''; |
$this->cgi['overwrite']["qf$k".'_id'] = ''; |
| } |
} |
| } |
} |
| |
// Constants |
| /* |
|
| * Constants |
|
| */ |
|
| |
|
| // code to use this is commented out |
|
| $this->sql_aggrs = array( |
$this->sql_aggrs = array( |
| '' => '', |
'' => '', |
| 'sum' => 'Total', |
'sum' => 'Total', |
| Line 2937 function phpMyEdit_form_control(theForm) |
|
| Line 2736 function phpMyEdit_form_control(theForm) |
|
| 'min' => 'Minimum', |
'min' => 'Minimum', |
| 'max' => 'Maximum', |
'max' => 'Maximum', |
| 'count' => 'Count'); |
'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'); |
| |
// MDdate 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', |
| 'time'=>'%H:%i:%s', |
'time'=>'%H:%i:%s', |
| 'year'=>'%Y'); |
'year'=>'%Y'); |
| |
|
| $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, |
| Line 2965 function phpMyEdit_form_control(theForm) |
|
| Line 2760 function phpMyEdit_form_control(theForm) |
|
| 'July'=>7,'August'=>8,'September'=>9, |
'July'=>7,'August'=>8,'September'=>9, |
| 'October'=>10,'November'=>11,'December'=>12); |
'October'=>10,'November'=>11,'December'=>12); |
| $this->months_long_keys = array_keys($this->months_long); |
$this->months_long_keys = array_keys($this->months_long); |
| |
|
| /* If you are phpMyEdit developer, set this to 1. |
/* If you are phpMyEdit developer, set this to 1. |
| You can also hide some new unfinished and/or untested features under |
You can also hide some new unfinished and/or untested features under |
| if ($this->development) { new_feature(); } statement. |
if ($this->development) { new_feature(); } statement. |
| Line 2977 function phpMyEdit_form_control(theForm) |
|
| Line 2771 function phpMyEdit_form_control(theForm) |
|
| * Preparing some others values |
* Preparing some others values |
| * (this was moved from execute() method) |
* (this was moved from execute() method) |
| */ |
*/ |
| |
|
| // Setting key_delim according to key_type |
// Setting key_delim according to key_type |
| if ($this->key_type == 'real') { |
if ($this->key_type == 'real') { |
| /* If 'real' key_type does not work, |
/* If 'real' key_type does not work, |
| Line 2994 function phpMyEdit_form_control(theForm) |
|
| Line 2787 function phpMyEdit_form_control(theForm) |
|
| $this->key_delim = '"'; |
$this->key_delim = '"'; |
| // $this->rec remains unmodified |
// $this->rec remains unmodified |
| } |
} |
| |
// Gathering query options |
| $this->gather_query_opts(); |
$this->gather_query_opts(); |
| |
|
| // Call to Action |
// Call to Action |
| // Moved this from the setup.php generated file to here |
// Moved this from the setup.php generated file to here |
| !isset($opts['execute']) && $opts['execute'] = 1; |
!isset($opts['execute']) && $opts['execute'] = 1; |