Merge remote-tracking branch 'origin/develop' into 6_2_1
Conflicts: lam-packaging/debian/changelog lam/HISTORY lam/VERSION
|  | @ -26,28 +26,28 @@ fi | |||
| function minify { | ||||
| 	local dir="$1" | ||||
| 	echo "Minify JS files in $dir" | ||||
| 	local outFile=$dir/100_lam.${VERSION}.min.js | ||||
| 	local files=`ls $dir/*.js` | ||||
| 	local jsFiles="" | ||||
| 	for file in $files; do | ||||
| 		closure-compiler --charset UTF-8 --js $file --js_output_file ${file}-MIN | ||||
| 		rm $file | ||||
| 		mv ${file}-MIN $file | ||||
| 		# add final new line to supress Debian warnings | ||||
| 		echo "" >> $file | ||||
| 		jsFiles="$jsFiles --js $file" | ||||
| 	done | ||||
| 	closure-compiler --charset UTF-8 $jsFiles --js_output_file $outFile | ||||
| 	rm $files | ||||
| 	# add final new line to supress Debian warnings | ||||
| 	echo "" >> $outFile | ||||
| } | ||||
| 
 | ||||
| # minifies the CSS files | ||||
| function minifyCSS { | ||||
| 	local dir="$1" | ||||
| 	echo "Minify CSS files in $dir" | ||||
| 	local outFile=$dir/100_lam.${VERSION}.min.css | ||||
| 	local files=`ls $dir/*.css` | ||||
| 	for file in $files; do | ||||
| 		cleancss -o ${file}-MIN $file | ||||
| 		rm $file | ||||
| 		mv ${file}-MIN $file | ||||
| 		# add final new line to supress Debian warnings | ||||
| 		echo "" >> $file | ||||
| 	done | ||||
| 	cat $files | cleancss -o $outFile | ||||
| 	rm $files | ||||
| 	# add final new line to supress Debian warnings | ||||
| 	echo "" >> $outFile | ||||
| } | ||||
| 
 | ||||
| echo "Getting files..." | ||||
|  |  | |||
|  | @ -1,3 +1,9 @@ | |||
| ldap-account-manager (6.3.DEV-1) unstable; urgency=medium | ||||
| 
 | ||||
|   * new upstream release | ||||
| 
 | ||||
|  -- Roland Gruber <post@rolandgruber.de>  Wed, 13 Dec 2017 16:47:31 +0200 | ||||
| 
 | ||||
| ldap-account-manager (6.2.1-1) unstable; urgency=medium | ||||
| 
 | ||||
|   * new upstream release | ||||
|  |  | |||
|  | @ -1,22 +1,24 @@ | |||
| #!/bin/bash | ||||
| 
 | ||||
| set -e | ||||
| 
 | ||||
| files=`ls templates/lib/*.js` | ||||
| for file in $files; do | ||||
| 	closure-compiler --charset UTF-8 --js $file --js_output_file ${file}-MIN | ||||
| 	rm $file | ||||
| 	mv ${file}-MIN $file | ||||
| outFile=templates/lib/100_lam.${SOURCE_DATE_EPOCH}.min.js | ||||
| if [ ! -e $outFile ]; then | ||||
| 	files=`ls templates/lib/*.js` | ||||
| 	jsFiles="" | ||||
| 	for file in $files; do | ||||
| 		jsFiles="$jsFiles --js $file" | ||||
| 	done | ||||
| 	closure-compiler --charset UTF-8 $jsFiles --js_output_file $outFile | ||||
| 	rm $files | ||||
| 	# add final new line to supress Debian warnings | ||||
| 	echo "" >> $file | ||||
| done | ||||
| 	echo "" >> $outFile | ||||
| fi | ||||
| 
 | ||||
| files=`ls style/*.css` | ||||
| for file in $files; do | ||||
| 	cleancss -o ${file}-MIN $file | ||||
| 	rm $file | ||||
| 	mv ${file}-MIN $file | ||||
| outFile=style/100_lam.${SOURCE_DATE_EPOCH}.min.css | ||||
| if [ ! -e $outFile ]; then | ||||
| 	cat $files | cleancss -o ${outFile} | ||||
| 	rm $files | ||||
| 	# add final new line to supress Debian warnings | ||||
| 	echo "" >> $file | ||||
| done | ||||
| 
 | ||||
| 	echo "" >> $outFile | ||||
| fi | ||||
|  |  | |||
|  | @ -1,3 +1,10 @@ | |||
| March 2018 6.3 | ||||
|   - Server profile: added option if referential integrity overlay is active to sip cleanup actions | ||||
|   - LAM Pro: | ||||
|    -> Support custom structural object classes with new custom type | ||||
|    -> Support dynamic lists | ||||
| 
 | ||||
| 
 | ||||
| 04.02.2018 6.2.1 | ||||
|   - Fixed bugs: | ||||
|    -> Login page not working when no server profile exists (44) | ||||
|  |  | |||
|  | @ -1 +1 @@ | |||
| 6.2.1 | ||||
| 6.3.DEV | ||||
|  |  | |||
|  | @ -0,0 +1,4 @@ | |||
| <pdf type="bind" filename="printLogo.jpg" headline="Custom entry" foldingmarks="no"> | ||||
| 	<section name="_main_dn"> | ||||
| 	</section> | ||||
| </pdf> | ||||
|  | @ -0,0 +1 @@ | |||
| 
 | ||||
|  | @ -15,9 +15,11 @@ time. | |||
| * lib/modules/aliasEntry.inc | ||||
| * lib/modules/automount.inc | ||||
| * lib/modules/bindDLZ.inc | ||||
| * lib/modules/customBaseType.inc | ||||
| * lib/modules/customFields.inc | ||||
| * lib/modules/customScripts.inc | ||||
| * lib/modules/device.inc | ||||
| * lib/modules/dynamicList.inc | ||||
| * lib/modules/groupOfNames.inc | ||||
| * lib/modules/groupOfNamesUser.inc | ||||
| * lib/modules/groupOfUniqueNames.inc | ||||
|  | @ -48,8 +50,9 @@ time. | |||
| * lib/modules/zarafaServer.inc | ||||
| * lib/modules/zarafaUser.inc | ||||
| * lib/types/alias.inc | ||||
| * lib/types/bind.inc | ||||
| * lib/types/automountType.inc | ||||
| * lib/types/bind.inc | ||||
| * lib/types/customType.inc | ||||
| * lib/types/gon.inc | ||||
| * lib/types/nisObjectType.inc | ||||
| * lib/types/nsview.inc | ||||
|  |  | |||
|  | @ -60,6 +60,19 @@ This is a list of API changes for all LAM releases. | |||
| 
 | ||||
| <br> | ||||
| 
 | ||||
| <h2>6.2 -> 6.3</h2> | ||||
| <ul> | ||||
|   <li>Module API | ||||
|     <ul> | ||||
|         <li>get_configOptions(): $allScopes contains type ids instead of account types</li> | ||||
|         <li>check_configOptions(): first parameter contains type ids instead of account types</li> | ||||
|     </ul> | ||||
|   </li> | ||||
| </ul> | ||||
| <h2>6.1 -> 6.2</h2> | ||||
| <ul> | ||||
|   <li>No major API changes</li> | ||||
| </ul> | ||||
| <h2>6.0 -> 6.1</h2> | ||||
| <ul> | ||||
|   <li>module API</li> | ||||
|  | @ -616,4 +629,4 @@ The class variable "triggered_messages" in baseModule was removed.<br> | |||
| 
 | ||||
| <br> | ||||
| 
 | ||||
| </body></html> | ||||
| </body></html> | ||||
|  |  | |||
|  | @ -368,24 +368,49 @@ | |||
| 
 | ||||
|         <para><emphasis role="bold">Advanced options</emphasis></para> | ||||
| 
 | ||||
|         <para>Sometimes, you may not want to display the server address on the | ||||
|         login page. In this case you can setup a display name here (e.g. | ||||
|         "Production").</para> | ||||
|         <para>Display name: Sometimes, you may not want to display the server | ||||
|         address on the login page. In this case you can setup a display name | ||||
|         here (e.g. "Production").</para> | ||||
| 
 | ||||
|         <para>By default LAM will not follow LDAP referrals. This is ok for | ||||
|         most installations. If you use LDAP referrals please activate the | ||||
|         referral option in advanced settings.</para> | ||||
|         <para>Follow referrals: By default LAM will not follow LDAP referrals. | ||||
|         This is ok for most installations. If you use LDAP referrals please | ||||
|         activate the referral option in advanced settings.</para> | ||||
| 
 | ||||
|         <para>Paged results should be activated only if you encounter any | ||||
|         problems regarding size limits on Active Directory. LAM will then | ||||
|         query LDAP to return results in chunks of 999 entries.</para> | ||||
|         <para>Paged results: Paged results should be activated only if you | ||||
|         encounter any problems regarding size limits on Active Directory. LAM | ||||
|         will then query LDAP to return results in chunks of 999 | ||||
|         entries.</para> | ||||
| 
 | ||||
|         <para>Referential integrity overlay: Activate this checkbox if you | ||||
|         have any server side extension for referential integrity in place. In | ||||
|         this case the server will cleanup references to LDAP entries that are | ||||
|         deleted.</para> | ||||
| 
 | ||||
|         <para>The following actions are skipped in this case:</para> | ||||
| 
 | ||||
|         <itemizedlist> | ||||
|           <listitem> | ||||
|             <para>Users: group of (unique) names: memberships are not deleted | ||||
|             when user is deleted</para> | ||||
|           </listitem> | ||||
| 
 | ||||
|           <listitem> | ||||
|             <para>Users: organizational roles: role assignments are not | ||||
|             deleted when user is deleted</para> | ||||
|           </listitem> | ||||
| 
 | ||||
|           <listitem> | ||||
|             <para>Groups: groupOf(Unique)Names: memberships are not deleted | ||||
|             when group is deleted</para> | ||||
|           </listitem> | ||||
|         </itemizedlist> | ||||
| 
 | ||||
|         <literallayout> | ||||
| </literallayout> | ||||
| 
 | ||||
|         <para>LAM is translated to many different languages. Here you can | ||||
|         select the default language for this server profile. The language | ||||
|         setting may be overriden at the LAM login page.</para> | ||||
|         setting may be overridden at the LAM login page.</para> | ||||
| 
 | ||||
|         <para>Please also set your time zone here.</para> | ||||
| 
 | ||||
|  |  | |||
|  | @ -2519,6 +2519,82 @@ | |||
|       </screenshot> | ||||
|     </section> | ||||
| 
 | ||||
|     <section> | ||||
|       <title>Dynamic lists (LAM Pro)</title> | ||||
| 
 | ||||
|       <para><ulink | ||||
|       url="http://www.openldap.org/doc/admin24/overlays.html#Dynamic%20Lists">Dynamic | ||||
|       lists</ulink> allow you to create LDAP entries that populate the value | ||||
|       of an attribute via LDAP query. This is e.g. used to create groups that | ||||
|       contain all users in a certain DN.</para> | ||||
| 
 | ||||
|       <para>Please note that this functionality requires configuration on your | ||||
|       LDAP server. E.g. on OpenLDAP you need to activate the "dynlist" overlay | ||||
|       and need to specify attribute mappings.</para> | ||||
| 
 | ||||
|       <para><emphasis role="bold">Configuration</emphasis></para> | ||||
| 
 | ||||
|       <para>Add a new group account type and set a unique label for it.</para> | ||||
| 
 | ||||
|       <para><inlinemediaobject> | ||||
|           <imageobject> | ||||
|             <imagedata fileref="images/mod_dynamicList1.png"/> | ||||
|           </imageobject> | ||||
|         </inlinemediaobject></para> | ||||
| 
 | ||||
|       <para>Do not forget to set proper "List attributes" to be shown on the | ||||
|       overview page of all dynamic lists.</para> | ||||
| 
 | ||||
|       <para><inlinemediaobject> | ||||
|           <imageobject> | ||||
|             <imagedata fileref="images/mod_dynamicList2.png"/> | ||||
|           </imageobject> | ||||
|         </inlinemediaobject></para> | ||||
| 
 | ||||
|       <para>On tab "Modules" please add the dynamic lists module.</para> | ||||
| 
 | ||||
|       <para><inlinemediaobject> | ||||
|           <imageobject> | ||||
|             <imagedata fileref="images/mod_dynamicList4.png"/> | ||||
|           </imageobject> | ||||
|         </inlinemediaobject></para> | ||||
| 
 | ||||
|       <para>On tab "Module settings" you can now configure your dynamic lists. | ||||
|       Here you setup the used object class, RDN attribute, query attribute and | ||||
|       list attribute (the one that is populated via query).</para> | ||||
| 
 | ||||
|       <para>In case you have different types of dynamic lists you can simply | ||||
|       redo the steps above to create more group types.</para> | ||||
| 
 | ||||
|       <para><inlinemediaobject> | ||||
|           <imageobject> | ||||
|             <imagedata fileref="images/mod_dynamicList3.png"/> | ||||
|           </imageobject> | ||||
|         </inlinemediaobject></para> | ||||
| 
 | ||||
|       <para/> | ||||
| 
 | ||||
|       <para><emphasis role="bold">Usage</emphasis></para> | ||||
| 
 | ||||
|       <para>When you login to LAM you will see your new dynamic lists | ||||
|       tab.</para> | ||||
| 
 | ||||
|       <para><inlinemediaobject> | ||||
|           <imageobject> | ||||
|             <imagedata fileref="images/mod_dynamicList5.png"/> | ||||
|           </imageobject> | ||||
|         </inlinemediaobject></para> | ||||
| 
 | ||||
|       <para>For each list you can manage the name and query string. LAM also | ||||
|       displays which entries are auto-populated to the list.</para> | ||||
| 
 | ||||
|       <para><inlinemediaobject> | ||||
|           <imageobject> | ||||
|             <imagedata fileref="images/mod_dynamicList6.png"/> | ||||
|           </imageobject> | ||||
|         </inlinemediaobject></para> | ||||
|     </section> | ||||
| 
 | ||||
|     <section> | ||||
|       <title>PyKota</title> | ||||
| 
 | ||||
|  | @ -4733,7 +4809,72 @@ OK (10 msec)</programlisting> | |||
|     </screenshot> | ||||
|   </section> | ||||
| 
 | ||||
|   <section> | ||||
|   <section id="mod_customTypes"> | ||||
|     <title>Custom types (LAM Pro)</title> | ||||
| 
 | ||||
|     <para>This account type allows you to manage any type of LDAP entries. | ||||
|     This is e.g. needed if you define your own structural object classes or | ||||
|     LAM does not yet provide a module for a structural object class.</para> | ||||
| 
 | ||||
|     <para>Always use this together with <link | ||||
|     linkend="mod_customFields">Custom fields</link> to specify the LDAP | ||||
|     attributes.</para> | ||||
| 
 | ||||
|     <para><emphasis role="bold">Configuration</emphasis></para> | ||||
| 
 | ||||
|     <para>Add a custom account type in your server profile (you can also add | ||||
|     multiple if needed).</para> | ||||
| 
 | ||||
|     <para><inlinemediaobject> | ||||
|         <imageobject> | ||||
|           <imagedata fileref="images/mod_customBaseType1.png"/> | ||||
|         </imageobject> | ||||
|       </inlinemediaobject></para> | ||||
| 
 | ||||
|     <para>Then specify the root DN where the entries should be stored. Also | ||||
|     provide the attributes to show in list view and a unique label for your | ||||
|     entries.</para> | ||||
| 
 | ||||
|     <para><inlinemediaobject> | ||||
|         <imageobject> | ||||
|           <imagedata fileref="images/mod_customBaseType2.png"/> | ||||
|         </imageobject> | ||||
|       </inlinemediaobject></para> | ||||
| 
 | ||||
|     <para>On tab modules add the custom type module. You will also need the | ||||
|     <link linkend="mod_customFields">Custom fields</link> module to manage the | ||||
|     attributes.</para> | ||||
| 
 | ||||
|     <para><inlinemediaobject> | ||||
|         <imageobject> | ||||
|           <imagedata fileref="images/mod_customBaseType3.png"/> | ||||
|         </imageobject> | ||||
|       </inlinemediaobject></para> | ||||
| 
 | ||||
|     <para>Finally, switch to tab Module settings. Here you need to specify the | ||||
|     structural object class. Also configure the <link | ||||
|     linkend="mod_customFields">Custom fields</link> module to manage all your | ||||
|     attributes.</para> | ||||
| 
 | ||||
|     <para><inlinemediaobject> | ||||
|         <imageobject> | ||||
|           <imagedata fileref="images/mod_customBaseType4.png"/> | ||||
|         </imageobject> | ||||
|       </inlinemediaobject></para> | ||||
| 
 | ||||
|     <para><emphasis role="bold">Manage your entries</emphasis></para> | ||||
| 
 | ||||
|     <para>You can now login to LAM and will see one tab for each configured | ||||
|     custom type.</para> | ||||
| 
 | ||||
|     <para><inlinemediaobject> | ||||
|         <imageobject> | ||||
|           <imagedata fileref="images/mod_customBaseType5.png"/> | ||||
|         </imageobject> | ||||
|       </inlinemediaobject></para> | ||||
|   </section> | ||||
| 
 | ||||
|   <section id="mod_customFields"> | ||||
|     <title>Custom fields (LAM Pro)</title> | ||||
| 
 | ||||
|     <para>This module allows you to manage LDAP attributes that are not | ||||
|  | @ -4781,7 +4922,8 @@ OK (10 msec)</programlisting> | |||
| 
 | ||||
|     <itemizedlist> | ||||
|       <listitem> | ||||
|         <para>structural object classes</para> | ||||
|         <para>structural object classes (supported by <link | ||||
|         linkend="mod_customTypes">Custom types</link>)</para> | ||||
|       </listitem> | ||||
| 
 | ||||
