checkParameters() public static method

Called by each script that needs parameters, it displays an error message and, by default, stops the execution. Not sure we could use a strMissingParameter message here, would have to check if the error message file is always available
public static checkParameters ( string[] $params, boolean $request = true ) : void
$params string[] The names of the parameters needed by the calling script
$request boolean Whether to include this list in checking for special params
return void
Ejemplo n.º 1
0
 */
if (isset($_REQUEST['set_col_prefs']) && $_REQUEST['set_col_prefs'] == true) {
    PMA_setColumnOrderOrVisibility($table, $db);
    // script has exited at this point
}
// Default to browse if no query set and we have table
// (needed for browsing from DefaultTabTable)
$tableLength = mb_strlen($table);
$dbLength = mb_strlen($db);
if (empty($sql_query) && $tableLength && $dbLength) {
    $sql_query = PMA_getDefaultSqlQueryForBrowse($db, $table);
    // set $goto to what will be displayed if query returns 0 rows
    $goto = '';
} else {
    // Now we can check the parameters
    Util::checkParameters(array('sql_query'));
}
/**
 * Parse and analyze the query
 */
require_once 'libraries/parse_analyze.lib.php';
list($analyzed_sql_results, $db, $table) = PMA_parseAnalyze($sql_query, $db);
// @todo: possibly refactor
extract($analyzed_sql_results);
/**
 * Check rights in case of DROP DATABASE
 *
 * This test may be bypassed if $is_js_confirmed = 1 (already checked with js)
 * but since a malicious user may pass this variable by url/form, we don't take
 * into account this case.
 */
Ejemplo n.º 2
0
<?php

/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Common includes for the database level views
 *
 * @package PhpMyAdmin
 */
use PMA\libraries\Message;
use PMA\libraries\Response;
use PMA\libraries\URL;
use PMA\libraries\Util;
if (!defined('PHPMYADMIN')) {
    exit;
}
PMA\libraries\Util::checkParameters(array('db'));
global $cfg;
global $db;
$is_show_stats = $cfg['ShowStats'];
$db_is_system_schema = $GLOBALS['dbi']->isSystemSchema($db);
if ($db_is_system_schema) {
    $is_show_stats = false;
}
/**
 * Defines the urls to return to in case of error in a sql statement
 */
$err_url_0 = 'index.php' . URL::getCommon();
$err_url = PMA\libraries\Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabDatabase'], 'database') . URL::getCommon(array('db' => $db));
/**
 * Ensures the database exists (else move to the "parent" script) and displays
 * headers