From 77282fed2946f5ae5ebb4d97c0ed6bac7f19dcb9 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 23 Dec 2018 17:21:50 +0100 Subject: [PATCH] refactoring --- lam/templates/help.php | 12 ++++++------ lam/templates/initsuff.php | 12 ++++++------ lam/templates/login.php | 16 ++++++++-------- lam/templates/logout.php | 8 ++++---- lam/templates/tools.php | 6 +++--- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lam/templates/help.php b/lam/templates/help.php index 3d24434d..0df42dfe 100644 --- a/lam/templates/help.php +++ b/lam/templates/help.php @@ -33,13 +33,13 @@ namespace LAM\HELP; */ /** LDAP connection */ -include_once("../lib/ldap.inc"); +include_once(__DIR__ . "/../lib/ldap.inc"); /** configuration */ -include_once("../lib/config.inc"); +include_once(__DIR__ . "/../lib/config.inc"); /** self service functions */ -include_once("../lib/selfService.inc"); +include_once(__DIR__ . "/../lib/selfService.inc"); if (!empty($_GET['selfService']) && ($_GET['selfService'] === '1')) { session_name('SELFSERVICE'); } @@ -50,12 +50,12 @@ if (strtolower(session_module_name()) == 'files') { lam_start_session(); /** status messages */ -include_once("../lib/status.inc"); +include_once(__DIR__ . "/../lib/status.inc"); setlanguage(); /** help data */ -include_once("../help/help.inc"); // Include help/help.inc which provides $helpArray where the help pages are stored +include_once(__DIR__ . "/../help/help.inc"); // Include help/help.inc which provides $helpArray where the help pages are stored /** @@ -115,7 +115,7 @@ $helpEntry = array(); // module help if(isset($_GET['module']) && !($_GET['module'] == 'main') && !($_GET['module'] == '')) { - include_once("../lib/modules.inc"); + include_once(__DIR__ . "/../lib/modules.inc"); if (isset($_GET['scope'])) { $helpEntry = getHelp($_GET['module'],$_GET['HelpNumber'],$_GET['scope']); } diff --git a/lam/templates/initsuff.php b/lam/templates/initsuff.php index 073679d4..dcd1ed2d 100644 --- a/lam/templates/initsuff.php +++ b/lam/templates/initsuff.php @@ -28,13 +28,13 @@ */ /** security functions */ -include_once("../lib/security.inc"); +include_once(__DIR__ . "/../lib/security.inc"); /** access to configuration settings */ -include_once("../lib/config.inc"); +include_once(__DIR__ . "/../lib/config.inc"); /** LDAP access */ -include_once("../lib/ldap.inc"); +include_once(__DIR__ . "/../lib/ldap.inc"); /** status messages */ -include_once("../lib/status.inc"); +include_once(__DIR__ . "/../lib/status.inc"); // start session startSecureSession(); @@ -182,7 +182,7 @@ $newSuffixes = str_replace("\\", "", $newSuffixes); $newSuffixes = str_replace("'", "", $newSuffixes); $newSuffixes = explode(";", $newSuffixes); -include '../lib/adminHeader.inc'; +include __DIR__ . '/../lib/adminHeader.inc'; echo '
'; echo "
\n"; $container = new htmlResponsiveRow(); @@ -207,5 +207,5 @@ include '../lib/adminHeader.inc'; echo "

\n"; echo "
\n"; -include '../lib/adminFooter.inc'; +include __DIR__ . '/../lib/adminFooter.inc'; ?> diff --git a/lam/templates/login.php b/lam/templates/login.php index 51427c6c..6e1b0bdb 100644 --- a/lam/templates/login.php +++ b/lam/templates/login.php @@ -45,26 +45,26 @@ use \htmlDiv; */ /** status messages */ -include_once("../lib/status.inc"); +include_once(__DIR__ . "/../lib/status.inc"); /** check environment */ -include '../lib/checkEnvironment.inc'; +include __DIR__ . '/../lib/checkEnvironment.inc'; /** security functions */ -include_once("../lib/security.inc"); +include_once(__DIR__ . "/../lib/security.inc"); /** self service functions */ -include_once("../lib/selfService.inc"); +include_once(__DIR__ . "/../lib/selfService.inc"); /** access to configuration options */ -include_once("../lib/config.inc"); +include_once(__DIR__ . "/../lib/config.inc"); $licenseValidator = null; if (isLAMProVersion()) { - include_once("../lib/env.inc"); + include_once(__DIR__ . "/../lib/env.inc"); $licenseValidator = new \LAM\ENV\LAMLicenseValidator(); $licenseValidator->validateAndRedirect('config/mainlogin.php?invalidLicense=1', 'config/mainlogin.php?invalidLicense=2'); } /** Upgrade functions */ -include_once("../lib/upgrade.inc"); +include_once(__DIR__ . "/../lib/upgrade.inc"); // set session save path if (strtolower(session_module_name()) == 'files') { @@ -465,7 +465,7 @@ function display_LoginPage($licenseValidator, $error_message) { // checking if the submitted username/password is correct. if(isset($_POST['checklogin'])) { - include_once("../lib/ldap.inc"); // Include ldap.php which provides Ldap class + include_once(__DIR__ . "/../lib/ldap.inc"); // Include ldap.php which provides Ldap class $_SESSION['ldap'] = new Ldap($_SESSION['config']); // Create new Ldap object diff --git a/lam/templates/logout.php b/lam/templates/logout.php index fb2129bc..42a34d14 100644 --- a/lam/templates/logout.php +++ b/lam/templates/logout.php @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2003 - 2017 Roland Gruber + Copyright (C) 2003 - 2018 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,11 +36,11 @@ if (function_exists('openssl_random_pseudo_bytes')) { } /** security functions */ -include_once("../lib/security.inc"); +include_once(__DIR__ . "/../lib/security.inc"); /** Used to display status messages */ -include_once("../lib/status.inc"); +include_once(__DIR__ . "/../lib/status.inc"); /** LDAP settings are deleted at logout */ -include_once("../lib/ldap.inc"); +include_once(__DIR__ . "/../lib/ldap.inc"); // start session startSecureSession(); diff --git a/lam/templates/tools.php b/lam/templates/tools.php index fd76109e..e804cac3 100644 --- a/lam/templates/tools.php +++ b/lam/templates/tools.php @@ -34,11 +34,11 @@ $Id$ */ /** security functions */ -include_once("../lib/security.inc"); +include_once(__DIR__ . "/../lib/security.inc"); /** access to configuration options */ -include_once("../lib/config.inc"); +include_once(__DIR__ . "/../lib/config.inc"); /** tool definitions */ -include_once("../lib/tools.inc"); +include_once(__DIR__ . "/../lib/tools.inc"); // start session startSecureSession();