/var/www/(Del)hsihk.com/wp-content/plugins/backupbuddy/destinations/_gdrive/_manage.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
<?php
// Settings.
if ( isset( pb_backupbuddy::$options['remote_destinations'][pb_backupbuddy::_GET('destination_id')] ) ) {
    
$settings = &pb_backupbuddy::$options['remote_destinations'][pb_backupbuddy::_GET('destination_id')];
} else {
    die( 
'Error #844893: Invalid destination ID.' );
}
$urlPrefix pb_backupbuddy::ajax_url'remoteClient' ) . '&destination_id=' htmlentitiespb_backupbuddy::_GET'destination_id' ) );


require_once( 
pb_backupbuddy::plugin_path() . '/destinations/gdrive/init.php' );



// Handle deletion.
if ( pb_backupbuddy::_POST'bulk_action' ) == 'delete_backup' ) {
    
pb_backupbuddy::verify_nonce();
    
$deleted_files 0;
    foreach( (array)
pb_backupbuddy::_POST'items' ) as $item ) {
        
        
$response pb_backupbuddy_destination_gdrive::deleteFile$settings$item );
        if ( 
true === $response ) {
            
$deleted_files++;
        } else {
            
pb_backupbuddy::alert'Error: Unable to delete `' $item '`. Verify permissions.' );
        }
        
        
    }
    
    if ( 
$deleted_files ) {
        
pb_backupbuddy::alert'Deleted ' $deleted_files ' file(s).' );
    }
    echo 
'<br>';
}
?>


<span id="backupbuddy_gdrive_loading"><h3><img src="<?php echo pb_backupbuddy::plugin_url(); ?>/images/loading.gif" alt="' . __('Loading...', 'it-l10n-backupbuddy' ) . '" title="' . __('Loading...', 'it-l10n-backupbuddy' ) . '" width="16" height="16" style="vertical-align: -3px;"> <?php _e'Loading...''it-l10n-backupbuddy' ); ?></h3></span>


<?php
pb_backupbuddy
::flush();


$files pb_backupbuddy_destination_gdrive::listFiles$settings"title contains 'backup'" );
if ( 
false === $files ) {
    die( 
'Error #834843: Error attempting to list files.' );
}
?>
<script>jQuery( '#backupbuddy_gdrive_loading' ).hide();</script>
<?php

/*
echo '<pre>';
print_r( $files );
echo '</pre>';
*/

$backup_files = array();
foreach( 
$files as $file ) {
    
//echo 'file: ' .$file->originalFilename . '<br>';
    
if ( '' == $file->originalFilename ) {
        continue;
    }
    
    
$created strtotime$file->createdDate );
    
    
$backup_files$file->id ] = array(
        array( 
$file->id$file->originalFilename ),
        
pb_backupbuddy::$format->datepb_backupbuddy::$format->localize_time$created ) ) . '<br /><span class="description">(' pb_backupbuddy::$format->time_ago$created ) . ' ago)</span>',
        
pb_backupbuddy::$format->file_size$file->fileSize ),
        
'??moose??'
    
);
}



// Render table listing files.
if ( count$backup_files ) == ) {
    echo 
'<b>';
    
_e'You have not completed sending any backups to Google Drive for this site yet.''it-l10n-backupbuddy' );
    echo 
'</b>';
} else {
    
pb_backupbuddy::$ui->list_table(
        
$backup_files,
        array(
            
'action'        =>    pb_backupbuddy::ajax_url'remoteClient' ) . '&function=remoteClient&destination_id=' htmlentitiespb_backupbuddy::_GET'destination_id' ) ) . '&remote_path=' htmlentitiespb_backupbuddy::_GET'remote_path' ) ),
            
'columns'        =>    array( 'Backup File''Uploaded <img src="' pb_backupbuddy::plugin_url() . '/images/sort_down.png" style="vertical-align: 0px;" title="Sorted most recent first">''File Size''Type' ),
            
'hover_actions'    =>    array( $urlPrefix '&cpy_file=' => 'Copy to Local'$urlPrefix '&downloadlink_file=' => 'Get download link' ),
            
'hover_action_column_key'    =>    '0',
            
'bulk_actions'    =>    array( 'delete_backup' => 'Delete' ),
            
'css'            =>        'width: 100%;',
        )
    );
}