Exemple #1
0
 /**
  * Run the application.
  */
 public static function run()
 {
     // Initialize the request
     $request = new Request();
     if ($request->admin) {
         // Execute the redirect
         header('Location: ' . URL_DASHBOARD_ADMIN);
         // Exit
         exit;
     } else {
         // Initialize and dispatch the request
         $controller = new CoreController($request);
         $controller->dispatch();
     }
 }
Exemple #2
0
 public static function &loadClass($class, $directory = '', $param = null, $isCache = true)
 {
     if (isset(self::$_classes[$class])) {
         $class = self::$_classes[$class];
         if (is_subclass_of($class, 'CoreController')) {
             CoreController::$instance = $class;
         }
         return $class;
     }
     $name = false;
     foreach (array(APPPATH, BASEPATH) as $path) {
         if (file_exists($path . $directory . '/' . $class . '.php')) {
             $name = $class;
             if (class_exists($name, FALSE) === FALSE) {
                 require_once $path . $directory . '/' . $class . '.php';
             }
             break;
         }
     }
     if ($name === FALSE) {
         die('Unable to locate the specified class: ' . $class . '.php');
     } else {
         $class = str_replace('.php', '', trim($class, '/'));
         if (($lastSlash = strrpos($class, '/')) !== FALSE) {
             $name = substr($class, ++$lastSlash);
         }
     }
     $instance = isset($param) ? new $name($param) : new $name();
     if ($isCache) {
         self::$_classes[$class] = $instance;
     }
     return $instance;
 }
 public function __construct()
 {
     parent::__construct();
     Debug::write("Building common WebsiteController ...", 0);
     /**
      * Do common stuff concerning your website here
      */
 }
Exemple #4
0
 /** 
  *	@brief	Méthode init qui recupere la liste de resultats
  *	@details	Affiche la liste de contenus
  *
  */
 public function init()
 {
     $id = request::get('id');
     $module = $this->getModule();
     $list = new List_Frameview();
     $views = users::getProfile();
     if (isset($views['view'][$module]['list']['filter'])) {
         $list->setFilter($views['view'][$module]['list']['filter']);
     }
     CoreController::share($this, $list);
     $listContent = $list->renderSTR();
     $this->assign('listContent', $listContent);
 }
Exemple #5
0
 /**
  *	Surcharge de l'init
  *	
  *	Recupere le module et genere une liste de prévisuatisation
  *	
  */
 public function init()
 {
     $list = new List_View();
     $modules = $this->getModule();
     CoreController::share($this, $list);
     $list->setFilter($this->filter);
     $list->setNbr($list->nbr);
     $listContent = $list->renderSTR();
     $this->assign('total', $list->total);
     $this->assign('start', 0);
     $this->assign('list', $listContent);
     $this->assign('mainmodule', ucfirst($modules));
 }
Exemple #6
0
 public function init()
 {
     $module = $this->getModule();
     $list = new List_Frameview();
     $views = users::getProfile();
     $list->setFilter($views['view'][$module]['dashlet']['filter']);
     $list->setNbr(3);
     CoreController::share($this, $list);
     $listContent = $list->renderSTR();
     $total = $list->getTotal();
     $this->assign('listContent', $listContent);
     $this->assign('module', $module);
     $this->assign('total', $total);
 }
Exemple #7
0
 public function __construct()
 {
     Debug::write("Building controller " . get_class($this) . " ...", 0);
     self::$instance = $this;
     $this->view = new View();
     //TODO: move check to Database.class.php
     if (isset($GLOBALS['config']['bdd']['hostname']) && !empty($GLOBALS['config']['bdd']['hostname'])) {
         $this->db = new Database();
     }
     /**
      * start capturating controller's output
      */
     self::startCapturing();
 }
