Revision 85ee73a5
Added by Stephen Beaver almost 10 years ago
src/usr/local/www/services_captiveportal_vouchers.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
/* |
3 | 3 |
services_captiveportal_vouchers.php |
4 |
|
|
5 |
Copyright (C) 2013-2015 Electric Sheep Fencing, LP |
|
6 |
Copyright (C) 2007 Marcel Wiget <mwiget@mac.com> |
|
7 |
All rights reserved. |
|
8 |
|
|
9 |
Redistribution and use in source and binary forms, with or without |
|
10 |
modification, are permitted provided that the following conditions are met: |
|
11 |
|
|
12 |
1. Redistributions of source code must retain the above copyright notice, |
|
13 |
this list of conditions and the following disclaimer. |
|
14 |
|
|
15 |
2. Redistributions in binary form must reproduce the above copyright |
|
16 |
notice, this list of conditions and the following disclaimer in the |
|
17 |
documentation and/or other materials provided with the distribution. |
|
18 |
|
|
19 |
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
|
20 |
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
21 |
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
22 |
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, |
|
23 |
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
24 |
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
25 |
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
26 |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
27 |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
28 |
POSSIBILITY OF SUCH DAMAGE. |
|
29 | 4 |
*/ |
5 |
/* ==================================================================== |
|
6 |
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved. |
|
7 |
* Copyright (c) 2004, 2005 Scott Ullrich |
|
8 |
* Copyright (c) 2 007 Marcel Wiget <mwiget@mac.com> |
|
9 |
* |
|
10 |
* Redistribution and use in source and binary forms, with or without modification, |
|
11 |
* are permitted provided that the following conditions are met: |
|
12 |
* |
|
13 |
* 1. Redistributions of source code must retain the above copyright notice, |
|
14 |
* this list of conditions and the following disclaimer. |
|
15 |
* |
|
16 |
* 2. Redistributions in binary form must reproduce the above copyright |
|
17 |
* notice, this list of conditions and the following disclaimer in |
|
18 |
* the documentation and/or other materials provided with the |
|
19 |
* distribution. |
|
20 |
* |
|
21 |
* 3. All advertising materials mentioning features or use of this software |
|
22 |
* must display the following acknowledgment: |
|
23 |
* "This product includes software developed by the pfSense Project |
|
24 |
* for use in the pfSense software distribution. (http://www.pfsense.org/). |
|
25 |
* |
|
26 |
* 4. The names "pfSense" and "pfSense Project" must not be used to |
|
27 |
* endorse or promote products derived from this software without |
|
28 |
* prior written permission. For written permission, please contact |
|
29 |
* coreteam@pfsense.org. |
|
30 |
* |
|
31 |
* 5. Products derived from this software may not be called "pfSense" |
|
32 |
* nor may "pfSense" appear in their names without prior written |
|
33 |
* permission of the Electric Sheep Fencing, LLC. |
|
34 |
* |
|
35 |
* 6. Redistributions of any form whatsoever must retain the following |
|
36 |
* acknowledgment: |
|
37 |
* |
|
38 |
* "This product includes software developed by the pfSense Project |
|
39 |
* for use in the pfSense software distribution (http://www.pfsense.org/). |
|
40 |
* |
|
41 |
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY |
|
42 |
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
43 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
44 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR |
|
45 |
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
46 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
|
47 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
48 |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
49 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
|
50 |
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
51 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
|
52 |
* OF THE POSSIBILITY OF SUCH DAMAGE. |
|
53 |
* |
|
54 |
* ==================================================================== |
|
55 |
* |
|
56 |
*/ |
|
30 | 57 |
/* |
31 | 58 |
pfSense_BUILDER_BINARIES: /usr/local/bin/voucher /usr/bin/openssl |
32 | 59 |
pfSense_MODULE: captiveportal |
... | ... | |
104 | 131 |
$config['voucher'][$cpzone]['checksumbits'] = 5; |
105 | 132 |
} |
106 | 133 |
if (!isset($config['voucher'][$cpzone]['magic'])) { |
107 |
$config['voucher'][$cpzone]['magic'] = rand(); // anything slightly random will do
|
|
134 |
$config['voucher'][$cpzone]['magic'] = rand(); // anything slightly random will do
|
|
108 | 135 |
} |
109 | 136 |
if (!isset($config['voucher'][$cpzone]['exponent'])) { |
110 | 137 |
while (true) { |
... | ... | |
292 | 319 |
$newvoucher['vouchersyncusername'] = $_POST['vouchersyncusername']; |
293 | 320 |
$newvoucher['vouchersyncpass'] = $_POST['vouchersyncpass']; |
294 | 321 |
if ($newvoucher['vouchersyncpass'] && $newvoucher['vouchersyncusername'] && |
295 |
$newvoucher['vouchersyncport'] && $newvoucher['vouchersyncdbip']) {
|
|
322 |
$newvoucher['vouchersyncport'] && $newvoucher['vouchersyncdbip']) {
|
|
296 | 323 |
// Synchronize the voucher DB from the master node |
297 | 324 |
require_once("xmlrpc.inc"); |
298 | 325 |
|
299 | 326 |
$protocol = "http"; |
300 | 327 |
if (is_array($config['system']) && is_array($config['system']['webgui']) && !empty($config['system']['webgui']['protocol']) && |
301 |
$config['system']['webgui']['protocol'] == "https") {
|
|
328 |
$config['system']['webgui']['protocol'] == "https") {
|
|
302 | 329 |
$protocol = "https"; |
303 | 330 |
} |
304 | 331 |
if ($protocol == "https" || $newvoucher['vouchersyncport'] == "443") { |
... | ... | |
387 | 414 |
} |
388 | 415 |
} |
389 | 416 |
} |
417 |
|
|
390 | 418 |
if (!$input_errors) { |
391 | 419 |
header("Location: services_captiveportal_vouchers.php?zone={$cpzone}"); |
392 | 420 |
exit; |
... | ... | |
446 | 474 |
<?=htmlspecialchars($rollent['descr']); ?> |
447 | 475 |
</td> |
448 | 476 |
<td> |
449 |
<!-- These buttons are hidden/shown on checking hte 'enable' checkbox -->
|
|
477 |
<!-- These buttons are hidden/shown on checking the 'enable' checkbox -->
|
|
450 | 478 |
<a href="services_captiveportal_vouchers_edit.php?zone=<?=$cpzone?>&id=<?=$i; ?>" class="btn btn-info btn-xs"><?=gettext("Edit")?></a> |
451 | 479 |
<a href="services_captiveportal_vouchers.php?zone=<?=$cpzone?>&act=del&id=<?=$i; ?>" class="btn btn-danger btn-xs"><?=gettext("Delete")?></a> |
452 | 480 |
<a href="services_captiveportal_vouchers.php?zone=<?=$cpzone?>&act=csv&id=<?=$i; ?>" class="btn btn-success btn-xs" data-toggle="tooltip" title="Generate vouchers for this roll to a .csv file""><?=gettext("Generate")?></a> |
... | ... | |
462 | 490 |
</div> |
463 | 491 |
</div> |
464 | 492 |
<?php |
493 |
|
|
465 | 494 |
if ($pconfig['enable']) : ?> |
466 | 495 |
<nav class="action-buttons"> |
467 |
<a href="services_captiveportal_vouchers_edit.php?zone=<?$cpzone?>" class="btn btn-success"><?=gettext("Add Voucher")?></a> |
|
496 |
<a href="services_captiveportal_vouchers_edit.php?zone=<?=$cpzone?>" class="btn btn-success"><?=gettext("Add Voucher")?></a>
|
|
468 | 497 |
</nav> |
469 | 498 |
<?php |
470 | 499 |
endif; |
Also available in: Unified diff
Fixed #5110
=$cpzone?> missing '='