Project

General

Profile

« Previous | Next » 

Revision 6dfb6b27

Added by Phil Davis almost 9 years ago

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.

View differences:

src/etc/inc/captiveportal.inc
2289 2289
			$message = 0;
2290 2290
		}
2291 2291

  
2292
		include("{$g['varetc_path']}/captiveportal-{$cpzone}-logout.html");
2292
		include_once("{$g['varetc_path']}/captiveportal-{$cpzone}-logout.html");
2293 2293

  
2294 2294
	} else {
2295 2295
		portal_reply_page($my_redirurl, "redir", "Just redirect the user.");
src/etc/inc/globals.inc
221 221

  
222 222
/* Include override values for the above if needed. If the file doesn't exist, don't try to load it. */
223 223
if (file_exists("/etc/inc/globals_override.inc")) {
224
	@include("globals_override.inc");
224
	@include_once("globals_override.inc");
225 225
}
226 226

  
227 227
/* Read all XML files in following dir and load menu entries */
src/etc/inc/pfsense-utils.inc
2733 2733
				continue;
2734 2734
			}
2735 2735
			// Include the extra handler
2736
			include("$nf");
2736
			include_once("$nf");
2737 2737
		}
2738 2738
	}
2739 2739
}
src/etc/inc/priv.inc
88 88
$dir_array = get_priv_files("/etc/inc/priv");
89 89
foreach ($dir_array as $file) {
90 90
	if (!is_dir("/etc/inc/priv/{$file}") && stristr($file, ".inc")) {
91
		include("/etc/inc/priv/{$file}");
91
		include_once("/etc/inc/priv/{$file}");
92 92
	}
93 93
}
94 94
if (is_dir("/usr/local/pkg/priv")) {
95 95
	$dir_array = get_priv_files("/usr/local/pkg/priv");
96 96
	foreach ($dir_array as $file) {
97 97
		if (!is_dir("/usr/local/pkg/priv/{$file}") && stristr($file, ".inc")) {
98
			include("/usr/local/pkg/priv/{$file}");
98
			include_once("/usr/local/pkg/priv/{$file}");
99 99
		}
100 100
	}
101 101
}
src/usr/local/www/diag_routes.php
60 60
##|*MATCH=diag_routes.php*
61 61
##|-PRIV
62 62

  
63
include('guiconfig.inc');
63
require_once('guiconfig.inc');
64 64

  
65 65
$limit = '100';
66 66
$filter = '';
src/usr/local/www/diag_sockets.php
60 60
##|*MATCH=diag_sockets.php*
61 61
##|-PRIV
62 62

  
63
include('guiconfig.inc');
63
require_once('guiconfig.inc');
64 64

  
65 65
$pgtitle = array(gettext("Diagnostics"), gettext("Sockets"));
66 66

  
src/usr/local/www/guiconfig.inc
817 817
function outputJavaScriptFileInline($javascript) {
818 818
	if (file_exists($javascript)) {
819 819
		echo "\n<script type=\"text/javascript\">\n";
820
		include($javascript);
820
		include_once($javascript);
821 821
		echo "\n</script>\n";
822 822
	} else {
823 823
		echo "\n\n<!-- Could not locate file:  {$javascript} -->\n\n";
......
829 829
function outputCSSPrintFileInline($css) {
830 830
	if (file_exists($css)) {
831 831
		echo "\n<style media=\"print\" type=\"text/css\">\n";
832
		include($css);
832
		include_once($css);
833 833
		echo "\n</style>\n";
834 834
	} else {
835 835
		echo "\n\n<!-- Could not locate file:  {$css} -->\n\n";
......
840 840
function outputCSSFileInline($css) {
841 841
	if (file_exists($css)) {
842 842
		echo "\n<style type=\"text/css\">\n";
843
		include($css);
843
		include_once($css);
844 844
		echo "\n</style>\n";
845 845
	} else {
846 846
		echo "\n\n<!-- Could not locate file:  {$css} -->\n\n";
src/usr/local/www/index.php
130 130
## These define vars that specify the widget title and title link.
131 131
foreach ($phpincludefiles as $includename) {
132 132
	if (file_exists($directory . $includename)) {
133
		include($directory . $includename);
133
		include_once($directory . $includename);
134 134
	}
135 135
}
136 136

  
......
425 425
						</h2>
426 426
					</div>
427 427
					<div id="widget-<?=$widgetname?>_panel-body" class="panel-body collapse<?=($widgetconfig['display'] == 'close' ? '' : ' in')?>">
428
						<?php include('/usr/local/www/widgets/widgets/'. $widgetname.'.widget.php'); ?>
428
						<?php include_once('/usr/local/www/widgets/widgets/'. $widgetname.'.widget.php'); ?>
429 429
					</div>
430 430
				</div>
431 431
				<?php
src/usr/local/www/restart_httpd.php
68 68
?>
69 69

  
70 70
<form>
71
<?php include("fbegin.inc"); ?>
71
<?php include_once("fbegin.inc"); ?>
72 72

  
73 73
<?=gettext("Mounting file systems read/write");?>...
74 74
<?php flush(); sleep(1); conf_mount_rw(); ?>
src/usr/local/www/shortcuts.inc
168 168
$dir_array = get_shortcut_files("/usr/local/www/shortcuts");
169 169
foreach ($dir_array as $file) {
170 170
	if (!is_dir("/usr/local/www/shortcuts/{$file}") && stristr($file, ".inc")) {
171
		include("/usr/local/www/shortcuts/{$file}");
171
		include_once("/usr/local/www/shortcuts/{$file}");
172 172
	}
173 173
}
174 174
if (is_dir("/usr/local/pkg/shortcuts")) {
175 175
	$dir_array = get_shortcut_files("/usr/local/pkg/shortcuts");
176 176
	foreach ($dir_array as $file) {
177 177
		if (!is_dir("/usr/local/pkg/shortcuts/{$file}") && stristr($file, ".inc")) {
178
			include("/usr/local/pkg/shortcuts/{$file}");
178
			include_once("/usr/local/pkg/shortcuts/{$file}");
179 179
		}
180 180
	}
181 181
}

Also available in: Unified diff