Try to prevent creating new session on every BasePage load

This commit is contained in:
DariusIII
2017-07-25 15:10:56 +02:00
parent 72e2219806
commit 046c1cda07
2 changed files with 12 additions and 7 deletions
+1
View File
@@ -1,4 +1,5 @@
2017-07-25 DariusIII
* Chg: Try to prevent creating new session on every BasePage load
* Chg: Add automatic user profile role change for expired roles (role change date) on users list check (admin area)
2017-07-23 DariusIII
* Fix: Fix error for scandir in profileedit page
+11 -7
View File
@@ -10,12 +10,12 @@ use nntmux\SABnzbd;
class BasePage
{
/**
* @var \nntmux\db\Settings
* @var DB
*/
public $settings = null;
/**
* @var nntmux\Users
* @var Users
*/
public $users = null;
@@ -79,17 +79,21 @@ class BasePage
*
* @var string
*/
protected $theme = 'Omicron';
protected $theme = 'Gentele';
/**
* Set up session / smarty / user variables.
*
* @throws \Exception
*/
public function __construct()
{
$this->https = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? true : false);
$this->https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on';
session_set_cookie_params(0, '/', '', $this->https, true);
@session_start();
if (session_id() === '') {
session_set_cookie_params(0, '/', '', $this->https, true);
@session_start();
}
if (NN_FLOOD_CHECK) {
$this->floodCheck();
@@ -111,7 +115,7 @@ class BasePage
if (isset($_SERVER['SERVER_NAME'])) {
$this->serverurl = (
($this->https === true ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] .
(($_SERVER['SERVER_PORT'] != '80' && $_SERVER['SERVER_PORT'] != '443') ? ':' . $_SERVER['SERVER_PORT'] : '') .
(((int)$_SERVER['SERVER_PORT'] !== 80 && (int)$_SERVER['SERVER_PORT'] !== 443) ? ':' . $_SERVER['SERVER_PORT'] : '') .
WWW_TOP . '/'
);
$this->smarty->assign('serverroot', $this->serverurl);