No direct script access allowed'); /** * @framework iResponse Framework * @version 1.0 * @author Amine Idrissi * @date 2019 * @name GapiProduction.php */ # core use IR\Core\Application as Application; # mvc use IR\Mvc\Controller as Controller; # models use IR\App\Models\Admin\GapiUser as GapiUser; use IR\App\Models\Admin\GapiAdmin as GapiAdmin; use IR\App\Models\Affiliate\AffiliateNetwork as AffiliateNetwork; use IR\App\Models\Affiliate\Offer as Offer; use IR\App\Models\Affiliate\FromName as FromName; use IR\App\Models\Affiliate\Subject as Subject; use IR\App\Models\Admin\Isp as Isp; use IR\App\Models\Lists\DataProvider as DataProvider; use IR\App\Models\Affiliate\Vertical as Vertical; use IR\App\Models\Production\GapiProcess as GapiProcess; use IR\App\Models\Production\AutoResponder as AutoResponder; use IR\App\Models\Production\Team as Team; use IR\App\Models\Production\TeamAuthorisation as TeamAuthorisation; use IR\App\Models\Admin\User as User; use IR\App\Models\Lists\DataList as DataList; # helpers use IR\App\Helpers\Api as Api; use IR\App\Helpers\Page as Page; use IR\App\Helpers\DataTable as DataTable; use IR\App\Helpers\Permissions as Permissions; use IR\App\Helpers\Authentication as Authentication; # http use IR\Http\Request as Request; # exceptions use IR\Exceptions\Types\PageException as PageException; /** * @name Production * @description Production Controller */ class GapiProduction extends Controller { /** * @app * @readwrite */ protected $app; /** * @app * @readwrite */ protected $authenticatedUser; /** * @name init * @description initializing process before the action method executed * @once * @protected */ public function init() { # set the current application to a local variable $this->app = Application::getCurrent(); # connect to the database $this->app->database('system')->connect(); # check for authentication if(!Authentication::isUserAuthenticated()) { Page::redirect($this->app->http->request->getBaseURL() . RDS . 'auth' . RDS . 'login.' . DEFAULT_EXTENSION); } # check users roles Authentication::checkUserRoles(); # get the authenticated user $this->authenticatedUser = Authentication::getAuthenticatedUser(); } /** * @name main * @description the main action * @before init * @after closeConnections */ public function main() { Page::redirect($this->app->http->request->getBaseURL() . RDS . 'gapi-production' . RDS . 'send-process' . RDS . DEFAULT_EXTENSION); } /** * @name sendProcess * @description the sendProcess action * @before init * @after closeConnections,checkForMessage */ public function sendProcess() { # check for permissions $access = Permissions::checkForAuthorization($this->authenticatedUser,__CLASS__,__FUNCTION__); if($access == false) { throw new PageException('Access Denied !',403); } # set menu status $this->masterView->set([ 'gapi_production' => 'true', 'drops_gapi_send' => 'true' ]); $arguments = func_get_args(); $processType = isset($arguments) && count($arguments) > 0 ? $arguments[0] : null; $processId = isset($arguments) && count($arguments) > 1 ? $arguments[1] : null; # set data to the page view $this->pageView->set([ //'users' => GapiUser::all(GapiUser::FETCH_ARRAY,['status = ? and message = ?',['Activated','ok']],['id','email','admin_name'],'id','ASC'), //'users' => [], 'admins' => GapiAdmin::all(GapiAdmin::FETCH_ARRAY,['status = ? ',['Activated']],['id','name'],'id','ASC'), 'affiliateNetworks' => AffiliateNetwork::all(AffiliateNetwork::FETCH_ARRAY,['status = ?','Activated'],['id','name']), 'isps' => Isp::all(Isp::FETCH_ARRAY,['status = ?','Activated'],['id','name'],'name','ASC'), 'dataProviders' => DataProvider::all(DataProvider::FETCH_ARRAY,['status = ?','Activated'],['id','name']), 'verticals' => Vertical::all(Vertical::FETCH_ARRAY,['status = ?','Activated'],['id','name']), 'processId' => $processId, 'processType' => $processType, 'gapiHeader' => 'MIME-Version: 1.0 Message-Id: <[a_7].[n_5].[n_3].[a_3]@[n_3].[a_3]> From: [from_name] <[from_email]> Subject: [a_7] Reply-To: [from_email] To: <[email]> Date: [mail_date] Content-Type: text/html; charset=UTF-8', ]); } /** * @name gapiDrops * @description the gapi drops action * @before init * @after closeConnections,checkForMessage */ public function gapiDrops() { # check for permissions $access = Permissions::checkForAuthorization($this->authenticatedUser,__CLASS__,__FUNCTION__); if($access == false) { throw new PageException('Access Denied !',403); } # set menu status $this->masterView->set([ 'gapi_production' => 'true', 'drops_gapi_drops' => 'true' ]); # get isps $isps = Isp::all(Isp::FETCH_ARRAY,['status = ?','Activated'],['id','name'],'name','ASC'); # preparing the columns array to create the list $columnsArray = [ 'id', 'start_time', 'mailer', 'isp', 'users', 'offer', 'lists', 'status', 'start', 'total', 'progress', 'delivered', 'bounced', 'opens', 'clicks', 'leads', 'unsubs' ]; $columnsSizes = [ 'start_time' => ' style="width:3%" ', 'mailer' => ' style="width:7%" ', 'users' => ' style="width:9%" ', 'isp' => ' style="width: 5.5%" ', 'offer' => ' style="width:13%" ', 'status' => ' style="width:3%" ', 'start' => ' style="width:0.5%" ', 'lists' => ' style="width:10%" ', 'total' => ' style="width:0.5%" ', 'progress' => ' style="width:0.5%" ', 'delivered' => ' style="width:0.5%" ', 'bounced' => ' style="width:0.5%" ', 'opens' => ' style="width:0.5%" ', 'clicks' => ' style="width:0.5%" ', 'leads' => ' style="width:0.5%" ', 'unsubs' => ' style="width:0.5%" ' ]; # creating the html part of the list $index = 1; $columns = ''; $filters = ''; $footer = ''; foreach ($columnsArray as $column) { $footer .= ''; $index++; if($column != 'id') { $size = key_exists($column,$columnsSizes) ? $columnsSizes[$column] : ''; $columns .= '' . ucwords(str_replace('_',' ',strtolower($column))) . '' . PHP_EOL; if(strpos($column,'_date') > -1 || strpos($column,'_time') > -1) { $filters .= '
' . PHP_EOL; } else if($column == 'status') { $filters .= ' ' . PHP_EOL; } else if($column == 'isp') { $filters .= ' ' . PHP_EOL; } else if($column == 'offer') { $filters .= '' . PHP_EOL; } else { $filters .= '' . PHP_EOL; } } } $footer .= ''; # set data to the page view $this->pageView->set([ 'columns' => $columns, 'filters' => $filters, 'footer' => $footer ]); } /** * @name getgapiDrops * @description the get gapi drops action * @before init * @after closeConnections,checkForMessage */ public function getGapiDrops() { # check for permissions $access = Permissions::checkForAuthorization($this->authenticatedUser,__CLASS__,'gapiDrops'); if($access == false) { throw new PageException('Access Denied !',403); } # get post data $data = $this->app->http->request->retrieve(Request::ALL,Request::POST); if(count($data)) { # preparing the columns array to create the list $columns = [ 'd.id' => 'id', "to_char(start_time, 'YYYY-MM-DD HH24:MI')" => 'start_time', "u.first_name || ' ' || u.last_name" => 'mailer', 'i.name' => 'isp', "'' || substring(replace((SELECT string_agg(email, ',') FROM admin.gapi_users s WHERE s.id = ANY (string_to_array(d.servers_ids,',')::int[])),',',' '),1,18)" => 'servers', "'(' || off.production_id || ') ' || off.name" => 'offer', "'' || replace((SELECT string_agg(name, ',') FROM lists.data_lists dt WHERE dt.id = ANY (string_to_array(d.lists,',')::int[])),',',' ') " => 'lists', 'd.status' => 'status', 'COALESCE(d.data_start,0)' => 'start', 'COALESCE(d.total_emails,0)' => 'total', 'COALESCE(d.progress,0)' => 'progress', 'COALESCE(d.delivered,0)' => 'delivered', 'COALESCE(d.hard_bounced,0)' => 'bounced', "COALESCE(d.opens,0)" => 'opens', "COALESCE(d.clicks,0)" => 'clicks', "COALESCE(d.leads,0)" => 'leads', "COALESCE(d.unsubs,0)" => 'unsubs' ]; # prepare query $query = $this->app->database('system')->query()->from('production.gapi_processes d',$columns) ->join('admin.users u','d.user_id = u.id') ->join('admin.isps i','d.isp_id = i.id') ->join('affiliate.offers off','d.offer_id = off.id') ->where('d.process_type = ?',['drop']); //print_r($query );exit; # fetching the results to create the ajax list if(Authentication::getAuthenticatedUser()->getMasterAccess() != 'Enabled') { $userTeams = []; $authorisations = TeamAuthorisation::all(TeamAuthorisation::FETCH_ARRAY,['team_member_id = ?',Authentication::getAuthenticatedUser()->getId()],['team_id']); foreach ($authorisations as $authorisation) { $userTeams[] = $authorisation['team_id']; } if(count($userTeams) != 0) { # check if the user is a team leader $userIds = [Authentication::getAuthenticatedUser()->getId()]; $teams = Team::all(Team::FETCH_ARRAY,["status = ? and " . $userIds[0] . " = ANY (string_to_array(team_leaders_ids,',')::int[])",['Activated']],['id','name']); if(count($teams)) { foreach ($teams as $team) { $members = TeamAuthorisation::all(TeamAuthorisation::FETCH_ARRAY,['team_member_id > 0 AND team_id = ?',$team['id']],['id','team_id','team_member_id']); if(count($members)) { foreach ($members as $member) { $userIds[] = intval($member['team_member_id']); } } } } $query->where('d.user_id in ?',[$userIds]); } } die(json_encode(DataTable::init($data,'production.gapi_processes d',$columns,new GapiProcess(),'production' . RDS . 'gapi-drops','DESC',$query,false))); } } /** * @name gapiTests * @description the gapi tests action * @before init * @after closeConnections,checkForMessage */ public function gapiTests() { # check for permissions $access = Permissions::checkForAuthorization($this->authenticatedUser,__CLASS__,__FUNCTION__); if($access == false) { throw new PageException('Access Denied !',403); } # set menu status $this->masterView->set([ 'gapi_production' => 'true', 'drops_gapi_tests' => 'true' ]); # get isps $isps = Isp::all(Isp::FETCH_ARRAY,['status = ?','Activated'],['id','name'],'name','ASC'); # preparing the columns array to create the list $columnsArray = [ 'id', 'start_time', 'mailer', 'isp_name' => 'isp', 'users', 'offer', 'status', 'total', 'progress', 'delivered', 'bounced', 'opens', 'clicks', 'leads', 'unsubs' ]; $columnsSizes = [ 'start_time' => ' style="width:2%" ', 'mailer' => ' style="width:7%" ', 'users' => ' style="width:9%" ', 'isp' => ' style="width: 5.5%" ', 'offer' => ' style="width:10%" ', 'status' => ' style="width:3%" ', 'start' => ' style="width:0.5%" ', 'total' => ' style="width:0.5%" ', 'progress' => ' style="width:0.5%" ', 'delivered' => ' style="width:0.5%" ', 'bounced' => ' style="width:0.5%" ', 'opens' => ' style="width:0.5%" ', 'leads' => ' style="width:0.5%" ', 'clicks' => ' style="width:0.5%" ', 'unsubs' => ' style="width:0.5%" ' ]; # creating the html part of the list $index = 1; $columns = ''; $filters = ''; $footer = ''; foreach ($columnsArray as $column) { $footer .= ''; $index++; if($column != 'id') { $size = key_exists($column,$columnsSizes) ? $columnsSizes[$column] : ''; $columns .= '' . ucwords(str_replace('_',' ',strtolower($column))) . '' . PHP_EOL; if(strpos($column,'_date') > -1 || strpos($column,'_time') > -1) { $filters .= '
' . PHP_EOL; } else if($column == 'status') { $filters .= ' ' . PHP_EOL; } else if($column == 'isp') { $filters .= ' ' . PHP_EOL; } else if($column == 'offer') { $filters .= '' . PHP_EOL; } else { $filters .= '' . PHP_EOL; } } } $footer .= ''; # set data to the page view $this->pageView->set([ 'columns' => $columns, 'filters' => $filters, 'footer' => $footer ]); } /** * @name getgapiTests * @description the get gapi tests action * @before init * @after closeConnections,checkForMessage */ public function getGapiTests() { # check for permissions $access = Permissions::checkForAuthorization($this->authenticatedUser,__CLASS__,'gapiTests'); if($access == false) { throw new PageException('Access Denied !',403); } # get post data $data = $this->app->http->request->retrieve(Request::ALL,Request::POST); if(count($data)) { # preparing the columns array to create the list $columns = [ 't.id' => 'id', "to_char(start_time, 'YYYY-MM-DD HH24:MI')" => 'start_time', "u.first_name || ' ' || u.last_name" => 'mailer', 'i.name' => 'isp', "'' || substring(replace((SELECT string_agg(email, ',') FROM admin.gapi_users s WHERE s.id = ANY (string_to_array(t.servers_ids,',')::int[])),',',' '),1,18)" => 'servers', "'(' || off.production_id || ') ' || off.name" => 'offer', 't.status' => 'status', 'COALESCE(t.total_emails,0)' => 'total', 'COALESCE(t.progress,0)' => 'progress', 'COALESCE(t.delivered,0)' => 'delivered', 'COALESCE(t.hard_bounced,0)' => 'bounced', "COALESCE(t.opens,0)" => 'opens', "COALESCE(t.clicks,0)" => 'clicks', "COALESCE(t.leads,0)" => 'leads', "COALESCE(t.unsubs,0)" => 'unsubs' ]; # prepare query $query = $this->app->database('system')->query()->from('production.gapi_processes t',$columns) ->join('admin.users u','t.user_id = u.id') ->join('admin.isps i','t.isp_id = i.id') ->join('affiliate.offers off','t.offer_id = off.id') ->where("t.process_type NOT LIKE 'drop'",[]); # fetching the results to create the ajax list if(Authentication::getAuthenticatedUser()->getMasterAccess() != 'Enabled') { $userTeams = []; $authorisations = TeamAuthorisation::all(TeamAuthorisation::FETCH_ARRAY,['team_member_id = ?',Authentication::getAuthenticatedUser()->getId()],['team_id']); foreach ($authorisations as $authorisation) { $userTeams[] = $authorisation['team_id']; } if(count($userTeams) != 0) { # check if the user is a team leader $userIds = [Authentication::getAuthenticatedUser()->getId()]; $teams = Team::all(Team::FETCH_ARRAY,["status = ? and " . $userIds[0] . " = ANY (string_to_array(team_leaders_ids,',')::int[])",['Activated']],['id','name']); if(count($teams)) { foreach ($teams as $team) { $members = TeamAuthorisation::all(TeamAuthorisation::FETCH_ARRAY,['team_member_id > 0 AND team_id = ?',$team['id']],['id','team_id','team_member_id']); if(count($members)) { foreach ($members as $member) { $userIds[] = intval($member['team_member_id']); } } } } $query->where('t.user_id in ?',[$userIds]); } } die(json_encode(DataTable::init($data,'production.gapi_processes t',$columns,new GapiProcess(),'gapi-production' . RDS . 'gapi-tests','DESC',$query,false))); } } /** * @name processDetails * @description the mta process details action * @before init * @after closeConnections,checkForMessage */ public function processDetails() { $arguments = func_get_args(); $type = isset($arguments) && count($arguments) > 0 ? $arguments[0] : null; $id = isset($arguments) && count($arguments) > 1 ? $arguments[1] : null; # check for permissions $method = ''; switch ($type) { case 'mt' : $method = 'mtaTests'; break; case 'md' : $method = 'mtaDrops'; break; case 'st' : $method = 'smtpTests'; break; case 'sd' : $method = 'smtpDrops'; break; } $access = Permissions::checkForAuthorization($this->authenticatedUser,__CLASS__,$method); if($access == false) { throw new PageException('Access Denied !',403); } $valid = true; # set menu status $this->masterView->set([ 'gapi_production' => 'true', 'drops_gapi' => 'true', 'drops_gapi_show' => 'true' ]); if(!isset($id) || !is_numeric($id) || intval($id) == 0) { $valid = false; } $where = ['id = ?',$id]; if(Authentication::getAuthenticatedUser()->getMasterAccess() != 'Enabled') { $hasAdminRole = Permissions::hasAdminBasedRole(Authentication::getAuthenticatedUser()); if($hasAdminRole == false) { # check if the user is a team leader $userIds = [Authentication::getAuthenticatedUser()->getId()]; $teams = Team::all(Team::FETCH_ARRAY,["status = ? and " . $userIds[0] . " = ANY (string_to_array(team_leaders_ids,',')::int[])",['Activated']],['id','name']); if(count($teams)) { foreach ($teams as $team) { $members = TeamAuthorisation::all(TeamAuthorisation::FETCH_ARRAY,['team_member_id > 0 AND team_id = ?',$team['id']],['id','team_id','team_member_id']); if(count($members)) { foreach ($members as $member) { $userIds[] = intval($member['team_member_id']); } } } } $where = ['id = ? AND user_id in ?',[$id,$userIds]]; } } $process = GapiProcess::first(GapiProcess::FETCH_ARRAY,$where) ; if(count($process) == 0) { $valid = false; } if($valid == true) { $json = json_decode(base64_decode($process['content']),true); if(count($json) == 0) { # stores the message in the session Page::registerMessage('error','Invalid drop content !'); # redirect to lists page Page::redirect(); } $processDetails = []; $serversIds = []; $vmtasIds = []; # fill with basic data foreach ($process as $key => $row) { if($key != 'content') { $processDetails[$key] = $row; } } # type $processDetails['process_type'] = $type == 'mt' || $type == 'md' ? 'mta' : 'smtp'; $processDetails['type'] = $this->app->utils->arrays->get($json,'type'); # get mailer info $user = User::first(User::FETCH_ARRAY,['id = ?',$processDetails['user_id']],['id','first_name','last_name','production_id']); if(count($user)) { $processDetails['user_production_id'] = $user['production_id']; $processDetails['user_full_name'] = $user['first_name'] . ' ' . $user['last_name'] ; } # servers and vmtas foreach ($this->app->utils->arrays->get($json,'selected-vmtas') as $val) { $serversIds[] = intval($this->app->utils->arrays->get(explode('|',$val),0)); $vmtasIds[] = intval($this->app->utils->arrays->get(explode('|',$val),1)); } $processDetails['servers'] = ($processDetails['process_type'] == 'mta') ? GapiUser::all(GapiUser::FETCH_ARRAY,['id IN ?',[$serversIds]],['id','name']) : SmtpServer::all(SmtpServer::FETCH_ARRAY,['id IN ?',[$serversIds]],['id','name']); if($processDetails['process_type'] == 'mta') { $processDetails['vmtas'] = ServerVmta::all(ServerVmta::FETCH_ARRAY,['id IN ?',[$vmtasIds]],['id','name','domain','ip','mta_server_name']); } else { $processDetails['smtp_users'] = SmtpUser::all(SmtpUser::FETCH_ARRAY,['id IN ?',[$vmtasIds]],['id','username','smtp_server_name']); } # test emails & placeholders $processDetails['test_emails'] = $this->app->utils->arrays->get($json,'rcpts'); $processDetails['placeholders_one'] = $this->app->utils->arrays->get($json,'placeholders-one'); $processDetails['placeholders_two'] = $this->app->utils->arrays->get($json,'placeholders-two'); $processDetails['placeholders_three'] = $this->app->utils->arrays->get($json,'placeholders-three'); # rotations & combinations $processDetails['vmtas_rotation'] = $this->app->utils->arrays->get($json,'vmta-rotation',1); $processDetails['test_rotation'] = $this->app->utils->arrays->get($json,'rcpt-rotation',1); $processDetails['test_after'] = $this->app->utils->arrays->get($json,'test-after',1000); $processDetails['test_emails_combination'] = $this->app->utils->arrays->get($json,'rcpt-combination','off'); $processDetails['placeholders_one_rotation'] = $this->app->utils->arrays->get($json,'placeholders-one-rotation','off'); $processDetails['placeholders_one_combination'] = $this->app->utils->arrays->get($json,'placeholders-one-combination','off'); $processDetails['placeholders_two_rotation'] = $this->app->utils->arrays->get($json,'placeholders-two-rotation','off'); $processDetails['placeholders_two_combination'] = $this->app->utils->arrays->get($json,'placeholders-two-combination','off'); $processDetails['placeholders_three_rotation'] = $this->app->utils->arrays->get($json,'placeholders-three-rotation','off'); $processDetails['placeholders_three_combination'] = $this->app->utils->arrays->get($json,'placeholders-three-combination','off'); $processDetails['split_emails_type'] = $this->app->utils->arrays->get($json,'emails-split-type'); $processDetails['emails_process_type'] = $this->app->utils->arrays->get($json,'vmtas-emails-process'); $processDetails['batch'] = $this->app->utils->arrays->get($json,'batch'); $processDetails['x_delay'] = $this->app->utils->arrays->get($json,'x-delay'); $processDetails['return_path'] = $this->app->utils->arrays->get($json,'return-path'); $processDetails['static_domain'] = $this->app->utils->arrays->get($json,'static-domain'); $processDetails['charset'] = $this->app->utils->arrays->get($json,'creative-charset'); $processDetails['content_type'] = $this->app->utils->arrays->get($json,'creative-content-type'); $processDetails['content_transfer_encoding'] = $this->app->utils->arrays->get($json,'creative-content-transfert-encoding'); $processDetails['link_type'] = $this->app->utils->arrays->get($json,'link-type'); # affiliate $processDetails['affiliate_network_name'] = $process['affiliate_network_id'] > 0 ? $this->app->utils->arrays->get(AffiliateNetwork::first(AffiliateNetwork::FETCH_ARRAY,['id = ?',intval($process['affiliate_network_id'])],['name']),'name') : ''; $processDetails['offer_name'] = $process['offer_id'] > 0 ? $this->app->utils->arrays->get(Offer::first(Offer::FETCH_ARRAY,['id = ?',intval($process['offer_id'])],['name']),'name') : ''; $processDetails['from_name'] = intval($this->app->utils->arrays->get($json,'from-name-id')) > 0 ? $this->app->utils->arrays->get(FromName::first(FromName::FETCH_ARRAY,['id = ?',intval($this->app->utils->arrays->get($json,'from-name-id'))],['value']),'value') : ''; $processDetails['from_name_encoding'] = $this->app->utils->arrays->get($json,'from-name-encoding'); $processDetails['subject'] = intval($this->app->utils->arrays->get($json,'subject-id')) > 0 ? $this->app->utils->arrays->get(Subject::first(Subject::FETCH_ARRAY,['id = ?',intval($this->app->utils->arrays->get($json,'subject-id'))],['value']),'value') : ''; $processDetails['subject_encoding'] = $this->app->utils->arrays->get($json,'subject-encoding'); # data and isps $processDetails['isp_name'] = $process['isp_id'] > 0 ? $this->app->utils->arrays->get(Isp::first(Isp::FETCH_ARRAY,['id = ?',intval($process['isp_id'])],['name']),'name') : ''; $processDetails['countries'] = key_exists('countries',$json) && is_array($json['countries']) ? implode(',',$json['countries']): 'US'; $processDetails['data_start'] = $this->app->utils->arrays->get($json,'data-start'); $processDetails['data_count'] = $this->app->utils->arrays->get($json,'data-count'); $processDetails['data_duplicate'] = $this->app->utils->arrays->get($json,'data-duplicate',1); if(strlen($process['lists']) > 0) { $processDetails['lists'] = DataList::all(DataList::FETCH_ARRAY,['id IN ?',[explode(',',$process['lists'])]],['id','name','data_provider_name']); } else { $processDetails['lists'] = []; } # data flags $processDetails['is_fresh'] = array_key_exists('fresh-filter',$json) ? 'on' : 'off'; $processDetails['is_clean'] = array_key_exists('clean-filter',$json) ? 'on' : 'off'; $processDetails['is_openers'] = array_key_exists('openers-filter',$json) ? 'on' : 'off'; $processDetails['is_clickers'] = array_key_exists('clickers-filter',$json) ? 'on' : 'off'; $processDetails['is_leaders'] = array_key_exists('leaders-filter',$json) ? 'on' : 'off'; $processDetails['is_optouts'] = array_key_exists('optouts-filter',$json) ? 'on' : 'off'; $processDetails['is_unsubs'] = array_key_exists('unsubs-filter',$json) ? 'on' : 'off'; $processDetails['is_seeds'] = array_key_exists('seeds-filter',$json) ? 'on' : 'off'; # header and body $headers = $this->app->utils->arrays->get($json,'headers',[]); $processDetails['headers'] = is_array($headers) && count($headers) ? implode(PHP_EOL . '_SEPARATOR_' . PHP_EOL,$headers): ''; $processDetails['body'] = $this->app->utils->arrays->get($json,'body'); # set data to the page view $this->pageView->set([ 'process' => $processDetails ]); } else { # stores the message in the session Page::registerMessage('error','Invalid process id !'); # redirect to lists page Page::redirect(); } } /** * @name closeConnections * @description close all connections * @once * @protected */ public function closeConnections() { # connect to the database $this->app->database('system')->disconnect(); $this->app->database('clients')->disconnect(); } /** * @name checkForMessage * @description checks for session messages * @once * @protected */ public function checkForMessage() { # check for message Page::checkForMessage($this); } }