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