public function __construct($data) { parent::__construct(); __extends($this); $this->data = $data; $this->data['page'] = get_core_vars('page'); $this->data['module'] = get_core_vars('module'); $this->data['current_page'] = get_core_vars('page'); // Setting Bread $this->data['current_page'] = get_core_vars('page'); set_bread(array('link' => get_instance()->url->site_url(array($this->data['current_page'][0]['PAGE_CNAME'])), 'text' => $this->data['current_page'][0]['PAGE_CNAME'])); // End }
public function index($parameters) { // var_dump( $parameters ); set_core_vars('pages_editor_parameters', $parameters); set_core_vars('pages_editor_loaded_page', $static_page = $this->lib->get_static_page($parameters), 'read_only'); if (is_array($static_page)) { if (is_array(return_if_array_key_exists('THREAD', $static_page[0]))) { foreach ($static_page[0]['THREAD'] as $_thread) { $_current_page = $this->lib->get_pages('filter_title_url', $_thread); if ($_current_page) { if (return_if_array_key_exists('THREAD', $_current_page[0])) { set_bread(array('link' => get_instance()->url->site_url($_current_page[0]['THREAD']), 'text' => $_current_page[0]['TITLE'])); } } } } } set_core_vars('module_content', $this->load->view($this->module['uri_path'] . '/views/common', $this->data, true, TRUE)); get_core_vars('active_theme_object')->head($this->data); get_core_vars('active_theme_object')->body($this->data); }
public function lecture($text, $page = 1) { // CE n'est pas au module de faire les chargement nécessaire pour le fonctionnement du theme. // Must be retreiving data $showAsAdmin = FALSE; // montrer l'article, même si ce dernier n'est pas publié if (isset($_GET['mode'])) { // Reservé aux administrateurs if ($this->users_global->isAdmin()) { $showAsAdmin = $_GET['mode'] == 'preview' ? TRUE : FALSE; } else { $this->url->redirect(array('error', 'code', 'accessDenied')); } } $this->data['GetNews'] = $this->data['news']->getSpeNews($text, $showAsAdmin, 'filter_url_title'); if (!$this->data['GetNews']) { module_location(array('index?unknowArticle')); } // Setting Bread $current_page = get_core_vars('page'); set_bread(array('link' => get_instance()->url->site_url(array($this->data['current_page'][0]['PAGE_CNAME'], 'lecture', $this->data['GetNews'][0]['URL_TITLE'])), 'text' => 'lecture')); set_bread(array('link' => "#", 'text' => $this->data['GetNews'][0]['TITLE'])); // End $this->load->library('form_validation'); $this->form_validation->set_rules('pseudo', 'Pseudo', 'required|max_length[15]'); $this->form_validation->set_rules('mail', 'Email', 'required|valid_email'); $this->form_validation->set_rules('content', 'Contenu', 'required|max_length[1000]'); if ($this->form_validation->run()) { // Provisoire $this->input->post('author'); $result = $this->data['news']->postComment($this->data['GetNews'][0]['ID'], $this->input->post('content'), $this->input->post('pseudo'), $this->input->post('email')); if ($result) { if ($this->data['setting']['APPROVEBEFOREPOST'] == 0) { notice('push', fetch_notice_output('done')); } else { notice('push', fetch_notice_output('submitedForApproval')); } } } $this->data['getKeywords'] = $this->data['news']->getNewsKeyWords($this->data['GetNews'][0]['ID']); $this->data['ttComments'] = $this->data['news']->countComments($this->data['GetNews'][0]['ID']); $this->data['pagination'] = $this->tendoo->paginate(10, $this->data['ttComments'], 1, 'active', '', $page, $this->url->site_url(array('blog', 'read', $this->data['GetNews'][0]['ID'], $text)) . '/'); $this->data['currentPage'] = $page; $this->data['Comments'] = $this->data['news']->getComments($this->data['GetNews'][0]['ID'], $this->data['pagination'][1], $this->data['pagination'][2]); if (!$this->data['GetNews']) { $this->url->redirect(array('error/code/page-404')); } $this->data['news']->pushView($this->data['GetNews'][0]['ID']); $keyWords = ''; if (count($this->data['getKeywords']) > 0) { for ($i = 0; $i < count($this->data['getKeywords']); $i++) { if (array_key_exists($i + 1, $this->data['getKeywords'])) { $keyWords .= $this->data['getKeywords'][$i]['TITLE'] . ','; } else { $keyWords .= $this->data['getKeywords'][$i]['TITLE']; } } } set_page('title', 'Article - ' . $this->data['GetNews'][0]['TITLE']); set_page('description', strip_tags($this->data['GetNews'][0]['CONTENT'])); set_page('keywords', $keyWords); get_core_vars('active_theme_object')->definePageTitle($this->data['page'][0]['PAGE_TITLE']); get_core_vars('active_theme_object')->definePageDescription($this->data['page'][0]['PAGE_DESCRIPTION']); // Load View set_core_vars('module_content', $this->load->view(MODULES_DIR . $this->data['module']['encrypted_dir'] . '/views/common_open', $this->data, true, TRUE)); // Load View From Theme selected; get_core_vars('active_theme_object')->head($this->data); get_core_vars('active_theme_object')->body($this->data); }
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 } } } }