From b192e30ee65a420e12b71cbc0b410754983c052e Mon Sep 17 00:00:00 2001 From: Tarik Gasmi Date: Mon, 14 May 2007 07:46:29 +0000 Subject: Some webinterface data. git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1076 95ad53e4-c205-0410-b2fa-d234c58c8868 --- ldap-site-mngmt/webinterface/au/au.php | 29 + ldap-site-mngmt/webinterface/au/au_change.php | 121 ++++ ldap-site-mngmt/webinterface/au/au_childs.php | 51 ++ ldap-site-mngmt/webinterface/au/au_footer.inc.php | 18 + ldap-site-mngmt/webinterface/au/au_header.inc.php | 33 + ldap-site-mngmt/webinterface/au/au_menu.php | 198 ++++++ ldap-site-mngmt/webinterface/au/au_show.php | 74 ++ ldap-site-mngmt/webinterface/au/child_au.php | 70 ++ ldap-site-mngmt/webinterface/au/childau_add.php | 144 ++++ ldap-site-mngmt/webinterface/au/childau_change.php | 157 +++++ ldap-site-mngmt/webinterface/au/childau_delete.php | 34 + ldap-site-mngmt/webinterface/au/dom_delete.php | 31 + ldap-site-mngmt/webinterface/au/new_child.php | 75 ++ .../webinterface/class.FastTemplate.php | 768 +++++++++++++++++++++ ldap-site-mngmt/webinterface/hauptmenue.dwt | 16 + ldap-site-mngmt/webinterface/home.dwt | 91 +++ ldap-site-mngmt/webinterface/index.dwt | 12 + ldap-site-mngmt/webinterface/index.php | 45 ++ ldap-site-mngmt/webinterface/login_sicher.php | 362 ++++++++++ ldap-site-mngmt/webinterface/logout_form.inc.dwt | 9 + ldap-site-mngmt/webinterface/pics/arrow.png | Bin 0 -> 866 bytes ldap-site-mngmt/webinterface/pics/branch.gif | Bin 0 -> 70 bytes ldap-site-mngmt/webinterface/pics/branch2.gif | Bin 0 -> 77 bytes ldap-site-mngmt/webinterface/pics/branchbottom.gif | Bin 0 -> 72 bytes .../webinterface/pics/branchbottom2.gif | Bin 0 -> 72 bytes ldap-site-mngmt/webinterface/pics/branchtop.gif | Bin 0 -> 67 bytes ldap-site-mngmt/webinterface/pics/down.gif | Bin 0 -> 164 bytes ldap-site-mngmt/webinterface/pics/down2.gif | Bin 0 -> 132 bytes .../webinterface/pics/folder-expanded.gif | Bin 0 -> 923 bytes ldap-site-mngmt/webinterface/pics/folder.gif | Bin 0 -> 922 bytes ldap-site-mngmt/webinterface/pics/header.png | Bin 0 -> 25739 bytes ldap-site-mngmt/webinterface/pics/header1.png | Bin 0 -> 6433 bytes ldap-site-mngmt/webinterface/pics/headerlayer.xcf | Bin 0 -> 44417 bytes ldap-site-mngmt/webinterface/pics/host.png | Bin 0 -> 816 bytes ldap-site-mngmt/webinterface/pics/host1.png | Bin 0 -> 802 bytes ldap-site-mngmt/webinterface/pics/hostfaulty.png | Bin 0 -> 712 bytes ldap-site-mngmt/webinterface/pics/hostfaulty1.png | Bin 0 -> 696 bytes ldap-site-mngmt/webinterface/pics/hostnoboot.png | Bin 0 -> 805 bytes ldap-site-mngmt/webinterface/pics/hostnoboot1.png | Bin 0 -> 792 bytes ldap-site-mngmt/webinterface/pics/line.gif | Bin 0 -> 63 bytes ldap-site-mngmt/webinterface/pics/line2.gif | Bin 0 -> 851 bytes ldap-site-mngmt/webinterface/pics/linebottom.gif | Bin 0 -> 58 bytes ldap-site-mngmt/webinterface/pics/minus.gif | Bin 0 -> 91 bytes ldap-site-mngmt/webinterface/pics/minus2.gif | Bin 0 -> 921 bytes ldap-site-mngmt/webinterface/pics/minusbottom.gif | Bin 0 -> 90 bytes ldap-site-mngmt/webinterface/pics/minustop.gif | Bin 0 -> 88 bytes ldap-site-mngmt/webinterface/pics/plus.gif | Bin 0 -> 94 bytes ldap-site-mngmt/webinterface/pics/plus2.gif | Bin 0 -> 890 bytes ldap-site-mngmt/webinterface/pics/plusbottom.gif | Bin 0 -> 93 bytes ldap-site-mngmt/webinterface/pics/plustop.gif | Bin 0 -> 93 bytes ldap-site-mngmt/webinterface/pics/up.gif | Bin 0 -> 162 bytes ldap-site-mngmt/webinterface/pics/up2.gif | Bin 0 -> 151 bytes .../webinterface/standard_header.inc.php | 65 ++ ldap-site-mngmt/webinterface/start.dwt | 37 + ldap-site-mngmt/webinterface/start.php | 68 ++ ldap-site-mngmt/webinterface/styles.css | 311 +++++++++ ldap-site-mngmt/webinterface/syntax_check.php | 268 +++++++ ldap-site-mngmt/webinterface/zwischen.php | 16 + 58 files changed, 3103 insertions(+) create mode 100644 ldap-site-mngmt/webinterface/au/au.php create mode 100644 ldap-site-mngmt/webinterface/au/au_change.php create mode 100644 ldap-site-mngmt/webinterface/au/au_childs.php create mode 100644 ldap-site-mngmt/webinterface/au/au_footer.inc.php create mode 100644 ldap-site-mngmt/webinterface/au/au_header.inc.php create mode 100644 ldap-site-mngmt/webinterface/au/au_menu.php create mode 100644 ldap-site-mngmt/webinterface/au/au_show.php create mode 100644 ldap-site-mngmt/webinterface/au/child_au.php create mode 100644 ldap-site-mngmt/webinterface/au/childau_add.php create mode 100644 ldap-site-mngmt/webinterface/au/childau_change.php create mode 100644 ldap-site-mngmt/webinterface/au/childau_delete.php create mode 100644 ldap-site-mngmt/webinterface/au/dom_delete.php create mode 100644 ldap-site-mngmt/webinterface/au/new_child.php create mode 100644 ldap-site-mngmt/webinterface/class.FastTemplate.php create mode 100644 ldap-site-mngmt/webinterface/hauptmenue.dwt create mode 100644 ldap-site-mngmt/webinterface/home.dwt create mode 100644 ldap-site-mngmt/webinterface/index.dwt create mode 100644 ldap-site-mngmt/webinterface/index.php create mode 100644 ldap-site-mngmt/webinterface/login_sicher.php create mode 100644 ldap-site-mngmt/webinterface/logout_form.inc.dwt create mode 100644 ldap-site-mngmt/webinterface/pics/arrow.png create mode 100644 ldap-site-mngmt/webinterface/pics/branch.gif create mode 100644 ldap-site-mngmt/webinterface/pics/branch2.gif create mode 100644 ldap-site-mngmt/webinterface/pics/branchbottom.gif create mode 100644 ldap-site-mngmt/webinterface/pics/branchbottom2.gif create mode 100644 ldap-site-mngmt/webinterface/pics/branchtop.gif create mode 100644 ldap-site-mngmt/webinterface/pics/down.gif create mode 100644 ldap-site-mngmt/webinterface/pics/down2.gif create mode 100644 ldap-site-mngmt/webinterface/pics/folder-expanded.gif create mode 100644 ldap-site-mngmt/webinterface/pics/folder.gif create mode 100644 ldap-site-mngmt/webinterface/pics/header.png create mode 100644 ldap-site-mngmt/webinterface/pics/header1.png create mode 100644 ldap-site-mngmt/webinterface/pics/headerlayer.xcf create mode 100644 ldap-site-mngmt/webinterface/pics/host.png create mode 100644 ldap-site-mngmt/webinterface/pics/host1.png create mode 100644 ldap-site-mngmt/webinterface/pics/hostfaulty.png create mode 100644 ldap-site-mngmt/webinterface/pics/hostfaulty1.png create mode 100644 ldap-site-mngmt/webinterface/pics/hostnoboot.png create mode 100644 ldap-site-mngmt/webinterface/pics/hostnoboot1.png create mode 100644 ldap-site-mngmt/webinterface/pics/line.gif create mode 100644 ldap-site-mngmt/webinterface/pics/line2.gif create mode 100644 ldap-site-mngmt/webinterface/pics/linebottom.gif create mode 100644 ldap-site-mngmt/webinterface/pics/minus.gif create mode 100644 ldap-site-mngmt/webinterface/pics/minus2.gif create mode 100644 ldap-site-mngmt/webinterface/pics/minusbottom.gif create mode 100644 ldap-site-mngmt/webinterface/pics/minustop.gif create mode 100644 ldap-site-mngmt/webinterface/pics/plus.gif create mode 100644 ldap-site-mngmt/webinterface/pics/plus2.gif create mode 100644 ldap-site-mngmt/webinterface/pics/plusbottom.gif create mode 100644 ldap-site-mngmt/webinterface/pics/plustop.gif create mode 100644 ldap-site-mngmt/webinterface/pics/up.gif create mode 100644 ldap-site-mngmt/webinterface/pics/up2.gif create mode 100644 ldap-site-mngmt/webinterface/standard_header.inc.php create mode 100644 ldap-site-mngmt/webinterface/start.dwt create mode 100644 ldap-site-mngmt/webinterface/start.php create mode 100644 ldap-site-mngmt/webinterface/styles.css create mode 100644 ldap-site-mngmt/webinterface/syntax_check.php create mode 100644 ldap-site-mngmt/webinterface/zwischen.php 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 @@ + \ 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 @@ +"; +#echo "old cn:"; print_r($oldcn); echo "
"; +#echo "new desc:"; print_r($description); echo "
"; +#echo "old desc:"; print_r($olddesc); echo "

