upgraded to version 1.4 and debugged
[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");
e8b140ab 17
18 displayPageHeader($color, "None");
19
20 $abook_take_verify = getPref($data_dir, $username, 'abook_take_verify');
21
22?>
23<FORM ACTION="../../src/addressbook.php" NAME=f_add METHOD="POST">
24<TABLE WIDTH=100% COLS=1 ALIGN=CENTER>
25<TR><TH BGCOLOR="<?PHP
26 echo $color[0];
27?>" ALIGN=CENTER><?PHP
28 // open address book, trash errors, skip LDAP
29 $abook = addressbook_init(false, true);
30 printf(_("Add to %s"), $abook->localbackendname);
31?></TH></TR>
32</TABLE>
33<TABLE BORDER=0 CELLPADDING=1 COLS=2 WIDTH="90%" ALIGN=center>
34<?PHP
35 $name = 'addaddr';
36
37 printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
38 _("Nickname"));
39 printf("<TD BGCOLOR=\"%s\" ALIGN=left>".
40 "<INPUT NAME=\"%s[nickname]\" SIZE=15 VALUE=\"\">".
41 "&nbsp;<SMALL>%s</SMALL></TD></TR>\n",
42 $color[4], $name, _("Must be unique"));
43 printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
44 _("E-mail address"));
45
46 echo "<TD BGCOLOR=\"$color[4]\" ALIGN=left>\n";
47 echo '<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 }
d55c0f66 55 else
56 {
57 echo '<option value="' . htmlspecialchars($Val) .
58 '">FAIL - ' . htmlspecialchars($Val) . "</option>\n";
59 }
e8b140ab 60 }
61 echo "</select>\n";
62
63 printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
64 _("First name"));
65 printf("<TD BGCOLOR=\"%s\" ALIGN=left>".
66 "<INPUT NAME=\"%s[firstname]\" SIZE=45 VALUE=\"\"></TD></TR>\n",
67 $color[4], $name);
68 printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
69 _("Last name"));
70 printf("<TD BGCOLOR=\"%s\" ALIGN=left>".
71 "<INPUT NAME=\"%s[lastname]\" SIZE=45 VALUE=\"\"></TD></TR>\n",
72 $color[4], $name);
73 printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
74 _("Additional info"));
75 printf("<TD BGCOLOR=\"%s\" ALIGN=left>".
76 "<INPUT NAME=\"%s[label]\" SIZE=45 VALUE=\"\"></TD></TR>\n",
77 $color[4], $name);
78
79 printf("<TR><TD COLSPAN=2 BGCOLOR=\"%s\" ALIGN=center>\n".
80 "<INPUT TYPE=submit NAME=\"%s[SUBMIT]\" VALUE=\"%s\"></TD></TR>\n",
81 $color[4], $name, _("Add address"));
82
83 print "</TABLE>\n";
84?>
85</FORM></BODY>
86</HTML>