//echo 1; ///exit(); define('APP_PATH', dirname(__FILE__).'/'); define('CORE_PATH', APP_PATH.'core/'); define('PROJ_PATH', APP_PATH.'project/'); include_once(CORE_PATH.'includes/_loader.php'); //services::getGenerateTime('start'); //echo APP_PATH; // //services::getGenerateTime('start', false); //phpinfo();exit; //services::getGenerateTime('before controller define'); $Controller = _getControllerAndAction(); $Action = $Controller['action']; $Controller = $Controller['controller']; //services::getGenerateTime('after controller define'); // Takes the names to create controller and run action $controllerName = $Controller.'_controller'; // controller class name and controller filename $actionName = $Action.'Action'; //services::getGenerateTime('before parent include'); // include controller we dont need autoload for controller - as we use only one controller per page include_once(CORE_PATH.'parents/parent_controller.php'); //services::getGenerateTime('after parent include'); include_once(PROJ_PATH.'controllers/'.$controllerName.'.php'); //sys::dump(swFiles::clearDir(APP_PATH.'misc/test/')); //$_is_ajax = request::isAjax(); //$isSWrequest request::isSWrequest(); //services::getGenerateTime('before is ajax'); $_UA = array(); if(!request::isAjax() && !request::isSWrequest()) { //$_UA = request::GetUserAgent(); // user agent } // create controller //services::getGenerateTime('before controller creation'); $controller = new $controllerName($Controller,$Action, $_UA); //services::getGenerateTime('after controller creation'); $dontconfig = request::get('dontconfig', 0); if(!$dontconfig) { //if there is an variable $queryModel = new queryModel(); $queries =$queryModel->getRand(); $controller->view->assign('queries', $queries); $bannerModel = new bannerModel(); $banners =$bannerModel->getRand(50); //sys::dump($banners); $controller->view->assign('banners', $banners); } //services::getGenerateTime('after get cats'); //sys::dump($categories); if('cli' == php_sapi_name()) { // cron error_reporting(E_ALL); $Controller = isset($argv[1]) && $argv[1] ? $argv[1] : 'script'; $Action = isset($argv[2]) && $argv[2] ? $argv[2] : 'index'; $controllerName = $Controller.'_controller'; // controller class name and controller filename $actionName = $Action.'Action'; //var_dump(1); include_once(ADMIN_PATH.'controllers/'.$controllerName.'.php'); //var_dump(2); //exit; //require_once(ADMIN_PATH.'controllers/'.$controllerName.'.php'); $controller = new $controllerName($Controller, $Action); $controller->{$actionName}(); //var_dump($actionName); exit; } //SMARTY before controller include_once(PROJ_PATH.'includes/smarty_before.php'); // run action $controller->{$actionName}(); //use {} //if themename were changed $controller->view->template_dir = PROJ_PATH.'view/'.$controller->THEMENAME.'/'; //SMARTY after controller include_once(PROJ_PATH.'includes/smarty_after.php'); //sys::dump($controller->swUser); //Services::getGenerateTime('start display'); if(SMARY_VERSION == 2) { $controller->view->display((($controller->tpl) ? $controller->view->template_dir . $controller->tpl : $controller->view->template_dir . $Controller . '/' . $Action . '.tpl')); } else { $controller->view->display((($controller->tpl) ? $controller->view->template_dir[0] . $controller->tpl : $controller->view->template_dir[0] . $Controller . '/' . $Action . '.tpl')); } //$controller->view->display((($controller->tpl) ? $controller->view->template_dir . $controller->tpl : $controller->view->template_dir . $Controller . '/' . $Action . '.tpl')); //in each controller we decide what type of template we will use/ // so here we take the teplate to say to smarty what templat will be this view //$controller->view->display($controller->template_type.'.tpl'); //services::getGenerateTime('end display', true); ?>