Phalcon Framework 3.4.5

Phalcon\Mvc\Model\Exception: Meta-Data directory cannot be written

phalcon/mvc/model/metadata/files.zep (88)
#0Phalcon\Mvc\Model\MetaData\Files->write(map-illusion\common\models\languages, Array([0] => (empty string), [1] => (empty string)))
#1Phalcon\Mvc\Model\MetaData->_initialize(Object(illusion\Common\Models\Languages: 28), null, null, null)
#2Phalcon\Mvc\Model\MetaData->readColumnMapIndex(Object(illusion\Common\Models\Languages: 28), 1)
#3Phalcon\Mvc\Model\MetaData->getReverseColumnMap(Object(illusion\Common\Models\Languages: 28))
#4Phalcon\Mvc\Model::_invokeFinder(findFirstByLang, Array([0] => es))
#5Phalcon\Mvc\Model::__callStatic(findFirstByLang, Array([0] => es))
/home/appcentroespecia/public_html/apps/config/services.php (237)
<?php
 
namespace illusion;
 
use illusion\Common\Cms\CMS;
use illusion\Common\Plugins\ConnectionPlugin;
use illusion\Common\Plugins\ForwardPlugin;
use Phalcon\DI\FactoryDefault;
use Phalcon\DI;
use Phalcon\Mvc\View;
use Phalcon\Crypt;
use Phalcon\Mvc\Dispatcher;
use Phalcon\Mvc\Url as UrlResolver;
use Pdo;
use Phalcon\Cache\Backend\File;
use Phalcon\Cache\Frontend\Data;
use Phalcon\Db\Adapter\Cacheable\Mysql;
use Phalcon\Db\Adapter\Pdo\Mysql as Connection;
use Phalcon\Mvc\View\Engine\Volt as VoltEngine;
use Phalcon\Mvc\Model\Metadata\Files as MetaDataAdapter;
use Phalcon\Session\Adapter\Files as SessionAdapter;
use Phalcon\Flash\Direct as Flash;
use illusion\Common\Auth\Auth;
use illusion\Common\Models\Info;
use illusion\Common\Models\Languages;
use Phalcon\Flash\Session;
use illusion\Common\Acl\Acl;
use illusion\Mail\Mail;
use Phalcon\Logger;
use Phalcon\Events\Manager;
use Phalcon\Logger\Adapter\File as FileLogger;
use illusion\Common\Utils\Utils;
use Phalcon\Http\Response\Cookies;
use Phalcon\Http\Request;
use Phalcon\Translate\Adapter\Database;
use ReflectionClass;
use ReflectionMethod;
use illusion\Common\Plugins\NotFoundPlugin;
use illusion\Common\Plugins\SecurityPlugin;
 
/**
 * The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework
 */
$di = new FactoryDefault();
 
 
/**
 * Register the global configuration as config
 */
$di->set('config', $config);
 
/**
 * Loading routes from the routes.php file
 */
$di->set('router', function () use ($config) {
    return require APPS_DIR . '/config/routes.php';
});
 
/**
 * The URL component is used to generate all kind of urls in the application
 */
$di->set('url', function () use ($config) {
    $url = new UrlResolver();
    $url->setBaseUri($config->application->publicUrl . $config->application->baseUri);
    return $url;
}, true);
 
/**
 * Setting up the view component
 */
$di->set('view', function () use ($config) {
 
    $view = new View();
 
    $view->registerEngines(['.volt' => function ($view, $di) use ($config) {
        $volt = new VoltEngine($view, $di);
        $volt->setOptions([
            'compiledPath' => CACHE_DIR . '/volt/',
            'compiledSeparator' => '_',
            'compileAlways' => (APPLICATION_ENV == 'dev') ? false : true
        ]);
        return $volt;
    }]);
 
    return $view;
}, true);
 
 
/**
 * Database connection is created based in the parameters defined in the configuration file
 */
$di->set('db', function () use ($config) {
 
    try {
 
        //    $connection = new Mysql([
        //        'host' => $config->database->host,
        //        'username' => $config->database->username,
        //        'password' => $config->database->password,
        //        'dbname' => $config->database->dbname,
        //        'charset' => $config->database->charset,
        //        'options' => [Pdo::ATTR_EMULATE_PREPARES => false]
        //    ]);
 
        $connection = new Connection(
            array(
                "host" => $config->database->host,
                "username" => $config->database->username,
                "password" => $config->database->password,
                "dbname" => $config->database->dbname,
                "charset" => $config->database->charset
            )
        );
        if (debugSQL) {
            $eventsManager = new Manager();
            $logger = new FileLogger(LOGS_DIR . '/debug.log');
            $eventsManager->attach('db', function ($event, $connection) use ($logger) {
                if ($event->getType() == 'beforeQuery') {
                    $logger->log($connection->getSQLStatement(), Logger::INFO);
                }
            });
            $connection->setEventsManager($eventsManager);
        }
 
        //    $frontCache = new Data(['lifetime' => 3600]);
        ////    $frontCache = new Data(['lifetime' => 3600]);
        //    // File backend settings
        //    $connection->setCache(new File($frontCache, ['cacheDir' => CACHE_DIR . '/db/']));
 
        return $connection;
 
    } catch (\PDOException $e) {
        throw new \PDOException("Error: " . $e->getMessage());
    }
 
});
 
if (APPLICATION_ENV == 'pro') {
    $di->set('modelsMetadata', function () use ($config) {
        return new MetaDataAdapter([
            'metaDataDir' => CACHE_DIR . '/metaData/'
        ]);
    });
}
 
/**
 * Start the session the first time some component request the session service
 */
$di->set('session', function () {
    $session = new SessionAdapter();
    $session->start();
    return $session;
});
 
$di->set('cookies', function () {
    $cookies = new Cookies();
    $cookies->useEncryption(false);
    return $cookies;
});
 
