Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions plugins/enigma/lib/enigma_ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class enigma_ui
private $data;
private $keys_parts = [];
private $keys_bodies = [];
private $status_messages = [];

/**
* Object constructor
Expand Down Expand Up @@ -954,7 +955,6 @@ public function status_message($p)
&& !empty($engine->decryptions[$found])
) {
$status = $engine->decryptions[$found];
$attach_scripts = true;

// show the message only once
unset($engine->decryptions[$found]);
Expand Down Expand Up @@ -996,7 +996,6 @@ public function status_message($p)
&& !empty($engine->signatures[$found])
) {
$sig = $engine->signatures[$found];
$attach_scripts = true;

// show the message only once
unset($engine->signatures[$found]);
Expand Down Expand Up @@ -1038,22 +1037,7 @@ public function status_message($p)
$messages[] = $attrib;
}

if ($count = count($messages)) {
if ($count == 2 && $messages[0]['class'] == $messages[1]['class']) {
// @phpstan-ignore-next-line
$p['prefix'] .= html::div($messages[0], $messages[0]['msg'] . ' ' . $messages[1]['msg']);
} else {
foreach ($messages as $msg) {
$p['prefix'] .= html::div($msg, $msg['msg']);
}
}
}

if (!empty($attach_scripts)) {
// add css and js script
$this->add_css();
$this->add_js();
}
$this->status_messages = $messages;

return $p;
}
Expand Down Expand Up @@ -1117,6 +1101,17 @@ public function message_output($p)
$attach_scripts = true;
}

if ($count = count($this->status_messages)) {
$attach_scripts = true;
if ($count == 2 && $this->status_messages[0]['class'] == $this->status_messages[1]['class']) {
$p['content'] = html::div($this->status_messages[0], $this->status_messages[0]['msg'] . ' ' . $this->status_messages[1]['msg']) . $p['content'];
} else {
foreach ($this->status_messages as $msg) {
$p['content'] = html::div($msg, $msg['msg']) . $p['content'];
}
}
}

if (!empty($attach_scripts)) {
// add css and js script
$this->add_css();
Expand Down