** $Id$
**/
- session_start();
-
- if (!isset($strings_php))
- include('../functions/strings.php');
- if (!isset($config_php))
- include('../config/config.php');
- if (!isset($array_php))
- include('../functions/array.php');
- if (!isset($auth_php))
- include('../functions/auth.php');
- if (!isset($page_header_php))
- include('../functions/page_header.php');
- if (!isset($display_messages_php))
- include('../functions/display_messages.php');
- if (!isset($addressbook_php))
- include('../functions/addressbook.php');
-
- is_logged_in();
+ require_once('../src/validate.php');
+ require_once('../functions/array.php');
+ require_once('../functions/display_messages.php');
+ require_once('../functions/addressbook.php');
// Sort array by the key "name"
function alistcmp($a,$b) {
}
- include('../src/load_prefs.php');
-
// Open addressbook, with error messages on but without LDAP (the
// second "true"). Don't need LDAP here anyway
$abook = addressbook_init(true, true);
$delfailed = false;
for($i = 0 ; (($i < sizeof($sel)) && !$delfailed) ; $i++) {
- list($sbackend, $snick) = split(':', $sel[$i]);
+ list($sbackend, $snick) = explode(':', $sel[$i]);
// When we get to a new backend, process addresses in
// previous one.
else if(!empty($editaddr)) {
// Stage one: Copy data into form
- if(sizeof($sel) > 0) {
+ if (isset($sel) && sizeof($sel) > 0) {
if(sizeof($sel) > 1) {
$formerror = _("You can only edit one address at the time");
$showaddrlist = true;
$defselected = $sel;
} else {
$abortform = true;
- list($ebackend, $enick) = split(":", $sel[0]);
+ list($ebackend, $enick) = explode(':', $sel[0]);
$olddata = $abook->lookup($enick, $ebackend);
// Display the "new address" form
$prevbackend = -1;
$headerprinted = false;
+ echo "<p align=center><a href=\"#AddAddress\">" .
+ _("Add address") . "</a></p>\n";
+
// List addresses
printf("<FORM ACTION=\"%s\" METHOD=\"POST\">\n", $PHP_SELF);
while(list($undef,$row) = each($alist)) {
// New table header for each backend
if($prevbackend != $row["backend"]) {
if($prevbackend >= 0) {
+ print "<TR><TD COLSPAN=5 ALIGN=center>\n";
+ printf("<INPUT TYPE=submit NAME=editaddr VALUE=\"%s\">\n",
+ _("Edit selected"));
+ printf("<INPUT TYPE=submit NAME=deladdr VALUE=\"%s\">\n",
+ _("Delete selected"));
+ echo "</tr>\n";
print '<TR><TD COLSPAN="5" ALIGN=center>';
print " <BR></TD></TR></TABLE>\n";
}
// Display the "new address" form
+ echo "<a name=\"AddAddress\"></a>\n";
printf("<FORM ACTION=\"%s\" NAME=f_add METHOD=\"POST\">\n", $PHP_SELF);
print "<TABLE WIDTH=100% COLS=1 ALIGN=CENTER>\n";
print "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER>\n<STRONG>";