/**
 * Crypt service
 */
$di->set('crypt', function () use ($config) {
    $crypt = new Crypt();
    $crypt->setKey($config->application->cryptSalt);
    return $crypt;
});
 
$di->set('dispatcher', function () use ($di) {
 
    $evManager = $di->getShared('eventsManager');
    $evManager->attach('dispatch:beforeDispatch', new SecurityPlugin);
    $evManager->attach('dispatch:beforeException', new NotFoundPlugin);
    $evManager->attach('dispatch:beforeForward', new ForwardPlugin);
 
    $dispatcher = new Dispatcher();
 
    $dispatcher->setEventsManager($evManager);
    return $dispatcher;
}, true
);
 
 
/**
 * Flash service with custom CSS classes
 */
$di->set('flash', function () {
    return new Session([
        'success' => 'alert alert-success alert-dismissable fade in',
        'notice' => 'alert alert-info alert-dismissable fade in',
        'warning' => 'alert alert-warning alert-dismissable fade in',
        'error' => 'alert alert-danger alert-dismissable fade in'
    ]);
});
 
/**
 * Custom authentication component
 */
$di->setShared('auth', function () {
    return new Auth();
});
 
$di->setShared('utils', function () {
    return new Utils();
});
 
$di->setShared('cms', function () {
    return new CMS();
});
 
/**
 * Access Control List
 */
$di->set('acl', function () {
    return new Acl();
});
/**
 * Access Control List
 */
$di->setShared('mobiledetect', function () {
    return new \Mobile_Detect();
});
 
$di->setShared('t', function ($lang = false) use ($config, $di) {
 
    global $lang;
 
    $language = DI::getDefault()->getShared('auth')->getActiveLanguage();
    if (!$language) {
        $request = new Request();
        $lang = $request->getBestLanguage();
        if (!$lang) {
            $lang = 'es';
        }
 
        $language = Languages::findFirstByLang($lang);
        if (!$language) {
            $lang = 'es';
        } else {
            $lang = $language->lang;
        }
    } else {
        $lang = $language->lang;
    }
 
 
    return new Database([
        'db' => $di->getDefault()->getDb(),
        'table' => 'translations',
        'language' => $lang,
    ]);
});
 
$di->set('connectionPlugin', function () {
    return new ConnectionPlugin();
});
 
 
/*
 * Marcando como shared el modulo al cargalo esto deja disponibles las "cosicas"
*/
foreach ($config->modules as $module) {
    $dir = preg_replace("/\/Module.php$/", "", $module['path']);
    // Register Namespace for Shared Module (will not be called by dispatch)
    if (array_key_exists('shared', $module) && $module['shared']) {
        $namespace = preg_replace('/\\\Module$/', "", $module['className']);
        $loader->registerNamespaces(array($namespace => $dir), true);
        // Loading Module class bootloader Reflection Instance
        $reflexion = new ReflectionClass($module['className']);
        $instance = $reflexion->newInstanceWithoutConstructor();
        // Execute every 'register' methods
        foreach ($reflexion->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
            if (preg_match('/^register/', $method->name)) {
                $instance->{$method->name}($di);
            }
        }
    }
}
#6Closure->illusion\{closure}()
#7Phalcon\Di\Service->resolve(null, Object(Phalcon\Di\FactoryDefault))
#8Phalcon\Di->get(t, null)
#9Phalcon\Di->getShared(t)
#10Phalcon\Di\Injectable->__get(t)
/home/appcentroespecia/public_html/apps/modules/users/controllers/AuthController.php (26)
<?php
 
namespace illusion\Modules\Users\Controllers;
 
 
use illusion\Common\Utils\Utils;
use illusion\Modules\Users\Forms\ConfirmaccountForm;
use illusion\Modules\Users\Forms\LoginForm;
use illusion\Modules\Users\Forms\ForgotPasswordForm;
use illusion\Modules\Users\Models\PasswordChanges;
use illusion\Modules\Users\Models\Users;
use illusion\Modules\Users\Models\ResetPasswords;
use illusion\Common\Auth\Exception;
use Phalcon\Mvc\View;
use Phalcon\Mvc\Controller;
 
class AuthController extends Controller
{
 
    public function loginAction()
    {
 
        $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        $this->view->setVars(
            array(
                'pageTitle' => $this->t->_('Iniciar sesión'),
                'pageTitleSmall' => ''
            )
        );
 
 
        $form = new LoginForm();
 
        if (!$this->request->isPost()) {
            if ($this->auth->hasRememberMe()) {
                return $this->auth->loginWithRememberMe();
            }
        } else {
 
            if ($form->isValid($this->request->getPost()) == false) {
                foreach ($form->getMessages() as $message) {
                    $this->flash->error($message);
                }
            } else {
 
                try {
                    $this->auth->check(array(
                        'email' => $this->request->getPost('email', 'email'),
                        'password' => $this->request->getPost('password', 'striptags'),
                        'remember' => $this->request->getPost('remember')
                    ));
                    $this->session->remove("lock");
                    $this->session->remove("referer");
                    $url = 'core/index';
 
                    if ($this->session->has('returnTo')) {
                        $returnTo = $this->session->get('returnTo');
                        if (!strpos($returnTo, 'users/login')) {
                            $url = $returnTo;
                        }
                        $this->session->remove('returnTo');
                    }
                    return $this->response->redirect($url);
                } catch (Exception $e) {
                    $this->flash->error($e->getMessage());
                }
            }
        }
 
        $this->view->setVar('loginForm', new LoginForm());
        $this->view->setVar('forgotForm', new ForgotPasswordForm());
    }
 
