Passed
Push — master ( 491d6e...b6634d )
by Patrick
02:04
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.
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.