.
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 off csrf for the dashboard
$nocsrf = true;
// 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');
if(isset($_REQUEST['closenotice'])){
close_notice($_REQUEST['closenotice']);
echo get_menu_messages();
exit;
}
if ($_REQUEST['act'] == 'alias_info_popup' && !preg_match("/\D/",$_REQUEST['aliasid'])){
alias_info_popup($_REQUEST['aliasid']);
exit;
}
if($g['disablecrashreporter'] != true) {
// Check to see if we have a crash report
$x = 0;
if(file_exists("/tmp/PHP_errors.log")) {
$total = `/usr/bin/grep -vi warning /tmp/PHP_errors.log | /usr/bin/wc -l | /usr/bin/awk '{ print $1 }'`;
if($total > 0)
$x++;
}
$crash = glob("/var/crash/*");
$skip_files = array(".", "..", "minfree", "");
if(is_array($crash)) {
foreach($crash as $c) {
if (!in_array(basename($c), $skip_files))
$x++;
}
if($x > 0)
$savemsg = "{$g['product_name']} has detected a crash report or programming bug. Click here for more information.";
}
}
##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'] <> '' && is_array($config['installedpackages']['package'])) {
if($g['platform'] == "pfSense" || $g['platform'] == "nanobsd") {
header('Location: pkg_mgr_install.php?mode=reinstallall');
exit;
}
} else {
conf_mount_rw();
@unlink('/conf/needs_package_sync');
conf_mount_ro();
}
}
## If it is the first time webConfigurator has been
## accessed since initial install show this stuff.
if(file_exists('/conf/trigger_initial_wizard')) {
echo <<