    public function confirmaccountAction($code)
    {
        $user = Users::findFirstByCode($code);
 
        if (!$user) {
            $this->flash->warning($this->t->_('El enlace ha caducado, puede solicitar una recuperación de contraseña.'));
            return $this->dispatcher->forward(array(
                'module' => 'users',
                'controller' => 'auth',
                'action' => 'login'
            ));
        }
 
        if ($user->used == 'Y') {
            $this->flash->warning($this->t->_('El enlace ya ha sido utilizado, puede solicitar una recuperación de contraseña.'));
            return $this->dispatcher->forward(array(
                'module' => 'users',
                'controller' => 'auth',
                'action' => 'login'
            ));
        }
 
 
        $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        $form = new ConfirmaccountForm($user);
 
//        Utils::po($this->request->getPost());
//        die();
        if ($this->request->isPost()) {
            
            if ($form->isValid($this->request->getPost()) == false) {
                foreach ($form->getMessages() as $message) {
                    $this->flash->error($message);
                }
            } else {
                $user = Users::findFirstByHash($this->request->getPost('hash'));
                if (!$user) {
                    $this->flash->warning($this->t->_('El enlace ha caducado, puede solicitar una recuperación de contraseña.'));
                    return $this->dispatcher->forward(array(
                        'module' => 'users',
                        'controller' => 'auth',
                        'action' => 'login'
                    ));
                }
                $password = $this->request->getPost('passwordNew');
                $passwordProfesto = $this->request->getPost('pin');
 
                $user->password = $this->security->hash($password);
                $user->passwordProfesto = $this->security->hash($passwordProfesto);
 
                $passwordChange = new PasswordChanges();
                $passwordChange->user = $user;
                $passwordChange->ipAddress = $this->request->getClientAddress();
                $passwordChange->userAgent = $this->request->getUserAgent();
                $passwordChange->createdAt = date('Y-m-d H:i:s');
                $user->used = 'Y';
                $user->code = '';
 
                $user->tmpPassword = $password;
                $user->update();
 
                $this->auth->authUserById($user->id);
                $this->flash->success($this->t->_('Contraseña guardada correctamente, bienvenid@ a Profesto.'));
                return $this->response->redirect('/');
            }
        }
        $this->view->form = $form;
        $this->view->code = $code;
    }
 
}
#11illusion\Modules\Users\Controllers\AuthController->loginAction()
#12Phalcon\Dispatcher->callActionMethod(Object(illusion\Modules\Users\Controllers\AuthController), loginAction, Array())
#13Phalcon\Dispatcher->dispatch()
#14Phalcon\Mvc\Application->handle()
/home/appcentroespecia/public_html/public/index.php (49)
<?php
ini_set("session.cookie_lifetime","14400");
ini_set("session.gc_maxlifetime","14000");
 
use Phalcon\Mvc\Application;
 
error_reporting(E_ALL);
 
 
date_default_timezone_set('Europe/Madrid');
setlocale(LC_ALL, array("es_ES"));
setlocale(LC_MONETARY, 'es_ES');
 
define('debug', true);
define('debugSQL', false);
 
if (!defined('APPLICATION_ENV')) {
    define('APPLICATION_ENV', 'pro');
}
 
if (debug) {
    (new \Phalcon\Debug())->listen();
}
 
//try {
if (!defined('BASE_DIR')) {
    define('BASE_DIR', dirname(__DIR__));
}
 
include BASE_DIR . '/apps/config/constants.php';
 
include BASE_DIR . '/apps/config/c_modules.php';
 
$config = include APPS_DIR . '/config/environment/' . APPLICATION_ENV . '/base-config.php';
$ini_file = APPS_DIR . '/config/environment/' . APPLICATION_ENV . '/base-config.ini';
 
$config2 = new \Phalcon\Config\Adapter\Ini($ini_file);
 
$config->merge($config2);
 
include APPS_DIR . '/config/loader.php';
include APPS_DIR . '/config/services.php';
 
$application = new Application();
$application->setDI($di);
 
require APPS_DIR . '/config/modules.php';
 
echo $application->handle()->getContent();
 
