code cleanup

This commit is contained in:
Marc Delisle
2009-12-30 13:28:30 +00:00
parent 912da56db4
commit 078eedae6e
3 changed files with 58 additions and 50 deletions

View File

@@ -6,7 +6,7 @@
* @package phpMyAdmin
*/
if (!defined('PHPMYADMIN')) {
if (! defined('PHPMYADMIN')) {
exit;
}
@@ -16,9 +16,10 @@ function PMA_getUploadStatus($id) {
global $SESSION_KEY;
global $ID_KEY;
if (trim($id)=="")
if (trim($id) == "") {
return;
if (!array_key_exists($id, $_SESSION[$SESSION_KEY])) {
}
if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
$_SESSION[$SESSION_KEY][$id] = array(
'id' => $id,
'finished' => false,
@@ -30,8 +31,9 @@ function PMA_getUploadStatus($id) {
}
$ret = $_SESSION[$SESSION_KEY][$id];
if (!PMA_import_apcCheck() || $ret['finished'])
if (! PMA_import_apcCheck() || $ret['finished']) {
return $ret;
}
$status = apc_fetch('upload_' . $id);
if ($status) {
@@ -39,11 +41,13 @@ function PMA_getUploadStatus($id) {
$ret['total'] = $status['total'];
$ret['complete'] = $status['current'];
if ($ret['total'] > 0)
if ($ret['total'] > 0) {
$ret['percent'] = $ret['complete'] / $ret['total'] * 100;
}
if ($ret['percent']==100)
$ret['finished']=(bool)true;
if ($ret['percent'] == 100) {
$ret['finished'] = (bool)true;
}
$_SESSION[$SESSION_KEY][$id] = $ret;
}

View File

@@ -6,7 +6,7 @@
* @package phpMyAdmin
*/
if (!defined('PHPMYADMIN')) {
if (! defined('PHPMYADMIN')) {
exit;
}
@@ -16,9 +16,10 @@ function PMA_getUploadStatus($id) {
global $SESSION_KEY;
global $ID_KEY;
if (trim($id)=="")
if (trim($id) == "") {
return;
if (!array_key_exists($id, $_SESSION[$SESSION_KEY])) {
}
if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
$_SESSION[$SESSION_KEY][$id] = array(
'id' => $id,
'finished' => false,
@@ -32,5 +33,4 @@ function PMA_getUploadStatus($id) {
return $ret;
}
?>

View File

@@ -5,7 +5,7 @@
* @version $Id$
* @package phpMyAdmin
*/
if (!defined('PHPMYADMIN')) {
if (! defined('PHPMYADMIN')) {
exit;
}
@@ -15,10 +15,11 @@ function PMA_getUploadStatus($id) {
global $SESSION_KEY;
global $ID_KEY;
if (trim($id)=="")
if (trim($id) == "") {
return;
}
if (!array_key_exists($id, $_SESSION[$SESSION_KEY])) {
if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
$_SESSION[$SESSION_KEY][$id] = array(
'id' => $id,
'finished' => false,
@@ -30,21 +31,24 @@ function PMA_getUploadStatus($id) {
}
$ret = $_SESSION[$SESSION_KEY][$id];
if (!PMA_import_uploadprogressCheck() || $ret['finished'])
if (! PMA_import_uploadprogressCheck() || $ret['finished']) {
return $ret;
}
$status = uploadprogress_get_info($id);
if ($status) {
if ($status['bytes_uploaded']==$status['bytes_total'])
if ($status['bytes_uploaded'] == $status['bytes_total']) {
$ret['finished'] = true;
else
} else {
$ret['finished'] = false;
}
$ret['total'] = $status['bytes_total'];
$ret['complete'] = $status['bytes_uploaded'];
if ($ret['total'] > 0)
if ($ret['total'] > 0) {
$ret['percent'] = $ret['complete'] / $ret['total'] * 100;
}
} else {
$ret = array(
'id' => $id,