예제 #1
0
function wfu_clean_log_prompt()
{
    $siteurl = site_url();
    if (!current_user_can('manage_options')) {
        return wfu_manage_mainmenu();
    }
    $echo_str = "\n" . '<div class="wrap">';
    $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
    $echo_str .= "\n\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=maintenance_actions" class="button" title="go back">Go back</a>';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n\t" . '<h2 style="margin-bottom: 10px;">Clean Database Log</h2>';
    $echo_str .= "\n\t" . '<form enctype="multipart/form-data" name="clean_log" id="clean_log" method="post" action="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload" class="validate">';
    $nonce = wp_nonce_field('wfu_clean_log', '_wpnonce', false, false);
    $nonce_ref = wp_referer_field(false);
    $echo_str .= "\n\t\t" . $nonce;
    $echo_str .= "\n\t\t" . $nonce_ref;
    $echo_str .= "\n\t\t" . '<input type="hidden" name="action" value="clean_log">';
    $echo_str .= "\n\t\t" . '<label>Are you sure that you want to clean the database log? This will erase all file data kept by the plugin in the database. Files uploaded by the plugin will be maintained, however all relevant information, such as user data, will be erased.</label><br/>';
    $echo_str .= "\n\t\t" . '<p class="submit">';
    $echo_str .= "\n\t\t\t" . '<input type="submit" class="button-primary" name="submit" value="Yes">';
    $echo_str .= "\n\t\t\t" . '<input type="submit" class="button-primary" name="submit" value="Cancel">';
    $echo_str .= "\n\t\t" . '</p>';
    $echo_str .= "\n\t" . '</form>';
    $echo_str .= "\n" . '</div>';
    return $echo_str;
}
예제 #2
0
function wordpress_file_upload_manage_dashboard()
{
    $_POST = stripslashes_deep($_POST);
    $_GET = stripslashes_deep($_GET);
    $action = !empty($_POST['action']) ? $_POST['action'] : (!empty($_GET['action']) ? $_GET['action'] : '');
    $dir = !empty($_POST['dir']) ? $_POST['dir'] : (!empty($_GET['dir']) ? $_GET['dir'] : '');
    $file = !empty($_POST['file']) ? $_POST['file'] : (!empty($_GET['file']) ? $_GET['file'] : '');
    $data_enc = !empty($_POST['data']) ? $_POST['data'] : (!empty($_GET['data']) ? $_GET['data'] : '');
    $postid = !empty($_POST['postid']) ? $_POST['postid'] : (!empty($_GET['postid']) ? $_GET['postid'] : '');
    $nonce = !empty($_POST['nonce']) ? $_POST['nonce'] : (!empty($_GET['nonce']) ? $_GET['nonce'] : '');
    $tag = !empty($_POST['tag']) ? $_POST['tag'] : (!empty($_GET['tag']) ? $_GET['tag'] : '');
    $echo_str = "";
    if ($action == 'edit_settings') {
        wfu_update_settings();
        $echo_str = wfu_manage_settings();
    } elseif ($action == 'shortcode_composer') {
        $echo_str = wfu_shortcode_composer();
    } elseif ($action == 'file_browser') {
        $echo_str = wfu_browse_files($dir);
    } elseif ($action == 'view_log') {
        $echo_str = wfu_view_log();
    } elseif ($action == 'rename_file' && $file != "") {
        $echo_str = wfu_rename_file_prompt($file, 'file', false);
    } elseif ($action == 'rename_dir' && $file != "") {
        $echo_str = wfu_rename_file_prompt($file, 'dir', false);
    } elseif ($action == 'renamefile' && $file != "") {
        if (wfu_rename_file($file, 'file')) {
            $echo_str = wfu_browse_files($dir);
        } else {
            $echo_str = wfu_rename_file_prompt($file, 'file', true);
        }
    } elseif ($action == 'renamedir' && $file != "") {
        if (wfu_rename_file($file, 'dir')) {
            $echo_str = wfu_browse_files($dir);
        } else {
            $echo_str = wfu_rename_file_prompt($file, 'dir', true);
        }
    } elseif ($action == 'delete_file' && $file != "") {
        $echo_str = wfu_delete_file_prompt($file, 'file');
    } elseif ($action == 'delete_dir' && $file != "") {
        $echo_str = wfu_delete_file_prompt($file, 'dir');
    } elseif ($action == 'deletefile' && $file != "") {
        wfu_delete_file($file, 'file');
        $echo_str = wfu_browse_files($dir);
    } elseif ($action == 'deletedir' && $file != "") {
        wfu_delete_file($file, 'dir');
        $echo_str = wfu_browse_files($dir);
    } elseif ($action == 'create_dir') {
        $echo_str = wfu_create_dir_prompt($dir, false);
    } elseif ($action == 'createdir') {
        if (wfu_create_dir($dir)) {
            $echo_str = wfu_browse_files($dir);
        } else {
            $echo_str = wfu_create_dir_prompt($dir, true);
        }
    } elseif ($action == 'file_details' && $file != "") {
        $echo_str = wfu_file_details($file, false);
    } elseif ($action == 'edit_filedetails' && $file != "") {
        wfu_edit_filedetails($file);
        $echo_str = wfu_file_details($file, false);
    } elseif ($action == 'maintenance_actions') {
        $echo_str = wfu_maintenance_actions();
    } elseif ($action == 'sync_db') {
        $affected_items = wfu_sync_database();
        $echo_str = wfu_maintenance_actions('Database updated. ' . $affected_items . ' items where affected.');
    } elseif ($action == 'clean_log_ask') {
        $echo_str = wfu_clean_log_prompt();
    } elseif ($action == 'clean_log') {
        $ret = wfu_clean_log();
        if ($ret <= -1) {
            $echo_str = wfu_maintenance_actions();
        } else {
            $echo_str = wfu_maintenance_actions('Database cleaned. ' . $ret . ' items where affected.');
        }
    } elseif ($action == 'plugin_settings') {
        $echo_str = wfu_manage_settings();
    } elseif ($action == 'add_shortcode' && $postid != "" && $nonce != "" && $tag != "") {
        if ($_SESSION['wfu_add_shortcode_ticket_for_' . $tag] != $nonce) {
            $echo_str = wfu_manage_mainmenu();
        } elseif (wfu_add_shortcode($postid, $tag)) {
            $echo_str = wfu_manage_mainmenu();
        } else {
            $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_ADD_SHORTCODE_REJECTED);
        }
        $_SESSION['wfu_add_shortcode_ticket'] = 'noticket';
    } elseif ($action == 'edit_shortcode' && $data_enc != "" && $tag != "") {
        $data = wfu_decode_array_from_string(wfu_get_shortcode_data_from_safe($data_enc));
        if ($data['post_id'] == "" || wfu_check_edit_shortcode($data)) {
            wfu_shortcode_composer($data, $tag);
        } else {
            $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_EDIT_SHORTCODE_REJECTED);
        }
    } elseif ($action == 'delete_shortcode' && $data_enc != "") {
        $data = wfu_decode_array_from_string(wfu_get_shortcode_data_from_safe($data_enc));
        if (wfu_check_edit_shortcode($data)) {
            $echo_str = wfu_delete_shortcode_prompt($data_enc);
        } else {
            $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_DELETE_SHORTCODE_REJECTED);
        }
    } elseif ($action == 'deleteshortcode' && $data_enc != "") {
        $data = wfu_decode_array_from_string(wfu_get_shortcode_data_from_safe($data_enc));
        if (wfu_check_edit_shortcode($data)) {
            if (wfu_delete_shortcode($data)) {
                wfu_clear_shortcode_data_from_safe($data_enc);
            }
            $echo_str = wfu_manage_mainmenu();
        } else {
            $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_DELETE_SHORTCODE_REJECTED);
        }
    } else {
        $echo_str = wfu_manage_mainmenu();
    }
    echo $echo_str;
}
예제 #3
0
function wordpress_file_upload_manage_dashboard()
{
    $_POST = stripslashes_deep($_POST);
    $_GET = stripslashes_deep($_GET);
    $action = !empty($_POST['action']) ? $_POST['action'] : (!empty($_GET['action']) ? $_GET['action'] : '');
    $dir = !empty($_POST['dir']) ? $_POST['dir'] : (!empty($_GET['dir']) ? $_GET['dir'] : '');
    $file = !empty($_POST['file']) ? $_POST['file'] : (!empty($_GET['file']) ? $_GET['file'] : '');
    $data_enc = !empty($_POST['data']) ? $_POST['data'] : (!empty($_GET['data']) ? $_GET['data'] : '');
    $echo_str = "";
    if ($action == 'edit_settings') {
        wfu_update_settings();
        $echo_str = wfu_manage_settings();
    } elseif ($action == 'shortcode_composer') {
        $echo_str = wfu_shortcode_composer();
    } elseif ($action == 'file_browser') {
        $echo_str = wfu_browse_files($dir);
    } elseif ($action == 'view_log') {
        $echo_str = wfu_view_log();
    } elseif ($action == 'rename_file' && $file != "") {
        $echo_str = wfu_rename_file_prompt($file, 'file', false);
    } elseif ($action == 'rename_dir' && $file != "") {
        $echo_str = wfu_rename_file_prompt($file, 'dir', false);
    } elseif ($action == 'renamefile' && $file != "") {
        if (wfu_rename_file($file, 'file')) {
            $echo_str = wfu_browse_files($dir);
        } else {
            $echo_str = wfu_rename_file_prompt($file, 'file', true);
        }
    } elseif ($action == 'renamedir' && $file != "") {
        if (wfu_rename_file($file, 'dir')) {
            $echo_str = wfu_browse_files($dir);
        } else {
            $echo_str = wfu_rename_file_prompt($file, 'dir', true);
        }
    } elseif ($action == 'delete_file' && $file != "") {
        $echo_str = wfu_delete_file_prompt($file, 'file');
    } elseif ($action == 'delete_dir' && $file != "") {
        $echo_str = wfu_delete_file_prompt($file, 'dir');
    } elseif ($action == 'deletefile' && $file != "") {
        wfu_delete_file($file, 'file');
        $echo_str = wfu_browse_files($dir);
    } elseif ($action == 'deletedir' && $file != "") {
        wfu_delete_file($file, 'dir');
        $echo_str = wfu_browse_files($dir);
    } elseif ($action == 'create_dir') {
        $echo_str = wfu_create_dir_prompt($dir, false);
    } elseif ($action == 'createdir') {
        if (wfu_create_dir($dir)) {
            $echo_str = wfu_browse_files($dir);
        } else {
            $echo_str = wfu_create_dir_prompt($dir, true);
        }
    } elseif ($action == 'file_details' && $file != "") {
        $echo_str = wfu_file_details($file, false);
    } elseif ($action == 'edit_filedetails' && $file != "") {
        wfu_edit_filedetails($file);
        $echo_str = wfu_file_details($file, false);
    } elseif ($action == 'sync_db') {
        $affected_items = wfu_sync_database();
        $echo_str = wfu_manage_mainmenu('Database updated. ' . $affected_items . ' items where affected.');
    } elseif ($action == 'plugin_settings') {
        $echo_str = wfu_manage_settings();
    } elseif ($action == 'edit_shortcode' && $data_enc != "") {
        $data = wfu_decode_array_from_string($data_enc);
        if (wfu_check_edit_shortcode($data)) {
            wfu_shortcode_composer($data);
        } else {
            $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_EDIT_SHORTCODE_REJECTED);
        }
    } elseif ($action == 'delete_shortcode' && $data_enc != "") {
        $data = wfu_decode_array_from_string($data_enc);
        if (wfu_check_edit_shortcode($data)) {
            $echo_str = wfu_delete_shortcode_prompt($data);
        } else {
            $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_DELETE_SHORTCODE_REJECTED);
        }
    } elseif ($action == 'deleteshortcode' && $data_enc != "") {
        $data = wfu_decode_array_from_string($data_enc);
        if (wfu_check_edit_shortcode($data)) {
            wfu_delete_shortcode($data);
            $echo_str = wfu_manage_mainmenu();
        } else {
            $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_DELETE_SHORTCODE_REJECTED);
        }
    } else {
        $echo_str = wfu_manage_mainmenu();
    }
    echo $echo_str;
}