| 1 |
<?php
|
| 2 |
|
| 3 |
// $Header: /cvsroot/tikiwiki/tiki/tiki-user_information.php,v 1.19.2.8 2005/06/26 18:51:49 lfagundes Exp $
|
| 4 |
|
| 5 |
// Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
|
| 6 |
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
|
| 7 |
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
|
| 8 |
|
| 9 |
// Initialization
|
| 10 |
require_once ('tiki-setup.php');
|
| 11 |
|
| 12 |
include_once ('lib/messu/messulib.php');
|
| 13 |
include_once ('lib/userprefs/scrambleEmail.php');
|
| 14 |
include_once ('lib/userprefs/userprefslib.php');
|
| 15 |
|
| 16 |
if (isset($_REQUEST['view_user'])) {
|
| 17 |
$userwatch = $_REQUEST['view_user'];
|
| 18 |
} else {
|
| 19 |
if ($user) {
|
| 20 |
$userwatch = $user;
|
| 21 |
} else {
|
| 22 |
$smarty->assign('msg', tra("You are not logged in and no user indicated"));
|
| 23 |
|
| 24 |
$smarty->display("error.tpl");
|
| 25 |
die;
|
| 26 |
}
|
| 27 |
}
|
| 28 |
|
| 29 |
$smarty->assign('userwatch', $userwatch);
|
| 30 |
|
| 31 |
// Custom fields
|
| 32 |
$customfields = array();
|
| 33 |
$customfields = $userprefslib->get_userprefs('CustomFields');
|
| 34 |
|
| 35 |
foreach ($customfields as $custpref=>$prefvalue ) {
|
| 36 |
$customfields[$custpref]['value'] = $tikilib->get_user_preference($userwatch, $customfields[$custpref]['prefName'], $customfields[$custpref]['value']);
|
| 37 |
}
|
| 38 |
|
| 39 |
$smarty->assign_by_ref('customfields', $customfields);
|
| 40 |
|
| 41 |
if ($feature_friends == 'y') {
|
| 42 |
$smarty->assign('friend', $tikilib->verify_friendship($userwatch, $user));
|
| 43 |
}
|
| 44 |
|
| 45 |
if (!$userlib->user_exists($userwatch)) {
|
| 46 |
$smarty->assign('msg', tra("Unknown user"));
|
| 47 |
|
| 48 |
$smarty->display("error.tpl");
|
| 49 |
die;
|
| 50 |
}
|
| 51 |
|
| 52 |
if ($tiki_p_admin != 'y') {
|
| 53 |
$user_information = $tikilib->get_user_preference($userwatch, 'user_information', 'public');
|
| 54 |
|
| 55 |
if ($user_information == 'private') {
|
| 56 |
$smarty->assign('msg', tra("The user has chosen to make his information private"));
|
| 57 |
$smarty->display("error.tpl");
|
| 58 |
die;
|
| 59 |
}
|
| 60 |
}
|
| 61 |
|
| 62 |
$smarty->assign('mid', 'tiki-user_information.tpl');
|
| 63 |
|
| 64 |
if ($user) {
|
| 65 |
$smarty->assign('sent', 0);
|
| 66 |
|
| 67 |
if (isset($_REQUEST['send'])) {
|
| 68 |
check_ticket('user-information');
|
| 69 |
$smarty->assign('sent', 1);
|
| 70 |
|
| 71 |
$message = '';
|
| 72 |
|
| 73 |
// Validation:
|
| 74 |
// must have a subject or body non-empty (or both)
|
| 75 |
if (empty($_REQUEST['subject']) && empty($_REQUEST['body'])) {
|
| 76 |
$smarty->assign('message', tra('ERROR: Either the subject or body must be non-empty'));
|
| 77 |
|
| 78 |
$smarty->display("tiki.tpl");
|
| 79 |
die;
|
| 80 |
}
|
| 81 |
|
| 82 |
$message = tra('Message sent to'). ':' . $userwatch . '<br />';
|
| 83 |
$messulib->post_message($userwatch, $user, $_REQUEST['to'],
|
| 84 |
'', $_REQUEST['subject'], $_REQUEST['body'], $_REQUEST['priority']);
|
| 85 |
|
| 86 |
$smarty->assign('message', $message);
|
| 87 |
}
|
| 88 |
}
|
| 89 |
if ($feature_score == 'y' and isset($user) and $user != $userwatch) {
|
| 90 |
$tikilib->score_event($user, 'profile_see');
|
| 91 |
$tikilib->score_event($userwatch, 'profile_is_seen');
|
| 92 |
}
|
| 93 |
global $site_style;
|
| 94 |
|
| 95 |
$smarty->assign('priority',3);
|
| 96 |
$allowMsgs = $tikilib->get_user_preference($userwatch,'allowMsgs','y');
|
| 97 |
$smarty->assign('allowMsgs',$allowMsgs);
|
| 98 |
$user_style = $tikilib->get_user_preference($userwatch,'theme',$site_style);
|
| 99 |
$user_language = $tikilib->get_language($userwatch);
|
| 100 |
$smarty->assign_by_ref('user_language',$user_language);
|
| 101 |
$smarty->assign_by_ref('user_style',$user_style);
|
| 102 |
$realName = $tikilib->get_user_preference($userwatch,'realName','');
|
| 103 |
$country = $tikilib->get_user_preference($userwatch,'country','Other');
|
| 104 |
$smarty->assign('country',$country);
|
| 105 |
$anonpref = $tikilib->get_preference('userbreadCrumb',4);
|
| 106 |
$userbreadCrumb = $tikilib->get_user_preference($userwatch,'userbreadCrumb',$anonpref);
|
| 107 |
$smarty->assign_by_ref('realName',$realName);
|
| 108 |
$smarty->assign_by_ref('userbreadCrumb',$userbreadCrumb);
|
| 109 |
$homePage = $tikilib->get_user_preference($userwatch,'homePage','');
|
| 110 |
|
| 111 |
$smarty->assign_by_ref('homePage',$homePage);
|
| 112 |
|
| 113 |
$avatar = $tikilib->get_user_avatar($userwatch);
|
| 114 |
$smarty->assign('avatar', $avatar);
|
| 115 |
|
| 116 |
$user_information = $tikilib->get_user_preference($userwatch, 'user_information', 'public');
|
| 117 |
$smarty->assign('user_information', $user_information);
|
| 118 |
|
| 119 |
$timezone_options = $tikilib->get_timezone_list(true);
|
| 120 |
$smarty->assign_by_ref('timezone_options', $timezone_options);
|
| 121 |
$server_time = new Date();
|
| 122 |
$display_timezone = $tikilib->get_user_preference($userwatch, 'display_timezone', $server_time->tz->getID());
|
| 123 |
$smarty->assign_by_ref('display_timezone', $display_timezone);
|
| 124 |
|
| 125 |
$userinfo = $userlib->get_user_info($userwatch);
|
| 126 |
$email_isPublic = $tikilib->get_user_preference($userwatch, 'email is public', 'n');
|
| 127 |
if ($email_isPublic != 'n') {
|
| 128 |
$userinfo['email'] = scrambleEmail($userinfo['email'], $email_isPublic);
|
| 129 |
}
|
| 130 |
$smarty->assign_by_ref('userinfo', $userinfo);
|
| 131 |
$smarty->assign_by_ref('email_isPublic',$email_isPublic);
|
| 132 |
$userPage = $feature_wiki_userpage_prefix.$userinfo['login'];
|
| 133 |
$exist = $tikilib->page_exists($userPage);
|
| 134 |
$smarty->assign("userPage_exists", $exist);
|
| 135 |
|
| 136 |
ask_ticket('user-information');
|
| 137 |
|
| 138 |
$smarty->display("tiki.tpl");
|
| 139 |
|
| 140 |
?>
|