Passed
Push — master ( d35be2...9c2cb2 )
by Patrick
02:02
created
application/clicommands/StatusCommand.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@
 block discarded – undo
40 40
 			$query = $dataBase->select()->from($Config->getTrapRuleName(),array('COUNT(*)'));			
41 41
 			printf("Number of rules : %s\n", $dataBase->fetchOne($query) );
42 42
 			
43
-		}
44
-		catch (Exception $e)
43
+		} catch (Exception $e)
45 44
 		{
46 45
 			printf('Error in DB : %s\n', $e->getMessage());
47 46
 		}	   
Please login to merge, or discard this patch.
application/clicommands/TrapsCommand.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,14 +42,12 @@  discard block
 block discarded – undo
42 42
 			if ($days=='<default>')
43 43
 			{
44 44
 				$trap->eraseOldTraps();
45
-			}
46
-			else
45
+			} else
47 46
 			{
48 47
 				$trap->eraseOldTraps($days);
49 48
 			}
50 49
 			
51
-		}
52
-		catch (Exception $e)
50
+		} catch (Exception $e)
53 51
 		{
54 52
 			echo 'Error in updating : ' . $e->getMessage();
55 53
 		}	   
@@ -74,8 +72,7 @@  discard block
 block discarded – undo
74 72
 		try 
75 73
 		{
76 74
 			$trap->reset_services();
77
-		} 
78
-		catch (Exception $e) 
75
+		} catch (Exception $e) 
79 76
 		{
80 77
 			echo 'ERROR : '. $e->getMessage();
81 78
 		}
Please login to merge, or discard this patch.
library/Trapdirector/Tables/TrapTableHostList.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -256,7 +256,9 @@  discard block
 block discarded – undo
256 256
 			$first=1;
257 257
 			foreach($this->moduleConfig->getTrapListSearchColumns() as $column)
258 258
 			{
259
-				if ($first==0) $sql.=' OR ';
259
+				if ($first==0) {
260
+					$sql.=' OR ';
261
+				}
260 262
 				$first=0;
261 263
 				$sql.=" ".$column." LIKE  '%".$this->filter_query."%' ";
262 264
 			}
@@ -264,10 +266,14 @@  discard block
 block discarded – undo
264 266
 		}
265 267
 		if ($this->filter_done == 1)
266 268
 		{
267
-			if ($sql != '') $sql.=' AND ';
269
+			if ($sql != '') {
270
+				$sql.=' AND ';
271
+			}
268 272
 			$sql.="(status != 'done')";
269 273
 		}
270
-		if ($sql != '') $query->where($sql);		
274
+		if ($sql != '') {
275
+			$query->where($sql);
276
+		}
271 277
         return $query;
272 278
     }	
273 279
 
Please login to merge, or discard this patch.
library/Trapdirector/Tables/HandlerTableList.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -99,13 +99,11 @@  discard block
 block discarded – undo
99 99
 								if (isset($oidName['name']))
100 100
 								{
101 101
 									$val=$oidName['name'];
102
-								}
103
-								else
102
+								} else
104 103
 								{
105 104
 									$val = $row->$rowkey;
106 105
 								}								
107
-							}
108
-							else
106
+							} else
109 107
 							{
110 108
 								$val = $row->$rowkey;
111 109
 							}
@@ -114,8 +112,7 @@  discard block
 block discarded – undo
114 112
 							if ($row->$rowkey == null)
115 113
 							{
116 114
 								$val = $row->host_group_name;
117
-							}
118
-							else
115
+							} else
119 116
 							{
120 117
 								$val = $row->$rowkey;
121 118
 							}
Please login to merge, or discard this patch.
library/Trapdirector/Tables/TrapTableList.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -214,7 +214,9 @@  discard block
 block discarded – undo
214 214
 			$first=1;
215 215
 			foreach($this->moduleConfig->getTrapListSearchColumns() as $column)
216 216
 			{
217
-				if ($first==0) $sql.=' OR ';
217
+				if ($first==0) {
218
+					$sql.=' OR ';
219
+				}
218 220
 				$first=0;
219 221
 				$sql.=" CAST(".$column." AS  char(100))  LIKE  '%".$this->filter_query."%' ";
220 222
 			}
@@ -222,10 +224,14 @@  discard block
 block discarded – undo
222 224
 		}
223 225
 		if ($this->filter_done == 1)
224 226
 		{
225
-			if ($sql != '') $sql.=' AND ';
227
+			if ($sql != '') {
228
+				$sql.=' AND ';
229
+			}
226 230
 			$sql.="(status != 'done')";
227 231
 		}
228
-		if ($sql != '') $query->where($sql);		
232
+		if ($sql != '') {
233
+			$query->where($sql);
234
+		}
229 235
         return $query;
230 236
     }	
231 237
 
Please login to merge, or discard this patch.
bin/trap_in.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,15 +30,13 @@
 block discarded – undo
30 30
 
31 31
 	$Trap->add_rule_final(microtime(true) - $time1);
32 32
 	
