@@ -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 | } |
@@ -102,7 +102,8 @@ |
||
| 102 | 102 | } catch(\Exception $e) { |
| 103 | 103 | if(starts_with($e->getMessage(), 'unserialize():')) { |
| 104 | 104 | return $value; |
| 105 | - } else { |
|
| 105 | + } |
|
| 106 | + else { |
|
| 106 | 107 | throw $e; |
| 107 | 108 | } |
| 108 | 109 | } |
@@ -76,7 +76,8 @@ |
||
| 76 | 76 | if ($type == 'settings-value') { |
| 77 | 77 | Settings::set($key, Input::get('value')); |
| 78 | 78 | return response('OK', 200); |
| 79 | - } elseif ($type == 'settings-array') { |
|
| 79 | + } |
|
| 80 | + elseif ($type == 'settings-array') { |
|
| 80 | 81 | $new = Input::get('value'); |
| 81 | 82 | $current = Settings::get($key); |
| 82 | 83 | |
@@ -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 |
@@ -52,7 +52,8 @@ discard block |
||
| 52 | 52 | $this->request = $request; |
| 53 | 53 | if (is_null($input)) { |
| 54 | 54 | $this->input = json_decode($request->{'input'}); |
| 55 | - } else { |
|
| 55 | + } |
|
| 56 | + else { |
|
| 56 | 57 | $this->input = $input; |
| 57 | 58 | } |
| 58 | 59 | $this->device = $this->fetchDevice(); |
@@ -72,10 +73,12 @@ discard block |
||
| 72 | 73 | if ($sourceName === 'rrd') { |
| 73 | 74 | if ($format == 'png') { |
| 74 | 75 | $source = $this->createRRDGraph(); |
| 75 | - } else { |
|
| 76 | + } |
|
| 77 | + else { |
|
| 76 | 78 | $source = $this->createRRDXport(); |
| 77 | 79 | } |
| 78 | - } else { |
|
| 80 | + } |
|
| 81 | + else { |
|
| 79 | 82 | throw new UnknownDataSourceException("Source type $source is not supported"); |
| 80 | 83 | } |
| 81 | 84 | |
@@ -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(); |
@@ -26,7 +26,8 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | if (Auth::user()->hasGlobalRead()) { |
| 28 | 28 | $ports = Port::all(); |
| 29 | - } else { |
|
| 29 | + } |
|
| 30 | + else { |
|
| 30 | 31 | $ports = Auth::user()->ports()->get(); |
| 31 | 32 | } |
| 32 | 33 | |
@@ -64,7 +65,8 @@ discard block |
||
| 64 | 65 | { |
| 65 | 66 | if ($request->user()->hasGlobalRead()) { |
| 66 | 67 | return Port::find($id); |
| 67 | - } else { |
|
| 68 | + } |
|
| 69 | + else { |
|
| 68 | 70 | $user = User::find($request->user()->user_id); |
| 69 | 71 | return $user->ports()->find($id); |
| 70 | 72 | } |
@@ -58,7 +58,8 @@ discard block |
||
| 58 | 58 | $user_widget->dashboard_id = $request->dashboard_id; |
| 59 | 59 | if ($user_widget->save()) { |
| 60 | 60 | return $this->response->array(array('statusText' => 'OK', 'user_widget_id' => $user_widget->user_widget_id)); |
| 61 | - } else { |
|
| 61 | + } |
|
| 62 | + else { |
|
| 62 | 63 | return $this->response->errorInternal(); |
| 63 | 64 | } |
| 64 | 65 | } |
@@ -99,7 +100,8 @@ discard block |
||
| 99 | 100 | if ($request->input('settings')) { |
| 100 | 101 | $users_widgets = UsersWidgets::find($id); |
| 101 | 102 | $users_widgets->settings = json_encode($request->input('settings')); |
| 102 | - } else { |
|
| 103 | + } |
|
| 104 | + else { |
|
| 103 | 105 | $users_widgets = UsersWidgets::find($id); |
| 104 | 106 | $users_widgets->col = $request->input('x'); |
| 105 | 107 | $users_widgets->row = $request->input('y'); |
@@ -109,7 +111,8 @@ discard block |
||
| 109 | 111 | |
| 110 | 112 | if ($users_widgets->save()) { |
| 111 | 113 | return $this->response->array(array('statusText' => 'OK')); |
| 112 | - } else { |
|
| 114 | + } |
|
| 115 | + else { |
|
| 113 | 116 | return $this->response->errorInternal(); |
| 114 | 117 | } |
| 115 | 118 | } |
@@ -124,7 +127,8 @@ discard block |
||
| 124 | 127 | { |
| 125 | 128 | if (UsersWidgets::destroy($id)) { |
| 126 | 129 | return $this->response->array(array('statusText' => 'OK')); |
| 127 | - } else { |
|
| 130 | + } |
|
| 131 | + else { |
|
| 128 | 132 | return $this->response->errorInternal(); |
| 129 | 133 | } |
| 130 | 134 | } |
@@ -67,10 +67,12 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | return $this->response->array(array('statusText' => 'OK', 'dashboard_id' => $dashboard->dashboard_id)); |
| 70 | - } else { |
|
| 70 | + } |
|
| 71 | + else { |
|
| 71 | 72 | return $this->response->errorInternal(); |
| 72 | 73 | } |
| 73 | - } else { |
|
| 74 | + } |
|
| 75 | + else { |
|
| 74 | 76 | $errors = $validation->errors(); |
| 75 | 77 | return response()->json($errors, 422); |
| 76 | 78 | } |
@@ -120,10 +122,12 @@ discard block |
||
| 120 | 122 | $dashboard->access = $request->access; |
| 121 | 123 | if ($dashboard->save()) { |
| 122 | 124 | return $this->response->array(array('statusText' => 'OK')); |
| 123 | - } else { |
|
| 125 | + } |
|
| 126 | + else { |
|
| 124 | 127 | return $this->response->errorInternal(); |
| 125 | 128 | } |
| 126 | - } else { |
|
| 129 | + } |
|
| 130 | + else { |
|
| 127 | 131 | $errors = $validation->errors(); |
| 128 | 132 | return response()->json($errors, 422); |
| 129 | 133 | } |
@@ -140,10 +144,12 @@ discard block |
||
| 140 | 144 | if (Dashboard::where('user_id', $request->user()->user_id)->where('dashboard_id', $id)->delete()) { |
| 141 | 145 | if (UsersWidgets::where('dashboard_id', $id)->delete() >= 0) { |
| 142 | 146 | return $this->response->array(array('statusText' => 'OK')); |
| 143 | - } else { |
|
| 147 | + } |
|
| 148 | + else { |
|
| 144 | 149 | return $this->response->errorInternal(); |
| 145 | 150 | } |
| 146 | - } else { |
|
| 151 | + } |
|
| 152 | + else { |
|
| 147 | 153 | return $this->response->errorInternal(); |
| 148 | 154 | } |
| 149 | 155 | } |
@@ -152,7 +158,8 @@ discard block |
||
| 152 | 158 | { |
| 153 | 159 | if (Dashboard::find($id)->widgets()->delete() >= 0) { |
| 154 | 160 | return $this->response->array(array('statusText' => 'OK')); |
| 155 | - } else { |
|
| 161 | + } |
|
| 162 | + else { |
|
| 156 | 163 | return $this->response->errorInternal(); |
| 157 | 164 | } |
| 158 | 165 | } |