Fixed redirect to installer

In some cases redirections to the installer would be ignored. Well, no
more.
This commit is contained in:
Emmanuel BENOîT 2012-02-06 10:09:36 +01:00
parent 9cc43ea4fe
commit d4387ee6bb

View file

@ -8,13 +8,13 @@ class Ctrl_HomePage
public final function handle( Page $page ) public final function handle( Page $page )
{ {
session_start( ); session_start( );
if ( array_key_exists( 'uid' , $_SESSION ) ) { if ( ! Loader::DAO( 'users' )->hasUsers( ) ) {
return 'items';
} elseif ( Loader::DAO( 'users' )->hasUsers( ) ) {
return 'login';
} else {
return 'install'; return 'install';
} }
if ( array_key_exists( 'uid' , $_SESSION ) ) {
return 'items';
}
return 'login';
} }
} }
@ -51,6 +51,9 @@ class Ctrl_CheckSession
public function handle( Page $page ) public function handle( Page $page )
{ {
session_start( ); session_start( );
if ( ! Loader::DAO( 'users' )->hasUsers( ) ) {
return 'install';
}
if ( array_key_exists( $this->sessionKey , $_SESSION ) ) { if ( array_key_exists( $this->sessionKey , $_SESSION ) ) {
return null; return null;
} }