bootstrap.php 11.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<?php
/**
 * This file is loaded automatically by the app/webroot/index.php file after core.php
 * This file should load/create any application wide configuration settings, such as
 * Caching, Logging, loading additional configuration files.
 * You should also use this file to include any files that provide global functions/constants
 * that your application uses.
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.10.8.2117
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */

20 21 22 23
if (defined('LOG_ERROR') == false) {
    define('LOG_ERROR', LOG_ERR);
}

24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
setlocale(LC_ALL, ['fr_FR', 'fr_FR@euro', 'fr', 'fr_FR.UTF8']);

// Setup a 'default' cache configuration for use in the application.
Cache::config('default', ['engine' => 'File']);

/**
 * The settings below can be used to set additional paths to models, views and controllers.
 * App::build(array(
 *     'Model'                     => array('/path/to/models/', '/next/path/to/models/'),
 *     'Model/Behavior'            => array('/path/to/behaviors/', '/next/path/to/behaviors/'),
 *     'Model/Datasource'          => array('/path/to/datasources/', '/next/path/to/datasources/'),
 *     'Model/Datasource/Database' => array('/path/to/databases/', '/next/path/to/database/'),
 *     'Model/Datasource/Session'  => array('/path/to/sessions/', '/next/path/to/sessions/'),
 *     'Controller'                => array('/path/to/controllers/', '/next/path/to/controllers/'),
 *     'Controller/Component'      => array('/path/to/components/', '/next/path/to/components/'),
 *     'Controller/Component/Auth' => array('/path/to/auths/', '/next/path/to/auths/'),
 *     'Controller/Component/Acl'  => array('/path/to/acls/', '/next/path/to/acls/'),
 *     'View'                      => array('/path/to/views/', '/next/path/to/views/'),
 *     'View/Helper'               => array('/path/to/helpers/', '/next/path/to/helpers/'),
 *     'Console'                   => array('/path/to/consoles/', '/next/path/to/consoles/'),
 *     'Console/Command'           => array('/path/to/commands/', '/next/path/to/commands/'),
 *     'Console/Command/Task'      => array('/path/to/tasks/', '/next/path/to/tasks/'),
 *     'Lib'                       => array('/path/to/libs/', '/next/path/to/libs/'),
 *     'Locale'                    => array('/path/to/locales/', '/next/path/to/locales/'),
 *     'Vendor'                    => array('/path/to/vendors/', '/next/path/to/vendors/'),
 *     'Plugin'                    => array('/path/to/plugins/', '/next/path/to/plugins/'),
 * ));

 */

/**
 * Custom Inflector rules can be set to correctly pluralize or singularize table, model, controller names or whatever other
 * string is passed to the inflection functions
 * Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
 * Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));

 */

Inflector::rules('plural', array(
    'rules' => array(),
    'irregular' => array(
        'fiche' => 'fiches',
66
        'article_organisation' => 'articles_organisations',
tguillon's avatar
tguillon committed
67
        'organisation_user' => 'organisations_users',
68
        'soustraitant_organisation' => 'soustraitants_organisations',
Théo GUILLON's avatar
Théo GUILLON committed
69 70
        'responsable_organisation' => 'responsables_organisations',
        'typage_organisation' => 'typages_organisations',
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
    ),
    'uninflected' => array()
));

/**
 * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
 * Uncomment one of the lines below, as you need. Make sure you read the documentation on CakePlugin to use more
 * advanced ways of loading plugins
 * CakePlugin::loadAll(); // Loads all plugins at once
 * CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit

 */
CakePlugin::loadAll([
    'AuthManager' => ['bootstrap' => true, 'routes' => false],
    'Database' => ['bootstrap' => false, 'routes' => false],
86
    'LibricielChecks' => ['bootstrap' => false, 'routes' => false],
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
    'Postgres' => ['bootstrap' => false, 'routes' => false],
    'Translator' => ['bootstrap' => true, 'routes' => false]
]);

/**
 * You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters:
 * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins
 * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers
 * Feel free to remove or add filters as you see fit for your application. A few examples:
 * Configure::write('Dispatcher.filters', array(
 *        'MyCacheFilter', //  will use MyCacheFilter class from the Routing/Filter package in your app.
 *        'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin.
 *        array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch
 *        array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch
 * ));
 */
Configure::write('Dispatcher.filters', [
    'AssetDispatcher',
    'CacheDispatcher'
]);

/**
 * Configures default file logging options
 */
App::uses('CakeLog', 'Log');

CakeLog::config('debug', [
    'engine' => 'File',
    'types' => [
        'notice',
        'info',
        'debug'
    ],
    'file' => 'debug',
]);

CakeLog::config('error', [
    'engine' => 'File',
    'types' => [
        'warning',
        'error',
        'critical',
        'alert',
        'emergency'
    ],
    'file' => 'error',
]);

//// Load composer autoload
require ROOT . DS . 'vendors'. DS .'autoload.php';

// Remove and re-prepend CakePHP's autoloader as composer thinks it is the most important.
// See https://github.com/composer/composer/commit/c80cb76b9b5082ecc3e5b53b1050f76bb27b127b
// See http://goo.gl/kKVJO7
spl_autoload_unregister(['App', 'load']);
spl_autoload_register(['App', 'load'], true, true);

144 145 146 147
// Gestion spéciale des exceptions pour qu'elles deviennent des messages flash dans l'interface
App::uses('UserFriendlyExceptionHandler', 'Lib');
UserFriendlyExceptionHandler::setUp();

148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
//Configuration du plugin Cakeflow
Configure::write('Cakeflow.app', 'webdelib');

