summaryrefslogtreecommitdiffstats
path: root/etc/inc/voucher.inc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-12-17 23:28:03 +0000
committerErmal <eri@pfsense.org>2010-12-17 23:28:03 +0000
commit7afb7ea90030af16cc6da390d8862a65bf11cb04 (patch)
tree09885f421bea101ee8461afb06e7ca4cfd44510c /etc/inc/voucher.inc
parent67b057a99332b33321bc08cd6f2b96d545f40665 (diff)
downloadpfsense-7afb7ea90030af16cc6da390d8862a65bf11cb04.zip
pfsense-7afb7ea90030af16cc6da390d8862a65bf11cb04.tar.gz
Safe belts to avoid errors.
Diffstat (limited to 'etc/inc/voucher.inc')
-rw-r--r--etc/inc/voucher.inc19
1 files changed, 11 insertions, 8 deletions
diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc
index ddd8ab4..5c1d132 100644
--- a/etc/inc/voucher.inc
+++ b/etc/inc/voucher.inc
@@ -108,12 +108,16 @@ function voucher_auth($voucher_received, $test = 0) {
$remote_time_used = xmlrpc_sync_used_voucher($voucher_received, $syncip, $syncport, $syncpass, $vouchersyncusername);
}
- // read rolls into assoc array with rollid as key and minutes as value
- $a_roll = &$config['voucher']['roll'];
- foreach ($a_roll as $rollent) {
- $tickets_per_roll[$rollent['number']] = $rollent['count'];
- $minutes_per_roll[$rollent['number']] = $rollent['minutes'];
- }
+ // read rolls into assoc array with rollid as key and minutes as value
+ $tickets_per_roll = array();
+ $minutes_per_roll = array();
+ if (is_array($config['voucher']['roll'])) {
+ $a_roll = &$config['voucher']['roll'];
+ foreach ($a_roll as $rollent) {
+ $tickets_per_roll[$rollent['number']] = $rollent['count'];
+ $minutes_per_roll[$rollent['number']] = $rollent['minutes'];
+ }
+ }
// split into an array. Useful for multiple vouchers given
$a_vouchers_received = split("[\t\n\r ]+",$voucher_received);
@@ -289,13 +293,12 @@ function voucher_configure() {
@chmod("{$g['varetc_path']}/voucher.cfg", 0600);
unlock($voucherlck);
- if ($g['booting']) {
+ if ($g['booting'] && is_array($config['voucher']['roll'])) {
// create active and used DB per roll on ramdisk from config
$a_roll = &$config['voucher']['roll'];
$voucherlck = lock('voucher');
- if (is_array($a_roll))
foreach ($a_roll as $rollent) {
$roll = $rollent['number'];
OpenPOWER on IntegriCloud