removed obsolete code

This commit is contained in:
Roland Gruber 2016-07-14 21:00:47 +02:00
parent d3cacaaa5d
commit 1a3f0f5d8a
2 changed files with 16 additions and 26 deletions

View File

@ -3,7 +3,7 @@
$Id$ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2004 - 2015 Roland Gruber Copyright (C) 2004 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -63,13 +63,8 @@ if (!empty($_POST)) {
// show LDIF if requested // show LDIF if requested
if (isset($_GET['showldif'])) { if (isset($_GET['showldif'])) {
//download file //download file
if(isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']) and strpos($HTTP_SERVER_VARS['HTTP_USER_AGENT'],'MSIE')) { header('Content-Type: text/plain');
Header('Content-Type: application/force-download'); header('Content-disposition: attachment; filename=lam.ldif');
}
else {
Header('Content-Type: text/plain');
}
Header('Content-disposition: attachment; filename=lam.ldif');
$accounts = unserialize($_SESSION['ldap']->decrypt($_SESSION['mass_accounts'])); $accounts = unserialize($_SESSION['ldap']->decrypt($_SESSION['mass_accounts']));
for ($i = 0; $i < sizeof($accounts); $i++) { for ($i = 0; $i < sizeof($accounts); $i++) {
echo "DN: " . $accounts[$i]['dn'] . "\n"; echo "DN: " . $accounts[$i]['dn'] . "\n";
@ -127,9 +122,9 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
while (($line = fgetcsv($handle, 2000)) !== false ) { // account rows while (($line = fgetcsv($handle, 2000)) !== false ) { // account rows
$data[] = $line; $data[] = $line;
} }
$errors = array(); $errors = array();
// check if all required columns are present // check if all required columns are present
$checkcolumns = array(); $checkcolumns = array();
$columns = call_user_func_array('array_merge', $columns); $columns = call_user_func_array('array_merge', $columns);
@ -139,7 +134,7 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
else $errors[] = array(_("A required column is missing in your CSV file."), $columns[$i]['name']); else $errors[] = array(_("A required column is missing in your CSV file."), $columns[$i]['name']);
} }
} }
// check if all required attributes are given // check if all required attributes are given
$invalidColumns = array(); $invalidColumns = array();
$id_names = array_keys($ids); $id_names = array_keys($ids);
@ -160,7 +155,7 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
for ($i = 0; $i < sizeof($invalidColumns); $i++) { for ($i = 0; $i < sizeof($invalidColumns); $i++) {
$errors[] = array(_("One or more values of the required column \"$invalidColumns[$i]\" are missing."), ""); $errors[] = array(_("One or more values of the required column \"$invalidColumns[$i]\" are missing."), "");
} }
// check if values in unique columns are correct // check if values in unique columns are correct
for ($i = 0; $i < sizeof($columns); $i++) { for ($i = 0; $i < sizeof($columns); $i++) {
if (isset($columns[$i]['unique']) && ($columns[$i]['unique'] == true) && isset($ids[$columns[$i]['name']])) { if (isset($columns[$i]['unique']) && ($columns[$i]['unique'] == true) && isset($ids[$columns[$i]['name']])) {
@ -182,7 +177,7 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
} }
} }
} }
// if input data is invalid just display error messages (max 50) // if input data is invalid just display error messages (max 50)
if (sizeof($errors) > 0) { if (sizeof($errors) > 0) {
for ($i = 0; $i < sizeof($errors); $i++) { for ($i = 0; $i < sizeof($errors); $i++) {
@ -191,7 +186,7 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
$container->addElement(new htmlSpacer(null, '10px'), true); $container->addElement(new htmlSpacer(null, '10px'), true);
massPrintBackButton($scope, $selectedModules, $container); massPrintBackButton($scope, $selectedModules, $container);
} }
// let modules build accounts // let modules build accounts
else { else {
$accounts = buildUploadAccounts($scope, $data, $ids, $selectedModules); $accounts = buildUploadAccounts($scope, $data, $ids, $selectedModules);

View File

@ -3,7 +3,7 @@
$Id$ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2004 - 2015 Roland Gruber Copyright (C) 2004 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -67,13 +67,8 @@ if (!empty($_POST)) {
// show CSV if requested // show CSV if requested
if (isset($_GET['getCSV'])) { if (isset($_GET['getCSV'])) {
//download file //download file
if(isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']) and strpos($HTTP_SERVER_VARS['HTTP_USER_AGENT'],'MSIE')) { header('Content-Type: application/msexcel');
Header('Content-Type: application/force-download'); header('Content-disposition: attachment; filename=lam.csv');
}
else {
Header('Content-Type: application/msexcel');
}
Header('Content-disposition: attachment; filename=lam.csv');
echo $_SESSION['mass_csv']; echo $_SESSION['mass_csv'];
exit; exit;
} }
@ -241,7 +236,7 @@ function showMainPage($scope, $selectedModules) {
// get input fields from modules // get input fields from modules
$columns = getUploadColumns($scope, $selectedModules); $columns = getUploadColumns($scope, $selectedModules);
$modules = array_keys($columns); $modules = array_keys($columns);
echo "<form enctype=\"multipart/form-data\" action=\"massBuildAccounts.php\" method=\"post\">\n"; echo "<form enctype=\"multipart/form-data\" action=\"massBuildAccounts.php\" method=\"post\">\n";
$container = new htmlTable(); $container = new htmlTable();
// title // title
@ -438,11 +433,11 @@ function showMainPage($scope, $selectedModules) {
} }
} }
$container->addElement($columnContainer, true); $container->addElement($columnContainer, true);
addSecurityTokenToMetaHTML($container); addSecurityTokenToMetaHTML($container);
$tabindex = 1; $tabindex = 1;
parseHtml(null, $container, array(), false, $tabindex, $scope); parseHtml(null, $container, array(), false, $tabindex, $scope);
echo "</form>\n"; echo "</form>\n";
// build sample CSV // build sample CSV
@ -476,7 +471,7 @@ function showMainPage($scope, $selectedModules) {
} }
$sampleCSV = implode(",", $sampleCSV_head) . "\n" . implode(",", $sampleCSV_row) . "\n"; $sampleCSV = implode(",", $sampleCSV_head) . "\n" . implode(",", $sampleCSV_row) . "\n";
$_SESSION['mass_csv'] = $sampleCSV; $_SESSION['mass_csv'] = $sampleCSV;
echo '</div>'; echo '</div>';
include 'main_footer.php'; include 'main_footer.php';
die; die;