/var/www/(Del)hsihk.com/wp-content/plugins/backupbuddy/controllers/pages/settings.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<style type="text/css">
#backupbuddy-meta-link-wrap a.show-settings {
    float: right;
    margin: 0 0 0 6px;
}
#screen-meta-links #backupbuddy-meta-link-wrap a {
    background: none;
}
#screen-meta-links #backupbuddy-meta-link-wrap a:after {
    content: '';
    margin-right: 5px;
}
</style>
<script type="text/javascript">
    jQuery(document).ready( function() {
        jQuery('#screen-meta-links').append(
            '<div id="backupbuddy-meta-link-wrap" class="hide-if-no-js screen-meta-toggle">' +
                '<a href="" class="show-settings pb_backupbuddy_begintour"><?php _e"Tour Page""it-l10n-backupbuddy" ); ?></a>' +
            '</div>'
        );
        
        
        jQuery( '.nav-tab-2' ).click( function(){
            jQuery.post( '<?php echo pb_backupbuddy::ajax_url'getMainLog' ); ?>', { }, 
                function(data) {
                    //data = jQuery.trim( data );
                    jQuery( '#backupbuddy_logFile' ).text( data );
                }
            );
        });
        
        <?php if ( '2' == pb_backupbuddy::_GET'tab' ) ) { ?>
        jQuery( '.nav-tab-2' ).trigger( 'click' );
        <?php ?>
        
    }); // end on ready.
    
</script>
<?php
// Tutorial
pb_backupbuddy::load_script'jquery.joyride-2.0.3.js' );
pb_backupbuddy::load_script'modernizr.mq.js' );
pb_backupbuddy::load_style'joyride.css' );
?>
<ol id="pb_backupbuddy_tour" style="display: none;">
    <li data-id="ui-id-1">These settings are your defaults for all backups. Profiles may be used to override many settings to customize various backups to your needs.</li>
    <li data-id="ui-id-2">Use profiles to customize various settings on a case-by-case basis and override default backup settings.</li>
    <li data-id="ui-id-3">Customize advanced options or troubleshoot issues by overriding functionality or changing default operation.</li>
    <li data-class="jQueryOuterTree">Database tables may be omitted from backups by hovering over a table in the list and clicking the (-) minus symbol.</li>
    <li data-id="exlude_dirs" data-button="Finish">Directories & files may be omitted from backups by hovering over an item in the list and clicking the (-) minus symbol.</li>
</ol>
<script>
jQuery(window).load(function() {
    jQuery(document).on( 'click', '.pb_backupbuddy_begintour', function(e) {
        jQuery("#pb_backupbuddy_tour").joyride({
            tipLocation: 'top',
        });
        return false;
    });
});
</script>

<?php
pb_backupbuddy
::$ui->title__'Settings''it-l10n-backupbuddy' ) );
backupbuddy_core::versions_confirm();

pb_backupbuddy::disalert'profile_suggest''<span class="pb_label" style="font-size: 12px; margin-left: 10px; position: relative;">Tip</span> &nbsp; You can create & customize multiple different backup types with profiles on the <a href="?page=pb_backupbuddy_backup">Backups</a> page by selecting the gear icon next to each profile.' );

$data = array(); // To pass to view.



// Reset settings to defaults.
if ( pb_backupbuddy::_POST'reset_defaults' ) != '' ) {
    if ( 
call_user_func(  'pb_backupbuddy::reset_options'true ) === true ) {
        
backupbuddy_core::verify_directories$skipTempGeneration true ); // Re-verify directories such as backup dir, temp, etc.
        //pb_backupbuddy::alert( 'Plugin settings have been reset to defaults.' );
    
} else {
        
pb_backupbuddy::alert'Unable to reset plugin settings. Verify you are running the latest version.' );
    }
}



/* BEGIN VERIFYING BACKUP DIRECTORY */
if ( isset( $_POST['pb_backupbuddy_backup_directory'] ) ) {
    
$backup_directory pb_backupbuddy::_POST'pb_backupbuddy_backup_directory' );
    if ( 
'' == $backup_directory ) { // blank so set to default.
        
$backup_directory backupbuddy_core::_getBackupDirectoryDefault();
    }
    
