From: Alexander Ebert Date: Mon, 30 Jun 2014 18:25:47 +0000 (+0200) Subject: Improved autosave to use prefixed keys X-Git-Tag: 2.1.0_Alpha_1~641^2~15 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=da75df6388e8a1dc3ea5de9f886cfe76276c6c04;p=GitHub%2FWoltLab%2FWCF.git Improved autosave to use prefixed keys --- diff --git a/com.woltlab.wcf/templates/wysiwyg.tpl b/com.woltlab.wcf/templates/wysiwyg.tpl index d8951b3601..0b84dc4434 100644 --- a/com.woltlab.wcf/templates/wysiwyg.tpl +++ b/com.woltlab.wcf/templates/wysiwyg.tpl @@ -41,7 +41,7 @@ $(function() { plugins: [ 'wutil', 'wmonkeypatch', 'wbutton', 'wbbcode', 'wfontcolor', 'wfontfamily', 'wfontsize' ], wautosave: { active: ($autosave) ? true : false, - key: ($autosave) ? $autosave : '', + key: ($autosave) ? '{@$__wcf->getAutosavePrefix()}_' + $autosave : '', saveOnInit: {if !$errorField|empty}true{else}false{/if} } }; diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js index 031289470c..db311e4fd0 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js @@ -203,7 +203,6 @@ RedactorPlugins.wutil = { } if (this._autosaveWorker === null) { - var self = this; this._autosaveWorker = new WCF.PeriodicalExecuter($.proxy(this._saveTextToStorage, this), 60 * 1000); } diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 7c0008d30d..bc01e55fc0 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -810,6 +810,15 @@ class WCF { return RouteHandler::secureConnection(); } + /** + * Returns a 8 character prefix for editor autosave. + * + * @return string + */ + public function getAutosavePrefix() { + return substr(sha1(preg_replace('~^https~', 'http', WCF::getPath())), 0, 8); + } + /** * Initialises the cronjobs. */