Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom logo and styles #68

Merged
merged 25 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
ldap-user-manager.iml
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,24 @@ To send emails you'll need to use an existing SMTP server. Email sending will b

* `SESSION_TIMEOUT` (default: *10 minutes*): How long before an idle session will be timed out.

#### Website customization

* `$CUSTOM_LOGO` (default: *FALSE*)*: If this is defined with path to image file, then this image will be displayed in header. You need also mount volume with this file.

* `$CUSTOM_STYLES` (default: *FALSE*)*: If this is defined with path to css file, then this style will be used in header. Also helps vith logo positioninig. You need also mount volume with this file.

docker-compose.yml example:

```yaml
ldap-user-manager:
environment:
CUSTOM_LOGO: "../gfx/logo.svg"
CUSTOM_STYLES: "../css/custom.css"
volumes:
- '/opt/openldap/www/gfx:/opt/ldap_user_manager/gfx'
- '/opt/openldap/www/css:/opt/ldap_user_manager/css'
```

#### Debugging settings

* `LDAP_DEBUG` (default: *FALSE*): Set to TRUE to increase the logging level for LDAP requests. This will output passwords to the error log - don't enable this in a production environment. This is for information on problems updating LDAP records and such. To debug problems connecting to the LDAP server in the first place use `LDAP_VERBOSE_CONNECTION_LOGS`.
Expand Down
3 changes: 3 additions & 0 deletions www/includes/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@

###

$CUSTOM_LOGO = (getenv('CUSTOM_LOGO') ? getenv('CUSTOM_LOGO') : FALSE);
$CUSTOM_STYLES = (getenv('CUSTOM_STYLES') ? getenv('CUSTOM_STYLES') : FALSE);

$errors = "";

if (empty($LDAP['uri'])) {
Expand Down
12 changes: 7 additions & 5 deletions www/includes/web_functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function log_out($method='normal') {

function render_header($title="",$menu=TRUE) {

global $SITE_NAME, $IS_ADMIN, $SENT_HEADERS, $SERVER_PATH;
global $SITE_NAME, $IS_ADMIN, $SENT_HEADERS, $SERVER_PATH, $CUSTOM_STYLES;

if (empty($title)) { $title = $SITE_NAME; }

Expand All @@ -242,6 +242,7 @@ function render_header($title="",$menu=TRUE) {
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<?php print $SERVER_PATH; ?>bootstrap/css/bootstrap.min.css">
<?php if ($CUSTOM_STYLES) echo '<link rel="stylesheet" href="'.$CUSTOM_STYLES.'">' ?>
<script src="<?php print $SERVER_PATH; ?>js/jquery-3.6.0.min.js"></script>
<script src="<?php print $SERVER_PATH; ?>bootstrap/js/bootstrap.min.js"></script>
</HEAD>
Expand Down Expand Up @@ -277,14 +278,15 @@ function render_menu() {
#Render the navigation menu.
#The menu is dynamically rendered the $MODULES hash

global $SITE_NAME, $MODULES, $THIS_MODULE, $VALIDATED, $IS_ADMIN, $USER_ID, $SERVER_PATH;
global $SITE_NAME, $MODULES, $THIS_MODULE, $VALIDATED, $IS_ADMIN, $USER_ID, $SERVER_PATH, $CUSTOM_LOGO;

?>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#"><?php print $SITE_NAME ?></a>
</div>
<div class="navbar-header"><?php
if ($CUSTOM_LOGO) echo '<span class="navbar-brand"><img src="'.$CUSTOM_LOGO.'" class="logo" alt="logo"></span>'
?><a class="navbar-brand" href="./"><?php print $SITE_NAME ?></a>
</div>
<ul class="nav navbar-nav">
<?php
foreach ($MODULES as $module => $access) {
Expand Down