Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function _executeRules($s, $RULES, $CF, $M1, $M2, $FI, $ARGS=array()){
- $vars = explode(" ", "CF M1 M2 FI");
- foreach($ARGS as $k => $v){
- if(@eval(($_code="\$$k = \$ARGS['$k'];")." return true;") !== true){
- throw new Exception(__("ERROR: cant execute code: '%s'", $_code));
- }
- $vars[] = $k;
- }
- foreach($RULES as $_rule){
- if(($_rule=trim($_rule)) == ""){
- continue;
- }
- if(!preg_match("!^[\[\|]([\+\-])[\]\|]:[ ]+(.+)$!", $_rule, $_m) or !(list($_, $op, $code)=$_m)){
- throw new Exception(__("ERROR: cant parse rule: '%s'", $_rule));
- }
- $code = trim(preg_replace(__("!( |[\(\)]|^)((?:%s))( |\(\)]|$)!", implode('|', $vars)), "$1\$$2$3", $code));
- $_we_have_it = true;
- if($code != "any"){
- $_we_have_it = false;
- if(@eval("\$_we_have_it=($code); return true;") !== true){
- throw new Exception(__("ERROR: cant execute code: '%s'", $code));
- }
- #echo "$op: $code: "; var_dump($_we_have_it); echo "\n\n";
- }
- if($_we_have_it){
- $status = ($op == '+');
- $s->_echo( __("[#] %s by $_rule \n", ($status ? 'ALLOWED': 'DENIED')) );
- return $status;
- }
- }
- throw new Exception(__("ERROR: something`s going wrong while exec BURGER_RULES"));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement