<?php
class suiten_Whatsapp
{
	function getHooks() {
		
		require_once("suiten_koreksinomor.php");
		
		foreach (WHMCS\Database\Capsule::table('tblconfiguration')->WHERE('setting', 'Version')->get() as $whmcs_config) {
			$VerWHMCS = $whmcs_config->value;
		}
		//logactivity( 'SUITEN WAM: version' . $VerWHMCS);
		
		//logactivity('S10WAM Mulai cari hooks');
        if ($handle = opendir(dirname(__FILE__) . '/suiten_hooks')) {
            while (false !== ($entry = readdir($handle))) {
                if (substr($entry, strlen($entry) - 4, strlen($entry)) == ".php") {
					//if ($entry = 'suiten_TicketOpen.php') {
				    //logactivity( 'SUITEN WAM: Hook Class start '.$entry);
					//}
					if (strpos($entry,"ClientLogin")) {
						if (substr($VerWHMCS, 0, 2)=="7.") {
							$file[] = require_once('suiten_hooks/' . $entry);
							//logactivity( 'SUITEN WAM: Hook Class loaded '.$entry);
						}
					} elseif (strpos($entry,"UserLogin")) {
						if (substr($VerWHMCS, 0, 2)=="8.") {
							$file[] = require_once('suiten_hooks/' . $entry);
							//logactivity( 'SUITEN WAM: Hook Class loaded '.$entry);
						}
					} else {
						$file[] = require_once('suiten_hooks/' . $entry);
						//if ($entry = 'suiten_TicketOpen.php') {
						//logactivity( 'SUITEN WAM: Hook Class loaded '.$entry);
						//}
					}
                }
            }
            closedir($handle);
        }
        return $file;
    }

}