Time to stop coding for tonight. Making this kind of terrible bugs is bad.
[squirrelmail.git] / plugins / abook_take / take.php
CommitLineData
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. */
11define('SM_PATH','../../');
e8b140ab 12
08185f2a 13/* SquirrelMail required files. */
14require_once(SM_PATH . 'config/config.php');
aa7fb30c 15require_once(SM_PATH . 'include/validate.php');
08185f2a 16require_once(SM_PATH . 'functions/strings.php');
17require_once(SM_PATH . 'config/config.php');
18require_once(SM_PATH . 'functions/i18n.php');
19require_once(SM_PATH . 'functions/page_header.php');
20require_once(SM_PATH . 'functions/addressbook.php');
aa7fb30c 21require_once(SM_PATH . 'include/load_prefs.php');
08185f2a 22require_once(SM_PATH . 'functions/html.php');
23
24displayPageHeader($color, 'None');
25
26$abook_take_verify = getPref($data_dir, $username, 'abook_take_verify');
4cf43843 27
28$abook = addressbook_init(false, true);
29$name = 'addaddr';
30echo '<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";
e8b140ab 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 }
d55c0f66 55 else
56 {
57 echo '<option value="' . htmlspecialchars($Val) .
58 '">FAIL - ' . htmlspecialchars($Val) . "</option>\n";
59 }
e8b140ab 60 }
4cf43843 61 echo '</select></td></tr>' . "\n" .
e8b140ab 62
4cf43843 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>';
e8b140ab 81?>
4cf43843 82</form></body>
83</html>