useHtmlVarDumper(); $debugBar['messages']->useHtmlVarDumper(); $config = $di['config']; $config['info']['salt'] = '********'; $config['db'] = array_fill_keys(array_keys($config['db']), '********'); $configCollector = new \DebugBar\DataCollector\ConfigCollector($config); $configCollector->useHtmlVarDumper(); $debugBar->addCollector($configCollector); // Now move onto the actual process of setting up the app & routing $url = $_GET['_url'] ?? $_SERVER['PATH_INFO'] ?? ''; $http_err_code = $_GET['_errcode'] ?? null; if ($url === '/run-patcher') { $patcher = new FOSSBilling\UpdatePatcher(); $patcher->setDi($di); try { $patcher->applyConfigPatches(); $patcher->applyCorePatches(); $di['tools']->emptyFolder(PATH_CACHE); exit('Any missing config migrations or database patches have been applied and the cache has been cleared'); } catch (\Exception $e) { exit('An error occurred while attempting to apply patches:
' . $e->getMessage()); } } $di['session']; if (strncasecmp($url, ADMIN_PREFIX, strlen(ADMIN_PREFIX)) === 0) { $appUrl = str_replace(ADMIN_PREFIX, '', preg_replace('/\?.+/', '', $url)); $app = new Box_AppAdmin([], $debugBar); } else { $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. if (!is_null($http_err_code)) { switch ($http_err_code) { case '404': $e = new FOSSBilling\Exception('Page :url not found', [':url' => $url], 404); echo $app->show404($e); break; default: $http_err_code = intval($http_err_code); http_response_code($http_err_code); $e = new FOSSBilling\Exception('HTTP Error :err_code occurred while attempting to load :url', [':err_code' => $http_err_code, ':url' => $url], $http_err_code); echo $app->render('error', ['exception' => $e]); } exit; } // If no HTTP error passed, run the app. echo $app->run(); exit;