Project

General

Profile

« Previous | Next » 

Revision 2fe347eb

Added by Ermal LUÇI about 14 years ago

Actually correctly report the timeleft in log messages. This is mostly cosmetic.

View differences:

etc/inc/voucher.inc
89 89
	global $g, $config;
90 90
	require_once("xmlrpc.inc");
91 91
	if($port == "443") 
92
		$url = "https://{$syncip}:{$port}";
92
		$url = "https://{$syncip}";
93 93
	else 
94
		$url = "http://{$syncip}:{$port}";
94
		$url = "http://{$syncip}";
95 95

  
96 96
	/* Construct code that is run on remote machine */
97 97
	$method = 'pfsense.exec_php';
98 98
	$execcmd  = <<<EOF
99 99
	require_once('/etc/inc/voucher.inc');
100
	\$timeleft = voucher_auth($voucher_received);
100
	\$timeleft = voucher_auth({$voucher_received});
101 101
	\$toreturn = array();
102 102
	\$toreturn['timeleft'] = \$timeleft;
103 103
	\$toreturn['voucher']['roll'] = \$config['voucher']['roll'];
......
132 132
	if(count($toreturn['voucher']['roll']) <> count($config['voucher']['roll'])) {
133 133
		$config['voucher']['roll'] = $toreturn['voucher']['roll'];
134 134
		write_config("Captive Portal Voucher database synchronized with {$url}");
135
		voucher_configure();
135
		voucher_configure(true);
136 136
	}
137 137

  
138 138
	return $toreturn['timeleft'];
......
230 230
                }
231 231
            } else {
232 232
                $test_result[] = "$voucher ($roll/$nr): not found on any registererd Roll";
233
				captiveportal_syslog("$voucher ($roll/$nr): not found on any registererd Roll");
233
		captiveportal_syslog("$voucher ($roll/$nr): not found on any registererd Roll");
234 234
            }
235 235
        } else {
236 236
            // hmm, thats weird ... not what I expected
237 237
            $test_result[] = "$voucher invalid: $result !!";
238
			captiveportal_syslog("$voucher invalid: $result !!");
238
	    captiveportal_syslog("$voucher invalid: $result !!");
239 239
            $error++;
240 240
        }
241 241
    }
......
247 247
        } else {
248 248
            $test_result[] = "Access granted for $total_minutes Minutes in total.";
249 249
        }
250
		unlock($voucherlck);
250
	unlock($voucherlck);
251 251
        return $test_result;
252 252
    }
253 253

  
......
264 264

  
265 265
	// If we did a XMLRPC sync earlier check the timeleft
266 266
	if(!empty($a_voucher['vouchersyncdbip'])) 
267
		if($remote_time_used['timeleft'] < $total_minutes) 
268
			$total_minutes = $remote_time_used['timeleft'];
267
		if($remote_time_used < $total_minutes) 
268
			$total_minutes = $remote_time_used;
269 269

  
270 270
    // All given vouchers were valid and this isn't simply a test.
271 271
    // Write back the used DB's

Also available in: Unified diff