| @@ 309-335 (lines=27) @@ | ||
| 306 | ); |
|
| 307 | } |
|
| 308 | ||
| 309 | public function announceAction($section) |
|
| 310 | { |
|
| 311 | //$this->assertRole(self::MANAGER_REQUIRED_ROLE); |
|
| 312 | ||
| 313 | $rootDir = realpath(__DIR__.'/../../../'); |
|
| 314 | $announceDir = $rootDir.'/docs/announcements'; |
|
| 315 | ||
| 316 | if (!preg_match('/^\w+$/', $section)) { |
|
| 317 | throw new NotFoundHttpException(); // don't give access to anything but plain names |
|
| 318 | } |
|
| 319 | ||
| 320 | $candidateFile = $announceDir.'/'.$section.'.md'; |
|
| 321 | ||
| 322 | if (!file_exists($candidateFile)) { |
|
| 323 | throw new NotFoundHttpException(); |
|
| 324 | } |
|
| 325 | ||
| 326 | $markdown = file_get_contents($candidateFile); |
|
| 327 | ||
| 328 | return $this->app['twig']->render( |
|
| 329 | 'announce.html.twig', |
|
| 330 | [ |
|
| 331 | 'announcement' => $markdown, |
|
| 332 | 'messageClass' => $section, |
|
| 333 | ] |
|
| 334 | ); |
|
| 335 | } |
|
| 336 | ||
| 337 | public function remotesRedirectAction() |
|
| 338 | { |
|
| @@ 47-72 (lines=26) @@ | ||
| 44 | return $viewParams; |
|
| 45 | } |
|
| 46 | ||
| 47 | public function announceAction($section) |
|
| 48 | { |
|
| 49 | $rootDir = realpath(__DIR__.'/../../../../'); |
|
| 50 | $announceDir = $rootDir.'/docs/announcements'; |
|
| 51 | ||
| 52 | if (!preg_match('/^\w+$/', $section)) { |
|
| 53 | throw new NotFoundHttpException(); // don't give access to anything but plain names |
|
| 54 | } |
|
| 55 | ||
| 56 | $candidateFile = $announceDir.'/'.$section.'.md'; |
|
| 57 | ||
| 58 | if (!file_exists($candidateFile)) { |
|
| 59 | throw new NotFoundHttpException(); |
|
| 60 | } |
|
| 61 | ||
| 62 | $markdown = file_get_contents($candidateFile); |
|
| 63 | ||
| 64 | return $this->render( |
|
| 65 | ':default:announce.html.twig', |
|
| 66 | [ |
|
| 67 | 'announcement' => $markdown, |
|
| 68 | 'messageClass' => $section, |
|
| 69 | 'displayOptions' => $this->getDisplayOptions(), |
|
| 70 | ] |
|
| 71 | ); |
|
| 72 | } |
|
| 73 | } |
|
| 74 | ||