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