refactoring

This commit is contained in:
Roland Gruber 2017-09-18 19:39:08 +02:00
parent e468e10a29
commit 93e69bfb4c
5 changed files with 13 additions and 13 deletions

View File

@ -591,7 +591,7 @@ if(!empty($_POST['checklogin'])) {
$searchFilter = str_replace('%USER%', $username ,$searchFilter); $searchFilter = str_replace('%USER%', $username ,$searchFilter);
$searchDN = ''; $searchDN = '';
$searchPassword = ''; $searchPassword = '';
if (($_SESSION['config']->getLoginSearchDN() != null) && ($_SESSION['config']->getLoginSearchDN() != '')) { if (!empty($_SESSION['config']->getLoginSearchDN())) {
$searchDN = $_SESSION['config']->getLoginSearchDN(); $searchDN = $_SESSION['config']->getLoginSearchDN();
$searchPassword = $_SESSION['config']->getLoginSearchPassword(); $searchPassword = $_SESSION['config']->getLoginSearchPassword();
} }

View File

@ -81,7 +81,7 @@ if (isset($_POST['createOU']) || isset($_POST['deleteOU'])) {
// check if ou already exists // check if ou already exists
$new_dn = "ou=" . $_POST['newOU'] . "," . $_POST['parentOU']; $new_dn = "ou=" . $_POST['newOU'] . "," . $_POST['parentOU'];
$found = ldapGetDN($new_dn); $found = ldapGetDN($new_dn);
if ($found == null) { if ($found === null) {
// add new ou // add new ou
$ou = array(); $ou = array();
$ou['objectClass'] = "organizationalunit"; $ou['objectClass'] = "organizationalunit";

View File

@ -142,7 +142,7 @@ if (!empty($_POST['import'])) {
} }
$errMessage = importStructures($_POST['typeId'], $options, $serverProfiles, $typeManager); $errMessage = importStructures($_POST['typeId'], $options, $serverProfiles, $typeManager);
} }
if ($errMessage != null) { if ($errMessage !== null) {
$errMessage->colspan = 10; $errMessage->colspan = 10;
$container->addElement($errMessage, true); $container->addElement($errMessage, true);
} }
@ -167,7 +167,7 @@ if (!empty($_POST['export'])) {
$name = $_POST['name_' . $typeId]; $name = $_POST['name_' . $typeId];
$errMessage = exportStructures($typeId, $name, $options, $serverProfiles, $typeManager); $errMessage = exportStructures($typeId, $name, $options, $serverProfiles, $typeManager);
} }
if ($errMessage != null) { if ($errMessage !== null) {
$errMessage->colspan = 10; $errMessage->colspan = 10;
$container->addElement($errMessage, true); $container->addElement($errMessage, true);
} }
@ -437,7 +437,7 @@ function importStructures($typeId, $options, &$serverProfiles, TypeManager &$typ
$sourceTypeManager = new TypeManager($serverProfiles[$sourceConfName]); $sourceTypeManager = new TypeManager($serverProfiles[$sourceConfName]);
$sourceType = $sourceTypeManager->getConfiguredType($sourceTypeId); $sourceType = $sourceTypeManager->getConfiguredType($sourceTypeId);
$targetType = $typeManager->getConfiguredType($typeId); $targetType = $typeManager->getConfiguredType($typeId);
if (($sourceType != null) && ($targetType != null)) { if (($sourceType !== null) && ($targetType !== null)) {
try { try {
\LAM\PDF\copyStructure($sourceType, $sourceName, $targetType); \LAM\PDF\copyStructure($sourceType, $sourceName, $targetType);
} }
@ -461,7 +461,7 @@ function importStructures($typeId, $options, &$serverProfiles, TypeManager &$typ
*/ */
function exportStructures($typeId, $name, $options, &$serverProfiles, TypeManager &$typeManager) { function exportStructures($typeId, $name, $options, &$serverProfiles, TypeManager &$typeManager) {
$sourceType = $typeManager->getConfiguredType($typeId); $sourceType = $typeManager->getConfiguredType($typeId);
if ($sourceType == null) { if ($sourceType === null) {
return null; return null;
} }
foreach ($options as $option) { foreach ($options as $option) {
@ -478,7 +478,7 @@ function exportStructures($typeId, $name, $options, &$serverProfiles, TypeManage
$targetTypeId = $option['typeId']; $targetTypeId = $option['typeId'];
$targetTypeManager = new TypeManager($serverProfiles[$targetConfName]); $targetTypeManager = new TypeManager($serverProfiles[$targetConfName]);
$targetType = $targetTypeManager->getConfiguredType($targetTypeId); $targetType = $targetTypeManager->getConfiguredType($targetTypeId);
if ($targetType != null) { if ($targetType !== null) {
try { try {
\LAM\PDF\copyStructure($sourceType, $name, $targetType); \LAM\PDF\copyStructure($sourceType, $name, $targetType);
} }

View File

@ -159,7 +159,7 @@ if (!empty($_POST['import'])) {
} }
$errMessage = importProfiles($_POST['typeId'], $options, $serverProfiles, $typeManager); $errMessage = importProfiles($_POST['typeId'], $options, $serverProfiles, $typeManager);
} }
if ($errMessage != null) { if ($errMessage !== null) {
$errMessage->colspan = 10; $errMessage->colspan = 10;
$container->addElement($errMessage, true); $container->addElement($errMessage, true);
} }
@ -182,7 +182,7 @@ if (!empty($_POST['export'])) {
$name = $_POST['name_' . $typeId]; $name = $_POST['name_' . $typeId];
$errMessage = exportProfiles($typeId, $name, $options, $serverProfiles, $typeManager); $errMessage = exportProfiles($typeId, $name, $options, $serverProfiles, $typeManager);
} }
if ($errMessage != null) { if ($errMessage !== null) {
$errMessage->colspan = 10; $errMessage->colspan = 10;
$container->addElement($errMessage, true); $container->addElement($errMessage, true);
} }
@ -397,7 +397,7 @@ function importProfiles($typeId, $options, &$serverProfiles, TypeManager &$typeM
$sourceTypeManager = new TypeManager($serverProfiles[$sourceConfName]); $sourceTypeManager = new TypeManager($serverProfiles[$sourceConfName]);
$sourceType = $sourceTypeManager->getConfiguredType($sourceTypeId); $sourceType = $sourceTypeManager->getConfiguredType($sourceTypeId);
$targetType = $typeManager->getConfiguredType($typeId); $targetType = $typeManager->getConfiguredType($typeId);
if (($sourceType != null) && ($targetType != null)) { if (($sourceType !== null) && ($targetType !== null)) {
try { try {
\LAM\PROFILES\copyAccountProfile($sourceType, $sourceName, $targetType); \LAM\PROFILES\copyAccountProfile($sourceType, $sourceName, $targetType);
} }
@ -421,7 +421,7 @@ function importProfiles($typeId, $options, &$serverProfiles, TypeManager &$typeM
*/ */
function exportProfiles($typeId, $name, $options, &$serverProfiles, TypeManager &$typeManager) { function exportProfiles($typeId, $name, $options, &$serverProfiles, TypeManager &$typeManager) {
$sourceType = $typeManager->getConfiguredType($typeId); $sourceType = $typeManager->getConfiguredType($typeId);
if ($sourceType == null) { if ($sourceType === null) {
return null; return null;
} }
foreach ($options as $option) { foreach ($options as $option) {
@ -438,7 +438,7 @@ function exportProfiles($typeId, $name, $options, &$serverProfiles, TypeManager
$targetTypeId = $option['typeId']; $targetTypeId = $option['typeId'];
$targetTypeManager = new TypeManager($serverProfiles[$targetConfName]); $targetTypeManager = new TypeManager($serverProfiles[$targetConfName]);
$targetType = $targetTypeManager->getConfiguredType($targetTypeId); $targetType = $targetTypeManager->getConfiguredType($targetTypeId);
if ($targetType != null) { if ($targetType !== null) {
try { try {
\LAM\PROFILES\copyAccountProfile($sourceType, $name, $targetType); \LAM\PROFILES\copyAccountProfile($sourceType, $name, $targetType);
} }

View File

@ -229,7 +229,7 @@ for ($m = 0; $m < sizeof($modules); $m++) {
if (sizeof($options[$modules[$m]]) < 1) continue; if (sizeof($options[$modules[$m]]) < 1) continue;
$module = new $modules[$m]($type->getScope()); $module = new $modules[$m]($type->getScope());
$icon = $module->getIcon(); $icon = $module->getIcon();
if (($icon != null) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) { if (!empty($icon) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) {
$icon = '../../graphics/' . $icon; $icon = '../../graphics/' . $icon;
} }
$container = new htmlTable(); $container = new htmlTable();