From 8999038a6c5b85cd9efb1a6fbced532128ebf87a Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 24 Nov 2008 03:12:07 +0000 Subject: Switch back over to upload_progress_meter now that it is a freebsd port. --- usr/local/www/system_firmware.php | 22 ++++---- usr/local/www/upload_progress.php | 111 +++++++++++++++++++------------------- 2 files changed, 68 insertions(+), 65 deletions(-) diff --git a/usr/local/www/system_firmware.php b/usr/local/www/system_firmware.php index 1d07438..a6f6b20 100755 --- a/usr/local/www/system_firmware.php +++ b/usr/local/www/system_firmware.php @@ -46,11 +46,8 @@ $curcfg = $config['system']['firmware']; require_once("xmlrpc_client.inc"); /* Allow additional execution time 0 = no limit. */ -ini_set('max_execution_time', '3600'); -ini_set('max_input_time', '3600'); - -/* Construct an upload_id for this session */ -$upload_id = $_SERVER['REQUEST_TIME'] . $_SESSION['Username']; +ini_set('max_execution_time', '9999'); +ini_set('max_input_time', '9999'); /* if upgrade in progress, alert user */ if(file_exists($d_firmwarelock_path)) { @@ -212,13 +209,16 @@ print_info_box($sig_warning); -
+
-

- -
- +
+ + + Firmware image file:  

@@ -236,7 +236,7 @@ print_info_box($sig_warning); } } ?> - + You must reboot the system before you can upgrade the firmware. diff --git a/usr/local/www/upload_progress.php b/usr/local/www/upload_progress.php index 8642a79..7df83ff 100644 --- a/usr/local/www/upload_progress.php +++ b/usr/local/www/upload_progress.php @@ -39,57 +39,28 @@ include("guiconfig.inc"); // sanitize the ID value -$id = $_REQUEST['uploadid']; -if (strlen($id) == 0) { - echo "Invalid uploadid#."; +$id = $_SESSION['uploadid']; +if (!$id) { + echo "Invalid upload id#."; exit; } -// ensure the uploaded status data exists in the session -if (!array_key_exists($id, $_SESSION[self::SESSION_KEY])) { - $_SESSION[self::SESSION_KEY][$id] = array( - 'id' => $id, - 'finished' => false, - 'percent' => 0, - 'total' => 0, - 'complete' => 0 - ); -} - -// retrieve the data from the session so it can be updated and returned -$ret = $_SESSION[self::SESSION_KEY][$id]; - // retrieve the upload data from APC -$status = apc_fetch('upload_' . $id); +$info = uploadprogress_get_info($id); // false is returned if the data isn't found -if ($status) { - $ret['finished'] = (bool) $status['done']; - $ret['total'] = $status['total']; - $ret['complete'] = $status['current']; - // calculate the completed percentage - if ($ret['total'] > 0) - $ret['percent'] = $ret['complete'] / $ret['total'] * 100; - // write the changed data back to the session - $_SESSION[self::SESSION_KEY][$id] = $ret; -} +if (!$info) { -if (!$ret) { - - if ( array_key_exists( "e", $_GET ) ) { - echo "Invalid Meter ID! {$_REQUEST['uploadid]}"; - echo (''); - exit; - } else { - echo (''); - exit; - } + echo "Could not locate progress {$id}. Trying again..."; + echo ""; + exit; } else { - if ($ret['percent'] > "99") { + if (intval($info['percent']) > "99") { - echo (' UPLOAD completed!'); + //echo (' UPLOAD completed!'); + echo (' UPLOAD completed!'); } else { @@ -115,7 +86,10 @@ if (!$ret) {
- ");?> + "; + ?>
@@ -124,20 +98,49 @@ if (!$ret) {
- - - - + + + + - - - - - -
Uploaded:File Size: + Uploaded: + + + + + + File Size: + + + +
Completed:%
- - - + + + Completed: + + + + % + + + + Estimated: + + + + + + + + + + + + -- cgit v1.1