Revision 0ddd0636
Added by Carlos Eduardo Ramos almost 15 years ago
usr/local/www/services_captiveportal_mac_edit.php | ||
---|---|---|
48 | 48 |
usort($config['captiveportal']['passthrumac'],"passthrumacscmp"); |
49 | 49 |
} |
50 | 50 |
|
51 |
$pgtitle = array("Services","Captive portal","Edit pass-through MAC address"); |
|
52 | 51 |
$statusurl = "status_captiveportal.php"; |
53 | 52 |
$logurl = "diag_logs_auth.php"; |
54 | 53 |
|
... | ... | |
58 | 57 |
require("shaper.inc"); |
59 | 58 |
require("captiveportal.inc"); |
60 | 59 |
|
60 |
$pgtitle = array(gettext("Services"),gettext("Captive portal"),gettext("Edit pass-through MAC address")); |
|
61 |
|
|
61 | 62 |
if (!is_array($config['captiveportal']['passthrumac'])) |
62 | 63 |
$config['captiveportal']['passthrumac'] = array(); |
63 | 64 |
|
... | ... | |
81 | 82 |
|
82 | 83 |
/* input validation */ |
83 | 84 |
$reqdfields = explode(" ", "mac"); |
84 |
$reqdfieldsn = explode(",", "MAC address");
|
|
85 |
$reqdfieldsn = array(gettext("MAC address"));
|
|
85 | 86 |
|
86 | 87 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); |
87 | 88 |
|
88 | 89 |
$_POST['mac'] = str_replace("-", ":", $_POST['mac']); |
89 | 90 |
|
90 | 91 |
if (($_POST['mac'] && !is_macaddr($_POST['mac']))) { |
91 |
$input_errors[] = "A valid MAC address must be specified. [".$_POST['mac']."]";
|
|
92 |
$input_errors[] = sprintf("%s. [%s]", gettext("A valid MAC address must be specified"), $_POST['mac']);
|
|
92 | 93 |
} |
93 | 94 |
if ($_POST['bw_up'] && !is_numeric($_POST['bw_up'])) |
94 |
$input_errors[] = "Upload speed needs to be an integer";
|
|
95 |
$input_errors[] = gettext("Upload speed needs to be an integer");
|
|
95 | 96 |
if ($_POST['bw_down'] && !is_numeric($_POST['bw_down'])) |
96 |
$input_errors[] = "Download speed needs to be an integer";
|
|
97 |
$input_errors[] = gettext("Download speed needs to be an integer");
|
|
97 | 98 |
|
98 | 99 |
foreach ($a_passthrumacs as $macent) { |
99 | 100 |
if (isset($id) && ($a_passthrumacs[$id]) && ($a_passthrumacs[$id] === $macent)) |
100 | 101 |
continue; |
101 | 102 |
|
102 | 103 |
if ($macent['mac'] == $_POST['mac']){ |
103 |
$input_errors[] = "[" . $_POST['mac'] . "] already allowed." ;
|
|
104 |
$input_errors[] = sprintf("[%s] %s.", $_POST['mac'], gettext("already allowed"));
|
|
104 | 105 |
break; |
105 | 106 |
} |
106 | 107 |
} |
... | ... | |
129 | 130 |
$ruleno = captiveportal_get_ipfw_passthru_ruleno($oldmac); |
130 | 131 |
if ($ruleno) { |
131 | 132 |
captiveportal_free_ipfw_ruleno($ruleno); |
132 |
$rules = "delete {$ruleno}\n";
|
|
133 |
$rules .= "delete " . ++$ruleno . "\n";
|
|
133 |
$rules = sprintf("%s %s\n", gettext("delete"), $ruleno);
|
|
134 |
$rules .= gettext("delete") . " " . ++$ruleno . "\n";
|
|
134 | 135 |
$rules .= captiveportal_passthrumac_configure_entry($mac); |
135 | 136 |
file_put_contents("{$g['tmp_path']}/tmpmacedit{$id}", $rules); |
136 | 137 |
mwexec("/sbin/ipfw -q {$g['tmp_path']}/tmpmacedit{$id}"); |
... | ... | |
149 | 150 |
<form action="services_captiveportal_mac_edit.php" method="post" name="iform" id="iform"> |
150 | 151 |
<table width="100%" border="0" cellpadding="6" cellspacing="0"> |
151 | 152 |
<tr> |
152 |
<td width="22%" valign="top" class="vncellreq">MAC address</td>
|
|
153 |
<td width="22%" valign="top" class="vncellreq"><?=gettext("MAC address"); ?></td>
|
|
153 | 154 |
<td width="78%" class="vtable"> |
154 | 155 |
<?=$mandfldhtml;?><input name="mac" type="text" class="formfld unknown" id="mac" size="17" value="<?=htmlspecialchars($pconfig['mac']);?>"> |
155 | 156 |
<br> |
156 |
<span class="vexpl">MAC address (6 hex octets separated by colons)</span></td>
|
|
157 |
<span class="vexpl"><?=gettext("MAC address (6 hex octets separated by colons)"); ?></span></td>
|
|
157 | 158 |
</tr> |
158 | 159 |
<tr> |
159 |
<td width="22%" valign="top" class="vncell">Description</td>
|
|
160 |
<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
|
|
160 | 161 |
<td width="78%" class="vtable"> |
161 | 162 |
<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> |
162 |
<br> <span class="vexpl">You may enter a description here
|
|
163 |
for your reference (not parsed).</span></td>
|
|
163 |
<br> <span class="vexpl"><?=gettext("You may enter a description here " .
|
|
164 |
"for your reference (not parsed)"); ?>.</span></td>
|
|
164 | 165 |
</tr> |
165 | 166 |
<tr> |
166 |
<td width="22%" valign="top" class="vncell">Bandwidth up</td>
|
|
167 |
<td width="22%" valign="top" class="vncell"><?=gettext("Bandwidth up"); ?></td>
|
|
167 | 168 |
<td width="78%" class="vtable"> |
168 | 169 |
<input name="bw_up" type="text" class="formfld unknown" id="bw_up" size="10" value="<?=htmlspecialchars($pconfig['bw_up']);?>"> |
169 |
<br> <span class="vexpl">Enter a upload limit to be enforced on this MAC address in Kbit/s</span></td>
|
|
170 |
<br> <span class="vexpl"><?=gettext("Enter a upload limit to be enforced on this MAC address in Kbit/s"); ?></span></td>
|
|
170 | 171 |
</tr> |
171 | 172 |
<tr> |
172 |
<td width="22%" valign="top" class="vncell">Bandwidth down</td>
|
|
173 |
<td width="22%" valign="top" class="vncell"><?=gettext("Bandwidth down"); ?></td>
|
|
173 | 174 |
<td width="78%" class="vtable"> |
174 | 175 |
<input name="bw_down" type="text" class="formfld unknown" id="bw_down" size="10" value="<?=htmlspecialchars($pconfig['bw_down']);?>"> |
175 |
<br> <span class="vexpl">Enter a download limit to be enforced on this MAC address in Kbit/s</span></td>
|
|
176 |
<br> <span class="vexpl"><?=gettext("Enter a download limit to be enforced on this MAC address in Kbit/s"); ?></span></td>
|
|
176 | 177 |
</tr> |
177 | 178 |
<tr> |
178 | 179 |
<td width="22%" valign="top"> </td> |
179 | 180 |
<td width="78%"> |
180 |
<input name="Submit" type="submit" class="formbtn" value="Save">
|
|
181 |
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>">
|
|
181 | 182 |
<?php if (isset($id) && $a_passthrumacs[$id]): ?> |
182 | 183 |
<input name="id" type="hidden" value="<?=$id;?>"> |
183 | 184 |
<?php endif; ?> |
Also available in: Unified diff
Implement gettext() calls on services_captiveportal_mac_edit.php