mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 02:28:05 -07:00
Merge branch 'master' of github.com:serghey-rodin/vesta
This commit is contained in:
commit
8f5b68b011
25 changed files with 6030 additions and 3562 deletions
6316
web/css/main.css
6316
web/css/main.css
File diff suppressed because it is too large
Load diff
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
web/images/checkboxes.png
Normal file
BIN
web/images/checkboxes.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.9 KiB |
BIN
web/images/form-checkboxes.png
Normal file
BIN
web/images/form-checkboxes.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -11,9 +11,9 @@ $('document').ready(function() {
|
|||
App.Utils.detectBrowser();
|
||||
App.Ref.init();
|
||||
|
||||
App.Env.world = 'USER';
|
||||
//App.Env.world = 'USER';
|
||||
// Disabled cookie tab restoring. Enable if needed
|
||||
/*if ('undefined' != typeof App.Tmp.loadTAB) {
|
||||
if ('undefined' != typeof App.Tmp.loadTAB) {
|
||||
App.Env.world = App.Tmp.loadTAB;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ $('document').ready(function() {
|
|||
else {
|
||||
App.Env.world = App.Constants.TABS[0];
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
App.Pages.init();
|
||||
App.Core.listen();
|
||||
|
|
|
@ -59,11 +59,12 @@ App.Messages.get = function(key, plural) {
|
|||
}
|
||||
|
||||
// Imutable
|
||||
App.Settings.Imutable = {};
|
||||
App.Settings.Imutable.USER = ['LOGIN_NAME'];
|
||||
App.Settings.Imutable.DB = ['DB', 'TYPE', 'USER'];
|
||||
App.Settings.Imutable.DNS = ['DNS_DOMAIN'];
|
||||
App.Settings.Imutable.IP = ['INTERFACE'];
|
||||
App.Settings.Imutable = {};
|
||||
App.Settings.Imutable.USER = ['LOGIN_NAME'];
|
||||
App.Settings.Imutable.WEB_DOMAIN = ['DOMAIN'];
|
||||
App.Settings.Imutable.DB = ['DB', 'TYPE', 'USER', 'CHARSET', 'HOST'];
|
||||
App.Settings.Imutable.DNS = ['DNS_DOMAIN'];
|
||||
App.Settings.Imutable.IP = ['IP_ADDRESS', 'NETMASK', 'INTERFACE'];
|
||||
|
||||
|
||||
// Empty
|
||||
|
|
|
@ -87,7 +87,7 @@ App.Actions.update_cs_value = function(evt)
|
|||
|
||||
if (App.Tmp[App.Env.world + '_selected_records'] > 0) {
|
||||
var confirm_message_key = App.Tmp[App.Env.world + '_selected_records'] == 1 ? 1 + ' record' : App.Tmp[App.Env.world + '_selected_records'] + ' records';
|
||||
var confirmed = confirm('This action will ' + val.toLowerCase() + ' ' + confirm_message_key + '. Do you want to proceede?');
|
||||
var confirmed = confirm('This action will ' + val.toLowerCase() + ' ' + confirm_message_key + '. Do you want to proceed?');
|
||||
if (confirmed) {
|
||||
fb.log('mass_' + val);
|
||||
var func_name = val.toLowerCase();
|
||||
|
@ -366,14 +366,13 @@ App.Actions.save_form = function(evt) {
|
|||
if (!confirmed) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
var values = App.Helpers.getFormValues(elm);
|
||||
if(App.Validate.form(values, $('#'+elm_id))) {
|
||||
App.Model.add(values, source);
|
||||
var form_id = App.Constants[App.Env.world + '_FORM_ID'];
|
||||
$('#'+form_id).remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var values = App.Helpers.getFormValues(elm);
|
||||
if(App.Validate.form(values, $('#'+elm_id))) {
|
||||
App.Model.add(values, source);
|
||||
var form_id = App.Constants[App.Env.world + '_FORM_ID'];
|
||||
$('#'+form_id).remove();
|
||||
}
|
||||
}
|
||||
else { // OLD ITEM, UPDATING IT
|
||||
|
|
|
@ -95,6 +95,7 @@ App.HTML.Build.user_form = function (options, id) {
|
|||
tpl.set(':DELETE_ACTION', App.Templates.get('DELETE_ACTION', 'general').finalize());
|
||||
}
|
||||
options = !App.Helpers.isEmpty(options) ? options : App.Empty.USER;
|
||||
|
||||
if (in_edit == true) {
|
||||
options.PASSWORD = App.Settings.PASSWORD_IMMUTE;
|
||||
var ns = [];
|
||||
|
@ -146,6 +147,15 @@ 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_CRT == '' || options.SSL_KEY == ''){
|
||||
options.SSL = '';
|
||||
options.SSL_HOME = '';
|
||||
options.SSL_CRT = '';
|
||||
options.SSL_KEY = '';
|
||||
options.SSL_CA = '';
|
||||
}
|
||||
|
||||
if (options.SSL == 'on') {
|
||||
tpl.set(':ssl_checked', 'checked="checked"');
|
||||
}
|
||||
|
@ -167,7 +177,7 @@ App.HTML.Build.web_domain_form = function (options, id) {
|
|||
tpl = App.HTML.setTplKeys(tpl, options, true);
|
||||
tpl = App.HTML.Build.web_domain_selects(tpl, options);
|
||||
tpl = App.HTML.toggle_suspended_form(tpl, options);
|
||||
if (options.CGI == 'yes') {
|
||||
if (options.CGI == 'yes' || !in_edit) {
|
||||
tpl.set(':CHECKED_CGI', 'checked="checked"');
|
||||
}
|
||||
if (options.ELOG == 'yes') {
|
||||
|
@ -384,8 +394,11 @@ App.HTML.Build.web_domain_entry = function (o, key) {
|
|||
'DISK_QUOTA_MEASURE': App.Helpers.getMbHumanMeasure(App.Env.initialParams.user_data.DISK_QUOTA),
|
||||
'BANDWIDTH_MEASURE': App.Helpers.getMbHumanMeasure(App.Env.initialParams.user_data.BANDWIDTH),
|
||||
'BANDWIDTH': App.Helpers.getMbHuman(App.Env.initialParams.user_data.BANDWIDTH),
|
||||
'DISK_QUOTA': App.Helpers.getMbHuman(App.Env.initialParams.user_data.DISK_QUOTA)
|
||||
'DISK_QUOTA': App.Helpers.getMbHuman(App.Env.initialParams.user_data.DISK_QUOTA),
|
||||
'SSL': (o.SSL_CRT == '' || o.SSL_KEY == '' || o.SSL != 'on') ? 'off' : 'on'
|
||||
};
|
||||
|
||||
|
||||
var o = $.extend(o, processed_data);
|
||||
o.U_DISK_PERCENTAGE_2 = o.U_DISK_PERCENTAGE;
|
||||
o.U_DISK_PERCENTAGE_3 = o.U_DISK_PERCENTAGE;
|
||||
|
@ -651,27 +664,14 @@ App.HTML.Build.db_selects = function (tpl, options) {
|
|||
});
|
||||
tpl.set(':TYPE_OPTIONS', acc.done());
|
||||
|
||||
acc = [];
|
||||
var items = App.Env.initialParams.DB.HOST;
|
||||
$.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.HOST ? 'selected="selected"' : '');
|
||||
acc[acc.length++] = tpl.finalize();
|
||||
});
|
||||
tpl.set(':HOST_OPTIONS', acc.done());
|
||||
var obj = App.Env.initialParams.DB.HOST;
|
||||
var opts = App.HTML.Build.options(obj, options.HOST);
|
||||
tpl.set(':HOST_OPTIONS', opts);
|
||||
|
||||
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());
|
||||
|
||||
var obj = App.Env.initialParams.DB.CHARSET;
|
||||
var opts = App.HTML.Build.options(obj, options.CHARSET);
|
||||
tpl.set(':CHARSET_OPTIONS', opts);
|
||||
|
||||
return tpl;
|
||||
}
|
||||
|
@ -691,9 +691,11 @@ App.HTML.Build.dns_selects = function (tpl, options) {
|
|||
$.each(App.Env.initialParams.DNS.TPL, function (key) {
|
||||
obj[key] = key;
|
||||
});
|
||||
var opts = App.HTML.Build.options(obj, options.PACKAGE);
|
||||
|
||||
var opts = App.HTML.Build.options(obj, options.TPL);
|
||||
tpl.set(':TPL', opts);
|
||||
tpl.set(':TPL_DEFAULT_VALUE', options.TPL || App.Helpers.getFirstKey(obj));
|
||||
// tpl.set(':TPL_DEFAULT_VALUE', options.TPL || App.Helpers.getFirstKey(obj));
|
||||
|
||||
} catch (e) {
|
||||
return tpl;
|
||||
}
|
||||
|
|
|
@ -1,164 +1,164 @@
|
|||
/*
|
||||
|
||||
CUSTOM FORM ELEMENTS
|
||||
|
||||
Created by Ryan Fait
|
||||
www.ryanfait.com
|
||||
|
||||
The only things you may need to change in this file are the following
|
||||
variables: checkboxHeight, radioHeight and selectWidth (lines 24, 25, 26)
|
||||
|
||||
The numbers you set for checkboxHeight and radioHeight should be one quarter
|
||||
of the total height of the image want to use for checkboxes and radio
|
||||
buttons. Both images should contain the four stages of both inputs stacked
|
||||
on top of each other in this order: unchecked, unchecked-clicked, checked,
|
||||
checked-clicked.
|
||||
|
||||
You may need to adjust your images a bit if there is a slight vertical
|
||||
movement during the different stages of the button activation.
|
||||
|
||||
The value of selectWidth should be the width of your select list image.
|
||||
|
||||
Visit http://ryanfait.com/ for more information.
|
||||
|
||||
*/
|
||||
|
||||
var checkboxHeight = "25";
|
||||
var radioHeight = "25";
|
||||
var selectWidth = "230";
|
||||
|
||||
|
||||
/* No need to change anything after this */
|
||||
|
||||
|
||||
document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } .disabled { opacity: 0.5; filter: alpha(opacity=50); }</style>');
|
||||
|
||||
var Custom = {
|
||||
init: function() {
|
||||
var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
|
||||
for(a = 0; a < inputs.length; a++) {
|
||||
if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && $(inputs[a]).hasClass("styled") && !$(inputs[a]).hasClass("style-applied")) {
|
||||
$(inputs[a]).addClass('style-applied');
|
||||
span[a] = document.createElement("span");
|
||||
span[a].className = inputs[a].type;
|
||||
if ($(inputs[a]).attr('class').indexOf('do_action_toggle_suspend') != -1) {
|
||||
span[a].className += ' do_action_toggle_suspend'; // save toggle functionality
|
||||
}
|
||||
if ($(inputs[a]).attr('class').indexOf('do_action_toggle_batch_selector') != -1) {
|
||||
span[a].className += ' do_action_toggle_batch_selector'; // save toggle functionality
|
||||
}
|
||||
if ($(inputs[a]).attr('class').indexOf('do_action_toggle_ssl_support') != -1) {
|
||||
span[a].className += ' do_action_toggle_ssl_support'; // save toggle functionality
|
||||
}
|
||||
|
||||
|
||||
if(inputs[a].checked == true) {
|
||||
if(inputs[a].type == "checkbox") {
|
||||
position = "0 -" + (checkboxHeight*2) + "px";
|
||||
span[a].style.backgroundPosition = position;
|
||||
} else {
|
||||
position = "0 -" + (radioHeight*2) + "px";
|
||||
span[a].style.backgroundPosition = position;
|
||||
}
|
||||
}
|
||||
inputs[a].parentNode.insertBefore(span[a], inputs[a]);
|
||||
inputs[a].onchange = Custom.clear;
|
||||
if(!inputs[a].getAttribute("disabled")) {
|
||||
span[a].onmousedown = Custom.pushed;
|
||||
span[a].onmouseup = Custom.check;
|
||||
} else {
|
||||
span[a].className = span[a].className += " disabled";
|
||||
}
|
||||
}
|
||||
}
|
||||
inputs = document.getElementsByTagName("select");
|
||||
try {
|
||||
for(a = 0; a < inputs.length; a++) {
|
||||
if($(inputs[a]).hasClass("styled")) {
|
||||
option = inputs[a].getElementsByTagName("option");
|
||||
active = option[0].childNodes[0].nodeValue;
|
||||
textnode = document.createTextNode(active);
|
||||
for(b = 0; b < option.length; b++) {
|
||||
if(option[b].selected == true) {
|
||||
textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
|
||||
}
|
||||
}
|
||||
span[a] = document.createElement("span");
|
||||
span[a].className = "select";
|
||||
span[a].id = "select-" + inputs[a].name + a;
|
||||
span[a].appendChild(textnode);
|
||||
inputs[a].parentNode.insertBefore(span[a], inputs[a]);
|
||||
inputs[a].id = inputs[a].name + a;
|
||||
if(!inputs[a].getAttribute("disabled")) {
|
||||
inputs[a].onchange = Custom.choose;
|
||||
} else {
|
||||
inputs[a].previousSibling.className = inputs[a].previousSibling.className += " disabled";
|
||||
}
|
||||
}
|
||||
}
|
||||
document.onmouseup = Custom.clear;
|
||||
}
|
||||
catch(e){ /* */ }
|
||||
},
|
||||
pushed: function() {
|
||||
element = this.nextSibling;
|
||||
if(element.checked == true && element.type == "checkbox") {
|
||||
this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
|
||||
} else if(element.checked == true && element.type == "radio") {
|
||||
this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
|
||||
} else if(element.checked != true && element.type == "checkbox") {
|
||||
this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
|
||||
} else {
|
||||
this.style.backgroundPosition = "0 -" + radioHeight + "px";
|
||||
}
|
||||
},
|
||||
check: function() {
|
||||
element = this.nextSibling;
|
||||
if(element.checked == true && element.type == "checkbox") {
|
||||
this.style.backgroundPosition = "0 0";
|
||||
element.checked = false;
|
||||
} else {
|
||||
if(element.type == "checkbox") {
|
||||
this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
|
||||
} else {
|
||||
this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
|
||||
group = this.nextSibling.name;
|
||||
inputs = document.getElementsByTagName("input");
|
||||
for(a = 0; a < inputs.length; a++) {
|
||||
if(inputs[a].name == group && inputs[a] != this.nextSibling) {
|
||||
inputs[a].previousSibling.style.backgroundPosition = "0 0";
|
||||
}
|
||||
}
|
||||
}
|
||||
element.checked = true;
|
||||
}
|
||||
},
|
||||
clear: function() {
|
||||
inputs = document.getElementsByTagName("input");
|
||||
for(var b = 0; b < inputs.length; b++) {
|
||||
if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
|
||||
inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
|
||||
} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
|
||||
inputs[b].previousSibling.style.backgroundPosition = "0 0";
|
||||
} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
|
||||
inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
|
||||
} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
|
||||
inputs[b].previousSibling.style.backgroundPosition = "0 0";
|
||||
}
|
||||
}
|
||||
},
|
||||
choose: function() {
|
||||
option = this.getElementsByTagName("option");
|
||||
for(d = 0; d < option.length; d++) {
|
||||
if(option[d].selected == true) {
|
||||
//
|
||||
var expr = '#select-' + this.id;
|
||||
fb.log(expr);
|
||||
$(expr).text(option[d].childNodes[0].nodeValue);
|
||||
// bad!
|
||||
//document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
window.onload = Custom.init;
|
||||
/*
|
||||
|
||||
CUSTOM FORM ELEMENTS
|
||||
|
||||
Created by Ryan Fait
|
||||
www.ryanfait.com
|
||||
|
||||
The only things you may need to change in this file are the following
|
||||
variables: checkboxHeight, radioHeight and selectWidth (lines 24, 25, 26)
|
||||
|
||||
The numbers you set for checkboxHeight and radioHeight should be one quarter
|
||||
of the total height of the image want to use for checkboxes and radio
|
||||
buttons. Both images should contain the four stages of both inputs stacked
|
||||
on top of each other in this order: unchecked, unchecked-clicked, checked,
|
||||
checked-clicked.
|
||||
|
||||
You may need to adjust your images a bit if there is a slight vertical
|
||||
movement during the different stages of the button activation.
|
||||
|
||||
The value of selectWidth should be the width of your select list image.
|
||||
|
||||
Visit http://ryanfait.com/ for more information.
|
||||
|
||||
*/
|
||||
|
||||
var checkboxHeight = "25";
|
||||
var radioHeight = "25";
|
||||
var selectWidth = "230";
|
||||
|
||||
|
||||
/* No need to change anything after this */
|
||||
|
||||
|
||||
document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } .disabled { opacity: 0.5; filter: alpha(opacity=50); }</style>');
|
||||
|
||||
var Custom = {
|
||||
init: function() {
|
||||
var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
|
||||
for(a = 0; a < inputs.length; a++) {
|
||||
if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && $(inputs[a]).hasClass("styled") && !$(inputs[a]).hasClass("style-applied")) {
|
||||
$(inputs[a]).addClass('style-applied');
|
||||
span[a] = document.createElement("span");
|
||||
span[a].className = inputs[a].type;
|
||||
if ($(inputs[a]).attr('class').indexOf('do_action_toggle_suspend') != -1) {
|
||||
span[a].className += ' do_action_toggle_suspend'; // save toggle functionality
|
||||
}
|
||||
if ($(inputs[a]).attr('class').indexOf('do_action_toggle_batch_selector') != -1) {
|
||||
span[a].className += ' do_action_toggle_batch_selector'; // save toggle functionality
|
||||
}
|
||||
if ($(inputs[a]).attr('class').indexOf('do_action_toggle_ssl_support') != -1) {
|
||||
span[a].className += ' do_action_toggle_ssl_support'; // save toggle functionality
|
||||
}
|
||||
|
||||
|
||||
if(inputs[a].checked == true) {
|
||||
if(inputs[a].type == "checkbox") {
|
||||
position = "0 -" + (checkboxHeight*2) + "px";
|
||||
span[a].style.backgroundPosition = position;
|
||||
} else {
|
||||
position = "0 -" + (radioHeight*2) + "px";
|
||||
span[a].style.backgroundPosition = position;
|
||||
}
|
||||
}
|
||||
inputs[a].parentNode.insertBefore(span[a], inputs[a]);
|
||||
inputs[a].onchange = Custom.clear;
|
||||
if(!inputs[a].getAttribute("disabled")) {
|
||||
span[a].onmousedown = Custom.pushed;
|
||||
span[a].onmouseup = Custom.check;
|
||||
} else {
|
||||
span[a].className = span[a].className += " disabled";
|
||||
}
|
||||
}
|
||||
}
|
||||
inputs = document.getElementsByTagName("select");
|
||||
try {
|
||||
for(a = 0; a < inputs.length; a++) {
|
||||
if($(inputs[a]).hasClass("styled")) {
|
||||
option = inputs[a].getElementsByTagName("option");
|
||||
active = option[0].childNodes[0].nodeValue;
|
||||
textnode = document.createTextNode(active);
|
||||
for(b = 0; b < option.length; b++) {
|
||||
if(option[b].selected == true) {
|
||||
textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
|
||||
}
|
||||
}
|
||||
span[a] = document.createElement("span");
|
||||
span[a].className = "select";
|
||||
span[a].id = "select-" + inputs[a].name + a;
|
||||
span[a].appendChild(textnode);
|
||||
inputs[a].parentNode.insertBefore(span[a], inputs[a]);
|
||||
inputs[a].id = inputs[a].name + a;
|
||||
if(!inputs[a].getAttribute("disabled")) {
|
||||
inputs[a].onchange = Custom.choose;
|
||||
} else {
|
||||
inputs[a].previousSibling.className = inputs[a].previousSibling.className += " disabled";
|
||||
}
|
||||
}
|
||||
}
|
||||
document.onmouseup = Custom.clear;
|
||||
}
|
||||
catch(e){ /* */ }
|
||||
},
|
||||
pushed: function() {
|
||||
element = this.nextSibling;
|
||||
if(element.checked == true && element.type == "checkbox") {
|
||||
this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
|
||||
} else if(element.checked == true && element.type == "radio") {
|
||||
this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
|
||||
} else if(element.checked != true && element.type == "checkbox") {
|
||||
this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
|
||||
} else {
|
||||
this.style.backgroundPosition = "0 -" + radioHeight + "px";
|
||||
}
|
||||
},
|
||||
check: function() {
|
||||
element = this.nextSibling;
|
||||
if(element.checked == true && element.type == "checkbox") {
|
||||
this.style.backgroundPosition = "0 0";
|
||||
element.checked = false;
|
||||
} else {
|
||||
if(element.type == "checkbox") {
|
||||
this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
|
||||
} else {
|
||||
this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
|
||||
group = this.nextSibling.name;
|
||||
inputs = document.getElementsByTagName("input");
|
||||
for(a = 0; a < inputs.length; a++) {
|
||||
if(inputs[a].name == group && inputs[a] != this.nextSibling) {
|
||||
inputs[a].previousSibling.style.backgroundPosition = "0 0";
|
||||
}
|
||||
}
|
||||
}
|
||||
element.checked = true;
|
||||
}
|
||||
},
|
||||
clear: function() {
|
||||
inputs = document.getElementsByTagName("input");
|
||||
for(var b = 0; b < inputs.length; b++) {
|
||||
if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
|
||||
inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
|
||||
} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
|
||||
inputs[b].previousSibling.style.backgroundPosition = "0 0";
|
||||
} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
|
||||
inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
|
||||
} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
|
||||
inputs[b].previousSibling.style.backgroundPosition = "0 0";
|
||||
}
|
||||
}
|
||||
},
|
||||
choose: function() {
|
||||
option = this.getElementsByTagName("option");
|
||||
for(d = 0; d < option.length; d++) {
|
||||
if(option[d].selected == true) {
|
||||
//
|
||||
var expr = '#select-' + this.id;
|
||||
fb.log(expr);
|
||||
$(expr).text(option[d].childNodes[0].nodeValue);
|
||||
// bad!
|
||||
//document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
window.onload = Custom.init;
|
||||
|
|
|
@ -70,7 +70,8 @@ App.Pages.USER.new_entry = function(evt)
|
|||
$(box).find('.suspended').addClass('hidden');
|
||||
App.Ref.CONTENT.prepend($(box).html());
|
||||
App.Helpers.updateScreen();
|
||||
$('#'+form_id).find('.ns-entry, .additional-ns-add').addClass('hidden');
|
||||
$('#'+form_id).find('.ns-entry, .additional-ns-add').addClass('hidden').find('.rule-required').removeClass('rule-required');
|
||||
$('#'+form_id).find('.shell-entry').addClass('hidden');
|
||||
}
|
||||
|
||||
App.Pages.WEB_DOMAIN.new_entry = function(evt)
|
||||
|
|
|
@ -138,20 +138,20 @@ App.Templates.html = {
|
|||
</div>\
|
||||
<div class="form-row dns-template-box cc">\
|
||||
<label for="#" class="field-label">Template:</label>\
|
||||
<span class="select" id="selecttemplate">~!:TPL_DEFAULT_VALUE~!</span>\
|
||||
<span class="select" id="selecttemplate">~!:TPL_DEFAULT_VALUE~! t </span>\
|
||||
<select name="TPL" class="styled tpl-item">\
|
||||
~!:TPL~!\
|
||||
</select>\
|
||||
<span class="context-settings do_action_view_dns_template_settings">View template settings</span>\
|
||||
</div>\
|
||||
<div class="form-row cc">\
|
||||
<!-- div class="form-row cc">\
|
||||
<label for="#" class="field-label">TTL:</label>\
|
||||
<input type="text" value="~!:TTL~!" name="TTL" class="text-field ttl-field rule-required rule-numeric">\
|
||||
</div>\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">SOA:</label>\
|
||||
<input type="text" value="~!:SOA~!" name="SOA" class="text-field rule-required rule-ns">\
|
||||
</div>\
|
||||
</div -->\
|
||||
<div class="form-row suspended cc">\
|
||||
<label for="#" class="field-label">Suspended:</label>\
|
||||
<input type="checkbox" ~!:SUSPENDED_CHECKED~! value="~!:SUSPENDED_VALUE~!" class="styled do_action_toggle_suspend" name="SUSPEND" />\
|
||||
|
@ -241,7 +241,7 @@ App.Templates.html = {
|
|||
<label for="#" class="field-label">value:</label>\
|
||||
<input type="text" value="~!:RECORD_VALUE~!" name="RECORD_VALUE" class="text-field">\
|
||||
</div>\
|
||||
<div class="delete-record do_action_delete_subentry"></div>\
|
||||
<!-- div class="delete-record do_action_delete_subentry"></div -->\
|
||||
</div>']
|
||||
},
|
||||
ip: {
|
||||
|
@ -286,10 +286,10 @@ App.Templates.html = {
|
|||
<label for="#" class="field-label">Associated DNS Name:</label>\
|
||||
<input type="text" name="NAME" value="~!:NAME~!" class="text-field rule-domain">\
|
||||
</div>\
|
||||
<div class="form-row suspended cc">\
|
||||
<!-- div class="form-row suspended cc">\
|
||||
<label for="#" class="field-label">Suspended:</label>\
|
||||
<input type="checkbox" ~!:SUSPENDED_CHECKED~! value="~!:SUSPENDED_VALUE~!" class="styled do_action_toggle_suspend" name="SUSPEND"/>\
|
||||
</div>\
|
||||
</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>\
|
||||
|
@ -403,7 +403,7 @@ App.Templates.html = {
|
|||
~!:PACKAGE_OPTIONS~!\
|
||||
</select>\
|
||||
</div>\
|
||||
<div class="form-row cc">\
|
||||
<div class="form-row shell-entry cc">\
|
||||
<label for="#" class="field-label">Shell:</label>\
|
||||
<select class="styled disabled" name="SHELL">\
|
||||
~!:SHELL_OPTIONS~!\
|
||||
|
@ -474,9 +474,9 @@ App.Templates.html = {
|
|||
<span class="prop-value">~!:FULLNAME~!</span>\
|
||||
</span>\ </div>\
|
||||
<div class="user-details-box">\
|
||||
<span class="prop-box prop-box_group-values cc user-details do_action_login_as">\
|
||||
<!-- span class="prop-box prop-box_group-values cc user-details do_action_login_as">\
|
||||
<span class="prop-value login-as do_action_login_as">login as</span>\
|
||||
</span>\
|
||||
</span -->\
|
||||
<span class="prop-box prop-box_group-values cc user-details">\
|
||||
<span class="prop-title">email:</span>\
|
||||
<span class="group-values">\
|
||||
|
@ -641,10 +641,10 @@ App.Templates.html = {
|
|||
<label for="#" class="field-label">Domain Aliases:</label>\
|
||||
<textarea name="ALIAS" class="textarea rule-alias">~!:ALIAS~!</textarea>\
|
||||
</div>\
|
||||
<div class="form-row cc">\
|
||||
<!-- div class="form-row cc">\
|
||||
<label for="#" class="field-label">Nginx extensions:</label>\
|
||||
<textarea name="NGINX_EXT" class="textarea rule-list">~!:NGINX_EXT~!</textarea>\
|
||||
</div>\
|
||||
</div -->\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">Statistics:</label>\
|
||||
<select name="STAT" class="styled">~!:STAT_OPTIONS~!</select>\
|
||||
|
@ -716,7 +716,7 @@ App.Templates.html = {
|
|||
</div>\
|
||||
</div><!-- Mail options -->\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">create DNS domain:</label>\
|
||||
<label for="#" class="field-label">Create DNS domain also:</label>\
|
||||
<input type="checkbox" value="" name="DNS_DOMAIN" class="styled">\
|
||||
</div>\
|
||||
<div class="form-row buttons-row cc">\
|
||||
|
@ -846,7 +846,7 @@ App.Templates.html = {
|
|||
<select name="TYPE" class="styled">~!:TYPE_OPTIONS~!</select>\
|
||||
</div>\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">Name:</label>\
|
||||
<label for="#" class="field-label">DB name:</label>\
|
||||
<input type="text" class="text-field" name="DB" value="~!:DB~!">\
|
||||
</div>\
|
||||
<div class="db-credentials ">\
|
||||
|
@ -860,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 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="ENCODING" class="styled">~!:ENCODING_OPTIONS~!</select>\
|
||||
<label for="#" class="field-label">Character Set:</label>\
|
||||
<select name="CHARSET" class="styled">~!:CHARSET_OPTIONS~!</select>\
|
||||
</div>\
|
||||
<div class="form-row suspended cc">\
|
||||
<label for="#" class="field-label">Suspended:</label>\
|
||||
|
@ -913,8 +913,8 @@ App.Templates.html = {
|
|||
<div class="props-ext">\
|
||||
<!-- span class="backup-db do_action_backup_db">backup</span-->\
|
||||
<span class="prop-box">\
|
||||
<span class="prop-title">encoding:</span>\
|
||||
<span class="prop-value">~!:ENCODING~!</span>\
|
||||
<span class="prop-title">Character Set:</span>\
|
||||
<span class="prop-value">~!:CHARSET~!</span>\
|
||||
</span>\
|
||||
<!-- disk usage block -->\
|
||||
<div class="b-usage-box disk-usage cc">\
|
||||
|
@ -1075,13 +1075,13 @@ App.Templates.html = {
|
|||
<a class="backup-url" href="return alert(\'Not available at the time\');">download</a>\
|
||||
</div>\
|
||||
<div class="props-ext">\
|
||||
<div class="backup-actions">\
|
||||
<!-- div class="backup-actions">\
|
||||
<a class="backup-actions-url restore-url" href="return alert(\'Not available at the time\');">restore</a>\
|
||||
<a class="backup-actions-url detailed-restore-url" href="return alert(\'Not available at the time\');">\
|
||||
<span class="detailed-restore-title">detailed</span>\
|
||||
<span class="detailed-restore-ext">restore</span>\
|
||||
</a>\
|
||||
</div>\
|
||||
</div -->\
|
||||
</div> \
|
||||
</div><!-- // .row-details -->\
|
||||
</div><!-- // .row 1 -->']
|
||||
|
|
1151
web/js/templates_admin.js
Normal file
1151
web/js/templates_admin.js
Normal file
File diff suppressed because it is too large
Load diff
1151
web/js/user_templates.js
Normal file
1151
web/js/user_templates.js
Normal file
File diff suppressed because it is too large
Load diff
|
@ -132,18 +132,20 @@ class CRON extends AjaxHandler
|
|||
$_new = $request->getParameter('new');
|
||||
$result = array();
|
||||
|
||||
if($_new['SUSPEND'] == 'on') {
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_CRON_JOB, array('USER' => $user['uid'], 'JOB' => $_new['CMD']));
|
||||
return $this->reply($result['status']);
|
||||
}
|
||||
else {
|
||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_CRON_JOB, array('USER' => $user['uid'], 'JOB' => $_new['CMD']));
|
||||
}
|
||||
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['SUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
$result = array();
|
||||
if(@Utils::getCheckboxBooleanValue($_new['SUSPEND'])){
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_CRON_JOB, array('USER' => $user['uid'], 'JOB' => $_old['JOB']));
|
||||
return $this->reply($result['status'], $result['error_message']);
|
||||
}
|
||||
elseif(@Utils::getCheckboxBooleanValue($_old['SUSPEND'])){
|
||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_CRON_JOB, array('USER' => $user['uid'], 'JOB' => $_old['JOB']));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['UNSUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
return $this->reply($result['status'], $result['error_message']);
|
||||
}
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'USER' => $user['uid'],
|
||||
|
|
|
@ -38,6 +38,7 @@ class DB extends AjaxHandler
|
|||
'TYPE' => $record['TYPE'],
|
||||
'U_DISK' => $record['U_DISK'],
|
||||
'DISK' => 2024,
|
||||
'CHARSET' => strtolower($record['CHARSET']),
|
||||
'SUSPEND' => $record['SUSPEND'],
|
||||
'DATE' => date(Config::get('ui_date_format', strtotime($record['DATE'])))
|
||||
);
|
||||
|
@ -65,7 +66,9 @@ class DB extends AjaxHandler
|
|||
'DB' => $_s['DB'],
|
||||
'DB_USER' => $_s['USER'],
|
||||
'DB_PASSWORD' => $_s['PASSWORD'],
|
||||
'TYPE' => $_s['TYPE']
|
||||
'TYPE' => $_s['TYPE'],
|
||||
'HOST' => $_s['HOST'],
|
||||
'CHARSET' => $_s['CHARSET']
|
||||
);
|
||||
|
||||
$result = Vesta::execute(Vesta::V_ADD_DB_BASE, $params);
|
||||
|
@ -74,7 +77,7 @@ class DB extends AjaxHandler
|
|||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
|
||||
if ($_s['SUSPEND'] == 'on') {
|
||||
if (Utils::getCheckboxBooleanValue($_s['SUSPEND'])) {
|
||||
if($result['status']){
|
||||
$result = array();
|
||||
|
||||
|
@ -86,7 +89,6 @@ class DB extends AjaxHandler
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return $this->reply($result['status'], $result['data']);
|
||||
}
|
||||
|
||||
|
@ -128,16 +130,19 @@ class DB extends AjaxHandler
|
|||
|
||||
$user = $this->getLoggedUser();
|
||||
$result = array();
|
||||
if($_new['SUSPEND'] == 'on'){
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_DB_BASE, array('USER' => $user['uid'], 'DB' => $_new['DB']));
|
||||
}
|
||||
else{
|
||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_DB_BASE, array('USER' => $user['uid'], 'DB' => $_new['DB']));
|
||||
}
|
||||
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['SUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
$result = array();
|
||||
if(@Utils::getCheckboxBooleanValue($_new['SUSPEND'])){
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_DB_BASE, array('USER' => $user['uid'], 'DB' => $_new['DB']));
|
||||
return $this->reply($result['status'], $result['error_message']);
|
||||
}
|
||||
elseif(@Utils::getCheckboxBooleanValue($_old['SUSPEND'])){
|
||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_DB_BASE, array('USER' => $user['uid'], 'DB' => $_new['DB']));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['UNSUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
return $this->reply($result['status'], $result['error_message']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($_new['PASSWORD'] != Vesta::SAME_PASSWORD && $_new['PASSWORD'] != $_old['PASSWORD']) {
|
||||
|
|
|
@ -97,22 +97,13 @@ class DNS extends AjaxHandler
|
|||
$_s = $request->getParameter('spell');
|
||||
$params = array(
|
||||
'USER' => $user['uid'], /// OWNER ???
|
||||
'DNS_DOMAIN' => $_s['DNS_DOMAIN'],
|
||||
'IP' => $_s['IP']
|
||||
);
|
||||
// TODO: rewrite this block. Get away from if/if/if/if
|
||||
if ($_s['TPL']) {
|
||||
$params['TPL'] = $_s['TPL'];
|
||||
}
|
||||
if ($_s['EXP']) {
|
||||
$params['EXP'] = $_s['EXP'];
|
||||
}
|
||||
if ($_s['SOA']) {
|
||||
$params['SOA'] = $_s['SOA'];
|
||||
}
|
||||
if ($_s['TTL']) {
|
||||
$params['TTL'] = $_s['TTL'];
|
||||
}
|
||||
'DNS_DOMAIN' => $_s['DNS_DOMAIN'],
|
||||
'IP' => $_s['IP'],
|
||||
'TPL' => $_s['TPL'],
|
||||
'EXP' => $_s['EXP'],
|
||||
'SOA' => $_s['SOA'],
|
||||
'TTL' => $_s['TTL']
|
||||
);
|
||||
|
||||
$result = Vesta::execute(Vesta::V_ADD_DNS_DOMAIN, $params);
|
||||
if (!$result['status']) {
|
||||
|
@ -120,7 +111,7 @@ class DNS extends AjaxHandler
|
|||
}
|
||||
|
||||
|
||||
if ($_s['SUSPEND'] == 'on') {
|
||||
if (@Utils::getCheckboxBooleanValue($_s['SUSPEND'])) {
|
||||
if($result['status']){
|
||||
$result = array();
|
||||
|
||||
|
@ -242,19 +233,19 @@ class DNS extends AjaxHandler
|
|||
$_DNS_DOMAIN = $_old['DNS_DOMAIN'];
|
||||
|
||||
$result = array();
|
||||
if($_new['SUSPEND'] == 'on'){
|
||||
if(@Utils::getCheckboxBooleanValue($_new['SUSPEND'])){
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_DNS_DOMAIN, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_DNS_DOMAIN));
|
||||
return $this->reply($result['status']);
|
||||
return $this->reply($result['status'], $result['error_message']);
|
||||
}
|
||||
else{
|
||||
elseif(@Utils::getCheckboxBooleanValue($_old['SUSPEND'])){
|
||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_DNS_DOMAIN, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_DNS_DOMAIN));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['UNSUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
return $this->reply($result['status'], $result['error_message']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['SUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
|
||||
if ($_old['IP'] != $_new['IP']) {
|
||||
$result = array();
|
||||
|
||||
|
@ -267,7 +258,7 @@ class DNS extends AjaxHandler
|
|||
|
||||
if ($_old['TPL'] != $_new['TPL']) {
|
||||
$result = array();
|
||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TPL, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['TPL']));
|
||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TPL, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_DNS_DOMAIN, 'TPL' => $_new['TPL']));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['TPL'] = array($result['error_code'] => $result['error_message']);
|
||||
|
@ -275,8 +266,9 @@ class DNS extends AjaxHandler
|
|||
}
|
||||
|
||||
if ($_old['TTL'] != $_new['TTL']) {
|
||||
echo 'changing ttl';
|
||||
$result = array();
|
||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TTL, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['TTL']));
|
||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TTL, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_DNS_DOMAIN, 'TTL' => $_new['TTL']));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['TTL'] = array($result['error_code'] => $result['error_message']);
|
||||
|
@ -285,7 +277,7 @@ class DNS extends AjaxHandler
|
|||
|
||||
if ($_old['EXP'] != $_new['EXP']) {
|
||||
$result = array();
|
||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_EXP, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['EXP']));
|
||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_EXP, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_DNS_DOMAIN, 'EXP' => $_new['EXP']));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['EXP'] = array($result['error_code'] => $result['error_message']);
|
||||
|
@ -294,7 +286,7 @@ class DNS extends AjaxHandler
|
|||
|
||||
if ($_old['SOA'] != $_new['SOA']) {
|
||||
$result = array();
|
||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_SOA, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_new['DNS_DOMAIN'], 'IP' => $_new['SOA']));
|
||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_SOA, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_new['DNS_DOMAIN'], 'SOA' => $_new['SOA']));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['SOA'] = array($result['error_code'] => $result['error_message']);
|
||||
|
@ -307,13 +299,6 @@ class DNS extends AjaxHandler
|
|||
Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TTL, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_old['TTL']));
|
||||
Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_EXP, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_old['EXP']));
|
||||
Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_SOA, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_new['DNS_DOMAIN'], 'IP' => $_old['SOA']));
|
||||
|
||||
if($_old['SUSPEND'] == 'on'){
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_DNS_DOMAIN, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_DNS_DOMAIN));
|
||||
}
|
||||
else{
|
||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_DNS_DOMAIN, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_DNS_DOMAIN));
|
||||
}
|
||||
}
|
||||
|
||||
return $this->reply($this->status, '');
|
||||
|
@ -432,7 +417,7 @@ class DNS extends AjaxHandler
|
|||
$_entities = $request->getParameter('entities');
|
||||
|
||||
foreach($_entities as $entity){
|
||||
$result = Vesta::execute(Vesta::V_UNUSPEND_DNS_DOMAIN, array('USER' => $user['uid'], $entity['DNS_DOMAIN']));
|
||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_DNS_DOMAIN, array('USER' => $user['uid'], $entity['DNS_DOMAIN']));
|
||||
}
|
||||
|
||||
return $this->reply($result['status'], $result['data']);
|
||||
|
|
|
@ -19,6 +19,10 @@ class IP extends AjaxHandler
|
|||
*/
|
||||
public function getListExecute(Request $request)
|
||||
{
|
||||
if(!VestaSession::getUserRole()){
|
||||
return self::getListUserIpsExecute($request);
|
||||
}
|
||||
|
||||
$reply = array();
|
||||
$result = Vesta::execute(Vesta::V_LIST_SYS_IPS, array(Config::get('response_type')));
|
||||
foreach ($result['data'] as $ip => $details) {
|
||||
|
@ -44,8 +48,10 @@ class IP extends AjaxHandler
|
|||
*/
|
||||
public function getListUserIpsExecute(Request $request)
|
||||
{
|
||||
$user = $this->getLoggedUser();
|
||||
|
||||
$reply = array();
|
||||
$result = Vesta::execute(Vesta::V_LIST_USER_IPS, array(Config::get('response_type')));
|
||||
$result = Vesta::execute(Vesta::V_LIST_USER_IPS, array($user['uid'], Config::get('response_type')));
|
||||
foreach ($result['data'] as $ip => $details) {
|
||||
$reply[] = array_merge(
|
||||
array(
|
||||
|
|
|
@ -218,7 +218,7 @@ MAIL;
|
|||
$disk_quota = $rs['data'];
|
||||
|
||||
$reply = array(
|
||||
'auth_user' => array('uid' => $this->getLoggedUser()),
|
||||
'auth_user' => array('uid' => $this->getLoggedUser(), 'admin' => !!VestaSession::getUserRole()),
|
||||
'user_data' => array('BANDWIDTH' => (int)$bandwidth, 'DISK_QUOTA' => (int)$disk_quota),
|
||||
'WEB_DOMAIN' => $this->getWebDomainParams($data_web_domain, $global_data),
|
||||
'CRON' => $this->getCronParams(),
|
||||
|
@ -370,15 +370,76 @@ MAIL;
|
|||
public function getDbParams($data = array())
|
||||
{
|
||||
$db_types = $this->getDBTypes();
|
||||
$db_hosts = $this->getDBHosts();
|
||||
$result = Vesta::execute(Vesta::V_LIST_DNS_TEMPLATES, null, self::JSON);
|
||||
return array(
|
||||
'TYPE' => $db_types,
|
||||
'HOST' => array('vestacp.com' => 'vestacp.com', 'askcow.org' => 'askcow.org')
|
||||
'TYPE' => $db_types,
|
||||
'HOST' => $db_hosts,
|
||||
'CHARSET' => array(
|
||||
'utf8' => 'utf8', 'latin1' => 'latin1', 'cp1251' => 'cp1251'
|
||||
/*
|
||||
'' => '',
|
||||
|
||||
'big5' => 'Big5 — Traditional Chinese ',
|
||||
'dec8' => 'dec8 — DEC West European ',
|
||||
'cp850' => 'cp850 — DOS West European',
|
||||
'hp8' => 'hp8 — HP West European',
|
||||
'koi8r' => 'koi8r — KOI8-R Relcom Russian',
|
||||
'latin1' => 'latin1 — cp1252 West European',
|
||||
'latin2' => 'latin2 — ISO 8859-2 Central European',
|
||||
'swe7' => 'swe7 — 7bit Swedish',
|
||||
'ascii' => 'ascii — US ASCII',
|
||||
'ujis' => 'ujis — EUC-JP Japanese',
|
||||
'sjis' => 'sjis — Shift-JIS Japanese',
|
||||
'hebrew' => 'hebrew — ISO 8859-8 Hebrew',
|
||||
'tis620' => 'tis620 — TIS620 Thai',
|
||||
'euckr' => 'euckr — EUC-KR Korean',
|
||||
'koi8u' => 'koi8u — KOI8-U Ukrainian',
|
||||
'gb2312' => 'gb2312 — GB2312 Simplified Chinese',
|
||||
'greek' => 'greek — ISO 8859-7 Greek',
|
||||
'cp1250' => 'cp1250 — Windows Central European',
|
||||
'gbk' => 'gbk — GBK Simplified Chinese',
|
||||
'latin5' => 'latin5 — ISO 8859-9 Turkish',
|
||||
'armscii8' => 'armscii8— ARMSCII-8 Armenian',
|
||||
'utf8' => 'utf8 — UTF-8 Unicode',
|
||||
'ucs2' => 'ucs2 — UCS-2 Unicode',
|
||||
'cp866' => 'cp866 — DOS Russian',
|
||||
'keybcs2' => 'keybcs2 — DOS Kamenicky Czech-Slovak',
|
||||
'macce' => 'macce — Mac Central European',
|
||||
'macroman' => 'macroman— Mac West European',
|
||||
'cp853' => 'cp852 — DOS Central European',
|
||||
'latin7' => 'latin7 — ISO 8859-13 Baltic',
|
||||
'cp1251' => 'cp1251 — Windows Cyrillic',
|
||||
'cp1256' => 'cp1256 — Windows Arabic',
|
||||
'cp1257' => 'cp1257 — Windows Baltic',
|
||||
'binary' => 'binary — Binary pseudo charset',
|
||||
'geostd8' => 'geostd8 — GEOSTD8 Georgian',
|
||||
'cp932' => 'cp932 — SJIS for Windows Japanese',
|
||||
'eucjpms' => 'eucjpms — UJIS for Windows Japanese'
|
||||
*/
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getDBTypes()
|
||||
{
|
||||
return array('mysql' => 'mysql', 'postgre' => 'postgre');
|
||||
return array('mysql' => 'MySQL', 'pgsql' => 'PostgreSQL');
|
||||
}
|
||||
|
||||
public function getDBHosts()
|
||||
{
|
||||
|
||||
return array('localhost' => 'localhost');
|
||||
foreach($this->getDBTypes() as $type => $type_name){
|
||||
$result = Vesta::execute(Vesta::V_LIST_DB_HOSTS, $type, self::JSON);
|
||||
foreach ($result['data'] as $host_name => $host_data) {
|
||||
if (Utils::getCheckboxBooleanValue($host_data['ACTIVE'])) {
|
||||
$hosts[$host_name] = $type_name .' – '. $host_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $hosts;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,13 +45,13 @@ class USER extends AjaxHandler
|
|||
"DNS_DOMAINS" => $details['DNS_DOMAINS'],
|
||||
"DISK_QUOTA" => $details['DISK_QUOTA'],
|
||||
"BANDWIDTH" => $details['BANDWIDTH'],
|
||||
// "NS" => $details['NS'],
|
||||
"SHELL" => $details['SHELL'],
|
||||
"BACKUPS" => $details['BACKUPS'],
|
||||
"WEB_TPL" => $details['WEB_TPL'],
|
||||
"SUSPEND" => $details['SUSPENDED'],
|
||||
"CONTACT" => $details['CONTACT'],
|
||||
"REPORTS" => $details['REPORTS'],
|
||||
"REPORTS_ENABLED" => $details['REPORTS'],
|
||||
"IP_OWNED" => $details['IP_OWNED'],
|
||||
"U_DIR_DISK" => $details['U_DIR_DISK'],
|
||||
"U_DISK" => $details['U_DISK'],
|
||||
|
@ -65,7 +65,8 @@ class USER extends AjaxHandler
|
|||
"U_MAIL_FORWARDERS" => '0',
|
||||
"U_MAIL_BOXES" => '0',
|
||||
"U_CRON_JOBS" => $details['U_CRON_JOBS'],
|
||||
"IP_OWNED" => $details['IP_OWNED']
|
||||
"IP_OWNED" => $details['IP_OWNED'],
|
||||
"NGINX_EXT" => $details['"NGINX_EXT']
|
||||
);
|
||||
$reply[$user] = array_merge($user_details, $nses);
|
||||
// $reply[$user] = $user_details;
|
||||
|
@ -132,33 +133,42 @@ class USER extends AjaxHandler
|
|||
*/
|
||||
public function addExecute(Request $request)
|
||||
{
|
||||
$spell = $request->getParameter('spell');
|
||||
$_s = $request->getParameter('spell');
|
||||
$user = $this->getLoggedUser();
|
||||
$params = array(
|
||||
'USER' => $spell['LOGIN_NAME'],
|
||||
'PASSWORD' => $spell['PASSWORD'],
|
||||
'EMAIL' => $spell['CONTACT'],
|
||||
'PACKAGE' => $spell['PACKAGE'],
|
||||
'FNAME' => $spell['FNAME'],
|
||||
'LNAME' => $spell['LNAME']
|
||||
'USER' => $_s['LOGIN_NAME'],
|
||||
'PASSWORD' => $_s['PASSWORD'],
|
||||
'EMAIL' => $_s['CONTACT'],
|
||||
'PACKAGE' => $_s['PACKAGE'],
|
||||
'FNAME' => $_s['FNAME'],
|
||||
'LNAME' => $_s['LNAME']
|
||||
);
|
||||
|
||||
$result = Vesta::execute(Vesta::V_ADD_SYS_USER, $params);
|
||||
// Reports
|
||||
$enable_reports = Utils::getCheckboxBooleanValue($spell['REPORTS_ENABLED']);
|
||||
$reports_result = $this->setUserReports($spell['LOGIN_NAME'], $spell['REPORTS_ENABLED']);
|
||||
// $enable_reports = Utils::getCheckboxBooleanValue($spell['REPORTS_ENABLED']);
|
||||
// $reports_result = $this->setUserReports($spell['LOGIN_NAME'], $spell['REPORTS_ENABLED']);
|
||||
// Set SHELL
|
||||
$this->setShell($spell['LOGIN_NAME'], $spell['SHELL']);
|
||||
// $this->setShell($_s['LOGIN_NAME'], $_s['SHELL']);
|
||||
|
||||
if (!$result['status']) {
|
||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
|
||||
if(@Utils::getCheckboxBooleanValue($_s['REPORTS_ENABLED'])){
|
||||
$result = Vesta::execute(Vesta::V_ADD_SYS_USER_REPORTS, array('USER' => $_USER));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['REPORTS'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($_s['SUSPEND'] == 'on') {
|
||||
if($result['status']){
|
||||
$result = array();
|
||||
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_SYS_USER, array('USER' => $user['uid'], 'USER' => $spell['LOGIN_NAME']));
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_SYS_USER, array('USER' => $user['uid'], 'USER' => $_s['LOGIN_NAME']));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['SUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
|
@ -204,7 +214,22 @@ class USER extends AjaxHandler
|
|||
$_old = $request->getParameter('old');
|
||||
|
||||
$_USER = $_old['LOGIN_NAME'];
|
||||
|
||||
|
||||
|
||||
$result = array();
|
||||
if(@Utils::getCheckboxBooleanValue($_new['SUSPEND'])){
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_SYS_USER, array('USER' => $_USER));
|
||||
return $this->reply($result['status'], $result['error_message']);
|
||||
}
|
||||
elseif(@Utils::getCheckboxBooleanValue($_old['SUSPEND'])){
|
||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_SYS_USER, array('USER' => $_USER));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['UNSUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
return $this->reply($result['status'], $result['error_message']);
|
||||
}
|
||||
}
|
||||
|
||||
$reports_result = $this->setUserReports($_USER, $_new['REPORTS_ENABLED']);
|
||||
|
||||
if (!empty($_new['PASSWORD']) && $_new['PASSWORD'] != Vesta::SAME_PASSWORD) {
|
||||
|
@ -234,6 +259,20 @@ class USER extends AjaxHandler
|
|||
}
|
||||
}
|
||||
|
||||
if ($_old['REPORTS_ENABLED'] != $_new['REPORTS_ENABLED']) {
|
||||
$result = array();
|
||||
if(@Utils::getCheckboxBooleanValue($_new['REPORTS_ENABLED'])){
|
||||
$result = Vesta::execute(Vesta::V_ADD_SYS_USER_REPORTS, array('USER' => $_USER));
|
||||
}
|
||||
else{
|
||||
$result = Vesta::execute(Vesta::V_ADD_SYS_USER_REPORTS, array('USER' => $_USER));
|
||||
}
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['REPORTS'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}
|
||||
|
||||
// Set SHELL
|
||||
$this->setShell($_USER, $_new['SHELL']);
|
||||
|
||||
|
@ -251,38 +290,12 @@ class USER extends AjaxHandler
|
|||
$this->errors['NAMES'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($_old['SUSPEND'] != $_new['SUSPEND']) {
|
||||
$result = array();
|
||||
if($_new['SUSPEND'] == 'on'){
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_SYS_USER, array('USER' => $_USER));
|
||||
}
|
||||
else{
|
||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_SYS_USER, array('USER' => $_USER));
|
||||
}
|
||||
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['SUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->status) {
|
||||
Vesta::execute(Vesta::V_CHANGE_SYS_USER_PASSWORD, array('USER' => $_USER, 'PASSWORD' => $_old['PASSWORD']));
|
||||
Vesta::execute(Vesta::V_CHANGE_SYS_USER_PACKAGE, array('USER' => $_USER, 'PACKAGE' => $_old['PACKAGE']));
|
||||
Vesta::execute(Vesta::V_CHANGE_SYS_USER_CONTACT, array('USER' => $_USER, 'EMAIL' => $_old['EMAIL']));
|
||||
Vesta::execute(Vesta::V_CHANGE_SYS_USER_NS, array('USER' => $_USER, 'NS1' => $_old['NS1'], 'NS2' => $_old['NS2']));
|
||||
Vesta::execute(Vesta::V_CHANGE_SYS_USER_SHELL, array('USER' => $_USER, 'SHELL' => $_old['SHELL']));
|
||||
|
||||
|
||||
if($_old['SUSPEND'] == 'on'){
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_SYS_USER, array('USER' => $_USER));
|
||||
}
|
||||
else{
|
||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_SYS_USER, array('USER' => $_USER));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->reply($this->status, '');
|
||||
|
|
|
@ -37,13 +37,13 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
'STAT' => $record['STATS'],
|
||||
'STATS_LOGIN' => $record['STATS_AUTH'],
|
||||
'SSL' => $record['SSL'] == 'yes' ? 'on' : 'off',
|
||||
'SSL_HOME' => $record['SSL_HOME'] == 'tsingle' ? 'off' : 'on',
|
||||
'SSL_HOME' => $record['SSL_HOME'] == 'same' ? 'off' : 'on',
|
||||
'SSL_CRT' => '',
|
||||
'SSL_KEY' => '',
|
||||
'SSL_CA' => '',
|
||||
'NGINX' => $record['NGINX'],
|
||||
'NGINX_EXT' => $record['NGINX_EXT'],
|
||||
'SUSPEND' => $record['SUSPEND'] == 'on' ? 'on' : 'off',
|
||||
'SUSPEND' => $record['SUSPEND'], // == 'yes' ? 'on' : 'off',
|
||||
'DATE' => date(Config::get('ui_date_format', strtotime($record['DATE'])))
|
||||
);
|
||||
$web_details['STAT'] == '' ? $web_details['STAT'] = 'none' : true;
|
||||
|
@ -85,6 +85,7 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
|
||||
if (!$result['status']) {
|
||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||
return $this->reply($result['status'], $result['data']);
|
||||
}
|
||||
|
||||
if (!empty($_s['TPL'])) {
|
||||
|
@ -101,9 +102,9 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_s['ALIAS'])) {
|
||||
$alias = str_replace("\n", "", $_s['ALIAS']);
|
||||
$alias = str_replace("\n", "", $alias);
|
||||
$alias_arr = explode(',', str_replace("\n", "", $_s['ALIAS']));
|
||||
|
||||
foreach ($alias_arr as $alias) {
|
||||
$params = array(
|
||||
|
@ -112,7 +113,6 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
'ALIAS' => trim($alias)
|
||||
);
|
||||
$result = 0;
|
||||
|
||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ALIAS, $params);
|
||||
|
||||
if (!$result['status']) {
|
||||
|
@ -121,7 +121,7 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($_s['STATS']) && @$_s['STATS'] != 'none') {
|
||||
if (!empty($_s['STAT']) && @$_s['STAT'] != 'none') {
|
||||
$params = array(
|
||||
'USER' => $user['uid'],
|
||||
'DOMAIN' => $_s['DOMAIN'],
|
||||
|
@ -148,21 +148,31 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
$this->errors['STAT_AUTH'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
|
||||
if (!empty($_new['CGI'])) {
|
||||
if (Utils::getCheckboxBooleanValue($_new['CGI'])) {
|
||||
if (!empty($_s['CGI'])) {
|
||||
if (Utils::getCheckboxBooleanValue($_s['CGI'])) {
|
||||
/* removed due to CGI is set by default at WEB DOMAIN creation
|
||||
$result = array();
|
||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_CGI, array('USER' => $user['uid'], 'DOMAIN' => $_DOMAIN));
|
||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_CGI, array('USER' => $user['uid'], 'DOMAIN' => $_s['DOMAIN']));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['ADD_CGI'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
*/
|
||||
}
|
||||
else{
|
||||
$result = array();
|
||||
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_CGI, array('USER' => $user['uid'], 'DOMAIN' => $_s['DOMAIN']));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['DEL_CGI'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_new['ELOG'])) {
|
||||
if (Utils::getCheckboxBooleanValue($_new['ELOG'])) {
|
||||
if (!empty($_s['ELOG'])) {
|
||||
if (Utils::getCheckboxBooleanValue($_s['ELOG'])) {
|
||||
$result = array();
|
||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ELOG, array('USER' => $user['uid'], 'DOMAIN' => $_DOMAIN));
|
||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ELOG, array('USER' => $user['uid'], 'DOMAIN' => $_s['DOMAIN']));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['ADD_ELOG'] = array($result['error_code'] => $result['error_message']);
|
||||
|
@ -170,16 +180,12 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
}
|
||||
}
|
||||
|
||||
if (($_s['DNS_DOMAIN']) == 'on') {
|
||||
echo 'adding dns domain';
|
||||
echo '<br>';
|
||||
|
||||
$params = array(
|
||||
'USER' => $user['uid'],
|
||||
'DNS_DOMAIN' => $_s['DOMAIN'],
|
||||
'IP' => $_s['IP']
|
||||
);
|
||||
if (Utils::getCheckboxBooleanValue($_s['DNS_DOMAIN'])) {
|
||||
|
||||
echo 'adding dns domain';
|
||||
echo '<br>';
|
||||
|
||||
/*
|
||||
require_once V_ROOT_DIR . 'api/DNS.class.php';
|
||||
|
||||
$dns = new DNS();
|
||||
|
@ -188,6 +194,36 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
if (!$result['status']) {
|
||||
$this->errors['DNS_DOMAIN'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$_GET['debug'] = 2;
|
||||
$params = array(
|
||||
'USER' => $user['uid'],
|
||||
'DNS_DOMAIN' => $_s['DOMAIN'],
|
||||
'IP' => $_s['IP']
|
||||
);
|
||||
|
||||
$result = Vesta::execute(Vesta::V_ADD_DNS_DOMAIN, $params);
|
||||
if (!$result['status']) {
|
||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
|
||||
|
||||
if (@Utils::getCheckboxBooleanValue($_s['SUSPEND'])) {
|
||||
if($result['status']){
|
||||
$result = array();
|
||||
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_DNS_DOMAIN, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_s['DOMAIN']));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['DNS_SUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -209,8 +245,41 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
}*/
|
||||
|
||||
|
||||
|
||||
if ($_s['SUSPEND'] == 'on') {
|
||||
|
||||
if (!empty($_s['SSL_KEY']) && !empty($_s['SSL_CRT']) && $_s['SSL'] == 'on' ) {
|
||||
$ssl_dir = sys_get_temp_dir().'/';
|
||||
|
||||
$ssl_crt_file = $ssl_dir . $_s['DOMAIN'] . '.crt';
|
||||
file_put_contents($ssl_crt_file, $_s['SSL_CRT']);
|
||||
|
||||
$ssl_key_file = $ssl_dir . $_s['DOMAIN'] . '.key';
|
||||
file_put_contents($ssl_key_file, $_s['SSL_KEY']);
|
||||
|
||||
if (!empty($_s['SSL_CA'])) {
|
||||
$ssl_ca_file = $ssl_dir . $_s['DOMAIN'] . '.ca';
|
||||
file_put_contents($ssl_ca_file, $_s['SSL_CA']);
|
||||
}
|
||||
|
||||
// $_GET['debug'] = 2;
|
||||
$params = array(
|
||||
'USER' => $user['uid'],
|
||||
'DOMAIN' => $_s['DOMAIN'],
|
||||
'SSL_DIR' => $ssl_dir,
|
||||
'SSL_HOME' => $_s['SSL_HOME'] == 'on' ? 'single' : 'same'
|
||||
);
|
||||
|
||||
$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']);
|
||||
}
|
||||
|
||||
unlink($ssl_crt_file);
|
||||
unlink($ssl_key_file);
|
||||
unlink($ssl_ca_file);
|
||||
}
|
||||
|
||||
if (@Utils::getCheckboxBooleanValue($_s['SUSPEND'])) {
|
||||
if($result['status']){
|
||||
$result = array();
|
||||
|
||||
|
@ -222,6 +291,7 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return $this->reply($result['status'], $result['data']);
|
||||
}
|
||||
|
||||
|
@ -267,39 +337,20 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
|
||||
$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));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['SUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
// return $this->reply($result['status']);
|
||||
}
|
||||
else {
|
||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_WEB_DOMAIN, array('USER' => $user['uid'], 'DOMAIN' => $_DOMAIN));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['UNSUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}
|
||||
if ($_new['SUSPEND'] == 'on') {
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_WEB_DOMAIN, array('USER' => $user['uid'], 'DOMAIN' => $_DOMAIN));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['SUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
// return $this->reply($result['status']);
|
||||
}
|
||||
else {
|
||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_WEB_DOMAIN, array('USER' => $user['uid'], 'DOMAIN' => $_DOMAIN));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['UNSUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(@Utils::getCheckboxBooleanValue($_new['SUSPEND'])){
|
||||
$result = Vesta::execute(Vesta::V_SUSPEND_WEB_DOMAIN, array('USER' => $user['uid'], 'DOMAIN' => $_DOMAIN));
|
||||
return $this->reply($result['status'], $result['error_message']);
|
||||
}
|
||||
elseif(@Utils::getCheckboxBooleanValue($_old['SUSPEND'])){
|
||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_WEB_DOMAIN, array('USER' => $user['uid'], 'DOMAIN' => $_DOMAIN));
|
||||
if (!$result['status']) {
|
||||
$this->status = FALSE;
|
||||
$this->errors['UNSUSPEND'] = array($result['error_code'] => $result['error_message']);
|
||||
return $this->reply($result['status'], $result['error_message']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($_old['IP'] != $_new['IP']) {
|
||||
$result = array();
|
||||
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_IP, array('USER' => $user['uid'], 'DOMAIN' => $_DOMAIN, 'IP' => $_new['IP']));
|
||||
|
@ -437,7 +488,15 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
}
|
||||
|
||||
|
||||
if (( !empty($_new['SSL_KEY']) && !empty($_new['SSL_CRT']) && $_new['SSL'] == 'on') || $_old['SSL_HOME'] != $_new['SSL_HOME']) {
|
||||
if ( ( $_old['SSL_KEY'] != $_new['SSL_KEY']
|
||||
|| $_old['SSL_CRT'] != $_new['SSL_CRT']
|
||||
|| $_old['SSL_CA'] != $_new['SSL_CA']
|
||||
|| $_old['SSL_HOME'] != $_new['SSL_HOME']
|
||||
)
|
||||
&& !empty($_new['SSL_KEY'])
|
||||
&& !empty($_new['SSL_CRT'])
|
||||
&& $_new['SSL'] == 'on'
|
||||
) {
|
||||
$ssl_dir = sys_get_temp_dir().'/';
|
||||
|
||||
$ssl_crt_file = $ssl_dir . $_new['DOMAIN'] . '.crt';
|
||||
|
@ -455,20 +514,39 @@ class WEB_DOMAIN extends AjaxHandler
|
|||
'USER' => $user['uid'],
|
||||
'DOMAIN' => $_DOMAIN,
|
||||
'SSL_DIR' => $ssl_dir,
|
||||
'SSL_HOME' => $_new['SSL_HOME'] == 'on' ? 'shared' : 'single'
|
||||
'SSL_HOME' => $_new['SSL_HOME'] == 'on' ? 'single' : 'same'
|
||||
);
|
||||
|
||||
$result = 0;
|
||||
|
||||
// updating ssl
|
||||
if($_old['SSL'] == 'on'){
|
||||
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_SSL, $params);
|
||||
if (!$result['status']) {
|
||||
$this->errors['SSL'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
|
||||
// if ssl home dir changed, updating it
|
||||
if($_old['SSL_HOME'] != $_new['SSL_HOME']){
|
||||
$params = array(
|
||||
'USER' => $user['uid'],
|
||||
'DOMAIN' => $_DOMAIN,
|
||||
'SSL_HOME' => $_new['SSL_HOME'] == 'on' ? 'single' : 'same'
|
||||
);
|
||||
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_SSLHOME, $params);
|
||||
if (!$result['status']) {
|
||||
$this->errors['SSL_HOME'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
// adding new ssl
|
||||
else{
|
||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_SSL, $params);
|
||||
if (!$result['status']) {
|
||||
$this->errors['SSL'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$result['status']) {
|
||||
$this->errors['SSL'] = array($result['error_code'] => $result['error_message']);
|
||||
}
|
||||
|
||||
unlink($ssl_crt_file);
|
||||
unlink($ssl_key_file);
|
||||
|
|
|
@ -29,6 +29,7 @@ class Vesta
|
|||
const V_LIST_SYS_USER = 'v_list_user';
|
||||
const V_LIST_USER_PACKAGES = 'v_list_user_packages';
|
||||
const V_ADD_SYS_USER = 'v_add_user';
|
||||
const V_ADD_SYS_USER_REPORTS = 'v_add_user_reports';
|
||||
const V_CHANGE_SYS_USER_CONTACT = 'v_change_user_contact';
|
||||
const V_CHANGE_SYS_USER_NS = 'v_change_user_ns';
|
||||
const V_CHANGE_SYS_USER_PACKAGE = 'v_change_user_package';
|
||||
|
@ -39,6 +40,7 @@ class Vesta
|
|||
const V_SUSPEND_SYS_USER = 'v_suspend_user';
|
||||
const V_UNSUSPEND_SYS_USER = 'v_unsuspend_user';
|
||||
const V_DEL_SYS_USER = 'v_delete_user';
|
||||
const V_DEL_SYS_USER_REPORTS = 'v_delete_user_reports';
|
||||
// WEB_DOMAIN
|
||||
const V_LIST_WEB_DOMAINS = 'v_list_web_domains';
|
||||
const V_LIST_WEB_DOMAINS_ALIAS = 'v_list_web_domains_alias';
|
||||
|
@ -46,6 +48,7 @@ class Vesta
|
|||
const V_LIST_WEB_DOMAINS_PROXY = 'v_list_web_domains_proxy';
|
||||
const V_LIST_WEB_DOMAINS_SSL = 'v_list_web_domains_ssl';
|
||||
const V_LIST_WEB_DOMAINS_STATS = 'v_list_web_domains_stats';
|
||||
const V_LIST_WEB_DOMAIN_SSL = 'v_list_web_domain_ssl';
|
||||
const V_LIST_WEB_TEMPLATES = 'v_list_web_templates';
|
||||
const V_ADD_WEB_DOMAIN = 'v_add_web_domain';
|
||||
const V_ADD_WEB_DOMAIN_ALIAS = 'v_add_web_domain_alias';
|
||||
|
@ -55,7 +58,7 @@ class Vesta
|
|||
const V_ADD_WEB_DOMAIN_ELOG = 'v_add_web_domain_elog';
|
||||
const V_ADD_WEB_DOMAIN_CGI = 'v_add_web_domain_cgi';
|
||||
const V_CHANGE_WEB_DOMAIN_IP = 'v_change_web_domain_ip';
|
||||
const V_CHANGE_WEB_DOMAIN_SSLCERT = 'v_change_web_domain_sslcert';
|
||||
const V_CHANGE_WEB_DOMAIN_SSL = 'v_change_web_domain_sslcert';
|
||||
const V_CHANGE_WEB_DOMAIN_SSLHOME = 'v_change_web_domain_sslhome';
|
||||
const V_CHANGE_WEB_DOMAIN_TPL = 'v_change_web_domain_tpl';
|
||||
const V_DEL_WEB_DOMAIN_CGI = 'v_delete_web_domain_cgi';
|
||||
|
@ -121,14 +124,14 @@ class Vesta
|
|||
// CRON
|
||||
const V_LIST_CRON_JOBS = 'v_list_cron_jobs';
|
||||
const V_ADD_CRON_JOB = 'v_add_cron_job';
|
||||
const V_ADD_SYS_USER_REPORTS = 'v_add_user_reports';
|
||||
// const V_ADD_SYS_USER_REPORTS = 'v_add_user_reports';
|
||||
const V_CHANGE_CRON_JOB = 'v_change_cron_job';
|
||||
const V_SUSPEND_CRON_JOB = 'v_suspend_cron_job';
|
||||
const V_SUSPEND_CRON_JOBS = 'v_suspend_cron_jobs';
|
||||
const V_UNSUSPEND_CRON_JOB = 'v_unsuspend_cron_job';
|
||||
const V_UNSUSPEND_CRON_JOBS = 'v_unsuspend_cron_jobs';
|
||||
const V_DEL_CRON_JOB = 'v_delete_cron_job';
|
||||
const V_DEL_SYS_USER_REPORTS = 'v_delete_user_reports';
|
||||
// const V_DEL_SYS_USER_REPORTS = 'v_delete_user_reports';
|
||||
// STATS
|
||||
const V_LIST_SYS_RRD = 'v_list_sys_rrd json';
|
||||
const V_UPDATE_SYS_RRD = 'v_update_sys_rrd';
|
||||
|
|
|
@ -76,20 +76,20 @@ class VestaSession
|
|||
|
||||
public function loginAs($login)
|
||||
{
|
||||
// TODO checkrights for login as
|
||||
// if(Vesta::hasRights(self::getUserRole();, 'login_as')){
|
||||
|
||||
if(!$_SESSION['real_user'])
|
||||
$_SESSION['real_user'] = $_SESSION['user'];
|
||||
// TODO checkrights for login as
|
||||
if(Vesta::hasRights(self::getUserRole(), 'login_as')){
|
||||
if(!$_SESSION['real_user']){
|
||||
$_SESSION['real_user'] = $_SESSION['user'];
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['user'] = $login;
|
||||
|
||||
// }
|
||||
$_SESSION['user'] = $login;
|
||||
}
|
||||
|
||||
public function logoutAs()
|
||||
{
|
||||
$_SESSION['user'] = $_SESSION['real_user'];
|
||||
$_SESSION['real_user'] = false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -5,7 +5,7 @@ class Utils
|
|||
|
||||
public static function getCheckboxBooleanValue($checkbox_value)
|
||||
{
|
||||
return $checkbox_value == 'on' ? true : false;
|
||||
return ($checkbox_value == 'on' || $checkbox_value == 'yes' || $checkbox_value === TRUE) ? true : false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ switch ($_GET['action']) {
|
|||
handleUpload();
|
||||
}
|
||||
else {
|
||||
show_form();
|
||||
show_form();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -59,8 +59,8 @@ function handleUpload()
|
|||
function show_form()
|
||||
{
|
||||
$type = $_GET['type'];
|
||||
if (!in_array($type, array('key', 'cert'))) {
|
||||
exit;
|
||||
if (!in_array($type, array('key', 'cert', 'ca'))) {
|
||||
exit;
|
||||
}
|
||||
|
||||
print <<<HTML
|
||||
|
@ -90,4 +90,4 @@ function show_form()
|
|||
HTML;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue