$special_chars = ''; $data = $vrow[$field['Field']]; } elseif ($field['True_Type'] == 'bit') { $special_chars = PMA_printableBitValue($vrow[$field['Field']], $extracted_columnspec['spec_in_brackets']); } elseif (in_array($field['True_Type'], $gis_data_types)) { // Convert gis data to Well Know Text format $vrow[$field['Field']] = PMA_asWKT($vrow[$field['Field']], true); $special_chars = htmlspecialchars($vrow[$field['Field']]); } else { // special binary "characters" if ($field['is_binary'] || $field['is_blob'] && !$cfg['ProtectBinary']) { if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && $cfg['ShowFunctionFields']) { $vrow[$field['Field']] = bin2hex($vrow[$field['Field']]); $field['display_binary_as_hex'] = true; } else { $vrow[$field['Field']] = PMA_replaceBinaryContents($vrow[$field['Field']]); } } // end if $special_chars = htmlspecialchars($vrow[$field['Field']]); //We need to duplicate the first \n or otherwise we will lose //the first newline entered in a VARCHAR or TEXT column $special_chars_encoded = PMA_duplicateFirstNewline($special_chars); $data = $vrow[$field['Field']]; } // end if... else... //when copying row, it is useful to empty auto-increment column to prevent duplicate key error if (isset($default_action) && $default_action === 'insert') { if ($field['Key'] === 'PRI' && strpos($field['Extra'], 'auto_increment') !== false) { $data = $special_chars_encoded = $special_chars = null; }
/** * Verifies what to do with non-printable contents (binary or BLOB) * in Browse mode. * * @param string $category BLOB|BINARY|GEOMETRY * @param string $content the binary content * @param string $transform_function transformation function * @param string $transform_options transformation parameters * @param string $default_function default transformation function * @param object $meta the meta-information about this field * @param array $url_params parameters that should go to the download link * * @return mixed string or float */ function PMA_handle_non_printable_contents($category, $content, $transform_function, $transform_options, $default_function, $meta, $url_params = array()) { $result = '[' . $category; if (is_null($content)) { $result .= ' - NULL'; $size = 0; } elseif (isset($content)) { $size = strlen($content); $display_size = PMA_formatByteDown($size, 3, 1); $result .= ' - ' . $display_size[0] . ' ' . $display_size[1]; } $result .= ']'; if (strpos($transform_function, 'octetstream')) { $result = $content; } if ($size > 0) { if ($default_function != $transform_function) { $result = $transform_function($result, $transform_options, $meta); } else { $result = $default_function($result, array(), $meta); if (stristr($meta->type, 'BLOB') && $_SESSION['tmp_user_values']['display_blob']) { // in this case, restart from the original $content $result = htmlspecialchars(PMA_replaceBinaryContents($content)); } /* Create link to download */ if (count($url_params) > 0) { $result = '<a href="tbl_get_field.php' . PMA_generate_common_url($url_params) . '">' . $result . '</a>'; } } } return $result; }