From 369220466ee2e62d28527cd75917399d6b06ce34 Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Mon, 21 Jul 2008 18:55:26 +0000
Subject: [PATCH] Update index.php to refresh cookie lifetime on each page
 load.

---
 document_root/index.php | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/document_root/index.php b/document_root/index.php
index f5864584..13e27a80 100644
--- a/document_root/index.php
+++ b/document_root/index.php
@@ -16,7 +16,13 @@ if ($pearPath) {
     set_include_path(get_include_path() . PATH_SEPARATOR . $pearPath);
 }
 
-Zend_Session::setOptions($config->session->toArray());
+$sessionConfig = $config->session->toArray();
+$sessionConfig['cookie_path'] = $config->application->baseUrl;
+Zend_Session::setOptions($sessionConfig);
+Zend_Session::start();
+if (count($_SESSION) > 0) {
+    setcookie(session_name(), $_COOKIE[session_name()], time() + ini_get('session.cookie_lifetime'), $config->application->baseUrl);
+}
 
 $cache = Zend_Cache::factory(
     'Core',
@@ -26,8 +32,6 @@ $cache = Zend_Cache::factory(
 );
 Zend_Registry::set('cache', $cache);
 
-Zend_Session::start();
-
 $db = Zend_Db::factory($config->database);
 $db->query('SET NAMES utf8');
 Zend_Registry::set('db', $db);
@@ -39,7 +43,7 @@ $layout->setLayoutPath(MODULES_DIR . '/default/views/scripts');
 
 $front = Zend_Controller_Front::getInstance();
 $front->addModuleDirectory(MODULES_DIR);
-$front->setBaseUrl('/~tsteiner/CREQ3');
+$front->setBaseUrl($config->application->baseUrl);
 $front->dispatch();
 
 /*
-- 
GitLab