function rex_version_initArticle($params) { global $REX; $version = rex_request('rex_version', 'int'); if ($version == '') { return; } rex_login::startSession(); $REX['LOGIN'] = new rex_backend_login($REX['TABLE_PREFIX'] . 'user'); if ($REX['PSWFUNC'] != '') { $REX['LOGIN']->setPasswordFunction($REX['PSWFUNC']); } if ($REX['LOGIN']->checkLogin() !== true) { return; } $REX['USER'] =& $REX['LOGIN']->USER; $params['article']->setSliceRevision($version); if (is_a($params['article'], 'rex_article')) { $params['article']->getContentAsQuery(); } $params['article']->setEval(true); }
/** * Version. * * @author jan@kristinus.de * * @package redaxo5 */ $mypage = 'version'; rex_perm::register('version[live_version]', null, rex_perm::OPTIONS); // ***** an EPs andocken rex_extension::register('ART_INIT', function (rex_extension_point $ep) { $version = rex_request('rex_version', 'int'); if ($version != 1) { return; } rex_login::startSession(); if (!rex_backend_login::hasSession()) { throw new rex_exception('no permission for the working version'); } $article = $ep->getParam('article'); $article->setSliceRevision($version); if ($article instanceof rex_article_content) { $article->getContentAsQuery(); } $article->setEval(true); }); rex_extension::register('PAGE_CONTENT_HEADER', function (rex_extension_point $ep) { $params = $ep->getParams(); $return = ''; $rex_version_article = rex::getProperty('login')->getSessionVar('rex_version_article'); if (!is_array($rex_version_article)) {