X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Faddressbook.php;h=8d4c80ff719b6b03b327b02211ae759deb00a2bc;hb=c3ccfa1912b4ca47279d259bb587ceb293ce5d83;hp=bfeac2423aa8ba5e5009f9e9079955ac0b7ee102;hpb=9c3e6cd4518d9e0d072a146fd6d19acd4daac243;p=squirrelmail.git
diff --git a/src/addressbook.php b/src/addressbook.php
index bfeac242..8d4c80ff 100644
--- a/src/addressbook.php
+++ b/src/addressbook.php
@@ -3,7 +3,7 @@
/**
* addressbook.php
*
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* Manage personal address book.
@@ -11,44 +11,86 @@
* $Id$
*/
-require_once('../src/validate.php');
-require_once('../functions/array.php');
-require_once('../functions/display_messages.php');
-require_once('../functions/addressbook.php');
-require_once('../functions/strings.php');
+/* Path for SquirrelMail required files. */
+define('SM_PATH','../');
+
+/* SquirrelMail required files. */
+require_once(SM_PATH . 'include/validate.php');
+require_once(SM_PATH . 'functions/global.php');
+require_once(SM_PATH . 'functions/display_messages.php');
+require_once(SM_PATH . 'functions/addressbook.php');
+require_once(SM_PATH . 'functions/strings.php');
+require_once(SM_PATH . 'functions/html.php');
+
+/* lets get the global vars we may need */
+sqgetGlobalVar('key', $key, SQ_COOKIE);
+
+sqgetGlobalVar('username', $username, SQ_SESSION);
+sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION);
+sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
+sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
+
+/* From the address form */
+sqgetGlobalVar('addaddr', $addaddr, SQ_POST);
+sqgetGlobalVar('editaddr', $editaddr, SQ_POST);
+sqgetGlobalVar('deladdr', $deladdr, SQ_POST);
+sqgetGlobalVar('sel', $sel, SQ_POST);
+sqgetGlobalVar('oldnick', $oldnick, SQ_POST);
+sqgetGlobalVar('backend', $backend, SQ_POST);
+sqgetGlobalVar('doedit', $doedit, SQ_POST);
/* Make an input field */
function adressbook_inp_field($label, $field, $name, $size, $values, $add) {
global $color;
- echo '
' .
- $label . ': | ' .
- '' .
- '' . $add . ' |
' . "\n";
+ $td_str .= '">' . $add . '';
+ return html_tag( 'tr' ,
+ html_tag( 'td', $label . ':', 'right', $color[4]) .
+ html_tag( 'td', $td_str, 'left', $color[4])
+ )
+ . "\n";
}
/* Output form to add and modify address data */
function address_form($name, $submittext, $values = array()) {
- global $color;
-
- echo '' ."\n";
-
- adressbook_inp_field(_("Nickname"), 'nickname', $name, 15, $values,
- '' . _("Must be unique") . '');
- adressbook_inp_field(_("E-mail address"), 'email', $name, 45, $values, '');
- adressbook_inp_field(_("First name"), 'firstname', $name, 45, $values, '');
- adressbook_inp_field(_("Last name"), 'lastname', $name, 45, $values, '');
- adressbook_inp_field(_("Additional info"), 'label', $name, 45, $values, '');
-
- echo '' . "\n" .
- ' |
' .
- "\n
\n";
+ global $color, $squirrelmail_language;
+
+ if ($squirrelmail_language == 'ja_JP')
+ {
+ echo html_tag( 'table',
+ adressbook_inp_field(_("Nickname"), 'nickname', $name, 15, $values,
+ ' ' . _("Must be unique") . '') .
+ adressbook_inp_field(_("E-mail address"), 'email', $name, 45, $values, '') .
+ adressbook_inp_field(_("Last name"), 'lastname', $name, 45, $values, '') .
+ adressbook_inp_field(_("First name"), 'firstname', $name, 45, $values, '') .
+ adressbook_inp_field(_("Additional info"), 'label', $name, 45, $values, '') .
+ html_tag( 'tr',
+ html_tag( 'td',
+ '',
+ 'center', $color[4], 'colspan="2"')
+ )
+ , 'center', '', 'border="0" cellpadding="1" width="90%"') ."\n";
+ } else {
+ echo html_tag( 'table',
+ adressbook_inp_field(_("Nickname"), 'nickname', $name, 15, $values,
+ ' ' . _("Must be unique") . '') .
+ adressbook_inp_field(_("E-mail address"), 'email', $name, 45, $values, '') .
+ adressbook_inp_field(_("First name"), 'firstname', $name, 45, $values, '') .
+ adressbook_inp_field(_("Last name"), 'lastname', $name, 45, $values, '') .
+ adressbook_inp_field(_("Additional info"), 'label', $name, 45, $values, '') .
+ html_tag( 'tr',
+ html_tag( 'td',
+ '',
+ 'center', $color[4], 'colspan="2"')
+ )
+ , 'center', '', 'border="0" cellpadding="1" width="90%"') ."\n";
+}
}
-
/* Open addressbook, with error messages on but without LDAP (the *
* second "true"). Don't need LDAP here anyway */
@@ -62,22 +104,24 @@ if($abook->localbackend == 0) {
displayPageHeader($color, 'None');
-
$defdata = array();
$formerror = '';
$abortform = false;
$showaddrlist = true;
$defselected = array();
+$form_url = 'addressbook.php';
/* Handle user's actions */
-if($REQUEST_METHOD == 'POST') {
+if(sqgetGlobalVar('REQUEST_METHOD', $req_method, SQ_SERVER) && $req_method == 'POST') {
/**************************************************
* Add new address *
**************************************************/
- if (!empty($addaddr['nickname'])) {
-
+ if (isset($addaddr)) {
+ foreach( $addaddr as $k => $adr ) {
+ $addaddr[$k] = strip_tags( $adr );
+ }
$r = $abook->add($addaddr, $abook->localbackend);
/* Handle error messages */
@@ -90,7 +134,6 @@ if($REQUEST_METHOD == 'POST') {
$showaddrlist = false;
$defdata = $addaddr;
}
-
} else {
/************************************************
@@ -160,13 +203,15 @@ if($REQUEST_METHOD == 'POST') {
$olddata = $abook->lookup($enick, $ebackend);
/* Display the "new address" form */
- echo '';
+ echo '';
}
} /* end of addresslist */
/* Display the "new address" form */
echo '' . "\n" .
- '';