Use PMA_Types->getAllFunctions

This commit is contained in:
Michal Čihař 2012-04-26 11:28:56 +02:00
parent eebad9fbb9
commit f975393726
2 changed files with 9 additions and 7 deletions

View File

@ -3734,14 +3734,15 @@ function PMA_getFunctionsForField($field, $insert_mode)
// For compatibility's sake, do not let out all other functions. Instead
// print a separator (blank) and then show ALL functions which weren't
// shown yet.
$cnt_functions = count($cfg['Functions']);
$functions = $GLOBALS['PMA_Types']->getAllFunctions();
$cnt_functions = count($functions);
for ($j = 0; $j < $cnt_functions; $j++) {
if (! isset($dropdown_built[$cfg['Functions'][$j]])
|| $dropdown_built[$cfg['Functions'][$j]] != 'true'
if (! isset($dropdown_built[$functions[$j]])
|| $dropdown_built[$functions[$j]] != 'true'
) {
// Is current function defined as default?
$selected = ($field['first_timestamp'] && $cfg['Functions'][$j] == $cfg['DefaultFunctions']['first_timestamp'])
|| (! $field['first_timestamp'] && $cfg['Functions'][$j] == $default_function)
$selected = ($field['first_timestamp'] && $functions[$j] == $cfg['DefaultFunctions']['first_timestamp'])
|| (! $field['first_timestamp'] && $functions[$j] == $default_function)
? ' selected="selected"'
: '';
if ($op_spacing_needed == true) {
@ -3751,7 +3752,7 @@ function PMA_getFunctionsForField($field, $insert_mode)
}
$retval .= ' ';
$retval .= '<option' . $selected . '>' . $cfg['Functions'][$j]
$retval .= '<option' . $selected . '>' . $functions[$j]
. '</option>' . "\n";
}
} // end for

View File

@ -1143,6 +1143,7 @@ function PMA_RTN_handleExecute()
$queries = array();
$end_query = array();
$args = array();
$all_functions = $GLOBALS['PMA_Types']->getAllFunctions();
for ($i=0; $i<$routine['item_num_params']; $i++) {
if (isset($_REQUEST['params'][$routine['item_param_name'][$i]])) {
$value = $_REQUEST['params'][$routine['item_param_name'][$i]];
@ -1151,7 +1152,7 @@ function PMA_RTN_handleExecute()
}
$value = PMA_sqlAddSlashes($value);
if (! empty($_REQUEST['funcs'][$routine['item_param_name'][$i]])
&& in_array($_REQUEST['funcs'][$routine['item_param_name'][$i]], $cfg['Functions'])
&& in_array($_REQUEST['funcs'][$routine['item_param_name'][$i]], $all_functions)
) {
$queries[] = "SET @p$i={$_REQUEST['funcs'][$routine['item_param_name'][$i]]}('$value');\n";
} else {