if (empty($this->name)) {
return $this->email;
}
+
return '"' . addslashes($this->name) . '" <' . $this->email . '>';
}
// ---------------- authentication / passwords and keys stuff ----------------
function isAuth()
{
-
@session_start();
$ff= HTML_FlexyFramework::get();
// local auth -
$default_admin = false;
-
- if (!empty($ff->Pman['local_autoauth']) &&
- ($ff->Pman['local_autoauth'] === true) &&
- (!empty($_SERVER['SERVER_ADDR'])) &&
- (
- (
- $_SERVER['SERVER_ADDR'] == '127.0.0.1' &&
- $_SERVER['REMOTE_ADDR'] == '127.0.0.1'
- )
- ||
- (
- $_SERVER['SERVER_ADDR'] == '::1' &&
- $_SERVER['REMOTE_ADDR'] == '::1'
- )
- )
- ){
- print_r('in????');
- exit;
- }
-
- print_R('out??');exit;
-
if (!empty($ff->Pman['local_autoauth']) &&
($ff->Pman['local_autoauth'] === true) &&
(!empty($_SERVER['SERVER_ADDR'])) &&
) &&
($default_admin || $u->get('email', $ff->Pman['local_autoauth']))
) {
- $_SESSION[get_class($this)][$sesPrefix .'-auth'] = serialize($default_admin ? $default_admin : $u);
+
+ $user = $default_admin ? $default_admin->toArray() : $u->toArray();
+
+ $_SESSION[get_class($this)][$sesPrefix .'-auth'] = serialize((object) $user);
return true;
}
$im->selectAdd();
$im->selectAs($im, 'company_id_logo_id_%s');
if ($im->find(true)) {
-
+
foreach($im->toArray() as $k=>$v) {
+ if (!preg_match('/^company_id_logo_id_/', $k)) {
+ continue;
+ }
$aur[$k] = $v;
}
}
* Seems we never expose oath_key / passwd, so...
*/
- $this->_extra_cols = array('length_passwd', 'length_oath_key');
+ if($this->tableName() == 'core_person'){
+ $this->_extra_cols = array('length_passwd', 'length_oath_key');
+
+ $this->selectAdd("
+ LENGTH({$this->tableName()}.passwd) AS length_passwd,
+ LENGTH({$this->tableName()}.oath_key) AS length_oath_key
+ ");
+ }
- $this->selectAdd("
- LENGTH({$this->tableName()}.passwd) AS length_passwd,
- LENGTH({$this->tableName()}.oath_key) AS length_oath_key
- ");
}
function beforeDelete($dependants_array, $roo)
{
+ //delete group membership except for admin group..
+ // if they are a member of admin group do not delete anything.
+ $default_admin = false;
$e = DB_DataObject::Factory('Events');
$e->whereAdd('person_id = ' . $this->id);
- $e->delete(true);
+
+ $g = DB_DataObject::Factory('core_group');
+ $g->get('name', 'Administrators'); // select * from core_group where name = 'Administrators'
+
+ $p = DB_DataObject::Factory('core_group_member');
+ $p->setFrom(array(
+ 'user_id' => $this->id,
+ 'group_id' => $g->id
+ ));
+
+ if ($p->count()) {
+ $roo->jerr();
+ }
+
+
+ $p = DB_DataObject::Factory('core_group_member');
+ $p->user_id = $this->id;
+ $mem = $p->fetchAll(); // fetch all the rows and set the $mem variable to the rows data, just like mysqli_fetch_assoc
+
+ $e->logDeletedRecord($p);
+
+ foreach($mem as $p) {
+ $p->delete();
+ }
+
+
// anything else?
if ($roo->authUser->id > -1 || $p->count() > 1) {
return;
}
- $c = DB_DAtaObject::Factory('core_company');
- $tc =$c->count();
+ $c = DB_DataObject::Factory('core_company');
+ $tc = $c->count();
+
if (!$tc || $tc> 1) {
$roo->jerr("can not create initial user as multiple companies already exist");
}
$roo->jerr('Fail to generate QR Code');
}
- $roo->jdata($qrcode);
+ $roo->jok($qrcode);
+ }
+ // handle group_id here..
+ if(!empty($q['group_id'])){
+
+ // insert data into core_person_member...
+
+
}
}