Update users and basepage.

This commit is contained in:
Darko
2015-06-08 09:29:27 +02:00
parent a140162da6
commit 6cd424d21e
2 changed files with 15 additions and 8 deletions
+9 -6
View File
@@ -44,6 +44,9 @@ class BasePage
*/
public function __construct()
{
$this->https = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? true : false);
session_set_cookie_params(0, '/', '', $this->https, true);
@session_start();
if (NN_FLOOD_CHECK) {
@@ -81,12 +84,12 @@ class BasePage
$servername = null;
if (defined('EXTERNAL_PROXY_IP') && defined('EXTERNAL_HOST_NAME') && isset($_SERVER["REMOTE_ADDR"]) && $_SERVER["REMOTE_ADDR"] == EXTERNAL_PROXY_IP)
$servername = EXTERNAL_HOST_NAME;
elseif (isset($_SERVER["SERVER_NAME"]))
$servername = $_SERVER["SERVER_NAME"];
if ($servername != "")
{
$this->serverurl = ($this->secure_connection ? "https://" : "http://").$servername.(($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") ? ":".$_SERVER["SERVER_PORT"] : "").WWW_TOP.'/';
elseif (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'] : '') .
WWW_TOP . '/'
);
$this->smarty->assign('serverroot', $this->serverurl);
}
+6 -2
View File
@@ -659,12 +659,16 @@ class Users
return (isset($_SESSION['uid']) ? $_SESSION['uid'] : -1);
}
/**
* Logout the user, destroying his cookies and session.
*/
public function logout()
{
session_unset();
session_destroy();
setcookie('uid', '', (time() - 2592000), '/', $_SERVER['SERVER_NAME'], (isset($_SERVER['HTTPS']) ? true : false));
setcookie('idh', '', (time() - 2592000), '/', $_SERVER['SERVER_NAME'], (isset($_SERVER['HTTPS']) ? true : false));
$secure_cookie = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? '1' : '0');
setcookie('uid', null, -1, '/', null, $secure_cookie, true);
setcookie('idh', null, -1, '/', null, $secure_cookie, true);
}
public function updateApiAccessed($uid)