summaryrefslogtreecommitdiffstats
path: root/examples/class
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2017-03-27 02:34:20 -0400
committerMalf Furious <m@lfurio.us>2017-03-27 02:34:20 -0400
commite55a29adc466aa1b485f564104ed3bc5d15ed28b (patch)
treec5c0b0905fc3402168639f247846883821af18b0 /examples/class
parent1ae7eab4711353b2144d0da40ac33270bc79a081 (diff)
downloadscrott-e55a29adc466aa1b485f564104ed3bc5d15ed28b.tar.gz
scrott-e55a29adc466aa1b485f564104ed3bc5d15ed28b.zip
Purge old content
Diffstat (limited to 'examples/class')
-rw-r--r--examples/class/group.class.php49
-rw-r--r--examples/class/user.class.php103
2 files changed, 0 insertions, 152 deletions
diff --git a/examples/class/group.class.php b/examples/class/group.class.php
deleted file mode 100644
index 246276a..0000000
--- a/examples/class/group.class.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-/*
- * SCROTT Copyright (C) 2016 Malf Furious
- *
- * Scrott is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License,
- * or (at your option) any later version.
- *
- * Scrott is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- */
-
-require_once "class/object.class.php";
-
-/*
- * User groups
- */
-class Group extends Object
-{
- /*
- * Constructor
- */
- function __construct($guid = null)
- {
- parent::__construct();
- $this->loadObj($guid);
- }
-
- /*
- * Create a new user group object.
- * On success, this object should be initialized as the new group (use only on new
- * Group() objects)
- */
- function createNewGroup($name, $owner)
- {
- $this->perms = $this->DEFAULT_OBJECT_PERMISSIONS;
- $this->owner = $owner->guid;
- $this->name = $name;
- $this->type = "group";
-
- $this->saveObj();
- }
-}
-
-?>
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;
- }
}
?>