diff --git a/usr/local/www/system_firmware.php b/usr/local/www/system_firmware.php index 3434301177..1f1a37abc2 100755 --- a/usr/local/www/system_firmware.php +++ b/usr/local/www/system_firmware.php @@ -38,19 +38,20 @@ ##|*MATCH=system_firmware.php* ##|-PRIV - $d_isfwfile = 1; require_once("guiconfig.inc"); $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']; + /* if upgrade in progress, alert user */ if(file_exists($d_firmwarelock_path)) { $pgtitle = array("System","Firmware","Manual Update"); @@ -155,13 +156,14 @@ $pgtitle = array("Diagnostics","Firmware"); include("head.inc"); ?> -
+ + "") print_info_box($fwinfo); ?> - diff --git a/usr/local/www/upload_progress.php b/usr/local/www/upload_progress.php new file mode 100644 index 0000000000..8642a791f2 --- /dev/null +++ b/usr/local/www/upload_progress.php @@ -0,0 +1,143 @@ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +/* DISABLE_PHP_LINT_CHECKING */ + +##|+PRIV +##|*IDENT=page-upload_progress +##|*NAME=System: Firmware: Manual Update page (progress bar) +##|*DESCR=Allow access to the 'System: Firmware: Manual Update: Progress bar' page. +##|*MATCH=upload_progress* +##|-PRIV + +include("guiconfig.inc"); + +// sanitize the ID value +$id = $_REQUEST['uploadid']; +if (strlen($id) == 0) { + echo "Invalid uploadid#."; + 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); + +// 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 (!$ret) { + + if ( array_key_exists( "e", $_GET ) ) { + echo "Invalid Meter ID! {$_REQUEST['uploadid]}"; + echo (''); + exit; + } else { + echo (''); + exit; + } + +} else { + + if ($ret['percent'] > "99") { + + echo (' UPLOAD completed!'); + + } else { + +?> + + + + +|
+ +
+
|
+