@@ -38,16 +38,16 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function getCurrentURL() |
| 40 | 40 | { |
| 41 | - return Url::fromPath($this->urlPath . '/handler'); |
|
| 41 | + return Url::fromPath($this->urlPath.'/handler'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function renderLine($row) |
| 45 | 45 | { |
| 46 | - $html = ''; |
|
| 47 | - $firstCol = true; |
|
| 46 | + $html=''; |
|
| 47 | + $firstCol=true; |
|
| 48 | 48 | |
| 49 | - $titleNames = array_keys($this->titles); |
|
| 50 | - foreach ($titleNames as $rowkey ) |
|
| 49 | + $titleNames=array_keys($this->titles); |
|
| 50 | + foreach ($titleNames as $rowkey) |
|
| 51 | 51 | { |
| 52 | 52 | // Check missing value |
| 53 | 53 | if (property_exists($row, $rowkey)) |
@@ -62,57 +62,57 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | if ($this->doTranslate === true) |
| 64 | 64 | { |
| 65 | - $oidName = $this->MIB->translateOID($row->$rowkey); |
|
| 65 | + $oidName=$this->MIB->translateOID($row->$rowkey); |
|
| 66 | 66 | if (isset($oidName['name'])) |
| 67 | 67 | { |
| 68 | 68 | $val=$oidName['name']; |
| 69 | 69 | } |
| 70 | 70 | else |
| 71 | 71 | { |
| 72 | - $val = $row->$rowkey; |
|
| 72 | + $val=$row->$rowkey; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | else |
| 76 | 76 | { |
| 77 | - $val = $row->$rowkey; |
|
| 77 | + $val=$row->$rowkey; |
|
| 78 | 78 | } |
| 79 | 79 | break; |
| 80 | 80 | case 'host_name': // switch to hostgroup if name is null |
| 81 | 81 | if ($row->$rowkey == null) |
| 82 | 82 | { |
| 83 | - $val = $row->host_group_name; |
|
| 83 | + $val=$row->host_group_name; |
|
| 84 | 84 | } |
| 85 | 85 | else |
| 86 | 86 | { |
| 87 | - $val = $row->$rowkey; |
|
| 87 | + $val=$row->$rowkey; |
|
| 88 | 88 | } |
| 89 | 89 | break; |
| 90 | 90 | default: |
| 91 | - $val = $row->$rowkey; |
|
| 91 | + $val=$row->$rowkey; |
|
| 92 | 92 | } |
| 93 | - if ($rowkey == 'trap_oid' && $this->doTranslate===true) |
|
| 93 | + if ($rowkey == 'trap_oid' && $this->doTranslate === true) |
|
| 94 | 94 | { |
| 95 | 95 | |
| 96 | 96 | } |
| 97 | 97 | } else { |
| 98 | - $val = '-'; |
|
| 98 | + $val='-'; |
|
| 99 | 99 | } |
| 100 | 100 | if ($firstCol === true) { // Put link in first column for trap detail. |
| 101 | - $html .= '<td class="traphover">' |
|
| 101 | + $html.='<td class="traphover">' |
|
| 102 | 102 | . $this->view->qlink( |
| 103 | 103 | $this->view->escape($val), |
| 104 | 104 | Url::fromPath( |
| 105 | - $this->urlPath . '/handler/add', |
|
| 105 | + $this->urlPath.'/handler/add', |
|
| 106 | 106 | array('ruleid' => $row->id) |
| 107 | 107 | ) |
| 108 | 108 | ); |
| 109 | 109 | if ($row->comment != '') |
| 110 | 110 | { |
| 111 | - $html.= '<span class="tohover">'. $row->comment .'</span></td>'; |
|
| 111 | + $html.='<span class="tohover">'.$row->comment.'</span></td>'; |
|
| 112 | 112 | } |
| 113 | - $html.= '</td>'; |
|
| 113 | + $html.='</td>'; |
|
| 114 | 114 | } else { |
| 115 | - $html .= '<td>' . $this->view->escape($val) . '</td>'; |
|
| 115 | + $html.='<td>'.$this->view->escape($val).'</td>'; |
|
| 116 | 116 | } |
| 117 | 117 | $firstCol=false; |
| 118 | 118 | |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | $this->checkReadPermission(); |
| 25 | 25 | $this->prepareTabs()->activate('status'); |
| 26 | 26 | |
| 27 | - $dbConn = $this->getUIDatabase()->getDb(); |
|
| 27 | + $dbConn=$this->getUIDatabase()->getDb(); |
|
| 28 | 28 | if ($dbConn === null) throw new \ErrorException('uncatched db error'); |
| 29 | 29 | |
| 30 | - $this->view->handlerTable = new HandlerTable( |
|
| 30 | + $this->view->handlerTable=new HandlerTable( |
|
| 31 | 31 | $this->moduleConfig->getTrapRuleName(), |
| 32 | 32 | $this->moduleConfig->getHandlerListTitles(), |
| 33 | 33 | $this->moduleConfig->getHandlerListDisplayColumns(), |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $this->view->handlerTable->setMaxPerPage($this->getModuleConfig()->itemListDisplay()); |
| 40 | 40 | |
| 41 | - $getVars = $this->getRequest()->getParams(); |
|
| 41 | + $getVars=$this->getRequest()->getParams(); |
|
| 42 | 42 | $this->view->handlerTable->getParams($getVars); |
| 43 | 43 | |
| 44 | 44 | $this->view->handlerTable->setMibloader($this->getMIB()); |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | $this->getHandlerListTable()->setConnection($dbConn); |
| 49 | 49 | $this->getHandlerListTable()->setMibloader($this->getMIB()); |
| 50 | 50 | // Apply pagination limits |
| 51 | - $this->view->table=$this->applyPaginationLimits($this->getHandlerListTable(),$this->getModuleConfig()->itemListDisplay()); |
|
| 51 | + $this->view->table=$this->applyPaginationLimits($this->getHandlerListTable(), $this->getModuleConfig()->itemListDisplay()); |
|
| 52 | 52 | |
| 53 | 53 | // Set Filter |
| 54 | - $this->view->filterEditor = $this->getHandlerListTable()->getFilterEditor($this->getRequest()); |
|
| 54 | + $this->view->filterEditor=$this->getHandlerListTable()->getFilterEditor($this->getRequest()); |
|
| 55 | 55 | |
| 56 | 56 | //$this->displayExitError('Handler/indexAction','Not implemented'); |
| 57 | 57 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | public function testruleAction() |
| 62 | 62 | { |
| 63 | 63 | $this->checkReadPermission(); |
| 64 | - $this->getTabs()->add('get',array( |
|
| 64 | + $this->getTabs()->add('get', array( |
|
| 65 | 65 | 'active' => true, |
| 66 | 66 | 'label' => $this->translate('Test Rule'), |
| 67 | 67 | 'url' => Url::fromRequest() |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | if ($this->params->get('rule') !== null) |
| 72 | 72 | { |
| 73 | - $this->view->rule= $this->params->get('rule'); |
|
| 73 | + $this->view->rule=$this->params->get('rule'); |
|
| 74 | 74 | } |
| 75 | 75 | else |
| 76 | 76 | { |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | catch (Exception $e) |
| 131 | 131 | { |
| 132 | - $this->displayExitError('Add handler : get host by IP/Name ',$e->getMessage()); |
|
| 132 | + $this->displayExitError('Add handler : get host by IP/Name ', $e->getMessage()); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | |
| 136 | 136 | // if one unique host found -> put id text input |
| 137 | - if (count($hosts)==1) { |
|
| 137 | + if (count($hosts) == 1) { |
|
| 138 | 138 | $this->view->hostname=$hosts[0]->name; |
| 139 | 139 | //$hostid=$hosts[0]->id; |
| 140 | 140 | // Tell JS to get services when page is loaded |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | else |
| 145 | 145 | { |
| 146 | - foreach($hosts as $key=>$val) |
|
| 146 | + foreach ($hosts as $key=>$val) |
|
| 147 | 147 | { |
| 148 | - array_push($this->view->hostlist,$hosts[$key]->name); |
|
| 148 | + array_push($this->view->hostlist, $hosts[$key]->name); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
@@ -184,18 +184,18 @@ discard block |
||
| 184 | 184 | $currentObjectTypeEnum |
| 185 | 185 | ); |
| 186 | 186 | $oid_index++; |
| 187 | - array_push($this->view->objectList,$currentObject); |
|
| 187 | + array_push($this->view->objectList, $currentObject); |
|
| 188 | 188 | // set currrent object to null in allObjects |
| 189 | 189 | if (isset($allObjects[$val->oid])) |
| 190 | 190 | { |
| 191 | 191 | $allObjects[$val->oid]=null; |
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | - if ($allObjects!=null) // in case trap doesn't have objects or is not resolved |
|
| 194 | + if ($allObjects != null) // in case trap doesn't have objects or is not resolved |
|
| 195 | 195 | { |
| 196 | 196 | foreach ($allObjects as $key => $val) |
| 197 | 197 | { |
| 198 | - if ($val==null) { continue; } |
|
| 198 | + if ($val == null) { continue; } |
|
| 199 | 199 | array_push($this->view->objectList, array( |
| 200 | 200 | $oid_index, |
| 201 | 201 | $key, |
@@ -223,9 +223,9 @@ discard block |
||
| 223 | 223 | // Check if hostname still exists |
| 224 | 224 | $host_get=$this->getUIDatabase()->getHostByName($this->view->hostname); |
| 225 | 225 | |
| 226 | - if (count($host_get)==0) |
|
| 226 | + if (count($host_get) == 0) |
|
| 227 | 227 | { |
| 228 | - $this->view->warning_message='Host '.$this->view->hostname. ' doesn\'t exists anymore'; |
|
| 228 | + $this->view->warning_message='Host '.$this->view->hostname.' doesn\'t exists anymore'; |
|
| 229 | 229 | $this->view->serviceGet=false; |
| 230 | 230 | } |
| 231 | 231 | else |
@@ -233,10 +233,10 @@ discard block |
||
| 233 | 233 | // Tell JS to get services when page is loaded |
| 234 | 234 | $this->view->serviceGet=true; |
| 235 | 235 | // get service id for form to set : |
| 236 | - $serviceID=$this->getUIDatabase()->getServiceIDByName($this->view->hostname,$ruleDetail->service_name); |
|
| 237 | - if (count($serviceID) ==0) |
|
| 236 | + $serviceID=$this->getUIDatabase()->getServiceIDByName($this->view->hostname, $ruleDetail->service_name); |
|
| 237 | + if (count($serviceID) == 0) |
|
| 238 | 238 | { |
| 239 | - $this->view->warning_message=' Service '.$ruleDetail->service_name. ' doesn\'t exists anymore'; |
|
| 239 | + $this->view->warning_message=' Service '.$ruleDetail->service_name.' doesn\'t exists anymore'; |
|
| 240 | 240 | } |
| 241 | 241 | else |
| 242 | 242 | { |
@@ -253,9 +253,9 @@ discard block |
||
| 253 | 253 | { |
| 254 | 254 | // Check if groupe exists |
| 255 | 255 | $group_get=$this->getUIDatabase()->getHostGroupByName($this->view->hostgroupname); |
| 256 | - if (count($group_get)==0) |
|
| 256 | + if (count($group_get) == 0) |
|
| 257 | 257 | { |
| 258 | - $this->view->warning_message='HostGroup '.$this->view->hostgroupname. ' doesn\'t exists anymore'; |
|
| 258 | + $this->view->warning_message='HostGroup '.$this->view->hostgroupname.' doesn\'t exists anymore'; |
|
| 259 | 259 | $this->view->serviceGroupGet=false; |
| 260 | 260 | } |
| 261 | 261 | else |
@@ -273,9 +273,9 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | // Tell JS to get services when page is loaded |
| 275 | 275 | $this->view->serviceGroupGet=true; |
| 276 | - if ($foundGrpService==0) |
|
| 276 | + if ($foundGrpService == 0) |
|
| 277 | 277 | { |
| 278 | - $this->view->warning_message.=' Service '.$ruleDetail->service_name. ' doesn\'t exists anymore'; |
|
| 278 | + $this->view->warning_message.=' Service '.$ruleDetail->service_name.' doesn\'t exists anymore'; |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | } |
@@ -293,12 +293,12 @@ discard block |
||
| 293 | 293 | $index=1; |
| 294 | 294 | // check in display & rule for : OID(<oid>) |
| 295 | 295 | $matches=array(); |
| 296 | - while ( preg_match('/_OID\(([\.0-9\*]+)\)/',$display,$matches) || |
|
| 297 | - preg_match('/_OID\(([\.0-9\*]+)\)/',$rule,$matches)) |
|
| 296 | + while (preg_match('/_OID\(([\.0-9\*]+)\)/', $display, $matches) || |
|
| 297 | + preg_match('/_OID\(([\.0-9\*]+)\)/', $rule, $matches)) |
|
| 298 | 298 | { |
| 299 | 299 | $curOid=$matches[1]; |
| 300 | 300 | |
| 301 | - if ( (preg_match('/\*/',$curOid) == 0 ) |
|
| 301 | + if ((preg_match('/\*/', $curOid) == 0) |
|
| 302 | 302 | && ($object=$this->getMIB()->translateOID($curOid)) != null) |
| 303 | 303 | { |
| 304 | 304 | array_push($curObjectList, array( |
@@ -323,9 +323,9 @@ discard block |
||
| 323 | 323 | 'not found' |
| 324 | 324 | )); |
| 325 | 325 | } |
| 326 | - $curOid = preg_replace('/\*/','\*',$curOid); |
|
| 327 | - $display=preg_replace('/_OID\('.$curOid.'\)/','\$'.$index.'\$',$display); |
|
| 328 | - $rule=preg_replace('/_OID\('.$curOid.'\)/','\$'.$index.'\$',$rule); |
|
| 326 | + $curOid=preg_replace('/\*/', '\*', $curOid); |
|
| 327 | + $display=preg_replace('/_OID\('.$curOid.'\)/', '\$'.$index.'\$', $display); |
|
| 328 | + $rule=preg_replace('/_OID\('.$curOid.'\)/', '\$'.$index.'\$', $rule); |
|
| 329 | 329 | $index++; |
| 330 | 330 | } |
| 331 | 331 | return $curObjectList; |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | $this->checkConfigPermission(); |
| 341 | 341 | // set up tab |
| 342 | 342 | $this->prepareTabs(); |
| 343 | - $this->getTabs()->add('get',array( |
|
| 343 | + $this->getTabs()->add('get', array( |
|
| 344 | 344 | 'active' => true, |
| 345 | 345 | 'label' => $this->translate('Add handler'), |
| 346 | 346 | 'url' => Url::fromRequest() |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | |
| 354 | 354 | //$this->view->trapvalues=false; // Set to true to display 'value' colum in objects |
| 355 | 355 | |
| 356 | - if (($trapid = $this->params->get('fromid')) !== null) { |
|
| 356 | + if (($trapid=$this->params->get('fromid')) !== null) { |
|
| 357 | 357 | /********** Setup from existing trap ***************/ |
| 358 | 358 | $this->add_from_existing($trapid); |
| 359 | 359 | return; |
@@ -373,11 +373,11 @@ discard block |
||
| 373 | 373 | $this->view->setRuleMatch=$ruleDetail->action_match; |
| 374 | 374 | $this->view->setRuleNoMatch=$ruleDetail->action_nomatch; |
| 375 | 375 | $this->view->hostgroupname=$ruleDetail->host_group_name; |
| 376 | - $this->view->modified=gmdate("Y-m-d\TH:i:s\Z",$ruleDetail->modified); |
|
| 376 | + $this->view->modified=gmdate("Y-m-d\TH:i:s\Z", $ruleDetail->modified); |
|
| 377 | 377 | $this->view->modifier=$ruleDetail->modifier; |
| 378 | 378 | |
| 379 | - $this->view->comment = $ruleDetail->comment; |
|
| 380 | - $this->view->category = $ruleDetail->category; |
|
| 379 | + $this->view->comment=$ruleDetail->comment; |
|
| 380 | + $this->view->category=$ruleDetail->category; |
|
| 381 | 381 | |
| 382 | 382 | // Warning message if host/service don't exists anymore |
| 383 | 383 | $this->view->warning_message=''; |
@@ -428,28 +428,28 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | $params=array( |
| 430 | 430 | // id (also db) => array('post' => post id, 'val' => default val, 'db' => send to table) |
| 431 | - 'hostgroup' => array('post' => 'hostgroup', 'db'=>false), |
|
| 432 | - 'db_rule' => array('post' => 'db_rule', 'db'=>false), |
|
| 433 | - 'hostid' => array('post' => 'hostid', 'db'=>false), |
|
| 434 | - 'host_name' => array('post' => 'hostname', 'val' => null, 'db'=>true), |
|
| 435 | - 'host_group_name'=> array('post' => null, 'val' => null, 'db'=>true), |
|
| 436 | - 'serviceid' => array('post' => 'serviceid', 'db'=>false), |
|
| 437 | - 'service_name' => array('post' => 'serviceName', 'db'=>true), |
|
| 438 | - 'comment' => array('post' => 'comment', 'val' => '', 'db'=>true), |
|
| 439 | - 'rule_type' => array('post' => 'category', 'val' => 0, 'db'=>true), |
|
| 440 | - 'trap_oid' => array('post' => 'oid', 'db'=>true), |
|
| 441 | - 'revert_ok' => array('post' => 'revertOK', 'val' => 0, 'db'=>true), |
|
| 442 | - 'display' => array('post' => 'display', 'val' => '', 'db'=>true), |
|
| 443 | - 'rule' => array('post' => 'rule', 'val' => '', 'db'=>true), |
|
| 444 | - 'action_match' => array('post' => 'ruleMatch', 'val' => -1, 'db'=>true), |
|
| 445 | - 'action_nomatch'=> array('post' => 'ruleNoMatch', 'val' => -1, 'db'=>true), |
|
| 446 | - 'ip4' => array('post' => null, 'val' => null, 'db'=>true), |
|
| 447 | - 'ip6' => array('post' => null, 'val' => null, 'db'=>true), |
|
| 448 | - 'action_form' => array('post' => 'action_form', 'val' => null, 'db'=>false) |
|
| 431 | + 'hostgroup' => array('post' => 'hostgroup', 'db'=>false), |
|
| 432 | + 'db_rule' => array('post' => 'db_rule', 'db'=>false), |
|
| 433 | + 'hostid' => array('post' => 'hostid', 'db'=>false), |
|
| 434 | + 'host_name' => array('post' => 'hostname', 'val' => null, 'db'=>true), |
|
| 435 | + 'host_group_name'=> array('post' => null, 'val' => null, 'db'=>true), |
|
| 436 | + 'serviceid' => array('post' => 'serviceid', 'db'=>false), |
|
| 437 | + 'service_name' => array('post' => 'serviceName', 'db'=>true), |
|
| 438 | + 'comment' => array('post' => 'comment', 'val' => '', 'db'=>true), |
|
| 439 | + 'rule_type' => array('post' => 'category', 'val' => 0, 'db'=>true), |
|
| 440 | + 'trap_oid' => array('post' => 'oid', 'db'=>true), |
|
| 441 | + 'revert_ok' => array('post' => 'revertOK', 'val' => 0, 'db'=>true), |
|
| 442 | + 'display' => array('post' => 'display', 'val' => '', 'db'=>true), |
|
| 443 | + 'rule' => array('post' => 'rule', 'val' => '', 'db'=>true), |
|
| 444 | + 'action_match' => array('post' => 'ruleMatch', 'val' => -1, 'db'=>true), |
|
| 445 | + 'action_nomatch'=> array('post' => 'ruleNoMatch', 'val' => -1, 'db'=>true), |
|
| 446 | + 'ip4' => array('post' => null, 'val' => null, 'db'=>true), |
|
| 447 | + 'ip6' => array('post' => null, 'val' => null, 'db'=>true), |
|
| 448 | + 'action_form' => array('post' => 'action_form', 'val' => null, 'db'=>false) |
|
| 449 | 449 | ); |
| 450 | 450 | |
| 451 | 451 | if (isset($postData[$params['action_form']['post']]) |
| 452 | - && $postData[$params['action_form']['post']] == 'delete' ) |
|
| 452 | + && $postData[$params['action_form']['post']] == 'delete') |
|
| 453 | 453 | { |
| 454 | 454 | try |
| 455 | 455 | { |
@@ -469,16 +469,16 @@ discard block |
||
| 469 | 469 | } |
| 470 | 470 | foreach (array_keys($params) as $key) |
| 471 | 471 | { |
| 472 | - if ($params[$key]['post']==null) continue; // data not sent in post vars |
|
| 473 | - if (! isset($postData[$params[$key]['post']])) |
|
| 472 | + if ($params[$key]['post'] == null) continue; // data not sent in post vars |
|
| 473 | + if (!isset($postData[$params[$key]['post']])) |
|
| 474 | 474 | { |
| 475 | 475 | // should not happen as the js checks data |
| 476 | - $this->_helper->json(array('status'=>'No ' . $key)); |
|
| 476 | + $this->_helper->json(array('status'=>'No '.$key)); |
|
| 477 | 477 | } |
| 478 | 478 | else |
| 479 | 479 | { |
| 480 | 480 | $data=$postData[$params[$key]['post']]; |
| 481 | - if ($data!=null && $data !="") |
|
| 481 | + if ($data != null && $data != "") |
|
| 482 | 482 | { |
| 483 | 483 | $params[$key]['val']=$postData[$params[$key]['post']]; |
| 484 | 484 | } |
@@ -487,8 +487,8 @@ discard block |
||
| 487 | 487 | |
| 488 | 488 | try |
| 489 | 489 | { |
| 490 | - $isHostGroup=($params['hostgroup']['val'] == 1)?true:false; |
|
| 491 | - if (! $isHostGroup ) |
|
| 490 | + $isHostGroup=($params['hostgroup']['val'] == 1) ?true:false; |
|
| 491 | + if (!$isHostGroup) |
|
| 492 | 492 | { // checks if selection by host |
| 493 | 493 | $hostAddr=$this->getUIDatabase()->getHostInfoByID($params['hostid']['val']); |
| 494 | 494 | $params['ip4']['val']=$hostAddr->ip4; |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | } |
| 502 | 502 | if (!is_numeric($params['serviceid']['val'])) |
| 503 | 503 | { |
| 504 | - $this->_helper->json(array('status'=>"Invalid service id ". $params['serviceid']['val'])); |
|
| 504 | + $this->_helper->json(array('status'=>"Invalid service id ".$params['serviceid']['val'])); |
|
| 505 | 505 | return; |
| 506 | 506 | } |
| 507 | 507 | $serviceName=$this->getUIDatabase()->getObjectNameByid($params['serviceid']['val']); |
@@ -520,15 +520,15 @@ discard block |
||
| 520 | 520 | return; |
| 521 | 521 | } |
| 522 | 522 | // Put param in correct column (group_name) |
| 523 | - $params['host_group_name']['val'] = $params['host_name']['val']; |
|
| 523 | + $params['host_group_name']['val']=$params['host_name']['val']; |
|
| 524 | 524 | $params['host_name']['val']=null; |
| 525 | 525 | } |
| 526 | 526 | $dbparams=array(); |
| 527 | 527 | foreach ($params as $key=>$val) |
| 528 | 528 | { |
| 529 | - if ($val['db']==true ) |
|
| 529 | + if ($val['db'] == true) |
|
| 530 | 530 | { |
| 531 | - $dbparams[$key] = $val['val']; |
|
| 531 | + $dbparams[$key]=$val['val']; |
|
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | 534 | // echo '<br>'; print_r($dbparams);echo '<br>'; |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | } |
| 540 | 540 | else |
| 541 | 541 | { |
| 542 | - $this->getUIDatabase()->updateHandlerRule($dbparams,$params['db_rule']['val']); |
|
| 542 | + $this->getUIDatabase()->updateHandlerRule($dbparams, $params['db_rule']['val']); |
|
| 543 | 543 | $ruleID=$params['db_rule']['val']; |
| 544 | 544 | } |
| 545 | 545 | } |
@@ -558,10 +558,10 @@ discard block |
||
| 558 | 558 | */ |
| 559 | 559 | protected function getTrapDetail($trapid) |
| 560 | 560 | { |
| 561 | - if (!preg_match('/^[0-9]+$/',$trapid)) { throw new Exception('Invalid id'); } |
|
| 561 | + if (!preg_match('/^[0-9]+$/', $trapid)) { throw new Exception('Invalid id'); } |
|
| 562 | 562 | $queryArray=$this->getModuleConfig()->trapDetailQuery(); |
| 563 | 563 | |
| 564 | - $dbConn = $this->getUIDatabase()->getDbConn(); |
|
| 564 | + $dbConn=$this->getUIDatabase()->getDbConn(); |
|
| 565 | 565 | if ($dbConn === null) throw new \ErrorException('uncatched db error'); |
| 566 | 566 | // *************** Get main data |
| 567 | 567 | // extract columns and titles; |
@@ -571,19 +571,19 @@ discard block |
||
| 571 | 571 | } |
| 572 | 572 | try |
| 573 | 573 | { |
| 574 | - $query = $dbConn->select() |
|
| 575 | - ->from($this->getModuleConfig()->getTrapTableName(),$elmts) |
|
| 576 | - ->where('id=?',$trapid); |
|
| 574 | + $query=$dbConn->select() |
|
| 575 | + ->from($this->getModuleConfig()->getTrapTableName(), $elmts) |
|
| 576 | + ->where('id=?', $trapid); |
|
| 577 | 577 | $trapDetail=$dbConn->fetchRow($query); |
| 578 | - if ( $trapDetail == null ) |
|
| 578 | + if ($trapDetail == null) |
|
| 579 | 579 | { |
| 580 | - $trapDetail = 'NULL'; |
|
| 580 | + $trapDetail='NULL'; |
|
| 581 | 581 | throw new Exception('No traps was found with id = '.$trapid); |
| 582 | 582 | } |
| 583 | 583 | } |
| 584 | 584 | catch (Exception $e) |
| 585 | 585 | { |
| 586 | - $this->displayExitError('Add handler : get trap detail returning : '.print_r($trapDetail,true),$e->getMessage()); |
|
| 586 | + $this->displayExitError('Add handler : get trap detail returning : '.print_r($trapDetail, true), $e->getMessage()); |
|
| 587 | 587 | return; |
| 588 | 588 | } |
| 589 | 589 | |
@@ -597,10 +597,10 @@ discard block |
||
| 597 | 597 | */ |
| 598 | 598 | protected function getTrapobjects($trapid) |
| 599 | 599 | { |
| 600 | - if (!preg_match('/^[0-9]+$/',$trapid)) { throw new Exception('Invalid id'); } |
|
| 600 | + if (!preg_match('/^[0-9]+$/', $trapid)) { throw new Exception('Invalid id'); } |
|
| 601 | 601 | $queryArrayData=$this->getModuleConfig()->trapDataDetailQuery(); |
| 602 | 602 | |
| 603 | - $dbConn = $this->getUIDatabase()->getDbConn(); |
|
| 603 | + $dbConn=$this->getUIDatabase()->getDbConn(); |
|
| 604 | 604 | if ($dbConn === null) throw new \ErrorException('uncatched db error'); |
| 605 | 605 | // *************** Get object data |
| 606 | 606 | // extract columns and titles; |
@@ -610,15 +610,15 @@ discard block |
||
| 610 | 610 | } |
| 611 | 611 | try |
| 612 | 612 | { |
| 613 | - $query = $dbConn->select() |
|
| 614 | - ->from($this->moduleConfig->getTrapDataTableName(),$data_elmts) |
|
| 615 | - ->where('trap_id=?',$trapid); |
|
| 613 | + $query=$dbConn->select() |
|
| 614 | + ->from($this->moduleConfig->getTrapDataTableName(), $data_elmts) |
|
| 615 | + ->where('trap_id=?', $trapid); |
|
| 616 | 616 | $trapDetail=$dbConn->fetchAll($query); |
| 617 | 617 | // if ( $trapDetail == null ) throw new Exception('No traps was found with id = '.$trapid); |
| 618 | 618 | } |
| 619 | 619 | catch (Exception $e) |
| 620 | 620 | { |
| 621 | - $this->displayExitError('Add handler : get trap data detail : ',$e->getMessage()); |
|
| 621 | + $this->displayExitError('Add handler : get trap data detail : ', $e->getMessage()); |
|
| 622 | 622 | return array(); |
| 623 | 623 | } |
| 624 | 624 | |
@@ -632,24 +632,24 @@ discard block |
||
| 632 | 632 | */ |
| 633 | 633 | protected function getRuleDetail($ruleid) |
| 634 | 634 | { |
| 635 | - if (!preg_match('/^[0-9]+$/',$ruleid)) { throw new Exception('Invalid id'); } |
|
| 635 | + if (!preg_match('/^[0-9]+$/', $ruleid)) { throw new Exception('Invalid id'); } |
|
| 636 | 636 | $queryArray=$this->getModuleConfig()->ruleDetailQuery(); |
| 637 | 637 | |
| 638 | - $dbConn = $this->getUIDatabase()->getDbConn(); |
|
| 638 | + $dbConn=$this->getUIDatabase()->getDbConn(); |
|
| 639 | 639 | if ($dbConn === null) throw new \ErrorException('uncatched db error'); |
| 640 | 640 | // *************** Get main data |
| 641 | 641 | try |
| 642 | 642 | { |
| 643 | - $query = $dbConn->select() |
|
| 644 | - ->from($this->getModuleConfig()->getTrapRuleName(),$queryArray) |
|
| 645 | - ->where('id=?',$ruleid); |
|
| 643 | + $query=$dbConn->select() |
|
| 644 | + ->from($this->getModuleConfig()->getTrapRuleName(), $queryArray) |
|
| 645 | + ->where('id=?', $ruleid); |
|
| 646 | 646 | $ruleDetail=$dbConn->fetchRow($query); |
| 647 | - if ( $ruleDetail == null ) throw new Exception('No rule was found with id = '.$ruleid); |
|
| 647 | + if ($ruleDetail == null) throw new Exception('No rule was found with id = '.$ruleid); |
|
| 648 | 648 | } |
| 649 | 649 | catch (Exception $e) |
| 650 | 650 | { |
| 651 | - $this->displayExitError('Update handler : get rule detail',$e->getMessage()); |
|
| 652 | - throw new Exception('Error : ' . $e->getMessage()); |
|
| 651 | + $this->displayExitError('Update handler : get rule detail', $e->getMessage()); |
|
| 652 | + throw new Exception('Error : '.$e->getMessage()); |
|
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | return $ruleDetail; |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | { |
| 663 | 663 | return $this->getTabs()->add('status', array( |
| 664 | 664 | 'label' => $this->translate('Trap handlers'), |
| 665 | - 'url' => $this->getModuleConfig()->urlPath() . '/handler') |
|
| 665 | + 'url' => $this->getModuleConfig()->urlPath().'/handler') |
|
| 666 | 666 | ); |
| 667 | 667 | } |
| 668 | 668 | |