Separate operations from structure (RFE #808029).
This commit is contained in:
@@ -23,6 +23,8 @@ $Source$
|
||||
libraries/config_import.lib.php, libraries/auth/config.auth.lib.php,
|
||||
libraries/auth/cookie.auth.lib.php: Allow simple blocking of root login
|
||||
(RFE #1012971), show just Access denied in case we denied it.
|
||||
* db_operations.php, db_details_links.php, db_details_structure.php:
|
||||
Separate operations from structure (RFE #808029).
|
||||
|
||||
2004-10-19 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* libraries/database_interface.lib.php: bug #1041667, correctly
|
||||
|
@@ -76,6 +76,7 @@ echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $GLOBALS['
|
||||
echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $GLOBALS['pmaThemeImage'] . 'b_export.png" width="16" height="16" border="0" hspace="2" align="middle" alt="'.$strExport.'" />' : '') . $strExport, $lnk3, $arg3);
|
||||
echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $GLOBALS['pmaThemeImage'] . 'b_search.png" width="16" height="16" border="0" hspace="2" align="middle" alt="'.$strSearch.'" />' : '') . $strSearch, $lnk4, $arg4);
|
||||
echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $GLOBALS['pmaThemeImage'] . 's_db.png" width="16" height="16" border="0" hspace="2" align="middle" alt="'.$strQBE.'" />' : '') . $strQBE, ($num_tables > 0) ? 'db_details_qbe.php' : '', $url_query);
|
||||
echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $GLOBALS['pmaThemeImage'] . 'b_tblops.png" width="16" height="16" border="0" hspace="2" align="middle" alt="'.$strOperations.'" />' : '') . $strOperations,'db_operations.php', $url_query);
|
||||
|
||||
// Displays drop link
|
||||
if ($lnk5) {
|
||||
|
@@ -6,75 +6,6 @@ require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/mysql_charsets.lib.php');
|
||||
|
||||
/**
|
||||
* Rename database
|
||||
*/
|
||||
if (isset($db) && isset($db_rename) && $db_rename == 'true') {
|
||||
if (!isset($newname) || empty($newname)) {
|
||||
$message = $strDatabaseEmpty;
|
||||
} else {
|
||||
$local_query = 'CREATE DATABASE ' . PMA_backquote($newname) . ';';
|
||||
$sql_query = $local_query;
|
||||
PMA_DBI_query($local_query);
|
||||
$tables = PMA_DBI_get_tables($db);
|
||||
foreach ($tables as $table) {
|
||||
$local_query = 'RENAME TABLE '
|
||||
. PMA_backquote($db) . '.' . PMA_backquote($table)
|
||||
. ' TO '
|
||||
. PMA_backquote($newname) . '.' . PMA_backquote($table)
|
||||
. ';';
|
||||
$sql_query .= "\n" . $local_query;
|
||||
PMA_DBI_query($local_query);
|
||||
}
|
||||
$local_query = 'DROP DATABASE ' . PMA_backquote($db) . ';';
|
||||
$sql_query .= "\n" . $local_query;
|
||||
PMA_DBI_query($local_query);
|
||||
$reload = TRUE;
|
||||
$message = sprintf($strRenameDatabaseOK, htmlspecialchars($db), htmlspecialchars($newname));
|
||||
|
||||
/* Update relations */
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
if ($cfgRelation['commwork']) {
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' SET db_name = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
}
|
||||
if ($cfgRelation['bookmarkwork']) {
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['bookmark'])
|
||||
. ' SET dbase = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
}
|
||||
if ($cfgRelation['displaywork']) {
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['table_info'])
|
||||
. ' SET db_name = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
}
|
||||
|
||||
if ($cfgRelation['relwork']) {
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' SET foreign_db = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' SET master_db = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
}
|
||||
if ($cfgRelation['historywork']) {
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['history'])
|
||||
. ' SET db = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE db = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
}
|
||||
if ($cfgRelation['pdfwork']) {
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['table_info'])
|
||||
. ' SET db_name = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
}
|
||||
|
||||
/* Change database to be used */
|
||||
$db = $newname;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Prepares the tables list if the user where not redirected to this script
|
||||
* because there is no table in the database ($is_info is TRUE)
|
||||
@@ -147,13 +78,6 @@ function pma_TableHeader($alternate = FALSE) {
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
/**
|
||||
* Check if comments were updated
|
||||
*/
|
||||
if ($cfgRelation['commwork'] && isset($db_comment) && $db_comment == 'true') {
|
||||
PMA_SetComment($db, '', '(db_comment)', $comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the tables list
|
||||
*/
|
||||
@@ -679,228 +603,8 @@ echo ' ' . '<input type="text" name="num_fields" size="2" class="tex
|
||||
echo ' </td>';
|
||||
echo ' <td align="right">';
|
||||
echo ' ' . ' <input type="submit" value="' . $strGo . '" />' . "\n";
|
||||
?>
|
||||
</td> </tr>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
if ($cfgRelation['commwork']) {
|
||||
?>
|
||||
<!-- Alter/Enter db-comment -->
|
||||
<tr><td colspan="3"><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td></tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="3" class="tblHeaders"><?php
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 'b_comment.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
}
|
||||
echo $strDBComment;
|
||||
?></td></tr>
|
||||
<form method="post" action="db_details_structure.php">
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<td colspan="2" nowrap="nowrap">
|
||||
<input type="hidden" name="db_comment" value="true" />
|
||||
<?php echo PMA_generate_common_hidden_inputs($db); ?>
|
||||
<input type="text" name="comment" class="textfield" size="30" value="<?php echo (isset($comment) && is_array($comment) ? htmlspecialchars(implode(' ', $comment)) : ''); ?>" /></td><td align="right">
|
||||
<input type="submit" value="<?php echo $strGo; ?>" />
|
||||
</td></tr>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<!-- Rename database -->
|
||||
<tr><td colspan="3"><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td></tr>
|
||||
<tr><td colspan="3" class="tblHeaders"><?php
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 'b_edit.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
}
|
||||
echo $strDBRename.': ';
|
||||
?></td></tr>
|
||||
<form method="post" action="db_details_structure.php"
|
||||
onsubmit="return emptyFormElements(this, 'newname')">
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>"><td colspan="2"><?php
|
||||
echo '<input type="hidden" name="db_rename" value="true" />'
|
||||
. PMA_generate_common_hidden_inputs($db);
|
||||
?><input type="text" name="newname" size="30" class="textfield" value="" /></td>
|
||||
<td align="right"><input type="submit" value="<?php echo $strGo; ?>" /></td>
|
||||
</form></tr>
|
||||
|
||||
<?php
|
||||
|
||||
if (PMA_MYSQL_INT_VERSION >= 40101) {
|
||||
// MySQL supports setting default charsets / collations for databases since
|
||||
// version 4.1.1.
|
||||
echo ' <!-- Change database charset -->' . "\n"
|
||||
. ' <tr><td colspan="3"><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n"
|
||||
. ' <tr><td colspan="3" class="tblHeaders">';
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 's_asci.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
}
|
||||
echo ' <label for="select_db_collation">' . $strCollation . '</label>: ' . "\n"
|
||||
. ' </td></tr>' . "\n"
|
||||
. ' <form method="post" action="./db_details_structure.php">' . "\n"
|
||||
. ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2" nowrap="nowrap">'
|
||||
. PMA_generate_common_hidden_inputs($db, $table, 3)
|
||||
. PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', 'select_db_collation', $db_collation, FALSE, 3)
|
||||
. ' </td><td align="right">'
|
||||
. ' <input type="submit" name="submitcollation" value="' . $strGo . '" style="vertical-align: middle" />' . "\n"
|
||||
. ' </td></tr>' . "\n"
|
||||
. ' </form>' . "\n"
|
||||
. ' ' . "\n\n";
|
||||
}
|
||||
|
||||
if ($num_tables > 0
|
||||
&& !$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == FALSE) {
|
||||
echo '<tr><td colspan="3"><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>'
|
||||
. '<tr><th colspan="3" class="tblHeadError"><div class="errorhead">' . $strError . '</div></th></tr>'
|
||||
. '<tr><td colspan="3" class="tblError">'
|
||||
. sprintf(wordwrap($strRelationNotWorking,65,'<br />'), '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $url_query . '">', '</a>')
|
||||
. '</td></tr>';
|
||||
} // end if
|
||||
?>
|
||||
</table>
|
||||
|
||||
<form method="post" action="pdf_schema.php">
|
||||
<?php
|
||||
// is this OK to check for 'class' support?
|
||||
if ($num_tables > 0) {
|
||||
$takeaway = $url_query . '&table=' . urlencode($table);
|
||||
}
|
||||
|
||||
if (($cfgRelation['pdfwork'] && $num_tables > 0) ||
|
||||
($num_tables > 0
|
||||
&& $cfgRelation['relwork'] && $cfgRelation['commwork']
|
||||
&& isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])
|
||||
)) { ?>
|
||||
<hr /><table border="0" cellpadding="2" cellspacing="0">
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?>
|
||||
<!-- Work on PDF Pages -->
|
||||
<tr>
|
||||
<td colspan="3" class="tblHeaders">
|
||||
<?php
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 'b_pdfdoc.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
} ?>PDF</td>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<td colspan="3">
|
||||
<?php
|
||||
echo '<a href="pdf_pages.php?' . $takeaway . '">';
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 'b_edit.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
}
|
||||
echo ''. $strEditPDFPages . '</a>';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- PDF schema -->
|
||||
<?php
|
||||
// We only show this if we find something in the new pdf_pages table
|
||||
|
||||
$test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$test_rs = PMA_query_as_cu($test_query, NULL, PMA_DBI_QUERY_STORE);
|
||||
|
||||
if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) { ?>
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">
|
||||
<td colspan="3">
|
||||
<?php
|
||||
echo PMA_generate_common_hidden_inputs($db);
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 'b_view.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
}
|
||||
echo $strDisplayPDF; ?>:
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">
|
||||
<td width="20"> </td>
|
||||
<td colspan="2">
|
||||
<label for="pdf_page_number_opt"><?php echo $strPageNumber; ?></label>
|
||||
<select name="pdf_page_number" id="pdf_page_number_opt">
|
||||
<?php
|
||||
while ($pages = @PMA_DBI_fetch_assoc($test_rs)) {
|
||||
echo ' <option value="' . $pages['page_nr'] . '">' . $pages['page_nr'] . ': ' . $pages['page_descr'] . '</option>' . "\n";
|
||||
} // end while
|
||||
PMA_DBI_free_result($test_rs);
|
||||
unset($test_rs);
|
||||
?>
|
||||
</select><br />
|
||||
|
||||
<input type="checkbox" name="show_grid" id="show_grid_opt" /><label for="show_grid_opt"><?php echo $strShowGrid; ?></label><br />
|
||||
<input type="checkbox" name="show_color" id="show_color_opt" checked="checked" /><label for="show_color_opt"><?php echo $strShowColor; ?></label><br />
|
||||
<input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" /><label for="show_table_dim_opt"><?php echo $strShowTableDimension; ?></label><br />
|
||||
<input type="checkbox" name="all_tab_same_wide" id="all_tab_same_wide" /><label for="all_tab_same_wide"><?php echo $strAllTableSameWidth; ?></label><br />
|
||||
<input type="checkbox" name="with_doc" id="with_doc" checked="checked" /><label for="with_doc"><?php echo $strDataDict; ?></label><br />
|
||||
|
||||
<label for="orientation_opt"><?php echo $strShowDatadictAs; ?></label>
|
||||
<select name="orientation" id="orientation_opt">
|
||||
<option value="L"><?php echo $strLandscape;?></option>
|
||||
<option value="P"><?php echo $strPortrait;?></option>
|
||||
</select><br />
|
||||
|
||||
<label for="paper_opt"><?php echo $strPaperSize; ?></label>
|
||||
<select name="paper" id="paper_opt">
|
||||
<?php
|
||||
foreach ($cfg['PDFPageSizes'] AS $key => $val) {
|
||||
echo '<option value="' . $val . '"';
|
||||
if ($val == $cfg['PDFDefaultPageSize']) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo ' >' . $val . '</option>' . "\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">
|
||||
<td width="20"> </td>
|
||||
<td colspan="3" align="right"> <input type="submit" value="<?php echo $strGo; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end if
|
||||
} // end if
|
||||
|
||||
if ($num_tables > 0
|
||||
&& $cfgRelation['relwork'] && $cfgRelation['commwork']
|
||||
&& isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])
|
||||
) {
|
||||
?>
|
||||
<!-- import docSQL files -->
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<td colspan="3">
|
||||
<?php
|
||||
echo '<a href="db_details_importdocsql.php?' . $takeaway . '">';
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 'b_docsql.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
}
|
||||
echo $strImportDocSQL . '</a>';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
if (($cfgRelation['pdfwork'] && $num_tables > 0) ||
|
||||
($num_tables > 0
|
||||
&& $cfgRelation['relwork'] && $cfgRelation['commwork']
|
||||
&& isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])
|
||||
)) { ?>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
echo ' </td> </tr>';
|
||||
echo ' </form>';
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
|
333
db_operations.php
Normal file
333
db_operations.php
Normal file
@@ -0,0 +1,333 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/mysql_charsets.lib.php');
|
||||
|
||||
/**
|
||||
* Rename database
|
||||
*/
|
||||
if (isset($db) && isset($db_rename) && $db_rename == 'true') {
|
||||
if (!isset($newname) || empty($newname)) {
|
||||
$message = $strDatabaseEmpty;
|
||||
} else {
|
||||
$local_query = 'CREATE DATABASE ' . PMA_backquote($newname) . ';';
|
||||
$sql_query = $local_query;
|
||||
PMA_DBI_query($local_query);
|
||||
$tables = PMA_DBI_get_tables($db);
|
||||
foreach ($tables as $table) {
|
||||
$local_query = 'RENAME TABLE '
|
||||
. PMA_backquote($db) . '.' . PMA_backquote($table)
|
||||
. ' TO '
|
||||
. PMA_backquote($newname) . '.' . PMA_backquote($table)
|
||||
. ';';
|
||||
$sql_query .= "\n" . $local_query;
|
||||
PMA_DBI_query($local_query);
|
||||
}
|
||||
$local_query = 'DROP DATABASE ' . PMA_backquote($db) . ';';
|
||||
$sql_query .= "\n" . $local_query;
|
||||
PMA_DBI_query($local_query);
|
||||
$reload = TRUE;
|
||||
$message = sprintf($strRenameDatabaseOK, htmlspecialchars($db), htmlspecialchars($newname));
|
||||
|
||||
/* Update relations */
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
if ($cfgRelation['commwork']) {
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['column_info'])
|
||||
. ' SET db_name = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
}
|
||||
if ($cfgRelation['bookmarkwork']) {
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['bookmark'])
|
||||
. ' SET dbase = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
}
|
||||
if ($cfgRelation['displaywork']) {
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['table_info'])
|
||||
. ' SET db_name = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
}
|
||||
|
||||
if ($cfgRelation['relwork']) {
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' SET foreign_db = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['relation'])
|
||||
. ' SET master_db = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
}
|
||||
if ($cfgRelation['historywork']) {
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['history'])
|
||||
. ' SET db = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE db = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
}
|
||||
if ($cfgRelation['pdfwork']) {
|
||||
PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['table_info'])
|
||||
. ' SET db_name = \'' . PMA_sqlAddslashes($newname) . '\''
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||
}
|
||||
|
||||
/* Change database to be used */
|
||||
$db = $newname;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Prepares the tables list if the user where not redirected to this script
|
||||
* because there is no table in the database ($is_info is TRUE)
|
||||
*/
|
||||
if (empty($is_info)) {
|
||||
require('./db_details_common.php');
|
||||
$url_query .= '&goto=db_details_structure.php';
|
||||
|
||||
// Gets the database structure
|
||||
$sub_part = '_structure';
|
||||
require('./db_details_db_info.php');
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
if (PMA_MYSQL_INT_VERSION >= 40101) {
|
||||
$db_collation = PMA_getDbCollation($db);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Settings for relations stuff
|
||||
*/
|
||||
require_once('./libraries/relation.lib.php');
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
/**
|
||||
* Check if comments were updated
|
||||
*/
|
||||
if ($cfgRelation['commwork'] && isset($db_comment) && $db_comment == 'true') {
|
||||
PMA_SetComment($db, '', '(db_comment)', $comment);
|
||||
}
|
||||
|
||||
echo '<table border="0" cellpadding="2" cellspacing="0">';
|
||||
if ($cfgRelation['commwork']) {
|
||||
?>
|
||||
<!-- Alter/Enter db-comment -->
|
||||
<tr><td colspan="3"><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td></tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="3" class="tblHeaders"><?php
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 'b_comment.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
}
|
||||
echo $strDBComment;
|
||||
$comment = PMA_getComments($db);
|
||||
?></td></tr>
|
||||
<form method="post" action="db_operations.php">
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<td colspan="2" nowrap="nowrap">
|
||||
<input type="hidden" name="db_comment" value="true" />
|
||||
<?php echo PMA_generate_common_hidden_inputs($db); ?>
|
||||
<input type="text" name="comment" class="textfield" size="30" value="<?php echo (isset($comment) && is_array($comment) ? htmlspecialchars(implode(' ', $comment)) : ''); ?>" /></td><td align="right">
|
||||
<input type="submit" value="<?php echo $strGo; ?>" />
|
||||
</td></tr>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<!-- Rename database -->
|
||||
<tr><td colspan="3"><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td></tr>
|
||||
<tr><td colspan="3" class="tblHeaders"><?php
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 'b_edit.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
}
|
||||
echo $strDBRename.': ';
|
||||
?></td></tr>
|
||||
<form method="post" action="db_details_structure.php"
|
||||
onsubmit="return emptyFormElements(this, 'newname')">
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>"><td colspan="2"><?php
|
||||
echo '<input type="hidden" name="db_rename" value="true" />'
|
||||
. PMA_generate_common_hidden_inputs($db);
|
||||
?><input type="text" name="newname" size="30" class="textfield" value="" /></td>
|
||||
<td align="right"><input type="submit" value="<?php echo $strGo; ?>" /></td>
|
||||
</form></tr>
|
||||
|
||||
<?php
|
||||
|
||||
if (PMA_MYSQL_INT_VERSION >= 40101) {
|
||||
// MySQL supports setting default charsets / collations for databases since
|
||||
// version 4.1.1.
|
||||
echo ' <!-- Change database charset -->' . "\n"
|
||||
. ' <tr><td colspan="3"><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n"
|
||||
. ' <tr><td colspan="3" class="tblHeaders">';
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 's_asci.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
}
|
||||
echo ' <label for="select_db_collation">' . $strCollation . '</label>: ' . "\n"
|
||||
. ' </td></tr>' . "\n"
|
||||
. ' <form method="post" action="./db_details_structure.php">' . "\n"
|
||||
. ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2" nowrap="nowrap">'
|
||||
. PMA_generate_common_hidden_inputs($db, $table, 3)
|
||||
. PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', 'select_db_collation', $db_collation, FALSE, 3)
|
||||
. ' </td><td align="right">'
|
||||
. ' <input type="submit" name="submitcollation" value="' . $strGo . '" style="vertical-align: middle" />' . "\n"
|
||||
. ' </td></tr>' . "\n"
|
||||
. ' </form>' . "\n"
|
||||
. ' ' . "\n\n";
|
||||
}
|
||||
|
||||
if ($num_tables > 0
|
||||
&& !$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == FALSE) {
|
||||
echo '<tr><td colspan="3"><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>'
|
||||
. '<tr><th colspan="3" class="tblHeadError"><div class="errorhead">' . $strError . '</div></th></tr>'
|
||||
. '<tr><td colspan="3" class="tblError">'
|
||||
. sprintf(wordwrap($strRelationNotWorking,65,'<br />'), '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $url_query . '">', '</a>')
|
||||
. '</td></tr>';
|
||||
} // end if
|
||||
?>
|
||||
</table>
|
||||
|
||||
<form method="post" action="pdf_schema.php">
|
||||
<?php
|
||||
// is this OK to check for 'class' support?
|
||||
if ($num_tables > 0) {
|
||||
$takeaway = $url_query . '&table=' . urlencode($table);
|
||||
}
|
||||
|
||||
if (($cfgRelation['pdfwork'] && $num_tables > 0) ||
|
||||
($num_tables > 0
|
||||
&& $cfgRelation['relwork'] && $cfgRelation['commwork']
|
||||
&& isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])
|
||||
)) { ?>
|
||||
<hr /><table border="0" cellpadding="2" cellspacing="0">
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?>
|
||||
<!-- Work on PDF Pages -->
|
||||
<tr>
|
||||
<td colspan="3" class="tblHeaders">
|
||||
<?php
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 'b_pdfdoc.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
} ?>PDF</td>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<td colspan="3">
|
||||
<?php
|
||||
echo '<a href="pdf_pages.php?' . $takeaway . '">';
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 'b_edit.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
}
|
||||
echo ''. $strEditPDFPages . '</a>';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- PDF schema -->
|
||||
<?php
|
||||
// We only show this if we find something in the new pdf_pages table
|
||||
|
||||
$test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
|
||||
$test_rs = PMA_query_as_cu($test_query, NULL, PMA_DBI_QUERY_STORE);
|
||||
|
||||
if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) { ?>
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">
|
||||
<td colspan="3">
|
||||
<?php
|
||||
echo PMA_generate_common_hidden_inputs($db);
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 'b_view.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
}
|
||||
echo $strDisplayPDF; ?>:
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">
|
||||
<td width="20"> </td>
|
||||
<td colspan="2">
|
||||
<label for="pdf_page_number_opt"><?php echo $strPageNumber; ?></label>
|
||||
<select name="pdf_page_number" id="pdf_page_number_opt">
|
||||
<?php
|
||||
while ($pages = @PMA_DBI_fetch_assoc($test_rs)) {
|
||||
echo ' <option value="' . $pages['page_nr'] . '">' . $pages['page_nr'] . ': ' . $pages['page_descr'] . '</option>' . "\n";
|
||||
} // end while
|
||||
PMA_DBI_free_result($test_rs);
|
||||
unset($test_rs);
|
||||
?>
|
||||
</select><br />
|
||||
|
||||
<input type="checkbox" name="show_grid" id="show_grid_opt" /><label for="show_grid_opt"><?php echo $strShowGrid; ?></label><br />
|
||||
<input type="checkbox" name="show_color" id="show_color_opt" checked="checked" /><label for="show_color_opt"><?php echo $strShowColor; ?></label><br />
|
||||
<input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" /><label for="show_table_dim_opt"><?php echo $strShowTableDimension; ?></label><br />
|
||||
<input type="checkbox" name="all_tab_same_wide" id="all_tab_same_wide" /><label for="all_tab_same_wide"><?php echo $strAllTableSameWidth; ?></label><br />
|
||||
<input type="checkbox" name="with_doc" id="with_doc" checked="checked" /><label for="with_doc"><?php echo $strDataDict; ?></label><br />
|
||||
|
||||
<label for="orientation_opt"><?php echo $strShowDatadictAs; ?></label>
|
||||
<select name="orientation" id="orientation_opt">
|
||||
<option value="L"><?php echo $strLandscape;?></option>
|
||||
<option value="P"><?php echo $strPortrait;?></option>
|
||||
</select><br />
|
||||
|
||||
<label for="paper_opt"><?php echo $strPaperSize; ?></label>
|
||||
<select name="paper" id="paper_opt">
|
||||
<?php
|
||||
foreach ($cfg['PDFPageSizes'] AS $key => $val) {
|
||||
echo '<option value="' . $val . '"';
|
||||
if ($val == $cfg['PDFDefaultPageSize']) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo ' >' . $val . '</option>' . "\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">
|
||||
<td width="20"> </td>
|
||||
<td colspan="3" align="right"> <input type="submit" value="<?php echo $strGo; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end if
|
||||
} // end if
|
||||
|
||||
if ($num_tables > 0
|
||||
&& $cfgRelation['relwork'] && $cfgRelation['commwork']
|
||||
&& isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])
|
||||
) {
|
||||
?>
|
||||
<!-- import docSQL files -->
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<td colspan="3">
|
||||
<?php
|
||||
echo '<a href="db_details_importdocsql.php?' . $takeaway . '">';
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<img src="' . $pmaThemeImage . 'b_docsql.png" border="0" width="16" height="16" hspace="2" align="middle" />';
|
||||
}
|
||||
echo $strImportDocSQL . '</a>';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
if (($cfgRelation['pdfwork'] && $num_tables > 0) ||
|
||||
($num_tables > 0
|
||||
&& $cfgRelation['relwork'] && $cfgRelation['commwork']
|
||||
&& isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])
|
||||
)) { ?>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require_once('./footer.inc.php');
|
||||
?>
|
Reference in New Issue
Block a user