Commit 93de08bd authored by Franco Fichtner's avatar Franco Fichtner

src: clean up global 'g' handling, still more work to do

parent 82c98816
...@@ -54,8 +54,8 @@ include("head.inc"); ...@@ -54,8 +54,8 @@ include("head.inc");
<li><?=gettext("System will be configured as a DHCP server on the default LAN interface");?></li> <li><?=gettext("System will be configured as a DHCP server on the default LAN interface");?></li>
<li><?=gettext("Reboot after changes are installed");?></li> <li><?=gettext("Reboot after changes are installed");?></li>
<li><?=gettext("WAN interface will be set to obtain an address automatically from a DHCP server");?></li> <li><?=gettext("WAN interface will be set to obtain an address automatically from a DHCP server");?></li>
<li><?=gettext("webConfigurator admin username will be reset to 'root'");?></li> <li><?= sprintf(gettext('Admin username will be reset to: %s'), $g['factory_shipped_username']) ?></li>
<li><?=gettext("webConfigurator admin password will be reset to");?> '<?=$g['factory_shipped_password']?>'</li> <li><?= sprintf(gettext('Admin password will be reset to: %s'), $g['factory_shipped_password']) ?></li>
</ul> </ul>
<p><strong><?=gettext("Are you sure you want to proceed?");?></strong></p> <p><strong><?=gettext("Are you sure you want to proceed?");?></strong></p>
<div class="btn-group"> <div class="btn-group">
......
...@@ -38,7 +38,7 @@ include("head.inc"); ...@@ -38,7 +38,7 @@ include("head.inc");
<div class="container-fluid "> <div class="container-fluid ">
<div class="row"> <div class="row">
<section class="col-xs-11"> <section class="col-xs-11">
<p><a href="https://opnsense.org/" target="_blank">OPNsense&reg;</a></span> is Copyright &copy; <?=$g['product_copyright_years'];?> by Deciso B.V. All rights reserved.</p> <p><a href="https://opnsense.org/" target="_blank">OPNsense&reg;</a></span> is Copyright &copy; <?=$g['product_copyright_years'];?> <?= $g['product_copyright_owner'] ?><br>All rights reserved.</p>
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p> <p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>
<p><ol><li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li> <p><ol><li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li>
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li></ol></p> <li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li></ol></p>
......
...@@ -156,7 +156,7 @@ include("head.inc"); ...@@ -156,7 +156,7 @@ include("head.inc");
<input name="agentoption" type="checkbox" value="yes" <?=!empty($pconfig['agentoption']) ? "checked=\"checked\"" : ""; ?> /> <input name="agentoption" type="checkbox" value="yes" <?=!empty($pconfig['agentoption']) ? "checked=\"checked\"" : ""; ?> />
<strong><?=gettext("Append circuit ID and agent ID to requests"); ?></strong><br /> <strong><?=gettext("Append circuit ID and agent ID to requests"); ?></strong><br />
<div class="hidden" for="help_for_agentoption"> <div class="hidden" for="help_for_agentoption">
<?php printf(gettext("If this is checked, the DHCP relay will append the circuit ID (%s interface number) and the agent ID to the DHCP request."), $g['product_name']); ?> <?= gettext('If this is checked, the DHCP relay will append the circuit ID (interface number) and the agent ID to the DHCP request.') ?>
</div> </div>
</td> </td>
</tr> </tr>
......
...@@ -157,7 +157,7 @@ include("head.inc"); ...@@ -157,7 +157,7 @@ include("head.inc");
<td> <td>
<input name="agentoption" type="checkbox" value="yes" <?=!empty($pconfig['agentoption']) ? "checked=\"checked\"" : ""; ?> /> <input name="agentoption" type="checkbox" value="yes" <?=!empty($pconfig['agentoption']) ? "checked=\"checked\"" : ""; ?> />
<div class="hidden" for="help_for_agentoption"> <div class="hidden" for="help_for_agentoption">
<?php printf(gettext("If this is checked, the DHCPv6 relay will append the circuit ID (%s interface number) and the agent ID to the DHCPv6 request."), $g['product_name']); ?> <?= gettext('If this is checked, the DHCPv6 relay will append the circuit ID (interface number) and the agent ID to the DHCPv6 request.') ?>
</div> </div>
</td> </td>
</tr> </tr>
......
...@@ -281,9 +281,9 @@ $( document ).ready(function() { ...@@ -281,9 +281,9 @@ $( document ).ready(function() {
<input name="strict_order" type="checkbox" id="strict_order" value="yes" <?=!empty($pconfig['strict_order']) ? "checked=\"checked\"" : "";?> /> <input name="strict_order" type="checkbox" id="strict_order" value="yes" <?=!empty($pconfig['strict_order']) ? "checked=\"checked\"" : "";?> />
<strong><?=gettext("Query DNS servers sequentially");?></strong> <strong><?=gettext("Query DNS servers sequentially");?></strong>
<div class="hidden" for="help_for_strict_order"> <div class="hidden" for="help_for_strict_order">
<?php printf(gettext("If this option is set, %s DNS Forwarder (dnsmasq) will ". <?= gettext("If this option is set, the DNS Forwarder (dnsmasq) will ".
"query the DNS servers sequentially in the order specified (%sSystem - General Setup - DNS Servers%s), ". "query the DNS servers sequentially in the order specified (System: " .
"rather than all at once in parallel."), $g['product_name'],'<i>','</i>'); ?> "General Setup: DNS Servers), rather than all at once in parallel.") ?>
</div> </div>
</td> </td>
</tr> </tr>
...@@ -292,9 +292,10 @@ $( document ).ready(function() { ...@@ -292,9 +292,10 @@ $( document ).ready(function() {
<input name="domain_needed" type="checkbox" id="domain_needed" value="yes" <?=!empty($pconfig['domain_needed']) ? "checked=\"checked\"" : "";?> /> <input name="domain_needed" type="checkbox" id="domain_needed" value="yes" <?=!empty($pconfig['domain_needed']) ? "checked=\"checked\"" : "";?> />
<strong><?=gettext("Require domain");?></strong> <strong><?=gettext("Require domain");?></strong>
<div class="hidden" for="help_for_strict_order"> <div class="hidden" for="help_for_strict_order">
<?php printf(gettext("If this option is set, %s DNS Forwarder (dnsmasq) will ". <?= gettext('If this option is set, the DNS Forwarder (dnsmasq) will '.
"not forward A or AAAA queries for plain names, without dots or domain parts, to upstream name servers. ". 'not forward A or AAAA queries for plain names, without dots or ' .
'If the name is not known from /etc/hosts or DHCP then a "not found" answer is returned.'), $g['product_name']); ?> 'domain parts, to upstream name servers. If the name is not known ' .
'from /etc/hosts or DHCP then a "not found" answer is returned.') ?>
</div> </div>
</td> </td>
</tr> </tr>
...@@ -303,10 +304,13 @@ $( document ).ready(function() { ...@@ -303,10 +304,13 @@ $( document ).ready(function() {
<input name="no_private_reverse" type="checkbox" id="no_private_reverse" value="yes" <?=!empty($pconfig['no_private_reverse']) ? "checked=\"checked\"" : "";?> /> <input name="no_private_reverse" type="checkbox" id="no_private_reverse" value="yes" <?=!empty($pconfig['no_private_reverse']) ? "checked=\"checked\"" : "";?> />
<strong><?=gettext("Do not forward private reverse lookups");?></strong> <strong><?=gettext("Do not forward private reverse lookups");?></strong>
<div class="hidden" for="help_for_strict_order"> <div class="hidden" for="help_for_strict_order">
<?php printf(gettext("If this option is set, %s DNS Forwarder (dnsmasq) will ". <?= gettext('If this option is set, the DNS Forwarder (dnsmasq) will '.
"not forward reverse DNS lookups (PTR) for private addresses (RFC 1918) to upstream name servers. ". 'not forward reverse DNS lookups (PTR) for private addresses ' .
'Any entries in the Domain Overrides section forwarding private "n.n.n.in-addr.arpa" names to a specific server are still forwarded. '. '(RFC 1918) to upstream name servers. Any entries in the Domain ' .
'If the IP to name is not known from /etc/hosts, DHCP or a specific domain override then a "not found" answer is immediately returned.'), $g['product_name']); ?> 'Overrides section forwarding private "n.n.n.in-addr.arpa" names ' .
'to a specific server are still forwarded. If the IP to name is ' .
'not known from /etc/hosts, DHCP or a specific domain override ' .
'then a "not found" answer is immediately returned.') ?>
</div> </div>
</td> </td>
</tr> </tr>
......
...@@ -510,8 +510,8 @@ include("head.inc"); ...@@ -510,8 +510,8 @@ include("head.inc");
<input name="disablefilter" type="checkbox" value="yes" <?= !empty($pconfig['disablefilter']) ? "checked=\"checked\"" : "";?>/> <input name="disablefilter" type="checkbox" value="yes" <?= !empty($pconfig['disablefilter']) ? "checked=\"checked\"" : "";?>/>
<strong><?=gettext("Disable all packet filtering.");?></strong> <strong><?=gettext("Disable all packet filtering.");?></strong>
<div class="hidden" for="help_for_disablefilter"> <div class="hidden" for="help_for_disablefilter">
<?php printf(gettext("Warning: This converts %s into a routing only platform!"), $g['product_name']);?> <?= gettext('Warning: This will convert into a routing-only platform!') ?><br />
<?=gettext("Warning: This will also turn off NAT!");?><br /> <?= gettext('Warning: This will also turn off NAT!') ?><br />
<?=sprintf( <?=sprintf(
gettext('If you only want to disable NAT, and not firewall rules, visit the %sOutbound NAT%s page.'), gettext('If you only want to disable NAT, and not firewall rules, visit the %sOutbound NAT%s page.'),
'<a href="/firewall_nat_out.php">', '</a>' '<a href="/firewall_nat_out.php">', '</a>'
......
...@@ -400,8 +400,7 @@ include("head.inc"); ...@@ -400,8 +400,7 @@ include("head.inc");
</select> </select>
<div class="hidden" for="help_for_theme"> <div class="hidden" for="help_for_theme">
<strong> <strong>
<?=gettext("This will change the look and feel of"); ?> <?= gettext('This will change the look and feel of the GUI.') ?>
<?=$g['product_name'];?>.
</strong> </strong>
</div> </div>
</td> </td>
...@@ -509,11 +508,11 @@ include("head.inc"); ...@@ -509,11 +508,11 @@ include("head.inc");
<?=gettext("Allow DNS server list to be overridden by DHCP/PPP on WAN"); ?> <?=gettext("Allow DNS server list to be overridden by DHCP/PPP on WAN"); ?>
</strong> </strong>
<div class="hidden" for="help_for_dnsservers_opt"> <div class="hidden" for="help_for_dnsservers_opt">
<?php printf(gettext("If this option is set, %s will " . <?= gettext("If this option is set, DNS servers " .
"use DNS servers assigned by a DHCP/PPP server on WAN " . "assigned by a DHCP/PPP server on WAN will be used " .
"for its own purposes (including the DNS forwarder). " . "for its own purposes (including the DNS forwarder). " .
"However, they will not be assigned to DHCP and PPTP " . "However, they will not be assigned to DHCP and PPTP " .
"VPN clients."), $g['product_name']); ?> "VPN clients.") ?>
</div> </div>
<br/> <br/>
<input name="dnslocalhost" type="checkbox" value="yes" <?=$pconfig['dnslocalhost'] ? "checked=\"checked\"" : ""; ?> /> <input name="dnslocalhost" type="checkbox" value="yes" <?=$pconfig['dnslocalhost'] ? "checked=\"checked\"" : ""; ?> />
......
...@@ -57,7 +57,7 @@ if (isset($config['system']['authserver'][0]['host'])) { ...@@ -57,7 +57,7 @@ if (isset($config['system']['authserver'][0]['host'])) {
else:?> else:?>
<tr> <tr>
<td colspan='2'> <td colspan='2'>
<?=sprintf(gettext("Testing %s LDAP settings... One moment please..."), $g['product_name']);?> <?= gettext('Testing LDAP settings... One moment please...') ?>
</td> </td>
</tr> </tr>
<tr> <tr>
......
...@@ -135,6 +135,19 @@ function system_api_disk() ...@@ -135,6 +135,19 @@ function system_api_disk()
return $result; return $result;
} }
function system_api_versions()
{
global $g;
$result = array();
$result[] = sprintf('%s %s-%s', $g['product_name'], explode('-', trim(file_get_contents('/usr/local/opnsense/version/opnsense')))[0], php_uname('m'));
$result[] = php_uname('s') . ' ' . php_uname('r');
$result[] = exec('/usr/local/bin/openssl version');
return $result;
}
/** /**
* widget system data * widget system data
*/ */
...@@ -142,6 +155,7 @@ function system_api() ...@@ -142,6 +155,7 @@ function system_api()
{ {
$result = array(); $result = array();
$result['versions'] = system_api_versions();
$result['cpu'] = system_api_cpu_stats(); $result['cpu'] = system_api_cpu_stats();
preg_match("/sec = (\d+)/", get_single_sysctl("kern.boottime"), $matches); preg_match("/sec = (\d+)/", get_single_sysctl("kern.boottime"), $matches);
$result['uptime'] = time() - $matches[1]; $result['uptime'] = time() - $matches[1];
......
...@@ -107,7 +107,7 @@ if (isset($_POST['getupdatestatus'])) { ...@@ -107,7 +107,7 @@ if (isset($_POST['getupdatestatus'])) {
// update cpu usage chart // update cpu usage chart
system_information_widget_cpu_update(sender, data); system_information_widget_cpu_update(sender, data);
$("#system_information_widget_cpu_type").html(data['cpu']['model'] + ' ( '+data['cpu']['cpus']+' cores )'); $("#system_information_widget_cpu_type").html(data['cpu']['model'] + ' ('+data['cpu']['cpus']+' cores )');
var uptime_days = parseInt(moment.duration(parseInt(data['uptime']), 'seconds').asDays()); var uptime_days = parseInt(moment.duration(parseInt(data['uptime']), 'seconds').asDays());
var uptime_str = ""; var uptime_str = "";
if (uptime_days > 0) { if (uptime_days > 0) {
...@@ -118,6 +118,7 @@ if (isset($_POST['getupdatestatus'])) { ...@@ -118,6 +118,7 @@ if (isset($_POST['getupdatestatus'])) {
$("#system_information_widget_uptime").html(uptime_str); $("#system_information_widget_uptime").html(uptime_str);
$("#system_information_widget_datetime").html(data['date_frmt']); $("#system_information_widget_datetime").html(data['date_frmt']);
$("#system_information_widget_last_config_change").html(data['config']['last_change_frmt']); $("#system_information_widget_last_config_change").html(data['config']['last_change_frmt']);
$("#system_information_widget_versions").html(data['versions'].join('<br/>'));
var states_perc = parseInt((parseInt(data['kernel']['pf']['states']) / parseInt(data['kernel']['pf']['maxstates']))*100); var states_perc = parseInt((parseInt(data['kernel']['pf']['states']) / parseInt(data['kernel']['pf']['maxstates']))*100);
$("#system_information_widget_states .progress-bar").css("width", states_perc + "%").attr("aria-valuenow", states_perc + "%"); $("#system_information_widget_states .progress-bar").css("width", states_perc + "%").attr("aria-valuenow", states_perc + "%");
...@@ -197,16 +198,12 @@ if (isset($_POST['getupdatestatus'])) { ...@@ -197,16 +198,12 @@ if (isset($_POST['getupdatestatus'])) {
</tr> </tr>
<tr> <tr>
<td><?=gettext("Versions");?></td> <td><?=gettext("Versions");?></td>
<td> <td id="system_information_widget_versions"></td>
<?=sprintf('%s %s-%s', $g['product_name'], explode('-', trim(file_get_contents('/usr/local/opnsense/version/opnsense')))[0], php_uname('m'));?><br/>
<?=php_uname('s') . ' ' . php_uname('r'); ?><br/>
<?=exec('/usr/local/bin/openssl version'); ?>
</td>
</tr> </tr>
<tr> <tr>
<td><?= gettext('Updates') ?></td> <td><?= gettext('Updates') ?></td>
<td> <td>
<div id='updatestatus'><span class='btn-link' onclick='system_information_widget_checkupdate()'><?=gettext("Click to check for updates");?></span></div> <div id="updatestatus"><span class='btn-link' onclick='system_information_widget_checkupdate()'><?=gettext("Click to check for updates");?></span></div>
</td> </td>
</tr> </tr>
<tr> <tr>
......
...@@ -83,10 +83,6 @@ if (isset($_GET['xml'])) { ...@@ -83,10 +83,6 @@ if (isset($_GET['xml'])) {
$xml = htmlspecialchars($_POST['xml']); $xml = htmlspecialchars($_POST['xml']);
} }
/*
* XXX If we don't want hardcoding we could
* probe /usr/local/wizard for viable files.
*/
switch ($xml) { switch ($xml) {
case 'openvpn': case 'openvpn':
break; break;
...@@ -95,7 +91,7 @@ switch ($xml) { ...@@ -95,7 +91,7 @@ switch ($xml) {
break; break;
} }
global $g, $listtags; global $listtags;
$listtags = array_flip(array( $listtags = array_flip(array(
'additional_files_needed', 'additional_files_needed',
...@@ -127,8 +123,8 @@ if (!is_array($pkg)) { ...@@ -127,8 +123,8 @@ if (!is_array($pkg)) {
die; die;
} }
$description = preg_replace("/pfSense/i", $g['product_name'], $pkg['step'][$stepid]['description']); $description = $pkg['step'][$stepid]['description'];
$title = preg_replace("/pfSense/i", $g['product_name'], $pkg['step'][$stepid]['title']); $title = $pkg['step'][$stepid]['title'];
$totalsteps = $pkg['totalsteps']; $totalsteps = $pkg['totalsteps'];
if ($pkg['includefile']) { if ($pkg['includefile']) {
...@@ -206,14 +202,12 @@ function update_config_field($field, $updatetext, $unset, $arraynum, $field_type ...@@ -206,14 +202,12 @@ function update_config_field($field, $updatetext, $unset, $arraynum, $field_type
eval($text); eval($text);
} }
$title = preg_replace("/pfSense/i", $g['product_name'], $pkg['step'][$stepid]['title']);
$description = preg_replace("/pfSense/i", $g['product_name'], $pkg['step'][$stepid]['description']);
// handle before form display event. // handle before form display event.
do { do {
$oldstepid = $stepid; $oldstepid = $stepid;
if($pkg['step'][$stepid]['stepbeforeformdisplay'] <> "") if ($pkg['step'][$stepid]['stepbeforeformdisplay'] != '') {
eval($pkg['step'][$stepid]['stepbeforeformdisplay']); eval($pkg['step'][$stepid]['stepbeforeformdisplay']);
}
} while ($oldstepid != $stepid); } while ($oldstepid != $stepid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment