From 42c62cb041a2b2b95c9cda0c20fcf70334fd244c Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 1 Nov 2011 09:32:21 +0000 Subject: Rewl og krat... needs cleaning up - after port to GIT. --- forum/utils/addressbook.php | 279 +++++++++++++++++++++++--------------------- 1 file changed, 147 insertions(+), 132 deletions(-) (limited to 'forum/utils/addressbook.php') diff --git a/forum/utils/addressbook.php b/forum/utils/addressbook.php index 20548ce..240831f 100644 --- a/forum/utils/addressbook.php +++ b/forum/utils/addressbook.php @@ -1,5 +1,4 @@ -
- - Name:
- c/o:
- Address:
- City:
- Country:
- Phone:
- Phone2:
- Email:
- Email2:
- URL:
- URL2:
- Essential: > (show on frontpage)
- Notes:
-
- -
-add($contactgroup); - $contacts->write(); - $gid = 0; -} - -elseif($action == "addcontact" && $gid && $cid) { - $contact = new Contact($cid, - $name, - $co, - $address, - $city, - $country, - $phone, - $phone2, - $email, - $email2, - $url, - $url2, - $essential, - $notes); - $contactgroup = $contacts->getContactGroup($gid); - $contactgroup->add($contact); - $contacts->write(); - $cid = 0; -} - -elseif($action =="editcontact" && $cid) { - $contact = $contacts->getContact($cid); - form($contact->cid, - "?mode=addressbook&action=updatecontact".$gid, - "Update contact", - $contact->name, - $contact->co, - $contact->address, - $contact->city, - $contact->country, - $contact->phone, - $contact->phone2, - $contact->email, - $contact->email2, - $contact->url, - $contact->url2, - $contact->essential, - $contact->notes); + $str = ""; + + $str .= "
\n"; + $str .= " \n"; + $str .= " Name:
\n"; + $str .= " c/o:
\n"; + $str .= " Address:
\n"; + $str .= " City:
\n"; + $str .= " Country:
\n"; + $str .= " Phone:
\n"; + $str .= " Phone2:
\n"; + $str .= " Email:
\n"; + $str .= " Email2:
\n"; + $str .= " URL:
\n"; + $str .= " URL2:
\n"; + $ess = ""; + if($essential == "on") $ess = " checked"; + $str .= " Essential: (show on frontpage)
\n"; + $str .= " Notes:
\n"; + $str .= "
\n"; + $str .= " \n"; + $str .= "
\n"; + + return $str; } -elseif($action == "updatecontact" && $cid) { - $contact = $contacts->getContact($cid); - - $contact->name = $name; - $contact->co = $co; - $contact->address = $address; - $contact->city = $city; - $contact->country = $country; - $contact->phone = $phone; - $contact->phone2 = $phone2; - $contact->email = $email; - $contact->email2 = $email2; - $contact->url = $url; - $contact->url2 = $url2; - $contact->essential = $essential; - $contact->notes = $notes; - - $contacts->write(); - - $contact->show(); -} - -elseif($cid) { - $contact = $contacts->getContact($cid); - $contact->show(); -} - -elseif($gid) { - $contactgroup = $contacts->getContactGroup($gid); - $contactgroup->show(); - - form($contacts->getNextCID(), - "?mode=addressbook&action=addcontact&gid=".$gid, - "Add contact"); - -} else { - $contacts->show(); - if($current_user->uid == 0) { -?> -
- - Name: - -
-add($contactgroup); + $contacts->write(); + $gid = 0; + } + + elseif($GLOBALS['action'] == "addcontact" && $gid && $cid) { + $contact = new Contact($cid, + $name, + $co, + $address, + $city, + $country, + $phone, + $phone2, + $email, + $email2, + $url, + $url2, + $essential, + $notes); + $contactgroup = $contacts->getContactGroup($gid); + $contactgroup->add($contact); + $contacts->write(); + $cid = 0; + } + + elseif($GLOBALS['action'] =="editcontact" && $cid) { + $contact = $contacts->getContact($cid); + $str .= form($contact->cid, + "?mode=addressbook&action=updatecontact".$gid, + "Update contact", + $contact->name, + $contact->co, + $contact->address, + $contact->city, + $contact->country, + $contact->phone, + $contact->phone2, + $contact->email, + $contact->email2, + $contact->url, + $contact->url2, + $contact->essential, + $contact->notes); + } + + elseif($GLOBALS['action'] == "updatecontact" && $cid) { + $contact = $contacts->getContact($cid); + + $contact->name = $name; + $contact->co = $co; + $contact->address = $address; + $contact->city = $city; + $contact->country = $country; + $contact->phone = $phone; + $contact->phone2 = $phone2; + $contact->email = $email; + $contact->email2 = $email2; + $contact->url = $url; + $contact->url2 = $url2; + $contact->essential = $essential; + $contact->notes = $notes; + + $contacts->write(); + + $str .= $contact->show(); + } + + elseif($cid) { + $contact = $contacts->getContact($cid); + $str .= $contact->show(); + } + + elseif($gid) { + $contactgroup = $contacts->getContactGroup($gid); + $str .= $contactgroup->show(); + + $str .= form($contacts->getNextCID(), + "?mode=addressbook&action=addcontact&gid=".$gid, + "Add contact"); + + } else { + $str .= $contacts->show(); + if($current_user->uid == 0) { + + $str .= "
\n"; + $str .= " getNextGID()) . "\">\n"; + $str .= " Name: \n"; + $str .= " \n"; + $str .= "
\n"; + + } + } + + return $str; } - ?> \ No newline at end of file -- cgit v1.2.3