Beispiel #1
0
 function index()
 {
     $data['heading'] = 'SendSMS2India';
     if (belongsToGroup() || isFbLoggedIn()) {
         $data['sms'] = anchor('sms', 'SMS', array('data-icon' => 'custom'));
         $data['contacts'] = anchor('contacts', 'Contacts', array('data-icon' => 'custom'));
         $data['page'] = $this->config->item('FAL_template_dir') . 'template/main';
         $data['header'] = true;
         $data['navigation'] = false;
     } else {
         $data['page'] = $this->config->item('FAL_template_dir') . 'template/home';
         $data['header'] = false;
         $data['navigation'] = true;
     }
     $this->load->vars($data);
     $this->load->view($this->_container);
     //$this->output->enable_profiler(TRUE);
 }
Beispiel #2
0
 /**
  * Handles the case where the one who did the request
  * doesn't have enough credentials
  *
  * if FAL_deny_with_flash_message == true in config file, displays a flash
  * message and redirects to the referer page (or homepage if none)
  *
  * else displays the FAL_denied_page (see config file)
  * -------------------------------
  * EXAMPLE USAGE (in a controller)
  * -------------------------------
  * $this->freakauth_light->denyAccess('user')
  *
  * @param string the role of the one we are denying the access
  */
 function denyAccess($role)
 {
     $this->CI->lang->load('freakauth');
     if ($this->CI->config->item('FAL_deny_with_flash_message')) {
         // if visitor is a GUEST
         if ($role == '') {
             // First, we have to store the requested page in order
             // to serve it back to the visitor after a successful login.
             $this->CI->db_session->set_flashdata('requested_page', $this->CI->uri->uri_string());
             // Then we redirect to the login form with a 'access denied'
             // message. Maybe if the visitor can log in,
             // he'll get some more permissions...
             $msg = $this->CI->lang->line('FAL_no_credentials_guest');
             if (!isFbLoggedIn()) {
                 // added this if by pradeep
                 flashMsg($msg);
                 redirect($this->CI->config->item('FAL_login_uri'), 'location');
             }
         } else {
             $msg = $this->CI->lang->line('FAL_no_credentials_user');
             flashMsg($msg);
             // if visitor came to this site with an http_referer
             if (isset($_SERVER['HTTP_REFERER'])) {
                 $referer = $_SERVER['HTTP_REFERER'];
                 if (preg_match("|^" . base_url() . "|", $referer) == 0) {
                     // if http_referer is from an external site,
                     // users are taken to the page defined in the config file
                     redirect($this->CI->config->item('FAL_denied_from_ext_location'));
                 } else {
                     // if we came from our website, just go to this page back
                     // but maybe we arrived here because of the
                     // 'redirect to requested page', so in order not to
                     $this->CI->db_session->keep_flashdata('requested_page');
                     header("location:" . $_SERVER['HTTP_REFERER']);
                     exit;
                 }
             } else {
                 redirect($this->CI->config->item('FAL_denied_from_ext_location'), 'location');
             }
         }
     } else {
         $page = $this->CI->config->item('FAL_denied_page');
         $data['role'] = $role;
         // this is how we stop the execution
         echo $this->CI->load->view($page, $data, true);
         exit;
     }
 }