humanmade /
backupwordpress
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | var BackUpWordPressAdmin = (function($){ |
||
| 2 | 'use strict'; |
||
| 3 | |||
| 4 | var recurrenceType; |
||
| 5 | |||
| 6 | function init(){ |
||
| 7 | |||
| 8 | recurrenceType = $( 'select#hmbkp_schedule_recurrence_type' ); |
||
| 9 | // Don't ever cache ajax requests |
||
| 10 | $.ajaxSetup( {'cache': false} ); |
||
| 11 | |||
| 12 | if ( recurrenceType.length ) { |
||
| 13 | |||
| 14 | hmbkpToggleScheduleFields( recurrenceType.val() ); |
||
| 15 | |||
| 16 | $( document ).on( 'change', 'select#hmbkp_schedule_recurrence_type', function () { |
||
| 17 | hmbkpToggleScheduleFields( $( this ).val() ); |
||
| 18 | } ); |
||
| 19 | |||
| 20 | } |
||
| 21 | |||
| 22 | $('.notice.is-dismissible').on('click', '.notice-dismiss', function(){ |
||
| 23 | $.post( |
||
| 24 | ajaxurl, |
||
| 25 | { |
||
| 26 | 'action': 'hmbkp_dismiss_notice' |
||
| 27 | } |
||
| 28 | ); |
||
| 29 | }); |
||
| 30 | |||
| 31 | // Show delete confirm message for delete schedule |
||
| 32 | $( document ).on( 'click', '.hmbkp-schedule-actions .delete-action', function ( e ) { |
||
| 33 | |||
| 34 | if ( ! confirm( hmbkp.delete_schedule ) ) { |
||
| 35 | e.preventDefault(); |
||
| 36 | } |
||
| 37 | |||
| 38 | } ); |
||
| 39 | |||
| 40 | // Show delete confirm message for delete backup |
||
| 41 | $( document ).on( 'click', '.hmbkp_manage_backups_row .delete-action', function ( e ) { |
||
| 42 | |||
| 43 | if ( ! confirm( hmbkp.delete_backup ) ) { |
||
| 44 | e.preventDefault(); |
||
| 45 | } |
||
| 46 | |||
| 47 | } ); |
||
| 48 | |||
| 49 | // Show delete confirm message for remove exclude rule |
||
| 50 | $( document ).on( 'click', '.hmbkp-edit-schedule-excludes-form .delete-action', function ( e ) { |
||
| 51 | |||
| 52 | if ( ! confirm( hmbkp.remove_exclude_rule ) ) { |
||
| 53 | e.preventDefault(); |
||
| 54 | } |
||
| 55 | |||
| 56 | } ); |
||
| 57 | |||
| 58 | // Test the cron response using ajax |
||
| 59 | $.post( ajaxurl, {'nonce': hmbkp.nonce, 'action': 'hmbkp_cron_test'}, |
||
| 60 | function ( data ) { |
||
| 61 | if ( data !== '1' ) { |
||
| 62 | $( '.wrap > h2' ).after( data ); |
||
| 63 | } |
||
| 64 | } |
||
| 65 | ); |
||
| 66 | |||
| 67 | // Run a backup |
||
| 68 | $( document ).on( 'click', '.hmbkp-run', function ( e ) { |
||
| 69 | wp.heartbeat.interval( 'fast' ); |
||
| 70 | $( this ).closest( '.hmbkp-schedule-sentence' ).addClass( 'hmbkp-running' ); |
||
| 71 | |||
| 72 | $( '.hmbkp-error' ).removeClass( 'hmbkp-error' ); |
||
| 73 | |||
| 74 | var scheduleId = $( '[data-hmbkp-schedule-id]' ).attr( 'data-hmbkp-schedule-id' ); |
||
| 75 | |||
| 76 | $.post( |
||
| 77 | ajaxurl, |
||
| 78 | { |
||
| 79 | 'hmbkp_run_schedule_nonce': hmbkp.hmbkp_run_schedule_nonce, |
||
| 80 | 'action': 'hmbkp_run_schedule', |
||
| 81 | 'hmbkp_schedule_id': scheduleId |
||
| 82 | } |
||
| 83 | ); |
||
| 84 | |||
| 85 | e.preventDefault(); |
||
| 86 | |||
| 87 | } ); |
||
| 88 | |||
| 89 | // Send the schedule id with the heartbeat |
||
| 90 | $( document ).on( 'heartbeat-send', function ( e, data ) { |
||
| 91 | |||
| 92 | data.hmbkp_schedule_id = $( '[data-hmbkp-schedule-id]' ).attr( 'data-hmbkp-schedule-id' ); |
||
| 93 | |||
| 94 | if ( $( '.hmbkp-schedule-sentence.hmbkp-running' ).length ) { |
||
| 95 | data.hmbkp_is_in_progress = true; |
||
| 96 | } else { |
||
| 97 | data.hmbkp_client_request = 'site_size'; |
||
| 98 | } |
||
| 99 | |||
| 100 | } ); |
||
| 101 | |||
| 102 | // Update schedule status on heartbeat tick |
||
| 103 | $( document ).on( 'heartbeat-tick', function ( e, data ) { |
||
| 104 | |||
| 105 | // If the schedule has finished then reload the page |
||
| 106 | if ( data.hmbkp_schedule_status === 0 && ! $( '.hmbkp-error' ).length ) { |
||
| 107 | location.reload( true ); |
||
| 108 | } |
||
| 109 | |||
| 110 | // If the schedule is still running then update the schedule status |
||
| 111 | if ( ( data.hmbkp_schedule_status !== 0 ) && ( data.hmbkp_schedule_status !== undefined ) ) { |
||
| 112 | $( '.hmbkp-status' ).replaceWith( data.hmbkp_schedule_status ); |
||
| 113 | } |
||
| 114 | |||
| 115 | if ( ( data.hmbkp_site_size !== undefined ) && ( $( 'code.calculating' ).length ) ) { |
||
| 116 | $( 'code.calculating' ).text( data.hmbkp_site_size ); |
||
| 117 | var excludes = $( '.hmbkp-exclude-settings' ); |
||
| 118 | if ( excludes.length ) { |
||
| 119 | excludes.replaceWith( data.hmbkp_dir_sizes ); |
||
| 120 | } |
||
| 121 | } |
||
| 122 | |||
| 123 | } ); |
||
| 124 | |||
| 125 | // Closing ThickBox Modal Window |
||
| 126 | $( document ).on( 'click', '.hmbkp-thickbox-close', function ( e ) { |
||
| 127 | |||
| 128 | e.preventDefault(); |
||
| 129 | window.parent.tb_remove(); |
||
| 130 | |||
| 131 | } ); |
||
| 132 | |||
| 133 | $( document ).on( 'click', '[id^="hmbkp-warning-"] .notice-dismiss', function(){ |
||
| 134 | $.post( |
||
| 135 | ajaxurl, |
||
| 136 | { |
||
| 137 | 'action': 'hmbkp_dismiss_error' |
||
| 138 | } |
||
| 139 | ); |
||
| 140 | } ); |
||
| 141 | |||
| 142 | jQuery( document ).one( 'click', '.hmbkp_send_error_via_email', function ( e ) { |
||
| 143 | |||
| 144 | e.preventDefault(); |
||
| 145 | |||
| 146 | jQuery( this ).addClass( 'hmbkp-ajax-loading' ).attr( 'disabled', 'disabled' ); |
||
| 147 | |||
| 148 | jQuery.post( |
||
| 149 | ajaxurl, |
||
| 150 | {'nonce': hmbkp.nonce, 'action': 'hmbkp_email_error', 'hmbkp_error': data}, |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 151 | function () { |
||
| 152 | //jQuery.colorbox.close(); |
||
| 153 | } |
||
| 154 | ); |
||
| 155 | |||
| 156 | } ); |
||
| 157 | } |
||
| 158 | |||
| 159 | function hmbkpToggleScheduleFields( recurrence ) { |
||
| 160 | |||
| 161 | recurrence = ( |
||
| 162 | typeof recurrence !== 'undefined' |
||
| 163 | ) ? recurrence : 'manually'; |
||
| 164 | |||
| 165 | var settingFields = jQuery( '.recurring-setting' ); |
||
| 166 | var scheduleSettingFields = jQuery( '#schedule-start' ); |
||
| 167 | var twiceDailyNote = jQuery( '.twice-js' ); |
||
| 168 | |||
| 169 | switch ( recurrence ) { |
||
| 170 | |||
| 171 | case 'manually': |
||
| 172 | settingFields.hide(); |
||
| 173 | break; |
||
| 174 | |||
| 175 | case 'hourly' : |
||
| 176 | settingFields.hide(); |
||
| 177 | break; |
||
| 178 | |||
| 179 | case 'daily' : |
||
| 180 | settingFields.hide(); |
||
| 181 | scheduleSettingFields.show(); |
||
| 182 | twiceDailyNote.hide(); |
||
| 183 | break; |
||
| 184 | |||
| 185 | case 'twicedaily' : |
||
| 186 | settingFields.hide(); |
||
| 187 | scheduleSettingFields.show(); |
||
| 188 | twiceDailyNote.show(); |
||
| 189 | break; |
||
| 190 | |||
| 191 | case 'weekly' : // fall through |
||
| 192 | case 'fortnightly' : |
||
| 193 | settingFields.hide(); |
||
| 194 | jQuery( '#start-day' ).show(); |
||
| 195 | scheduleSettingFields.show(); |
||
| 196 | twiceDailyNote.hide(); |
||
| 197 | break; |
||
| 198 | |||
| 199 | case 'monthly' : |
||
| 200 | settingFields.hide(); |
||
| 201 | scheduleSettingFields.show(); |
||
| 202 | jQuery( '#start-date' ).show(); |
||
| 203 | twiceDailyNote.hide(); |
||
| 204 | break; |
||
| 205 | |||
| 206 | } |
||
| 207 | |||
| 208 | } |
||
| 209 | |||
| 210 | return { |
||
| 211 | init: init |
||
| 212 | }; |
||
| 213 | |||
| 214 | })(jQuery); |
||
| 215 | |||
| 216 | jQuery( document ).ready(BackUpWordPressAdmin.init); |
||
| 217 |