/** * Construct. * */ public function __construct() { parent::__construct(); // Add CDatabase to framework $this->setShared('db', function () { $db = new \Mos\Database\CDatabaseBasic(); // LOCALp $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql.php'); // BTH // $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql_bth.php'); $db->connect(); return $db; }); // Add CForm to framework $this->set('form', '\\Mos\\HTMLForm\\CForm'); // Create extra navbar for top menu $this->setShared('topnav', function () { $navbar = new \Anax\Navigation\CNavbar(); $navbar->setDI($this); $navbar->configure(ANAX_APP_PATH . 'config/topnav.php'); return $navbar; }); // Add UserController to framework $this->set('UserController', function () { $controller = new \Anax\User\UserController(); $controller->setDI($this); return $controller; }); // Add QuestionsController to framework $this->set('QuestionsController', function () { $controller = new \Anax\Questions\QuestionsController(); $controller->setDI($this); $controller->setup(); return $controller; }); // Add AnswersController to framework $this->set('AnswersController', function () { $controller = new \Anax\Answers\AnswersController(); $controller->setDI($this); $controller->setup(); return $controller; }); // Add CommentsController to framework $this->set('CommentsController', function () { $controller = new \Anax\Comments\CommentsController(); $controller->setDI($this); $controller->setup(); return $controller; }); // Add TagsController to framework $this->set('TagsController', function () { $controller = new \Anax\Tags\TagsController(); $controller->setDI($this); $controller->setup(); return $controller; }); }
}); // Load Questions Controller $di->set('QuestionsController', function () use($di) { $controller = new \Anax\Questions\QuestionsController(); $controller->setDI($di); return $controller; }); // Load Tags Controller $di->set('TagsController', function () use($di) { $controller = new \Anax\Tags\TagsController(); $controller->setDI($di); return $controller; }); // Load Answers Controller $di->set('AnswersController', function () use($di) { $controller = new \Anax\Answers\AnswersController(); $controller->setDI($di); return $controller; }); // $app = new \Anax\Kernel\CAnax($di); $app = new \Anax\MVC\CApplicationBasic($di); // $app->theme->configure(ANAX_APP_PATH . 'config/theme-grid.php'); $app->theme->configure(ANAX_APP_PATH . 'config/theme_me.php'); // On production server, set pretty urls and use rewrite in .htaccess $app->url->setUrlType($_SERVER['SERVER_NAME'] == 'localhost' ? \Anax\Url\CUrl::URL_APPEND : \Anax\Url\CUrl::URL_CLEAN); // $app->url->setUrlType(\Anax\Url\CUrl::URL_CLEAN); $app->navbar->configure(ANAX_APP_PATH . 'config/navbar_me.php'); // $app->theme->addStylesheet('css/me.css'); // $app->theme->addStylesheet('css/comments.css'); // $app->theme->addStylesheet('css/users.css'); $app->users = new \Anax\Users\User();