Exemplo n.º 1
0
  */
 if (headers_sent() || (int) ob_get_length() > 0) {
     throw new OwnsettingsCreatedOutputException();
 }
 # if
 # helper functions for passed variables
 $req = new SpotReq();
 $req->initialize($settings);
 $page = $req->getDef('page', 'index');
 # Retrieve the users object of the user which is logged on
 SpotTiming::start('auth');
 $spotUserSystem = new SpotUserSystem($db, $settings);
 if ($req->doesExist('apikey')) {
     $currentSession = $spotUserSystem->verifyApi($req->getDef('apikey', ''));
 } else {
     $currentSession = $spotUserSystem->useOrStartSession(false);
 }
 # if
 /*
  * If three is no user object, we don't have a security system
  * either. Without a security system we cannot boot, so fatal
  */
 if ($currentSession === false) {
     if ($req->doesExist('apikey')) {
         $currentSession = $spotUserSystem->useOrStartSession(true);
         throw new PermissionDeniedException(SpotSecurity::spotsec_consume_api, 'invalid API key');
     } else {
         throw new SqlErrorException("Unable to create session");
     }
     # else
 }
Exemplo n.º 2
0
		die("Globale settings zijn gewijzigd, draai upgrade-db.php aub" . PHP_EOL);
	} # if

	# helper functions for passed variables
	$req = new SpotReq();
	$req->initialize($settings);

	$page = $req->getDef('page', 'index');

	# Haal het userobject op dat 'ingelogged' is
	SpotTiming::start('auth');
	$spotUserSystem = new SpotUserSystem($db, $settings);
	if ($req->doesExist('apikey')) {
		$currentSession = $spotUserSystem->verifyApi($req->getDef('apikey', ''));
	} else {
		$currentSession = $spotUserSystem->useOrStartSession();
	} # if

	/* Zonder userobject ook geen security systeem, dus dit is altijd fatal */
	if ($currentSession === false) {
		if ($req->doesExist('apikey')) {
			throw new Exception("API Key Incorrect");
		} else {
			throw new Exception("Unable to create session");
		} # else
	} # if
	SpotTiming::stop('auth');

	# Controleer nu pas of de securitygroups wel valid zijn
	if (!$currentSession['security']->securityValid()) {
		die("Security settings zijn gewijzigd, draai upgrade-db.php aub" . PHP_EOL);