Ejemplo n.º 1
0
if (isset($_GET['recover']) && file_exists(WB_PATH . '/modules/droplets/export/' . $_GET['recover'])) {
    $result = wb_unpack_and_import(WB_PATH . '/modules/droplets/export/' . $_GET['recover'], WB_PATH . '/temp/unzip/');
    // show errors
    if (isset($result['errors']) && is_array($result['errors']) && count($result['errors']) > 0) {
        echo '<div style="border: 1px solid #f00; padding: 5px; color: #f00; font-weight: bold;">', $DR_TEXT['IMPORT_ERRORS'], "<br />\n";
        foreach ($result['errors'] as $droplet => $error) {
            echo 'Droplet: ', $droplet, '<br />', '<span style="padding-left: 15px">', $error, '</span>';
        }
        echo "</div>\n";
    } else {
        $new = isset($result['imported']) ? $result['imported'] : array();
        echo '<div class="drok">', $result['count'], " ", $DR_TEXT['IMPORTED'], '</div>';
    }
}
if (isset($_REQUEST['export']) && $_REQUEST['export']) {
    wb_handle_export();
}
if (isset($_REQUEST['delete']) && $_REQUEST['delete']) {
    // Changed by PCWacht
    wb_handle_delete();
}
// ----- /added by WebBird, 2010-11-02 -----
?>

<h2><?php 
echo $TEXT['MODIFY'] . '/' . $TEXT['DELETE'] . ' ' . $DR_TEXT['DROPLETS'];
?>
</h2>
<?php 
// if ($loggedin_user == '1') {
if ($admin_user) {
function wb_handle_delete()
{
    global $database, $admin, $MESSAGE;
    $list = isset($_POST['markeddroplet']) ? $_POST['markeddroplet'] : array();
    if (!is_array($list)) {
        $list = array($list);
    }
    if (count($list) < 1) {
        // error message already set by wb_handle_export()
        return;
    }
    foreach ($list as $id) {
        // Added by PCWacht
        // Get id - needed $admin to be global!
        if (version_compare(WB_VERSION, '2.8.2', '>=') && WB_VERSION != "2.8.x") {
            $id = $admin->checkIDKEY($id, false, '');
            if (!$id) {
                $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
                exit;
            }
        }
        // First export before delete
        wb_handle_export($filename = 'delete_export', $export_id = $id);
        // End add
        $result = $database->query("DELETE FROM `" . TABLE_PREFIX . "mod_droplet`s WHERE `id`='{$id}'");
    }
}
        }
    } else {
        if (isset($_GET['droplet_id']) && is_numeric($_GET['droplet_id'])) {
            $droplet_id = intval($_GET['droplet_id']);
        } else {
            header("Location: " . ADMIN_URL . "/pages/index.php");
        }
    }
} else {
    $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $module_edit_link);
    exit;
}
// fake for wb_handle_export
$_POST['markeddroplet'] = array($droplet_id);
ob_start();
wb_handle_export('drop_export', $droplet_id);
ob_end_clean();
// check website baker platform (with WB 2.7, Admin-Tools were moved out of settings dialogue)
if (file_exists(ADMIN_PATH . '/admintools/tool.php')) {
    $admintool_link = ADMIN_URL . '/admintools/index.php';
    $module_edit_link = ADMIN_URL . '/admintools/tool.php?tool=droplets';
    $admin = new admin('admintools', 'admintools');
} else {
    $admintool_link = ADMIN_URL . '/settings/index.php?advanced=yes#administration_tools"';
    $module_edit_link = ADMIN_URL . '/settings/tool.php?tool=droplets';
    $admin = new admin('Settings', 'settings_advanced');
}
// Delete droplet
$database->query("DELETE FROM " . TABLE_PREFIX . "mod_droplets WHERE id = '{$droplet_id}' LIMIT 1");
// Check if there is a db error, otherwise say successful
if ($database->is_error()) {