adding HTTPS status in subdomain view

This commit is contained in:
Benjamin Sonntag 2018-06-22 15:06:08 +02:00
parent be49630527
commit f7c05c5e23
3 changed files with 56 additions and 15 deletions

View File

@ -139,10 +139,11 @@ if ( ! empty($problems) ) {
?>
<table class="tlist" id="dom_edit_table">
<thead>
<tr><th colspan="2"> </th><th><?php __("Subdomain"); ?></th><th><?php __("Type");?></th><th><?php __("Status")?></th><th></th></tr>
<tr><th colspan="2"> </th><th><?php __("Subdomain"); ?></th><th><?php __("HTTPS"); ?></th><th><?php __("Type");?></th><th><?php __("Status")?></th><th></th></tr>
</thead>
<?php
$hasadvanced=false;
// this loop expect the table to be sorted with advanced entries AFTER normal ones :
for($i=0;$i<$r["nsub"];$i++) {
if ($r["sub"][$i]["advanced"] && !$hasadvanced) {
$hasadvanced=true;
@ -152,7 +153,7 @@ if ($r["sub"][$i]["advanced"] && !$hasadvanced) {
<p class="alert alert-warning"><?php __("The following entries are advanced ones, edit them at your own risks."); ?></p>
<table class="tlist" id="dom_edit_table">
<thead>
<tr><th colspan="2"> </th><th><?php __("Subdomain"); ?></th><th><?php __("Type");?></th><th><?php __("Status")?></th><th></th></tr>
<tr><th colspan="2"> </th><th><?php __("Subdomain"); ?></th><th><?php __("HTTPS"); ?></th><th><?php __("Type");?></th><th><?php __("Status")?></th><th></th></tr>
</thead>
<?php
@ -179,7 +180,27 @@ $disabled_class=in_array(strtoupper($r['sub'][$i]['enable']),array('DISABLED','D
</td>
<?php } // end IF ==DELETE ?>
<td><div class="retour-auto <?php echo $disabled_class; ?>"><a href="http://<?php echo $r["sub"][$i]["fqdn"] ?>" target="_blank"><?php echo $r["sub"][$i]["fqdn"]; ?></a></div></td>
<td><div class="retour-auto <?php echo $disabled_class; ?>"><?php if ($r['sub'][$i]['type_desc']) { __($r['sub'][$i]['type_desc']); } else { echo __("ERROR, please check your server setup"); } ?>
<td>
<?php
if (!$r["sub"][$i]["only_dns"]) {
switch ($r["sub"][$i]["https"]) {
case "http":
__("HTTP only");
break;
case "https":
__("HTTPS only");
break;
case "both":
__("HTTP and HTTPS");
break;
default:
__("Unknown");
break;
}
}
?>
</td>
<td><div class="retour-auto <?php echo $disabled_class; ?>"><?php if ($r['sub'][$i]['type_desc']) { __($r['sub'][$i]['type_desc']); } else { echo __("ERROR, please check your server setup"); } ?>
<?php
//if ($r["sub"][$i]['type'] === 'VHOST') {
if ( @$dt[$r["sub"][$i]['type']]['target'] === 'DIRECTORY') {

View File

@ -219,6 +219,25 @@ class DB_Sql {
return TRUE;
}
/* pdo equivalent of fetchAll() */
function fetchAll() {
if (!$this->pdo_query) {
$this->halt("next_record called with no query pending.");
return FALSE;
}
$data = $this->pdo_query->fetchAll(PDO::FETCH_BOTH);
$this->Errno = $this->pdo_query->errorCode();
$this->Error = $this->pdo_query->errorInfo();
if ($data == FALSE) {
if ($this->Auto_Free)
$this->free();
return FALSE;
}
return $data;
}
/**
* table locking

View File

@ -1159,6 +1159,7 @@ class m_dom {
* $r["sub"][0-(nsub-1)]["name"] = nom du sous-domaine (NON-complet)
* $r["sub"][0-(nsub-1)]["dest"] = Destination (url, ip, local ...)
* $r["sub"][0-(nsub-1)]["type"] = Type (0-n) de la redirection.
* $r["sub"][0-(nsub-1)]["https"] = is https properly enabled for this subdomain? (http/https/both)
* </pre>
* Retourne FALSE si une erreur s'est produite.
*
@ -1197,21 +1198,21 @@ class m_dom {
$r["nsub"] = $db->Record["cnt"];
$db->free();
#$db->query("SELECT sd.*, dt.description AS type_desc, dt.only_dns FROM sub_domaines sd, domaines_type dt WHERE compte='$cuid' AND domaine='$dom' AND UPPER(dt.name)=UPPER(sd.type) ORDER BY sd.sub,sd.type");
$db->query("SELECT sd.*, dt.description AS type_desc, dt.only_dns, dt.advanced FROM sub_domaines sd LEFT JOIN domaines_type dt on UPPER(dt.name)=UPPER(sd.type) WHERE compte= ? AND domaine= ? ORDER BY dt.advanced,sd.sub,sd.type ;", array($cuid, $dom));
$db->query("SELECT sd.*, dt.description AS type_desc, dt.only_dns, dt.advanced, dt.has_https_option FROM sub_domaines sd LEFT JOIN domaines_type dt on UPPER(dt.name)=UPPER(sd.type) WHERE compte= ? AND domaine= ? ORDER BY dt.advanced,sd.sub,sd.type ;", array($cuid, $dom));
// Pas de webmail, on le cochera si on le trouve.
$r["sub"] = array();
for ($i = 0; $i < $r["nsub"]; $i++) {
$db->next_record();
$data = $db->fetchAll();
foreach($data as $i=>$record) {
$r["sub"][$i] = array();
$r["sub"][$i]["id"] = $db->Record["id"];
$r["sub"][$i]["name"] = $db->Record["sub"];
$r["sub"][$i]["dest"] = $db->Record["valeur"];
$r["sub"][$i]["type"] = $db->Record["type"];
$r["sub"][$i]["enable"] = $db->Record["enable"];
$r["sub"][$i]["type_desc"] = $db->Record["type_desc"];
$r["sub"][$i]["only_dns"] = $db->Record["only_dns"];
$r["sub"][$i]["web_action"] = $db->Record["web_action"];
$r["sub"][$i]["advanced"] = $db->Record["advanced"];
$r["sub"][$i]["id"] = $record["id"];
$r["sub"][$i]["name"] = $record["sub"];
$r["sub"][$i]["dest"] = $record["valeur"];
$r["sub"][$i]["type"] = $record["type"];
$r["sub"][$i]["enable"] = $record["enable"];
$r["sub"][$i]["type_desc"] = $record["type_desc"];
$r["sub"][$i]["only_dns"] = $record["only_dns"];
$r["sub"][$i]["web_action"] = $record["web_action"];
$r["sub"][$i]["advanced"] = $record["advanced"];
$r["sub"][$i]["fqdn"] = ((!empty($r["sub"][$i]["name"])) ? $r["sub"][$i]["name"] . "." : "") . $r["name"];
}
$db->free();