function execute($par) { global $wgOut; global $wgRequest; $cacheManager = new \PageAttachment\Cache\CacheManager(); $pageFactory = new \PageAttachment\Session\PageFactory($cacheManager); $security = new \PageAttachment\Security\SecurityManager(); $session = new \PageAttachment\Session\Session($security, $pageFactory); $attachToPage = $session->getAttachToPage(); if (isset($attachToPage) && $attachToPage->getId() > 0) { $protectedPage = $attachToPage->isProtected(); if (!$security->isAuditLogViewAllowed($protectedPage)) { if ($security->isAuditLogViewRequireLogin($protectedPage) && !$security->isLoggedIn()) { $session->setStatusMessage('YouMustBeLoggedInToViewAuditLog'); } else { $session->setStatusMessage('AuditLogViewingIsNotPermitted'); } $wgOut->redirect($attachToPage->getFullURL()); } else { $attachmentName = $wgRequest->getVal("attachmentName", null); if (isset($attachmentName)) { $attachmentName = base64_decode($attachmentName); } $this->setHeaders(); $pager = new AuditLogPager($attachToPage, $attachmentName); $limit = $pager->getForm(); $body = $pager->getBody(); $nav = $pager->getNavigationBar(); $wgOut->addHTML("{$limit}<br />\n{$nav}<br />\n{$body}<br />\n{$nav}"); } } else { $session->setStatusMessage('UnableToDetermineAttachToPage'); $title = \Title::newFromText(\wfMsgForContent('mainpage')); $wgOut->redirect($title->getFullURL()); } }