"; + +$url = 'au_show.php'; + +echo " + + + AU Management + + + + +
"; + +if ( $oldcn == "" && $cn != "" ){ + echo "CN neu anlegen
"; + # hier noch Syntaxcheck + $entry['cn'] = $cn; + $result = ldap_mod_add($ds,$auDN,$entry); + if($result){ + $mesg = "AU Name erfolgreich eingetragen

"; + } + else{ + $mesg = "Fehler beim eintragen des AU Namen

"; + } +} + +if ( $oldcn != "" && $cn != "" && $oldcn != $cn ){ + echo "CN aendern
"; + # hier noch Syntaxcheck + $entry['cn'] = $cn; + $result = ldap_mod_replace($ds,$auDN,$entry); + if($result){ + $mesg = "AU Name erfolgreich geaendert

"; + } + else{ + $mesg = "Fehler beim aendern des AU Namen

"; + } +} + +if ( $oldcn != "" && $cn == "" ){ + echo "CN loeschen
"; + # hier noch Syntaxcheck + $entry['cn'] = $oldcn; + $result = ldap_mod_del($ds,$auDN,$entry); + if($result){ + $mesg = "AU Name erfolgreich geloescht

"; + } + else{ + $mesg = "Fehler beim loeschen des AU Namen

"; + } +} + +if ( $olddesc == "" && $description != "" ){ + echo "DESCR neu anlegen
"; + # hier noch Syntaxcheck + $entry2['description'] = $description; + $result = ldap_mod_add($ds,$auDN,$entry2); + if($result){ + $mesg = "AU Beschreibung erfolgreich eingetragen

