diff options
author | Tarik Gasmi | 2007-05-14 09:46:29 +0200 |
---|---|---|
committer | Tarik Gasmi | 2007-05-14 09:46:29 +0200 |
commit | b192e30ee65a420e12b71cbc0b410754983c052e (patch) | |
tree | 7e1b63e5c932d15d33943e7bab1cba8fe394c7fb /ldap-site-mngmt | |
parent | * fixed incorrect execution of chroot with respect to setting up the (diff) | |
download | core-b192e30ee65a420e12b71cbc0b410754983c052e.tar.gz core-b192e30ee65a420e12b71cbc0b410754983c052e.tar.xz core-b192e30ee65a420e12b71cbc0b410754983c052e.zip |
Some webinterface data.
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1076 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'ldap-site-mngmt')
58 files changed, 3103 insertions, 0 deletions
diff --git a/ldap-site-mngmt/webinterface/au/au.php b/ldap-site-mngmt/webinterface/au/au.php new file mode 100644 index 00000000..ca732622 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/au.php @@ -0,0 +1,29 @@ +<?php + +include('../standard_header.inc.php'); +include("../class.FastTemplate.php"); + +# Filename of Template +$webseite = "au_start.dwt"; + +include('au_header.inc.php'); + + +############################################################################### +# Menus + +$mnr = 0; +$sbmnr = -1; + +$childauDN = $_GET['dn']; + +createMainMenu($rollen, $mainnr); +createAUMenu($rollen, $mnr, $auDN, $sbmnr); + + +############################################################################### +# Footer + +include("au_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/au_change.php b/ldap-site-mngmt/webinterface/au/au_change.php new file mode 100644 index 00000000..990d2155 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/au_change.php @@ -0,0 +1,121 @@ +<?php + +include('../standard_header.inc.php'); + +# $_POST form variables +$cn = $_POST['commonname']; +$oldcn = $_POST['oldcn']; +$description = $_POST['description']; +$olddesc = $_POST['olddesc']; + +$cn = htmlentities($cn); +$oldcn = htmlentities($oldcn); +$description = htmlentities($description); +$olddesc = htmlentities($olddesc); + +#echo "new cn:"; print_r($cn); echo "<br>"; +#echo "old cn:"; print_r($oldcn); echo "<br>"; +#echo "new desc:"; print_r($description); echo "<br>"; +#echo "old desc:"; print_r($olddesc); echo "<br><br>"; + +$url = 'au_show.php'; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $oldcn == "" && $cn != "" ){ + echo "CN neu anlegen<br>"; + # hier noch Syntaxcheck + $entry['cn'] = $cn; + $result = ldap_mod_add($ds,$auDN,$entry); + if($result){ + $mesg = "AU Name erfolgreich eingetragen<br><br>"; + } + else{ + $mesg = "Fehler beim eintragen des AU Namen<br><br>"; + } +} + +if ( $oldcn != "" && $cn != "" && $oldcn != $cn ){ + echo "CN aendern<br>"; + # hier noch Syntaxcheck + $entry['cn'] = $cn; + $result = ldap_mod_replace($ds,$auDN,$entry); + if($result){ + $mesg = "AU Name erfolgreich geaendert<br><br>"; + } + else{ + $mesg = "Fehler beim aendern des AU Namen<br><br>"; + } +} + +if ( $oldcn != "" && $cn == "" ){ + echo "CN loeschen<br>"; + # hier noch Syntaxcheck + $entry['cn'] = $oldcn; + $result = ldap_mod_del($ds,$auDN,$entry); + if($result){ + $mesg = "AU Name erfolgreich geloescht<br><br>"; + } + else{ + $mesg = "Fehler beim loeschen des AU Namen<br><br>"; + } +} + +if ( $olddesc == "" && $description != "" ){ + echo "DESCR neu anlegen<br>"; + # hier noch Syntaxcheck + $entry2['description'] = $description; + $result = ldap_mod_add($ds,$auDN,$entry2); + if($result){ + $mesg = "AU Beschreibung erfolgreich eingetragen<br><br>"; + } + else{ + $mesg = "Fehler beim eintragen der AU Beschreibung<br><br>"; + } +} + +if ( $olddesc != "" && $description != "" && $olddesc != $description ){ + echo "DESCR aendern<br>"; + # hier noch Syntaxcheck + $entry2['description'] = $description; + $result = ldap_mod_replace($ds,$auDN,$entry2); + if($result){ + $mesg = "AU Beschreibung erfolgreich geandert<br><br>"; + } + else{ + $mesg = "Fehler beim aendern der AU Beschreibung<br><br>"; + } +} + +if ( $olddesc != "" && $description == "" ){ + echo "DESCR loeschen<br>"; + # hier noch Syntaxcheck + $entry2['description'] = $olddesc; + $result = ldap_mod_del($ds,$auDN,$entry2); + if($result){ + $mesg = "AU Beschreibung erfolgreich geloescht<br><br>"; + } + else{ + $mesg = "Fehler beim loeschen der AU Beschreibung<br><br>"; + } +} + +else{ + $mesg = "keine Aenderung<br>"; +} + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='au_show.php' style='publink'>back</a>"; +redirect(2, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body></html>"; + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/au_childs.php b/ldap-site-mngmt/webinterface/au/au_childs.php new file mode 100644 index 00000000..fe91a5c5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/au_childs.php @@ -0,0 +1,51 @@ +<?php + +include('../standard_header.inc.php'); +include("../class.FastTemplate.php"); + +# Filename of Template +$webseite = "au_childs.dwt"; + +include('au_header.inc.php'); + + +############################################################################### +# Menus + +$mnr = 2; +$sbmnr = -1; + +createMainMenu($rollen, $mainnr); +createAUMenu($rollen, $mnr, $auDN, $sbmnr); + + +############################################################################### +# Mainpage Data + +$template->assign(array("CHILDOU" => "Noch keine untergordnete AU angelegt", + "CHILDCN" => "", + "CHILDDN" => "", + "CHILDDOMAIN" => "", + "CHILDDESC" => "")); + +$childau_array = get_childau($auDN,array("dn","cn","ou","associateddomain","description","maxipblock")); + +$template->define_dynamic("Childaus", "Webseite"); + +foreach ($childau_array as $childau){ + $template->assign(array("CHILDOU" => $childau['ou'], + "CHILDCN" => $childau['cn'], + "CHILDDN" => $childau['dn'], + "CHILDDOMAIN" => $childau['associateddomain'], + "CHILDDESC" => $childau['description'], + "AUDN" => $auDN)); + $template->parse("CHILDAUS_LIST", ".Childaus"); +} + + +################################################################################### +# Footer + +include("au_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/au_footer.inc.php b/ldap-site-mngmt/webinterface/au/au_footer.inc.php new file mode 100644 index 00000000..311721c5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/au_footer.inc.php @@ -0,0 +1,18 @@ +<?php + +$template->assign(array("PFAD" => $START_PATH)); + +# Daten in die Vorlage parsen +$template->parse("LOGIN", "Login"); +$template->parse("MAINMENU", "Mmenu"); +$template->parse("NAVIGATION", "Menu"); +$template->parse("HAUPTFENSTER", "Webseite"); +$template->parse("PAGE", "Vorlage"); + +# Fertige Seite an den Browser senden +$template->FastPrint("PAGE"); + +# Abmelden vom LDAP +ldap_unbind($ds); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/au_header.inc.php b/ldap-site-mngmt/webinterface/au/au_header.inc.php new file mode 100644 index 00000000..3ba68fc9 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/au_header.inc.php @@ -0,0 +1,33 @@ +<?php + +# standard header file for AU files + +include("au_menu.php"); +# 1. Title +$titel = "Administrative Unit Management"; +# 2. Mainmenu Number (starting with 0) +$mainnr = 0; + + +$template = new FastTemplate("."); +# dem erstellten Template-Objekt eine Vorlage zuweisen +$definedTemplates = array("Vorlage" => "au.dwt", + "Login" => "../logout_form.inc.dwt", + "Mmenu" => "../hauptmenue.dwt", + "Menu" => "menu.dwt", + "Webseite" => $webseite); + +if (isset($additionalTemplates)) { + foreach ($additionalTemplates as $templateKey => $templateFile) { + $definedTemplates[$templateKey] = $templateFile; + } +} + +$template->define($definedTemplates); +$template->assign(array("SEITENTITEL" => $titel, + "ROLLE" => "mainadmin", + "AU" => $au_ou, + "DOMAIN" => $assocdom, + "USERCN" => $usercn)); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/au_menu.php b/ldap-site-mngmt/webinterface/au/au_menu.php new file mode 100644 index 00000000..3142c015 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/au_menu.php @@ -0,0 +1,198 @@ +<?php + +function createAUMenu($rollen, $mnr, $auDN,$sbmnr) { + + global $template, $ds, $suffix, $START_PATH; + + # Mainmenu + $hauptmenu = array(array("link" => "au.php", + "text" => "Übersicht", + "zugriff" => "alle"), + array("link" => "au_show.php", + "text" => "Eigene AU", + "zugriff" => array("MainAdmin")), + array("link" => "au_childs.php", + "text" => "Untergeordnete AUs", + "zugriff" => array("MainAdmin")), + array("link" => "new_child.php", + "text" => "Neue untergeordnete AU", + "zugriff" => array("MainAdmin"))); + #echo "hauptmenu: ";print_r($hauptmenu);echo "<br><br>"; + # Submenu + $array = array(); + $childau_array = get_childau($auDN,array("dn","cn","ou")); + #echo "childau_array: ";print_r($childau_array);echo "<br><br>"; + if (count($childau_array)!= 0){ + for ($n=0;$n<count($childau_array);$n++) { + $array[] = array("link" => "child_au.php?dn=".$childau_array[$n]['dn']."&sbmnr=".$n, + "text" => $childau_array[$n]['ou'], + "zugriff" => array("MainAdmin")); + } + } + $submenu = array(array(), + array(), + $array, + array()); + #echo "submenu: ";print_r($submenu);echo "<br><br>"; + # Zusammenstellen der Menuleiste + $template->define_dynamic("Hauptmenu", "Menu"); + $template->define_dynamic("Submenu", "Menu"); + + $i=0; + $maxmenu = count($hauptmenu); + + foreach ($hauptmenu as $item) { + $template->clear_parse("SUBMENU_LIST"); + #echo "item: "; print_r($item); echo "<br>"; + if ($item['zugriff'] === "alle" || vergleicheArrays($rollen , $item['zugriff'])) { + $subempty = 0; + $j=0; + $maxsub = count($submenu[$mnr]); + #echo "maxsub: "; print_r($maxsub); echo "<br>"; + if ($maxsub > 0) { + foreach ($submenu[$mnr] as $item2) { + #echo "item2: "; print_r($item2); echo "<br>"; + if ($item2['zugriff'] === "alle" || vergleicheArrays($rollen, $item2['zugriff'])) { + if ($i != $mnr) { + $template->assign(array("SUB" => "")); + #"LINK_S" => "", + #"TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + else { + if ($j==0) { + if ($sbmnr==0) { + if ($maxsub == 1) {$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else { + if ($maxsub == 1) {$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($sbmnr==$j) { + if ($maxsub == $j+1) {$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if ($maxsub == $j+1) {$zwisch="branchbottom2";} + else {$zwisch="branch2";} + # if ($lastaktive) {$zwisch="branch";} + # else {$zwisch="branch";} + $lastaktive=false; + } + } + $htmlcode= " + <tr height='4'> + <td></td><td align='right'><img src='../pics/line2.gif' height='4'></td><td></td><td></td> + </tr> + <tr> + <td width='8%'> </td> + <td width='8%' align='right'><img src='../pics/".$zwisch.".gif'></td> + <td width='74%' align='left' style='border-width:1 1 1 1;border-color:#000000;border-style:solid;padding:2;padding-left:30px;background-color:{FARBE_S}'> + <a href='".$item2['link']."' style='text-decoration:none'><b class='standard_schrift'>".$item2['text']."</b></a></td> + <td width='10%'> </td> + </tr>"; + + $template->assign(array("SUB" => $htmlcode)); + $template->assign(array("FARBE_S" => $farb)); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + } + else { + $subempty++; + } + $j=$j+1; + } + } + if ($subempty == count($submenu[$mnr])) { + $template->assign(array("SUB" => "")); + #"LINK_S" => "", + #"TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + + if ($i==0) { + if ($mnr==0) { + if (count($submenu[$i][0]) != 0) { + if ($maxmenu == 1) {$zwisch="";} # {$zwisch="<img style='border-width:0;border-style=none;' src='../pics/minus2.gif'>";} + else {$zwisch="";} + } + else {$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else { + if (count($submenu[$i][0]) != 0) { + if ($maxmenu == 1) { + $zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>"; + } + else { + $zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>"; + } + } + else {$zwisch="";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($mnr==$i) { + if (count($submenu[$mnr][0]) != 0) { + if ($maxmenu == $i+1) {$zwisch="";} + else {$zwisch="";} + } + else {$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if (count($submenu[$i][0]) != 0) { + if ($maxmenu == $i+1) { + $zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>"; + } + else { + $zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>"; + } + } + else {$zwisch="";} + #if ($lastaktive) {$zwisch="";} + #else {$zwisch="";} + $lastaktive=false; + } + } + $template->assign(array("ICON" => $zwisch, + "FARBE" => $farb, + "LINK_M" => $item["link"], + "TEXT_M" => $item["text"])); + $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); + $template->clear_dynamic("Hauptmenu"); + } + $i=$i+1; + } + if ($lastaktive) { + $template->assign(array("ENDE" => "")); + } + else{ + $template->assign(array("ENDE" => "")); + } + +} + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/au_show.php b/ldap-site-mngmt/webinterface/au/au_show.php new file mode 100644 index 00000000..2f29a1db --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/au_show.php @@ -0,0 +1,74 @@ +<?php + +include('../standard_header.inc.php'); +include("../class.FastTemplate.php"); + +# Filename of Template +$webseite = "au_show.dwt"; + +include('au_header.inc.php'); + + +############################################################################### +# Menus + +$mnr = 1; +$sbmnr = -1; + +createMainMenu($rollen, $mainnr); +createAUMenu($rollen, $mnr, $auDN, $sbmnr); + + +############################################################################### +# MainpageData + +# Parent AU, Email MainAdmin +$exp = explode(',',$auDN); +$parentau = array_slice($exp, 1, 1); +$parentau = substr($parentau[0],3); + +if ( $parentau != "RIPM"){ + $length = count($exp); + $out = array_slice($exp, 1, $length -1); + $parentauDN = implode(',',$out); + $rol = get_roles($parentauDN); + $mainadminDN = $rol['MainAdmin'][0]; + $emailMA = get_user_data($mainadminDN, array("mail")); + $emailCODE = "<a href'mailto:".$emailMA['mail']."' class='maillink' style='text-decoration:none'>".$emailMA['mail']."</a>"; +} + +$template->assign(array("OU" => $au_ou, + "CN" => $au_cn, + "DSC" => $au_desc, + "AUDN" => $auDN, + "PARENTAU" => $parentau, + "EMAILMA" => $emailCODE)); + +# MaxIPBlocks +$mipb = $au_mipb; +$mipbs = ""; +if (count($mipb) > 1) { + for ($i=0; $i < count($mipb) - 1; $i++) { + $exp = explode('_',$mipb[$i]); + $mipbs .= "$exp[0] - $exp[1]<br>"; + } + $exp = explode('_',$mipb[$i]); + $mipbs .= "$exp[0] - $exp[1]"; + $template->assign(array("MIPBS" => $mipbs)); +} +elseif (count($mipb) == 1) { + $exp = explode('_',$mipb); + $mipbs .= "$exp[0] - $exp[1]"; + $template->assign(array("MIPBS" => $mipbs)); +} +else { + $template->assign(array("MIPBS" => $mipbs)); +} + + +############################################################################### +# Footer + +include("au_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/child_au.php b/ldap-site-mngmt/webinterface/au/child_au.php new file mode 100644 index 00000000..bd8f1ebc --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/child_au.php @@ -0,0 +1,70 @@ +<?php + +include('../standard_header.inc.php'); +include("../class.FastTemplate.php"); + +# Filename of Template +$webseite = "child_au.dwt"; + +include('au_header.inc.php'); + + +############################################################################### +# Menus + +$mnr = 2; +$sbmnr = -1; + +$sbmnr = $_GET['sbmnr']; + +createMainMenu($rollen, $mainnr); +createAUMenu($rollen, $mnr, $auDN, $sbmnr); + + +############################################################################### +# MainPage Data + +$childauDN = $_GET['dn']; + +$childau = get_au_data($childauDN,array("dn","cn","ou","associateddomain","description","maxipblock")); +#print_r($childau); + +$domprefix = str_replace('.uni-freiburg.de','',$childau[0]['associateddomain']); +#print_r($domprefix); + +$template->assign(array("CHILDOU" => $childau[0]['ou'], + "CHILDCN" => $childau[0]['cn'], + "CHILDDN" => $childauDN, + "CHILDDOMAIN" => $domprefix, + "CHILDDESC" => $childau[0]['description'], + "AUDN" => $auDN, + "SBMNR" => $sbmnr)); + +# MaxIPBlocks +$mipb = $childau[0]['maxipblock']; +$mipbs = ""; +if (count($mipb) > 1){ + for ($i=0; $i < count($mipb) - 1; $i++){ + $exp = explode('_',$mipb[$i]); + $mipbs .= "$exp[0] - $exp[1]<br>"; + } + $exp = explode('_',$mipb[$i]); + $mipbs .= "$exp[0] - $exp[1]"; + $template->assign(array("MIPBS" => $mipbs)); +} +elseif(count($mipb) == 1){ + $exp = explode('_',$mipb); + $mipbs .= "$exp[0] - $exp[1]"; + $template->assign(array("MIPBS" => $mipbs)); +} +else{ + $template->assign(array("MIPBS" => $mipbs)); +} + + +############################################################################### +# Footer + +include("au_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/childau_add.php b/ldap-site-mngmt/webinterface/au/childau_add.php new file mode 100644 index 00000000..89969882 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/childau_add.php @@ -0,0 +1,144 @@ +<?php + +include('../standard_header.inc.php'); + +# $_POST form variables +$childou = $_POST['childou']; +$childcn = $_POST['childcn']; +$childdesc = $_POST['childdesc']; +$childdomain = $_POST['childdomain']; +$mainadmin = $_POST['adduser']; +$hosts = $_POST['addhost']; + +$childou = htmlentities($childou); +$childcn = htmlentities($childcn); +$childdesc = htmlentities($childdesc); +$childdomainfull = htmlentities($childdomain).".".$domsuffix ; + +/* +echo "AU dn:"; print_r($auDN); echo "<br>"; +echo "ou:"; print_r($childou); echo "<br>"; +echo "cn:"; print_r($childcn); echo "<br>"; +echo "desc:"; print_r($childdesc); echo "<br>"; +echo "domain:"; print_r($childdomainfull); echo "<br>"; +echo "mainadmin:"; print_r($mainadmin); echo "<br><br>"; +echo "hosts:"; print_r($hosts); echo "<br><br>"; +*/ + +$seconds = 2; +# $url = 'new_child.php?ou='.$childou.'&cn='.$get_childcn.'&desc='.$get_childdesc.'&childdomain='.$childdomain; + +echo " + <html> + <head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> + </head> + <body> + <table border='0' cellpadding='30' cellspacing='0'> + <tr><td>"; + +if ( $childou != "" && $mainadmin != none && $mainadmin != "") { + + # Formulareingaben anpassen + $expou = explode(" ",$childou); + foreach ($expou as $word) {$expuc[] = ucfirst($word);} + $childou = implode(" ",$expuc); + $childou = preg_replace ( '/\s+([0-9A-Z])/', '$1', $childou); + + # AU Objekt anlegen + $sisters = get_childau($auDN,array("ou")); + $sister = 0; + foreach ($sisters as $item) { + if ($item['ou'] == $childou) { + $mesg = "Es existiert bereits eine untergeordnete AU mit dem eingegebenen OU!<br> + Bitte geben Sie einen anderen OU ein.<br><br>"; + $get_childcn = str_replace ( " ", "_", $childcn ); + $get_childdesc = str_replace ( " ", "_", $childdesc ); + $url = "new_child.php?ou=Hier_andere_OU_eingeben&cn=".$get_childcn."&desc=".$get_childdesc."&childdomain=".$childdomain; + $sister = 1; + break; + } + } + if ($sister == 0) { + + $childDN = "ou=".$childou.",".$auDN; + if (new_childau($childDN,$childou,$childcn,$childdesc,$mainadmin)) { + + # Objekete verschieben + $i = array_search('none',$hosts); + #print_r($i); echo "<br>"; + if ($i === 0 ) {array_splice($hosts, $i, 1);} + #print_r($hosts ); echo "<br>"; + + if (count($hosts) != 0) { + foreach ($hosts as $host) { + $exp = explode('_',$host); + $hostDN = $exp[0]; + $hostname = $exp[1]; + print_r($hostDN); echo "<br>"; + print_r($hostname); echo "<br><br>"; + # IP Adresse nicht verschieben (IPs werden später delegiert) + $hoip = get_node_data($hostDN, array("ipaddress")); + # print_r($hoip); echo "<br>"; + if ($hoip['ipaddress'] != "") { + delete_ip_host($hostDN,$auDN); + } + if (move_subtree($hostDN, "hostname=".$hostname.",cn=computers,".$childDN)) { + # bestimmte Attribute loeschen ... + $newhostDN = "hostname=".$hostname.",cn=computers,".$childDN; + $dhcp = get_node_data($newhostDN, array("dhcphlpcont")); + # print_r($dhcp); echo "<br>"; + if ($dhcp['dhcphlpcont'] != "") { + $entrydel ['dhcphlpcont'] = array(); + #$entrydel ['objectclass'] = "dhcpHost"; + # print_r($dhcphlpcont); + ldap_mod_del($ds, "hostname=".$hostname.",cn=computers,".$childDN, $entrydel); + } + } + } + } + + # Domain anlegen falls erforderlich + if (new_child_domain($childdomain, $childDN, $assocdom, $domDN)) { + $mesg .= "<br>AU Domain erfolgreich eingetragen<br>"; + } + else { + $mesg .= "<br>Fehler beim eintragen der AU Domain<br>"; + } + + $mesg .= "<br>Untergeordnete AU erfolgreich angelegt<br>"; + } + else { + $mesg .= "<br>Fehler beim anlegen der untergeordneten AU<br>"; + } + + $url = 'au_childs.php'; + } +} + + +elseif ( $childou == "") { + $get_childcn = str_replace ( " ", "_", $childcn ); + $get_childdesc = str_replace ( " ", "_", $childdesc ); + $mesg = "Sie haben den OU der neuen AU nicht angegeben. Dieser ist aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "new_child.php?ou=Hier_OU_eingeben&cn=".$get_childcn."&desc=".$get_childdesc."&childdomain=".$childdomain; +} + +elseif ($mainadmin == "none" || $mainadmin == "") { + $get_childcn = str_replace ( " ", "_", $childcn ); + $get_childdesc = str_replace ( " ", "_", $childdesc ); + $mesg = "Sie haben keinen MainAdmin für die neue AU gewählt.<br> + Bitte wählen Sie einen MainAdmin.<br><br>"; + $url = 'new_child.php?ou='.$childou.'&cn='.$get_childcn.'&desc='.$get_childdesc.'&childdomain='.$childdomain; +} + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body></html>"; + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/childau_change.php b/ldap-site-mngmt/webinterface/au/childau_change.php new file mode 100644 index 00000000..2406b4c2 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/childau_change.php @@ -0,0 +1,157 @@ +<?php + +include('../standard_header.inc.php'); + +$childcn = $_POST['childcn']; +$oldchildcn = $_POST['oldchildcn']; +$childou = $_POST['childou']; +$oldchildou = $_POST['oldchildou']; +$childdomain = $_POST['childdomain']; +$oldchilddomain = $_POST['oldchilddomain']; +$childDN = $_POST['childdn']; +$submenu = $_POST['submenu']; + +$childcn = htmlentities($childcn); +$oldchildcn = htmlentities($oldchildcn); +$childou = htmlentities($childou); +$oldchildou = htmlentities($oldchildou); +$childdomainfull = htmlentities($childdomain).".".$domsuffix ; +$oldchilddomainfull = htmlentities($oldchilddomain).".".$domsuffix; + +/* +echo "new ou:"; print_r($childou); echo "<br>"; +echo "old ou:"; print_r($oldchildou); echo "<br>"; +echo "new cn:"; print_r($childcn); echo "<br>"; +echo "old cn:"; print_r($oldchildcn); echo "<br>"; +echo "new domain:"; print_r($childdomain); echo "<br>"; +echo "old domain:"; print_r($oldchilddomain); echo "<br><br>"; +echo "child DN:"; print_r($childDN); echo "<br>"; +echo "new child DN:"; print_r($newchildDN); echo "<br>"; +echo "submenuNR:"; print_r($submenu); echo "<br><br>"; +*/ + +$seconds = 2; +$url = 'child_au.php?dn='.$childDN.'&sbmnr='.$submenu; + +echo " + <html> + <head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> + </head> + <body> + <table border='0' cellpadding='30' cellspacing='0'> + <tr><td>"; + +####################################### +# CN + +if ($oldchildcn == $childcn) { + #$mesg = "keine Aenderung<br>"; +} + +if ($oldchildcn == "" && $childcn != "") { + echo "CN neu anlegen<br>"; + # hier noch Syntaxcheck + $entry['cn'] = $childcn; + $result = ldap_mod_add($ds,$childDN,$entry); + if ($result) { + $mesg = "AU Name erfolgreich eingetragen<br><br>"; + } + else { + $mesg = "Fehler beim eintragen des AU Namen<br><br>"; + } +} + +if ($oldchildcn != "" && $childcn != "" && $oldchildcn != $childcn) { + echo "CN aendern<br>"; + # hier noch Syntaxcheck + $entry['cn'] = $childcn; + $result = ldap_mod_replace($ds,$childDN,$entry); + if ($result) { + $mesg = "AU Name erfolgreich geaendert<br><br>"; + } + else { + $mesg = "Fehler beim aendern des AU Namen<br><br>"; + } +} + +if ($oldchildcn != "" && $childcn == "") { + echo "CN loeschen<br>"; + # hier noch Syntaxcheck + $entry['cn'] = $oldchildcn; + $result = ldap_mod_del($ds,$childDN,$entry); + if ($result) { + $mesg = "AU Name erfolgreich geloescht<br><br>"; + } + else { + $mesg = "Fehler beim loeschen des AU Namen<br><br>"; + } +} + +####################################### +# OU + +if ($oldchildou == $childou) { + #$mesg = "keine Aenderung<br>"; +} + +if ($oldchildou != "" && $childou != "" && $oldchildou != $childou) { + echo "OU aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $expou = explode(" ",$childou); + foreach ($expou as $word) {$expuc[] = ucfirst($word);} + $childou = implode(" ",$expuc); + $childou = preg_replace ( '/\s+([0-9A-Z])/', '$1', $childou); + + $newchildDN = "ou=".$childou.",".$auDN; + modify_au_dn($childDN, $newchildDN); + + $url = 'au_childs.php'; +} + +if ($oldchildou != "" && $childou == "") { + echo "OU loeschen<br>"; + echo "Sie sind dabei einen Teil des DN zu loeschen.<br> + Dies geht nur, wenn Sie den gesamten Eintrag loeschen. <br> + Verwenden Sie dazu das Formular unten"; +} + +######################################## +# DOMAIN +if ($oldchilddomain == $domprefix && ($childdomain == "" || $childdomain == $domprefix)) { + #$mesg = "keine Aenderung<br>"; +} +if ($oldchilddomain == $childdomain) { + #$mesg = "keine Aenderung<br>"; +} + + +if ($oldchilddomain != "" && $childdomain != "" && $oldchilddomain != $childdomain && $childdomain != $domprefix) { + echo "Domain aendern<br>"; + # hier noch Syntaxcheck + if (change_child_domain($childdomain, $oldchilddomain, $childDN, $assocdom, $domDN, $domprefix)) { + $mesg = "Domain erfolgreich geandert<br><br>"; + } + else { + $mesg = "Fehler beim aendern der Domain<br><br>"; + } +} + + +if ($oldchilddomain != "" && $oldchilddomain != $domprefix && ($childdomain == "" || $childdomain == $domprefix)) { + echo "Domain loeschen bzw. integrieren<br><br>"; + $delmodus = "integrate"; + delete_child_domain($oldchilddomain,$assocdom,$childDN, $domDN, $delmodus); + $seconds = 5; +} + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body></html>"; + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/childau_delete.php b/ldap-site-mngmt/webinterface/au/childau_delete.php new file mode 100644 index 00000000..f9bd75d7 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/childau_delete.php @@ -0,0 +1,34 @@ +<?php + +include('../standard_header.inc.php'); + +# $_POST form variables +$delmodus = $_POST['delmodus']; +$childDN = $_POST['childdn']; +$childou = $_POST['childou']; +$oldchilddomain = $_POST['oldchilddomain']; +#print_r($childDN); echo "<br>"; +#print_r($oldchilddomain); echo "<br>"; +#print_r($entrydel); echo "<br>"; + +$url = 'au_childs.php'; + +echo " + <html> + <head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> + </head> + <body> + <table border='0' cellpadding='30' cellspacing='0'> + <tr><td>"; + +$mesg = delete_childau($childDN,$childou,$delmodus); + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect(2, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body></html>"; + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/dom_delete.php b/ldap-site-mngmt/webinterface/au/dom_delete.php new file mode 100644 index 00000000..b8c664b4 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/dom_delete.php @@ -0,0 +1,31 @@ +<?php + +include('../standard_header.inc.php'); + +# $_POST form variables +$delmodus = $_POST['delmodus']; +$oldchilddomain = $_POST['oldchilddomain']; +$childDN = $_POST['childdn']; +$submenu = $_POST['submenu']; + +$url = 'child_au.php?dn='.$childDN.'&sbmnr='.$submenu; + +echo " + <html> + <head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> + </head> + <body> + <table border='0' cellpadding='30' cellspacing='0'> + <tr><td>"; + +$mesg = delete_childau_domain($oldchilddomain,$childDN,$delmodus); + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect(2, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body></html>"; + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/au/new_child.php b/ldap-site-mngmt/webinterface/au/new_child.php new file mode 100644 index 00000000..4f8839b4 --- /dev/null +++ b/ldap-site-mngmt/webinterface/au/new_child.php @@ -0,0 +1,75 @@ +<?php + +include('../standard_header.inc.php'); +include("../class.FastTemplate.php"); + +# Filename of Template +$webseite = "new_child.dwt"; + +include('au_header.inc.php'); + + +############################################################################### +# Menus + +$mnr = 3; +$sbmnr = -1; + +createMainMenu($rollen, $mainnr); +createAUMenu($rollen, $mnr, $auDN, $sbmnr); + + +################################################################################ +# Mainpage Data + +$childou = str_replace ( "_", " ", $_GET['ou']); +$childcn = str_replace ( "_", " ", $_GET['cn']); +$childdesc = str_replace ( "_", " ", $_GET['desc']); +$childdomain = $_GET['childdomain']; + +$domprefix = str_replace('.uni-freiburg.de','',$childau[0]['associateddomain']); + +$template->assign(array("CHILDOU" => $childou, + "CHILDCN" => $childcn, + "CHILDDOMAIN" => $childdomain, + "CHILDDESC" => $childdesc, + "AUDN" => $auDN)); + + +####################################### +# Admin anlegen + +$users_array = get_users(); +#print_r($users_array); echo "<br><br>"; + +if (count($users_array) != 0) { + $template->define_dynamic("Users", "Webseite"); + foreach ($users_array as $item) { + $template->assign(array("UDN" => $item['dn'], + "USER" => $item['uid'])); + $template->parse("USERS_LIST", ".Users"); + } +} +else { + $template->assign(array("UDN" => "","USER" => "")); +} + +####################################### +# Objekte zum verschieben + +$host_array = get_hosts($auDN,array("dn","hostname")); +#print_r($host_array); +$template->define_dynamic("Hosts", "Webseite"); +foreach ($host_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HOSTNAME" => $item['hostname'], + "HOSTNUMBER" => 5)); + $template->parse("HOSTS_LIST", ".Hosts"); +} + +############################################################################### +# Footer + +include("au_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/class.FastTemplate.php b/ldap-site-mngmt/webinterface/class.FastTemplate.php new file mode 100644 index 00000000..d048ee5c --- /dev/null +++ b/ldap-site-mngmt/webinterface/class.FastTemplate.php @@ -0,0 +1,768 @@ +<? +################################################ +#### Angepasst an PHP4 von #### +#### Timothy Burk - Webdesign & PC-Service #### +#### info@tburk.com #### +################################################ +/* + CVS Revision. 1.1.0 +*/ + +/* + eine weitere kleine Anpassung von Thomas Nunninger betrifft das append in der + parse-Funktion. Bei error_reporting(E_ALL) erschien sonst beim ersten Anhängen + an eine noch nicht vorhandene Variable eine Fehlermeldung. +*/ + +class FastTemplate { + + var $FILELIST = array(); // Holds the array of filehandles + // FILELIST[HANDLE] == "fileName" + + var $DYNAMIC = array(); // Holds the array of dynamic + // blocks, and the fileHandles they + // live in. + + var $PARSEVARS = array(); // Holds the array of Variable + // handles. + // PARSEVARS[HANDLE] == "value" + + var $LOADED = array(); // We only want to load a template + // once - when it's used. + // LOADED[FILEHANDLE] == 1 if loaded + // undefined if not loaded yet. + + var $HANDLE = array(); // Holds the handle names assigned + // by a call to parse() + + var $ROOT = ""; // Holds path-to-templates + + var $WIN32 = false; // Set to true if this is a WIN32 server + + var $ERROR = ""; // Holds the last error message + + var $LAST = ""; // Holds the HANDLE to the last + // template parsed by parse() + + var $STRICT = true; // Strict template checking. + // Unresolved vars in templates will + // generate a warning when found. + +// ************************************************************ + + function FastTemplate ($pathToTemplates = "") + { + global $php_errormsg; + + if(!empty($pathToTemplates)) + { + $this->set_root($pathToTemplates); + } + + } // end (new) FastTemplate () + + +// ************************************************************ +// All templates will be loaded from this "root" directory +// Can be changed in mid-process by re-calling with a new +// value. + + function set_root ($root) + { + $trailer = substr($root,-1); + + if(!$this->WIN32) + { + if( (ord($trailer)) != 47 ) + { + $root = "$root".chr(47); + } + + if(is_dir($root)) + { + $this->ROOT = $root; + } + else + { + $this->ROOT = ""; + $this->error("Specified ROOT dir [$root] is not a directory"); + } + } + else + { + // WIN32 box - no testing + if( (ord($trailer)) != 92 ) + { + $root = "$root".chr(92); + } + $this->ROOT = $root; + } + + } // End set_root() + + +// ************************************************************** +// Calculates current microtime +// I throw this into all my classes for benchmarking purposes +// It's not used by anything in this class and can be removed +// if you don't need it. + + + function utime () + { + $time = explode( " ", microtime()); + $usec = (double)$time[0]; + $sec = (double)$time[1]; + return $sec + $usec; + } + +// ************************************************************** +// Strict template checking, if true sends warnings to STDOUT when +// parsing a template with undefined variable references +// Used for tracking down bugs-n-such. Use no_strict() to disable. + + function strict () + { + $this->STRICT = true; + } + +// ************************************************************ +// Silently discards (removes) undefined variable references +// found in templates + + function no_strict () + { + $this->STRICT = false; + } + +// ************************************************************ +// A quick check of the template file before reading it. +// This is -not- a reliable check, mostly due to inconsistencies +// in the way PHP determines if a file is readable. + + function is_safe ($filename) + { + if(!file_exists($filename)) + { + $this->error("[$filename] does not exist",0); + return false; + } + return true; + } + +// ************************************************************ +// Grabs a template from the root dir and +// reads it into a (potentially REALLY) big string + + function get_template ($template) + { + if(empty($this->ROOT)) + { + $this->error("Cannot open template. Root not valid.",1); + return false; + } + + $filename = "$this->ROOT"."$template"; + + $contents = implode("",(@file($filename))); + if( (!$contents) or (empty($contents)) ) + { + $this->error("get_template() failure: [$filename] $php_errormsg",1); + } + + return $contents; + + } // end get_template + +// ************************************************************ +// Prints the warnings for unresolved variable references +// in template files. Used if STRICT is true + + function show_unknowns ($Line) + { + $unknown = array(); + if (ereg("({[A-Z0-9_]+})",$Line,$unknown)) + { + $UnkVar = $unknown[1]; + if(!(empty($UnkVar))) + { + @error_log("[FastTemplate] Warning: no value found for variable: $UnkVar ",0); + } + } + } // end show_unknowns() + +// ************************************************************ +// This routine get's called by parse() and does the actual +// {VAR} to VALUE conversion within the template. + + function parse_template ($template, $tpl_array) + { + while ( list ($key,$val) = each ($tpl_array) ) + { + if (!(empty($key))) + { + if(gettype($val) != "string") + { + settype($val,"string"); + } + + $template = ereg_replace("\{$key}","$val","$template"); + //$template = str_replace("\{$key}","$val","$template"); + } + } + + if(!$this->STRICT) + { + // Silently remove anything not already found + + $template = ereg_replace("\{([A-Z0-9_]+)}","",$template); + } + else + { + // Warn about unresolved template variables + if (ereg("(\{[A-Z0-9_]+})",$template)) + { + $unknown = split("\n",$template); + while (list ($Element,$Line) = each($unknown) ) + { + $UnkVar = $Line; + if(!(empty($UnkVar))) + { + $this->show_unknowns($UnkVar); + } + } + } + } + return $template; + + } // end parse_template(); + +// ************************************************************ +// The meat of the whole class. The magic happens here. + + function parse ( $ReturnVar, $FileTags ) + { + $append = false; + $this->LAST = $ReturnVar; + $this->HANDLE[$ReturnVar] = 1; + + if (gettype($FileTags) == "array") + { + unset($this->$ReturnVar); // Clear any previous data + + while ( list ( $key , $val ) = each ( $FileTags ) ) + { + if ( (!isset($this->$val)) || (empty($this->$val)) ) + { + $this->LOADED["$val"] = 1; + if(isset($this->DYNAMIC["$val"])) + { + $this->parse_dynamic($val,$ReturnVar); + } + else + { + $fileName = $this->FILELIST["$val"]; + $this->$val = $this->get_template($fileName); + } + } + + // Array context implies overwrite + + $this->$ReturnVar = $this->parse_template($this->$val,$this->PARSEVARS); + + // For recursive calls. + + $this->assign( array( $ReturnVar => $this->$ReturnVar ) ); + + } + } // end if FileTags is array() + else + { + // FileTags is not an array + + $val = $FileTags; + + if( (substr($val,0,1)) == '.' ) + { + // Append this template to a previous ReturnVar + + $append = true; + $val = substr($val,1); + } + + if ( (!isset($this->$val)) || (empty($this->$val)) ) + { + $this->LOADED["$val"] = 1; + if(isset($this->DYNAMIC["$val"])) + { + $this->parse_dynamic($val,$ReturnVar); + } + else + { + $fileName = $this->FILELIST["$val"]; + $this->$val = $this->get_template($fileName); + } + } + + if($append) + { + // Thomas> auch hier append korrigiert + if (isset($this->$ReturnVar)) { + $this->$ReturnVar .= $this->parse_template($this->$val,$this->PARSEVARS); + } else { + $this->$ReturnVar = $this->parse_template($this->$val,$this->PARSEVARS); + } + } + else + { + $this->$ReturnVar = $this->parse_template($this->$val,$this->PARSEVARS); + } + + // For recursive calls. + + $this->assign(array( $ReturnVar => $this->$ReturnVar) ); + + } + return; + } // End parse() + + +// ************************************************************ + + function FastPrint ( $template = "" ) + { + if(empty($template)) + { + $template = $this->LAST; + } + + if( (!(isset($this->$template))) || (empty($this->$template)) ) + { + $this->error("Nothing parsed, nothing printed",0); + return; + } + else + { + print $this->$template; + } + return; + } + +// ************************************************************ + + function fetch ( $template = "" ) + { + if(empty($template)) + { + $template = $this->LAST; + } + if( (!(isset($this->$template))) || (empty($this->$template)) ) + { + $this->error("Nothing parsed, nothing printed",0); + return ""; + } + + return($this->$template); + } + + +// ************************************************************ + + function define_dynamic ($Macro, $ParentName) + { + // A dynamic block lives inside another template file. + // It will be stripped from the template when parsed + // and replaced with the {$Tag}. + + $this->DYNAMIC["$Macro"] = $ParentName; + return true; + } + +// ************************************************************ + + function parse_dynamic ($Macro,$MacroName) + { + // The file must already be in memory. + + $ParentTag = $this->DYNAMIC["$Macro"]; + // Thomas> in Folgezeile !isset($this->$ParentTag eingefügt + if( (!isset($this->$ParentTag) || !$this->$ParentTag) or (empty($this->$ParentTag)) ) + { + $fileName = $this->FILELIST[$ParentTag]; + $this->$ParentTag = $this->get_template($fileName); + $this->LOADED[$ParentTag] = 1; + } + if($this->$ParentTag) + { + $template = $this->$ParentTag; + $DataArray = split("\n",$template); + $newMacro = ""; + $newParent = ""; + $outside = true; + $start = false; + $end = false; + while ( list ($lineNum,$lineData) = each ($DataArray) ) + { + $lineTest = trim($lineData); + if("<!-- BEGIN DYNAMIC BLOCK: $Macro -->" == "$lineTest" ) + { + $start = true; + $end = false; + $outside = false; + } + if("<!-- END DYNAMIC BLOCK: $Macro -->" == "$lineTest" ) + { + $start = false; + $end = true; + $outside = true; + } + if( (!$outside) and (!$start) and (!$end) ) + { + $newMacro .= "$lineData\n"; // Restore linebreaks + } + if( ($outside) and (!$start) and (!$end) ) + { + $newParent .= "$lineData\n"; // Restore linebreaks + } + if($end) + { + $newParent .= "\{$MacroName}\n"; + } + // Next line please + if($end) { $end = false; } + if($start) { $start = false; } + } // end While + + $this->$Macro = $newMacro; + $this->$ParentTag = $newParent; + return true; + + } // $ParentTag NOT loaded - MAJOR oopsie + else + { + @error_log("ParentTag: [$ParentTag] not loaded!",0); + $this->error("ParentTag: [$ParentTag] not loaded!",0); + } + return false; + } + +// ************************************************************ +// Strips a DYNAMIC BLOCK from a template. + + function clear_dynamic ($Macro="") + { + if(empty($Macro)) { return false; } + + // The file must already be in memory. + + $ParentTag = $this->DYNAMIC["$Macro"]; + + if( (!$this->$ParentTag) or (empty($this->$ParentTag)) ) + { + $fileName = $this->FILELIST[$ParentTag]; + $this->$ParentTag = $this->get_template($fileName); + $this->LOADED[$ParentTag] = 1; + } + + if($this->$ParentTag) + { + $template = $this->$ParentTag; + $DataArray = split("\n",$template); + $newParent = ""; + $outside = true; + $start = false; + $end = false; + while ( list ($lineNum,$lineData) = each ($DataArray) ) + { + $lineTest = trim($lineData); + if("<!-- BEGIN DYNAMIC BLOCK: $Macro -->" == "$lineTest" ) + { + $start = true; + $end = false; + $outside = false; + } + if("<!-- END DYNAMIC BLOCK: $Macro -->" == "$lineTest" ) + { + $start = false; + $end = true; + $outside = true; + } + if( ($outside) and (!$start) and (!$end) ) + { + $newParent .= "$lineData\n"; // Restore linebreaks + } + // Next line please + if($end) { $end = false; } + if($start) { $start = false; } + } // end While + + $this->$ParentTag = $newParent; + return true; + + } // $ParentTag NOT loaded - MAJOR oopsie + else + { + @error_log("ParentTag: [$ParentTag] not loaded!",0); + $this->error("ParentTag: [$ParentTag] not loaded!",0); + } + return false; + } + + +// ************************************************************ + + function define ($fileList) + { + while ( list ($FileTag,$FileName) = each ($fileList) ) + { + $this->FILELIST["$FileTag"] = $FileName; + } + return true; + } + +// ************************************************************ + + function clear_parse ( $ReturnVar = "") + { + $this->clear($ReturnVar); + } + +// ************************************************************ + + function clear ( $ReturnVar = "" ) + { + // Clears out hash created by call to parse() + + if(!empty($ReturnVar)) + { + if( (gettype($ReturnVar)) != "array") + { + unset($this->$ReturnVar); + return; + } + else + { + while ( list ($key,$val) = each ($ReturnVar) ) + { + unset($this->$val); + } + return; + } + } + + // Empty - clear all of them + + while ( list ( $key,$val) = each ($this->HANDLE) ) + { + $KEY = $key; + unset($this->$KEY); + } + return; + + } // end clear() + +// ************************************************************ + + function clear_all () + { + $this->clear(); + $this->clear_assign(); + $this->clear_define(); + $this->clear_tpl(); + + return; + + } // end clear_all + +// ************************************************************ + + function clear_tpl ($fileHandle = "") + { + if(empty($this->LOADED)) + { + // Nothing loaded, nothing to clear + + return true; + } + if(empty($fileHandle)) + { + // Clear ALL fileHandles + + while ( list ($key, $val) = each ($this->LOADED) ) + { + unset($this->$key); + } + unset($this->LOADED); + + return true; + } + else + { + if( (gettype($fileHandle)) != "array") + { + if( (isset($this->$fileHandle)) || (!empty($this->$fileHandle)) ) + { + unset($this->LOADED[$fileHandle]); + unset($this->$fileHandle); + return true; + } + } + else + { + while ( list ($Key, $Val) = each ($fileHandle) ) + { + unset($this->LOADED[$Key]); + unset($this->$Key); + } + return true; + } + } + + return false; + + } // end clear_tpl + +// ************************************************************ + + function clear_define ( $FileTag = "" ) + { + if(empty($FileTag)) + { + unset($this->FILELIST); + return; + } + + if( (gettype($Files)) != "array") + { + unset($this->FILELIST[$FileTag]); + return; + } + else + { + while ( list ( $Tag, $Val) = each ($FileTag) ) + { + unset($this->FILELIST[$Tag]); + } + return; + } + } + +// ************************************************************ +// Aliased function - used for compatibility with CGI::FastTemplate + /* function clear_parse () + { + $this->clear_assign(); + } */ + +// ************************************************************ +// Clears all variables set by assign() + + function clear_assign () + { + if(!(empty($this->PARSEVARS))) + { + while(list($Ref,$Val) = each ($this->PARSEVARS) ) + { + unset($this->PARSEVARS["$Ref"]); + } + } + } + +// ************************************************************ + + function clear_href ($href) + { + if(!empty($href)) + { + if( (gettype($href)) != "array") + { + unset($this->PARSEVARS[$href]); + return; + } + else + { + while (list ($Ref,$val) = each ($href) ) + { + unset($this->PARSEVARS[$Ref]); + } + return; + } + } + else + { + // Empty - clear them all + + $this->clear_assign(); + } + return; + } + +// ************************************************************ + + function assign ($tpl_array, $trailer="") + { + if(gettype($tpl_array) == "array") + { + while ( list ($key,$val) = each ($tpl_array) ) + { + if (!(empty($key))) + { + // Empty values are allowed + // Empty Keys are NOT + + $this->PARSEVARS["$key"] = $val; + } + } + } + else + { + // Empty values are allowed in non-array context now. + if (!empty($tpl_array)) + { + $this->PARSEVARS["$tpl_array"] = $trailer; + } + } + } + +// ************************************************************ +// Return the value of an assigned variable. +// Christian Brandel cbrandel@gmx.de + + function get_assigned($tpl_name = "") + { + if(empty($tpl_name)) { return false; } + if(isset($this->PARSEVARS["$tpl_name"])) + { + return ($this->PARSEVARS["$tpl_name"]); + } + else + { + return false; + } + } + +// ************************************************************ + + function error ($errorMsg, $die = 0) + { + $this->ERROR = $errorMsg; + echo "ERROR: $this->ERROR <BR> \n"; + if ($die == 1) + { + exit; + } + + return; + + } // end error() + + +// ************************************************************ + + + +// ************************************************************ + +} // End class.FastTemplate.php3 + +?> diff --git a/ldap-site-mngmt/webinterface/hauptmenue.dwt b/ldap-site-mngmt/webinterface/hauptmenue.dwt new file mode 100644 index 00000000..8501041d --- /dev/null +++ b/ldap-site-mngmt/webinterface/hauptmenue.dwt @@ -0,0 +1,16 @@ +
+<table width='100%' height="25" border="0" cellspacing="0" cellpadding="5">
+<tr height="15"> +
+ <!-- BEGIN DYNAMIC BLOCK: Mainmenu -->
+ <td width='2'></td>
+ <td height="20" width="110" align="center" style="border-width:1 1 1 1;border-color:#000000;border-style:solid;background-color:{MFARBE}"> + <a href="{MLINK_M}" style="text-decoration:none"><b class="standard_schrift"> + {MTEXT_M}</b></a> + </td>
+ <!-- END DYNAMIC BLOCK: Mainmenu -->
+ <td> </td> +
+</tr>
+
+</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/home.dwt b/ldap-site-mngmt/webinterface/home.dwt new file mode 100644 index 00000000..4ffe69e9 --- /dev/null +++ b/ldap-site-mngmt/webinterface/home.dwt @@ -0,0 +1,91 @@ + + +<table cellpadding='0' cellspacing='0' border='0' width='95%' height='8%'> + <tr> + <td width='35%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top'> + <td width='1'></td> + <td><h2>Rechner und IP Management</h2></td> + </tr> + </table> + </td> + + <td width='40%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top' align='left'> + <td> + <h4><a href='start.php' class='headerlink'>Startseite</a> + >> </h4> + </td> + </tr> + </table> + </td> + <td width='25%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%' align='right'> + <tr valign='top' align='right'> + <td> + {LOGIN} + </td> + </tr> + </table> + </td> + </tr> +</table> + +<hr align='center' width='98%' noshade> + + + +<table cellpadding='5' cellspacing='0' border='0' width='100%' height='85%'> + + <tr valign='top' height='100%'> + <td width='95%'> + + <table border='0' cellpadding='10' cellspacing='0' width='100%'> + <tr> + <td colspan='6'><h3>Home - Alle AUs in denen Sie Administrator sind</h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td colspan='2'> + Sie sind in folgenden Administrativen Einheiten (AU) bzw. Abteilungen Administrator in einer + bestimmten Funktion (Rolle). Welche Rolle Sie in der jeweiligen AU haben entnehmen Sie bitte + der Tabelle.<br> + Um zu den Administrations-Seiten einer AU zu kommen, wählen Sie entsprechenden Link. + </td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='100%' style='border-width: 0 0 0 0;'> + <tr> + <td width='25%' colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Administrative Einheiten</b></td> + <td width='10%' colspan='4' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Rollen</b></td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Aus --> + <tr> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <a href='zwischen.php?audn={AUDN}&rollen={ROLLEN}' class='headerlink'>{AU}</a> </td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{AUDN} </td> + <td width='10%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{MA} </td> + <td width='10%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{HA} </td> + <td width='10%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{DA} </td> + <td width='10%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{ZA} </td> + </tr> + <!-- END DYNAMIC BLOCK: Aus --> + + </table> + </td> + </tr> + </table> + + </td> + </tr> +</table> + diff --git a/ldap-site-mngmt/webinterface/index.dwt b/ldap-site-mngmt/webinterface/index.dwt new file mode 100644 index 00000000..36fe2223 --- /dev/null +++ b/ldap-site-mngmt/webinterface/index.dwt @@ -0,0 +1,12 @@ +<html> + +<head> + <title>{SEITENTITEL}</title> + <link rel='stylesheet' href='styles.css' type='text/css'></head> +<body> + + {HAUPTFENSTER} + +</body> + +</html>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/index.php b/ldap-site-mngmt/webinterface/index.php new file mode 100644 index 00000000..32c2e4ce --- /dev/null +++ b/ldap-site-mngmt/webinterface/index.php @@ -0,0 +1,45 @@ +<?php +# Nach dem Logout wird die Session beim Aufruf der index.php zerstört. +if(isset($_POST['Logout'])) { + session_start(); + session_unregister('uid'); + session_unregister('userPassword'); + session_unregister('cn'); + session_unregister('dn'); + session_unregister('roles'); + session_unregister('au_dn'); + session_destroy(); +} + +#Pfad festlegen wo die Dateien sich befinden +include('standard_header.inc.php'); + +$titel = "Rechner und IP Management Startseite"; +$webseite = "start.dwt"; +# Einbinden der Template-Funktionen + +include("class.FastTemplate.php"); + +# neues Template-Objekt erstellen +$template = new FastTemplate("."); +# dem erstellten Template-Objekt eine Vorlage zuweisen +$template->define(array("Vorlage" => "index.dwt", + "Login" => "login_form.inc.html", + "Webseite" => $webseite)); + +$template->assign(array("SEITENTITEL" => $titel)); + +############################################################ + +# Daten in die Vorlage parsen +$template->assign(array("PFAD" => $START_PATH)); + +# $template->parse("MAINMENU", "Mmenu"); +# $template->parse("NAVIGATION", "Menu"); +$template->parse("LOGIN", "Login"); +$template->parse("HAUPTFENSTER", "Webseite"); +$template->parse("PAGE", "Vorlage"); + +# Fertige Seite an den Browser senden +$template->FastPrint("PAGE"); +?> diff --git a/ldap-site-mngmt/webinterface/login_sicher.php b/ldap-site-mngmt/webinterface/login_sicher.php new file mode 100644 index 00000000..3dd2af46 --- /dev/null +++ b/ldap-site-mngmt/webinterface/login_sicher.php @@ -0,0 +1,362 @@ +<?php +/** +* login_sicher.php führt einen Bind mit den eingegebenen Benutzerdaten durch. +* Dabei erfolgt die Authetifizierung entsprechend der Ausführung bei der Präsentation des Projektes +* am RZ-LDAP. Das Passwort des Users wird aber nun nicht mehr auf dem Gruppe1 LDAP gespeichert. Dort +* legt das Skript ein Standardpasswort an. +* Im Fehlerfall wird eine Meldung ausgegeben und anschließend auf index.php weitergeleitet. +* Bei erfolgreichem nicht anonymem Bind werden die Benutzerrechte ausgelesen und davon abhängig +* die entsprechende Startseite aufgerufen. dn, uid, userPassword, cn und die Rechte werden in +* einer Session gespeichert. +* +* DIESE VERSION IST AKTUELL IM EINSATZ!!!! +* +* @version V3.2 +* @author Timothy Burk +*/ +session_cache_expire(30); +session_start(); + +# LDAP-Bibliothek einbinden +include("lib/ldap.inc.php"); +# Standard-Bibliothek einbinden +include("lib/commonlib.inc.php"); + +$uid = $_POST['uid']; +$userPassword = $_POST['userPassword']; +# $userDn_rz = "uid=".$uid.",ou=people,".$suffix_rz; +$userDN = "uid=".$uid.",ou=people,".$suffix; + +#echo "uid: "; print_r($uid); echo "<br>"; +#echo "pw: "; print_r($userPassword); echo "<br>"; + +checkLogin($uid,$userPassword); + +/** +* checkLogin($uid, $userPassword) - Authentifizierung am RZ-LDAP und Gruppe1-LDAP +* +* Wenn RZ-LDAP-Login UND Gruppe1-LDAP-Login erfolgreich sind, dann ist der User +* bereits im Gruppe1-LDAP eingetragen. +* -> Mache Datenabgleich und anschließenden Login am Gruppe1-LDAP +* Wenn RZ-LDAP-Login erfolgreich, Gruppe1-LDAP-Login jedoch nicht erfolgreich ist, +* dann unterscheide zwischen zwei Möglichkeiten: +* 1. Der User ist im Gruppe1-LDAP nicht angelegt, +* 2. Der User ist im Gruppe1-LDAP zwar angelegt, aber das Passwort wurde auf dem RZ-LDAP inzwischen geändert. +* -> Login als Dummy und Check, ob UID vorhanden +* Wenn RZ-LDAP-Login nicht erfolgreich, Gruppe1-LDAP-Login jedoch erfolgreich ist, +* dann ist der User auf dem RZ-LDAP nicht gespeichert. +* -> Login am Gruppe1-LDAP +* In anderen Fällen waren die Zugangsdaten nicht korrekt. +* -> Redirect auf index.php. +* +* Schema siehe auch /home/gruppe1/Praesentation/Login und Personen.pps +* +* @param string UID +* @param string Password +* +* @see userLogin() +* @see datenabgleich() +* @see dummyUidCheck() +* @see userAnlegen() +* +* @author Timothy Burk +*/ +function checkLogin($uid = "", $userPassword = "") { + global $userDn_rz, $userDN, $suffix, $suffix_rz, $ldapError, $standardPassword; + # Abfrage, ob das Loginformular Daten enthält + if(!(($uid == "") || ($userPassword == ""))) { + # UID und Passwort wurden eingegeben + # Fallunterscheidung welche Logins möglich sind + /* if(($ds_rz = rzLdapConnect($uid,$userPassword)) && ($ds = uniLdapConnect($uid, $standardPassword))) { + # Wenn RZ-LDAP-Login UND Gruppe1-LDAP-Login erfolgreich sind, dann ist der User + # bereits im Gruppe1-LDAP eingetragen. + # -> Mache Datenabgleich und anschließenden Login am Gruppe1-LDAP + datenabgleich($uid, $userPassword, $ds_rz, $ds); + ldap_unbind($ds); + ldap_unbind($ds_rz); + $userPassword = $standardPassword; + userLogin($uid, $userPassword); + } else if(($ds_rz = rzLdapConnect($uid,$userPassword)) && !($ds = uniLdapConnect($uid, $standardPassword))) { + # Wenn RZ-LDAP-Login erfolgreich, Gruppe1-LDAP-Login jedoch nicht erfolgreich ist, + # dann unterscheide zwischen zwei Möglichkeiten: + # 1. Der User ist im Gruppe1-LDAP nicht angelegt, + # 2. Der User ist im Gruppe1-LDAP zwar angelegt, aber das Passwort wurde auf dem RZ-LDAP + # inzwischen geändert. + # -> Login als Dummy und Check, ob UID vorhanden + if(dummyUidCheck($uid)) { + #changePassword($uid,$userPassword); + $userPassword = $standardPassword; + } else { + userAnlegen($uid,$userPassword,$ds_rz); + } + ldap_unbind($ds_rz); + $userPassword = $standardPassword; + checkLogin($uid, $userPassword); + } else if(!($ds_rz = rzLdapConnect($uid,$userPassword)) && */ if ($ds = uniLdapConnect($uid,$userPassword)) { + # Wenn RZ-LDAP-Login nicht erfolgreich, Gruppe1-LDAP-Login jedoch erfolgreich ist, + # dann ist der User auf dem RZ-LDAP nicht gespeichert. + # -> Login am Gruppe1-LDAP + ldap_unbind($ds); + userLogin($uid, $userPassword); + } else { + # In anderen Fällen waren die Zugangsdaten nicht korrekt. + # -> Redirect auf index.php. + redirect(5, "index.php", "Bitte geben Sie korrekte Zugangsdaten ein.<br>".$ldapError, FALSE); + die; + } + + } else { + # UID und/oder Passwort wurden NICHT eingegeben + redirect(5, "index.php", "Bitte geben Sie User-Id und Passwort ein.<br>".$ldapError, FALSE); + die; + } +} + +/** +* dummyUidCheck($uid) - Überprüft, ob UID im Gruppe1-LPAD vorhanden ist. +* +* Über den Dummyuser wird eine Verbindung zum Gruppe1-LDAP aufgebaut und die angegebene +* UID wird gesucht. +* +* @param string UID +* +* @return boolean TRUE = UID vorhanden, FALSE = UID nicht gefunden +* +* @author Timothy Burk +*/ +function dummyUidCheck($uid) { + global $userDn, $suffix, $suffix_rz, $ldapError, $dummyUid, $dummyPassword; + # Bei Erfolg stellen wir eine Verbindung mit unserem LDAP her. Dazu nutzen wir den Dummy: + if(!($ds_dummy = uniLdapConnect($dummyUid, $dummyPassword))) { + redirect(5, "index.php", "Dummy-Login fehlgeschlagen!<br>".$ldapError, FALSE); + die; + } + # Im nächsten Schritt wird überprüft, ob ein Eintrag mit der UID $uid schon vorliegt: + if(!($person_daten = uniLdapSearch($ds_dummy, "ou=people,".$suffix, "uid=$uid", array("*"), "", "list", 0, 0))) { + redirect(5, "index.php", $ldapError, FALSE); + die; + } + if($person_daten['count'] == 0) { + # Eintrag ist nicht vorhanden. -> Anlegen + ldap_unbind($ds_dummy); + return FALSE; + } else { + ldap_unbind($ds_dummy); + return TRUE; + } +} + +/** +* userAnlegen($uid,$userPassword,$ds_rz) +* +* Legt mithilfe des Dummyusers einen noch nicht bei uns geführten User im Gruppe1-LDAP +* mit den Daten des Rechenzentrums an. Das Passwort ist dabei für alle User in der config.inc.php festgelegt. +* +* @param string UID +* @param string Password +* @param resource RZ-LDAP Directory Handle +* +* @author Timothy Burk +*/ +function userAnlegen($uid,$userPassword,$ds_rz) { + global $userDn_rz, $userDn, $suffix, $suffix_rz, $ldapError, $dummyUid, $dummyPassword, $standardPassword; + # Bei Erfolg stellen wir eine Verbindung mit unserem LDAP her. Dazu nutzen wir den Dummy: + if(!($ds_dummy = uniLdapConnect($dummyUid, $dummyPassword))) { + redirect(5, "index.php", "Dummy-Login fehlgeschlagen!<br>".$ldapError, FALSE); + die; + } + # Im nächsten Schritt wird überprüft, ob ein Eintrag mit der UID $uid schon vorliegt: + $ruffelder = array("uid", "sn", "givenname", "uidnumber", "gidnumber", "homedirectory", "loginshell", "rufnutzernummer", "rufanrede", "rufeinrichtung", "rufmatnr", "rufaccounttype", "ruffakultaet", "mail", "rufdienst"); + + if(!($person_daten = uniLdapSearch($ds_rz, "ou=people,".$suffix_rz, "uid=$uid", $ruffelder, "", "list", 0, 0))) { + redirect(5, "index.php", $ldapError, FALSE); + die; + } + $person_daten = ldapArraySauber($person_daten); + $person_daten = $person_daten[0]; + foreach($ruffelder as $ruffeld) { + $ruffeld = str_replace("ruf","",$ruffeld); + if($ruffeld == "accounttype") { + $gruppe1felder[] = "employeetype"; + } else if($ruffeld == "anrede") { + $gruppe1felder[] = "title"; + } else { + $gruppe1felder[] = $ruffeld; + } + } + $i = 0; + $neuerEintrag = array(); + foreach($gruppe1felder as $gruppe1feld) { + if (isset($person_daten[$ruffelder[$i]])) { + $neuerEintrag[$gruppe1feld] = $person_daten[$ruffelder[$i]]; + } else { + $neuerEintrag[$gruppe1feld] = ''; + } + $i++; + } + if($neuerEintrag['employeetype'] != "student") { + unset($neuerEintrag['employeetype']); + } else { + $neuerEintrag['employeetype'] = ucfirst($neuerEintrag['employeetype']); + } + $neuerEintrag['userPassword'] = $userPassword; + # Ermitteln der Initialen: Erster Buchstabe des Vornamens und erster Buchstabe des Nachnamens + $neuerEintrag['initials'] = substr($neuerEintrag['givenname'],0,1).".".substr($neuerEintrag['sn'],0,1)."."; + + # CN erstellen + $neuerEintrag['cn'] = $neuerEintrag['givenname']." ".$neuerEintrag['sn']; + + # Aktiv setzen + $neuerEintrag['aktiv'] = "yes"; + $neuerEintrag = inputArraySauber($neuerEintrag); + + # Festes Sicherungspasswort setzen + $neuerEintrag['userPassword'] = $standardPassword; + if(!($add = uniLdapAdd($ds_dummy, $userDn, $neuerEintrag, "personen"))) { + redirect(5, "index.php", "<b>Eintrag nicht erfolgreich</b><br>".$ldapError, FALSE); + die; + } +} + +/** +* datenabgleich($uid, $userPassword, $ds_rz, $ds) - Überschreibt bei jedem Login die Daten des +* Gruppe1-LDAP mit denen des RZ-LDAP mithilfe des Dummyusers. +* +* @param string UID +* @param string Password +* @param resource ds_rz RZ-LDAP Directory Handle +* @param resource ds Gruppe1-LDAP Directory Handle nach Bind mit Dummyuser +* +* @author Timothy Burk +*/ +function datenabgleich($uid, $userPassword, $ds_rz, $ds) { + global $userDn_rz, $userDn, $suffix, $suffix_rz, $ldapError, $dummyUid, $dummyPassword, $standardPassword; + # Bei Erfolg stellen wir eine Verbindung mit unserem LDAP her. Dazu nutzen wir den Dummy: + if(!($ds_dummy = uniLdapConnect($dummyUid, $dummyPassword))) { + redirect(5, "index.php", "Dummy-Login fehlgeschlagen!<br>".$ldapError, FALSE); + die; + } + # Im nächsten Schritt wird überprüft, ob ein Eintrag mit der UID $uid schon vorliegt: + $ruffelder = array("uid", "sn", "givenname", "uidnumber", "gidnumber", "homedirectory", "loginshell", "rufnutzernummer", "rufanrede", "rufeinrichtung", "rufmatnr", "rufaccounttype", "ruffakultaet", "mail", "rufdienst"); + + if(!($person_daten = uniLdapSearch($ds_rz, "ou=people,".$suffix_rz, "uid=$uid", $ruffelder, "", "list", 0, 0))) { + redirect(5, "index.php", $ldapError, FALSE); + die; + } + $person_daten = ldapArraySauber($person_daten); + $person_daten = $person_daten[0]; + foreach($ruffelder as $ruffeld) { + $ruffeld = str_replace("ruf","",$ruffeld); + if($ruffeld == "accounttype") { + $gruppe1felder[] = "employeetype"; + } else if($ruffeld == "anrede") { + $gruppe1felder[] = "title"; + } else { + $gruppe1felder[] = $ruffeld; + } + } + $i = 0; + $neuerEintrag = array(); + foreach($gruppe1felder as $gruppe1feld) { + if (isset($person_daten[$ruffelder[$i]])) { + $eintrag = $person_daten[$ruffelder[$i]]; + } else { + $eintrag = ''; + } + $neuerEintrag[$gruppe1feld] = $eintrag; //$person_daten[$ruffelder[$i]]; + $i++; + } + + if($neuerEintrag['employeetype'] != "student") { + unset($neuerEintrag['employeetype']); + } else { + $neuerEintrag['employeetype'] = ucfirst($neuerEintrag['employeetype']); + } + $neuerEintrag['userPassword'] = $userPassword; + # Ermitteln der Initialen: Erster Buchstabe des Vornamens und erster Buchstabe des Nachnamens + $neuerEintrag['initials'] = substr($neuerEintrag['givenname'],0,1).".".substr($neuerEintrag['sn'],0,1)."."; + + # CN erstellen + $neuerEintrag['cn'] = $neuerEintrag['givenname']." ".$neuerEintrag['sn']; + + # Aktiv setzen + $neuerEintrag['aktiv'] = "yes"; + $neuerEintrag = inputArraySauber($neuerEintrag); + + # Festes Sicherungspasswort setzen + $neuerEintrag['userPassword'] = $standardPassword; + + if(!($alteDaten = uniLdapSearch($ds_dummy, "ou=people,".$suffix, "uid=$uid", array("*"), "", "list", 0, 0))) { + redirect(5, "index.php", $ldapError, FALSE); + die; + } + + if(uniLdapModify($ds_dummy, $userDn, $alteDaten, $neuerEintrag, 0)) { + $meldung = "Daten abgeglichen"; + } + +} + +/** +* userLogin($uid, $userPassword) - Führt den Login am Gruppe1-LDAP durch. +* +* Nach erfolgreicher Identifikation und ggf. neuem Anlegen oder Datenabgleich wird +* mit userLogin() der Bind am Gruppe1-LDAP durchgeführt. +* Die Rechte und der CN des Users werden ausgelesen und in der Session gespeichert. +* Anschließend leitet das Skript auf die Startseite der Verwaltung (person_daten_show.php) weiter. +* +* @param string UID +* @param string Password +* +* @author Timothy Burk +*/ +function userLogin($uid, $userPassword) { + global $userDN, $suffix, $ldapError; + # Verbindung mit der Datenbank herstellen + if(($uid == "") || ($userPassword == "") || !($ds = uniLdapConnect($uid,$userPassword))) { + redirect(5, "index.php", "Falscher Login<br>".$ldapError, FALSE); + die; + } + + # cn abfragen + $cn = "Gast"; + if(!($person_daten = uniLdapSearch($ds, "ou=people,".$suffix, "uid=$uid", array("cn"), "", "list", 0, 0))) { + redirect(5, "index.php", $ldapError, FALSE); + die; + } else { + $cn = str_replace('\"', '', $person_daten[0]['cn'][0]); + } + + # Speichern der Sessionvariablen + $_SESSION['uid'] = $uid; + $_SESSION['userPassword'] = $userPassword; + $_SESSION['dn'] = $userDN; + $_SESSION['cn'] = $cn; + $_SESSION['audn'] = ""; + + # LDAP-Bind aufheben + ldap_unbind($ds); + + $mesg = "<html> + <head> + <title>AU Management</title> + <link rel='stylesheet' href='styles.css' type='text/css'> + </head> + <body> + <table border='0' cellpadding='30' cellspacing='0'> + <tr><td> + Bitte haben Sie einen Moment Geduld, die Seite wird geladen... <br> + Falls nicht, klicken Sie bitte <a href='start.php'>hier</a>. + </td></tr> + </table> + </body> + </html>"; + # Aufruf der Startseite: + redirect(0, "start.php", $mesg, TRUE); + + # nichtmehr benötigte CSV-Dateien im tmp-Verzeichnis löschen + # listen_sauber(); +} + + +?> diff --git a/ldap-site-mngmt/webinterface/logout_form.inc.dwt b/ldap-site-mngmt/webinterface/logout_form.inc.dwt new file mode 100644 index 00000000..96d4a552 --- /dev/null +++ b/ldap-site-mngmt/webinterface/logout_form.inc.dwt @@ -0,0 +1,9 @@ +<form action="{PFAD}index.php" method="post">
+ <table border="0" cellspacing="0" cellpadding="3">
+ <tr valign='top' align='right'>
+ <td><p class="small_loginform_text">Eingeloggt als: </td>
+ <td><b> {USERCN} </b></td>
+ <td><input type="Submit" name="Logout" value="Logout" class="small_loginform_button"></p></td>
+ </tr>
+ </table>
+</form>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/pics/arrow.png b/ldap-site-mngmt/webinterface/pics/arrow.png Binary files differnew file mode 100644 index 00000000..f65dbf64 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/arrow.png diff --git a/ldap-site-mngmt/webinterface/pics/branch.gif b/ldap-site-mngmt/webinterface/pics/branch.gif Binary files differnew file mode 100644 index 00000000..32e0f683 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/branch.gif diff --git a/ldap-site-mngmt/webinterface/pics/branch2.gif b/ldap-site-mngmt/webinterface/pics/branch2.gif Binary files differnew file mode 100644 index 00000000..a693647c --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/branch2.gif diff --git a/ldap-site-mngmt/webinterface/pics/branchbottom.gif b/ldap-site-mngmt/webinterface/pics/branchbottom.gif Binary files differnew file mode 100644 index 00000000..55ceb453 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/branchbottom.gif diff --git a/ldap-site-mngmt/webinterface/pics/branchbottom2.gif b/ldap-site-mngmt/webinterface/pics/branchbottom2.gif Binary files differnew file mode 100644 index 00000000..a27a9c4c --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/branchbottom2.gif diff --git a/ldap-site-mngmt/webinterface/pics/branchtop.gif b/ldap-site-mngmt/webinterface/pics/branchtop.gif Binary files differnew file mode 100644 index 00000000..f6bd127b --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/branchtop.gif diff --git a/ldap-site-mngmt/webinterface/pics/down.gif b/ldap-site-mngmt/webinterface/pics/down.gif Binary files differnew file mode 100644 index 00000000..51095d1c --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/down.gif diff --git a/ldap-site-mngmt/webinterface/pics/down2.gif b/ldap-site-mngmt/webinterface/pics/down2.gif Binary files differnew file mode 100644 index 00000000..4fb87681 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/down2.gif diff --git a/ldap-site-mngmt/webinterface/pics/folder-expanded.gif b/ldap-site-mngmt/webinterface/pics/folder-expanded.gif Binary files differnew file mode 100644 index 00000000..f779acc7 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/folder-expanded.gif diff --git a/ldap-site-mngmt/webinterface/pics/folder.gif b/ldap-site-mngmt/webinterface/pics/folder.gif Binary files differnew file mode 100644 index 00000000..842989f2 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/folder.gif diff --git a/ldap-site-mngmt/webinterface/pics/header.png b/ldap-site-mngmt/webinterface/pics/header.png Binary files differnew file mode 100644 index 00000000..7155aa01 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/header.png diff --git a/ldap-site-mngmt/webinterface/pics/header1.png b/ldap-site-mngmt/webinterface/pics/header1.png Binary files differnew file mode 100644 index 00000000..ccb676fb --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/header1.png diff --git a/ldap-site-mngmt/webinterface/pics/headerlayer.xcf b/ldap-site-mngmt/webinterface/pics/headerlayer.xcf Binary files differnew file mode 100644 index 00000000..b906128f --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/headerlayer.xcf diff --git a/ldap-site-mngmt/webinterface/pics/host.png b/ldap-site-mngmt/webinterface/pics/host.png Binary files differnew file mode 100644 index 00000000..5741243e --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/host.png diff --git a/ldap-site-mngmt/webinterface/pics/host1.png b/ldap-site-mngmt/webinterface/pics/host1.png Binary files differnew file mode 100644 index 00000000..6cc7079d --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/host1.png diff --git a/ldap-site-mngmt/webinterface/pics/hostfaulty.png b/ldap-site-mngmt/webinterface/pics/hostfaulty.png Binary files differnew file mode 100644 index 00000000..c011fb15 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/hostfaulty.png diff --git a/ldap-site-mngmt/webinterface/pics/hostfaulty1.png b/ldap-site-mngmt/webinterface/pics/hostfaulty1.png Binary files differnew file mode 100644 index 00000000..5c64ea02 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/hostfaulty1.png diff --git a/ldap-site-mngmt/webinterface/pics/hostnoboot.png b/ldap-site-mngmt/webinterface/pics/hostnoboot.png Binary files differnew file mode 100644 index 00000000..e5351514 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/hostnoboot.png diff --git a/ldap-site-mngmt/webinterface/pics/hostnoboot1.png b/ldap-site-mngmt/webinterface/pics/hostnoboot1.png Binary files differnew file mode 100644 index 00000000..4325a841 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/hostnoboot1.png diff --git a/ldap-site-mngmt/webinterface/pics/line.gif b/ldap-site-mngmt/webinterface/pics/line.gif Binary files differnew file mode 100644 index 00000000..a567ef9e --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/line.gif diff --git a/ldap-site-mngmt/webinterface/pics/line2.gif b/ldap-site-mngmt/webinterface/pics/line2.gif Binary files differnew file mode 100644 index 00000000..659e20fe --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/line2.gif diff --git a/ldap-site-mngmt/webinterface/pics/linebottom.gif b/ldap-site-mngmt/webinterface/pics/linebottom.gif Binary files differnew file mode 100644 index 00000000..a960f1ff --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/linebottom.gif diff --git a/ldap-site-mngmt/webinterface/pics/minus.gif b/ldap-site-mngmt/webinterface/pics/minus.gif Binary files differnew file mode 100644 index 00000000..a2bff127 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/minus.gif diff --git a/ldap-site-mngmt/webinterface/pics/minus2.gif b/ldap-site-mngmt/webinterface/pics/minus2.gif Binary files differnew file mode 100644 index 00000000..4f31339e --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/minus2.gif diff --git a/ldap-site-mngmt/webinterface/pics/minusbottom.gif b/ldap-site-mngmt/webinterface/pics/minusbottom.gif Binary files differnew file mode 100644 index 00000000..cc33192e --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/minusbottom.gif diff --git a/ldap-site-mngmt/webinterface/pics/minustop.gif b/ldap-site-mngmt/webinterface/pics/minustop.gif Binary files differnew file mode 100644 index 00000000..9e8fc36d --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/minustop.gif diff --git a/ldap-site-mngmt/webinterface/pics/plus.gif b/ldap-site-mngmt/webinterface/pics/plus.gif Binary files differnew file mode 100644 index 00000000..5bc24cfb --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/plus.gif diff --git a/ldap-site-mngmt/webinterface/pics/plus2.gif b/ldap-site-mngmt/webinterface/pics/plus2.gif Binary files differnew file mode 100644 index 00000000..1fee2d74 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/plus2.gif diff --git a/ldap-site-mngmt/webinterface/pics/plusbottom.gif b/ldap-site-mngmt/webinterface/pics/plusbottom.gif Binary files differnew file mode 100644 index 00000000..4aa0bde9 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/plusbottom.gif diff --git a/ldap-site-mngmt/webinterface/pics/plustop.gif b/ldap-site-mngmt/webinterface/pics/plustop.gif Binary files differnew file mode 100644 index 00000000..24e8a9ec --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/plustop.gif diff --git a/ldap-site-mngmt/webinterface/pics/up.gif b/ldap-site-mngmt/webinterface/pics/up.gif Binary files differnew file mode 100644 index 00000000..dfff04b4 --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/up.gif diff --git a/ldap-site-mngmt/webinterface/pics/up2.gif b/ldap-site-mngmt/webinterface/pics/up2.gif Binary files differnew file mode 100644 index 00000000..48ac4a4b --- /dev/null +++ b/ldap-site-mngmt/webinterface/pics/up2.gif diff --git a/ldap-site-mngmt/webinterface/standard_header.inc.php b/ldap-site-mngmt/webinterface/standard_header.inc.php new file mode 100644 index 00000000..62e51f9b --- /dev/null +++ b/ldap-site-mngmt/webinterface/standard_header.inc.php @@ -0,0 +1,65 @@ +<?php +session_cache_expire(30); +session_start(); + +include('lib/config.inc.php'); +include('lib/ldap.inc.php'); +include('lib/ldap2.inc.php'); +include('lib/commonlib.inc.php'); +include('syntax_check.php'); +include('lib/au_management_functions.php'); +include('lib/ip_management_functions.php'); +include('lib/host_management_functions.php'); +include('lib/dhcp_management_functions.php'); +include('lib/rbs_management_functions.php'); + + +$uid = $_SESSION['uid']; +$userPassword = $_SESSION['userPassword']; +$userDN = $_SESSION['dn']; +$usercn = $_SESSION['cn']; +$auDN = $_SESSION['audn']; +#echo "auDN: "; print_r($auDN); echo "<br>"; +$rollen = $_SESSION['rollen']; +#echo "rollen: "; print_r($rollen); echo "<br>"; + + +if (!($ds = uniLdapConnect($uid,$userPassword))){ + echo "<html> + <head> + <title>Rechner und IP Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> + </head> + <body> + <table border='0' cellpadding='30' cellspacing='0'> + <tr><td> + Es konnte keine Verbindung zum LDAP Server hergestellt werden! + </td></tr></table></body> + </html> + "; + die; +} + +# AU Daten holen +$attributes = array("ou","associateddomain","maxipblock","freeipblock","cn","description"); +$au_data = get_au_data($auDN,$attributes); +$assocdom = $au_data[0]['associateddomain']; +$au_ou = $au_data[0]['ou']; +$au_cn = $au_data[0]['cn']; +$au_desc = $au_data[0]['description']; +$au_mipb = $au_data[0]['maxipblock']; +$au_fipb = $au_data[0]['freeipblock']; + +# AU Domain Daten holen +$domain_data = get_domain_data($auDN,array("dn")); + +$expAuDn = explode(",",$auDN); +if ($expAuDn[1] == "ou=RIPM"){ + $domDN = "ou=DNS,".$suffix; +} +else{$domDN = $domain_data[0]['dn']; echo "<br>";} + +$domprefix = str_replace('.'.$domsuffix,'',$assocdom); +# print_r($domprefix); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/start.dwt b/ldap-site-mngmt/webinterface/start.dwt new file mode 100644 index 00000000..db7cf92c --- /dev/null +++ b/ldap-site-mngmt/webinterface/start.dwt @@ -0,0 +1,37 @@ + + +<hr align='center' width='98%' noshade> + +<table cellpadding='5' cellspacing='0' border='0' width='100%' height='20%'> + + <tr valign='middle' height='100%'> + <td width='100%' align='center'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td align='center'> + + <h1>Rechner und IP Managment</h1> + + </td></tr> + </table> + </td> + + </tr> +</table> + +<hr align='center' width='98%' noshade> + +<table cellpadding='5' cellspacing='0' border='0' width='100%' height='20%'> + + <tr valign='middle' height='100%'> + <td width='100%' align='center'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td align='center'> + + {LOGIN} + + </td></tr> + </table> + </td> + + </tr> +</table> diff --git a/ldap-site-mngmt/webinterface/start.php b/ldap-site-mngmt/webinterface/start.php new file mode 100644 index 00000000..f64005e5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/start.php @@ -0,0 +1,68 @@ +<?php + +#Pfad festlegen wo die Dateien sich befinden +include('standard_header.inc.php'); + +$titel = "Rechner und IP Management Startseite"; +$webseite = "home.dwt"; +# Einbinden der Template-Funktionen + +include("class.FastTemplate.php"); + +# neues Template-Objekt erstellen +$template = new FastTemplate("."); +# dem erstellten Template-Objekt eine Vorlage zuweisen +$template->define(array("Vorlage" => "index.dwt", + "Login" => "logout_form.inc.dwt", + "Webseite" => $webseite)); + +$template->assign(array("SEITENTITEL" => $titel,"USERCN" => $usercn)); + +############################################################ + +$template->define_dynamic("Aus", "Webseite"); +#$template->define_dynamic("Roles", "Webseite"); + +$roles = getRoles($ds, $userDN); +#print_r($roles); echo "<br><br>"; +foreach ($roles as $item){ + + $auDN = $item['au']; + $expDN = explode(',',$auDN); + $expOU = explode('=',$expDN[0]); + $au = $expOU[1]; + + $template->assign(array( "MA" => "", "HA" => "", "DA" => "", "ZA" => "")); + $template->assign(array( "AU" => $au, "AUDN" => $auDN, "ROLLEN" => implode('_',$item['role']))); + + foreach ($item['role'] as $role){ + if ($role == MainAdmin){ + $template->assign(array( "MA" => $role)); + } + if ($role == HostAdmin){ + $template->assign(array( "HA" => $role)); + } + if ($role == DhcpAdmin){ + $template->assign(array( "DA" => $role)); + } + if ($role == ZoneAdmin){ + $template->assign(array( "ZA" => $role)); + } + } + $template->parse("AUS_LIST", ".Aus"); + $template->clear_dynamic("Aus"); +} + + +############################################################# + +# Daten in die Vorlage parsen +$template->assign(array("PFAD" => $START_PATH)); + +$template->parse("LOGIN", "Login"); +$template->parse("HAUPTFENSTER", "Webseite"); +$template->parse("PAGE", "Vorlage"); + +# Fertige Seite an den Browser senden +$template->FastPrint("PAGE"); +?> diff --git a/ldap-site-mngmt/webinterface/styles.css b/ldap-site-mngmt/webinterface/styles.css new file mode 100644 index 00000000..f644f497 --- /dev/null +++ b/ldap-site-mngmt/webinterface/styles.css @@ -0,0 +1,311 @@ +p { + font-family: Arial; + font-size: 10pt; + color: #000000; +} +a:link { + color: #006BB6; + text-decoration:none; +} +a:visited { + color: #006BB6; + text-decoration:none; +} +a:hover { + color: #006BB6; + text-decoration:underline; +} +a:active { + color: #B9D9F0; + text-decoration:underline; +} +body { + font-family: Arial; + font-size: 10pt; + color: #000000; + background-color: #FFFFFF; + margin-top:0px; + margin-left:0px; +} +h1 { + font-family: Arial; + font-size: 25pt; + font-weight: bold; + color: #000000; +} +h2 { + font-family: Arial; + font-size: 15pt; + font-weight: bold; + color: #000000; +} +h3 { + font-family: Arial; + font-size: 12pt; + font-weight: bold; + color: #000000; +} +h4 { + font-family: Arial; + font-size: 10pt; + font-weight: bold; + color: #000000; +} +.font_object { + font-family: Arial; + font-weight: bold; + color: #505050; +} +.balken { + font-family: Arial; + font-size: 12pt; + font-weight: bold; + color: #FFFFFF; + background-color: #006BB6; +} +.balken_mit_pd { + font-family: Arial; + font-size: 12pt; + font-weight: bold; + color: #FFFFFF; + background-color: #006BB6; + padding: 5; +} +.balken_kl { + font-family: Arial; + font-size: 10pt; + color: #FFFFFF; + background-color: #006BB6; +} +.small_loginform_field { + font-family: Arial; + font-size: 8pt; + color: #000000; + border-style: solid; + border-width: 1px 1px; + border-color: #000000; + background-color: #C0C0C0; +} +.small_loginform_button { + font-family: Arial; + font-size: 8pt; + width: 60px; + color: #FFFFFF; + border-style: solid; + border-width: 1px 1px; + border-color: #000000; + background-color: #880000; +} +.small_loginform_text { + font-family: Arial; + font-size: 8pt; + color: #000000; +} +.small_form_selectbox { + font-family: Arial; + font-size: 10pt; + border-style: solid; + border-width: 1px 1px; + border-color: #000000; + width: 150; + padding-left: 10px; + margin: 5px; +} +.medium_form_field { + font-family: Arial; + font-size: 10pt; + color: #000000; + padding-left: 5px; + border-style: solid; + border-width: 1px 1px; + border-color: #000000; + background-color: #FFFFFF; + margin: 5px; +} +.medium_form_field_err { + font-family: Arial; + font-size: 10pt; + color: #000000; + border-style: solid; + border-width: 1px 1px; + border-color: #000000; + background-color: #FFFFFF; +} +.medium_form_button { + font-family: Arial; + font-size: 10pt; + color: #FFFFFF; + border-style: solid; + border-width: 1px 1px; + border-color: #000000; + background-color: #600000; + width: 50px; +} +.medium_form_text { + font-family: Arial; + font-size: 10pt; + color: #000000; +} +.medium_form_checkbox { + font-family: Arial; + font-size: 10pt; + border-style: solid; + border-width: 1px 1px; + border-color: #000000; +} +.medium_form_selectbox { + font-family: Arial; + font-size: 10pt; + border-style: solid; + border-width: 1px 1px; + border-color: #000000; + width: 300; + padding-left: 10px; + margin: 5px; +} +.rootfs_form_selectbox { + font-family: Arial; + font-size: 10pt; + border-style: solid; + border-width: 1px 1px; + border-color: #000000; + width: 200; + padding-left: 10px; + margin: 5px; +} +.large_form_selectbox { + font-family: Arial; + font-size: 10pt; + border-style: solid; + border-width: 1px 1px; + border-color: #000000; + width: 430; + padding-left: 10px; + margin: 5px; +} + +.tabellen_platzhalter{ + font-size: 0pt; +} +.standard_schrift { + font-family: Arial; + font-size: 10pt; + color: #FFFFFF; +} +.tabellenzeile_hell { + background-color: #E7F5FE; +} +.tabellenzeile_dunkel { + background-color: #B9D9F0; +} +.warnung { + color: #C40000; +} +.Textfeld { + font-family: Arial; + font-size: 10pt; + color: #000000; + border-style: solid; + border-width: 1px 1px; + border-color: #006BB6; + background-color: #E7F5FE; +} +.tab_h { + border-color: black; + border-style: solid; + border-width: 0px 0px 3px 0px; +} +.tab_d { + border-color: black; + border-style: solid; + border-width: 0px 0px 1px 0px; +} +.tab_d_ohne { + border-color: black; + border-style: solid; + border-width: 0px 0px 0px 0px; +} +.headerlink:link { + color: #000000; + text-decoration:underline; +} +.headerlink:visited { + color: #000000; + text-decoration:underline; +} +.headerlink:hover { + color: #505050; + text-decoration:none; +} +.headerlink:active { + color: #505050; + text-decoration:underline; +} +.publink:link { + color: #001B56; + text-decoration:none; +} +.publink:visited { + color: #001B56; + text-decoration:none; +} +.publink:hover { + color: #001B56; + text-decoration:underline; +} +.publink:active { + color: #B9D9F0; + text-decoration:underline; +} +.publink_leit:link { + color: #FFFFDF; + text-decoration:none; +} +.publink_leit:visited { + color: #FFFFDF; + text-decoration:none; +} +.publink_leit:hover { + color: #FFFFDF; + text-decoration:underline; +} +.publink_leit:active { + color: #FFFFDF; + text-decoration:underline; +} +.maillink:link { + color: #001B56; + text-decoration:none; +} +.maillink:visited { + color: #001B56; + text-decoration:none; +} +.maillink:hover { + color: #001B56; + text-decoration:underline; +} +.maillink:active { + color: #B9D9F0; + text-decoration:underline; +} +.formlink:link { + color: #FFFFFF; + text-decoration:none; +} +.formlink:visited { + color: #FFFFFF; + text-decoration:none; +} +.formlink:hover { + color: #FFFFFF; + text-decoration:none; +} +.formlink:active { + color: #FFFFFF; + text-decoration:none; +} +.no_size { + font-family: Arial; + font-size: 1pt; +}
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/syntax_check.php b/ldap-site-mngmt/webinterface/syntax_check.php new file mode 100644 index 00000000..4784d6d3 --- /dev/null +++ b/ldap-site-mngmt/webinterface/syntax_check.php @@ -0,0 +1,268 @@ +<?php +/* + Syntaxcheck 1.2 2006/08/08 + + A class for checking syntax of forms data + Copyright (c) Tarik Gasmi, All Rights Reserved +*/ + + +class Syntaxcheck +{ + + var $ERROR = ""; + var $CLEAR = false; + + function Syntaxcheck () + { + return; + } + + function clear_error () + { + $this->ERROR = ""; + } + + + + + +# Ist "dotted quad IPAddress" in gueltigem Bereich? true or false +# Ueberprueft Format, fuehrende Nullen, und Werte > 255 +# +# Ueberprueft nicht nach reservierten oder nicht-route-baren IPs. +# +function check_ip_syntax($IP) +{ + if($this->CLEAR) { $this->clear_error();} + + $len = strlen($IP); + if( $len > 15 ){ + $this->ERROR = "check_ip_syntax: too long [$IP][$len]"; + return false; + } + + $badcharacter = eregi_replace("([0-9\.]+)","",$IP); + if(!empty($badcharacter)){ + $this->ERROR = "check_ip_syntax: Bad data in IP address [$badcharacter]"; + return false; + } + + $chunks = explode(".",$IP); + $count = count($chunks); + if ($count != 4){ + $this->ERROR = "check_ip_syntax: not a dotted quad [$IP]"; + return false; + } + + while ( list ($key,$val) = each ($chunks) ){ + if(ereg("^0",$val) && strlen($val) != 1){ + $this->ERROR = "check_ip_syntax: Invalid IP segment [$val]"; + return false; + } + $Num = $val; + settype($Num,"integer"); + if($Num > 255){ + $this->ERROR = "check_ip_syntax: Segment out of range [$Num]"; + return false; + } + } + + return true; + +} + +# Netzwerkaddresse +function check_netip_syntax($IP) +{ + if($this->CLEAR) { $this->clear_error();} + + if ( !($this->check_ip_syntax($IP)) ){ + return false; + } + $chunks = explode(".",$IP); + if ( $chunks[3] != "0" ){ + return false; + } + return true; +} + +# MAC Adresse + +# Domainname + +# Hostname +function is_hostname ($hostname = ""){ + + if($this->CLEAR) { $this->clear_error(); } + + $web = false; + + if(empty($hostname)) + { + $this->ERROR = "is_hostname: No hostname submitted"; + return false; + } + + // Only a-z, 0-9, and "-" or "." are permitted in a hostname + + // Patch for POSIX regex lib by Sascha Schumann sas@schell.de + $Bad = eregi_replace("[-A-Z0-9\.]","",$hostname); + + if(!empty($Bad)) + { + $this->ERROR = "is_hostname: invalid chars [$Bad]"; + return false; + } + + // See if we're doing www.hostname.tld or hostname.tld + if(eregi("^www\.",$hostname)) + { + $web = true; + } + + // double "." is a not permitted + if(ereg("\.\.",$hostname)) + { + $this->ERROR = "is_hostname: Double dot in [$hostname]"; + return false; + } + if(ereg("^\.",$hostname)) + { + $this->ERROR = "is_hostname: leading dot in [$hostname]"; + return false; + } + + $chunks = explode(".",$hostname); + + if( (gettype($chunks)) != "array") + { + $this->ERROR = "is_hostname: Invalid hostname, no dot seperator [$hostname]"; + return false; + } + + $count = ( (count($chunks)) - 1); + + if($count < 1) + { + $this->ERROR = "is_hostname: Invalid hostname [$count] [$hostname]\n"; + return false; + } + + // Bug that can't be killed without doing an is_host, + // something.something will return TRUE, even if it's something + // stupid like NS.SOMETHING (with no tld), because SOMETHING is + // construed to BE the tld. The is_bigfour and is_country + // checks should help eliminate this inconsistancy. To really + // be sure you've got a valid hostname, do an is_host() on it. + + if( ($web) and ($count < 2) ) + { + $this->ERROR = "is_hostname: Invalid hostname [$count] [$hostname]\n"; + return false; + } + + $tld = $chunks[$count]; + + if(empty($tld)) + { + $this->ERROR = "is_hostname: No TLD found in [$hostname]"; + return false; + } + + if(!$this->is_bigfour($tld)) + { + if(!$this->is_country($tld)) + { + $this->ERROR = "is_hostname: Unrecognized TLD [$tld]"; + return false; + } + } + + + return true; +} + + +# Syntax Check für die Eingaben: Uhrzeit, Wochentag, Monatstag, Monatstag.Monat +function check_timerange_syntax($mcday,$mcbeg,$mcend){ + + if($this->CLEAR) { $this->clear_error();} + + $badcharacter = eregi_replace("([a-z0-9\.]+)","",$mcday); + if(!empty($badcharacter)){ + $this->ERROR = "check_ip_syntax: Bad data in MC Day [$badcharacter]"; + return false; + } + $badcharacter = eregi_replace("([x0-9]+)","",$mcbeg); + if(!empty($badcharacter)){ + $this->ERROR = "check_ip_syntax: Bad data in MC Begin [$badcharacter]"; + return false; + } + $badcharacter = eregi_replace("([x0-9]+)","",$mcend); + if(!empty($badcharacter)){ + $this->ERROR = "check_ip_syntax: Bad data in MC End [$badcharacter]"; + return false; + } + + $lenmcday = strlen($mcday); + if (eregi("([a-z]+)",$mcday)){ + if ($lenmcday > 2){$this->ERROR = "WOTAG > 2"; return false;} + if (eregi("([0-9\.]+)",$mcday)){$this->ERROR = "WOTAG enthaelt (0-9.)"; return false;} + #if (!(eregi("[mdsfx][aiorx]",$mcday))){return false;} + if (!(eregi("(m[io]|d[io]|s[ao]|fr|x)",$mcday))){$this->ERROR = "WOTAG falscher String"; return false;} + } + if (eregi("([0-9]+)",$mcday)){ + if (eregi("[\.]",$mcday)){ + preg_match("/[\.]/",$mcday,$treffer); + if (count($treffer) > 1){$this->ERROR = "mehr als 2 Punkte"; return false;}; + $exp = explode('.',$mcday); + $day = $exp[0]; + $lenday = strlen($day); + if ($lenday > 2){$this->ERROR = "TAG > 2"; return false;} + if (!(eregi("(0[1-9]|[0-2][0-9]|3[01])",$day))){$this->ERROR = "TAG nicht korrekt"; return false;} + $month = $exp[1]; + $lenmonth = strlen($month); + if ($lenmonth > 2){$this->ERROR = "MONAT > 2"; return false;} + if (!(eregi("(0[0-9]|0[0-9]|1[0-2])",$month))){$this->ERROR = "Monat nicht korrekt"; return false;} + + } + else{ + if ($lenmcday > 2){$this->ERROR = "TAG > 2"; return false;} + if (!(eregi("(0[0-9]|[0-2][0-9]|3[01])",$mcday))){$this->ERROR = "Tag nicht korrekt"; return false;} + } + } + + $lenmcbeg = strlen($mcbeg); + if ($lenmcbeg == 2){ + if (!(eregi("(0[0-9]|1[0-9]|2[0-3]|x)",$mcbeg))){$this->ERROR = "Uhrzeit nicht korrekt"; return false;} + } + if ($lenmcbeg == 1){ + if (!(eregi("([0-9]|x)",$mcbeg))){$this->ERROR = "Uhrzeit nicht korrekt"; return false;} + } + $lenmcend = strlen($mcend); + if ($lenmcend == 2){ + if (!(eregi("(0[0-9]|1[0-9]|2[0-3]|x)",$mcend))){$this->ERROR = "Uhrzeit nicht korrekt"; return false;} + } + if ($lenmcend == 1){ + if (!(eregi("([0-9]|x)",$mcend))){$this->ERROR = "Uhrzeit nicht korrekt"; return false;} + } + + return true; +} + + +# Überprüft ob Menuposition ein Zahl ist +function check_menuposition($menpos){ + + if($this->CLEAR) { $this->clear_error();} + + $badcharacter = eregi_replace("([0-9]+)","",$menpos); + if(!empty($badcharacter)){ + $this->ERROR = "check_menupostion: Bad data in Menu Position [$badcharacter]"; + return false; + } +} + +} +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/zwischen.php b/ldap-site-mngmt/webinterface/zwischen.php new file mode 100644 index 00000000..21e5137a --- /dev/null +++ b/ldap-site-mngmt/webinterface/zwischen.php @@ -0,0 +1,16 @@ +<?php +session_cache_expire(30); +session_start(); + +$_SESSION['audn'] = $_GET['audn']; + +$rollen_string = $_GET['rollen']; +$_SESSION['rollen'] = explode('_',$rollen_string); + +include('lib/commonlib.inc.php'); + +$url = "au/au.php"; +$mesg = ""; +redirect(0, $url, $mesg, $addSessionId = TRUE); + +?>
\ No newline at end of file |