public function boot()
 {
     if ($this->db_connect()) {
         $this->date = new Tdate();
         $this->meta_datas = new Meta_datas();
     }
     /* =-=-=-=-=-=-=-=-= URI HANDLER	-=-=-=-=-=-=-=-=-=-= */
     set_core_vars('base_url', $baseUrl = $this->url->site_url(array('index')));
     set_core_vars('controller', $Class = $this->url->controller());
     set_core_vars('method', $Method = $this->url->method());
     set_core_vars('parameters', $Parameters = $this->url->parameters());
     /* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
     /**
      * Check out if current server support tendoo
      **/
     is_compatible();
     /**
      * Load module and Themes if tendoo is installed
      **/
     if ($this->is_installed === true) {
         // Load Themes Only if Website mode is enabled.
         if (get_core_vars('tendoo_mode') !== 'website') {
             load_themes();
         }
         load_modules();
     }
     /**
      * Load Core Vars
      **/
     new Load_Core_Values($this->is_installed);
     /**
      * Checking Controller
      **/
     if (in_array($Class, array('install', 'registration', 'logoff', 'admin', 'login', 'error'))) {
         $Class === 'admin' ? define('SCRIPT_CONTEXT', 'ADMIN') : define('SCRIPT_CONTEXT', 'PUBLIC');
         if ($this->is_installed) {
             if ($this->db_connected()) {
                 include_once CONTROLLERS_DIR . $Class . '.php';
                 include_once SYSTEM_DIR . 'Executer.php';
             } else {
                 $this->tendoo->error('db_connect_error');
                 die;
             }
         } else {
             if ($Class === 'install') {
                 include_once CONTROLLERS_DIR . $Class . '.php';
                 include_once SYSTEM_DIR . 'Executer.php';
             } else {
                 $this->url->redirect(array('install'));
             }
         }
     } else {
         // Define Script context
         define('SCRIPT_CONTEXT', 'PUBLIC');
         // Checks install status
         if (!$this->is_installed) {
             include_once CONTROLLERS_DIR . 'tendoo_index.php';
             include_once SYSTEM_DIR . 'Executer.php';
         } else {
             /**
              * Attemps connecting to database
              **/
             !$this->db_connected() ? $this->tendoo->error('db_connect_error') : null;
             $options = get_core_vars('options');
             /**
              * Loading Users Class
              **/
             $this->load->library('users_global');
             // Conditional if webmode is enabled
             get_core_vars('tendoo_mode') == 'webapp' ? $this->url->redirect(array('admin', 'index?notice=web-app-mode-enabled')) : null;
             /**
              * Setting Core vars
              **/
             set_core_vars('controllers', $loaded_controllers = $this->controller->get('', FALSE), 'readonly');
             // ??
             set_core_vars('page', $unique_controller = $this->controller->_get($Class), 'readonly');
             set_core_vars('active_theme', $active_theme = get_themes('filter_active'));
             set_core_vars('module_url', $module_url = $Class, 'readonly');
             set_core_vars('module', $module = get_modules('filter_active_namespace', $unique_controller[0]['PAGE_MODULES']), 'readonly');
             set_core_vars('opened_module', $module, 'readonly');
             set_core_vars('app_module', $app_module = get_modules('filter_active_app'), 'readonly');
             /**
              * 	Trigger each init.php file within module and theme folders
              *	init.php is the main file for modules and themes.
              *	@since 1.4
              **/
             $this->trigger_inits();
             /**
              * 	Declare Notices : Notices are internal(system) or module/theme alert.
              **/
             set_core_vars('tendoo_notices', trigger_filters('declare_notices', array(get_core_vars('default_notices'))));
             // @since 1.4
             if (is_string($unique_controller)) {
                 $this->url->redirect(array('error', 'code', $unique_controller));
             } else {
                 // If selected module is valid
                 if (!$module) {
                     $this->url->redirect(array('error', 'code', 'moduleBug'));
                 }
                 /**
                  * Setting page meta datas
                  **/
                 set_page('title', $unique_controller[0]['PAGE_TITLE']);
                 set_page('description', $unique_controller[0]['PAGE_DESCRIPTION']);
                 set_page('keywords', $unique_controller[0]['PAGE_KEYWORDS']);
                 // Saved First BreadCrumbs
                 $INDEX = $this->controller->_get('index');
                 set_bread(array('link' => $module_url, 'text' => $INDEX[0]['PAGE_NAMES']));
                 /**
                  * Checks if current module is supported by active theme
                  **/
                 if (TRUE !== does_active_theme_support($module['handle'])) {
                     $this->url->redirect(array('error', 'code', 'unsupported-by-current-theme'));
                 }
                 if ($module_url == 'noMainPage') {
                     $this->url->redirect(array('error', 'code', 'noMainPage'));
                 }
                 if ($active_theme == FALSE) {
                     $this->url->redirect(array('error', 'code', 'no-theme-installed'));
                 } else {
                     // Load theme handler file
                     include_if_file_exists($active_theme['uri_path'] . '/handler.php');
                     if (class_exists($active_theme['namespace'] . '_theme_handler')) {
                         eval('set_core_vars("active_theme_object",new ' . $active_theme['namespace'] . '_theme_handler());');
                         // Initialize Theme handler;
                     } else {
                         $this->url->redirect(array('error', 'code', 'themeCrashed'));
                     }
                     $TENDOO_MODULE = $module;
                     $Class = $module['namespace'];
                     // REAFFECT CLASS VALUE DUE TO EXISTENT MODULE CLASS
                     include_if_file_exists(MODULES_DIR . $module['encrypted_dir'] . '/library.php');
                     include_once MODULES_DIR . $module['encrypted_dir'] . '/frontend.php';
                 }
                 include_once SYSTEM_DIR . 'Executer.php';
                 /// MODULE EXECUTER
             }
         }
     }
 }
Beispiel #2
0
                                                        : <?php 
            echo $mod['author'];
            ?>
</small> | <small>
                                                        <?php 
            _e('Attributes');
            ?>
                                                        : <?php 
            echo in_array($mod['handle'], array('BLOG', 'INDEX', 'FORUM', 'CONTACT', 'STATIC', 'MEDIA', 'PORTFOLIO', 'APP', 'WIDGETS')) ? $mod['handle'] : 'Inconnu';
            ?>
</small> <strong><small style="float:right;font-size:10px;"><?php 
            echo $mod['version'] == '' ? 'Version Inconnue' : 'v.' . $mod['version'];
            ?>
</small></strong>
                                                        <?php 
            if (TRUE !== ($active_theme = does_active_theme_support($mod['handle'])) && $mod['handle'] != 'APP') {
                ?>
                                                        <hr class="line-dashed" style="margin:5px 0;">
                                                        <div style="color:#FF6464">
                                                            <i class="fa fa-warning" style="font-size:20px;"></i> <?php 
                echo sprintf(__('Active theme %s doesn\'t support this module.'), '<strong>' . $active_theme['name'] . '</strong>');
                ?>
                                                        </div>
                                                        <?php 
            }
            ?>
</td>
                                                    <td class="action"><a class="delete" href="<?php 
            echo $this->instance->url->site_url(array('admin', 'uninstall', 'module', $mod['namespace']));
            ?>
"><i style="font-size:25px;" class="fa fa-trash-o" title="<?php