KeyValue
_url/users/auth/login
KeyValue
CONTEXT_DOCUMENT_ROOT/home/appcentroespecia/public_html
CONTEXT_PREFIX
DOCUMENT_ROOT/home/appcentroespecia/public_html
GATEWAY_INTERFACECGI/1.1
H2PUSHoff
H2_PUSHoff
H2_PUSHED
H2_PUSHED_ON
H2_STREAM_ID11
H2_STREAM_TAG1275079-659-11
HTTP2on
HTTPSon
HTTP_ACCEPT*/*
HTTP_ACCEPT_ENCODINGgzip, br, zstd, deflate
HTTP_COOKIEPHPSESSID=caaf6c950c9a796b717a0cb293ea4753
HTTP_HOSTapp.centroespecialtutelar.es
HTTP_REFERERhttps://app.centroespecialtutelar.es/
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_X_HTTPS1
PATH/bin:/usr/bin
PHP_INI_SCAN_DIR/opt/cpanel/ea-php73/root/etc:/opt/cpanel/ea-php73/root/etc/php.d:.
QUERY_STRING_url=/users/auth/login
REDIRECT_H2PUSHoff
REDIRECT_H2_PUSHoff
REDIRECT_H2_PUSHED
REDIRECT_H2_PUSHED_ON
REDIRECT_H2_STREAM_ID11
REDIRECT_H2_STREAM_TAG1275079-659-11
REDIRECT_HTTP2on
REDIRECT_HTTPSon
REDIRECT_QUERY_STRING_url=/users/auth/login
REDIRECT_REDIRECT_H2PUSHoff
REDIRECT_REDIRECT_H2_PUSHoff
REDIRECT_REDIRECT_H2_PUSHED
REDIRECT_REDIRECT_H2_PUSHED_ON
REDIRECT_REDIRECT_H2_STREAM_ID11
REDIRECT_REDIRECT_H2_STREAM_TAG1275079-659-11
REDIRECT_REDIRECT_HTTP2on
REDIRECT_REDIRECT_HTTPSon
REDIRECT_REDIRECT_SCRIPT_URIhttps://app.centroespecialtutelar.es/users/auth/login
REDIRECT_REDIRECT_SCRIPT_URL/users/auth/login
REDIRECT_REDIRECT_SSL_TLS_SNIapp.centroespecialtutelar.es
REDIRECT_REDIRECT_STATUS200
REDIRECT_REDIRECT_UNIQUE_IDaaBdJv0A2GH4Se_GiY_kBAAAgQM
REDIRECT_SCRIPT_URIhttps://app.centroespecialtutelar.es/users/auth/login
REDIRECT_SCRIPT_URL/users/auth/login
REDIRECT_SSL_TLS_SNIapp.centroespecialtutelar.es
REDIRECT_STATUS200
REDIRECT_UNIQUE_IDaaBdJv0A2GH4Se_GiY_kBAAAgQM
REDIRECT_URL/public/users/auth/login
REMOTE_ADDR216.73.216.146
REMOTE_PORT31925
REQUEST_METHODGET
REQUEST_SCHEMEhttps
REQUEST_URI/users/auth/login
SCRIPT_FILENAME/home/appcentroespecia/public_html/public/index.php
SCRIPT_NAME/public/index.php
SCRIPT_URIhttps://app.centroespecialtutelar.es/users/auth/login
SCRIPT_URL/users/auth/login
SERVER_ADDR135.125.108.117
SERVER_ADMINwebmaster@app.centroespecialtutelar.es
SERVER_NAMEapp.centroespecialtutelar.es
SERVER_PORT443
SERVER_PROTOCOLHTTP/2.0
SERVER_SIGNATURE
SERVER_SOFTWAREApache
SSL_TLS_SNIapp.centroespecialtutelar.es
TZEurope/Madrid
UNIQUE_IDaaBdJv0A2GH4Se_GiY_kBAAAgQM
PHP_SELF/public/index.php
REQUEST_TIME_FLOAT1772117286.9385
REQUEST_TIME1772117286
argvArray([0] => _url=/users/auth/login)
argc1
#Path
0/home/appcentroespecia/public_html/public/index.php
1/home/appcentroespecia/public_html/apps/config/constants.php
2/home/appcentroespecia/public_html/apps/config/c_modules.php
3/home/appcentroespecia/public_html/apps/config/environment/pro/base-config.php
4/home/appcentroespecia/public_html/apps/config/loader.php
5/home/appcentroespecia/public_html/vendor/autoload.php
6/home/appcentroespecia/public_html/vendor/composer/autoload_real.php
7/home/appcentroespecia/public_html/vendor/composer/ClassLoader.php
8/home/appcentroespecia/public_html/vendor/composer/autoload_static.php
9/home/appcentroespecia/public_html/vendor/ralouphie/getallheaders/src/getallheaders.php
10/home/appcentroespecia/public_html/vendor/guzzlehttp/psr7/src/functions_include.php
11/home/appcentroespecia/public_html/vendor/guzzlehttp/psr7/src/functions.php
12/home/appcentroespecia/public_html/vendor/symfony/polyfill-mbstring/bootstrap.php
13/home/appcentroespecia/public_html/vendor/clue/stream-filter/src/functions_include.php
14/home/appcentroespecia/public_html/vendor/clue/stream-filter/src/functions.php
15/home/appcentroespecia/public_html/vendor/guzzlehttp/promises/src/functions_include.php
16/home/appcentroespecia/public_html/vendor/guzzlehttp/promises/src/functions.php
17/home/appcentroespecia/public_html/vendor/symfony/polyfill-ctype/bootstrap.php
18/home/appcentroespecia/public_html/vendor/guzzlehttp/guzzle/src/functions_include.php
19/home/appcentroespecia/public_html/vendor/guzzlehttp/guzzle/src/functions.php
20/home/appcentroespecia/public_html/vendor/php-http/message/src/filters.php
21/home/appcentroespecia/public_html/apps/config/services.php
22/home/appcentroespecia/public_html/apps/modules/core/Module.php
23/home/appcentroespecia/public_html/apps/common/plugins/SecurityPlugin.php
24/home/appcentroespecia/public_html/apps/common/plugins/NotFoundPlugin.php
25/home/appcentroespecia/public_html/apps/common/plugins/ForwardPlugin.php
26/home/appcentroespecia/public_html/apps/common/libraries/Auth/Auth.php
27/home/appcentroespecia/public_html/apps/modules/users/Module.php
28/home/appcentroespecia/public_html/apps/modules/app/Module.php
29/home/appcentroespecia/public_html/apps/modules/messaging/Module.php
30/home/appcentroespecia/public_html/apps/modules/cms/Module.php
31/home/appcentroespecia/public_html/apps/config/modules.php
32/home/appcentroespecia/public_html/apps/config/routes.php
33/home/appcentroespecia/public_html/apps/modules/core/routes/CoreRoutes.php
34/home/appcentroespecia/public_html/apps/modules/users/routes/UsersRoutes.php
35/home/appcentroespecia/public_html/apps/modules/app/routes/AppRoutes.php
36/home/appcentroespecia/public_html/apps/modules/messaging/routes/MessagingRoutes.php
37/home/appcentroespecia/public_html/apps/modules/cms/routes/CmsRoutes.php
38/home/appcentroespecia/public_html/apps/common/libraries/Acl/Acl.php
39/home/appcentroespecia/public_html/apps/modules/users/controllers/AuthController.php
40/home/appcentroespecia/public_html/apps/common/models/Languages.php
41/home/appcentroespecia/public_html/apps/common/models/AbstractModel.php
42/home/appcentroespecia/public_html/apps/common/traits/ModelControl.php
Memory
Usage2097152
Phalcon\Mvc\Model\Exception: Meta-Data directory cannot be written
Phalcon Framework 3.4.5

Phalcon\Mvc\Model\Exception: Meta-Data directory cannot be written

phalcon/mvc/model/metadata/files.zep (88)
#0Phalcon\Mvc\Model\MetaData\Files->write(map-illusion\common\models\languages, Array([0] => (empty string), [1] => (empty string)))
#1Phalcon\Mvc\Model\MetaData->_initialize(Object(illusion\Common\Models\Languages: 28), null, null, null)
#2Phalcon\Mvc\Model\MetaData->readColumnMapIndex(Object(illusion\Common\Models\Languages: 28), 1)
#3Phalcon\Mvc\Model\MetaData->getReverseColumnMap(Object(illusion\Common\Models\Languages: 28))
#4Phalcon\Mvc\Model::_invokeFinder(findFirstByLang, Array([0] => es))
#5Phalcon\Mvc\Model::__callStatic(findFirstByLang, Array([0] => es))
/home/appcentroespecia/public_html/apps/config/services.php (237)
<?php
 
namespace illusion;
 
use illusion\Common\Cms\CMS;
use illusion\Common\Plugins\ConnectionPlugin;
use illusion\Common\Plugins\ForwardPlugin;
use Phalcon\DI\FactoryDefault;
use Phalcon\DI;
use Phalcon\Mvc\View;
use Phalcon\Crypt;
use Phalcon\Mvc\Dispatcher;
use Phalcon\Mvc\Url as UrlResolver;
use Pdo;
use Phalcon\Cache\Backend\File;
use Phalcon\Cache\Frontend\Data;
use Phalcon\Db\Adapter\Cacheable\Mysql;
use Phalcon\Db\Adapter\Pdo\Mysql as Connection;
use Phalcon\Mvc\View\Engine\Volt as VoltEngine;
use Phalcon\Mvc\Model\Metadata\Files as MetaDataAdapter;
use Phalcon\Session\Adapter\Files as SessionAdapter;
use Phalcon\Flash\Direct as Flash;
use illusion\Common\Auth\Auth;
use illusion\Common\Models\Info;
use illusion\Common\Models\Languages;
use Phalcon\Flash\Session;
use illusion\Common\Acl\Acl;
use illusion\Mail\Mail;
use Phalcon\Logger;
use Phalcon\Events\Manager;
use Phalcon\Logger\Adapter\File as FileLogger;
use illusion\Common\Utils\Utils;
use Phalcon\Http\Response\Cookies;
use Phalcon\Http\Request;
use Phalcon\Translate\Adapter\Database;
use ReflectionClass;
use ReflectionMethod;
use illusion\Common\Plugins\NotFoundPlugin;
use illusion\Common\Plugins\SecurityPlugin;
 
/**
 * The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework
 */
