Move PHP and config init to dedicated file

in order to keep index.php as minimal as possible
This commit is contained in:
ArthurHoaro 2020-07-22 18:12:10 +02:00
parent a8c11451e8
commit fabff3835d
4 changed files with 122 additions and 140 deletions
application/render

View file

@ -158,10 +158,6 @@ class PageBuilder
*/
protected function finalize(): void
{
//FIXME - DEV _ REMOVE ME
$this->assign('base_path', '/Shaarli');
$this->assign('asset_path', '/Shaarli/tpl/default');
// TODO: use the SessionManager
$messageKeys = [
SessionManager::KEY_SUCCESS_MESSAGES,
@ -248,20 +244,4 @@ class PageBuilder
return $this->tpl->draw($page, true);
}
/**
* Render a 404 page (uses the template : tpl/404.tpl)
* usage: $PAGE->render404('The link was deleted')
*
* @param string $message A message to display what is not found
*/
public function render404($message = '')
{
if (empty($message)) {
$message = t('The page you are trying to reach does not exist or has been deleted.');
}
header($_SERVER['SERVER_PROTOCOL'] . ' ' . t('404 Not Found'));
$this->tpl->assign('error_message', $message);
$this->renderPage('404');
}
}