Starting Import'; if (substr($docpath, strlen($docpath) - 2, 1) != '/') { $docpath = $docpath . '/'; } if (is_dir($docpath)) { // Get relation settings include('./libraries/relation.lib.php3'); $cfgRelation = PMA_getRelationsParam(); // Do the work $handle = opendir($docpath); while ($file = @readdir($handle)) { $filename = basename($file); // echo '
Working on file ' . $filename . '
'; if (strpos(' ' . $filename, '_field_comment.txt')) { $tab = substr($filename, 0, strlen($filename) - strlen('_field_comment.txt')); //echo '' . $line . '
'; $inf = explode('|',$line); if (!empty($inf[1]) && strlen(trim($inf[1])) > 0) { $qry = 'INSERT INTO ' . PMA_backquote($cfgRelation['column_comments']) . ' (db_name, table_name, column_name, ' . PMA_backquote('comment') . ') ' . ' VALUES(' . '\'' . PMA_sqlAddslashes($db) . '\',' . '\'' . PMA_sqlAddslashes(trim($tab)) . '\',' . '\'' . PMA_sqlAddslashes(trim($inf[0])) . '\',' . '\'' . PMA_sqlAddslashes(trim($inf[1])) . '\')'; if (PMA_query_as_cu($qry)) { echo '' . $strAddedColumnComment . ' ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . '
'; } else { echo '' . $strWritingCommentNotPossible . '
'; } echo "\n"; } // end inf[1] exists if (!empty($inf[2]) && strlen(trim($inf[2])) > 0) { $for = explode('->', $inf[2]); $qry = 'INSERT INTO ' . PMA_backquote($cfgRelation['relation']) . '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)' . ' VALUES(' . '\'' . PMA_sqlAddslashes($db) . '\', ' . '\'' . PMA_sqlAddslashes(trim($tab)) . '\', ' . '\'' . PMA_sqlAddslashes(trim($inf[0])) . '\', ' . '\'' . PMA_sqlAddslashes($db) . '\', ' . '\'' . PMA_sqlAddslashes(trim($for[0])) . '\',' . '\'' . PMA_sqlAddslashes(trim($for[1])) . '\')'; if (PMA_query_as_cu($qry)) { echo '' . $strAddedColumnRelation . ' ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . ' to ' . htmlspecialchars($for) . '
'; } else { echo '' . $strWritingRelationNotPossible . '
'; } echo "\n"; } // end inf[2] exists } echo '' . $strImportFinished . '
' . "\n"; } else { echo '' . $strFileCouldNotBeRead . '
' . "\n"; } } else { echo '' . sprintf($strIgnoringFile, ' ' . $file) . '
' . "\n"; } // end working on table } // end while } else { echo $strThisNotDirectory . "\n"; } } /** * Try to get the "$DOCUMENT_ROOT" variable whatever is the register_globals * value */ if (empty($DOCUMENT_ROOT)) { if (!empty($_SERVER) && isset($_SERVER['DOCUMENT_ROOT'])) { $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT']; } else if (!empty($HTTP_SERVER_VARS) && isset($HTTP_SERVER_VARS['DOCUMENT_ROOT'])) { $DOCUMENT_ROOT = $HTTP_SERVER_VARS['DOCUMENT_ROOT']; } else if (!empty($_ENV) && isset($_ENV['DOCUMENT_ROOT'])) { $DOCUMENT_ROOT = $_ENV['DOCUMENT_ROOT']; } else if (!empty($HTTP_ENV_VARS) && isset($HTTP_ENV_VARS['DOCUMENT_ROOT'])) { $DOCUMENT_ROOT = $HTTP_ENV_VARS['DOCUMENT_ROOT']; } else if (@getenv('DOCUMENT_ROOT')) { $DOCUMENT_ROOT = getenv('DOCUMENT_ROOT'); } else { $DOCUMENT_ROOT = ''; } } // end if /** * Displays the form */ ?>