Skip to content

Commit

Permalink
Merge pull request #2795 from Leantime/configurationPHPFileFix
Browse files Browse the repository at this point in the history
Configuration php file fix
  • Loading branch information
marcelfolaron authored Nov 18, 2024
2 parents 4126ff6 + c02fe28 commit 4a693ca
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.vscode
*.swp

config/_configuration.php
config/configuration.php
resources/logs/*
node_modules/*
Expand Down
63 changes: 63 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions app/Core/Configuration/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ public function __construct(array $items = [])
}

$this->phpConfig = new Config;

$configVars = get_class_vars(Config::class);
foreach (array_keys($configVars) as $propertyName) {
$envVarName = self::LEGACY_MAPPINGS[$propertyName] ?? 'LEAN_'.Str::of($propertyName)->snake()->upper()->toString();
putenv($envVarName.'='.$configVars[$propertyName]);
}

}

/* YAML */
Expand Down
21 changes: 11 additions & 10 deletions app/Domain/Sprints/Templates/sprintdialog.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,20 @@
<label><?= $tpl->__('label.sprint_name') ?></label>
<input type="text" name="name" value="<?php echo $currentSprint->name?>" placeholder="<?= $tpl->__('label.sprint_name') ?>"/><br />

<?php

function isSelected($projectId, $currentSprint, $currentProject)
{
return (isset($currentSprint) && ($currentSprint->projectId == $projectId || $currentProject == $projectId)) ||
(! isset($currentSprint) && $currentProject == $projectId);
}

$currentProject = session('currentProject');
?>
<label><?= $tpl->__('label.project') ?></label>
<select name="projectId">
<?php foreach ($allAssignedprojects as $project) { ?>
<option value="<?= $project['id'] ?>"
<?php
if (isset($currentSprint)) {
if ($currentSprint->projectId == $project['id']) {
echo 'selected';
}
} elseif (session('currentProject') == $project['id']) {
echo 'selected';
}
?>
<option value="<?= $project['id'] ?>" <?= isSelected($project['id'], $currentSprint ?? null, $currentProject) ? 'selected' : '' ?>
><?= $tpl->escape($project['name']); ?></option>
<?php } ?>
</select><br />
Expand Down
6 changes: 4 additions & 2 deletions config/configuration.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* Config class
* This class is included for backwards compatibility and to be used with subfolder installations
*
* @deprecated Please do not use this file to set you configuration. Use the environment file .env instead
*
* @see config/sample.env
*/
class Config
Expand All @@ -27,9 +29,9 @@ class Config

public $defaultTheme = 'default'; //Default theme

public $primarycolor = '#1b75bb'; //Primary Theme color
public $primarycolor = '#006d9f'; //Primary Theme color

public $secondarycolor = '#81B1A8'; //Secondary Theme Color
public $secondarycolor = '#00a886'; //Secondary Theme Color

public $defaultTimezone = 'America/Los_Angeles'; //Set default timezone

Expand Down
2 changes: 1 addition & 1 deletion config/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ LEAN_DISABLE_LOGIN_FORM = false # If true then don't show the
## Session Management
LEAN_SESSION_PASSWORD = '3evBlq9zdUEuzKvVJHWWx3QzsQhturBApxwcws2m' # Salting sessions, replace with a strong password
LEAN_SESSION_EXPIRATION = 28800 # How many seconds after inactivity should we logout? 28800seconds = 8hours
LEAN_SESSION_SECURE = true # Cookies only served via https
LEAN_SESSION_SECURE = false # Cookies only served via https

## Look & Feel, these settings are available in the UI and can be overwritten there.
LEAN_LOGO_PATH = '/dist/images/logo.svg' # Default logo path, can be changed later
Expand Down

0 comments on commit 4a693ca

Please sign in to comment.