Merge branch 'master' into plugins-and-OOP
This commit is contained in:
commit
db4e781485
@ -495,7 +495,7 @@ class PMA_Header
|
||||
}
|
||||
$retval .= "<noscript>";
|
||||
$retval .= PMA_message::error(
|
||||
__("Javascript must be enabled past this point")
|
||||
__("Javascript must be enabled past this point")
|
||||
)->getDisplay();
|
||||
$retval .= "</noscript>";
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ class PMA_TableSearch
|
||||
* @return array column names
|
||||
*/
|
||||
public function getColumnNames()
|
||||
{
|
||||
{
|
||||
return $this->_columnNames;
|
||||
}
|
||||
|
||||
@ -260,10 +260,10 @@ class PMA_TableSearch
|
||||
$column_index, $titles, $foreignMaxLimit, $criteriaValues, $column_id,
|
||||
$in_zoom_search_edit = false
|
||||
) {
|
||||
$html_output = '';
|
||||
$html_output = '';
|
||||
if (is_array($foreignData['disp_row'])) {
|
||||
$html_output .= '<select name="criteriaValues[' . $column_index . ']" id="'
|
||||
. $column_id . $column_index .'">';
|
||||
$html_output .= '<select name="criteriaValues[' . $column_index . ']"'
|
||||
. ' id="' . $column_id . $column_index .'">';
|
||||
$html_output .= PMA_foreignDropdown(
|
||||
$foreignData['disp_row'], $foreignData['foreign_field'],
|
||||
$foreignData['foreign_display'], '', $foreignMaxLimit
|
||||
@ -329,9 +329,9 @@ EOT;
|
||||
$html_output .= '<select name="criteriaValues[' . ($column_index)
|
||||
. '][]" id="' . $column_id . $column_index .'">';
|
||||
} else {
|
||||
$html_output .= '<select name="criteriaValues[' . ($column_index)
|
||||
. '][]" id="' . $column_id . $column_index .'" multiple="multiple" size="'
|
||||
. min(3, $cnt_value) . '">';
|
||||
$html_output .= '<select name="criteriaValues[' . $column_index . '][]"'
|
||||
. ' id="' . $column_id . $column_index . '" multiple="multiple"'
|
||||
. ' size="' . min(3, $cnt_value) . '">';
|
||||
}
|
||||
|
||||
//Add select options
|
||||
@ -377,7 +377,8 @@ EOT;
|
||||
$column_type = (string)$column_type;
|
||||
$column_id = ($in_zoom_search_edit) ? 'edit_fieldID_' : 'fieldID_';
|
||||
|
||||
//Get inputbox based on different column types (Foreign key, geometrical, enum)
|
||||
// Get inputbox based on different column types
|
||||
// (Foreign key, geometrical, enum)
|
||||
if ($this->_foreigners && isset($this->_foreigners[$column_name])) {
|
||||
$str .= $this->_getForeignKeyInputBox(
|
||||
$foreignData, $column_name, $column_index, $titles,
|
||||
@ -401,7 +402,9 @@ EOT;
|
||||
|
||||
if ($column_type == 'date') {
|
||||
$the_class .= ' datefield';
|
||||
} elseif ($column_type == 'datetime' || substr($column_type, 0, 9) == 'timestamp') {
|
||||
} elseif ($column_type == 'datetime'
|
||||
|| substr($column_type, 0, 9) == 'timestamp'
|
||||
) {
|
||||
$the_class .= ' datetimefield';
|
||||
} elseif (substr($column_type, 0, 3) == 'bit') {
|
||||
$the_class .= ' bit';
|
||||
@ -471,8 +474,9 @@ EOT;
|
||||
*
|
||||
* @return string part of where clause.
|
||||
*/
|
||||
private function _getGeomWhereClause($criteriaValues, $names, $func_type, $geom_func = null)
|
||||
{
|
||||
private function _getGeomWhereClause($criteriaValues, $names,
|
||||
$func_type, $geom_func = null
|
||||
) {
|
||||
$geom_unary_functions = array(
|
||||
'IsEmpty' => 1,
|
||||
'IsSimple' => 1,
|
||||
@ -498,10 +502,14 @@ EOT;
|
||||
}
|
||||
|
||||
// If the where clause is something like 'IsEmpty(`spatial_col_name`)'
|
||||
if (isset($geom_unary_functions[$geom_func]) && trim($criteriaValues) == '') {
|
||||
if (isset($geom_unary_functions[$geom_func])
|
||||
&& trim($criteriaValues) == ''
|
||||
) {
|
||||
$where = $backquoted_name;
|
||||
|
||||
} elseif (in_array($types, PMA_getGISDatatypes()) && ! empty($criteriaValues)) {
|
||||
} elseif (in_array($types, PMA_getGISDatatypes())
|
||||
&& ! empty($criteriaValues)
|
||||
) {
|
||||
// create gis data from the criteria input
|
||||
$gis_data = PMA_createGISData($criteriaValues);
|
||||
$where = $backquoted_name . ' ' . $func_type . ' ' . $gis_data;
|
||||
@ -527,7 +535,9 @@ EOT;
|
||||
) {
|
||||
// If geometry function is set
|
||||
if ($geom_func != null && trim($geom_func) != '') {
|
||||
return $this->_getGeomWhereClause($criteriaValues, $names, $func_type, $geom_func);
|
||||
return $this->_getGeomWhereClause(
|
||||
$criteriaValues, $names, $func_type, $geom_func
|
||||
);
|
||||
}
|
||||
|
||||
$backquoted_name = PMA_backquote($names);
|
||||
@ -541,9 +551,10 @@ EOT;
|
||||
$where .= $this->_getEnumWhereClause($criteriaValues, $func_type);
|
||||
|
||||
} elseif ($criteriaValues != '') {
|
||||
// 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
|
||||
// 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')
|
||||
) {
|
||||
@ -622,7 +633,7 @@ EOT;
|
||||
$sql_query .= ' FROM ' . PMA_backquote($_POST['table']);
|
||||
$whereClause = $this->_generateWhereClause();
|
||||
$sql_query .= $whereClause;
|
||||
|
||||
|
||||
// if the search results are to be ordered
|
||||
if (isset($_POST['orderByColumn']) && $_POST['orderByColumn'] != '--nil--') {
|
||||
$sql_query .= ' ORDER BY ' . PMA_backquote($_POST['orderByColumn'])
|
||||
@ -640,7 +651,9 @@ EOT;
|
||||
{
|
||||
$fullWhereClause = '';
|
||||
|
||||
if (isset($_POST['customWhereClause']) && trim($_POST['customWhereClause']) != '') {
|
||||
if (isset($_POST['customWhereClause'])
|
||||
&& trim($_POST['customWhereClause']) != ''
|
||||
) {
|
||||
$fullWhereClause .= ' WHERE ' . $_POST['customWhereClause'];
|
||||
return $fullWhereClause;
|
||||
}
|
||||
@ -665,7 +678,9 @@ EOT;
|
||||
$_POST['criteriaValues'][$column_index],
|
||||
$_POST['criteriaColumnNames'][$column_index],
|
||||
$_POST['criteriaColumnTypes'][$column_index],
|
||||
$_POST['criteriaColumnCollations'][$column_index], $operator, $unaryFlag,
|
||||
$_POST['criteriaColumnCollations'][$column_index],
|
||||
$operator,
|
||||
$unaryFlag,
|
||||
$tmp_geom_func
|
||||
);
|
||||
|
||||
@ -706,9 +721,12 @@ EOT;
|
||||
$html_output .= '<select class="geom_func" name="geom_func['
|
||||
. $column_index . ']">';
|
||||
// get the relevant list of GIS functions
|
||||
$funcs = PMA_getGISFunctions($this->_columnTypes[$column_index], true, true);
|
||||
$funcs = PMA_getGISFunctions(
|
||||
$this->_columnTypes[$column_index], true, true
|
||||
);
|
||||
/**
|
||||
* For each function in the list of functions, add an option to select list
|
||||
* For each function in the list of functions,
|
||||
* add an option to select list
|
||||
*/
|
||||
foreach ($funcs as $func_name => $func) {
|
||||
$name = isset($func['display']) ? $func['display'] : $func_name;
|
||||
@ -737,8 +755,9 @@ EOT;
|
||||
*/
|
||||
$html_output .= '<fieldset id="fieldset_select_fields">'
|
||||
. '<legend>' . __('Select columns (at least one):') . '</legend>'
|
||||
. '<select name="columnsToDisplay[]" size="' . min(count($this->_columnNames), 10)
|
||||
. '" multiple="multiple">';
|
||||
. '<select name="columnsToDisplay[]"'
|
||||
. ' size="' . min(count($this->_columnNames), 10) . '"'
|
||||
. ' multiple="multiple">';
|
||||
// Displays the list of the fields
|
||||
foreach ($this->_columnNames as $each_field) {
|
||||
$html_output .= ' '
|
||||
@ -757,8 +776,8 @@ EOT;
|
||||
. '<legend>' . '<em>' . __('Or') . '</em> '
|
||||
. __('Add search conditions (body of the "where" clause):') . '</legend>';
|
||||
$html_output .= PMA_showMySQLDocu('SQL-Syntax', 'Functions');
|
||||
$html_output .= '<input type="text" name="customWhereClause" class="textfield"'
|
||||
. 'size="64" />';
|
||||
$html_output .= '<input type="text" name="customWhereClause"'
|
||||
. ' class="textfield" size="64" />';
|
||||
$html_output .= '</fieldset>';
|
||||
|
||||
/**
|
||||
@ -771,7 +790,8 @@ EOT;
|
||||
. '</fieldset>';
|
||||
|
||||
/**
|
||||
* Displays option for ordering search results by a column value (Asc or Desc)
|
||||
* Displays option for ordering search results
|
||||
* by a column value (Asc or Desc)
|
||||
*/
|
||||
$html_output .= '<fieldset id="fieldset_display_order">'
|
||||
. '<legend>' . __('Display order:') . '</legend>'
|
||||
@ -833,8 +853,9 @@ EOT;
|
||||
$html_output .= '<td><label for="maxRowPlotLimit">'
|
||||
. __("Maximum rows to plot") . '</label></td>';
|
||||
$html_output .= '<td>';
|
||||
$html_output .= '<input type="text" name="maxPlotLimit" id="maxRowPlotLimit" '
|
||||
. 'value="' . ((! empty($_POST['maxPlotLimit']))
|
||||
$html_output .= '<input type="text" name="maxPlotLimit"'
|
||||
. ' id="maxRowPlotLimit"'
|
||||
. ' value="' . ((! empty($_POST['maxPlotLimit']))
|
||||
? htmlspecialchars($_POST['maxPlotLimit'])
|
||||
: $GLOBALS['cfg']['maxRowPlotLimit'])
|
||||
. '" />';
|
||||
@ -902,8 +923,8 @@ EOT;
|
||||
//If 'Function' column is present
|
||||
$html_output .= $this->_getGeomFuncHtml($column_index);
|
||||
//Displays column's name, type, collation and value
|
||||
$html_output .= '<th>' . htmlspecialchars($this->_columnNames[$column_index])
|
||||
. '</th>';
|
||||
$html_output .= '<th>'
|
||||
. htmlspecialchars($this->_columnNames[$column_index]) . '</th>';
|
||||
$properties = $this->getColumnProperties($column_index, $column_index);
|
||||
$html_output .= '<td>' . $properties['type'] . '</td>';
|
||||
$html_output .= '<td>' . $properties['collation'] . '</td>';
|
||||
@ -912,16 +933,19 @@ EOT;
|
||||
$html_output .= '</tr>';
|
||||
//Displays hidden fields
|
||||
$html_output .= '<tr><td>';
|
||||
$html_output .= '<input type="hidden" name="criteriaColumnNames['
|
||||
. $column_index . ']" value="'
|
||||
. htmlspecialchars($this->_columnNames[$column_index]) . '" />';
|
||||
$html_output .= '<input type="hidden" name="criteriaColumnTypes['
|
||||
. $column_index . ']" value="' . $this->_columnTypes[$column_index] . '" />';
|
||||
$html_output .= '<input type="hidden" name="criteriaColumnCollations['
|
||||
. $column_index . ']" value="' . $this->_columnCollations[$column_index]
|
||||
. '" /></td></tr>';
|
||||
$html_output .= '<input type="hidden"'
|
||||
. ' name="criteriaColumnNames[' . $column_index . ']"'
|
||||
. ' value="' . htmlspecialchars($this->_columnNames[$column_index])
|
||||
. '" />';
|
||||
$html_output .= '<input type="hidden"'
|
||||
. ' name="criteriaColumnTypes[' . $column_index . ']"'
|
||||
. ' value="' . $this->_columnTypes[$column_index] . '" />';
|
||||
$html_output .= '<input type="hidden"'
|
||||
. ' name="criteriaColumnCollations[' . $column_index . ']"'
|
||||
. ' value="' . $this->_columnCollations[$column_index] . '" />';
|
||||
$html_output .= '</td></tr>';
|
||||
} // end for
|
||||
|
||||
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
@ -971,7 +995,10 @@ EOT;
|
||||
if (isset($_POST['criteriaColumnNames'])
|
||||
&& $_POST['criteriaColumnNames'][$i] != 'pma_null'
|
||||
) {
|
||||
$key = array_search($_POST['criteriaColumnNames'][$i], $this->_columnNames);
|
||||
$key = array_search(
|
||||
$_POST['criteriaColumnNames'][$i],
|
||||
$this->_columnNames
|
||||
);
|
||||
$properties = $this->getColumnProperties($i, $key);
|
||||
$type[$i] = $properties['type'];
|
||||
$collation[$i] = $properties['collation'];
|
||||
@ -983,7 +1010,7 @@ EOT;
|
||||
//Column Collation
|
||||
$html_output .= '<td>' . (isset($collation[$i]) ? $collation[$i] : '')
|
||||
. '</td>';
|
||||
//Select options for column operators
|
||||
//Select options for column operators
|
||||
$html_output .= '<td>' . (isset($func[$i]) ? $func[$i] : '') . '</td>';
|
||||
//Inputbox for search criteria value
|
||||
$html_output .= '<td>' . (isset($value[$i]) ? $value[$i] : '') . '</td>';
|
||||
@ -1192,8 +1219,9 @@ EOT;
|
||||
//Column's Input box
|
||||
$html_output .= '<th>';
|
||||
$html_output .= $this->_getInputbox(
|
||||
$foreignData, $fieldpopup, $this->_columnTypes[$column_index], $column_index,
|
||||
$titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], '', false, true
|
||||
$foreignData, $fieldpopup, $this->_columnTypes[$column_index],
|
||||
$column_index, $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'],
|
||||
'', false, true
|
||||
);
|
||||
$html_output .= '</th></tr>';
|
||||
}
|
||||
|
||||
@ -267,7 +267,9 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false,
|
||||
.' cols="' . $GLOBALS['cfg']['TextareaCols'] . '"'
|
||||
.' rows="' . $height . '"'
|
||||
.' dir="' . $GLOBALS['text_dir'] . '"'
|
||||
.$auto_sel . $locking . '>' . htmlspecialchars($query) . '</textarea>' . "\n";
|
||||
.$auto_sel . $locking . '>'
|
||||
. htmlspecialchars($query)
|
||||
. '</textarea>' . "\n";
|
||||
// Add buttons to generate query easily for
|
||||
// select all, single select, insert, update and delete
|
||||
if (count($fields_list)) {
|
||||
@ -289,7 +291,10 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false,
|
||||
foreach ($fields_list as $field) {
|
||||
echo '<option value="'
|
||||
.PMA_backquote(htmlspecialchars($field['Field'])) . '"';
|
||||
if (isset($field['Field']) && strlen($field['Field']) && isset($field['Comment'])) {
|
||||
if (isset($field['Field'])
|
||||
&& strlen($field['Field'])
|
||||
&& isset($field['Comment'])
|
||||
) {
|
||||
echo ' title="' . htmlspecialchars($field['Comment']) . '"';
|
||||
}
|
||||
echo '>' . htmlspecialchars($field['Field']) . '</option>' . "\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user