function uninstall_module($namespace) { $module = get_modules('filter_namespace', $namespace); // Disabling Module unactive_module($namespace); // Removing module actions get_db()->where('MOD_NAMESPACE', $module['namespace'])->delete('tendoo_modules_actions'); // Include uninstall.php for more uninstall task include_if_file_exists($module['uri_path'] . 'uninstall.php'); // Droping module repository return get_instance()->tendoo_admin->drop($module['uri_path']); }
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 } } } }
public function open($e = '', $a = '', $b = '') { if ($e == 'modules') { // Si la re-écriture est activé, on réduit l'index. // Sauf si dans l'url le fichier index.php est appelé. if (!in_array('index.php', $this->url->getSplitedUrl())) { $index = $this->url->getRewrite() == true ? 1 : 0; } else { $index = 0; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= $module = get_modules('filter_active_namespace', $a); // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= set_core_vars('opened_module', $module, 'read_only'); // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= if (get_core_vars('opened_module')) { // Définition d'un titre par défaut set_page('title', $module['namespace'] . ' | ' . translate('Dashboard')); if (!is_file(MODULES_DIR . $module['encrypted_dir'] . '/backend.php')) { $this->exceptions->show_error(translate('Several Error'), translate('Some files required for this module are missing. Reinstalling this module may fix this issue')); exit; } include_if_file_exists(MODULES_DIR . $module['encrypted_dir'] . '/library.php'); include_once MODULES_DIR . $module['encrypted_dir'] . '/backend.php'; $Parameters = $this->url->http_request(TRUE); if (array_key_exists(4 - $index, $Parameters)) { $Method = $Parameters[4 - $index]; } else { $Method = 'index'; } for ($i = 0; $i < 5 - $index; $i++) { array_shift($Parameters); } set_core_vars('interpretation', $interpretation = $this->tendoo->interpreter($module['namespace'] . '_backend', $Method, $Parameters), 'read_only'); if ($interpretation == '404') { $this->url->redirect(array('error', 'code', 'page-404')); } if (is_array($interpretation)) { if (array_key_exists('MCO', $interpretation)) { if ($interpretation['MCO'] == TRUE) { $BODY = array(); $BODY['RETURNED'] = array_key_exists('RETURNED', $interpretation) ? $interpretation['RETURNED'] : $this->exceptions->show_error(translate('interpretation unclear'), translate('The interpretation returns a array that does not contain the "RETURNED" key. The module loaded return incorrect or incomplete array.')); // If array key forget, get all content as interpretation. $BODY['MCO'] = $interpretation['MCO']; set_core_vars('body', $BODY); // If current module require GUI, let GUI handle header and global_body if (!in_array('gui', riake('require', $module, array()))) { $this->load->view('admin/global_body', $this->data, false, false); } } } else { $this->exceptions->show_error(translate('interpretation unclear'), translate('The interpretation returns a array that does not contain the "MCO" key. The module loaded return incorrect or incomplete array.')); } } else { // If nothing is returned, tendoo foresee that module use GUI library. if (!is_null($interpretation)) { $BODY['RETURNED'] = $interpretation; $BODY['MCO'] = FALSE; set_core_vars('body', $BODY); // If current module require GUI, let GUI handle header and global_body if (!in_array('gui', riake('require', $module, array()))) { $this->load->view('admin/header', $this->data, false, false); $this->load->view('admin/global_body', $this->data, false, false); } } } } else { $this->url->redirect(array('admin/modules?notice=unactive-or-unknow-module')); } } else { $this->url->redirect(array('error', 'code', 'page-404')); } }
function uninstall_theme($namespace) { $theme = get_themes('filter_namespace', $namespace); if ($theme) { // Disabling Theme unactive_theme($namespace); // Include uninstall.php for more uninstall task include_if_file_exists($theme['uri_path'] . 'uninstall.php'); // Droping module repository return get_instance()->tendoo_admin->drop($theme['uri_path']); } return false; }