Source for file setup.php

Documentation is available at setup.php

  1. <?php
  2.  
  3. /**
  4.  * setup.php
  5.  *
  6.  * Copyright (c) 1999-2006 The SquirrelMail Project Team
  7.  * Licensed under the GNU GPL. For full terms see the file COPYING.
  8.  *
  9.  * Address Take -- steals addresses from incoming email messages. Searches
  10.  * the To, Cc, From and Reply-To headers, also searches the body of the
  11.  * message.
  12.  *
  13.  * $Id: setup.php,v 1.8.2.5 2006/02/03 22:27:51 jervfors Exp $
  14.  */
  15.  
  16. if (!defined('SM_PATH'))  {
  17.     define('SM_PATH','../../');
  18. }
  19.  
  20. /* SquirrelMail required files. */
  21. require_once(SM_PATH 'functions/url_parser.php');
  22.  
  23. {
  24.     global $squirrelmail_plugin_hooks;
  25.   
  26.     $squirrelmail_plugin_hooks['read_body_bottom']['abook_take''abook_take_read';
  27.     $squirrelmail_plugin_hooks['loading_prefs']['abook_take''abook_take_pref';
  28.     $squirrelmail_plugin_hooks['options_display_inside']['abook_take''abook_take_options';
  29.     $squirrelmail_plugin_hooks['options_display_save']['abook_take''abook_take_save';
  30. }
  31.  
  32. function valid_email ($email$verify)
  33. {
  34.     global $Email_RegExp_Match;
  35.   
  36.     if (eregi('^' $Email_RegExp_Match '$'$email))
  37.         return false;
  38.     
  39.     if ($verify)
  40.         return true;
  41.  
  42.     return checkdnsrr(substr(strstr($email'@')1)'ANY';
  43. }
  44.  
  45. function abook_take_read_string($str)
  46. {
  47.     global $abook_found_email$Email_RegExp_Match;
  48.  
  49.     while (eregi('(' $Email_RegExp_Match ')'$str$hits))
  50.     {
  51.         $str substr(strstr($str$hits[0])strlen($hits[0]));
  52.         if (isset($abook_found_email[$hits[0]]))
  53.         {
  54.             echo '<input type="hidden" name="email[]" value="' .
  55.                  htmlspecialchars($hits[0]"\" />\n";
  56.             $abook_found_email[$hits[0]] 1;
  57.         }
  58.     }
  59.  
  60.     return;
  61. }
  62.  
  63. function abook_take_read_array($array)
  64. {
  65.     foreach ($array as $item)
  66.         abook_take_read_string($item->getAddress());
  67. }
  68.  
  69. function abook_take_read()
  70. {
  71.     global $message;
  72.  
  73.     echo '<br /><form action="../plugins/abook_take/take.php" method="post"><center>'."\n";
  74.  
  75.     if (isset($message->rfc822_header->reply_to))
  76.         abook_take_read_array($message->rfc822_header->reply_to);
  77.     if (isset($message->rfc822_header->from))
  78.         abook_take_read_array($message->rfc822_header->from);
  79.     if (isset($message->rfc822_header->cc))
  80.         abook_take_read_array($message->rfc822_header->cc);
  81.     if (isset($message->rfc822_header->to))
  82.         abook_take_read_array($message->rfc822_header->to);
  83.  
  84.     echo '<input type="submit" value="' _("Take Address"'" />' .
  85.          '</center></form>';
  86. }
  87.  
  88. function abook_take_pref()
  89.     global $username$data_dir$abook_take_verify;
  90.  
  91.     $abook_take_verify getPref($data_dir$username'abook_take_verify');
  92. }
  93.  
  94. function abook_take_options()
  95. {
  96.     global $abook_take_verify;
  97.  
  98.     echo '<tr>' html_tag('td',_("Address Book Take:"),'right','','nowrap'"\n" .
  99.          '<td><input name="abook_take_abook_take_verify" type="checkbox"';
  100.     if (isset($abook_take_verify&& $abook_take_verify)
  101.     echo ' checked';
  102.     echo ' /> ' _("Try to verify addresses""</td></tr>\n";
  103. }
  104.  
  105.  
  106. function abook_take_save()
  107. {
  108.     global $username$data_dir;
  109.   
  110.     if (sqgetGlobalVar('abook_take_abook_take_verify'$abook_take_abook_take_verifySQ_POST)) 
  111.         setPref($data_dir$username'abook_take_verify''1');
  112.     else 
  113.         setPref($data_dir$username'abook_take_verify''');
  114. }
  115.  
  116. ?>

Documentation generated on Sat, 07 Oct 2006 16:33:29 +0300 by phpDocumentor 1.3.0RC6