Merge branch 'master' into Bug4537
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
This commit is contained in:
commit
432790c0d9
@ -43,6 +43,9 @@ phpMyAdmin - ChangeLog
|
||||
+ rfe #1529 Avoid session timeout when user is active
|
||||
- bug #4528 Can't import dump via SQL field
|
||||
+ rfe #1251 Show "Overhead" with same precision for all tables
|
||||
+ rfe #1546 Improve the js printf library
|
||||
+ rfe #1542 Better error reporting in Designer
|
||||
- bug #4547 Micro history does not work in Users page
|
||||
- bug #4537 BLOB inline-view JPG column transformation does not work for anything except simple queries
|
||||
|
||||
4.2.10.0 (not yet released)
|
||||
@ -51,6 +54,7 @@ phpMyAdmin - ChangeLog
|
||||
- bug PDF export: title not present in PDF
|
||||
- bug #4543 Changing column name can break saved "order by" clause
|
||||
- bug #4545 trying to favorite table while browser localStorage is disabled throws JS error
|
||||
- bug #4259 reCaptcha sound session expired problem
|
||||
|
||||
4.2.9.0 (2014-09-20)
|
||||
- bug ajax.js responseHandler: cannot read property of null
|
||||
|
||||
@ -12,9 +12,9 @@ Code status
|
||||
:alt: Build status
|
||||
:target: https://travis-ci.org/phpmyadmin/phpmyadmin
|
||||
|
||||
.. image:: http://l10n.cihar.com/widgets/phpmyadmin-status-badge.png
|
||||
.. image:: http://hosted.weblate.org/widgets/phpmyadmin-status-badge.png
|
||||
:alt: Translation status
|
||||
:target: https://l10n.cihar.com/engage/phpmyadmin/?utm_source=widget
|
||||
:target: https://hosted.weblate.org/engage/phpmyadmin/?utm_source=widget
|
||||
|
||||
.. image:: https://coveralls.io/repos/phpmyadmin/phpmyadmin/badge.png?branch=master
|
||||
:target: https://coveralls.io/r/phpmyadmin/phpmyadmin?branch=master
|
||||
|
||||
@ -70,15 +70,16 @@ if (isset($_REQUEST['operation'])) {
|
||||
$_REQUEST['on_update']
|
||||
);
|
||||
$response->isSuccess($success);
|
||||
$response->addJSON($success ? 'message' : 'error', $message);
|
||||
$response->addJSON('message', $message);
|
||||
} elseif ($_REQUEST['operation'] == 'removeRelation') {
|
||||
PMA_removeRelation(
|
||||
list($success, $message) = PMA_removeRelation(
|
||||
$_REQUEST['T1'],
|
||||
$_REQUEST['F1'],
|
||||
$_REQUEST['T2'],
|
||||
$_REQUEST['F2']
|
||||
);
|
||||
$response->isSuccess(true);
|
||||
$response->isSuccess($success);
|
||||
$response->addJSON('message', $message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2040,7 +2040,7 @@ Bugs section. But please first discuss your bug with other users:
|
||||
|
||||
Translations are very welcome and all you need to have are the
|
||||
language skills. The easiest way is to use our `online translation
|
||||
service <https://l10n.cihar.com/projects/phpmyadmin/>`_. You can check
|
||||
service <https://hosted.weblate.org/projects/phpmyadmin/>`_. You can check
|
||||
out all the possibilities to translate in the `translate section on
|
||||
our website <http://www.phpmyadmin.net/home_page/translate.php>`_.
|
||||
|
||||
|
||||
@ -996,8 +996,8 @@ $('form').live('submit', AJAX.requestHandler);
|
||||
*/
|
||||
$(document).ajaxError(function (event, request, settings) {
|
||||
if (request.status !== 0) { // Don't handle aborted requests
|
||||
var errorCode = $.sprintf(PMA_messages.strErrorCode, request.status);
|
||||
var errorText = $.sprintf(PMA_messages.strErrorText, request.statusText);
|
||||
var errorCode = PMA_sprintf(PMA_messages.strErrorCode, request.status);
|
||||
var errorText = PMA_sprintf(PMA_messages.strErrorText, request.statusText);
|
||||
PMA_ajaxShowMessage(
|
||||
'<div class="error">' +
|
||||
PMA_messages.strErrorProcessingRequest +
|
||||
|
||||
@ -82,7 +82,7 @@ var PMA_commonParams = (function () {
|
||||
* @return string
|
||||
*/
|
||||
getUrlQuery: function () {
|
||||
return $.sprintf(
|
||||
return PMA_sprintf(
|
||||
'?%s&server=%s&db=%s&table=%s',
|
||||
this.get('common_query'),
|
||||
encodeURIComponent(this.get('server')),
|
||||
|
||||
@ -261,7 +261,7 @@ var validators = {
|
||||
if (isNaN(val)) {
|
||||
return true;
|
||||
}
|
||||
return val <= max_value ? true : $.sprintf(PMA_messages.error_value_lte, max_value);
|
||||
return val <= max_value ? true : PMA_sprintf(PMA_messages.error_value_lte, max_value);
|
||||
},
|
||||
// field validators
|
||||
_field: {
|
||||
|
||||
@ -54,11 +54,11 @@ AJAX.registerOnload('db_qbe.js', function () {
|
||||
* Ajax event handlers for 'Delete bookmark'
|
||||
*/
|
||||
$("#deleteSearch").live('click', function (event) {
|
||||
var question = $.sprintf(PMA_messages.strConfirmDeleteQBESearch, $("#searchId option:selected").text());
|
||||
var question = PMA_sprintf(PMA_messages.strConfirmDeleteQBESearch, $("#searchId option:selected").text());
|
||||
if (!confirm(question)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#action').val('delete');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -128,7 +128,7 @@ function PMA_adjustTotals() {
|
||||
|
||||
// Update summary with new data
|
||||
var $summary = $("#tbl_summary_row");
|
||||
$summary.find('.tbl_num').text($.sprintf(PMA_messages.strTables, tableSum));
|
||||
$summary.find('.tbl_num').text(PMA_sprintf(PMA_messages.strTables, tableSum));
|
||||
$summary.find('.row_count_sum').text(strRowSum);
|
||||
$summary.find('.tbl_size').text(sizeSum + " " + byteUnits[size_magnitude]);
|
||||
$summary.find('.tbl_overhead').text(overheadSum + " " + byteUnits[overhead_magnitude]);
|
||||
@ -288,7 +288,7 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = PMA_messages.strTruncateTableStrongWarning + ' ' +
|
||||
$.sprintf(PMA_messages.strDoYouReally, 'TRUNCATE ' + escapeHtml(curr_table_name));
|
||||
PMA_sprintf(PMA_messages.strDoYouReally, 'TRUNCATE ' + escapeHtml(curr_table_name));
|
||||
|
||||
$this_anchor.PMA_confirm(question, $this_anchor.attr('href'), function (url) {
|
||||
|
||||
@ -344,10 +344,10 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
var question;
|
||||
if (! is_view) {
|
||||
question = PMA_messages.strDropTableStrongWarning + ' ' +
|
||||
$.sprintf(PMA_messages.strDoYouReally, 'DROP TABLE ' + escapeHtml(curr_table_name));
|
||||
PMA_sprintf(PMA_messages.strDoYouReally, 'DROP TABLE ' + escapeHtml(curr_table_name));
|
||||
} else {
|
||||
question =
|
||||
$.sprintf(PMA_messages.strDoYouReally, 'DROP VIEW ' + escapeHtml(curr_table_name));
|
||||
PMA_sprintf(PMA_messages.strDoYouReally, 'DROP VIEW ' + escapeHtml(curr_table_name));
|
||||
}
|
||||
|
||||
$this_anchor.PMA_confirm(question, $this_anchor.attr('href'), function (url) {
|
||||
|
||||
@ -122,6 +122,10 @@ function escapeHtml(unsafe) {
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_sprintf() {
|
||||
return sprintf.apply(this, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides/shows the default value input field, depending on the default type
|
||||
* Ticks the NULL checkbox if NULL is chosen as default value.
|
||||
@ -235,7 +239,7 @@ function PMA_current_version(data)
|
||||
' ' + escapeHtml(data.version) +
|
||||
'</span>';
|
||||
if (latest > current) {
|
||||
var message = $.sprintf(
|
||||
var message = PMA_sprintf(
|
||||
PMA_messages.strNewerVersion,
|
||||
escapeHtml(data.version),
|
||||
escapeHtml(data.date)
|
||||
@ -385,7 +389,7 @@ function confirmLink(theLink, theSqlQuery)
|
||||
return true;
|
||||
}
|
||||
|
||||
var is_confirmed = confirm($.sprintf(PMA_messages.strDoYouReally, theSqlQuery));
|
||||
var is_confirmed = confirm(PMA_sprintf(PMA_messages.strDoYouReally, theSqlQuery));
|
||||
if (is_confirmed) {
|
||||
if ($(theLink).hasClass('formLinkSubmit')) {
|
||||
var name = 'is_js_confirmed';
|
||||
@ -457,7 +461,7 @@ function confirmQuery(theForm1, sqlQuery1)
|
||||
} else {
|
||||
message = sqlQuery1.value;
|
||||
}
|
||||
var is_confirmed = confirm($.sprintf(PMA_messages.strDoYouReally, message));
|
||||
var is_confirmed = confirm(PMA_sprintf(PMA_messages.strDoYouReally, message));
|
||||
// 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
|
||||
@ -598,7 +602,7 @@ function checkFormElementInRange(theForm, theFieldName, message, min, max)
|
||||
// It's a number but it is not between min and max
|
||||
else if (val < min || val > max) {
|
||||
theField.select();
|
||||
alert($.sprintf(message, val));
|
||||
alert(PMA_sprintf(message, val));
|
||||
theField.focus();
|
||||
return false;
|
||||
}
|
||||
@ -682,15 +686,16 @@ var updateInterval;
|
||||
AJAX.registerTeardown('functions.js', function () {
|
||||
clearInterval(updateInterval);
|
||||
clearInterval(IncInterval);
|
||||
$(document).off('mousemove');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('functions.js', function () {
|
||||
document.onclick = function() {
|
||||
_idleSecondsCounter = 0;
|
||||
};
|
||||
document.onmousemove = function() {
|
||||
$(document).on('mousemove',function() {
|
||||
_idleSecondsCounter = 0;
|
||||
};
|
||||
});
|
||||
document.onkeypress = function() {
|
||||
_idleSecondsCounter = 0;
|
||||
};
|
||||
@ -1715,7 +1720,7 @@ function PMA_doc_add($elm, params)
|
||||
return;
|
||||
}
|
||||
|
||||
var url = $.sprintf(
|
||||
var url = PMA_sprintf(
|
||||
mysql_doc_template,
|
||||
params[0]
|
||||
);
|
||||
@ -2682,7 +2687,7 @@ AJAX.registerOnload('functions.js', function () {
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = PMA_messages.strDropDatabaseStrongWarning + ' ';
|
||||
question += $.sprintf(
|
||||
question += PMA_sprintf(
|
||||
PMA_messages.strDoYouReally,
|
||||
'DROP DATABASE ' + escapeHtml(PMA_commonParams.get('db'))
|
||||
);
|
||||
@ -3029,7 +3034,7 @@ AJAX.registerOnload('functions.js', function () {
|
||||
"<div class='slider'></div>" +
|
||||
"</td><td>" +
|
||||
"<form><div><input type='submit' class='add_value' value='" +
|
||||
$.sprintf(PMA_messages.enum_addValue, 1) +
|
||||
PMA_sprintf(PMA_messages.enum_addValue, 1) +
|
||||
"'/></div></form>" +
|
||||
"</td></tr></table>" +
|
||||
"<input type='hidden' value='" + // So we know which column's data is being edited
|
||||
@ -3088,7 +3093,7 @@ AJAX.registerOnload('functions.js', function () {
|
||||
max: 9,
|
||||
slide: function (event, ui) {
|
||||
$(this).closest('table').find('input[type=submit]').val(
|
||||
$.sprintf(PMA_messages.enum_addValue, ui.value)
|
||||
PMA_sprintf(PMA_messages.enum_addValue, ui.value)
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -3146,7 +3151,7 @@ AJAX.registerOnload('functions.js', function () {
|
||||
var result_pointer = i;
|
||||
var search_in = '<input type="text" class="filter_rows" placeholder="'+PMA_messages.searchList+'">';
|
||||
if (fields === '') {
|
||||
fields = $.sprintf(PMA_messages.strEmptyCentralList, "'"+db+"'");
|
||||
fields = PMA_sprintf(PMA_messages.strEmptyCentralList, "'"+db+"'");
|
||||
search_in = '';
|
||||
}
|
||||
var seeMore = '';
|
||||
@ -3427,7 +3432,7 @@ function indexEditorDialog(url, title, callback_success, callback_failure)
|
||||
max: 16,
|
||||
slide: function (event, ui) {
|
||||
$(this).closest('fieldset').find('input[type=submit]').val(
|
||||
$.sprintf(PMA_messages.strAddToIndex, ui.value)
|
||||
PMA_sprintf(PMA_messages.strAddToIndex, ui.value)
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -3953,7 +3958,7 @@ AJAX.registerOnload('functions.js', function () {
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = PMA_messages.strDropTableStrongWarning + ' ';
|
||||
question += $.sprintf(
|
||||
question += PMA_sprintf(
|
||||
PMA_messages.strDoYouReally,
|
||||
'DROP TABLE ' + escapeHtml(PMA_commonParams.get('table'))
|
||||
);
|
||||
@ -3986,7 +3991,7 @@ AJAX.registerOnload('functions.js', function () {
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = PMA_messages.strDropTableStrongWarning + ' ';
|
||||
question += $.sprintf(
|
||||
question += PMA_sprintf(
|
||||
PMA_messages.strDoYouReally,
|
||||
'DROP VIEW ' + escapeHtml(PMA_commonParams.get('table'))
|
||||
);
|
||||
@ -4019,7 +4024,7 @@ AJAX.registerOnload('functions.js', function () {
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = PMA_messages.strTruncateTableStrongWarning + ' ';
|
||||
question += $.sprintf(
|
||||
question += PMA_sprintf(
|
||||
PMA_messages.strDoYouReally,
|
||||
'TRUNCATE ' + escapeHtml(PMA_commonParams.get('table'))
|
||||
);
|
||||
@ -4519,7 +4524,7 @@ function checkNumberOfFields() {
|
||||
$('form').each(function() {
|
||||
var nbInputs = $(this).find(':input').length;
|
||||
if (nbInputs > maxInputVars) {
|
||||
var warning = $.sprintf(PMA_messages.strTooManyInputs, maxInputVars);
|
||||
var warning = PMA_sprintf(PMA_messages.strTooManyInputs, maxInputVars);
|
||||
PMA_ajaxShowMessage(warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ function prepareJSVersion() {
|
||||
*/
|
||||
function addDataPoint(pointNumber, prefix) {
|
||||
return '<br/>' +
|
||||
$.sprintf(PMA_messages.strPointN, (pointNumber + 1)) + ': ' +
|
||||
PMA_sprintf(PMA_messages.strPointN, (pointNumber + 1)) + ': ' +
|
||||
'<label for="x">' + PMA_messages.strX + '</label>' +
|
||||
'<input type="text" name="' + prefix + '[' + pointNumber + '][x]" value=""/>' +
|
||||
'<label for="y">' + PMA_messages.strY + '</label>' +
|
||||
|
||||
@ -1,68 +0,0 @@
|
||||
/**
|
||||
* sprintf and vsprintf for jQuery
|
||||
* somewhat based on http://jan.moesen.nu/code/javascript/sprintf-and-printf-in-javascript/
|
||||
*
|
||||
* Copyright (c) 2008 Sabin Iacob (m0n5t3r) <iacobs@m0n5t3r.info>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @project jquery.sprintf
|
||||
*/
|
||||
(function($){
|
||||
var formats = {
|
||||
'b': function(val) {return parseInt(val, 10).toString(2);},
|
||||
'c': function(val) {return String.fromCharCode(parseInt(val, 10));},
|
||||
'd': function(val) {return parseInt(val, 10);},
|
||||
'u': function(val) {return Math.abs(val);},
|
||||
'f': function(val, p) {
|
||||
p = parseInt(p, 10);
|
||||
val = parseFloat(val);
|
||||
if(isNaN(p && val)) {
|
||||
return NaN;
|
||||
}
|
||||
return p && val.toFixed(p) || val;
|
||||
},
|
||||
'o': function(val) {return parseInt(val, 10).toString(8);},
|
||||
's': function(val) {return val;},
|
||||
'x': function(val) {return ('' + parseInt(val, 10).toString(16)).toLowerCase();},
|
||||
'X': function(val) {return ('' + parseInt(val, 10).toString(16)).toUpperCase();}
|
||||
};
|
||||
|
||||
var re = /%(?:(\d+)?(?:\.(\d+))?|\(([^)]+)\))([%bcdufosxX])/g;
|
||||
|
||||
var dispatch = function(data){
|
||||
if(data.length == 1 && typeof data[0] == 'object') { //python-style printf
|
||||
data = data[0];
|
||||
return function(match, w, p, lbl, fmt, off, str) {
|
||||
return formats[fmt](data[lbl]);
|
||||
};
|
||||
} else { // regular, somewhat incomplete, printf
|
||||
var idx = 0;
|
||||
return function(match, w, p, lbl, fmt, off, str) {
|
||||
if(fmt == '%') {
|
||||
return '%';
|
||||
}
|
||||
return formats[fmt](data[idx++], p);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
$.extend({
|
||||
sprintf: function(format) {
|
||||
var argv = Array.apply(null, arguments).slice(1);
|
||||
return format.replace(re, dispatch(argv));
|
||||
},
|
||||
vsprintf: function(format, data) {
|
||||
return format.replace(re, dispatch(data));
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
@ -101,7 +101,7 @@ function goToFinish1NF()
|
||||
}
|
||||
$("#mainContent legend").html(PMA_messages.strEndStep);
|
||||
$("#mainContent h4").html(
|
||||
"<h3>"+$.sprintf(PMA_messages.strFinishMsg, PMA_commonParams.get('table'))+"</h3>"
|
||||
"<h3>" + PMA_sprintf(PMA_messages.strFinishMsg, PMA_commonParams.get('table')) + "</h3>"
|
||||
);
|
||||
$("#mainContent p").html('');
|
||||
$("#mainContent #extra").html('');
|
||||
@ -629,7 +629,7 @@ AJAX.registerOnload('normalization.js', function() {
|
||||
if (repeatingCols !== '') {
|
||||
newColName = $("#extra input[type=checkbox]:checked:first").val();
|
||||
repeatingCols = repeatingCols.slice(0, -2);
|
||||
confirmStr = $.sprintf(PMA_messages.strMoveRepeatingGroup, escapeHtml(repeatingCols), escapeHtml(PMA_commonParams.get('table')));
|
||||
confirmStr = PMA_sprintf(PMA_messages.strMoveRepeatingGroup, escapeHtml(repeatingCols), escapeHtml(PMA_commonParams.get('table')));
|
||||
confirmStr += '<input type="text" name="repeatGroupTable" placeholder="'+PMA_messages.strNewTablePlaceholder+'"/>'+
|
||||
'( '+escapeHtml(primary_key.toString())+', <input type="text" name="repeatGroupColumn" placeholder="'+PMA_messages.strNewColumnPlaceholder+'" value="'+escapeHtml(newColName)+'">)'+
|
||||
'</ol>';
|
||||
@ -704,4 +704,4 @@ AJAX.registerOnload('normalization.js', function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -1587,7 +1587,7 @@ function Click_option(id_this, column_name, table_name)
|
||||
// var top = Glob_Y - document.getElementById(id_this).offsetHeight - 10;
|
||||
document.getElementById(id_this).style.top = (screen.height / 4) + 'px';
|
||||
document.getElementById(id_this).style.display = 'block';
|
||||
document.getElementById('option_col_name').innerHTML = '<strong>' + $.sprintf(PMA_messages.strAddOption, column_name) + '</strong>';
|
||||
document.getElementById('option_col_name').innerHTML = '<strong>' + PMA_sprintf(PMA_messages.strAddOption, column_name) + '</strong>';
|
||||
col_name = column_name;
|
||||
tab_name = table_name;
|
||||
}
|
||||
@ -1747,10 +1747,10 @@ function add_object()
|
||||
document.getElementById('orderby').checked = false;
|
||||
//make orderby
|
||||
}
|
||||
PMA_ajaxShowMessage($.sprintf(PMA_messages.strObjectsCreated, sum));
|
||||
PMA_ajaxShowMessage(PMA_sprintf(PMA_messages.strObjectsCreated, sum));
|
||||
//output sum new objects created
|
||||
var existingDiv = document.getElementById('ab');
|
||||
existingDiv.innerHTML = display(init, history_array.length);
|
||||
Close_option();
|
||||
panel(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ AJAX.registerOnload('server_databases.js', function () {
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = PMA_messages.strDropDatabaseStrongWarning + ' ' +
|
||||
$.sprintf(PMA_messages.strDoYouReally, selected_dbs.join('<br />'));
|
||||
PMA_sprintf(PMA_messages.strDoYouReally, selected_dbs.join('<br />'));
|
||||
|
||||
$(this).PMA_confirm(
|
||||
question,
|
||||
|
||||
@ -31,156 +31,6 @@ function checkAddUser(the_form)
|
||||
return PMA_checkPassword($(the_form));
|
||||
} // end of the 'checkAddUser()' function
|
||||
|
||||
/**
|
||||
* When a new user is created and retrieved over Ajax, append the user's row to
|
||||
* the user's table
|
||||
*
|
||||
* @param new_user_string the html for the new user's row
|
||||
* @param new_user_initial the first alphabet of the user's name
|
||||
* @param new_user_initial_string html to replace the initial for pagination
|
||||
*/
|
||||
function appendNewUser(new_user_string, new_user_initial, new_user_initial_string)
|
||||
{
|
||||
if (!$('#usersForm').length) {
|
||||
return;
|
||||
}
|
||||
//Append the newly retrieved user to the table now
|
||||
//Calculate the index for the new row
|
||||
var $curr_last_row = $("#usersForm").find('tbody').find('tr:last');
|
||||
var curr_shown_initial;
|
||||
var is_show_all;
|
||||
var $insert_position;
|
||||
var dummy_tr_inserted;
|
||||
var $tbody;
|
||||
var new_last_row_index;
|
||||
|
||||
if ($curr_last_row.length) {
|
||||
// at least one tr exists inside the tbody
|
||||
var $curr_first_row = $("#usersForm").find('tbody').find('tr:first');
|
||||
var $first_row_label = $curr_first_row.find('label');
|
||||
if ($first_row_label.length) {
|
||||
var first_row_initial = $first_row_label.html().substr(0, 1).toUpperCase();
|
||||
curr_shown_initial = $curr_last_row.find('label').html().substr(0, 1).toUpperCase();
|
||||
var curr_last_row_index_string = $curr_last_row.find('input:checkbox').attr('id').match(/\d+/)[0];
|
||||
var curr_last_row_index = parseFloat(curr_last_row_index_string);
|
||||
new_last_row_index = curr_last_row_index + 1;
|
||||
is_show_all = (first_row_initial != curr_shown_initial) ? true : false;
|
||||
$insert_position = $curr_last_row;
|
||||
dummy_tr_inserted = false;
|
||||
}
|
||||
} else {
|
||||
// no tr exists inside the tbody
|
||||
$tbody = $("#usersForm").find('tbody');
|
||||
// append a dummy tr
|
||||
$tbody.append('<tr></tr>');
|
||||
dummy_tr_inserted = true;
|
||||
$insert_position = $tbody.find('tr:first');
|
||||
is_show_all = true;
|
||||
//todo: the case when the new user's initial does not match
|
||||
// the currently selected initial
|
||||
curr_shown_initial = '';
|
||||
new_last_row_index = 0;
|
||||
}
|
||||
var new_last_row_id = 'checkbox_sel_users_' + new_last_row_index;
|
||||
|
||||
//Append to the table and set the id/names correctly
|
||||
if ((curr_shown_initial == new_user_initial) || is_show_all) {
|
||||
$(new_user_string)
|
||||
.insertAfter($insert_position)
|
||||
.find('input:checkbox')
|
||||
.attr('id', new_last_row_id)
|
||||
.val(function () {
|
||||
//the insert messes up the &27; part. let's fix it
|
||||
return $(this).val().replace(/&/, '&');
|
||||
})
|
||||
.end()
|
||||
.find('label')
|
||||
.attr('for', new_last_row_id)
|
||||
.end();
|
||||
}
|
||||
|
||||
if (dummy_tr_inserted) {
|
||||
// remove the dummy tr
|
||||
$tbody.find('tr:first').remove();
|
||||
}
|
||||
|
||||
//Let us sort the table alphabetically
|
||||
$("#usersForm").find('tbody').PMA_sort_table('label');
|
||||
|
||||
$("#initials_table").find('td:contains(' + new_user_initial + ')')
|
||||
.html(new_user_initial_string);
|
||||
|
||||
//update the checkall checkbox
|
||||
$(checkboxes_sel).trigger("change");
|
||||
}
|
||||
|
||||
function addUser($form)
|
||||
{
|
||||
if (! checkAddUser($form.get(0))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//We also need to post the value of the submit button in order to get this to work correctly
|
||||
$.post($form.attr('action'), $form.serialize() + "&adduser_submit=" + $("input[name=adduser_submit]").val(), function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
// Refresh navigation, if we created a database with the name
|
||||
// that is the same as the username of the new user
|
||||
if ($('#add_user_dialog #createdb-1:checked').length) {
|
||||
PMA_reloadNavigation();
|
||||
}
|
||||
|
||||
$('#page_content').show();
|
||||
$("#add_user_dialog").remove();
|
||||
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$("#result_query").remove();
|
||||
$('#page_content').prepend(data.sql_query);
|
||||
PMA_highlightSQL($('#page_content'));
|
||||
$("#result_query").css({
|
||||
'margin-top' : '0.5em'
|
||||
});
|
||||
|
||||
//Remove the empty notice div generated due to a NULL query passed to PMA_getMessage()
|
||||
var $notice_class = $("#result_query").find('.notice');
|
||||
if ($notice_class.text() === '') {
|
||||
$notice_class.remove();
|
||||
}
|
||||
if ($('#fieldset_add_user a.ajax').attr('name') == 'db_specific') {
|
||||
|
||||
/*process the fieldset_add_user attribute and get the val of privileges*/
|
||||
var url = $('#fieldset_add_user a.ajax').attr('rel');
|
||||
|
||||
if (url.substring(url.length - 23, url.length) == "&goto=db_operations.php") {
|
||||
url = url.substring(0, url.length - 23);
|
||||
}
|
||||
url = url + "&ajax_request=true&db_specific=true";
|
||||
|
||||
/* post request for get the updated userForm table */
|
||||
$.post($form.attr('action'), url, function (priv_data) {
|
||||
|
||||
/*Remove the old userForm table*/
|
||||
if ($('#userFormDiv').length !== 0) {
|
||||
$('#userFormDiv').remove();
|
||||
} else {
|
||||
$("#usersForm").remove();
|
||||
}
|
||||
if (priv_data.success === true) {
|
||||
$('<div id="userFormDiv"></div>')
|
||||
.html(priv_data.user_form)
|
||||
.insertAfter('#result_query');
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + priv_data.error, false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
appendNewUser(data.new_user_string, data.new_user_initial, data.new_user_initial_string);
|
||||
}
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX scripts for server_privileges page.
|
||||
*
|
||||
@ -202,12 +52,8 @@ function addUser($form)
|
||||
*/
|
||||
AJAX.registerTeardown('server_privileges.js', function () {
|
||||
$("#fieldset_add_user_login input[name='username']").die("focusout");
|
||||
$("#fieldset_add_user a.ajax").die("click");
|
||||
$('form[name=usersForm]').unbind('submit');
|
||||
$("#fieldset_delete_user_footer #buttonGo.ajax").die('click');
|
||||
$("a.edit_user_anchor.ajax").die('click');
|
||||
$("a.edit_user_group_anchor.ajax").die('click');
|
||||
$("#edit_user_dialog").find("form.ajax").die('submit');
|
||||
$("button.mult_submit[value=export]").die('click');
|
||||
$("a.export_user_anchor.ajax").die('click');
|
||||
$("#initials_table").find("a.ajax").die('click');
|
||||
@ -242,50 +88,6 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
$warning.hide();
|
||||
}
|
||||
});
|
||||
/**
|
||||
* AJAX event handler for 'Add a New User'
|
||||
*
|
||||
* @see PMA_ajaxShowMessage()
|
||||
* @see appendNewUser()
|
||||
* @memberOf jQuery
|
||||
* @name add_user_click
|
||||
*
|
||||
*/
|
||||
$("#fieldset_add_user a.ajax").live("click", function (event) {
|
||||
/** @lends jQuery */
|
||||
event.preventDefault();
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
$.get($(this).attr("href"), {'ajax_request': true}, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$('#page_content').hide();
|
||||
var $div = $('#add_user_dialog');
|
||||
if ($div.length === 0) {
|
||||
$div = $('<div id="add_user_dialog" style="margin: 0.5em;"></div>')
|
||||
.insertBefore('#page_content');
|
||||
} else {
|
||||
$div.empty();
|
||||
}
|
||||
$div.html(data.message)
|
||||
.find("form[name=usersForm]")
|
||||
.append('<input type="hidden" name="ajax_request" value="true" />')
|
||||
.end();
|
||||
PMA_highlightSQL($div);
|
||||
displayPasswordGenerateButton();
|
||||
PMA_showHints($div);
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
$div.find("input.autofocus").focus();
|
||||
|
||||
$div.find('form[name=usersForm]').bind('submit', function (event) {
|
||||
event.preventDefault();
|
||||
addUser($(this));
|
||||
});
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.get()
|
||||
|
||||
});//end of Add New User AJAX event handler
|
||||
|
||||
/**
|
||||
* AJAX handler for 'Revoke User'
|
||||
@ -304,7 +106,7 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
|
||||
$drop_users_db_checkbox = $("#checkbox_drop_users_db");
|
||||
if ($drop_users_db_checkbox.is(':checked')) {
|
||||
var is_confirmed = confirm(PMA_messages.strDropDatabaseStrongWarning + '\n' + $.sprintf(PMA_messages.strDoYouReally, 'DROP DATABASE'));
|
||||
var is_confirmed = confirm(PMA_messages.strDropDatabaseStrongWarning + '\n' + PMA_sprintf(PMA_messages.strDoYouReally, 'DROP DATABASE'));
|
||||
if (! is_confirmed) {
|
||||
// Uncheck the drop users database checkbox
|
||||
$drop_users_db_checkbox.prop('checked', false);
|
||||
@ -420,170 +222,6 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* AJAX handler for 'Edit User'
|
||||
*
|
||||
* @see PMA_ajaxShowMessage()
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Step 1: Load Edit User Dialog
|
||||
* @memberOf jQuery
|
||||
* @name edit_user_click
|
||||
*/
|
||||
$("a.edit_user_anchor.ajax").live('click', function (event) {
|
||||
/** @lends jQuery */
|
||||
event.preventDefault();
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
$(this).parents('tr').addClass('current_row');
|
||||
|
||||
var token = $(this).parents('form').find('input[name="token"]').val();
|
||||
$.get(
|
||||
$(this).attr('href'),
|
||||
{
|
||||
'ajax_request': true,
|
||||
'edit_user_dialog': true,
|
||||
'token': token
|
||||
},
|
||||
function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$('#page_content').hide();
|
||||
var $div = $('#edit_user_dialog');
|
||||
if ($div.length === 0) {
|
||||
$div = $('<div id="edit_user_dialog" style="margin: 0.5em;"></div>')
|
||||
.insertBefore('#page_content');
|
||||
} else {
|
||||
$div.empty();
|
||||
}
|
||||
$div.html(data.message);
|
||||
PMA_highlightSQL($div);
|
||||
$div = $('#edit_user_dialog');
|
||||
displayPasswordGenerateButton();
|
||||
addOrUpdateSubmenu();
|
||||
$(checkboxes_sel).trigger("change");
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
PMA_showHints($div);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}
|
||||
); // end $.get()
|
||||
});
|
||||
|
||||
/**
|
||||
* Step 2: Submit the Edit User Dialog
|
||||
*
|
||||
* @see PMA_ajaxShowMessage()
|
||||
* @memberOf jQuery
|
||||
* @name edit_user_submit
|
||||
*/
|
||||
$("#edit_user_dialog").find("form.ajax").live('submit', function (event) {
|
||||
/** @lends jQuery */
|
||||
event.preventDefault();
|
||||
|
||||
var $t = $(this);
|
||||
|
||||
if ($t.is('.copyUserForm') && ! PMA_checkPassword($t)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
|
||||
|
||||
$t.append('<input type="hidden" name="ajax_request" value="true" />');
|
||||
|
||||
/**
|
||||
* @var curr_submit_name name of the current button being submitted
|
||||
*/
|
||||
var curr_submit_name = $t.find('.tblFooters').find('input:submit').attr('name');
|
||||
|
||||
/**
|
||||
* @var curr_submit_value value of the current button being submitted
|
||||
*/
|
||||
var curr_submit_value = $t.find('.tblFooters').find('input:submit').val();
|
||||
|
||||
// If any option other than 'keep the old one'(option 4) is chosen, we need to remove
|
||||
// the old one from the table.
|
||||
var $row_to_remove;
|
||||
if (curr_submit_name == 'change_copy' &&
|
||||
$('input[name=mode]:checked', '#fieldset_mode').val() != '4'
|
||||
) {
|
||||
var old_username = $t.find('input[name="old_username"]').val();
|
||||
var old_hostname = $t.find('input[name="old_hostname"]').val();
|
||||
$('#usersForm tbody tr').each(function () {
|
||||
var $tr = $(this);
|
||||
if ($tr.find('td:nth-child(2) label').text() == old_username &&
|
||||
$tr.find('td:nth-child(3)').text() == old_hostname
|
||||
) {
|
||||
$row_to_remove = $tr;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$.post($t.attr('action'), $t.serialize() + '&' + curr_submit_name + '=' + curr_submit_value, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$('#page_content').show();
|
||||
$("#edit_user_dialog").remove();
|
||||
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
|
||||
if (data.sql_query) {
|
||||
$("#result_query").remove();
|
||||
$('#page_content').prepend(data.sql_query);
|
||||
PMA_highlightSQL($('#page_content'));
|
||||
$("#result_query").css({
|
||||
'margin-top' : '0.5em'
|
||||
});
|
||||
var $notice_class = $("#result_query").find('.notice');
|
||||
if ($notice_class.text() === '') {
|
||||
$notice_class.remove();
|
||||
}
|
||||
} //Show SQL Query that was executed
|
||||
|
||||
// Remove the old row if the old user is deleted
|
||||
if (typeof $row_to_remove != 'undefined' && $row_to_remove !== null) {
|
||||
$row_to_remove.remove();
|
||||
}
|
||||
|
||||
//Append new user if necessary
|
||||
if (data.new_user_string) {
|
||||
appendNewUser(data.new_user_string, data.new_user_initial, data.new_user_initial_string);
|
||||
}
|
||||
|
||||
//Check if we are on the page of the db-specific privileges
|
||||
var db_priv_page = !!($('#dbspecificuserrights').length); // the "!!" part is merely there to ensure a value of type boolean
|
||||
// we always need to reload on the db-specific privilege page
|
||||
// and on the global page when adjusting global privileges,
|
||||
// but not on the global page when adjusting db-specific privileges.
|
||||
var reload_privs = false;
|
||||
if (data.db_specific_privs === false || (db_priv_page == data.db_specific_privs)) {
|
||||
reload_privs = true;
|
||||
}
|
||||
if (data.db_wildcard_privs) {
|
||||
reload_privs = false;
|
||||
}
|
||||
|
||||
//Change privileges, if they were edited and need to be reloaded
|
||||
if (data.new_privileges && reload_privs) {
|
||||
$("#usersForm")
|
||||
.find('.current_row')
|
||||
.find('code')
|
||||
.html(data.new_privileges);
|
||||
}
|
||||
|
||||
$("#usersForm")
|
||||
.find('.current_row')
|
||||
.removeClass('current_row');
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
//end Edit user
|
||||
|
||||
/**
|
||||
* AJAX handler for 'Export Privileges'
|
||||
*
|
||||
@ -723,8 +361,6 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
}); // end $.get
|
||||
}); // end of the paginate users table
|
||||
|
||||
displayPasswordGenerateButton();
|
||||
|
||||
/*
|
||||
* Create submenu for simpler interface
|
||||
*/
|
||||
@ -778,5 +414,15 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
|
||||
// hide all sections but the first
|
||||
$("#edit_user_dialog .submenu-item").hide().eq(0).show();
|
||||
|
||||
// scroll to the top
|
||||
$('html, body').animate({scrollTop: 0}, 'fast');
|
||||
};
|
||||
|
||||
$("input.autofocus").focus();
|
||||
$(checkboxes_sel).trigger("change");
|
||||
displayPasswordGenerateButton();
|
||||
if ($("#edit_user_dialog").length > 0) {
|
||||
addOrUpdateSubmenu();
|
||||
}
|
||||
});
|
||||
|
||||
@ -736,13 +736,13 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
if (logVars.slow_query_log == 'ON') {
|
||||
if (logVars.long_query_time > 2) {
|
||||
str += PMA_getImage('s_attention.png') + ' ';
|
||||
str += $.sprintf(PMA_messages.strSmallerLongQueryTimeAdvice, logVars.long_query_time);
|
||||
str += PMA_sprintf(PMA_messages.strSmallerLongQueryTimeAdvice, logVars.long_query_time);
|
||||
str += '<br />';
|
||||
}
|
||||
|
||||
if (logVars.long_query_time < 2) {
|
||||
str += PMA_getImage('s_success.png') + ' ';
|
||||
str += $.sprintf(PMA_messages.strLongQueryTimeSet, logVars.long_query_time);
|
||||
str += PMA_sprintf(PMA_messages.strLongQueryTimeSet, logVars.long_query_time);
|
||||
str += '<br />';
|
||||
}
|
||||
}
|
||||
@ -760,26 +760,26 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
|
||||
str += '- <a class="set" href="#log_output-' + varValue + '">';
|
||||
str += $.sprintf(PMA_messages.strSetLogOutput, varValue);
|
||||
str += PMA_sprintf(PMA_messages.strSetLogOutput, varValue);
|
||||
str += ' </a><br />';
|
||||
|
||||
if (logVars.general_log != 'ON') {
|
||||
str += '- <a class="set" href="#general_log-ON">';
|
||||
str += $.sprintf(PMA_messages.strEnableVar, 'general_log');
|
||||
str += PMA_sprintf(PMA_messages.strEnableVar, 'general_log');
|
||||
str += ' </a><br />';
|
||||
} else {
|
||||
str += '- <a class="set" href="#general_log-OFF">';
|
||||
str += $.sprintf(PMA_messages.strDisableVar, 'general_log');
|
||||
str += PMA_sprintf(PMA_messages.strDisableVar, 'general_log');
|
||||
str += ' </a><br />';
|
||||
}
|
||||
|
||||
if (logVars.slow_query_log != 'ON') {
|
||||
str += '- <a class="set" href="#slow_query_log-ON">';
|
||||
str += $.sprintf(PMA_messages.strEnableVar, 'slow_query_log');
|
||||
str += PMA_sprintf(PMA_messages.strEnableVar, 'slow_query_log');
|
||||
str += ' </a><br />';
|
||||
} else {
|
||||
str += '- <a class="set" href="#slow_query_log-OFF">';
|
||||
str += $.sprintf(PMA_messages.strDisableVar, 'slow_query_log');
|
||||
str += PMA_sprintf(PMA_messages.strDisableVar, 'slow_query_log');
|
||||
str += ' </a><br />';
|
||||
}
|
||||
|
||||
@ -789,7 +789,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
|
||||
str += '- <a class="set" href="#long_query_time-' + varValue + '">';
|
||||
str += $.sprintf(PMA_messages.setSetLongQueryTime, varValue);
|
||||
str += PMA_sprintf(PMA_messages.setSetLongQueryTime, varValue);
|
||||
str += ' </a><br />';
|
||||
|
||||
} else {
|
||||
@ -906,7 +906,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
|
||||
var str = serie.display == 'differential' ? ', ' + PMA_messages.strDifferential : '';
|
||||
str += serie.valueDivisor ? (', ' + $.sprintf(PMA_messages.strDividedBy, serie.valueDivisor)) : '';
|
||||
str += serie.valueDivisor ? (', ' + PMA_sprintf(PMA_messages.strDividedBy, serie.valueDivisor)) : '';
|
||||
str += serie.unit ? (', ' + PMA_messages.strUnit + ': ' + serie.unit) : '';
|
||||
|
||||
var newSeries = {
|
||||
@ -1181,7 +1181,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
seriesValue = plot.series[0]._yaxis.tickOptions.formatter('%s', seriesValue);
|
||||
} else if (plot.series[0]._yaxis.tickOptions.formatString) {
|
||||
// using format string
|
||||
seriesValue = $.sprintf(plot.series[0]._yaxis.tickOptions.formatString, seriesValue);
|
||||
seriesValue = PMA_sprintf(plot.series[0]._yaxis.tickOptions.formatString, seriesValue);
|
||||
}
|
||||
tooltipHtml += '<br /><span style="color:' + seriesColor + '">' +
|
||||
seriesLabel + ': ' + seriesValue + '</span>';
|
||||
|
||||
@ -27,7 +27,7 @@ AJAX.registerOnload('server_user_groups.js', function () {
|
||||
};
|
||||
$('<div/>')
|
||||
.attr('id', 'confirmUserGroupDeleteDialog')
|
||||
.append($.sprintf(PMA_messages.strDropUserGroupWarning, escapeHtml(groupName)))
|
||||
.append(PMA_sprintf(PMA_messages.strDropUserGroupWarning, escapeHtml(groupName)))
|
||||
.dialog({
|
||||
width: 300,
|
||||
minWidth: 200,
|
||||
|
||||
211
js/sprintf.js
Normal file
211
js/sprintf.js
Normal file
@ -0,0 +1,211 @@
|
||||
function sprintf() {
|
||||
/*
|
||||
* Copyright (c) 2013 Kevin van Zonneveld (http://kvz.io)
|
||||
* and Contributors (http://phpjs.org/authors)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is furnished to do
|
||||
* so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
// discuss at: http://phpjs.org/functions/sprintf/
|
||||
// original by: Ash Searle (http://hexmen.com/blog/)
|
||||
// improved by: Michael White (http://getsprink.com)
|
||||
// improved by: Jack
|
||||
// improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
|
||||
// improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
|
||||
// improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
|
||||
// improved by: Dj
|
||||
// improved by: Allidylls
|
||||
// input by: Paulo Freitas
|
||||
// input by: Brett Zamir (http://brett-zamir.me)
|
||||
// example 1: sprintf("%01.2f", 123.1);
|
||||
// returns 1: 123.10
|
||||
// example 2: sprintf("[%10s]", 'monkey');
|
||||
// returns 2: '[ monkey]'
|
||||
// example 3: sprintf("[%'#10s]", 'monkey');
|
||||
// returns 3: '[####monkey]'
|
||||
// example 4: sprintf("%d", 123456789012345);
|
||||
// returns 4: '123456789012345'
|
||||
// example 5: sprintf('%-03s', 'E');
|
||||
// returns 5: 'E00'
|
||||
|
||||
var regex = /%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g;
|
||||
var a = arguments;
|
||||
var i = 0;
|
||||
var format = a[i++];
|
||||
|
||||
// pad()
|
||||
var pad = function (str, len, chr, leftJustify) {
|
||||
if (!chr) {
|
||||
chr = ' ';
|
||||
}
|
||||
var padding = (str.length >= len) ? '' : new Array(1 + len - str.length >>> 0)
|
||||
.join(chr);
|
||||
return leftJustify ? str + padding : padding + str;
|
||||
};
|
||||
|
||||
// justify()
|
||||
var justify = function (value, prefix, leftJustify, minWidth, zeroPad, customPadChar) {
|
||||
var diff = minWidth - value.length;
|
||||
if (diff > 0) {
|
||||
if (leftJustify || !zeroPad) {
|
||||
value = pad(value, minWidth, customPadChar, leftJustify);
|
||||
} else {
|
||||
value = value.slice(0, prefix.length) + pad('', diff, '0', true) + value.slice(prefix.length);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
// formatBaseX()
|
||||
var formatBaseX = function (value, base, prefix, leftJustify, minWidth, precision, zeroPad) {
|
||||
// Note: casts negative numbers to positive ones
|
||||
var number = value >>> 0;
|
||||
prefix = prefix && number && {
|
||||
'2': '0b',
|
||||
'8': '0',
|
||||
'16': '0x'
|
||||
}[base] || '';
|
||||
value = prefix + pad(number.toString(base), precision || 0, '0', false);
|
||||
return justify(value, prefix, leftJustify, minWidth, zeroPad);
|
||||
};
|
||||
|
||||
// formatString()
|
||||
var formatString = function (value, leftJustify, minWidth, precision, zeroPad, customPadChar) {
|
||||
if (precision != null) {
|
||||
value = value.slice(0, precision);
|
||||
}
|
||||
return justify(value, '', leftJustify, minWidth, zeroPad, customPadChar);
|
||||
};
|
||||
|
||||
// doFormat()
|
||||
var doFormat = function (substring, valueIndex, flags, minWidth, _, precision, type) {
|
||||
var number, prefix, method, textTransform, value;
|
||||
|
||||
if (substring === '%%') {
|
||||
return '%';
|
||||
}
|
||||
|
||||
// parse flags
|
||||
var leftJustify = false;
|
||||
var positivePrefix = '';
|
||||
var zeroPad = false;
|
||||
var prefixBaseX = false;
|
||||
var customPadChar = ' ';
|
||||
var flagsl = flags.length;
|
||||
for (var j = 0; flags && j < flagsl; j++) {
|
||||
switch (flags.charAt(j)) {
|
||||
case ' ':
|
||||
positivePrefix = ' ';
|
||||
break;
|
||||
case '+':
|
||||
positivePrefix = '+';
|
||||
break;
|
||||
case '-':
|
||||
leftJustify = true;
|
||||
break;
|
||||
case "'":
|
||||
customPadChar = flags.charAt(j + 1);
|
||||
break;
|
||||
case '0':
|
||||
zeroPad = true;
|
||||
customPadChar = '0';
|
||||
break;
|
||||
case '#':
|
||||
prefixBaseX = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// parameters may be null, undefined, empty-string or real valued
|
||||
// we want to ignore null, undefined and empty-string values
|
||||
if (!minWidth) {
|
||||
minWidth = 0;
|
||||
} else if (minWidth === '*') {
|
||||
minWidth = +a[i++];
|
||||
} else if (minWidth.charAt(0) == '*') {
|
||||
minWidth = +a[minWidth.slice(1, -1)];
|
||||
} else {
|
||||
minWidth = +minWidth;
|
||||
}
|
||||
|
||||
// Note: undocumented perl feature:
|
||||
if (minWidth < 0) {
|
||||
minWidth = -minWidth;
|
||||
leftJustify = true;
|
||||
}
|
||||
|
||||
if (!isFinite(minWidth)) {
|
||||
throw new Error('sprintf: (minimum-)width must be finite');
|
||||
}
|
||||
|
||||
if (!precision) {
|
||||
precision = 'fFeE'.indexOf(type) > -1 ? 6 : (type === 'd') ? 0 : undefined;
|
||||
} else if (precision === '*') {
|
||||
precision = +a[i++];
|
||||
} else if (precision.charAt(0) == '*') {
|
||||
precision = +a[precision.slice(1, -1)];
|
||||
} else {
|
||||
precision = +precision;
|
||||
}
|
||||
|
||||
// grab value using valueIndex if required?
|
||||
value = valueIndex ? a[valueIndex.slice(0, -1)] : a[i++];
|
||||
|
||||
switch (type) {
|
||||
case 's':
|
||||
return formatString(String(value), leftJustify, minWidth, precision, zeroPad, customPadChar);
|
||||
case 'c':
|
||||
return formatString(String.fromCharCode(+value), leftJustify, minWidth, precision, zeroPad);
|
||||
case 'b':
|
||||
return formatBaseX(value, 2, prefixBaseX, leftJustify, minWidth, precision, zeroPad);
|
||||
case 'o':
|
||||
return formatBaseX(value, 8, prefixBaseX, leftJustify, minWidth, precision, zeroPad);
|
||||
case 'x':
|
||||
return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad);
|
||||
case 'X':
|
||||
return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad)
|
||||
.toUpperCase();
|
||||
case 'u':
|
||||
return formatBaseX(value, 10, prefixBaseX, leftJustify, minWidth, precision, zeroPad);
|
||||
case 'i':
|
||||
case 'd':
|
||||
number = +value || 0;
|
||||
// Plain Math.round doesn't just truncate
|
||||
number = Math.round(number - number % 1);
|
||||
prefix = number < 0 ? '-' : positivePrefix;
|
||||
value = prefix + pad(String(Math.abs(number)), precision, '0', false);
|
||||
return justify(value, prefix, leftJustify, minWidth, zeroPad);
|
||||
case 'e':
|
||||
case 'E':
|
||||
case 'f': // Should handle locales (as per setlocale)
|
||||
case 'F':
|
||||
case 'g':
|
||||
case 'G':
|
||||
number = +value;
|
||||
prefix = number < 0 ? '-' : positivePrefix;
|
||||
method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())];
|
||||
textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) % 2];
|
||||
value = prefix + Math.abs(number)[method](precision);
|
||||
return justify(value, prefix, leftJustify, minWidth, zeroPad)[textTransform]();
|
||||
default:
|
||||
return substring;
|
||||
}
|
||||
};
|
||||
|
||||
return format.replace(regex, doFormat);
|
||||
}
|
||||
@ -125,7 +125,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
// Delete row from SQL results
|
||||
$('a.delete_row.ajax').live('click', function (e) {
|
||||
e.preventDefault();
|
||||
var question = $.sprintf(PMA_messages.strDoYouReally, escapeHtml($(this).closest('td').find('div').text()));
|
||||
var question = PMA_sprintf(PMA_messages.strDoYouReally, escapeHtml($(this).closest('td').find('div').text()));
|
||||
var $link = $(this);
|
||||
$link.PMA_confirm(question, $link.attr('href'), function (url) {
|
||||
$msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
@ -208,7 +208,7 @@ AJAX.registerOnload('tbl_relation.js', function () {
|
||||
.val()
|
||||
);
|
||||
|
||||
var question = $.sprintf(PMA_messages.strDoYouReally, drop_query);
|
||||
var question = PMA_sprintf(PMA_messages.strDoYouReally, drop_query);
|
||||
|
||||
$anchor.PMA_confirm(question, $anchor.attr('href'), function (url) {
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages.strDroppingForeignKey, false);
|
||||
|
||||
@ -212,7 +212,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = $.sprintf(PMA_messages.strDoYouReally, 'ALTER TABLE `' + escapeHtml(curr_table_name) + '` DROP `' + escapeHtml(curr_column_name) + '`;');
|
||||
var question = PMA_sprintf(PMA_messages.strDoYouReally, 'ALTER TABLE `' + escapeHtml(curr_table_name) + '` DROP `' + escapeHtml(curr_column_name) + '`;');
|
||||
$(this).PMA_confirm(question, $(this).attr('href'), function (url) {
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages.strDroppingColumn, false);
|
||||
$.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true, 'ajax_page_request' : true}, function (data) {
|
||||
@ -265,7 +265,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = $.sprintf(PMA_messages.strDoYouReally, 'ALTER TABLE `' + escapeHtml(curr_table_name) + '` ADD PRIMARY KEY(`' + escapeHtml(curr_column_name) + '`);');
|
||||
var question = PMA_sprintf(PMA_messages.strDoYouReally, 'ALTER TABLE `' + escapeHtml(curr_table_name) + '` ADD PRIMARY KEY(`' + escapeHtml(curr_column_name) + '`);');
|
||||
$(this).PMA_confirm(question, $(this).attr('href'), function (url) {
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages.strAddingPrimaryKey, false);
|
||||
$.get(url,
|
||||
@ -314,7 +314,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = $.sprintf(PMA_messages.strDoYouReally, 'ALTER TABLE `' + escapeHtml(curr_table_name) + '` ADD INDEX(`' + escapeHtml(curr_column_name) + '`);');
|
||||
var question = PMA_sprintf(PMA_messages.strDoYouReally, 'ALTER TABLE `' + escapeHtml(curr_table_name) + '` ADD INDEX(`' + escapeHtml(curr_column_name) + '`);');
|
||||
$(this).PMA_confirm(question, $(this).attr('href'), function (url) {
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages.strAddingIndex, false);
|
||||
$.get(url,
|
||||
@ -358,7 +358,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = $.sprintf(PMA_messages.strDoYouReally, 'ALTER TABLE `' + escapeHtml(curr_table_name) + '` ADD UNIQUE(`' + escapeHtml(curr_column_name) + '`);');
|
||||
var question = PMA_sprintf(PMA_messages.strDoYouReally, 'ALTER TABLE `' + escapeHtml(curr_table_name) + '` ADD UNIQUE(`' + escapeHtml(curr_column_name) + '`);');
|
||||
$(this).PMA_confirm(question, $(this).attr('href'), function (url) {
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages.strAddingUnique, false);
|
||||
$.get(url,
|
||||
|
||||
@ -162,10 +162,10 @@ class PMA_Header
|
||||
$this->_scripts->addFile(
|
||||
'whitelist.php' . PMA_URL_getCommon($params), false, true
|
||||
);
|
||||
$this->_scripts->addFile('sprintf.js');
|
||||
$this->_scripts->addFile('ajax.js');
|
||||
$this->_scripts->addFile('keyhandler.js');
|
||||
$this->_scripts->addFile('jquery/jquery-ui-1.9.2.custom.min.js');
|
||||
$this->_scripts->addFile('jquery/jquery.sprintf.js');
|
||||
$this->_scripts->addFile('jquery/jquery.cookie.js');
|
||||
$this->_scripts->addFile('jquery/jquery.mousewheel.js');
|
||||
$this->_scripts->addFile('jquery/jquery.event.drag-2.2.js');
|
||||
|
||||
@ -1619,31 +1619,30 @@ class PMA_Table
|
||||
// do checking based on property
|
||||
if ($property == self::PROP_SORTED_COLUMN) {
|
||||
if (isset($this->uiprefs[$property])) {
|
||||
if (isset($_REQUEST['discard_remembered_sort'])) {
|
||||
$this->removeUiProp(self::PROP_SORTED_COLUMN);
|
||||
}
|
||||
// check if the column name exists in this table
|
||||
$tmp = explode(' ', $this->uiprefs[$property]);
|
||||
$colname = $tmp[0];
|
||||
//remove backquoting from colname
|
||||
$colname = str_replace('`', '', $colname);
|
||||
//get the available column name without backquoting
|
||||
$avail_columns = $this->getColumns(false);
|
||||
if (! isset($_REQUEST['discard_remembered_sort'])) {
|
||||
// check if the column name exists in this table
|
||||
$tmp = explode(' ', $this->uiprefs[$property]);
|
||||
$colname = $tmp[0];
|
||||
//remove backquoting from colname
|
||||
$colname = str_replace('`', '', $colname);
|
||||
//get the available column name without backquoting
|
||||
$avail_columns = $this->getColumns(false);
|
||||
|
||||
/** @var PMA_String $pmaString */
|
||||
$pmaString = $GLOBALS['PMA_String'];
|
||||
/** @var PMA_String $pmaString */
|
||||
$pmaString = $GLOBALS['PMA_String'];
|
||||
|
||||
foreach ($avail_columns as $each_col) {
|
||||
// check if $each_col ends with $colname
|
||||
if (substr_compare(
|
||||
$each_col,
|
||||
$colname,
|
||||
$pmaString->strlen($each_col) - $pmaString->strlen($colname)
|
||||
) === 0) {
|
||||
return $this->uiprefs[$property];
|
||||
foreach ($avail_columns as $each_col) {
|
||||
// check if $each_col ends with $colname
|
||||
if (substr_compare(
|
||||
$each_col,
|
||||
$colname,
|
||||
$pmaString->strlen($each_col) - $pmaString->strlen($colname)
|
||||
) === 0) {
|
||||
return $this->uiprefs[$property];
|
||||
}
|
||||
}
|
||||
}
|
||||
// remove the property, since it is not exist anymore in database
|
||||
// remove the property, since it no longer exists in database
|
||||
$this->removeUiProp(self::PROP_SORTED_COLUMN);
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@ -584,7 +584,7 @@ function PMA_getDatabaseTables(
|
||||
$html .= 'id="id_hide_tbody_' . $t_n_url . '" ';
|
||||
$html .= 'onmouseover="this.className=\'small_tab2\';" ';
|
||||
$html .= 'onmouseout="this.className=\'small_tab\';" ';
|
||||
$html .= 'onclick="Small_tab(' . $t_n_url . ', 1)">';
|
||||
$html .= 'onclick="Small_tab(\'' . $t_n_url . '\', 1)">';
|
||||
|
||||
// no space alloawd here, between tags and content !!!
|
||||
// JavaScript function does require this
|
||||
@ -599,8 +599,8 @@ function PMA_getDatabaseTables(
|
||||
$html .= '<td class="small_tab_pref" ';
|
||||
$html .= 'onmouseover="this.className=\'small_tab_pref2\';" ';
|
||||
$html .= 'onmouseout="this.className=\'small_tab_pref\';" ';
|
||||
$html .= 'onclick="Start_tab_upd('
|
||||
. $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i] . ');">';
|
||||
$html .= 'onclick="Start_tab_upd(\''
|
||||
. $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i] . '\');">';
|
||||
$html .= '<img alt="" ';
|
||||
$html .= 'src="' . $_SESSION['PMA_Theme']->getImgPath('pmd/exec_small.png')
|
||||
. '" />';
|
||||
|
||||
@ -34,9 +34,7 @@ function PMA_getHtmlForChangePassword($username, $hostname)
|
||||
$html = '<form method="post" id="change_password_form" '
|
||||
. 'action="' . basename($GLOBALS['PMA_PHP_SELF']) . '" '
|
||||
. 'name="chgPassword" '
|
||||
. 'class="ajax'
|
||||
. ($is_privileges ? ' submenu-item' : '')
|
||||
. '">';
|
||||
. 'class="' . ($is_privileges ? 'submenu-item' : '') . '">';
|
||||
|
||||
$html .= PMA_URL_getHiddenInputs();
|
||||
|
||||
@ -109,7 +107,8 @@ function PMA_getHtmlForChangePassword($username, $hostname)
|
||||
$html .= '</table>'
|
||||
. '</fieldset>'
|
||||
. '<fieldset id="fieldset_change_password_footer" class="tblFooters">'
|
||||
. '<input type="submit" name="change_pw" value="' . __('Go') . '" />'
|
||||
. '<input type="hidden" name="change_pw" value="1" />'
|
||||
. '<input type="submit" value="' . __('Go') . '" />'
|
||||
. '</fieldset>'
|
||||
. '</form>';
|
||||
return $html;
|
||||
|
||||
@ -493,7 +493,7 @@ function PMA_getHtmlForImportWithPlugin($upload_id)
|
||||
$html .= ' now.getFullYear(), now.getMonth(), now.getDate(), ';
|
||||
$html .= ' now.getHours(), now.getMinutes(), now.getSeconds()) ';
|
||||
$html .= ' + now.getMilliseconds() - 1000; ';
|
||||
$html .= ' var statustext = $.sprintf("' . $statustext_str . '", ';
|
||||
$html .= ' var statustext = PMA_sprintf("' . $statustext_str . '", ';
|
||||
$html .= ' formatBytes(complete, 1, PMA_messages.strDecimalSeparator), ';
|
||||
$html .= ' formatBytes(total, 1, PMA_messages.strDecimalSeparator) ';
|
||||
$html .= ' ); ';
|
||||
@ -517,7 +517,7 @@ function PMA_getHtmlForImportWithPlugin($upload_id)
|
||||
$html .= ' var used_time = now - import_start; ';
|
||||
$html .= ' var seconds = '
|
||||
. 'parseInt(((total - complete) / complete) * used_time / 1000); ';
|
||||
$html .= ' var speed = $.sprintf("' . $second_str . '"';
|
||||
$html .= ' var speed = PMA_sprintf("' . $second_str . '"';
|
||||
$html .= ' , formatBytes(complete / used_time * 1000, 1,'
|
||||
. ' PMA_messages.strDecimalSeparator)); ';
|
||||
|
||||
|
||||
@ -250,12 +250,14 @@ class AuthenticationCookie extends AuthenticationPlugin
|
||||
value="manual_challenge">
|
||||
</noscript>
|
||||
<script type="text/javascript">
|
||||
$("#recaptcha_reload_btn").addClass("disableAjax");
|
||||
$("#recaptcha_switch_audio_btn").addClass("disableAjax");
|
||||
$("#recaptcha_switch_img_btn").addClass("disableAjax");
|
||||
$("#recaptcha_whatsthis_btn").addClass("disableAjax");
|
||||
$("#recaptcha_audio_play_again").live("mouseover", function() {
|
||||
$(this).addClass("disableAjax");
|
||||
$(function() {
|
||||
$("#recaptcha_reload_btn").addClass("disableAjax");
|
||||
$("#recaptcha_switch_audio_btn").addClass("disableAjax");
|
||||
$("#recaptcha_switch_img_btn").addClass("disableAjax");
|
||||
$("#recaptcha_whatsthis_btn").addClass("disableAjax");
|
||||
$("#recaptcha_audio_play_again").live("mouseover", function() {
|
||||
$(this).addClass("disableAjax");
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
@ -537,8 +537,16 @@ function PMA_addNewRelation($db, $T1, $F1, $T2, $F2, $on_delete, $on_update)
|
||||
$upd_query .= ';';
|
||||
if ($GLOBALS['dbi']->tryQuery($upd_query)) {
|
||||
return array(true, __('FOREIGN KEY relation has been added.'));
|
||||
} else {
|
||||
$error = $GLOBALS['dbi']->getError();
|
||||
return array(
|
||||
false,
|
||||
__('Error: FOREIGN KEY relation could not be added!')
|
||||
. "<br/>" . $error
|
||||
);
|
||||
}
|
||||
return array(false, __('Error: Relation could not be added!'));
|
||||
} else {
|
||||
return array(false, __('Error: Missing index on column(s).'));
|
||||
}
|
||||
} else { // internal (pmadb) relation
|
||||
if ($GLOBALS['cfgRelation']['relwork'] == false) {
|
||||
@ -547,23 +555,28 @@ function PMA_addNewRelation($db, $T1, $F1, $T2, $F2, $on_delete, $on_update)
|
||||
// no need to recheck if the keys are primary or unique at this point,
|
||||
// this was checked on the interface part
|
||||
|
||||
$q = 'INSERT INTO '
|
||||
$q = "INSERT INTO "
|
||||
. PMA_Util::backquote($GLOBALS['cfgRelation']['db'])
|
||||
. '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['relation'])
|
||||
. '(master_db, master_table, master_field,'
|
||||
. 'foreign_db, foreign_table, foreign_field)'
|
||||
. ' values('
|
||||
. '\'' . PMA_Util::sqlAddSlashes($db) . '\', '
|
||||
. '\'' . PMA_Util::sqlAddSlashes($T2) . '\', '
|
||||
. '\'' . PMA_Util::sqlAddSlashes($F2) . '\', '
|
||||
. '\'' . PMA_Util::sqlAddSlashes($db) . '\', '
|
||||
. '\'' . PMA_Util::sqlAddSlashes($T1) . '\','
|
||||
. '\'' . PMA_Util::sqlAddSlashes($F1) . '\')';
|
||||
. "." . PMA_Util::backquote($GLOBALS['cfgRelation']['relation'])
|
||||
. "(master_db, master_table, master_field, "
|
||||
. "foreign_db, foreign_table, foreign_field)"
|
||||
. " values("
|
||||
. "'" . PMA_Util::sqlAddSlashes($db) . "', "
|
||||
. "'" . PMA_Util::sqlAddSlashes($T2) . "', "
|
||||
. "'" . PMA_Util::sqlAddSlashes($F2) . "', "
|
||||
. "'" . PMA_Util::sqlAddSlashes($db) . "', "
|
||||
. "'" . PMA_Util::sqlAddSlashes($T1) . "', "
|
||||
. "'" . PMA_Util::sqlAddSlashes($F1) . "')";
|
||||
|
||||
if (PMA_queryAsControlUser($q, false, PMA_DatabaseInterface::QUERY_STORE)) {
|
||||
return array(true, __('Internal relation has been added.'));
|
||||
} else {
|
||||
return array(false, __('Error: Relation could not be added!'));
|
||||
$error = $GLOBALS['dbi']->getError($GLOBALS['controllink']);
|
||||
return array(
|
||||
false,
|
||||
__('Error: Internal relation could not be added!')
|
||||
. "<br/>" . $error
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -577,7 +590,7 @@ function PMA_addNewRelation($db, $T1, $F1, $T2, $F2, $on_delete, $on_update)
|
||||
* @param string $T2 master db.table
|
||||
* @param string $F2 master field
|
||||
*
|
||||
* @return void
|
||||
* @return array array of success/failure and message
|
||||
*/
|
||||
function PMA_removeRelation($T1, $F1, $T2, $F2)
|
||||
{
|
||||
@ -603,11 +616,19 @@ function PMA_removeRelation($T1, $F1, $T2, $F2)
|
||||
$foreigner = PMA_searchColumnInForeigners($existrel_foreign, $F2);
|
||||
|
||||
if (isset($foreigner['constraint'])) {
|
||||
$upd_query = 'ALTER TABLE ' . PMA_Util::backquote($DB2)
|
||||
$upd_query = 'ALTER TABLE ' . PMA_Util::backquote($DB2)
|
||||
. '.' . PMA_Util::backquote($T2) . ' DROP FOREIGN KEY '
|
||||
. PMA_Util::backquote($foreigner['constraint'])
|
||||
. ';';
|
||||
$upd_rs = $GLOBALS['dbi']->query($upd_query);
|
||||
. PMA_Util::backquote($foreigner['constraint']) . ';';
|
||||
if ($GLOBALS['dbi']->query($upd_query)) {
|
||||
return array(true, __('FOREIGN KEY relation has been removed.'));
|
||||
} else {
|
||||
$error = $GLOBALS['dbi']->getError();
|
||||
return array(
|
||||
false,
|
||||
__('Error: FOREIGN KEY relation could not be removed!')
|
||||
. "<br/>" . $error
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// there can be an internal relation even if InnoDB
|
||||
$try_to_delete_internal_relation = true;
|
||||
@ -615,21 +636,34 @@ function PMA_removeRelation($T1, $F1, $T2, $F2)
|
||||
} else {
|
||||
$try_to_delete_internal_relation = true;
|
||||
}
|
||||
|
||||
if ($try_to_delete_internal_relation) {
|
||||
// internal relations
|
||||
PMA_queryAsControlUser(
|
||||
'DELETE FROM '
|
||||
. PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.'
|
||||
. $GLOBALS['cfgRelation']['relation'] . ' WHERE '
|
||||
. 'master_db = \'' . PMA_Util::sqlAddSlashes($DB2) . '\''
|
||||
. ' AND master_table = \'' . PMA_Util::sqlAddSlashes($T2) . '\''
|
||||
. ' AND master_field = \'' . PMA_Util::sqlAddSlashes($F2) . '\''
|
||||
. ' AND foreign_db = \'' . PMA_Util::sqlAddSlashes($DB1) . '\''
|
||||
. ' AND foreign_table = \'' . PMA_Util::sqlAddSlashes($T1) . '\''
|
||||
. ' AND foreign_field = \'' . PMA_Util::sqlAddSlashes($F1) . '\'',
|
||||
$delete_query = "DELETE FROM "
|
||||
. PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . "."
|
||||
. $GLOBALS['cfgRelation']['relation'] . " WHERE "
|
||||
. "master_db = '" . PMA_Util::sqlAddSlashes($DB2) . "'"
|
||||
. " AND master_table = '" . PMA_Util::sqlAddSlashes($T2) . "'"
|
||||
. " AND master_field = '" . PMA_Util::sqlAddSlashes($F2) . "'"
|
||||
. " AND foreign_db = '" . PMA_Util::sqlAddSlashes($DB1) . "'"
|
||||
. " AND foreign_table = '" . PMA_Util::sqlAddSlashes($T1) . "'"
|
||||
. " AND foreign_field = '" . PMA_Util::sqlAddSlashes($F1) . "'";
|
||||
|
||||
$result = PMA_queryAsControlUser(
|
||||
$delete_query,
|
||||
false,
|
||||
PMA_DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
if ($result) {
|
||||
return array(true, __('Internal relation has been removed.'));
|
||||
} else {
|
||||
$error = $GLOBALS['dbi']->getError($GLOBALS['controllink']);
|
||||
return array(
|
||||
false,
|
||||
__('Error: Internal relation could not be removed!') . "<br/>" . $error
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -699,9 +699,9 @@ function PMA_getHtmlToDisplayPrivilegesTable($db = '*',
|
||||
if ($submit) {
|
||||
$html_output .= '<fieldset id="fieldset_user_privtable_footer" '
|
||||
. 'class="tblFooters">' . "\n"
|
||||
. '<input type="submit" name="update_privs" '
|
||||
. 'value="' . __('Go') . '" />' . "\n"
|
||||
. '</fieldset>' . "\n";
|
||||
. '<input type="hidden" name="update_privs" value="1" />' . "\n"
|
||||
. '<input type="submit" value="' . __('Go') . '" />' . "\n"
|
||||
. '</fieldset>' . "\n";
|
||||
}
|
||||
return $html_output;
|
||||
} // end of the 'PMA_displayPrivTable()' function
|
||||
@ -1754,7 +1754,8 @@ function PMA_getHtmlForAddUser($dbname)
|
||||
$html_output = '<h2>' . "\n"
|
||||
. PMA_Util::getIcon('b_usradd.png') . __('Add user') . "\n"
|
||||
. '</h2>' . "\n"
|
||||
. '<form name="usersForm" class="ajax" id="addUsersForm"'
|
||||
. '<form name="usersForm" id="addUsersForm"'
|
||||
. ' onsubmit="return checkAddUser(this);"'
|
||||
. ' action="server_privileges.php" method="post" autocomplete="off" >' . "\n"
|
||||
. PMA_URL_getHiddenInputs('', '')
|
||||
. PMA_getHtmlForLoginInformationFields('new');
|
||||
@ -1796,8 +1797,8 @@ function PMA_getHtmlForAddUser($dbname)
|
||||
}
|
||||
$html_output .= '<fieldset id="fieldset_add_user_footer" class="tblFooters">'
|
||||
. "\n"
|
||||
. '<input type="submit" name="adduser_submit" '
|
||||
. 'value="' . __('Go') . '" />' . "\n"
|
||||
. '<input type="hidden" name="adduser_submit" value="1" />' . "\n"
|
||||
. '<input type="submit" id="adduser_submit" value="' . __('Go') . '" />' . "\n"
|
||||
. '</fieldset>' . "\n"
|
||||
. '</form>' . "\n";
|
||||
|
||||
@ -2238,7 +2239,7 @@ function PMA_getHtmlListOfPrivs(
|
||||
*/
|
||||
function PMA_getUserEditLink($username, $hostname, $dbname = '', $tablename = '')
|
||||
{
|
||||
return '<a class="edit_user_anchor ajax"'
|
||||
return '<a class="edit_user_anchor"'
|
||||
. ' href="server_privileges.php'
|
||||
. PMA_URL_getCommon(
|
||||
array(
|
||||
@ -2375,7 +2376,7 @@ function PMA_getExtraDataForAjaxBehavior(
|
||||
$extra_data['sql_query'] = PMA_Util::getMessage(null, $sql_query);
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['adduser_submit']) || isset($_REQUEST['change_copy'])) {
|
||||
if (isset($_REQUEST['change_copy'])) {
|
||||
/**
|
||||
* generate html on the fly for the new user that was just created.
|
||||
*/
|
||||
@ -2510,7 +2511,8 @@ function PMA_getChangeLoginInformationHtmlForm($username, $hostname)
|
||||
);
|
||||
|
||||
$html_output = '<form action="server_privileges.php" '
|
||||
. 'method="post" class="copyUserForm ajax submenu-item">' . "\n"
|
||||
. 'onsubmit="return checkAddUser(this);" '
|
||||
. 'method="post" class="copyUserForm submenu-item">' . "\n"
|
||||
. PMA_URL_getHiddenInputs('', '')
|
||||
. '<input type="hidden" name="old_username" '
|
||||
. 'value="' . htmlspecialchars($username) . '" />' . "\n"
|
||||
@ -2534,8 +2536,8 @@ function PMA_getChangeLoginInformationHtmlForm($username, $hostname)
|
||||
|
||||
$html_output .= '<fieldset id="fieldset_change_copy_user_footer" '
|
||||
. 'class="tblFooters">' . "\n"
|
||||
. '<input type="submit" name="change_copy" '
|
||||
. 'value="' . __('Go') . '" />' . "\n"
|
||||
. '<input type="hidden" name="change_copy" value="1" />' . "\n"
|
||||
. '<input type="submit" value="' . __('Go') . '" />' . "\n"
|
||||
. '</fieldset>' . "\n"
|
||||
. '</form>' . "\n";
|
||||
|
||||
@ -3848,7 +3850,7 @@ function PMA_getAddUserHtmlFieldset($db = '', $table = '')
|
||||
. (!empty($rel_params)
|
||||
? ('rel="' . PMA_URL_getCommon($rel_params) . '" ')
|
||||
: '')
|
||||
. 'class="ajax">' . "\n"
|
||||
. '">' . "\n"
|
||||
. PMA_Util::getIcon('b_usradd.png')
|
||||
. ' ' . __('Add user') . '</a>' . "\n"
|
||||
. '</fieldset>' . "\n";
|
||||
@ -3875,7 +3877,7 @@ function PMA_getHtmlHeaderForUserProperties(
|
||||
. __('User');
|
||||
|
||||
if (! empty($dbname)) {
|
||||
$html_output .= ' <i><a class="edit_user_anchor ajax"'
|
||||
$html_output .= ' <i><a class="edit_user_anchor"'
|
||||
. ' href="server_privileges.php'
|
||||
. PMA_URL_getCommon(
|
||||
array(
|
||||
@ -4074,7 +4076,8 @@ function PMA_getHtmlForUserOverview($pmaThemeImage, $text_dir)
|
||||
function PMA_getHtmlForUserProperties($dbname_is_wildcard,$url_dbname,
|
||||
$username, $hostname, $dbname, $tablename
|
||||
) {
|
||||
$html_output = PMA_getHtmlHeaderForUserProperties(
|
||||
$html_output = '<div id="edit_user_dialog">';
|
||||
$html_output .= PMA_getHtmlHeaderForUserProperties(
|
||||
$dbname_is_wildcard, $url_dbname, $dbname, $username, $hostname, $tablename
|
||||
);
|
||||
|
||||
@ -4107,7 +4110,7 @@ function PMA_getHtmlForUserProperties($dbname_is_wildcard,$url_dbname,
|
||||
$_params['dbname'] = $dbname;
|
||||
}
|
||||
|
||||
$html_output .= '<form class="ajax submenu-item" name="usersForm" '
|
||||
$html_output .= '<form class="submenu-item" name="usersForm" '
|
||||
. 'id="addUsersForm" action="server_privileges.php" method="post">' . "\n";
|
||||
$html_output .= PMA_URL_getHiddenInputs($_params);
|
||||
$html_output .= PMA_getHtmlToDisplayPrivilegesTable(
|
||||
@ -4166,6 +4169,7 @@ function PMA_getHtmlForUserProperties($dbname_is_wildcard,$url_dbname,
|
||||
$html_output .= PMA_getHtmlForChangePassword($username, $hostname);
|
||||
$html_output .= PMA_getChangeLoginInformationHtmlForm($username, $hostname);
|
||||
}
|
||||
$html_output .= '</div>';
|
||||
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
@ -283,7 +283,7 @@ function PMA_getHtmlToEditUserGroup($userGroup = null)
|
||||
|
||||
$html_output .= '<fieldset id="fieldset_user_group_rights_footer"'
|
||||
. ' class="tblFooters">';
|
||||
$html_output .= '<input type="submit" name="update_privs" value="Go">';
|
||||
$html_output .= '<input type="submit" value="' . __('Go') . '">';
|
||||
$html_output .= '</fieldset>';
|
||||
|
||||
return $html_output;
|
||||
|
||||
@ -2514,7 +2514,7 @@ function PMA_updateColumns($db, $table)
|
||||
if ($pmaString->strpos(
|
||||
$sorted_col,
|
||||
PMA_Util::backquote($_REQUEST['field_orig'][$i])
|
||||
) !== false) {
|
||||
) !== false) {
|
||||
// delete the whole remembered sort expression
|
||||
$pmatable->removeUiProp(PMA_Table::PROP_SORTED_COLUMN);
|
||||
}
|
||||
|
||||
3564
po/be@latin.po
3564
po/be@latin.po
File diff suppressed because it is too large
Load Diff
4222
po/en_GB.po
4222
po/en_GB.po
File diff suppressed because it is too large
Load Diff
3522
po/phpmyadmin.pot
3522
po/phpmyadmin.pot
File diff suppressed because it is too large
Load Diff
3680
po/pt_BR.po
3680
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
3587
po/sr@latin.po
3587
po/sr@latin.po
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user