Ticket #2574: allow2.diff

File allow2.diff, 2.5 kB (added by pnlarsson, 4 years ago)

In the switch statement instead - only >=1.4 are sending warnings about the empty allow

  • functions.inc.php

    old new  
    147147    // 
    148148    if (version_compare($ast_version, "1.4", "ge")) {  
    149149      $call_limit = "call-limit=50\n"; 
     150      $ver12 = false; 
    150151    } else { 
    151152      $call_limit = ""; 
     153      $ver12 = true; 
    152154    } 
    153155 
    154156    $sql = "SELECT keyword,data from $table_name where id=-1 and keyword <> 'account' and flags <> 1"; 
     
    157159      die($results->getMessage()); 
    158160    } 
    159161    foreach ($results as $result) { 
    160       $additional .= $result['keyword']."=".$result['data']."\n"; 
     162      if ($ver12) { 
     163        $additional .= $result['keyword']."=".$result['data']."\n"; 
     164      } else { 
     165        $option = $result['data']; 
     166        switch ($result['keyword']) { 
     167          case 'allow': 
     168          case 'disallow': 
     169            if ($option != '') 
     170              $additional .= $result['keyword']."=$option\n"; 
     171            break; 
     172          default: 
     173            $additional .= $result['keyword']."=$option\n"; 
     174        } 
     175      } 
    161176    } 
    162177 
    163178    $sql = "SELECT data,id from $table_name where keyword='account' and flags <> 1 group by data"; 
     
    178193      } 
    179194      foreach ($results2 as $result2) { 
    180195        $options = explode("&", $result2['data']); 
    181         foreach ($options as $option) { 
    182           $output .= $result2['keyword']."=$option\n"; 
     196        if ($ver12) { 
     197          foreach ($options as $option) { 
     198            $output .= $result2['keyword']."=$option\n"; 
     199          } 
     200        } else { 
     201          foreach ($options as $option) { 
     202            switch ($result2['keyword']) { 
     203              case 'allow': 
     204              case 'disallow': 
     205                if ($option != '') 
     206                  $output .= $result2['keyword']."=$option\n"; 
     207                break; 
     208              default: 
     209                $output .= $result2['keyword']."=$option\n"; 
     210            } 
     211          } 
    183212        } 
    184213      } 
    185214      if ($call_limit && ($id < 999900)) { 
     
    242271              $additional .= $result['keyword']."=$option\n"; 
    243272            } 
    244273            break; 
     274          case 'allow': 
     275          case 'disallow': 
     276            if ($option != '') 
     277              $additional .= $result['keyword']."=$option\n"; 
     278            break; 
    245279          default: 
    246280            $additional .= $result['keyword']."=$option\n"; 
    247281        } 
     
    284318                  $output .= $result2['keyword']."=$option\n"; 
    285319                } 
    286320                break; 
     321              case 'allow': 
     322              case 'disallow': 
     323                if ($option != '') 
     324                  $output .= $result2['keyword']."=$option\n"; 
     325                break; 
    287326              default: 
    288327                $output .= $result2['keyword']."=$option\n"; 
    289328            }