| #0 | ChatHispanoEngine\Core\Library\Phalcon\Session\Adapter\RedisCluster->__construct /srv/ChatHispanoEngine/releases/20250927141530/config/services.php (35) <?php
$di['config'] = $config;
$di['session'] = function () use ($di, $config) {
$env = trim(file_get_contents(__DIR__ . '/environment.txt'));
$node = trim(file_get_contents(__DIR__ . '/node.txt'));
$path = $config->session->path;
$manager = new \Phalcon\Session\Manager();
$serializer = new \Phalcon\Storage\SerializerFactory();
if ($env == 'prod' || $env == 'staging') {
$factory = new \Phalcon\Storage\AdapterFactory($serializer, [
'redisCluster' => \ChatHispanoEngine\Core\Library\Phalcon\Storage\Adapter\RedisCluster::class,
]);
$options = [
'adapter' => 'redisCluster',
'servers' => [
'10.234.60.7:6380',
'10.234.60.8:6380',
'10.234.60.9:6380',
'10.234.60.11:6380',
'10.234.60.12:6380',
'10.234.60.13:6380',
],
'persistent' => false,
'prefix' => $config->session->name . '::',
'lifetime' => 3600,
'ssl' => [
'cafile' => '/etc/ssl/chathispano_root.crt',
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
],
];
$o = new \ChatHispanoEngine\Core\Library\Phalcon\Session\Adapter\RedisCluster($factory, $options);
} else {
$factory = new \Phalcon\Storage\AdapterFactory($serializer);
$o = new \Phalcon\Session\Adapter\Redis($factory, [
'host' => '127.0.0.1',
'port' => 6379,
'uniqueId' => $config->session->name,
'ssl' => [
'cafile' => '/etc/ssl/chathispano_root.crt',
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
],
]);
}
$manager->setAdapter($o);
$manager->start();
return $manager;
};
$di['flash'] = function () {
return new \Phalcon\Flash\Direct([
'error' => 'alert alert-danger alert-dismissible fade show',
'success' => 'alert alert-success alert-dismissible fade show',
'notice' => 'alert alert-info alert-dismissible fade show',
'warning' => 'alert alert-warning alert-dismissible fade show',
]);
};
$di['flashSession'] = function () {
return new \ChatHispanoEngine\Core\Library\Flash();
};
$di['security'] = function () {
$o = new \Phalcon\Encryption\Security();
$o->setWorkFactor(12);
return $o;
};
$di['db'] = function () use ($config) {
$node = trim(file_get_contents(__DIR__ . '/node.txt'));
$conf = $config->database->toArray();
$connection = new \Phalcon\Db\Adapter\Pdo\Mysql([
'host' => $conf[$node]['host'],
'username' => $conf[$node]['username'],
'password' => $conf[$node]['password'],
'dbname' => $conf[$node]['dbname'],
'options' => [
\PDO::MYSQL_ATTR_SSL_CA => '/etc/ssl/chathispano_root.crt',
\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => true,
\PDO::ATTR_CASE => \PDO::CASE_LOWER,
],
'persistent' => true,
]);
$connection->execute('SET NAMES ' . $conf[$node]['charset']);
return $connection;
};
$di['postgresql'] = function () use ($config) {
$conf = $config->postgresql->toArray();
$connection = new \Phalcon\Db\Adapter\Pdo\Postgresql($conf);
return $connection;
};
$di['mongo'] = function () use ($config) {
try {
$mongo = new \MongoDB\Client($config->mongodb->uri, [
'tls' => true,
'tlsCAFile' => $config->mongodb->cafile,
]);
return $mongo->selectDatabase('ChatHispanoEngine');
} catch (\Exception $e) {
return;
}
};
$di['redis_cluster'] = function () use ($config) {
$node = trim(file_get_contents(__DIR__ . '/node.txt'));
$env = trim(file_get_contents(__DIR__ . '/environment.txt'));
$path = $config->session->path;
$ssl_options = [
'stream' => [
'cafile' => '/etc/ssl/chathispano_root.crt',
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
],
];
if ($env == 'dev') {
$o = new \Redis();
$o->connect($path[$node]['host'], $path[$node]['port'], 0, null, 0, 0, $ssl_options);
} else {
$o = new \RedisCluster(null, [
$path['even']['host'] . ':' . $path['even']['port'],
$path['odd']['host'] . ':' . $path['odd']['port'],
], 2.5, 2.5, false, null, $ssl_options['stream']);
}
return $o;
};
$di['url'] = function () {
return new \Phalcon\Mvc\Url();
};
$di['voltService'] = function ($view) use ($config) {
$di = $this;
$volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
$cache_dir = $config->view->cache->dir;
if (!is_dir($cache_dir)) {
mkdir($cache_dir, 0o777, true);
}
$env = trim(file_get_contents(__DIR__ . '/environment.txt'));
$volt->setOptions([
'path' => $cache_dir,
'extension' => '.compiled',
'always' => $env == 'prod' ? false : true,
]);
$compiler = $volt->getCompiler();
$compiler->addFunction('assets', function ($resolvedArgs, $exprArgs) use ($di) {
return $di->get('assets');
});
$compiler->addFunction('_t', function ($resolvedArgs, $exprArgs) use ($di) {
return '$this->translate->translate(' . $resolvedArgs . ')';
});
$compiler->addFunction('flashSession', function ($resolvedArgs, $exprArgs) use ($di) {
return '$this->flashSession->output()';
});
$compiler->addFunction('rand', function ($resolvedArgs, $exprArgs) use ($di) {
return 'rand(' . $resolvedArgs . ')';
});
$compiler->addFunction('isset', 'isset');
$compiler->addFilter('round', function ($resolvedArgs, $exprArgs) {
return 'round(' . $resolvedArgs . ', PHP_ROUND_HALF_DOWN)';
});
$compiler->addFilter('urlencode', function ($resolvedArgs, $exprArgs) {
return 'urlencode(' . $resolvedArgs . ')';
});
$compiler->addFilter('rawurlencode', function ($resolvedArgs, $exprArgs) {
return 'rawurlencode(' . $resolvedArgs . ')';
});
$compiler->addFilter('urldecode', function ($resolvedArgs, $exprArgs) {
return 'urldecode(' . $resolvedArgs . ')';
});
$compiler->addFilter('utf8encode', function ($resolvedArgs, $exprArgs) {
return 'utf8_encode(' . $resolvedArgs . ')';
});
$compiler->addFilter('utf8decode', function ($resolvedArgs, $exprArgs) {
return 'utf8_decode(' . $resolvedArgs . ')';
});
$compiler->addFilter('escapetahead', function ($resolvedArgs, $exprArgs) {
return 'str_replace(["\'","à","á","è","é","í","ò","ó","ú"], ["'","à","á","è","é","í","ò","ó","ú"], ' . $resolvedArgs . ')';
});
$compiler->addFunction('isArray', function ($resolvedArgs, $exprArgs) {
return 'is_array(' . $resolvedArgs . ')';
});
$compiler->addFunction('in_array', function ($resolvedArgs, $exprArgs) {
return 'in_array(' . $resolvedArgs . ')';
});
$compiler->addFunction('implode', function ($resolvedArgs, $exprArgs) {
return 'implode(' . $resolvedArgs . ')';
});
$compiler->addFunction('date', function ($resolvedArgs, $exprArgs) {
return 'date(' . $resolvedArgs . ')';
});
$compiler->addFunction('max', function ($resolvedArgs, $exprArgs) {
return 'max(' . $resolvedArgs . ')';
});
$compiler->addFunction('min', function ($resolvedArgs, $exprArgs) {
return 'min(' . $resolvedArgs . ')';
});
$compiler->addFunction('htmlspecialchars', function ($resolvedArgs, $exprArgs) {
return 'htmlspecialchars(' . $resolvedArgs . ')';
});
$compiler->addFunction('mb_strtolower', function ($resolvedArgs, $exprArgs) {
return 'mb_strtolower(' . $resolvedArgs . ')';
});
return $volt;
};
$di['auth'] = function () {
return new \ChatHispanoEngine\Core\Auth\Auth();
};
$di['mail'] = function () use ($di) {
return new \ChatHispanoEngine\Core\Library\Mail(
$di['redis_cluster']
);
};
$di['acl'] = function () {
return new \Phalcon\UserPlugin\Acl\Acl();
};
$di['cache'] = function () use ($di, $config) {
return new \Phalcon\Cache\Adapter\Redis(new \Phalcon\Storage\SerializerFactory(), [
'host' => '127.0.0.1',
'port' => 6379,
'prefix' => $config->session->name . '::',
]);
};
$di['modelsCache'] = function () use ($di, $config) {
$serializerFactory = new \Phalcon\Storage\SerializerFactory();
$adapterFactory = new \Phalcon\Cache\AdapterFactory($serializerFactory);
$options = [
'defaultSerializer' => 'Php',
'lifetime' => 7200,
];
$adapter = $adapterFactory->newInstance('apcu', $options);
return new \Phalcon\Cache\Cache($adapter);
};
$di['viewCache'] = $di['cache'];
$di['model_manager'] = function () {
return new \Phalcon\Mvc\Model\Manager();
};
$di['translate'] = function () use ($di, $config) {
$available = $config->i18n->available_languages->toArray();
$default = $config->i18n->default_locale;
$language = null;
if (php_sapi_name() != 'cli') {
$language = $di['session']->get('lang');
}
if (null === $language || false === $language || $language == '') {
/**
* We try to get the language from http request
* They are sort from highest priority to low priority
* so the first one we support is the one we will use.
* If none is found, the default is taken.
*/
$found = false;
if (php_sapi_name() != 'cli') {
$request = new \Phalcon\Http\Request();
$langs = $request->getLanguages();
foreach ($langs as $l) {
if (isset($available[$l['language']])) {
$language = $available[$l['language']];
$found = true;
break;
}
}
}
if (false === $found) {
$language = $default;
}
}
if (!file_exists(__DIR__ . '/../I18N/' . $language)) {
$language = $default;
}
return new \iwalkalone\Translator($available, $language, __DIR__ . '/../I18N/', $language, [
'creg',
'chan',
'nick',
'admin',
'oper',
'memo',
'clones',
'ipvirtual',
'docking',
'datacenter',
'proxyscanner',
'garbagecollector',
'wormhunter',
'ayuda',
'errmsg',
'web',
'login',
'shorten',
'foro',
'date',
'bugslayer',
]);
};
$di['logger'] = function () {
return new \iwalkalone\Logger();
};
$di['oauth2_storage'] = function () {
return new \ChatHispanoEngine\Core\Library\OAuth2\EmailStorage();
};
$di['assets'] = function () {
return new \Phalcon\Assets\Manager(new \Phalcon\Html\TagFactory(new \Phalcon\Html\Escaper()));
};
include 'managers.php';
|
| #1 | Application->{closure:/srv/ChatHispanoEngine/releases/20250927141530/config/services.php:5} |
| #2 | Phalcon\Di\Service->resolve |
| #3 | Phalcon\Di\Di->get |
| #4 | Phalcon\Di\Di->getShared |
| #5 | Phalcon\Di\Di->offsetGet /srv/ChatHispanoEngine/releases/20250927141530/config/services.php (287) <?php
$di['config'] = $config;
$di['session'] = function () use ($di, $config) {
$env = trim(file_get_contents(__DIR__ . '/environment.txt'));
$node = trim(file_get_contents(__DIR__ . '/node.txt'));
$path = $config->session->path;
$manager = new \Phalcon\Session\Manager();
$serializer = new \Phalcon\Storage\SerializerFactory();
if ($env == 'prod' || $env == 'staging') {
$factory = new \Phalcon\Storage\AdapterFactory($serializer, [
'redisCluster' => \ChatHispanoEngine\Core\Library\Phalcon\Storage\Adapter\RedisCluster::class,
]);
$options = [
'adapter' => 'redisCluster',
'servers' => [
'10.234.60.7:6380',
'10.234.60.8:6380',
'10.234.60.9:6380',
'10.234.60.11:6380',
'10.234.60.12:6380',
'10.234.60.13:6380',
],
'persistent' => false,
'prefix' => $config->session->name . '::',
'lifetime' => 3600,
'ssl' => [
'cafile' => '/etc/ssl/chathispano_root.crt',
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
],
];
$o = new \ChatHispanoEngine\Core\Library\Phalcon\Session\Adapter\RedisCluster($factory, $options);
} else {
$factory = new \Phalcon\Storage\AdapterFactory($serializer);
$o = new \Phalcon\Session\Adapter\Redis($factory, [
'host' => '127.0.0.1',
'port' => 6379,
'uniqueId' => $config->session->name,
'ssl' => [
'cafile' => '/etc/ssl/chathispano_root.crt',
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
],
]);
}
$manager->setAdapter($o);
$manager->start();
return $manager;
};
$di['flash'] = function () {
return new \Phalcon\Flash\Direct([
'error' => 'alert alert-danger alert-dismissible fade show',
'success' => 'alert alert-success alert-dismissible fade show',
'notice' => 'alert alert-info alert-dismissible fade show',
'warning' => 'alert alert-warning alert-dismissible fade show',
]);
};
$di['flashSession'] = function () {
return new \ChatHispanoEngine\Core\Library\Flash();
};
$di['security'] = function () {
$o = new \Phalcon\Encryption\Security();
$o->setWorkFactor(12);
return $o;
};
$di['db'] = function () use ($config) {
$node = trim(file_get_contents(__DIR__ . '/node.txt'));
$conf = $config->database->toArray();
$connection = new \Phalcon\Db\Adapter\Pdo\Mysql([
'host' => $conf[$node]['host'],
'username' => $conf[$node]['username'],
'password' => $conf[$node]['password'],
'dbname' => $conf[$node]['dbname'],
'options' => [
\PDO::MYSQL_ATTR_SSL_CA => '/etc/ssl/chathispano_root.crt',
\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => true,
\PDO::ATTR_CASE => \PDO::CASE_LOWER,
],
'persistent' => true,
]);
$connection->execute('SET NAMES ' . $conf[$node]['charset']);
return $connection;
};
$di['postgresql'] = function () use ($config) {
$conf = $config->postgresql->toArray();
$connection = new \Phalcon\Db\Adapter\Pdo\Postgresql($conf);
return $connection;
};
$di['mongo'] = function () use ($config) {
try {
$mongo = new \MongoDB\Client($config->mongodb->uri, [
'tls' => true,
'tlsCAFile' => $config->mongodb->cafile,
]);
return $mongo->selectDatabase('ChatHispanoEngine');
} catch (\Exception $e) {
return;
}
};
$di['redis_cluster'] = function () use ($config) {
$node = trim(file_get_contents(__DIR__ . '/node.txt'));
$env = trim(file_get_contents(__DIR__ . '/environment.txt'));
$path = $config->session->path;
$ssl_options = [
'stream' => [
'cafile' => '/etc/ssl/chathispano_root.crt',
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
],
];
if ($env == 'dev') {
$o = new \Redis();
$o->connect($path[$node]['host'], $path[$node]['port'], 0, null, 0, 0, $ssl_options);
} else {
$o = new \RedisCluster(null, [
$path['even']['host'] . ':' . $path['even']['port'],
$path['odd']['host'] . ':' . $path['odd']['port'],
], 2.5, 2.5, false, null, $ssl_options['stream']);
}
return $o;
};
$di['url'] = function () {
return new \Phalcon\Mvc\Url();
};
$di['voltService'] = function ($view) use ($config) {
$di = $this;
$volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
$cache_dir = $config->view->cache->dir;
if (!is_dir($cache_dir)) {
mkdir($cache_dir, 0o777, true);
}
$env = trim(file_get_contents(__DIR__ . '/environment.txt'));
$volt->setOptions([
'path' => $cache_dir,
'extension' => '.compiled',
'always' => $env == 'prod' ? false : true,
]);
$compiler = $volt->getCompiler();
$compiler->addFunction('assets', function ($resolvedArgs, $exprArgs) use ($di) {
return $di->get('assets');
});
$compiler->addFunction('_t', function ($resolvedArgs, $exprArgs) use ($di) {
return '$this->translate->translate(' . $resolvedArgs . ')';
});
$compiler->addFunction('flashSession', function ($resolvedArgs, $exprArgs) use ($di) {
return '$this->flashSession->output()';
});
$compiler->addFunction('rand', function ($resolvedArgs, $exprArgs) use ($di) {
return 'rand(' . $resolvedArgs . ')';
});
$compiler->addFunction('isset', 'isset');
$compiler->addFilter('round', function ($resolvedArgs, $exprArgs) {
return 'round(' . $resolvedArgs . ', PHP_ROUND_HALF_DOWN)';
});
$compiler->addFilter('urlencode', function ($resolvedArgs, $exprArgs) {
return 'urlencode(' . $resolvedArgs . ')';
});
$compiler->addFilter('rawurlencode', function ($resolvedArgs, $exprArgs) {
return 'rawurlencode(' . $resolvedArgs . ')';
});
$compiler->addFilter('urldecode', function ($resolvedArgs, $exprArgs) {
return 'urldecode(' . $resolvedArgs . ')';
});
$compiler->addFilter('utf8encode', function ($resolvedArgs, $exprArgs) {
return 'utf8_encode(' . $resolvedArgs . ')';
});
$compiler->addFilter('utf8decode', function ($resolvedArgs, $exprArgs) {
return 'utf8_decode(' . $resolvedArgs . ')';
});
$compiler->addFilter('escapetahead', function ($resolvedArgs, $exprArgs) {
return 'str_replace(["\'","à","á","è","é","í","ò","ó","ú"], ["'","à","á","è","é","í","ò","ó","ú"], ' . $resolvedArgs . ')';
});
$compiler->addFunction('isArray', function ($resolvedArgs, $exprArgs) {
return 'is_array(' . $resolvedArgs . ')';
});
$compiler->addFunction('in_array', function ($resolvedArgs, $exprArgs) {
return 'in_array(' . $resolvedArgs . ')';
});
$compiler->addFunction('implode', function ($resolvedArgs, $exprArgs) {
return 'implode(' . $resolvedArgs . ')';
});
$compiler->addFunction('date', function ($resolvedArgs, $exprArgs) {
return 'date(' . $resolvedArgs . ')';
});
$compiler->addFunction('max', function ($resolvedArgs, $exprArgs) {
return 'max(' . $resolvedArgs . ')';
});
$compiler->addFunction('min', function ($resolvedArgs, $exprArgs) {
return 'min(' . $resolvedArgs . ')';
});
$compiler->addFunction('htmlspecialchars', function ($resolvedArgs, $exprArgs) {
return 'htmlspecialchars(' . $resolvedArgs . ')';
});
$compiler->addFunction('mb_strtolower', function ($resolvedArgs, $exprArgs) {
return 'mb_strtolower(' . $resolvedArgs . ')';
});
return $volt;
};
$di['auth'] = function () {
return new \ChatHispanoEngine\Core\Auth\Auth();
};
$di['mail'] = function () use ($di) {
return new \ChatHispanoEngine\Core\Library\Mail(
$di['redis_cluster']
);
};
$di['acl'] = function () {
return new \Phalcon\UserPlugin\Acl\Acl();
};
$di['cache'] = function () use ($di, $config) {
return new \Phalcon\Cache\Adapter\Redis(new \Phalcon\Storage\SerializerFactory(), [
'host' => '127.0.0.1',
'port' => 6379,
'prefix' => $config->session->name . '::',
]);
};
$di['modelsCache'] = function () use ($di, $config) {
$serializerFactory = new \Phalcon\Storage\SerializerFactory();
$adapterFactory = new \Phalcon\Cache\AdapterFactory($serializerFactory);
$options = [
'defaultSerializer' => 'Php',
'lifetime' => 7200,
];
$adapter = $adapterFactory->newInstance('apcu', $options);
return new \Phalcon\Cache\Cache($adapter);
};
$di['viewCache'] = $di['cache'];
$di['model_manager'] = function () {
return new \Phalcon\Mvc\Model\Manager();
};
$di['translate'] = function () use ($di, $config) {
$available = $config->i18n->available_languages->toArray();
$default = $config->i18n->default_locale;
$language = null;
if (php_sapi_name() != 'cli') {
$language = $di['session']->get('lang');
}
if (null === $language || false === $language || $language == '') {
/**
* We try to get the language from http request
* They are sort from highest priority to low priority
* so the first one we support is the one we will use.
* If none is found, the default is taken.
*/
$found = false;
if (php_sapi_name() != 'cli') {
$request = new \Phalcon\Http\Request();
$langs = $request->getLanguages();
foreach ($langs as $l) {
if (isset($available[$l['language']])) {
$language = $available[$l['language']];
$found = true;
break;
}
}
}
if (false === $found) {
$language = $default;
}
}
if (!file_exists(__DIR__ . '/../I18N/' . $language)) {
$language = $default;
}
return new \iwalkalone\Translator($available, $language, __DIR__ . '/../I18N/', $language, [
'creg',
'chan',
'nick',
'admin',
'oper',
'memo',
'clones',
'ipvirtual',
'docking',
'datacenter',
'proxyscanner',
'garbagecollector',
'wormhunter',
'ayuda',
'errmsg',
'web',
'login',
'shorten',
'foro',
'date',
'bugslayer',
]);
};
$di['logger'] = function () {
return new \iwalkalone\Logger();
};
$di['oauth2_storage'] = function () {
return new \ChatHispanoEngine\Core\Library\OAuth2\EmailStorage();
};
$di['assets'] = function () {
return new \Phalcon\Assets\Manager(new \Phalcon\Html\TagFactory(new \Phalcon\Html\Escaper()));
};
include 'managers.php';
|
| #6 | Application->{closure:/srv/ChatHispanoEngine/releases/20250927141530/config/services.php:281} |
| #7 | Phalcon\Di\Service->resolve |
| #8 | Phalcon\Di\Di->get |
| #9 | Phalcon\Di\Di->getShared |
| #10 | Phalcon\Di\Injectable->__get /srv/ChatHispanoEngine/releases/20250927141530/apps/Web/Controllers/BaseController.php (145) <?php
namespace ChatHispanoEngine\Web\Controllers;
use ChatHispanoEngine\Core\Controllers\BaseController as CoreController;
use ChatHispanoEngine\Core\Library\Util;
use ChatHispanoEngine\Core\Library\Irc\IP;
use ChatHispanoEngine\Core\Models\InspIRCd\Channel;
class BaseController extends CoreController
{
protected $private_controllers = [
'profile',
];
protected $private_actions = [
'paywall' => [
'checkoutSuccessPaypal',
],
];
protected $time_start;
protected $enable_moment = false;
protected $enable_editor = false;
protected $enable_charts = false;
protected $head_title;
protected $head_suffix;
protected $meta_description;
protected $meta_site_name;
protected $meta_show_image;
protected $meta_image;
protected $meta_twitter_profile;
protected $meta_facebook_id;
protected $meta_noindex;
protected $meta_nofollow;
protected $meta_article;
protected $meta_article_tags;
protected $meta_article_section;
protected $meta_article_created;
protected $meta_article_updated;
protected $rel_canonical;
protected function getDefaultMetaTags()
{
$config = $this->getDI()->get('config');
$this->head_title = $config->seo->head_title;
$this->head_suffix = $config->seo->head_suffix;
$this->meta_description = $config->seo->meta_description;
$this->meta_site_name = $config->seo->meta_site_name;
$this->meta_show_image = true;
$this->meta_image = $config->seo->meta_image;
$this->meta_twitter_profile = $config->seo->meta_twitter_profile;
$this->meta_facebook_id = $config->seo->meta_facebook_id;
$this->meta_noindex = $this->env == 'prod' ? false : true;
$this->meta_nofollow = false;
$this->article = false;
$this->rel_canonical = 'https://'
. $this->request->getServer('SERVER_NAME')
. ($this->request->getServer('REQUEST_URI') == '/' ? '' : $this->request->getServer('REQUEST_URI'));
$controller = $this->dispatcher->getControllerName();
$action = $this->dispatcher->getActionName();
$seo = $config->seo->controllers->toArray();
if (isset($seo[$controller]) && isset($seo[$controller][$action])) {
$this->head_title = $seo[$controller][$action]['title'];
$this->meta_description = $seo[$controller][$action]['description'];
if (isset($seo[$controller][$action]['nofollow']) && true === $seo[$controller][$action]['nofollow']) {
$this->setMetaNofollow(true);
}
}
}
protected function setArticleMeta(array $meta_article_tags, $meta_article_section, $meta_article_created, $meta_article_updated)
{
$this->meta_article = true;
$this->meta_article_tags = $meta_article_tags;
$this->meta_article_section = $meta_article_section;
$this->meta_article_created = $meta_article_created;
$this->meta_article_updated = $meta_article_updated;
}
protected function setHeadTitle($head_title)
{
$this->head_title = $head_title;
}
protected function setMetaDescription($meta_description)
{
$this->meta_description = $meta_description;
}
protected function setMetaSiteName($meta_site_name)
{
$this->meta_site_name = $meta_site_name;
}
protected function setMetaImage($meta_image)
{
$this->meta_image = $meta_image;
}
protected function setMetaNofollow($meta_nofollow)
{
$this->meta_nofollow = $meta_nofollow;
}
protected function setMetaNoindex($meta_noindex)
{
$this->meta_noindex = $meta_noindex;
}
protected function setRelCanonical($rel_canonical)
{
$this->rel_canonical = $rel_canonical;
}
protected function setMetaTags()
{
$this->view->head_title = $this->head_title;
$this->view->head_suffix = $this->head_suffix;
$this->view->meta_description = $this->meta_description;
$this->view->meta_site_name = $this->meta_site_name;
$this->view->meta_show_image = $this->meta_show_image;
$this->view->meta_image = $this->meta_image;
$this->view->meta_facebook_id = $this->meta_facebook_id;
$this->view->meta_twitter_profile = $this->meta_twitter_profile;
$this->view->meta_noindex = $this->meta_noindex;
$this->view->meta_nofollow = $this->meta_nofollow;
$this->view->meta_article = $this->meta_article;
if ($this->meta_article) {
$this->view->meta_article_tags = $this->meta_article_tags;
$this->view->meta_article_section = $this->meta_article_section;
$this->view->meta_article_created = $this->meta_article_created;
$this->view->meta_article_updated = $this->meta_article_updated;
}
$this->view->rel_canonical = $this->rel_canonical;
}
public function beforeExecuteRoute($dispatcher)
{
$this->view->cdn_uri = $this->config->cdn->baseUri;
$this->translate->setDefaultDomain('web');
$controller = $this->dispatcher->getControllerName();
$action = $this->dispatcher->getActionName();
if ($controller == 'auth'
&& $action != 'session'
&& $action != 'logout'
&& $action != 'setNick'
&& $action != 'registerCompleted'
&& true === $this->auth->isUserSignedIn()) {
$this->response->redirect('');
return false;
}
$this->view->section_sex = 0;
$this->view->section_gay = 0;
$this->view->section_lesbianas = 0;
if (false === $this->auth->isUserSignedIn()
&& (in_array($controller, $this->private_controllers)
|| (isset($this->private_actions[$controller]) && in_array($action, $this->private_actions[$controller])))) {
$this->flashSession->warning($this->_t('You have to login to access to this module.'));
$this->response->redirect('auth/login');
$this->session->set('web_redirect_after_login', $this->request->getQuery('_url'));
$dispatcher->forward([
'controller' => 'auth',
'action' => 'login',
]);
return false;
}
if ($controller == 'auth') {
$redir = $this->request->getQuery('redir', 'string', '');
if ($redir != '') {
if ($action == 'login') {
$this->session->set('web_redirect_after_login', $redir);
$this->session->remove('web_redirect_after_register');
} elseif ($action == 'register') {
$this->session->remove('web_redirect_after_login');
$this->session->set('web_redirect_after_register', $redir);
}
}
}
/*
* Getting environment and common template variables
*/
$this->getEnvironment();
/*
* Building assets
*/
if ($controller == 'webchat') {
$this->buildWebchatAssets();
} else {
$this->buildAssets();
}
if ($this->auth->isUserSignedIn() || $this->auth->checkAuthCookie()) {
$this->view->loggedIn = true;
$this->view->identity = $this->auth->syncIdentity();
$identity = $this->auth->getIdentity();
$this->view->loggedInUser = $this->getDI()->get('user_manager')->getByEmail($identity['email']);
$this->view->hasPremium = $this->view->loggedInUser->hasSubscriptionType('premium');
if ($this->view->hasPremium) {
$s = $this->view->loggedInUser->getSubscriptionType('premium');
if ($s->getSettings()['status'] == 'enabled') {
$this->view->premiumSubscription = $s->getPlan()->getSlug();
} else {
$this->view->hasPremium = false;
$this->view->premiumSubscription = false;
}
} else {
$this->view->premiumSubscription = false;
}
} else {
$this->view->loggedIn = false;
$this->view->hasPremium = false;
}
$this->getDefaultMetaTags();
$this->view->rating_avg = 4.9;
$this->view->rating_best = 5;
$this->view->rating_total = 5982;
$this->view->client_ip = $this->request->getClientAddress();
$this->view->client_real_ip = $this->request->getClientAddress(true);
try {
$this->view->gline = $this->getDI()->get('inspircd_gline_manager')->findActiveByIp($this->view->client_real_ip);
} catch (\Exception $e) {
}
$this->view->controller = $controller;
$this->view->action = $action;
$this->view->backLink = $this->request->getServer('HTTP_REFERER');
$this->view->baseUri = $this->config->application->baseUri;
$queryString = $_SERVER['QUERY_STRING'] ?? '/';
$this->view->fullUri = $this->config->application->baseUri . substr($queryString, 1);
$this->view->supportUri = $this->config->application->supportUri;
$this->view->locale = $this->translate->getLanguage();
$this->view->chatmovilUri = $this->config->application->chatmovilUri;
$this->view->kiwiUri = $this->config->application->kiwiUri;
$this->view->current_year = date('Y');
$this->view->facebook_app_id = $this->config->facebook->app_id;
/**
* Random channel datasheets
*/
$this->view->random_channels = $this->getDI()->get('inspircd_channel_manager')->getRandomDatasheets(3);
// Special content type in utils controller
if ($this->view->controller == 'utils') {
if ($this->view->action == 'sitemap') {
$this->response->setHeader('Content-Type', 'text/xml; charset=utf-8');
} else {
$this->response->setHeader('Content-Type', 'text/plain; charset=utf-8');
}
} else {
$this->response->setHeader('Content-Type', 'text/html; charset=utf-8');
}
$this->view->cdnUri = $this->config->cdn->baseUri;
// Ads config
$this->view->ads_revive_enabled = false;
if ($this->view->controller == 'stats' || ($this->view->controller == 'channel' && $this->view->action == 'stats') || $this->view->controller == 'stories') {
$this->view->ads_revive_enabled = true;
}
$this->view->ads_onnetwork_enabled = true;
// Always disabled
$this->view->ads_optimanetwork_enabled = false;
$this->view->refinery89_enabled = false;
// Vivelavita ads
$this->view->vivelavita = $this->getDI()->get('vivelavita_manager');
// Detect crawlers
if ($this->env == 'prod') {
$crawler_detector = new \Jaybizzle\CrawlerDetect\CrawlerDetect();
if ($crawler_detector->isCrawler()) {
$this->view->ads_onnetwork_enabled = false;
$this->view->ads_revive_enabled = true;
} else {
// Detect HOSTING / VPN
$irc_manager = $this->getDI()->get('inspircd_irc_manager');
$geo = $irc_manager->get_geoip($this->request->getClientAddress(true));
$continents = ['OC', 'AS', 'AF'];
if ($geo && is_array($geo) && ($geo['proxy'] || $geo['hosting'] || in_array($geo['continent_code'], $continents))) {
$this->view->ads_onnetwork_enabled = false;
$this->view->ads_revive_enabled = true;
} elseif (!$geo || !is_array($geo)) {
$this->view->ads_onnetwork_enabled = false;
$this->view->ads_revive_enabled = true;
}
}
}
// We add this to make revive work
if (true === $this->view->ads_revive_enabled) {
$this->response->setHeader('Access-Control-Allow-Origin', $this->request->getHTTPReferer());
}
// Wechat version
$this->view->enable_element = $this->config->webchat->enable_element;
// Underage wall
$underage_wall_exceptions = [
'/condiciones',
'/lopd',
'/normas/politica-de-cookies',
'/contactar',
'/quejas',
'/ayuda',
];
foreach ($underage_wall_exceptions as $uri) {
if (str_starts_with($_SERVER['REQUEST_URI'], $uri)) {
$this->view->disable_underage_wall = 1;
break;
}
}
// Paywall promo
$promo_enabled = $this->config->paywall->promo->enabled;
$promo_start_time = $this->config->paywall->promo->start_time;
$promo_end_time = $this->config->paywall->promo->end_time;
$this->view->paywall_promo_enabled = $promo_enabled && time() >= strtotime($promo_start_time) && time() <= strtotime($promo_end_time);
$this->view->paywall_promo_image = $this->config->paywall->promo->image;
$this->view->paywall_promo_button_link = $this->config->paywall->promo->button_link;
$this->view->paywall_promo_keyword_header = $this->_t($this->config->paywall->promo->keyword_header);
$this->view->paywall_promo_keyword_description = $this->_t($this->config->paywall->promo->keyword_description);
}
public function afterExecuteRoute($dispatcher)
{
$this->view->enable_moment = $this->enable_moment;
$this->view->enable_charts = $this->enable_charts;
$this->view->enable_editor = $this->enable_editor;
/*
* Default META tags
*/
$this->setMetaTags();
}
public function goToLastPage()
{
$this->response->redirect($this->request->getServer('HTTP_REFERER'));
}
/**
* Translator.
*
* @param string $message
*/
protected function _t($message, $vars = null)
{
return $this->translate->translate($message, $vars, 'web');
}
protected function buildResponse()
{
$response = (new \Phalcon\Http\Response())
->setStatusCode(200, 'OK')
->setHeader('Access-Control-Allow-Headers', 'X-Requested-With');
return $response;
}
protected function checkSection($section)
{
$sex = 0;
$gay = 0;
$lesbianas = 0;
switch ($section) {
case 'ADU':
$sex = 1;
break;
case 'LES':
$lesbianas = 1;
break;
case 'GAY':
$gay = 1;
break;
default:
break;
}
$this->view->section_sex = $sex;
$this->view->section_gay = $gay;
$this->view->section_lesbianas = $lesbianas;
}
protected function checkChannelSection(Channel $channel)
{
/**
* Getting section to know if it is a sex/gay/lesb channel or not
* to put different ad zones (#1471)
*/
$lesbianas = 0;
$gay = 0;
$sex = 0;
if ($channel) {
$options = $channel->getOptions();
if ($options['noads'] == 1 || $options['noads'] == '1') {
/**
* If ads are manually disabled, we mark as adults to avoid showing ads
*/
$sex = 1;
} else {
try {
$section = $channel->getSectionObj();
if ($section) {
switch ($section->getCode()) {
case 'ADU':
$sex = 1;
break;
case 'LES':
$lesbianas = 1;
break;
case 'GAY':
$gay = 1;
break;
default:
break;
}
} else {
$debug_channel = $this->config->irc->opers_channel;
$irc_manager = $this->getDI()->get('inspircd_irc_manager');
$irc_manager->privmsgOrderEnqueue('AAAAAA', $debug_channel, "El canal\x02 " . $channel->getName() . "\x02 no tiene sección en la BBDD");
$sex = 1;
}
} catch (\Exception $e) {
/**
* If we catch an error getting section, we avoid ads
*/
$sex = 1;
}
}
} else {
/**
* If there is no channel, we avoid ads
*/
$sex = 1;
}
$this->view->section_sex = $sex;
$this->view->section_gay = $gay;
$this->view->section_lesbianas = $lesbianas;
}
protected function buildWebchatAssets()
{
$this->assets->collection('webchatCss')
->addInlineCss(file_get_contents(__DIR__ . '/../../../public/assets/compiled/webchatCss.min.css'));
$this->assets->collection('webchatJs')
->addInlineJs(file_get_contents(__DIR__ . '/../../../public/assets/compiled/webchatJs.min.js'));
$this->assets->collection('wpluginJs')
->addInlineJs(file_get_contents(__DIR__ . '/../../../public/assets/compiled/wpluginJs.min.js'));
}
protected function buildAssets()
{
$this->assets->collection('headerCss')
->addInlineCss(file_get_contents(__DIR__ . '/../../../public/assets/compiled/headerCss.min.css'));
$this->assets->collection('mainJs')
->addInlineJs(file_get_contents(__DIR__ . '/../../../public/assets/compiled/mainJs.min.js'));
$this->assets->collection('pluginJs')
->addInlineJs(file_get_contents(__DIR__ . '/../../../public/assets/compiled/pluginJs.min.js'));
if ($this->enable_moment === true) {
$this->assets->collection('momentJs')
->addInlineJs(file_get_contents(__DIR__ . '/../../../public/assets/compiled/momentJs.min.js'));
}
if ($this->enable_charts === true) {
$this->assets->collection('chartJs')
->addInlineJs(file_get_contents(__DIR__ . '/../../../public/assets/compiled/chartJs.min.js'));
}
if ($this->enable_editor === true) {
$baseUri = $this->config->application->baseUri;
$this->assets->collection('ckeditorJs')
->addJs('assets/web/plugins/ckeditor/ckeditor.js')
->addJs('assets/web/plugins/ckeditor/lang/en.js')
->addJs('assets/web/plugins/ckeditor/lang/es.js')
->addJs('assets/web/plugins/ckeditor/lang/ca.js')
->addJs('assets/web/js/ckeditor/youtube/plugin.js')
->addJs('assets/web/js/ckeditor/youtube/lang/en.js')
->addJs('assets/web/js/ckeditor/youtube/lang/es.js');
}
}
}
|
| #11 | ChatHispanoEngine\Web\Controllers\BaseController->beforeExecuteRoute |
| #12 | Phalcon\Dispatcher\AbstractDispatcher->dispatch |
| #13 | Phalcon\Mvc\Application->handle /srv/ChatHispanoEngine/releases/20250927141530/apps/Application.php (150) <?php
// namespace ChatHispanoEngine;
/**
* Application driver class to initialize Phalcon and
* other resources.
*/
class Application extends \Phalcon\Mvc\Application
{
private static $mode = 'dev';
private static $DEFAULT_MODULE = 'api';
public const MODE_PRODUCTION = 'prod';
public const MODE_STAGING = 'staging';
public const MODE_TEST = 'test';
public const MODE_DEVELOPMENT = 'dev';
/**
* Set application mode and error reporting level.
*/
public function __construct($defaultModule, $env = 'dev')
{
$this->modules = array(
'core' => array(
'className' => 'ChatHispanoEngine\Core\Module',
'path' => __DIR__.'/Core/Module.php',
),
'api' => array(
'className' => 'ChatHispanoEngine\Api\Module',
'path' => __DIR__.'/Api/Module.php',
),
'login' => array(
'className' => 'ChatHispanoEngine\Login\Module',
'path' => __DIR__.'/Login/Module.php',
),
'oidc' => array(
'className' => 'ChatHispanoEngine\Oidc\Module',
'path' => __DIR__.'/Oidc/Module.php',
),
'web' => array(
'className' => 'ChatHispanoEngine\Web\Module',
'path' => __DIR__.'/Web/Module.php',
),
'backoffice' => array(
'className' => 'ChatHispanoEngine\Backoffice\Module',
'path' => __DIR__.'/Backoffice/Module.php',
),
'movil' => array(
'className' => 'ChatHispanoEngine\Movil\Module',
'path' => __DIR__.'/Movil/Module.php',
),
'regwebexternal' => array(
'className' => 'ChatHispanoEngine\RegWebExternal\Module',
'path' => __DIR__.'/Regwebexternal/Module.php',
),
'cdn' => array(
'className' => 'ChatHispanoEngine\Cdn\Module',
'path' => __DIR__.'/Cdn/Module.php',
),
'shorten' => array(
'className' => 'ChatHispanoEngine\Shorten\Module',
'path' => __DIR__.'/Shorten/Module.php',
),
);
static::$DEFAULT_MODULE = $defaultModule;
self::$mode = $env;
self::$mode = trim(file_get_contents(__DIR__.'/../config/environment.txt'));
define('ENVIRONMENT', self::$mode);
if (!defined('PHALCON_MODE')) {
$mode = getenv('PHALCON_MODE');
$mode = $mode ? $mode : self::$mode;
define('PHALCON_MODE', $mode);
}
switch (self::getMode()) {
case self::MODE_PRODUCTION:
case self::MODE_STAGING:
error_reporting(0);
break;
case self::MODE_TEST:
case self::MODE_DEVELOPMENT:
ini_set('display_errors', 'On');
error_reporting(E_ALL);
break;
}
}
/**
* Register the services here to make them general or register in
* the ModuleDefinition to make them module-specific.
*/
protected function _registerServices()
{
$defaultModule = self::$DEFAULT_MODULE;
$modules = $this->modules;
$config = include __DIR__.'/../config/config.php';
$env_config = include __DIR__.'/../config/config_'.ENVIRONMENT.'.php';
$config->merge($env_config);
$di = new \Phalcon\DI\FactoryDefault();
include __DIR__.'/../config/loader.php';
include __DIR__.'/../config/services.php';
include __DIR__.'/../config/routing.php';
$this->setDI($di);
}
/**
* Run the application.
*/
public function main()
{
if (static::MODE_PRODUCTION === static::getMode()) {
$this->mainProd();
} else {
$this->mainDev();
}
}
private function getRequestUri()
{
if (!isset($_SERVER)) {
return "/";
}
if (!is_array($_SERVER)) {
return "/";
}
if (!isset($_SERVER['REQUEST_URI'])) {
return "/";
}
return $_SERVER['REQUEST_URI'];
}
/**
* Run the development environment.
*/
private function mainDev()
{
(new \Phalcon\Support\Debug())->listen();
$this->_registerServices();
$this->registerModules($this->modules);
$response = $this->handle($this->getRequestUri());
$response->send();
}
/**
* Run the production environment.
*/
private function mainProd()
{
try {
$this->registerModules($this->modules);
$this->_registerServices();
$response = $this->handle($this->getRequestUri());
$response->send();
} catch (\Exception $e) {
$logger = new \Phalcon\Logger\Adapter\Stream(__DIR__.'/../logs/'.date('Y-m-d').'.log');
$msg = "[".$_SERVER['SERVER_NAME']."] [".$_SERVER['REQUEST_URI']."] [".$e->getCode()."] ".$e->getMessage()." at ".$e->getFile()." (".$e->getLine().")";
$msg .= "\n".$e->getTraceAsString();
$logger->process(new \Phalcon\Logger\Item($msg, "error", 100));
$logger->close();
// remove view contents from buffer
ob_clean();
$errorCode = 500;
$errorView = __DIR__.'/../public/errors/error.html';
if (401 === $e->getCode()) {
// 401 UNAUTHORIZED
$errorCode = 401;
} elseif (403 === $e->getCode()) {
// 403 FORBIDDEN
$errorCode = 403;
} elseif (404 === $e->getCode()
|| $e instanceof Phalcon\Mvc\View\Exception
|| $e instanceof Phalcon\Mvc\Dispatcher\Exception) {
// 404 NOT FOUND
$errorCode = 404;
}
// Get error view contents. Since we are including the view
// file here you can use PHP and local vars inside the error view.
ob_start();
include_once $errorView;
$contents = ob_get_contents();
ob_end_clean();
// send view to header
$response = $this->getDI()->getShared('response');
$response->resetHeaders()
->setStatusCode($errorCode, null)
->setContent($contents)
->send()
;
/**
* We try to register in MongoDB the error to be able to
* track it in backoffice and/or receive emails
*/
try {
$system_log_manager = $this->getDI()->get('system_log_manager');
if ($errorCode == 500) {
$system_log_manager->createError([
'ip' => $_SERVER['SERVER_ADDR'],
'host' => $_SERVER['SERVER_NAME'],
'process' => 'php-fpm',
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
]);
} else {
$system_log_manager->createWarning([
'ip' => $_SERVER['SERVER_ADDR'],
'host' => $_SERVER['SERVER_NAME'],
'process' => 'php-fpm',
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
]);
}
} catch (\Exception $e) {
}
}
}
public function slowLog($t)
{
$config = $this->getDI()->get('config');
$irc_manager = $this->getDI()->get('inspircd_irc_manager');
$server = gethostname() ? gethostname() : 'unknown';
$uri = "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
if (substr($_SERVER['REQUEST_URI'], 0, 10) == '/historias') {
return;
}
$msg = "\x02[SLOWLOG] [".str_pad($server, 6, " ", STR_PAD_LEFT)."] [".str_pad(round($t, 1), 5, " ", STR_PAD_LEFT)."s] PATH=\x02 ".$_SERVER['REQUEST_URI']
."\x02 TYPE=\x02 ".$_SERVER['REQUEST_METHOD']."\x02 URI=\x02 ".$uri;
$irc_manager->privmsgOrderEnqueue('AAAAAI', $config->irc->debug_channel, $msg);
}
/**
* Get the current mode.
*
* @return string
*/
public static function getMode()
{
return self::$mode;
}
}
|
| #14 | Application->mainDev /srv/ChatHispanoEngine/releases/20250927141530/apps/Application.php (122) <?php
// namespace ChatHispanoEngine;
/**
* Application driver class to initialize Phalcon and
* other resources.
*/
class Application extends \Phalcon\Mvc\Application
{
private static $mode = 'dev';
private static $DEFAULT_MODULE = 'api';
public const MODE_PRODUCTION = 'prod';
public const MODE_STAGING = 'staging';
public const MODE_TEST = 'test';
public const MODE_DEVELOPMENT = 'dev';
/**
* Set application mode and error reporting level.
*/
public function __construct($defaultModule, $env = 'dev')
{
$this->modules = array(
'core' => array(
'className' => 'ChatHispanoEngine\Core\Module',
'path' => __DIR__.'/Core/Module.php',
),
'api' => array(
'className' => 'ChatHispanoEngine\Api\Module',
'path' => __DIR__.'/Api/Module.php',
),
'login' => array(
'className' => 'ChatHispanoEngine\Login\Module',
'path' => __DIR__.'/Login/Module.php',
),
'oidc' => array(
'className' => 'ChatHispanoEngine\Oidc\Module',
'path' => __DIR__.'/Oidc/Module.php',
),
'web' => array(
'className' => 'ChatHispanoEngine\Web\Module',
'path' => __DIR__.'/Web/Module.php',
),
'backoffice' => array(
'className' => 'ChatHispanoEngine\Backoffice\Module',
'path' => __DIR__.'/Backoffice/Module.php',
),
'movil' => array(
'className' => 'ChatHispanoEngine\Movil\Module',
'path' => __DIR__.'/Movil/Module.php',
),
'regwebexternal' => array(
'className' => 'ChatHispanoEngine\RegWebExternal\Module',
'path' => __DIR__.'/Regwebexternal/Module.php',
),
'cdn' => array(
'className' => 'ChatHispanoEngine\Cdn\Module',
'path' => __DIR__.'/Cdn/Module.php',
),
'shorten' => array(
'className' => 'ChatHispanoEngine\Shorten\Module',
'path' => __DIR__.'/Shorten/Module.php',
),
);
static::$DEFAULT_MODULE = $defaultModule;
self::$mode = $env;
self::$mode = trim(file_get_contents(__DIR__.'/../config/environment.txt'));
define('ENVIRONMENT', self::$mode);
if (!defined('PHALCON_MODE')) {
$mode = getenv('PHALCON_MODE');
$mode = $mode ? $mode : self::$mode;
define('PHALCON_MODE', $mode);
}
switch (self::getMode()) {
case self::MODE_PRODUCTION:
case self::MODE_STAGING:
error_reporting(0);
break;
case self::MODE_TEST:
case self::MODE_DEVELOPMENT:
ini_set('display_errors', 'On');
error_reporting(E_ALL);
break;
}
}
/**
* Register the services here to make them general or register in
* the ModuleDefinition to make them module-specific.
*/
protected function _registerServices()
{
$defaultModule = self::$DEFAULT_MODULE;
$modules = $this->modules;
$config = include __DIR__.'/../config/config.php';
$env_config = include __DIR__.'/../config/config_'.ENVIRONMENT.'.php';
$config->merge($env_config);
$di = new \Phalcon\DI\FactoryDefault();
include __DIR__.'/../config/loader.php';
include __DIR__.'/../config/services.php';
include __DIR__.'/../config/routing.php';
$this->setDI($di);
}
/**
* Run the application.
*/
public function main()
{
if (static::MODE_PRODUCTION === static::getMode()) {
$this->mainProd();
} else {
$this->mainDev();
}
}
private function getRequestUri()
{
if (!isset($_SERVER)) {
return "/";
}
if (!is_array($_SERVER)) {
return "/";
}
if (!isset($_SERVER['REQUEST_URI'])) {
return "/";
}
return $_SERVER['REQUEST_URI'];
}
/**
* Run the development environment.
*/
private function mainDev()
{
(new \Phalcon\Support\Debug())->listen();
$this->_registerServices();
$this->registerModules($this->modules);
$response = $this->handle($this->getRequestUri());
$response->send();
}
/**
* Run the production environment.
*/
private function mainProd()
{
try {
$this->registerModules($this->modules);
$this->_registerServices();
$response = $this->handle($this->getRequestUri());
$response->send();
} catch (\Exception $e) {
$logger = new \Phalcon\Logger\Adapter\Stream(__DIR__.'/../logs/'.date('Y-m-d').'.log');
$msg = "[".$_SERVER['SERVER_NAME']."] [".$_SERVER['REQUEST_URI']."] [".$e->getCode()."] ".$e->getMessage()." at ".$e->getFile()." (".$e->getLine().")";
$msg .= "\n".$e->getTraceAsString();
$logger->process(new \Phalcon\Logger\Item($msg, "error", 100));
$logger->close();
// remove view contents from buffer
ob_clean();
$errorCode = 500;
$errorView = __DIR__.'/../public/errors/error.html';
if (401 === $e->getCode()) {
// 401 UNAUTHORIZED
$errorCode = 401;
} elseif (403 === $e->getCode()) {
// 403 FORBIDDEN
$errorCode = 403;
} elseif (404 === $e->getCode()
|| $e instanceof Phalcon\Mvc\View\Exception
|| $e instanceof Phalcon\Mvc\Dispatcher\Exception) {
// 404 NOT FOUND
$errorCode = 404;
}
// Get error view contents. Since we are including the view
// file here you can use PHP and local vars inside the error view.
ob_start();
include_once $errorView;
$contents = ob_get_contents();
ob_end_clean();
// send view to header
$response = $this->getDI()->getShared('response');
$response->resetHeaders()
->setStatusCode($errorCode, null)
->setContent($contents)
->send()
;
/**
* We try to register in MongoDB the error to be able to
* track it in backoffice and/or receive emails
*/
try {
$system_log_manager = $this->getDI()->get('system_log_manager');
if ($errorCode == 500) {
$system_log_manager->createError([
'ip' => $_SERVER['SERVER_ADDR'],
'host' => $_SERVER['SERVER_NAME'],
'process' => 'php-fpm',
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
]);
} else {
$system_log_manager->createWarning([
'ip' => $_SERVER['SERVER_ADDR'],
'host' => $_SERVER['SERVER_NAME'],
'process' => 'php-fpm',
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
]);
}
} catch (\Exception $e) {
}
}
}
public function slowLog($t)
{
$config = $this->getDI()->get('config');
$irc_manager = $this->getDI()->get('inspircd_irc_manager');
$server = gethostname() ? gethostname() : 'unknown';
$uri = "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
if (substr($_SERVER['REQUEST_URI'], 0, 10) == '/historias') {
return;
}
$msg = "\x02[SLOWLOG] [".str_pad($server, 6, " ", STR_PAD_LEFT)."] [".str_pad(round($t, 1), 5, " ", STR_PAD_LEFT)."s] PATH=\x02 ".$_SERVER['REQUEST_URI']
."\x02 TYPE=\x02 ".$_SERVER['REQUEST_METHOD']."\x02 URI=\x02 ".$uri;
$irc_manager->privmsgOrderEnqueue('AAAAAI', $config->irc->debug_channel, $msg);
}
/**
* Get the current mode.
*
* @return string
*/
public static function getMode()
{
return self::$mode;
}
}
|
| #15 | Application->main /srv/ChatHispanoEngine/releases/20250927141530/public/index.php (13) <?php
date_default_timezone_set('Europe/Madrid');
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../apps/Application.php';
if (isset($_SERVER['PHALCON_APP'])) {
$app = new Application($_SERVER['PHALCON_APP']);
} else {
$app = new Application('web');
}
$app->main();
try {
$t = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"];
if ($t > 6) {
$app->slowLog($t);
}
} catch (\Exception $e) {
}
|
| Key | Value |
|---|---|
| _url | /historias/camelot/2024-04-02/660c9d7ed357fb2fc40b6130/dislike |
| Key | Value |
|---|---|
| USER | www-data |
| HOME | /var/www |
| HTTP_CONNECTION | close |
| HTTP_X_FORWARDED_FOR | 216.73.216.242 |
| HTTP_X_FORWARDED_PROTO | http |
| HTTP_ACCEPT_ENCODING | gzip, br, zstd, deflate |
| HTTP_USER_AGENT | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com) |
| HTTP_ACCEPT | */* |
| DISABLE_ANTEVENIO | 0 |
| DISABLE_MOBUSI | 0 |
| DISABLE_MASSARIUS | 0 |
| DISABLE_RELATEDCONTENT | 0 |
| DISABLE_ADSENSE | 0 |
| ADS_DEFER | 0 |
| PHALCON_APP | web |
| CHATHISPANOENGINE_REVISION | development |
| CHATHISPANOENGINE_INSTANCE | virtualbox |
| SCRIPT_FILENAME | /srv/ChatHispanoEngine/releases/20250927141530/public/index.php |
| PATH_TRANSLATED | /srv/ChatHispanoEngine/current/public |
| PATH_INFO | |
| HTTP_HOST | test.chathispano.com |
| REDIRECT_STATUS | 200 |
| SERVER_NAME | test.chathispano.com |
| SERVER_PORT | 80 |
| SERVER_ADDR | 10.234.61.101 |
| REMOTE_USER | |
| REMOTE_PORT | 42292 |
| REMOTE_ADDR | 10.234.61.154 |
| SERVER_SOFTWARE | nginx/1.26.3 |
| GATEWAY_INTERFACE | CGI/1.1 |
| REQUEST_SCHEME | http |
| SERVER_PROTOCOL | HTTP/1.1 |
| DOCUMENT_ROOT | /srv/ChatHispanoEngine/releases/20250927141530/public |
| DOCUMENT_URI | /index.php |
| REQUEST_URI | /historias/camelot/2024-04-02/660c9d7ed357fb2fc40b6130/dislike |
| SCRIPT_NAME | /index.php |
| CONTENT_LENGTH | |
| CONTENT_TYPE | |
| REQUEST_METHOD | GET |
| QUERY_STRING | _url=/historias/camelot/2024-04-02/660c9d7ed357fb2fc40b6130/dislike |
| FCGI_ROLE | RESPONDER |
| PHP_SELF | /index.php |
| REQUEST_TIME_FLOAT | 1783464705.6826 |
| REQUEST_TIME | 1783464705 |
| # | Path |
|---|---|
| 0 | /srv/ChatHispanoEngine/releases/20250927141530/public/index.php |
| 1 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/autoload.php |
| 2 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/composer/autoload_real.php |
| 3 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/composer/platform_check.php |
| 4 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/composer/ClassLoader.php |
| 5 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/composer/include_paths.php |
| 6 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/composer/autoload_static.php |
| 7 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-mbstring/bootstrap.php |
| 8 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-mbstring/bootstrap80.php |
| 9 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/deprecation-contracts/function.php |
| 10 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/amphp/amp/lib/functions.php |
| 11 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/amphp/amp/lib/Internal/functions.php |
| 12 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/react/promise/src/functions_include.php |
| 13 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/react/promise/src/functions.php |
| 14 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-ctype/bootstrap.php |
| 15 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-ctype/bootstrap80.php |
| 16 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-intl-normalizer/bootstrap.php |
| 17 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-intl-normalizer/bootstrap80.php |
| 18 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-php85/bootstrap.php |
| 19 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-php85/bootstrap80.php |
| 20 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-php84/bootstrap.php |
| 21 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-intl-grapheme/bootstrap.php |
| 22 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-intl-grapheme/bootstrap80.php |
| 23 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/amphp/byte-stream/lib/functions.php |
| 24 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/illuminate/collections/functions.php |
| 25 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/illuminate/collections/helpers.php |
| 26 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/string/Resources/functions.php |
| 27 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php |
| 28 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/ralouphie/getallheaders/src/getallheaders.php |
| 29 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php |
| 30 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/clock/Resources/now.php |
| 31 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-intl-idn/bootstrap.php |
| 32 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/translation/Resources/functions.php |
| 33 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/var-dumper/Resources/functions/dump.php |
| 34 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/guzzlehttp/guzzle/src/functions_include.php |
| 35 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/guzzlehttp/guzzle/src/functions.php |
| 36 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-php80/bootstrap.php |
| 37 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/amphp/process/lib/functions.php |
| 38 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/amphp/serialization/src/functions.php |
| 39 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/amphp/sync/src/functions.php |
| 40 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/amphp/sync/src/ConcurrentIterator/functions.php |
| 41 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/illuminate/reflection/helpers.php |
| 42 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/psy/psysh/src/functions.php |
| 43 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/daverandom/libdns/src/functions.php |
| 44 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/illuminate/support/functions.php |
| 45 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/illuminate/support/helpers.php |
| 46 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/symfony/polyfill-php81/bootstrap.php |
| 47 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/amphp/dns/lib/functions.php |
| 48 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/codeception/codeception/functions.php |
| 49 | /srv/ChatHispanoEngine/releases/20250927141530/vendor/mongodb/mongodb/src/functions.php |
| 50 | /srv/ChatHispanoEngine/releases/20250927141530/apps/Application.php |
| 51 | /srv/ChatHispanoEngine/releases/20250927141530/config/config.php |
| 52 | /srv/ChatHispanoEngine/releases/20250927141530/config/config_staging.php |
| 53 | /srv/ChatHispanoEngine/releases/20250927141530/config/loader.php |
| 54 | /srv/ChatHispanoEngine/releases/20250927141530/config/services.php |
| 55 | /srv/ChatHispanoEngine/releases/20250927141530/config/managers.php |
| 56 | /srv/ChatHispanoEngine/releases/20250927141530/config/routing.php |
| 57 | /srv/ChatHispanoEngine/releases/20250927141530/apps/Web/config/routing.php |
| 58 | /srv/ChatHispanoEngine/releases/20250927141530/apps/Web/Module.php |
| 59 | /srv/ChatHispanoEngine/releases/20250927141530/apps/Web/config/config.php |
| 60 | /srv/ChatHispanoEngine/releases/20250927141530/apps/Web/config/services.php |
| 61 | /srv/ChatHispanoEngine/releases/20250927141530/apps/Web/config/managers.php |
| 62 | /srv/ChatHispanoEngine/releases/20250927141530/apps/Web/Controllers/StoriesController.php |
| 63 | /srv/ChatHispanoEngine/releases/20250927141530/apps/Web/Controllers/BaseController.php |
| 64 | /srv/ChatHispanoEngine/releases/20250927141530/apps/Core/Controllers/BaseController.php |
| 65 | /srv/ChatHispanoEngine/releases/20250927141530/apps/Core/Library/Phalcon/Session/Adapter/RedisCluster.php |
| 66 | /srv/ChatHispanoEngine/releases/20250927141530/apps/Core/Library/Phalcon/Storage/Adapter/RedisCluster.php |
| Memory | |
|---|---|
| Usage | 2097152 |