Properly escape strings in MySQL statement values
Use *_real_escape string functions provided by connectors to escape strings while exporting Fix #12453 Signed-off-by: Deven Bansod <devenbansod.bits@gmail.com> Conflicts: libraries/server_privileges.lib.php
This commit is contained in:
parent
2fbf09ba2d
commit
f14cffdbe7
@ -305,7 +305,7 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) {
|
||||
SELECT *
|
||||
FROM ' . PMA\libraries\Util::backquote($GLOBALS['cfgRelation']['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['pdf_pages']) . '
|
||||
WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($GLOBALS['db'])
|
||||
WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($GLOBALS['db'])
|
||||
. '\'';
|
||||
$test_rs = PMA_queryAsControlUser(
|
||||
$test_query,
|
||||
|
||||
@ -114,7 +114,7 @@ $cfgRelation = PMA_getRelationsParam();
|
||||
$all_tables_query = ' SELECT table_name, MAX(version) as version FROM ' .
|
||||
PMA\libraries\Util::backquote($cfgRelation['db']) . '.' .
|
||||
PMA\libraries\Util::backquote($cfgRelation['tracking']) .
|
||||
' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($_REQUEST['db']) .
|
||||
' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($_REQUEST['db']) .
|
||||
'\' ' .
|
||||
' GROUP BY table_name' .
|
||||
' ORDER BY table_name ASC';
|
||||
|
||||
@ -120,13 +120,13 @@ if (! empty($sql_query)) {
|
||||
// making sure that :param does not apply values to :param1
|
||||
$sql_query = preg_replace(
|
||||
'/' . $quoted . '([^a-zA-Z0-9_])/',
|
||||
PMA\libraries\Util::sqlAddSlashes($replacement) . '${1}',
|
||||
$GLOBALS['dbi']->escapeString($replacement) . '${1}',
|
||||
$sql_query
|
||||
);
|
||||
// for parameters the appear at the end of the string
|
||||
$sql_query = preg_replace(
|
||||
'/' . $quoted . '$/',
|
||||
PMA\libraries\Util::sqlAddSlashes($replacement),
|
||||
$GLOBALS['dbi']->escapeString($replacement),
|
||||
$sql_query
|
||||
);
|
||||
}
|
||||
|
||||
@ -307,13 +307,13 @@ class DatabaseInterface
|
||||
if (true === $tbl_is_group) {
|
||||
$sql_where_table = 'AND t.`TABLE_NAME` LIKE \''
|
||||
. Util::escapeMysqlWildcards(
|
||||
Util::sqlAddSlashes($table)
|
||||
$GLOBALS['dbi']->escapeString($table)
|
||||
)
|
||||
. '%\'';
|
||||
} else {
|
||||
$sql_where_table = 'AND t.`TABLE_NAME` '
|
||||
. Util::getCollateForIS() . ' = \''
|
||||
. Util::sqlAddSlashes($table) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($table) . '\'';
|
||||
}
|
||||
} else {
|
||||
$sql_where_table = '';
|
||||
@ -489,9 +489,10 @@ class DatabaseInterface
|
||||
$needAnd = false;
|
||||
if ($table || (true === $tbl_is_group)) {
|
||||
$sql .= " `Name` LIKE '"
|
||||
. Util::escapeMysqlWildcards(
|
||||
Util::sqlAddSlashes($table, true)
|
||||
)
|
||||
.
|
||||
// Util::escapeMysqlWildcards(
|
||||
$this->escapeString($table, $link)
|
||||
// )
|
||||
. "%'";
|
||||
$needAnd = true;
|
||||
}
|
||||
@ -851,7 +852,7 @@ class DatabaseInterface
|
||||
// get table information from information_schema
|
||||
if (! empty($database)) {
|
||||
$sql_where_schema = 'WHERE `SCHEMA_NAME` LIKE \''
|
||||
. Util::sqlAddSlashes($database) . '\'';
|
||||
. $this->escapeString($database, $link) . '\'';
|
||||
} else {
|
||||
$sql_where_schema = '';
|
||||
}
|
||||
@ -1090,19 +1091,19 @@ class DatabaseInterface
|
||||
// get columns information from information_schema
|
||||
if (null !== $database) {
|
||||
$sql_wheres[] = '`TABLE_SCHEMA` = \''
|
||||
. Util::sqlAddSlashes($database) . '\' ';
|
||||
. $this->escapeString($database, $link) . '\' ';
|
||||
} else {
|
||||
$array_keys[] = 'TABLE_SCHEMA';
|
||||
}
|
||||
if (null !== $table) {
|
||||
$sql_wheres[] = '`TABLE_NAME` = \''
|
||||
. Util::sqlAddSlashes($table) . '\' ';
|
||||
. $this->escapeString($table, $link) . '\' ';
|
||||
} else {
|
||||
$array_keys[] = 'TABLE_NAME';
|
||||
}
|
||||
if (null !== $column) {
|
||||
$sql_wheres[] = '`COLUMN_NAME` = \''
|
||||
. Util::sqlAddSlashes($column) . '\' ';
|
||||
. $this->escapeString($column, $link) . '\' ';
|
||||
} else {
|
||||
$array_keys[] = 'COLUMN_NAME';
|
||||
}
|
||||
@ -1147,7 +1148,7 @@ class DatabaseInterface
|
||||
$sql = 'SHOW FULL COLUMNS FROM '
|
||||
. Util::backquote($database) . '.' . Util::backquote($table);
|
||||
if (null !== $column) {
|
||||
$sql .= " LIKE '" . Util::sqlAddSlashes($column, true) . "'";
|
||||
$sql .= " LIKE '" . $this->escapeString($column, $link) . "'";
|
||||
}
|
||||
|
||||
$columns = $this->fetchResult($sql, 'Field', null, $link);
|
||||
@ -1235,7 +1236,7 @@ class DatabaseInterface
|
||||
$sql = 'SHOW ' . ($full ? 'FULL' : '') . ' COLUMNS FROM '
|
||||
. Util::backquote($database) . '.' . Util::backquote($table)
|
||||
. (($column !== null) ? "LIKE '"
|
||||
. Util::sqlAddSlashes($column, true) . "'" : '');
|
||||
. $GLOBALS['dbi']->escapeString($column) . "'" : '');
|
||||
|
||||
return $sql;
|
||||
}
|
||||
@ -1475,7 +1476,7 @@ class DatabaseInterface
|
||||
}
|
||||
$result = $this->tryQuery(
|
||||
"SET collation_connection = '"
|
||||
. Util::sqlAddSlashes($GLOBALS['collation_connection'])
|
||||
. $this->escapeString($GLOBALS['collation_connection'], $link)
|
||||
. "';",
|
||||
$link,
|
||||
self::QUERY_STORE
|
||||
@ -1487,7 +1488,7 @@ class DatabaseInterface
|
||||
);
|
||||
$this->query(
|
||||
"SET collation_connection = '"
|
||||
. Util::sqlAddSlashes($default_collation)
|
||||
. $this->escapeString($GLOBALS['collation_connection'], $link)
|
||||
. "';",
|
||||
$link,
|
||||
self::QUERY_STORE
|
||||
@ -1871,13 +1872,13 @@ class DatabaseInterface
|
||||
. " `DTD_IDENTIFIER`"
|
||||
. " FROM `information_schema`.`ROUTINES`"
|
||||
. " WHERE `ROUTINE_SCHEMA` " . Util::getCollateForIS()
|
||||
. " = '" . Util::sqlAddSlashes($db) . "'";
|
||||
. " = '" . $GLOBALS['dbi']->escapeString($db) . "'";
|
||||
if (PMA_isValid($which, array('FUNCTION','PROCEDURE'))) {
|
||||
$query .= " AND `ROUTINE_TYPE` = '" . $which . "'";
|
||||
}
|
||||
if (! empty($name)) {
|
||||
$query .= " AND `SPECIFIC_NAME`"
|
||||
. " = '" . Util::sqlAddSlashes($name) . "'";
|
||||
. " = '" . $GLOBALS['dbi']->escapeString($name) . "'";
|
||||
}
|
||||
$result = $this->fetchResult($query);
|
||||
if (!empty($result)) {
|
||||
@ -1886,10 +1887,10 @@ class DatabaseInterface
|
||||
} else {
|
||||
if ($which == 'FUNCTION' || $which == null) {
|
||||
$query = "SHOW FUNCTION STATUS"
|
||||
. " WHERE `Db` = '" . Util::sqlAddSlashes($db) . "'";
|
||||
. " WHERE `Db` = '" . $GLOBALS['dbi']->escapeString($db) . "'";
|
||||
if (! empty($name)) {
|
||||
$query .= " AND `Name` = '"
|
||||
. Util::sqlAddSlashes($name) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($name) . "'";
|
||||
}
|
||||
$result = $this->fetchResult($query);
|
||||
if (!empty($result)) {
|
||||
@ -1898,10 +1899,10 @@ class DatabaseInterface
|
||||
}
|
||||
if ($which == 'PROCEDURE' || $which == null) {
|
||||
$query = "SHOW PROCEDURE STATUS"
|
||||
. " WHERE `Db` = '" . Util::sqlAddSlashes($db) . "'";
|
||||
. " WHERE `Db` = '" . $GLOBALS['dbi']->escapeString($db) . "'";
|
||||
if (! empty($name)) {
|
||||
$query .= " AND `Name` = '"
|
||||
. Util::sqlAddSlashes($name) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($name) . "'";
|
||||
}
|
||||
$result = $this->fetchResult($query);
|
||||
if (!empty($result)) {
|
||||
@ -1961,16 +1962,16 @@ class DatabaseInterface
|
||||
. "`DATABASE_COLLATION` AS `Database Collation`"
|
||||
. " FROM `information_schema`.`EVENTS`"
|
||||
. " WHERE `EVENT_SCHEMA` " . Util::getCollateForIS()
|
||||
. " = '" . Util::sqlAddSlashes($db) . "'";
|
||||
. " = '" . $GLOBALS['dbi']->escapeString($db) . "'";
|
||||
if (! empty($name)) {
|
||||
$query .= " AND `EVENT_NAME`"
|
||||
. " = '" . Util::sqlAddSlashes($name) . "'";
|
||||
. " = '" . $GLOBALS['dbi']->escapeString($name) . "'";
|
||||
}
|
||||
} else {
|
||||
$query = "SHOW EVENTS FROM " . Util::backquote($db);
|
||||
if (! empty($name)) {
|
||||
$query .= " AND `Name` = '"
|
||||
. Util::sqlAddSlashes($name) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($name) . "'";
|
||||
}
|
||||
}
|
||||
|
||||
@ -2013,16 +2014,16 @@ class DatabaseInterface
|
||||
. ', EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER'
|
||||
. ' FROM information_schema.TRIGGERS'
|
||||
. ' WHERE EVENT_OBJECT_SCHEMA ' . Util::getCollateForIS() . '='
|
||||
. ' \'' . Util::sqlAddSlashes($db) . '\'';
|
||||
. ' \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
|
||||
if (! empty($table)) {
|
||||
$query .= " AND EVENT_OBJECT_TABLE " . Util::getCollateForIS()
|
||||
. " = '" . Util::sqlAddSlashes($table) . "';";
|
||||
. " = '" . $GLOBALS['dbi']->escapeString($table) . "';";
|
||||
}
|
||||
} else {
|
||||
$query = "SHOW TRIGGERS FROM " . Util::backquote($db);
|
||||
if (! empty($table)) {
|
||||
$query .= " LIKE '" . Util::sqlAddSlashes($table, true) . "';";
|
||||
$query .= " LIKE '" . $GLOBALS['dbi']->escapeString($table) . "';";
|
||||
}
|
||||
}
|
||||
|
||||
@ -2649,6 +2650,27 @@ class DatabaseInterface
|
||||
return $this->_extension->fieldFlags($result, $i);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns properly escaped string for use in MySQL queries
|
||||
*
|
||||
* @param string $str string to be escaped
|
||||
* @param mixed $link optional database link to use
|
||||
*
|
||||
* @return string a MySQL escaped string
|
||||
*/
|
||||
public function escapeString($str, $link = null)
|
||||
{
|
||||
if ($link === null) {
|
||||
$link = $this->getLink();
|
||||
}
|
||||
|
||||
if ($this->_extension === null) {
|
||||
return $str;
|
||||
}
|
||||
|
||||
return $this->_extension->escapeString($link, $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets server connection port
|
||||
*
|
||||
@ -2704,6 +2726,7 @@ class DatabaseInterface
|
||||
if (isset($GLOBALS['userlink']) && !is_null($GLOBALS['userlink'])) {
|
||||
return $GLOBALS['userlink'];
|
||||
} else {
|
||||
error_log("YAHA\n", 3, "/tmp/a.txt");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ class DbSearch
|
||||
) {
|
||||
unset($this->_criteriaColumnName);
|
||||
} else {
|
||||
$this->_criteriaColumnName = Util::sqlAddSlashes(
|
||||
$this->_criteriaColumnName = $GLOBALS['dbi']->escapeString(
|
||||
$_REQUEST['criteriaColumnName'], true
|
||||
);
|
||||
}
|
||||
@ -203,7 +203,7 @@ class DbSearch
|
||||
// For "as regular expression" (search option 4), LIKE won't be used
|
||||
// Usage example: If user is searching for a literal $ in a regexp search,
|
||||
// he should enter \$ as the value.
|
||||
$criteriaSearchStringEscaped = Util::sqlAddSlashes(
|
||||
$criteriaSearchStringEscaped = $GLOBALS['dbi']->escapeString(
|
||||
$this->_criteriaSearchString,
|
||||
($this->_criteriaSearchType == 4 ? false : true)
|
||||
);
|
||||
|
||||
@ -4041,7 +4041,7 @@ class DisplayResults
|
||||
|| $bool_nowrap) ? ' nowrap' : '';
|
||||
|
||||
$where_comparison = ' = \''
|
||||
. Util::sqlAddSlashes($column)
|
||||
. $GLOBALS['dbi']->escapeString($column)
|
||||
. '\'';
|
||||
|
||||
$cell = $this->_getRowData(
|
||||
|
||||
@ -139,7 +139,7 @@ class Menu
|
||||
. " AND `tab` LIKE '" . $level . "%'"
|
||||
. " AND `usergroup` = (SELECT usergroup FROM "
|
||||
. $userTable . " WHERE `username` = '"
|
||||
. Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . "')";
|
||||
. $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user']) . "')";
|
||||
|
||||
$result = PMA_queryAsControlUser($sql_query, false);
|
||||
if ($result) {
|
||||
|
||||
@ -153,8 +153,8 @@ class Partition extends SubPartition
|
||||
if (Partition::havePartitioning()) {
|
||||
$result = $GLOBALS['dbi']->fetchResult(
|
||||
"SELECT * FROM `information_schema`.`PARTITIONS`"
|
||||
. " WHERE `TABLE_SCHEMA` = '" . Util::sqlAddSlashes($db)
|
||||
. "' AND `TABLE_NAME` = '" . Util::sqlAddSlashes($table) . "'"
|
||||
. " WHERE `TABLE_SCHEMA` = '" . $GLOBALS['dbi']->escapeString($db)
|
||||
. "' AND `TABLE_NAME` = '" . $GLOBALS['dbi']->escapeString($table) . "'"
|
||||
);
|
||||
if ($result) {
|
||||
$partitionMap = array();
|
||||
@ -194,8 +194,8 @@ class Partition extends SubPartition
|
||||
if (Partition::havePartitioning()) {
|
||||
return $GLOBALS['dbi']->fetchResult(
|
||||
"SELECT DISTINCT `PARTITION_NAME` FROM `information_schema`.`PARTITIONS`"
|
||||
. " WHERE `TABLE_SCHEMA` = '" . Util::sqlAddSlashes($db)
|
||||
. "' AND `TABLE_NAME` = '" . Util::sqlAddSlashes($table) . "'"
|
||||
. " WHERE `TABLE_SCHEMA` = '" . $GLOBALS['dbi']->escapeString($db)
|
||||
. "' AND `TABLE_NAME` = '" . $GLOBALS['dbi']->escapeString($table) . "'"
|
||||
);
|
||||
} else {
|
||||
return array();
|
||||
@ -215,8 +215,8 @@ class Partition extends SubPartition
|
||||
if (Partition::havePartitioning()) {
|
||||
$partition_method = $GLOBALS['dbi']->fetchResult(
|
||||
"SELECT `PARTITION_METHOD` FROM `information_schema`.`PARTITIONS`"
|
||||
. " WHERE `TABLE_SCHEMA` = '" . Util::sqlAddSlashes($db) . "'"
|
||||
. " AND `TABLE_NAME` = '" . Util::sqlAddSlashes($table) . "'"
|
||||
. " WHERE `TABLE_SCHEMA` = '" . $GLOBALS['dbi']->escapeString($db) . "'"
|
||||
. " AND `TABLE_NAME` = '" . $GLOBALS['dbi']->escapeString($table) . "'"
|
||||
. " LIMIT 1"
|
||||
);
|
||||
if (! empty($partition_method)) {
|
||||
|
||||
@ -96,7 +96,7 @@ class RecentFavoriteTable
|
||||
// Read from phpMyAdmin database, if recent tables is not in session
|
||||
$sql_query
|
||||
= " SELECT `tables` FROM " . $this->_getPmaTable() .
|
||||
" WHERE `username` = '" . Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . "'";
|
||||
" WHERE `username` = '" . $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user']) . "'";
|
||||
|
||||
$return = array();
|
||||
$result = PMA_queryAsControlUser($sql_query, false);
|
||||
@ -119,8 +119,8 @@ class RecentFavoriteTable
|
||||
$username = $GLOBALS['cfg']['Server']['user'];
|
||||
$sql_query
|
||||
= " REPLACE INTO " . $this->_getPmaTable() . " (`username`, `tables`)" .
|
||||
" VALUES ('" . Util::sqlAddSlashes($username) . "', '"
|
||||
. Util::sqlAddSlashes(
|
||||
" VALUES ('" . $GLOBALS['dbi']->escapeString($username) . "', '"
|
||||
. $GLOBALS['dbi']->escapeString(
|
||||
json_encode($this->_tables)
|
||||
) . "')";
|
||||
|
||||
|
||||
@ -273,7 +273,7 @@ class SavedSearches
|
||||
//If it's an insert.
|
||||
if (null === $this->getId()) {
|
||||
$wheres = array(
|
||||
"search_name = '" . Util::sqlAddSlashes($this->getSearchName())
|
||||
"search_name = '" . $GLOBALS['dbi']->escapeString($this->getSearchName())
|
||||
. "'"
|
||||
);
|
||||
$existingSearches = $this->getList($wheres);
|
||||
@ -292,10 +292,10 @@ class SavedSearches
|
||||
$sqlQuery = "INSERT INTO " . $savedSearchesTbl
|
||||
. "(`username`, `db_name`, `search_name`, `search_data`)"
|
||||
. " VALUES ("
|
||||
. "'" . Util::sqlAddSlashes($this->getUsername()) . "',"
|
||||
. "'" . Util::sqlAddSlashes($this->getDbname()) . "',"
|
||||
. "'" . Util::sqlAddSlashes($this->getSearchName()) . "',"
|
||||
. "'" . Util::sqlAddSlashes(json_encode($this->getCriterias()))
|
||||
. "'" . $GLOBALS['dbi']->escapeString($this->getUsername()) . "',"
|
||||
. "'" . $GLOBALS['dbi']->escapeString($this->getDbname()) . "',"
|
||||
. "'" . $GLOBALS['dbi']->escapeString($this->getSearchName()) . "',"
|
||||
. "'" . $GLOBALS['dbi']->escapeString(json_encode($this->getCriterias()))
|
||||
. "')";
|
||||
|
||||
$result = (bool)PMA_queryAsControlUser($sqlQuery);
|
||||
@ -311,7 +311,7 @@ class SavedSearches
|
||||
//Else, it's an update.
|
||||
$wheres = array(
|
||||
"id != " . $this->getId(),
|
||||
"search_name = '" . Util::sqlAddSlashes($this->getSearchName()) . "'"
|
||||
"search_name = '" . $GLOBALS['dbi']->escapeString($this->getSearchName()) . "'"
|
||||
);
|
||||
$existingSearches = $this->getList($wheres);
|
||||
|
||||
@ -328,9 +328,9 @@ class SavedSearches
|
||||
|
||||
$sqlQuery = "UPDATE " . $savedSearchesTbl
|
||||
. "SET `search_name` = '"
|
||||
. Util::sqlAddSlashes($this->getSearchName()) . "', "
|
||||
. $GLOBALS['dbi']->escapeString($this->getSearchName()) . "', "
|
||||
. "`search_data` = '"
|
||||
. Util::sqlAddSlashes(json_encode($this->getCriterias())) . "' "
|
||||
. $GLOBALS['dbi']->escapeString(json_encode($this->getCriterias())) . "' "
|
||||
. "WHERE id = " . $this->getId();
|
||||
return (bool)PMA_queryAsControlUser($sqlQuery);
|
||||
}
|
||||
@ -358,7 +358,7 @@ class SavedSearches
|
||||
. Util::backquote($this->_config['cfgRelation']['savedsearches']);
|
||||
|
||||
$sqlQuery = "DELETE FROM " . $savedSearchesTbl
|
||||
. "WHERE id = '" . Util::sqlAddSlashes($this->getId()) . "'";
|
||||
. "WHERE id = '" . $GLOBALS['dbi']->escapeString($this->getId()) . "'";
|
||||
|
||||
return (bool)PMA_queryAsControlUser($sqlQuery);
|
||||
}
|
||||
@ -386,7 +386,7 @@ class SavedSearches
|
||||
. Util::backquote($this->_config['cfgRelation']['savedsearches']);
|
||||
$sqlQuery = "SELECT id, search_name, search_data "
|
||||
. "FROM " . $savedSearchesTbl . " "
|
||||
. "WHERE id = '" . Util::sqlAddSlashes($this->getId()) . "' ";
|
||||
. "WHERE id = '" . $GLOBALS['dbi']->escapeString($this->getId()) . "' ";
|
||||
|
||||
$resList = PMA_queryAsControlUser($sqlQuery);
|
||||
|
||||
@ -426,8 +426,8 @@ class SavedSearches
|
||||
$sqlQuery = "SELECT id, search_name "
|
||||
. "FROM " . $savedSearchesTbl . " "
|
||||
. "WHERE "
|
||||
. "username = '" . Util::sqlAddSlashes($this->getUsername()) . "' "
|
||||
. "AND db_name = '" . Util::sqlAddSlashes($this->getDbname()) . "' ";
|
||||
. "username = '" . $GLOBALS['dbi']->escapeString($this->getUsername()) . "' "
|
||||
. "AND db_name = '" . $GLOBALS['dbi']->escapeString($this->getDbname()) . "' ";
|
||||
|
||||
foreach ($wheres as $where) {
|
||||
$sqlQuery .= "AND " . $where . " ";
|
||||
|
||||
@ -50,7 +50,7 @@ class SystemDatabase
|
||||
"SELECT * FROM %s.%s WHERE `db_name` = '%s'",
|
||||
Util::backquote($cfgRelation['db']),
|
||||
Util::backquote($cfgRelation['column_info']),
|
||||
Util::sqlAddSlashes($db)
|
||||
$GLOBALS['dbi']->escapeString($db)
|
||||
);
|
||||
|
||||
return $this->dbi->tryQuery($pma_transformation_sql);
|
||||
@ -105,7 +105,7 @@ class SystemDatabase
|
||||
$data_row['comment'],
|
||||
$data_row['mimetype'],
|
||||
$data_row['transformation'],
|
||||
Util::sqlAddSlashes(
|
||||
$GLOBALS['dbi']->escapeString(
|
||||
$data_row['transformation_options']
|
||||
)
|
||||
);
|
||||
|
||||
@ -190,8 +190,8 @@ class Table
|
||||
$result = $this->_dbi->fetchResult(
|
||||
"SELECT TABLE_NAME
|
||||
FROM information_schema.VIEWS
|
||||
WHERE TABLE_SCHEMA = '" . Util::sqlAddSlashes($db) . "'
|
||||
AND TABLE_NAME = '" . Util::sqlAddSlashes($table) . "'"
|
||||
WHERE TABLE_SCHEMA = '" . $GLOBALS['dbi']->escapeString($db) . "'
|
||||
AND TABLE_NAME = '" . $GLOBALS['dbi']->escapeString($table) . "'"
|
||||
);
|
||||
return $result ? true : false;
|
||||
}
|
||||
@ -210,8 +210,8 @@ class Table
|
||||
$result = $this->_dbi->fetchResult(
|
||||
"SELECT TABLE_NAME
|
||||
FROM information_schema.VIEWS
|
||||
WHERE TABLE_SCHEMA = '" . Util::sqlAddSlashes($this->_db_name) . "'
|
||||
AND TABLE_NAME = '" . Util::sqlAddSlashes($this->_name) . "'
|
||||
WHERE TABLE_SCHEMA = '" . $GLOBALS['dbi']->escapeString($this->_db_name) . "'
|
||||
AND TABLE_NAME = '" . $GLOBALS['dbi']->escapeString($this->_name) . "'
|
||||
AND IS_UPDATABLE = 'YES'"
|
||||
);
|
||||
return $result ? true : false;
|
||||
@ -240,8 +240,8 @@ class Table
|
||||
$results = $this->_dbi->fetchResult(
|
||||
"SELECT COLUMN_NAME, DATA_TYPE
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = '" . Util::sqlAddSlashes($this->_db_name)
|
||||
. " AND TABLE_NAME = '" . Util::sqlAddSlashes($this->_name) . "'"
|
||||
WHERE TABLE_SCHEMA = '" . $GLOBALS['dbi']->escapeString($this->_db_name)
|
||||
. " AND TABLE_NAME = '" . $GLOBALS['dbi']->escapeString($this->_name) . "'"
|
||||
);
|
||||
|
||||
foreach ($results as $result) {
|
||||
@ -454,13 +454,13 @@ class Table
|
||||
} else {
|
||||
// Invalid BOOLEAN value
|
||||
$query .= ' DEFAULT \''
|
||||
. Util::sqlAddSlashes($default_value) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($default_value) . '\'';
|
||||
}
|
||||
} elseif ($type == 'BINARY' || $type == 'VARBINARY') {
|
||||
$query .= ' DEFAULT 0x' . $default_value;
|
||||
} else {
|
||||
$query .= ' DEFAULT \''
|
||||
. Util::sqlAddSlashes($default_value) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($default_value) . '\'';
|
||||
}
|
||||
break;
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
@ -487,7 +487,7 @@ class Table
|
||||
}
|
||||
}
|
||||
if (!empty($comment)) {
|
||||
$query .= " COMMENT '" . Util::sqlAddSlashes($comment) . "'";
|
||||
$query .= " COMMENT '" . $GLOBALS['dbi']->escapeString($comment) . "'";
|
||||
}
|
||||
|
||||
// move column
|
||||
@ -661,14 +661,14 @@ class Table
|
||||
$where_parts = array();
|
||||
foreach ($where_fields as $_where => $_value) {
|
||||
$where_parts[] = Util::backquote($_where) . ' = \''
|
||||
. Util::sqlAddSlashes($_value) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($_value) . '\'';
|
||||
}
|
||||
|
||||
$new_parts = array();
|
||||
$new_value_parts = array();
|
||||
foreach ($new_fields as $_where => $_value) {
|
||||
$new_parts[] = Util::backquote($_where);
|
||||
$new_value_parts[] = Util::sqlAddSlashes($_value);
|
||||
$new_value_parts[] = $GLOBALS['dbi']->escapeString($_value);
|
||||
}
|
||||
|
||||
$table_copy_query = '
|
||||
@ -687,7 +687,7 @@ class Table
|
||||
$value_parts = array();
|
||||
foreach ($table_copy_row as $_key => $_val) {
|
||||
if (isset($row_fields[$_key]) && $row_fields[$_key] == 'cc') {
|
||||
$value_parts[] = Util::sqlAddSlashes($_val);
|
||||
$value_parts[] = $GLOBALS['dbi']->escapeString($_val);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1088,10 +1088,10 @@ class Table
|
||||
. Util::backquote($GLOBALS['cfgRelation']['column_info'])
|
||||
. ' WHERE '
|
||||
. ' db_name = \''
|
||||
. Util::sqlAddSlashes($source_db) . '\''
|
||||
. $GLOBALS['dbi']->escapeString($source_db) . '\''
|
||||
. ' AND '
|
||||
. ' table_name = \''
|
||||
. Util::sqlAddSlashes($source_table) . '\''
|
||||
. $GLOBALS['dbi']->escapeString($source_table) . '\''
|
||||
);
|
||||
|
||||
// Write every comment as new copied entry. [MIME]
|
||||
@ -1106,21 +1106,21 @@ class Table
|
||||
. ($GLOBALS['cfgRelation']['mimework']
|
||||
? ', mimetype, transformation, transformation_options'
|
||||
: '')
|
||||
. ') ' . ' VALUES(' . '\'' . Util::sqlAddSlashes($target_db)
|
||||
. '\',\'' . Util::sqlAddSlashes($target_table) . '\',\''
|
||||
. Util::sqlAddSlashes($comments_copy_row['column_name'])
|
||||
. ') ' . ' VALUES(' . '\'' . $GLOBALS['dbi']->escapeString($target_db)
|
||||
. '\',\'' . $GLOBALS['dbi']->escapeString($target_table) . '\',\''
|
||||
. $GLOBALS['dbi']->escapeString($comments_copy_row['column_name'])
|
||||
. '\''
|
||||
. ($GLOBALS['cfgRelation']['mimework']
|
||||
? ',\'' . Util::sqlAddSlashes(
|
||||
? ',\'' . $GLOBALS['dbi']->escapeString(
|
||||
$comments_copy_row['comment']
|
||||
)
|
||||
. '\',' . '\'' . Util::sqlAddSlashes(
|
||||
. '\',' . '\'' . $GLOBALS['dbi']->escapeString(
|
||||
$comments_copy_row['mimetype']
|
||||
)
|
||||
. '\',' . '\'' . Util::sqlAddSlashes(
|
||||
. '\',' . '\'' . $GLOBALS['dbi']->escapeString(
|
||||
$comments_copy_row['transformation']
|
||||
)
|
||||
. '\',' . '\'' . Util::sqlAddSlashes(
|
||||
. '\',' . '\'' . $GLOBALS['dbi']->escapeString(
|
||||
$comments_copy_row['transformation_options']
|
||||
)
|
||||
. '\''
|
||||
@ -1556,9 +1556,9 @@ class Table
|
||||
|
||||
// Read from phpMyAdmin database
|
||||
$sql_query = " SELECT `prefs` FROM " . $pma_table
|
||||
. " WHERE `username` = '" . Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . "'"
|
||||
. " AND `db_name` = '" . Util::sqlAddSlashes($this->_db_name) . "'"
|
||||
. " AND `table_name` = '" . Util::sqlAddSlashes($this->_name) . "'";
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user']) . "'"
|
||||
. " AND `db_name` = '" . $GLOBALS['dbi']->escapeString($this->_db_name) . "'"
|
||||
. " AND `table_name` = '" . $GLOBALS['dbi']->escapeString($this->_name) . "'";
|
||||
|
||||
$row = $this->_dbi->fetchArray(PMA_queryAsControlUser($sql_query));
|
||||
if (isset($row[0])) {
|
||||
@ -1579,14 +1579,14 @@ class Table
|
||||
$pma_table = Util::backquote($cfgRelation['db']) . "."
|
||||
. Util::backquote($cfgRelation['table_uiprefs']);
|
||||
|
||||
$secureDbName = Util::sqlAddSlashes($this->_db_name);
|
||||
$secureDbName = $GLOBALS['dbi']->escapeString($this->_db_name);
|
||||
|
||||
$username = $GLOBALS['cfg']['Server']['user'];
|
||||
$sql_query = " REPLACE INTO " . $pma_table
|
||||
. " (username, db_name, table_name, prefs) VALUES ('"
|
||||
. Util::sqlAddSlashes($username) . "', '" . $secureDbName
|
||||
. "', '" . Util::sqlAddSlashes($this->_name) . "', '"
|
||||
. Util::sqlAddSlashes(json_encode($this->uiprefs)) . "')";
|
||||
. $GLOBALS['dbi']->escapeString($username) . "', '" . $secureDbName
|
||||
. "', '" . $GLOBALS['dbi']->escapeString($this->_name) . "', '"
|
||||
. $GLOBALS['dbi']->escapeString(json_encode($this->uiprefs)) . "')";
|
||||
|
||||
$success = $this->_dbi->tryQuery($sql_query, $GLOBALS['controllink']);
|
||||
|
||||
@ -1953,7 +1953,7 @@ class Table
|
||||
if (! empty($keyBlockSizes)) {
|
||||
$sql_query .= sprintf(
|
||||
' KEY_BLOCK_SIZE = ',
|
||||
Util::sqlAddSlashes($keyBlockSizes)
|
||||
$GLOBALS['dbi']->escapeString($keyBlockSizes)
|
||||
);
|
||||
}
|
||||
|
||||
@ -1968,14 +1968,14 @@ class Table
|
||||
|
||||
$parser = $index->getParser();
|
||||
if ($index->getChoice() == 'FULLTEXT' && ! empty($parser)) {
|
||||
$sql_query .= ' WITH PARSER ' . Util::sqlAddSlashes($parser);
|
||||
$sql_query .= ' WITH PARSER ' . $GLOBALS['dbi']->escapeString($parser);
|
||||
}
|
||||
|
||||
$comment = $index->getComment();
|
||||
if (! empty($comment)) {
|
||||
$sql_query .= sprintf(
|
||||
" COMMENT '%s'",
|
||||
Util::sqlAddSlashes($comment)
|
||||
$GLOBALS['dbi']->escapeString($comment)
|
||||
);
|
||||
}
|
||||
|
||||
@ -2002,28 +2002,28 @@ class Table
|
||||
. Util::backquote($GLOBALS['cfgRelation']['db'])
|
||||
. '.' . Util::backquote($cfgRelation['table_info'])
|
||||
. ' WHERE db_name = \''
|
||||
. Util::sqlAddSlashes($this->_db_name) . '\''
|
||||
. $GLOBALS['dbi']->escapeString($this->_db_name) . '\''
|
||||
. ' AND table_name = \''
|
||||
. Util::sqlAddSlashes($this->_name) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($this->_name) . '\'';
|
||||
} elseif ($disp != $display_field) {
|
||||
$upd_query = 'UPDATE '
|
||||
. Util::backquote($GLOBALS['cfgRelation']['db'])
|
||||
. '.' . Util::backquote($cfgRelation['table_info'])
|
||||
. ' SET display_field = \''
|
||||
. Util::sqlAddSlashes($display_field) . '\''
|
||||
. $GLOBALS['dbi']->escapeString($display_field) . '\''
|
||||
. ' WHERE db_name = \''
|
||||
. Util::sqlAddSlashes($this->_db_name) . '\''
|
||||
. $GLOBALS['dbi']->escapeString($this->_db_name) . '\''
|
||||
. ' AND table_name = \''
|
||||
. Util::sqlAddSlashes($this->_name) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($this->_name) . '\'';
|
||||
}
|
||||
} elseif ($display_field != '') {
|
||||
$upd_query = 'INSERT INTO '
|
||||
. Util::backquote($GLOBALS['cfgRelation']['db'])
|
||||
. '.' . Util::backquote($cfgRelation['table_info'])
|
||||
. '(db_name, table_name, display_field) VALUES('
|
||||
. '\'' . Util::sqlAddSlashes($this->_db_name) . '\','
|
||||
. '\'' . Util::sqlAddSlashes($this->_name) . '\','
|
||||
. '\'' . Util::sqlAddSlashes($display_field) . '\')';
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($this->_db_name) . '\','
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($this->_name) . '\','
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($display_field) . '\')';
|
||||
}
|
||||
|
||||
if ($upd_query) {
|
||||
@ -2072,12 +2072,12 @@ class Table
|
||||
. '(master_db, master_table, master_field, foreign_db,'
|
||||
. ' foreign_table, foreign_field)'
|
||||
. ' values('
|
||||
. '\'' . Util::sqlAddSlashes($this->_db_name) . '\', '
|
||||
. '\'' . Util::sqlAddSlashes($this->_name) . '\', '
|
||||
. '\'' . Util::sqlAddSlashes($master_field) . '\', '
|
||||
. '\'' . Util::sqlAddSlashes($foreign_db) . '\', '
|
||||
. '\'' . Util::sqlAddSlashes($foreign_table) . '\','
|
||||
. '\'' . Util::sqlAddSlashes($foreign_field) . '\')';
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($this->_db_name) . '\', '
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($this->_name) . '\', '
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($master_field) . '\', '
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($foreign_db) . '\', '
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($foreign_table) . '\','
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($foreign_field) . '\')';
|
||||
|
||||
} elseif ($existrel[$master_field]['foreign_db'] != $foreign_db
|
||||
|| $existrel[$master_field]['foreign_table'] != $foreign_table
|
||||
@ -2087,28 +2087,28 @@ class Table
|
||||
. Util::backquote($GLOBALS['cfgRelation']['db'])
|
||||
. '.' . Util::backquote($cfgRelation['relation'])
|
||||
. ' SET foreign_db = \''
|
||||
. Util::sqlAddSlashes($foreign_db) . '\', '
|
||||
. $GLOBALS['dbi']->escapeString($foreign_db) . '\', '
|
||||
. ' foreign_table = \''
|
||||
. Util::sqlAddSlashes($foreign_table) . '\', '
|
||||
. $GLOBALS['dbi']->escapeString($foreign_table) . '\', '
|
||||
. ' foreign_field = \''
|
||||
. Util::sqlAddSlashes($foreign_field) . '\' '
|
||||
. $GLOBALS['dbi']->escapeString($foreign_field) . '\' '
|
||||
. ' WHERE master_db = \''
|
||||
. Util::sqlAddSlashes($this->_db_name) . '\''
|
||||
. $GLOBALS['dbi']->escapeString($this->_db_name) . '\''
|
||||
. ' AND master_table = \''
|
||||
. Util::sqlAddSlashes($this->_name) . '\''
|
||||
. $GLOBALS['dbi']->escapeString($this->_name) . '\''
|
||||
. ' AND master_field = \''
|
||||
. Util::sqlAddSlashes($master_field) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($master_field) . '\'';
|
||||
} // end if... else....
|
||||
} elseif (isset($existrel[$master_field])) {
|
||||
$upd_query = 'DELETE FROM '
|
||||
. Util::backquote($GLOBALS['cfgRelation']['db'])
|
||||
. '.' . Util::backquote($cfgRelation['relation'])
|
||||
. ' WHERE master_db = \''
|
||||
. Util::sqlAddSlashes($this->_db_name) . '\''
|
||||
. $GLOBALS['dbi']->escapeString($this->_db_name) . '\''
|
||||
. ' AND master_table = \''
|
||||
. Util::sqlAddSlashes($this->_name) . '\''
|
||||
. $GLOBALS['dbi']->escapeString($this->_name) . '\''
|
||||
. ' AND master_field = \''
|
||||
. Util::sqlAddSlashes($master_field) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($master_field) . '\'';
|
||||
} // end if... else....
|
||||
|
||||
if (isset($upd_query)) {
|
||||
@ -2390,10 +2390,10 @@ class Table
|
||||
FROM
|
||||
`information_schema`.`COLUMNS`
|
||||
WHERE
|
||||
`TABLE_SCHEMA` = '" . Util::sqlAddSlashes($this->_db_name) . "'
|
||||
AND `TABLE_NAME` = '" . Util::sqlAddSlashes($this->_name) . "'";
|
||||
`TABLE_SCHEMA` = '" . $GLOBALS['dbi']->escapeString($this->_db_name) . "'
|
||||
AND `TABLE_NAME` = '" . $GLOBALS['dbi']->escapeString($this->_name) . "'";
|
||||
if ($column != null) {
|
||||
$sql .= " AND `COLUMN_NAME` = '" . Util::sqlAddSlashes($column)
|
||||
$sql .= " AND `COLUMN_NAME` = '" . $GLOBALS['dbi']->escapeString($column)
|
||||
. "'";
|
||||
}
|
||||
$columns = $this->_dbi->fetchResult($sql, 'Field', 'Expression');
|
||||
|
||||
@ -123,8 +123,8 @@ class Tracker
|
||||
}
|
||||
|
||||
$sql_query = " SELECT tracking_active FROM " . self::_getTrackingTable() .
|
||||
" WHERE db_name = '" . Util::sqlAddSlashes($dbname) . "' " .
|
||||
" AND table_name = '" . Util::sqlAddSlashes($tablename) . "' " .
|
||||
" WHERE db_name = '" . $GLOBALS['dbi']->escapeString($dbname) . "' " .
|
||||
" AND table_name = '" . $GLOBALS['dbi']->escapeString($tablename) . "' " .
|
||||
" ORDER BY version DESC";
|
||||
|
||||
$row = $GLOBALS['dbi']->fetchArray(PMA_queryAsControlUser($sql_query));
|
||||
@ -242,15 +242,15 @@ class Tracker
|
||||
"tracking " .
|
||||
") " .
|
||||
"values (
|
||||
'" . Util::sqlAddSlashes($dbname) . "',
|
||||
'" . Util::sqlAddSlashes($tablename) . "',
|
||||
'" . Util::sqlAddSlashes($version) . "',
|
||||
'" . Util::sqlAddSlashes($date) . "',
|
||||
'" . Util::sqlAddSlashes($date) . "',
|
||||
'" . Util::sqlAddSlashes($snapshot) . "',
|
||||
'" . Util::sqlAddSlashes($create_sql) . "',
|
||||
'" . Util::sqlAddSlashes("\n") . "',
|
||||
'" . Util::sqlAddSlashes($tracking_set)
|
||||
'" . $GLOBALS['dbi']->escapeString($dbname) . "',
|
||||
'" . $GLOBALS['dbi']->escapeString($tablename) . "',
|
||||
'" . $GLOBALS['dbi']->escapeString($version) . "',
|
||||
'" . $GLOBALS['dbi']->escapeString($date) . "',
|
||||
'" . $GLOBALS['dbi']->escapeString($date) . "',
|
||||
'" . $GLOBALS['dbi']->escapeString($snapshot) . "',
|
||||
'" . $GLOBALS['dbi']->escapeString($create_sql) . "',
|
||||
'" . $GLOBALS['dbi']->escapeString("\n") . "',
|
||||
'" . $GLOBALS['dbi']->escapeString($tracking_set)
|
||||
. "' )";
|
||||
|
||||
$result = PMA_queryAsControlUser($sql_query);
|
||||
@ -280,12 +280,12 @@ class Tracker
|
||||
$sql_query = "/*NOTRACK*/\n"
|
||||
. "DELETE FROM " . self::_getTrackingTable()
|
||||
. " WHERE `db_name` = '"
|
||||
. Util::sqlAddSlashes($dbname) . "'"
|
||||
. $GLOBALS['dbi']->escapeString($dbname) . "'"
|
||||
. " AND `table_name` = '"
|
||||
. Util::sqlAddSlashes($tablename) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($tablename) . "'";
|
||||
if ($version) {
|
||||
$sql_query .= " AND `version` = '"
|
||||
. Util::sqlAddSlashes($version) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($version) . "'";
|
||||
}
|
||||
$result = PMA_queryAsControlUser($sql_query);
|
||||
|
||||
@ -338,15 +338,15 @@ class Tracker
|
||||
"tracking " .
|
||||
") " .
|
||||
"values (
|
||||
'" . Util::sqlAddSlashes($dbname) . "',
|
||||
'" . Util::sqlAddSlashes('') . "',
|
||||
'" . Util::sqlAddSlashes($version) . "',
|
||||
'" . Util::sqlAddSlashes($date) . "',
|
||||
'" . Util::sqlAddSlashes($date) . "',
|
||||
'" . Util::sqlAddSlashes('') . "',
|
||||
'" . Util::sqlAddSlashes($create_sql) . "',
|
||||
'" . Util::sqlAddSlashes("\n") . "',
|
||||
'" . Util::sqlAddSlashes($tracking_set)
|
||||
'" . $GLOBALS['dbi']->escapeString($dbname) . "',
|
||||
'" . $GLOBALS['dbi']->escapeString('') . "',
|
||||
'" . $GLOBALS['dbi']->escapeString($version) . "',
|
||||
'" . $GLOBALS['dbi']->escapeString($date) . "',
|
||||
'" . $GLOBALS['dbi']->escapeString($date) . "',
|
||||
'" . $GLOBALS['dbi']->escapeString('') . "',
|
||||
'" . $GLOBALS['dbi']->escapeString($create_sql) . "',
|
||||
'" . $GLOBALS['dbi']->escapeString("\n") . "',
|
||||
'" . $GLOBALS['dbi']->escapeString($tracking_set)
|
||||
. "' )";
|
||||
|
||||
$result = PMA_queryAsControlUser($sql_query);
|
||||
@ -374,9 +374,9 @@ class Tracker
|
||||
|
||||
$sql_query = " UPDATE " . self::_getTrackingTable() .
|
||||
" SET `tracking_active` = '" . $new_state . "' " .
|
||||
" WHERE `db_name` = '" . Util::sqlAddSlashes($dbname) . "' " .
|
||||
" AND `table_name` = '" . Util::sqlAddSlashes($tablename) . "' " .
|
||||
" AND `version` = '" . Util::sqlAddSlashes($version) . "' ";
|
||||
" WHERE `db_name` = '" . $GLOBALS['dbi']->escapeString($dbname) . "' " .
|
||||
" AND `table_name` = '" . $GLOBALS['dbi']->escapeString($tablename) . "' " .
|
||||
" AND `version` = '" . $GLOBALS['dbi']->escapeString($version) . "' ";
|
||||
|
||||
$result = PMA_queryAsControlUser($sql_query);
|
||||
|
||||
@ -412,7 +412,7 @@ class Tracker
|
||||
if (is_array($new_data)) {
|
||||
foreach ($new_data as $data) {
|
||||
$new_data_processed .= '# log ' . $date . ' ' . $data['username']
|
||||
. Util::sqlAddSlashes($data['statement']) . "\n";
|
||||
. $GLOBALS['dbi']->escapeString($data['statement']) . "\n";
|
||||
}
|
||||
} else {
|
||||
$new_data_processed = $new_data;
|
||||
@ -420,9 +420,9 @@ class Tracker
|
||||
|
||||
$sql_query = " UPDATE " . self::_getTrackingTable() .
|
||||
" SET `" . $save_to . "` = '" . $new_data_processed . "' " .
|
||||
" WHERE `db_name` = '" . Util::sqlAddSlashes($dbname) . "' " .
|
||||
" AND `table_name` = '" . Util::sqlAddSlashes($tablename) . "' " .
|
||||
" AND `version` = '" . Util::sqlAddSlashes($version) . "' ";
|
||||
" WHERE `db_name` = '" . $GLOBALS['dbi']->escapeString($dbname) . "' " .
|
||||
" AND `table_name` = '" . $GLOBALS['dbi']->escapeString($tablename) . "' " .
|
||||
" AND `version` = '" . $GLOBALS['dbi']->escapeString($version) . "' ";
|
||||
|
||||
$result = PMA_queryAsControlUser($sql_query);
|
||||
|
||||
@ -478,8 +478,8 @@ class Tracker
|
||||
static public function getVersion($dbname, $tablename, $statement = null)
|
||||
{
|
||||
$sql_query = " SELECT MAX(version) FROM " . self::_getTrackingTable() .
|
||||
" WHERE `db_name` = '" . Util::sqlAddSlashes($dbname) . "' " .
|
||||
" AND `table_name` = '" . Util::sqlAddSlashes($tablename) . "' ";
|
||||
" WHERE `db_name` = '" . $GLOBALS['dbi']->escapeString($dbname) . "' " .
|
||||
" AND `table_name` = '" . $GLOBALS['dbi']->escapeString($tablename) . "' ";
|
||||
|
||||
if ($statement != "") {
|
||||
$sql_query .= " AND FIND_IN_SET('"
|
||||
@ -507,12 +507,12 @@ class Tracker
|
||||
static public function getTrackedData($dbname, $tablename, $version)
|
||||
{
|
||||
$sql_query = " SELECT * FROM " . self::_getTrackingTable() .
|
||||
" WHERE `db_name` = '" . Util::sqlAddSlashes($dbname) . "' ";
|
||||
" WHERE `db_name` = '" . $GLOBALS['dbi']->escapeString($dbname) . "' ";
|
||||
if (! empty($tablename)) {
|
||||
$sql_query .= " AND `table_name` = '"
|
||||
. Util::sqlAddSlashes($tablename) . "' ";
|
||||
. $GLOBALS['dbi']->escapeString($tablename) . "' ";
|
||||
}
|
||||
$sql_query .= " AND `version` = '" . Util::sqlAddSlashes($version)
|
||||
$sql_query .= " AND `version` = '" . $GLOBALS['dbi']->escapeString($version)
|
||||
. "' " . " ORDER BY `version` DESC LIMIT 1";
|
||||
|
||||
$mixed = $GLOBALS['dbi']->fetchAssoc(PMA_queryAsControlUser($sql_query));
|
||||
@ -916,14 +916,14 @@ class Tracker
|
||||
. " UPDATE " . self::_getTrackingTable()
|
||||
. " SET " . Util::backquote($save_to)
|
||||
. " = CONCAT( " . Util::backquote($save_to) . ",'\n"
|
||||
. Util::sqlAddSlashes($query) . "') ,"
|
||||
. $GLOBALS['dbi']->escapeString($query) . "') ,"
|
||||
. " `date_updated` = '" . $date . "' ";
|
||||
|
||||
// If table was renamed we have to change
|
||||
// the tablename attribute in pma_tracking too
|
||||
if ($result['identifier'] == 'RENAME TABLE') {
|
||||
$sql_query .= ', `table_name` = \''
|
||||
. Util::sqlAddSlashes($result['tablename_after_rename'])
|
||||
. $GLOBALS['dbi']->escapeString($result['tablename_after_rename'])
|
||||
. '\' ';
|
||||
}
|
||||
|
||||
@ -934,10 +934,10 @@ class Tracker
|
||||
// we want to track
|
||||
$sql_query .=
|
||||
" WHERE FIND_IN_SET('" . $result['identifier'] . "',tracking) > 0" .
|
||||
" AND `db_name` = '" . Util::sqlAddSlashes($dbname) . "' " .
|
||||
" AND `db_name` = '" . $GLOBALS['dbi']->escapeString($dbname) . "' " .
|
||||
" AND `table_name` = '"
|
||||
. Util::sqlAddSlashes($result['tablename']) . "' " .
|
||||
" AND `version` = '" . Util::sqlAddSlashes($version) . "' ";
|
||||
. $GLOBALS['dbi']->escapeString($result['tablename']) . "' " .
|
||||
" AND `version` = '" . $GLOBALS['dbi']->escapeString($version) . "' ";
|
||||
|
||||
PMA_queryAsControlUser($sql_query);
|
||||
}
|
||||
|
||||
@ -2337,7 +2337,7 @@ class Util
|
||||
. self::printableBitValue($row[$i], $meta->length) . "'";
|
||||
} else {
|
||||
$con_val = '= \''
|
||||
. self::sqlAddSlashes($row[$i], false, true) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($row[$i]) . '\'';
|
||||
}
|
||||
}
|
||||
|
||||
@ -4161,7 +4161,7 @@ class Util
|
||||
'SCHEMA_PRIVILEGES',
|
||||
$username,
|
||||
$priv,
|
||||
self::sqlAddSlashes($db)
|
||||
$GLOBALS['dbi']->escapeString($db)
|
||||
)
|
||||
);
|
||||
if ($schema_privileges) {
|
||||
@ -4184,8 +4184,8 @@ class Util
|
||||
'TABLE_PRIVILEGES',
|
||||
$username,
|
||||
$priv,
|
||||
self::sqlAddSlashes($db),
|
||||
self::sqlAddSlashes($tbl)
|
||||
$GLOBALS['dbi']->escapeString($db),
|
||||
$GLOBALS['dbi']->escapeString($tbl)
|
||||
)
|
||||
);
|
||||
if ($table_privileges) {
|
||||
@ -4942,7 +4942,7 @@ class Util
|
||||
if (! isset($sot_cache[$tmp[0]])) {
|
||||
$sts_result = $GLOBALS['dbi']->query(
|
||||
"SHOW TABLE STATUS FROM " . Util::backquote($db)
|
||||
. " LIKE '" . Util::sqlAddSlashes($tmp[0], true)
|
||||
. " LIKE '" . $GLOBALS['dbi']->escapeString($tmp[0])
|
||||
. "';"
|
||||
);
|
||||
$sts_tmp = $GLOBALS['dbi']->fetchAssoc($sts_result);
|
||||
|
||||
@ -64,8 +64,8 @@ function PMA_Bookmark_getList($db = false)
|
||||
$query = 'SELECT query, label, id FROM ' . PMA\libraries\Util::backquote(
|
||||
$cfgBookmark['db']
|
||||
) . '.' . PMA\libraries\Util::backquote($cfgBookmark['table'])
|
||||
. ' WHERE dbase = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\''
|
||||
. ' AND user = \'' . PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user'])
|
||||
. ' WHERE dbase = \'' . $GLOBALS['dbi']->escapeString($db) . '\''
|
||||
. ' AND user = \'' . $GLOBALS['dbi']->escapeString($cfgBookmark['user'])
|
||||
. '\''
|
||||
. ' ORDER BY label';
|
||||
$per_user = $GLOBALS['dbi']->fetchResult(
|
||||
@ -79,7 +79,7 @@ function PMA_Bookmark_getList($db = false)
|
||||
$query = 'SELECT query, label, id FROM ' . PMA\libraries\Util::backquote(
|
||||
$cfgBookmark['db']
|
||||
) . '.' . PMA\libraries\Util::backquote($cfgBookmark['table'])
|
||||
. ' WHERE dbase = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\''
|
||||
. ' WHERE dbase = \'' . $GLOBALS['dbi']->escapeString($db) . '\''
|
||||
. ' AND user = \'\''
|
||||
. ' ORDER BY label';
|
||||
$global = $GLOBALS['dbi']->fetchResult(
|
||||
@ -103,7 +103,7 @@ function PMA_Bookmark_getList($db = false)
|
||||
. " FROM " . PMA\libraries\Util::backquote($cfgBookmark['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgBookmark['table'])
|
||||
. " WHERE `user` = '' OR"
|
||||
. " `user` = '" . PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user'])
|
||||
. " `user` = '" . $GLOBALS['dbi']->escapeString($cfgBookmark['user'])
|
||||
. "'";
|
||||
|
||||
$ret = $GLOBALS['dbi']->fetchResult(
|
||||
@ -149,11 +149,11 @@ function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = fal
|
||||
|
||||
$query = 'SELECT query FROM ' . PMA\libraries\Util::backquote($cfgBookmark['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgBookmark['table'])
|
||||
. ' WHERE dbase = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'';
|
||||
. ' WHERE dbase = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
|
||||
if (! $action_bookmark_all) {
|
||||
$query .= ' AND (user = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user']) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($cfgBookmark['user']) . '\'';
|
||||
if (! $exact_user_match) {
|
||||
$query .= ' OR user = \'\'';
|
||||
}
|
||||
@ -195,18 +195,18 @@ function PMA_Bookmark_save($bkm_fields, $all_users = false)
|
||||
. '.' . PMA\libraries\Util::backquote($cfgBookmark['table'])
|
||||
. ' (id, dbase, user, query, label)'
|
||||
. ' VALUES (NULL, \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($bkm_fields['bkm_database']) . '\', '
|
||||
. $GLOBALS['dbi']->escapeString($bkm_fields['bkm_database']) . '\', '
|
||||
. '\''
|
||||
. ($all_users
|
||||
? ''
|
||||
: PMA\libraries\Util::sqlAddSlashes(
|
||||
: $GLOBALS['dbi']->escapeString(
|
||||
$bkm_fields['bkm_user']
|
||||
))
|
||||
. '\', '
|
||||
. '\''
|
||||
. PMA\libraries\Util::sqlAddSlashes($bkm_fields['bkm_sql_query'])
|
||||
. $GLOBALS['dbi']->escapeString($bkm_fields['bkm_sql_query'])
|
||||
. '\', '
|
||||
. '\'' . PMA\libraries\Util::sqlAddSlashes($bkm_fields['bkm_label']) . '\')';
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($bkm_fields['bkm_label']) . '\')';
|
||||
return $GLOBALS['dbi']->query($query, $controllink);
|
||||
} // end of the 'PMA_Bookmark_save()' function
|
||||
|
||||
@ -235,7 +235,7 @@ function PMA_Bookmark_delete($id)
|
||||
$query = 'DELETE FROM ' . PMA\libraries\Util::backquote($cfgBookmark['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgBookmark['table'])
|
||||
. ' WHERE (user = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($cfgBookmark['user']) . '\''
|
||||
. $GLOBALS['dbi']->escapeString($cfgBookmark['user']) . '\''
|
||||
. ' OR user = \'\')'
|
||||
. ' AND id = ' . $id;
|
||||
return $GLOBALS['dbi']->tryQuery($query, $controllink);
|
||||
@ -275,7 +275,7 @@ function PMA_Bookmark_applyVariables($query)
|
||||
for ($i = 1; $i <= $number_of_variables; $i++) {
|
||||
$var = '';
|
||||
if (! empty($_REQUEST['bookmark_variable'][$i])) {
|
||||
$var = PMA\libraries\Util::sqlAddSlashes(
|
||||
$var = $GLOBALS['dbi']->escapeString(
|
||||
$_REQUEST['bookmark_variable'][$i]
|
||||
);
|
||||
}
|
||||
|
||||
@ -60,10 +60,10 @@ function PMA_getColumnsList($db, $from=0, $num=25)
|
||||
//get current values of $db from central column list
|
||||
if ($num == 0) {
|
||||
$query = 'SELECT * FROM ' . Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . Util::sqlAddSlashes($db) . '\';';
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\';';
|
||||
} else {
|
||||
$query = 'SELECT * FROM ' . Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . Util::sqlAddSlashes($db) . '\' '
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\' '
|
||||
. 'LIMIT ' . $from . ', ' . $num . ';';
|
||||
}
|
||||
$has_list = (array) $GLOBALS['dbi']->fetchResult(
|
||||
@ -91,7 +91,7 @@ function PMA_getCentralColumnsCount($db)
|
||||
$central_list_table = $cfgCentralColumns['table'];
|
||||
$query = 'SELECT count(db_name) FROM ' .
|
||||
Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . Util::sqlAddSlashes($db) . '\';';
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\';';
|
||||
$res = $GLOBALS['dbi']->fetchResult(
|
||||
$query, null, null, $GLOBALS['controllink']
|
||||
);
|
||||
@ -122,7 +122,7 @@ function PMA_findExistingColNames($db, $cols, $allFields=false)
|
||||
$central_list_table = $cfgCentralColumns['table'];
|
||||
if ($allFields) {
|
||||
$query = 'SELECT * FROM ' . Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . Util::sqlAddSlashes($db) . '\' AND col_name IN (' . $cols . ');';
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\' AND col_name IN (' . $cols . ');';
|
||||
$has_list = (array) $GLOBALS['dbi']->fetchResult(
|
||||
$query, null, null, $GLOBALS['controllink']
|
||||
);
|
||||
@ -130,7 +130,7 @@ function PMA_findExistingColNames($db, $cols, $allFields=false)
|
||||
} else {
|
||||
$query = 'SELECT col_name FROM '
|
||||
. Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . Util::sqlAddSlashes($db) . '\' AND col_name IN (' . $cols . ');';
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\' AND col_name IN (' . $cols . ');';
|
||||
$has_list = (array) $GLOBALS['dbi']->fetchResult(
|
||||
$query, null, null, $GLOBALS['controllink']
|
||||
);
|
||||
@ -187,14 +187,14 @@ function PMA_getInsertQuery($column, $def, $db, $central_list_table)
|
||||
$default = isset($def['Default'])?$def['Default']:"";
|
||||
$insQuery = 'INSERT INTO '
|
||||
. Util::backquote($central_list_table) . ' '
|
||||
. 'VALUES ( \'' . Util::sqlAddSlashes($db) . '\' ,'
|
||||
. '\'' . Util::sqlAddSlashes($column) . '\',\''
|
||||
. Util::sqlAddSlashes($type) . '\','
|
||||
. '\'' . Util::sqlAddSlashes($length) . '\',\''
|
||||
. Util::sqlAddSlashes($collation) . '\','
|
||||
. '\'' . Util::sqlAddSlashes($isNull) . '\','
|
||||
. 'VALUES ( \'' . $GLOBALS['dbi']->escapeString($db) . '\' ,'
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($column) . '\',\''
|
||||
. $GLOBALS['dbi']->escapeString($type) . '\','
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($length) . '\',\''
|
||||
. $GLOBALS['dbi']->escapeString($collation) . '\','
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($isNull) . '\','
|
||||
. '\'' . implode(',', array($extra, $attribute))
|
||||
. '\',\'' . Util::sqlAddSlashes($default) . '\');';
|
||||
. '\',\'' . $GLOBALS['dbi']->escapeString($default) . '\');';
|
||||
return $insQuery;
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ function PMA_syncUniqueColumns($field_select, $isTable=true, $table=null)
|
||||
$db, $table, null, true, $GLOBALS['userlink']
|
||||
);
|
||||
foreach ($fields[$table] as $field => $def) {
|
||||
$cols .= "'" . Util::sqlAddSlashes($field) . "',";
|
||||
$cols .= "'" . $GLOBALS['dbi']->escapeString($field) . "',";
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ function PMA_syncUniqueColumns($field_select, $isTable=true, $table=null)
|
||||
$table = $_REQUEST['table'];
|
||||
}
|
||||
foreach ($field_select as $column) {
|
||||
$cols .= "'" . Util::sqlAddSlashes($column) . "',";
|
||||
$cols .= "'" . $GLOBALS['dbi']->escapeString($column) . "',";
|
||||
}
|
||||
$has_list = PMA_findExistingColNames($db, trim($cols, ','));
|
||||
foreach ($field_select as $column) {
|
||||
@ -336,7 +336,7 @@ function PMA_deleteColumnsFromList($field_select, $isTable=true)
|
||||
$db, $table, $GLOBALS['userlink']
|
||||
);
|
||||
foreach ($fields[$table] as $col_select) {
|
||||
$cols .= '\'' . Util::sqlAddSlashes($col_select) . '\',';
|
||||
$cols .= '\'' . $GLOBALS['dbi']->escapeString($col_select) . '\',';
|
||||
}
|
||||
}
|
||||
$cols = trim($cols, ',');
|
||||
@ -352,7 +352,7 @@ function PMA_deleteColumnsFromList($field_select, $isTable=true)
|
||||
} else {
|
||||
$cols = '';
|
||||
foreach ($field_select as $col_select) {
|
||||
$cols .= '\'' . Util::sqlAddSlashes($col_select) . '\',';
|
||||
$cols .= '\'' . $GLOBALS['dbi']->escapeString($col_select) . '\',';
|
||||
}
|
||||
$cols = trim($cols, ',');
|
||||
$has_list = PMA_findExistingColNames($db, $cols);
|
||||
@ -376,7 +376,7 @@ function PMA_deleteColumnsFromList($field_select, $isTable=true)
|
||||
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
|
||||
|
||||
$query = 'DELETE FROM ' . Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . Util::sqlAddSlashes($db) . '\' AND col_name IN (' . $cols . ');';
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\' AND col_name IN (' . $cols . ');';
|
||||
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['controllink'])) {
|
||||
$message = Message::error(__('Could not remove columns!'));
|
||||
@ -414,7 +414,7 @@ function PMA_makeConsistentWithList($db, $selected_tables)
|
||||
//it is not referenced by another column
|
||||
if ($column_status['isEditable']) {
|
||||
$query .= ' MODIFY ' . Util::backquote($column['col_name']) . ' '
|
||||
. Util::sqlAddSlashes($column['col_type']);
|
||||
. $GLOBALS['dbi']->escapeString($column['col_type']);
|
||||
if ($column['col_length']) {
|
||||
$query .= '(' . $column['col_length'] . ')';
|
||||
}
|
||||
@ -429,11 +429,11 @@ function PMA_makeConsistentWithList($db, $selected_tables)
|
||||
$query .= ' ' . $column['col_extra'];
|
||||
if ($column['col_default']) {
|
||||
if ($column['col_default'] != 'CURRENT_TIMESTAMP') {
|
||||
$query .= ' DEFAULT \'' . Util::sqlAddSlashes(
|
||||
$query .= ' DEFAULT \'' . $GLOBALS['dbi']->escapeString(
|
||||
$column['col_default']
|
||||
) . '\'';
|
||||
} else {
|
||||
$query .= ' DEFAULT ' . Util::sqlAddSlashes(
|
||||
$query .= ' DEFAULT ' . $GLOBALS['dbi']->escapeString(
|
||||
$column['col_default']
|
||||
);
|
||||
}
|
||||
@ -481,7 +481,7 @@ function PMA_getCentralColumnsFromTable($db, $table, $allFields=false)
|
||||
);
|
||||
$cols = '';
|
||||
foreach ($fields as $col_select) {
|
||||
$cols .= '\'' . Util::sqlAddSlashes($col_select) . '\',';
|
||||
$cols .= '\'' . $GLOBALS['dbi']->escapeString($col_select) . '\',';
|
||||
}
|
||||
$cols = trim($cols, ',');
|
||||
$has_list = PMA_findExistingColNames($db, $cols, $allFields);
|
||||
@ -531,16 +531,16 @@ function PMA_updateOneColumn($db, $orig_col_name, $col_name, $col_type,
|
||||
$query = PMA_getInsertQuery($col_name, $def, $db, $centralTable);
|
||||
} else {
|
||||
$query = 'UPDATE ' . Util::backquote($centralTable)
|
||||
. ' SET col_type = \'' . Util::sqlAddSlashes($col_type) . '\''
|
||||
. ', col_name = \'' . Util::sqlAddSlashes($col_name) . '\''
|
||||
. ', col_length = \'' . Util::sqlAddSlashes($col_length) . '\''
|
||||
. ' SET col_type = \'' . $GLOBALS['dbi']->escapeString($col_type) . '\''
|
||||
. ', col_name = \'' . $GLOBALS['dbi']->escapeString($col_name) . '\''
|
||||
. ', col_length = \'' . $GLOBALS['dbi']->escapeString($col_length) . '\''
|
||||
. ', col_isNull = ' . $col_isNull
|
||||
. ', col_collation = \'' . Util::sqlAddSlashes($collation) . '\''
|
||||
. ', col_collation = \'' . $GLOBALS['dbi']->escapeString($collation) . '\''
|
||||
. ', col_extra = \''
|
||||
. implode(',', array($col_extra, $col_attribute)) . '\''
|
||||
. ', col_default = \'' . Util::sqlAddSlashes($col_default) . '\''
|
||||
. ' WHERE db_name = \'' . Util::sqlAddSlashes($db) . '\' '
|
||||
. 'AND col_name = \'' . Util::sqlAddSlashes($orig_col_name)
|
||||
. ', col_default = \'' . $GLOBALS['dbi']->escapeString($col_default) . '\''
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\' '
|
||||
. 'AND col_name = \'' . $GLOBALS['dbi']->escapeString($orig_col_name)
|
||||
. '\'';
|
||||
}
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['controllink'])) {
|
||||
@ -1147,7 +1147,7 @@ function PMA_getCentralColumnsListRaw($db, $table)
|
||||
$centralTable = $cfgCentralColumns['table'];
|
||||
if (empty($table) || $table == '') {
|
||||
$query = 'SELECT * FROM ' . Util::backquote($centralTable) . ' '
|
||||
. 'WHERE db_name = \'' . Util::sqlAddSlashes($db) . '\';';
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\';';
|
||||
} else {
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$columns = (array) $GLOBALS['dbi']->getColumnNames(
|
||||
@ -1155,11 +1155,11 @@ function PMA_getCentralColumnsListRaw($db, $table)
|
||||
);
|
||||
$cols = '';
|
||||
foreach ($columns as $col_select) {
|
||||
$cols .= '\'' . Util::sqlAddSlashes($col_select) . '\',';
|
||||
$cols .= '\'' . $GLOBALS['dbi']->escapeString($col_select) . '\',';
|
||||
}
|
||||
$cols = trim($cols, ',');
|
||||
$query = 'SELECT * FROM ' . Util::backquote($centralTable) . ' '
|
||||
. 'WHERE db_name = \'' . Util::sqlAddSlashes($db) . '\'';
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
if ($cols) {
|
||||
$query .= ' AND col_name NOT IN (' . $cols . ')';
|
||||
}
|
||||
@ -1383,7 +1383,7 @@ function PMA_getHTMLforEditingPage($selected_fld,$selected_db)
|
||||
$html .= PMA_getCentralColumnsEditTableHeader($header_cells);
|
||||
$selected_fld_safe = array();
|
||||
foreach ($selected_fld as $key) {
|
||||
$selected_fld_safe[] = Util::sqlAddSlashes($key);
|
||||
$selected_fld_safe[] = $GLOBALS['dbi']->escapeString($key);
|
||||
}
|
||||
$columns_list = implode("','", $selected_fld_safe);
|
||||
$columns_list = "'" . $columns_list . "'";
|
||||
|
||||
@ -877,7 +877,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
if ($cfg['Server']['SessionTimeZone'] != '') {
|
||||
$sql_query_tz = 'SET ' . Util::backquote('time_zone') . ' = '
|
||||
. '\''
|
||||
. Util::sqlAddSlashes($cfg['Server']['SessionTimeZone'])
|
||||
. $GLOBALS['dbi']->escapeString($cfg['Server']['SessionTimeZone'])
|
||||
. '\'';
|
||||
|
||||
if (! $userlink->query($sql_query_tz)) {
|
||||
|
||||
@ -134,7 +134,7 @@ class ServerVariablesController extends Controller
|
||||
// when server is running in ANSI_QUOTES sql_mode
|
||||
$varValue = $this->dbi->fetchSingleRow(
|
||||
'SHOW GLOBAL VARIABLES WHERE Variable_name=\''
|
||||
. Util::sqlAddSlashes($_REQUEST['varName']) . '\';',
|
||||
. $GLOBALS['dbi']->escapeString($_REQUEST['varName']) . '\';',
|
||||
'NUM'
|
||||
);
|
||||
|
||||
@ -186,7 +186,7 @@ class ServerVariablesController extends Controller
|
||||
$exp[mb_strtolower($matches[3])]
|
||||
);
|
||||
} else {
|
||||
$value = Util::sqlAddSlashes($value);
|
||||
$value = $GLOBALS['dbi']->escapeString($value);
|
||||
}
|
||||
|
||||
if (! is_numeric($value)) {
|
||||
@ -201,7 +201,7 @@ class ServerVariablesController extends Controller
|
||||
// Some values are rounded down etc.
|
||||
$varValue = $this->dbi->fetchSingleRow(
|
||||
'SHOW GLOBAL VARIABLES WHERE Variable_name="'
|
||||
. Util::sqlAddSlashes($_REQUEST['varName'])
|
||||
. $GLOBALS['dbi']->escapeString($_REQUEST['varName'])
|
||||
. '";', 'NUM'
|
||||
);
|
||||
$this->response->addJSON(
|
||||
|
||||
@ -716,7 +716,7 @@ class TableSearchController extends TableController
|
||||
. " FROM " . Util::backquote($this->db)
|
||||
. "." . Util::backquote($this->table)
|
||||
. " WHERE " . Util::backquote($column)
|
||||
. " RLIKE '" . Util::sqlAddSlashes($find) . "' COLLATE "
|
||||
. " RLIKE '" . $GLOBALS['dbi']->escapeString($find) . "' COLLATE "
|
||||
. $charSet . "_bin"; // here we
|
||||
// change the collation of the 2nd operand to a case sensitive
|
||||
// binary collation to make sure that the comparison is case sensitive
|
||||
@ -774,13 +774,13 @@ class TableSearchController extends TableController
|
||||
if (is_array($toReplace)) {
|
||||
foreach ($toReplace as $row) {
|
||||
$sql_query .= "\n WHEN " . Util::backquote($column)
|
||||
. " = '" . Util::sqlAddSlashes($row[0])
|
||||
. "' THEN '" . Util::sqlAddSlashes($row[1]) . "'";
|
||||
. " = '" . $GLOBALS['dbi']->escapeString($row[0])
|
||||
. "' THEN '" . $GLOBALS['dbi']->escapeString($row[1]) . "'";
|
||||
}
|
||||
}
|
||||
$sql_query .= " END"
|
||||
. " WHERE " . Util::backquote($column)
|
||||
. " RLIKE '" . Util::sqlAddSlashes($find) . "' COLLATE "
|
||||
. " RLIKE '" . $GLOBALS['dbi']->escapeString($find) . "' COLLATE "
|
||||
. $charSet . "_bin"; // here we
|
||||
// change the collation of the 2nd operand to a case sensitive
|
||||
// binary collation to make sure that the comparison
|
||||
@ -1034,10 +1034,10 @@ class TableSearchController extends TableController
|
||||
$parens_close = '';
|
||||
}
|
||||
$enum_where = '\''
|
||||
. Util::sqlAddSlashes($criteriaValues[0]) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($criteriaValues[0]) . '\'';
|
||||
for ($e = 1; $e < $enum_selected_count; $e++) {
|
||||
$enum_where .= ', \''
|
||||
. Util::sqlAddSlashes($criteriaValues[$e]) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($criteriaValues[$e]) . '\'';
|
||||
}
|
||||
|
||||
return ' ' . $func_type . ' ' . $parens_open
|
||||
@ -1163,7 +1163,7 @@ class TableSearchController extends TableController
|
||||
&& 'NOT BETWEEN' != $func_type
|
||||
) {
|
||||
return $backquoted_name . ' ' . $func_type . ' ' . $quot
|
||||
. Util::sqlAddSlashes($criteriaValues) . $quot;
|
||||
. $GLOBALS['dbi']->escapeString($criteriaValues) . $quot;
|
||||
}
|
||||
$func_type = str_replace(' (...)', '', $func_type);
|
||||
|
||||
@ -1182,7 +1182,7 @@ class TableSearchController extends TableController
|
||||
$value = 'NULL';
|
||||
continue;
|
||||
}
|
||||
$value = $quot . Util::sqlAddSlashes(trim($value))
|
||||
$value = $quot . $GLOBALS['dbi']->escapeString(trim($value))
|
||||
. $quot;
|
||||
}
|
||||
|
||||
|
||||
@ -1211,8 +1211,8 @@ class TableStructureController extends TableController
|
||||
FROM `INFORMATION_SCHEMA`.`VIEWS`
|
||||
WHERE TABLE_SCHEMA='%s'
|
||||
AND TABLE_NAME='%s';",
|
||||
Util::sqlAddSlashes($this->db),
|
||||
Util::sqlAddSlashes($this->table)
|
||||
$GLOBALS['dbi']->escapeString($this->db),
|
||||
$GLOBALS['dbi']->escapeString($this->table)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -166,7 +166,7 @@ function PMA_buildIndexStatements($index, $index_choice,
|
||||
$keyBlockSizes = $index['Key_block_size'];
|
||||
if (! empty($keyBlockSizes)) {
|
||||
$sql_query .= " KEY_BLOCK_SIZE = "
|
||||
. PMA\libraries\Util::sqlAddSlashes($keyBlockSizes);
|
||||
. $GLOBALS['dbi']->escapeString($keyBlockSizes);
|
||||
}
|
||||
|
||||
// specifying index type is allowed only for primary, unique and index only
|
||||
@ -180,12 +180,12 @@ function PMA_buildIndexStatements($index, $index_choice,
|
||||
|
||||
$parser = $index['Parser'];
|
||||
if ($index['Index_choice'] == 'FULLTEXT' && ! empty($parser)) {
|
||||
$sql_query .= " WITH PARSER " . PMA\libraries\Util::sqlAddSlashes($parser);
|
||||
$sql_query .= " WITH PARSER " . $GLOBALS['dbi']->escapeString($parser);
|
||||
}
|
||||
|
||||
$comment = $index['Index_comment'];
|
||||
if (! empty($comment)) {
|
||||
$sql_query .= " COMMENT '" . PMA\libraries\Util::sqlAddSlashes($comment)
|
||||
$sql_query .= " COMMENT '" . $GLOBALS['dbi']->escapeString($comment)
|
||||
. "'";
|
||||
}
|
||||
|
||||
@ -424,11 +424,11 @@ function PMA_getTableCreationQuery($db, $table)
|
||||
&& $_REQUEST['tbl_storage_engine'] == 'FEDERATED'
|
||||
) {
|
||||
$sql_query .= " CONNECTION = '"
|
||||
. PMA\libraries\Util::sqlAddSlashes($_REQUEST['connection']) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($_REQUEST['connection']) . "'";
|
||||
}
|
||||
if (!empty($_REQUEST['comment'])) {
|
||||
$sql_query .= ' COMMENT = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($_REQUEST['comment']) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($_REQUEST['comment']) . '\'';
|
||||
}
|
||||
$sql_query .= PMA_getPartitionsDefinition();
|
||||
$sql_query .= ';';
|
||||
|
||||
@ -82,7 +82,7 @@ function PMA_getPageIdsAndNames($db)
|
||||
$page_query = "SELECT `page_nr`, `page_descr` FROM "
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db']) . "."
|
||||
. PMA\libraries\Util::backquote($cfgRelation['pdf_pages'])
|
||||
. " WHERE db_name = '" . PMA\libraries\Util::sqlAddSlashes($db) . "'"
|
||||
. " WHERE db_name = '" . $GLOBALS['dbi']->escapeString($db) . "'"
|
||||
. " ORDER BY `page_descr`";
|
||||
$page_rs = PMA_queryAsControlUser(
|
||||
$page_query, false, PMA\libraries\DatabaseInterface::QUERY_STORE
|
||||
|
||||
@ -62,7 +62,7 @@ if (empty($is_table)
|
||||
if (! $is_table) {
|
||||
$_result = $GLOBALS['dbi']->tryQuery(
|
||||
'SHOW TABLES LIKE \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($table, true) . '\';',
|
||||
. $GLOBALS['dbi']->escapeString($table, true) . '\';',
|
||||
null, PMA\libraries\DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$is_table = @$GLOBALS['dbi']->numRows($_result);
|
||||
|
||||
@ -1256,4 +1256,17 @@ class DBIDummy implements DBIExtension
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* returns properly escaped string for use in MySQL queries
|
||||
*
|
||||
* @param mixed $link database link
|
||||
* @param string $str string to be escaped
|
||||
*
|
||||
* @return string a MySQL escaped string
|
||||
*/
|
||||
public function escapeString($link, $str)
|
||||
{
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,4 +235,14 @@ interface DBIExtension
|
||||
* @return string field flags
|
||||
*/
|
||||
public function fieldFlags($result, $i);
|
||||
|
||||
/**
|
||||
* returns properly escaped string for use in MySQL queries
|
||||
*
|
||||
* @param mixed $link database link
|
||||
* @param string $str string to be escaped
|
||||
*
|
||||
* @return string a MySQL escaped string
|
||||
*/
|
||||
public function escapeString($link, $str);
|
||||
}
|
||||
|
||||
@ -471,4 +471,17 @@ class DBIMysql implements DBIExtension
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns properly escaped string for use in MySQL queries
|
||||
*
|
||||
* @param mixed $link database link
|
||||
* @param string $str string to be escaped
|
||||
*
|
||||
* @return string a MySQL escaped string
|
||||
*/
|
||||
public function escapeString($link, $str)
|
||||
{
|
||||
return mysql_real_escape_string($str, $link);
|
||||
}
|
||||
}
|
||||
|
||||
@ -615,4 +615,17 @@ class DBIMysqli implements DBIExtension
|
||||
}
|
||||
return implode(' ', $flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns properly escaped string for use in MySQL queries
|
||||
*
|
||||
* @param mixed $link database link
|
||||
* @param string $str string to be escaped
|
||||
*
|
||||
* @return string a MySQL escaped string
|
||||
*/
|
||||
public function escapeString($link, $str)
|
||||
{
|
||||
return mysqli_real_escape_string($link, $str);
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,8 +249,8 @@ function PMA_getOptionsForExportTemplates($export_type)
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db']) . '.'
|
||||
. PMA\libraries\Util::backquote($cfgRelation['export_templates'])
|
||||
. " WHERE `username` = "
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user'])
|
||||
. "' AND `export_type` = '" . PMA\libraries\Util::sqlAddSlashes($export_type) . "'"
|
||||
. "'" . $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user'])
|
||||
. "' AND `export_type` = '" . $GLOBALS['dbi']->escapeString($export_type) . "'"
|
||||
. " ORDER BY `template_name`;";
|
||||
|
||||
$result = PMA_queryAsControlUser($query);
|
||||
@ -1113,14 +1113,14 @@ function PMA_getExportDisplay(
|
||||
function PMA_handleExportTemplateActions($cfgRelation)
|
||||
{
|
||||
if (isset($_REQUEST['templateId'])) {
|
||||
$id = PMA\libraries\Util::sqlAddSlashes($_REQUEST['templateId']);
|
||||
$id = $GLOBALS['dbi']->escapeString($_REQUEST['templateId']);
|
||||
} else {
|
||||
$id = '';
|
||||
}
|
||||
|
||||
$templateTable = PMA\libraries\Util::backquote($cfgRelation['db']) . '.'
|
||||
. PMA\libraries\Util::backquote($cfgRelation['export_templates']);
|
||||
$user = PMA\libraries\Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']);
|
||||
$user = $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user']);
|
||||
|
||||
switch ($_REQUEST['templateAction']) {
|
||||
case 'create':
|
||||
@ -1129,9 +1129,9 @@ function PMA_handleExportTemplateActions($cfgRelation)
|
||||
. " `template_name`, `template_data`"
|
||||
. ") VALUES ("
|
||||
. "'" . $user . "', "
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($_REQUEST['exportType'])
|
||||
. "', '" . PMA\libraries\Util::sqlAddSlashes($_REQUEST['templateName'])
|
||||
. "', '" . PMA\libraries\Util::sqlAddSlashes($_REQUEST['templateData'])
|
||||
. "'" . $GLOBALS['dbi']->escapeString($_REQUEST['exportType'])
|
||||
. "', '" . $GLOBALS['dbi']->escapeString($_REQUEST['templateName'])
|
||||
. "', '" . $GLOBALS['dbi']->escapeString($_REQUEST['templateData'])
|
||||
. "');";
|
||||
break;
|
||||
case 'load':
|
||||
@ -1140,7 +1140,7 @@ function PMA_handleExportTemplateActions($cfgRelation)
|
||||
break;
|
||||
case 'update':
|
||||
$query = "UPDATE " . $templateTable . " SET `template_data` = "
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($_REQUEST['templateData']) . "'"
|
||||
. "'" . $GLOBALS['dbi']->escapeString($_REQUEST['templateData']) . "'"
|
||||
. " WHERE `id` = " . $id . " AND `username` = '" . $user . "'";
|
||||
break;
|
||||
case 'delete':
|
||||
|
||||
@ -655,8 +655,8 @@ function PMA_exportDatabase(
|
||||
// This obtains the current table's size
|
||||
$query = 'SELECT data_length + index_length
|
||||
from information_schema.TABLES
|
||||
WHERE table_schema = "' . PMA\libraries\Util::sqlAddSlashes($db) . '"
|
||||
AND table_name = "' . PMA\libraries\Util::sqlAddSlashes($table) . '"';
|
||||
WHERE table_schema = "' . $GLOBALS['dbi']->escapeString($db) . '"
|
||||
AND table_name = "' . $GLOBALS['dbi']->escapeString($table) . '"';
|
||||
|
||||
$size = $GLOBALS['dbi']->fetchValue($query);
|
||||
//Converting the size to MB
|
||||
|
||||
@ -1144,7 +1144,7 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null,
|
||||
}
|
||||
|
||||
$tempSQLStr .= (($is_varchar) ? "'" : "");
|
||||
$tempSQLStr .= PMA\libraries\Util::sqlAddSlashes(
|
||||
$tempSQLStr .= $GLOBALS['dbi']->escapeString(
|
||||
(string) $tables[$i][ROWS][$j][$k]
|
||||
);
|
||||
$tempSQLStr .= (($is_varchar) ? "'" : "");
|
||||
|
||||
@ -2255,7 +2255,7 @@ function PMA_getCurrentValueAsAnArrayForMultipleEdit( $multi_edit_funcs,
|
||||
|| $multi_edit_funcs[$key] == "ENCRYPT"))
|
||||
) {
|
||||
return $multi_edit_funcs[$key] . '(' . $current_value . ",'"
|
||||
. PMA\libraries\Util::sqlAddSlashes($multi_edit_salt[$key]) . "')";
|
||||
. $GLOBALS['dbi']->escapeString($multi_edit_salt[$key]) . "')";
|
||||
} else {
|
||||
return $multi_edit_funcs[$key] . '(' . $current_value . ')';
|
||||
}
|
||||
@ -2314,7 +2314,7 @@ function PMA_getQueryValuesForInsertAndUpdateInMultipleEdit($multi_edit_columns_
|
||||
. ' = ' . $current_value_as_an_array;
|
||||
} elseif (empty($multi_edit_funcs[$key])
|
||||
&& isset($multi_edit_columns_prev[$key])
|
||||
&& (("'" . PMA\libraries\Util::sqlAddSlashes($multi_edit_columns_prev[$key]) . "'" === $current_value)
|
||||
&& (("'" . $GLOBALS['dbi']->escapeString($multi_edit_columns_prev[$key]) . "'" === $current_value)
|
||||
|| ('0x' . $multi_edit_columns_prev[$key] === $current_value))
|
||||
) {
|
||||
// No change for this column and no MySQL function is used -> next column
|
||||
@ -2373,7 +2373,7 @@ function PMA_getCurrentValueForDifferentTypes($possibly_uploaded_val, $key,
|
||||
if (false !== $possibly_uploaded_val) {
|
||||
$current_value = $possibly_uploaded_val;
|
||||
} else if (! empty($multi_edit_funcs[$key])) {
|
||||
$current_value = "'" . PMA\libraries\Util::sqlAddSlashes($current_value)
|
||||
$current_value = "'" . $GLOBALS['dbi']->escapeString($current_value)
|
||||
. "'";
|
||||
} else {
|
||||
// c o l u m n v a l u e i n t h e f o r m
|
||||
@ -2401,7 +2401,7 @@ function PMA_getCurrentValueForDifferentTypes($possibly_uploaded_val, $key,
|
||||
',', $_REQUEST['fields']['multi_edit'][$rownumber][$key]
|
||||
);
|
||||
$current_value = "'"
|
||||
. PMA\libraries\Util::sqlAddSlashes($current_value) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($current_value) . "'";
|
||||
} else {
|
||||
$current_value = "''";
|
||||
}
|
||||
@ -2424,12 +2424,12 @@ function PMA_getCurrentValueForDifferentTypes($possibly_uploaded_val, $key,
|
||||
$current_value = '0x' . $current_value;
|
||||
} elseif ($type == 'bit') {
|
||||
$current_value = preg_replace('/[^01]/', '0', $current_value);
|
||||
$current_value = "b'" . PMA\libraries\Util::sqlAddSlashes($current_value)
|
||||
$current_value = "b'" . $GLOBALS['dbi']->escapeString($current_value)
|
||||
. "'";
|
||||
} elseif (! ($type == 'datetime' || $type == 'timestamp')
|
||||
|| $current_value != 'CURRENT_TIMESTAMP'
|
||||
) {
|
||||
$current_value = "'" . PMA\libraries\Util::sqlAddSlashes($current_value)
|
||||
$current_value = "'" . $GLOBALS['dbi']->escapeString($current_value)
|
||||
. "'";
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ function PMA_getDbCollation($db)
|
||||
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
// this is slow with thousands of databases
|
||||
$sql = 'SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA'
|
||||
. ' WHERE SCHEMA_NAME = \'' . Util::sqlAddSlashes($db)
|
||||
. ' WHERE SCHEMA_NAME = \'' . $GLOBALS['dbi']->escapeString($db)
|
||||
. '\' LIMIT 1';
|
||||
return $GLOBALS['dbi']->fetchValue($sql);
|
||||
} else {
|
||||
|
||||
@ -90,11 +90,11 @@ class Navigation
|
||||
$sqlQuery = "INSERT INTO " . $navTable
|
||||
. "(`username`, `item_name`, `item_type`, `db_name`, `table_name`)"
|
||||
. " VALUES ("
|
||||
. "'" . Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . "',"
|
||||
. "'" . Util::sqlAddSlashes($itemName) . "',"
|
||||
. "'" . Util::sqlAddSlashes($itemType) . "',"
|
||||
. "'" . Util::sqlAddSlashes($dbName) . "',"
|
||||
. "'" . (! empty($tableName)? Util::sqlAddSlashes($tableName) : "" )
|
||||
. "'" . $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user']) . "',"
|
||||
. "'" . $GLOBALS['dbi']->escapeString($itemName) . "',"
|
||||
. "'" . $GLOBALS['dbi']->escapeString($itemType) . "',"
|
||||
. "'" . $GLOBALS['dbi']->escapeString($dbName) . "',"
|
||||
. "'" . (! empty($tableName)? $GLOBALS['dbi']->escapeString($tableName) : "" )
|
||||
. "')";
|
||||
PMA_queryAsControlUser($sqlQuery, false);
|
||||
}
|
||||
@ -139,12 +139,12 @@ class Navigation
|
||||
$sqlQuery = "DELETE FROM " . $navTable
|
||||
. " WHERE"
|
||||
. " `username`='"
|
||||
. Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . "'"
|
||||
. " AND `item_name`='" . Util::sqlAddSlashes($itemName) . "'"
|
||||
. " AND `item_type`='" . Util::sqlAddSlashes($itemType) . "'"
|
||||
. " AND `db_name`='" . Util::sqlAddSlashes($dbName) . "'"
|
||||
. $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user']) . "'"
|
||||
. " AND `item_name`='" . $GLOBALS['dbi']->escapeString($itemName) . "'"
|
||||
. " AND `item_type`='" . $GLOBALS['dbi']->escapeString($itemType) . "'"
|
||||
. " AND `db_name`='" . $GLOBALS['dbi']->escapeString($dbName) . "'"
|
||||
. (! empty($tableName)
|
||||
? " AND `table_name`='" . Util::sqlAddSlashes($tableName) . "'"
|
||||
? " AND `table_name`='" . $GLOBALS['dbi']->escapeString($tableName) . "'"
|
||||
: ""
|
||||
);
|
||||
PMA_queryAsControlUser($sqlQuery, false);
|
||||
@ -169,10 +169,10 @@ class Navigation
|
||||
. "." . Util::backquote($GLOBALS['cfgRelation']['navigationhiding']);
|
||||
$sqlQuery = "SELECT `item_name`, `item_type` FROM " . $navTable
|
||||
. " WHERE `username`='"
|
||||
. Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . "'"
|
||||
. " AND `db_name`='" . Util::sqlAddSlashes($dbName) . "'"
|
||||
. $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user']) . "'"
|
||||
. " AND `db_name`='" . $GLOBALS['dbi']->escapeString($dbName) . "'"
|
||||
. " AND `table_name`='"
|
||||
. (! empty($tableName) ? Util::sqlAddSlashes($tableName) : '') . "'";
|
||||
. (! empty($tableName) ? $GLOBALS['dbi']->escapeString($tableName) : '') . "'";
|
||||
$result = PMA_queryAsControlUser($sqlQuery, false);
|
||||
|
||||
$hidden = array();
|
||||
|
||||
@ -174,7 +174,7 @@ class NavigationTree
|
||||
$query = "SELECT (COUNT(DB_first_level) DIV %d) * %d ";
|
||||
$query .= "from ( ";
|
||||
$query .= " SELECT distinct SUBSTRING_INDEX(SCHEMA_NAME, ";
|
||||
$query .= " '" . Util::sqlAddSlashes($GLOBALS['cfg']['NavigationTreeDbSeparator']) . "', 1) ";
|
||||
$query .= " '" . $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['NavigationTreeDbSeparator']) . "', 1) ";
|
||||
$query .= " DB_first_level ";
|
||||
$query .= " FROM INFORMATION_SCHEMA.SCHEMATA ";
|
||||
$query .= " WHERE `SCHEMA_NAME` < '%s' ";
|
||||
@ -185,7 +185,7 @@ class NavigationTree
|
||||
$query,
|
||||
(int)$GLOBALS['cfg']['FirstLevelNavigationItems'],
|
||||
(int)$GLOBALS['cfg']['FirstLevelNavigationItems'],
|
||||
Util::sqlAddSlashes($GLOBALS['db'])
|
||||
$GLOBALS['dbi']->escapeString($GLOBALS['db'])
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -434,7 +434,7 @@ class Node
|
||||
$query .= "SELECT DB_first_level ";
|
||||
$query .= "FROM ( ";
|
||||
$query .= "SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, ";
|
||||
$query .= "'" . Util::sqlAddSlashes($dbSeparator) . "', 1) ";
|
||||
$query .= "'" . $GLOBALS['dbi']->escapeString($dbSeparator) . "', 1) ";
|
||||
$query .= "DB_first_level ";
|
||||
$query .= "FROM INFORMATION_SCHEMA.SCHEMATA ";
|
||||
$query .= $this->_getWhereClause('SCHEMA_NAME', $searchClause);
|
||||
@ -444,9 +444,9 @@ class Node
|
||||
$query .= ") t2 ";
|
||||
$query .= $this->_getWhereClause('SCHEMA_NAME', $searchClause);
|
||||
$query .= "AND 1 = LOCATE(CONCAT(DB_first_level, ";
|
||||
$query .= "'" . Util::sqlAddSlashes($dbSeparator) . "'), ";
|
||||
$query .= "'" . $GLOBALS['dbi']->escapeString($dbSeparator) . "'), ";
|
||||
$query .= "CONCAT(SCHEMA_NAME, ";
|
||||
$query .= "'" . Util::sqlAddSlashes($dbSeparator) . "')) ";
|
||||
$query .= "'" . $GLOBALS['dbi']->escapeString($dbSeparator) . "')) ";
|
||||
$query .= "ORDER BY SCHEMA_NAME ASC";
|
||||
$retval = $GLOBALS['dbi']->fetchResult($query);
|
||||
|
||||
@ -480,7 +480,7 @@ class Node
|
||||
$subClauses = array();
|
||||
foreach ($prefixes as $prefix) {
|
||||
$subClauses[] = " LOCATE('"
|
||||
. Util::sqlAddSlashes($prefix) . $dbSeparator
|
||||
. $GLOBALS['dbi']->escapeString($prefix) . $dbSeparator
|
||||
. "', "
|
||||
. "CONCAT(`Database`, '" . $dbSeparator . "')) = 1 ";
|
||||
}
|
||||
@ -685,7 +685,7 @@ class Node
|
||||
{
|
||||
if (!empty($searchClause)) {
|
||||
$databases = array(
|
||||
"%" . Util::sqlAddSlashes($searchClause, true) . "%",
|
||||
"%" . $GLOBALS['dbi']->escapeString($searchClause, true) . "%",
|
||||
);
|
||||
} elseif (!empty($GLOBALS['cfg']['Server']['only_db'])) {
|
||||
$databases = $GLOBALS['cfg']['Server']['only_db'];
|
||||
@ -712,7 +712,7 @@ class Node
|
||||
if (!empty($searchClause)) {
|
||||
$whereClause .= "AND " . Util::backquote($columnName)
|
||||
. " LIKE '%";
|
||||
$whereClause .= Util::sqlAddSlashes(
|
||||
$whereClause .= $GLOBALS['dbi']->escapeString(
|
||||
$searchClause,
|
||||
true
|
||||
);
|
||||
@ -722,7 +722,7 @@ class Node
|
||||
if (!empty($GLOBALS['cfg']['Server']['hide_db'])) {
|
||||
$whereClause .= "AND " . Util::backquote($columnName)
|
||||
. " NOT REGEXP '"
|
||||
. Util::sqlAddSlashes($GLOBALS['cfg']['Server']['hide_db'], true)
|
||||
. $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['hide_db'], true)
|
||||
. "' ";
|
||||
}
|
||||
|
||||
@ -737,7 +737,7 @@ class Node
|
||||
foreach ($GLOBALS['cfg']['Server']['only_db'] as $each_only_db) {
|
||||
$subClauses[] = " " . Util::backquote($columnName)
|
||||
. " LIKE '"
|
||||
. Util::sqlAddSlashes($each_only_db, true) . "' ";
|
||||
. $GLOBALS['dbi']->escapeString($each_only_db, true) . "' ";
|
||||
}
|
||||
$whereClause .= implode("OR", $subClauses) . ") ";
|
||||
}
|
||||
@ -817,7 +817,7 @@ class Node
|
||||
);
|
||||
$sqlQuery = "SELECT `db_name`, COUNT(*) AS `count` FROM " . $navTable
|
||||
. " WHERE `username`='"
|
||||
. Util::sqlAddSlashes(
|
||||
. $GLOBALS['dbi']->escapeString(
|
||||
$GLOBALS['cfg']['Server']['user']
|
||||
) . "'"
|
||||
. " GROUP BY `db_name`";
|
||||
|
||||
@ -115,7 +115,7 @@ class NodeDatabase extends Node
|
||||
}
|
||||
|
||||
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
$db = Util::sqlAddSlashes($db);
|
||||
$db = $GLOBALS['dbi']->escapeString($db);
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
|
||||
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
|
||||
@ -199,7 +199,7 @@ class NodeDatabase extends Node
|
||||
{
|
||||
$db = $this->real_name;
|
||||
if (!$GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
$db = Util::sqlAddSlashes($db);
|
||||
$db = $GLOBALS['dbi']->escapeString($db);
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
|
||||
$query .= "WHERE `ROUTINE_SCHEMA` "
|
||||
@ -214,7 +214,7 @@ class NodeDatabase extends Node
|
||||
}
|
||||
$retval = (int)$GLOBALS['dbi']->fetchValue($query);
|
||||
} else {
|
||||
$db = Util::sqlAddSlashes($db);
|
||||
$db = $GLOBALS['dbi']->escapeString($db);
|
||||
$query = "SHOW PROCEDURE STATUS WHERE `Db`='$db' ";
|
||||
if (!empty($searchClause)) {
|
||||
$query .= "AND " . $this->_getWhereClauseForSearch(
|
||||
@ -245,7 +245,7 @@ class NodeDatabase extends Node
|
||||
{
|
||||
$db = $this->real_name;
|
||||
if (!$GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
$db = Util::sqlAddSlashes($db);
|
||||
$db = $GLOBALS['dbi']->escapeString($db);
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
|
||||
$query .= "WHERE `ROUTINE_SCHEMA` "
|
||||
@ -260,7 +260,7 @@ class NodeDatabase extends Node
|
||||
}
|
||||
$retval = (int)$GLOBALS['dbi']->fetchValue($query);
|
||||
} else {
|
||||
$db = Util::sqlAddSlashes($db);
|
||||
$db = $GLOBALS['dbi']->escapeString($db);
|
||||
$query = "SHOW FUNCTION STATUS WHERE `Db`='$db' ";
|
||||
if (!empty($searchClause)) {
|
||||
$query .= "AND " . $this->_getWhereClauseForSearch(
|
||||
@ -291,7 +291,7 @@ class NodeDatabase extends Node
|
||||
{
|
||||
$db = $this->real_name;
|
||||
if (!$GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
$db = Util::sqlAddSlashes($db);
|
||||
$db = $GLOBALS['dbi']->escapeString($db);
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` ";
|
||||
$query .= "WHERE `EVENT_SCHEMA` "
|
||||
@ -339,10 +339,10 @@ class NodeDatabase extends Node
|
||||
$query = '';
|
||||
if ($singleItem) {
|
||||
$query .= Util::backquote($columnName) . " = ";
|
||||
$query .= "'" . Util::sqlAddSlashes($searchClause) . "'";
|
||||
$query .= "'" . $GLOBALS['dbi']->escapeString($searchClause) . "'";
|
||||
} else {
|
||||
$query .= Util::backquote($columnName) . " LIKE ";
|
||||
$query .= "'%" . Util::sqlAddSlashes($searchClause, true)
|
||||
$query .= "'%" . $GLOBALS['dbi']->escapeString($searchClause, true)
|
||||
. "%'";
|
||||
}
|
||||
|
||||
@ -418,7 +418,7 @@ class NodeDatabase extends Node
|
||||
$sqlQuery = "SELECT `item_name` FROM " . $navTable
|
||||
. " WHERE `username`='" . $cfgRelation['user'] . "'"
|
||||
. " AND `item_type`='" . $type
|
||||
. "'" . " AND `db_name`='" . Util::sqlAddSlashes($db)
|
||||
. "'" . " AND `db_name`='" . $GLOBALS['dbi']->escapeString($db)
|
||||
. "'";
|
||||
$result = PMA_queryAsControlUser($sqlQuery, false);
|
||||
$hiddenItems = array();
|
||||
@ -452,14 +452,14 @@ class NodeDatabase extends Node
|
||||
$retval = array();
|
||||
$db = $this->real_name;
|
||||
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
$escdDb = Util::sqlAddSlashes($db);
|
||||
$escdDb = $GLOBALS['dbi']->escapeString($db);
|
||||
$query = "SELECT `TABLE_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
|
||||
$query .= "WHERE `TABLE_SCHEMA`='$escdDb' ";
|
||||
$query .= "AND `TABLE_TYPE`" . $condition . "'BASE TABLE' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `TABLE_NAME` LIKE '%";
|
||||
$query .= Util::sqlAddSlashes(
|
||||
$query .= $GLOBALS['dbi']->escapeString(
|
||||
$searchClause,
|
||||
true
|
||||
);
|
||||
@ -476,7 +476,7 @@ class NodeDatabase extends Node
|
||||
$query .= "AND " . Util::backquote(
|
||||
"Tables_in_" . $db
|
||||
);
|
||||
$query .= " LIKE '%" . Util::sqlAddSlashes(
|
||||
$query .= " LIKE '%" . $GLOBALS['dbi']->escapeString(
|
||||
$searchClause,
|
||||
true
|
||||
);
|
||||
@ -542,7 +542,7 @@ class NodeDatabase extends Node
|
||||
$retval = array();
|
||||
$db = $this->real_name;
|
||||
if (!$GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
$escdDb = Util::sqlAddSlashes($db);
|
||||
$escdDb = $GLOBALS['dbi']->escapeString($db);
|
||||
$query = "SELECT `ROUTINE_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
|
||||
$query .= "WHERE `ROUTINE_SCHEMA` "
|
||||
@ -550,7 +550,7 @@ class NodeDatabase extends Node
|
||||
$query .= "AND `ROUTINE_TYPE`='" . $routineType . "' ";
|
||||
if (!empty($searchClause)) {
|
||||
$query .= "AND `ROUTINE_NAME` LIKE '%";
|
||||
$query .= Util::sqlAddSlashes(
|
||||
$query .= $GLOBALS['dbi']->escapeString(
|
||||
$searchClause,
|
||||
true
|
||||
);
|
||||
@ -560,11 +560,11 @@ class NodeDatabase extends Node
|
||||
$query .= "LIMIT " . intval($pos) . ", $maxItems";
|
||||
$retval = $GLOBALS['dbi']->fetchResult($query);
|
||||
} else {
|
||||
$escdDb = Util::sqlAddSlashes($db);
|
||||
$escdDb = $GLOBALS['dbi']->escapeString($db);
|
||||
$query = "SHOW " . $routineType . " STATUS WHERE `Db`='$escdDb' ";
|
||||
if (!empty($searchClause)) {
|
||||
$query .= "AND `Name` LIKE '%";
|
||||
$query .= Util::sqlAddSlashes(
|
||||
$query .= $GLOBALS['dbi']->escapeString(
|
||||
$searchClause,
|
||||
true
|
||||
);
|
||||
@ -629,14 +629,14 @@ class NodeDatabase extends Node
|
||||
$retval = array();
|
||||
$db = $this->real_name;
|
||||
if (!$GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
$escdDb = Util::sqlAddSlashes($db);
|
||||
$escdDb = $GLOBALS['dbi']->escapeString($db);
|
||||
$query = "SELECT `EVENT_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` ";
|
||||
$query .= "WHERE `EVENT_SCHEMA` "
|
||||
. Util::getCollateForIS() . "='$escdDb' ";
|
||||
if (!empty($searchClause)) {
|
||||
$query .= "AND `EVENT_NAME` LIKE '%";
|
||||
$query .= Util::sqlAddSlashes(
|
||||
$query .= $GLOBALS['dbi']->escapeString(
|
||||
$searchClause,
|
||||
true
|
||||
);
|
||||
@ -650,7 +650,7 @@ class NodeDatabase extends Node
|
||||
$query = "SHOW EVENTS FROM $escdDb ";
|
||||
if (!empty($searchClause)) {
|
||||
$query .= "WHERE `Name` LIKE '%";
|
||||
$query .= Util::sqlAddSlashes(
|
||||
$query .= $GLOBALS['dbi']->escapeString(
|
||||
$searchClause,
|
||||
true
|
||||
);
|
||||
|
||||
@ -94,8 +94,8 @@ class NodeTable extends NodeDatabaseChild
|
||||
switch ($type) {
|
||||
case 'columns':
|
||||
if (!$GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
$db = Util::sqlAddSlashes($db);
|
||||
$table = Util::sqlAddSlashes($table);
|
||||
$db = $GLOBALS['dbi']->escapeString($db);
|
||||
$table = $GLOBALS['dbi']->escapeString($table);
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`COLUMNS` ";
|
||||
$query .= "WHERE `TABLE_NAME`='$table' ";
|
||||
@ -120,8 +120,8 @@ class NodeTable extends NodeDatabaseChild
|
||||
break;
|
||||
case 'triggers':
|
||||
if (!$GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
$db = Util::sqlAddSlashes($db);
|
||||
$table = Util::sqlAddSlashes($table);
|
||||
$db = $GLOBALS['dbi']->escapeString($db);
|
||||
$table = $GLOBALS['dbi']->escapeString($table);
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`TRIGGERS` ";
|
||||
$query .= "WHERE `EVENT_OBJECT_SCHEMA` "
|
||||
@ -131,7 +131,7 @@ class NodeTable extends NodeDatabaseChild
|
||||
$retval = (int)$GLOBALS['dbi']->fetchValue($query);
|
||||
} else {
|
||||
$db = Util::backquote($db);
|
||||
$table = Util::sqlAddSlashes($table);
|
||||
$table = $GLOBALS['dbi']->escapeString($table);
|
||||
$query = "SHOW TRIGGERS FROM $db WHERE `Table` = '$table'";
|
||||
$retval = (int)$GLOBALS['dbi']->numRows(
|
||||
$GLOBALS['dbi']->tryQuery($query)
|
||||
@ -166,8 +166,8 @@ class NodeTable extends NodeDatabaseChild
|
||||
switch ($type) {
|
||||
case 'columns':
|
||||
if (!$GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
$db = Util::sqlAddSlashes($db);
|
||||
$table = Util::sqlAddSlashes($table);
|
||||
$db = $GLOBALS['dbi']->escapeString($db);
|
||||
$table = $GLOBALS['dbi']->escapeString($table);
|
||||
$query = "SELECT `COLUMN_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`COLUMNS` ";
|
||||
$query .= "WHERE `TABLE_NAME`='$table' ";
|
||||
@ -221,8 +221,8 @@ class NodeTable extends NodeDatabaseChild
|
||||
break;
|
||||
case 'triggers':
|
||||
if (!$GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
$db = Util::sqlAddSlashes($db);
|
||||
$table = Util::sqlAddSlashes($table);
|
||||
$db = $GLOBALS['dbi']->escapeString($db);
|
||||
$table = $GLOBALS['dbi']->escapeString($table);
|
||||
$query = "SELECT `TRIGGER_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`TRIGGERS` ";
|
||||
$query .= "WHERE `EVENT_OBJECT_SCHEMA` "
|
||||
@ -236,7 +236,7 @@ class NodeTable extends NodeDatabaseChild
|
||||
}
|
||||
|
||||
$db = Util::backquote($db);
|
||||
$table = Util::sqlAddSlashes($table);
|
||||
$table = $GLOBALS['dbi']->escapeString($table);
|
||||
$query = "SHOW TRIGGERS FROM $db WHERE `Table` = '$table'";
|
||||
$handle = $GLOBALS['dbi']->tryQuery($query);
|
||||
if ($handle === false) {
|
||||
|
||||
@ -515,7 +515,7 @@ function PMA_runEventDefinitionsForDb($db)
|
||||
{
|
||||
$event_names = $GLOBALS['dbi']->fetchResult(
|
||||
'SELECT EVENT_NAME FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($db, true) . '\';'
|
||||
. $GLOBALS['dbi']->escapeString($db) . '\';'
|
||||
);
|
||||
if ($event_names) {
|
||||
foreach ($event_names as $event_name) {
|
||||
@ -585,26 +585,26 @@ function PMA_AdjustPrivileges_moveDB($oldDb, $newname)
|
||||
|
||||
// For Db specific privileges
|
||||
$query_db_specific = 'UPDATE ' . Util::backquote('db')
|
||||
. 'SET Db = \'' . Util::sqlAddSlashes($newname)
|
||||
. '\' where Db = \'' . Util::sqlAddSlashes($oldDb) . '\';';
|
||||
. 'SET Db = \'' . $GLOBALS['dbi']->escapeString($newname)
|
||||
. '\' where Db = \'' . $GLOBALS['dbi']->escapeString($oldDb) . '\';';
|
||||
$GLOBALS['dbi']->query($query_db_specific);
|
||||
|
||||
// For table specific privileges
|
||||
$query_table_specific = 'UPDATE ' . Util::backquote('tables_priv')
|
||||
. 'SET Db = \'' . Util::sqlAddSlashes($newname)
|
||||
. '\' where Db = \'' . Util::sqlAddSlashes($oldDb) . '\';';
|
||||
. 'SET Db = \'' . $GLOBALS['dbi']->escapeString($newname)
|
||||
. '\' where Db = \'' . $GLOBALS['dbi']->escapeString($oldDb) . '\';';
|
||||
$GLOBALS['dbi']->query($query_table_specific);
|
||||
|
||||
// For column specific privileges
|
||||
$query_col_specific = 'UPDATE ' . Util::backquote('columns_priv')
|
||||
. 'SET Db = \'' . Util::sqlAddSlashes($newname)
|
||||
. '\' where Db = \'' . Util::sqlAddSlashes($oldDb) . '\';';
|
||||
. 'SET Db = \'' . $GLOBALS['dbi']->escapeString($newname)
|
||||
. '\' where Db = \'' . $GLOBALS['dbi']->escapeString($oldDb) . '\';';
|
||||
$GLOBALS['dbi']->query($query_col_specific);
|
||||
|
||||
// For procedures specific privileges
|
||||
$query_proc_specific = 'UPDATE ' . Util::backquote('procs_priv')
|
||||
. 'SET Db = \'' . Util::sqlAddSlashes($newname)
|
||||
. '\' where Db = \'' . Util::sqlAddSlashes($oldDb) . '\';';
|
||||
. 'SET Db = \'' . $GLOBALS['dbi']->escapeString($newname)
|
||||
. '\' where Db = \'' . $GLOBALS['dbi']->escapeString($oldDb) . '\';';
|
||||
$GLOBALS['dbi']->query($query_proc_specific);
|
||||
|
||||
// Finally FLUSH the new privileges
|
||||
@ -1771,7 +1771,7 @@ function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys,
|
||||
&& urldecode($_REQUEST['prev_comment']) !== $_REQUEST['comment']
|
||||
) {
|
||||
$table_alters[] = 'COMMENT = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($_REQUEST['comment']) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($_REQUEST['comment']) . '\'';
|
||||
}
|
||||
|
||||
if (! empty($newTblStorageEngine)
|
||||
@ -1830,7 +1830,7 @@ function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys,
|
||||
|| $_REQUEST['new_auto_increment'] !== $auto_increment)
|
||||
) {
|
||||
$table_alters[] = 'auto_increment = '
|
||||
. PMA\libraries\Util::sqlAddSlashes($_REQUEST['new_auto_increment']);
|
||||
. $GLOBALS['dbi']->escapeString($_REQUEST['new_auto_increment']);
|
||||
}
|
||||
|
||||
if (! empty($_REQUEST['new_row_format'])) {
|
||||
@ -1841,7 +1841,7 @@ function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys,
|
||||
|| $newRowFormatLower !== mb_strtolower($row_format))
|
||||
) {
|
||||
$table_alters[] = 'ROW_FORMAT = '
|
||||
. PMA\libraries\Util::sqlAddSlashes($newRowFormat);
|
||||
. $GLOBALS['dbi']->escapeString($newRowFormat);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1945,15 +1945,15 @@ function PMA_AdjustPrivileges_renameOrMoveTable($oldDb, $oldTable, $newDb, $newT
|
||||
|
||||
// For table specific privileges
|
||||
$query_table_specific = 'UPDATE ' . Util::backquote('tables_priv')
|
||||
. 'SET Db = \'' . Util::sqlAddSlashes($newDb) . '\', Table_name = \'' . Util::sqlAddSlashes($newTable)
|
||||
. '\' where Db = \'' . Util::sqlAddSlashes($oldDb) . '\' AND Table_name = \'' . Util::sqlAddSlashes($oldTable)
|
||||
. 'SET Db = \'' . $GLOBALS['dbi']->escapeString($newDb) . '\', Table_name = \'' . $GLOBALS['dbi']->escapeString($newTable)
|
||||
. '\' where Db = \'' . $GLOBALS['dbi']->escapeString($oldDb) . '\' AND Table_name = \'' . $GLOBALS['dbi']->escapeString($oldTable)
|
||||
. '\';';
|
||||
$GLOBALS['dbi']->query($query_table_specific);
|
||||
|
||||
// For column specific privileges
|
||||
$query_col_specific = 'UPDATE ' . Util::backquote('columns_priv')
|
||||
. 'SET Db = \'' . Util::sqlAddSlashes($newDb) . '\', Table_name = \'' . Util::sqlAddSlashes($newTable)
|
||||
. '\' where Db = \'' . Util::sqlAddSlashes($oldDb) . '\' AND Table_name = \'' . Util::sqlAddSlashes($oldTable)
|
||||
. 'SET Db = \'' . $GLOBALS['dbi']->escapeString($newDb) . '\', Table_name = \'' . $GLOBALS['dbi']->escapeString($newTable)
|
||||
. '\' where Db = \'' . $GLOBALS['dbi']->escapeString($oldDb) . '\' AND Table_name = \'' . $GLOBALS['dbi']->escapeString($oldTable)
|
||||
. '\';';
|
||||
$GLOBALS['dbi']->query($query_col_specific);
|
||||
|
||||
|
||||
@ -949,7 +949,7 @@ class ExportSql extends ExportPlugin
|
||||
|
||||
$event_names = $GLOBALS['dbi']->fetchResult(
|
||||
"SELECT EVENT_NAME FROM information_schema.EVENTS WHERE"
|
||||
. " EVENT_SCHEMA= '" . Util::sqlAddSlashes($db, true)
|
||||
. " EVENT_SCHEMA= '" . $GLOBALS['dbi']->escapeString($db)
|
||||
. "';"
|
||||
);
|
||||
|
||||
@ -1102,7 +1102,7 @@ class ExportSql extends ExportPlugin
|
||||
. Util::backquote($cfgRelation['db'])
|
||||
. "." . Util::backquote($cfgRelation[$type])
|
||||
. " WHERE " . Util::backquote($dbNameColumn)
|
||||
. " = '" . Util::sqlAddSlashes($db) . "'";
|
||||
. " = '" . $GLOBALS['dbi']->escapeString($db) . "'";
|
||||
|
||||
$result = $GLOBALS['dbi']->fetchResult(
|
||||
$sql_query,
|
||||
@ -1120,7 +1120,7 @@ class ExportSql extends ExportPlugin
|
||||
. " WHERE " . Util::backquote(
|
||||
$dbNameColumn
|
||||
)
|
||||
. " = '" . Util::sqlAddSlashes($db) . "'"
|
||||
. " = '" . $GLOBALS['dbi']->escapeString($db) . "'"
|
||||
. " AND `page_nr` = '" . intval($page) . "'";
|
||||
|
||||
if (!$this->exportData(
|
||||
@ -1186,10 +1186,10 @@ class ExportSql extends ExportPlugin
|
||||
$sql_query .= Util::backquote($cfgRelation['db'])
|
||||
. '.' . Util::backquote($cfgRelation[$type])
|
||||
. " WHERE " . Util::backquote($dbNameColumn)
|
||||
. " = '" . Util::sqlAddSlashes($db) . "'";
|
||||
. " = '" . $GLOBALS['dbi']->escapeString($db) . "'";
|
||||
if (isset($table)) {
|
||||
$sql_query .= " AND `table_name` = '"
|
||||
. Util::sqlAddSlashes($table) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($table) . "'";
|
||||
}
|
||||
|
||||
if (!$this->exportData(
|
||||
@ -1309,7 +1309,7 @@ class ExportSql extends ExportPlugin
|
||||
}
|
||||
if (isset($column['Default'])) {
|
||||
$create_query .= " DEFAULT '"
|
||||
. Util::sqlAddSlashes($column['Default']) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($column['Default']) . "'";
|
||||
} else {
|
||||
if ($column['Null'] == 'YES') {
|
||||
$create_query .= " DEFAULT NULL";
|
||||
@ -1317,7 +1317,7 @@ class ExportSql extends ExportPlugin
|
||||
}
|
||||
if (!empty($column['Comment'])) {
|
||||
$create_query .= " COMMENT '"
|
||||
. Util::sqlAddSlashes($column['Comment']) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($column['Comment']) . "'";
|
||||
}
|
||||
$firstCol = false;
|
||||
}
|
||||
@ -1389,7 +1389,7 @@ class ExportSql extends ExportPlugin
|
||||
// with $GLOBALS['dbi']->numRows() in mysqli
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
'SHOW TABLE STATUS FROM ' . Util::backquote($db)
|
||||
. ' WHERE Name = \'' . Util::sqlAddSlashes($table) . '\'',
|
||||
. ' WHERE Name = \'' . $GLOBALS['dbi']->escapeString($table) . '\'',
|
||||
null,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
@ -2397,7 +2397,7 @@ class ExportSql extends ExportPlugin
|
||||
}
|
||||
} elseif ($fields_meta[$j]->type == 'bit') {
|
||||
// detection of 'bit' works only on mysqli extension
|
||||
$values[] = "b'" . Util::sqlAddSlashes(
|
||||
$values[] = "b'" . $GLOBALS['dbi']->escapeString(
|
||||
Util::printableBitValue(
|
||||
$row[$j],
|
||||
$fields_meta[$j]->length
|
||||
@ -2411,10 +2411,12 @@ class ExportSql extends ExportPlugin
|
||||
} else {
|
||||
// something else -> treat as a string
|
||||
$values[] = '\''
|
||||
. str_replace(
|
||||
$search,
|
||||
$replace,
|
||||
Util::sqlAddSlashes($row[$j])
|
||||
. $GLOBALS['dbi']->escapeString(
|
||||
str_replace(
|
||||
$search,
|
||||
$replace,
|
||||
$row[$j]
|
||||
)
|
||||
)
|
||||
. '\'';
|
||||
} // end if
|
||||
|
||||
@ -253,7 +253,7 @@ class ExportXml extends ExportPlugin
|
||||
$result = $GLOBALS['dbi']->fetchResult(
|
||||
'SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME`'
|
||||
. ' FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME`'
|
||||
. ' = \'' . Util::sqlAddSlashes($db) . '\' LIMIT 1'
|
||||
. ' = \'' . $GLOBALS['dbi']->escapeString($db) . '\' LIMIT 1'
|
||||
);
|
||||
$db_collation = $result[0]['DEFAULT_COLLATION_NAME'];
|
||||
$db_charset = $result[0]['DEFAULT_CHARACTER_SET_NAME'];
|
||||
|
||||
@ -548,7 +548,7 @@ class ImportCsv extends AbstractImportCsv
|
||||
$sql .= 'NULL';
|
||||
} else {
|
||||
$sql .= '\''
|
||||
. PMA\libraries\Util::sqlAddSlashes($val)
|
||||
. $GLOBALS['dbi']->escapeString($val)
|
||||
. '\'';
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ class ImportLdi extends AbstractImportCsv
|
||||
if (isset($ldi_local_option)) {
|
||||
$sql .= ' LOCAL';
|
||||
}
|
||||
$sql .= ' INFILE \'' . PMA\libraries\Util::sqlAddSlashes($import_file)
|
||||
$sql .= ' INFILE \'' . $GLOBALS['dbi']->escapeString($import_file)
|
||||
. '\'';
|
||||
if (isset($ldi_replace)) {
|
||||
$sql .= ' REPLACE';
|
||||
@ -131,11 +131,11 @@ class ImportLdi extends AbstractImportCsv
|
||||
}
|
||||
if (strlen($ldi_enclosed) > 0) {
|
||||
$sql .= ' ENCLOSED BY \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($ldi_enclosed) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($ldi_enclosed) . '\'';
|
||||
}
|
||||
if (strlen($ldi_escaped) > 0) {
|
||||
$sql .= ' ESCAPED BY \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($ldi_escaped) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($ldi_escaped) . '\'';
|
||||
}
|
||||
if (strlen($ldi_new_line) > 0) {
|
||||
if ($ldi_new_line == 'auto') {
|
||||
|
||||
@ -240,7 +240,7 @@ class Pdf extends PDF_lib
|
||||
$test_query = 'SELECT * FROM '
|
||||
. Util::backquote($GLOBALS['cfgRelation']['db']) . '.'
|
||||
. Util::backquote($GLOBALS['cfgRelation']['pdf_pages'])
|
||||
. ' WHERE db_name = \'' . Util::sqlAddSlashes($this->_db)
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($this->_db)
|
||||
. '\' AND page_nr = \'' . $this->_pageNumber . '\'';
|
||||
$test_rs = PMA_queryAsControlUser($test_query);
|
||||
$pages = @$GLOBALS['dbi']->fetchAssoc($test_rs);
|
||||
|
||||
@ -352,8 +352,8 @@ function PMA_getDefaultPage($db)
|
||||
$query = "SELECT `page_nr`"
|
||||
. " FROM " . PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['pdf_pages'])
|
||||
. " WHERE `db_name` = '" . PMA\libraries\Util::sqlAddSlashes($db) . "'"
|
||||
. " AND `page_descr` = '" . PMA\libraries\Util::sqlAddSlashes($db) . "'";
|
||||
. " WHERE `db_name` = '" . $GLOBALS['dbi']->escapeString($db) . "'"
|
||||
. " AND `page_descr` = '" . $GLOBALS['dbi']->escapeString($db) . "'";
|
||||
|
||||
$default_page_no = $GLOBALS['dbi']->fetchResult(
|
||||
$query,
|
||||
@ -393,7 +393,7 @@ function PMA_getLoadingPage($db)
|
||||
$query = "SELECT MIN(`page_nr`)"
|
||||
. " FROM " . PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['pdf_pages'])
|
||||
. " WHERE `db_name` = '" . PMA\libraries\Util::sqlAddSlashes($db) . "'";
|
||||
. " WHERE `db_name` = '" . $GLOBALS['dbi']->escapeString($db) . "'";
|
||||
|
||||
$min_page_no = $GLOBALS['dbi']->fetchResult(
|
||||
$query,
|
||||
@ -450,9 +450,9 @@ function PMA_saveTablePositions($pg)
|
||||
. "." . PMA\libraries\Util::backquote(
|
||||
$GLOBALS['cfgRelation']['table_coords']
|
||||
)
|
||||
. " WHERE `db_name` = '" . PMA\libraries\Util::sqlAddSlashes($_REQUEST['db'])
|
||||
. " WHERE `db_name` = '" . $GLOBALS['dbi']->escapeString($_REQUEST['db'])
|
||||
. "'"
|
||||
. " AND `pdf_page_number` = '" . PMA\libraries\Util::sqlAddSlashes($pg)
|
||||
. " AND `pdf_page_number` = '" . $GLOBALS['dbi']->escapeString($pg)
|
||||
. "'";
|
||||
|
||||
$res = PMA_queryAsControlUser(
|
||||
@ -476,11 +476,11 @@ function PMA_saveTablePositions($pg)
|
||||
. PMA\libraries\Util::backquote($GLOBALS['cfgRelation']['table_coords'])
|
||||
. " (`db_name`, `table_name`, `pdf_page_number`, `x`, `y`)"
|
||||
. " VALUES ("
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($DB) . "', "
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($TAB) . "', "
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($pg) . "', "
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($_REQUEST['t_x'][$key]) . "', "
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($_REQUEST['t_y'][$key]) . "')";
|
||||
. "'" . $GLOBALS['dbi']->escapeString($DB) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($TAB) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($pg) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($_REQUEST['t_x'][$key]) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($_REQUEST['t_y'][$key]) . "')";
|
||||
|
||||
$res = PMA_queryAsControlUser(
|
||||
$query, true, PMA\libraries\DatabaseInterface::QUERY_STORE
|
||||
@ -623,12 +623,12 @@ function PMA_addNewRelation($db, $T1, $F1, $T2, $F2, $on_delete, $on_update)
|
||||
. "(master_db, master_table, master_field, "
|
||||
. "foreign_db, foreign_table, foreign_field)"
|
||||
. " values("
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($db) . "', "
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($T2) . "', "
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($F2) . "', "
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($db) . "', "
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($T1) . "', "
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($F1) . "')";
|
||||
. "'" . $GLOBALS['dbi']->escapeString($db) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($T2) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($F2) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($db) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($T1) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($F1) . "')";
|
||||
|
||||
if (PMA_queryAsControlUser($q, false, PMA\libraries\DatabaseInterface::QUERY_STORE)
|
||||
) {
|
||||
@ -692,12 +692,12 @@ function PMA_removeRelation($T1, $F1, $T2, $F2)
|
||||
$delete_query = "DELETE FROM "
|
||||
. PMA\libraries\Util::backquote($GLOBALS['cfgRelation']['db']) . "."
|
||||
. $GLOBALS['cfgRelation']['relation'] . " WHERE "
|
||||
. "master_db = '" . PMA\libraries\Util::sqlAddSlashes($DB2) . "'"
|
||||
. " AND master_table = '" . PMA\libraries\Util::sqlAddSlashes($T2) . "'"
|
||||
. " AND master_field = '" . PMA\libraries\Util::sqlAddSlashes($F2) . "'"
|
||||
. " AND foreign_db = '" . PMA\libraries\Util::sqlAddSlashes($DB1) . "'"
|
||||
. " AND foreign_table = '" . PMA\libraries\Util::sqlAddSlashes($T1) . "'"
|
||||
. " AND foreign_field = '" . PMA\libraries\Util::sqlAddSlashes($F1) . "'";
|
||||
. "master_db = '" . $GLOBALS['dbi']->escapeString($DB2) . "'"
|
||||
. " AND master_table = '" . $GLOBALS['dbi']->escapeString($T2) . "'"
|
||||
. " AND master_field = '" . $GLOBALS['dbi']->escapeString($F2) . "'"
|
||||
. " AND foreign_db = '" . $GLOBALS['dbi']->escapeString($DB1) . "'"
|
||||
. " AND foreign_table = '" . $GLOBALS['dbi']->escapeString($T1) . "'"
|
||||
. " AND foreign_field = '" . $GLOBALS['dbi']->escapeString($F1) . "'";
|
||||
|
||||
$result = PMA_queryAsControlUser(
|
||||
$delete_query,
|
||||
@ -740,7 +740,7 @@ function PMA_saveDesignerSetting($index, $value)
|
||||
. " FROM " . PMA\libraries\Util::backquote($cfgDesigner['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgDesigner['table'])
|
||||
. " WHERE username = '"
|
||||
. PMA\libraries\Util::sqlAddSlashes($cfgDesigner['user']) . "';";
|
||||
. $GLOBALS['dbi']->escapeString($cfgDesigner['user']) . "';";
|
||||
|
||||
$orig_data = $GLOBALS['dbi']->fetchSingleRow(
|
||||
$orig_data_query, 'ASSOC', $GLOBALS['controllink']
|
||||
@ -756,7 +756,7 @@ function PMA_saveDesignerSetting($index, $value)
|
||||
. "." . PMA\libraries\Util::backquote($cfgDesigner['table'])
|
||||
. " SET settings_data = '" . $orig_data . "'"
|
||||
. " WHERE username = '"
|
||||
. PMA\libraries\Util::sqlAddSlashes($cfgDesigner['user']) . "';";
|
||||
. $GLOBALS['dbi']->escapeString($cfgDesigner['user']) . "';";
|
||||
|
||||
$success = PMA_queryAsControlUser($save_query);
|
||||
} else {
|
||||
|
||||
@ -756,12 +756,12 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both')
|
||||
`foreign_field`
|
||||
FROM ' . PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['relation']) . '
|
||||
WHERE `master_db` = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'
|
||||
AND `master_table` = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
WHERE `master_db` = \'' . $GLOBALS['dbi']->escapeString($db) . '\'
|
||||
AND `master_table` = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\' ';
|
||||
if (mb_strlen($column)) {
|
||||
$rel_query .= ' AND `master_field` = '
|
||||
. '\'' . PMA\libraries\Util::sqlAddSlashes($column) . '\'';
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($column) . '\'';
|
||||
}
|
||||
$foreign = $GLOBALS['dbi']->fetchResult(
|
||||
$rel_query, 'master_field', null, $GLOBALS['controllink']
|
||||
@ -836,8 +836,8 @@ function PMA_getDisplayField($db, $table)
|
||||
SELECT `display_field`
|
||||
FROM ' . PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['table_info']) . '
|
||||
WHERE `db_name` = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'
|
||||
AND `table_name` = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
WHERE `db_name` = \'' . $GLOBALS['dbi']->escapeString($db) . '\'
|
||||
AND `table_name` = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'';
|
||||
|
||||
$row = $GLOBALS['dbi']->fetchSingleRow(
|
||||
@ -919,7 +919,7 @@ function PMA_getDbComment($db)
|
||||
FROM " . PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['column_info'])
|
||||
. "
|
||||
WHERE db_name = '" . PMA\libraries\Util::sqlAddSlashes($db) . "'
|
||||
WHERE db_name = '" . $GLOBALS['dbi']->escapeString($db) . "'
|
||||
AND table_name = ''
|
||||
AND column_name = '(db_comment)'";
|
||||
$com_rs = PMA_queryAsControlUser(
|
||||
@ -995,17 +995,17 @@ function PMA_setDbComment($db, $comment = '')
|
||||
. PMA\libraries\Util::backquote($cfgRelation['column_info'])
|
||||
. ' (`db_name`, `table_name`, `column_name`, `comment`)'
|
||||
. ' VALUES (\''
|
||||
. PMA\libraries\Util::sqlAddSlashes($db)
|
||||
. $GLOBALS['dbi']->escapeString($db)
|
||||
. "', '', '(db_comment)', '"
|
||||
. PMA\libraries\Util::sqlAddSlashes($comment)
|
||||
. $GLOBALS['dbi']->escapeString($comment)
|
||||
. "') "
|
||||
. ' ON DUPLICATE KEY UPDATE '
|
||||
. "`comment` = '" . PMA\libraries\Util::sqlAddSlashes($comment) . "'";
|
||||
. "`comment` = '" . $GLOBALS['dbi']->escapeString($comment) . "'";
|
||||
} else {
|
||||
$upd_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db']) . '.'
|
||||
. PMA\libraries\Util::backquote($cfgRelation['column_info'])
|
||||
. ' WHERE `db_name` = \'' . PMA\libraries\Util::sqlAddSlashes($db)
|
||||
. ' WHERE `db_name` = \'' . $GLOBALS['dbi']->escapeString($db)
|
||||
. '\'
|
||||
AND `table_name` = \'\'
|
||||
AND `column_name` = \'(db_comment)\'';
|
||||
@ -1071,11 +1071,11 @@ function PMA_setHistory($db, $table, $username, $sqlquery)
|
||||
`timevalue`,
|
||||
`sqlquery`)
|
||||
VALUES
|
||||
(\'' . PMA\libraries\Util::sqlAddSlashes($username) . '\',
|
||||
\'' . PMA\libraries\Util::sqlAddSlashes($db) . '\',
|
||||
\'' . PMA\libraries\Util::sqlAddSlashes($table) . '\',
|
||||
(\'' . $GLOBALS['dbi']->escapeString($username) . '\',
|
||||
\'' . $GLOBALS['dbi']->escapeString($db) . '\',
|
||||
\'' . $GLOBALS['dbi']->escapeString($table) . '\',
|
||||
NOW(),
|
||||
\'' . PMA\libraries\Util::sqlAddSlashes($sqlquery) . '\')'
|
||||
\'' . $GLOBALS['dbi']->escapeString($sqlquery) . '\')'
|
||||
);
|
||||
|
||||
PMA_purgeHistory($username);
|
||||
@ -1117,7 +1117,7 @@ function PMA_getHistory($username)
|
||||
`timevalue`
|
||||
FROM ' . PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['history']) . '
|
||||
WHERE `username` = \'' . PMA\libraries\Util::sqlAddSlashes($username) . '\'
|
||||
WHERE `username` = \'' . $GLOBALS['dbi']->escapeString($username) . '\'
|
||||
ORDER BY `id` DESC';
|
||||
|
||||
return $GLOBALS['dbi']->fetchResult(
|
||||
@ -1152,7 +1152,7 @@ function PMA_purgeHistory($username)
|
||||
SELECT `timevalue`
|
||||
FROM ' . PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['history']) . '
|
||||
WHERE `username` = \'' . PMA\libraries\Util::sqlAddSlashes($username) . '\'
|
||||
WHERE `username` = \'' . $GLOBALS['dbi']->escapeString($username) . '\'
|
||||
ORDER BY `timevalue` DESC
|
||||
LIMIT ' . $GLOBALS['cfg']['QueryHistoryMax'] . ', 1';
|
||||
|
||||
@ -1163,7 +1163,7 @@ function PMA_purgeHistory($username)
|
||||
'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db']) . '.'
|
||||
. PMA\libraries\Util::backquote($cfgRelation['history']) . '
|
||||
WHERE `username` = \'' . PMA\libraries\Util::sqlAddSlashes($username)
|
||||
WHERE `username` = \'' . $GLOBALS['dbi']->escapeString($username)
|
||||
. '\'
|
||||
AND `timevalue` <= \'' . $max_time . '\''
|
||||
);
|
||||
@ -1381,7 +1381,7 @@ function PMA_getForeignData(
|
||||
. '.' . PMA\libraries\Util::backquote($foreign_table);
|
||||
$f_query_filter = empty($foreign_filter) ? '' : ' WHERE '
|
||||
. PMA\libraries\Util::backquote($foreign_field)
|
||||
. ' LIKE "%' . PMA\libraries\Util::sqlAddSlashes(
|
||||
. ' LIKE "%' . $GLOBALS['dbi']->escapeString(
|
||||
$foreign_filter,
|
||||
true
|
||||
) . '%"'
|
||||
@ -1389,7 +1389,7 @@ function PMA_getForeignData(
|
||||
($foreign_display == false)
|
||||
? ''
|
||||
: ' OR ' . PMA\libraries\Util::backquote($foreign_display)
|
||||
. ' LIKE "%' . PMA\libraries\Util::sqlAddSlashes(
|
||||
. ' LIKE "%' . $GLOBALS['dbi']->escapeString(
|
||||
$foreign_filter,
|
||||
true
|
||||
)
|
||||
@ -1468,14 +1468,14 @@ function PMA_REL_renameField($db, $table, $field, $new_name)
|
||||
$table_query = 'UPDATE '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db']) . '.'
|
||||
. PMA\libraries\Util::backquote($cfgRelation['table_info'])
|
||||
. ' SET display_field = \'' . PMA\libraries\Util::sqlAddSlashes(
|
||||
. ' SET display_field = \'' . $GLOBALS['dbi']->escapeString(
|
||||
$new_name
|
||||
) . '\''
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db)
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db)
|
||||
. '\''
|
||||
. ' AND table_name = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' AND table_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\''
|
||||
. ' AND display_field = \'' . PMA\libraries\Util::sqlAddSlashes($field)
|
||||
. ' AND display_field = \'' . $GLOBALS['dbi']->escapeString($field)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($table_query);
|
||||
}
|
||||
@ -1484,28 +1484,28 @@ function PMA_REL_renameField($db, $table, $field, $new_name)
|
||||
$table_query = 'UPDATE '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db']) . '.'
|
||||
. PMA\libraries\Util::backquote($cfgRelation['relation'])
|
||||
. ' SET master_field = \'' . PMA\libraries\Util::sqlAddSlashes(
|
||||
. ' SET master_field = \'' . $GLOBALS['dbi']->escapeString(
|
||||
$new_name
|
||||
) . '\''
|
||||
. ' WHERE master_db = \'' . PMA\libraries\Util::sqlAddSlashes($db)
|
||||
. ' WHERE master_db = \'' . $GLOBALS['dbi']->escapeString($db)
|
||||
. '\''
|
||||
. ' AND master_table = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' AND master_table = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\''
|
||||
. ' AND master_field = \'' . PMA\libraries\Util::sqlAddSlashes($field)
|
||||
. ' AND master_field = \'' . $GLOBALS['dbi']->escapeString($field)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($table_query);
|
||||
|
||||
$table_query = 'UPDATE '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db']) . '.'
|
||||
. PMA\libraries\Util::backquote($cfgRelation['relation'])
|
||||
. ' SET foreign_field = \'' . PMA\libraries\Util::sqlAddSlashes(
|
||||
. ' SET foreign_field = \'' . $GLOBALS['dbi']->escapeString(
|
||||
$new_name
|
||||
) . '\''
|
||||
. ' WHERE foreign_db = \'' . PMA\libraries\Util::sqlAddSlashes($db)
|
||||
. ' WHERE foreign_db = \'' . $GLOBALS['dbi']->escapeString($db)
|
||||
. '\''
|
||||
. ' AND foreign_table = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' AND foreign_table = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\''
|
||||
. ' AND foreign_field = \'' . PMA\libraries\Util::sqlAddSlashes($field)
|
||||
. ' AND foreign_field = \'' . $GLOBALS['dbi']->escapeString($field)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($table_query);
|
||||
|
||||
@ -1535,14 +1535,14 @@ function PMA_REL_renameSingleTable($table,
|
||||
. PMA\libraries\Util::backquote($GLOBALS['cfgRelation']['db']) . '.'
|
||||
. PMA\libraries\Util::backquote($GLOBALS['cfgRelation'][$table])
|
||||
. ' SET '
|
||||
. $db_field . ' = \'' . PMA\libraries\Util::sqlAddSlashes($target_db)
|
||||
. $db_field . ' = \'' . $GLOBALS['dbi']->escapeString($target_db)
|
||||
. '\', '
|
||||
. $table_field . ' = \'' . PMA\libraries\Util::sqlAddSlashes($target_table)
|
||||
. $table_field . ' = \'' . $GLOBALS['dbi']->escapeString($target_table)
|
||||
. '\''
|
||||
. ' WHERE '
|
||||
. $db_field . ' = \'' . PMA\libraries\Util::sqlAddSlashes($source_db) . '\''
|
||||
. $db_field . ' = \'' . $GLOBALS['dbi']->escapeString($source_db) . '\''
|
||||
. ' AND '
|
||||
. $table_field . ' = \'' . PMA\libraries\Util::sqlAddSlashes($source_table)
|
||||
. $table_field . ' = \'' . $GLOBALS['dbi']->escapeString($source_table)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($query);
|
||||
}
|
||||
@ -1615,8 +1615,8 @@ function PMA_REL_renameTable($source_db, $target_db, $source_table, $target_tabl
|
||||
$remove_query = "DELETE FROM "
|
||||
. PMA\libraries\Util::backquote($GLOBALS['cfgRelation']['db']) . "."
|
||||
. PMA\libraries\Util::backquote($GLOBALS['cfgRelation']['table_coords'])
|
||||
. " WHERE db_name = '" . PMA\libraries\Util::sqlAddSlashes($source_db) . "'"
|
||||
. " AND table_name = '" . PMA\libraries\Util::sqlAddSlashes($source_table)
|
||||
. " WHERE db_name = '" . $GLOBALS['dbi']->escapeString($source_db) . "'"
|
||||
. " AND table_name = '" . $GLOBALS['dbi']->escapeString($source_table)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -1646,13 +1646,13 @@ function PMA_REL_renameTable($source_db, $target_db, $source_table, $target_tabl
|
||||
. PMA\libraries\Util::backquote(
|
||||
$GLOBALS['cfgRelation']['navigationhiding']
|
||||
)
|
||||
. " SET db_name = '" . PMA\libraries\Util::sqlAddSlashes($target_db)
|
||||
. " SET db_name = '" . $GLOBALS['dbi']->escapeString($target_db)
|
||||
. "',"
|
||||
. " item_name = '" . PMA\libraries\Util::sqlAddSlashes($target_table)
|
||||
. " item_name = '" . $GLOBALS['dbi']->escapeString($target_table)
|
||||
. "'"
|
||||
. " WHERE db_name = '" . PMA\libraries\Util::sqlAddSlashes($source_db)
|
||||
. " WHERE db_name = '" . $GLOBALS['dbi']->escapeString($source_db)
|
||||
. "'"
|
||||
. " AND item_name = '" . PMA\libraries\Util::sqlAddSlashes($source_table)
|
||||
. " AND item_name = '" . $GLOBALS['dbi']->escapeString($source_table)
|
||||
. "'"
|
||||
. " AND item_type = 'table'";
|
||||
PMA_queryAsControlUser($query);
|
||||
@ -1678,8 +1678,8 @@ function PMA_REL_createPage($newpage, $cfgRelation, $db)
|
||||
. PMA\libraries\Util::backquote($cfgRelation['pdf_pages'])
|
||||
. ' (db_name, page_descr)'
|
||||
. ' VALUES (\''
|
||||
. PMA\libraries\Util::sqlAddSlashes($db) . '\', \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($newpage) . '\')';
|
||||
. $GLOBALS['dbi']->escapeString($db) . '\', \''
|
||||
. $GLOBALS['dbi']->escapeString($newpage) . '\')';
|
||||
PMA_queryAsControlUser($ins_query, false);
|
||||
|
||||
return $GLOBALS['dbi']->insertId(
|
||||
@ -1705,12 +1705,12 @@ function PMA_getChildReferences($db, $table, $column = '')
|
||||
. " `table_schema`, `referenced_column_name`"
|
||||
. " FROM `information_schema`.`key_column_usage`"
|
||||
. " WHERE `referenced_table_name` = '"
|
||||
. PMA\libraries\Util::sqlAddSlashes($table) . "'"
|
||||
. $GLOBALS['dbi']->escapeString($table) . "'"
|
||||
. " AND `referenced_table_schema` = '"
|
||||
. PMA\libraries\Util::sqlAddSlashes($db) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($db) . "'";
|
||||
if ($column) {
|
||||
$rel_query .= " AND `referenced_column_name` = '"
|
||||
. PMA\libraries\Util::sqlAddSlashes($column) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($column) . "'";
|
||||
}
|
||||
|
||||
$child_references = $GLOBALS['dbi']->fetchResult(
|
||||
|
||||
@ -23,10 +23,10 @@ function PMA_relationsCleanupColumn($db, $table, $column)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\''
|
||||
. ' AND table_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\''
|
||||
. ' AND column_name = \'' . PMA\libraries\Util::sqlAddSlashes($column)
|
||||
. ' AND column_name = \'' . $GLOBALS['dbi']->escapeString($column)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -35,10 +35,10 @@ function PMA_relationsCleanupColumn($db, $table, $column)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['table_info'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\''
|
||||
. ' AND table_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\''
|
||||
. ' AND display_field = \'' . PMA\libraries\Util::sqlAddSlashes($column)
|
||||
. ' AND display_field = \'' . $GLOBALS['dbi']->escapeString($column)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -47,22 +47,22 @@ function PMA_relationsCleanupColumn($db, $table, $column)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['relation'])
|
||||
. ' WHERE master_db = \'' . PMA\libraries\Util::sqlAddSlashes($db)
|
||||
. ' WHERE master_db = \'' . $GLOBALS['dbi']->escapeString($db)
|
||||
. '\''
|
||||
. ' AND master_table = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' AND master_table = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\''
|
||||
. ' AND master_field = \'' . PMA\libraries\Util::sqlAddSlashes($column)
|
||||
. ' AND master_field = \'' . $GLOBALS['dbi']->escapeString($column)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['relation'])
|
||||
. ' WHERE foreign_db = \'' . PMA\libraries\Util::sqlAddSlashes($db)
|
||||
. ' WHERE foreign_db = \'' . $GLOBALS['dbi']->escapeString($db)
|
||||
. '\''
|
||||
. ' AND foreign_table = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' AND foreign_table = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\''
|
||||
. ' AND foreign_field = \'' . PMA\libraries\Util::sqlAddSlashes($column)
|
||||
. ' AND foreign_field = \'' . $GLOBALS['dbi']->escapeString($column)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -84,8 +84,8 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\''
|
||||
. ' AND table_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -94,8 +94,8 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['table_info'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\''
|
||||
. ' AND table_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -104,8 +104,8 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['table_coords'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\''
|
||||
. ' AND table_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -114,18 +114,18 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['relation'])
|
||||
. ' WHERE master_db = \'' . PMA\libraries\Util::sqlAddSlashes($db)
|
||||
. ' WHERE master_db = \'' . $GLOBALS['dbi']->escapeString($db)
|
||||
. '\''
|
||||
. ' AND master_table = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' AND master_table = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['relation'])
|
||||
. ' WHERE foreign_db = \'' . PMA\libraries\Util::sqlAddSlashes($db)
|
||||
. ' WHERE foreign_db = \'' . $GLOBALS['dbi']->escapeString($db)
|
||||
. '\''
|
||||
. ' AND foreign_table = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' AND foreign_table = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -134,8 +134,8 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['table_uiprefs'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\''
|
||||
. ' AND table_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -144,10 +144,10 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['navigationhiding'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\''
|
||||
. ' AND (table_name = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\''
|
||||
. ' AND (table_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\''
|
||||
. ' OR (item_name = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
. ' OR (item_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\''
|
||||
. ' AND item_type = \'table\'))';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
@ -169,7 +169,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'';
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['bookmark'])
|
||||
. ' WHERE dbase = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'';
|
||||
. ' WHERE dbase = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['table_info'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'';
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
@ -193,13 +193,13 @@ function PMA_relationsCleanupDatabase($db)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['pdf_pages'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'';
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['table_coords'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'';
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
@ -208,13 +208,13 @@ function PMA_relationsCleanupDatabase($db)
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['relation'])
|
||||
. ' WHERE master_db = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($db) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['relation'])
|
||||
. ' WHERE foreign_db = \'' . PMA\libraries\Util::sqlAddSlashes($db)
|
||||
. ' WHERE foreign_db = \'' . $GLOBALS['dbi']->escapeString($db)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -223,7 +223,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['table_uiprefs'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'';
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['navigationhiding'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'';
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
@ -239,7 +239,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['savedsearches'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'';
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['central_columns'])
|
||||
. ' WHERE db_name = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'';
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
}
|
||||
@ -267,7 +267,7 @@ function PMA_relationsCleanupUser($username)
|
||||
$remove_query = "DELETE FROM "
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['bookmark'])
|
||||
. " WHERE `user` = '" . PMA\libraries\Util::sqlAddSlashes($username)
|
||||
. " WHERE `user` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -276,7 +276,7 @@ function PMA_relationsCleanupUser($username)
|
||||
$remove_query = "DELETE FROM "
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['history'])
|
||||
. " WHERE `username` = '" . PMA\libraries\Util::sqlAddSlashes($username)
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -285,7 +285,7 @@ function PMA_relationsCleanupUser($username)
|
||||
$remove_query = "DELETE FROM "
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['recent'])
|
||||
. " WHERE `username` = '" . PMA\libraries\Util::sqlAddSlashes($username)
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -294,7 +294,7 @@ function PMA_relationsCleanupUser($username)
|
||||
$remove_query = "DELETE FROM "
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['favorite'])
|
||||
. " WHERE `username` = '" . PMA\libraries\Util::sqlAddSlashes($username)
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -303,7 +303,7 @@ function PMA_relationsCleanupUser($username)
|
||||
$remove_query = "DELETE FROM "
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['table_uiprefs'])
|
||||
. " WHERE `username` = '" . PMA\libraries\Util::sqlAddSlashes($username)
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -312,7 +312,7 @@ function PMA_relationsCleanupUser($username)
|
||||
$remove_query = "DELETE FROM "
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['userconfig'])
|
||||
. " WHERE `username` = '" . PMA\libraries\Util::sqlAddSlashes($username)
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -321,7 +321,7 @@ function PMA_relationsCleanupUser($username)
|
||||
$remove_query = "DELETE FROM "
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['users'])
|
||||
. " WHERE `username` = '" . PMA\libraries\Util::sqlAddSlashes($username)
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -330,7 +330,7 @@ function PMA_relationsCleanupUser($username)
|
||||
$remove_query = "DELETE FROM "
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['navigationhiding'])
|
||||
. " WHERE `username` = '" . PMA\libraries\Util::sqlAddSlashes($username)
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -339,7 +339,7 @@ function PMA_relationsCleanupUser($username)
|
||||
$remove_query = "DELETE FROM "
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['savedsearches'])
|
||||
. " WHERE `username` = '" . PMA\libraries\Util::sqlAddSlashes($username)
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
@ -348,7 +348,7 @@ function PMA_relationsCleanupUser($username)
|
||||
$remove_query = "DELETE FROM "
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['designer_settings'])
|
||||
. " WHERE `username` = '" . PMA\libraries\Util::sqlAddSlashes($username)
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ if (! empty($_REQUEST['master_connection'])) {
|
||||
if ($server_slave_multi_replication) {
|
||||
$GLOBALS['dbi']->query(
|
||||
"SET @@default_master_connection = '"
|
||||
. PMA\libraries\Util::sqlAddSlashes(
|
||||
. $GLOBALS['dbi']->escapeString(
|
||||
$_REQUEST['master_connection']
|
||||
) . "'"
|
||||
);
|
||||
|
||||
@ -963,13 +963,13 @@ function PMA_handleRequestForSlaveChangeMaster()
|
||||
{
|
||||
$sr = array();
|
||||
$_SESSION['replication']['m_username'] = $sr['username']
|
||||
= PMA\libraries\Util::sqlAddSlashes($_REQUEST['username']);
|
||||
= $GLOBALS['dbi']->escapeString($_REQUEST['username']);
|
||||
$_SESSION['replication']['m_password'] = $sr['pma_pw']
|
||||
= PMA\libraries\Util::sqlAddSlashes($_REQUEST['pma_pw']);
|
||||
= $GLOBALS['dbi']->escapeString($_REQUEST['pma_pw']);
|
||||
$_SESSION['replication']['m_hostname'] = $sr['hostname']
|
||||
= PMA\libraries\Util::sqlAddSlashes($_REQUEST['hostname']);
|
||||
= $GLOBALS['dbi']->escapeString($_REQUEST['hostname']);
|
||||
$_SESSION['replication']['m_port'] = $sr['port']
|
||||
= PMA\libraries\Util::sqlAddSlashes($_REQUEST['text_port']);
|
||||
= $GLOBALS['dbi']->escapeString($_REQUEST['text_port']);
|
||||
$_SESSION['replication']['m_correct'] = '';
|
||||
$_SESSION['replication']['sr_action_status'] = 'error';
|
||||
$_SESSION['replication']['sr_action_info'] = __('Unknown error');
|
||||
|
||||
@ -287,8 +287,8 @@ function PMA_EVN_getDataFromName($name)
|
||||
. "`INTERVAL_VALUE`, `INTERVAL_FIELD`, `STARTS`, `ENDS`, "
|
||||
. "`EVENT_DEFINITION`, `ON_COMPLETION`, `DEFINER`, `EVENT_COMMENT`";
|
||||
$where = "EVENT_SCHEMA " . PMA\libraries\Util::getCollateForIS() . "="
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($db) . "' "
|
||||
. "AND EVENT_NAME='" . PMA\libraries\Util::sqlAddSlashes($name) . "'";
|
||||
. "'" . $GLOBALS['dbi']->escapeString($db) . "' "
|
||||
. "AND EVENT_NAME='" . $GLOBALS['dbi']->escapeString($name) . "'";
|
||||
$query = "SELECT $columns FROM `INFORMATION_SCHEMA`.`EVENTS` WHERE $where;";
|
||||
$item = $GLOBALS['dbi']->fetchSingleRow($query);
|
||||
if (! $item) {
|
||||
@ -561,18 +561,18 @@ function PMA_EVN_getQueryFromRequest()
|
||||
}
|
||||
if (! empty($_REQUEST['item_starts'])) {
|
||||
$query .= "STARTS '"
|
||||
. PMA\libraries\Util::sqlAddSlashes($_REQUEST['item_starts'])
|
||||
. $GLOBALS['dbi']->escapeString($_REQUEST['item_starts'])
|
||||
. "' ";
|
||||
}
|
||||
if (! empty($_REQUEST['item_ends'])) {
|
||||
$query .= "ENDS '"
|
||||
. PMA\libraries\Util::sqlAddSlashes($_REQUEST['item_ends'])
|
||||
. $GLOBALS['dbi']->escapeString($_REQUEST['item_ends'])
|
||||
. "' ";
|
||||
}
|
||||
} else {
|
||||
if (! empty($_REQUEST['item_execute_at'])) {
|
||||
$query .= "AT '"
|
||||
. PMA\libraries\Util::sqlAddSlashes($_REQUEST['item_execute_at'])
|
||||
. $GLOBALS['dbi']->escapeString($_REQUEST['item_execute_at'])
|
||||
. "' ";
|
||||
} else {
|
||||
$errors[]
|
||||
|
||||
@ -588,9 +588,9 @@ function PMA_RTN_getDataFromName($name, $type, $all = true, $control = false)
|
||||
. "ROUTINE_DEFINITION, IS_DETERMINISTIC, SQL_DATA_ACCESS, "
|
||||
. "ROUTINE_COMMENT, SECURITY_TYPE";
|
||||
$where = "ROUTINE_SCHEMA " . PMA\libraries\Util::getCollateForIS() . "="
|
||||
. "'" . PMA\libraries\Util::sqlAddSlashes($db) . "' "
|
||||
. "AND SPECIFIC_NAME='" . PMA\libraries\Util::sqlAddSlashes($name) . "'"
|
||||
. "AND ROUTINE_TYPE='" . PMA\libraries\Util::sqlAddSlashes($type) . "'";
|
||||
. "'" . $GLOBALS['dbi']->escapeString($db) . "' "
|
||||
. "AND SPECIFIC_NAME='" . $GLOBALS['dbi']->escapeString($name) . "'"
|
||||
. "AND ROUTINE_TYPE='" . $GLOBALS['dbi']->escapeString($type) . "'";
|
||||
$query = "SELECT $fields FROM INFORMATION_SCHEMA.ROUTINES WHERE $where;";
|
||||
|
||||
$routine = $GLOBALS['dbi']->fetchSingleRow($query, 'ASSOC', $link);
|
||||
@ -1342,7 +1342,7 @@ function PMA_RTN_handleExecute()
|
||||
if (is_array($value)) { // is SET type
|
||||
$value = implode(',', $value);
|
||||
}
|
||||
$value = PMA\libraries\Util::sqlAddSlashes($value);
|
||||
$value = $GLOBALS['dbi']->escapeString($value);
|
||||
if (! empty($_REQUEST['funcs'][$routine['item_param_name'][$i]])
|
||||
&& in_array(
|
||||
$_REQUEST['funcs'][$routine['item_param_name'][$i]],
|
||||
|
||||
@ -310,7 +310,7 @@ function PMA_TRI_getEditorForm($mode, $item)
|
||||
. "type='hidden' value='{$item['item_original_name']}'/>\n";
|
||||
}
|
||||
$query = "SELECT `TABLE_NAME` FROM `INFORMATION_SCHEMA`.`TABLES` ";
|
||||
$query .= "WHERE `TABLE_SCHEMA`='" . PMA\libraries\Util::sqlAddSlashes($db) . "' ";
|
||||
$query .= "WHERE `TABLE_SCHEMA`='" . $GLOBALS['dbi']->escapeString($db) . "' ";
|
||||
$query .= "AND `TABLE_TYPE`='BASE TABLE'";
|
||||
$tables = $GLOBALS['dbi']->fetchResult($query);
|
||||
|
||||
|
||||
@ -83,9 +83,9 @@ function PMA_rangeOfUsers($initial = '')
|
||||
}
|
||||
|
||||
$ret = " WHERE `User` LIKE '"
|
||||
. Util::sqlAddSlashes($initial, true) . "%'"
|
||||
. $GLOBALS['dbi']->escapeString($initial) . "%'"
|
||||
. " OR `User` LIKE '"
|
||||
. Util::sqlAddSlashes(mb_strtolower($initial), true)
|
||||
. $GLOBALS['dbi']->escapeString(mb_strtolower($initial))
|
||||
. "%'";
|
||||
return $ret;
|
||||
} // end function
|
||||
@ -492,21 +492,21 @@ function PMA_getSqlQueryForDisplayPrivTable($db, $table, $username, $hostname)
|
||||
{
|
||||
if ($db == '*') {
|
||||
return "SELECT * FROM `mysql`.`user`"
|
||||
. " WHERE `User` = '" . Util::sqlAddSlashes($username) . "'"
|
||||
. " AND `Host` = '" . Util::sqlAddSlashes($hostname) . "';";
|
||||
. " WHERE `User` = '" . $GLOBALS['dbi']->escapeString($username) . "'"
|
||||
. " AND `Host` = '" . $GLOBALS['dbi']->escapeString($hostname) . "';";
|
||||
} elseif ($table == '*') {
|
||||
return "SELECT * FROM `mysql`.`db`"
|
||||
. " WHERE `User` = '" . Util::sqlAddSlashes($username) . "'"
|
||||
. " AND `Host` = '" . Util::sqlAddSlashes($hostname) . "'"
|
||||
. " AND '" . Util::sqlAddSlashes(Util::unescapeMysqlWildcards($db)) . "'"
|
||||
. " WHERE `User` = '" . $GLOBALS['dbi']->escapeString($username) . "'"
|
||||
. " AND `Host` = '" . $GLOBALS['dbi']->escapeString($hostname) . "'"
|
||||
. " AND '" . $GLOBALS['dbi']->escapeString(Util::unescapeMysqlWildcards($db)) . "'"
|
||||
. " LIKE `Db`;";
|
||||
}
|
||||
return "SELECT `Table_priv`"
|
||||
. " FROM `mysql`.`tables_priv`"
|
||||
. " WHERE `User` = '" . Util::sqlAddSlashes($username) . "'"
|
||||
. " AND `Host` = '" . Util::sqlAddSlashes($hostname) . "'"
|
||||
. " AND `Db` = '" . Util::sqlAddSlashes(Util::unescapeMysqlWildcards($db)) . "'"
|
||||
. " AND `Table_name` = '" . Util::sqlAddSlashes($table) . "';";
|
||||
. " WHERE `User` = '" . $GLOBALS['dbi']->escapeString($username) . "'"
|
||||
. " AND `Host` = '" . $GLOBALS['dbi']->escapeString($hostname) . "'"
|
||||
. " AND `Db` = '" . $GLOBALS['dbi']->escapeString(Util::unescapeMysqlWildcards($db)) . "'"
|
||||
. " AND `Table_name` = '" . $GLOBALS['dbi']->escapeString($table) . "';";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -545,7 +545,7 @@ function PMA_getHtmlToChooseUserGroup($username)
|
||||
$userGroup = '';
|
||||
if (isset($GLOBALS['username'])) {
|
||||
$sql_query = "SELECT `usergroup` FROM " . $userTable
|
||||
. " WHERE `username` = '" . Util::sqlAddSlashes($username) . "'";
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username) . "'";
|
||||
$userGroup = $GLOBALS['dbi']->fetchValue(
|
||||
$sql_query, 0, 0, $GLOBALS['controllink']
|
||||
);
|
||||
@ -583,23 +583,23 @@ function PMA_setUserGroup($username, $userGroup)
|
||||
. "." . Util::backquote($cfgRelation['users']);
|
||||
|
||||
$sql_query = "SELECT `usergroup` FROM " . $userTable
|
||||
. " WHERE `username` = '" . Util::sqlAddSlashes($username) . "'";
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username) . "'";
|
||||
$oldUserGroup = $GLOBALS['dbi']->fetchValue(
|
||||
$sql_query, 0, 0, $GLOBALS['controllink']
|
||||
);
|
||||
|
||||
if ($oldUserGroup === false) {
|
||||
$upd_query = "INSERT INTO " . $userTable . "(`username`, `usergroup`)"
|
||||
. " VALUES ('" . Util::sqlAddSlashes($username) . "', "
|
||||
. "'" . Util::sqlAddSlashes($userGroup) . "')";
|
||||
. " VALUES ('" . $GLOBALS['dbi']->escapeString($username) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($userGroup) . "')";
|
||||
} else {
|
||||
if (empty($userGroup)) {
|
||||
$upd_query = "DELETE FROM " . $userTable
|
||||
. " WHERE `username`='" . Util::sqlAddSlashes($username) . "'";
|
||||
. " WHERE `username`='" . $GLOBALS['dbi']->escapeString($username) . "'";
|
||||
} elseif ($oldUserGroup != $userGroup) {
|
||||
$upd_query = "UPDATE " . $userTable
|
||||
. " SET `usergroup`='" . Util::sqlAddSlashes($userGroup) . "'"
|
||||
. " WHERE `username`='" . Util::sqlAddSlashes($username) . "'";
|
||||
. " SET `usergroup`='" . $GLOBALS['dbi']->escapeString($userGroup) . "'"
|
||||
. " WHERE `username`='" . $GLOBALS['dbi']->escapeString($username) . "'";
|
||||
}
|
||||
}
|
||||
if (isset($upd_query)) {
|
||||
@ -979,11 +979,11 @@ function PMA_getHtmlForRoutineSpecificPrivilges(
|
||||
|
||||
$sql = "SELECT `Proc_priv`"
|
||||
. " FROM `mysql`.`procs_priv`"
|
||||
. " WHERE `User` = '" . Util::sqlAddSlashes($username) . "'"
|
||||
. " AND `Host` = '" . Util::sqlAddSlashes($hostname) . "'"
|
||||
. " WHERE `User` = '" . $GLOBALS['dbi']->escapeString($username) . "'"
|
||||
. " AND `Host` = '" . $GLOBALS['dbi']->escapeString($hostname) . "'"
|
||||
. " AND `Db` = '"
|
||||
. Util::sqlAddSlashes(Util::unescapeMysqlWildcards($db)) . "'"
|
||||
. " AND `Routine_name` LIKE '" . Util::sqlAddSlashes($routine) . "';";
|
||||
. $GLOBALS['dbi']->escapeString(Util::unescapeMysqlWildcards($db)) . "'"
|
||||
. " AND `Routine_name` LIKE '" . $GLOBALS['dbi']->escapeString($routine) . "';";
|
||||
$res = $GLOBALS['dbi']->fetchValue($sql);
|
||||
|
||||
$privs = array(
|
||||
@ -1069,15 +1069,15 @@ function PMA_getHtmlForTableSpecificPrivileges(
|
||||
'SELECT `Column_name`, `Column_priv`'
|
||||
. ' FROM `mysql`.`columns_priv`'
|
||||
. ' WHERE `User`'
|
||||
. ' = \'' . Util::sqlAddSlashes($username) . "'"
|
||||
. ' = \'' . $GLOBALS['dbi']->escapeString($username) . "'"
|
||||
. ' AND `Host`'
|
||||
. ' = \'' . Util::sqlAddSlashes($hostname) . "'"
|
||||
. ' = \'' . $GLOBALS['dbi']->escapeString($hostname) . "'"
|
||||
. ' AND `Db`'
|
||||
. ' = \'' . Util::sqlAddSlashes(
|
||||
. ' = \'' . $GLOBALS['dbi']->escapeString(
|
||||
Util::unescapeMysqlWildcards($db)
|
||||
) . "'"
|
||||
. ' AND `Table_name`'
|
||||
. ' = \'' . Util::sqlAddSlashes($table) . '\';'
|
||||
. ' = \'' . $GLOBALS['dbi']->escapeString($table) . '\';'
|
||||
);
|
||||
|
||||
while ($row1 = $GLOBALS['dbi']->fetchRow($res)) {
|
||||
@ -1968,8 +1968,8 @@ function PMA_getGrants($user, $host)
|
||||
{
|
||||
$grants = $GLOBALS['dbi']->fetchResult(
|
||||
"SHOW GRANTS FOR '"
|
||||
. Util::sqlAddSlashes($user) . "'@'"
|
||||
. Util::sqlAddSlashes($host) . "'"
|
||||
. $GLOBALS['dbi']->escapeString($user) . "'@'"
|
||||
. $GLOBALS['dbi']->escapeString($host) . "'"
|
||||
);
|
||||
$response = '';
|
||||
foreach ($grants as $one_grant) {
|
||||
@ -2023,15 +2023,15 @@ function PMA_updatePassword($err_url, $username, $hostname)
|
||||
) {
|
||||
if ($authentication_plugin != 'mysql_old_password') {
|
||||
$query_prefix = "ALTER USER '"
|
||||
. Util::sqlAddSlashes($username)
|
||||
. "'@'" . Util::sqlAddSlashes($hostname) . "'"
|
||||
. $GLOBALS['dbi']->escapeString($username)
|
||||
. "'@'" . $GLOBALS['dbi']->escapeString($hostname) . "'"
|
||||
. " IDENTIFIED WITH "
|
||||
. $authentication_plugin
|
||||
. " BY '";
|
||||
} else {
|
||||
$query_prefix = "ALTER USER '"
|
||||
. Util::sqlAddSlashes($username)
|
||||
. "'@'" . Util::sqlAddSlashes($hostname) . "'"
|
||||
. $GLOBALS['dbi']->escapeString($username)
|
||||
. "'@'" . $GLOBALS['dbi']->escapeString($hostname) . "'"
|
||||
. " IDENTIFIED BY '";
|
||||
}
|
||||
|
||||
@ -2039,7 +2039,7 @@ function PMA_updatePassword($err_url, $username, $hostname)
|
||||
$sql_query = $query_prefix . "*'";
|
||||
|
||||
$local_query = $query_prefix
|
||||
. Util::sqlAddSlashes($_POST['pma_pw']) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($_POST['pma_pw']) . "'";
|
||||
} else if ($serverType == 'MariaDB'
|
||||
&& PMA_MYSQL_INT_VERSION >= 50200
|
||||
&& $is_superuser
|
||||
@ -2059,8 +2059,8 @@ function PMA_updatePassword($err_url, $username, $hostname)
|
||||
$hashedPassword = PMA_getHashedPassword($_POST['pma_pw']);
|
||||
|
||||
$sql_query = 'SET PASSWORD FOR \''
|
||||
. Util::sqlAddSlashes($username)
|
||||
. '\'@\'' . Util::sqlAddSlashes($hostname) . '\' = '
|
||||
. $GLOBALS['dbi']->escapeString($username)
|
||||
. '\'@\'' . $GLOBALS['dbi']->escapeString($hostname) . '\' = '
|
||||
. (($_POST['pma_pw'] == '')
|
||||
? '\'\''
|
||||
: $hashing_function . '(\''
|
||||
@ -2104,18 +2104,18 @@ function PMA_updatePassword($err_url, $username, $hostname)
|
||||
$GLOBALS['dbi']->tryQuery('SET `old_passwords` = 2;');
|
||||
}
|
||||
$sql_query = 'SET PASSWORD FOR \''
|
||||
. Util::sqlAddSlashes($username)
|
||||
. '\'@\'' . Util::sqlAddSlashes($hostname) . '\' = '
|
||||
. $GLOBALS['dbi']->escapeString($username)
|
||||
. '\'@\'' . $GLOBALS['dbi']->escapeString($hostname) . '\' = '
|
||||
. (($_POST['pma_pw'] == '')
|
||||
? '\'\''
|
||||
: $hashing_function . '(\''
|
||||
. preg_replace('@.@s', '*', $_POST['pma_pw']) . '\')');
|
||||
|
||||
$local_query = 'SET PASSWORD FOR \''
|
||||
. Util::sqlAddSlashes($username)
|
||||
. '\'@\'' . Util::sqlAddSlashes($hostname) . '\' = '
|
||||
. $GLOBALS['dbi']->escapeString($username)
|
||||
. '\'@\'' . $GLOBALS['dbi']->escapeString($hostname) . '\' = '
|
||||
. (($_POST['pma_pw'] == '') ? '\'\'' : $hashing_function
|
||||
. '(\'' . Util::sqlAddSlashes($_POST['pma_pw']) . '\')');
|
||||
. '(\'' . $GLOBALS['dbi']->escapeString($_POST['pma_pw']) . '\')');
|
||||
}
|
||||
|
||||
if (!($GLOBALS['dbi']->tryQuery($local_query))) {
|
||||
@ -2160,12 +2160,12 @@ function PMA_getMessageAndSqlQueryForPrivilegesRevoke($dbname,
|
||||
|
||||
$sql_query0 = 'REVOKE ALL PRIVILEGES ON ' . $itemType . ' ' . $db_and_table
|
||||
. ' FROM \''
|
||||
. Util::sqlAddSlashes($username) . '\'@\''
|
||||
. Util::sqlAddSlashes($hostname) . '\';';
|
||||
. $GLOBALS['dbi']->escapeString($username) . '\'@\''
|
||||
. $GLOBALS['dbi']->escapeString($hostname) . '\';';
|
||||
|
||||
$sql_query1 = 'REVOKE GRANT OPTION ON ' . $itemType . ' ' . $db_and_table
|
||||
. ' FROM \'' . Util::sqlAddSlashes($username) . '\'@\''
|
||||
. Util::sqlAddSlashes($hostname) . '\';';
|
||||
. ' FROM \'' . $GLOBALS['dbi']->escapeString($username) . '\'@\''
|
||||
. $GLOBALS['dbi']->escapeString($hostname) . '\';';
|
||||
|
||||
$GLOBALS['dbi']->query($sql_query0);
|
||||
if (! $GLOBALS['dbi']->tryQuery($sql_query1)) {
|
||||
@ -2196,15 +2196,15 @@ function PMA_getRequireClause()
|
||||
$require = array();
|
||||
if (! empty($arr['ssl_cipher'])) {
|
||||
$require[] = "CIPHER '"
|
||||
. Util::sqlAddSlashes($arr['ssl_cipher']) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($arr['ssl_cipher']) . "'";
|
||||
}
|
||||
if (! empty($arr['x509_issuer'])) {
|
||||
$require[] = "ISSUER '"
|
||||
. Util::sqlAddSlashes($arr['x509_issuer']) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($arr['x509_issuer']) . "'";
|
||||
}
|
||||
if (! empty($arr['x509_subject'])) {
|
||||
$require[] = "SUBJECT '"
|
||||
. Util::sqlAddSlashes($arr['x509_subject']) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($arr['x509_subject']) . "'";
|
||||
}
|
||||
if (count($require)) {
|
||||
$require_clause = " REQUIRE " . implode(" AND ", $require);
|
||||
@ -2396,7 +2396,7 @@ function PMA_getListOfPrivilegesAndComparedPrivileges()
|
||||
*/
|
||||
function PMA_getHtmlTableBodyForSpecificDbRoutinePrivs($db, $odd_row, $index_checkbox)
|
||||
{
|
||||
$sql_query = 'SELECT * FROM `mysql`.`procs_priv` WHERE Db = \'' . Util::sqlAddSlashes($db) . '\';';
|
||||
$sql_query = 'SELECT * FROM `mysql`.`procs_priv` WHERE Db = \'' . $GLOBALS['dbi']->escapeString($db) . '\';';
|
||||
$res = $GLOBALS['dbi']->query($sql_query);
|
||||
$html_output = '';
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
|
||||
@ -2555,8 +2555,8 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table)
|
||||
$sql_query = "SELECT `User`, `Host`, `Db`,"
|
||||
. " 't' AS `Type`, `Table_name`, `Table_priv`"
|
||||
. " FROM `mysql`.`tables_priv`"
|
||||
. " WHERE '" . Util::sqlAddSlashes($db) . "' LIKE `Db`"
|
||||
. " AND '" . Util::sqlAddSlashes($table) . "' LIKE `Table_name`"
|
||||
. " WHERE '" . $GLOBALS['dbi']->escapeString($db) . "' LIKE `Db`"
|
||||
. " AND '" . $GLOBALS['dbi']->escapeString($table) . "' LIKE `Table_name`"
|
||||
. " AND NOT (`Table_priv` = '' AND Column_priv = '')"
|
||||
. " ORDER BY `User` ASC, `Host` ASC, `Db` ASC, `Table_priv` ASC;";
|
||||
$res = $GLOBALS['dbi']->query($sql_query);
|
||||
@ -2604,7 +2604,7 @@ function PMA_getPrivMap($db)
|
||||
. "("
|
||||
. " SELECT " . $listOfPrivs . ", `Db`, 'd' AS `Type`"
|
||||
. " FROM `mysql`.`db`"
|
||||
. " WHERE '" . Util::sqlAddSlashes($db) . "' LIKE `Db`"
|
||||
. " WHERE '" . $GLOBALS['dbi']->escapeString($db) . "' LIKE `Db`"
|
||||
. " AND NOT (" . $listOfComparedPrivs . ")"
|
||||
. ")"
|
||||
. " ORDER BY `User` ASC, `Host` ASC, `Db` ASC;";
|
||||
@ -3272,9 +3272,9 @@ function PMA_getLinkToDbAndTable($url_dbname, $dbname, $tablename)
|
||||
function PMA_getUserSpecificRights($username, $hostname, $type, $dbname = '')
|
||||
{
|
||||
$user_host_condition = " WHERE `User`"
|
||||
. " = '" . Util::sqlAddSlashes($username) . "'"
|
||||
. " = '" . $GLOBALS['dbi']->escapeString($username) . "'"
|
||||
. " AND `Host`"
|
||||
. " = '" . Util::sqlAddSlashes($hostname) . "'";
|
||||
. " = '" . $GLOBALS['dbi']->escapeString($hostname) . "'";
|
||||
|
||||
if ($type == 'database') {
|
||||
$tables_to_search_for_users = array(
|
||||
@ -3283,12 +3283,12 @@ function PMA_getUserSpecificRights($username, $hostname, $type, $dbname = '')
|
||||
$dbOrTableName = 'Db';
|
||||
} elseif ($type == 'table') {
|
||||
$user_host_condition .= " AND `Db` LIKE '"
|
||||
. Util::sqlAddSlashes($dbname, true) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($dbname, true) . "'";
|
||||
$tables_to_search_for_users = array('columns_priv',);
|
||||
$dbOrTableName = 'Table_name';
|
||||
} else { // routine
|
||||
$user_host_condition .= " AND `Db` LIKE '"
|
||||
. Util::sqlAddSlashes($dbname, true) . "'";
|
||||
. $GLOBALS['dbi']->escapeString($dbname, true) . "'";
|
||||
$tables_to_search_for_users = array('procs_priv',);
|
||||
$dbOrTableName = 'Routine_name';
|
||||
}
|
||||
@ -4000,13 +4000,13 @@ function PMA_updatePrivileges($username, $hostname, $tablename, $dbname, $itemTy
|
||||
$db_and_table = PMA_wildcardEscapeForGrant($dbname, $tablename);
|
||||
|
||||
$sql_query0 = 'REVOKE ALL PRIVILEGES ON ' . $itemType . ' ' . $db_and_table
|
||||
. ' FROM \'' . Util::sqlAddSlashes($username)
|
||||
. '\'@\'' . Util::sqlAddSlashes($hostname) . '\';';
|
||||
. ' FROM \'' . $GLOBALS['dbi']->escapeString($username)
|
||||
. '\'@\'' . $GLOBALS['dbi']->escapeString($hostname) . '\';';
|
||||
|
||||
if (! isset($_POST['Grant_priv']) || $_POST['Grant_priv'] != 'Y') {
|
||||
$sql_query1 = 'REVOKE GRANT OPTION ON ' . $itemType . ' ' . $db_and_table
|
||||
. ' FROM \'' . Util::sqlAddSlashes($username) . '\'@\''
|
||||
. Util::sqlAddSlashes($hostname) . '\';';
|
||||
. ' FROM \'' . $GLOBALS['dbi']->escapeString($username) . '\'@\''
|
||||
. $GLOBALS['dbi']->escapeString($hostname) . '\';';
|
||||
} else {
|
||||
$sql_query1 = '';
|
||||
}
|
||||
@ -4018,8 +4018,8 @@ function PMA_updatePrivileges($username, $hostname, $tablename, $dbname, $itemTy
|
||||
) {
|
||||
$sql_query2 = 'GRANT ' . join(', ', PMA_extractPrivInfo())
|
||||
. ' ON ' . $itemType . ' ' . $db_and_table
|
||||
. ' TO \'' . Util::sqlAddSlashes($username) . '\'@\''
|
||||
. Util::sqlAddSlashes($hostname) . '\'';
|
||||
. ' TO \'' . $GLOBALS['dbi']->escapeString($username) . '\'@\''
|
||||
. $GLOBALS['dbi']->escapeString($hostname) . '\'';
|
||||
|
||||
if (! mb_strlen($dbname)) {
|
||||
// add REQUIRE clause
|
||||
@ -4073,9 +4073,9 @@ function PMA_getDataForChangeOrCopyUser()
|
||||
|
||||
if (isset($_REQUEST['change_copy'])) {
|
||||
$user_host_condition = ' WHERE `User` = '
|
||||
. "'" . Util::sqlAddSlashes($_REQUEST['old_username']) . "'"
|
||||
. "'" . $GLOBALS['dbi']->escapeString($_REQUEST['old_username']) . "'"
|
||||
. ' AND `Host` = '
|
||||
. "'" . Util::sqlAddSlashes($_REQUEST['old_hostname']) . "';";
|
||||
. "'" . $GLOBALS['dbi']->escapeString($_REQUEST['old_hostname']) . "';";
|
||||
$row = $GLOBALS['dbi']->fetchSingleRow(
|
||||
'SELECT * FROM `mysql`.`user` ' . $user_host_condition
|
||||
);
|
||||
@ -4164,8 +4164,8 @@ function PMA_getDataForDeleteUsers($queries)
|
||||
)
|
||||
. ' ...';
|
||||
$queries[] = 'DROP USER \''
|
||||
. Util::sqlAddSlashes($this_user)
|
||||
. '\'@\'' . Util::sqlAddSlashes($this_host) . '\';';
|
||||
. $GLOBALS['dbi']->escapeString($this_user)
|
||||
. '\'@\'' . $GLOBALS['dbi']->escapeString($this_host) . '\';';
|
||||
PMA_relationsCleanupUser($this_user);
|
||||
|
||||
if (isset($_REQUEST['drop_users_db'])) {
|
||||
@ -4277,8 +4277,8 @@ function PMA_addUser(
|
||||
break;
|
||||
}
|
||||
$sql = "SELECT '1' FROM `mysql`.`user`"
|
||||
. " WHERE `User` = '" . Util::sqlAddSlashes($username) . "'"
|
||||
. " AND `Host` = '" . Util::sqlAddSlashes($hostname) . "';";
|
||||
. " WHERE `User` = '" . $GLOBALS['dbi']->escapeString($username) . "'"
|
||||
. " AND `Host` = '" . $GLOBALS['dbi']->escapeString($hostname) . "';";
|
||||
if ($GLOBALS['dbi']->fetchValue($sql) == 1) {
|
||||
$message = Message::error(__('The user %s already exists!'));
|
||||
$message->addParam(
|
||||
@ -4902,8 +4902,8 @@ function PMA_getHtmlForUserProperties($dbname_is_wildcard,$url_dbname,
|
||||
);
|
||||
|
||||
$sql = "SELECT '1' FROM `mysql`.`user`"
|
||||
. " WHERE `User` = '" . Util::sqlAddSlashes($username) . "'"
|
||||
. " AND `Host` = '" . Util::sqlAddSlashes($hostname) . "';";
|
||||
. " WHERE `User` = '" . $GLOBALS['dbi']->escapeString($username) . "'"
|
||||
. " AND `Host` = '" . $GLOBALS['dbi']->escapeString($hostname) . "';";
|
||||
|
||||
$user_does_not_exists = (bool) ! $GLOBALS['dbi']->fetchValue($sql);
|
||||
|
||||
@ -5010,13 +5010,13 @@ function PMA_getTablePrivsQueriesForChangeOrCopyUser($user_host_condition,
|
||||
'SELECT `Column_name`, `Column_priv`'
|
||||
. ' FROM `mysql`.`columns_priv`'
|
||||
. ' WHERE `User`'
|
||||
. ' = \'' . Util::sqlAddSlashes($_REQUEST['old_username']) . "'"
|
||||
. ' = \'' . $GLOBALS['dbi']->escapeString($_REQUEST['old_username']) . "'"
|
||||
. ' AND `Host`'
|
||||
. ' = \'' . Util::sqlAddSlashes($_REQUEST['old_username']) . '\''
|
||||
. ' = \'' . $GLOBALS['dbi']->escapeString($_REQUEST['old_username']) . '\''
|
||||
. ' AND `Db`'
|
||||
. ' = \'' . Util::sqlAddSlashes($row['Db']) . "'"
|
||||
. ' = \'' . $GLOBALS['dbi']->escapeString($row['Db']) . "'"
|
||||
. ' AND `Table_name`'
|
||||
. ' = \'' . Util::sqlAddSlashes($row['Table_name']) . "'"
|
||||
. ' = \'' . $GLOBALS['dbi']->escapeString($row['Table_name']) . "'"
|
||||
. ';',
|
||||
null,
|
||||
PMA\libraries\DatabaseInterface::QUERY_STORE
|
||||
@ -5064,8 +5064,8 @@ function PMA_getTablePrivsQueriesForChangeOrCopyUser($user_host_condition,
|
||||
$queries[] = 'GRANT ' . join(', ', $tmp_privs1)
|
||||
. ' ON ' . Util::backquote($row['Db']) . '.'
|
||||
. Util::backquote($row['Table_name'])
|
||||
. ' TO \'' . Util::sqlAddSlashes($username)
|
||||
. '\'@\'' . Util::sqlAddSlashes($hostname) . '\''
|
||||
. ' TO \'' . $GLOBALS['dbi']->escapeString($username)
|
||||
. '\'@\'' . $GLOBALS['dbi']->escapeString($hostname) . '\''
|
||||
. (in_array('Grant', explode(',', $row['Table_priv']))
|
||||
? ' WITH GRANT OPTION;'
|
||||
: ';');
|
||||
@ -5086,9 +5086,9 @@ function PMA_getDbSpecificPrivsQueriesForChangeOrCopyUser(
|
||||
$queries, $username, $hostname
|
||||
) {
|
||||
$user_host_condition = ' WHERE `User`'
|
||||
. ' = \'' . Util::sqlAddSlashes($_REQUEST['old_username']) . "'"
|
||||
. ' = \'' . $GLOBALS['dbi']->escapeString($_REQUEST['old_username']) . "'"
|
||||
. ' AND `Host`'
|
||||
. ' = \'' . Util::sqlAddSlashes($_REQUEST['old_hostname']) . '\';';
|
||||
. ' = \'' . $GLOBALS['dbi']->escapeString($_REQUEST['old_hostname']) . '\';';
|
||||
|
||||
$res = $GLOBALS['dbi']->query(
|
||||
'SELECT * FROM `mysql`.`db`' . $user_host_condition
|
||||
@ -5097,8 +5097,8 @@ function PMA_getDbSpecificPrivsQueriesForChangeOrCopyUser(
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
|
||||
$queries[] = 'GRANT ' . join(', ', PMA_extractPrivInfo($row))
|
||||
. ' ON ' . Util::backquote($row['Db']) . '.*'
|
||||
. ' TO \'' . Util::sqlAddSlashes($username)
|
||||
. '\'@\'' . Util::sqlAddSlashes($hostname) . '\''
|
||||
. ' TO \'' . $GLOBALS['dbi']->escapeString($username)
|
||||
. '\'@\'' . $GLOBALS['dbi']->escapeString($hostname) . '\''
|
||||
. ($row['Grant_priv'] == 'Y' ? ' WITH GRANT OPTION;' : ';');
|
||||
}
|
||||
$GLOBALS['dbi']->freeResult($res);
|
||||
@ -5140,7 +5140,7 @@ function PMA_addUserAndCreateDatabase($_error, $real_sql_query, $sql_query,
|
||||
// Create database with same name and grant all privileges
|
||||
$q = 'CREATE DATABASE IF NOT EXISTS '
|
||||
. Util::backquote(
|
||||
Util::sqlAddSlashes($username)
|
||||
$GLOBALS['dbi']->escapeString($username)
|
||||
) . ';';
|
||||
$sql_query .= $q;
|
||||
if (! $GLOBALS['dbi']->tryQuery($q)) {
|
||||
@ -5156,11 +5156,11 @@ function PMA_addUserAndCreateDatabase($_error, $real_sql_query, $sql_query,
|
||||
$q = 'GRANT ALL PRIVILEGES ON '
|
||||
. Util::backquote(
|
||||
Util::escapeMysqlWildcards(
|
||||
Util::sqlAddSlashes($username)
|
||||
$GLOBALS['dbi']->escapeString($username)
|
||||
)
|
||||
) . '.* TO \''
|
||||
. Util::sqlAddSlashes($username)
|
||||
. '\'@\'' . Util::sqlAddSlashes($hostname) . '\';';
|
||||
. $GLOBALS['dbi']->escapeString($username)
|
||||
. '\'@\'' . $GLOBALS['dbi']->escapeString($hostname) . '\';';
|
||||
$sql_query .= $q;
|
||||
if (! $GLOBALS['dbi']->tryQuery($q)) {
|
||||
$message = Message::rawError($GLOBALS['dbi']->getError());
|
||||
@ -5172,11 +5172,11 @@ function PMA_addUserAndCreateDatabase($_error, $real_sql_query, $sql_query,
|
||||
$q = 'GRANT ALL PRIVILEGES ON '
|
||||
. Util::backquote(
|
||||
Util::escapeMysqlWildcards(
|
||||
Util::sqlAddSlashes($username)
|
||||
$GLOBALS['dbi']->escapeString($username)
|
||||
) . '\_%'
|
||||
) . '.* TO \''
|
||||
. Util::sqlAddSlashes($username)
|
||||
. '\'@\'' . Util::sqlAddSlashes($hostname) . '\';';
|
||||
. $GLOBALS['dbi']->escapeString($username)
|
||||
. '\'@\'' . $GLOBALS['dbi']->escapeString($hostname) . '\';';
|
||||
$sql_query .= $q;
|
||||
if (! $GLOBALS['dbi']->tryQuery($q)) {
|
||||
$message = Message::rawError($GLOBALS['dbi']->getError());
|
||||
@ -5187,10 +5187,10 @@ function PMA_addUserAndCreateDatabase($_error, $real_sql_query, $sql_query,
|
||||
// Grant all privileges on the specified database to the new user
|
||||
$q = 'GRANT ALL PRIVILEGES ON '
|
||||
. Util::backquote(
|
||||
Util::sqlAddSlashes($dbname)
|
||||
$GLOBALS['dbi']->escapeString($dbname)
|
||||
) . '.* TO \''
|
||||
. Util::sqlAddSlashes($username)
|
||||
. '\'@\'' . Util::sqlAddSlashes($hostname) . '\';';
|
||||
. $GLOBALS['dbi']->escapeString($username)
|
||||
. '\'@\'' . $GLOBALS['dbi']->escapeString($hostname) . '\';';
|
||||
$sql_query .= $q;
|
||||
if (! $GLOBALS['dbi']->tryQuery($q)) {
|
||||
$message = Message::rawError($GLOBALS['dbi']->getError());
|
||||
@ -5255,9 +5255,9 @@ function PMA_checkIfMariaDBPwdCheckPluginActive()
|
||||
*/
|
||||
function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password)
|
||||
{
|
||||
$slashedUsername = Util::sqlAddSlashes($username);
|
||||
$slashedHostname = Util::sqlAddSlashes($hostname);
|
||||
$slashedPassword = Util::sqlAddSlashes($password);
|
||||
$slashedUsername = $GLOBALS['dbi']->escapeString($username);
|
||||
$slashedHostname = $GLOBALS['dbi']->escapeString($hostname);
|
||||
$slashedPassword = $GLOBALS['dbi']->escapeString($password);
|
||||
$serverType = Util::getServerType();
|
||||
|
||||
$create_user_stmt = sprintf(
|
||||
|
||||
@ -744,7 +744,7 @@ function PMA_getSuspensionPoints($lastChar)
|
||||
function PMA_getJsonForLoggingVars()
|
||||
{
|
||||
if (isset($_REQUEST['varName']) && isset($_REQUEST['varValue'])) {
|
||||
$value = PMA\libraries\Util::sqlAddSlashes($_REQUEST['varValue']);
|
||||
$value = $GLOBALS['dbi']->escapeString($_REQUEST['varValue']);
|
||||
if (! is_numeric($value)) {
|
||||
$value="'" . $value . "'";
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ function PMA_getHtmlForListingUsersofAGroup($userGroup)
|
||||
$usersTable = PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['users']);
|
||||
$sql_query = "SELECT `username` FROM " . $usersTable
|
||||
. " WHERE `usergroup`='" . PMA\libraries\Util::sqlAddSlashes($userGroup)
|
||||
. " WHERE `usergroup`='" . $GLOBALS['dbi']->escapeString($userGroup)
|
||||
. "'";
|
||||
$result = PMA_queryAsControlUser($sql_query, false);
|
||||
if ($result) {
|
||||
@ -186,11 +186,11 @@ function PMA_deleteUserGroup($userGroup)
|
||||
$groupTable = PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['usergroups']);
|
||||
$sql_query = "DELETE FROM " . $userTable
|
||||
. " WHERE `usergroup`='" . PMA\libraries\Util::sqlAddSlashes($userGroup)
|
||||
. " WHERE `usergroup`='" . $GLOBALS['dbi']->escapeString($userGroup)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($sql_query, true);
|
||||
$sql_query = "DELETE FROM " . $groupTable
|
||||
. " WHERE `usergroup`='" . PMA\libraries\Util::sqlAddSlashes($userGroup)
|
||||
. " WHERE `usergroup`='" . $GLOBALS['dbi']->escapeString($userGroup)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($sql_query, true);
|
||||
}
|
||||
@ -249,7 +249,7 @@ function PMA_getHtmlToEditUserGroup($userGroup = null)
|
||||
$groupTable = PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA\libraries\Util::backquote($cfgRelation['usergroups']);
|
||||
$sql_query = "SELECT * FROM " . $groupTable
|
||||
. " WHERE `usergroup`='" . PMA\libraries\Util::sqlAddSlashes($userGroup)
|
||||
. " WHERE `usergroup`='" . $GLOBALS['dbi']->escapeString($userGroup)
|
||||
. "'";
|
||||
$result = PMA_queryAsControlUser($sql_query, false);
|
||||
if ($result) {
|
||||
@ -336,7 +336,7 @@ function PMA_editUserGroup($userGroup, $new = false)
|
||||
|
||||
if (! $new) {
|
||||
$sql_query = "DELETE FROM " . $groupTable
|
||||
. " WHERE `usergroup`='" . PMA\libraries\Util::sqlAddSlashes($userGroup)
|
||||
. " WHERE `usergroup`='" . $GLOBALS['dbi']->escapeString($userGroup)
|
||||
. "';";
|
||||
PMA_queryAsControlUser($sql_query, true);
|
||||
}
|
||||
@ -352,7 +352,7 @@ function PMA_editUserGroup($userGroup, $new = false)
|
||||
}
|
||||
$tabName = $tabGroupName . '_' . $tab;
|
||||
$allowed = isset($_REQUEST[$tabName]) && $_REQUEST[$tabName] == 'Y';
|
||||
$sql_query .= "('" . PMA\libraries\Util::sqlAddSlashes($userGroup) . "', '" . $tabName . "', '"
|
||||
$sql_query .= "('" . $GLOBALS['dbi']->escapeString($userGroup) . "', '" . $tabName . "', '"
|
||||
. ($allowed ? "Y" : "N") . "')";
|
||||
$first = false;
|
||||
}
|
||||
|
||||
@ -887,7 +887,7 @@ function PMA_getDefaultSqlQueryForBrowse($db, $table)
|
||||
include_once 'libraries/bookmark.lib.php';
|
||||
$book_sql_query = PMA_Bookmark_get(
|
||||
$db,
|
||||
'\'' . PMA\libraries\Util::sqlAddSlashes($table) . '\'',
|
||||
'\'' . $GLOBALS['dbi']->escapeString($table) . '\'',
|
||||
'label',
|
||||
false,
|
||||
true
|
||||
|
||||
@ -244,10 +244,10 @@ function PMA_getListOfVersionsOfTable()
|
||||
$sql_query = " SELECT * FROM " .
|
||||
PMA\libraries\Util::backquote($cfgRelation['db']) . "." .
|
||||
PMA\libraries\Util::backquote($cfgRelation['tracking']) .
|
||||
" WHERE db_name = '" . PMA\libraries\Util::sqlAddSlashes($_REQUEST['db']) .
|
||||
" WHERE db_name = '" . $GLOBALS['dbi']->escapeString($_REQUEST['db']) .
|
||||
"' " .
|
||||
" AND table_name = '" .
|
||||
PMA\libraries\Util::sqlAddSlashes($_REQUEST['table']) . "' " .
|
||||
$GLOBALS['dbi']->escapeString($_REQUEST['table']) . "' " .
|
||||
" ORDER BY version DESC ";
|
||||
|
||||
return PMA_queryAsControlUser($sql_query);
|
||||
@ -404,7 +404,7 @@ function PMA_getSQLResultForSelectableTables()
|
||||
$sql_query = " SELECT DISTINCT db_name, table_name FROM " .
|
||||
PMA\libraries\Util::backquote($cfgRelation['db']) . "." .
|
||||
PMA\libraries\Util::backquote($cfgRelation['tracking']) .
|
||||
" WHERE db_name = '" . PMA\libraries\Util::sqlAddSlashes($GLOBALS['db']) .
|
||||
" WHERE db_name = '" . $GLOBALS['dbi']->escapeString($GLOBALS['db']) .
|
||||
"' " .
|
||||
" ORDER BY db_name, table_name";
|
||||
|
||||
@ -1646,9 +1646,9 @@ function PMA_displayTrackedTables(
|
||||
PMA\libraries\Util::backquote($cfgRelation['db']) . '.' .
|
||||
PMA\libraries\Util::backquote($cfgRelation['tracking']) .
|
||||
' WHERE `db_name` = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($_REQUEST['db'])
|
||||
. $GLOBALS['dbi']->escapeString($_REQUEST['db'])
|
||||
. '\' AND `table_name` = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($table_name)
|
||||
. $GLOBALS['dbi']->escapeString($table_name)
|
||||
. '\' AND `version` = \'' . $version_number . '\'';
|
||||
|
||||
$table_result = PMA_queryAsControlUser($table_query);
|
||||
|
||||
@ -236,8 +236,8 @@ function PMA_getMIME($db, $table, $strict = false, $fullName = false)
|
||||
`input_transformation_options`
|
||||
FROM ' . PMA\libraries\Util::backquote($cfgRelation['db']) . '.'
|
||||
. PMA\libraries\Util::backquote($cfgRelation['column_info']) . '
|
||||
WHERE `db_name` = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'
|
||||
AND `table_name` = \'' . PMA\libraries\Util::sqlAddSlashes($table) . '\'
|
||||
WHERE `db_name` = \'' . $GLOBALS['dbi']->escapeString($db) . '\'
|
||||
AND `table_name` = \'' . $GLOBALS['dbi']->escapeString($table) . '\'
|
||||
AND ( `mimetype` != \'\'' . (!$strict ? '
|
||||
OR `transformation` != \'\'
|
||||
OR `transformation_options` != \'\'
|
||||
@ -331,9 +331,9 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
|
||||
`comment`
|
||||
FROM ' . PMA\libraries\Util::backquote($cfgRelation['db']) . '.'
|
||||
. PMA\libraries\Util::backquote($cfgRelation['column_info']) . '
|
||||
WHERE `db_name` = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'
|
||||
AND `table_name` = \'' . PMA\libraries\Util::sqlAddSlashes($table) . '\'
|
||||
AND `column_name` = \'' . PMA\libraries\Util::sqlAddSlashes($key) . '\'';
|
||||
WHERE `db_name` = \'' . $GLOBALS['dbi']->escapeString($db) . '\'
|
||||
AND `table_name` = \'' . $GLOBALS['dbi']->escapeString($table) . '\'
|
||||
AND `column_name` = \'' . $GLOBALS['dbi']->escapeString($key) . '\'';
|
||||
|
||||
$test_rs = PMA_queryAsControlUser(
|
||||
$test_qry, true, PMA\libraries\DatabaseInterface::QUERY_STORE
|
||||
@ -354,25 +354,25 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
|
||||
. PMA\libraries\Util::backquote($cfgRelation['column_info'])
|
||||
. ' SET '
|
||||
. '`mimetype` = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($mimetype) . '\', '
|
||||
. $GLOBALS['dbi']->escapeString($mimetype) . '\', '
|
||||
. '`transformation` = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($transformation) . '\', '
|
||||
. $GLOBALS['dbi']->escapeString($transformation) . '\', '
|
||||
. '`transformation_options` = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($transformationOpts) . '\', '
|
||||
. $GLOBALS['dbi']->escapeString($transformationOpts) . '\', '
|
||||
. '`input_transformation` = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($inputTransform) . '\', '
|
||||
. $GLOBALS['dbi']->escapeString($inputTransform) . '\', '
|
||||
. '`input_transformation_options` = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($inputTransformOpts) . '\'';
|
||||
. $GLOBALS['dbi']->escapeString($inputTransformOpts) . '\'';
|
||||
} else {
|
||||
$upd_query = 'DELETE FROM '
|
||||
. PMA\libraries\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PMA\libraries\Util::backquote($cfgRelation['column_info']);
|
||||
}
|
||||
$upd_query .= '
|
||||
WHERE `db_name` = \'' . PMA\libraries\Util::sqlAddSlashes($db) . '\'
|
||||
AND `table_name` = \'' . PMA\libraries\Util::sqlAddSlashes($table)
|
||||
WHERE `db_name` = \'' . $GLOBALS['dbi']->escapeString($db) . '\'
|
||||
AND `table_name` = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'
|
||||
AND `column_name` = \'' . PMA\libraries\Util::sqlAddSlashes($key)
|
||||
AND `column_name` = \'' . $GLOBALS['dbi']->escapeString($key)
|
||||
. '\'';
|
||||
} elseif (mb_strlen($mimetype)
|
||||
|| mb_strlen($transformation)
|
||||
@ -386,14 +386,14 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
|
||||
. 'transformation, transformation_options, '
|
||||
. 'input_transformation, input_transformation_options) '
|
||||
. ' VALUES('
|
||||
. '\'' . PMA\libraries\Util::sqlAddSlashes($db) . '\','
|
||||
. '\'' . PMA\libraries\Util::sqlAddSlashes($table) . '\','
|
||||
. '\'' . PMA\libraries\Util::sqlAddSlashes($key) . '\','
|
||||
. '\'' . PMA\libraries\Util::sqlAddSlashes($mimetype) . '\','
|
||||
. '\'' . PMA\libraries\Util::sqlAddSlashes($transformation) . '\','
|
||||
. '\'' . PMA\libraries\Util::sqlAddSlashes($transformationOpts) . '\','
|
||||
. '\'' . PMA\libraries\Util::sqlAddSlashes($inputTransform) . '\','
|
||||
. '\'' . PMA\libraries\Util::sqlAddSlashes($inputTransformOpts) . '\')';
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($db) . '\','
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($table) . '\','
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($key) . '\','
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($mimetype) . '\','
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($transformation) . '\','
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($transformationOpts) . '\','
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($inputTransform) . '\','
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($inputTransformOpts) . '\')';
|
||||
}
|
||||
|
||||
if (isset($upd_query)) {
|
||||
|
||||
@ -64,7 +64,7 @@ function PMA_loadUserprefs()
|
||||
$query = 'SELECT `config_data`, UNIX_TIMESTAMP(`timevalue`) ts'
|
||||
. ' FROM ' . $query_table
|
||||
. ' WHERE `username` = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($cfgRelation['user'])
|
||||
. $GLOBALS['dbi']->escapeString($cfgRelation['user'])
|
||||
. '\'';
|
||||
$row = $GLOBALS['dbi']->fetchSingleRow($query, 'ASSOC', $GLOBALS['controllink']);
|
||||
|
||||
@ -104,7 +104,7 @@ function PMA_saveUserprefs(array $config_array)
|
||||
. PMA\libraries\Util::backquote($cfgRelation['userconfig']);
|
||||
$query = 'SELECT `username` FROM ' . $query_table
|
||||
. ' WHERE `username` = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($cfgRelation['user'])
|
||||
. $GLOBALS['dbi']->escapeString($cfgRelation['user'])
|
||||
. '\'';
|
||||
|
||||
$has_config = $GLOBALS['dbi']->fetchValue(
|
||||
@ -114,17 +114,17 @@ function PMA_saveUserprefs(array $config_array)
|
||||
if ($has_config) {
|
||||
$query = 'UPDATE ' . $query_table
|
||||
. ' SET `timevalue` = NOW(), `config_data` = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($config_data)
|
||||
. $GLOBALS['dbi']->escapeString($config_data)
|
||||
. '\''
|
||||
. ' WHERE `username` = \''
|
||||
. PMA\libraries\Util::sqlAddSlashes($cfgRelation['user'])
|
||||
. $GLOBALS['dbi']->escapeString($cfgRelation['user'])
|
||||
. '\'';
|
||||
} else {
|
||||
$query = 'INSERT INTO ' . $query_table
|
||||
. ' (`username`, `timevalue`,`config_data`) '
|
||||
. 'VALUES (\''
|
||||
. PMA\libraries\Util::sqlAddSlashes($cfgRelation['user']) . '\', NOW(), '
|
||||
. '\'' . PMA\libraries\Util::sqlAddSlashes($config_data) . '\')';
|
||||
. $GLOBALS['dbi']->escapeString($cfgRelation['user']) . '\', NOW(), '
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($config_data) . '\')';
|
||||
}
|
||||
if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
|
||||
unset($_SESSION['cache'][$cache_key]['userprefs']);
|
||||
|
||||
@ -83,6 +83,9 @@ class ImportLdiTest extends PMATestCase
|
||||
$dbi->expects($this->any())->method('fetchRow')
|
||||
->will($this->returnValue($fetchRowResult));
|
||||
|
||||
$dbi->expects($this->any())->method('escapeString')
|
||||
->will($this->returnArgument(0));
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$this->object = new ImportLdi();
|
||||
|
||||
@ -134,10 +134,14 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
|
||||
$dbi->expects($this->any())->method('tryQuery')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->any())->method('escapeString')
|
||||
->will($this->returnArgument(0));
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
$GLOBALS['is_superuser'] = true;
|
||||
$GLOBALS['is_grantuser'] = true;
|
||||
$GLOBALS['is_createuser'] = true;
|
||||
$GLOBALS['is_reload_priv'] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -507,8 +511,8 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
|
||||
$db, $table, $username, $hostname
|
||||
);
|
||||
$sql = "SELECT * FROM `mysql`.`user`"
|
||||
. " WHERE `User` = '" . PMA\libraries\Util::sqlAddSlashes($username) . "'"
|
||||
. " AND `Host` = '" . PMA\libraries\Util::sqlAddSlashes($hostname) . "';";
|
||||
. " WHERE `User` = '" . $GLOBALS['dbi']->escapeString($username) . "'"
|
||||
. " AND `Host` = '" . $GLOBALS['dbi']->escapeString($hostname) . "';";
|
||||
$this->assertEquals(
|
||||
$sql,
|
||||
$ret
|
||||
@ -521,8 +525,8 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
|
||||
$db, $table, $username, $hostname
|
||||
);
|
||||
$sql = "SELECT * FROM `mysql`.`db`"
|
||||
. " WHERE `User` = '" . PMA\libraries\Util::sqlAddSlashes($username) . "'"
|
||||
. " AND `Host` = '" . PMA\libraries\Util::sqlAddSlashes($hostname) . "'"
|
||||
. " WHERE `User` = '" . $GLOBALS['dbi']->escapeString($username) . "'"
|
||||
. " AND `Host` = '" . $GLOBALS['dbi']->escapeString($hostname) . "'"
|
||||
. " AND '" . PMA\libraries\Util::unescapeMysqlWildcards($db) . "'"
|
||||
. " LIKE `Db`;";
|
||||
$this->assertEquals(
|
||||
@ -538,10 +542,10 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
$sql = "SELECT `Table_priv`"
|
||||
. " FROM `mysql`.`tables_priv`"
|
||||
. " WHERE `User` = '" . PMA\libraries\Util::sqlAddSlashes($username) . "'"
|
||||
. " AND `Host` = '" . PMA\libraries\Util::sqlAddSlashes($hostname) . "'"
|
||||
. " WHERE `User` = '" . $GLOBALS['dbi']->escapeString($username) . "'"
|
||||
. " AND `Host` = '" . $GLOBALS['dbi']->escapeString($hostname) . "'"
|
||||
. " AND `Db` = '" . PMA\libraries\Util::unescapeMysqlWildcards($db) . "'"
|
||||
. " AND `Table_name` = '" . PMA\libraries\Util::sqlAddSlashes($table) . "';";
|
||||
. " AND `Table_name` = '" . $GLOBALS['dbi']->escapeString($table) . "';";
|
||||
$this->assertEquals(
|
||||
$sql,
|
||||
$ret
|
||||
@ -556,7 +560,7 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(
|
||||
"SELECT `Table_priv` FROM `mysql`.`tables_priv` "
|
||||
. "WHERE `User` = 'pma_username' AND "
|
||||
. "`Host` = 'pma_hostname' AND `Db` = 'db\' AND' AND "
|
||||
. "`Host` = 'pma_hostname' AND `Db` = 'db' AND' AND "
|
||||
. "`Table_name` = 'pma_table';",
|
||||
$ret
|
||||
);
|
||||
|
||||
@ -236,7 +236,7 @@ function PMA_changePassUrlParamsAndSubmitQuery(
|
||||
. ' IDENTIFIED with ' . $orig_auth_plugin . ' BY '
|
||||
. (($password == '')
|
||||
? '\'\''
|
||||
: '\'' . PMA\libraries\Util::sqlAddSlashes($password) . '\'');
|
||||
: '\'' . $GLOBALS['dbi']->escapeString($password) . '\'');
|
||||
} else if ($serverType == 'MariaDB'
|
||||
&& PMA_MYSQL_INT_VERSION >= 50200
|
||||
&& PMA_MYSQL_INT_VERSION < 100100
|
||||
@ -264,7 +264,7 @@ function PMA_changePassUrlParamsAndSubmitQuery(
|
||||
$local_query = 'SET password = ' . (($password == '')
|
||||
? '\'\''
|
||||
: $hashing_function . '(\''
|
||||
. PMA\libraries\Util::sqlAddSlashes($password) . '\')');
|
||||
. $GLOBALS['dbi']->escapeString($password) . '\')');
|
||||
}
|
||||
if (! @$GLOBALS['dbi']->tryQuery($local_query)) {
|
||||
PMA\libraries\Util::mysqlDie(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user