Esempio n. 1
0
                    $this->layout = false;
                    $this->response->body = $this->render("layouts:error/500-debug.php", ['error' => json_decode($this->response->body, true)]);
                }
            } else {
                if ($this->req_is('ajax')) {
                    $this->response->body = '{"error": "500", "message": "system error"}';
                } else {
                    $this->layout = false;
                    $this->response->body = copi::view("theme:error/500.html");
                }
            }
            break;
        case 404:
            // route | file not found
            if ($this->req_is('ajax')) {
                $this->response->body = '{"error": "404", "message":"File not found"}';
            } else {
                $this->layout = false;
                $this->response->body = copi::view("theme:error/404.html");
            }
            break;
    }
    /**
     * send some debug information
     * back to client (visible in the network panel)
     */
    if ($this['debug'] && !headers_sent()) {
        header('SITE_DURATION_TIME: ' . CP_DURATION_TIME . 'sec');
        header('SITE_MEMORY_USAGE: ' . CP_MEMORY_USAGE . 'mb');
    }
}, 100);