- fixed some session and cookie bugs
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
session_name('pathfinder_session');
|
||||
$f3 = require('app/lib/base.php');
|
||||
|
||||
// load main config
|
||||
|
||||
@@ -77,7 +77,8 @@ define([
|
||||
var d = new Date();
|
||||
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
||||
var expires = 'expires=' + d.toUTCString();
|
||||
document.cookie = cname + '=' + cvalue + '; ' + expires;
|
||||
var path = 'path=' + Util.getDocumentPath();
|
||||
document.cookie = cname + '=' + cvalue + '; ' + expires + '; ' + path;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1824,6 +1824,19 @@ define([
|
||||
return dateString + ' ' + timeString;
|
||||
};
|
||||
|
||||
/**
|
||||
* get document path
|
||||
* -> www.pathfinder.com/pathfinder/ -> /pathfinder
|
||||
* @returns {string|string}
|
||||
*/
|
||||
var getDocumentPath = function(){
|
||||
var pathname = window.location.pathname;
|
||||
// replace file endings
|
||||
var r = /[^\/]*$/;
|
||||
var path = pathname.replace(r, '');
|
||||
return path || '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* redirect
|
||||
* @param url
|
||||
@@ -1919,6 +1932,7 @@ define([
|
||||
convertDateToString: convertDateToString,
|
||||
getOpenDialogs: getOpenDialogs,
|
||||
formatPrice: formatPrice,
|
||||
getDocumentPath: getDocumentPath,
|
||||
redirect: redirect,
|
||||
logout: logout
|
||||
};
|
||||
|
||||
@@ -77,7 +77,8 @@ define([
|
||||
var d = new Date();
|
||||
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
||||
var expires = 'expires=' + d.toUTCString();
|
||||
document.cookie = cname + '=' + cvalue + '; ' + expires;
|
||||
var path = 'path=' + Util.getDocumentPath();
|
||||
document.cookie = cname + '=' + cvalue + '; ' + expires + '; ' + path;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1824,6 +1824,19 @@ define([
|
||||
return dateString + ' ' + timeString;
|
||||
};
|
||||
|
||||
/**
|
||||
* get document path
|
||||
* -> www.pathfinder.com/pathfinder/ -> /pathfinder
|
||||
* @returns {string|string}
|
||||
*/
|
||||
var getDocumentPath = function(){
|
||||
var pathname = window.location.pathname;
|
||||
// replace file endings
|
||||
var r = /[^\/]*$/;
|
||||
var path = pathname.replace(r, '');
|
||||
return path || '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* redirect
|
||||
* @param url
|
||||
@@ -1919,6 +1932,7 @@ define([
|
||||
convertDateToString: convertDateToString,
|
||||
getOpenDialogs: getOpenDialogs,
|
||||
formatPrice: formatPrice,
|
||||
getDocumentPath: getDocumentPath,
|
||||
redirect: redirect,
|
||||
logout: logout
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user