private function init() { Tools::initPhp(); $pocheUser = Session::getParam('poche_user'); if ($pocheUser && $pocheUser != array()) { $this->user = $pocheUser; } else { // fake user, just for install & login screens $this->user = new User(); $this->user->setConfig($this->getDefaultConfig()); } $this->pagination = new Paginator($this->user->getConfigValue('pager'), 'p'); $this->language = new Language($this); $this->tpl = new Template($this); $this->store = new Database(); $this->messages = new Messages(); $this->routing = new Routing($this); }
public function updateUserConfig() { $data['success'] = false; $user = new User($this->c_user->id); $key = $this->getRequest()->request->get('key', null); $configValue = $this->getRequest()->request->get('value', null); $token_id = $this->getRequest()->request->get('token_id', null); $user->setConfig($key, $configValue, $token_id); if (empty($user->error->all)) { $data['success'] = true; $data['message'] = lang('settings_saved_success'); } else { $data['error'] = $user->error->string; } echo json_encode($data); }
public function errorFeatureNotImplemented($stanza) { $user = new \User(); $user->setConfig(array('config' => false)); $this->deliver(); }
foreach ($ips as $ip) { if (filter_var($ip, FILTER_VALIDATE_IP)) { $path[] = $ip; } } return array_pop($path); } else { if (filter_var($fwd, FILTER_VALIDATE_IP) && !$trustremote && $checkforwarded) { // single return $fwd; } else { // as usual return $remote; } } } } } // Make our class available automatically $user = new User(); $user->setDebug($debug); $user->setLog($log); $user->setMysql($mysqli); $user->setSalt($config['SALT']); $user->setSmarty($smarty); $user->setConfig($config); $user->setMail($mail); $user->setToken($oToken); $user->setBitcoin($bitcoin); $user->setSetting($setting); $user->setErrorCodes($aErrorCodes);
public final function authenticate($email, $password) { $email = isset($email) ? $email : ""; $password = isset($password) ? $password : ""; if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { return null; } if (strlen($password) == 0) { return null; } $email = $this->DBRef->filterString($email); $password = sha1($password); $query = "SELECT * FROM users WHERE "; $query .= "EMAIL = '{$email}' AND "; $query .= "PASSWORD = '******' "; $res = $this->DBRef->GetSingleResult($query); if (count($res) == 0 || $res == 0) { return null; } else { $user = new User((int) $res['ID'], $res['NAME'], $res['EMAIL']); $user->setPassword($res['PASSWORD']); $user->setBalance($res['BALANCE']); $user->setConfig($res['CONFIG']); $user->setCreationTime($res['CREATIONTIME']); $user->setLastUpdate($res['LASTUPDATE']); return $user; } }