refactoring
This commit is contained in:
parent
ed325fcab6
commit
ce68219e6a
|
@ -55,7 +55,6 @@ if (!empty($_POST)) {
|
||||||
if (isset($_POST['add_suff']) || isset($_POST['cancel'])) {
|
if (isset($_POST['add_suff']) || isset($_POST['cancel'])) {
|
||||||
if (isset($_POST['add_suff'])) {
|
if (isset($_POST['add_suff'])) {
|
||||||
$failedDNs = array();
|
$failedDNs = array();
|
||||||
$error = array();
|
|
||||||
$newSuffixes = $_POST['new_suff'];
|
$newSuffixes = $_POST['new_suff'];
|
||||||
$newSuffixes = str_replace("\\", "", $newSuffixes);
|
$newSuffixes = str_replace("\\", "", $newSuffixes);
|
||||||
$newSuffixes = str_replace("'", "", $newSuffixes);
|
$newSuffixes = str_replace("'", "", $newSuffixes);
|
||||||
|
@ -63,9 +62,14 @@ if (isset($_POST['add_suff']) || isset($_POST['cancel'])) {
|
||||||
// add entries
|
// add entries
|
||||||
foreach ($newSuffixes as $newSuffix) {
|
foreach ($newSuffixes as $newSuffix) {
|
||||||
// check if entry is already present
|
// check if entry is already present
|
||||||
$info = ldap_read($_SESSION['ldap']->server(), escapeDN($newSuffix), "objectclass=*", array('dn'), 0, 0, 0, LDAP_DEREF_NEVER);
|
$info = @ldap_read($_SESSION['ldap']->server(), escapeDN($newSuffix), "objectclass=*", array('dn'), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
|
$res = false;
|
||||||
|
if ($info !== false) {
|
||||||
$res = ldap_get_entries($_SESSION['ldap']->server(), $info);
|
$res = ldap_get_entries($_SESSION['ldap']->server(), $info);
|
||||||
if ($res) continue;
|
}
|
||||||
|
if ($res) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$suff = $newSuffix;
|
$suff = $newSuffix;
|
||||||
// generate DN and attributes
|
// generate DN and attributes
|
||||||
$tmp = explode(",", $suff);
|
$tmp = explode(",", $suff);
|
||||||
|
@ -78,8 +82,7 @@ if (isset($_POST['add_suff']) || isset($_POST['cancel'])) {
|
||||||
$attr['objectClass'] = 'organization';
|
$attr['objectClass'] = 'organization';
|
||||||
$dn = $suff;
|
$dn = $suff;
|
||||||
if (!@ldap_add($_SESSION['ldap']->server(), $dn, $attr)) {
|
if (!@ldap_add($_SESSION['ldap']->server(), $dn, $attr)) {
|
||||||
$failedDNs[] = $suff;
|
$failedDNs[$suff] = ldap_error($_SESSION['ldap']->server());
|
||||||
$error[] = ldap_error($_SESSION['ldap']->server());
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,8 +111,11 @@ if (isset($_POST['add_suff']) || isset($_POST['cancel'])) {
|
||||||
$subsuffCount = sizeof($subsuffs);
|
$subsuffCount = sizeof($subsuffs);
|
||||||
for ($k = $subsuffCount - 1; $k >= 0; $k--) {
|
for ($k = $subsuffCount - 1; $k >= 0; $k--) {
|
||||||
// check if subsuffix is present
|
// check if subsuffix is present
|
||||||
$info = ldap_read($_SESSION['ldap']->server(), escapeDN($subsuffs[$k]), "objectclass=*", array('dn'), 0, 0, 0, LDAP_DEREF_NEVER);
|
$info = @ldap_read($_SESSION['ldap']->server(), escapeDN($subsuffs[$k]), "objectclass=*", array('dn'), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
|
$res = false;
|
||||||
|
if ($info !== false) {
|
||||||
$res = ldap_get_entries($_SESSION['ldap']->server(), $info);
|
$res = ldap_get_entries($_SESSION['ldap']->server(), $info);
|
||||||
|
}
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
$suffarray = explode(",", $subsuffs[$k]);
|
$suffarray = explode(",", $subsuffs[$k]);
|
||||||
$headarray = explode("=", $suffarray[0]);
|
$headarray = explode("=", $suffarray[0]);
|
||||||
|
@ -119,8 +125,7 @@ if (isset($_POST['add_suff']) || isset($_POST['cancel'])) {
|
||||||
$attr['ou'] = $headarray[1];
|
$attr['ou'] = $headarray[1];
|
||||||
$dn = $subsuffs[$k];
|
$dn = $subsuffs[$k];
|
||||||
if (!@ldap_add($_SESSION['ldap']->server(), $dn, $attr)) {
|
if (!@ldap_add($_SESSION['ldap']->server(), $dn, $attr)) {
|
||||||
$failedDNs[] = $suff;
|
$failedDNs[$suff] = ldap_error($_SESSION['ldap']->server());
|
||||||
$error[] = ldap_error($_SESSION['ldap']->server());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,8 +139,7 @@ if (isset($_POST['add_suff']) || isset($_POST['cancel'])) {
|
||||||
}
|
}
|
||||||
$dn = $subsuffs[$k];
|
$dn = $subsuffs[$k];
|
||||||
if (!@ldap_add($_SESSION['ldap']->server(), $dn, $attr)) {
|
if (!@ldap_add($_SESSION['ldap']->server(), $dn, $attr)) {
|
||||||
$failedDNs[] = $suff;
|
$failedDNs[$suff] = ldap_error($_SESSION['ldap']->server());
|
||||||
$error[] = ldap_error($_SESSION['ldap']->server());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,8 +147,7 @@ if (isset($_POST['add_suff']) || isset($_POST['cancel'])) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$failedDNs[] = $suff;
|
$failedDNs[$suff] = ldap_error($_SESSION['ldap']->server());
|
||||||
$error[] = ldap_error($_SESSION['ldap']->server());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,8 +158,8 @@ if (isset($_POST['add_suff']) || isset($_POST['cancel'])) {
|
||||||
if (isset($_POST['add_suff'])) {
|
if (isset($_POST['add_suff'])) {
|
||||||
if (sizeof($failedDNs) > 0) {
|
if (sizeof($failedDNs) > 0) {
|
||||||
// print error messages
|
// print error messages
|
||||||
for ($i = 0; $i < sizeof($failedDNs); $i++) {
|
foreach ($failedDNs as $suffix => $error) {
|
||||||
StatusMessage("ERROR", _("Failed to create entry!") . "<br>" . htmlspecialchars($error[$i]), htmlspecialchars($failedDNs[$i]));
|
StatusMessage("ERROR", _("Failed to create entry!") . "<br>" . htmlspecialchars($error), htmlspecialchars($suffix));
|
||||||
}
|
}
|
||||||
include 'main_footer.php';
|
include 'main_footer.php';
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,11 @@ $new_suffs = array();
|
||||||
$typeManager = new \LAM\TYPES\TypeManager();
|
$typeManager = new \LAM\TYPES\TypeManager();
|
||||||
$types = $typeManager->getConfiguredTypes();
|
$types = $typeManager->getConfiguredTypes();
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
$info = ldap_read($_SESSION['ldap']->server(), escapeDN($type->getSuffix()), "(objectClass=*)", array('objectClass'), 0, 0, 0, LDAP_DEREF_NEVER);
|
$info = @ldap_read($_SESSION['ldap']->server(), escapeDN($type->getSuffix()), "(objectClass=*)", array('objectClass'), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||||
|
if (($info === false) && !in_array($type->getSuffix(), $new_suffs)) {
|
||||||
|
$new_suffs[] = $type->getSuffix();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$res = ldap_get_entries($_SESSION['ldap']->server(), $info);
|
$res = ldap_get_entries($_SESSION['ldap']->server(), $info);
|
||||||
if (!$res && !in_array($type->getSuffix(), $new_suffs)) {
|
if (!$res && !in_array($type->getSuffix(), $new_suffs)) {
|
||||||
$new_suffs[] = $type->getSuffix();
|
$new_suffs[] = $type->getSuffix();
|
||||||
|
|
|
@ -85,8 +85,7 @@ $availableTools = getTools();
|
||||||
$toolSettings = $_SESSION['config']->getToolSettings();
|
$toolSettings = $_SESSION['config']->getToolSettings();
|
||||||
// sort tools
|
// sort tools
|
||||||
$toSort = array();
|
$toSort = array();
|
||||||
for ($i = 0; $i < sizeof($availableTools); $i++) {
|
foreach ($availableTools as $toolClass) {
|
||||||
$toolClass = $availableTools[$i];
|
|
||||||
$myTool = new $toolClass();
|
$myTool = new $toolClass();
|
||||||
if ($myTool->getRequiresWriteAccess() && !checkIfWriteAccessIsAllowed()) {
|
if ($myTool->getRequiresWriteAccess() && !checkIfWriteAccessIsAllowed()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -103,7 +102,7 @@ for ($i = 0; $i < sizeof($availableTools); $i++) {
|
||||||
if (isset($toolSettings['tool_hide_' . $toolName]) && ($toolSettings['tool_hide_' . $toolName] == 'true')) {
|
if (isset($toolSettings['tool_hide_' . $toolName]) && ($toolSettings['tool_hide_' . $toolName] == 'true')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$toSort[$availableTools[$i]] = $myTool->getPosition();
|
$toSort[$toolClass] = $myTool->getPosition();
|
||||||
}
|
}
|
||||||
asort($toSort);
|
asort($toSort);
|
||||||
$tools = array();
|
$tools = array();
|
||||||
|
@ -148,19 +147,19 @@ foreach ($toSort as $key => $value) {
|
||||||
<a href="<?php echo $headerPrefix; ?>tools.php"><img class="align-middle" height="16" width="16" alt="tools" src="<?php echo $headerPrefix; ?>../graphics/tools.png"> <?php echo _("Tools") ?></a>
|
<a href="<?php echo $headerPrefix; ?>tools.php"><img class="align-middle" height="16" width="16" alt="tools" src="<?php echo $headerPrefix; ?>../graphics/tools.png"> <?php echo _("Tools") ?></a>
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php
|
||||||
for ($i = 0; $i < sizeof($tools); $i++) {
|
foreach ($tools as $tool) {
|
||||||
$subTools = $tools[$i]->getSubTools();
|
$subTools = $tool->getSubTools();
|
||||||
echo '<li title="' . $tools[$i]->getDescription() . '">';
|
echo '<li title="' . $tool->getDescription() . '">';
|
||||||
$link = $headerPrefix . $tools[$i]->getLink();
|
$link = $headerPrefix . $tool->getLink();
|
||||||
echo '<a href="' . $link . "\">\n";
|
echo '<a href="' . $link . "\">\n";
|
||||||
echo '<img height="16" width="16" alt="" src="' . $headerPrefix . '../graphics/' . $tools[$i]->getImageLink() . '"> ' . $tools[$i]->getName();
|
echo '<img height="16" width="16" alt="" src="' . $headerPrefix . '../graphics/' . $tool->getImageLink() . '"> ' . $tool->getName();
|
||||||
echo "</a>\n";
|
echo "</a>\n";
|
||||||
if (sizeof($subTools) > 0) {
|
if (sizeof($subTools) > 0) {
|
||||||
echo "<ul>\n";
|
echo "<ul>\n";
|
||||||
for ($s = 0; $s < sizeof($subTools); $s++) {
|
foreach ($subTools as $subTool) {
|
||||||
echo "<li title=\"" . $subTools[$s]->description . "\">\n";
|
echo "<li title=\"" . $subTool->description . "\">\n";
|
||||||
echo "<a href=\"" . $headerPrefix . $subTools[$s]->link . "\">\n";
|
echo "<a href=\"" . $headerPrefix . $subTool->link . "\">\n";
|
||||||
echo '<img width=16 height=16 alt="" src="' . $headerPrefix . '../graphics/' . $subTools[$s]->image . '"> ' . $subTools[$s]->name;
|
echo '<img width=16 height=16 alt="" src="' . $headerPrefix . '../graphics/' . $subTool->image . '"> ' . $subTool->name;
|
||||||
echo "</a>\n";
|
echo "</a>\n";
|
||||||
echo "</li>\n";
|
echo "</li>\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,8 +191,8 @@ function display_main($message, $error) {
|
||||||
$type = $typeManager->getConfiguredType($typeId);
|
$type = $typeManager->getConfiguredType($typeId);
|
||||||
$elements = array();
|
$elements = array();
|
||||||
$units = searchLDAP($type->getSuffix(), '(objectclass=organizationalunit)', array('dn'));
|
$units = searchLDAP($type->getSuffix(), '(objectclass=organizationalunit)', array('dn'));
|
||||||
for ($u = 0; $u < sizeof($units); $u++) {
|
foreach ($units as $unit) {
|
||||||
$elements[getAbstractDN($units[$u]['dn'])] = $units[$u]['dn'];
|
$elements[getAbstractDN($unit['dn'])] = $unit['dn'];
|
||||||
}
|
}
|
||||||
$options[$title] = $elements;
|
$options[$title] = $elements;
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,10 +243,6 @@ include '../main_header.php';
|
||||||
$container->addElement(new htmlSubTitle(_("Manage existing PDF structures")), true);
|
$container->addElement(new htmlSubTitle(_("Manage existing PDF structures")), true);
|
||||||
$existingContainer = new htmlTable();
|
$existingContainer = new htmlTable();
|
||||||
foreach ($templateClasses as $templateClass) {
|
foreach ($templateClasses as $templateClass) {
|
||||||
if ($i > 0) {
|
|
||||||
$existingContainer->addElement(new htmlSpacer(null, '10px'), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$existingContainer->addElement(new htmlImage('../../graphics/' . $templateClass['icon']));
|
$existingContainer->addElement(new htmlImage('../../graphics/' . $templateClass['icon']));
|
||||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||||
$existingContainer->addElement(new htmlOutputText($templateClass['title']));
|
$existingContainer->addElement(new htmlOutputText($templateClass['title']));
|
||||||
|
|
|
@ -188,8 +188,8 @@ include '../main_header.php';
|
||||||
|
|
||||||
// print error messages if any
|
// print error messages if any
|
||||||
if (sizeof($saveErrors) > 0) {
|
if (sizeof($saveErrors) > 0) {
|
||||||
for ($i = 0; $i < sizeof($saveErrors); $i++) {
|
foreach ($saveErrors as $saveError) {
|
||||||
call_user_func_array('StatusMessage', $saveErrors[$i]);
|
call_user_func_array('StatusMessage', $saveError);
|
||||||
}
|
}
|
||||||
echo "<br>\n";
|
echo "<br>\n";
|
||||||
}
|
}
|
||||||
|
@ -259,8 +259,7 @@ $structure = $_SESSION['currentPDFStructure'];
|
||||||
// print every entry in the current structure
|
// print every entry in the current structure
|
||||||
$structureContent = new htmlTable();
|
$structureContent = new htmlTable();
|
||||||
$sections = $structure->getSections();
|
$sections = $structure->getSections();
|
||||||
for ($key = 0; $key < sizeof($sections); $key++) {
|
foreach ($sections as $key => $section) {
|
||||||
$section = $sections[$key];
|
|
||||||
// create the up/down/remove links
|
// create the up/down/remove links
|
||||||
$linkUp = new htmlButton('up_section_' . $key, 'up.gif', true);
|
$linkUp = new htmlButton('up_section_' . $key, 'up.gif', true);
|
||||||
$linkUp->setTitle(_("Up"));
|
$linkUp->setTitle(_("Up"));
|
||||||
|
@ -317,8 +316,7 @@ for ($key = 0; $key < sizeof($sections); $key++) {
|
||||||
$structureContent->addElement($linkRemove, true);
|
$structureContent->addElement($linkRemove, true);
|
||||||
// add section entries
|
// add section entries
|
||||||
$sectionEntries = $section->getEntries();
|
$sectionEntries = $section->getEntries();
|
||||||
for ($e = 0; $e < sizeof($sectionEntries); $e++) {
|
foreach ($sectionEntries as $e => $sectionEntry) {
|
||||||
$sectionEntry = $sectionEntries[$e];
|
|
||||||
$structureContent->addElement(new htmlSpacer('10px', null));
|
$structureContent->addElement(new htmlSpacer('10px', null));
|
||||||
$fieldOutput = new htmlOutputText(translateFieldIDToName($sectionEntry->getKey(), $type->getScope(), $availablePDFFields));
|
$fieldOutput = new htmlOutputText(translateFieldIDToName($sectionEntry->getKey(), $type->getScope(), $availablePDFFields));
|
||||||
$structureContent->addElement($fieldOutput);
|
$structureContent->addElement($fieldOutput);
|
||||||
|
|
|
@ -86,8 +86,8 @@ foreach ($types as $type) {
|
||||||
$profileClassesKeys = array_keys($profileClassesTemp);
|
$profileClassesKeys = array_keys($profileClassesTemp);
|
||||||
natcasesort($profileClassesKeys);
|
natcasesort($profileClassesKeys);
|
||||||
$profileClassesKeys = array_values($profileClassesKeys);
|
$profileClassesKeys = array_values($profileClassesKeys);
|
||||||
for ($i = 0; $i < sizeof($profileClassesKeys); $i++) {
|
foreach ($profileClassesKeys as $profileClassesKey) {
|
||||||
$profileClasses[] = $profileClassesTemp[$profileClassesKeys[$i]];
|
$profileClasses[] = $profileClassesTemp[$profileClassesKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if user is logged in, if not go to login
|
// check if user is logged in, if not go to login
|
||||||
|
@ -102,10 +102,10 @@ elseif (isset($_POST['createProfileButton'])) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
// check if a profile should be edited
|
// check if a profile should be edited
|
||||||
for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
foreach ($profileClasses as $profileClass) {
|
||||||
if (isset($_POST['editProfile_' . $profileClasses[$i]['typeId']]) || isset($_POST['editProfile_' . $profileClasses[$i]['typeId'] . '_x'])) {
|
if (isset($_POST['editProfile_' . $profileClass['typeId']]) || isset($_POST['editProfile_' . $profileClass['typeId'] . '_x'])) {
|
||||||
metaRefresh("profilepage.php?type=" . htmlspecialchars($profileClasses[$i]['typeId']) .
|
metaRefresh("profilepage.php?type=" . htmlspecialchars($profileClass['typeId']) .
|
||||||
"&edit=" . htmlspecialchars($_POST['profile_' . $profileClasses[$i]['typeId']]));
|
"&edit=" . htmlspecialchars($_POST['profile_' . $profileClass['typeId']]));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,10 +189,10 @@ if (!empty($_POST['export'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get list of profiles for each account type
|
// get list of profiles for each account type
|
||||||
for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
foreach ($profileClasses as &$profileClass) {
|
||||||
$profileList = \LAM\PROFILES\getAccountProfiles($profileClasses[$i]['typeId']);
|
$profileList = \LAM\PROFILES\getAccountProfiles($profileClass['typeId']);
|
||||||
natcasesort($profileList);
|
natcasesort($profileList);
|
||||||
$profileClasses[$i]['profiles'] = $profileList;
|
$profileClass['profiles'] = $profileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['savedSuccessfully'])) {
|
if (isset($_GET['savedSuccessfully'])) {
|
||||||
|
@ -205,8 +205,8 @@ if (isset($_GET['savedSuccessfully'])) {
|
||||||
if (!empty($profileClasses)) {
|
if (!empty($profileClasses)) {
|
||||||
$container->addElement(new htmlSubTitle(_('Create a new profile')), true);
|
$container->addElement(new htmlSubTitle(_('Create a new profile')), true);
|
||||||
$sortedTypes = array();
|
$sortedTypes = array();
|
||||||
for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
foreach ($profileClasses as $profileClass) {
|
||||||
$sortedTypes[$profileClasses[$i]['title']] = $profileClasses[$i]['typeId'];
|
$sortedTypes[$profileClass['title']] = $profileClass['typeId'];
|
||||||
}
|
}
|
||||||
natcasesort($sortedTypes);
|
natcasesort($sortedTypes);
|
||||||
$newContainer = new htmlTable();
|
$newContainer = new htmlTable();
|
||||||
|
@ -226,37 +226,33 @@ $container->addElement(new htmlSubTitle(_('Manage existing profiles')), true);
|
||||||
$existingContainer = new htmlTable();
|
$existingContainer = new htmlTable();
|
||||||
$existingContainer->colspan = 5;
|
$existingContainer->colspan = 5;
|
||||||
|
|
||||||
for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
foreach ($profileClasses as $profileClass) {
|
||||||
if ($i > 0) {
|
$existingContainer->addElement(new htmlImage('../../graphics/' . $profileClass['icon']));
|
||||||
$existingContainer->addElement(new htmlSpacer(null, '10px'), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$existingContainer->addElement(new htmlImage('../../graphics/' . $profileClasses[$i]['icon']));
|
|
||||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||||
$existingContainer->addElement(new htmlOutputText($profileClasses[$i]['title']));
|
$existingContainer->addElement(new htmlOutputText($profileClass['title']));
|
||||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||||
$select = new htmlSelect('profile_' . $profileClasses[$i]['typeId'], $profileClasses[$i]['profiles']);
|
$select = new htmlSelect('profile_' . $profileClass['typeId'], $profileClass['profiles']);
|
||||||
$select->setWidth('15em');
|
$select->setWidth('15em');
|
||||||
$existingContainer->addElement($select);
|
$existingContainer->addElement($select);
|
||||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||||
$editButton = new htmlButton('editProfile_' . $profileClasses[$i]['typeId'], 'edit.png', true);
|
$editButton = new htmlButton('editProfile_' . $profileClass['typeId'], 'edit.png', true);
|
||||||
$editButton->setTitle(_('Edit'));
|
$editButton->setTitle(_('Edit'));
|
||||||
$existingContainer->addElement($editButton);
|
$existingContainer->addElement($editButton);
|
||||||
$deleteLink = new htmlLink(null, '#', '../../graphics/delete.png');
|
$deleteLink = new htmlLink(null, '#', '../../graphics/delete.png');
|
||||||
$deleteLink->setTitle(_('Delete'));
|
$deleteLink->setTitle(_('Delete'));
|
||||||
$deleteLink->setOnClick("profileShowDeleteDialog('" . _('Delete') . "', '" . _('Ok') . "', '" . _('Cancel') . "', '" . $profileClasses[$i]['typeId'] . "', '" . 'profile_' . $profileClasses[$i]['typeId'] . "');");
|
$deleteLink->setOnClick("profileShowDeleteDialog('" . _('Delete') . "', '" . _('Ok') . "', '" . _('Cancel') . "', '" . $profileClass['typeId'] . "', '" . 'profile_' . $profileClass['typeId'] . "');");
|
||||||
$existingContainer->addElement($deleteLink);
|
$existingContainer->addElement($deleteLink);
|
||||||
if (count($configProfiles) > 1) {
|
if (count($configProfiles) > 1) {
|
||||||
$importLink = new htmlLink(null, '#', '../../graphics/import.png');
|
$importLink = new htmlLink(null, '#', '../../graphics/import.png');
|
||||||
$importLink->setTitle(_('Import profiles'));
|
$importLink->setTitle(_('Import profiles'));
|
||||||
$importLink->setOnClick("showDistributionDialog('" . _("Import profiles") . "', '" .
|
$importLink->setOnClick("showDistributionDialog('" . _("Import profiles") . "', '" .
|
||||||
_('Ok') . "', '" . _('Cancel') . "', '" . $profileClasses[$i]['typeId'] . "', 'import');");
|
_('Ok') . "', '" . _('Cancel') . "', '" . $profileClass['typeId'] . "', 'import');");
|
||||||
$existingContainer->addElement($importLink);
|
$existingContainer->addElement($importLink);
|
||||||
}
|
}
|
||||||
$exportLink = new htmlLink(null, '#', '../../graphics/export.png');
|
$exportLink = new htmlLink(null, '#', '../../graphics/export.png');
|
||||||
$exportLink->setTitle(_('Export profile'));
|
$exportLink->setTitle(_('Export profile'));
|
||||||
$exportLink->setOnClick("showDistributionDialog('" . _("Export profile") . "', '" .
|
$exportLink->setOnClick("showDistributionDialog('" . _("Export profile") . "', '" .
|
||||||
_('Ok') . "', '" . _('Cancel') . "', '" . $profileClasses[$i]['typeId'] . "', 'export', '" . 'profile_' . $profileClasses[$i]['typeId'] . "');");
|
_('Ok') . "', '" . _('Cancel') . "', '" . $profileClass['typeId'] . "', 'export', '" . 'profile_' . $profileClass['typeId'] . "');");
|
||||||
$existingContainer->addElement($exportLink);
|
$existingContainer->addElement($exportLink);
|
||||||
$existingContainer->addNewLine();
|
$existingContainer->addNewLine();
|
||||||
}
|
}
|
||||||
|
@ -270,9 +266,9 @@ parseHtml(null, $container, array(), false, $tabindex, 'user');
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
|
|
||||||
for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
foreach ($profileClasses as $profileClass) {
|
||||||
$typeId = $profileClasses[$i]['typeId'];
|
$typeId = $profileClass['typeId'];
|
||||||
$scope = $profileClasses[$i]['scope'];
|
$scope = $profileClass['scope'];
|
||||||
$importOptions = array();
|
$importOptions = array();
|
||||||
foreach ($configProfiles as $profile) {
|
foreach ($configProfiles as $profile) {
|
||||||
$typeManagerImport = new TypeManager($serverProfiles[$profile]);
|
$typeManagerImport = new TypeManager($serverProfiles[$profile]);
|
||||||
|
@ -281,8 +277,8 @@ for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
||||||
if (($profile != $_SESSION['config']->getName()) || ($typeImport->getId() != $typeId)) {
|
if (($profile != $_SESSION['config']->getName()) || ($typeImport->getId() != $typeId)) {
|
||||||
$accountProfiles = \LAM\PROFILES\getAccountProfiles($typeImport->getId(), $profile);
|
$accountProfiles = \LAM\PROFILES\getAccountProfiles($typeImport->getId(), $profile);
|
||||||
if (!empty($accountProfiles)) {
|
if (!empty($accountProfiles)) {
|
||||||
for ($p = 0; $p < sizeof($accountProfiles); $p++) {
|
foreach ($accountProfiles as $accountProfile) {
|
||||||
$importOptions[$profile][$typeImport->getAlias() . ': ' . $accountProfiles[$p]] = $profile . '##' . $typeImport->getId() . '##' . $accountProfiles[$p];
|
$importOptions[$profile][$typeImport->getAlias() . ': ' . $accountProfile] = $profile . '##' . $typeImport->getId() . '##' . $accountProfile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue