| Current Path : /home/jeromecohp/www/aesecure/premium/template/ |
| Current File : /home/jeromecohp/www/aesecure/premium/template/form_31_chmod.default.aec |
<div data-aesecure="premium">
<form id="form%ID%" role="form">
<input type="hidden" name="w" value="%ID%" size="4"/>
<input type="hidden" name="a" value="1" size="1"/>
<input type="hidden" name="%AESECURETOKEN%" value="%TOKEN%"/>
%PROTECTHTML%
<br/><button id="tab%ID%DoIt" class="btn btn-success aeButton" data-toggle="popover" data-content="%HINT%">%PROTECT%</button>
</form>
</div>
<script type="text/javascript">
function reloadFilesFolders() {
SetupTask('%ID%','form%ID%','t=3','','','gotoTab()','','POST');
}
function gotoTab() {
document.location.hash = 'chmodfiles';
}
function tableSort() {
// The table is now filled in with every monitored sites; add the table sorting functionnalities and widget
$("#chmodfilesfolders").tablesorter({
widthFixed: true,
showProcessing: true,
widgets: [ 'uitheme', 'stickyHeaders' ],
widgetOptions: {
stickyHeaders : '',
stickyHeaders_offset : $('#topnav').height(), // Because of the top horizontal menu
cssStickyHeaders_addCaption : true,
cssStickyHeaders_attachTo : null,
cssStickyHeaders_filteredToTop : true,
cssStickyHeaders_zIndex : 10,
zebra : ["ui-widget-content even", "ui-state-default odd"]
},
ignoreCase: true,
headerTemplate: '{content} {icon}',
initWidgets: true
});
return;
} // function tableSort()
var bClickOnProtect=false;
var previous="%PREVIOUS%";
var nochange="%NOCHANGE%";
// Prevent the form's submission (the user has press on the Enter key f.i.).
// The submission is only done by clicking on the "Execute" button to make sure that
// the call is correct (with token)
$("#form%ID%").submit(function(event) { event.preventDefault(); });
$('[data-toggle="popover"]').popover({trigger:'hover','placement':'top','html':true});
$(function() { $('th').tooltip({placement: 'top'});});
$(function() { $('span').tooltip({placement: 'rigth'});});
$("#tab%ID%DoIt").click(function(e) {
var wcount=0;
// Get the list of entries in the table and, for each row, check if the user has modified the chmod of the entry (which is a folder or a file)
$('#chmodfilesfolders > tbody > tr').each(function() {
// this.id is, for instance, chmodconfiguration.php. Keep only the file/folder name and thus configuration.php
var name=this.id.substr(5);
// Get the current chmod of this file/folder
var current=$('#form%ID%').find('input[name="'+this.id+'_current"]').val();
// Get the selected permission
var newval=$('#form%ID%').find('input[name="'+this.id+'"]:checked').val();
// Check if the new value is different which means that the user has changed the permissions
if (current!==newval) {
// Replace the § character by a dot
name=name.replace(/\§/g,".");
console.log(name+' new value='+newval+' current val='+current);
SetupTask('%ID%', 'tab'+this.id+'_result', 'f='+name+'&c='+newval,'','','','','POST');
wcount++;
} // if (current!==newval)
});
if (wcount==0) { alertify.log(nochange); } else { alertify.success((aeSecure.demo=='true'?'<span class="text-danger" style="font-weight:bold;">demo</span> ':'')+'%FEATURE_ENABLED%'); }
});
$("#chmodfilesfoldersmakezip").click(function(e) {
if(aeSecure.demo=='false') {
// Zip the entire website and download it
alertify.set({ buttonFocus: "cancel", buttonReverse: true });
alertify.confirm(getLanguageText('31_permissions.makezipconfirm'), function (e) {
if (e) {
// Retrieve the url for the download : this is an hidden input field with a name
//like download_url_configuration§php (the dot has been replaced by §)
var downloadurl='download_weburl';
// Be sure that the url is present for that element
if ($('#form%ID%').find('input[name="'+downloadurl+'"]').length>0) {
var url=$('#form%ID%').find('input[name="'+downloadurl+'"]').val();
alertify.log("<strong>"+getLanguageText('main.pleasewaitcanbelong')+"</strong>","",0);
document.location.href =url;
} // if
} // if (e)
}); // alertify.confirm
} else {
alertify.error('Functionalitly not enabled during the demo mode');
}
});
// Kill a file
$( "span[id^='kill']" ).click(function(e) {
if (aeSecure.demo=='false') {
var name=this.id.substr(4); // name = configuration.php <-- our filename / foldername
var sConfirm="%CONFIRMKILL%"
var sRemoved="%FILEREMOVED%"
sConfirm=sConfirm.replace("%s",name);
// Replace the § character by a dot
sConfirm=sConfirm.replace(/\§/g,".");
sRemoved=sRemoved.replace("%s",name);
sRemoved=sRemoved.replace(/\"§"/g,".");
alertify.set({ buttonFocus: "cancel", buttonReverse: true });
alertify.confirm(sConfirm, function (e) {
if (e) {
SetupTask('%ID%', '', 'f='+name+'&k=1', '', '', 'reloadFilesFolders()','','POST');
}
}); // alertify.confirm
} else {
alertify.error('Functionalitly not enabled during the demo mode');
}
});
// View a file
$( "span[id^='view']" ).click(function(e) {
if (aeSecure.demo=='false') {
var name=this.id.substr(4); // name = configuration.php <-- our filename / foldername
// Get file content / display the file
SetupTask('%ID%', '', 'f='+name+'&v=1','','','new_window','','POST');
// }); // alertify.confirm
} else {
alertify.error('Functionalitly not enabled during the demo mode');
}
});
// Download a file
$( "span[id^='download']" ).click(function(e) {
if (aeSecure.demo=='false') {
var name=this.id.substr(8); // name = configuration.php <-- our filename / foldername
// Retrieve the url for the download : this is an hidden input field with a name
//like download_url_configuration§php (the dot has been replaced by §)
var downloadurl='download_url_'+name;
// Be sure that the url is present for that element
if ($('#form%ID%').find('input[name="'+downloadurl+'"]').length>0) {
var url=$('#form%ID%').find('input[name="'+downloadurl+'"]').val();
alertify.log("<strong>"+getLanguageText('main.pleasewaitcanbelong')+"</strong>","",0);
document.location.href =url;
} // if
// }); // alertify.confirm
} else {
alertify.error('Functionalitly not enabled during the demo mode');
}
});
// Capture click on a folder name. The span has an id like "aefolder_administrator"
$( "span[id^='aefolder_']" ).click(function(e) {
// No directory change during demo
if (aeSecure.demo=='false') {
var name=this.id.substr(9); // name = administrator <-- our foldername
SetupTask('%ID%','form%ID%','t=3&f='+name,'','','','','POST');
} else {
alertify.error('Functionalitly not enabled during the demo mode');
}
});
$( "input[name^='chmod']" ).click(function(e) {
// this.name is, for instance, chmodconfiguration.php_444. Keep only the file/folder name and thus configuration.php
var name=this.name.substr(5); // name = configuration.php <-- our filename / foldername
var optname=this.name; // optname = chmodconfiguration.php
// Get the current chmod of this file/folder (current=actual chmod of the file/folder on the server)
var current=$('#form%ID%').find('input[name="'+optname+'_current"]').val();
// Get the new selected permission
var val=$('#form%ID%').find('input[name="'+this.name+'"]:checked').val();
// Does we need to show a confirm message ?
var askfor=$('#form%ID%').find('input[name="'+optname+'_confirm"]').val();
if (askfor==1) {
$('#'+optname).css("border","1px dotted blue");
alertify.set({ buttonFocus: "cancel", buttonReverse: true });
alertify.confirm("%CONFIRM%", function (e) {
if (e) {
if (val!=current) {
$('#'+optname+'_result').html(' <span class="label label-primary" style="font-size:1em;">' + previous + ' : ' + current + '</span>');
} else {
$('#'+optname+'_result').html(' ');
}
$('#'+optname).css("border", "0px");
} else {
// The user wish to cancel.
// Get the ID of the radio button that match the current chmod f.i. chmodconfiguration.php_644
var optcurrent=optname.concat('_',current);
// And check it back
$('#'+optcurrent).prop("checked","checked");
alertify.log("%CANCEL%");
$('#'+optname).css("border", "0px");
} // if (e)
}); // alertify.confirm
} else { // if (askfor==1)
$('#'+optname+'_result').html(' <span class="label label-primary" style="font-size:1em;">' + previous + ' : ' + current + '</span>');
} // if (askfor==1)
if (bClickOnProtect==0) {
alertify.log("%CLICKONPROTECT%");
bClickOnProtect=1;
}
});
// Activate the TableSort plugin
tableSort();
</script>