"; + } + else{ + $mesg = "Fehler beim eintragen der AU Beschreibung

"; + } +} + +if ( $olddesc != "" && $description != "" && $olddesc != $description ){ + echo "DESCR aendern
"; + # hier noch Syntaxcheck + $entry2['description'] = $description; + $result = ldap_mod_replace($ds,$auDN,$entry2); + if($result){ + $mesg = "AU Beschreibung erfolgreich geandert

"; + } + else{ + $mesg = "Fehler beim aendern der AU Beschreibung

"; + } +} + +if ( $olddesc != "" && $description == "" ){ + echo "DESCR loeschen
"; + # hier noch Syntaxcheck + $entry2['description'] = $olddesc; + $result = ldap_mod_del($ds,$auDN,$entry2); + if($result){ + $mesg = "AU Beschreibung erfolgreich geloescht

"; + } + else{ + $mesg = "Fehler beim loeschen der AU Beschreibung

"; + } +} + +else{ + $mesg = "keine Aenderung
"; +} + +$mesg .= "
Sie werden automatisch auf die vorherige Seite zurückgeleitet.
+ Falls nicht, klicken Sie hier back"; +redirect(2, $url, $mesg, $addSessionId = TRUE); + +echo "
"; + +?> \ 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 @@ +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 @@ +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 @@ + "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 @@ + "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 "

