Commit 7fefef33 authored by Franco Fichtner's avatar Franco Fichtner

src: gettext(sprintf()) corrections; closes #971

(cherry picked from commit 0652bd06)
parent bcbca368
...@@ -328,7 +328,7 @@ function notify_via_growl($message, $force=false) { ...@@ -328,7 +328,7 @@ function notify_via_growl($message, $force=false) {
$growl_notification = $config['notifications']['growl']['notification_name']; $growl_notification = $config['notifications']['growl']['notification_name'];
$growl = new Growl($growl_ip, $growl_password, $growl_name); $growl = new Growl($growl_ip, $growl_password, $growl_name);
$growl->notify("{$growl_notification}", gettext(sprintf("%s (%s) - Notification", $g['product_name'], $hostname)), "{$message}"); $growl->notify("{$growl_notification}", sprintf(gettext('%s (%s) - Notification'), $g['product_name'], $hostname), "{$message}");
} }
/* Store last message sent to avoid spamming */ /* Store last message sent to avoid spamming */
......
...@@ -149,12 +149,12 @@ include 'head.inc'; ...@@ -149,12 +149,12 @@ include 'head.inc';
<input name="enable" type="checkbox" id="enable" value="yes" <?=!empty($pconfig['enable']) ? 'checked="checked"' : "";?> /> <input name="enable" type="checkbox" id="enable" value="yes" <?=!empty($pconfig['enable']) ? 'checked="checked"' : "";?> />
<strong><?=gettext('Filter DNS requests using OpenDNS'); ?></strong> <strong><?=gettext('Filter DNS requests using OpenDNS'); ?></strong>
<div class="hidden" for="help_for_enable"> <div class="hidden" for="help_for_enable">
<?=gettext(sprintf( <?= sprintf(gettext(
'Enabling the OpenDNS service will overwrite DNS servers configured ' . 'Enabling the OpenDNS service will overwrite DNS servers configured ' .
'via the General Setup page as well as ignore any DNS servers learned ' . 'via the General Setup page as well as ignore any DNS servers learned ' .
'by DHCP/PPP on WAN and use the DNS servers from %s instead.', 'by DHCP/PPP on WAN and use the DNS servers from %s instead.'),
'<a href="http://www.opendns.com" target="_blank">OpenDNS.com</a>' '<a href="http://www.opendns.com" target="_blank">OpenDNS.com</a>'
)); ?> ) ?>
</div> </div>
</td> </td>
</tr> </tr>
...@@ -182,13 +182,13 @@ include 'head.inc'; ...@@ -182,13 +182,13 @@ include 'head.inc';
<td> <td>
<input name="host" type="text" id="host" size="30" value="<?=$pconfig['host'];?>" /> <input name="host" type="text" id="host" size="30" value="<?=$pconfig['host'];?>" />
<div class="hidden" for="help_for_host"> <div class="hidden" for="help_for_host">
<?=gettext(sprintf( <?= sprintf(gettext(
'Enter the network name configured on the %s under ' . 'Enter the network name configured on the %sNetworks ' .
'\'Manage your networks\'. Used to update the node\'s ' . 'Dashboard of OpenDNS%s under \'Manage your networks\'. ' .
'IP address whenever the WAN interface changes its IP address.', 'Used to update the node\'s IP address whenever the ' .
'<a href="https://www.opendns.com/dashboard/networks/" target="_blank">' . 'WAN interface changes its IP address.'),
gettext('Networks Dashboard of OpenDNS') .'</a>' '<a href="https://www.opendns.com/dashboard/networks/" target="_blank">', '</a>'
)); ?> ) ?>
</div> </div>
</td> </td>
</tr> </tr>
......
...@@ -239,11 +239,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -239,11 +239,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
} elseif (!empty($pconfig['latencylow'])) { } elseif (!empty($pconfig['latencylow'])) {
if (is_numeric($pconfig['latencylow']) && $pconfig['latencylow'] > $apinger_default['latencyhigh']) { if (is_numeric($pconfig['latencylow']) && $pconfig['latencylow'] > $apinger_default['latencyhigh']) {
$input_errors[] = gettext(sprintf("The low latency threshold needs to be less than the default high latency threshold (%d)", $apinger_default['latencyhigh'])); $input_errors[] = sprintf(gettext('The low latency threshold needs to be less than the default high latency threshold (%d)'), $apinger_default['latencyhigh']);
} }
} elseif (!empty($pconfig['latencyhigh'])) { } elseif (!empty($pconfig['latencyhigh'])) {
if (is_numeric($_POST['latencyhigh']) && $_POST['latencyhigh'] < $apinger_default['latencylow']) { if (is_numeric($_POST['latencyhigh']) && $_POST['latencyhigh'] < $apinger_default['latencylow']) {
$input_errors[] = gettext(sprintf("The high latency threshold needs to be higher than the default low latency threshold (%d)", $apinger_default['latencylow'])); $input_errors[] = sprintf(gettext('The high latency threshold needs to be higher than the default low latency threshold (%d)'), $apinger_default['latencylow']);
} }
} }
...@@ -253,11 +253,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -253,11 +253,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
} elseif (!empty($pconfig['losslow'])) { } elseif (!empty($pconfig['losslow'])) {
if (is_numeric($pconfig['losslow']) && $pconfig['losslow'] > $apinger_default['losshigh']) { if (is_numeric($pconfig['losslow']) && $pconfig['losslow'] > $apinger_default['losshigh']) {
$input_errors[] = gettext(sprintf("The low Packet Loss threshold needs to be less than the default high Packet Loss threshold (%d)", $apinger_default['losshigh'])); $input_errors[] = sprintf(gettext('The low Packet Loss threshold needs to be less than the default high Packet Loss threshold (%d)'), $apinger_default['losshigh']);
} }
} elseif (!empty($pconfig['losshigh'])) { } elseif (!empty($pconfig['losshigh'])) {
if (is_numeric($pconfig['losshigh']) && $pconfig['losshigh'] < $apinger_default['losslow']) { if (is_numeric($pconfig['losshigh']) && $pconfig['losshigh'] < $apinger_default['losslow']) {
$input_errors[] = gettext(sprintf("The high Packet Loss threshold needs to be higher than the default low Packet Loss threshold (%d)", $apinger_default['losslow'])); $input_errors[] = sprintf(gettext('The high Packet Loss threshold needs to be higher than the default low Packet Loss threshold (%d)'), $apinger_default['losslow']);
} }
} }
...@@ -283,11 +283,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -283,11 +283,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
} elseif (!empty($pconfig['interval'])) { } elseif (!empty($pconfig['interval'])) {
if (is_numeric($pconfig['interval']) && $pconfig['interval'] > $apinger_default['down']) { if (is_numeric($pconfig['interval']) && $pconfig['interval'] > $apinger_default['down']) {
$input_errors[] = gettext(sprintf("The probe interval needs to be less than the default down time setting (%d)", $apinger_default['down'])); $input_errors[] = sprintf(gettext('The probe interval needs to be less than the default down time setting (%d)'), $apinger_default['down']);
} }
} elseif (!empty($pconfig['down'])) { } elseif (!empty($pconfig['down'])) {
if (is_numeric($pconfig['down']) && $pconfig['down'] < $apinger_default['interval']) { if (is_numeric($pconfig['down']) && $pconfig['down'] < $apinger_default['interval']) {
$input_errors[] = gettext(sprintf("The down time setting needs to be higher than the default probe interval (%d)", $apinger_default['interval'])); $input_errors[] = sprintf(gettext('The down time setting needs to be higher than the default probe interval (%d)'), $apinger_default['interval']);
} }
} }
...@@ -728,7 +728,7 @@ $( document ).ready(function() { ...@@ -728,7 +728,7 @@ $( document ).ready(function() {
</tbody> </tbody>
</table> </table>
<div class="hidden" for="help_for_latency"> <div class="hidden" for="help_for_latency">
<?=gettext(sprintf("Low and high thresholds for latency in milliseconds. Default is %d/%d.", $apinger_default['latencylow'], $apinger_default['latencyhigh']));?> <?= sprintf(gettext('Low and high thresholds for latency in milliseconds. Default is %d/%d.'), $apinger_default['latencylow'], $apinger_default['latencyhigh']) ?>
</div> </div>
</td> </td>
</tr> </tr>
...@@ -754,7 +754,7 @@ $( document ).ready(function() { ...@@ -754,7 +754,7 @@ $( document ).ready(function() {
</tbody> </tbody>
</table> </table>
<div class="hidden" for="help_for_loss"> <div class="hidden" for="help_for_loss">
<?=gettext(sprintf("Low and high thresholds for packet loss in %%. Default is %d/%d.", $apinger_default['losslow'], $apinger_default['losshigh']));?> <?= sprintf(gettext('Low and high thresholds for packet loss in %%. Default is %d/%d.'), $apinger_default['losslow'], $apinger_default['losshigh']) ?>
</div> </div>
</td> </td>
</tr> </tr>
...@@ -763,7 +763,7 @@ $( document ).ready(function() { ...@@ -763,7 +763,7 @@ $( document ).ready(function() {
<td> <td>
<input name="interval" id="interval" type="text" value="<?=$pconfig['interval'];?>" onclick="calculated_change()" /> <input name="interval" id="interval" type="text" value="<?=$pconfig['interval'];?>" onclick="calculated_change()" />
<div class="hidden" for="help_for_interval"> <div class="hidden" for="help_for_interval">
<?=gettext(sprintf("How often that an ICMP probe will be sent in seconds. Default is %d.", $apinger_default['interval']));?><br /><br /> <?= sprintf(gettext('How often that an ICMP probe will be sent in seconds. Default is %d.'), $apinger_default['interval']) ?><br /><br />
<?=gettext("NOTE: The quality graph is averaged over seconds, not intervals, so as the probe interval is increased the accuracy of the quality graph is decreased.");?> <?=gettext("NOTE: The quality graph is averaged over seconds, not intervals, so as the probe interval is increased the accuracy of the quality graph is decreased.");?>
</div> </div>
</td> </td>
...@@ -773,7 +773,7 @@ $( document ).ready(function() { ...@@ -773,7 +773,7 @@ $( document ).ready(function() {
<td> <td>
<input name="down" type="text" value="<?=$pconfig['down'];?>" /> <input name="down" type="text" value="<?=$pconfig['down'];?>" />
<div class="hidden" for="help_for_down"> <div class="hidden" for="help_for_down">
<?=gettext(sprintf("The number of seconds of failed probes before the alarm will fire. Default is %d.", $apinger_default['down']));?> <?= sprintf(gettext('The number of seconds of failed probes before the alarm will fire. Default is %d.'), $apinger_default['down']) ?>
</div> </div>
</td> </td>
</tr> </tr>
...@@ -784,7 +784,7 @@ $( document ).ready(function() { ...@@ -784,7 +784,7 @@ $( document ).ready(function() {
<input name="avg_delay_samples_calculated" type="checkbox" id="avg_delay_samples_calculated" value="yes" <?=!empty($pconfig['avg_delay_samples_calculated']) ? "checked=\"checked\"" : "";?> onclick="calculated_change()" /> <input name="avg_delay_samples_calculated" type="checkbox" id="avg_delay_samples_calculated" value="yes" <?=!empty($pconfig['avg_delay_samples_calculated']) ? "checked=\"checked\"" : "";?> onclick="calculated_change()" />
<?=gettext("Use calculated value."); ?> <?=gettext("Use calculated value."); ?>
<div class="hidden" for="help_for_avg_delay_samples"> <div class="hidden" for="help_for_avg_delay_samples">
<?=gettext(sprintf("How many replies should be used to compute average delay for controlling \"delay\" alarms? Default is %d.", $apinger_default['avg_delay_samples']));?> <?= sprintf(gettext('How many replies should be used to compute average delay for controlling "delay" alarms? Default is %d.'), $apinger_default['avg_delay_samples']) ?>
</div> </div>
</td> </td>
</tr> </tr>
...@@ -796,7 +796,7 @@ $( document ).ready(function() { ...@@ -796,7 +796,7 @@ $( document ).ready(function() {
<?=gettext("Use calculated value."); ?> <?=gettext("Use calculated value."); ?>
<div class="hidden" for="help_for_avg_loss_samples"> <div class="hidden" for="help_for_avg_loss_samples">
<?=gettext(sprintf("How many probes should be used to compute average packet loss? Default is %d.", $apinger_default['avg_loss_samples']));?> <?= sprintf(gettext('How many probes should be used to compute average packet loss? Default is %d.'), $apinger_default['avg_loss_samples']) ?>
</div> </div>
</td> </td>
</tr> </tr>
...@@ -808,7 +808,7 @@ $( document ).ready(function() { ...@@ -808,7 +808,7 @@ $( document ).ready(function() {
<?=gettext("Use calculated value."); ?> <?=gettext("Use calculated value."); ?>
<div class="hidden" for="help_for_avg_loss_delay_samples"> <div class="hidden" for="help_for_avg_loss_delay_samples">
<?=gettext(sprintf("The delay (in qty of probe samples) after which loss is computed. Without this, delays longer than the probe interval would be treated as packet loss. Default is %d.", $apinger_default['avg_loss_delay_samples']));?> <?= sprintf(gettext('The delay (in qty of probe samples) after which loss is computed. Without this, delays longer than the probe interval would be treated as packet loss. Default is %d.'), $apinger_default['avg_loss_delay_samples']) ?>
</div> </div>
</td> </td>
</tr> </tr>
......
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