Skip to content

Commit edbad4a

Browse files
author
Kristan Kenney
committed
Enable phpMyAdmin/phpPgAdmin buttons if installed
1 parent 470136f commit edbad4a

File tree

2 files changed

+26
-42
lines changed

2 files changed

+26
-42
lines changed

web/templates/admin/list_db.html

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,24 @@
33
<div class="l-unit-toolbar__buttonstrip">
44
<a href="/add/db/" id="btn-create" class="ui-button cancel" dir="ltr"><i class="fas fa-plus-circle status-icon green"></i><?=_('Add Database')?></a>
55
<?
6-
$mysql = 0;
7-
$pgsql = 0;
8-
96
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
107

11-
foreach ($data as $key => $value) {
12-
if ($data[$key]['TYPE'] == 'mysql'){
13-
$mysql = 1;
14-
$db_myadmin_link = "//".$http_host."/phpmyadmin/";
15-
if (!empty($_SESSION['DB_PMA_ALIAS']))
16-
$db_myadmin_link = "//".$http_host."/".$_SESSION['DB_PMA_ALIAS'];
17-
}
18-
if ($data[$key]['TYPE'] == 'pgsql'){
19-
$pgsql = 1;
20-
$db_pgadmin_link = "//".$http_host."/phppgadmin/";
21-
if (!empty($_SESSION['DB_PGA_ALIAS']))
22-
$db_pgadmin_link = "//".$http_host."/".$_SESSION['DB_PGA_ALIAS'];
23-
}
24-
}
25-
if($mysql){
26-
echo '<a class="ui-button cancel" dir="ltr" href="'.$db_myadmin_link.'" target="_blank"><i class="fas fa-database status-icon orange"></i>phpMyAdmin</a>';
8+
$db_myadmin_link = "//".$http_host."/phpmyadmin/";
9+
$db_pgadmin_link = "//".$http_host."/phppgadmin/";
10+
11+
if (!empty($_SESSION['DB_PMA_ALIAS'])) {
12+
$db_myadmin_link = "//".$http_host."/".$_SESSION['DB_PMA_ALIAS']."/";
2713
}
28-
if($pgsql){
29-
echo '<a class="ui-button cancel" dir="ltr" href="'.$db_pgadmin_link.'" target="_blank"><i class="fas fa-database status-icon orange"></i>phpPgAdmin</a>';
14+
if (!empty($_SESSION['DB_PGA_ALIAS'])) {
15+
$db_pgadmin_link = "//".$http_host."/".$_SESSION['DB_PGA_ALIAS']."/";
3016
}
3117
?>
18+
<? if (($_SESSION['DB_SYSTEM'] === 'mysql') || ($_SESSION['DB_SYSTEM'] === 'mysql,pgsql') || ($_SESSION['DB_SYSTEM'] === 'pgsql,mysql')) {?>
19+
<a class="ui-button cancel" dir="ltr" href="<?php echo $db_myadmin_link; ?>" target="_blank"><i class="fas fa-database status-icon orange"></i>phpMyAdmin</a>
20+
<? } ?>
21+
<? if (($_SESSION['DB_SYSTEM'] === 'pgsql') || ($_SESSION['DB_SYSTEM'] === 'mysql,pgsql') || ($_SESSION['DB_SYSTEM'] === 'pgsql,mysql')) {?>
22+
<a class="ui-button cancel" dir="ltr" href="<?php echo $db_pgadmin_link; ?>" target="_blank"><i class="fas fa-database status-icon orange"></i>phpPgAdmin</a>
23+
<? } ?>
3224
</div>
3325
<ul class="context-menu sort-order animated fadeIn" style="display:none;">
3426
<li entity="sort-date" sort_as_int="1"><span class="name active"><?=_('Date')?> <i class="fas fa-sort-amount-down"></i></span><span class="up"><i class="fas fa-sort-amount-up"></i></span></li>

web/templates/user/list_db.html

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,24 @@
33
<div class="l-unit-toolbar__buttonstrip">
44
<a href="/add/db/" id="btn-create" class="ui-button cancel" dir="ltr"><i class="fas fa-plus-circle status-icon green"></i><?=_('Add Database')?></a>
55
<?
6-
$mysql = 0;
7-
$pgsql = 0;
8-
96
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
107

11-
foreach ($data as $key => $value) {
12-
if ($data[$key]['TYPE'] == 'mysql'){
13-
$mysql = 1;
14-
$db_myadmin_link = "//".$http_host."/phpmyadmin/";
15-
if (!empty($_SESSION['DB_PMA_ALIAS']))
16-
$db_myadmin_link = "//".$http_host."/".$_SESSION['DB_PMA_ALIAS'];
17-
}
18-
if ($data[$key]['TYPE'] == 'pgsql'){
19-
$pgsql = 1;
20-
$db_pgadmin_link = "//".$http_host."/phppgadmin/";
21-
if (!empty($_SESSION['DB_PGA_ALIAS']))
22-
$db_pgadmin_link = "//".$http_host."/".$_SESSION['DB_PGA_ALIAS'];
23-
}
24-
}
25-
if($mysql){
26-
echo '<a class="ui-button cancel" dir="ltr" href="'.$db_myadmin_link.'" target="_blank"><i class="fas fa-database status-icon orange"></i>phpMyAdmin</a>';
8+
$db_myadmin_link = "//".$http_host."/phpmyadmin/";
9+
$db_pgadmin_link = "//".$http_host."/phppgadmin/";
10+
11+
if (!empty($_SESSION['DB_PMA_ALIAS'])) {
12+
$db_myadmin_link = "//".$http_host."/".$_SESSION['DB_PMA_ALIAS']."/";
2713
}
28-
if($pgsql){
29-
echo '<a class="ui-button cancel" dir="ltr" href="'.$db_pgadmin_link.'" target="_blank"><i class="fas fa-database status-icon orange"></i>phpPgAdmin</a>';
14+
if (!empty($_SESSION['DB_PGA_ALIAS'])) {
15+
$db_pgadmin_link = "//".$http_host."/".$_SESSION['DB_PGA_ALIAS']."/";
3016
}
3117
?>
18+
<? if (($_SESSION['DB_SYSTEM'] === 'mysql') || ($_SESSION['DB_SYSTEM'] === 'mysql,pgsql') || ($_SESSION['DB_SYSTEM'] === 'pgsql,mysql')) {?>
19+
<a class="ui-button cancel" dir="ltr" href="<?php echo $db_myadmin_link; ?>" target="_blank"><i class="fas fa-database status-icon orange"></i>phpMyAdmin</a>
20+
<? } ?>
21+
<? if (($_SESSION['DB_SYSTEM'] === 'pgsql') || ($_SESSION['DB_SYSTEM'] === 'mysql,pgsql') || ($_SESSION['DB_SYSTEM'] === 'pgsql,mysql')) {?>
22+
<a class="ui-button cancel" dir="ltr" href="<?php echo $db_pgadmin_link; ?>" target="_blank"><i class="fas fa-database status-icon orange"></i>phpPgAdmin</a>
23+
<? } ?>
3224
</div>
3325
<ul class="context-menu sort-order animated fadeIn" style="display:none;">
3426
<li entity="sort-date" sort_as_int="1"><span class="name active"><?=_('Date')?> <i class="fas fa-sort-amount-down"></i></span><span class="up"><i class="fas fa-sort-amount-up"></i></span></li>

0 commit comments

Comments
 (0)