improved binary fields protection
This commit is contained in:
@@ -12,6 +12,9 @@ $Source$
|
||||
* db_readdump.php3 has been renamed to read_dump.php3.
|
||||
* lang/italian.inc.php3: updated thanks to
|
||||
Pietro Danesi <danone at aruba.it>.
|
||||
* config.lib.php3, lines 100-104; libraries/common.lib.php3, lines 55-56;
|
||||
Documentation.html, lines 446-451; tbl_change.php3: improved binay fields
|
||||
protection.
|
||||
|
||||
2001-09-07 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||
* main.php3, line 208: fixed an invalid link id.
|
||||
|
@@ -443,8 +443,12 @@
|
||||
|
||||
<dt><b>$cfgProtectBlob </b>boolean</dt>
|
||||
<dd>
|
||||
Defines whether <tt>BLOB</tt> fields are protected from edition when
|
||||
browsing a table's content or not.
|
||||
Defines whether <tt>BLOB</tt> or <tt>BINARY</tt> fields are protected
|
||||
from edition when browsing a table's content or not.
|
||||
Valid values are:<br />
|
||||
- <tt>FALSE</tt> to allow edition of all fields;
|
||||
- <tt>blob</tt> to allow edition of all fields except <tt>BLOBS</TT>;
|
||||
- <tt>all</tt> to disallow edition of all <tt>BINARY</tt> or <tt>BLOB</tt> fields.
|
||||
<br /><br />
|
||||
</dd>
|
||||
|
||||
|
@@ -97,7 +97,11 @@ unset($cfgServers[0]);
|
||||
$cfgConfirm = TRUE; // confirm 'DROP TABLE' & 'DROP DATABASE'
|
||||
$cfgPersistentConnections = FALSE; // use persistent connections to MySQL database
|
||||
$cfgShowBlob = FALSE; // display blob field contents in browse mode
|
||||
$cfgProtectBlob = TRUE; // disallow editing of blob fields in edit mode
|
||||
$cfgProtectBinary = 'blob'; // disallow editing of binary fields in edit mode
|
||||
// valid values are:
|
||||
// FALSE allow editing
|
||||
// 'blob' allow editing except for BLOB fields
|
||||
// 'all' disallow editing
|
||||
$cfgAllowUserDropDatabase = FALSE; // disallow users to delete their own database
|
||||
$cfgShowSQL = TRUE; // show SQL queries as run
|
||||
$cfgSkipLockedTables = FALSE; // mark used tables, make possible to show
|
||||
|
@@ -47,13 +47,13 @@ if (!defined('__LIB_COMMON__')){
|
||||
* Avoids undefined variables in PHP3
|
||||
*/
|
||||
if (!isset($use_backquotes)) {
|
||||
$use_backquotes = 0;
|
||||
$use_backquotes = 0;
|
||||
}
|
||||
if (!isset($pos)) {
|
||||
$pos = 0;
|
||||
$pos = 0;
|
||||
}
|
||||
if (!isset($cfgProtectBlob)) {
|
||||
$cfgProtectBlob = FALSE;
|
||||
if (!isset($cfgProtectBinary)) {
|
||||
$cfgProtectBinary = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -88,6 +88,8 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
echo "\n";
|
||||
|
||||
// The type column
|
||||
$is_binary = eregi(' binary', $row_table_def['Type']);
|
||||
$is_blob = eregi('blob', $row_table_def['Type']);
|
||||
$row_table_def['True_Type'] = ereg_replace('\\(.*', '', $row_table_def['Type']);
|
||||
switch ($row_table_def['True_Type']) {
|
||||
case 'set':
|
||||
@@ -129,9 +131,9 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
// Note: from the MySQL manual: "BINARY doesn't affect how the column is
|
||||
// stored or retrieved" so it does not mean that the contents is
|
||||
// binary
|
||||
if (strstr($row_table_def['True_Type'], 'blob')
|
||||
&& !empty($data)
|
||||
&& $cfgProtectBlob == TRUE) {
|
||||
if ((($cfgProtectBinary && $is_blob)
|
||||
|| ($cfgProtectBinary == 'all' && $is_binary))
|
||||
&& !empty($data)) {
|
||||
echo ' <td align="center">' . $strBinary . '</td>' . "\n";
|
||||
} else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) {
|
||||
echo ' <td align="center">--</td>' . "\n";
|
||||
@@ -303,15 +305,16 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
}
|
||||
// Change by Bernard M. Piller <bernard@bmpsystems.com>
|
||||
// We don't want binary data destroyed
|
||||
else if (strstr($row_table_def['Type'], 'blob')) {
|
||||
if ($cfgProtectBlob == TRUE) {
|
||||
else if ($is_binary || $is_blob) {
|
||||
if (($cfgProtectBinary && $is_blob)
|
||||
|| ($cfgProtectBinary == 'all' && $is_binary)) {
|
||||
echo "\n";
|
||||
?>
|
||||
<td align="center">
|
||||
<?php echo $strBinaryDoNotEdit . "\n"; ?>
|
||||
</td>
|
||||
<?php
|
||||
} else {
|
||||
} else if ($is_blob) {
|
||||
echo "\n";
|
||||
?>
|
||||
<td>
|
||||
@@ -319,7 +322,21 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
<textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfgTextareaRows; ?>" cols="<?php echo $cfgTextareaCols; ?>"><?php if (!empty($special_chars)) echo $special_chars; ?></textarea>
|
||||
</td>
|
||||
<?php
|
||||
} // end if...else
|
||||
} else {
|
||||
if ($len < 4) {
|
||||
$fieldsize = $maxlength = 4;
|
||||
} else {
|
||||
$fieldsize = $len;
|
||||
$maxlength = (($len > 40) ? 40 : $len);
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
<td>
|
||||
<?php echo $backup_field . "\n"; ?>
|
||||
<input type="text" name="fields[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $maxlength; ?>" />
|
||||
</td>
|
||||
<?php
|
||||
} // end if...elseif...else
|
||||
} // end else if
|
||||
else {
|
||||
if ($len < 4) {
|
||||
|
Reference in New Issue
Block a user