Source for file mailto.php

Documentation is available at mailto.php

  1. <?php
  2. /**
  3. * mailto.php -- mailto: url handler
  4. *
  5. * This page facilitates handling mailto: links in SquirrelMail. It checks
  6. * to see if we're logged in, and if we are, it refers the user to the
  7. * compose screen (embedded in a normal, full SquirrelMail interface) with
  8. * the mailto: data auto-populated in the corresponding fields. If there
  9. * is no user currently logged in, the user is redirected to the login screen
  10. * first, but after login, the compose screen is shown with the correct
  11. * fields pre-populated.
  12. *
  13. * If the administrator desires, $compose_only can be set to TRUE, in which
  14. * case only a compose screen will show, not embedded in the normal
  15. * SquirrelMail interface.
  16. *
  17. * If the administrator wants to force a re-login every time a mailto: link
  18. * is clicked on (no matter if a user was already logged in), set $force_login
  19. * to TRUE.
  20. *
  21. * Use the following URI when configuring a computer to handle mailto: links
  22. * by using SquirrelMail:
  23. *
  24. * http://<your server>/<squirrelmail base dir>/src/mailto.php?emailaddress=%1
  25. *
  26. * see ../contrib/squirrelmail.mailto.NT2KXP.reg for a Windows Registry file
  27. * that will set this up in the most robust manner.
  28. *
  29. * @copyright 1999-2020 The SquirrelMail Project Team
  30. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  31. * @version $Id: mailto.php 14840 2020年01月07日 07:42:38Z pdontthink $
  32. * @package squirrelmail
  33. */
  34. /** This is the mailto page */
  35. define ('PAGE_NAME', 'mailto');
  36. /**
  37. * Path for SquirrelMail required files.
  38. * @ignore
  39. */
  40. define ('SM_PATH','../');
  41. /* SquirrelMail required files. */
  42. require_once(SM_PATH . 'functions/global.php');
  43. // Force users to login each time? Setting this to TRUE does NOT mean
  44. // that if no user is logged in that it won't require a correct login
  45. // first! Instead, setting it to TRUE will log out anyone currently
  46. // logged in and force a re-login. Setting this to FALSE will still
  47. // require a login if no one is logged in, but it will allow you to go
  48. // directly to compose your message if you are already logged in.
  49. //
  50. // Note, however, that depending on how the client browser manages
  51. // sessions and how the client operating system is set to handle
  52. // mailto: links, you may have to log in every time no matter what
  53. // (IE under WinXP appears to pop up a new window and thus always
  54. // start a new session; Firefox under WinXP seems to start a new tab
  55. // which will find a current login if one exists).
  56. //
  57. $force_login = FALSE;
  58. // Open only the compose window, meaningless if $force_login is TRUE
  59. //
  60. $compose_only = FALSE;
  61. // Disable Browser Caching
  62. //
  63. header ('Cache-Control: no-cache, no-store, must-revalidate');
  64. header ('Pragma: no-cache');
  65. header ('Expires: Sat, 1 Jan 2000 00:00:00 GMT');
  66. $trtable = array('cc' => 'cc',
  67. 'bcc' => 'bcc',
  68. 'body' => 'body',
  69. 'subject' => 'subject');
  70. $url = '';
  71. $data = array();
  72. if (sqgetGlobalVar ('emailaddress', $emailaddress)) {
  73. $emailaddress = trim ($emailaddress);
  74. if (stristr ($emailaddress, 'mailto:')) {
  75. $emailaddress = substr ($emailaddress, 7);
  76. }
  77. if (strpos ($emailaddress, '?') !== FALSE) {
  78. list($emailaddress, $a) = explode ('?', $emailaddress, 2);
  79. if (strlen (trim ($a)) > 0) {
  80. $a = explode ('=', $a, 2);
  81. $data[strtolower ($a[0])] = $a[1];
  82. }
  83. }
  84. $data['to'] = $emailaddress;
  85. /* CC, BCC, etc could be any case, so we'll fix them here */
  86. foreach($_GET as $k=>$g) {
  87. $k = strtolower ($k);
  88. if (isset($trtable[$k])) {
  89. $k = $trtable[$k];
  90. $data[$k] = $g;
  91. }
  92. }
  93. }
  94. if (!$force_login && sqsession_is_registered ('user_is_logged_in')) {
  95. if ($compose_only) {
  96. $redirect = 'compose.php?mailtodata=' . urlencode (serialize ($data));
  97. } else {
  98. $redirect = 'webmail.php?right_frame=compose.php&mailtodata=' . urlencode (serialize ($data));
  99. }
  100. } else {
  101. $redirect = 'login.php?mailtodata=' . urlencode (serialize ($data));
  102. }
  103. header ('Location: ' . get_location () . '/' . $redirect);

Documentation generated on 2020年1月13日 04:24:55 +0100 by phpDocumentor 1.4.3

AltStyle によって変換されたページ (->オリジナル) /