public function index() { $active_theme = get_core_vars('active_theme'); $setting_key = $active_theme['namespace'] . '_theme_settings'; $this->load->library('form_validation'); $this->form_validation->set_rules('api_limit', 'API LIMIT', 'required'); $this->form_validation->set_rules('declared_apis', 'Declared API', 'required'); $this->form_validation->set_rules('declared_item', 'Declared Item', 'required'); // For Static using API if ($this->form_validation->run()) { if ($active_theme) { $datas_get = get_meta($setting_key); $saved_settings = $datas_get ? $datas_get : array(); // If there are same setting already saved, they'll be overwrited $saved_settings[$this->input->post('declared_item')] = array('api_limit' => $this->input->post('api_limit'), 'declared_apis' => $this->input->post('declared_apis'), 'declared_item' => $this->input->post('declared_item')); if (set_meta($active_theme['namespace'] . '_theme_settings', $saved_settings)) { notice('push', fetch_notice_output('done')); } } } // For Static not draggable if ($this->input->post('is_static_item')) { $this->load->library('form_validation'); if ($static = return_if_array_key_exists('static', $_POST)) { if (is_array($static)) { $active_theme = get_core_vars('active_theme'); $saved_settings = get_meta($active_theme['namespace'] . '_theme_settings'); foreach ($static as $namespace => $item) { if (is_array($item)) { foreach ($item as $name => $fields) { $saved_settings[$namespace][$name] = $fields; } } } if (set_meta($active_theme['namespace'] . '_theme_settings', $saved_settings)) { notice('push', fetch_notice_output('done')); } } } } // Add Settings to Core vars push_core_vars('active_theme', 'theme_settings', get_meta($setting_key)); set_page('title', 'TIM | ' . get('core_version')); return $this->load->view($this->module_metas['uri_path'] . 'views/body', $this->data, true, true); }
public function edit($page_id) { $this->load->library('form_validation'); $this->form_validation->set_rules('page_title', __('Page Title'), 'trim|required'); $this->form_validation->set_rules('page_id', __('Page Id'), 'trim|required'); $this->form_validation->set_rules('page_description', __('Page description'), 'trim|required'); $this->form_validation->set_rules('page_content', __('Content field'), 'trim|required'); if ($this->form_validation->run()) { $post_page = $this->lib->set_page($this->input->post('page_title'), $this->input->post('page_content'), $this->input->post('page_description'), $this->input->post('page_parent') ? $this->input->post('page_parent') : 0, $this->input->post('page_controller_id') ? $this->input->post('page_controller_id') : 0, $process_type = 'edit', $this->input->post('page_status') ? 1 : 0, $this->input->post('page_id')); notice('push', fetch_notice_output($post_page)); } set_page('title', __('Page creator > Create a page')); set_core_vars('available_controllers', $this->lib->get_available_controllers($page_id)); set_core_vars('available_pages', $this->lib->get_pages('all_but_not', $page_id)); set_core_vars('current_page', $this->lib->get_pages('filter_id', $page_id)); $this->visual_editor->loadEditor(1); return $this->load->view($this->opened_module['uri_path'] . 'views/edit', $this->data, true, TRUE); }
public function code($e) { // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= set_core_vars('code', notice('push', fetch_notice_output($e))); set_core_vars('body', $this->load->view('error/inner_body', $this->data, TRUE)); // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= set_page('title', translate('Error - Tendoo')); // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 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'); // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= $this->load->view('header', $this->data); $this->load->view('error/global_body', $this->data); // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= }
public function superAdmin() { // Has Admin ? $this->users_global->hasAdmin() === TRUE ? $this->instance->url->redirect(array('login')) : false; $this->instance->form_validation->set_rules('super_admin_pseudo', __('Pseudo'), 'trim|required|min_length[5]|max_length[15]'); $this->instance->form_validation->set_rules('super_admin_password', __('Password'), 'trim|required|min_length[6]|max_length[15]'); $this->instance->form_validation->set_rules('super_admin_password_confirm', __('Confirm Password'), 'trim|required|min_length[6]|matches[super_admin_password]'); $this->instance->form_validation->set_rules('super_admin_mail', __('Email'), 'trim|valid_email|required'); $this->instance->form_validation->set_rules('super_admin_sex', __('Sex selection'), 'trim|required|min_length[3]|max_length[4]'); if ($this->instance->form_validation->run()) { if ($this->instance->users_global->createSuperAdmin($this->instance->input->post('super_admin_pseudo'), $this->instance->input->post('super_admin_password'), $this->instance->input->post('super_admin_sex'), $this->instance->input->post('super_admin_mail'))) { $this->instance->url->redirect(array('login?notice=user-has-been-created&ref=' . urlencode($this->instance->url->site_url(array('admin', 'index'))))); } notice('push', fetch_notice_output('super-admin-creation-failed')); } set_core_vars('pageTitle', __('Create Admin - Tendoo')); set_page('title', get_core_vars('pageTitle')); set_page('description', __('Create Super Admin - Tendoo')); set_core_vars('body', $this->load->view('registration/createSuperAdmin', true)); $this->load->view('header'); $this->load->view('global_body'); }
public function index($page = 1, $action = "", $element = '') { if (isset($_POST['tewi_wid'])) { $result = $this->lib->save_widgets($_POST['tewi_wid']); if (is_array($result)) { $this->instance->notice->push_notice(tendoo_info($result['success'] . ' widget(s) has been created. ' . $result['error'] . ' error(s)')); } else { $this->instance->notice->push_notice(fetch_notice_output($result)); } } $this->instance->file->js_push('jquery-ui-1.10.4.custom.min'); $this->instance->file->js_url = $this->instance->url->main_url() . $this->data['module_dir'] . '/js/'; $this->instance->file->js_push('tewi_script'); $this->instance->file->css_url = $this->instance->url->main_url() . $this->data['module_dir'] . '/css/'; $this->instance->file->css_push('style'); $this->data['modules'] = get_modules('filter_active'); $this->data['finalMod'] = array(); foreach ($this->data['modules'] as $module) { if ($module['has_widget'] == true) { $widget_config_file = MODULES_DIR . $module['encrypted_dir'] . '/config/widget_config.php'; if (file_exists($widget_config_file)) { include_once $widget_config_file; if (isset($WIDGET_CONFIG)) { foreach ($WIDGET_CONFIG as $wc) { $this->data['finalMod'][] = $wc; } } } } } $this->data['widgets_left'] = $this->lib->tewi_getWidgets('left'); $this->data['widgets_right'] = $this->lib->tewi_getWidgets('right'); $this->data['widgets_bottom'] = $this->lib->tewi_getWidgets('bottom'); // var_dump($this->data['widgets_right']); set_page('title', __('Tendoo - Manage Widgets')); $this->data['body'] = $this->load->view($this->data['module_dir'] . '/views/body', $this->data, true, TRUE); return $this->data['body']; }
tendoo.notice.alert('<?php echo addslashes(strip_tags(fetch_notice_output($notice))); ?> ','warning');
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 attempt_db_connection($host, $user, $pass, $db_name, $type, $extension) { $this->instance = get_instance(); $config['hostname'] = $host; $config['username'] = $user; $config['password'] = $pass; $config['database'] = $db_name; $config['dbdriver'] = $type; $config['dbprefix'] = !preg_match('#^tendoo#', $extension) ? $extension : 'td_'; $config['pconnect'] = TRUE; $config['db_debug'] = TRUE; $config['cache_on'] = FALSE; $config['cachedir'] = ""; $config['char_set'] = "utf8"; $config['dbcollat'] = "utf8_general_ci"; $config['autoinit'] = TRUE; $config['stricton'] = FALSE; $this->db = DB($config, TRUE); if (!defined('DB_ROOT')) { define('DB_ROOT', $config['dbprefix']); } $this->connexion_status = $this->db->initialize(); if ($this->connexion_status === TRUE) { $_SESSION['db_datas'] = $config; return true; } notice('push', fetch_notice_output($this->connexion_status)); return false; }
/** * Set an error message * * @param string * @return void */ public function set_error($msg) { $CI = get_instance(); $CI->lang->load('upload'); if (is_array($msg)) { foreach ($msg as $val) { $CI->notice->push_notice(fetch_notice_output($val)); } } else { $CI->notice->push_notice(fetch_notice_output($msg)); } }
$('#controller_creation_error_contener').html(''); tendoo.notice.alert('<?php echo addslashes(strip_tags(fetch_notice_output($result))); ?> ','warning');
} set_blog_comment(array('author' => $final_user, 'authorlink' => $author_link, 'content' => $c['CONTENT'], 'timestamp' => $c['DATE'])); } } set_pagination(array('innerLink' => $pagination[4], 'currentPage' => $currentPage)); // Intégration du formulaire de réponse. if ($this->instance->users_global->isConnected()) { $pseudo = $this->instance->users_global->current('PSEUDO'); $email = $this->instance->users_global->current('EMAIL'); } else { $pseudo = ''; $email = ''; } // REPLY FORM if ($setting['EVERYONEPOST'] == 0) { if ($userUtil->isConnected()) { set_form('blog_single_reply_form', array('type' => 'text', 'name' => 'pseudo', 'value' => $pseudo, 'placeholder' => 'Entrez votre pseudo', 'text' => 'Entrez votre pseudo')); set_form('blog_single_reply_form', array('type' => 'text', 'name' => 'mail', 'value' => $email, 'placeholder' => 'Entrez votre email', 'text' => 'Entrez votre email')); set_form('blog_single_reply_form', array('type' => 'textarea', 'name' => 'content', 'placeholder' => 'Entrez votre commentaireE', 'text' => 'Entrez votre commentaire')); set_form('blog_single_reply_form', array('type' => 'submit', 'value' => 'Publier le commentaire')); } else { get_instance()->notice->push_notice(fetch_notice_output('connectToComment')); } } else { set_form('blog_single_reply_form', array('type' => 'text', 'name' => 'pseudo', 'value' => $pseudo, 'placeholder' => 'Entrez votre pseudo', 'text' => 'Entrez votre pseudo')); set_form('blog_single_reply_form', array('type' => 'text', 'name' => 'mail', 'value' => $email, 'placeholder' => 'Entrez votre email', 'text' => 'Entrez votre email')); set_form('blog_single_reply_form', array('type' => 'textarea', 'name' => 'content', 'placeholder' => 'Entrez votre commentaire', 'text' => 'Entrez votre commentaire')); set_form('blog_single_reply_form', array('type' => 'submit', 'value' => 'Publier le commentaire')); } // Affichage du single article $theme->blog_single();
function fetch_notice_from_url() { $notice = ''; $info = ''; if (isset($_GET['notice'])) { $notice = fetch_notice_output($_GET['notice']); } if (isset($_GET['info'])) { $info = tendoo_info($_GET['info']); } return $notice . $info; }
public function overwrite_image($image_id, $x1, $y1, $x2, $y2, $w, $h) { $image = $this->getUploadedFiles($image_id); if ($image) { $config['image_library'] = 'gd2'; $config['source_image'] = $this->cp_dir . '/' . $image[0]['FILE_NAME']; $config['create_thumb'] = FALSE; $config['maintain_ratio'] = FALSE; $config['width'] = $w; $config['height'] = $h; $config['quality'] = '100%'; $config['x_axis'] = $x1; $config['y_axis'] = $y1; $this->load->library('image_lib'); $this->instance->image_lib->initialize($config); $this->instance->image_lib->crop(); $notice = $this->instance->image_lib->display_errors(); $this->_createThumb($image_id); if ($notice != '') { $this->instance->notice->push_notice(fetch_notice_output($notice)); } return true; } return false; }
public function setting() { if (current_user_can('blogster_setting@blogster')) { if (isset($_POST['update'])) { $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="alert alert-danger"><button type="button" class="close" data-dismiss="alert"><i class="icon-remove"></i></button><i style="font-size:18px;margin-right:5px;" class="icon-warning-sign"></i>', '</div>'); $this->form_validation->set_rules('validateall', '', ''); $this->form_validation->set_rules('allowPublicComment', '', ''); $this->form_validation->set_rules('update', '', ''); if ($this->form_validation->run()) { if ($this->news->setBlogsterSetting($this->input->post('validateall'), $this->input->post('allowPublicComment'))) { notice('push', fetch_notice_output('done')); } else { notice('push', fetch_notice_output('error-occured')); } // modification des parametres } } if (isset($_FILES['import'])) { $config['file_name'] = 'backup'; $config['overwrite'] = TRUE; $config['upload_path'] = $this->link; $config['allowed_types'] = 'json'; $config['remove_spaces'] = TRUE; $this->load->library('upload', $config, null, $this); $this->upload->do_upload('import'); if (is_file($this->link . 'backup.json')) { $content = file_get_contents($this->link . 'backup.json'); $fullArray = json_decode($content, TRUE); $status = $this->news->doImport($fullArray); notice('push', tendoo_info($status['success'] . ' requête(s) a/ont correctement été exécutée(s), ' . $status['error'] . ' requête(s) n\'a/ont pas pu être exécutée(s)')); unlink($this->link . 'backup.json'); } } if ($this->input->post('export')) { // Prevent output ob_clean(); $options = get_core_vars('options'); // exportation des données header('Content-type: application/octect-stream'); header('Content-Disposition: attachment; filename="' . $options['site_name'] . '_blogster_backup.json"'); echo $this->news->export(); die; } $this->data['setting'] = $this->news->getBlogsterSetting(); set_page('title', __('Blogster - Settings')); $this->data['body'] = $this->load->view(MODULES_DIR . $this->opened_module['encrypted_dir'] . '/views/setting', $this->data, false, TRUE); } else { $this->url->redirect(array('admin', 'index?notice=accessDenied')); } }
public function passchange($email, $timestamp, $password) { if ($timestamp > $this->instance->date->timestamp()) { if ($this->users_global->emailExist($email)) { // Library $this->load->library('Tendoo_admin'); if (riake('allow_registration', $this->options) == "0") { $this->url->redirect(array('error', 'code', 'registration-disabled')); } $connect = $this->users_global->emailConnect($email, $password); if ($connect) { $this->load->library('form_validation'); $this->form_validation->set_rules('password_new', translate('New password'), 'trim|required|min_length[6]|max_length[30]'); $this->form_validation->set_rules('password_new_confirm', translate('Confirm password'), 'trim|required|matches[password_new]'); if ($this->form_validation->run()) { $query = $this->users_global->recoverPassword($connect['ID'], $password, $this->input->post('password_new')); if ($query == 'password-has-changed') { $this->url->redirect(array('login?notice=' . $query)); } else { notice(fetch_notice_output($query)); } } set_core_vars('pageTitle', translate('Changing Password - Tendoo')); set_page('title', get_core_vars('pageTitle')); set_core_vars('menu', $this->load->view('login/recovery_menu', true)); set_core_vars('body', $this->load->view('login/password_change', true)); $this->load->the_view('header'); $this->load->the_view('global_body'); } else { $this->url->redirect(array('error', 'code', 'activation-failed')); } } else { $this->url->redirect(array('error', 'code', 'unknow-email')); } } else { $this->url->redirect(array('error', 'code', 'expiration-time-reached')); } }
public function manage($id) { if (!current_user_can('tendoo_contents@upload_media')) { $this->url->redirect(array('admin', 'index?notice=accessDenied')); } $this->file->js_url = $this->url->main_url() . $this->data['module_dir'] . '/js/'; $this->file->css_url = $this->url->main_url() . $this->data['module_dir'] . '/css/'; $this->file->js_push('jquery.Jcrop.min'); $this->file->css_push('jquery.Jcrop.min'); $this->load->library('form_validation'); if ($this->input->post('delete_file')) { if (!current_user_can('tendoo_contents@delete_media')) { $this->url->redirect(array('admin', 'index?notice=accessDenied')); } $this->form_validation->set_rules('delete_file', '', 'trim|required'); $this->form_validation->set_rules('content_id', '', 'trim|required|is_numeric'); if ($this->form_validation->run()) { $query = $this->file_contentAdmin->fileDrop($this->input->post('content_id')); if ($query) { $this->url->redirect(array('admin', 'open', 'modules', $this->opened_module['namespace'] . '?notice=done')); } else { $this->notice->push_notice(fetch_notice_output('error-occured')); } } } if ($this->input->post('edit_file')) { $this->load->library('form_validation'); $this->form_validation->set_rules('file_name', 'Le nom du fichier', 'trim|required|min_length[5]|max_length[40]'); $this->form_validation->set_rules('file_description', 'La description du fichier', 'trim|required|min_length[5]|max_length[200]'); $this->form_validation->set_rules('content_id', '', 'trim|required|min_length[1]'); $this->form_validation->set_rules('edit_file', '', 'trim|required|min_length[1]'); if ($this->form_validation->run()) { $query = $this->file_contentAdmin->editFile($this->input->post('content_id'), $this->input->post('file_name'), $this->input->post('file_description')); if ($query) { module_location(array('manage', $this->input->post('content_id') . '?notice=done')); } else { $this->notice->push_notice(fetch_notice_output('error-occured')); } } } if ($this->input->post('overwrite_file')) { $this->load->library('form_validation'); $this->form_validation->set_rules('overwrite_file', 'Ecraser l\'image', 'trim|required|min_length[5]|max_length[40]'); $this->form_validation->set_rules('x1', 'cordonnée', 'trim|required|min_length[1]'); $this->form_validation->set_rules('y1', 'cordonnée', 'trim|required|min_length[1]'); $this->form_validation->set_rules('x2', 'cordonnée', 'trim|required|min_length[1]'); $this->form_validation->set_rules('y2', 'cordonnée', 'trim|required|min_length[1]'); $this->form_validation->set_rules('w', 'cordonnée', 'trim|required|min_length[1]'); $this->form_validation->set_rules('h', 'cordonnée', 'trim|required|min_length[1]'); $this->form_validation->set_rules('image_id', 'Index de l\'image', 'trim|required|min_length[1]'); if ($this->form_validation->run()) { $query = $this->lib->overwrite_image($this->input->post('image_id'), $this->input->post('x1'), $this->input->post('y1'), $this->input->post('x2'), $this->input->post('y2'), $this->input->post('w'), $this->input->post('h')); if ($query) { $this->notice->push_notice(fetch_notice_output('done')); } else { $this->notice->push_notice(fetch_notice_output('error-occured')); } } } if ($this->input->post('change_file')) { $this->load->library('form_validation'); $this->form_validation->set_rules('content_id', 'cordonnée', 'trim|required|min_length[1]'); if ($this->form_validation->run()) { $query = $this->lib->fileReplace($this->input->post('content_id'), 'new_file'); $this->notice->push_notice(fetch_notice_output($query)); } } if ($this->input->post('create_new_file')) { $this->load->library('form_validation'); $this->form_validation->set_rules('create_new_file', 'Ecraser l\'image', 'trim|required|min_length[5]|max_length[40]'); $this->form_validation->set_rules('x1', 'cordonnée', 'trim|required|min_length[1]'); $this->form_validation->set_rules('y1', 'cordonnée', 'trim|required|min_length[1]'); $this->form_validation->set_rules('x2', 'cordonnée', 'trim|required|min_length[1]'); $this->form_validation->set_rules('y2', 'cordonnée', 'trim|required|min_length[1]'); $this->form_validation->set_rules('w', 'cordonnée', 'trim|required|min_length[1]'); $this->form_validation->set_rules('h', 'cordonnée', 'trim|required|min_length[1]'); $this->form_validation->set_rules('image_id', 'Index de l\'image', 'trim|required|min_length[1]'); if ($this->form_validation->run()) { $query = $this->lib->create_new_image($this->input->post('image_id'), $this->session->userdata('fileNewName'), $this->input->post('x1'), $this->input->post('y1'), $this->input->post('x2'), $this->input->post('y2'), $this->input->post('w'), $this->input->post('h')); $this->notice->push_notice(fetch_notice_output($query)); } } set_page('title', __('Editing Media')); $this->data['fileNewName'] = $this->lib->getName(); $this->session->set_userdata('fileNewName', $this->data['fileNewName']); $this->data['getFile'] = $this->file_contentAdmin->getUploadedFiles($id); if (count($this->data['getFile']) == 0) { $this->url->redirect(array('error', 'code', 'page-404')); } $this->data['id'] = $id; $this->data['loadSection'] = 'manage'; $this->data['body'] = $this->load->view(MODULES_DIR . $this->opened_module['encrypted_dir'] . '/views/manage', $this->data, true, TRUE); return $this->data['body']; }
public function users($options = '', $x = 1, $y = '', $z = '') { current_user()->cannot('system@manage_users') ? $this->url->redirect(array('admin', 'index?notice=accessDenied')) : false; if ($options == 'create') { $this->form_validation->set_rules('admin_pseudo', translate('Pseudo'), 'trim|required|min_length[5]|max_length[15]'); $this->form_validation->set_rules('admin_password', translate('Password'), 'trim|required|min_length[6]|max_length[30]'); $this->form_validation->set_rules('admin_password_confirm', translate('Password Confirm'), 'trim|required|matches[admin_password]'); $this->form_validation->set_rules('admin_sex', translate('Sex'), 'trim|min_length[3]|max_length[5]'); $this->form_validation->set_rules('admin_password_email', translate('email'), 'trim|valid_email|required'); $this->form_validation->set_rules('admin_privilege', translate('Select privilege'), 'trim|required'); if ($this->form_validation->run()) { $creation_status = $this->users_global->createAdmin($this->input->post('admin_pseudo'), $this->input->post('admin_password'), $this->input->post('admin_sex'), $this->input->post('admin_privilege'), $this->input->post('admin_password_email')); switch ($creation_status) { case 'notAllowedPrivilege': notice('push', fetch_notice_output('users-creation-failed')); break; case 'user-has-been-created': $this->url->redirect(array('admin', 'users?notice=user-has-been-created')); break; case 'users-creation-failed': $this->url->redirect(array('admin', 'users', 'create?notice=users-creation-failed')); } } set_core_vars('getPrivs', $this->roles->get()); set_page('title', translate('Manage Users - Tendoo')); $this->load->the_view('admin/users/create'); } else { if ($options == 'edit') { if ($this->input->post('set_admin')) { $this->form_validation->set_rules('current_admin', translate('About current user'), 'trim|required|min_length[5]'); $this->form_validation->set_rules('edit_priv', translate('Edit his privilege'), 'trim|required'); $this->form_validation->set_rules('user_email', translate('Email'), 'trim|valid_email'); if ($this->form_validation->run()) { $query = $this->users_global->setAdminPrivilege($this->input->post('edit_priv'), $this->input->post('current_admin'), $this->input->post('user_email')); notice('push', fetch_notice_output($query)); } } if ($this->input->post('delete_admin')) { $this->form_validation->set_rules('current_admin', translate('About current user'), 'trim|required|min_length[5]'); $this->form_validation->set_rules('delete_admin', translate('Edit his privilege'), 'trim|required|min_length[1]'); if ($this->form_validation->run()) { if ($this->users_global->deleteSpeAdmin($this->input->post('current_admin'))) { $this->url->redirect(array('admin', 'users?notice=adminDeleted')); } else { notice('push', fetch_notice_output('error-occured')); } } } set_core_vars('get_roles', $this->roles->get()); set_core_vars('adminInfo', $adminInfo = $this->users_global->getSpeAdminByPseudo($x)); set_page('title', sprintf(translate('User profile : %s - Tendoo'), $adminInfo['PSEUDO'])); $this->load->the_view('admin/users/edit'); } else { set_core_vars('users_nbr', count($this->users_global->getAdmin())); set_core_vars('paginate', $paginate = $this->tendoo->paginate(10, get_core_vars('users_nbr'), 1, 'bg-color-red fg-color-white', '', $x, $this->url->site_url(array('admin', 'system', 'users')) . '/')); set_core_vars('get_users', $this->users_global->getAdmin($paginate[1], $paginate[2])); set_page('title', translate('Manage users - Tendoo')); $this->load->the_view('admin/users/users'); } } }