e8b140ab |
1 | <?php |
08185f2a |
2 | |
e8b140ab |
3 | /** |
08185f2a |
4 | * take.php |
5 | * |
6 | * Adds a "taken" address to the address book. Takes addresses from |
7 | * incoming mail -- the body, To, From, Cc, or Reply-To. |
8 | */ |
e8b140ab |
9 | |
08185f2a |
10 | /* Path for SquirrelMail required files. */ |
11 | define('SM_PATH','../../'); |
e8b140ab |
12 | |
08185f2a |
13 | /* SquirrelMail required files. */ |
08185f2a |
14 | require_once(SM_PATH . 'functions/strings.php'); |
15 | require_once(SM_PATH . 'config/config.php'); |
b6a1eb5f |
16 | require_once(SM_PATH . 'include/validate.php'); |
08185f2a |
17 | require_once(SM_PATH . 'functions/i18n.php'); |
18 | require_once(SM_PATH . 'functions/page_header.php'); |
19 | require_once(SM_PATH . 'functions/addressbook.php'); |
aa7fb30c |
20 | require_once(SM_PATH . 'include/load_prefs.php'); |
08185f2a |
21 | require_once(SM_PATH . 'functions/html.php'); |
22 | |
23 | displayPageHeader($color, 'None'); |
24 | |
25 | $abook_take_verify = getPref($data_dir, $username, 'abook_take_verify'); |
4cf43843 |
26 | |
27 | $abook = addressbook_init(false, true); |
28 | $name = 'addaddr'; |
29 | echo '<form action="../../src/addressbook.php" name="f_add" method="post">' ."\n" . |
30 | html_tag( 'table', |
31 | html_tag( 'tr', |
32 | html_tag( 'th', sprintf(_("Add to %s"), $abook->localbackendname), 'center', $color[0] ) |
33 | ) , |
34 | 'center', '', 'width="100%" cols="1"' ) . |
35 | |
36 | html_tag( 'table', '', 'center', '', 'border="0" cellpadding="1" cols="2" width="90%"' ) . "\n" . |
37 | html_tag( 'tr', "\n" . |
38 | html_tag( 'td', _("Nickname") . ':', 'right', $color[4], 'width="50"' ) . "\n" . |
39 | html_tag( 'td', '<input name="' . $name . '[nickname]" size="15" value="">' . |
40 | ' <small>' . _("Must be unique") . '</small>', |
41 | 'left', $color[4] ) |
42 | ) . "\n" . |
43 | html_tag( 'tr' ) . "\n" . |
44 | html_tag( 'td', _("E-mail address") . ':', 'right', $color[4], 'width="50"' ) . "\n" . |
45 | html_tag( 'td', '', 'left', $color[4] ) . |
46 | '<select name="' . $name . "[email]\">\n"; |
e8b140ab |
47 | foreach ($email as $Val) |
48 | { |
49 | if (valid_email($Val, $abook_take_verify)) |
50 | { |
51 | echo '<option value="' . htmlspecialchars($Val) . |
52 | '">' . htmlspecialchars($Val) . "</option>\n"; |
53 | } |
d55c0f66 |
54 | else |
55 | { |
56 | echo '<option value="' . htmlspecialchars($Val) . |
57 | '">FAIL - ' . htmlspecialchars($Val) . "</option>\n"; |
58 | } |
e8b140ab |
59 | } |
4cf43843 |
60 | echo '</select></td></tr>' . "\n" . |
e8b140ab |
61 | |
4cf43843 |
62 | html_tag( 'tr', "\n" . |
63 | html_tag( 'td', _("First name") . ':', 'right', $color[4], 'width="50"' ) . |
64 | html_tag( 'td', '<input name="' . $name . '[firstname]" size="45" value="">', 'left', $color[4] ) |
65 | ) . "\n" . |
66 | html_tag( 'tr', "\n" . |
67 | html_tag( 'td', _("Last name") . ':', 'right', $color[4], 'width="50"' ) . |
68 | html_tag( 'td', '<input name="' . $name . '[lastname]" size="45" value="">', 'left', $color[4] ) |
69 | ) . "\n" . |
70 | html_tag( 'tr', "\n" . |
71 | html_tag( 'td', _("Additional info") . ':', 'right', $color[4], 'width="50"' ) . |
72 | html_tag( 'td', '<input name="' . $name . '[label]" size="45" value="">', 'left', $color[4] ) |
73 | ) . "\n" . |
74 | html_tag( 'tr', "\n" . |
75 | html_tag( 'td', |
76 | '<input type="submit" name="' . $name . '[SUBMIT]" size="45" value="'. _("Add address") .'">' , |
77 | 'center', $color[4], 'colspan="2"' ) |
78 | ) . "\n" . |
79 | '</table>'; |
e8b140ab |
80 | ?> |
4cf43843 |
81 | </form></body> |
82 | </html> |