| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * webmail.php -- Displays the main frameset |
| 5 | * |
| 6 | * Copyright (c) 1999-2003 The SquirrelMail development team |
| 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | * |
| 9 | * This file generates the main frameset. The files that are |
| 10 | * shown can be given as parameters. If the user is not logged in |
| 11 | * this file will verify username and password. |
| 12 | * |
| 13 | * $Id$ |
| 14 | */ |
| 15 | |
| 16 | /* Path for SquirrelMail required files. */ |
| 17 | define('SM_PATH','../'); |
| 18 | |
| 19 | /* SquirrelMail required files. */ |
| 20 | require_once(SM_PATH . 'functions/strings.php'); |
| 21 | require_once(SM_PATH . 'config/config.php'); |
| 22 | require_once(SM_PATH . 'functions/prefs.php'); |
| 23 | require_once(SM_PATH . 'functions/imap.php'); |
| 24 | require_once(SM_PATH . 'functions/plugin.php'); |
| 25 | require_once(SM_PATH . 'functions/i18n.php'); |
| 26 | require_once(SM_PATH . 'functions/auth.php'); |
| 27 | require_once(SM_PATH . 'functions/global.php'); |
| 28 | |
| 29 | if (!function_exists('sqm_baseuri')){ |
| 30 | require_once(SM_PATH . 'functions/display_messages.php'); |
| 31 | } |
| 32 | $base_uri = sqm_baseuri(); |
| 33 | |
| 34 | session_start(); |
| 35 | |
| 36 | sqgetGlobalVar('username', $username, SQ_SESSION); |
| 37 | sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); |
| 38 | sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); |
| 39 | |
| 40 | sqgetGlobalVar('right_frame', $right_frame, SQ_GET); |
| 41 | |
| 42 | if ( isset($_SESSION['session_expired_post']) ) { |
| 43 | sqsession_unregister('session_expired_post'); |
| 44 | } |
| 45 | if(!sqgetGlobalVar('mailto', $mailto)) { |
| 46 | $mailto = ''; |
| 47 | } |
| 48 | |
| 49 | is_logged_in(); |
| 50 | |
| 51 | do_hook('webmail_top'); |
| 52 | |
| 53 | /** |
| 54 | * We'll need this to later have a noframes version |
| 55 | * |
| 56 | * Check if the user has a language preference, but no cookie. |
| 57 | * Send him a cookie with his language preference, if there is |
| 58 | * such discrepancy. |
| 59 | */ |
| 60 | $my_language = getPref($data_dir, $username, 'language'); |
| 61 | if ($my_language != $squirrelmail_language) { |
| 62 | setcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri); |
| 63 | } |
| 64 | |
| 65 | set_up_language(getPref($data_dir, $username, 'language')); |
| 66 | |
| 67 | echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">\n". |
| 68 | "<html><head>\n" . |
| 69 | "<title>$org_title</title>\n". |
| 70 | "</head>"; |
| 71 | |
| 72 | $left_size = getPref($data_dir, $username, 'left_size'); |
| 73 | $location_of_bar = getPref($data_dir, $username, 'location_of_bar'); |
| 74 | |
| 75 | if (isset($languages[$squirrelmail_language]['DIR']) && |
| 76 | strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') { |
| 77 | $temp_location_of_bar = 'right'; |
| 78 | } else { |
| 79 | $temp_location_of_bar = 'left'; |
| 80 | } |
| 81 | |
| 82 | if ($location_of_bar == '') { |
| 83 | $location_of_bar = $temp_location_of_bar; |
| 84 | } |
| 85 | $temp_location_of_bar = ''; |
| 86 | |
| 87 | if ($left_size == "") { |
| 88 | if (isset($default_left_size)) { |
| 89 | $left_size = $default_left_size; |
| 90 | } |
| 91 | else { |
| 92 | $left_size = 200; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | if ($location_of_bar == 'right') { |
| 97 | echo "<frameset cols=\"*, $left_size\" id=\"fs1\">\n"; |
| 98 | } |
| 99 | else { |
| 100 | echo "<frameset cols=\"$left_size, *\" id=\"fs1\">\n"; |
| 101 | } |
| 102 | |
| 103 | /* |
| 104 | * There are three ways to call webmail.php |
| 105 | * 1. webmail.php |
| 106 | * - This just loads the default entry screen. |
| 107 | * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX |
| 108 | * - This loads the frames starting at the given values. |
| 109 | * 3. webmail.php?right_frame=folders.php |
| 110 | * - Loads the frames with the Folder options in the right frame. |
| 111 | * |
| 112 | * This was done to create a pure HTML way of refreshing the folder list since |
| 113 | * we would like to use as little Javascript as possible. |
| 114 | */ |
| 115 | if (!isset($right_frame)) { |
| 116 | $right_frame = ''; |
| 117 | } |
| 118 | if ($right_frame == 'right_main.php') { |
| 119 | $urlMailbox = urlencode($mailbox); |
| 120 | $right_frame_url = |
| 121 | "right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage"; |
| 122 | } elseif ($right_frame == 'options.php') { |
| 123 | $right_frame_url = 'options.php'; |
| 124 | } elseif ($right_frame == 'folders.php') { |
| 125 | $right_frame_url = 'folders.php'; |
| 126 | } elseif ($right_frame == 'compose.php') { |
| 127 | $right_frame_url = 'compose.php?' . $mailto; |
| 128 | } else if ($right_frame == '') { |
| 129 | $right_frame_url = 'right_main.php'; |
| 130 | } else { |
| 131 | $right_frame_url = $right_frame; |
| 132 | } |
| 133 | |
| 134 | if ($location_of_bar == 'right') { |
| 135 | echo "<frame src=\"$right_frame_url\" name=\"right\" frameborder=\"1\" />\n" . |
| 136 | "<frame src=\"left_main.php\" name=\"left\" frameborder=\"1\" />\n"; |
| 137 | } |
| 138 | else { |
| 139 | echo "<frame src=\"left_main.php\" name=\"left\" frameborder=\"1\" />\n". |
| 140 | "<frame src=\"$right_frame_url\" name=\"right\" frameborder=\"1\" />\n"; |
| 141 | } |
| 142 | do_hook('webmail_bottom'); |
| 143 | ?> |
| 144 | </frameset> |
| 145 | </html> |