6 * Functions for the Address Take plugin
8 * @copyright © 1999-2006 The SquirrelMail Project Team
9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
12 * @subpackage abook_take
15 /** SquirrelMail required files. */
16 require_once(SM_PATH
. 'functions/url_parser.php');
17 require_once(SM_PATH
. 'functions/forms.php');
19 function valid_email ($email, $verify)
21 global $Email_RegExp_Match;
23 if (! eregi('^' . $Email_RegExp_Match . '$', $email))
29 return checkdnsrr(substr(strstr($email, '@'), 1), 'ANY') ;
32 function abook_take_read_string($str)
34 global $abook_found_email, $Email_RegExp_Match;
36 while (eregi('(' . $Email_RegExp_Match . ')', $str, $hits))
38 $str = substr(strstr($str, $hits[0]), strlen($hits[0]));
39 if (! isset($abook_found_email[$hits[0]]))
41 echo addHidden('email[]', $hits[0]);
42 $abook_found_email[$hits[0]] = 1;
49 function abook_take_read_array($array)
51 foreach ($array as $item)
52 abook_take_read_string($item->getAddress());
55 function abook_take_read()
59 echo '<br />' . addForm(SM_PATH
. 'plugins/abook_take/take.php') .
60 '<div style="text-align: center;">' . "\n";
62 if (isset($message->rfc822_header
->reply_to
))
63 abook_take_read_array($message->rfc822_header
->reply_to
);
64 if (isset($message->rfc822_header
->from
))
65 abook_take_read_array($message->rfc822_header
->from
);
66 if (isset($message->rfc822_header
->cc
))
67 abook_take_read_array($message->rfc822_header
->cc
);
68 if (isset($message->rfc822_header
->to
))
69 abook_take_read_array($message->rfc822_header
->to
);
71 echo addSubmit(_("Take Address")) .
75 function abook_take_pref()
77 global $username, $data_dir, $abook_take_verify;
79 $abook_take_verify = getPref($data_dir, $username, 'abook_take_verify', false);
82 function abook_take_options()
84 global $abook_take_verify;
86 echo '<tr>' . html_tag('td',_("Address Book Take:"),'right','','style="white-space: nowrap;"') . "\n" . '<td>' .
87 addCheckbox('abook_take_abook_take_verify', $abook_take_verify) .
88 _("Try to verify addresses") . "</td></tr>\n";
91 function abook_take_save()
93 global $username, $data_dir;
95 if (sqgetGlobalVar('abook_take_abook_take_verify', $abook_take_abook_take_verify, SQ_POST
))
96 setPref($data_dir, $username, 'abook_take_verify', '1');
98 setPref($data_dir, $username, 'abook_take_verify', '');