X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=HTML%2FFlexyFramework%2FPage.php;h=e8add0e59829c88ed16793bcdde78059f5c08706;hb=HEAD;hp=eed7f99ba63070a02fdc59bd7744571d4f30167a;hpb=fffdd0ce357e963fe5df95ba0235bb3965d0daee;p=pear diff --git a/HTML/FlexyFramework/Page.php b/HTML/FlexyFramework/Page.php index eed7f99b..e8add0e5 100644 --- a/HTML/FlexyFramework/Page.php +++ b/HTML/FlexyFramework/Page.php @@ -129,7 +129,13 @@ class HTML_FlexyFramework_Page { var $errors = array(); // key(element name)=>error message - + /** + * is the page being run from the command line? + * + * @var bool + * @access public + */ + var $cli = false; /** * Arguments from cli if static $cli_opts is used. * @@ -148,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. @@ -242,7 +250,7 @@ class HTML_FlexyFramework_Page { function output() { - + if (!empty($this->cli)) { return; } @@ -290,7 +298,7 @@ class HTML_FlexyFramework_Page { } $template_engine->elements = $this->elements; $template_engine->outputObject($this,$this->elements); - + return ''; } @@ -397,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); @@ -424,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); + } + } + }