From ea9bbf788e500c13e20bbfdc0755f9478b24bb25 Mon Sep 17 00:00:00 2001 From: katagia Date: Fri, 25 Apr 2003 11:07:28 +0000 Subject: [PATCH] Renamed print.php in print.html print.html is now written in html-code added template for delete --- lam/config/print.html | 24 +++++++++++++++ lam/config/print.php | 27 ----------------- lam/lib/account.inc | 9 +++--- lam/lib/createntlm.pl | 4 +-- lam/templates/account.php | 41 +++++++++++++------------- lam/templates/delete.php | 62 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 112 insertions(+), 55 deletions(-) create mode 100644 lam/config/print.html delete mode 100644 lam/config/print.php create mode 100644 lam/templates/delete.php diff --git a/lam/config/print.html b/lam/config/print.html new file mode 100644 index 00000000..6cfaecc3 --- /dev/null +++ b/lam/config/print.html @@ -0,0 +1,24 @@ +Userinformation +
+personal_title?> personal_surname?> personal_givenname?> +personal_employeeType?> +personal_street?> +personal_postalCode?> personal_postalAddress?> +
+Telephone: personal_telephoneNumber?> +Mobile Phone: personal_mobileTelephoneNumber?> +Fax Number: personal_facsimileTelephoneNumber?> +eMail-Address: personal_mail?> +
+Username: general_username?>UID-Number: general_uidNumber?> +Unix-Password: unix_password?> +Groupname: general_group?>GID-Number: +User is also member of groups: general_groupadd as $group) echo $group.' ';?> + +Homedirectory: general_homedir?>Shell: general_shell?> +
+Windows-Password: smb_password?> +Windows-Domain: smb_domain?> +Allowed workstations: smb_smbuserworkstations?> +Windows-Homedir: smb_smbhome?> + diff --git a/lam/config/print.php b/lam/config/print.php deleted file mode 100644 index ce983b32..00000000 --- a/lam/config/print.php +++ /dev/null @@ -1,27 +0,0 @@ -Userinformation'; -echo '
'; -echo ''.$_SESSION['account']->personal_title .' '. $_SESSION['account']->personal_surname .' '. $_SESSION['account']->personal_givenname . ''; -echo ''.$_SESSION['account']->personal_employeeType.''; -echo ''.$_SESSION['account']->personal_street.''; -echo ''.$_SESSION['account']->personal_postalCode.$_SESSION['account']->personal_postalAddress.''; -echo '
'; -echo 'Telephone: '.$_SESSION['account']->personal_telephoneNumber.''; -echo 'Mobile Phone: '.$_SESSION['account']->personal_mobileTelephoneNumber.''; -echo 'Fax Number: '.$_SESSION['account']->personal_facsimileTelephoneNumber.''; -echo 'eMail-Address: '.$_SESSION['account']->personal_mail.''; -echo '
'; -echo 'Username: '.$_SESSION['account']->general_username.'UID-Number: '.$_SESSION['account']->general_uidNumber.''; -echo 'Unix-Password: '.$_SESSION['account']->unix_password.''; -echo 'Groupname: '.$_SESSION['account']->general_group.'GID-Number: '; -echo 'User is also member of the groups: '; -foreach ($_SESSION['account']->general_groupadd[] as $group) echo $group.' '; -echo ''; -echo 'Homedirectory: '.$_SESSION['account']->general_homedir.'Shell: '.$_SESSION['account']->general_shell.''; -echo '
'; -echo 'Windows-Password: '.$_SESSION['account']->smb_password.''; -echo 'Windows-Domain: '.$_SESSION['account']->smb_domain.''; -echo 'Allowed workstations: '.$_SESSION['account']->smb_smbuserworkstations.''; -echo 'Windows-Homedir: '.$_SESSION['account']->smb_smbhome.''; -echo ''; -?> \ No newline at end of file diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 9df0adba..f4c58c10 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -570,7 +570,6 @@ function createuser() { // Will create the LDAP-Account // 3 == Account has been modified // 4 == Error while creating Account // 5 == Error while modifying Account - // Value stored in shadowExpire, days since 1.1.1970 $date = mktime(0,0,0, $_SESSION['account']->unix_pwdexpire_day, $_SESSION['account']->unix_pwdexpire_mon, $_SESSION['account']->unix_pwdexpire_yea) / 86400 ; settype($date, 'integer'); @@ -612,8 +611,8 @@ function createuser() { // Will create the LDAP-Account $attr['shadowLastChange'] = getdays(); // shadowAccunt_may } if ($_SESSION['account']->smb_password!='') { - $attr['ntPassword'] = exec('../lib/createntlm.pl nt' . $_SESSION['account']->smb_password); - $attr['lmPassword'] = exec('../lib/createntlm.pl lm' . $_SESSION['account']->smb_password); + $attr['ntPassword'] = exec('../lib/createntlm.pl nt ' . $_SESSION['account']->smb_password); + $attr['lmPassword'] = exec('../lib/createntlm.pl lm ' . $_SESSION['account']->smb_password); $attr['pwdLastSet'] = time(); // sambaAccount_may } } @@ -622,8 +621,8 @@ function createuser() { // Will create the LDAP-Account if ($_SESSION['account']->unix_deactivated) $attr['userPassword'] = '{CRYPT}!' . crypt($_SESSION['account']->unix_password); else $attr['userPassword'] = '{CRYPT}' . crypt($_SESSION['account']->unix_password); $attr['shadowLastChange'] = getdays(); // shadowAccunt_may - $attr['ntPassword'] = exec('../lib/createntlm.pl nt' . $_SESSION['account']->smb_password); - $attr['lmPassword'] = exec('../lib/createntlm.pl lm' . $_SESSION['account']->smb_password); + $attr['ntPassword'] = exec('../lib/createntlm.pl nt ' . $_SESSION['account']->smb_password); + $attr['lmPassword'] = exec('../lib/createntlm.pl lm ' . $_SESSION['account']->smb_password); $attr['pwdLastSet'] = time(); // sambaAccount_may } if ($_SESSION['account']->smb_password_no) { diff --git a/lam/lib/createntlm.pl b/lam/lib/createntlm.pl index affc8872..0f399d21 100755 --- a/lam/lib/createntlm.pl +++ b/lam/lib/createntlm.pl @@ -482,6 +482,6 @@ sub E_P16 { return @p16; } -if ($ARGV[0] eq 'nt') { print nthash($ARGV[1]); } -if ($ARGV[0] eq 'lm') { print lmhash($ARGV[1]); } +if ($ARGV[0] eq 'nt') { print nthash($ARGV[1])."\n"; } +if ($ARGV[0] eq 'lm') { print lmhash($ARGV[1])."\n"; } diff --git a/lam/templates/account.php b/lam/templates/account.php index 45f8116b..a57dae3f 100644 --- a/lam/templates/account.php +++ b/lam/templates/account.php @@ -194,30 +194,15 @@ if ( $create ) { // Create-Button was pressed switch ($_SESSION['type2']) { case 'user': $result = createuser(); // account.inc - if ( $result==1 || $result==3 ) { - $_SESSION['account'] = ""; - $_SESSION['account_old'] = ""; - $_SESSION['account_temp'] = ""; - $select = 'finish'; - } + if ( $result==1 || $result==3 ) $select = 'finish'; break; case 'group': $result = creategroup(); // account.inc - if ( $result==1 || $result==3 ) { - $_SESSION['account'] = ""; - $_SESSION['account_old'] = ""; - $_SESSION['account_temp'] = ""; - $select = 'finish'; - } + if ( $result==1 || $result==3 ) $select = 'finish'; break; case 'host': $result = createhost(); // account.inc - if ( $result==1 || $result==3 ) { - $_SESSION['account'] = ""; - $_SESSION['account_old'] = ""; - $_SESSION['account_temp'] = ""; - $select = 'finish'; - } + if ( $result==1 || $result==3 ) $select = 'finish'; break; } } @@ -238,8 +223,22 @@ echo ' if (!$select) $select='general'; -if ($createagain) $select='general'; -if ($backmain) $select='backmain'; +if ($createagain) { + $select='general'; + $_SESSION['account']=""; + $_SESSION['account_temp']=""; + $_SESSION['account_old']=""; + } +if ($backmain) { + $select='backmain'; + $_SESSION['account']=""; + $_SESSION['account_temp']=""; + $_SESSION['account_old']=""; + } + + + + switch ($select) { case 'general': @@ -763,7 +762,7 @@ switch ($select) { echo $_SESSION['account']->general_username; echo _('has been created'); echo ''; - include('../config/print.php'); + foreach (file('../config/print.html') as $line) eval("?".">".$line."<"."?"); echo ' diff --git a/lam/templates/delete.php b/lam/templates/delete.php new file mode 100644 index 00000000..52e25a57 --- /dev/null +++ b/lam/templates/delete.php @@ -0,0 +1,62 @@ +'; +echo _('Delete Account'); +echo ' + + +
+ + + +
'; + +if ($DN && $type) +foreach ($DN as $dn) { + $dn = str_replace("\'", '',$dn); + switch ($type) { + case 'user': + $success = ldap_delete($_SESSION['ldap']->server(), $dn); + if (!$success) $error = _('Could not delete user: ').$dn; + break; + case 'host': + $success = ldap_delete($_SESSION['ldap']->server(), $dn); + if (!$success) $error = _('Could not delete user: ').$dn; + break; + case 'group': + $entry = ldap_read($_SESSION['ldap']->server(), $dn, ""); + if (!$entry) $error = _('Could not delete group: ').$dn; + $attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry); + if ($attr['memberUid']) $error = _('Could not delete group. Still users in group: ').$dn; + break; + } + if (!$error) echo $dn. _('deleted.'); + echo '
'; + } + +echo ''; +?> \ No newline at end of file