6 * Copyright (c) 1999-2004 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Functions for the Address Take plugin
13 * @subpackage abook_take
16 /** SquirrelMail required files. */
17 require_once(SM_PATH
. 'functions/url_parser.php');
18 require_once(SM_PATH
. 'functions/forms.php');
20 function valid_email ($email, $verify)
22 global $Email_RegExp_Match;
24 if (! eregi('^' . $Email_RegExp_Match . '$', $email))
30 return checkdnsrr(substr(strstr($email, '@'), 1), 'ANY') ;
33 function abook_take_read_string($str)
35 global $abook_found_email, $Email_RegExp_Match;
37 while (eregi('(' . $Email_RegExp_Match . ')', $str, $hits))
39 $str = substr(strstr($str, $hits[0]), strlen($hits[0]));
40 if (! isset($abook_found_email[$hits[0]]))
42 echo addHidden('email[]', $hits[0]);
43 $abook_found_email[$hits[0]] = 1;
50 function abook_take_read_array($array)
52 foreach ($array as $item)
53 abook_take_read_string($item->getAddress());
56 function abook_take_read()
60 echo '<br />' . addForm(SM_PATH
. 'plugins/abook_take/take.php') .
63 if (isset($message->rfc822_header
->reply_to
))
64 abook_take_read_array($message->rfc822_header
->reply_to
);
65 if (isset($message->rfc822_header
->from
))
66 abook_take_read_array($message->rfc822_header
->from
);
67 if (isset($message->rfc822_header
->cc
))
68 abook_take_read_array($message->rfc822_header
->cc
);
69 if (isset($message->rfc822_header
->to
))
70 abook_take_read_array($message->rfc822_header
->to
);
72 echo addSubmit(_("Take Address")) .
76 function abook_take_pref()
78 global $username, $data_dir, $abook_take_verify;
80 $abook_take_verify = getPref($data_dir, $username, 'abook_take_verify', false);
83 function abook_take_options()
85 global $abook_take_verify;
87 echo '<tr>' . html_tag('td',_("Address Book Take:"),'right','','nowrap') . "\n" . '<td>' .
88 addCheckbox('abook_take_abook_take_verify', $abook_take_verify) .
89 _("Try to verify addresses") . "</td></tr>\n";
92 function abook_take_save()
94 global $username, $data_dir;
96 if (sqgetGlobalVar('abook_take_abook_take_verify', $abook_take_abook_take_verify, SQ_POST
))
97 setPref($data_dir, $username, 'abook_take_verify', '1');
99 setPref($data_dir, $username, 'abook_take_verify', '');