summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2008-10-23 08:42:43 +0000
committerdeva <deva>2008-10-23 08:42:43 +0000
commit8e4e2bd50f9237481b77500feb27470a5ffc3473 (patch)
tree8698be3ca0312426bfd89ddd36e836b164cdd1fd
parenta095638ca86e571a0c5589400fe5ebc20aee0d2d (diff)
More work on addressbook, now almost finished.
-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