$backup_directory str_replace'\\''/'$backup_directory );
    
$backup_directory rtrim$backup_directory'/\\' ) . '/'// Enforce single trailing slash.
    
    
if ( ! is_dir$backup_directory ) ) {
        if ( 
false === @mkdir$backup_directory0755 ) ) {
            
pb_backupbuddy::alert'Error #4838594589: Selected backup directory does not exist and it could not be created. Verify the path is correct or manually create the directory and set proper permissions. Reset to default path.' );
            
$_POST['pb_backupbuddy_backup_directory'] = backupbuddy_core::getBackupDirectory(); // Set back to previous value (aka unchanged).
        
}
    }
    
    if ( 
backupbuddy_core::getBackupDirectory() != $backup_directory ) { // Directory differs. Needs updated in post var. Give messages here as this value is going to end up being saved.
        
pb_backupbuddy::anti_directory_browsing$backup_directory );
        
        
$old_backup_dir backupbuddy_core::getBackupDirectory();
        
$new_backup_dir $backup_directory;
        
        
// Move all files from old backup to new.
        
$old_backups_moved 0;
        
$old_backups glob$old_backup_dir 'backup*.zip' );
        if ( !
is_array$old_backups ) || empty( $old_backups ) ) { // On failure glob() returns false or an empty array depending on server settings so normalize here.
            
$old_backups = array();
        }
        foreach( 
$old_backups as $old_backup ) {
            if ( 
false === rename$old_backup$new_backup_dir basename$old_backup ) ) ) {
                
pb_backupbuddy::alert'ERROR: Unable to move backup "' basename$old_backup ) . '" to new storage directory. Manually move it or delete it for security and to prevent it from being backed up within backups.' );
            } else { 
// rename success.
                
$old_backups_moved++;
                
$serial backupbuddy_core::get_serial_from_filebasename$old_backup ) );
                
                require_once( 
pb_backupbuddy::plugin_path() . '/classes/fileoptions.php' );
                
$fileoptions_files globbackupbuddy_core::getLogDirectory() . 'fileoptions/*.txt' );
                if ( ! 
is_array$fileoptions_files ) ) {
                    
$fileoptions_files = array();
                }
                foreach( 
$fileoptions_files as $fileoptions_file ) {
                    
pb_backupbuddy::status'details''Fileoptions instance #21.' );
                    
$backup_options = new pb_backupbuddy_fileoptions$fileoptions_file );
                    if ( 
true !== ( $result $backup_options->is_ok() ) ) {
                        
pb_backupbuddy::status'error'__('Unable to access fileoptions data.''it-l10n-backupbuddy' ) . ' Error: ' $result );
                        continue;
                    }
                    
                    if ( isset( 
$backup_options->options$serial ] ) ) {
                        if ( isset( 
$backup_options->options['archive_file'] ) ) {
                            
$backup_options->options['archive_file'] = str_replace$old_backup_dir$new_backup_dir$backup_options->options['archive_file'] );
                        }
                    }
                    
$backup_options->save();
                    unset( 
$backup_options );
                }
                
            }
        }
        
        if ( 
'' == pb_backupbuddy::_POST'pb_backupbuddy_backup_directory' ) ) { // Blank default.
            
$_POST['pb_backupbuddy_backup_directory'] = '';
        } else {
            
$_POST['pb_backupbuddy_backup_directory'] = $backup_directory;
        }
        
pb_backupbuddy::alert'Your backup storage directory has been updated from "' $old_backup_dir '" to "' $new_backup_dir '". ' $old_backups_moved ' backup(s) have been moved to the new location. You should perform a manual backup to verify that your backup storage directory changes perform as expected.' );
    }
}
/* END VERIFYING BACKUP DIRECTORY */



