diff options
author | jim-p <jim@pingle.org> | 2010-05-06 12:46:58 -0400 |
---|---|---|
committer | jim-p <jim@pingle.org> | 2010-05-06 12:52:44 -0400 |
commit | acc5dd59f9c5f60ae67e135376506e9c9f70c154 (patch) | |
tree | 9a85eb55ae17940efb5f5e739db60c5701af335c /usr/local/www/index.php | |
parent | a669395c5f661487dca4469c295235988449e97b (diff) | |
download | pfsense-acc5dd59f9c5f60ae67e135376506e9c9f70c154.zip pfsense-acc5dd59f9c5f60ae67e135376506e9c9f70c154.tar.gz |
Fix widget settings in general. Initialize widget list before use. Fixes #285.
Diffstat (limited to 'usr/local/www/index.php')
-rwxr-xr-x | usr/local/www/index.php | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/usr/local/www/index.php b/usr/local/www/index.php index ffc9a4d..4125b51 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -42,16 +42,43 @@ ##|*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"); +// 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'); +## 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']; @@ -146,32 +173,6 @@ EOF; fclose($fd); } -##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(); -} - ##build widget saved list information if ($config['widgets'] && $config['widgets']['sequence'] != "") { $pconfig['sequence'] = $config['widgets']['sequence']; |