fix indentation

This commit is contained in:
Dieter Adriaenssens 2012-04-28 22:44:03 +02:00
parent 6281b4f941
commit b14acc2e1c
8 changed files with 143 additions and 144 deletions

View File

@ -724,7 +724,7 @@ class PMA_File
// UTF-8
if (strncmp($result, "\xEF\xBB\xBF", 3) == 0) {
$result = substr($result, 3);
// UTF-16 BE, LE
// UTF-16 BE, LE
} elseif (strncmp($result, "\xFE\xFF", 2) == 0
|| strncmp($result, "\xFF\xFE", 2) == 0) {
$result = substr($result, 2);

View File

@ -24,11 +24,10 @@ require_once './libraries/List.class.php';
* @todo this object should be attached to the PMA_Server object
* @todo ? make use of INFORMATION_SCHEMA
* @todo ? support --skip-showdatabases and user has only global rights
* @access public
* @since phpMyAdmin 2.9.10
* @package PhpMyAdmin
*/
/*public*/ class PMA_List_Database extends PMA_List
class PMA_List_Database extends PMA_List
{
/**
* @var mixed database link resource|object to be used

View File

@ -317,38 +317,38 @@ class FormDisplay
$opts['errors'] = $this->errors[$work_path];
}
switch ($form->getOptionType($field)) {
case 'string':
$type = 'text';
break;
case 'short_string':
$type = 'short_text';
break;
case 'double':
case 'integer':
$type = 'number_text';
break;
case 'boolean':
$type = 'checkbox';
break;
case 'select':
$type = 'select';
$opts['values'] = $form->getOptionValueList($form->fields[$field]);
break;
case 'array':
$type = 'list';
$value = (array) $value;
$value_default = (array) $value_default;
break;
case 'group':
if (substr($field, 7, 4) != 'end:') { // :group:end is changed to :group:end:{unique id} in Form class
display_group_header(substr($field, 7));
} else {
display_group_footer();
}
return;
case 'NULL':
trigger_error("Field $system_path has no type", E_USER_WARNING);
return;
case 'string':
$type = 'text';
break;
case 'short_string':
$type = 'short_text';
break;
case 'double':
case 'integer':
$type = 'number_text';
break;
case 'boolean':
$type = 'checkbox';
break;
case 'select':
$type = 'select';
$opts['values'] = $form->getOptionValueList($form->fields[$field]);
break;
case 'array':
$type = 'list';
$value = (array) $value;
$value_default = (array) $value_default;
break;
case 'group':
if (substr($field, 7, 4) != 'end:') { // :group:end is changed to :group:end:{unique id} in Form class
display_group_header(substr($field, 7));
} else {
display_group_footer();
}
return;
case 'NULL':
trigger_error("Field $system_path has no type", E_USER_WARNING);
return;
}
// TrustedProxies requires changes before displaying
@ -364,23 +364,23 @@ class FormDisplay
// send default value to form's JS
$js_line = '\'' . $translated_path . '\': ';
switch ($type) {
case 'text':
case 'short_text':
case 'number_text':
$js_line .= '\'' . PMA_escapeJsString($value_default) . '\'';
break;
case 'checkbox':
$js_line .= $value_default ? 'true' : 'false';
break;
case 'select':
$value_default_js = is_bool($value_default)
? (int) $value_default
: $value_default;
$js_line .= '[\'' . PMA_escapeJsString($value_default_js) . '\']';
break;
case 'list':
$js_line .= '\'' . PMA_escapeJsString(implode("\n", $value_default)) . '\'';
break;
case 'text':
case 'short_text':
case 'number_text':
$js_line .= '\'' . PMA_escapeJsString($value_default) . '\'';
break;
case 'checkbox':
$js_line .= $value_default ? 'true' : 'false';
break;
case 'select':
$value_default_js = is_bool($value_default)
? (int) $value_default
: $value_default;
$js_line .= '[\'' . PMA_escapeJsString($value_default_js) . '\']';
break;
case 'list':
$js_line .= '\'' . PMA_escapeJsString(implode("\n", $value_default)) . '\'';
break;
}
$js_default[] = $js_line;
@ -535,45 +535,45 @@ class FormDisplay
// cast variables to correct type
switch ($type) {
case 'double':
settype($_POST[$key], 'float');
break;
case 'boolean':
case 'integer':
if ($_POST[$key] !== '') {
settype($_POST[$key], $type);
case 'double':
settype($_POST[$key], 'float');
break;
case 'boolean':
case 'integer':
if ($_POST[$key] !== '') {
settype($_POST[$key], $type);
}
break;
case 'select':
// special treatment for NavigationBarIconic and PropertiesIconic
if ($key === 'NavigationBarIconic' || $key === 'PropertiesIconic') {
if ($_POST[$key] !== 'both') {
settype($_POST[$key], 'boolean');
}
break;
case 'select':
// special treatment for NavigationBarIconic and PropertiesIconic
if ($key === 'NavigationBarIconic' || $key === 'PropertiesIconic') {
if ($_POST[$key] !== 'both') {
settype($_POST[$key], 'boolean');
}
}
if (!$this->_validateSelect($_POST[$key], $form->getOptionValueList($system_path))) {
$this->errors[$work_path][] = __('Incorrect value');
$result = false;
continue;
}
break;
case 'string':
case 'short_string':
$_POST[$key] = trim($_POST[$key]);
break;
case 'array':
// eliminate empty values and ensure we have an array
$post_values = is_array($_POST[$key])
? $_POST[$key]
: explode("\n", $_POST[$key]);
$_POST[$key] = array();
foreach ($post_values as $v) {
$v = trim($v);
if ($v !== '') {
$_POST[$key][] = $v;
}
if (!$this->_validateSelect($_POST[$key], $form->getOptionValueList($system_path))) {
$this->errors[$work_path][] = __('Incorrect value');
$result = false;
continue;
}
break;
case 'string':
case 'short_string':
$_POST[$key] = trim($_POST[$key]);
break;
case 'array':
// eliminate empty values and ensure we have an array
$post_values = is_array($_POST[$key])
? $_POST[$key]
: explode("\n", $_POST[$key]);
$_POST[$key] = array();
foreach ($post_values as $v) {
$v = trim($v);
if ($v !== '') {
$_POST[$key][] = $v;
}
}
break;
}
break;
}
// now we have value with proper type

View File

@ -217,7 +217,7 @@ if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
* Sets a variable to remember headers have been sent
*/
$GLOBALS['is_header_sent'] = true;
//end if (!$GLOBALS['is_ajax_request'])
//end if (!$GLOBALS['is_ajax_request'])
} else {
if (empty($GLOBALS['is_header_sent'])) {
include_once './libraries/header_http.inc.php';

View File

@ -32,7 +32,7 @@ function PMA_checkTimeout()
return false;
} elseif ($timeout_passed) {
return true;
/* 5 in next row might be too much */
/* 5 in next row might be too much */
} elseif ((time() - $timestamp) > ($maximum_time - 5)) {
$timeout_passed = true;
return true;
@ -173,7 +173,7 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false)
}
} // end run query
} // end if not DROP DATABASE
// end non empty query
// end non empty query
} elseif (!empty($import_run_buffer['full'])) {
if ($go_sql) {
$complete_query .= $import_run_buffer['full'];
@ -315,7 +315,7 @@ function PMA_importGetNextChunk($size = 32768)
// UTF-8
if (strncmp($result, "\xEF\xBB\xBF", 3) == 0) {
$result = substr($result, 3);
// UTF-16 BE, LE
// UTF-16 BE, LE
} elseif (strncmp($result, "\xFE\xFF", 2) == 0 || strncmp($result, "\xFF\xFE", 2) == 0) {
$result = substr($result, 2);
}

View File

@ -62,7 +62,7 @@ function PMA_select_server($not_only_options, $ommit_fieldset)
if (! empty($server['only_db'])) {
if (! is_array($server['only_db'])) {
$label .= ' - ' . $server['only_db'];
// try to avoid displaying a too wide selector
// try to avoid displaying a too wide selector
} elseif (count($server['only_db']) < 4) {
$label .= ' - ' . implode(', ', $server['only_db']);
}

View File

@ -1088,13 +1088,13 @@ if (! defined('PMA_MINIMUM_COMMON')) {
if ($in_extract) {
$number_of_brackets_in_extract--;
if ($number_of_brackets_in_extract == 0) {
$in_extract = false;
$in_extract = false;
}
}
if ($in_group_concat) {
$number_of_brackets_in_group_concat--;
if ($number_of_brackets_in_group_concat == 0) {
$in_group_concat = false;
$in_group_concat = false;
}
}
}
@ -1821,8 +1821,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$seen_default = false;
for ($i = 0; $i < $size; $i++) {
// DEBUG echo "Loop 3 <strong>" . $arr[$i]['data'] . "</strong> " . $arr[$i]['type'] . "<br />";
if ($arr[$i]['type'] == 'alpha_reservedWord') {
$upper_data = strtoupper($arr[$i]['data']);

View File

@ -176,16 +176,16 @@ for ($i = 0; $i < $num_fields; $i++) {
$row['DefaultValue'] = (isset($_REQUEST['field_default_value'][$i]) ? $_REQUEST['field_default_value'][$i] : '');
switch ($row['DefaultType']) {
case 'NONE' :
$row['Default'] = null;
break;
case 'USER_DEFINED' :
$row['Default'] = $row['DefaultValue'];
break;
case 'NULL' :
case 'CURRENT_TIMESTAMP' :
$row['Default'] = $row['DefaultType'];
break;
case 'NONE' :
$row['Default'] = null;
break;
case 'USER_DEFINED' :
$row['Default'] = $row['DefaultValue'];
break;
case 'NULL' :
case 'CURRENT_TIMESTAMP' :
$row['Default'] = $row['DefaultType'];
break;
}
$row['Extra'] = (isset($_REQUEST['field_extra'][$i]) ? $_REQUEST['field_extra'][$i] : false);
@ -215,28 +215,30 @@ for ($i = 0; $i < $num_fields; $i++) {
} elseif (isset($fields_meta[$i])) {
$row = $fields_meta[$i];
switch ($row['Default']) {
case null:
if ($row['Null'] == 'YES') {
$row['DefaultType'] = 'NULL';
$row['DefaultValue'] = '';
// SHOW FULL COLUMNS does not report the case when there is a DEFAULT value
// which is empty so we need to use the results of SHOW CREATE TABLE
} elseif (isset($row) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_value'])) {
$row['DefaultType'] = 'USER_DEFINED';
$row['DefaultValue'] = $row['Default'];
} else {
$row['DefaultType'] = 'NONE';
$row['DefaultValue'] = '';
}
break;
case 'CURRENT_TIMESTAMP':
$row['DefaultType'] = 'CURRENT_TIMESTAMP';
case null:
if ($row['Null'] == 'YES') {
$row['DefaultType'] = 'NULL';
$row['DefaultValue'] = '';
break;
default:
// SHOW FULL COLUMNS does not report the case when there is a DEFAULT value
// which is empty so we need to use the results of SHOW CREATE TABLE
} elseif (isset($row)
&& isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_value'])
) {
$row['DefaultType'] = 'USER_DEFINED';
$row['DefaultValue'] = $row['Default'];
break;
} else {
$row['DefaultType'] = 'NONE';
$row['DefaultValue'] = '';
}
break;
case 'CURRENT_TIMESTAMP':
$row['DefaultType'] = 'CURRENT_TIMESTAMP';
$row['DefaultValue'] = '';
break;
default:
$row['DefaultType'] = 'USER_DEFINED';
$row['DefaultValue'] = $row['Default'];
break;
}
}
@ -521,26 +523,26 @@ for ($i = 0; $i < $num_fields; $i++) {
. ' name="field_move_to[' . $i . ']" size="1" width="5em">'
. '<option value="" selected="selected">&nbsp;</option>';
// find index of current column
$current_index = 0;
for ($mi = 0, $cols = count($move_columns); $mi < $cols; $mi++) {
if ($move_columns[$mi]->name == $row['Field']) {
$current_index = $mi;
break;
}
// find index of current column
$current_index = 0;
for ($mi = 0, $cols = count($move_columns); $mi < $cols; $mi++) {
if ($move_columns[$mi]->name == $row['Field']) {
$current_index = $mi;
break;
}
$content_cells[$i][$ci] .= '<option value="-first"'
. ($current_index == 0 ? ' disabled="disabled"' : '')
. '>' . __('first') . '</option>';
}
$content_cells[$i][$ci] .= '<option value="-first"'
. ($current_index == 0 ? ' disabled="disabled"' : '')
. '>' . __('first') . '</option>';
for ($mi = 0, $cols = count($move_columns); $mi < $cols; $mi++) {
$content_cells[$i][$ci] .=
'<option value="' . $move_columns[$mi]->name . '"'
. (($current_index == $mi || $current_index == $mi + 1) ? ' disabled="disabled"' : '')
.'>' . sprintf(__('after %s'), PMA_backquote($move_columns[$mi]->name)) . '</option>';
}
for ($mi = 0, $cols = count($move_columns); $mi < $cols; $mi++) {
$content_cells[$i][$ci] .=
'<option value="' . $move_columns[$mi]->name . '"'
. (($current_index == $mi || $current_index == $mi + 1) ? ' disabled="disabled"' : '')
.'>' . sprintf(__('after %s'), PMA_backquote($move_columns[$mi]->name)) . '</option>';
}
$content_cells[$i][$ci] .= '</select>';
$content_cells[$i][$ci] .= '</select>';
$ci++;
}