From 70e61af67cdbaba986c0880c88fa96e8708bfef5 Mon Sep 17 00:00:00 2001 From: indiri69 Date: Tue, 11 May 2004 18:21:49 +0000 Subject: [PATCH] Move functions out of setup.php git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7436 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- plugins/abook_take/functions.php | 103 +++++++++++++++++++++++++++++++ plugins/abook_take/setup.php | 96 +++++----------------------- 2 files changed, 119 insertions(+), 80 deletions(-) create mode 100644 plugins/abook_take/functions.php diff --git a/plugins/abook_take/functions.php b/plugins/abook_take/functions.php new file mode 100644 index 00000000..6351cfb5 --- /dev/null +++ b/plugins/abook_take/functions.php @@ -0,0 +1,103 @@ +\n"; + $abook_found_email[$hits[0]] = 1; + } + } + + return; +} + +function abook_take_read_array($array) +{ + foreach ($array as $item) + abook_take_read_string($item->getAddress()); +} + +function abook_take_read() +{ + global $message; + + 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 '' . + '
'; +} + +function abook_take_pref() +{ + global $username, $data_dir, $abook_take_verify; + + $abook_take_verify = getPref($data_dir, $username, 'abook_take_verify'); +} + +function abook_take_options() +{ + global $abook_take_verify; + + echo '' . html_tag('td',_("Address Book Take:"),'right','','nowrap') . "\n" . + ' ' . _("Try to verify addresses") . "\n"; +} + +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', ''); +} + +?> diff --git a/plugins/abook_take/setup.php b/plugins/abook_take/setup.php index 9bee49c8..59783198 100755 --- a/plugins/abook_take/setup.php +++ b/plugins/abook_take/setup.php @@ -23,105 +23,41 @@ 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') ; + $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_string($str) -{ - global $abook_found_email, $Email_RegExp_Match; +function abook_take_read_body_bottom() { + include_once(SM_PATH . 'plugins/abook_take/functions.php'); - 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; + abook_take_read(); } -function abook_take_read_array($array) -{ - foreach ($array as $item) - abook_take_read_string($item->getAddress()); -} +function abook_take_loading_prefs() { + include_once(SM_PATH . 'plugins/abook_take/functions.php'); -function abook_take_read() -{ - global $message; - - 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 '' . - '
'; -} - -function abook_take_pref() -{ - global $username, $data_dir, $abook_take_verify; - - $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 '' . html_tag('td',_("Address Book Take:"),'right','','nowrap') . "\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(); } ?> -- 2.25.1