Skip to content

Commit

Permalink
Merge pull request #286 from WBCE/class.admin-modifications-for-theme…
Browse files Browse the repository at this point in the history
…-stuff

class.admin modifications for theme stuff
  • Loading branch information
Christoph Bleiweis authored Jul 28, 2017
2 parents 2e996ea + 5603edb commit 4d5fb96
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 22 deletions.
19 changes: 14 additions & 5 deletions wbce/framework/class.admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public function print_header($body_tags = '')
. 'WHERE `name`=\'website_title\'';
$get_title = $database->query($sql);
$title = $get_title->fetchRow(MYSQLI_ASSOC);

// Setup template object, parse vars to it, then parse it
$header_template = new Template(dirname($this->correct_theme_source('header.htt')));
$header_template->set_file('page', 'header.htt');
Expand Down Expand Up @@ -127,27 +128,28 @@ public function print_header($body_tags = '')
'WBCE_VERSION' => WBCE_VERSION,
'WBCE_TAG' => (in_array(WBCE_TAG, array('', '-'))
? '-'
: '<a href="https://github.com/WBCE/WebsiteBaker_CommunityEdition/releases/tag/' . WBCE_TAG . '" target="_blank">' . WBCE_TAG . '</a>'
: '<a href="https://github.com/WBCE/WBCE_CMS/releases/tag/' . WBCE_TAG . '" target="_blank">' . WBCE_TAG . '</a>'
),
'VERSION' => VERSION, // Legacy: WB-classic
'SP' => SP, // Legacy: WB-classic
'REVISION' => REVISION, // Legacy: WB-classic
'SERVER_ADDR' => ($this->get_group_id() == 1
? (!isset($_SERVER['SERVER_ADDR'])
? '129.0.0.1'
? '127.0.0.1'
: $_SERVER['SERVER_ADDR'])
: ''),
'WB_URL' => WB_URL,
'ADMIN_URL' => ADMIN_URL,
'THEME_URL' => THEME_URL,
'PHP_VERSION' => substr(phpversion(),0,6),
'TITLE_START' => $MENU['START'],
'TITLE_BACK' => $TEXT['BACK'],
'TITLE_VIEW' => $MENU['VIEW'],
'TITLE_HELP' => $MENU['HELP'],
'TITLE_LOGOUT' => $MENU['LOGOUT'],
'LOGGED_IN_AS' => $TEXT['LOGGED_IN'],
'URL_VIEW' => $view_url,
'URL_HELP' => 'http://websitebaker.org/en/help.php',
'URL_HELP' => 'https://wbce.org/',
'BACKEND_MODULE_CSS' => $this->register_backend_modfiles('css'), // adds backend.css
'BACKEND_MODULE_JS' => $this->register_backend_modfiles('js'), // adds backend.js
)
Expand Down Expand Up @@ -203,13 +205,20 @@ public function print_footer($activateJsAdmin = false)
$footer_template = new Template(dirname($this->correct_theme_source('footer.htt')));
$footer_template->set_file('page', 'footer.htt');
$footer_template->set_block('page', 'footer_block', 'header');

// Session Timeout possibly not Defined on Upgrade
if ($sSessionTimeout=Settings::get("wb_session_timeout")) {}
elseif ($sSessionTimeout=Settings::get("wb_secform_timeout")) {}
else {$sSessionTimeout="7200";}

$footer_template->set_var(array(
'BACKEND_BODY_MODULE_JS' => $this->register_backend_modfiles_body('js'),
'WB_SESSION_TIMEOUT' => $sSessionTimeout,
'WB_URL' => WB_URL,
'ADMIN_URL' => ADMIN_URL,
'THEME_URL' => THEME_URL,
'WBCE_VERSION' => WBCE_VERSION,
'PHP_VERSION' => substr(phpversion(),0,6),
'WBCE_VERSION' => WBCE_VERSION,
'BACKEND_BODY_MODULE_JS' => $this->register_backend_modfiles_body('js'),
));
$footer_template->parse('header', 'footer_block', false);
$footer_template->pparse('output', 'page');
Expand Down
3 changes: 2 additions & 1 deletion wbce/templates/argos_theme_reloaded/templates/footer.htt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
WBCE Version: {WBCE_VERSION} &bull;
Backend Version: 2.0.1
&bull;
PHP Version: {PHP_VERSION}
PHP Version: {PHP_VERSION} &bull;
Session timeout: <span id="countdowntimer">{WB_SESSION_TIMEOUT}</span> Seconds
</div>

{BACKEND_BODY_MODULE_JS}
Expand Down
15 changes: 15 additions & 0 deletions wbce/templates/argos_theme_reloaded/templates/header.htt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@

{BACKEND_MODULE_CSS}
{BACKEND_MODULE_JS}

