diff --git a/js/functions.js b/js/functions.js
index 37b0f982d..85e29715b 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -51,11 +51,11 @@ function confirmLinkDropDB(theLink, theSqlQuery)
{
// Confirmation is not required in the configuration file
// or browser is Opera (crappy js implementation)
- if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
+ if (PMA_messages['strDoYouReally'] == '' || typeof(window.opera) != 'undefined') {
return true;
}
- var is_confirmed = confirm(confirmMsgDropDB + '\n' + confirmMsg + ' :\n' + theSqlQuery);
+ var is_confirmed = confirm(PMA_messages['strDropDatabaseStrongWarning'] + '\n' + PMA_messages['strDoYouReally'] + ' :\n' + theSqlQuery);
if (is_confirmed) {
theLink.href += '&is_js_confirmed=1';
}
@@ -76,11 +76,11 @@ function confirmLink(theLink, theSqlQuery)
{
// Confirmation is not required in the configuration file
// or browser is Opera (crappy js implementation)
- if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
+ if (PMA_messages['strDoYouReally'] == '' || typeof(window.opera) != 'undefined') {
return true;
}
- var is_confirmed = confirm(confirmMsg + ' :\n' + theSqlQuery);
+ var is_confirmed = confirm(PMA_messages['strDoYouReally'] + ' :\n' + theSqlQuery);
if (is_confirmed) {
if ( typeof(theLink.href) != 'undefined' ) {
theLink.href += '&is_js_confirmed=1';
@@ -130,7 +130,7 @@ function confirmAction(theMessage)
function confirmQuery(theForm1, sqlQuery1)
{
// Confirmation is not required in the configuration file
- if (confirmMsg == '') {
+ if (PMA_messages['strDoYouReally'] == '') {
return true;
}
@@ -142,10 +142,10 @@ function confirmQuery(theForm1, sqlQuery1)
// js1.2+ -> validation with regular expressions
else {
// "DROP DATABASE" statement isn't allowed
- if (noDropDbMsg != '') {
+ if (PMA_messages['strNoDropDatabases'] != '') {
var drop_re = new RegExp('(^|;)\\s*DROP\\s+(IF EXISTS\\s+)?DATABASE\\s', 'i');
if (drop_re.test(sqlQuery1.value)) {
- alert(noDropDbMsg);
+ alert(PMA_messages['strNoDropDatabases']);
theForm1.reset();
sqlQuery1.focus();
return false;
@@ -168,7 +168,7 @@ function confirmQuery(theForm1, sqlQuery1)
var message = (sqlQuery1.value.length > 100)
? sqlQuery1.value.substr(0, 100) + '\n ...'
: sqlQuery1.value;
- var is_confirmed = confirm(confirmMsg + ' :\n' + message);
+ var is_confirmed = confirm(PMA_messages['strDoYouReally'] + ' :\n' + message);
// drop/delete/alter statement is confirmed -> update the
// "is_js_confirmed" form field so the confirm test won't be
// run on the server side and allows to submit the form
@@ -249,7 +249,7 @@ function checkSqlQuery(theForm)
if (isEmpty) {
sqlQuery.select();
- alert(errorMsg0);
+ alert(PMA_messages['strFormEmpty']);
sqlQuery.focus();
return false;
}
@@ -302,7 +302,7 @@ function emptyFormElements(theForm, theFieldName)
if (isEmpty) {
theForm.reset();
theField.select();
- alert(errorMsg0);
+ alert(PMA_messages['strFormEmpty']);
theField.focus();
return false;
}
@@ -336,7 +336,7 @@ function checkFormElementInRange(theForm, theFieldName, message, min, max)
// It's not a number
if (isNaN(val)) {
theField.select();
- alert(errorMsg1);
+ alert(PMA_messages['strNotNumber']);
theField.focus();
return false;
}
@@ -374,7 +374,7 @@ function checkTableEditForm(theForm, fieldsCnt)
elm3 = getElement("field_" + i + "_1");
if (isNaN(val) && elm3.value != "") {
elm2.select();
- alert(errorMsg1);
+ alert(PMA_messages['strNotNumber']);
elm2.focus();
return false;
}
@@ -389,7 +389,7 @@ function checkTableEditForm(theForm, fieldsCnt)
}
if (atLeastOneField == 0) {
var theField = theForm.elements["field_0_1"];
- alert(errorMsg0);
+ alert(PMA_messages['strFormEmpty']);
theField.focus();
return false;
}
diff --git a/js/indexes.js b/js/indexes.js
index 8caed6bdd..3a170bf4e 100644
--- a/js/indexes.js
+++ b/js/indexes.js
@@ -30,7 +30,7 @@ function checkFormElementInRange(theForm, theFieldName, message, min, max)
// It's not a number
if (isNaN(val)) {
theField.select();
- alert(errorMsg1);
+ alert(PMA_messages['strNotNumber']);
theField.focus();
return false;
}
diff --git a/js/server_privileges.js b/js/server_privileges.js
index ccf1eb0f1..95b1b873c 100644
--- a/js/server_privileges.js
+++ b/js/server_privileges.js
@@ -8,8 +8,8 @@
/**
* Validates the password field in a form
*
- * @uses jsPasswordEmpty
- * @uses jsPasswordNotSame
+ * @uses PMA_messages['strPasswordEmpty']
+ * @uses PMA_messages['strPasswordNotSame']
* @param object the form
* @return boolean whether the field value is valid or not
*/
@@ -30,9 +30,9 @@ function checkPassword(the_form)
var alert_msg = false;
if (password.value == '') {
- alert_msg = jsPasswordEmpty;
+ alert_msg = PMA_messages['strPasswordEmpty'];
} else if (password.value != password_repeat.value) {
- alert_msg = jsPasswordNotSame;
+ alert_msg = PMA_messages['strPasswordNotSame'];
}
if (alert_msg) {
@@ -55,13 +55,13 @@ function checkPassword(the_form)
function checkAddUser(the_form)
{
if (the_form.elements['pred_hostname'].value == 'userdefined' && the_form.elements['hostname'].value == '') {
- alert(jsHostEmpty);
+ alert(PMA_messages['strHostEmpty']);
the_form.elements['hostname'].focus();
return false;
}
if (the_form.elements['pred_username'].value == 'userdefined' && the_form.elements['username'].value == '') {
- alert(jsUserEmpty);
+ alert(PMA_messages['strUserEmpty']);
the_form.elements['username'].focus();
return false;
}
diff --git a/libraries/header.inc.php b/libraries/header.inc.php
index 301815ddb..8c7f87d4d 100644
--- a/libraries/header.inc.php
+++ b/libraries/header.inc.php
@@ -27,32 +27,63 @@ if (empty($GLOBALS['is_header_sent'])) {
require_once './libraries/header_meta_style.inc.php';
// generate title
- $title = str_replace(
- array(
- '@HTTP_HOST@',
- '@SERVER@',
- '@VERBOSE@',
- '@VSERVER@',
- '@DATABASE@',
- '@TABLE@',
- '@PHPMYADMIN@',
- ),
- array(
- PMA_getenv('HTTP_HOST') ? PMA_getenv('HTTP_HOST') : '',
- isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : '',
- isset($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : '',
- !empty($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : (isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : ''),
- $GLOBALS['db'],
- $GLOBALS['table'],
- 'phpMyAdmin ' . PMA_VERSION,
- ),
- !empty($GLOBALS['table']) ? $GLOBALS['cfg']['TitleTable'] :
- (!empty($GLOBALS['db']) ? $GLOBALS['cfg']['TitleDatabase'] :
- (!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] :
- $GLOBALS['cfg']['TitleDefault']))
- );
+ $title = str_replace(
+ array(
+ '@HTTP_HOST@',
+ '@SERVER@',
+ '@VERBOSE@',
+ '@VSERVER@',
+ '@DATABASE@',
+ '@TABLE@',
+ '@PHPMYADMIN@',
+ ),
+ array(
+ PMA_getenv('HTTP_HOST') ? PMA_getenv('HTTP_HOST') : '',
+ isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : '',
+ isset($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : '',
+ !empty($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : (isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : ''),
+ $GLOBALS['db'],
+ $GLOBALS['table'],
+ 'phpMyAdmin ' . PMA_VERSION,
+ ),
+ !empty($GLOBALS['table']) ? $GLOBALS['cfg']['TitleTable'] :
+ (!empty($GLOBALS['db']) ? $GLOBALS['cfg']['TitleDatabase'] :
+ (!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] :
+ $GLOBALS['cfg']['TitleDefault']))
+ );
// here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0;
$is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
+
+ if (in_array('functions.js', $GLOBALS['js_include'])) {
+ $js_messages['strFormEmpty'] = $GLOBALS['strFormEmpty'];
+ $js_messages['strNotNumber'] = $GLOBALS['strNotNumber'];
+
+ if (!$is_superuser && !$GLOBALS['cfg']['AllowUserDropDatabase']) {
+ $js_messages['strNoDropDatabases'] = $GLOBALS['strNoDropDatabases'];
+ } else {
+ $js_messages['strNoDropDatabases'] = '';
+ }
+
+ if ($GLOBALS['cfg']['Confirm']) {
+ $js_messages['strDoYouReally'] = $GLOBALS['strDoYouReally'];
+ $js_messages['strDropDatabaseStrongWarning'] = $GLOBALS['strDropDatabaseStrongWarning'];
+ } else {
+ $js_messages['strDoYouReally'] = '';
+ $js_messages['strDropDatabaseStrongWarning'] = '';
+ }
+ } elseif (in_array('indexes.js', $GLOBALS['js_include'])) {
+ $js_messages['strFormEmpty'] = $GLOBALS['strFormEmpty'];
+ $js_messages['strNotNumber'] = $GLOBALS['strNotNumber'];
+ }
+
+ if (in_array('server_privileges.js', $GLOBALS['js_include'])) {
+ $js_messages['strHostEmpty'] = $GLOBALS['strHostEmpty'];
+ $js_messages['strUserEmpty'] = $GLOBALS['strUserEmpty'];
+ $js_messages['strPasswordEmpty'] = $GLOBALS['strPasswordEmpty'];
+ $js_messages['strPasswordNotSame'] = $GLOBALS['strPasswordNotSame'];
+ }
+
+ $GLOBALS['js_include'][] = 'tooltip.js';
?>
' . "\n";
}
diff --git a/querywindow.php b/querywindow.php
index d1858e47d..2e346f475 100644
--- a/querywindow.php
+++ b/querywindow.php
@@ -170,11 +170,12 @@ require_once './libraries/header_meta_style.inc.php';
?>