From 5b61a40d77ac3bbb8d40c5bf32ed27d4f41f8f2d Mon Sep 17 00:00:00 2001 From: tokul Date: Sat, 15 Jul 2006 12:39:16 +0000 Subject: [PATCH] older code used sel[] name in list form. Label code added backend id and nickname. extracting array value with current() instead of using index. $sel is also used when address book entry is deleted, but array is reindexed there. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11398 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/addressbook.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/addressbook.php b/src/addressbook.php index f3fb8b1a..7b933923 100644 --- a/src/addressbook.php +++ b/src/addressbook.php @@ -147,16 +147,19 @@ if(sqgetGlobalVar('REQUEST_METHOD', $req_method, SQ_SERVER) && $req_method == 'P $defselected = $sel; } else { $abortform = true; - list($ebackend, $enick) = explode(':', $sel[0]); + list($ebackend, $enick) = explode(':', current($sel)); $olddata = $abook->lookup($enick, $ebackend); - // FIXME: Test if $olddata really contains anything and return an error message if it doesn't - - /* Display the "new address" form */ - abook_create_form($form_url,'editaddr',_("Update address"),_("Update address"),$olddata); - echo addHidden('oldnick', $olddata['nickname']). - addHidden('backend', $olddata['backend']). - addHidden('doedit', '1'). - ''; + // Test if $olddata really contains anything and return an error message if it doesn't + if (!$olddata) { + error_box(nl2br(htmlspecialchars($abook->error))); + } else { + /* Display the "new address" form */ + abook_create_form($form_url,'editaddr',_("Update address"),_("Update address"),$olddata); + echo addHidden('oldnick', $olddata['nickname']). + addHidden('backend', $olddata['backend']). + addHidden('doedit', '1'). + ''; + } } } elseif ($doedit == 1) { /* Stage two: Write new data */ -- 2.25.1