{
return empty($this->name) ? $this->email : $this->name;
}
- function whereAddIn($key, $list, $type) {
- $ar = array();
- foreach($list as $k) {
- $ar[] = $type =='int' ? (int)$k : $this->escape($k);
- }
- if (!$ar) {
- return;
- }
- $this->whereAdd("$key IN (". implode(',', $ar). ')');
- }
- function fetchAll($k= false, $v = false)
- {
- // should it even do this!!!?!?
- if ($k !== false &&
- ( // only do this is we have not been explicit..
- empty($this->_query['data_select']) ||
- ($this->_query['data_select'] == '*')
- )
- ) {
- $this->selectAdd();
- $this->selectAdd($k);
- if ($v !== false) {
- $this->selectAdd($v);
- }
- }
-
- $this->find();
- $ret = array();
- while ($this->fetch()) {
- if ($v !== false) {
- $ret[$this->$k] = $this->$v;
- continue;
- }
- $ret[] = $k === false ? clone($this) : $this->$k;
- }
- return $ret;
-
- }
+
// ---------------- authentication / passwords and keys stuff ----------------
function isAuth()
{
$u = DB_DataObject::factory('Person');
$ff = HTML_FlexyFramework::get();
if (!empty($ff->Pman['local_autoauth']) &&
+ (!empty($_SERVER['SERVER_ADDR'])) &&
($_SERVER['SERVER_ADDR'] == '127.0.0.1') &&
($_SERVER['REMOTE_ADDR'] == '127.0.0.1') &&
$u->get('email', $ff->Pman['local_autoauth'])
}
function checkPassword($val)
{
+
if (substr($this->passwd,0,1) == '$') {
return crypt($val,$this->passwd) == $this->passwd ;
}
}
}
}
- /*
- now handled by interface...
-
- $lang = empty($this->lang) ? 'en' : $this->lang;
- if (empty($_SESSION['Pman_I18N'][$lang])) {
- require_once 'Pman/I18N.php';
- $x = new Pman_I18N();
- $x->setSession($this);
-
- }
-
- $aur['i18n'] =$_SESSION['Pman_I18N'][$lang];
- */
+
// perms + groups.
$aur['perms'] = $this->getPerms();
$g = DB_DataObject::Factory('Group_Members');
$g->genDefault();
}
if ($this->id < 0) {
- return $g->adminRights();
+ return $g->adminRights(); // system is not set up - so they get full rights.
}
$g = DB_DataObject::Factory('Group_Members');
$g = DB_DataObject::Factory('Group_Members');
$grps = $g->listGroupMembership($this);
$isAdmin = $g->inAdmin;
- // var_dump($grps);
+ //echo '<PRE>'; print_r($grps);var_dump($isAdmin);
// the load all the perms for those groups, and add them all together..
// then load all those
$g = DB_DataObject::Factory('Group_Rights');
$ret = $g->listPermsFromGroupIds($grps, $isAdmin);
- // echo '<PRE>';print_r($ret);
+ //echo '<PRE>';print_r($ret);
return $ret;
}
if (!empty($q['query']['comptype_or_company_id'])) {
+ // DB_DataObject::debugLevel(1);
$bits = explode(',', $q['query']['comptype_or_company_id']);
$id = (int) array_pop($bits);
$ct = $this->escape($bits[0]);
}
}
+
+ if (!empty($q['query']['project_member_of'])) {
+ // this is also a flag to return if they are a member..
+ //DB_DataObject::debugLevel(1);
+ $do = DB_DataObject::factory('ProjectDirectory');
+ $do->project_id = $q['query']['project_member_of'];
+
+ $this->joinAdd($do,array('joinType' => 'LEFT', 'useWhereAsOn' => true));
+ $this->selectAdd('IF(ProjectDirectory.id IS NULL, 0, ProjectDirectory.id ) as is_member');
+
+
+ if (!empty($q['query']['project_member_filter'])) {
+ $this->having('is_member !=0');
+
+ }
+
+ }
+
+
if (!empty($q['query']['search'])) {
$s = $this->escape($q['query']['search']);
$this->whereAdd("