X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Fabook_take%2Fsetup.php;h=f135f467db7ab997a088fa67a5f17f756efd8d5e;hb=cc201b463e7d240bd4656795e5a3f0af14fb05c8;hp=9bdb840950a6f86c9150e2f8ee9c2243f7c4829d;hpb=b755a6b10b48829e0ba137ad77ac47b9da4a2a10;p=squirrelmail.git diff --git a/plugins/abook_take/setup.php b/plugins/abook_take/setup.php index 9bdb8409..f135f467 100755 --- a/plugins/abook_take/setup.php +++ b/plugins/abook_take/setup.php @@ -3,116 +3,51 @@ /** * setup.php * - * Copyright (c) 1999-2003 The SquirrelMail Project Team - * Licensed under the GNU GPL. For full terms see the file COPYING. - * * Address Take -- steals addresses from incoming email messages. Searches * the To, Cc, From and Reply-To headers, also searches the body of the * message. * - * $Id$ + * @copyright © 1999-2007 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package plugins + * @subpackage abook_take */ -if (!defined('SM_PATH')) { - define('SM_PATH','../../'); -} - -/* SquirrelMail required files. */ -require_once(SM_PATH . 'functions/url_parser.php'); +/** + * Initialize the plugin + */ function squirrelmail_plugin_init_abook_take() { global $squirrelmail_plugin_hooks; - - $squirrelmail_plugin_hooks['read_body_bottom']['abook_take'] = 'abook_take_read'; - $squirrelmail_plugin_hooks['loading_prefs']['abook_take'] = 'abook_take_pref'; - $squirrelmail_plugin_hooks['options_display_inside']['abook_take'] = 'abook_take_options'; - $squirrelmail_plugin_hooks['options_display_save']['abook_take'] = 'abook_take_save'; -} - -function valid_email ($email, $verify) -{ - global $Email_RegExp_Match; - - if (! eregi('^' . $Email_RegExp_Match . '$', $email)) - return false; - - if (! $verify) - return true; - - return checkdnsrr(substr(strstr($email, '@'), 1), 'ANY') ; -} - -function abook_take_read_string($str) -{ - global $abook_found_email, $Email_RegExp_Match; - - while (eregi('(' . $Email_RegExp_Match . ')', $str, $hits)) - { - $str = substr(strstr($str, $hits[0]), strlen($hits[0])); - if (! isset($abook_found_email[$hits[0]])) - { - echo '\n"; - $abook_found_email[$hits[0]] = 1; - } - } - - return; -} -function abook_take_read_array($array) -{ - foreach ($array as $item) - abook_take_read_string($item->getAddress()); + $squirrelmail_plugin_hooks['read_body_bottom']['abook_take'] = 'abook_take_read_body_bottom'; + $squirrelmail_plugin_hooks['loading_prefs']['abook_take'] = 'abook_take_loading_prefs'; + $squirrelmail_plugin_hooks['options_display_inside']['abook_take'] = 'abook_take_options_display_inside'; + $squirrelmail_plugin_hooks['options_display_save']['abook_take'] = 'abook_take_options_display_save'; } -function abook_take_read() -{ - global $message; +function abook_take_read_body_bottom() { + include_once(SM_PATH . 'plugins/abook_take/functions.php'); - echo '
'."\n"; - - if (isset($message->rfc822_header->reply_to)) - abook_take_read_array($message->rfc822_header->reply_to); - if (isset($message->rfc822_header->from)) - abook_take_read_array($message->rfc822_header->from); - if (isset($message->rfc822_header->cc)) - abook_take_read_array($message->rfc822_header->cc); - if (isset($message->rfc822_header->to)) - abook_take_read_array($message->rfc822_header->to); - - echo '' . - '
'; + abook_take_read(); } -function abook_take_pref() -{ - global $username, $data_dir, $abook_take_verify; +function abook_take_loading_prefs() { + include_once(SM_PATH . 'plugins/abook_take/functions.php'); - $abook_take_verify = getPref($data_dir, $username, 'abook_take_verify'); + abook_take_pref(); } -function abook_take_options() -{ - global $abook_take_verify; +function abook_take_options_display_inside() { + include_once(SM_PATH . 'plugins/abook_take/functions.php'); - echo '' . _("Address Book Take:") . "\n" . - ' ' . _("Try to verify addresses") . "\n"; + abook_take_options(); } +function abook_take_options_display_save() { + include_once(SM_PATH . 'plugins/abook_take/functions.php'); -function abook_take_save() -{ - global $username, $data_dir; - - if (sqgetGlobalVar('abook_take_abook_take_verify', $abook_take_abook_take_verify, SQ_POST)) - setPref($data_dir, $username, 'abook_take_verify', '1'); - else - setPref($data_dir, $username, 'abook_take_verify', ''); + abook_take_save(); } - -?>