Skip to content

Commit

Permalink
4.15.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lbr38 committed Jan 7, 2025
1 parent d10ff19 commit 9cbedae
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 35 deletions.
7 changes: 2 additions & 5 deletions www/controllers/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,16 @@ public function __construct()
*/
public static function getEnvColor(string $name)
{
// Default color
$color = '#ffffff';

// Retrieve color from ENVS array
if (defined('ENVS')) {
foreach (ENVS as $env) {
if ($env['Name'] == $name and !empty($env['Color'])) {
$color = $env['Color'];
return $env['Color'];
}
}
}

return $color;
return '#ffffff';
}

/**
Expand Down
9 changes: 8 additions & 1 deletion www/controllers/Repo/Repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,15 @@ public function getEnvIdBySnapId(string $snapId)
/**
* Set environment description
*/
public function envSetDescription(string $envId, string $description)
public function envSetDescription(string $envId, string $description) : void
{
// Description cannot contain single quotes or backslashes
if (str_contains($description, "'") || str_contains($description, "\\")) {
throw new Exception('Description contains invalid characters');
}

$description = \Controllers\Common::validateData($description);

$this->model->envSetDescription($envId, $description);
}

Expand Down
3 changes: 2 additions & 1 deletion www/controllers/Task/Form/Param/Description.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public static function check(string $description = null) : void
return;
}

if (!\Controllers\Common::isAlphanumDash($description, array('.', '(', ')', '@', 'é', 'è', 'à', 'ç', 'ù', 'ê', 'ô', '+', '\'', ' '))) {
// Description cannot contain single quotes or backslashes
if (str_contains($description, "'") || str_contains($description, "\\")) {
throw new Exception('Description contains invalid characters');
}
}
Expand Down
2 changes: 1 addition & 1 deletion www/controllers/Task/Repo/Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function execute()
* If the description is empty then the description will remain empty
*/
if (!empty($actualDescription)) {
$this->repo->setDescription($actualDescription);
$this->repo->setDescription(htmlspecialchars_decode($actualDescription));
} else {
$this->repo->setDescription('');
}
Expand Down
2 changes: 1 addition & 1 deletion www/controllers/Task/Repo/Finalize.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ protected function finalize()
* Si la description récupérée est vide alors la description restera vide
*/
if (!empty($actualDescription)) {
$this->repo->setDescription($actualDescription);
$this->repo->setDescription(htmlspecialchars_decode($actualDescription));
} else {
$this->repo->setDescription('');
}
Expand Down
16 changes: 4 additions & 12 deletions www/models/Repo/Repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,26 +526,18 @@ public function getUnunsedSnapshot(string $repoId, string $retention)
}

/**
* Modification de la description
*/
public function envSetDescription(string $envId, string $description)
* Set environment description
*/
public function envSetDescription(string $envId, string $description) : void
{
/**
* Vérification des caractères de la description
*/
if (\Controllers\Common::isAlphanumDash($description, array(' ', '(', ')', '@', ',', '.', '\'', 'é', 'è', 'ê', 'à', 'ç', 'ù', 'ô', 'ï', '"')) === false) {
throw new Exception('Description contains invalid characters');
}

try {
$stmt = $this->db->prepare("UPDATE repos_env SET Description = :description WHERE Id = :envId");
$stmt->bindValue(':description', \Controllers\Common::validateData($description));
$stmt->bindValue(':description', $description);
$stmt->bindValue(':envId', $envId);
$stmt->execute();
} catch (\Exception $e) {
$this->db->logError($e);
}
unset($stmt);
}

/**
Expand Down
13 changes: 8 additions & 5 deletions www/public/resources/js/host.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ function searchHost()
*/
if (!$("#search-host-input").val()) {
// Show all containers and host lines before quit
$('.hosts-group-container, .host-line, .js-select-all-button').show();
$('.hosts-group-container, .js-select-all-button').show();
$('.host-line').addClass('flex').show();

return;
}
Expand All @@ -110,7 +111,8 @@ function searchHost()
/**
* Hide all host lines, only those corresponding to the search will be re-displayed
*/
$('.host-line, .js-select-all-button').hide();
$('.js-select-all-button').hide();
$('.host-line, .js-select-all-button').removeClass('flex').hide();

/**
* Check if the user has entered a filter in his search, different filters are possible:
Expand Down Expand Up @@ -242,13 +244,14 @@ function searchHost()
* Then we process each div retrieved and display only those corresponding to the search
*/
$.each(line, function () {
div = $(this).find("div")[2];
div = $(this).find("div")[0];

if (div) {
txtValue = div.textContent || div.innerText;
if (txtValue.toUpperCase().indexOf(search) > -1) {
$(this).show();
$(this).addClass('flex').show();
} else {
$(this).hide();
$(this).removeClass('flex').hide();
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion www/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.15.0
4.15.1
8 changes: 4 additions & 4 deletions www/views/includes/containers/hosts/list.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@
<div class="grid hosts-compact-view column-gap-40">
<div>
<div>
<p title="Hostname">
<a href="/host/<?= $id ?>" class="wordbreakall copy" target="_blank" rel="noopener noreferrer">
<p title="Hostname" class="copy">
<a href="/host/<?= $id ?>" class="wordbreakall" target="_blank" rel="noopener noreferrer">
<b><?= $hostname ?></b>
</a>
</p>
Expand Down Expand Up @@ -319,8 +319,8 @@

if (!$compactView) : ?>
<div class="margin-bottom-15">
<p>
<a href="/host/<?= $id ?>" class="wordbreakall copy" target="_blank" rel="noopener noreferrer">
<p class="copy">
<a href="/host/<?= $id ?>" class="wordbreakall" target="_blank" rel="noopener noreferrer">
<b><?= $hostname ?></b>
</a>
</p>
Expand Down
3 changes: 1 addition & 2 deletions www/views/includes/containers/hosts/overview.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@

$envNameList .= "'" . $envName . "',";
$envCountList .= "'" . $env['Env_count'] . "',";

$envBackgroundColor .= '"' . \Controllers\Environment::getEnvColor($envNameList) . '",';
$envBackgroundColor .= '"' . \Controllers\Environment::getEnvColor($envName) . '",';
}

$labels = rtrim($envNameList, ',');
Expand Down
5 changes: 3 additions & 2 deletions www/views/includes/repos-list.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
$mygroup = new \Controllers\Group('repo');
$groupsList = $mygroup->listAll(true);
$myrepoListing = new \Controllers\Repo\Listing();

/**
* Print groups and repos
Expand All @@ -13,7 +14,7 @@
/**
* Getting repos list of the group
*/
$myrepoListing = new \Controllers\Repo\Listing();

$reposList = $myrepoListing->listByGroup($group['Name']);

/**
Expand Down Expand Up @@ -373,7 +374,7 @@
*/
echo '<div class="item-desc">';
if (!empty($env)) {
echo '<input type="text" class="repoDescriptionInput" env-id="' . $envId . '" placeholder="🖉 add a description" value="' . $description . '" />';
echo '<input type="text" class="repoDescriptionInput" env-id="' . $envId . '" placeholder="🖉 add a description" value=\'' . htmlspecialchars_decode($description) . '\' />';
}
echo '</div>';

Expand Down

0 comments on commit 9cbedae

Please sign in to comment.