aboutsummaryrefslogtreecommitdiffstats
path: root/apps/error/error_app.php
blob: dc1d64cb25040035f32a969c906fc35eaa7511ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
 *
 * PHP version 5.4
 *
 * @category Mageia
 * @package  Mageia\Web\www
 * @author   rda <rda@mageia.org>
 * @license  http://www.gnu.org/licenses/gpl-2.0.html GPL-2+
 * @link     http://www.mageia.org/
 *
*/

class Error extends Pinq_App
{
    public function __construct($controller, $options)
    {
        $this->_control = $controller;
        $this->_options = $options;
    }

    public function run()
    {
        if ($this->_options['code'] == 404) {
            return $this->_error_404();
        }
    }

    private function _error_404()
    {
        define('HLANG', true);
        require 'langs.php'; // needs absolute path in some form to be link depth independent
        _lang_load($locale, '404');

        ob_start();
        include 'templates/404.tpl';

        return array(
            'headers' => array(
                'Mageia-Test: 1',
                'HTTP/1.0 404 Not Found',
                'Status: 404 Not Found'
            ),
            'body'    => ob_get_clean()
        );
    }
}