Permalink
Browse files

coding style : control structures

  • Loading branch information...
1 parent 90bd765 commit f62c4a1809458008c778afac98e481f54def216b @ruleant ruleant committed Nov 24, 2011
View
@@ -93,7 +93,7 @@
// Remove a value, given a valid index, from the list
// of values, if there was a request to do so.
if (isset($_GET['drop']) && is_array($_GET['drop'])) {
- foreach ($_GET['drop'] as $index => $value){
+ foreach ($_GET['drop'] as $index => $value) {
if ((int)$index == $index
&& $index > 0
&& $index <= count($values)
View
@@ -208,8 +208,8 @@ function PMA_addRecentTable($db, $table)
* Sets a variable to remember headers have been sent
*/
$GLOBALS['is_header_sent'] = true;
-} //end if (!$GLOBALS['is_ajax_request'])
-else {
+//end if (!$GLOBALS['is_ajax_request'])
+} else {
if (empty($GLOBALS['is_header_sent'])) {
include_once './libraries/header_http.inc.php';
$GLOBALS['is_header_sent'] = true;
@@ -64,7 +64,7 @@
parent.document.title = '<?php echo (isset($title) ? PMA_sanitize(PMA_escapeJsString(htmlspecialchars($title))) : ''); ?>';
}
<?php
-if(count($GLOBALS['js_script']) > 0) {
+if (count($GLOBALS['js_script']) > 0) {
echo implode("\n", $GLOBALS['js_script'])."\n";
}
View
@@ -106,7 +106,7 @@
// free memory
unset($data);
// Do not parse string when we're not at the end and don't have ; inside
- if ((strpos($buffer, $sql_delimiter, $i) === false) && !$GLOBALS['finished']) {
+ if ((strpos($buffer, $sql_delimiter, $i) === false) && !$GLOBALS['finished']) {
continue;
}
}
@@ -262,8 +262,7 @@
<button type="submit" name="mult_btn" value="<?php echo __('Yes'); ?>" id="buttonYes"><?php echo __('Submit'); ?></button>
</fieldset>
<?php
- }
- elseif ($what == 'add_prefix_tbl') { ?>
+ } elseif ($what == 'add_prefix_tbl') { ?>
<fieldset class = "input">
<legend><?php echo __('Add table prefix') ?>:</legend>
<table>
@@ -276,8 +275,7 @@
<button type="submit" name="mult_btn" value="<?php echo __('Yes'); ?>" id="buttonYes"><?php echo __('Submit'); ?></button>
</fieldset>
<?php
- }
- else { ?>
+ } else { ?>
<fieldset class="confirmation">
<legend><?php echo ($what == 'drop_db' ? __('You are about to DESTROY a complete database!') . '&nbsp;' : '') . __('Do you really want to '); ?>:</legend>
<tt><?php echo $full_query; ?></tt>
@@ -290,14 +288,10 @@
}
include './libraries/footer.inc.php';
-} // end if
-
-
+} elseif ($mult_btn == __('Yes')) {
/**
* Executes the query - dropping rows, columns/fields, tables or dbs
*/
-elseif ($mult_btn == __('Yes')) {
-
if ($query_type == 'drop_db' || $query_type == 'drop_tbl' || $query_type == 'drop_fld') {
include_once './libraries/relation_cleanup.lib.php';
}
@@ -118,13 +118,13 @@ private function _handleOptions()
{
$this->_dataPoints = array();
if (! is_null($this->_userSpecifiedSettings)) {
- foreach (array_keys($this->_userSpecifiedSettings) as $key){
- $this->_settings[$key] = $this->_userSpecifiedSettings[$key];
- }
+ foreach (array_keys($this->_userSpecifiedSettings) as $key) {
+ $this->_settings[$key] = $this->_userSpecifiedSettings[$key];
+ }
}
if ($this->_settings['dataLabel'] == '') {
$labels = array_keys($this->_data[0]);
- $this->_settings['dataLabel'] = $labels[0];
+ $this->_settings['dataLabel'] = $labels[0];
}
}
@@ -213,8 +213,7 @@ private function _scaleDataSet($data, $xField, $yField)
for ($j = 0 ; $j < count($coordinates[$i]) ; $j++) {
$coordinates[$i][$j] = $map[$coordinates[$i][$j]];
}
- }
- else if (is_numeric($coordinates[$i][0])) {
+ } else if (is_numeric($coordinates[$i][0])) {
$maxC = max($coordinates[$i]);
for ($j = 0 ; $j < count($coordinates[$i]) ; $j++) {
if ($i == 0) {
@@ -122,8 +122,7 @@
echo PMA_generate_html_tabs($tabs, $url_params);
unset($tabs);
-if (PMA_Tracker::isActive() and PMA_Tracker::isTracked($GLOBALS["db"], $GLOBALS["table"]))
-{
+if (PMA_Tracker::isActive() and PMA_Tracker::isTracked($GLOBALS["db"], $GLOBALS["table"])) {
$msg = PMA_Message::notice('<a href="tbl_tracking.php?'.$url_query.'">'.sprintf(__('Tracking of %s.%s is activated.'), htmlspecialchars($GLOBALS["db"]), htmlspecialchars($GLOBALS["table"])).'</a>');
$msg->display();
}
@@ -152,12 +152,11 @@ function PMA_getForeignFields_Values($foreigners, $foreignData, $field, $tbl_fie
$str .= '</select>' . "\n";
} elseif ($foreignData['foreign_link'] == true) {
- if(isset($fields[$i]) && is_string($fields[$i])){
+ if (isset($fields[$i]) && is_string($fields[$i])) {
$str .= '<input type="text" id="fieldID_' . $i .'"name="fields[' . $i . ']" value="' . $fields[$i] . '"';
'id="field_' . md5($field) . '[' . $i .']"
class="textfield"/>' ;
- }
- else{
+ } else {
$str .= '<input type="text" id="fieldID_' . $i .'"name="fields[' . $i . ']"';
'id="field_' . md5($field) . '[' . $i .']"
class="textfield" />' ;
View
@@ -43,8 +43,7 @@ function PMA_exitNavigationFrame()
if (isset($_REQUEST['pos'])) {
if (isset($_REQUEST['tpos'])) {
$_SESSION['tmp_user_values']['table_limit_offset'] = (int) $_REQUEST['pos'];
- }
- else {
+ } else {
$_SESSION['tmp_user_values']['navi_limit_offset'] = (int) $_REQUEST['pos'];
}
}
View
@@ -85,7 +85,7 @@
echo '<p>' . __('Page') . ':';
echo '<select name="pdf_page_number">';
- while($page = PMA_DBI_fetch_assoc($table_info_result)) {
+ while ($page = PMA_DBI_fetch_assoc($table_info_result)) {
echo '<option value="' . $page['page_nr'] . '">';
echo htmlspecialchars($page['page_descr']);
echo '</option>';
View
@@ -181,8 +181,7 @@
}
}
- foreach ($replication_types as $type)
- {
+ foreach ($replication_types as $type) {
if ($type=="master")
$name = __('Master replication');
elseif ($type == "slave")
@@ -245,10 +244,10 @@
}
}
- foreach ($replication_types as $type)
- {
- if (${"server_{$type}_status"})
- echo ' <th></th>' . "\n";
+ foreach ($replication_types as $type) {
+ if (${"server_{$type}_status"}) {
+ echo ' <th></th>' . "\n";
+ {
}
if ($is_superuser) {
View
@@ -421,7 +421,7 @@
/* Files required for chart exporting */
$GLOBALS['js_include'][] = 'highcharts/exporting.js';
/* < IE 9 doesn't support canvas natively */
-if(PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
+if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
$GLOBALS['js_include'][] = 'canvg/flashcanvas.js';
}
$GLOBALS['js_include'][] = 'canvg/canvg.js';
@@ -671,7 +671,7 @@
}
}
-if(PMA_DRIZZLE) {
+if (PMA_DRIZZLE) {
$used_queries = PMA_DBI_fetch_result(
'SELECT * FROM data_dictionary.global_statements',
0,
@@ -1073,8 +1073,7 @@ function printServerTraffic()
<h3><a name="replication"></a><?php echo __('Replication status'); ?></h3>
<?php
- foreach ($replication_types as $type)
- {
+ foreach ($replication_types as $type) {
if (${"server_{$type}_status"}) {
PMA_replication_print_status_table($type);
}
View
@@ -777,10 +777,9 @@
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . str_replace('&amp;', '&', $goto) . '&message=' . urlencode($message));
} // end else
exit();
-} // end no rows returned
-
-// At least one row is returned -> displays a table with results
-else {
+// end no rows returned
+} else {
+ // At least one row is returned -> displays a table with results
//If we are retrieving the full value of a truncated field or the original
// value of a transformed field, show it here and exit
if ($GLOBALS['grid_edit'] == true && $GLOBALS['cfg']['AjaxEnable']) {
View
@@ -185,7 +185,7 @@
$message = PMA_Message::success(__('Table %1$s has been altered successfully'));
$message->addParam($table);
- if( $GLOBALS['is_ajax_request'] == true) {
+ if ( $GLOBALS['is_ajax_request'] == true) {
$extra_data['sql_query'] = PMA_showMessage(null, $sql_query);
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
}
View
@@ -803,9 +803,8 @@ class="textfield"
?>
</select>
<?php
- }
// We don't want binary data destroyed
- elseif ($field['is_binary'] || $field['is_blob']) {
+ } elseif ($field['is_binary'] || $field['is_blob']) {
if (($cfg['ProtectBinary'] && $field['is_blob'])
|| ($cfg['ProtectBinary'] == 'all' && $field['is_binary'])
) {
@@ -912,10 +911,9 @@ class="textfield" <?php echo $unnullify_trigger; ?>
echo ' </select>' . "\n";
}
} // end if (web-server upload directory)
- } // end elseif (binary or blob)
- elseif (in_array($field['pma_type'], $no_support_types)) {
+ // end elseif (binary or blob)
+ } elseif (! in_array($field['pma_type'], $no_support_types)) {
// ignore this column to avoid changing it
- } else {
if ($field['is_char']) {
$fieldsize = $extracted_fieldspec['spec_in_brackets'];
} else {
View
@@ -272,7 +272,7 @@
} elseif (! in_array($me_funcs[$key], $func_no_param)
|| ($val != "''" && in_array($me_funcs[$key], $func_optional_param))) {
$cur_value = $me_funcs[$key] . '(' . $val . ')';
- } else {
+ } else {
$cur_value = $me_funcs[$key] . '()';
}

0 comments on commit f62c4a1

Please sign in to comment.