Skip to content

Commit

Permalink
fix: Server error on access logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dogukanoksuz committed Sep 15, 2023
1 parent ef6571b commit da1b24e
Showing 1 changed file with 39 additions and 35 deletions.
74 changes: 39 additions & 35 deletions app/Http/Controllers/API/Server/AccessLogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,47 +66,51 @@ public function index()
foreach (explode("\n", (string) $data) as $row) {
$row = json_decode($row);

if (isset($row->request_details->extension_id)) {
if (! isset($knownExtensions[$row->request_details->extension_id])) {

$extension = Extension::find($row->request_details->extension_id);
if ($extension) {
$knownExtensions[$row->request_details->extension_id] =
$extension->display_name;
} else {
$knownExtensions[$row->request_details->extension_id] =
$row->request_details->extension_id;
try {
if (isset($row->request_details->extension_id)) {
if (! isset($knownExtensions[$row->request_details->extension_id])) {

$extension = Extension::find($row->request_details->extension_id);
if ($extension) {
$knownExtensions[$row->request_details->extension_id] =
$extension->display_name;
} else {
$knownExtensions[$row->request_details->extension_id] =
$row->request_details->extension_id;
}
}
}
$row->extension_id = $knownExtensions[$row->request_details->extension_id];
} else {
$row->extension_id = __('Komut');
}

if (! isset($knownUsers[$row->user_id])) {
$user = User::find($row->user_id);
if ($user) {
$knownUsers[$row->user_id] = $user->name;
$row->extension_id = $knownExtensions[$row->request_details->extension_id];
} else {
$knownUsers[$row->user_id] = $row->user_id;
$row->extension_id = __('Komut');
}
}

$row->user_id = $knownUsers[$row->user_id];

if (isset($row->request_details->lmntargetFunction)) {
$row->view = $row->request_details->lmntargetFunction;

if (isset($row->request_details->lmntargetFunction) && $row->request_details->lmntargetFunction == '') {
if ($row->lmn_level == 'high_level' && isset($row->request_details->title)) {
$row->view = base64_decode($row->request_details->title);

if (! isset($knownUsers[$row->user_id])) {
$user = User::find($row->user_id);
if ($user) {
$knownUsers[$row->user_id] = $user->name;
} else {
$knownUsers[$row->user_id] = $row->user_id;
}
}

$row->user_id = $knownUsers[$row->user_id];

if (isset($row->request_details->lmntargetFunction)) {
$row->view = $row->request_details->lmntargetFunction;

if (isset($row->request_details->lmntargetFunction) && $row->request_details->lmntargetFunction == '') {
if ($row->lmn_level == 'high_level' && isset($row->request_details->title)) {
$row->view = base64_decode($row->request_details->title);
}
}
} else {
$row->view = __('Komut');
}
} else {
$row->view = __('Komut');

$clean[] = $row;
} catch (\Throwable $e) {
continue;
}

$clean[] = $row;
}

return response()->json($clean);
Expand Down

0 comments on commit da1b24e

Please sign in to comment.