* limitations under the License.
 */
session_start();
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/aabUtil.php';
require_once __DIR__ . '/../lib/AAB/AABService.php';
use Att\Api\AAB\AABService;
$arr = null;
try {
    envinit();
    $aabService = new AABService(getFqdn(), getSessionToken());
    $contact = $aabService->getMyInfo();
    $tables = array();
    $tables[] = generateContactTable($contact);
    $contactId = $contact->getContactId();
    $table = generatePhonesTable($contactId, $contact->getPhones());
    if ($table !== null) {
        $tables[] = $table;
    }
    $table = generateEmailsTable($contactId, $contact->getEmails());
    if ($table !== null) {
        $tables[] = $table;
    }
    $table = generateImsTable($contactId, $contact->getIms());
    if ($table !== null) {
        $tables[] = $table;
    }
    $table = generateAddressesTable($contactId, $contact->getAddresses());
    if ($table !== null) {
        $tables[] = $table;
    }
        if ($table !== null) {
            $tables[] = $table;
        }
        $table = generateAddressesTable($contactId, $contact->getAddresses());
        if ($table !== null) {
            $tables[] = $table;
        }
        $table = generateWeburlsTable($contactId, $contact->getWeburls());
        if ($table !== null) {
            $tables[] = $table;
        }
    }
    foreach ($qcontacts as $qcontact) {
        $tables[] = generateQuickContactTable($qcontact);
        if ($qcontact->getPhone() !== null) {
            $tables[] = generatePhonesTable($qcontact->getContactId(), array($qcontact->getPhone()));
        }
        if ($qcontact->getEmail() !== null) {
            $tables[] = generateEmailsTable($qcontact->getContactId(), array($qcontact->getEmail()));
        }
        if ($qcontact->getIm() !== null) {
            $tables[] = generateImsTable($qcontact->getContactId(), array($qcontact->getIm()));
        }
        if ($qcontact->getAddress() !== null) {
            $tables[] = generateAddressesTable($qcontact->getContactId(), array($qcontact->getAddress()));
        }
    }
    $arr = array('success' => true, 'tables' => $tables);
} catch (Exception $e) {
    $arr = array('success' => false, 'text' => $e->getMessage());
}