|
@@ 119-127 (lines=9) @@
|
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
return true; |
| 119 |
|
} elseif ( $cond[0] == '|' ) { // OR (at least one cond passes) |
| 120 |
|
foreach ( array_slice( $cond, 1 ) as $subcond ) { |
| 121 |
|
if ( self::recCheckCondition( $subcond, $user ) ) { |
| 122 |
|
return true; |
| 123 |
|
} |
| 124 |
|
} |
| 125 |
|
|
| 126 |
|
return false; |
| 127 |
|
} elseif ( $cond[0] == '^' ) { // XOR (exactly one cond passes) |
| 128 |
|
if ( count( $cond ) > 3 ) { |
| 129 |
|
wfWarn( 'recCheckCondition() given XOR ("^") condition on three or more conditions.' . |
| 130 |
|
' Check your $wgAutopromote and $wgAutopromoteOnce settings.' ); |
|
@@ 134-142 (lines=9) @@
|
| 131 |
|
} |
| 132 |
|
return self::recCheckCondition( $cond[1], $user ) |
| 133 |
|
xor self::recCheckCondition( $cond[2], $user ); |
| 134 |
|
} elseif ( $cond[0] == '!' ) { // NOT (no conds pass) |
| 135 |
|
foreach ( array_slice( $cond, 1 ) as $subcond ) { |
| 136 |
|
if ( self::recCheckCondition( $subcond, $user ) ) { |
| 137 |
|
return false; |
| 138 |
|
} |
| 139 |
|
} |
| 140 |
|
|
| 141 |
|
return true; |
| 142 |
|
} |
| 143 |
|
} |
| 144 |
|
// If we got here, the array presumably does not contain other conditions; |
| 145 |
|
// it's not recursive. Pass it off to self::checkCondition. |