Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace VDV\Alarm\Task; require_once dirname(__DIR__, 3) . "\x2f\x63\x6f\155\160..

Decoded Output download

<?php 
 namespace VDV\Alarm\Task; require_once dirname(__DIR__, 3) . "/component_broker.php"; class Alarm extends \VDV\TaskMgr\Model\Task { private $_handlers = array(); const ACTION_PROCESS_ALL = "process_all"; const ACTION_PROCESS = "process"; const ACTION_REPEAT = "repeat"; const MSG_START = 1; const MSG_START_PROCESS_ALL = 2; const MSG_START_PROCESS = 3; const MSG_START_REPEAT = 4; const MSG_HANDLER = 5; const MSG_HANDLER_ID = 6; const ERR_UNKNOWN_HANDLER = 100; const ERR_PROCESS_ALARM = 101; const ERR_REPEAT_ALARM = 102; const ERR_HANDLER_FAILURE = 103; const ERR_ROBOT_VERSION = 0; public function ownerEntity($param) { switch ($param["action"] ?? null) { case self::ACTION_PROCESS_ALL: $name = get_text("Process all alarms"); break; case self::ACTION_PROCESS: $name = get_text("Process alarms"); break; case self::ACTION_REPEAT: $name = get_text("Repeat alarms"); break; default: $name = get_Text("Process all alarms and repeat"); break; } return ["name" => $name]; } public static function name() : string { return get_text("Alarm"); } public static function messages() : array { return [self::MSG_START => get_text("Starting alarm task with %d registered handlers"), self::MSG_START_PROCESS => get_text("Processing alarms"), self::MSG_START_PROCESS_ALL => get_text("Processing all alarms"), self::MSG_START_REPEAT => get_text("Processing repeat alarms"), self::MSG_HANDLER => get_text("%s"), self::MSG_HANDLER_ID => get_text("%d"), self::ERR_UNKNOWN_HANDLER => get_text("Unknown alarm handler %s"), self::ERR_PROCESS_ALARM => get_text("Error processing alarm"), self::ERR_REPEAT_ALARM => get_text("Unable to process repeat alarms"), self::ERR_ROBOT_VERSION => get_text("Regular Alarm Task will not work with the current version of db.robot.c. Please update!"), self::ERR_HANDLER_FAILURE => get_text("Error handling alarm %d: %s")]; } public function run($param) : bool { $this->initHandlers(); $this->logInfo(self::MSG_START, count($this->_handlers)); switch ($param["action"] ?? null) { case self::ACTION_PROCESS_ALL: return $this->processAllAlarms(); case self::ACTION_PROCESS: return $this->processAlarms($param["alarms"] ?? null); case self::ACTION_REPEAT: return $this->processRepeatAlarms(); } if (!$this->processAllAlarms()) { return false; } if (!$this->processRepeatAlarms()) { return false; } return true; } private function initHandlers() { dv_broker::getInstance()->callHook("registerAlarmHandlers", function ($component, $hook) { $handlers = call_user_func($hook); foreach ($handlers as $handler) { $handler["obj"] = new $handler["class"]($this->logger()); $this->_handlers[$handler["class"]] = $handler; } }); } private function processAllAlarms() : bool { $this->logInfo(self::MSG_START_PROCESS_ALL); $this->logPush(); foreach ($this->_handlers as $handler) { $this->logInfo(self::MSG_HANDLER, $handler["name"]); $this->logPush(); $handler["obj"]->processAllAlarms(); $this->logPop(); } $this->logPop(); return true; } private function processAlarms(array $alarms) : bool { $this->logInfo(self::MSG_START_PROCESS); $this->logPush(); foreach ($alarms as $handlerClass => $ids) { if (!isset($this->_handlers[$handlerClass])) { $this->logError(self::ERR_UNKNOWN_HANDLER, $handlerClass); continue; } $handler = $this->_handlers[$handlerClass]; $this->logInfo(self::MSG_HANDLER, $handler["name"]); $this->logPush(); foreach ($ids as $id) { $this->logInfo(self::MSG_HANDLER_ID, $id); if (!$handler["obj"]->processAlarm($id)) { $this->logPush(); $this->logError(self::ERR_PROCESS_ALARM); $this->logPop(); } } $this->logPop(); } $this->logPop(); return true; } private function processRepeatAlarms() : bool { $this->logInfo(self::MSG_START_REPEAT); $this->logPush(); foreach ($this->_handlers as $handler) { $this->logInfo(self::MSG_HANDLER, $handler["name"]); if (!$handler["obj"]->processRepeatAlarms()) { $this->logPush(); $this->logError(self::ERR_REPEAT_ALARM); $this->logPop(); } } $this->logPop(); return true; } } ?>

