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");
<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("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><?=gettext("webConfigurator admin password will be reset to");?> '<?=$g['factory_shipped_password']?>'</li>
<li><?= sprintf(gettext('Admin username will be reset to: %s'), $g['factory_shipped_username']) ?></li>
<li><?= sprintf(gettext('Admin password will be reset to: %s'), $g['factory_shipped_password']) ?></li>
</ul>
<p><strong><?=gettext("Are you sure you want to proceed?");?></strong></p>
<div class="btn-group">
......
......@@ -38,7 +38,7 @@ include("head.inc");
<div class="container-fluid ">
<div class="row">
<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><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>
......
......@@ -156,7 +156,7 @@ include("head.inc");
<input name="agentoption" type="checkbox" value="yes" <?=!empty($pconfig['agentoption']) ? "checked=\"checked\"" : ""; ?> />
<strong><?=gettext("Append circuit ID and agent ID to requests"); ?></strong><br />
<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>
</td>
</tr>
......
......@@ -157,7 +157,7 @@ include("head.inc");
<td>
<input name="agentoption" type="checkbox" value="yes" <?=!empty($pconfig['agentoption']) ? "checked=\"checked\"" : ""; ?> />
<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>
</td>
</tr>
......
......@@ -281,9 +281,9 @@ $( document ).ready(function() {
<input name="strict_order" type="checkbox" id="strict_order" value="yes" <?=!empty($pconfig['strict_order']) ? "checked=\"checked\"" : "";?> />
<strong><?=gettext("Query DNS servers sequentially");?></strong>
<div class="hidden" for="help_for_strict_order">
<?php printf(gettext("If this option is set, %s DNS Forwarder (dnsmasq) will ".
"query the DNS servers sequentially in the order specified (%sSystem - General Setup - DNS Servers%s), ".
"rather than all at once in parallel."), $g['product_name'],'<i>','</i>'); ?>
<?= gettext("If this option is set, the DNS Forwarder (dnsmasq) will ".
"query the DNS servers sequentially in the order specified (System: " .
"General Setup: DNS Servers), rather than all at once in parallel.") ?>
</div>
</td>
</tr>
......@@ -292,9 +292,10 @@ $( document ).ready(function() {
<input name="domain_needed" type="checkbox" id="domain_needed" value="yes" <?=!empty($pconfig['domain_needed']) ? "checked=\"checked\"" : "";?> />
<strong><?=gettext("Require domain");?></strong>
<div class="hidden" for="help_for_strict_order">
<?php printf(gettext("If this option is set, %s DNS Forwarder (dnsmasq) will ".
"not forward A or AAAA queries for plain names, without dots or domain parts, to upstream name servers. ".
'If the name is not known from /etc/hosts or DHCP then a "not found" answer is returned.'), $g['product_name']); ?>
<?= 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. If the name is not known ' .
'from /etc/hosts or DHCP then a "not found" answer is returned.') ?>
</div>
</td>
</tr>
......@@ -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\"" : "";?> />
<strong><?=gettext("Do not forward private reverse lookups");?></strong>
<div class="hidden" for="help_for_strict_order">
<?php printf(gettext("If this option is set, %s DNS Forwarder (dnsmasq) will ".
"not forward reverse DNS lookups (PTR) for private addresses (RFC 1918) to upstream name servers. ".
'Any entries in the Domain 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.'), $g['product_name']); ?>
<?= 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. Any entries in the Domain ' .
'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>
</td>
</tr>
......
......@@ -510,8 +510,8 @@ include("head.inc");
<input name="disablefilter" type="checkbox" value="yes" <?= !empty($pconfig['disablefilter']) ? "checked=\"checked\"" : "";?>/>
<strong><?=gettext("Disable all packet filtering.");?></strong>
<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 also turn off NAT!");?><br />
<?= gettext('Warning: This will convert into a routing-only platform!') ?><br />
<?= gettext('Warning: This will also turn off NAT!') ?><br />
<?=sprintf(
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>'
......
......@@ -400,8 +400,7 @@ include("head.inc");
</select>
<div class="hidden" for="help_for_theme">
<strong>
<?=gettext("This will change the look and feel of"); ?>
<?=$g['product_name'];?>.
<?= gettext('This will change the look and feel of the GUI.') ?>
</strong>
</div>
</td>
......@@ -509,11 +508,11 @@ include("head.inc");
<?=gettext("Allow DNS server list to be overridden by DHCP/PPP on WAN"); ?>
</strong>
<div class="hidden" for="help_for_dnsservers_opt">
<?php printf(gettext("If this option is set, %s will " .
"use DNS servers assigned by a DHCP/PPP server on WAN " .
<?= gettext("If this option is set, DNS servers " .
"assigned by a DHCP/PPP server on WAN will be used " .
"for its own purposes (including the DNS forwarder). " .
"However, they will not be assigned to DHCP and PPTP " .
"VPN clients."), $g['product_name']); ?>
"VPN clients.") ?>
</div>
<br/>
<input name="dnslocalhost" type="checkbox" value="yes" <?=$pconfig['dnslocalhost'] ? "checked=\"checked\"" : ""; ?> />
......
......@@ -57,7 +57,7 @@ if (isset($config['system']['authserver'][0]['host'])) {
else:?>
<tr>
<td colspan='2'>
<?=sprintf(gettext("Testing %s LDAP settings... One moment please..."), $g['product_name']);?>
<?= gettext('Testing LDAP settings... One moment please...') ?>
</td>
</tr>
<tr>
......
......@@ -135,6 +135,19 @@ function system_api_disk()
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
*/
......@@ -142,6 +155,7 @@ function system_api()
{
$result = array();
$result['versions'] = system_api_versions();
$result['cpu'] = system_api_cpu_stats();
preg_match("/sec = (\d+)/", get_single_sysctl("kern.boottime"), $matches);
$result['uptime'] = time() - $matches[1];
......
......@@ -107,7 +107,7 @@ if (isset($_POST['getupdatestatus'])) {
// update cpu usage chart
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_str = "";
if (uptime_days > 0) {
......@@ -118,6 +118,7 @@ if (isset($_POST['getupdatestatus'])) {
$("#system_information_widget_uptime").html(uptime_str);
$("#system_information_widget_datetime").html(data['date_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);
$("#system_information_widget_states .progress-bar").css("width", states_perc + "%").attr("aria-valuenow", states_perc + "%");
......@@ -197,16 +198,12 @@ if (isset($_POST['getupdatestatus'])) {
</tr>
<tr>
<td><?=gettext("Versions");?></td>
<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>
<td id="system_information_widget_versions"></td>
</tr>
<tr>
<td><?= gettext('Updates') ?></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>
</tr>
<tr>
......
......@@ -83,10 +83,6 @@ if (isset($_GET['xml'])) {
$xml = htmlspecialchars($_POST['xml']);
}
/*
* XXX If we don't want hardcoding we could
* probe /usr/local/wizard for viable files.
*/
switch ($xml) {
case 'openvpn':
break;
......@@ -95,7 +91,7 @@ switch ($xml) {
break;
}
global $g, $listtags;
global $listtags;
$listtags = array_flip(array(
'additional_files_needed',
......@@ -127,8 +123,8 @@ if (!is_array($pkg)) {
die;
}
$description = preg_replace("/pfSense/i", $g['product_name'], $pkg['step'][$stepid]['description']);
$title = preg_replace("/pfSense/i", $g['product_name'], $pkg['step'][$stepid]['title']);
$description = $pkg['step'][$stepid]['description'];
$title = $pkg['step'][$stepid]['title'];
$totalsteps = $pkg['totalsteps'];
if ($pkg['includefile']) {
......@@ -206,14 +202,12 @@ function update_config_field($field, $updatetext, $unset, $arraynum, $field_type
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.
do {
$oldstepid = $stepid;
if($pkg['step'][$stepid]['stepbeforeformdisplay'] <> "")
if ($pkg['step'][$stepid]['stepbeforeformdisplay'] != '') {
eval($pkg['step'][$stepid]['stepbeforeformdisplay']);
}
} 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