make use of PMA_Message

This commit is contained in:
Sebastian Mendel
2007-10-17 12:14:19 +00:00
parent 06b2fea3e3
commit 085a7c8f22
9 changed files with 54 additions and 50 deletions

View File

@@ -29,7 +29,7 @@ $export_page_title = $strViewDumpDB;
// exit if no tables in db found
if ($num_tables < 1) {
echo '<div class="warning">' . $strNoTablesFound . '</div>';
PMA_Message::error('strNoTablesFound')->display();
require './libraries/footer.inc.php';
exit;
} // end if

View File

@@ -38,7 +38,7 @@ if (isset($_REQUEST['submit_sql']) && ! empty($sql_query)) {
if (isset($_REQUEST['submit_sql'])
&& ! preg_match('@^SELECT@i', $sql_query)) {
echo '<div class="warning">' . $GLOBALS['strHaveToShow'] . '</div>';
PMA_Message::warning('strHaveToShow')->display();
}

View File

@@ -19,8 +19,8 @@
*
* @access public
*/
function PMA_auth() {
function PMA_auth()
{
/* Perform logout to custom URL */
if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
@@ -46,22 +46,25 @@ function PMA_auth() {
?>
</head>
<body>
<?php if (file_exists('./config.header.inc.php')) {
require './config.header.inc.php';
}
?>
<?php
if (file_exists('./config.header.inc.php')) {
require './config.header.inc.php';
}
?>
<br /><br />
<center>
<h1><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION); ?></h1>
</center>
<br />
<div class="warning"><?php echo $GLOBALS['strWrongUser']; ?></div>
<?php if (file_exists('./config.footer.inc.php')) {
require './config.footer.inc.php';
}
?>
<?php
PMA_Message::error('strWrongUser')->display();
if (file_exists('./config.footer.inc.php')) {
require './config.footer.inc.php';
}
?>
</body>
</html>
@@ -145,8 +148,8 @@ function PMA_auth_check()
if (!empty($old_usr)
&& (isset($PHP_AUTH_USER) && $old_usr == $PHP_AUTH_USER)) {
$PHP_AUTH_USER = '';
// -> delete user's choices that were stored in session
session_destroy();
// -> delete user's choices that were stored in session
session_destroy();
}
// Returns whether we get authentication settings or not

View File

@@ -15,13 +15,14 @@ if ($GLOBALS['cfg']['DBG']['enable']) {
* Loads the DBG extension if needed
*/
if (! @extension_loaded('dbg') && ! PMA_dl('dbg')) {
echo '<div class="warning">'
.sprintf($GLOBALS['strCantLoad'], 'DBG')
.' <a href="./Documentation.html#faqdbg" target="documentation">'
.$GLOBALS['strDocu'] . '</a>'
.'</div>';
$message = PMA_Message::error('strCantLoad');
$message->addParam('DBG');
$message->addMessage('<a href="./Documentation.html#faqdbg" target="documentation">');
$message->addString('strDocu');
$message->addMessage('</a>');
$message->display();
} else {
$GLOBALS['DBG'] = true;
}
}
?>
?>

View File

@@ -36,23 +36,22 @@ echo PMA_pluginGetJavascript($import_list);
<fieldset class="options">
<legend><?php echo $strFileToImport; ?></legend>
<?php
if ($GLOBALS['is_upload']) {
?>
<?php
if ($GLOBALS['is_upload']) {
?>
<div class="formelementrow">
<label for="input_import_file"><?php echo $strLocationTextfile; ?></label>
<input style="margin: 5px" type="file" name="import_file" id="input_import_file" onchange="match_file(this.value);" />
<?php
echo PMA_displayMaximumUploadSize($max_upload_size) . "\n";
// some browsers should respect this :)
echo PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
} else {
echo '<div class="warning">' . "\n";
echo $strUploadsNotAllowed . "\n";
}
?>
<?php
echo PMA_displayMaximumUploadSize($max_upload_size) . "\n";
// some browsers should respect this :)
echo PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
?>
</div>
<?php
<?php
} else {
PMA_Message::warning('strUploadsNotAllowed')->display();
}
if (!empty($cfg['UploadDir'])) {
$extensions = '';
foreach ($import_list as $key => $val) {
@@ -66,10 +65,7 @@ if (!empty($cfg['UploadDir'])) {
$files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir']), $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ? $local_import_file : '');
echo '<div class="formelementrow">' . "\n";
if ($files === FALSE) {
echo ' <div class="warning">' . "\n";
echo ' <strong>' . $strError . '</strong>: ' . "\n";
echo ' ' . $strWebServerUploadDirectoryError . "\n";
echo ' </div>' . "\n";
PMA_Message::error('strWebServerUploadDirectoryError')->display();
} elseif (!empty($files)) {
echo "\n";
echo ' <i>' . $strOr . '</i><br/><label for="select_local_import_file">' . $strWebServerUploadDirectory . '</label>&nbsp;: ' . "\n";

View File

@@ -106,10 +106,9 @@ function PMA_check_indexes($idx_collection)
reset($while_index);
$first_column = current($while_index);
$output .= '<div class="warning">';
$output .= $GLOBALS['strIndexesSeemEqual'] . ' ';
$output .= $each_index_name . ', ' . $first_column['Key_name'];
$output .= '</div>';
$message = PMA_Message::warning('strIndexesSeemEqual');
$message->addMessage($each_index_name . ', ' . $first_column['Key_name']);
$output .= $message->getDisplay();
// there is no need to check any further indexes if we have already
// found that this one has a duplicate

View File

@@ -328,9 +328,9 @@ if (window.parent.openDb(\'' . PMA_jsFormat($current['SCHEMA_NAME'], false) . '\
.' title="' . $strDatabasesStatsDisable . '">' . "\n"
.' ' . $strDatabasesStatsDisable;
}
echo '</a></strong><br />' . "\n"
.' <div class="warning">'
. $strDatabasesStatsHeavyTraffic . '</div></li>' . "\n"
echo '</a></strong><br />' . "\n";
PMA_Message::warning('strDatabasesStatsHeavyTraffic')->display();
echo '</li>' . "\n"
.'</ul>' . "\n";
echo '</form>';
} else {

View File

@@ -309,7 +309,9 @@ elseif (!defined('PMA_IDX_INCLUDED')
<br class="clearfloat" />
<div class="warning"><?php echo $strPrimaryKeyWarning; ?></div>
<?php
PMA_Message::warning('strPrimaryKeyWarning')->display();
?>
<table>
<thead>
@@ -441,8 +443,9 @@ elseif (!defined('PMA_IDX_INCLUDED')
else {
// none indexes
echo '<tbody>'
.'<tr><td colspan="7"><div class="warning">' . $strNoIndex
.'</div></td></tr>' . "\n";
.'<tr><td colspan="7">';
PMA_Message::warning('strNoIndex')->display();
echo '</td></tr>' . "\n";
}
?>

View File

@@ -220,8 +220,10 @@ if (isset($_REQUEST['destination_innodb'])) {
echo PMA_showMySQLDocu('manual_Table_types', 'InnoDB_foreign_key_constraints') . "\n";
}
if (substr($tmp_error, 1, 4) == '1005') {
echo '<p class="warning">' . $strForeignKeyError . ' : ' . $master_field
.'</p>' . PMA_showMySQLDocu('manual_Table_types', 'InnoDB_foreign_key_constraints') . "\n";
$message = PMA_Message::warning('strForeignKeyError');
$message->addMessage(htmlspecialchars($master_field), ' : ');
$message->display();
echo PMA_showMySQLDocu('manual_Table_types', 'InnoDB_foreign_key_constraints') . "\n";
}
unset($tmp_error);
$sql_query = '';