<script>
var wbSessionTiomeout= {WB_SESSION_TIMEOUT};
var seconds = new Date().getTime() / 1000;
seconds = Math.round(seconds);
document.cookie = 'WBCELastConnectJS='+seconds.toString()+'; expires=0; path=/'

var timeleft = {WB_SESSION_TIMEOUT};
var downloadTimer = setInterval(function(){
timeleft--;
document.getElementById("countdowntimer").textContent = timeleft;
if(timeleft <= 0)
clearInterval(downloadTimer);
},1000);
</script>
</head>

<body>
Expand Down
46 changes: 30 additions & 16 deletions wbce/templates/wbce_flat_theme/templates/header.htt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<link href="{THEME_URL}/css/fitrgrid.css" rel="stylesheet" type="text/css">
<link href="{THEME_URL}/css/theme.css" rel="stylesheet" type="text/css">
<link href="{THEME_URL}/css/themeextended.css" rel="stylesheet" type="text/css">
{BACKEND_MODULE_CSS}
<script>
var WB_URL = '{WB_URL}';
var THEME_URL = '{THEME_URL}';
Expand All @@ -31,12 +32,19 @@ var LANGUAGE = '{LANGUAGE}';
<script type="text/javascript" src="{THEME_URL}/jquery/jqueryNiceFileInput/jquery.nicefileinput.min.js"></script>
<script type="text/javascript" src="{THEME_URL}/jquery/theme.js"></script>
{BACKEND_MODULE_JS}
{BACKEND_MODULE_CSS}
<script>
var wbSessionTiomeout= {WB_SESSION_TIMEOUT};
var seconds = new Date().getTime() / 1000;
seconds = Math.round(seconds);
document.cookie = 'WBCELastConnectJS='+seconds.toString()+'; expires=0; path=/'
var wbSessionTiomeout= {WB_SESSION_TIMEOUT};
var seconds = new Date().getTime() / 1000;
seconds = Math.round(seconds);
document.cookie = 'WBCELastConnectJS='+seconds.toString()+'; expires=0; path=/'

var timeleft = {WB_SESSION_TIMEOUT};
var downloadTimer = setInterval(function(){
timeleft--;
document.getElementById("countdowntimer").textContent = timeleft;
if(timeleft <= 0)
clearInterval(downloadTimer);
},1000);
</script>
</head>
<body>
Expand All @@ -62,18 +70,24 @@ document.cookie = 'WBCELastConnectJS='+seconds.toString()+'; expires=0; path=/'
<!-- ##### ENDE pagetopmenu ####################### -->

<div id="sidebararea" class="stickySidebarElement">
<div id="userbox" class="stickySidebarElement"> <span id="user-introtext">{WELCOME_MESSAGE} {CURRENT_USER} </span> <br/>
<span id="user-name">{DISPLAY_NAME}</span> <br/>
<a id="user-button" href="{ADMIN_URL}/logout/" title="{TITLE_LOGOUT}">{TITLE_LOGOUT}</a> </div>
<div id="userbox" class="stickySidebarElement">
<span id="user-introtext">{WELCOME_MESSAGE} {CURRENT_USER} </span><br/>
<span id="user-name">{DISPLAY_NAME}</span><br/>
<a id="user-button" href="{ADMIN_URL}/logout/" title="{TITLE_LOGOUT}">{TITLE_LOGOUT}</a>
</div>
<div id="mainmenu" class="stickySidebarElement">
<ul class="stickySidebarElement">
<!-- BEGIN linkBlock -->
<li class="{CLASS}"><a href="{LINK}" target="{TARGET}" title="{TITLE}"><span>{TITLE}</span></a></li>
<!-- END linkBlock -->
</ul>
</div>
<div id="systeminfo" class="stickySidebarElement"> <span class="version">WBCE Version: {WBCE_VERSION}</span><br/>
<span class="version">Tag: {WBCE_TAG}</span></div>
<ul class="stickySidebarElement">
<!-- BEGIN linkBlock -->
<li class="{CLASS}"><a href="{LINK}" target="{TARGET}" title="{TITLE}"><span>{TITLE}</span></a></li>
<!-- END linkBlock -->
</ul>
</div>
<div id="systeminfo" class="stickySidebarElement">
<span class="version">WBCE Version: {WBCE_VERSION}<br/>
<span class="version">Tag: {WBCE_TAG}</span><br/>
<span class="version">PHP Version: {PHP_VERSION}</span><br/>
<span class="version">Session timeout: <span id="countdowntimer">{WB_SESSION_TIMEOUT}</span> Seconds</span>
</div>
</div>
<div id="mainarea" class="stickySidebarElement">
<div id="contentarea">
Expand Down

0 comments on commit 4d5fb96

Please sign in to comment.