From 58a1b21207cae2abf656e6c7c7485e2efd0ed2aa Mon Sep 17 00:00:00 2001 From: katagia Date: Sat, 8 Nov 2003 11:24:20 +0000 Subject: [PATCH] added support for custom text in pdf-files show error when creating user or host an no groups are existing --- lam/lib/pdf.inc | 2 +- lam/templates/account/hostedit.php | 18 ++++++++++++++++++ lam/templates/account/useredit.php | 25 ++++++++++++++++++++++--- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/lam/lib/pdf.inc b/lam/lib/pdf.inc index 212a1a7e..8ef449ae 100644 --- a/lam/lib/pdf.inc +++ b/lam/lib/pdf.inc @@ -45,7 +45,7 @@ function createUserPDF($accounts) { $key = base64_decode($_COOKIE['Key']); $pdfFile->addPage(); // Load string with additional information from session - $info_string = $_SESSION['config']->pdf_customtext; + $info_string = $_SESSION['config']->pdftext; // Print individuall text. // Get all allowed vairables from account-object $values = get_object_vars($account); diff --git a/lam/templates/account/hostedit.php b/lam/templates/account/hostedit.php index 087a421e..3937e48f 100644 --- a/lam/templates/account/hostedit.php +++ b/lam/templates/account/hostedit.php @@ -82,6 +82,24 @@ if (isset($_GET['DN']) && $_GET['DN']!='') { // Startcondition. hostedit.php was called from outside to create a new host else if (count($_POST)==0) { // Create new account object with settings from default profile + // Check if there are valid groups. Can not create user with no primary group + $groups = findgroups(); + if (count($groups)==0) { + // Write HTML-Header + echo $header_intern; + echo ""; + echo ""; + echo _("Create new Account"); + echo "\n". + "\n". + "\n". + "\n". + "\n". + // Display errir-messages + StatusMessage("ERROR", _("Can not create any hosts."),_("Please create a group first.")); + echo ""; + die; + } $account_new = loadHostProfile('default'); $account_new ->type = 'host'; $account_new->smb_flagsW = 1; diff --git a/lam/templates/account/useredit.php b/lam/templates/account/useredit.php index 99780aae..c65a04f3 100644 --- a/lam/templates/account/useredit.php +++ b/lam/templates/account/useredit.php @@ -92,6 +92,24 @@ if (isset($_GET['DN']) && $_GET['DN']!='') { // Startcondition. useredit.php was called from outside to create a new group else if (count($_POST)==0) { // Create new account object with settings from default profile + // Check if there are valid groups. Can not create user with no primary group + $groups = findgroups(); + if (count($groups)==0) { + // Write HTML-Header + echo $header_intern; + echo ""; + echo ""; + echo _("Create new Account"); + echo "\n". + "\n". + "\n". + "\n". + "\n". + // Display errir-messages + StatusMessage("ERROR", _("Can not create any users."),_("Please create a group first.")); + echo ""; + die; + } $account_new = loadUserProfile('default'); $account_new ->type = 'user'; if ($config_intern->scriptServer) { @@ -415,7 +433,7 @@ switch ($_POST['select']) { else $account_new->smb_password = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $_POST['f_smb_password'], MCRYPT_MODE_ECB, $iv)); } else $account_new->smb_password = ''; - if ( ($account_new->smb_useunixpwd && !$account_old) || ($account_new->smb_useunixpwd && $account_new->unix_password!='') ) { + if ( (($account_new->smb_useunixpwd && !$account_old) || ($account_new->smb_useunixpwd && $account_new->unix_password!='')) && isset($account_new->unix_password) ) { // Set Samba-Password to unix-password if option is set $unix_password = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($account_new->unix_password), MCRYPT_MODE_ECB, $iv); $smb_password = str_replace(chr(00), '', $unix_password); @@ -733,10 +751,10 @@ do { // X-Or, only one if() can be true } } while(0); - // Write HTML-Header echo $header_intern; -echo ""; +echo "<html><head>"; +echo "<title>"; echo _("Create new Account"); echo "\n". "\n". @@ -753,6 +771,7 @@ if (is_array($errors)) // print_r($account_new); //print_r($account_old); + switch ($select_local) { /* Select which part of page should be loaded and check values * groups = page with all groups to which user is additional member