Skip to content

Commit 11621df

Browse files
committed
Add force ssl checkbox to backend for admin and user.
1 parent 2006c7a commit 11621df

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

web/edit/web/index.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
$v_ssl_signature = $ssl_str[$v_domain]['SIGNATURE'];
5050
$v_ssl_pub_key = $ssl_str[$v_domain]['PUB_KEY'];
5151
$v_ssl_issuer = $ssl_str[$v_domain]['ISSUER'];
52+
$v_ssl_forcessl = $ssl_str[$v_domain]['FORCESSL'];
5253
}
5354
$v_letsencrypt = $data[$v_domain]['LETSENCRYPT'];
5455
if (empty($v_letsencrypt)) $v_letsencrypt = 'no';
@@ -360,6 +361,7 @@
360361
$v_ssl_key = '';
361362
$v_ssl_ca = '';
362363
$v_ssl = 'no';
364+
$v_ssl_forcessl = 'no';
363365
$restart_web = 'yes';
364366
$restart_proxy = 'yes';
365367
}
@@ -443,8 +445,22 @@
443445
rmdir($tmpdir);
444446
}
445447
}
446-
447-
448+
449+
// Add Force SSL
450+
if ((!empty($_POST['v_ssl_forcessl'])) && (!empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) {
451+
exec (HESTIA_CMD."v-add-web-domain-ssl-force ".$user." ".$v_domain, $output, $return_var);
452+
check_return_code($return_var,$output);
453+
unset($output);
454+
$v_ssl_forcessl = 'yes';
455+
}
456+
457+
// Delete Force SSL
458+
if (( $v_ssl_forcessl == 'yes' ) && (empty($_POST['v_ssl_forcessl'])) && (empty($_SESSION['error_msg']))) {
459+
exec (HESTIA_CMD."v-delete-web-domain-ssl-force ".$user." ".$v_domain." yes", $output, $return_var);
460+
check_return_code($return_var,$output);
461+
unset($output);
462+
$v_ssl_forcessl = 'no';
463+
}
448464

449465
// Delete web stats
450466
if ((!empty($v_stats)) && ($_POST['v_stats'] == 'none') && (empty($_SESSION['error_msg']))) {

web/templates/admin/edit_web.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,16 @@
187187
<tr>
188188
<td class="step-left">
189189
<table style="display:<?php if ($v_ssl == 'no' ) { echo 'none';} else {echo 'block';}?> ;" id="ssltable">
190-
<tr>
190+
<tr>
191191
<td class="input-label vst-text">
192192
<label><input type="checkbox" size="20" class="vst-checkbox" name="v_letsencrypt" <?php if($v_letsencrypt == 'yes' || $v_letencrypt == 'on') echo "checked=yes" ?> onclick="App.Actions.WEB.toggle_letsencrypt(this)"> <?php print __('Lets Encrypt Support');?></label>
193193
</td>
194194
</tr>
195+
<tr>
196+
<td class="input-label vst-text">
197+
<label><input type="checkbox" size="20" class="vst-checkbox" name="v_ssl_forcessl" <?php if($v_ssl_forcessl == 'yes') echo "checked=yes" ?> onclick="App.Actions.WEB.toggle_forcessl(this)"> <?php print __('Force SSL/HTTPS');?></label>
198+
</td>
199+
</tr>
195200
<tr>
196201
<td class="vst-text input-label">
197202
<?php print __('SSL Home Directory');?>

web/templates/user/edit_web.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,16 @@
187187
<tr>
188188
<td class="step-left">
189189
<table style="display:<?php if ($v_ssl == 'no' ) { echo 'none';} else {echo 'block';}?> ;" id="ssltable">
190-
<tr>
190+
<tr>
191191
<td class="input-label vst-text">
192192
<label><input type="checkbox" size="20" class="vst-checkbox" name="v_letsencrypt" <?php if($v_letsencrypt == 'yes' || $v_letencrypt == 'on') echo "checked=yes" ?> onclick="App.Actions.WEB.toggle_letsencrypt(this)"> <?php print __('Lets Encrypt Support');?></label>
193193
</td>
194194
</tr>
195+
<tr>
196+
<td class="input-label vst-text">
197+
<label><input type="checkbox" size="20" class="vst-checkbox" name="v_ssl_forcessl" <?php if($v_ssl_forcessl == 'yes') echo "checked=yes" ?> onclick="App.Actions.WEB.toggle_forcessl(this)"> <?php print __('Force SSL/HTTPS');?></label>
198+
</td>
199+
</tr>
195200
<tr>
196201
<td class="vst-text input-label">
197202
<?php print __('SSL Home Directory');?>

0 commit comments

Comments
 (0)