wefra/themes/materialize/index.php
2020-11-30 07:22:10 +01:00

180 lines
5.9 KiB
PHP

<?php
if(isset($_POST['formLoginButtonSubmit'])){
$user = new ClassUser();
$user = $oUser->login($_POST);
if(isset($user['email'])){
$_SESSION['translations'] = $oTrans->listTranslations($user['lang_code']);
$_SESSION['user'] = $user;
$_SESSION['features'] = $oFeat->getFeaturesOfUser($user['id'], $user['lang_code']);
header("Location:".$oConf->getURLRoot());
} else {
$_SESSION['message'] = $user;
}
}
if(isset($_POST['submit_change_password'])){
// Open connection with Globsi Backend
$userPassword = $oUser->changePassword($_SESSION['user']['id'], $_POST);
if($userPassword['state']=="success"){
$getUser = $oUser->getUser($_SESSION['user']['id']);
if(isset($getUser['password'])){
unset($_SESSION);
header("Location:".$oConf->getURLRoot('scripts/logout.php'));
}
}
}
$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, shrink-to-fit=no"/>
<title>Projects Run Smoothly</title>
<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>
<!--Cleave.js: easy formatting of HTML input tags-->
<script src="<?php echo $oConf->getURLRoot('lib/node_modules/cleave.js/dist/cleave.min.js'); ?>"></script>
<!--Materialize-->
<link href="<?php echo $oConf->getURLRoot('lib/materialize/materialize-1.1.0.min.css'); ?>" type="text/css" rel="stylesheet" media="screen,projection"/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="<?php echo $oConf->getURLRoot('lib/materialize/materialize-1.1.0.min.js'); ?>"></script>
<script src="<?php echo $oConf->getURLRoot('themes/materialize/js/init.js'); ?>"></script>
</head>
<body>
<?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);
}
?>
<div class="navbar-fixed">
<nav>
<div class="nav-wrapper">
<a class="brand-logo" href="#!">Wodoo</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_menu_display == true) {
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>
</div>
<!--ENDOF .navbar-fixed-->
<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_menu_display == true) {
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">
<div class="container">
<div class="row center">
<div class="col s12 l6">
<p>
<a href="cookies-policy">Cookies Policy</a><br>
<a href="privacy-policy">Privacy Policy</a><br>
<a href="terms-and-conditions">Terms and Condtions</a><br>
</p>
</div>
<!--<div class="col s12"></div>-->
<div class="col s12 l6">
<p><b>Powered by</b><br><a href="https://www.jmdn-solutions.com/home" target="_blank">JMDN Solutions Sàrl</a><br>
info@jmdn-solutions.com</p>
</div>
</div>
<!--ENDOF .row-->
</div>
</footer>
<footer class="footer-bottom">
<div class="container">
<div class="row center">
<div class="col s12 l6">
<h5>Languages</h5>
<p>HTML 5, CSS 3, javascript, PHP 7, Postgresql</p>
</div>
<!--ENDOF .col-->
<div class="col s12 l6">
<h5>Librairies / APIs</h5>
<p>jQuery, d3js, node.js, XML-RPC, JSON-RPC</p>
</div>
<!--ENDOF .col-->
</div>
<!--ENDOF .row-->
</div>
<!--ENDOF .container-->
</footer>
</body>
</html>