return false;
- $ff->page->jerr("Login not permited to outside companies");
+ //$ff->page->jerr("Login not permited to outside companies");
}
return true;
$u = DB_DataObject::factory($this->tableName());
if ($a->id && $u->get($a->id)) { //&& strlen($u->passwd)) {
- return $u->verifyAuth();
+ return $u->verifyAuth(); // got authentication...
}
unset($_SESSION[get_class($this)][$sesPrefix .'-auth']);
+ unset($_SESSION[get_class($this)][$sesPrefix .'-timeout']);
+ setcookie('Pman.timeout', -1, time() + (30*60), '/');
}
if (!$this->canInitializeSystem()) {
$ff= HTML_FlexyFramework::get();
$sesPrefix = $this->sesPrefix();
- session_start();
+
//var_dump(array(get_class($this),$sesPrefix .'-auth'));
- print_R(unset($_SESSION[get_class($this)][$sesPrefix .'-auth']));exit;
+
if (!empty($_SESSION[get_class($this)][$sesPrefix .'-auth'])) {
$a = unserialize($_SESSION[get_class($this)][$sesPrefix .'-auth']);
-
$u = DB_DataObject::factory($this->tableName()); // allow extending this ...
$u->autoJoin();
if ($u->get($a->id)) { /// && strlen($u->passwd)) { // should work out the pid .. really..
- return clone($u);
+
+ $_SESSION[get_class($this)][$sesPrefix .'-auth-timeout'] = time() + (30*60); // eg. 30 minutes
+ setcookie('Pman.timeout', time() + (30*60), time() + (30*60), '/');
+
+ $user = clone ($u);
+
+ return clone($user);
+
}
unset($_SESSION[get_class($this)][$sesPrefix .'-auth']);
+ unset($_SESSION[get_class($this)][$sesPrefix .'-timeout']);
+ setcookie('Pman.timeout', -1, time() + (30*60), '/');
+
}
$p = DB_DAtaObject::Factory($this->tableName());
$p->get($this->pid());
+ $d = $p->toArray();
+
+ $_SESSION[get_class($this)][$sesPrefix .'-auth-timeout'] = time() + (30*60); // eg. 30 minutes
+ setcookie('Pman.timeout', time() + (30*60), time() + (30*60), '/');
+
//var_dump(array(get_class($this),$sesPrefix .'-auth'));
- $_SESSION[get_class($this)][$sesPrefix .'-auth'] = serialize((object)$p->toArray());
+ $_SESSION[get_class($this)][$sesPrefix .'-auth'] = serialize((object)$d);
// ensure it's written so that ajax calls can fetch it..
$sesPrefix = $this->sesPrefix();
+ $_SESSION[get_class($this)][$sesPrefix .'-auth-timeout'] = -1;
+
$_SESSION[get_class($this)][$sesPrefix .'-auth'] = "";
}
"$tn_p.remarks",
"join_company_id_id.name"
);
+ $tbcols = $this->table();
+ foreach(array('firstname','lastname') as $k) {
+ if (isset($tbcols[$k])) {
+ $props[] = "{$tn_p}.{$k}";
+ }
+ }
+
+
+
$str = $x->toSQL(array(
'default' => $props,
}
}
+ // this is for the To: "{getEmailName()}" <email@address>
+ // not good for Dear XXXX, - use {person.firstname} for that.
function getEmailName()
{
$name = array();
$name = array_filter($name);
- return $name;
+ return implode(' ', $name);
}
return $this->email;