X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Faddressbook.php;h=2ad610ea4bcbe5e95fd65487305680e6fa96a158;hb=e2ab93e54b0576afcc455883e256862fa939c79c;hp=c1d584b74e439a199ab77d6316f4fb33c39c0273;hpb=d9fdc8d3da9301594d749b8cd4ba6081318dd740;p=squirrelmail.git diff --git a/src/addressbook.php b/src/addressbook.php index c1d584b7..2ad610ea 100644 --- a/src/addressbook.php +++ b/src/addressbook.php @@ -7,35 +7,36 @@ ** ** Manage personal address book. ** + ** $Id$ **/ session_start(); + if (!isset($strings_php)) + include('../functions/strings.php'); if (!isset($config_php)) - include("../config/config.php"); + include('../config/config.php'); if (!isset($array_php)) - include("../functions/array.php"); + include('../functions/array.php'); if (!isset($auth_php)) - include("../functions/auth.php"); - if (!isset($strings_php)) - include("../functions/strings.php"); + include('../functions/auth.php'); if (!isset($page_header_php)) - include("../functions/page_header.php"); + include('../functions/page_header.php'); if (!isset($display_messages_php)) - include("../functions/display_messages.php"); + include('../functions/display_messages.php'); if (!isset($addressbook_php)) - include("../functions/addressbook.php"); + include('../functions/addressbook.php'); is_logged_in(); // Sort array by the key "name" function alistcmp($a,$b) { - if($a["backend"] > $b["backend"]) + if($a['backend'] > $b['backend']) return 1; - else if($a["backend"] < $b["backend"]) + else if($a['backend'] < $b['backend']) return -1; - return (strtolower($a["name"]) > strtolower($b["name"])) ? 1 : -1; + return (strtolower($a['name']) > strtolower($b['name'])) ? 1 : -1; } // Output form to add and modify address data @@ -47,28 +48,38 @@ printf("". "". " %s\n", - $color[4], $name, htmlspecialchars($values["nickname"]), + $color[4], $name, + (isset($values['nickname']))? + htmlspecialchars($values['nickname']):"", _("Must be unique")); printf("%s:", _("E-mail address")); printf("". "\n", - $color[4], $name, htmlspecialchars($values["email"])); + $color[4], $name, + (isset($values["email"]))? + htmlspecialchars($values["email"]):""); printf("%s:", _("First name")); printf("". "\n", - $color[4], $name, htmlspecialchars($values["firstname"])); + $color[4], $name, + (isset($values["firstname"]))? + htmlspecialchars($values["firstname"]):""); printf("%s:", _("Last name")); printf("". "\n", - $color[4], $name, htmlspecialchars($values["lastname"])); + $color[4], $name, + (isset($values["lastname"]))? + htmlspecialchars($values["lastname"]):""); printf("%s:", _("Additional info")); printf("". "\n", - $color[4], $name, htmlspecialchars($values["label"])); + $color[4], $name, + (isset($values["label"]))? + htmlspecialchars($values["label"]):""); printf("\n". "\n", @@ -78,7 +89,7 @@ } - include("../src/load_prefs.php"); + include('../src/load_prefs.php'); // Open addressbook, with error messages on but without LDAP (the // second "true"). Don't need LDAP here anyway @@ -88,23 +99,23 @@ exit(); } - displayPageHeader($color, "None"); + displayPageHeader($color, 'None'); $defdata = array(); - $formerror = ""; + $formerror = ''; $abortform = false; $showaddrlist = true; $defselected = array(); // Handle user's actions - if($REQUEST_METHOD == "POST") { + if($REQUEST_METHOD == 'POST') { // *********************************************** // Add new address // *********************************************** - if(!empty($addaddr["nickname"])) { + if(!empty($addaddr['nickname'])) { $r = $abook->add($addaddr, $abook->localbackend); @@ -112,7 +123,7 @@ if(!$r) { // Remove backend name from error string $errstr = $abook->error; - $errstr = ereg_replace("^\[.*\] *", "", $errstr); + $errstr = ereg_replace('^\[.*\] *', '', $errstr); $formerror = $errstr; $showaddrlist = false; @@ -137,7 +148,7 @@ $delfailed = false; for($i = 0 ; (($i < sizeof($sel)) && !$delfailed) ; $i++) { - list($sbackend, $snick) = split(":", $sel[$i]); + list($sbackend, $snick) = split(':', $sel[$i]); // When we get to a new backend, process addresses in // previous one. @@ -190,7 +201,7 @@ $olddata = $abook->lookup($enick, $ebackend); // Display the "new address" form - printf("
\n", $PHP_SELF); + print "\n"; print "\n"; print "
\n"; print _("Update address"); @@ -202,7 +213,7 @@ printf("\n", htmlspecialchars($olddata["backend"])); print "\n"; - print ""; + print ''; } } @@ -234,7 +245,7 @@ printf("\n", htmlspecialchars($backend)); print "\n"; - print ""; + print ''; $abortform = true; } @@ -292,7 +303,7 @@ // New table header for each backend if($prevbackend != $row["backend"]) { if($prevbackend >= 0) { - print "
"; + print '
'; print " 
\n"; } @@ -302,7 +313,7 @@ print "\n\n"; print "\n"; - print ''; + print '
'; printf('\n"; print "
 '. '%s%s'. '%s%s'. @@ -315,13 +326,13 @@ $headerprinted = true; } // End of header - $prevbackend = $row["backend"]; + $prevbackend = $row['backend']; // Check if this user is selected - if(in_array($row["backend"].":".$row["nickname"], $defselected)) - $selected = "CHECKED"; + if(in_array($row['backend'].':'.$row['nickname'], $defselected)) + $selected = 'CHECKED'; else - $selected = ""; + $selected = ''; // Print one row printf("", @@ -360,8 +371,8 @@ printf(_("Add to %s"), $abook->localbackendname); print "\n
\n"; - address_form("addaddr", _("Add address"), $defdata); - print ""; + address_form('addaddr', _("Add address"), $defdata); + print ''; // Add hook for anything that wants on the bottom do_hook("addressbook_bottom");