Changeset 3369101
- Timestamp:
- 09/28/2025 07:04:21 AM (6 months ago)
- Location:
- softdiscover-db-file-manager/trunk
- Files:
-
- 16 edited
-
assets/backend/js/admin.js (modified) (1 diff)
-
classes/uiform-installdb.php (modified) (1 diff)
-
db-file-manager.php (modified) (2 diffs)
-
i18n/languages/backend/wprockf.pot (modified) (5 diffs)
-
modules/database/controllers/backend.php (modified) (2 diffs)
-
modules/database/views/backend/list_tables.php (modified) (1 diff)
-
modules/default/controllers/backend.php (modified) (2 diffs)
-
modules/filemanager/controllers/backend.php (modified) (2 diffs)
-
modules/filemanager/controllers/backup.php (modified) (51 diffs)
-
modules/filemanager/helpers/iprogress.php (modified) (11 diffs)
-
modules/filemanager/models/backup.php (modified) (2 diffs)
-
modules/filemanager/views/backup/list_backups.php (modified) (13 diffs)
-
modules/filemanager/views/backup/restore_message.php (modified) (1 diff)
-
modules/optbuilder/controllers/fields.php (modified) (2 diffs)
-
modules/settings/controllers/backend.php (modified) (2 diffs)
-
modules/settings/views/backend/list_options.php (modified) (1 diff)
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);1 var 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 10 10 * @copyright 2015 Softdiscover 11 11 * @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/ 13 13 */ 14 14 if (!defined('ABSPATH')) { -
softdiscover-db-file-manager/trunk/db-file-manager.php
r3350058 r3369101 4 4 * Plugin URI: https://softdiscover.com/managefy/ 5 5 * 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.06 * Version: 1.6.2 7 7 * Author: SoftDiscover.Com 8 8 * Author URI: https://github.com/Softdiscover … … 30 30 * @since 1.0 31 31 */ 32 public $version = '1. 5.0';32 public $version = '1.6.2'; 33 33 34 34 /** -
softdiscover-db-file-manager/trunk/i18n/languages/backend/wprockf.pot
r3350058 r3369101 1 # Copyright (C) 2025 Managefy 1. 5.02 # This file is distributed under the same license as the Managefy 1. 5.0package.1 # Copyright (C) 2025 Managefy 1.6.2 2 # This file is distributed under the same license as the Managefy 1.6.2 package. 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Managefy 1. 5.0\n"5 "Project-Id-Version: Managefy 1.6.2\n" 6 6 "MIME-Version: 1.0\n" 7 7 "Content-Type: text/plain; charset=UTF-8\n" 8 8 "Content-Transfer-Encoding: 8bit\n" 9 "POT-Creation-Date: 2025-0 8-26 05:26+0000\n"9 "POT-Creation-Date: 2025-09-28 07:00+0000\n" 10 10 "X-Poedit-Basepath: ..\n" 11 11 "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" … … 55 55 msgstr "" 56 56 57 #: modules/filemanager/controllers/backup.php:1 1757 #: modules/filemanager/controllers/backup.php:182 58 58 msgid "<b>Unable to restore DB backup.</b>" 59 59 msgstr "" 60 60 61 #: modules/filemanager/controllers/backup.php:1 1561 #: modules/filemanager/controllers/backup.php:180 62 62 msgid "<b>Database backup restored.</b>" 63 63 msgstr "" 64 64 65 #: modules/filemanager/controllers/backup.php:1 27, modules/filemanager/controllers/backup.php:137, modules/filemanager/controllers/backup.php:147, modules/filemanager/controllers/backup.php:15765 #: modules/filemanager/controllers/backup.php:192, modules/filemanager/controllers/backup.php:202, modules/filemanager/controllers/backup.php:212, modules/filemanager/controllers/backup.php:222 66 66 msgid "<b>Unable to restore plugins.</b>" 67 67 msgstr "" 68 68 69 #: modules/filemanager/controllers/backup.php:1 2569 #: modules/filemanager/controllers/backup.php:190 70 70 msgid "<b>Plugins backup restored.</b>" 71 71 msgstr "" 72 72 73 #: modules/filemanager/controllers/backup.php: 13573 #: modules/filemanager/controllers/backup.php:200 74 74 msgid "<b>Themes backup restored.</b>" 75 75 msgstr "" 76 76 77 #: modules/filemanager/controllers/backup.php: 14577 #: modules/filemanager/controllers/backup.php:210 78 78 msgid "<b>Uploads backup restored.</b>" 79 79 msgstr "" 80 80 81 #: modules/filemanager/controllers/backup.php: 15581 #: modules/filemanager/controllers/backup.php:220 82 82 msgid "<b>Others backup restored.</b>" 83 83 msgstr "" 84 84 85 #: modules/filemanager/controllers/backup.php: 16585 #: modules/filemanager/controllers/backup.php:230 86 86 msgid "Restored successfully" 87 87 msgstr "" 88 88 89 #: modules/filemanager/controllers/backup.php:2 1089 #: modules/filemanager/controllers/backup.php:275 90 90 msgid "Insufficient permissions." 91 91 msgstr "" 92 92 93 #: modules/filemanager/controllers/backup.php:2 23, modules/filemanager/controllers/backup.php:230, modules/filemanager/controllers/backup.php:241, modules/filemanager/controllers/backup.php:24793 #: modules/filemanager/controllers/backup.php:287, modules/filemanager/controllers/backup.php:294, modules/filemanager/controllers/backup.php:305, modules/filemanager/controllers/backup.php:311 94 94 msgid "Invalid file requested." 95 95 msgstr "" 96 96 97 #: modules/filemanager/controllers/backup.php: 25497 #: modules/filemanager/controllers/backup.php:317 98 98 msgid "Invalid file name." 99 99 msgstr "" 100 100 101 #: modules/filemanager/controllers/backup.php: 262101 #: modules/filemanager/controllers/backup.php:325 102 102 msgid "Invalid file type." 103 103 msgstr "" 104 104 105 #: modules/filemanager/controllers/backup.php: 271105 #: modules/filemanager/controllers/backup.php:334 106 106 msgid "Backup directory unavailable." 107 107 msgstr "" 108 108 109 #: modules/filemanager/controllers/backup.php: 281109 #: modules/filemanager/controllers/backup.php:344 110 110 msgid "Invalid path." 111 111 msgstr "" 112 112 113 #: modules/filemanager/controllers/backup.php: 286113 #: modules/filemanager/controllers/backup.php:349 114 114 msgid "File not found." 115 115 msgstr "" … … 331 331 msgstr "" 332 332 333 #: modules/filemanager/views/backup/list_backups.php:59, modules/filemanager/views/backup/list_backups.php:1 26, modules/filemanager/views/backup/list_backups.php:191333 #: modules/filemanager/views/backup/list_backups.php:59, modules/filemanager/views/backup/list_backups.php:134, modules/filemanager/views/backup/list_backups.php:199 334 334 msgid "Plugins" 335 335 msgstr "" 336 336 337 #: modules/filemanager/views/backup/list_backups.php:65, modules/filemanager/views/backup/list_backups.php:1 34, modules/filemanager/views/backup/list_backups.php:196337 #: modules/filemanager/views/backup/list_backups.php:65, modules/filemanager/views/backup/list_backups.php:142, modules/filemanager/views/backup/list_backups.php:204 338 338 msgid "Themes" 339 339 msgstr "" 340 340 341 #: modules/filemanager/views/backup/list_backups.php:71, modules/filemanager/views/backup/list_backups.php:1 42, modules/filemanager/views/backup/list_backups.php:201341 #: modules/filemanager/views/backup/list_backups.php:71, modules/filemanager/views/backup/list_backups.php:150, modules/filemanager/views/backup/list_backups.php:209 342 342 msgid "Uploads" 343 343 msgstr "" … … 347 347 msgstr "" 348 348 349 #: modules/filemanager/views/backup/list_backups.php:90, modules/filemanager/views/backup/list_backups.php:1 58, modules/filemanager/views/backup/list_backups.php:211349 #: modules/filemanager/views/backup/list_backups.php:90, modules/filemanager/views/backup/list_backups.php:166, modules/filemanager/views/backup/list_backups.php:219 350 350 msgid "Database" 351 351 msgstr "" … … 363 363 msgstr "" 364 364 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 366 msgid "Cancel Backup" 367 msgstr "" 368 369 #: modules/filemanager/views/backup/list_backups.php:125 370 msgid "Backing up now" 371 msgstr "" 372 373 #: modules/filemanager/views/backup/list_backups.php:126 370 374 msgid "Wait until backup is finished" 371 375 msgstr "" 372 376 373 #: modules/filemanager/views/backup/list_backups.php:15 0, modules/filemanager/views/backup/list_backups.php:206377 #: modules/filemanager/views/backup/list_backups.php:158, modules/filemanager/views/backup/list_backups.php:214 374 378 msgid "Others" 375 379 msgstr "" 376 380 377 #: modules/filemanager/views/backup/list_backups.php:1 76381 #: modules/filemanager/views/backup/list_backups.php:184 378 382 msgid "File name" 379 383 msgstr "" 380 384 381 #: modules/filemanager/views/backup/list_backups.php:1 77385 #: modules/filemanager/views/backup/list_backups.php:185 382 386 msgid "Backup Created" 383 387 msgstr "" 384 388 385 #: modules/filemanager/views/backup/list_backups.php:1 78389 #: modules/filemanager/views/backup/list_backups.php:186 386 390 msgid "Backup Data" 387 391 msgstr "" 388 392 389 #: modules/filemanager/views/backup/list_backups.php:1 79393 #: modules/filemanager/views/backup/list_backups.php:187 390 394 msgid "Options" 391 395 msgstr "" 392 396 397 #: modules/filemanager/views/backup/list_backups.php:253 398 msgid "there is not Backups" 399 msgstr "" 400 401 #: modules/filemanager/views/backup/list_backups.php:230, modules/filemanager/views/backup/list_backups.php:233 402 msgid "Delete" 403 msgstr "" 404 405 #: modules/filemanager/views/backup/list_backups.php:239 406 msgid "Backup" 407 msgstr "" 408 393 409 #: 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:225398 msgid "Delete"399 msgstr ""400 401 #: modules/filemanager/views/backup/list_backups.php:228402 msgid "Backup"403 msgstr ""404 405 #: modules/filemanager/views/backup/list_backups.php:231406 410 msgid "Restore" 407 411 msgstr "" 408 412 409 #: modules/filemanager/views/backup/list_backups.php:2 61413 #: modules/filemanager/views/backup/list_backups.php:272 410 414 msgid "Are you sure about this?" 411 415 msgstr "" -
softdiscover-db-file-manager/trunk/modules/database/controllers/backend.php
r3027919 r3369101 10 10 * @copyright 2015 Softdiscover 11 11 * @license http://www.php.net/license/3_01.txt PHP License 3.01 12 * @link http ://wordpress-cost-estimator.zigaform.com12 * @link https://softdiscover.com 13 13 */ 14 14 if (!defined('ABSPATH')) { … … 28 28 * @license http://www.php.net/license/3_01.txt PHP License 3.01 29 29 * @version Release: 1.00 30 * @link http ://wordpress-cost-estimator.zigaform.com30 * @link https://softdiscover.com 31 31 */ 32 32 class flmbkp_database_Controller_Back extends Flmbkp_Base_Module -
softdiscover-db-file-manager/trunk/modules/database/views/backend/list_tables.php
r3027919 r3369101 10 10 * @copyright 2015 Softdiscover 11 11 * @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/ 13 13 */ 14 14 if (!defined('ABSPATH')) { -
softdiscover-db-file-manager/trunk/modules/default/controllers/backend.php
r3027919 r3369101 10 10 * @copyright 2015 Softdiscover 11 11 * @license http://www.php.net/license/3_01.txt PHP License 3.01 12 * @link http ://wordpress-cost-estimator.zigaform.com12 * @link https://softdiscover.com 13 13 */ 14 14 if (!defined('ABSPATH')) { … … 28 28 * @license http://www.php.net/license/3_01.txt PHP License 3.01 29 29 * @version Release: 1.00 30 * @link http ://wordpress-cost-estimator.zigaform.com30 * @link https://softdiscover.com 31 31 */ 32 32 class flmbkp_Default_Controller_Back extends Flmbkp_Base_Module -
softdiscover-db-file-manager/trunk/modules/filemanager/controllers/backend.php
r3027919 r3369101 10 10 * @copyright 2015 Softdiscover 11 11 * @license http://www.php.net/license/3_01.txt PHP License 3.01 12 * @link http ://wordpress-cost-estimator.zigaform.com12 * @link https://softdiscover.com 13 13 */ 14 14 if (!defined('ABSPATH')) { … … 28 28 * @license http://www.php.net/license/3_01.txt PHP License 3.01 29 29 * @version Release: 1.00 30 * @link http ://wordpress-cost-estimator.zigaform.com30 * @link https://softdiscover.com 31 31 */ 32 32 class flmbkp_Filemanager_Controller_Back extends Flmbkp_Base_Module -
softdiscover-db-file-manager/trunk/modules/filemanager/controllers/backup.php
r3350045 r3369101 11 11 * @copyright 2015 Softdiscover 12 12 * @license http://www.php.net/license/3_01.txt PHP License 3.01 13 * @link http ://wordpress-cost-estimator.zigaform.com13 * @link https://softdiscover.com 14 14 */ 15 15 if (!defined('ABSPATH')) { … … 29 29 * @license http://www.php.net/license/3_01.txt PHP License 3.01 30 30 * @version Release: 1.00 31 * @link http://wordpress-cost -estimator.zigaform.com31 * @link http://wordpress-cost_estimator.zigaform.com 32 32 */ 33 33 class flmbkp_Filemanager_Controller_Backup extends Flmbkp_Base_Module … … 44 44 public $zip_obj; 45 45 public $last_abort_check; 46 47 46 48 47 public $total_targets; … … 70 69 71 70 //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')); 73 72 74 73 //submit header options 75 add_action('wp_ajax_flmbkp_backup_sendoptions', array( &$this, 'ajax_submit_options_switch'));76 77 // backup process78 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')); 79 78 80 79 //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')); 82 81 83 82 //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')); 85 84 86 85 //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')); 88 91 89 92 define('NL', "\r\n"); 90 93 } 91 94 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 } 92 158 93 159 /* … … 101 167 $bkp_id = (isset($_POST['rec_id']) && $_POST['rec_id']) ? Flmbkp_Form_Helper::sanitizeInput($_POST['rec_id']) : 0; 102 168 103 104 169 $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(); 109 174 110 175 //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')) { 112 177 require_once(FLMBKP_DIR . '/classes/uiform_backup.php'); 113 178 $objClass = new Flmbkp_Backup($rec_info->bkp_slug, $backup_directory); … … 120 185 121 186 // 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); 124 189 if ($tmp_res) { 125 190 $log[] = __('<b>Plugins backup restored.</b>', 'FRocket_admin'); … … 130 195 131 196 // 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); 134 199 if ($tmp_res) { 135 200 $log[] = __('<b>Themes backup restored.</b>', 'FRocket_admin'); … … 140 205 141 206 // 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); 144 209 if ($tmp_res) { 145 210 $log[] = __('<b>Uploads backup restored.</b>', 'FRocket_admin'); … … 150 215 151 216 // 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); 154 219 if ($tmp_res) { 155 220 $log[] = __('<b>Others backup restored.</b>', 'FRocket_admin'); … … 163 228 'log' => $log, 164 229 '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)) 167 232 ); 168 233 … … 182 247 $bkp_id = (isset($_POST['rec_id']) && $_POST['rec_id']) ? Flmbkp_Form_Helper::sanitizeInput($_POST['rec_id']) : 0; 183 248 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 recprd195 $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)); 196 261 } 197 262 … … 206 271 207 272 // Only privileged users may download backups. 208 if ( ! current_user_can('manage_options')) {273 if (!current_user_can('manage_options')) { 209 274 status_header(403); 210 275 wp_die(__('Insufficient permissions.', 'FRocket_admin')); … … 215 280 // Raw input (no HTML decoding) then minimal normalization 216 281 $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); 219 283 220 284 // Basic presence 221 if ( ! is_string($flm_file) || $flm_file === '') {285 if (!is_string($flm_file) || $flm_file === '') { 222 286 status_header(400); 223 287 wp_die(__('Invalid file requested.', 'FRocket_admin')); … … 226 290 // Must be a basename only (no slashes/backslashes) 227 291 $norm = str_replace('\\', '/', $flm_file); 228 if ( strpos($norm, '/') !== false || basename($norm) !== $norm) {292 if (strpos($norm, '/') !== false || basename($norm) !== $norm) { 229 293 status_header(400); 230 294 wp_die(__('Invalid file requested.', 'FRocket_admin')); … … 243 307 244 308 // 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)) { 246 310 status_header(400); 247 311 wp_die(__('Invalid file requested.', 'FRocket_admin')); 248 312 } 249 313 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)) { 253 316 status_header(400); 254 317 wp_die(__('Invalid file name.', 'FRocket_admin')); … … 258 321 $allowed_exts = apply_filters('flmbkp_allowed_download_exts', array('zip')); 259 322 $ext = strtolower(pathinfo($flm_file, PATHINFO_EXTENSION)); 260 if ( ! in_array($ext, $allowed_exts, true)) {323 if (!in_array($ext, $allowed_exts, true)) { 261 324 status_header(400); 262 325 wp_die(__('Invalid file type.', 'FRocket_admin')); … … 264 327 265 328 // Resolve paths safely 266 $backup_directory = Flmbkp_Form_Helper::backup_directory();329 $backup_directory = $this->get_backup_directory(); 267 330 $backup_directory_real = realpath($backup_directory); 268 331 269 if ( ! $backup_directory_real || ! is_dir($backup_directory_real)) {332 if (!$backup_directory_real || !is_dir($backup_directory_real)) { 270 333 status_header(500); 271 334 wp_die(__('Backup directory unavailable.', 'FRocket_admin')); … … 277 340 278 341 // 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) { 280 343 status_header(400); 281 344 wp_die(__('Invalid path.', 'FRocket_admin')); 282 345 } 283 346 284 if ( ! is_file($fullpath) || ! is_readable($fullpath)) {347 if (!is_file($fullpath) || !is_readable($fullpath)) { 285 348 status_header(404); 286 349 wp_die(__('File not found.', 'FRocket_admin')); … … 299 362 300 363 readfile($fullpath); 301 exit; // prevent any extra output from corrupting the file364 exit; 302 365 } 303 366 … … 362 425 } 363 426 364 365 $data=array(); 366 $data['bkp_slug']='flmbkp_'.date("YmdHis"); 427 $data = array(); 428 $data['bkp_slug'] = 'flmbkp_' . date("YmdHis"); 367 429 $this->wpdb->insert($this->model_backup->table, $data); 368 430 $idActivate = $this->wpdb->insert_id; 369 $json=array(); 431 432 $json = array(); 370 433 $json['status'] = 'created'; 371 434 $json['id'] = $idActivate; 372 435 $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; 376 439 377 440 header('Content-Type: application/json'); … … 393 456 switch (strval($tmp_nexstep)) { 394 457 case 'plugins': 395 //assigning targets 396 $tmp_targets=array(ABSPATH.'/wp-content/plugins'); 397 458 $tmp_targets = array(ABSPATH . '/wp-content/plugins'); 398 459 $this->ajax_submit_options($tmp_targets, $tmp_nexstep); 399 460 break; 400 461 case 'themes': 401 //assigning targets 402 $tmp_targets=array(ABSPATH.'/wp-content/themes'); 403 462 $tmp_targets = array(ABSPATH . '/wp-content/themes'); 404 463 $this->ajax_submit_options($tmp_targets, $tmp_nexstep); 405 464 break; 406 465 case 'uploads': 407 $tmp_targets=array(ABSPATH.'/wp-content/uploads'); 408 466 $tmp_targets = array(ABSPATH . '/wp-content/uploads'); 409 467 $this->ajax_submit_options($tmp_targets, $tmp_nexstep); 410 468 break; 411 469 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')); 415 473 $this->ajax_submit_options($tmp_targets, $tmp_nexstep); 416 474 break; … … 420 478 default: 421 479 die('something happened'); 422 break;423 480 } 424 481 } … … 428 485 429 486 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); 437 493 if (mysqli_connect_errno()) { 438 // echo "Failed to connect to MySQL: " . mysqli_connect_error();494 // connection error ignored 439 495 } 440 496 441 497 $str = mysqli_get_server_info($con); 442 } else {498 } else { 443 499 $str = mysql_get_server_info(); 444 500 } … … 452 508 public function ajax_submit_backupdb() 453 509 { 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"); 455 511 $this->is_initial_run = !empty($_POST['is_initial_run']); 456 512 require_once FLMBKP_DIR . '/modules/filemanager/helpers/iprogress.php'; 457 513 458 $backup_directory = Flmbkp_Form_Helper::backup_directory();514 $backup_directory = $this->get_backup_directory(); 459 515 460 516 $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'); 462 518 $this->progress->setData('oFile', $this->oFile); 463 519 … … 484 540 foreach ($tables as $key => $table) { 485 541 $table_dump = $this->dumpTable($table); 486 487 542 if (!($table_dump)) { 488 543 return false; … … 492 547 } 493 548 494 495 $fname = $backup_directory; 496 $fname .= '/'.$tmp_flmbkp_slug .'_database'; 497 $fname .= '.sql'; 549 $fname = $backup_directory . '/' . $tmp_flmbkp_slug . '_database.sql'; 498 550 if (!($f = fopen($fname, 'w'))) { 499 551 return false; … … 503 555 504 556 $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 } 506 561 $this->zip_obj->addFile($fname, basename($fname)); 507 562 $this->zip_obj->close(); 508 563 509 564 //delete sql file 510 unlink($fname);565 @unlink($fname); 511 566 512 567 $json = array( 513 568 'error' => false, 514 569 'continue' => false, 515 'fileURL' => '',516 'next_task' =>'',517 'is_finished' =>true570 'fileURL' => '', // no public URL exposure 571 'next_task' => '', 572 'is_finished' => true 518 573 ); 519 574 … … 531 586 foreach ($result as $mytable) { 532 587 foreach ($mytable as $t) { 533 $value[] = $t;588 $value[] = $t; 534 589 } 535 590 } … … 544 599 public function dumpTable($table) 545 600 { 546 547 // $dump = '';548 601 $this->wpdb->query('LOCK TABLES ' . $table . ' WRITE'); 549 602 550 // $tables = $this->wpdb->get_col('SHOW TABLES');551 603 $output = ''; 552 //foreach($tables as $table) {553 604 $result = $this->wpdb->get_results("SELECT * FROM {$table}", ARRAY_N); 554 605 … … 557 608 $output .= '-- --------------------------------------------------;' . NL; 558 609 $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"; 561 612 for ($i = 0; $i < count($result); $i++) { 562 613 $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++) { 565 616 $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)) { 568 619 $output .= ','; 569 620 } … … 572 623 } 573 624 $output .= "\n"; 574 //}575 625 576 626 $this->wpdb->query('UNLOCK TABLES'); 577 627 return $output; 578 628 } 629 579 630 /** 580 631 * receiving header options … … 584 635 public function ajax_submit_options($tmp_targets, $tmp_nexstep) 585 636 { 586 587 637 try { 588 638 $is_initial_run = (isset($_POST['is_initial_run'])) ? Flmbkp_Form_Helper::sanitizeInput($_POST['is_initial_run']) : 0; 589 639 $flush_to_disk = (isset($_POST['flush_to_disk'])) ? Flmbkp_Form_Helper::sanitizeInput($_POST['flush_to_disk']) : 50; 590 640 $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"); 592 642 593 643 $this->startTime = microtime(true); 594 644 595 //language596 if (isset($data['flpbkp_opt_files']) && intval($data['flpbkp_opt_files']) === 1) {597 // $this->generate_zip_files();598 }599 600 645 require_once FLMBKP_DIR . '/modules/filemanager/helpers/iprogress.php'; 601 646 … … 605 650 606 651 $this->is_initial_run = !empty($is_initial_run); 607 $flush_to_disk = !empty($flush_to_disk) ? (int) $flush_to_disk : 50; 652 608 653 $this->max_execution_time = !empty($max_execution_time) ? (int) $max_execution_time : 20; 609 654 $exclude_string = array(); 610 655 $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 616 656 617 657 $targets = ($this->is_initial_run && !empty($tmp_targets)) ? $tmp_targets : $this->progress->getData('targets'); … … 628 668 $this->progress->addMsg('Scanning files to be compressed...'); 629 669 $this->progress->setData('targets', $targets); 670 $this->progress->setData('abort', 0); 630 671 } 631 672 … … 656 697 } 657 698 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'); 663 702 664 703 $this->progress->setData('oFile', $this->oFile); 665 704 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. 667 706 668 707 $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 } 670 712 671 713 $this->iteration_number = 0; … … 700 742 } 701 743 702 703 744 $this->progress->iterateWith(1); 704 745 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 707 747 } 708 748 } … … 714 754 $this->zip_obj->close(); 715 755 716 $file_url = FLMBKP_URL . '/' . basename($this->oFile);756 // Don't expose public URLs; downloads must go through ajax_downloadfile 717 757 $json = array( 718 758 'error' => false, 719 759 'continue' => false, 720 'fileURL' => $file_url,721 'is_finished' =>false760 'fileURL' => '', // keep empty to avoid direct access attempts 761 'is_finished' => false 722 762 ); 723 763 … … 729 769 'error' => true, 730 770 'continue' => false, 731 'error_msg' =>$exception->getMessage(),732 'is_finished' =>false771 'error_msg' => $exception->getMessage(), 772 'is_finished' => false 733 773 ); 734 774 … … 751 791 } 752 792 753 $acceptedfiles =array();793 $acceptedfiles = array(); 754 794 $entries = scandir($dir); 755 //reads the filenames, one by one756 795 foreach ($entries as $file) { 757 796 if ($file == '.' || $file == '..') { … … 759 798 } 760 799 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 } 771 810 return $acceptedfiles; 772 811 } 773 /** 774 * backup process 812 813 /** 814 * backup process progress 775 815 * 776 816 * @mvc Controller … … 793 833 echo json_encode($json); 794 834 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)); 795 877 } 796 878 … … 842 924 public function flush_zip() 843 925 { 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 } 850 944 851 945 public function zip_dir($path, $base = '') 852 946 { 853 854 947 $progress = $this->progress; 855 856 948 857 949 $entries = scandir($path); … … 890 982 891 983 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 point984 $this->flush_zip(); //Write to disk every 50 files 893 985 } 894 986 } … … 899 991 public function stop_iteration() 900 992 { 901 //$zip=$this->zip_obj; 902 $this->zip_obj->close(); 993 if ($this->zip_obj instanceof ZipArchive) { 994 $this->zip_obj->close(); 995 } 903 996 904 997 $json = array( … … 912 1005 private function is_excluded($path) 913 1006 { 914 $excludes = $this->excludes;1007 $excludes = $this->excludes; 915 1008 916 1009 if (!empty($excludes)) { … … 927 1020 public function build_exclude_find_params() 928 1021 { 929 $excludes = $this->excludes;1022 $excludes = $this->excludes; 930 1023 $params = ''; 931 1024 … … 940 1033 public function count_dir_files($path) 941 1034 { 942 //global $use_system_calls; 943 944 $use_system_calls=false; 1035 $use_system_calls = false; 945 1036 946 1037 $path = rtrim($path, '/'); … … 976 1067 public function abort_if_requested() 977 1068 { 978 979 1069 $progress = $this->progress; 980 1070 $last_abort_check = $this->last_abort_check; … … 988 1078 989 1079 /** 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 /** 990 1120 * Register callbacks for actions and filters 991 1121 * … … 1005 1135 1006 1136 try { 1007 //$instance_example = new WPPS_Instance_Class( 'Instance example', '42' ); 1008 //add_notice('ba'); 1137 // initialization 1009 1138 } catch (Exception $exception) { 1010 1139 add_notice(__METHOD__ . ' error: ' . $exception->getMessage(), 'error'); … … 1025 1154 public function activate($network_wide) 1026 1155 { 1027 1028 1156 return true; 1029 1157 } -
softdiscover-db-file-manager/trunk/modules/filemanager/helpers/iprogress.php
r3027919 r3369101 13 13 private $progress_file = ''; 14 14 private $state = array(); 15 private $fp ;15 private $fp = null; 16 16 private $data = array(); 17 17 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 18 121 public function __construct($task = 'isense', $messageHistoryCount = 20) 19 122 { 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 35 173 public function __destruct() 36 174 { 37 fclose($this->fp); 175 if (is_resource($this->fp)) { 176 @fclose($this->fp); 177 } 38 178 } 39 179 … … 44 184 $this->saveState(); 45 185 } 186 46 187 public function abortCalled() 47 188 { 48 189 $this->sync(); 49 return $this->abortCalled;190 return (bool)$this->abortCalled; 50 191 } 51 192 … … 53 194 { 54 195 $this->sync(); 55 $this->max_value = $max; 56 $this->saveState(); 57 } 196 $this->max_value = (int)$max; 197 $this->saveState(); 198 } 199 58 200 public function getMax() 59 201 { 60 202 $this->sync(); 61 return $this->max_value;203 return (int)$this->max_value; 62 204 } 63 205 … … 65 207 { 66 208 $this->sync(); 67 $this->current_value = $progress; 68 $this->saveState(); 69 } 209 $this->current_value = (int)$progress; 210 $this->saveState(); 211 } 212 70 213 public function getProgress($sync = true) 71 214 { 72 215 if ($sync) { 73 216 $this->sync(); 74 } return $this->current_value; 75 } 76 217 } 218 return (int)$this->current_value; 219 } 220 77 221 public function setData($key, $value) 78 222 { … … 81 225 $this->saveState(); 82 226 } 227 83 228 public function getData($key) 84 229 { … … 90 235 { 91 236 $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; 96 242 $this->last_message = $msg; 243 97 244 if ($this->countMessages() > $this->message_history_count) { 98 245 $this->truncMessages(); 99 246 } 100 $this->saveState(); 101 } 247 248 $this->saveState(); 249 } 250 102 251 public function getMessages() 103 252 { … … 105 254 return $this->messages; 106 255 } 256 107 257 public function getLastMessage() 108 258 { … … 114 264 { 115 265 $this->sync(); 116 $this->current_value += $value; 117 $this->saveState(); 118 } 266 $this->current_value += (int)$value; 267 $this->saveState(); 268 } 269 119 270 public function getProgressPercent() 120 271 { 121 272 $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); 123 279 } 124 280 … … 137 293 { 138 294 $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 } 139 307 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--; 150 311 if ($message_overflow <= 0) { 151 312 break 2; 152 313 } 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 } 157 318 } 158 319 } … … 160 321 private function saveState() 161 322 { 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 169 331 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 179 341 private function loadState() 180 342 { 181 343 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(); 188 351 } else { 189 352 $this->state = array(); 190 353 } 354 @flock($this->fp, LOCK_UN); 191 355 } else { 192 356 $this->state = array(); … … 197 361 { 198 362 $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']; 207 372 } 208 373 } -
softdiscover-db-file-manager/trunk/modules/filemanager/models/backup.php
r3027919 r3369101 11 11 * @copyright 2015 Softdiscover 12 12 * @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/ 14 14 */ 15 15 if (!defined('ABSPATH')) { … … 29 29 * @license http://www.php.net/license/3_01.txt PHP License 3.01 30 30 * @version Release: 1.00 31 * @link https:// wordpress-form-builder.zigaform.com/31 * @link https://softdiscover.com/ 32 32 */ 33 33 class flmbkp_Model_Backup -
softdiscover-db-file-manager/trunk/modules/filemanager/views/backup/list_backups.php
r3037022 r3369101 10 10 * @copyright 2015 Softdiscover 11 11 * @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/ 13 13 */ 14 14 if (!defined('ABSPATH')) { … … 28 28 </h5> 29 29 30 </div> 30 </div> 31 31 <div class="widget-body"> 32 32 33 33 <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" 39 39 id="flmbkp_backup_form"> 40 40 <div class="alert alert-info" role="alert"> … … 42 42 <div class=""> 43 43 <div class="row"> 44 44 45 45 <div class="col-sm-4"> 46 <fieldset class="col-md-12"> 46 <fieldset class="col-md-12"> 47 47 <legend><?php echo __('Files', 'FRocket_admin'); ?></legend> 48 48 … … 55 55 <div class="alert alert-secondary" role="alert"> 56 56 <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> 58 58 <label class="form-check-label" for="defaultCheck1"> 59 59 <?php echo __('Plugins', 'FRocket_admin'); ?> … … 61 61 </div> 62 62 <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> 64 64 <label class="form-check-label" for="defaultCheck2"> 65 65 <?php echo __('Themes', 'FRocket_admin'); ?> … … 67 67 </div> 68 68 <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="defaultCheck 2">69 <input name="flpbkp_opt_uploads" class="" type="checkbox" value="uploads" id="defaultCheck3" checked> 70 <label class="form-check-label" for="defaultCheck3"> 71 71 <?php echo __('Uploads', 'FRocket_admin'); ?> 72 72 </label> 73 73 </div> 74 74 <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="defaultCheck 2">75 <input name="flpbkp_opt_others" class="" type="checkbox" value="others" id="defaultCheck4" checked> 76 <label class="form-check-label" for="defaultCheck4"> 77 77 <?php echo __('Any other directories found inside wp-content', 'FRocket_admin'); ?> 78 78 </label> … … 85 85 </fieldset> 86 86 </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"> 90 90 <legend><?php echo __('Database', 'FRocket_admin'); ?></legend> 91 91 … … 94 94 <p> 95 95 <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'); ?> 97 97 </label> 98 98 <div class="alert alert-secondary" role="alert"> … … 105 105 </fieldset> 106 106 107 108 107 </div> 109 108 <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> 111 115 </div> 112 116 </div> … … 114 118 115 119 </div> 116 </form> 120 </form> 117 121 </div> 118 122 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> 121 129 <button type="button" class="close" data-dismiss="alert" aria-label="Close"> 122 130 <span aria-hidden="true">×</span> … … 164 172 165 173 </div> 166 174 167 175 <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 170 178 <div class="alert alert-secondary" role="alert"> 171 179 … … 173 181 <table class="table table-striped table-bordered dataTable" id="users"> 174 182 <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> 181 189 </thead> 182 190 <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) : ?> 240 193 <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> 243 247 </td> 244 248 </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 } ?> 246 257 </tbody> 247 258 </table> … … 250 261 </div> 251 262 252 253 263 <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> 257 268 </div> 258 269 </div> -
softdiscover-db-file-manager/trunk/modules/filemanager/views/backup/restore_message.php
r3027919 r3369101 10 10 * @copyright 2015 Softdiscover 11 11 * @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/ 13 13 */ 14 14 if (!defined('ABSPATH')) { -
softdiscover-db-file-manager/trunk/modules/optbuilder/controllers/fields.php
r3027919 r3369101 10 10 * @copyright 2015 Softdiscover 11 11 * @license http://www.php.net/license/3_01.txt PHP License 3.01 12 * @link http ://wordpress-cost-estimator.zigaform.com12 * @link https://softdiscover.com 13 13 */ 14 14 if (!defined('ABSPATH')) { … … 28 28 * @license http://www.php.net/license/3_01.txt PHP License 3.01 29 29 * @version Release: 1.00 30 * @link http ://wordpress-cost-estimator.zigaform.com30 * @link https://softdiscover.com 31 31 */ 32 32 class Zgpb_Optb_Controller_Fields extends Flmbkp_Base_Module -
softdiscover-db-file-manager/trunk/modules/settings/controllers/backend.php
r3027919 r3369101 11 11 * @copyright 2015 Softdiscover 12 12 * @license http://www.php.net/license/3_01.txt PHP License 3.01 13 * @link http ://wordpress-cost-estimator.zigaform.com13 * @link https://softdiscover.com 14 14 */ 15 15 if (!defined('ABSPATH')) { … … 29 29 * @license http://www.php.net/license/3_01.txt PHP License 3.01 30 30 * @version Release: 1.00 31 * @link http ://wordpress-cost-estimator.zigaform.com31 * @link https://softdiscover.com 32 32 */ 33 33 class flmbkp_settings_Controller_Back extends Flmbkp_Base_Module -
softdiscover-db-file-manager/trunk/modules/settings/views/backend/list_options.php
r3027919 r3369101 10 10 * @copyright 2015 Softdiscover 11 11 * @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/ 13 13 */ 14 14 if (!defined('ABSPATH')) {
Note: See TracChangeset
for help on using the changeset viewer.