header.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. <?php echo Plugin::callCss("css"); ?>
  41. </head>
  42. <body>
  43. <div id="wrap">
  44. <!-- menu -->
  45. <nav role="navigation" class="navbar navbar-inverse">
  46. <div class="container-fluid">
  47. <!-- Brand and toggle get grouped for better mobile display -->
  48. <div class="navbar-header">
  49. <button data-target="#bs-example-navbar-collapse-5" data-toggle="collapse" class="navbar-toggle" type="button">
  50. <span class="sr-only">Toggle navigation</span>
  51. <span class="icon-bar"></span>
  52. <span class="icon-bar"></span>
  53. <span class="icon-bar"></span>
  54. </button>
  55. <a href="index.php" class="navbar-brand">Hackpoint</a>
  56. </div>
  57. <!-- Collect the nav links, forms, and other content for toggling -->
  58. <div id="bs-example-navbar-collapse-5" class="collapse navbar-collapse">
  59. <ul class="nav navbar-nav">
  60. <?php
  61. $menuItems = array();
  62. Plugin::callHook("menu_main",array(&$menuItems));
  63. usort($menuItems, function($a, $b){
  64. if ($a['sort'] == $b['sort']) {
  65. return 0;
  66. }
  67. return ($a['sort'] < $b['sort']) ? -1 : 1;
  68. });
  69. foreach($menuItems as $item):
  70. ?>
  71. <li <?php echo $page==$item['url']?'class="active"':''; ?>><a href="<?php echo $item['url'];?>"><?php echo $item['label'];?></a></li>
  72. <?php endforeach; ?>
  73. </ul>
  74. <ul class="nav navbar-nav navbar-right">
  75. <?php if (!$myUser->connected()): ?>
  76. <li>
  77. <form id="loginForm" method="post" action="action.php?action=login" class="navbar-form navbar-right">
  78. Identifiant :
  79. <input name="login" placeholder="Identifiant" class="form-control" type="text">
  80. Mot de passe :
  81. <input name="password" placeholder="Mot de passe" class="form-control" type="password">
  82. <input class="btn btn-success" value="Connexion" type="submit">
  83. </form>
  84. </li>
  85. <?php else: ?>
  86. <li class="dropdown <?php echo $page=='account.php'?'active':''; ?>" >
  87. <a data-toggle="dropdown" class="dropdown-toggle" href="#"> Connecté en tant que <?php echo $myUser->login; ?> <b class="caret"></b></a>
  88. <ul role="menu" class="dropdown-menu">
  89. <li class="dropdown-header">Préférences</li>
  90. <li ><a href="plugin.php">Plugins</a></li>
  91. <li ><a href="account.php">Profil</a></li>
  92. <li class="divider"></li>
  93. <?php
  94. $menuItems = array();
  95. Plugin::callHook("menu_setting",array(&$menuItems));
  96. usort($menuItems, function($a, $b){
  97. if ($a['sort'] == $b['sort']) {
  98. return 0;
  99. }
  100. return ($a['sort'] < $b['sort']) ? -1 : 1;
  101. });
  102. foreach($menuItems as $item): ?>
  103. <li><a href="<?php echo $item['url'];?>"><?php echo $item['label'];?></a></li>
  104. <?php endforeach;?>
  105. <li><a href="action.php?action=logout">Déconnexion</a></li>
  106. </ul>
  107. </li>
  108. <?php endif; ?>
  109. </ul>
  110. <!--<button class="btn btn-danger navbar-btn" onclick="window.location='action.php?action=logout';" type="button">MAJ</button>-->
  111. </div><!-- /.navbar-collapse -->
  112. </div><!-- /.container-fluid -->
  113. </nav>
  114. <!-- menu -->
  115. <!-- body -->
  116. <div class="container-fluid">
  117. <!-- messages -->
  118. <?php if (isset($_SESSION['error'])): ?>
  119. <div class="alert alert-danger">
  120. <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
  121. <strong>Oops!</strong> <?php echo $_SESSION['error']; unset($_SESSION['error']); ?>
  122. </div>
  123. <?php endif; ?>
  124. <?php if (isset($_SESSION['success'])): ?>
  125. <div class="alert alert-success alert-dismissable">
  126. <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
  127. <strong>Succès !</strong> <?php echo $_SESSION['success']; unset($_SESSION['success']); ?>
  128. </div>
  129. <?php endif; ?>
  130. <!-- messages -->