210 lines
8.5 KiB
PHP
210 lines
8.5 KiB
PHP
<?php
|
|
if(isset($_POST['formLoginButtonSubmit'])){
|
|
$url = $_SESSION['erp']['url'];
|
|
$db = $_SESSION['erp']['db'];
|
|
$username = $_POST['formLoginFieldEmail'];
|
|
|
|
$user = $oUser->login($_POST);
|
|
|
|
if(isset($user['email']) && $user['email'] == $username){
|
|
$_SESSION['translations'] = $oTrans->listTranslations($user['lang_code']);
|
|
$_SESSION['user'] = $user;
|
|
$_SESSION['features'] = $oFeat->getFeaturesOfUser($user['id'], $user['lang_code']);
|
|
header("Location:".$oConf->getURLRoot());
|
|
} else {
|
|
unset($_SESSION['user']);
|
|
$_SESSION['message']['status'] = "orange";
|
|
$_SESSION['message']['content'] = "<b>Bad login or password</b>";
|
|
}
|
|
|
|
}
|
|
$session_lifetime = 60*60*8;
|
|
if(isset($_SESSION['user']) and isset($_SESSION['user']['stay_connected']) and $_SESSION['user']['stay_connected'] == true){
|
|
$session_lifetime = 60*60*24*365*5;
|
|
}
|
|
setcookie(session_name(),session_id(),time() + $session_lifetime);
|
|
|
|
$lang_code = (isset($_SESSION['user']['lang_code']))?$_SESSION['user']['lang_code']:$_SESSION['config']['default_lang_code'];
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="<?php echo substr($lang_code, 0, 2); ?>">
|
|
<head>
|
|
<!--META-->
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>Wefra: web framework for geeks</title>
|
|
|
|
<!-- CSS -->
|
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
<link href="<?php echo $oConf->getURLRoot('themes/materialize/css/materialize.css'); ?>" type="text/css" rel="stylesheet" media="screen,projection"/>
|
|
<link href="<?php echo $oConf->getURLRoot('themes/materialize/css/style.css'); ?>" type="text/css" rel="stylesheet" media="screen,projection"/>
|
|
|
|
<!--JQUERY and addons-->
|
|
<script src="<?php echo $oConf->getURLRoot('lib/jquery/jquery-3.2.1.js'); ?>"></script>
|
|
<script src="<?php echo $oConf->getURLRoot('lib/jquery/jquery-ui.js'); ?>"></script>
|
|
|
|
<script src="<?php echo $oConf->getURLRoot('themes/materialize/js/materialize.js'); ?>"></script>
|
|
<script src="<?php echo $oConf->getURLRoot('themes/materialize/js/init.js'); ?>"></script>
|
|
|
|
<!--D3JS v5-->
|
|
<script src="<?php echo $oConf->getURLRoot('lib/d3-v5/d3.min.js'); ?>"></script>
|
|
<script src="<?php echo $oConf->getURLRoot('scripts/config.js'); ?>"></script>
|
|
|
|
</head>
|
|
<body class="">
|
|
|
|
<?php
|
|
if(isset($display_cookie_message)){
|
|
echo '<div class="alert alert-warning" style="margin:0px;">'.$oTrans->getTranslation('display_cookie_message', $_SESSION['config']['default_lang_code']).'</div>';
|
|
unset($display_cookie_message);
|
|
}
|
|
?>
|
|
|
|
|
|
<nav>
|
|
<div class="nav-wrapper">
|
|
<a href="#!" class="brand-logo">Logo</a>
|
|
<a href="#" data-target="mobile-demo" class="sidenav-trigger"><i class="material-icons">menu</i></a>
|
|
<ul class="right hide-on-med-and-down">
|
|
<?php
|
|
foreach($_SESSION['features'] as $k=>$v){
|
|
// condition for logout
|
|
if ($_SESSION['features'][$k]->code == 'logout'){
|
|
echo '
|
|
<li class="">
|
|
<a class="nav-link" href="'.$oConf->getURLScript('logout.php').'">'.$_SESSION['features'][$k]->menu_label.'
|
|
</a>
|
|
</li>';
|
|
// and condition for others (not logout)
|
|
} else {
|
|
if($_SESSION['features'][$k]->is_parent==true){
|
|
$subFeatures = (isset($_SESSION['user']))
|
|
?$oFeat->getSubFeaturesForUser($_SESSION['features'][$k]->id, $_SESSION['user']['lang_code'])
|
|
:$oFeat->getSubFeatures($_SESSION['features'][$k]->id, $_SESSION['config']['default_lang_code']);
|
|
// <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"
|
|
echo '
|
|
<li class="dropdown">
|
|
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"
|
|
href="'.$oConf->getURLRoot($_SESSION['features'][$k]->url).'">
|
|
<span class="'.$_SESSION['features'][$k]->menu_icon.'"></span>'.$_SESSION['features'][$k]->menu_label.'
|
|
</a>
|
|
<ul class="dropdown-menu">';
|
|
foreach($subFeatures as $subFeature){
|
|
echo '
|
|
<li class="nav-item-submenu">
|
|
<a class="nav-link" href="'.$oConf->getURLRoot($subFeature->url).'">
|
|
<span class="'.$subFeature->menu_icon.'"></span>'.$subFeature->menu_label.'
|
|
</a>
|
|
</li>';
|
|
}
|
|
echo '</ul>
|
|
</li>';
|
|
} else {
|
|
echo '
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="'.$oConf->getURLRoot($_SESSION['features'][$k]->url).'">
|
|
<span class="'.$_SESSION['features'][$k]->menu_icon.'"></span>'.$_SESSION['features'][$k]->menu_label.'
|
|
</a>
|
|
</li>';
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
</ul>
|
|
</div>
|
|
</nav>
|
|
|
|
<ul class="sidenav" id="mobile-demo">
|
|
<?php
|
|
foreach($_SESSION['features'] as $k=>$v){
|
|
// condition for logout
|
|
if ($_SESSION['features'][$k]->code == 'logout'){
|
|
echo '
|
|
<li class="">
|
|
<a class="nav-link" href="'.$oConf->getURLScript('logout.php').'">'.$_SESSION['features'][$k]->menu_label.'
|
|
</a>
|
|
</li>';
|
|
// and condition for others (not logout)
|
|
} else {
|
|
if($_SESSION['features'][$k]->is_parent==true){
|
|
$subFeatures = (isset($_SESSION['user']))
|
|
?$oFeat->getSubFeaturesForUser($_SESSION['features'][$k]->id, $_SESSION['user']['lang_code'])
|
|
:$oFeat->getSubFeatures($_SESSION['features'][$k]->id, $_SESSION['config']['default_lang_code']);
|
|
// <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"
|
|
echo '
|
|
<li class="dropdown">
|
|
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"
|
|
href="'.$oConf->getURLRoot($_SESSION['features'][$k]->url).'">
|
|
<span class="'.$_SESSION['features'][$k]->menu_icon.'"></span>'.$_SESSION['features'][$k]->menu_label.'
|
|
</a>
|
|
<ul class="dropdown-menu">';
|
|
foreach($subFeatures as $subFeature){
|
|
echo '
|
|
<li class="nav-item-submenu">
|
|
<a class="nav-link" href="'.$oConf->getURLRoot($subFeature->url).'">
|
|
<span class="'.$subFeature->menu_icon.'"></span>'.$subFeature->menu_label.'
|
|
</a>
|
|
</li>';
|
|
}
|
|
echo '</ul>
|
|
</li>';
|
|
} else {
|
|
echo '
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="'.$oConf->getURLRoot($_SESSION['features'][$k]->url).'">
|
|
<span class="'.$_SESSION['features'][$k]->menu_icon.'"></span>'.$_SESSION['features'][$k]->menu_label.'
|
|
</a>
|
|
</li>';
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
</ul>
|
|
|
|
<!-- get and displays content of requested web page -->
|
|
<main>
|
|
<?php $oController->getPage("materialize", $lang_code); ?>
|
|
</main>
|
|
|
|
<!-- FOOTER SECTION -->
|
|
<footer class="page-footer grey darken-2">
|
|
<div class="container">
|
|
<div class="row">
|
|
|
|
<div class="col l6 s12">
|
|
<h5 class="grey-text text-darken-3">Company Bio</h5>
|
|
<p class="grey-text text-darken-4">JMDN Solutions Sàrl is a Swiss based company and provide services in Information Technology/Systems, Data Visualisation and everything related to Software Development</p>
|
|
</div>
|
|
|
|
<div class="col l6 s12">
|
|
<h5 class="grey-text text-darken-3">Legal</h5>
|
|
<ul>
|
|
<li><a class="grey-text text-darken-4" href="terms-of-services" target="_blank">Terms of services</a></li>
|
|
<li><a class="grey-text text-darken-4" href="privacy-policy" target="_blank">Privacy Policy</a></li>
|
|
<li><a class="grey-text text-darken-4" href="cookies-policy" target="_blank">Cookies Policy</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="footer-copyright">
|
|
<div class="container">
|
|
Made by <a class="brown-text text-lighten-3" href="https://www.jmdn-group.com">JMDN Solutions Sàrl</a>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
|
|
<!-- Scripts-->
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
$(function(){
|
|
$('select').formSelect();
|
|
});
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|
|
|