Merge branch 'master' of github.com:phpmyadmin/phpmyadmin

This commit is contained in:
Madhura Jayaratne 2017-06-13 21:50:24 +10:00
commit 522f1a714e
76 changed files with 2172 additions and 1757 deletions

View File

@ -27,6 +27,7 @@ phpMyAdmin - ChangeLog
- issue #13343 Fixed editing QBE
- issue #13193 Improved documentation on user settings
- issue #13092 Gracefully handle early fatal errors in AJAX requests
- issue #13327 Fixed Incorrect NavigationTreeEnableExpansion default value in the documentation
4.7.1 (2017-05-25)
- issue #13132 Always execute tracking queries as controluser

View File

@ -29,7 +29,6 @@ $container->alias('response', 'PMA\libraries\Response');
/* Define dependencies for the concerned controller */
$dependency_definitions = array(
'db' => $db,
'url_query' => &$GLOBALS['url_query'],
);
/** @var DatabaseStructureController $controller */

View File

@ -1995,7 +1995,7 @@ Navigation panel setup
.. config:option:: $cfg['NavigationTreeEnableExpansion']
:type: boolean
:default: false
:default: true
Whether to offer the possibility of tree expansion in the navigation panel.

View File

@ -1,4 +1,6 @@
Copyright (C) 2016 by Marijn Haverbeke <marijnh@gmail.com> and others
MIT License
Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -14,6 +14,7 @@
var tables;
var defaultTable;
var keywords;
var identifierQuote;
var CONS = {
QUERY_DIV: ";",
ALIAS_KEYWORD: "AS"
@ -28,6 +29,12 @@
return CodeMirror.resolveMode(mode).keywords;
}
function getIdentifierQuote(editor) {
var mode = editor.doc.modeOption;
if (mode === "sql") mode = "text/x-sql";
return CodeMirror.resolveMode(mode).identifierQuote || "`";
}
function getText(item) {
return typeof item == "string" ? item : item.text;
}
@ -86,17 +93,25 @@
}
function cleanName(name) {
// Get rid name from backticks(`) and preceding dot(.)
// Get rid name from identifierQuote and preceding dot(.)
if (name.charAt(0) == ".") {
name = name.substr(1);
}
return name.replace(/`/g, "");
// replace doublicated identifierQuotes with single identifierQuotes
// and remove single identifierQuotes
var nameParts = name.split(identifierQuote+identifierQuote);
for (var i = 0; i < nameParts.length; i++)
nameParts[i] = nameParts[i].replace(new RegExp(identifierQuote,"g"), "");
return nameParts.join(identifierQuote);
}
function insertBackticks(name) {
function insertIdentifierQuotes(name) {
var nameParts = getText(name).split(".");
for (var i = 0; i < nameParts.length; i++)
nameParts[i] = "`" + nameParts[i] + "`";
nameParts[i] = identifierQuote +
// doublicate identifierQuotes
nameParts[i].replace(new RegExp(identifierQuote,"g"), identifierQuote+identifierQuote) +
identifierQuote;
var escaped = nameParts.join(".");
if (typeof name == "string") return escaped;
name = shallowClone(name);
@ -106,13 +121,13 @@
function nameCompletion(cur, token, result, editor) {
// Try to complete table, column names and return start position of completion
var useBacktick = false;
var useIdentifierQuotes = false;
var nameParts = [];
var start = token.start;
var cont = true;
while (cont) {
cont = (token.string.charAt(0) == ".");
useBacktick = useBacktick || (token.string.charAt(0) == "`");
useIdentifierQuotes = useIdentifierQuotes || (token.string.charAt(0) == identifierQuote);
start = token.start;
nameParts.unshift(cleanName(token.string));
@ -127,12 +142,12 @@
// Try to complete table names
var string = nameParts.join(".");
addMatches(result, string, tables, function(w) {
return useBacktick ? insertBackticks(w) : w;
return useIdentifierQuotes ? insertIdentifierQuotes(w) : w;
});
// Try to complete columns from defaultTable
addMatches(result, string, defaultTable, function(w) {
return useBacktick ? insertBackticks(w) : w;
return useIdentifierQuotes ? insertIdentifierQuotes(w) : w;
});
// Try to complete columns
@ -162,7 +177,7 @@
w = shallowClone(w);
w.text = tableInsert + "." + w.text;
}
return useBacktick ? insertBackticks(w) : w;
return useIdentifierQuotes ? insertIdentifierQuotes(w) : w;
});
}
@ -170,12 +185,9 @@
}
function eachWord(lineText, f) {
if (!lineText) return;
var excepted = /[,;]/g;
var words = lineText.split(" ");
for (var i = 0; i < words.length; i++) {
f(words[i]?words[i].replace(excepted, '') : '');
}
var words = lineText.split(/\s+/)
for (var i = 0; i < words.length; i++)
if (words[i]) f(words[i].replace(/[,;]/g, ''))
}
function findTableByAlias(alias, editor) {
@ -232,6 +244,7 @@
var disableKeywords = options && options.disableKeywords;
defaultTable = defaultTableName && getTable(defaultTableName);
keywords = getKeywords(editor);
identifierQuote = getIdentifierQuote(editor);
if (defaultTableName && !defaultTable)
defaultTable = findTableByAlias(defaultTableName, editor);
@ -249,7 +262,7 @@
token.string = token.string.slice(0, cur.ch - token.start);
}
if (token.string.match(/^[.`\w@]\w*$/)) {
if (token.string.match(/^[.`"\w@]\w*$/)) {
search = token.string;
start = token.start;
end = token.end;
@ -257,7 +270,7 @@
start = end = cur.ch;
search = "";
}
if (search.charAt(0) == "." || search.charAt(0) == "`") {
if (search.charAt(0) == "." || search.charAt(0) == identifierQuote) {
start = nameCompletion(cur, token, result, editor);
} else {
addMatches(result, search, tables, function(w) {return w;});

View File

@ -140,7 +140,12 @@
if (options.async || getAnnotations.async) {
lintAsync(cm, getAnnotations, passOptions)
} else {
updateLinting(cm, getAnnotations(cm.getValue(), passOptions, cm));
var annotations = getAnnotations(cm.getValue(), passOptions, cm);
if (!annotations) return;
if (annotations.then) annotations.then(function(issues) {
updateLinting(cm, issues);
});
else updateLinting(cm, annotations);
}
}

View File

@ -30,7 +30,6 @@ CodeMirror.sqlLint = function(text, updateLinting, options, cm) {
dataType: 'json',
data: {
sql_query: text,
token: PMA_commonParams.get('token'),
server: PMA_commonParams.get('server'),
options: options.lintOptions,
no_history: true,

View File

@ -223,11 +223,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
cursor: default;
z-index: 4;
}
.CodeMirror-gutter-wrapper {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
.CodeMirror-lines {
cursor: text;
@ -272,6 +269,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
.CodeMirror-widget {}
.CodeMirror-rtl pre { direction: rtl; }
.CodeMirror-code {
outline: none;
}

File diff suppressed because it is too large Load Diff

View File

@ -54,7 +54,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
"namespace": C,
"module": kw("module"),
"enum": kw("module"),
"type": kw("type"),
// scope modifiers
"public": kw("modifier"),
@ -77,7 +76,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return jsKeywords;
}();
var isOperatorChar = /[+\-*&%=<>!?|~^]/;
var isOperatorChar = /[+\-*&%=<>!?|~^@]/;
var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
function readRegexp(stream) {
@ -361,8 +360,15 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
}
if (type == "function") return cont(functiondef);
if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
if (type == "variable") return cont(pushlex("stat"), maybelabel);
if (type == "switch") return cont(pushlex("form"), parenExpr, pushlex("}", "switch"), expect("{"),
if (type == "variable") {
if (isTS && value == "type") {
cx.marked = "keyword"
return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
} else {
return cont(pushlex("stat"), maybelabel);
}
}
if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"),
block, poplex, poplex);
if (type == "case") return cont(expression, expect(":"));
if (type == "default") return cont(expect(":"));
@ -371,9 +377,9 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "class") return cont(pushlex("form"), className, poplex);
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
if (type == "module") return cont(pushlex("form"), pattern, pushlex("}"), expect("{"), block, poplex, poplex)
if (type == "type") return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
if (type == "module") return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)
if (type == "async") return cont(statement)
if (value == "@") return cont(expression, statement)
return pass(pushlex("stat"), expression, expect(";"), poplex);
}
function expression(type) {
@ -505,9 +511,9 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == ":") return cont(expressionNoComma);
if (type == "(") return pass(functiondef);
}
function commasep(what, end) {
function commasep(what, end, sep) {
function proceed(type, value) {
if (type == ",") {
if (sep ? sep.indexOf(type) > -1 : type == ",") {
var lex = cx.state.lexical;
if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
return cont(function(type, value) {
@ -541,18 +547,22 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function typeexpr(type) {
if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
if (type == "string" || type == "number" || type == "atom") return cont(afterType);
if (type == "{") return cont(commasep(typeprop, "}"))
if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType)
if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
}
function maybeReturnType(type) {
if (type == "=>") return cont(typeexpr)
}
function typeprop(type) {
function typeprop(type, value) {
if (type == "variable" || cx.style == "keyword") {
cx.marked = "property"
return cont(typeprop)
} else if (value == "?") {
return cont(typeprop)
} else if (type == ":") {
return cont(typeexpr)
} else if (type == "[") {
return cont(expression, maybetype, expect("]"), typeprop)
}
}
function typearg(type) {
@ -563,6 +573,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
if (value == "|" || type == ".") return cont(typeexpr)
if (type == "[") return cont(expect("]"), afterType)
if (value == "extends") return cont(typeexpr)
}
function vardef() {
return pass(pattern, maybetype, maybeAssign, vardefCont);
@ -618,6 +629,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
if (type == "variable") {register(value); return cont(functiondef);}
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext);
if (isTS && value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, functiondef)
}
function funarg(type) {
if (type == "spread") return cont(funarg);
@ -632,12 +644,14 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "variable") {register(value); return cont(classNameAfter);}
}
function classNameAfter(type, value) {
if (value == "extends" || value == "implements") return cont(isTS ? typeexpr : expression, classNameAfter);
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, classNameAfter)
if (value == "extends" || value == "implements" || (isTS && type == ","))
return cont(isTS ? typeexpr : expression, classNameAfter);
if (type == "{") return cont(pushlex("}"), classBody, poplex);
}
function classBody(type, value) {
if (type == "variable" || cx.style == "keyword") {
if ((value == "static" || value == "get" || value == "set" ||
if ((value == "async" || value == "static" || value == "get" || value == "set" ||
(isTS && (value == "public" || value == "private" || value == "protected" || value == "readonly" || value == "abstract"))) &&
cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false)) {
cx.marked = "keyword";
@ -646,16 +660,20 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
cx.marked = "property";
return cont(isTS ? classfield : functiondef, classBody);
}
if (type == "[")
return cont(expression, expect("]"), isTS ? classfield : functiondef, classBody)
if (value == "*") {
cx.marked = "keyword";
return cont(classBody);
}
if (type == ";") return cont(classBody);
if (type == "}") return cont();
if (value == "@") return cont(expression, classBody)
}
function classfield(type, value) {
if (value == "?") return cont(classfield)
if (type == ":") return cont(typeexpr, maybeAssign)
if (value == "=") return cont(expressionNoComma)
return pass(functiondef)
}
function afterExport(type, value) {

View File

@ -217,6 +217,19 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
return stream.eatWhile(/\w/) ? "variable-2" : null;
}
// "identifier"
function hookIdentifierDoublequote(stream) {
// Standard SQL /SQLite identifiers
// ref: http://web.archive.org/web/20160813185132/http://savage.net.au/SQL/sql-99.bnf.html#delimited%20identifier
// ref: http://sqlite.org/lang_keywords.html
var ch;
while ((ch = stream.next()) != null) {
if (ch == "\"" && !stream.eat("\"")) return "variable-2";
}
stream.backUp(stream.current().length - 1);
return stream.eatWhile(/\w/) ? "variable-2" : null;
}
// variable token
function hookVar(stream) {
// variables
@ -322,6 +335,36 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
}
});
// provided by the phpLiteAdmin project - phpliteadmin.org
CodeMirror.defineMIME("text/x-sqlite", {
name: "sql",
// commands of the official SQLite client, ref: https://www.sqlite.org/cli.html#dotcmd
client: set("auth backup bail binary changes check clone databases dbinfo dump echo eqp exit explain fullschema headers help import imposter indexes iotrace limit lint load log mode nullvalue once open output print prompt quit read restore save scanstats schema separator session shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width"),
// ref: http://sqlite.org/lang_keywords.html
keywords: set(sqlKeywords + "abort action add after all analyze attach autoincrement before begin cascade case cast check collate column commit conflict constraint cross current_date current_time current_timestamp database default deferrable deferred detach each else end escape except exclusive exists explain fail for foreign full glob if ignore immediate index indexed initially inner instead intersect isnull key left limit match natural no notnull null of offset outer plan pragma primary query raise recursive references regexp reindex release rename replace restrict right rollback row savepoint temp temporary then to transaction trigger unique using vacuum view virtual when with without"),
// SQLite is weakly typed, ref: http://sqlite.org/datatype3.html. This is just a list of some common types.
builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text clob bigint int int2 int8 integer float double char varchar date datetime year unsigned signed numeric real"),
// ref: http://sqlite.org/syntax/literal-value.html
atoms: set("null current_date current_time current_timestamp"),
// ref: http://sqlite.org/lang_expr.html#binaryops
operatorChars: /^[*+\-%<>!=&|/~]/,
// SQLite is weakly typed, ref: http://sqlite.org/datatype3.html. This is just a list of some common types.
dateSQL: set("date time timestamp datetime"),
support: set("decimallessFloat zerolessFloat"),
identifierQuote: "\"", //ref: http://sqlite.org/lang_keywords.html
hooks: {
// bind-parameters ref:http://sqlite.org/lang_expr.html#varparam
"@": hookVar,
":": hookVar,
"?": hookVar,
"$": hookVar,
// The preferred way to escape Identifiers is using double quotes, ref: http://sqlite.org/lang_keywords.html
"\"": hookIdentifierDoublequote,
// there is also support for backtics, ref: http://sqlite.org/lang_keywords.html
"`": hookIdentifier
}
});
// the query language used by Apache Cassandra is called CQL, but this mime type
// is called Cassandra to avoid confusion with Contextual Query Language
CodeMirror.defineMIME("text/x-cassandra", {

View File

@ -482,7 +482,6 @@ PMA_DROP_IMPORT = {
fd.append('noplugin', Math.random().toString(36).substring(2, 12));
fd.append('db', dbname);
fd.append('server', server);
fd.append('token', PMA_commonParams.get('token'));
fd.append('import_type', 'database');
// todo: method to find the value below
fd.append('MAX_FILE_SIZE', '4194304');

View File

@ -799,7 +799,6 @@ function savePrefsToLocalStorage(form)
data: {
ajax_request: true,
server: PMA_commonParams.get('server'),
token: PMA_commonParams.get('token'),
submit_get_json: true
},
success: function (data) {
@ -853,7 +852,6 @@ function offerPrefsAutoimport()
if ($a.attr('href') == '#no') {
$cnt.remove();
$.post('index.php', {
token: PMA_commonParams.get('token'),
server: PMA_commonParams.get('server'),
prefs_autoload: 'hide'
}, null, 'html');
@ -862,7 +860,6 @@ function offerPrefsAutoimport()
$cnt.remove();
localStorage.clear();
$.post('index.php', {
token: PMA_commonParams.get('token'),
server: PMA_commonParams.get('server'),
prefs_autoload: 'hide'
}, null, 'html');

View File

@ -64,11 +64,11 @@ var PMA_console = {
PMA_console.isEnabled = true;
// Cookie var checks and init
if (! $.cookie('pma_console_height')) {
$.cookie('pma_console_height', 92);
if (! Cookies.get('pma_console_height')) {
Cookies.set('pma_console_height', 92);
}
if (! $.cookie('pma_console_mode')) {
$.cookie('pma_console_mode', 'info');
if (! Cookies.get('pma_console_mode')) {
Cookies.set('pma_console_mode', 'info');
}
// Vars init
@ -85,18 +85,17 @@ var PMA_console = {
'<input name="server" value="">' +
'<input name="db" value="">' +
'<input name="table" value="">' +
'<input name="token" value="' +
PMA_commonParams.get('token') +
'">' +
'<input name="token" value="">' +
'</form>'
);
PMA_console.$requestForm.children('[name=token]').val(PMA_commonParams.get('token'));
PMA_console.$requestForm.on('submit', AJAX.requestHandler);
// Event binds shouldn't run again
if (PMA_console.isInitialized === false) {
// Load config first
var tempConfig = JSON.parse($.cookie('pma_console_config'));
var tempConfig = Cookies.getJSON('pma_console_config');
if (tempConfig) {
if (tempConfig.alwaysExpand === true) {
$('#pma_console_options input[name=always_expand]').prop('checked', true);
@ -205,13 +204,13 @@ var PMA_console = {
}
// Change console mode from cookie
switch($.cookie('pma_console_mode')) {
switch(Cookies.get('pma_console_mode')) {
case 'collapse':
PMA_console.collapse();
break;
/* jshint -W086 */// no break needed in default section
default:
$.cookie('pma_console_mode', 'info');
Cookies.set('pma_console_mode', 'info');
case 'info':
/* jshint +W086 */
PMA_console.info();
@ -274,11 +273,11 @@ var PMA_console = {
* @return void
*/
collapse: function() {
$.cookie('pma_console_mode', 'collapse');
var pmaConsoleHeight = $.cookie('pma_console_height');
Cookies.set('pma_console_mode', 'collapse');
var pmaConsoleHeight = Cookies.get('pma_console_height');
if (pmaConsoleHeight < 32) {
$.cookie('pma_console_height', 92);
Cookies.set('pma_console_height', 92);
}
PMA_console.$consoleToolbar.addClass('collapsed');
PMA_console.$consoleAllContents.height(pmaConsoleHeight);
@ -297,12 +296,12 @@ var PMA_console = {
* @return void
*/
show: function(inputFocus) {
$.cookie('pma_console_mode', 'show');
Cookies.set('pma_console_mode', 'show');
var pmaConsoleHeight = $.cookie('pma_console_height');
var pmaConsoleHeight = Cookies.get('pma_console_height');
if (pmaConsoleHeight < 32) {
$.cookie('pma_console_height', 32);
Cookies.set('pma_console_height', 32);
PMA_console.collapse();
return;
}
@ -338,7 +337,7 @@ var PMA_console = {
* @return void
*/
toggle: function() {
switch($.cookie('pma_console_mode')) {
switch(Cookies.get('pma_console_mode')) {
case 'collapse':
case 'info':
PMA_console.show(true);
@ -416,7 +415,7 @@ var PMA_console = {
enterExecutes: $('#pma_console_options').find('input[name=enter_executes]').prop('checked'),
darkTheme: $('#pma_console_options').find('input[name=dark_theme]').prop('checked')
};
$.cookie('pma_console_config', JSON.stringify(PMA_console.config));
Cookies.set('pma_console_config', PMA_console.config);
/*Setting the dark theme of the console*/
if (PMA_console.config.darkTheme) {
$('#pma_console').find('>.content').addClass('console_dark_theme');
@ -445,7 +444,7 @@ var PMA_consoleResizer = {
* @return void
*/
_mousedown: function(event) {
if ($.cookie('pma_console_mode') !== 'show') {
if (Cookies.get('pma_console_mode') !== 'show') {
return;
}
PMA_consoleResizer._posY = event.pageY;
@ -487,7 +486,7 @@ var PMA_consoleResizer = {
* @return void
*/
_mouseup: function() {
$.cookie('pma_console_height', PMA_consoleResizer._resultHeight);
Cookies.set('pma_console_height', PMA_consoleResizer._resultHeight);
PMA_console.show();
$(document).off('mousemove');
$(document).off('mouseup');
@ -924,7 +923,7 @@ var PMA_consoleMessages = {
var $message = $(this).closest('.message');
if (confirm(PMA_messages.strConsoleDeleteBookmarkConfirm + '\n' + $message.find('.bookmark_label').text())) {
$.post('import.php',
{token: PMA_commonParams.get('token'),
{
server: PMA_commonParams.get('server'),
action_bookmark: 2,
ajax_request: true,
@ -1060,7 +1059,6 @@ var PMA_consoleBookmarks = {
refresh: function () {
$.get('import.php',
{ajax_request: true,
token: PMA_commonParams.get('token'),
server: PMA_commonParams.get('server'),
console_bookmark_refresh: 'refresh'},
function(data) {
@ -1095,7 +1093,7 @@ var PMA_consoleBookmarks = {
}
$(this).prop('disabled', true);
$.post('import.php',
{token: PMA_commonParams.get('token'),
{
ajax_request: true,
console_bookmark_add: 'true',
label: $('#pma_bookmarks').find('.card.add [name=label]').val(),
@ -1204,7 +1202,7 @@ PMA_consoleDebug = {
PMA_consoleDebug.showLog(debugSQLInfo);
},
_initConfig: function () {
var config = JSON.parse($.cookie('pma_console_dbg_config'));
var config = Cookies.getJSON('pma_console_dbg_config');
if (config) {
for (var name in config) {
if (config.hasOwnProperty(name)) {
@ -1218,7 +1216,7 @@ PMA_consoleDebug = {
return this._config[name];
}
this._config[name] = value;
$.cookie('pma_console_dbg_config', JSON.stringify(this._config));
Cookies.set('pma_console_dbg_config', this._config);
return value;
},
_formatFunctionCall: function (dbgStep) {

View File

@ -64,7 +64,7 @@ AJAX.registerOnload('db_central_columns.js', function () {
PMA_ajaxShowMessage(PMA_messages.strRadioUnchecked);
return false;
}
var editColumnData = editColumnList+ '&edit_central_columns_page=true&ajax_request=true&ajax_page_request=true&token='+PMA_commonParams.get('token')+'&db='+PMA_commonParams.get('db');
var editColumnData = editColumnList+ '&edit_central_columns_page=true&ajax_request=true&ajax_page_request=true&db='+PMA_commonParams.get('db');
PMA_ajaxShowMessage();
AJAX.source = $(this);
$.get('db_central_columns.php', editColumnData, AJAX.responseHandler);
@ -72,7 +72,7 @@ AJAX.registerOnload('db_central_columns.js', function () {
$('#multi_edit_central_columns').submit(function(event){
event.preventDefault();
event.stopPropagation();
var multi_column_edit_data = $("#multi_edit_central_columns").serialize()+'&multi_edit_central_column_save=true&ajax_request=true&ajax_page_request=true&token='+PMA_commonParams.get('token')+'&db='+PMA_commonParams.get('db');
var multi_column_edit_data = $("#multi_edit_central_columns").serialize()+'&multi_edit_central_column_save=true&ajax_request=true&ajax_page_request=true&db='+encodeURIComponent(PMA_commonParams.get('db'));
PMA_ajaxShowMessage();
AJAX.source = $(this);
$.post('db_central_columns.php', multi_column_edit_data, AJAX.responseHandler);
@ -194,7 +194,6 @@ AJAX.registerOnload('db_central_columns.js', function () {
var href = "db_central_columns.php";
var params = {
'ajax_request' : true,
'token' : PMA_commonParams.get('token'),
'server' : PMA_commonParams.get('server'),
'db' : PMA_commonParams.get('db'),
'selectedTable' : selectvalue,

View File

@ -137,8 +137,7 @@ AJAX.registerOnload('db_operations.js', function () {
);
var params = {
'is_js_confirmed': '1',
'ajax_request': true,
'token': PMA_commonParams.get('token')
'ajax_request': true
};
$(this).PMA_confirm(question, $(this).attr('href'), function (url) {
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);

View File

@ -129,8 +129,7 @@ AJAX.registerOnload('db_search.js', function () {
var params = {
'ajax_request': true,
'is_js_confirmed': true,
'sql_query' : browse_sql,
'token' : PMA_commonParams.get('token')
'sql_query' : browse_sql
};
$.post(url, params, function (data) {
if (typeof data !== 'undefined' && data.success) {
@ -172,8 +171,7 @@ AJAX.registerOnload('db_search.js', function () {
var params = {
'ajax_request': true,
'is_js_confirmed': true,
'sql_query': $(this).data('delete-sql'),
'token' : PMA_commonParams.get('token')
'sql_query': $(this).data('delete-sql')
};
var url = $(this).attr('href');

View File

@ -326,7 +326,6 @@ AJAX.registerOnload('db_structure.js', function () {
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
var params = getJSConfirmCommonParam(this);
params.token = PMA_commonParams.get('token');
$.post(url, params, function (data) {
if (typeof data !== 'undefined' && data.success === true) {
@ -390,7 +389,6 @@ AJAX.registerOnload('db_structure.js', function () {
var $msg = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
var params = getJSConfirmCommonParam(this);
params.token = PMA_commonParams.get('token');
$.post(url, params, function (data) {
if (typeof data !== 'undefined' && data.success === true) {

View File

@ -85,10 +85,9 @@ AJAX.registerOnload('db_tracking.js', function () {
AJAX.source = $anchor;
var params = {
'ajax_page_request': true,
'ajax_request': true,
'token': PMA_commonParams.get('token')
'ajax_request': true
};
$.post(url, params, AJAX.responseHandler);
});
});
});
});

View File

@ -22,7 +22,6 @@ var ErrorReport = {
$.get("error_report.php", {
ajax_request: true,
server: PMA_commonParams.get('server'),
token: PMA_commonParams.get('token'),
get_settings: true,
exception_type: 'js'
}, function (data) {
@ -195,7 +194,7 @@ var ErrorReport = {
* @return void
*/
_redirect_to_settings: function () {
window.location.href = "prefs_forms.php?token=" + PMA_commonParams.get('token');
window.location.href = "prefs_forms.php";
},
/**
* Returns the report data to send to the server
@ -207,7 +206,6 @@ var ErrorReport = {
_get_report_data: function (exception) {
var report_data = {
"ajax_request": true,
"token": PMA_commonParams.get('token'),
"exception": exception,
"current_url": window.location.href,
"exception_type": 'js'

View File

@ -77,7 +77,6 @@ function createTemplate(name)
var params = {
ajax_request : true,
token : PMA_commonParams.get('token'),
server : PMA_commonParams.get('server'),
db : PMA_commonParams.get('db'),
table : PMA_commonParams.get('table'),
@ -113,7 +112,6 @@ function loadTemplate(id)
{
var params = {
ajax_request : true,
token : PMA_commonParams.get('token'),
server : PMA_commonParams.get('server'),
db : PMA_commonParams.get('db'),
table : PMA_commonParams.get('table'),
@ -164,7 +162,6 @@ function updateTemplate(id)
var params = {
ajax_request : true,
token : PMA_commonParams.get('token'),
server : PMA_commonParams.get('server'),
db : PMA_commonParams.get('db'),
table : PMA_commonParams.get('table'),
@ -193,7 +190,6 @@ function deleteTemplate(id)
{
var params = {
ajax_request : true,
token : PMA_commonParams.get('token'),
server : PMA_commonParams.get('server'),
db : PMA_commonParams.get('db'),
table : PMA_commonParams.get('table'),
@ -699,7 +695,6 @@ function check_time_out(time_limit)
var href = "export.php";
var params = {
'ajax_request' : true,
'token' : PMA_commonParams.get('token'),
'check_time_out' : true
};
clearTimeout(time_out);

View File

@ -81,9 +81,9 @@ var spatial_indexes = [];
$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
var nocache = new Date().getTime() + "" + Math.floor(Math.random() * 1000000);
if (typeof options.data == "string") {
options.data += "&_nocache=" + nocache;
options.data += "&_nocache=" + nocache + "&token=" + encodeURIComponent(PMA_commonParams.get('token'));
} else if (typeof options.data == "object") {
options.data = $.extend(originalOptions.data, {'_nocache' : nocache});
options.data = $.extend(originalOptions.data, {'_nocache' : nocache, 'token': PMA_commonParams.get('token')});
}
});
@ -575,7 +575,6 @@ function PMA_display_git_revision()
"index.php",
{
"server": PMA_commonParams.get('server'),
"token": PMA_commonParams.get('token'),
"git_revision": true,
"ajax_request": true,
"no_debug": true
@ -935,7 +934,6 @@ AJAX.registerOnload('functions.js', function () {
}
var params = {
'ajax_request' : true,
'token' : PMA_commonParams.get('token'),
'server' : PMA_commonParams.get('server'),
'db' : PMA_commonParams.get('db'),
'guid': guid,
@ -1197,7 +1195,6 @@ function insertQuery(queryType)
var href = 'db_sql_format.php';
var params = {
'ajax_request': true,
'token': PMA_commonParams.get('token'),
'sql': codemirror_editor.getValue()
};
$.ajax({
@ -1216,8 +1213,8 @@ function insertQuery(queryType)
} else if (queryType == "saved") {
if (isStorageSupported('localStorage') && typeof window.localStorage.auto_saved_sql != 'undefined') {
setQuery(window.localStorage.auto_saved_sql);
} else if ($.cookie('auto_saved_sql')) {
setQuery($.cookie('auto_saved_sql'));
} else if (Cookies.get('auto_saved_sql')) {
setQuery(Cookies.get('auto_saved_sql'));
} else {
PMA_ajaxShowMessage(PMA_messages.strNoAutoSavedQuery);
}
@ -1821,7 +1818,6 @@ function loadForeignKeyCheckbox() {
// Load default foreign key check value
var params = {
'ajax_request': true,
'token': PMA_commonParams.get('token'),
'server': PMA_commonParams.get('server'),
'get_default_fk_check_value': true
};
@ -1973,7 +1969,6 @@ function codemirrorAutocompleteOnInputRead(instance) {
var href = 'db_sql_autocomplete.php';
var params = {
'ajax_request': true,
'token': PMA_commonParams.get('token'),
'server': PMA_commonParams.get('server'),
'db': PMA_commonParams.get('db'),
'no_debug': true
@ -3542,7 +3537,6 @@ AJAX.registerOnload('functions.js', function () {
}
var params = {
'ajax_request' : true,
'token' : PMA_commonParams.get('token'),
'server' : PMA_commonParams.get('server'),
'db' : PMA_commonParams.get('db'),
'cur_table' : PMA_commonParams.get('table'),
@ -4087,7 +4081,7 @@ var toggleButton = function ($obj) {
addClass = 'on';
}
var params = {'ajax_request': true, 'token': PMA_commonParams.get('token')};
var params = {'ajax_request': true};
$.post(url, params, function (data) {
if (typeof data !== 'undefined' && data.success === true) {
PMA_ajaxRemoveMessage($msg);
@ -4166,8 +4160,7 @@ AJAX.registerOnload('functions.js', function () {
url: 'version_check.php',
method: "POST",
data: {
"server": PMA_commonParams.get('server'),
"token": PMA_commonParams.get('token'),
"server": PMA_commonParams.get('server')
},
success: PMA_current_version
});
@ -4215,7 +4208,6 @@ AJAX.registerOnload('functions.js', function () {
favorite_tables: (isStorageSupported('localStorage') && typeof window.localStorage.favorite_tables !== 'undefined')
? window.localStorage.favorite_tables
: '',
token: PMA_commonParams.get('token'),
server: PMA_commonParams.get('server'),
no_debug: true
},
@ -4670,7 +4662,7 @@ AJAX.registerOnload('functions.js', function () {
$('.logout').click(function() {
var form = $(
'<form method="POST" action="' + $(this).attr('href') + '" class="disableAjax">' +
'<input type="hidden" name="token" value="' + PMA_commonParams.get('token') + '"/>' +
'<input type="hidden" name="token" value="' + escapeHtml(PMA_commonParams.get('token')) + '"/>' +
'</form>'
);
$('body').append(form);
@ -5083,4 +5075,6 @@ AJAX.registerOnload('functions.js', function(){
$('#ssl_reqd_warning_cp').hide();
}
});
Cookies.defaults.path = PMA_commonParams.get('rootPath');
});

View File

@ -89,7 +89,7 @@ function initGISEditorVisualization() {
* @param input_name name of the input field
* @param token token
*/
function loadJSAndGISEditor(value, field, type, input_name, token) {
function loadJSAndGISEditor(value, field, type, input_name) {
var head = document.getElementsByTagName('head')[0];
var script;
@ -113,14 +113,14 @@ function loadJSAndGISEditor(value, field, type, input_name, token) {
script.onreadystatechange = function () {
if (this.readyState == 'complete') {
loadGISEditor(value, field, type, input_name, token);
loadGISEditor(value, field, type, input_name);
}
};
script.onload = function () {
loadGISEditor(value, field, type, input_name, token);
loadGISEditor(value, field, type, input_name);
};
script.onerror = function() {
loadGISEditor(value, field, type, input_name, token);
loadGISEditor(value, field, type, input_name);
}
script.src = 'js/openlayers/OpenLayers.js';
@ -136,9 +136,8 @@ function loadJSAndGISEditor(value, field, type, input_name, token) {
* @param field field name
* @param type geometry type
* @param input_name name of the input field
* @param token token
*/
function loadGISEditor(value, field, type, input_name, token) {
function loadGISEditor(value, field, type, input_name) {
var $gis_editor = $("#gis_editor");
$.post('gis_data_editor.php', {
@ -147,7 +146,6 @@ function loadGISEditor(value, field, type, input_name, token) {
'type' : type,
'input_name' : input_name,
'get_gis_editor' : true,
'token' : token,
'ajax_request': true
}, function (data) {
if (typeof data !== 'undefined' && data.success === true) {

View File

@ -319,7 +319,6 @@ function PMA_showAddIndexDialog(source_array, array_index, target_columns, col_i
var table = $table.length > 0 ? $table.val() : '';
var post_data = {
server: PMA_commonParams.get('server'),
token: PMA_commonParams.get('token'),
db: $('input[name="db"]').val(),
table: table,
ajax_request: 1,
@ -611,8 +610,7 @@ AJAX.registerOnload('indexes.js', function () {
var $msg = PMA_ajaxShowMessage(PMA_messages.strDroppingPrimaryKeyIndex, false);
var params = {
'is_js_confirmed': 1,
'ajax_request': true,
'token' : PMA_commonParams.get('token')
'ajax_request': true
};
$.post(url, params, function (data) {
if (typeof data !== 'undefined' && data.success === true) {

View File

@ -1,5 +1,5 @@
/*!
* jQuery Validation Plugin v1.15.1
* jQuery Validation Plugin v1.16.0
*
* http://jqueryvalidation.org/
*
@ -144,59 +144,111 @@ $.validator.addMethod( "bic", function( value, element ) {
/*
* Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities
* Further rules can be found in Spanish on http://es.wikipedia.org/wiki/C%C3%B3digo_de_identificaci%C3%B3n_fiscal
*
* Spanish CIF structure:
*
* [ T ][ P ][ P ][ N ][ N ][ N ][ N ][ N ][ C ]
*
* Where:
*
* T: 1 character. Kind of Organization Letter: [ABCDEFGHJKLMNPQRSUVW]
* P: 2 characters. Province.
* N: 5 characters. Secuencial Number within the province.
* C: 1 character. Control Digit: [0-9A-J].
*
* [ T ]: Kind of Organizations. Possible values:
*
* A. Corporations
* B. LLCs
* C. General partnerships
* D. Companies limited partnerships
* E. Communities of goods
* F. Cooperative Societies
* G. Associations
* H. Communities of homeowners in horizontal property regime
* J. Civil Societies
* K. Old format
* L. Old format
* M. Old format
* N. Nonresident entities
* P. Local authorities
* Q. Autonomous bodies, state or not, and the like, and congregations and religious institutions
* R. Congregations and religious institutions (since 2008 ORDER EHA/451/2008)
* S. Organs of State Administration and regions
* V. Agrarian Transformation
* W. Permanent establishments of non-resident in Spain
*
* [ C ]: Control Digit. It can be a number or a letter depending on T value:
* [ T ] --> [ C ]
* ------ ----------
* A Number
* B Number
* E Number
* H Number
* K Letter
* P Letter
* Q Letter
* S Letter
*
*/
$.validator.addMethod( "cifES", function( value ) {
"use strict";
var num = [],
controlDigit, sum, i, count, tmp, secondDigit;
var cifRegEx = new RegExp( /^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/gi );
var letter = value.substring( 0, 1 ), // [ T ]
number = value.substring( 1, 8 ), // [ P ][ P ][ N ][ N ][ N ][ N ][ N ]
control = value.substring( 8, 9 ), // [ C ]
all_sum = 0,
even_sum = 0,
odd_sum = 0,
i, n,
control_digit,
control_letter;
value = value.toUpperCase();
function isOdd( n ) {
return n % 2 === 0;
}
// Quick format test
if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) {
if ( value.length !== 9 || !cifRegEx.test( value ) ) {
return false;
}
for ( i = 0; i < 9; i++ ) {
num[ i ] = parseInt( value.charAt( i ), 10 );
for ( i = 0; i < number.length; i++ ) {
n = parseInt( number[ i ], 10 );
// Odd positions
if ( isOdd( i ) ) {
// Odd positions are multiplied first.
n *= 2;
// If the multiplication is bigger than 10 we need to adjust
odd_sum += n < 10 ? n : n - 9;
// Even positions
// Just sum them
} else {
even_sum += n;
}
}
// Algorithm for checking CIF codes
sum = num[ 2 ] + num[ 4 ] + num[ 6 ];
for ( count = 1; count < 8; count += 2 ) {
tmp = ( 2 * num[ count ] ).toString();
secondDigit = tmp.charAt( 1 );
all_sum = even_sum + odd_sum;
control_digit = ( 10 - ( all_sum ).toString().substr( -1 ) ).toString();
control_digit = parseInt( control_digit, 10 ) > 9 ? "0" : control_digit;
control_letter = "JABCDEFGHI".substr( control_digit, 1 ).toString();
sum += parseInt( tmp.charAt( 0 ), 10 ) + ( secondDigit === "" ? 0 : parseInt( secondDigit, 10 ) );
}
// Control must be a digit
if ( letter.match( /[ABEH]/ ) ) {
return control === control_digit;
/* The first (position 1) is a letter following the following criteria:
* A. Corporations
* B. LLCs
* C. General partnerships
* D. Companies limited partnerships
* E. Communities of goods
* F. Cooperative Societies
* G. Associations
* H. Communities of homeowners in horizontal property regime
* J. Civil Societies
* K. Old format
* L. Old format
* M. Old format
* N. Nonresident entities
* P. Local authorities
* Q. Autonomous bodies, state or not, and the like, and congregations and religious institutions
* R. Congregations and religious institutions (since 2008 ORDER EHA/451/2008)
* S. Organs of State Administration and regions
* V. Agrarian Transformation
* W. Permanent establishments of non-resident in Spain
*/
if ( /^[ABCDEFGHJNPQRSUVW]{1}/.test( value ) ) {
sum += "";
controlDigit = 10 - parseInt( sum.charAt( sum.length - 1 ), 10 );
value += controlDigit;
return ( num[ 8 ].toString() === String.fromCharCode( 64 + controlDigit ) || num[ 8 ].toString() === value.charAt( value.length - 1 ) );
// Control must be a letter
} else if ( letter.match( /[KPQS]/ ) ) {
return control === control_letter;
// Can be either
} else {
return control === control_digit || control === control_letter;
}
return false;
@ -654,37 +706,38 @@ $.validator.addMethod( "mobileUK", function( phone_number, element ) {
}, "Please specify a valid mobile number" );
/*
* The número de identidad de extranjero ( NIE )is a code used to identify the non-nationals in Spain
* The NIE (Número de Identificación de Extranjero) is a Spanish tax identification number assigned by the Spanish
* authorities to any foreigner.
*
* The NIE is the equivalent of a Spaniards Número de Identificación Fiscal (NIF) which serves as a fiscal
* identification number. The CIF number (Certificado de Identificación Fiscal) is equivalent to the NIF, but applies to
* companies rather than individuals. The NIE consists of an 'X' or 'Y' followed by 7 or 8 digits then another letter.
*/
$.validator.addMethod( "nieES", function( value ) {
"use strict";
value = value.toUpperCase();
var nieRegEx = new RegExp( /^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi );
var validChars = "TRWAGMYFPDXBNJZSQVHLCKET",
letter = value.substr( value.length - 1 ).toUpperCase(),
number;
// Basic format test
if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) {
value = value.toString().toUpperCase();
// Quick format test
if ( value.length > 10 || value.length < 9 || !nieRegEx.test( value ) ) {
return false;
}
// Test NIE
//T
if ( /^[T]{1}/.test( value ) ) {
return ( value[ 8 ] === /^[T]{1}[A-Z0-9]{8}$/.test( value ) );
}
// X means same number
// Y means number + 10000000
// Z means number + 20000000
value = value.replace( /^[X]/, "0" )
.replace( /^[Y]/, "1" )
.replace( /^[Z]/, "2" );
//XYZ
if ( /^[XYZ]{1}/.test( value ) ) {
return (
value[ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE".charAt(
value.replace( "X", "0" )
.replace( "Y", "1" )
.replace( "Z", "2" )
.substring( 0, 8 ) % 23
)
);
}
number = value.length === 9 ? value.substr( 0, 8 ) : value.substr( 0, 9 );
return false;
return validChars.charAt( parseInt( number, 10 ) % 23 ) === letter;
}, "Please specify a valid NIE number." );
@ -753,6 +806,22 @@ $.validator.addMethod( "phoneNL", function( value, element ) {
return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test( value );
}, "Please specify a valid phone number." );
/* For UK phone functions, do the following server side processing:
* Compare original input with this RegEx pattern:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
* Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0'
* Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2.
* A number of very detailed GB telephone number RegEx patterns can also be found at:
* http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers
*/
// Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers
$.validator.addMethod( "phonesUK", function( phone_number, element ) {
phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" );
return this.optional( element ) || phone_number.length > 9 &&
phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/ );
}, "Please specify a valid uk phone number" );
/* For UK phone functions, do the following server side processing:
* Compare original input with this RegEx pattern:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
@ -789,21 +858,17 @@ $.validator.addMethod( "phoneUS", function( phone_number, element ) {
phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/ );
}, "Please specify a valid phone number" );
/* For UK phone functions, do the following server side processing:
* Compare original input with this RegEx pattern:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
* Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0'
* Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2.
* A number of very detailed GB telephone number RegEx patterns can also be found at:
* http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers
*/
// Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers
$.validator.addMethod( "phonesUK", function( phone_number, element ) {
phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" );
return this.optional( element ) || phone_number.length > 9 &&
phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/ );
}, "Please specify a valid uk phone number" );
/*
* Valida CEPs do brasileiros:
*
* Formatos aceitos:
* 99999-999
* 99.999-999
* 99999999
*/
$.validator.addMethod( "postalcodeBR", function( cep_value, element ) {
return this.optional( element ) || /^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test( cep_value );
}, "Informe um CEP válido." );
/**
* Matches a valid Canadian Postal Code
@ -822,18 +887,6 @@ $.validator.addMethod( "postalCodeCA", function( value, element ) {
return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test( value );
}, "Please specify a valid postal code" );
/*
* Valida CEPs do brasileiros:
*
* Formatos aceitos:
* 99999-999
* 99.999-999
* 99999999
*/
$.validator.addMethod( "postalcodeBR", function( cep_value, element ) {
return this.optional( element ) || /^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test( cep_value );
}, "Informe um CEP válido." );
/* Matches Italian postcode (CAP) */
$.validator.addMethod( "postalcodeIT", function( value, element ) {
return this.optional( element ) || /^\d{5}$/.test( value );
@ -1065,5 +1118,5 @@ $.validator.addMethod( "zipcodeUS", function( value, element ) {
$.validator.addMethod( "ziprange", function( value, element ) {
return this.optional( element ) || /^90[2-5]\d\{2\}-\d{4}$/.test( value );
}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx" );
return $;
}));

View File

@ -1,91 +0,0 @@
/*jslint browser: true */ /*global jQuery: true */
/**
* jQuery Cookie plugin
*
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
// TODO JsDoc
/**
* Create a cookie with the given key and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String key The key of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given key.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String key The key of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function (key, value, options) {
// key and at least value given, set cookie...
if (arguments.length > 1 && String(value) !== "[object Object]") {
options = jQuery.extend({}, options);
if (value === null || value === undefined) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = String(value);
return (document.cookie = [
encodeURIComponent(key), '=',
options.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// key and possibly options given, get cookie...
options = value || {};
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*!
* jQuery Validation Plugin v1.15.1
* jQuery Validation Plugin v1.16.0
*
* http://jqueryvalidation.org/
*
@ -204,7 +204,7 @@ $.extend( $.fn, {
} );
// Custom selectors
$.extend( $.expr[ ":" ], {
$.extend( $.expr.pseudos || $.expr[ ":" ], { // '|| $.expr[ ":" ]' here enables backwards compatibility to jQuery 1.7. Can be removed when dropping jQ 1.7.x support
// http://jqueryvalidation.org/blank-selector/
blank: function( a ) {
@ -417,7 +417,7 @@ $.extend( $.validator, {
":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " +
"[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " +
"[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " +
"[type='radio'], [type='checkbox'], [contenteditable]", delegate )
"[type='radio'], [type='checkbox'], [contenteditable], [type='button']", delegate )
// Support: Chrome, oldIE
// "select" is provided as event.target when clicking a option
@ -1570,5 +1570,5 @@ if ( $.ajaxPrefilter ) {
return ajax.apply( this, arguments );
};
}
return $;
}));

View File

@ -1,10 +1,11 @@
define( [
"../core",
"../core/access",
"../core/nodeName",
"./support",
"../var/rnothtmlwhite",
"../selector"
], function( jQuery, access, support, rnothtmlwhite ) {
], function( jQuery, access, nodeName, support, rnothtmlwhite ) {
"use strict";
@ -74,7 +75,7 @@ jQuery.extend( {
type: {
set: function( elem, value ) {
if ( !support.radioValue && value === "radio" &&
jQuery.nodeName( elem, "input" ) ) {
nodeName( elem, "input" ) ) {
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {

View File

@ -2,8 +2,10 @@ define( [
"../core",
"../core/stripAndCollapse",
"./support",
"../core/nodeName",
"../core/init"
], function( jQuery, stripAndCollapse, support ) {
], function( jQuery, stripAndCollapse, support, nodeName ) {
"use strict";
@ -62,7 +64,7 @@ jQuery.fn.extend( {
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
} else if ( Array.isArray( val ) ) {
val = jQuery.map( val, function( value ) {
return value == null ? "" : value + "";
} );
@ -121,7 +123,7 @@ jQuery.extend( {
// Don't return options that are disabled or in a disabled optgroup
!option.disabled &&
( !option.parentNode.disabled ||
!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
!nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option
value = jQuery( option ).val();
@ -173,7 +175,7 @@ jQuery.extend( {
jQuery.each( [ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
if ( Array.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
}
}

View File

@ -69,7 +69,7 @@ jQuery.Callbacks = function( options ) {
fire = function() {
// Enforce single-firing
locked = options.once;
locked = locked || options.once;
// Execute callbacks for all pending executions,
// respecting firingIndex overrides and runtime changes

View File

@ -24,7 +24,7 @@ define( [
"use strict";
var
version = "3.1.1",
version = "3.2.1",
// Define a local copy of jQuery
jQuery = function( selector, context ) {
@ -172,11 +172,11 @@ jQuery.extend = jQuery.fn.extend = function() {
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
( copyIsArray = jQuery.isArray( copy ) ) ) ) {
( copyIsArray = Array.isArray( copy ) ) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray( src ) ? src : [];
clone = src && Array.isArray( src ) ? src : [];
} else {
clone = src && jQuery.isPlainObject( src ) ? src : {};
@ -215,8 +215,6 @@ jQuery.extend( {
return jQuery.type( obj ) === "function";
},
isArray: Array.isArray,
isWindow: function( obj ) {
return obj != null && obj === obj.window;
},
@ -291,10 +289,6 @@ jQuery.extend( {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
each: function( obj, callback ) {
var length, i = 0;

View File

@ -3,6 +3,7 @@ define( [
"../core",
"../var/document",
"./var/rsingleTag",
"../traversing/findFilter"
], function( jQuery, document, rsingleTag ) {

13
js/jquery/src/jquery/core/nodeName.js vendored Normal file
View File

@ -0,0 +1,13 @@
define( function() {
"use strict";
function nodeName( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
};
return nodeName;
} );

View File

@ -32,15 +32,6 @@ jQuery.extend( {
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
ready: function( wait ) {
// Abort if there are pending holds or we're already ready

View File

@ -34,15 +34,6 @@ jQuery.extend( {
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {

View File

@ -28,6 +28,7 @@ var
// except "table", "table-cell", or "table-caption"
// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rcustomProp = /^--/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: "0",
@ -57,6 +58,16 @@ function vendorPropName( name ) {
}
}
// Return a property mapped along what jQuery.cssProps suggests or to
// a vendor prefixed property.
function finalPropName( name ) {
var ret = jQuery.cssProps[ name ];
if ( !ret ) {
ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
}
return ret;
}
function setPositiveNumber( elem, value, subtract ) {
// Any relative (+/-) values have already been
@ -117,44 +128,31 @@ function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var val,
valueIsBorderBox = true,
// Start with computed style
var valueIsBorderBox,
styles = getStyles( elem ),
val = curCSS( elem, name, styles ),
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// Support: IE <=11 only
// Running getBoundingClientRect on a disconnected node
// in IE throws an error.
if ( elem.getClientRects().length ) {
val = elem.getBoundingClientRect()[ name ];
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test( val ) ) {
return val;
}
// Some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
// Check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox &&
( support.boxSizingReliable() || val === elem.style[ name ] );
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, styles );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test( val ) ) {
return val;
}
// Check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox &&
( support.boxSizingReliable() || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
// Fall back to offsetWidth/Height when value is "auto"
// This happens for inline elements with no explicit setting (gh-3571)
if ( val === "auto" ) {
val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ];
}
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
// Use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
@ -218,10 +216,15 @@ jQuery.extend( {
// Make sure that we're working with the right name
var ret, type, hooks,
origName = jQuery.camelCase( name ),
isCustomProp = rcustomProp.test( name ),
style = elem.style;
name = jQuery.cssProps[ origName ] ||
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
// Make sure that we're working with the right name. We don't
// want to query the value if it is a CSS custom property
// since they are user-defined.
if ( !isCustomProp ) {
name = finalPropName( origName );
}
// Gets hook for the prefixed version, then unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
@ -257,7 +260,11 @@ jQuery.extend( {
if ( !hooks || !( "set" in hooks ) ||
( value = hooks.set( elem, value, extra ) ) !== undefined ) {
style[ name ] = value;
if ( isCustomProp ) {
style.setProperty( name, value );
} else {
style[ name ] = value;
}
}
} else {
@ -276,11 +283,15 @@ jQuery.extend( {
css: function( elem, name, extra, styles ) {
var val, num, hooks,
origName = jQuery.camelCase( name );
origName = jQuery.camelCase( name ),
isCustomProp = rcustomProp.test( name );
// Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] ||
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
// Make sure that we're working with the right name. We don't
// want to modify the value if it is a CSS custom property
// since they are user-defined.
if ( !isCustomProp ) {
name = finalPropName( origName );
}
// Try prefixed name followed by the unprefixed name
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
@ -305,6 +316,7 @@ jQuery.extend( {
num = parseFloat( val );
return extra === true || isFinite( num ) ? num || 0 : val;
}
return val;
}
} );
@ -404,7 +416,7 @@ jQuery.fn.extend( {
map = {},
i = 0;
if ( jQuery.isArray( name ) ) {
if ( Array.isArray( name ) ) {
styles = getStyles( elem );
len = name.length;

View File

@ -11,12 +11,18 @@ define( [
function curCSS( elem, name, computed ) {
var width, minWidth, maxWidth, ret,
// Support: Firefox 51+
// Retrieving style before computed somehow
// fixes an issue with getting wrong values
// on detached elements
style = elem.style;
computed = computed || getStyles( elem );
// Support: IE <=9 only
// getPropertyValue is only needed for .css('filter') (#12537)
// getPropertyValue is needed for:
// .css('filter') (IE 9 only, #12537)
// .css('--customProperty) (#3144)
if ( computed ) {
ret = computed.getPropertyValue( name ) || computed[ name ];

View File

@ -115,7 +115,7 @@ Data.prototype = {
if ( key !== undefined ) {
// Support array or space separated string of keys
if ( jQuery.isArray( key ) ) {
if ( Array.isArray( key ) ) {
// If key is an array of keys...
// We always set camelCase keys, so remove that.

View File

@ -13,7 +13,7 @@ function Thrower( ex ) {
throw ex;
}
function adoptValue( value, resolve, reject ) {
function adoptValue( value, resolve, reject, noValue ) {
var method;
try {
@ -29,9 +29,10 @@ function adoptValue( value, resolve, reject ) {
// Other non-thenables
} else {
// Support: Android 4.0 only
// Strict mode functions invoked without .call/.apply get global-object context
resolve.call( undefined, value );
// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
// * false: [ value ].slice( 0 ) => resolve( value )
// * true: [ value ].slice( 1 ) => resolve()
resolve.apply( undefined, [ value ].slice( noValue ) );
}
// For Promises/A+, convert exceptions into rejections
@ -41,7 +42,7 @@ function adoptValue( value, resolve, reject ) {
// Support: Android 4.0 only
// Strict mode functions invoked without .call/.apply get global-object context
reject.call( undefined, value );
reject.apply( undefined, [ value ] );
}
}
@ -366,7 +367,8 @@ jQuery.extend( {
// Single- and empty arguments are adopted like Promise.resolve
if ( remaining <= 1 ) {
adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject );
adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
!remaining );
// Use .then() to unwrap secondary thenables (cf. gh-3000)
if ( master.state() === "pending" ||

View File

@ -1,6 +1,7 @@
define( [
"./core"
], function( jQuery ) {
"./core",
"./core/nodeName"
], function( jQuery, nodeName ) {
"use strict";
@ -25,6 +26,15 @@ jQuery.fn.extend( {
}
} );
jQuery.holdReady = function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
};
jQuery.isArray = Array.isArray;
jQuery.parseJSON = JSON.parse;
jQuery.nodeName = nodeName;
} );

View File

@ -23,13 +23,18 @@ define( [
"use strict";
var
fxNow, timerId,
fxNow, inProgress,
rfxtypes = /^(?:toggle|show|hide)$/,
rrun = /queueHooks$/;
function raf() {
if ( timerId ) {
window.requestAnimationFrame( raf );
function schedule() {
if ( inProgress ) {
if ( document.hidden === false && window.requestAnimationFrame ) {
window.requestAnimationFrame( schedule );
} else {
window.setTimeout( schedule, jQuery.fx.interval );
}
jQuery.fx.tick();
}
}
@ -256,7 +261,7 @@ function propFilter( props, specialEasing ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
if ( Array.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
@ -315,12 +320,19 @@ function Animation( elem, properties, options ) {
deferred.notifyWith( elem, [ animation, percent, remaining ] );
// If there's more to do, yield
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
// If this was an empty animation, synthesize a final progress notification
if ( !length ) {
deferred.notifyWith( elem, [ animation, 1, 0 ] );
}
// Resolve the animation and report its conclusion
deferred.resolveWith( elem, [ animation ] );
return false;
},
animation = deferred.promise( {
elem: elem,
@ -385,6 +397,13 @@ function Animation( elem, properties, options ) {
animation.opts.start.call( elem, animation );
}
// Attach callbacks from options
animation
.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
jQuery.fx.timer(
jQuery.extend( tick, {
elem: elem,
@ -393,11 +412,7 @@ function Animation( elem, properties, options ) {
} )
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
return animation;
}
jQuery.Animation = jQuery.extend( Animation, {
@ -448,8 +463,8 @@ jQuery.speed = function( speed, easing, fn ) {
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};
// Go to the end state if fx are off or if document is hidden
if ( jQuery.fx.off || document.hidden ) {
// Go to the end state if fx are off
if ( jQuery.fx.off ) {
opt.duration = 0;
} else {
@ -641,7 +656,7 @@ jQuery.fx.tick = function() {
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
// Checks the timer has not already been removed
// Run the timer and safely remove it when done (allowing for external removal)
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
}
@ -655,30 +670,21 @@ jQuery.fx.tick = function() {
jQuery.fx.timer = function( timer ) {
jQuery.timers.push( timer );
if ( timer() ) {
jQuery.fx.start();
} else {
jQuery.timers.pop();
}
jQuery.fx.start();
};
jQuery.fx.interval = 13;
jQuery.fx.start = function() {
if ( !timerId ) {
timerId = window.requestAnimationFrame ?
window.requestAnimationFrame( raf ) :
window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
if ( inProgress ) {
return;
}
inProgress = true;
schedule();
};
jQuery.fx.stop = function() {
if ( window.cancelAnimationFrame ) {
window.cancelAnimationFrame( timerId );
} else {
window.clearInterval( timerId );
}
timerId = null;
inProgress = null;
};
jQuery.fx.speeds = {

View File

@ -5,10 +5,11 @@ define( [
"./var/rnothtmlwhite",
"./var/slice",
"./data/var/dataPriv",
"./core/nodeName",
"./core/init",
"./selector"
], function( jQuery, document, documentElement, rnothtmlwhite, slice, dataPriv ) {
], function( jQuery, document, documentElement, rnothtmlwhite, slice, dataPriv, nodeName ) {
"use strict";
@ -476,7 +477,7 @@ jQuery.event = {
// For checkbox, fire native event so checked state will be right
trigger: function() {
if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
this.click();
return false;
}
@ -484,7 +485,7 @@ jQuery.event = {
// For cross-browser consistency, don't fire native .click() on links
_default: function( event ) {
return jQuery.nodeName( event.target, "a" );
return nodeName( event.target, "a" );
}
},

View File

@ -16,6 +16,7 @@ define( [
"./data/var/dataUser",
"./data/var/acceptData",
"./core/DOMEval",
"./core/nodeName",
"./core/init",
"./traversing",
@ -24,7 +25,7 @@ define( [
], function( jQuery, concat, push, access,
rcheckableType, rtagName, rscriptType,
wrapMap, getAll, setGlobalEval, buildFragment, support,
dataPriv, dataUser, acceptData, DOMEval ) {
dataPriv, dataUser, acceptData, DOMEval, nodeName ) {
"use strict";
@ -47,11 +48,12 @@ var
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
// Prefer a tbody over its parent table for containing new rows
function manipulationTarget( elem, content ) {
if ( jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
if ( nodeName( elem, "table" ) &&
nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
return elem.getElementsByTagName( "tbody" )[ 0 ] || elem;
return jQuery( ">tbody", elem )[ 0 ] || elem;
}
return elem;

View File

@ -1,6 +1,7 @@
define( [
"../core"
], function( jQuery ) {
"../core",
"../core/nodeName"
], function( jQuery, nodeName ) {
"use strict";
@ -20,7 +21,7 @@ function getAll( context, tag ) {
ret = [];
}
if ( tag === undefined || tag && jQuery.nodeName( context, tag ) ) {
if ( tag === undefined || tag && nodeName( context, tag ) ) {
return jQuery.merge( [ context ], ret );
}

View File

@ -7,21 +7,16 @@ define( [
"./css/curCSS",
"./css/addGetHookIf",
"./css/support",
"./core/nodeName",
"./core/init",
"./css",
"./selector" // contains
], function( jQuery, access, document, documentElement, rnumnonpx, curCSS, addGetHookIf, support ) {
], function( jQuery, access, document, documentElement, rnumnonpx,
curCSS, addGetHookIf, support, nodeName ) {
"use strict";
/**
* Gets a window from an element
*/
function getWindow( elem ) {
return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
}
jQuery.offset = {
setOffset: function( elem, options, i ) {
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
@ -86,13 +81,14 @@ jQuery.fn.extend( {
} );
}
var docElem, win, rect, doc,
var doc, docElem, rect, win,
elem = this[ 0 ];
if ( !elem ) {
return;
}
// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
// Support: IE <=11 only
// Running getBoundingClientRect on a
// disconnected node in IE throws an error
@ -102,20 +98,14 @@ jQuery.fn.extend( {
rect = elem.getBoundingClientRect();
// Make sure element is not hidden (display: none)
if ( rect.width || rect.height ) {
doc = elem.ownerDocument;
win = getWindow( doc );
docElem = doc.documentElement;
doc = elem.ownerDocument;
docElem = doc.documentElement;
win = doc.defaultView;
return {
top: rect.top + win.pageYOffset - docElem.clientTop,
left: rect.left + win.pageXOffset - docElem.clientLeft
};
}
// Return zeros for disconnected and hidden elements (gh-2310)
return rect;
return {
top: rect.top + win.pageYOffset - docElem.clientTop,
left: rect.left + win.pageXOffset - docElem.clientLeft
};
},
position: function() {
@ -141,7 +131,7 @@ jQuery.fn.extend( {
// Get correct offsets
offset = this.offset();
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
if ( !nodeName( offsetParent[ 0 ], "html" ) ) {
parentOffset = offsetParent.offset();
}
@ -188,7 +178,14 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
jQuery.fn[ method ] = function( val ) {
return access( this, function( elem, method, val ) {
var win = getWindow( elem );
// Coalesce documents and windows
var win;
if ( jQuery.isWindow( elem ) ) {
win = elem;
} else if ( elem.nodeType === 9 ) {
win = elem.defaultView;
}
if ( val === undefined ) {
return win ? win[ prop ] : elem[ method ];

View File

@ -17,7 +17,7 @@ jQuery.extend( {
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray( data ) ) {
if ( !queue || Array.isArray( data ) ) {
queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
} else {
queue.push( data );

View File

@ -17,7 +17,7 @@ var
function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) {
if ( Array.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
@ -69,7 +69,7 @@ jQuery.param = function( a, traditional ) {
};
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
@ -115,7 +115,7 @@ jQuery.fn.extend( {
return null;
}
if ( jQuery.isArray( val ) ) {
if ( Array.isArray( val ) ) {
return jQuery.map( val, function( val ) {
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
} );

View File

@ -4,10 +4,12 @@ define( [
"./traversing/var/dir",
"./traversing/var/siblings",
"./traversing/var/rneedsContext",
"./core/nodeName",
"./core/init",
"./traversing/findFilter",
"./selector"
], function( jQuery, indexOf, dir, siblings, rneedsContext ) {
], function( jQuery, indexOf, dir, siblings, rneedsContext, nodeName ) {
"use strict";
@ -143,7 +145,18 @@ jQuery.each( {
return siblings( elem.firstChild );
},
contents: function( elem ) {
return elem.contentDocument || jQuery.merge( [], elem.childNodes );
if ( nodeName( elem, "iframe" ) ) {
return elem.contentDocument;
}
// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
// Treat the template element as a regular one in browsers that
// don't support it.
if ( nodeName( elem, "template" ) ) {
elem = elem.content || elem;
}
return jQuery.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {

53
js/jquery/src/jquery/wrapper.js vendored Normal file
View File

@ -0,0 +1,53 @@
/* eslint-disable no-unused-vars*/
/*!
* jQuery JavaScript Library v@VERSION
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: @DATE
*/
( function( global, factory ) {
"use strict";
if ( typeof module === "object" && typeof module.exports === "object" ) {
// For CommonJS and CommonJS-like environments where a proper `window`
// is present, execute the factory and get jQuery.
// For environments that do not have a `window` with a `document`
// (such as Node.js), expose a factory as module.exports.
// This accentuates the need for the creation of a real `window`.
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info.
module.exports = global.document ?
factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window with a document" );
}
return factory( w );
};
} else {
factory( global );
}
// Pass this if window is not defined yet
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
// enough that all such attempts are guarded in a try block.
"use strict";
// @CODE
// build.js inserts compiled jQuery here
return jQuery;
} );

165
js/js.cookie.js Normal file
View File

@ -0,0 +1,165 @@
/*!
* JavaScript Cookie v2.1.4
* https://github.com/js-cookie/js-cookie
*
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
* Released under the MIT license
*/
;(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
define(factory);
registeredInModuleLoader = true;
}
if (typeof exports === 'object') {
module.exports = factory();
registeredInModuleLoader = true;
}
if (!registeredInModuleLoader) {
var OldCookies = window.Cookies;
var api = window.Cookies = factory();
api.noConflict = function () {
window.Cookies = OldCookies;
return api;
};
}
}(function () {
function extend () {
var i = 0;
var result = {};
for (; i < arguments.length; i++) {
var attributes = arguments[ i ];
for (var key in attributes) {
result[key] = attributes[key];
}
}
return result;
}
function init (converter) {
function api (key, value, attributes) {
var result;
if (typeof document === 'undefined') {
return;
}
// Write
if (arguments.length > 1) {
attributes = extend({
path: '/'
}, api.defaults, attributes);
if (typeof attributes.expires === 'number') {
var expires = new Date();
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
attributes.expires = expires;
}
// We're using "expires" because "max-age" is not supported by IE
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
try {
result = JSON.stringify(value);
if (/^[\{\[]/.test(result)) {
value = result;
}
} catch (e) {}
if (!converter.write) {
value = encodeURIComponent(String(value))
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
} else {
value = converter.write(value, key);
}
key = encodeURIComponent(String(key));
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
key = key.replace(/[\(\)]/g, escape);
var stringifiedAttributes = '';
for (var attributeName in attributes) {
if (!attributes[attributeName]) {
continue;
}
stringifiedAttributes += '; ' + attributeName;
if (attributes[attributeName] === true) {
continue;
}
stringifiedAttributes += '=' + attributes[attributeName];
}
return (document.cookie = key + '=' + value + stringifiedAttributes);
}
// Read
if (!key) {
result = {};
}
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling "get()"
var cookies = document.cookie ? document.cookie.split('; ') : [];
var rdecode = /(%[0-9A-Z]{2})+/g;
var i = 0;
for (; i < cookies.length; i++) {
var parts = cookies[i].split('=');
var cookie = parts.slice(1).join('=');
if (cookie.charAt(0) === '"') {
cookie = cookie.slice(1, -1);
}
try {
var name = parts[0].replace(rdecode, decodeURIComponent);
cookie = converter.read ?
converter.read(cookie, name) : converter(cookie, name) ||
cookie.replace(rdecode, decodeURIComponent);
if (this.json) {
try {
cookie = JSON.parse(cookie);
} catch (e) {}
}
if (key === name) {
result = cookie;
break;
}
if (!key) {
result[name] = cookie;
}
} catch (e) {}
}
return result;
}
api.set = api;
api.get = function (key) {
return api.call(api, key);
};
api.getJSON = function () {
return api.apply({
json: true
}, [].slice.call(arguments));
};
api.defaults = {};
api.remove = function (key, attributes) {
api(key, '', extend(attributes, {
expires: -1
}));
};
api.withConverter = init;
return api;
}
return init(function () {});
}));

View File

@ -862,7 +862,6 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
'db' : g.db,
'table' : g.table,
'column' : field_name,
'token' : g.token,
'curr_value' : relation_curr_value,
'relation_key_or_display_column' : relation_key_or_display_column
};
@ -910,7 +909,6 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
'db' : g.db,
'table' : g.table,
'column' : field_name,
'token' : g.token,
'curr_value' : curr_value
};
g.lastXHR = $.post('sql.php', post_params, function (data) {
@ -939,7 +937,6 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
'db' : g.db,
'table' : g.table,
'column' : field_name,
'token' : g.token,
'curr_value' : curr_value
};
@ -990,7 +987,6 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// Make the Ajax call and get the data, wrap it and insert it
g.lastXHR = $.post('sql.php', {
'token' : g.token,
'server' : g.server,
'db' : g.db,
'ajax_request' : true,
@ -1270,7 +1266,6 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
*/
var post_params = {'ajax_request' : true,
'sql_query' : full_sql_query,
'token' : g.token,
'server' : g.server,
'db' : g.db,
'table' : g.table,
@ -2166,7 +2161,6 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// assign common hidden inputs
var $common_hidden_inputs = $(g.o).find('div.common_hidden_inputs');
g.token = $common_hidden_inputs.find('input[name=token]').val();
g.server = $common_hidden_inputs.find('input[name=server]').val();
g.db = $common_hidden_inputs.find('input[name=db]').val();
g.table = $common_hidden_inputs.find('input[name=table]').val();

View File

@ -524,7 +524,6 @@ $(function () {
type: 'POST',
data: {
server: PMA_commonParams.get('server'),
token: PMA_commonParams.get('token')
},
url: $(this).attr('href') + '&ajax_request=true',
success: function (data) {
@ -576,7 +575,6 @@ $(function () {
type: 'POST',
data: {
server: PMA_commonParams.get('server'),
token: PMA_commonParams.get('token')
},
url: $(this).attr('href') + '&ajax_request=true',
success: function (data) {
@ -613,7 +611,6 @@ $(function () {
? window.localStorage.favorite_tables
: '',
server: PMA_commonParams.get('server'),
token: PMA_commonParams.get('token')
},
success: function (data) {
if (data.changes) {
@ -946,7 +943,6 @@ function PMA_ensureNaviSettings(selflink) {
var params = {
getNaviSettings: true,
server: PMA_commonParams.get('server'),
token: PMA_commonParams.get('token')
};
var url = $('#pma_navigation').find('a.navigation_url').attr('href');
$.post(url, params, function (data) {
@ -978,7 +974,6 @@ function PMA_reloadNavigation(callback, paths) {
reload: true,
no_debug: true,
server: PMA_commonParams.get('server'),
token: PMA_commonParams.get('token')
};
paths = paths || traverseNavigationForPaths();
$.extend(params, paths);
@ -1042,7 +1037,7 @@ function PMA_navigationTreePagination($this) {
var url, params;
if ($this[0].tagName == 'A') {
url = $this.attr('href');
params = 'ajax_request=true&token=' + PMA_commonParams.get('token');
params = 'ajax_request=true';
} else { // tagName == 'SELECT'
url = 'navigation.php';
params = $this.closest("form").serialize() + '&ajax_request=true';
@ -1216,7 +1211,7 @@ var ResizeHandler = function () {
*/
this.mouseup = function (event) {
$('body').css('cursor', '');
$.cookie('pma_navi_width', event.data.resize_handler.getPos(event));
Cookies.set('pma_navi_width', event.data.resize_handler.getPos(event));
$('#topmenu').menuResizer('resize');
$(document)
.off('mousemove')
@ -1277,9 +1272,9 @@ var ResizeHandler = function () {
$('body').css('margin-bottom', $('#pma_console').height() + 'px');
};
/* Initialisation section begins here */
if ($.cookie('pma_navi_width')) {
if (Cookies.get('pma_navi_width')) {
// If we have a cookie, set the width of the panel to its value
var pos = Math.abs(parseInt($.cookie('pma_navi_width'), 10) || 0);
var pos = Math.abs(parseInt(Cookies.get('pma_navi_width'), 10) || 0);
this.setWidth(pos);
$('#topmenu').menuResizer('resize');
}

View File

@ -19,7 +19,6 @@ function appendHtmlColumnsList()
$.get(
"normalization.php",
{
"token": PMA_commonParams.get('token'),
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"table": PMA_commonParams.get('table'),
@ -40,7 +39,6 @@ function goTo3NFStep1(newTables)
$.post(
"normalization.php",
{
"token": PMA_commonParams.get('token'),
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"tables": newTables,
@ -69,7 +67,6 @@ function goTo2NFStep1() {
$.post(
"normalization.php",
{
"token": PMA_commonParams.get('token'),
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"table": PMA_commonParams.get('table'),
@ -115,7 +112,6 @@ function goToStep4()
$.post(
"normalization.php",
{
"token": PMA_commonParams.get('token'),
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"table": PMA_commonParams.get('table'),
@ -139,7 +135,6 @@ function goToStep3()
$.post(
"normalization.php",
{
"token": PMA_commonParams.get('token'),
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"table": PMA_commonParams.get('table'),
@ -164,7 +159,6 @@ function goToStep2(extra)
$.post(
"normalization.php",
{
"token": PMA_commonParams.get('token'),
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"table": PMA_commonParams.get('table'),
@ -201,7 +195,7 @@ function goTo2NFFinish(pd)
for (var dependson in pd) {
tables[dependson] = $('#extra input[name="' + dependson + '"]').val();
}
datastring = {"token": PMA_commonParams.get('token'),
datastring = {
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"table": PMA_commonParams.get('table'),
@ -248,7 +242,7 @@ function goTo3NFFinish(newTables)
}
}
}
datastring = {"token": PMA_commonParams.get('token'),
datastring = {
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"newTables":JSON.stringify(newTables),
@ -296,7 +290,7 @@ function goTo2NFStep2(pd, primary_key)
extra += '</div>';
} else {
extra += '</div>';
datastring = {"token": PMA_commonParams.get('token'),
datastring = {
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"table": PMA_commonParams.get('table'),
@ -345,7 +339,7 @@ function goTo3NFStep2(pd, tablesTds)
extra += '</div>';
} else {
extra += '</div>';
datastring = {"token": PMA_commonParams.get('token'),
datastring = {
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"tables": JSON.stringify(tablesTds),
@ -437,7 +431,7 @@ function moveRepeatingGroup(repeatingCols) {
$("input[name=repeatGroupColumn]").focus();
return false;
}
datastring = {"token": PMA_commonParams.get('token'),
datastring = {
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"table": PMA_commonParams.get('table'),
@ -496,7 +490,6 @@ AJAX.registerOnload('normalization.js', function() {
$.get(
"normalization.php",
{
"token": PMA_commonParams.get('token'),
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"table": PMA_commonParams.get('table'),
@ -529,7 +522,6 @@ AJAX.registerOnload('normalization.js', function() {
$.post(
"sql.php",
{
"token": PMA_commonParams.get('token'),
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"table": PMA_commonParams.get('table'),
@ -559,7 +551,6 @@ AJAX.registerOnload('normalization.js', function() {
$.get(
"normalization.php",
{
"token": PMA_commonParams.get('token'),
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"table": PMA_commonParams.get('table'),
@ -607,7 +598,6 @@ AJAX.registerOnload('normalization.js', function() {
$.post(
"sql.php",
{
"token": PMA_commonParams.get('token'),
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"table": PMA_commonParams.get('table'),
@ -647,7 +637,6 @@ AJAX.registerOnload('normalization.js', function() {
server: PMA_commonParams.get('server'),
db: PMA_commonParams.get('db'),
table: PMA_commonParams.get('table'),
token: PMA_commonParams.get('token'),
added_fields: 1,
add_fields:1,
index: {Key_name:'PRIMARY'},
@ -684,7 +673,6 @@ AJAX.registerOnload('normalization.js', function() {
$.post(
"normalization.php",
{
"token": PMA_commonParams.get('token'),
"ajax_request": true,
"db": PMA_commonParams.get('db'),
"table": PMA_commonParams.get('table'),

View File

@ -656,7 +656,7 @@ function Save2(callback)
{
if (pmd_tables_enabled) {
var poststr = '&operation=savePage&save_page=same&ajax_request=true';
poststr += '&server=' + server + '&db=' + db + '&token=' + PMA_commonParams.get('token') + '&selected_page=' + selected_page;
poststr += '&server=' + server + '&db=' + db + '&selected_page=' + selected_page;
poststr += Get_url_pos();
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
@ -743,7 +743,6 @@ function Save3(callback)
var $form = $('<form action="db_designer.php" method="post" name="save_page" id="save_page" class="ajax"></form>')
.append('<input type="hidden" name="server" value="' + server + '" />')
.append('<input type="hidden" name="db" value="' + db + '" />')
.append('<input type="hidden" name="token" value="' + PMA_commonParams.get('token') + '" />')
.append('<input type="hidden" name="operation" value="savePage" />')
.append('<input type="hidden" name="save_page" value="new" />')
.append('<label for="selected_value">' + PMA_messages.strPageName +
@ -788,7 +787,7 @@ function Edit_pages()
};
var $msgbox = PMA_ajaxShowMessage();
var params = 'ajax_request=true&dialog=edit&server=' + server + '&token=' + PMA_commonParams.get('token') + '&db=' + db;
var params = 'ajax_request=true&dialog=edit&server=' + server + '&db=' + db;
$.get("db_designer.php", params, function (data) {
if (data.success === false) {
PMA_ajaxShowMessage(data.error, false);
@ -868,7 +867,7 @@ function Delete_pages()
};
var $msgbox = PMA_ajaxShowMessage();
var params = 'ajax_request=true&dialog=delete&server=' + server + '&token=' + PMA_commonParams.get('token') + '&db=' + db;
var params = 'ajax_request=true&dialog=delete&server=' + server + '&db=' + db;
$.get("db_designer.php", params, function (data) {
if (data.success === false) {
PMA_ajaxShowMessage(data.error, false);
@ -967,7 +966,7 @@ function Save_as()
};
var $msgbox = PMA_ajaxShowMessage();
var params = 'ajax_request=true&dialog=save_as&server=' + server + '&token=' + PMA_commonParams.get('token') + '&db=' + db;
var params = 'ajax_request=true&dialog=save_as&server=' + server + '&token=' + '&db=' + db;
$.get("db_designer.php", params, function (data) {
if (data.success === false) {
PMA_ajaxShowMessage(data.error, false);
@ -1044,7 +1043,7 @@ function Export_pages()
$(this).dialog('close');
};
var $msgbox = PMA_ajaxShowMessage();
var params = 'ajax_request=true&dialog=export&server=' + server + '&token=' + PMA_commonParams.get('token') + '&db=' + db + '&selected_page=' + selected_page;
var params = 'ajax_request=true&dialog=export&server=' + server + '&db=' + db + '&selected_page=' + selected_page;
$.get("db_designer.php", params, function (data) {
if (data.success === false) {
PMA_ajaxShowMessage(data.error, false);
@ -1091,7 +1090,7 @@ function Load_page(page) {
if (page !== null) {
param_page = '&page=' + page;
}
$('<a href="db_designer.php?server=' + server + '&db=' + db + '&token=' + PMA_commonParams.get('token') + param_page + '"></a>')
$('<a href="db_designer.php?server=' + server + '&db=' + db + param_page + '"></a>')
.appendTo($('#page_content'))
.click();
} else {
@ -1139,7 +1138,7 @@ function Angular_direct()
function saveValueInConfig(index_sent, value_sent) {
$.post('db_designer.php',
{operation: 'save_setting_value', index: index_sent, ajax_request: true, server: server, token: PMA_commonParams.get('token'), value: value_sent},
{operation: 'save_setting_value', index: index_sent, ajax_request: true, server: server, value: value_sent},
function (data) {
if (data.success === false) {
PMA_ajaxShowMessage(data.error, false);
@ -1219,7 +1218,7 @@ function Click_field(T, f, PK) // table field
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
$.post('db_designer.php',
{operation: 'setDisplayField', ajax_request: true, server: server, token: PMA_commonParams.get('token'), db: db, table: T, field: f},
{operation: 'setDisplayField', ajax_request: true, server: server, db: db, table: T, field: f},
function (data) {
if (data.success === false) {
PMA_ajaxShowMessage(data.error, false);
@ -1234,7 +1233,7 @@ function Click_field(T, f, PK) // table field
function New_relation()
{
document.getElementById('layer_new_relation').style.display = 'none';
link_relation += '&server=' + server + '&db=' + db + '&token=' + PMA_commonParams.get('token');
link_relation += '&server=' + server + '&db=' + db;
link_relation += '&on_delete=' + document.getElementById('on_delete').value + '&on_update=' + document.getElementById('on_update').value;
link_relation += '&operation=addNewRelation&ajax_request=true';
@ -1465,7 +1464,7 @@ function Canvas_click(id, event)
function Upd_relation()
{
document.getElementById('layer_upd_relation').style.display = 'none';
link_relation += '&server=' + server + '&db=' + db + '&token=' + PMA_commonParams.get('token');
link_relation += '&server=' + server + '&db=' + db;
link_relation += '&operation=removeRelation&ajax_request=true';
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);

View File

@ -86,7 +86,6 @@ AJAX.registerOnload('replication.js', function () {
var params = {
'ajax_page_request': true,
'ajax_request': true,
'token': PMA_commonParams.get('tokens')
};
$.post(url, params, AJAX.responseHandler);
});

View File

@ -404,8 +404,7 @@ RTE.COMMON = {
var $msg = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
var params = {
'is_js_confirmed': 1,
'ajax_request': true,
'token': PMA_commonParams.get('token')
'ajax_request': true
};
$.post(url, params, function (data) {
if (data.success === true) {
@ -483,8 +482,7 @@ RTE.COMMON = {
var $curr_row = $anchor.parents('tr');
var params = {
'is_js_confirmed': 1,
'ajax_request': true,
'token': PMA_commonParams.get('token')
'ajax_request': true
};
$.post($anchor.attr('href'), params, function (data) {
returnCount++;
@ -833,8 +831,7 @@ RTE.ROUTINE = {
*/
var $msg = PMA_ajaxShowMessage();
var params = {
'ajax_request': true,
'token': PMA_commonParams.get('token')
'ajax_request': true
};
$.post($this.attr('href'), params, function (data) {
if (data.success === true) {

View File

@ -65,7 +65,6 @@ AJAX.registerOnload('server_databases.js', function () {
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest, false);
var params = getJSConfirmCommonParam(this);
params.token = PMA_commonParams.get('token');
$.post(url, params, function (data) {
if (typeof data !== 'undefined' && data.success === true) {

View File

@ -105,7 +105,6 @@ AJAX.registerOnload('server_privileges.js', function () {
var href = $("form[name='usersForm']").attr('action');
var params = {
'ajax_request' : true,
'token' : PMA_commonParams.get('token'),
'server' : PMA_commonParams.get('server'),
'validate_username' : true,
'username' : username
@ -218,14 +217,12 @@ AJAX.registerOnload('server_privileges.js', function () {
$(document).on('click', "a.edit_user_group_anchor.ajax", function (event) {
event.preventDefault();
$(this).parents('tr').addClass('current_row');
var token = $(this).parents('form').find('input[name="token"]').val();
var $msg = PMA_ajaxShowMessage();
$.get(
$(this).attr('href'),
{
'ajax_request': true,
'edit_user_group_dialog': true,
'token': token
'edit_user_group_dialog': true
},
function (data) {
if (typeof data !== 'undefined' && data.success === true) {

View File

@ -1350,8 +1350,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
chart_data: 1,
type: 'chartgrid',
requiredData: JSON.stringify(runtime.dataList),
server: PMA_commonParams.get('server'),
token: PMA_commonParams.get('token')
server: PMA_commonParams.get('server')
}, function (data) {
var chartData;
if (typeof data !== 'undefined' && data.success === true) {
@ -1984,8 +1983,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
query_analyzer: true,
query: codemirror_editor ? codemirror_editor.getValue() : $('#sqlquery').val(),
database: db,
server: PMA_commonParams.get('server'),
token: PMA_commonParams.get('token')
server: PMA_commonParams.get('server')
}, function (data) {
var i, l;
if (typeof data !== 'undefined' && data.success === true) {

View File

@ -86,8 +86,7 @@ AJAX.registerOnload('server_variables.js', function () {
ajax_request: true,
type: 'setval',
varName: varName,
varValue: $valueCell.find('input').val(),
token: PMA_commonParams.get('token')
varValue: $valueCell.find('input').val()
}, function (data) {
if (data.success) {
$valueCell

View File

@ -48,7 +48,7 @@ function PMA_autosaveSQL(query)
if (isStorageSupported('localStorage')) {
window.localStorage.auto_saved_sql = query;
} else {
$.cookie('auto_saved_sql', query);
Cookies.set('auto_saved_sql', query);
}
}
}
@ -173,8 +173,7 @@ AJAX.registerOnload('sql.js', function () {
} else {
var params = {
'ajax_request': true,
'is_js_confirmed': true,
'token': PMA_commonParams.get('token')
'is_js_confirmed': true
};
$.post(url, params, function (data) {
if (data.success) {
@ -585,7 +584,6 @@ AJAX.registerOnload('sql.js', function () {
type: 'POST',
url: $form.attr('action'),
data: {
token: PMA_commonParams.get('token'),
server: PMA_commonParams.get('server'),
db: db_name,
ajax_request: '1',

View File

@ -404,14 +404,12 @@ AJAX.registerOnload('tbl_change.js', function () {
var type = $span.parents('tr').find('span.column_type').text();
// Names of input field and null checkbox
var input_name = $span.parent('td').children("input[type='text']").attr('name');
//Token
var token = $("input[name='token']").val();
openGISEditor();
if (!gisEditorLoaded) {
loadJSAndGISEditor(value, field, type, input_name, token);
loadJSAndGISEditor(value, field, type, input_name);
} else {
loadGISEditor(value, field, type, input_name, token);
loadGISEditor(value, field, type, input_name);
}
});

View File

@ -137,8 +137,7 @@ AJAX.registerOnload('tbl_operations.js', function () {
//variables which stores the common attributes
var params = {
ajax_request: 1,
server: PMA_commonParams.get('server'),
token: PMA_commonParams.get('token')
server: PMA_commonParams.get('server')
};
$.post($(this).attr('href'), params, function (data) {
function scrollToTop() {
@ -217,7 +216,6 @@ AJAX.registerOnload('tbl_operations.js', function () {
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
var params = getJSConfirmCommonParam(this);
params.token = PMA_commonParams.get('token');
$.post(url, params, function (data) {
if (typeof data !== 'undefined' && data.success === true) {
@ -254,8 +252,7 @@ AJAX.registerOnload('tbl_operations.js', function () {
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
var params = {
'is_js_confirmed': '1',
'ajax_request': true,
'token': PMA_commonParams.get('token')
'ajax_request': true
};
$.post(url, params, function (data) {
if (typeof data !== 'undefined' && data.success === true) {
@ -290,7 +287,6 @@ AJAX.registerOnload('tbl_operations.js', function () {
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
var params = getJSConfirmCommonParam(this);
params.token = PMA_commonParams.get('token');
$.post(url, params, function (data) {
if ($(".sqlqueryresults").length !== 0) {

View File

@ -70,7 +70,6 @@ function getDropdownValues($dropdown) {
var $msgbox = PMA_ajaxShowMessage();
var $form = $dropdown.parents('form');
var url = 'tbl_relation.php?getDropdownValues=true&ajax_request=true' +
'&token=' + $form.find('input[name="token"]').val() +
'&db=' + $form.find('input[name="db"]').val() +
'&table=' + $form.find('input[name="table"]').val() +
'&foreign=' + (foreign !== '') +
@ -221,8 +220,7 @@ AJAX.registerOnload('tbl_relation.js', function () {
var $msg = PMA_ajaxShowMessage(PMA_messages.strDroppingForeignKey, false);
var params = {
'is_js_confirmed': 1,
'ajax_request': true,
'token': PMA_commonParams.get('token')
'ajax_request': true
};
$.post(url, params, function (data) {
if (data.success === true) {

View File

@ -156,7 +156,6 @@ AJAX.registerOnload('tbl_select.js', function () {
} else {
values.displayAllColumns = true;
}
values.token = PMA_commonParams.get('token');
$.post($search_form.attr('action'), values, function (data) {
PMA_ajaxRemoveMessage($msgbox);
@ -269,13 +268,12 @@ AJAX.registerOnload('tbl_select.js', function () {
// Names of input field and null checkbox
var input_name = $span.parent('td').children("input[type='text']").attr('name');
//Token
var token = $("input[name='token']").val();
openGISEditor();
if (!gisEditorLoaded) {
loadJSAndGISEditor(value, field, type, input_name, token);
loadJSAndGISEditor(value, field, type, input_name);
} else {
loadGISEditor(value, field, type, input_name, token);
loadGISEditor(value, field, type, input_name);
}
});
@ -309,7 +307,6 @@ AJAX.registerOnload('tbl_select.js', function () {
type: 'POST',
data: {
server: PMA_commonParams.get('server'),
token: PMA_commonParams.get('token'),
ajax_request: 1,
db: $('input[name="db"]').val(),
table: $('input[name="table"]').val(),

View File

@ -216,8 +216,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
var params = {
'is_js_confirmed' : 1,
'ajax_request' : true,
'ajax_page_request' : true,
'token': PMA_commonParams.get('token')
'ajax_page_request' : true
};
$.post(url, params, function (data) {
if (typeof data !== 'undefined' && data.success === true) {
@ -302,8 +301,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
AJAX.source = $this;
var params = {
'ajax_request' : true,
'ajax_page_request' : true,
'token': PMA_commonParams.get('token')
'ajax_page_request' : true
};
$.post(url, params, AJAX.responseHandler);
}); // end $.PMA_confirm()
@ -462,8 +460,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
function submitPartitionAction(url) {
var params = {
'ajax_request' : true,
'ajax_page_request' : true,
'token': PMA_commonParams.get('token')
'ajax_page_request' : true
};
PMA_ajaxShowMessage();
AJAX.source = $link;
@ -495,8 +492,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
$link.PMA_confirm(question, $link.attr('href'), function (url) {
var params = {
'ajax_request' : true,
'ajax_page_request' : true,
'token': PMA_commonParams.get('token')
'ajax_page_request' : true
};
PMA_ajaxShowMessage();
AJAX.source = $link;

View File

@ -82,8 +82,7 @@ AJAX.registerOnload('tbl_tracking.js', function () {
AJAX.source = $anchor;
var params = {
'ajax_page_request': true,
'ajax_request': true,
'token': PMA_commonParams.get('token')
'ajax_request': true
};
$.post(url, params, AJAX.responseHandler);
});
@ -101,10 +100,9 @@ AJAX.registerOnload('tbl_tracking.js', function () {
AJAX.source = $anchor;
var params = {
'ajax_page_request': true,
'ajax_request': true,
'token': PMA_commonParams.get('token')
'ajax_request': true
};
$.post(url, params, AJAX.responseHandler);
});
});
});
});

View File

@ -158,8 +158,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
'db' : PMA_commonParams.get('db'),
'table' : PMA_commonParams.get('table'),
'field' : $('#tableid_0').val(),
'it' : 0,
'token' : PMA_commonParams.get('token')
'it' : 0
}, function (data) {
$('#tableFieldsId').find('tr:eq(1) td:eq(0)').html(data.field_type);
$('#tableFieldsId').find('tr:eq(1) td:eq(1)').html(data.field_collation);
@ -183,8 +182,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
'db' : PMA_commonParams.get('db'),
'table' : PMA_commonParams.get('table'),
'field' : $('#tableid_1').val(),
'it' : 1,
'token' : PMA_commonParams.get('token')
'it' : 1
}, function (data) {
$('#tableFieldsId').find('tr:eq(3) td:eq(0)').html(data.field_type);
$('#tableFieldsId').find('tr:eq(3) td:eq(1)').html(data.field_collation);
@ -207,8 +205,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
'db' : PMA_commonParams.get('db'),
'table' : PMA_commonParams.get('table'),
'field' : $('#tableid_2').val(),
'it' : 2,
'token' : PMA_commonParams.get('token')
'it' : 2
}, function (data) {
$('#tableFieldsId').find('tr:eq(6) td:eq(0)').html(data.field_type);
$('#tableFieldsId').find('tr:eq(6) td:eq(1)').html(data.field_collation);
@ -229,8 +226,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
'db' : PMA_commonParams.get('db'),
'table' : PMA_commonParams.get('table'),
'field' : $('#tableid_3').val(),
'it' : 3,
'token' : PMA_commonParams.get('token')
'it' : 3
}, function (data) {
$('#tableFieldsId').find('tr:eq(8) td:eq(0)').html(data.field_type);
$('#tableFieldsId').find('tr:eq(8) td:eq(1)').html(data.field_collation);
@ -397,7 +393,6 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
//Post SQL query to sql.php
$.post('sql.php', {
'token' : PMA_commonParams.get('token'),
'server' : PMA_commonParams.get('server'),
'db' : PMA_commonParams.get('db'),
'ajax_request' : true,
@ -598,8 +593,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
'server' : PMA_commonParams.get('server'),
'db' : PMA_commonParams.get('db'),
'table' : PMA_commonParams.get('table'),
'where_clause' : data[3],
'token' : PMA_commonParams.get('token')
'where_clause' : data[3]
};
$.post('tbl_zoom_select.php', post_params, function (data) {

View File

@ -310,7 +310,6 @@ class Footer
if (! $this->_isAjax && ! $this->_isMinimal) {
if (Core::getenv('SCRIPT_NAME')
&& empty($_POST)
&& empty($GLOBALS['checked_special'])
&& ! $this->_isAjax
) {
$url = $this->getSelfUrl();

View File

@ -155,7 +155,7 @@ class Header
$this->_scripts->addFile('ajax.js');
$this->_scripts->addFile('keyhandler.js');
$this->_scripts->addFile('jquery/jquery-ui.min.js');
$this->_scripts->addFile('jquery/jquery.cookie.js');
$this->_scripts->addFile('js.cookie.js');
$this->_scripts->addFile('jquery/jquery.mousewheel.js');
$this->_scripts->addFile('jquery/jquery.event.drag-2.2.js');
$this->_scripts->addFile('jquery/jquery-ui-timepicker-addon.js');
@ -247,6 +247,7 @@ class Header
'session_gc_maxlifetime' => (int)@ini_get('session.gc_maxlifetime'),
'logged_in' => isset($GLOBALS['userlink']) ? true : false,
'is_https' => $GLOBALS['PMA_Config']->isHttps(),
'rootPath' => $GLOBALS['PMA_Config']->getRootPath(),
'PMA_VERSION' => PMA_VERSION
);
if (isset($GLOBALS['cfg']['Server'])

View File

@ -95,14 +95,16 @@ class Menu
*/
private function _getMenu()
{
$url_params = array('db' => $this->_db);
$url_params = array();
if (strlen($this->_table) > 0) {
$tabs = $this->_getTableTabs();
$url_params['db'] = $this->_db;
$url_params['table'] = $this->_table;
$level = 'table';
} else if (strlen($this->_db) > 0) {
$tabs = $this->_getDbTabs();
$url_params['db'] = $this->_db;
$level = 'db';
} else {
$tabs = $this->_getServerTabs();

View File

@ -1644,22 +1644,14 @@ class Util
}
}
// If there are any tab specific URL parameters, merge those with
// the general URL parameters
if (! empty($tab['url_params']) && is_array($tab['url_params'])) {
$url_params = array_merge($url_params, $tab['url_params']);
}
// build the link
if (! empty($tab['link'])) {
$tab['link'] = htmlentities($tab['link']);
$tab['link'] = $tab['link'] . URL::getCommon($url_params);
if (! empty($tab['args'])) {
foreach ($tab['args'] as $param => $value) {
$tab['link'] .= URL::getArgSeparator('html')
. urlencode($param) . '=' . urlencode($value);
}
// If there are any tab specific URL parameters, merge those with
// the general URL parameters
if (! empty($tab['args']) && is_array($tab['args'])) {
$url_params = array_merge($url_params, $tab['args']);
}
$tab['link'] = htmlentities($tab['link']) . URL::getCommon($url_params);
}
if (! empty($tab['fragment'])) {
@ -1983,33 +1975,18 @@ class Util
*
* @param string[] $params The names of the parameters needed by the calling
* script
* @param bool $request Whether to include this list in checking for
* special params
*
* @return void
*
* @global boolean $checked_special flag whether any special variable
* was required
*
* @access public
*/
public static function checkParameters($params, $request = true)
public static function checkParameters($params)
{
global $checked_special;
if (! isset($checked_special)) {
$checked_special = false;
}
$reported_script_name = basename($GLOBALS['PMA_PHP_SELF']);
$found_error = false;
$error_message = '';
foreach ($params as $param) {
if ($request && ($param != 'db') && ($param != 'table')) {
$checked_special = true;
}
if (! isset($GLOBALS[$param])) {
$error_message .= $reported_script_name
. ': ' . __('Missing parameter:') . ' '

View File

@ -34,10 +34,6 @@ require_once 'libraries/config/page_settings.forms.php';
*/
class DatabaseStructureController extends DatabaseController
{
/**
* @var string The URL query string
*/
protected $_url_query;
/**
* @var int Number of tables
*/
@ -63,17 +59,6 @@ class DatabaseStructureController extends DatabaseController
*/
protected $_is_show_stats;
/**
* DatabaseStructureController constructor
*
* @param string $url_query URL query
*/
public function __construct($url_query) {
parent::__construct();
$this->_url_query = $url_query;
}
/**
* Retrieves databse information for further use
*
@ -142,8 +127,6 @@ class DatabaseStructureController extends DatabaseController
)
);
$this->_url_query .= '&amp;goto=db_structure.php';
// Gets the database structure
$this->_getDbInfo('_structure');
@ -220,7 +203,12 @@ class DatabaseStructureController extends DatabaseController
/* Printable view of a table */
$this->response->addHTML(
Template::get('database/structure/print_view_data_dictionary_link')
->render(array('url_query' => $this->_url_query))
->render(array('url_query' => URL::getCommon(
array(
'db' => $this->db,
'goto' => 'db_structure.php',
)
)))
);
if (empty($this->_db_is_system_schema)) {
@ -419,8 +407,9 @@ class DatabaseStructureController extends DatabaseController
$table_is_view = false;
// Sets parameters for links
$tbl_url_query = $this->_url_query
. '&amp;table=' . htmlspecialchars($current_table['TABLE_NAME']);
$tbl_url_query = URL::getCommon(
array('db' => $this->db, 'table' => $current_table['TABLE_NAME'])
);
// do not list the previous table's size info for a view
list($current_table, $formatted_size, $unit, $formatted_overhead,

View File

@ -24,7 +24,7 @@ if (empty($viewing_mode)) {
/**
* Set parameters for links
*/
$GLOBALS['url_query'] = URL::getCommon(array('db' => $db));
$GLOBALS['url_query'] = URL::getCommon();
/**
* Defines the urls to return to in case of error in a sql statement
@ -43,10 +43,6 @@ if ($GLOBALS['is_superuser']) {
$GLOBALS['dbi']->selectDb('mysql', $GLOBALS['userlink']);
}
PMA\libraries\Util::checkParameters(
array('is_superuser', 'url_query'), false
);
/**
* shared functions for server page
*/

View File

@ -105,7 +105,7 @@
]
} only %}
<div class="content bookmark">
{{ bookmark_content }}
{{ bookmark_content|raw }}
</div>
<div class="mid_layer"></div>
<div class="card add">