58 require_once(CH_DIRECTORY_PATH_INC .
'db.inc.php');
61 $aData =
$oCache->getData(
$oDb->genDbCacheKey(
'sys_alerts'));
65 $this->_aAlerts = $aData[
'alerts'];
66 $this->_aHandlers = $aData[
'handlers'];
70 $this->iObject = (int)$iObjectId;
72 (
empty($_COOKIE[
'memberID']) ? 0 : (int)$_COOKIE[
'memberID']);
83 $oSubscription->send($this->sUnit, $this->sAction, $this->iObject, $this->aExtras);
85 if(isset($this->_aAlerts[$this->sUnit]) && isset($this->_aAlerts[$this->sUnit][$this->sAction]))
86 foreach($this->_aAlerts[$this->sUnit][$this->sAction]
as $iHandlerId) {
87 $aHandler = $this->_aHandlers[$iHandlerId];
89 if(!
empty($aHandler[
'file']) && !
empty($aHandler[
'class']) && file_exists(CH_DIRECTORY_PATH_ROOT . $aHandler[
'file'])) {
90 if(!class_exists($aHandler[
'class']))
91 require_once(CH_DIRECTORY_PATH_ROOT . $aHandler[
'file']);
93 $oHandler =
new $aHandler[
'class']();
94 $oHandler->response($this);
95 }
else if(!
empty($aHandler[
'eval'])) {
96 eval($aHandler[
'eval']);
108 $aResult = array(
'alerts' => array(),
'handlers' => array());
110 $rAlerts =
db_res(
"SELECT `unit`, `action`, `handler_id` FROM `sys_alerts` ORDER BY `id` ASC");
111 while($aAlert = $rAlerts->fetch())
112 $aResult[
'alerts'][$aAlert[
'unit']][$aAlert[
'action']][] = $aAlert[
'handler_id'];
114 $rHandlers =
db_res(
"SELECT `id`, `class`, `file`, `eval` FROM `sys_alerts_handlers` ORDER BY `id` ASC");
115 while($aHandler = $rHandlers->fetch())
116 $aResult[
'handlers'][$aHandler[
'id']] = array(
'class' => $aHandler[
'class'],
'file' => $aHandler[
'file'],
'eval' => $aHandler[
'eval']);