diff --git a/ChangeLog b/ChangeLog index 7367fdf6a..54fc2ce0e 100755 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ $Source$ * db_readdump.php3 has been renamed to read_dump.php3. * lang/italian.inc.php3: updated thanks to Pietro Danesi . + * 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ïc Chapeaux * main.php3, line 208: fixed an invalid link id. diff --git a/Documentation.html b/Documentation.html index 1ef5bba4c..754b044f2 100755 --- a/Documentation.html +++ b/Documentation.html @@ -443,8 +443,12 @@
$cfgProtectBlob boolean
- Defines whether BLOB fields are protected from edition when - browsing a table's content or not. + Defines whether BLOB or BINARY fields are protected + from edition when browsing a table's content or not. + Valid values are:
+ - FALSE to allow edition of all fields; + - blob to allow edition of all fields except BLOBS; + - all to disallow edition of all BINARY or BLOB fields.

diff --git a/config.inc.php3 b/config.inc.php3 index 0f51483de..770138cc3 100755 --- a/config.inc.php3 +++ b/config.inc.php3 @@ -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 diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index 440c30c3f..d084f2f02 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -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; } diff --git a/tbl_change.php3 b/tbl_change.php3 index 5f633fef8..ef6cea8a7 100755 --- a/tbl_change.php3 +++ b/tbl_change.php3 @@ -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 ' ' . $strBinary . '' . "\n"; } else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) { echo ' --' . "\n"; @@ -303,15 +305,16 @@ for ($i = 0; $i < $fields_cnt; $i++) { } // Change by Bernard M. Piller // 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"; ?> @@ -319,7 +322,21 @@ for ($i = 0; $i < $fields_cnt; $i++) { 40) ? 40 : $len); + } + echo "\n"; + ?> + + + + +