(root)/profiles.php - Rev 466
Rev 460 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
<?PHP
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This file is part of Travelsized CMS
* A content management system with modules, based on wiki syntax
*
* Author: Dan Jensen <admin@leinir.dk>
* Copyright 2003/2004
*
* 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.
*
* The GNU General Public License is available at: http://www.gnu.org/copyleft/
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
$page_author = $owner_name;
$page_author_email = $owner_email;
$page_date = formatTime
( time() );
$page_menu = $profile_options["profiles_menu"];
/**
* Renders an information box appropriate for the section the profile is shown in. If it is the user itself,
* appropriate hints for what they should be doing are showed.
*
* @param section The profile section to show the hint in
*
* @return A string containing the rendered information box with hints for the profile
*/
function drawProfileHint
()
{
global $viewUser;
if( $_REQUEST["profile_mode"] == "mypage" || $_REQUEST["profile_mode"] == "view" || $_REQUEST["profile_mode"] == "" )
{
$avatarfile = getAvatar
( $viewUser );
$avatarthumbfile = getAvatarThumbnail
( $viewUser );
list($avatarwidth,$avatarheight) = getAvatarThumbSize
( $viewUser );
$avatarfile = siteURL
(true) . $avatarfile;
$avatarthumbfile = siteURL
(true) . $avatarthumbfile;
if( currentUser
() == $viewUser )
{
if( getAvatar
( $viewUser ) == getAvatar
() )
$infoAvatar = i18n
("**Show yourself!**") . "\n" .
i18n
("Make yourself visible by uploading an image to present yourself to visitors of the site. Your avatar is used to show a tiny face next to your name everywhere that links to this profile, such as blog entries, documents and events listings.") . "\n>>" .
drawCommand
(i18n
("User avatar ##0##", array("»")), i18n
("User avatar selection"), globalIDtoURL
("user/$viewUser/edit/user_avatar") );
;
if( getUserInfo
($viewUser, "profile") == i18n
("No ##0## information\n", array("profile")) || getUserInfo
($viewUser, "profile") == "" )
$infoProfile = i18n
("**Make yourself known!**") . "\n" .
i18n
("Let others know who and what you are, type in some information in the Profile Editor so visitors to the site can get to know you a little better") . "\n>>" .
drawCommand
(i18n
("Profile ##0##", array("»")), i18n
("Profile text editor"), globalIDtoURL
("user/$viewUser/edit/profile") );
;
if( $infoProfile != "" && $infoAvatar != "" )
$infoAvatar .= "\n---\n";
$infoBox = renderInformationBox
( i18n
("What's next?"), $infoAvatar . $infoProfile);
}
else
$infoBox = renderInformationBox
( i18n
("No profile information"), i18n
("This user has not yet entered any profile information") );
if( $_REQUEST["profile_mode"] == "view" || $_REQUEST["profile_mode"] == "" )
$data = "
<a href=\"$avatarfile\" target=\"_blank\"><img border=\"0\" class=\"profile_avatar\" src=\"$avatarthumbfile\" width=\"$avatarwidth\" height=\"$avatarheight\" alt=\"" . i18n
("##0##'s avatar", array(getUserInfo
($viewUser, "name"))) . "\" /></a>
";
$data .= $infoBox;
}
return $data;
}
$tabwidget = new TabWidget
;
if ($viewUser == currentUser
() || isAllowed
("global_admin")) $tabwidget->tabbar->addTab(i18n
("My page"), globalIDtoURL
("user/$viewUser/mypage") );
$tabwidget->tabbar->addTab(i18n
("View"), globalIDtoURL
("user/$viewUser") );
// Only add the profile to the user, if the user is allowed to use that module...
foreach ($profilemodules as $key => $value)
if( userIsAllowed
( $viewUser, "profile_" . substr($value, 14) ) )
$tabwidget->tabbar->addTab(i18n
(substr($value, 14)), globalIDtoURL
("user/$viewUser/" . substr($value, 14)));
$tabwidget->tabbar->addTab(i18n
("Contact"), globalIDtoURL
("user/$viewUser/contact") );
if( profileEditAllowed
($viewUser) )
$tabwidget->tabbar->addTab(i18n
("Edit"), globalIDtoURL
("user/$viewUser/edit") );
if( array_key_exists( "module", $_REQUEST ) )
$_REQUEST["profile_mode"] = "module";
if( !array_key_exists( "profile_mode", $_REQUEST ) )
$_REQUEST["profile_mode"] = "view";
switch( $_REQUEST["profile_mode"] )
{
case "new":
$page_title = i18n
("Register a new user");
if (!isAllowed
("global_user_new")) {
$page_content = i18n
("You do not have the correct priviledges to create a new user.");
}
else
{
$panel = new optionsPanel
("newUser");
$panel->showHeader = false;
$panel->saveTitle = i18n
("Register and log in");
$panel->revertTitle = i18n
("Reset");
$panel->addOption( i18n
("Username:"), i18n
("All lower case, no spaces or special characters, for example johndoe"), "", "username", "text");
$panel->addOption( i18n
("Password:"), i18n
("A password, at least 8 characters long. Repeat the password in the two boxes. Preferably comprised of a mix of upper and lower case characters and numbers, for example ##0##", array(makeRandomPassword
())), "", "password", "password" );
$panel->addOption( i18n
("Repeat password:"), "", "", "password2", "password" );
$panel->addOption( i18n
("Full name:"), i18n
("Your full name, for example John Doe"), "", "fullname", "text" );
$panel->addOption( i18n
("Email address:"), i18n
("The email address you wish to use, for example johndoe@site.com"), "", "email", "text" );
$errorFound = false;
if( $panel->submitted )
{
if( $panel->options["username"]["current"] == "" )
{ $errorFound = true; $panel->options["username"]["error"] = i18n
("Your must enter a username!"); }
if( strpos( $panel->options["username"]["current"], " " ) )
{ $errorFound = true; $panel->options["username"]["error"] = i18n
("Your username cannot contain spaces!"); }
if( $usermanager->userExists( strtolower( $panel->options["username"]["current"] ) ) )
{ $errorFound = true; $panel->options["username"]["error"] = i18n
("A user with this username already exists!"); }
if( $panel->options["password"]["current"] == "" )
{ $errorFound = true; $panel->options["password"]["error"] = i18n
("Your must enter a password!"); }
if( $panel->options["password"]["current"] != $panel->options["password2"]["current"] )
{ $errorFound = true; $panel->options["password2"]["error"] = i18n
("The passwords must match!"); }
if( $panel->options["fullname"]["current"] == "" )
{ $errorFound = true; $panel->options["fullname"]["error"] = i18n
("Your must enter a full name!"); }
if( $panel->options["email"]["current"] == "" )
{ $errorFound = true; $panel->options["email"]["error"] = i18n
("Your must enter an email address!"); }
if( ! validateEmail
( $panel->options["email"]["current"] ) )
{ $errorFound = true; $panel->options["email"]["error"] = i18n
("Your must enter a valid email address!"); }
}
if( $panel->submitted && ! $errorFound )
{
$newUsername = strtolower($panel->options["username"]["current"]);
$usermanager->changeadd($newUsername, $panel->options["password"]["current"], "setup/password.txt");
saveUserInfo
($newUsername, "name", $panel->options["fullname"]["current"]);
saveUserInfo
($newUsername, "email", $panel->options["email"]["current"]);
// If the user is already logged in - then it's almost certainly an administrator or similar... Don't redirect!
if( !isAuth
() )
{
auth
($newUsername, $_REQUEST['new_password']);
header("Location: " . globalIDtoURL
( "user/$newUsername/mypage") );
}
else
{
if( isAllowed
("global_user_edit") )
$userSetup = drawCommand
( i18n
("User setup"), i18n
("Go to User Setup"), globalIDtoURL
("setup/users") );
$page_content = renderInformationBox
( i18n
("User created"),
i18n
("The user was successfully created. The details are as follows (this message has also been emailed to the new user):##0##",
array("\n" .
i18n
("Username: ##0##", array($newUsername)) . "\n" .
i18n
("Password: ##0##", array($panel->options["password"]["current"])) . "\n" .
i18n
("Full name: ##0##", array($panel->options["fullname"]["current"])) . "\n" .
i18n
("Email: ##0##", array($panel->options["email"]["current"])) . "\n"
)
) . "\n---\n" .
i18n
("You now have the following choices:") . "\n" .
drawCommand
(i18n
("Create user"), i18n
("Create another user"), globalIDtoURL
("user/" . i18n
("username") . "/new")) . " " .
drawCommand
(i18n
("Edit ##0##", array($panel->options["fullname"]["current"])), i18n
("Edit the new user's details"), globalIDtoURL
("user/$newUsername/edit")) . " " .
drawCommand
(i18n
("Front page"), i18n
("Go to the front page"), globalIDtoURL
("content/$language/0")) . " $userSetup"
);
}
}
else
{
$page_content = "
<form action=\"" . globalIDtoURL
( "user/" . i18n
("username") . "/new" ) . "\" method=\"post\">
" . renderInformationBox
( i18n
("Register"), i18n
("Please type in the login information you wish to use in the fields below.") . $panel->render(), false ) . "
</form>
";
}
}
break;
case "module":
if ($usermanager->userExists($viewUser)) {
$page_title = i18n
("##0##'s ##1##", array(getUserInfo
($viewUser, "name"), i18n
(substr(htmlspecialchars($_REQUEST["module"]), 14))));
$tabwidget->tabbar->setCurrent(i18n
(substr($_REQUEST["module"], 14)));
if (!userAllowsView
($viewUser)) {
global $permissionlevels_array;
$tabwidget->contents = "<p>" . i18n
("The user has decided you are not allowed to view this page. The user has selected that only the following people can view their profile") . ":<br /><b>" . $permissionlevels_array[getUserInfo
($viewUser, "profiles_view")] . "</b></p>";
} else {
$tabwidget->contents = $_REQUEST["module"]();
}
} else {
$page_title = i18n
("##0##'s profile", array(i18n
("Unknown User")));
$tabwidget = new TabWidget
;
$tabwidget->tabbar->addTab(i18n
("View"), globalIDtoURL
("user/$viewUser") );
$tabwidget->tabbar->setCurrent(i18n
("View"));
if (isAllowed
("global_admin"))
$tabwidget->tabbar->addTab(i18n
("Add this user"), globalIDtoURL
("setup/users/new/$viewUser") );
$tabwidget->contents = "<p>" . i18n
("The user was not found on the system") . "</p>";
}
if (array_key_exists("theme", $_REQUEST) && $_REQUEST["theme"] == "empty")
$page_content = $tabwidget->contents;
else
$page_content = $tabwidget->renderTabWidget();
break;
case "edit":
if ($usermanager->userExists($viewUser)) {
include("profiles_edit.php");
} else {
$page_title = i18n
("##0##'s profile", array(i18n
("Unknown User")));
$tabwidget = new TabWidget
;
$tabwidget->tabbar->addTab(i18n
("View"), globalIDtoURL
("user/$viewUser") );
$tabwidget->tabbar->setCurrent(i18n
("View"));
if (isAllowed
("global_admin")) $tabwidget->tabbar->addTab(i18n
("Add this user"), globalIDtoURL
("setup/users/new/$viewUser") );
$tabwidget->contents = "<p>" . i18n
("The user was not found on the system") . "</p>";
$page_content = $tabwidget->renderTabWidget();
}
break;
case "contact":
if ($usermanager->userExists($viewUser)) {
$page_title = i18n
("Contact ##0##", array(getUserInfo
($viewUser, "name")));
$tabwidget->tabbar->setCurrent(i18n
("Contact"));
if (!userAllowsContact
($viewUser)) {
global $permissionlevels_array;
$tabwidget->contents = "<p>" . i18n
("The user has decided you are not allowed to view this page. The user has selected that only the following people can contact them") . ":<br /><b>" . $permissionlevels_array[getUserInfo
($viewUser, "profiles_contact")] . "</b></p>";
} else {
$tabwidget->contents = "
<h2>" . i18n
("Contact information") . "</h2>";
if( array_key_exists( "send_email", $_REQUEST ) )
{
if( $_REQUEST["email"] != "" && validateEmail
($_REQUEST["email"]) && $_REQUEST["subject"] != "" && $_REQUEST["message"] != "" )
{
if ( !array_key_exists("email_sent_time", $_SESSION) OR
(time() - $_SESSION["email_sent_time"]) > 15 )
{
if (mail(getUserInfo
($viewUser, "email"), stripslashes($_REQUEST["subject"]), stripslashes($_REQUEST["message"]), "From: " . stripslashes($_REQUEST["email"]) . "\r\n" . "X-Mailer: PHP/" . phpversion())) {
$_SESSION["email_sent_time"] = time();
$tabwidget->contents .= renderInformationBox
( i18n
("Success!"), i18n
("The email was sent successfully!") );
}
else
$tabwidget->contents .= renderInformationBox
( i18n
("Error!"), i18n
("An error occured while attempting to send the email! This probably means that the server does not support sending emails, or that there is a mis-configuration.") );
}
else
$tabwidget->contents .= renderInformationBox
( i18n
("Timeout error!"), i18n
("You have attempted to send another email before 15 seconds passed since the last message was sent.") );
}
else
{
if (!validateEmail
($_REQUEST["email"]))
$tabwidget->contents .= renderInformationBox
( i18n
("Not an email address"), i18n
("The email address was filled in wrongly! Please correct this and try again.") );
else
$tabwidget->contents .= renderInformationBox
( i18n
("Required fields"), i18n
("All fields were not filled out! Please correct this and try again.") );
}
}
$contact_content = "
<table class=\"setup\">
<tr class=\"setup\">
<th class=\"setup\" width=\"50%\">" . i18n
("Contact type and description") . "</th>
<th class=\"setup\" width=\"50%\">" . i18n
("Contact detail (click on icon to activate)") . "</th>
</tr>";
$contactinfo = unserialize(getUserInfo
($viewUser, "contactinfo"));
$temp_contact_content = "";
if( is_array($contactinfo) )
{
foreach( $contactinfo as $key => $value )
{
if( $value )
{
$url = str_replace("$$", $value, $profile_options["contact_fields"][$key]["url"]);
$temp_contact_content .= "
<tr class=\"setup\"><td class=\"setup\">
<p class=\"profile_contactitem\">$key:<br /><small class=\"comment\">" . $profile_options["contact_fields"][$key]["description"] . "</small></p>
</td><td class=\"setup\">
<a href=\"$url\" target=\"_blank\" title=\"" . $value . "\"><img border=\"0\" class=\"profile_contactimage\" src=\"" . siteURL
(true) . "$setup_folder/images/contact/" . $profile_options["contact_fields"][$key]["image"] . "\" alt=\"" . $value . "\" /></a>
<p class=\"profile_contactitem\">$value</p>
</td></tr>";
}
}
}
if ($temp_contact_content == "")
$contact_content = "<table class=\"setup\"><tr class=\"setup\"><td class=\"setup\">
" . renderInformationBox
(
i18n
("No contact information"),
i18n
("There was not found any direct contact information, however you can still send messages from the site using the form below.")
) . "
</td></tr>";
else
$contact_content .= $temp_contact_content;
$email = $subject = $message = "";
if( array_key_exists( "email", $_REQUEST ) )
$email .= stripslashes($_REQUEST['email']);
if( array_key_exists( "subject", $_REQUEST) )
$subject .= stripslashes($_REQUEST['subject']);
if( array_key_exists( "message", $_REQUEST ) )
$message .= stripslashes($_REQUEST['message']);
$tabwidget->contents .= "$contact_content
</table>
<h2>" . i18n
("Email") . "</h2>
<p>" . i18n
("Please note, that you can only send one email from this website to any user every 15 (fifteen) seconds. This is done to protect against using the website for spamming or other malicious purposes. Thank you for your understanding.") . "</p>
<form action=\"" . globalIDtoURL
( "user/$viewUser/contact" ) . "\" method=\"post\">
<table class=\"setup\">
<tr class=\"setup\">
<td class=\"setup\" width=\"35%\">
" . i18n
("From") . ":<br />
<small class=\"comment\">" . i18n
("Your email, in the following format: johndoe@somesite.com") . "</small>
</td>
<td class=\"setup\" width=\"65%\"><input style=\"width: 100%\" type=\"text\" name=\"email\" value=\"$email\" /></td>
</tr>
<tr class=\"setup\">
<td class=\"setup\" width=\"35%\">
" . i18n
("Subject") . ":<br />
<small class=\"comment\">" . i18n
("The subject of the message") . "</small>
</td>
<td class=\"setup\" width=\"65%\"><input style=\"width: 100%\" type=\"text\" name=\"subject\" value=\"$subject\" /></td>
</tr>
<tr class=\"setup\">
<td class=\"setup\" colspan=\"2\"><textarea rows=\"10\" cols=\"70\" style=\"width: 100%\" name=\"message\">$message</textarea>
</td>
</tr>
<tr class=\"setup\">
<td colspan=\"2\">
<div class=\"wikicenteralign\">
<input type=\"submit\" name=\"send_email\" value=\"" . i18n
("Send email") . "\" />
<input type=\"reset\" value=\"" . i18n
("Reset") . "\" />
</div>
</td>
</tr>
</table>
</form>
";
}
} else {
$page_title = i18n
("##0##'s profile", array(i18n
("Unknown User")));
$tabwidget = new TabWidget
;
$tabwidget->tabbar->addTab(i18n
("View"), globalIDtoURL
("user/$viewUser") );
$tabwidget->tabbar->setCurrent(i18n
("View"));
if (isAllowed
("global_admin"))
$tabwidget->tabbar->addTab(i18n
("Add this user"), globalIDtoURL
("setup/users/new/$viewUser") );
$tabwidget->contents = "<p>" . i18n
("The user was not found on the system") . "</p>";
}
$page_content = $tabwidget->renderTabWidget();
break;
case "mypage":
$page_title = i18n
("My page") . " - " . getUserInfo
($viewUser, "name");
$tabwidget->tabbar->setCurrent(i18n
("My page"));
$currentuser = currentUser
();
if ($usermanager->userExists($viewUser)) {
if ($viewUser == $currentuser || userAllowsMypage
($viewUser)) {
if (($viewUser == $currentuser || isAllowed
("global_admin")) && ($_REQUEST["new_relationship"] == "neutral" && $usermanager->userExists($_REQUEST["changeuser"]))) {
setFriend
($viewUser, $_REQUEST["changeuser"], false);
setBlacklisted
($viewUser, $_REQUEST["changeuser"], false);
}
$filename = "$userinfo_folder/$viewUser/relationships.php";
if (file_exists($filename)) $relationships = fileGet
($filename);
$relationships = unserialize(substr($relationships, strpos($relationships, "\n") + 1));
if (count($relationships["friends"]) > 0) {
ksort($relationships["friends"]);
foreach($relationships["friends"] as $key => $value) {
$avatarfile = getAvatar
( $key );
$avatarthumbfile = getAvatarThumbnail
( $key );
list($avatarwidth,$avatarheight) = getAvatarThumbSize
( $key );
$avatarfile = siteURL
(true) . $avatarfile;
$avatarthumbfile = siteURL
(true) . $avatarthumbfile;
$temp_friends_data = "
<tr class=\"setup\">
<td class=\"setup\"><a href=\"$avatarfile\" target=\"_blank\"><img border=\"0\" class=\"profile_avatar\" src=\"$avatarthumbfile\" width=\"$avatarwidth\" height=\"$avatarheight\" alt=\"" . i18n
("##0##'s avatar", array(getUserInfo
($key, "name"))) . "\" /></a>
<strong>" . getUserInfo
($key, "name") . " ($key)</strong><br />";
if (userAllowsView
($key)) $temp_friends_data .= "<a class=\"command\" href=\"" . globalIDtoURL
( "user/$key" ) . "\">[" . i18n
("View profile") . "]</a><br />";
if (userAllowsContact
($key)) $temp_friends_data .= "<a class=\"command\" href=\"" . globalIDtoURL
( "user/$key/contact" ) . "\">[" . i18n
("Contact") . "]</a><br />";
$temp_friends_data .= "<br /><a class=\"command\" href=\"" . thisPageURL
( false, true, array( "page_id" => "13", "profile_mode" => "mypage", "user_id" => $viewUser, "changeuser" => $key, "new_relationship" => "neutral" ) ) . "\">[" . i18n
("Remove from friends list") . "]</a>
</td>
</tr>";
if (isFriend
($key, $_REQUEST["user_id"])) $mutual_friends_data .= $temp_friends_data;
else if (isBlacklisting
($key, $viewUser)) $black_friends_data .= $temp_friends_data;
else $neutral_friends_data .= $temp_friends_data;
}
$friends_data = "
<table class=\"setup\">
";
if ($mutual_friends_data != "") $friends_data .= "<th class=\"setup\">" . i18n
("Mutual friendships (I am marked as friend)") . "</th>$mutual_friends_data";
if ($neutral_friends_data != "") $friends_data .= "<th class=\"setup\">" . i18n
("Friendships (I am marked neutral)") . "</th>$neutral_friends_data";
if ($black_friends_data != "") $friends_data .= "<th class=\"setup\">" . i18n
("One-way friendships (I am blacklisted)") . "</th>$black_friends_data";
$friends_data .= "
</table>";
}
if (count($relationships["blacklists"]) > 0) {
ksort($relationships["blacklists"]);
foreach($relationships["blacklists"] as $key => $value) {
$avatarfile = getAvatar
( $key );
$avatarthumbfile = getAvatarThumbnail
( $key );
list($avatarwidth,$avatarheight) = getAvatarThumbSize
( $key );
$avatarfile = siteURL
(true) . $avatarfile;
$avatarthumbfile = siteURL
(true) . $avatarthumbfile;
$temp_blacklist_data .= "
<tr class=\"setup\">
<td class=\"setup\"><a href=\"$avatarfile\" target=\"_blank\"><img border=\"0\" class=\"profile_avatar\" src=\"$avatarthumbfile\" width=\"$avatarwidth\" height=\"$avatarheight\" alt=\"" . i18n
("##0##'s avatar", array(getUserInfo
($key, "name"))) . "\" /></a>
<strong>" . getUserInfo
($key, "name") . " ($key)</strong><br />
";
if (userAllowsView
($key)) $temp_blacklist_data .= "<a class=\"command\" href=\"" . globalIDtoURL
( "user/$key" ) . "\">[" . i18n
("View profile") . "]</a><br />";
if (userAllowsView
($key)) $temp_blacklist_data .= "<a class=\"command\" href=\"" . globalIDtoURL
( "user/$key/contact" ) . "\">[" . i18n
("Contact") . "]</a><br />";
$temp_blacklist_data .= "<br /><a class=\"command\" href=\"" . thisPageURL
( false, true, array( "page_id" => "13", "profile_mode" => "mypage", "user_id" => $_REQUEST["user_id"], "changeuser" => $key, "new_relationship" => "neutral" ) ) . "\">[" . i18n
("Remove from blacklist") . "]</a>
</td>
</tr>";
if (isFriend
($key, $viewUser)) $friend_blacklist_data .= $temp_blacklist_data;
else if (isBlacklisting
($key, $viewUser)) $mutual_blacklist_data .= $temp_blacklist_data;
else $neutral_blacklist_data .= $temp_blacklist_data;
}
$blacklist_data .= "
<table class=\"setup\">
";
if ($friend_blacklist_data != "") $blacklist_data .= "<th class=\"setup\">" . i18n
("Friendly towards me (I am marked as friend)") . "</th>$friend_blacklist_data";
if ($neutral_blacklist_data != "") $blacklist_data .= "<th class=\"setup\">" . i18n
("Neutral blacklisting (I am marked as neutral)") . "</th>$neutral_blacklist_data";
if ($mutual_blacklist_data != "") $blacklist_data .= "<th class=\"setup\">" . i18n
("Mutual blacklisting (I am blacklisted)") . "</th>$mutual_blacklist_data";
$blacklist_data .= "
</table>";
}
if ($friends_data == "" && $blacklist_data == "") $tabwidget->contents = "<p><em><strong>" . i18n
("Welcome to your page!") . "</strong></em></p><p>" . i18n
("This is your personal page. If you select people as friends or if you blacklist people, they will show up here. You can use this as a shortcut list for keeping track of people you like, or for don't like. Options for contacting them in various manners will show up here") . "</p>";
if ($friends_data == "") $friends_data = "<p class=\"comment\">" . i18n
("You have not yet found any friends on this website. You can set a person as a friend by clicking on the Friends button on a user's profile") . "</p>";
if ($blacklist_data == "") $blacklist_data = "<p class=\"comment\">" . i18n
("You have not blacklisted anyone. You can blacklist someone by clicking on the Blacklist button on a user's profile") . "</p>";
$tabwidget->contents .= "
<table class=\"setup\">
<tr class=\"setup\">
<th class=\"setup\" width=\"50%\">" . i18n
("My friends") . "</th>
<th class=\"setup\" width=\"50%\">" . i18n
("My blacklist") . "</th>
<tr>
<tr class=\"setup\">
<td class=\"setup\" valign=\"top\">$friends_data</td>
<td class=\"setup\" valign=\"top\">$blacklist_data</td>
</tr>
</table>";
}
if( getUserInfo
($viewUser, "profile") == i18n
("No ##0## information\n", array("profile")) || getUserInfo
($viewUser, "profile") == "" )
$tabwidget->contents = drawProfileHint
() . $tabwidget->contents;
} else {
$page_title = i18n
("##0##'s profile", array(i18n
("Unknown User")));
$tabwidget = new TabWidget
;
$tabwidget->tabbar->addTab(i18n
("View"), globalIDtoURL
("user/$viewUser") );
$tabwidget->tabbar->setCurrent(i18n
("View"));
if (isAllowed
("global_admin"))
$tabwidget->tabbar->addTab(i18n
("Add this user"), globalIDtoURL
( "setup/users/add/$viewUser" ) );
$tabwidget->contents = "<p>" . i18n
("The user was not found on the system") . "</p>";
}
$page_content = $tabwidget->renderTabWidget();
break;
case "view":
default:
$page_title = i18n
("##0##'s Profile", array(getUserInfo
($viewUser, "name")));
$tabwidget->tabbar->setCurrent(i18n
("View"));
if (!userAllowsView
($viewUser))
{
global $permissionlevels_array;
$tabwidget->contents = "<p>" . i18n
("The user has decided you are not allowed to view this page. The user has selected that only the following people can view their profile") . ":<br /><b>" . $permissionlevels_array[getUserInfo
($viewUser, "profiles_view")] . "</b></p>";
}
else
{
if ($usermanager->userExists($viewUser))
{
$avatarfile = getAvatar
( $viewUser );
$avatarthumbfile = getAvatarThumbnail
( $viewUser );
list($avatarwidth,$avatarheight) = getAvatarThumbSize
( $viewUser );
$avatarfile = siteURL
(true) . $avatarfile;
$avatarthumbfile = siteURL
(true) . $avatarthumbfile;
if( $avatarfile == getAvatar
( "\\noone\\" ) || getUserInfo
($viewUser, "profile") == i18n
("No ##0## information\n", array("profile")) || getUserInfo
($viewUser, "profile") == "" )
$tabwidget->contents = drawProfileHint
();
else
$tabwidget->contents = "<a href=\"$avatarfile\" target=\"_blank\"><img border=\"0\" class=\"profile_avatar\" src=\"$avatarthumbfile\" width=\"$avatarwidth\" height=\"$avatarheight\" alt=\"" . i18n
("##0##'s avatar", array(getUserInfo
($viewUser, "name"))) . "\" /></a>" . parse_page_data
(getUserInfo
($viewUser, "profile", ""));
if (isAuth
() && ($viewUser != currentUser
()))
{
if ($_REQUEST["new_relationship"] != "")
{
switch ($_REQUEST["new_relationship"])
{
case "friend":
setFriend
(currentUser
(), $viewUser, true);
setBlacklisted
(currentUser
(), $viewUser, false);
break;
case "blacklist":
setFriend
(currentUser
(), $viewUser, false);
setBlacklisted
(currentUser
(), $viewUser, true);
break;
case "neutral":
default:
setFriend
(currentUser
(), $viewUser, false);
setBlacklisted
(currentUser
(), $viewUser, false);
}
}
if (isFriend
(currentUser
(), $viewUser))
{
$tabwidget->addCommand(i18n
("##0## Friend", array("<img style=\"vertical-align: middle;\" border=\"0\" src=\"" . siteURL
(true) . "$setup_folder/images/selection-on.png\" width=\"10\" height=\"10\" alt=\"x\" />")), i18n
("This user is your friend!"), thisPageURL
( false, true, array( "new_relationship" => "friend" ) ) );
$tabwidget->addCommand(i18n
("##0## Neutral", array("<img style=\"vertical-align: middle;\" border=\"0\" src=\"" . siteURL
(true) . "$setup_folder/images/selection-off.png\" width=\"10\" height=\"10\" alt=\"o\" />")), i18n
("Set this user as neutral"), thisPageURL
( false, true, array( "new_relationship" => "neutral" ) ) );
$tabwidget->addCommand(i18n
("##0## Blacklisted", array("<img style=\"vertical-align: middle;\" border=\"0\" src=\"" . siteURL
(true) . "$setup_folder/images/selection-off.png\" width=\"10\" height=\"10\" alt=\"o\" />")), i18n
("Set this user as blacklisted"), thisPageURL
( false, true, array( "new_relationship" => "blacklist" ) ) );
}
else if (isBlacklisting
(currentUser
(), $viewUser))
{
$tabwidget->addCommand(i18n
("##0## Friend", array("<img style=\"vertical-align: middle;\" border=\"0\" src=\"" . siteURL
(true) . "$setup_folder/images/selection-off.png\" width=\"10\" height=\"10\" alt=\"o\" />")), i18n
("Set this user as your friend"), thisPageURL
( false, true, array( "new_relationship" => "friend" ) ) );
$tabwidget->addCommand(i18n
("##0## Neutral", array("<img style=\"vertical-align: middle;\" border=\"0\" src=\"" . siteURL
(true) . "$setup_folder/images/selection-off.png\" width=\"10\" height=\"10\" alt=\"o\" />")), i18n
("Set this user as neutral"), thisPageURL
( false, true, array( "new_relationship" => "neutral" ) ) );
$tabwidget->addCommand(i18n
("##0## Blacklisted", array("<img style=\"vertical-align: middle;\" border=\"0\" src=\"" . siteURL
(true) . "$setup_folder/images/selection-on.png\" width=\"10\" height=\"10\" alt=\"x\" />")), i18n
("You have blacklisted this user"), thisPageURL
( false, true, array( "new_relationship" => "blacklist" ) ) );
}
else
{
$tabwidget->addCommand(i18n
("##0## Friend", array("<img style=\"vertical-align: middle;\" border=\"0\" src=\"" . siteURL
(true) . "$setup_folder/images/selection-off.png\" width=\"10\" height=\"10\" alt=\"o\" />")), i18n
("Set this user as your friend"), thisPageURL
( false, true, array( "new_relationship" => "friend" ) ) );
$tabwidget->addCommand(i18n
("##0## Neutral", array("<img style=\"vertical-align: middle;\" border=\"0\" src=\"" . siteURL
(true) . "$setup_folder/images/selection-on.png\" width=\"10\" height=\"10\" alt=\"x\" />")), i18n
("This user is neutral to you"), thisPageURL
( false, true, array( "new_relationship" => "neutral" ) ) );
$tabwidget->addCommand(i18n
("##0## Blacklisted", array("<img style=\"vertical-align: middle;\" border=\"0\" src=\"" . siteURL
(true) . "$setup_folder/images/selection-off.png\" width=\"10\" height=\"10\" alt=\"o\" />")), i18n
("Set this user as blacklisted"), thisPageURL
( false, true, array( "new_relationship" => "blacklist" ) ) );
}
}
}
else
{
$tabwidget = new TabWidget
;
$tabwidget->tabbar->addTab(i18n
("View"), globalIDtoURL
( "user/$viewUser" ) );
$tabwidget->tabbar->setCurrent(i18n
("View"));
if (isAllowed
("global_admin"))
$tabwidget->tabbar->addTab(i18n
("Add this user"), globalIDtoURL
( "setup/users/new/$viewUser" ) );
$tabwidget->contents = "<p>" . i18n
("The user was not found on the system") . "</p>";
}
}
$tabwidget->contents = $tabwidget->contents;
$page_content = $tabwidget->renderTabWidget();
}
?>