Plugin Directory

Changeset 3369101


Ignore:
Timestamp:
09/28/2025 07:04:21 AM (6 months ago)
Author:
softdiscover
Message:

v1.6.2

Location:
softdiscover-db-file-manager/trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • softdiscover-db-file-manager/trunk/assets/backend/js/admin.js

    r3027919 r3369101  
    1 var flmbkp_back_fm=flmbkp_back_fm||null,flmbkp_back_backup=(($uifm="undefined"==typeof $uifm?jQuery:$uifm).isFunction(flmbkp_back_fm)||!function(e,t){"use strict";var r=function(){this.initialize=function(){e(document).on("change",".uiform-editing-header select",function(e){r.header_options_submit()})},this.header_options_submit=function(){console.log("change  submit"),e.ajax({type:"POST",url:ajaxurl,data:{action:"flmbkp_header_options",page:"flmbkp_file_manager",flmbkp_security:flmbkp_vars.ajax_nonce,options:e("#flmbkp_header_opt").serialize()},success:function(e){flmbkp_back_helper.redirect_tourl(e.url)}})}};t.flmbkp_back_fm=r=e.flmbkp_back_fm=new r,r.initialize()}($uifm,window),flmbkp_back_backup||null),flmbkp_back_settings=(($uifm="undefined"==typeof $uifm?jQuery:$uifm).isFunction(flmbkp_back_backup)||!function(r,e){"use strict";var s=function(){this.initialize=function(){r(document).on("click","#flmbkp_backup_form button",function(e){return e.preventDefault(),e.stopPropagation(),r(this).prop("disabled",!0),s.options_createRec(),!1})},this.options_createRec=function(){0<r("#flmbkp_backup_form input:checked").length?(r("#flmbkp_progress_graph").show(),r.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"flmbkp_backup_createrec",page:"flmbkp_page_backups",flmbkp_security:flmbkp_vars.ajax_nonce,options:r("#flmbkp_backup_form").serialize()},success:function(e){for(var t in flmbkp_slug=e.slug,flmbkp_counter_qu=e.pending,url_redirect_afterbkp=e.url_redirect,flmbkp_counter_qu)r("#flmbkp_progress_"+flmbkp_counter_qu[t]).show();s.options_routeNextStep()}})):(r("#flmbkp_backup_form button").prop("disabled",!1),alert("Select one option at least"))},this.records_delreg=function(t){r.ajax({type:"POST",url:ajaxurl,data:{action:"flmbkp_backup_delete_records",page:"flmbkp_page_backups",flmbkp_security:flmbkp_vars.ajax_nonce,rec_id:t},success:function(e){r(".sfdc-block1-container a[data-recid='"+t+"']").closest("tr").fadeOut("slow")}})},this.records_restore=function(e){r.ajax({type:"POST",url:ajaxurl,data:{action:"flmbkp_backup_restore_records",page:"flmbkp_page_backups",flmbkp_security:flmbkp_vars.ajax_nonce,rec_id:e},success:function(e){r("#flmbkp_Modal").modal({show:!0,backdrop:"static",keyboard:!1}),r("#flmbkp_Modal .modal-title").html(e.modal_title),r("#flmbkp_Modal .modal-body").html(e.modal_body)}})},this.options_routeNextStep=function(){if(jQuery.isEmptyObject(flmbkp_counter_qu))nextstep="",processFinished=!0,r("#flmbkp_backup_form").find("button").prop("disabled",!0),flmbkp_back_helper.redirect_tourl(url_redirect_afterbkp);else switch(processFinished=!0,progressLastRun=!1,lastPrintedMessage="",initialRun=1,selected_paths=[],lastZipResponse={},isPaused=!1,cwd="",dir_listing=[],tmp_var1=function(e){for(var t in e)return[e[t],t]}(flmbkp_counter_qu),currentOption=tmp_var1[0],delete flmbkp_counter_qu[tmp_var1[1]],String(currentOption)){case"plugins":progressBarObj[currentOption]=r("#flmbkp_plugins_progress"),progressBarMsgObj[currentOption]=r("#flmbkp_plugins_progress_msg"),s.options_filebackup();break;case"themes":progressBarObj[currentOption]=r("#flmbkp_themes_progress"),progressBarMsgObj[currentOption]=r("#flmbkp_themes_progress_msg"),s.options_filebackup();break;case"uploads":progressBarObj[currentOption]=r("#flmbkp_uploads_progress"),progressBarMsgObj[currentOption]=r("#flmbkp_uploads_progress_msg"),s.options_filebackup();break;case"others":progressBarObj[currentOption]=r("#flmbkp_others_progress"),progressBarMsgObj[currentOption]=r("#flmbkp_others_progress_msg"),s.options_filebackup();break;case"database":progressBarObj[currentOption]=r("#flmbkp_database_progress"),progressBarMsgObj[currentOption]=r("#flmbkp_database_progress_msg"),s.options_filebackup();break;default:console.log("there is no option")}},this.options_downloadFiles=function(e){r("body").append("<iframe src='"+ajaxurl+"?action=flmbkp_backup_downloadfile&page=flmbkp_page_backups&flmbkp_security="+flmbkp_vars.ajax_nonce+"&flm_file="+e+"' style='display: none;' ></iframe>")},this.options_filebackup=function(){isPaused=!1,selected_paths=[cwd],isPaused||(initialRun&&(progressLogObj.val(""),lastPrintedMessage=""),progressBarObj[currentOption].addClass("active"),r.ajax({type:"POST",url:ajaxurl,dataType:"json",beforeSend:function(){processFinished=!1,initialRun&&s.watchProgress(),initialRun=0},data:{targets:selected_paths,flush_to_disk:50,max_execution_time:20,excludes:"",is_initial_run:initialRun,use_system_calls:!1,nexstep:currentOption,flmbkp_slug:flmbkp_slug,action:"flmbkp_backup_sendoptions",page:"flmbkp_page_backups",flmbkp_security:flmbkp_vars.ajax_nonce},success:function(e){(lastZipResponse=e).continue},complete:function(){!lastZipResponse.error&&lastZipResponse.continue?s.options_filebackup():(setTimeout(function(){s.options_routeNextStep()},3e3),processFinished=!0)}}))},this.watchProgress=function(){progressLastRun=!(!processFinished&&!isPaused),setTimeout(function(){r.ajax({url:ajaxurl,type:"GET",data:{action:"flmbkp_backup_watchprogress",page:"flmbkp_page_backups",flmbkp_security:flmbkp_vars.ajax_nonce},dataType:"json",success:function(e){if(""!=currentOption){for(var t="",r=0,s=0,s=e.msgs.indexOf(lastPrintedMessage)+1;s<e.msgs.length;s++)lastPrintedMessage=e.msgs[s],t+="\n"+e.msgs[s],r++;var n,a=progressLogObj.val().split("\n").length,o=progressLogObj.val();200<=length&&((n=progressLogObj.val().split("\n")).splice(0,a-(199+r)),o=n.join("\n")),progressLogObj.val(o+t),progressLogObj.scrollTop(progressLogObj[0].scrollHeight),progressBarObj[currentOption].attr("aria-valuenow",e.percent),progressBarObj[currentOption].css("width",e.percent+"%"),progressBarMsgObj[currentOption].text(e.percent+"% completed"),progressBarMsgObj[currentOption].css("width",e.percent+"%"),progressBarMsgObj[currentOption].removeClass("progress-bar-animated"),progressLastRun&&progressBarObj[currentOption].removeClass("active")}},complete:function(){progressLastRun||s.watchProgress()}})},1e3)}};e.flmbkp_back_backup=s=r.flmbkp_back_backup=new s,s.initialize()}($uifm,window),flmbkp_back_settings||null),flmbkp_back_helper=(($uifm="undefined"==typeof $uifm?jQuery:$uifm).isFunction(flmbkp_back_settings)||!function(t){"use strict";var e=function(){this.initialize=function(){t(document).on("click","#dbflm_page_settings .btn.btn-primary",function(e){return e.preventDefault(),e.stopPropagation(),console.log("ja"),console.log(t("#dbflm_page_settings_form").serialize()),t.ajax({type:"POST",url:ajaxurl,dataType:"json",beforeSend:function(){},data:{action:"flmbkp_settings_saveoptions",page:"flmbkp_page_settings",flmbkp_security:flmbkp_vars.ajax_nonce,options:t("#dbflm_page_settings_form").serialize()},success:function(e){e.success&&alert("User Roles saved successfully")}}),!1})}};window.flmbkp_back_settings=e=t.flmbkp_back_settings=new e,e.initialize()}($uifm),"undefined"==typeof $uifm&&($uifm=jQuery),flmbkp_back_helper||null);$uifm.isFunction(flmbkp_back_helper)||!function(e,t){"use strict";t.flmbkp_back_helper=e.flmbkp_back_helper=new function(){this.initialize=function(){},this.length_obj=function(e){var t,r=0;for(t in e)e.hasOwnProperty(t)&&r++;return r},this.generateUniqueID=function(e){var t=Math.random();return t.toString(36),t.toString(36).substr(2,e)},this.versionCompare=function(e,t,r){var s=r&&r.lexicographical,r=r&&r.zeroExtend,n=e.split("."),a=t.split(".");function o(e){return(s?/^\d+[A-Za-z]*$/:/^\d+$/).test(e)}if(!n.every(o)||!a.every(o))return NaN;if(r){for(;n.length<a.length;)n.push("0");for(;a.length<n.length;)a.push("0")}s||(n=n.map(Number),a=a.map(Number));for(var i=0;i<n.length;++i){if(a.length==i)return 1;if(n[i]!=a[i])return n[i]>a[i]?1:-1}return n.length!=a.length?-1:0},this.getData=function(e,t){return e[t]},this.setData=function(e,t,r){e[t]=r},this.getData2=function(e,t,r){try{return e[t][r]}catch(e){console.log("error getUiData2: "+e.message)}},this.setData2=function(e,t,r,s){e.hasOwnProperty(t)||(e[t]={}),e[t].hasOwnProperty(r)||(e[t][r]={}),e[t][r]=s},this.getData3=function(e,t,r,s){try{return e[t][r][s]}catch(e){console.log("error getUiData3: "+e.message)}},this.delData3=function(e,t,r,s){delete e[t][r][s]},this.setData3=function(e,t,r,s,n){e.hasOwnProperty(t)||(e[t]={}),e[t].hasOwnProperty(r)||(e[t][r]={}),e[t][r][s]=n},this.setData4=function(e,t,r,s,n,a){e.hasOwnProperty(t)||(e[t]={}),e[t].hasOwnProperty(r)||(e[t][r]={}),e[t][r].hasOwnProperty(s)||(e[t][r][s]={}),e[t][r][s][n]=a},this.getData4=function(e,t,r,s,n){try{return e[t][r][s][n]}catch(e){console.log("error getUiData4: "+e.message)}},this.getData5=function(e,t,r,s,n,a){try{return void 0===e[t][r]?"":e[t][r][s][n][a]}catch(e){return console.log("error getUiData5: "+e.message),""}},this.setData5=function(e,t,r,s,n,a,o){e.hasOwnProperty(t)||(e[t]={}),e[t].hasOwnProperty(r)||(e[t][r]={}),e[t][r].hasOwnProperty(s)||(e[t][r][s]={}),e[t][r][s].hasOwnProperty(n)||(e[t][r][s][n]={}),e[t][r][s][n][a]=o},this.addIndexData5=function(e,t,r,s,n,a,o){void 0!==e[t][r][s][n][a]&&(e[t][r][s][n][a][o]={})},this.getData6=function(e,t,r,s,n,a,o){try{return void 0===e[t][r][s][n][a][o]?"":e[t][r][s][n][a][o]}catch(e){return console.log("error handled - getUiData6: "+e.message),""}},this.setData6=function(e,t,r,s,n,a,o,i){e.hasOwnProperty(t)||(e[t]={}),e[t].hasOwnProperty(r)||(e[t][r]={}),e[t][r].hasOwnProperty(s)||(e[t][r][s]={}),e[t][r][s].hasOwnProperty(n)||(e[t][r][s][n]={}),e[t][r][s][n].hasOwnProperty(a)||(e[t][r][s][n][a]={}),e[t][r][s][n][a][o]=i},this.delData6=function(e,t,r,s,n,a,o){delete e[t][r][s][n][a][o]},this.redirect_tourl=function(e){t.event?(t.event.returnValue=!1,t.location=e):location.href=e}}}($uifm,window);
     1var flmbkp_back_fm=flmbkp_back_fm||null,flmbkp_back_backup=(($uifm="undefined"==typeof $uifm?jQuery:$uifm).isFunction(flmbkp_back_fm)||!function(e,s){"use strict";var t=function(){this.initialize=function(){e(document).on("change",".uiform-editing-header select",function(e){t.header_options_submit()})},this.header_options_submit=function(){console.log("change  submit"),e.ajax({type:"POST",url:ajaxurl,data:{action:"flmbkp_header_options",page:"flmbkp_file_manager",flmbkp_security:flmbkp_vars.ajax_nonce,options:e("#flmbkp_header_opt").serialize()},success:function(e){flmbkp_back_helper.redirect_tourl(e.url)}})}};s.flmbkp_back_fm=t=e.flmbkp_back_fm=new t,t.initialize()}($uifm,window),flmbkp_back_backup||null),flmbkp_back_settings=(($uifm="undefined"==typeof $uifm?jQuery:$uifm).isFunction(flmbkp_back_backup)||!function(t,p){"use strict";var r=function(){function e(){p.progressLogObj=p.progressLogObj||t("#flmbkp_processLog"),p.progressBarObj=p.progressBarObj||{},p.progressBarMsgObj=p.progressBarMsgObj||{}}function s(){t("#flmbkp_cancel_btn").hide().prop("disabled",!0),t("#flmbkp_backup_btn").prop("disabled",!1)}p.flmbkp_slug=p.flmbkp_slug||"",p.flmbkp_counter_qu=p.flmbkp_counter_qu||{},p.url_redirect_afterbkp=p.url_redirect_afterbkp||"",p.processFinished=!0,p.progressLastRun=!1,p.lastPrintedMessage="",p.initialRun=1,p.selected_paths=[],p.lastZipResponse={},p.isPaused=!1,p.cwd="",p.dir_listing=[],p.currentOption="",p.tmp_var1=null,p.flmbkp_is_cancelling=!1;this.initialize=function(){e(),t(document).on("click","#flmbkp_backup_btn",function(e){return e.preventDefault(),e.stopPropagation(),t(this).prop("disabled",!0),r.options_createRec(),!1}),t(document).on("click","#flmbkp_cancel_btn",function(e){return e.preventDefault(),e.stopPropagation(),p.flmbkp_is_cancelling||(p.flmbkp_is_cancelling=!0,t(this).prop("disabled",!0),r.request_cancel_and_cleanup()),!1})},this.request_cancel_and_cleanup=function(){p.isPaused=!0,p.processFinished=!0,t.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"flmbkp_backup_cancel",page:"flmbkp_page_backups",flmbkp_security:flmbkp_vars.ajax_nonce,flmbkp_slug:p.flmbkp_slug,current_step:p.currentOption||""}}).always(function(){t.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"flmbkp_backup_cleanup",page:"flmbkp_page_backups",flmbkp_security:flmbkp_vars.ajax_nonce,flmbkp_slug:p.flmbkp_slug}}).always(function(){p.flmbkp_is_cancelling=!1,p.currentOption="",p.flmbkp_counter_qu={},t("#flmbkp_progress_plugins,#flmbkp_progress_themes,#flmbkp_progress_uploads,#flmbkp_progress_others,#flmbkp_progress_database").hide(),t("#flmbkp_plugins_progress_msg, #flmbkp_themes_progress_msg, #flmbkp_uploads_progress_msg, #flmbkp_others_progress_msg, #flmbkp_database_progress_msg").text("0%").css("width","0%"),t("#flmbkp_plugins_progress, #flmbkp_themes_progress, #flmbkp_uploads_progress, #flmbkp_others_progress, #flmbkp_database_progress").attr("aria-valuenow",0).css("width","0%").removeClass("active"),t("#flmbkp_progress_graph").hide(),p.progressLogObj&&progressLogObj.val(""),s()})})},this.options_createRec=function(){0<t("#flmbkp_backup_form input:checked").length?(t("#flmbkp_backup_btn").prop("disabled",!0),t("#flmbkp_cancel_btn").show().prop("disabled",!1),t("#flmbkp_progress_graph").show(),e(),t.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"flmbkp_backup_createrec",page:"flmbkp_page_backups",flmbkp_security:flmbkp_vars.ajax_nonce,options:t("#flmbkp_backup_form").serialize()},success:function(e){for(var s in p.flmbkp_slug=e.slug,p.flmbkp_counter_qu=e.pending,p.url_redirect_afterbkp=e.url_redirect,p.flmbkp_counter_qu)p.flmbkp_counter_qu.hasOwnProperty(s)&&t("#flmbkp_progress_"+p.flmbkp_counter_qu[s]).show();r.options_routeNextStep()},error:function(){s()}})):(t("#flmbkp_backup_btn").prop("disabled",!1),alert("Select one option at least"))},this.records_delreg=function(e){t.ajax({type:"POST",url:ajaxurl,data:{action:"flmbkp_backup_delete_records",page:"flmbkp_page_backups",flmbkp_security:flmbkp_vars.ajax_nonce,rec_id:e},success:function(){t(".sfdc-block1-container a[data-recid='"+e+"']").closest("tr").fadeOut("slow")}})},this.records_restore=function(e){t.ajax({type:"POST",url:ajaxurl,data:{action:"flmbkp_backup_restore_records",page:"flmbkp_page_backups",flmbkp_security:flmbkp_vars.ajax_nonce,rec_id:e},success:function(e){t("#flmbkp_Modal").modal({show:!0,backdrop:"static",keyboard:!1}),t("#flmbkp_Modal .modal-title").html(e.modal_title),t("#flmbkp_Modal .modal-body").html(e.modal_body)}})},this.options_routeNextStep=function(){if(t.isEmptyObject(p.flmbkp_counter_qu))p.nextstep="",p.processFinished=!0,s(),flmbkp_back_helper.redirect_tourl(p.url_redirect_afterbkp);else switch(e(),p.processFinished=!0,p.progressLastRun=!1,p.lastPrintedMessage="",p.initialRun=1,p.selected_paths=[],p.lastZipResponse={},p.isPaused=!1,p.cwd="",p.dir_listing=[],p.tmp_var1=function(e){for(var s in e)if(e.hasOwnProperty(s))return[e[s],s];return["",null]}(p.flmbkp_counter_qu),p.currentOption=p.tmp_var1[0],null!==p.tmp_var1[1]&&delete p.flmbkp_counter_qu[p.tmp_var1[1]],String(p.currentOption)){case"plugins":progressBarObj[currentOption]=t("#flmbkp_plugins_progress"),progressBarMsgObj[currentOption]=t("#flmbkp_plugins_progress_msg"),r.options_filebackup();break;case"themes":progressBarObj[currentOption]=t("#flmbkp_themes_progress"),progressBarMsgObj[currentOption]=t("#flmbkp_themes_progress_msg"),r.options_filebackup();break;case"uploads":progressBarObj[currentOption]=t("#flmbkp_uploads_progress"),progressBarMsgObj[currentOption]=t("#flmbkp_uploads_progress_msg"),r.options_filebackup();break;case"others":progressBarObj[currentOption]=t("#flmbkp_others_progress"),progressBarMsgObj[currentOption]=t("#flmbkp_others_progress_msg"),r.options_filebackup();break;case"database":progressBarObj[currentOption]=t("#flmbkp_database_progress"),progressBarMsgObj[currentOption]=t("#flmbkp_database_progress_msg"),r.options_filebackup();break;default:console.log("there is no option"),r.options_routeNextStep()}},this.options_downloadFiles=function(e){t("body").append("<iframe src='"+ajaxurl+"?action=flmbkp_backup_downloadfile&page=flmbkp_page_backups&flmbkp_security="+flmbkp_vars.ajax_nonce+"&flm_file="+encodeURIComponent(e)+"' style='display: none;' ></iframe>")},this.options_filebackup=function(){p.flmbkp_is_cancelling||(p.isPaused=!1,p.selected_paths=[p.cwd],p.isPaused)||(p.initialRun&&(progressLogObj.val(""),p.lastPrintedMessage=""),progressBarObj[currentOption].addClass("active"),t.ajax({type:"POST",url:ajaxurl,dataType:"json",beforeSend:function(){p.processFinished=!1,p.initialRun&&r.watchProgress(),p.initialRun=0},data:{targets:p.selected_paths,flush_to_disk:50,max_execution_time:20,excludes:"",is_initial_run:p.initialRun,use_system_calls:!1,nexstep:p.currentOption,flmbkp_slug:p.flmbkp_slug,action:"flmbkp_backup_sendoptions",page:"flmbkp_page_backups",flmbkp_security:flmbkp_vars.ajax_nonce},success:function(e){p.lastZipResponse=e},complete:function(){p.flmbkp_is_cancelling||(!p.lastZipResponse.error&&p.lastZipResponse.continue?r.options_filebackup():(setTimeout(function(){r.options_routeNextStep()},1200),p.processFinished=!0))}}))},this.watchProgress=function(){p.processFinished||p.isPaused||p.flmbkp_is_cancelling?p.progressLastRun=!0:p.progressLastRun=!1,setTimeout(function(){p.flmbkp_is_cancelling||t.ajax({url:ajaxurl,type:"GET",data:{action:"flmbkp_backup_watchprogress",page:"flmbkp_page_backups",flmbkp_security:flmbkp_vars.ajax_nonce},dataType:"json",success:function(e){if(""!==p.currentOption){for(var s="",t=0,r=0,r=e.msgs.indexOf(p.lastPrintedMessage)+1;r<e.msgs.length;r++)p.lastPrintedMessage=e.msgs[r],s+="\n"+e.msgs[r],t++;var a,n=progressLogObj.val().split("\n").length,o=progressLogObj.val();200<=n&&((a=progressLogObj.val().split("\n")).splice(0,n-(199+t)),o=a.join("\n")),progressLogObj.val(o+s),progressLogObj.scrollTop(progressLogObj[0].scrollHeight),progressBarObj[currentOption].attr("aria-valuenow",e.percent),progressBarObj[currentOption].css("width",e.percent+"%"),progressBarMsgObj[currentOption].text(e.percent+"% completed"),progressBarMsgObj[currentOption].css("width",e.percent+"%"),progressBarMsgObj[currentOption].removeClass("progress-bar-animated"),p.progressLastRun&&progressBarObj[currentOption].removeClass("active")}},complete:function(){p.progressLastRun||p.flmbkp_is_cancelling||r.watchProgress()}})},1e3)}};p.flmbkp_back_backup=r=t.flmbkp_back_backup=new r,r.initialize()}($uifm,window),flmbkp_back_settings||null),flmbkp_back_helper=(($uifm="undefined"==typeof $uifm?jQuery:$uifm).isFunction(flmbkp_back_settings)||!function(s){"use strict";var e=function(){this.initialize=function(){s(document).on("click","#dbflm_page_settings .btn.btn-primary",function(e){return e.preventDefault(),e.stopPropagation(),console.log("ja"),console.log(s("#dbflm_page_settings_form").serialize()),s.ajax({type:"POST",url:ajaxurl,dataType:"json",beforeSend:function(){},data:{action:"flmbkp_settings_saveoptions",page:"flmbkp_page_settings",flmbkp_security:flmbkp_vars.ajax_nonce,options:s("#dbflm_page_settings_form").serialize()},success:function(e){e.success&&alert("User Roles saved successfully")}}),!1})}};window.flmbkp_back_settings=e=s.flmbkp_back_settings=new e,e.initialize()}($uifm),"undefined"==typeof $uifm&&($uifm=jQuery),flmbkp_back_helper||null);$uifm.isFunction(flmbkp_back_helper)||!function(e,s){"use strict";s.flmbkp_back_helper=e.flmbkp_back_helper=new function(){this.initialize=function(){},this.length_obj=function(e){var s,t=0;for(s in e)e.hasOwnProperty(s)&&t++;return t},this.generateUniqueID=function(e){var s=Math.random();return s.toString(36),s.toString(36).substr(2,e)},this.versionCompare=function(e,s,t){var r=t&&t.lexicographical,t=t&&t.zeroExtend,a=e.split("."),n=s.split(".");function o(e){return(r?/^\d+[A-Za-z]*$/:/^\d+$/).test(e)}if(!a.every(o)||!n.every(o))return NaN;if(t){for(;a.length<n.length;)a.push("0");for(;n.length<a.length;)n.push("0")}r||(a=a.map(Number),n=n.map(Number));for(var p=0;p<a.length;++p){if(n.length==p)return 1;if(a[p]!=n[p])return a[p]>n[p]?1:-1}return a.length!=n.length?-1:0},this.getData=function(e,s){return e[s]},this.setData=function(e,s,t){e[s]=t},this.getData2=function(e,s,t){try{return e[s][t]}catch(e){console.log("error getUiData2: "+e.message)}},this.setData2=function(e,s,t,r){e.hasOwnProperty(s)||(e[s]={}),e[s].hasOwnProperty(t)||(e[s][t]={}),e[s][t]=r},this.getData3=function(e,s,t,r){try{return e[s][t][r]}catch(e){console.log("error getUiData3: "+e.message)}},this.delData3=function(e,s,t,r){delete e[s][t][r]},this.setData3=function(e,s,t,r,a){e.hasOwnProperty(s)||(e[s]={}),e[s].hasOwnProperty(t)||(e[s][t]={}),e[s][t][r]=a},this.setData4=function(e,s,t,r,a,n){e.hasOwnProperty(s)||(e[s]={}),e[s].hasOwnProperty(t)||(e[s][t]={}),e[s][t].hasOwnProperty(r)||(e[s][t][r]={}),e[s][t][r][a]=n},this.getData4=function(e,s,t,r,a){try{return e[s][t][r][a]}catch(e){console.log("error getUiData4: "+e.message)}},this.getData5=function(e,s,t,r,a,n){try{return void 0===e[s][t]?"":e[s][t][r][a][n]}catch(e){return console.log("error getUiData5: "+e.message),""}},this.setData5=function(e,s,t,r,a,n,o){e.hasOwnProperty(s)||(e[s]={}),e[s].hasOwnProperty(t)||(e[s][t]={}),e[s][t].hasOwnProperty(r)||(e[s][t][r]={}),e[s][t][r].hasOwnProperty(a)||(e[s][t][r][a]={}),e[s][t][r][a][n]=o},this.addIndexData5=function(e,s,t,r,a,n,o){void 0!==e[s][t][r][a][n]&&(e[s][t][r][a][n][o]={})},this.getData6=function(e,s,t,r,a,n,o){try{return void 0===e[s][t][r][a][n][o]?"":e[s][t][r][a][n][o]}catch(e){return console.log("error handled - getUiData6: "+e.message),""}},this.setData6=function(e,s,t,r,a,n,o,p){e.hasOwnProperty(s)||(e[s]={}),e[s].hasOwnProperty(t)||(e[s][t]={}),e[s][t].hasOwnProperty(r)||(e[s][t][r]={}),e[s][t][r].hasOwnProperty(a)||(e[s][t][r][a]={}),e[s][t][r][a].hasOwnProperty(n)||(e[s][t][r][a][n]={}),e[s][t][r][a][n][o]=p},this.delData6=function(e,s,t,r,a,n,o){delete e[s][t][r][a][n][o]},this.redirect_tourl=function(e){s.event?(s.event.returnValue=!1,s.location=e):location.href=e}}}($uifm,window);
  • softdiscover-db-file-manager/trunk/classes/uiform-installdb.php

    r3027919 r3369101  
    1010 * @copyright 2015 Softdiscover
    1111 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    12  * @link      https://wordpress-form-builder.zigaform.com/
     12 * @link      https://softdiscover.com/
    1313 */
    1414if (!defined('ABSPATH')) {
  • softdiscover-db-file-manager/trunk/db-file-manager.php

    r3350058 r3369101  
    44 * Plugin URI: https://softdiscover.com/managefy/
    55 * Description: Managefy Plugin for wordpress, allow user to access folders, download files, upload files, create folders, sub folders. Also Managefy allows to backup your files and database, and restore them as well.
    6  * Version: 1.5.0
     6 * Version: 1.6.2
    77 * Author: SoftDiscover.Com
    88 * Author URI: https://github.com/Softdiscover
     
    3030         * @since 1.0
    3131         */
    32         public $version = '1.5.0';
     32        public $version = '1.6.2';
    3333
    3434        /**
  • softdiscover-db-file-manager/trunk/i18n/languages/backend/wprockf.pot

    r3350058 r3369101  
    1 # Copyright (C) 2025 Managefy 1.5.0
    2 # This file is distributed under the same license as the Managefy 1.5.0 package.
     1# Copyright (C) 2025 Managefy 1.6.2
     2# This file is distributed under the same license as the Managefy 1.6.2 package.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Managefy 1.5.0\n"
     5"Project-Id-Version: Managefy 1.6.2\n"
    66"MIME-Version: 1.0\n"
    77"Content-Type: text/plain; charset=UTF-8\n"
    88"Content-Transfer-Encoding: 8bit\n"
    9 "POT-Creation-Date: 2025-08-26 05:26+0000\n"
     9"POT-Creation-Date: 2025-09-28 07:00+0000\n"
    1010"X-Poedit-Basepath: ..\n"
    1111"X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
     
    5555msgstr ""
    5656
    57 #: modules/filemanager/controllers/backup.php:117
     57#: modules/filemanager/controllers/backup.php:182
    5858msgid "<b>Unable to restore DB backup.</b>"
    5959msgstr ""
    6060
    61 #: modules/filemanager/controllers/backup.php:115
     61#: modules/filemanager/controllers/backup.php:180
    6262msgid "<b>Database backup restored.</b>"
    6363msgstr ""
    6464
    65 #: modules/filemanager/controllers/backup.php:127, modules/filemanager/controllers/backup.php:137, modules/filemanager/controllers/backup.php:147, modules/filemanager/controllers/backup.php:157
     65#: modules/filemanager/controllers/backup.php:192, modules/filemanager/controllers/backup.php:202, modules/filemanager/controllers/backup.php:212, modules/filemanager/controllers/backup.php:222
    6666msgid "<b>Unable to restore plugins.</b>"
    6767msgstr ""
    6868
    69 #: modules/filemanager/controllers/backup.php:125
     69#: modules/filemanager/controllers/backup.php:190
    7070msgid "<b>Plugins backup restored.</b>"
    7171msgstr ""
    7272
    73 #: modules/filemanager/controllers/backup.php:135
     73#: modules/filemanager/controllers/backup.php:200
    7474msgid "<b>Themes backup restored.</b>"
    7575msgstr ""
    7676
    77 #: modules/filemanager/controllers/backup.php:145
     77#: modules/filemanager/controllers/backup.php:210
    7878msgid "<b>Uploads backup restored.</b>"
    7979msgstr ""
    8080
    81 #: modules/filemanager/controllers/backup.php:155
     81#: modules/filemanager/controllers/backup.php:220
    8282msgid "<b>Others backup restored.</b>"
    8383msgstr ""
    8484
    85 #: modules/filemanager/controllers/backup.php:165
     85#: modules/filemanager/controllers/backup.php:230
    8686msgid "Restored successfully"
    8787msgstr ""
    8888
    89 #: modules/filemanager/controllers/backup.php:210
     89#: modules/filemanager/controllers/backup.php:275
    9090msgid "Insufficient permissions."
    9191msgstr ""
    9292
    93 #: modules/filemanager/controllers/backup.php:223, modules/filemanager/controllers/backup.php:230, modules/filemanager/controllers/backup.php:241, modules/filemanager/controllers/backup.php:247
     93#: modules/filemanager/controllers/backup.php:287, modules/filemanager/controllers/backup.php:294, modules/filemanager/controllers/backup.php:305, modules/filemanager/controllers/backup.php:311
    9494msgid "Invalid file requested."
    9595msgstr ""
    9696
    97 #: modules/filemanager/controllers/backup.php:254
     97#: modules/filemanager/controllers/backup.php:317
    9898msgid "Invalid file name."
    9999msgstr ""
    100100
    101 #: modules/filemanager/controllers/backup.php:262
     101#: modules/filemanager/controllers/backup.php:325
    102102msgid "Invalid file type."
    103103msgstr ""
    104104
    105 #: modules/filemanager/controllers/backup.php:271
     105#: modules/filemanager/controllers/backup.php:334
    106106msgid "Backup directory unavailable."
    107107msgstr ""
    108108
    109 #: modules/filemanager/controllers/backup.php:281
     109#: modules/filemanager/controllers/backup.php:344
    110110msgid "Invalid path."
    111111msgstr ""
    112112
    113 #: modules/filemanager/controllers/backup.php:286
     113#: modules/filemanager/controllers/backup.php:349
    114114msgid "File not found."
    115115msgstr ""
     
    331331msgstr ""
    332332
    333 #: modules/filemanager/views/backup/list_backups.php:59, modules/filemanager/views/backup/list_backups.php:126, modules/filemanager/views/backup/list_backups.php:191
     333#: modules/filemanager/views/backup/list_backups.php:59, modules/filemanager/views/backup/list_backups.php:134, modules/filemanager/views/backup/list_backups.php:199
    334334msgid "Plugins"
    335335msgstr ""
    336336
    337 #: modules/filemanager/views/backup/list_backups.php:65, modules/filemanager/views/backup/list_backups.php:134, modules/filemanager/views/backup/list_backups.php:196
     337#: modules/filemanager/views/backup/list_backups.php:65, modules/filemanager/views/backup/list_backups.php:142, modules/filemanager/views/backup/list_backups.php:204
    338338msgid "Themes"
    339339msgstr ""
    340340
    341 #: modules/filemanager/views/backup/list_backups.php:71, modules/filemanager/views/backup/list_backups.php:142, modules/filemanager/views/backup/list_backups.php:201
     341#: modules/filemanager/views/backup/list_backups.php:71, modules/filemanager/views/backup/list_backups.php:150, modules/filemanager/views/backup/list_backups.php:209
    342342msgid "Uploads"
    343343msgstr ""
     
    347347msgstr ""
    348348
    349 #: modules/filemanager/views/backup/list_backups.php:90, modules/filemanager/views/backup/list_backups.php:158, modules/filemanager/views/backup/list_backups.php:211
     349#: modules/filemanager/views/backup/list_backups.php:90, modules/filemanager/views/backup/list_backups.php:166, modules/filemanager/views/backup/list_backups.php:219
    350350msgid "Database"
    351351msgstr ""
     
    363363msgstr ""
    364364
    365 #: modules/filemanager/views/backup/list_backups.php:120
    366 msgid "Backuping Now"
    367 msgstr ""
    368 
    369 #: modules/filemanager/views/backup/list_backups.php:120
     365#: modules/filemanager/views/backup/list_backups.php:113
     366msgid "Cancel Backup"
     367msgstr ""
     368
     369#: modules/filemanager/views/backup/list_backups.php:125
     370msgid "Backing up now"
     371msgstr ""
     372
     373#: modules/filemanager/views/backup/list_backups.php:126
    370374msgid "Wait until backup is finished"
    371375msgstr ""
    372376
    373 #: modules/filemanager/views/backup/list_backups.php:150, modules/filemanager/views/backup/list_backups.php:206
     377#: modules/filemanager/views/backup/list_backups.php:158, modules/filemanager/views/backup/list_backups.php:214
    374378msgid "Others"
    375379msgstr ""
    376380
    377 #: modules/filemanager/views/backup/list_backups.php:176
     381#: modules/filemanager/views/backup/list_backups.php:184
    378382msgid "File name"
    379383msgstr ""
    380384
    381 #: modules/filemanager/views/backup/list_backups.php:177
     385#: modules/filemanager/views/backup/list_backups.php:185
    382386msgid "Backup Created"
    383387msgstr ""
    384388
    385 #: modules/filemanager/views/backup/list_backups.php:178
     389#: modules/filemanager/views/backup/list_backups.php:186
    386390msgid "Backup Data"
    387391msgstr ""
    388392
    389 #: modules/filemanager/views/backup/list_backups.php:179
     393#: modules/filemanager/views/backup/list_backups.php:187
    390394msgid "Options"
    391395msgstr ""
    392396
     397#: modules/filemanager/views/backup/list_backups.php:253
     398msgid "there is not Backups"
     399msgstr ""
     400
     401#: modules/filemanager/views/backup/list_backups.php:230, modules/filemanager/views/backup/list_backups.php:233
     402msgid "Delete"
     403msgstr ""
     404
     405#: modules/filemanager/views/backup/list_backups.php:239
     406msgid "Backup"
     407msgstr ""
     408
    393409#: modules/filemanager/views/backup/list_backups.php:242
    394 msgid "there is not Backups"
    395 msgstr ""
    396 
    397 #: modules/filemanager/views/backup/list_backups.php:222, modules/filemanager/views/backup/list_backups.php:225
    398 msgid "Delete"
    399 msgstr ""
    400 
    401 #: modules/filemanager/views/backup/list_backups.php:228
    402 msgid "Backup"
    403 msgstr ""
    404 
    405 #: modules/filemanager/views/backup/list_backups.php:231
    406410msgid "Restore"
    407411msgstr ""
    408412
    409 #: modules/filemanager/views/backup/list_backups.php:261
     413#: modules/filemanager/views/backup/list_backups.php:272
    410414msgid "Are you sure about this?"
    411415msgstr ""
  • softdiscover-db-file-manager/trunk/modules/database/controllers/backend.php

    r3027919 r3369101  
    1010 * @copyright 2015 Softdiscover
    1111 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    12  * @link      http://wordpress-cost-estimator.zigaform.com
     12 * @link      https://softdiscover.com
    1313 */
    1414if (!defined('ABSPATH')) {
     
    2828 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    2929 * @version   Release: 1.00
    30  * @link      http://wordpress-cost-estimator.zigaform.com
     30 * @link      https://softdiscover.com
    3131 */
    3232class flmbkp_database_Controller_Back extends Flmbkp_Base_Module
  • softdiscover-db-file-manager/trunk/modules/database/views/backend/list_tables.php

    r3027919 r3369101  
    1010 * @copyright 2015 Softdiscover
    1111 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    12  * @link      https://wordpress-form-builder.zigaform.com/
     12 * @link      https://softdiscover.com/
    1313 */
    1414if (!defined('ABSPATH')) {
  • softdiscover-db-file-manager/trunk/modules/default/controllers/backend.php

    r3027919 r3369101  
    1010 * @copyright 2015 Softdiscover
    1111 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    12  * @link      http://wordpress-cost-estimator.zigaform.com
     12 * @link      https://softdiscover.com
    1313 */
    1414if (!defined('ABSPATH')) {
     
    2828 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    2929 * @version   Release: 1.00
    30  * @link      http://wordpress-cost-estimator.zigaform.com
     30 * @link      https://softdiscover.com
    3131 */
    3232class flmbkp_Default_Controller_Back extends Flmbkp_Base_Module
  • softdiscover-db-file-manager/trunk/modules/filemanager/controllers/backend.php

    r3027919 r3369101  
    1010 * @copyright 2015 Softdiscover
    1111 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    12  * @link      http://wordpress-cost-estimator.zigaform.com
     12 * @link      https://softdiscover.com
    1313 */
    1414if (!defined('ABSPATH')) {
     
    2828 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    2929 * @version   Release: 1.00
    30  * @link      http://wordpress-cost-estimator.zigaform.com
     30 * @link      https://softdiscover.com
    3131 */
    3232class flmbkp_Filemanager_Controller_Back extends Flmbkp_Base_Module
  • softdiscover-db-file-manager/trunk/modules/filemanager/controllers/backup.php

    r3350045 r3369101  
    1111 * @copyright 2015 Softdiscover
    1212 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    13  * @link      http://wordpress-cost-estimator.zigaform.com
     13 * @link      https://softdiscover.com
    1414 */
    1515if (!defined('ABSPATH')) {
     
    2929 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    3030 * @version   Release: 1.00
    31  * @link      http://wordpress-cost-estimator.zigaform.com
     31 * @link      http://wordpress-cost_estimator.zigaform.com
    3232 */
    3333class flmbkp_Filemanager_Controller_Backup extends Flmbkp_Base_Module
     
    4444    public $zip_obj;
    4545    public $last_abort_check;
    46 
    4746
    4847    public $total_targets;
     
    7069
    7170        //create records
    72         add_action('wp_ajax_flmbkp_backup_createrec', array(&$this, 'ajax_create_records'));
     71        add_action('wp_ajax_flmbkp_backup_createrec', array($this, 'ajax_create_records'));
    7372
    7473        //submit header options
    75         add_action('wp_ajax_flmbkp_backup_sendoptions', array(&$this, 'ajax_submit_options_switch'));
    76 
    77         //backup process
    78         add_action('wp_ajax_flmbkp_backup_watchprogress', array(&$this, 'ajax_watchprogress'));
     74        add_action('wp_ajax_flmbkp_backup_sendoptions', array($this, 'ajax_submit_options_switch'));
     75
     76        //progress polling
     77        add_action('wp_ajax_flmbkp_backup_watchprogress', array($this, 'ajax_watchprogress'));
    7978
    8079        //download file
    81         add_action('wp_ajax_flmbkp_backup_downloadfile', array(&$this, 'ajax_downloadfile'));
     80        add_action('wp_ajax_flmbkp_backup_downloadfile', array($this, 'ajax_downloadfile'));
    8281
    8382        //delete record
    84         add_action('wp_ajax_flmbkp_backup_delete_records', array(&$this, 'ajax_delete_record'));
     83        add_action('wp_ajax_flmbkp_backup_delete_records', array($this, 'ajax_delete_record'));
    8584
    8685        //restore record
    87         add_action('wp_ajax_flmbkp_backup_restore_records', array(&$this, 'ajax_restore_record'));
     86        add_action('wp_ajax_flmbkp_backup_restore_records', array($this, 'ajax_restore_record'));
     87
     88        // cancel & cleanup endpoints
     89        add_action('wp_ajax_flmbkp_backup_cancel', array($this, 'ajax_cancel_backup'));
     90        add_action('wp_ajax_flmbkp_backup_cleanup', array($this, 'ajax_cleanup_backup'));
    8891
    8992        define('NL', "\r\n");
    9093    }
    9194
     95    /**
     96     * Create deny-all hardening files in a directory (Apache/IIS) + placeholder index.html
     97     */
     98    private function harden_dir($dir)
     99    {
     100        // Apache
     101        $htaccess = $dir . DIRECTORY_SEPARATOR . '.htaccess';
     102        if (!file_exists($htaccess)) {
     103            $ht = ""
     104                . "Options -Indexes\n"
     105                . "<IfModule mod_authz_core.c>\n"
     106                . "  Require all denied\n"
     107                . "</IfModule>\n"
     108                . "<IfModule !mod_authz_core.c>\n"
     109                . "  Order allow,deny\n"
     110                . "  Deny from all\n"
     111                . "</IfModule>\n";
     112            @file_put_contents($htaccess, $ht);
     113        }
     114
     115        // IIS
     116        $webconfig = $dir . DIRECTORY_SEPARATOR . 'web.config';
     117        if (!file_exists($webconfig)) {
     118            $wc = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"
     119                . '<configuration>' . "\n"
     120                . '  <system.webServer>' . "\n"
     121                . '    <security>' . "\n"
     122                . '      <authorization>' . "\n"
     123                . '        <deny users="*" />' . "\n"
     124                . '      </authorization>' . "\n"
     125                . '    </security>' . "\n"
     126                . '    <directoryBrowse enabled="false" />' . "\n"
     127                . '  </system.webServer>' . "\n"
     128                . '</configuration>' . "\n";
     129            @file_put_contents($webconfig, $wc);
     130        }
     131
     132        // Placeholder index to avoid directory listing on odd setups
     133        $index = $dir . DIRECTORY_SEPARATOR . 'index.html';
     134        if (!file_exists($index)) {
     135            @file_put_contents($index, "<!doctype html><title>403</title><h1>Forbidden</h1>");
     136        }
     137    }
     138
     139    /**
     140     * Centralized backup directory: /wp-content/softdiscover/backups
     141     * Ensures directory exists and is hardened against direct web access.
     142     */
     143    private function get_backup_directory()
     144    {
     145        $dir = trailingslashit(WP_CONTENT_DIR) . 'softdiscover/backups';
     146        if (!is_dir($dir)) {
     147            if (function_exists('wp_mkdir_p')) {
     148                @wp_mkdir_p($dir);
     149            } else {
     150                @mkdir($dir, 0755, true);
     151            }
     152        }
     153        if (is_dir($dir) && is_writable($dir)) {
     154            $this->harden_dir($dir);
     155        }
     156        return $dir;
     157    }
    92158
    93159    /*
     
    101167        $bkp_id = (isset($_POST['rec_id']) && $_POST['rec_id']) ? Flmbkp_Form_Helper::sanitizeInput($_POST['rec_id']) : 0;
    102168
    103 
    104169        $log = array();
    105         $files_dest = WP_CONTENT_DIR.'/uploads/';
    106         if (intval($bkp_id)>0) {
    107             $rec_info=$this->model_backup->getinfo($bkp_id);
    108             $backup_directory = Flmbkp_Form_Helper::backup_directory();
     170        $files_dest = WP_CONTENT_DIR . '/uploads/'; // restore into uploads root (unchanged)
     171        if (intval($bkp_id) > 0) {
     172            $rec_info = $this->model_backup->getinfo($bkp_id);
     173            $backup_directory = $this->get_backup_directory();
    109174
    110175            //database
    111             if (file_exists($backup_directory . '/' . $rec_info->bkp_slug .'_database.zip')) {
     176            if (file_exists($backup_directory . '/' . $rec_info->bkp_slug . '_database.zip')) {
    112177                require_once(FLMBKP_DIR . '/classes/uiform_backup.php');
    113178                $objClass = new Flmbkp_Backup($rec_info->bkp_slug, $backup_directory);
     
    120185
    121186            // Plugins
    122             if (file_exists($backup_directory . '/' . $rec_info->bkp_slug .'_plugins.zip')) {
    123                 $tmp_res = Flmbkp_Form_Helper::unzipFiles($backup_directory . '/' . $rec_info->bkp_slug .'_plugins.zip', $files_dest);
     187            if (file_exists($backup_directory . '/' . $rec_info->bkp_slug . '_plugins.zip')) {
     188                $tmp_res = Flmbkp_Form_Helper::unzipFiles($backup_directory . '/' . $rec_info->bkp_slug . '_plugins.zip', $files_dest);
    124189                if ($tmp_res) {
    125190                    $log[] = __('<b>Plugins backup restored.</b>', 'FRocket_admin');
     
    130195
    131196            // themes
    132             if (file_exists($backup_directory . '/' . $rec_info->bkp_slug .'_themes.zip')) {
    133                 $tmp_res = Flmbkp_Form_Helper::unzipFiles($backup_directory . '/' . $rec_info->bkp_slug .'_themes.zip', $files_dest);
     197            if (file_exists($backup_directory . '/' . $rec_info->bkp_slug . '_themes.zip')) {
     198                $tmp_res = Flmbkp_Form_Helper::unzipFiles($backup_directory . '/' . $rec_info->bkp_slug . '_themes.zip', $files_dest);
    134199                if ($tmp_res) {
    135200                    $log[] = __('<b>Themes backup restored.</b>', 'FRocket_admin');
     
    140205
    141206            // Uploads
    142             if (file_exists($backup_directory . '/' . $rec_info->bkp_slug .'_uploads.zip')) {
    143                 $tmp_res = Flmbkp_Form_Helper::unzipFiles($backup_directory . '/' . $rec_info->bkp_slug .'_uploads.zip', $files_dest);
     207            if (file_exists($backup_directory . '/' . $rec_info->bkp_slug . '_uploads.zip')) {
     208                $tmp_res = Flmbkp_Form_Helper::unzipFiles($backup_directory . '/' . $rec_info->bkp_slug . '_uploads.zip', $files_dest);
    144209                if ($tmp_res) {
    145210                    $log[] = __('<b>Uploads backup restored.</b>', 'FRocket_admin');
     
    150215
    151216            // Others
    152             if (file_exists($backup_directory . '/' . $rec_info->bkp_slug .'_others.zip')) {
    153                 $tmp_res = Flmbkp_Form_Helper::unzipFiles($backup_directory . '/' . $rec_info->bkp_slug .'_others.zip', $files_dest);
     217            if (file_exists($backup_directory . '/' . $rec_info->bkp_slug . '_others.zip')) {
     218                $tmp_res = Flmbkp_Form_Helper::unzipFiles($backup_directory . '/' . $rec_info->bkp_slug . '_others.zip', $files_dest);
    154219                if ($tmp_res) {
    155220                    $log[] = __('<b>Others backup restored.</b>', 'FRocket_admin');
     
    163228            'log' => $log,
    164229            'success' => true,
    165             'modal_title'=>__('Restored successfully', 'FRocket_admin'),
    166             'modal_body'=>self::render_template('filemanager/views/backup/restore_message.php', array('log'=>$log))
     230            'modal_title' => __('Restored successfully', 'FRocket_admin'),
     231            'modal_body' => self::render_template('filemanager/views/backup/restore_message.php', array('log' => $log))
    167232        );
    168233
     
    182247        $bkp_id = (isset($_POST['rec_id']) && $_POST['rec_id']) ? Flmbkp_Form_Helper::sanitizeInput($_POST['rec_id']) : 0;
    183248
    184         $rec_info=$this->model_backup->getinfo($bkp_id);
    185 
    186         $backup_directory = Flmbkp_Form_Helper::backup_directory();
    187 
    188         @unlink($backup_directory . '/' . $rec_info->bkp_slug .'_plugins.zip');
    189         @unlink($backup_directory . '/' . $rec_info->bkp_slug .'_themes.zip');
    190         @unlink($backup_directory . '/' . $rec_info->bkp_slug .'_database.zip');
    191         @unlink($backup_directory . '/' . $rec_info->bkp_slug .'_others.zip');
    192         @unlink($backup_directory . '/' . $rec_info->bkp_slug .'_uploads.zip');
    193 
    194         //de;ete recprd
    195         $this->wpdb->delete($this->model_backup->table, array( 'bkp_id' => $bkp_id));
     249        $rec_info = $this->model_backup->getinfo($bkp_id);
     250
     251        $backup_directory = $this->get_backup_directory();
     252
     253        @unlink($backup_directory . '/' . $rec_info->bkp_slug . '_plugins.zip');
     254        @unlink($backup_directory . '/' . $rec_info->bkp_slug . '_themes.zip');
     255        @unlink($backup_directory . '/' . $rec_info->bkp_slug . '_database.zip');
     256        @unlink($backup_directory . '/' . $rec_info->bkp_slug . '_others.zip');
     257        @unlink($backup_directory . '/' . $rec_info->bkp_slug . '_uploads.zip');
     258
     259        //delete record
     260        $this->wpdb->delete($this->model_backup->table, array('bkp_id' => $bkp_id));
    196261    }
    197262
     
    206271
    207272        // Only privileged users may download backups.
    208         if ( ! current_user_can('manage_options') ) {
     273        if (!current_user_can('manage_options')) {
    209274            status_header(403);
    210275            wp_die(__('Insufficient permissions.', 'FRocket_admin'));
     
    215280        // Raw input (no HTML decoding) then minimal normalization
    216281        $flm_file_raw = isset($_GET['flm_file']) ? wp_unslash($_GET['flm_file']) : '';
    217         // Use your existing helper for generic cleanup, but rely on strict validation below.
    218         $flm_file     = Flmbkp_Form_Helper::sanitizeInput($flm_file_raw);
     282        $flm_file = Flmbkp_Form_Helper::sanitizeInput($flm_file_raw);
    219283
    220284        // Basic presence
    221         if ( ! is_string($flm_file) || $flm_file === '' ) {
     285        if (!is_string($flm_file) || $flm_file === '') {
    222286            status_header(400);
    223287            wp_die(__('Invalid file requested.', 'FRocket_admin'));
     
    226290        // Must be a basename only (no slashes/backslashes)
    227291        $norm = str_replace('\\', '/', $flm_file);
    228         if ( strpos($norm, '/') !== false || basename($norm) !== $norm ) {
     292        if (strpos($norm, '/') !== false || basename($norm) !== $norm) {
    229293            status_header(400);
    230294            wp_die(__('Invalid file requested.', 'FRocket_admin'));
     
    243307
    244308        // Reasonable length + strict allowed characters
    245         if ( strlen($flm_file) > 200 || ! preg_match('/^[A-Za-z0-9._-]+$/', $flm_file) ) {
     309        if (strlen($flm_file) > 200 || !preg_match('/^[A-Za-z0-9._-]+$/', $flm_file)) {
    246310            status_header(400);
    247311            wp_die(__('Invalid file requested.', 'FRocket_admin'));
    248312        }
    249313
    250         // (Optional but recommended) enforce expected backup naming pattern
    251         // e.g., flmbkp_YYYYMMDDHHIISS_(plugins|themes|uploads|others|database).zip
    252         if ( ! preg_match('/^flmbkp_\d{14,}_(plugins|themes|uploads|others|database)\.zip$/', $flm_file) ) {
     314        // enforce expected backup naming pattern
     315        if (!preg_match('/^flmbkp_\d{14,}_(plugins|themes|uploads|others|database)\.zip$/', $flm_file)) {
    253316            status_header(400);
    254317            wp_die(__('Invalid file name.', 'FRocket_admin'));
     
    258321        $allowed_exts = apply_filters('flmbkp_allowed_download_exts', array('zip'));
    259322        $ext = strtolower(pathinfo($flm_file, PATHINFO_EXTENSION));
    260         if ( ! in_array($ext, $allowed_exts, true) ) {
     323        if (!in_array($ext, $allowed_exts, true)) {
    261324            status_header(400);
    262325            wp_die(__('Invalid file type.', 'FRocket_admin'));
     
    264327
    265328        // Resolve paths safely
    266         $backup_directory      = Flmbkp_Form_Helper::backup_directory();
     329        $backup_directory = $this->get_backup_directory();
    267330        $backup_directory_real = realpath($backup_directory);
    268331
    269         if ( ! $backup_directory_real || ! is_dir($backup_directory_real) ) {
     332        if (!$backup_directory_real || !is_dir($backup_directory_real)) {
    270333            status_header(500);
    271334            wp_die(__('Backup directory unavailable.', 'FRocket_admin'));
     
    277340
    278341        // Ensure the resolved path is inside the backup directory
    279         if ( ! $fullpath || strpos($fullpath, $backup_directory_real . DIRECTORY_SEPARATOR) !== 0 ) {
     342        if (!$fullpath || strpos($fullpath, $backup_directory_real . DIRECTORY_SEPARATOR) !== 0) {
    280343            status_header(400);
    281344            wp_die(__('Invalid path.', 'FRocket_admin'));
    282345        }
    283346
    284         if ( ! is_file($fullpath) || ! is_readable($fullpath) ) {
     347        if (!is_file($fullpath) || !is_readable($fullpath)) {
    285348            status_header(404);
    286349            wp_die(__('File not found.', 'FRocket_admin'));
     
    299362
    300363        readfile($fullpath);
    301         exit; // prevent any extra output from corrupting the file
     364        exit;
    302365    }
    303366
     
    362425        }
    363426
    364 
    365         $data=array();
    366         $data['bkp_slug']='flmbkp_'.date("YmdHis");
     427        $data = array();
     428        $data['bkp_slug'] = 'flmbkp_' . date("YmdHis");
    367429        $this->wpdb->insert($this->model_backup->table, $data);
    368430        $idActivate = $this->wpdb->insert_id;
    369         $json=array();
     431
     432        $json = array();
    370433        $json['status'] = 'created';
    371434        $json['id'] = $idActivate;
    372435        $json['slug'] = $data['bkp_slug'];
    373         $json['next_task']=$data2[0];
    374         $json['url_redirect']=admin_url('admin.php?page=flmbkp_page_backups');
    375         $json['pending']=$data2;
     436        $json['next_task'] = $data2[0];
     437        $json['url_redirect'] = admin_url('admin.php?page=flmbkp_page_backups');
     438        $json['pending'] = $data2;
    376439
    377440        header('Content-Type: application/json');
     
    393456        switch (strval($tmp_nexstep)) {
    394457            case 'plugins':
    395                 //assigning targets
    396                 $tmp_targets=array(ABSPATH.'/wp-content/plugins');
    397 
     458                $tmp_targets = array(ABSPATH . '/wp-content/plugins');
    398459                $this->ajax_submit_options($tmp_targets, $tmp_nexstep);
    399460                break;
    400461            case 'themes':
    401                 //assigning targets
    402                 $tmp_targets=array(ABSPATH.'/wp-content/themes');
    403 
     462                $tmp_targets = array(ABSPATH . '/wp-content/themes');
    404463                $this->ajax_submit_options($tmp_targets, $tmp_nexstep);
    405464                break;
    406465            case 'uploads':
    407                 $tmp_targets=array(ABSPATH.'/wp-content/uploads');
    408 
     466                $tmp_targets = array(ABSPATH . '/wp-content/uploads');
    409467                $this->ajax_submit_options($tmp_targets, $tmp_nexstep);
    410468                break;
    411469            case 'others':
    412                 $tmp_targets=array();
    413                 $tmp_targets=$this->listAndExcludeDIr(ABSPATH.'wp-content', array('uploads','themes','plugins','softdiscover','debug.log'));
    414 
     470                $tmp_targets = array();
     471                // exclude the private backup dir & common folders we back up separately
     472                $tmp_targets = $this->listAndExcludeDIr(ABSPATH . 'wp-content', array('uploads', 'themes', 'plugins', 'softdiscover', 'debug.log'));
    415473                $this->ajax_submit_options($tmp_targets, $tmp_nexstep);
    416474                break;
     
    420478            default:
    421479                die('something happened');
    422                 break;
    423480        }
    424481    }
     
    428485
    429486        if (!version_compare('5.5', phpversion(), '>=')) {
    430             $database_name=DB_NAME;
    431             $database_user=DB_USER;
    432             $datadase_password=DB_PASSWORD;
    433             $database_host=DB_HOST;
    434 
    435             $con=mysqli_connect($database_host, $database_user, $datadase_password, $database_name);
    436             // Check connection
     487            $database_name = DB_NAME;
     488            $database_user = DB_USER;
     489            $datadase_password = DB_PASSWORD;
     490            $database_host = DB_HOST;
     491
     492            $con = mysqli_connect($database_host, $database_user, $datadase_password, $database_name);
    437493            if (mysqli_connect_errno()) {
    438                 // echo "Failed to connect to MySQL: " . mysqli_connect_error();
     494                // connection error ignored
    439495            }
    440496
    441497            $str = mysqli_get_server_info($con);
    442         }else {
     498        } else {
    443499            $str = mysql_get_server_info();
    444500        }
     
    452508    public function ajax_submit_backupdb()
    453509    {
    454         $tmp_flmbkp_slug = (isset($_POST['flmbkp_slug'])) ? urldecode(Flmbkp_Form_Helper::sanitizeInput($_POST['flmbkp_slug'])) : 'flmbkp_err'.date("YmdHis");
     510        $tmp_flmbkp_slug = (isset($_POST['flmbkp_slug'])) ? urldecode(Flmbkp_Form_Helper::sanitizeInput($_POST['flmbkp_slug'])) : 'flmbkp_err' . date("YmdHis");
    455511        $this->is_initial_run = !empty($_POST['is_initial_run']);
    456512        require_once FLMBKP_DIR . '/modules/filemanager/helpers/iprogress.php';
    457513
    458         $backup_directory = Flmbkp_Form_Helper::backup_directory();
     514        $backup_directory = $this->get_backup_directory();
    459515
    460516        $this->progress  = new iProgress('zip', 200);
    461         $this->oFile = ($this->is_initial_run || !$this->progress->getData('oFile')) ? $backup_directory . '/' . $tmp_flmbkp_slug .'_database.zip' : $this->progress->getData('oFile');
     517        $this->oFile = ($this->is_initial_run || !$this->progress->getData('oFile')) ? $backup_directory . '/' . $tmp_flmbkp_slug . '_database.zip' : $this->progress->getData('oFile');
    462518        $this->progress->setData('oFile', $this->oFile);
    463519
     
    484540            foreach ($tables as $key => $table) {
    485541                $table_dump = $this->dumpTable($table);
    486 
    487542                if (!($table_dump)) {
    488543                    return false;
     
    492547        }
    493548
    494 
    495         $fname = $backup_directory;
    496         $fname .= '/'.$tmp_flmbkp_slug .'_database';
    497         $fname .= '.sql';
     549        $fname = $backup_directory . '/' . $tmp_flmbkp_slug . '_database.sql';
    498550        if (!($f = fopen($fname, 'w'))) {
    499551            return false;
     
    503555
    504556        $this->zip_obj = new ZipArchive();
    505         $this->zip_obj->open($this->oFile, ZipArchive::CREATE);
     557        $openRes = $this->zip_obj->open($this->oFile, ZipArchive::CREATE);
     558        if ($openRes !== true) {
     559            wp_send_json_error(array('message' => 'Failed to create DB zip (code '.$openRes.')'), 500);
     560        }
    506561        $this->zip_obj->addFile($fname, basename($fname));
    507562        $this->zip_obj->close();
    508563
    509564        //delete sql file
    510         unlink($fname);
     565        @unlink($fname);
    511566
    512567        $json = array(
    513568            'error' => false,
    514569            'continue' => false,
    515             'fileURL' =>'',
    516             'next_task'=>'',
    517             'is_finished'=>true
     570            'fileURL' => '', // no public URL exposure
     571            'next_task' => '',
     572            'is_finished' => true
    518573        );
    519574
     
    531586        foreach ($result as $mytable) {
    532587            foreach ($mytable as $t) {
    533                 $value[]= $t;
     588                $value[] = $t;
    534589            }
    535590        }
     
    544599    public function dumpTable($table)
    545600    {
    546 
    547         // $dump = '';
    548601        $this->wpdb->query('LOCK TABLES ' . $table . ' WRITE');
    549602
    550         // $tables = $this->wpdb->get_col('SHOW TABLES');
    551603        $output = '';
    552         //foreach($tables as $table) {
    553604        $result = $this->wpdb->get_results("SELECT * FROM {$table}", ARRAY_N);
    554605
     
    557608        $output .= '-- --------------------------------------------------;' . NL;
    558609        $output .= 'DROP TABLE IF EXISTS `' . $table . '`;' . NL;
    559         $row2 = $this->wpdb->get_row('SHOW CREATE TABLE '.$table, ARRAY_N);
    560         $output .= "\n\n".$row2[1].";\n\n";
     610        $row2 = $this->wpdb->get_row('SHOW CREATE TABLE ' . $table, ARRAY_N);
     611        $output .= "\n\n" . $row2[1] . ";\n\n";
    561612        for ($i = 0; $i < count($result); $i++) {
    562613            $row = $result[$i];
    563             $output .= 'INSERT INTO '.$table.' VALUES(';
    564             for ($j=0; $j<count($result[0]); $j++) {
     614            $output .= 'INSERT INTO ' . $table . ' VALUES(';
     615            for ($j = 0; $j < count($result[0]); $j++) {
    565616                $row[$j] = $this->wpdb->_real_escape($row[$j]);
    566                 $output .= (isset($row[$j])) ? '"'.$row[$j].'"' : '""';
    567                 if ($j < (count($result[0])-1)) {
     617                $output .= (isset($row[$j])) ? '"' . $row[$j] . '"' : '""';
     618                if ($j < (count($result[0]) - 1)) {
    568619                    $output .= ',';
    569620                }
     
    572623        }
    573624        $output .= "\n";
    574         //}
    575625
    576626        $this->wpdb->query('UNLOCK TABLES');
    577627        return $output;
    578628    }
     629
    579630    /**
    580631     * receiving header options
     
    584635    public function ajax_submit_options($tmp_targets, $tmp_nexstep)
    585636    {
    586 
    587637        try {
    588638            $is_initial_run = (isset($_POST['is_initial_run'])) ? Flmbkp_Form_Helper::sanitizeInput($_POST['is_initial_run']) : 0;
    589639            $flush_to_disk = (isset($_POST['flush_to_disk'])) ? Flmbkp_Form_Helper::sanitizeInput($_POST['flush_to_disk']) : 50;
    590640            $max_execution_time = (isset($_POST['max_execution_time'])) ? Flmbkp_Form_Helper::sanitizeInput($_POST['max_execution_time']) : 20;
    591             $tmp_flmbkp_slug = (isset($_POST['flmbkp_slug'])) ? urldecode(Flmbkp_Form_Helper::sanitizeInput($_POST['flmbkp_slug'])) : 'flmbkp_err'.date("YmdHis");
     641            $tmp_flmbkp_slug = (isset($_POST['flmbkp_slug'])) ? urldecode(Flmbkp_Form_Helper::sanitizeInput($_POST['flmbkp_slug'])) : 'flmbkp_err' . date("YmdHis");
    592642
    593643            $this->startTime = microtime(true);
    594644
    595             //language
    596             if (isset($data['flpbkp_opt_files']) && intval($data['flpbkp_opt_files']) === 1) {
    597                 // $this->generate_zip_files();
    598             }
    599 
    600645            require_once FLMBKP_DIR . '/modules/filemanager/helpers/iprogress.php';
    601646
     
    605650
    606651            $this->is_initial_run = !empty($is_initial_run);
    607             $flush_to_disk = !empty($flush_to_disk) ? (int) $flush_to_disk : 50;
     652
    608653            $this->max_execution_time = !empty($max_execution_time) ? (int) $max_execution_time : 20;
    609654            $exclude_string = array();
    610655            $this->excludes = (!empty($exclude_string)) ? array_filter(array_map('trim', explode(',', $exclude_string))) : array();
    611 //        $use_system_calls = (!empty($_POST['use_system_calls']) && $_POST['use_system_calls'] == 'true') ? true : false;
    612             $use_system_calls =  false;
    613             $last_abort_check = microtime(true);
    614 
    615 
    616656
    617657            $targets = ($this->is_initial_run && !empty($tmp_targets)) ? $tmp_targets : $this->progress->getData('targets');
     
    628668                $this->progress->addMsg('Scanning files to be compressed...');
    629669                $this->progress->setData('targets', $targets);
     670                $this->progress->setData('abort', 0);
    630671            }
    631672
     
    656697            }
    657698
    658             $backup_directory = Flmbkp_Form_Helper::backup_directory();
    659 
    660             $this->oFile = ($this->is_initial_run || !$this->progress->getData('oFile')) ? $backup_directory.'/'. $tmp_flmbkp_slug .'_'.$tmp_nexstep. '.zip' : $this->progress->getData('oFile');
    661 
    662 
     699            $backup_directory = $this->get_backup_directory();
     700
     701            $this->oFile = ($this->is_initial_run || !$this->progress->getData('oFile')) ? $backup_directory . '/' . $tmp_flmbkp_slug . '_' . $tmp_nexstep . '.zip' : $this->progress->getData('oFile');
    663702
    664703            $this->progress->setData('oFile', $this->oFile);
    665704
    666             chdir(sys_get_temp_dir()); // Zip always get's created in current working dir so move to tmp.
     705            chdir(sys_get_temp_dir()); // Zip always gets created in current working dir so move to tmp.
    667706
    668707            $this->zip_obj = new ZipArchive();
    669             $this->zip_obj->open($this->oFile, ZipArchive::CREATE);
     708            $openRes = $this->zip_obj->open($this->oFile, ZipArchive::CREATE);
     709            if ($openRes !== true) {
     710                wp_send_json_error(array('message' => 'Failed to open zip (code '.$openRes.')'), 500);
     711            }
    670712
    671713            $this->iteration_number = 0;
     
    700742                            }
    701743
    702 
    703744                            $this->progress->iterateWith(1);
    704745
    705                             //if ($this->zip_obj->numFiles % 50 === 0)
    706                             $this->flush_zip(); //Write to disk every 50 files. This should free the memory taken up to this point
     746                            $this->flush_zip(); //Write to disk regularly to free memory
    707747                        }
    708748                    }
     
    714754            $this->zip_obj->close();
    715755
    716             $file_url = FLMBKP_URL . '/' . basename($this->oFile);
     756            // Don't expose public URLs; downloads must go through ajax_downloadfile
    717757            $json = array(
    718758                'error' => false,
    719759                'continue' => false,
    720                 'fileURL' => $file_url,
    721                 'is_finished'=>false
     760                'fileURL' => '', // keep empty to avoid direct access attempts
     761                'is_finished' => false
    722762            );
    723763
     
    729769                'error' => true,
    730770                'continue' => false,
    731                 'error_msg'=>$exception->getMessage(),
    732                 'is_finished'=>false
     771                'error_msg' => $exception->getMessage(),
     772                'is_finished' => false
    733773            );
    734774
     
    751791        }
    752792
    753         $acceptedfiles=array();
     793        $acceptedfiles = array();
    754794        $entries = scandir($dir);
    755         //reads the filenames, one by one
    756795        foreach ($entries as $file) {
    757796            if ($file == '.' || $file == '..') {
     
    759798            }
    760799
    761             $full_path = $dir.'/'.$file;
    762 
    763             if (is_dir($full_path) && $file!="." && $file!=".." && !in_array($file, $exclude)) {
    764                 $acceptedfiles[]=$full_path;
    765             }elseif ($file!="." && $file!=".." && !in_array($file, $exclude)) {
    766                 $acceptedfiles[]=$full_path;
    767             }else {
    768             }
    769         }
    770         //closedir($handle);
     800            $full_path = $dir . '/' . $file;
     801
     802            if (is_dir($full_path) && $file != "." && $file != ".." && !in_array($file, $exclude)) {
     803                $acceptedfiles[] = $full_path;
     804            } elseif ($file != "." && $file != ".." && !in_array($file, $exclude)) {
     805                $acceptedfiles[] = $full_path;
     806            } else {
     807                // excluded
     808            }
     809        }
    771810        return $acceptedfiles;
    772811    }
    773     /**
    774      * backup process
     812
     813    /**
     814     * backup process progress
    775815     *
    776816     * @mvc Controller
     
    793833        echo json_encode($json);
    794834        wp_die();
     835    }
     836
     837    /**
     838     * request cancel (set abort flag)
     839     */
     840    public function ajax_cancel_backup()
     841    {
     842        check_ajax_referer('flmbkp_ajax_nonce', 'flmbkp_security');
     843
     844        require_once FLMBKP_DIR . '/modules/filemanager/helpers/iprogress.php';
     845        $this->progress = new iProgress('zip', 200);
     846
     847        if (method_exists($this->progress, 'requestAbort')) {
     848            $this->progress->requestAbort();
     849        } else {
     850            $this->progress->setData('abort', 1);
     851        }
     852
     853        wp_send_json_success(array('aborted' => true));
     854    }
     855
     856    /**
     857     * cleanup partial files for a given slug and remove DB record
     858     */
     859    public function ajax_cleanup_backup()
     860    {
     861        check_ajax_referer('flmbkp_ajax_nonce', 'flmbkp_security');
     862
     863        $slug_raw = isset($_POST['flmbkp_slug']) ? wp_unslash($_POST['flmbkp_slug']) : '';
     864        $slug = Flmbkp_Form_Helper::sanitizeInput($slug_raw);
     865
     866        if (!$this->is_valid_slug($slug)) {
     867            wp_send_json_error(array('message' => 'Invalid slug'), 400);
     868        }
     869
     870        $deleted = $this->delete_partial_files($slug);
     871
     872        if (!empty($this->model_backup->table)) {
     873            $this->wpdb->delete($this->model_backup->table, array('bkp_slug' => $slug));
     874        }
     875
     876        wp_send_json_success(array('cleaned' => true, 'files_removed' => $deleted));
    795877    }
    796878
     
    842924    public function flush_zip()
    843925    {
    844         //$zip=$this->zip_obj;
    845         $this->zip_obj->close();
    846         $this->zip_obj->open($this->oFile);
    847         //$this->zip_obj=$zip;
    848     }
    849 
     926        // Close current handle then reopen in CREATE mode to avoid
     927        // "Unexpected length of data" on final close.
     928        if ($this->zip_obj instanceof ZipArchive) {
     929            $this->zip_obj->close();
     930        }
     931        $this->zip_obj = new ZipArchive();
     932        $openRes = $this->zip_obj->open($this->oFile, ZipArchive::CREATE);
     933        if ($openRes !== true) {
     934            $json = array(
     935                'error'     => true,
     936                'continue'  => false,
     937                'error_msg' => 'Failed to reopen zip (code '.$openRes.') for '.$this->oFile
     938            );
     939            header('Content-Type: application/json');
     940            echo json_encode($json);
     941            exit;
     942        }
     943    }
    850944
    851945    public function zip_dir($path, $base = '')
    852946    {
    853 
    854947        $progress = $this->progress;
    855 
    856948
    857949        $entries = scandir($path);
     
    890982
    891983                    if ($this->zip_obj->numFiles % 50 == 0) {
    892                         $this->flush_zip(); //Write to disk every 50 files. This should free the memory taken up to this point
     984                        $this->flush_zip(); //Write to disk every 50 files
    893985                    }
    894986                }
     
    899991    public function stop_iteration()
    900992    {
    901         //$zip=$this->zip_obj;
    902         $this->zip_obj->close();
     993        if ($this->zip_obj instanceof ZipArchive) {
     994            $this->zip_obj->close();
     995        }
    903996
    904997        $json = array(
     
    9121005    private function is_excluded($path)
    9131006    {
    914         $excludes =$this->excludes;
     1007        $excludes = $this->excludes;
    9151008
    9161009        if (!empty($excludes)) {
     
    9271020    public function build_exclude_find_params()
    9281021    {
    929         $excludes =$this->excludes;
     1022        $excludes = $this->excludes;
    9301023        $params = '';
    9311024
     
    9401033    public function count_dir_files($path)
    9411034    {
    942         //global $use_system_calls;
    943 
    944         $use_system_calls=false;
     1035        $use_system_calls = false;
    9451036
    9461037        $path = rtrim($path, '/');
     
    9761067    public function abort_if_requested()
    9771068    {
    978 
    9791069        $progress = $this->progress;
    9801070        $last_abort_check = $this->last_abort_check;
     
    9881078
    9891079    /**
     1080     * Helper: validate backup slug
     1081     */
     1082    private function is_valid_slug($slug)
     1083    {
     1084        return is_string($slug) && preg_match('/^flmbkp_\d{14,}$/', $slug);
     1085    }
     1086
     1087    /**
     1088     * Helper: delete partial files for a slug
     1089     * @return int number of files deleted
     1090     */
     1091    private function delete_partial_files($slug)
     1092    {
     1093        $backup_directory = $this->get_backup_directory();
     1094        $deleted = 0;
     1095
     1096        $suffixes = array('plugins', 'themes', 'uploads', 'others', 'database');
     1097        foreach ($suffixes as $sfx) {
     1098            $file = $backup_directory . '/' . $slug . '_' . $sfx . '.zip';
     1099            if (is_file($file)) {
     1100                @unlink($file);
     1101                if (!file_exists($file)) {
     1102                    $deleted++;
     1103                }
     1104            }
     1105        }
     1106
     1107        // Also clean any stray .sql temporary (for database step before zipping)
     1108        $sql = $backup_directory . '/' . $slug . '_database.sql';
     1109        if (is_file($sql)) {
     1110            @unlink($sql);
     1111            if (!file_exists($sql)) {
     1112                $deleted++;
     1113            }
     1114        }
     1115
     1116        return $deleted;
     1117    }
     1118
     1119    /**
    9901120     * Register callbacks for actions and filters
    9911121     *
     
    10051135
    10061136        try {
    1007             //$instance_example = new WPPS_Instance_Class( 'Instance example', '42' );
    1008             //add_notice('ba');
     1137            // initialization
    10091138        } catch (Exception $exception) {
    10101139            add_notice(__METHOD__ . ' error: ' . $exception->getMessage(), 'error');
     
    10251154    public function activate($network_wide)
    10261155    {
    1027 
    10281156        return true;
    10291157    }
  • softdiscover-db-file-manager/trunk/modules/filemanager/helpers/iprogress.php

    r3027919 r3369101  
    1313    private $progress_file = '';
    1414    private $state = array();
    15     private $fp;
     15    private $fp = null;
    1616    private $data = array();
    1717
     18    /**
     19     * Build a safe, non-web-accessible directory for progress files.
     20     * Prefers system temp, falls back to WP_CONTENT_DIR/softdiscover/backups/.runtime.
     21     */
     22    private static function getProgressDir()
     23    {
     24        $candidates = array();
     25
     26        // 1) System temp is usually outside webroot
     27        $tmp = function_exists('sys_get_temp_dir') ? sys_get_temp_dir() : null;
     28        if (!empty($tmp)) {
     29            $candidates[] = rtrim($tmp, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'softdiscover-backups-runtime';
     30        }
     31
     32        // 2) WP content runtime (we'll harden with .htaccess/web.config/index.html)
     33        if (defined('WP_CONTENT_DIR')) {
     34            $candidates[] = rtrim(WP_CONTENT_DIR, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'softdiscover' . DIRECTORY_SEPARATOR . 'backups' . DIRECTORY_SEPARATOR . '.runtime';
     35        }
     36
     37        // 3) As a last resort, next to this file BUT inside a hidden sibling folder (still hardened)
     38        $candidates[] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '.runtime';
     39
     40        foreach ($candidates as $dir) {
     41            if (!is_dir($dir)) {
     42                // Only use WP helper when available, otherwise mkdir recursively.
     43                if (function_exists('wp_mkdir_p')) {
     44                    @wp_mkdir_p($dir);
     45                } else {
     46                    @mkdir($dir, 0755, true);
     47                }
     48            }
     49            if (is_dir($dir) && is_writable($dir)) {
     50                self::writeHardeningFiles($dir);
     51                return $dir;
     52            }
     53        }
     54
     55        // Fallback: current directory (will still be hardened). Not ideal, but prevents failure.
     56        $fallback = dirname(__FILE__) . DIRECTORY_SEPARATOR . '.runtime';
     57        if (!is_dir($fallback)) {
     58            @mkdir($fallback, 0755, true);
     59        }
     60        self::writeHardeningFiles($fallback);
     61        return $fallback;
     62    }
     63
     64    /**
     65     * Create deny-all hardening files for Apache/IIS and a placeholder index.html.
     66     */
     67    private static function writeHardeningFiles($dir)
     68    {
     69        // Apache
     70        $htaccess = $dir . DIRECTORY_SEPARATOR . '.htaccess';
     71        if (!file_exists($htaccess)) {
     72            $ht = ""
     73                . "Options -Indexes\n"
     74                . "<IfModule mod_authz_core.c>\n"
     75                . "  Require all denied\n"
     76                . "</IfModule>\n"
     77                . "<IfModule !mod_authz_core.c>\n"
     78                . "  Order allow,deny\n"
     79                . "  Deny from all\n"
     80                . "</IfModule>\n";
     81            @file_put_contents($htaccess, $ht);
     82        }
     83
     84        // IIS
     85        $webconfig = $dir . DIRECTORY_SEPARATOR . 'web.config';
     86        if (!file_exists($webconfig)) {
     87            $wc = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"
     88                . '<configuration>' . "\n"
     89                . '  <system.webServer>' . "\n"
     90                . '    <security>' . "\n"
     91                . '      <authorization>' . "\n"
     92                . '        <deny users="*" />' . "\n"
     93                . '      </authorization>' . "\n"
     94                . '    </security>' . "\n"
     95                . '    <directoryBrowse enabled="false" />' . "\n"
     96                . '  </system.webServer>' . "\n"
     97                . '</configuration>' . "\n";
     98            @file_put_contents($webconfig, $wc);
     99        }
     100
     101        // Placeholder (covers directory listing on some setups)
     102        $index = $dir . DIRECTORY_SEPARATOR . 'index.html';
     103        if (!file_exists($index)) {
     104            @file_put_contents($index, "<!doctype html><title>403</title><h1>Forbidden</h1>");
     105        }
     106    }
     107
     108    /**
     109     * Sanitize task name to a safe filename component.
     110     */
     111    private static function sanitizeTask($task)
     112    {
     113        $task = (string)$task;
     114        $task = preg_replace('/[^A-Za-z0-9._-]/', '_', $task);
     115        if ($task === '' || $task === null) {
     116            $task = 'isense';
     117        }
     118        return $task;
     119    }
     120
    18121    public function __construct($task = 'isense', $messageHistoryCount = 20)
    19122    {
    20         $this->task_name = $task;
    21         $this->progress_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . $task . '.iprogress';
    22         $this->fp = fopen($this->progress_file, 'c+');
    23        
    24         $this->loadState();
    25        
    26         $this->message_history_count = ($messageHistoryCount != 20) ? $messageHistoryCount : (!empty($this->state['history_count']) ? $this->state['history_count'] : $messageHistoryCount);
    27         $this->max_value = !empty($this->state['max']) ? $this->state['max'] : 100;
    28         $this->current_value = !empty($this->state['current']) ? $this->state['current'] : 0;
    29         $this->messages = !empty($this->state['messages']) ? $this->state['messages'] : array();
    30         $this->last_message = !empty($this->state['last_message']) ? $this->state['last_message'] : '';
    31         $this->abortCalled = !empty($this->state['abort']) ? $this->state['abort'] : false;
    32         $this->data = !empty($this->state['data']) ? json_decode($this->state['data'], true) : array();
    33     }
    34    
     123        $this->task_name = self::sanitizeTask($task);
     124
     125        // Allow overriding the runtime directory via WordPress filter if available.
     126        $dir = self::getProgressDir();
     127        if (function_exists('apply_filters')) {
     128            $dir = apply_filters('flmbkp_progress_dir', $dir, $this->task_name);
     129            if (!is_dir($dir)) {
     130                if (function_exists('wp_mkdir_p')) {
     131                    @wp_mkdir_p($dir);
     132                } else {
     133                    @mkdir($dir, 0755, true);
     134                }
     135                self::writeHardeningFiles($dir);
     136            }
     137        }
     138
     139        $this->progress_file = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $this->task_name . '.iprogress';
     140
     141        // Open file for read/write, create if not exists
     142        $created = !file_exists($this->progress_file);
     143        $this->fp = @fopen($this->progress_file, 'c+');
     144        if ($this->fp === false) {
     145            // As a last resort: try system temp directly
     146            $fallback = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $this->task_name . '.iprogress';
     147            $this->progress_file = $fallback;
     148            $this->fp = @fopen($this->progress_file, 'c+');
     149        }
     150
     151        if (is_resource($this->fp)) {
     152            if ($created) {
     153                @chmod($this->progress_file, 0600); // restrict permissions
     154            }
     155            $this->loadState();
     156
     157            $this->message_history_count = ($messageHistoryCount != 20)
     158                ? (int)$messageHistoryCount
     159                : (!empty($this->state['history_count']) ? (int)$this->state['history_count'] : (int)$messageHistoryCount);
     160
     161            $this->max_value     = isset($this->state['max'])         ? (int)$this->state['max']         : 100;
     162            $this->current_value = isset($this->state['current'])     ? (int)$this->state['current']     : 0;
     163            $this->messages      = !empty($this->state['messages'])   ? $this->state['messages']         : array();
     164            $this->last_message  = isset($this->state['last_message'])? $this->state['last_message']     : '';
     165            $this->abortCalled   = !empty($this->state['abort']);
     166            $this->data          = !empty($this->state['data'])       ? json_decode($this->state['data'], true) : array();
     167        } else {
     168            // If file handle cannot be opened, keep defaults (no progress persistence)
     169            $this->state = array();
     170        }
     171    }
     172
    35173    public function __destruct()
    36174    {
    37         fclose($this->fp);
     175        if (is_resource($this->fp)) {
     176            @fclose($this->fp);
     177        }
    38178    }
    39179
     
    44184        $this->saveState();
    45185    }
     186
    46187    public function abortCalled()
    47188    {
    48189        $this->sync();
    49         return $this->abortCalled;
     190        return (bool)$this->abortCalled;
    50191    }
    51192
     
    53194    {
    54195        $this->sync();
    55         $this->max_value = $max;
    56         $this->saveState();
    57     }
     196        $this->max_value = (int)$max;
     197        $this->saveState();
     198    }
     199
    58200    public function getMax()
    59201    {
    60202        $this->sync();
    61         return $this->max_value;
     203        return (int)$this->max_value;
    62204    }
    63205
     
    65207    {
    66208        $this->sync();
    67         $this->current_value = $progress;
    68         $this->saveState();
    69     }
     209        $this->current_value = (int)$progress;
     210        $this->saveState();
     211    }
     212
    70213    public function getProgress($sync = true)
    71214    {
    72215        if ($sync) {
    73216            $this->sync();
    74         } return $this->current_value;
    75     }
    76    
     217        }
     218        return (int)$this->current_value;
     219    }
     220
    77221    public function setData($key, $value)
    78222    {
     
    81225        $this->saveState();
    82226    }
     227
    83228    public function getData($key)
    84229    {
     
    90235    {
    91236        $this->sync();
    92         if (empty($this->messages[$this->current_value])) {
    93             $this->messages[$this->current_value] = array();
    94         }
    95         $this->messages[$this->current_value][] = $msg;
     237        $idx = (int)$this->current_value;
     238        if (empty($this->messages[$idx])) {
     239            $this->messages[$idx] = array();
     240        }
     241        $this->messages[$idx][] = $msg;
    96242        $this->last_message = $msg;
     243
    97244        if ($this->countMessages() > $this->message_history_count) {
    98245            $this->truncMessages();
    99246        }
    100         $this->saveState();
    101     }
     247
     248        $this->saveState();
     249    }
     250
    102251    public function getMessages()
    103252    {
     
    105254        return $this->messages;
    106255    }
     256
    107257    public function getLastMessage()
    108258    {
     
    114264    {
    115265        $this->sync();
    116         $this->current_value += $value;
    117         $this->saveState();
    118     }
     266        $this->current_value += (int)$value;
     267        $this->saveState();
     268    }
     269
    119270    public function getProgressPercent()
    120271    {
    121272        $this->sync();
    122         return (($this->max_value == $this->current_value) || $this->max_value == 0) ? 100 : (int)(($this->current_value/$this->max_value)*100);
     273        if ($this->max_value == 0) {
     274            return 100;
     275        }
     276        return ($this->max_value == $this->current_value)
     277            ? 100
     278            : (int)(($this->current_value / $this->max_value) * 100);
    123279    }
    124280
     
    137293    {
    138294        $messages_count = 0;
     295        foreach ($this->messages as $messages) {
     296            $messages_count += is_array($messages) ? count($messages) : 0;
     297        }
     298        return $messages_count;
     299    }
     300
     301    private function truncMessages()
     302    {
     303        $message_overflow = $this->countMessages() - $this->message_history_count;
     304        if ($message_overflow <= 0) {
     305            return;
     306        }
    139307        foreach ($this->messages as $progress_value => $messages) {
    140             $messages_count += count($messages);
    141         }
    142         return $messages_count;
    143     }
    144 
    145     private function truncMessages()
    146     {
    147         $message_overflow = $this->countMessages() - $this->message_history_count;
    148         foreach ($this->messages as $progress_value => $messages) {
    149             foreach ($messages as &$msg) {
     308            foreach ($messages as $k => $msg) {
     309                unset($this->messages[$progress_value][$k]);
     310                $message_overflow--;
    150311                if ($message_overflow <= 0) {
    151312                    break 2;
    152313                }
    153                 unset($msg);
    154                 $message_overflow--;
    155             }
    156             unset($this->messages[$progress_value]);
     314            }
     315            if (empty($this->messages[$progress_value])) {
     316                unset($this->messages[$progress_value]);
     317            }
    157318        }
    158319    }
     
    160321    private function saveState()
    161322    {
    162         $this->state['max'] = $this->max_value;
    163         $this->state['current'] = $this->current_value;
    164         $this->state['messages'] = $this->messages;
    165         $this->state['last_message'] = $this->last_message;
    166         $this->state['abort'] = $this->abortCalled;
    167         $this->state['data'] = json_encode($this->data);
    168        
     323        $this->state['max']          = (int)$this->max_value;
     324        $this->state['current']      = (int)$this->current_value;
     325        $this->state['messages']     = $this->messages;
     326        $this->state['last_message'] = (string)$this->last_message;
     327        $this->state['abort']        = (bool)$this->abortCalled;
     328        $this->state['history_count']= (int)$this->message_history_count;
     329        $this->state['data']         = json_encode($this->data);
     330
    169331        if (is_resource($this->fp)) {
    170             flock($this->fp, LOCK_EX);
    171             ftruncate($this->fp, 0);
    172             rewind($this->fp);
    173             fwrite($this->fp, json_encode($this->state));
    174             fflush($this->fp);
    175             flock($this->fp, LOCK_UN);
    176         }
    177     }
    178    
     332            @flock($this->fp, LOCK_EX);
     333            @ftruncate($this->fp, 0);
     334            @rewind($this->fp);
     335            @fwrite($this->fp, json_encode($this->state));
     336            @fflush($this->fp);
     337            @flock($this->fp, LOCK_UN);
     338        }
     339    }
     340
    179341    private function loadState()
    180342    {
    181343        if (is_resource($this->fp)) {
    182             flock($this->fp, LOCK_SH);
    183             $info = fstat($this->fp);
    184             if ($info['size']) {
    185                 rewind($this->fp);
    186                 $this->state = json_decode(fread($this->fp, $info['size']), true);
    187                 flock($this->fp, LOCK_UN);
     344            @flock($this->fp, LOCK_SH);
     345            $info = @fstat($this->fp);
     346            if (!empty($info) && isset($info['size']) && $info['size'] > 0) {
     347                @rewind($this->fp);
     348                $raw = @fread($this->fp, $info['size']);
     349                $decoded = json_decode($raw, true);
     350                $this->state = is_array($decoded) ? $decoded : array();
    188351            } else {
    189352                $this->state = array();
    190353            }
     354            @flock($this->fp, LOCK_UN);
    191355        } else {
    192356            $this->state = array();
     
    197361    {
    198362        $this->loadState();
    199        
    200         if (!empty($this->state['max'])) { //if one is set, the others will also be set
    201             $this->max_value = $this->state['max'];
    202             $this->current_value = $this->state['current'];
    203             $this->messages = $this->state['messages'];
    204             $this->last_message = $this->state['last_message'];
    205             $this->abortCalled = $this->state['abort'];
    206             $this->data = json_decode($this->state['data'], true);
     363
     364        if (!empty($this->state)) {
     365            if (isset($this->state['max']))          $this->max_value     = (int)$this->state['max'];
     366            if (isset($this->state['current']))      $this->current_value = (int)$this->state['current'];
     367            if (isset($this->state['messages']))     $this->messages      = $this->state['messages'];
     368            if (isset($this->state['last_message'])) $this->last_message  = (string)$this->state['last_message'];
     369            if (isset($this->state['abort']))        $this->abortCalled   = (bool)$this->state['abort'];
     370            if (isset($this->state['data']))         $this->data          = json_decode($this->state['data'], true);
     371            if (isset($this->state['history_count']))$this->message_history_count = (int)$this->state['history_count'];
    207372        }
    208373    }
  • softdiscover-db-file-manager/trunk/modules/filemanager/models/backup.php

    r3027919 r3369101  
    1111 * @copyright 2015 Softdiscover
    1212 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    13  * @link      https://wordpress-form-builder.zigaform.com/
     13 * @link      https://softdiscover.com/
    1414 */
    1515if (!defined('ABSPATH')) {
     
    2929 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    3030 * @version   Release: 1.00
    31  * @link      https://wordpress-form-builder.zigaform.com/
     31 * @link      https://softdiscover.com/
    3232 */
    3333class flmbkp_Model_Backup
  • softdiscover-db-file-manager/trunk/modules/filemanager/views/backup/list_backups.php

    r3037022 r3369101  
    1010 * @copyright 2015 Softdiscover
    1111 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    12  * @link      https://wordpress-form-builder.zigaform.com/
     12 * @link      https://softdiscover.com/
    1313 */
    1414if (!defined('ABSPATH')) {
     
    2828                    </h5>
    2929
    30                 </div> 
     30                </div>
    3131                <div class="widget-body">
    3232
    3333                    <div class="flmbkp-bkpoptions-wrap">
    34                         <form class="rockfm-form" 
    35                               action="" 
    36                               name="" 
    37                               method="post" 
    38                               enctype="multipart/form-data" 
     34                        <form class="rockfm-form"
     35                              action=""
     36                              name=""
     37                              method="post"
     38                              enctype="multipart/form-data"
    3939                              id="flmbkp_backup_form">
    4040                            <div class="alert alert-info" role="alert">
     
    4242                                <div class="">
    4343                                    <div class="row">
    44                                      
     44
    4545                                        <div class="col-sm-4">
    46                                             <fieldset class="col-md-12">       
     46                                            <fieldset class="col-md-12">
    4747                                                <legend><?php echo __('Files', 'FRocket_admin'); ?></legend>
    4848
     
    5555                                                        <div class="alert alert-secondary" role="alert">
    5656                                                            <div class="form-check">
    57                                                                 <input name="flpbkp_opt_plugins" class="" type="checkbox" value="plugins" id="defaultCheck1" checked  >
     57                                                                <input name="flpbkp_opt_plugins" class="" type="checkbox" value="plugins" id="defaultCheck1" checked>
    5858                                                                <label class="form-check-label" for="defaultCheck1">
    5959                                                                    <?php echo __('Plugins', 'FRocket_admin'); ?>
     
    6161                                                            </div>
    6262                                                            <div class="form-check">
    63                                                                 <input name="flpbkp_opt_themes" class="" type="checkbox" value="themes" id="defaultCheck2" checked >
     63                                                                <input name="flpbkp_opt_themes" class="" type="checkbox" value="themes" id="defaultCheck2" checked>
    6464                                                                <label class="form-check-label" for="defaultCheck2">
    6565                                                                    <?php echo __('Themes', 'FRocket_admin'); ?>
     
    6767                                                            </div>
    6868                                                            <div class="form-check">
    69                                                                 <input name="flpbkp_opt_uploads" class="" type="checkbox" value="uploads" id="defaultCheck3" checked >
    70                                                                 <label class="form-check-label" for="defaultCheck2">
     69                                                                <input name="flpbkp_opt_uploads" class="" type="checkbox" value="uploads" id="defaultCheck3" checked>
     70                                                                <label class="form-check-label" for="defaultCheck3">
    7171                                                                    <?php echo __('Uploads', 'FRocket_admin'); ?>
    7272                                                                </label>
    7373                                                            </div>
    7474                                                            <div class="form-check">
    75                                                                 <input name="flpbkp_opt_others" class="" type="checkbox" value="others" id="defaultCheck4" checked >
    76                                                                 <label class="form-check-label" for="defaultCheck2">
     75                                                                <input name="flpbkp_opt_others" class="" type="checkbox" value="others" id="defaultCheck4" checked>
     76                                                                <label class="form-check-label" for="defaultCheck4">
    7777                                                                    <?php echo __('Any other directories found inside wp-content', 'FRocket_admin'); ?>
    7878                                                                </label>
     
    8585                                            </fieldset>
    8686                                        </div>
    87                                           <div class="col-sm-4">
    88 
    89                                             <fieldset class="col-md-12">       
     87                                        <div class="col-sm-4">
     88
     89                                            <fieldset class="col-md-12">
    9090                                                <legend><?php echo __('Database', 'FRocket_admin'); ?></legend>
    9191
     
    9494                                                        <p>
    9595                                                            <label class = "checkbox-inline">
    96                                                                 <input name="flpbkp_opt_database" type = "checkbox" id = "databaseCheckbox1" value = "database" checked > <?php echo __('Include your database in the backup', 'FRocket_admin'); ?>
     96                                                                <input name="flpbkp_opt_database" type="checkbox" id="databaseCheckbox1" value="database" checked> <?php echo __('Include your database in the backup', 'FRocket_admin'); ?>
    9797                                                            </label>
    9898                                                        <div class="alert alert-secondary" role="alert">
     
    105105                                            </fieldset>
    106106
    107 
    108107                                        </div>
    109108                                        <div class="col-sm-4">
    110                                             <button type="button" class="btn btn-primary btn-lg btn-block text-monospace"><?php echo __('Backup Now', 'FRocket_admin'); ?></button>
     109                                            <button type="button" id="flmbkp_backup_btn" class="btn btn-primary btn-lg btn-block text-monospace">
     110                                                <?php echo __('Backup Now', 'FRocket_admin'); ?>
     111                                            </button>
     112                                            <button type="button" id="flmbkp_cancel_btn" class="btn btn-outline-danger btn-lg btn-block text-monospace" style="display:none;">
     113                                                <?php echo __('Cancel Backup', 'FRocket_admin'); ?>
     114                                            </button>
    111115                                        </div>
    112116                                    </div>
     
    114118
    115119                            </div>
    116                         </form> 
     120                        </form>
    117121                    </div>
    118122
    119                     <div id="flmbkp_progress_graph" class="alert alert-danger alert-dismissible fade show" role="alert">
    120                         <div><strong><?php echo __('Backuping Now', 'FRocket_admin'); ?></strong> <?php echo __('Wait until backup is finished', 'FRocket_admin'); ?> <i class="fa fa-spin fa-8x fa-spinner" id="loading-icon"></i></div>
     123                    <div id="flmbkp_progress_graph" class="alert alert-danger alert-dismissible fade show" role="alert" style="display:none;">
     124                        <div>
     125                            <strong><?php echo __('Backing up now', 'FRocket_admin'); ?></strong>
     126                            <?php echo __('Wait until backup is finished', 'FRocket_admin'); ?>
     127                            <i class="fa fa-spin fa-8x fa-spinner" id="loading-icon"></i>
     128                        </div>
    121129                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
    122130                            <span aria-hidden="true">&times;</span>
     
    164172
    165173                    </div>
    166  
     174
    167175                    <div id="flmbkp_directoryListing" style="display:none;"></div>
    168                     <textarea  id="flmbkp_processLog" style="width: 100%;"></textarea>
    169  
     176                    <textarea id="flmbkp_processLog" style="width: 100%;"></textarea>
     177
    170178                    <div class="alert alert-secondary" role="alert">
    171179
     
    173181                            <table class="table table-striped table-bordered dataTable" id="users">
    174182                                <thead>
    175                                     <tr>
    176                                         <th><?php echo __('File name', 'FRocket_admin'); ?></th>
    177                                         <th><?php echo __('Backup Created', 'FRocket_admin'); ?></th>
    178                                         <th><?php echo __('Backup Data', 'FRocket_admin'); ?></th>
    179                                         <th><?php echo __('Options', 'FRocket_admin'); ?></th>
    180                                     </tr>
     183                                <tr>
     184                                    <th><?php echo __('File name', 'FRocket_admin'); ?></th>
     185                                    <th><?php echo __('Backup Created', 'FRocket_admin'); ?></th>
     186                                    <th><?php echo __('Backup Data', 'FRocket_admin'); ?></th>
     187                                    <th><?php echo __('Options', 'FRocket_admin'); ?></th>
     188                                </tr>
    181189                                </thead>
    182190                                <tbody>
    183                                     <?php if (!empty($query)) { ?>
    184                                         <?php foreach ($query as $row) : ?>
    185                                             <tr>
    186                                                 <td><?php echo $row->bkp_slug; ?></td>
    187                                                 <td><?php echo $row->created_date; ?></td>
    188                                                 <td>
    189                                                 <?php if (file_exists(WP_CONTENT_DIR.'/uploads/softdiscover/'.$row->bkp_slug.'_plugins.zip')) {   ?>
    190                                                     <button onclick="flmbkp_back_backup.options_downloadFiles('<?php echo $row->bkp_slug;?>_plugins.zip')"  class="btn btn-warning">
    191                                                     <i class="fa fa-download"></i> <?php echo __('Plugins', 'FRocket_admin'); ?>
    192                                                     </button>
    193                                                 <?php } ?>
    194                                                 <?php if (file_exists(WP_CONTENT_DIR.'/uploads/softdiscover/'.$row->bkp_slug.'_themes.zip')) {   ?>
    195                                                     <button onclick="flmbkp_back_backup.options_downloadFiles('<?php echo $row->bkp_slug;?>_themes.zip')"  class="btn btn-warning">
    196                                                     <i class="fa fa-download"></i> <?php echo __('Themes', 'FRocket_admin'); ?>
    197                                                     </button>
    198                                                 <?php } ?>
    199                                                     <?php if (file_exists(WP_CONTENT_DIR.'/uploads/softdiscover/'.$row->bkp_slug.'_uploads.zip')) {   ?>
    200                                                     <button onclick="flmbkp_back_backup.options_downloadFiles('<?php echo $row->bkp_slug;?>_uploads.zip')"  class="btn btn-warning">
    201                                                     <i class="fa fa-download"></i> <?php echo __('Uploads', 'FRocket_admin'); ?>
    202                                                     </button>
    203                                                     <?php } ?>
    204                                                     <?php if (file_exists(WP_CONTENT_DIR.'/uploads/softdiscover/'.$row->bkp_slug.'_others.zip')) {   ?>
    205                                                     <button onclick="flmbkp_back_backup.options_downloadFiles('<?php echo $row->bkp_slug;?>_others.zip')"  class="btn btn-warning">
    206                                                     <i class="fa fa-download"></i> <?php echo __('Others', 'FRocket_admin'); ?>
    207                                                     </button>
    208                                                     <?php } ?>
    209                                                     <?php if (file_exists(WP_CONTENT_DIR.'/uploads/softdiscover/'.$row->bkp_slug.'_database.zip')) {   ?>
    210                                                     <button onclick="flmbkp_back_backup.options_downloadFiles('<?php echo $row->bkp_slug;?>_database.zip')"  class="btn btn-warning">
    211                                                     <i class="fa fa-download"></i> <?php echo __('Database', 'FRocket_admin'); ?>
    212                                                     </button>
    213                                                     <?php } ?>
    214                                                
    215                                                 </td>
    216                                                 <td>
    217                                                     <div class="sfdc-btn-group">
    218                                                         <ul class="unstyled">
    219                                                              
    220                                                             <li><a href="javascript:void(0);"
    221                                                                    class="btn btn-danger uiform-confirmation-func-action"
    222                                                                    data-dialog-title="<?php echo __('Delete', 'FRocket_admin') ?>"
    223                                                                    data-dialog-callback="flmbkp_back_backup.records_delreg(<?php echo $row->bkp_id; ?>);"
    224                                                                    data-recid="<?php echo $row->bkp_id; ?>">
    225                                                                     <i class="fa fa-trash-o"></i> <?php echo __('Delete', 'FRocket_admin'); ?></a></li>
    226                                                                     <li><a href="javascript:void(0);"
    227                                                                    class="btn btn-info uiform-confirmation-func-action"
    228                                                                    data-dialog-title="<?php echo __('Backup', 'FRocket_admin') ?>"
    229                                                                    data-dialog-callback="flmbkp_back_backup.records_restore(<?php echo $row->bkp_id; ?>);"
    230                                                                    data-recid="<?php echo $row->bkp_id; ?>">
    231                                                                     <i class="fa fa-window-restore"></i> <?php echo __('Restore', 'FRocket_admin'); ?></a></li>
    232                                                         </ul>
    233                                                     </div>
    234                                                 </td>
    235                                             </tr>
    236                                             <?php
    237                                         endforeach;
    238                                         ?>
    239                                     <?php }else { ?>
     191                                <?php if (!empty($query)) { ?>
     192                                    <?php foreach ($query as $row) : ?>
    240193                                        <tr>
    241                                             <td colspan="5">
    242                                                 <div class="sfdc-alert sfdc-alert-info"><i class="fa fa-exclamation-triangle"></i> <?php echo __('there is not Backups', 'FRocket_admin'); ?></div>
     194                                            <td><?php echo $row->bkp_slug; ?></td>
     195                                            <td><?php echo $row->created_date; ?></td>
     196                                            <td>
     197                                                <?php if (file_exists(WP_CONTENT_DIR.'/softdiscover/backups/'.$row->bkp_slug.'_plugins.zip')) { ?>
     198                                                    <button onclick="flmbkp_back_backup.options_downloadFiles('<?php echo $row->bkp_slug; ?>_plugins.zip')" class="btn btn-warning">
     199                                                        <i class="fa fa-download"></i> <?php echo __('Plugins', 'FRocket_admin'); ?>
     200                                                    </button>
     201                                                <?php } ?>
     202                                                <?php if (file_exists(WP_CONTENT_DIR.'/softdiscover/backups/'.$row->bkp_slug.'_themes.zip')) { ?>
     203                                                    <button onclick="flmbkp_back_backup.options_downloadFiles('<?php echo $row->bkp_slug; ?>_themes.zip')" class="btn btn-warning">
     204                                                        <i class="fa fa-download"></i> <?php echo __('Themes', 'FRocket_admin'); ?>
     205                                                    </button>
     206                                                <?php } ?>
     207                                                <?php if (file_exists(WP_CONTENT_DIR.'/softdiscover/backups/'.$row->bkp_slug.'_uploads.zip')) { ?>
     208                                                    <button onclick="flmbkp_back_backup.options_downloadFiles('<?php echo $row->bkp_slug; ?>_uploads.zip')" class="btn btn-warning">
     209                                                        <i class="fa fa-download"></i> <?php echo __('Uploads', 'FRocket_admin'); ?>
     210                                                    </button>
     211                                                <?php } ?>
     212                                                <?php if (file_exists(WP_CONTENT_DIR.'/softdiscover/backups/'.$row->bkp_slug.'_others.zip')) { ?>
     213                                                    <button onclick="flmbkp_back_backup.options_downloadFiles('<?php echo $row->bkp_slug; ?>_others.zip')" class="btn btn-warning">
     214                                                        <i class="fa fa-download"></i> <?php echo __('Others', 'FRocket_admin'); ?>
     215                                                    </button>
     216                                                <?php } ?>
     217                                                <?php if (file_exists(WP_CONTENT_DIR.'/softdiscover/backups/'.$row->bkp_slug.'_database.zip')) { ?>
     218                                                    <button onclick="flmbkp_back_backup.options_downloadFiles('<?php echo $row->bkp_slug; ?>_database.zip')" class="btn btn-warning">
     219                                                        <i class="fa fa-download"></i> <?php echo __('Database', 'FRocket_admin'); ?>
     220                                                    </button>
     221                                                <?php } ?>
     222
     223                                            </td>
     224                                            <td>
     225                                                <div class="sfdc-btn-group">
     226                                                    <ul class="unstyled">
     227                                                        <li>
     228                                                            <a href="javascript:void(0);"
     229                                                               class="btn btn-danger uiform-confirmation-func-action"
     230                                                               data-dialog-title="<?php echo __('Delete', 'FRocket_admin') ?>"
     231                                                               data-dialog-callback="flmbkp_back_backup.records_delreg(<?php echo (int) $row->bkp_id; ?>);"
     232                                                               data-recid="<?php echo (int) $row->bkp_id; ?>">
     233                                                                <i class="fa fa-trash-o"></i> <?php echo __('Delete', 'FRocket_admin'); ?>
     234                                                            </a>
     235                                                        </li>
     236                                                        <li>
     237                                                            <a href="javascript:void(0);"
     238                                                               class="btn btn-info uiform-confirmation-func-action"
     239                                                               data-dialog-title="<?php echo __('Backup', 'FRocket_admin') ?>"
     240                                                               data-dialog-callback="flmbkp_back_backup.records_restore(<?php echo (int) $row->bkp_id; ?>);"
     241                                                               data-recid="<?php echo (int) $row->bkp_id; ?>">
     242                                                                <i class="fa fa-window-restore"></i> <?php echo __('Restore', 'FRocket_admin'); ?>
     243                                                            </a>
     244                                                        </li>
     245                                                    </ul>
     246                                                </div>
    243247                                            </td>
    244248                                        </tr>
    245                                     <?php } ?>
     249                                    <?php endforeach; ?>
     250                                <?php } else { ?>
     251                                    <tr>
     252                                        <td colspan="5">
     253                                            <div class="sfdc-alert sfdc-alert-info"><i class="fa fa-exclamation-triangle"></i> <?php echo __('there is not Backups', 'FRocket_admin'); ?></div>
     254                                        </td>
     255                                    </tr>
     256                                <?php } ?>
    246257                                </tbody>
    247258                            </table>
     
    250261                    </div>
    251262
    252 
    253263                    <center>
    254                         <div  class="pagination-wrap"><?php echo $pagination; ?></div></center>
    255                 </div>
    256             </div>
     264                        <div class="pagination-wrap"><?php echo $pagination; ?></div>
     265                    </center>
     266                </div>
     267            </div>
    257268        </div>
    258269    </div>
  • softdiscover-db-file-manager/trunk/modules/filemanager/views/backup/restore_message.php

    r3027919 r3369101  
    1010 * @copyright 2015 Softdiscover
    1111 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    12  * @link      https://wordpress-form-builder.zigaform.com/
     12 * @link      https://softdiscover.com/
    1313 */
    1414if (!defined('ABSPATH')) {
  • softdiscover-db-file-manager/trunk/modules/optbuilder/controllers/fields.php

    r3027919 r3369101  
    1010 * @copyright 2015 Softdiscover
    1111 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    12  * @link      http://wordpress-cost-estimator.zigaform.com
     12 * @link      https://softdiscover.com
    1313 */
    1414if (!defined('ABSPATH')) {
     
    2828 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    2929 * @version   Release: 1.00
    30  * @link      http://wordpress-cost-estimator.zigaform.com
     30 * @link      https://softdiscover.com
    3131 */
    3232class Zgpb_Optb_Controller_Fields extends Flmbkp_Base_Module
  • softdiscover-db-file-manager/trunk/modules/settings/controllers/backend.php

    r3027919 r3369101  
    1111 * @copyright 2015 Softdiscover
    1212 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    13  * @link      http://wordpress-cost-estimator.zigaform.com
     13 * @link      https://softdiscover.com
    1414 */
    1515if (!defined('ABSPATH')) {
     
    2929 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    3030 * @version   Release: 1.00
    31  * @link      http://wordpress-cost-estimator.zigaform.com
     31 * @link      https://softdiscover.com
    3232 */
    3333class flmbkp_settings_Controller_Back extends Flmbkp_Base_Module
  • softdiscover-db-file-manager/trunk/modules/settings/views/backend/list_options.php

    r3027919 r3369101  
    1010 * @copyright 2015 Softdiscover
    1111 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
    12  * @link      https://wordpress-form-builder.zigaform.com/
     12 * @link      https://softdiscover.com/
    1313 */
    1414if (!defined('ABSPATH')) {
Note: See TracChangeset for help on using the changeset viewer.