Exemple #8
0
 /**
  * 实例化一个模型
  * @param type $classname_path
  * @param type $hmvc_module_floder
  * @return type CoreModel
  */
 public static function instance($classname_path = null, $hmvc_module_floder = NULL)
 {
     if (!empty($hmvc_module_floder)) {
         CoreRouter::switchHmvcConfig($hmvc_module_floder);
     }
     //这里调用控制器instance是为了触发自动加载,从而避免了插件模式下,直接instance模型,自动加载失效的问题
     CoreController::instance();
     if (empty($classname_path)) {
         $renew = is_bool($classname_path) && $classname_path === true;
         CoreLoader::classAutoloadRegister();
         return empty(self::$instance) || $renew ? self::$instance = new self() : self::$instance;
     }
     $system = CoreLoader::$system;
     $classname_path = str_replace('.', DIRECTORY_SEPARATOR, $classname_path);
     $classname = basename($classname_path);
     $model_folders = $system['model_folder'];
     if (!is_array($model_folders)) {
         $model_folders = array($model_folders);
     }
     $count = count($model_folders);
     CoreLoader::classAutoloadRegister();
     foreach ($model_folders as $key => $model_folder) {
         $filepath = $model_folder . DIRECTORY_SEPARATOR . $classname_path . $system['model_file_suffix'];
         $alias_name = $classname;
         if (isset(CoreModelLoader::$model_files[$alias_name])) {
             return CoreModelLoader::$model_files[$alias_name];
         }
         if (file_exists($filepath)) {
             //在plugin模式下,路由器不再使用,那么自动注册不会被执行,自动加载功能会失效,所以在这里再尝试加载一次,
             //如此一来就能满足两种模式
             //CoreLoader::classAutoloadRegister();
             if (!class_exists($classname, FALSE)) {
                 CoreLoader::includeOnce($filepath);
             }
             if (class_exists($classname, FALSE)) {
                 return CoreModelLoader::$model_files[$alias_name] = new $classname();
             } else {
                 if ($key == $count - 1) {
                     Fn::trigger404('Model Class:' . $classname . ' not found.');
                 }
             }
         } else {
             if ($key == $count - 1) {
                 Fn::trigger404($filepath . ' not  found.');
             }
         }
     }
 }
 public function callAction($method, $parameters)
 {
     parent::initLayout($method, $parameters);
     if (!$this->is_ajax) {
         $this->_current_controller = $this->getCurrentController();
         $this->_current_controller_parts = explode('/', $this->_current_controller);
         $this->_current_action = $this->getCurrentAction();
         $assets = json_decode(file_get_contents(base_path('assets.json')), true);
         foreach ($assets['libraries'] as $library_name => $library_data) {
             $css = isset($library_data['css']) ? $library_data['css'] : null;
             $js = isset($library_data['js']) ? $library_data['js'] : null;
             $this->addLibrary($library_name, $css, $js);
         }
         $this->loadPages($assets['pages']);
     }
     return parent::callAction($method, $parameters);
 }
Exemple #10
0
 /**
  * @brief		Methode d'initialisation du frameview
  * @details		Méthode qui gere l'ensemble de la pagination
  * @return	null
  */
 public function init()
 {
     $list = new List_View();
     $modules = $this->getModule();
     CoreController::share($this, $list);
     $commande = request::get('commande');
     $start = request::get('start');
     // Si le filtre n'est pas set alors je recupere celui dans l'url
     if (!$this->filter) {
         $filter = request::get('filter');
         $this->setFilter($filter);
     }
     $list->setFilter($this->filter);
     if ($this->nbr) {
         $list->setNbr($this->nbr);
     }
     if ($start == "") {
         $start = 0;
     }
     $prevStart = $start - $list->nbr;
     $nextStart = $start + $list->nbr;
     $list->setStart($start);
     $listContent = $list->renderSTR();
     if ($list->total < $list->nbr) {
         $nextStart = $start;
     }
     if ($start + $list->nbr > $list->total) {
         $nextStart = $start;
     }
     if ($start - $list->nbr < 0) {
         $prevStart = $start;
     }
     $this->setTotal($list->total);
     $this->assign('total', $list->total);
     $this->assign('start', $start);
     $this->assign('nextStart', $nextStart);
     $this->assign('prevStart', $prevStart);
     $this->assign('list', $listContent);
     $this->assign('mainmodule', ucfirst($modules));
 }
Exemple #11
0
 public static function display()
 {
     if (self::$enabled && CoreController::getInstance() != NULL) {
         // keeps only main request with controller
         // if(self::$enabled) { // all requests (if uncommented, html ressources might fail if stdout enabled)
         if (self::$out === "stdout" || self::$out === "both") {
             foreach (self::$content as $msg) {
                 echo "Debug: " . $msg . "<br />";
             }
         }
         if (self::$out === "file" || self::$out === "both") {
             $file = fopen(self::$outfile, 'a');
             if (!$file) {
                 return;
             }
             foreach (self::$content as $msg) {
                 fwrite($file, $msg . PHP_EOL);
             }
             fclose($file);
         }
     }
 }
