fix image text
[pear] / HTML / FlexyFramework / Page.php
index 837c9a6..e8add0e 100644 (file)
@@ -154,6 +154,8 @@ class HTML_FlexyFramework_Page  {
 
 
 
+    var $timer;
+
     /**
     * The default page handler
     * by default relays to get(), or post() methods depending on the request.
@@ -268,7 +270,6 @@ class HTML_FlexyFramework_Page  {
 
         $template_engine = new HTML_Template_Flexy();
         $template_engine->compile($this->masterTemplate);
-        print_r($template_engine);exit;
         if (!$this->_cache || !$this->cacheMethod) {
             $template_engine->outputObject($this,$this->elements);
             return;
@@ -297,7 +298,7 @@ class HTML_FlexyFramework_Page  {
         }
         $template_engine->elements = $this->elements;
         $template_engine->outputObject($this,$this->elements);
-
+        return '';
     }
 
 
@@ -404,6 +405,12 @@ class HTML_FlexyFramework_Page  {
     {
         static $ses_status = false;
         static $ini = false;
+        
+        if (!empty($_SERVER['PHP_AUTH_USER']) ||  php_sapi_name() == "cli") {
+            // do not do sessions if we are using http auth.
+            return;
+        }
+        
         // session status is only php5.4 and up..
         if (!defined('PHP_SESSION_ACTIVE')) {
             define('PHP_SESSION_ACTIVE' , 1);
@@ -431,8 +438,31 @@ class HTML_FlexyFramework_Page  {
                 $ini = true;
                 // sometimes raises a notice - ps_files_cleanup_dir.
                 @session_start();
+                $this->dedupeSessionCookies();
                 return;
         }
     }
+    
+    function dedupeSessionCookies()
+    {
+         if (headers_sent()) {
+            return;
+        }
+        $cookies = array();
+        
+        foreach (headers_list() as $header) {
+            // Identify cookie headers
+            if (strpos($header, 'Set-Cookie:') === 0) {
+                $cookies[] = $header;
+            }
+        }
+        header_remove('Set-Cookie');
+
+        // Restore one copy of each cookie
+        foreach(array_unique($cookies) as $cookie) {
+            header($cookie, false);
+        }
+    }
+    
 
 }