Project

General

Profile

Regression #13984 » patch_squidGuard.txt

Marcos M, 05/03/2023 11:43 PM

 
1
diff --git a/www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard.inc b/www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard.inc
2
index 0d637388f180ae340e104de0def747f05c906ab1..37f43f021a9fb7f6c7c8fd56bf1ebe8fa3cfc09e 100644
3
--- a/www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard.inc
4
+++ b/www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard.inc
5
@@ -97,7 +97,6 @@ sg_init(convert_pfxml_to_sgxml());
6
 # ==============================================================================
7
 function squidguard_validate(&$post, &$input_errors)
8
 {
9
-    global $config, $g;
10
     $submit = isset($_GET['submit']) ? $_GET['submit'] : $_POST['submit'];
11
 
12
     # check config if 'Apply'
13
@@ -340,9 +339,7 @@ function squidguard_resync() {
14
 # -----------------------------------------------------------------------------
15
 
16
 function squidguard_resync_acl() {
17
-    global $config; # !!! ORDER !!!
18
-
19
-    $conf = $config['installedpackages'][MODULE_ACL]['config'];
20
+    $conf = config_get_path('installedpackages/' . MODULE_ACL . '/config');
21
     $id = isset($_POST['id']) ? $_POST['id'] : $_GET['id'];
22
 
23
     # --- sources part ---
24
@@ -364,8 +361,8 @@ function squidguard_resync_acl() {
25
         $src_new = array_values($src_new); # make keys '0, 1, 2, ...'
26
 
27
         # renew config
28
-        unset ($config['installedpackages'][MODULE_ACL]['config']);
29
-        $config['installedpackages'][MODULE_ACL]['config'] = $src_new;
30
+        config_del_path('installedpackages/' . MODULE_ACL . '/config');
31
+        config_set_path('installedpackages/' . MODULE_ACL . '/config', $src_new);
32
         write_config('Update squidguardacl config');
33
 
34
         # renew global $squidguard_config
35
@@ -378,9 +375,7 @@ function squidguard_resync_acl() {
36
 # -----------------------------------------------------------------------------
37
 
38
 function squidguard_resync_dest() {
39
-	global $config; # !!! ORDER !!!
40
-
41
-	$conf = $config['installedpackages'][MODULE_DESTINATION]['config'];
42
+	$conf = config_get_path('installedpackages/' . MODULE_DESTINATION . '/config');
43
 	$id = isset($_POST['id']) ? $_POST['id'] : $_GET['id'];
44
 
45
 	# --- sources part ---
46
@@ -402,8 +397,8 @@ function squidguard_resync_dest() {
47
 		$src_new = array_values($src_new); # make keys '0, 1, 2, ...'
48
 
49
 		# renew config
50
-		unset ($config['installedpackages'][MODULE_DESTINATION]['config']);
51
-		$config['installedpackages'][MODULE_DESTINATION]['config'] = $src_new;
52
+		config_del_path('installedpackages/' . MODULE_DESTINATION . '/config');
53
+		config_set_path('installedpackages/' . MODULE_DESTINATION . '/config', $src_new);
54
 		write_config('Update squidguarddest config');
55
 
56
 		# renew global $squidguard_config
57
@@ -419,10 +414,9 @@ function squidguard_resync_dest() {
58
 # get_pkgconf/sgconf_items_list
59
 # -----------------------------------------------------------------------------
60
 function get_pkgconf_items_list($pkg_gui_name, $fieldname) {
61
-    global $config;
62
     $res = array();
63
 
64
-    $conf = $config['installedpackages'][$pkg_gui_name]['config'];
65
+    $conf = config_get_path("installedpackages/{$pkg_gui_name}/config");
66
     if (is_array($conf)) {
67
         foreach($conf as $cf) {
68
         	$res[] = $cf[$fieldname];
69
@@ -476,7 +470,6 @@ function squidguard_before_form(&$pkg) {
70
 # squidguard_before_form_acl
71
 # -----------------------------------------------------------------------------
72
 function squidguard_before_form_acl(&$pkg, $is_acl=true) {
73
-    global $g;
74
     global $squidguard_config;
75
 
76
     $current_id   = '';
77
@@ -673,7 +666,7 @@ function squidguard_before_form_acl(&$pkg, $is_acl=true) {
78
 # squidguard_before_form_dest
79
 # -----------------------------------------------------------------------------
80
 function squidguard_before_form_dest(&$pkg) {
81
-	global $g, $squidguard_config;
82
+	global $squidguard_config;
83
 	$destination_items = get_sgconf_items_list(F_DESTINATIONS, 'name');
84
 //var_dump($squidguard_config);
85
 	$i=0;
86
@@ -738,8 +731,6 @@ function make_grid_blacklist() {
87
 # make_grid_controls
88
 # -----------------------------------------------------------------------------
89
 function make_grid_controls($type, $items, $enable_overtime = true) {
90
-    global $g;
91
-
92
     $res = '';
93
     $tbl = '';
94
     $color = '';
95
@@ -1022,9 +1013,9 @@ EOF;
96
 function convert_pfxml_to_sgxml() {
97
 	capability_update_source();
98
 
99
-	global $config;
100
+	$conf = config_get_path('/');
101
 	$sgxml = array();
102
-	$pfxml = $config['installedpackages'][MODULE_GENERAL]['config'][0];
103
+	$pfxml = config_get_path('installedpackages/' . MODULE_GENERAL . '/config/0');
104
 
105
 	$sgxml[F_LOGDIR]           = SQUIDGUARD_LOGDIR;
106
 	$sgxml[F_DBHOME]           = SQUIDGUARD_DBHOME;
107
@@ -1041,12 +1032,12 @@ function convert_pfxml_to_sgxml() {
108
 	$sgxml[F_ENABLED]          = $pfxml[F_SQUIDGUARDENABLE];
109
 	$sgxml[F_BLACKLISTENABLED] = $pfxml[F_BLACKLIST];
110
 	$sgxml[F_BLACKLISTURL]     = $pfxml[F_BLACKLISTURL];
111
-	$sgxml[F_SOURCES]          = convert_pfxml_to_sgxml_source($config);
112
-	$sgxml[F_DESTINATIONS]     = convert_pfxml_to_sgxml_destination($config);
113
-	$sgxml[F_REWRITES]         = convert_pfxml_to_sgxml_rewrite($config);
114
-	$sgxml[F_TIMES]            = convert_pfxml_to_sgxml_time($config);
115
-	$sgxml[F_ACLS]             = convert_pfxml_to_sgxml_acl($config);
116
-	$sgxml[F_DEFAULT]          = convert_pfxml_to_sgxml_default($config);
117
+	$sgxml[F_SOURCES]          = convert_pfxml_to_sgxml_source($conf);
118
+	$sgxml[F_DESTINATIONS]     = convert_pfxml_to_sgxml_destination($conf);
119
+	$sgxml[F_REWRITES]         = convert_pfxml_to_sgxml_rewrite($conf);
120
+	$sgxml[F_TIMES]            = convert_pfxml_to_sgxml_time($conf);
121
+	$sgxml[F_ACLS]             = convert_pfxml_to_sgxml_acl($conf);
122
+	$sgxml[F_DEFAULT]          = convert_pfxml_to_sgxml_default($conf);
123
 
124
 	# url_rewrite_children options
125
 	$sgxml[F_REWRITE_CH]		= $pfxml['rewrite_children'];
126
@@ -1062,11 +1053,11 @@ function convert_pfxml_to_sgxml() {
127
 	$sgxml[F_ADV_BLANKIMG] = $pfxml['adv_blankimg']  == 'on' ? 'on' : 'off';
128
 
129
 	# other
130
-	$lanip = $config['interfaces']['lan']['ipaddr'];
131
+	$lanip = config_get_path('interfaces/lan/ipaddr');
132
 	$sgxml[F_CURRENT_LAN_IP] = $lanip;
133
 
134
 	# transparent
135
-	$squidxml = $config['installedpackages']['squid']['config'][0];
136
+	$squidxml = config_get_path('installedpackages/squid/config/0');
137
 	if($squidxml['transparent_proxy'] == 'on') {
138
 		$sgxml[F_SQUID_TRANSPARENT_MODE] = 'on';
139
 	} else {
140
@@ -1074,8 +1065,8 @@ function convert_pfxml_to_sgxml() {
141
 	}
142
 
143
 	# WebGUI
144
-	$sgxml[F_CURRENT_GUI_PORT]  = $config['system']['webgui']['port'];
145
-	$sgxml[F_CURRENT_GUI_PROTO] = $config['system']['webgui']['protocol'];
146
+	$sgxml[F_CURRENT_GUI_PORT]  = config_get_path('system/webgui/port');
147
+	$sgxml[F_CURRENT_GUI_PROTO] = config_get_path('system/webgui/protocol');
148
 
149
 	# store cfg cache
150
 	$cfg_xml = dump_xml_config($sgxml, F_SQUIDGUARD);
151
@@ -1098,7 +1089,7 @@ function convert_pfxml_to_sgxml() {
152
 function convert_pfxml_to_sgxml_source($pfconfig) {
153
     $sgxml = array();
154
     $sgxml[F_ITEM] = array();
155
-    $pfxml = $pfconfig['installedpackages'][MODULE_ACL]['config'];
156
+    $pfxml = array_get_path($pfconfig, 'installedpackages/' . MODULE_ACL . '/config');
157
 
158
 	if (is_array($pfxml)) {
159
 		foreach($pfxml as $pfx) {
160
@@ -1121,7 +1112,7 @@ function convert_pfxml_to_sgxml_source($pfconfig) {
161
 function convert_pfxml_to_sgxml_destination($pfconfig) {
162
     $sgxml = array();
163
     $sgxml[F_ITEM] = array();
164
-    $pfxml = $pfconfig['installedpackages'][MODULE_DESTINATION]['config'];
165
+    $pfxml = array_get_path($pfconfig, 'installedpackages/' . MODULE_DESTINATION . '/config');
166
 
167
     if (is_array($pfxml)) {
168
         foreach($pfxml as $pfx) {
169
@@ -1147,7 +1138,7 @@ function convert_pfxml_to_sgxml_destination($pfconfig) {
170
 function convert_pfxml_to_sgxml_rewrite($pfconfig) {
171
     $sgxml = array();
172
 
173
-    $pfxml = $pfconfig['installedpackages'][MODULE_REWRITE]['config'];
174
+    $pfxml = array_get_path($pfconfig, 'installedpackages/' . MODULE_REWRITE . '/config');
175
     if (!is_array($pfxml)) {
176
     	$pfxml = array();
177
     }
178
@@ -1190,7 +1181,7 @@ function convert_pfxml_to_sgxml_rewrite($pfconfig) {
179
 function convert_pfxml_to_sgxml_time($pfconfig) {
180
     $sgxml = array();
181
 
182
-    $pfxml = $pfconfig['installedpackages'][MODULE_TIME]['config'];
183
+    $pfxml = array_get_path($pfconfig, 'installedpackages/' . MODULE_TIME . '/config');
184
     if (!is_array($pfxml)) {
185
     	$pfxml = array();
186
     }
187
@@ -1227,7 +1218,7 @@ function convert_pfxml_to_sgxml_time($pfconfig) {
188
 function convert_pfxml_to_sgxml_acl($pfconfig) {
189
     $sgxml = array();
190
 
191
-    $pfxml = $pfconfig['installedpackages'][MODULE_ACL]['config'];
192
+    $pfxml = array_get_path($pfconfig, 'installedpackages/' . MODULE_ACL . '/config');
193
     if (!is_array($pfxml)) {
194
     	$pfxml = array();
195
     }
196
@@ -1287,7 +1278,7 @@ function convert_pfxml_to_sgxml_acl($pfconfig) {
197
 # sgxml_acl: [name][desc][disabled][timename][destname][redirect][rewritename][over_redirect][over_rewritename]
198
 # -----------------------------------------------------------------
199
 function convert_pfxml_to_sgxml_default($pfconfig) {
200
-    $pfxml = $pfconfig['installedpackages'][MODULE_DEFAULT]['config'];
201
+    $pfxml = array_get_path($pfconfig, 'installedpackages/' . MODULE_DEFAULT . '/config');
202
 
203
     if (!is_array($pfxml)) {
204
     	$pfxml = array();
205
@@ -1330,27 +1321,24 @@ function convert_pfxml_to_sgxml_default($pfconfig) {
206
 # =================================================================
207
 # convert old ver. squidguard config.
208
 function capability_update_source() {
209
-	# ! use global var $config ONLY !
210
-    global $config;
211
     $conf_changed = false;
212
 
213
-    if (isset($config['installedpackages'][MODULE_ACL]['config'])) {
214
-        $tconf = &$config['installedpackages'][MODULE_ACL]['config'];
215
-        foreach($tconf as $key => $cfg) {
216
-            if (isset($cfg['iplist'])) {
217
-                $tconf[$key][F_SOURCE] .= " " . $cfg['iplist'];
218
-                unset($tconf[$key]['iplist']);
219
-                $conf_changed = true;
220
-            }
221
-            if (isset($cfg[F_DOMAINS])) {
222
-                $tconf[$key][F_SOURCE] .= " " . $cfg[F_DOMAINS];
223
-                unset($tconf[$key][F_DOMAINS]);
224
-                $conf_changed = true;
225
-            }
226
-        }
227
+	$conf_path = 'installedpackages/' . MODULE_ACL . '/config';
228
+	foreach(config_get_path($conf_path, []) as $key => $cfg) {
229
+		$aclconf = "{$conf_path}/{$key}/";
230
+		if (isset($cfg[F_IPLIST])) {
231
+			config_set_path($aclconf . F_SOURCE, config_get_path($aclconf . F_SOURCE, '') . ' ' . $cfg[F_IPLIST]);
232
+			config_del_path($aclconf . F_IPLIST);
233
+			$conf_changed = true;
234
+		}
235
+		if (isset($cfg[F_DOMAINS])) {
236
+			config_set_path($aclconf . F_SOURCE, config_get_path($aclconf . F_SOURCE, '') . ' ' . $cfg[F_DOMAINS]);
237
+			config_del_path($aclconf . F_DOMAINS);
238
+			$conf_changed = true;
239
+		}
240
+	}
241
 
242
-        if ($conf_changed) write_config('Convert old ver. squidguard config.');
243
-    }
244
+	if ($conf_changed) write_config('Convert old ver. squidguard config.');
245
 }
246
 # ------------------------------------------------------------------
247
 # get_item_id - get item 'id' from get/post
248
@@ -1553,39 +1541,39 @@ function squidguard_blacklist_list()
249
 
250
 /* Uses XMLRPC to synchronize the changes to a remote node */
251
 function squidguard_sync_on_changes() {
252
-	global $config, $g;
253
+	$conf_path = 'installedpackages/squidguardsync/config/0';
254
 
255
-	if (is_array($config['installedpackages']['squidguardsync'])) {
256
-		$synconchanges = $config['installedpackages']['squidguardsync']['config'][0]['varsyncenablexmlrpc'];
257
-		$varsynctimeout = $config['installedpackages']['squidguardsync']['config'][0]['varsynctimeout'] ?: '150';
258
+	if (is_array(config_get_path('installedpackages/squidguardsync'))) {
259
+		$synconchanges = config_get_path("{$conf_path}/varsyncenablexmlrpc");
260
+		$varsynctimeout = config_get_path("{$conf_path}/varsynctimeout", '150');
261
 	} else {
262
 		return;
263
 	}
264
 
265
 	switch ($synconchanges) {
266
 		case "manual":
267
-			if (is_array($config['installedpackages']['squidguardsync']['config'][0]['row'])) {
268
-				$rs = $config['installedpackages']['squidguardsync']['config'][0]['row'];
269
+			if (is_array(config_get_path("{$conf_path}/row"))) {
270
+				$rs = config_get_path("{$conf_path}/row");
271
 			} else {
272
 				log_error("[Squidguard]  XMLRPC sync is enabled but there are no hosts configured as replication targets.");
273
 				return;
274
 			}
275
 			break;
276
 		case "auto":
277
-			if (is_array($config['hasync'])) {
278
-				$system_carp = $config['hasync'];
279
+			if (is_array(config_get_path('hasync'))) {
280
+				$system_carp = config_get_path('hasync');
281
 				$rs[0]['varsyncipaddress'] = $system_carp['synchronizetoip'];
282
 				$rs[0]['varsyncusername'] = $system_carp['username'];
283
 				$rs[0]['varsyncpassword'] = $system_carp['password'];
284
 				$rs[0]['varsyncdestinenable'] = FALSE;
285
 
286
 				// XMLRPC sync is currently only supported over connections using the same protocol and port as this system
287
-				if ($config['system']['webgui']['protocol'] == 'http') {
288
+				if (config_get_path('system/webgui/protocol') == 'http') {
289
 					$rs[0]['varsyncprotocol'] = 'http';
290
-					$rs[0]['varsyncport'] = $config['system']['webgui']['port'] ?: '80';
291
+					$rs[0]['varsyncport'] = config_get_path('system/webgui/port', '80');
292
 				} else {
293
 					$rs[0]['varsyncprotocol'] = 'https';
294
-					$rs[0]['varsyncport'] = $config['system']['webgui']['port'] ?: '443';
295
+					$rs[0]['varsyncport'] = config_get_path('system/webgui/port', '443');
296
 				}
297
 				if ($system_carp['synchronizetoip'] == "") {
298
 					log_error("[Squidguard] XMLRPC CARP/HA sync is enabled but there are no system backup hosts configured as replication targets.");
299
@@ -1649,8 +1637,6 @@ if(!function_exists('pf_version')) {
300
 
301
 /* Do the actual XMLRPC sync */
302
 function squidguard_do_xmlrpc_sync($sync_to_ip, $varsyncport, $varsyncprotocol, $username, $password, $varsynctimeout) {
303
-	global $config, $g;
304
-
305
 	if ($username == "" || $password == "" || $sync_to_ip == "" || $varsyncport == "" || $varsyncprotocol == "") {
306
 		log_error("[SquidGuard] A required XMLRPC sync parameter (username, password, replication target, port or protocol) is empty ... aborting pkg sync");
307
 		return;
308
@@ -1658,12 +1644,12 @@ function squidguard_do_xmlrpc_sync($sync_to_ip, $varsyncport, $varsyncprotocol,
309
 
310
 	/* XML will hold the sections to sync. */
311
 	$xml = array();
312
-	$xml['squidguardgeneral'] = $config['installedpackages']['squidguardgeneral'];
313
-	$xml['squidguardacl'] = $config['installedpackages']['squidguardacl'];
314
-	$xml['squidguarddefault'] = $config['installedpackages']['squidguarddefault'];
315
-	$xml['squidguarddest'] = $config['installedpackages']['squidguarddest'];
316
-	$xml['squidguardrewrite'] = $config['installedpackages']['squidguardrewrite'];
317
-	$xml['squidguardtime'] = $config['installedpackages']['squidguardtime'];
318
+	$xml['squidguardgeneral'] = config_get_path('installedpackages/squidguardgeneral');
319
+	$xml['squidguardacl'] = config_get_path('installedpackages/squidguardacl');
320
+	$xml['squidguarddefault'] = config_get_path('installedpackages/squidguarddefault');
321
+	$xml['squidguarddest'] = config_get_path('installedpackages/squidguarddest');
322
+	$xml['squidguardrewrite'] = config_get_path('installedpackages/squidguardrewrite');
323
+	$xml['squidguardtime'] = config_get_path('installedpackages/squidguardtime');
324
 
325
 	$execcmd  = "require_once('/usr/local/pkg/squidguard.inc');\n";
326
 	$execcmd .= "squidguard_all_after_XMLRPC_resync();";
327
@@ -1700,7 +1686,7 @@ function squidguard_do_xmlrpc_sync($sync_to_ip, $varsyncport, $varsyncprotocol,
328
 		$msg = new XML_RPC_Message($method, $params);
329
 		$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
330
 		$cli->setCredentials($username, $password);
331
-		if ($g['debug']) {
332
+		if (g_get('debug')) {
333
 			$cli->setDebug(1);
334
 		}
335
 		/* Send our XMLRPC message and timeout after $varsynctimeout seconds */
336
diff --git a/www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard_configurator.inc b/www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard_configurator.inc
337
index 3ae273da7f9461ce8032554696902f3b9045ac21..6d56dfeb8240673ee0b969350baa53501f401be0 100644
338
--- a/www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard_configurator.inc
339
+++ b/www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard_configurator.inc
340
@@ -46,8 +46,6 @@ require_once('pkg-utils.inc');
341
 require_once('filter.inc');
342
 require_once('service-utils.inc');
343
 
344
-global $config;
345
-
346
 # squid package must exists by default system path (for v.2.0/2.1)
347
 # todo: move include string to the squid-function call string position
348
 if (file_exists('/usr/local/pkg/squid.inc')) {
349
@@ -129,7 +127,7 @@ define('SQUIDGUARD_STATE',              '/squidGuard.state');
350
 define('SQUIDGUARD_REBUILD',            '/squidGuard.rebuild');
351
 define('SQUIDGUARD_CONFXML',            '/squidguard_conf.xml');
352
 
353
-if (isset($config['system']['use_mfs_tmpvar'])) {
354
+if (config_path_enabled('system', 'use_mfs_tmpvar')) {
355
 	define('SQUIDGUARD_DBHOME',     '/usr/local/share/squidGuard');
356
 } else {
357
 	define('SQUIDGUARD_DBHOME',     '/var/db/squidGuard');
358
@@ -416,10 +414,10 @@ function sg_reconfigure()
359
 
360
 function squid_reconfigure($remove_only = '')
361
 {
362
-    global $config;
363
     global $squidguard_config;
364
     $conf = '';
365
-    $cust_opt = $config['installedpackages']['squid']['config'][0]['custom_options'];
366
+    $conf_path_cust_opt = 'installedpackages/squid/config/0/custom_options';
367
+    $cust_opt = config_get_path($conf_path_cust_opt);
368
     # remove old options
369
     if (!empty($cust_opt)) {
370
         $conf = explode(";", $cust_opt);
371
@@ -456,7 +454,7 @@ function squid_reconfigure($remove_only = '')
372
 
373
 	/* Only update squid options if we have something to do, otherwise this can interfere with squid's default options in a new install. */
374
 	if ($conf != $cust_opt) {
375
-		$config['installedpackages']['squid']['config'][0]['custom_options'] = $conf;
376
+		config_set_path($conf_path_cust_opt, $conf);
377
 		write_config('Update redirector options to squid config.');
378
 	}
379
 
380
@@ -520,7 +518,7 @@ function sg_check_system()
381
 # sg_reconfigure_user_db - reconfigure(update) db user entries
382
 # ------------------------------------------------------------------------------
383
 function sg_reconfigure_user_db() {
384
-	global $squidguard_config, $config;
385
+	global $squidguard_config;
386
 	$dbhome = $squidguard_config[F_DBHOME];
387
 
388
 	sg_addlog("sg_reconfigure_user_db", "Begin with '$dbhome'", SQUIDGUARD_INFO);
389
@@ -538,7 +536,7 @@ function sg_reconfigure_user_db() {
390
 	/* bypass local IPs for squid_status.php, see https://redmine.pfsense.org/issues/11711 */
391
 	if ($squidguard_config[F_DEFAULT][F_NOTALLOWINGIP]) {
392
 		init_config_arr(array('installedpackages', 'squidcache','config'));
393
-		$proxy_ifaces = explode(",", $config['installedpackages']['squid']['config'][0]['active_interface']);
394
+		$proxy_ifaces = explode(",", config_get_path('installedpackages/squid/config/0/active_interface'));
395
 		$sgips = '';
396
 		foreach ($proxy_ifaces as $iface) {
397
 			if (get_interface_ip($iface)) {
398
diff --git a/www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard_default.xml b/www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard_default.xml
399
index 37fec24c57bc04a4f6cb324ed0f2a32286552f37..bde9cd96084cf2a2765fbd217dd65951b73be115 100644
400
--- a/www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard_default.xml
401
+++ b/www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard_default.xml
402
@@ -64,7 +64,7 @@
403
 		<field>
404
 			<fielddescr>Proxy Denied Error</fielddescr>
405
 			<fieldname>deniedmessage</fieldname>
406
-			<description><![CDATA[The first part of the error message displayed to clients when access was denied. Defaults to <b>"Request denied by $g['product_name'] proxy"</b>]]></description>
407
+			<description><![CDATA[The first part of the error message displayed to clients when access was denied. Defaults to <b>Request denied by g_get('product_name') proxy</b>.]]></description>
408
 			<type>textarea</type>
409
 			<cols>65</cols>
410
 			<rows>2</rows>
411
diff --git a/www/pfSense-pkg-squidGuard/files/usr/local/www/sgerror.php b/www/pfSense-pkg-squidGuard/files/usr/local/www/sgerror.php
412
index 179fb9a868ad0917d653b33f65763dbe783ad8bb..399854fb59e709ba0b66654c5715d52de743aaef 100644
413
--- a/www/pfSense-pkg-squidGuard/files/usr/local/www/sgerror.php
414
+++ b/www/pfSense-pkg-squidGuard/files/usr/local/www/sgerror.php
415
@@ -135,7 +135,7 @@ function get_page($body) { ?>
416
  * Generate an error page for the user
417
  */
418
 function get_error_page($er_code_id, $err_msg='') {
419
-	global $g, $config, $err_code, $cl;
420
+	global $err_code, $cl;
421
 	header("HTTP/1.1 " . $err_code[$er_code_id]);
422
 
423
 ?>
424
@@ -144,10 +144,10 @@ function get_error_page($er_code_id, $err_msg='') {
425
 		<title>squidGuard Error page</title>
426
 	</head>
427
 	<body>
428
-	<?php if ($config['installedpackages']['squidguarddefault']['config'][0]['deniedmessage']): ?>
429
-		<h3><?= $config['installedpackages']['squidguarddefault']['config'][0]['deniedmessage'] ?>: <?= htmlspecialchars($err_code[$er_code_id]) ?></h3>;
430
+	<?php if (config_get_path('installedpackages/squidguarddefault/config/0/deniedmessage')): ?>
431
+		<h3><?= config_get_path('installedpackages/squidguarddefault/config/0/deniedmessage') ?>: <?= htmlspecialchars($err_code[$er_code_id]) ?></h3>;
432
 	<?php else: ?>
433
-		<h3>Request denied by <?= $g['product_name'] ?> proxy: <?= htmlspecialchars($err_code[$er_code_id]) ?></h3>
434
+		<h3>Request denied by <?= g_get('product_name') ?> proxy: <?= htmlspecialchars($err_code[$er_code_id]) ?></h3>
435
 	<?php endif; ?>
436
 
437
 	<?php if ($err_msg): ?>
(15-15/17)