public function index($page = 1) { notice('push', tendoo_info(__('Page childs wont be available on frontend it that page is set as draft'))); if (isset($_POST['page_id']) && return_if_array_key_exists('action', $_POST) == 'delete') { if (is_array($_POST['page_id'])) { foreach ($_POST['page_id'] as $_page_id) { $this->lib->delete_page($_page_id); } notice(fetch_notice_output('done')); } } $totalPerPages = isset($_GET['limit']) ? $_GET['limit'] : 10; set_core_vars('totalPages', $totalPages = count($this->lib->get_pages('all_available'))); $paginate = pagination_helper($totalPerPages, $totalPages, $page, module_url(array('index')), $RedirectUrl = array('error', 'code', 'page-404')); set_core_vars('paginate', $paginate); $get_pages = $this->lib->get_pages('all_limited', $paginate['start'], $paginate['end']); set_core_vars('get_pages', $get_pages); set_page('title', __('Page Creator')); $this->load->view($this->opened_module['uri_path'] . 'views/main', $this->data, false, TRUE); }
public function __posttype_controller($namespace, $page = 'list', $id = 0, $taxonomy_arg1 = 'list', $taxonomy_arg2 = 0) { if ($this->current_posttype = riake($namespace, $this->config->item('posttypes'))) { $data['current_posttype'] = $this->current_posttype; $data['post_namespace'] = $namespace; if ($page === 'list') { $id = $id === 0 ? 1 : $id; $post_limit = 20; $post_nbr = count($this->current_posttype->get()); $pagination = pagination_helper($post_limit, $post_nbr, $id, site_url(array('dashboard', 'posttype', $namespace, 'list')), site_url(array('error', 'code', 'page-404'))); $this->config->set_item('pagination_data', $pagination); $post = $this->current_posttype->get(array(array('limit' => array('start' => riake('start', $pagination), 'end' => riake('end', $pagination))))); $data['post'] = $post; $data['post_list_label'] = $this->current_posttype->posts_list_label; $this->gui->set_title($this->current_posttype->posts_list_label); $this->load->view('../modules/post_type/views/list', $data, false); } else { if ($page === 'new') { $data['post_namespace'] = $namespace; $data['new_post_label'] = $this->current_posttype->new_post_label; $this->load->library('form_validation'); $this->form_validation->set_rules('post_title', __('Post title')); if ($this->form_validation->run()) { $return = $this->current_posttype->set($this->input->post('post_title'), $this->input->post('post_content'), riake('post_meta', $_POST, array()), riake('post_taxonomy', $_POST, array()), $this->input->post('post_status'), $this->input->post('post_parent'), $status = 'set'); if (riake('msg', $return) === 'custom-query-saved') { redirect(array('dashboard', 'posttype', $namespace, 'edit', riake('id', $return) . '?notice=' . riake('msg', $return))); } get_instance()->notice->push_notice($this->lang->line(riake('msg', $return))); } $this->gui->set_title($this->current_posttype->new_post_label); $this->load->view('../modules/post_type/views/create', $data, false); } else { if ($page === 'edit') { $this->load->library('form_validation'); $this->form_validation->set_rules('post_title', __('Post title')); if ($this->form_validation->run()) { $return = $this->current_posttype->update($this->input->post('post_title'), $this->input->post('post_content'), riake('post_meta', $_POST, array()), riake('post_taxonomy', $_POST, array()), $this->input->post('post_status'), $this->input->post('post_parent'), $status = 'publish', $id); if (riake('msg', $return) === 'custom-query-saved') { redirect(array('dashboard', 'posttype', $namespace, 'edit', riake('id', $return) . '?notice=' . riake('msg', $return))); } get_instance()->notice->push_notice($this->lang->line(riake('msg', $return))); } // print_array( get_core_vars( 'post' ) );die; $this->gui->set_title($this->current_posttype->edit_post_label); $this->load->view('../modules/post_type/views/edit', array('post_namespace' => $namespace, 'new_post_label' => $this->current_posttype->new_post_label, 'current_posttype' => $this->current_posttype, 'post' => farray($this->current_posttype->get(array(array('where' => array('id' => $id)))))), false); } else { if ($page === 'taxonomy') { // $id is taxonomy namespace here if (in_array($id, array_keys(force_array($taxonomy = $this->current_posttype->query->get_defined_taxonomies())))) { $data = array(); $data['current_taxonomy'] = $current_taxonomy = riake($id, $taxonomy); $data['taxonomy_namespace'] = $taxonomy_namespace = $id; $data['taxonomy'] = $taxonomy; $data['taxonomy_list_label'] = riake('taxonomy-list-label', $current_taxonomy); $data['post_namespace'] = $namespace; if ($taxonomy_arg1 === 'list') { $taxonomy_limit = 20; $taxonomy_arg2 = $taxonomy_arg2 === 0 ? 1 : $taxonomy_arg2; $taxonomies_nbr = count($this->current_posttype->query->get_taxonomies($taxonomy_namespace)); $pagination = pagination_helper($taxonomy_limit, $taxonomies_nbr, $taxonomy_arg2, site_url(array('dashboard', 'posttype', $namespace, $page, $id, $taxonomy_arg1)), site_url(array('error', 'code', 'page-404'))); $data['taxonomy_list_label'] = riake('taxonomy-list-label', $current_taxonomy); $data['taxonomies'] = $this->current_posttype->query->get_taxonomies($taxonomy_namespace, $pagination['start'], $pagination['end']); $data['taxonomies_nbr'] = $taxonomies_nbr; $data['pagination'] = $pagination; $data['current_taxonomy'] = $current_taxonomy; $this->gui->set_title(riake('new-taxonomy-label', $current_taxonomy)); $this->load->view('../modules/post_type/views/taxonomy-list', $data); } else { if ($taxonomy_arg1 === 'new') { $this->load->library('form_validation'); $this->form_validation->set_rules('taxonomy_title', __('Taxonomy Title'), 'required'); if ($this->form_validation->run()) { $result = $this->current_posttype->query->set_taxonomy($data['taxonomy_namespace'], $this->input->post('taxonomy_title'), $this->input->post('taxonomy_content'), in_array($this->input->post('taxonomy_parent'), array(false, ''), TRUE) ? null : $this->input->post('taxonomy_parent')); get_instance()->notice->push_notice($this->lang->line($result)); } $this->gui->set_title(riake('new-taxonomy-label', $current_taxonomy, __('New taxonomy'))); $this->load->view('../modules/post_type/views/taxonomy-create', $data, false); } else { if ($taxonomy_arg1 === 'edit') { $this->load->library('form_validation'); $this->form_validation->set_rules('taxonomy_title', __('Taxonomy Title'), 'required'); if ($this->form_validation->run()) { $result = $this->current_posttype->query->update_taxonomy($id, $this->input->post('taxonomy_title'), $this->input->post('taxonomy_content'), $taxonomy_arg2, in_array($this->input->post('taxonomy_parent'), array(false, ''), TRUE) ? null : $this->input->post('taxonomy_parent')); get_instance()->notice->push_notice($this->lang->line('taxonomy-set')); } $data['taxonomy_id'] = $taxonomy_arg2; $data['get_taxonomy'] = farray($this->current_posttype->query->get_taxonomies($taxonomy_namespace, $taxonomy_arg2, 'as_id')); $this->gui->set_title(riake('edit-taxonomy-label', $current_taxonomy, __('Edit taxonomy'))); $this->load->view('../modules/post_type/views/taxonomy-edit', $data); } } } } else { redirect(array('dashboard', 'error', 'unknow-taxonomy')); } } else { if ($page === 'comments') { if ($id === 'approve' && $taxonomy_arg1 != 0) { $exec = $this->current_posttype->query->comment_status($taxonomy_arg1, 1); if ($exec == 'comment-edited') { redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=' . $exec)); } redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=error-occured')); } else { if ($id === 'disapprove' && $taxonomy_arg1 != 0) { $exec = $this->current_posttype->query->comment_status($taxonomy_arg1, 4); if ($exec == 'comment-edited') { redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=' . $exec)); } redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=error-occured')); } else { if ($id === 'trash' && $taxonomy_arg1 != 0) { $exec = $this->current_posttype->query->comment_status($taxonomy_arg1, 3); if ($exec == 'comment-edited') { redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=' . $exec)); } redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=error-occured')); } else { if ($id === 'draft' && $taxonomy_arg1 != 0) { $exec = $this->current_posttype->query->comment_status($taxonomy_arg1, 0); if ($exec == 'comment-edited') { redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=' . $exec)); } redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=error-occured')); } else { if ($id === 'delete' && $taxonomy_arg1 != 0) { $exec = $this->current_posttype->query->delete_comment($taxonomy_arg1, 'as_id'); if ($exec == 'comment-edited') { redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=' . $exec)); } redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=error-occured')); } } } } } // $this->current_posttype->query->post_comment( 1 , 'Custom' , $author = false , $mode = 'create' , $comment_id = null , $author_name = 'Blair' , $author_email = '*****@*****.**' , $reply_to = false ); $id = $id === 0 ? 1 : $id; $comment_limit = 10; $comments_nbr = count($this->current_posttype->query->get_comments()); $pagination = pagination_helper($comment_limit, $comments_nbr, $id, site_url(array('dashboard', 'posttype', $namespace, 'comments')), site_url(array('error', 'code', 'page-404'))); $comments = $this->current_posttype->query->get_comments(array('limit' => array('start' => riake('start', $pagination), 'end' => riake('end', $pagination)))); $this->config->set_item('comments', $comments); $this->config->set_item('comments_list_label', $this->current_posttype->comments_list_label); $this->gui->set_title($this->current_posttype->comments_list_label); $this->load->view('../modules/post_type/views/comments-list', array('pagination_data' => $pagination, 'post_namespace' => $namespace, 'comments_list_label' => $this->current_posttype->comments_list_label, 'comments' => $comments), false); } else { if ($page === 'comment-edit') { } } } } } } } else { redirect(array('dashboard', 'error', 'unknow-post-type')); } }
public function tags($tags_name = '', $page = 1) { $this->data['keyWords'] = $this->news->keyWordExists($tags_name, 'filter_url_title'); if (!$this->data['keyWords']) { module_location(array('index?notice=unknowKeyWord')); } $this->data['countArticles'] = count($this->news->getKeyWordsArticles($this->data['keyWords'][0]['ID'], null, null, 'filter_id')); $this->data['paginate'] = pagination_helper(10, $this->data['countArticles'], $page, module_url(array('tags')), $RedirectUrl = array('error', 'code', 'page-404')); $this->data['tagArticles'] = $this->data['news']->getKeyWordsArticles($this->data['keyWords'][0]['URL_TITLE'], $this->data['paginate']['start'], $this->data['paginate']['end'], 'filter_url_title'); // $title = $this->data['page'][0]['PAGE_TITLE'] . ' » ' . $this->data['keyWords'][0]['TITLE'] . ' (mot-clé)'; $description = strip_tags($this->data['keyWords'][0]['DESCRIPTION']); // Fetching KeyWords Description // set_page('title', $title); set_page('description', $description); // get_core_vars('active_theme_object')->definePageTitle($title); get_core_vars('active_theme_object')->definePageDescription($description); // if ($this->data['tagArticles'] == false) { $this->data['tagArticles'] = array(array('TITLE' => 'Aucune publication disponible', 'CONTENT' => 'Aucune publication n\'est disponible pour ce mot-clé', 'AUTEUR' => '1', 'DATE' => get_instance()->date->datetime(), 'THUMB' => $this->url->img_url('hub_back.png'), 'IMAGE' => $this->url->img_url('hub_back.png'), 'ID' => 0)); } $this->data['section'] = 'keywords'; set_core_vars('module_content', $this->load->view(MODULES_DIR . $this->data['module']['encrypted_dir'] . '/views/common_keywords', $this->data, true, TRUE)); // ----------------------------------------------------------------------------------------------------------------------------------// get_core_vars('active_theme_object')->head($this->data); get_core_vars('active_theme_object')->body($this->data); }
public function posttype($namespace, $page = 'list', $id = 0, $taxonomy_arg1 = 'list', $taxonomy_arg2 = 0) { if ($this->current_posttype = riake($namespace, get_core_vars('posttypes'))) { set_core_vars('current_posttype', $this->current_posttype); set_core_vars('post_namespace', $namespace); if ($page === 'list') { $id = $id === 0 ? 1 : $id; $post_limit = 20; $post_nbr = count($this->current_posttype->get()); $pagination = pagination_helper($post_limit, $post_nbr, $id, get_instance()->url->site_url(array('admin', 'posttype', $namespace, 'list')), get_instance()->url->site_url(array('error', 'code', 'page-404'))); set_core_vars('pagination_data', $pagination); $post = $this->current_posttype->get(array('limit' => array('start' => riake('start', $pagination), 'end' => riake('end', $pagination)))); set_core_vars('post', $post); set_core_vars('post_list_label', $this->current_posttype->posts_list_label); set_page('title', $this->current_posttype->posts_list_label, 'Post List Label [#Unexpected error occured]'); $this->load->the_view('admin/posttypes/list', false); } else { if ($page === 'new') { set_core_vars('post_namespace', $namespace); set_core_vars('new_post_label', $this->current_posttype->new_post_label); $this->load->library('form_validation'); $this->form_validation->set_rules('post_title', __('Post title')); if ($this->form_validation->run()) { $return = $this->current_posttype->set($this->input->post('post_title'), $this->input->post('post_content'), riake('post_meta', $_POST), riake('post_taxonomy', $_POST), $this->input->post('post_status'), $this->input->post('post_parent'), $status = 'set'); if (riake('msg', $return) === 'custom-query-saved') { get_instance()->url->redirect(array('admin', 'posttype', $namespace, 'edit', riake('id', $return) . '?notice=' . riake('msg', $return))); } get_instance()->notice->push_notice(fetch_notice_output(riake('msg', $return))); } set_page('title', $this->current_posttype->new_post_label, 'Post List Label [#Unexpected error occured]'); $this->load->the_view('admin/posttypes/create', false); } else { if ($page === 'edit') { set_core_vars('post_namespace', $namespace); set_core_vars('new_post_label', $this->current_posttype->new_post_label); $this->load->library('form_validation'); $this->form_validation->set_rules('post_title', __('Post title')); if ($this->form_validation->run()) { $return = $this->current_posttype->update($this->input->post('post_title'), $this->input->post('post_content'), riake('post_meta', $_POST), riake('post_taxonomy', $_POST), $this->input->post('post_status'), $this->input->post('post_parent'), $status = 'publish', $id); if (riake('msg', $return) === 'custom-query-saved') { get_instance()->url->redirect(array('admin', 'posttype', $namespace, 'edit', riake('id', $return) . '?notice=' . riake('msg', $return))); } get_instance()->notice->push_notice(fetch_notice_output(riake('msg', $return))); } set_core_vars('post', farray($this->current_posttype->get(array('where' => array('id' => $id))))); // print_array( get_core_vars( 'post' ) );die; set_page('title', $this->current_posttype->edit_post_label, 'Post List Label [#Unexpected error occured]'); $this->load->the_view('admin/posttypes/edit', false); } else { if ($page === 'taxonomy') { // $id is taxonomy namespace here if (in_array($id, array_keys(force_array($taxonomy = $this->current_posttype->query->get_defined_taxonomies())))) { set_core_vars('current_taxonomy', $current_taxonomy = riake($id, $taxonomy)); set_core_vars('taxonomy_namespace', $taxonomy_namespace = $id); set_core_vars('taxonomy', $taxonomy); set_core_vars('taxonomy_list_label', riake('taxonomy-list-label', $current_taxonomy)); if ($taxonomy_arg1 === 'list') { $taxonomy_limit = 20; $taxonomy_arg2 = $taxonomy_arg2 === 0 ? 1 : $taxonomy_arg2; set_core_vars('taxonomies_nbr', $taxonomies_nbr = count($this->current_posttype->query->get_taxonomies($taxonomy_namespace))); set_core_vars('pagination', $pagination = pagination_helper($taxonomy_limit, $taxonomies_nbr, $taxonomy_arg2, get_instance()->url->site_url(array('admin', 'posttype', $namespace, $page, $id, $taxonomy_arg1)), get_instance()->url->site_url(array('error', 'code', 'page-404')))); set_core_vars('taxonomies', $this->current_posttype->query->get_taxonomies($pagination['start'], $pagination['end'])); set_page('title', riake('new-taxonomy-label', $current_taxonomy), 'Post List Label [#Unexpected error occured]'); $this->load->the_view('admin/posttypes/taxonomy-list', false); } else { if ($taxonomy_arg1 === 'new') { $this->load->library('form_validation'); $this->form_validation->set_rules('taxonomy_title', __('Taxonomy Title'), 'required'); if ($this->form_validation->run()) { $result = $this->current_posttype->query->set_taxonomy($id, $this->input->post('taxonomy_title'), $this->input->post('taxonomy_content'), in_array($this->input->post('taxonomy_parent'), array(false, ''), TRUE) ? null : $this->input->post('taxonomy_parent')); get_instance()->notice->push_notice(fetch_notice_output($result)); } set_page('title', riake('new-taxonomy-label', $current_taxonomy, __('New taxonomy')), 'Post List Label [#Unexpected error occured]'); $this->load->the_view('admin/posttypes/taxonomy-create', false); } else { if ($taxonomy_arg1 === 'edit') { $this->load->library('form_validation'); $this->form_validation->set_rules('taxonomy_title', __('Taxonomy Title'), 'required'); if ($this->form_validation->run()) { $result = $this->current_posttype->query->update_taxonomy($id, $this->input->post('taxonomy_title'), $this->input->post('taxonomy_content'), in_array($this->input->post('taxonomy_parent'), array(false, ''), TRUE) ? null : $this->input->post('taxonomy_parent'), $taxonomy_arg2); get_instance()->notice->push_notice(fetch_notice_output('taxonomy-set')); } set_core_vars('taxonomy_id', $taxonomy_arg2); set_core_vars('get_taxonomy', farray($this->current_posttype->query->get_taxonomies($taxonomy_namespace, $taxonomy_arg2, 'as_id'))); set_page('title', riake('edit-taxonomy-label', $current_taxonomy, __('Edit taxonomy')), 'Post List Label [#Unexpected error occured]'); $this->load->the_view('admin/posttypes/taxonomy-edit', false); } } } } else { $this->url->redirect(array('error', 'code', 'unknow-taxonomy')); } } else { if ($page === 'comments') { if ($taxonomy_arg1 == 'approve') { } else { if ($taxonomy_arg1 == 'disapprove') { } else { if ($taxonomy_arg1 == 'trash') { } else { if ($taxonomy_arg1 == 'draft') { } } } } // $this->current_posttype->query->post_comment( 1 , 'Custom' , $author = false , $mode = 'create' , $comment_id = null , $author_name = 'Blair' , $author_email = '*****@*****.**' , $reply_to = false ); $id = $id === 0 ? 1 : $id; $comment_limit = 10; $comments_nbr = count($this->current_posttype->query->get_comments()); $pagination = pagination_helper($comment_limit, $comments_nbr, $id, get_instance()->url->site_url(array('admin', 'posttype', $namespace, 'comments')), get_instance()->url->site_url(array('error', 'code', 'page-404'))); set_core_vars('pagination_data', $pagination); $comments = $this->current_posttype->query->get_comments(array('limit' => array('start' => riake('start', $pagination), 'end' => riake('end', $pagination)))); set_core_vars('comments', $comments); set_core_vars('comments_list_label', $this->current_posttype->comments_list_label); set_page('title', $this->current_posttype->comments_list_label, 'Post List Label [#Unexpected error occured]'); $this->load->the_view('admin/posttypes/comments-list', false); } else { if ($page === 'comment-edit') { } } } } } } } else { $this->url->redirect(array('error', 'code', 'unknow-post-type')); } }
public function tags($action = 'index', $page = 1) { if (current_user_can('blogster_manage_tags@blogster')) { // Get All keyWords $this->data['totalKeyWords'] = count($this->news->getAllPopularKeyWords('all')); // Starting Pagination $_elPP = isset($_GET['limit']) ? $_GET['limit'] : 10; $this->data['paginate'] = pagination_helper($_elPP, $this->data['totalKeyWords'], $page, module_url(array('tags', 'index'))); // Get KeyWord Using Page Pagination $this->data['getKeywords'] = $this->news->getAllPopularKeyWords('limitedTo', $this->data['paginate']['start'], $this->data['paginate']['end']); // Set Page Title set_page('title', __('Blogster - Manage Tags')); $this->data['body'] = $this->load->view(MODULES_DIR . $this->opened_module['encrypted_dir'] . '/views/keywords_main', $this->data, true, TRUE, $this); return $this->data['body']; } else { module_location('?notice=accessDenied'); } }