Source for file mailto.php

Documentation is available at mailto.php

  1. <?php
  2.  
  3. /**
  4.  * mailto.php -- mailto: url handler
  5.  *
  6.  * This checks to see if we're logged in.  If we are we open up a new
  7.  * compose window for this email, otherwise we go to login.php
  8.  * (the above functionality has been disabled, by default you are required to
  9.  *  login first)
  10.  *
  11.  * Use the following url to use mailto:
  12.  * http://<your server>/<squirrelmail base dir>/src/mailto.php?emailaddress=%1
  13.  * see ../contrib/squirrelmail.mailto.reg for a Windows Registry file
  14.  * @copyright &copy; 1999-2006 The SquirrelMail Project Team
  15.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  16.  * @version $Id: mailto.php,v 1.11.2.4 2006/06/02 15:51:50 tokul Exp $
  17.  * @package squirrelmail
  18.  */
  19.  
  20. /**
  21.  * Path for SquirrelMail required files.
  22.  * @ignore
  23.  */
  24. define('SM_PATH','../');
  25.  
  26. /* SquirrelMail required files. */
  27. require_once(SM_PATH 'functions/global.php');
  28. require_once(SM_PATH 'functions/strings.php');
  29. require_once(SM_PATH 'config/config.php');
  30.  
  31. /* Force users to login each time? */
  32. $force_login  true;
  33. /* Open only the compose window, meaningless if $force_login is true */
  34. $compose_only false;
  35.  
  36. header('Pragma: no-cache');
  37.  
  38. $trtable array('cc'           => 'send_to_cc',
  39.                  'bcc'          => 'send_to_bcc',
  40.                  'body'         => 'body',
  41.                  'subject'      => 'subject');
  42. $url '';
  43.  
  44. if(sqgetGlobalVar('emailaddress'$emailaddress)) {
  45.     $emailaddress trim($emailaddress);
  46.     if(stristr($emailaddress'mailto:')) {
  47.         $emailaddress substr($emailaddress7);
  48.     }
  49.     if(strpos($emailaddress'?'!== false{
  50.         list($emailaddress$aexplode('?'$emailaddress2);
  51.         if(strlen(trim($a)) 0{
  52.             $a explode('='$a2);
  53.             $url .= $trtable[strtolower($a[0])'=' urlencode($a[1]'&';
  54.         }
  55.     }
  56.     $url 'send_to=' urlencode($emailaddress'&' $url;
  57.  
  58.     /* CC, BCC, etc could be any case, so we'll fix them here */
  59.     foreach($_GET as $k=>$g{
  60.         $k strtolower($k);
  61.         if(isset($trtable[$k])) {
  62.             $k $trtable[$k];
  63.             $url .= $k '=' urlencode($g'&';
  64.         }
  65.     }
  66.     $url substr($url0-1);
  67. }
  68.  
  69. if($force_login == false && sqsession_is_registered('user_is_logged_in')) {
  70.     if($compose_only == true{
  71.         $redirect 'compose.php?' $url;
  72.     else {
  73.         $redirect 'webmail.php?right_frame=compose.php?' urlencode($url);
  74.     }
  75. else {
  76.     $redirect 'login.php?mailto=' urlencode($url);
  77. }
  78.  
  79. header('Location: ' get_location('/' $redirect);
  80. ?>

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