public function OnStartForking() { // Initialization $Db = Core::GetDBInstance(); $DbDomain = DBDomain::GetInstance(); $Whois = JWhois::GetInstance(); // Grep TLDs $data = $Db->GetAll("SELECT TLD FROM tlds WHERE modulename = 'Verisign' AND isactive = 1"); foreach ($data as $row) { $tlds[] = "'{$row['TLD']}'"; } $tlds = join(',', $tlds); // Grep domains $domain_data = $Db->GetAll("\r\n\t\t\t\tSELECT name, TLD FROM domains \r\n\t\t\t\tWHERE\r\n\t\t\t\t-- TLD in matching list\r\n\t\t\t\tTLD IN ({$tlds})\r\n\t\t\t\t-- Today is anniversary of registration\r\n\t\t\t\tAND ((MONTH(NOW()) = MONTH(start_date) AND DAY(NOW()) = DAY(start_date))\r\n\t\t\t\t-- Today is 28/02 and domain was registered 29/02 at leap year \r\n\t\t\t\tOR (MONTH(NOW()) = 2 AND DAY(NOW()) = 28 AND MONTH(start_date) = 2 AND DAY(start_date) = 29))\r\n\t\t\t"); foreach ($domain_data as $row) { try { $Domain = $DbDomain->LoadByName($row['name'], $row['TLD']); $Client = Client::Load($Domain->UserID); // Send notice $emlvars = array('whois' => $Whois->Whois($Domain->GetHostName()), 'Client' => $Client); mailer_send("wdrp_notice.eml", $emlvars, $Client->Email, $Client->Name); } catch (Exception $e) { Log::Log(sprintf("Failed to sent notice about %s. %s", "{$row['name']}.{$row['TLD']}", $e->getMessage()), E_ERROR); } } }
/** * Singleton * * @return JWhois */ public static function GetInstance() { if (self::$Instance === null) { self::$Instance = new JWhois(); } return self::$Instance; }
function _testJWhois() { $Whois = JWhois::GetInstance(); print "<pre>"; print $Whois->Whois("aws11.net"); print "</pre>"; }