diff options
| author | Malf Furious <m@lfurio.us> | 2017-03-27 02:34:20 -0400 | 
|---|---|---|
| committer | Malf Furious <m@lfurio.us> | 2017-03-27 02:34:20 -0400 | 
| commit | e55a29adc466aa1b485f564104ed3bc5d15ed28b (patch) | |
| tree | c5c0b0905fc3402168639f247846883821af18b0 /examples/class/user.class.php | |
| parent | 1ae7eab4711353b2144d0da40ac33270bc79a081 (diff) | |
| download | scrott-e55a29adc466aa1b485f564104ed3bc5d15ed28b.tar.gz scrott-e55a29adc466aa1b485f564104ed3bc5d15ed28b.zip | |
Purge old content
Diffstat (limited to '')
| -rw-r--r-- | examples/class/user.class.php | 103 | 
1 files changed, 0 insertions, 103 deletions
| diff --git a/examples/class/user.class.php b/examples/class/user.class.php index eff5fd0..063de19 100644 --- a/examples/class/user.class.php +++ b/examples/class/user.class.php @@ -3,85 +3,6 @@  class User extends Object  {      /* -     * Create a new User object with the given username and keyed with the given plain-text password -     * This function returns false if $username is already being used -     * On success, this object should be initialized as the new user (use only on new User() objects) -     */ -    function createNewUser($username, $password) -    { -        if ($this->usernameInUse($username)) -            return false; - -        /* if there exist no users already, make this new one an admin */ -        if (count($this->getAllUsers_orderByName()) == 0) -            $this->admin = 1; - -        $this->perms = 0; -        $this->name = $username; -        $this->type = "user"; -        $this->setPassword($password); -        $this->setEmail(""); - -        $this->saveObj(); - -        $this->owner = $this->guid; -        $this->saveObj(); - -        return true; -    } - -    /* -     * Validate the password for this user.  Returns true if correct, false otherwise -     */ -    function validatePassword($password) -    { -        $key = $this->getKey($password, $this->salt); -        return $key == $this->key; -    } - -    /* -     * Validate the email confirmation key for a user, returns true if correct, false otherwise.  On success, $this->emailConf is also set to 1 -     */ -    function confirmEmailKey($key) -    { -        if ($key != $this->emailConfKey) -            return false; - -        $this->emailConf = 1; -        return true; -    } - -    /* -     * Overwrite the salt and key for this user, given a new plaintext password -     */ -    function setPassword($password) -    { -        $this->salt = $this->getBlob(); -        $this->key = $this->getKey($password, $this->salt); -    } - -    /* -     * Overwrite the emailConfKey and flag, and change user's saved email address -     */ -    function setEmail($email) -    { -        $this->email = $email; -        $this->emailConf = 0; -        $this->emailConfKey = $this->getBlob(); -    } - -    /* -     * If a user has an alias set, display it instead of their username -     */ -    function getDisplayName() -    { -        if ($this->alias != "") -            return $this->alias; - -        return $this->name; -    } - -    /*       * Get the glyphicon to use for this user       */      function getGlyphicon() @@ -91,30 +12,6 @@ class User extends Object          return "glyphicon glyphicon-user";      } - -    /* -     * Get all groups this user owns or is a member of -     */ -    function getGroups() -    { -        /* owner */ -        $query = "SELECT guid FROM object WHERE type = 'group' AND owner = '" . $this->db->esc($this->guid) . "'"; -        $result = $this->db->query($query); - -        $groups = array(); - -        foreach ($result as $g) -            $groups[] = new Group($g['guid']); - -        /* member */ -        $query = "SELECT o.guid FROM object o JOIN obj_member om ON o.guid = om.guid WHERE o.type = 'group' AND member = '" . $this->db->esc($this->guid) . "'"; -        $result = $this->db->query($query); - -        foreach ($result as $g) -            $groups[] = new Group($g['guid']); - -        return $groups; -    }  }  ?> | 
