use Exception;
use Ampersand\AngularApp;
use Ampersand\Core\Atom;
use Ampersand\Core\Concept;
use Ampersand\Config;
use Ampersand\Interfacing\InterfaceObject;
use Ampersand\Core\Relation;
use Ampersand\Log\Logger;
use PHPExcel_Cell;
use PHPExcel_Shared_Date;
use PHPExcel_IOFactory;
require_once __DIR__ . '/lib/Classes/PHPExcel.php';
// UI
AngularApp::addMenuItem('ext', 'extensions/ExcelImport/ui/views/MenuItem.html', function ($session) {
    $roles = Config::get('allowedRolesForExcelImport', 'excelImport');
    return !empty(array_intersect($session->getActiveRoles(), (array) $roles)) || is_null($roles);
});
AngularApp::addCSS('extensions/ExcelImport/ui/css/style.css');
AngularApp::addJS('extensions/ExcelImport/ui/js/ExcelImport.js');
// API
$GLOBALS['api']['files'][] = __DIR__ . DIRECTORY_SEPARATOR . 'api' . DIRECTORY_SEPARATOR . 'import.php';
// Config
Config::set('allowedMimeTypes', 'excelImport', array('application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/excel'));
class ExcelImport
{
    /**
     * 
     * @var string
     */
    public $file;
    /**
    Config::set('ignoreInvariantViolations', 'transactions', false);
    // for debugging can be set to true (transactions will be committed regardless off invariant violations)
    Config::set('interfaceAutoCommitChanges', 'transactions', true);
    // specifies whether changes in an interface are automatically commited when allowed (all invariants hold)
    Config::set('interfaceAutoSaveChanges', 'transactions', true);
    // specifies whether changes in interface are directly communicated (saved) to server
    Config::set('interfaceCacheGetCalls', 'transactions', false);
    // specifies whether GET calls should be cached by the frontend (e.g. angular) application
    // Default CRUD rights for interfaces
    Config::set('defaultCrudC', 'transactions', true);
    Config::set('defaultCrudR', 'transactions', true);
    Config::set('defaultCrudU', 'transactions', true);
    Config::set('defaultCrudD', 'transactions', true);
    // Default notification settings
    Config::set('defaultShowSignals', 'notifications', true);
    Config::set('defaultShowInfos', 'notifications', true);
    Config::set('defaultShowWarnings', 'notifications', true);
    Config::set('defaultShowSuccesses', 'notifications', true);
    Config::set('defaultAutoHideSuccesses', 'notifications', true);
    Config::set('defaultShowErrors', 'notifications', true);
    Config::set('defaultShowInvariants', 'notifications', true);
    // Navigation menu settings
    AngularApp::addMenuItem('refresh', 'app/views/menu/installer.html', function ($session) {
        return !Config::get('productionEnv');
    });
    AngularApp::addMenuItem('refresh', 'app/views/menu/checkAllRules.html', function ($session) {
        return !Config::get('productionEnv');
    });
} catch (Exception $e) {
    throw $e;
}
<?php

namespace Ampersand\Extension\OAuthLogin;

use Exception;
use Ampersand\AngularApp;
use Ampersand\Config;
use Ampersand\Session;
use Ampersand\Database\Database;
use Ampersand\Core\Atom;
use Ampersand\Core\Concept;
use Ampersand\Core\Relation;
// UI
AngularApp::addMenuItem('role', 'extensions/OAuthLogin/ui/views/MenuItem.html', function ($session) {
    return true;
});
AngularApp::addJS('extensions/OAuthLogin/ui/js/LoginModule.js');
// API
$GLOBALS['api']['files'][] = __DIR__ . DIRECTORY_SEPARATOR . 'api' . DIRECTORY_SEPARATOR . 'oauthlogin.php';
class OAuthLoginController
{
    private $token_url;
    private $client_id;
    private $client_secret;
    private $redirect_uri;
    private $tokenObj;
    private $dataObj;
    function __construct($client_id, $client_secret, $redirect_uri, $token_url)
    {
        $this->client_id = $client_id;
        $this->client_secret = $client_secret;