403Webshell
Server IP : 89.108.64.180  /  Your IP : 216.73.216.229
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : www-root ( 1010)
PHP Version : 8.0.30
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/sadovaya-gelendgik.ru/wp-content/plugins/wp-reset/libs/pCloud/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/sadovaya-gelendgik.ru/wp-content/plugins/wp-reset/libs/pCloud/File.php
<?php

namespace pCloud;

use InvalidArgumentException;

class File {

	private $partSize;
	private $request;

	function __construct() {
		$this->request = new Request();
		$this->partSize = Config::$filePartSize;
	}

	public function getLink($fileId) {
		if (!is_int($fileId)) {
			throw new InvalidArgumentException("Invalid file id");
		}

		$params = array(
			"fileid" => $fileId
		);

		$response = $this->request->get("getfilelink", $params);
        
		return is_object($response) ? "https://".$response->hosts[0].$response->path : $response;
	}

	public function download($fileId, $destination = "") {
		if (!is_int($fileId)) {
			throw new InvalidArgumentException("Invalid file id");
		}

		$fileLink = $this->getLink($fileId);

		if (!empty($destination)) {
			$destination = str_replace(array("\\", "/"), DIRECTORY_SEPARATOR, $destination).DIRECTORY_SEPARATOR;
		}

		if (!empty($destination) && !is_dir($destination)) {
			if (!mkdir($destination, 0777)) {
				throw new Exception("Couldn't create destination folder");
			}
		}

        $parts = explode("/", $fileLink);
        $path = $destination.rawurldecode(end($parts));

		$source = fopen($fileLink, "rb");
		$file = fopen("{$path}.download", "wb");
		while (!feof($source)) {
			$content = fread($source, $this->partSize);
			fwrite($file, $content);
		}
		fclose($file);
		fclose($source);

        rename("{$path}.download", $path);

		return $path;
	}

	private function createUpload() {
		return $this->request->get("upload_create");
	}

	private function save($uploadId, $name, $folderId) {
		$params = array(
			"uploadid" => $uploadId,
			"name" => $name,
			"folderid" => $folderId
		);

		return $this->request->get("upload_save", $params);
	}

	private function write($params, $content) {
		return $this->request->put("upload_write", $params, $content);
	}

	public function upload($path, $folderId = 0, $filename = null) {
		if (!file_exists($path) || !is_file($path) || !is_readable($path)) {
			throw new Exception("Invalid file");
		}

		$parts = explode("/", $path);

		if (!$filename) {
			$filename = end($parts);
		}

		$upload = $this->createUpload();

		$params = array(
			"uploadid" => $upload->uploadid,
			"uploadoffset" => 0
		);

        
        $file = fopen($path, "r");

		while (!feof($file)) {
            $content = fread($file, $this->partSize);
            $this->write($params, $content);
   
			$params["uploadoffset"] += $this->partSize;
		}
		fclose($file);

		return $this->save($upload->uploadid, $filename, $folderId);
	}

	public function delete($fileId) {
		if (!is_int($fileId)) {
			throw new InvalidArgumentException("Invalid file id");
		}

		$params = array(
			"fileid" => $fileId
		);

		$response = $this->request->get("deletefile", $params);

		return is_object($response) ? $response->metadata->isdeleted : $response;
	}

	public function rename($fileId, $name) {
		if (!is_int($fileId)) {
			throw new InvalidArgumentException("Invalid file id");
		}

		if (!is_string($name) || strlen($name) < 1) {
			throw new InvalidArgumentException("Invalid file name");
		}

		$params = array(
			"fileid" => $fileId,
			"toname" => $name
		);

		return $this->request->get("renamefile", $params);
	}

	public function move($fileId, $folderId) {
		if (!is_int($fileId)) {
			throw new InvalidArgumentException("Invalid file id");
		}

		if (!is_int($folderId)) {
			throw new InvalidArgumentException("Invalid folder id");
		}

		$params = array(
			"fileid" => $fileId,
			"tofolderid" => $folderId
		);

		return $this->request->get("renamefile", $params);
	}

	public function copy($fileId, $folderId) {
		if (!is_int($fileId)) {
			throw new InvalidArgumentException("Invalid file id");
		}

		if (!is_int($folderId)) {
			throw new InvalidArgumentException("Invalid folder id");
		}

		$params = array(
			"fileid" => $fileId,
			"tofolderid" => $folderId
		);

		return $this->request->get("copyfile", $params);
	}

	public function getInfo($fileId) {
		if (!is_int($fileId)) {
			throw new InvalidArgumentException("Invalid file id");
		}

		$params = array(
			"fileid" => $fileId
		);

		return $this->request->get("checksumfile", $params);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit