public static function DoIt() { self::prepareHttpString(); try { $url = new BuUrl2(self::$httpString); bu::setBuUrlInstance($url); self::runController($url); } catch (Exception $e) { $msg = 'Ошибка на сайте'; if (bu::config('rc/debug')) { $msg = get_class($e) . ': ' . $e->getMessage(); } $layout = bu::layout('panic'); $content = $msg; if (bu::config('rc/debug')) { $content .= sprintf('<br><b>%s</b><br>', get_class($e)); $content .= "<pre>"; foreach (array_reverse($e->getTrace()) as $v) { if (isset($v['line'])) { $content .= $v['line'] . ' ' . $v['file'] . "\n"; } } $content .= "</pre>"; } $layout->content = $content; $layout->generate(); } }
public function runController($__url) { bu::timer('Controller start.', 'system'); bu::hook(array('pre_controller', 'blank')); ob_start(); $layout = bu::layout(); if ($__url->getBinUrl()) { $layout->_content_view = $__url->getBinUrl(); } include $__url->getBinFile(); $__content = ob_get_contents(); ob_end_clean(); $layout->content = $__content; $layout->generate(); bu::timer('Controller end.', 'system'); }