Changeset 57404

Show
Ignore:
Timestamp:
04/07/08 14:52:23 (3 months ago)
Author:
sminnee
Message:

Added better error message for when form methods are left out of allowed_actions

Location:
modules/sapphire/branches/roa/core/control
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • modules/sapphire/branches/roa/core/control/HTTPResponse.php

    r55557 r57404  
    7676        function getStatusCode() { 
    7777                return $this->statusCode; 
     78        } 
     79         
     80        /** 
     81         * Returns true if this HTTP response is in error 
     82         */ 
     83        function isError() { 
     84                return $this->statusCode && ($this->statusCode < 200 || $this->statusCode > 399); 
    7885        } 
    7986         
  • modules/sapphire/branches/roa/core/control/RequestHandlingData.php

    r53655 r57404  
    7676                        if(isset($_REQUEST['debug_request'])) Debug::message("Testing '$rule' with '" . $request->remaining() . "' on $this->class"); 
    7777                        if($params = $request->match($rule, true)) { 
    78                                 if(isset($_REQUEST['debug_request'])) Debug::message("Rule '$rule' matched on $this->class"); 
     78                                if(isset($_REQUEST['debug_request'])) Debug::message("Rule '$rule' matched to action '$action' on $this->class"); 
    7979                                 
    8080                                // Actions can reference URL parameters, eg, '$Action/$ID/$OtherID' => '$Action', 
     
    8585                                } else { 
    8686                                        return $this->httpError(403, "Action '$action' isn't allowed on class $this->class"); 
     87                                } 
     88                                 
     89                                if($result instanceof HTTPResponse && $result->isError()) { 
     90                                        if(isset($_REQUEST['debug_request'])) Debug::message("Rule resulted in HTTP error; breaking"); 
     91                                        return $result; 
    8792                                } 
    8893