| 1 |
<?php |
| 2 |
/** |
| 3 |
* Destination ftp |
| 4 |
* |
| 5 |
* @package wpdbbkp |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! function_exists( 'add_action' ) ) { |
| 9 |
header( 'Status: 403 Forbidden' ); |
| 10 |
header( 'HTTP/1.1 403 Forbidden' ); |
| 11 |
exit(); |
| 12 |
} |
| 13 |
|
| 14 |
if ( ! current_user_can( 'manage_options' ) ) { |
| 15 |
header( 'Status: 403 Forbidden' ); |
| 16 |
header( 'HTTP/1.1 403 Forbidden' ); |
| 17 |
exit(); |
| 18 |
} |
| 19 |
|
| 20 |
?> |
| 21 |
<p><strong>Here's a list of BackupBreeze in your repository:</strong></p> |
| 22 |
<?php |
| 23 |
/** |
| 24 |
* Set up variables |
| 25 |
* |
| 26 |
* @package wpdbbkp |
| 27 |
*/ |
| 28 |
$host = get_option( 'snapshot_ftp_host' ); |
| 29 |
$user = get_option( 'snapshot_ftp_user' ); |
| 30 |
$pass = get_option( 'snapshot_ftp_pass' ); |
| 31 |
$subdir = get_option( 'snapshot_ftp_subdir' ); |
| 32 |
if ( '' === $subdir ) { |
| 33 |
$subdir = '/'; |
| 34 |
} |
| 35 |
|
| 36 |
// If in WP Dashboard or Admin Panels. |
| 37 |
if ( is_admin() ) { |
| 38 |
// If user has WP manage options permissions. |
| 39 |
if ( current_user_can( 'manage_options' ) ) { |
| 40 |
$conn_id = ftp_connect( $host ); |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
// Login with username and password. |
| 45 |
$login_result = ftp_login( $conn_id, $user, $pass ); |
| 46 |
|
| 47 |
// Get contents of the current directory. |
| 48 |
$contents = ftp_nlist( $conn_id, "$subdir/*.tar" ); |
| 49 |
|
| 50 |
?> |
| 51 |
<ol></em> |
| 52 |
|
| 53 |
<?php |
| 54 |
foreach ( $contents as $key => $value ) { |
| 55 |
echo '<li>' . esc_attr( substr( $value, ( strlen( $subdir ) ) ) ) . '</li>'; |
| 56 |
} |
| 57 |
?> |
| 58 |
</ol> |
| 59 |
<p><br /> |
| 60 |
<em><?php echo esc_html__('This section shows a list of Backup in your repository. ', 'wpdbbkp') ?></em></p> |
| 61 |
<p><em><?php echo esc_html__("If you're using the Auto-Delete option under Automation: ", 'wpdbbkp') ?> <br /> |
| 62 |
</em><em><?php echo esc_html__('the files at the bottom of this list will be deleted, the ones at the top will stay in place. ', 'wpdbbkp') ?></em> |
| 63 |
<?php |
| 64 |
ftp_close( $conn_id ); |
| 65 |
?> |
| 66 |
</p> |
| 67 |
|