PageRenderTime 60ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-content/plugins/backupbuddy/controllers/pages/settings.php

https://bitbucket.org/summitds/bloomsburgpa.org
PHP | 906 lines | 747 code | 118 blank | 41 comment | 81 complexity | 7769b54a661298b576f88a947474c0e6 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, BSD-3-Clause, GPL-3.0, LGPL-2.1

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. // TODO: move all output into the view.
  3. pb_backupbuddy::load_script( 'filetree.js' );
  4. pb_backupbuddy::load_style( 'filetree.css' );
  5. // Reset settings to defaults.
  6. if ( pb_backupbuddy::_POST( 'reset_defaults' ) != '' ) {
  7. if ( call_user_func( 'pb_backupbuddy::reset_options', true ) === true ) {
  8. pb_backupbuddy::$classes['core']->verify_directories(); // Re-verify directories such as backup dir, temp, etc.
  9. pb_backupbuddy::alert( 'Plugin settings have been reset to defaults.' );
  10. } else {
  11. pb_backupbuddy::alert( 'Unable to reset plugin settings. Verify you are running the latest version.' );
  12. }
  13. }
  14. ?>
  15. <style type="text/css">
  16. .pb_backupbuddy_customize_email_error_row, .pb_backupbuddy_customize_email_scheduled_start_row, .pb_backupbuddy_customize_email_scheduled_complete_row {
  17. display: none;
  18. }
  19. </style>
  20. <script type="text/javascript">
  21. jQuery(document).ready(function() {
  22. // Show options on hover.
  23. jQuery( '.jqueryFileTree > li a' ).live('mouseover mouseout', function(event) {
  24. if ( event.type == 'mouseover' ) {
  25. jQuery(this).children( '.pb_backupbuddy_treeselect_control' ).css( 'visibility', 'visible' );
  26. } else {
  27. jQuery(this).children( '.pb_backupbuddy_treeselect_control' ).css( 'visibility', 'hidden' );
  28. }
  29. });
  30. jQuery('#exlude_dirs').fileTree(
  31. {
  32. root: '/',
  33. multiFolder: false,
  34. script: '<?php echo pb_backupbuddy::ajax_url( 'exclude_tree' ); ?>'
  35. },
  36. function(file) {
  37. if ( ( file == 'wp-config.php' ) ) {
  38. alert( '<?php _e('You cannot exclude wp-config.php.', 'it-l10n-backupbuddy' );?>' );
  39. } else {
  40. jQuery('#pb_backupbuddy_excludes').val( file + "\n" + jQuery('#pb_backupbuddy_excludes').val() );
  41. }
  42. },
  43. function(directory) {
  44. if ( ( directory == '/wp-content/' ) || ( directory == '/wp-content/uploads/' ) || ( directory == '<?php echo pb_backupbuddy::$options['backup_directory']; ?>' ) || ( directory == '/wp-content/uploads/backupbuddy_temp/' ) ) {
  45. alert( '<?php _e('You cannot exclude /wp-content/, /wp-content/uploads/, or BackupBuddy directories. However, you may exclude subdirectories within these. BackupBuddy directories such as backupbuddy_backups are automatically excluded and cannot be added to exclusion list.', 'it-l10n-backupbuddy' );?>' );
  46. } else {
  47. jQuery('#pb_backupbuddy_excludes').val( directory + "\n" + jQuery('#pb_backupbuddy_excludes').val() );
  48. }
  49. }
  50. );
  51. /* Begin Table Selector */
  52. jQuery( '.pb_backupbuddy_table_addexclude' ).click(function(){
  53. jQuery('#pb_backupbuddy_mysqldump_additional_excludes').val( jQuery(this).parent().parent().parent().find( 'a' ).attr( 'alt' ) + "\n" + jQuery('#pb_backupbuddy_mysqldump_additional_excludes').val() );
  54. return false;
  55. });
  56. jQuery( '.pb_backupbuddy_table_addinclude' ).click(function(){
  57. jQuery('#pb_backupbuddy_mysqldump_additional_includes').val( jQuery(this).parent().parent().parent().find( 'a' ).attr( 'alt' ) + "\n" + jQuery('#pb_backupbuddy_mysqldump_additional_includes').val() );
  58. return false;
  59. });
  60. /* Begin Directory / File Selector */
  61. jQuery( '.pb_backupbuddy_filetree_exclude' ).live( 'click', function(){
  62. text = jQuery(this).parent().parent().find( 'a' ).attr( 'rel' );
  63. if ( ( text == 'wp-config.php' ) || ( text == '/wp-content/' ) || ( text == '/wp-content/uploads/' ) || ( text == '<?php echo pb_backupbuddy::$options['backup_directory']; ?>' ) || ( text == '/wp-content/uploads/backupbuddy_temp/' ) ) {
  64. alert( '<?php _e('You cannot exclude /wp-content/, /wp-content/uploads/, or BackupBuddy directories. However, you may exclude subdirectories within these. BackupBuddy directories such as backupbuddy_backups are automatically excluded and cannot be added to exclusion list.', 'it-l10n-backupbuddy' );?>' );
  65. } else {
  66. jQuery('#pb_backupbuddy_excludes').val( text + "\n" + jQuery('#pb_backupbuddy_excludes').val() );
  67. }
  68. return false;
  69. });
  70. jQuery( '.pb_backupbuddy_customize_email_scheduled_start' ).click( function() {
  71. jQuery( '.pb_backupbuddy_customize_email_scheduled_start_row' ).slideToggle();
  72. return false;
  73. });
  74. jQuery( '.pb_backupbuddy_customize_email_scheduled_complete' ).click( function() {
  75. jQuery( '.pb_backupbuddy_customize_email_scheduled_complete_row' ).slideToggle();
  76. return false;
  77. });
  78. jQuery( '.pb_backupbuddy_customize_email_error' ).click( function() {
  79. jQuery( '.pb_backupbuddy_customize_email_error_row' ).slideToggle();
  80. return false;
  81. });
  82. });
  83. function pb_backupbuddy_selectdestination( destination_id, destination_title, callback_data ) {
  84. window.location.href = '<?php echo pb_backupbuddy::page_url(); ?>&custom=remoteclient&destination_id=' + destination_id;
  85. }
  86. </script>
  87. <?php
  88. pb_backupbuddy::$ui->title( 'BackupBuddy Settings' );
  89. pb_backupbuddy::$classes['core']->versions_confirm();
  90. /* BEGIN VERIFYING BACKUP DIRECTORY */
  91. if ( pb_backupbuddy::_POST( 'pb_backupbuddy_backup_directory' ) != '' ) {
  92. $backup_directory = pb_backupbuddy::_POST( 'pb_backupbuddy_backup_directory' );
  93. $backup_directory = str_replace( '\\', '/', $backup_directory );
  94. $backup_directory = rtrim( $backup_directory, '/\\' ) . '/'; // Enforce single trailing slash.
  95. if ( ! is_dir( $backup_directory ) ) {
  96. if ( false === @mkdir( $backup_directory, 0755 ) ) {
  97. 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.' );
  98. $_POST['pb_backupbuddy_backup_directory'] = pb_backupbuddy::$options['backup_directory']; // Set back to previous value (aka unchanged).
  99. }
  100. }
  101. if ( pb_backupbuddy::$options['backup_directory'] != $backup_directory ) { // Directory differs. Needs updated in post var. Give messages here as this value is going to end up being saved.
  102. pb_backupbuddy::anti_directory_browsing( $backup_directory );
  103. $old_backup_dir = pb_backupbuddy::$options['backup_directory'];
  104. $new_backup_dir = $backup_directory;
  105. // Move all files from old backup to new.
  106. $old_backups_moved = 0;
  107. $old_backups = glob( $old_backup_dir . 'backup*.zip' );
  108. if ( !is_array( $old_backups ) || empty( $old_backups ) ) { // On failure glob() returns false or an empty array depending on server settings so normalize here.
  109. $old_backups = array();
  110. }
  111. foreach( $old_backups as $old_backup ) {
  112. if ( false === rename( $old_backup, $new_backup_dir . basename( $old_backup ) ) ) {
  113. 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.' );
  114. } else { // rename success.
  115. $old_backups_moved++;
  116. $serial = pb_backupbuddy::$classes['core']->get_serial_from_file( basename( $old_backup ) );
  117. if ( isset( pb_backupbuddy::$options['backups'][ $serial ] ) ) {
  118. if ( isset( pb_backupbuddy::$options['backups'][ $serial ]['archive_file'] ) ) {
  119. pb_backupbuddy::$options['backups'][ $serial ]['archive_file'] = str_replace( $old_backup_dir, $new_backup_dir, pb_backupbuddy::$options['backups'][ $serial ]['archive_file'] );
  120. }
  121. }
  122. }
  123. }
  124. $_POST['pb_backupbuddy_backup_directory'] = $backup_directory;
  125. 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.' );
  126. }
  127. }
  128. /* END VERIFYING BACKUP DIRECTORY */
  129. /* BEGIN DISALLOWING DEFAULT IMPORT/REPAIR PASSWORD */
  130. if ( strtolower( pb_backupbuddy::_POST( 'pb_backupbuddy_importbuddy_pass_hash' ) ) == 'myp@ssw0rd' ) {
  131. pb_backupbuddy::alert( 'Warning: The example password is not allowed for security reasons for ImportBuddy. Please choose another password.' );
  132. $_POST['pb_backupbuddy_importbuddy_pass_hash'] = '';
  133. }
  134. if ( strtolower( pb_backupbuddy::_POST( 'pb_backupbuddy_repairbuddy_pass_hash' ) ) == 'myp@ssw0rd' ) {
  135. pb_backupbuddy::alert( 'Warning: The example password is not allowed for security reasons for RepairBuddy. Please choose another password.' );
  136. $_POST['pb_backupbuddy_repairbuddy_pass_hash'] = '';
  137. }
  138. /* END DISALLOWING DEFAULT IMPORT/REPAIR PASSWORD */
  139. /* BEGIN VERIFYING PASSWORD CONFIRMATIONS MATCH */
  140. $importbuddy_pass_match_fail = false;
  141. if ( pb_backupbuddy::_POST( 'pb_backupbuddy_importbuddy_pass_hash' ) != pb_backupbuddy::_POST( 'pb_backupbuddy_importbuddy_pass_hash_confirm' ) ) {
  142. 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.' );
  143. $_POST['pb_backupbuddy_importbuddy_pass_hash'] = '';
  144. $_POST['pb_backupbuddy_importbuddy_pass_hash_confirm'] = '';
  145. $importbuddy_pass_match_fail = true;
  146. }
  147. $repairbuddy_pass_match_fail = false;
  148. if ( pb_backupbuddy::_POST( 'pb_backupbuddy_repairbuddy_pass_hash' ) != pb_backupbuddy::_POST( 'pb_backupbuddy_repairbuddy_pass_hash_confirm' ) ) {
  149. pb_backupbuddy::alert( 'Error: The provided RepairBuddy password and confirmation do not match. Please make sure you type the password and re-type it correctly.' );
  150. $_POST['pb_backupbuddy_repairbuddy_pass_hash'] = '';
  151. $_POST['pb_backupbuddy_repairbuddy_pass_hash_confirm'] = '';
  152. $repairbuddy_pass_match_fail = true;
  153. }
  154. /* END VERIFYING PASSWORD CONFIRMATIONS MATCH */
  155. /* BEGIN REPLACING IMPORTBUDDY/REPAIRBUDDY_PASS_HASH WITH VALUE OF ACTUAL HASH */
  156. // ImportBuddy hash replace.
  157. if ( ( str_replace( ')', '', pb_backupbuddy::_POST( 'pb_backupbuddy_importbuddy_pass_hash' ) ) != '' ) && ( md5( pb_backupbuddy::_POST( 'pb_backupbuddy_importbuddy_pass_hash' ) ) != pb_backupbuddy::$options['importbuddy_pass_hash'] ) ) {
  158. //echo 'posted value: ' . pb_backupbuddy::_POST( 'pb_backupbuddy_importbuddy_pass_hash' ) . '<br>';
  159. //echo 'hash: ' . md5( pb_backupbuddy::_POST( 'pb_backupbuddy_importbuddy_pass_hash' ) ) . '<br>';
  160. pb_backupbuddy::$options['importbuddy_pass_length'] = strlen( pb_backupbuddy::_POST( 'pb_backupbuddy_importbuddy_pass_hash' ) );
  161. $_POST['pb_backupbuddy_importbuddy_pass_hash'] = md5( pb_backupbuddy::_POST( 'pb_backupbuddy_importbuddy_pass_hash' ) );
  162. } else { // Keep the same.
  163. if ( $importbuddy_pass_match_fail !== true ) { // keep the same
  164. $_POST['pb_backupbuddy_importbuddy_pass_hash'] = pb_backupbuddy::$options['importbuddy_pass_hash'];
  165. }
  166. }
  167. // Set importbuddy dummy text to display in form box. Equal length to the provided password.
  168. $importbuddy_pass_dummy_text = str_pad( '', pb_backupbuddy::$options['importbuddy_pass_length'], ')' );
  169. // RepairBuddy hash replace.
  170. if ( ( str_replace( ')', '', pb_backupbuddy::_POST( 'pb_backupbuddy_repairbuddy_pass_hash' ) ) != '' ) && ( md5( pb_backupbuddy::_POST( 'pb_backupbuddy_repairbuddy_pass_hash' ) ) != pb_backupbuddy::$options['repairbuddy_pass_hash'] ) ) {
  171. pb_backupbuddy::$options['repairbuddy_pass_length'] = strlen( pb_backupbuddy::_POST( 'pb_backupbuddy_repairbuddy_pass_hash' ) );
  172. $_POST['pb_backupbuddy_repairbuddy_pass_hash'] = md5( pb_backupbuddy::_POST( 'pb_backupbuddy_repairbuddy_pass_hash' ) );
  173. } else { // Keep the same.
  174. if ( $repairbuddy_pass_match_fail !== true ) { // keep the same
  175. $_POST['pb_backupbuddy_repairbuddy_pass_hash'] = pb_backupbuddy::$options['repairbuddy_pass_hash'];
  176. }
  177. }
  178. // Set repairbuddy dummy text to display in form box. Equal length to the provided password.
  179. $repairbuddy_pass_dummy_text = str_pad( '', pb_backupbuddy::$options['repairbuddy_pass_length'], ')' );
  180. /* END REPLACING IMPORTBUDDY/REPAIRBUDDY_PASS_HASH WITH VALUE OF ACTUAL HASH */
  181. /* BEGIN SAVE MULTISITE SPECIFIC SETTINGS IN SET OPTIONS SO THEY ARE AVAILABLE GLOBALLY */
  182. if ( is_multisite() ) {
  183. // Save multisite export option to the global site/network options for global retrieval.
  184. $options = get_site_option( 'pb_' . pb_backupbuddy::settings( 'slug' ) );
  185. $options[ 'multisite_export' ] = pb_backupbuddy::_POST( 'pb_backupbuddy_multisite_export' );
  186. update_site_option( 'pb_' . pb_backupbuddy::settings( 'slug' ), $options );
  187. unset( $options );
  188. }
  189. /* END SAVE MULTISITE SPECIFIC SETTINGS IN SET OPTIONS SO THEY ARE AVAILABLE GLOBALLY */
  190. /* BEGIN CONFIGURING PLUGIN SETTINGS FORM */
  191. $settings_form = new pb_backupbuddy_settings( 'settings', '', '', 320 );
  192. $settings_form->add_setting( array(
  193. 'type' => 'title',
  194. 'name' => 'title_2',
  195. 'title' => __( 'General Options', 'it-l10n-backupbuddy' ) . ' ' . pb_backupbuddy::video( 'PmXLw_tS42Q#6', __('General Options Tutorial', 'it-l10n-backupbuddy' ), false ),
  196. ) );
  197. $settings_form->add_setting( array(
  198. 'type' => 'password',
  199. 'name' => 'importbuddy_pass_hash',
  200. 'title' => __('ImportBuddy password', 'it-l10n-backupbuddy' ),
  201. 'tip' => __('[Example: myp@ssw0rD] - Required password for running the ImportBuddy import/migration script. This prevents unauthorized access when using this tool. You should not use your WordPress password here.', 'it-l10n-backupbuddy' ),
  202. 'value' => $importbuddy_pass_dummy_text,
  203. 'after' => '&nbsp;&nbsp; Confirm: <input type="password" name="pb_backupbuddy_importbuddy_pass_hash_confirm" value="' . $importbuddy_pass_dummy_text . '">',
  204. //'classes' => 'regular-text code',
  205. ) );
  206. $settings_form->add_setting( array(
  207. 'type' => 'password',
  208. 'name' => 'repairbuddy_pass_hash',
  209. 'title' => __('RepairBuddy password', 'it-l10n-backupbuddy' ),
  210. 'tip' => __('[Example: myp@ssw0rD] - Required password for running the RepairBuddy troubleshooting/repair script. This prevents unauthorized access when using this tool. You should not use your WordPress password here.', 'it-l10n-backupbuddy' ),
  211. 'value' => $repairbuddy_pass_dummy_text,
  212. 'after' => '&nbsp;&nbsp; Confirm: <input type="password" name="pb_backupbuddy_repairbuddy_pass_hash_confirm" value="' . $repairbuddy_pass_dummy_text . '">',
  213. //'classes' => 'regular-text code',
  214. ) );
  215. $settings_form->add_setting( array(
  216. 'type' => 'text',
  217. 'name' => 'backup_directory',
  218. 'title' => __('Local storage directory for backups', 'it-l10n-backupbuddy' ),
  219. 'tip' => __('Local directory where all backup ZIP files will be saved to. This directory must have proper write and read permissions. Upon changing, any backups in the existing directory will be moved to the new directory. Note: This is only where local backups will be, not remotely stored backups. Remote storage is configured on the Remote Destinations page.', 'it-l10n-backupbuddy' ),
  220. 'rules' => 'required',
  221. 'css' => 'width: 325px;',
  222. 'after' => ' <a style="cursor: pointer;" onClick="jQuery(\'#pb_backupbuddy_backup_directory\').val(\'' . str_replace( '\\', '/', ABSPATH ) . 'wp-content/uploads/backupbuddy_backups/\');">Reset Default</a>',
  223. ) );
  224. $settings_form->add_setting( array(
  225. 'type' => 'select',
  226. 'name' => 'role_access',
  227. 'title' => __('BackupBuddy access permission', 'it-l10n-backupbuddy' ),
  228. 'options' => array(
  229. 'administrator' => __( 'Administrator (default)', 'it-l10n-backupbuddy' ),
  230. 'moderate_comments' => __( 'Editor (moderate_comments)', 'it-l10n-backupbuddy' ),
  231. 'edit_published_posts' => __( 'Author (edit_published_posts)', 'it-l10n-backupbuddy' ),
  232. 'edit_posts' => __( 'Contributor (edit_posts)', 'it-l10n-backupbuddy' ),
  233. ),
  234. 'tip' => __('[Default: Administrator] - Allow other user levels to access BackupBuddy. Use extreme caution as users granted access will have FULL access to BackupBuddy and your backups, including remote destinations. This is a potential security hole if used improperly. Use caution when selecting any other user roles or giving users in such roles access. Not applicable to Multisite installations.', 'it-l10n-backupbuddy' ),
  235. 'after' => ' <span class="description">Use caution changing from "administrator".</span>',
  236. 'rules' => 'required',
  237. ) );
  238. $log_file = WP_CONTENT_DIR . '/uploads/pb_' . pb_backupbuddy::settings( 'slug' ) . '/log-' . pb_backupbuddy::$options['log_serial'] . '.txt';
  239. $settings_form->add_setting( array(
  240. 'type' => 'select',
  241. 'name' => 'log_level',
  242. 'title' => __('Logging / Debug level', 'it-l10n-backupbuddy' ),
  243. 'options' => array(
  244. '0' => __( 'None', 'it-l10n-backupbuddy' ),
  245. '1' => __( 'Errors Only', 'it-l10n-backupbuddy' ),
  246. '2' => __( 'Errors & Warnings', 'it-l10n-backupbuddy' ),
  247. '3' => __( 'Everything (debug mode)', 'it-l10n-backupbuddy' ),
  248. ),
  249. 'tip' => sprintf( __('[Default: Errors Only] - This option controls how much activity is logged for records or debugging. When in debug mode error emails will contain encrypted debugging data for support. Log file: %s', 'it-l10n-backupbuddy' ), $log_file ),
  250. 'rules' => 'required',
  251. ) );
  252. $settings_form->add_setting( array(
  253. 'type' => 'text',
  254. 'name' => 'max_site_log_size',
  255. 'title' => __('Maximum log file size', 'it-l10n-backupbuddy' ),
  256. 'tip' => __('[Default: 10 MB] - If the log file exceeds this size then it will be cleared to prevent it from using too much space.' ),
  257. 'rules' => 'required',
  258. 'css' => 'width: 50px;',
  259. 'after' => ' MB',
  260. ) );
  261. $settings_form->add_setting( array(
  262. 'type' => 'checkbox',
  263. 'name' => 'backup_reminders',
  264. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  265. 'title' => __( 'Enable backup reminders', 'it-l10n-backupbuddy' ),
  266. 'tip' => __( '[Default: enabled] - When enabled links will be displayed upon post or page edits and during WordPress upgrades to remind and allow rapid backing up after modifications or before upgrading.', 'it-l10n-backupbuddy' ),
  267. 'css' => '',
  268. 'after' => '',
  269. 'rules' => 'required',
  270. ) );
  271. $settings_form->add_setting( array(
  272. 'type' => 'checkbox',
  273. 'name' => 'archive_name_format',
  274. 'options' => array( 'unchecked' => 'date', 'checked' => 'datetime' ),
  275. 'title' => __( 'Add time in backup file name', 'it-l10n-backupbuddy' ),
  276. 'tip' => __( '[Default: disabled (date only)] - When enabled your backup filename will display the time the backup was created in addition to the default date. This is useful when making multiple backups in a one day period.', 'it-l10n-backupbuddy' ),
  277. 'css' => '',
  278. 'rules' => 'required',
  279. ) );
  280. $settings_form->add_setting( array(
  281. 'type' => 'title',
  282. 'name' => 'title_1',
  283. 'title' => __( 'Email Notification Recipients', 'it-l10n-backupbuddy' ) . ' ' . pb_backupbuddy::video( 'PmXLw_tS42Q#6', __('Email Notifications Tutorial', 'it-l10n-backupbuddy' ), false ),
  284. ) );
  285. $settings_form->add_setting( array(
  286. 'type' => 'text',
  287. 'name' => 'email_notify_scheduled_start',
  288. 'title' => __('Scheduled backup started email recipient(s)', 'it-l10n-backupbuddy' ),
  289. 'tip' => __('Email address to send notifications to upon scheduled backup starting. Use commas to separate multiple email addresses. Notifications will not be sent for remote destination file transfers.', 'it-l10n-backupbuddy' ),
  290. //'rules' => 'string[0-500]',
  291. 'css' => 'width: 325px;',
  292. 'after' => ' <a href="" class="pb_backupbuddy_customize_email_scheduled_start" style="text-decoration: none;">Customize Email</a>',
  293. ) );
  294. $settings_form->add_setting( array(
  295. 'type' => 'text',
  296. 'name' => 'email_notify_scheduled_start_subject',
  297. 'title' => ' ',
  298. 'rules' => 'required|string[1-500]',
  299. 'css' => 'width: 360px;',
  300. 'row_class' => 'pb_backupbuddy_customize_email_scheduled_start_row',
  301. 'before' => '<span style="display: inline-block; width: 65px;">' . __('Subject', 'it-l10n-backupbuddy' ) . ':</span>',
  302. ) );
  303. $settings_form->add_setting( array(
  304. 'type' => 'textarea',
  305. 'name' => 'email_notify_scheduled_start_body',
  306. 'title' => ' ',
  307. 'rules' => 'required|string[1-500]',
  308. 'css' => 'width: 360px; height: 75px;',
  309. 'row_class' => 'pb_backupbuddy_customize_email_scheduled_start_row',
  310. 'before' => '<span style="display: inline-block; width: 65px; float: left;">' . __('Body', 'it-l10n-backupbuddy' ) . ':</span>',
  311. 'after' => '<div style="margin-left: 65px; width: 360px;" class="description">
  312. Variables: {site_url} {backupbuddy_version} {current_datetime} {message}
  313. </div>',
  314. ) );
  315. $settings_form->add_setting( array(
  316. 'type' => 'text',
  317. 'name' => 'email_notify_scheduled_complete',
  318. 'title' => __('Scheduled backup completed email recipient(s)', 'it-l10n-backupbuddy' ),
  319. 'tip' => __('Email address to send notifications to upon scheduled backup completion. Use commas to separate multiple email addresses.', 'it-l10n-backupbuddy' ),
  320. 'css' => 'width: 325px;',
  321. 'after' => ' <a href="" class="pb_backupbuddy_customize_email_scheduled_complete" style="text-decoration: none;">Customize Email</a>',
  322. ) );
  323. $settings_form->add_setting( array(
  324. 'type' => 'text',
  325. 'name' => 'email_notify_scheduled_complete_subject',
  326. 'title' => ' ',
  327. 'rules' => 'required|string[1-500]',
  328. 'css' => 'width: 360px;',
  329. 'row_class' => 'pb_backupbuddy_customize_email_scheduled_complete_row',
  330. 'before' => '<span style="display: inline-block; width: 65px;">' . __('Subject', 'it-l10n-backupbuddy' ) . ':</span>',
  331. ) );
  332. $settings_form->add_setting( array(
  333. 'type' => 'textarea',
  334. 'name' => 'email_notify_scheduled_complete_body',
  335. 'title' => ' ',
  336. 'classes' => 'regular-text',
  337. 'rules' => 'required|string[1-500]',
  338. 'css' => 'width: 360px; height: 75px;',
  339. 'row_class' => 'pb_backupbuddy_customize_email_scheduled_complete_row',
  340. 'before' => '<span style="display: inline-block; width: 65px; float: left;">' . __('Body', 'it-l10n-backupbuddy' ) . ':</span>',
  341. 'after' => '<div style="margin-left: 65px; width: 360px;" class="description">
  342. Variables: {site_url} {backupbuddy_version} {current_datetime} {message}
  343. {download_link} {backup_size} {backup_type} {backup_file} {backup_serial}
  344. </div>',
  345. ) );
  346. $settings_form->add_setting( array(
  347. 'type' => 'text',
  348. 'name' => 'email_notify_error',
  349. 'title' => __('Error notification recipient(s)', 'it-l10n-backupbuddy' ),
  350. 'tip' => __('Email address to send notifications to upon encountering any errors or problems. Use commas to separate multiple email addresses.', 'it-l10n-backupbuddy' ),
  351. 'css' => 'width: 325px;',
  352. 'after' => ' <a href="" class="pb_backupbuddy_customize_email_error" style="text-decoration: none;">Customize Email</a>',
  353. ) );
  354. $settings_form->add_setting( array(
  355. 'type' => 'text',
  356. 'name' => 'email_notify_error_subject',
  357. 'title' => ' ',
  358. 'rules' => 'required|string[1-500]',
  359. 'css' => 'width: 360px;',
  360. 'row_class' => 'pb_backupbuddy_customize_email_error_row',
  361. 'before' => '<span style="display: inline-block; width: 65px;">' . __('Subject', 'it-l10n-backupbuddy' ) . ':</span>',
  362. ) );
  363. $settings_form->add_setting( array(
  364. 'type' => 'textarea',
  365. 'name' => 'email_notify_error_body',
  366. 'title' => ' ',
  367. 'classes' => 'regular-text',
  368. 'rules' => 'required|string[1-500]',
  369. 'css' => 'width: 360px; height: 75px;',
  370. 'row_class' => 'pb_backupbuddy_customize_email_error_row',
  371. 'before' => '<span style="display: inline-block; width: 65px; float: left;">' . __('Body', 'it-l10n-backupbuddy' ) . ':</span>',
  372. 'after' => '<div style="margin-left: 65px; width: 360px;" class="description">
  373. Variables: {site_url} {backupbuddy_version} {current_datetime} {message}
  374. </div>',
  375. ) );
  376. $settings_form->add_setting( array(
  377. 'type' => 'title',
  378. 'name' => 'title_archivestoragelimits',
  379. 'title' => __( 'Local Archive Storage Limits', 'it-l10n-backupbuddy' ) . ' ' . pb_backupbuddy::video( 'PmXLw_tS42Q#45', __('Archive Storage Limits Tutorial', 'it-l10n-backupbuddy' ), false ),
  380. ) );
  381. $settings_form->add_setting( array(
  382. 'type' => 'text',
  383. 'name' => 'archive_limit',
  384. 'title' => __('Maximum number of local backups to keep', 'it-l10n-backupbuddy' ),
  385. 'tip' => __('[Example: 10] - Maximum number of local archived backups to store (remote archive limits are configured per destination on their respective settings pages). Any new backups created after this limit is met will result in your oldest backup(s) being deleted to make room for the newer ones. Changes to this setting take place once a new backup is made. Set to zero (0) for no limit.', 'it-l10n-backupbuddy' ),
  386. 'rules' => 'required|string[0-500]',
  387. 'css' => 'width: 50px;',
  388. 'after' => ' backups',
  389. ) );
  390. $settings_form->add_setting( array(
  391. 'type' => 'text',
  392. 'name' => 'archive_limit_size',
  393. 'title' => __('Maximum size of all local backups combined', 'it-l10n-backupbuddy' ),
  394. 'tip' => __('[Example: 350] - Maximum size (in MB) to allow your total local archives to reach (remote archive limits are configured per destination on their respective settings pages). Any new backups created after this limit is met will result in your oldest backup(s) being deleted to make room for the newer ones. Changes to this setting take place once a new backup is made. Set to zero (0) for no limit.', 'it-l10n-backupbuddy' ),
  395. 'rules' => 'required|string[0-500]',
  396. 'css' => 'width: 50px;',
  397. 'after' => ' MB',
  398. ) );
  399. $settings_form->add_setting( array(
  400. 'type' => 'text',
  401. 'name' => 'archive_limit_age',
  402. 'title' => __('Maximum age of local backups', 'it-l10n-backupbuddy' ),
  403. 'tip' => __('[Example: 90] - Maximum age (in days) to allow your local archives to reach (remote archive limits are configured per destination on their respective settings pages). Any backups exceeding this age will be deleted as new backups are created. Changes to this setting take place once a new backup is made. Set to zero (0) for no limit.', 'it-l10n-backupbuddy' ),
  404. 'rules' => 'required|string[0-99999]',
  405. 'css' => 'width: 50px;',
  406. 'after' => ' days',
  407. ) );
  408. if ( is_multisite() ) {
  409. $settings_form->add_setting( array(
  410. 'type' => 'title',
  411. 'name' => 'title_multisite',
  412. 'title' => __( 'Multisite', 'it-l10n-backupbuddy' ),
  413. ) );
  414. $settings_form->add_setting( array(
  415. 'type' => 'checkbox',
  416. 'name' => 'multisite_export',
  417. 'title' => __( 'Allow individual site exports by administrators?', 'it-l10n-backupbuddy' ) . ' ' . pb_backupbuddy::video( '_oKGIzzuVzw', __('Multisite export', 'it-l10n-backupbuddy' ), false ),
  418. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  419. 'tip' => __('[Default: disabled] - When enabled individual sites may be exported by Administrators of the individual site. Network Administrators always see this menu (notes with the words SuperAdmin in parentheses in the menu when only SuperAdmins have access to the feature).', 'it-l10n-backupbuddy' ),
  420. 'rules' => 'required',
  421. 'after' => '<span class="description"> ' . __( 'Check to extend Site Exporting functionality to subsite Administrators.', 'it-l10n-backupbuddy' ) . '</span>',
  422. ) );
  423. }
  424. $settings_form->add_setting( array(
  425. 'type' => 'title',
  426. 'name' => 'title_mysqltables',
  427. 'title' => __( 'Database Backup', 'it-l10n-backupbuddy' ) . ' ' . pb_backupbuddy::video( 'PmXLw_tS42Q#62', __('Database backup settings', 'it-l10n-backupbuddy' ), false ),
  428. ) );
  429. global $wpdb;
  430. $settings_form->add_setting( array(
  431. 'type' => 'radio',
  432. 'name' => 'backup_nonwp_tables',
  433. 'options' => array( '0' => 'This WordPress\' tables (starts with prefix ' . $wpdb->prefix . ')', '1' => 'All tables in database (including non-WordPress)' ),
  434. 'title' => __( '<b>Default</b> database tables to backup', 'it-l10n-backupbuddy' ),
  435. 'tip' => __( '[Default: This WordPress\' tables prefix (' . $wpdb->prefix . ')] - Determines the default set of tables to backup. If this WordPress\' tables is selected then only tables with the same prefix (for example ' . $wpdb->prefix . ' for this installation) will be backed up by default. If all are selected then all tables will be backed up by default. Additional inclusions & exclusions may be defined below.', 'it-l10n-backupbuddy' ),
  436. 'css' => '',
  437. 'rules' => 'required',
  438. ) );
  439. function pb_additional_tables() {
  440. $return = '';
  441. global $wpdb;
  442. $prefix = $wpdb->prefix;
  443. $prefix_length = strlen( $wpdb->prefix );
  444. $additional_includes = explode( "\n", pb_backupbuddy::$options['mysqldump_additional_includes'] );
  445. array_walk( $additional_includes, create_function('&$val', '$val = trim($val);'));
  446. $additional_excludes = explode( "\n", pb_backupbuddy::$options['mysqldump_additional_excludes'] );
  447. array_walk( $additional_excludes, create_function('&$val', '$val = trim($val);'));
  448. $total_size = 0;
  449. $total_size_with_exclusions = 0;
  450. $total_rows = 0;
  451. $result = mysql_query("SHOW TABLE STATUS");
  452. while( $rs = mysql_fetch_array( $result ) ) {
  453. $excluded = true; // Default.
  454. // TABLE STATUS.
  455. $resultb = mysql_query("CHECK TABLE `{$rs['Name']}`");
  456. while( $rsb = mysql_fetch_array( $resultb ) ) {
  457. if ( $rsb['Msg_type'] == 'status' ) {
  458. $status = $rsb['Msg_text'];
  459. }
  460. }
  461. mysql_free_result( $resultb );
  462. // Fix up row count and average row length for InnoDB engine which returns inaccurate
  463. // (and changing) values for these
  464. if ( 'InnoDB' === $rs[ 'Engine' ] ) {
  465. if ( false !== ( $resultc = mysql_query( "SELECT COUNT(1) FROM `{$rs[ 'Name' ]}`" ) ) ) {
  466. if ( false !== ( $row = mysql_fetch_row( $resultc ) ) ) {
  467. if ( 0 < ( $rs[ 'Rows' ] = $row[ 0 ] ) ) {
  468. $rs[ 'Avg_row_length' ] = ( $rs[ 'Data_length' ] / $rs[ 'Rows' ] );
  469. }
  470. }
  471. mysql_free_result( $resultc );
  472. }
  473. }
  474. // TABLE SIZE.
  475. $size = ( $rs['Data_length'] + $rs['Index_length'] );
  476. $total_size += $size;
  477. // HANDLE EXCLUSIONS.
  478. if ( pb_backupbuddy::$options['backup_nonwp_tables'] == 0 ) { // Only matching prefix.
  479. if ( ( substr( $rs['Name'], 0, $prefix_length ) == $prefix ) OR ( in_array( $rs['Name'], $additional_includes ) ) ) {
  480. if ( !in_array( $rs['Name'], $additional_excludes ) ) {
  481. $total_size_with_exclusions += $size;
  482. $excluded = false;
  483. }
  484. }
  485. } else { // All tables.
  486. if ( !in_array( $rs['Name'], $additional_excludes ) ) {
  487. $total_size_with_exclusions += $size;
  488. $excluded = false;
  489. }
  490. }
  491. $return .= '<li class="file ext_sql collapsed">';
  492. $return .= '<a rel="/" alt="' . $rs['Name'] . '">' . $rs['Name'] . ' (' . pb_backupbuddy::$format->file_size( $size ) . ') ';
  493. if ( true === $excluded ) {
  494. //$return .= '<span class="pb_label pb_label-important">Excluded</span> ';
  495. }
  496. $return .= '<div class="pb_backupbuddy_treeselect_control">';
  497. $return .= '<img src="' . pb_backupbuddy::plugin_url() . '/images/redminus.png" style="vertical-align: -3px;" title="Add to exclusions..." class="pb_backupbuddy_table_addexclude"> <img src="' . pb_backupbuddy::plugin_url() . '/images/greenplus.png" style="vertical-align: -3px;" title="Add to inclusions..." class="pb_backupbuddy_table_addinclude">';
  498. $return .= '</div>';
  499. $return .= '</a>';
  500. $return .= '</li>';
  501. }
  502. $return = '<div class="jQueryOuterTree" style="position: absolute; height: 160px;"><ul class="jqueryFileTree">' .
  503. $return .
  504. '</ul></div>';
  505. return $return;
  506. }
  507. $settings_form->add_setting( array(
  508. 'type' => 'textarea',
  509. 'name' => 'mysqldump_additional_includes',
  510. 'title' => 'Hover tables & click <img src="' . pb_backupbuddy::plugin_url() .'/images/greenplus.png" style="vertical-align: -3px;"> to include, <img src="' . pb_backupbuddy::plugin_url() .'/images/redminus.png" style="vertical-align: -3px;"> to exclude.' . ' ' . pb_additional_tables(),
  511. 'before' => __('<b>Inclusions</b> beyond default', 'it-l10n-backupbuddy' ) . ':',
  512. //'after' => '<span class="description">' . __( 'One table per line. This may be manually edited.', 'it-l10n-backupbuddy' ) . '</span>',
  513. 'tip' => __('Additional databases tables to include OR exclude IN ADDITION to the DEFAULTS determined by the previous option. You may override defaults with exclusions. Excluding tables may result in an incomplete or broken backup so exercise caution.', 'it-l10n-backupbuddy' ),
  514. 'rules' => '',
  515. 'css' => 'width: 100%;',
  516. ) );
  517. $settings_form->add_setting( array(
  518. 'type' => 'textarea',
  519. 'name' => 'mysqldump_additional_excludes',
  520. //'title' => __('Additional tables to <b>exclude</b>', 'it-l10n-backupbuddy' ) . '<br><span class="description">' . __( 'One table per line.', 'it-l10n-backupbuddy' ) . '</span>',
  521. 'title' => '&nbsp;',
  522. 'before' => __('<b>Exclusions</b> beyond default', 'it-l10n-backupbuddy' ) . ':',
  523. 'after' => '<span class="description">' . __( 'One table per line. This may be manually edited.', 'it-l10n-backupbuddy' ) . '</span>',
  524. 'tip' => __('Additional databases tables to EXCLUDE from the backup. Exclusions are exempted after calculating defaults and additional table includes first. These may include non-WordPress and WordPress tables. WARNING: Excluding WordPress tables results in an incomplete backup and could result in failure in the ability to restore or data loss. Use with caution.', 'it-l10n-backupbuddy' ),
  525. 'rules' => '',
  526. 'css' => 'width: 100%;',
  527. ) );
  528. $settings_form->add_setting( array(
  529. 'type' => 'title',
  530. 'name' => 'title_exclusions',
  531. 'title' => __( 'File & Directory Exclusions', 'it-l10n-backupbuddy' ) . ' ' . pb_backupbuddy::video( 'PmXLw_tS42Q#94', __('Backup Directory Excluding Tutorial', 'it-l10n-backupbuddy' ), false ),
  532. ) );
  533. $settings_form->add_setting( array(
  534. 'type' => 'textarea',
  535. 'name' => 'excludes',
  536. 'title' => 'Click directories to navigate or click <img src="' . pb_backupbuddy::plugin_url() .'/images/redminus.png" style="vertical-align: -3px;"> to exclude.' . ' ' .
  537. pb_backupbuddy::tip( __('Click on a directory name to navigate directories. Click the red minus sign to the right of a directory to place it in the exclusion list. /wp-content/, /wp-content/uploads/, and BackupBuddy backup & temporary directories cannot be excluded. BackupBuddy directories are automatically excluded.', 'it-l10n-backupbuddy' ), '', false ) .
  538. '<br><div id="exlude_dirs" class="jQueryOuterTree"></div>',
  539. //'tip' => ,
  540. 'rules' => 'string[0-9000]',
  541. 'css' => 'width: 100%; height: 135px;',
  542. 'before' => __('Excluded files & directories (relative to WordPress installation directory)' , 'it-l10n-backupbuddy' ) . pb_backupbuddy::tip( __('List paths relative to the WordPress installation directory to be excluded from backups. You may use the directory selector to the left to easily exclude directories by ctrl+clicking them. Paths are relative to root, for example: /wp-content/uploads/junk/', 'it-l10n-backupbuddy' ), '', false ) . '<br>',
  543. 'after' => '<span class="description">' . __( 'One file or directory exclusion per line. This may be manually edited.', 'it-l10n-backupbuddy' ) . '</span>',
  544. ) );
  545. $settings_form->add_setting( array(
  546. 'type' => 'title',
  547. 'name' => 'title_troubleshooting',
  548. 'title' => __( 'Troubleshooting & Compatibility', 'it-l10n-backupbuddy' ) . ' ' . pb_backupbuddy::video( 'PmXLw_tS42Q#108', __('Troubleshooting options', 'it-l10n-backupbuddy' ), false ),
  549. ) );
  550. $settings_form->add_setting( array(
  551. 'type' => 'checkbox',
  552. 'name' => 'lock_archives_directory',
  553. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  554. 'title' => __( 'Lock archive directory (high security)', 'it-l10n-backupbuddy' ),
  555. 'tip' => __( '[Default: disabled] - When enabled all downloads of archives via the web will be prevented under all circumstances via .htaccess file. If your server permits it, they will only be unlocked temporarily on click to download. If your server does not support this unlocking then you will have to access the archives via the server (such as by FTP).', 'it-l10n-backupbuddy' ),
  556. 'css' => '',
  557. 'after' => '<span class="description"> ' . __('Check for enhanced security to block backup downloading.', 'it-l10n-backupbuddy' ) . ' This may<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result in an inability to download backups while enabled on some servers.</span>',
  558. 'rules' => 'required',
  559. ) );
  560. $settings_form->add_setting( array(
  561. 'type' => 'checkbox',
  562. 'name' => 'delete_archives_pre_backup',
  563. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  564. 'title' => __( 'Delete all backup archives prior to backups', 'it-l10n-backupbuddy' ),
  565. 'tip' => __( '[Default: disabled] - When enabled all local backup archives will be deleted prior to each backup. This is useful if in compatibilty mode to prevent backing up existing files.', 'it-l10n-backupbuddy' ),
  566. 'css' => '',
  567. 'after' => '<span class="description"> ' . __('Check if using compatibilty mode & exclusions are unavailable.', 'it-l10n-backupbuddy' ) . '</span>',
  568. 'rules' => 'required',
  569. ) );
  570. $settings_form->add_setting( array(
  571. 'type' => 'checkbox',
  572. 'name' => 'compression',
  573. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  574. 'title' => __( 'Enable zip compression', 'it-l10n-backupbuddy' ),
  575. 'tip' => __( '[Default: enabled] - ZIP compression decreases file sizes of stored backups. If you are encountering timeouts due to the script running too long, disabling compression may allow the process to complete faster.', 'it-l10n-backupbuddy' ),
  576. 'css' => '',
  577. 'after' => '<span class="description"> ' . __('Uncheck for large sites causing backups to not complete.', 'it-l10n-backupbuddy' ) . '</span>',
  578. 'rules' => 'required',
  579. ) );
  580. $settings_form->add_setting( array(
  581. 'type' => 'checkbox',
  582. 'name' => 'integrity_check',
  583. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  584. 'title' => __('Perform integrity check on backup files', 'it-l10n-backupbuddy' ),
  585. 'tip' => __('[Default: enabled] - By default each backup file is checked for integrity and completion the first time it is viewed on the Backup page. On some server configurations this may cause memory problems as the integrity checking process is intensive. If you are experiencing out of memory errors on the Backup file listing, you can uncheck this to disable this feature.', 'it-l10n-backupbuddy' ),
  586. 'css' => '',
  587. 'after' => '<span class="description"> ' . __( 'Uncheck if having problems viewing your backup listing.', 'it-l10n-backupbuddy' ) . '</span>',
  588. 'rules' => 'required',
  589. ) );
  590. $settings_form->add_setting( array(
  591. 'type' => 'checkbox',
  592. 'name' => 'force_compatibility',
  593. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  594. 'title' => __('Force compatibility mode zip', 'it-l10n-backupbuddy' ),
  595. 'tip' => __('[Default: disabled] - (WARNING: This forces the potentially slower mode of zip creation. Only use if absolutely necessary. Checking this box can cause backup failures if it is not needed.) Under normal circumstances compatibility mode is automatically entered as needed without user intervention. However under some server configurations the native backup system is unavailable but is incorrectly reported as functioning by the server. Forcing compatibility may fix problems in this situation by bypassing the native backup system check entirely.', 'it-l10n-backupbuddy' ),
  596. 'css' => '',
  597. 'after' => '<span class="description"> ' . __('Check if absolutely necessary or directed by support.', 'it-l10n-backupbuddy' ) . '</span>',
  598. 'rules' => 'required',
  599. ) );
  600. $settings_form->add_setting( array(
  601. 'type' => 'checkbox',
  602. 'name' => 'force_mysqldump_compatibility',
  603. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  604. 'title' => __('Force compatibility mode database dump', 'it-l10n-backupbuddy' ),
  605. 'tip' => __('[Default: disabled] - WARNING: This forces the potentially slower mode of database dumping. Under normal circumstances mysql dump compatibility mode is automatically entered as needed without user intervention.', 'it-l10n-backupbuddy' ),
  606. 'css' => '',
  607. 'after' => '<span class="description"> ' . __( 'Check if database dumping fails. Pre-v3.x mode.', 'it-l10n-backupbuddy' ) . '</span>',
  608. 'rules' => 'required',
  609. ) );
  610. $settings_form->add_setting( array(
  611. 'type' => 'checkbox',
  612. 'name' => 'skip_database_dump',
  613. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  614. 'title' => __('Skip database dump on backup', 'it-l10n-backupbuddy' ),
  615. 'tip' => __('[Default: disabled] - (WARNING: This prevents BackupBuddy from backing up the database during any kind of backup. This is for troubleshooting / advanced usage only to work around being unable to backup the database.', 'it-l10n-backupbuddy' ),
  616. 'css' => '',
  617. 'after' => '<span class="description"> ' . __('Check if unable to backup database for some reason.', 'it-l10n-backupbuddy' ) . '</span>',
  618. 'rules' => 'required',
  619. ) );
  620. $settings_form->add_setting( array(
  621. 'type' => 'checkbox',
  622. 'name' => 'include_importbuddy',
  623. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  624. 'title' => __('Include ImportBuddy in full backup archive', 'it-l10n-backupbuddy' ),
  625. 'tip' => __('[Default: enabled] - When enabled, the importbuddy.php file will be included within the backup archive ZIP file. This file can be used to restore your site. Inclusion in the ZIP file itself insures you always have access to it. importbuddy.php is only included in full backups and only when this option is enabled.', 'it-l10n-backupbuddy' ),
  626. 'css' => '',
  627. 'after' => '<span class="description"> ' . __('Uncheck to skip adding ImportBuddy to backup archive.', 'it-l10n-backupbuddy' ) . '</span>',
  628. 'rules' => 'required',
  629. ) );
  630. $settings_form->add_setting( array(
  631. 'type' => 'checkbox',
  632. 'name' => 'alternative_zip_2',
  633. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  634. 'title' => __( 'Alternative zip system (BETA)', 'it-l10n-backupbuddy' ),
  635. 'tip' => __( '[Default: Disabled] Use if directed by support.', 'it-l10n-backupbuddy' ) . '</span>',
  636. 'css' => '',
  637. 'after' => '<span class="description"> Check if directed by support.</span>',
  638. 'rules' => 'required',
  639. ) );
  640. $settings_form->add_setting( array(
  641. 'type' => 'checkbox',
  642. 'name' => 'disable_zipmethod_caching',
  643. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  644. 'title' => __( 'Disable zip method caching', 'it-l10n-backupbuddy' ),
  645. 'tip' => __( '[Default: Disabled] Use if directed by support. Bypasses caching available zip methods so they are always displayed in logs. When unchecked BackupBuddy will cache command line zip testing for a few minutes so it does not run too often. This means that your backup status log may not always show the test results unless you disable caching.', 'it-l10n-backupbuddy' ) . '</span>',
  646. 'css' => '',
  647. 'after' => '<span class="description"> Check if you always want available zip methods to be tested and displayed<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in backup log files. This is useful for support to see if command line zip is failing.</span>',
  648. 'rules' => 'required',
  649. ) );
  650. $settings_form->add_setting( array(
  651. 'type' => 'checkbox',
  652. 'name' => 'ignore_zip_warnings',
  653. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  654. 'title' => __( 'Ignore zip archive warnings', 'it-l10n-backupbuddy' ),
  655. 'tip' => __( '[Default: Disabled] When enabled BackupBuddy will ignore non-fatal warnings encountered during the backup process such as inability to read or access a file, symlink problems, etc. These non-fatal warnings will still be logged.', 'it-l10n-backupbuddy' ) . '</span>',
  656. 'css' => '',
  657. 'after' => '<span class="description"> Check to ignore non-fatal errors when zipping files.</span>',
  658. 'rules' => 'required',
  659. ) );
  660. $settings_form->add_setting( array(
  661. 'type' => 'checkbox',
  662. 'name' => 'zip_viewer_enabled',
  663. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  664. 'title' => __( 'Allow viewing zip contents (BETA)', 'it-l10n-backupbuddy' ),
  665. 'tip' => __( '[Default: Disabled] This feature is currently in beta. If your server supports ZipArchive, when enabled you may select to `View zip contents` from the backup listing on the Backups page. This allows you to view a listing of files within a ZIP archive.', 'it-l10n-backupbuddy' ),
  666. 'css' => '',
  667. 'after' => '<span class="description"> ' . __('Check for Beta feature for viewing a list of files in an archive.', 'it-l10n-backupbuddy' ) . '</span>',
  668. 'rules' => 'required',
  669. ) );
  670. $settings_form->add_setting( array(
  671. 'type' => 'checkbox',
  672. 'name' => 'disable_https_local_ssl_verify',
  673. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  674. 'title' => __( 'Disable local SSL certificate verification', 'it-l10n-backupbuddy' ),
  675. 'tip' => __( '[Default: Disabled] When enabled, WordPress will skip local https SSL verification.', 'it-l10n-backupbuddy' ) . '</span>',
  676. 'css' => '',
  677. 'after' => '<span class="description"> Check if local SSL verification fails (ie. for loopbacks).</span>',
  678. 'rules' => 'required',
  679. ) );
  680. $settings_form->add_setting( array(
  681. 'type' => 'checkbox',
  682. 'name' => 'breakout_tables',
  683. 'options' => array( 'unchecked' => '0', 'checked' => '1' ),
  684. 'title' => __( 'Break out big table dumps into steps (beta)', 'it-l10n-backupbuddy' ),
  685. 'tip' => __( '[Default: Disabled] Currently in beta. Breaks up some commonly known database tables to be backed up separately rather than all at once. Helps with larger databases.', 'it-l10n-backupbuddy' ) . '</span>',
  686. 'css' => '',
  687. 'after' => '<span class="description"> Check if you want some commonly known to be large tables dumped in<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;separate steps. This is useful for large databases if dumps are timing out.</span>',
  688. 'rules' => 'required',
  689. ) );
  690. $settings_form->add_setting( array(
  691. 'type' => 'select',
  692. 'name' => 'backup_mode',
  693. 'title' => __('Manual backup mode', 'it-l10n-backupbuddy' ),
  694. 'options' => array(
  695. '1' => __( 'Classic (v1.x)', 'it-l10n-backupbuddy' ),
  696. '2' => __( 'Modern (v2.x)', 'it-l10n-backupbuddy' ),
  697. ),
  698. 'tip' => __('[Default: Modern] - If you are encountering difficulty backing up due to WordPress cron, HTTP Loopbacks, or other features specific to version 2.x you can try classic mode which runs like BackupBuddy v1.x did.', 'it-l10n-backupbuddy' ),
  699. 'rules' => 'required',
  700. ) );
  701. $settings_form->process(); // Handles processing the submitted form (if applicable).
  702. $settings_form->set_value( 'importbuddy_pass_hash', $importbuddy_pass_dummy_text );
  703. $settings_form->set_value( 'repairbuddy_pass_hash', $repairbuddy_pass_dummy_text );
  704. $data['settings_form'] = &$settings_form; // For use in view.
  705. /* END CONFIGURING PLUGIN SETTINGS FORM */
  706. flush();
  707. pb_backupbuddy::$classes['core']->periodic_cleanup( 43200, false ); // Cleans up and also makes sure directory security is always configured right on downloads after settings changes.
  708. flush();
  709. //$settings_form->clear_values();
  710. // Load settings view.
  711. pb_backupbuddy::load_view( 'settings', $data );
  712. ?>
  713. <style type="text/css">
  714. /* Core Styles - USED BY DIRECTORY EXCLUDER */
  715. .jqueryFileTree LI.directory { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/directory.png') 6px 6px no-repeat; }
  716. .jqueryFileTree LI.expanded { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/folder_open.png') 6px 6px no-repeat; }
  717. .jqueryFileTree LI.file { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/file.png') 6px 6px no-repeat; }
  718. .jqueryFileTree LI.wait { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/spinner.gif') 6px 6px no-repeat; }
  719. /* File Extensions*/
  720. .jqueryFileTree LI.ext_3gp { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/film.png') 6px 6px no-repeat; }
  721. .jqueryFileTree LI.ext_afp { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/code.png') 6px 6px no-repeat; }
  722. .jqueryFileTree LI.ext_afpa { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/code.png') 6px 6px no-repeat; }
  723. .jqueryFileTree LI.ext_asp { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/code.png') 6px 6px no-repeat; }
  724. .jqueryFileTree LI.ext_aspx { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/code.png') 6px 6px no-repeat; }
  725. .jqueryFileTree LI.ext_avi { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/film.png') 6px 6px no-repeat; }
  726. .jqueryFileTree LI.ext_bat { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/application.png') 6px 6px no-repeat; }
  727. .jqueryFileTree LI.ext_bmp { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/picture.png') 6px 6px no-repeat; }
  728. .jqueryFileTree LI.ext_c { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/code.png') 6px 6px no-repeat; }
  729. .jqueryFileTree LI.ext_cfm { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/code.png') 6px 6px no-repeat; }
  730. .jqueryFileTree LI.ext_cgi { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/code.png') 6px 6px no-repeat; }
  731. .jqueryFileTree LI.ext_com { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/application.png') 6px 6px no-repeat; }
  732. .jqueryFileTree LI.ext_cpp { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/code.png') 6px 6px no-repeat; }
  733. .jqueryFileTree LI.ext_css { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/css.png') 6px 6px no-repeat; }
  734. .jqueryFileTree LI.ext_doc { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/doc.png') 6px 6px no-repeat; }
  735. .jqueryFileTree LI.ext_exe { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/application.png') 6px 6px no-repeat; }
  736. .jqueryFileTree LI.ext_gif { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/picture.png') 6px 6px no-repeat; }
  737. .jqueryFileTree LI.ext_fla { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/flash.png') 6px 6px no-repeat; }
  738. .jqueryFileTree LI.ext_h { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/code.png') 6px 6px no-repeat; }
  739. .jqueryFileTree LI.ext_htm { background: url('<?php echo pb_backupbuddy::plugin_url(); ?>/images/filetree/html.png') 6px 6px no-repeat; }
  740. .jqueryFileTree LI.ext_html {

Large files files are truncated, but you can click here to view the full file