$di = new FactoryDefault();
 
 
/**
 * Register the global configuration as config
 */
$di->set('config', $config);
 
/**
 * Loading routes from the routes.php file
 */
$di->set('router', function () use ($config) {
    return require APPS_DIR . '/config/routes.php';
});
 
/**
 * The URL component is used to generate all kind of urls in the application
 */
$di->set('url', function () use ($config) {
    $url = new UrlResolver();
    $url->setBaseUri($config->application->publicUrl . $config->application->baseUri);
    return $url;
}, true);
 
/**
 * Setting up the view component
 */
$di->set('view', function () use ($config) {
 
    $view = new View();
 
    $view->registerEngines(['.volt' => function ($view, $di) use ($config) {
        $volt = new VoltEngine($view, $di);
        $volt->setOptions([
            'compiledPath' => CACHE_DIR . '/volt/',
            'compiledSeparator' => '_',
            'compileAlways' => (APPLICATION_ENV == 'dev') ? false : true
        ]);
        return $volt;
    }]);
 
    return $view;
}, true);
 
 
/**
 * Database connection is created based in the parameters defined in the configuration file
 */
$di->set('db', function () use ($config) {
 
    try {
 
        //    $connection = new Mysql([
        //        'host' => $config->database->host,
        //        'username' => $config->database->username,
        //        'password' => $config->database->password,
        //        'dbname' => $config->database->dbname,
        //        'charset' => $config->database->charset,
        //        'options' => [Pdo::ATTR_EMULATE_PREPARES => false]
        //    ]);
 
        $connection = new Connection(
            array(
                "host" => $config->database->host,
                "username" => $config->database->username,
                "password" => $config->database->password,
                "dbname" => $config->database->dbname,
                "charset" => $config->database->charset
            )
        );
        if (debugSQL) {
            $eventsManager = new Manager();
            $logger = new FileLogger(LOGS_DIR . '/debug.log');
            $eventsManager->attach('db', function ($event, $connection) use ($logger) {
                if ($event->getType() == 'beforeQuery') {
                    $logger->log($connection->getSQLStatement(), Logger::INFO);
                }
            });
            $connection->setEventsManager($eventsManager);
        }
 
        //    $frontCache = new Data(['lifetime' => 3600]);
        ////    $frontCache = new Data(['lifetime' => 3600]);
        //    // File backend settings
        //    $connection->setCache(new File($frontCache, ['cacheDir' => CACHE_DIR . '/db/']));
 
        return $connection;
 
    } catch (\PDOException $e) {
        throw new \PDOException("Error: " . $e->getMessage());
    }
 
});
 
if (APPLICATION_ENV == 'pro') {
    $di->set('modelsMetadata', function () use ($config) {
        return new MetaDataAdapter([
            'metaDataDir' => CACHE_DIR . '/metaData/'
        ]);
    });
}
 
/**
 * Start the session the first time some component request the session service
 */
$di->set('session', function () {
    $session = new SessionAdapter();
    $session->start();
    return $session;
});
 
