Пример #1
0
} else {
    die('Error #844893: Invalid destination ID.');
}
$urlPrefix = pb_backupbuddy::ajax_url('remoteClient') . '&destination_id=' . $destinationID;
require_once pb_backupbuddy::plugin_path() . '/destinations/gdrive/init.php';
$settings = array_merge(pb_backupbuddy_destination_gdrive::$default_settings, $settings);
$folderID = $settings['folderID'];
if ('' == $folderID) {
    $folderID = 'root';
}
// 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 or try again.');
        }
    }
    if ($deleted_files > 0) {
        pb_backupbuddy::alert('Deleted ' . $deleted_files . ' file(s).');
    }
    echo '<br>';
}
// Download link
if ('' != pb_backupbuddy::_GET('downloadlink_file')) {
    $fileMeta = pb_backupbuddy_destination_gdrive::getFileMeta($settings, pb_backupbuddy::_GET('downloadlink_file'));
    pb_backupbuddy::alert('<a href="' . $fileMeta->alternateLink . '" target="_new">Click here</a> to view & download this file from Google Drive. You must log in to Google to access it.');