summaryrefslogtreecommitdiffstats
path: root/src/usr/local
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2016-06-28 09:01:31 +0930
committerChris Buechler <cmb@pfsense.org>2016-06-28 22:01:42 -0500
commit6dfb6b27d8320947fb07865ae5e2ebfa17c1e3fc (patch)
tree7d391fe718cb04ec61d0593c2568e87d5ebee1cb /src/usr/local
parente8019bcde8dc8db6349f93b963d41172a60f06f8 (diff)
downloadpfsense-6dfb6b27d8320947fb07865ae5e2ebfa17c1e3fc.zip
pfsense-6dfb6b27d8320947fb07865ae5e2ebfa17c1e3fc.tar.gz
Update include() to include_once()
For safety, use include_once() when including various "side" files. There are a couple of instances of include("guiconfig,inc") that I changes to use require_once() to be consistent with everywhere else. The remaining cases of include() are just (hundreds of) head.inc and footer.inc - those are only at the start/end of the ordinary top-level interactive PHP files. There is no nested interaction of those to think about, so that should be fine.
Diffstat (limited to 'src/usr/local')
-rw-r--r--src/usr/local/www/diag_routes.php2
-rw-r--r--src/usr/local/www/diag_sockets.php2
-rw-r--r--src/usr/local/www/guiconfig.inc6
-rw-r--r--src/usr/local/www/index.php4
-rw-r--r--src/usr/local/www/restart_httpd.php2
-rw-r--r--src/usr/local/www/shortcuts.inc4
6 files changed, 10 insertions, 10 deletions
diff --git a/src/usr/local/www/diag_routes.php b/src/usr/local/www/diag_routes.php
index 250c3f5..c68622d 100644
--- a/src/usr/local/www/diag_routes.php
+++ b/src/usr/local/www/diag_routes.php
@@ -60,7 +60,7 @@
##|*MATCH=diag_routes.php*
##|-PRIV
-include('guiconfig.inc');
+require_once('guiconfig.inc');
$limit = '100';
$filter = '';
diff --git a/src/usr/local/www/diag_sockets.php b/src/usr/local/www/diag_sockets.php
index d03a0f2..7547911 100644
--- a/src/usr/local/www/diag_sockets.php
+++ b/src/usr/local/www/diag_sockets.php
@@ -60,7 +60,7 @@
##|*MATCH=diag_sockets.php*
##|-PRIV
-include('guiconfig.inc');
+require_once('guiconfig.inc');
$pgtitle = array(gettext("Diagnostics"), gettext("Sockets"));
diff --git a/src/usr/local/www/guiconfig.inc b/src/usr/local/www/guiconfig.inc
index 578364b..53d82ec 100644
--- a/src/usr/local/www/guiconfig.inc
+++ b/src/usr/local/www/guiconfig.inc
@@ -817,7 +817,7 @@ function display_widget_tabs(& $tab_array) {
function outputJavaScriptFileInline($javascript) {
if (file_exists($javascript)) {
echo "\n<script type=\"text/javascript\">\n";
- include($javascript);
+ include_once($javascript);
echo "\n</script>\n";
} else {
echo "\n\n<!-- Could not locate file: {$javascript} -->\n\n";
@@ -829,7 +829,7 @@ function outputJavaScriptFileInline($javascript) {
function outputCSSPrintFileInline($css) {
if (file_exists($css)) {
echo "\n<style media=\"print\" type=\"text/css\">\n";
- include($css);
+ include_once($css);
echo "\n</style>\n";
} else {
echo "\n\n<!-- Could not locate file: {$css} -->\n\n";
@@ -840,7 +840,7 @@ function outputCSSPrintFileInline($css) {
function outputCSSFileInline($css) {
if (file_exists($css)) {
echo "\n<style type=\"text/css\">\n";
- include($css);
+ include_once($css);
echo "\n</style>\n";
} else {
echo "\n\n<!-- Could not locate file: {$css} -->\n\n";
diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php
index 1f2eac0..0cd459c 100644
--- a/src/usr/local/www/index.php
+++ b/src/usr/local/www/index.php
@@ -130,7 +130,7 @@ while (false !== ($filename = readdir($dirhandle))) {
## These define vars that specify the widget title and title link.
foreach ($phpincludefiles as $includename) {
if (file_exists($directory . $includename)) {
- include($directory . $includename);
+ include_once($directory . $includename);
}
}
@@ -425,7 +425,7 @@ foreach ($widgets as $widgetname => $widgetconfig) {
</h2>
</div>
<div id="widget-<?=$widgetname?>_panel-body" class="panel-body collapse<?=($widgetconfig['display'] == 'close' ? '' : ' in')?>">
- <?php include('/usr/local/www/widgets/widgets/'. $widgetname.'.widget.php'); ?>
+ <?php include_once('/usr/local/www/widgets/widgets/'. $widgetname.'.widget.php'); ?>
</div>
</div>
<?php
diff --git a/src/usr/local/www/restart_httpd.php b/src/usr/local/www/restart_httpd.php
index 394eed8..87143b0 100644
--- a/src/usr/local/www/restart_httpd.php
+++ b/src/usr/local/www/restart_httpd.php
@@ -68,7 +68,7 @@ include("head.inc");
?>
<form>
-<?php include("fbegin.inc"); ?>
+<?php include_once("fbegin.inc"); ?>
<?=gettext("Mounting file systems read/write");?>...
<?php flush(); sleep(1); conf_mount_rw(); ?>
diff --git a/src/usr/local/www/shortcuts.inc b/src/usr/local/www/shortcuts.inc
index a172616..db21e69 100644
--- a/src/usr/local/www/shortcuts.inc
+++ b/src/usr/local/www/shortcuts.inc
@@ -168,14 +168,14 @@ function get_shortcut_log_link($shortcut_section, $addspace = true) {
$dir_array = get_shortcut_files("/usr/local/www/shortcuts");
foreach ($dir_array as $file) {
if (!is_dir("/usr/local/www/shortcuts/{$file}") && stristr($file, ".inc")) {
- include("/usr/local/www/shortcuts/{$file}");
+ include_once("/usr/local/www/shortcuts/{$file}");
}
}
if (is_dir("/usr/local/pkg/shortcuts")) {
$dir_array = get_shortcut_files("/usr/local/pkg/shortcuts");
foreach ($dir_array as $file) {
if (!is_dir("/usr/local/pkg/shortcuts/{$file}") && stristr($file, ".inc")) {
- include("/usr/local/pkg/shortcuts/{$file}");
+ include_once("/usr/local/pkg/shortcuts/{$file}");
}
}
}
OpenPOWER on IntegriCloud