. * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ##|+PRIV ##|*IDENT=page-system-login-logout ##|*NAME=System: Login / Logout / 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('guiconfig.inc'); require_once('functions.inc'); require_once('notices.inc'); require_once("pkg-utils.inc"); if (isset($_POST['closenotice'])) { close_notice($_POST['closenotice']); sleep(1); exit; } if (isset($_REQUEST['closenotice'])) { close_notice($_REQUEST['closenotice']); sleep(1); } if ($g['disablecrashreporter'] != true) { // Check to see if we have a crash report $x = 0; if (file_exists("/tmp/PHP_errors.log")) { $total = `/bin/cat /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 = sprintf(gettext("%s has detected a crash report or programming bug."), $g['product_name']) . " "; if (isAllowedPage("/crash_reporter.php")) { $savemsg .= sprintf(gettext('Click %1$shere%2$s for more information.'), '', ''); } else { $savemsg .= sprintf(gettext("Contact a firewall administrator for more information.")); } $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_once($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 (!is_array($user_settings['widgets'])) { $user_settings['widgets'] = array(); } if ($_POST && $_POST['sequence']) { // Start with the user's widget settings. $widget_settings = $user_settings['widgets']; $widget_settings['sequence'] = rtrim($_POST['sequence'], ','); foreach ($widgets as $widgetname => $widgetconfig) { if ($_POST[$widgetname . '-config']) { $widget_settings[$widgetname . '-config'] = $_POST[$widgetname . '-config']; } } save_widget_settings($_SESSION['Username'], $widget_settings); 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 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 { @unlink('/conf/needs_package_sync'); } } ## If it is the first time webConfigurator has been ## accessed since initial install show this stuff. if (file_exists('/conf/trigger_initial_wizard')) { ?>
=gettext("One moment while the initial setup wizard starts.")?>
=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'])?>