added PMA_unQuote() to remove quotes from strings
This commit is contained in:
@@ -13,8 +13,9 @@ $Source$
|
|||||||
added variables to define (text) color for marked and hovered objects
|
added variables to define (text) color for marked and hovered objects
|
||||||
thanks to Juergen Wind - windkiel for hinting this bug (patch #1503529)
|
thanks to Juergen Wind - windkiel for hinting this bug (patch #1503529)
|
||||||
* Documentation.html: updated style config option descriptions
|
* Documentation.html: updated style config option descriptions
|
||||||
* libraries/common.lib.php: added PMA_escapeJsString() to escape strings for
|
* libraries/common.lib.php:
|
||||||
JavaScript inside CDATA blocks
|
- added PMA_escapeJsString() to escape strings for JavaScript inside CDATA blocks
|
||||||
|
- added PMA_unQuote() to remove quotes from strings
|
||||||
* libraries/footer.inc.php: correctly escape strings inside JavaScript
|
* libraries/footer.inc.php: correctly escape strings inside JavaScript
|
||||||
(part of bug #1532721)
|
(part of bug #1532721)
|
||||||
|
|
||||||
|
@@ -723,6 +723,39 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
|||||||
return $name;
|
return $name;
|
||||||
} // end of the 'PMA_unescape_mysql_wildcards()' function
|
} // end of the 'PMA_unescape_mysql_wildcards()' function
|
||||||
|
|
||||||
|
/**
|
||||||
|
* removes quotes (',",`) from a quoted string
|
||||||
|
*
|
||||||
|
* checks if the sting is quoted and removes this quotes
|
||||||
|
*
|
||||||
|
* @param string $quoted_string string to remove quotes from
|
||||||
|
* @param string $quote type of quote to remove
|
||||||
|
* @return string unqoted string
|
||||||
|
*/
|
||||||
|
function PMA_unQuote($quoted_string, $quote = null)
|
||||||
|
{
|
||||||
|
$quotes = array();
|
||||||
|
|
||||||
|
if (null === $quote) {
|
||||||
|
$quotes[] = '`';
|
||||||
|
$quotes[] = '"';
|
||||||
|
$quotes[] = "'";
|
||||||
|
} else {
|
||||||
|
$quotes[] = $quote;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($quotes as $quote) {
|
||||||
|
if (substr($quoted_string, 0, 1) === $quote
|
||||||
|
&& substr($quoted_string, 1, 1) !== $quote
|
||||||
|
&& substr($quoted_string, -1, 1) === $quote
|
||||||
|
&& substr($quoted_string, -2, 1) !== $quote ) {
|
||||||
|
return substr($quoted_string, 1, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $quoted_string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* format sql strings
|
* format sql strings
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user