@@ -20,7 +20,8 @@ |
||
| 20 | 20 | if (Auth::guard($guard)->guest()) { |
| 21 | 21 | if ($request->ajax() || $request->wantsJson()) { |
| 22 | 22 | return response('Unauthorized.', 401); |
| 23 | - } else { |
|
| 23 | + } |
|
| 24 | + else { |
|
| 24 | 25 | return redirect()->guest('login'); |
| 25 | 26 | } |
| 26 | 27 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function apply($query) |
| 23 | 23 | { |
| 24 | - return $query->whereHas('groups', function ($q) { |
|
| 24 | + return $query->whereHas('groups', function($q) { |
|
| 25 | 25 | $q->where('id', '=', $this->group_id); |
| 26 | 26 | }); |
| 27 | 27 | } |
@@ -38,6 +38,9 @@ |
||
| 38 | 38 | return json_encode(self::generateMacroFilter('alert.macros.rule', self::generateTableFilter())); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | + /** |
|
| 42 | + * @param string $setting |
|
| 43 | + */ |
|
| 41 | 44 | private static function generateMacroFilter($setting, $filter = []) |
| 42 | 45 | { |
| 43 | 46 | foreach (Settings::get($setting, []) as $key => $value) { |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // return the table filter merged with $filter, fetch from cache if available |
| 65 | - return array_merge($filter, Cache::rememberForever('query_builder_table_filter', function () { |
|
| 65 | + return array_merge($filter, Cache::rememberForever('query_builder_table_filter', function() { |
|
| 66 | 66 | $tableFilter = []; |
| 67 | 67 | $schema = DB::getDoctrineSchemaManager(); |
| 68 | 68 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | Route::group([ |
| 55 | 55 | 'middleware' => 'web', |
| 56 | 56 | 'namespace' => $this->namespace, |
| 57 | - ], function ($router) { |
|
| 57 | + ], function($router) { |
|
| 58 | 58 | require base_path('routes/web.php'); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | 'middleware' => ['api', 'jwt-auth'], |
| 73 | 73 | 'namespace' => $this->namespace, |
| 74 | 74 | 'prefix' => 'api', |
| 75 | - ], function ($router) { |
|
| 75 | + ], function($router) { |
|
| 76 | 76 | require base_path('routes/api.php'); |
| 77 | 77 | }); |
| 78 | 78 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | /* |
| 20 | 20 | * Authenticate the user's personal channel... |
| 21 | 21 | */ |
| 22 | - Broadcast::channel('App.User.*', function ($user, $userId) { |
|
| 22 | + Broadcast::channel('App.User.*', function($user, $userId) { |
|
| 23 | 23 | return (int) $user->id === (int) $userId; |
| 24 | 24 | }); |
| 25 | 25 | } |
@@ -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 | } |
@@ -150,7 +150,7 @@ |
||
| 150 | 150 | { |
| 151 | 151 | parent::boot(); |
| 152 | 152 | |
| 153 | - static::deleting(function (Device $device) { |
|
| 153 | + static::deleting(function(Device $device) { |
|
| 154 | 154 | // delete related data |
| 155 | 155 | $device->ports()->delete(); |
| 156 | 156 | $device->syslogs()->delete(); |
@@ -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 |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | } elseif ($format == 'csv') { |
| 66 | 66 | return $this->csvSerialize(); |
| 67 | 67 | } |
| 68 | - return null; // shouldn't get here |
|
| 68 | + return null; // shouldn't get here |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -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 | } |