Merge branch 'master' of https://github.com/phpmyadmin/phpmyadmin into UT_plu_parse
This commit is contained in:
commit
3f24f6d901
19
js/config.js
19
js/config.js
@ -751,24 +751,13 @@ function savePrefsToLocalStorage(form)
|
||||
function updatePrefsDate()
|
||||
{
|
||||
var d = new Date(window.localStorage['config_mtime_local']);
|
||||
var msg = PMA_messages.strSavedOn.replace('@DATE@', formatDate(d));
|
||||
var msg = PMA_messages.strSavedOn.replace(
|
||||
'@DATE@',
|
||||
PMA_formatDateTime(d)
|
||||
);
|
||||
$('#opts_import_local_storage div.localStorage-exists').html(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns date formatted as YYYY-MM-DD HH:II
|
||||
*
|
||||
* @param {Date} d
|
||||
*/
|
||||
function formatDate(d)
|
||||
{
|
||||
return d.getFullYear() + '-' +
|
||||
(d.getMonth() < 10 ? '0' + d.getMonth() : d.getMonth()) +
|
||||
'-' + (d.getDate() < 10 ? '0' + d.getDate() : d.getDate()) +
|
||||
' ' + (d.getHours() < 10 ? '0' + d.getHours() : d.getHours()) +
|
||||
':' + (d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares message which informs that localStorage preferences are available and can be imported
|
||||
*/
|
||||
|
||||
408
js/date.js
408
js/date.js
@ -1,408 +0,0 @@
|
||||
// ===================================================================
|
||||
// Author: Matt Kruse <matt@mattkruse.com>
|
||||
// WWW: http://www.mattkruse.com/
|
||||
//
|
||||
// NOTICE: You may use this code for any purpose, commercial or
|
||||
// private, without any further permission from the author. You may
|
||||
// remove this notice from your final code if you wish, however it is
|
||||
// appreciated by the author if at least my web site address is kept.
|
||||
//
|
||||
// You may *NOT* re-distribute this code in any way except through its
|
||||
// use. That means, you can include it in your product, or your web
|
||||
// site, or any other form where the code is actually being used. You
|
||||
// may not put the plain javascript up on your site for download or
|
||||
// include it in your javascript libraries for download.
|
||||
// If you wish to share this code with others, please just point them
|
||||
// to the URL instead.
|
||||
// Please DO NOT link directly to my .js files from your site. Copy
|
||||
// the files to your server and use them there. Thank you.
|
||||
// ===================================================================
|
||||
|
||||
// HISTORY
|
||||
// ------------------------------------------------------------------
|
||||
// May 17, 2003: Fixed bug in parseDate() for dates <1970
|
||||
// March 11, 2003: Added parseDate() function
|
||||
// March 11, 2003: Added "NNN" formatting option. Doesn't match up
|
||||
// perfectly with SimpleDateFormat formats, but
|
||||
// backwards-compatability was required.
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// These functions use the same 'format' strings as the
|
||||
// java.text.SimpleDateFormat class, with minor exceptions.
|
||||
// The format string consists of the following abbreviations:
|
||||
//
|
||||
// Field | Full Form | Short Form
|
||||
// -------------+--------------------+-----------------------
|
||||
// Year | yyyy (4 digits) | yy (2 digits), y (2 or 4 digits)
|
||||
// Month | MMM (name or abbr.)| MM (2 digits), M (1 or 2 digits)
|
||||
// | NNN (abbr.) |
|
||||
// Day of Month | dd (2 digits) | d (1 or 2 digits)
|
||||
// Day of Week | EE (name) | E (abbr)
|
||||
// Hour (1-12) | hh (2 digits) | h (1 or 2 digits)
|
||||
// Hour (0-23) | HH (2 digits) | H (1 or 2 digits)
|
||||
// Hour (0-11) | KK (2 digits) | K (1 or 2 digits)
|
||||
// Hour (1-24) | kk (2 digits) | k (1 or 2 digits)
|
||||
// Minute | mm (2 digits) | m (1 or 2 digits)
|
||||
// Second | ss (2 digits) | s (1 or 2 digits)
|
||||
// AM/PM | a |
|
||||
//
|
||||
// NOTE THE DIFFERENCE BETWEEN MM and mm! Month=MM, not mm!
|
||||
// Examples:
|
||||
// "MMM d, y" matches: January 01, 2000
|
||||
// Dec 1, 1900
|
||||
// Nov 20, 00
|
||||
// "M/d/yy" matches: 01/20/00
|
||||
// 9/2/00
|
||||
// "MMM dd, yyyy hh:mm:ssa" matches: "January 01, 2000 12:30:45AM"
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
var MONTH_NAMES = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
|
||||
var DAY_NAMES = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
|
||||
function LZ(x) {
|
||||
return (x < 0 || x > 9 ? "" : "0") + x;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// isDate ( date_string, format_string )
|
||||
// Returns true if date string matches format of format string and
|
||||
// is a valid date. Else returns false.
|
||||
// It is recommended that you trim whitespace around the value before
|
||||
// passing it to this function, as whitespace is NOT ignored!
|
||||
// ------------------------------------------------------------------
|
||||
function isDate(val, format) {
|
||||
var date = getDateFromFormat(val, format);
|
||||
if (date === 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// compareDates(date1,date1format,date2,date2format)
|
||||
// Compare two date strings to see which is greater.
|
||||
// Returns:
|
||||
// 1 if date1 is greater than date2
|
||||
// 0 if date2 is greater than date1 of if they are the same
|
||||
// -1 if either of the dates is in an invalid format
|
||||
// -------------------------------------------------------------------
|
||||
function compareDates(date1, dateformat1, date2, dateformat2) {
|
||||
var d1 = getDateFromFormat(date1, dateformat1);
|
||||
var d2 = getDateFromFormat(date2, dateformat2);
|
||||
if (d1 === 0 || d2 === 0) {
|
||||
return -1;
|
||||
} else if (d1 > d2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// formatDate (date_object, format)
|
||||
// Returns a date in the output format specified.
|
||||
// The format string uses the same abbreviations as in getDateFromFormat()
|
||||
// ------------------------------------------------------------------
|
||||
function formatDate(date, format) {
|
||||
format = format + "";
|
||||
var result = "";
|
||||
var i_format = 0;
|
||||
var c = "";
|
||||
var token = "";
|
||||
var y = date.getYear() + "";
|
||||
var M = date.getMonth() + 1;
|
||||
var d = date.getDate();
|
||||
var E = date.getDay();
|
||||
var H = date.getHours();
|
||||
var m = date.getMinutes();
|
||||
var s = date.getSeconds();
|
||||
// Convert real date parts into formatted versions
|
||||
var value = new Object();
|
||||
if (y.length < 4) {
|
||||
y = "" + (y - 0 + 1900);
|
||||
}
|
||||
value["y"] = "" + y;
|
||||
value["yyyy"] = y;
|
||||
value["yy"] = y.substring(2, 4);
|
||||
value["M"] = M;
|
||||
value["MM"] = LZ(M);
|
||||
value["MMM"] = MONTH_NAMES[M - 1];
|
||||
value["NNN"] = MONTH_NAMES[M + 11];
|
||||
value["d"] = d;
|
||||
value["dd"] = LZ(d);
|
||||
value["E"] = DAY_NAMES[E + 7];
|
||||
value["EE"] = DAY_NAMES[E];
|
||||
value["H"] = H;
|
||||
value["HH"] = LZ(H);
|
||||
if (H === 0) {
|
||||
value["h"] = 12;
|
||||
} else if (H > 12) {
|
||||
value["h"] = H - 12;
|
||||
} else {
|
||||
value["h"] = H;
|
||||
}
|
||||
value["hh"] = LZ(value["h"]);
|
||||
if (H > 11) {
|
||||
value["K"] = H - 12;
|
||||
} else {
|
||||
value["K"] = H;
|
||||
}
|
||||
value["k"] = H + 1;
|
||||
value["KK"] = LZ(value["K"]);
|
||||
value["kk"] = LZ(value["k"]);
|
||||
if (H > 11) {
|
||||
value["a"] = "PM";
|
||||
} else {
|
||||
value["a"] = "AM";
|
||||
}
|
||||
value["m"] = m;
|
||||
value["mm"] = LZ(m);
|
||||
value["s"] = s;
|
||||
value["ss"] = LZ(s);
|
||||
while (i_format < format.length) {
|
||||
c = format.charAt(i_format);
|
||||
token = "";
|
||||
while ((format.charAt(i_format) == c) && (i_format < format.length)) {
|
||||
token += format.charAt(i_format++);
|
||||
}
|
||||
if (value[token] !== null && value[token] !== undefined) {
|
||||
result = result + value[token];
|
||||
} else {
|
||||
result = result + token;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Utility functions for parsing in getDateFromFormat()
|
||||
// ------------------------------------------------------------------
|
||||
function _isInteger(val) {
|
||||
var digits = "1234567890";
|
||||
for (var i = 0; i < val.length; i++) {
|
||||
if (digits.indexOf(val.charAt(i)) == -1) { return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function _getInt(str, i, minlength, maxlength) {
|
||||
for (var x = maxlength; x >= minlength; x--) {
|
||||
var token = str.substring(i, i + x);
|
||||
if (token.length < minlength) {
|
||||
return null;
|
||||
}
|
||||
if (_isInteger(token)) {
|
||||
return token;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// getDateFromFormat( date_string , format_string )
|
||||
//
|
||||
// This function takes a date string and a format string. It matches
|
||||
// If the date string matches the format string, it returns the
|
||||
// getTime() of the date. If it does not match, it returns 0.
|
||||
// ------------------------------------------------------------------
|
||||
function getDateFromFormat(val, format) {
|
||||
val = val + "";
|
||||
format = format + "";
|
||||
var i_val = 0;
|
||||
var i_format = 0;
|
||||
var c = "";
|
||||
var token = "";
|
||||
var token2 = "";
|
||||
var x, y;
|
||||
var now = new Date();
|
||||
var year = now.getYear();
|
||||
var month = now.getMonth() + 1;
|
||||
var date = 1;
|
||||
var hh = now.getHours();
|
||||
var mm = now.getMinutes();
|
||||
var ss = now.getSeconds();
|
||||
var ampm = "";
|
||||
|
||||
while (i_format < format.length) {
|
||||
// Get next token from format string
|
||||
c = format.charAt(i_format);
|
||||
token = "";
|
||||
while ((format.charAt(i_format) == c) && (i_format < format.length)) {
|
||||
token += format.charAt(i_format++);
|
||||
}
|
||||
// Extract contents of value based on format token
|
||||
if (token == "yyyy" || token == "yy" || token == "y") {
|
||||
if (token == "yyyy") {
|
||||
x = 4;
|
||||
y = 4;
|
||||
} else if (token == "yy") {
|
||||
x = 2;
|
||||
y = 2;
|
||||
} else if (token == "y") {
|
||||
x = 2;
|
||||
y = 4;
|
||||
}
|
||||
year = _getInt(val, i_val, x, y);
|
||||
if (year === null) {
|
||||
return 0;
|
||||
}
|
||||
i_val += year.length;
|
||||
if (year.length == 2) {
|
||||
if (year > 70) {
|
||||
year = 1900 + (year - 0);
|
||||
} else {
|
||||
year = 2000 + (year - 0);
|
||||
}
|
||||
}
|
||||
} else if (token == "MMM" || token == "NNN") {
|
||||
month = 0;
|
||||
for (var i = 0; i < MONTH_NAMES.length; i++) {
|
||||
var month_name = MONTH_NAMES[i];
|
||||
if (val.substring(i_val, i_val + month_name.length).toLowerCase() == month_name.toLowerCase()) {
|
||||
if (token == "MMM" || (token == "NNN" && i > 11)) {
|
||||
month = i + 1;
|
||||
if (month > 12) {
|
||||
month -= 12;
|
||||
}
|
||||
i_val += month_name.length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((month < 1) || (month > 12)) {
|
||||
return 0;
|
||||
}
|
||||
} else if (token == "EE" || token == "E") {
|
||||
for (var i = 0; i < DAY_NAMES.length; i++) {
|
||||
var day_name = DAY_NAMES[i];
|
||||
if (val.substring(i_val, i_val + day_name.length).toLowerCase() == day_name.toLowerCase()) {
|
||||
i_val += day_name.length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (token == "MM" || token == "M") {
|
||||
month = _getInt(val, i_val, token.length, 2);
|
||||
if (month === null || (month < 1) || (month > 12)) {
|
||||
return 0;
|
||||
}
|
||||
i_val += month.length;
|
||||
} else if (token == "dd" || token == "d") {
|
||||
date = _getInt(val, i_val, token.length, 2);
|
||||
if (date === null || (date < 1) || (date > 31)) {
|
||||
return 0;
|
||||
}
|
||||
i_val += date.length;
|
||||
} else if (token == "hh" || token == "h") {
|
||||
hh = _getInt(val, i_val, token.length, 2);
|
||||
if (hh === null || (hh < 1) || (hh > 12)) {
|
||||
return 0;
|
||||
}
|
||||
i_val += hh.length;
|
||||
} else if (token == "HH" || token == "H") {
|
||||
hh = _getInt(val, i_val, token.length, 2);
|
||||
if (hh === null || (hh < 0) || (hh > 23)) {
|
||||
return 0;
|
||||
}
|
||||
i_val += hh.length;
|
||||
} else if (token == "KK" || token == "K") {
|
||||
hh = _getInt(val, i_val, token.length, 2);
|
||||
if (hh === null || (hh < 0) || (hh > 11)) {
|
||||
return 0;
|
||||
}
|
||||
i_val += hh.length;
|
||||
} else if (token == "kk" || token == "k") {
|
||||
hh = _getInt(val, i_val, token.length, 2);
|
||||
if (hh === null || (hh < 1) || (hh > 24)) {
|
||||
return 0;
|
||||
}
|
||||
i_val += hh.length;
|
||||
hh--;
|
||||
} else if (token == "mm" || token == "m") {
|
||||
mm = _getInt(val, i_val, token.length, 2);
|
||||
if (mm === null || (mm < 0) || (mm > 59)) {
|
||||
return 0;
|
||||
}
|
||||
i_val += mm.length;
|
||||
} else if (token == "ss" || token == "s") {
|
||||
ss = _getInt(val, i_val, token.length, 2);
|
||||
if (ss === null || (ss < 0) || (ss > 59)) {
|
||||
return 0;
|
||||
}
|
||||
i_val += ss.length;
|
||||
} else if (token == "a") {
|
||||
if (val.substring(i_val, i_val + 2).toLowerCase() == "am") {
|
||||
ampm = "AM";
|
||||
} else if (val.substring(i_val, i_val + 2).toLowerCase() == "pm") {
|
||||
ampm = "PM";
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
i_val += 2;
|
||||
} else {
|
||||
if (val.substring(i_val, i_val + token.length) != token) {
|
||||
return 0;
|
||||
} else {
|
||||
i_val += token.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If there are any trailing characters left in the value, it doesn't match
|
||||
if (i_val != val.length) {
|
||||
return 0;
|
||||
}
|
||||
// Is date valid for month?
|
||||
if (month == 2) {
|
||||
// Check for leap year
|
||||
if (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) { // leap year
|
||||
if (date > 29) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (date > 28) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((month == 4) || (month == 6) || (month == 9) || (month == 11)) {
|
||||
if (date > 30) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// Correct hours value
|
||||
if (hh < 12 && ampm == "PM") {
|
||||
hh = hh - 0 + 12;
|
||||
} else if (hh > 11 && ampm == "AM") {
|
||||
hh -= 12;
|
||||
}
|
||||
var newdate = new Date(year, month - 1, date, hh, mm, ss);
|
||||
return newdate.getTime();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// parseDate( date_string [, prefer_euro_format] )
|
||||
//
|
||||
// This function takes a date string and tries to match it to a
|
||||
// number of possible date formats to get the value. It will try to
|
||||
// match against the following international formats, in this order:
|
||||
// y-M-d MMM d, y MMM d,y y-MMM-d d-MMM-y MMM d
|
||||
// M/d/y M-d-y M.d.y MMM-d M/d M-d
|
||||
// d/M/y d-M-y d.M.y d-MMM d/M d-M
|
||||
// A second argument may be passed to instruct the method to search
|
||||
// for formats like d/M/y (european format) before M/d/y (American).
|
||||
// Returns a Date object or null if no patterns match.
|
||||
// ------------------------------------------------------------------
|
||||
function parseDate(val) {
|
||||
var preferEuro = (arguments.length == 2) ? arguments[1] : false;
|
||||
generalFormats = new Array('y-M-d', 'MMM d, y', 'MMM d,y', 'y-MMM-d', 'd-MMM-y', 'MMM d');
|
||||
monthFirst = new Array('M/d/y', 'M-d-y', 'M.d.y', 'MMM-d', 'M/d', 'M-d');
|
||||
dateFirst = new Array('d/M/y', 'd-M-y', 'd.M.y', 'd-MMM', 'd/M', 'd-M');
|
||||
var checkList = new Array('generalFormats', preferEuro ? 'dateFirst' : 'monthFirst', preferEuro ? 'monthFirst' : 'dateFirst');
|
||||
var d = null;
|
||||
for (var i = 0; i < checkList.length; i++) {
|
||||
var l = window[checkList[i]];
|
||||
for (var j = 0; j < l.length; j++) {
|
||||
d = getDateFromFormat(val, l[j]);
|
||||
if (d !== 0) {
|
||||
return new Date(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -3919,3 +3919,21 @@ $('a.login-link').live('click', function (e) {
|
||||
$(window).resize(DynamicBoxes);
|
||||
});
|
||||
})();
|
||||
|
||||
/**
|
||||
* Formats timestamp for display
|
||||
*/
|
||||
function PMA_formatDateTime(date, seconds) {
|
||||
var result = $.datepicker.formatDate('yy-mm-dd', date);
|
||||
var timefmt = 'HH:mm';
|
||||
if (seconds) {
|
||||
timefmt = 'HH:mm:ss';
|
||||
}
|
||||
return result + ' ' + $.datepicker.formatTime(
|
||||
timefmt, {
|
||||
hour: date.getHours(),
|
||||
minute: date.getMinutes(),
|
||||
second: date.getSeconds()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -1424,9 +1424,9 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
|
||||
function PMA_getLogAnalyseDialog(min, max) {
|
||||
$('#logAnalyseDialog input[name="dateStart"]')
|
||||
.val(formatDate(min, 'yyyy-MM-dd HH:mm:ss'));
|
||||
.val(PMA_formatDateTime(min, true));
|
||||
$('#logAnalyseDialog input[name="dateEnd"]')
|
||||
.val(formatDate(max, 'yyyy-MM-dd HH:mm:ss'));
|
||||
.val(PMA_formatDateTime(max, true));
|
||||
|
||||
var dlgBtns = { };
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ function getFieldName($this_field)
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('sql.js', function () {
|
||||
$('a.delete_row.ajax').unbind('click');
|
||||
$('a.delete_row.ajax').die('click');
|
||||
$('#bookmarkQueryForm').die('submit');
|
||||
$('input#bkm_label').unbind('keyup');
|
||||
$("#sqlqueryresults").die('makegrid');
|
||||
@ -104,7 +104,7 @@ AJAX.registerTeardown('sql.js', function () {
|
||||
*/
|
||||
AJAX.registerOnload('sql.js', function () {
|
||||
// Delete row from SQL results
|
||||
$('a.delete_row.ajax').click(function (e) {
|
||||
$('a.delete_row.ajax').live('click',function (e) {
|
||||
e.preventDefault();
|
||||
var question = $.sprintf(PMA_messages.strDoYouReally, $(this).closest('td').find('div').text());
|
||||
var $link = $(this);
|
||||
|
||||
@ -58,13 +58,13 @@ function isEmpty(obj) {
|
||||
**/
|
||||
function getTimeStamp(val, type) {
|
||||
if (type.toString().search(/datetime/i) != -1 || type.toString().search(/timestamp/i) != -1) {
|
||||
return getDateFromFormat(val, 'yyyy-MM-dd HH:mm:ss');
|
||||
return $.datepicker.parseDateTime('yy-mm-dd', 'HH:mm:ss', val);
|
||||
}
|
||||
else if (type.toString().search(/time/i) != -1) {
|
||||
return getDateFromFormat('1970-01-01 ' + val, 'yyyy-MM-dd HH:mm:ss');
|
||||
return $.datepicker.parseDateTime('yy-mm-dd', 'HH:mm:ss', '1970-01-01 ' + val);
|
||||
}
|
||||
else if (type.toString().search(/date/i) != -1) {
|
||||
return getDateFromFormat(val, 'yyyy-MM-dd');
|
||||
return $.datepicker.parseDate('yy-mm-dd', val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4957,10 +4957,10 @@ class PMA_DisplayResults
|
||||
|
||||
}
|
||||
|
||||
$messagge_qt = PMA_Message::notice(__('Query took %01.4f sec') . ')');
|
||||
$messagge_qt->addParam($this->__get('querytime'));
|
||||
$message_qt = PMA_Message::notice(__('Query took %01.4f sec') . ')');
|
||||
$message_qt->addParam($this->__get('querytime'));
|
||||
|
||||
$message->addMessage($messagge_qt, '');
|
||||
$message->addMessage($message_qt, '');
|
||||
if (! is_null($sorted_column_message)) {
|
||||
$message->addMessage($sorted_column_message, '');
|
||||
}
|
||||
|
||||
@ -1462,4 +1462,192 @@ function PMA_executeTheQuery($analyzed_sql_results, $full_sql_query, $is_gotofil
|
||||
isset($justBrowsing) ? $justBrowsing : null, $extra_data
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Delete related tranformatioinformationn information
|
||||
*
|
||||
* @param String $db current database
|
||||
* @param String $table current table
|
||||
* @param array $analyzed_sql analyzed sql query
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_deleteTransformationInfo($db, $table, $analyzed_sql)
|
||||
{
|
||||
include_once 'libraries/transformations.lib.php';
|
||||
if ($analyzed_sql[0]['querytype'] == 'ALTER') {
|
||||
if (stripos($analyzed_sql[0]['unsorted_query'], 'DROP') !== false) {
|
||||
$drop_column = PMA_getColumnNameInColumnDropSql(
|
||||
$analyzed_sql[0]['unsorted_query']
|
||||
);
|
||||
|
||||
if ($drop_column != '') {
|
||||
PMA_clearTransformations($db, $table, $drop_column);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (($analyzed_sql[0]['querytype'] == 'DROP') && ($table != '')) {
|
||||
PMA_clearTransformations($db, $table);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the message for the no rows returned case
|
||||
*
|
||||
* @param string $message_to_show message to show
|
||||
* @param array $analyzed_sql_results analyzed sql results
|
||||
* @param int $num_rows number of rows
|
||||
*
|
||||
* @return string $message
|
||||
*/
|
||||
function PMA_getMessageForNoRowsReturned($message_to_show, $analyzed_sql_results,
|
||||
$num_rows
|
||||
) {
|
||||
if ($analyzed_sql_results['is_delete']) {
|
||||
$message = PMA_Message::getMessageForDeletedRows($num_rows);
|
||||
} elseif ($analyzed_sql_results['is_insert']) {
|
||||
if ($analyzed_sql_results['is_replace']) {
|
||||
// For replace we get DELETED + INSERTED row count,
|
||||
// so we have to call it affected
|
||||
$message = PMA_Message::getMessageForAffectedRows($num_rows);
|
||||
} else {
|
||||
$message = PMA_Message::getMessageForInsertedRows($num_rows);
|
||||
}
|
||||
$insert_id = $GLOBALS['dbi']->insertId();
|
||||
if ($insert_id != 0) {
|
||||
// insert_id is id of FIRST record inserted in one insert,
|
||||
// so if we inserted multiple rows, we had to increment this
|
||||
$message->addMessage('[br]');
|
||||
// need to use a temporary because the Message class
|
||||
// currently supports adding parameters only to the first
|
||||
// message
|
||||
$_inserted = PMA_Message::notice(__('Inserted row id: %1$d'));
|
||||
$_inserted->addParam($insert_id + $num_rows - 1);
|
||||
$message->addMessage($_inserted);
|
||||
}
|
||||
} elseif ($analyzed_sql_results['is_affected']) {
|
||||
$message = PMA_Message::getMessageForAffectedRows($num_rows);
|
||||
|
||||
// Ok, here is an explanation for the !$is_select.
|
||||
// The form generated by sql_query_form.lib.php
|
||||
// and db_sql.php has many submit buttons
|
||||
// on the same form, and some confusion arises from the
|
||||
// fact that $message_to_show is sent for every case.
|
||||
// The $message_to_show containing a success message and sent with
|
||||
// the form should not have priority over errors
|
||||
} elseif (! empty($message_to_show) && ! $analyzed_sql_results['is_select']) {
|
||||
$message = PMA_Message::rawSuccess(htmlspecialchars($message_to_show));
|
||||
} elseif (! empty($GLOBALS['show_as_php'])) {
|
||||
$message = PMA_Message::success(__('Showing as PHP code'));
|
||||
} elseif (isset($GLOBALS['show_as_php'])) {
|
||||
/* User disable showing as PHP, query is only displayed */
|
||||
$message = PMA_Message::notice(__('Showing SQL query'));
|
||||
} elseif (! empty($GLOBALS['validatequery'])) {
|
||||
$message = PMA_Message::notice(__('Validated SQL'));
|
||||
} else {
|
||||
$message = PMA_Message::success(
|
||||
__('MySQL returned an empty result set (i.e. zero rows).')
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($GLOBALS['querytime'])) {
|
||||
$_querytime = PMA_Message::notice('(' . __('Query took %01.4f sec') . ')');
|
||||
$_querytime->addParam($GLOBALS['querytime']);
|
||||
$message->addMessage($_querytime);
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to send the Ajax response when no rows returned
|
||||
*
|
||||
* @param string $message message to be send
|
||||
* @param array $analyzed_sql analyzed sql
|
||||
* @param object $displayResultsObject DisplayResult instance
|
||||
* @param bool $showSql whether to show sql or not
|
||||
* @param array $extra_data extra data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_sendAjaxResponseForNoResultsReturned($message, $analyzed_sql,
|
||||
$displayResultsObject, $showSql, $extra_data
|
||||
) {
|
||||
/**
|
||||
* @todo find a better way to make getMessage() in Header.class.php
|
||||
* output the intended message
|
||||
*/
|
||||
$GLOBALS['message'] = $message;
|
||||
|
||||
if ($showSql) {
|
||||
$extra_data['sql_query'] = PMA_Util::getMessage(
|
||||
$message, $GLOBALS['sql_query'], 'success'
|
||||
);
|
||||
}
|
||||
if (isset($GLOBALS['reload']) && $GLOBALS['reload'] == 1) {
|
||||
$extra_data['reload'] = 1;
|
||||
$extra_data['db'] = $GLOBALS['db'];
|
||||
}
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess($message->isSuccess());
|
||||
// No need to manually send the message
|
||||
// The Response class will handle that automatically
|
||||
$query__type = PMA_DisplayResults::QUERY_TYPE_SELECT;
|
||||
if ($analyzed_sql[0]['querytype'] == $query__type) {
|
||||
$createViewHTML = $displayResultsObject->getCreateViewQueryResultOp(
|
||||
$analyzed_sql
|
||||
);
|
||||
$response->addHTML($createViewHTML.'<br />');
|
||||
}
|
||||
|
||||
$response->addJSON(isset($extra_data) ? $extra_data : array());
|
||||
if (empty($_REQUEST['ajax_page_request'])) {
|
||||
$response->addJSON('message', $message);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to respond back when the query returns zero rows
|
||||
* This method is called
|
||||
* 1-> When browsing an empty table
|
||||
* 2-> When executing a query on a non empty table which returns zero results
|
||||
* 3-> When executing a query on an empty table
|
||||
* 4-> When executing an INSERT, UPDATE, DEDETE query from the SQL tab
|
||||
* 5-> When deleting a row from BROWSE tab
|
||||
* 6-> When searching using the SEARCH tab which returns zero results
|
||||
* 7-> When changing the structure of the table except change operation
|
||||
*
|
||||
* @param array $analyzed_sql_results analyzed sql results
|
||||
* @param string $db current database
|
||||
* @param string $table current table
|
||||
* @param string $message_to_show message to show
|
||||
* @param int $num_rows number of rows
|
||||
* @param object $displayResultsObject DisplayResult instance
|
||||
* @param array $extra_data extra data
|
||||
* @param array $cfg configuration
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_sendResponseForNoResultsReturned($analyzed_sql_results, $db, $table,
|
||||
$message_to_show, $num_rows, $displayResultsObject, $extra_data, $cfg
|
||||
) {
|
||||
if (PMA_isDeleteTransformationInfo($analyzed_sql_results)) {
|
||||
PMA_deleteTransformationInfo(
|
||||
$db, $table, $analyzed_sql_results['analyzed_sql']
|
||||
);
|
||||
}
|
||||
|
||||
$message = PMA_getMessageForNoRowsReturned(
|
||||
isset($message_to_show) ? $message_to_show : null, $analyzed_sql_results,
|
||||
$num_rows
|
||||
);
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
PMA_sendAjaxResponseForNoResultsReturned($message,
|
||||
$analyzed_sql_results['analyzed_sql'],
|
||||
$displayResultsObject, $cfg['ShowSQL'],
|
||||
isset($extra_data) ? $extra_data : null
|
||||
);
|
||||
}
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
|
||||
29
po/sl.po
29
po/sl.po
@ -4,16 +4,16 @@ msgstr ""
|
||||
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
|
||||
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
|
||||
"POT-Creation-Date: 2013-07-04 06:07-0400\n"
|
||||
"PO-Revision-Date: 2013-06-24 22:19+0200\n"
|
||||
"PO-Revision-Date: 2013-07-07 17:12+0200\n"
|
||||
"Last-Translator: Domen <dbc334@gmail.com>\n"
|
||||
"Language-Team: Slovenian <http://l10n.cihar.com/projects/phpmyadmin/master/"
|
||||
"sl/>\n"
|
||||
"Language-Team: Slovenian "
|
||||
"<http://l10n.cihar.com/projects/phpmyadmin/master/sl/>\n"
|
||||
"Language: sl\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: sl\n"
|
||||
"Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%"
|
||||
"100==4 ? 2 : 3;\n"
|
||||
"Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
|
||||
"%100==4 ? 2 : 3;\n"
|
||||
"X-Generator: Weblate 1.6-dev\n"
|
||||
|
||||
#: browse_foreigners.php:51 browse_foreigners.php:75 js/messages.php:339
|
||||
@ -3316,38 +3316,33 @@ msgid "Find"
|
||||
msgstr "Najdi:"
|
||||
|
||||
#: libraries/TableSearch.class.php:1273
|
||||
#, fuzzy
|
||||
#| msgid "Replace NULL with"
|
||||
msgid "Replace with"
|
||||
msgstr "Zamenjaj NULL z"
|
||||
msgstr "Zamenjaj z"
|
||||
|
||||
#: libraries/TableSearch.class.php:1333
|
||||
msgid "Find and replace - preview"
|
||||
msgstr ""
|
||||
msgstr "Najdi in zamenjaj - predogled"
|
||||
|
||||
#: libraries/TableSearch.class.php:1337
|
||||
#, fuzzy
|
||||
#| msgid "Column"
|
||||
msgid "Count"
|
||||
msgstr "Stolpec"
|
||||
msgstr "Štetje"
|
||||
|
||||
#: libraries/TableSearch.class.php:1338
|
||||
#, fuzzy
|
||||
#| msgid "Original position"
|
||||
msgid "Original string"
|
||||
msgstr "Izvirni položaj"
|
||||
msgstr "Izvirni niz"
|
||||
|
||||
#: libraries/TableSearch.class.php:1339
|
||||
#, fuzzy
|
||||
#| msgid "Related Links"
|
||||
msgid "Replaced string"
|
||||
msgstr "Sorodne povezave"
|
||||
msgstr "Zamenjani nizi"
|
||||
|
||||
#: libraries/TableSearch.class.php:1364
|
||||
#, fuzzy
|
||||
#| msgid "Replicated"
|
||||
msgid "Replace"
|
||||
msgstr "Podvojeno"
|
||||
msgstr "Zamenjaj"
|
||||
|
||||
#: libraries/Theme.class.php:170
|
||||
#, php-format
|
||||
|
||||
@ -93,7 +93,6 @@ $scripts->addFile('jqplot/plugins/jqplot.dateAxisRenderer.js');
|
||||
$scripts->addFile('jqplot/plugins/jqplot.highlighter.js');
|
||||
$scripts->addFile('jqplot/plugins/jqplot.cursor.js');
|
||||
$scripts->addFile('jqplot/plugins/jqplot.byteFormatter.js');
|
||||
$scripts->addFile('date.js');
|
||||
|
||||
$scripts->addFile('server_status_monitor.js');
|
||||
$scripts->addFile('server_status_sorter.js');
|
||||
|
||||
149
sql.php
149
sql.php
@ -222,150 +222,11 @@ list($result, $num_rows, $unlim_num_rows, $profiling_results,
|
||||
|
||||
// No rows returned -> move back to the calling page
|
||||
if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
|
||||
// Delete related tranformation information
|
||||
if (PMA_isDeleteTransformationInfo($analyzed_sql_results)) {
|
||||
include_once 'libraries/transformations.lib.php';
|
||||
if ($analyzed_sql[0]['querytype'] == 'ALTER') {
|
||||
if (stripos($analyzed_sql[0]['unsorted_query'], 'DROP') !== false) {
|
||||
$drop_column = PMA_getColumnNameInColumnDropSql(
|
||||
$analyzed_sql[0]['unsorted_query']
|
||||
);
|
||||
|
||||
if ($drop_column != '') {
|
||||
PMA_clearTransformations($db, $table, $drop_column);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (($analyzed_sql[0]['querytype'] == 'DROP') && ($table != '')) {
|
||||
PMA_clearTransformations($db, $table);
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_delete) {
|
||||
$message = PMA_Message::getMessageForDeletedRows($num_rows);
|
||||
} elseif ($is_insert) {
|
||||
if ($is_replace) {
|
||||
// For replace we get DELETED + INSERTED row count,
|
||||
// so we have to call it affected
|
||||
$message = PMA_Message::getMessageForAffectedRows($num_rows);
|
||||
} else {
|
||||
$message = PMA_Message::getMessageForInsertedRows($num_rows);
|
||||
}
|
||||
$insert_id = $GLOBALS['dbi']->insertId();
|
||||
if ($insert_id != 0) {
|
||||
// insert_id is id of FIRST record inserted in one insert,
|
||||
// so if we inserted multiple rows, we had to increment this
|
||||
$message->addMessage('[br]');
|
||||
// need to use a temporary because the Message class
|
||||
// currently supports adding parameters only to the first
|
||||
// message
|
||||
$_inserted = PMA_Message::notice(__('Inserted row id: %1$d'));
|
||||
$_inserted->addParam($insert_id + $num_rows - 1);
|
||||
$message->addMessage($_inserted);
|
||||
}
|
||||
} elseif ($is_affected) {
|
||||
$message = PMA_Message::getMessageForAffectedRows($num_rows);
|
||||
|
||||
// Ok, here is an explanation for the !$is_select.
|
||||
// The form generated by sql_query_form.lib.php
|
||||
// and db_sql.php has many submit buttons
|
||||
// on the same form, and some confusion arises from the
|
||||
// fact that $message_to_show is sent for every case.
|
||||
// The $message_to_show containing a success message and sent with
|
||||
// the form should not have priority over errors
|
||||
} elseif (! empty($message_to_show) && ! $is_select) {
|
||||
$message = PMA_Message::rawSuccess(htmlspecialchars($message_to_show));
|
||||
} elseif (! empty($GLOBALS['show_as_php'])) {
|
||||
$message = PMA_Message::success(__('Showing as PHP code'));
|
||||
} elseif (isset($GLOBALS['show_as_php'])) {
|
||||
/* User disable showing as PHP, query is only displayed */
|
||||
$message = PMA_Message::notice(__('Showing SQL query'));
|
||||
} elseif (! empty($GLOBALS['validatequery'])) {
|
||||
$message = PMA_Message::notice(__('Validated SQL'));
|
||||
} else {
|
||||
$message = PMA_Message::success(
|
||||
__('MySQL returned an empty result set (i.e. zero rows).')
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($GLOBALS['querytime'])) {
|
||||
$_querytime = PMA_Message::notice('(' . __('Query took %01.4f sec') . ')');
|
||||
$_querytime->addParam($GLOBALS['querytime']);
|
||||
$message->addMessage($_querytime);
|
||||
}
|
||||
|
||||
if ($GLOBALS['is_ajax_request'] == true) {
|
||||
if ($cfg['ShowSQL']) {
|
||||
$extra_data['sql_query'] = PMA_Util::getMessage(
|
||||
$message, $GLOBALS['sql_query'], 'success'
|
||||
);
|
||||
}
|
||||
if (isset($GLOBALS['reload']) && $GLOBALS['reload'] == 1) {
|
||||
$extra_data['reload'] = 1;
|
||||
$extra_data['db'] = $GLOBALS['db'];
|
||||
}
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->isSuccess($message->isSuccess());
|
||||
// No need to manually send the message
|
||||
// The Response class will handle that automatically
|
||||
$query__type = PMA_DisplayResults::QUERY_TYPE_SELECT;
|
||||
if ($analyzed_sql[0]['querytype'] == $query__type) {
|
||||
$createViewHTML = $displayResultsObject->getCreateViewQueryResultOp(
|
||||
$analyzed_sql
|
||||
);
|
||||
$response->addHTML($createViewHTML.'<br />');
|
||||
}
|
||||
|
||||
$response->addJSON(isset($extra_data) ? $extra_data : array());
|
||||
if (empty($_REQUEST['ajax_page_request'])) {
|
||||
$response->addJSON('message', $message);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_gotofile) {
|
||||
$goto = PMA_securePath($goto);
|
||||
// Checks for a valid target script
|
||||
$is_db = $is_table = false;
|
||||
if (isset($_REQUEST['purge']) && $_REQUEST['purge'] == '1') {
|
||||
$table = '';
|
||||
unset($url_params['table']);
|
||||
}
|
||||
include 'libraries/db_table_exists.lib.php';
|
||||
|
||||
if (strpos($goto, 'tbl_') === 0 && ! $is_table) {
|
||||
if (strlen($table)) {
|
||||
$table = '';
|
||||
}
|
||||
$goto = 'db_sql.php';
|
||||
}
|
||||
if (strpos($goto, 'db_') === 0 && ! $is_db) {
|
||||
if (strlen($db)) {
|
||||
$db = '';
|
||||
}
|
||||
$goto = 'index.php';
|
||||
}
|
||||
// Loads to target script
|
||||
if (strlen($goto) > 0) {
|
||||
$active_page = $goto;
|
||||
include '' . $goto;
|
||||
} else {
|
||||
// Echo at least one character to prevent showing last page from history
|
||||
echo " ";
|
||||
}
|
||||
|
||||
} else {
|
||||
// avoid a redirect loop when last record was deleted
|
||||
if (0 == $num_rows && 'sql.php' == $cfg['DefaultTabTable']) {
|
||||
$goto = str_replace('sql.php', 'tbl_structure.php', $goto);
|
||||
}
|
||||
PMA_sendHeaderLocation(
|
||||
$cfg['PmaAbsoluteUri'] . str_replace('&', '&', $goto)
|
||||
. '&message=' . urlencode($message)
|
||||
);
|
||||
} // end else
|
||||
exit();
|
||||
// end no rows returned
|
||||
PMA_sendResponseForNoResultsReturned($analyzed_sql_results, $db, $table,
|
||||
isset($message_to_show) ? $message_to_show : null,
|
||||
$num_rows, $displayResultsObject, $extra_data, $cfg
|
||||
);
|
||||
|
||||
} else {
|
||||
$html_output='';
|
||||
// At least one row is returned -> displays a table with results
|
||||
|
||||
@ -12,23 +12,9 @@
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/mime.lib.php';
|
||||
|
||||
/**
|
||||
* Sets globals from $_GET
|
||||
*/
|
||||
$get_params = array(
|
||||
'where_clause',
|
||||
'transform_key'
|
||||
);
|
||||
|
||||
foreach ($get_params as $one_get_param) {
|
||||
if (isset($_GET[$one_get_param])) {
|
||||
$GLOBALS[$one_get_param] = $_GET[$one_get_param];
|
||||
}
|
||||
}
|
||||
|
||||
/* Check parameters */
|
||||
PMA_Util::checkParameters(
|
||||
array('db', 'table', 'where_clause', 'transform_key')
|
||||
array('db', 'table')
|
||||
);
|
||||
|
||||
/* Select database */
|
||||
@ -45,9 +31,9 @@ if (!$GLOBALS['dbi']->getColumns($db, $table)) {
|
||||
}
|
||||
|
||||
/* Grab data */
|
||||
$sql = 'SELECT ' . PMA_Util::backquote($transform_key)
|
||||
$sql = 'SELECT ' . PMA_Util::backquote($_GET['transform_key'])
|
||||
. ' FROM ' . PMA_Util::backquote($table)
|
||||
. ' WHERE ' . $where_clause . ';';
|
||||
. ' WHERE ' . $_GET['where_clause'] . ';';
|
||||
$result = $GLOBALS['dbi']->fetchValue($sql);
|
||||
|
||||
/* Check return code */
|
||||
@ -59,7 +45,7 @@ if ($result === false) {
|
||||
@ini_set('url_rewriter.tags', '');
|
||||
|
||||
PMA_downloadHeader(
|
||||
$table . '-' . $transform_key . '.bin',
|
||||
$table . '-' . $_GET['transform_key'] . '.bin',
|
||||
PMA_detectMIME($result),
|
||||
strlen($result)
|
||||
);
|
||||
|
||||
@ -21,7 +21,6 @@ $header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('makegrid.js');
|
||||
$scripts->addFile('sql.js');
|
||||
$scripts->addFile('date.js');
|
||||
/* < IE 9 doesn't support canvas natively */
|
||||
if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
|
||||
$scripts->addFile('canvg/flashcanvas.js');
|
||||
|
||||
141
test/libraries/PMA_relation_test.php
Normal file
141
test/libraries/PMA_relation_test.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for relation.lib.php
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/Theme.class.php';
|
||||
require_once 'libraries/php-gettext/gettext.inc';
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/Tracker.class.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
|
||||
class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['cfg']['Server']['user'] = 'root';
|
||||
$GLOBALS['cfg']['Server']['pmadb'] = 'phpmyadmin';
|
||||
$_SESSION['relation'][$GLOBALS['server']] = "PMA_relation";
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
|
||||
$GLOBALS['pmaThemePath'] = $_SESSION['PMA_Theme']->getPath();
|
||||
$GLOBALS['pmaThemeImage'] = 'theme/';
|
||||
|
||||
include_once 'libraries/relation.lib.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_queryAsControlUser
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPMA_queryAsControlUser()
|
||||
{
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->will($this->returnValue('executeResult1'));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('tryQuery')
|
||||
->will($this->returnValue('executeResult2'));
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$sql = "insert into PMA_bookmark A,B values(1, 2)";
|
||||
$this->assertEquals(
|
||||
'executeResult1',
|
||||
PMA_queryAsControlUser($sql)
|
||||
);
|
||||
$this->assertEquals(
|
||||
'executeResult2',
|
||||
PMA_queryAsControlUser($sql, false)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_getRelationsParam & PMA_getRelationsParamDiagnostic
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPMA_getRelationsParam()
|
||||
{
|
||||
$GLOBALS['cfg']['ServerDefault'] = 0;
|
||||
$_SESSION['relation'] = array();
|
||||
|
||||
$relationsPara = PMA_getRelationsParam();
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$relationsPara['relwork']
|
||||
);
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$relationsPara['bookmarkwork']
|
||||
);
|
||||
$this->assertEquals(
|
||||
'root',
|
||||
$relationsPara['user']
|
||||
);
|
||||
$this->assertEquals(
|
||||
'phpmyadmin',
|
||||
$relationsPara['db']
|
||||
);
|
||||
|
||||
$retval = PMA_getRelationsParamDiagnostic($relationsPara);
|
||||
//check $cfg['Servers'][$i]['pmadb']
|
||||
$this->assertContains(
|
||||
"\$cfg['Servers'][\$i]['pmadb']",
|
||||
$retval
|
||||
);
|
||||
$this->assertContains(
|
||||
'<strong>OK</strong>',
|
||||
$retval
|
||||
);
|
||||
|
||||
//$cfg['Servers'][$i]['relation']
|
||||
$result = "\$cfg['Servers'][\$i]['pmadb'] ... </th><td class=\"right\">"
|
||||
. "<font color=\"green\"><strong>OK</strong></font>";
|
||||
$this->assertContains(
|
||||
$result,
|
||||
$retval
|
||||
);
|
||||
// $cfg['Servers'][$i]['relation']
|
||||
$result = "\$cfg['Servers'][\$i]['relation'] ... </th><td class=\"right\">"
|
||||
. "<font color=\"red\"><strong>not OK</strong></font>";
|
||||
$this->assertContains(
|
||||
$result,
|
||||
$retval
|
||||
);
|
||||
// General relation features
|
||||
$result = 'General relation features: <font color="red">Disabled</font>';
|
||||
$this->assertContains(
|
||||
$result,
|
||||
$retval
|
||||
);
|
||||
// $cfg['Servers'][$i]['table_info']
|
||||
$result = "\$cfg['Servers'][\$i]['table_info'] ... </th><td class=\"right\">"
|
||||
. "<font color=\"red\"><strong>not OK</strong></font>";
|
||||
$this->assertContains(
|
||||
$result,
|
||||
$retval
|
||||
);
|
||||
// Display Features:
|
||||
$result = 'Display Features: <font color="red">Disabled</font>';
|
||||
$this->assertContains(
|
||||
$result,
|
||||
$retval
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ header('Content-Type: text/html; charset=utf-8');
|
||||
href="../phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
|
||||
<link rel="stylesheet" type="text/css" media="print"
|
||||
href="../print.css" />
|
||||
<script src="../js/jquery/jquery-1.8.3.js" type="text/javascript"></script>
|
||||
<script src="../js/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
|
||||
<script src="../js/messages.php" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var PMA_TEST_THEME = true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user