X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Faddressbook.php;h=50b16a9229865842540c6ddc9bc152add5dce65b;hb=fc99a551c505b2be1803373c8978f621ea2ea69f;hp=cb3bd0e9898afb4593dad30df2799083eccd728d;hpb=abdfb4d05045aafa3170747a2dca7ce5243e840f;p=squirrelmail.git
diff --git a/src/addressbook.php b/src/addressbook.php
index cb3bd0e9..50b16a92 100644
--- a/src/addressbook.php
+++ b/src/addressbook.php
@@ -1,218 +1,398 @@
strtolower($b["name"])) ? 1 : -1;
- }
-
- // Output form to add and modify address data
- function address_form($name, $submittext, $values = array()) {
- global $color;
- print "
\n";
- printf("%s: | ",
- _("Nickname"));
- printf("".
- "".
- " %s |
\n",
- $color[4], $name, htmlspecialchars($values["nickname"]),
- _("Must be unique"));
- printf("%s: | ",
- _("E-mail address"));
- printf("".
- " |
\n",
- $color[4], $name, htmlspecialchars($values["email"]));
- printf("%s: | ",
- _("First name"));
- printf("".
- " |
\n",
- $color[4], $name, htmlspecialchars($values["firstname"]));
- printf("%s: | ",
- _("Last name"));
- printf("".
- " |
\n",
- $color[4], $name, htmlspecialchars($values["lastname"]));
- printf("%s: | ",
- _("Additional info"));
- printf("".
- " |
\n",
- $color[4], $name, htmlspecialchars($values["label"]));
-
- printf("\n".
- " |
\n",
- $color[4], $name, $submittext);
-
- print "
\n";
- }
-
-
- // IMAP Login
- $imapConnection = sqimap_login ($username, $key,
- $imapServerAddress, $imapPort, 10);
- include("../src/load_prefs.php");
- sqimap_logout ($imapConnection);
-
-
- // Open addressbook, with error messages on but without LDAP (the
- // second "true"). Don't need LDAP here anyway
- $abook = addressbook_init(true, true);
- if($abook->localbackend == 0) {
- plain_error_message(_("No personal address book is defined. Contact administrator."), $color);
- exit();
- }
-
- print "\n";
- print "\n";
- printf("%s: %s\n", $org_title, _("Address Book"));
- print "\n\n";
-
- printf('',
- $color[8], $color[4], $color[7], $color[7], $color[7]);
- displayPageHeader($color, "None");
-
-
- $defdata = array();
- $formerror = "";
- $abortform = false;
- $showaddrlist = true;
-
-
- // Handle user's actions
- if($REQUEST_METHOD == "POST") {
-
- // Check for user addition
- $add_data = $HTTP_POST_VARS["addaddr"];
- if(!empty($add_data["nickname"])) {
-
- $r = $abook->add($add_data, $abook->localbackend);
-
- // Handle error messages
- if(!$r) {
- // Remove backend name from error string
- $errstr = $abook->error;
- $errstr = ereg_replace("^\[.*\] *", "", $errstr);
-
- $formerror = $errstr;
- $showaddrlist = false;
- $defdata = $add_data;
- }
-
- }
-
- // Check for "delete address"
- if((!empty($HTTP_POST_VARS["deladdr"])) &&
- sizeof($HTTP_POST_VARS["sel"]) > 0) {
- plain_error_message("Delete address not implemented yet", $color);
- $abortform = true;
- }
-
- // Check for "edit address"
- if((!empty($HTTP_POST_VARS["editaddr"])) &&
- sizeof($HTTP_POST_VARS["sel"]) > 0) {
- plain_error_message("Edit address not implemented yet", $color);
- $abortform = true;
- }
-
- // Some times we end output before forms are printed
- if($abortform) {
- print "\n";
- exit();
- }
-
- }
-
- // ===================================================================
- // The following is only executed on a GET request, or on a POST when
- // a user is added, or when "delete" or "modify" was successful.
- // ===================================================================
-
- // Display error messages
- if(!empty($formerror)) {
- print "\n";
- print "\n ";
- print ""._("ERROR").": $formerror";
- print "\n |
\n";
- print "
\n";
- }
-
- // Display the address management part
- if($showaddrlist) {
- printf("";
- }
-
- // Display the "new address" form
- printf("";
-
-?>
-
-