0 ) { array_pop( $__realparts ); } } else { array_push( $__realparts, $__parts[ $i ] ); } } return $__startPoint . _PL_OS_SEP . implode( _PL_OS_SEP, $__realparts ); } function PMA_splitSqlFile(&$ret, $sql) { $sql = rtrim($sql, "\n\r"); $sql_len = strlen($sql); $char = ''; $string_start = ''; $in_string = FALSE; $nothing = TRUE; $time0 = time(); for ($i = 0; $i < $sql_len; ++$i) { $char = $sql[$i]; if ($in_string) { for (;;) { $i = strpos($sql, $string_start, $i); if (!$i) { $ret[] = array('query' => $sql, 'empty' => $nothing); return TRUE; } else if ($string_start == '`' || $sql[$i-1] != '\\') { $string_start = ''; $in_string = FALSE; break; } else { $j = 2; $escaped_backslash = FALSE; while ($i-$j > 0 && $sql[$i-$j] == '\\') { $escaped_backslash = !$escaped_backslash; $j++; } if ($escaped_backslash) { $string_start = ''; $in_string = FALSE; break; } else { $i++; } } } } else if (($char == '-' && $sql_len > $i + 2 && $sql[$i + 1] == '-' && $sql[$i + 2] <= ' ') || $char == '#' || ($char == '/' && $sql_len > $i + 1 && $sql[$i + 1] == '*')) { $i = strpos($sql, $char == '/' ? '*/' : "\n", $i); if ($i === FALSE) { break; } if ($char == '/') $i++; } else if ($char == ';') { $ret[] = array('query' => substr($sql, 0, $i), 'empty' => $nothing); $nothing = TRUE; $sql = ltrim(substr($sql, min($i + 1, $sql_len))); $sql_len = strlen($sql); if ($sql_len) { $i = -1; } else { return TRUE; } } else if (($char == '"') || ($char == '\'') || ($char == '`')) { $in_string = TRUE; $nothing = FALSE; $string_start = $char; } elseif ($nothing) { $nothing = FALSE; } $time1 = time(); if ($time1 >= $time0 + 30) { $time0 = $time1; header('X-pmaPing: Pong'); } } if (!empty($sql) && preg_match('@[^[:space:]]+@', $sql)) { $ret[] = array('query' => $sql, 'empty' => $nothing); } return TRUE; }