public function getAvatarPath() { $path = parent::getAvatarPath(); if ($path == null) { $path = "default.png"; } return "Uploads/Avatars/" . $path; }
/** * ### Sets a remember token to stay logged in * * @param User $user * @param $hash * @throws \Propel\Runtime\Exception\PropelException */ private static function setRememberToken(User $user, $hash) { $cookie_name = 'remember_token'; $cookie_time = 3600 * 24 * 30; $sha = sha1($hash); $remember = $user->getId() . '.' . $sha; $hostname = Config::get('app', 'hostname'); if (filter_var($hostname, FILTER_VALIDATE_IP)) { $cookie_host = $hostname; } else { $cookie_host = '.' . $hostname; } setcookie($cookie_name, $remember, time() + $cookie_time, '/', $cookie_host); $user->setRemember($sha); $user->save(); }