return also works for includes ... so don't mess with intends

This commit is contained in:
Sebastian Mendel
2007-03-29 11:45:12 +00:00
parent adc43110f6
commit 02ecd621bb
4 changed files with 675 additions and 661 deletions

View File

@@ -10,7 +10,10 @@
/**
*
*/
if ($plugin_param == 'table') {
if ($plugin_param !== 'table') {
return;
}
if (isset($plugin_list)) {
$plugin_list['csv'] = array(
'text' => 'strCSV',
@@ -26,8 +29,10 @@ if ($plugin_param == 'table') {
),
'options_text' => 'strCSVImportOptions',
);
} else {
/* We do not define function when plugin is just queried for information above */
return;
}
$replacements = array(
'\\n' => "\n",
'\\t' => "\t",
@@ -304,6 +309,4 @@ if ($plugin_param == 'table') {
$show_error_header = TRUE;
$error = TRUE;
}
}
}
?>

View File

@@ -6,10 +6,16 @@
* @version $Id$
*/
$cfgRelation = PMA_getRelationsParam();
/**
* We need relations enabled and we work only on database
*/
if ($plugin_param == 'database' && $GLOBALS['num_tables'] > 0 && $GLOBALS['cfgRelation']['relwork'] && $GLOBALS['cfgRelation']['commwork']) {
if ($plugin_param !== 'database' || $GLOBALS['num_tables'] < 1
|| ! $cfgRelation['relwork'] || ! $cfgRelation['commwork']) {
return;
}
if (isset($plugin_list)) {
$plugin_list['docsql'] = array( // set name of your plugin
'text' => 'strDocSQL', // text to be displayed as choice
@@ -19,8 +25,10 @@ if ($plugin_param == 'database' && $GLOBALS['num_tables'] > 0 && $GLOBALS['cfgRe
),
'options_text' => 'strDocSQLOptions', // text to describe plugin options (must be set if options are used)
);
} else {
/* We do not define function when plugin is just queried for information above */
return;
}
$tab = $_POST['docsql_table'];
$buffer = '';
/* Read whole buffer, we except it is small enough */
@@ -48,7 +56,7 @@ if ($plugin_param == 'database' && $GLOBALS['num_tables'] > 0 && $GLOBALS['cfgRe
if (!empty($inf[1]) && strlen(trim($inf[1])) > 0) {
$qry = '
INSERT INTO
' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['column_info']) . '
' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
( db_name, table_name, column_name, ' . PMA_backquote('comment') . ' )
VALUES (
\'' . PMA_sqlAddslashes($GLOBALS['db']) . '\',
@@ -61,7 +69,7 @@ if ($plugin_param == 'database' && $GLOBALS['num_tables'] > 0 && $GLOBALS['cfgRe
$for = explode('->', $inf[2]);
$qry = '
INSERT INTO
' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['relation']) . '
' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['relation']) . '
( master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)
VALUES (
\'' . PMA_sqlAddslashes($GLOBALS['db']) . '\',
@@ -76,6 +84,4 @@ if ($plugin_param == 'database' && $GLOBALS['num_tables'] > 0 && $GLOBALS['cfgRe
} // End import
// Commit any possible data in buffers
PMA_importRunQuery();
}
}
?>

View File

@@ -9,7 +9,10 @@
/**
*
*/
if ($plugin_param == 'table') {
if ($plugin_param !== 'table') {
return;
}
if (isset($plugin_list)) {
if ($GLOBALS['cfg']['Import']['ldi_local_option'] == 'auto') {
$GLOBALS['cfg']['Import']['ldi_local_option'] = FALSE;
@@ -45,14 +48,18 @@ if ($plugin_param == 'table') {
),
'options_text' => 'strLDIImportOptions',
);
} else {
/* We do not define function when plugin is just queried for information above */
return;
}
if ($import_file == 'none' || $compression != 'none' || $charset_conversion) {
// We handle only some kind of data!
$message = $strInvalidLDIImport;
$show_error_header = TRUE;
$error = TRUE;
} else {
return;
}
$sql = 'LOAD DATA';
if (isset($ldi_local_option)) {
$sql .= ' LOCAL';
@@ -100,8 +107,4 @@ if ($plugin_param == 'table') {
PMA_importRunQuery($sql, $sql);
PMA_importRunQuery();
$finished = TRUE;
}
}
}
?>

View File

@@ -25,8 +25,11 @@ if (isset($plugin_list)) {
array('type' => 'select', 'name' => 'compatibility', 'text' => 'strSQLCompatibility', 'values' => $values, 'doc' => array('manual_MySQL_Database_Administration', 'Server_SQL_mode'))
);
}
} else {
/* We do not define function when plugin is just queried for information above */
return;
}
$buffer = '';
// Defaults for parser
$sql = '';
@@ -260,5 +263,4 @@ if (isset($plugin_list)) {
// Commit any possible data in buffers
PMA_importRunQuery('', substr($buffer, 0, $len));
PMA_importRunQuery();
}
?>