X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Faddressbook.php;h=acb88d80cdc8c379d27b0071d303d17790c4953a;hb=45c1ed84f88a3e3a9e3d0959642b88f1225bac45;hp=6e17d228d7b07e71b0992e8270316ef8d54a14f0;hpb=625c8b787b79d07a1e53ba05213f66451d73651e;p=squirrelmail.git
diff --git a/src/addressbook.php b/src/addressbook.php
index 6e17d228..acb88d80 100644
--- a/src/addressbook.php
+++ b/src/addressbook.php
@@ -3,55 +3,52 @@
/**
* 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.
*
* $Id$
+ * @package squirrelmail
*/
-/* Path for SquirrelMail required files. */
+/** Path for SquirrelMail required files. */
define('SM_PATH','../');
-/* SquirrelMail required files. */
+/** 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 */
-$key = $_COOKIE['key'];
+/** lets get the global vars we may need */
+sqgetGlobalVar('key', $key, SQ_COOKIE);
-$username = $_SESSION['username'];
-$onetimepad = $_SESSION['onetimepad'];
-$base_uri = $_SESSION['base_uri'];
-$delimiter = $_SESSION['delimiter'];
+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 */
-if ( isset($_POST['addaddr']) ) {
- $addaddr = &$_POST['addaddr'];
-}
-if ( isset($_POST['editaddr']) ) {
- $editaddr = &$_POST['editaddr'];
-}
-if ( isset($_POST['deladdr']) ) {
- $deladdr = &$_POST['deladdr'];
-}
-$sel = &$_POST['sel'];
+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);
-if (isset($_POST['oldnick'])) {
- $oldnick = $_POST['oldnick'];
-}
-if (isset($_POST['backend'])) {
- $backend = $_POST['backend'];
-}
-if (isset($_POST['doedit'])) {
- $doedit = $_POST['doedit'];
-}
-
-/* Make an input field */
+/**
+ * Make an input field
+ * @param string $label
+ * @param string $field
+ * @param string $name
+ * @param string $size
+ * @param array $values
+ * @param string $add
+ */
function adressbook_inp_field($label, $field, $name, $size, $values, $add) {
global $color;
$td_str = '' . _("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, '') .
+ list_writable_backends($name) .
+ 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") . '') .
@@ -77,6 +94,7 @@ function address_form($name, $submittext, $values = array()) {
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, '') .
+ list_writable_backends($name) .
html_tag( 'tr',
html_tag( 'td',
'numbackends > 1 ) {
+ $ret = "";
+ return html_tag( 'tr',
+ html_tag( 'td', _("Add to:"),'right', $color[4] ) .
+ html_tag( 'td', $ret, 'left', $color[4] )) . "\n";
+ } else {
+ return html_tag( 'tr',
+ html_tag( 'td',
+ '',
+ 'center', $color[4], 'colspan="2"')) . "\n";
+ }
+}
/* Open addressbook, with error messages on but without LDAP (the *
* second "true"). Don't need LDAP here anyway */
@@ -107,16 +150,20 @@ $form_url = 'addressbook.php';
/* Handle user's actions */
-if($_SERVER['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);
+ if (isset($backend)) {
+ $r = $abook->add($addaddr, $backend);
+ } else {
+ $r = $abook->add($addaddr, $abook->localbackend);
+ }
/* Handle error messages */
if (!$r) {
@@ -227,7 +274,7 @@ if($_SERVER['REQUEST_METHOD'] == 'POST') {
echo html_tag( 'table',
html_tag( 'tr',
html_tag( 'td',
- "\n". '
' . _("ERROR") . ': ' . $abook->error . '' ."\n",
'center' )
),
@@ -239,10 +286,10 @@ if($_SERVER['REQUEST_METHOD'] == 'POST') {
html_tag( 'table',
html_tag( 'tr',
html_tag( 'td',
- "\n". '
' . _("Update address") . '' ."\n",
+ "\n". '' . _("Update address") . '' ."\n",
'center', $color[0] )
),
- 'center', '', 'width="100%"' ) .
+ 'center', '', 'width="100%"' );
address_form("editaddr", _("Update address"), $newdata);
echo '\n" .
@@ -357,7 +404,19 @@ if ($showaddrlist) {
/* Print one row */
$tr_bgcolor = '';
if ($line % 2) { $tr_bgcolor = $color[0]; }
- echo html_tag( 'tr', '') .
+ if ($squirrelmail_language == 'ja_JP')
+ {
+ echo html_tag( 'tr', '', '', $tr_bgcolor) .
+ html_tag( 'td',
+ '' .
+ '' ,
+ 'center', '', 'valign="top" width="1%"' ) .
+ html_tag( 'td', ' ' . $row['nickname'] . ' ', 'left', '', 'valign="top" width="1%" nowrap' ) .
+ html_tag( 'td', ' ' . $row['lastname'] . ' ' . $row['firstname'] . ' ', 'left', '', 'valign="top" width="1%" nowrap' ) .
+ html_tag( 'td', '', 'left', '', 'valign="top" width="1%" nowrap' ) . ' ';
+ } else {
+ echo html_tag( 'tr', '', '', $tr_bgcolor) .
html_tag( 'td',
'' .
'full_address($row);
- if ($compose_new_win == '1') {
- echo '';
- }
- else {
- echo '';
- }
- echo htmlspecialchars($row['email']) . ' '."\n".
+ echo makeComposeLink('src/compose.php?send_to='.rawurlencode($email),
+ htmlspecialchars($row['email']) ) .
+ ' '."\n".
html_tag( 'td', ' ' . htmlspecialchars($row['label']) . ' ', 'left', '', 'valign="top" width="1%"' ) .
"\n";
$line++;
@@ -400,7 +456,7 @@ echo '' . "\n" .
'