%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php class MY_Controller extends CI_Controller { function __construct() { parent::__construct(); //header('Access-Control-Allow-Origin: *'); $origin=$this->input->server('HTTP_ORIGIN'); header('Access-Control-Allow-Origin: '.$origin); header('Access-Control-Allow-Credentials: true'); header('Access-Control-Allow-Headers: Content-Type, Origin, Accept, AuthToken'); if ($this->input->method() == 'options') { header('HTTP/1.1 200 OK'); header('Access-Control-Allow-Headers: Content-Type, Origin, Accept, AuthToken'); header('Access-Control-Allow-Methods: POST, GET, OPTIONS'); header('Access-Control-Max-Age: 86400'); die; } date_default_timezone_set('Asia/Kolkata'); define('IS_AJAX', $this->input->is_ajax_request()?TRUE:FALSE); define('IS_POST', $this->input->method()=='post'?TRUE:FALSE); $this->db->query("SET sql_mode=''"); $this->load->model('common_model', 'common'); $dtl=$this->loggedData(); define('USER_ID', $dtl['id']?$dtl['id']:''); define('USER_TYPE', $dtl['type']); define('IS_ADMIN', USER_TYPE=='ADMIN'); define('LEAD_RESTRICT', (int)$dtl['lead_restrict']); if(IS_POST){ $this->req=array('required'=>'%s required', 'is_unique'=>'This %s is already used', 'numeric'=>'%s must be numeric', 'integer'=>'%s must be integer'); $this->load->library('form_validation'); } } function loggedData(){ $dtl=get_session(USR_SESSION_NAME); return $dtl?$dtl:[]; } function json_data($res, $jsonNumChk=false){ header('Content-Type: application/json'); $res=$res?$res:array(); /*if($this->config->item('csrf_protection')===TRUE){ $res['csrf_token']=$this->security->get_csrf_token_name(); $res['csrf_hash']=$this->security->get_csrf_hash(); }*/ if($jsonNumChk){ die(json_encode($res, JSON_NUMERIC_CHECK)); } die(json_encode($res)); } function img_ext_check($v, $param='image'){ if($_FILES[$param]['name'] and !check_image_ext($_FILES[$param]['name'])){ $this->form_validation->set_message('img_ext_check', 'Please upload .jpg, .jpeg, .gif or .png file only'); return FALSE; }else{ return TRUE; } } function valid_date($v){ if($v && !is_valid_date($v)){ $this->form_validation->set_message("valid_date", "Invalid date format (%s)!"); return FALSE; } return TRUE; } function valid_name($str){ if(trim($str)){ $is_only_alpha=( ! preg_match("/^([-a-z_ ])+$/i", $str)) ? FALSE : TRUE ; if(!$is_only_alpha){ $this->form_validation->set_message("valid_name", "Only alphabet and space are allowed in %s"); } return $is_only_alpha; }else{ return TRUE; } } function is_access($module){ if(USER_TYPE=='ADMIN'){ return TRUE; } $this->load->model('auth_model', 'auth'); $modules=$this->auth->modules(USER_ID); if(!is_array($module)){ $arg_modules[]=$module; }else{ $arg_modules=$module; } foreach($arg_modules as $m){ if(isset($modules[$m])){ return TRUE; } } return FALSE; } function checkAccess($module){ if(!$this->is_access($module)){ $this->json_data(array('success'=>'F', 'msg'=>'You are not allowed to access this page')); } } } //EOF