Configure::write('Cakeflow.user.model', 'User');
Configure::write('Cakeflow.user.idsession', 'user.User.id');
Configure::write('Cakeflow.user.fields', 'prenom,nom,username');
Configure::write('Cakeflow.user.format', '%s %s (%s)');

Configure::write('Cakeflow.trigger.model', 'User');
Configure::write('Cakeflow.trigger.fields', 'prenom,nom,username');
Configure::write('Cakeflow.trigger.format', '%s %s (%s)');
Configure::write('Cakeflow.trigger.title', 'Utilisateur');

Configure::write('Cakeflow.target.model', 'Deliberation');

Configure::write('Cakeflow.manage.parapheur', false);
Configure::write('Cakeflow.manage.default', false);
Configure::write('Cakeflow.actionsOutOfTreatment', 'ST,JS,IN');
Configure::write('Cakeflow.trigger.parapheur', -1);
Configure::write("Cakeflow.etapesType", [
  'simple'=> ['value' => 1, 'label' => __('Simple')],
  'concurrent'=> ['value' => 2, 'label' => __('Concurrent [OU]')],
  'collaboratif'=> ['value' => 3, 'label' => __('Collaboratif [ET]')]]);
Configure::write('Cakeflow.models_circuit_default', ['User', 'Service']);

//Configuration du plugin AuthManager
Configure::write('AuthManager.ignorePlugins', []);
Configure::write('AuthManager.ignoreActions', []);
Configure::write('AuthManager.ignoreControllers', []);
Configure::write('AuthManager.models', []);

Configure::write('AuthManager.aros', []);
//Affichage des droits
Configure::write(
    'AuthManager.configCRUD',
    [
    'CRUD' => [
        'controllers' => ['group' => true],
        //
        'Deliberations' => [],
        //
        'mesProjetsValidation' => ['group' => true],
        'mesProjetsATraiter' => ['group' => true],
        'mesProjetsValides' => ['group' => true],
        'projetsMonService' => ['group' => true],
        //
        'tousLesProjetsSansSeance' => ['group' => true],
        'tousLesProjetsValidation' => ['group' => true],
        'tousLesProjetsAFaireVoter' => ['group' => true],
        //
        'autresActesAValider' => ['group' => true],
        'autresActesValides' => ['group' => true],
        'autresActesAEnvoyer' => ['group' => true],
        'autresActesEnvoyes' => ['group' => true],
        'nonTransmis' => ['group' => true],
        //
        'tousLesProjetsRecherche' => ['group' => true],
        'duplicate' => ['group' => true],
        'reattribuerTous' => ['group' => true],
        'editerTous' => ['group' => true],
        'supprimerTous' => ['group' => true],
        'traitementLot' => ['group' => true],
        //
        'goNext' => ['group' => true],
        'retour' => ['group' => true],
        'rebond' => ['group' => true],
        'validerEnUrgence' => ['group' => true],
        //
        'sendActesToSignature' => ['group' => true],
        'sendToParapheur' => ['group' => true],
        'cancelSignature' => ['group' => true],
        'cancelSendToTDT' => ['group' => true],
        //
        'Seances'=> [],
        'calendrier' => ['group' => true],
        'TableauDeBord' => ['group' => true],
        //
        'Postseances' => ['group' => true],
        'toSend' => ['group' => true],
        'transmit' => ['group' => true],
        'sendToSae' => ['group' => true],
        'signature' => ['group' => true],
        //
        'Collectivites' => ['role' => ['admin']],
        'Themes' => ['role' => ['admin']],
        //
        'ModelOdtValidator' => ['group' => true, 'role' => ['admin']],
        'Modeltemplates' => ['role' => ['admin']],
        'Modelvalidations' => ['group' => true, 'role' => ['admin']],
        //
        'Sequences' => ['role' => ['admin']],
        'Compteurs' => ['role' => ['admin']],
        'Typeactes' => ['role' => ['admin']],
        'Typeseances' => ['role' => ['admin']],
        'edit9Cases' => ['role' => ['admin']],
        //
        'Users' => ['role' => ['admin', 'manager']],
        'updateDroits' => ['group' => true, 'role' => ['admin']],
        'changeUserMdp' => ['group' => true],
        'changeFormatSortie' => ['group' => true],
        'Profils' => ['role' => ['admin']],
        'Services' => ['role' => ['admin', 'manager']],
        //
        'Cakeflow' => ['group' => true, 'role' => ['admin', 'manager']],
        'Circuits' => ['role' => ['admin', 'manager']],
        'Etapes' => ['role' => ['admin', 'manager']],
        'Compositions' => ['role' => ['admin', 'manager']],
        //
        'Acteurs' => ['role' => ['admin']],
        'Typeacteurs' => ['role' => ['admin']],
        //
        'Infosupdefs' => ['role' => ['admin']],
        //
        'Connecteurs' => ['group' => true, 'role' => ['admin']],
        'Crons' => ['role' => ['admin']],
        'Historiques' => ['group' => true, 'role' => ['admin']]
    //'ConnectorManager' => ['group' => true, 'role' => ['admin']],
    //'Connectors' => ['role' => ['admin']],
    ],
    'options' => ['order' => true]
    ]
);

require_once('webdpo.inc');
require_once(APP . DS . 'Lib' . DS . 'basics.php');

//
CakePlugin::load('Cakeflow', ['bootstrap' => true, 'routes' => false]);
CakePlugin::load('FusionConv', ['bootstrap' => true, 'routes' => false]);
CakePlugin::load('LdapManager', ['bootstrap' => true, 'routes' => false]);
278
CakePlugin::load('LibricielChecks', ['bootstrap' => false, 'routes' => false]);
279 280 281 282

//appVersion
$versionFile = file(ROOT . DS . 'VERSION.txt');
define('VERSION', trim(array_pop($versionFile)));