modxcms/revolution — pull request #11204 by exside (2014-03-12 16:44:58+00:00)
Title: Make preview possible if session_enabled = 0

For many sites sessions_enabled = 0 (set in the context!) can speed up load times dramatically if no user sessions, e.g. personalization, are needed. The problem that comes with this context setting is, that editors that are logged into the manager are not able to preview unpublished resources anymore, which makes this nice option useless in real world website management.

This PR fixes the issue by 1. adjusting the preview URL in the manager if a sessions_enabled context setting is detected > setting get param ?preview and 2. checking for that get param in the initSession() method of the modx core class and forcing a session if the preview param is set.

I thought about making some more security checks, but I couldn't load an unpublished resource from a not logged in browser, so this seemed to be unnecessary, but if somebody sees a potential security issue here, please comment and/or improve this PR!