//Logger::registerGenericHandler($browserHandler);
// User log handler
Logger::registerHandlerForChannel('USERLOG', new NotificationHandler(\Monolog\Logger::INFO));
/**************************************************************************************************
 * SERVER settings
 *************************************************************************************************/
// Config::set('serverURL', 'global', 'http://www.yourdomain.nl'); // defaults to http://localhost/<ampersand context name>
// Config::set('apiPath', 'global', '/api/v1'); // relative path to api
/**************************************************************************************************
 * DATABASE settings
 *************************************************************************************************/
// Config::set('dbHost', 'mysqlDatabase', 'localhost');
// Config::set('dbUser', 'mysqlDatabase', 'ampersand');
// Config::set('dbPassword', 'mysqlDatabase', 'ampersand');
// Config::set('dbName', 'mysqlDatabase', '');
/**************************************************************************************************
 * LOGIN FUNCTIONALITY
 * 
 * The login functionality requires the ampersand SIAM module
 * The module can be downloaded at: https://github.com/AmpersandTarski/ampersand-models/tree/master/SIAM
 * Copy and rename the SIAM_Module-example.adl into SIAM_Module.adl
 * Include this file into your project
 * Uncomment the config setting below
 *************************************************************************************************/
Config::set('loginEnabled', 'global', true);
/**************************************************************************************************
 * EXTENSIONS
 *************************************************************************************************/
require_once __DIR__ . '/extensions/ExecEngine/ExecEngine.php';
// Enable ExecEngine
// require_once(__DIR__ . '/extensions/ExcelImport/ExcelImport.php'); // Enable ExcelImport
Exemplo n.º 2
0
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;
    /**
     *
     * @var \Psr\Log\LoggerInterface
     */
    private $logger;
    /**
     * Constructor
     */
Exemplo n.º 3
0
    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;
}
Exemplo n.º 4
0
$hook1 = array('class' => '\\Ampersand\\Extension\\ExecEngine\\ExecEngine', 'function' => 'run', 'filename' => 'ExecEngine.php', 'filepath' => 'extensions/ExecEngine', 'params' => array());
Hooks::addHook('preDatabaseCloseTransaction', $hook1);
$hook2 = array('class' => '\\Ampersand\\Extension\\ExecEngine\\ExecEngine', 'function' => 'run', 'filename' => 'ExecEngine.php', 'filepath' => 'extensions/ExecEngine', 'params' => array(true));
Hooks::addHook('postDatabaseReinstallDB', $hook2);
// UI
AngularApp::addMenuItem('ext', 'extensions/ExecEngine/ui/views/MenuItem.html', function ($session) {
    $roles = Config::get('allowedRolesForRunFunction', 'execEngine');
    return !empty(array_intersect($session->getActiveRoles(), (array) $roles)) || is_null($roles);
});
AngularApp::addJS('extensions/ExecEngine/ui/js/ExecEngine.js');
// API
$GLOBALS['api']['files'][] = __DIR__ . DIRECTORY_SEPARATOR . 'api' . DIRECTORY_SEPARATOR . 'run.php';
// Config (can be overwritten in localSettings.php)
Config::set('execEngineRoleName', 'execEngine', 'ExecEngine');
Config::set('autoRerun', 'execEngine', true);
Config::set('maxRunCount', 'execEngine', 10);
class ExecEngine
{
    private static $roleName;
    public static $doRun = true;
    public static $autoRerun;
    public static $runCount;
    public static function run($allRules = false)
    {
        $database = Database::singleton();
        $logger = Logger::getLogger('EXECENGINE');
        $logger->info("ExecEngine run started");
        // Load the execEngine functions (security hazard :P)
        $files = getDirectoryList(__DIR__ . '/functions');
        foreach ($files as $file) {
            if (substr($file, -3) !== 'php') {