Exemple #12
0
 public function __construct($autoload = true, $init_template = true)
 {
     // Add trace for debugging
     \Debug::trace('Initializing core controller...', __FILE__, __LINE__);
     // Set the instance here
     if (self::$instance == false) {
         self::$instance = $this;
     }
     // Set our Controller and Action
     $this->controller = $GLOBALS['controller'];
     $this->action = $GLOBALS['action'];
     $this->querystring = $GLOBALS['querystring'];
     // Initiate the Loader Input, and Config class
     $this->load = load_class('Loader');
     $this->Config = load_class('Config');
     $this->Input = load_class('Input');
     // If site is updating, only allow Ajax requests
     if ($GLOBALS['controller'] != 'admin_ajax' && $this->Config->get('site_updating')) {
         die('Site Down for maintenance. Be back soon.');
     }
     // Setup the selected users language
     $this->Language = load_class('Language');
     $GLOBALS['language'] = $this->Language->selected_language();
     // Autoload helpers and libraries
     if ($autoload == true) {
         $this->_autoload();
     }
     // Setup the template system
     if ($init_template == true) {
         $this->_init_template();
     }
     // Process DB updates
     if (!$this->Input->is_ajax()) {
         $this->_process_db();
     }
     // Add trace for debugging
     \Debug::trace('Core controller initialized successfully', __FILE__, __LINE__);
 }
Exemple #13
0
 /**
  *	@brief methode appelé quand l'utilisateur est connectée
  */
 public function whenConnected()
 {
     if ($this->action != "") {
         $moduleName = ucfirst($this->module);
         $actionName = ucfirst($this->action);
         $customName = 'Modules_' . $moduleName . '_' . $actionName;
         $coreName = 'Module_' . $actionName;
         if (CoreController::controllerExists($customName)) {
             $ctrName = $customName;
         } elseif (CoreController::controllerExists($coreName)) {
             $ctrName = $coreName;
         }
         $obj = new $ctrName();
         CoreController::share($this, $obj);
         $this->assign('right', $obj->renderSTR());
     }
     $allModules = ModuleManager::getAllModules();
     $this->assign('topLinks', $allModules);
     $obj = new Sidebar_View();
     $obj->setModulesList($allModules);
     $this->assign('left', $obj->renderSTR());
     $this->assign('sidebar', true);
 }
Exemple #14
0
 public function __construct(array $param)
 {
     parent::__construct();
 }
 protected function beforeAction($action)
 {
     if ($this->isRequiredLogin() && !$this->hasLoggedIn() && ($action->id != $this->getActionLogin() || $this->id != $this->getControllerLogin())) {
         $this->redirect($this->getLoginUrl());
         return false;
     }
     return parent::beforeAction($action);
 }
 /**
  * returns view languages
  * 
  */
 public function alwaysAction()
 {
     parent::alwaysAction();
     $this->model = new FeedModel($this->Database);
 }
 public function __construct()
 {
     parent::__construct();
 }
Exemple #18
0
 function __construct()
 {
     parent::__construct();
     // Put any controller initialization code here
 }
Exemple #19
0
 */
if (isset($GLOBALS['config']['DEBUG']['enabled']) && $GLOBALS['config']['DEBUG']['enabled'] == true) {
    Debug::build();
}
/**
 * Security checks
 * Keep in mind it just does a BASIC check on world-permission on files/folders under DOCUMENT_ROOT ; and a quick check on php.ini
 */
