improved binary fields protection
This commit is contained in:
@@ -12,6 +12,9 @@ $Source$
|
|||||||
* db_readdump.php3 has been renamed to read_dump.php3.
|
* db_readdump.php3 has been renamed to read_dump.php3.
|
||||||
* lang/italian.inc.php3: updated thanks to
|
* lang/italian.inc.php3: updated thanks to
|
||||||
Pietro Danesi <danone at aruba.it>.
|
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>
|
2001-09-07 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||||
* main.php3, line 208: fixed an invalid link id.
|
* main.php3, line 208: fixed an invalid link id.
|
||||||
|
@@ -443,8 +443,12 @@
|
|||||||
|
|
||||||
<dt><b>$cfgProtectBlob </b>boolean</dt>
|
<dt><b>$cfgProtectBlob </b>boolean</dt>
|
||||||
<dd>
|
<dd>
|
||||||
Defines whether <tt>BLOB</tt> fields are protected from edition when
|
Defines whether <tt>BLOB</tt> or <tt>BINARY</tt> fields are protected
|
||||||
browsing a table's content or not.
|
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 />
|
<br /><br />
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
@@ -97,7 +97,11 @@ unset($cfgServers[0]);
|
|||||||
$cfgConfirm = TRUE; // confirm 'DROP TABLE' & 'DROP DATABASE'
|
$cfgConfirm = TRUE; // confirm 'DROP TABLE' & 'DROP DATABASE'
|
||||||
$cfgPersistentConnections = FALSE; // use persistent connections to MySQL database
|
$cfgPersistentConnections = FALSE; // use persistent connections to MySQL database
|
||||||
$cfgShowBlob = FALSE; // display blob field contents in browse mode
|
$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
|
$cfgAllowUserDropDatabase = FALSE; // disallow users to delete their own database
|
||||||
$cfgShowSQL = TRUE; // show SQL queries as run
|
$cfgShowSQL = TRUE; // show SQL queries as run
|
||||||
$cfgSkipLockedTables = FALSE; // mark used tables, make possible to show
|
$cfgSkipLockedTables = FALSE; // mark used tables, make possible to show
|
||||||
|
@@ -47,13 +47,13 @@ if (!defined('__LIB_COMMON__')){
|
|||||||
* Avoids undefined variables in PHP3
|
* Avoids undefined variables in PHP3
|
||||||
*/
|
*/
|
||||||
if (!isset($use_backquotes)) {
|
if (!isset($use_backquotes)) {
|
||||||
$use_backquotes = 0;
|
$use_backquotes = 0;
|
||||||
}
|
}
|
||||||
if (!isset($pos)) {
|
if (!isset($pos)) {
|
||||||
$pos = 0;
|
$pos = 0;
|
||||||
}
|
}
|
||||||
if (!isset($cfgProtectBlob)) {
|
if (!isset($cfgProtectBinary)) {
|
||||||
$cfgProtectBlob = FALSE;
|
$cfgProtectBinary = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -88,6 +88,8 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
// The type column
|
// 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']);
|
$row_table_def['True_Type'] = ereg_replace('\\(.*', '', $row_table_def['Type']);
|
||||||
switch ($row_table_def['True_Type']) {
|
switch ($row_table_def['True_Type']) {
|
||||||
case 'set':
|
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
|
// 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
|
// stored or retrieved" so it does not mean that the contents is
|
||||||
// binary
|
// binary
|
||||||
if (strstr($row_table_def['True_Type'], 'blob')
|
if ((($cfgProtectBinary && $is_blob)
|
||||||
&& !empty($data)
|
|| ($cfgProtectBinary == 'all' && $is_binary))
|
||||||
&& $cfgProtectBlob == TRUE) {
|
&& !empty($data)) {
|
||||||
echo ' <td align="center">' . $strBinary . '</td>' . "\n";
|
echo ' <td align="center">' . $strBinary . '</td>' . "\n";
|
||||||
} else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) {
|
} else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) {
|
||||||
echo ' <td align="center">--</td>' . "\n";
|
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>
|
// Change by Bernard M. Piller <bernard@bmpsystems.com>
|
||||||
// We don't want binary data destroyed
|
// We don't want binary data destroyed
|
||||||
else if (strstr($row_table_def['Type'], 'blob')) {
|
else if ($is_binary || $is_blob) {
|
||||||
if ($cfgProtectBlob == TRUE) {
|
if (($cfgProtectBinary && $is_blob)
|
||||||
|
|| ($cfgProtectBinary == 'all' && $is_binary)) {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
?>
|
?>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<?php echo $strBinaryDoNotEdit . "\n"; ?>
|
<?php echo $strBinaryDoNotEdit . "\n"; ?>
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else if ($is_blob) {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
?>
|
?>
|
||||||
<td>
|
<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>
|
<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>
|
</td>
|
||||||
<?php
|
<?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
|
} // end else if
|
||||||
else {
|
else {
|
||||||
if ($len < 4) {
|
if ($len < 4) {
|
||||||
|
Reference in New Issue
Block a user