6351cfb520f1e129e3064a15c695504fecab31e2
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');
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 '<input type="hidden" name="email[]" value="' .
42 htmlspecialchars($hits[0]) . "\" />\n";
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 /><form action="../plugins/abook_take/take.php" method="post"><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 '<input type="submit" value="' . _("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');
82 function abook_take_options()
84 global $abook_take_verify;
86 echo '<tr>' . html_tag('td',_("Address Book Take:"),'right','','nowrap') . "\n" .
87 '<td><input name="abook_take_abook_take_verify" type="checkbox"';
88 if (isset($abook_take_verify) && $abook_take_verify)
90 echo ' /> ' . _("Try to verify addresses") . "</td></tr>\n";
93 function abook_take_save()
95 global $username, $data_dir;
97 if (sqgetGlobalVar('abook_take_abook_take_verify', $abook_take_abook_take_verify, SQ_POST
))
98 setPref($data_dir, $username, 'abook_take_verify', '1');
100 setPref($data_dir, $username, 'abook_take_verify', '');