403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.7
Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64
User : viralblo ( 1001)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/cwpsrv/var/services/pma_01-03-2025.bak/vendor/phpmyadmin/sql-parser/src/Utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/cwpsrv/var/services/pma_01-03-2025.bak/vendor/phpmyadmin/sql-parser/src/Utils/CLI.php
<?php

/**
 * CLI interface.
 */

namespace PhpMyAdmin\SqlParser\Utils;

use PhpMyAdmin\SqlParser\Context;
use PhpMyAdmin\SqlParser\Lexer;
use PhpMyAdmin\SqlParser\Parser;

/**
 * CLI interface.
 *
 * @category   Exceptions
 *
 * @license    https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
 */
class CLI
{
    public function mergeLongOpts(&$params, &$longopts)
    {
        foreach ($longopts as $value) {
            $value = rtrim($value, ':');
            if (isset($params[$value])) {
                $params[$value[0]] = $params[$value];
            }
        }
    }

    public function usageHighlight()
    {
        echo "Usage: highlight-query --query SQL [--format html|cli|text]\n";
    }

    public function getopt($opt, $long)
    {
        return getopt($opt, $long);
    }

    public function parseHighlight()
    {
        $longopts = array('help', 'query:', 'format:');
        $params = $this->getopt(
            'hq:f:', $longopts
        );
        if ($params === false) {
            return false;
        }
        $this->mergeLongOpts($params, $longopts);
        if (!isset($params['f'])) {
            $params['f'] = 'cli';
        }
        if (!in_array($params['f'], array('html', 'cli', 'text'))) {
            echo "ERROR: Invalid value for format!\n";

            return false;
        }

        return $params;
    }

    public function runHighlight()
    {
        $params = $this->parseHighlight();
        if ($params === false) {
            return 1;
        }
        if (isset($params['h'])) {
            $this->usageHighlight();

            return 0;
        }
        if (isset($params['q'])) {
            echo Formatter::format(
                $params['q'], array('type' => $params['f'])
            );
            echo "\n";

            return 0;
        }
        echo "ERROR: Missing parameters!\n";
        $this->usageHighlight();

        return 1;
    }

    public function usageLint()
    {
        echo "Usage: lint-query --query SQL\n";
    }

    public function parseLint()
    {
        $longopts = array('help', 'query:', 'context:');
        $params = $this->getopt(
            'hq:c:', $longopts
        );
        $this->mergeLongOpts($params, $longopts);

        return $params;
    }

    public function runLint()
    {
        $params = $this->parseLint();
        if ($params === false) {
            return 1;
        }
        if (isset($params['h'])) {
            $this->usageLint();

            return 0;
        }
        if (isset($params['c'])) {
            Context::load($params['c']);
        }
        if (isset($params['q'])) {
            $lexer = new Lexer($params['q'], false);
            $parser = new Parser($lexer->list);
            $errors = Error::get(array($lexer, $parser));
            if (count($errors) == 0) {
                return 0;
            }
            $output = Error::format($errors);
            echo implode("\n", $output);
            echo "\n";

            return 10;
        }
        echo "ERROR: Missing parameters!\n";
        $this->usageLint();

        return 1;
    }

    public function usageTokenize()
    {
        echo "Usage: tokenize-query --query SQL\n";
    }

    public function parseTokenize()
    {
        $longopts = array('help', 'query:');
        $params = $this->getopt(
            'hq:', $longopts
        );
        $this->mergeLongOpts($params, $longopts);

        return $params;
    }

    public function runTokenize()
    {
        $params = $this->parseTokenize();
        if ($params === false) {
            return 1;
        }
        if (isset($params['h'])) {
            $this->usageTokenize();

            return 0;
        }
        if (isset($params['q'])) {
            $lexer = new Lexer($params['q'], false);
            foreach ($lexer->list->tokens as $idx => $token) {
                echo '[TOKEN ', $idx, "]\n";
                echo 'Type = ', $token->type, "\n";
                echo 'Flags = ', $token->flags, "\n";
                echo 'Value = ';
                var_export($token->value);
                echo "\n";
                echo 'Token = ';
                var_export($token->token);
                echo "\n";
                echo "\n";
            }

            return 0;
        }
        echo "ERROR: Missing parameters!\n";
        $this->usageTokenize();

        return 1;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit