(!$this->company_id || ($ff->Pman['auth_comptype'] != $this->company()->comptype))
){
- // force a logout - without a check on the isAuth - as this is called from there..
- $db = $this->getDatabaseConnection();
- $appname = empty($ff->appNameShort) ? $ff->project : $ff->appNameShort;
- $sesPrefix =$appname.'-' .get_class($this) .'-'.$db->dsn['database'] ;
+ $sesPrefix = $this->sesPrefix();
$_SESSION[get_class($this)][$sesPrefix .'-auth'] = "";
+
return false;
$ff->page->jerr("Login not permited to outside companies");
@session_start();
-
- $db = $this->getDatabaseConnection();
- // we combine db + project names,
- // otherwise if projects use different 'auth' objects
- // then we get unserialize issues.
$ff= HTML_FlexyFramework::get();
- $appname = empty($ff->appNameShort) ? $ff->project : $ff->appNameShort;
-
- $sesPrefix = $appname .'-' .get_class($this) .'-'.$db->dsn['database'] ;
+
+ $sesPrefix = $this->sesPrefix();
if (!empty($_SESSION[get_class($this)][$sesPrefix .'-auth'])) {
// in session...
if (!$this->isAuth()) {
return false;
}
- $db = $this->getDatabaseConnection();
$ff= HTML_FlexyFramework::get();
- $appname = empty($ff->appNameShort) ? $ff->project : $ff->appNameShort;
-
- $sesPrefix =$appname.'-' .get_class($this) .'-'.$db->dsn['database'] ;
+ $sesPrefix = $this->sesPrefix();
//var_dump(array(get_class($this),$sesPrefix .'-auth'));
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);
+ $user = clone ($u);
+
+ return clone($user);
}
unset($_SESSION[get_class($this)][$sesPrefix .'-auth']);
}
if (!$this->verifyAuth()) { // check for company valid..
return false;
}
- $db = $this->getDatabaseConnection();
-
// open up iptables at login..
$dbname = $this->database();
$gr = DB_DataObject::Factory('group_rights');
$gr->applyDefs($g, 0);
}
- $ff= HTML_FlexyFramework::get();
- $appname = empty($ff->appNameShort) ? $ff->project : $ff->appNameShort;
- $sesPrefix =$appname.'-' .get_class($this) .'-'.$db->dsn['database'] ;
-
+
+ $sesPrefix = $this->sesPrefix();
// we should not store the whole data in the session - otherwise it get's huge.
$p = DB_DAtaObject::Factory($this->tableName());
$p->get($this->pid());
+ $d = $p->toArray();
+
//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..
function logout()
{
$this->isAuth(); // force session start..
- $db = $this->getDatabaseConnection();
- $ff= HTML_FlexyFramework::get();
- $appname = empty($ff->appNameShort) ? $ff->project : $ff->appNameShort;
- $sesPrefix =$appname.'-' .get_class($this) .'-'.$db->dsn['database'] ;
- $_SESSION[get_class($this)][$sesPrefix .'-auth'] = "";
-
+ $sesPrefix = $this->sesPrefix();
+ $_SESSION[get_class($this)][$sesPrefix .'-auth'] = "";
}
function genPassKey ($t)
"$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,