"; + # Submenu + $array = array(); + $childau_array = get_childau($auDN,array("dn","cn","ou")); + #echo "childau_array: ";print_r($childau_array);echo "

"; + if (count($childau_array)!= 0){ + for ($n=0;$n "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 "

"; + # 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 "
"; + if ($item['zugriff'] === "alle" || vergleicheArrays($rollen , $item['zugriff'])) { + $subempty = 0; + $j=0; + $maxsub = count($submenu[$mnr]); + #echo "maxsub: "; print_r($maxsub); echo "
"; + if ($maxsub > 0) { + foreach ($submenu[$mnr] as $item2) { + #echo "item2: "; print_r($item2); echo "
"; + 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= " + + + + +   + + + ".$item2['text']." +   + "; + + $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="";} + else {$zwisch="";} + } + else {$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else { + if (count($submenu[$i][0]) != 0) { + if ($maxmenu == 1) { + $zwisch=" + "; + } + else { + $zwisch=" + "; + } + } + 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=" + "; + } + else { + $zwisch=" + "; + } + } + 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 @@ +".$emailMA['mail'].""; +} + +$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]
"; + } + $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 @@ +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]
"; + } + $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 @@ +"; +echo "ou:"; print_r($childou); echo "
"; +echo "cn:"; print_r($childcn); echo "
"; +echo "desc:"; print_r($childdesc); echo "
"; +echo "domain:"; print_r($childdomainfull); echo "
"; +echo "mainadmin:"; print_r($mainadmin); echo "

"; +echo "hosts:"; print_r($hosts); echo "

"; +*/ + +$seconds = 2; +# $url = 'new_child.php?ou='.$childou.'&cn='.$get_childcn.'&desc='.$get_childdesc.'&childdomain='.$childdomain; + +echo " + + + AU Management + + + + +
"; + +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!
+ Bitte geben Sie einen anderen OU ein.

"; + $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 "
"; + if ($i === 0 ) {array_splice($hosts, $i, 1);} + #print_r($hosts ); echo "
"; + + if (count($hosts) != 0) { + foreach ($hosts as $host) { + $exp = explode('_',$host); + $hostDN = $exp[0]; + $hostname = $exp[1]; + print_r($hostDN); echo "
"; + print_r($hostname); echo "

"; + # IP Adresse nicht verschieben (IPs werden später delegiert) + $hoip = get_node_data($hostDN, array("ipaddress")); + # print_r($hoip); echo "
"; + 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 "
"; + 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 .= "
AU Domain erfolgreich eingetragen
"; + } + else { + $mesg .= "
Fehler beim eintragen der AU Domain
"; + } + + $mesg .= "
Untergeordnete AU erfolgreich angelegt
"; + } + else { + $mesg .= "
Fehler beim anlegen der untergeordneten AU
"; + } + + $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.
+ Bitte geben Sie ihn an.

"; + $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.
+ Bitte wählen Sie einen MainAdmin.

"; + $url = 'new_child.php?ou='.$childou.'&cn='.$get_childcn.'&desc='.$get_childdesc.'&childdomain='.$childdomain; +} + + +$mesg .= "
Sie werden automatisch auf die vorherige Seite zurückgeleitet.
+ Falls nicht, klicken Sie hier back"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "
"; + +?> \ 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 @@ +"; +echo "old ou:"; print_r($oldchildou); echo "
"; +echo "new cn:"; print_r($childcn); echo "
"; +echo "old cn:"; print_r($oldchildcn); echo "
"; +echo "new domain:"; print_r($childdomain); echo "
"; +echo "old domain:"; print_r($oldchilddomain); echo "

"; +echo "child DN:"; print_r($childDN); echo "
"; +echo "new child DN:"; print_r($newchildDN); echo "
"; +echo "submenuNR:"; print_r($submenu); echo "

