Example #1
0
    public function TheScope($Name, $Scope = "")
    {
        global $_SYSHCVOL;
        //if (!IsLoggedIn())
        $A = new MOD_bw_user_Auth();
        if (!$A->isBWLoggedIn()) {
            return false;
        }
        $IdMember = $_SESSION['IdMember'];
        if (!isset($_SESSION[$this->IdSession . $Name]) or $_SESSION['Param']->ReloadRightsAndFlags == 'Yes') {
            $str = '
SELECT SQL_CACHE Scope, Level
FROM ' . $this->nomtablevolunteer . ',' . $this->nomtable . '
WHERE IdMember=' . $IdMember . '
AND ' . $this->nomtable . '.id=' . $this->nomtablevolunteer . '.' . $this->IdName . ' AND ' . $this->nomtable . '.Name=\'' . $Name . '\'';
            $qry = $this->dao->query($str);
            $row = $qry->fetch(PDB::FETCH_OBJ);
            if (!isset($row->Level)) {
                return false;
            }
            $_SESSION[$this->tablelevel . $Name] = $row->Level;
            $_SESSION[$this->tablescope . $Name] = $row->Scope;
        }
        return $_SESSION[$this->tablescope . $Name];
    }
Example #2
0
    public function registerTBMember($vars)
    {
        $Auth = new MOD_bw_user_Auth();
        $authId = $Auth->checkAuth('defaultUser');
        // TODO: we shouldn't use mysql's password(),
        // but for now it's to get nearer to the BW style
        $query = '
INSERT INTO `user`
(`id`, `auth_id`, `handle`, `email`, `active`)
VALUES
(
    ' . $this->dao->nextId('user') . ',
    ' . (int) $authId . ',
    \'' . $vars['username'] . '\',
    \'' . $vars['email'] . '\',
    0
)';
        $s = $this->dao->query($query);
        if (!$s->insertId()) {
            $vars['errors'] = array('inserror');
            return false;
        }
        $userId = $s->insertId();
        $key = PFunctions::randomString(16);
        // save register key
        if (!APP_User::addSetting($userId, 'regkey', $key)) {
            $vars['errors'] = array('inserror');
            return false;
        }
        // save lang
        if (!APP_User::addSetting($userId, 'lang', PVars::get()->lang)) {
            $vars['errors'] = array('inserror');
            return false;
        }
        return $userId;
    }
Example #3
0
 /**
  * log the current user out
  * 
  * @param void
  * @return boolean
  */
 public function logout()
 {
     $this->removeCookie();
     return parent::logout();
 }