header.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. <!-- Plugin css files -->
  64. <?php echo Plugin::callCss($mediaRoot,$cacheVersion); ?>
  65. </head>
  66. <body>
  67. <!-- Fixed navbar -->
  68. <nav id="mainMenu" class="navbar navbar-expand-md navbar-dark fixed-top noPrint">
  69. <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>
  70. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
  71. <div class="menu">
  72. <div class="menu-icon">
  73. <div class="menu-line menu-line-1"></div>
  74. <div class="menu-line menu-line-2"></div>
  75. <div class="menu-line menu-line-3"></div>
  76. <div class="menu-line menu-line-4"></div>
  77. <div class="menu-line menu-line-5"></div>
  78. </div>
  79. </div>
  80. </button>
  81. <div class="collapse navbar-collapse" id="navbarCollapse">
  82. <ul class="navbar-nav navbar-main">
  83. <?php foreach($mainMenu as $item): ?>
  84. <?php if (isset($item['label']) && $item['label'] == 'Réglages') $page = basename($_SERVER['PHP_SELF']);
  85. $classes = isset($item['classes'])? $item['classes']: '';
  86. if(isset($item['url'])
  87. && ((!empty($item['url'])
  88. && strpos($page, $item['url']) !== false
  89. && $item['url'] != 'index.php') || $page == $item['url'])
  90. || (isset($item['active']) && $item['active'] ==true)
  91. ){
  92. $classes .= ' active';
  93. }
  94. ?>
  95. <li data-id="<?php echo isset($item['id'])?$item['id']:''; ?>"
  96. class="nav-item <?php echo $classes; ?> ">
  97. <a class="nav-link"
  98. title="<?php echo isset($item['title'])?$item['title']:''; ?>"
  99. target="<?php echo isset($item['target'])?$item['target']:''; ?>"
  100. onclick="<?php echo isset($item['onclick'])?$item['onclick']:''; ?>"
  101. <?php echo isset($item['url'])? 'href="'.$item['url'].'"':''; ?>>
  102. <?php echo (isset($item['icon'])?'<i class="'.$item['icon'].'"></i> ':'').'<span>'.(isset($item['label'])?$item['label']:'').'</span>'; ?>
  103. <?php echo isset($item['html'])? $item['html']:''; ?>
  104. </a>
  105. </li>
  106. <?php endforeach; ?>
  107. </ul>
  108. <?php Plugin::callHook("header", array()); ?>
  109. <div id="loginHeader" class="ml-auto text-right">
  110. <?php Plugin::callHook("login_header", array()); ?>
  111. <div class="dropdown user-dropdown-menu">
  112. <button class="btn btn-dark dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  113. <?php if ($myUser->connected()): ?>
  114. <img src="<?php echo $myUser->getAvatar(); ?>" class="avatar-mini avatar-rounded avatar-login" title="<?php echo $myUser->fullName(); ?>">
  115. <?php else: ?>
  116. Non connecté - Connexion
  117. <?php endif;?>
  118. </button>
  119. <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
  120. <?php if (!$myUser->connected()): ?>
  121. <div class="dropdown-item login-item" >
  122. <form id="loginForm" method="post" action="action.php?action=login" class="form-inline mt-mb-0">
  123. <label for="login">Identifiant</label>
  124. <input name="login" id="login" maxlength="64" class="form-control w-100 pb-1" type="text" required="required" autofocus="true">
  125. <label for="password">Mot de passe</label>
  126. <input data-type="password" name="password" id="password" class="form-control w-100" type="password" required="required">
  127. <div class="form-check w-100 mt-2 mb-1">
  128. <input class="form-check-input" data-type="checkbox" type="checkbox" id="rememberMe" name="rememberMe">
  129. <label class="form-check-label" for="rememberMe">Se souvenir de moi</label>
  130. </div>
  131. <input class="btn btn-success btn-small w-100" type="submit" value="Connexion" onclick="toggle_preloader_to('#loginRequest', 'div.container-fluid');">
  132. <a href="account.lost.php" class="d-block w-100 text-center mt-2 mb-1">Mot de passe oublié ?</a>
  133. </form>
  134. </div>
  135. <?php else: ?>
  136. <div class="font-weight-bold text-primary p-2 text-center"><?php echo $myUser->fullName(); ?></div>
  137. <?php foreach($userMenu as $item): ?>
  138. <?php if(isset($item['custom'])):
  139. echo $item['custom'];
  140. else: ?>
  141. <a class="dropdown-item" href="<?php echo $item['url']; ?>">
  142. <?php echo (isset($item['icon'])?'<i class="'.$item['icon'].'"></i> ':'').$item['label']; ?>
  143. </a>
  144. <?php endif; ?>
  145. <?php endforeach; ?>
  146. <?php endif; ?>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. </nav>
  152. <!-- Begin page content -->
  153. <div class="container-fluid">
  154. <?php } ?>