/**
 * exports a list of droplets
 *
 * @access public
 * @param  array   $list      - list of droplet IDs
 * @param  string  $filename  - name part of the zip file to export to (optional)
 * @param  string  $export_id - single droplet ID, will overwrite $list!
 * @param  boolean $return_details - wether to return details about added files
 * @return string            - result of wbce_export_droplets()
 **/
function wbce_export_droplets($list, $filename = 'drop_export', $export_id = 0, $return_details = false)
{
    global $database, $admin, $MESSAGE;
    $name = NULL;
    if ($export_id != 0) {
        $list = $export_id;
    }
    if (!is_array($list)) {
        $list = array($list);
    }
    if (count($list) < 1 and $export_id == 0) {
        return '<div class="drfail">Please mark some Droplets first!</div>';
    }
    // get the droplet(s) data
    $droplets = array();
    foreach ($list as $id) {
        $result = $database->query(sprintf("SELECT * FROM `%smod_droplets` WHERE id='%d'", TABLE_PREFIX, $id));
        if ($result->numRows() > 0) {
            $droplets[] = $result->fetchRow();
        }
    }
    // if there's only a single droplet to export, name the zip-file after this droplet
    if (count($list) === 1) {
        $filename = 'droplet_' . $droplets[0]['name'];
    }
    // save
    return wbce_backup_droplets($droplets, $filename, $return_details);
}
     $droplet_id = intval($_GET['droplet_id']);
     // Get header and footer
     $query_content = $database->query(sprintf("SELECT * FROM `%smod_droplets` WHERE `id` = '%d'", TABLE_PREFIX, $droplet_id));
     $fetch_content = $query_content->fetchRow(MYSQL_ASSOC);
     $twig_data['content'] = wbce_twig_display(array('data' => $fetch_content), 'modify', true);
     break;
     // ----- create full backup -----
 // ----- create full backup -----
 case 'backup_droplets':
     $query_droplets = $database->query(sprintf("SELECT * FROM `%smod_droplets`", TABLE_PREFIX));
     $list = array();
     while ($droplet = $query_droplets->fetchRow()) {
         $list[] = $droplet;
     }
     // backup
     $twig_data['content'] = wbce_backup_droplets($list);
     $twig_data['more_header_links'] = $DR_TEXT['BACKUP'];
     break;
     // ----- manage backups -----
 // ----- manage backups -----
 case 'manage_backups':
     $backup_files = wbce_find_backups(WB_PATH . '/modules/droplets/export/');
     // file to delete?
     if (isset($_GET['del'])) {
         if ($_GET['del'] !== 'all') {
             if (file_exists(WB_PATH . '/modules/droplets/export/' . $_GET['del'])) {
                 unlink(WB_PATH . '/modules/droplets/export/' . $_GET['del']);
             }
         } else {
             foreach ($backup_files as $file) {
                 unlink(WB_PATH . '/modules/droplets/export/' . $file);