if ($GLOBALS['config']['security']['skipLocalChecks'] === false) {
    //Setup
    CoreController::startCapturing();
    $successful_Check = true;
    /**
     * php.ini config
     */
    echo "<u>Checking php.ini file ...</u><br />";
    php_iniChecks();
    echo "******************<br />";
    /**
     * File rights
     */
    echo "<u>Checking file permissions ...</u><br />";
    localSecurityChecks(ROOT_DIR);
    // Can be found in FUNCTIONS_DIR . security.php
    //Cleaning
    $output = CoreController::stopCapturing();
    if ($GLOBALS["successful_Check"] === false) {
        Site::error(Site::app_error, "Some misconfiguration were detected. <br />Please fix them in order to run this framework safely", $output);
    }
    unset($successful_Check, $checks);
}
Exemple #20
0
 public function closeConnection()
 {
     if (!is_null(self::$connection)) {
         Model::$connection = NULL;
         self::$connection = NULL;
     }
 }
Exemple #21
0
 /**
  * Render data
  *
  * @param $view
  * @param array $data
  * @return string
  */
 public static function renderIt($view, array $data)
 {
     self::$_layout = $view;
     self::$_data = !empty($data) ? $data : array();
     $router = DIContainer::build('router');
     $app = DIContainer::build('app');
     $config = DIContainer::build('config');
     $funCurRoute = $router->findRoute();
     $funGetRoute = function ($route_name, $params = null) use($router) {
         return $router->generateRoute($route_name, $params);
     };
     $funDoAction = function ($class_name, $action, $params) use($app) {
         $response = $app->runControllerAction($class_name, $action, $params);
         if (is_object($response)) {
             $response->send();
         }
     };
     $funGetImg = function ($img) {
         $default_img = '/img/phone.png';
         return !empty($img) && getimagesize($img) ? $img : $default_img;
     };
     $data = array_merge($data, array('config' => $config, 'getRoute' => $funGetRoute, 'include' => $funDoAction, 'route' => $funCurRoute, 'getImg' => $funGetImg, 'isAjax' => self::isAjax()));
     ob_start();
     extract(self::$_data);
     extract($data);
     include self::$_layout;
     $result = ob_get_clean();
     return $result;
 }
Exemple #22
0
 /**
  *	Methode constructeur surcharge avec init du nombre et start
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->start = 0;
     $this->nbr = 10;
 }
Exemple #23
0
 /**
  * [Load correct controller from sections]
  * @return [void]
  */
 protected function loadController()
 {
     /**
      * First, if it's an embed HTML request (js, css, others...), 
      * then load directly requested file, not a controller.
      */
     preg_match_all("/\\.[^\\.]*\$/", empty(self::$sections) ? "index.php" : array_reverse(self::$sections)[0], $file_Extention);
     if (!empty($file_Extention[0]) && !in_array(str_replace(".", "", $file_Extention[0][0]), array('php', 'html', 'phtml', '.locale', '.template'))) {
         //Logging request
         self::log(date("Y/m/d-H:i:s") . " - Ressrce request from " . $_SERVER['REMOTE_ADDR'] . " - " . Site::getRequest());
         $sections = self::$sections;
         // UGLY Label ... To improve later with a dedicated recursive function
         LABEL_loadController_ReduceSectionsByOne:
         //TODO : PHP<5.3 ?
         $fileToLoad = HTML_DIR . $GLOBALS['config']['HTML']['template'] . "/";
         foreach ($sections as $section) {
             if (empty($section)) {
                 continue;
             }
             if (is_dir($fileToLoad . $section)) {
                 $fileToLoad .= $section . "/";
             } elseif (is_file($fileToLoad . $section) && $section == (empty(self::$sections) ? "index.php" : array_reverse(self::$sections)[0])) {
                 $fileToLoad .= $section;
                 break;
             }
         }
         if (file_exists($fileToLoad) && is_file($fileToLoad)) {
             $contentType = array_pop(explode('.', self::$request));
             if (array_key_exists(strtolower($contentType), $GLOBALS['config']['HTML']['filetypes'])) {
                 header("Content-type: " . $GLOBALS['config']['HTML']['filetypes'][strtolower($contentType)]);
             } else {
                 header("Content-type: " . finfo_file(finfo_open(FILEINFO_MIME_TYPE), $fileToLoad));
             }
             echo file_get_contents($fileToLoad);
         } elseif (count($sections) > 1) {
             $sections = array_slice($sections, 1);
             goto LABEL_loadController_ReduceSectionsByOne;
         } else {
             Site::error(Site::HTTP_error, "404", $GLOBALS['config']['errors']['http']['404']);
         }
         /** 
          * Second, if the ressource requested isn't an html/css whatsoever file, 
          * load the corresponding PHP controller
          */
     } else {
         $this->findController();
         //Logging request
         self::log(date("Y/m/d-H:i:s") . " - Primary request from " . $_SERVER['REMOTE_ADDR'] . " - " . Site::getRequest());
         if (file_exists(self::$path_to_controller . self::$controller_file_to_load)) {
             /**
              * Quick check on controller's syntax. 
              * TODO : manage includes / requires
              */
             $shell = shell_exec(PHP_BINDIR . '/php -l "' . self::$path_to_controller . self::$controller_file_to_load . '"');
             $error_msg = preg_replace("/Errors parsing.*\$/", "", $shell, -1, $count);
             if ($shell === NULL) {
                 Debug::write("PHP binary couldn't be found. Can't check requested controller.", 0);
             } else {
                 if ($count > 0) {
                     Site::error(Site::app_error, "Syntax error in controller", trim($error_msg));
                 }
             }
             /** 
              * If syntax checks are ok, loads controller
              */
             include self::$path_to_controller . self::$controller_file_to_load;
             // TODO : check syntax
             try {
                 $controller = new self::$controller_name_to_load();
                 // FIXME: PHP<5.3?
             } catch (PDOException $e) {
                 CoreController::stopCapturing();
                 Site::error(Site::app_error, "Database error", $GLOBALS['config']['security']['displayExplicitErrors'] === true ? $e->getMessage() : $GLOBALS['config']['errors']['framework']['503']);
                 exit;
                 /* TODO : do not catch general exceptions ? */
             } catch (Exception $e) {
                 CoreController::stopCapturing();
                 Site::error(Site::site_error, "Exception thrown in loaded controller", $GLOBALS['config']['security']['displayExplicitErrors'] === true ? $e->getMessage() : $GLOBALS['config']['errors']['framework']['502']);
                 exit;
             }
             if (method_exists($controller, 'displayView')) {
                 $controller->displayView();
             }
         } else {
             $this->error(Site::app_error, "501", $GLOBALS['config']['errors']['framework']['501'] . " " . self::$controller_name_to_load);
         }
     }
 }
