session_start();
if(!isset($GLOBALS["errors"]) && !isset($GLOBALS["warnings"]) ) {
require_once("./includes/php/db.inc.php");
require_once("./includes/php/commons.inc.php");
require_once("./includes/php/CAS/CAS.php");
if(isset($_REQUEST["action"])) {
$action = $_REQUEST["action"];
require("./includes/php/" . $action . ".inc.php");
exit(0);
}
phpCAS::setDebug();
phpCAS::client(CAS_VERSION_2_0,'id.ist.utl.pt',443,'/cas');
phpCAS::forceAuthentication();
$user = phpCAS::getUser();
$_POST['utilizador'] = $user;
redirectCAS(NULL,NULL, "login");
exit;
} else {
//if (!isset($GLOBALS["errors"])) $GLOBALS["errors"]) = $_GET['erros'];
if(isset($_REQUEST["action"])) {
$action = $_REQUEST["action"];
require("./includes/php/" . $action . ".inc.php");
exit(0);
}
if(!isset($_SESSION["candidatura_id"])) {
?>