| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * take.php |
| 5 | * |
| 6 | * Copyright (c) 1999-2004 The SquirrelMail Project Team |
| 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | * |
| 9 | * Address Take -- steals addresses from incoming email messages. Searches |
| 10 | * the To, Cc, From and Reply-To headers. |
| 11 | * |
| 12 | * $Id$ |
| 13 | * @package plugins |
| 14 | * @subpackage abook_take |
| 15 | */ |
| 16 | |
| 17 | /** |
| 18 | * Path for SquirrelMail required files. |
| 19 | * @ignore */ |
| 20 | define('SM_PATH','../../'); |
| 21 | |
| 22 | /* SquirrelMail required files. */ |
| 23 | require_once(SM_PATH . 'include/validate.php'); |
| 24 | require_once(SM_PATH . 'functions/strings.php'); |
| 25 | require_once(SM_PATH . 'config/config.php'); |
| 26 | require_once(SM_PATH . 'functions/i18n.php'); |
| 27 | require_once(SM_PATH . 'functions/page_header.php'); |
| 28 | require_once(SM_PATH . 'functions/addressbook.php'); |
| 29 | require_once(SM_PATH . 'include/load_prefs.php'); |
| 30 | require_once(SM_PATH . 'functions/html.php'); |
| 31 | require_once(SM_PATH . 'functions/forms.php'); |
| 32 | |
| 33 | displayPageHeader($color, 'None'); |
| 34 | |
| 35 | /* input form data */ |
| 36 | sqgetGlobalVar('email', $email, SQ_POST); |
| 37 | |
| 38 | $abook_take_verify = getPref($data_dir, $username, 'abook_take_verify'); |
| 39 | |
| 40 | $abook = addressbook_init(false, true); |
| 41 | $name = 'addaddr'; |
| 42 | |
| 43 | $addrs = array(); |
| 44 | foreach ($email as $Val) { |
| 45 | if (valid_email($Val, $abook_take_verify)) { |
| 46 | $addrs[$Val] = $Val; |
| 47 | } else { |
| 48 | $addrs[$Val] = 'FAIL - ' . $Val; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | echo addForm(SM_PATH . 'src/addressbook.php', 'POST', 'f_add') . "\n" . |
| 53 | html_tag( 'table', |
| 54 | html_tag( 'tr', |
| 55 | html_tag( 'th', sprintf(_("Add to %s"), $abook->localbackendname), 'center', $color[0] ) |
| 56 | ) , |
| 57 | 'center', '', 'width="100%"' ) . "\n" . |
| 58 | |
| 59 | html_tag( 'table', '', 'center', '', 'border="0" cellpadding="1" cols="2" width="90%"' ) . "\n" . |
| 60 | html_tag( 'tr', "\n" . |
| 61 | html_tag( 'td', _("Nickname") . ':', 'right', $color[4], 'width="50"' ) . "\n" . |
| 62 | html_tag( 'td', addInput($name . '[nickname]', '', 15) . |
| 63 | ' <small>' . _("Must be unique") . '</small>', |
| 64 | 'left', $color[4] ) |
| 65 | ) . "\n" . |
| 66 | html_tag( 'tr' ) . "\n" . |
| 67 | html_tag( 'td', _("E-mail address") . ':', 'right', $color[4], 'width="50"' ) . "\n" . |
| 68 | html_tag( 'td', '', 'left', $color[4] ) . "\n" . |
| 69 | addSelect($name . '[email]', $addrs, null, true) . |
| 70 | '</td></tr>' . "\n"; |
| 71 | |
| 72 | if ($squirrelmail_language == 'ja_JP') { |
| 73 | echo html_tag( 'tr', "\n" . |
| 74 | html_tag( 'td', _("Last name") . ':', 'right', $color[4], 'width="50"' ) . |
| 75 | html_tag( 'td', addInput($name . '[lastname]', '', 45), 'left', $color[4] ) |
| 76 | ) . "\n" . |
| 77 | html_tag( 'tr', "\n" . |
| 78 | html_tag( 'td', _("First name") . ':', 'right', $color[4], 'width="50"' ) . |
| 79 | html_tag( 'td', addInput($name . '[firstname]', '', 45), 'left', $color[4] ) |
| 80 | ) . "\n"; |
| 81 | } else { |
| 82 | echo html_tag( 'tr', "\n" . |
| 83 | html_tag( 'td', _("First name") . ':', 'right', $color[4], 'width="50"' ) . |
| 84 | html_tag( 'td', addInput($name . '[firstname]', '', 45), 'left', $color[4] ) |
| 85 | ) . "\n" . |
| 86 | html_tag( 'tr', "\n" . |
| 87 | html_tag( 'td', _("Last name") . ':', 'right', $color[4], 'width="50"' ) . |
| 88 | html_tag( 'td', addInput($name . '[lastname]', '', 45), 'left', $color[4] ) |
| 89 | ) . "\n"; |
| 90 | } |
| 91 | echo html_tag( 'tr', "\n" . |
| 92 | html_tag( 'td', _("Additional info") . ':', 'right', $color[4], 'width="50"' ) . |
| 93 | html_tag( 'td', addInput($name . '[label]', '', 45), 'left', $color[4] ) |
| 94 | ) . "\n" . |
| 95 | html_tag( 'tr', "\n" . |
| 96 | html_tag( 'td', |
| 97 | addSubmit(_("Add address"), $name . '[SUBMIT]'), |
| 98 | 'center', $color[4], 'colspan="2"' ) |
| 99 | ) . "\n"; |
| 100 | ?> |
| 101 | </table> |
| 102 | </form></body> |
| 103 | </html> |