| Server IP : 104.21.37.246 / Your IP : 172.71.28.145 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/2388322/task/2388322/cwd/3rdparty/cloudlinux/ |
Upload File : |
/**
* Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved
*
* Licensed under CLOUD LINUX LICENSE AGREEMENT
* http://cloudlinux.com/docs/LICENSE.TXT
*/
(function(win) {
var doc = win.document,
version_select = doc.getElementById('user-selector-select-version'),
opttable_body = doc.getElementById('user-selector-options-table'),
opttable_save = doc.getElementById('user-selector-table-save'),
infobox = doc.getElementById('infobox').innerHTML,
sel_message = doc.getElementById('selector-message'),
temp_buffer;
if (infobox) {
if (typeof isPlesk !== 'undefined' && isPlesk === true) {
var cur_ver = doc.getElementById('user-selector-current-version');
if (cur_ver !== null && cur_ver.innerText === 'native') {
doc.querySelector('.tabs-area a[href*="selector-user/option"]').
setAttribute('style', 'display:none');
if (infobox === 'Cannot get extensions list for version native') {
infobox = 'Warning, changing php modules and php options via PHP Selector for native php version is impossible.';
}
}
}
displayIt('warn', infobox);
}
message_box.onclick = function() {
while (message_box.firstChild) {
message_box.removeChild(message_box.firstChild);
}
};
opttable_body.onclick = function(e) {
var tgt = e.target;
var tagClasses = tgt.className.split(' ');
if (tgt.nodeName === 'A' && tgt.className.indexOf('option-link_') == 0) {
var nodes = opttable_body.childNodes;
for (var row in nodes) {
if (nodes[row].firstElementChild !== null &&
nodes[row].firstElementChild !== undefined) {
var row_name = nodes[row].firstElementChild.firstChild.nodeValue;
if (win.getComputedStyle(
doc.getElementById('option-control_' + row_name), '').
display.
toLowerCase() != 'none') {
doc.getElementById(
'option-control_' + row_name).style.display = 'none';
doc.getElementById(
'option-value_' + row_name).style.display = 'table-cell';
}
}
}
temp_buffer = tgt.firstChild.nodeValue;
var optName = tgt.className.substring(tgt.className.indexOf('_') + 1);
var valueID = 'option-value_' + optName,
ctrlID = 'option-control_' + optName;
doc.getElementById(valueID).style.display = 'none';
doc.getElementById(ctrlID).style.display = 'table-cell';
if (!opttable_save.disabled) {
opttable_save.disabled = true;
}
}
else if (tgt.nodeName === 'INPUT' && tagClasses.indexOf('opt-submit') >=
0) {
var ctrl_cell = doc.getElementById(tgt.parentNode.id),
value_cell = doc.getElementById(
tgt.parentNode.previousElementSibling.id);
if (tgt.previousElementSibling.nodeName === 'INPUT') {
var custom_value = tgt.previousElementSibling.value;
}
else if (tgt.previousElementSibling.nodeName === 'SELECT') {
var custom_value = tgt.previousElementSibling.options[tgt.previousElementSibling.selectedIndex].firstChild.nodeValue;
}
if (custom_value === '') {
custom_value = 'no value';
}
if (custom_value == tgt.nextElementSibling.value) {
value_cell.firstElementChild.firstChild.nodeValue = custom_value;
value_cell.firstElementChild.style.color = '#A0A0A0';
}
else if (temp_buffer && temp_buffer != custom_value) {
value_cell.firstElementChild.firstChild.nodeValue = custom_value;
value_cell.firstElementChild.style.color = '#EDA200';
}
temp_buffer = undefined;
ctrl_cell.style.display = 'none';
value_cell.style.display = 'table-cell';
if (opttable_save.disabled) {
opttable_save.disabled = false;
}
}
else if (tgt.nodeName === 'INPUT' && tagClasses.indexOf('opt-reset') >= 0) {
var ctrl_cell = doc.getElementById(tgt.parentNode.id),
value_cell = doc.getElementById(
tgt.parentNode.previousElementSibling.id),
dflt_value = tgt.previousElementSibling.value;
value_cell.firstElementChild.firstChild.nodeValue = dflt_value ||
'no value';
if (ctrl_cell.firstElementChild.nodeName === 'INPUT') {
ctrl_cell.firstElementChild.value = dflt_value;
}
else if (ctrl_cell.firstElementChild.nodeName === 'SELECT') {
var opts = ctrl_cell.firstElementChild.childNodes;
for (var i in opts) {
if (opts[i].nodeType != 1 && opts[i].nodeName !== 'OPTION') {
continue;
}
if (opts[i].firstChild.nodeValue === dflt_value) {
opts[i].selected = true;
}
else {
opts[i].selected = false;
}
}
}
value_cell.firstElementChild.style.color = '#A0A0A0';
ctrl_cell.style.display = 'none';
value_cell.style.display = 'table-cell';
if (opttable_save.disabled) {
opttable_save.disabled = false;
}
}
};
opttable_save.onclick = function(e) {
var nodes = opttable_body.childNodes,
selected_version = stripVersion(
version_select.options[version_select.selectedIndex].firstChild.nodeValue),
request = new XMLHttpRequest(),
data = [],
request_data = {'version': selected_version, 'action': 'optsave'};
if (typeof(username) !== 'undefined') {
request_data['username'] = username;
}
if (selected_version === 'native') {
doc.querySelector('.tabs-area a[href*="selector-user/option"]').
setAttribute('style', 'display:none');
infobox = 'Warning, changing php modules and php options via PHP Selector for native php version is impossible.';
displayIt('warn', infobox);
}
for (var row in nodes) {
if (nodes[row].firstElementChild === null ||
nodes[row].firstElementChild === undefined) {
continue;
}
var row_name = nodes[row].firstElementChild.firstChild.nodeValue,
row_value = doc.getElementById(
'option-value_' +
row_name).firstElementChild.firstChild.nodeValue,
row_dflt = doc.getElementById('option-control_' +
row_name).firstElementChild.nextElementSibling.nextElementSibling.value;
if (row_value == row_dflt) {
continue;
}
data.push(encodeBase64(row_name + ':' + row_value));
}
request_data['optset'] = data.join(',');
request.open('POST', uri);
request.onreadystatechange = function() {
if (request.readyState === 4 && request.status === 200) {
var data = ie ? json_parse(request.responseText) : JSON.parse(
request.responseText);
if (data !== undefined) {
if (data['status'] !== 'OK' && 'message' in data) {
displayIt(data['status'].toLowerCase(), data['message']);
}
else if (data['status'] === 'OK') {
var msg = ('success_msg' in data)
? data.success_msg
: 'Settings saved';
displayIt('info', msg);
}
}
}
};
request.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
request.send(encodeFormData(request_data));
};
version_select.onchange = function() {
var selected_version = stripVersion(
version_select.options[version_select.selectedIndex].firstChild.nodeValue),
request = new XMLHttpRequest(),
request_data = {'version': selected_version, 'action': 'optlist'};
if (typeof(username) !== 'undefined') {
request_data['username'] = username;
}
request.open('POST', uri);
request.onreadystatechange = function() {
var indexes = [];
if (request.readyState === 4 && request.status === 200) {
var data = ie ? json_parse(request.responseText) : JSON.parse(
request.responseText);
if (data !== undefined) {
while (opttable_body.firstChild) {
opttable_body.removeChild(opttable_body.firstChild);
}
if (data['status'] !== 'OK' && 'message' in data) {
if ('isPlesk' in data && 'errorForNativeVer' in data &&
data['errorForNativeVer']) {
if (data['message'] ===
'Cannot get extensions list for version native') {
data['message'] = 'Warning, changing php modules and php options via PHP Selector for native php version is impossible.';
}
displayIt(data['status'].toLowerCase(), data['message']);
doc.querySelector('.tabs-area a[href*="selector-user/option"]').
setAttribute('style', 'display:none');
} else if (data['message'] ===
'Cannot get extensions list for version native') {
sel_message.textContent = 'Warning: Changing php modules and php options via PHP Selector for native php version is impossible';
sel_message.setAttribute('style', 'display:block');
doc.getElementById('switch-to-url').
setAttribute('style', 'display:none');
} else {
displayIt(data['status'].toLowerCase(), data['message']);
}
} else {
if (sel_message !== null) {
sel_message.setAttribute('style', 'display:none');
}
if (doc.getElementById('switch-to-url') !== null) {
doc.getElementById('switch-to-url').
setAttribute('style', 'display:inline');
}
if ('isPlesk' in data && !('errorForNativeVer' in data)) {
doc.querySelector('.tabs-area a[href*="selector-user/option"]').
setAttribute('style', 'display:initial');
}
}
for (var option in data['data']) {
indexes.push(option);
}
for (var i in indexes.sort()) {
if (typeof indexes[i] !== 'string') {
continue;
}
var row = doc.createElement('tr'),
cells = [],
border_color = (i == indexes.length - 1
? end_row_border_color
: row_border_color);
row.title = data['data'][indexes[i]]['comment'];
row.style.borderBottom = '1px solid ' + border_color;
for (var j = 0; j != 3; j++) {
cells[j] = doc.createElement('td');
cells[j].style.height = '24px';
}
cells[0].appendChild(doc.createTextNode(indexes[i]));
cells[0].style.fontWeight = 'bold';
cells[0].style.paddingLeft = '12px';
cells[0].style.paddingRight = '32px';
var value_link = doc.createElement('a');
value_link.href = '#';
value_link.className = 'option-link_' + indexes[i];
if ('value' in data['data'][indexes[i]] &&
data['data'][indexes[i]]['value'] !== undefined) {
value_link.appendChild(
doc.createTextNode(data['data'][indexes[i]]['value']));
value_link.style.color = '#008C23';
}
else {
value_link.appendChild(doc.createTextNode(
data['data'][indexes[i]]['default'] || 'no value'));
value_link.style.color = '#A0A0A0';
}
cells[1].appendChild(value_link);
cells[1].id = 'option-value_' + indexes[i];
if (data['data'][indexes[i]]['type'] === 'list') {
var ctrl = doc.createElement('select'),
range = data['data'][indexes[i]]['range'].split(',');
for (var j = 0; j != range.length; j++) {
var opt = doc.createElement('option');
opt.appendChild(doc.createTextNode(range[j]));
opt.value = range[j];
if ('value' in data['data'][indexes[i]] &&
data['data'][indexes[i]]['value'] !== undefined &&
data['data'][indexes[i]]['value'] == range[j]) {
opt.selected = true;
}
else if (data['data'][indexes[i]]['default'] == range[j]) {
opt.selected = true;
}
ctrl.appendChild(opt);
}
}
else if (data['data'][indexes[i]]['type'] === 'bool') {
var ctrl = doc.createElement('select'),
values = ['On', 'Off'];
for (var j = 0; j != values.length; j++) {
var opt = doc.createElement('option');
if ('value' in data['data'][indexes[i]] &&
data['data'][indexes[i]]['value'] !== undefined &&
data['data'][indexes[i]]['value'] == values[j]) {
opt.selected = true;
}
else if (data['data'][indexes[i]]['default'] == values[j]) {
opt.selected = true;
}
opt.appendChild(doc.createTextNode(values[j]));
opt.value = values[j];
ctrl.appendChild(opt);
}
}
else {
var ctrl = doc.createElement('input');
ctrl.type = 'text';
ctrl.size = '12';
if ('value' in data['data'][indexes[i]] &&
data['data'][indexes[i]]['value'] !== undefined) {
ctrl.value = data['data'][indexes[i]]['value'];
}
else {
ctrl.value = data['data'][indexes[i]]['default'];
}
}
cells[2].id = 'option-control_' + indexes[i];
cells[2].style.display = 'none';
cells[2].appendChild(ctrl);
var opt_submit = doc.createElement('input'),
dflt_value = doc.createElement('input');
opt_submit.type = 'button';
dflt_value.type = 'hidden';
opt_submit.className = 'opt-submit';
opt_submit.value = 'Apply';
dflt_value.value = data['data'][indexes[i]]['default'];
cells[2].appendChild(opt_submit);
cells[2].appendChild(dflt_value);
if ('value' in data['data'][indexes[i]] &&
data['data'][indexes[i]]['value'] !== undefined) {
var opt_reset = doc.createElement('input');
opt_reset.type = 'button';
opt_reset.className = 'opt-reset';
opt_reset.value = 'Reset';
cells[2].appendChild(opt_reset);
}
for (var j = 0; j != cells.length; j++) {
row.appendChild(cells[j]);
}
opttable_body.appendChild(row);
}
if (opttable_save.disabled && indexes.length != 0) {
opttable_save.disabled = false;
}
else if (!opttable_save.disabled && indexes.length == 0) {
opttable_save.disabled = true;
}
}
}
};
request.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
request.send(encodeFormData(request_data));
};
}(window));