|       <listitem> | ||||
|  |  | |||
| Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 39 KiB | 
| After Width: | Height: | Size: 32 KiB | 
| After Width: | Height: | Size: 24 KiB | 
| After Width: | Height: | Size: 25 KiB | 
| After Width: | Height: | Size: 8.6 KiB | 
| After Width: | Height: | Size: 30 KiB | 
| After Width: | Height: | Size: 34 KiB | 
| After Width: | Height: | Size: 25 KiB | 
| After Width: | Height: | Size: 16 KiB | 
| After Width: | Height: | Size: 33 KiB | 
| After Width: | Height: | Size: 28 KiB | 
| After Width: | Height: | Size: 36 KiB | 
| Before Width: | Height: | Size: 815 B After Width: | Height: | Size: 1.8 KiB | 
| After Width: | Height: | Size: 3.5 KiB | 
|  | @ -194,6 +194,8 @@ $helpArray = array ( | |||
| 					"Text" => _('Please select the template for the new server profile. You can either select an existing server profile or use one of the built-in templates.')), | ||||
| 				"268" => array ("Headline" => _('Display name'), | ||||
| 					"Text" => _('This name is shown on the login page as server name. Defaults to server address if empty.')), | ||||
| 				"269" => array ("Headline" => _('Referential integrity overlay'), | ||||
| 					"Text" => _('Activate this checkbox if you have any server side extension for referential integrity in place. LAM will then skip cleanup tasks like deletion of group memberships on account deletion.')), | ||||
| 				"270" => array ("Headline" => _('Bind user and password'), | ||||
| 					"Text" => _('Please enter the DN and password to use for all jobs.')), | ||||
| 				"271" => array ("Headline" => _('Database type'), | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ $Id$ | |||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2003 - 2006  Tilo Lutz | ||||
|                 2009 - 2017  Roland Gruber | ||||
|                 2009 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -1094,7 +1094,14 @@ function extractRDNAttribute($dn) { | |||
|  */ | ||||
| function extractRDNValue($dn) { | ||||
| 	if (empty($dn)) return null; | ||||
| 	$parts = explode("=", substr($dn, 0, strpos($dn, ','))); | ||||
| 	if (strpos($dn, '=') === false) { | ||||
| 		return $dn; | ||||
| 	} | ||||
| 	$dnWork = $dn; | ||||
| 	if (strpos($dnWork, ',') !== false) { | ||||
| 		$dnWork = substr($dn, 0, strpos($dnWork, ',')); | ||||
| 	} | ||||
| 	$parts = explode("=", $dnWork); | ||||
| 	return $parts[1]; | ||||
| } | ||||
| 
 | ||||
|  | @ -1567,7 +1574,7 @@ function printJsIncludes($prefix) { | |||
| 	$jsFiles = array(); | ||||
| 	$jsEntry = $jsDir->read(); | ||||
| 	while ($jsEntry !== false) { | ||||
| 		if (substr($jsEntry, strlen($jsEntry) - 3, 3) == '.js') { | ||||
| 		if ((substr($jsEntry, strlen($jsEntry) - 3, 3) == '.js') || (substr($jsEntry, strlen($jsEntry) - 4, 4) == '.php')) { | ||||
| 			$jsFiles[] = $jsEntry; | ||||
| 		} | ||||
| 		$jsEntry = $jsDir->read(); | ||||
|  | @ -1578,6 +1585,11 @@ function printJsIncludes($prefix) { | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * LAM exception with title and message. | ||||
|  * | ||||
|  * @author Roland Gruber | ||||
|  */ | ||||
| class LAMException extends Exception { | ||||
| 
 | ||||
| 	private $title; | ||||
|  |  | |||
|  | @ -0,0 +1,35 @@ | |||
| <?php | ||||
| namespace LAM\FOOTER; | ||||
| /* | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation; either version 2 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program; if not, write to the Free Software | ||||
|   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | ||||
| 
 | ||||
| */ | ||||
| 
 | ||||
| /** | ||||
| * Footer part of page which closes the tab content area etc. | ||||
| * | ||||
| * @package main | ||||
| * @author Roland Gruber | ||||
| */ | ||||
| ?>
 | ||||
| 
 | ||||
| </div> | ||||
| <br> | ||||
| </body> | ||||
| </html> | ||||
|  | @ -0,0 +1,206 @@ | |||
| <?php | ||||
| namespace LAM\HEADER; | ||||
| /* | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation; either version 2 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program; if not, write to the Free Software | ||||
|   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | ||||
| 
 | ||||
| */ | ||||
| 
 | ||||
| /** | ||||
| * Head part of page which includes links to lists etc. | ||||
| * | ||||
| * @package main | ||||
| * @author Roland Gruber | ||||
| */ | ||||
| 
 | ||||
| $headerPrefix = ""; | ||||
| if (is_file("login.php")) { | ||||
| 	$headerPrefix = ".."; | ||||
| } | ||||
| elseif (is_file("../../templates/login.php")) { | ||||
| 	$headerPrefix = "../.."; | ||||
| } | ||||
| elseif (is_file("../../../templates/login.php")) { | ||||
| 	$headerPrefix = "../../.."; | ||||
| } | ||||
| 
 | ||||
| /** tool definitions */ | ||||
| include_once($headerPrefix . "/lib/tools.inc"); | ||||
| 
 | ||||
| $pro = ''; | ||||
| if (isLAMProVersion()) { | ||||
| 	$pro = ' Pro'; | ||||
| } | ||||
| 
 | ||||
| // HTML header and title
 | ||||
| echo $_SESSION['header']; | ||||
| $title = "LDAP Account Manager" . $pro . " (" . str_replace(array('ldap://', 'ldaps://'), array('', ''), $_SESSION['config']->get_ServerURL()) . ")"; | ||||
| printHeaderContents($title, $headerPrefix); | ||||
| echo "</head><body class=\"admin\">\n"; | ||||
| 
 | ||||
| // include all JavaScript files
 | ||||
| printJsIncludes($headerPrefix); | ||||
| 
 | ||||
| // get tool list
 | ||||
| $availableTools = getTools(); | ||||
| $toolSettings = $_SESSION['config']->getToolSettings(); | ||||
| // sort tools
 | ||||
| $toSort = array(); | ||||
| foreach ($availableTools as $toolClass) { | ||||
|     $myTool = new $toolClass(); | ||||
| 	if ($myTool->getRequiresWriteAccess() && !checkIfWriteAccessIsAllowed()) { | ||||
| 		continue; | ||||
| 	} | ||||
| 	if ($myTool->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) { | ||||
| 		continue; | ||||
| 	} | ||||
| 	// check visibility
 | ||||
| 	if (!$myTool->isVisible()) { | ||||
| 		continue; | ||||
| 	} | ||||
| 	// check if hidden by config
 | ||||
| 	$toolName = substr($toolClass, strrpos($toolClass, '\\') + 1); | ||||
| 	if (isset($toolSettings['tool_hide_' . $toolName]) && ($toolSettings['tool_hide_' . $toolName] == 'true')) { | ||||
| 		continue; | ||||
| 	} | ||||
| 	$toSort[$toolClass] = $myTool->getPosition(); | ||||
| } | ||||
| asort($toSort); | ||||
| $tools = array(); | ||||
| foreach ($toSort as $key => $value) { | ||||
| 	$tools[] = new $key(); | ||||
| } | ||||
| ?>
 | ||||
| 
 | ||||
| <table border=0 width="100%" class="lamHeader ui-corner-all"> | ||||
| 	<tr> | ||||
| 		<td align="left" height="30" class="nowrap"> | ||||
| 			<a class="lamLogo" href="https://www.ldap-account-manager.org/" target="new_window"> | ||||
| 				<span class="hide-on-tablet"> </span> | ||||
| 				<span class="hide-on-mobile"> | ||||
| 				LDAP Account Manager | ||||
| 				<?php | ||||
| 				echo $pro . " - " . LAMVersion(); | ||||
| 				?>
 | ||||
| 				</span> | ||||
| 			</a> | ||||
| 		</td> | ||||
| 		<td align="left" height="30" class="nowrap"> | ||||
| 			<span class="hide-on-mobile"> | ||||
| 			<?php | ||||
| 				$userData = $_SESSION['ldap']->decrypt_login(); | ||||
| 				echo '  <small title="' . $userData[0] . '">'; | ||||
| 				printf('(' . _('Logged in as: %s') . ')', extractRDNValue($userData[0])); | ||||
| 				$userData = null; | ||||
| 				echo '</small>'; | ||||
| 			?>
 | ||||
| 			</span> | ||||
| 		</td> | ||||
| 	<td align="right" height=30 width="100%"> | ||||
| 	<ul id="dropmenu" class="dropmenu"> | ||||
| 		<li><a href="<?php echo $headerPrefix; ?>/templates/logout.php" target="_top"><img class="align-middle" height="16" width="16" alt="logout" src="<?php echo $headerPrefix; ?>/graphics/exit.png"><span class="hide-on-mobile padding0"> <?php echo _("Logout") ?></span></a></li>
 | ||||
| 		<?php | ||||
| 		if (is_dir(dirname(__FILE__) . '/../docs/manual')) { | ||||
| 		?>
 | ||||
| 	    <li> | ||||
| 			<a target="_blank" href="<?php echo $headerPrefix; ?>/docs/manual/index.html"><img class="align-middle" width="16" height="16" alt="help" src="<?php echo $headerPrefix; ?>/graphics/help.png"><span class="hide-on-mobile padding0"> <?php echo _("Help") ?>      </span></a>
 | ||||
| 		</li> | ||||
| 		<?php | ||||
| 		} | ||||
| 		if (sizeof($tools) > 0) { | ||||
| 		?>
 | ||||
| 		<li> | ||||
| 			<a href="<?php echo $headerPrefix; ?>/templates/tools.php"><img class="align-middle" height="16" width="16" alt="tools" src="<?php echo $headerPrefix; ?>/graphics/tools.png"><span class="hide-on-mobile padding0"> <?php echo _("Tools") ?></span></a>
 | ||||
| 				<ul> | ||||
| 				<?php | ||||
| 					foreach ($tools as $tool) { | ||||
| 						$subTools = $tool->getSubTools(); | ||||
| 						echo '<li title="' . $tool->getDescription() . '">'; | ||||
| 						$link = $headerPrefix . '/templates/' . $tool->getLink(); | ||||
| 						echo '<a href="' . $link . "\">\n"; | ||||
| 						echo '<img class="max16" height="16px" width="16px" alt="" src="' . $headerPrefix . '/graphics/' . $tool->getImageLink() . '"> ' . $tool->getName(); | ||||
| 						echo "</a>\n"; | ||||
| 						if (sizeof($subTools) > 0) { | ||||
| 							echo "<ul>\n"; | ||||
| 							foreach ($subTools as $subTool) { | ||||
| 								echo "<li title=\"" . $subTool->description . "\">\n"; | ||||
| 								echo "<a href=\"" . $headerPrefix . '/templates/' . $subTool->link . "\">\n"; | ||||
| 								echo '<img class="max16" width="16px" height="16px" alt="" src="' . $headerPrefix . '/graphics/' . $subTool->image . '"> ' . $subTool->name; | ||||
| 								echo "</a>\n"; | ||||
| 								echo "</li>\n"; | ||||
| 							} | ||||
| 							echo "</ul>\n"; | ||||
| 						} | ||||
| 						echo "</li>\n"; | ||||
| 					} | ||||
| 				?>
 | ||||
| 			</ul> | ||||
| 		</li> | ||||
| 		<?php | ||||
| 		} | ||||
| 		if ($_SESSION['config']->get_Suffix('tree') != "") { | ||||
| 		?>
 | ||||
| 	    <li> | ||||
| 			<a href="<?php echo $headerPrefix; ?>/templates/tree/treeViewContainer.php"><img class="align-middle" height="16" width="16" alt="tree" src="<?php echo $headerPrefix; ?>/graphics/process.png"><span class="hide-on-mobile padding0"> <?php echo _("Tree view") ?></span></a>
 | ||||
| 		</li> | ||||
| 		<?php | ||||
| 		} | ||||
| 		?>
 | ||||
| 	</ul> | ||||
| 	</td> | ||||
| 	</tr> | ||||
| </table> | ||||
| 
 | ||||
| <script type="text/javascript"> | ||||
| jQuery(document).ready(function() { | ||||
| 	jQuery('#dropmenu').dropmenu({ | ||||
| 		effect  : 'slide', | ||||
| 		nbsp    : true, | ||||
| 		timeout : 350, | ||||
| 		speed   : 'fast' | ||||
| 	}); | ||||
| }); | ||||
| </script> | ||||
| 
 | ||||
| <br> | ||||
| <div class="ui-tabs ui-widget ui-widget-content ui-corner-all"> | ||||
| <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"> | ||||
| 	<?php | ||||
| 		printTypeTabs($headerPrefix); | ||||
| 	?>
 | ||||
| </ul> | ||||
| 
 | ||||
| <?php | ||||
| 
 | ||||
| function printTypeTabs($headerPrefix) { | ||||
| 	$typeManager = new \LAM\TYPES\TypeManager(); | ||||
| 	$types = $typeManager->getConfiguredTypes(); | ||||
| 	foreach ($types as $type) { | ||||
| 		if ($type->isHidden()) { | ||||
| 			continue; | ||||
| 		} | ||||
| 		$link = '<a href="' . $headerPrefix . '/templates/lists/list.php?type=' . $type->getId() . | ||||
| 		'" onmouseover="jQuery(this).addClass(\'tabs-hover\');" onmouseout="jQuery(this).removeClass(\'tabs-hover\');">' . | ||||
| 		'<img height="16" width="16" alt="' . $type->getId() . '" src="' . $headerPrefix . '/graphics/' . $type->getIcon() . '"> ' . | ||||
| 		$type->getAlias() . '</a>'; | ||||
| 		echo '<li id="tab_' . $type->getId() . '" class="ui-state-default ui-corner-top">'; | ||||
| 		echo $link; | ||||
| 		echo "</li>\n"; | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -2,11 +2,11 @@ | |||
| use \LAM\PDF\PDFLabelValue; | ||||
| use \LAM\PDF\PDFTable; | ||||
| use LAM\TYPES\ConfiguredType; | ||||
| use function LAM\TYPES\getScopeFromTypeId; | ||||
| /* | ||||
| $Id$ | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2003 - 2017  Roland Gruber | ||||
|   Copyright (C) 2003 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -168,7 +168,9 @@ abstract class baseModule { | |||
| 			} | ||||
| 		} | ||||
| 		// load attributes
 | ||||
| 		$attributeNames = $this->getManagedAttributes($typeId); | ||||
| 		$attributeNames = array_merge($this->getManagedAttributes($typeId), $this->getManagedHiddenAttributes($typeId)); | ||||
| 		$attributeNames = array_unique($attributeNames); | ||||
| 		$attributeNames = array_values($attributeNames); | ||||
| 		for ($i = 0; $i < sizeof($attributeNames); $i++) { | ||||
| 			if (isset($attributes[$attributeNames[$i]])) { | ||||
| 				$this->attributes[$attributeNames[$i]] = $attributes[$attributeNames[$i]]; | ||||
|  | @ -424,11 +426,12 @@ abstract class baseModule { | |||
| 	* <br> | ||||
| 	* <b>Example:</b> return array('or' => '(objectClass=posixAccount)', 'and' => '(!(uid=*$))') | ||||
| 	* | ||||
| 	* @param string $typeId account type id | ||||
| 	* @return string LDAP filter | ||||
| 	* | ||||
| 	* @see baseModule::get_metaData() | ||||
| 	*/ | ||||
| 	public function get_ldap_filter() { | ||||
| 	public function get_ldap_filter($typeId) { | ||||
| 		if (isset($this->meta['ldap_filter'])) return $this->meta['ldap_filter']; | ||||
| 		else return ""; | ||||
| 	} | ||||
|  | @ -638,7 +641,7 @@ abstract class baseModule { | |||
| 	* We recommend to use the module name as prefix for them (e.g. posixAccount_homeDirectory) to avoid naming conflicts. | ||||
| 	* | ||||
| 	* @param array $scopes account types (user, group, host) | ||||
| 	* @param array $allScopes list of all active account modules and their scopes (module => array(scopes)) | ||||
| 	* @param array $allScopes list of all active account modules and their account type id (module => array(type id)) | ||||
| 	* @return mixed htmlElement or array of htmlElement | ||||
| 	* | ||||
| 	* @see baseModule::get_metaData() | ||||
|  | @ -681,15 +684,20 @@ abstract class baseModule { | |||
| 	* If the input data is invalid the return value is an array that contains subarrays to build StatusMessages ('message type', 'message head', 'message text'). | ||||
| 	* <br>If no errors occured the function returns an empty array. | ||||
| 	* | ||||
| 	* @param array $scopes list of account types which are used | ||||
| 	* @param array $typeIds list of account type ids which are used | ||||
| 	* @param array $options hash array (option name => value) that contains the input. The option values are all arrays containing one or more elements. | ||||
| 	* @return array list of error messages | ||||
| 	* | ||||
| 	* @see baseModule::get_metaData() | ||||
| 	*/ | ||||
| 	public function check_configOptions($scopes, &$options) { | ||||
| 	public function check_configOptions($typeIds, &$options) { | ||||
| 		$messages = array(); | ||||
| 		$scopes[] = 'all'; // add checks that are independent of scope
 | ||||
| 		// add checks that are independent of scope
 | ||||
| 		$scopes = array('all'); | ||||
| 		foreach ($typeIds as $typeId) { | ||||
| 			$scopes[] = getScopeFromTypeId($typeId); | ||||
| 		} | ||||
| 		$scopes = array_unique($scopes); | ||||
| 		for ($s = 0; $s < sizeof($scopes); $s++) { | ||||
| 			if (isset($this->meta['config_checks'][$scopes[$s]]) && is_array($this->meta['config_checks'][$scopes[$s]])) { | ||||
| 				$identifiers = array_keys($this->meta['config_checks'][$scopes[$s]]); | ||||
|  | @ -1586,11 +1594,12 @@ abstract class baseModule { | |||
| 	/** | ||||
| 	 * Returns a list of operational LDAP attributes which are managed by this module and need to be explicitly set for LDAP search. | ||||
| 	 * | ||||
| 	 * @param string $typeId account type id | ||||
| 	 * @return array list of hidden attributes | ||||
| 	 * | ||||
| 	 * @see baseModule::get_metaData() | ||||
| 	 */ | ||||
| 	public function getManagedHiddenAttributes() { | ||||
| 	public function getManagedHiddenAttributes($typeId) { | ||||
| 		if (isset($this->meta['hiddenAttributes']) && is_array($this->meta['hiddenAttributes'])) return $this->meta['hiddenAttributes']; | ||||
| 		else return array(); | ||||
| 	} | ||||
|  |  | |||
|  | @ -435,6 +435,9 @@ class LAMConfig { | |||
| 	/** use paged results */ | ||||
| 	private $pagedResults = 'false'; | ||||
| 
 | ||||
| 	/** overlay for referential integrity is activated */ | ||||
| 	private $referentialIntegrityOverlay = 'false'; | ||||
| 
 | ||||
| 	/** Array of string: users with admin rights */ | ||||
| 	private $Admins; | ||||
| 
 | ||||
|  | @ -589,7 +592,7 @@ class LAMConfig { | |||
| 		'pwdResetAllowScreenPassword', 'pwdResetForcePasswordChange', 'pwdResetDefaultPasswordOutput', | ||||
| 		'scriptUserName', 'scriptSSHKey', 'scriptSSHKeyPassword', 'twoFactorAuthentication', 'twoFactorAuthenticationURL', | ||||
| 		'twoFactorAuthenticationInsecure', 'twoFactorAuthenticationLabel', 'twoFactorAuthenticationOptional', | ||||
| 		'twoFactorAuthenticationCaption' | ||||
| 		'twoFactorAuthenticationCaption', 'referentialIntegrityOverlay' | ||||
| 	); | ||||
| 
 | ||||
| 
 | ||||
|  | @ -799,6 +802,7 @@ class LAMConfig { | |||
| 			if (!in_array("useTLS", $saved)) array_push($file_array, "\n\n# enable TLS encryption\n" . "useTLS: " . $this->useTLS . "\n"); | ||||
| 			if (!in_array("followReferrals", $saved)) array_push($file_array, "\n\n# follow referrals\n" . "followReferrals: " . $this->followReferrals . "\n"); | ||||
| 			if (!in_array("pagedResults", $saved)) array_push($file_array, "\n\n# paged results\n" . "pagedResults: " . $this->pagedResults . "\n"); | ||||
| 			if (!in_array("referentialIntegrityOverlay", $saved)) array_push($file_array, "\n" . "referentialIntegrityOverlay: " . $this->referentialIntegrityOverlay . "\n"); | ||||
| 			if (!in_array("Passwd", $saved)) array_push($file_array, "\n\n# password to change these preferences via webfrontend\n" . "Passwd: " . $this->Passwd . "\n"); | ||||
| 			if (!in_array("Admins", $saved)) array_push($file_array, "\n\n# list of users who are allowed to use LDAP Account Manager\n" . | ||||
| 								"# names have to be seperated by semicolons\n" . | ||||
|  | @ -1034,6 +1038,33 @@ class LAMConfig { | |||
| 		$this->pagedResults = $pagedResults; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Returns if referential integrity overlay is in place. | ||||
| 	 * | ||||
| 	 * @return String true or false | ||||
| 	 */ | ||||
| 	public function getReferentialIntegrityOverlay() { | ||||
| 		return $this->referentialIntegrityOverlay; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Sets if referential integrity overlay is in place. | ||||
| 	 * | ||||
| 	 * @param String $referentialIntegrityOverlay true or false | ||||
| 	 */ | ||||
| 	public function setReferentialIntegrityOverlay($referentialIntegrityOverlay) { | ||||
| 		$this->referentialIntegrityOverlay = $referentialIntegrityOverlay; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Returns if referential integrity overlay is in place. | ||||
| 	 * | ||||
| 	 * @return bool overlay in place | ||||
| 	 */ | ||||
| 	public function isReferentialIntegrityOverlayActive() { | ||||
| 		return $this->referentialIntegrityOverlay === 'true'; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	* Returns an array of string with all admin names | ||||
| 	* | ||||
|  |  | |||
							
								
								
									
										126
									
								
								lam/lib/html.inc
								
								
								
								
							
							
						
						|  | @ -2,7 +2,7 @@ | |||
| /* | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2010 - 2017  Roland Gruber | ||||
|   Copyright (C) 2010 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -61,6 +61,8 @@ abstract class htmlElement { | |||
| 	protected $cssClasses = array(); | ||||
| 	/** table cell CSS classes */ | ||||
| 	protected $tableCellCssClasses = array(); | ||||
| 	/** data attributes */ | ||||
| 	private $dataAttributes = array(); | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Prints the HTML code for this element. | ||||
|  | @ -155,6 +157,29 @@ abstract class htmlElement { | |||
| 		return $this->tableCellCssClasses; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Adds a data attribute. | ||||
| 	 * | ||||
| 	 * @param string $key attribute name (without "data-") | ||||
| 	 * @param string $value attribute value | ||||
| 	 */ | ||||
| 	public function addDataAttribute($key, $value) { | ||||
| 		$this->dataAttributes[$key] = $value; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Returns the data attributes as rendered string. | ||||
| 	 * | ||||
| 	 * @return string data attributes | ||||
| 	 */ | ||||
| 	protected function getDataAttributesAsString() { | ||||
| 		$result = ''; | ||||
| 		foreach ($this->dataAttributes as $key => $value) { | ||||
| 			$result .= ' data-' . htmlspecialchars($key) . '="' . htmlspecialchars($value) . '"'; | ||||
| 		} | ||||
| 		return $result; | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  | @ -1254,7 +1279,9 @@ class htmlSelect extends htmlElement { | |||
| 			echo '<div class="hidden">'; | ||||
| 		} | ||||
| 		// print select box
 | ||||
| 		echo '<select' . $class . $style . $name . $size . $multi . $disabled . $onchange . ' tabindex="' . $tabindex . "\">\n"; | ||||
| 		echo '<select' . $this->getDataAttributesAsString() . $class . $style | ||||
| 				. $name . $size . $multi . $disabled . $onchange | ||||
| 				. ' tabindex="' . $tabindex . "\">\n"; | ||||
| 		$tabindex++; | ||||
| 		if ($this->containsOptgroups) { | ||||
| 			foreach ($this->elements as $label => $elements) { | ||||
|  | @ -1926,22 +1953,23 @@ class htmlInputCheckbox extends htmlElement { | |||
| 		// build Java script to show/hide depending fields
 | ||||
| 		$onChange = ''; | ||||
| 		$script = ''; | ||||
| 		$selector = $this->getShowHideSelector(); | ||||
| 		if ((sizeof($this->tableRowsToShow) > 0) || (sizeof($this->tableRowsToHide) > 0)) { | ||||
| 			// build onChange listener
 | ||||
| 			$onChange .= 'if (jQuery(\'#' . $this->name . ':checked\').val() !== undefined) {'; | ||||
| 			for ($i = 0; $i < sizeof($this->tableRowsToShow); $i++) { | ||||
| 				$onChange .= 'jQuery(\'#' . $this->tableRowsToShow[$i] . '\').closest(\'tr\').removeClass(\'hidden\');'; | ||||
| 				$onChange .= 'jQuery(\'#' . $this->tableRowsToShow[$i] . '\').closest(\'' . $selector . '\').removeClass(\'hidden\');'; | ||||
| 			} | ||||
| 			for ($i = 0; $i < sizeof($this->tableRowsToHide); $i++) { | ||||
| 				$onChange .= 'jQuery(\'#' . $this->tableRowsToHide[$i] . '\').closest(\'tr\').addClass(\'hidden\');'; | ||||
| 				$onChange .= 'jQuery(\'#' . $this->tableRowsToHide[$i] . '\').closest(\'' . $selector . '\').addClass(\'hidden\');'; | ||||
| 			} | ||||
| 			$onChange .= '}'; | ||||
| 			$onChange .= 'else {'; | ||||
| 			for ($i = 0; $i < sizeof($this->tableRowsToShow); $i++) { | ||||
| 				$onChange .= 'jQuery(\'#' . $this->tableRowsToShow[$i] . '\').closest(\'tr\').addClass(\'hidden\');'; | ||||
| 				$onChange .= 'jQuery(\'#' . $this->tableRowsToShow[$i] . '\').closest(\'' . $selector . '\').addClass(\'hidden\');'; | ||||
| 			} | ||||
| 			for ($i = 0; $i < sizeof($this->tableRowsToHide); $i++) { | ||||
| 				$onChange .= 'jQuery(\'#' . $this->tableRowsToHide[$i] . '\').closest(\'tr\').removeClass(\'hidden\');'; | ||||
| 				$onChange .= 'jQuery(\'#' . $this->tableRowsToHide[$i] . '\').closest(\'' . $selector . '\').removeClass(\'hidden\');'; | ||||
| 			} | ||||
| 			$onChange .= '};'; | ||||
| 			// build script to set initial state
 | ||||
|  | @ -1951,14 +1979,14 @@ class htmlInputCheckbox extends htmlElement { | |||
| 				if ($this->checked) { | ||||
| 					$classType = 'removeClass'; | ||||
| 				} | ||||
| 				$script .= 'jQuery(\'#' . $this->tableRowsToShow[$i] . '\').closest(\'tr\').' . $classType . '(\'hidden\');'; | ||||
| 				$script .= 'jQuery(\'#' . $this->tableRowsToShow[$i] . '\').closest(\'' . $selector . '\').' . $classType . '(\'hidden\');'; | ||||
| 			} | ||||
| 			for ($i = 0; $i < sizeof($this->tableRowsToHide); $i++) { | ||||
| 				$classType = 'removeClass'; | ||||
| 				if ($this->checked) { | ||||
| 					$classType = 'addClass'; | ||||
| 				} | ||||
| 				$script .= 'jQuery(\'#' . $this->tableRowsToHide[$i] . '\').closest(\'tr\').' . $classType . '(\'hidden\');'; | ||||
| 				$script .= 'jQuery(\'#' . $this->tableRowsToHide[$i] . '\').closest(\'' . $selector . '\').' . $classType . '(\'hidden\');'; | ||||
| 			} | ||||
| 			$script .= '});</script>'; | ||||
| 		} | ||||
|  | @ -2078,6 +2106,13 @@ class htmlInputCheckbox extends htmlElement { | |||
| 		$this->elementsToEnable = $elements; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Returns the CSS selector to use to find show/hide elements. | ||||
| 	 */ | ||||
| 	protected function getShowHideSelector() { | ||||
| 		return '.tr'; | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  | @ -2273,7 +2308,7 @@ class htmlInputTextarea extends htmlElement { | |||
| 	/** enabled or disabled */ | ||||
| 	private $isEnabled = true; | ||||
| 	/** specifies if LAM should display this field whith a WYSIWYG editor */ | ||||
| 	private $richEdit = false; | ||||
| 	protected $richEdit = false; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Constructor. | ||||
|  | @ -3574,6 +3609,8 @@ class htmlResponsiveRow extends htmlElement { | |||
| 
 | ||||
| 	/** @var htmlResponsiveCell[] cells */ | ||||
| 	private $cells = array(); | ||||
| 	/** HTML ID */ | ||||
| 	private $id = null; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Creates a new responsive row. | ||||
|  | @ -3591,6 +3628,15 @@ class htmlResponsiveRow extends htmlElement { | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Sets the HTML id. | ||||
| 	 * | ||||
| 	 * @param string $id ID | ||||
| 	 */ | ||||
| 	public function setId($id) { | ||||
| 		$this->id = $id; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Adds a responsive cell to the row. | ||||
| 	 * | ||||
|  | @ -3619,16 +3665,17 @@ class htmlResponsiveRow extends htmlElement { | |||
| 	 * Adds the content as a typical label with 12/6/6 columns and CSS class "responsiveLabel".
 | ||||
| 	 * | ||||
| 	 * @param htmlElement $content label | ||||
| 	 * @param string $cssClasses additional CSS classes | ||||
| 	 */ | ||||
| 	public function addLabel($content) { | ||||
| 		$this->add($content, 12, 6, 6, 'responsiveLabel nowrap'); | ||||
| 	public function addLabel($content, $cssClasses = '') { | ||||
| 		$this->add($content, 12, 6, 6, 'responsiveLabel nowrap ' . $cssClasses); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Adds the content as a typical field with 12/6/6 columns and CSS class "responsiveField".
 | ||||
| 	 * | ||||
| 	 * @param htmlElement $content field | ||||
| 	 * @param $cssClasses CSS class names separated by space | ||||
| 	 * @param string $cssClasses CSS class names separated by space | ||||
| 	 */ | ||||
| 	public function addField($content, $cssClasses = '') { | ||||
| 		$this->add($content, 12, 6, 6, 'responsiveField ' . $cssClasses); | ||||
|  | @ -3648,7 +3695,11 @@ class htmlResponsiveRow extends htmlElement { | |||
| 	public function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) { | ||||
| 		$return = array(); | ||||
| 		$cssClasses = implode(' ', $this->cssClasses); | ||||
| 		echo '<div class="row ' . $cssClasses . '">'; | ||||
| 		$idParam = ''; | ||||
| 		if ($this->id !== null) { | ||||
| 			$idParam = ' id="' . $this->id . '"'; | ||||
| 		} | ||||
| 		echo '<div class="row ' . $cssClasses . '"' . $idParam . '>'; | ||||
| 		foreach ($this->cells as $cell) { | ||||
| 			$return = array_merge($return, $cell->generateHTML($module, $input, $values, $restricted, $tabindex, $scope)); | ||||
| 		} | ||||
|  | @ -3808,6 +3859,8 @@ class htmlResponsiveInputTextarea extends htmlInputTextarea { | |||
| 	private $label; | ||||
| 	/** help ID */ | ||||
| 	private $helpID; | ||||
| 	/** help module */ | ||||
| 	private $helpModule = null; | ||||
| 	/** required field */ | ||||
| 	private $required = false; | ||||
| 	/** render HTML of parent class */ | ||||
|  | @ -3821,12 +3874,18 @@ class htmlResponsiveInputTextarea extends htmlInputTextarea { | |||
| 	 * @param int $colCount number of characters per line | ||||
| 	 * @param int $rowCount number of rows | ||||
| 	 * @param String $label descriptive label | ||||
| 	 * @param String $helpID help ID | ||||
| 	 * @param String|array $helpID help ID | ||||
| 	 */ | ||||
| 	function __construct($name, $value, $colCount, $rowCount, $label, $helpID = null) { | ||||
| 		parent::__construct($name, $value, $colCount, $rowCount); | ||||
| 		$this->label = htmlspecialchars($label); | ||||
| 		$this->helpID = $helpID; | ||||
| 		if (is_string($helpID)) { | ||||
| 			$this->helpID = $helpID; | ||||
| 		} | ||||
| 		elseif (is_array($helpID)) { | ||||
| 			$this->helpID = $helpID[0]; | ||||
| 			$this->helpModule = $helpID[1]; | ||||
| 		} | ||||
| 		$this->alignment = htmlElement::ALIGN_TOP; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -3850,16 +3909,20 @@ class htmlResponsiveInputTextarea extends htmlInputTextarea { | |||
| 			$labelGroup->addElement(new htmlImage($graphicsPath . '/required.png', 16, 16, _('required'), _('required'))); | ||||
| 		} | ||||
| 		if (!empty($this->helpID)) { | ||||
| 			$helpLinkLabel = new htmlHelpLink($this->helpID); | ||||
| 			$helpLinkLabel->setCSSClasses(array('hide-on-tablet', 'margin-left5')); | ||||
| 			$helpLinkLabel = new htmlHelpLink($this->helpID, $this->helpModule); | ||||
| 			$helpCssClasses = array('margin-left5'); | ||||
| 			if (!$this->richEdit) { | ||||
| 				$helpCssClasses[] = 'hide-on-tablet'; | ||||
| 			} | ||||
| 			$helpLinkLabel->setCSSClasses($helpCssClasses); | ||||
| 			$labelGroup->addElement($helpLinkLabel); | ||||
| 		} | ||||
| 		$row->add($labelGroup, 12, 6, 6, 'responsiveLabel'); | ||||
| 		// input field
 | ||||
| 		$fieldGroup = new htmlGroup(); | ||||
| 		$fieldGroup->addElement($this); | ||||
| 		if (!empty($this->helpID)) { | ||||
| 			$helpLink = new htmlHelpLink($this->helpID); | ||||
| 		if (!empty($this->helpID) && !$this->richEdit) { | ||||
| 			$helpLink = new htmlHelpLink($this->helpID, $this->helpModule); | ||||
| 			$helpLink->setCSSClasses(array('align-top', 'hide-on-mobile')); | ||||
| 			$fieldGroup->addElement($helpLink); | ||||
| 		} | ||||
|  | @ -4095,6 +4158,14 @@ class htmlResponsiveInputCheckbox extends htmlInputCheckbox { | |||
| 		return $row->generateHTML($module, $input, $values, $restricted, $tabindex, $scope); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * {@inheritDoc} | ||||
| 	 * @see htmlInputCheckbox::getShowHideSelector() | ||||
| 	 */ | ||||
| 	protected function getShowHideSelector() { | ||||
| 		return '.row'; | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  | @ -4113,15 +4184,22 @@ class htmlResponsiveTable extends htmlElement { | |||
| 	/** widthes of the columns */ | ||||
| 	private $widths = array(); | ||||
| 
 | ||||
| 	/** highlighted rows */ | ||||
| 	private $highlighted = array(); | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Creates the table. | ||||
| 	 * | ||||
| 	 * @param string[] $titles row titles | ||||
| 	 * @param htmlElement[][] $data data rows | ||||
| 	 * @param int[] $highlighted list of row numbers that should be highlighted (starting at 0) | ||||
| 	 */ | ||||
| 	public function __construct($titles, $data) { | ||||
| 	public function __construct($titles, $data, $highlighted = null) { | ||||
| 		$this->titles = $titles; | ||||
| 		$this->data = $data; | ||||
| 		if (!empty($highlighted) && is_array($highlighted)) { | ||||
| 			$this->highlighted = $highlighted; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
|  | @ -4146,8 +4224,13 @@ class htmlResponsiveTable extends htmlElement { | |||
| 		echo '</thead>'; | ||||
| 		echo '<tbody>'; | ||||
| 		$titleCount = sizeof($this->titles); | ||||
| 		$counter = 0; | ||||
| 		foreach ($this->data as $row) { | ||||
| 			echo '<tr>'; | ||||
| 			$cssClass = ''; | ||||
| 			if (in_array($counter, $this->highlighted)) { | ||||
| 				$cssClass = ' class="bold"'; | ||||
| 			} | ||||
| 			echo '<tr ' . $cssClass . '>'; | ||||
| 			for ($i = 0; $i < $titleCount; $i++) { | ||||
| 				echo '<td data-label="' . $this->titles[$i] . '">'; | ||||
| 				$ids = parseHtml($module, $row[$i], $values, $restricted, $tabindex, $scope); | ||||
|  | @ -4155,6 +4238,7 @@ class htmlResponsiveTable extends htmlElement { | |||
| 				echo '</td>'; | ||||
| 			} | ||||
| 			echo '</tr>'; | ||||
| 			$counter++; | ||||
| 		} | ||||
| 		echo '</tbody>'; | ||||
| 		echo '</table>'; | ||||
|  |  | |||
|  | @ -101,7 +101,7 @@ function get_ldap_filter($typeId) { | |||
| 	$orFilter = ''; | ||||
| 	for ($i = 0; $i < sizeof($mods); $i++) { | ||||
| 		$module = moduleCache::getModule($mods[$i], $type->getScope()); | ||||
| 		$modinfo = $module->get_ldap_filter(); | ||||
| 		$modinfo = $module->get_ldap_filter($typeId); | ||||
| 		if (isset($modinfo['or'])) { | ||||
| 			$filters['or'][] = $modinfo['or']; | ||||
| 		} | ||||
|  | @ -360,7 +360,7 @@ function getConfigOptions($scopes) { | |||
| /** | ||||
| * Checks if the configuration options are valid | ||||
| * | ||||
| * @param array $scopes hash array (module name => array(account types)) | ||||
| * @param array $scopes hash array (module name => array(account type ids)) | ||||
| * @param array $options hash array containing all options (name => array(...)) | ||||
| * @return array list of error messages | ||||
| */ | ||||
|  | @ -1581,7 +1581,7 @@ class accountContainer { | |||
| 		$searchAttrs = array('*', '+'); | ||||
| 		foreach ($modules as $module) { | ||||
| 			$modTmp = new $module($this->type->getScope()); | ||||
| 			$searchAttrs = array_merge($searchAttrs, $modTmp->getManagedHiddenAttributes()); | ||||
| 			$searchAttrs = array_merge($searchAttrs, $modTmp->getManagedHiddenAttributes($this->type->getId())); | ||||
| 		} | ||||
| 		$result = @ldap_read($_SESSION['ldap']->server(), escapeDN($dn), escapeDN($search), $searchAttrs, 0, 0, 0, LDAP_DEREF_NEVER); | ||||
| 		if (!$result) { | ||||
|  |  | |||
|  | @ -36,3 +36,5 @@ | |||
| /zarafaUser.inc | ||||
| /locking389ds.inc | ||||
| /kopano*.inc | ||||
| /dynamicList.inc | ||||
| /customBaseType.inc | ||||
|  |  | |||
|  | @ -245,9 +245,8 @@ class asteriskAccount extends baseModule implements passwordService { | |||
| 			), | ||||
| 		); | ||||
| 		// self service options
 | ||||
| 		$selfServiceContainer = new htmlTable(); | ||||
| 		$selfServiceContainer->addElement(new htmlTableExtendedInputField(_('Asterisk realm'), 'asteriskAccount_AsteriskRealm', null)); | ||||
| 		$selfServiceContainer->addElement(new htmlHelpLink('AsteriskRealm', get_class($this))); | ||||
| 		$selfServiceContainer = new htmlResponsiveRow(); | ||||
| 		$selfServiceContainer->add(new htmlResponsiveInputField(_('Asterisk realm'), 'asteriskAccount_AsteriskRealm', null, array('AsteriskRealm', get_class($this))), 12); | ||||
| 		$return['selfServiceSettings'] = $selfServiceContainer; | ||||
| 		// profile options
 | ||||
| 		$profileContainer = new htmlTable(); | ||||
|  |  | |||
|  | @ -497,21 +497,11 @@ class imapAccess extends baseModule { | |||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	* Checks input values of module settings. | ||||
| 	* | ||||
| 	* Calling this method does not require the existence of an enclosing {@link accountContainer}.<br> | ||||
| 	* <br> | ||||
| 	* If the input data is invalid the return value is an array that contains subarrays to build StatusMessages ('message type', 'message head', 'message text'). | ||||
| 	* <br>If no errors occured the function returns an empty array. | ||||
| 	* | ||||
| 	* @param array $scopes list of account types which are used | ||||
| 	* @param array $options hash array (option name => value) that contains the input. The option values are all arrays containing one or more elements. | ||||
| 	* @return array list of error messages | ||||
| 	* | ||||
| 	* @see baseModule::get_metaData() | ||||
| 	*/ | ||||
| 	public function check_configOptions($scopes, &$options) { | ||||
| 		$errors = parent::check_configOptions($scopes, $options); | ||||
| 	 * {@inheritDoc} | ||||
| 	 * @see baseModule::check_configOptions() | ||||
| 	 */ | ||||
| 	public function check_configOptions($typeIds, &$options) { | ||||
| 		$errors = parent::check_configOptions($typeIds, $options); | ||||
| 		if ($options['ImapAccess_ImapAdminPasswordSelect'][0] == 'config') { | ||||
| 			if (empty($options['ImapAccess_ImapAdminPassword'][0])) { | ||||
| 				$errors[] = $this->messages['config'][2]; | ||||
|  |  | |||
|  | @ -2433,18 +2433,13 @@ class inetOrgPerson extends baseModule implements passwordService { | |||
| 	 * @return htmlElement meta HTML object | ||||
| 	 */ | ||||
| 	public function getSelfServiceSettings($profile) { | ||||
| 		$container = new htmlTable(); | ||||
| 		$container->addElement(new htmlSubTitle(_('Photo')), true); | ||||
| 		$photoTable = new htmlTable(); | ||||
| 		$photoTable->colspan = 2; | ||||
| 		$container = new htmlResponsiveRow(); | ||||
| 		$container->add(new htmlSubTitle(_('Photo')), 12); | ||||
| 		if (extension_loaded('imagick')) { | ||||
| 			$photoTable->addElement(new htmlTableExtendedInputField(_('Maximum width (px)'), 'inetOrgPerson_jpegPhoto_maxWidth')); | ||||
| 			$photoTable->addElement(new htmlHelpLink('crop', get_class($this)), true); | ||||
| 			$photoTable->addElement(new htmlTableExtendedInputField(_('Maximum height (px)'), 'inetOrgPerson_jpegPhoto_maxHeight')); | ||||
| 			$photoTable->addElement(new htmlHelpLink('crop', get_class($this)), true); | ||||
| 			$container->add(new htmlResponsiveInputField(_('Maximum width (px)'), 'inetOrgPerson_jpegPhoto_maxWidth', null, array('crop', get_class($this))), 12); | ||||
| 			$container->add(new htmlResponsiveInputField(_('Maximum height (px)'), 'inetOrgPerson_jpegPhoto_maxHeight', null, array('crop', get_class($this))), 12); | ||||
| 		} | ||||
| 		$photoTable->addElement(new htmlTableExtendedInputField(_('Maximum file size (kB)'), 'inetOrgPerson_jpegPhoto_maxSize'), true); | ||||
| 		$container->addElement($photoTable, true); | ||||
| 		$container->add(new htmlResponsiveInputField(_('Maximum file size (kB)'), 'inetOrgPerson_jpegPhoto_maxSize'), 12); | ||||
| 		return $container; | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,5 +1,6 @@ | |||
| <?php | ||||
| use \LAM\TYPES\TypeManager; | ||||
| use function LAM\TYPES\getScopeFromTypeId; | ||||
| /* | ||||
| 	$Id$ | ||||
| 
 | ||||
|  | @ -178,16 +179,11 @@ class posixAccount extends baseModule implements passwordService { | |||
| 			// possible self service read-only fields
 | ||||
| 			$return['selfServiceReadOnlyFields'] = array('cn', 'loginShell'); | ||||
| 			// self service configuration settings
 | ||||
| 			$selfServiceContainer = new htmlTable(); | ||||
| 			$selfServiceContainer->addElement(new htmlTableExtendedSelect('posixAccount_pwdHash', getSupportedHashTypes(), | ||||
| 				array('SSHA'), _("Password hash type"))); | ||||
| 			$selfServiceContainer->addElement(new htmlHelpLink('pwdHash', get_class($this)), true); | ||||
| 			$selfServiceContainer->addElement(new htmlTableExtendedInputTextarea('posixAccount_shells', implode("\r\n", $this->getShells()), 30, 4, _('Login shells'))); | ||||
| 			$loginShellsHelp = new htmlHelpLink('loginShells', get_class($this)); | ||||
| 			$loginShellsHelp->alignment = htmlElement::ALIGN_TOP; | ||||
| 			$selfServiceContainer->addElement($loginShellsHelp, true); | ||||
| 			$selfServiceContainer->addElement(new htmlTableExtendedInputCheckbox('posixAccount_useOldPwd', false, _('Password change with old password'))); | ||||
| 			$selfServiceContainer->addElement(new htmlHelpLink('useOldPwd', get_class($this)), true); | ||||
| 			$selfServiceContainer = new htmlResponsiveRow(); | ||||
| 			$selfServiceContainer->add(new htmlResponsiveSelect('posixAccount_pwdHash', getSupportedHashTypes(), | ||||
| 				array('SSHA'), _("Password hash type"), array('pwdHash', get_class($this))), 12); | ||||
| 			$selfServiceContainer->add(new htmlResponsiveInputTextarea('posixAccount_shells', implode("\r\n", $this->getShells()), 30, 4, _('Login shells'), array('loginShells', get_class($this))), 12); | ||||
| 			$selfServiceContainer->add(new htmlResponsiveInputCheckbox('posixAccount_useOldPwd', false, _('Password change with old password'), array('useOldPwd', get_class($this))), 12); | ||||
| 			$return['selfServiceSettings'] = $selfServiceContainer; | ||||
| 		} | ||||
| 		// profile checks
 | ||||
|  | @ -908,6 +904,11 @@ class posixAccount extends baseModule implements passwordService { | |||
| 		for ($i = 0; $i < sizeof($groups); $i++) { | ||||
| 			$return[$groups[$i]['dn']]['remove']['memberUid'][] = $this->attributes['uid'][0]; | ||||
| 		} | ||||
| 		// stop here if referential integrity overlay is active
 | ||||
| 		$config = $this->getAccountContainer()->get_type()->getTypeManager()->getConfig(); | ||||
| 		if ($config->isReferentialIntegrityOverlayActive()) { | ||||
| 			return $return; | ||||
| 		} | ||||
| 		// remove from group of names
 | ||||
| 		$dn = $this->getAccountContainer()->dn_orig; | ||||
| 		$gons = searchLDAPByFilter('(|(member=' . $dn . ')(uniqueMember=' . $dn . '))', array('member', 'uniqueMember'), array('group', 'gon')); | ||||
|  | @ -2031,15 +2032,15 @@ class posixAccount extends baseModule implements passwordService { | |||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	* Checks input values of module settings. | ||||
| 	* | ||||
| 	* @param array $scopes list of account types which are used | ||||
| 	* @param array $options hash array containing the settings (array('option' => array('value'))) | ||||
| 	* @return array list of error messages | ||||
| 	*/ | ||||
| 	function check_configOptions($scopes, &$options) { | ||||
| 	 * {@inheritDoc} | ||||
| 	 * @see baseModule::check_configOptions() | ||||
| 	 */ | ||||
| 	function check_configOptions($typeIds, &$options) { | ||||
| 		$return = array(); | ||||
| 		// user settings
 | ||||
| 		$scopes = array(); | ||||
| 		foreach ($typeIds as $typeId) { | ||||
| 			$scopes[] = getScopeFromTypeId($typeId); | ||||
| 		}		// user settings
 | ||||
| 		if (in_array('user', $scopes)) { | ||||
| 			if ($options['posixAccount_uidGeneratorUsers'][0] == 'range') { | ||||
| 				// min/maxUID are required, check if they are numeric
 | ||||
|  | @ -3244,7 +3245,7 @@ class posixAccount extends baseModule implements passwordService { | |||
| 				$wc = substr($wildcards[0][$i], 1, strlen($wildcards[0][$i]) - 2); | ||||
| 				$value = ''; | ||||
| 				if (isset($attributes[$wc][0]) && !empty($attributes[$wc][0])) { | ||||
| 					$value = $attributes[$wc][0][0]; | ||||
| 					$value = $this->cleanSuggestionPart($attributes[$wc][0][0]); | ||||
| 				} | ||||
| 				$format = str_replace('@' . $wc . '@', $value, $format); | ||||
| 			} | ||||
|  | @ -3256,16 +3257,26 @@ class posixAccount extends baseModule implements passwordService { | |||
| 				$wc = substr($wildcards[0][$i], 1, strlen($wildcards[0][$i]) - 2); | ||||
| 				$value = ''; | ||||
| 				if (isset($attributes[$wc][0])) { | ||||
| 					$value = $attributes[$wc][0]; | ||||
| 					$value = $this->cleanSuggestionPart($attributes[$wc][0]); | ||||
| 				} | ||||
| 				$format = str_replace('%' . $wc . '%', $value, $format); | ||||
| 			} | ||||
| 		} | ||||
| 		$format = str_replace(array_keys($this->umlautReplacements), array_values($this->umlautReplacements), strtolower($format)); | ||||
| 		$format = str_replace(array(' ', '_', '-'), array('', '', ''), $format); | ||||
| 		return $format; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Cleans a string that is injected in user name suggestion. | ||||
| 	 * | ||||
| 	 * @param string $part injected part | ||||
| 	 * @return string cleaned by removing umlauts, spaces, dashes and underscores | ||||
| 	 */ | ||||
| 	private function cleanSuggestionPart($part) { | ||||
| 		$result = str_replace(array_keys($this->umlautReplacements), array_values($this->umlautReplacements), strtolower($part)); | ||||
| 		$result = str_replace(array(' ', '_', '-'), array('', '', ''), $result); | ||||
| 		return $result; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Returns if this account can be locked. | ||||
| 	 * This is the case if a hashed password is set ("{" at the beginning). | ||||
|  |  | |||
|  | @ -1,11 +1,12 @@ | |||
| <?php | ||||
| use \LAM\TYPES\TypeManager; | ||||
| use function LAM\TYPES\getScopeFromTypeId; | ||||
| use LAM\TYPES\ConfiguredType; | ||||
| /* | ||||
| $Id$ | ||||
| 
 | ||||
| This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
| Copyright (C) 2003 - 2006  Tilo Lutz | ||||
|               2007 - 2017  Roland Gruber | ||||
|               2007 - 2018  Roland Gruber | ||||
| 
 | ||||
| This program is free software; you can redistribute it and/or modify | ||||
| it under the terms of the GNU General Public License as published by | ||||
|  | @ -139,7 +140,7 @@ class posixGroup extends baseModule implements passwordService { | |||
| 		// fill in autoGIDs
 | ||||
| 		if (sizeof($needAutoGID) > 0) { | ||||
| 			$errorsTemp = array(); | ||||
| 			$gids = $this->getNextGIDs(sizeof($needAutoGID), $errorsTemp); | ||||
| 			$gids = $this->getNextGIDs(sizeof($needAutoGID), $errorsTemp, $type); | ||||
| 			if (is_array($gids)) { | ||||
| 				for ($i = 0; $i < sizeof($needAutoGID); $i++) { | ||||
| 					$partialAccounts[$i]['gidNumber'] = $gids[$i]; | ||||
|  | @ -586,8 +587,18 @@ class posixGroup extends baseModule implements passwordService { | |||
| 		$configContainer->add($magicNumber, 12); | ||||
| 		$configContainer->add(new htmlResponsiveInputField(_('Suffix for GID/group name check'), 'posixGroup_gidCheckSuffix', '', 'gidCheckSuffix'), 12); | ||||
| 		$configContainer->add(new htmlResponsiveInputCheckbox('posixGroup_hidememberUid', false, _('Disable membership management'), 'hidememberUid'), 12); | ||||
| 		if ((!empty($allScopes['groupOfNames']) && in_array('group', $allScopes['groupOfNames'])) | ||||
| 			|| (!empty($allScopes['groupOfUniqueNames']) && in_array('group', $allScopes['groupOfUniqueNames']))) { | ||||
| 		$gonModules = array('groupOfNames', 'groupOfUniqueNames'); | ||||
| 		$gonFound = false; | ||||
| 		foreach ($gonModules as $gonModule) { | ||||
| 			if (!empty($allScopes[$gonModule])) { | ||||
| 				foreach ($allScopes[$gonModule] as $gonTypeId) { | ||||
| 					if (getScopeFromTypeId($gonTypeId) === 'group') { | ||||
| 						$gonFound = true; | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		if ($gonFound) { | ||||
| 			$configContainer->add(new htmlResponsiveInputCheckbox('posixGroup_autoSyncGon', false, _('Force sync with group of names'), 'autoSyncGon'), 12); | ||||
| 		} | ||||
| 		// display password hash option only if posixAccount module is not used
 | ||||
|  | @ -705,7 +716,7 @@ class posixGroup extends baseModule implements passwordService { | |||
| 		if ($this->manageCnAndDescription($modules) && ($this->attributes['cn'][0] == '')) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		if ($this->attributes['gidNumber'][0] == '') { | ||||
| 		if ((!isset($this->attributes['gidNumber'][0])) || $this->attributes['gidNumber'][0] === '') { | ||||
| 			return false; | ||||
| 		} | ||||
| 		return true; | ||||
|  | @ -784,7 +795,7 @@ class posixGroup extends baseModule implements passwordService { | |||
| 			if ($this->attributes['gidNumber'][0]=='') { | ||||
| 				// No id-number given, find free GID
 | ||||
| 				if (!isset($this->orig['gidNumber'][0])) { | ||||
| 					$newGID = $this->getNextGIDs(1, $errors); | ||||
| 					$newGID = $this->getNextGIDs(1, $errors, $this->getAccountContainer()->get_type()); | ||||
| 					if (is_array($newGID)) { | ||||
| 						$this->attributes['gidNumber'][0] = $newGID[0]; | ||||
| 					} | ||||
|  | @ -796,7 +807,7 @@ class posixGroup extends baseModule implements passwordService { | |||
| 				// old account -> return id-number which has been used
 | ||||
| 			} | ||||
| 			else { | ||||
| 				$gids = $this->getGIDs(); | ||||
| 				$gids = $this->getGIDs($this->getAccountContainer()->get_type()); | ||||
| 				// Check manual ID
 | ||||
| 				if ($this->getAccountContainer()->isNewAccount || !isset($this->orig['gidNumber'][0]) || ($this->orig['gidNumber'][0] != $this->attributes['gidNumber'][0])) { | ||||
| 					// check range
 | ||||
|  | @ -1005,20 +1016,10 @@ class posixGroup extends baseModule implements passwordService { | |||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	* Checks input values of module settings. | ||||
| 	* | ||||
| 	* Calling this method does not require the existence of an enclosing {@link accountContainer}.<br> | ||||
| 	* <br> | ||||
| 	* If the input data is invalid the return value is an array that contains subarrays to build StatusMessages ('message type', 'message head', 'message text'). | ||||
| 	* <br>If no errors occured the function returns an empty array. | ||||
| 	* | ||||
| 	* @param array $scopes list of account types which are used | ||||
| 	* @param array $options hash array (option name => value) that contains the input. The option values are all arrays containing one or more elements. | ||||
| 	* @return array list of error messages | ||||
| 	* | ||||
| 	* @see baseModule::get_metaData() | ||||
| 	*/ | ||||
| 	public function check_configOptions($scopes, &$options) { | ||||
| 	 * {@inheritDoc} | ||||
| 	 * @see baseModule::check_configOptions() | ||||
| 	 */ | ||||
| 	public function check_configOptions($typeIds, &$options) { | ||||
| 		if ($options['posixGroup_gidGenerator'][0] == 'range') { | ||||
| 			$this->meta['config_checks']['group']['posixGroup_minGID'] = array ( | ||||
| 				'type' => 'ext_preg', | ||||
|  | @ -1054,7 +1055,7 @@ class posixGroup extends baseModule implements passwordService { | |||
| 				'required_message' => $this->messages['windowsIDPoolDN'][0], | ||||
| 				'error_message' => $this->messages['windowsIDPoolDN'][0]); | ||||
| 		} | ||||
| 		return parent::check_configOptions($scopes, $options); | ||||
| 		return parent::check_configOptions($typeIds, $options); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
|  | @ -1062,9 +1063,10 @@ class posixGroup extends baseModule implements passwordService { | |||
| 	* | ||||
| 	* @param integer $count Number of needed free GIDs. | ||||
| 	* @param array $errors list of error messages where errors can be added | ||||
| 	* @param ConfiguredType $type account type | ||||
| 	* @return mixed Null if no GIDs are free else an array of free GIDs. | ||||
| 	*/ | ||||
| 	function getNextGIDs($count, &$errors) { | ||||
| 	function getNextGIDs($count, &$errors, $type) { | ||||
| 		// check if UIDs should be taken from Samba pool entry
 | ||||
| 		if (isset($this->moduleSettings['posixGroup_gidGenerator']) && ($this->moduleSettings['posixGroup_gidGenerator'][0] == 'sambaPool')) { | ||||
| 			return $this->getNextSambaPoolGIDs($count, $errors); | ||||
|  | @ -1084,7 +1086,7 @@ class posixGroup extends baseModule implements passwordService { | |||
| 		$ret = array(); | ||||
| 		$minID = intval($this->moduleSettings['posixGroup_minGID'][0]); | ||||
| 		$maxID = intval($this->moduleSettings['posixGroup_maxGID'][0]); | ||||
| 		$gidList = $this->getGIDs(); | ||||
| 		$gidList = $this->getGIDs($type); | ||||
| 		$gids = array(); | ||||
| 		foreach ($gidList as $gid) { | ||||
| 			if (($gid <= $maxID) && ($gid >= $minID)) $gids[] = $gid;  // ignore GIDs > maxID and GIDs < minID
 | ||||
|  | @ -1224,16 +1226,17 @@ class posixGroup extends baseModule implements passwordService { | |||
| 	/** | ||||
| 	 * Returns a list of existing GID numbers. | ||||
| 	 * | ||||
| 	 * @param ConfiguredType $type account type | ||||
| 	 * @return array list of GID numbers | ||||
| 	 */ | ||||
| 	private function getGIDs() { | ||||
| 	private function getGIDs($type) { | ||||
| 		if ($this->cachedGIDList != null) { | ||||
| 			return $this->cachedGIDList; | ||||
| 		} | ||||
| 		$this->cachedGIDList = array(); | ||||
| 		$attrs = array('gidNumber'); | ||||
| 		$filter = '(&(objectClass=posixGroup)(gidNumber=*))'; | ||||
| 		$suffix = $this->getAccountContainer()->get_type()->getSuffix(); | ||||
| 		$suffix = $type->getSuffix(); | ||||
| 		if (isset($this->moduleSettings['posixGroup_gidCheckSuffix'][0]) && ($this->moduleSettings['posixGroup_gidCheckSuffix'][0] != '')) { | ||||
| 			$suffix = $this->moduleSettings['posixGroup_gidCheckSuffix'][0]; | ||||
| 		} | ||||
|  |  | |||
|  | @ -254,9 +254,8 @@ class pykotaUser extends baseModule { | |||
| 		); | ||||
| 		// self service settings
 | ||||
| 		if (get_class($this) == 'pykotaUser') { | ||||
| 			$selfServiceContainer = new htmlTable(); | ||||
| 			$selfServiceContainer->addElement(new htmlTableExtendedInputField(_('Job suffix'), 'pykotaUser_jobSuffix', null)); | ||||
| 			$selfServiceContainer->addElement(new htmlHelpLink('jobSuffix', get_class($this)), true); | ||||
| 			$selfServiceContainer = new htmlResponsiveRow(); | ||||
| 			$selfServiceContainer->add(new htmlResponsiveInputField(_('Job suffix'), 'pykotaUser_jobSuffix', null, array('jobSuffix', get_class($this))), 12); | ||||
| 			$return['selfServiceSettings'] = $selfServiceContainer; | ||||
| 		} | ||||
| 		// configuration checks
 | ||||
|  |  | |||
|  | @ -103,6 +103,8 @@ class quota extends baseModule { | |||
| 			'quotas' => _('Quota') | ||||
| 		); | ||||
| 		// help entries
 | ||||
| 		$numbersHelp = _('Symbols K, M, G, and T can be appended to numeric value to express kibibytes, mebibytes, gibibytes, and tebibytes for blocks.') | ||||
| 		. _(' Symbols k, m, g, and t can be appended to numeric value to express multiples of 10^3, 10^6, 10^9, and 10^12 inodes.'); | ||||
| 		$return['help'] = array( | ||||
| 			"Mountpoint" => array( | ||||
| 				"Headline" => _("Mountpoint"), | ||||
|  | @ -114,13 +116,13 @@ class quota extends baseModule { | |||
| 			), | ||||
| 			"SoftBlockLimit" => array( | ||||
| 				"Headline" => _("Soft block limit"), | ||||
| 				"Text" => _("Soft block limit."), "SeeAlso" => array( | ||||
| 				"Text" => _("Soft block limit.") . '<br>' . $numbersHelp, "SeeAlso" => array( | ||||
| 					'link' => 'http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.4', | ||||
| 					'text' => 'Quota How-To') | ||||
| 			), | ||||
| 			"HardBlockLimit" => array( | ||||
| 				"Headline" => _("Hard block limit"), | ||||
| 				"Text" => _("Hard block limit"), "SeeAlso" => array( | ||||
| 				"Text" => _("Hard block limit") . '<br>' . $numbersHelp, "SeeAlso" => array( | ||||
| 					'link' => 'http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.5', | ||||
| 					'text' => 'Quota How-To') | ||||
| 			), | ||||
|  | @ -136,13 +138,13 @@ class quota extends baseModule { | |||
| 			), | ||||
| 			"SoftInodeLimit" => array( | ||||
| 				"Headline" => _("Soft inode limit"), | ||||
| 				"Text" => _("Soft inode (files) limit."), "SeeAlso" => array( | ||||
| 				"Text" => _("Soft inode (files) limit.") . '<br>' . $numbersHelp, "SeeAlso" => array( | ||||
| 					'link' => 'http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.4', | ||||
| 					'text' => 'Quota How-To') | ||||
| 			), | ||||
| 			"HardInodeLimit" => array( | ||||
| 				"Headline" => _("Hard inode limit"), | ||||
| 				"Text" => _("Hard inode (files) limit"), "SeeAlso" => array( | ||||
| 				"Text" => _("Hard inode (files) limit") . '<br>' . $numbersHelp, "SeeAlso" => array( | ||||
| 					'link' => 'http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.5', | ||||
| 					'text' => 'Quota How-To') | ||||
| 			), | ||||
|  | @ -304,13 +306,13 @@ class quota extends baseModule { | |||
| 			return $quotaInput; | ||||
| 		} | ||||
| 		if (substr($quotaInput, -1, 1) === 'K') { | ||||
| 			return 1024 * substr($quotaInput, 0, -1); | ||||
| 			return substr($quotaInput, 0, -1); | ||||
| 		} | ||||
| 		if (substr($quotaInput, -1, 1) === 'M') { | ||||
| 			return 1024 * 1024 * substr($quotaInput, 0, -1); | ||||
| 			return 1024 * substr($quotaInput, 0, -1); | ||||
| 		} | ||||
| 		if (substr($quotaInput, -1, 1) === 'G') { | ||||
| 			return 1024 * 1024 * 1024 * substr($quotaInput, 0, -1); | ||||
| 			return 1024 * 1024 * substr($quotaInput, 0, -1); | ||||
| 		} | ||||
| 		if (substr($quotaInput, -1, 1) === 'T') { | ||||
| 			return 1024 * 1024 * 1024 * 1024 * substr($quotaInput, 0, -1); | ||||
|  |  | |||
|  | @ -2251,36 +2251,23 @@ class sambaSamAccount extends baseModule implements passwordService { | |||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Returns a list of self service configuration settings. | ||||
| 	 * | ||||
| 	 * Calling this method does not require the existence of an enclosing {@link accountContainer}.<br> | ||||
| 	 * <br> | ||||
| 	 * The name attributes are used as keywords to load | ||||
| 	 * and save settings. We recommend to use the module name as prefix for them | ||||
| 	 * (e.g. posixAccount_homeDirectory) to avoid naming conflicts. | ||||
| 	 * | ||||
| 	 * @param selfServiceProfile $profile currently edited profile | ||||
| 	 * @return htmlElement meta HTML object | ||||
| 	 * | ||||
| 	 * @see baseModule::get_metaData() | ||||
| 	 * @see htmlElement | ||||
| 	 * {@inheritDoc} | ||||
| 	 * @see baseModule::getSelfServiceSettings() | ||||
| 	 */ | ||||
| 	public function getSelfServiceSettings($profile) { | ||||
| 		$selfServiceContainer = new htmlTable(); | ||||
| 		$selfServiceContainer = new htmlResponsiveRow(); | ||||
| 		// domain suffix
 | ||||
| 		$selfServiceDomainSuffix = new htmlTableExtendedInputField(_('Domain suffix'), 'sambaSamAccount_domainSuffix'); | ||||
| 		$selfServiceContainer->addElement($selfServiceDomainSuffix); | ||||
| 		$selfServiceContainer->addElement(new htmlHelpLink('domainSuffix', get_class($this)), true); | ||||
| 		$selfServiceDomainSuffix = new htmlResponsiveInputField(_('Domain suffix'), 'sambaSamAccount_domainSuffix', null, array('domainSuffix', get_class($this))); | ||||
| 		$selfServiceContainer->add($selfServiceDomainSuffix, 12); | ||||
| 		// password history
 | ||||
| 		$historyOptions = array( | ||||
| 				_('yes - ordered ascending') => 'yes_deleteLast', | ||||
| 				_('yes - ordered descending') => 'yes_deleteFirst', | ||||
| 				_('no') => 'no' | ||||
| 		); | ||||
| 		$historySelect = new htmlTableExtendedSelect('sambaSamAccount_history', $historyOptions, array('yes_deleteLast'), _("Password history")); | ||||
| 		$historySelect = new htmlResponsiveSelect('sambaSamAccount_history', $historyOptions, array('yes_deleteLast'), _("Password history"), array('history', get_class($this))); | ||||
| 		$historySelect->setHasDescriptiveElements(true); | ||||
| 		$selfServiceContainer->addElement($historySelect); | ||||
| 		$selfServiceContainer->addElement(new htmlHelpLink('history', get_class($this)), true); | ||||
| 		$selfServiceContainer->add($historySelect, 12); | ||||
| 		return $selfServiceContainer; | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
|  | @ -209,6 +209,7 @@ function printTable(&$pdf, $table, $fontName) { | |||
| 	if (!empty($headline)) { | ||||
| 		$pdf->SetFont($fontName, 'B', LAMPDF_FONT_SIZE); | ||||
| 		$pdf->Cell(LAMPDF_LABELWIDTH, LAMPDF_LINEHEIGHT, $headline . ':', 0 , 0, 'L', 0); | ||||
| 		$pdf->SetFont($fontName, '', LAMPDF_FONT_SIZE); | ||||
| 		$pdf->Ln(LAMPDF_LINEHEIGHT); | ||||
| 	} | ||||
| 	foreach ($table->rows as $row) { | ||||
|  |  | |||
|  | @ -1,9 +1,10 @@ | |||
| <?php | ||||
| namespace LAM\SCHEMA; | ||||
| /* | ||||
| $Id$ | ||||
| 
 | ||||
|   Copyright (C) 2004 David Smith | ||||
|   modified to fit for LDAP Account Manager 2005 - 2016 Roland Gruber | ||||
|   modified to fit for LDAP Account Manager 2005 - 2018 Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -2028,18 +2029,10 @@ function set_cached_schema($schema_type, $schema_items ) | |||
|     if( ! SCHEMA_SESSION_CACHE_ENABLED ) | ||||
|         return false; | ||||
| 
 | ||||
|     //echo "Setting cached schema for \"$schema_type\"...<br />\n";
 | ||||
|     // Sanity check. The schema must be in the form of an array
 | ||||
|     if( ! is_array( $schema_items ) ) { | ||||
|         die( "While attempting to cache schema, passed a non-array for \$schema_items!" ); | ||||
|     } | ||||
|     // Make sure we are being passed a valid array of schema_items
 | ||||
|     foreach( $schema_items as $schema_item ) { | ||||
|         if( ! is_subclass_of( $schema_item, 'SchemaItem' ) && | ||||
|             ! 0 == strcasecmp( 'SchemaItem', get_class( $schema_item ) ) ) { | ||||
|             die( "While attempting to cache schema, one of the schema items passed is not a true SchemaItem instance!" ); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     $schema_type = strtolower( $schema_type ); | ||||
|     $_SESSION[ 'schema' ][ $schema_type ] = $schema_items; | ||||
|  |  | |||
|  | @ -556,10 +556,14 @@ function validateSecurityToken($post = true) { | |||
|  * Adds a hidden input field to the given meta HTML table. | ||||
|  * Should be used to add token at the end of table. | ||||
|  * | ||||
|  * @param htmlTable|htmlGroup $container table | ||||
|  * @param htmlTable|htmlGroup|htmlResponsiveRow $container table | ||||
|  */ | ||||
| function addSecurityTokenToMetaHTML(&$container) { | ||||
| 	$token = new htmlHiddenInput(getSecurityTokenName(), $_SESSION[getSecurityTokenName()]); | ||||
| 	if ($container instanceof htmlResponsiveRow) { | ||||
| 		$container->add($token, 12); | ||||
| 		return; | ||||
| 	} | ||||
| 	$container->addElement($token, true); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,3 +10,4 @@ | |||
| /zarafaAddressListType.inc | ||||
| /zarafaDynamicGroupType.inc | ||||
| /kopano*.inc | ||||
| /customType.inc | ||||
|  |  | |||
|  | @ -113,6 +113,7 @@ class group extends baseType { | |||
| 			"memberuid" => _("Group members"), | ||||
| 			"roleOccupant" => _("Role member DNs"), | ||||
| 			"uniqueMember" => _("Group member DNs"), | ||||
| 			"memberUrl" => _("Entries"), | ||||
| 		); | ||||
| 		if ($this->getType() != null) { | ||||
| 			$modules = $this->getType()->getModules(); | ||||
|  |  | |||
|  | @ -2,4 +2,4 @@ | |||
| 
 | ||||
| rm -rf docs/phpdoc | ||||
| mkdir docs/phpdoc | ||||
| phpdoc -d ./ -t docs/phpdoc --title "LDAP Account Manager" --template clean --defaultpackagename main -e php,inc --ignore lib/en*,lib/env.inc | ||||
| phpdoc -d ./ -t docs/phpdoc --title "LDAP Account Manager" --template clean --defaultpackagename main -e php,inc --ignore lib/en*,lib/env.inc,lib/3rdParty*,templates/3rdParty* | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ | |||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2003  Leonhard Walchshaeusl | ||||
|   Copyright (C) 2005 - 2017  Roland Gruber | ||||
|   Copyright (C) 2005 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -154,6 +154,10 @@ textarea { | |||
| 	margin-top: 0px; | ||||
| } | ||||
| 
 | ||||
| .padding0 { | ||||
| 	padding: 0em !important; | ||||
| } | ||||
| 
 | ||||
| .padding05 { | ||||
| 	padding: 0.5em; | ||||
| } | ||||
|  | @ -354,6 +358,7 @@ table.collapse { | |||
| 
 | ||||
| .smallPaddingContent { | ||||
| 	padding: 0.5em; | ||||
| 	padding-bottom: 1rem; | ||||
| } | ||||
| 
 | ||||
| /** titles */ | ||||
|  | @ -398,6 +403,12 @@ div.jobList { | |||
| 	max-height: 50rem; | ||||
| } | ||||
| 
 | ||||
| div.smallScroll { | ||||
| 	overflow: scroll; | ||||
| 	max-height: 10rem; | ||||
| 	overflow-x: hidden; | ||||
| } | ||||
| 
 | ||||
| .fullwidth { | ||||
| 	width: 100%; | ||||
| } | ||||
|  | @ -610,96 +621,10 @@ div.confModList { | |||
| 	overflow-y: auto; | ||||
| } | ||||
| 
 | ||||
| /* schema browser */ | ||||
| 
 | ||||
| table.schema_oclasses { | ||||
| 	border-left: 1px solid black; | ||||
| 	border-right: 1px solid black; | ||||
| 	border-bottom: 1px solid black; | ||||
| 	border-top: 0; | ||||
| 	margin-bottom: 10px; | ||||
| 	background-color: #eee; | ||||
| .font-big { | ||||
| 	font-size: 130%; | ||||
| } | ||||
| 
 | ||||
| table.schema_oclasses td { | ||||
| 	vertical-align: top; | ||||
| 	text-align: left; | ||||
| 	padding-left: 5px; | ||||
| } | ||||
| 
 | ||||
| table.schema_attr { | ||||
| 	border: 1px solid black; | ||||
| } | ||||
| 
 | ||||
| table.schema_attr th { | ||||
| 	background-color: #F3F3F3; | ||||
| 	padding: 5px; | ||||
| 	color: black; | ||||
| 	font-weight: bold; | ||||
| 	font-size: 125%; | ||||
| } | ||||
| 
 | ||||
| table.schema_attr td { | ||||
| 	padding: 5px; | ||||
| 	vertical-align: top; | ||||
| } | ||||
| 
 | ||||
| table.schema_attr tr.even { | ||||
| 	background-color: #eee; | ||||
| } | ||||
| 
 | ||||
| table.schema_attr tr.odd { | ||||
| 	background-color: #ccc; | ||||
| } | ||||
| 
 | ||||
| table.schema_attr tr.highlight{ | ||||
| 	background-color: #bcd; | ||||
| 	font-weight: Bold; | ||||
| } | ||||
| 
 | ||||
| ul.schema { | ||||
| 	margin: 5px; | ||||
| 	margin-left: 0px; | ||||
| 	padding-left: 20px; | ||||
| } | ||||
| 
 | ||||
| ul.schema li { | ||||
| 	margin-left: 0px; | ||||
| 	padding-left: 0px; | ||||
| } | ||||
| 
 | ||||
| ul.schema li small { | ||||
| 	font-size: 75%; | ||||
| 	color: #777; | ||||
| } | ||||
| 
 | ||||
| ul.schema li small a { | ||||
| 	color: #77c; | ||||
| } | ||||
| 
 | ||||
| h4.schema_oclass { | ||||
| 	background: #F3F3F3; | ||||
| 	padding: 5px; | ||||
| 	margin: 0px; | ||||
| 	margin-top: 8px; | ||||
| 	font-weight: normal; | ||||
| 	border: 1px solid black; | ||||
| 	font-size: 140%; | ||||
| 	color: black; | ||||
| } | ||||
| 
 | ||||
| h4.schema_oclass_sub { | ||||
| 	background: #dde; | ||||
| 	border: 1px solid black; | ||||
| 	border-top: 0px; | ||||
| 	font-weight: normal; | ||||
| 	margin: 0px; | ||||
| 	padding: 2px; | ||||
| 	padding-left: 5px; | ||||
| 	font-size: 80%; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /** colors for account types */ | ||||
| 
 | ||||
| .alias-border { border-color:#af8800; } | ||||
|  | @ -798,3 +723,7 @@ h4.schema_oclass_sub { | |||
| .nsviewType-bright { background:#fff3c8 !important; } | ||||
| .nsviewType-dark { background-color:#ffe27f !important; } | ||||
| 
 | ||||
| .customType-border { border-color:#b87500; } | ||||
| .customType-bright { background:#ffe3b1 !important; } | ||||
| .customType-dark { background-color:#e1b974 !important; } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /* | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2017  Roland Gruber | ||||
|   Copyright (C) 2017 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -49,6 +49,10 @@ | |||
| 	width: auto; | ||||
| } | ||||
| 
 | ||||
| img.max16 { | ||||
| 	max-width: 16px; | ||||
| } | ||||
| 
 | ||||
| div.dialog-page { | ||||
| 	float: left; | ||||
| } | ||||
|  | @ -79,6 +83,8 @@ table.responsive-table th { | |||
| table.responsive-table td { | ||||
| 	overflow: hidden; | ||||
| 	vertical-align: top; | ||||
| 	padding-bottom: 0.5rem; | ||||
| 	padding-top: 0.5rem; | ||||
| } | ||||
| 
 | ||||
| /* mobile */ | ||||
|  | @ -132,6 +138,10 @@ table.responsive-table td { | |||
| 		margin-right: 5px; | ||||
| 	} | ||||
| 
 | ||||
| 	.bold-mobile-only { | ||||
| 		font-weight: bold; | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| /* tablet */ | ||||
|  |  | |||
|  | @ -227,6 +227,9 @@ $advancedOptionsContent->add(new htmlResponsiveInputCheckbox('followReferrals', | |||
| // paged results
 | ||||
| $pagedResults = ($conf->getPagedResults() === 'true'); | ||||
| $advancedOptionsContent->add(new htmlResponsiveInputCheckbox('pagedResults', $pagedResults , _('Paged results'), '266'), 12); | ||||
| // referential integrity overlay
 | ||||
| $referentialIntegrity = ($conf->isReferentialIntegrityOverlayActive()); | ||||
| $advancedOptionsContent->add(new htmlResponsiveInputCheckbox('referentialIntegrityOverlay', $referentialIntegrity , _('Referential integrity overlay'), '269'), 12); | ||||
| 
 | ||||
| // build advanced options box
 | ||||
| $advancedOptions = new htmlAccordion('advancedOptions_server', array(_('Advanced options') => $advancedOptionsContent), false); | ||||
|  | @ -545,6 +548,12 @@ function checkInput() { | |||
| 	else { | ||||
| 		$conf->setPagedResults('false'); | ||||
| 	} | ||||
| 	if (isset($_POST['referentialIntegrityOverlay']) && ($_POST['referentialIntegrityOverlay'] == 'on')) { | ||||
| 		$conf->setReferentialIntegrityOverlay('true'); | ||||
| 	} | ||||
| 	else { | ||||
| 		$conf->setReferentialIntegrityOverlay('false'); | ||||
| 	} | ||||
| /*	if (!$conf->set_cacheTimeout($_POST['cachetimeout'])) { | ||||
| 		$errors[] = array("ERROR", _("Cache timeout is invalid!")); | ||||
| 	}*/ | ||||
|  |  | |||
|  | @ -134,7 +134,7 @@ $scopes = array(); | |||
| foreach ($types as $type) { | ||||
| 	$mods = $conf->get_AccountModules($type->getId()); | ||||
| 	for ($i = 0; $i < sizeof($mods); $i++) { | ||||
| 		$scopes[$mods[$i]][] = $type->getScope(); | ||||
| 		$scopes[$mods[$i]][] = $type->getId(); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -224,7 +224,7 @@ function checkInput() { | |||
| 	foreach ($types as $type) { | ||||
| 		$mods = $conf->get_AccountModules($type->getId()); | ||||
| 		for ($i = 0; $i < sizeof($mods); $i++) { | ||||
| 			$scopes[$mods[$i]][] = $type->getScope(); | ||||
| 			$scopes[$mods[$i]][] = $type->getId(); | ||||
| 		} | ||||
| 	} | ||||
| 	// check options
 | ||||
|  |  | |||
|  | @ -873,6 +873,20 @@ window.lam.tools.setInitialFocus = function() { | |||
| 	jQuery('.lam-initial-focus').focus(); | ||||
| }; | ||||
| 
 | ||||
| window.lam.tools.schema = window.lam.tools.schema || {}; | ||||
| 
 | ||||
| /** | ||||
|  * Adds the onChange listener to schema selections. | ||||
|  */ | ||||
| window.lam.tools.schema.select = function() { | ||||
| 	var select = jQuery('#lam-schema-select'); | ||||
| 	var display = select.data('display'); | ||||
| 	select.change(function() { | ||||
| 		var value = this.value; | ||||
| 		document.location = 'schema.php?display=' + display + '&sel=' + value; | ||||
| 	}); | ||||
| }; | ||||
| 
 | ||||
| jQuery(document).ready(function() { | ||||
| 	window.lam.gui.equalHeight(); | ||||
| 	window.lam.form.autoTrim(); | ||||
|  | @ -880,4 +894,5 @@ jQuery(document).ready(function() { | |||
| 	window.lam.tools.addSavedSelectListener(); | ||||
| 	window.lam.tools.activateTab(); | ||||
| 	window.lam.tools.setInitialFocus(); | ||||
| 	window.lam.tools.schema.select(); | ||||
| }); | ||||
|  |  | |||
|  | @ -220,7 +220,7 @@ function display_LoginPage($licenseValidator, $error_message) { | |||
| 			<tr> | ||||
| 				<td align="left" height="30" width="34%"> | ||||
| 					<a class="lamLogo" href="http://www.ldap-account-manager.org/" target="new_window"> | ||||
| 					LDAP Account Manager | ||||
| 					LAM | ||||
| 					<?php | ||||
| 						if (isLAMProVersion()) { | ||||
| 							echo 'Pro '; | ||||
|  |  | |||
|  | @ -1,20 +1,20 @@ | |||
| <?php | ||||
| namespace LAM\TOOLS\OU_EDIT; | ||||
| use \htmlTable; | ||||
| use \htmlSpacer; | ||||
| use \htmlOutputText; | ||||
| use \htmlButton; | ||||
| use \htmlHiddenInput; | ||||
| use \htmlTitle; | ||||
| use \htmlSubTitle; | ||||
| use \htmlStatusMessage; | ||||
| use \htmlSelect; | ||||
| use \htmlHelpLink; | ||||
| use \htmlInputField; | ||||
| use \htmlResponsiveRow; | ||||
| use \htmlResponsiveSelect; | ||||
| use \htmlResponsiveInputField; | ||||
| use \htmlGroup; | ||||
| /* | ||||
| $Id$ | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2003 - 2017  Roland Gruber | ||||
|   Copyright (C) 2003 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -122,19 +122,22 @@ if (isset($_POST['createOU']) || isset($_POST['deleteOU'])) { | |||
| 			echo '<div class="user-bright smallPaddingContent">'; | ||||
| 			echo "<form action=\"ou_edit.php\" method=\"post\">\n"; | ||||
| 			$tabindex = 1; | ||||
| 			$container = new htmlTable(); | ||||
| 			$container = new htmlResponsiveRow(); | ||||
| 			$label = new htmlOutputText(_("Do you really want to delete this OU?")); | ||||
| 			$label->colspan = 5; | ||||
| 			$container->addElement($label, true); | ||||
| 			$container->addElement(new htmlSpacer(null, '10px'), true); | ||||
| 			$container->add($label, 12); | ||||
| 			$container->addVerticalSpacer('1rem'); | ||||
| 			$dnLabel = new htmlOutputText(getAbstractDN($_POST['deleteableOU'])); | ||||
| 			$dnLabel->colspan = 5; | ||||
| 			$container->addElement($dnLabel, true); | ||||
| 			$container->addElement(new htmlSpacer(null, '10px'), true); | ||||
| 			$container->addElement(new htmlButton('sure', _("Delete"))); | ||||
| 			$container->addElement(new htmlButton('abort', _("Cancel"))); | ||||
| 			$container->addElement(new htmlHiddenInput('deleteOU', 'submit')); | ||||
| 			$container->addElement(new htmlHiddenInput('deletename', $_POST['deleteableOU'])); | ||||
| 			$container->add($dnLabel, 12); | ||||
| 			$container->addVerticalSpacer('1rem'); | ||||
| 			$buttonGroup = new htmlGroup(); | ||||
| 			$buttonGroup->addElement(new htmlButton('sure', _("Delete"))); | ||||
| 			$buttonGroup->addElement(new htmlSpacer('0.5rem', null)); | ||||
| 			$buttonGroup->addElement(new htmlButton('abort', _("Cancel"))); | ||||
| 			$container->add($buttonGroup, 12); | ||||
| 			$container->add(new htmlHiddenInput('deleteOU', 'submit'), 12); | ||||
| 			$container->add(new htmlHiddenInput('deletename', $_POST['deleteableOU']), 12); | ||||
| 			addSecurityTokenToMetaHTML($container); | ||||
| 			parseHtml(null, $container, array(), false, $tabindex, 'user'); | ||||
| 			echo "</form>"; | ||||
|  | @ -158,22 +161,22 @@ display_main($message, $error); | |||
|  */ | ||||
| function display_main($message, $error) { | ||||
| 	// display main page
 | ||||
| 	include 'main_header.php'; | ||||
| 	include '../lib/adminHeader.inc'; | ||||
| 	echo '<div class="user-bright smallPaddingContent">'; | ||||
| 	echo "<form action=\"ou_edit.php\" method=\"post\">\n"; | ||||
| 
 | ||||
| 	$tabindex = 1; | ||||
| 	$container = new htmlTable(); | ||||
| 	$container->addElement(new htmlSubTitle(_("OU editor")), true); | ||||
| 	$container = new htmlResponsiveRow(); | ||||
| 	$container->add(new htmlTitle(_("OU editor")), 12); | ||||
| 	if (isset($error)) { | ||||
| 		$msg = new htmlStatusMessage("ERROR", "", $error); | ||||
| 		$msg->colspan = 5; | ||||
| 		$container->addElement($msg, true); | ||||
| 		$container->add($msg, 12); | ||||
| 	} | ||||
| 	elseif (isset($message)) { | ||||
| 		$msg = new htmlStatusMessage("INFO", "", $message); | ||||
| 		$msg->colspan = 5; | ||||
| 		$container->addElement($msg, true); | ||||
| 		$container->add($msg, 12); | ||||
| 	} | ||||
| 
 | ||||
| 	$typeManager = new \LAM\TYPES\TypeManager(); | ||||
|  | @ -199,35 +202,33 @@ function display_main($message, $error) { | |||
| 
 | ||||
| 	if (!empty($options)) { | ||||
| 		// new OU
 | ||||
| 		$container->addElement(new htmlOutputText(_("New organisational unit"))); | ||||
| 		$parentOUSelect = new htmlSelect('parentOU', $options, array()); | ||||
| 		$container->add(new htmlSubTitle(_("New organisational unit")), 12); | ||||
| 		$parentOUSelect = new htmlResponsiveSelect('parentOU', $options, array(), _('Parent DN'), '601'); | ||||
| 		$parentOUSelect->setContainsOptgroups(true); | ||||
| 		$parentOUSelect->setHasDescriptiveElements(true); | ||||
| 		$parentOUSelect->setRightToLeftTextDirection(true); | ||||
| 		$parentOUSelect->setSortElements(false); | ||||
| 		$container->addElement($parentOUSelect); | ||||
| 		$container->addElement(new htmlInputField('newOU')); | ||||
| 		$container->addElement(new htmlButton('createOU', _("Ok"))); | ||||
| 		$container->addElement(new htmlHelpLink('601'), true); | ||||
| 
 | ||||
| 		$container->addElement(new htmlSpacer(null, '10px'), true); | ||||
| 		$container->add($parentOUSelect, 12); | ||||
| 		$container->add(new htmlResponsiveInputField(_('Name'), 'newOU'), 12); | ||||
| 		$container->addLabel(new htmlOutputText(' ', false)); | ||||
| 		$container->addField(new htmlButton('createOU', _("Ok"))); | ||||
| 		$container->addVerticalSpacer('2rem'); | ||||
| 
 | ||||
| 		// delete OU
 | ||||
| 		$container->addElement(new htmlOutputText(_("Delete organisational unit"))); | ||||
| 		$deleteableOUSelect = new htmlSelect('deleteableOU', $options, array()); | ||||
| 		$container->add(new htmlSubTitle(_("Delete organisational unit")), 12); | ||||
| 		$deleteableOUSelect = new htmlResponsiveSelect('deleteableOU', $options, array(), _('Organisational unit'), '602'); | ||||
| 		$deleteableOUSelect->setContainsOptgroups(true); | ||||
| 		$deleteableOUSelect->setHasDescriptiveElements(true); | ||||
| 		$deleteableOUSelect->setRightToLeftTextDirection(true); | ||||
| 		$deleteableOUSelect->setSortElements(false); | ||||
| 		$container->addElement($deleteableOUSelect); | ||||
| 		$container->addElement(new htmlOutputText('')); | ||||
| 		$container->addElement(new htmlButton('deleteOU', _("Ok"))); | ||||
| 		$container->addElement(new htmlHelpLink('602'), true); | ||||
| 		$container->add($deleteableOUSelect, 12); | ||||
| 		$container->addLabel(new htmlOutputText(' ', false)); | ||||
| 		$container->addField(new htmlButton('deleteOU', _("Ok"))); | ||||
| 	} | ||||
| 
 | ||||
| 	addSecurityTokenToMetaHTML($container); | ||||
| 	parseHtml(null, $container, array(), false, $tabindex, 'user'); | ||||
| 	echo ("</form>\n"); | ||||
| 	echo '</div>'; | ||||
| 	include 'main_footer.php'; | ||||
| 	include '../lib/adminFooter.inc'; | ||||
| } | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ use \htmlHiddenInput; | |||
| $Id$ | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2003 - 2017  Roland Gruber | ||||
|   Copyright (C) 2003 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -145,8 +145,8 @@ include '../main_header.php'; | |||
| // print error messages if any
 | ||||
| if (sizeof($errors) > 0) { | ||||
| 	echo "<br>\n"; | ||||
| 	for ($i = 0; $i < sizeof($errors); $i++) { | ||||
| 		call_user_func_array('StatusMessage', $errors[$i]); | ||||
| 	foreach ($errors as $error) { | ||||
| 		call_user_func_array('StatusMessage', $error); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -159,13 +159,12 @@ $options = getProfileOptions($type->getId()); | |||
| // load old profile or POST values if needed
 | ||||
| $old_options = array(); | ||||
| if (isset($_POST['save'])) { | ||||
| 	$postKeys = array_keys($_POST); | ||||
| 	for ($i = 0; $i < sizeof($postKeys); $i++) { | ||||
| 		if (!is_array($_POST[$postKeys[$i]])) { | ||||
| 			$old_options[$postKeys[$i]] = array($_POST[$postKeys[$i]]); | ||||
| 	foreach ($_POST as $key => $value) { | ||||
| 		if (!is_array($value)) { | ||||
| 			$old_options[$key] = array($value); | ||||
| 		} | ||||
| 		else { | ||||
| 			$old_options[$postKeys[$i]] = $_POST[$postKeys[$i]]; | ||||
| 			$old_options[$key] = $value; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | @ -223,19 +222,20 @@ $container->addElement(new htmlSpacer(null, '15px'), true); | |||
| $_SESSION['profile_types'] = parseHtml(null, $container, $old_options, false, $tabindex, $type->getScope()); | ||||
| 
 | ||||
| // display module options
 | ||||
| $modules = array_keys($options); | ||||
| for ($m = 0; $m < sizeof($modules); $m++) { | ||||
| foreach ($options as $moduleName => $moduleOptions) { | ||||
| 	// ignore modules without options
 | ||||
| 	if (sizeof($options[$modules[$m]]) < 1) continue; | ||||
| 	$module = new $modules[$m]($type->getScope()); | ||||
| 	if (sizeof($moduleOptions) < 1) { | ||||
| 		continue; | ||||
| 	} | ||||
| 	$module = new $moduleName($type->getScope()); | ||||
| 	$icon = $module->getIcon(); | ||||
| 	if (!empty($icon) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) { | ||||
| 		$icon = '../../graphics/' . $icon; | ||||
| 	} | ||||
| 	$container = new htmlTable(); | ||||
| 	$container->addElement(new htmlFieldset($options[$modules[$m]], getModuleAlias($modules[$m], $type->getScope()), $icon), true); | ||||
| 	$container->addElement(new htmlFieldset($moduleOptions, getModuleAlias($moduleName, $type->getScope()), $icon), true); | ||||
| 	$container->addElement(new htmlSpacer(null, '15px'), true); | ||||
| 	$_SESSION['profile_types'] = array_merge($_SESSION['profile_types'], parseHtml($modules[$m], $container, $old_options, false, $tabindex, $type->getScope())); | ||||
| 	$_SESSION['profile_types'] = array_merge($_SESSION['profile_types'], parseHtml($moduleName, $container, $old_options, false, $tabindex, $type->getScope())); | ||||
| } | ||||
| 
 | ||||
| // profile name and submit/abort buttons
 | ||||
|  |  | |||
|  | @ -1,9 +1,18 @@ | |||
| <?php | ||||
| namespace LAM\SCHEMA; | ||||
| use \htmlResponsiveRow; | ||||
| use \htmlSpacer; | ||||
| use \htmlLink; | ||||
| use \htmlStatusMessage; | ||||
| use \htmlResponsiveTable; | ||||
| use \htmlOutputText; | ||||
| use \htmlGroup; | ||||
| use \htmlSelect; | ||||
| use \htmlDiv; | ||||
| use \htmlSubTitle; | ||||
| /* | ||||
| $Id$ | ||||
| 
 | ||||
|   Copyright (C) 2004 David Smith | ||||
|   modified to fit for LDAP Account Manager 2005 - 2017 Roland Gruber | ||||
|   Copyright (C) 2018 Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -26,7 +35,6 @@ $Id$ | |||
|  * Displays the LDAP schema of the server | ||||
|  * | ||||
|  * @package tools | ||||
|  * @author David Smith | ||||
|  * @author Roland Gruber | ||||
|  */ | ||||
| 
 | ||||
|  | @ -48,396 +56,317 @@ checkIfToolIsActive('toolSchemaBrowser'); | |||
| 
 | ||||
| setlanguage(); | ||||
| 
 | ||||
| include '../main_header.php'; | ||||
| include '../../lib/adminHeader.inc'; | ||||
| echo "<div class=\"user-bright smallPaddingContent\">\n"; | ||||
| 
 | ||||
| 
 | ||||
| $view = isset( $_GET['view'] ) ? $_GET['view'] : 'objectClasses'; | ||||
| $viewvalue = isset( $_GET['viewvalue'] ) ? $_GET['viewvalue'] : null; | ||||
| if( trim( $viewvalue ) == "" ) | ||||
|     $viewvalue = null; | ||||
| if( ! is_null( $viewvalue ) ) | ||||
|     $viewed = false; | ||||
| 
 | ||||
| ?>
 | ||||
| 
 | ||||
| <br /> | ||||
| <center><big> | ||||
| 	<?php echo ( $view=='objectClasses' ? | ||||
| 		_('Object classes') : | ||||
| 		'<a href="?view=objectClasses">' . _('Object classes').'</a>' ); ?>
 | ||||
| 		| | ||||
| 	<?php echo ( $view=='attributes' ? | ||||
| 		_('Attribute types'): | ||||
| 		'<a href="?view=attributes">' .	_('Attribute types').'</a>' ); ?>
 | ||||
| 		| | ||||
| 	<?php echo ( $view=='syntaxes' ? | ||||
| 		_('Syntaxes') : | ||||
| 		'<a href="?view=syntaxes">' . _('Syntaxes').'</a>' ); ?>
 | ||||
| 		| | ||||
| 	<?php echo ( $view=='matching_rules' ? | ||||
| 		_('Matching rules') : | ||||
| 		'<a href="?view=matching_rules">' . _('Matching rules').'</a>' ); ?>
 | ||||
| </big></center> | ||||
| <br /> | ||||
| 
 | ||||
| <?php flush(); ?>
 | ||||
| 
 | ||||
| <?php | ||||
| 
 | ||||
| if( $view == 'syntaxes' ) { | ||||
| 	$highlight_oid = isset( $_GET['highlight_oid'] ) ? $_GET['highlight_oid'] : false; | ||||
| 	echo "\n\n<table class=\"schema_attr\" width=\"100%\">\n"; | ||||
| 	echo "<tr><th>" . _('Syntax OID') . "</th><th>" . _('Description') . "</th></tr>\n"; | ||||
| 	flush(); | ||||
| 	$counter=1; | ||||
| 	$schema_syntaxes = get_schema_syntaxes(null); | ||||
| 	if( ! $schema_syntaxes ) StatusMessage("ERROR", _("Unable to retrieve schema!"), ""); | ||||
| 	foreach( $schema_syntaxes as $syntax ) { | ||||
| 		$counter++; | ||||
| 		$oid =  htmlspecialchars( $syntax->getOID() ); | ||||
| 		$desc = htmlspecialchars( $syntax->getDescription() ); | ||||
| 		if( $highlight_oid && $highlight_oid == $oid ) | ||||
| 			echo "<tr class=\"highlight\">"; | ||||
| 		else | ||||
| 			echo "<tr class=\"" . ($counter%2==0?'even':'odd'). "\">"; | ||||
| 		echo "<td><a name=\"$oid\">$oid</a></td><td>$desc</td></tr>\n\n";
 | ||||
| 	} | ||||
| 	echo "</table>\n"; | ||||
| 
 | ||||
| } elseif( $view == 'attributes' ) { | ||||
| 	flush(); | ||||
| 	$schema_attrs = get_schema_attributes(null); | ||||
| 	$schema_object_classes = get_schema_objectclasses(null); | ||||
| 	if( ! $schema_attrs || ! $schema_object_classes ) | ||||
| 		StatusMessage("ERROR", _("Unable to retrieve schema!"), ""); | ||||
| 
 | ||||
| 	?>
 | ||||
| 	<small><?php echo _('Jump to an attribute type'); ?>:</small>
 | ||||
| 	<form action="schema.php" method="get"><input type="hidden" name="view" value="<?php echo $view; ?>" /> | ||||
|         <select name="viewvalue" onChange="submit()"> | ||||
| 	<option value=""> - all -</option> | ||||
| 
 | ||||
| 	<?php foreach( $schema_attrs as $attr ) { | ||||
|                     echo( '<option value="' | ||||
|                          .$attr->getName() | ||||
|                          .'" ' | ||||
|                          .( 0 == strcasecmp( $attr->getName(), $viewvalue ) ? ' selected ' : '' ) | ||||
|                          .'>' | ||||
|                          . $attr->getName() | ||||
| 		         .'</option>' . "\n" ); | ||||
| 	 } ?>
 | ||||
| 	</select><input type="submit" value="<?php echo _('Go'); ?>" /></form> | ||||
| 
 | ||||
| 	<br /> | ||||
| 	<table class="schema_attr" width="100%"> | ||||
| 
 | ||||
| 	<?php | ||||
|     foreach( $schema_attrs  as $attr ) { | ||||
| 	  if ( is_null( $viewvalue ) || 0 == strcasecmp( $viewvalue, $attr->getName() ) ) { | ||||
|         if( ! is_null( $viewvalue ) ) | ||||
|             $viewed = true; | ||||
| 		flush(); | ||||
| 		echo "<tr><th colspan=\"2\">" . $attr->getName() . "</th></tr>\n\n"; | ||||
| 		$counter = 0; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td>"._('Description')."</td>\n"; | ||||
| 		echo "<td>" . ( $attr->getDescription() === null ? '('._('No description').')' : $attr->getDescription() ). "</td>\n"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td><acronym title=\"Object Identier\">"._('OID')."</acronym></td>\n"; | ||||
| 		echo "<td>" .  $attr->getOID() . "</td>\n"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo '<td>'._('Obsolete')."?</td>\n"; | ||||
| 		echo "<td>" . ( $attr->getIsObsolete() ? '<b>' . _('Yes') . '</b>' : _('No') ) . "</td>\n"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td>"._('Inherits from')."</td>\n"; | ||||
| 		echo "<td>"; | ||||
| 		if( $attr->getSupAttribute() === null ) | ||||
| 			echo '('._('none').')'; | ||||
| 		else | ||||
| 			echo "<a href=\"?view=$view&viewvalue=" . strtolower( $attr->getSupAttribute() ) . "\">" . $attr->getSupAttribute()  . "</a></td>\n"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td>"._('Equality')."</td>\n"; | ||||
| 		echo "<td>" .  ( $attr->getEquality() === null ? '('._('not specified').')' : "<a href=\"?view=matching_rules&viewvalue=".$attr->getEquality()."\">".$attr->getEquality()."</a>" ) . "</td>\n"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td>"._('Ordering')."</td>\n"; | ||||
| 		echo "<td>" .  ( $attr->getOrdering() === null? '('._('not specified').')' : $attr->getOrdering() ) . "</td>\n"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td>"._('Substring Rule')."</td>\n"; | ||||
| 		echo "<td>" .  ( $attr->getSubstr() === null? '('._('not specified').')' : $attr->getSubstr() ) . "</td>\n"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td>"._('Syntax')."</td>\n"; | ||||
| 		echo "<td>"; | ||||
| 		if( null !== $attr->getType() ) { | ||||
| 			echo "<a href=\"?view=syntaxes&highlight_oid="; | ||||
| 			echo $attr->getSyntaxOID() . "#" .  $attr->getSyntaxOID(); | ||||
| 			echo "\">" . $attr->getType() . " (" . $attr->getSyntaxOID() . ")</a>"; | ||||
| 		} else { | ||||
| 			echo $attr->getSyntaxOID(); | ||||
| 		} | ||||
| 		echo "</td>\n"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td>"._('Single valued')."</td>\n"; | ||||
| 		echo "<td>" .  ( $attr->getIsSingleValue() ? _('Yes') : _('No') ) . "</td>\n"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td>"._('Collective')."?</td>\n"; | ||||
| 		echo "<td>" .  ( $attr->getIsCollective() ? _('Yes') : _('No') ) . "</td>\n"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td>"._('User modification')."</td>\n"; | ||||
| 		echo "<td>" . ( $attr->getIsNoUserModification() ? _('No') : _('Yes') ) . "</td>\n"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td>"._('Usage')."</td>\n"; | ||||
| 		echo "<td>" .  ( $attr->getUsage() ? $attr->getUsage() : '('._('not specified').')' ) . "</td>\n"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td>"._('Maximum length')."</td>\n"; | ||||
| 		echo "<td>"; | ||||
| 		if ( $attr->getMaxLength() === null ) { echo '('._('not applicable').')';} | ||||
| 		else { | ||||
| 		  echo number_format( $attr->getMaxLength() ) ." "; | ||||
| 		  if (  $attr->getMaxLength()>1) {echo _('characters');} | ||||
| 		  else { echo _('character')  ;} | ||||
| 	                        } | ||||
| 		echo "</td>\n"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td>"._('Aliases')."</td>\n"; | ||||
| 		echo "<td>"; | ||||
| 		if( count( $attr->getAliases() ) == 0 ) | ||||
| 			echo '('._('none').')'; | ||||
| 		else | ||||
| 			foreach( $attr->getAliases() as $alias_attr_name ) | ||||
| 				echo "<a href=\"?view=attributes&viewvalue=" . $alias_attr_name. "\">$alias_attr_name</a> "; | ||||
| 		echo "</td>"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; | ||||
| 		echo "<td>"._('Used by object classes')."</td>\n"; | ||||
| 		echo "<td>"; | ||||
| 		if( count( $attr->getUsedInObjectClasses() ) == 0 ) | ||||
| 			echo '('._('none').')'; | ||||
| 		else | ||||
| 			foreach( $attr->getUsedInObjectClasses() as $used_in_oclass) | ||||
| 				echo "<a href=\"?view=objectClasses&viewvalue=" . | ||||
| 					$used_in_oclass. "\">$used_in_oclass</a> "; | ||||
| 		echo "</td>"; | ||||
| 		echo "</tr>\n\n"; | ||||
| 
 | ||||
| 		flush(); | ||||
| 	  } | ||||
| 	} | ||||
| 	echo "</table>\n"; | ||||
| 
 | ||||
| } elseif( $view == 'matching_rules' ) { | ||||
|         $schema_matching_rules = get_schema_matching_rules(null); | ||||
| 	echo '<small>' . _('Jump to a matching rule').'</small><br />'; | ||||
| 	echo '<form  action="schema.php" method="get">'; | ||||
|         echo '<input type="hidden" name="view" value="matching_rules" />'; | ||||
|         echo '<select name="viewvalue" onChange="submit()">'; | ||||
|         echo '<option value=""> - all -</option>'; | ||||
| 		foreach( $schema_matching_rules as $rule ) { | ||||
| 		  echo '<option value="'.$rule->getName().'"'.($rule->getName()==$viewvalue? ' selected ': '').'>'.$rule->getName().'</option>'; | ||||
| 		} | ||||
| 
 | ||||
|         echo '</select>'; | ||||
|        	echo '<input type="submit" value="'._('Go').'" />'; | ||||
| 	echo '</form>'; | ||||
| 	echo "\n\n<table class=\"schema_attr\" width=\"100%\">\n"; | ||||
| 	echo "<tr><th>" . _('Matching rule OID') . "</th><th>" . _('Name') . "</th><th>"._('Used by attributes')."</th></tr>\n"; | ||||
| 	flush(); | ||||
| 	$counter=1; | ||||
| 	$schema_matching_rules = get_schema_matching_rules(null); | ||||
| 	if( ! $schema_matching_rules ) StatusMessage("ERROR", _("Unable to retrieve schema!"), ""); | ||||
| 	foreach( $schema_matching_rules as $rule ) { | ||||
| 		$counter++; | ||||
| 		$oid = htmlspecialchars( $rule->getOID() ); | ||||
| 		$desc = htmlspecialchars( $rule->getName() ); | ||||
| 		if ( $viewvalue === null || $viewvalue==($rule->getName() )) { | ||||
|         if( ! is_null( $viewvalue ) ) | ||||
|             $viewed = true; | ||||
| 		if( null !== $rule->getDescription() ) | ||||
| 			$desc .= ' (' . $rule->getDescription() . ')'; | ||||
| 		if( true === $rule->getIsObsolete() ) | ||||
| 			$desc .= ' <span style="color:red">' . _('Obsolete') . '</span>'; | ||||
| 		echo "<tr class=\"" . ($counter%2==0?'even':'odd'). "\">"; | ||||
| 		echo "<td>$oid</td>"; | ||||
| 		echo "<td>$desc</td>"; | ||||
| 		echo "<td>"; | ||||
| 		if( count( $rule->getUsedByAttrs() ) == 0 ) { | ||||
| 			echo "<center>(" . _('none') . ")</center><br /><br />\n"; | ||||
| 		} else { | ||||
| 			echo "<table><tr><td style=\"text-align: right\"><form action=\"schema.php\" method=\"get\">"; | ||||
| 			echo "<input type=\"hidden\" name=\"view\" value=\"attributes\" />"; | ||||
| 			echo "<select style=\"width: 150px; color:black; background-color: #eee\" size=\"4\" name=\"viewvalue\">\n"; | ||||
| 			foreach( $rule->getUsedByAttrs() as $attr ) | ||||
| 				echo "<option>$attr</option>\n"; | ||||
| 			echo "</select><br /><input type=\"submit\" value=\""._('Go')."\" /></form></td></tr></table>\n"; | ||||
| 		} | ||||
| 		echo "</td></tr>\n"; | ||||
| 		  } | ||||
| 	} | ||||
| 	echo "</table>\n"; | ||||
| 
 | ||||
| } elseif( $view == 'objectClasses' ) { | ||||
| 	flush(); | ||||
| 	$schema_oclasses = get_schema_objectclasses(null); | ||||
| 	if( ! $schema_oclasses ) StatusMessage("ERROR", _("Unable to retrieve schema!"), ""); | ||||
| 	?>
 | ||||
| 	<small><?php echo _('Jump to an object class'); ?>:</small>
 | ||||
| 	<form action="schema.php" method="get"><input type="hidden" name="view" value="<?php echo $view; ?>" /> | ||||
| 	<select name="viewvalue" | ||||
| 	onChange="submit()"> | ||||
|         <option value=""> - all - </option> | ||||
| 	<?php foreach( $schema_oclasses as $name => $oclass ) { | ||||
| 		echo '<option value="' | ||||
| 		     .$oclass->getName() | ||||
|                      .'"' | ||||
|                      . ( 0 == strcasecmp( $oclass->getName(), $viewvalue ) ? ' selected ':'') | ||||
|                      .'>'.$oclass->getName() | ||||
| 		     .'</option>'; | ||||
| 	 } ?>
 | ||||
|         </select><input type="submit" value="<?php echo _('Go'); ?>" /> | ||||
|         </form> | ||||
| 
 | ||||
|         <?php flush(); ?>
 | ||||
| 
 | ||||
|     <?php foreach( $schema_oclasses as $name => $oclass ) { | ||||
|         foreach( $oclass->getSupClasses() as $parent_name ) { | ||||
|             $parent_name = $parent_name; | ||||
|             if( isset( $schema_oclasses[ $parent_name ] ) ) { | ||||
|                 $schema_oclasses[ $parent_name ]->addChildObjectClass( $oclass->getName() ); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|     } ?>
 | ||||
| 
 | ||||
| 	<br /> | ||||
| 	<?php foreach( $schema_oclasses as $name => $oclass ) { | ||||
| 	  if ( $viewvalue === null || 0 == strcasecmp( $viewvalue, $oclass->getName() ) ){ | ||||
|         if( ! is_null( $viewvalue ) ) | ||||
|             $viewed = true; | ||||
|         ?>
 | ||||
| 
 | ||||
| 		<h4 class="schema_oclass"><?php echo $oclass->getName(); ?></h4>
 | ||||
| 		<h4 class="schema_oclass_sub"><?php echo _('OID'); ?>: <b><?php echo $oclass->getOID(); ?></b></h4>
 | ||||
| 		<?php if( $oclass->getDescription() ) { ?>
 | ||||
| 			<h4 class="schema_oclass_sub"><?php echo _('Description'); ?>: <b><?php echo $oclass->getDescription(); ?></b></h4>
 | ||||
| 		<?php } ?>
 | ||||
| 		<h4 class="schema_oclass_sub"><?php echo _('Type'); ?>: <b><?php echo $oclass->getType(); ?></b></h4>
 | ||||
| 		<?php if( $oclass->getIsObsolete() === true ) { ?>
 | ||||
| 			<h4 class="schema_oclass_sub"><?php echo _('This object class is obsolete.'); ?></h4>
 | ||||
| 		<?php } ?>
 | ||||
| 
 | ||||
| 		<h4 class="schema_oclass_sub"><?php echo _('Inherits from'); ?>: <b><?php
 | ||||
| 		if( count( $oclass->getSupClasses() ) == 0 ) | ||||
| 			echo "(" . _('none') . ")"; | ||||
| 		else | ||||
| 			foreach( $oclass->getSupClasses() as $i => $object_class ) { | ||||
| 				echo '<a title="' . _('Jump to an object class') . ' " | ||||
| 					href="?view='.$view.'&viewvalue='.htmlspecialchars( $object_class ) ;
 | ||||
| 				echo '">' . htmlspecialchars( $object_class ) . '</a>'; | ||||
| 				if( $i < count( $oclass->getSupClasses() ) - 1 ) | ||||
| 					echo ', '; | ||||
| 		} | ||||
| 		?></b></h4>
 | ||||
| 
 | ||||
| 		<h4 class="schema_oclass_sub"><?php echo _('Parent to'); ?>: <b><?php
 | ||||
|         if( 0 == strcasecmp( $oclass->getName(), 'top' ) ) | ||||
|             echo "(<a href=\"schema.php?view=objectClasses\">all</a>)"; | ||||
| 		elseif( count( $oclass->getChildObjectClasses() ) == 0 ) | ||||
| 			echo "(" . _('none') . ")"; | ||||
| 		else | ||||
| 			foreach( $oclass->getChildObjectClasses() as $i => $object_class ) { | ||||
| 				echo '<a title="' . _('Jump to an object class') . ' " | ||||
| 					href="?view='.$view.'&viewvalue='.htmlspecialchars( $object_class ) ;
 | ||||
| 				echo '">' . htmlspecialchars( $object_class ) . '</a>'; | ||||
| 				if( $i < count( $oclass->getChildObjectClasses() ) - 1 ) | ||||
| 					echo ', '; | ||||
| 		} | ||||
| 		?></b></h4>
 | ||||
| 
 | ||||
| 		<table width="100%" class="schema_oclasses"> | ||||
| 		<tr> | ||||
| 			<th width="50%"><b><?php echo _('Required attributes'); ?></b></th>
 | ||||
| 			<th width="50%"><b><?php echo _('Optional attributes'); ?></b></th>
 | ||||
| 		</tr> | ||||
| 		<tr> | ||||
| 			<td> | ||||
| 			<?php if( count( $oclass->getMustAttrs($schema_oclasses) ) > 0 ) { | ||||
| 				echo '<ul class="schema">'; | ||||
| 				foreach( $oclass->getMustAttrs($schema_oclasses) as $attr ) { | ||||
| 					echo "<li><a href=\"?view=attributes&viewvalue="; | ||||
| 					echo rawurlencode( $attr->getName()  ). "\">" . htmlspecialchars($attr->getName()); | ||||
| 					echo "</a>"; | ||||
| 					if( $attr->getSource() != $oclass->getName() ) | ||||
| 					{ | ||||
| 						echo "<br /><small>  ("._('Inherited from')." "; | ||||
| 						echo "<a href=\"?view=objectClasses&viewvalue=" . $attr->getSource()  . "\">" . $attr->getSource() . "</a>"; | ||||
| 						echo ")</small>"; | ||||
| 					} | ||||
| 					echo "</li>\n"; | ||||
| 				} | ||||
| 				echo "</ul>"; | ||||
| 			} else | ||||
| 				echo "<center>(" . _('none') . ")</center>\n"; | ||||
| 			?>
 | ||||
| 		</td> | ||||
| 		<td width="50%"> | ||||
| 		<?php | ||||
| 		if( count( $oclass->getMayAttrs($schema_oclasses) ) > 0 ) { | ||||
| 			echo '<ul class="schema">'; | ||||
| 			foreach( $oclass->getMayAttrs($schema_oclasses) as $attr ) { | ||||
| 				echo "<li><a href=\"?view=attributes&viewvalue="; | ||||
| 				echo rawurlencode( $attr->getName() ) . "\">" . htmlspecialchars($attr->getName() ); | ||||
| 				echo "</a>\n"; | ||||
| 				if( $attr->getSource() != $oclass->getName() ) | ||||
| 				{ | ||||
| 					echo "<br /><small>   ("._('Inherited from')." "; | ||||
| 					echo "<a href=\"?view=objectClasses&viewvalue=" . $attr->getSource()  . "\">" . $attr->getSource() . "</a>"; | ||||
| 					echo ")</small>"; | ||||
| 				} | ||||
| 				echo "</li>"; | ||||
| 			} | ||||
| 			echo "</ul>"; | ||||
| 		} | ||||
| 		else | ||||
| 			echo "<center>(" . _('none') . ")</center>\n"; | ||||
| 	?>
 | ||||
| 
 | ||||
| 	</td> | ||||
| 	</tr> | ||||
| 	</table> | ||||
| 
 | ||||
| 	<?php }  } /* End foreach objectClass */ ?>
 | ||||
| <?php } /* End else (displaying objectClasses */ ?>
 | ||||
| 
 | ||||
| <?php | ||||
| if( ! is_null( $viewvalue ) && ! $viewed ) { | ||||
|     StatusMessage("ERROR",  sprintf( _('No such schema item: "%s"'), htmlspecialchars( $viewvalue ) ) ); | ||||
| $availableViews = array('objectClass', 'attribute', 'syntax', 'rule'); | ||||
| $selectedView = 'objectClass'; | ||||
| if (!empty($_GET['display']) && in_array($_GET['display'], $availableViews)) { | ||||
| 	$selectedView = $_GET['display']; | ||||
| } | ||||
| 
 | ||||
| $tabindex = 1; | ||||
| 
 | ||||
| $row = new htmlResponsiveRow(); | ||||
| $row->addVerticalSpacer('2rem'); | ||||
| $row->add(new htmlSpacer('1rem', '1px'), 0, 2); | ||||
| $row->add(new htmlLink(_('Object classes'), 'schema.php'), 12, 2, 2, 'font-big text-center'); | ||||
| $row->add(new htmlLink(_('Attribute types'), 'schema.php?display=attribute'), 12, 2, 2, 'font-big text-center'); | ||||
| $row->add(new htmlLink(_('Syntaxes'), 'schema.php?display=syntax'), 12, 2, 2, 'font-big text-center'); | ||||
| $row->add(new htmlLink(_('Matching rules'), 'schema.php?display=rule'), 12, 2, 2, 'font-big text-center'); | ||||
| $row->add(new htmlSpacer('1rem', '1px'), 0, 2); | ||||
| $row->addVerticalSpacer('2rem'); | ||||
| 
 | ||||
| if ($selectedView === 'syntax') { | ||||
| 	displaySyntaxList($row); | ||||
| } | ||||
| elseif( $selectedView == 'attribute' ) { | ||||
| 	displayAttributeList($row); | ||||
| } | ||||
| elseif ($selectedView === 'rule') { | ||||
| 	displayRuleList($row); | ||||
| } | ||||
| elseif( $selectedView == 'objectClass' ) { | ||||
| 	displayObjectClassList($row); | ||||
| } | ||||
| 
 | ||||
| parseHtml(null, $row, array(), false, $tabindex, 'user'); | ||||
| 
 | ||||
| echo '</div>'; | ||||
| include '../../lib/adminFooter.inc'; | ||||
| 
 | ||||
| /** | ||||
|  * Displays the syntax list. | ||||
|  * | ||||
|  * @param htmlResponsiveRow $row row | ||||
|  */ | ||||
| function displaySyntaxList(htmlResponsiveRow &$row) { | ||||
| 	$schema_syntaxes = get_schema_syntaxes(null); | ||||
| 	if (!$schema_syntaxes) { | ||||
| 		$row->add(new htmlStatusMessage("ERROR", _("Unable to retrieve schema!")), 12); | ||||
| 		return; | ||||
| 	} | ||||
| 	$data = array(); | ||||
| 	$labels = array(_('Syntax OID'), _('Description')); | ||||
| 	$pos = 0; | ||||
| 	$highlighted = array(); | ||||
| 	foreach( $schema_syntaxes as $syntax ) { | ||||
| 		$oid = new htmlOutputText($syntax->getOID()); | ||||
| 		$description = new htmlOutputText($syntax->getDescription()); | ||||
| 		$data[] = array($oid, $description); | ||||
| 		if (!empty($_GET['sel']) && ($syntax->getOID() === $_GET['sel'])) { | ||||
| 			$highlighted[] = $pos; | ||||
| 		} | ||||
| 		$pos++; | ||||
| 	} | ||||
| 	$row->add(new htmlResponsiveTable($labels, $data, $highlighted), 12); | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Displays the matching rule list. | ||||
|  * | ||||
|  * @param htmlResponsiveRow $row row | ||||
|  */ | ||||
| function displayRuleList(htmlResponsiveRow &$row) { | ||||
|     $rules = get_schema_matching_rules(null); | ||||
| 	if (!$rules) { | ||||
| 		$row->add(new htmlStatusMessage("ERROR", _("Unable to retrieve schema!")), 12); | ||||
| 		return; | ||||
| 	} | ||||
|     $row->addLabel(new htmlOutputText(_('Jump to a matching rule'))); | ||||
|     $availableRules = array(''); | ||||
|     foreach ($rules as $rule) { | ||||
| 		$availableRules[] = $rule->getName(); | ||||
|     } | ||||
|     $selectedRule = array(); | ||||
|     if (!empty($_GET['sel']) && in_array($_GET['sel'], $availableRules)) { | ||||
|     	$selectedRule[] = $_GET['sel']; | ||||
|     } | ||||
|     $ruleSelect = new htmlSelect('lam-schema-select', $availableRules, $selectedRule); | ||||
|     $ruleSelect->addDataAttribute('display', 'rule'); | ||||
| 	$row->addField($ruleSelect); | ||||
| 	$row->addVerticalSpacer('1rem'); | ||||
| 
 | ||||
| 	$labels = array(_('Matching rule OID'), _('Name'), _('Used by attributes')); | ||||
| 	$data = array(); | ||||
| 	foreach ($rules as $rule) { | ||||
| 		if (!empty($selectedRule) && !in_array($rule->getName(), $selectedRule)) { | ||||
| 			continue; | ||||
| 		} | ||||
| 		$oid = new htmlOutputText($rule->getOID()); | ||||
| 		$name = $rule->getName(); | ||||
| 		if (!empty($rule->getDescription())) { | ||||
| 			$name .= ' (' . $rule->getDescription() . ')'; | ||||
| 		} | ||||
| 		if ($rule->getIsObsolete()) { | ||||
| 			$name .= ' (' . _('Obsolete') . ')'; | ||||
| 		} | ||||
| 		$nameText = new htmlOutputText($name); | ||||
| 		$attributes = new htmlGroup(); | ||||
| 		foreach ($rule->getUsedByAttrs() as $attr) { | ||||
| 			$attributes->addElement(new htmlDiv(null, new htmlLink($attr, 'schema.php?display=attribute&sel=' . $attr))); | ||||
| 		} | ||||
| 		$data[] = array($oid, $nameText, new htmlDiv(null, $attributes, array('smallScroll'))); | ||||
| 	} | ||||
| 
 | ||||
| 	$row->add(new htmlResponsiveTable($labels, $data), 12); | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Displays the object class list. | ||||
|  * | ||||
|  * @param htmlResponsiveRow $row row | ||||
|  */ | ||||
| function displayObjectClassList(htmlResponsiveRow &$row) { | ||||
| 	$objectClasses = get_schema_objectclasses(null); | ||||
| 	if (!$objectClasses) { | ||||
| 		$row->add(new htmlStatusMessage("ERROR", _("Unable to retrieve schema!")), 12); | ||||
| 		return; | ||||
| 	} | ||||
|     $row->addLabel(new htmlOutputText(_('Jump to an object class'))); | ||||
|     $availableClasses = array(_('all') => ''); | ||||
|     foreach ($objectClasses as $objectClass) { | ||||
| 		$availableClasses[$objectClass->getName()] = $objectClass->getName(); | ||||
|     } | ||||
|     $selectedClass = array(); | ||||
|     if (isset($_GET['sel']) && (empty($_GET['sel']) || array_key_exists(strtolower($_GET['sel']), $objectClasses))) { | ||||
|     	$selectedClass[0] = $_GET['sel']; | ||||
|     } | ||||
|     if (empty($selectedClass) && (sizeof($objectClasses) > 0)) { | ||||
|     	// select first class by default
 | ||||
|     	$selectedClassNames = array_keys($objectClasses); | ||||
|     	$selectedClass[0] = $selectedClassNames[0]; | ||||
|     } | ||||
|     $classSelect = new htmlSelect('lam-schema-select', $availableClasses, $selectedClass); | ||||
|     $classSelect->addDataAttribute('display', 'objectClass'); | ||||
|     $classSelect->setHasDescriptiveElements(true); | ||||
|     $classSelect->setSortElements(false); | ||||
| 	$row->addField($classSelect); | ||||
| 	$row->addVerticalSpacer('1rem'); | ||||
| 
 | ||||
| 	// fill child object classes
 | ||||
| 	foreach ($objectClasses as $name => $objectClass) { | ||||
| 		if (!empty($objectClass->getSupClasses())) { | ||||
| 			foreach ($objectClass->getSupClasses() as $subClass) { | ||||
| 				if (!isset($objectClasses[strtolower($subClass)])) { | ||||
| 					continue; | ||||
| 				} | ||||
| 				$objectClasses[strtolower($subClass)]->addChildObjectClass($name); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	foreach ($objectClasses as $name => $objectClass) { | ||||
| 		if (!empty($selectedClass[0]) && ($name !== strtolower($selectedClass[0]))) { | ||||
| 			continue; | ||||
| 		} | ||||
| 		$row->add(new htmlSubTitle($name), 12); | ||||
| 		$row->addLabel(new htmlOutputText(_('OID')), 'bold-mobile-only'); | ||||
| 		$row->addField(new htmlOutputText($objectClass->getOID())); | ||||
| 		if (!empty($objectClass->getDescription())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Description')), 'bold-mobile-only'); | ||||
| 			$row->addField(new htmlOutputText($objectClass->getDescription())); | ||||
| 		} | ||||
| 		$row->addLabel(new htmlOutputText(_('Type')), 'bold-mobile-only'); | ||||
| 		$row->addField(new htmlOutputText($objectClass->getType())); | ||||
| 		if ($objectClass->getIsObsolete()) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Obsolete'))); | ||||
| 			$row->addField(new htmlOutputText(_('yes'))); | ||||
| 		} | ||||
| 		if (!empty($objectClass->getSupClasses())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Inherits from')), 'bold-mobile-only'); | ||||
| 			$subClasses = new htmlGroup(); | ||||
| 			foreach ($objectClass->getSupClasses() as $subClass) { | ||||
| 				$subClasses->addElement(new htmlDiv(null, new htmlLink($subClass, 'schema.php?display=objectClass&sel=' . rawurlencode($subClass)))); | ||||
| 			} | ||||
| 			$row->addField($subClasses); | ||||
| 		} | ||||
| 		if (!empty($objectClass->getChildObjectClasses())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Parent to')), 'bold-mobile-only'); | ||||
| 			$subClasses = new htmlGroup(); | ||||
| 			foreach ($objectClass->getChildObjectClasses() as $subClass) { | ||||
| 				$subClasses->addElement(new htmlDiv(null, new htmlLink($subClass, 'schema.php?display=objectClass&sel=' . rawurlencode($subClass)))); | ||||
| 			} | ||||
| 			$row->addField($subClasses); | ||||
| 		} | ||||
| 		if (!empty($objectClass->getMustAttrs())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Required attributes')), 'bold-mobile-only'); | ||||
| 			$attributes = new htmlGroup(); | ||||
| 			foreach ($objectClass->getMustAttrs() as $attribute) { | ||||
| 				$attributes->addElement(new htmlDiv(null, new htmlLink($attribute->getName(), 'schema.php?display=attribute&sel=' . rawurlencode($attribute->getName())))); | ||||
| 			} | ||||
| 			$row->addField($attributes); | ||||
| 		} | ||||
| 		if (!empty($objectClass->getMayAttrs())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Optional attributes')), 'bold-mobile-only'); | ||||
| 			$attributes = new htmlGroup(); | ||||
| 			foreach ($objectClass->getMayAttrs() as $attribute) { | ||||
| 				$attributes->addElement(new htmlDiv(null, new htmlLink($attribute->getName(), 'schema.php?display=attribute&sel=' . rawurlencode($attribute->getName())))); | ||||
| 			} | ||||
| 			$row->addField($attributes); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Displays the attributes list. | ||||
|  * | ||||
|  * @param htmlResponsiveRow $row row | ||||
|  */ | ||||
| function displayAttributeList(htmlResponsiveRow $row) { | ||||
| 	$attributes = get_schema_attributes(null); | ||||
| 	if (!$attributes) { | ||||
| 		$row->add(new htmlStatusMessage("ERROR", _("Unable to retrieve schema!")), 12); | ||||
| 		return; | ||||
| 	} | ||||
| 	$row->addLabel(new htmlOutputText(_('Jump to an attribute type'))); | ||||
| 	$availableAttributes = array(_('all') => ''); | ||||
| 	foreach ($attributes as $attribute) { | ||||
| 		$availableAttributes[$attribute->getName()] = $attribute->getName(); | ||||
| 	} | ||||
| 	$selectedAttribute = array(); | ||||
| 	if (isset($_GET['sel']) && (empty($_GET['sel']) || array_key_exists(strtolower($_GET['sel']), $attributes))) { | ||||
| 		$selectedAttribute[0] = $_GET['sel']; | ||||
| 	} | ||||
| 	if (empty($selectedAttribute) && (sizeof($availableAttributes) > 0)) { | ||||
| 		// select first attribute by default
 | ||||
| 		$attributeNames = array_keys($availableAttributes); | ||||
| 		$selectedAttribute[0] = $attributeNames[1]; | ||||
| 	} | ||||
| 	$attributeSelect = new htmlSelect('lam-schema-select', $availableAttributes, $selectedAttribute); | ||||
| 	$attributeSelect->addDataAttribute('display', 'attribute'); | ||||
| 	$attributeSelect->setHasDescriptiveElements(true); | ||||
| 	$attributeSelect->setSortElements(false); | ||||
| 	$row->addField($attributeSelect); | ||||
| 	$row->addVerticalSpacer('1rem'); | ||||
| 
 | ||||
| 	foreach ($attributes as $name => $attribute) { | ||||
| 		if (!empty($selectedAttribute[0]) && ($name !== strtolower($selectedAttribute[0]))) { | ||||
| 			continue; | ||||
| 		} | ||||
| 		$row->add(new htmlSubTitle($name), 12); | ||||
| 		if (!empty($attribute->getDescription())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Description')), 'bold-mobile-only'); | ||||
| 			$row->addField(new htmlOutputText($attribute->getDescription())); | ||||
| 		} | ||||
| 		$row->addLabel(new htmlOutputText(_('OID')), 'bold-mobile-only'); | ||||
| 		$row->addField(new htmlOutputText($attribute->getOID())); | ||||
| 		if ($attribute->getIsObsolete()) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Obsolete')), 'bold-mobile-only'); | ||||
| 			$row->addField(new htmlOutputText(_('yes'))); | ||||
| 		} | ||||
| 		if (!empty($attribute->getSupAttribute())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Inherits from')), 'bold-mobile-only'); | ||||
| 			$row->addField(new htmlOutputText($attribute->getSupAttribute())); | ||||
| 		} | ||||
| 		if (!empty($attribute->getEquality())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Equality')), 'bold-mobile-only'); | ||||
| 			$row->addField(new htmlLink($attribute->getEquality(), 'schema.php?display=rule&sel=' . rawurldecode($attribute->getEquality()))); | ||||
| 		} | ||||
| 		if (!empty($attribute->getOrdering())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Ordering')), 'bold-mobile-only'); | ||||
| 			$row->addField(new htmlLink($attribute->getOrdering(), 'schema.php?display=rule&sel=' . rawurldecode($attribute->getOrdering()))); | ||||
| 		} | ||||
| 		if (!empty($attribute->getSubstr())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Substring Rule')), 'bold-mobile-only'); | ||||
| 			$row->addField(new htmlLink($attribute->getSubstr(), 'schema.php?display=rule&sel=' . rawurldecode($attribute->getSubstr()))); | ||||
| 		} | ||||
| 		if (!empty($attribute->getSyntaxOID())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Syntax')), 'bold-mobile-only'); | ||||
| 			$row->addField(new htmlLink($attribute->getSyntaxOID(), 'schema.php?display=syntax&sel=' . rawurldecode($attribute->getSyntaxOID()))); | ||||
| 		} | ||||
| 		$row->addLabel(new htmlOutputText(_('Single valued')), 'bold-mobile-only'); | ||||
| 		$row->addField(new htmlOutputText($attribute->getIsSingleValue() ? _('yes') : _('no'))); | ||||
| 		$row->addLabel(new htmlOutputText(_('Collective')), 'bold-mobile-only'); | ||||
| 		$row->addField(new htmlOutputText($attribute->getIsCollective() ? _('yes') : _('no'))); | ||||
| 		$row->addLabel(new htmlOutputText(_('User modification')), 'bold-mobile-only'); | ||||
| 		$row->addField(new htmlOutputText($attribute->getIsNoUserModification() ? _('no') : _('yes'))); | ||||
| 		if (!empty($attribute->getUsage())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Usage')), 'bold-mobile-only'); | ||||
| 			$row->addField(new htmlOutputText($attribute->getUsage())); | ||||
| 		} | ||||
| 		if (!empty($attribute->getMaxLength())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Maximum length')), 'bold-mobile-only'); | ||||
| 			$row->addField(new htmlOutputText($attribute->getMaxLength())); | ||||
| 		} | ||||
| 		if (!empty($attribute->getAliases())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Aliases')), 'bold-mobile-only'); | ||||
| 			$aliases = new htmlGroup(); | ||||
| 			foreach ($attribute->getAliases() as $alias) { | ||||
| 				$aliases->addElement(new htmlDiv(null, new htmlLink($alias, 'schema.php?display=attribute&sel=' . rawurlencode($alias)))); | ||||
| 			} | ||||
| 			$row->addField($aliases); | ||||
| 		} | ||||
| 		if (!empty($attribute->getUsedInObjectClasses())) { | ||||
| 			$row->addLabel(new htmlOutputText(_('Used by object classes')), 'bold-mobile-only'); | ||||
| 			$objectClasses = new htmlGroup(); | ||||
| 			foreach ($attribute->getUsedInObjectClasses() as $objectClass) { | ||||
| 				$objectClasses->addElement(new htmlDiv(null, new htmlLink($objectClass, 'schema.php?display=objectClass&sel=' . rawurlencode($objectClass)))); | ||||
| 			} | ||||
| 			$row->addField($objectClasses); | ||||
| 		} | ||||
| 
 | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| include '../main_footer.php'; | ||||
| ?>
 | ||||
|  |  | |||
|  | @ -1,9 +1,8 @@ | |||
| <?php | ||||
| /* | ||||
| $Id$ | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2009 - 2017  Roland Gruber | ||||
|   Copyright (C) 2009 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -88,130 +87,116 @@ if ($result) { | |||
| } | ||||
| 
 | ||||
| // get additional information if monitoring is enabled
 | ||||
| $monitorResult = searchLDAP('cn=monitor', 'objectClass=*', array('*', '+')); | ||||
| $monitorResults = searchLDAP('cn=monitor', 'objectClass=*', array('*', '+')); | ||||
| $monitorEntries = array(); | ||||
| for ($i = 0; $i < sizeof($monitorResult); $i++) { | ||||
| 	$monitorEntries[$monitorResult[$i]['dn']] = array_change_key_case($monitorResult[$i], CASE_LOWER); | ||||
| foreach ($monitorResults as $monitorResult) { | ||||
| 	$monitorEntries[$monitorResult['dn']] = array_change_key_case($monitorResult, CASE_LOWER); | ||||
| } | ||||
| $monitorEntries = array_change_key_case($monitorEntries, CASE_LOWER); | ||||
| 
 | ||||
| include 'main_header.php'; | ||||
| include '../lib/adminHeader.inc'; | ||||
| echo '<div class="user-bright smallPaddingContent">'; | ||||
| $tabindex = 1; | ||||
| $container = new htmlTable(); | ||||
| $spacer = new htmlSpacer('20px', null); | ||||
| $container = new htmlResponsiveRow(); | ||||
| 
 | ||||
| $container->addElement(new htmlTitle(_("Server information")), true); | ||||
| $container->add(new htmlTitle(_("Server information")), 12); | ||||
| 
 | ||||
| $container->addElement(new htmlOutputText('<b>' . _("Managed suffixes") . '</b>', false)); | ||||
| $container->addElement($spacer); | ||||
| $container->addElement(new htmlOutputText($namingContexts), true); | ||||
| if (!empty($namingContexts)) { | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("Managed suffixes") . '</b>', false)); | ||||
| 	$container->addField(new htmlOutputText($namingContexts)); | ||||
| } | ||||
| 
 | ||||
| $container->addElement(new htmlOutputText('<b>' . _("LDAP version") . '</b>', false)); | ||||
| $container->addElement($spacer); | ||||
| $container->addElement(new htmlOutputText($supportedldapversion), true); | ||||
| if (!empty($supportedldapversion)) { | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("LDAP version") . '</b>', false)); | ||||
| 	$container->addField(new htmlOutputText($supportedldapversion)); | ||||
| } | ||||
| 
 | ||||
| if ($configcontext != '') { | ||||
| 	$container->addElement(new htmlOutputText('<b>' . _("Config suffix") . '</b>', false)); | ||||
| 	$container->addElement($spacer); | ||||
| 	$container->addElement(new htmlOutputText($configcontext), true); | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("Config suffix") . '</b>', false)); | ||||
| 	$container->addField(new htmlOutputText($configcontext)); | ||||
| } | ||||
| 
 | ||||
| $container->addElement(new htmlOutputText('<b>' . _("Schema suffix") . '</b>', false)); | ||||
| $container->addElement($spacer); | ||||
| $container->addElement(new htmlOutputText($subschemasubentry), true); | ||||
| $container->addLabel(new htmlOutputText('<b>' . _("Schema suffix") . '</b>', false)); | ||||
| $container->addField(new htmlOutputText($subschemasubentry)); | ||||
| 
 | ||||
| if ($dynamicSubtrees != '') { | ||||
| 	$container->addElement(new htmlOutputText('<b>' . _("Dynamic subtrees") . '</b>', false)); | ||||
| 	$container->addElement($spacer); | ||||
| 	$container->addElement(new htmlOutputText($dynamicSubtrees), true); | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("Dynamic subtrees") . '</b>', false)); | ||||
| 	$container->addField(new htmlOutputText($dynamicSubtrees)); | ||||
| } | ||||
| 
 | ||||
| $container->addElement(new htmlOutputText('<b>' . _("SASL mechanisms") . '</b>', false)); | ||||
| $container->addElement($spacer); | ||||
| $container->addElement(new htmlOutputText($supportedsaslmechanisms), true); | ||||
| if (!empty($supportedsaslmechanisms)) { | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("SASL mechanisms") . '</b>', false)); | ||||
| 	$container->addField(new htmlOutputText($supportedsaslmechanisms)); | ||||
| } | ||||
| 
 | ||||
| if ($vendorname != '') { | ||||
| 	$container->addElement(new htmlOutputText('<b>' . _("Vendor name") . '</b>', false)); | ||||
| 	$container->addElement($spacer); | ||||
| 	$container->addElement(new htmlOutputText($vendorname), true); | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("Vendor name") . '</b>', false)); | ||||
| 	$container->addField(new htmlOutputText($vendorname)); | ||||
| } | ||||
| 
 | ||||
| if ($vendorversion != '') { | ||||
| 	$container->addElement(new htmlOutputText('<b>' . _("Vendor version") . '</b>', false)); | ||||
| 	$container->addElement($spacer); | ||||
| 	$container->addElement(new htmlOutputText($vendorversion), true); | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("Vendor version") . '</b>', false)); | ||||
| 	$container->addField(new htmlOutputText($vendorversion)); | ||||
| } | ||||
| 
 | ||||
| // monitoring information
 | ||||
| if (isset($monitorEntries['cn=monitor']['monitoredinfo'])) { | ||||
| 	$container->addElement(new htmlOutputText('<b>' . _("Name") . '</b>', false)); | ||||
| 	$container->addElement($spacer); | ||||
| 	$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['monitoredinfo'])), true); | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("Name") . '</b>', false)); | ||||
| 	$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['monitoredinfo']))); | ||||
| } | ||||
| if (isset($monitorEntries['cn=listeners,cn=monitor'])) { | ||||
| 	$container->addElement(new htmlOutputText('<b>' . _("Listeners") . '</b>', false)); | ||||
| 	$container->addElement($spacer); | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("Listeners") . '</b>', false)); | ||||
| 	$listeners = array(); | ||||
| 	$l = 0; | ||||
| 	while (isset($monitorEntries['cn=listener ' . $l . ',cn=listeners,cn=monitor'])) { | ||||
| 		$listeners[] = $monitorEntries['cn=listener ' . $l . ',cn=listeners,cn=monitor']['monitorconnectionlocaladdress'][0]; | ||||
| 		$l++; | ||||
| 	} | ||||
| 	$container->addElement(new htmlOutputText(implode(', ', $listeners)), true); | ||||
| 	$container->addField(new htmlOutputText(implode(', ', $listeners))); | ||||
| } | ||||
| if (isset($monitorEntries['cn=backends,cn=monitor'])) { | ||||
| 	$container->addElement(new htmlOutputText('<b>' . _("Backends") . '</b>', false)); | ||||
| 	$container->addElement($spacer); | ||||
| 	$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=backends,cn=monitor']['monitoredinfo'])), true); | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("Backends") . '</b>', false)); | ||||
| 	$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=backends,cn=monitor']['monitoredinfo']))); | ||||
| } | ||||
| if (isset($monitorEntries['cn=overlays,cn=monitor'])) { | ||||
| 	$container->addElement(new htmlOutputText('<b>' . _("Overlays") . '</b>', false)); | ||||
| 	$container->addElement($spacer); | ||||
| 	$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=overlays,cn=monitor']['monitoredinfo'])), true); | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("Overlays") . '</b>', false)); | ||||
| 	$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=overlays,cn=monitor']['monitoredinfo']))); | ||||
| } | ||||
| if (isset($monitorEntries['cn=max file descriptors,cn=connections,cn=monitor'])) { | ||||
| 	$container->addElement(new htmlOutputText('<b>' . _("Max. file descriptors") . '</b>', false)); | ||||
| 	$container->addElement($spacer); | ||||
| 	$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=max file descriptors,cn=connections,cn=monitor']['monitorcounter'])), true); | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("Max. file descriptors") . '</b>', false)); | ||||
| 	$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=max file descriptors,cn=connections,cn=monitor']['monitorcounter']))); | ||||
| } | ||||
| 
 | ||||
| // server statistics
 | ||||
| if (isset($monitorEntries['cn=time,cn=monitor']) || isset($monitorEntries['cn=statistics,cn=monitor']) || isset($monitorEntries['cn=monitor']['currenttime'])) { | ||||
| 	$container->addElement(new htmlSubTitle(_('Server statistics')), true); | ||||
| 	$container->add(new htmlSubTitle(_('Server statistics')), 12); | ||||
| 	if (isset($monitorEntries['cn=entries,cn=statistics,cn=monitor'])) { | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("LDAP entries") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=entries,cn=statistics,cn=monitor']['monitorcounter'])), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("LDAP entries") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=entries,cn=statistics,cn=monitor']['monitorcounter']))); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=referrals,cn=statistics,cn=monitor'])) { | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Referrals") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=referrals,cn=statistics,cn=monitor']['monitorcounter'])), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Referrals") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=referrals,cn=statistics,cn=monitor']['monitorcounter']))); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=start,cn=time,cn=monitor'])) { | ||||
| 		$time = formatLDAPTimestamp($monitorEntries['cn=start,cn=time,cn=monitor']['monitortimestamp'][0]); | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Start time") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText($time), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Start time") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText($time), 12); | ||||
| 	} | ||||
| 	elseif (isset($monitorEntries['cn=monitor']['starttime'])) { // Fedora 389
 | ||||
| 		$time = formatLDAPTimestamp($monitorEntries['cn=monitor']['starttime'][0]); | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Start time") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText($time), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Start time") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText($time)); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=current,cn=time,cn=monitor'])) { | ||||
| 		$time = formatLDAPTimestamp($monitorEntries['cn=current,cn=time,cn=monitor']['monitortimestamp'][0]); | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Server time") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText($time), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Server time") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText($time)); | ||||
| 	} | ||||
| 	elseif (isset($monitorEntries['cn=monitor']['currenttime'])) { // Fedora 389
 | ||||
| 		$time = formatLDAPTimestamp($monitorEntries['cn=monitor']['currenttime'][0]); | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Server time") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText($time), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Server time") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText($time)); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=uptime,cn=time,cn=monitor'])) { | ||||
| 		$uptime = $monitorEntries['cn=uptime,cn=time,cn=monitor']['monitoredinfo'][0]; | ||||
|  | @ -220,189 +205,165 @@ if (isset($monitorEntries['cn=time,cn=monitor']) || isset($monitorEntries['cn=st | |||
| 		$hours = floor($daysRest / 3600); | ||||
| 		$hoursRest = $daysRest - ($hours * 3600); | ||||
| 		$minutes = floor($hoursRest / 60); | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Uptime") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText($days . ':' . $hours . ':' . $minutes), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Uptime") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText($days . ':' . $hours . ':' . $minutes)); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // connection statistics
 | ||||
| if (isset($monitorEntries['cn=connections,cn=monitor']) || isset($monitorEntries['cn=statistics,cn=monitor']) || isset($monitorEntries['cn=monitor']['currentconnections'])) { | ||||
| 	$container->addElement(new htmlSubTitle(_('Connection statistics')), true); | ||||
| 	$container->add(new htmlSubTitle(_('Connection statistics')), 12); | ||||
| 	if (isset($monitorEntries['cn=current,cn=connections,cn=monitor'])) { | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Current connections") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=current,cn=connections,cn=monitor']['monitorcounter'])), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Current connections") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=current,cn=connections,cn=monitor']['monitorcounter']))); | ||||
| 	} | ||||
| 	elseif (isset($monitorEntries['cn=monitor']['currentconnections'])) { // Fedora 389
 | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Current connections") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['currentconnections'])), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Current connections") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['currentconnections']))); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=total,cn=connections,cn=monitor'])) { | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Total connections") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=total,cn=connections,cn=monitor']['monitorcounter'])), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Total connections") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=total,cn=connections,cn=monitor']['monitorcounter']))); | ||||
| 	} | ||||
| 	elseif (isset($monitorEntries['cn=monitor']['totalconnections'])) { // Fedora 389
 | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Total connections") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['totalconnections'])), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Total connections") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['totalconnections']))); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=bytes,cn=statistics,cn=monitor'])) { | ||||
| 		$bytes = round($monitorEntries['cn=bytes,cn=statistics,cn=monitor']['monitorcounter'][0] / 1000000, 2) . 'MB'; | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Bytes sent") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText($bytes), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Bytes sent") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText($bytes)); | ||||
| 	} | ||||
| 	elseif (isset($monitorEntries['cn=monitor']['bytessent'])) { // Fedora 389
 | ||||
| 		$bytes = round($monitorEntries['cn=monitor']['bytessent'][0] / 1000000, 2) . 'MB'; | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Bytes sent") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText($bytes), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Bytes sent") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText($bytes)); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=pdu,cn=statistics,cn=monitor'])) { | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("PDUs sent") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText($monitorEntries['cn=pdu,cn=statistics,cn=monitor']['monitorcounter'][0]), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("PDUs sent") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText($monitorEntries['cn=pdu,cn=statistics,cn=monitor']['monitorcounter'][0])); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=monitor']['entriessent'])) { // Fedora 389
 | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Entries sent") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText($monitorEntries['cn=monitor']['entriessent'][0]), true); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Entries sent") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText($monitorEntries['cn=monitor']['entriessent'][0])); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // operation statistics (OpenLDAP)
 | ||||
| if (isset($monitorEntries['cn=operations,cn=monitor'])) { | ||||
| 	$container->addElement(new htmlSubTitle(_('Operation statistics')), true); | ||||
| 	$opStats = new htmlTable(); | ||||
| 	$opStats->colspan = 10; | ||||
| 	$opStats->addElement(new htmlOutputText('')); | ||||
| 	$opStats->addElement($spacer); | ||||
| 	$opStats->addElement(new htmlOutputText('<b>' . _("Initiated") . '</b>', false)); | ||||
| 	$opStats->addElement($spacer); | ||||
| 	$opStats->addElement(new htmlOutputText('<b>' . _("Completed") . '</b>', false), true); | ||||
| 	$container->add(new htmlSubTitle(_('Operation statistics')), 12); | ||||
| 	$data = array(); | ||||
| 	if (isset($monitorEntries['cn=bind,cn=operations,cn=monitor'])) { | ||||
| 		$opStats->addElement(new htmlOutputText('<b>' . _("Bind") . '</b>', false)); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=bind,cn=operations,cn=monitor']['monitoropinitiated']))); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=bind,cn=operations,cn=monitor']['monitoropcompleted'])), true); | ||||
| 		$data[] = array( | ||||
| 			new htmlOutputText('<b>' . _("Bind") . '</b>', false), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=bind,cn=operations,cn=monitor']['monitoropinitiated'])), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=bind,cn=operations,cn=monitor']['monitoropcompleted'])), | ||||
| 		); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=unbind,cn=operations,cn=monitor'])) { | ||||
| 		$opStats->addElement(new htmlOutputText('<b>' . _("Unbind") . '</b>', false)); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=unbind,cn=operations,cn=monitor']['monitoropinitiated']))); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=unbind,cn=operations,cn=monitor']['monitoropcompleted'])), true); | ||||
| 		$data[] = array( | ||||
| 			new htmlOutputText('<b>' . _("Unbind") . '</b>', false), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=unbind,cn=operations,cn=monitor']['monitoropinitiated'])), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=unbind,cn=operations,cn=monitor']['monitoropcompleted'])), | ||||
| 		); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=search,cn=operations,cn=monitor'])) { | ||||
| 		$opStats->addElement(new htmlOutputText('<b>' . _("Search") . '</b>', false)); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=search,cn=operations,cn=monitor']['monitoropinitiated']))); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=search,cn=operations,cn=monitor']['monitoropcompleted'])), true); | ||||
| 		$data[] = array( | ||||
| 			new htmlOutputText('<b>' . _("Search") . '</b>', false), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=search,cn=operations,cn=monitor']['monitoropinitiated'])), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=search,cn=operations,cn=monitor']['monitoropcompleted'])), | ||||
| 		); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=add,cn=operations,cn=monitor'])) { | ||||
| 		$opStats->addElement(new htmlOutputText('<b>' . _("Add") . '</b>', false)); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=add,cn=operations,cn=monitor']['monitoropinitiated']))); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=add,cn=operations,cn=monitor']['monitoropcompleted'])), true); | ||||
| 		$data[] = array( | ||||
| 			new htmlOutputText('<b>' . _("Add") . '</b>', false), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=add,cn=operations,cn=monitor']['monitoropinitiated'])), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=add,cn=operations,cn=monitor']['monitoropcompleted'])), | ||||
| 		); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=modify,cn=operations,cn=monitor'])) { | ||||
| 		$opStats->addElement(new htmlOutputText('<b>' . _("Modify") . '</b>', false)); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=modify,cn=operations,cn=monitor']['monitoropinitiated']))); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=modify,cn=operations,cn=monitor']['monitoropcompleted'])), true); | ||||
| 		$data[] = array( | ||||
| 			new htmlOutputText('<b>' . _("Modify") . '</b>', false), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=modify,cn=operations,cn=monitor']['monitoropinitiated'])), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=modify,cn=operations,cn=monitor']['monitoropcompleted'])), | ||||
| 		); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=delete,cn=operations,cn=monitor'])) { | ||||
| 		$opStats->addElement(new htmlOutputText('<b>' . _("Delete") . '</b>', false)); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=delete,cn=operations,cn=monitor']['monitoropinitiated']))); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=delete,cn=operations,cn=monitor']['monitoropcompleted'])), true); | ||||
| 		$data[] = array( | ||||
| 			new htmlOutputText('<b>' . _("Delete") . '</b>', false), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=delete,cn=operations,cn=monitor']['monitoropinitiated'])), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=delete,cn=operations,cn=monitor']['monitoropcompleted'])), | ||||
| 		); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=modrdn,cn=operations,cn=monitor'])) { | ||||
| 		$opStats->addElement(new htmlOutputText('<b>' . _("Modify RDN") . '</b>', false)); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=modrdn,cn=operations,cn=monitor']['monitoropinitiated']))); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=modrdn,cn=operations,cn=monitor']['monitoropcompleted'])), true); | ||||
| 		$data[] = array( | ||||
| 			new htmlOutputText('<b>' . _("Modify RDN") . '</b>', false), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=modrdn,cn=operations,cn=monitor']['monitoropinitiated'])), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=modrdn,cn=operations,cn=monitor']['monitoropcompleted'])), | ||||
| 		); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=compare,cn=operations,cn=monitor'])) { | ||||
| 		$opStats->addElement(new htmlOutputText('<b>' . _("Compare") . '</b>', false)); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=compare,cn=operations,cn=monitor']['monitoropinitiated']))); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=compare,cn=operations,cn=monitor']['monitoropcompleted'])), true); | ||||
| 		$data[] = array( | ||||
| 			new htmlOutputText('<b>' . _("Compare") . '</b>', false), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=compare,cn=operations,cn=monitor']['monitoropinitiated'])), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=compare,cn=operations,cn=monitor']['monitoropcompleted'])), | ||||
| 		); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=abandon,cn=operations,cn=monitor'])) { | ||||
| 		$opStats->addElement(new htmlOutputText('<b>' . _("Abandon") . '</b>', false)); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=abandon,cn=operations,cn=monitor']['monitoropinitiated']))); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=abandon,cn=operations,cn=monitor']['monitoropcompleted'])), true); | ||||
| 		$data[] = array( | ||||
| 			new htmlOutputText('<b>' . _("Abandon") . '</b>', false), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=abandon,cn=operations,cn=monitor']['monitoropinitiated'])), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=abandon,cn=operations,cn=monitor']['monitoropcompleted'])), | ||||
| 		); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=extended,cn=operations,cn=monitor'])) { | ||||
| 		$opStats->addElement(new htmlOutputText('<b>' . _("Extended") . '</b>', false)); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=extended,cn=operations,cn=monitor']['monitoropinitiated']))); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=extended,cn=operations,cn=monitor']['monitoropcompleted'])), true); | ||||
| 		$data[] = array( | ||||
| 			new htmlOutputText('<b>' . _("Extended") . '</b>', false), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=extended,cn=operations,cn=monitor']['monitoropinitiated'])), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=extended,cn=operations,cn=monitor']['monitoropcompleted'])), | ||||
| 		); | ||||
| 	} | ||||
| 	if (isset($monitorEntries['cn=operations,cn=monitor']['monitoropinitiated'])) { | ||||
| 		$opStats->addElement(new htmlSpacer(null, '10px'), true); | ||||
| 		$opStats->addElement(new htmlOutputText('<b>' . _("Total") . '</b>', false)); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=operations,cn=monitor']['monitoropinitiated']))); | ||||
| 		$opStats->addElement($spacer); | ||||
| 		$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=operations,cn=monitor']['monitoropcompleted'])), true); | ||||
| 		$data[] = array( | ||||
| 			new htmlOutputText('<b>' . _("Total") . '</b>', false), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=operations,cn=monitor']['monitoropinitiated'])), | ||||
| 			new htmlOutputText(implode(', ', $monitorEntries['cn=operations,cn=monitor']['monitoropcompleted'])), | ||||
| 		); | ||||
| 	} | ||||
| 	$container->addElement($opStats); | ||||
| 	$opStats = new htmlResponsiveTable(array('', _("Initiated"), _("Completed")), $data); | ||||
| 	$container->add($opStats, 12); | ||||
| } | ||||
| // operation statistics (389 server)
 | ||||
| elseif (isset($monitorEntries['cn=monitor']['opsinitiated'])) { | ||||
| 	$container->addElement(new htmlSubTitle(_('Operation statistics')), true); | ||||
| 	$container->addElement(new htmlOutputText('<b>' . _("Initiated") . '</b>', false)); | ||||
| 	$container->addElement($spacer); | ||||
| 	$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['opsinitiated'])), true); | ||||
| 	$container->addElement(new htmlOutputText('<b>' . _("Completed") . '</b>', false)); | ||||
| 	$container->addElement($spacer); | ||||
| 	$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['opscompleted'])), true); | ||||
| 	$container->add(new htmlSubTitle(_('Operation statistics')), 12); | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("Initiated") . '</b>', false)); | ||||
| 	$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['opsinitiated']))); | ||||
| 	$container->addLabel(new htmlOutputText('<b>' . _("Completed") . '</b>', false)); | ||||
| 	$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['opscompleted']))); | ||||
| 	if (isset($monitorEntries['cn=snmp,cn=monitor']['addentryops'])) { | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Bind") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Bind") . '</b>', false)); | ||||
| 		$binds = $monitorEntries['cn=snmp,cn=monitor']['anonymousbinds'][0] + $monitorEntries['cn=snmp,cn=monitor']['unauthbinds'][0] | ||||
| 					+ $monitorEntries['cn=snmp,cn=monitor']['simpleauthbinds'][0] + $monitorEntries['cn=snmp,cn=monitor']['strongauthbinds'][0]; | ||||
| 		$container->addElement(new htmlOutputText($binds), true); | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Search") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addField(new htmlOutputText($binds)); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Search") . '</b>', false)); | ||||
| 		$searches = $monitorEntries['cn=snmp,cn=monitor']['searchops'][0]; | ||||
| 		$container->addElement(new htmlOutputText($searches), true); | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Add") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['addentryops'])), true); | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Modify") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['modifyentryops'])), true); | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Delete") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['removeentryops'])), true); | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Modify RDN") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['modifyrdnops'])), true); | ||||
| 		$container->addElement(new htmlOutputText('<b>' . _("Compare") . '</b>', false)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['compareops'])), true); | ||||
| 		$container->addField(new htmlOutputText($searches)); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Add") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['addentryops']))); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Modify") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['modifyentryops']))); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Delete") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['removeentryops']))); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Modify RDN") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['modifyrdnops']))); | ||||
| 		$container->addLabel(new htmlOutputText('<b>' . _("Compare") . '</b>', false)); | ||||
| 		$container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['compareops']))); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| parseHtml(null, $container, array(), true, $tabindex, 'user'); | ||||
| 
 | ||||
| echo '</div>'; | ||||
| include 'main_footer.php'; | ||||
| include '../lib/adminFooter.inc'; | ||||
| 
 | ||||
| ?>
 | ||||
|  |  | |||
|  | @ -1,9 +1,13 @@ | |||
| <?php | ||||
| namespace LAM\TOOLS\TESTS; | ||||
| use \htmlResponsiveRow; | ||||
| use \htmlOutputText; | ||||
| use \htmlLink; | ||||
| use \htmlTitle; | ||||
| /* | ||||
| $Id$ | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2006 - 2017  Roland Gruber | ||||
|   Copyright (C) 2006 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -44,26 +48,24 @@ checkIfToolIsActive('toolTests'); | |||
| 
 | ||||
| setlanguage(); | ||||
| 
 | ||||
| include '../main_header.php'; | ||||
| include '../../lib/adminHeader.inc'; | ||||
| echo "<div class=\"user-bright smallPaddingContent\">\n"; | ||||
| 
 | ||||
| $container = new htmlTable(); | ||||
| $container->addElement(new htmlSubTitle(_("LAM tests")), true); | ||||
| $container = new htmlResponsiveRow(); | ||||
| $container->add(new htmlTitle(_("LAM tests")), 12); | ||||
| 
 | ||||
| $container->addElement(new htmlLink(_("Lamdaemon test"), 'lamdaemonTest.php', '../../graphics/lamdaemonSmall.png')); | ||||
| $container->addElement(new htmlSpacer('20px', null)); | ||||
| $container->addElement(new htmlOutputText(_("Check if quotas and homedirectories can be managed.")), true); | ||||
| $container->add(new htmlLink(_("Lamdaemon test"), 'lamdaemonTest.php', '../../graphics/lamdaemonSmall.png'), 12, 4); | ||||
| $container->add(new htmlOutputText(_("Check if quotas and homedirectories can be managed.")), 12, 8); | ||||
| 
 | ||||
| $container->addElement(new htmlSpacer(null, '20px'), true); | ||||
| $container->addVerticalSpacer('2rem'); | ||||
| 
 | ||||
| $container->addElement(new htmlLink(_("Schema test"), 'schemaTest.php', '../../graphics/schemaTest.png')); | ||||
| $container->addElement(new htmlSpacer('20px', null)); | ||||
| $container->addElement(new htmlOutputText(_("Check if the LDAP schema fits the requirements of the selected account modules.")), true); | ||||
| $container->add(new htmlLink(_("Schema test"), 'schemaTest.php', '../../graphics/schemaTest.png'), 12, 4); | ||||
| $container->add(new htmlOutputText(_("Check if the LDAP schema fits the requirements of the selected account modules.")), 12, 8); | ||||
| 
 | ||||
| $tabindex = 1; | ||||
| parseHtml(null, $container, array(), true, $tabindex, 'user'); | ||||
| 
 | ||||
| echo "</div>\n"; | ||||
| include '../main_footer.php'; | ||||
| include '../../lib/adminFooter.inc'; | ||||
| 
 | ||||
| ?>
 | ||||
|  |  | |||
|  | @ -1,23 +1,21 @@ | |||
| <?php | ||||
| namespace LAM\TOOLS\TESTS; | ||||
| use \LAM\REMOTE\Remote; | ||||
| use \htmlTable; | ||||
| use \htmlTitle; | ||||
| use \htmlOutputText; | ||||
| use \htmlSelect; | ||||
| use \htmlInputCheckbox; | ||||
| use \htmlSpacer; | ||||
| use \htmlResponsiveSelect; | ||||
| use \htmlResponsiveInputCheckbox; | ||||
| use \htmlButton; | ||||
| use \htmlStatusMessage; | ||||
| use \htmlImage; | ||||
| use \htmlSubTitle; | ||||
| use \Exception; | ||||
| use \htmlResponsiveRow; | ||||
| 
 | ||||
| /* | ||||
| $Id$ | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2006 - 2017  Roland Gruber | ||||
|   Copyright (C) 2006 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -59,12 +57,12 @@ checkIfToolIsActive('toolTests'); | |||
| 
 | ||||
| setlanguage(); | ||||
| 
 | ||||
| include '../main_header.php'; | ||||
| include '../../lib/adminHeader.inc'; | ||||
| echo "<div class=\"user-bright smallPaddingContent\">\n"; | ||||
| echo "<form action=\"lamdaemonTest.php\" method=\"post\">\n"; | ||||
| 
 | ||||
| $container = new htmlTable(); | ||||
| $container->addElement(new htmlTitle(_("Lamdaemon test")), true); | ||||
| $container = new htmlResponsiveRow(); | ||||
| $container->add(new htmlTitle(_("Lamdaemon test")), 12); | ||||
| 
 | ||||
| $servers = explode(";", $_SESSION['config']->get_scriptServers()); | ||||
| $serverIDs = array(); | ||||
|  | @ -84,7 +82,6 @@ if (isset($_POST['runTest'])) { | |||
| 	lamRunTestSuite($_POST['server'], $serverTitles[$_POST['server']] , isset($_POST['checkQuotas']), $container); | ||||
| } | ||||
| else if ((sizeof($servers) > 0) && isset($servers[0]) && ($servers[0] != '')) { | ||||
| 	$container->addElement(new htmlOutputText(_("Server"))); | ||||
| 	$serverOptions = array(); | ||||
| 	for ($i = 0; $i < sizeof($servers); $i++) { | ||||
| 		$servers[$i] = explode(":", $servers[$i]); | ||||
|  | @ -95,21 +92,21 @@ else if ((sizeof($servers) > 0) && isset($servers[0]) && ($servers[0] != '')) { | |||
| 		} | ||||
| 		$serverOptions[$title] = $serverName; | ||||
| 	} | ||||
| 	$serverSelect = new htmlSelect('server', $serverOptions); | ||||
| 	$serverSelect = new htmlResponsiveSelect('server', $serverOptions, array(), _("Server")); | ||||
| 	$serverSelect->setHasDescriptiveElements(true); | ||||
| 	$container->addElement($serverSelect, true); | ||||
| 	$container->add($serverSelect, 12); | ||||
| 
 | ||||
| 	$container->addElement(new htmlOutputText(_("Check quotas"))); | ||||
| 	$container->addElement(new htmlInputCheckbox('checkQuotas', false), true); | ||||
| 	$container->add(new htmlResponsiveInputCheckbox('checkQuotas', false, _("Check quotas")), 12); | ||||
| 
 | ||||
| 	$container->addElement(new htmlSpacer(null, '10px'), true); | ||||
| 	$container->addVerticalSpacer('1rem'); | ||||
| 
 | ||||
| 	$okButton = new htmlButton('runTest', _("Ok")); | ||||
| 	$okButton->colspan = 2; | ||||
| 	$container->addElement($okButton); | ||||
| 	$container->addLabel($okButton); | ||||
| 	$container->addField(new htmlOutputText(' ', false)); | ||||
| } | ||||
| else { | ||||
| 	$container->addElement(new htmlStatusMessage("ERROR", _('No lamdaemon server set, please update your LAM configuration settings.'))); | ||||
| 	$container->add(new htmlStatusMessage("ERROR", _('No lamdaemon server set, please update your LAM configuration settings.')), 12); | ||||
| } | ||||
| 
 | ||||
| $tabindex = 1; | ||||
|  | @ -117,7 +114,7 @@ parseHtml(null, $container, array(), false, $tabindex, 'user'); | |||
| 
 | ||||
| echo "</form>\n"; | ||||
| echo "</div>\n"; | ||||
| include '../main_footer.php'; | ||||
| include '../../lib/adminFooter.inc'; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  | @ -127,17 +124,15 @@ include '../main_footer.php'; | |||
|  * @param boolean $stopTest specifies if test should be run | ||||
|  * @param Remote $remote SSH connection | ||||
|  * @param string $testText describing text | ||||
|  * @param htmlTable $container container for HTML output | ||||
|  * @param htmlResponsiveRow $container container for HTML output | ||||
|  * @return boolean true, if errors occured | ||||
|  */ | ||||
| function testRemoteCommand($command, $stopTest, $remote, $testText, $container) { | ||||
| 	$okImage = "../../graphics/pass.png"; | ||||
| 	$failImage = "../../graphics/fail.png"; | ||||
| 	$spacer = new htmlSpacer('10px', null); | ||||
| 	// run remote command
 | ||||
| 	if (!$stopTest) { | ||||
| 		$container->addElement(new htmlOutputText($testText)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->add(new htmlOutputText($testText), 10, 4); | ||||
| 		flush(); | ||||
| 		$lamdaemonOk = false; | ||||
| 		$output = $remote->execute($command); | ||||
|  | @ -145,34 +140,32 @@ function testRemoteCommand($command, $stopTest, $remote, $testText, $container) | |||
| 			$lamdaemonOk = true; | ||||
| 		} | ||||
| 		if ($lamdaemonOk) { | ||||
| 			$container->addElement(new htmlImage($okImage)); | ||||
| 			$container->addElement($spacer); | ||||
| 			$container->addElement(new htmlOutputText(_("Lamdaemon successfully run.")), true); | ||||
| 			$container->add(new htmlImage($okImage), 2); | ||||
| 			$container->add(new htmlOutputText(_("Lamdaemon successfully run.")), 12, 6); | ||||
| 		} | ||||
| 		else { | ||||
| 			$container->addElement(new htmlImage($failImage)); | ||||
| 			$container->addElement($spacer); | ||||
| 			$container->add(new htmlImage($failImage), 2); | ||||
| 			if (!(strpos($output, 'ERROR,') === 0) && !(strpos($output, 'WARN,') === 0)) { | ||||
| 				// error messages from console (e.g. sudo)
 | ||||
| 				$container->addElement(new htmlStatusMessage('ERROR', $output), true); | ||||
| 				$container->add(new htmlStatusMessage('ERROR', $output), 12, 6); | ||||
| 			} | ||||
| 			else { | ||||
| 				// error messages from lamdaemon
 | ||||
| 				$parts = explode(",", $output); | ||||
| 				if (sizeof($parts) == 2) { | ||||
| 					$container->addElement(new htmlStatusMessage($parts[0], $parts[1]), true); | ||||
| 					$container->add(new htmlStatusMessage($parts[0], $parts[1]), 12, 6); | ||||
| 				} | ||||
| 				elseif (sizeof($parts) == 3) { | ||||
| 					$container->addElement(new htmlStatusMessage($parts[0], $parts[1], $parts[2]), true); | ||||
| 					$container->add(new htmlStatusMessage($parts[0], $parts[1], $parts[2]), 12, 6); | ||||
| 				} | ||||
| 				else { | ||||
| 					$container->addElement(new htmlOutputText($output), true); | ||||
| 					$container->add(new htmlOutputText($output), 12, 6); | ||||
| 				} | ||||
| 			} | ||||
| 			$stopTest = true; | ||||
| 		} | ||||
| 	} | ||||
| 	flush(); | ||||
| 	$container->addVerticalSpacer('0.5rem'); | ||||
| 	return $stopTest; | ||||
| } | ||||
| 
 | ||||
|  | @ -182,7 +175,7 @@ function testRemoteCommand($command, $stopTest, $remote, $testText, $container) | |||
|  * @param String $serverName server ID | ||||
|  * @param String $serverTitle server name | ||||
|  * @param boolean $testQuota true, if Quotas should be checked | ||||
|  * @param htmlTable $container container for HTML output | ||||
|  * @param htmlResponsiveRow $container container for HTML output | ||||
|  */ | ||||
| function lamRunTestSuite($serverName, $serverTitle, $testQuota, $container) { | ||||
| 	$SPLIT_DELIMITER = "###x##y##x###"; | ||||
|  | @ -190,47 +183,38 @@ function lamRunTestSuite($serverName, $serverTitle, $testQuota, $container) { | |||
| 	$okImage = "../../graphics/pass.png"; | ||||
| 	$failImage = "../../graphics/fail.png"; | ||||
| 
 | ||||
| 	flush(); | ||||
| 	$stopTest = false; | ||||
| 	$spacer = new htmlSpacer('10px', null); | ||||
| 
 | ||||
| 	$container->addElement(new htmlSubTitle($serverTitle), true); | ||||
| 	$container->add(new htmlSubTitle($serverTitle), 12); | ||||
| 
 | ||||
| 	// check script server and path
 | ||||
| 	$container->addElement(new htmlOutputText(_("Lamdaemon server and path"))); | ||||
| 	$container->addElement(new htmlSpacer('10px', null)); | ||||
| 	$container->add(new htmlOutputText(_("Lamdaemon server and path")), 10, 4); | ||||
| 	if (!isset($serverName) || (strlen($serverName) < 3)) { | ||||
| 		$container->addElement(new htmlImage($failImage)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(_("No lamdaemon server set, please update your LAM configuration settings.")), true); | ||||
| 		$container->add(new htmlImage($failImage), 2); | ||||
| 		$container->add(new htmlOutputText(_("No lamdaemon server set, please update your LAM configuration settings.")), 12, 6); | ||||
| 	} | ||||
| 	elseif (($_SESSION['config']->get_scriptPath() == null) || (strlen($_SESSION['config']->get_scriptPath()) < 10)) { | ||||
| 		$container->addElement(new htmlImage($failImage)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(_("No lamdaemon path set, please update your LAM configuration settings.")), true); | ||||
| 		$container->add(new htmlImage($failImage), 2); | ||||
| 		$container->add(new htmlOutputText(_("No lamdaemon path set, please update your LAM configuration settings.")), 12, 6); | ||||
| 		$stopTest = true; | ||||
| 	} | ||||
| 	elseif (substr($_SESSION['config']->get_scriptPath(), -3) != '.pl') { | ||||
| 		$container->addElement(new htmlImage($failImage)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(_("Lamdaemon path does not end with \".pl\". Did you enter the full path to the script?")), true); | ||||
| 		$container->add(new htmlImage($failImage), 2); | ||||
| 		$container->add(new htmlOutputText(_("Lamdaemon path does not end with \".pl\". Did you enter the full path to the script?")), 12, 6); | ||||
| 		$stopTest = true; | ||||
| 	} | ||||
| 	else { | ||||
| 		$container->addElement(new htmlImage($okImage)); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->addElement(new htmlOutputText(sprintf(_("Using %s as lamdaemon remote server."), $serverName)), true); | ||||
| 		$container->add(new htmlImage($okImage), 2); | ||||
| 		$container->add(new htmlOutputText(sprintf(_("Using %s as lamdaemon remote server."), $serverName)), 12, 6); | ||||
| 	} | ||||
| 
 | ||||
| 	flush(); | ||||
| 	$container->addVerticalSpacer('0.5rem'); | ||||
| 
 | ||||
| 	// check Unix account of LAM admin
 | ||||
| 	$credentials = $_SESSION['ldap']->decrypt_login(); | ||||
| 	if (!$stopTest) { | ||||
| 		$scriptUserName = $_SESSION['config']->getScriptUserName(); | ||||
| 		if (empty($scriptUserName)) { | ||||
| 			$container->addElement(new htmlOutputText(_("Unix account"))); | ||||
| 			$container->addElement($spacer); | ||||
| 			$container->add(new htmlOutputText(_("Unix account")), 10, 4); | ||||
| 			$unixOk = false; | ||||
| 			$sr = @ldap_read($_SESSION['ldap']->server(), $credentials[0], "objectClass=posixAccount", array('uid'), 0, 0, 0, LDAP_DEREF_NEVER); | ||||
| 			if ($sr) { | ||||
|  | @ -241,46 +225,39 @@ function lamRunTestSuite($serverName, $serverTitle, $testQuota, $container) { | |||
| 				} | ||||
| 			} | ||||
| 			if ($unixOk) { | ||||
| 				$container->addElement(new htmlImage($okImage)); | ||||
| 				$container->addElement($spacer); | ||||
| 				$container->addElement(new htmlOutputText(sprintf(_("Using %s to connect to remote server."), $userName)), true); | ||||
| 				$container->add(new htmlImage($okImage), 2); | ||||
| 				$container->add(new htmlOutputText(sprintf(_("Using %s to connect to remote server."), $userName)), 12, 6); | ||||
| 			} | ||||
| 			else { | ||||
| 				$container->addElement(new htmlImage($failImage)); | ||||
| 				$container->addElement($spacer); | ||||
| 				$container->addElement(new htmlOutputText(sprintf(_("Your LAM admin user (%s) must be a valid Unix account to work with lamdaemon!"), $credentials[0])), true); | ||||
| 				$container->add(new htmlImage($failImage), 2); | ||||
| 				$container->add(new htmlOutputText(sprintf(_("Your LAM admin user (%s) must be a valid Unix account to work with lamdaemon!"), $credentials[0])), 12, 6); | ||||
| 				$stopTest = true; | ||||
| 			} | ||||
| 			$container->addVerticalSpacer('0.5rem'); | ||||
| 		} | ||||
| 		else { | ||||
| 			$userName = $_SESSION['config']->getScriptUserName(); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	flush(); | ||||
| 
 | ||||
| 	// check SSH login
 | ||||
| 	$remote = new Remote(); | ||||
| 	if (!$stopTest) { | ||||
| 		$container->addElement(new htmlOutputText(_("SSH connection"))); | ||||
| 		$container->addElement($spacer); | ||||
| 		$container->add(new htmlOutputText(_("SSH connection")), 10, 4); | ||||
| 		flush(); | ||||
| 		$sshOk = false; | ||||
| 		try { | ||||
| 			$remote->connect($serverName); | ||||
| 			$container->addElement(new htmlImage($okImage)); | ||||
| 			$container->addElement($spacer); | ||||
| 			$container->addElement(new htmlOutputText(_("SSH connection established.")), true); | ||||
| 			$container->add(new htmlImage($okImage), 2); | ||||
| 			$container->add(new htmlOutputText(_("SSH connection established.")), 12, 6); | ||||
| 		} | ||||
| 		catch (Exception $e) { | ||||
| 			$container->addElement(new htmlImage($failImage)); | ||||
| 			$container->addElement($spacer); | ||||
| 			$container->addElement(new htmlOutputText($e->getMessage()), true); | ||||
| 			$container->add(new htmlImage($failImage), 2); | ||||
| 			$container->add(new htmlOutputText($e->getMessage()), 12, 6); | ||||
| 			$stopTest = true; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	flush(); | ||||
| 	$container->addVerticalSpacer('0.5rem'); | ||||
| 
 | ||||
| 	if (!$stopTest) { | ||||
| 		$stopTest = testRemoteCommand("+" . $SPLIT_DELIMITER . "test" . $SPLIT_DELIMITER . "basic", $stopTest, $remote, _("Execute lamdaemon"), $container); | ||||
|  | @ -299,10 +276,10 @@ function lamRunTestSuite($serverName, $serverTitle, $testQuota, $container) { | |||
| 	} | ||||
| 	$remote->disconnect(); | ||||
| 
 | ||||
| 	$container->addElement(new htmlSpacer(null, '10px'), true); | ||||
| 	$container->addVerticalSpacer('1rem'); | ||||
| 	$endMessage = new htmlOutputText(_("Lamdaemon test finished.")); | ||||
| 	$endMessage->colspan = 5; | ||||
| 	$container->addElement($endMessage); | ||||
| 	$container->add($endMessage, 12); | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
|  |  | |||
|  | @ -1,9 +1,15 @@ | |||
| <?php | ||||
| namespace LAM\TOOLS\TESTS; | ||||
| use \htmlResponsiveRow; | ||||
| use \htmlTitle; | ||||
| use \htmlStatusMessage; | ||||
| use \htmlSubTitle; | ||||
| use \htmlOutputText; | ||||
| use \htmlImage; | ||||
| /* | ||||
| $Id$ | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2007 - 2017  Roland Gruber | ||||
|   Copyright (C) 2007 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -48,18 +54,18 @@ checkIfToolIsActive('toolTests'); | |||
| 
 | ||||
| setlanguage(); | ||||
| 
 | ||||
| include '../main_header.php'; | ||||
| include '../../lib/adminHeader.inc'; | ||||
| echo "<div class=\"user-bright smallPaddingContent\">\n"; | ||||
| 
 | ||||
| $container = new htmlTable(); | ||||
| $container = new htmlResponsiveRow(); | ||||
| 
 | ||||
| $container->addElement(new htmlTitle(_("Schema test")), true); | ||||
| $container->add(new htmlTitle(_("Schema test")), 12); | ||||
| 
 | ||||
| get_schema_objectclasses(); | ||||
| $classes = get_cached_schema('objectclasses'); | ||||
| 
 | ||||
| if (!is_array($classes)) { | ||||
| 	$container->addElement(new htmlStatusMessage('ERROR', _('Unable to retrieve schema!'), _('You do not have the required access rights or the LDAP schema is not published by your server.'))); | ||||
| 	$container->add(new htmlStatusMessage('ERROR', _('Unable to retrieve schema!'), _('You do not have the required access rights or the LDAP schema is not published by your server.')), 12); | ||||
| } | ||||
| else { | ||||
| 	// loop for active account types
 | ||||
|  | @ -67,7 +73,7 @@ else { | |||
| 	$types = $typeManager->getConfiguredTypes(); | ||||
| 	foreach ($types as $type) { | ||||
| 		$modules = $_SESSION['config']->get_AccountModules($type->getId()); | ||||
| 		$container->addElement(new htmlSubTitle($type->getAlias()), true); | ||||
| 		$container->add(new htmlSubTitle($type->getAlias()), 12); | ||||
| 		for ($m = 0; $m < sizeof($modules); $m++) { | ||||
| 			$error = checkSchemaForModule($modules[$m], $type->getScope(), $type->getId()); | ||||
| 			$message = _("No problems found."); | ||||
|  | @ -77,13 +83,12 @@ else { | |||
| 				$message = $error; | ||||
| 			} | ||||
| 			// module name
 | ||||
| 			$container->addElement(new htmlOutputText(getModuleAlias($modules[$m], $type->getScope()))); | ||||
| 			$container->addElement(new htmlSpacer('10px', null)); | ||||
| 			$container->add(new htmlOutputText(getModuleAlias($modules[$m], $type->getScope())), 10, 3); | ||||
| 			// icon
 | ||||
| 			$container->addElement(new htmlImage($icon)); | ||||
| 			$container->addElement(new htmlSpacer('10px', null)); | ||||
| 			$container->add(new htmlImage($icon), 2); | ||||
| 			// text
 | ||||
| 			$container->addElement(new htmlOutputText($message), true); | ||||
| 			$container->add(new htmlOutputText($message), 12, 7); | ||||
| 			$container->addVerticalSpacer('0.5rem'); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | @ -92,7 +97,7 @@ $tabindex = 1; | |||
| parseHtml(null, $container, array(), true, $tabindex, 'user'); | ||||
| 
 | ||||
| echo "</div>\n"; | ||||
| include '../main_footer.php'; | ||||
| include '../../lib/adminFooter.inc'; | ||||
| 
 | ||||
| /** | ||||
|  * Checks if the object classes and attributes for this module are available. | ||||
|  |  | |||
|  | @ -1,9 +1,14 @@ | |||
| <?php | ||||
| namespace LAM\TOOLS\TESTS; | ||||
| use \htmlResponsiveRow; | ||||
| use \htmlTitle; | ||||
| use \htmlOutputText; | ||||
| use \htmlLink; | ||||
| /* | ||||
| $Id$ | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2003 - 2017  Roland Gruber | ||||
|   Copyright (C) 2003 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -41,15 +46,15 @@ enforceUserIsLoggedIn(); | |||
| 
 | ||||
| setlanguage(); | ||||
| 
 | ||||
| include 'main_header.php'; | ||||
| include '../lib/adminHeader.inc'; | ||||
| 
 | ||||
| // get tool list
 | ||||
| $availableTools = getTools(); | ||||
| // sort tools
 | ||||
| $toSort = array(); | ||||
| for ($i = 0; $i < sizeof($availableTools); $i++) { | ||||
| 	$myTool = new $availableTools[$i](); | ||||
| 	$toSort[$availableTools[$i]] = $myTool->getPosition(); | ||||
| foreach ($availableTools as $availableTool) { | ||||
| 	$myTool = new $availableTool(); | ||||
| 	$toSort[$availableTool] = $myTool->getPosition(); | ||||
| } | ||||
| asort($toSort); | ||||
| $tools = array(); | ||||
|  | @ -60,33 +65,32 @@ foreach ($toSort as $key => $value) { | |||
| echo "<div class=\"user-bright smallPaddingContent\">\n"; | ||||
| 
 | ||||
| // print tools table
 | ||||
| $container = new htmlTable(); | ||||
| $container->addElement(new htmlTitle(_('Tools')), true); | ||||
| $container = new htmlResponsiveRow(); | ||||
| $container->add(new htmlTitle(_('Tools')), 12); | ||||
| $toolSettings = $_SESSION['config']->getToolSettings(); | ||||
| 
 | ||||
| for ($i = 0; $i < sizeof($tools); $i++) { | ||||
| foreach ($tools as $tool) { | ||||
| 	// check access level
 | ||||
| 	if ($tools[$i]->getRequiresWriteAccess() && !checkIfWriteAccessIsAllowed()) { | ||||
| 	if ($tool->getRequiresWriteAccess() && !checkIfWriteAccessIsAllowed()) { | ||||
| 		continue; | ||||
| 	} | ||||
| 	if ($tools[$i]->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) { | ||||
| 	if ($tool->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) { | ||||
| 		continue; | ||||
| 	} | ||||
| 	// check visibility
 | ||||
| 	if (!$tools[$i]->isVisible()) { | ||||
| 	if (!$tool->isVisible()) { | ||||
| 		continue; | ||||
| 	} | ||||
| 	// check if hidden by config
 | ||||
| 	$className = get_class($tools[$i]); | ||||
| 	$className = get_class($tool); | ||||
| 	$toolName = substr($className, strrpos($className, '\\') + 1); | ||||
| 	if (isset($toolSettings['tool_hide_' . $toolName]) && ($toolSettings['tool_hide_' . $toolName] == 'true')) { | ||||
| 		continue; | ||||
| 	} | ||||
| 	// add tool
 | ||||
| 	$container->addElement(new htmlLink($tools[$i]->getName(), $tools[$i]->getLink(), '../graphics/' . $tools[$i]->getImageLink())); | ||||
| 	$container->addElement(new htmlSpacer('10px', null)); | ||||
| 	$container->addElement(new htmlOutputText($tools[$i]->getDescription()), true); | ||||
| 	$container->addElement(new htmlSpacer(null, '20px'), true); | ||||
| 	$container->add(new htmlLink($tool->getName(), $tool->getLink(), '../graphics/' . $tool->getImageLink()), 12, 4); | ||||
| 	$container->add(new htmlOutputText($tool->getDescription()), 12, 8); | ||||
| 	$container->addVerticalSpacer('2rem'); | ||||
| } | ||||
| 
 | ||||
| $tabindex = 1; | ||||
|  | @ -94,6 +98,6 @@ parseHtml(null, $container, array(), true, $tabindex, 'user'); | |||
| 
 | ||||
| echo "</div>"; | ||||
| 
 | ||||
| include 'main_footer.php'; | ||||
| include '../lib/adminFooter.inc'; | ||||
| 
 | ||||
| ?>
 | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ use \htmlHiddenInput; | |||
| $Id$ | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2004 - 2017  Roland Gruber | ||||
|   Copyright (C) 2004 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -75,21 +75,21 @@ if (isset($_GET['showldif'])) { | |||
| 	header('Content-Type: text/plain'); | ||||
| 	header('Content-disposition: attachment; filename=lam.ldif'); | ||||
| 	$accounts = unserialize(lamDecrypt($_SESSION['mass_accounts'])); | ||||
| 	for ($i = 0; $i < sizeof($accounts); $i++) { | ||||
| 		echo "DN: " . $accounts[$i]['dn'] . "\n"; | ||||
| 		unset($accounts[$i]['dn']); | ||||
| 		$keys = array_keys($accounts[$i]); | ||||
| 		for ($k = 0; $k < sizeof($keys); $k++) { | ||||
| 			if (strpos($keys[$k], 'INFO.') === 0) { | ||||
| 	foreach ($accounts as $account) { | ||||
| 		echo "DN: " . $account['dn'] . "\n"; | ||||
| 		unset($account['dn']); | ||||
| 		$keys = array_keys($account); | ||||
| 		foreach ($keys as $key) { | ||||
| 			if (strpos($key, 'INFO.') === 0) { | ||||
| 				continue; | ||||
| 			} | ||||
| 			if (is_array($accounts[$i][$keys[$k]])) { | ||||
| 				for ($x = 0; $x < sizeof($accounts[$i][$keys[$k]]); $x++) { | ||||
| 					echo $keys[$k] . ": " . $accounts[$i][$keys[$k]][$x] . "\n"; | ||||
| 			if (is_array($account[$key])) { | ||||
| 				foreach ($account[$key] as $value) { | ||||
| 					echo $key . ": " . $value . "\n"; | ||||
| 				} | ||||
| 			} | ||||
| 			else { | ||||
| 				echo $keys[$k] . ": " . $accounts[$i][$keys[$k]] . "\n"; | ||||
| 				echo $key . ": " . $account[$key] . "\n"; | ||||
| 			} | ||||
| 		} | ||||
| 		echo "\n"; | ||||
|  | @ -126,8 +126,8 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) { | |||
| 	// read input file
 | ||||
| 	$handle = fopen ($_FILES['inputfile']['tmp_name'], "r"); | ||||
| 	if (($head = fgetcsv($handle, 2000)) !== false ) { // head row
 | ||||
| 		for ($i = 0; $i < sizeof($head); $i++) { | ||||
| 			$ids[$head[$i]] = $i; | ||||
| 		foreach ($head as $i => $headItem) { | ||||
| 			$ids[$headItem] = $i; | ||||
| 		} | ||||
| 	} | ||||
| 	while (($line = fgetcsv($handle, 2000)) !== false ) { // account rows
 | ||||
|  | @ -139,10 +139,10 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) { | |||
| 	// check if all required columns are present
 | ||||
| 	$checkcolumns = array(); | ||||
| 	$columns = call_user_func_array('array_merge', $columns); | ||||
| 	for ($i = 0; $i < sizeof($columns); $i++) { | ||||
| 		if (isset($columns[$i]['required']) && ($columns[$i]['required'] === true)) { | ||||
| 			if (isset($ids[$columns[$i]['name']])) $checkcolumns[] = $ids[$columns[$i]['name']]; | ||||
| 			else $errors[] = array(_("A required column is missing in your CSV file."), $columns[$i]['name']); | ||||
| 	foreach ($columns as $column) { | ||||
| 		if (isset($column['required']) && ($column['required'] === true)) { | ||||
| 			if (isset($ids[$column['name']])) $checkcolumns[] = $ids[$column['name']]; | ||||
| 			else $errors[] = array(_("A required column is missing in your CSV file."), $column['name']); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
|  | @ -163,14 +163,14 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) { | |||
| 			break; | ||||
| 		} | ||||
| 	} | ||||
| 	for ($i = 0; $i < sizeof($invalidColumns); $i++) { | ||||
| 		$errors[] = array(_("One or more values of the required column \"$invalidColumns[$i]\" are missing."), ""); | ||||
| 	foreach ($invalidColumns as $invalidColumn) { | ||||
| 		$errors[] = array(_("One or more values of the required column \"$invalidColumn\" are missing."), "");
 | ||||
| 	} | ||||
| 
 | ||||
| 	// check if values in unique columns are correct
 | ||||
| 	for ($i = 0; $i < sizeof($columns); $i++) { | ||||
| 		if (isset($columns[$i]['unique']) && ($columns[$i]['unique'] === true) && isset($ids[$columns[$i]['name']])) { | ||||
| 			$colNumber = $ids[$columns[$i]['name']]; | ||||
| 	foreach ($columns as $column) { | ||||
| 		if (isset($column['unique']) && ($column['unique'] === true) && isset($ids[$column['name']])) { | ||||
| 			$colNumber = $ids[$column['name']]; | ||||
| 			$values_given = array(); | ||||
| 			foreach ($data as $dataRow) { | ||||
| 				$values_given[] = $dataRow[$colNumber]; | ||||
|  | @ -184,15 +184,15 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) { | |||
| 					} | ||||
| 				} | ||||
| 				$duplicates = array_values(array_unique($duplicates)); | ||||
| 				$errors[] = array(_("This column is defined to include unique entries but duplicates were found:") . ' ' . $columns[$i]['name'], implode(', ', $duplicates)); | ||||
| 				$errors[] = array(_("This column is defined to include unique entries but duplicates were found:") . ' ' . $column['name'], implode(', ', $duplicates)); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	// if input data is invalid just display error messages (max 50)
 | ||||
| 	if (sizeof($errors) > 0) { | ||||
| 		for ($i = 0; $i < sizeof($errors); $i++) { | ||||
| 			$container->addElement(new htmlStatusMessage("ERROR", $errors[$i][0], $errors[$i][1]), true); | ||||
| 		foreach ($errors as $error) { | ||||
| 			$container->addElement(new htmlStatusMessage("ERROR", $error[0], $error[1]), true); | ||||
| 		} | ||||
| 		$container->addElement(new htmlSpacer(null, '10px'), true); | ||||
| 		massPrintBackButton($type->getId(), $selectedModules, $container); | ||||
|  | @ -219,8 +219,8 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) { | |||
| 			} | ||||
| 			// print errors if DN could not be built
 | ||||
| 			if (sizeof($errors) > 0) { | ||||
| 				for ($i = 0; $i < sizeof($errors); $i++) { | ||||
| 					$container->addElement(new htmlStatusMessage("ERROR", $errors[$i][0], $errors[$i][1], $errors[$i][2]), true); | ||||
| 				foreach ($errors as $error) { | ||||
| 					$container->addElement(new htmlStatusMessage("ERROR", $error[0], $error[1], $error[2]), true); | ||||
| 				} | ||||
| 			} | ||||
| 			else { | ||||
|  | @ -294,8 +294,8 @@ function massPrintBackButton($typeId, $selectedModules, htmlTable &$container) { | |||
| 	} | ||||
| 	$container->addElement(new htmlHiddenInput('createPDF', $createPDF)); | ||||
| 	$container->addElement(new htmlHiddenInput('pdfStructure', $_POST['pdfStructure'])); | ||||
| 	for ($i = 0; $i < sizeof($selectedModules); $i++) { | ||||
| 		$container->addElement(new htmlHiddenInput($typeId . '___' . $selectedModules[$i], 'on')); | ||||
| 	foreach ($selectedModules as $selectedModule) { | ||||
| 		$container->addElement(new htmlHiddenInput($typeId . '___' . $selectedModule, 'on')); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -22,7 +22,7 @@ use \moduleCache; | |||
| $Id$ | ||||
| 
 | ||||
|   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|   Copyright (C) 2004 - 2017  Roland Gruber | ||||
|   Copyright (C) 2004 - 2018  Roland Gruber | ||||
| 
 | ||||
|   This program is free software; you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|  | @ -119,18 +119,18 @@ if (isset($_POST['type'])) { | |||
| 	// get selected modules
 | ||||
| 	$selectedModules = array(); | ||||
| 	$checkedBoxes = array_keys($_POST, 'on'); | ||||
| 	for ($i = 0; $i < sizeof($checkedBoxes); $i++) { | ||||
| 		if (strpos($checkedBoxes[$i], $typeId . '___') === 0) { | ||||
| 			$selectedModules[] = substr($checkedBoxes[$i], strlen($typeId) + strlen('___')); | ||||
| 	foreach ($checkedBoxes as $checkedBox) { | ||||
| 		if (strpos($checkedBox, $typeId . '___') === 0) { | ||||
| 			$selectedModules[] = substr($checkedBox, strlen($typeId) + strlen('___')); | ||||
| 		} | ||||
| 	} | ||||
| 	$deps = getModulesDependencies($type->getScope()); | ||||
| 	$depErrors = check_module_depends($selectedModules, $deps); | ||||
| 	if (is_array($depErrors) && (sizeof($depErrors) > 0)) { | ||||
| 		for ($i = 0; $i < sizeof($depErrors); $i++) { | ||||
| 		foreach ($depErrors as $depError) { | ||||
| 			StatusMessage('ERROR', _("Unsolved dependency:") . ' ' . | ||||
| 							getModuleAlias($depErrors[$i][0], $type->getScope()) . " (" . | ||||
| 							getModuleAlias($depErrors[$i][1], $type->getScope()) . ")"); | ||||
| 							getModuleAlias($depError[0], $type->getScope()) . " (" . | ||||
| 							getModuleAlias($depError[1], $type->getScope()) . ")"); | ||||
| 		} | ||||
| 	} | ||||
| 	else { | ||||
|  | @ -191,25 +191,25 @@ foreach ($types as $type) { | |||
| 	} | ||||
| 	$innerTable = new htmlTable(); | ||||
| 	$modules = $_SESSION['config']->get_AccountModules($type->getId()); | ||||
| 	for ($m = 0; $m < sizeof($modules); $m++) { | ||||
| 	foreach ($modules as $m => $moduleName) { | ||||
| 		if (($m != 0) && ($m%3 == 0)) { | ||||
| 			echo $innerTable->addNewLine(); | ||||
| 		} | ||||
| 		$module = moduleCache::getModule($modules[$m], $type->getScope()); | ||||
| 		$module = moduleCache::getModule($moduleName, $type->getScope()); | ||||
| 		$iconImage = $module->getIcon(); | ||||
| 		if (!is_null($iconImage) && !(strpos($iconImage, 'http') === 0) && !(strpos($iconImage, '/') === 0)) { | ||||
| 			$iconImage = '../../graphics/' . $iconImage; | ||||
| 		} | ||||
| 		$innerTable->addElement(new htmlImage($iconImage)); | ||||
| 		$enabled = true; | ||||
| 		if (is_base_module($modules[$m], $type->getScope())) { | ||||
| 		if (is_base_module($moduleName, $type->getScope())) { | ||||
| 			$enabled = false; | ||||
| 		} | ||||
| 		$checked = true; | ||||
| 		if (isset($_POST['submit']) && !isset($_POST[$type->getId() . '___' . $modules[$m]])) { | ||||
| 		if (isset($_POST['submit']) && !isset($_POST[$type->getId() . '___' . $moduleName])) { | ||||
| 			$checked = false; | ||||
| 		} | ||||
| 		$checkbox = new htmlTableExtendedInputCheckbox($type->getId() . '___' . $modules[$m], $checked, getModuleAlias($modules[$m], $type->getScope()), null, false); | ||||
| 		$checkbox = new htmlTableExtendedInputCheckbox($type->getId() . '___' . $moduleName, $checked, getModuleAlias($moduleName, $type->getScope()), null, false); | ||||
| 		$checkbox->setIsEnabled($enabled); | ||||
| 		if ($enabled) { | ||||
| 			$innerTable->addElement($checkbox); | ||||
|  | @ -218,7 +218,7 @@ foreach ($types as $type) { | |||
| 			$boxGroup = new htmlGroup(); | ||||
| 			$boxGroup->addElement($checkbox); | ||||
| 			// add hidden field to fake disabled checkbox value
 | ||||
| 			$boxGroup->addElement(new htmlHiddenInput($type->getId() . '___' . $modules[$m], 'on')); | ||||
| 			$boxGroup->addElement(new htmlHiddenInput($type->getId() . '___' . $moduleName, 'on')); | ||||
| 			$innerTable->addElement($boxGroup); | ||||
| 		} | ||||
| 		$innerTable->addElement(new htmlSpacer('10px', null)); | ||||
|  | @ -380,18 +380,18 @@ function showMainPage(\LAM\TYPES\ConfiguredType $type, $selectedModules) { | |||
| 	$dnRDNRow->setCSSClasses(array($scope . '-bright')); | ||||
| 	$columnContainer->addElement($dnRDNRow); | ||||
| 	// module options
 | ||||
| 	for ($m = 0; $m < sizeof($modules); $m++) { | ||||
| 	foreach ($modules as $moduleName) { | ||||
| 		// skip modules without upload columns
 | ||||
| 		if (sizeof($columns[$modules[$m]]) < 1) { | ||||
| 		if (sizeof($columns[$moduleName]) < 1) { | ||||
| 			continue; | ||||
| 		} | ||||
| 		$columnContainer->addElement(new htmlSpacer(null, '10px'), true); | ||||
| 		$module = moduleCache::getModule($modules[$m], $scope); | ||||
| 		$module = moduleCache::getModule($moduleName, $scope); | ||||
| 		$icon = $module->getIcon(); | ||||
| 		if (!empty($icon) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) { | ||||
| 			$icon = '../../graphics/' . $icon; | ||||
| 		} | ||||
| 		$moduleTitle = new htmlSubTitle(getModuleAlias($modules[$m], $scope), $icon); | ||||
| 		$moduleTitle = new htmlSubTitle(getModuleAlias($moduleName, $scope), $icon); | ||||
| 		$moduleTitle->colspan = 20; | ||||
| 		$columnContainer->addElement($moduleTitle, true); | ||||
| 		$columnContainer->addElement(new htmlOutputText('')); | ||||
|  | @ -417,37 +417,37 @@ function showMainPage(\LAM\TYPES\ConfiguredType $type, $selectedModules) { | |||
| 		$possibleOut->alignment = htmlElement::ALIGN_LEFT; | ||||
| 		$columnContainer->addElement($possibleOut, false, true); | ||||
| 		$odd = true; | ||||
| 		for ($i = 0; $i < sizeof($columns[$modules[$m]]); $i++) { | ||||
| 		foreach ($columns[$moduleName] as $column) { | ||||
| 			$required = false; | ||||
| 			if (isset($columns[$modules[$m]][$i]['required']) && ($columns[$modules[$m]][$i]['required'] === true)) { | ||||
| 			if (isset($column['required']) && ($column['required'] === true)) { | ||||
| 				$required = true; | ||||
| 			} | ||||
| 			$rowCells = array(); | ||||
| 			$rowCells[] = $columnSpacer; | ||||
| 			$rowCells[] = new htmlHelpLink($columns[$modules[$m]][$i]['help'], $modules[$m], $scope); | ||||
| 			$rowCells[] = new htmlHelpLink($column['help'], $moduleName, $scope); | ||||
| 			$rowCells[] = $columnSpacer; | ||||
| 			$descriptionText = new htmlOutputText($columns[$modules[$m]][$i]['description']); | ||||
| 			$descriptionText = new htmlOutputText($column['description']); | ||||
| 			$descriptionText->setMarkAsRequired($required); | ||||
| 			$descriptionText->setNoWrap(true); | ||||
| 			$rowCells[] = $descriptionText; | ||||
| 			$rowCells[] = $columnSpacer; | ||||
| 			$rowCells[] = new htmlOutputText($columns[$modules[$m]][$i]['name']); | ||||
| 			$rowCells[] = new htmlOutputText($column['name']); | ||||
| 			$rowCells[] = $columnSpacer; | ||||
| 			$example = ''; | ||||
| 			if (isset($columns[$modules[$m]][$i]['example'])) { | ||||
| 				$example = $columns[$modules[$m]][$i]['example']; | ||||
| 			if (isset($column['example'])) { | ||||
| 				$example = $column['example']; | ||||
| 			} | ||||
| 			$rowCells[] = new htmlOutputText($example); | ||||
| 			$rowCells[] = $columnSpacer; | ||||
| 			if (isset($columns[$modules[$m]][$i]['default'])) { | ||||
| 				$rowCells[] = new htmlOutputText($columns[$modules[$m]][$i]['default']); | ||||
| 			if (isset($column['default'])) { | ||||
| 				$rowCells[] = new htmlOutputText($column['default']); | ||||
| 			} | ||||
| 			else { | ||||
| 				$rowCells[] = new htmlOutputText(''); | ||||
| 			} | ||||
| 			$rowCells[] = $columnSpacer; | ||||
| 			if (isset($columns[$modules[$m]][$i]['values'])) { | ||||
| 				$rowCells[] = new htmlOutputText($columns[$modules[$m]][$i]['values']); | ||||
| 			if (isset($column['values'])) { | ||||
| 				$rowCells[] = new htmlOutputText($column['values']); | ||||
| 			} | ||||
| 			else { | ||||
| 				$rowCells[] = new htmlOutputText(''); | ||||
|  | @ -479,10 +479,12 @@ function showMainPage(\LAM\TYPES\ConfiguredType $type, $selectedModules) { | |||
| 		$sampleCSV_head[] = "\"dn_suffix\""; | ||||
| 		$sampleCSV_head[] = "\"dn_rdn\""; | ||||
| 		// module attributes
 | ||||
| 		for ($m = 0; $m < sizeof($modules); $m++) { | ||||
| 			if (sizeof($columns[$modules[$m]]) < 1) continue; | ||||
| 			for ($i = 0; $i < sizeof($columns[$modules[$m]]); $i++) { | ||||
| 				$sampleCSV_head[] = "\"" . $columns[$modules[$m]][$i]['name'] . "\""; | ||||
| 		foreach ($modules as $moduleName) { | ||||
| 			if (sizeof($columns[$moduleName]) < 1) { | ||||
| 				continue; | ||||
| 			} | ||||
| 			foreach ($columns[$moduleName] as $column) { | ||||
| 				$sampleCSV_head[] = "\"" . $column['name'] . "\""; | ||||
| 			} | ||||
| 		} | ||||
| 		$RDNs = getRDNAttributes($type->getId(), $selectedModules); | ||||
|  | @ -490,11 +492,13 @@ function showMainPage(\LAM\TYPES\ConfiguredType $type, $selectedModules) { | |||
| 		$sampleCSV_row[] = "\"" . $type->getSuffix() . "\""; | ||||
| 		$sampleCSV_row[] = "\"" . $RDNs[0] . "\""; | ||||
| 		// module attributes
 | ||||
| 		for ($m = 0; $m < sizeof($modules); $m++) { | ||||
| 			if (sizeof($columns[$modules[$m]]) < 1) continue; | ||||
| 			for ($i = 0; $i < sizeof($columns[$modules[$m]]); $i++) { | ||||
| 				if (isset($columns[$modules[$m]][$i]['example'])) { | ||||
| 					$sampleCSV_row[] = '"' . $columns[$modules[$m]][$i]['example'] . '"'; | ||||
| 		foreach ($modules as $moduleName) { | ||||
| 			if (sizeof($columns[$moduleName]) < 1) { | ||||
| 				continue; | ||||
| 			} | ||||
| 			foreach ($columns[$moduleName] as $column) { | ||||
| 				if (isset($column['example'])) { | ||||
| 					$sampleCSV_row[] = '"' . $column['example'] . '"'; | ||||
| 				} | ||||
| 				else { | ||||
| 					$sampleCSV_row[] = '""'; | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
|  $Id$ | ||||
| 
 | ||||
|  This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | ||||
|  Copyright (C) 2016  Roland Gruber | ||||
|  Copyright (C) 2016 - 2017  Roland Gruber | ||||
| 
 | ||||
|  This program is free software; you can redistribute it and/or modify | ||||
|  it under the terms of the GNU General Public License as published by | ||||
|  | @ -154,6 +154,19 @@ class LAMConfigTest extends PHPUnit_Framework_TestCase { | |||
| 		$this->assertEquals($val, $this->lAMConfig->getPagedResults()); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Tests LAMConfig->getReferentialIntegrityOverlay() and LAMConfig->setReferentialIntegrityOverlay() | ||||
| 	 */ | ||||
| 	public function testReferentialIntegrityOverlay() { | ||||
| 		$val = 'true'; | ||||
| 		$this->lAMConfig->setReferentialIntegrityOverlay($val); | ||||
| 		$this->assertEquals($val, $this->lAMConfig->getReferentialIntegrityOverlay()); | ||||
| 		$this->assertTrue($this->lAMConfig->isReferentialIntegrityOverlayActive()); | ||||
| 		$this->doSave(); | ||||
| 		$this->assertEquals($val, $this->lAMConfig->getReferentialIntegrityOverlay()); | ||||
| 		$this->assertTrue($this->lAMConfig->isReferentialIntegrityOverlayActive()); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Tests LAMConfig->get_Admins() | ||||
| 	 */ | ||||
|  |  | |||