PATH:
var
/
www
/
vhosts
/
sandbox.dos-group.com
/
beacons.sandbox.dos-group.com
/
app
/
config
<?php /** * @Author Mariano.Pirelli * @Copyright (c) 2015 DOS Group. All rights reserved */ use App\Auth\MyAclService; use App\Auth\MyUserService; use Dos\Phalcon\Auth\UserService; use Dos\Phalcon\Email\Adapter\PHPMailer as MailAdapter; use Dos\Phalcon\Forms\Element\Bootstrap\ElementFormatter; use Dos\Phalcon\Intl\LocaleService; use Monolog\Handler\RotatingFileHandler; use Monolog\Logger; use Phalcon\Db\Adapter\Pdo\Mysql; use Phalcon\DI\FactoryDefault; use Phalcon\Flash\Session; use Phalcon\Http\Response\Cookies; use Phalcon\Mvc\Url; use Phalcon\Session\Adapter\Files as SessionAdapter; /** * The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework */ $di = new FactoryDefault(); //Read the configuration $config = include __DIR__ . '/config.php'; // Register a logger $di->setShared('logger', function () use ($config) { //Scrivere log รจ costoso in termini di performance, usare i log levels. $logger = new Logger($config->logger->config->channel); $logger->pushHandler(new RotatingFileHandler($config->logger->config->fileName, $config->logger->config->maxFiles, $config->logger->config->level)); return $logger; }); // Register the Url service $di->setShared('url', function () use ($config) { $url = new Url(); $url->setBaseUri($config->application->baseUri); $url->setStaticBaseUri($config->application->staticBaseUri); $url->setBasePath($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR); return $url; }); // Register the router service $di->setShared('router', function () { $router = require __DIR__ . '/routes.php'; return $router; }); // Register the session service $di->setShared('session', function () use ($config) { $session = new SessionAdapter(['uniqueId' => $config->session->prefix]); $session->start(); return $session; }); // Register the cache service $di->set('cache', function () use ($config) { $cache = require __DIR__ . '/../../vendor/dos/phalcon/config/cache.php'; return $cache; }); // Register the models cache service $di->set('modelsCache', function () use ($config) { $cache = require __DIR__ . '/../../vendor/dos/phalcon/config/cache.php'; return $cache; }); // Register the models metadata cache service $di->set('modelsMetadata', function () use ($config) { $metaData = require __DIR__ . '/../../vendor/dos/phalcon/config/metadata.php'; return $metaData; }); // Register database service $di->setShared('db', new Mysql([ 'host' => $config->db->host, 'port' => $config->db->port, 'dbname' => $config->db->database, 'username' => $config->db->username, 'password' => $config->db->password, ])); /** * Database connection to the notification database */ $di->setShared('dbNotification', new Mysql([ 'host' => $config->dbNotification->host, 'port' => $config->dbNotification->port, 'username' => $config->dbNotification->username, 'password' => $config->dbNotification->password, 'dbname' => $config->dbNotification->database, ])); // Register acl service $di->setShared('acl', function () { return new MyAclService(); }); // Register user service $di->setShared('user', function () { return new MyUserService(); }); // Register the locale service $di->setShared('locale', function () { return new LocaleService(); }); // Register cookies service $di->setShared('cookies', function () { $cookies = new Cookies(); $cookies->useEncryption(FALSE); return $cookies; }); /* * Register the email service */ $di->setShared('email', function () use ($config) { return new MailAdapter([ 'subjectPrefix' => $config->application->name . ' - ', 'viewsDir' => __DIR__ . '/../../vendor/dos/phalcon/templates/email', 'enableAuth' => $config->mail->smtp->enableAuth, 'encryption' => $config->mail->smtp->encryption, 'port' => $config->mail->smtp->port, 'server' => $config->mail->smtp->server, 'username' => $config->mail->smtp->username, 'password' => $config->mail->smtp->password, 'from' => $config->mail->from, 'fromName' => $config->mail->fromName, 'replyTo' => $config->mail->replyTo, 'replyToName' => $config->mail->replyToName, ]); }); /** * Register assets for public resources */ $di->setShared('assets', function () { return require __DIR__ . '/assets.php'; }); /* * Register the flash service with custom CSS classes */ $di->setShared('flash', function () { $flash = new Phalcon\Flash\Direct([ 'error' => 'alert alert-danger', 'success' => 'alert alert-success', 'warning' => 'alert alert-warning', 'notice' => 'alert alert-info', ]); return $flash; }); //Register the flash service with custom CSS classes $di->setShared('flashSession', function () { $flash = new Session([ 'error' => 'alert alert-danger', 'success' => 'alert alert-success', 'warning' => 'alert alert-warning', 'notice' => 'alert alert-info', ]); return $flash; }); /** * Form Element formatter, used by default in TabelController */ $di->setShared('formElementFormatter', function () { return new ElementFormatter(); });
[-] assets.php
[open]
[-] intl.php
[open]
[-] routes.php
[open]
[+]
..
[-] services.php
[open]
[-] config.php
[open]
[-] modules.php
[open]
[-] loader.php
[open]