@@ -42,7 +42,7 @@ abstract class Presenter extends Control implements Application\IPresenter
4242 /** @internal special parameter key */
4343 const SIGNAL_KEY = 'do ' ,
4444 ACTION_KEY = 'action ' ,
45- FLASH_KEY = ' _fid ' ,
45+ FLASH_KEY = Http \Session:: FLASH_KEY ,
4646 DEFAULT_ACTION = 'default ' ;
4747
4848 /** @var int */
@@ -237,10 +237,6 @@ public function run(Application\Request $request)
237237 }
238238 } catch (Application \AbortException $ e ) { }
239239
240- if ($ this ->hasFlashSession ()) {
241- $ this ->getFlashSession ()->setExpiration ($ this ->response instanceof Responses \RedirectResponse ? '+ 30 seconds ' : '+ 3 seconds ' );
242- }
243-
244240 // SHUTDOWN
245241 $ this ->onShutdown ($ this , $ this ->response );
246242 $ this ->shutdown ($ this ->response );
@@ -955,8 +951,8 @@ protected function createRequest($component, $destination, array $args, $mode)
955951 $ args [self ::SIGNAL_KEY ] = $ component ->getParameterId ($ signal );
956952 $ current = $ current && $ args [self ::SIGNAL_KEY ] === $ this ->getParameter (self ::SIGNAL_KEY );
957953 }
958- if (( $ mode === 'redirect ' || $ mode === 'forward ' ) && $ this -> hasFlashSession () ) {
959- $ args [self ::FLASH_KEY ] = $ this ->getParameter ( self :: FLASH_KEY );
954+ if ($ mode === 'redirect ' || $ mode === 'forward ' ) {
955+ $ args [Http \Session ::FLASH_KEY ] = $ this ->getSession ()-> getFlashId ( );
960956 }
961957
962958 $ this ->lastCreatedRequest = new Application \Request (
@@ -1107,7 +1103,7 @@ public function restoreRequest($key)
11071103 unset($ session [$ key ]);
11081104 $ request ->setFlag (Application \Request::RESTORED , TRUE );
11091105 $ params = $ request ->getParameters ();
1110- $ params [self ::FLASH_KEY ] = $ this ->getParameter ( self :: FLASH_KEY );
1106+ $ params [Http \Session ::FLASH_KEY ] = $ this ->getSession ()-> getFlashId ( );
11111107 $ request ->setParameters ($ params );
11121108 $ this ->sendResponse (new Responses \ForwardResponse ($ request ));
11131109 }
@@ -1289,8 +1285,7 @@ public function popGlobalParameters($id)
12891285 */
12901286 public function hasFlashSession ()
12911287 {
1292- return !empty ($ this ->params [self ::FLASH_KEY ])
1293- && $ this ->getSession ()->hasSection ('Nette.Application.Flash/ ' . $ this ->params [self ::FLASH_KEY ]);
1288+ return (bool ) $ this ->getSession ()->getFlashId ();
12941289 }
12951290
12961291
@@ -1300,10 +1295,7 @@ public function hasFlashSession()
13001295 */
13011296 public function getFlashSession ()
13021297 {
1303- if (empty ($ this ->params [self ::FLASH_KEY ])) {
1304- $ this ->params [self ::FLASH_KEY ] = Nette \Utils \Random::generate (4 );
1305- }
1306- return $ this ->getSession ('Nette.Application.Flash/ ' . $ this ->params [self ::FLASH_KEY ]);
1298+ return $ this ->getSession ()->getFlashSection ('Nette.Application.Flash ' );
13071299 }
13081300
13091301
0 commit comments