| 
									
										
										
										
											2003-06-13 14:38:42 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /* | 
					
						
							|  |  |  | $Id$ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-27 18:47:12 +00:00
										 |  |  |   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | 
					
						
							| 
									
										
										
										
											2010-01-01 17:21:46 +00:00
										 |  |  |   Copyright (C) 2003 - 2010  Roland Gruber | 
					
						
							| 
									
										
										
										
											2003-06-13 14:38:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   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 detaexils. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   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 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-05-31 18:03:40 +00:00
										 |  |  | */ | 
					
						
							| 
									
										
										
										
											2003-06-13 14:38:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-05-31 18:03:40 +00:00
										 |  |  | /** | 
					
						
							|  |  |  | * This page will redirect to account/edit.php if the given user is valid. | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * It is called from listgroups.php via the memberUID links. | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * @package lists | 
					
						
							|  |  |  | * @author Roland Gruber | 
					
						
							| 
									
										
										
										
											2003-06-13 14:38:42 +00:00
										 |  |  | */ | 
					
						
							| 
									
										
										
										
											2004-05-31 18:03:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-03-26 17:51:25 +00:00
										 |  |  | /** security functions */ | 
					
						
							|  |  |  | include_once("../../lib/security.inc"); | 
					
						
							| 
									
										
										
										
											2004-05-31 18:03:40 +00:00
										 |  |  | /** Needed to find DNs of users */ | 
					
						
							| 
									
										
										
										
											2006-03-26 17:51:25 +00:00
										 |  |  | include_once("../../lib/ldap.inc"); | 
					
						
							| 
									
										
										
										
											2004-05-31 18:03:40 +00:00
										 |  |  | /** Used to display error messages */ | 
					
						
							| 
									
										
										
										
											2006-03-26 17:51:25 +00:00
										 |  |  | include_once("../../lib/status.inc"); | 
					
						
							| 
									
										
										
										
											2003-06-13 14:38:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | // start session
 | 
					
						
							| 
									
										
										
										
											2006-03-26 17:51:25 +00:00
										 |  |  | startSecureSession(); | 
					
						
							| 
									
										
										
										
											2003-06-13 14:38:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | setlanguage(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // get user name
 | 
					
						
							|  |  |  | $user = $_GET['user']; | 
					
						
							| 
									
										
										
										
											2004-02-16 19:50:22 +00:00
										 |  |  | $user = str_replace("\\", '',$user); | 
					
						
							|  |  |  | $user = str_replace("'", '',$user); | 
					
						
							| 
									
										
										
										
											2003-06-13 14:38:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | // get DN of user
 | 
					
						
							| 
									
										
										
										
											2004-09-19 08:30:16 +00:00
										 |  |  | $dn = search_username($user); | 
					
						
							| 
									
										
										
										
											2003-06-13 14:38:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | if ($dn) { | 
					
						
							| 
									
										
										
										
											2004-02-10 20:08:47 +00:00
										 |  |  | 	// redirect to account/edit.php
 | 
					
						
							| 
									
										
										
										
											2010-01-13 18:45:29 +00:00
										 |  |  | 	metaRefresh("../account/edit.php?type=user&DN='" . rawurlencode($dn) . "'"); | 
					
						
							| 
									
										
										
										
											2003-06-13 14:38:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | else { | 
					
						
							|  |  |  | 	// print error message if user was not found
 | 
					
						
							| 
									
										
										
										
											2010-01-01 17:21:46 +00:00
										 |  |  | 	include '../main_header.php'; | 
					
						
							| 
									
										
										
										
											2003-07-27 14:20:39 +00:00
										 |  |  | 	StatusMessage("ERROR", "", _("This user was not found!") . " (" . $user . ")"); | 
					
						
							| 
									
										
										
										
											2003-07-27 14:26:10 +00:00
										 |  |  | 	echo "<p> </p>"; | 
					
						
							| 
									
										
										
										
											2006-01-01 16:30:05 +00:00
										 |  |  | 	echo "<p><a href=\"list.php?type=group\">" . _("Back to group list") . "</a></p>"; | 
					
						
							| 
									
										
										
										
											2003-06-13 14:38:42 +00:00
										 |  |  | 	echo ("</body></html>\n"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-19 08:30:16 +00:00
										 |  |  | /** | 
					
						
							|  |  |  | * Searches LDAP for a specific user name (uid attribute) and returns its DN entry | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * @param string $name user name | 
					
						
							|  |  |  | * @return string DN | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | function search_username($name) { | 
					
						
							| 
									
										
										
										
											2010-02-06 11:52:48 +00:00
										 |  |  | 	$entries = searchLDAPByAttribute('uid', $name, null, array('dn'), array('user')); | 
					
						
							|  |  |  | 	if (sizeof($entries) > 0 ) { | 
					
						
							|  |  |  | 		return $entries[0]['dn']; | 
					
						
							| 
									
										
										
										
											2004-09-19 08:30:16 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	else return ""; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-06-13 14:38:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-19 08:30:16 +00:00
										 |  |  | ?>
 |