"; +*/ + +$seconds = 2; +$url = 'child_au.php?dn='.$childDN.'&sbmnr='.$submenu; + +echo " + + + AU Management + + + + +
"; + +####################################### +# CN + +if ($oldchildcn == $childcn) { + #$mesg = "keine Aenderung
"; +} + +if ($oldchildcn == "" && $childcn != "") { + echo "CN neu anlegen
"; + # hier noch Syntaxcheck + $entry['cn'] = $childcn; + $result = ldap_mod_add($ds,$childDN,$entry); + if ($result) { + $mesg = "AU Name erfolgreich eingetragen

"; + } + else { + $mesg = "Fehler beim eintragen des AU Namen

"; + } +} + +if ($oldchildcn != "" && $childcn != "" && $oldchildcn != $childcn) { + echo "CN aendern
"; + # hier noch Syntaxcheck + $entry['cn'] = $childcn; + $result = ldap_mod_replace($ds,$childDN,$entry); + if ($result) { + $mesg = "AU Name erfolgreich geaendert

"; + } + else { + $mesg = "Fehler beim aendern des AU Namen

"; + } +} + +if ($oldchildcn != "" && $childcn == "") { + echo "CN loeschen
"; + # hier noch Syntaxcheck + $entry['cn'] = $oldchildcn; + $result = ldap_mod_del($ds,$childDN,$entry); + if ($result) { + $mesg = "AU Name erfolgreich geloescht

"; + } + else { + $mesg = "Fehler beim loeschen des AU Namen

"; + } +} + +####################################### +# OU + +if ($oldchildou == $childou) { + #$mesg = "keine Aenderung
"; +} + +if ($oldchildou != "" && $childou != "" && $oldchildou != $childou) { + echo "OU aendern
"; + # 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
"; + echo "Sie sind dabei einen Teil des DN zu loeschen.
+ Dies geht nur, wenn Sie den gesamten Eintrag loeschen.
+ Verwenden Sie dazu das Formular unten"; +} + +######################################## +# DOMAIN +if ($oldchilddomain == $domprefix && ($childdomain == "" || $childdomain == $domprefix)) { + #$mesg = "keine Aenderung
"; +} +if ($oldchilddomain == $childdomain) { + #$mesg = "keine Aenderung
"; +} + + +if ($oldchilddomain != "" && $childdomain != "" && $oldchilddomain != $childdomain && $childdomain != $domprefix) { + echo "Domain aendern
"; + # hier noch Syntaxcheck + if (change_child_domain($childdomain, $oldchilddomain, $childDN, $assocdom, $domDN, $domprefix)) { + $mesg = "Domain erfolgreich geandert

"; + } + else { + $mesg = "Fehler beim aendern der Domain

"; + } +} + + +if ($oldchilddomain != "" && $oldchilddomain != $domprefix && ($childdomain == "" || $childdomain == $domprefix)) { + echo "Domain loeschen bzw. integrieren

"; + $delmodus = "integrate"; + delete_child_domain($oldchilddomain,$assocdom,$childDN, $domDN, $delmodus); + $seconds = 5; +} + + +$mesg .= "
Sie werden automatisch auf die vorherige Seite zurückgeleitet.
+ Falls nicht, klicken Sie hier back"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "
"; + +?> \ 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 @@ +"; +#print_r($oldchilddomain); echo "
"; +#print_r($entrydel); echo "
"; + +$url = 'au_childs.php'; + +echo " + + + AU Management + + + + +
"; + +$mesg = delete_childau($childDN,$childou,$delmodus); + +$mesg .= "
Sie werden automatisch auf die vorherige Seite zurückgeleitet.
+ Falls nicht, klicken Sie hier back"; +redirect(2, $url, $mesg, $addSessionId = TRUE); + +echo "
"; + +?> \ 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 @@ + + + AU Management + + + + +
"; + +$mesg = delete_childau_domain($oldchilddomain,$childDN,$delmodus); + +$mesg .= "
Sie werden automatisch auf die vorherige Seite zurückgeleitet.
+ Falls nicht, klicken Sie hier back"; +redirect(2, $url, $mesg, $addSessionId = TRUE); + +echo "
"; + +?> \ 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 @@ +assign(array("CHILDOU" => $childou, + "CHILDCN" => $childcn, + "CHILDDOMAIN" => $childdomain, + "CHILDDESC" => $childdesc, + "AUDN" => $auDN)); + + +####################################### +# Admin anlegen + +$users_array = get_users(); +#print_r($users_array); echo "

