updated/moved plugin from plugins/abook_take to squirrelmail/plugins/abook_take
[squirrelmail.git] / plugins / abook_take / take.php
CommitLineData
e8b140ab 1<?php /* Modified at 6 places by ri_once */ ?>
2<?php
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 session_start();
11
12 if(!isset($username)) {
13 echo "You need a valid user and password to access this page!";
14 exit;
15 }
16
17 chdir("..");
18 if (!isset($config_php))
19 /* '_once' Added by ri_once */ include_once("../config/config.php");
20 if (!isset($i18n_php))
21 /* '_once' Added by ri_once */ include_once("../functions/i18n.php");
22 if (!isset($page_header_php))
23 /* '_once' Added by ri_once */ include_once("../functions/page_header.php");
24 if (!isset($addressbook_php))
25 /* '_once' Added by ri_once */ include_once("../functions/addressbook.php");
26 if (!isset($strings_php))
27 /* '_once' Added by ri_once */ include_once("../functions/strings.php");
28
29 /* '_once' Added by ri_once */ include_once("../src/load_prefs.php");
30
31 displayPageHeader($color, "None");
32
33 $abook_take_verify = getPref($data_dir, $username, 'abook_take_verify');
34
35?>
36<FORM ACTION="../../src/addressbook.php" NAME=f_add METHOD="POST">
37<TABLE WIDTH=100% COLS=1 ALIGN=CENTER>
38<TR><TH BGCOLOR="<?PHP
39 echo $color[0];
40?>" ALIGN=CENTER><?PHP
41 // open address book, trash errors, skip LDAP
42 $abook = addressbook_init(false, true);
43 printf(_("Add to %s"), $abook->localbackendname);
44?></TH></TR>
45</TABLE>
46<TABLE BORDER=0 CELLPADDING=1 COLS=2 WIDTH="90%" ALIGN=center>
47<?PHP
48 $name = 'addaddr';
49
50 printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
51 _("Nickname"));
52 printf("<TD BGCOLOR=\"%s\" ALIGN=left>".
53 "<INPUT NAME=\"%s[nickname]\" SIZE=15 VALUE=\"\">".
54 "&nbsp;<SMALL>%s</SMALL></TD></TR>\n",
55 $color[4], $name, _("Must be unique"));
56 printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
57 _("E-mail address"));
58
59 echo "<TD BGCOLOR=\"$color[4]\" ALIGN=left>\n";
60 echo '<select name="' . $name . "[email]\">\n";
61 foreach ($email as $Val)
62 {
63 if (valid_email($Val, $abook_take_verify))
64 {
65 echo '<option value="' . htmlspecialchars($Val) .
66 '">' . htmlspecialchars($Val) . "</option>\n";
67 }
68 }
69 echo "</select>\n";
70
71 printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
72 _("First name"));
73 printf("<TD BGCOLOR=\"%s\" ALIGN=left>".
74 "<INPUT NAME=\"%s[firstname]\" SIZE=45 VALUE=\"\"></TD></TR>\n",
75 $color[4], $name);
76 printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
77 _("Last name"));
78 printf("<TD BGCOLOR=\"%s\" ALIGN=left>".
79 "<INPUT NAME=\"%s[lastname]\" SIZE=45 VALUE=\"\"></TD></TR>\n",
80 $color[4], $name);
81 printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
82 _("Additional info"));
83 printf("<TD BGCOLOR=\"%s\" ALIGN=left>".
84 "<INPUT NAME=\"%s[label]\" SIZE=45 VALUE=\"\"></TD></TR>\n",
85 $color[4], $name);
86
87 printf("<TR><TD COLSPAN=2 BGCOLOR=\"%s\" ALIGN=center>\n".
88 "<INPUT TYPE=submit NAME=\"%s[SUBMIT]\" VALUE=\"%s\"></TD></TR>\n",
89 $color[4], $name, _("Add address"));
90
91 print "</TABLE>\n";
92?>
93</FORM></BODY>
94</HTML>