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
This commit is contained in:
katagia 2003-10-01 12:14:04 +00:00
parent 5005f6039e
commit d8fc45f830
7 changed files with 115 additions and 151 deletions

View File

@ -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;

View File

@ -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.

View File

@ -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 "<html><head><title>";
echo _("Create new Account");
echo "</title>\n".
"<link rel=\"stylesheet\" type=\"text/css\" href=\"".$_SESSION['lamurl']."style/layout.css\">\n".
"<meta http-equiv=\"pragma\" content=\"no-cache\">\n".
"<meta http-equiv=\"cache-control\" content=\"no-cache\">\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 "<meta http-equiv=\"refresh\" content=\"2; URL=".$_SESSION['lamurl']."templates/lists/listgroups.php\">\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 "</head><body>\n";
echo "<form action=\"groupedit.php\" method=\"post\">\n";
// Write HTML-Header
echo $_SESSION['header'];
echo "<html><head><title>";
echo _("Create new Account");
echo "</title>\n".
"<link rel=\"stylesheet\" type=\"text/css\" href=\"".$_SESSION['lamurl']."style/layout.css\">\n".
"<meta http-equiv=\"pragma\" content=\"no-cache\">\n".
"<meta http-equiv=\"cache-control\" content=\"no-cache\">\n".
"</head><body>\n".
"<form action=\"groupedit.php\" method=\"post\">\n";
if (is_array($errors)) {
echo "<table class=\"groupedit\" width=\"100%\">\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 '<input name="select" type="hidden" value="finish">';
echo "<fieldset class=\"groupedit-bright\"><legend class=\"groupedit-bright\"><b>"._('Success')."</b></legend>\n";

View File

@ -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 "<html><head><title>";
echo _("Create new Account");
echo "</title>\n".
"<link rel=\"stylesheet\" type=\"text/css\" href=\"".$_SESSION['lamurl']."style/layout.css\">\n".
"<meta http-equiv=\"pragma\" content=\"no-cache\">\n".
"<meta http-equiv=\"cache-control\" content=\"no-cache\">\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 "<meta http-equiv=\"refresh\" content=\"2; URL=".$_SESSION['lamurl']."templates/lists/listhosts.php\">\n";
$select_local='backmain';
metaRefresh($_SESSION['lamurl']."templates/lists/listhosts.php");
die;
break;
}
if (!$select_local) $select_local='general';
} while(0);
echo "</head><body>\n";
echo "<form action=\"hostedit.php\" method=\"post\">\n";
// Write HTML-Header
echo $_SESSION['header'];
echo "<html><head><title>";
echo _("Create new Account");
echo "</title>\n".
"<link rel=\"stylesheet\" type=\"text/css\" href=\"".$_SESSION['lamurl']."style/layout.css\">\n".
"<meta http-equiv=\"pragma\" content=\"no-cache\">\n".
"<meta http-equiv=\"cache-control\" content=\"no-cache\">\n".
"</head><body>\n".
"<form action=\"hostedit.php\" method=\"post\">\n";
if (is_array($errors)) {
echo "<table class=\"account\" width=\"100%\">\n";

View File

@ -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 "<html><head><title>";
echo _("Create new Account");
echo "</title>\n".
"<link rel=\"stylesheet\" type=\"text/css\" href=\"".$_SESSION['lamurl']."style/layout.css\">\n".
"<meta http-equiv=\"pragma\" content=\"no-cache\">\n".
"<meta http-equiv=\"cache-control\" content=\"no-cache\">\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 "<meta http-equiv=\"refresh\" content=\"2; URL=".$_SESSION['lamurl']."templates/lists/listusers.php\">\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 "</head><body>\n";
echo "<form action=\"useredit.php\" method=\"post\">\n";
// Write HTML-Header
echo $_SESSION['header'];
echo "<html><head><title>";
echo _("Create new Account");
echo "</title>\n".
"<link rel=\"stylesheet\" type=\"text/css\" href=\"".$_SESSION['lamurl']."style/layout.css\">\n".
"<meta http-equiv=\"pragma\" content=\"no-cache\">\n".
"<meta http-equiv=\"cache-control\" content=\"no-cache\">\n".
"</head><body>\n".
"<form action=\"useredit.php\" method=\"post\">\n";
if (is_array($errors)) {
echo "<table class=\"account\" width=\"100%\">\n";

View File

@ -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 '<html><head><title>';
echo _('Delete Account');
echo '</title>'."\n".
'<link rel="stylesheet" type="text/css" href="'.$_SESSION['lamurl'].'style/layout.css">'."\n".
'<meta http-equiv="pragma" content="no-cache">'."\n".
'<meta http-equiv="cache-control" content="no-cache">'."\n";
if ($_POST['backmain'])
switch ( $_POST['type5'] ) {
case 'user' :
echo "<meta http-equiv=\"refresh\" content=\"2; URL=lists/listusers.php\">\n";
break;
case 'group' :
echo "<meta http-equiv=\"refresh\" content=\"2; URL=lists/listgroups.php\">\n";
break;
case 'host' :
echo "<meta http-equiv=\"refresh\" content=\"2; URL=lists/listhosts.php\">\n";
break;
}
echo '</head>'."\n".
'<meta http-equiv="cache-control" content="no-cache">'."\n".
'</head>'."\n".
'<body>'."\n".
'<form action="delete.php" method="post">'."\n";
if ($_GET['type']) {
$DN2 = explode(";", str_replace("\'", '',$_GET['DN']));
echo '<input name="type5" type="hidden" value="'.$_GET['type'].'">';
echo '<input name="DN" type="hidden" value="'.$_GET['DN'].'">';
//$DN2 = explode(";", str_replace("\'", '',$_GET['DN']));
switch ($_GET['type']) {
case 'user':
echo "<fieldset class=\"useredit-bright\"><legend class=\"useredit-bright\"><b>";
@ -78,7 +69,7 @@ if ($_GET['type']) {
break;
}
echo "<table border=0 width=\"100%\">\n";
foreach ($DN2 as $dn) echo '<tr><td>'.$dn.'</td></tr>';
foreach ($_SESSION['delete_dn'] as $dn) echo '<tr><td>'.$dn.'</td></tr>';
echo "</table>\n";
if (($_GET['type']== user) && $_SESSION['config']->scriptServer) {
echo "<table border=0 width=\"100%\">\n";
@ -119,8 +110,7 @@ if ($_POST['delete_yes'] && !$_POST['backmain']) {
break;
}
echo "<br><table border=0 width=\"100%\">\n";
$DN2 = explode(";", str_replace("\\", '',str_replace("\'", '',$_POST['DN'])));
foreach ($DN2 as $dn) {
foreach ($_SESSION['delete_dn'] as $dn) {
echo '<input name="type5" type="hidden" value="'.$_POST['type5'].'">';
switch ($_POST['type5']) {
case 'user':
@ -220,23 +210,5 @@ if ($_POST['delete_no']) {
}
if ($_POST['backmain'])
switch ( $_POST['type5'] ) {
case 'user' :
echo '<a href="lists/listusers.php">';
echo _('Please press here if meta-refresh didn\'t work.');
echo "</a>\n";
break;
case 'group' :
echo '<a href="lists/listgroups.php">';
echo _('Please press here if meta-refresh didn\'t work.');
echo "</a>\n";
break;
case 'host' :
echo '<a href="lists/listhosts.php">';
echo _('Please press here if meta-refresh didn\'t work.');
echo "</a>\n";
break;
}
echo '</form></body></html>'."\n";
?>

View File

@ -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 '<html><head><title>';
echo _('Create new Accounts');
echo '</title>'."\n".
'<link rel="stylesheet" type="text/css" href="'.$_SESSION['lamurl'].'style/layout.css">'."\n".
'<meta http-equiv="pragma" content="no-cache">'."\n".
'<meta http-equiv="cache-control" content="no-cache">'."\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;
}
// Write HTML-Header and part of Table
echo $_SESSION['header'];
echo '<html><head><title>';
@ -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.'&amp;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.'&amp;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.'&amp;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.'&amp;type=error">'._('Show Errors.').'</a>';
echo '</td></tr>'."\n";
}
$noerrors=true;