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 = sprintf(gettext("%s has detected a crash report or programming bug. Click here for more information."), $g['product_name']);
$class = "warning";
}
}
}
##build list of php include files
$phpincludefiles = array();
$directory = "/usr/local/www/widgets/include/";
$dirhandle = opendir($directory);
$filename = "";
while (false !== ($filename = readdir($dirhandle))) {
if (!stristr($filename, ".inc")) {
continue;
}
$phpincludefiles[] = $filename;
}
## Include each widget include file.
## These define vars that specify the widget title and title link.
foreach ($phpincludefiles as $includename) {
if (file_exists($directory . $includename)) {
include($directory . $includename);
}
}
##build list of widgets
foreach (glob("/usr/local/www/widgets/widgets/*.widget.php") as $file) {
$name = basename($file, '.widget.php');
// Get the widget title that should be in a var defined in the widget's inc file.
$widgettitle = ${$name . '_title'};
if (empty(trim($widgettitle))) {
// Fall back to constructing a title from the file name of the widget.
$widgettitle = ucwords(str_replace('_', ' ', $name));
}
$widgets[ $name ] = array('name' => $widgettitle, 'display' => 'none');
}
##if no config entry found, initialize config entry
if (!is_array($config['widgets'])) {
$config['widgets'] = array();
}
if ($_POST && $_POST['sequence']) {
$config['widgets']['sequence'] = rtrim($_POST['sequence'], ',');
foreach ($widgets as $widgetname => $widgetconfig) {
if ($_POST[$widgetname . '-config']) {
$config['widgets'][$widgetname . '-config'] = $_POST[$widgetname . '-config'];
}
}
write_config(gettext("Widget configuration has been changed."));
header("Location: /");
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'] == $g['product_name'] || $g['platform'] == "nanobsd") {
## If the user has logged into webGUI quickly while the system is booting then do not redirect them to
## the package reinstall page. That is about to be done by the boot script anyway.
## The code in head.inc will put up a notice to the user.
if (!platform_booting()) {
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')) {
?>
=$g['product_name']?>.localdomain - =$g['product_name']?> first time setup
=sprintf(gettext("Welcome to %s!\n"), $g['product_name'])?>
=gettext("One moment while we start the initial setup wizard.")?>
=gettext("Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal GUI.")?>
=sprintf(gettext("To bypass the wizard, click on the %s logo on the initial page."), $g['product_name'])?>
,/", $dmesgl, $matches)
or preg_match("/^glxsb.: (.*?),/", $dmesgl, $matches)) {
$hwcrypto = $matches[1];
break;
}
}
fclose($fd);
if (!isset($hwcrypto) && get_single_sysctl("dev.aesni.0.%desc")) {
$hwcrypto = get_single_sysctl("dev.aesni.0.%desc");
}
}
##build widget saved list information
if ($config['widgets'] && $config['widgets']['sequence'] != "") {
$dashboardcolumns = isset($config['system']['webgui']['dashboardcolumns']) ? $config['system']['webgui']['dashboardcolumns'] : 2;
$pconfig['sequence'] = $config['widgets']['sequence'];
$widgetsfromconfig = array();
foreach (explode(',', $pconfig['sequence']) as $line) {
list($file, $col, $display) = explode(':', $line);
// be backwards compatible
// If the display column information is missing, we will assign a temporary
// column here. Next time the user saves the dashboard it will fix itself
if ($col == "") {
if ($file == "system_information") {
$col = "col1";
} else {
$col = "col2";
}
}
// Limit the column to the current dashboard columns.
if (substr($col, 3) > $dashboardcolumns) {
$col = "col" . $dashboardcolumns;
}
$offset = strpos($file, '-container');
if (false !== $offset) {
$file = substr($file, 0, $offset);
}
// Get the widget title that should be in a var defined in the widget's inc file.
$widgettitle = ${$file . '_title'};
if (empty(trim($widgettitle))) {
// Fall back to constructing a title from the file name of the widget.
$widgettitle = ucwords(str_replace('_', ' ', $file));
}
$widgetsfromconfig[ $file ] = array(
'name' => $widgettitle,
'col' => $col,
'display' => $display,
);
}
// add widgets that may not be in the saved configuration, in case they are to be displayed later
$widgets = $widgetsfromconfig + $widgets;
##find custom configurations of a particular widget and load its info to $pconfig
foreach ($widgets as $widgetname => $widgetconfig) {
if ($config['widgets'][$widgetname . '-config']) {
$pconfig[$widgetname . '-config'] = $config['widgets'][$widgetname . '-config'];
}
}
}
## Get the configured options for Show/Hide available widgets panel.
$dashboard_available_widgets_hidden = isset($config['system']['webgui']['dashboardavailablewidgetspanel']) ? false : true;
if ($dashboard_available_widgets_hidden) {
$panel_state = 'out';
$panel_body_state = 'in';
} else {
$panel_state = 'in';
$panel_body_state = 'out';
}
## Set Page Title and Include Header
$pgtitle = array(gettext("Status"), gettext("Dashboard"));
include("head.inc");
if ($savemsg) {
print_info_box($savemsg, $class);
}
pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard");
?>
=gettext("Available Widgets"); ?>
$widgetconfig):
if ($widgetconfig['display'] == 'none'):
?>
';
$columnWidgets = $widgetColumns['col'.$currentColumnNumber];
foreach ($columnWidgets as $widgetname => $widgetconfig) {
// Compose the widget title and include the title link if available
$widgetlink = ${$widgetname . '_title_link'};
if ((strlen($widgetlink) > 0)) {
$wtitle = ' ' . $widgetconfig['name'] . '';
} else {
$wtitle = $widgetconfig['name'];
}
?>