<?php
 // include("debuglib.php")
include_once('../bootloader.php');

?>

<?php

// http://www.framework.zend.com/manual/1.9/en/zend.rest.client.html
// http://www.framework.zend.com/manual/2.0/en/modules/zendservice.twitter.html
// const VERSION = '1.9.7';
// http://www.quadrillian.com/#view-project/161

set_time_limit(600); // increase timeout
define('ATMAIL_MIN_PHP_VERSION', '5.1.6');

// Read in current Atmail version
$atmailVersion = trim(@file_get_contents('../.VERSION'));

// Setup lib paths
// define('APP_ROOT', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
$path = dirname(dirname(__FILE__));
set_include_path('.' . PATH_SEPARATOR . "$path/library/" . PATH_SEPARATOR . "$path/sso/phpseclib/");

session_start();

require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();

$loader->setFallbackAutoloader(true);
$loader->suppressNotFoundWarnings(false);

// Report all errors except E_NOTICE
error_reporting(E_ALL ^ E_NOTICE);

// echo "<hr />";
// echo "cookies:<br />";
// print_r($_COOKIE);
// echo "<hr />";
// print_r($_COOKIE[atmailuser]);
// echo "<hr />";
// print_r($_COOKIE[PHPSESSID]);
// echo "<hr />";

$charterSSO = new CharterSSO();
$charterSSO->setCredentials("");

if ($charterSSO->getIsLoggedIn())
{
    echo "<hr />";
    echo "getIsLoggedIn(): "    . $charterSSO->getIsLoggedIn()    . "<br />";
    echo "getStatusCode(): "    . $charterSSO->getStatusCode()    . "<br />";
    echo "getStatusMessage(): " . $charterSSO->getStatusMessage() . "<br />";
    echo "getUsername(): "      . $charterSSO->getUsername()      . "<br />";
    echo "getPassword(): "      . $charterSSO->getPassword()      . "<br />";
    echo "<hr />";
}
else
{
    echo "<br /><hr /><br />";
    echo "Not Logged In";
    echo "<br /><hr /><br />";
}
