summaryrefslogtreecommitdiff
path: root/forum/utils/addressbook.php
blob: 43477dd70c3fddc5bac4f61bd998b88344caf4a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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

}

?>