34 lines
		
	
	
		
			913 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			913 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
require_once "globals.php";
 | 
						|
 | 
						|
# -dxdebug.default_enable=1 -dxdebug.remote_enable=1 -dxdebug.remote_autostart=1 -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 -dxdebug.idekey=PHPSTORM -dxdebug.mode=debug
 | 
						|
 | 
						|
if (file_exists(INSTALL_INDICATOR)) {
 | 
						|
    echo "SpreadQuiz already installed!";
 | 
						|
    exit();
 | 
						|
}
 | 
						|
 | 
						|
init_datadir(); // create data directory
 | 
						|
 | 
						|
// auto-create databases
 | 
						|
require_once "class/UserMgr.php";
 | 
						|
require_once "class/GroupMgr.php";
 | 
						|
require_once "class/GameMgr.php";
 | 
						|
require_once "class/TestMgr.php";
 | 
						|
 | 
						|
$usrmgr = new UserMgr();
 | 
						|
$groupMgr = new GroupMgr();
 | 
						|
$gameMgr = new GameMgr();
 | 
						|
$testMgr = new TestMgr();
 | 
						|
 | 
						|
// create "quizmaster" (admin) user
 | 
						|
$pw = uniqid();
 | 
						|
$usrmgr->addUser(QUIZMASTER_NICKNAME, $pw, "");
 | 
						|
$qm = $usrmgr->getUser(QUIZMASTER_NICKNAME);
 | 
						|
$qm->setPrivilege(PRIVILEGE_QUIZMASTER);
 | 
						|
echo "Quizmaster account: quizmaster, $pw\n";
 | 
						|
 | 
						|
// deploy install indicator
 | 
						|
touch(INSTALL_INDICATOR);
 |