| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * webmail.php -- Displays the main frameset |
| 5 | * |
| 6 | * This file generates the main frameset. The files that are |
| 7 | * shown can be given as parameters. If the user is not logged in |
| 8 | * this file will verify username and password. |
| 9 | * |
| 10 | * @copyright © 1999-2006 The SquirrelMail Project Team |
| 11 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 12 | * @version $Id$ |
| 13 | * @package squirrelmail |
| 14 | */ |
| 15 | |
| 16 | /** |
| 17 | * Include the SquirrelMail initialization file. |
| 18 | */ |
| 19 | require('../include/init.php'); |
| 20 | |
| 21 | sqgetGlobalVar('username', $username, SQ_SESSION); |
| 22 | sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); |
| 23 | sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); |
| 24 | |
| 25 | if (sqgetGlobalVar('sort', $sort)) { |
| 26 | $sort = (int) $sort; |
| 27 | } |
| 28 | |
| 29 | if (sqgetGlobalVar('startMessage', $startMessage)) { |
| 30 | $startMessage = (int) $startMessage; |
| 31 | } |
| 32 | |
| 33 | if (!sqgetGlobalVar('mailbox', $mailbox)) { |
| 34 | $mailbox = 'INBOX'; |
| 35 | } |
| 36 | |
| 37 | sqgetGlobalVar('right_frame', $right_frame, SQ_GET); |
| 38 | |
| 39 | if ( isset($_SESSION['session_expired_post']) ) { |
| 40 | sqsession_unregister('session_expired_post'); |
| 41 | } |
| 42 | if(!sqgetGlobalVar('mailto', $mailto)) { |
| 43 | $mailto = ''; |
| 44 | } |
| 45 | |
| 46 | do_hook('webmail_top'); |
| 47 | |
| 48 | $output = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\n". |
| 49 | " \"http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd\">\n". |
| 50 | "<html><head>\n" . |
| 51 | "<meta name=\"robots\" content=\"noindex,nofollow\">\n" . |
| 52 | "<title>$org_title</title>\n". |
| 53 | "</head>"; |
| 54 | |
| 55 | $left_size = getPref($data_dir, $username, 'left_size'); |
| 56 | $location_of_bar = getPref($data_dir, $username, 'location_of_bar'); |
| 57 | |
| 58 | if (isset($languages[$squirrelmail_language]['DIR']) && |
| 59 | strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') { |
| 60 | $temp_location_of_bar = 'right'; |
| 61 | } else { |
| 62 | $temp_location_of_bar = 'left'; |
| 63 | } |
| 64 | |
| 65 | if ($location_of_bar == '') { |
| 66 | $location_of_bar = $temp_location_of_bar; |
| 67 | } |
| 68 | $temp_location_of_bar = ''; |
| 69 | |
| 70 | if ($left_size == "") { |
| 71 | if (isset($default_left_size)) { |
| 72 | $left_size = $default_left_size; |
| 73 | } |
| 74 | else { |
| 75 | $left_size = 200; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | if ($location_of_bar == 'right') { |
| 80 | $output .= "<frameset cols=\"*, $left_size\" id=\"fs1\">\n"; |
| 81 | } |
| 82 | else { |
| 83 | $output .= "<frameset cols=\"$left_size, *\" id=\"fs1\">\n"; |
| 84 | } |
| 85 | |
| 86 | /* |
| 87 | * There are three ways to call webmail.php |
| 88 | * 1. webmail.php |
| 89 | * - This just loads the default entry screen. |
| 90 | * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX |
| 91 | * - This loads the frames starting at the given values. |
| 92 | * 3. webmail.php?right_frame=folders.php |
| 93 | * - Loads the frames with the Folder options in the right frame. |
| 94 | * |
| 95 | * This was done to create a pure HTML way of refreshing the folder list since |
| 96 | * we would like to use as little Javascript as possible. |
| 97 | * |
| 98 | * The test for // should catch any attempt to include off-site webpages into |
| 99 | * our frameset. |
| 100 | */ |
| 101 | |
| 102 | if (empty($right_frame) || (strpos(urldecode($right_frame), '//') !== false)) { |
| 103 | $right_frame = ''; |
| 104 | } |
| 105 | |
| 106 | if ( strpos($right_frame,'?') ) { |
| 107 | $right_frame_file = substr($right_frame,0,strpos($right_frame,'?')); |
| 108 | } else { |
| 109 | $right_frame_file = $right_frame; |
| 110 | } |
| 111 | |
| 112 | switch($right_frame) { |
| 113 | case 'right_main.php': |
| 114 | $right_frame_url = "right_main.php?mailbox=".urlencode($mailbox) |
| 115 | . (!empty($sort)?"&sort=$sort":'') |
| 116 | . (!empty($startMessage)?"&startMessage=$startMessage":''); |
| 117 | break; |
| 118 | case 'options.php': |
| 119 | $right_frame_url = 'options.php'; |
| 120 | break; |
| 121 | case 'folders.php': |
| 122 | $right_frame_url = 'folders.php'; |
| 123 | break; |
| 124 | case 'compose.php': |
| 125 | $right_frame_url = 'compose.php?' . $mailto; |
| 126 | break; |
| 127 | case '': |
| 128 | $right_frame_url = 'right_main.php'; |
| 129 | break; |
| 130 | default: |
| 131 | $right_frame_url = urlencode($right_frame); |
| 132 | break; |
| 133 | } |
| 134 | |
| 135 | $left_frame = '<frame src="left_main.php" name="left" frameborder="1" title="'. |
| 136 | _("Folder List") ."\" />\n"; |
| 137 | $right_frame = '<frame src="'.$right_frame_url.'" name="right" frameborder="1" title="'. |
| 138 | _("Message List") ."\" />\n"; |
| 139 | |
| 140 | if ($location_of_bar == 'right') { |
| 141 | $output .= $right_frame . $left_frame; |
| 142 | } |
| 143 | else { |
| 144 | $output .= $left_frame . $right_frame; |
| 145 | } |
| 146 | $ret = concat_hook_function('webmail_bottom', $output); |
| 147 | if($ret != '') { |
| 148 | $output = $ret; |
| 149 | } |
| 150 | |
| 151 | echo $output . '</frameset>'; |
| 152 | |
| 153 | $oTemplate->display('footer.tpl'); |