summaryrefslogtreecommitdiff
path: root/forum/utils
diff options
context:
space:
mode:
Diffstat (limited to 'forum/utils')
-rw-r--r--forum/utils/addressbook.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/forum/utils/addressbook.php b/forum/utils/addressbook.php
new file mode 100644
index 0000000..43477dd
--- /dev/null
+++ b/forum/utils/addressbook.php
@@ -0,0 +1,41 @@
+<?php
+include_once($UTIL_DIR . "/contacts.php");
+
+$contacts = new Contacts($DATA_DIR . "/contacts.xml");
+
+if($cid && $name) {
+ // Edit
+ $contact = new Contact($cid,
+ $name,
+ $address,
+ $phone,
+ $phone2,
+ $email,
+ $url);
+ $contacts->add($contact);
+ $contacts->write();
+} elseif($name) {
+ // Add
+ $cid = $contacts->getNextCID();
+ $contact = new Contact($cid,
+ $name,
+ $address,
+ $phone,
+ $phone2,
+ $email,
+ $url);
+ $contacts->add($contact);
+ $contacts->write();
+}
+
+if($cid) {
+ $contact = $contacts->getContact($cid);
+ $contact->show();
+} else {
+ $contacts->show();
+
+ // TODO: Editorbox for adding new contact
+
+}
+
+?> \ No newline at end of file