function send_to_ios($apnsHost, $apnsCertPath, $device_token, $data) { header('Content-Type: text/html; charset=UTF-8'); $deviceToken = $device_token; /* * $apnsHost * development : gateway.sandbox.push.apple.com * deployment : gateway.push.apple.com */ $apnsPort = 2195; $alert = ''; if (array_key_exists('ios_alert', $data)) { $alert = $data['ios_alert']; } $payload = array('aps' => array('alert' => $alert, 'badge' => 0, 'sound' => 'default')); if (array_key_exists('ios_custom', $data)) { $payload['ios_custom'] = $data['ios_custom']; } $payload = json_encode($payload); $streamContext = stream_context_create(); stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCertPath); $apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext); if ($apns) { $apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '', $deviceToken)) . chr(0) . chr(strlen($payload)) . $payload; fwrite($apns, $apnsMessage); fclose($apns); return TRUE; } //middle.error.log MDI_Log::write('IOS_PUSH_ERROR-' . $this->input->ip_address() . '-' . $this->input->user_agent() . '-' . current_url()); return FALSE; }
function form_open($action = '', $attributes = '', $hidden = array()) { $ING =& get_instance(); $ING->load->helper('url'); if ($attributes == '') { $attributes = 'method="post"'; } // If an action is not a full URL then turn it into one if ($action && strpos($action, '://') === FALSE) { $action = site_url($action); } // If no action is provided then set to the current url $action or $action = current_url(); $form = '<form action="' . $action . '"'; $form .= _attributes_to_string($attributes, TRUE); $form .= '>'; // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites if (config_item('csrf_protection') === TRUE and !(strpos($action, base_url()) === FALSE or strpos($form, 'method="get"'))) { $hidden[$ING->security->get_csrf_token_name()] = $ING->security->get_csrf_hash(); } if (is_array($hidden) and count($hidden) > 0) { $form .= sprintf("<div style=\"display:none\">%s</div>", form_hidden($hidden)); } return $form; }
public function loadpageviews($pagetoload, $cdata = NULL) { if (!file_exists(APPPATH . '/views/' . $pagetoload . '.php')) { // Whoops, we don't have a page for that! show_404(); } $this->load->view('global/view_html_header', $cdata); $this->load->view('global/view_session'); $this->load->view('global/view_header'); $this->passMyGlobalData(); $this->load->view('global/view_top_nav'); //$this->loadmenu(); $this->is_Home(); if (current_url() !== base_url()) { if ($this->pagebanner === true) { $this->load->view('view_page_banner'); } } else { $this->load->view('view_jumbotron'); } $this->load->view($pagetoload); $this->load->view('global/view_footer'); $this->load->view('global/view_sub_footer'); $this->load->view('global/view_html_footer'); }
public function require_login() { if (strlen($this->CI->session->userdata('Name')) == 0) { $this->CI->session->set_flashdata('redirect_url', current_url()); redirect('login'); } }
function maintain_ssl($maintain = FALSE, $port = 443) { $CI =& get_instance(); if ($maintain) { // remove protocol $segments = explode('://', $CI->config->config['base_url']); // explode url into segements $segments = explode('/', $segments[1]); // remove port number $domain = explode(':', $segments[0]); // form temp base url $temp_base_url = 'https://' . $domain[0] . ':' . $port . '/'; // replace segments for ($i = 1; $i < sizeof($segments); $i++) { if ($segments[$i]) { $temp_base_url .= $segments[$i] . '/'; } } // Temporarily overwrite base url $CI->config->config['base_url'] = $temp_base_url; } // if don't maintain but SSL is on -OR- maintain but SSL isn't on, correct by redirect if (!$maintain && !empty($_SERVER['HTTPS']) || $maintain && empty($_SERVER['HTTPS'])) { // Keep flashdata - Requires MY_Session keep_flashdata() $CI->load->library('session'); $CI->session->keep_flashdata(); // Correct by redirect $CI->load->helper('url'); header('Location: ' . current_url() . (empty($_SERVER['QUERY_STRING']) ? '' : '?' . $_SERVER['QUERY_STRING'])); } }
/** * (non-PHPdoc) * * @see \mithra62\BackupPro\Platforms\PlatformInterface::getCurrentUrl() */ public function getCurrentUrl() { if (!function_exists('current_url')) { ee()->load->helper('url'); } return current_url(); }
public function paginacion($segment = 3, $perpage = 10) { $config['base_url'] = current_url(); $config['uri_segment'] = $segment; $config['num_links'] = 4; $config['per_page'] = $perpage; $config['full_tag_open'] = '<div class="pagination"><ul>'; $config['full_tag_close'] = '</ul></div>'; $config['first_link'] = '« Primero'; $config['first_tag_open'] = '<li class="previous">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Ultimo »'; $config['last_tag_open'] = '<li class="next">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = '<i class="fa fa-arrow-right"></i>'; $config['next_tag_open'] = '<li class="next">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '<i class="fa fa-arrow-left"></i>'; $config['prev_tag_open'] = '<li class="previous">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a>'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li>'; $config['num_tag_close'] = '</li>'; $config['anchor_class'] = ''; return $config; }
/** * Create form open * @param array $data Data array * @return string HTML form open */ public function open($data=NULL) { $form_action = NULL; $uri = NULL; if (isset($this->uri)) { $uri = $this->uri; } else { $uri = $data['uri']; if (empty($uri)) { $uri = current_url(); } } if (isset($this->on_success)) { $data['form_action'] = array('form_action' => 'auto'); } $name = isset($this->name) ? $this->name : $data['name']; $data['name'] = $name; $data['id'] = isset($data['id']) ? $data['id'] : $data['name']; if (! $this->render) { $data['id'] = 'form_'.$data['id']; $data['id'] = str_replace('form_form_', 'form_', $data['id']); $data['uri'] = $uri; $this->data[] = array('open' => $data); } $data = $this->_sanitize_param($data); $returns = form_open($uri, $data, $data['form_action']); $this->returns[] = $returns; return $returns; }
/** * Constructor */ function __construct() { parent::__construct(); // must be logged in if (!$this->user) { if (current_url() != base_url()) { //store requested URL to session - will load once logged in $data = array('redirect' => current_url()); $this->session->set_userdata($data); } redirect('login'); } // make sure this user is setup as admin if (!$this->user['is_admin']) { redirect(base_url()); } // load the admin language file $this->lang->load('admin'); // prepare theme name $this->settings->theme = strtolower($this->config->item('admin_theme')); // set up global header data $this->add_css_theme("{$this->settings->theme}.css,summernote-bs3.css")->add_js_theme("summernote.min.js")->add_js_theme("{$this->settings->theme}_i18n.js", TRUE); // declare main template $this->template = "../../htdocs/themes/{$this->settings->theme}/template.php"; }
function setLang($get = array()) { $num = $get ? count($get) : 0; $langconfig = $this->loadConfig('lang'); $this->defaultLang = $langconfig['site_frontlang']; $this->defaultAdminLang = $langconfig['site_adminlang']; switch ($num) { case 0: $this->currentLang = $this->defaultLang; $this->langurl = ''; break; case 1: $langarr = $this->loadLang(); if (isset($get['lang']) && isset($langarr[$get['lang']])) { if ($get['lang'] == $this->defaultLang) { redirect(current_url()); } else { $this->currentLang = $get['lang']; $this->langurl = '?lang=' . $get['lang']; } } else { show_404(); } break; default: show_404(); break; } }
function edit() { // Init $data = array(); $data['breadcrumb'] = set_crumbs(array('navigations/groups' => 'Navigations', current_url() => 'Navigation Edit')); $data['Group'] = $Group = $this->load->model('navigations_model'); $data['edit_mode'] = $edit_mode = FALSE; $group_id = $this->uri->segment(4); if (!empty($group_id)) { $data['edit_mode'] = $edit_mode = TRUE; $Group->get_by_id($group_id); if (!$Group->exists()) { return show_404(); } } $this->form_validation->set_rules('title', 'Title', 'trim|required|max_length[255]'); // Form validation if ($this->form_validation->run() == TRUE) { $Group->from_array($this->input->post()); $Group->save(); $this->session->set_flashdata('message', '<p class="success">Navigation Saved.<p>'); if ($edit_mode) { redirect(ADMIN_PATH . '/navigations'); } else { redirect(ADMIN_PATH . '/navigations/items/tree/' . $Group->id); } } $this->template->view('admin/navigations/edit', $data); }
function __construct($ThemeDirName = '') { parent::__construct(); $this->setThemeDirName($ThemeDirName); $this->site_dir = $this->getConfig('siteDir'); $this->site_current_url = current_url(); }
function save() { $this->form_validation->set_rules('txtstatus', 'Text Status', 'trim|required|htmlspecialchars|xss_clean'); $url = current_url(); $user = $this->session->userdata('username'); $output['message'] = ""; $output['success'] = FALSE; if ($this->form_validation->run() == FALSE) { $output['message'] = validation_errors("<p class='error'>", "</p>"); } else { $id = (string) $this->session->userdata('user_id'); $txtstatus = $this->input->post('txtstatus', TRUE); $this->mongo_db->select_db("Social"); $this->mongo_db->select_collection("Social"); $datatinsert = array('type' => 'StateOfMind', "StateMind" => $txtstatus, "user_id" => $id, 'datetime' => $this->mongo_db->time(strtotime(date("Y-m-d H:i:s")))); $this->mongo_db->insert($datatinsert); $this->m_user->tulis_log("Add New Status", $url, $user); $output['message'] = "<i class='success'>New Data is added</i>"; $output['success'] = TRUE; } if (IS_AJAX) { echo json_encode($output); } else { redirect('member/timeline/index'); } }
public function inserir() { esta_logado(TRUE); $this->form_validation->set_rules('nome', 'NOME', 'trim|required|ucfirst'); $this->form_validation->set_rules('descricao', 'DESCRIÇÃO', 'trim'); if ($this->form_validation->run() == TRUE) { $upload = $this->midia_model->fazer_upload('arquivo'); if (is_array($upload) && $upload['file_name'] != '') { $dados = elements(array('nome', 'descricao'), $this->input->post()); $dados['arquivo'] = $upload['file_name']; $this->midia_model->fazer_insert($dados); } else { define_msg('midiaerro', $upload, 'erro'); redirect(current_url()); } } //vai carregar o modulo usuarios e mostrar a tela de recuperação de senha set_tema('footerinc', '<script> $(document).ready(function() { App.init(); $("#arquivo").fileinput({\'showUpload\':false, \'previewFileType\':\'any\', \'language\':\'pt-BR\',\'allowedFileExtensions\' : [\'jpg\', \'png\',\'gif\'], \'maxFileSize\': 5000, }); }); </script>', FALSE); set_tema('headerinc', load_css('fileinput', 'css/upload/css'), FALSE); set_tema('headerinc', load_js(array('fileinput.min', 'fileinput_locale_pt-BR'), 'js/upload'), FALSE); set_tema('titulo', 'Upload de Imagens'); set_tema('conteudo', load_modulo('midia', 'inserir')); set_tema('rodape', ''); //vai substituir o rodape padrao load_template(); }
function add() { $data['action'] = 'Add'; /* for insert page */ if ($this->form_validate() == FALSE) { $data['error_message'] = validation_errors(); } else { $postdata = array('page_title' => 'About Me', 'page_content' => $this->input->post('page_content'), 'published' => 1); //echo '<pre>';print_r($postdata);die; $table['name'] = 'dumkal_pages'; $success = $this->Common_model->save_data($table, $postdata); if ($success) { $this->session->set_flashdata('success_message', 'Page Content successfully inserted'); redirect('admin/manage_pages'); } else { $this->session->set_flashdata('error_message', 'Invalid username or password! Please try again.'); redirect(current_url()); } } /* for insert page */ $data['head'] = $this->load->view('admin/elements/head', '', true); $data['header'] = $this->load->view('admin/elements/header', '', true); $data['left_sidebar'] = $this->load->view('admin/elements/left-sidebar', '', true); $data['footer'] = $this->load->view('admin/elements/footer', '', true); $data['maincontent'] = $this->load->view('admin/maincontents/add-edit-page-view', $data, true); $this->load->view('admin/layout_after_login', $data); }
/** * Set previous page * * @access public * @param void * @return void */ public function set_previous_page() { class_exists('Session') or $this->load->library('session'); if (!in_array(uri_string(), $this->ignored_pages)) { $this->session->set_userdata('previous_page', current_url()); } }
public function __construct() { parent::__construct(); $this->load->model('visual_themes')->library('template'); // Determine the current visual theme. if ($this->input->get('theme') != '' && $this->input->method() == 'get' && !$this->input->is_ajax_request()) { $theme = (string) $this->input->get('theme'); $this->visual_themes->set_current($theme); parse_str(parse_url(CURRENT_URL, PHP_URL_QUERY), $query); unset($query['theme']); redirect(http_build_url(current_url(), array('query' => http_build_query($query)))); } $this->template->set_theme($this->visual_themes->get_current()); $default_title = config_item('default_title'); $default_description = config_item('default_description'); $default_keywords = config_item('default_keywords'); if ($default_title != '') { $this->template->title($default_title); } if ($default_description != '') { $this->template->set_metadata('description', $default_description); } if ($default_keywords != '') { $this->template->set_metadata('keywords', $default_keywords); } $this->template->set_breadcrumb('<i class="fa fa-home"></i> ' . $this->lang->line('ui_home'), site_url()); }
function edit() { if ($this->input->get('id')) { $lec = $this->model->getBy(array("id" => $this->input->get('id')), 1); if (!is_object($lec)) { show_404(); } $this->form_validation->set_rules('form[name]', 'Name', 'required'); $this->form_validation->set_rules('form[salary]', 'Salary', 'price'); if ($this->form_validation->run() == TRUE) { if ($this->model->update($this->input->post('form'), "id = " . $this->input->get('id'))) { $this->session->set_flashdata('valid', 'Record Update Successfully'); } else { $this->session->set_flashdata('error', 'Record Uopdate Failure !!!'); } redirect(current_url() . "?id=" . $this->input->get('id')); } else { if ($this->input->post()) { $this->session->set_flashdata('error', validation_errors()); } } $this->load->view('sys/employee/employee_create', array('result' => $lec)); } else { show_404(); } }
public function getDial() { if (empty($this->dial)) { $this->dial = $this->response->dial(NULL, array('action' => current_url(), 'callerId' => $this->callerId, 'timeout' => $this->default_timeout, 'sequential' => $this->sequential ? 'true' : 'false')); } return $this->dial; }
public function check_login() { if ($this->session->userdata('logged_in') != 1) { $return_url = current_url(); redirect(site_url('/login') . '?return_url=' . $return_url); } }
public function index() { // if($this->input->ip_address() == '10.52.65.39') { // echo "<pre>"; // var_dump($this->session->all_userdata()); // die; // } //if($this->input->ip_address() == '10.52.66.100') { // echo "<pre>"; var_dump($this->session->all_userdata()); // die; //} //var_dump($this->user->get_infos_group($this->session->userdata('iduser'))); //die; if (!$this->session->userdata('iduser')) { if ($this->input->get('sid')) { if ($this->decrypt($this->input->get('sid'))) { $this->session->set_userdata('iduser', $this->decrypt($this->input->get('sid'))); } else { $this->session->set_userdata('saved_url', current_url()); redirect(base_url('/index.php')); } } else { $this->session->set_userdata('saved_url', current_url()); redirect(base_url('/index.php')); } } $vars['title'] = "Base de Loisirs de Kribi - Perenco Cameroun"; $vars['nom'] = $this->user->get_nom(); if (!$this->user->is_athorized_user($this->session->userdata('iduser'))) { $this->load->view('access_denied', $vars); } else { //$this->load->view('templates/header', $vars); $this->load->view('base_loisir', $vars); } }
public function edit($commentId) { //Checks if the user is admin if (!is_admin()) { show_404(current_url()); } //Set the validation rules $this->load->library('form_validation'); $validation_rules = array(array('field' => 'comment_user_name', 'label' => 'Nombre', 'rules' => 'required'), array('field' => 'comment_user_email', 'label' => 'Email', 'rules' => 'required'), array('field' => 'comment_content', 'label' => 'Comentario', 'rules' => 'required')); $this->form_validation->set_rules($validation_rules); //If the form has been submited it process the data and creates the comment if ($this->form_validation->run()) { /* ** Gets the comment data ** */ //Gets the comment id $commentData['comment_id'] = $commentId; //Gets the comment content $commentData['comment_content'] = $this->input->post('comment_content'); //Gets the user data $commentData['comment_user_name'] = $this->input->post('comment_user_name'); $commentData['comment_user_email'] = $this->input->post('comment_user_email'); $commentData['comment_user_url'] = $this->input->post('comment_user_url'); //Updates the comment $this->CommentModel->editComment($commentData); //Redirects to the comment header('location: ' . comment_url($commentId)); } else { $commentData = $this->CommentModel->getComment($commentId); $data['comment'] = $commentData['comment']; $data['title'] = 'Editar Comentario'; $this->load->view('templates/header', $data); $this->load->view('templates/admin/menu'); $this->load->view('comments/edit_comment', $data); $this->load->view('templates/footer'); } }
/** * Displays a list of form data. * * @return void */ public function index() { // Deleting anything? if (isset($_POST['delete'])) { $checked = $this->input->post('checked'); if (is_array($checked) && count($checked)) { $result = FALSE; foreach ($checked as $pid) { $result = $this->activity_documents_model->delete($pid); } if ($result) { Template::set_message(count($checked) . ' ' . lang('activity_documents_delete_success'), 'success'); } else { Template::set_message(lang('activity_documents_delete_failure') . $this->activity_documents_model->error, 'error'); } } } $records = $this->activity_documents_model->find_all(); $total = $this->activity_documents_model->count_all(); // Pagination $this->load->library('pagination'); $offset = $this->input->get('per_page'); $limit = 10; $this->pager['base_url'] = current_url() . '?'; $this->pager['total_rows'] = $total; $this->pager['per_page'] = $limit; $this->pager['page_query_string'] = TRUE; $this->pagination->initialize($this->pager); Template::set('records', $this->activity_documents_model->limit($limit, $offset)->find_all()); //Template::set('records', $records); Template::set('toolbar_title', 'Manage Activity Documents'); Template::render(); }
function vasp_breadcrumbs($trail_delimeter = '»', $open_tag = '<p>', $close_tag = '</p>') { $CI =& get_instance(); $CI->load->helper('inflector'); $breadcrumbs = array(); if (count($breadcrumbs) == 0) { $url_parts = array(); $segment = $CI->uri->segment_array(); $last_segment = array_pop($segment); foreach ($segment as $url_ref) { // Skip if we already have this breadcrumb and its not admin //if(in_array($url_ref, $url_parts) or $url_ref == 'admin') continue; $url_parts[] = $url_ref; $breadcrumbs[] = array('name' => humanize(str_replace('-', ' ', $url_ref)), 'url' => implode('/', $url_parts), 'current_page' => FALSE); } $url_parts[] = $last_segment; $breadcrumbs[] = array('name' => humanize(str_replace('-', ' ', $last_segment)), 'url' => implode('/', $url_parts), 'current_page' => TRUE); } // Build HTML to output $html = $open_tag . '<a href="' . site_url('home') . '">Home</a> '; foreach ($breadcrumbs as $breadcrumb) { if (!$breadcrumb['current_page']) { $html .= $trail_delimeter . ' ' . '<a href="' . site_url($breadcrumb['url']) . '">' . $breadcrumb['name'] . '</a> '; } elseif (current_url() === site_url('home') || uri_string() === '') { $html .= ''; } else { $html .= $trail_delimeter . ' ' . $breadcrumb['name']; } } $html .= $close_tag; echo $html; }
public function error_404() { $this->output->set_status_header('404'); $this->breadcrumbs->push('<i class="icon-sitemap"></i> 404 Page Not Found', current_url()); $this->data['page_title'] = '404 Page Not Found'; $this->load->view($this->tpl, $this->data); }
/** * 修改管理员 */ public function update($admin_id) { $admin = $this->input->post('Admin'); if ($admin) { $res = $this->load_model('admin_model')->update_admin($admin_id, $admin); if (isset($res['error'])) { $this->session->keep_flashdata('from_list_page'); $this->session->set_flashdata('admin', $admin); $this->session->set_flashdata('error_message', $res['error']); redirect(current_url()); } $this->session->set_flashdata('success_message', '操作成功'); redirect($this->session->flashdata('from_list_page')); } $this->session->set_flashdata('from_list_page', $_SERVER['HTTP_REFERER']); if ($this->session->flashdata('admin')) { $this->view->assign($this->session->flashdata('admin')); } else { $admin = $this->load_model('admin_model')->get_admin_by_id($admin_id); $this->view->assign($admin); } // 权限分组 $group_actions = $this->config->item('group_actions'); $this->view->assign('group_actions', $group_actions); // 权限点 $access_actions = $this->config->item('access_actions'); $this->view->assign('access_actions', $access_actions); $this->view->assign('admin_id', $admin_id); $this->view->display('system/admin_update.html'); }
public function index() { $this->session->set_tempdata('previous_url', current_url()); if ($this->input->post() and $this->_reserveTable() === TRUE) { redirect('reservation/success'); } $this->template->setBreadcrumb('<i class="fa fa-home"></i>', '/'); $this->template->setBreadcrumb($this->lang->line('text_heading'), 'reservation'); $this->template->setTitle($this->lang->line('text_heading')); $this->template->setHeading($this->lang->line('text_heading')); $data['text_login_register'] = $this->customer->isLogged() ? sprintf($this->lang->line('text_logout'), $this->customer->getName(), site_url('account/logout')) : sprintf($this->lang->line('text_login'), site_url('account/login')); $data['reset_url'] = site_url('reservation'); if ($this->input->post('first_name')) { $data['first_name'] = $this->input->post('first_name'); } else { if ($this->customer->getFirstName()) { $data['first_name'] = $this->customer->getFirstName(); // retrieve customer first name from customer library } else { $data['first_name'] = ''; } } if ($this->input->post('last_name')) { $data['last_name'] = $this->input->post('last_name'); } else { if ($this->customer->getLastName()) { $data['last_name'] = $this->customer->getLastName(); // retrieve customer last name from customer library } else { $data['last_name'] = ''; } } if ($this->input->post('email')) { $data['email'] = $this->input->post('email'); } else { if ($this->customer->getEmail()) { $data['email'] = $this->customer->getEmail(); // retrieve customer email address from customer library } else { $data['email'] = ''; } } if ($this->input->post('telephone')) { $data['telephone'] = $this->input->post('telephone'); } else { if ($this->customer->getTelephone()) { $data['telephone'] = $this->customer->getTelephone(); // retrieve customer telephone from customer library } else { $data['telephone'] = ''; } } if ($this->input->post('comment')) { $data['comment'] = $this->input->post('comment'); } else { $data['comment'] = ''; } $data['captcha'] = $this->createCaptcha(); $this->template->render('reservation', $data); }
public function index() { $data = array(); $this->load->library('pagination'); $per_page = 50; $data['breadcrumb'] = set_crumbs(array('reports/quote/' => 'Reports', current_url() => 'Quote')); $reportModel = $this->load->model('reports/report_model'); $sort = $this->input->get('sort') != "" ? $this->input->get('sort') : ''; $order = $this->input->get('order') != "" ? $this->input->get('order') : ''; $data['query_string'] = !empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''; $limit = $this->uri->segment(5) ? $this->uri->segment(5) : 0; $config['base_url'] = site_url(ADMIN_PATH . '/reports/quote/index/'); $trows = count($reportModel->getQuoteReportsCount()); $config['total_rows'] = $trows; $config['per_page'] = $per_page; $config['uri_segment'] = '5'; $config['num_links'] = 5; $config['suffix'] = $data['query_string']; $this->pagination->initialize($config); $filter = $this->input->get('filter') ? $this->input->get('filter') : ''; $data['no_pages'] = ceil($config['total_rows'] / $per_page); $data['total'] = $config['total_rows']; $data['limit'] = $limit; $data['per_page'] = $config['per_page']; $reports = $reportModel->getQuoteReports($sort, $order, $per_page, $limit, $filter); $data['reports'] = $reports; // print_r($data);exit; $this->template->view('admin/quote', $data); }
function form_open($action = '', $attributes = array(), $hidden = array()) { $CI =& get_instance(); // If no action is provided then set to the current url if (!$action) { $action = current_url($action); } elseif (strpos($action, '://') === FALSE) { $action = if_secure_site_url($action); } $attributes = _attributes_to_string($attributes); if (stripos($attributes, 'method=') === FALSE) { $attributes .= ' method="post"'; } if (stripos($attributes, 'accept-charset=') === FALSE) { $attributes .= ' accept-charset="' . strtolower(config_item('charset')) . '"'; } $form = '<form action="' . $action . '"' . $attributes . ">\n"; // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites if ($CI->config->item('csrf_protection') === TRUE && strpos($action, if_secure_base_url()) !== FALSE && !stripos($form, 'method="get"')) { $hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash(); } // Add MY CSRF token if MY CSRF library is loaded if ($CI->load->is_loaded('tokens') && strpos($action, if_secure_base_url()) !== FALSE && !stripos($form, 'method="get"')) { $hidden[$CI->tokens->name] = $CI->tokens->token(); } if (is_array($hidden)) { foreach ($hidden as $name => $value) { $form .= '<input type="hidden" name="' . $name . '" value="' . html_escape($value) . '" style="display:none;" />' . "\n"; } } return $form; }
/** * List of pages */ public function index() { // Set page $page = $this->input->get('page') ? $this->input->get('page') : 1; $locale = $this->input->get('locale') ? $this->input->get('locale') : config_item('selected_locale'); $this->setReturnLink($this->sessionName); // Delete checked item if ($this->input->post('action') == 'delete_checked') { foreach ($this->input->post('check_item') as $item => $value) { // Delete page $this->page->delete($item); } // Set message and refresh the page $this->session->set_flashdata('success', lang('alert.success.delete_checked')); redirect(current_url()); } // Get number of items for pager $this->page_translations->generate_like_query($this->input->get('string')); $numberOfItems = $this->page_translations->where('locale', $locale)->count(); // Init pagination $paginationLimits = $this->initPagination($numberOfItems, $page); $this->page_translations->generate_like_query($this->input->get('string')); $pages = $this->page_translations->where('locale', $locale)->limit($paginationLimits['limit'], $paginationLimits['limit_offset'])->with_root()->get_all(); // Set view data $this->data['pages'] = $this->prepare_join_data($pages, 'root'); $this->data['pager'] = $this->pagination->create_links(); $this->data['subnav_active'] = 'index'; $this->data['selected_language'] = $this->config->item($locale, 'system_languages_by_locale')->name; // Load the view $this->render('page/index', $this->data); }