diff options
author | Dan Ungureanu <udan1107@gmail.com> | 2015-07-21 01:12:53 +0300 |
---|---|---|
committer | Dan Ungureanu <udan1107@gmail.com> | 2015-07-22 19:13:38 +0300 |
commit | 2b3febf65272edabaeeb7a7f0a5862fc87a1d4a2 (patch) | |
tree | 687b1e0e8945fdee99aabc41d5cb60122db0b801 /lint.php | |
parent | 86a4c3e32dcc2caea0d0f8a680fcf528a5f400a0 (diff) |
Localization.
Updated sql-parser library to udan11/sql-parser@e1b91ed.
Signed-off-by: Dan Ungureanu <udan1107@gmail.com>
Diffstat (limited to 'lint.php')
-rw-r--r-- | lint.php | 39 |
1 files changed, 20 insertions, 19 deletions
@@ -8,31 +8,32 @@ define('PHPMYADMIN', true); -// We load the minimum files required to check if the user is logged in. -require_once 'libraries/core.lib.php'; -require_once 'libraries/Config.class.php'; -$GLOBALS['PMA_Config'] = new PMA_Config(CONFIG_FILE); -require_once 'libraries/session.inc.php'; - -// If user is not logged in, he should not send any requests, so we exit here to -// avoid external requests. -if (empty($_SESSION['encryption_key'])) { - // Unauthorized access detected. - exit; -} +/** + * The SQL query to be analyzed. + * + * This does not need to be checked again XSS or MySQL injections because it is + * never executed, just parsed. + * + * The client, which will recieve the JSON response will decode the message and + * and any HTML fragments that are displayed to the user will be encoded anyway. + * + * @var string + */ +$sql_query = $_REQUEST['sql_query']; /** - * Loads the SQL lexer and parser, which are used to detect errors. + * Loading common files. Used to check for authorization, localization and to + * load the parsing library. */ -require_once 'libraries/sql-parser/autoload.php'; +require_once 'libraries/common.inc.php'; /** * Loads the linter. */ require_once 'libraries/Linter.class.php'; -// The input of this function does not need to be checked again XSS or MySQL -// injections because it is never executed, just parsed. -// The client, which will recieve the JSON response will decode the message and -// and any HTML fragments that are displayed to the user will be encoded anyway. -PMA_Linter::lint($_REQUEST['sql_query']); +// Disabling standard response. +$response = PMA_Response::getInstance(); +$response->disable(); + +echo json_encode(PMA_Linter::lint($sql_query)); |