Made suggested change to tbl_select.php and tbl_zoom_select.php
This commit is contained in:
parent
c7cef3b0ba
commit
70167fed52
@ -22,13 +22,9 @@ $(document).ready(function() {
|
||||
cache: 'false'
|
||||
});
|
||||
|
||||
/*if($('#id_flag').val()==2)
|
||||
{
|
||||
$('#tbl_search_form').hide();
|
||||
$('#zoom_search_form').show();
|
||||
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Form submit on field change
|
||||
*/
|
||||
$('#tableid_0').change(function() {
|
||||
$('#zoom_search_form').submit();
|
||||
})
|
||||
|
||||
@ -11,8 +11,6 @@
|
||||
|
||||
require_once 'url_generating.lib.php';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* PMA_tbl_setTitle() sets the title for foreign keys display link
|
||||
*
|
||||
@ -23,14 +21,14 @@ require_once 'url_generating.lib.php';
|
||||
*/
|
||||
|
||||
function PMA_tbl_setTitle($propertiesIconic,$pmaThemeImage){
|
||||
if ($propertiesIconic == true) {
|
||||
$str = '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
|
||||
.'b_browse.png" alt="' . __('Browse foreign values') . '" title="'
|
||||
. __('Browse foreign values') . '" />';
|
||||
if ($propertiesIconic == true) {
|
||||
$str = '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
|
||||
.'b_browse.png" alt="' . __('Browse foreign values') . '" title="'
|
||||
. __('Browse foreign values') . '" />';
|
||||
|
||||
if ($propertiesIconic === 'both') {
|
||||
$str .= __('Browse foreign values');
|
||||
return $str;
|
||||
if ($propertiesIconic === 'both') {
|
||||
$str .= __('Browse foreign values');
|
||||
return $str;
|
||||
}
|
||||
} else {
|
||||
return __('Browse foreign values');
|
||||
@ -108,7 +106,7 @@ function PMA_tbl_getFields($table,$db) {
|
||||
function PMA_tbl_setTableHeader(){
|
||||
|
||||
return '<thead>
|
||||
<tr><th>' . __('Column') . '</th>
|
||||
<tr><th>' . __('Column') . '</th>
|
||||
<th>' . __('Type') . '</th>
|
||||
<th>' . __('Collation') . '</th>
|
||||
<th>' . __('Operator') . '</th>
|
||||
@ -127,20 +125,20 @@ return '<thead>
|
||||
|
||||
function PMA_tbl_getSubTabs(){
|
||||
|
||||
$subtabs = array();
|
||||
$subtabs = array();
|
||||
|
||||
$subtabs['search']['icon'] = 'b_search.png';
|
||||
$subtabs['search']['text'] = __('Table Search');
|
||||
$subtabs['search']['link'] = 'tbl_select.php';
|
||||
$subtabs['search']['id'] = 'tbl_search_id';
|
||||
$subtabs['search']['args']['pos'] = 0;
|
||||
$subtabs['search']['icon'] = 'b_search.png';
|
||||
$subtabs['search']['text'] = __('Table Search');
|
||||
$subtabs['search']['link'] = 'tbl_select.php';
|
||||
$subtabs['search']['id'] = 'tbl_search_id';
|
||||
$subtabs['search']['args']['pos'] = 0;
|
||||
|
||||
$subtabs['zoom']['icon'] = 'b_props.png';
|
||||
$subtabs['zoom']['link'] = 'tbl_zoom_select.php';
|
||||
$subtabs['zoom']['text'] = __('Zoom Search');
|
||||
$subtabs['zoom']['id'] = 'zoom_search_id';
|
||||
$subtabs['zoom']['icon'] = 'b_props.png';
|
||||
$subtabs['zoom']['link'] = 'tbl_zoom_select.php';
|
||||
$subtabs['zoom']['text'] = __('Zoom Search');
|
||||
$subtabs['zoom']['id'] = 'zoom_search_id';
|
||||
|
||||
return $subtabs;
|
||||
return $subtabs;
|
||||
|
||||
}
|
||||
|
||||
@ -173,47 +171,46 @@ function PMA_tbl_getSubTabs(){
|
||||
|
||||
function PMA_getForeignFields_Values($foreigners, $foreignData, $field, $tbl_fields_type, $i, $db, $table,$titles,$foreignMaxLimit, $fields){
|
||||
|
||||
$str = '';
|
||||
$str = '';
|
||||
|
||||
if ($foreigners && isset($foreigners[$field]) && is_array($foreignData['disp_row'])) {
|
||||
if ($foreigners && isset($foreigners[$field]) && is_array($foreignData['disp_row'])) {
|
||||
|
||||
// f o r e i g n k e y s
|
||||
$str .= ' <select name="fields[' . $i . ']">' . "\n";
|
||||
// go back to first row
|
||||
// f o r e i g n k e y s
|
||||
$str .= ' <select name="fields[' . $i . ']">' . "\n";
|
||||
// go back to first row
|
||||
// here, the 4th parameter is empty because there is no current
|
||||
// value of data for the dropdown (the search page initial values
|
||||
// are displayed empty)
|
||||
$str .= PMA_foreignDropdown($foreignData['disp_row'],
|
||||
$foreignData['foreign_field'],
|
||||
$foreignData['foreign_display'],
|
||||
'', $foreignMaxLimit);
|
||||
$str .= ' </select>' . "\n";
|
||||
}
|
||||
elseif ($foreignData['foreign_link'] == true) {
|
||||
|
||||
// here, the 4th parameter is empty because there is no current
|
||||
// value of data for the dropdown (the search page initial values
|
||||
// are displayed empty)
|
||||
$str .= PMA_foreignDropdown($foreignData['disp_row'],
|
||||
$foreignData['foreign_field'],
|
||||
$foreignData['foreign_display'],
|
||||
'', $foreignMaxLimit);
|
||||
$str .= ' </select>' . "\n";
|
||||
} elseif ($foreignData['foreign_link'] == true) {
|
||||
|
||||
$str .= '<input type="text" name="fields[' . $i . '] "';
|
||||
'id="field_' . md5($field) . '[' . $i .']"
|
||||
class="textfield" />' ; ?>
|
||||
$str .= '<input type="text" name="fields[' . $i . '] "';
|
||||
'id="field_' . md5($field) . '[' . $i .']"
|
||||
class="textfield" />' ; ?>
|
||||
|
||||
<?php $str .= '<script type="text/javascript">';
|
||||
// <![CDATA[
|
||||
$str .= <<<EOT
|
||||
<?php $str .= '<script type="text/javascript">';
|
||||
// <![CDATA[
|
||||
$str .= <<<EOT
|
||||
document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes\'); return false" href="browse_foreigners.php?
|
||||
EOT;
|
||||
$str .= '' . PMA_generate_common_url($db, $table) . '&field=' . urlencode($field) . '&fieldkey=' . $i . '">' . str_replace("'", "\'", $titles['Browse']) . '</a>\');';
|
||||
// ]]
|
||||
$str .= '</script>';
|
||||
?>
|
||||
<?php
|
||||
} elseif (strncasecmp($tbl_fields_type[$i], 'enum', 4) == 0) {
|
||||
// e n u m s
|
||||
$enum_value=explode(', ', str_replace("'", '', substr($tbl_fields_type[$i], 5, -1)));
|
||||
$cnt_enum_value = count($enum_value);
|
||||
$str .= ' <select name="fields[' . ($i) . '][]"'
|
||||
.' multiple="multiple" size="' . min(3, $cnt_enum_value) . '">' . "\n";
|
||||
$str .= '' . PMA_generate_common_url($db, $table) . '&field=' . urlencode($field) . '&fieldkey=' . $i . '">' . str_replace("'", "\'", $titles['Browse']) . '</a>\');';
|
||||
// ]]
|
||||
$str .= '</script>';
|
||||
}
|
||||
elseif (strncasecmp($tbl_fields_type[$i], 'enum', 4) == 0) {
|
||||
// e n u m s
|
||||
$enum_value=explode(', ', str_replace("'", '', substr($tbl_fields_type[$i], 5, -1)));
|
||||
$cnt_enum_value = count($enum_value);
|
||||
$str .= '<select name="fields[' . ($i) . '][]"'
|
||||
.' multiple="multiple" size="' . min(3, $cnt_enum_value) . '">' . "\n";
|
||||
for ($j = 0; $j < $cnt_enum_value; $j++) {
|
||||
if(isset($fields[$i]) && is_array($fields[$i]) && in_array($enum_value[$j],$fields[$i])){
|
||||
$str .= ' <option value="' . $enum_value[$j] . '" Selected>'
|
||||
if(isset($fields[$i]) && is_array($fields[$i]) && in_array($enum_value[$j],$fields[$i])){
|
||||
$str .= ' <option value="' . $enum_value[$j] . '" Selected>'
|
||||
. $enum_value[$j] . '</option>';
|
||||
}
|
||||
else{
|
||||
@ -221,26 +218,27 @@ EOT;
|
||||
. $enum_value[$j] . '</option>';
|
||||
}
|
||||
} // end for
|
||||
$str .= ' </select>' . "\n";
|
||||
} else {
|
||||
// o t h e r c a s e s
|
||||
$the_class = 'textfield';
|
||||
$type = $tbl_fields_type[$i];
|
||||
if ($type == 'date') {
|
||||
$the_class .= ' datefield';
|
||||
} elseif ($type == 'datetime' || substr($type, 0, 9) == 'timestamp') {
|
||||
$the_class .= ' datetimefield';
|
||||
}
|
||||
if(isset($fields[$i]) && is_string($fields[$i])){
|
||||
$str .= ' <input type="text" name="fields[' . $i . ']"'
|
||||
.' size="40" class="' . $the_class . '" id="field_' . $i . '" value = "' . $fields[$i] . '"/>' . "\n";
|
||||
}
|
||||
else{
|
||||
$str .= ' <input type="text" name="fields[' . $i . ']"'
|
||||
.' size="40" class="' . $the_class . '" id="field_' . $i . '" />' . "\n";
|
||||
}
|
||||
};
|
||||
return $str;
|
||||
$str .= ' </select>' . "\n";
|
||||
}
|
||||
else {
|
||||
// o t h e r c a s e s
|
||||
$the_class = 'textfield';
|
||||
$type = $tbl_fields_type[$i];
|
||||
if ($type == 'date') {
|
||||
$the_class .= ' datefield';
|
||||
} elseif ($type == 'datetime' || substr($type, 0, 9) == 'timestamp') {
|
||||
$the_class .= ' datetimefield';
|
||||
}
|
||||
if(isset($fields[$i]) && is_string($fields[$i])){
|
||||
$str .= ' <input type="text" name="fields[' . $i . ']"'
|
||||
.' size="40" class="' . $the_class . '" id="field_' . $i . '" value = "' . $fields[$i] . '"/>' . "\n";
|
||||
}
|
||||
else{
|
||||
$str .= ' <input type="text" name="fields[' . $i . ']"'
|
||||
.' size="40" class="' . $the_class . '" id="field_' . $i . '" />' . "\n";
|
||||
}
|
||||
};
|
||||
return $str;
|
||||
|
||||
}
|
||||
|
||||
@ -271,79 +269,79 @@ EOT;
|
||||
function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $func_type, $unaryFlag){
|
||||
|
||||
|
||||
$w = '';
|
||||
if($unaryFlag){
|
||||
$fields = '';
|
||||
$w = PMA_backquote($names) . ' ' . $func_type;
|
||||
$w = '';
|
||||
if($unaryFlag){
|
||||
$fields = '';
|
||||
$w = PMA_backquote($names) . ' ' . $func_type;
|
||||
|
||||
} elseif (strncasecmp($types, 'enum', 4) == 0) {
|
||||
if (!empty($fields)) {
|
||||
if (! is_array($fields)) {
|
||||
$fields = explode(',', $fields);
|
||||
}
|
||||
$enum_selected_count = count($fields);
|
||||
if ($func_type == '=' && $enum_selected_count > 1) {
|
||||
$func_type = 'IN';
|
||||
$parens_open = '(';
|
||||
$parens_close = ')';
|
||||
} elseif (strncasecmp($types, 'enum', 4) == 0) {
|
||||
if (!empty($fields)) {
|
||||
if (! is_array($fields)) {
|
||||
$fields = explode(',', $fields);
|
||||
}
|
||||
$enum_selected_count = count($fields);
|
||||
if ($func_type == '=' && $enum_selected_count > 1) {
|
||||
$func_type = 'IN';
|
||||
$parens_open = '(';
|
||||
$parens_close = ')';
|
||||
|
||||
} elseif ($func_type == '!=' && $enum_selected_count > 1) {
|
||||
$func_type = 'NOT IN';
|
||||
$parens_open = '(';
|
||||
$parens_close = ')';
|
||||
} elseif ($func_type == '!=' && $enum_selected_count > 1) {
|
||||
$func_type = 'NOT IN';
|
||||
$parens_open = '(';
|
||||
$parens_close = ')';
|
||||
|
||||
} else {
|
||||
$parens_open = '';
|
||||
$parens_close = '';
|
||||
}
|
||||
$enum_where = '\'' . PMA_sqlAddslashes($fields[0]) . '\'';
|
||||
for ($e = 1; $e < $enum_selected_count; $e++) {
|
||||
$enum_where .= ', \'' . PMA_sqlAddslashes($fields[$e]) . '\'';
|
||||
}
|
||||
} else {
|
||||
$parens_open = '';
|
||||
$parens_close = '';
|
||||
}
|
||||
$enum_where = '\'' . PMA_sqlAddslashes($fields[0]) . '\'';
|
||||
for ($e = 1; $e < $enum_selected_count; $e++) {
|
||||
$enum_where .= ', \'' . PMA_sqlAddslashes($fields[$e]) . '\'';
|
||||
}
|
||||
|
||||
$w = PMA_backquote($names) . ' ' . $func_type . ' ' . $parens_open . $enum_where . $parens_close;
|
||||
}
|
||||
$w = PMA_backquote($names) . ' ' . $func_type . ' ' . $parens_open . $enum_where . $parens_close;
|
||||
}
|
||||
|
||||
} elseif ($fields != '') {
|
||||
// For these types we quote the value. Even if it's another type (like INT),
|
||||
// for a LIKE we always quote the value. MySQL converts strings to numbers
|
||||
// and numbers to strings as necessary during the comparison
|
||||
if (preg_match('@char|binary|blob|text|set|date|time|year@i', $types) || strpos(' ' . $func_type, 'LIKE')) {
|
||||
$quot = '\'';
|
||||
} else {
|
||||
$quot = '';
|
||||
}
|
||||
} elseif ($fields != '') {
|
||||
// For these types we quote the value. Even if it's another type (like INT),
|
||||
// for a LIKE we always quote the value. MySQL converts strings to numbers
|
||||
// and numbers to strings as necessary during the comparison
|
||||
if (preg_match('@char|binary|blob|text|set|date|time|year@i', $types) || strpos(' ' . $func_type, 'LIKE')) {
|
||||
$quot = '\'';
|
||||
} else {
|
||||
$quot = '';
|
||||
}
|
||||
|
||||
// LIKE %...%
|
||||
if ($func_type == 'LIKE %...%') {
|
||||
$func_type = 'LIKE';
|
||||
$fields = '%' . $fields . '%';
|
||||
}
|
||||
if ($func_type == 'REGEXP ^...$') {
|
||||
$func_type = 'REGEXP';
|
||||
$fields = '^' . $fields . '$';
|
||||
}
|
||||
// LIKE %...%
|
||||
if ($func_type == 'LIKE %...%') {
|
||||
$func_type = 'LIKE';
|
||||
$fields = '%' . $fields . '%';
|
||||
}
|
||||
if ($func_type == 'REGEXP ^...$') {
|
||||
$func_type = 'REGEXP';
|
||||
$fields = '^' . $fields . '$';
|
||||
}
|
||||
|
||||
if ($func_type == 'IN (...)' || $func_type == 'NOT IN (...)' || $func_type == 'BETWEEN' || $func_type == 'NOT BETWEEN') {
|
||||
$func_type = str_replace(' (...)', '', $func_type);
|
||||
if ($func_type == 'IN (...)' || $func_type == 'NOT IN (...)' || $func_type == 'BETWEEN' || $func_type == 'NOT BETWEEN') {
|
||||
$func_type = str_replace(' (...)', '', $func_type);
|
||||
|
||||
// quote values one by one
|
||||
$values = explode(',', $fields);
|
||||
foreach ($values as &$value)
|
||||
$value = $quot . PMA_sqlAddslashes(trim($value)) . $quot;
|
||||
// quote values one by one
|
||||
$values = explode(',', $fields);
|
||||
foreach ($values as &$value)
|
||||
$value = $quot . PMA_sqlAddslashes(trim($value)) . $quot;
|
||||
|
||||
if ($func_type == 'BETWEEN' || $func_type == 'NOT BETWEEN')
|
||||
$w = PMA_backquote($names) . ' ' . $func_type . ' ' . (isset($values[0]) ? $values[0] : '') . ' AND ' . (isset($values[1]) ? $values[1] : '');
|
||||
else
|
||||
$w = PMA_backquote($names) . ' ' . $func_type . ' (' . implode(',', $values) . ')';
|
||||
}
|
||||
else {
|
||||
$w = PMA_backquote($names) . ' ' . $func_type . ' ' . $quot . PMA_sqlAddslashes($fields) . $quot;;
|
||||
}
|
||||
if ($func_type == 'BETWEEN' || $func_type == 'NOT BETWEEN')
|
||||
$w = PMA_backquote($names) . ' ' . $func_type . ' ' . (isset($values[0]) ? $values[0] : '') . ' AND ' . (isset($values[1]) ? $values[1] : '');
|
||||
else
|
||||
$w = PMA_backquote($names) . ' ' . $func_type . ' (' . implode(',', $values) . ')';
|
||||
}
|
||||
else {
|
||||
$w = PMA_backquote($names) . ' ' . $func_type . ' ' . $quot . PMA_sqlAddslashes($fields) . $quot;;
|
||||
}
|
||||
|
||||
} // end if
|
||||
} // end if
|
||||
|
||||
return $w;
|
||||
return $w;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -51,11 +51,7 @@ if (! isset($param) || $param[0] == '') {
|
||||
|
||||
// Gets the list and number of fields
|
||||
|
||||
$fields_array = PMA_tbl_getFields($table,$db);
|
||||
$fields_list = $fields_array[0];
|
||||
$fields_type = $fields_array[1];
|
||||
$fields_collation = $fields_array[2];
|
||||
$fields_null = $fields_array[3];
|
||||
list($fields_list, $fields_type, $fields_collation, $fields_null) = PMA_tbl_getFields($table,$db);
|
||||
$fields_cnt = count($fields_list);
|
||||
|
||||
// retrieve keys into foreign fields, if any
|
||||
|
||||
@ -48,22 +48,15 @@ if (! isset($zoom_submit)) {
|
||||
|
||||
// Gets the list and number of fields
|
||||
|
||||
$fields_array = PMA_tbl_getFields($table,$db);
|
||||
$fields_list = $fields_array[0];
|
||||
$fields_type = $fields_array[1];
|
||||
$fields_collation = $fields_array[2];
|
||||
$fields_null = $fields_array[3];
|
||||
list($fields_list, $fields_type, $fields_collation, $fields_null) = PMA_tbl_getFields($table,$db);
|
||||
$fields_cnt = count($fields_list);
|
||||
|
||||
|
||||
// retrieve keys into foreign fields, if any
|
||||
// check also foreigners even if relwork is FALSE (to get
|
||||
// foreign keys from innodb)
|
||||
$foreigners = PMA_getForeigners($db, $table);
|
||||
$flag = 1;
|
||||
$tbl_fields_type =array();
|
||||
$tbl_fields_collation =array();
|
||||
$tbl_fields_null =array();
|
||||
$tbl_fields_type = $tbl_fields_collation = $tbl_fields_null = array();
|
||||
?>
|
||||
|
||||
<fieldset id="fieldset_subtab">
|
||||
@ -79,19 +72,19 @@ echo PMA_generate_html_tabs(PMA_tbl_getSubTabs(), $url_params);
|
||||
|
||||
if(isset($inputs) && ($inputs[0] != __('pma_null') || $inputs[1] != __('pma_null')))
|
||||
{
|
||||
$flag = 2;
|
||||
for($i = 0 ; $i < 2 ; $i++)
|
||||
{
|
||||
if($inputs[$i] != __('pma_null'))
|
||||
{
|
||||
$key = array_search($inputs[$i],$fields_list);
|
||||
$tbl_fields_type[$i] = $fields_type[$key];
|
||||
$tbl_fields_collation[$i] = $fields_collation[$key];
|
||||
$tbl_fields_null[$i] = $fields_null[$key];
|
||||
}
|
||||
|
||||
$flag = 2;
|
||||
for($i = 0 ; $i < 2 ; $i++)
|
||||
{
|
||||
if($inputs[$i] != __('pma_null'))
|
||||
{
|
||||
$key = array_search($inputs[$i],$fields_list);
|
||||
$tbl_fields_type[$i] = $fields_type[$key];
|
||||
$tbl_fields_collation[$i] = $fields_collation[$key];
|
||||
$tbl_fields_null[$i] = $fields_null[$key];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@ -110,21 +103,21 @@ if(isset($inputs) && ($inputs[0] != __('pma_null') || $inputs[1] != __('pma_null
|
||||
<?php
|
||||
$odd_row = true;
|
||||
|
||||
for($i=0 ; $i<2 ; $i++){
|
||||
for($i = 0 ; $i < 2 ; $i++){
|
||||
?>
|
||||
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
|
||||
<th><select name="inputs[]" id=<?php echo 'tableid_' . $i?> >
|
||||
<option value= <?php echo __('pma_null')?>><?php echo __('None'); ?> </option>
|
||||
<?php
|
||||
for ($j = 0; $j < $fields_cnt; $j++){
|
||||
if(isset($inputs[$i]) && $inputs[$i]==htmlspecialchars($fields_list[$j])){?>
|
||||
<option value=<?php echo htmlspecialchars($fields_list[$j]);?> Selected> <?php echo htmlspecialchars($fields_list[$j]);?></option>
|
||||
for ($j = 0 ; $j < $fields_cnt ; $j++){
|
||||
if(isset($inputs[$i]) && $inputs[$i] == htmlspecialchars($fields_list[$j])){?>
|
||||
<option value=<?php echo htmlspecialchars($fields_list[$j]);?> Selected> <?php echo htmlspecialchars($fields_list[$j]);?></option>
|
||||
<?php
|
||||
}
|
||||
else{ ?>
|
||||
<option value=<?php echo htmlspecialchars($fields_list[$j]);?> > <?php echo htmlspecialchars($fields_list[$j]);?></option>
|
||||
}
|
||||
else{ ?>
|
||||
<option value=<?php echo htmlspecialchars($fields_list[$j]);?> > <?php echo htmlspecialchars($fields_list[$j]);?></option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
} ?>
|
||||
</select></th>
|
||||
<td><?php if(isset($tbl_fields_type[$i]))echo $tbl_fields_type[$i]; ?></td>
|
||||
@ -132,56 +125,61 @@ if(isset($inputs) && ($inputs[0] != __('pma_null') || $inputs[1] != __('pma_null
|
||||
|
||||
<td>
|
||||
<?php if(isset($inputs) && $inputs[$i] != __('pma_null')){ ?>
|
||||
<select name="zoomFunc[]">
|
||||
<?php
|
||||
<select name="zoomFunc[]">
|
||||
<?php
|
||||
|
||||
if (strncasecmp($tbl_fields_type[$i], 'enum', 4) == 0) {
|
||||
foreach ($GLOBALS['cfg']['EnumOperators'] as $fc) {
|
||||
echo "\n" . ' '
|
||||
. '<option value="' . htmlspecialchars($fc) . '">'
|
||||
. htmlspecialchars($fc) . '</option>';
|
||||
}
|
||||
} elseif (preg_match('@char|blob|text|set@i', $tbl_fields_type[$i])) {
|
||||
foreach ($GLOBALS['cfg']['TextOperators'] as $fc) {
|
||||
echo "\n" . ' '
|
||||
. '<option value="' . htmlspecialchars($fc) . '">'
|
||||
. htmlspecialchars($fc) . '</option>';
|
||||
}
|
||||
} else {
|
||||
foreach ($GLOBALS['cfg']['NumOperators'] as $fc) {
|
||||
echo "\n" . ' '
|
||||
. '<option value="' . htmlspecialchars($fc) . '">'
|
||||
. htmlspecialchars($fc) . '</option>';
|
||||
}
|
||||
} // end if... else...
|
||||
if ($tbl_fields_null[$i]) {
|
||||
foreach ($GLOBALS['cfg']['NullOperators'] as $fc) {
|
||||
echo "\n" . ' '
|
||||
. '<option value="' . htmlspecialchars($fc) . '">'
|
||||
. htmlspecialchars($fc) . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
if (strncasecmp($tbl_fields_type[$i], 'enum', 4) == 0) {
|
||||
foreach ($GLOBALS['cfg']['EnumOperators'] as $fc) {
|
||||
echo "\n" . ' '
|
||||
. '<option value="' . htmlspecialchars($fc) . '">'
|
||||
. htmlspecialchars($fc) . '</option>';
|
||||
}
|
||||
} elseif (preg_match('@char|blob|text|set@i', $tbl_fields_type[$i])) {
|
||||
foreach ($GLOBALS['cfg']['TextOperators'] as $fc) {
|
||||
echo "\n" . ' '
|
||||
. '<option value="' . htmlspecialchars($fc) . '">'
|
||||
. htmlspecialchars($fc) . '</option>';
|
||||
}
|
||||
} else {
|
||||
foreach ($GLOBALS['cfg']['NumOperators'] as $fc) {
|
||||
echo "\n" . ' '
|
||||
. '<option value="' . htmlspecialchars($fc) . '">'
|
||||
. htmlspecialchars($fc) . '</option>';
|
||||
}
|
||||
} // end if... else...
|
||||
|
||||
if ($tbl_fields_null[$i]) {
|
||||
foreach ($GLOBALS['cfg']['NullOperators'] as $fc) {
|
||||
echo "\n" . ' '
|
||||
. '<option value="' . htmlspecialchars($fc) . '">'
|
||||
. htmlspecialchars($fc) . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$field = $inputs[$i];
|
||||
|
||||
$foreignData = PMA_getForeignData($foreigners, $field, false, '', '');
|
||||
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$field = $inputs[$i];
|
||||
|
||||
$foreignData = PMA_getForeignData($foreigners, $field, false, '', '');
|
||||
|
||||
if (isset($fields))
|
||||
if (isset($fields))
|
||||
echo PMA_getForeignFields_Values($foreigners, $foreignData, $field, $tbl_fields_type, $i ,$db, $table, $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], $fields);
|
||||
else
|
||||
else
|
||||
echo PMA_getForeignFields_Values($foreigners, $foreignData, $field, $tbl_fields_type, $i ,$db, $table, $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], '');
|
||||
|
||||
}
|
||||
?>
|
||||
<input type="hidden" name="types[<?php echo $i; ?>]"
|
||||
value="<?php if(isset($tbl_fields_type[$i]))echo $tbl_fields_type[$i]; ?>" />
|
||||
<input type="hidden" name="collations[<?php echo $i; ?>]"
|
||||
value="<?php if(isset($tbl_fields_collation[$i]))echo $tbl_fields_collation[$i]; ?>" />
|
||||
else{ ?>
|
||||
|
||||
</td><td></td>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<input type="hidden" name="types[<?php echo $i; ?>]"
|
||||
value="<?php if(isset($tbl_fields_type[$i]))echo $tbl_fields_type[$i]; ?>" />
|
||||
<input type="hidden" name="collations[<?php echo $i; ?>]"
|
||||
value="<?php if(isset($tbl_fields_collation[$i]))echo $tbl_fields_collation[$i]; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -211,31 +209,31 @@ else {
|
||||
|
||||
// Unlike tbl_search page this part builds two queries, Query1 for the search criteria on 1st column and Query2 for the other column. This has to be done because user can select two same columns having different criteria.
|
||||
|
||||
for($i = 0 ;$i<2;$i++){
|
||||
for($i = 0 ; $i < 2 ; $i++){
|
||||
|
||||
$sql_query = 'SELECT ';
|
||||
$sql_query = 'SELECT ';
|
||||
|
||||
// Add the colums to be selected
|
||||
// Add the colums to be selected
|
||||
|
||||
$sql_query .= PMA_backquote($inputs[$i]);
|
||||
$sql_query .= PMA_backquote($inputs[$i]);
|
||||
|
||||
//Add the table
|
||||
//Add the table
|
||||
|
||||
$sql_query .= ' FROM ' . PMA_backquote($table);
|
||||
$sql_query .= ' FROM ' . PMA_backquote($table);
|
||||
|
||||
// The where clause
|
||||
$charsets = array();
|
||||
$cnt_func = count($zoomFunc[$i]);
|
||||
reset($zoomFunc[$i]);
|
||||
$func_type = $zoomFunc[$i];
|
||||
list($charsets[$i]) = explode('_', $collations[$i]);
|
||||
$unaryFlag = (isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) ? true : false;
|
||||
$w = PMA_tbl_search_getWhereClause($fields[$i],$inputs[$i], $types[$i], $collations[$i], $func_type, $unaryFlag);
|
||||
if ($w != '') {
|
||||
$sql_query .= ' WHERE ' . $w;
|
||||
}
|
||||
print $sql_query."<br>";
|
||||
}
|
||||
// The where clause
|
||||
$charsets = array();
|
||||
$cnt_func = count($zoomFunc[$i]);
|
||||
reset($zoomFunc[$i]);
|
||||
$func_type = $zoomFunc[$i];
|
||||
list($charsets[$i]) = explode('_', $collations[$i]);
|
||||
$unaryFlag = (isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) ? true : false;
|
||||
$w = PMA_tbl_search_getWhereClause($fields[$i],$inputs[$i], $types[$i], $collations[$i], $func_type, $unaryFlag);
|
||||
if ($w != '') {
|
||||
$sql_query .= ' WHERE ' . $w;
|
||||
}
|
||||
print $sql_query."<br>";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user