Replace other usages of deprecated split().

This commit is contained in:
Michal Čihař
2010-04-22 20:21:07 +02:00
parent e7f528e0b7
commit 20925728e7
3 changed files with 16 additions and 16 deletions

View File

@@ -21,7 +21,7 @@ function Swekey_auth_check()
if ($_SESSION['SWEKEY']['ENABLED'] && empty($_SESSION['SWEKEY']['CONF_LOADED'])) { if ($_SESSION['SWEKEY']['ENABLED'] && empty($_SESSION['SWEKEY']['CONF_LOADED'])) {
$_SESSION['SWEKEY']['CONF_LOADED'] = true; $_SESSION['SWEKEY']['CONF_LOADED'] = true;
$_SESSION['SWEKEY']['VALID_SWEKEYS'] = array(); $_SESSION['SWEKEY']['VALID_SWEKEYS'] = array();
$valid_swekeys = split("\n",@file_get_contents($confFile)); $valid_swekeys = explode("\n", @file_get_contents($confFile));
foreach ($valid_swekeys as $line) { foreach ($valid_swekeys as $line) {
if (preg_match("/^[0-9A-F]{32}:.+$/", $line) != false) if (preg_match("/^[0-9A-F]{32}:.+$/", $line) != false)
{ {

View File

@@ -31,7 +31,7 @@ if (isset($plugin_list)) {
), ),
'options_text' => 'strOptions', 'options_text' => 'strOptions',
); );
if ($plugin_param !== 'table') { if ($plugin_param !== 'table') {
$plugin_list['csv']['options'][] = $plugin_list['csv']['options'][] =
array('type' => 'bool', 'name' => 'col_names', 'text' => 'strImportColNames'); array('type' => 'bool', 'name' => 'col_names', 'text' => 'strImportColNames');
@@ -39,7 +39,7 @@ if (isset($plugin_list)) {
$plugin_list['csv']['options'][] = $plugin_list['csv']['options'][] =
array('type' => 'text', 'name' => 'columns', 'text' => 'strColumnNames'); array('type' => 'text', 'name' => 'columns', 'text' => 'strColumnNames');
} }
/* We do not define function when plugin is just queried for information above */ /* We do not define function when plugin is just queried for information above */
return; return;
} }
@@ -101,7 +101,7 @@ if (!$analyze) {
} else { } else {
$sql_template .= ' ('; $sql_template .= ' (';
$fields = array(); $fields = array();
$tmp = split(',( ?)', $csv_columns); $tmp = preg_split('/,( ?)/', $csv_columns);
foreach ($tmp as $key => $val) { foreach ($tmp as $key => $val) {
if (count($fields) > 0) { if (count($fields) > 0) {
$sql_template .= ', '; $sql_template .= ', ';
@@ -126,7 +126,7 @@ if (!$analyze) {
} }
$sql_template .= ') '; $sql_template .= ') ';
} }
$required_fields = count($fields); $required_fields = count($fields);
$sql_template .= ' VALUES ('; $sql_template .= ' VALUES (';
@@ -287,18 +287,18 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) {
if (!$csv_finish) { if (!$csv_finish) {
$values[] = ''; $values[] = '';
} }
if ($analyze) { if ($analyze) {
foreach ($values as $ley => $val) { foreach ($values as $ley => $val) {
$tempRow[] = $val; $tempRow[] = $val;
++$col_count; ++$col_count;
} }
if ($col_count > $max_cols) { if ($col_count > $max_cols) {
$max_cols = $col_count; $max_cols = $col_count;
} }
$col_count = 0; $col_count = 0;
$rows[] = $tempRow; $rows[] = $tempRow;
$tempRow = array(); $tempRow = array();
} else { } else {
@@ -315,7 +315,7 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) {
break; break;
} }
} }
$first = TRUE; $first = TRUE;
$sql = $sql_template; $sql = $sql_template;
foreach ($values as $key => $val) { foreach ($values as $key => $val) {
@@ -331,13 +331,13 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) {
$first = FALSE; $first = FALSE;
} }
$sql .= ')'; $sql .= ')';
/** /**
* @todo maybe we could add original line to verbose SQL in comment * @todo maybe we could add original line to verbose SQL in comment
*/ */
PMA_importRunQuery($sql, $sql); PMA_importRunQuery($sql, $sql);
} }
$line++; $line++;
$csv_finish = FALSE; $csv_finish = FALSE;
$values = array(); $values = array();
@@ -358,26 +358,26 @@ if ($analyze) {
$rows[$i][] = 'NULL'; $rows[$i][] = 'NULL';
} }
} }
if ($_REQUEST['csv_col_names']) { if ($_REQUEST['csv_col_names']) {
$col_names = array_splice($rows, 0, 1); $col_names = array_splice($rows, 0, 1);
$col_names = $col_names[0]; $col_names = $col_names[0];
} }
if ((isset($col_names) && count($col_names) != $max_cols) || !isset($col_names)) { if ((isset($col_names) && count($col_names) != $max_cols) || !isset($col_names)) {
// Fill out column names // Fill out column names
for ($i = 0; $i < $max_cols; ++$i) { for ($i = 0; $i < $max_cols; ++$i) {
$col_names[] = 'COL '.($i+1); $col_names[] = 'COL '.($i+1);
} }
} }
if (strlen($db)) { if (strlen($db)) {
$result = PMA_DBI_fetch_result('SHOW TABLES'); $result = PMA_DBI_fetch_result('SHOW TABLES');
$tbl_name = 'TABLE '.(count($result) + 1); $tbl_name = 'TABLE '.(count($result) + 1);
} else { } else {
$tbl_name = 'TBL_NAME'; $tbl_name = 'TBL_NAME';
} }
$tables[] = array($tbl_name, $col_names, $rows); $tables[] = array($tbl_name, $col_names, $rows);
/* Obtain the best-fit MySQL types for each column */ /* Obtain the best-fit MySQL types for each column */

View File

@@ -90,7 +90,7 @@ if ($skip_queries > 0) {
} }
if (strlen($ldi_columns) > 0) { if (strlen($ldi_columns) > 0) {
$sql .= ' ('; $sql .= ' (';
$tmp = split(',( ?)', $ldi_columns); $tmp = preg_split('/,( ?)/', $ldi_columns);
$cnt_tmp = count($tmp); $cnt_tmp = count($tmp);
for ($i = 0; $i < $cnt_tmp; $i++) { for ($i = 0; $i < $cnt_tmp; $i++) {
if ($i > 0) { if ($i > 0) {