Passed
Pull Request — master (#50)
by
unknown
02:24 queued 29s
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/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.
library/Trapdirector/TrapsProcess/Plugins.php 1 patch
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@  discard block
 block discarded – undo
56 56
         if ($pluginDir == '')
57 57
         {
58 58
             $this->pluginDir=dirname(__DIR__).'/Plugins';
59
-        }
60
-        else 
59
+        } else 
61 60
         {
62 61
             $this->pluginDir=$pluginDir;
63 62
         }
@@ -94,8 +93,7 @@  discard block
 block discarded – undo
94 93
         {
95 94
             $this->logClass->log('No enabled plugins',DEBUG);
96 95
             return;
97
-        }
98
-        else
96
+        } else
99 97
         {   // Saved config : <plugin name>;<Catch all OID ? 1|0>;<Trap target ? 1|0>;<func 1 name>|<func 2 name>... ,<plugin2 name>....
100 98
             $this->logClass->log('Enabled plugins = '.$PluginList,DEBUG);
101 99
             
@@ -233,9 +231,11 @@  discard block
 block discarded – undo
233 231
      */
234 232
     public function registerPlugin(string $pluginName)
235 233
     {
236
-        if ( ! isset($this->pluginsList[$pluginName]) ) // Plugin isn't enable, create entry
234
+        if ( ! isset($this->pluginsList[$pluginName]) ) {
235
+        	// Plugin isn't enable, create entry
237 236
         {
238 237
             $pluginListElmt = array();
238
+        }
239 239
             $pluginListElmt['object'] = null; // class not loaded
240 240
             $pluginListElmt['enabled'] = false;
241 241
             $this->pluginsList[$pluginName] = $pluginListElmt;
@@ -282,8 +282,7 @@  discard block
 block discarded – undo
282 282
                             . $pluginName . ' and ' . $this->functionList[$fname]['plugin']);
283 283
                     }
284 284
                     
285
-                }
286
-                else
285
+                } else
287 286
                 {
288 287
                     $this->functionList[$fname]=array();
289 288
                     $this->functionList[$fname]['plugin'] = $pluginName;
@@ -326,11 +325,13 @@  discard block
 block discarded – undo
326 325
                 $retDisplay .= $e->getMessage() . ' / ';
327 326
             }
328 327
         }
329
-        if ($checkEnabled === false) // Load all php files in plugin dir
328
+        if ($checkEnabled === false) {
329
+        	// Load all php files in plugin dir
330 330
         {
331 331
             foreach (glob($this->pluginDir."/*.php") as $filename)
332 332
             {             
333 333
                 $pluginName=basename($filename,'.php');
334
+        }
334 335
                 if (!preg_match('/^[a-zA-Z0-9]+$/',$pluginName))
335 336
                 {
336 337
                     $this->logClass->log("Invalid plugin name : ".$pluginName, WARN);
@@ -348,8 +349,7 @@  discard block
 block discarded – undo
348 349
         if ($retDisplay == '')
349 350
         {
350 351
             return 'All plugins loaded OK';
351
-        }
352
-        else
352
+        } else
353 353
         {
354 354
             return $retDisplay;
355 355
         }
Please login to merge, or discard this patch.
library/Trapdirector/TrapsProcess/Database.php 1 patch
Braces   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -153,8 +153,7 @@  discard block
 block discarded – undo
153 153
         if ($value != null && isset($value['id']))
154 154
         {   // Entry exists -> update
155 155
             $sql='UPDATE '.$this->dbPrefix.'db_config SET value = \''.$element.'\' WHERE (id = '.$value['id'].')';
156
-        }
157
-        else
156
+        } else
158 157
         {   // Entry does no exists -> create
159 158
             $sql='INSERT INTO '.$this->dbPrefix.'db_config (name,value) VALUES (\''.$name.'\' , \''.$element.'\' )';
160 159
         }
@@ -222,8 +221,7 @@  discard block
 block discarded – undo
222 221
                 if (preg_match('/^ *CREATE TABLE ([^ ]+)/',$newline,$cur_table_array))
223 222
                 {
224 223
                     $cur_table='table '.$cur_table_array[1];
225
-                }
226
-                else
224
+                } else
227 225
                 {
228 226
                     $cur_table='secret SQL stuff :-)';
229 227
                 }
@@ -267,8 +265,7 @@  discard block
 block discarded – undo
267 265
         if ($this->trapDBType == 'pgsql')
268 266
         {
269 267
             $prefix .= 'update_pgsql/schema_';
270
-        }
271
-        else
268
+        } else
272 269
         {
273 270
             $prefix .= 'update_sql/schema_';
274 271
         }
@@ -312,7 +309,10 @@  discard block
 block discarded – undo
312 309
             $db_conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
313 310
             while (($line=fgets($input_stream)) !== false)
314 311
             {
315
-                if (preg_match('/^#/', $line)) continue; // ignore comment lines
312
+                if (preg_match('/^#/', $line)) {
313
+                	continue;
314
+                }
315
+                // ignore comment lines
316 316
                 $newline.=chop(preg_replace('/#PREFIX#/',$table_prefix,$line));
317 317
                 if (preg_match('/; *$/', $newline))
318 318
                 {
@@ -325,8 +325,7 @@  discard block
 block discarded – undo
325 325
                     if (preg_match('/^ *([^ ]+) TABLE ([^ ]+)/',$newline,$cur_table_array))
326 326
                     {
327 327
                         $cur_table=$cur_table_array[1] . ' SQL table '.$cur_table_array[2];
328
-                    }
329
-                    else
328
+                    } else
330 329
                     {
331 330
                         $cur_table='secret SQL stuff :-)';
332 331
                         //$cur_table=$newline;
Please login to merge, or discard this patch.
library/Trapdirector/Plugins/NetworkRule.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,9 @@
 block discarded – undo
116 116
         {
117 117
             throw new Exception('Invalid number of parameters : ' . count($param));
118 118
         }
119
-        if ($param[0] == 'true') return true;
119
+        if ($param[0] == 'true') {
120
+        	return true;
121
+        }
120 122
         return false;
121 123
     }
122 124
 }
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;
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.