. 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. */ ## Load Essential Includes require_once('guiconfig.inc'); require_once('notices.inc'); ## Load Functions Files require_once('includes/functions.inc.php'); ## Load AJAX, Initiate Class ############################################### require_once('includes/sajax.class.php'); ## Initiate Class and Set location of ajax file containing ## the information that we need for this page. Also set functions ## that SAJAX will be using. $oSajax = new sajax(); $oSajax->sajax_remote_uri = 'sajax/index.sajax.php'; $oSajax->sajax_request_type = 'POST'; $oSajax->sajax_export("get_stats"); $oSajax->sajax_handle_client_request(); ############################################################################ ## Check to see if we have a swap space, ## if true, display, if false, hide it ... if(file_exists("/usr/sbin/swapinfo")) { $swapinfo = `/usr/sbin/swapinfo`; if(stristr($swapinfo,'%') == true) $showswap=true; } ## User recently restored his config. ## If packages are installed lets resync if(file_exists('/conf/needs_package_sync')) { if($config['installedpackages'] <> '') { conf_mount_rw(); unlink('/conf/needs_package_sync'); header('Location: pkg_mgr_install.php?mode=reinstallall'); exit; } } ## If it is the first time webConfigurator has been ## accessed since initial install show this stuff. if(file_exists('/conf/trigger_initial_wizard')) { $pgtitle = array("{$g['product_name']} first time setup"); include('head.inc'); echo "\n"; echo "
\n"; echo "
\n"; echo "

\n"; echo "

\n"; echo "Welcome to {$g['product_name']}!

\n"; echo "One moment while we start the initial setup wizard.

\n"; echo "Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal GUI.

\n"; echo "To bypass the wizard, click on the {$g['product_name']} logo on the initial page.\n"; echo "

\n"; echo "\n"; echo "\n"; exit; } ## Find out whether there's hardware encryption or not unset($hwcrypto); $fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r"); if ($fd) { while (!feof($fd)) { $dmesgl = fgets($fd); if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches)) { $hwcrypto = $matches[1]; break; } } fclose($fd); } //build list of widgets $directory = "widgets/widgets/"; $dirhandle = opendir($directory); $filename = ""; $widgetnames = array (); $widgetfiles = array(); while (false !== ($filename = readdir($dirhandle))) { $periodpos = strpos($filename, "."); $widgetname = substr($filename, 0, $periodpos); $widgetnames[] = $widgetname; if ($widgetname != "system_information") $widgetfiles[] = $filename; } sort($widgetfiles); array_unshift($widgetfiles, "system_information.widget.php"); if (!is_array($config['widgets'])) { $config['widgets'] = array(); } $pconfig['sequence'] = $config['widgets']['sequence']; if ($_POST){ $config['widgets']['sequence'] = $_POST['sequence']; foreach ($widgetnames as $widget){ if ($_POST[$widget . '-config']){ $config['widgets'][$widget . '-config'] = $_POST[$widget . '-config']; } } write_config(); header("Location: index.php"); exit; } if ($config['widgets']) { $widgetlist = $pconfig['sequence']; $colpos = array(); $savedwidgetfiles = array(); $widgetname = ""; $widgetlist = explode(",",$widgetlist); foreach ($widgetlist as $widget){ $dashpos = strpos($widget, "-"); $widgetname = substr($widget, 0, $dashpos); $colposition = strpos($widget, ":"); $displayposition = strrpos($widget, ":"); $colpos[] = substr($widget,$colposition+1, $displayposition - $colposition-1); $displayarray[] = substr($widget,$displayposition+1); $savedwidgetfiles[] = $widgetname . ".widget.php"; } foreach ($widgetnames as $widget){ if ($config['widgets'][$widget . '-config']){ $pconfig[$widget . '-config'] = $config['widgets'][$widget . '-config']; } } } //build list of php include files $phpincludefiles = Array(); $directory = "widgets/include/"; $dirhandle = opendir($directory); $filename = ""; while (false !== ($filename = readdir($dirhandle))) { $phpincludefiles[] = $filename; } foreach($phpincludefiles as $includename) { if(!stristr($includename, ".inc")) continue; include($directory . $includename); } $jscriptstr = << function widgetAjax(widget) { uri = "widgets/widgets/" + widget + ".widget.php"; var opt = { // Use GET method: 'get', evalScripts: 'true', asynchronous: true, // Handle 404 on404: function(t) { alert('Error 404: location "' + t.statusText + '" was not found.'); }, // Handle other errors onFailure: function(t) { alert('Error ' + t.status + ' -- ' + t.statusText); }, onSuccess: function(t) { widget2 = widget + "-loader"; Effect.Fade(widget2, {queue:'front'}); Effect.Appear(widget, {queue:'end'}); } } new Ajax.Updater(widget, uri, opt); } function addDiv(selectedDiv){ selectedDiv2 = selectedDiv + "-container"; d = document; textlink = d.getElementById(selectedDiv2); Effect.Appear(selectedDiv2, {duration:1}); if (textlink.style.display != "none") { Effect.Shake(selectedDiv2); } else { widgetAjax(selectedDiv); selectIntLink = selectedDiv2 + "-input"; textlink = d.getElementById(selectIntLink); textlink.value = "show"; showSave(); } } function configureDiv(selectedDiv){ selectIntLink = selectedDiv + "-settings"; d = document; textlink = d.getElementById(selectIntLink); if (textlink.style.display == "none") Effect.BlindDown(selectIntLink, {duration:1}); else Effect.BlindUp(selectIntLink, {duration:1}); } function showDiv(selectedDiv,swapButtons){ //appear element Effect.BlindDown(selectedDiv, {duration:1}); showSave(); d = document; if (swapButtons){ selectIntLink = selectedDiv + "-min"; textlink = d.getElementById(selectIntLink); textlink.style.display = "inline"; selectIntLink = selectedDiv + "-open"; textlink = d.getElementById(selectIntLink); textlink.style.display = "none"; } selectIntLink = selectedDiv + "-container-input"; textlink = d.getElementById(selectIntLink); textlink.value = "show"; } function minimizeDiv(selectedDiv,swapButtons){ //fade element Effect.BlindUp(selectedDiv, {duration:1}); showSave(); d = document; if (swapButtons){ selectIntLink = selectedDiv + "-open"; textlink = d.getElementById(selectIntLink); textlink.style.display = "inline"; selectIntLink = selectedDiv + "-min"; textlink = d.getElementById(selectIntLink); textlink.style.display = "none"; } selectIntLink = selectedDiv + "-container-input"; textlink = d.getElementById(selectIntLink); textlink.value = "hide"; } function closeDiv(selectedDiv){ showSave(); selectedDiv = selectedDiv + "-container"; Effect.Fade(selectedDiv, {duration:1}); d = document; selectIntLink = selectedDiv + "-input"; textlink = d.getElementById(selectIntLink); textlink.value = "close"; } function showSave(){ d = document; selectIntLink = "submit"; textlink = d.getElementById(selectIntLink); textlink.style.display = "inline"; } function updatePref(){ var widgets = document.getElementsByClassName('widgetdiv'); var widgetSequence = ""; var firstprint = false; d = document; for (i=0; i EOD; $closehead = false; ## Set Page Title and Include Header $pgtitle = array("{$g['product_name']} Dashboard"); include("head.inc"); echo ""; echo ""; echo ""; echo ""; ?>

"; ?> Click here to add widgets Click here for help    

= $halftotal && $printed == false){ $printed = true; ?>

Loading selected widget...