removed PMA_isInto(), deprecated by in_array()

This commit is contained in:
Sebastian Mendel
2005-12-08 12:37:38 +00:00
parent c0966e3ad0
commit fe8553fa7b
4 changed files with 15 additions and 38 deletions

View File

@@ -85,7 +85,7 @@ if (isset($submit_search)) {
for ($i = 0; $i < $search_wds_cnt; $i++) {
// Eliminates empty values
// In MySQL 4.1, if a field has no collation we get NULL in Charset
// but in MySQL 5.0.x we get ''
// but in MySQL 5.0.x we get ''
if (!empty($search_words[$i])) {
for ($j = 0; $j < $tblfields_cnt; $j++) {
if (PMA_MYSQL_INT_VERSION >= 40100 && $tblfields[$j]['Charset'] != $charset_connection && $tblfields[$j]['Charset'] != 'NULL' && $tblfields[$j]['Charset'] != '') {
@@ -323,9 +323,9 @@ if ($num_tables > 1) {
if (!empty($unselectall)) {
$is_selected = '';
}
else if ((isset($table_select) && PMA_isInto($tables[$i], $table_select) != -1)
|| (!empty($selectall))
|| (isset($onetable) && $onetable == $tables[$i])) {
elseif ( ( isset($table_select) && in_array($tables[$i], $table_select) )
|| ! empty($selectall)
|| ( isset($onetable) && $onetable == $tables[$i]) ) {
$is_selected = ' selected="selected"';
}
else {

View File

@@ -297,7 +297,7 @@ function PMA_safe_db_list($only_db_check, $controllink, $dblist_cnt, $rs, $userl
$rs = PMA_DBI_try_query($local_query, $controllink);
if ($rs && @PMA_DBI_num_rows($rs)) {
while ($row = PMA_DBI_fetch_assoc($rs)) {
if (PMA_isInto($row['Db'], $dblist) == -1) {
if ( ! in_array($row['Db'], $dblist) ) {
$dblist[] = $row['Db'];
}
} // end while
@@ -812,15 +812,15 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
// get the duplicate entry
// get table name
preg_match( '<27>ALTER\sTABLE\s\`([^\`]+)\`<60>iu', $the_query, $error_table = array() );
preg_match( '<27>ALTER\sTABLE\s\`([^\`]+)\`<60>iu', $the_query, $error_table = array() );
$error_table = $error_table[1];
// get fields
preg_match( '<27>\(([^\)]+)\)<29>i', $the_query, $error_fields = array() );
preg_match( '<27>\(([^\)]+)\)<29>i', $the_query, $error_fields = array() );
$error_fields = explode( ',', $error_fields[1] );
// duplicate value
preg_match( '<27>\'([^\']+)\'<27>i', $tmp_mysql_error, $duplicate_value = array() );
preg_match( '<27>\'([^\']+)\'<27>i', $tmp_mysql_error, $duplicate_value = array() );
$duplicate_value = $duplicate_value[1];
$sql = '
@@ -852,29 +852,6 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
}
} // end of the 'PMA_mysqlDie()' function
/**
* Defines whether a string exists inside an array or not
*
* @param string string to search for
* @param mixed array to search into
*
* @return integer the rank of the $toFind string in the array or '-1' if
* it hasn't been found
*
* @access public
*/
function PMA_isInto($toFind = '', &$in)
{
$max = count($in);
for ($i = 0; $i < $max && ($toFind != $in[$i]); $i++) {
// void();
}
return ($i < $max) ? $i : -1;
} // end of the 'PMA_isInto()' function
/**
* Returns a string formatted with CONVERT ... USING
* if MySQL supports it
@@ -1954,9 +1931,9 @@ window.parent.updateTableTitle( '<?php echo $uni_tbl; ?>', '<?php echo PMA_jsFor
$ret .= '<input type="image"' . $submit_name . ' '
. implode( ' ', $tag_params_strings )
. ' src="' . preg_replace(
'<27>^.*\ssrc="([^"]*)".*$<24>si', '\1', $message ) . '"'
'<27>^.*\ssrc="([^"]*)".*$<24>si', '\1', $message ) . '"'
. ' value="' . htmlspecialchars(
preg_replace( '<27>^.*\salt="([^"]*)".*$<24>si', '\1',
preg_replace( '<27>^.*\salt="([^"]*)".*$<24>si', '\1',
$message) )
. '" />';
}

View File

@@ -91,8 +91,8 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
$GLOBALS['asfile'] = 1;
// Ensure the target is valid
if (count($dblist) > 0 &&
(PMA_isInto($source_db, $dblist) == -1 || PMA_isInto($target_db, $dblist) == -1)) {
if ( count($dblist) > 0 &&
( ! in_array($source_db, $dblist) || ! in_array($target_db, $dblist) )) {
exit();
}

View File

@@ -290,7 +290,7 @@ class PMA_PDF extends PMA_FPDF
echo "\n";
require_once('./libraries/footer.inc.php');
} // end of the "PMA_PDF_die()" function
} // end of the "PMA_PDF_die()" function
/**
@@ -645,7 +645,7 @@ class PMA_RT_Table
// loic1 : PHP3 fix
// if (in_array($field, $this->primary)) {
if ($setcolor) {
if (PMA_isInto($field, $this->primary) != -1) {
if ( in_array($field, $this->primary) ) {
$pdf->SetFillColor(215, 121, 123);
}
if ($field == $this->displayfield) {
@@ -1200,7 +1200,7 @@ class PMA_RT
// (do not use array_search() because we would have to
// to do a === FALSE and this is not PHP3 compatible)
if (PMA_isInto($rel['foreign_table'], $alltables)> -1) {
if ( in_array($rel['foreign_table'], $alltables) ) {
$this->PMA_RT_addRelation($one_table , $master_field, $rel['foreign_table'], $rel['foreign_field']);
}