<?php
$permittedPages = array('terms.php');
if (defined(SableSystem) || SableSystem::loggedIn())
{
	// define who may/may not access this page:
	$loginRequired = true; //set to false if you do not need to be logged in to access this module.
	$loggedIn = SableSystem::loggedIn();
	$allowModuleAccess = $loggedIn && $loginRequired;
	if (!$allowModuleAccess)
	{
		SableGeneralFunctions::divertFromPage();
	}
	else
	{
		/* 
			To be in here means that the user is NOT logged in. 
			If not logged in, we only permit access to the registration page:
		*/
		if (!SableSystem::loggedIn())
		{
			if (!(empty($_SESSION['current_dir']) && $_SESSION['current_page'] == 'index.php'))
			{
				if (!in_array($_SESSION['current_page'], $permittedPages)) SableGeneralFunctions::divertFromPage();
			}
		}
	}
}