@@ -46,14 +46,14 @@ |
||
46 | 46 | |
47 | 47 | $routes->scope('/', function (RouteBuilder $builder) { |
48 | 48 | |
49 | - $builder->prefix('admin', function($routes) { |
|
50 | - $routes->connect('/', ['controller' => 'Users', 'action' => 'index']); |
|
51 | - $routes->fallbacks(DashedRoute::class); |
|
52 | - }); |
|
49 | + $builder->prefix('admin', function($routes) { |
|
50 | + $routes->connect('/', ['controller' => 'Users', 'action' => 'index']); |
|
51 | + $routes->fallbacks(DashedRoute::class); |
|
52 | + }); |
|
53 | 53 | |
54 | - $builder->prefix('profile', function($routes) { |
|
55 | - $routes->fallbacks(DashedRoute::class); |
|
56 | - }); |
|
54 | + $builder->prefix('profile', function($routes) { |
|
55 | + $routes->fallbacks(DashedRoute::class); |
|
56 | + }); |
|
57 | 57 | |
58 | 58 | |
59 | 59 | $builder->connect('/', ['controller' => 'dashboard', 'action' => 'index']); |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | $routes->setRouteClass(DashedRoute::class); |
46 | 46 | |
47 | -$routes->scope('/', function (RouteBuilder $builder) { |
|
47 | +$routes->scope('/', function(RouteBuilder $builder) { |
|
48 | 48 | |
49 | 49 | $builder->prefix('admin', function($routes) { |
50 | 50 | $routes->connect('/', ['controller' => 'Users', 'action' => 'index']); |
@@ -166,12 +166,12 @@ |
||
166 | 166 | /* |
167 | 167 | * Setup detectors for mobile and tablet. |
168 | 168 | */ |
169 | -ServerRequest::addDetector('mobile', function ($request) { |
|
169 | +ServerRequest::addDetector('mobile', function($request) { |
|
170 | 170 | $detector = new \Detection\MobileDetect(); |
171 | 171 | |
172 | 172 | return $detector->isMobile(); |
173 | 173 | }); |
174 | -ServerRequest::addDetector('tablet', function ($request) { |
|
174 | +ServerRequest::addDetector('tablet', function($request) { |
|
175 | 175 | $detector = new \Detection\MobileDetect(); |
176 | 176 | |
177 | 177 | return $detector->isTablet(); |
@@ -86,29 +86,41 @@ discard block |
||
86 | 86 | <ul> |
87 | 87 | <?php if (version_compare(PHP_VERSION, '7.2.0', '>=')) : ?> |
88 | 88 | <li class="bullet success">Your version of PHP is 7.2.0 or higher (detected <?php echo PHP_VERSION ?>).</li> |
89 | - <?php else : ?> |
|
89 | + <?php else { |
|
90 | + : ?> |
|
90 | 91 | <li class="bullet problem">Your version of PHP is too low. You need PHP 7.2.0 or higher to use CakePHP (detected <?php echo PHP_VERSION ?>).</li> |
91 | - <?php endif; ?> |
|
92 | + <?php endif; |
|
93 | +} |
|
94 | +?> |
|
92 | 95 | |
93 | 96 | <?php if (extension_loaded('mbstring')) : ?> |
94 | 97 | <li class="bullet success">Your version of PHP has the mbstring extension loaded.</li> |
95 | - <?php else : ?> |
|
98 | + <?php else { |
|
99 | + : ?> |
|
96 | 100 | <li class="bullet problem">Your version of PHP does NOT have the mbstring extension loaded.</li> |
97 | - <?php endif; ?> |
|
101 | + <?php endif; |
|
102 | +} |
|
103 | +?> |
|
98 | 104 | |
99 | 105 | <?php if (extension_loaded('openssl')) : ?> |
100 | 106 | <li class="bullet success">Your version of PHP has the openssl extension loaded.</li> |
101 | 107 | <?php elseif (extension_loaded('mcrypt')) : ?> |
102 | 108 | <li class="bullet success">Your version of PHP has the mcrypt extension loaded.</li> |
103 | - <?php else : ?> |
|
109 | + <?php else { |
|
110 | + : ?> |
|
104 | 111 | <li class="bullet problem">Your version of PHP does NOT have the openssl or mcrypt extension loaded.</li> |
105 | - <?php endif; ?> |
|
112 | + <?php endif; |
|
113 | +} |
|
114 | +?> |
|
106 | 115 | |
107 | 116 | <?php if (extension_loaded('intl')) : ?> |
108 | 117 | <li class="bullet success">Your version of PHP has the intl extension loaded.</li> |
109 | - <?php else : ?> |
|
118 | + <?php else { |
|
119 | + : ?> |
|
110 | 120 | <li class="bullet problem">Your version of PHP does NOT have the intl extension loaded.</li> |
111 | - <?php endif; ?> |
|
121 | + <?php endif; |
|
122 | +} |
|
123 | +?> |
|
112 | 124 | </ul> |
113 | 125 | </div> |
114 | 126 | <div class="column"> |
@@ -116,22 +128,31 @@ discard block |
||
116 | 128 | <ul> |
117 | 129 | <?php if (is_writable(TMP)) : ?> |
118 | 130 | <li class="bullet success">Your tmp directory is writable.</li> |
119 | - <?php else : ?> |
|
131 | + <?php else { |
|
132 | + : ?> |
|
120 | 133 | <li class="bullet problem">Your tmp directory is NOT writable.</li> |
121 | - <?php endif; ?> |
|
134 | + <?php endif; |
|
135 | +} |
|
136 | +?> |
|
122 | 137 | |
123 | 138 | <?php if (is_writable(LOGS)) : ?> |
124 | 139 | <li class="bullet success">Your logs directory is writable.</li> |
125 | - <?php else : ?> |
|
140 | + <?php else { |
|
141 | + : ?> |
|
126 | 142 | <li class="bullet problem">Your logs directory is NOT writable.</li> |
127 | - <?php endif; ?> |
|
143 | + <?php endif; |
|
144 | +} |
|
145 | +?> |
|
128 | 146 | |
129 | 147 | <?php $settings = Cache::getConfig('_cake_core_'); ?> |
130 | 148 | <?php if (!empty($settings)) : ?> |
131 | 149 | <li class="bullet success">The <em><?php echo $settings['className'] ?>Engine</em> is being used for core caching. To change the config edit config/app.php</li> |
132 | - <?php else : ?> |
|
150 | + <?php else { |
|
151 | + : ?> |
|
133 | 152 | <li class="bullet problem">Your cache is NOT working. Please check the settings in config/app.php</li> |
134 | - <?php endif; ?> |
|
153 | + <?php endif; |
|
154 | +} |
|
155 | +?> |
|
135 | 156 | </ul> |
136 | 157 | </div> |
137 | 158 | </div> |
@@ -157,9 +178,12 @@ discard block |
||
157 | 178 | <ul> |
158 | 179 | <?php if ($connected) : ?> |
159 | 180 | <li class="bullet success">CakePHP is able to connect to the database.</li> |
160 | - <?php else : ?> |
|
181 | + <?php else { |
|
182 | + : ?> |
|
161 | 183 | <li class="bullet problem">CakePHP is NOT able to connect to the database.<br /><?php echo $errorMsg ?></li> |
162 | - <?php endif; ?> |
|
184 | + <?php endif; |
|
185 | +} |
|
186 | +?> |
|
163 | 187 | </ul> |
164 | 188 | </div> |
165 | 189 | <div class="column"> |
@@ -167,9 +191,12 @@ discard block |
||
167 | 191 | <ul> |
168 | 192 | <?php if (Plugin::isLoaded('DebugKit')) : ?> |
169 | 193 | <li class="bullet success">DebugKit is loaded.</li> |
170 | - <?php else : ?> |
|
194 | + <?php else { |
|
195 | + : ?> |
|
171 | 196 | <li class="bullet problem">DebugKit is NOT loaded. You need to either install pdo_sqlite, or define the "debug_kit" connection name.</li> |
172 | - <?php endif; ?> |
|
197 | + <?php endif; |
|
198 | +} |
|
199 | +?> |
|
173 | 200 | </ul> |
174 | 201 | </div> |
175 | 202 | </div> |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | $this->loadComponent('RequestHandler'); |
46 | 46 | $this->loadComponent('Flash'); |
47 | 47 | $this->loadComponent('Security'); |
48 | - $this->loadComponent('Auth', [ |
|
49 | - 'authorize' => ['Controller'], |
|
48 | + $this->loadComponent('Auth', [ |
|
49 | + 'authorize' => ['Controller'], |
|
50 | 50 | 'authenticate' => [ |
51 | 51 | 'Form' => [ |
52 | 52 | 'fields' => [ |
@@ -56,30 +56,30 @@ discard block |
||
56 | 56 | ] |
57 | 57 | ], |
58 | 58 | 'loginAction' => [ |
59 | - 'prefix' => 'admin', |
|
59 | + 'prefix' => 'admin', |
|
60 | 60 | 'controller' => 'Users', |
61 | 61 | 'action' => 'login' |
62 | 62 | ], |
63 | - 'logoutAction' => [ |
|
64 | - 'prefix' => 'admin', |
|
63 | + 'logoutAction' => [ |
|
64 | + 'prefix' => 'admin', |
|
65 | 65 | 'controller' => 'Users', |
66 | 66 | 'action' => 'login' |
67 | 67 | ], |
68 | - 'unauthorizedRedirect' => $this->referer() |
|
69 | - ]); |
|
70 | - $this->Auth->allow(); |
|
68 | + 'unauthorizedRedirect' => $this->referer() |
|
69 | + ]); |
|
70 | + $this->Auth->allow(); |
|
71 | 71 | } |
72 | 72 | |
73 | - public function isAuthorized($user) |
|
74 | - { |
|
75 | - // Admin can access every action |
|
76 | - if (isset($user['role']) && $user['role'] === 'admin') { |
|
77 | - return true; |
|
78 | - } |
|
73 | + public function isAuthorized($user) |
|
74 | + { |
|
75 | + // Admin can access every action |
|
76 | + if (isset($user['role']) && $user['role'] === 'admin') { |
|
77 | + return true; |
|
78 | + } |
|
79 | 79 | |
80 | - // Default permit |
|
81 | - return true; |
|
82 | - } |
|
80 | + // Default permit |
|
81 | + return true; |
|
82 | + } |
|
83 | 83 | |
84 | 84 | |
85 | 85 | /** |