33
-}
34
-catch (Exception $e) 
33
+} catch (Exception $e) 
35 34
 {
36 35
     if ($Trap == null)
37 36
     {  // Exception in trap creation : log in display & syslog
38 37
         $logging = new Logging();
39 38
         $logging->log("Caught exception creating Trap class",2);
40
-    }
41
-    else
39
+    } else
42 40
     {
43 41
 	   $Trap->trapLog("Exception : ". $e->getMessage(),2,0);
44 42
     }
Please login to merge, or discard this patch.
library/Trapdirector/Config/MIBLoader.php 1 patch
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -94,7 +94,9 @@  discard block
 block discarded – undo
94 94
 					array('id' => 'id'))
95 95
 				->where("oid = '".$trap."'") ;
96 96
 		$id=$dbconn->fetchRow($query);
97
-		if ( ($id == null) || ! property_exists($id,'id') ) return null;
97
+		if ( ($id == null) || ! property_exists($id,'id') ) {
98
+			return null;
99
+		}
98 100
 		
99 101
 		$query=$dbconn->select()
100 102
 		        ->from(
@@ -107,7 +109,9 @@  discard block
 block discarded – undo
107 109
 		            'o.trap_id='.$id->id )
108 110
 		        ->where("o.object_id = c.id");
109 111
 		$listObjects=$dbconn->fetchAll($query);
110
-		if ( count($listObjects)==0 ) return null;
112
+		if ( count($listObjects)==0 ) {
113
+			return null;
114
+		}
111 115
 		
112 116
 		foreach ($listObjects as $val)
113 117
 		{
@@ -128,7 +132,10 @@  discard block
 block discarded – undo
128 132
 	*/
129 133
 	public function translateOID($oid)
130 134
 	{
131
-	    if (!preg_match('/^\./',$oid)) $oid = '.' . $oid; // Add a leading '.'
135
+	    if (!preg_match('/^\./',$oid)) {
136
+	    	$oid = '.' . $oid;
137
+	    }
138
+	    // Add a leading '.'
132 139
 		$retArray=array('oid' => $oid, 'mib' => null, 'name'=>null,'type'=>null);
133 140
 		$dbconn = $this->db->getConnection();
134 141
 
@@ -166,8 +173,7 @@  discard block
 block discarded – undo
166 173
 		{
167 174
 		    $retArray['type']=$matches[1];
168 175
 		    $retArray['type_enum']=$matches[2];
169
-		}
170
-		else
176
+		} else
171 177
 		{
172 178
 			$retArray['type']=$translate;
173 179
 			$retArray['type_enum']='';			
@@ -233,8 +239,7 @@  discard block
 block discarded – undo
233 239
 	    if ($oid===null)
234 240
 	    {
235 241
 	        $where="c.id = '$id'";
236
-	    }
237
-	    else
242
+	    } else
238 243
 	    {
239 244
 	        $where="c.oid = '$oid'";
240 245
 	    }
Please login to merge, or discard this patch.
library/Trapdirector/TrapsProcess/Logging.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,9 @@
 block discarded – undo
68 68
         switch ($outputType)
69 69
         {
70 70
             case 'file':
71
-                if ($outputFile == null) throw new Exception("File logging without file !");
71
+                if ($outputFile == null) {
72
+                	throw new Exception("File logging without file !");
73
+                }
72 74
                 $this->setFile($outputFile);
73 75
                 $this->setDestination('file');
74 76
                 break;
Please login to merge, or discard this patch.
application/controllers/ReceivedController.php 1 patch
Braces   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -76,9 +76,10 @@  discard block
 block discarded – undo
76 76
 				->from($this->moduleConfig->getTrapTableName(),$elmts)
77 77
 				->where('id=?',$trapid);
78 78
 			$trapDetail=$db->fetchRow($query);
79
-			if ( $trapDetail == null) throw new Exception('No traps was found with id = '.$trapid);
80
-		}
81
-		catch (Exception $e)
79
+			if ( $trapDetail == null) {
80
+				throw new Exception('No traps was found with id = '.$trapid);
81
+			}
82
+		} catch (Exception $e)
82 83
 		{
83 84
 			$this->displayExitError('Trap detail',$e->getMessage());
84 85
 			return;
@@ -109,8 +110,7 @@  discard block
 block discarded – undo
109 110
 				->from($this->moduleConfig->getTrapDataTableName(),$data_elmts)
110 111
 				->where('trap_id=?',$trapid);
111 112
 			$trapDetail=$db->fetchAll($query);
112
-		}
113
-		catch (Exception $e)
113
+		} catch (Exception $e)
114 114
 		{
115 115
 			$this->displayExitError('Trap detail',$e->getMessage());
116 116
 		}
@@ -118,8 +118,7 @@  discard block
 block discarded – undo
118 118
 		if ($trapDetail == null ) 
119 119
 		{
120 120
 			$this->view->data=false;
121
-		}
122
-		else
121
+		} else
123 122
 		{
124 123
 			$this->view->data=true;
125 124
 			// Store result in array.
@@ -205,8 +204,7 @@  discard block
 block discarded – undo
205 204
 			$ip=$postData['IP'];
206 205
 			$oid=$postData['OID'];
207 206
 			$action=$postData['action'];
208
-		}
209
-		else
207
+		} else
210 208
 		{
211 209
 			$this->_helper->json(array('status'=>'Missing variables'));
212 210
 			return;
Please login to merge, or discard this patch.