Your IP : 216.73.216.229


Current Path : /home/jeromecohp/www/aesecure/premium/template/
Upload File :
Current File : /home/jeromecohp/www/aesecure/premium/template/form_21_protectIP.default.aec

<script src="%AESECURESITEURL%aesecure/third/autocomplete/jquery.autocomplete.js"></script>

<div data-aesecure="premium">
   <span style="visibility:hidden !important;display:none !important;" id="form%ID%_IPs"></span>
   <form id="form%ID%" class="form-inline" 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%"/>
      <label>%FOLDER%</label>&nbsp;
      <input id="folder" name="folder" type="text" size="50" class="input-small" placeholder="/aesecure" data-toggle="popover" data-content="%HINT_FOLDER%" required>&nbsp;<span class="text-danger glyphicon glyphicon-asterisk" />
      <br/><br/>
      <p>%PREFACE%</p>
      <label>%ADDRESSIP% (<span id="aeSecureMyIP" data-toggle="popover" data-content="%HINT_IP%" >%REMOTE_ADDR%</span>)</label>
      <textarea disabled="disabled" name="ips" class="form-control" rows="8" placeholder="" cols="98">%VALUES%</textarea><br/><br/>
      <input type="button" id="tab%ID%DoIt" class="btn btn-success aeButton" data-toggle="popover" data-content="%HINT%" value="%PROTECT%" />
      <input type="button" id="tab%ID%Remove" class="btn btn-danger aeButton" data-toggle="popover" data-content="%HINT%" value="%UNPROTECT%" />
   </form>

   <div id="div%ID%" class="ajaxResult"/>

</div>

<script type="text/javascript">

   $('#folder').autocomplete({
       serviceUrl: 'setup.php?w=2298&%AESECURETOKEN%=%TOKEN%'
   });

   // Initialize Pro functionnalities (if present)
   if (typeof initaeSecurePro !== 'undefined' && $.isFunction(initaeSecurePro)) initaeSecurePro(%ID%);

   // By double-clicking on the IP address, the IP will be appended to the list
   $("#aeSecureMyIP").dblclick(function(e) {

      var myIP=$("#aeSecureMyIP").html();

      var IPs=$('#form%ID%_IPs').html();
      if (IPs!='') {
         if (IPs.indexOf(myIP)==-1) $('#form%ID%_IPs').html(IPs+';'+myIP);
      } else {
         $('#form%ID%_IPs').html(myIP);
      }
      ResetIPs();

   });

   // When the user will type a folder name, aeSecure will make an Ajax call and will try to get the list of
   // already whitelisted IP (if any) for that folder.
   // The ResetIPs() function is called once the call is successfull and will reset the textarea
   function ResetIPs() {
        var IPs=$('#form%ID%_IPs').html();
        $('#form%ID%').find('textarea[name="ips"]').val(IPs);
        $('#form%ID%').find('textarea[name="ips"]').removeAttr('disabled');
   }

   $('[data-toggle="popover"]').popover({trigger:'hover','placement':'top','html':true});

   $('#form%ID%').find('input[name="folder"]').change(function() {

      // When the user will mention a directory name, make an Ajax call to aeSecure and try to find if
      // this folder is already protected.  In that case, retrieve the list of whitelisted IP addresses

      $('#form%ID% input[name=w]').val(%ID%99);
      var formData=$('#form%ID%').serialize();

      // The ajax call here should only be made on the folder name, to ask aeSecure to retrieve the current
      // protection.  No need to submit the editbox with the list of IPs
      formData=removeURLParameter(formData,'ips');

      SetupTask('%ID%99', 'form%ID%_IPs',formData, '', '', 'ResetIPs()', false, 'POST');

   });

   // Assign task to the different Protect/Optimize buttons
   $('#form%ID%').validate({
      rules: {
         folder: {required:true,minlength:2,maxlength:50}
      }
   });

   $('#tab%ID%DoIt').click(function(event) {
      if ($("#form%ID%").valid()) {
         $('#form%ID% input[name=w]').val(%ID%);
         var formData=$('#form%ID%').serialize();
         SetupTask('%ID%', 'div%ID%', formData, '%FEATURE_ENABLED%', '', '', true, 'POST','tab%ID%DoIt','','','%TAG%');
      };
   });

   $('#tab%ID%Remove').click(function(event) {
      if ($("#form%ID%").valid()) {
         alertify.set({ buttonFocus: "cancel",  buttonReverse: true  });
         alertify.confirm(getLanguageText('main.are_you_sure'), function (e) {
            if (e) {
               $('#form%ID% input[name=w]').val(%ID%);
               $('#form%ID%').find('textarea[name="ips"]').val('');
               var formData=$('#form%ID%').serialize();
               SetupTask('%ID%', '', formData, '', '', '', true, 'POST','tab%ID%Remove','','','%TAG%');
            }
         }); // alertify.confirm
      };
   });

</script>