header.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?php
  2. require_once __DIR__.DIRECTORY_SEPARATOR.'common.php';
  3. Plugin::addHook("page", function(){
  4. global $_;
  5. if(isset($_['module'])) return;
  6. require_once('dashboard.php');
  7. });
  8. Plugin::addHook("menu_main", function(&$menuItems){
  9. global $_,$myUser;
  10. $menuItems[] = array(
  11. 'sort'=>0,
  12. 'url'=>'index.php',
  13. 'label'=>'Sketch',
  14. 'icon'=>'codepen'
  15. );
  16. if (! $myUser->connected()) return;
  17. $menuItems[] = array(
  18. 'sort'=>1,
  19. 'url'=>'component.php',
  20. 'label'=>'Composants',
  21. 'icon'=>'codepen'
  22. );
  23. });
  24. ?>
  25. <!doctype html>
  26. <html class="no-js" lang="">
  27. <head>
  28. <meta charset="utf-8">
  29. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  30. <title><?php echo PROGRAM_NAME.' V'.SOURCE_VERSION.'.'.BASE_VERSION ?></title>
  31. <link rel="icon" type="image/png" href="img/favicon.png">
  32. <meta name="description" content="">
  33. <meta name="viewport" content="width=device-width, initial-scale=1">
  34. <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,800,700,400italic,600italic,700italic,800italic,300italic" rel="stylesheet" type="text/css">
  35. <link rel="stylesheet" href="css/bootflat.min.css">
  36. <link rel="stylesheet" href="css/font-awesome.min.css">
  37. <link rel="stylesheet" href="css/codemirror.css">
  38. <link rel="stylesheet" href="css/monokai.css">
  39. <link rel="stylesheet" href="css/main.css">
  40. </head>
  41. <body>
  42. <div id="wrap">
  43. <!-- menu -->
  44. <nav role="navigation" class="navbar navbar-inverse">
  45. <div class="container-fluid">
  46. <!-- Brand and toggle get grouped for better mobile display -->
  47. <div class="navbar-header">
  48. <button data-target="#bs-example-navbar-collapse-5" data-toggle="collapse" class="navbar-toggle" type="button">
  49. <span class="sr-only">Toggle navigation</span>
  50. <span class="icon-bar"></span>
  51. <span class="icon-bar"></span>
  52. <span class="icon-bar"></span>
  53. </button>
  54. <a href="index.php" class="navbar-brand">Hackpoint</a>
  55. </div>
  56. <!-- Collect the nav links, forms, and other content for toggling -->
  57. <div id="bs-example-navbar-collapse-5" class="collapse navbar-collapse">
  58. <ul class="nav navbar-nav">
  59. <?php
  60. $menuItems = array();
  61. Plugin::callHook("menu_main",array(&$menuItems));
  62. usort($menuItems, function($a, $b){
  63. if ($a['sort'] == $b['sort']) {
  64. return 0;
  65. }
  66. return ($a['sort'] < $b['sort']) ? -1 : 1;
  67. });
  68. foreach($menuItems as $item):
  69. ?>
  70. <li <?php echo $page==$item['url']?'class="active"':''; ?>><a href="<?php echo $item['url'];?>"><?php echo $item['label'];?></a></li>
  71. <?php endforeach; ?>
  72. </ul>
  73. <ul class="nav navbar-nav navbar-right">
  74. <?php if (!$myUser->connected()): ?>
  75. <li>
  76. <form id="loginForm" method="post" action="action.php?action=login" class="navbar-form navbar-right">
  77. Identifiant :
  78. <input name="login" placeholder="Identifiant" class="form-control" type="text">
  79. Mot de passe :
  80. <input name="password" placeholder="Mot de passe" class="form-control" type="password">
  81. <input class="btn btn-success" value="Connexion" type="submit">
  82. </form>
  83. </li>
  84. <?php else: ?>
  85. <li class="dropdown <?php echo $page=='account.php'?'active':''; ?>" >
  86. <a data-toggle="dropdown" class="dropdown-toggle" href="#"> Connecté en tant que <?php echo $myUser->login; ?> <b class="caret"></b></a>
  87. <ul role="menu" class="dropdown-menu">
  88. <li class="dropdown-header">Préférences</li>
  89. <li ><a href="plugin.php">Plugins</a></li>
  90. <li ><a href="account.php">Profil</a></li>
  91. <li class="divider"></li>
  92. <?php
  93. $menuItems = array();
  94. Plugin::callHook("menu_setting",array(&$menuItems));
  95. usort($menuItems, function($a, $b){
  96. if ($a['sort'] == $b['sort']) {
  97. return 0;
  98. }
  99. return ($a['sort'] < $b['sort']) ? -1 : 1;
  100. });
  101. foreach($menuItems as $item): ?>
  102. <li><a href="<?php echo $item['url'];?>"><?php echo $item['label'];?></a></li>
  103. <?php endforeach;?>
  104. <li><a href="action.php?action=logout">Déconnexion</a></li>
  105. </ul>
  106. </li>
  107. <?php endif; ?>
  108. </ul>
  109. <!--<button class="btn btn-danger navbar-btn" onclick="window.location='action.php?action=logout';" type="button">MAJ</button>-->
  110. </div><!-- /.navbar-collapse -->
  111. </div><!-- /.container-fluid -->
  112. </nav>
  113. <!-- menu -->
  114. <!-- body -->
  115. <div class="container-fluid">
  116. <!-- messages -->
  117. <?php if (isset($_SESSION['error'])): ?>
  118. <div class="alert alert-danger">
  119. <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
  120. <strong>Oops!</strong> <?php echo $_SESSION['error']; unset($_SESSION['error']); ?>
  121. </div>
  122. <?php endif; ?>
  123. <?php if (isset($_SESSION['success'])): ?>
  124. <div class="alert alert-success alert-dismissable">
  125. <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
  126. <strong>Succès !</strong> <?php echo $_SESSION['success']; unset($_SESSION['success']); ?>
  127. </div>
  128. <?php endif; ?>
  129. <!-- messages -->