Skip to content

Commit cf8190f

Browse files
author
vogelor
committed
The user can now "jump" to the webmailer and to phpmyadmin direct from within the corresponding list.
1 parent 267bfe6 commit cf8190f

File tree

5 files changed

+73
-35
lines changed

5 files changed

+73
-35
lines changed

interface/web/mail/mail_user_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function onSubmit() {
131131
$app->tform->errorMessage .= $app->tform->wordbook["error_no_pwd"]."<br>";
132132
}
133133

134-
// Ccheck the client limits, if user is not the admin
134+
// Check the client limits, if user is not the admin
135135
if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
136136
// Get the limits of the client
137137
$client_group_id = $_SESSION["s"]["user"]["default_group"];

interface/web/mail/templates/mail_user_list.htm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ <h2><tmpl_var name="list_head_txt"></h2>
3434
<td class="tbl_col_autoresponder"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="autoresponder"}</a></td>
3535
<td class="tbl_col_buttons">
3636
<div class="buttons icons16">
37+
<a class="icons16 icoWebmailer" href="mail/webmailer.php?id={tmpl_var name='id'}" target="webmail"><span>{tmpl_var name='delete_txt'}</span></a>
3738
<a class="icons16 icoDelete" href="javascript: del_record('mail/mail_user_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
3839
</div>
3940
</td>

interface/web/mail/webmailer.php

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
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+
31+
require_once('../../lib/config.inc.php');
32+
require_once('../../lib/app.inc.php');
33+
34+
//* Check permissions for module
35+
$app->auth->check_module_permissions('sites');
36+
37+
/* get the id of the mail (must be int!) */
38+
if (!isset($_GET['id'])){
39+
die ("No E-Mail selected!");
40+
}
41+
$emailId = intval($_GET['id']);
42+
43+
/*
44+
* Get the data to connect to the database
45+
*/
46+
$dbData = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = " . $emailId);
47+
$serverId = intval($dbData['server_id']);
48+
if ($serverId == 0){
49+
die ("No E-Mail - Server found!");
50+
}
51+
52+
$serverData = $app->db->queryOneRecord(
53+
"SELECT server_name FROM server WHERE server_id = " .
54+
$serverId);
55+
56+
/*
57+
* We only redirect to the login-form, so there is no need, to check any rights
58+
*/
59+
isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
60+
header('location:' . $http . '://' . $serverData['server_name'] . '/webmail');
61+
exit;
62+
?>

interface/web/sites/database_phpmyadmin.php

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
//* Check permissions for module
3535
$app->auth->check_module_permissions('sites');
3636

37-
/* get the id of the database (must be int!) */
37+
/*
38+
* get the id of the database (must be int!)
39+
*/
3840
if (!isset($_GET['id'])){
3941
die ("No DB selected!");
4042
}
@@ -43,48 +45,20 @@
4345
/*
4446
* Get the data to connect to the database
4547
*/
46-
$dbData = $app->db->queryOneRecord(
47-
"SELECT sys_userid, sys_groupid, sys_perm_user, sys_perm_group, server_id, database_name, database_user, database_password FROM web_database WHERE database_id = " .
48-
$databaseId);
49-
50-
/*
51-
* We also need the data of the server
52-
*/
48+
$dbData = $app->db->queryOneRecord("SELECT server_id FROM web_database WHERE database_id = " . $databaseId);
5349
$serverId = intval($dbData['server_id']);
5450
if ($serverId == 0){
5551
die ("No DB-Server found!");
5652
}
57-
5853
$serverData = $app->db->queryOneRecord(
5954
"SELECT server_name FROM server WHERE server_id = " .
6055
$serverId);
6156

6257
/*
63-
* Check if the user has the right to open phpmyadmin with this database
64-
* (we will check only users, not admins)
65-
*/
66-
if($_SESSION["s"]["user"]["typ"] == 'user') {
67-
/* Get the group of the client */
68-
$client_group_id = intval($_SESSION["s"]["user"]["default_group"]);
69-
/* compare both */
70-
if ($dbData['sys_groupid'] != $client_group_id){
71-
die ("You don't have the right to access this db!");
72-
}
73-
}
74-
75-
/*
76-
* Now generate the login-Form
58+
* We only redirect to the login-form, so there is no need, to check any rights
7759
*/
7860
isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
79-
echo '
80-
starting phpMyAdmin...<br>
81-
<form method="post" action="' . $http . '://' . $serverData['server_name'] . '/phpmyadmin/index.php" name="login_form" target="_top" style="visibility:hidden">
82-
<input type="text" name="pma_username" id="input_username" value="' . $dbData['database_user'] . '" />
83-
<input type="password" name="pma_password" id="input_password" value="' . $dbData['database_password'] . '" size="24" class="textfield" />
84-
</form>
85-
<script type="text/javascript" language="javascript">
86-
<!--
87-
document.forms["login_form"].submit();
88-
//-->
89-
</script>';
61+
header('location:' . $http . '://' . $serverData['server_name'] . '/phpmyadmin');
62+
exit;
63+
9064
?>

interface/web/themes/default/css/screen/content_ispc.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,5 +289,6 @@
289289
.icons16.icoEdit { background-image: url("../../icons/x16/wrench.png"); }
290290
.icons16.icoDbAdmin { background-image: url("../../icons/x16/database.png"); }
291291
.icons16.icoLoginAs { background-image: url("../../icons/x16/user_go.png"); }
292+
.icons16.icoWebmailer { background-image: url("../../icons/x16/mails_arrow.png"); }
292293
}
293294

0 commit comments

Comments
 (0)