!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/uploads/script/vendor/maatwebsite/excel/src/   drwxr-xr-x
Free 13.41 GB of 57.97 GB (23.13%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     Writer.php (6.64 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace Maatwebsite\Excel;

use 
Maatwebsite\Excel\Cache\CacheManager;
use 
Maatwebsite\Excel\Concerns\WithCustomValueBinder;
use 
Maatwebsite\Excel\Concerns\WithEvents;
use 
Maatwebsite\Excel\Concerns\WithMultipleSheets;
use 
Maatwebsite\Excel\Concerns\WithProperties;
use 
Maatwebsite\Excel\Concerns\WithTitle;
use 
Maatwebsite\Excel\Events\BeforeExport;
use 
Maatwebsite\Excel\Events\BeforeWriting;
use 
Maatwebsite\Excel\Factories\WriterFactory;
use 
Maatwebsite\Excel\Files\RemoteTemporaryFile;
use 
Maatwebsite\Excel\Files\TemporaryFile;
use 
Maatwebsite\Excel\Files\TemporaryFileFactory;
use 
PhpOffice\PhpSpreadsheet\Cell\Cell;
use 
PhpOffice\PhpSpreadsheet\IOFactory;
use 
PhpOffice\PhpSpreadsheet\Spreadsheet;

class 
Writer
{
    use 
DelegatedMacroableHasEventBus;

    
/**
     * @var Spreadsheet
     */
    
protected $spreadsheet;

    
/**
     * @var object
     */
    
protected $exportable;

    
/**
     * @var TemporaryFileFactory
     */
    
protected $temporaryFileFactory;

    
/**
     * @param TemporaryFileFactory $temporaryFileFactory
     */
    
public function __construct(TemporaryFileFactory $temporaryFileFactory)
    {
        
$this->temporaryFileFactory $temporaryFileFactory;

        
$this->setDefaultValueBinder();
    }

    
/**
     * @param object $export
     * @param string $writerType
     *
     * @return TemporaryFile
     * @throws \PhpOffice\PhpSpreadsheet\Exception
     */
    
public function export($exportstring $writerType): TemporaryFile
    
{
        
$this->open($export);

        
$sheetExports = [$export];
        if (
$export instanceof WithMultipleSheets) {
            
$sheetExports $export->sheets();
        }

        foreach (
$sheetExports as $sheetExport) {
            
$this->addNewSheet()->export($sheetExport);
        }

        return 
$this->write($export$this->temporaryFileFactory->makeLocal(nullstrtolower($writerType)), $writerType);
    }

    
/**
     * @param object $export
     *
     * @return $this
     */
    
public function open($export)
    {
        
$this->exportable $export;

        if (
$export instanceof WithEvents) {
            
$this->registerListeners($export->registerEvents());
        }

        
$this->exportable  $export;
        
$this->spreadsheet = new Spreadsheet;
        
$this->spreadsheet->disconnectWorksheets();

        if (
$export instanceof WithCustomValueBinder) {
            
Cell::setValueBinder($export);
        }

        
$this->handleDocumentProperties($export);

        
$this->raise(new BeforeExport($this$this->exportable));

        return 
$this;
    }

    
/**
     * @param TemporaryFile $tempFile
     * @param string        $writerType
     *
     * @return Writer
     * @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
     */
    
public function reopen(TemporaryFile $tempFilestring $writerType)
    {
        
$reader            IOFactory::createReader($writerType);
        
$this->spreadsheet $reader->load($tempFile->sync()->getLocalPath());

        return 
$this;
    }

    
/**
     * @param object        $export
     * @param TemporaryFile $temporaryFile
     * @param string        $writerType
     *
     * @return TemporaryFile
     * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
     * @throws \PhpOffice\PhpSpreadsheet\Exception
     */
    
public function write($exportTemporaryFile $temporaryFilestring $writerType): TemporaryFile
    
{
        
$this->exportable $export;

        
$this->spreadsheet->setActiveSheetIndex(0);

        
$this->raise(new BeforeWriting($this$this->exportable));

        
$writer WriterFactory::make(
            
$writerType,
            
$this->spreadsheet,
            
$export
        
);

        
$writer->save(
            
$path $temporaryFile->getLocalPath()
        );

        if (
$temporaryFile instanceof RemoteTemporaryFile) {
            
$temporaryFile->updateRemote();
        }

        
$this->clearListeners();
        
$this->spreadsheet->disconnectWorksheets();
        unset(
$this->spreadsheet);
        
app(CacheManager::class)->flush();

        return 
$temporaryFile;
    }

    
/**
     * @param int|null $sheetIndex
     *
     * @return Sheet
     * @throws \PhpOffice\PhpSpreadsheet\Exception
     */
    
public function addNewSheet(int $sheetIndex null)
    {
        return new 
Sheet($this->spreadsheet->createSheet($sheetIndex));
    }

    
/**
     * @return Spreadsheet
     */
    
public function getDelegate()
    {
        return 
$this->spreadsheet;
    }

    
/**
     * @return $this
     */
    
public function setDefaultValueBinder()
    {
        
Cell::setValueBinder(
            
app(config('excel.value_binder.default'DefaultValueBinder::class))
        );

        return 
$this;
    }

    
/**
     * @param int $sheetIndex
     *
     * @return Sheet
     * @throws \PhpOffice\PhpSpreadsheet\Exception
     */
    
public function getSheetByIndex(int $sheetIndex)
    {
        return new 
Sheet($this->getDelegate()->getSheet($sheetIndex));
    }

    
/**
     * @param string $concern
     *
     * @return bool
     */
    
public function hasConcern($concern): bool
    
{
        return 
$this->exportable instanceof $concern;
    }

    
/**
     * @param object $export
     */
    
protected function handleDocumentProperties($export)
    {
        
$properties config('excel.exports.properties', []);

        if (
$export instanceof WithProperties) {
            
$properties array_merge($properties$export->properties());
        }

        if (
$export instanceof WithTitle) {
            
$properties array_merge($properties, ['title' => $export->title()]);
        }

        
$props $this->spreadsheet->getProperties();

        foreach (
array_filter($properties) as $property => $value) {
            switch (
$property) {
                case 
'title':
                    
$props->setTitle($value);
                    break;
                case 
'description':
                    
$props->setDescription($value);
                    break;
                case 
'creator':
                    
$props->setCreator($value);
                    break;
                case 
'lastModifiedBy':
                    
$props->setLastModifiedBy($value);
                    break;
                case 
'subject':
                    
$props->setSubject($value);
                    break;
                case 
'keywords':
                    
$props->setKeywords($value);
                    break;
                case 
'category':
                    
$props->setCategory($value);
                    break;
                case 
'manager':
                    
$props->setManager($value);
                    break;
                case 
'company':
                    
$props->setCompany($value);
                    break;
            }
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0069 ]--