mirror of
https://github.com/myvesta/vesta
synced 2025-08-20 21:34:12 -07:00
Merge branch 'master' of github.com:serghey-rodin/vesta
This commit is contained in:
commit
bc1864225d
8 changed files with 113 additions and 173 deletions
|
@ -3,7 +3,7 @@ Title : Vesta
|
|||
Author : Eugen Lobicov, eugen.lobicov@gmail.com
|
||||
|
||||
created : November 27, 2009
|
||||
last updated : January 11, 2012
|
||||
last updated : January 12, 2012
|
||||
- - - - - - - - - - - - - - - - - - */
|
||||
|
||||
html{
|
||||
|
@ -585,7 +585,7 @@ input::-moz-focus-inner{
|
|||
width:11px;
|
||||
height:11px;
|
||||
margin:2px 5px 0 0;
|
||||
background:url(../images/chekbox-selector.png) no-repeat;
|
||||
background:url(../images/checkbox-selector.png) no-repeat;
|
||||
cursor:pointer;
|
||||
}
|
||||
.checkbox-selector .selector-title{
|
||||
|
@ -610,18 +610,6 @@ input::-moz-focus-inner{
|
|||
font-size: 12px;
|
||||
|
||||
background-color: #fff;
|
||||
/* background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.5, white));
|
||||
background-image: -webkit-linear-gradient(center bottom, #eeeeee 0%, white 50%);
|
||||
background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, white 50%);
|
||||
background-image: -o-linear-gradient(top, #eeeeee 0%,#ffffff 50%);
|
||||
background-image: -ms-linear-gradient(top, #eeeeee 0%,#ffffff 50%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff',GradientType=0 );
|
||||
background-image: linear-gradient(top, #eeeeee 0%,#ffffff 50%);
|
||||
|
||||
-moz-background-clip : padding;
|
||||
-webkit-background-clip: padding-box;
|
||||
background-clip : padding-box;
|
||||
*/
|
||||
|
||||
box-shadow: inset 1px 1px 4px 0px rgba(0, 0, 0, 0.10);
|
||||
-moz-box-shadow: inset 1px 1px 4px 0px rgba(0, 0, 0, 0.10);
|
||||
|
@ -652,15 +640,6 @@ input::-moz-focus-inner{
|
|||
background-clip : padding-box;
|
||||
background: #ccc;
|
||||
|
||||
/* background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
|
||||
background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%);
|
||||
background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
|
||||
background-image: -o-linear-gradient(bottom, #ccc 0%, #eee 60%);
|
||||
background-image: -ms-linear-gradient(top, #cccccc 0%,#eeeeee 60%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cccccc', endColorstr='#eeeeee',GradientType=0 );
|
||||
background-image: linear-gradient(top, #cccccc 0%,#eeeeee 60%);
|
||||
*/
|
||||
|
||||
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #fff), color-stop(0.6, #f5f4ef));
|
||||
background-image: -webkit-linear-gradient(center bottom, #fff 0%, #f5f4ef 60%);
|
||||
background-image: -moz-linear-gradient(center bottom, #fff 0%, #f5f4ef 60%);
|
||||
|
@ -1676,10 +1655,10 @@ input::-moz-focus-inner{
|
|||
width:18px;
|
||||
height:18px;
|
||||
margin:6px 0 0;
|
||||
background:url(../images/checkboxes.png) no-repeat;
|
||||
background:url(/images/form-checkboxes.png) no-repeat;
|
||||
}
|
||||
.b-new-entry .checkbox:hover{
|
||||
background-position:0 -98px;
|
||||
background-position:0 -100px;
|
||||
}
|
||||
.b-new-entry .stats-settings{
|
||||
padding-left:40px;
|
||||
|
@ -1687,10 +1666,6 @@ input::-moz-focus-inner{
|
|||
.b-new-entry .db-credentials .field-label{
|
||||
text-indent:40px;
|
||||
}
|
||||
/*.b-new-entry .pwd-box .text-field{
|
||||
float:left;
|
||||
margin:0 15px 0 0;
|
||||
}*/
|
||||
.b-new-entry_user .lastname-box{
|
||||
margin-bottom:30px;
|
||||
}
|
||||
|
@ -1774,26 +1749,6 @@ input::-moz-focus-inner{
|
|||
border-top:1px solid #dcdbad;
|
||||
background:url(../images/form-bottom-bg.png) repeat-x;
|
||||
}
|
||||
/* .b-new-entry .help-btn{
|
||||
position:absolute;
|
||||
top:13px;
|
||||
right:20px;
|
||||
font-size:11px;
|
||||
line-height:12px;
|
||||
color:#b4b39f;
|
||||
text-transform:uppercase;
|
||||
cursor:pointer;
|
||||
border-bottom:1px solid #b4b39f;
|
||||
text-decoration:none;
|
||||
}
|
||||
.b-new-entry .help-btn:hover{
|
||||
color:#000;
|
||||
border-bottom-color:#9fb35a;
|
||||
}
|
||||
.b-new-entry .help-btn:active{
|
||||
color:#4B9427;
|
||||
}
|
||||
*/
|
||||
|
||||
.b-new-entry .cancel-btn{
|
||||
|
||||
|
@ -1893,7 +1848,6 @@ input::-moz-focus-inner{
|
|||
height:32px;
|
||||
font-size:0;
|
||||
line-height:0;
|
||||
/* background:#fff url(../images/select-arrow.png) no-repeat 100% 50%;*/
|
||||
background:#fff url(../images/autocomplete-field-arrows-sprite.png) no-repeat;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
@ -1981,12 +1935,6 @@ input::-moz-focus-inner{
|
|||
.b-new-detailed-restore .add-entry-btn{
|
||||
padding:0 30px;
|
||||
}
|
||||
/*
|
||||
.b-new-detailed-restore .cancel-btn{
|
||||
left:auto;
|
||||
right:16px;
|
||||
}
|
||||
*/
|
||||
|
||||
/* Show/edit dns records form
|
||||
- - - - - - - - - - - - - - - - - - - */
|
||||
|
@ -2206,19 +2154,12 @@ input::-moz-focus-inner{
|
|||
background:url(../images/stats-brace.png) no-repeat 0 50%;
|
||||
}
|
||||
.stats-box-title{
|
||||
/*
|
||||
background: url("../images/stats-curve.png") no-repeat 85% 50%;
|
||||
|
||||
line-height: 61px;
|
||||
margin-right: 33px;
|
||||
padding-right: 35px;
|
||||
*/
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:-68px;
|
||||
|
||||
width:28px;
|
||||
margin-top:-10px;
|
||||
margin-top:-6px;
|
||||
padding-right:35px;
|
||||
text-transform:uppercase;
|
||||
font-size:9px;
|
||||
|
|
BIN
web/images/checkbox-selector.png
Normal file
BIN
web/images/checkbox-selector.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
|
@ -69,7 +69,7 @@ App.Settings.Imutable.IP = ['INTERFACE'];
|
|||
// Empty
|
||||
App.Empty = {};
|
||||
App.Empty.USER = {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','LNAME':'', 'FNAME':'','NS1':'','NS2':'','NS3':'','NS4':'','NS5':'','NS6':'','NS7':'','NS8':''};
|
||||
App.Empty.WEB_DOMAIN = {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','NS':'', 'DOMAIN':'','SSL_CERT':'','SSL_KEY':'','SSL_HOME':'','STATS_PASSWORD':'','STATS_LOGIN':'','ALIAS':''};
|
||||
App.Empty.WEB_DOMAIN = {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','NS':'', 'DOMAIN':'','SSL_CERT':'','SSL_KEY':'','SSL_HOME':'','STATS_PASSWORD':'','STATS_LOGIN':'','ALIAS':'', 'SSL_CA':'', 'SSL_CRT':'','NGINX_EXT':''};
|
||||
App.Empty.DB = {'DB':'', 'USER':'','FORM':'', 'PASSWORD': ''};
|
||||
|
||||
App.Settings.getMethodName = function(action)
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
App.Actions.toggle_ssl_support = function(evt, elm)
|
||||
{
|
||||
if (!elm) {
|
||||
var elm = $(evt.target);
|
||||
}
|
||||
|
||||
var ref = elm.hasClass('form') ? elm : elm.parents('.form');
|
||||
fb.log(ref);
|
||||
if (ref.find('.ssl_support').attr('checked')) {
|
||||
$('.ssl-crtfct-box', ref).removeClass('hidden');
|
||||
}
|
||||
else {
|
||||
$('.ssl-crtfct-box', ref).addClass('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
App.Actions.view_nginx_extensions = function(evt)
|
||||
{
|
||||
var elm = $(evt.target);
|
||||
|
|
|
@ -146,7 +146,20 @@ App.HTML.Build.web_domain_form = function (options, id) {
|
|||
tpl.set(':title', 'Edit WEB domain');
|
||||
tpl.set(':save_button', 'SAVE');
|
||||
tpl.set(':DELETE_ACTION', App.Templates.get('DELETE_ACTION', 'general').finalize());
|
||||
if (options.SSL == 'on') {
|
||||
tpl.set(':ssl_checked', 'checked="checked"');
|
||||
}
|
||||
else {
|
||||
tpl.set(':ssl_checked', '');
|
||||
}
|
||||
if (options.SSL_HOME == 'on') {
|
||||
tpl.set(':ssl_home_checked', 'checked="checked"');
|
||||
}
|
||||
else{
|
||||
tpl.set(':ssl_home_checked', '');
|
||||
}
|
||||
}
|
||||
|
||||
options = !App.Helpers.isEmpty(options) ? options : App.Empty.WEB_DOMAIN;
|
||||
if (in_edit == true) {
|
||||
options.STATS_PASSWORD = options.STATS_LOGIN.trim() != '' ? App.Settings.PASSWORD_IMMUTE : '';
|
||||
|
@ -170,6 +183,25 @@ App.HTML.Build.web_domain_form = function (options, id) {
|
|||
tpl.set(':ACTIVE_PASSWORD', 'hidden');
|
||||
tpl.set(':stats_auth_checked', '');
|
||||
}
|
||||
|
||||
if (options.SSL == 'on') {
|
||||
tpl.set(':ssl_checked', 'checked="checked"');
|
||||
if (options.SSL_HOME == 'on') {
|
||||
tpl.set(':ssl_home_checked', 'checked="checked"');
|
||||
}
|
||||
else{
|
||||
tpl.set(':ssl_home_checked', '');
|
||||
}
|
||||
}
|
||||
else {
|
||||
tpl.set(':ssl_checked', '');
|
||||
tpl.set(':ssl_home_checked', '');
|
||||
tpl.set(':SSL_HOME', '');
|
||||
tpl.set(':SSL_CRT', '');
|
||||
tpl.set(':SSL_KEY', '');
|
||||
tpl.set(':SSL_CA', '');
|
||||
}
|
||||
|
||||
return tpl.finalize();
|
||||
}
|
||||
|
||||
|
@ -581,6 +613,9 @@ App.HTML.Build.ssl_key_file = function () {
|
|||
App.HTML.Build.ssl_cert_file = function () {
|
||||
return '<iframe src="' + App.Helpers.getUploadUrl() + '?action=show&type=cert" width="500px;" height="53px;" framevorder="0" scroll="no">..</iframe>';
|
||||
}
|
||||
App.HTML.Build.ssl_ca_file = function () {
|
||||
return '<iframe src="' + App.Helpers.getUploadUrl() + '?action=show&type=ca" width="500px;" height="53px;" framevorder="0" scroll="no">..</iframe>';
|
||||
}
|
||||
App.HTML.Build.user_selects = function (tpl, options) {
|
||||
var acc = [];
|
||||
var pkg = App.Env.initialParams.USERS.PACKAGE;
|
||||
|
@ -615,6 +650,7 @@ App.HTML.Build.db_selects = function (tpl, options) {
|
|||
acc[acc.length++] = tpl.finalize();
|
||||
});
|
||||
tpl.set(':TYPE_OPTIONS', acc.done());
|
||||
|
||||
acc = [];
|
||||
var items = App.Env.initialParams.DB.HOST;
|
||||
$.each(items, function (val) {
|
||||
|
@ -625,6 +661,18 @@ App.HTML.Build.db_selects = function (tpl, options) {
|
|||
acc[acc.length++] = tpl.finalize();
|
||||
});
|
||||
tpl.set(':HOST_OPTIONS', acc.done());
|
||||
|
||||
acc = [];
|
||||
var items = App.Env.initialParams.DB.ENCODING;
|
||||
$.each(items, function (val) {
|
||||
var tpl = App.Templates.get('select_option', 'general');
|
||||
tpl.set(':VALUE', val);
|
||||
tpl.set(':TEXT', items[val]);
|
||||
tpl.set(':SELECTED', val == options.ENCODING ? 'selected="selected"' : '');
|
||||
acc[acc.length++] = tpl.finalize();
|
||||
});
|
||||
tpl.set(':ENCODING_OPTIONS', acc.done());
|
||||
|
||||
return tpl;
|
||||
}
|
||||
App.HTML.Build.ip_selects = function (tpl, options) {
|
||||
|
|
|
@ -87,8 +87,11 @@ App.Pages.WEB_DOMAIN.new_entry = function(evt)
|
|||
$('#'+form_id).find('.ns-entry, .additional-ns-add').addClass('hidden');
|
||||
var ssl_key_upload = App.HTML.Build.ssl_key_file();
|
||||
var ssl_cert_upload = App.HTML.Build.ssl_cert_file();
|
||||
var ssl_ca_upload = App.HTML.Build.ssl_ca_file();
|
||||
$('#'+form_id).find('.ssl-key-input-dummy:first').replaceWith(ssl_key_upload);
|
||||
$('#'+form_id).find('.ssl-cert-input-dummy:first').replaceWith(ssl_cert_upload);
|
||||
$('#'+form_id).find('.ssl-ca-input-dummy:first').replaceWith(ssl_ca_upload);
|
||||
App.Actions.toggle_ssl_support({}, $('#'+form_id));
|
||||
}
|
||||
|
||||
App.Pages.WEB_DOMAIN.edit = function(evt)
|
||||
|
@ -102,9 +105,14 @@ App.Pages.WEB_DOMAIN.edit = function(evt)
|
|||
// ssls uploads
|
||||
var ssl_key_upload = App.HTML.Build.ssl_key_file();
|
||||
var ssl_cert_upload = App.HTML.Build.ssl_cert_file();
|
||||
var ssl_ca_upload = App.HTML.Build.ssl_ca_file();
|
||||
tpl = tpl.replace('<span class="ssl-key-input-dummy">...</span>', ssl_key_upload);
|
||||
tpl = tpl.replace('<span class="ssl-cert-input-dummy">...</span>', ssl_cert_upload);
|
||||
elm.replaceWith(tpl);
|
||||
tpl = tpl.replace('<span class="ssl-ca-input-dummy">...</span>', ssl_cert_upload);
|
||||
var tmp_elm = $('<div>').html(tpl);
|
||||
App.Actions.toggle_ssl_support({}, tmp_elm.find('.form'));
|
||||
elm.replaceWith(tmp_elm.html());
|
||||
|
||||
|
||||
App.Helpers.disableNotEditable();
|
||||
App.Helpers.updateScreen();
|
||||
|
|
|
@ -666,11 +666,11 @@ App.Templates.html = {
|
|||
</div><!-- // stats settings -->\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">SSL Support:</label>\
|
||||
<input type="checkbox" name="SSL" class="styled" ~!:ssl_checked~!="" value="~!SSL~!">\
|
||||
<input type="checkbox" name="SSL" class="styled do_action_toggle_ssl_support ssl_support" ~!:ssl_checked~! value="~!SSL~!">\
|
||||
</div>\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">SSL Document Root:</label>\
|
||||
<input type="text" name="SSL_HOME" class="text-field" value="~!:SSL_HOME~!">\
|
||||
<div class="form-row cc ssl-crtfct-box">\
|
||||
<label for="#" class="field-label">SSL Shared DocRoot:</label>\
|
||||
<input type="checkbox" name="SSL_HOME" class="styled" ~!:ssl_home_checked~! value="~!SSL_HOME~!">\
|
||||
</div>\
|
||||
<div class="form-row ssl-crtfct-box cc">\
|
||||
<label for="#" class="field-label">SSL Crtificate: <span class="remark">(upload file or paste as text)</span></label>\
|
||||
|
@ -684,7 +684,7 @@ App.Templates.html = {
|
|||
</div>\
|
||||
<div class="form-row ssl-crtfct-box cc">\
|
||||
<label for="#" class="field-label">SSL Certificate CA: <span class="remark">(upload file or paste as text)</span></label>\
|
||||
<span class="ssl-key-input-dummy">...</span>\
|
||||
<span class="ssl-ca-input-dummy">...</span>\
|
||||
<textarea name="SSL_CA" class="textarea ssl-key">~!:SSL_CA~!</textarea>\
|
||||
</div>\
|
||||
</div><!-- // advanced options -->\
|
||||
|
@ -697,7 +697,7 @@ App.Templates.html = {
|
|||
</div>\
|
||||
<div class="sub_section hidden">\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">create dns domain:</label>\
|
||||
<label for="#" class="field-label">create DNS domain:</label>\
|
||||
<input type="checkbox" value="~!:DNS~!" ~!:CHECKED_DNS~! name="DNS" class="styled">\
|
||||
</div>\
|
||||
</div><!-- DNS options -->\
|
||||
|
@ -715,6 +715,10 @@ App.Templates.html = {
|
|||
</div>\
|
||||
</div>\
|
||||
</div><!-- Mail options -->\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">create DNS domain:</label>\
|
||||
<input type="checkbox" value="" name="DNS_DOMAIN" class="styled">\
|
||||
</div>\
|
||||
<div class="form-row buttons-row cc">\
|
||||
<input class="add-entry-btn do_action_save_form" type="submit" value="~!:save_button~!"/>\
|
||||
<span class="cancel-btn do_action_cancel_form">Cancel</span>\
|
||||
|
@ -856,13 +860,13 @@ App.Templates.html = {
|
|||
<span class="generate-pwd do_action_generate_pass">Generate</span>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="form-row hidden cc">\
|
||||
<!--div class="form-row hidden cc">\
|
||||
<label for="#" class="field-label">Host:</label>\
|
||||
<select name="HOST" class="styled">~!:HOST_OPTIONS~!</select>\
|
||||
</div>\
|
||||
</div -->\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">Encoding:</label>\
|
||||
<select name="TYPE" class="styled">~!:ENCODING_OPTIONS~!</select>\
|
||||
<select name="ENCODING" class="styled">~!:ENCODING_OPTIONS~!</select>\
|
||||
</div>\
|
||||
<div class="form-row suspended cc">\
|
||||
<label for="#" class="field-label">Suspended:</label>\
|
||||
|
|
|
@ -36,8 +36,8 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
'ELOG' => $record['ELOG'],
|
||||
'STAT' => $record['STATS'],
|
||||
'STATS_LOGIN' => $record['STATS_AUTH'],
|
||||
'SSL' => $record['SSL'],
|
||||
'SSL_HOME' => $record['SSL_HOME'],
|
||||
'SSL' => $record['SSL'] == 'yes' ? 'on' : 'off',
|
||||
'SSL_HOME' => $record['SSL_HOME'] == 'tsingle' ? 'off' : 'on',
|
||||
'SSL_CRT' => '',
|
||||
'SSL_KEY' => '',
|
||||
'SSL_CA' => '',
|
||||
|
@ -170,29 +170,10 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
}
|
||||
}
|
||||
|
||||
/* if ($_s['SSL']) {
|
||||
$params = array(
|
||||
'USER' => $user['uid'],
|
||||
'DOMAIN' => $_s['DOMAIN'],
|
||||
'SSL_CERT' => $_s['SSL_CERT']
|
||||
);
|
||||
|
||||
if ($_s['SSL_HOME']) {
|
||||
$params['SSL_HOME'] = $_s['SSL_HOME'];
|
||||
}
|
||||
|
||||
$result = 0;
|
||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_SSL, $params);
|
||||
|
||||
if (!$result['status']) {
|
||||
$this->errors['SSL'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}
|
||||
if ($_s['SSL_HOME']) {
|
||||
|
||||
}*/
|
||||
|
||||
/*if (!empty($_s['DNS'])) {
|
||||
if (($_s['DNS_DOMAIN']) == 'on') {
|
||||
echo 'adding dns domain';
|
||||
echo '<br>';
|
||||
|
||||
$params = array(
|
||||
'USER' => $user['uid'],
|
||||
'DNS_DOMAIN' => $_s['DOMAIN'],
|
||||
|
@ -207,7 +188,7 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
if (!$result['status']) {
|
||||
$this->errors['DNS_DOMAIN'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
/*if (!empty($_s['MAIL'])) {
|
||||
|
@ -277,11 +258,15 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
$_old['ELOG'] = $_old['ELOG'] == 'yes' ? 'on' : 'off';
|
||||
$_old['CGI'] = $_old['CGI'] == 'yes' ? 'on' : 'off';
|
||||
$_old['AUTH'] = $_old['AUTH'] == 'yes' ? 'on' : 'off';
|
||||
$_old['SSL'] = $_old['SSL'] == 'yes' ? 'on' : 'off';
|
||||
// $_old['SSL'] = $_old['SSL'] == 'yes' ? 'on' : 'off';
|
||||
// $_new['SSL'] = $_new['SSL'] == 'yes' ? 'on' : 'off';
|
||||
// $_new['SSL_HOME'] = $_new['SSL_HOME'] == 'no' ? 'shared' : 'single';
|
||||
|
||||
$user = $this->getLoggedUser();
|
||||
$_DOMAIN = $_new['DOMAIN'];
|
||||
|
||||
$result['status'] = TRUE;
|
||||
|
||||
if ($_old['SUSPEND'] != $_new['SUSPEND']) {
|
||||
if ($_new['SUSPEND'] == 'on') {
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_WEB_DOMAIN, array('USER' => $user['uid'], 'DOMAIN' => $_DOMAIN));
|
||||
|
@ -451,91 +436,29 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (!empty($_s['SSL_KEY'])) {
|
||||
$ssl_file = tempnam(sys_get_temp_dir(), 'ssl');
|
||||
file_put_contents($ssl_file, $_s['SSL_KEY']);
|
||||
|
||||
$params = array(
|
||||
'USER' => $user['uid'],
|
||||
'DOMAIN' => $_s['DOMAIN'],
|
||||
'SSL_KEY' => $ssl_file
|
||||
);
|
||||
|
||||
if (!empty($_s['SSL_HOME'])) {
|
||||
$params['SSL_HOME'] = $_s['SSL_HOME'];
|
||||
}
|
||||
|
||||
$result = 0;
|
||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_SSL, $params);
|
||||
|
||||
if (!$result['status']) {
|
||||
$this->errors['SSL'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_s['SSL_CERT'])) {
|
||||
$sslcert_file = tempnam(sys_get_temp_dir(), 'ssl');
|
||||
file_put_contents($sslcert_file, $_s['SSL_CERT']);
|
||||
|
||||
$params = array(
|
||||
'USER' => $user['uid'],
|
||||
'DOMAIN' => $_s['DOMAIN'],
|
||||
'SSL_CERT' => $sslcert_file
|
||||
);
|
||||
|
||||
$result = 0;
|
||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_SSLCERT, $params);
|
||||
|
||||
if (!$result['status']) {
|
||||
$this->errors['SSL_CERT'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if (!empty($_new['SSL_KEY']) && !empty($_new['SSL_CRT'])) {
|
||||
// $ssl_dir = sys_get_temp_dir().'/ssl/'.rand();
|
||||
if (( !empty($_new['SSL_KEY']) && !empty($_new['SSL_CRT']) && $_new['SSL'] == 'on') || $_old['SSL_HOME'] != $_new['SSL_HOME']) {
|
||||
$ssl_dir = sys_get_temp_dir().'/';
|
||||
// if(!mkdir($ssl_dir)){
|
||||
// return $this->reply(FALSE, array('error' => 'can\'t create temp ssl dir: '.$ssl_dir));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
$ssl_crt_file = $ssl_dir . $_new['DOMAIN'] . '.crt';
|
||||
if(!file_put_contents($ssl_crt_file, $_new['SSL_CRT']))
|
||||
file_put_contents($ssl_crt_file, $_new['SSL_CRT']);
|
||||
|
||||
$ssl_key_file = $ssl_dir . $_new['DOMAIN'] . '.key';
|
||||
file_put_contents($ssl_key_file, $_new['SSL_KEY']);
|
||||
|
||||
if (!empty($_new['SSL_CA'])) {
|
||||
$ssl_ca_file = $ssl_dir . $_new['DOMAIN'] . '.ca';
|
||||
// file_put_contents($ssl_ca_file, $_new['SSL_CA']);
|
||||
file_put_contents($ssl_ca_file, $_new['SSL_CA']);
|
||||
}
|
||||
|
||||
|
||||
// echo '<br>';
|
||||
// echo $ssl_crt_file;
|
||||
// echo '<br>';
|
||||
// echo $ssl_key_file;
|
||||
// echo '<br>';
|
||||
// echo $ssl_ca_file;
|
||||
|
||||
$params = array(
|
||||
'USER' => $user['uid'],
|
||||
'DOMAIN' => $_DOMAIN,
|
||||
'SSL_DIR' => $ssl_dir
|
||||
// 'SSL_DIR' => 'tmp'
|
||||
'SSL_DIR' => $ssl_dir,
|
||||
'SSL_HOME' => $_new['SSL_HOME'] == 'on' ? 'shared' : 'single'
|
||||
);
|
||||
|
||||
// if (!empty($_s['SSL_HOME'])) {
|
||||
// $params['SSL_HOME'] = $_s['SSL_HOME'];
|
||||
// }
|
||||
|
||||
$result = 0;
|
||||
|
||||
if($_old['SSL'] == 'on'){
|
||||
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_SSL, $params);
|
||||
}
|
||||
|
@ -543,8 +466,6 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_SSL, $params);
|
||||
}
|
||||
|
||||
// print_r($result);
|
||||
|
||||
if (!$result['status']) {
|
||||
$this->errors['SSL'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
|
@ -552,12 +473,14 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
unlink($ssl_crt_file);
|
||||
unlink($ssl_key_file);
|
||||
unlink($ssl_ca_file);
|
||||
|
||||
}
|
||||
|
||||
if (empty($_new['SSL_KEY']) && empty($_new['SSL_CRT']) && $_old['SSL'] == 'on') {
|
||||
if ( ((empty($_new['SSL_KEY']) || empty($_new['SSL_CRT'])) && $_old['SSL'] == 'on') || ( $_old['SSL'] == 'on' && $_new['SSL'] == 'off') ){
|
||||
$result = 0;
|
||||
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_SSL, array('USER' => $user['uid'], 'DOMAIN' => $_DOMAIN));
|
||||
if (!$result['status']) {
|
||||
$this->errors['SSL_REMOVING'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->reply($result['status'], $result['data']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue