6 * Functions for the Address Take plugin
8 * @copyright © 1999-2007 The SquirrelMail Project Team
9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
12 * @subpackage abook_take
16 function valid_email ($email, $verify)
18 global $Email_RegExp_Match;
20 if (! eregi('^' . $Email_RegExp_Match . '$', $email))
26 return checkdnsrr(substr(strstr($email, '@'), 1), 'ANY') ;
29 function abook_take_read_string($str)
31 global $abook_found_email, $Email_RegExp_Match;
33 while (eregi('(' . $Email_RegExp_Match . ')', $str, $hits))
35 $str = substr(strstr($str, $hits[0]), strlen($hits[0]));
36 if (! isset($abook_found_email[$hits[0]]))
38 echo addHidden('email[]', $hits[0]);
39 $abook_found_email[$hits[0]] = 1;
46 function abook_take_read_array($array)
48 foreach ($array as $item)
49 abook_take_read_string($item->getAddress());
52 function abook_take_read()
56 echo '<br />' . addForm(SM_PATH
. 'plugins/abook_take/take.php') .
57 '<div style="text-align: center;">' . "\n";
59 if (isset($message->rfc822_header
->reply_to
))
60 abook_take_read_array($message->rfc822_header
->reply_to
);
61 if (isset($message->rfc822_header
->from
))
62 abook_take_read_array($message->rfc822_header
->from
);
63 if (isset($message->rfc822_header
->cc
))
64 abook_take_read_array($message->rfc822_header
->cc
);
65 if (isset($message->rfc822_header
->to
))
66 abook_take_read_array($message->rfc822_header
->to
);
68 echo addSubmit(_("Take Address")) .
72 function abook_take_pref()
74 global $username, $data_dir, $abook_take_verify;
76 $abook_take_verify = getPref($data_dir, $username, 'abook_take_verify', false);
79 function abook_take_options()
81 global $abook_take_verify;
83 echo '<tr>' . html_tag('td',_("Address Book Take:"),'right','','style="white-space: nowrap;"') . "\n" . '<td>' .
84 addCheckbox('abook_take_abook_take_verify', $abook_take_verify) .
85 _("Try to verify addresses") . "</td></tr>\n";
88 function abook_take_save()
90 global $username, $data_dir;
92 if (sqgetGlobalVar('abook_take_abook_take_verify', $abook_take_abook_take_verify, SQ_POST
))
93 setPref($data_dir, $username, 'abook_take_verify', '1');
95 setPref($data_dir, $username, 'abook_take_verify', '');