/home/deployr/subs/apps/src/di.php
* @return \Box_Crypt
*/
$di['crypt'] = function () use ($di) {
$crypt = new Box_Crypt();
$crypt->setDi($di);
return $crypt;
};
/*
* Creates a new PDO object for database connections
*
* @param void
*
* @return PDO The PDO object used for database connections
*/
$di['pdo'] = function () {
$config = Config::getProperty('db');
$pdo = new PDO(
$config['type'] . ':host=' . $config['host'] . ';port=' . $config['port'] . ';dbname=' . $config['name'],
$config['user'],
$config['password'],
[
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]
);
if (isset($config['debug']) && $config['debug']) {
$pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, ['Box_DbLoggedPDOStatement']);
}
if ($config['type'] === 'mysql') {
$pdo->exec('SET NAMES "utf8"');
$pdo->exec('SET CHARACTER SET utf8');
$pdo->exec('SET CHARACTER_SET_CONNECTION = utf8');
$pdo->exec('SET character_set_results = utf8');
$pdo->exec('SET character_set_server = utf8');
Arguments
"SQLSTATE[HY000] [2002] No route to host"
/home/deployr/subs/apps/src/di.php
* @return \Box_Crypt
*/
$di['crypt'] = function () use ($di) {
$crypt = new Box_Crypt();
$crypt->setDi($di);
return $crypt;
};
/*
* Creates a new PDO object for database connections
*
* @param void
*
* @return PDO The PDO object used for database connections
*/
$di['pdo'] = function () {
$config = Config::getProperty('db');
$pdo = new PDO(
$config['type'] . ':host=' . $config['host'] . ';port=' . $config['port'] . ';dbname=' . $config['name'],
$config['user'],
$config['password'],
[
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]
);
if (isset($config['debug']) && $config['debug']) {
$pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, ['Box_DbLoggedPDOStatement']);
}
if ($config['type'] === 'mysql') {
$pdo->exec('SET NAMES "utf8"');
$pdo->exec('SET CHARACTER SET utf8');
$pdo->exec('SET CHARACTER_SET_CONNECTION = utf8');
$pdo->exec('SET character_set_results = utf8');
$pdo->exec('SET character_set_server = utf8');
/home/deployr/subs/apps/src/vendor/pimple/pimple/src/Pimple/Container.php
{
if (!isset($this->keys[$id])) {
throw new UnknownIdentifierException($id);
}
if (
isset($this->raw[$id])
|| !\is_object($this->values[$id])
|| isset($this->protected[$this->values[$id]])
|| !\method_exists($this->values[$id], '__invoke')
) {
return $this->values[$id];
}
if (isset($this->factories[$this->values[$id]])) {
return $this->values[$id]($this);
}
$raw = $this->values[$id];
$val = $this->values[$id] = $raw($this);
$this->raw[$id] = $raw;
$this->frozen[$id] = true;
return $val;
}
/**
* Checks if a parameter or an object is set.
*
* @param string $id The unique identifier for the parameter or object
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($id)
{
return isset($this->keys[$id]);
}
/home/deployr/subs/apps/src/di.php
* @param void
*
* @return \Box_EventManager
*/
$di['events_manager'] = function () use ($di) {
$service = new Box_EventManager();
$service->setDi($di);
return $service;
};
/*
* Creates a new session, applying specified security rules depending on the config.php settings.
*
* @param void
*
* @return \FOSSBilling\Session
*/
$di['session'] = function () use ($di) {
$handler = new PdoSessionHandler($di['pdo']);
$session = new FOSSBilling\Session($handler);
$session->setDi($di);
$session->setupSession();
return $session;
};
/*
* Creates a new request object based on the current request.
*
* @param void
*
* @link https://symfony.com/doc/current/components/http_foundation.html
*
* @return Symfony\Component\HttpFoundation\Request
*/
$di['request'] = fn (): Request => Request::createFromGlobals();
/*
* @param void
/home/deployr/subs/apps/src/vendor/pimple/pimple/src/Pimple/Container.php
{
if (!isset($this->keys[$id])) {
throw new UnknownIdentifierException($id);
}
if (
isset($this->raw[$id])
|| !\is_object($this->values[$id])
|| isset($this->protected[$this->values[$id]])
|| !\method_exists($this->values[$id], '__invoke')
) {
return $this->values[$id];
}
if (isset($this->factories[$this->values[$id]])) {
return $this->values[$id]($this);
}
$raw = $this->values[$id];
$val = $this->values[$id] = $raw($this);
$this->raw[$id] = $raw;
$this->frozen[$id] = true;
return $val;
}
/**
* Checks if a parameter or an object is set.
*
* @param string $id The unique identifier for the parameter or object
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($id)
{
return isset($this->keys[$id]);
}
/home/deployr/subs/apps/src/index.php
// Rewrite for custom pages
if (str_starts_with($url, '/page/')) {
$url = substr_replace($url, '/custompages/', 0, 6);
}
// Set the final URL
$_GET['_url'] = $url;
$http_err_code = $_GET['_errcode'] ?? null;
$debugBar['time']->startMeasure('session_start', 'Starting / restoring the session');
/*
* Workaround: Session IDs get reset when using PGs like PayPal because of the `samesite=strict` cookie attribute, resulting in the client getting logged out.
* Internally the return and cancel URLs get a restore_session GET parameter attached to them with the proper session ID to restore, so we do so here.
*/
if (!empty($_GET['restore_session'])) {
session_id($_GET['restore_session']);
}
$di['session'];
$debugBar['time']->stopMeasure('session_start');
if (strncasecmp($url, ADMIN_PREFIX, strlen(ADMIN_PREFIX)) === 0) {
define('ADMIN_AREA', true);
$appUrl = str_replace(ADMIN_PREFIX, '', preg_replace('/\?.+/', '', $url));
$app = new Box_AppAdmin([], $debugBar);
} else {
define('ADMIN_AREA', false);
$appUrl = $url;
$app = new Box_AppClient([], $debugBar);
}
$app->setUrl($appUrl);
$app->setDi($di);
$debugBar['time']->startMeasure('translate', 'Setting up translations');
$di['translate']();
$debugBar['time']->stopMeasure('translate');
// If HTTP error code has been passed, handle it.