header.php 8.1 KB

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