| Conditions | 7 |
| Paths | 3 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function Authorize() |
||
| 18 | { |
||
| 19 | if (env('APP_ENV') != 'testing'){ |
||
| 20 | $headers = $_SERVER; |
||
| 21 | $auth = ''; //$headers['REDIRECT_REDIRECT_HTTP_AUTHORIZATION'] |
||
| 22 | foreach($headers as $key=>$val){ |
||
| 23 | if (strpos($key, 'AUTHORIZATION') !== false) { |
||
| 24 | $auth = $val; |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | if (($auth == '') || |
||
| 29 | !preg_match('/^\s*Basic\s+(\S+)\s*$/i', $auth, $matches) || |
||
| 30 | base64_decode($matches[1]) != $this->config['login'] . ":" . $this->config['password']) |
||
| 31 | { |
||
| 32 | $this->response->error(Response::ERROR_INSUFFICIENT_PRIVILEGE, 'Insufficient privilege to perform this method.'); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | return true; |
||
| 36 | } |
||
| 37 | } |
||
| 38 |