Fix saving schema to cookie in Opera and Firefox 4
This commit is contained in:
parent
806264851e
commit
3eba7310da
|
@ -4,7 +4,8 @@ page_header(lang('Database schema'), "", array(), DB);
|
||||||
$table_pos = array();
|
$table_pos = array();
|
||||||
$table_pos_js = array();
|
$table_pos_js = array();
|
||||||
// saved in one cookie because there is a limit of 20 cookies per domain
|
// saved in one cookie because there is a limit of 20 cookies per domain
|
||||||
preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~', ($_GET["schema"] ? $_GET["schema"] : $_COOKIE["adminer_schema"]), $matches, PREG_SET_ORDER); //! ':' in table name
|
$name = "adminer_schema";
|
||||||
|
preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~', ($_GET["schema"] ? $_GET["schema"] : $_COOKIE[($_COOKIE["$name-" . DB] ? "$name-" . DB : $name)]), $matches, PREG_SET_ORDER); // $_COOKIE["adminer_schema"] was used before 3.2.0 //! ':' in table name
|
||||||
foreach ($matches as $i => $match) {
|
foreach ($matches as $i => $match) {
|
||||||
$table_pos[$match[1]] = array($match[2], $match[3]);
|
$table_pos[$match[1]] = array($match[2], $match[3]);
|
||||||
$table_pos_js[] = "\n\t'" . js_escape($match[1]) . "': [ $match[2], $match[3] ]";
|
$table_pos_js[] = "\n\t'" . js_escape($match[1]) . "': [ $match[2], $match[3] ]";
|
||||||
|
@ -53,7 +54,9 @@ foreach (table_status() as $row) {
|
||||||
tablePos = {<?php echo implode(",", $table_pos_js) . "\n"; ?>};
|
tablePos = {<?php echo implode(",", $table_pos_js) . "\n"; ?>};
|
||||||
em = document.getElementById('schema').offsetHeight / <?php echo $top; ?>;
|
em = document.getElementById('schema').offsetHeight / <?php echo $top; ?>;
|
||||||
document.onmousemove = schemaMousemove;
|
document.onmousemove = schemaMousemove;
|
||||||
document.onmouseup = schemaMouseup;
|
document.onmouseup = function (ev) {
|
||||||
|
schemaMouseup(ev, '<?php echo js_escape(DB); ?>');
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
foreach ($schema as $name => $table) {
|
foreach ($schema as $name => $table) {
|
||||||
|
|
|
@ -397,8 +397,9 @@ function schemaMousemove(ev) {
|
||||||
|
|
||||||
/** Finish move
|
/** Finish move
|
||||||
* @param MouseEvent
|
* @param MouseEvent
|
||||||
|
* @param string
|
||||||
*/
|
*/
|
||||||
function schemaMouseup(ev) {
|
function schemaMouseup(ev, db) {
|
||||||
if (that !== undefined) {
|
if (that !== undefined) {
|
||||||
ev = ev || event;
|
ev = ev || event;
|
||||||
tablePos[that.firstChild.firstChild.firstChild.data] = [ (ev.clientY - y) / em, (ev.clientX - x) / em ];
|
tablePos[that.firstChild.firstChild.firstChild.data] = [ (ev.clientY - y) / em, (ev.clientX - x) / em ];
|
||||||
|
@ -410,6 +411,6 @@ function schemaMouseup(ev) {
|
||||||
s = encodeURIComponent(s.substr(1));
|
s = encodeURIComponent(s.substr(1));
|
||||||
var link = document.getElementById('schema-link');
|
var link = document.getElementById('schema-link');
|
||||||
link.href = link.href.replace(/[^=]+$/, '') + s;
|
link.href = link.href.replace(/[^=]+$/, '') + s;
|
||||||
cookie('adminer_schema=' + s, 30, '; path="' + location.pathname + location.search + '"');
|
cookie('adminer_schema-' + db + '=' + s, 30); //! special chars in db
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,10 @@ function toggle(id) {
|
||||||
* @param number
|
* @param number
|
||||||
* @param string optional
|
* @param string optional
|
||||||
*/
|
*/
|
||||||
function cookie(assign, days, params) {
|
function cookie(assign, days) {
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
date.setDate(date.getDate() + days);
|
date.setDate(date.getDate() + days);
|
||||||
document.cookie = assign + '; expires=' + date + (params || '');
|
document.cookie = assign + '; expires=' + date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Verify current Adminer version
|
/** Verify current Adminer version
|
||||||
|
|
|
@ -18,6 +18,7 @@ Homepage customization
|
||||||
Use IN for search in numeric fields (Editor)
|
Use IN for search in numeric fields (Editor)
|
||||||
Use password input for _md5 and _sha1 fields (Editor)
|
Use password input for _md5 and _sha1 fields (Editor)
|
||||||
Work without session.use_cookies (bug #3138640)
|
Work without session.use_cookies (bug #3138640)
|
||||||
|
Fix saving schema to cookie in Opera
|
||||||
Portuguese, Slovenian and Turkish translation
|
Portuguese, Slovenian and Turkish translation
|
||||||
|
|
||||||
Adminer 3.1.0 (released 2010-11-16):
|
Adminer 3.1.0 (released 2010-11-16):
|
||||||
|
|
Loading…
Reference in a new issue