diff --git a/src/etc/inc/authgui.inc b/src/etc/inc/authgui.inc index 5c10cfdb4..7622f53ab 100644 --- a/src/etc/inc/authgui.inc +++ b/src/etc/inc/authgui.inc @@ -332,7 +332,7 @@ function display_error_form($http_code, $desc) global $config, $g; $g['theme'] = get_current_theme(); if (isAjax()) { - printf(gettext('Error: %1$s Description: %2$s'), $http_code, $desc); + printf(gettext('Error: %s, Description: %s'), $http_code, $desc); return; } diff --git a/src/etc/inc/config.lib.inc b/src/etc/inc/config.lib.inc index b18ed2a8d..9afbb675f 100644 --- a/src/etc/inc/config.lib.inc +++ b/src/etc/inc/config.lib.inc @@ -141,7 +141,7 @@ function convert_config() } if ($prev_version != $config['version']) { - write_config(sprintf(gettext('Upgraded config version level from %1$s to %2$s'), $prev_version, $config['version'])); + write_config(sprintf(gettext('Upgraded config version level from %s to %s'), $prev_version, $config['version'])); } } diff --git a/src/etc/inc/filter.inc b/src/etc/inc/filter.inc index fbaf8f98e..0120d7913 100644 --- a/src/etc/inc/filter.inc +++ b/src/etc/inc/filter.inc @@ -297,7 +297,7 @@ function filter_configure_sync($delete_states_if_needed = true) $line_number = $line_error[1]; $line_split = file('/tmp/rules.debug'); if(is_array($line_split)) { - $line_error = sprintf(gettext('The line in question reads [%1$d]: %2$s'), $line_number, $line_split[$line_number-1]); + $line_error = sprintf(gettext('The line in question reads [%d]: %s'), $line_number, $line_split[$line_number-1]); } unset($line_split); } else { @@ -315,8 +315,8 @@ function filter_configure_sync($delete_states_if_needed = true) unset($rules_loading, $rules_error); if ($line_error and $line_number) { - file_notice("filter_load", sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $saved_line_error, $line_error), "Filter Reload", ""); - update_filter_reload_status(sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $saved_line_error, $line_error)); + file_notice("filter_load", sprintf(gettext('There were error(s) loading the rules: %s - %s'), $saved_line_error, $line_error), "Filter Reload", ""); + update_filter_reload_status(sprintf(gettext('There were error(s) loading the rules: %s - %s'), $saved_line_error, $line_error)); unlock($filterlck); return; } diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index d431e46b3..1fb2c5460 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -1534,7 +1534,7 @@ function interface_ppps_configure($interface) $localips[$pid] = "0.0.0.0"; } if(!is_ipaddr($gateways[$pid])){ - log_error(sprintf(gettext('Could not get a PPTP/L2TP Remote IP address from %1$s for %2$s in interfaces_ppps_configure.'), $dhcp_gateway, $gway)); + log_error(sprintf(gettext('Could not get a PPTP/L2TP Remote IP address from %s for %s in interfaces_ppps_configure.'), $dhcp_gateway, $gway)); return 0; } pfSense_ngctl_attach(".", $port); @@ -2208,7 +2208,7 @@ function interface_wireless_clone($realif, $wlcfg) // example: wlan2 exec("/sbin/ifconfig wlan create wlandev {$baseif} {$mode} bssid 2>&1", $out, $ret); if($ret <> 0) { - log_error(sprintf(gettext('Failed to clone interface %1$s with error code %2$s, output %3$s'), $baseif, $ret, $out[0])); + log_error(sprintf(gettext('Failed to clone interface %s with error code %s, output %s'), $baseif, $ret, $out[0])); return false; } $newif = trim($out[0]); @@ -2931,7 +2931,7 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven " link " . escapeshellarg($random_mac)); $wancfg['spoofmac'] = $random_mac; write_config(); - file_notice("MAC Address altered", sprintf(gettext('The INVALID MAC address (ff:ff:ff:ff:ff:ff) on interface %1$s has been automatically replaced with %2$s'), $realif, $random_mac), "Interfaces"); + file_notice("MAC Address altered", sprintf(gettext('The INVALID MAC address (ff:ff:ff:ff:ff:ff) on interface %s has been automatically replaced with %s'), $realif, $random_mac), "Interfaces"); } } diff --git a/src/etc/inc/notices.inc b/src/etc/inc/notices.inc index 3238e668f..127cdc575 100644 --- a/src/etc/inc/notices.inc +++ b/src/etc/inc/notices.inc @@ -293,8 +293,9 @@ function send_smtp_message($message, $subject = "(no subject)") { log_error(sprintf(gettext("Message sent to %s OK"), $to)); return; } else { - log_error(sprintf(gettext('Could not send the message to %1$s -- Error: %2$s'), $to, $smtp->error)); - return(sprintf(gettext('Could not send the message to %1$s -- Error: %2$s'), $to, $smtp->error)); + $msg = sprintf(gettext('Could not send the message to %s -- Error: %s'), $to, $smtp->error); + log_error($msg); + return ($msg); } } diff --git a/src/etc/inc/notices.smtp.inc b/src/etc/inc/notices.smtp.inc index 6c7b5c1ba..39b0f2cef 100644 --- a/src/etc/inc/notices.smtp.inc +++ b/src/etc/inc/notices.smtp.inc @@ -227,7 +227,7 @@ class smtp_class && !strcmp(@gethostbyname($this->exclude_address),$ip)) return(sprintf(gettext("domain \"%s\" resolved to an address excluded to be valid"), $domain)); if($this->debug) - $this->OutputDebug(sprintf(gettext('Connecting to host address "%1$s" port %2$s...'), $ip, $port)); + $this->OutputDebug(sprintf(gettext('Connecting to host address "%s" port %s...'), $ip, $port)); if(($this->connection=($this->timeout ? @fsockopen(($this->ssl ? "ssl://" : "").$ip,$port,$errno,$error,$this->timeout) : @fsockopen(($this->ssl ? "ssl://" : "").$ip,$port)))) return(""); $error=($this->timeout ? strval($error) : "??"); @@ -244,7 +244,7 @@ class smtp_class case "-7": return(gettext("-7 setvbuf() call failed")); } - return(sprintf(gettext('could not connect to the host "%1$s": %2$s'), $domain, $error)); + return(sprintf(gettext('could not connect to the host "%s": %s'), $domain, $error)); } Function SASLAuthenticate($mechanisms, $credentials, &$authenticated, &$mechanism) diff --git a/src/etc/inc/rrd.inc b/src/etc/inc/rrd.inc index 377f302b2..6d05b4715 100644 --- a/src/etc/inc/rrd.inc +++ b/src/etc/inc/rrd.inc @@ -71,7 +71,7 @@ function create_new_rrd($rrdcreatecmd) { $_gb = exec("$rrdcreatecmd 2>&1", $rrdcreateoutput, $rrdcreatereturn); if ($rrdcreatereturn <> 0) { $rrdcreateoutput = implode(" ", $rrdcreateoutput); - log_error(sprintf(gettext('RRD create failed exited with %1$s, the error is: %2$s'), $rrdcreatereturn, $rrdcreateoutput)); + log_error(sprintf(gettext('RRD create failed exited with %s, the error is: %s'), $rrdcreatereturn, $rrdcreateoutput)); } unset($rrdcreateoutput); return $rrdcreatereturn; diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index e1702d8d2..0a83c4197 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -422,7 +422,7 @@ function services_dhcpdv4_configure() exec('cd /;LANG=C /usr/bin/tar -xzf /conf/dhcpleases.tgz 2>&1', $dhcprestore, $dhcpreturn); $dhcprestore = implode(' ', $dhcprestore); if($dhcpreturn <> 0) { - log_error(sprintf(gettext('DHCP leases restore failed exited with %1$s, the error is: %2$s%3$s'), $dhcpreturn, $dhcprestore, "\n")); + log_error(sprintf(gettext('DHCP leases restore failed exited with %s, the error is: %s'), $dhcpreturn, $dhcprestore)); } } } diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index 7148870e4..70634910a 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -608,7 +608,7 @@ function compare_hostname_to_dnscache($hostname) { } if(trim($oldcontents) != trim($contents)) { - log_error(sprintf(gettext('DNSCACHE: Found old IP %1$s and new IP %2$s'), $oldcontents, $contents)); + log_error(sprintf(gettext('DNSCACHE: Found old IP %s and new IP %s'), $oldcontents, $contents)); return ($oldcontents); } else { return false; diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index 6ca92ad42..251d2fd1e 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -37,7 +37,7 @@ function dump_rrd_to_xml($rrddatabase, $xmldumpfile) exec("$rrdtool dump " . escapeshellarg($rrddatabase) . " {$xmldumpfile} 2>&1", $dumpout, $dumpret); if ($dumpret <> 0) { $dumpout = implode(" ", $dumpout); - log_error(sprintf(gettext('RRD dump failed exited with %1$s, the error is: %2$s'), $dumpret, $dumpout)); + log_error(sprintf(gettext('RRD dump failed exited with %s, the error is: %s'), $dumpret, $dumpout)); } return($dumpret); @@ -53,7 +53,7 @@ function migrate_rrd_format($rrdoldxml, $rrdnewxml) { $numrranew = count($rrdnewxml['rra']); $numdsold = count($rrdoldxml['ds']); $numdsnew = count($rrdnewxml['ds']); - log_error(sprintf(gettext('Import RRD has %1$s DS values and %2$s RRA databases, new format RRD has %3$s DS values and %4$s RRA databases'), $numdsold, $numrraold, $numdsnew ,$numrranew)); + log_error(sprintf(gettext('Import RRD has %s DS values and %s RRA databases, new format RRD has %s DS values and %s RRA databases'), $numdsold, $numrraold, $numdsnew ,$numrranew)); /* add data sources not found in the old array from the new array */ $i = 0; @@ -137,7 +137,7 @@ function migrate_rrd_format($rrdoldxml, $rrdnewxml) { $numrranew = count($rrdoldxml['rra']); $numdsnew = count($rrdoldxml['ds']); - log_error(sprintf(gettext('The new RRD now has %1$s DS values and %2$s RRA databases'), $numdsnew, $numrranew)); + log_error(sprintf(gettext('The new RRD now has %s DS values and %s RRA databases'), $numdsnew, $numrranew)); return $rrdoldxml; } diff --git a/src/etc/inc/xmlparse.inc b/src/etc/inc/xmlparse.inc index ff071ecf5..cd5df6815 100644 --- a/src/etc/inc/xmlparse.inc +++ b/src/etc/inc/xmlparse.inc @@ -80,7 +80,7 @@ function startElement($parser, $name, $attrs) { } else if (isset($ptr)) { /* multiple entries not allowed for this element, bail out */ - die(sprintf(gettext('XML error: %1$s at line %2$d cannot occur more than once') . "\n", + die(sprintf(gettext('XML error: %s at line %d cannot occur more than once') . "\n", $name, xml_get_current_line_number($parser))); } @@ -162,7 +162,7 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") { while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { - log_error(sprintf(gettext('XML error: %1$s at line %2$d in %3$s') . "\n", + log_error(sprintf(gettext('XML error: %s at line %d in %s') . "\n", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser), $cffile)); diff --git a/src/etc/rc.carpbackup b/src/etc/rc.carpbackup index 9b279c703..7a6ad3dea 100755 --- a/src/etc/rc.carpbackup +++ b/src/etc/rc.carpbackup @@ -42,7 +42,7 @@ list($vhid, $iface) = explode("@", $argument); $friendly = convert_real_interface_to_friendly_interface_name($iface); $carp_iface = "{$friendly}_vip{$vhid}"; $friendly_descr = convert_friendly_interface_to_friendly_descr($carp_iface); -$notificationmsg = sprintf('Carp cluster member "%2$s (%1$s)" has resumed the state "BACKUP" for vhid %s', $argument, $friendly_descr, $vhid); +$notificationmsg = sprintf('Carp cluster member "%s (%s)" has resumed the state "BACKUP" for vhid %s', $friendly_descr, $argument, $vhid); notify_via_smtp($notificationmsg); notify_via_growl($notificationmsg); diff --git a/src/etc/rc.carpmaster b/src/etc/rc.carpmaster index 038eb08a1..ef83444c6 100755 --- a/src/etc/rc.carpmaster +++ b/src/etc/rc.carpmaster @@ -42,7 +42,7 @@ list($vhid, $iface) = explode("@", $argument); $friendly = convert_real_interface_to_friendly_interface_name($iface); $carp_iface = "{$friendly}_vip${vhid}"; $friendly_descr = convert_friendly_interface_to_friendly_descr($carp_iface); -$notificationmsg = sprintf('Carp cluster member "%2$s (%1$s)" has resumed the state "MASTER" for vhid %s', $argument, $friendly_descr, $vhid); +$notificationmsg = sprintf('Carp cluster member "%s (%s)" has resumed the state "MASTER" for vhid %s', $friendly_descr, $argument, $vhid); notify_via_smtp($notificationmsg); notify_via_growl($notificationmsg); diff --git a/src/etc/rc.restore_config_backup b/src/etc/rc.restore_config_backup index ededc77b1..1befa3bd2 100755 --- a/src/etc/rc.restore_config_backup +++ b/src/etc/rc.restore_config_backup @@ -73,7 +73,7 @@ function restore_history_backup($number) { $cnf = OPNsense\Core\Config::getInstance(); if($cnf->restoreBackup($filename)){ echo "\n"; - echo sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $thisbackup['time']), $thisbackup['description']); + echo sprintf(gettext('Successfully reverted to timestamp %s with description "%s".'), date(gettext("n/j/y H:i:s"), $thisbackup['time']), $thisbackup['description']); echo "\n" . gettext("You may need to reboot the firewall or restart services before the restored configuration is fully active.") . "\n\n"; } else { echo gettext("Unable to revert to the selected configuration.") . "\n"; diff --git a/src/www/diag_confbak.php b/src/www/diag_confbak.php index 483d04a94..d5ef5976a 100644 --- a/src/www/diag_confbak.php +++ b/src/www/diag_confbak.php @@ -44,7 +44,7 @@ if (isset($_POST['backupcount'])) { foreach ($confvers as $filename => $revision) { if (isset($revision['time']) && $revision['time'] == $_POST['newver']) { if (config_restore($filename)== 0) { - $savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['newver']), $revision['description']); + $savemsg = sprintf(gettext('Successfully reverted to timestamp %s with description "%s".'), date(gettext("n/j/y H:i:s"), $_POST['newver']), $revision['description']); } else { $savemsg = gettext("Unable to revert to the selected configuration."); } @@ -56,7 +56,7 @@ if (isset($_POST['backupcount'])) { if (isset($revision['time']) && $revision['time'] == $_POST['rmver']) { if (file_exists($filename)) { @unlink($filename); - $savemsg = sprintf(gettext('Deleted backup with timestamp %1$s and description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['rmver']),$revision['description']); + $savemsg = sprintf(gettext('Deleted backup with timestamp %s and description "%s".'), date(gettext("n/j/y H:i:s"), $_POST['rmver']),$revision['description']); } else { $savemsg = gettext("Unable to delete the selected configuration."); } @@ -170,7 +170,7 @@ include("head.inc");
: - +
diff --git a/src/www/diag_logs_filter.php b/src/www/diag_logs_filter.php index 52b6d9e1f..6149b9393 100644 --- a/src/www/diag_logs_filter.php +++ b/src/www/diag_logs_filter.php @@ -391,7 +391,7 @@ function get_port_with_service($port, $proto) { $service = getservbyport($port, $proto); $portstr = ""; if ($service) { - $portstr = sprintf('' . htmlspecialchars($port) . '', $port, $proto, $service); + $portstr = sprintf('' . htmlspecialchars($port) . '', $port, $proto, $service); } else { $portstr = htmlspecialchars($port); } diff --git a/src/www/firewall_nat_out.php b/src/www/firewall_nat_out.php index 09922ee80..5aa242446 100644 --- a/src/www/firewall_nat_out.php +++ b/src/www/firewall_nat_out.php @@ -80,9 +80,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { foreach ($tonathosts as $tonathost) { foreach ($automatic_rules as $natent) { $natent['source']['network'] = $tonathost['subnet']; - $natent['descr'] .= sprintf(gettext(' - %1$s to %2$s'), - $tonathost['descr'], - convert_real_interface_to_friendly_descr($natent['interface'])); + $natent['descr'] .= ' - ' . $tonathost['descr'] . ' -> ' . convert_real_interface_to_friendly_descr($natent['interface']); $natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch")); /* Try to detect already auto created rules and avoid duplicate them */ diff --git a/src/www/interfaces.php b/src/www/interfaces.php index beae9fb38..7e466f24e 100644 --- a/src/www/interfaces.php +++ b/src/www/interfaces.php @@ -89,7 +89,7 @@ function startElement_attr($parser, $name, $attrs) { } else if (isset($ptr)) { /* multiple entries not allowed for this element, bail out */ - die(sprintf(gettext('XML error: %1$s at line %2$d cannot occur more than once') . "\n", + die(sprintf(gettext('XML error: %s at line %d cannot occur more than once') . "\n", $name, xml_get_current_line_number($parser))); } else if (isset($writeattrs)) { @@ -211,7 +211,7 @@ function parse_xml_config_raw_attr($cffile, $rootobj, &$parsed_attributes, $isst while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { - log_error(sprintf(gettext('XML error: %1$s at line %2$d') . "\n", + log_error(sprintf(gettext('XML error: %s at line %d') . "\n", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); if (isset($parsed_attributes)) { diff --git a/src/www/interfaces_assign.php b/src/www/interfaces_assign.php index cee60466e..f1812b803 100644 --- a/src/www/interfaces_assign.php +++ b/src/www/interfaces_assign.php @@ -43,7 +43,7 @@ require_once("unbound.inc"); function interface_assign_description($portinfo, $portname) { if ($portinfo['isvlan']) { - $descr = sprintf(gettext('VLAN %1$s on %2$s'),$portinfo['tag'],$portinfo['if']); + $descr = sprintf(gettext('VLAN %s on %s'),$portinfo['tag'],$portinfo['if']); if ($portinfo['descr']) $descr .= " (" . $portinfo['descr'] . ")"; } elseif ($portinfo['iswlclone']) { @@ -268,9 +268,7 @@ if (isset($_POST['add_x']) && isset($_POST['if_add'])) { /* Deliver error message for any port with more than one assignment */ foreach ($portifmap as $portname => $ifnames) { if (count($ifnames) > 1) { - $errstr = sprintf(gettext('Port %1$s '. - ' was assigned to %2$s' . - ' interfaces:'), $portname, count($ifnames)); + $errstr = sprintf(gettext('Port %s was assigned to %d interfaces:'), $portname, count($ifnames)); foreach ($portifmap[$portname] as $ifn) $errstr .= " " . $ifn; diff --git a/src/www/interfaces_wireless_edit.php b/src/www/interfaces_wireless_edit.php index 54eb108de..22bfed10d 100644 --- a/src/www/interfaces_wireless_edit.php +++ b/src/www/interfaces_wireless_edit.php @@ -115,7 +115,7 @@ if ($_POST) { } if (!$input_errors) { if (!interface_wireless_clone($clone['cloneif'], $clone)) { - $input_errors[] = sprintf(gettext('Error creating interface with mode %1$s. The %2$s interface may not support creating more clones with the selected mode.'), $wlan_modes[$clone['mode']], $clone['if']); + $input_errors[] = sprintf(gettext('Error creating interface with mode %s. The %s interface may not support creating more clones with the selected mode.'), $wlan_modes[$clone['mode']], $clone['if']); } else { if (isset($id) && $a_clones[$id]) { if ($clone['if'] != $a_clones[$id]['if']) diff --git a/src/www/services_wol.php b/src/www/services_wol.php index 8e6eaac48..709d0a52a 100644 --- a/src/www/services_wol.php +++ b/src/www/services_wol.php @@ -1,4 +1,5 @@ . @@ -50,10 +51,11 @@ if($_GET['wakeall'] <> "") { continue; $bcip = gen_subnet_max($ipaddr, get_interface_subnet($if)); /* Execute wol command and check return code. */ - if (!mwexec("/usr/local/bin/wol -i {$bcip} {$mac}")) - $savemsg .= sprintf(gettext('Sent magic packet to %1$s (%2$s)%3$s'),$mac, $description, ".
"); - else - $savemsg .= sprintf(gettext('Please check the %1$ssystem log%2$s, the wol command for %3$s (%4$s) did not complete successfully%5$s'),'','',$description,$mac,".
"); + if (!mwexec("/usr/local/bin/wol -i {$bcip} {$mac}")) { + $savemsg = sprintf(gettext('Sent magic packet to %s (%s).'), $mac, $description); + } else { + $savemsg = sprintf(gettext('Please check the %ssystem log%s, the wol command for %s (%s) did not complete successfully.'), '', '', $description, $mac); + } } } @@ -86,10 +88,11 @@ if ($_POST || $_GET['mac']) { else { $bcip = gen_subnet_max($ipaddr, get_interface_subnet($if)); /* Execute wol command and check return code. */ - if(!mwexec("/usr/local/bin/wol -i {$bcip} " . escapeshellarg($mac))) - $savemsg .= sprintf(gettext("Sent magic packet to %s."),$mac); - else - $savemsg .= sprintf(gettext('Please check the %1$ssystem log%2$s, the wol command for %3$s did not complete successfully%4$s'),'', '', $mac, ".
"); + if(!mwexec("/usr/local/bin/wol -i {$bcip} " . escapeshellarg($mac))) { + $savemsg = sprintf(gettext('Sent magic packet to %s.'), $mac); + } else { + $savemsg = sprintf(gettext('Please check the %ssystem log%s, the wol command for %s did not complete successfully.'), '', '', $mac); + } } } } diff --git a/src/www/vpn_ipsec_phase1.php b/src/www/vpn_ipsec_phase1.php index 1e56d0d66..466800445 100644 --- a/src/www/vpn_ipsec_phase1.php +++ b/src/www/vpn_ipsec_phase1.php @@ -230,7 +230,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { foreach ($a_phase1 as $ph1tmp) { if ($p1index <> $t) { if (isset($ph1tmp['remote-gateway']) && $ph1tmp['remote-gateway'] == $pconfig['remote-gateway'] && !isset($ph1tmp['disabled'])) { - $input_errors[] = sprintf(gettext('The remote gateway "%1$s" is already used by phase1 "%2$s".'), $pconfig['remote-gateway'], $ph1tmp['descr']); + $input_errors[] = sprintf(gettext('The remote gateway "%s" is already used by phase1 "%s".'), $pconfig['remote-gateway'], $ph1tmp['descr']); } } $t++;