summaryrefslogtreecommitdiff
path: root/functions.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2007-03-21 16:36:24 +0100
committerAndrew Dolgov <[email protected]>2007-03-21 16:36:24 +0100
commitbe0801a1619981931c813346b53de2d9f29bcede (patch)
tree442c3e505455c9f1bb673d4d3ad04093d0dcfcba /functions.js
parent441acab8ff3a62e11d70ed920f0b12ad08b20e09 (diff)
make storeInitParam actually work (move back to cookies)
Diffstat (limited to 'functions.js')
-rw-r--r--functions.js28
1 files changed, 25 insertions, 3 deletions
diff --git a/functions.js b/functions.js
index b7e633ea9..b6c656b6a 100644
--- a/functions.js
+++ b/functions.js
@@ -428,7 +428,7 @@ function setCookie(name, value, lifetime, path, domain, secure) {
if (lifetime) {
d = new Date();
- d.setTime(lifetime * 1000);
+ d.setTime(d.getTime() + (lifetime * 1000));
}
int_setCookie(name, value, d, path, domain, secure);
@@ -1500,9 +1500,31 @@ function debug(msg) {
}
function getInitParam(key) {
- return getMainContext().init_params[key];
+ var c = getCookie("TTIP:" + key);
+ if (c) {
+ return c;
+ } else {
+ return getMainContext().init_params[key];
+ }
}
+function storeInitParam(key, value) {
+ try {
+ init_params[key] = value;
+ debug("storeInitParam: " + key + " => " + value +
+ " (" + getInitParam("cookie_lifetime") + ")");
+ if (getInitParam("cookie_lifetime") > 0) {
+ setCookie("TTIP:" + key, value, getInitParam("cookie_lifetime"));
+ } else {
+ setCookie("TTIP:" + key, value);
+ }
+ } catch (e) {
+ exception_error("storeInitParam", e);
+ }
+}
+
+
+/*
function storeInitParam(key, value, is_client) {
try {
if (!is_client) {
@@ -1519,7 +1541,7 @@ function storeInitParam(key, value, is_client) {
} catch (e) {
exception_error("storeInitParam", e);
}
-}
+} */
/*
function storeInitParams(params, is_client) {