!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/   drwxrwxrwx
Free 12.95 GB of 57.97 GB (22.34%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace Webkul\Core;

use 
Illuminate\Support\Arr;
use 
Illuminate\Support\Collection;
use 
Illuminate\Support\Facades\Config;
use 
Webkul\Core\Repositories\CoreConfigRepository;
use 
Webkul\Core\SystemConfig\Item;

class 
SystemConfig
{
    
/**
     * Items array.
     */
    
public array $items = [];

    
/**
     * Create a new class instance.
     *
     * @return void
     */
    
public function __construct(protected CoreConfigRepository $coreConfigRepository) {}

    
/**
     * Add Item.
     */
    
public function addItem(Item $item): void
    
{
        
$this->items[] = $item;
    }

    
/**
     * Get all configuration items.
     */
    
public function getItems(): Collection
    
{
        if (! 
$this->items) {
            
$this->prepareConfigurationItems();
        }

        return 
collect($this->items)
            ->
sortBy('sort');
    }

    
/**
     * Retrieve Core Config
     */
    
private function retrieveCoreConfig(): array
    {
        static 
$items;

        if (
$items) {
            return 
$items;
        }

        return 
$items config('core_config');
    }

    
/**
     * Prepare configuration items.
     */
    
public function prepareConfigurationItems()
    {
        
$configWithDotNotation = [];

        foreach (
$this->retrieveCoreConfig() as $item) {
            
$configWithDotNotation[$item['key']] = $item;
        }

        
$configs Arr::undot(Arr::dot($configWithDotNotation));

        foreach (
$configs as $configItem) {
            
$subConfigItems $this->processSubConfigItems($configItem);

            
$this->addItem(new Item(
                
children$subConfigItems,
                
fields$configItem['fields'] ?? null,
                
icon$configItem['icon'] ?? null,
                
key$configItem['key'],
                
nametrans($configItem['name']),
                
route$configItem['route'] ?? null,
                
infotrans($configItem['info']) ?? null,
                
sort$configItem['sort'],
            ));
        }
    }

    
/**
     * Process sub config items.
     */
    
private function processSubConfigItems($configItem): Collection
    
{
        return 
collect($configItem)
            ->
sortBy('sort')
            ->
filter(fn ($value) => is_array($value) && isset($value['name']))
            ->
map(function ($subConfigItem) {
                
$configItemChildren $this->processSubConfigItems($subConfigItem);

                return new 
Item(
                    
children$configItemChildren,
                    
fields$subConfigItem['fields'] ?? null,
                    
icon$subConfigItem['icon'] ?? null,
                    
key$subConfigItem['key'],
                    
nametrans($subConfigItem['name']),
                    
infotrans($subConfigItem['info']) ?? null,
                    
route$subConfigItem['route'] ?? null,
                    
sort$subConfigItem['sort'] ?? null,
                );
            });
    }

    
/**
     * Get active configuration item.
     */
    
public function getActiveConfigurationItem(): ?Item
    
{
        if (! 
$slug request()->route('slug')) {
            return 
null;
        }

        
$activeItem $this->getItems()->where('key'$slug)->first() ?? null;

        if (! 
$activeItem) {
            return 
null;
        }

        if (
$slug2 request()->route('slug2')) {
            
$activeItem $activeItem->getChildren()[$slug2];
        }

        return 
$activeItem;
    }

    
/**
     * Get config field.
     */
    
public function getConfigField(string $fieldName): ?array
    {
        foreach (
$this->retrieveCoreConfig() as $coreData) {
            if (! isset(
$coreData['fields'])) {
                continue;
            }

            foreach (
$coreData['fields'] as $field) {
                
$name $coreData['key'].'.'.$field['name'];

                if (
$name == $fieldName) {
                    return 
$field;
                }
            }
        }

        return 
null;
    }

    
/**
     * Get default config.
     */
    
private function getDefaultConfig(string $field): mixed
    
{
        
$configFieldInfo $this->getConfigField($field);

        
$fields explode('.'$field);

        
array_shift($fields);

        
$field implode('.'$fields);

        return 
Config::get($field$configFieldInfo['default'] ?? null);
    }

    
/**
     * Retrieve information for configuration
     */
    
public function getConfigData(string $field): mixed
    
{
        
$coreConfigValue $this->coreConfigRepository->findOneWhere([
            
'code' => $field,
        ]);

        if (! 
$coreConfigValue) {
            return 
$this->getDefaultConfig($field);
        }

        return 
$coreConfigValue->value;
    }
}

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