home.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 0.10.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. * @var \App\View\AppView $this
  15. */
  16. use Cake\Cache\Cache;
  17. use Cake\Core\Configure;
  18. use Cake\Core\Plugin;
  19. use Cake\Datasource\ConnectionManager;
  20. use Cake\Error\Debugger;
  21. use Cake\Http\Exception\NotFoundException;
  22. $this->disableAutoLayout();
  23. $checkConnection = function (string $name) {
  24. $error = null;
  25. $connected = false;
  26. try {
  27. ConnectionManager::get($name)->getDriver()->connect();
  28. // No exception means success
  29. $connected = true;
  30. } catch (Exception $connectionError) {
  31. $error = $connectionError->getMessage();
  32. if (method_exists($connectionError, 'getAttributes')) {
  33. $attributes = $connectionError->getAttributes();
  34. if (isset($attributes['message'])) {
  35. $error .= '<br />' . $attributes['message'];
  36. }
  37. }
  38. if ($name === 'debug_kit') {
  39. $error = 'Try adding your current <b>top level domain</b> to the
  40. <a href="https://book.cakephp.org/debugkit/5/en/index.html#configuration" target="_blank">DebugKit.safeTld</a>
  41. config and reload.';
  42. if (!in_array('sqlite', \PDO::getAvailableDrivers())) {
  43. $error .= '<br />You need to install the PHP extension <code>pdo_sqlite</code> so DebugKit can work properly.';
  44. }
  45. }
  46. }
  47. return compact('connected', 'error');
  48. };
  49. if (!Configure::read('debug')) :
  50. throw new NotFoundException(
  51. 'Please replace templates/Pages/home.php with your own version or re-enable debug mode.'
  52. );
  53. endif;
  54. ?>
  55. <!DOCTYPE html>
  56. <html>
  57. <head>
  58. <?= $this->Html->charset() ?>
  59. <meta name="viewport" content="width=device-width, initial-scale=1">
  60. <title>
  61. CakePHP: the rapid development PHP framework:
  62. <?= $this->fetch('title') ?>
  63. </title>
  64. <?= $this->Html->meta('icon') ?>
  65. <?= $this->Html->css(['normalize.min', 'milligram.min', 'fonts', 'cake', 'home']) ?>
  66. <?= $this->fetch('meta') ?>
  67. <?= $this->fetch('css') ?>
  68. <?= $this->fetch('script') ?>
  69. </head>
  70. <body>
  71. <header>
  72. <div class="container text-center">
  73. <a href="https://cakephp.org/" target="_blank" rel="noopener">
  74. <img alt="CakePHP" src="https://cakephp.org/v2/img/logos/CakePHP_Logo.svg" width="350" />
  75. </a>
  76. <h1>
  77. Welcome to CakePHP <?= h(Configure::version()) ?> Chiffon (🍰)
  78. </h1>
  79. </div>
  80. </header>
  81. <main class="main">
  82. <div class="container">
  83. <div class="content">
  84. <div class="row">
  85. <div class="column">
  86. <div class="message default text-center">
  87. <small>Please be aware that this page will not be shown if you turn off debug mode unless you replace templates/Pages/home.php with your own version.</small>
  88. </div>
  89. <div id="url-rewriting-warning" style="padding: 1rem; background: #fcebea; color: #cc1f1a; border-color: #ef5753;">
  90. <ul>
  91. <li class="bullet problem">
  92. URL rewriting is not properly configured on your server.<br />
  93. 1) <a target="_blank" rel="noopener" href="https://book.cakephp.org/5/en/installation.html#url-rewriting">Help me configure it</a><br />
  94. 2) <a target="_blank" rel="noopener" href="https://book.cakephp.org/5/en/development/configuration.html#general-configuration">I don't / can't use URL rewriting</a>
  95. </li>
  96. </ul>
  97. </div>
  98. <?php Debugger::checkSecurityKeys(); ?>
  99. </div>
  100. </div>
  101. <div class="row">
  102. <div class="column">
  103. <h4>Environment</h4>
  104. <ul>
  105. <?php if (version_compare(PHP_VERSION, '8.1.0', '>=')) : ?>
  106. <li class="bullet success">Your version of PHP is 8.1.0 or higher (detected <?= PHP_VERSION ?>).</li>
  107. <?php else : ?>
  108. <li class="bullet problem">Your version of PHP is too low. You need PHP 8.1.0 or higher to use CakePHP (detected <?= PHP_VERSION ?>).</li>
  109. <?php endif; ?>
  110. <?php if (extension_loaded('mbstring')) : ?>
  111. <li class="bullet success">Your version of PHP has the mbstring extension loaded.</li>
  112. <?php else : ?>
  113. <li class="bullet problem">Your version of PHP does NOT have the mbstring extension loaded.</li>
  114. <?php endif; ?>
  115. <?php if (extension_loaded('openssl')) : ?>
  116. <li class="bullet success">Your version of PHP has the openssl extension loaded.</li>
  117. <?php elseif (extension_loaded('mcrypt')) : ?>
  118. <li class="bullet success">Your version of PHP has the mcrypt extension loaded.</li>
  119. <?php else : ?>
  120. <li class="bullet problem">Your version of PHP does NOT have the openssl or mcrypt extension loaded.</li>
  121. <?php endif; ?>
  122. <?php if (extension_loaded('intl')) : ?>
  123. <li class="bullet success">Your version of PHP has the intl extension loaded.</li>
  124. <?php else : ?>
  125. <li class="bullet problem">Your version of PHP does NOT have the intl extension loaded.</li>
  126. <?php endif; ?>
  127. </ul>
  128. </div>
  129. <div class="column">
  130. <h4>Filesystem</h4>
  131. <ul>
  132. <?php if (is_writable(TMP)) : ?>
  133. <li class="bullet success">Your tmp directory is writable.</li>
  134. <?php else : ?>
  135. <li class="bullet problem">Your tmp directory is NOT writable.</li>
  136. <?php endif; ?>
  137. <?php if (is_writable(LOGS)) : ?>
  138. <li class="bullet success">Your logs directory is writable.</li>
  139. <?php else : ?>
  140. <li class="bullet problem">Your logs directory is NOT writable.</li>
  141. <?php endif; ?>
  142. <?php $settings = Cache::getConfig('_cake_core_'); ?>
  143. <?php if (!empty($settings)) : ?>
  144. <li class="bullet success">The <em><?= h($settings['className']) ?></em> is being used for core caching. To change the config edit config/app.php</li>
  145. <?php else : ?>
  146. <li class="bullet problem">Your cache is NOT working. Please check the settings in config/app.php</li>
  147. <?php endif; ?>
  148. </ul>
  149. </div>
  150. </div>
  151. <hr>
  152. <div class="row">
  153. <div class="column">
  154. <h4>Database</h4>
  155. <?php
  156. $result = $checkConnection('default');
  157. ?>
  158. <ul>
  159. <?php if ($result['connected']) : ?>
  160. <li class="bullet success">CakePHP is able to connect to the database.</li>
  161. <?php else : ?>
  162. <li class="bullet problem">CakePHP is NOT able to connect to the database.<br /><?= h($result['error']) ?></li>
  163. <?php endif; ?>
  164. </ul>
  165. </div>
  166. <div class="column">
  167. <h4>DebugKit</h4>
  168. <ul>
  169. <?php if (Plugin::isLoaded('DebugKit')) : ?>
  170. <li class="bullet success">DebugKit is loaded.</li>
  171. <?php
  172. $result = $checkConnection('debug_kit');
  173. ?>
  174. <?php if ($result['connected']) : ?>
  175. <li class="bullet success">DebugKit can connect to the database.</li>
  176. <?php else : ?>
  177. <li class="bullet problem">There are configuration problems present which need to be fixed:<br /><?= $result['error'] ?></li>
  178. <?php endif; ?>
  179. <?php else : ?>
  180. <li class="bullet problem">DebugKit is <strong>not</strong> loaded.</li>
  181. <?php endif; ?>
  182. </ul>
  183. </div>
  184. </div>
  185. <hr>
  186. <div class="row">
  187. <div class="column links">
  188. <h3>Getting Started</h3>
  189. <a target="_blank" rel="noopener" href="https://book.cakephp.org/5/en/">CakePHP Documentation</a>
  190. <a target="_blank" rel="noopener" href="https://book.cakephp.org/5/en/tutorials-and-examples/cms/installation.html">The 20 min CMS Tutorial</a>
  191. </div>
  192. </div>
  193. <hr>
  194. <div class="row">
  195. <div class="column links">
  196. <h3>Help and Bug Reports</h3>
  197. <a target="_blank" rel="noopener" href="https://slack-invite.cakephp.org/">Slack</a>
  198. <a target="_blank" rel="noopener" href="https://github.com/cakephp/cakephp/issues">CakePHP Issues</a>
  199. <a target="_blank" rel="noopener" href="https://discourse.cakephp.org/">CakePHP Forum</a>
  200. </div>
  201. </div>
  202. <hr>
  203. <div class="row">
  204. <div class="column links">
  205. <h3>Docs and Downloads</h3>
  206. <a target="_blank" rel="noopener" href="https://api.cakephp.org/">CakePHP API</a>
  207. <a target="_blank" rel="noopener" href="https://bakery.cakephp.org">The Bakery</a>
  208. <a target="_blank" rel="noopener" href="https://book.cakephp.org/5/en/">CakePHP Documentation</a>
  209. <a target="_blank" rel="noopener" href="https://plugins.cakephp.org">CakePHP plugins repo</a>
  210. <a target="_blank" rel="noopener" href="https://github.com/cakephp/">CakePHP Code</a>
  211. <a target="_blank" rel="noopener" href="https://github.com/FriendsOfCake/awesome-cakephp">CakePHP Awesome List</a>
  212. <a target="_blank" rel="noopener" href="https://www.cakephp.org">CakePHP</a>
  213. </div>
  214. </div>
  215. <hr>
  216. <div class="row">
  217. <div class="column links">
  218. <h3>Training and Certification</h3>
  219. <a target="_blank" rel="noopener" href="https://cakefoundation.org/">Cake Software Foundation</a>
  220. <a target="_blank" rel="noopener" href="https://training.cakephp.org/">CakePHP Training</a>
  221. </div>
  222. </div>
  223. </div>
  224. </div>
  225. </main>
  226. </body>
  227. </html>