|
35 | 35 | use Cake\Cache\Cache; |
36 | 36 | use Cake\Core\Configure; |
37 | 37 | use Cake\Core\Configure\Engine\PhpConfig; |
| 38 | +use Cake\Core\Exception\CakeException; |
38 | 39 | use Cake\Datasource\ConnectionManager; |
39 | 40 | use Cake\Error\ErrorTrap; |
40 | 41 | use Cake\Error\ExceptionTrap; |
|
44 | 45 | use Cake\Mailer\TransportFactory; |
45 | 46 | use Cake\Routing\Router; |
46 | 47 | use Cake\Utility\Security; |
| 48 | +use Detection\MobileDetect; |
47 | 49 | use function Cake\Core\env; |
48 | 50 |
|
49 | 51 | /* |
|
83 | 85 | try { |
84 | 86 | Configure::config('default', new PhpConfig()); |
85 | 87 | Configure::load('app', 'default', false); |
86 | | -} catch (\Exception $e) { |
| 88 | +} catch (Exception $e) { |
87 | 89 | exit($e->getMessage() . "\n"); |
88 | 90 | } |
89 | 91 |
|
|
165 | 167 | * This allows CLI tools (like PHPStan) to load the bootstrap without throwing. |
166 | 168 | */ |
167 | 169 | if (!Configure::read('debug') && $httpHost) { |
168 | | - throw new \Cake\Core\Exception\CakeException( |
| 170 | + throw new CakeException( |
169 | 171 | 'SECURITY: App.fullBaseUrl is not configured. ' . |
170 | 172 | 'This is required in production to prevent Host Header Injection attacks. ' . |
171 | | - 'Set APP_FULL_BASE_URL environment variable or configure App.fullBaseUrl in config/app.php' |
| 173 | + 'Set APP_FULL_BASE_URL environment variable or configure App.fullBaseUrl in config/app.php', |
172 | 174 | ); |
173 | 175 | } |
174 | 176 |
|
|
207 | 209 | * and the mobiledetect package from composer.json. |
208 | 210 | */ |
209 | 211 | ServerRequest::addDetector('mobile', function ($request) { |
210 | | - $detector = new \Detection\MobileDetect(); |
| 212 | + $detector = new MobileDetect(); |
211 | 213 |
|
212 | 214 | return $detector->isMobile(); |
213 | 215 | }); |
214 | 216 | ServerRequest::addDetector('tablet', function ($request) { |
215 | | - $detector = new \Detection\MobileDetect(); |
| 217 | + $detector = new MobileDetect(); |
216 | 218 |
|
217 | 219 | return $detector->isTablet(); |
218 | 220 | }); |
|
0 commit comments