diff --git a/database.mwb b/database.mwb
index c859bfc..11189fc 100644
Binary files a/database.mwb and b/database.mwb differ
diff --git a/lib/Child.lib.php b/lib/Child.lib.php
deleted file mode 100644
index bde67bd..0000000
--- a/lib/Child.lib.php
+++ /dev/null
@@ -1,114 +0,0 @@
-get('people', ["familyid", "name", "birthday", "graduated"], ['personid' => $id]);
-
- $this->id = $id;
- $this->familyid = $info['familyid'];
- $this->name = $info['name'];
- $this->birthday = strtotime($info['birthday']);
- $this->graduated = $info['graduated'] == 1;
-
- return $this;
- }
-
- public function save() {
- global $database;
- if (is_int($this->id) && $database->has("people", ['personid' => $this->id])) {
- $database->update("people", ["name" => $this->name, "birthday" => date("Y-m-d", $this->birthday), "graduated" => $this->graduated], ['personid' => $this->id]);
- } else {
- $database->insert("people", ["familyid" => $this->familyid, "name" => $this->name, "birthday" => date("Y-m-d", $this->birthday), "graduated" => $this->graduated]);
- $this->id = $database->id();
- }
- }
-
- public static function exists(int $cid, int $fid = null) {
- global $database;
- if (is_null($fid)) {
- return $database->has("people", [
- 'personid' => $cid
- ]);
- }
- return $database->has("people", ["AND" => [
- 'familyid' => $fid,
- 'personid' => $cid
- ]]);
- }
-
- public function getID(): int {
- return $this->id;
- }
-
- public function getFamilyID(): int {
- return $this->familyid;
- }
-
- public function getFamily(): Family {
- return (new Family())->load($this->familyid);
- }
-
- public function getName(): string {
- return $this->name;
- }
-
- /**
- * Get the person's birth date as a UNIX timestamp.
- * @return int
- */
- public function getBirthday(): int {
- return $this->birthday;
- }
-
- public function isGraduated(): bool {
- return $this->graduated == true;
- }
-
- public function setName(string $name) {
- $this->name = $name;
- }
-
- /**
- * Set the person's birth date to either a UNIX timestamp or a date string.
- * @param int $timestamp
- * @param string $date A string parseable by strtotime().
- */
- public function setBirthday(int $timestamp = null, string $date = null) {
- if (is_null($timestamp) && !is_null($date)) {
- $this->birthday = strtotime($date);
- } else if (!is_null($timestamp) && is_null($date)) {
- $this->birthday = $timestamp;
- }
- }
-
- public function setGraduated(bool $graduated) {
- $this->graduated = $graduated;
- }
-
- public function setFamilyID(int $id) {
- $this->familyid = $id;
- }
-
- public function setFamily(Family $f) {
- $this->familyid = $f->getID();
- }
-
-}
diff --git a/lib/Family.lib.php b/lib/Family.lib.php
deleted file mode 100644
index be35c46..0000000
--- a/lib/Family.lib.php
+++ /dev/null
@@ -1,291 +0,0 @@
-has("families", ['familyid' => $familyid])) {
- $this->id = $familyid;
- } else {
- throw new Exception("No such family exists.");
- }
-
- $f = $database->get("families", [
- 'familyid (id)',
- 'familyname (name)',
- 'phone',
- 'email',
- 'newsletter_method (newsletter)',
- 'address',
- 'city',
- 'state',
- 'zip',
- 'father_name (father)',
- 'mother_name (mother)',
- 'photo_permission (photo)',
- 'expires',
- 'private'
- ], [
- "familyid" => $this->id
- ]);
-
- $children = $database->select("people", 'personid', ["familyid" => $this->id]);
-
- $this->name = $f['name'];
- $this->father = $f['father'];
- $this->mother = $f['mother'];
- $this->phone = $f['phone'];
- $this->email = $f['email'];
- $this->address = $f['address'];
- $this->city = $f['city'];
- $this->state = $f['state'];
- $this->zip = $f['zip'];
- $this->photo = $f['photo'] == 1;
- $this->newsletter = $f['newsletter'];
- $this->expires = strtotime($f['expires']);
- $this->private = $f['private'] == 1;
-
- foreach ($children as $c) {
- $this->children[] = (new Child())->load($c);
- }
-
- return $this;
- }
-
- public function save() {
- global $database;
- if (is_int($this->id) && $database->has("families", ['familyid' => $this->id])) {
- $database->update("families", [
- "familyname" => $this->getName(),
- "father_name" => $this->getFather(),
- "mother_name" => $this->getMother(),
- "phone" => $this->getPhone(),
- "email" => $this->getEmail(),
- "address" => $this->getAddress(),
- "city" => $this->getCity(),
- "state" => $this->getState(),
- "zip" => $this->getZip(),
- "photo_permission" => $this->getPhotoPermission(),
- "newsletter_method" => $this->getNewsletter(),
- "expires" => date("Y-m-d", $this->getExpires()),
- "private" => $this->getPrivate()
- ], [
- "familyid" => $this->id
- ]);
- } else {
- $database->insert("families", [
- "familyname" => $this->getName(),
- "father_name" => $this->getFather(),
- "mother_name" => $this->getMother(),
- "phone" => $this->getPhone(),
- "email" => $this->getEmail(),
- "address" => $this->getAddress(),
- "city" => $this->getCity(),
- "state" => $this->getState(),
- "zip" => $this->getZip(),
- "photo_permission" => $this->getPhotoPermission(),
- "newsletter_method" => $this->getNewsletter(),
- "expires" => date("Y-m-d", $this->getExpires()),
- "private" => $this->getPrivate()
- ]);
- $this->id = $database->id();
- }
-
- for ($i = 0; $i < count($this->children); $i++) {
- $this->children[$i]->setFamilyID($this->id);
- $this->children[$i]->save();
- }
- }
-
- public function getID() {
- return $this->id;
- }
-
- public function getName(): string {
- return $this->name;
- }
-
- public function getFather(): string {
- return $this->father;
- }
-
- public function getMother(): string {
- return $this->mother;
- }
-
- public function getPhone(): string {
- return $this->phone;
- }
-
- public function getEmail(): string {
- return $this->email;
- }
-
- public function getAddress(): string {
- return $this->address;
- }
-
- public function getCity(): string {
- return $this->city;
- }
-
- public function getState(): string {
- return $this->state;
- }
-
- public function getZip(): string {
- return $this->zip;
- }
-
- public function getPhotoPermission(): bool {
- return $this->photo == true;
- }
-
- public function getNewsletter(): int {
- return $this->newsletter;
- }
-
- public function getChildren(): array {
- return $this->children;
- }
-
- public function getExpires(): int {
- return $this->expires;
- }
-
- public function getPrivate(): bool {
- return $this->private == true;
- }
-
-
-
- public function setName(string $name) {
- $this->name = $name;
- }
-
- public function setFather(string $name) {
- $this->father = $name;
- }
-
- public function setMother(string $name) {
- $this->mother = $name;
- }
-
- public function setPhone(string $phone) {
- $phone = preg_replace("/[^0-9]/", "", $phone);
- if (strlen($phone) == 11) {
- $phone = preg_replace("/^1/", "", $phone);
- }
- if (strlen($phone) != 10) {
- throw new Exception("Enter a valid 10-digit phone number.");
- }
- $this->phone = $phone;
- }
-
- public function setEmail(string $email) {
- $email = strtolower($email);
- if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
- throw new Exception("The email address looks wrong.");
- }
- $this->email = $email;
- }
-
- public function setAddress(string $address) {
- $this->address = $address;
- }
-
- public function setCity(string $city) {
- $this->city = $city;
- }
-
- /**
- * Set the state, in two-character form.
- * @param string $state
- * @throws Exception
- */
- public function setState(string $state) {
- $state = strtoupper($state);
- if (!preg_match("/^[A-Z]{2}$/", $state)) {
- throw new Exception("Select a valid state.");
- }
- $this->state = strtoupper($state);
- }
-
- public function setZip(string $zip) {
- if (!preg_match("/^[0-9]{5}(-?[0-9]{4})?$/", $zip)) {
- throw new Exception("Enter a valid five or nine digit US ZIP code.");
- }
- $this->zip = $zip;
- }
-
- public function setPhotoPermission(bool $perm) {
- $this->photo = $perm;
- }
-
- public function setNewsletter(int $newsletter) {
- if (!is_int($newsletter) || !($newsletter == 1 || $newsletter == 2 || $newsletter == 3)) {
- throw new Exception("Invalid newsletter preference.");
- }
- $this->newsletter = $newsletter;
- }
-
- public function setChildren(array $children) {
- $this->children = $children;
- }
-
- public function addChild(Child $child) {
- $this->children[] = $child;
- }
-
- /**
- * Set the membership expiration date to either a UNIX timestamp or a date
- * string.
- * @param int $timestamp
- * @param string $date A string parseable by strtotime().
- */
- public function setExpires(int $timestamp = null, string $date = null) {
- if (is_null($timestamp) && !is_null($date)) {
- $this->expires = strtotime($date);
- } else if (!is_null($timestamp) && is_null($date)) {
- $this->expires = $timestamp;
- }
- }
-
- public function setPrivate(bool $private) {
- $this->private = $private;
- }
-
-}
diff --git a/nbproject/project.xml b/nbproject/project.xml
index 0ab2e4f..75ab9c3 100644
--- a/nbproject/project.xml
+++ b/nbproject/project.xml
@@ -3,7 +3,7 @@
- Please enter your email address below. You'll be - sent a verification code. This is to ensure nobody - else can view or change your family's information. -