Marius Cramer
2015-08-06 37b29231e47a0c4458dc1c15d98588f16f07e1e2
commit | author | age
cf8190 1 <?php
V 2 /*
3 Copyright (c) 2008, Till Brehm, projektfarm Gmbh
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without modification,
7 are permitted provided that the following conditions are met:
8
9     * Redistributions of source code must retain the above copyright notice,
10       this list of conditions and the following disclaimer.
11     * Redistributions in binary form must reproduce the above copyright notice,
12       this list of conditions and the following disclaimer in the documentation
13       and/or other materials provided with the distribution.
14     * Neither the name of ISPConfig nor the names of its contributors
15       may be used to endorse or promote products derived from this software without
16       specific prior written permission.
17
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30
b1a6a5 31 require_once '../../lib/config.inc.php';
MC 32 require_once '../../lib/app.inc.php';
cf8190 33
V 34 //* Check permissions for module
6338aa 35 $app->auth->check_module_permissions('mail');
cf8190 36
V 37 /* get the id of the mail (must be int!) */
38 if (!isset($_GET['id'])){
b1a6a5 39     die ("No E-Mail selected!");
cf8190 40 }
65ea2e 41 $emailId = $app->functions->intval($_GET['id']);
cf8190 42
V 43 /*
44  * Get the data to connect to the database
45  */
cc7a82 46 $dbData = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = ?", $emailId);
65ea2e 47 $serverId = $app->functions->intval($dbData['server_id']);
cf8190 48 if ($serverId == 0){
b1a6a5 49     die ("No E-Mail - Server found!");
cf8190 50 }
V 51
cc7a82 52 $serverData = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ?", $serverId);
f92de2 53
T 54 $app->uses('getconf');
55 $global_config = $app->getconf->get_global_config('mail');
56
57 if($global_config['webmail_url'] != '') {
615a0a 58     $webmail_url = $global_config['webmail_url'];
T 59     $webmail_url = str_replace('[SERVERNAME]', $serverData['server_name'], $webmail_url);
60     header('Location:' . $webmail_url);
f92de2 61 } else {
cf8190 62
b1a6a5 63     /*
cf8190 64  * We only redirect to the login-form, so there is no need, to check any rights
V 65  */
f92de2 66     isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
615a0a 67     if($web_config['server_type'] == 'nginx') {
T 68         header('Location: http://' . $serverData['server_name'] . ':8081/webmail');
69     } else {
70         header('Location: ' . $http . '://' . $serverData['server_name'] . '/webmail');
71     }
72     isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
f92de2 73 }
cf8190 74 exit;
b1a6a5 75 ?>