*/
require_once 'DB/DataObject.php';
+
class Pman_Core_DataObjects_Person extends DB_DataObject
{
###START_AUTOCODE
if (!empty($ff->Pman['auth_comptype']) &&
(!$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();
+ $sesPrefix = $ff->appNameShort .'-'.get_class($this) .'-'.$db->dsn['database'] ;
+ $_SESSION[__CLASS__][$sesPrefix .'-auth'] = "";
+ return false;
+
$ff->page->jerr("Login not permited to outside companies");
}
return true;
// we combine db + project names,
// otherwise if projects use different 'auth' objects
// then we get unserialize issues.
- $sesPrefix = get_class($this) .'-'.$db->dsn['database'] ;
+ $ff= HTML_FlexyFramework::get();
+ $sesPrefix = $ff->appNameShort .'-' .get_class($this) .'-'.$db->dsn['database'] ;
@session_start();
$u = DB_DataObject::factory('Person');
if ($u->get($a->id)) { //&& strlen($u->passwd)) {
- $u->verifyAuth();
+ return $u->verifyAuth();
return true;
return false;
}
$db = $this->getDatabaseConnection();
- $sesPrefix = get_class($this) .'-'.$db->dsn['database'] ;
+ $ff= HTML_FlexyFramework::get();
+ $sesPrefix = $ff->appNameShort .'-' .get_class($this) .'-'.$db->dsn['database'] ;
+
if (!empty($_SESSION[__CLASS__][$sesPrefix .'-auth'])) {
function login()
{
$this->isAuth(); // force session start..
- $this->verifyAuth();
+ if (!$this->verifyAuth()) {
+ return false;
+ }
$db = $this->getDatabaseConnection();
$gr = DB_DataObject::Factory('group_rights');
$gr->applyDefs($g, 0);
}
-
- $sesPrefix = get_class($this) .'-'.$db->dsn['database'] ;
+ $ff= HTML_FlexyFramework::get();
+ $sesPrefix = $ff->appNameShort .'-' .get_class($this) .'-'.$db->dsn['database'] ;
+
+
$_SESSION[__CLASS__][$sesPrefix .'-auth'] = serialize($this);
}
function logout()
{
$this->isAuth(); // force session start..
- $db = $this->getDatabaseConnection();
- $sesPrefix = get_class($this) .'-'.$db->dsn['database'] ;
+ $db = $this->getDatabaseConnection();
+ $ff= HTML_FlexyFramework::get();
+ $sesPrefix = $ff->appNameShort .'-' .get_class($this) .'-'.$db->dsn['database'] ;
+
$_SESSION[__CLASS__][$sesPrefix .'-auth'] = "";
}
$this->whereAdd('LENGTH(passwd) > 1');
$this->email = $n;
}
- function lang($val)
+ function lang()
{
+ if (!func_num_args()) {
+ return $this->lang;
+ }
+ $val = array_shift(func_get_args());
if ($val == $this->lang) {
return;
}
$uu = clone($this);
$this->lang = $val;
$this->update($uu);
-
+ return $this->lang;
}