From d8fc45f8309c93840f46a684eedb3c0de61eb3ea Mon Sep 17 00:00:00 2001 From: katagia Date: Wed, 1 Oct 2003 12:14:04 +0000 Subject: [PATCH] added session info changed redirector. Fixed little bug which causes to display unix-accounts always disabled delte loads users from session, not from $_GET anymore --- lam/lib/account.inc | 2 +- lam/session-vars.txt | 48 +++++++-------- lam/templates/account/groupedit.php | 26 ++++----- lam/templates/account/hostedit.php | 24 ++++---- lam/templates/account/useredit.php | 26 ++++----- lam/templates/delete.php | 50 ++++------------ lam/templates/masscreate.php | 90 +++++++++++++---------------- 7 files changed, 115 insertions(+), 151 deletions(-) diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 26db2fa3..7ae48bc3 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -535,7 +535,7 @@ function loaduser($dn) { // Will load all needed values from an existing account if (isset($attr['postalAddress'][0])) $return->personal_postalAddress = utf8_decode($attr['postalAddress'][0]); if (isset($attr['employeeType'][0])) $return->personal_employeeType = utf8_decode($attr['employeeType'][0]); // New password code. should work with every kind of encryption ({CRYPT}, {SHA} - if ( ereg('^[{]([A-Z]|[a-z]|[0-9])+([}!])+', $attr['userPassword'][0])) $return->unix_deactivated=true; + if ( ereg('^[{]([A-Z]|[a-z]|[0-9])+[}][!]', $attr['userPassword'][0])) $return->unix_deactivated=true; // next line is old code //if (substr(str_replace('{CRYPT}', '',$attr['userPassword'][0]),0,1) == '!' ) $return->unix_deactivated=true; diff --git a/lam/session-vars.txt b/lam/session-vars.txt index aebbb585..3af99d0a 100644 --- a/lam/session-vars.txt +++ b/lam/session-vars.txt @@ -9,17 +9,18 @@ Alle: massdetail: -- accounts: -- errors: +- accounts: Array aus account-Objekten +- errors: Array aus Fehlermeldungen. Index ist gleich Index von accounts masscreate: -- accounts: -- pointer: -- errors: -- group_suffix: -- group_selectprofile: -- rowstart: +- accounts: Array aus account-Objekten +- pointer: Zeigt auf den aktuellen Startpunkt, ab dem Benutzer angelegt werden sollen. + Noetig, da mit Meta-Refreshs gearbeitet werden muss +- errors: Array aus Fehlermeldungen. Index ist gleich Index von accounts +- group_suffix: Suffix, unter welchem eine Gruppe bei Bedarf angelegt wird +- group_selectprofile: Profil, mit dem eine Gruppe bei Bedarf angelegt werden soll +- rowstart: ??? nicht mehr benutzt main: @@ -84,11 +85,11 @@ convsave, confmain, conflogin: useredit: -- shellist: -- account_old: -- account: -- final_changegids: -- hostDN: +- shellist: Array mit allen shells +- account_old: Object account. Hier wird beim laden eines Accounts alle alten Werte zwischengespeichert +- account: Object account. Hier wird der aktuelle Eintrag gespeichert +- final_changegids: boolean. Wenn gesetzt, werden die gids in ldap angepasst +- hostDN: Array mit allen hosts. account.php: @@ -96,7 +97,7 @@ account.php: wird nicht mehr verwendet? -hostedit: +hostedit: s.o. - account: - account_old: - final_changegids: @@ -107,18 +108,19 @@ groupedit: - account: - account_old: - final_changeids: -- userDN: -- Account: ??? +- userDN: Array mit allen Benutzern +- Account: ??? Tipfehler account.inc: -- userDN: -- groupDN: -- hostDN: -- account: -- final_changeids: - - +- userDN: array mit allen Benutzern +- groupDN: array mit allen Gruppen +- hostDN: array mit allen Gruppen +- account: s.o. +- final_changeids: s.o. + +delete.php +- delete_dn : Liste der DNs, die gelscht werden sollen. diff --git a/lam/templates/account/groupedit.php b/lam/templates/account/groupedit.php index e9298904..e6ec2f50 100644 --- a/lam/templates/account/groupedit.php +++ b/lam/templates/account/groupedit.php @@ -226,14 +226,6 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch } -// Write HTML-Header and part of Table -echo $_SESSION['header']; -echo ""; -echo _("Create new Account"); -echo "\n". - "\n". - "\n". - "\n"; do { // X-Or, only one if() can be true if ($_POST['next_members']) { @@ -286,8 +278,8 @@ do { // X-Or, only one if() can be true break; } if ($_POST['backmain']) { - $select_local='backmain'; - echo "\n"; + metaRefresh($_SESSION['lamurl']."templates/lists/listgroups.php"); + die; break; } if ($_POST['load']) { @@ -348,8 +340,16 @@ do { // X-Or, only one if() can be true if (!$select_local) $select_local='general'; } while(0); -echo "\n"; -echo "
\n"; +// Write HTML-Header +echo $_SESSION['header']; +echo ""; +echo _("Create new Account"); +echo "\n". + "\n". + "\n". + "\n". + "\n". + "\n"; if (is_array($errors)) { echo "\n"; @@ -765,7 +765,7 @@ switch ($select_local) { // Select which part of page will be loaded case 'finish': // Final Settings - if (($_SESSION['config']->samba3 =='yes') && !isset($_SESSION['Account']->smb_mapgroup)) $disabled = 'disabled'; + if (($_SESSION['config']->samba3 =='yes') && !isset($_SESSION['account']->smb_mapgroup)) $disabled = 'disabled'; else $disabled = ''; echo ''; echo "
"._('Success')."\n"; diff --git a/lam/templates/account/hostedit.php b/lam/templates/account/hostedit.php index 6b9a44f8..ec7332a4 100644 --- a/lam/templates/account/hostedit.php +++ b/lam/templates/account/hostedit.php @@ -169,14 +169,6 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch break; } -// Write HTML-Header -echo $_SESSION['header']; -echo ""; -echo _("Create new Account"); -echo "\n". - "\n". - "\n". - "\n"; do { // X-Or, only one if() can be true if ($_POST['next_general']) { @@ -241,15 +233,23 @@ do { // X-Or, only one if() can be true break; } if ($_POST['backmain']) { - echo "\n"; - $select_local='backmain'; + metaRefresh($_SESSION['lamurl']."templates/lists/listhosts.php"); + die; break; } if (!$select_local) $select_local='general'; } while(0); -echo "\n"; -echo "\n"; +// Write HTML-Header +echo $_SESSION['header']; +echo ""; +echo _("Create new Account"); +echo "\n". + "\n". + "\n". + "\n". + "\n". + "\n"; if (is_array($errors)) { echo "
\n"; diff --git a/lam/templates/account/useredit.php b/lam/templates/account/useredit.php index a9b7af0b..6bf4650a 100644 --- a/lam/templates/account/useredit.php +++ b/lam/templates/account/useredit.php @@ -425,16 +425,6 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch break; } -if ($select_local != 'pdf') { - // Write HTML-Header - echo $_SESSION['header']; - echo ""; - echo _("Create new Account"); - echo "\n". - "\n". - "\n". - "\n"; - } do { // X-Or, only one if() can be true @@ -572,8 +562,8 @@ do { // X-Or, only one if() can be true break; } if ($_POST['backmain']) { - echo "\n"; - $select_local='backmain'; + metaRefresh($_SESSION['lamurl']."templates/lists/listusers.php"); + die; break; } if (!$select_local) $select_local='general'; @@ -581,8 +571,16 @@ do { // X-Or, only one if() can be true if ($select_local != 'pdf') { - echo "\n"; - echo "\n"; + // Write HTML-Header + echo $_SESSION['header']; + echo ""; + echo _("Create new Account"); + echo "\n". + "\n". + "\n". + "\n". + "\n". + "\n"; if (is_array($errors)) { echo "
\n"; diff --git a/lam/templates/delete.php b/lam/templates/delete.php index e8d3dd84..b12799e7 100644 --- a/lam/templates/delete.php +++ b/lam/templates/delete.php @@ -29,34 +29,25 @@ session_save_path('../sess'); @session_start(); setlanguage(); + +if ($_POST['backmain']) { // back to list page + metaRefresh($_SESSION['lamurl']."templates/lists/list".$_POST['type5']."s.php"); + die; + } + echo $_SESSION['header']; echo ''; echo _('Delete Account'); echo ''."\n". ''."\n". ''."\n". - ''."\n"; - -if ($_POST['backmain']) - switch ( $_POST['type5'] ) { - case 'user' : - echo "\n"; - break; - case 'group' : - echo "\n"; - break; - case 'host' : - echo "\n"; - break; - } -echo ''."\n". + ''."\n". + ''."\n". ''."\n". ''."\n"; if ($_GET['type']) { - $DN2 = explode(";", str_replace("\'", '',$_GET['DN'])); - echo ''; - echo ''; + //$DN2 = explode(";", str_replace("\'", '',$_GET['DN'])); switch ($_GET['type']) { case 'user': echo "
"; @@ -78,7 +69,7 @@ if ($_GET['type']) { break; } echo "
\n"; - foreach ($DN2 as $dn) echo ''; + foreach ($_SESSION['delete_dn'] as $dn) echo ''; echo "
'.$dn.'
'.$dn.'
\n"; if (($_GET['type']== user) && $_SESSION['config']->scriptServer) { echo "\n"; @@ -119,8 +110,7 @@ if ($_POST['delete_yes'] && !$_POST['backmain']) { break; } echo "
\n"; - $DN2 = explode(";", str_replace("\\", '',str_replace("\'", '',$_POST['DN']))); - foreach ($DN2 as $dn) { + foreach ($_SESSION['delete_dn'] as $dn) { echo ''; switch ($_POST['type5']) { case 'user': @@ -220,23 +210,5 @@ if ($_POST['delete_no']) { } -if ($_POST['backmain']) - switch ( $_POST['type5'] ) { - case 'user' : - echo ''; - echo _('Please press here if meta-refresh didn\'t work.'); - echo "\n"; - break; - case 'group' : - echo ''; - echo _('Please press here if meta-refresh didn\'t work.'); - echo "\n"; - break; - case 'host' : - echo ''; - echo _('Please press here if meta-refresh didn\'t work.'); - echo "\n"; - break; - } echo ''."\n"; ?> diff --git a/lam/templates/masscreate.php b/lam/templates/masscreate.php index 4f51b766..911cd670 100644 --- a/lam/templates/masscreate.php +++ b/lam/templates/masscreate.php @@ -53,6 +53,43 @@ else { } if ($select!='pdf') { + switch ($select) { + case 'cancel' : // go back to user list page + metaRefresh($_SESSION['lamurl']."templates/lists/listusers.php"); + die; + break; + case 'list' : // refreh to masscreate + if (!is_array($accounts)) $accounts = array(); + $groups = array(); + if (loadfile()) { + $_SESSION['group_suffix'] = $_POST['f_group_suffix']; + $_SESSION['group_selectprofile'] = $_POST['f_selectgroupprofile']; + metaRefresh($_SESSION['lamurl']."templates/masscreate.php?list2"); + die; + } + else { + echo $_SESSION['header']; + echo ''; + echo _('Create new Accounts'); + echo ''."\n". + ''."\n". + ''."\n". + ''."\n"; + echo ''."\n". + ''."\n". + '
'. + ''."\n"; + echo '
'; + echo _('Max 400 users allowed. Ignored additional users.'); + echo '
'; + echo _('Cancel'); + echo ''; + echo _('Contiune'); + echo "
\n"; + } + break; + } + // Write HTML-Header and part of Table echo $_SESSION['header']; echo ''; @@ -62,19 +99,6 @@ if ($select!='pdf') { '<meta http-equiv="pragma" content="no-cache">'."\n". '<meta http-equiv="cache-control" content="no-cache">'."\n"; switch ($select) { - case 'cancel': - if ( isset($_SESSION['accounts'])) unset($_SESSION['accounts']); - if ( isset($_SESSION['pointer'])) unset($_SESSION['pointer']); - if ( isset($_SESSION['errors'])) unset($_SESSION['errors']); - if ( isset($_SESSION['group_suffix'])) unset($_SESSION['group_suffix']); - if ( isset($_SESSION['group_selectprofile'])) unset($_SESSION['group_selectprofile']); - echo '<meta http-equiv="refresh" content="1; URL=lists/listusers.php">'."\n". - '</head><body>'."\n". - '<form enctype="multipart/form-data" action="masscreate.php" method="post">'."\n". - '<a href="lists/listusers.php">'; - echo _('Please press here if meta-refresh didn\'t work.'); - echo "</a>\n"; - break; case 'create': if ($_SESSION['pointer'] < sizeof($_SESSION['accounts'])) { $refresh = get_cfg_var('max_execution_time')-5; @@ -199,35 +223,6 @@ if ($select!='pdf') { if ( isset($_SESSION['group_selectprofile'])) unset($_SESSION['group_selectprofile']); } break; - case 'list': - if (!is_array($accounts)) $accounts = array(); - $groups = array(); - if (loadfile()) { - echo '<meta http-equiv="refresh" content="2; URL=masscreate.php?list2">'."\n". - '</head><body>'."\n". - '<form enctype="multipart/form-data" action="masscreate.php" method="post">'."\n". - '<a href="masscreate.php?list2">'; - echo _('Please press here if meta-refresh didn\'t work.'); - echo "</a>\n"; - $_SESSION['group_suffix'] = $_POST['f_group_suffix']; - $_SESSION['group_selectprofile'] = $_POST['f_selectgroupprofile']; - - } - else { - //echo '<meta http-equiv="refresh" content="2; URL=masscreate.php?list2">'."\n". - echo '</head><body>'."\n". - '<form enctype="multipart/form-data" action="masscreate.php" method="post">'."\n". - '<table class="masscreate" width="100%">'. - '<tr><td>'; - echo _('Max 400 users allowed. Ignored additional users.'); - echo '</td></tr>'."\n"; - echo '<tr><td><a href="lists/listusers.php">'; - echo _('Cancel'); - echo '</a></td><td><a href="masscreate.php?list2">'; - echo _('Contiune'); - echo "</a></td></tr></table>\n"; - } - break; case 'list2': echo '</head><body>'."\n". '<form enctype="multipart/form-data" action="masscreate.php" method="post">'."\n". @@ -242,9 +237,6 @@ if ($select!='pdf') { echo "</b></legend>\n<table border=0 width=\"100%\">\n"; echo '<tr><td>'._('row').'</td>'."\n".'<td>'. _('Surname'). '</td>'."\n".'<td>'. _('Given name'). '</td>'."\n".'<td>'. _('User name'). '</td>'."\n".'<td>'. _('Primary group'). '</td>'."\n".'<td>'. _('Details'). '</td>'."\n".'<td>' . _('Infos'). '</td>'."\n".'<td>' . _('Warnings'). '</td>'."\n".'<td>' . _('Errors') . '</td>'."\n".'</tr>'."\n"; - if (!isset($_SESSION['rowstart'])) $_SESSION['rowstart'] = 0; - //if (sizeof($_SESSION['accounts'])<($_SESSION['rowstart']+10)) $end = sizeof($_SESSION['accounts']); - // else $end = $_SESSION['rowstart']+10; $end = sizeof($_SESSION['accounts']); for ($row=0; $row<$end; $row++) { // loops for every row echo '<tr><td>'.$row.'</td>'."\n".'<td>'. @@ -252,21 +244,21 @@ if ($select!='pdf') { $_SESSION['accounts'][$row]->general_givenname.'</td>'."\n".'<td>'. $_SESSION['accounts'][$row]->general_username.'</td>'."\n".'<td>'. $_SESSION['accounts'][$row]->general_group.'</td>'."\n".'<td>'. - '<a target=_blank href="massdetail.php?row='.$row.'&type=detail">'._('Show Details.').'</a></td>'."\n".'<td>'; + '<a target=_blank href="massdetail.php?row='.$row.'&type=detail">'._('Show Details.').'</a></td>'."\n".'<td>'; $found=false; for ($i=0; $i<sizeof($_SESSION['errors'][$row]); $i++) if ($_SESSION['errors'][$row][$i][0] == 'INFO') $found=true; - if ($found) echo '<a target="massdetail" href="massdetail.php?row='.$row.'&type=info">'._('Show Infos.').'</a>'; + if ($found) echo '<a target="massdetail" href="massdetail.php?row='.$row.'&type=info">'._('Show Infos.').'</a>'; echo '</td>'."\n".'<td>'; $found=false; for ($i=0; $i<sizeof($_SESSION['errors'][$row]); $i++) if ($_SESSION['errors'][$row][$i][0] == 'WARN') $found=true; - if ($found) echo '<a target="massdetail" href="massdetail.php?row='.$row.'&type=warn">'._('Show Warnings.').'</a>'; + if ($found) echo '<a target="massdetail" href="massdetail.php?row='.$row.'&type=warn">'._('Show Warnings.').'</a>'; echo '</td>'."\n".'<td>'; $found=false; for ($i=0; $i<sizeof($_SESSION['errors'][$row]); $i++) if ($_SESSION['errors'][$row][$i][0] == 'ERROR') $found=true; - if ($found) echo '<a target="massdetail" href="massdetail.php?row='.$row.'&type=error">'._('Show Errors.').'</a>'; + if ($found) echo '<a target="massdetail" href="massdetail.php?row='.$row.'&type=error">'._('Show Errors.').'</a>'; echo '</td></tr>'."\n"; } $noerrors=true;