Exemple #24
0
 public static function &getInstance()
 {
     return CoreController::getInstance();
 }
Exemple #25
0
 public function __construct()
 {
     parent::__construct();
     $this->router_info = CoreRouter::info();
     // ====================================
     // 确定语言
     // ====================================
     $cookie_lifetime = 7 * 86400;
     if (!empty($_GET['lang']) && preg_match('/^[a-z\\-]+$/', $_GET['lang'])) {
         if ($this->validLanguage($_GET['lang'])) {
             CoreLoader::setCookie('lang', $_GET['lang'], $cookie_lifetime);
             CoreLoader::$system['language'] = $_GET['lang'];
         } else {
             CoreLoader::setCookie('lang', CoreLoader::$system['default_language'], $cookie_lifetime);
             CoreLoader::$system['language'] = CoreLoader::$system['default_language'];
         }
     } else {
         $cookieLang = CoreInput::cookie('lang');
         if (empty($cookieLang) || !preg_match('/^[a-z\\-]+$/', $cookieLang) || !$this->validLanguage($cookieLang)) {
             // if user doesn't specify any language, check his/her browser language
             // check if the visitor language is supported
             // $this->language(true) to return the country code such as en-US zh-CN zh-TW
             $countryCode = true;
             $langcode = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
             $langcode = !empty($langcode) ? explode(';', $langcode) : $langcode;
             $langcode = !empty($langcode[0]) ? explode(',', $langcode[0]) : $langcode;
             if (!$countryCode) {
                 $langcode = !empty($langcode[0]) ? explode('-', $langcode[0]) : $langcode;
             }
             $lang = $langcode[0];
             $lang = strtolower($lang);
             if (preg_match('/^[a-z\\-]+$/', $lang) && $this->validLanguage($lang)) {
                 CoreLoader::setCookie('lang', $lang, $cookie_lifetime);
                 CoreLoader::$system['language'] = $lang;
             } else {
                 CoreLoader::setCookie('lang', CoreLoader::$system['default_language'], $cookie_lifetime);
                 CoreLoader::$system['language'] = CoreLoader::$system['default_language'];
             }
         } else {
             CoreLoader::$system['language'] = $cookieLang;
         }
     }
     #echo CoreLoader::$system['language'];
     $locale = CoreLoader::locale(CoreLoader::$system['language']);
     $langEncoding = explode('.', $locale->getLocale());
     $localeDataFile = CoreLoader::$system['language_folder'] . '/' . $langEncoding[0] . '/locale.php';
     if (file_exists($localeDataFile)) {
         CoreLocale::$LANG = (include $localeDataFile);
     }
     // ====================================
     // 初始化Smarty模板引擎
     // ====================================
     include_once FRAMEWORK_CORE_PATH . '/Smarty/Smarty.class.php';
     $smarty = new Smarty();
     $view_dir = self::$system['view_folder'];
     $cache_dir = self::$system['table_cache_folder'] . '/smarty';
     // $smarty->force_compile = true;
     $smarty->error_reporting = 9;
     //E_ALL;
     $smarty->debugging = false;
     $smarty->caching = false;
     //$smarty->use_sub_dirs = true;
     $smarty->cache_lifetime = 120;
     $smarty->left_delimiter = '<{';
     $smarty->right_delimiter = '}>';
     $smarty->allow_php_templates = true;
     $smarty->setTemplateDir($view_dir);
     $smarty->setCompileDir($cache_dir . '/templates_c/');
     $smarty->setConfigDir($cache_dir . '/configs/');
     $smarty->setCacheDir($cache_dir . '/cache/');
     $smarty->registered_cache_resources = array('phpFastCache', 'memcache');
     //$smarty->caching_type = 'phpFastCache'; //TODO: 缓存无效
     $smarty->caching_type = 'file';
     switch (phpFastCache::$storage) {
         case 'memcache':
         case 'apc':
             $smarty->caching_type = phpFastCache::$storage;
             break;
         default:
             if (function_exists('apc_cache_info')) {
                 $smarty->caching_type = 'apc';
             }
             break;
     }
     $smarty->default_resource_type = 'file';
     //模板保存方式
     // ====================================
     // 设置全局变量
     // ====================================
     $smarty->assignGlobal('TITLE', '');
     $smarty->assignGlobal('KEYWORDS', '');
     $smarty->assignGlobal('DESCRIPTION', '');
     // ====================================
     // 注册自定义函数
     // ====================================
     //$smarty->registerPlugin('function', 'burl', 'build_url');
     //<{burl param=value}> ===> function build_url(...){...}
     //$smarty->registerPlugin('modifier', 'astatus', 'audit_status');
     //<{$var|astatus}> ===> function audit_status(...){...}
     $smarty->registerPlugin('modifier', 'url', 'Fn::url');
     $this->view =& $smarty;
 }
