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)  

webmail.php
Go to the documentation of this file.
1 <?php
2 
17 define('PAGE_NAME', 'webmail');
18 
23 define('SM_PATH','../');
24 
25 /* SquirrelMail required files. */
26 require_once(SM_PATH . 'include/validate.php');
27 require_once(SM_PATH . 'functions/imap.php');
28 
29 sqgetGlobalVar('username', $username, SQ_SESSION);
30 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
31 sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
32 sqgetGlobalVar('right_frame', $right_frame, SQ_GET);
33 if (sqgetGlobalVar('sort', $sort)) {
34  $sort = (int) $sort;
35 }
36 
37 if (sqgetGlobalVar('startMessage', $startMessage)) {
38  $startMessage = (int) $startMessage;
39 }
40 
41 if (!sqgetGlobalVar('mailbox', $mailbox)) {
42  $mailbox = 'INBOX';
43 }
44 
45 if(sqgetGlobalVar('mailtodata', $mailtodata)) {
46  $mailtourl = 'mailtodata='.urlencode($mailtodata);
47 } else {
48  $mailtourl = '';
49 }
50 
51 // this value may be changed by a plugin, but initialize
52 // it first to avoid register_globals headaches
53 //
55 do_hook('webmail_top');
56 
66  sqsetcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri);
67 }
68 
70 
71 $output = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">\n".
72  "<html><head>\n" .
73  "<meta name=\"robots\" content=\"noindex,nofollow\">\n" .
74  "<title>$org_title</title>\n".
75  "</head>";
76 
79 
80 if (isset($languages[$squirrelmail_language]['DIR']) &&
81  strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
82  $temp_location_of_bar = 'right';
83 } else {
84  $temp_location_of_bar = 'left';
85 }
86 
87 if ($location_of_bar == '') {
89 }
91 
92 if ($left_size == "") {
93  if (isset($default_left_size)) {
95  }
96  else {
97  $left_size = 200;
98  }
99 }
100 
101 if ($location_of_bar == 'right') {
102  $output .= "<frameset cols=\"*, $left_size\" id=\"fs1\">\n";
103 }
104 else {
105  $output .= "<frameset cols=\"$left_size, *\" id=\"fs1\">\n";
106 }
107 
108 /*
109  * There are three ways to call webmail.php
110  * 1. webmail.php
111  * - This just loads the default entry screen.
112  * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
113  * - This loads the frames starting at the given values.
114  * 3. webmail.php?right_frame=folders.php
115  * - Loads the frames with the Folder options in the right frame.
116  *
117  * This was done to create a pure HTML way of refreshing the folder list since
118  * we would like to use as little Javascript as possible.
119  *
120  * The test for // should catch any attempt to include off-site webpages into
121  * our frameset.
122  *
123  * Note that plugins are allowed to completely and freely override the URI
124  * used for the "right" (content) frame, and they do so by modifying the
125  * global variable $right_frame_url.
126  *
127  */
128 
129 if (empty($right_frame) || (strpos(urldecode($right_frame), '//') !== false)) {
130  $right_frame = '';
131 }
132 
133 if ( strpos($right_frame,'?') ) {
134  $right_frame_file = substr($right_frame,0,strpos($right_frame,'?'));
135 } else {
136  $right_frame_file = $right_frame;
137 }
138 
139 if (empty($right_frame_url)) {
140  switch($right_frame_file) {
141  case 'right_main.php':
142  $right_frame_url = "right_main.php?mailbox=".urlencode($mailbox)
143  . (!empty($sort)?"&amp;sort=$sort":'')
144  . (!empty($startMessage)?"&amp;startMessage=$startMessage":'');
145  break;
146  case 'options.php':
147  $right_frame_url = 'options.php';
148  break;
149  case 'folders.php':
150  $right_frame_url = 'folders.php';
151  break;
152  case 'compose.php':
153  $right_frame_url = 'compose.php?' . $mailtourl;
154  break;
155  case '':
156  $right_frame_url = 'right_main.php';
157  break;
158  default:
159  $right_frame_url = urlencode($right_frame);
160  break;
161  }
162 }
163 
164 if ($location_of_bar == 'right') {
165  $output .= "<frame src=\"$right_frame_url\" name=\"right\" frameborder=\"1\">\n" .
166  "<frame src=\"left_main.php\" name=\"left\" frameborder=\"1\">\n";
167 }
168 else {
169  $output .= "<frame src=\"left_main.php\" name=\"left\" frameborder=\"1\">\n".
170  "<frame src=\"$right_frame_url\" name=\"right\" frameborder=\"1\">\n";
171 }
172 $ret = concat_hook_function('webmail_bottom', $output);
173 if($ret != '') {
174  $output = $ret;
175 }
176 echo $output;
177 ?>
178 </frameset>
179 </html>
sqgetGlobalVar
sqgetGlobalVar($name, &$value, $search=SQ_INORDER)
Definition: global.php:344
$ret
$ret
Definition: webmail.php:172
getPref
getPref($data_dir, $username, $string, $default='')
Definition: db_prefs.php:316
$right_frame_url
$right_frame_url
Definition: webmail.php:54
$data_dir
$data_dir
Definition: config_default.php:499
SQ_SESSION
const SQ_SESSION
Definition: global.php:18
$mailbox
$mailbox
Definition: options.php:28
concat_hook_function
concat_hook_function($name, $parm=NULL)
Definition: plugin.php:96
html
Definition: html.class.php:18
$username
global $username
Definition: validate.php:55
do_hook
do_hook($name)
Definition: plugin.php:42
$sort
$sort
Definition: load_prefs.php:170
$temp_location_of_bar
if($location_of_bar=='') $temp_location_of_bar
Definition: webmail.php:90
$output
$output
Definition: webmail.php:71
set_up_language
set_up_language($sm_language, $do_search=false, $default=false)
Definition: i18n.php:330
$languages
global $languages
Definition: i18n.php:774
SQ_GET
const SQ_GET
Definition: global.php:16
sqsetcookie
sqsetcookie($sName, $sValue='deleted', $iExpire=0, $sPath="", $sDomain="", $bSecure=false, $bHttpOnly=true, $bReplace=false)
Definition: global.php:509
$base_uri
if(!(bool) ini_get('session.use_cookies')||ini_get('session.use_cookies')=='off') $base_uri
Definition: global.php:173
$location_of_bar
$location_of_bar
Definition: webmail.php:78
$my_language
$my_language
Definition: webmail.php:64
$squirrelmail_language
global $squirrelmail_language
Definition: i18n.php:774
SM_PATH
const SM_PATH
Definition: webmail.php:23
$left_size
$left_size
Definition: webmail.php:77
$default_left_size
$default_left_size
Definition: config_default.php:539