header.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <?php require_once __DIR__.DIRECTORY_SEPARATOR.'common.php';
  2. $scheme = define_url_scheme();
  3. $mediaRoot = define_media_root();
  4. if($myUser->preference('passwordTime')!='' && !$myUser->superadmin){
  5. $basepage = explode('?',$page);
  6. $basepage = $basepage[0];
  7. if(is_numeric($conf->get('password_delay')) && $basepage!="account.php" && ( (time() - ($conf->get('password_delay') * 86400) > $myUser->preference('passwordTime')) ) ) header('location: account.php?error=Votre mot de passe est trop vieux, veuillez le renouveller ci dessous.');
  8. }
  9. //Redirige la home si définie dans les settings
  10. if(($page=='index.php' || $page==basename(ROOT_URL) || $page=='') && !isset($_['module']) && !empty($conf->get('home_page')))
  11. header('location:'.$conf->get('home_page'));
  12. $cssModule = array();
  13. foreach(array('module','page','section') as $term){
  14. if(isset($_[$term])) $cssModule[] = preg_replace('/([^a-z])/i', '-',$term.'-'.$_[$term]);
  15. }
  16. if(empty($cssModule) && ($page=='index.php' || $page==basename(ROOT_URL) || $page=='')) $cssModule[] = 'module-index';
  17. if(!isset($_['admin_login']) && file_exists('enabled.maintenance') && !$myUser->connected()){
  18. isset($_['error']) && !empty($_['error']) ? header('Location: maintenance.php?error='.$_['error']) : header('Location: maintenance.php');
  19. exit();
  20. } else {
  21. $mainMenu = array();
  22. Plugin::callHook("menu_main", array(&$mainMenu));
  23. uasort ($mainMenu , function($a,$b){return $a['sort']>$b['sort']?1:-1;});
  24. $userMenu = array();
  25. if ($myUser->connected()){
  26. Plugin::callHook("menu_user", array(&$userMenu));
  27. uasort ($userMenu , function($a,$b){return $a['sort']>$b['sort']?1:-1;});
  28. }
  29. ?>
  30. <!DOCTYPE html>
  31. <html class="html <?php echo implode(' ',$cssModule); ?>" lang="fr">
  32. <head>
  33. <meta charset="utf-8">
  34. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  35. <meta name="description" content="">
  36. <meta name="author" content="">
  37. <!-- <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico"> -->
  38. <link rel="shortcut icon" type="image/png" href="action.php?action=general_favicon_download" />
  39. <?php
  40. $title=$myUser->connected() ? 'Accueil':'Connexion';
  41. foreach($mainMenu as $item):
  42. $title = (!empty($item['url']) && strpos($page, $item['url']) !== false) ? $item['label'] : $title;
  43. endforeach;
  44. foreach($userMenu as $item):
  45. $title = (isset($item['url']) && strpos($page, $item['url']) !== false) ? $item['label'] : $title;
  46. endforeach;
  47. ?>
  48. <title><?php echo PROGRAM_NAME.' - '.$title ?></title>
  49. <!-- Bootstrap core CSS -->
  50. <link href="<?php echo $mediaRoot ?>/css/bootstrap.min.css" rel="stylesheet">
  51. <!-- Jquery ui -->
  52. <link rel="stylesheet" href="<?php echo $mediaRoot ?>/css/jquery-ui.min.css">
  53. <link rel="stylesheet" href="<?php echo $mediaRoot ?>/css/jquery.timepicker.min.css">
  54. <!-- Font awesome -->
  55. <link rel="stylesheet" href="<?php echo $mediaRoot ?>/css/fontawesome-all.min.css">
  56. <!-- Trumbowyg -->
  57. <link href="<?php echo $mediaRoot ?>/css/trumbowyg.min.css" rel="stylesheet">
  58. <link href="<?php echo $mediaRoot ?>/css/trumbowyg.table.css" rel="stylesheet">
  59. <link href="<?php echo $mediaRoot ?>/css/trumbowyg.colors.css" rel="stylesheet">
  60. <?php if(!$conf->get('offline_mode')): ?>
  61. <!-- Lato font-->
  62. <link href="https://fonts.googleapis.com/css?family=Lato:300,400" rel="stylesheet">
  63. <?php endif; ?>
  64. <!-- Custom styles for this template -->
  65. <link href="<?php echo $mediaRoot ?>/css/main.css?v=<?php echo $cacheVersion; ?>" rel="stylesheet">
  66. <!-- Plugin css files -->
  67. <?php echo Plugin::callCss($mediaRoot,$cacheVersion); ?>
  68. </head>
  69. <body>
  70. <!-- Fixed navbar -->
  71. <nav id="mainMenu" class="navbar navbar-expand-md navbar-dark fixed-top noPrint">
  72. <a class="navbar-brand" style="background-image: url('action.php?action=general_logo_download')" href="index.php"><?php echo $conf->get('show_application_name') ? PROGRAM_NAME : ''; ?></a>
  73. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
  74. <div class="menu">
  75. <div class="menu-icon">
  76. <div class="menu-line menu-line-1"></div>
  77. <div class="menu-line menu-line-2"></div>
  78. <div class="menu-line menu-line-3"></div>
  79. <div class="menu-line menu-line-4"></div>
  80. <div class="menu-line menu-line-5"></div>
  81. </div>
  82. </div>
  83. </button>
  84. <div class="collapse navbar-collapse" id="navbarCollapse">
  85. <ul class="navbar-nav navbar-main">
  86. <?php foreach($mainMenu as $item): ?>
  87. <?php if (isset($item['label']) && $item['label'] == 'Réglages') $page = basename($_SERVER['PHP_SELF']);
  88. $classes = isset($item['classes'])? $item['classes']: '';
  89. if(isset($item['url'])
  90. && ((!empty($item['url'])
  91. && strpos($page, $item['url']) !== false
  92. && $item['url'] != 'index.php') || $page == $item['url'])
  93. || (isset($item['active']) && $item['active'] ==true)
  94. ){
  95. $classes .= ' active';
  96. }
  97. ?>
  98. <li data-id="<?php echo isset($item['id'])?$item['id']:''; ?>"
  99. class="nav-item <?php echo $classes; ?> ">
  100. <a class="nav-link"
  101. title="<?php echo isset($item['title'])?$item['title']:''; ?>"
  102. target="<?php echo isset($item['target'])?$item['target']:''; ?>"
  103. onclick="<?php echo isset($item['onclick'])?$item['onclick']:''; ?>"
  104. <?php echo isset($item['url'])? 'href="'.$item['url'].'"':''; ?>>
  105. <?php echo (isset($item['icon'])?'<i class="'.$item['icon'].'"></i> ':'').'<span>'.(isset($item['label'])?$item['label']:'').'</span>'; ?>
  106. <?php echo isset($item['html'])? $item['html']:''; ?>
  107. </a>
  108. </li>
  109. <?php endforeach; ?>
  110. </ul>
  111. <?php Plugin::callHook("header", array()); ?>
  112. <div id="loginHeader" class="ml-auto text-right">
  113. <?php Plugin::callHook("login_header", array()); ?>
  114. <div class="dropdown user-dropdown-menu">
  115. <button class="btn btn-dark dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  116. <?php if ($myUser->connected()): ?>
  117. <img src="<?php echo $myUser->getAvatar(); ?>" class="avatar-mini avatar-rounded avatar-login" title="<?php echo $myUser->fullName(); ?>">
  118. <?php else: ?>
  119. Non connecté - Connexion
  120. <?php endif;?>
  121. </button>
  122. <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
  123. <?php if (!$myUser->connected()): ?>
  124. <div class="dropdown-item login-item" >
  125. <form id="loginForm" data-action="login" class="form-inline mt-mb-0">
  126. <label for="login">Identifiant</label>
  127. <input name="login" id="login" maxlength="64" class="form-control form-control-sm w-100 pb-1" type="text" required="required" autofocus="true">
  128. <label for="password">Mot de passe</label>
  129. <input data-type="password" name="password" id="password" class="form-control form-control-sm w-100" type="password" required="required">
  130. <div class="form-check w-100 mt-2 mb-1">
  131. <input class="form-check-input" data-type="checkbox" type="checkbox" id="rememberMe" name="rememberMe">
  132. <label class="form-check-label" for="rememberMe">Se souvenir de moi</label>
  133. </div>
  134. <div class="btn btn-success btn-sm w-100" id="login-button" onclick="core_login('body>.container-fluid')">Se connecter</div>
  135. <?php if($conf->get('password_allow_lost')): ?>
  136. <a href="account.lost.php" class="d-block w-100 text-center mt-2 mb-1 btn-lost-account">Mot de passe oublié ?</a>
  137. <?php endif; ?>
  138. </form>
  139. </div>
  140. <?php else: ?>
  141. <div class="font-weight-bold text-primary p-2 text-center user-fullname"><?php echo $myUser->fullName(); ?></div>
  142. <?php foreach($userMenu as $item): ?>
  143. <?php if(isset($item['custom'])):
  144. echo $item['custom'];
  145. else: ?>
  146. <a class="dropdown-item" href="<?php echo $item['url']; ?>">
  147. <?php echo (isset($item['icon'])?'<i class="'.$item['icon'].'"></i> ':'').$item['label']; ?>
  148. </a>
  149. <?php endif; ?>
  150. <?php endforeach; ?>
  151. <?php endif; ?>
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. </nav>
  157. <!-- Begin page content -->
  158. <div class="container-fluid">
  159. <?php } ?>