summaryrefslogtreecommitdiff
path: root/htdocs/src/User.inc.php
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2011-05-12 16:59:36 -0700
committerJesse Morgan <jesse@jesterpm.net ; true>2011-05-12 16:59:36 -0700
commitdd24e2c973a7979894971bdc38d904d2aecc7d5d (patch)
tree2f8474d22cbf29749219bd6dd543bb22b959465e /htdocs/src/User.inc.php
parente159ae5209a561043ceb89aa640b207df15181b7 (diff)
Well, you can see posts on the moderation panel now
Diffstat (limited to 'htdocs/src/User.inc.php')
-rw-r--r--htdocs/src/User.inc.php74
1 files changed, 74 insertions, 0 deletions
diff --git a/htdocs/src/User.inc.php b/htdocs/src/User.inc.php
new file mode 100644
index 0000000..6821042
--- /dev/null
+++ b/htdocs/src/User.inc.php
@@ -0,0 +1,74 @@
+<?php
+
+/* Foursquare Community Site
+ *
+ * Copyright (C) 2011 Foursquare Church.
+ *
+ * Developers: Jesse Morgan <jmorgan@foursquarestaff.com>
+ *
+ */
+
+require_once "base.inc.php";
+
+class User {
+ private $info;
+
+
+ public static function getById($id) {
+ $where = "id='$id'";
+
+ return User::getUser($where);
+ }
+
+ public static function getByEmail($email) {
+ $where = "email='$email'";
+
+ return User::getUser($where);
+ }
+
+ private static function getUser($where) {
+ $query = "SELECT * FROM user WHERE $where";
+
+ $db = getDatabase();
+
+ $row = $db->fetchAssocRow($query);
+
+ if ($row) {
+ $user = new User();
+ $user->info = $row;
+
+ return $user;
+
+ } else {
+ return false;
+ }
+ }
+
+ public function save() {
+ $db = getDatabase();
+
+ // TODO: Implement save
+ }
+
+ public function getId() {
+ return $this->info['id'];
+ }
+
+ public function getName() {
+ return $this->info['name'];
+ }
+
+ public function getEmail() {
+ return $this->info['email'];
+ }
+
+ public function setPassword($password) {
+ $this->info['password'] = sha1($password);
+ }
+
+ public function authenticate($password) {
+ return sha1($password) == $this->info['password'];
+ }
+}
+
+?>