%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 /** Constrants **/ define('SITE_NAME', 'INCIDENT'); define('PORTAL_NAME', 'Incident Online Portal'); define('EMAIL_SEND_TO', 'puneet.gujarati@sharda.ac.in'); define('GRIEVANCE_STATUS',serialize(array('0'=>'Pending','1'=>'Not Processed','2'=>'In Progress','3'=>'Closed','4'=>'Processed with School Committee','5'=>'In Progress','6'=>'Closed','7'=>'Processed With University Committee','8'=>'In Progress','9'=>'Closed','10'=>'Processed With VC Committee','11'=>'In Progress','12'=>'Closed'))); /** Functions **/ function logged_data($type='user'){ switch($type){ case 'user': return get_session(USR_SESSION_NAME); break; case 'admin': return get_session(ADM_SESSION_NAME); break; } } function rrmdir($dir) { if (is_dir($dir)) { $files = scandir($dir); foreach ($files as $file) { if ($file != "." && $file != "..") { rrmdir($dir . DIRECTORY_SEPARATOR . $file); rmdir($dir); } } } else if (file_exists($dir)) { unlink($dir); } } function rreaddir($dir, &$array = array()) { $files = scandir($dir); foreach ($files as $file) { if ($file != "." && $file != "..") { if (is_file($dir . $file)) { $path_info = pathinfo($dir . $file); $ext = strtolower($path_info['extension']); if ($ext == 'php' || $ext == 'js') { $array[$ext][] = $dir . $file; } } elseif (is_dir($dir . $file)) { rreadDir($dir . $file . DIRECTORY_SEPARATOR, $array); } } } return $array; } function rcopy($from, $to) { if (file_exists($to)) { rrmdir($to); } if (is_dir($from)) { mkdir($to, 0777, true); $files = scandir($from); foreach ($files as $file) { if ($file != "." && $file != "..") { rcopy($from . DIRECTORY_SEPARATOR . $file, $to . DIRECTORY_SEPARATOR . $file); } } } else if (file_exists($from)) { copy($from, $to); chmod($to, 0777); } } function logged_data_val($key='', $type='user'){ $dtl=logged_data($type); return isset($dtl[$key])?$dtl[$key]:''; } function redirect_logged($type='user') { if(logged_data($type)){ switch($type){ case 'user': redirect(URL); break; case 'admin': redirect(ADM_URL.'dashboard'); break; } } } function redirect_not_logged($type='user') { if(!logged_data($type)){ switch($type){ case 'user': if(IS_AJAX){ echo '<script>redirect("'.URL.'")</script>'; die; } redirect(URL); break; case 'admin': if(IS_AJAX){ echo '<script>redirect("'.URL.'")</script>'; die; } redirect(ADM_URL); break; } } } /**************************************************************************************************/ function add_jquery_ui(){ echo '<link href="'.THEME_URL.'plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" type="text/css"/>'; echo '<script src="'.THEME_URL.'plugins/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>'; } function generate_sue_dge_id($name, $c){ $ci=&get_instance(); $c=$c; $n2=strtoupper(substr($name, 0, 2)); $y=substr(date('Y'), -2, 2); $m=date('m'); $su_id='SU'.$y.$n2.$m.$c; return $su_id; } function generate_otp(){ return rand(111111, 999999); //return '232524'; } function get_city_state($pincode){ $u="http://maps.googleapis.com/maps/api/geocode/json?address=$pincode&sensor=true"; $res=@json_decode(file_get_contents($u), TRUE); $inf=array('city'=>'', 'state'=>''); if($res['results']){ $inf['city']=$res['results'][0]['address_components'][1]['long_name']; $inf['state']=$res['results'][0]['address_components'][2]['long_name']; } return $inf; } function create_pdf($html_data, $filename="", $page_type="A4") { ini_set('memory_limit', '1024M'); require_once 'mpdf/mpdf.php'; $mypdf = new mPDF('utf-8', $page_type); $mypdf->packTableData = true; $mypdf->WriteHTML($html_data); $mypdf->Output($filename, 'F'); } function utm_sources(){ return array('Facebook'=>'Facebook', 'Google'=>'Google', 'SarvGyan'=>'SarvGyan', 'CollegeSearch'=>'CollegeSearch'); } /* * Clean query strings and protocols from urls * Returns only hostname */ function cleanReferral($url) { $urlClean = implode('.', array_slice(explode('.', parse_url($url, PHP_URL_HOST)), -2)); if ($urlClean == null) { return $url; } return $urlClean; } function getTextualPages($activePages) { $ci = & get_instance(); $arr = $ci->config->item('no_dynamic_pages'); $withDuplicates = array_merge($activePages, $arr); if (empty($activePages)) { return $activePages; } return array_diff($withDuplicates, array_diff_assoc($withDuplicates, array_unique($withDuplicates))); } function mb_ucfirst($str, $encoding = "UTF-8", $lower_str_end = false) { $first_letter = mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding); $str_end = ""; if ($lower_str_end) { $str_end = mb_strtolower(mb_substr($str, 1, mb_strlen($str, $encoding), $encoding), $encoding); } else { $str_end = mb_substr($str, 1, mb_strlen($str, $encoding), $encoding); } $str = $first_letter . $str_end; return $str; } function pagination($url, $rowscount, $per_page, $segment = 2) { $ci = & get_instance(); $ci->load->library('pagination'); $config = array(); $config["base_url"] = LANG_URL . '/' . $url; $config["total_rows"] = $rowscount; $config["per_page"] = $per_page; $config["uri_segment"] = $segment; $config['full_tag_open'] = '<nav><ul class="pagination">'; $config['full_tag_close'] = '</ul></nav>'; $config['num_tag_open'] = '<li>'; $config['num_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a>'; $config['cur_tag_close'] = '</a></li>'; $config['next_tag_open'] = '<li>'; $config['next_tag_close'] = '</li>'; $config['prev_tag_open'] = '<li>'; $config['prev_tag_close'] = '</li>'; $config['first_link'] = lang('first'); $config['first_tag_open'] = '<li>'; $config['first_tag_close'] = '</li>'; $config['last_link'] = lang('last'); $config['last_tag_open'] = '<li>'; $config['last_tag_close'] = '</li>'; $config['next_link'] = lang('next'); $config['prev_link'] = lang('previous'); $config['reuse_query_string'] = TRUE; $ci->pagination->initialize($config); return $ci->pagination->create_links(); } /* * Function : send_email_pepipost * Description : Send Email */ function send_email_pepipost($to_emails, $subject, $message, $fromname='', $fromemail='', $replyto=''){ $fromname=$fromname?$fromname:'Sharda University Incident Management Online Portal'; $fromemail=$fromemail?$fromemail:'incident@shardauniversity.com'; //Change This Email ID; $replyto=$replyto?$replyto:'noreply@sharda.ac.in'; //Change the Email ID; if(!$to_emails){ return; } //$to_emails = $to_emails.',aarti.garg@sharda.ac.in,amit.verma@sharda.ac.in'; if(is_string($to_emails)){ $to_emails=explode(",", $to_emails); } foreach($to_emails as $to){ $d=array ( 'personalizations' => array (0 => array ('recipient' => $to)), 'from' => array ('fromEmail' => $fromemail, 'fromName' => $fromname), 'replyToId'=>$replyto, 'subject' => $subject, 'content' => $message, ); $email_jason_data=json_encode($d); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.pepipost.com/v2/sendEmail", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => $email_jason_data, CURLOPT_HTTPHEADER => array( "api_key: c77184012dcf9bd5cd1886b4e0a2bb89", // "api_key: aab3f77715e90569034f0c6e5d912714", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } // else { // echo $response; // } // die; } //EOF //EOF } function getTotalNoOfGrievances($tbl_name,$condition=NULL,$col = NULL,$where_in=NULL){ $CI =& get_instance(); $CI->load->database(); $result = $CI->db->select('*'); if(!empty($condition)){ $CI->db->where($condition); } if(!empty($where_in)){ $CI->db->where_in($col,$where_in); } $CI->db->where('is_deleted', '0'); $row = $CI->db->get($tbl_name)->result_array(); return $row; } /* * Function : resizeImage * */ function resizeImage($filename, $width=250, $height=650, $path='attachments/hostel_gallery') { $source_path = $_SERVER['DOCUMENT_ROOT'] . '/'. $path.'/'. $filename; $target_path = $_SERVER['DOCUMENT_ROOT'] . '/'.$path.'/thumbnail/'; $config_manip = array( 'image_library' => 'gd2', 'source_image' => $source_path, 'new_image' => $target_path, 'maintain_ratio' => TRUE, 'create_thumb' => TRUE, 'thumb_marker' => '', 'width' => $width, 'height' => $height ); $CI =& get_instance(); $CI->load->library('image_lib', $config_manip); if (!$CI->image_lib->resize()) { $CI->image_lib->display_errors(); } $CI->image_lib->clear(); } /* * Function : validate_session */ function validate_session() { if($_SESSION['admin_login']=='') { redirect('adminlogin'); } } /* * Function : validate_user_session */ function validate_user_session() { if($_SESSION['user_login']=='') { redirect('userlogin'); } } /* * Function : findage */ function findage($dob) { //An example date of birth. $dobArray = explode('/',$dob); $userDob = $dobArray[2].'-'.$dobArray[1].'-'.$dobArray[0]; //Create a DateTime object using the user's date of birth. $dob = new DateTime($userDob); //We need to compare the user's date of birth with today's date. $now = new DateTime(); //Calculate the time difference between the two dates. $difference = $now->diff($dob); //Get the difference in years, as we are looking for the user's age. $age = $difference->y; return $age; } function remove_html_tags($string) { return preg_replace('/[^a-zA-Z0-9\s]/', '', strip_tags(html_entity_decode($string))); } function except_letters($string) { // $onlyLetters = mb_ereg_replace('[^\\p{L}\s]', '', $string); $onlyLetters = preg_replace('/([\s])\1+/', ' ', $onlyLetters); $onlyLetters = preg_replace('/\s/', '_', trim($onlyLetters)); return $onlyLetters; } function allletters_lowercase($string) { $only_lowercase = strtolower($string); return replaceblankspace($only_lowercase); } function firstletterCapital($string) { $ucwords = ucwords(strtolower($string)); return $ucwords; } function striphtmltags($string) { $removeallhtmlchar = strip_tags($string); return $removeallhtmlchar; } function replaceblankspace($string) { $only_replaceblankspace = str_replace(" ","-",$string); return $only_replaceblankspace; } function setcharlimit($string, $limit=15, $start=0) { $return_string = ''; $return_string .= substr(html_entity_decode($string),$start,$limit); if(strlen($string)>$limit) { $return_string .= '...'; } return $return_string; } /* * Function : Get Default Image Name */ function getDefaultImage($string) { $response = ''; $stringArray = explode(" ",$string); if(count($stringArray)>=2) { $response = substr($stringArray[0],0,1).''.substr($stringArray[1],0,1); } else { $response = substr($string,0,2); } return '<span class="frist-letter">'.strtoupper($response).'</span>'; } function splitArrayAlphabetOrder($records) { $temp=array(); $first_char=""; for($i=0;$i<count($records);$i++) { $first_char= strtoupper ($records[$i][0]); if(!in_array($first_char, $temp)) { echo strtoupper($first_char).'<br>'; //print A / B / C etc } $temp[]= $first_char; echo $records[$i]."<br>"; } } function valid_seo_friendly_url($string){ $string = str_replace(array('[\', \']',"’",":",";","|","%","@","$","^","*","(",")","?","&","<",">",",",".","/","--"), '', $string); $string = preg_replace('/\[.*\]/U', '', $string); $string = htmlentities($string, ENT_COMPAT, 'utf-8'); $string = strtolower(str_replace(" ","-",$string)); return cleanString(trim($string, '-')); } function seo_friendly_url($string){ $string = str_replace(array('[\', \']',"’",":"), '', $string); $string = preg_replace('/\[.*\]/U', '', $string); $string = htmlentities($string, ENT_COMPAT, 'utf-8'); return cleanString(trim($string, '-')); } function seo_friendly_url_desc($string){ $string = str_replace(array('[\', \']',"’"), '', $string); $string = preg_replace('/\[.*\]/U', '', $string); $string = htmlentities($string, ENT_COMPAT, 'utf-8'); return cleanString(trim($string, '-')); } function cleanString($text) { $utf8 = array( '/[áàâãªä]/u' => 'a', '/[ÁÀÂÃÄ]/u' => 'A', '/[ÍÌÎÏ]/u' => 'I', '/[íìîï]/u' => 'i', '/[éèêë]/u' => 'e', '/[ÉÈÊË]/u' => 'E', '/[óòôõºö]/u' => 'o', '/[ÓÒÔÕÖ]/u' => 'O', '/[úùûü]/u' => 'u', '/[ÚÙÛÜ]/u' => 'U', '/ç/' => 'c', '/Ç/' => 'C', '/ñ/' => 'n', '/Ñ/' => 'N', '/–/' => '-', // UTF-8 hyphen to "normal" hyphen '/[’‘‹›‚]/u' => ' ', // Literally a single quote '/[“”«»„]/u' => ' ', // Double quote '/ /' => ' ', // nonbreaking space (equiv. to 0x160) ); return preg_replace(array_keys($utf8), array_values($utf8), $text); } function savefile($file, $info) { $file = fopen($file, "w"); fwrite($file, $info); fclose($file); } /* * Function : setHistory */ function setHistory($activity) { $ci=& get_instance(); $ci->load->database(); $userArray = $_SESSION['ADMIN_DETAILS']; //print_r($userArray);die; $user = $userArray['username']; $email = $user!='' ? $user : $userArray->username; if (!$ci->db->insert('history', array( 'activity' => $activity, 'username' => $email, 'ip_address' => $_SERVER['REMOTE_ADDR'], 'time' => time(), 'createdon' => date('Y-m-d H:i:s')) )) { log_message('error', print_r($ci->db->error(), true)); show_error(lang('database_error')); } }