#!/usr/clearos/sandbox/usr/bin/php
<?php

/**
 * Registration check-in.
 *
 * @category   apps
 * @package    registration
 * @subpackage scripts
 * @author     ClearCenter <developer@clearcenter.com>
 * @copyright  2011-2012 ClearCenter
 * @license    http://www.clearcenter.com/app_license ClearCenter license
 * @link       http://www.clearcenter.com/support/documentation/clearos/registration/
 */

///////////////////////////////////////////////////////////////////////////////
// N A M E S P A C E
///////////////////////////////////////////////////////////////////////////////

namespace clearos\apps\registration;

///////////////////////////////////////////////////////////////////////////////
// B O O T S T R A P
///////////////////////////////////////////////////////////////////////////////

$bootstrap = getenv('CLEAROS_BOOTSTRAP') ? getenv('CLEAROS_BOOTSTRAP') : '/usr/clearos/framework/shared';
require_once $bootstrap . '/bootstrap.php';

///////////////////////////////////////////////////////////////////////////////
// T R A N S L A T I O N S
///////////////////////////////////////////////////////////////////////////////

clearos_load_language('clearcenter');

///////////////////////////////////////////////////////////////////////////////
// D E P E N D E N C I E S
///////////////////////////////////////////////////////////////////////////////

// Classes
//--------

use \clearos\apps\registration\Registration as Registration;

clearos_load_library('registration/Registration');

// Exceptions
//-----------

use \Exception as Exception;

///////////////////////////////////////////////////////////////////////////////
// M A I N
///////////////////////////////////////////////////////////////////////////////

// Command line options
//--------------------------------------------------------------------

$short_options  = '';

// Common

$options = getopt($short_options);

// Command line options
//--------------------------------------------------------------------

$registration = new Registration();

try {
    $response = $registration->check_in();
    // There may be notifications from the SDN
    if ($response != NULL)
        $registration->set_sdn_notice($response);
} catch (Exception $e) {
    echo clearos_exception_message($e) . "\n";
    clearos_log('clearcenter-checkin', clearos_exception_message($e));
}

// vim: syntax=php ts=4
