Completed
Pull Request — develop (#143)
by Tony
06:44
created
app/Http/Controllers/Widgets/WidgetDataController.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -82,7 +82,8 @@  discard block
 block discarded – undo
82 82
         $uptime = Settings::get('uptime_warning', 84600);
83 83
         if ($request->user()->hasGlobalRead()) {
84 84
             $devices = Device::where('ignore', '=', 0)->get();
85
-        } else {
85
+        }
86
+        else {
86 87
             $devices = User::find($request->user()->user_id)->devices()->where('ignore', '=', 0)->get();
87 88
         }
88 89
         $count = ['warn' => 0, 'up' => 0, 'down' => 0];
@@ -90,10 +91,12 @@  discard block
 block discarded – undo
90 91
             if ($device->status == 1) {
91 92
                 if (($device->uptime < $uptime) && ($device->uptime != '0')) {
92 93
                     $count['warn']++;
93
-                } else {
94
+                }
95
+                else {
94 96
                     $count['up']++;
95 97
                 }
96
-            } else {
98
+            }
99
+            else {
97 100
                 $count['down']++;
98 101
             }
99 102
         }
@@ -122,7 +125,8 @@  discard block
 block discarded – undo
122 125
             $count['ports']['down'] = Port::isDown()->count();
123 126
             $count['ports']['ignored'] = Port::isIgnored()->count();
124 127
             $count['ports']['disabled'] = Port::isDisabled()->count();
125
-        } else {
128
+        }
129
+        else {
126 130
             $user = User::find($request->user()->user_id);
127 131
 
128 132
             $count['devices']['total'] = $user->devices()->count();
Please login to merge, or discard this patch.
app/Http/Controllers/DeviceGroupController.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -195,7 +195,8 @@
 block discarded – undo
195 195
         $user = \Auth::user();
196 196
         if (!is_null($user) && $user->isAdmin()) {
197 197
             return false;
198
-        } else {
198
+        }
199
+        else {
199 200
             return 'auth';
200 201
         }
201 202
     }
Please login to merge, or discard this patch.
app/Models/DeviceGroup.php 1 patch
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -145,7 +145,8 @@  discard block
 block discarded – undo
145 145
         $query = null;
146 146
         if (count($tables) == 1) {
147 147
             $query = DB::table($tables[0])->select('device_id');
148
-        } else {
148
+        }
149
+        else {
149 150
             $query = DB::table('devices')->select('devices.device_id')->distinct();
150 151
 
151 152
             foreach ($tables as $table) {
@@ -186,7 +187,8 @@  discard block
 block discarded – undo
186 187
         if (str_contains($pattern, 'macros.')) {
187 188
             if (++$x < 30) {
188 189
                 $pattern = self::applyGroupMacros($pattern, $x);
189
-            } else {
190
+            }
191
+            else {
190 192
                 return false;
191 193
             }
192 194
         }
@@ -253,14 +255,16 @@  discard block
 block discarded – undo
253 255
             if (starts_with($cur, '%')) {
254 256
                 // table and column or macro
255 257
                 $out .= substr($cur, 1).' ';
256
-            } elseif (substr($cur, -1) == '~') {
258
+            }
259
+            elseif (substr($cur, -1) == '~') {
257 260
                 // like operator
258 261
                 $content = $parts[++$i]; // grab the content so we can format it
259 262
 
260 263
                 if (str_contains($content, '@')) {
261 264
                     // contains wildcard
262 265
                     $content = str_replace('@', '%', $content);
263
-                } else {
266
+                }
267
+                else {
264 268
                     // assume substring
265 269
                     $content = '%'.$content.'%';
266 270
                 }
@@ -272,14 +276,18 @@  discard block
 block discarded – undo
272 276
 
273 277
                 $out .= "LIKE('".$content."') ";
274 278
 
275
-            } elseif ($cur == '&&') {
279
+            }
280
+            elseif ($cur == '&&') {
276 281
                 $out .= 'AND ';
277
-            } elseif ($cur == '||') {
282
+            }
283
+            elseif ($cur == '||') {
278 284
                 $out .= 'OR ';
279
-            } elseif (in_array($cur, $ops)) {
285
+            }
286
+            elseif (in_array($cur, $ops)) {
280 287
                 // pass-through operators
281 288
                 $out .= $cur.' ';
282
-            } else {
289
+            }
290
+            else {
283 291
                 // user supplied input
284 292
                 $out .= "'".trim($cur, '"\'')."' "; // TODO: remove trim, only needed with invalid input
285 293
             }
Please login to merge, or discard this patch.