@@ -59,7 +59,7 @@ |
||
59 | 59 | */ |
60 | 60 | public function boot(Router $router) |
61 | 61 | { |
62 | - $router->middlewareGroup('activity',[LogActivity::class]); |
|
62 | + $router->middlewareGroup('activity', [LogActivity::class]); |
|
63 | 63 | $this->loadTranslationsFrom(__DIR__.'/resources/lang/', 'LaravelLogger'); |
64 | 64 | } |
65 | 65 |
@@ -98,13 +98,13 @@ |
||
98 | 98 | |
99 | 99 | if (config('LaravelLogger.loggerPaginationEnabled')) { |
100 | 100 | $userActivities = Activity::where('userId', $activity->userId) |
101 | - ->orderBy('created_at', 'desc') |
|
102 | - ->paginate(config('LaravelLogger.loggerPaginationPerPage')); |
|
101 | + ->orderBy('created_at', 'desc') |
|
102 | + ->paginate(config('LaravelLogger.loggerPaginationPerPage')); |
|
103 | 103 | $totalUserActivities = $userActivities->total(); |
104 | 104 | } else { |
105 | 105 | $userActivities = Activity::where('userId', $activity->userId) |
106 | - ->orderBy('created_at', 'desc') |
|
107 | - ->get(); |
|
106 | + ->orderBy('created_at', 'desc') |
|
107 | + ->get(); |
|
108 | 108 | $totalUserActivities = $userActivities->count(); |
109 | 109 | } |
110 | 110 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | private function mapAdditionalDetails($collectionItems) |
44 | 44 | { |
45 | - $collectionItems->map(function ($collectionItem) { |
|
45 | + $collectionItems->map(function($collectionItem) { |
|
46 | 46 | $eventTime = Carbon::parse($collectionItem->updated_at); |
47 | 47 | $collectionItem['timePassed'] = $eventTime->diffForHumans(); |
48 | 48 | $collectionItem['userAgentDetails'] = UserAgentDetails::details($collectionItem->useragent); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | self::mapAdditionalDetails($userActivities); |
112 | 112 | |
113 | - $data = [ |
|
113 | + $data = [ |
|
114 | 114 | 'activity' => $activity, |
115 | 115 | 'userDetails' => $userDetails, |
116 | 116 | 'ipAddressDetails' => $ipAddressDetails, |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $eventTime = Carbon::parse($activity->created_at); |
188 | 188 | $timePassed = $eventTime->diffForHumans(); |
189 | 189 | |
190 | - $data = [ |
|
190 | + $data = [ |
|
191 | 191 | 'activity' => $activity, |
192 | 192 | 'userDetails' => $userDetails, |
193 | 193 | 'ipAddressDetails' => $ipAddressDetails, |
@@ -37,7 +37,7 @@ |
||
37 | 37 | "SA" => "South America" |
38 | 38 | ); |
39 | 39 | if (filter_var($ip, FILTER_VALIDATE_IP) && in_array($purpose, $support)) { |
40 | - $ipdat = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=" . $ip)); |
|
40 | + $ipdat = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$ip)); |
|
41 | 41 | if (@strlen(trim($ipdat->geoplugin_countryCode)) == 2) { |
42 | 42 | switch ($purpose) { |
43 | 43 | case "location": |
@@ -19,10 +19,12 @@ discard block |
||
19 | 19 | if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE) { |
20 | 20 | $ip = $_SERVER["REMOTE_ADDR"]; |
21 | 21 | if ($deep_detect) { |
22 | - if (filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP)) |
|
23 | - $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
|
24 | - if (filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP)) |
|
25 | - $ip = $_SERVER['HTTP_CLIENT_IP']; |
|
22 | + if (filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP)) { |
|
23 | + $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
|
24 | + } |
|
25 | + if (filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP)) { |
|
26 | + $ip = $_SERVER['HTTP_CLIENT_IP']; |
|
27 | + } |
|
26 | 28 | } |
27 | 29 | } |
28 | 30 | $purpose = str_replace(array("name", "\n", "\t", " ", "-", "_"), NULL, strtolower(trim($purpose))); |
@@ -58,10 +60,12 @@ discard block |
||
58 | 60 | break; |
59 | 61 | case "address": |
60 | 62 | $address = array($ipdat->geoplugin_countryName); |
61 | - if (@strlen($ipdat->geoplugin_regionName) >= 1) |
|
62 | - $address[] = $ipdat->geoplugin_regionName; |
|
63 | - if (@strlen($ipdat->geoplugin_city) >= 1) |
|
64 | - $address[] = $ipdat->geoplugin_city; |
|
63 | + if (@strlen($ipdat->geoplugin_regionName) >= 1) { |
|
64 | + $address[] = $ipdat->geoplugin_regionName; |
|
65 | + } |
|
66 | + if (@strlen($ipdat->geoplugin_city) >= 1) { |
|
67 | + $address[] = $ipdat->geoplugin_city; |
|
68 | + } |
|
65 | 69 | $output = implode(", ", array_reverse($address)); |
66 | 70 | break; |
67 | 71 | case "city": |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | $userType = trans('LaravelLogger::laravel-logger.userTypes.guest'); |
21 | 21 | $userId = null; |
22 | 22 | |
23 | - if(\Auth::check()) { |
|
23 | + if (\Auth::check()) { |
|
24 | 24 | $userType = trans('LaravelLogger::laravel-logger.userTypes.registered'); |
25 | 25 | $userId = \Request::user()->id; |
26 | 26 | } |
27 | 27 | |
28 | - if(Crawler::isCrawler()) { |
|
28 | + if (Crawler::isCrawler()) { |
|
29 | 29 | $userType = trans('LaravelLogger::laravel-logger.userTypes.crawler'); |
30 | - $description = $userType . ' ' . trans('LaravelLogger::laravel-logger.verbTypes.crawled') . ' ' . \Request::fullUrl(); |
|
30 | + $description = $userType.' '.trans('LaravelLogger::laravel-logger.verbTypes.crawled').' '.\Request::fullUrl(); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | if (!$description) { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | break; |
52 | 52 | } |
53 | 53 | |
54 | - $description = $verb . ' ' . \Request::path(); |
|
54 | + $description = $verb.' '.\Request::path(); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $data = [ |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | if ($validator->fails()) { |
72 | 72 | $errors = json_encode($validator->errors(), true); |
73 | 73 | if (config('LaravelLogger.logDBActivityLogFailuresToFile')) { |
74 | - Log::error('Failed to record activity event. Failed Validation: ' . $errors); |
|
74 | + Log::error('Failed to record activity event. Failed Validation: '.$errors); |
|
75 | 75 | } |
76 | 76 | } else { |
77 | 77 | self::storeActivity($data); |
@@ -45,13 +45,11 @@ |
||
45 | 45 | if (preg_match("/^[\d]+\.[\d]+(?:\.[\d]{0,2}$)?/",$ua_array[4],$matches)) |
46 | 46 | { |
47 | 47 | $return['version'] = $matches[0]; |
48 | - } |
|
49 | - else |
|
48 | + } else |
|
50 | 49 | { |
51 | 50 | $return['version'] = $ua_array[4]; |
52 | 51 | } |
53 | - } |
|
54 | - else |
|
52 | + } else |
|
55 | 53 | { |
56 | 54 | return false; |
57 | 55 | } |
@@ -34,21 +34,21 @@ discard block |
||
34 | 34 | $replace_pat = '$7$8|$2$3|$9|${17}${15}$5$3|${18}${13}$6${11}'; |
35 | 35 | |
36 | 36 | // Run the preg_replace .. and explode on | |
37 | - $ua_array = explode("|",preg_replace($regex_pat, $replace_pat, $ua, PREG_PATTERN_ORDER)); |
|
37 | + $ua_array = explode("|", preg_replace($regex_pat, $replace_pat, $ua, PREG_PATTERN_ORDER)); |
|
38 | 38 | |
39 | - if (count($ua_array)>1) |
|
39 | + if (count($ua_array) > 1) |
|
40 | 40 | { |
41 | - $return['platform'] = $ua_array[0]; // Windows / iPad / MacOS / BlackBerry |
|
42 | - $return['type'] = $ua_array[1]; // Mozilla / Opera etc. |
|
43 | - $return['renderer'] = $ua_array[2]; // WebKit / Presto / Trident / Gecko etc. |
|
44 | - $return['browser'] = $ua_array[3]; // Chrome / Safari / MSIE / Firefox |
|
41 | + $return['platform'] = $ua_array[0]; // Windows / iPad / MacOS / BlackBerry |
|
42 | + $return['type'] = $ua_array[1]; // Mozilla / Opera etc. |
|
43 | + $return['renderer'] = $ua_array[2]; // WebKit / Presto / Trident / Gecko etc. |
|
44 | + $return['browser'] = $ua_array[3]; // Chrome / Safari / MSIE / Firefox |
|
45 | 45 | |
46 | 46 | /* |
47 | 47 | Not necessary but this will filter out Chromes ridiculously long version |
48 | 48 | numbers 31.0.1234.122 becomes 31.0, while a "normal" 3 digit version number |
49 | 49 | like 10.2.1 would stay 10.2.1, 11.0 stays 11.0. Non-match stays what it is. |
50 | 50 | */ |
51 | - if (preg_match("/^[\d]+\.[\d]+(?:\.[\d]{0,2}$)?/",$ua_array[4],$matches)) |
|
51 | + if (preg_match("/^[\d]+\.[\d]+(?:\.[\d]{0,2}$)?/", $ua_array[4], $matches)) |
|
52 | 52 | { |
53 | 53 | $return['version'] = $matches[0]; |
54 | 54 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | // Replace some browsernames e.g. MSIE -> Internet Explorer |
66 | - switch(strtolower($return['browser'])) |
|
66 | + switch (strtolower($return['browser'])) |
|
67 | 67 | { |
68 | 68 | case "msie": |
69 | 69 | case "trident": |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | break; |
78 | 78 | } |
79 | 79 | |
80 | - switch(strtolower($return['platform'])) |
|
80 | + switch (strtolower($return['platform'])) |
|
81 | 81 | { |
82 | 82 | case "android": // These browsers claim to be Safari but are BB Mobile |
83 | 83 | case "blackberry": // and Android Mobile |
84 | - if ($return['browser'] =="Safari" || $return['browser'] == "Mobile" || $return['browser'] == "") |
|
84 | + if ($return['browser'] == "Safari" || $return['browser'] == "Mobile" || $return['browser'] == "") |
|
85 | 85 | { |
86 | 86 | $return['browser'] = "{$return['platform']} mobile"; |
87 | 87 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | $routeUrl .= $parsedUrl['path']; |
16 | 16 | } |
17 | 17 | if (isset($parsedUrl['query'])) { |
18 | - $routeUrl .= '?' . $parsedUrl['query']; |
|
18 | + $routeUrl .= '?'.$parsedUrl['query']; |
|
19 | 19 | } |
20 | 20 | echo $routeUrl; |
21 | 21 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | protected $table; |
18 | 18 | |
19 | - /** |
|
19 | + /** |
|
20 | 20 | * The connection name for the model. |
21 | 21 | * |
22 | 22 | * @var string |
@@ -123,7 +123,7 @@ |
||
123 | 123 | * |
124 | 124 | * @return array |
125 | 125 | */ |
126 | - public static function rules($merge=[]) |
|
126 | + public static function rules($merge = []) |
|
127 | 127 | { |
128 | 128 | return array_merge([ |
129 | 129 | 'description' => 'required|string', |
@@ -137,11 +137,11 @@ |
||
137 | 137 | |-------------------------------------------------------------------------- |
138 | 138 | */ |
139 | 139 | |
140 | - 'messages' => [ |
|
140 | + 'messages' => [ |
|
141 | 141 | 'logClearedSuccessfuly' => 'Activity log cleared successfully', |
142 | 142 | 'logDestroyedSuccessfuly' => 'Activity log deleted successfully', |
143 | 143 | 'logRestoredSuccessfuly' => 'Activity log restored successfully', |
144 | - ], |
|
144 | + ], |
|
145 | 145 | |
146 | 146 | /* |
147 | 147 | |-------------------------------------------------------------------------- |
@@ -20,7 +20,7 @@ |
||
20 | 20 | $tableCheck = Schema::connection($connection)->hasTable($table); |
21 | 21 | |
22 | 22 | if (!$tableCheck) { |
23 | - Schema::connection($connection)->create($table, function (Blueprint $table) { |
|
23 | + Schema::connection($connection)->create($table, function(Blueprint $table) { |
|
24 | 24 | $table->increments('id'); |
25 | 25 | $table->longText('description'); |
26 | 26 | $table->string('userType'); |