patch #515268 - Feature Request #511816 (enable/disable functions fields) thanks to Alexander M. Turek
This commit is contained in:
@@ -24,6 +24,10 @@ $Source$
|
||||
with <base href=""> thanks to Alexander M. Turek.
|
||||
* main.php3, lines 11-14; libraries/grab_globals.lib.php3, lines 27-32;
|
||||
libraries/auth/cookie.auth.lib.php3: improved patch #495360.
|
||||
* config.inc.php3, lines 142 & 238-265; Documentation.html, lines 746-752;
|
||||
tbl_change.php3; libraries/common.lib.php3, lines 105-107:
|
||||
patch #515268 - Feature Request #511816 (enable/disable functions fields)
|
||||
thanks to Alexander M. Turek <rabus at users.sourceforge.net>.
|
||||
|
||||
2002-02-08 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* ukrainian updates thanks to Markijan Baran.
|
||||
|
@@ -732,7 +732,7 @@
|
||||
<br /><br />
|
||||
</dd>
|
||||
|
||||
<dt><b>$cfgProtectBinary </b>boolean</dt>
|
||||
<dt><b>$cfgProtectBinary </b>boolean or string</dt>
|
||||
<dd>
|
||||
Defines whether <tt>BLOB</tt> or <tt>BINARY</tt> fields are protected
|
||||
from edition when browsing a table's content or not.
|
||||
@@ -743,6 +743,13 @@
|
||||
<br /><br />
|
||||
</dd>
|
||||
|
||||
<dt><b>$cfgShowFunctionFields </b>boolean</dt>
|
||||
<dd>
|
||||
Defines whether MySQL functions fields should be displayed or not in edit/insert
|
||||
mode.
|
||||
<br /><br />
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<b>$cfgZipDump </b>boolean<br />
|
||||
<b>$cfgGZipDump </b>boolean<br />
|
||||
|
@@ -139,6 +139,7 @@ $cfgProtectBinary = 'blob'; // disallow editing of binary fields
|
||||
// FALSE allow editing
|
||||
// 'blob' allow editing except for BLOB fields
|
||||
// 'all' disallow editing
|
||||
$cfgShowFunctionFields = TRUE; // Display the function fields in edit/insert mode
|
||||
|
||||
$cfgZipDump = TRUE; // Allow the use of zip/gzip/bzip
|
||||
$cfgGZipDump = TRUE; // compression for
|
||||
@@ -234,32 +235,34 @@ $cfgAttributeTypes = array(
|
||||
);
|
||||
|
||||
// Available functions
|
||||
$cfgFunctions = array(
|
||||
'ASCII',
|
||||
'CHAR',
|
||||
'SOUNDEX',
|
||||
'LCASE',
|
||||
'UCASE',
|
||||
'NOW',
|
||||
'PASSWORD',
|
||||
'MD5',
|
||||
'ENCRYPT',
|
||||
'RAND',
|
||||
'LAST_INSERT_ID',
|
||||
'COUNT',
|
||||
'AVG',
|
||||
'SUM',
|
||||
'CURDATE',
|
||||
'CURTIME',
|
||||
'FROM_DAYS',
|
||||
'FROM_UNIXTIME',
|
||||
'PERIOD_ADD',
|
||||
'PERIOD_DIFF',
|
||||
'TO_DAYS',
|
||||
'UNIX_TIMESTAMP',
|
||||
'USER',
|
||||
'WEEKDAY'
|
||||
);
|
||||
if ($cfgShowFunctionFields) {
|
||||
$cfgFunctions = array(
|
||||
'ASCII',
|
||||
'CHAR',
|
||||
'SOUNDEX',
|
||||
'LCASE',
|
||||
'UCASE',
|
||||
'NOW',
|
||||
'PASSWORD',
|
||||
'MD5',
|
||||
'ENCRYPT',
|
||||
'RAND',
|
||||
'LAST_INSERT_ID',
|
||||
'COUNT',
|
||||
'AVG',
|
||||
'SUM',
|
||||
'CURDATE',
|
||||
'CURTIME',
|
||||
'FROM_DAYS',
|
||||
'FROM_UNIXTIME',
|
||||
'PERIOD_ADD',
|
||||
'PERIOD_DIFF',
|
||||
'TO_DAYS',
|
||||
'UNIX_TIMESTAMP',
|
||||
'USER',
|
||||
'WEEKDAY'
|
||||
);
|
||||
} // end if
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -45,7 +45,7 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
|
||||
* - authentication work
|
||||
* - second load of the libraries/define.lib.php3 library to get the MySQL
|
||||
* release number)
|
||||
* - other functions, respecting dependencies
|
||||
* - other functions, respecting dependencies
|
||||
*/
|
||||
|
||||
|
||||
@@ -102,6 +102,9 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
|
||||
$cfgProtectBinary = 'blob';
|
||||
}
|
||||
}
|
||||
if (!isset($cfgShowFunctionFields)) {
|
||||
$cfgShowFunctionFields = TRUE;
|
||||
}
|
||||
if (!isset($cfgZipDump)) {
|
||||
$cfgZipDump = (isset($cfgGZipDump) ? $cfgGZipDump : TRUE);
|
||||
}
|
||||
@@ -200,7 +203,7 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
|
||||
$a_string = str_replace('\\', '\\\\', $a_string);
|
||||
}
|
||||
$a_string = str_replace('\'', '\\\'', $a_string);
|
||||
|
||||
|
||||
return $a_string;
|
||||
} // end of the 'PMA_sqlAddslashes()' function
|
||||
|
||||
@@ -299,7 +302,7 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
|
||||
unset($cfgServers[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($server) || !isset($cfgServers[$server]) || !is_array($cfgServers[$server])) {
|
||||
$server = $cfgServerDefault;
|
||||
}
|
||||
@@ -602,7 +605,7 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
|
||||
}
|
||||
} // end for
|
||||
mysql_free_result($dbs);
|
||||
$num_dbs = $real_num_dbs;
|
||||
$num_dbs = $real_num_dbs;
|
||||
} // end else
|
||||
|
||||
return TRUE;
|
||||
@@ -954,7 +957,7 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
|
||||
|
||||
/**
|
||||
* Ensures a database/table/field's name is not a reserved word (for MySQL
|
||||
* releases < 3.23.6)
|
||||
* releases < 3.23.6)
|
||||
*
|
||||
* @param string the name to check
|
||||
* @param string the url to go back in case of error
|
||||
@@ -972,7 +975,7 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
|
||||
if (!ereg('^[a-zA-Z_]+$', $the_name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Else do the work
|
||||
$filename = 'badwords.txt';
|
||||
if (file_exists($filename)) {
|
||||
|
@@ -142,7 +142,11 @@ echo "\n";
|
||||
<tr>
|
||||
<th><?php echo $strField; ?></th>
|
||||
<th><?php echo $strType; ?></th>
|
||||
<th><?php echo $strFunction; ?></th>
|
||||
<?php
|
||||
if ($cfgShowFunctionFields) {
|
||||
echo ' <th>' . $strFunction . '</th>' . "\n";
|
||||
}
|
||||
?>
|
||||
<th><?php echo $strNull; ?></th>
|
||||
<th><?php echo $strValue; ?></th>
|
||||
</tr>
|
||||
@@ -224,7 +228,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
? ''
|
||||
: '<input type="hidden" name="fields_prev[' . urlencode($field) . ']" value="' . urlencode($row[$field]) . '" />';
|
||||
} else {
|
||||
// loic1: display default values
|
||||
// loic1: display default values
|
||||
if (!isset($row_table_def['Default'])) {
|
||||
$row_table_def['Default'] = '';
|
||||
$data = 'NULL';
|
||||
@@ -242,40 +246,42 @@ 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 ((($cfgProtectBinary && $is_blob)
|
||||
|| ($cfgProtectBinary == 'all' && $is_binary))
|
||||
&& !empty($data)) {
|
||||
echo ' <td align="center" bgcolor="'. $bgcolor . '">' . $strBinary . '</td>' . "\n";
|
||||
} else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) {
|
||||
echo ' <td align="center" bgcolor="'. $bgcolor . '">--</td>' . "\n";
|
||||
} else {
|
||||
?>
|
||||
if ($cfgShowFunctionFields) {
|
||||
if ((($cfgProtectBinary && $is_blob)
|
||||
|| ($cfgProtectBinary == 'all' && $is_binary))
|
||||
&& !empty($data)) {
|
||||
echo ' <td align="center" bgcolor="'. $bgcolor . '">' . $strBinary . '</td>' . "\n";
|
||||
} else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) {
|
||||
echo ' <td align="center" bgcolor="'. $bgcolor . '">--</td>' . "\n";
|
||||
} else {
|
||||
?>
|
||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||
<select name="funcs[<?php echo urlencode($field); ?>]">
|
||||
<option></option>
|
||||
<?php
|
||||
echo "\n";
|
||||
if (!$first_timestamp) {
|
||||
for ($j = 0; $j < count($cfgFunctions); $j++) {
|
||||
echo ' ';
|
||||
echo '<option>' . $cfgFunctions[$j] . '</option>' . "\n";
|
||||
}
|
||||
} else {
|
||||
<?php
|
||||
echo "\n";
|
||||
if (!$first_timestamp) {
|
||||
for ($j = 0; $j < count($cfgFunctions); $j++) {
|
||||
echo ' ';
|
||||
echo '<option>' . $cfgFunctions[$j] . '</option>' . "\n";
|
||||
}
|
||||
} else {
|
||||
// for default function = NOW() on first timestamp field
|
||||
// -- swix/18jul01
|
||||
for ($j = 0; $j < count($cfgFunctions); $j++) {
|
||||
echo ' ';
|
||||
if ($cfgFunctions[$j] == 'NOW') {
|
||||
echo '<option selected="selected">' . $cfgFunctions[$j] . '</option>' . "\n";
|
||||
} else {
|
||||
echo '<option>' . $cfgFunctions[$j] . '</option>' . "\n";
|
||||
}
|
||||
} // end for
|
||||
}
|
||||
?>
|
||||
for ($j = 0; $j < count($cfgFunctions); $j++) {
|
||||
echo ' ';
|
||||
if ($cfgFunctions[$j] == 'NOW') {
|
||||
echo '<option selected="selected">' . $cfgFunctions[$j] . '</option>' . "\n";
|
||||
} else {
|
||||
echo '<option>' . $cfgFunctions[$j] . '</option>' . "\n";
|
||||
}
|
||||
} // end for
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
@@ -350,7 +356,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
}
|
||||
echo '>' . htmlspecialchars($enum_atom) . '</option>' . "\n";
|
||||
} // end for
|
||||
|
||||
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
@@ -361,7 +367,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
// Removes automatic MySQL escape format
|
||||
$enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
|
||||
echo ' ';
|
||||
echo '<input type="radio" name="field_' . md5($field) . '[]" value="' . urlencode($enum_atom) . '"' . ' onclick="if (typeof(document.forms[\'insertForm\'].elements[\'fields_null[' . urlencode($field) . ']\']) != \'undefined\') {document.forms[\'insertForm\'].elements[\'fields_null[' . urlencode($field) .']\'].checked = false}"';
|
||||
echo '<input type="radio" name="field_' . md5($field) . '[]" value="' . urlencode($enum_atom) . '"' . ' onclick="if (typeof(document.forms[\'insertForm\'].elements[\'fields_null[' . urlencode($field) . ']\']) != \'undefined\') {document.forms[\'insertForm\'].elements[\'fields_null[' . urlencode($field) .']\'].checked = false}"';
|
||||
if ($data == $enum_atom
|
||||
|| ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
|
||||
&& isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
|
||||
|
Reference in New Issue
Block a user