getAll(); //CONFS GÉNÉRALES Configuration::setting('configuration-global',array( "Gestion des pages :", 'home_page' => array("label"=>"Page d'accueil","type"=>"text","legend"=>"Laisser vide pour gérer en automatique","placeholder"=>"eg : index.php?module=example"), "Gestion des clés Map Algolia API :", 'maps_api_id' => array("label"=>"ID de l'application","type"=>"text","legend"=>"Clé API pour le composant location","placeholder"=>"eg. pl0749TULNDW..."), 'maps_api_key' => array("label"=>"Clé publique de l'application","type"=>"password","legend"=>"Clé API pour le composant location","placeholder"=>"eg. db6788b1e4165d3370ed88a304704676..."), "Authentification :", 'account_block' => array("label"=>"Activer le blocage de compte au bout de N essais","legend"=>"Tous les utilisateurs seront soumis à la règle","type"=>"checkbox"), 'account_block_try' => array("label"=>"Nombre d'essais avant blocage du compte","legend"=>"L'utilisateur aura N tentatives pour se connecter avant d'être bloqué","type"=>"number", "placeholder"=>"eg. 10"), 'account_block_delay' => array("label"=>"Durée de blocage", "legend"=>"(en minutes)", "type"=>"number", "placeholder"=>"eg. 30") )); //CACHE CSS & JS $cacheVersion = 1; if(file_exists(__DIR__.SLASH.'.git'.SLASH.'refs'.SLASH.'heads'.SLASH.'master')) $cacheVersion = file_get_contents(__DIR__.SLASH.'.git'.SLASH.'refs'.SLASH.'heads'.SLASH.'master'); if($myUser->login==null && isset($_COOKIE[COOKIE_NAME])){ $cookie = UserPreference::load(array('key'=>'cookie','value'=>$_COOKIE[COOKIE_NAME])); if($cookie!=false){ if(Plugin::is_active('fr.idleman.activedirectory')) require_once(PLUGIN_PATH.'activedirectory'.SLASH.'activedirectory.plugin.php'); $myUser = User::byLogin($cookie->user); if($myUser->origin != 'active_directory'){ $myUser->ranks = array(); $myUser->firms = array(); $myUser->loadRanks(); $myUser->loadPreferences(); } $defaultFirm = !empty($myUser->preference('default_firm')) ? $myUser->preferences['default_firm'] : key($myUser->firms); $myFirm = isset($myUser->firms[$defaultFirm]) ? $myUser->firms[$defaultFirm]:key($myUser->firms); $_SESSION['currentUser'] = serialize($myUser); $_SESSION['firm'] = serialize($myFirm); } } $myFirm = isset($_SESSION['firm']) ? unserialize($_SESSION['firm']): new Firm(); //MENUS Plugin::addHook("menu_account", function(&$accountMenu){ global $myUser; if(!$myUser->connected()) throw new Exception('Vous devez être connecté pour accéder à cette fonctionnalité'); $accountMenu[]= array( 'sort' =>0, 'url' => 'account.php?section=global', 'icon' => 'fas fa-angle-right', 'label' => 'Général', ); }); Plugin::addHook("menu_setting", function(&$settingMenu){ global $myUser; $settingMenu[]= array( 'sort' =>0, 'url' => 'setting.php?section=global', 'icon' => 'fas fa-angle-right', 'label' => 'Général', ); if($myUser->can('plugin','configure')) $settingMenu[]= array( 'sort' =>18, 'url' => 'setting.php?section=plugin', 'icon' => 'fas fa-angle-right', 'label' => 'Plugins', 'category' => 'administration' ); if($myUser->can('user','configure')) $settingMenu[]= array( 'sort' =>20, 'url' => 'setting.php?section=user', 'icon' => 'fas fa-angle-right', 'label' => 'Utilisateurs', 'category' => 'administration' ); if($myUser->can('rank','configure')) $settingMenu[]= array( 'sort' =>21, 'url' => 'setting.php?section=rank', 'icon' => 'fas fa-angle-right', 'label' => 'Rangs & Accès', 'category' => 'administration' ); if($myUser->can('firm','configure')) $settingMenu[]= array( 'sort' =>22, 'url' => 'setting.php?section=firm', 'icon' => 'fas fa-angle-right', 'label' => 'Établissements', 'category' => 'administration' ); if($myUser->can('user','configure')) $settingMenu[]= array( 'sort' =>23, 'url' => 'setting.php?section=userfirmrank', 'icon' => 'fas fa-angle-right', 'label' => 'Établissement / Utilisateur / Rang', 'category' => 'administration' ); if($myUser->can('plugin','configure')) $settingMenu[]= array( 'sort' =>24, 'url' => 'setting.php?section=firmPlugin', 'icon' => 'fas fa-angle-right', 'label' => 'Établissement / Plugins', 'category' => 'administration' ); if($myUser->can('dictionnary','configure')) $settingMenu[]= array( 'sort' =>20, 'url' => 'setting.php?section=dictionnary', 'icon' => 'fas fa-angle-right', 'label' => 'Listes de valeur' ); if($myUser->can('log','read')) $settingMenu[]= array( 'sort' =>16, 'url' => 'setting.php?section=log', 'icon' => 'fas fa-angle-right', 'label' => 'Logs', 'category' => 'administration' ); if($myUser->login!='') $settingMenu[]= array( 'sort' =>16, 'url' => 'setting.php?section=update', 'icon' => 'fas fa-angle-right', 'label' => 'Mises à jour', 'category' => 'administration' ); }); Plugin::addHook("menu_main", function(&$mainMenu) { global $myUser; $mainMenu[] = array( 'sort' =>0, 'icon' => 'fas fa-home', 'label' => 'Accueil', 'url' => 'index.php', 'color' => '#383838' ); if(!$myUser->connected()) return; $settingMenu = array(); Plugin::callHook("menu_setting", array(&$settingMenu)); }); Plugin::addHook("menu_user", function(&$userMenu){ global $myUser,$myFirm; $rankLabels = array(); if($myUser->superadmin){ $rankLabels[] = 'Super Admin'; } else { if(isset($myUser->ranks[$myFirm->id])){ foreach($myUser->ranks[$myFirm->id] as $rank){ $rankLabels[] = $rank->label; } } } if(count($rankLabels)!=0){ $rankLabels = '