public function export()
 {
     if (!$this->app->module("printdesigner")->checkToken()) {
         return json_encode(['error' => 'Invalid token!']);
     }
     $project = $this->param('project', false);
     if (!$project['projectID']) {
         return json_encode(['error' => 'No projectID!']);
     }
     $svg = $this->param('svg', '');
     $project['svg_path'] = 'projects/' . $project['projectID'] . '/export.svg';
     if (!is_dir(COCKPIT_DOCS_ROOT . '/projects/' . $project['projectID'])) {
         mkdir(COCKPIT_DOCS_ROOT . '/projects/' . $project['projectID'], 644);
     }
     $fileSize = file_put_contents(COCKPIT_DOCS_ROOT . '/' . $project['svg_path'], $svg);
     $project['pdf_path'] = 'projects/' . $project['projectID'] . '/export.pdf';
     $this->app->helper("pdf")->fromSvg(COCKPIT_DOCS_ROOT . '/' . $project['svg_path'], COCKPIT_DOCS_ROOT . '/' . $project['pdf_path']);
     //vue don't want no dangling _'s
     $project['_id'] = !empty($project['extID']) ? $project['extID'] : null;
     $ret = $this->module("datastore")->save_entry('printdesigner_projects', $project);
     if (empty($project['_id'])) {
         //pk only returned on new item
         $project['extID'] = $ret;
     }
     return json_encode(['token' => getSessionToken(), 'data' => $project]);
 }
/*
 * Copyright 2015 AT&T
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
session_start();
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/../lib/AAB/AABService.php';
use Att\Api\AAB\AABService;
$arr = null;
try {
    envinit();
    $aabService = new AABService(getFqdn(), getSessionToken());
    $contactId = $_POST['deleteContactId'];
    $aabService->deleteContact($contactId);
    $arr = array('success' => true, 'text' => 'Successfully deleted contact.');
} catch (Exception $e) {
    $arr = array('success' => false, 'text' => $e->getMessage());
}
echo json_encode($arr);
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/*
 * Copyright 2015 AT&T
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
session_start();
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/../lib/IMMN/IMMNService.php';
use Att\Api\IMMN\IMMNService;
$arr = null;
try {
    envinit();
    $immnSrvc = new IMMNService(getFqdn(), getSessionToken());
    $immnSrvc->createMessageIndex();
    $arr = array('success' => true, 'text' => 'Message index created.');
} catch (Exception $e) {
    $arr = array('success' => false, 'text' => $e->getMessage());
}
echo json_encode($arr);
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
try {
    if (isset($_SESSION['subscriptionId'])) {
        throw new Exception('You must first delete your existing subscription.');
    }
    $events = array();
    if (isset($_REQUEST['subscriptionText'])) {
        $events[] = 'TEXT';
    }
    if (isset($_REQUEST['subscriptionMms'])) {
        $events[] = 'MMS';
    }
    if (count($events) == 0) {
        throw new Exception("You must select at least one of Text or MMS");
    }
    envinit();
    $webhooksSrvc = new WebhooksService(getFqdn(), getSessionToken());
    $callbackData = $_REQUEST['callbackData'];
    if ($callbackData == '') {
        $callbackData = null;
    }
    $args = new CreateSubscriptionArgs(CHANNEL_ID, $events, $callbackData, EXPIRES_IN);
    $response = $webhooksSrvc->createNotificationSubscription($args);
    $subscription = $response->getSubscription();
    $subscriptionId = $subscription->getSubscriptionId();
    $_SESSION['subscriptionId'] = $subscriptionId;
    $_SESSION['subscriptionExpiry'] = EXPIRES_IN + time();
    $arr = array('success' => true, 'text' => 'Subscription created.');
} catch (Exception $e) {
    $arr = array('success' => false, 'text' => $e->getMessage());
}
echo json_encode($arr);
<?php
$token = '';
if (file_exists('cockpit/bootstrap.php')) {
	include 'cockpit/bootstrap.php';
	$token = getSessionToken();
}?>
<!DOCTYPE HTML>
<html lang="nl-NL" dir="ltr">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bixie PrintDesigner</title>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="vendor/uikit/css/uikit.almost-flat.min.css" type="text/css" />
    <link rel="stylesheet" href="vendor/uikit/css/components/sortable.almost-flat.min.css" type="text/css" />
    <link rel="stylesheet" href="vendor/uikit/css/components/notify.almost-flat.min.css" type="text/css" />
</head>

<body>
    <div class="uk-container uk-container-center">
        <header class="uk-block uk-block-primary">
            <h1 class="uk-text-center uk-margin-remove uk-contrast">Bixie PrintDesigner</h1>
        </header>
        <section class="uk-block uk-block-default">
            <div id="main" class="uk-form">
                <component is="{{ currentView }}"></component>
            </div>
        </section>

    </div>
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
session_start();
require_once __DIR__ . '/../config.php';
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/../lib/OAuth/OAuthException.php';
use Att\Api\OAuth\OAuthException;
try {
    envinit();
    getSessionToken();
    header("Location: " . INDEX_URI);
} catch (OAuthException $oe) {
    $error = $oe->getError();
    $errorDesc = $oe->getErrorDescription();
    if (isset($_SESSION['savedData'])) {
        $savedData = json_decode($_SESSION['savedData'], true);
        if (isset($savedData['redirecting'])) {
            unset($savedData['redirecting']);
            $_SESSION['savedData'] = json_encode($savedData);
        }
    }
}
?>
<!DOCTYPE html>
<html lang="en">