Replace regular expressions when simple
Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
This commit is contained in:
parent
dd74c497d9
commit
746fd8b417
@ -90,7 +90,7 @@ if ($cfgRelation['savedsearcheswork']) {
|
||||
*/
|
||||
$message_to_display = false;
|
||||
if (isset($_POST['submit_sql']) && ! empty($sql_query)) {
|
||||
if (! preg_match('@^SELECT@i', $sql_query)) {
|
||||
if (0 !== stripos($sql_query, "SELECT")) {
|
||||
$message_to_display = true;
|
||||
} else {
|
||||
$goto = 'db_sql.php';
|
||||
|
||||
@ -62,7 +62,7 @@ $target_blacklist = [
|
||||
// If we have a valid target, let's load that script instead
|
||||
if (! empty($_REQUEST['target'])
|
||||
&& is_string($_REQUEST['target'])
|
||||
&& ! preg_match('/^index/', $_REQUEST['target'])
|
||||
&& 0 !== strpos($_REQUEST['target'], "index")
|
||||
&& ! in_array($_REQUEST['target'], $target_blacklist)
|
||||
&& Core::checkPageValidity($_REQUEST['target'], [], true)
|
||||
) {
|
||||
|
||||
@ -158,7 +158,7 @@ class TableSearchController extends TableController
|
||||
// strip the "BINARY" attribute, except if we find "BINARY(" because
|
||||
// this would be a BINARY or VARBINARY column type
|
||||
if (! preg_match('@BINARY[\(]@i', $type)) {
|
||||
$type = preg_replace('@BINARY@i', '', $type);
|
||||
$type = str_ireplace("BINARY", '', $type);
|
||||
}
|
||||
$type = preg_replace('@ZEROFILL@i', '', $type);
|
||||
$type = preg_replace('@UNSIGNED@i', '', $type);
|
||||
|
||||
@ -3002,7 +3002,7 @@ class InsertEdit
|
||||
'sql_query' => $_POST['sql_query'],
|
||||
];
|
||||
|
||||
if (preg_match('@^tbl_@', $GLOBALS['goto'])) {
|
||||
if (0 === strpos($GLOBALS['goto'], "tbl_")) {
|
||||
$url_params['table'] = $table;
|
||||
}
|
||||
|
||||
|
||||
@ -1280,7 +1280,7 @@ class Relation
|
||||
$key = htmlspecialchars($key);
|
||||
} else {
|
||||
$key = '0x' . bin2hex($key);
|
||||
if (preg_match('/0x/', $data)) {
|
||||
if (false !== strpos($data, "0x")) {
|
||||
$selected = ($key == trim($data));
|
||||
} else {
|
||||
$selected = ($key == '0x' . $data);
|
||||
|
||||
@ -30,7 +30,7 @@ class SysInfoSunOS extends SysInfoBase
|
||||
private function _kstat($key)
|
||||
{
|
||||
if ($m = shell_exec('kstat -p d ' . $key)) {
|
||||
list(, $value) = preg_split("/\t/", trim($m), 2);
|
||||
list(, $value) = explode("\t", trim($m), 2);
|
||||
|
||||
return $value;
|
||||
} else {
|
||||
|
||||
@ -526,7 +526,7 @@ class Table
|
||||
$query .= ' ' . $attribute;
|
||||
|
||||
if ($is_timestamp
|
||||
&& preg_match('/TIMESTAMP/i', $attribute)
|
||||
&& false !== stripos($attribute, "TIMESTAMP")
|
||||
&& strlen($length) !== 0
|
||||
&& $length !== 0
|
||||
) {
|
||||
|
||||
@ -53,7 +53,7 @@ class Transformations
|
||||
$result = [];
|
||||
|
||||
if (strlen($option_string) === 0
|
||||
|| ! $transform_options = preg_split('/,/', $option_string)
|
||||
|| ! $transform_options = explode(",", $option_string)
|
||||
) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -2894,7 +2894,7 @@ class Util
|
||||
// this would be a BINARY or VARBINARY column type;
|
||||
// by the way, a BLOB should not show the BINARY attribute
|
||||
// because this is not accepted in MySQL syntax.
|
||||
if (preg_match('@binary@', $printtype)
|
||||
if (false !== strpos($printtype, "binary")
|
||||
&& ! preg_match('@binary[\(]@', $printtype)
|
||||
) {
|
||||
$printtype = preg_replace('@binary@', '', $printtype);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user