Did this file decode correctly?

Original Code

<?php
 namespace VDV\Alarm\Task; require_once dirname(__DIR__, 3) . "\x2f\x63\x6f\155\160\x6f\x6e\x65\x6e\164\137\142\x72\157\x6b\145\x72\56\x70\150\x70"; class Alarm extends \VDV\TaskMgr\Model\Task { private $_handlers = array(); const ACTION_PROCESS_ALL = "\x70\162\157\x63\x65\x73\163\x5f\141\x6c\154"; const ACTION_PROCESS = "\x70\x72\x6f\x63\145\x73\163"; const ACTION_REPEAT = "\162\x65\x70\145\x61\x74"; const MSG_START = 1; const MSG_START_PROCESS_ALL = 2; const MSG_START_PROCESS = 3; const MSG_START_REPEAT = 4; const MSG_HANDLER = 5; const MSG_HANDLER_ID = 6; const ERR_UNKNOWN_HANDLER = 100; const ERR_PROCESS_ALARM = 101; const ERR_REPEAT_ALARM = 102; const ERR_HANDLER_FAILURE = 103; const ERR_ROBOT_VERSION = 0; public function ownerEntity($param) { switch ($param["\141\143\164\151\x6f\x6e"] ?? null) { case self::ACTION_PROCESS_ALL: $name = get_text("\x50\162\157\143\145\163\x73\40\x61\x6c\x6c\x20\141\154\141\x72\x6d\163"); break; case self::ACTION_PROCESS: $name = get_text("\120\x72\x6f\x63\145\x73\x73\40\x61\x6c\x61\162\155\163"); break; case self::ACTION_REPEAT: $name = get_text("\x52\145\x70\145\141\x74\40\141\154\141\162\155\163"); break; default: $name = get_Text("\120\162\157\x63\145\163\x73\40\x61\154\x6c\x20\141\x6c\141\x72\155\163\x20\x61\x6e\x64\x20\x72\x65\x70\145\x61\x74"); break; } return ["\x6e\141\x6d\145" => $name]; } public static function name() : string { return get_text("\101\154\141\x72\x6d"); } public static function messages() : array { return [self::MSG_START => get_text("\123\x74\141\x72\x74\151\x6e\147\x20\x61\x6c\x61\162\x6d\x20\164\141\x73\153\40\x77\x69\164\x68\x20\45\144\40\x72\145\147\x69\163\164\145\x72\x65\144\x20\x68\141\156\144\x6c\145\x72\x73"), self::MSG_START_PROCESS => get_text("\x50\x72\x6f\x63\x65\163\163\151\x6e\x67\x20\x61\154\141\x72\155\x73"), self::MSG_START_PROCESS_ALL => get_text("\120\x72\157\143\x65\163\163\151\156\147\40\x61\154\154\x20\x61\x6c\141\162\x6d\x73"), self::MSG_START_REPEAT => get_text("\120\162\157\x63\x65\x73\163\151\156\x67\x20\162\x65\160\145\x61\x74\x20\141\x6c\x61\x72\x6d\163"), self::MSG_HANDLER => get_text("\45\163"), self::MSG_HANDLER_ID => get_text("\x25\144"), self::ERR_UNKNOWN_HANDLER => get_text("\x55\156\x6b\x6e\x6f\167\156\x20\141\154\141\162\155\x20\150\141\x6e\144\x6c\145\x72\40\x25\x73"), self::ERR_PROCESS_ALARM => get_text("\x45\162\162\157\x72\x20\160\162\x6f\x63\x65\x73\163\151\x6e\147\x20\x61\x6c\x61\162\x6d"), self::ERR_REPEAT_ALARM => get_text("\x55\156\141\x62\x6c\145\x20\164\x6f\x20\x70\162\157\143\x65\x73\163\40\x72\x65\x70\x65\141\x74\40\x61\x6c\141\x72\155\x73"), self::ERR_ROBOT_VERSION => get_text("\x52\145\x67\x75\154\141\162\x20\101\x6c\x61\162\x6d\40\124\x61\x73\153\x20\167\151\154\154\40\156\157\x74\40\x77\x6f\x72\153\40\x77\151\x74\150\x20\x74\150\145\40\143\165\162\x72\x65\156\x74\40\166\145\x72\x73\151\157\156\x20\x6f\146\x20\x64\x62\x2e\162\157\x62\x6f\164\56\x63\x2e\40\120\x6c\x65\141\x73\145\x20\x75\160\144\x61\x74\x65\41"), self::ERR_HANDLER_FAILURE => get_text("\105\x72\x72\157\162\x20\150\x61\x6e\x64\x6c\151\156\x67\40\141\154\141\162\155\x20\45\144\x3a\x20\x25\x73")]; } public function run($param) : bool { $this->initHandlers(); $this->logInfo(self::MSG_START, count($this->_handlers)); switch ($param["\141\143\x74\151\x6f\x6e"] ?? null) { case self::ACTION_PROCESS_ALL: return $this->processAllAlarms(); case self::ACTION_PROCESS: return $this->processAlarms($param["\141\154\x61\162\x6d\x73"] ?? null); case self::ACTION_REPEAT: return $this->processRepeatAlarms(); } if (!$this->processAllAlarms()) { return false; } if (!$this->processRepeatAlarms()) { return false; } return true; } private function initHandlers() { \vdv_broker::getInstance()->callHook("\162\x65\147\151\x73\164\x65\162\101\x6c\141\x72\155\110\x61\156\x64\154\145\x72\x73", function ($component, $hook) { $handlers = call_user_func($hook); foreach ($handlers as $handler) { $handler["\x6f\142\152"] = new $handler["\143\x6c\141\x73\x73"]($this->logger()); $this->_handlers[$handler["\143\x6c\x61\x73\x73"]] = $handler; } }); } private function processAllAlarms() : bool { $this->logInfo(self::MSG_START_PROCESS_ALL); $this->logPush(); foreach ($this->_handlers as $handler) { $this->logInfo(self::MSG_HANDLER, $handler["\156\x61\155\x65"]); $this->logPush(); $handler["\157\x62\x6a"]->processAllAlarms(); $this->logPop(); } $this->logPop(); return true; } private function processAlarms(array $alarms) : bool { $this->logInfo(self::MSG_START_PROCESS); $this->logPush(); foreach ($alarms as $handlerClass => $ids) { if (!isset($this->_handlers[$handlerClass])) { $this->logError(self::ERR_UNKNOWN_HANDLER, $handlerClass); continue; } $handler = $this->_handlers[$handlerClass]; $this->logInfo(self::MSG_HANDLER, $handler["\x6e\x61\155\x65"]); $this->logPush(); foreach ($ids as $id) { $this->logInfo(self::MSG_HANDLER_ID, $id); if (!$handler["\x6f\x62\152"]->processAlarm($id)) { $this->logPush(); $this->logError(self::ERR_PROCESS_ALARM); $this->logPop(); } } $this->logPop(); } $this->logPop(); return true; } private function processRepeatAlarms() : bool { $this->logInfo(self::MSG_START_REPEAT); $this->logPush(); foreach ($this->_handlers as $handler) { $this->logInfo(self::MSG_HANDLER, $handler["\x6e\x61\155\x65"]); if (!$handler["\157\x62\x6a"]->processRepeatAlarms()) { $this->logPush(); $this->logError(self::ERR_REPEAT_ALARM); $this->logPop(); } } $this->logPop(); return true; } }

Function Calls

None

Variables

None

Stats

MD5 58e2ed77f526c068bb2a9ae9f8ccf786
Eval Count 0
Decode Time 59 ms