[enh] adding HTTP/HTTPS/BOTH UI in the subdomain editor.
This commit is contained in:
parent
6ba6a40d05
commit
09bb693480
|
@ -50,7 +50,7 @@ $dom->unlock();
|
|||
|
||||
<form action="dom_subdoedit.php" method="post" name="main" id="main">
|
||||
<?php csrf_get(); ?>
|
||||
<table border="0">
|
||||
<table class="dom-edit-table">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="hidden" name="domain" value="<?php ehe($domain) ?>" />
|
||||
|
@ -64,6 +64,7 @@ $dom->unlock();
|
|||
}
|
||||
?></td><td>
|
||||
<input type="text" class="int" name="sub" style="text-align:right" value="<?php ehe($sub); ?>" size="22" id="sub" /><span class="int" id="newsubname">.<?php ehe($domain); ?></span></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$first_advanced=true;
|
||||
|
@ -81,10 +82,8 @@ $dom->unlock();
|
|||
$lst_advanced[]=$dt['name'];
|
||||
if ($first_advanced) {
|
||||
$first_advanced=false;
|
||||
echo "<tr><td colspan=\"2\" class=\"advdom\"></td></tr>";
|
||||
echo "<tr id='domtype_show' onClick=\"domtype_advanced_show();\"><td colspan='2'><a href=\"javascript:domtype_advanced_show();\"><b>+ "; __("Show advanced options"); echo "</b></a></td></tr>";
|
||||
echo "<tr id='domtype_hide' onClick=\"domtype_advanced_hide();\" style='display:none'><td colspan='2'><a href=\"javascript:domtype_advanced_hide();\"><b>- "; __("Hide advanced options"); echo "</b></a></td></tr>";
|
||||
echo "<tr><td colspan=\"2\" class=\"advdom\"></td></tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -126,6 +125,16 @@ $dom->unlock();
|
|||
break;
|
||||
} // switch ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($dt['has_https_option']) { ?>
|
||||
|
||||
<select class="inl" name="https_<?php ehe($dt['name']); ?>" id="https_<?php ehe($dt['name']); ?>">
|
||||
<option value="http"<?php selected((strtoupper($type)==strtoupper($dt['name']) && $sd["https"]=="http") || false); ?>><?php __("HTTP Only (redirect HTTPS to HTTP)"); ?></option>
|
||||
<option value="https"<?php selected((strtoupper($type)==strtoupper($dt['name']) && $sd["https"]=="http") || true); ?>><?php __("HTTPS Only (redirect HTTP to HTTPS)"); ?></option>
|
||||
<option value="both"<?php selected((strtoupper($type)==strtoupper($dt['name']) && $sd["https"]=="http") || false); ?>><?php __("Both HTTP and HTTPS hosted at the same place"); ?></option>
|
||||
</select>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } // foreach ?>
|
||||
|
||||
|
|
|
@ -35,11 +35,14 @@ getFields($fields);
|
|||
|
||||
// here we get a dynamic-named value
|
||||
$dynamicvar="t_$type";
|
||||
$httpsvar="https_$type";
|
||||
$fields = array (
|
||||
"$dynamicvar" => array ("post", "string", ""),
|
||||
"$httpsvar" => array ("post", "string", ""),
|
||||
);
|
||||
getFields($fields);
|
||||
$value=$$dynamicvar;
|
||||
$https=$$httpsvar;
|
||||
// The dynamic value is now in $value
|
||||
|
||||
$dom->lock();
|
||||
|
@ -52,7 +55,7 @@ if ( (!isset($isinvited) || !$isinvited) && $dt[strtolower($type)]["enable"] !=
|
|||
}
|
||||
|
||||
if (empty($sub_domain_id)) $sub_domain_id=null;
|
||||
$r=$dom->set_sub_domain($domain,$sub,$type,$value, $sub_domain_id);
|
||||
$r=$dom->set_sub_domain($domain, $sub, $type, $value, $sub_domain_id, $https);
|
||||
|
||||
$dom->unlock();
|
||||
|
||||
|
|
|
@ -205,21 +205,15 @@ div.ui-accordion-content > ul {
|
|||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
select {
|
||||
border: 1px solid #999;
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
|
||||
font-size: 13px;
|
||||
color: black;
|
||||
background: white;
|
||||
text-transform: lowercase;
|
||||
}
|
||||
|
||||
.inc, .inl {
|
||||
border: 1px solid #999;
|
||||
select, .inc, .inl {
|
||||
border: 1px solid #ccc;
|
||||
border-top-left-radius: 0px;
|
||||
border-bottom-left-radius: 0px;
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
|
||||
font-size: 13px;
|
||||
color: black;
|
||||
background: white;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
#inp1 {
|
||||
|
@ -242,7 +236,7 @@ p > input#file + br + .inb, p > input#file + br + .inb + .inb {
|
|||
input.inb, input.ina{
|
||||
color: black;
|
||||
white-space: nowrap;
|
||||
border: 1px solid #999;
|
||||
border: 1px solid black;
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
|
||||
font-size: 14px;
|
||||
padding: 4px 10px 4px 0px;
|
||||
|
@ -256,7 +250,7 @@ input.inb, input.ina{
|
|||
}
|
||||
|
||||
input.inb:hover, input.ina:hover {
|
||||
border: 1px solid #999;
|
||||
border: 1px solid black;
|
||||
text-decoration: none;
|
||||
background-color: #F0F0F0;
|
||||
}
|
||||
|
@ -336,7 +330,7 @@ input.ui-state-hover {
|
|||
|
||||
input.ina, input.inav,
|
||||
input.ina:hover, input.inav:hover {
|
||||
border: 1px solid #999;
|
||||
border: 1px solid black;
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
|
||||
font-size: 14px;
|
||||
color: black;
|
||||
|
@ -361,7 +355,7 @@ input.ina:hover, .ina a:hover, .inb a:hover {
|
|||
.ina a, a.ina, .inb a, a.inb,.inav a, a.inav {
|
||||
color: black;
|
||||
white-space: nowrap;
|
||||
border: 1px solid #999;
|
||||
border: 1px solid black;
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
|
||||
font-size: 14px;
|
||||
padding: 4px 10px;
|
||||
|
@ -416,7 +410,7 @@ span#newsubname {
|
|||
float: left;
|
||||
}
|
||||
.bff {
|
||||
border: 1px solid #999;
|
||||
border: 1px solid black;
|
||||
background-color: #F0F0F0;
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
|
||||
font-size: 13px;
|
||||
|
@ -1273,6 +1267,9 @@ input.cancel:active {
|
|||
border-top: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.dom-edit-table td {
|
||||
height: 2.4em;
|
||||
}
|
||||
.dom a, a.dom, input.dom, .dom-menu .menu-title {
|
||||
background-image: url(../images/dom.png);
|
||||
background-repeat: no-repeat;
|
||||
|
|
|
@ -170,7 +170,7 @@ class m_dom {
|
|||
|
||||
function domains_type_enable_values() {
|
||||
global $db, $msg, $cuid;
|
||||
$msg->log("dom", "domains_type_target_values");
|
||||
$msg->log("dom", "domains_type_enable_values");
|
||||
$db->query("desc domaines_type;");
|
||||
$r = array();
|
||||
while ($db->next_record()) {
|
||||
|
@ -1256,11 +1256,26 @@ class m_dom {
|
|||
$r["type_desc"] = $db->Record["type_desc"];
|
||||
$r["only_dns"] = $db->Record["only_dns"];
|
||||
$r["web_action"] = $db->Record["web_action"];
|
||||
$r["https"] = $db->Record["https"];
|
||||
$db->free();
|
||||
return $r;
|
||||
} // get_sub_domain_all
|
||||
|
||||
|
||||
function clean_https_value($type, $https) {
|
||||
global $db;
|
||||
$db->query("select has_https_option from domaines_type where name= ? ;", array($type));
|
||||
if (!$db->next_record()) {
|
||||
return "";
|
||||
}
|
||||
if ($db->Record["has_https_option"]) {
|
||||
$https=strtolower($https);
|
||||
if ($https!="http" && $https!="https" && $https!="both") {
|
||||
return "both";
|
||||
}
|
||||
return $https;
|
||||
} else return "";
|
||||
}
|
||||
/**
|
||||
* @param integer $type
|
||||
* @param string $value
|
||||
|
@ -1385,9 +1400,11 @@ class m_dom {
|
|||
* @param integer $type Type de sous-domaine (local, ip, url ...)
|
||||
* @param string $dest Destination du sous-domaine, dépend de la valeur
|
||||
* de $type (url, ip, dossier...)
|
||||
* @param string $https the HTTPS behavior : HTTP(redirect https to http),
|
||||
* HTTPS(redirect http to https) or BOTH (both hosted at the same place)
|
||||
* @return boolean Retourne FALSE si une erreur s'est produite, TRUE sinon.
|
||||
*/
|
||||
function set_sub_domain($dom, $sub, $type, $dest, $sub_domain_id = 0) {
|
||||
function set_sub_domain($dom, $sub, $type, $dest, $sub_domain_id = 0, $https) {
|
||||
global $db, $msg, $cuid, $bro;
|
||||
$msg->log("dom", "set_sub_domain", $dom . "/" . $sub . "/" . $type . "/" . $dest);
|
||||
// Locked ?
|
||||
|
@ -1399,7 +1416,6 @@ class m_dom {
|
|||
$sub = trim(trim($sub), ".");
|
||||
$dom = strtolower($dom);
|
||||
$sub = strtolower($sub);
|
||||
|
||||
// if (!(($sub == '*') || ($sub=="") || (preg_match('/([a-z0-9][\.\-a-z0-9]*)?[a-z0-9]/', $sub)))) {
|
||||
$fqdn = checkfqdn($sub);
|
||||
// Special cases : * (all subdomains at once) and '' empty subdomain are allowed.
|
||||
|
@ -1409,10 +1425,10 @@ class m_dom {
|
|||
}
|
||||
|
||||
if (!$this->check_type_value($type, $dest)) {
|
||||
//plutot verifier si la chaine d'erreur est vide avant de raise sinon sa veut dire que l(erruer est deja remonté
|
||||
// error raised by check_type_value
|
||||
return false;
|
||||
}
|
||||
$https=$this->clean_https_value($type, $https);
|
||||
|
||||
// On a épuré $dir des problémes eventuels ... On est en DESSOUS du dossier de l'utilisateur.
|
||||
if (($t = checkfqdn($dom))) {
|
||||
|
@ -1430,8 +1446,8 @@ class m_dom {
|
|||
}
|
||||
|
||||
// Re-create the one we want
|
||||
if (!$db->query("INSERT INTO sub_domaines (compte,domaine,sub,valeur,type,web_action) VALUES (?, ?, ?, ?, ?, 'UPDATE');", array( $cuid , $dom , $sub , $dest , $type ))) {
|
||||
echo "query failed: " . $db->Error;
|
||||
if (!$db->query("INSERT INTO sub_domaines (compte,domaine,sub,valeur,type,web_action,https) VALUES (?, ?, ?, ?, ?, 'UPDATE',?);", array( $cuid , $dom , $sub , $dest , $type, $https ))) {
|
||||
$msg->raise("ERROR", "dom", _("The parameters for this subdomain and domain type are invalid. Please check for subdomain entries incompatibility"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ CREATE TABLE IF NOT EXISTS sub_domaines (
|
|||
enable enum ('ENABLED', 'ENABLE', 'DISABLED', 'DISABLE') NOT NULL DEFAULT 'ENABLED',
|
||||
`certificate_id` INT UNSIGNED NOT NULL DEFAULT '0',
|
||||
`provider` VARCHAR(16) NOT NULL DEFAULT '',
|
||||
`https` VARCHAR(4) NOT NULL, -- SET(http,https,both) (also the suffix of the template name in /etc/alternc/templates/apache2/)
|
||||
`https` VARCHAR(6) NOT NULL, -- SET(http,https,both) (also the suffix of the template name in /etc/alternc/templates/apache2/)
|
||||
PRIMARY KEY (id)
|
||||
-- ,FOREIGN KEY (type) REFERENCES (domaines_type)
|
||||
) ENGINE=InnoDB;
|
||||
|
|
Loading…
Reference in New Issue