e8b140ab |
1 | <?php |
08185f2a |
2 | |
b755a6b1 |
3 | /** |
4 | * take.php |
5 | * |
82d304a0 |
6 | * Copyright (c) 1999-2004 The SquirrelMail Project Team |
b755a6b1 |
7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | * |
9 | * Address Take -- steals addresses from incoming email messages. Searches |
10 | * the To, Cc, From and Reply-To headers. |
11 | * |
12 | * $Id$ |
ea5f4b8e |
13 | * @package plugins |
14 | * @subpackage abook_take |
b755a6b1 |
15 | */ |
1bf86d6f |
16 | |
ea5f4b8e |
17 | /** |
18 | * Path for SquirrelMail required files. |
19 | * @ignore */ |
08185f2a |
20 | define('SM_PATH','../../'); |
e8b140ab |
21 | |
08185f2a |
22 | /* SquirrelMail required files. */ |
41ec18a3 |
23 | require_once(SM_PATH . 'include/validate.php'); |
08185f2a |
24 | require_once(SM_PATH . 'functions/strings.php'); |
25 | require_once(SM_PATH . 'config/config.php'); |
26 | require_once(SM_PATH . 'functions/i18n.php'); |
27 | require_once(SM_PATH . 'functions/page_header.php'); |
28 | require_once(SM_PATH . 'functions/addressbook.php'); |
aa7fb30c |
29 | require_once(SM_PATH . 'include/load_prefs.php'); |
08185f2a |
30 | require_once(SM_PATH . 'functions/html.php'); |
1bf86d6f |
31 | require_once(SM_PATH . 'functions/forms.php'); |
32 | |
08185f2a |
33 | displayPageHeader($color, 'None'); |
b755a6b1 |
34 | |
35 | /* input form data */ |
36 | sqgetGlobalVar('email', $email, SQ_POST); |
37 | |
08185f2a |
38 | $abook_take_verify = getPref($data_dir, $username, 'abook_take_verify'); |
4cf43843 |
39 | |
40 | $abook = addressbook_init(false, true); |
41 | $name = 'addaddr'; |
b755a6b1 |
42 | |
1bf86d6f |
43 | $addrs = array(); |
44 | foreach ($email as $Val) { |
45 | if (valid_email($Val, $abook_take_verify)) { |
46 | $addrs[$Val] = $Val; |
47 | } else { |
48 | $addrs[$Val] = 'FAIL - ' . $Val; |
49 | } |
50 | } |
51 | |
52 | echo addForm(SM_PATH . 'src/addressbook.php', 'POST', 'f_add') . "\n" . |
4cf43843 |
53 | html_tag( 'table', |
54 | html_tag( 'tr', |
55 | html_tag( 'th', sprintf(_("Add to %s"), $abook->localbackendname), 'center', $color[0] ) |
56 | ) , |
1bf86d6f |
57 | 'center', '', 'width="100%"' ) . "\n" . |
4cf43843 |
58 | |
59 | html_tag( 'table', '', 'center', '', 'border="0" cellpadding="1" cols="2" width="90%"' ) . "\n" . |
60 | html_tag( 'tr', "\n" . |
61 | html_tag( 'td', _("Nickname") . ':', 'right', $color[4], 'width="50"' ) . "\n" . |
1bf86d6f |
62 | html_tag( 'td', addInput($name . '[nickname]', '', 15) . |
4cf43843 |
63 | ' <small>' . _("Must be unique") . '</small>', |
64 | 'left', $color[4] ) |
65 | ) . "\n" . |
66 | html_tag( 'tr' ) . "\n" . |
67 | html_tag( 'td', _("E-mail address") . ':', 'right', $color[4], 'width="50"' ) . "\n" . |
1bf86d6f |
68 | html_tag( 'td', '', 'left', $color[4] ) . "\n" . |
69 | addSelect($name . '[email]', $addrs, null, true) . |
70 | '</td></tr>' . "\n"; |
b755a6b1 |
71 | |
e842b215 |
72 | if ($squirrelmail_language == 'ja_JP') { |
1bf86d6f |
73 | echo html_tag( 'tr', "\n" . |
74 | html_tag( 'td', _("Last name") . ':', 'right', $color[4], 'width="50"' ) . |
75 | html_tag( 'td', addInput($name . '[lastname]', '', 45), 'left', $color[4] ) |
76 | ) . "\n" . |
77 | html_tag( 'tr', "\n" . |
78 | html_tag( 'td', _("First name") . ':', 'right', $color[4], 'width="50"' ) . |
79 | html_tag( 'td', addInput($name . '[firstname]', '', 45), 'left', $color[4] ) |
80 | ) . "\n"; |
e842b215 |
81 | } else { |
1bf86d6f |
82 | echo html_tag( 'tr', "\n" . |
83 | html_tag( 'td', _("First name") . ':', 'right', $color[4], 'width="50"' ) . |
84 | html_tag( 'td', addInput($name . '[firstname]', '', 45), 'left', $color[4] ) |
85 | ) . "\n" . |
86 | html_tag( 'tr', "\n" . |
87 | html_tag( 'td', _("Last name") . ':', 'right', $color[4], 'width="50"' ) . |
88 | html_tag( 'td', addInput($name . '[lastname]', '', 45), 'left', $color[4] ) |
89 | ) . "\n"; |
e842b215 |
90 | } |
1bf86d6f |
91 | echo html_tag( 'tr', "\n" . |
92 | html_tag( 'td', _("Additional info") . ':', 'right', $color[4], 'width="50"' ) . |
93 | html_tag( 'td', addInput($name . '[label]', '', 45), 'left', $color[4] ) |
94 | ) . "\n" . |
95 | html_tag( 'tr', "\n" . |
96 | html_tag( 'td', |
97 | addSubmit(_("Add address"), $name . '[SUBMIT]'), |
98 | 'center', $color[4], 'colspan="2"' ) |
99 | ) . "\n"; |
e8b140ab |
100 | ?> |
1bf86d6f |
101 | </table> |
dcc1cc82 |
102 | </form></body> |
103 | </html> |