| 1 | <?php |
| 2 | /** |
| 3 | * webmail.php -- Displays the main frameset |
| 4 | * |
| 5 | * This file generates the main frameset. The files that are |
| 6 | * shown can be given as parameters. If the user is not logged in |
| 7 | * this file will verify username and password. |
| 8 | * |
| 9 | * @copyright © 1999-2006 The SquirrelMail Project Team |
| 10 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 11 | * @version $Id$ |
| 12 | * @package squirrelmail |
| 13 | */ |
| 14 | |
| 15 | /** |
| 16 | * Include the SquirrelMail initialization file. |
| 17 | */ |
| 18 | require('../include/init.php'); |
| 19 | |
| 20 | if (sqgetGlobalVar('sort', $sort)) { |
| 21 | $sort = (int) $sort; |
| 22 | } |
| 23 | |
| 24 | if (sqgetGlobalVar('startMessage', $startMessage)) { |
| 25 | $startMessage = (int) $startMessage; |
| 26 | } |
| 27 | |
| 28 | if (!sqgetGlobalVar('mailbox', $mailbox)) { |
| 29 | $mailbox = 'INBOX'; |
| 30 | } |
| 31 | |
| 32 | sqgetGlobalVar('right_frame', $right_frame, SQ_GET); |
| 33 | |
| 34 | if(!sqgetGlobalVar('mailtodata', $mailtodata)) { |
| 35 | $mailtourl = 'mailtodata='.urlencode($mailtodata); |
| 36 | } else { |
| 37 | $mailtourl = ''; |
| 38 | } |
| 39 | |
| 40 | // Determine the size of the left frame |
| 41 | $left_size = getPref($data_dir, $username, 'left_size'); |
| 42 | if ($left_size == "") { |
| 43 | if (isset($default_left_size)) { |
| 44 | $left_size = $default_left_size; |
| 45 | } |
| 46 | else { |
| 47 | $left_size = 200; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | // Determine where the navigation frame should be |
| 52 | $location_of_bar = getPref($data_dir, $username, 'location_of_bar'); |
| 53 | if (isset($languages[$squirrelmail_language]['DIR']) && |
| 54 | strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') { |
| 55 | $temp_location_of_bar = 'right'; |
| 56 | } else { |
| 57 | $temp_location_of_bar = 'left'; |
| 58 | } |
| 59 | if ($location_of_bar == '') { |
| 60 | $location_of_bar = $temp_location_of_bar; |
| 61 | } |
| 62 | |
| 63 | // Determine the main frame URL |
| 64 | /* |
| 65 | * There are three ways to call webmail.php |
| 66 | * 1. webmail.php |
| 67 | * - This just loads the default entry screen. |
| 68 | * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX |
| 69 | * - This loads the frames starting at the given values. |
| 70 | * 3. webmail.php?right_frame=folders.php |
| 71 | * - Loads the frames with the Folder options in the right frame. |
| 72 | * |
| 73 | * This was done to create a pure HTML way of refreshing the folder list since |
| 74 | * we would like to use as little Javascript as possible. |
| 75 | * |
| 76 | * The test for // should catch any attempt to include off-site webpages into |
| 77 | * our frameset. |
| 78 | */ |
| 79 | if (empty($right_frame) || (strpos(urldecode($right_frame), '//') !== false)) { |
| 80 | $right_frame = ''; |
| 81 | } |
| 82 | if ( strpos($right_frame,'?') ) { |
| 83 | $right_frame_file = substr($right_frame,0,strpos($right_frame,'?')); |
| 84 | } else { |
| 85 | $right_frame_file = $right_frame; |
| 86 | } |
| 87 | switch($right_frame) { |
| 88 | case 'right_main.php': |
| 89 | $right_frame_url = "right_main.php?mailbox=".urlencode($mailbox) |
| 90 | . (!empty($sort)?"&sort=$sort":'') |
| 91 | . (!empty($startMessage)?"&startMessage=$startMessage":''); |
| 92 | break; |
| 93 | case 'options.php': |
| 94 | $right_frame_url = 'options.php'; |
| 95 | break; |
| 96 | case 'folders.php': |
| 97 | $right_frame_url = 'folders.php'; |
| 98 | break; |
| 99 | case 'compose.php': |
| 100 | $right_frame_url = 'compose.php?' . $mailtourl; |
| 101 | break; |
| 102 | case '': |
| 103 | $right_frame_url = 'right_main.php'; |
| 104 | break; |
| 105 | default: |
| 106 | $right_frame_url = urlencode($right_frame); |
| 107 | break; |
| 108 | } |
| 109 | |
| 110 | $oErrorHandler->setDelayedErrors(true); |
| 111 | |
| 112 | $oTemplate->assign('nav_size', $left_size); |
| 113 | $oTemplate->assign('nav_on_left', $location_of_bar=='left'); |
| 114 | $oTemplate->assign('right_frame_url', $right_frame_url); |
| 115 | |
| 116 | do_hook('webmail_top', $null); |
| 117 | |
| 118 | displayHtmlHeader($org_title, '', false, true); |
| 119 | |
| 120 | $oTemplate->display('webmail.tpl'); |
| 121 | |
| 122 | $oTemplate->display('footer.tpl'); |