From b584c216204ec9f70bf72f2ea325bdabb15e434d Mon Sep 17 00:00:00 2001
From: katagia <katagia>
Date: Sun, 8 Jun 2003 19:08:29 +0000
Subject: [PATCH] *** empty log message ***

---
 lam/lib/account.inc          |  4 ++--
 lam/templates/account.php    | 32 +++++++++++++++++++------------
 lam/templates/masscreate.php | 37 +++++++++++++++++++++---------------
 3 files changed, 44 insertions(+), 29 deletions(-)

diff --git a/lam/lib/account.inc b/lam/lib/account.inc
index 2ef8d403..20073003 100644
--- a/lam/lib/account.inc
+++ b/lam/lib/account.inc
@@ -769,7 +769,7 @@ function createuser($values) { // Will create the LDAP-Account
 		addhomedir($values->general_username);
 		}
 	// Add User to Additional Groups
-	if ($values->general_groupadd)
+	if ($values->general_groupadd[0])
 		foreach ($values->general_groupadd as $group2) {
 			$result = ldap_search($_SESSION['ldap']->server(), 'cn='.$group2.','.$_SESSION['config']->get_GroupSuffix(), "objectclass=posixGroup");
 			$entry = ldap_first_entry($_SESSION['ldap']->server(), $result);
@@ -1013,7 +1013,7 @@ function createhost($values) { // Will create the LDAP-Account
 	$success = ldap_add($_SESSION['ldap']->server(),$values->general_dn, $attr);
 	if (!$success) return 4;
 	// Add Host to Additional Groups
-	if ($values->general_groupadd)
+	if ($values->general_groupadd[0])
 		foreach ($values->general_groupadd as $group2) {
 			$result = ldap_search($_SESSION['ldap']->server(), 'cn='.$group2.','.$_SESSION['config']->get_GroupSuffix(), "objectclass=posixGroup");
 			$entry = ldap_first_entry($_SESSION['ldap']->server(), $result);
diff --git a/lam/templates/account.php b/lam/templates/account.php
index 7e4edff2..ae96a069 100644
--- a/lam/templates/account.php
+++ b/lam/templates/account.php
@@ -239,7 +239,10 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch
 		break;
 	case 'finish':
 		// Check if pdf-file should be created
-		if ($_POST['outputpdf']) createpdf($_SESSION['account']);
+		if ($_POST['outputpdf']) {
+			createpdf($_SESSION['account']);
+			$select_local = 'pdf';
+			}
 		break;
 	}
 
@@ -284,16 +287,18 @@ if ($_POST['load']) $select_local='load';
 if ($_POST['save']) $select_local='save';
 
 
-// Write HTML-Header and part of Table
-echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
-       \"http://www.w3.org/TR/html4/loose.dtd\">\n";
-echo "<html><head><title>";
-echo _("Create new Account");
-echo "</title>\n
-	<link rel=\"stylesheet\" type=\"text/css\" href=\"../style/layout.css\">\n
-	<meta http-equiv=\"pragma\" content=\"no-cache\">\n
-	<meta http-equiv=\"cache-control\" content=\"no-cache\">\n
-	<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">";
+if ($select_local != 'pdf') {
+	// Write HTML-Header and part of Table
+	echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
+		\"http://www.w3.org/TR/html4/loose.dtd\">\n";
+	echo "<html><head><title>";
+	echo _("Create new Account");
+	echo "</title>\n
+		<link rel=\"stylesheet\" type=\"text/css\" href=\"../style/layout.css\">\n
+		<meta http-equiv=\"pragma\" content=\"no-cache\">\n
+		<meta http-equiv=\"cache-control\" content=\"no-cache\">\n
+		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">";
+	}
 
 switch ($select_local) {
 	// backmain = back to lists
@@ -353,10 +358,13 @@ switch ($select_local) {
 		break;
 	}
 
+
+if ($select_local != 'pdf') {
 	echo "</head><body>\n";
 	echo "<form action=\"account.php\" method=\"post\">\n";
 	if ($error != "0") StatusMessage("ERROR", _("Invalid Value!"), $error);
 	echo "<table rules=\"all\" class=\"account\" width=\"100%\">\n";
+	}
 
 
 switch ($select_local) { // Select which part of page will be loaded
@@ -1009,5 +1017,5 @@ switch ($select_local) { // Select which part of page will be loaded
 	}
 
 // Print end of HTML-Page
-echo '</table></form></body></html>';
+if ($select_local != 'pdf') echo '</table></form></body></html>';
 ?>
diff --git a/lam/templates/masscreate.php b/lam/templates/masscreate.php
index 80f9eb3c..330e9952 100644
--- a/lam/templates/masscreate.php
+++ b/lam/templates/masscreate.php
@@ -38,21 +38,26 @@ if ($_POST['tolist'] && ($_FILES['userfile']['size']>0)) $select = 'list';
 if ($_POST['back']) $select = 'main';
 if ($_POST['cancel']) $select = 'cancel';
 if ($_POST['create']) $select = 'create';
-if ($_POST['pdf']) createpdf($_SESSION['accounts']);
+if ($_POST['pdf']) {
+	createpdf($_SESSION['accounts']);
+	$select='pdf';
+	}
 if (!$select && !$_SESSION['pointer']) $select='main';
 if (!$select && $_SESSION['pointer']) $select='create';
 
 
-// Write HTML-Header and part of Table
-echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-       "http://www.w3.org/TR/html4/loose.dtd">';
-echo '<html><head><title>';
-echo _('Create new Accounts');
-echo '</title>
-	<link rel="stylesheet" type="text/css" href="../style/layout.css">
-	<meta http-equiv="pragma" content="no-cache">
-	<meta http-equiv="cache-control" content="no-cache">
-	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">';
+if ($select!='pdf') {
+	// Write HTML-Header and part of Table
+	echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+		"http://www.w3.org/TR/html4/loose.dtd">';
+	echo '<html><head><title>';
+	echo _('Create new Accounts');
+	echo '</title>
+		<link rel="stylesheet" type="text/css" href="../style/layout.css">
+		<meta http-equiv="pragma" content="no-cache">
+		<meta http-equiv="cache-control" content="no-cache">
+		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">';
+	}
 
 switch ($select) {
 	case 'cancel':
@@ -68,10 +73,12 @@ switch ($select) {
 		break;
 	}
 
-echo	'</head><body>
-	<form enctype="multipart/form-data" action="masscreate.php" method="post">';
+if ($select!='pdf') {
+	echo	'</head><body>
+		<form enctype="multipart/form-data" action="masscreate.php" method="post">';
 	echo '<table rules="all" class="masscreate" width="100%">
-	<tr><td></td></tr>';
+		<tr><td></td></tr>';
+	}
 
 switch ($select) {
 	case 'main':
@@ -228,5 +235,5 @@ switch ($select) {
 	}
 
 
-echo '</table></form></body></html>';
+if ($select!='pdf') echo '</table></form></body></html>';
 ?>