| @@ 219-237 (lines=19) @@ | ||
| 216 | /** |
|
| 217 | * @return Boolean |
|
| 218 | */ |
|
| 219 | function MyPermissionCheck() |
|
| 220 | { |
|
| 221 | $codesWithIPs = $this->Config()->get('secret_codes'); |
|
| 222 | ||
| 223 | //with a code you do not have to be logged in ... |
|
| 224 | if(count($codesWithIPs)) { |
|
| 225 | $ip = EcommerceCountry::get_ip(); |
|
| 226 | $code = $this->request->param('ID'); |
|
| 227 | if($code) { |
|
| 228 | $testIP = isset($codesWithIPs[$code]) ? $codesWithIPs[$code] : false; |
|
| 229 | if($testIP) { |
|
| 230 | if($testIP === $ip || $testIP === '*') { |
|
| 231 | return true; |
|
| 232 | } |
|
| 233 | } |
|
| 234 | } |
|
| 235 | } |
|
| 236 | return Permission::check('ADMIN'); |
|
| 237 | } |
|
| 238 | ||
| 239 | protected function returnJSONorFile($array, $filenameAppendix = '') |
|
| 240 | { |
|
| @@ 59-77 (lines=19) @@ | ||
| 56 | /** |
|
| 57 | * @return Boolean |
|
| 58 | */ |
|
| 59 | function MyPermissionCheck() |
|
| 60 | { |
|
| 61 | $codesWithIPs = $this->Config()->get('secret_codes'); |
|
| 62 | ||
| 63 | //with a code you do not have to be logged in ... |
|
| 64 | if(count($codesWithIPs)) { |
|
| 65 | $ip = EcommerceCountry::get_ip(); |
|
| 66 | $code = $this->request->param('ID'); |
|
| 67 | if($code) { |
|
| 68 | $testIP = isset($codesWithIPs[$code]) ? $codesWithIPs[$code] : false; |
|
| 69 | if($testIP) { |
|
| 70 | if($testIP === $ip || $testIP === '*') { |
|
| 71 | return true; |
|
| 72 | } |
|
| 73 | } |
|
| 74 | } |
|
| 75 | } |
|
| 76 | return Permission::check('ADMIN'); |
|
| 77 | } |
|
| 78 | } |
|
| 79 | ||