| version 1.6, 2007/09/16 20:15:42 |
version 1.7, 2010/12/13 17:32:46 |
|
|
| * http://platon.sk/projects/phpMyEdit/ |
* http://platon.sk/projects/phpMyEdit/ |
| */ |
*/ |
| |
|
| /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.204 2007-09-16 12:57:07 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.213 2010-09-20 01:08:46 nepto Exp $ */ |
| |
|
| /* This is a generic table editing program. The table and fields to be |
/* This is a generic table editing program. The table and fields to be |
| edited are defined in the calling program. |
edited are defined in the calling program. |
|
|
| return mysql_insert_id($this->dbh); |
return mysql_insert_id($this->dbh); |
| } /* }}} */ |
} /* }}} */ |
| |
|
| function sql_limit($start, $more) /* {{{ */ |
function sql_limit($start, $more = null) /* {{{ */ |
| { |
{ |
| return ' LIMIT '.$start.', '.$more.' '; |
if ($more < 0) return; |
| |
if (!is_numeric($start)) return; |
| |
$ret = ' LIMIT '.$start; |
| |
if (is_numeric($more)) { |
| |
$ret .= ','.$more; |
| |
} |
| |
$ret .= ' '; |
| |
return $ret; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| function sql_delimiter() /* {{{ */ |
function sql_delimiter() /* {{{ */ |
|
|
| return $ret; |
return $ret; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
function get_SQL_main_list_query_parts() /* {{{ */ |
| |
{ |
| |
/* |
| |
* Prepare the SQL Query from the data definition file |
| |
*/ |
| |
$qparts['type'] = 'select'; |
| |
$qparts['select'] = $this->get_SQL_column_list(); |
| |
// Even if the key field isn't displayed, we still need its value |
| |
if ($select_recs) { |
| |
if (!in_array ($this->key, $this->fds)) { |
| |
$qparts['select'] .= ','.$this->fqn($this->key); |
| |
} |
| |
} |
| |
$qparts['from'] = $this->get_SQL_join_clause(); |
| |
$qparts['where'] = $this->get_SQL_where_from_query_opts(); |
| |
// build up the ORDER BY clause |
| |
if (isset($this->sfn)) { |
| |
$sort_fields = array(); |
| |
$sort_fields_w = array(); |
| |
foreach ($this->sfn as $field) { |
| |
if ($field[0] == '-') { |
| |
$field = substr($field, 1); |
| |
$desc = true; |
| |
} else { |
| |
$field = $field; |
| |
$desc = false; |
| |
} |
| |
$sort_field = $this->fqn($field); |
| |
$sort_field_w = $this->fdd[$field]['name']; |
| |
$this->col_has_sql($field) && $sort_field_w .= ' (sql)'; |
| |
if ($desc) { |
| |
$sort_field .= ' DESC'; |
| |
$sort_field_w .= ' '.$this->labels['descending']; |
| |
} else { |
| |
$sort_field_w .= ' '.$this->labels['ascending']; |
| |
} |
| |
$sort_fields[] = $sort_field; |
| |
$sort_fields_w[] = $sort_field_w; |
| |
} |
| |
if (count($sort_fields) > 0) { |
| |
$qparts['orderby'] = join(',', $sort_fields); |
| |
} |
| |
} |
| |
$qparts['limit'] = $listall ? '' : $this->sql_limit($this->fm,$this->inc); |
| |
$this->sort_fields_w = $sort_fields_w; // due to display sorting sequence |
| |
return $qparts; |
| |
} /* }}} */ |
| |
|
| |
|
| function get_SQL_main_list_query($qparts) /* {{{ */ |
function get_SQL_main_list_query($qparts) /* {{{ */ |
| { |
{ |
| return $this->get_SQL_query($qparts); |
return $this->get_SQL_query($qparts); |
| Line 1044 function '.$this->js['prefix'].'filter_h |
|
| Line 1100 function '.$this->js['prefix'].'filter_h |
|
| $strip_tags, $escape); |
$strip_tags, $escape); |
| } |
} |
| } elseif (isset ($this->fdd[$k]['textarea'])) { |
} elseif (isset ($this->fdd[$k]['textarea'])) { |
| echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"'; |
echo $this->htmlTextarea($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, $k, $this->fdd[$k]['default']); |
| echo ($this->readonly($k) ? ' disabled' : ''); |
|
| if (intval($this->fdd[$k]['textarea']['rows']) > 0) { |
|
| echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"'; |
|
| } |
|
| if (intval($this->fdd[$k]['textarea']['cols']) > 0) { |
|
| echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"'; |
|
| } |
|
| if (isset($this->fdd[$k]['textarea']['wrap'])) { |
|
| echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"'; |
|
| } else { |
|
| echo ' wrap="virtual"'; |
|
| } |
|
| echo '>'; |
|
| if($escape) echo htmlspecialchars($this->fdd[$k]['default']); |
|
| else echo $this->fdd[$k]['default']; |
|
| echo '</textarea>',"\n"; |
|
| } elseif ($this->col_has_php($k)) { |
} elseif ($this->col_has_php($k)) { |
| echo include($this->fdd[$k]['php']); |
echo include($this->fdd[$k]['php']); |
| } else { |
} else { |
| Line 1192 function '.$this->js['prefix'].'filter_h |
|
| Line 1232 function '.$this->js['prefix'].'filter_h |
|
| $strip_tags, $escape); |
$strip_tags, $escape); |
| } |
} |
| } elseif (isset($this->fdd[$k]['textarea'])) { |
} elseif (isset($this->fdd[$k]['textarea'])) { |
| echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"'; |
echo $this->htmlTextarea($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, $k, $row["qf$k"]); |
| echo ($this->readonly($k) ? ' disabled' : ''); |
|
| if (intval($this->fdd[$k]['textarea']['rows']) > 0) { |
|
| echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"'; |
|
| } |
|
| if (intval($this->fdd[$k]['textarea']['cols']) > 0) { |
|
| echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"'; |
|
| } |
|
| if (isset($this->fdd[$k]['textarea']['wrap'])) { |
|
| echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"'; |
|
| } else { |
|
| echo ' wrap="virtual"'; |
|
| } |
|
| echo '>'; |
|
| if($escape) echo htmlspecialchars($row["qf$k"]); |
|
| else echo $row["qf$k"]; |
|
| echo '</textarea>',"\n"; |
|
| } elseif ($this->col_has_php($k)) { |
} elseif ($this->col_has_php($k)) { |
| echo include($this->fdd[$k]['php']); |
echo include($this->fdd[$k]['php']); |
| } else { |
} else { |
| Line 1536 function '.$this->js['prefix'].'filter_h |
|
| Line 1560 function '.$this->js['prefix'].'filter_h |
|
| if (! is_array($selected)) { |
if (! is_array($selected)) { |
| $selected = $selected === null ? array() : array((string)$selected); |
$selected = $selected === null ? array() : array((string)$selected); |
| } else { |
} else { |
| foreach($selected as $val) $selecte2[]=(string)$val; |
foreach($selected as $val) $selected2[]=(string)$val; |
| $selected = $selected2; |
$selected = $selected2; |
| } |
} |
| $found = false; |
$found = false; |
| Line 1600 function '.$this->js['prefix'].'filter_h |
|
| Line 1624 function '.$this->js['prefix'].'filter_h |
|
| return $ret; |
return $ret; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
function htmlTextarea($name, $css, $k, $value = null, $js = NULL) |
| |
{ |
| |
$ret = '<textarea class="'.$css.'" name="'.$name.'"'; |
| |
$ret .= ($this->readonly($k) ? ' disabled' : ''); |
| |
if (intval($this->fdd[$k]['textarea']['rows']) > 0) { |
| |
$ret .= ' rows="'.$this->fdd[$k]['textarea']['rows'].'"'; |
| |
} |
| |
if (intval($this->fdd[$k]['textarea']['cols']) > 0) { |
| |
$ret .= ' cols="'.$this->fdd[$k]['textarea']['cols'].'"'; |
| |
} |
| |
if (isset($this->fdd[$k]['textarea']['wrap'])) { |
| |
$ret .= ' wrap="'.$this->fdd[$k]['textarea']['wrap'].'"'; |
| |
} else { |
| |
$ret .= ' wrap="virtual"'; |
| |
} |
| |
$ret .= '>'; |
| |
if($escape) $ret .= htmlspecialchars($value); |
| |
else $ret .= $value; |
| |
$ret .= '</textarea>'."\n"; |
| |
return $ret; |
| |
} /* }}} */ |
| |
|
| /** |
/** |
| * Returns original variables HTML code for use in forms or links. |
* Returns original variables HTML code for use in forms or links. |
| * |
* |
| Line 1982 function '.$this->js['prefix'].'filter_h |
|
| Line 2028 function '.$this->js['prefix'].'filter_h |
|
| $ret .= ' name="'.$this->cgi['prefix']['sys'].'navpn'.$position.'" value="'.($current_page+1).'"'; |
$ret .= ' name="'.$this->cgi['prefix']['sys'].'navpn'.$position.'" value="'.($current_page+1).'"'; |
| $ret .= ' size="'.(strlen($total_pages)+1).'" maxlength="'.(strlen($total_pages)+1).'"'; |
$ret .= ' size="'.(strlen($total_pages)+1).'" maxlength="'.(strlen($total_pages)+1).'"'; |
| // TODO some js here.... on enter submit, on click erase ?... |
// TODO some js here.... on enter submit, on click erase ?... |
| $ret .=' oneypress="return PE_filter_handler(this.form, event);" />'; |
$ret .=' onkeypress="return '.$this->js['prefix'].'filter_handler(this.form, event);" />'; |
| return $ret; |
return $ret; |
| } |
} |
| if ($name == 'goto_combo') { |
if ($name == 'goto_combo') { |
| Line 2028 function '.$this->js['prefix'].'filter_h |
|
| Line 2074 function '.$this->js['prefix'].'filter_h |
|
| $this->total_recs = $row[0]; |
$this->total_recs = $row[0]; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
function filter_heading() /* {{{ */ |
| |
{ |
| |
/* FILTER {{{ |
| |
* |
| |
* 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. |
| |
*/ |
| |
|
| |
// Filter row retrieval |
| |
/*$fields = false; |
| |
$filter_row = array();//$row; |
| |
if (! is_array($filter_row)) { echo 'tttt'; |
| |
unset($qparts['where']); |
| |
$query = $this->get_SQL_query($qparts); |
| |
$res = $this->myquery($query, __LINE__); |
| |
if ($res == false) { |
| |
$this->error('invalid SQL query', $query); |
| |
return false; |
| |
} |
| |
$filter_row = $this->sql_fetch($res); |
| |
}*/ |
| |
/* TODO - $fields is completely useless (michal) |
| |
Variable $fields is used to get index of particular field in |
| |
result. That index can be passed in example to $this->sql_field_len() |
| |
function. Use field names as indexes to $fields array. */ |
| |
if (is_array($filter_row)) { |
| |
$fields = array_flip(array_keys($filter_row)); |
| |
} |
| |
//if ($fields != false) { |
| |
$css_class_name = $this->getCSSclass('filter'); |
| |
echo '<tr class="',$css_class_name,'">',"\n"; |
| |
echo '<td class="',$css_class_name,'" colspan="',$this->sys_cols,'">'; |
| |
echo $this->htmlSubmit('filter', 'Query', $this->getCSSclass('query'), false); |
| |
echo '</td>', "\n"; |
| |
for ($k = 0; $k < $this->num_fds; $k++) { |
| |
if (! $this->displayed[$k]) { |
| |
continue; |
| |
} |
| |
$css_postfix = @$this->fdd[$k]['css']['postfix']; |
| |
$css_class_name = $this->getCSSclass('filter', null, null, $css_postfix); |
| |
$this->field_name = $this->fds[$k]; |
| |
$fd = $this->field_name; |
| |
$this->field = $this->fdd[$fd]; |
| |
$l = 'qf'.$k; |
| |
$lc = 'qf'.$k.'_comp'; |
| |
$li = 'qf'.$k.'_id'; |
| |
if ($this->clear_operation()) { |
| |
$m = null; |
| |
$mc = null; |
| |
$mi = null; |
| |
} else { |
| |
$m = $this->get_sys_cgi_var($l); |
| |
$mc = $this->get_sys_cgi_var($lc); |
| |
$mi = $this->get_sys_cgi_var($li); |
| |
} |
| |
echo '<td class="',$css_class_name,'">'; |
| |
if ($this->password($k)) { |
| |
echo ' '; |
| |
} else if ($this->fdd[$fd]['select'] == 'D' || $this->fdd[$fd]['select'] == 'M') { |
| |
// Multiple fields processing |
| |
// Default size is 2 and array required for values. |
| |
$from_table = ! $this->col_has_values($k) || isset($this->fdd[$k]['values']['table']); |
| |
$vals = $this->set_values($k, array('*' => '*'), null, $from_table); |
| |
$selected = $mi; |
| |
$multiple = $this->col_has_multiple_select($k); |
| |
$multiple |= $this->fdd[$fd]['select'] == 'M'; |
| |
$readonly = false; |
| |
$strip_tags = true; |
| |
$escape = true; |
| |
echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_id', $css_class_name, |
| |
$vals, $selected, $multiple, $readonly, $strip_tags, $escape); |
| |
} elseif ($this->fdd[$fd]['select'] == 'N' || $this->fdd[$fd]['select'] == 'T') { |
| |
$len_props = ''; |
| |
$maxlen = intval($this->fdd[$k]['maxlen']); |
| |
//$maxlen > 0 || $maxlen = intval($this->sql_field_len($res, $fields["qf$k"])); |
| |
$maxlen > 0 || $maxlen = 500; |
| |
$size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] |
| |
: ($maxlen < 30 ? min($maxlen, 8) : 12); |
| |
$len_props .= ' size="'.$size.'"'; |
| |
$len_props .= ' maxlength="'.$maxlen.'"'; |
| |
if ($this->fdd[$fd]['select'] == 'N') { |
| |
$mc = in_array($mc, $this->comp_ops) ? $mc : '='; |
| |
echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_comp', |
| |
$css_class_name, $this->comp_ops, $mc); |
| |
} |
| |
echo '<input class="',$css_class_name,'" value="',htmlspecialchars(@$m); |
| |
echo '" type="text" name="'.$this->cgi['prefix']['sys'].'qf'.$k.'"',$len_props; |
| |
echo ' onkeypress="return '.$this->js['prefix'].'filter_handler(this.form, event);" />'; |
| |
} else { |
| |
echo ' '; |
| |
} |
| |
echo '</td>',"\n"; |
| |
} |
| |
echo '</tr>',"\n"; |
| |
//} |
| |
} /* }}} */ |
| |
function display_sorting_sequence() /* {{{ */ |
| |
{ |
| |
/* |
| |
* Display sorting sequence |
| |
*/ |
| |
$css_class_name = $this->getCSSclass('sortinfo'); |
| |
echo '<tr class="',$css_class_name,'">',"\n"; |
| |
echo '<td class="',$css_class_name,'" colspan="',$this->sys_cols,'">'; |
| |
echo '<a class="',$css_class_name,'" href="'; |
| |
echo htmlspecialchars($this->page_name |
| |
.'?'.$this->cgi['prefix']['sys'].'fl'.'='.$this->fl |
| |
.'&'.$this->cgi['prefix']['sys'].'fm'.'='.$this->fm |
| |
.'&'.$this->cgi['prefix']['sys'].'qfn'.'='.rawurlencode($this->qfn) |
| |
.$this->qfn.$this->cgi['persist']); |
| |
echo '">',$this->labels['Clear'],'</a></td>',"\n"; |
| |
echo '<td class="',$css_class_name,'" colspan="',$this->num_fields_displayed,'">'; |
| |
echo $this->labels['Sorted By'],': ',join(', ', $this->sort_fields_w),'</td></tr>',"\n"; |
| |
} /* }}} */ |
| |
|
| |
function display_current_query() /* {{{ */ |
| |
{ |
| |
/* |
| |
* Display the current query |
| |
*/ |
| |
$text_query = $this->get_SQL_where_from_query_opts(null, true); |
| |
if ($text_query != '') { |
| |
$css_class_name = $this->getCSSclass('queryinfo'); |
| |
echo '<tr class="',$css_class_name,'">',"\n"; |
| |
echo '<td class="',$css_class_name,'" colspan="',$this->sys_cols,'">'; |
| |
echo '<a class="',$css_class_name,'" href="'; |
| |
echo htmlspecialchars($this->get_server_var('PHP_SELF') |
| |
.'?'.$this->cgi['prefix']['sys'].'fl'.'='.$this->fl |
| |
.'&'.$this->cgi['prefix']['sys'].'fm'.'='.$this->fm |
| |
.'&'.$this->cgi['prefix']['sys'].'qfn'.'='.rawurlencode($this->qfn) |
| |
.'&'.$this->get_sfn_cgi_vars().$this->cgi['persist']); |
| |
echo '">',$this->labels['Clear'],'</a></td>',"\n"; |
| |
echo '<td class="',$css_class_name,'" colspan="',$this->num_fields_displayed,'">'; |
| |
echo $this->labels['Current Query'],': ',htmlspecialchars($text_query),'</td></tr>',"\n"; |
| |
} |
| |
} /* }}} */ |
| |
|
| /* |
/* |
| * Table Page Listing |
* Table Page Listing |
| */ |
*/ |
| Line 2091 function '.$this->js['prefix'].'filter_h |
|
| Line 2274 function '.$this->js['prefix'].'filter_h |
|
| /* |
/* |
| * System (navigation, selection) columns counting |
* System (navigation, selection) columns counting |
| */ |
*/ |
| $sys_cols = 0; |
$this->sys_cols = 0; |
| $sys_cols += intval($this->filter_enabled() || $select_recs); |
$this->sys_cols += intval($this->filter_enabled() || $select_recs); |
| if ($sys_cols > 0) { |
if ($this->sys_cols > 0) { |
| $sys_cols += intval($this->nav_buttons() |
$this->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 ($this->sys_cols) { |
| echo '<th class="',$this->getCSSclass('header'),'" colspan="',$sys_cols,'">'; |
echo '<th class="',$this->getCSSclass('header'),'" colspan="',$this->sys_cols,'">'; |
| if ($this->filter_enabled()) { |
if ($this->filter_enabled()) { |
| if ($this->filter_operation()) { |
if ($this->filter_operation()) { |
| echo $this->htmlSubmit('sw', 'Hide', $this->getCSSclass('hide'), false); |
echo $this->htmlSubmit('sw', 'Hide', $this->getCSSclass('hide'), false); |
| Line 2139 function '.$this->js['prefix'].'filter_h |
|
| Line 2322 function '.$this->js['prefix'].'filter_h |
|
| } |
} |
| } |
} |
| echo '</tr>',"\n"; |
echo '</tr>',"\n"; |
| |
|
| /* |
|
| * Prepare the SQL Query from the data definition file |
|
| */ |
|
| $qparts['type'] = 'select'; |
|
| $qparts['select'] = $this->get_SQL_column_list(); |
|
| // Even if the key field isn't displayed, we still need its value |
|
| if ($select_recs) { |
|
| if (!in_array ($this->key, $this->fds)) { |
|
| $qparts['select'] .= ','.$this->fqn($this->key); |
|
| } |
|
| } |
|
| $qparts['from'] = $this->get_SQL_join_clause(); |
|
| $qparts['where'] = $this->get_SQL_where_from_query_opts(); |
|
| // build up the ORDER BY clause |
|
| if (isset($this->sfn)) { |
|
| $sort_fields = array(); |
|
| $sort_fields_w = array(); |
|
| foreach ($this->sfn as $field) { |
|
| if ($field[0] == '-') { |
|
| $field = substr($field, 1); |
|
| $desc = true; |
|
| } else { |
|
| $field = $field; |
|
| $desc = false; |
|
| } |
|
| $sort_field = $this->fqn($field); |
|
| $sort_field_w = $this->fdd[$field]['name']; |
|
| $this->col_has_sql($field) && $sort_field_w .= ' (sql)'; |
|
| if ($desc) { |
|
| $sort_field .= ' DESC'; |
|
| $sort_field_w .= ' '.$this->labels['descending']; |
|
| } else { |
|
| $sort_field_w .= ' '.$this->labels['ascending']; |
|
| } |
|
| $sort_fields[] = $sort_field; |
|
| $sort_fields_w[] = $sort_field_w; |
|
| } |
|
| if (count($sort_fields) > 0) { |
|
| $qparts['orderby'] = join(',', $sort_fields); |
|
| } |
|
| } |
|
| $qparts['limit'] = $listall ? '' : $this->sql_limit($this->fm,$this->inc); |
|
| |
|
| /* |
/* |
| * Main list_table() query |
* Main list_table() query |
| * |
* |
| Line 2191 function '.$this->js['prefix'].'filter_h |
|
| Line 2330 function '.$this->js['prefix'].'filter_h |
|
| * $this->sql_field_len() function. We will also fetch the first row to get |
* $this->sql_field_len() function. We will also fetch the first row to get |
| * the field names. |
* the field names. |
| */ |
*/ |
| |
$qparts = $this->get_SQL_main_list_query_parts(); |
| $query = $this->get_SQL_main_list_query($qparts); |
$query = $this->get_SQL_main_list_query($qparts); |
| $res = $this->myquery($query, __LINE__); |
$res = $this->myquery($query, __LINE__); |
| if ($res == false) { |
if ($res == false) { |
| Line 2199 function '.$this->js['prefix'].'filter_h |
|
| Line 2339 function '.$this->js['prefix'].'filter_h |
|
| } |
} |
| $row = $this->sql_fetch($res); |
$row = $this->sql_fetch($res); |
| |
|
| /* FILTER {{{ |
// filter |
| * |
if ($this->filter_operation()) $this->filter_heading(); |
| * Draw the filter and fill it with any data typed in last pass and stored |
// Display sorting sequence |
| * in the array parameter keyword 'filter'. Prepare the SQL WHERE clause. |
if ($qparts['orderby'] && $this->display['sort']) $this->display_sorting_sequence(); |
| */ |
// Display the current query |
| if ($this->filter_operation()) { |
if($this->display['query']) $this->display_current_query(); |
| // Filter row retrieval |
|
| $fields = false; |
|
| $filter_row = $row; |
|
| if (! is_array($filter_row)) { |
|
| unset($qparts['where']); |
|
| $query = $this->get_SQL_query($qparts); |
|
| $res = $this->myquery($query, __LINE__); |
|
| if ($res == false) { |
|
| $this->error('invalid SQL query', $query); |
|
| return false; |
|
| } |
|
| $filter_row = $this->sql_fetch($res); |
|
| } |
|
| /* Variable $fields is used to get index of particular field in |
|
| result. That index can be passed in example to $this->sql_field_len() |
|
| function. Use field names as indexes to $fields array. */ |
|
| if (is_array($filter_row)) { |
|
| $fields = array_flip(array_keys($filter_row)); |
|
| } |
|
| if ($fields != false) { |
|
| $css_class_name = $this->getCSSclass('filter'); |
|
| echo '<tr class="',$css_class_name,'">',"\n"; |
|
| echo '<td class="',$css_class_name,'" colspan="',$sys_cols,'">'; |
|
| echo $this->htmlSubmit('filter', 'Query', $this->getCSSclass('query'), false); |
|
| echo '</td>', "\n"; |
|
| for ($k = 0; $k < $this->num_fds; $k++) { |
|
| if (! $this->displayed[$k]) { |
|
| continue; |
|
| } |
|
| $css_postfix = @$this->fdd[$k]['css']['postfix']; |
|
| $css_class_name = $this->getCSSclass('filter', null, null, $css_postfix); |
|
| $this->field_name = $this->fds[$k]; |
|
| $fd = $this->field_name; |
|
| $this->field = $this->fdd[$fd]; |
|
| $l = 'qf'.$k; |
|
| $lc = 'qf'.$k.'_comp'; |
|
| $li = 'qf'.$k.'_id'; |
|
| if ($this->clear_operation()) { |
|
| $m = null; |
|
| $mc = null; |
|
| $mi = null; |
|
| } else { |
|
| $m = $this->get_sys_cgi_var($l); |
|
| $mc = $this->get_sys_cgi_var($lc); |
|
| $mi = $this->get_sys_cgi_var($li); |
|
| } |
|
| echo '<td class="',$css_class_name,'">'; |
|
| if ($this->password($k)) { |
|
| echo ' '; |
|
| } else if ($this->fdd[$fd]['select'] == 'D' || $this->fdd[$fd]['select'] == 'M') { |
|
| // Multiple fields processing |
|
| // Default size is 2 and array required for values. |
|
| $from_table = ! $this->col_has_values($k) || isset($this->fdd[$k]['values']['table']); |
|
| $vals = $this->set_values($k, array('*' => '*'), null, $from_table); |
|
| $selected = $mi; |
|
| $multiple = $this->col_has_multiple_select($k); |
|
| $multiple |= $this->fdd[$fd]['select'] == 'M'; |
|
| $readonly = false; |
|
| $strip_tags = true; |
|
| $escape = true; |
|
| echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_id', $css_class_name, |
|
| $vals, $selected, $multiple, $readonly, $strip_tags, $escape); |
|
| } elseif ($this->fdd[$fd]['select'] == 'N' || $this->fdd[$fd]['select'] == 'T') { |
|
| $len_props = ''; |
|
| $maxlen = intval($this->fdd[$k]['maxlen']); |
|
| $maxlen > 0 || $maxlen = intval($this->sql_field_len($res, $fields["qf$k"])); |
|
| $size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] |
|
| : ($maxlen < 30 ? min($maxlen, 8) : 12); |
|
| $len_props .= ' size="'.$size.'"'; |
|
| $len_props .= ' maxlength="'.$maxlen.'"'; |
|
| if ($this->fdd[$fd]['select'] == 'N') { |
|
| $mc = in_array($mc, $this->comp_ops) ? $mc : '='; |
|
| echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_comp', |
|
| $css_class_name, $this->comp_ops, $mc); |
|
| } |
|
| echo '<input class="',$css_class_name,'" value="',htmlspecialchars(@$m); |
|
| echo '" type="text" name="'.$this->cgi['prefix']['sys'].'qf'.$k.'"',$len_props; |
|
| echo ' onkeypress="return '.$this->js['prefix'].'filter_handler(this.form, event);" />'; |
|
| } else { |
|
| echo ' '; |
|
| } |
|
| echo '</td>',"\n"; |
|
| } |
|
| echo '</tr>',"\n"; |
|
| } |
|
| } // }}} |
|
| |
|
| /* |
|
| * Display sorting sequence |
|
| */ |
|
| if ($qparts['orderby'] && $this->display['sort']) { |
|
| $css_class_name = $this->getCSSclass('sortinfo'); |
|
| echo '<tr class="',$css_class_name,'">',"\n"; |
|
| echo '<td class="',$css_class_name,'" colspan="',$sys_cols,'">'; |
|
| echo '<a class="',$css_class_name,'" href="'; |
|
| echo htmlspecialchars($this->page_name |
|
| .'?'.$this->cgi['prefix']['sys'].'fl'.'='.$this->fl |
|
| .'&'.$this->cgi['prefix']['sys'].'fm'.'='.$this->fm |
|
| .'&'.$this->cgi['prefix']['sys'].'qfn'.'='.rawurlencode($this->qfn) |
|
| .$this->qfn.$this->cgi['persist']); |
|
| echo '">',$this->labels['Clear'],'</a></td>',"\n"; |
|
| echo '<td class="',$css_class_name,'" colspan="',$this->num_fields_displayed,'">'; |
|
| echo $this->labels['Sorted By'],': ',join(', ', $sort_fields_w),'</td></tr>',"\n"; |
|
| } |
|
| |
|
| /* |
|
| * Display the current query |
|
| */ |
|
| $text_query = $this->get_SQL_where_from_query_opts(null, true); |
|
| if ($text_query != '' && $this->display['query']) { |
|
| $css_class_name = $this->getCSSclass('queryinfo'); |
|
| echo '<tr class="',$css_class_name,'">',"\n"; |
|
| echo '<td class="',$css_class_name,'" colspan="',$sys_cols,'">'; |
|
| echo '<a class="',$css_class_name,'" href="'; |
|
| echo htmlspecialchars($this->get_server_var('PHP_SELF') |
|
| .'?'.$this->cgi['prefix']['sys'].'fl'.'='.$this->fl |
|
| .'&'.$this->cgi['prefix']['sys'].'fm'.'='.$this->fm |
|
| .'&'.$this->cgi['prefix']['sys'].'qfn'.'='.rawurlencode($this->qfn) |
|
| .'&'.$this->get_sfn_cgi_vars().$this->cgi['persist']); |
|
| echo '">',$this->labels['Clear'],'</a></td>',"\n"; |
|
| echo '<td class="',$css_class_name,'" colspan="',$this->num_fields_displayed,'">'; |
|
| echo $this->labels['Current Query'],': ',htmlspecialchars($text_query),'</td></tr>',"\n"; |
|
| } |
|
| |
|
| if ($this->nav_text_links() || $this->nav_graphic_links()) { |
if ($this->nav_text_links() || $this->nav_graphic_links()) { |
| $qstrparts = array(); |
$qstrparts = array(); |
| strlen($this->fl) > 0 && $qstrparts[] = $this->cgi['prefix']['sys'].'fl'.'='.$this->fl; |
strlen($this->fl) > 0 && $qstrparts[] = $this->cgi['prefix']['sys'].'fl'.'='.$this->fl; |
| Line 2357 function '.$this->js['prefix'].'filter_h |
|
| Line 2374 function '.$this->js['prefix'].'filter_h |
|
| || ($fetched && $row != false)) { |
|| ($fetched && $row != false)) { |
| $fetched = false; |
$fetched = false; |
| echo '<tr class="',$this->getCSSclass('row', null, 'next'),'">',"\n"; |
echo '<tr class="',$this->getCSSclass('row', null, 'next'),'">',"\n"; |
| if ($sys_cols) { /* {{{ */ |
if ($this->sys_cols) { /* {{{ */ |
| $key_rec = $row['qf'.$this->key_num]; |
$key_rec = $row['qf'.$this->key_num]; |
| $queryAppend = htmlspecialchars('&'.$this->cgi['prefix']['sys'].'rec'.'='.$key_rec); |
$queryAppend = htmlspecialchars('&'.$this->cgi['prefix']['sys'].'rec'.'='.$key_rec); |
| $viewQuery = $qpviewStr . $queryAppend; |
$viewQuery = $qpviewStr . $queryAppend; |
| Line 2370 function '.$this->js['prefix'].'filter_h |
|
| Line 2387 function '.$this->js['prefix'].'filter_h |
|
| $deleteTitle = htmlspecialchars($this->labels['Delete']); |
$deleteTitle = htmlspecialchars($this->labels['Delete']); |
| $css_class_name = $this->getCSSclass('navigation', null, true); |
$css_class_name = $this->getCSSclass('navigation', null, true); |
| if ($select_recs) { |
if ($select_recs) { |
| if (! $this->nav_buttons() || $sys_cols > 1) { |
if (! $this->nav_buttons() || $this->sys_cols > 1) { |
| echo '<td class="',$css_class_name,'">'; |
echo '<td class="',$css_class_name,'">'; |
| } |
} |
| if ($this->nav_graphic_links()) { |
if ($this->nav_graphic_links()) { |
| Line 2432 function '.$this->js['prefix'].'filter_h |
|
| Line 2449 function '.$this->js['prefix'].'filter_h |
|
| echo '<a href="',$deleteQuery,'" title="',$deleteTitle,'" class="',$css_class_name,'">D</a>'; |
echo '<a href="',$deleteQuery,'" title="',$deleteTitle,'" class="',$css_class_name,'">D</a>'; |
| } |
} |
| } |
} |
| if (! $this->nav_buttons() || $sys_cols > 1) { |
if (! $this->nav_buttons() || $this->sys_cols > 1) { |
| echo '</td>',"\n"; |
echo '</td>',"\n"; |
| } |
} |
| if ($this->nav_buttons()) { |
if ($this->nav_buttons()) { |
| Line 2446 function '.$this->js['prefix'].'filter_h |
|
| Line 2463 function '.$this->js['prefix'].'filter_h |
|
| echo ' /></td>',"\n"; |
echo ' /></td>',"\n"; |
| } |
} |
| } elseif ($this->filter_enabled()) { |
} elseif ($this->filter_enabled()) { |
| echo '<td class="',$css_class_name,'" colspan="',$sys_cols,'"> </td>',"\n"; |
echo '<td class="',$css_class_name,'" colspan="',$this->sys_cols,'"> </td>',"\n"; |
| } |
} |
| } /* }}} */ |
} /* }}} */ |
| for ($k = 0; $k < $this->num_fds; $k++) { /* {{{ */ |
for ($k = 0; $k < $this->num_fds; $k++) { /* {{{ */ |
| Line 3097 function '.$this->js['prefix'].'filter_h |
|
| Line 3114 function '.$this->js['prefix'].'filter_h |
|
| */ |
*/ |
| |
|
| // Let's do explicit quoting - it's safer |
// Let's do explicit quoting - it's safer |
| set_magic_quotes_runtime(0); |
// (but 5.3 does not have this at all) |
| |
if (version_compare(PHP_VERSION, '5.3.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', 'searched path: '.$this->dir['lang']); |
$this->error('could not locate language files', 'searched path: '.$this->dir['lang']); |