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.
*
+ var $timer;
+
/**
* The default page handler
* by default relays to get(), or post() methods depending on the request.
function output()
{
- print_r('bresk');exit;
-
-
+
if (!empty($this->cli)) {
return;
}
}
$template_engine->elements = $this->elements;
$template_engine->outputObject($this,$this->elements);
-
+ return '';
}
{
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);
$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);
+ }
+ }
+
}