/* BEGIN DISALLOWING DEFAULT IMPORT/REPAIR PASSWORD */
if ( strtolowerpb_backupbuddy::_POST'pb_backupbuddy_importbuddy_pass_hash' ) ) == 'myp@ssw0rd' ) {
    
pb_backupbuddy::alert'Warning: The example password is not allowed for security reasons for ImportBuddy. Please choose another password.' );
    
$_POST['pb_backupbuddy_importbuddy_pass_hash'] = '';
}
/* END DISALLOWING DEFAULT IMPORT/REPAIR PASSWORD */



/* BEGIN VERIFYING PASSWORD CONFIRMATIONS MATCH */
$importbuddy_pass_match_fail false;
if ( 
pb_backupbuddy::_POST'pb_backupbuddy_importbuddy_pass_hash' ) != pb_backupbuddy::_POST'pb_backupbuddy_importbuddy_pass_hash_confirm' ) ) {
    
pb_backupbuddy::alert'Error: The provided ImportBuddy password and confirmation do not match. Please make sure you type the password and re-type it correctly.' );
    
$_POST['pb_backupbuddy_importbuddy_pass_hash'] = '';
    
$_POST['pb_backupbuddy_importbuddy_pass_hash_confirm'] = '';
    
$importbuddy_pass_match_fail true;
}
/* END VERIFYING PASSWORD CONFIRMATIONS MATCH */



/* BEGIN REPLACING IMPORTBUDDY/REPAIRBUDDY_PASS_HASH WITH VALUE OF ACTUAL HASH */
if ( isset( $_POST['pb_backupbuddy_importbuddy_pass_hash'] ) && ( '' == $_POST['pb_backupbuddy_importbuddy_pass_hash'] ) ) { // Clear out length if setting to blank.
    
pb_backupbuddy::$options['importbuddy_pass_length'] = 0;
}
if ( ( 
str_replace')'''pb_backupbuddy::_POST'pb_backupbuddy_importbuddy_pass_hash' ) ) != '' ) && ( md5pb_backupbuddy::_POST'pb_backupbuddy_importbuddy_pass_hash' ) ) != pb_backupbuddy::$options['importbuddy_pass_hash'] ) ) {
    
pb_backupbuddy::$options['importbuddy_pass_length'] = strlenpb_backupbuddy::_POST'pb_backupbuddy_importbuddy_pass_hash' ) );
    
$_POST['pb_backupbuddy_importbuddy_pass_hash'] = md5pb_backupbuddy::_POST'pb_backupbuddy_importbuddy_pass_hash' ) );
    
$_POST['pb_backupbuddy_importbuddy_pass_hash_confirm'] = '';
} else { 
// Keep the same.
    
if ( $importbuddy_pass_match_fail !== true ) { // keep the same
        
$_POST['pb_backupbuddy_importbuddy_pass_hash'] = pb_backupbuddy::$options['importbuddy_pass_hash'];
        
$_POST['pb_backupbuddy_importbuddy_pass_hash_confirm'] = '';
    }
}
// Set importbuddy dummy text to display in form box. Equal length to the provided password.
$data['importbuddy_pass_dummy_text'] = str_pad''pb_backupbuddy::$options['importbuddy_pass_length'], ')' );




/* BEGIN SAVE MULTISITE SPECIFIC SETTINGS IN SET OPTIONS SO THEY ARE AVAILABLE GLOBALLY */
if ( is_multisite() ) {
    
// Save multisite export option to the global site/network options for global retrieval.
    
$options get_site_option'pb_' pb_backupbuddy::settings'slug' ) );
    
$options'multisite_export' ] = pb_backupbuddy::_POST'pb_backupbuddy_multisite_export' );
    
update_site_option'pb_' pb_backupbuddy::settings'slug' ), $options );
    unset( 
$options );
}
/* END SAVE MULTISITE SPECIFIC SETTINGS IN SET OPTIONS SO THEY ARE AVAILABLE GLOBALLY */



// Load settings view.
pb_backupbuddy::load_view'settings'$data );



?>
<br style="clear: both;">
<br><br>
<br><br>
</div>