Passed
Push — master ( f05ebb...390827 )
by Patrick
02:50
created
application/controllers/StatusController.php 1 patch
Braces   +19 added lines, -29 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 		try
23 23
 		{
24 24
 		    $dbConn = $this->getUIDatabase()->getDbConn();
25
-		    if ($dbConn === null) throw new \ErrorException('uncatched db error');
25
+		    if ($dbConn === null) {
26
+		    	throw new \ErrorException('uncatched db error');
27
+		    }
26 28
 			$query = $dbConn->select()->from(
27 29
 				$this->getModuleConfig()->getTrapTableName(),
28 30
 				array('COUNT(*)')
@@ -41,8 +43,7 @@  discard block
 block discarded – undo
41 43
  			
42 44
 			$this->view->trap_days_delete=$this->getUIDatabase()->getDBConfigValue('db_remove_days');
43 45
 			
44
-		}
45
-		catch (Exception $e)
46
+		} catch (Exception $e)
46 47
 		{
47 48
 			$this->displayExitError('status',$e->getMessage());
48 49
 		}
@@ -56,8 +57,7 @@  discard block
 block discarded – undo
56 57
 			$this->view->currentLogFile=$this->getUIDatabase()->getDBConfigValue('log_file');
57 58
 			$this->view->logLevels=$this->getModuleConfig()->getlogLevels();
58 59
 			$this->view->currentLogLevel=$this->getUIDatabase()->getDBConfigValue('log_level');
59
-		}
60
-		catch (Exception $e)
60
+		} catch (Exception $e)
61 61
 		{
62 62
 			$this->displayExitError('status',$e->getMessage());
63 63
 		}
@@ -69,8 +69,7 @@  discard block
 block discarded – undo
69 69
 		    $this->view->SnmpTrapAddressOID=$this->getUIDatabase()->getDBConfigValue('SnmpTrapAddess_oid');
70 70
 		    $this->view->SnmpTrapAddressOIDDefault = ($this->view->SnmpTrapAddressOID == $this->getModuleConfig()->getDBConfigDefaults()['SnmpTrapAddess_oid'] ) ? TRUE : FALSE;
71 71
 		    
72
-		}
73
-		catch (Exception $e)
72
+		} catch (Exception $e)
74 73
 		{
75 74
 		    $this->displayExitError('status',$e->getMessage());
76 75
 		}		
@@ -120,8 +119,7 @@  discard block
 block discarded – undo
120 119
 					if ($retVal == 0)
121 120
 					{ // process is alive
122 121
 						$this->_helper->json(array('status'=>'Alive and kicking'));
123
-					}
124
-					else
122
+					} else
125 123
 					{ // process is dead
126 124
 					    $this->_helper->json(array('status'=>'tu quoque fili','err'=>'no proc'.$pid));
127 125
 					}
@@ -137,22 +135,19 @@  discard block
 block discarded – undo
137 135
 				if (!is_dir($destDir))
138 136
 				{
139 137
 				    $this->view->uploadStatus="ERROR : no $destDir directory, check module configuration";
140
-				}
141
-				else
138
+				} else
142 139
 				{
143 140
 				    if (!is_writable($destDir))
144 141
 				    {
145 142
 				        $this->view->uploadStatus="ERROR : $destDir directory is not writable";
146
-				    }
147
-				    else
143
+				    } else
148 144
 				    {
149 145
 				        $destination = $destDir .'/'.$name; //$this->Module()->getBaseDir() . "/mibs/$name";
150 146
 				        $sourceTmpNam=filter_var($_FILES['mibfile']['tmp_name'],FILTER_SANITIZE_STRING);
151 147
 				        if (move_uploaded_file($sourceTmpNam,$destination)===false)
152 148
     				    {
153 149
     				        $this->view->uploadStatus="ERROR, file $destination not loaded. Check file and path name or selinux violations";
154
-    				    }
155
-    				    else
150
+    				    } else
156 151
     				    {
157 152
     				        $this->view->uploadStatus="File $name uploaded in $destDir";
158 153
     				    }
@@ -177,18 +172,15 @@  discard block
 block discarded – undo
177 172
 			    {		    
178 173
     				$this->view->snmptranslate='works fine';
179 174
     				$this->view->snmptranslate_state='ok';
180
-			    }
181
-			    else
175
+			    } else
182 176
 			    {
183 177
 			        $this->view->snmptranslate='works fine but missing basic MIBs';
184 178
 			    }
185
-			}
186
-			else
179
+			} else
187 180
 			{
188 181
 				$this->view->snmptranslate='Can execute but no OID to name resolution';
189 182
 			}
190
-		}
191
-		else
183
+		} else
192 184
 		{
193 185
 			$this->view->snmptranslate='Cannot execute';
194 186
 		}
@@ -209,15 +201,13 @@  discard block
 block discarded – undo
209 201
 		if ($retVal==0)
210 202
 		{
211 203
 			$dirArray=array_merge($dirArray,explode(':',$sysDirs));
212
-		}
213
-		else
204
+		} else
214 205
 		{
215 206
 			$translateOut=exec($this->Config()->get('config', 'snmptranslate') . ' -Dinit_mib .1.3 2>&1 | grep MIBDIRS');
216 207
 			if (preg_match('/MIBDIRS.*\'([^\']+)\'/',$translateOut,$matches))
217 208
 			{
218 209
 				$dirArray=array_merge($dirArray,explode(':',$matches[1]));
219
-			}
220
-			else
210
+			} else
221 211
 			{
222 212
 				array_push($dirArray,'Install net-snmp-config to see system directories');
223 213
 			}
@@ -256,8 +246,7 @@  discard block
 block discarded – undo
256 246
 	        if (!preg_match('/^[0-9]+$/', $maxRows) || $maxRows < 1)
257 247
 	        {
258 248
 	            $this->view->setError='Max rows must be a number';
259
-	        }
260
-	        else
249
+	        } else
261 250
 	        {
262 251
 	            $this->setitemListDisplay($maxRows);
263 252
 	            $this->view->setOKMsg='Set max rows to ' . $maxRows;
@@ -276,8 +265,9 @@  discard block
 block discarded – undo
276 265
 	        $index = $this->getRequest()->getPost('index',NULL);
277 266
 	        $newname = $this->getRequest()->getPost('newname',NULL);
278 267
 
279
-	        if (!preg_match('/^[0-9]+$/', $index) || $index < 1)
280
-	            $this->_helper->json(array('status'=>'Bad index'));
268
+	        if (!preg_match('/^[0-9]+$/', $index) || $index < 1) {
269
+	        	            $this->_helper->json(array('status'=>'Bad index'));
270
+	        }
281 271
 	        
282 272
 	        switch ($type)
283 273
 	        {
Please login to merge, or discard this patch.