From 02107879fc905c87fd1f18356abc140ddd687754 Mon Sep 17 00:00:00 2001 From: kkalev Date: Tue, 13 Aug 2002 07:00:23 +0000 Subject: [PATCH] * Have adddress and home address in user personal info * Set $user_info in lib/{ldap,sql}/user_info.php3 and only if the user exists and has personal info * Show language attributes only if general_prefered_lang is not 'en' --- Changelog | 3 +++ htdocs/user_admin.php3 | 1 - html/user_admin.html.php3 | 52 +++++++++++++++++++++++++++++++++++++-- lib/ldap/user_info.php3 | 7 ++++++ lib/sql/user_info.php3 | 6 ++++- 5 files changed, 65 insertions(+), 4 deletions(-) diff --git a/Changelog b/Changelog index 093c570..2734d38 100644 --- a/Changelog +++ b/Changelog @@ -18,6 +18,9 @@ Ver 1.50: * Set a few more personal information attributes to defaults in lib/sql/user_info.php3 * Fix a typo for department * Set personal information attributes to defaults in lib/ldap/user_info.php3 +* Have adddress and home address in user personal info +* Set $user_info in lib/{ldap,sql}/user_info.php3 and only if the user exists and has personal info +* Show language attributes only if general_prefered_lang is not 'en' 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_admin.php3 b/htdocs/user_admin.php3 index 1366275..4784af5 100644 --- a/htdocs/user_admin.php3 +++ b/htdocs/user_admin.php3 @@ -9,7 +9,6 @@ $date = strftime('%A, %e %B %Y, %T %Z'); if (is_file("../lib/$config[general_lib_type]/user_info.php3")){ include("../lib/$config[general_lib_type]/user_info.php3"); - $user_info = 1; if ($user_exists == 'no'){ echo <<user information page diff --git a/html/user_admin.html.php3 b/html/user_admin.html.php3 index 2577fa4..015784c 100644 --- a/html/user_admin.html.php3 +++ b/html/user_admin.html.php3 @@ -256,7 +256,8 @@ lign=top>
EOM; -if ($user_info) print << @@ -279,6 +280,9 @@ if ($user_info) print << +EOM; + if ($config[general_prefered_lang] != 'en'){ + echo << name ($config[general_prefered_lang_name]) @@ -287,6 +291,9 @@ if ($user_info) print << +EOM; + } + echo << department @@ -295,6 +302,9 @@ if ($user_info) print << +EOM; + if ($config[general_prefered_lang] != 'en'){ + echo << department ($config[general_prefered_lang_name]) @@ -303,6 +313,9 @@ if ($user_info) print << +EOM; + } + echo << title @@ -311,6 +324,9 @@ if ($user_info) print << +EOM; + if ($config[general_prefered_lang] != 'en'){ + echo << title ($config[general_prefered_lang_name]) @@ -319,22 +335,53 @@ if ($user_info) print << +EOM; + } + echo << address - $homeaddress + $address +EOM; + if ($config[general_prefered_lang] != 'en'){ + echo << address ($config[general_prefered_lang_name]) + $address_lang + + +EOM; + } + echo << + + home address + + + $homeaddress + + +EOM; + if ($config[general_prefered_lang] != 'en'){ + echo << + + home address ($config[general_prefered_lang_name]) + + $homeaddress_lang +EOM; + } + echo << phone @@ -396,6 +443,7 @@ if ($user_info) print << EOM; +} ?> diff --git a/lib/ldap/user_info.php3 b/lib/ldap/user_info.php3 index ff56adb..56e069c 100644 --- a/lib/ldap/user_info.php3 +++ b/lib/ldap/user_info.php3 @@ -7,6 +7,8 @@ else $cn = '-'; $cn_lang = '-'; +$address = '-'; +$address_lang = '-'; $homeaddress = '-'; $homeaddress_lang = '-'; $fax = '-'; @@ -31,6 +33,7 @@ if ($ds) { $user_exists = 'no'; else{ $user_exists = 'yes'; + $user_info = 1; unset($item_vals); $k = init_decoder(); $cn = ($info[0]['cn'][0]) ? $info[0]['cn'][0] : '-'; @@ -39,6 +42,10 @@ if ($ds) { $cn_lang = ($cn_lang) ? $cn_lang : '-'; $telephonenumber = ($info[0]['telephonenumber'][0]) ? $info[0]['telephonenumber'][0] : '-'; $homephone = ($info[0]['homephone'][0]) ? $info[0]['homephone'][0] : '-'; + $address = ($info[0]['postaladdress'][0]) ? $info[0]['postaladdress'][0] : '-'; + $address_lang = $info[0]["postaladdress;lang-$config[general_prefered_lang]"][0]; + $address_lang = decode_string("$address_lang",$k); + $address_lang = ($address_lang) ? $address_lang : '-'; $homeaddress = ($info[0]['homepostaladdress'][0]) ? $info[0]['homepostaladdress'][0] : '-'; $homeaddress_lang = $info[0]["homepostaladdress;lang-$config[general_prefered_lang]"][0]; $homeaddress_lang = decode_string("$homeaddress_lang", $k); diff --git a/lib/sql/user_info.php3 b/lib/sql/user_info.php3 index 96e2f57..b170438 100644 --- a/lib/sql/user_info.php3 +++ b/lib/sql/user_info.php3 @@ -17,6 +17,8 @@ $user_exists = 'no'; $cn = '-'; $cn_lang = '-'; +$address = '-'; +$address_lang = '-'; $homeaddress = '-'; $homeaddress_lang = '-'; $fax = '-'; @@ -69,8 +71,10 @@ if ($link){ $res = @da_sql_query($link,$config, "SELECT * FROM $config[sql_user_info_table] WHERE UserName = '$login';"); if ($res){ - if (@da_sql_num_rows($res,$config)) + if (@da_sql_num_rows($res,$config)){ $user_exists = 'yes'; + $user_info = 1; + } if (($row = @da_sql_fetch_array($res,$config))){ $cn = ($row[Name] != '') ? $row[Name] : '-'; $telephonenumber = ($row[WorkPhone] != '') ? $row[WorkPhone] : '-'; -- 2.39.5