mirror of
https://github.com/myvesta/vesta
synced 2025-08-20 13:24:25 -07:00
Merge branch 'master' of github.com:serghey-rodin/vesta
This commit is contained in:
commit
2265083702
19 changed files with 9716 additions and 1030 deletions
|
@ -124,7 +124,7 @@
|
||||||
<i class="add-entry do_action_new_entry"> </i>
|
<i class="add-entry do_action_new_entry"> </i>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="section-contains">
|
<dd class="section-contains">
|
||||||
<span class="def total_dns_records">0 total records</span>
|
<span class="def"><span class="num-total">0</span> total records</span>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
@ -203,9 +203,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- script type="text/javascript" src="js/lib/jquery-1.4.4.min.js"></script -->
|
|
||||||
<script type="text/javascript" src="js/lib/cookie.js"></script>
|
<script type="text/javascript" src="js/lib/cookie.js"></script>
|
||||||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.js"></script>
|
<script type="text/javascript" src="js/lib/jquery-1.6.1.js"></script>
|
||||||
|
<script type="text/javascript" src="js/lib/jquery-ui-1.8.13.custom.min.js"></script>
|
||||||
<script type="text/javascript" src="js/date_format.js"></script>
|
<script type="text/javascript" src="js/date_format.js"></script>
|
||||||
<script type="text/javascript" src="js/lib/custom-form-elements.js"></script>
|
<script type="text/javascript" src="js/lib/custom-form-elements.js"></script>
|
||||||
<script type="text/javascript" src="js/lib/browser.js"></script>
|
<script type="text/javascript" src="js/lib/browser.js"></script>
|
||||||
|
|
|
@ -37,9 +37,17 @@ 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'];
|
||||||
|
|
||||||
|
|
||||||
// Empty
|
// Empty
|
||||||
App.Empty = {};
|
App.Empty = {};
|
||||||
App.Empty.USER = {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','LNAME':'', 'FNAME':'','NS1':'','NS2':'','NS3':'','NS4':'','NS5':'','NS6':'','NS7':'','NS8':''};
|
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_HOME':'','STATS_PASSWORD':'','STATS_LOGIN':'','ALIAS':''};
|
||||||
|
|
||||||
App.Settings.getMethodName = function(action)
|
App.Settings.getMethodName = function(action)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,17 +24,6 @@ App.Actions.show_subform = function(evt)
|
||||||
// TODO: probably general way to embed subforms
|
// TODO: probably general way to embed subforms
|
||||||
}
|
}
|
||||||
|
|
||||||
App.Actions.close_subform = function(evt)
|
|
||||||
{
|
|
||||||
var elm = $(evt.target);
|
|
||||||
var ref = elm.hasClass('subform') ? elm : elm.parents('.subform');
|
|
||||||
var parent_ref = ref.prev('.row');
|
|
||||||
if (parent_ref.length > 0) {
|
|
||||||
parent_ref.find('.show-records').removeClass('hidden');
|
|
||||||
}
|
|
||||||
ref.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
App.Actions.view_template_settings = function(evt)
|
App.Actions.view_template_settings = function(evt)
|
||||||
{
|
{
|
||||||
alert('TODO');
|
alert('TODO');
|
||||||
|
@ -51,17 +40,6 @@ App.Actions.add_subrecord_dns = function(evt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
App.Actions.delete_subentry = function(evt)
|
|
||||||
{
|
|
||||||
var sure = confirm(App.i18n.getMessage('confirm'));
|
|
||||||
if (!sure) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var elm = $(evt.target);
|
|
||||||
var ref = elm.hasClass('subrow') ? elm : elm.parents('.subrow');
|
|
||||||
ref.effect('puff', {}, 300, function(){ref.remove();})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Embeds new item form
|
* Embeds new item form
|
||||||
* if exits custom method (App.Pages[ENVIRONMENT_NAME].newForm)
|
* if exits custom method (App.Pages[ENVIRONMENT_NAME].newForm)
|
||||||
|
@ -115,13 +93,11 @@ App.Actions.edit = function(evt) {
|
||||||
elm = elm.hasClass('row') ? elm : elm.parents('.row');
|
elm = elm.hasClass('row') ? elm : elm.parents('.row');
|
||||||
|
|
||||||
var options = elm.find('.source').val();
|
var options = elm.find('.source').val();
|
||||||
fb.warn(elm);
|
|
||||||
fb.warn(options);
|
|
||||||
var build_method = App.Env.getWorldName() + '_form';
|
var build_method = App.Env.getWorldName() + '_form';
|
||||||
var tpl = App.HTML.Build[build_method](options);
|
var tpl = App.HTML.Build[build_method](options);
|
||||||
elm.replaceWith(tpl);
|
elm.replaceWith(tpl);
|
||||||
|
|
||||||
//App.Pages[App.Env.world].edit(elm);
|
App.Helpers.disbleNotEditable();
|
||||||
//App.Helpers.updateScreen();
|
//App.Helpers.updateScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,17 +189,56 @@ App.Actions.close_popup = function()
|
||||||
App.View.closePopup();
|
App.View.closePopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
App.Actions.close_subform = function(evt, elm)
|
||||||
|
{
|
||||||
|
var elm = elm || $(evt.target);
|
||||||
|
var ref = elm.hasClass('subform') ? elm : elm.parents('.subform');
|
||||||
|
var parent_ref = ref.prev('.row');
|
||||||
|
if (parent_ref.length > 0) {
|
||||||
|
parent_ref.find('.show-records').removeClass('hidden');
|
||||||
|
}
|
||||||
|
ref.remove();
|
||||||
|
}
|
||||||
|
|
||||||
App.Actions.save_dns_subrecords = function(evt)
|
App.Actions.save_dns_subrecords = function(evt)
|
||||||
{
|
{
|
||||||
var elm = $(evt.target);
|
var elm = $(evt.target);
|
||||||
var ref = elm.hasClass('subform') ? elm : elm.parents('.subform');
|
var ref = elm.hasClass('subform') ? elm : elm.parents('.subform');
|
||||||
|
|
||||||
var records = [];
|
var data = [];
|
||||||
ref.find('.subrow').each(function(i, o){
|
$('.subform').find('.subrow').each(function(i, o)
|
||||||
records[records.length++] = App.Helpers.getFormValuesFromElement(o);
|
{
|
||||||
|
data[data.length++] = App.Helpers.getFormValues(o);
|
||||||
});
|
});
|
||||||
|
|
||||||
fb.warn($.toJSON(records));
|
var parent_row = $(elm).parents('.subform').prev('.dns-details-row');
|
||||||
|
var dns_json = $(parent_row).find('.source').val();
|
||||||
|
|
||||||
|
App.Ajax.request('DNS.changeRecords', {spell: App.Helpers.toJSON(data), dns: dns_json}, function(reply)
|
||||||
|
{
|
||||||
|
if (reply.result) {
|
||||||
|
var emphasize = $('.show-records', parent_row);
|
||||||
|
App.Actions.close_subform(null, elm);
|
||||||
|
$(emphasize).effect("highlight", {'color':'#B0D635'}, 3000);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
App.Helpers.alert('Changes were not applied');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
App.Actions.delete_subentry = function(evt)
|
||||||
|
{
|
||||||
|
var sure = confirm(App.i18n.getMessage('confirm'));
|
||||||
|
if (!sure) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var elm = $(evt.target);
|
||||||
|
var ref = elm.hasClass('subrow') ? elm : elm.parents('.subrow');
|
||||||
|
$(ref).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
App.Actions.generate_pass = function()
|
App.Actions.generate_pass = function()
|
||||||
|
|
|
@ -202,10 +202,14 @@ App.Helpers.getFormValuesFromElement = function(ref)
|
||||||
App.Helpers.updateScreen = function()
|
App.Helpers.updateScreen = function()
|
||||||
{
|
{
|
||||||
Custom.init();
|
Custom.init();
|
||||||
|
App.Ajax.request('MAIN.getInitial', {}, function(reply){
|
||||||
|
App.Env.initialParams = reply.data;
|
||||||
|
App.Helpers.updateInitial();
|
||||||
|
});
|
||||||
//$(document.body).find('select').each(function(i, o){
|
//$(document.body).find('select').each(function(i, o){
|
||||||
// $(o).selectbox();
|
// $(o).selectbox();
|
||||||
//});
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
App.Helpers.alert = function(msg)
|
App.Helpers.alert = function(msg)
|
||||||
{
|
{
|
||||||
|
@ -287,3 +291,21 @@ App.Helpers.getBackendUrl = function()
|
||||||
|
|
||||||
return url_parts.join('/');
|
return url_parts.join('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
App.Helpers.disbleNotEditable = function()
|
||||||
|
{
|
||||||
|
if ('undefined' == typeof App.Settings.Imutable[App.Env.world]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.form').each(function(i, form)
|
||||||
|
{
|
||||||
|
if ($(form).attr('id') == '') {
|
||||||
|
$('input, select, textarea', form).each(function(i, elm) {
|
||||||
|
if ($.inArray($(elm).attr('name'), App.Settings.Imutable[App.Env.world]) != -1) {
|
||||||
|
$(elm).attr('disabled', true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@ App.HTML.Build.user_entry = function(o, key)
|
||||||
|
|
||||||
var ns = [];
|
var ns = [];
|
||||||
var ns_full = [];
|
var ns_full = [];
|
||||||
fb.info(o);
|
|
||||||
$([1,2,3,4,5,6,7,8]).each(function(i, index)
|
$([1,2,3,4,5,6,7,8]).each(function(i, index)
|
||||||
{
|
{
|
||||||
if (o['NS'+index].trim() != '') {
|
if (o['NS'+index].trim() != '') {
|
||||||
|
@ -233,7 +233,7 @@ App.HTML.Build.user_entry = function(o, key)
|
||||||
App.HTML.Build.user_form = function(options, id)
|
App.HTML.Build.user_form = function(options, id)
|
||||||
{
|
{
|
||||||
if('undefined' == typeof App.Env.initialParams) {
|
if('undefined' == typeof App.Env.initialParams) {
|
||||||
return alert('PLease wait a bit. Some background processes are not yet executed. Thank you for patience.');
|
return alert('Please wait a bit. Some background processes are not yet executed. Thank you for patience.');
|
||||||
}
|
}
|
||||||
var tpl = App.Templates.get('FORM', 'user');
|
var tpl = App.Templates.get('FORM', 'user');
|
||||||
tpl.set(':source', options);
|
tpl.set(':source', options);
|
||||||
|
@ -268,6 +268,13 @@ App.HTML.Build.user_form = function(options, id)
|
||||||
tpl = App.HTML.setTplKeys(tpl, options, true);
|
tpl = App.HTML.setTplKeys(tpl, options, true);
|
||||||
tpl = App.HTML.Build.user_selects(tpl, options);
|
tpl = App.HTML.Build.user_selects(tpl, options);
|
||||||
|
|
||||||
|
if (options.REPORTS_ENABLED == 'yes') {
|
||||||
|
tpl.set(':CHECKED', 'checked="checked"');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tpl.set(':CHECKED', '');
|
||||||
|
}
|
||||||
|
|
||||||
return tpl.finalize();
|
return tpl.finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,18 +308,18 @@ App.HTML.Build.web_domain_form = function(options, id)
|
||||||
tpl.set(':id', id || '');
|
tpl.set(':id', id || '');
|
||||||
options = App.Helpers.evalJSON(options) || {};
|
options = App.Helpers.evalJSON(options) || {};
|
||||||
if (App.Helpers.isEmpty(options)) {
|
if (App.Helpers.isEmpty(options)) {
|
||||||
tpl.set(':title', 'New user');
|
tpl.set(':title', 'New WEB domain');
|
||||||
tpl.set(':save_button', 'ADD');
|
tpl.set(':save_button', 'ADD');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tpl.set(':title', 'Edit user');
|
tpl.set(':title', 'Edit WEB domain');
|
||||||
tpl.set(':save_button', 'SAVE');
|
tpl.set(':save_button', 'SAVE');
|
||||||
}
|
}
|
||||||
|
|
||||||
options = !App.Helpers.isEmpty(options) ? options : {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','NS':''};
|
options = !App.Helpers.isEmpty(options) ? options : App.Empty.WEB_DOMAIN;
|
||||||
|
|
||||||
tpl = App.HTML.setTplKeys(tpl, options, true);
|
tpl = App.HTML.setTplKeys(tpl, options, true);
|
||||||
tpl = App.HTML.Build.user_selects(tpl, options);
|
tpl = App.HTML.Build.web_domain_selects(tpl, options);
|
||||||
|
|
||||||
return tpl.finalize();
|
return tpl.finalize();
|
||||||
}
|
}
|
||||||
|
@ -374,10 +381,11 @@ App.HTML.Build.db_form = function(options, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
options = !App.Helpers.isEmpty(options) ? options : {'DB':'', 'USER':'','FORM':'', 'PASSWORD': ''};
|
options = !App.Helpers.isEmpty(options) ? options : {'DB':'', 'USER':'','FORM':'', 'PASSWORD': ''};
|
||||||
|
|
||||||
tpl = App.HTML.setTplKeys(tpl, options, true);
|
tpl = App.HTML.setTplKeys(tpl, options, true);
|
||||||
tpl = App.HTML.Build.db_selects(tpl, options);
|
tpl = App.HTML.Build.db_selects(tpl, options);
|
||||||
|
|
||||||
|
tpl.set(':PASSWORD', '');
|
||||||
|
|
||||||
return tpl.finalize();
|
return tpl.finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +567,27 @@ App.HTML.Build.dns_selects = function(tpl, options)
|
||||||
tpl.set(':TPL_DEFAULT_VALUE', options.TPL || App.Helpers.getFirstKey(obj));
|
tpl.set(':TPL_DEFAULT_VALUE', options.TPL || App.Helpers.getFirstKey(obj));
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
return '';
|
return tpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return tpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
App.HTML.Build.web_domain_selects = function(tpl, options)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// IP
|
||||||
|
var obj = App.Env.initialParams.WEB_DOMAIN.IP;
|
||||||
|
var opts = App.HTML.Build.options(obj, options.IP);
|
||||||
|
tpl.set(':IP_OPTIONS', opts);
|
||||||
|
|
||||||
|
// TPL
|
||||||
|
var obj = App.Env.initialParams.WEB_DOMAIN.TPL;
|
||||||
|
var opts = App.HTML.Build.options(obj, options.TPL);
|
||||||
|
tpl.set(':TPL_OPTIONS', opts);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
return tpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tpl;
|
return tpl;
|
||||||
|
|
8936
web/js/lib/jquery-1.6.1.js
vendored
Normal file
8936
web/js/lib/jquery-1.6.1.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
|
@ -69,7 +69,7 @@ App.Model.add = function(values, source_json)
|
||||||
spell: $.toJSON(values)
|
spell: $.toJSON(values)
|
||||||
}, function(reply){
|
}, function(reply){
|
||||||
if(!reply.result) {
|
if(!reply.result) {
|
||||||
App.Helpers.Warn('Changes were not applied');
|
App.Helpers.Warn('Changes were not applied ' + App.Helpers.toJSON(reply.errors) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/*var build_method = App.Env.getWorldName() + '_entry';
|
/*var build_method = App.Env.getWorldName() + '_entry';
|
||||||
|
|
|
@ -48,3 +48,4 @@ App.Pages.DNS.edit = function(elm) {
|
||||||
var tpl = App.HTML.Build.dns_form(options);
|
var tpl = App.HTML.Build.dns_form(options);
|
||||||
elm.replaceWith(tpl);
|
elm.replaceWith(tpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ App.Templates.html = {
|
||||||
},
|
},
|
||||||
dns: {
|
dns: {
|
||||||
FORM: [
|
FORM: [
|
||||||
'<div style="margin-top: 25px;" class="b-new-entry b-new-entry_dns" id="~!:id~!">\
|
'<div style="margin-top: 25px;" class="b-new-entry b-new-entry_dns form" id="~!:id~!">\
|
||||||
<input type="hidden" name="source" class="source" value=~!:source~!>\
|
<input type="hidden" name="source" class="source" value=~!:source~!>\
|
||||||
<input type="hidden" name="target" class="target" value=\'\'>\
|
<input type="hidden" name="target" class="target" value=\'\'>\
|
||||||
<div class="entry-header">~!:title~!</div>\
|
<div class="entry-header">~!:title~!</div>\
|
||||||
|
@ -75,7 +75,7 @@ App.Templates.html = {
|
||||||
</div>\
|
</div>\
|
||||||
<div class="form-row cc">\
|
<div class="form-row cc">\
|
||||||
<label for="#" class="field-label">soa:</label>\
|
<label for="#" class="field-label">soa:</label>\
|
||||||
<input type="text" value="~!:SOA~!" name="SOA" class="text-field rule-required rule-numeric">\
|
<input type="text" value="~!:SOA~!" name="SOA" class="text-field rule-required rule-ns">\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="form-row buttons-row cc">\
|
<div class="form-row buttons-row cc">\
|
||||||
<input type="submit" value="~!:save_button~!" class="add-entry-btn do_action_save_form" name="save">\
|
<input type="submit" value="~!:save_button~!" class="add-entry-btn do_action_save_form" name="save">\
|
||||||
|
@ -139,7 +139,7 @@ App.Templates.html = {
|
||||||
<div class="form-row buttons-row cc">\
|
<div class="form-row buttons-row cc">\
|
||||||
<input type="submit" value="save" class="add-entry-btn do_action_save_dns_subrecords">\
|
<input type="submit" value="save" class="add-entry-btn do_action_save_dns_subrecords">\
|
||||||
<span class="cancel-btn do_action_close_subform">Cancel</span>\
|
<span class="cancel-btn do_action_close_subform">Cancel</span>\
|
||||||
<span class="help-btn">Help</span>\
|
<!-- span class="help-btn">Help</span -->\
|
||||||
</div>\
|
</div>\
|
||||||
</div>'],
|
</div>'],
|
||||||
SUBENTRY: ['<div class="subrow form-row form-row-line cc">\
|
SUBENTRY: ['<div class="subrow form-row form-row-line cc">\
|
||||||
|
@ -160,14 +160,14 @@ App.Templates.html = {
|
||||||
</div>\
|
</div>\
|
||||||
<div class="field-box dns-value-box">\
|
<div class="field-box dns-value-box">\
|
||||||
<label for="#" class="field-label">value:</label>\
|
<label for="#" class="field-label">value:</label>\
|
||||||
<input type="text" value="~!:RECORD_VALUE~!" class="text-field RECORD_VALUE">\
|
<input type="text" value="~!:RECORD_VALUE~!" name="RECORD_VALUE" class="text-field">\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="delete-record do_action_delete_subentry"></div>\
|
<div class="delete-record do_action_delete_subentry"></div>\
|
||||||
</div>']
|
</div>']
|
||||||
},
|
},
|
||||||
ip: {
|
ip: {
|
||||||
FORM: ['\
|
FORM: ['\
|
||||||
<div class="b-new-entry b-new-entry_ip" id="~!:id~!">\
|
<div class="b-new-entry b-new-entry_ip form" id="~!:id~!">\
|
||||||
<input type="hidden" name="source" class="source" value=\'~!:source~!\'>\
|
<input type="hidden" name="source" class="source" value=\'~!:source~!\'>\
|
||||||
<input type="hidden" name="target" class="target" value=\'~!:target~!\'>\
|
<input type="hidden" name="target" class="target" value=\'~!:target~!\'>\
|
||||||
<div class="entry-header">~!:title~!</div>\
|
<div class="entry-header">~!:title~!</div>\
|
||||||
|
@ -328,7 +328,7 @@ App.Templates.html = {
|
||||||
</div>\
|
</div>\
|
||||||
<div class="form-row cc">\
|
<div class="form-row cc">\
|
||||||
<label for="#" class="field-label">reports:</label>\
|
<label for="#" class="field-label">reports:</label>\
|
||||||
<input type="checkbox" name="REPORTS_ENABLED" class="not-styled" value="~!:REPORTS_ENABLED~!">\
|
<input type="checkbox" name="REPORTS_ENABLED" ~!:CHECKED~! class="not-styled" value="~!:REPORTS_ENABLED~!">\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="form-row cc">\
|
<div class="form-row cc">\
|
||||||
<label for="#" class="field-label">Firstname:</label>\
|
<label for="#" class="field-label">Firstname:</label>\
|
||||||
|
@ -493,15 +493,15 @@ App.Templates.html = {
|
||||||
</div>']
|
</div>']
|
||||||
},
|
},
|
||||||
web_domain: {
|
web_domain: {
|
||||||
FORM: ['<div id="~!:id~!" class="b-new-entry b-new-entry_domain">\
|
FORM: ['<div id="~!:id~!" class="b-new-entry b-new-entry_domain form">\
|
||||||
<input type="hidden" class="source" name="source" value=\'~!:source~!\' />\
|
<input type="hidden" class="source" name="source" value=\'~!:source~!\' />\
|
||||||
<input type="hidden" class="target" name="target" value="" />\
|
<input type="hidden" class="target" name="target" value="" />\
|
||||||
<div class="entry-header">~!:title~!</div>\
|
<div class="entry-header">~!:title~!</div>\
|
||||||
<div class="form-error">\
|
<div class="form-error hidden">\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="form-row cc">\
|
<div class="form-row cc">\
|
||||||
<label for="#" class="field-label">domain:</label>\
|
<label for="#" class="field-label">domain:</label>\
|
||||||
<input type="text" name="DOMAIN" class="text-field" value="~!:DOMAIN~!">\
|
<input type="text" name="DOMAIN" class="text-field rule-required rule-ns" value="~!:DOMAIN~!">\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="form-row cc">\
|
<div class="form-row cc">\
|
||||||
<label for="#" class="field-label">ip:</label>\
|
<label for="#" class="field-label">ip:</label>\
|
||||||
|
@ -529,7 +529,6 @@ App.Templates.html = {
|
||||||
<label for="#" class="field-label">alias list:</label>\
|
<label for="#" class="field-label">alias list:</label>\
|
||||||
<textarea name="ALIAS" class="textarea">~!:ALIAS~!</textarea>\
|
<textarea name="ALIAS" class="textarea">~!:ALIAS~!</textarea>\
|
||||||
</div>\
|
</div>\
|
||||||
\
|
|
||||||
<div class="form-row cc">\
|
<div class="form-row cc">\
|
||||||
<label for="#" class="field-label">statistics:</label>\
|
<label for="#" class="field-label">statistics:</label>\
|
||||||
<input type="checkbox" name="STATS" ~!:stats_checked~!="" value="~!:STATS~!" class="styled">\
|
<input type="checkbox" name="STATS" ~!:stats_checked~!="" value="~!:STATS~!" class="styled">\
|
||||||
|
@ -541,11 +540,11 @@ App.Templates.html = {
|
||||||
</div>\
|
</div>\
|
||||||
<div class="form-row cc">\
|
<div class="form-row cc">\
|
||||||
<label for="#" class="field-label">login:</label>\
|
<label for="#" class="field-label">login:</label>\
|
||||||
<input type="text" class="text-field" name="STATS_LOGIN" value="~!:STATS_LOGIN~!">\
|
<input type="text" class="text-field rule-username" name="STATS_LOGIN" value="~!:STATS_LOGIN~!">\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="form-row pwd-box cc">\
|
<div class="form-row pwd-box cc">\
|
||||||
<label for="#" class="field-label">password:</label>\
|
<label for="#" class="field-label">password:</label>\
|
||||||
<input type="text" value="~!:STATS_PASSWORD~!" name="STATS_PASSWORD" class="text-field password">\
|
<input type="text" value="~!:STATS_PASSWORD~!" name="STATS_PASSWORD" class="text-field rule-password">\
|
||||||
<span class="generate-pwd do_action_generate_pass">Generate</span>\
|
<span class="generate-pwd do_action_generate_pass">Generate</span>\
|
||||||
</div>\
|
</div>\
|
||||||
</div><!-- // stats settings -->\
|
</div><!-- // stats settings -->\
|
||||||
|
@ -591,7 +590,7 @@ App.Templates.html = {
|
||||||
</div>\
|
</div>\
|
||||||
</div><!-- Mail options -->\
|
</div><!-- Mail options -->\
|
||||||
<div class="form-row buttons-row cc">\
|
<div class="form-row buttons-row cc">\
|
||||||
<input type="submit" value="~!:save_button~!" class="add-entry-btn">\
|
<input type="submit" value="~!:save_button~!" class="add-entry-btn do_action_save_form">\
|
||||||
<span class="cancel-btn do_action_cancel_form">Cancel</span>\
|
<span class="cancel-btn do_action_cancel_form">Cancel</span>\
|
||||||
<a target="_blank" href="http://vestacp.com/docs/web/" class="help-btn">Help</a>\
|
<a target="_blank" href="http://vestacp.com/docs/web/" class="help-btn">Help</a>\
|
||||||
</div>\
|
</div>\
|
||||||
|
@ -700,11 +699,11 @@ App.Templates.html = {
|
||||||
</span>\
|
</span>\
|
||||||
</div>'],
|
</div>'],
|
||||||
ENTRIES_WRAPPER: ['<div class="db-list">~!:content~!</div>'],
|
ENTRIES_WRAPPER: ['<div class="db-list">~!:content~!</div>'],
|
||||||
FORM: ['<div id="~!:id~!" class="b-new-entry b-new-entry_db">\
|
FORM: ['<div id="~!:id~!" class="b-new-entry b-new-entry_db form">\
|
||||||
<input type="hidden" name="source" class="source" value=\'~!:source~!\'>\
|
<input type="hidden" name="source" class="source" value=\'~!:source~!\'>\
|
||||||
<input type="hidden" name="target" class="target" value=\'\'>\
|
<input type="hidden" name="target" class="target" value=\'\'>\
|
||||||
<div class="entry-header">~!:title~!</div>\
|
<div class="entry-header">~!:title~!</div>\
|
||||||
<div class="form-error">\
|
<div class="form-error hidden">\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="form-row cc">\
|
<div class="form-row cc">\
|
||||||
<label for="#" class="field-label">db type:</label>\
|
<label for="#" class="field-label">db type:</label>\
|
||||||
|
@ -725,7 +724,7 @@ App.Templates.html = {
|
||||||
<span class="generate-pwd do_action_generate_pass">Generate</span>\
|
<span class="generate-pwd do_action_generate_pass">Generate</span>\
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="form-row cc">\
|
<div class="form-row hidden cc">\
|
||||||
<label for="#" class="field-label">db host:</label>\
|
<label for="#" class="field-label">db host:</label>\
|
||||||
<select name="HOST">~!:HOST_OPTIONS~!</select>\
|
<select name="HOST">~!:HOST_OPTIONS~!</select>\
|
||||||
</div>\
|
</div>\
|
||||||
|
@ -741,7 +740,7 @@ App.Templates.html = {
|
||||||
<div class="row-actions-box cc">\
|
<div class="row-actions-box cc">\
|
||||||
<div class="check-this check-control"></div>\
|
<div class="check-this check-control"></div>\
|
||||||
<div class="row-operations">\
|
<div class="row-operations">\
|
||||||
<span class="delete-entry"><span class="delete-entry-text">delete</span></span>\
|
<span class="delete-entry do_action_delete_entry"><span class="delete-entry-text do_action_delete_entry">delete</span></span>\
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="row-meta">\
|
<div class="row-meta">\
|
||||||
|
@ -758,7 +757,7 @@ App.Templates.html = {
|
||||||
<span class="db-name do_action_edit">~!:DB~!</span>\
|
<span class="db-name do_action_edit">~!:DB~!</span>\
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="props-additional">\
|
<div class="props-additional hidden">\
|
||||||
<div class="db-user-box cc">\
|
<div class="db-user-box cc">\
|
||||||
<span class="db-user-wrap backup-db do_action_open_inner_popup">\
|
<span class="db-user-wrap backup-db do_action_open_inner_popup">\
|
||||||
Users: ~!:USERS~!\
|
Users: ~!:USERS~!\
|
||||||
|
@ -786,7 +785,7 @@ App.Templates.html = {
|
||||||
</div>']
|
</div>']
|
||||||
},
|
},
|
||||||
cron: {
|
cron: {
|
||||||
FORM: ['<div class="b-new-entry b-new-entry_cron" id="~!:id~!" >\
|
FORM: ['<div class="b-new-entry b-new-entry_cron form" id="~!:id~!" >\
|
||||||
<input type="hidden" name="source" class="source" value=\'~!:source~!\'>\
|
<input type="hidden" name="source" class="source" value=\'~!:source~!\'>\
|
||||||
<input type="hidden" name="target" class="target" value=\'\'>\
|
<input type="hidden" name="target" class="target" value=\'\'>\
|
||||||
<div class="entry-header">~!:title~!</div>\
|
<div class="entry-header">~!:title~!</div>\
|
||||||
|
@ -799,31 +798,31 @@ App.Templates.html = {
|
||||||
<div class="field-box cron-minute-box">\
|
<div class="field-box cron-minute-box">\
|
||||||
<label for="#" class="field-label ">minute:<br>(0—59)</label>\
|
<label for="#" class="field-label ">minute:<br>(0—59)</label>\
|
||||||
<div class="field-box-inner cc">\
|
<div class="field-box-inner cc">\
|
||||||
<input type="text" value="~!:MIN~!" name="MIN" class="text-field rule-required rule-minute">\
|
<input type="text" value="~!:MIN~!" name="MIN" class="text-field rule-required rule-cronminute">\
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="field-box cron-hour-box">\
|
<div class="field-box cron-hour-box">\
|
||||||
<label for="#" class="field-label">hour:<br>(0—23)</label>\
|
<label for="#" class="field-label">hour:<br>(0—23)</label>\
|
||||||
<div class="field-box-inner cc">\
|
<div class="field-box-inner cc">\
|
||||||
<input type="text" value="~!:HOUR~!" name="HOUR" class="text-field rule-required rule-hour">\
|
<input type="text" value="~!:HOUR~!" name="HOUR" class="text-field rule-required rule-cronhour">\
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="field-box cron-day-box">\
|
<div class="field-box cron-day-box">\
|
||||||
<label for="#" class="field-label">day of Month:<br>(1—31)</label>\
|
<label for="#" class="field-label">day of Month:<br>(1—31)</label>\
|
||||||
<div class="field-box-inner cc">\
|
<div class="field-box-inner cc">\
|
||||||
<input type="text" value="~!:DAY~!" name="DAY" class="text-field rule-required rule-day">\
|
<input type="text" value="~!:DAY~!" name="DAY" class="text-field rule-required rule-cronday">\
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="field-box cron-month-box">\
|
<div class="field-box cron-month-box">\
|
||||||
<label for="#" class="field-label">Month:<br>(1—12)(Jan—Dec)</label>\
|
<label for="#" class="field-label">Month:<br>(1—12)(Jan—Dec)</label>\
|
||||||
<div class="field-box-inner cc">\
|
<div class="field-box-inner cc">\
|
||||||
<input type="text" value="~!:MONTH~!" name="MONTH" class="text-field rule-required rule-month">\
|
<input type="text" value="~!:MONTH~!" name="MONTH" class="text-field rule-required rule-cronmonth">\
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="field-box cron-week-box">\
|
<div class="field-box cron-week-box">\
|
||||||
<label for="#" class="field-label">day of Week:<br>(1—7)(Sun—Sat)</label>\
|
<label for="#" class="field-label">day of Week:<br>(1—7)(Sun—Sat)</label>\
|
||||||
<div class="field-box-inner cc">\
|
<div class="field-box-inner cc">\
|
||||||
<input type="text" value="~!:WDAY~!" name="WDAY" class="text-field rule-required rule-wday">\
|
<input type="text" value="~!:WDAY~!" name="WDAY" class="text-field rule-required rule-cronwday">\
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
|
|
|
@ -25,6 +25,12 @@ App.Validate.getFieldName = function(elm)
|
||||||
}
|
}
|
||||||
|
|
||||||
App.Validate.Rule = {
|
App.Validate.Rule = {
|
||||||
|
'username' : function(elm) {
|
||||||
|
if ($(elm).val().trim() != '' && $(elm).val().search(/[^a-zA-Z_]+/) != -1) {
|
||||||
|
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' is required'};
|
||||||
|
}
|
||||||
|
return {VALID: true};
|
||||||
|
},
|
||||||
'required' : function(elm) {
|
'required' : function(elm) {
|
||||||
if ($(elm).val().trim() == '') {
|
if ($(elm).val().trim() == '') {
|
||||||
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' is required'};
|
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' is required'};
|
||||||
|
@ -73,52 +79,44 @@ App.Validate.Rule = {
|
||||||
}
|
}
|
||||||
return {VALID: true};
|
return {VALID: true};
|
||||||
},
|
},
|
||||||
'minute': function(elm) {
|
'cronminute': function(elm) {
|
||||||
if ($(elm).val() == '*') {
|
if ($(elm).val().trim() != '' && $(elm).val().search(/[^0-9\/\*-,]+/) != -1) {
|
||||||
return {VALID: true};
|
|
||||||
}
|
|
||||||
var minute = parseInt($(elm).val(), 10);
|
|
||||||
if (minute > 60 || minute < 0) {
|
|
||||||
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' wrong minute value'};
|
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' wrong minute value'};
|
||||||
}
|
}
|
||||||
return {VALID: true};
|
return {VALID: true};
|
||||||
},
|
},
|
||||||
'hour': function(elm) {
|
'cronhour': function(elm) {
|
||||||
if ($(elm).val() == '*') {
|
if ($(elm).val() == '*') {
|
||||||
return {VALID: true};
|
return {VALID: true};
|
||||||
}
|
}
|
||||||
var hour = parseInt($(elm).val(), 10);
|
if ($(elm).val().trim() != '' && $(elm).val().search(/[^0-9\/\*-,]+/) != -1) {
|
||||||
if (hour > 60 || hour < 0) {
|
|
||||||
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' wrong hour value'};
|
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' wrong hour value'};
|
||||||
}
|
}
|
||||||
return {VALID: true};
|
return {VALID: true};
|
||||||
},
|
},
|
||||||
'wday': function(elm) {
|
'cronwday': function(elm) {
|
||||||
if ($(elm).val() == '*') {
|
if ($(elm).val() == '*') {
|
||||||
return {VALID: true};
|
return {VALID: true};
|
||||||
}
|
}
|
||||||
var wday = parseInt($(elm).val(), 10);
|
if ($(elm).val().trim() != '' && $(elm).val().search(/[^123456\/\*-,]+/) != -1) {
|
||||||
if (wday > 7 || wday < 1) {
|
|
||||||
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' wrong week day value'};
|
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' wrong week day value'};
|
||||||
}
|
}
|
||||||
return {VALID: true};
|
return {VALID: true};
|
||||||
},
|
},
|
||||||
'month': function(elm) {
|
'cronmonth': function(elm) {
|
||||||
if ($(elm).val() == '*') {
|
if ($(elm).val() == '*') {
|
||||||
return {VALID: true};
|
return {VALID: true};
|
||||||
}
|
}
|
||||||
var month = parseInt($(elm).val(), 10);
|
if ($(elm).val().trim() != '' && $(elm).val().search(/[^0-9\/\*-,]+/) != -1) {
|
||||||
if (month > 1 || month < 12) {
|
|
||||||
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' wrong month value'};
|
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' wrong month value'};
|
||||||
}
|
}
|
||||||
return {VALID: true};
|
return {VALID: true};
|
||||||
},
|
},
|
||||||
'day': function(elm) {
|
'cronday': function(elm) {
|
||||||
if ($(elm).val() == '*') {
|
if ($(elm).val() == '*') {
|
||||||
return {VALID: true};
|
return {VALID: true};
|
||||||
}
|
}
|
||||||
var day = parseInt($(elm).val(), 10);
|
if ($(elm).val().trim() != '' && $(elm).val().search(/[^0-9\/\*-,]+/) != -1) {
|
||||||
if (day > 31 || day < 1) {
|
|
||||||
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' wrong day value'};
|
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' wrong day value'};
|
||||||
}
|
}
|
||||||
return {VALID: true};
|
return {VALID: true};
|
||||||
|
|
|
@ -12,6 +12,7 @@ class AjaxHandler {
|
||||||
|
|
||||||
static public $instance = null;
|
static public $instance = null;
|
||||||
|
|
||||||
|
const JSON = 'json';
|
||||||
public $errors = array();
|
public $errors = array();
|
||||||
public $status = TRUE;
|
public $status = TRUE;
|
||||||
|
|
||||||
|
@ -37,7 +38,8 @@ class AjaxHandler {
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function dispatch($request) {
|
public function dispatch(Request $request)
|
||||||
|
{
|
||||||
$method = Request::parseAjaxMethod($request);
|
$method = Request::parseAjaxMethod($request);
|
||||||
$inc_file = V_ROOT_DIR . 'api' . DIRECTORY_SEPARATOR . $method['namespace'] . '.class.php';
|
$inc_file = V_ROOT_DIR . 'api' . DIRECTORY_SEPARATOR . $method['namespace'] . '.class.php';
|
||||||
if (!is_readable($inc_file)) {
|
if (!is_readable($inc_file)) {
|
||||||
|
@ -59,7 +61,8 @@ class AjaxHandler {
|
||||||
/**
|
/**
|
||||||
* Prepare response for ajax
|
* Prepare response for ajax
|
||||||
*/
|
*/
|
||||||
function reply($result, $data, $message = '', $extra = array()) {
|
public function reply($result, $data, $message = '', $extra = array())
|
||||||
|
{
|
||||||
return json_encode(array('result' => $result,
|
return json_encode(array('result' => $result,
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
|
@ -68,7 +71,8 @@ class AjaxHandler {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
static function makeReply($reply) {
|
static function makeReply($reply)
|
||||||
|
{
|
||||||
print $reply;
|
print $reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class CRON extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function getListExecute($request)
|
public function getListExecute(Request $request)
|
||||||
{
|
{
|
||||||
$user = $this->getLoggedUser();
|
$user = $this->getLoggedUser();
|
||||||
$reply = array();
|
$reply = array();
|
||||||
|
@ -168,7 +168,7 @@ class CRON extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function unsuspendExecute($request)
|
public function unsuspendExecute(Request $request)
|
||||||
{
|
{
|
||||||
$user = $this->getLoggedUser();
|
$user = $this->getLoggedUser();
|
||||||
$spell = $request->getParameter('spell');
|
$spell = $request->getParameter('spell');
|
||||||
|
@ -186,54 +186,4 @@ class CRON extends AjaxHandler
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Batch suspend CRON entries
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @return string - Ajax Reply
|
|
||||||
*/
|
|
||||||
/*public function suspendAllExecute($request)
|
|
||||||
{
|
|
||||||
$r = new Request();
|
|
||||||
$_s = $r->getSpell();
|
|
||||||
$_user = 'vesta';
|
|
||||||
$_JOB = $_s['JOB'];
|
|
||||||
$params = array(
|
|
||||||
'USER' => $_user
|
|
||||||
);
|
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_SUSPEND_CRON_JOBS, $params);
|
|
||||||
|
|
||||||
if (!$result['status']) {
|
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Batch unsuspend CRON entries
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @return string - Ajax Reply
|
|
||||||
*/
|
|
||||||
/*public function unsuspendAllExecute($request)
|
|
||||||
{
|
|
||||||
$r = new Request();
|
|
||||||
$_s = $r->getSpell();
|
|
||||||
$_user = 'vesta';
|
|
||||||
$params = array(
|
|
||||||
'USER' => $_user
|
|
||||||
);
|
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_CRON_JOBS, $params);
|
|
||||||
|
|
||||||
if (!$result['status']) {
|
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,21 +18,21 @@ class DB extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function getListExecute($request)
|
public function getListExecute(Request $request)
|
||||||
{
|
{
|
||||||
$_user = 'vesta';
|
$user = $this->getLoggedUser();
|
||||||
$reply = array();
|
$reply = array();
|
||||||
$result = Vesta::execute(Vesta::V_LIST_DB_BASES, array($_user, Config::get('response_type')));
|
$result = Vesta::execute(Vesta::V_LIST_DB_BASES, array($user['uid'], Config::get('response_type')));
|
||||||
|
|
||||||
foreach ($result['data'] as $db => $record) {
|
foreach ($result['data'] as $db => $record) {
|
||||||
$type = $record['TYPE'];
|
$type = $record['TYPE'];
|
||||||
if (!isset($reply[$type])) {
|
if (!isset($reply[$type])) {
|
||||||
$reply[$type] = array();
|
$reply[$type] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$reply[$type][] = array(
|
$reply[$type][] = array(
|
||||||
'DB' => $db,
|
'DB' => $db,
|
||||||
'OWNER' => 'John Travlolta',
|
'OWNER' => $record['USER'],
|
||||||
|
'USER' => $record['USER'],
|
||||||
'USERS' => (array)$record['USER'],
|
'USERS' => (array)$record['USER'],
|
||||||
'HOST' => $record['HOST'],
|
'HOST' => $record['HOST'],
|
||||||
'TYPE' => $record['TYPE'],
|
'TYPE' => $record['TYPE'],
|
||||||
|
@ -47,17 +47,6 @@ class DB extends AjaxHandler
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$reply['postgre'][] = array(
|
|
||||||
'DB' => 'x',
|
|
||||||
'OWNER' => 'John Travlolta',
|
|
||||||
'USERS' => array('E'),
|
|
||||||
'HOST' => 'xxx',
|
|
||||||
'TYPE' => '34',
|
|
||||||
'U_DISK' => '0',
|
|
||||||
'SUSPEND' => 'false',
|
|
||||||
'DATE' => '2011-01-01'
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->reply($result['status'], $reply);
|
return $this->reply($result['status'], $reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,23 +56,21 @@ class DB extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function addExecute($request)
|
public function addExecute(Request $request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$user = $this->getLoggedUser();
|
||||||
$_s = $r->getSpell();
|
$_s = $request->getParameter('spell');
|
||||||
$_user = 'vesta';
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $user['uid'],
|
||||||
'DB' => $_s['DB'],
|
'DB' => $_s['DB'],
|
||||||
'DB_USER' => $_s['DB_USER'],
|
'DB_USER' => $_s['USER'],
|
||||||
'DB_PASSWORD' => $_s['DB_PASSWORD'],
|
'DB_PASSWORD' => $_s['PASSWORD'],
|
||||||
'TYPE' => $_s['TYPE']
|
'TYPE' => $_s['TYPE']
|
||||||
);
|
);
|
||||||
|
// TODO: do not user it. Will be used in later releases
|
||||||
if ($_s['HOST']) {
|
/*if ($_s['HOST']) {
|
||||||
$params['HOST'] = $_s['HOST'];
|
$params['HOST'] = $_s['HOST'];
|
||||||
}
|
}*/
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_ADD_DB_BASE, $params);
|
$result = Vesta::execute(Vesta::V_ADD_DB_BASE, $params);
|
||||||
|
|
||||||
|
@ -100,14 +87,13 @@ class DB extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function delExecute($request)
|
public function deleteExecute(Request $request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$_s = $request->getParameter('spell');
|
||||||
$_s = $r->getSpell();
|
$user = $this->getLoggedUser();
|
||||||
$_user = 'vesta';
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $user['uid'],
|
||||||
'DB' => $_user.'_'.$_s['DB']
|
'DB' => $_s['DB']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_DEL_DB_BASE, $params);
|
$result = Vesta::execute(Vesta::V_DEL_DB_BASE, $params);
|
||||||
|
@ -125,16 +111,15 @@ class DB extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function changePasswordExecute($request)
|
public function changeExecute(Request $request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$_s = $request->getParameter('new');
|
||||||
$_s = $r->getSpell();
|
$user = $this->getLoggedUser();
|
||||||
$_user = 'vesta';
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $user['uid'],
|
||||||
'DB' => $_user.'_'.$_s['DB'],
|
'DB' => $_s['DB'],
|
||||||
'PASSWORD' => $_s['DB_PASSWORD']
|
'PASSWORD' => $_s['PASSWORD']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_DB_PASSWORD, $params);
|
$result = Vesta::execute(Vesta::V_CHANGE_DB_PASSWORD, $params);
|
||||||
|
@ -146,102 +131,4 @@ class DB extends AjaxHandler
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Suspend DB entry
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @return string - Ajax Reply
|
|
||||||
*/
|
|
||||||
public function suspendExecute($request)
|
|
||||||
{
|
|
||||||
$r = new Request();
|
|
||||||
$_s = $r->getSpell();
|
|
||||||
$_user = 'vesta';
|
|
||||||
$params = array(
|
|
||||||
'USER' => $_user,
|
|
||||||
'DB' => $_user.'_'.$_s['DB']
|
|
||||||
);
|
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_SUSPEND_DB_BASE, $params);
|
|
||||||
|
|
||||||
if (!$result['status']) {
|
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unsuspend DB entry
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @return string - Ajax Reply
|
|
||||||
*/
|
|
||||||
public function unsuspendExecute($request)
|
|
||||||
{
|
|
||||||
$r = new Request();
|
|
||||||
$_s = $r->getSpell();
|
|
||||||
$_user = 'vesta';
|
|
||||||
$params = array(
|
|
||||||
'USER' => $_user,
|
|
||||||
'DB' => $_user.'_'.$_s['DB']
|
|
||||||
);
|
|
||||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_DB_BASE, $params);
|
|
||||||
|
|
||||||
if (!$result['status']) {
|
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Batch Suspend DB entries
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @return string - Ajax Reply
|
|
||||||
*/
|
|
||||||
public function suspendAllExecute($request)
|
|
||||||
{
|
|
||||||
$r = new Request();
|
|
||||||
$_s = $r->getSpell();
|
|
||||||
$_user = 'vesta';
|
|
||||||
$_JOB = $_s['JOB'];
|
|
||||||
|
|
||||||
$params = array(
|
|
||||||
'USER' => $_user
|
|
||||||
);
|
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_SUSPEND_DB_BASES, $params);
|
|
||||||
|
|
||||||
if (!$result['status']) {
|
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Batch unsuspend DB entries
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @return string - Ajax Reply
|
|
||||||
*/
|
|
||||||
public function unsuspendAllExecute($request)
|
|
||||||
{
|
|
||||||
$r = new Request();
|
|
||||||
$_s = $r->getSpell();
|
|
||||||
$_user = 'vesta';
|
|
||||||
$params = array(
|
|
||||||
'USER' => $_user
|
|
||||||
);
|
|
||||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_DB_BASES, $params);
|
|
||||||
|
|
||||||
if (!$result['status']) {
|
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ class DNS extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function getListExecute($request)
|
public function getListExecute(Request $request)
|
||||||
{
|
{
|
||||||
$user = $this->getLoggedUser();
|
$user = $this->getLoggedUser();
|
||||||
$reply = array();
|
$reply = array();
|
||||||
|
@ -51,19 +51,25 @@ class DNS extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function getListRecordsExecute($request)
|
public function getListRecordsExecute(Request $request)
|
||||||
{
|
{
|
||||||
$_s = $request->getParameter('spell');
|
$_s = $request->getParameter('spell');
|
||||||
$user = $this->getLoggedUser();
|
$user = $this->getLoggedUser();
|
||||||
$reply = array();
|
$reply = array();
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_LIST_DNS_DOMAIN_RECORDS, array($user['uid'], $_s['DNS_DOMAIN'], Config::get('response_type')));
|
$params = array(
|
||||||
|
'USER' => $user['uid'],
|
||||||
|
'DOMAIN' => $_s['DNS_DOMAIN']
|
||||||
|
);
|
||||||
|
|
||||||
|
$result = Vesta::execute(Vesta::V_LIST_DNS_DOMAIN_RECORDS, $params, self::JSON);
|
||||||
foreach ($result['data'] as $record_id => $details) {
|
foreach ($result['data'] as $record_id => $details) {
|
||||||
$reply[$record_id] = array(
|
$reply[$record_id] = array(
|
||||||
|
'ID' => $record_id,
|
||||||
'RECORD_ID' => $record_id,
|
'RECORD_ID' => $record_id,
|
||||||
'RECORD' => $details['RECORD'],
|
'RECORD' => $details['RECORD'],
|
||||||
'RECORD_TYPE' => $details['TYPE'],
|
'RECORD_TYPE' => $details['TYPE'],
|
||||||
'RECORD_VALUE' => $details['VALUE'],
|
'RECORD_VALUE' => str_replace('"', '', $details['VALUE']),
|
||||||
'SUSPEND' => $details['SUSPEND'],
|
'SUSPEND' => $details['SUSPEND'],
|
||||||
'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
|
'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
|
||||||
);
|
);
|
||||||
|
@ -85,7 +91,7 @@ class DNS extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function addExecute($request)
|
public function addExecute(Request $request)
|
||||||
{
|
{
|
||||||
$user = $this->getLoggedUser();
|
$user = $this->getLoggedUser();
|
||||||
$_s = $request->getParameter('spell');
|
$_s = $request->getParameter('spell');
|
||||||
|
@ -125,13 +131,13 @@ class DNS extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function addRecordExecute($request)
|
public function addRecordExecute(Request $request)
|
||||||
{
|
{
|
||||||
$user = $this->getLoggedUser();
|
$user = $this->getLoggedUser();
|
||||||
$_s = $request->getParameter('spell');
|
$_s = $request->getParameter('spell');
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $user['uid'], /// OWNER ???
|
'USER' => $user['uid'],
|
||||||
'DOMAIN' => $_s['DOMAIN'],
|
'DOMAIN' => $_s['DOMAIN'],
|
||||||
'RECORD' => $_s['RECORD'],
|
'RECORD' => $_s['RECORD'],
|
||||||
'RECORD_TYPE' => $_s['TYPE'],
|
'RECORD_TYPE' => $_s['TYPE'],
|
||||||
|
@ -157,7 +163,7 @@ class DNS extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function deleteExecute($request)
|
public function deleteExecute(Request $request)
|
||||||
{
|
{
|
||||||
$user = $this->getLoggedUser();
|
$user = $this->getLoggedUser();
|
||||||
$_s = $request->getParameter('spell');
|
$_s = $request->getParameter('spell');
|
||||||
|
@ -184,14 +190,15 @@ class DNS extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function delRecordExecute($request)
|
public function deleteRecordExecute(Request $request)
|
||||||
{
|
{
|
||||||
$_s = $request->getParameter('spell');
|
$_s = $request->getParameter('spell');
|
||||||
|
$dns = $request->getParameter('dns');
|
||||||
$user = $this->getLoggedUser();
|
$user = $this->getLoggedUser();
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $user['uid'], // TODO: OWNER ???
|
'USER' => $user['uid'], // TODO: OWNER ???
|
||||||
'DOMAIN' => $_s['DOMAIN'],
|
'DOMAIN' => $dns['DNS_DOMAIN'],
|
||||||
'RECORD_ID' => $_s['RECORD_ID']
|
'RECORD_ID' => $_s['RECORD_ID']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -214,7 +221,7 @@ class DNS extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function changeExecute($request)
|
public function changeExecute(Request $request)
|
||||||
{
|
{
|
||||||
$_old = $request->getParameter('old');
|
$_old = $request->getParameter('old');
|
||||||
$_new = $request->getParameter('new');
|
$_new = $request->getParameter('new');
|
||||||
|
@ -285,50 +292,76 @@ class DNS extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function changeRecordsExecute($request)
|
public function changeRecordsExecute(Request $request)
|
||||||
{
|
{
|
||||||
$_old = $request->getParameter('old');
|
$records = $request->getParameter('spell');
|
||||||
$_new = $request->getParameter('new');
|
$dns = $request->getParameter('dns');
|
||||||
$user = $this->getLoggedUser();
|
$user = $this->getLoggedUser();
|
||||||
$_DNS_DOMAIN = $_s['DNS_DOMAIN'];
|
$domain = $dns['DNS_DOMAIN'];
|
||||||
|
|
||||||
foreach ($_new as $record_id => $record_data) {
|
// Get current records
|
||||||
// checking if record existed - update
|
$curr_records = array();
|
||||||
if (is_array($_old[$record_id])) {
|
$params = array(
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_RECORD,
|
|
||||||
array(
|
|
||||||
'USER' => $user['uid'],
|
'USER' => $user['uid'],
|
||||||
'DNS_DOMAIN' => $_DNS_DOMAIN,
|
'DOMAIN' => $domain
|
||||||
'ID' => $record_id,
|
);
|
||||||
'RECORD' => $record_data['RECORD'],
|
|
||||||
'TYPE' => $record_data['RECORD_TYPE'],
|
$result = Vesta::execute(Vesta::V_LIST_DNS_DOMAIN_RECORDS, $params, self::JSON);
|
||||||
'VALUE' => $record_data['RECORD_VALUE']
|
foreach ($result['data'] as $record_id => $details) {
|
||||||
));
|
$curr_records[] = $record_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_records = array();
|
||||||
|
foreach ($records as $record) {
|
||||||
|
if ((int)$record['RECORD_ID'] > 0) {
|
||||||
|
$new_records[] = $record['RECORD_ID'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$delete = array_diff(array_values($curr_records), array_values($new_records));
|
||||||
|
foreach ($records as $record) {
|
||||||
|
if (((int)$record['RECORD_ID'] > 0) == false) {
|
||||||
|
$params = array(
|
||||||
|
'USER' => $user['uid'],
|
||||||
|
'DOMAIN' => $domain,
|
||||||
|
'RECORD' => $record['RECORD'],
|
||||||
|
'RECORD_TYPE' => $record['RECORD_TYPE'],
|
||||||
|
'RECORD_VALUE' => $record['RECORD_VALUE']
|
||||||
|
);
|
||||||
|
|
||||||
|
$result = Vesta::execute(Vesta::V_ADD_DNS_DOMAIN_RECORD, $params);
|
||||||
if (!$result['status']) {
|
if (!$result['status']) {
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors[$record_id] = array($result['error_code'] => $result['error_message']);
|
$this->errors[$record_id] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result = Vesta::execute(Vesta::V_ADD_DNS_DOMAIN_RECORD, array('USER' => $user['uid'], 'DNS_DOMAIN' => $_DNS_DOMAIN, 'RECORD' => $record_data['RECORD'], 'TYPE' => $record_data['RECORD_TYPE'], 'VALUE' => $record_data['RECORD_VALUE'], 'ID' => $record_id));
|
$params = array(
|
||||||
|
'USER' => $user['uid'],
|
||||||
|
'DOMAIN' => $domain,
|
||||||
|
'ID' => (int)$record['RECORD_ID'],
|
||||||
|
'RECORD' => $record['RECORD'],
|
||||||
|
'RECORD_TYPE' => $record['RECORD_TYPE'],
|
||||||
|
'RECORD_VALUE' => $record['RECORD_VALUE']
|
||||||
|
);
|
||||||
|
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_RECORD, $params);
|
||||||
if (!$result['status']) {
|
if (!$result['status']) {
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors[$record_id] = array($result['error_code'] => $result['error_message']);
|
$this->errors[$record_id] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($_old[$record_id]);
|
|
||||||
}
|
}
|
||||||
|
foreach ($delete as $record_id) {
|
||||||
// in $_old have remained only record that do not present in new - so they have to be deleted
|
$params = array(
|
||||||
foreach ($_old as $record_id => $record_data) {
|
'USER' => $user['uid'],
|
||||||
/*
|
'DOMAIN' => $domain,
|
||||||
$result = Vesta::execute(Vesta::V_DEL_DNS_DOMAIN_RECORD, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'ID' => $record_id,));
|
'ID' => $record_id
|
||||||
|
);
|
||||||
|
$result = Vesta::execute(Vesta::V_DEL_DNS_DOMAIN_RECORD, $params);
|
||||||
if (!$result['status']) {
|
if (!$result['status']) {
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors[$record_id] = array($result['error_code'] => $result['error_message']);
|
$this->errors[$record_id] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($this->status, '');
|
return $this->reply($this->status, '');
|
||||||
|
|
|
@ -77,7 +77,6 @@ class IP extends AjaxHandler
|
||||||
'INTERFACE' => $spell['INTERFACE'],
|
'INTERFACE' => $spell['INTERFACE'],
|
||||||
'OWNER' => $spell['OWNER'],
|
'OWNER' => $spell['OWNER'],
|
||||||
'IP_STATUS' => $spell['STATUS']
|
'IP_STATUS' => $spell['STATUS']
|
||||||
//'IP_NAME' => $spell['NAME']
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_ADD_SYS_IP, $params);
|
$result = Vesta::execute(Vesta::V_ADD_SYS_IP, $params);
|
||||||
|
@ -124,6 +123,9 @@ class IP extends AjaxHandler
|
||||||
$_old = $request->getParameter('old');
|
$_old = $request->getParameter('old');
|
||||||
$_new = $request->getParameter('new');
|
$_new = $request->getParameter('new');
|
||||||
|
|
||||||
|
$this->status = TRUE;
|
||||||
|
$this->errors = array();
|
||||||
|
|
||||||
if ($_old['OWNER'] != $_new['OWNER']) {
|
if ($_old['OWNER'] != $_new['OWNER']) {
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_SYS_IP_OWNER, array('OWNER' => $_new['OWNER'], 'IP' => $_new['IP_ADDRESS']));
|
$result = Vesta::execute(Vesta::V_CHANGE_SYS_IP_OWNER, array('OWNER' => $_new['OWNER'], 'IP' => $_new['IP_ADDRESS']));
|
||||||
|
@ -156,7 +158,7 @@ class IP extends AjaxHandler
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($this->status, $this->errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -165,7 +167,7 @@ class IP extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function getSysInterfacesExecute($request)
|
public function getSysInterfacesExecute(Request $request)
|
||||||
{
|
{
|
||||||
$reply = array();
|
$reply = array();
|
||||||
$result = Vesta::execute(Vesta::V_LIST_SYS_INTERFACES, array(Config::get('response_type')));
|
$result = Vesta::execute(Vesta::V_LIST_SYS_INTERFACES, array(Config::get('response_type')));
|
||||||
|
|
|
@ -23,7 +23,7 @@ class MAIN extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function versionExecute($request)
|
public function versionExecute(Request $request)
|
||||||
{
|
{
|
||||||
$result = array(
|
$result = array(
|
||||||
'version' => '1.0',
|
'version' => '1.0',
|
||||||
|
@ -41,7 +41,7 @@ class MAIN extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function getInitialExecute($request)
|
public function getInitialExecute(Request $request)
|
||||||
{
|
{
|
||||||
require_once V_ROOT_DIR . 'api/IP.class.php';
|
require_once V_ROOT_DIR . 'api/IP.class.php';
|
||||||
require_once V_ROOT_DIR . 'api/USER.class.php';
|
require_once V_ROOT_DIR . 'api/USER.class.php';
|
||||||
|
@ -55,14 +55,13 @@ class MAIN extends AjaxHandler
|
||||||
$user_obj = new USER();
|
$user_obj = new USER();
|
||||||
$users = json_decode($user_obj->getListExecute($request), TRUE);
|
$users = json_decode($user_obj->getListExecute($request), TRUE);
|
||||||
$user_names = array_keys($users['data']);
|
$user_names = array_keys($users['data']);
|
||||||
$db_types = array('mysql' => 'mysql', 'postgress' => 'postgress');
|
|
||||||
$interfaces_arr = json_decode($ip_obj->getSysInterfacesExecute($request), TRUE);
|
$interfaces_arr = json_decode($ip_obj->getSysInterfacesExecute($request), TRUE);
|
||||||
$interfaces = $interfaces_arr['data'];
|
$interfaces = $interfaces_arr['data'];
|
||||||
|
|
||||||
$data_web_domain = array('ips' => $ips);
|
$data_web_domain = array('ips' => $ips);
|
||||||
$data_ip = array('user_names' => $user_names, 'interfaces' => $interfaces);
|
$data_ip = array('user_names' => $user_names, 'interfaces' => $interfaces);
|
||||||
$data_dns = array('ips' => $ips);
|
$data_dns = array('ips' => $ips);
|
||||||
$data_db = array('db_types' => $db_types);
|
$data_db = array('db_types' => $this->getDBTypes());
|
||||||
$data_users = array('user_names' => $user_names);
|
$data_users = array('user_names' => $user_names);
|
||||||
|
|
||||||
$reply = array(
|
$reply = array(
|
||||||
|
@ -174,7 +173,7 @@ class MAIN extends AjaxHandler
|
||||||
'TTL' => array(),
|
'TTL' => array(),
|
||||||
'record' => array(
|
'record' => array(
|
||||||
'RECORD' => array(),
|
'RECORD' => array(),
|
||||||
'RECORD_TYPE' => array('a' => 'a', 'reverse' => 'reverse'),
|
'RECORD_TYPE' => array('A' => 'A', 'NS' => 'NS', 'MX' => 'MX', 'TXT' => 'TXT'),
|
||||||
'RECORD_VALUE' => array()
|
'RECORD_VALUE' => array()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -188,12 +187,18 @@ class MAIN extends AjaxHandler
|
||||||
*/
|
*/
|
||||||
public function getDbParams($data = array())
|
public function getDbParams($data = array())
|
||||||
{
|
{
|
||||||
|
$db_types = $this->getDBTypes();
|
||||||
return array(
|
return array(
|
||||||
'TYPE' => $data['db_types'],
|
'TYPE' => $db_types,
|
||||||
'HOST' => array('vestacp.com' => 'vestacp.com', 'askcow.org' => 'askcow.org')
|
'HOST' => array('vestacp.com' => 'vestacp.com', 'askcow.org' => 'askcow.org')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDBTypes()
|
||||||
|
{
|
||||||
|
return array('mysql' => 'mysql', 'postgre' => 'postgre');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Users initial params
|
* Users initial params
|
||||||
*
|
*
|
||||||
|
|
|
@ -9,92 +9,7 @@
|
||||||
* @author Dmitry Naumov-Socolov <naumov.socolov@gmail.com>
|
* @author Dmitry Naumov-Socolov <naumov.socolov@gmail.com>
|
||||||
* @copyright vesta 2010-2011
|
* @copyright vesta 2010-2011
|
||||||
*/
|
*/
|
||||||
class PARAMS extends AjaxHandler {
|
class PARAMS extends AjaxHandler
|
||||||
/*
|
{
|
||||||
function getInitialExecute($request)
|
|
||||||
{
|
|
||||||
require_once V_ROOT_DIR . 'api/IP.class.php';
|
|
||||||
$ip_obj = new IP();
|
|
||||||
$user_ips = json_decode($ip_obj->getListUserIpsExecute(), TRUE);
|
|
||||||
foreach($user_ips['data'] as $ip)
|
|
||||||
$ips[$ip['IP_ADDRESS']] = $ip['IP_ADDRESS'];
|
|
||||||
|
|
||||||
require_once V_ROOT_DIR . 'api/USER.class.php';
|
|
||||||
$user_obj = new USER();
|
|
||||||
$users = json_decode($user_obj->getListExecute(), TRUE);
|
|
||||||
$user_names = array_keys($users['data']['data']);
|
|
||||||
|
|
||||||
$db_types = array('mysql' => 'mysql', 'postgress' => 'postgress');
|
|
||||||
|
|
||||||
$interfaces_arr = json_decode($ip_obj->getSysInterfacesExecute(), TRUE);
|
|
||||||
$interfaces = $interfaces_arr['data'];
|
|
||||||
|
|
||||||
|
|
||||||
$reply = array(
|
|
||||||
'WEB_DOMAIN' => array(
|
|
||||||
'TPL' => array('default' => 'default'),
|
|
||||||
'ALIAS' => array(),
|
|
||||||
'STAT' => array(
|
|
||||||
'webalizer' => 'webalizer',
|
|
||||||
'awstats' => 'awstats'),
|
|
||||||
'IP' => $ips
|
|
||||||
),
|
|
||||||
|
|
||||||
'CRON' => array(),
|
|
||||||
|
|
||||||
'IP' => array(
|
|
||||||
'SYS_USERS' => $user_names,
|
|
||||||
'STATUSES' => array(
|
|
||||||
'shared' => 'shared',
|
|
||||||
'exclusive' => 'exclusive'
|
|
||||||
),
|
|
||||||
'INTERFACES' => $interfaces,
|
|
||||||
'MASK' => array(
|
|
||||||
'255.255.255.0' => '255.255.255.0',
|
|
||||||
'255.255.255.128' => '255.255.255.128',
|
|
||||||
'255.255.255.192' => '255.255.255.192',
|
|
||||||
'255.255.255.224' => '255.255.255.224',
|
|
||||||
'255.255.255.240' => '255.255.255.240',
|
|
||||||
'255.255.255.248' => '255.255.255.248',
|
|
||||||
'255.255.255.252' => '255.255.255.252',
|
|
||||||
'255.255.255.255' => '255.255.255.255'
|
|
||||||
),
|
|
||||||
'OWNER' => array()
|
|
||||||
),
|
|
||||||
|
|
||||||
'DNS' => array(
|
|
||||||
'IP' => $ips,
|
|
||||||
'TPL' => array('default' => 'default'),
|
|
||||||
'EXP' => array(),
|
|
||||||
'SOA' => array(),
|
|
||||||
'TTL' => array(),
|
|
||||||
'record' => array(
|
|
||||||
'RECORD' => array(),
|
|
||||||
'RECORD_TYPE' => array('a' => 'a', 'reverce' => 'reverce'),
|
|
||||||
'RECORD_VALUE' => array()
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
'DB' => array(
|
|
||||||
'TYPE' => $db_types,
|
|
||||||
'HOST' => array('vestacp.com' => 'vestacp.com', 'askcow.org' => 'askcow.org')
|
|
||||||
),
|
|
||||||
|
|
||||||
'USERS' => array(
|
|
||||||
'ROLE' => array('user' => 'user'),
|
|
||||||
'OWNER' => $user_names,
|
|
||||||
'PACKAGE' => array('default' => 'default'),
|
|
||||||
'NS1' => array('' => ''),
|
|
||||||
'NS2' => array('' => ''),
|
|
||||||
'SHELL' => array(
|
|
||||||
'/bin/sh' => '/bin/sh',
|
|
||||||
'/bin/bash' => '/bin/bash',
|
|
||||||
'/sbin/nologin' => '/sbin/nologin',
|
|
||||||
'/bin/tcsh' => '/bin/tcsh',
|
|
||||||
'/bin/csh' => '/bin/csh')
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->reply(true, $reply);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,13 +30,13 @@ class USER extends AjaxHandler
|
||||||
foreach ($result['data'] as $user => $details) {
|
foreach ($result['data'] as $user => $details) {
|
||||||
$fullname_id = rand(0, count($users)-1);
|
$fullname_id = rand(0, count($users)-1);
|
||||||
$fullname = implode('', array($details['FNAME'], ' ', $details['LNAME']));
|
$fullname = implode('', array($details['FNAME'], ' ', $details['LNAME']));
|
||||||
//if ($user == 'TestGOOD') {var_dump($details);die();}
|
|
||||||
$nses = $this->getNS($user, $details);
|
$nses = $this->getNS($user, $details);
|
||||||
$user_details = array(
|
$user_details = array(
|
||||||
"FNAME" => $details['FNAME'],
|
"FNAME" => $details['FNAME'],
|
||||||
"LNAME" => $details['LNAME'],
|
"LNAME" => $details['LNAME'],
|
||||||
"LOGIN_NAME" => $user,
|
"LOGIN_NAME" => $user,
|
||||||
"FULLNAME" => $fullname, // TODO skid
|
"FULLNAME" => $fullname,
|
||||||
"PACKAGE" => $details['PACKAGE'],
|
"PACKAGE" => $details['PACKAGE'],
|
||||||
"WEB_DOMAINS" => $details['WEB_DOMAINS'],
|
"WEB_DOMAINS" => $details['WEB_DOMAINS'],
|
||||||
"WEB_SSL" => $details['WEB_SSL'],
|
"WEB_SSL" => $details['WEB_SSL'],
|
||||||
|
@ -46,9 +46,8 @@ class USER extends AjaxHandler
|
||||||
"MAIL_BOXES" => $details['MAIL_BOXES'],
|
"MAIL_BOXES" => $details['MAIL_BOXES'],
|
||||||
"MAIL_FORWARDERS" => $details['MAIL_FORWARDERS'],
|
"MAIL_FORWARDERS" => $details['MAIL_FORWARDERS'],
|
||||||
"DNS_DOMAINS" => $details['DNS_DOMAINS'],
|
"DNS_DOMAINS" => $details['DNS_DOMAINS'],
|
||||||
"DISK_QUOTA" => $details['DISK_QUOTA'],//$disk_quota,
|
"DISK_QUOTA" => $details['DISK_QUOTA'],
|
||||||
"BANDWIDTH" => $details['BANDWIDTH'],//$bandwidth,
|
"BANDWIDTH" => $details['BANDWIDTH'],
|
||||||
//"NS_LIST" => array($details['NS1'], $details['NS2']), // TODO skid
|
|
||||||
"SHELL" => $details['SHELL'],
|
"SHELL" => $details['SHELL'],
|
||||||
"BACKUPS" => $details['BACKUPS'],
|
"BACKUPS" => $details['BACKUPS'],
|
||||||
"WEB_TPL" => $details['WEB_TPL'],
|
"WEB_TPL" => $details['WEB_TPL'],
|
||||||
|
@ -67,7 +66,6 @@ class USER extends AjaxHandler
|
||||||
"U_MAIL_DOMAINS" => $details['U_MAIL_DOMAINS'],
|
"U_MAIL_DOMAINS" => $details['U_MAIL_DOMAINS'],
|
||||||
"CONTACT" => $details['CONTACT'],
|
"CONTACT" => $details['CONTACT'],
|
||||||
"DATE" => $details['DATE'],
|
"DATE" => $details['DATE'],
|
||||||
|
|
||||||
"U_MAIL_BOXES" => rand(1, 10), // TODO: skid
|
"U_MAIL_BOXES" => rand(1, 10), // TODO: skid
|
||||||
"U_MAIL_FORWARDERS" => rand(1, 10), // TODO: skid
|
"U_MAIL_FORWARDERS" => rand(1, 10), // TODO: skid
|
||||||
"REPORTS_ENABLED" => 'enabled' // TODO: skid
|
"REPORTS_ENABLED" => 'enabled' // TODO: skid
|
||||||
|
@ -142,7 +140,7 @@ class USER extends AjaxHandler
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string - Ajax Reply
|
* @return string - Ajax Reply
|
||||||
*/
|
*/
|
||||||
public function changeExecute($request)
|
public function changeExecute(Request $request)
|
||||||
{
|
{
|
||||||
$_new = $request->getParameter('new');
|
$_new = $request->getParameter('new');
|
||||||
$_old = $request->getParameter('old');
|
$_old = $request->getParameter('old');
|
||||||
|
|
|
@ -7,16 +7,15 @@
|
||||||
* @author Dmitry Naumov-Socolov <naumov.socolov@gmail.com>
|
* @author Dmitry Naumov-Socolov <naumov.socolov@gmail.com>
|
||||||
* @copyright vesta 2010-2011
|
* @copyright vesta 2010-2011
|
||||||
*/
|
*/
|
||||||
class WEB_DOMAIN extends AjaxHandler {
|
class WEB_DOMAIN extends AjaxHandler
|
||||||
function getListExecute($request)
|
{
|
||||||
|
|
||||||
|
public function getListExecute(Request $request)
|
||||||
{
|
{
|
||||||
$_user = 'vesta';
|
$user = $this->getLoggedUser();
|
||||||
$reply = array();
|
$reply = array();
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_LIST_WEB_DOMAINS, array($_user, Config::get('response_type')));
|
$result = Vesta::execute(Vesta::V_LIST_WEB_DOMAINS, array($user['uid'], Config::get('response_type')));
|
||||||
|
|
||||||
// echo '<pre>';
|
|
||||||
// print_r($result);
|
|
||||||
|
|
||||||
foreach($result['data'] as $web_domain => $data)
|
foreach($result['data'] as $web_domain => $data)
|
||||||
{
|
{
|
||||||
|
@ -41,85 +40,85 @@ class WEB_DOMAIN extends AjaxHandler {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $reply);
|
return $this->reply($result['status'], $reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function addExecute($request)
|
public function addExecute(Request $request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$_s = $request->getParameter('spell');
|
||||||
$_s = $r->getSpell();
|
$user = $this->getLoggedUser();
|
||||||
$_user = 'vesta';
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $user['uid'],
|
||||||
'DOMAIN' => $_s['DOMAIN'],
|
'DOMAIN' => $_s['DOMAIN'],
|
||||||
'IP' => $_s['IP']
|
'IP' => $_s['IP']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN, $params);
|
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN, $params);
|
||||||
|
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_s['TPL']) {
|
||||||
|
$params = array(
|
||||||
// if(0)
|
'USER' => $user['uid'],
|
||||||
if($_s['TPL'])
|
|
||||||
{
|
|
||||||
$params = array('USER' => $_user,
|
|
||||||
'DOMAIN' => $_s['DOMAIN'],
|
'DOMAIN' => $_s['DOMAIN'],
|
||||||
'TPL' => $_s['TPL']);
|
'TPL' => $_s['TPL']
|
||||||
|
);
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_TPL, $params);
|
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_TPL, $params);
|
||||||
|
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
$this->errors['CHANGE_TPL'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['CHANGE_TPL'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if(0)
|
if ($_s['ALIAS']) {
|
||||||
if($_s['ALIAS'])
|
|
||||||
{
|
|
||||||
$alias_arr = explode(',', $_s['ALIAS']);
|
$alias_arr = explode(',', $_s['ALIAS']);
|
||||||
|
|
||||||
foreach($alias_arr as $alias)
|
foreach ($alias_arr as $alias) {
|
||||||
{
|
$params = array(
|
||||||
$params = array('USER' => $_user,
|
'USER' => $user['uid'],
|
||||||
'DOMAIN' => $_s['DOMAIN'],
|
'DOMAIN' => $_s['DOMAIN'],
|
||||||
'ALIAS' => trim($alias));
|
'ALIAS' => trim($alias)
|
||||||
|
);
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ALIAS, $params);
|
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ALIAS, $params);
|
||||||
|
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
$this->errors['ALIAS'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['ALIAS'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if(0)
|
if ($_s['STAT']) {
|
||||||
if($_s['STAT'])
|
$params = array(
|
||||||
{
|
'USER' => $user['uid'],
|
||||||
$params = array('USER' => $_user,
|
|
||||||
'DOMAIN' => $_s['DOMAIN'],
|
'DOMAIN' => $_s['DOMAIN'],
|
||||||
'STAT' => $_s['STAT']);
|
'STAT' => $_s['STAT']);
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT, $params);
|
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT, $params);
|
||||||
|
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
$this->errors['STATS'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['STATS'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if(0)
|
if ($_s['STAT_AUTH']) {
|
||||||
if($_s['STAT_AUTH'])
|
$params = array(
|
||||||
{
|
'USER' => $user['uid'],
|
||||||
$params = array('USER' => $_user,
|
|
||||||
'DOMAIN' => $_s['DOMAIN'],
|
'DOMAIN' => $_s['DOMAIN'],
|
||||||
'STAT_USER' => $_s['STAT_USER'],
|
'STAT_USER' => $_s['STAT_USER'],
|
||||||
'STAT_PASSWORS' => $_s['STAT_PASSWORD']);
|
'STAT_PASSWORS' => $_s['STAT_PASSWORD']
|
||||||
|
);
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT_AUTH, $params);
|
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT_AUTH, $params);
|
||||||
|
|
||||||
|
@ -127,51 +126,55 @@ class WEB_DOMAIN extends AjaxHandler {
|
||||||
$this->errors['STAT_AUTH'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['STAT_AUTH'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(0)
|
if (0) {
|
||||||
if($_s['SSL'])
|
if ($_s['SSL']) {
|
||||||
{
|
$params = array(
|
||||||
$params = array('USER' => $_user,
|
'USER' => $user[''],
|
||||||
'DOMAIN' => $_s['DOMAIN'],
|
'DOMAIN' => $_s['DOMAIN'],
|
||||||
'SSL_CERT' => $_s['SSL_CERT']);
|
'SSL_CERT' => $_s['SSL_CERT']
|
||||||
|
);
|
||||||
|
|
||||||
if($_s['SSL_HOME'])
|
if ($_s['SSL_HOME']) {
|
||||||
$params['SSL_HOME'] = $_s['SSL_HOME'];
|
$params['SSL_HOME'] = $_s['SSL_HOME'];
|
||||||
|
}
|
||||||
|
|
||||||
if($_s['SSL_TEXT'])
|
if ($_s['SSL_TEXT']) {
|
||||||
{}
|
// TODO: implement
|
||||||
// if($_FILES['SSL_CERT'])
|
}
|
||||||
// $ssl_text = file_get_contents($_FILES...);
|
|
||||||
|
|
||||||
|
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_SSL, $params);
|
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_SSL, $params);
|
||||||
|
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
$this->errors['SSL'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['SSL'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if(0)
|
if ($_s['CREATE_DNS_DOMAIN']) {
|
||||||
if($_s['CREATE_DNS_DOMAIN'])
|
$params = array(
|
||||||
{
|
'USER' => $user['uid'],
|
||||||
$params = array('USER' => $_user,
|
|
||||||
'DNS_DOMAIN' => $_s['DOMAIN'],
|
'DNS_DOMAIN' => $_s['DOMAIN'],
|
||||||
'IP' => $_s['IP']);
|
'IP' => $_s['IP']
|
||||||
|
);
|
||||||
|
|
||||||
require_once V_ROOT_DIR . 'api/DNS.class.php';
|
require_once V_ROOT_DIR . 'api/DNS.class.php';
|
||||||
|
|
||||||
$dns = new DNS();
|
$dns = new DNS();
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$result = $dns->addExecute($params);
|
$result = $dns->addExecute($params);
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
$this->errors['DNS_DOMAIN'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['DNS_DOMAIN'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(0)
|
/*
|
||||||
if($_s['CREATE_MAIL_DOMAIN'])
|
if ($_s['CREATE_MAIL_DOMAIN']) {
|
||||||
{
|
$params = array(
|
||||||
$params = array('USER' => $_user,
|
'USER' => $_user,
|
||||||
'MAIL_DOMAIN' => $_s['DOMAIN'],
|
'MAIL_DOMAIN' => $_s['DOMAIN'],
|
||||||
'IP' => $_s['IP']);
|
'IP' => $_s['IP']
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
require_once V_ROOT_DIR . 'api/MAIL.class.php';
|
require_once V_ROOT_DIR . 'api/MAIL.class.php';
|
||||||
|
@ -179,30 +182,29 @@ class WEB_DOMAIN extends AjaxHandler {
|
||||||
$mail = new MAIL();
|
$mail = new MAIL();
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$result = $mail->addExecute($params);
|
$result = $mail->addExecute($params);
|
||||||
if(!$result['status'])
|
if (!$result['status'])
|
||||||
$this->errors['MAIL_DOMAIN'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['MAIL_DOMAIN'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function delExecute($request)
|
public function deleteExecute(Request $request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$_s = $request->getParameter('spell');
|
||||||
$_s = $r->getSpell();
|
$user = $this->getLoggedUser();
|
||||||
$_user = 'vesta';
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $user['uid'],
|
||||||
'DOMAIN' => $_s['DOMAIN']
|
'DOMAIN' => $_s['DOMAIN']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN, $params);
|
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN, $params);
|
||||||
|
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
|
@ -213,64 +215,48 @@ class WEB_DOMAIN extends AjaxHandler {
|
||||||
$dns = new DNS();
|
$dns = new DNS();
|
||||||
$result = $dns->delExecute($params);
|
$result = $dns->delExecute($params);
|
||||||
|
|
||||||
if(!$result['status'] && $result['error_code'] != 31) // domain not found
|
if (!$result['status'] && $result['error_code'] != 31) { // domain not found
|
||||||
$this->errors['DNS'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['DNS'] = array($result['error_code'] => $result['error_message']);
|
||||||
|
}
|
||||||
|
|
||||||
require_once V_ROOT_DIR . 'api/DNS.class.php';
|
require_once V_ROOT_DIR . 'api/DNS.class.php';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $user['uid'],
|
||||||
'MAIL_DOMAIN' => $_s['DOMAIN']
|
'MAIL_DOMAIN' => $_s['DOMAIN']
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
|
||||||
require_once V_ROOT_DIR . 'api/MAIL.class.php';
|
|
||||||
$mail = new MAIL();
|
|
||||||
$result = $mail->delExecute($params);
|
|
||||||
|
|
||||||
if(!$result['status'] && $result['error_code'] != 31) // domain not found
|
|
||||||
$this->errors['MAIL'] = array($result['error_code'] => $result['error_message']);
|
|
||||||
*/
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function changeExecute(Request $request)
|
||||||
|
|
||||||
function changeExecute($request)
|
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$_s = $request->getParameter('spell');
|
||||||
$_s = $r->getSpell();
|
$_old = $request->getParameter('old');
|
||||||
$_old = $_s['old'];
|
$_new = $request->getParameter('new');
|
||||||
$_new = $_s['new'];
|
|
||||||
|
|
||||||
$_user = 'vesta';
|
$user = $this->getLoggedUser();
|
||||||
$_DOMAIN = $_new['DOMAIN'];
|
$_DOMAIN = $_new['DOMAIN'];
|
||||||
|
|
||||||
if($_old['IP'] != $_new['IP'])
|
if ($_old['IP'] != $_new['IP']) {
|
||||||
{
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_IP, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'IP' => $_new['IP']));
|
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_IP, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'IP' => $_new['IP']));
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
{
|
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['IP_ADDRESS'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['IP_ADDRESS'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($_old['TPL'] != $_new['TPL']) {
|
||||||
if($_old['TPL'] != $_new['TPL'])
|
|
||||||
{
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_TPL, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'TPL' => $_new['TPL']));
|
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_TPL, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'TPL' => $_new['TPL']));
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
{
|
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['TPL'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['TPL'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_old['ALIAS'] != $_new['ALIAS'])
|
if ($_old['ALIAS'] != $_new['ALIAS']) {
|
||||||
{
|
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
$old_arr = explode(',', $_old['ALIAS']);
|
$old_arr = explode(',', $_old['ALIAS']);
|
||||||
|
@ -279,20 +265,17 @@ class WEB_DOMAIN extends AjaxHandler {
|
||||||
$added = array_diff($new_arr, $old_arr);
|
$added = array_diff($new_arr, $old_arr);
|
||||||
$deleted = array_diff($old_arr, $new_arr);
|
$deleted = array_diff($old_arr, $new_arr);
|
||||||
|
|
||||||
foreach($added as $alias)
|
foreach ($added as $alias) {
|
||||||
{
|
|
||||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ALIAS, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'ALIAS' => $alias));
|
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ALIAS, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'ALIAS' => $alias));
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
{
|
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['ADD_ALIAS'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['ADD_ALIAS'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach($deleted as $alias)
|
|
||||||
{
|
foreach ($deleted as $alias) {
|
||||||
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_ALIAS, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'ALIAS' => $alias));
|
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_ALIAS, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'ALIAS' => $alias));
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
{
|
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['DEL_ALIAS'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['DEL_ALIAS'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
@ -300,213 +283,115 @@ class WEB_DOMAIN extends AjaxHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($_old['STAT'] != $_new['STAT'])
|
if ($_old['STAT'] != $_new['STAT']) {
|
||||||
{
|
if ($_new['STAT'] == true) {
|
||||||
if($_new['STAT'] == true)
|
|
||||||
{
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'STAT' => $_new['STAT']));
|
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'STAT' => $_new['STAT']));
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
{
|
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['ADD_STAT'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['ADD_STAT'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_new['STAT'] == false)
|
if ($_new['STAT'] == false) {
|
||||||
{
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_STAT, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
|
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_STAT, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
{
|
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['DEL_STAT'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['DEL_STAT'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_STAT_AUTH, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'STAT_USER' => $_new['STAT_USER']));
|
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_STAT_AUTH, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'STAT_USER' => $_new['STAT_USER']));
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
{
|
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['DEL_STAT_AUTH'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['DEL_STAT_AUTH'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(0)
|
if ($_old['CGI'] != $_new['CGI']) {
|
||||||
// ssl
|
if ($_new['CGI'] == true) {
|
||||||
if($_old['SSL'] != $_new['SSL'])
|
|
||||||
{
|
|
||||||
if($_new['SSL'] == true)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
if($_new['SSL'] == false)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if($_old['SSL_CERT'] != $_new['SSL_CERT'])
|
|
||||||
{
|
|
||||||
$result = array();
|
|
||||||
$_SSL_CERT = $_new['SSL_CERT'];
|
|
||||||
// or read uploaded tmp file
|
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_CERT, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'SSL_CERT' => $_SSL_CERT ));
|
|
||||||
if(!$result['status'])
|
|
||||||
{
|
|
||||||
$this->status = FALSE;
|
|
||||||
$this->errors['SSL_CERT'] = array($result['error_code'] => $result['error_message']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($_old['SSL_HOME'] != $_new['SSL_HOME'])
|
|
||||||
{
|
|
||||||
$result = array();
|
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_SSLHOME, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'SSL_HOME' => $_new['SSL_HOME']));
|
|
||||||
if(!$result['status'])
|
|
||||||
{
|
|
||||||
$this->status = FALSE;
|
|
||||||
$this->errors['SSL_HOME'] = array($result['error_code'] => $result['error_message']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_old['CGI'] != $_new['CGI'])
|
|
||||||
{
|
|
||||||
if($_new['CGI'] == true)
|
|
||||||
{
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_CGI, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
|
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_CGI, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
{
|
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['ADD_CGI'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['ADD_CGI'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($_new['CGI'] == false)
|
|
||||||
{
|
if ($_new['CGI'] == false) {
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_CGI, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
|
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_CGI, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
{
|
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['DEL_CGI'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['DEL_CGI'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_old['ELOG'] != $_new['ELOG'])
|
if ($_old['ELOG'] != $_new['ELOG']) {
|
||||||
{
|
if ($_new['ELOG'] == true) {
|
||||||
if($_new['ELOG'] == true)
|
|
||||||
{
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ELOG, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
|
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ELOG, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
{
|
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['ADD_ELOG'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['ADD_ELOG'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($_new['ELOG'] == false)
|
|
||||||
{
|
if ($_new['ELOG'] == false) {
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_ELOG, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
|
$result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_ELOG, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
{
|
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['DEL_ELOG'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['DEL_ELOG'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function suspendExecute($request)
|
public function suspendExecute(Request $request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$_s = $request->getParameter('spell');
|
||||||
$_s = $r->getSpell();
|
$user = $this->getLoggedUser();
|
||||||
|
|
||||||
$_user = 'vesta';
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user['uid'],
|
||||||
'DOMAIN' => $_s['DOMAIN']
|
'DOMAIN' => $_s['DOMAIN']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_SUSPEND_WEB_DOMAIN, $params);
|
$result = Vesta::execute(Vesta::V_SUSPEND_WEB_DOMAIN, $params);
|
||||||
|
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function unsuspendExecute($request)
|
public function unsuspendExecute(Request $request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$_s = $request->getParameter('spell');
|
||||||
$_s = $r->getSpell();
|
$user = $this->getLoggedUser();
|
||||||
|
|
||||||
$_user = 'vesta';
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $user['uid'],
|
||||||
'DOMAIN' => $_s['DOMAIN']
|
'DOMAIN' => $_s['DOMAIN']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_WEB_DOMAIN, $params);
|
$result = Vesta::execute(Vesta::V_UNSUSPEND_WEB_DOMAIN, $params);
|
||||||
|
|
||||||
if(!$result['status'])
|
if (!$result['status']) {
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function suspendAllExecute($request)
|
|
||||||
{
|
|
||||||
$r = new Request();
|
|
||||||
$_s = $r->getSpell();
|
|
||||||
|
|
||||||
$_user = 'vesta';
|
|
||||||
|
|
||||||
$params = array(
|
|
||||||
'USER' => $_user
|
|
||||||
);
|
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_SUSPEND_WEB_DOMAINS, $params);
|
|
||||||
|
|
||||||
if(!$result['status'])
|
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
|
||||||
}
|
|
||||||
|
|
||||||
function unsuspendAllExecute($request)
|
|
||||||
{
|
|
||||||
$r = new Request();
|
|
||||||
$_s = $r->getSpell();
|
|
||||||
|
|
||||||
$_user = 'vesta';
|
|
||||||
|
|
||||||
$params = array(
|
|
||||||
'USER' => $_user
|
|
||||||
);
|
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_WEB_DOMAINS, $params);
|
|
||||||
|
|
||||||
if(!$result['status'])
|
|
||||||
$this->errors[] = 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