Exemple #1
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;
}
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;
}