<?php

// System customized by BUANAdotnet
// Powerby CB
// Whatsapp: 628558828262
// Site: www.buana.net

if (!defined('WHMCS')) {
	exit('Access Restricted - Powered by www.buana.net');
}

use WHMCS\Session;
use Carbon\Carbon;
use WHMCS\Database\Capsule;

global $NomerLisensi;
global $resultado;
global $ARRAY;
global $phone;
global $body;
global $message_type;

function timeStampWhatsapp() {

    //date_default_timezone_set('Asia/Jakarta');
    $dataWhatsapp_Send = date('Y-m-d H:i:00');

    return $dataWhatsapp_Send;

}

function suiten_whatsapp_GetIP() {
    if (!empty( $_SERVER['HTTP_CLIENT_IP'] )) {      
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    } else {
        if (!empty( $_SERVER['HTTP_X_FORWARDED_FOR'] )) {            
            $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
        } else {
            if (!empty( $_SERVER['REMOTE_ADDR'] )) {
                $ip = $_SERVER['REMOTE_ADDR'];
            } else {               
                $ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
            }
        }
    }
    return $ip;
}


// New hook system
//logactivity('S10WAM Mulai -');

require_once("suiten_classes.php");
//logactivity('S10WAM Mulai 1');

$suiten_class = new suiten_Whatsapp();
//logactivity('S10WAM Mulai 2');

$suiten_hooks = $suiten_class->getHooks();

//logactivity('S10WAM Mulai 3');

foreach ($suiten_hooks as $hook) {

  //logactivity( 'SUITEN WAM: Adding Hook '.$hook['hook'].' func '.$hook['function']);
	// logactivity( suiten_whatsapp_GetIP() );
    add_hook($hook['hook'], 1, $hook['function'], "");
  //logactivity( 'SUITEN WAM: Hook Added '.$hook['hook'].' func '.$hook['function']);
	
    
}
// logactivity( 'SUITEN WAM: All Hook Loaded' );