public function __construct() { // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= parent::__construct(); __extends($this); $this->instance = get_instance(); // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= $this->load->library('install'); $this->load->library('file'); // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= if ($this->instance->db_connected()) { $this->load->library('users_global'); $this->data['options'] = get_meta('all'); trigger_inits(); // For Core menu extension, they are called after default menu. /** * 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 } else { $this->users_global = FALSE; $this->data['options'] = FALSE; } }
public function __construct() { parent::__construct(); // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= $this->instance = get_instance(); // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= $this->load->library('users_global'); $this->load->library('file'); $this->load->library('pagination'); $this->load->library('form_validation'); // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= css_push_if_not_exists('font'); css_push_if_not_exists('../admin-lte/bootstrap/css/bootstrap.min'); css_push_if_not_exists('../admin-lte/font-awesome/font-awesome.4.3.0.min'); css_push_if_not_exists('../admin-lte/dist/css/AdminLTE.min'); css_push_if_not_exists('../admin-lte/plugins/iCheck/square/blue'); js_push_if_not_exists('../admin-lte/plugins/jQuery/jQuery-2.1.3.min'); js_push_if_not_exists('../admin-lte/bootstrap/js/bootstrap.min'); js_push_if_not_exists('../admin-lte/plugins/iCheck/icheck.min'); // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // Has admin ? $this->users_global->hasAdmin() === FALSE ? $this->url->redirect(array('registration', 'superAdmin')) : false; // is Connected ? $this->users_global->isConnected() === TRUE ? $this->url->redirect(array('index')) : false; $this->options = get_meta('all'); set_core_vars('tendoo_notices', trigger_filters('declare_notices', array(get_core_vars('default_notices')))); // @since 1.4 }
public function __construct() { parent::__construct(); $this->instance = get_instance(); $this->db = get_db(); $this->data = array(); $this->options = get_core_vars('options'); // -=-=-=-=-=--=-=-=-=-=-=--=-=-=-=-=-=--=-=-=-=-=-=--=-=-=-=-=-=--=-=-=-=-=-=--=-=-=-=-=-=--=-=-=-=-=-=--= $this->libraries_loader(); // Affecting Libraries */ // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= set_core_vars('admin_menu_items', array('dashboard', 'menu', 'about', 'users', 'controllers', 'installer', 'modules', 'themes', 'settings', 'roles', 'frontend')); // @since 1.4 set_core_vars('admin_menu_position', array('after', 'before')); // @since 1.4 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= $this->__admin_widgets(); // USING core WiDGET and thoses defined through init $this->__creating_menus(); trigger_inits(); // For Core menu extension, they are called after default menu. $this->notices_loader(); $this->file_loader(); if (get_user_meta('tendoo_status') == false && get_instance()->url->method() != 'about') { get_instance()->url->redirect(array('admin', 'about')); } /** * 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 set_page('description', translate('Dashboard') . ' | ' . get('core_version')); /*$this->tendoo_admin->system_not('Modifier vos paramêtre de sécurité', 'Mettez vous à jour avec cette version', '#', '10 mai 2013', null);*/ // Set Default View set_core_vars('inner_head', $this->load->view('admin/inner_head', array(), true, false), 'read_only'); set_core_vars('lmenu', $this->load->view('admin/left_menu', array(), true, false), 'read_only'); }
<?php $this->gui->cols_width(1, 4); $this->gui->set_meta(array('namespace' => core_meta_namespace(array('users', 'edit')), 'title' => __('Edit user'), 'type' => 'panel', 'form_wrap' => array('method' => 'POST')))->push_to(1); $this->gui->set_item(array('type' => 'text', 'attrs' => array('readonly' => 'readonly'), 'value' => $adminInfo['PSEUDO'], 'placeholder' => __('User Pseudo'), 'label' => __('User Pseudo')))->push_to(core_meta_namespace(array('users', 'edit'))); $this->gui->set_item(array('type' => 'text', 'name' => 'user_email', 'placeholder' => __('Enter Email'), 'text' => __('User Email'), 'label' => __('User Email'), 'value' => $adminInfo['EMAIL']))->push_to(core_meta_namespace(array('users', 'edit'))); // Get Roles $text[] = __('User Role'); $value[] = ''; foreach (force_array($get_roles) as $_role) { $value[] = riake('ID', $_role); $text[] = riake('NAME', $_role); } $this->gui->set_item(array('type' => 'select', 'name' => 'edit_priv', 'value' => $value, 'placeholder' => __('Select User Role'), 'text' => $text, 'active' => $adminInfo['REF_ROLE_ID'], 'label' => __('User Role')))->push_to(core_meta_namespace(array('users', 'edit'))); $this->gui->set_item(array('type' => 'hidden', 'name' => 'current_admin', 'value' => $adminInfo['PSEUDO']))->push_to(core_meta_namespace(array('users', 'edit'))); // Loading Generated Fields using "user_fields" hook $user_fields = trigger_filters('user_form_fields', array(get_core_vars('tendoo_user_fields'), $adminInfo['ID'])); // Filter user fields or add foreach (force_array($user_fields) as $field) { $this->gui->set_item($field)->push_to(core_meta_namespace(array('users', 'edit'))); } $this->gui->set_item(array('type' => 'buttons', 'name' => array('set_admin', 'delete_admin'), 'value' => array(__('Save User'), __('Delete User')), 'classes' => array('btn-primary', 'btn-warning'), 'button_types' => array('submit', 'submit'), 'attrs_string' => array('', 'onclick="return confirm( \'' . __('Do you really want to delete this user ?') . '\')" ')))->push_to(core_meta_namespace(array('users', 'edit'))); $this->gui->get();
<?php $this->gui->cols_width(1, 4); // Creating Meta $this->gui->set_meta(array('namespace' => core_meta_namespace(array('users', 'create')), 'title' => __('Create User'), 'type' => 'panel', 'form_wrap' => array('method' => 'post', 'submit_text' => __('Create user'), 'reset_text' => __('Reset Form'))))->push_to(1); $this->gui->set_meta(array('namespace' => 'tips', 'title' => __('How to create a user'), 'type' => 'panel'))->push_to(2); // Creating Fields // Static Fields $this->gui->set_item(array('type' => 'text', 'name' => 'admin_pseudo', 'placeholder' => __('Enter a Username'), 'label' => __('Username')))->push_to(core_meta_namespace(array('users', 'create'))); $this->gui->set_item(array('type' => 'password', 'name' => 'admin_password', 'placeholder' => __('Password'), 'label' => __('Enter a password')))->push_to(core_meta_namespace(array('users', 'create'))); $this->gui->set_item(array('type' => 'password', 'name' => 'admin_password_confirm', 'placeholder' => __('Confirm password'), 'label' => __('Confirm password')))->push_to(core_meta_namespace(array('users', 'create'))); $this->gui->set_item(array('type' => 'text', 'name' => 'admin_password_email', 'placeholder' => __('Email'), 'label' => __('Enter a user email')))->push_to(core_meta_namespace(array('users', 'create'))); $this->gui->set_item(array('type' => 'select', 'name' => 'admin_sex', 'placeholder' => __('Select user sex'), 'value' => array('', 'MASC', 'FEM'), 'text' => array(__('Choose...'), __('Male'), __('Female')), 'label' => __('User Sex')))->push_to(core_meta_namespace(array('users', 'create'))); $roles = array(''); $text = array(__('Choose...')); foreach (force_array($getPrivs) as $_role) { $roles[] = riake('ID', $_role); $text[] = riake('NAME', $_role); } $this->gui->set_item(array('type' => 'select', 'name' => 'admin_privilege', 'placeholder' => __('Select user role'), 'value' => $roles, 'text' => $text, 'label' => __('User role')))->push_to(core_meta_namespace(array('users', 'create'))); // Loading Generated Fields using "user_form_fields" hook $user_fields = trigger_filters('user_form_fields', array(get_core_vars('tendoo_user_fields'))); // Filter user fields or add foreach (force_array($user_fields) as $field) { $this->gui->set_item($field)->push_to(core_meta_namespace(array('users', 'create'))); } $this->gui->get();
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 } } } }