squirrelmail-webmail  1.4.22
About: SquirrelMail is a standards-based webmail package with strong MIME support, address books, and folder manipulation (written in PHP4).
  Fossies Dox: squirrelmail-webmail-1.4.22.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

mailto.php
Go to the documentation of this file.
1 <?php
2 
37 define('PAGE_NAME', 'mailto');
38 
43 define('SM_PATH','../');
44 
45 /* SquirrelMail required files. */
46 require_once(SM_PATH . 'functions/global.php');
47 
48 
49 // Force users to login each time? Setting this to TRUE does NOT mean
50 // that if no user is logged in that it won't require a correct login
51 // first! Instead, setting it to TRUE will log out anyone currently
52 // logged in and force a re-login. Setting this to FALSE will still
53 // require a login if no one is logged in, but it will allow you to go
54 // directly to compose your message if you are already logged in.
55 //
56 // Note, however, that depending on how the client browser manages
57 // sessions and how the client operating system is set to handle
58 // mailto: links, you may have to log in every time no matter what
59 // (IE under WinXP appears to pop up a new window and thus always
60 // start a new session; Firefox under WinXP seems to start a new tab
61 // which will find a current login if one exists).
62 //
63 $force_login = FALSE;
64 
65 
66 // Open only the compose window, meaningless if $force_login is TRUE
67 //
68 $compose_only = FALSE;
69 
70 
71 // Disable Browser Caching
72 //
73 header('Cache-Control: no-cache, no-store, must-revalidate');
74 header('Pragma: no-cache');
75 header('Expires: Sat, 1 Jan 2000 00:00:00 GMT');
76 
77 $trtable = array('cc' => 'cc',
78  'bcc' => 'bcc',
79  'body' => 'body',
80  'subject' => 'subject');
81 $url = '';
82 
83 $data = array();
84 
85 if (sqgetGlobalVar('emailaddress', $emailaddress)) {
86  $emailaddress = trim($emailaddress);
87  if (stristr($emailaddress, 'mailto:')) {
88  $emailaddress = substr($emailaddress, 7);
89  }
90  if (strpos($emailaddress, '?') !== FALSE) {
91  list($emailaddress, $a) = explode('?', $emailaddress, 2);
92  if (strlen(trim($a)) > 0) {
93  $a = explode('=', $a, 2);
94  $data[strtolower($a[0])] = $a[1];
95  }
96  }
97  $data['to'] = $emailaddress;
98 
99  /* CC, BCC, etc could be any case, so we'll fix them here */
100  foreach($_GET as $k=>$g) {
101  $k = strtolower($k);
102  if (isset($trtable[$k])) {
103  $k = $trtable[$k];
104  $data[$k] = $g;
105  }
106  }
107 }
109 
110 if (!$force_login && sqsession_is_registered('user_is_logged_in')) {
111  if ($compose_only) {
112  $redirect = 'compose.php?mailtodata=' . urlencode(serialize($data));
113  } else {
114  $redirect = 'webmail.php?right_frame=compose.php&mailtodata=' . urlencode(serialize($data));
115  }
116 } else {
117  $redirect = 'login.php?mailtodata=' . urlencode(serialize($data));
118 }
119 
120 session_write_close();
121 header('Location: ' . get_location() . '/' . $redirect);
sqgetGlobalVar
sqgetGlobalVar($name, &$value, $search=SQ_INORDER)
Definition: global.php:344
$url
$url
Definition: mailto.php:81
$force_login
$force_login
Definition: mailto.php:63
$compose_only
$compose_only
Definition: mailto.php:68
$g
$g
Definition: darkness.php:104
sqsession_is_registered
sqsession_is_registered($name)
Definition: global.php:318
$trtable
$trtable
Definition: mailto.php:77
$data
$data
Definition: mailto.php:83
SM_PATH
const SM_PATH
Definition: mailto.php:43
sqsession_is_active
sqsession_is_active()
Definition: global.php:452
get_location
get_location()
Definition: strings.php:340