* Set personal information attributes in lib/sql/user_info.php3 to default values.
* Add a page to change the user's personal information. Changed the user toolbar and added htdocs/user_info.php3
along with lib/{sql,ldap}/change_info.php3
* Print a message if we can't connect to the ldap server in lib/ldap/user_info.php3
* Updated TODO
* Added a help page for the Session Timeout and Idle Timeout attributes.
* The new group page should only be available if the general library type is sql.
+* Fix a small bug in lib/sql/create_user.php3 where work and home phone were stored in the wrong fields.
+* Set personal information attributes in lib/sql/user_info.php3 to default values.
+* Add a page to change the user's personal information. Changed the user toolbar and added htdocs/user_info.php3
+ along with lib/{sql,ldap}/change_info.php3
+* Print a message if we can't connect to the ldap server in lib/ldap/user_info.php3
Ver 1.30:
* Add limit of results returned in accounting.php3
* Fix a bug in time2strclock() in lib/functions.php3. Seconds ammount more than 9 would not show.
--- /dev/null
+<?php
+require('../conf/config.php3');
+?>
+
+<html>
+<head>
+<title>Personal information page</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="images/title2.gif"></td>
+</tr>
+</table>
+
+<table border=0 width=400 cellpadding=0 cellspacing=2>
+<?php
+include("../html/user_toolbar.html.php3");
+?>
+</table>
+
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Personal information for <?php echo "$login ($cn)"?></font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+
+<?php
+if ($change == 1){
+ if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
+ include("../lib/$config[general_lib_type]/user_info.php3");
+ if (is_file("../lib/$config[general_lib_type]/change_info.php3"))
+ include("../lib/$config[general_lib_type]/change_info.php3");
+}
+
+if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
+ include("../lib/$config[general_lib_type]/user_info.php3");
+?>
+ <form method=post>
+ <input type=hidden name=login value="<?php echo $login?>">
+ <input type=hidden name=change value="0">
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+<?php
+ echo <<<EOM
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Name (First Name Surname)
+ </td><td>
+ <input type=text name="Fcn" value="$cn" size=35>
+ </td>
+ </tr>
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Mail
+ </td><td>
+ <input type=text name="Fmail" value="$mail" size=35>
+ </td>
+ </tr>
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Departement
+ </td><td>
+ <input type=text name="Fou" value="$ou" size=35>
+ </td>
+ </tr>
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Home Phone
+ </td><td>
+ <input type=text name="Fhomephone" value="$homephone" size=35>
+ </td>
+ </tr>
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Work Phone
+ </td><td>
+ <input type=text name="Ftelephonenumber" value="$telephonenumber" size=35>
+ </td>
+ </tr>
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Mobile Phone
+ </td><td>
+ <input type=text name="Fmobile" value="$mobile" size=35>
+ </td>
+ </tr>
+EOM;
+?>
+ </table>
+<br>
+<input type=submit class=button value="Change" OnClick="this.form.change.value=1">
+</form>
+ </td></tr>
+</table>
+</tr>
+</table>
+</body>
+</html>
<a href="user_admin.php3?login=$login" title="Show User Information"><font color="white"><b>SHOW</b></font></a></td>
<td align=center bgcolor="black" width=100>
<a href="user_edit.php3?login=$login" title="Change User Dialup Settings"><font color="white"><b>EDIT</b></font></a></td>
+<td align=center bgcolor="black" width=200 colspan=2>
+<a href="user_info.php3?login=$login" title="Change User Personal Information"><font color="white"><b>USER INFO</b></font></a></td>
+</tr>
+<tr valign=top>
<td align=center bgcolor="black" width=100>
<a href="user_accounting.php3?login=$login" title="Show User Accounting Information"><font color="white"><b>ACCOUNTING</b></font></a></td>
<td align=center bgcolor="black" width=100>
--- /dev/null
+<?php
+ $ds = @ldap_connect($config[ldap_server]);
+ if ($ds){
+ $r = @ldap_bind($ds,"$config[ldap_binddn]",$config[ldap_bindpw]);
+ if ($r){
+ if ($Fcn != '' && $Fcn != $cn)
+ $mod['cn'] = $Fcn;
+ if ($Fmail != '' && $Fmail != $mail)
+ $mod['mail'] = $Fmail;
+ if ($Fou != '' && $Fou != $ou)
+ $mod['ou'] = $Fou;
+ if ($Ftelephonenumber != '' && $Ftelephonenumber != $telephonenumber)
+ $mod['telephonenumber'] = $Ftelephonenumber;
+ if ($Fhomephone != '' && $Fhomephone != $homephone)
+ $mod['homephone'] = $Fhomephone;
+ if ($dn != ''){
+ @ldap_mod_replace($ds,$dn,$mod);
+ if (@ldap_error($ds) != 'Success')
+ echo "<b>LDAP ERROR: " . ldap_error($ds) . "</b><br>\n";
+ else
+ echo "<b>User personal information updated successfully</b><br>\n";
+ }
+ }
+ @ldap_close($ds);
+ }
+?>
}
@ldap_close($ds);
}
+else
+ echo "<b>Could not connect to the LDAP server</b><br>\n";
?>
--- /dev/null
+<?php
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo "<b>Could not include SQL library</b><br>\n";
+ exit();
+}
+$link = @da_sql_pconnect($config);
+$fail = 0;
+if ($link){
+ if ($config[sql_use_user_info_table] == 'true'){
+ $res = @da_sql_query($link,$config,
+ "SELECT UserName FROM $config[sql_user_info_table] WHERE
+ UserName = '$login';");
+ if ($res){
+ if (!@da_sql_num_rows($res,$config)){
+ $res = @da_sql_query($link,$config,
+ "INSERT INTO $config[sql_user_info_table]
+ (UserName,Name,Mail,Department,HomePhone,WorkPhone,Mobile) VALUES
+ ('$login','$Fcn','$Fmail','$Fou','$Ftelephonenumber','$Fhomephone','$Fmobile');");
+ if (!$res || !@da_sql_affected_rows($link,$res,$config)){
+ echo "<b>Could not add user information in user info table</b><br>\n";
+ $fail = 1;
+ }
+ }
+ else{
+ $res = @da_sql_query($link,$config,
+ "UPDATE $config[sql_user_info_table] SET Name = '$Fcn',Mail = '$Fmail',
+ Department = '$Fou', HomePhone = '$Fhomephone', WorkPhone = '$Ftelephonenumber',
+ Mobile = '$Fmobile';");
+ if (!$res || !@da_sql_affected_rows($link,$res,$config)){
+ echo "<b>Could not update user information in user info table</b><br>\n";
+ $fail = 1;
+ }
+ }
+ }
+ else{
+ echo "<b>Could not find user in user info table. SQL Error</b><br>\n";
+ $fail = 1;
+ }
+ if ($fail == 0)
+ echo "<b>User information updated successfully</b><br>\n";
+ }
+ else
+ echo "<b>Cannot use the user info table. Check the sql_use_user_info_table directive in admin.conf</b><br>\n";
+
+}
+else
+ echo "<b>Could not connect to database</b><br>\n";
+?>
$res = @da_sql_query($link,$config,
"INSERT INTO $config[sql_user_info_table]
(UserName,Name,Mail,Department,HomePhone,WorkPhone,Mobile) VALUES
- ('$login','$cn','$mail','$ou','$telephonenumber','$homephone','$mobile');");
+ ('$login','$cn','$mail','$ou','$homephone','$telephonenumber','$mobile');");
if (!$res || !@da_sql_affected_rows($link,$res,$config))
echo "<b>Could not add user information in user info table</b><br>\n";
}
$use_op = 0;
}
$user_exists = 'no';
+
+$cn_lang = '-';
+$homeaddress = '-';
+$homeaddress_lang = '-';
+$fax = '-';
+$url = '-';
+$ou_lang = '-';
+$title = '-';
+$title_lang = '-';
+$mailalt = '-';
+
unset($item_vals);
unset($tmp);
$link = @da_sql_pconnect($config);