"; + +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 @@ +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("" == "$lineTest" ) + { + $start = true; + $end = false; + $outside = false; + } + if("" == "$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("" == "$lineTest" ) + { + $start = true; + $end = false; + $outside = false; + } + if("" == "$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
\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 @@ + + + + + + + + + + + + +
+ + {MTEXT_M} +  
\ 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 @@ + + + + + + + + + +
+ + + + + +

Rechner und IP Management

+
+ + + + +
+

Startseite +  >> 

+
+
+ + + + +
+ {LOGIN} +
+
+ +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + +

Home - Alle AUs in denen Sie Administrator sind

+ 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.
+ Um zu den Administrations-Seiten einer AU zu kommen, wählen Sie entsprechenden Link. +
+ + + + + + + + + + + + + + + + + +
Administrative EinheitenRollen
+ {AU} {AUDN} {MA}  {HA}  {DA}  {ZA}  
+
+ +
+ 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 @@ + + + + {SEITENTITEL} + + + + {HAUPTFENSTER} + + + + \ 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 @@ +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 @@ +"; +#echo "pw: "; print_r($userPassword); echo "
"; + +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.
".$ldapError, FALSE); + die; + } + + } else { + # UID und/oder Passwort wurden NICHT eingegeben + redirect(5, "index.php", "Bitte geben Sie User-Id und Passwort ein.
".$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!
".$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!
".$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", "Eintrag nicht erfolgreich
".$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!
".$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
".$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 = " + + AU Management + + + + + +
+ Bitte haben Sie einen Moment Geduld, die Seite wird geladen...
+ Falls nicht, klicken Sie bitte hier. +
+ + "; + # 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 @@ +
+ + + + + + +

Eingeloggt als:

{USERCN}

+
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/pics/arrow.png b/ldap-site-mngmt/webinterface/pics/arrow.png new file mode 100644 index 00000000..f65dbf64 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/arrow.png differ diff --git a/ldap-site-mngmt/webinterface/pics/branch.gif b/ldap-site-mngmt/webinterface/pics/branch.gif new file mode 100644 index 00000000..32e0f683 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/branch.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/branch2.gif b/ldap-site-mngmt/webinterface/pics/branch2.gif new file mode 100644 index 00000000..a693647c Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/branch2.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/branchbottom.gif b/ldap-site-mngmt/webinterface/pics/branchbottom.gif new file mode 100644 index 00000000..55ceb453 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/branchbottom.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/branchbottom2.gif b/ldap-site-mngmt/webinterface/pics/branchbottom2.gif new file mode 100644 index 00000000..a27a9c4c Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/branchbottom2.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/branchtop.gif b/ldap-site-mngmt/webinterface/pics/branchtop.gif new file mode 100644 index 00000000..f6bd127b Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/branchtop.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/down.gif b/ldap-site-mngmt/webinterface/pics/down.gif new file mode 100644 index 00000000..51095d1c Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/down.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/down2.gif b/ldap-site-mngmt/webinterface/pics/down2.gif new file mode 100644 index 00000000..4fb87681 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/down2.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/folder-expanded.gif b/ldap-site-mngmt/webinterface/pics/folder-expanded.gif new file mode 100644 index 00000000..f779acc7 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/folder-expanded.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/folder.gif b/ldap-site-mngmt/webinterface/pics/folder.gif new file mode 100644 index 00000000..842989f2 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/folder.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/header.png b/ldap-site-mngmt/webinterface/pics/header.png new file mode 100644 index 00000000..7155aa01 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/header.png differ diff --git a/ldap-site-mngmt/webinterface/pics/header1.png b/ldap-site-mngmt/webinterface/pics/header1.png new file mode 100644 index 00000000..ccb676fb Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/header1.png differ diff --git a/ldap-site-mngmt/webinterface/pics/headerlayer.xcf b/ldap-site-mngmt/webinterface/pics/headerlayer.xcf new file mode 100644 index 00000000..b906128f Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/headerlayer.xcf differ diff --git a/ldap-site-mngmt/webinterface/pics/host.png b/ldap-site-mngmt/webinterface/pics/host.png new file mode 100644 index 00000000..5741243e Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/host.png differ diff --git a/ldap-site-mngmt/webinterface/pics/host1.png b/ldap-site-mngmt/webinterface/pics/host1.png new file mode 100644 index 00000000..6cc7079d Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/host1.png differ diff --git a/ldap-site-mngmt/webinterface/pics/hostfaulty.png b/ldap-site-mngmt/webinterface/pics/hostfaulty.png new file mode 100644 index 00000000..c011fb15 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/hostfaulty.png differ diff --git a/ldap-site-mngmt/webinterface/pics/hostfaulty1.png b/ldap-site-mngmt/webinterface/pics/hostfaulty1.png new file mode 100644 index 00000000..5c64ea02 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/hostfaulty1.png differ diff --git a/ldap-site-mngmt/webinterface/pics/hostnoboot.png b/ldap-site-mngmt/webinterface/pics/hostnoboot.png new file mode 100644 index 00000000..e5351514 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/hostnoboot.png differ diff --git a/ldap-site-mngmt/webinterface/pics/hostnoboot1.png b/ldap-site-mngmt/webinterface/pics/hostnoboot1.png new file mode 100644 index 00000000..4325a841 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/hostnoboot1.png differ diff --git a/ldap-site-mngmt/webinterface/pics/line.gif b/ldap-site-mngmt/webinterface/pics/line.gif new file mode 100644 index 00000000..a567ef9e Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/line.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/line2.gif b/ldap-site-mngmt/webinterface/pics/line2.gif new file mode 100644 index 00000000..659e20fe Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/line2.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/linebottom.gif b/ldap-site-mngmt/webinterface/pics/linebottom.gif new file mode 100644 index 00000000..a960f1ff Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/linebottom.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/minus.gif b/ldap-site-mngmt/webinterface/pics/minus.gif new file mode 100644 index 00000000..a2bff127 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/minus.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/minus2.gif b/ldap-site-mngmt/webinterface/pics/minus2.gif new file mode 100644 index 00000000..4f31339e Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/minus2.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/minusbottom.gif b/ldap-site-mngmt/webinterface/pics/minusbottom.gif new file mode 100644 index 00000000..cc33192e Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/minusbottom.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/minustop.gif b/ldap-site-mngmt/webinterface/pics/minustop.gif new file mode 100644 index 00000000..9e8fc36d Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/minustop.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/plus.gif b/ldap-site-mngmt/webinterface/pics/plus.gif new file mode 100644 index 00000000..5bc24cfb Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/plus.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/plus2.gif b/ldap-site-mngmt/webinterface/pics/plus2.gif new file mode 100644 index 00000000..1fee2d74 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/plus2.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/plusbottom.gif b/ldap-site-mngmt/webinterface/pics/plusbottom.gif new file mode 100644 index 00000000..4aa0bde9 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/plusbottom.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/plustop.gif b/ldap-site-mngmt/webinterface/pics/plustop.gif new file mode 100644 index 00000000..24e8a9ec Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/plustop.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/up.gif b/ldap-site-mngmt/webinterface/pics/up.gif new file mode 100644 index 00000000..dfff04b4 Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/up.gif differ diff --git a/ldap-site-mngmt/webinterface/pics/up2.gif b/ldap-site-mngmt/webinterface/pics/up2.gif new file mode 100644 index 00000000..48ac4a4b Binary files /dev/null and b/ldap-site-mngmt/webinterface/pics/up2.gif differ 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 @@ +"; +$rollen = $_SESSION['rollen']; +#echo "rollen: "; print_r($rollen); echo "
"; + + +if (!($ds = uniLdapConnect($uid,$userPassword))){ + echo " + + Rechner und IP Management + + + + +
+ Es konnte keine Verbindung zum LDAP Server hergestellt werden! +
+ + "; + 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 "
";} + +$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 @@ + + +
+ + + + + + + +
+ + +
+ +

Rechner und IP Managment

+ +
+
+ +
+ + + + + + + +
+ + +
+ + {LOGIN} + +
+
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 @@ +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 "

"; +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 @@ +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 @@ + \ No newline at end of file -- cgit v1.2.3-55-g7522