Zeile 1321 | Zeile 1321 |
---|
$update = false; $search_bit = array();
|
$update = false; $search_bit = array();
|
if(is_array($main_field) && !empty($main_field)) { foreach($main_field as $field) { if(isset($mybb->binary_fields[$table][$field]) && $mybb->binary_fields[$table][$field]) { $search_bit[] = "{$field} = ".$replacements[$field]; } else { $search_bit[] = "{$field} = ".$this->quote_val($replacements[$field]); } }
$search_bit = implode(" AND ", $search_bit); $query = $this->write_query("SELECT COUNT(".$main_field[0].") as count FROM {$this->table_prefix}{$table} WHERE {$search_bit} LIMIT 1"); if($this->fetch_field($query, "count") == 1) { $update = true; } } else { $query = $this->write_query("SELECT {$main_field} FROM {$this->table_prefix}{$table}");
while($column = $this->fetch_array($query)) { if($column[$main_field] == $replacements[$main_field]) { $update = true; break; } }
| if(!is_array($main_field)) { $main_field = array($main_field);
|
}
|
}
|
if($update === true)
| foreach($main_field as $field)
|
{
|
{
|
if(is_array($main_field)) { return $this->update_query($table, $replacements, $search_bit);
| if(isset($mybb->binary_fields[$table][$field]) && $mybb->binary_fields[$table][$field]) { $search_bit[] = "{$field} = ".$replacements[$field];
|
} else {
|
} else {
|
return $this->update_query($table, $replacements, "{$main_field}=".$this->quote_val($replacements[$main_field]));
| $search_bit[] = "{$field} = ".$this->quote_val($replacements[$field]);
|
}
|
}
|
| } $search_bit = implode(" AND ", $search_bit); $query = $this->write_query("SELECT COUNT(".$main_field[0].") as count FROM {$this->table_prefix}{$table} WHERE {$search_bit} LIMIT 1"); if($this->fetch_field($query, "count") == 1) { $update = true; }
if($update === true) { return $this->update_query($table, $replacements, $search_bit);
|
} else {
| } else {
|