@@ -60,7 +60,6 @@ |
||
| 60 | 60 | /** |
| 61 | 61 | * Display the alerts widget. |
| 62 | 62 | * |
| 63 | - * @param AlertsDataTable $dataTable |
|
| 64 | 63 | * @param null $action |
| 65 | 64 | * @return \Illuminate\Http\JsonResponse|\Illuminate\View\View |
| 66 | 65 | */ |
@@ -52,7 +52,8 @@ discard block |
||
| 52 | 52 | if ($request->device_id) { |
| 53 | 53 | return $EventlogDataTable->forDevice($request->device_id) |
| 54 | 54 | ->render('widgets.eventlog', compact(['tableName', 'action'])); |
| 55 | - } else { |
|
| 55 | + } |
|
| 56 | + else { |
|
| 56 | 57 | return $EventlogDataTable->render('widgets.eventlog', compact(['tableName', 'action'])); |
| 57 | 58 | } |
| 58 | 59 | } |
@@ -95,7 +96,8 @@ discard block |
||
| 95 | 96 | $uptime = Settings::get('uptime_warning', 84600); |
| 96 | 97 | if ($request->user()->hasGlobalRead()) { |
| 97 | 98 | $devices = Device::where('ignore', '=', 0)->get(); |
| 98 | - } else { |
|
| 99 | + } |
|
| 100 | + else { |
|
| 99 | 101 | $devices = User::find($request->user()->user_id)->devices()->where('ignore', '=', 0)->get(); |
| 100 | 102 | } |
| 101 | 103 | $count = ['warn' => 0, 'up' => 0, 'down' => 0]; |
@@ -103,10 +105,12 @@ discard block |
||
| 103 | 105 | if ($device->status == 1) { |
| 104 | 106 | if (($device->uptime < $uptime) && ($device->uptime != '0')) { |
| 105 | 107 | $count['warn']++; |
| 106 | - } else { |
|
| 108 | + } |
|
| 109 | + else { |
|
| 107 | 110 | $count['up']++; |
| 108 | 111 | } |
| 109 | - } else { |
|
| 112 | + } |
|
| 113 | + else { |
|
| 110 | 114 | $count['down']++; |
| 111 | 115 | } |
| 112 | 116 | } |
@@ -137,7 +141,8 @@ discard block |
||
| 137 | 141 | $count['ports']['down'] = Port::isDown()->count(); |
| 138 | 142 | $count['ports']['ignored'] = Port::isIgnored()->count(); |
| 139 | 143 | $count['ports']['disabled'] = Port::isDisabled()->count(); |
| 140 | - } else { |
|
| 144 | + } |
|
| 145 | + else { |
|
| 141 | 146 | $user = User::find($request->user()->user_id); |
| 142 | 147 | |
| 143 | 148 | $count['devices']['total'] = $user->devices()->count(); |
@@ -213,11 +213,14 @@ |
||
| 213 | 213 | $disabled = $this->disabled; |
| 214 | 214 | if ($disabled == 1) { |
| 215 | 215 | return 'teal'; |
| 216 | - } elseif ($ignore == 1) { |
|
| 216 | + } |
|
| 217 | + elseif ($ignore == 1) { |
|
| 217 | 218 | return 'yellow'; |
| 218 | - } elseif ($status == 0) { |
|
| 219 | + } |
|
| 220 | + elseif ($status == 0) { |
|
| 219 | 221 | return 'danger'; |
| 220 | - } else { |
|
| 222 | + } |
|
| 223 | + else { |
|
| 221 | 224 | return 'success'; |
| 222 | 225 | } |
| 223 | 226 | } |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | */ |
| 106 | 106 | public function getAjax() |
| 107 | 107 | { |
| 108 | - return url('eventlog?device_id=' . $this->device_id); |
|
| 108 | + return url('eventlog?device_id='.$this->device_id); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | public function forDevice($device_id) |
@@ -195,7 +195,8 @@ |
||
| 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 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } elseif ($format == 'csv') { |
| 68 | 68 | return $this->csvSerialize(); |
| 69 | 69 | } |
| 70 | - return null; // shouldn't get here |
|
| 70 | + return null; // shouldn't get here |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | private function getOutput() |
| 79 | 79 | { |
| 80 | - return Cache::tags('graphs')->remember($this->key, 5, function () { |
|
| 80 | + return Cache::tags('graphs')->remember($this->key, 5, function() { |
|
| 81 | 81 | $output = $this->run(); |
| 82 | 82 | $output = preg_replace('/\'/', '"', $output); |
| 83 | 83 | $output = preg_replace('/about\:/', '"meta":', $output); |
@@ -64,7 +64,8 @@ |
||
| 64 | 64 | |
| 65 | 65 | if ($format == 'json') { |
| 66 | 66 | return $this->jsonSerialize(); |
| 67 | - } elseif ($format == 'csv') { |
|
| 67 | + } |
|
| 68 | + elseif ($format == 'csv') { |
|
| 68 | 69 | return $this->csvSerialize(); |
| 69 | 70 | } |
| 70 | 71 | return null; // shouldn't get here |
@@ -191,8 +191,8 @@ discard block |
||
| 191 | 191 | public static function escape($string, $length = null) |
| 192 | 192 | { |
| 193 | 193 | $result = shorten_interface_type($string); |
| 194 | - $result = str_replace("'", '', $result); # remove quotes |
|
| 195 | - $result = str_replace('%', '%%', $result); # double percent signs |
|
| 194 | + $result = str_replace("'", '', $result); # remove quotes |
|
| 195 | + $result = str_replace('%', '%%', $result); # double percent signs |
|
| 196 | 196 | if (is_numeric($length) && strlen($string) > $length) { |
| 197 | 197 | $extra = substr_count($string, ':', 0, $length); |
| 198 | 198 | $result = substr(str_pad($result, $length), 0, ($length + $extra)); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - $result = str_replace(':', '\:', $result); # escape colons |
|
| 204 | + $result = str_replace(':', '\:', $result); # escape colons |
|
| 205 | 205 | return $result.' '; |
| 206 | 206 | } |
| 207 | 207 | } |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | { |
| 58 | 58 | $this->checkFormatSupported($format); |
| 59 | 59 | |
| 60 | - return Cache::tags('graphs')->remember($this->key, 5, function () { |
|
| 60 | + return Cache::tags('graphs')->remember($this->key, 5, function() { |
|
| 61 | 61 | return base64_encode($this->run()); |
| 62 | 62 | }); |
| 63 | 63 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | { |
| 34 | 34 | if ($this->hasIDs()) { |
| 35 | 35 | return [ |
| 36 | - 'storage' => function (Builder $query) { |
|
| 36 | + 'storage' => function(Builder $query) { |
|
| 37 | 37 | $query->whereIn('storage_id', $this->getIDs()); |
| 38 | 38 | }, |
| 39 | 39 | ]; |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | { |
| 34 | 34 | if ($this->hasIDs()) { |
| 35 | 35 | return [ |
| 36 | - 'processors' => function (Builder $query) { |
|
| 36 | + 'processors' => function(Builder $query) { |
|
| 37 | 37 | $query->whereIn('processor_id', $this->getIDs()); |
| 38 | 38 | }, |
| 39 | 39 | ]; |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | { |
| 34 | 34 | if ($this->hasIDs()) { |
| 35 | 35 | return [ |
| 36 | - 'ports' => function (Builder $query) { |
|
| 36 | + 'ports' => function(Builder $query) { |
|
| 37 | 37 | $query->whereIn('port_id', $this->getIDs()); |
| 38 | 38 | }, |
| 39 | 39 | ]; |