$di->set('cookies', function () {
    $cookies = new Cookies();
    $cookies->useEncryption(false);
    return $cookies;
});
 
/**
 * Crypt service
 */
$di->set('crypt', function () use ($config) {
    $crypt = new Crypt();
    $crypt->setKey($config->application->cryptSalt);
    return $crypt;
});
 
$di->set('dispatcher', function () use ($di) {
 
    $evManager = $di->getShared('eventsManager');
    $evManager->attach('dispatch:beforeDispatch', new SecurityPlugin);
    $evManager->attach('dispatch:beforeException', new NotFoundPlugin);
    $evManager->attach('dispatch:beforeForward', new ForwardPlugin);
 
    $dispatcher = new Dispatcher();
 
    $dispatcher->setEventsManager($evManager);
    return $dispatcher;
}, true
);
 
 
/**
 * Flash service with custom CSS classes
 */
$di->set('flash', function () {
    return new Session([
        'success' => 'alert alert-success alert-dismissable fade in',
        'notice' => 'alert alert-info alert-dismissable fade in',
        'warning' => 'alert alert-warning alert-dismissable fade in',
        'error' => 'alert alert-danger alert-dismissable fade in'
    ]);
});
 
/**
 * Custom authentication component
 */
$di->setShared('auth', function () {
    return new Auth();
});
 
$di->setShared('utils', function () {
    return new Utils();
});
 
$di->setShared('cms', function () {
    return new CMS();
});
 
/**
 * Access Control List
 */
$di->set('acl', function () {
    return new Acl();
});
/**
 * Access Control List
 */
$di->setShared('mobiledetect', function () {
    return new \Mobile_Detect();
});
 
$di->setShared('t', function ($lang = false) use ($config, $di) {
 
    global $lang;
 
    $language = DI::getDefault()->getShared('auth')->getActiveLanguage();
    if (!$language) {
        $request = new Request();
        $lang = $request->getBestLanguage();
        if (!$lang) {
            $lang = 'es';
        }
 
        $language = Languages::findFirstByLang($lang);
        if (!$language) {
            $lang = 'es';
        } else {
            $lang = $language->lang;
        }
    } else {
        $lang = $language->lang;
    }
 
 
    return new Database([
        'db' => $di->getDefault()->getDb(),
        'table' => 'translations',
        'language' => $lang,
    ]);
});
 
$di->set('connectionPlugin', function () {
    return new ConnectionPlugin();
});
 
 
/*
 * Marcando como shared el modulo al cargalo esto deja disponibles las "cosicas"
*/
foreach ($config->modules as $module) {
    $dir = preg_replace("/\/Module.php$/", "", $module['path']);
    // Register Namespace for Shared Module (will not be called by dispatch)
    if (array_key_exists('shared', $module) && $module['shared']) {
        $namespace = preg_replace('/\\\Module$/', "", $module['className']);
        $loader->registerNamespaces(array($namespace => $dir), true);
        // Loading Module class bootloader Reflection Instance
        $reflexion = new ReflectionClass($module['className']);
        $instance = $reflexion->newInstanceWithoutConstructor();
        // Execute every 'register' methods
        foreach ($reflexion->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
            if (preg_match('/^register/', $method->name)) {
                $instance->{$method->name}($di);
            }
        }
    }
}
#6Closure->illusion\{closure}()
#7Phalcon\Di\Service->resolve(null, Object(Phalcon\Di\FactoryDefault))
#8Phalcon\Di->get(t, null)
#9Phalcon\Di->getShared(t)
#10Phalcon\Di\Injectable->__get(t)
/home/appcentroespecia/public_html/apps/modules/users/controllers/AuthController.php (26)
<?php
 
namespace illusion\Modules\Users\Controllers;
 
 
use illusion\Common\Utils\Utils;
use illusion\Modules\Users\Forms\ConfirmaccountForm;
use illusion\Modules\Users\Forms\LoginForm;
use illusion\Modules\Users\Forms\ForgotPasswordForm;
use illusion\Modules\Users\Models\PasswordChanges;
use illusion\Modules\Users\Models\Users;
use illusion\Modules\Users\Models\ResetPasswords;
use illusion\Common\Auth\Exception;
use Phalcon\Mvc\View;
use Phalcon\Mvc\Controller;
 
class AuthController extends Controller
{
 
    public function loginAction()
    {
 
        $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        $this->view->setVars(
            array(
                'pageTitle' => $this->t->_('Iniciar sesión'),
                'pageTitleSmall' => ''
            )
        );
 
 
        $form = new LoginForm();
 
        if (!$this->request->isPost()) {
            if ($this->auth->hasRememberMe()) {
                return $this->auth->loginWithRememberMe();
            }
        } else {
 
            if ($form->isValid($this->request->getPost()) == false) {
                foreach ($form->getMessages() as $message) {
                    $this->flash->error($message);
                }
            } else {
 
                try {
                    $this->auth->check(array(
                        'email' => $this->request->getPost('email', 'email'),
                        'password' => $this->request->getPost('password', 'striptags'),
                        'remember' => $this->request->getPost('remember')
                    ));
                    $this->session->remove("lock");
                    $this->session->remove("referer");
                    $url = 'core/index';
 
                    if ($this->session->has('returnTo')) {
                        $returnTo = $this->session->get('returnTo');
                        if (!strpos($returnTo, 'users/login')) {
                            $url = $returnTo;
                        }
                        $this->session->remove('returnTo');
                    }
                    return $this->response->redirect($url);
                } catch (Exception $e) {
                    $this->flash->error($e->getMessage());
                }
            }
        }
 
        $this->view->setVar('loginForm', new LoginForm());
        $this->view->setVar('forgotForm', new ForgotPasswordForm());
    }
 
