From 8c28a121bf02fb15e9986bc052a573302e3b873c Mon Sep 17 00:00:00 2001 From: Marcello Coutinho Date: Mon, 27 May 2013 19:17:11 -0300 Subject: widescreen - revert git mv from previous commit --- config/widescreen/bin/index.php_ | 775 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 775 insertions(+) create mode 100644 config/widescreen/bin/index.php_ (limited to 'config/widescreen/bin/index.php_') diff --git a/config/widescreen/bin/index.php_ b/config/widescreen/bin/index.php_ new file mode 100644 index 00000000..a6ad1019 --- /dev/null +++ b/config/widescreen/bin/index.php_ @@ -0,0 +1,775 @@ +. + 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. +*/ +/* + pfSense_BUILDER_BINARIES: /sbin/ifconfig + pfSense_MODULE: interfaces +*/ + +##|+PRIV +##|*IDENT=page-system-login/logout +##|*NAME=System: Login / Logout page / Dashboard +##|*DESCR=Allow access to the 'System: Login / Logout' page and Dashboard. +##|*MATCH=index.php* +##|-PRIV + +// Turn on buffering to speed up rendering +ini_set('output_buffering','true'); + +// Start buffering with a cache size of 100000 +ob_start(null, "1000"); + +## Load Essential Includes +require_once('functions.inc'); +require_once('guiconfig.inc'); +require_once('notices.inc'); + +##build list of widgets +$directory = "/usr/local/www/widgets/widgets/"; +$dirhandle = opendir($directory); +$filename = ""; +$widgetnames = array(); +$widgetfiles = array(); +$widgetlist = array(); + +while (false !== ($filename = readdir($dirhandle))) { + $periodpos = strpos($filename, "."); + $widgetname = substr($filename, 0, $periodpos); + $widgetnames[] = $widgetname; + if ($widgetname != "system_information") + $widgetfiles[] = $filename; +} + +##sort widgets alphabetically +sort($widgetfiles); + +##insert the system information widget as first, so as to be displayed first +array_unshift($widgetfiles, "system_information.widget.php"); + +##if no config entry found, initialize config entry +if (!is_array($config['widgets'])) { + $config['widgets'] = array(); +} + + if ($_POST && $_POST['submit']) { + $config['widgets']['sequence'] = $_POST['sequence']; + + foreach ($widgetnames as $widget){ + if ($_POST[$widget . '-config']){ + $config['widgets'][$widget . '-config'] = $_POST[$widget . '-config']; + } + } + + write_config(gettext("Widget configuration has been changed.")); + header("Location: index.php"); + exit; + } + + ## Load Functions Files + require_once('includes/functions.inc.php'); + + ## 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'); + conf_mount_ro(); + if($g['platform'] == "pfSense" || $g['platform'] == "nanobsd") { + 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')) { + echo << + + + {$g['product_name']}.localdomain - {$g['product_name']} first time setup + + + + + +EOF; + + echo "\n"; + + if(file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css")) + echo "\n"; + else + echo ""; + + echo "
\n"; + echo "
\n"; + echo "

\n"; + echo "

\n"; + echo sprintf(gettext("Welcome to %s!\n"),$g['product_name']) . "

"; + echo gettext("One moment while we start the initial setup wizard.") . "

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

\n"; + echo sprintf(gettext("To bypass the wizard, click on the %s logo on the initial page."),$g['product_name']) . "\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) or preg_match("/.*(VIA Padlock)/", $dmesgl, $matches) or preg_match("/^safe.: (\w.*)/", $dmesgl, $matches) or preg_match("/^ubsec.: (.*?),/", $dmesgl, $matches) or preg_match("/^padlock.: <(.*?)>,/", $dmesgl, $matches) or preg_match("/^glxsb.: (.*?),/", $dmesgl, $matches)) { + $hwcrypto = $matches[1]; + break; + } + } + fclose($fd); + } + +##build widget saved list information +if ($config['widgets'] && $config['widgets']['sequence'] != "") { + $pconfig['sequence'] = $config['widgets']['sequence']; + $widgetlist = $pconfig['sequence']; + $colpos = array(); + $savedwidgetfiles = array(); + $widgetname = ""; + $widgetlist = explode(",",$widgetlist); + + ##read the widget position and display information + 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"; + } + + ##add widgets that may not be in the saved configuration, in case they are to be displayed later + foreach ($widgetfiles as $defaultwidgets){ + if (!in_array($defaultwidgets, $savedwidgetfiles)){ + $savedwidgetfiles[] = $defaultwidgets; + } + } + + ##find custom configurations of a particular widget and load its info to $pconfig + foreach ($widgetnames as $widget){ + if ($config['widgets'][$widget . '-config']){ + $pconfig[$widget . '-config'] = $config['widgets'][$widget . '-config']; + } + } + + $widgetlist = $savedwidgetfiles; +} else{ + // no saved widget sequence found, build default list. + $widgetlist = $widgetfiles; +} + +##build list of php include files +$phpincludefiles = array(); +$directory = "/usr/local/www/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); +} + +##begin AJAX +$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 addWidget(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 configureWidget(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 showWidget(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 minimizeWidget(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 closeWidget(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(sprintf(gettext("%s Dashboard"), $g['product_name'])); +include("head.inc"); + +echo "\t\n"; +echo "\t\n"; +echo "\t\n"; +echo "\t\n"; + +?> + + + + + +

"; +?> + + + + + +<?=gettext(" style="cursor: pointer;" onmouseup="domTT_activate(this, event, 'content', document.getElementById('content1'), 'type', 'velcro', 'delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" /> + +<?=gettext(" style="cursor: help;" onmouseup="hideAllWidgets();domTT_activate(this, event, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" /> + + +    + " /> +

+ +
+ + + + + + +
+
+ +
+
+ + + + + + + + + +
+
+ +
+
+
+
+
+
+ +
+
+
+ <?=gettext(..."> +
+
+
+
+ +
+
+
+ + +
+
+ + + + + + + +\n"; + } +?> +
+ + -- cgit v1.2.3