code cleanup

This commit is contained in:
Marc Delisle
2009-12-30 13:46:17 +00:00
parent 078eedae6e
commit d63ed916fc
5 changed files with 42 additions and 42 deletions

View File

@@ -68,7 +68,7 @@ xmlns="http://www.w3.org/TR/REC-html40">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : $charset) .'" />
<meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : $charset) . '" />
</head>
<body>');
}
@@ -129,10 +129,10 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
{
global $what;
if (!PMA_exportOutputHandler('<h2>' . $GLOBALS['strDumpingData'] . ' ' . $table . '</h2>')) {
if (! PMA_exportOutputHandler('<h2>' . $GLOBALS['strDumpingData'] . ' ' . $table . '</h2>')) {
return FALSE;
}
if (!PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
if (! PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
return FALSE;
}
@@ -147,7 +147,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</b></td>';
} // end for
$schema_insert .= '</tr>';
if (!PMA_exportOutputHandler($schema_insert)) {
if (! PMA_exportOutputHandler($schema_insert)) {
return FALSE;
}
} // end if
@@ -156,7 +156,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
while ($row = PMA_DBI_fetch_row($result)) {
$schema_insert = '<tr class="print-category">';
for ($j = 0; $j < $fields_cnt; $j++) {
if (!isset($row[$j]) || is_null($row[$j])) {
if (! isset($row[$j]) || is_null($row[$j])) {
$value = $GLOBALS[$what . '_null'];
} elseif ($row[$j] == '0' || $row[$j] != '') {
$value = $row[$j];
@@ -166,12 +166,12 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
$schema_insert .= '<td class="print">' . htmlspecialchars($value) . '</td>';
} // end for
$schema_insert .= '</tr>';
if (!PMA_exportOutputHandler($schema_insert)) {
if (! PMA_exportOutputHandler($schema_insert)) {
return FALSE;
}
} // end while
PMA_DBI_free_result($result);
if (!PMA_exportOutputHandler('</table>')) {
if (! PMA_exportOutputHandler('</table>')) {
return FALSE;
}
@@ -182,7 +182,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
{
global $cfgRelation;
if (!PMA_exportOutputHandler('<h2>' . $GLOBALS['strTableStructure'] . ' ' .$table . '</h2>')) {
if (! PMA_exportOutputHandler('<h2>' . $GLOBALS['strTableStructure'] . ' ' .$table . '</h2>')) {
return FALSE;
}
@@ -208,7 +208,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$fields_cnt = PMA_DBI_num_rows($result);
// Check if we can use Relations (Mike Beck)
if ($do_relation && !empty($cfgRelation['relation'])) {
if ($do_relation && ! empty($cfgRelation['relation'])) {
// Find which tables are related with the current one and write it in
// an array
$res_rel = PMA_getForeigners($db, $table);
@@ -225,7 +225,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
/**
* Displays the table structure
*/
if (!PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
if (! PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
return FALSE;
}
@@ -258,7 +258,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
}
$schema_insert .= '</tr>';
if (!PMA_exportOutputHandler($schema_insert)) {
if (! PMA_exportOutputHandler($schema_insert)) {
return FALSE;
}
@@ -299,7 +299,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
if ($zerofill) {
$strAttribute = 'UNSIGNED ZEROFILL';
}
if (!isset($row['Default'])) {
if (! isset($row['Default'])) {
if ($row['Null'] != 'NO') {
$row['Default'] = 'NULL';
}
@@ -313,7 +313,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$fmt_pre = '<b>' . $fmt_pre;
$fmt_post = $fmt_post . '</b>';
}
if ($row['Key']=='PRI') {
if ($row['Key'] == 'PRI') {
$fmt_pre = '<i>' . $fmt_pre;
$fmt_post = $fmt_post . '</i>';
}
@@ -336,7 +336,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$schema_insert .= '</tr>';
if (!PMA_exportOutputHandler($schema_insert)) {
if (! PMA_exportOutputHandler($schema_insert)) {
return FALSE;
}
} // end while

View File

@@ -111,7 +111,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
global $mediawiki_export_struct;
global $mediawiki_export_data;
$result = PMA_DBI_fetch_result("SHOW COLUMNS FROM `".$db."`.`".$table."`");
$result = PMA_DBI_fetch_result("SHOW COLUMNS FROM `" . $db . "`.`" . $table . "`");
$row_cnt = count($result);
$output = "{| cellpadding=\"10\" cellspacing=\"0\" border=\"1\" style=\"text-align:center;\"\n";

View File

@@ -66,12 +66,12 @@ function PMA_exportFooter()
function PMA_exportHeader()
{
PMA_exportOutputHandler(
'<?php'.$GLOBALS['crlf']
. '/**'.$GLOBALS['crlf']
. ' * Export to PHP Array plugin for PHPMyAdmin'.$GLOBALS['crlf']
. ' * @author Geoffray Warnants'.$GLOBALS['crlf']
. ' * @version 0.2b'.$GLOBALS['crlf']
. ' */'.$GLOBALS['crlf'].$GLOBALS['crlf']
'<?php' . $GLOBALS['crlf']
. '/**' . $GLOBALS['crlf']
. ' * Export to PHP Array plugin for PHPMyAdmin' . $GLOBALS['crlf']
. ' * @author Geoffray Warnants' . $GLOBALS['crlf']
. ' * @version 0.2b' . $GLOBALS['crlf']
. ' */' . $GLOBALS['crlf'] . $GLOBALS['crlf']
);
return true;
}
@@ -87,7 +87,7 @@ function PMA_exportHeader()
*/
function PMA_exportDBHeader($db)
{
PMA_exportOutputHandler('//'.$GLOBALS['crlf'].'// Database "'.$db.'"'.$GLOBALS['crlf'].'//'.$GLOBALS['crlf']);
PMA_exportOutputHandler('//' . $GLOBALS['crlf'] . '// Database "' . $db . '"' . $GLOBALS['crlf'] . '//' . $GLOBALS['crlf']);
return true;
}
@@ -150,34 +150,34 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
// Output table name as comment if this is the first record of the table
if ($record_cnt == 1) {
$buffer .= $crlf.'// '.$db.'.'.$table.$crlf;
$buffer .= '$'.$table.' = array('.$crlf;
$buffer .= $crlf . '// ' . $db . '.' . $table . $crlf;
$buffer .= '$' . $table . ' = array(' . $crlf;
$buffer .= ' array(';
} else {
$buffer .= ','.$crlf.' array(';
$buffer .= ',' . $crlf . ' array(';
}
for ($i = 0; $i < $columns_cnt; $i++) {
$isLastLine = ($i+1 >= $columns_cnt);
$isLastLine = ($i + 1 >= $columns_cnt);
$column = $columns[$i];
if (is_null($record[$i])) {
$buffer .= "'".$column."'=>null".(!$isLastLine?',':'');
$buffer .= "'" . $column . "'=>null" . (! $isLastLine ? ',' : '');
} elseif (is_numeric($record[$i])) {
$buffer .= "'".$column."'=>".$record[$i] . (!$isLastLine?',':'');
$buffer .= "'" . $column . "'=>" . $record[$i] . (! $isLastLine ? ',' : '');
} else {
$buffer .= "'".$column."'=>'".addslashes($record[$i]) . "'" . (!$isLastLine?',':'');
$buffer .= "'" . $column . "'=>'" . addslashes($record[$i]) . "'" . (! $isLastLine ? ',' : '');
}
}
$buffer .= ')';
}
$buffer .= $crlf.');'.$crlf;
if (!PMA_exportOutputHandler($buffer)) {
$buffer .= $crlf . ');' . $crlf;
if (! PMA_exportOutputHandler($buffer)) {
return FALSE;
}

View File

@@ -127,7 +127,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
{
global $what;
if (!PMA_exportOutputHandler('== ' . $GLOBALS['strDumpingData'] . ' ' . $table . "\n\n")) {
if (! PMA_exportOutputHandler('== ' . $GLOBALS['strDumpingData'] . ' ' . $table . "\n\n")) {
return FALSE;
}
@@ -142,7 +142,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
$text_output .= '|' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i)));
} // end for
$text_output .= "\n|------\n";
if (!PMA_exportOutputHandler($text_output)) {
if (! PMA_exportOutputHandler($text_output)) {
return FALSE;
}
} // end if
@@ -151,7 +151,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
while ($row = PMA_DBI_fetch_row($result)) {
$text_output = '';
for ($j = 0; $j < $fields_cnt; $j++) {
if (!isset($row[$j]) || is_null($row[$j])) {
if (! isset($row[$j]) || is_null($row[$j])) {
$value = $GLOBALS[$what . '_null'];
} elseif ($row[$j] == '0' || $row[$j] != '') {
$value = $row[$j];
@@ -161,7 +161,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
$text_output .= '|' . htmlspecialchars($value);
} // end for
$text_output .= "\n";
if (!PMA_exportOutputHandler($text_output)) {
if (! PMA_exportOutputHandler($text_output)) {
return FALSE;
}
} // end while
@@ -174,7 +174,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
{
global $cfgRelation;
if (!PMA_exportOutputHandler('== ' . $GLOBALS['strTableStructure'] . ' ' .$table . "\n\n")) {
if (! PMA_exportOutputHandler('== ' . $GLOBALS['strTableStructure'] . ' ' .$table . "\n\n")) {
return FALSE;
}
@@ -200,7 +200,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$fields_cnt = PMA_DBI_num_rows($result);
// Check if we can use Relations (Mike Beck)
if ($do_relation && !empty($cfgRelation['relation'])) {
if ($do_relation && ! empty($cfgRelation['relation'])) {
// Find which tables are related with the current one and write it in
// an array
$res_rel = PMA_getForeigners($db, $table);
@@ -247,7 +247,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
}
$text_output .= "\n|------\n";
if (!PMA_exportOutputHandler($text_output)) {
if (! PMA_exportOutputHandler($text_output)) {
return FALSE;
}
@@ -288,7 +288,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
if ($zerofill) {
$strAttribute = 'UNSIGNED ZEROFILL';
}
if (!isset($row['Default'])) {
if (! isset($row['Default'])) {
if ($row['Null'] != 'NO') {
$row['Default'] = 'NULL';
}
@@ -325,7 +325,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$text_output .= "\n";
if (!PMA_exportOutputHandler($text_output)) {
if (! PMA_exportOutputHandler($text_output)) {
return FALSE;
}
} // end while

View File

@@ -174,7 +174,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
$buffer .= ' ' . $column . ': ' . $record[$i] . $crlf;
}
if (!PMA_exportOutputHandler($buffer)) {
if (! PMA_exportOutputHandler($buffer)) {
return FALSE;
}
}