@@ -10,19 +10,19 @@ |
||
| 10 | 10 | |
| 11 | 11 | class PageRegisterStandard extends PageRegisterBase |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * @return string |
|
| 15 | - */ |
|
| 16 | - protected function getRegistrationTemplate() |
|
| 17 | - { |
|
| 18 | - return "registration/register.tpl"; |
|
| 19 | - } |
|
| 13 | + /** |
|
| 14 | + * @return string |
|
| 15 | + */ |
|
| 16 | + protected function getRegistrationTemplate() |
|
| 17 | + { |
|
| 18 | + return "registration/register.tpl"; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @return string |
|
| 23 | - */ |
|
| 24 | - protected function getDefaultRole() |
|
| 25 | - { |
|
| 26 | - return 'user'; |
|
| 27 | - } |
|
| 21 | + /** |
|
| 22 | + * @return string |
|
| 23 | + */ |
|
| 24 | + protected function getDefaultRole() |
|
| 25 | + { |
|
| 26 | + return 'user'; |
|
| 27 | + } |
|
| 28 | 28 | } |
@@ -15,37 +15,37 @@ |
||
| 15 | 15 | |
| 16 | 16 | class PageSiteNotice extends InternalPageBase |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Main function for this page, when no specific actions are called. |
|
| 20 | - * @return void |
|
| 21 | - */ |
|
| 22 | - protected function main() |
|
| 23 | - { |
|
| 24 | - $this->setHtmlTitle('Site Notice'); |
|
| 25 | - |
|
| 26 | - $database = $this->getDatabase(); |
|
| 27 | - |
|
| 28 | - /** @var SiteNotice $siteNoticeMessage */ |
|
| 29 | - $siteNoticeMessage = SiteNotice::getById(1, $database); |
|
| 30 | - |
|
| 31 | - // Dual-mode |
|
| 32 | - if (WebRequest::wasPosted()) { |
|
| 33 | - $this->validateCSRFToken(); |
|
| 34 | - |
|
| 35 | - $siteNoticeMessage->setContent(WebRequest::postString('mailtext')); |
|
| 36 | - $siteNoticeMessage->setUpdateVersion(WebRequest::postInt('updateversion')); |
|
| 37 | - $siteNoticeMessage->save(); |
|
| 38 | - |
|
| 39 | - Logger::siteNoticeEdited($database, $siteNoticeMessage); |
|
| 40 | - $this->getNotificationHelper()->siteNoticeEdited(); |
|
| 41 | - |
|
| 42 | - $this->redirect(); |
|
| 43 | - } |
|
| 44 | - else { |
|
| 45 | - $this->assignCSRFToken(); |
|
| 46 | - |
|
| 47 | - $this->setTemplate('site-notice/edit-form.tpl'); |
|
| 48 | - $this->assign('message', $siteNoticeMessage); |
|
| 49 | - } |
|
| 50 | - } |
|
| 18 | + /** |
|
| 19 | + * Main function for this page, when no specific actions are called. |
|
| 20 | + * @return void |
|
| 21 | + */ |
|
| 22 | + protected function main() |
|
| 23 | + { |
|
| 24 | + $this->setHtmlTitle('Site Notice'); |
|
| 25 | + |
|
| 26 | + $database = $this->getDatabase(); |
|
| 27 | + |
|
| 28 | + /** @var SiteNotice $siteNoticeMessage */ |
|
| 29 | + $siteNoticeMessage = SiteNotice::getById(1, $database); |
|
| 30 | + |
|
| 31 | + // Dual-mode |
|
| 32 | + if (WebRequest::wasPosted()) { |
|
| 33 | + $this->validateCSRFToken(); |
|
| 34 | + |
|
| 35 | + $siteNoticeMessage->setContent(WebRequest::postString('mailtext')); |
|
| 36 | + $siteNoticeMessage->setUpdateVersion(WebRequest::postInt('updateversion')); |
|
| 37 | + $siteNoticeMessage->save(); |
|
| 38 | + |
|
| 39 | + Logger::siteNoticeEdited($database, $siteNoticeMessage); |
|
| 40 | + $this->getNotificationHelper()->siteNoticeEdited(); |
|
| 41 | + |
|
| 42 | + $this->redirect(); |
|
| 43 | + } |
|
| 44 | + else { |
|
| 45 | + $this->assignCSRFToken(); |
|
| 46 | + |
|
| 47 | + $this->setTemplate('site-notice/edit-form.tpl'); |
|
| 48 | + $this->assign('message', $siteNoticeMessage); |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | 51 | } |
@@ -40,8 +40,7 @@ |
||
| 40 | 40 | $this->getNotificationHelper()->siteNoticeEdited(); |
| 41 | 41 | |
| 42 | 42 | $this->redirect(); |
| 43 | - } |
|
| 44 | - else { |
|
| 43 | + } else { |
|
| 45 | 44 | $this->assignCSRFToken(); |
| 46 | 45 | |
| 47 | 46 | $this->setTemplate('site-notice/edit-form.tpl'); |
@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | class StatsReservedRequests extends InternalPageBase |
| 15 | 15 | { |
| 16 | - public function main() |
|
| 17 | - { |
|
| 18 | - $this->setHtmlTitle('Reserved Requests :: Statistics'); |
|
| 16 | + public function main() |
|
| 17 | + { |
|
| 18 | + $this->setHtmlTitle('Reserved Requests :: Statistics'); |
|
| 19 | 19 | |
| 20 | - $query = <<<sql |
|
| 20 | + $query = <<<sql |
|
| 21 | 21 | SELECT |
| 22 | 22 | p.id AS requestid, |
| 23 | 23 | p.name AS name, |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | WHERE reserved != 0; |
| 30 | 30 | sql; |
| 31 | 31 | |
| 32 | - $database = $this->getDatabase(); |
|
| 33 | - $statement = $database->query($query); |
|
| 34 | - $data = $statement->fetchAll(PDO::FETCH_ASSOC); |
|
| 35 | - $this->assign('dataTable', $data); |
|
| 36 | - $this->assign('statsPageTitle', 'All currently reserved requests'); |
|
| 37 | - $this->setTemplate('statistics/reserved-requests.tpl'); |
|
| 38 | - } |
|
| 32 | + $database = $this->getDatabase(); |
|
| 33 | + $statement = $database->query($query); |
|
| 34 | + $data = $statement->fetchAll(PDO::FETCH_ASSOC); |
|
| 35 | + $this->assign('dataTable', $data); |
|
| 36 | + $this->assign('statsPageTitle', 'All currently reserved requests'); |
|
| 37 | + $this->setTemplate('statistics/reserved-requests.tpl'); |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -48,8 +48,7 @@ |
||
| 48 | 48 | |
| 49 | 49 | if ($request->getEmailConfirm() === $si) { |
| 50 | 50 | $request->setEmailConfirm('Confirmed'); |
| 51 | - } |
|
| 52 | - else { |
|
| 51 | + } else { |
|
| 53 | 52 | throw new ApplicationLogicException('The confirmation value does not appear to match the expected value'); |
| 54 | 53 | } |
| 55 | 54 | |
@@ -19,70 +19,70 @@ |
||
| 19 | 19 | |
| 20 | 20 | class PageConfirmEmail extends PublicInterfacePageBase |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * Main function for this page, when no specific actions are called. |
|
| 24 | - * @throws ApplicationLogicException |
|
| 25 | - * @throws Exception |
|
| 26 | - */ |
|
| 27 | - protected function main() |
|
| 28 | - { |
|
| 29 | - $id = WebRequest::getInt('id'); |
|
| 30 | - $si = WebRequest::getString('si'); |
|
| 31 | - |
|
| 32 | - if ($id === null || $si === null) { |
|
| 33 | - throw new ApplicationLogicException('Link incomplete - please double check the link you received.'); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - /** @var Request|false $request */ |
|
| 37 | - $request = Request::getById($id, $this->getDatabase()); |
|
| 38 | - |
|
| 39 | - if ($request === false) { |
|
| 40 | - throw new ApplicationLogicException('Request not found'); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - if ($request->getEmailConfirm() === 'Confirmed') { |
|
| 44 | - // request has already been confirmed. Bomb out silently. |
|
| 45 | - $this->redirect('requestSubmitted'); |
|
| 46 | - |
|
| 47 | - return; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - if ($request->getEmailConfirm() === $si) { |
|
| 51 | - $request->setEmailConfirm('Confirmed'); |
|
| 52 | - } |
|
| 53 | - else { |
|
| 54 | - throw new ApplicationLogicException('The confirmation value does not appear to match the expected value'); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - try { |
|
| 58 | - $request->save(); |
|
| 59 | - } |
|
| 60 | - catch (OptimisticLockFailedException $ex) { |
|
| 61 | - // Okay. Someone's edited this in the time between us loading this page and doing the checks, and us getting |
|
| 62 | - // to saving the page. We *do not* want to show an optimistic lock failure, the most likely problem is they |
|
| 63 | - // double-loaded this page (see #255). Let's confirm this, and bomb out with a success message if it's the |
|
| 64 | - // case. |
|
| 65 | - |
|
| 66 | - $request = Request::getById($id, $this->getDatabase()); |
|
| 67 | - if ($request->getEmailConfirm() === 'Confirmed') { |
|
| 68 | - // we've already done the sanity checks above |
|
| 69 | - |
|
| 70 | - $this->redirect('requestSubmitted'); |
|
| 71 | - |
|
| 72 | - // skip the log and notification |
|
| 73 | - return; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - // something really weird happened. Another race condition? |
|
| 77 | - throw $ex; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - Logger::emailConfirmed($this->getDatabase(), $request); |
|
| 81 | - |
|
| 82 | - if ($request->getStatus() != RequestStatus::CLOSED) { |
|
| 83 | - $this->getNotificationHelper()->requestReceived($request); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - $this->redirect('requestSubmitted'); |
|
| 87 | - } |
|
| 22 | + /** |
|
| 23 | + * Main function for this page, when no specific actions are called. |
|
| 24 | + * @throws ApplicationLogicException |
|
| 25 | + * @throws Exception |
|
| 26 | + */ |
|
| 27 | + protected function main() |
|
| 28 | + { |
|
| 29 | + $id = WebRequest::getInt('id'); |
|
| 30 | + $si = WebRequest::getString('si'); |
|
| 31 | + |
|
| 32 | + if ($id === null || $si === null) { |
|
| 33 | + throw new ApplicationLogicException('Link incomplete - please double check the link you received.'); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + /** @var Request|false $request */ |
|
| 37 | + $request = Request::getById($id, $this->getDatabase()); |
|
| 38 | + |
|
| 39 | + if ($request === false) { |
|
| 40 | + throw new ApplicationLogicException('Request not found'); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + if ($request->getEmailConfirm() === 'Confirmed') { |
|
| 44 | + // request has already been confirmed. Bomb out silently. |
|
| 45 | + $this->redirect('requestSubmitted'); |
|
| 46 | + |
|
| 47 | + return; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + if ($request->getEmailConfirm() === $si) { |
|
| 51 | + $request->setEmailConfirm('Confirmed'); |
|
| 52 | + } |
|
| 53 | + else { |
|
| 54 | + throw new ApplicationLogicException('The confirmation value does not appear to match the expected value'); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + try { |
|
| 58 | + $request->save(); |
|
| 59 | + } |
|
| 60 | + catch (OptimisticLockFailedException $ex) { |
|
| 61 | + // Okay. Someone's edited this in the time between us loading this page and doing the checks, and us getting |
|
| 62 | + // to saving the page. We *do not* want to show an optimistic lock failure, the most likely problem is they |
|
| 63 | + // double-loaded this page (see #255). Let's confirm this, and bomb out with a success message if it's the |
|
| 64 | + // case. |
|
| 65 | + |
|
| 66 | + $request = Request::getById($id, $this->getDatabase()); |
|
| 67 | + if ($request->getEmailConfirm() === 'Confirmed') { |
|
| 68 | + // we've already done the sanity checks above |
|
| 69 | + |
|
| 70 | + $this->redirect('requestSubmitted'); |
|
| 71 | + |
|
| 72 | + // skip the log and notification |
|
| 73 | + return; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + // something really weird happened. Another race condition? |
|
| 77 | + throw $ex; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + Logger::emailConfirmed($this->getDatabase(), $request); |
|
| 81 | + |
|
| 82 | + if ($request->getStatus() != RequestStatus::CLOSED) { |
|
| 83 | + $this->getNotificationHelper()->requestReceived($request); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + $this->redirect('requestSubmitted'); |
|
| 87 | + } |
|
| 88 | 88 | } |
| 89 | 89 | \ No newline at end of file |
@@ -29,8 +29,7 @@ |
||
| 29 | 29 | foreach ($teamData as $name => $item) { |
| 30 | 30 | if (count($item['Role']) == 0) { |
| 31 | 31 | $inactive[$name] = $item; |
| 32 | - } |
|
| 33 | - else { |
|
| 32 | + } else { |
|
| 34 | 33 | $active[$name] = $item; |
| 35 | 34 | } |
| 36 | 35 | } |
@@ -12,44 +12,44 @@ |
||
| 12 | 12 | |
| 13 | 13 | class PageTeam extends InternalPageBase |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * Main function for this page, when no specific actions are called. |
|
| 17 | - * @return void |
|
| 18 | - */ |
|
| 19 | - protected function main() |
|
| 20 | - { |
|
| 21 | - $path = $this->getSiteConfiguration()->getFilePath() . '/team.json'; |
|
| 22 | - $json = file_get_contents($path); |
|
| 23 | - |
|
| 24 | - $teamData = json_decode($json, true); |
|
| 25 | - |
|
| 26 | - $active = array(); |
|
| 27 | - $inactive = array(); |
|
| 28 | - |
|
| 29 | - foreach ($teamData as $name => $item) { |
|
| 30 | - if (count($item['Role']) == 0) { |
|
| 31 | - $inactive[$name] = $item; |
|
| 32 | - } |
|
| 33 | - else { |
|
| 34 | - $active[$name] = $item; |
|
| 35 | - } |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - $this->assign('developer', $this->assocArrayShuffle($active)); |
|
| 39 | - $this->assign('inactiveDeveloper', $this->assocArrayShuffle($inactive)); |
|
| 40 | - $this->setTemplate('team/team.tpl'); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - private function assocArrayShuffle($array) |
|
| 44 | - { |
|
| 45 | - $arrayKeys = array_keys($array); |
|
| 46 | - shuffle($arrayKeys); |
|
| 47 | - |
|
| 48 | - $sorted = []; |
|
| 49 | - foreach ($arrayKeys as $k) { |
|
| 50 | - $sorted[$k] = $array[$k]; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - return $sorted; |
|
| 54 | - } |
|
| 15 | + /** |
|
| 16 | + * Main function for this page, when no specific actions are called. |
|
| 17 | + * @return void |
|
| 18 | + */ |
|
| 19 | + protected function main() |
|
| 20 | + { |
|
| 21 | + $path = $this->getSiteConfiguration()->getFilePath() . '/team.json'; |
|
| 22 | + $json = file_get_contents($path); |
|
| 23 | + |
|
| 24 | + $teamData = json_decode($json, true); |
|
| 25 | + |
|
| 26 | + $active = array(); |
|
| 27 | + $inactive = array(); |
|
| 28 | + |
|
| 29 | + foreach ($teamData as $name => $item) { |
|
| 30 | + if (count($item['Role']) == 0) { |
|
| 31 | + $inactive[$name] = $item; |
|
| 32 | + } |
|
| 33 | + else { |
|
| 34 | + $active[$name] = $item; |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + $this->assign('developer', $this->assocArrayShuffle($active)); |
|
| 39 | + $this->assign('inactiveDeveloper', $this->assocArrayShuffle($inactive)); |
|
| 40 | + $this->setTemplate('team/team.tpl'); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + private function assocArrayShuffle($array) |
|
| 44 | + { |
|
| 45 | + $arrayKeys = array_keys($array); |
|
| 46 | + shuffle($arrayKeys); |
|
| 47 | + |
|
| 48 | + $sorted = []; |
|
| 49 | + foreach ($arrayKeys as $k) { |
|
| 50 | + $sorted[$k] = $array[$k]; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + return $sorted; |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -17,43 +17,43 @@ |
||
| 17 | 17 | |
| 18 | 18 | class PageSendToUser extends RequestActionBase |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * Main function for this page, when no specific actions are called. |
|
| 22 | - * @throws ApplicationLogicException |
|
| 23 | - * @throws Exception |
|
| 24 | - */ |
|
| 25 | - protected function main() |
|
| 26 | - { |
|
| 27 | - $this->checkPosted(); |
|
| 28 | - $database = $this->getDatabase(); |
|
| 29 | - $request = $this->getRequest($database); |
|
| 30 | - |
|
| 31 | - if ($request->getReserved() !== User::getCurrent($database)->getId()) { |
|
| 32 | - throw new ApplicationLogicException('You don\'t have this request reserved!'); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - $username = WebRequest::postString('user'); |
|
| 36 | - if ($username === null) { |
|
| 37 | - throw new ApplicationLogicException('User must be specified'); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - $user = User::getByUsername($username, $database); |
|
| 41 | - if ($user === false) { |
|
| 42 | - throw new ApplicationLogicException('User not found'); |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - if (!$user->isActive()) { |
|
| 46 | - throw new ApplicationLogicException('User is currently not active on the tool'); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - $request->setReserved($user->getId()); |
|
| 50 | - $request->setUpdateVersion(WebRequest::postInt('updateversion')); |
|
| 51 | - $request->save(); |
|
| 52 | - |
|
| 53 | - Logger::sendReservation($database, $request, $user); |
|
| 54 | - $this->getNotificationHelper()->requestReservationSent($request, $user); |
|
| 55 | - SessionAlert::success("Reservation sent successfully"); |
|
| 56 | - |
|
| 57 | - $this->redirect('viewRequest', null, array('id' => $request->getId())); |
|
| 58 | - } |
|
| 20 | + /** |
|
| 21 | + * Main function for this page, when no specific actions are called. |
|
| 22 | + * @throws ApplicationLogicException |
|
| 23 | + * @throws Exception |
|
| 24 | + */ |
|
| 25 | + protected function main() |
|
| 26 | + { |
|
| 27 | + $this->checkPosted(); |
|
| 28 | + $database = $this->getDatabase(); |
|
| 29 | + $request = $this->getRequest($database); |
|
| 30 | + |
|
| 31 | + if ($request->getReserved() !== User::getCurrent($database)->getId()) { |
|
| 32 | + throw new ApplicationLogicException('You don\'t have this request reserved!'); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + $username = WebRequest::postString('user'); |
|
| 36 | + if ($username === null) { |
|
| 37 | + throw new ApplicationLogicException('User must be specified'); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + $user = User::getByUsername($username, $database); |
|
| 41 | + if ($user === false) { |
|
| 42 | + throw new ApplicationLogicException('User not found'); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + if (!$user->isActive()) { |
|
| 46 | + throw new ApplicationLogicException('User is currently not active on the tool'); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + $request->setReserved($user->getId()); |
|
| 50 | + $request->setUpdateVersion(WebRequest::postInt('updateversion')); |
|
| 51 | + $request->save(); |
|
| 52 | + |
|
| 53 | + Logger::sendReservation($database, $request, $user); |
|
| 54 | + $this->getNotificationHelper()->requestReservationSent($request, $user); |
|
| 55 | + SessionAlert::success("Reservation sent successfully"); |
|
| 56 | + |
|
| 57 | + $this->redirect('viewRequest', null, array('id' => $request->getId())); |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -48,8 +48,7 @@ |
||
| 48 | 48 | |
| 49 | 49 | if ($external) { |
| 50 | 50 | return $smarty->fetch("offline/external.tpl"); |
| 51 | - } |
|
| 52 | - else { |
|
| 51 | + } else { |
|
| 53 | 52 | $hideCulprit = true; |
| 54 | 53 | |
| 55 | 54 | // Use the provided message if possible |
@@ -17,57 +17,57 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class Offline |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * Determines if the tool is offline |
|
| 22 | - * @return bool |
|
| 23 | - */ |
|
| 24 | - public static function isOffline(SiteConfiguration $configuration): bool |
|
| 25 | - { |
|
| 26 | - return (bool)$configuration->getOffline()['offline']; |
|
| 27 | - } |
|
| 20 | + /** |
|
| 21 | + * Determines if the tool is offline |
|
| 22 | + * @return bool |
|
| 23 | + */ |
|
| 24 | + public static function isOffline(SiteConfiguration $configuration): bool |
|
| 25 | + { |
|
| 26 | + return (bool)$configuration->getOffline()['offline']; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Gets the offline message |
|
| 31 | - * |
|
| 32 | - * @throws Smarty\Exception |
|
| 33 | - */ |
|
| 34 | - public static function getOfflineMessage(bool $external, SiteConfiguration $configuration, ?string $message = null): string |
|
| 35 | - { |
|
| 36 | - $baseurl = $configuration->getBaseUrl(); |
|
| 37 | - $culprit = $configuration->getOffline()['culprit']; |
|
| 38 | - $reason = $configuration->getOffline()['reason']; |
|
| 29 | + /** |
|
| 30 | + * Gets the offline message |
|
| 31 | + * |
|
| 32 | + * @throws Smarty\Exception |
|
| 33 | + */ |
|
| 34 | + public static function getOfflineMessage(bool $external, SiteConfiguration $configuration, ?string $message = null): string |
|
| 35 | + { |
|
| 36 | + $baseurl = $configuration->getBaseUrl(); |
|
| 37 | + $culprit = $configuration->getOffline()['culprit']; |
|
| 38 | + $reason = $configuration->getOffline()['reason']; |
|
| 39 | 39 | |
| 40 | - $smarty = new Smarty(); |
|
| 41 | - $smarty->assign("baseurl", $baseurl); |
|
| 42 | - $smarty->assign("resourceCacheEpoch", 0); |
|
| 43 | - $smarty->assign("alerts", []); |
|
| 44 | - $smarty->assign("toolversion", Environment::getToolVersion()); |
|
| 40 | + $smarty = new Smarty(); |
|
| 41 | + $smarty->assign("baseurl", $baseurl); |
|
| 42 | + $smarty->assign("resourceCacheEpoch", 0); |
|
| 43 | + $smarty->assign("alerts", []); |
|
| 44 | + $smarty->assign("toolversion", Environment::getToolVersion()); |
|
| 45 | 45 | |
| 46 | - if (!headers_sent()) { |
|
| 47 | - header("HTTP/1.1 503 Service Unavailable"); |
|
| 48 | - } |
|
| 46 | + if (!headers_sent()) { |
|
| 47 | + header("HTTP/1.1 503 Service Unavailable"); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - if ($external) { |
|
| 51 | - return $smarty->fetch("offline/external.tpl"); |
|
| 52 | - } |
|
| 53 | - else { |
|
| 54 | - $hideCulprit = true; |
|
| 50 | + if ($external) { |
|
| 51 | + return $smarty->fetch("offline/external.tpl"); |
|
| 52 | + } |
|
| 53 | + else { |
|
| 54 | + $hideCulprit = true; |
|
| 55 | 55 | |
| 56 | - // Use the provided message if possible |
|
| 57 | - if ($message === null) { |
|
| 58 | - $hideCulprit = false; |
|
| 59 | - $message = $reason; |
|
| 60 | - } |
|
| 56 | + // Use the provided message if possible |
|
| 57 | + if ($message === null) { |
|
| 58 | + $hideCulprit = false; |
|
| 59 | + $message = $reason; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - $smarty->assign("hideCulprit", $hideCulprit); |
|
| 63 | - $smarty->assign("dontUseDbCulprit", $culprit); |
|
| 64 | - $smarty->assign("dontUseDbReason", $message); |
|
| 65 | - $smarty->assign("alerts", []); |
|
| 66 | - $smarty->assign('currentUser', User::getCommunity()); |
|
| 67 | - $smarty->assign('skin', 'main'); |
|
| 68 | - $smarty->assign('currentDomain', null); |
|
| 62 | + $smarty->assign("hideCulprit", $hideCulprit); |
|
| 63 | + $smarty->assign("dontUseDbCulprit", $culprit); |
|
| 64 | + $smarty->assign("dontUseDbReason", $message); |
|
| 65 | + $smarty->assign("alerts", []); |
|
| 66 | + $smarty->assign('currentUser', User::getCommunity()); |
|
| 67 | + $smarty->assign('skin', 'main'); |
|
| 68 | + $smarty->assign('currentDomain', null); |
|
| 69 | 69 | |
| 70 | - return $smarty->fetch("offline/internal.tpl"); |
|
| 71 | - } |
|
| 72 | - } |
|
| 70 | + return $smarty->fetch("offline/internal.tpl"); |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | 73 | } |
@@ -340,8 +340,7 @@ discard block |
||
| 340 | 340 | if (count($pathInfo) === 0) { |
| 341 | 341 | // No pathInfo, so no page to load. Load the main page. |
| 342 | 342 | return $this->getDefaultRoute(); |
| 343 | - } |
|
| 344 | - elseif (count($pathInfo) === 1) { |
|
| 343 | + } elseif (count($pathInfo) === 1) { |
|
| 345 | 344 | // Exactly one path info segment, it's got to be a page. |
| 346 | 345 | $classSegment = $pathInfo[0]; |
| 347 | 346 | |
@@ -353,8 +352,7 @@ discard block |
||
| 353 | 352 | // Let's handle more than two, and collapse it down into two. |
| 354 | 353 | $requestedAction = array_pop($pathInfo); |
| 355 | 354 | $classSegment = implode('/', $pathInfo); |
| 356 | - } |
|
| 357 | - else { |
|
| 355 | + } else { |
|
| 358 | 356 | // Two path info segments. |
| 359 | 357 | $classSegment = $pathInfo[0]; |
| 360 | 358 | $requestedAction = $pathInfo[1]; |
@@ -383,8 +381,7 @@ discard block |
||
| 383 | 381 | $action = 'main'; |
| 384 | 382 | |
| 385 | 383 | return array($pageClass, $action); |
| 386 | - } |
|
| 387 | - else { |
|
| 384 | + } else { |
|
| 388 | 385 | // Doesn't exist in map. Fall back to 404 |
| 389 | 386 | $pageClass = Page404::class; |
| 390 | 387 | $action = "main"; |
@@ -413,16 +410,14 @@ discard block |
||
| 413 | 410 | $action = $requestedAction; |
| 414 | 411 | |
| 415 | 412 | return array($pageClass, $action); |
| 416 | - } |
|
| 417 | - else { |
|
| 413 | + } else { |
|
| 418 | 414 | // Valid page, invalid action. 404 our way out. |
| 419 | 415 | $pageClass = Page404::class; |
| 420 | 416 | $action = 'main'; |
| 421 | 417 | |
| 422 | 418 | return array($pageClass, $action); |
| 423 | 419 | } |
| 424 | - } |
|
| 425 | - else { |
|
| 420 | + } else { |
|
| 426 | 421 | // Class doesn't exist in map. Fall back to 404 |
| 427 | 422 | $pageClass = Page404::class; |
| 428 | 423 | $action = 'main'; |
@@ -72,483 +72,483 @@ |
||
| 72 | 72 | */ |
| 73 | 73 | class RequestRouter implements IRequestRouter |
| 74 | 74 | { |
| 75 | - /** |
|
| 76 | - * This is the core routing table for the application. The basic idea is: |
|
| 77 | - * |
|
| 78 | - * array( |
|
| 79 | - * "foo" => |
|
| 80 | - * array( |
|
| 81 | - * "class" => PageFoo::class, |
|
| 82 | - * "actions" => array("bar", "other") |
|
| 83 | - * ), |
|
| 84 | - * ); |
|
| 85 | - * |
|
| 86 | - * Things to note: |
|
| 87 | - * - If no page is requested, we go to PageMain. PageMain can't have actions defined. |
|
| 88 | - * |
|
| 89 | - * - If a page is defined and requested, but no action is requested, go to that page's main() method |
|
| 90 | - * - If a page is defined and requested, and an action is defined and requested, go to that action's method. |
|
| 91 | - * - If a page is defined and requested, and an action NOT defined and requested, go to Page404 and it's main() |
|
| 92 | - * method. |
|
| 93 | - * - If a page is NOT defined and requested, go to Page404 and it's main() method. |
|
| 94 | - * |
|
| 95 | - * - Query parameters are ignored. |
|
| 96 | - * |
|
| 97 | - * The key point here is request routing with validation that this is allowed, before we start hitting the |
|
| 98 | - * filesystem through the AutoLoader, and opening random files. Also, so that we validate the action requested |
|
| 99 | - * before we start calling random methods through the web UI. |
|
| 100 | - * |
|
| 101 | - * Examples: |
|
| 102 | - * /internal.php => returns instance of PageMain, routed to main() |
|
| 103 | - * /internal.php?query => returns instance of PageMain, routed to main() |
|
| 104 | - * /internal.php/foo => returns instance of PageFoo, routed to main() |
|
| 105 | - * /internal.php/foo?query => returns instance of PageFoo, routed to main() |
|
| 106 | - * /internal.php/foo/bar => returns instance of PageFoo, routed to bar() |
|
| 107 | - * /internal.php/foo/bar?query => returns instance of PageFoo, routed to bar() |
|
| 108 | - * /internal.php/foo/baz => returns instance of Page404, routed to main() |
|
| 109 | - * /internal.php/foo/baz?query => returns instance of Page404, routed to main() |
|
| 110 | - * /internal.php/bar => returns instance of Page404, routed to main() |
|
| 111 | - * /internal.php/bar?query => returns instance of Page404, routed to main() |
|
| 112 | - * /internal.php/bar/baz => returns instance of Page404, routed to main() |
|
| 113 | - * /internal.php/bar/baz?query => returns instance of Page404, routed to main() |
|
| 114 | - * |
|
| 115 | - * Take care when changing this - a lot of places rely on the array key for redirects and other links. If you need |
|
| 116 | - * to change the key, then you'll likely have to update a lot of files. |
|
| 117 | - * |
|
| 118 | - * @var array |
|
| 119 | - */ |
|
| 120 | - private $routeMap = array( |
|
| 121 | - |
|
| 122 | - ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 123 | - // Login and registration |
|
| 124 | - 'logout' => |
|
| 125 | - array( |
|
| 126 | - 'class' => PageLogout::class, |
|
| 127 | - 'actions' => array(), |
|
| 128 | - ), |
|
| 129 | - 'login' => |
|
| 130 | - array( |
|
| 131 | - 'class' => PagePasswordLogin::class, |
|
| 132 | - 'actions' => array(), |
|
| 133 | - ), |
|
| 134 | - 'login/otp' => |
|
| 135 | - array( |
|
| 136 | - 'class' => PageOtpLogin::class, |
|
| 137 | - 'actions' => array(), |
|
| 138 | - ), |
|
| 139 | - 'forgotPassword' => |
|
| 140 | - array( |
|
| 141 | - 'class' => PageForgotPassword::class, |
|
| 142 | - 'actions' => array('reset'), |
|
| 143 | - ), |
|
| 144 | - 'register' => |
|
| 145 | - array( |
|
| 146 | - 'class' => PageRegisterOption::class, |
|
| 147 | - 'actions' => array(), |
|
| 148 | - ), |
|
| 149 | - 'register/standard' => |
|
| 150 | - array( |
|
| 151 | - 'class' => PageRegisterStandard::class, |
|
| 152 | - 'actions' => array('done'), |
|
| 153 | - ), |
|
| 154 | - 'domainSwitch' => |
|
| 155 | - array( |
|
| 156 | - 'class' => PageDomainSwitch::class, |
|
| 157 | - 'actions' => array(), |
|
| 158 | - ), |
|
| 159 | - |
|
| 160 | - ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 161 | - // Discovery |
|
| 162 | - 'search' => |
|
| 163 | - array( |
|
| 164 | - 'class' => PageSearch::class, |
|
| 165 | - 'actions' => array(), |
|
| 166 | - ), |
|
| 167 | - 'logs' => |
|
| 168 | - array( |
|
| 169 | - 'class' => PageLog::class, |
|
| 170 | - 'actions' => array(), |
|
| 171 | - ), |
|
| 172 | - |
|
| 173 | - ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 174 | - // Administration |
|
| 175 | - 'bans' => |
|
| 176 | - array( |
|
| 177 | - 'class' => PageBan::class, |
|
| 178 | - 'actions' => array('set', 'remove', 'show', 'replace'), |
|
| 179 | - ), |
|
| 180 | - 'userManagement' => |
|
| 181 | - array( |
|
| 182 | - 'class' => PageUserManagement::class, |
|
| 183 | - 'actions' => array( |
|
| 184 | - 'approve', |
|
| 185 | - 'decline', |
|
| 186 | - 'rename', |
|
| 187 | - 'editUser', |
|
| 188 | - 'suspend', |
|
| 189 | - 'editRoles', |
|
| 190 | - ), |
|
| 191 | - ), |
|
| 192 | - 'siteNotice' => |
|
| 193 | - array( |
|
| 194 | - 'class' => PageSiteNotice::class, |
|
| 195 | - 'actions' => array(), |
|
| 196 | - ), |
|
| 197 | - 'emailManagement' => |
|
| 198 | - array( |
|
| 199 | - 'class' => PageEmailManagement::class, |
|
| 200 | - 'actions' => array('create', 'edit', 'view'), |
|
| 201 | - ), |
|
| 202 | - 'queueManagement' => |
|
| 203 | - array( |
|
| 204 | - 'class' => PageQueueManagement::class, |
|
| 205 | - 'actions' => array('create', 'edit'), |
|
| 206 | - ), |
|
| 207 | - 'requestFormManagement' => |
|
| 208 | - array( |
|
| 209 | - 'class' => PageRequestFormManagement::class, |
|
| 210 | - 'actions' => array('create', 'edit', 'view', 'preview'), |
|
| 211 | - ), |
|
| 212 | - 'jobQueue' => |
|
| 213 | - array( |
|
| 214 | - 'class' => PageJobQueue::class, |
|
| 215 | - 'actions' => array('acknowledge', 'requeue', 'view', 'all', 'cancel'), |
|
| 216 | - ), |
|
| 217 | - 'domainManagement' => |
|
| 218 | - array( |
|
| 219 | - 'class' => PageDomainManagement::class, |
|
| 220 | - 'actions' => array('create', 'edit'), |
|
| 221 | - ), |
|
| 222 | - 'flaggedComments' => |
|
| 223 | - array( |
|
| 224 | - 'class' => PageListFlaggedComments::class, |
|
| 225 | - 'actions' => array(), |
|
| 226 | - ), |
|
| 227 | - |
|
| 228 | - ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 229 | - // Personal preferences |
|
| 230 | - 'preferences' => |
|
| 231 | - array( |
|
| 232 | - 'class' => PagePreferences::class, |
|
| 233 | - 'actions' => array( |
|
| 234 | - 'refreshOAuth' |
|
| 235 | - ), |
|
| 236 | - ), |
|
| 237 | - 'changePassword' => |
|
| 238 | - array( |
|
| 239 | - 'class' => PageChangePassword::class, |
|
| 240 | - 'actions' => array(), |
|
| 241 | - ), |
|
| 242 | - 'multiFactor' => |
|
| 243 | - array( |
|
| 244 | - 'class' => PageMultiFactor::class, |
|
| 245 | - 'actions' => array( |
|
| 246 | - 'scratch', |
|
| 247 | - 'enableYubikeyOtp', |
|
| 248 | - 'disableYubikeyOtp', |
|
| 249 | - 'enableTotp', |
|
| 250 | - 'disableTotp', |
|
| 251 | - ), |
|
| 252 | - ), |
|
| 253 | - 'oauth' => |
|
| 254 | - array( |
|
| 255 | - 'class' => PageOAuth::class, |
|
| 256 | - 'actions' => array('detach', 'attach'), |
|
| 257 | - ), |
|
| 258 | - 'oauth/callback' => |
|
| 259 | - array( |
|
| 260 | - 'class' => PageOAuthCallback::class, |
|
| 261 | - 'actions' => array('authorise', 'create'), |
|
| 262 | - ), |
|
| 263 | - |
|
| 264 | - ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 265 | - // Welcomer configuration |
|
| 266 | - 'welcomeTemplates' => |
|
| 267 | - array( |
|
| 268 | - 'class' => PageWelcomeTemplateManagement::class, |
|
| 269 | - 'actions' => array('select', 'edit', 'delete', 'add', 'view'), |
|
| 270 | - ), |
|
| 271 | - |
|
| 272 | - ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 273 | - // Statistics |
|
| 274 | - 'statistics' => |
|
| 275 | - array( |
|
| 276 | - 'class' => StatsMain::class, |
|
| 277 | - 'actions' => array(), |
|
| 278 | - ), |
|
| 279 | - 'statistics/fastCloses' => |
|
| 280 | - array( |
|
| 281 | - 'class' => StatsFastCloses::class, |
|
| 282 | - 'actions' => array(), |
|
| 283 | - ), |
|
| 284 | - 'statistics/inactiveUsers' => |
|
| 285 | - array( |
|
| 286 | - 'class' => StatsInactiveUsers::class, |
|
| 287 | - 'actions' => array(), |
|
| 288 | - ), |
|
| 289 | - 'statistics/monthlyStats' => |
|
| 290 | - array( |
|
| 291 | - 'class' => StatsMonthlyStats::class, |
|
| 292 | - 'actions' => array(), |
|
| 293 | - ), |
|
| 294 | - 'statistics/reservedRequests' => |
|
| 295 | - array( |
|
| 296 | - 'class' => StatsReservedRequests::class, |
|
| 297 | - 'actions' => array(), |
|
| 298 | - ), |
|
| 299 | - 'statistics/templateStats' => |
|
| 300 | - array( |
|
| 301 | - 'class' => StatsTemplateStats::class, |
|
| 302 | - 'actions' => array(), |
|
| 303 | - ), |
|
| 304 | - 'statistics/topCreators' => |
|
| 305 | - array( |
|
| 306 | - 'class' => StatsTopCreators::class, |
|
| 307 | - 'actions' => array(), |
|
| 308 | - ), |
|
| 309 | - 'statistics/users' => |
|
| 310 | - array( |
|
| 311 | - 'class' => StatsUsers::class, |
|
| 312 | - 'actions' => array('detail'), |
|
| 313 | - ), |
|
| 314 | - |
|
| 315 | - ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 316 | - // Zoom page |
|
| 317 | - 'viewRequest' => |
|
| 318 | - array( |
|
| 319 | - 'class' => PageViewRequest::class, |
|
| 320 | - 'actions' => array(), |
|
| 321 | - ), |
|
| 322 | - 'viewRequest/confirm' => |
|
| 323 | - array( |
|
| 324 | - 'class' => PageManuallyConfirm::class, |
|
| 325 | - 'actions' => array(), |
|
| 326 | - ), |
|
| 327 | - 'viewRequest/reserve' => |
|
| 328 | - array( |
|
| 329 | - 'class' => PageReservation::class, |
|
| 330 | - 'actions' => array(), |
|
| 331 | - ), |
|
| 332 | - 'viewRequest/breakReserve' => |
|
| 333 | - array( |
|
| 334 | - 'class' => PageBreakReservation::class, |
|
| 335 | - 'actions' => array(), |
|
| 336 | - ), |
|
| 337 | - 'viewRequest/defer' => |
|
| 338 | - array( |
|
| 339 | - 'class' => PageDeferRequest::class, |
|
| 340 | - 'actions' => array(), |
|
| 341 | - ), |
|
| 342 | - 'viewRequest/comment' => |
|
| 343 | - array( |
|
| 344 | - 'class' => PageComment::class, |
|
| 345 | - 'actions' => array(), |
|
| 346 | - ), |
|
| 347 | - 'viewRequest/sendToUser' => |
|
| 348 | - array( |
|
| 349 | - 'class' => PageSendToUser::class, |
|
| 350 | - 'actions' => array(), |
|
| 351 | - ), |
|
| 352 | - 'viewRequest/close' => |
|
| 353 | - array( |
|
| 354 | - 'class' => PageCloseRequest::class, |
|
| 355 | - 'actions' => array(), |
|
| 356 | - ), |
|
| 357 | - 'viewRequest/create' => |
|
| 358 | - array( |
|
| 359 | - 'class' => PageCreateRequest::class, |
|
| 360 | - 'actions' => array(), |
|
| 361 | - ), |
|
| 362 | - 'viewRequest/drop' => |
|
| 363 | - array( |
|
| 364 | - 'class' => PageDropRequest::class, |
|
| 365 | - 'actions' => array(), |
|
| 366 | - ), |
|
| 367 | - 'viewRequest/custom' => |
|
| 368 | - array( |
|
| 369 | - 'class' => PageCustomClose::class, |
|
| 370 | - 'actions' => array(), |
|
| 371 | - ), |
|
| 372 | - 'editComment' => |
|
| 373 | - array( |
|
| 374 | - 'class' => PageEditComment::class, |
|
| 375 | - 'actions' => array(), |
|
| 376 | - ), |
|
| 377 | - 'flagComment' => |
|
| 378 | - array( |
|
| 379 | - 'class' => PageFlagComment::class, |
|
| 380 | - 'actions' => array(), |
|
| 381 | - ), |
|
| 382 | - |
|
| 383 | - ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 384 | - // Misc stuff |
|
| 385 | - 'team' => |
|
| 386 | - array( |
|
| 387 | - 'class' => PageTeam::class, |
|
| 388 | - 'actions' => array(), |
|
| 389 | - ), |
|
| 390 | - 'requestList' => |
|
| 391 | - array( |
|
| 392 | - 'class' => PageExpandedRequestList::class, |
|
| 393 | - 'actions' => array(), |
|
| 394 | - ), |
|
| 395 | - 'xffdemo' => |
|
| 396 | - array( |
|
| 397 | - 'class' => PageXffDemo::class, |
|
| 398 | - 'actions' => array(), |
|
| 399 | - ), |
|
| 400 | - 'errorLog' => |
|
| 401 | - array( |
|
| 402 | - 'class' => PageErrorLogViewer::class, |
|
| 403 | - 'actions' => array('remove', 'view'), |
|
| 404 | - ), |
|
| 405 | - 'privacy' => |
|
| 406 | - array( |
|
| 407 | - 'class' => PagePrivacy::class, |
|
| 408 | - 'actions' => array(), |
|
| 409 | - ), |
|
| 410 | - ); |
|
| 411 | - |
|
| 412 | - /** |
|
| 413 | - * @return IRoutedTask |
|
| 414 | - * @throws Exception |
|
| 415 | - */ |
|
| 416 | - final public function route() |
|
| 417 | - { |
|
| 418 | - $pathInfo = WebRequest::pathInfo(); |
|
| 419 | - |
|
| 420 | - list($pageClass, $action) = $this->getRouteFromPath($pathInfo); |
|
| 421 | - |
|
| 422 | - /** @var IRoutedTask $page */ |
|
| 423 | - $page = new $pageClass(); |
|
| 424 | - |
|
| 425 | - // Dynamic creation, so we've got to be careful here. We can't use built-in language type protection, so |
|
| 426 | - // let's use our own. |
|
| 427 | - if (!($page instanceof IRoutedTask)) { |
|
| 428 | - throw new Exception('Expected a page, but this is not a page.'); |
|
| 429 | - } |
|
| 430 | - |
|
| 431 | - // OK, I'm happy at this point that we know we're running a page, and we know it's probably what we want if it |
|
| 432 | - // inherits PageBase and has been created from the routing map. |
|
| 433 | - $page->setRoute($action); |
|
| 434 | - |
|
| 435 | - return $page; |
|
| 436 | - } |
|
| 437 | - |
|
| 438 | - /** |
|
| 439 | - * @param $pathInfo |
|
| 440 | - * |
|
| 441 | - * @return array |
|
| 442 | - */ |
|
| 443 | - public function getRouteFromPath($pathInfo) |
|
| 444 | - { |
|
| 445 | - if (count($pathInfo) === 0) { |
|
| 446 | - // No pathInfo, so no page to load. Load the main page. |
|
| 447 | - return $this->getDefaultRoute(); |
|
| 448 | - } |
|
| 449 | - elseif (count($pathInfo) === 1) { |
|
| 450 | - // Exactly one path info segment, it's got to be a page. |
|
| 451 | - $classSegment = $pathInfo[0]; |
|
| 452 | - |
|
| 453 | - return $this->routeSinglePathSegment($classSegment); |
|
| 454 | - } |
|
| 455 | - |
|
| 456 | - // OK, we have two or more segments now. |
|
| 457 | - if (count($pathInfo) > 2) { |
|
| 458 | - // Let's handle more than two, and collapse it down into two. |
|
| 459 | - $requestedAction = array_pop($pathInfo); |
|
| 460 | - $classSegment = implode('/', $pathInfo); |
|
| 461 | - } |
|
| 462 | - else { |
|
| 463 | - // Two path info segments. |
|
| 464 | - $classSegment = $pathInfo[0]; |
|
| 465 | - $requestedAction = $pathInfo[1]; |
|
| 466 | - } |
|
| 467 | - |
|
| 468 | - $routeMap = $this->routePathSegments($classSegment, $requestedAction); |
|
| 469 | - |
|
| 470 | - if ($routeMap[0] === Page404::class) { |
|
| 471 | - $routeMap = $this->routeSinglePathSegment($classSegment . '/' . $requestedAction); |
|
| 472 | - } |
|
| 473 | - |
|
| 474 | - return $routeMap; |
|
| 475 | - } |
|
| 476 | - |
|
| 477 | - /** |
|
| 478 | - * @param $classSegment |
|
| 479 | - * |
|
| 480 | - * @return array |
|
| 481 | - */ |
|
| 482 | - final protected function routeSinglePathSegment($classSegment) |
|
| 483 | - { |
|
| 484 | - $routeMap = $this->getRouteMap(); |
|
| 485 | - if (array_key_exists($classSegment, $routeMap)) { |
|
| 486 | - // Route exists, but we don't have an action in path info, so default to main. |
|
| 487 | - $pageClass = $routeMap[$classSegment]['class']; |
|
| 488 | - $action = 'main'; |
|
| 489 | - |
|
| 490 | - return array($pageClass, $action); |
|
| 491 | - } |
|
| 492 | - else { |
|
| 493 | - // Doesn't exist in map. Fall back to 404 |
|
| 494 | - $pageClass = Page404::class; |
|
| 495 | - $action = "main"; |
|
| 496 | - |
|
| 497 | - return array($pageClass, $action); |
|
| 498 | - } |
|
| 499 | - } |
|
| 500 | - |
|
| 501 | - /** |
|
| 502 | - * @param $classSegment |
|
| 503 | - * @param $requestedAction |
|
| 504 | - * |
|
| 505 | - * @return array |
|
| 506 | - */ |
|
| 507 | - final protected function routePathSegments($classSegment, $requestedAction) |
|
| 508 | - { |
|
| 509 | - $routeMap = $this->getRouteMap(); |
|
| 510 | - if (array_key_exists($classSegment, $routeMap)) { |
|
| 511 | - // Route exists, but we don't have an action in path info, so default to main. |
|
| 512 | - |
|
| 513 | - if (isset($routeMap[$classSegment]['actions']) |
|
| 514 | - && array_search($requestedAction, $routeMap[$classSegment]['actions']) !== false |
|
| 515 | - ) { |
|
| 516 | - // Action exists in allowed action list. Allow both the page and the action |
|
| 517 | - $pageClass = $routeMap[$classSegment]['class']; |
|
| 518 | - $action = $requestedAction; |
|
| 519 | - |
|
| 520 | - return array($pageClass, $action); |
|
| 521 | - } |
|
| 522 | - else { |
|
| 523 | - // Valid page, invalid action. 404 our way out. |
|
| 524 | - $pageClass = Page404::class; |
|
| 525 | - $action = 'main'; |
|
| 526 | - |
|
| 527 | - return array($pageClass, $action); |
|
| 528 | - } |
|
| 529 | - } |
|
| 530 | - else { |
|
| 531 | - // Class doesn't exist in map. Fall back to 404 |
|
| 532 | - $pageClass = Page404::class; |
|
| 533 | - $action = 'main'; |
|
| 534 | - |
|
| 535 | - return array($pageClass, $action); |
|
| 536 | - } |
|
| 537 | - } |
|
| 538 | - |
|
| 539 | - /** |
|
| 540 | - * @return array |
|
| 541 | - */ |
|
| 542 | - protected function getRouteMap() |
|
| 543 | - { |
|
| 544 | - return $this->routeMap; |
|
| 545 | - } |
|
| 546 | - |
|
| 547 | - /** |
|
| 548 | - * @return array |
|
| 549 | - */ |
|
| 550 | - protected function getDefaultRoute() |
|
| 551 | - { |
|
| 552 | - return array(PageMain::class, "main"); |
|
| 553 | - } |
|
| 75 | + /** |
|
| 76 | + * This is the core routing table for the application. The basic idea is: |
|
| 77 | + * |
|
| 78 | + * array( |
|
| 79 | + * "foo" => |
|
| 80 | + * array( |
|
| 81 | + * "class" => PageFoo::class, |
|
| 82 | + * "actions" => array("bar", "other") |
|
| 83 | + * ), |
|
| 84 | + * ); |
|
| 85 | + * |
|
| 86 | + * Things to note: |
|
| 87 | + * - If no page is requested, we go to PageMain. PageMain can't have actions defined. |
|
| 88 | + * |
|
| 89 | + * - If a page is defined and requested, but no action is requested, go to that page's main() method |
|
| 90 | + * - If a page is defined and requested, and an action is defined and requested, go to that action's method. |
|
| 91 | + * - If a page is defined and requested, and an action NOT defined and requested, go to Page404 and it's main() |
|
| 92 | + * method. |
|
| 93 | + * - If a page is NOT defined and requested, go to Page404 and it's main() method. |
|
| 94 | + * |
|
| 95 | + * - Query parameters are ignored. |
|
| 96 | + * |
|
| 97 | + * The key point here is request routing with validation that this is allowed, before we start hitting the |
|
| 98 | + * filesystem through the AutoLoader, and opening random files. Also, so that we validate the action requested |
|
| 99 | + * before we start calling random methods through the web UI. |
|
| 100 | + * |
|
| 101 | + * Examples: |
|
| 102 | + * /internal.php => returns instance of PageMain, routed to main() |
|
| 103 | + * /internal.php?query => returns instance of PageMain, routed to main() |
|
| 104 | + * /internal.php/foo => returns instance of PageFoo, routed to main() |
|
| 105 | + * /internal.php/foo?query => returns instance of PageFoo, routed to main() |
|
| 106 | + * /internal.php/foo/bar => returns instance of PageFoo, routed to bar() |
|
| 107 | + * /internal.php/foo/bar?query => returns instance of PageFoo, routed to bar() |
|
| 108 | + * /internal.php/foo/baz => returns instance of Page404, routed to main() |
|
| 109 | + * /internal.php/foo/baz?query => returns instance of Page404, routed to main() |
|
| 110 | + * /internal.php/bar => returns instance of Page404, routed to main() |
|
| 111 | + * /internal.php/bar?query => returns instance of Page404, routed to main() |
|
| 112 | + * /internal.php/bar/baz => returns instance of Page404, routed to main() |
|
| 113 | + * /internal.php/bar/baz?query => returns instance of Page404, routed to main() |
|
| 114 | + * |
|
| 115 | + * Take care when changing this - a lot of places rely on the array key for redirects and other links. If you need |
|
| 116 | + * to change the key, then you'll likely have to update a lot of files. |
|
| 117 | + * |
|
| 118 | + * @var array |
|
| 119 | + */ |
|
| 120 | + private $routeMap = array( |
|
| 121 | + |
|
| 122 | + ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 123 | + // Login and registration |
|
| 124 | + 'logout' => |
|
| 125 | + array( |
|
| 126 | + 'class' => PageLogout::class, |
|
| 127 | + 'actions' => array(), |
|
| 128 | + ), |
|
| 129 | + 'login' => |
|
| 130 | + array( |
|
| 131 | + 'class' => PagePasswordLogin::class, |
|
| 132 | + 'actions' => array(), |
|
| 133 | + ), |
|
| 134 | + 'login/otp' => |
|
| 135 | + array( |
|
| 136 | + 'class' => PageOtpLogin::class, |
|
| 137 | + 'actions' => array(), |
|
| 138 | + ), |
|
| 139 | + 'forgotPassword' => |
|
| 140 | + array( |
|
| 141 | + 'class' => PageForgotPassword::class, |
|
| 142 | + 'actions' => array('reset'), |
|
| 143 | + ), |
|
| 144 | + 'register' => |
|
| 145 | + array( |
|
| 146 | + 'class' => PageRegisterOption::class, |
|
| 147 | + 'actions' => array(), |
|
| 148 | + ), |
|
| 149 | + 'register/standard' => |
|
| 150 | + array( |
|
| 151 | + 'class' => PageRegisterStandard::class, |
|
| 152 | + 'actions' => array('done'), |
|
| 153 | + ), |
|
| 154 | + 'domainSwitch' => |
|
| 155 | + array( |
|
| 156 | + 'class' => PageDomainSwitch::class, |
|
| 157 | + 'actions' => array(), |
|
| 158 | + ), |
|
| 159 | + |
|
| 160 | + ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 161 | + // Discovery |
|
| 162 | + 'search' => |
|
| 163 | + array( |
|
| 164 | + 'class' => PageSearch::class, |
|
| 165 | + 'actions' => array(), |
|
| 166 | + ), |
|
| 167 | + 'logs' => |
|
| 168 | + array( |
|
| 169 | + 'class' => PageLog::class, |
|
| 170 | + 'actions' => array(), |
|
| 171 | + ), |
|
| 172 | + |
|
| 173 | + ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 174 | + // Administration |
|
| 175 | + 'bans' => |
|
| 176 | + array( |
|
| 177 | + 'class' => PageBan::class, |
|
| 178 | + 'actions' => array('set', 'remove', 'show', 'replace'), |
|
| 179 | + ), |
|
| 180 | + 'userManagement' => |
|
| 181 | + array( |
|
| 182 | + 'class' => PageUserManagement::class, |
|
| 183 | + 'actions' => array( |
|
| 184 | + 'approve', |
|
| 185 | + 'decline', |
|
| 186 | + 'rename', |
|
| 187 | + 'editUser', |
|
| 188 | + 'suspend', |
|
| 189 | + 'editRoles', |
|
| 190 | + ), |
|
| 191 | + ), |
|
| 192 | + 'siteNotice' => |
|
| 193 | + array( |
|
| 194 | + 'class' => PageSiteNotice::class, |
|
| 195 | + 'actions' => array(), |
|
| 196 | + ), |
|
| 197 | + 'emailManagement' => |
|
| 198 | + array( |
|
| 199 | + 'class' => PageEmailManagement::class, |
|
| 200 | + 'actions' => array('create', 'edit', 'view'), |
|
| 201 | + ), |
|
| 202 | + 'queueManagement' => |
|
| 203 | + array( |
|
| 204 | + 'class' => PageQueueManagement::class, |
|
| 205 | + 'actions' => array('create', 'edit'), |
|
| 206 | + ), |
|
| 207 | + 'requestFormManagement' => |
|
| 208 | + array( |
|
| 209 | + 'class' => PageRequestFormManagement::class, |
|
| 210 | + 'actions' => array('create', 'edit', 'view', 'preview'), |
|
| 211 | + ), |
|
| 212 | + 'jobQueue' => |
|
| 213 | + array( |
|
| 214 | + 'class' => PageJobQueue::class, |
|
| 215 | + 'actions' => array('acknowledge', 'requeue', 'view', 'all', 'cancel'), |
|
| 216 | + ), |
|
| 217 | + 'domainManagement' => |
|
| 218 | + array( |
|
| 219 | + 'class' => PageDomainManagement::class, |
|
| 220 | + 'actions' => array('create', 'edit'), |
|
| 221 | + ), |
|
| 222 | + 'flaggedComments' => |
|
| 223 | + array( |
|
| 224 | + 'class' => PageListFlaggedComments::class, |
|
| 225 | + 'actions' => array(), |
|
| 226 | + ), |
|
| 227 | + |
|
| 228 | + ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 229 | + // Personal preferences |
|
| 230 | + 'preferences' => |
|
| 231 | + array( |
|
| 232 | + 'class' => PagePreferences::class, |
|
| 233 | + 'actions' => array( |
|
| 234 | + 'refreshOAuth' |
|
| 235 | + ), |
|
| 236 | + ), |
|
| 237 | + 'changePassword' => |
|
| 238 | + array( |
|
| 239 | + 'class' => PageChangePassword::class, |
|
| 240 | + 'actions' => array(), |
|
| 241 | + ), |
|
| 242 | + 'multiFactor' => |
|
| 243 | + array( |
|
| 244 | + 'class' => PageMultiFactor::class, |
|
| 245 | + 'actions' => array( |
|
| 246 | + 'scratch', |
|
| 247 | + 'enableYubikeyOtp', |
|
| 248 | + 'disableYubikeyOtp', |
|
| 249 | + 'enableTotp', |
|
| 250 | + 'disableTotp', |
|
| 251 | + ), |
|
| 252 | + ), |
|
| 253 | + 'oauth' => |
|
| 254 | + array( |
|
| 255 | + 'class' => PageOAuth::class, |
|
| 256 | + 'actions' => array('detach', 'attach'), |
|
| 257 | + ), |
|
| 258 | + 'oauth/callback' => |
|
| 259 | + array( |
|
| 260 | + 'class' => PageOAuthCallback::class, |
|
| 261 | + 'actions' => array('authorise', 'create'), |
|
| 262 | + ), |
|
| 263 | + |
|
| 264 | + ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 265 | + // Welcomer configuration |
|
| 266 | + 'welcomeTemplates' => |
|
| 267 | + array( |
|
| 268 | + 'class' => PageWelcomeTemplateManagement::class, |
|
| 269 | + 'actions' => array('select', 'edit', 'delete', 'add', 'view'), |
|
| 270 | + ), |
|
| 271 | + |
|
| 272 | + ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 273 | + // Statistics |
|
| 274 | + 'statistics' => |
|
| 275 | + array( |
|
| 276 | + 'class' => StatsMain::class, |
|
| 277 | + 'actions' => array(), |
|
| 278 | + ), |
|
| 279 | + 'statistics/fastCloses' => |
|
| 280 | + array( |
|
| 281 | + 'class' => StatsFastCloses::class, |
|
| 282 | + 'actions' => array(), |
|
| 283 | + ), |
|
| 284 | + 'statistics/inactiveUsers' => |
|
| 285 | + array( |
|
| 286 | + 'class' => StatsInactiveUsers::class, |
|
| 287 | + 'actions' => array(), |
|
| 288 | + ), |
|
| 289 | + 'statistics/monthlyStats' => |
|
| 290 | + array( |
|
| 291 | + 'class' => StatsMonthlyStats::class, |
|
| 292 | + 'actions' => array(), |
|
| 293 | + ), |
|
| 294 | + 'statistics/reservedRequests' => |
|
| 295 | + array( |
|
| 296 | + 'class' => StatsReservedRequests::class, |
|
| 297 | + 'actions' => array(), |
|
| 298 | + ), |
|
| 299 | + 'statistics/templateStats' => |
|
| 300 | + array( |
|
| 301 | + 'class' => StatsTemplateStats::class, |
|
| 302 | + 'actions' => array(), |
|
| 303 | + ), |
|
| 304 | + 'statistics/topCreators' => |
|
| 305 | + array( |
|
| 306 | + 'class' => StatsTopCreators::class, |
|
| 307 | + 'actions' => array(), |
|
| 308 | + ), |
|
| 309 | + 'statistics/users' => |
|
| 310 | + array( |
|
| 311 | + 'class' => StatsUsers::class, |
|
| 312 | + 'actions' => array('detail'), |
|
| 313 | + ), |
|
| 314 | + |
|
| 315 | + ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 316 | + // Zoom page |
|
| 317 | + 'viewRequest' => |
|
| 318 | + array( |
|
| 319 | + 'class' => PageViewRequest::class, |
|
| 320 | + 'actions' => array(), |
|
| 321 | + ), |
|
| 322 | + 'viewRequest/confirm' => |
|
| 323 | + array( |
|
| 324 | + 'class' => PageManuallyConfirm::class, |
|
| 325 | + 'actions' => array(), |
|
| 326 | + ), |
|
| 327 | + 'viewRequest/reserve' => |
|
| 328 | + array( |
|
| 329 | + 'class' => PageReservation::class, |
|
| 330 | + 'actions' => array(), |
|
| 331 | + ), |
|
| 332 | + 'viewRequest/breakReserve' => |
|
| 333 | + array( |
|
| 334 | + 'class' => PageBreakReservation::class, |
|
| 335 | + 'actions' => array(), |
|
| 336 | + ), |
|
| 337 | + 'viewRequest/defer' => |
|
| 338 | + array( |
|
| 339 | + 'class' => PageDeferRequest::class, |
|
| 340 | + 'actions' => array(), |
|
| 341 | + ), |
|
| 342 | + 'viewRequest/comment' => |
|
| 343 | + array( |
|
| 344 | + 'class' => PageComment::class, |
|
| 345 | + 'actions' => array(), |
|
| 346 | + ), |
|
| 347 | + 'viewRequest/sendToUser' => |
|
| 348 | + array( |
|
| 349 | + 'class' => PageSendToUser::class, |
|
| 350 | + 'actions' => array(), |
|
| 351 | + ), |
|
| 352 | + 'viewRequest/close' => |
|
| 353 | + array( |
|
| 354 | + 'class' => PageCloseRequest::class, |
|
| 355 | + 'actions' => array(), |
|
| 356 | + ), |
|
| 357 | + 'viewRequest/create' => |
|
| 358 | + array( |
|
| 359 | + 'class' => PageCreateRequest::class, |
|
| 360 | + 'actions' => array(), |
|
| 361 | + ), |
|
| 362 | + 'viewRequest/drop' => |
|
| 363 | + array( |
|
| 364 | + 'class' => PageDropRequest::class, |
|
| 365 | + 'actions' => array(), |
|
| 366 | + ), |
|
| 367 | + 'viewRequest/custom' => |
|
| 368 | + array( |
|
| 369 | + 'class' => PageCustomClose::class, |
|
| 370 | + 'actions' => array(), |
|
| 371 | + ), |
|
| 372 | + 'editComment' => |
|
| 373 | + array( |
|
| 374 | + 'class' => PageEditComment::class, |
|
| 375 | + 'actions' => array(), |
|
| 376 | + ), |
|
| 377 | + 'flagComment' => |
|
| 378 | + array( |
|
| 379 | + 'class' => PageFlagComment::class, |
|
| 380 | + 'actions' => array(), |
|
| 381 | + ), |
|
| 382 | + |
|
| 383 | + ////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 384 | + // Misc stuff |
|
| 385 | + 'team' => |
|
| 386 | + array( |
|
| 387 | + 'class' => PageTeam::class, |
|
| 388 | + 'actions' => array(), |
|
| 389 | + ), |
|
| 390 | + 'requestList' => |
|
| 391 | + array( |
|
| 392 | + 'class' => PageExpandedRequestList::class, |
|
| 393 | + 'actions' => array(), |
|
| 394 | + ), |
|
| 395 | + 'xffdemo' => |
|
| 396 | + array( |
|
| 397 | + 'class' => PageXffDemo::class, |
|
| 398 | + 'actions' => array(), |
|
| 399 | + ), |
|
| 400 | + 'errorLog' => |
|
| 401 | + array( |
|
| 402 | + 'class' => PageErrorLogViewer::class, |
|
| 403 | + 'actions' => array('remove', 'view'), |
|
| 404 | + ), |
|
| 405 | + 'privacy' => |
|
| 406 | + array( |
|
| 407 | + 'class' => PagePrivacy::class, |
|
| 408 | + 'actions' => array(), |
|
| 409 | + ), |
|
| 410 | + ); |
|
| 411 | + |
|
| 412 | + /** |
|
| 413 | + * @return IRoutedTask |
|
| 414 | + * @throws Exception |
|
| 415 | + */ |
|
| 416 | + final public function route() |
|
| 417 | + { |
|
| 418 | + $pathInfo = WebRequest::pathInfo(); |
|
| 419 | + |
|
| 420 | + list($pageClass, $action) = $this->getRouteFromPath($pathInfo); |
|
| 421 | + |
|
| 422 | + /** @var IRoutedTask $page */ |
|
| 423 | + $page = new $pageClass(); |
|
| 424 | + |
|
| 425 | + // Dynamic creation, so we've got to be careful here. We can't use built-in language type protection, so |
|
| 426 | + // let's use our own. |
|
| 427 | + if (!($page instanceof IRoutedTask)) { |
|
| 428 | + throw new Exception('Expected a page, but this is not a page.'); |
|
| 429 | + } |
|
| 430 | + |
|
| 431 | + // OK, I'm happy at this point that we know we're running a page, and we know it's probably what we want if it |
|
| 432 | + // inherits PageBase and has been created from the routing map. |
|
| 433 | + $page->setRoute($action); |
|
| 434 | + |
|
| 435 | + return $page; |
|
| 436 | + } |
|
| 437 | + |
|
| 438 | + /** |
|
| 439 | + * @param $pathInfo |
|
| 440 | + * |
|
| 441 | + * @return array |
|
| 442 | + */ |
|
| 443 | + public function getRouteFromPath($pathInfo) |
|
| 444 | + { |
|
| 445 | + if (count($pathInfo) === 0) { |
|
| 446 | + // No pathInfo, so no page to load. Load the main page. |
|
| 447 | + return $this->getDefaultRoute(); |
|
| 448 | + } |
|
| 449 | + elseif (count($pathInfo) === 1) { |
|
| 450 | + // Exactly one path info segment, it's got to be a page. |
|
| 451 | + $classSegment = $pathInfo[0]; |
|
| 452 | + |
|
| 453 | + return $this->routeSinglePathSegment($classSegment); |
|
| 454 | + } |
|
| 455 | + |
|
| 456 | + // OK, we have two or more segments now. |
|
| 457 | + if (count($pathInfo) > 2) { |
|
| 458 | + // Let's handle more than two, and collapse it down into two. |
|
| 459 | + $requestedAction = array_pop($pathInfo); |
|
| 460 | + $classSegment = implode('/', $pathInfo); |
|
| 461 | + } |
|
| 462 | + else { |
|
| 463 | + // Two path info segments. |
|
| 464 | + $classSegment = $pathInfo[0]; |
|
| 465 | + $requestedAction = $pathInfo[1]; |
|
| 466 | + } |
|
| 467 | + |
|
| 468 | + $routeMap = $this->routePathSegments($classSegment, $requestedAction); |
|
| 469 | + |
|
| 470 | + if ($routeMap[0] === Page404::class) { |
|
| 471 | + $routeMap = $this->routeSinglePathSegment($classSegment . '/' . $requestedAction); |
|
| 472 | + } |
|
| 473 | + |
|
| 474 | + return $routeMap; |
|
| 475 | + } |
|
| 476 | + |
|
| 477 | + /** |
|
| 478 | + * @param $classSegment |
|
| 479 | + * |
|
| 480 | + * @return array |
|
| 481 | + */ |
|
| 482 | + final protected function routeSinglePathSegment($classSegment) |
|
| 483 | + { |
|
| 484 | + $routeMap = $this->getRouteMap(); |
|
| 485 | + if (array_key_exists($classSegment, $routeMap)) { |
|
| 486 | + // Route exists, but we don't have an action in path info, so default to main. |
|
| 487 | + $pageClass = $routeMap[$classSegment]['class']; |
|
| 488 | + $action = 'main'; |
|
| 489 | + |
|
| 490 | + return array($pageClass, $action); |
|
| 491 | + } |
|
| 492 | + else { |
|
| 493 | + // Doesn't exist in map. Fall back to 404 |
|
| 494 | + $pageClass = Page404::class; |
|
| 495 | + $action = "main"; |
|
| 496 | + |
|
| 497 | + return array($pageClass, $action); |
|
| 498 | + } |
|
| 499 | + } |
|
| 500 | + |
|
| 501 | + /** |
|
| 502 | + * @param $classSegment |
|
| 503 | + * @param $requestedAction |
|
| 504 | + * |
|
| 505 | + * @return array |
|
| 506 | + */ |
|
| 507 | + final protected function routePathSegments($classSegment, $requestedAction) |
|
| 508 | + { |
|
| 509 | + $routeMap = $this->getRouteMap(); |
|
| 510 | + if (array_key_exists($classSegment, $routeMap)) { |
|
| 511 | + // Route exists, but we don't have an action in path info, so default to main. |
|
| 512 | + |
|
| 513 | + if (isset($routeMap[$classSegment]['actions']) |
|
| 514 | + && array_search($requestedAction, $routeMap[$classSegment]['actions']) !== false |
|
| 515 | + ) { |
|
| 516 | + // Action exists in allowed action list. Allow both the page and the action |
|
| 517 | + $pageClass = $routeMap[$classSegment]['class']; |
|
| 518 | + $action = $requestedAction; |
|
| 519 | + |
|
| 520 | + return array($pageClass, $action); |
|
| 521 | + } |
|
| 522 | + else { |
|
| 523 | + // Valid page, invalid action. 404 our way out. |
|
| 524 | + $pageClass = Page404::class; |
|
| 525 | + $action = 'main'; |
|
| 526 | + |
|
| 527 | + return array($pageClass, $action); |
|
| 528 | + } |
|
| 529 | + } |
|
| 530 | + else { |
|
| 531 | + // Class doesn't exist in map. Fall back to 404 |
|
| 532 | + $pageClass = Page404::class; |
|
| 533 | + $action = 'main'; |
|
| 534 | + |
|
| 535 | + return array($pageClass, $action); |
|
| 536 | + } |
|
| 537 | + } |
|
| 538 | + |
|
| 539 | + /** |
|
| 540 | + * @return array |
|
| 541 | + */ |
|
| 542 | + protected function getRouteMap() |
|
| 543 | + { |
|
| 544 | + return $this->routeMap; |
|
| 545 | + } |
|
| 546 | + |
|
| 547 | + /** |
|
| 548 | + * @return array |
|
| 549 | + */ |
|
| 550 | + protected function getDefaultRoute() |
|
| 551 | + { |
|
| 552 | + return array(PageMain::class, "main"); |
|
| 553 | + } |
|
| 554 | 554 | } |
@@ -18,9 +18,9 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | interface IRequestRouter |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * @return IRoutedTask |
|
| 23 | - * @throws Exception |
|
| 24 | - */ |
|
| 25 | - public function route(); |
|
| 21 | + /** |
|
| 22 | + * @return IRoutedTask |
|
| 23 | + * @throws Exception |
|
| 24 | + */ |
|
| 25 | + public function route(); |
|
| 26 | 26 | } |
| 27 | 27 | \ No newline at end of file |