"Installer" added
A very basic installer will appear when accessing the home page if there are no users in the database. It allows the initial user to be created.
This commit is contained in:
parent
071577168a
commit
1271afd1d8
6 changed files with 60 additions and 7 deletions
includes/t-basics
|
@ -10,8 +10,10 @@ class Ctrl_HomePage
|
|||
session_start( );
|
||||
if ( array_key_exists( 'uid' , $_SESSION ) ) {
|
||||
return 'items';
|
||||
} else {
|
||||
} elseif ( Loader::DAO( 'users' )->hasUsers( ) ) {
|
||||
return 'login';
|
||||
} else {
|
||||
return 'install';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,3 +121,17 @@ class Ctrl_LoggedOut
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class Ctrl_Install
|
||||
extends Controller
|
||||
{
|
||||
|
||||
public function handle( Page $page )
|
||||
{
|
||||
if ( Loader::DAO( 'users' )->hasUsers( ) ) {
|
||||
return 'login';
|
||||
}
|
||||
return Loader::Ctrl( 'users_add_form' , true );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue