For Lo�c: Coding standards

This commit is contained in:
Alexander M. Turek
2002-08-21 09:30:53 +00:00
parent 73ce610905
commit 7184bb81c8
12 changed files with 179 additions and 164 deletions

View File

@@ -5,6 +5,12 @@ phpMyAdmin - Changelog
$Id$
$Source$
2002-08-21 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* config.inc.php3, db_details.php3, db_details_export.php3,
db_details_qbe.php3, Documentation.html, ldi_check.php3, ldi_table.php3,
tbl_dump.php3, tbl_properties_export.php3, tbl_query_box.php3,
libraries/charset_conversion.lib.php3: Coding standards.
2002-08-21 Michal Cihar <nijel@users.sourceforge.net>
* libraries/common.lib.php3: revised to fit coding standards (by Lo<4C>c) and
added documentation about parameters for PMA_showMySQLDocu()

View File

@@ -1141,7 +1141,8 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
<dt><b>$cfg['MySQLManualBase']</b> string</dt>
<dd>
If set to an URL which points to the MySQL documentation (type depends
on $cfg['MySQLManualType']), appropriate help links are generated.
on <tt>$cfg['MySQLManualType']</tt>), appropriate help links are
generated.
<br />
See <a href="http://www.mysql.com/documentation/index.html">MySQL
Documentation page</a> for more information about MySQL manuals and
@@ -1154,9 +1155,9 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
Type of MySQL documentation:
<ul>
<li>old - old style used in phpMyAdmin 2.3.0 and sooner</li>
<li>searchable - "Searchable, with user comments"</li>
<li>chapters - "HTML, one page per chapter"</li>
<li>big - "HTML, all on one page"</li>
<li>searchable - &quot;Searchable, with user comments&quot;</li>
<li>chapters - &quot;HTML, one page per chapter&quot;</li>
<li>big - &quot;HTML, all on one page&quot;</li>
<li>none - do not show documentation links</li>
</ul>
<br /><br />
@@ -1200,7 +1201,8 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
<dt><b>$cfg['RecodingEngine'] </b>string</dt>
<dd>
You can select here which functions will be used for charset conversion.
You can select here which functions will be used for charset
conversion.
Possible values are:<br />
<ul>
<li>auto - automatically use available one (first is tested
@@ -1209,6 +1211,7 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
<li>recode - use recode_string function</li>
</ul>
Default is auto.
<br /><br />
</dd>
<dt><b>$cfg['AvailableCharsets'] </b>array</dt>
@@ -1303,8 +1306,8 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
<b>$cfg['TextareaAutoSelect'] </b>boolean<br />
</dt>
<dd>
Defines if the whole textarea of the query box will be selected
on click.
Defines if the whole textarea of the query box will be selected on
click.
<br /><br />
</dd>
@@ -2118,7 +2121,7 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
<p>
<b>[6.5] How can I restore (upload) my database or table using a dump?
How can I run a &quot;.sql&quot; file?</b>
How can I run a &quot;.sql&quot; file?</b>
<br />
Click on a database name in the left frame, the properties will be
local displayed. Then in the &quot;Run SQL query&quot; section, type in

View File

@@ -234,11 +234,11 @@ $cfg['MySQLManualBase'] = 'http://www.mysql.com/doc/en';
/**
* Type of MySQL documentation:
* old - old style used in phpMyAdmin 2.3.0 and sooner
* old - old style used in phpMyAdmin 2.3.0 and sooner
* searchable - "Searchable, with user comments"
* chapters - "HTML, one page per chapter"
* big - "HTML, all on one page"
* none - do not show documentation links
* chapters - "HTML, one page per chapter"
* big - "HTML, all on one page"
* none - do not show documentation links
*/
$cfg['MySQLManualType'] = 'searchable';

View File

@@ -45,6 +45,10 @@ $is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get'))
? ((strtolower(ini_get('file_uploads')) == 'on' || ini_get('file_uploads') == 1) && intval(ini_get('upload_max_filesize')))
// loic1: php 3.0.15 and lower bug -> always enabled
: (PMA_PHP_INT_VERSION < 30016 || intval(@get_cfg_var('upload_max_filesize')));
$auto_sel = ($cfg['TextareaAutoSelect'])
? "\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
: '';
?>
<!-- Query box, sql file loader and bookmark support -->
<a name="querybox"></a>
@@ -61,11 +65,7 @@ $is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get'))
<input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
<?php echo sprintf($strRunSQLQuery, $db) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT'); ?>&nbsp;:<br />
<div style="margin-bottom: 5px">
<textarea name="sql_query" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" rows="<?php echo $cfg['TextareaRows']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"<?php
if ($cfg['TextareaAutoSelect']) {
echo "\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"';
}
?>>
<textarea name="sql_query" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" rows="<?php echo $cfg['TextareaRows']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>>
<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?>
</textarea><br />
<input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" />&nbsp;

View File

@@ -108,28 +108,28 @@ echo "\n";
<td<?php echo $colspan; ?>>
<input type="checkbox" name="asfile" value="sendit" id="checkbox_dump_asfile" onclick="return checkTransmitDump(this.form, 'transmit')" />
<label for="checkbox_dump_asfile"><?php echo $strSend; ?></label>
<?php
if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
$temp_charset = reset($cfg['AvailableCharsets']);
echo "\n, " . $strCharsetOfFile . "\n"
. ' <select name="charset_of_file" size="1">' . "\n"
. ' <option value="' . $temp_charset . '"';
<?php
// charset of file
if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
$temp_charset = reset($cfg['AvailableCharsets']);
echo "\n" . ' , ' . $strCharsetOfFile . "\n"
. ' <select name="charset_of_file" size="1">' . "\n"
. ' <option value="' . $temp_charset . '"';
if ($temp_charset == $charset) {
echo ' selected="selected"';
}
echo '>' . $temp_charset . '</option>' . "\n";
while ($temp_charset = next($cfg['AvailableCharsets'])) {
echo ' <option value="' . $temp_charset . '"';
if ($temp_charset == $charset) {
echo ' selected="selected"';
}
echo '>' . $temp_charset . '</option>' . "\n";
while ($temp_charset = next($cfg['AvailableCharsets'])) {
echo ' <option value="' . $temp_charset . '"';
if ($temp_charset == $charset) {
echo ' selected="selected"';
}
echo '>' . $temp_charset . '</option>' . "\n";
} // end while
echo ' </select>';
} // end if
echo "\n";
?>
<?php
} // end while
echo ' </select>';
} // end if
echo "\n";
// zip, gzip and bzip2 encode features
if (PMA_PHP_INT_VERSION >= 40004) {
$is_zip = (isset($cfg['ZipDump']) && $cfg['ZipDump'] && @function_exists('gzcompress'));

View File

@@ -775,15 +775,17 @@ if (isset($Field) && count($Field) > 0) {
// if there was nothing starting with '=' we have to use all we got in
// the first place
// the first place (we can't use an "&=" assignment because of PHP3
// compliance)
if (count($wheretabs) == 0) {
$wheretabs = &$where;
$wheretabs = $where;
}
// when we want the fastest SELECT Statement, it would be great
// to have one Table as $master (that is the one that will be in FROM ... contrary to the
// rest which will just show in the LEFT JOIN lines) that has a good whereclause and is
// FOREIGN table to as many tables as possible
// When we want the fastest SELECT Statement, it would be great
// to have one Table as $master (that is the one that will be in
// FROM ... contrary to the rest which will just show in the LEFT JOIN
// lines) that has a good whereclause and is FOREIGN table to as many
// tables as possible
// We will need this a few times:
$incrit = '(\'' . implode('\', \'', $alltabs) . '\')';
@@ -791,12 +793,12 @@ if (isset($Field) && count($Field) > 0) {
$rel_query = 'SELECT foreign_table AS wer, COUNT(master_table) AS hits'
. ' FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . $db . '\''
. ' AND foreign_db = \'' . $db . '\''
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND master_table IN ' . $incrit
. ' AND foreign_table IN ' . $incrit;
if (!empty($column)) {
$rel_query .= ' AND foreign_field = \'' . $column . '\'';
$rel_query .= ' AND foreign_field = \'' . PMA_sqlAddslashes($column) . '\'';
}
$rel_query .= ' GROUP BY foreign_table ORDER BY hits DESC';
$relations = PMA_query_as_cu($rel_query);
@@ -804,8 +806,9 @@ if (isset($Field) && count($Field) > 0) {
$bpm = FALSE;
while ($row = PMA_mysql_fetch_array($relations)) {
// in case we will not find any foreign table that is also in the
// where clause AND we do not find a master table later, then we
// just use the most popular foreign table (allthough chances are remote)
// where clause AND we do not find a master table later, then we
// just use the most popular foreign table (allthough chances are
// remote)
if (!isset($master)) {
$master = $row['wer'];
}
@@ -821,41 +824,42 @@ if (isset($Field) && count($Field) > 0) {
}
} // end while
// if we didn't find any best possible master at this point, then we will settle
// for the most popular master_table in the whereclause (sbpm = second best possible master ;-)
// or if that fails as well, then rather the most popular master table than the
// most popular foreign_table
// if we didn't find any best possible master at this point, then we
// will settle for the most popular master_table in the where clause
// (sbpm = second best possible master ;-) or if that fails as well,
// then rather the most popular master table than the most popular
// foreign_table
if ($bpm == FALSE) {
$sbpm = FALSE;
// easier to just save any bad master we had and use it if we do not
// find anything better
// Easier to just save any bad master we had and use it if we do
// not find anything better
if (isset($master)) {
$badmaster = $master;
unset($master);
}
$rel_query = 'SELECT master_table AS wer, COUNT(foreign_table) AS hits'
. ' FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . $db . '\''
. ' AND foreign_db = \'' . $db . '\''
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND master_table IN ' . $incrit
. ' AND foreign_table IN ' . $incrit;
if (!empty($column)) {
$rel_query .= ' AND master_field = \'' . $column . '\'';
$rel_query .= ' AND master_field = \'' . PMA_sqlAddslashes($column) . '\'';
}
$rel_query .= ' GROUP BY master_table ORDER BY hits DESC';
$relations = PMA_query_as_cu($rel_query);
$relations = PMA_query_as_cu($rel_query);
while ($row = PMA_mysql_fetch_array($relations)) {
// we want the first one (highest number of hits) or the first one
// that is in the WHERE clause
if (!isset($master)) {
$master = $row['wer'];
$master = $row['wer'];
}
if ($sbpm == FALSE) {
while (list($key, $value) = each($wheretabs)) {
if ($row['wer'] == $key) {
$master = $row['wer'];
$sbpm = TRUE;
$sbpm = TRUE;
break;
}
} // end while
@@ -863,15 +867,15 @@ if (isset($Field) && count($Field) > 0) {
}
} // end while
if (!isset($master) && isset($badmaster)) {
$master = $badmaster;
$master = $badmaster;
unset($badmaster);
}
} // end if bpm==FALSE
} // end if bpm == FALSE
// if we still don't have a master at this point we might as well
// give up ;-)
if (isset ($master) && $master != '') {
if (isset($master) && $master != '') {
$qry_from = PMA_backquote($master);
// now we want one Array that has all tablenames but master
@@ -883,20 +887,20 @@ if (isset($Field) && count($Field) > 0) {
} // end while
// everything but the first table
$incrit_s = '(\'' . implode('\', \'', $reltabs) . '\')';
$rel_query = 'SELECT *'
. ' FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . $db . '\''
. ' AND foreign_db = \'' . $db . '\'';
if($bpm == TRUE){ // which means that my $master is a foreign table
$rel_query .= ' AND master_table IN ' . $incrit_s
. ' AND foreign_table IN ' . $incrit;
$incrit_s = '(\'' . implode('\', \'', $reltabs) . '\')';
$rel_query = 'SELECT *'
. ' FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND foreign_db = \'' . PMA_sqlAddslashes($db) . '\'';
if ($bpm == TRUE) { // means that my $master is a foreign table
$rel_query .= ' AND master_table IN ' . $incrit_s
. ' AND foreign_table IN ' . $incrit;
if (!empty($column)) {
$rel_query .= ' AND foreign_field = \'' . $column . '\'';
$rel_query .= ' AND foreign_field = \'' . PMA_sqlAddslashes($column) . '\'';
}
} else {
$rel_query .= ' AND foreign_table IN ' . $incrit_s
. ' AND master_table IN ' . $incrit;
$rel_query .= ' AND foreign_table IN ' . $incrit_s
. ' AND master_table IN ' . $incrit;
if (!empty($column)) {
$rel_query .= ' AND master_field = \'' . $column . '\'';
}
@@ -912,7 +916,7 @@ if (isset($Field) && count($Field) > 0) {
PMA_mysql_select_db($db);
}
if($bpm == TRUE){ // which means that my $master is a foreign table
if ($bpm == TRUE) { // means that my $master is a foreign table
while ($row = PMA_mysql_fetch_array($relations)) {
$master_table = $row['master_table'];
if ($rel[$master_table]['mcon'] == 0) {
@@ -942,8 +946,7 @@ if (isset($Field) && count($Field) > 0) {
} // end while
}
// possibly we still don't have all - there might be some that are
// only found in relation to one of those that we
// already have
// only found in relation to one of those that we already have
if ($master != '') {
$found[] = $master;
$qry_from = PMA_backquote($master);
@@ -957,8 +960,8 @@ if (isset($Field) && count($Field) > 0) {
}
} // end while
if (count($rest) > 0) {
$incrit_d = '(\'' . implode('\', \'', $found) . '\')';
$incrit_s = '(\'' . implode('\', \'', $rest) . '\')';
$incrit_d = '(\'' . implode('\', \'', $found) . '\')';
$incrit_s = '(\'' . implode('\', \'', $rest) . '\')';
if ($bpm == TRUE) {
$from_table = 'foreign_table';
$from_field = 'foreign_field';
@@ -968,17 +971,16 @@ if (isset($Field) && count($Field) > 0) {
$from_field = 'master_field';
$to_table = 'foreign_table';
}
$rel_query = 'SELECT *'
. ' FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . $db . '\''
. ' AND foreign_db = \'' . $db . '\''
. ' AND ' . $from_table . ' IN ' . $incrit_s
. ' AND ' . $to_table . ' IN ' . $incrit_d;
$rel_query = 'SELECT *'
. ' FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND ' . $from_table . ' IN ' . $incrit_s
. ' AND ' . $to_table . ' IN ' . $incrit_d;
if (!empty($column)) {
$rel_query .= ' AND ' . $from_field . ' = \'' . $column . '\'';
$rel_query .= ' AND ' . $from_field . ' = \'' . PMA_sqlAddslashes($column) . '\'';
}
if (isset($dbh)) {
PMA_mysql_select_db($cfgRelation['db'], $dbh);
$relations = @PMA_mysql_query($rel_query, $dbh) or PMA_mysqlDie(PMA_mysql_error($dbh), $rel_query, '', $err_url_0);
@@ -1007,7 +1009,7 @@ if (isset($Field) && count($Field) > 0) {
// in extreme cases we hadn't found a master yet, so
// let's use the one we found now
if ($master == '') {
$master = $found_table;
$master = $found_table;
}
if ($other_table == $master) {
$rel[$found_table]['mcon'] = 1;

View File

@@ -36,7 +36,7 @@ if (isset($btnLDI) && ($textfile != 'none')) {
if (function_exists('PMA_kanji_file_conv')) {
$textfile = PMA_kanji_file_conv($textfile, $knjenc, isset($xkana) ? $xkana : '');
}
// Convert the file's charset if necessary
if ($cfg['AllowAnywhereRecoding'] && $allow_recoding
&& isset($charset_of_file) && $charset_of_file != $charset) {
@@ -102,7 +102,7 @@ if (isset($btnLDI) && ($textfile != 'none')) {
$sql_query = $query;
}
// Set an empty sub_part to avoid an undefined variable.
// Set an empty sub_part to avoid an undefined variable.
// We could also rename the ldi* scripts
// to tbl_properties_ldi* to improve consistency with the other sub-pages.
//

View File

@@ -26,31 +26,31 @@ require('./tbl_properties_table_info.php3');
<td><?php echo $strLocationTextfile; ?></td>
<td colspan="2"><input type="file" name="textfile" /></td>
</tr>
<?php
if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
$temp_charset = reset($cfg['AvailableCharsets']);
echo '<tr>' . "\n"
. ' <td>'.$strCharsetOfFile . "</td>\n"
. ' <td colspan="2">'. "\n"
. ' <select name="charset_of_file" size="1">' . "\n"
. ' <option value="' . $temp_charset . '"';
<?php
if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
$temp_charset = reset($cfg['AvailableCharsets']);
echo ' <tr>' . "\n"
. ' <td>' . $strCharsetOfFile . '</td>' . "\n"
. ' <td colspan="2">' . "\n"
. ' <select name="charset_of_file" size="1">' . "\n"
. ' <option value="' . $temp_charset . '"';
if ($temp_charset == $charset) {
echo ' selected="selected"';
}
echo '>' . $temp_charset . '</option>' . "\n";
while ($temp_charset = next($cfg['AvailableCharsets'])) {
echo ' <option value="' . $temp_charset . '"';
if ($temp_charset == $charset) {
echo ' selected="selected"';
}
echo '>' . $temp_charset . '</option>' . "\n";
while ($temp_charset = next($cfg['AvailableCharsets'])) {
echo ' <option value="' . $temp_charset . '"';
if ($temp_charset == $charset) {
echo ' selected="selected"';
}
echo '>' . $temp_charset . '</option>' . "\n";
} // end while
echo ' </select>' . "\n";
echo ' </td>' . "\n";
echo ' </tr>' . "\n";
} // end if
echo "\n";
?>
} // end while
echo ' </select>' . "\n";
echo ' </td>' . "\n";
echo ' </tr>';
} // end if
echo "\n";
?>
<tr>
<td><?php echo $strReplaceTable; ?></td>
<td><input type="checkbox" name="replace" value="REPLACE" id="checkbox_replace" /><?php echo $strReplace; ?></td>

View File

@@ -31,32 +31,34 @@ if (!defined('PMA_CHARSET_CONVERSION_LIB_INCLUDED')){
$suffix = '.so';
}
// Initialize configuration for default, if not set:
if (!isset($cfg['RecodingEngine'])) $cfg['RecodingEngine'] = 'auto';
// Initializes configuration for default, if not set:
if (!isset($cfg['RecodingEngine'])) {
$cfg['RecodingEngine'] = 'auto';
}
if ($cfg['RecodingEngine'] == 'recode') {
if (! @extension_loaded('recode')) {
if (!@extension_loaded('recode')) {
dl('recode' . $suffix);
if (!@extension_loaded('recode')) {
echo $strCantLoadRecodeIconv;
exit();
}
}
$PMA_recoding_engine = 'recode';
} elseif ($cfg['RecodingEngine'] == 'iconv') {
if (! @extension_loaded('iconv')) {
$PMA_recoding_engine = 'recode';
} else if ($cfg['RecodingEngine'] == 'iconv') {
if (!@extension_loaded('iconv')) {
dl('iconv' . $suffix);
if (!@extension_loaded('iconv')) {
echo $strCantLoadRecodeIconv;
exit();
}
}
$PMA_recoding_engine = 'iconv';
$PMA_recoding_engine = 'iconv';
} else {
if (@extension_loaded('iconv')) {
$PMA_recoding_engine = 'iconv';
} elseif (@extension_loaded('recode')) {
$PMA_recoding_engine = 'recode';
} else if (@extension_loaded('recode')) {
$PMA_recoding_engine = 'recode';
} else {
dl('iconv' . $suffix);
if (!@extension_loaded('iconv')) {
@@ -68,31 +70,33 @@ if (!defined('PMA_CHARSET_CONVERSION_LIB_INCLUDED')){
$PMA_recoding_engine = 'recode';
}
} else {
$PMA_recoding_engine = 'iconv';
$PMA_recoding_engine = 'iconv';
}
}
}
} // end load recode/iconv extension
define('PMA_CHARSET_NONE', 0);
define('PMA_CHARSET_ICONV', 1);
define('PMA_CHARSET_LIBICONV', 2);
define('PMA_CHARSET_RECODE', 3);
// finally detect which function will we use:
// Finally detects which function will we use:
if (isset($cfg['AllowAnywhereRecoding'])
&& $cfg['AllowAnywhereRecoding']
&& $allow_recoding) {
if (!isset($PMA_recoding_engine)) $PMA_recoding_engine = $cfg['RecodingEngine'];
if (!isset($PMA_recoding_engine)) {
$PMA_recoding_engine = $cfg['RecodingEngine'];
}
if ($PMA_recoding_engine == 'iconv') {
if (@function_exists('iconv')) {
$PMA_recoding_engine = PMA_CHARSET_ICONV;
$PMA_recoding_engine = PMA_CHARSET_ICONV;
} else if (@function_exists('libiconv')) {
$PMA_recoding_engine = PMA_CHARSET_LIBICONV;
} else {
$PMA_recoding_engine = PMA_CHARSET_NONE;
if (!isset($GLOBALS['is_header_sent'])) {
include('./header.inc.php3');
}
@@ -100,12 +104,11 @@ if (!defined('PMA_CHARSET_CONVERSION_LIB_INCLUDED')){
include('./footer.inc.php3');
exit();
}
} elseif ($PMA_recoding_engine == 'recode') {
} else if ($PMA_recoding_engine == 'recode') {
if (@function_exists('recode_string')) {
$PMA_recoding_engine = PMA_CHARSET_RECODE;
$PMA_recoding_engine = PMA_CHARSET_RECODE;
} else {
$PMA_recoding_engine = PMA_CHARSET_NONE;
if (!isset($GLOBALS['is_header_sent'])) {
include('./header.inc.php3');
@@ -116,14 +119,13 @@ if (!defined('PMA_CHARSET_CONVERSION_LIB_INCLUDED')){
}
} else {
if (@function_exists('iconv')) {
$PMA_recoding_engine = PMA_CHARSET_ICONV;
$PMA_recoding_engine = PMA_CHARSET_ICONV;
} else if (@function_exists('libiconv')) {
$PMA_recoding_engine = PMA_CHARSET_LIBICONV;
} elseif (@function_exists('recode_string')) {
$PMA_recoding_engine = PMA_CHARSET_RECODE;
$PMA_recoding_engine = PMA_CHARSET_RECODE;
} else {
$PMA_recoding_engine = PMA_CHARSET_NONE;
if (!isset($GLOBALS['is_header_sent'])) {
include('./header.inc.php3');
@@ -134,9 +136,10 @@ if (!defined('PMA_CHARSET_CONVERSION_LIB_INCLUDED')){
}
}
} else {
$PMA_recoding_engine = PMA_CHARSET_NONE;
$PMA_recoding_engine = PMA_CHARSET_NONE;
}
/**
* Converts encoding according to current settings.
*
@@ -162,7 +165,7 @@ if (!defined('PMA_CHARSET_CONVERSION_LIB_INCLUDED')){
else if (is_array($what)) {
$result = array();
reset($what);
while(list($key, $val) = each($what)) {
while (list($key, $val) = each($what)) {
if (is_string($val) || is_array($val)) {
if (is_string($key)) {
$result[PMA_convert_display_charset($key)] = PMA_convert_display_charset($val);
@@ -249,7 +252,7 @@ if (!defined('PMA_CHARSET_CONVERSION_LIB_INCLUDED')){
} // end of the "PMA_convert_charset()" function
/**
* Converts encoding of text according to pametres with detected
* Converts encoding of text according to parameters with detected
* conversion function.
*
* @param string source charset
@@ -278,8 +281,9 @@ if (!defined('PMA_CHARSET_CONVERSION_LIB_INCLUDED')){
}
} // end of the "PMA_convert_string()" function
/**
* Converts encoding of file according to pametres with detected
* Converts encoding of file according to parameters with detected
* conversion function. The old file will be unlinked and new created and
* its file name is returned.
*

View File

@@ -18,14 +18,14 @@ function PMA_myHandler($sql_insert)
if (function_exists('PMA_kanji_str_conv')) {
$sql_insert = PMA_kanji_str_conv($sql_insert, $GLOBALS['knjenc'], isset($GLOBALS['xkana']) ? $GLOBALS['xkana'] : '');
}
// Convert the charset if required.
if ($GLOBALS['cfg']['AllowAnywhereRecoding'] && $GLOBALS['allow_recoding']
&& isset($GLOBALS['charset_of_file']) && $GLOBALS['charset_of_file'] != $GLOBALS['charset']
&& (!empty($GLOBALS['asfile']))) {
$sql_insert = PMA_convert_string($GLOBALS['charset'], $GLOBALS['charset_of_file'], $sql_insert);
}
// Defines the end of line delimiter to use
$eol_dlm = (isset($GLOBALS['extended_ins']) && ($GLOBALS['current_row'] < $GLOBALS['rows_cnt']))
? ','
@@ -265,8 +265,9 @@ else {
. '#' . $crlf .$crlf;
if (function_exists('PMA_kanji_str_conv')) { // Y.Kawada
$dump_buffer .= PMA_kanji_str_conv($tcmt, $knjenc, isset($xkana) ? $xkana : '');
} elseif ($GLOBALS['cfg']['AllowAnywhereRecoding'] && $GLOBALS['allow_recoding']
// Convert the charset if required.
}
// Converts the charset if required.
else if ($GLOBALS['cfg']['AllowAnywhereRecoding'] && $GLOBALS['allow_recoding']
&& isset($GLOBALS['charset_of_file']) && $GLOBALS['charset_of_file'] != $GLOBALS['charset']
&& (!empty($GLOBALS['asfile']))) {
$dump_buffer .= PMA_convert_string($GLOBALS['charset'], $GLOBALS['charset_of_file'], $tcmt);

View File

@@ -92,28 +92,28 @@ echo "\n";
<td colspan="2" align="center">
<input type="checkbox" name="asfile" value="sendit" id="checkbox_dump_asfile" onclick="return checkTransmitDump(this.form, 'transmit')" />
<label for="checkbox_dump_asfile"><?php echo $strSend; ?></label>
<?php
if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
$temp_charset = reset($cfg['AvailableCharsets']);
echo "\n, " . $strCharsetOfFile . "\n"
. ' <select name="charset_of_file" size="1">' . "\n"
. ' <option value="' . $temp_charset . '"';
<?php
// charset of file
if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
$temp_charset = reset($cfg['AvailableCharsets']);
echo "\n" . ' , ' . $strCharsetOfFile . "\n"
. ' <select name="charset_of_file" size="1">' . "\n"
. ' <option value="' . $temp_charset . '"';
if ($temp_charset == $charset) {
echo ' selected="selected"';
}
echo '>' . $temp_charset . '</option>' . "\n";
while ($temp_charset = next($cfg['AvailableCharsets'])) {
echo ' <option value="' . $temp_charset . '"';
if ($temp_charset == $charset) {
echo ' selected="selected"';
}
echo '>' . $temp_charset . '</option>' . "\n";
while ($temp_charset = next($cfg['AvailableCharsets'])) {
echo ' <option value="' . $temp_charset . '"';
if ($temp_charset == $charset) {
echo ' selected="selected"';
}
echo '>' . $temp_charset . '</option>' . "\n";
} // end while
echo ' </select>';
} // end if
echo "\n";
?>
<?php
} // end while
echo ' </select>';
} // end if
echo "\n";
// zip, gzip and bzip2 encode features
if (PMA_PHP_INT_VERSION >= 40004) {
$is_zip = (isset($cfg['ZipDump']) && $cfg['ZipDump'] && @function_exists('gzcompress'));

View File

@@ -52,6 +52,9 @@ $is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get'))
// loic1: php 3.0.15 and lower bug -> always enabled
: (PMA_PHP_INT_VERSION < 30016 || intval(@get_cfg_var('upload_max_filesize')));
$auto_sel = ($cfg['TextareaAutoSelect'])
? "\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
: '';
?>
<!-- Query box and bookmark support -->
<li>
@@ -81,11 +84,7 @@ for ($i = 0 ; $i < $fields_cnt; $i++) {
<input type="button" name="insert" value="<?php echo($strInsert); ?>" onclick="sqlform.sql_query.value = sqlform.sql_query.value + sqlform.dummy.value" />
<br />
<div style="margin-bottom: 5px">
<textarea name="sql_query" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"<?php
if ($cfg['TextareaAutoSelect']) {
echo "\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"';
}
?>>
<textarea name="sql_query" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>>
<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE 1'); ?>
</textarea><br />
<input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" />&nbsp;