    public function confirmaccountAction($code)
    {
        $user = Users::findFirstByCode($code);
 
        if (!$user) {
            $this->flash->warning($this->t->_('El enlace ha caducado, puede solicitar una recuperación de contraseña.'));
            return $this->dispatcher->forward(array(
                'module' => 'users',
                'controller' => 'auth',
                'action' => 'login'
            ));
        }
 
        if ($user->used == 'Y') {
            $this->flash->warning($this->t->_('El enlace ya ha sido utilizado, puede solicitar una recuperación de contraseña.'));
            return $this->dispatcher->forward(array(
                'module' => 'users',
                'controller' => 'auth',
                'action' => 'login'
            ));
        }
 
 
        $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        $form = new ConfirmaccountForm($user);
 
//        Utils::po($this->request->getPost());
//        die();
        if ($this->request->isPost()) {
            
            if ($form->isValid($this->request->getPost()) == false) {
                foreach ($form->getMessages() as $message) {
                    $this->flash->error($message);
                }
            } else {
                $user = Users::findFirstByHash($this->request->getPost('hash'));
                if (!$user) {
                    $this->flash->warning($this->t->_('El enlace ha caducado, puede solicitar una recuperación de contraseña.'));
                    return $this->dispatcher->forward(array(
                        'module' => 'users',
                        'controller' => 'auth',
                        'action' => 'login'
                    ));
                }
                $password = $this->request->getPost('passwordNew');
                $passwordProfesto = $this->request->getPost('pin');
 
                $user->password = $this->security->hash($password);
                $user->passwordProfesto = $this->security->hash($passwordProfesto);
 
                $passwordChange = new PasswordChanges();
                $passwordChange->user = $user;
                $passwordChange->ipAddress = $this->request->getClientAddress();
                $passwordChange->userAgent = $this->request->getUserAgent();
                $passwordChange->createdAt = date('Y-m-d H:i:s');
                $user->used = 'Y';
                $user->code = '';
 
                $user->tmpPassword = $password;
                $user->update();
 
                $this->auth->authUserById($user->id);
                $this->flash->success($this->t->_('Contraseña guardada correctamente, bienvenid@ a Profesto.'));
                return $this->response->redirect('/');
            }
        }
        $this->view->form = $form;
        $this->view->code = $code;
    }
 
}
#11illusion\Modules\Users\Controllers\AuthController->loginAction()
#12Phalcon\Dispatcher->callActionMethod(Object(illusion\Modules\Users\Controllers\AuthController), loginAction, Array())
#13Phalcon\Dispatcher->dispatch()
#14Phalcon\Mvc\Application->handle()
/home/appcentroespecia/public_html/public/index.php (49)
<?php
ini_set("session.cookie_lifetime","14400");
ini_set("session.gc_maxlifetime","14000");
 
use Phalcon\Mvc\Application;
 
error_reporting(E_ALL);
 
 
date_default_timezone_set('Europe/Madrid');
setlocale(LC_ALL, array("es_ES"));
setlocale(LC_MONETARY, 'es_ES');
 
define('debug', true);
define('debugSQL', false);
 
if (!defined('APPLICATION_ENV')) {
    define('APPLICATION_ENV', 'pro');
}
 
if (debug) {
    (new \Phalcon\Debug())->listen();
}
 
//try {
if (!defined('BASE_DIR')) {
    define('BASE_DIR', dirname(__DIR__));
}
 
include BASE_DIR . '/apps/config/constants.php';
 
include BASE_DIR . '/apps/config/c_modules.php';
 
$config = include APPS_DIR . '/config/environment/' . APPLICATION_ENV . '/base-config.php';
$ini_file = APPS_DIR . '/config/environment/' . APPLICATION_ENV . '/base-config.ini';
 
$config2 = new \Phalcon\Config\Adapter\Ini($ini_file);
 
$config->merge($config2);
 
include APPS_DIR . '/config/loader.php';
include APPS_DIR . '/config/services.php';
 
$application = new Application();
$application->setDI($di);
 
require APPS_DIR . '/config/modules.php';
 
echo $application->handle()->getContent();
 
