From b2e4b30f6cf5ce2c513641b9113c902479d102b9 Mon Sep 17 00:00:00 2001 From: kkalev Date: Mon, 12 Aug 2002 13:08:20 +0000 Subject: [PATCH] * 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 --- Changelog | 5 ++ htdocs/user_info.php3 | 110 ++++++++++++++++++++++++++++++++++++ html/user_toolbar.html.php3 | 4 ++ lib/ldap/change_info.php3 | 26 +++++++++ lib/ldap/user_info.php3 | 2 + lib/sql/change_info.php3 | 50 ++++++++++++++++ lib/sql/create_user.php3 | 2 +- lib/sql/user_info.php3 | 11 ++++ 8 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 htdocs/user_info.php3 create mode 100644 lib/ldap/change_info.php3 create mode 100644 lib/sql/change_info.php3 diff --git a/Changelog b/Changelog index 4b9ce16..fe81ca3 100644 --- a/Changelog +++ b/Changelog @@ -8,6 +8,11 @@ Ver 1.50: * 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. diff --git a/htdocs/user_info.php3 b/htdocs/user_info.php3 new file mode 100644 index 0000000..f7096ef --- /dev/null +++ b/htdocs/user_info.php3 @@ -0,0 +1,110 @@ + + + + +Personal information page + + + + +
+ + + + +
+ + + +
+ +
+ + + + + +
+ + +
+ Personal information for   +
+
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + +EOM; +?> +
+ Name (First Name Surname) + + +
+ Mail + + +
+ Departement + + +
+ Home Phone + + +
+ Work Phone + + +
+ Mobile Phone + + +
+
+ +
+
+
+ + diff --git a/html/user_toolbar.html.php3 b/html/user_toolbar.html.php3 index 456a638..e8aa909 100644 --- a/html/user_toolbar.html.php3 +++ b/html/user_toolbar.html.php3 @@ -5,6 +5,10 @@ print <<SHOW EDIT + +USER INFO + + ACCOUNTING diff --git a/lib/ldap/change_info.php3 b/lib/ldap/change_info.php3 new file mode 100644 index 0000000..48e10d0 --- /dev/null +++ b/lib/ldap/change_info.php3 @@ -0,0 +1,26 @@ +LDAP ERROR: " . ldap_error($ds) . "
\n"; + else + echo "User personal information updated successfully
\n"; + } + } + @ldap_close($ds); + } +?> diff --git a/lib/ldap/user_info.php3 b/lib/ldap/user_info.php3 index 34fd632..174f72e 100644 --- a/lib/ldap/user_info.php3 +++ b/lib/ldap/user_info.php3 @@ -46,4 +46,6 @@ if ($ds) { } @ldap_close($ds); } +else + echo "Could not connect to the LDAP server
\n"; ?> diff --git a/lib/sql/change_info.php3 b/lib/sql/change_info.php3 new file mode 100644 index 0000000..ddf05dd --- /dev/null +++ b/lib/sql/change_info.php3 @@ -0,0 +1,50 @@ +Could not include SQL library
\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 "Could not add user information in user info table
\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 "Could not update user information in user info table
\n"; + $fail = 1; + } + } + } + else{ + echo "Could not find user in user info table. SQL Error
\n"; + $fail = 1; + } + if ($fail == 0) + echo "User information updated successfully
\n"; + } + else + echo "Cannot use the user info table. Check the sql_use_user_info_table directive in admin.conf
\n"; + +} +else + echo "Could not connect to database
\n"; +?> diff --git a/lib/sql/create_user.php3 b/lib/sql/create_user.php3 index 012850a..3a26ce3 100644 --- a/lib/sql/create_user.php3 +++ b/lib/sql/create_user.php3 @@ -32,7 +32,7 @@ if ($link){ $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 "Could not add user information in user info table
\n"; } diff --git a/lib/sql/user_info.php3 b/lib/sql/user_info.php3 index be6efb8..3da8cc4 100644 --- a/lib/sql/user_info.php3 +++ b/lib/sql/user_info.php3 @@ -14,6 +14,17 @@ if ($config[sql_use_operators] == 'true'){ $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); -- 2.39.5