263 lines
11 KiB
PHP
263 lines
11 KiB
PHP
<?php
|
|
if(isset($_POST['login_form_submit'])){
|
|
$user = $oUser->login($_POST);
|
|
if(isset($user['email']) && $user['email'] == $_POST['login_form_email']){
|
|
$_SESSION['translations'] = $oTrans->listTranslations($user['lang_code']);
|
|
$_SESSION['user'] = $user;
|
|
$_SESSION['features'] = $oFeat->getFeaturesOfUser($user['id'], $user['lang_code']);
|
|
$_SESSION['config']['default_lang_code'] = $user['lang_code'];
|
|
} else {
|
|
$_SESSION['message'] = $user;
|
|
}
|
|
}
|
|
|
|
//REM You MUST ABSOLUTELY leave this code here and not place it in the model (models/markets.php)
|
|
// because of the header which must be declared before any of HTML tags, even <html>
|
|
// if a guest does a trade from market page, they will need to register to continue
|
|
if(isset($_POST['portfolio_form_submit'])){
|
|
if(!isset($_SESSION['user']['id'])){
|
|
$_SESSION['_POST'] = $_POST;
|
|
header("Location: ".$oConf->getURLRoot('register')) or die("error");
|
|
}
|
|
}
|
|
// END OF REM
|
|
|
|
$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>
|
|
<!-- Required meta tags -->
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
|
<!-- Bootstrap 4 CSS -->
|
|
<link rel="stylesheet" href="<?php echo $oConf->getURLRoot('lib/bootstrap-4.0.0/css/bootstrap.min.css'); ?>" />
|
|
|
|
<!-- jQuery Bootstrap 4 JS -->
|
|
<script src="<?php echo $oConf->getURLRoot('lib/jquery/jquery-3.2.1.js'); ?>"></script>
|
|
<script src="<?php echo $oConf->getURLRoot('lib/bootstrap-4.0.0/js/bootstrap.min.js'); ?>"></script>
|
|
|
|
<!-- Custom style -->
|
|
<link rel="stylesheet" href="<?php echo $oConf->getURLRoot('themes/default/css/style.css'); ?>" type="text/css" media="screen" />
|
|
|
|
<!-- D3JS v4 -->
|
|
<script src="<?php echo $oConf->getURLRoot('lib/d3-v4/d3.min.js'); ?>"></script>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: #743737;">
|
|
|
|
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
|
data-target="#navbar-collapse-1" aria-controls="navbar-collapse-1"
|
|
aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<a class="navbar-brand" href="<?php echo $oConf->getURLRoot(); ?>">Wefra</a>
|
|
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
|
data-target="#navbar-collapse-2" aria-controls="navbar-collapse-2"
|
|
aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="icon-user"></span>
|
|
</button>
|
|
|
|
<!-- Collect the nav links, forms, and other content for toggling -->
|
|
<div class="collapse navbar-collapse navbar-left" id="navbar-collapse-1">
|
|
<ul class="nav navbar-nav client-nav">
|
|
<?php
|
|
foreach($_SESSION['features'] as $k=>$v){
|
|
// condition for guest features
|
|
if ($_SESSION['features'][$k]->is_menu_display == true && $_SESSION['features'][$k]->is_menu_backend != true && $_SESSION['features'][$k]->is_user_feature == false){
|
|
// condition for logout
|
|
if ($_SESSION['features'][$k]->code == 'logout'){
|
|
echo '
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="'.$oConf->getURLScript('logout.php').'">'.
|
|
strtoupper($_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="nav-item 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>'.
|
|
strtoupper($_SESSION['features'][$k]->menu_label).'
|
|
</a>
|
|
<ul class="dropdown-menu" style="background-color:#64efef;">';
|
|
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>'.
|
|
strtoupper($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>'.
|
|
strtoupper($_SESSION['features'][$k]->menu_label).'
|
|
</a>
|
|
</li>';
|
|
}
|
|
}
|
|
}
|
|
} //ENDOF foreach($_SESSION['features'] as $k=>$v){
|
|
?>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- User menu to show on screens < 768px -->
|
|
<div class="collapse navbar-collapse navbar-right text-right" id="navbar-collapse-2">
|
|
<?php if(!isset($_SESSION['user'])){ ?>
|
|
<ul class="nav navbar-nav client-nav navbar-right">
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="<?php echo $oConf->getURLRoot($oFeatTrans->getFeatureTranslation('menu_login_url', $_SESSION['config']['default_lang_code'])); ?>">
|
|
<span class="glyphicon glyphicon-log-in"></span> <?php echo strtoupper($oFeatTrans->getFeatureTranslation('menu_login_label', $_SESSION['config']['default_lang_code'])); ?></a>
|
|
</li>
|
|
<!-- displays active languages in listbox -->
|
|
<li class="nav-item dropdown"><a class="nav-link" href="#" class="dropdown-toggle" data-toggle="dropdown">
|
|
<?php echo '<img class="lang_icon" style="height:15px; width:30px;"
|
|
src="'.$oConf->getURLRoot('images/flags/default/'.$lang_code.'.png').'"
|
|
alt="'.$lang_code.'"/>' ?>
|
|
<b class="caret"></b></a>
|
|
<ul class="dropdown-menu">
|
|
<?php
|
|
$languages = $_SESSION['activeLanguages'];
|
|
foreach($languages as $k=>$v){
|
|
echo '<li class="nav-item"><a class="nav-link" href="'.$oConf->getURLScript('changeLang.php?lang='.$languages[$k]['code']).'">
|
|
<img class="lang_icon" style="height:15px; width:30px;"
|
|
src="'.$oConf->getURLRoot('images/flags/default/'.$languages[$k]['code'].'.png').'"
|
|
alt="'.$languages[$k]['code'].'"/> '.$languages[$k]['name'].'</a></li>';
|
|
}
|
|
?>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<?php } else {?>
|
|
<ul class="nav navbar-nav client-nav navbar-right">
|
|
<li class="nav-item dropdown"><a class="nav-link" href="#" class="dropdown-toggle" data-toggle="dropdown">
|
|
<?php echo '<img class="lang_icon" style="height:15px; width:30px;"
|
|
src="'.$oConf->getURLRoot('images/flags/default/'.$lang_code.'.png').'"
|
|
alt="'.$lang_code.'"/>' ?>
|
|
<b class="caret"></b></a>
|
|
<ul class="dropdown-menu">
|
|
<?php
|
|
$languages = $_SESSION['activeLanguages'];
|
|
foreach($languages as $k=>$v){
|
|
echo '<li class="nav-item"><a class="nav-link" href="'.$oConf->getURLScript('changeLang.php?lang='.$languages[$k]['code']).'">
|
|
<img class="lang_icon" style="height:15px; width:30px;"
|
|
src="'.$oConf->getURLRoot('images/flags/default/'.$languages[$k]['code'].'.png').'"
|
|
alt="'.$languages[$k]['code'].'"/> '.$languages[$k]['name'].'</a></li>';
|
|
}
|
|
?>
|
|
</ul>
|
|
</li>
|
|
<?php
|
|
foreach($_SESSION['features'] as $k=>$v){
|
|
if ($_SESSION['features'][$k]->is_menu_display == true && $_SESSION['features'][$k]->is_menu_backend != true && $_SESSION['features'][$k]->is_user_feature == true){
|
|
if ($_SESSION['features'][$k]->code == 'logout'){
|
|
echo '
|
|
<li class="nav-item">
|
|
<a class="nav-link" style="color:red;" href="'.$oConf->getURLScript('logout.php').'">'.
|
|
$_SESSION['features'][$k]->menu_label.'
|
|
</a>
|
|
</li>';
|
|
} else {
|
|
echo '
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="'.$_SESSION['features'][$k]->url.'">'.
|
|
$_SESSION['features'][$k]->menu_label.'
|
|
</a>
|
|
</li>';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
</ul>
|
|
</div>
|
|
<!-- /.navbar-collapse -->
|
|
<!--<form class="form-inline my-2 my-lg-0">-->
|
|
<!-- <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">-->
|
|
<!-- <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>-->
|
|
<!--</form>-->
|
|
</nav>
|
|
|
|
|
|
<!--<div class="container text-right">-->
|
|
<!--<a href="https://www.facebook.com/skills-trading" target="_blank" title="Skills Trading on Facebook"><span class="hb hb-xs hb-facebook-inv spin-icon"><i class="fa fa-facebook"></i></span></a>-->
|
|
<!--<a href="#"><span class="hb hb-xs inv"><i class="fa fa-twitter"></i></span></a>-->
|
|
<!--<a href="#"><span class="hb hb-xs inv"><i class="fa fa-google-plus"></i></span></a>-->
|
|
<!--<a href="https://www.linkedin.com/company/skills-trading" target="_blank" title="Skills Trading on Linkedin"><span class="hb hb-xs hb-linkedin-inv spin-icon"><i class="fa fa-linkedin-square"></i></span></a>-->
|
|
<!--<a href="https://www.youtube.com/channel/UC6hkwpOQfGpOipiuBuV6Wsg" target="_blank" title="Skills Trading on YouTube"><span class="hb hb-xs hb-youtube-inv spin-icon"><i class="fa fa-youtube"></i></span></a> -->
|
|
<!--<a href="https://www.instagram.com/strading" title="Skills Trading on Instagram"><span class="hb hb-xs hb-instragram-inv spin-icon"><i class="fa fa-instagram"></i></span></a>-->
|
|
<!--<a href="#"><span class="hb hb-xs inv"><i class="fa fa-tumblr-square"></i></span></a> -->
|
|
<!--<a href="#"><span class="hb hb-xs inv"><i class="fa fa-rss-square"></i></span></a>-->
|
|
<!--<a href="#"><span class="hb hb-xs inv"><i class="fa fa-vimeo-square"></i></span></a>-->
|
|
<!--<a href="#"><span class="hb hb-xs inv"><i class="fa fa-github-square"></i></span></a>-->
|
|
<!--<a href="#"><span class="hb hb-xs inv"><i class="fa fa-flickr"></i></span></a>-->
|
|
<!--<a href="#"><span class="hb hb-xs inv"><i class="fa fa-dropbox"></i></span></a>-->
|
|
<!--<a href="#"><span class="hb hb-xs inv"><i class="fa fa-xing"></i></span></a>-->
|
|
<!--<a href="#"><span class="hb hb-xs inv"><i class="fa fa-skype"></i></span></a>-->
|
|
<!--<a href="#"><span class="hb hb-xs inv"><i class="fa fa-dribbble"></i></span></a>-->
|
|
<!--<a href="#"><span class="hb hb-xs inv"><i class="fa fa-tencent-weibo"></i></span></a>-->
|
|
<!--</div>-->
|
|
|
|
|
|
<!-- get and displays content of requested web page -->
|
|
<?php $oController->getPage("default", $lang_code); ?>
|
|
|
|
<!-- displayed for certain messages: warnings, alerts, success -->
|
|
<p class="text-center" id="general_message"></p>
|
|
|
|
<?php if($_SESSION['config']['framework_environment'] == "dev"){ ?>
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="col-lg-12">
|
|
|
|
<div class="panel panel-info">
|
|
<div class="panel-body">
|
|
<div class="col-lg-6">
|
|
<h5>Session config</h5>
|
|
<pre>
|
|
<?php print_r($_SESSION['config']); ?>
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
<div class="col-lg-6">
|
|
<h5>_POST</h5>
|
|
<pre>
|
|
<?php print_r($_POST); ?>
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<footer>
|
|
</footer>
|
|
|
|
</body>
|
|
</html>
|