KeyValue
_url/users/auth/login
KeyValue
CONTEXT_DOCUMENT_ROOT/home/appcentroespecia/public_html
CONTEXT_PREFIX
DOCUMENT_ROOT/home/appcentroespecia/public_html
GATEWAY_INTERFACECGI/1.1
H2PUSHoff
H2_PUSHoff
H2_PUSHED
H2_PUSHED_ON
H2_STREAM_ID11
H2_STREAM_TAG1275079-659-11
HTTP2on
HTTPSon
HTTP_ACCEPT*/*
HTTP_ACCEPT_ENCODINGgzip, br, zstd, deflate
HTTP_COOKIEPHPSESSID=caaf6c950c9a796b717a0cb293ea4753
HTTP_HOSTapp.centroespecialtutelar.es
HTTP_REFERERhttps://app.centroespecialtutelar.es/
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_X_HTTPS1
PATH/bin:/usr/bin
PHP_INI_SCAN_DIR/opt/cpanel/ea-php73/root/etc:/opt/cpanel/ea-php73/root/etc/php.d:.
QUERY_STRING_url=/users/auth/login
REDIRECT_H2PUSHoff
REDIRECT_H2_PUSHoff
REDIRECT_H2_PUSHED
REDIRECT_H2_PUSHED_ON
REDIRECT_H2_STREAM_ID11
REDIRECT_H2_STREAM_TAG1275079-659-11
REDIRECT_HTTP2on
REDIRECT_HTTPSon
REDIRECT_QUERY_STRING_url=/users/auth/login
REDIRECT_REDIRECT_H2PUSHoff
REDIRECT_REDIRECT_H2_PUSHoff
REDIRECT_REDIRECT_H2_PUSHED
REDIRECT_REDIRECT_H2_PUSHED_ON
REDIRECT_REDIRECT_H2_STREAM_ID11
REDIRECT_REDIRECT_H2_STREAM_TAG1275079-659-11
REDIRECT_REDIRECT_HTTP2on
REDIRECT_REDIRECT_HTTPSon
REDIRECT_REDIRECT_SCRIPT_URIhttps://app.centroespecialtutelar.es/users/auth/login
REDIRECT_REDIRECT_SCRIPT_URL/users/auth/login
REDIRECT_REDIRECT_SSL_TLS_SNIapp.centroespecialtutelar.es
REDIRECT_REDIRECT_STATUS200
REDIRECT_REDIRECT_UNIQUE_IDaaBdJv0A2GH4Se_GiY_kBAAAgQM
REDIRECT_SCRIPT_URIhttps://app.centroespecialtutelar.es/users/auth/login
REDIRECT_SCRIPT_URL/users/auth/login
REDIRECT_SSL_TLS_SNIapp.centroespecialtutelar.es
REDIRECT_STATUS200
REDIRECT_UNIQUE_IDaaBdJv0A2GH4Se_GiY_kBAAAgQM
REDIRECT_URL/public/users/auth/login
REMOTE_ADDR216.73.216.146
REMOTE_PORT31925
REQUEST_METHODGET
REQUEST_SCHEMEhttps
REQUEST_URI/users/auth/login
SCRIPT_FILENAME/home/appcentroespecia/public_html/public/index.php
SCRIPT_NAME/public/index.php
SCRIPT_URIhttps://app.centroespecialtutelar.es/users/auth/login
SCRIPT_URL/users/auth/login
SERVER_ADDR135.125.108.117
SERVER_ADMINwebmaster@app.centroespecialtutelar.es
SERVER_NAMEapp.centroespecialtutelar.es
SERVER_PORT443
SERVER_PROTOCOLHTTP/2.0
SERVER_SIGNATURE
SERVER_SOFTWAREApache
SSL_TLS_SNIapp.centroespecialtutelar.es
TZEurope/Madrid
UNIQUE_IDaaBdJv0A2GH4Se_GiY_kBAAAgQM
PHP_SELF/public/index.php
REQUEST_TIME_FLOAT1772117286.9385
REQUEST_TIME1772117286
argvArray([0] => _url=/users/auth/login)
argc1
#Path
0/home/appcentroespecia/public_html/public/index.php
1/home/appcentroespecia/public_html/apps/config/constants.php
2/home/appcentroespecia/public_html/apps/config/c_modules.php
3/home/appcentroespecia/public_html/apps/config/environment/pro/base-config.php
4/home/appcentroespecia/public_html/apps/config/loader.php
5/home/appcentroespecia/public_html/vendor/autoload.php
6/home/appcentroespecia/public_html/vendor/composer/autoload_real.php
7/home/appcentroespecia/public_html/vendor/composer/ClassLoader.php
8/home/appcentroespecia/public_html/vendor/composer/autoload_static.php
9/home/appcentroespecia/public_html/vendor/ralouphie/getallheaders/src/getallheaders.php
10/home/appcentroespecia/public_html/vendor/guzzlehttp/psr7/src/functions_include.php
11/home/appcentroespecia/public_html/vendor/guzzlehttp/psr7/src/functions.php
12/home/appcentroespecia/public_html/vendor/symfony/polyfill-mbstring/bootstrap.php
13/home/appcentroespecia/public_html/vendor/clue/stream-filter/src/functions_include.php
14/home/appcentroespecia/public_html/vendor/clue/stream-filter/src/functions.php
15/home/appcentroespecia/public_html/vendor/guzzlehttp/promises/src/functions_include.php
16/home/appcentroespecia/public_html/vendor/guzzlehttp/promises/src/functions.php
17/home/appcentroespecia/public_html/vendor/symfony/polyfill-ctype/bootstrap.php
18/home/appcentroespecia/public_html/vendor/guzzlehttp/guzzle/src/functions_include.php
19/home/appcentroespecia/public_html/vendor/guzzlehttp/guzzle/src/functions.php
20/home/appcentroespecia/public_html/vendor/php-http/message/src/filters.php
21/home/appcentroespecia/public_html/apps/config/services.php
22/home/appcentroespecia/public_html/apps/modules/core/Module.php
23/home/appcentroespecia/public_html/apps/common/plugins/SecurityPlugin.php
24/home/appcentroespecia/public_html/apps/common/plugins/NotFoundPlugin.php
25/home/appcentroespecia/public_html/apps/common/plugins/ForwardPlugin.php
26/home/appcentroespecia/public_html/apps/common/libraries/Auth/Auth.php
27/home/appcentroespecia/public_html/apps/modules/users/Module.php
28/home/appcentroespecia/public_html/apps/modules/app/Module.php
29/home/appcentroespecia/public_html/apps/modules/messaging/Module.php
30/home/appcentroespecia/public_html/apps/modules/cms/Module.php
31/home/appcentroespecia/public_html/apps/config/modules.php
32/home/appcentroespecia/public_html/apps/config/routes.php
33/home/appcentroespecia/public_html/apps/modules/core/routes/CoreRoutes.php
34/home/appcentroespecia/public_html/apps/modules/users/routes/UsersRoutes.php
35/home/appcentroespecia/public_html/apps/modules/app/routes/AppRoutes.php
36/home/appcentroespecia/public_html/apps/modules/messaging/routes/MessagingRoutes.php
37/home/appcentroespecia/public_html/apps/modules/cms/routes/CmsRoutes.php
38/home/appcentroespecia/public_html/apps/common/libraries/Acl/Acl.php
39/home/appcentroespecia/public_html/apps/modules/users/controllers/AuthController.php
40/home/appcentroespecia/public_html/apps/common/models/Languages.php
41/home/appcentroespecia/public_html/apps/common/models/AbstractModel.php
42/home/appcentroespecia/public_html/apps/common/traits/ModelControl.php
Memory
Usage4194304