diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-16 00:09:33 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-16 00:09:33 +0200 |
commit | 4a3ec0ca3f7d0ca8776a6ee7f2a2615234395eb8 (patch) | |
tree | 8869134f1c3b5f7c3841578fbcaa4ff9cee7e2bc /fai_gestion/src | |
parent | a6104f47f7a0534664f8f3740f303f01e7e7399e (diff) | |
download | chd_gestion-4a3ec0ca3f7d0ca8776a6ee7f2a2615234395eb8.zip chd_gestion-4a3ec0ca3f7d0ca8776a6ee7f2a2615234395eb8.tar.gz chd_gestion-4a3ec0ca3f7d0ca8776a6ee7f2a2615234395eb8.tar.bz2 |
Cake 3.6.7 fresh install
Diffstat (limited to 'fai_gestion/src')
29 files changed, 1288 insertions, 0 deletions
diff --git a/fai_gestion/src/Application.php b/fai_gestion/src/Application.php new file mode 100644 index 0000000..48484b4 --- /dev/null +++ b/fai_gestion/src/Application.php @@ -0,0 +1,89 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 3.3.0 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ +namespace App; + +use Cake\Core\Configure; +use Cake\Core\Exception\MissingPluginException; +use Cake\Error\Middleware\ErrorHandlerMiddleware; +use Cake\Http\BaseApplication; +use Cake\Http\Middleware\CsrfProtectionMiddleware; +use Cake\Routing\Middleware\AssetMiddleware; +use Cake\Routing\Middleware\RoutingMiddleware; + +/** + * Application setup class. + * + * This defines the bootstrapping logic and middleware layers you + * want to use in your application. + */ +class Application extends BaseApplication +{ + /** + * {@inheritDoc} + */ + public function bootstrap() + { + // Call parent to load bootstrap from files. + parent::bootstrap(); + + if (PHP_SAPI === 'cli') { + try { + $this->addPlugin('Bake'); + } catch (MissingPluginException $e) { + // Do not halt if the plugin is missing + } + + $this->addPlugin('Migrations'); + } + + /* + * Only try to load DebugKit in development mode + * Debug Kit should not be installed on a production system + */ + if (Configure::read('debug')) { + $this->addPlugin(\DebugKit\Plugin::class); + } + } + + /** + * Setup the middleware queue your application will use. + * + * @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to setup. + * @return \Cake\Http\MiddlewareQueue The updated middleware queue. + */ + public function middleware($middlewareQueue) + { + $middlewareQueue + // Catch any exceptions in the lower layers, + // and make an error page/response + ->add(ErrorHandlerMiddleware::class) + + // Handle plugin/theme assets like CakePHP normally does. + ->add(AssetMiddleware::class) + + // Add routing middleware. + // Routes collection cache enabled by default, to disable route caching + // pass null as cacheConfig, example: `new RoutingMiddleware($this)` + // you might want to disable this cache in case your routing is extremely simple + ->add(new RoutingMiddleware($this, '_cake_routes_')) + + // Add csrf middleware. + ->add(new CsrfProtectionMiddleware([ + 'httpOnly' => true + ])); + + return $middlewareQueue; + } +} diff --git a/fai_gestion/src/Console/Installer.php b/fai_gestion/src/Console/Installer.php new file mode 100644 index 0000000..3bcef47 --- /dev/null +++ b/fai_gestion/src/Console/Installer.php @@ -0,0 +1,246 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 3.0.0 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ +namespace App\Console; + +if (!defined('STDIN')) { + define('STDIN', fopen('php://stdin', 'r')); +} + +use Cake\Utility\Security; +use Composer\Script\Event; +use Exception; + +/** + * Provides installation hooks for when this application is installed via + * composer. Customize this class to suit your needs. + */ +class Installer +{ + + /** + * An array of directories to be made writable + */ + const WRITABLE_DIRS = [ + 'logs', + 'tmp', + 'tmp/cache', + 'tmp/cache/models', + 'tmp/cache/persistent', + 'tmp/cache/views', + 'tmp/sessions', + 'tmp/tests' + ]; + + /** + * Does some routine installation tasks so people don't have to. + * + * @param \Composer\Script\Event $event The composer event object. + * @throws \Exception Exception raised by validator. + * @return void + */ + public static function postInstall(Event $event) + { + $io = $event->getIO(); + + $rootDir = dirname(dirname(__DIR__)); + + static::createAppConfig($rootDir, $io); + static::createWritableDirectories($rootDir, $io); + + // ask if the permissions should be changed + if ($io->isInteractive()) { + $validator = function ($arg) { + if (in_array($arg, ['Y', 'y', 'N', 'n'])) { + return $arg; + } + throw new Exception('This is not a valid answer. Please choose Y or n.'); + }; + $setFolderPermissions = $io->askAndValidate( + '<info>Set Folder Permissions ? (Default to Y)</info> [<comment>Y,n</comment>]? ', + $validator, + 10, + 'Y' + ); + + if (in_array($setFolderPermissions, ['Y', 'y'])) { + static::setFolderPermissions($rootDir, $io); + } + } else { + static::setFolderPermissions($rootDir, $io); + } + + static::setSecuritySalt($rootDir, $io); + + $class = 'Cake\Codeception\Console\Installer'; + if (class_exists($class)) { + $class::customizeCodeceptionBinary($event); + } + } + + /** + * Create the config/app.php file if it does not exist. + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @return void + */ + public static function createAppConfig($dir, $io) + { + $appConfig = $dir . '/config/app.php'; + $defaultConfig = $dir . '/config/app.default.php'; + if (!file_exists($appConfig)) { + copy($defaultConfig, $appConfig); + $io->write('Created `config/app.php` file'); + } + } + + /** + * Create the `logs` and `tmp` directories. + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @return void + */ + public static function createWritableDirectories($dir, $io) + { + foreach (static::WRITABLE_DIRS as $path) { + $path = $dir . '/' . $path; + if (!file_exists($path)) { + mkdir($path); + $io->write('Created `' . $path . '` directory'); + } + } + } + + /** + * Set globally writable permissions on the "tmp" and "logs" directory. + * + * This is not the most secure default, but it gets people up and running quickly. + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @return void + */ + public static function setFolderPermissions($dir, $io) + { + // Change the permissions on a path and output the results. + $changePerms = function ($path) use ($io) { + $currentPerms = fileperms($path) & 0777; + $worldWritable = $currentPerms | 0007; + if ($worldWritable == $currentPerms) { + return; + } + + $res = chmod($path, $worldWritable); + if ($res) { + $io->write('Permissions set on ' . $path); + } else { + $io->write('Failed to set permissions on ' . $path); + } + }; + + $walker = function ($dir) use (&$walker, $changePerms) { + $files = array_diff(scandir($dir), ['.', '..']); + foreach ($files as $file) { + $path = $dir . '/' . $file; + + if (!is_dir($path)) { + continue; + } + + $changePerms($path); + $walker($path); + } + }; + + $walker($dir . '/tmp'); + $changePerms($dir . '/tmp'); + $changePerms($dir . '/logs'); + } + + /** + * Set the security.salt value in the application's config file. + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @return void + */ + public static function setSecuritySalt($dir, $io) + { + $newKey = hash('sha256', Security::randomBytes(64)); + static::setSecuritySaltInFile($dir, $io, $newKey, 'app.php'); + } + + /** + * Set the security.salt value in a given file + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @param string $newKey key to set in the file + * @param string $file A path to a file relative to the application's root + * @return void + */ + public static function setSecuritySaltInFile($dir, $io, $newKey, $file) + { + $config = $dir . '/config/' . $file; + $content = file_get_contents($config); + + $content = str_replace('__SALT__', $newKey, $content, $count); + + if ($count == 0) { + $io->write('No Security.salt placeholder to replace.'); + + return; + } + + $result = file_put_contents($config, $content); + if ($result) { + $io->write('Updated Security.salt value in config/' . $file); + + return; + } + $io->write('Unable to update Security.salt value.'); + } + + /** + * Set the APP_NAME value in a given file + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @param string $appName app name to set in the file + * @param string $file A path to a file relative to the application's root + * @return void + */ + public static function setAppNameInFile($dir, $io, $appName, $file) + { + $config = $dir . '/config/' . $file; + $content = file_get_contents($config); + $content = str_replace('__APP_NAME__', $appName, $content, $count); + + if ($count == 0) { + $io->write('No __APP_NAME__ placeholder to replace.'); + + return; + } + + $result = file_put_contents($config, $content); + if ($result) { + $io->write('Updated __APP_NAME__ value in config/' . $file); + + return; + } + $io->write('Unable to update __APP_NAME__ value.'); + } +} diff --git a/fai_gestion/src/Controller/AppController.php b/fai_gestion/src/Controller/AppController.php new file mode 100644 index 0000000..49fa03f --- /dev/null +++ b/fai_gestion/src/Controller/AppController.php @@ -0,0 +1,55 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 0.2.9 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ +namespace App\Controller; + +use Cake\Controller\Controller; +use Cake\Event\Event; + +/** + * Application Controller + * + * Add your application-wide methods in the class below, your controllers + * will inherit them. + * + * @link https://book.cakephp.org/3.0/en/controllers.html#the-app-controller + */ +class AppController extends Controller +{ + + /** + * Initialization hook method. + * + * Use this method to add common initialization code like loading components. + * + * e.g. `$this->loadComponent('Security');` + * + * @return void + */ + public function initialize() + { + parent::initialize(); + + $this->loadComponent('RequestHandler', [ + 'enableBeforeRedirect' => false, + ]); + $this->loadComponent('Flash'); + + /* + * Enable the following component for recommended CakePHP security settings. + * see https://book.cakephp.org/3.0/en/controllers/components/security.html + */ + //$this->loadComponent('Security'); + } +} diff --git a/fai_gestion/src/Controller/Component/empty b/fai_gestion/src/Controller/Component/empty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/fai_gestion/src/Controller/Component/empty diff --git a/fai_gestion/src/Controller/ErrorController.php b/fai_gestion/src/Controller/ErrorController.php new file mode 100644 index 0000000..43bd2fb --- /dev/null +++ b/fai_gestion/src/Controller/ErrorController.php @@ -0,0 +1,70 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 3.3.4 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ +namespace App\Controller; + +use Cake\Event\Event; + +/** + * Error Handling Controller + * + * Controller used by ExceptionRenderer to render error responses. + */ +class ErrorController extends AppController +{ + /** + * Initialization hook method. + * + * @return void + */ + public function initialize() + { + $this->loadComponent('RequestHandler', [ + 'enableBeforeRedirect' => false, + ]); + } + + /** + * beforeFilter callback. + * + * @param \Cake\Event\Event $event Event. + * @return \Cake\Http\Response|null|void + */ + public function beforeFilter(Event $event) + { + } + + /** + * beforeRender callback. + * + * @param \Cake\Event\Event $event Event. + * @return \Cake\Http\Response|null|void + */ + public function beforeRender(Event $event) + { + parent::beforeRender($event); + + $this->viewBuilder()->setTemplatePath('Error'); + } + + /** + * afterFilter callback. + * + * @param \Cake\Event\Event $event Event. + * @return \Cake\Http\Response|null|void + */ + public function afterFilter(Event $event) + { + } +} diff --git a/fai_gestion/src/Controller/PagesController.php b/fai_gestion/src/Controller/PagesController.php new file mode 100644 index 0000000..d023661 --- /dev/null +++ b/fai_gestion/src/Controller/PagesController.php @@ -0,0 +1,69 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 0.2.9 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ +namespace App\Controller; + +use Cake\Core\Configure; +use Cake\Http\Exception\ForbiddenException; +use Cake\Http\Exception\NotFoundException; +use Cake\View\Exception\MissingTemplateException; + +/** + * Static content controller + * + * This controller will render views from Template/Pages/ + * + * @link https://book.cakephp.org/3.0/en/controllers/pages-controller.html + */ +class PagesController extends AppController +{ + + /** + * Displays a view + * + * @param array ...$path Path segments. + * @return \Cake\Http\Response|null + * @throws \Cake\Http\Exception\ForbiddenException When a directory traversal attempt. + * @throws \Cake\Http\Exception\NotFoundException When the view file could not + * be found or \Cake\View\Exception\MissingTemplateException in debug mode. + */ + public function display(...$path) + { + $count = count($path); + if (!$count) { + return $this->redirect('/'); + } + if (in_array('..', $path, true) || in_array('.', $path, true)) { + throw new ForbiddenException(); + } + $page = $subpage = null; + + if (!empty($path[0])) { + $page = $path[0]; + } + if (!empty($path[1])) { + $subpage = $path[1]; + } + $this->set(compact('page', 'subpage')); + + try { + $this->render(implode('/', $path)); + } catch (MissingTemplateException $exception) { + if (Configure::read('debug')) { + throw $exception; + } + throw new NotFoundException(); + } + } +} diff --git a/fai_gestion/src/Model/Behavior/empty b/fai_gestion/src/Model/Behavior/empty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/fai_gestion/src/Model/Behavior/empty diff --git a/fai_gestion/src/Model/Entity/empty b/fai_gestion/src/Model/Entity/empty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/fai_gestion/src/Model/Entity/empty diff --git a/fai_gestion/src/Model/Table/empty b/fai_gestion/src/Model/Table/empty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/fai_gestion/src/Model/Table/empty diff --git a/fai_gestion/src/Shell/ConsoleShell.php b/fai_gestion/src/Shell/ConsoleShell.php new file mode 100644 index 0000000..2eb9395 --- /dev/null +++ b/fai_gestion/src/Shell/ConsoleShell.php @@ -0,0 +1,81 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 3.0.0 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ +namespace App\Shell; + +use Cake\Console\ConsoleOptionParser; +use Cake\Console\Shell; +use Cake\Log\Log; +use Psy\Shell as PsyShell; + +/** + * Simple console wrapper around Psy\Shell. + */ +class ConsoleShell extends Shell +{ + + /** + * Start the shell and interactive console. + * + * @return int|null + */ + public function main() + { + if (!class_exists('Psy\Shell')) { + $this->err('<error>Unable to load Psy\Shell.</error>'); + $this->err(''); + $this->err('Make sure you have installed psysh as a dependency,'); + $this->err('and that Psy\Shell is registered in your autoloader.'); + $this->err(''); + $this->err('If you are using composer run'); + $this->err(''); + $this->err('<info>$ php composer.phar require --dev psy/psysh</info>'); + $this->err(''); + + return self::CODE_ERROR; + } + + $this->out("You can exit with <info>`CTRL-C`</info> or <info>`exit`</info>"); + $this->out(''); + + Log::drop('debug'); + Log::drop('error'); + $this->_io->setLoggers(false); + restore_error_handler(); + restore_exception_handler(); + + $psy = new PsyShell(); + $psy->run(); + } + + /** + * Display help for this console. + * + * @return \Cake\Console\ConsoleOptionParser + */ + public function getOptionParser() + { + $parser = new ConsoleOptionParser('console'); + $parser->setDescription( + 'This shell provides a REPL that you can use to interact ' . + 'with your application in an interactive fashion. You can use ' . + 'it to run adhoc queries with your models, or experiment ' . + 'and explore the features of CakePHP and your application.' . + "\n\n" . + 'You will need to have psysh installed for this Shell to work.' + ); + + return $parser; + } +} diff --git a/fai_gestion/src/Template/Cell/empty b/fai_gestion/src/Template/Cell/empty new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fai_gestion/src/Template/Cell/empty @@ -0,0 +1 @@ + diff --git a/fai_gestion/src/Template/Element/Flash/default.ctp b/fai_gestion/src/Template/Element/Flash/default.ctp new file mode 100644 index 0000000..736b27d --- /dev/null +++ b/fai_gestion/src/Template/Element/Flash/default.ctp @@ -0,0 +1,10 @@ +<?php +$class = 'message'; +if (!empty($params['class'])) { + $class .= ' ' . $params['class']; +} +if (!isset($params['escape']) || $params['escape'] !== false) { + $message = h($message); +} +?> +<div class="<?= h($class) ?>" onclick="this.classList.add('hidden');"><?= $message ?></div> diff --git a/fai_gestion/src/Template/Element/Flash/error.ctp b/fai_gestion/src/Template/Element/Flash/error.ctp new file mode 100644 index 0000000..e7c4af1 --- /dev/null +++ b/fai_gestion/src/Template/Element/Flash/error.ctp @@ -0,0 +1,6 @@ +<?php +if (!isset($params['escape']) || $params['escape'] !== false) { + $message = h($message); +} +?> +<div class="message error" onclick="this.classList.add('hidden');"><?= $message ?></div> diff --git a/fai_gestion/src/Template/Element/Flash/success.ctp b/fai_gestion/src/Template/Element/Flash/success.ctp new file mode 100644 index 0000000..becd5a1 --- /dev/null +++ b/fai_gestion/src/Template/Element/Flash/success.ctp @@ -0,0 +1,6 @@ +<?php +if (!isset($params['escape']) || $params['escape'] !== false) { + $message = h($message); +} +?> +<div class="message success" onclick="this.classList.add('hidden')"><?= $message ?></div> diff --git a/fai_gestion/src/Template/Email/html/default.ctp b/fai_gestion/src/Template/Email/html/default.ctp new file mode 100644 index 0000000..ac3daa7 --- /dev/null +++ b/fai_gestion/src/Template/Email/html/default.ctp @@ -0,0 +1,20 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 0.10.0 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ + +$content = explode("\n", $content); + +foreach ($content as $line) : + echo '<p> ' . $line . "</p>\n"; +endforeach; diff --git a/fai_gestion/src/Template/Email/text/default.ctp b/fai_gestion/src/Template/Email/text/default.ctp new file mode 100644 index 0000000..862cd9f --- /dev/null +++ b/fai_gestion/src/Template/Email/text/default.ctp @@ -0,0 +1,16 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 0.10.0 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ + +echo $content; diff --git a/fai_gestion/src/Template/Error/error400.ctp b/fai_gestion/src/Template/Error/error400.ctp new file mode 100644 index 0000000..6b538b7 --- /dev/null +++ b/fai_gestion/src/Template/Error/error400.ctp @@ -0,0 +1,38 @@ +<?php +use Cake\Core\Configure; +use Cake\Error\Debugger; + +$this->layout = 'error'; + +if (Configure::read('debug')) : + $this->layout = 'dev_error'; + + $this->assign('title', $message); + $this->assign('templateName', 'error400.ctp'); + + $this->start('file'); +?> +<?php if (!empty($error->queryString)) : ?> + <p class="notice"> + <strong>SQL Query: </strong> + <?= h($error->queryString) ?> + </p> +<?php endif; ?> +<?php if (!empty($error->params)) : ?> + <strong>SQL Query Params: </strong> + <?php Debugger::dump($error->params) ?> +<?php endif; ?> +<?= $this->element('auto_table_warning') ?> +<?php +if (extension_loaded('xdebug')) : + xdebug_print_function_stack(); +endif; + +$this->end(); +endif; +?> +<h2><?= h($message) ?></h2> +<p class="error"> + <strong><?= __d('cake', 'Error') ?>: </strong> + <?= __d('cake', 'The requested address {0} was not found on this server.', "<strong>'{$url}'</strong>") ?> +</p> diff --git a/fai_gestion/src/Template/Error/error500.ctp b/fai_gestion/src/Template/Error/error500.ctp new file mode 100644 index 0000000..3328cc5 --- /dev/null +++ b/fai_gestion/src/Template/Error/error500.ctp @@ -0,0 +1,43 @@ +<?php +use Cake\Core\Configure; +use Cake\Error\Debugger; + +$this->layout = 'error'; + +if (Configure::read('debug')) : + $this->layout = 'dev_error'; + + $this->assign('title', $message); + $this->assign('templateName', 'error500.ctp'); + + $this->start('file'); +?> +<?php if (!empty($error->queryString)) : ?> + <p class="notice"> + <strong>SQL Query: </strong> + <?= h($error->queryString) ?> + </p> +<?php endif; ?> +<?php if (!empty($error->params)) : ?> + <strong>SQL Query Params: </strong> + <?php Debugger::dump($error->params) ?> +<?php endif; ?> +<?php if ($error instanceof Error) : ?> + <strong>Error in: </strong> + <?= sprintf('%s, line %s', str_replace(ROOT, 'ROOT', $error->getFile()), $error->getLine()) ?> +<?php endif; ?> +<?php + echo $this->element('auto_table_warning'); + + if (extension_loaded('xdebug')) : + xdebug_print_function_stack(); + endif; + + $this->end(); +endif; +?> +<h2><?= __d('cake', 'An Internal Error Has Occurred') ?></h2> +<p class="error"> + <strong><?= __d('cake', 'Error') ?>: </strong> + <?= h($message) ?> +</p> diff --git a/fai_gestion/src/Template/Layout/Email/html/default.ctp b/fai_gestion/src/Template/Layout/Email/html/default.ctp new file mode 100644 index 0000000..3ff87ff --- /dev/null +++ b/fai_gestion/src/Template/Layout/Email/html/default.ctp @@ -0,0 +1,24 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 0.10.0 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> + <title><?= $this->fetch('title') ?></title> +</head> +<body> + <?= $this->fetch('content') ?> +</body> +</html> diff --git a/fai_gestion/src/Template/Layout/Email/text/default.ctp b/fai_gestion/src/Template/Layout/Email/text/default.ctp new file mode 100644 index 0000000..29b439c --- /dev/null +++ b/fai_gestion/src/Template/Layout/Email/text/default.ctp @@ -0,0 +1,16 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 0.10.0 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ + +echo $this->fetch('content'); diff --git a/fai_gestion/src/Template/Layout/ajax.ctp b/fai_gestion/src/Template/Layout/ajax.ctp new file mode 100644 index 0000000..29b439c --- /dev/null +++ b/fai_gestion/src/Template/Layout/ajax.ctp @@ -0,0 +1,16 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 0.10.0 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ + +echo $this->fetch('content'); diff --git a/fai_gestion/src/Template/Layout/default.ctp b/fai_gestion/src/Template/Layout/default.ctp new file mode 100644 index 0000000..caf014e --- /dev/null +++ b/fai_gestion/src/Template/Layout/default.ctp @@ -0,0 +1,57 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 0.10.0 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ + +$cakeDescription = 'CakePHP: the rapid development php framework'; +?> +<!DOCTYPE html> +<html> +<head> + <?= $this->Html->charset() ?> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title> + <?= $cakeDescription ?>: + <?= $this->fetch('title') ?> + </title> + <?= $this->Html->meta('icon') ?> + + <?= $this->Html->css('base.css') ?> + <?= $this->Html->css('style.css') ?> + + <?= $this->fetch('meta') ?> + <?= $this->fetch('css') ?> + <?= $this->fetch('script') ?> +</head> +<body> + <nav class="top-bar expanded" data-topbar role="navigation"> + <ul class="title-area large-3 medium-4 columns"> + <li class="name"> + <h1><a href=""><?= $this->fetch('title') ?></a></h1> + </li> + </ul> + <div class="top-bar-section"> + <ul class="right"> + <li><a target="_blank" href="https://book.cakephp.org/3.0/">Documentation</a></li> + <li><a target="_blank" href="https://api.cakephp.org/3.0/">API</a></li> + </ul> + </div> + </nav> + <?= $this->Flash->render() ?> + <div class="container clearfix"> + <?= $this->fetch('content') ?> + </div> + <footer> + </footer> +</body> +</html> diff --git a/fai_gestion/src/Template/Layout/error.ctp b/fai_gestion/src/Template/Layout/error.ctp new file mode 100644 index 0000000..7367c1b --- /dev/null +++ b/fai_gestion/src/Template/Layout/error.ctp @@ -0,0 +1,47 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 0.10.0 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ +?> +<!DOCTYPE html> +<html> +<head> + <?= $this->Html->charset() ?> + <title> + <?= $this->fetch('title') ?> + </title> + <?= $this->Html->meta('icon') ?> + + <?= $this->Html->css('base.css') ?> + <?= $this->Html->css('style.css') ?> + + <?= $this->fetch('meta') ?> + <?= $this->fetch('css') ?> + <?= $this->fetch('script') ?> +</head> +<body> + <div id="container"> + <div id="header"> + <h1><?= __('Error') ?></h1> + </div> + <div id="content"> + <?= $this->Flash->render() ?> + + <?= $this->fetch('content') ?> + </div> + <div id="footer"> + <?= $this->Html->link(__('Back'), 'javascript:history.back()') ?> + </div> + </div> +</body> +</html> diff --git a/fai_gestion/src/Template/Layout/rss/default.ctp b/fai_gestion/src/Template/Layout/rss/default.ctp new file mode 100644 index 0000000..8269be2 --- /dev/null +++ b/fai_gestion/src/Template/Layout/rss/default.ctp @@ -0,0 +1,11 @@ +<?php +if (!isset($channel)) : + $channel = []; +endif; +if (!isset($channel['title'])) : + $channel['title'] = $this->fetch('title'); +endif; + +echo $this->Rss->document( + $this->Rss->channel([], $channel, $this->fetch('content')) +); diff --git a/fai_gestion/src/Template/Pages/home.ctp b/fai_gestion/src/Template/Pages/home.ctp new file mode 100644 index 0000000..a393d0e --- /dev/null +++ b/fai_gestion/src/Template/Pages/home.ctp @@ -0,0 +1,278 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 0.10.0 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ +use Cake\Cache\Cache; +use Cake\Core\Configure; +use Cake\Core\Plugin; +use Cake\Datasource\ConnectionManager; +use Cake\Error\Debugger; +use Cake\Network\Exception\NotFoundException; + +$this->layout = false; + +if (!Configure::read('debug')) : + throw new NotFoundException( + 'Please replace src/Template/Pages/home.ctp with your own version or re-enable debug mode.' + ); +endif; + +$cakeDescription = 'CakePHP: the rapid development PHP framework'; +?> +<!DOCTYPE html> +<html> +<head> + <?= $this->Html->charset() ?> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title> + <?= $cakeDescription ?> + </title> + + <?= $this->Html->meta('icon') ?> + <?= $this->Html->css('base.css') ?> + <?= $this->Html->css('style.css') ?> + <?= $this->Html->css('home.css') ?> + <link href="https://fonts.googleapis.com/css?family=Raleway:500i|Roboto:300,400,700|Roboto+Mono" rel="stylesheet"> +</head> +<body class="home"> + +<header class="row"> + <div class="header-image"><?= $this->Html->image('cake.logo.svg') ?></div> + <div class="header-title"> + <h1>Welcome to CakePHP <?= Configure::version() ?> Red Velvet. Build fast. Grow solid.</h1> + </div> +</header> + +<div class="row"> + <div class="columns large-12"> + <div class="ctp-warning alert text-center"> + <p>Please be aware that this page will not be shown if you turn off debug mode unless you replace src/Template/Pages/home.ctp with your own version.</p> + </div> + <div id="url-rewriting-warning" class="alert url-rewriting"> + <ul> + <li class="bullet problem"> + URL rewriting is not properly configured on your server.<br /> + 1) <a target="_blank" href="https://book.cakephp.org/3.0/en/installation.html#url-rewriting">Help me configure it</a><br /> + 2) <a target="_blank" href="https://book.cakephp.org/3.0/en/development/configuration.html#general-configuration">I don't / can't use URL rewriting</a> + </li> + </ul> + </div> + <?php Debugger::checkSecurityKeys(); ?> + </div> +</div> + +<div class="row"> + <div class="columns large-6"> + <h4>Environment</h4> + <ul> + <?php if (version_compare(PHP_VERSION, '5.6.0', '>=')) : ?> + <li class="bullet success">Your version of PHP is 5.6.0 or higher (detected <?= PHP_VERSION ?>).</li> + <?php else : ?> + <li class="bullet problem">Your version of PHP is too low. You need PHP 5.6.0 or higher to use CakePHP (detected <?= PHP_VERSION ?>).</li> + <?php endif; ?> + + <?php if (extension_loaded('mbstring')) : ?> + <li class="bullet success">Your version of PHP has the mbstring extension loaded.</li> + <?php else : ?> + <li class="bullet problem">Your version of PHP does NOT have the mbstring extension loaded.</li> + <?php endif; ?> + + <?php if (extension_loaded('openssl')) : ?> + <li class="bullet success">Your version of PHP has the openssl extension loaded.</li> + <?php elseif (extension_loaded('mcrypt')) : ?> + <li class="bullet success">Your version of PHP has the mcrypt extension loaded.</li> + <?php else : ?> + <li class="bullet problem">Your version of PHP does NOT have the openssl or mcrypt extension loaded.</li> + <?php endif; ?> + + <?php if (extension_loaded('intl')) : ?> + <li class="bullet success">Your version of PHP has the intl extension loaded.</li> + <?php else : ?> + <li class="bullet problem">Your version of PHP does NOT have the intl extension loaded.</li> + <?php endif; ?> + </ul> + </div> + <div class="columns large-6"> + <h4>Filesystem</h4> + <ul> + <?php if (is_writable(TMP)) : ?> + <li class="bullet success">Your tmp directory is writable.</li> + <?php else : ?> + <li class="bullet problem">Your tmp directory is NOT writable.</li> + <?php endif; ?> + + <?php if (is_writable(LOGS)) : ?> + <li class="bullet success">Your logs directory is writable.</li> + <?php else : ?> + <li class="bullet problem">Your logs directory is NOT writable.</li> + <?php endif; ?> + + <?php $settings = Cache::getConfig('_cake_core_'); ?> + <?php if (!empty($settings)) : ?> + <li class="bullet success">The <em><?= $settings['className'] ?>Engine</em> is being used for core caching. To change the config edit config/app.php</li> + <?php else : ?> + <li class="bullet problem">Your cache is NOT working. Please check the settings in config/app.php</li> + <?php endif; ?> + </ul> + </div> + <hr /> +</div> + +<div class="row"> + <div class="columns large-6"> + <h4>Database</h4> + <?php + try { + $connection = ConnectionManager::get('default'); + $connected = $connection->connect(); + } catch (Exception $connectionError) { + $connected = false; + $errorMsg = $connectionError->getMessage(); + if (method_exists($connectionError, 'getAttributes')) : + $attributes = $connectionError->getAttributes(); + if (isset($errorMsg['message'])) : + $errorMsg .= '<br />' . $attributes['message']; + endif; + endif; + } + ?> + <ul> + <?php if ($connected) : ?> + <li class="bullet success">CakePHP is able to connect to the database.</li> + <?php else : ?> + <li class="bullet problem">CakePHP is NOT able to connect to the database.<br /><?= $errorMsg ?></li> + <?php endif; ?> + </ul> + </div> + <div class="columns large-6"> + <h4>DebugKit</h4> + <ul> + <?php if (Plugin::loaded('DebugKit')) : ?> + <li class="bullet success">DebugKit is loaded.</li> + <?php else : ?> + <li class="bullet problem">DebugKit is NOT loaded. You need to either install pdo_sqlite, or define the "debug_kit" connection name.</li> + <?php endif; ?> + </ul> + </div> + <hr /> +</div> + +<div class="row"> + <div class="columns large-6"> + <h3>Editing this Page</h3> + <ul> + <li class="bullet cutlery">To change the content of this page, edit: src/Template/Pages/home.ctp.</li> + <li class="bullet cutlery">You can also add some CSS styles for your pages at: webroot/css/.</li> + </ul> + </div> + <div class="columns large-6"> + <h3>Getting Started</h3> + <ul> + <li class="bullet book"><a target="_blank" href="https://book.cakephp.org/3.0/en/">CakePHP 3.0 Docs</a></li> + <li class="bullet book"><a target="_blank" href="https://book.cakephp.org/3.0/en/tutorials-and-examples/bookmarks/intro.html">The 15 min Bookmarker Tutorial</a></li> + <li class="bullet book"><a target="_blank" href="https://book.cakephp.org/3.0/en/tutorials-and-examples/blog/blog.html">The 15 min Blog Tutorial</a></li> + <li class="bullet book"><a target="_blank" href="https://book.cakephp.org/3.0/en/tutorials-and-examples/cms/installation.html">The 15 min CMS Tutorial</a></li> + </ul> + </div> +</div> + +<div class="row"> + <div class="columns large-12 text-center"> + <h3 class="more">More about Cake</h3> + <p> + CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Front Controller and MVC.<br /> + Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility. + </p> + </div> + <hr/> +</div> + +<div class="row"> + <div class="columns large-4"> + <i class="icon support">P</i> + <h3>Help and Bug Reports</h3> + <ul> + <li class="bullet cutlery"> + <a href="irc://irc.freenode.net/cakephp">irc.freenode.net #cakephp</a> + <ul><li>Live chat about CakePHP</li></ul> + </li> + <li class="bullet cutlery"> + <a href="http://cakesf.herokuapp.com/">Slack</a> + <ul><li>CakePHP Slack support</li></ul> + </li> + <li class="bullet cutlery"> + <a href="https://github.com/cakephp/cakephp/issues">CakePHP Issues</a> + <ul><li>CakePHP issues and pull requests</li></ul> + </li> + <li class="bullet cutlery"> + <a href="http://discourse.cakephp.org/">CakePHP Forum</a> + <ul><li>CakePHP official discussion forum</li></ul> + </li> + </ul> + </div> + <div class="columns large-4"> + <i class="icon docs">r</i> + <h3>Docs and Downloads</h3> + <ul> + <li class="bullet cutlery"> + <a href="https://api.cakephp.org/3.0/">CakePHP API</a> + <ul><li>Quick Reference</li></ul> + </li> + <li class="bullet cutlery"> + <a href="https://book.cakephp.org/3.0/en/">CakePHP Documentation</a> + <ul><li>Your Rapid Development Cookbook</li></ul> + </li> + <li class="bullet cutlery"> + <a href="https://bakery.cakephp.org">The Bakery</a> + <ul><li>Everything CakePHP</li></ul> + </li> + <li class="bullet cutlery"> + <a href="https://plugins.cakephp.org">CakePHP plugins repo</a> + <ul><li>A comprehensive list of all CakePHP plugins created by the community</li></ul> + </li> + <li class="bullet cutlery"> + <a href="https://github.com/cakephp/">CakePHP Code</a> + <ul><li>For the Development of CakePHP Git repository, Downloads</li></ul> + </li> + <li class="bullet cutlery"> + <a href="https://github.com/FriendsOfCake/awesome-cakephp">CakePHP Awesome List</a> + <ul><li>A curated list of amazingly awesome CakePHP plugins, resources and shiny things.</li></ul> + </li> + <li class="bullet cutlery"> + <a href="https://www.cakephp.org">CakePHP</a> + <ul><li>The Rapid Development Framework</li></ul> + </li> + </ul> + </div> + <div class="columns large-4"> + <i class="icon training">s</i> + <h3>Training and Certification</h3> + <ul> + <li class="bullet cutlery"> + <a href="https://cakefoundation.org/">Cake Software Foundation</a> + <ul><li>Promoting development related to CakePHP</li></ul> + </li> + <li class="bullet cutlery"> + <a href="https://training.cakephp.org/">CakePHP Training</a> + <ul><li>Learn to use the CakePHP framework</li></ul> + </li> + <li class="bullet cutlery"> + <a href="https://certification.cakephp.org/">CakePHP Certification</a> + <ul><li>Become a certified CakePHP developer</li></ul> + </li> + </ul> + </div> +</div> + +</body> +</html> diff --git a/fai_gestion/src/View/AjaxView.php b/fai_gestion/src/View/AjaxView.php new file mode 100644 index 0000000..3cb7869 --- /dev/null +++ b/fai_gestion/src/View/AjaxView.php @@ -0,0 +1,49 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 3.0.4 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ +namespace App\View; + +use Cake\Event\EventManager; +use Cake\Http\Response; +use Cake\Http\ServerRequest; + +/** + * A view class that is used for AJAX responses. + * Currently only switches the default layout and sets the response type - + * which just maps to text/html by default. + */ +class AjaxView extends AppView +{ + + /** + * The name of the layout file to render the view inside of. The name + * specified is the filename of the layout in /src/Template/Layout without + * the .ctp extension. + * + * @var string + */ + public $layout = 'ajax'; + + /** + * Initialization hook method. + * + * @return void + */ + public function initialize() + { + parent::initialize(); + + $this->response = $this->response->withType('ajax'); + } +} diff --git a/fai_gestion/src/View/AppView.php b/fai_gestion/src/View/AppView.php new file mode 100644 index 0000000..7b92ebf --- /dev/null +++ b/fai_gestion/src/View/AppView.php @@ -0,0 +1,40 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 3.0.0 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ +namespace App\View; + +use Cake\View\View; + +/** + * Application View + * + * Your application’s default view class + * + * @link https://book.cakephp.org/3.0/en/views.html#the-app-view + */ +class AppView extends View +{ + + /** + * Initialization hook method. + * + * Use this method to add common initialization code like loading helpers. + * + * e.g. `$this->loadHelper('Html');` + * + * @return void + */ + public function initialize() + { + } +} diff --git a/fai_gestion/src/View/Cell/empty b/fai_gestion/src/View/Cell/empty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/fai_gestion/src/View/Cell/empty diff --git a/fai_gestion/src/View/Helper/empty b/fai_gestion/src/View/Helper/empty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/fai_gestion/src/View/Helper/empty |