File: operators.php3

package info (click to toggle)
freeradius 2.0.4%2Bdfsg-6
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 14,884 kB
  • ctags: 9,109
  • sloc: ansic: 73,328; sh: 12,392; php: 6,679; perl: 3,075; makefile: 1,316; sql: 1,197; python: 171; tcl: 35; sed: 23
file content (42 lines) | stat: -rw-r--r-- 673 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
$op_eq = '=';
$op_set = ':=';
$op_add = '+=';
$op_eq2 = '==';
$op_ne = '!=';
$op_gt = '>';
$op_ge = '>=';
$op_lt = '<';
$op_le = '<=';
$op_regeq = '=~';
$op_regne = '!~';
$op_exst = '=*';
$op_nexst = '!*';

// Check the operator if it is allowed for this type of
// attribute (check or reply).
// Arguments:
// $op: The operator
// $type: 1(check),2(reply)
// Return value:0 for OK, -1 for error
function check_operator($op,$type)
{
	switch($op){
		case '=':
		case ':=':
		case '+=':
			return 0;
		case '==':
		case '!=':
		case '>':
		case '>=':
		case '<':
		case '<=':
		case '=~':
		case '!~':
		case '=*':
		case '!*':
			return ($type == 1) ? 0 : -1;
	}
}
?>