Exemple #26
0
 /**
  * 实例化一个loader
  * @param type $renew               是否强制重新new一个loader,默认只会new一次
  * @param type $hmvc_module_floder  hmvc模块文件夹名称
  * @return type CoreLoader
  */
 public static function instance($renew = null, $hmvc_module_floder = null)
 {
     $default = CoreLoader::$system;
     if (!empty($hmvc_module_floder)) {
         CoreRouter::switchHmvcConfig($hmvc_module_floder);
     }
     //在plugin模式下,路由器不再使用,那么自动注册不会被执行,自动加载功能会失效,所以在这里再尝试加载一次,
     //如此一来就能满足两种模式
     self::classAutoloadRegister();
     //这里调用控制器instance是为了触发自动加载,从而避免了插件模式下,直接instance模型,自动加载失效的问题
     CoreController::instance();
     $renew = is_bool($renew) && $renew === true;
     $ret = empty(self::$instance) || $renew ? self::$instance = new self() : self::$instance;
     CoreLoader::$system = $default;
     return $ret;
 }
Exemple #27
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('DefaultModel', 'defaultModel');
     $this->load->library('Mcurl', 'mcurl');
 }
Exemple #28
0
<?php

// DO NOT FORGET: "LESS IS MORE"
session_start();
require_once "./api.php";
$main = new Main();
$ctr = new Controller();
$ctr->setAction(request::get("action"));
$ctr->setModule(request::get("controller"));
$ctr->setFormat(request::get("format"));
CoreController::share($ctr, $main);
$main->assign('content', $ctr);
$main->render();