00001 <?PHP
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 $page_author = $owner_name;
00018 $page_author_email = $owner_email;
00019 $page_date = formatTime( time() );
00020
00021 $page_menu = $profile_options["profiles_menu"];
00022
00031 function drawProfileHint()
00032 {
00033 global $viewUser;
00034 if( $_REQUEST["profile_mode"] == "mypage" || $_REQUEST["profile_mode"] == "view" || $_REQUEST["profile_mode"] == "" )
00035 {
00036 $avatarfile = getAvatar( $viewUser );
00037 $avatarthumbfile = getAvatarThumbnail( $viewUser );
00038 list($avatarwidth,$avatarheight) = getAvatarThumbSize( $viewUser );
00039 $avatarfile = siteURL(true) . $avatarfile;
00040 $avatarthumbfile = siteURL(true) . $avatarthumbfile;
00041 if( currentUser() == $viewUser )
00042 {
00043 if( getAvatar( $viewUser ) == getAvatar() )
00044 $infoAvatar = i18n("**Show yourself!**") . "\n" .
00045 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>>" .
00046 drawCommand(i18n("User avatar ##0##", array("»")), i18n("User avatar selection"), globalIDtoURL("user/$viewUser/edit/user_avatar") );
00047 ;
00048 if( getUserInfo($viewUser, "profile") == i18n("No ##0## information\n", array("profile")) || getUserInfo($viewUser, "profile") == "" )
00049 $infoProfile = i18n("**Make yourself known!**") . "\n" .
00050 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>>" .
00051 drawCommand(i18n("Profile ##0##", array("»")), i18n("Profile text editor"), globalIDtoURL("user/$viewUser/edit/profile") );
00052 ;
00053
00054 if( $infoProfile != "" && $infoAvatar != "" )
00055 $infoAvatar .= "\n---\n";
00056
00057 $infoBox = renderInformationBox( i18n("What's next?"), $infoAvatar . $infoProfile);
00058 }
00059 else
00060 $infoBox = renderInformationBox( i18n("No profile information"), i18n("This user has not yet entered any profile information") );
00061
00062 if( $_REQUEST["profile_mode"] == "view" || $_REQUEST["profile_mode"] == "" )
00063 $data = "
00064 <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>
00065 ";
00066 $data .= $infoBox;
00067 }
00068 return $data;
00069 }
00070
00071 $tabwidget = new TabWidget;
00072
00073 if ($viewUser == currentUser() || isAllowed("global_admin")) $tabwidget->tabbar->addTab(i18n("My page"), globalIDtoURL("user/$viewUser/mypage") );
00074 $tabwidget->tabbar->addTab(i18n("View"), globalIDtoURL("user/$viewUser") );
00075
00076 foreach ($profilemodules as $key => $value)
00077 if( userIsAllowed( $viewUser, "profile_" . substr($value, 14) ) )
00078 $tabwidget->tabbar->addTab(i18n(substr($value, 14)), globalIDtoURL("user/$viewUser/" . substr($value, 14)));
00079 $tabwidget->tabbar->addTab(i18n("Contact"), globalIDtoURL("user/$viewUser/contact") );
00080 if( profileEditAllowed($viewUser) )
00081 $tabwidget->tabbar->addTab(i18n("Edit"), globalIDtoURL("user/$viewUser/edit") );
00082
00083 if ($_REQUEST["module"] != "") $_REQUEST["profile_mode"] = "module";
00084
00085 switch ($_REQUEST["profile_mode"]) {
00086 case "new":
00087 $page_title = i18n("Register a new user");
00088 if (!isAllowed("global_user_new")) {
00089 $page_content = i18n("You do not have the correct priviledges to create a new user.");
00090 }
00091 else
00092 {
00093 $panel = new optionsPanel("newUser");
00094 $panel->showHeader = false;
00095 $panel->saveTitle = i18n("Register and log in");
00096 $panel->revertTitle = i18n("Reset");
00097
00098 $panel->addOption( i18n("Username:"), i18n("All lower case, no spaces or special characters, for example johndoe"), "", "username", "text");
00099 $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" );
00100 $panel->addOption( i18n("Repeat password:"), "", "", "password2", "password" );
00101 $panel->addOption( i18n("Full name:"), i18n("Your full name, for example John Doe"), "", "fullname", "text" );
00102 $panel->addOption( i18n("Email address:"), i18n("The email address you wish to use, for example johndoe@site.com"), "", "email", "text" );
00103
00104 $errorFound = false;
00105
00106 if( $panel->submitted )
00107 {
00108 if( $panel->options["username"]["current"] == "" )
00109 { $errorFound = true; $panel->options["username"]["error"] = i18n("Your must enter a username!"); }
00110 if( strpos( $panel->options["username"]["current"], " " ) )
00111 { $errorFound = true; $panel->options["username"]["error"] = i18n("Your username cannot contain spaces!"); }
00112 if( $usermanager->userExists( strtolower( $panel->options["username"]["current"] ) ) )
00113 { $errorFound = true; $panel->options["username"]["error"] = i18n("A user with this username already exists!"); }
00114 if( $panel->options["password"]["current"] == "" )
00115 { $errorFound = true; $panel->options["password"]["error"] = i18n("Your must enter a password!"); }
00116 if( $panel->options["password"]["current"] != $panel->options["password2"]["current"] )
00117 { $errorFound = true; $panel->options["password2"]["error"] = i18n("The passwords must match!"); }
00118 if( $panel->options["fullname"]["current"] == "" )
00119 { $errorFound = true; $panel->options["fullname"]["error"] = i18n("Your must enter a full name!"); }
00120 if( $panel->options["email"]["current"] == "" )
00121 { $errorFound = true; $panel->options["email"]["error"] = i18n("Your must enter an email address!"); }
00122 if( ! validateEmail( $panel->options["email"]["current"] ) )
00123 { $errorFound = true; $panel->options["email"]["error"] = i18n("Your must enter a valid email address!"); }
00124 }
00125
00126 if( $panel->submitted && ! $errorFound )
00127 {
00128 $newUsername = strtolower($panel->options["username"]["current"]);
00129 $usermanager->changeadd($newUsername, $panel->options["password"]["current"], "setup/password.txt");
00130 saveUserInfo($newUsername, "name", $panel->options["fullname"]["current"]);
00131 saveUserInfo($newUsername, "email", $panel->options["email"]["current"]);
00132
00133 if( !isAuth() )
00134 {
00135 auth($newUsername, $_REQUEST['new_password']);
00136 header("Location: " . globalIDtoURL( "user/$newUsername/mypage") );
00137 }
00138 else
00139 {
00140 if( isAllowed("global_user_edit") )
00141 $userSetup = drawCommand( i18n("User setup"), i18n("Go to User Setup"), globalIDtoURL("setup/users") );
00142 $page_content = renderInformationBox( i18n("User created"),
00143 i18n("The user was successfully created. The details are as follows (this message has also been emailed to the new user):##0##",
00144 array("\n" .
00145 i18n("Username: ##0##", array($newUsername)) . "\n" .
00146 i18n("Password: ##0##", array($panel->options["password"]["current"])) . "\n" .
00147 i18n("Full name: ##0##", array($panel->options["fullname"]["current"])) . "\n" .
00148 i18n("Email: ##0##", array($panel->options["email"]["current"])) . "\n"
00149 )
00150 ) . "\n---\n" .
00151 i18n("You now have the following choices:") . "\n" .
00152 drawCommand(i18n("Create user"), i18n("Create another user"), globalIDtoURL("user/" . i18n("username") . "/new")) . " " .
00153 drawCommand(i18n("Edit ##0##", array($panel->options["fullname"]["current"])), i18n("Edit the new user's details"), globalIDtoURL("user/$newUsername/edit")) . " " .
00154 drawCommand(i18n("Front page"), i18n("Go to the front page"), globalIDtoURL("content/$language/0")) . " $userSetup"
00155 );
00156 }
00157 }
00158 else
00159 {
00160 $page_content = "
00161 <form action=\"" . globalIDtoURL( "user/" . i18n("username") . "/new" ) . "\" method=\"post\">
00162 " . renderInformationBox( i18n("Register"), i18n("Please type in the login information you wish to use in the fields below.") . $panel->render(), false ) . "
00163 </form>
00164 ";
00165 }
00166 }
00167 break;
00168 case "module":
00169 if ($usermanager->userExists($viewUser)) {
00170 $page_title = i18n("##0##'s ##1##", array(getUserInfo($viewUser, "name"), i18n(substr(htmlspecialchars($_REQUEST["module"]), 14))));
00171 $tabwidget->tabbar->setCurrent(i18n(substr($_REQUEST["module"], 14)));
00172 if (!userAllowsView($viewUser)) {
00173 global $permissionlevels_array;
00174 $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>";
00175 } else {
00176 $tabwidget->contents = $_REQUEST["module"]();
00177 }
00178 } else {
00179 $page_title = i18n("##0##'s profile", array(i18n("Unknown User")));
00180 $tabwidget = new TabWidget;
00181 $tabwidget->tabbar->addTab(i18n("View"), globalIDtoURL("user/$viewUser") );
00182 $tabwidget->tabbar->setCurrent(i18n("View"));
00183 if (isAllowed("global_admin"))
00184 $tabwidget->tabbar->addTab(i18n("Add this user"), globalIDtoURL("setup/users/new/$viewUser") );
00185 $tabwidget->contents = "<p>" . i18n("The user was not found on the system") . "</p>";
00186 }
00187 if ($_REQUEST["theme"] == "empty") {
00188 $page_content = $tabwidget->contents;
00189 } else {
00190 $page_content = $tabwidget->renderTabWidget();
00191 }
00192 break;
00193 case "edit":
00194 if ($usermanager->userExists($viewUser)) {
00195 include("profiles_edit.php");
00196 } else {
00197 $page_title = i18n("##0##'s profile", array(i18n("Unknown User")));
00198 $tabwidget = new TabWidget;
00199 $tabwidget->tabbar->addTab(i18n("View"), globalIDtoURL("user/$viewUser") );
00200 $tabwidget->tabbar->setCurrent(i18n("View"));
00201 if (isAllowed("global_admin")) $tabwidget->tabbar->addTab(i18n("Add this user"), globalIDtoURL("setup/users/new/$viewUser") );
00202 $tabwidget->contents = "<p>" . i18n("The user was not found on the system") . "</p>";
00203 $page_content = $tabwidget->renderTabWidget();
00204 }
00205 break;
00206 case "contact":
00207 if ($usermanager->userExists($viewUser)) {
00208 $page_title = i18n("Contact ##0##", array(getUserInfo($viewUser, "name")));
00209 $tabwidget->tabbar->setCurrent(i18n("Contact"));
00210 if (!userAllowsContact($viewUser)) {
00211 global $permissionlevels_array;
00212 $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>";
00213 } else {
00214 $tabwidget->contents = "
00215 <h2>" . i18n("Contact information") . "</h2>";
00216
00217 if ($_REQUEST["send_email"]) {
00218 if ($_REQUEST["email"] != "" && validateEmail($_REQUEST["email"]) && $_REQUEST["subject"] != "" && $_REQUEST["message"] != "") {
00219 if (!$_SESSION["email_sent_time"] OR (time() - $_SESSION["email_sent_time"]) > 15) {
00220 if (mail(getUserInfo($viewUser, "email"), stripslashes($_REQUEST["subject"]), stripslashes($_REQUEST["message"]), "From: " . stripslashes($_REQUEST["email"]) . "\r\n" . "X-Mailer: PHP/" . phpversion())) {
00221 $_SESSION["email_sent_time"] = time();
00222 $tabwidget->contents .= renderInformationBox( i18n("Success!"), i18n("The email was sent successfully!") );
00223 } else {
00224 $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.") );
00225 }
00226 } else {
00227 $tabwidget->contents .= renderInformationBox( i18n("Timeout error!"), i18n("You have attempted to send another email before 15 seconds passed since the last message was sent.") );
00228 }
00229 } else {
00230 if (!validateEmail($_REQUEST["email"])) {
00231 $tabwidget->contents .= renderInformationBox( i18n("Not an email address"), i18n("The email address was filled in wrongly! Please correct this and try again.") );
00232 } else {
00233 $tabwidget->contents .= renderInformationBox( i18n("Required fields"), i18n("All fields were not filled out! Please correct this and try again.") );
00234 }
00235 }
00236 }
00237
00238 $contact_content = "
00239 <table class=\"setup\">
00240 <tr class=\"setup\">
00241 <th class=\"setup\" width=\"50%\">" . i18n("Contact type and description") . "</th>
00242 <th class=\"setup\" width=\"50%\">" . i18n("Contact detail (click on icon to activate)") . "</th>
00243 </tr>";
00244
00245 $contactinfo = unserialize(getUserInfo($viewUser, "contactinfo"));
00246 if (is_array($contactinfo)) {
00247 foreach($contactinfo as $key => $value) {
00248 if ($value) {
00249 $url = str_replace("$$", $value, $profile_options["contact_fields"][$key]["url"]);
00250 $temp_contact_content .= "
00251 <tr class=\"setup\"><td class=\"setup\">
00252 <p class=\"profile_contactitem\">$key:<br /><small class=\"comment\">" . $profile_options["contact_fields"][$key]["description"] . "</small></p>
00253 </td><td class=\"setup\">
00254 <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>
00255 <p class=\"profile_contactitem\">$value</p>
00256 </td></tr>";
00257 }
00258 }
00259 }
00260 if ($temp_contact_content == "")
00261 $contact_content = "<table class=\"setup\"><tr class=\"setup\"><td class=\"setup\">
00262 " . renderInformationBox(
00263 i18n("No contact information"),
00264 i18n("There was not found any direct contact information, however you can still send messages from the site using the form below.")
00265 ) . "
00266 </td></tr>";
00267 else
00268 $contact_content .= $temp_contact_content;
00269
00270 $tabwidget->contents .= "$contact_content
00271 </table>
00272 <h2>" . i18n("Email") . "</h2>
00273 <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>
00274 <form action=\"" . globalIDtoURL( "user/$viewUser/contact" ) . "\" method=\"post\">
00275 <table class=\"setup\">
00276 <tr class=\"setup\">
00277 <td class=\"setup\" width=\"35%\">
00278 " . i18n("From") . ":<br />
00279 <small class=\"comment\">" . i18n("Your email, in the following format: johndoe@somesite.com") . "</small>
00280 </td>
00281 <td class=\"setup\" width=\"65%\"><input style=\"width: 100%\" type=\"text\" name=\"email\" value=\"{$_REQUEST['email']}\" /></td>
00282 </tr>
00283 <tr class=\"setup\">
00284 <td class=\"setup\" width=\"35%\">
00285 " . i18n("Subject") . ":<br />
00286 <small class=\"comment\">" . i18n("The subject of the message") . "</small>
00287 </td>
00288 <td class=\"setup\" width=\"65%\"><input style=\"width: 100%\" type=\"text\" name=\"subject\" value=\"" . stripslashes($_REQUEST['subject']) . "\" /></td>
00289 </tr>
00290 <tr class=\"setup\">
00291 <td class=\"setup\" colspan=\"2\"><textarea rows=\"10\" cols=\"70\" style=\"width: 100%\" name=\"message\">" . stripslashes($_REQUEST['message']) . "</textarea>
00292 </td>
00293 </tr>
00294 <tr class=\"setup\">
00295 <td colspan=\"2\">
00296 <div class=\"wikicenteralign\">
00297 <input type=\"submit\" name=\"send_email\" value=\"" . i18n("Send email") . "\" />
00298 <input type=\"reset\" value=\"" . i18n("Reset") . "\" />
00299 </div>
00300 </td>
00301 </tr>
00302 </table>
00303 </form>
00304 ";
00305 }
00306 } else {
00307 $page_title = i18n("##0##'s profile", array(i18n("Unknown User")));
00308 $tabwidget = new TabWidget;
00309 $tabwidget->tabbar->addTab(i18n("View"), globalIDtoURL("user/$viewUser") );
00310 $tabwidget->tabbar->setCurrent(i18n("View"));
00311 if (isAllowed("global_admin"))
00312 $tabwidget->tabbar->addTab(i18n("Add this user"), globalIDtoURL("setup/users/new/$viewUser") );
00313 $tabwidget->contents = "<p>" . i18n("The user was not found on the system") . "</p>";
00314 }
00315 $page_content = $tabwidget->renderTabWidget();
00316 break;
00317 case "mypage":
00318 $page_title = i18n("My page") . " - " . getUserInfo($viewUser, "name");
00319 $tabwidget->tabbar->setCurrent(i18n("My page"));
00320 $currentuser = currentUser();
00321 if ($usermanager->userExists($viewUser)) {
00322 if ($viewUser == $currentuser || userAllowsMypage($viewUser)) {
00323 if (($viewUser == $currentuser || isAllowed("global_admin")) && ($_REQUEST["new_relationship"] == "neutral" && $usermanager->userExists($_REQUEST["changeuser"]))) {
00324 setFriend($viewUser, $_REQUEST["changeuser"], false);
00325 setBlacklisted($viewUser, $_REQUEST["changeuser"], false);
00326 }
00327
00328 $filename = "$userinfo_folder/$viewUser/relationships.php";
00329 if (file_exists($filename)) $relationships = file_get_contents($filename);
00330 $relationships = unserialize(substr($relationships, strpos($relationships, "\n") + 1));
00331
00332
00333 if (count($relationships["friends"]) > 0) {
00334 ksort($relationships["friends"]);
00335 foreach($relationships["friends"] as $key => $value) {
00336 $avatarfile = getAvatar( $key );
00337 $avatarthumbfile = getAvatarThumbnail( $key );
00338 list($avatarwidth,$avatarheight) = getAvatarThumbSize( $key );
00339 $avatarfile = siteURL(true) . $avatarfile;
00340 $avatarthumbfile = siteURL(true) . $avatarthumbfile;
00341
00342 $temp_friends_data = "
00343 <tr class=\"setup\">
00344 <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>
00345 <strong>" . getUserInfo($key, "name") . " ($key)</strong><br />";
00346 if (userAllowsView($key)) $temp_friends_data .= "<a class=\"command\" href=\"" . globalIDtoURL( "user/$key" ) . "\">[" . i18n("View profile") . "]</a><br />";
00347 if (userAllowsContact($key)) $temp_friends_data .= "<a class=\"command\" href=\"" . globalIDtoURL( "user/$key/contact" ) . "\">[" . i18n("Contact") . "]</a><br />";
00348 $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>
00349 </td>
00350 </tr>";
00351 if (isFriend($key, $_REQUEST["user_id"])) $mutual_friends_data .= $temp_friends_data;
00352 else if (isBlacklisting($key, $viewUser)) $black_friends_data .= $temp_friends_data;
00353 else $neutral_friends_data .= $temp_friends_data;
00354 }
00355
00356 $friends_data = "
00357 <table class=\"setup\">
00358 ";
00359 if ($mutual_friends_data != "") $friends_data .= "<th class=\"setup\">" . i18n("Mutual friendships (I am marked as friend)") . "</th>$mutual_friends_data";
00360 if ($neutral_friends_data != "") $friends_data .= "<th class=\"setup\">" . i18n("Friendships (I am marked neutral)") . "</th>$neutral_friends_data";
00361 if ($black_friends_data != "") $friends_data .= "<th class=\"setup\">" . i18n("One-way friendships (I am blacklisted)") . "</th>$black_friends_data";
00362 $friends_data .= "
00363 </table>";
00364 }
00365
00366 if (count($relationships["blacklists"]) > 0) {
00367 ksort($relationships["blacklists"]);
00368 foreach($relationships["blacklists"] as $key => $value) {
00369 $avatarfile = getAvatar( $key );
00370 $avatarthumbfile = getAvatarThumbnail( $key );
00371 list($avatarwidth,$avatarheight) = getAvatarThumbSize( $key );
00372 $avatarfile = siteURL(true) . $avatarfile;
00373 $avatarthumbfile = siteURL(true) . $avatarthumbfile;
00374
00375 $temp_blacklist_data .= "
00376 <tr class=\"setup\">
00377 <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>
00378 <strong>" . getUserInfo($key, "name") . " ($key)</strong><br />
00379 ";
00380 if (userAllowsView($key)) $temp_blacklist_data .= "<a class=\"command\" href=\"" . globalIDtoURL( "user/$key" ) . "\">[" . i18n("View profile") . "]</a><br />";
00381 if (userAllowsView($key)) $temp_blacklist_data .= "<a class=\"command\" href=\"" . globalIDtoURL( "user/$key/contact" ) . "\">[" . i18n("Contact") . "]</a><br />";
00382 $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>
00383 </td>
00384 </tr>";
00385 if (isFriend($key, $viewUser)) $friend_blacklist_data .= $temp_blacklist_data;
00386 else if (isBlacklisting($key, $viewUser)) $mutual_blacklist_data .= $temp_blacklist_data;
00387 else $neutral_blacklist_data .= $temp_blacklist_data;
00388 }
00389 $blacklist_data .= "
00390 <table class=\"setup\">
00391 ";
00392 if ($friend_blacklist_data != "") $blacklist_data .= "<th class=\"setup\">" . i18n("Friendly towards me (I am marked as friend)") . "</th>$friend_blacklist_data";
00393 if ($neutral_blacklist_data != "") $blacklist_data .= "<th class=\"setup\">" . i18n("Neutral blacklisting (I am marked as neutral)") . "</th>$neutral_blacklist_data";
00394 if ($mutual_blacklist_data != "") $blacklist_data .= "<th class=\"setup\">" . i18n("Mutual blacklisting (I am blacklisted)") . "</th>$mutual_blacklist_data";
00395 $blacklist_data .= "
00396 </table>";
00397 }
00398
00399 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>";
00400 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>";
00401 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>";
00402 $tabwidget->contents .= "
00403 <table class=\"setup\">
00404 <tr class=\"setup\">
00405 <th class=\"setup\" width=\"50%\">" . i18n("My friends") . "</th>
00406 <th class=\"setup\" width=\"50%\">" . i18n("My blacklist") . "</th>
00407 <tr>
00408 <tr class=\"setup\">
00409 <td class=\"setup\" valign=\"top\">$friends_data</td>
00410 <td class=\"setup\" valign=\"top\">$blacklist_data</td>
00411 </tr>
00412 </table>";
00413 }
00414
00415 if( getUserInfo($viewUser, "profile") == i18n("No ##0## information\n", array("profile")) || getUserInfo($viewUser, "profile") == "" )
00416 $tabwidget->contents = drawProfileHint() . $tabwidget->contents;
00417 } else {
00418 $page_title = i18n("##0##'s profile", array(i18n("Unknown User")));
00419 $tabwidget = new TabWidget;
00420 $tabwidget->tabbar->addTab(i18n("View"), globalIDtoURL("user/$viewUser") );
00421 $tabwidget->tabbar->setCurrent(i18n("View"));
00422 if (isAllowed("global_admin"))
00423 $tabwidget->tabbar->addTab(i18n("Add this user"), globalIDtoURL( "setup/users/add/$viewUser" ) );
00424 $tabwidget->contents = "<p>" . i18n("The user was not found on the system") . "</p>";
00425 }
00426 $page_content = $tabwidget->renderTabWidget();
00427 break;
00428 case "view":
00429 default:
00430 $page_title = i18n("##0##'s Profile", array(getUserInfo($viewUser, "name")));
00431 $tabwidget->tabbar->setCurrent(i18n("View"));
00432 if (!userAllowsView($viewUser))
00433 {
00434 global $permissionlevels_array;
00435 $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>";
00436 }
00437 else
00438 {
00439 if ($usermanager->userExists($viewUser))
00440 {
00441 $avatarfile = getAvatar( $viewUser );
00442 $avatarthumbfile = getAvatarThumbnail( $viewUser );
00443 list($avatarwidth,$avatarheight) = getAvatarThumbSize( $viewUser );
00444 $avatarfile = siteURL(true) . $avatarfile;
00445 $avatarthumbfile = siteURL(true) . $avatarthumbfile;
00446
00447 if( $avatarfile == getAvatar( "\\noone\\" ) || getUserInfo($viewUser, "profile") == i18n("No ##0## information\n", array("profile")) || getUserInfo($viewUser, "profile") == "" )
00448 $tabwidget->contents = drawProfileHint();
00449 else
00450 $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", ""));
00451
00452 if (isAuth() && ($viewUser != currentUser()))
00453 {
00454 if ($_REQUEST["new_relationship"] != "")
00455 {
00456 switch ($_REQUEST["new_relationship"])
00457 {
00458 case "friend":
00459 setFriend(currentUser(), $viewUser, true);
00460 setBlacklisted(currentUser(), $viewUser, false);
00461 break;
00462 case "blacklist":
00463 setFriend(currentUser(), $viewUser, false);
00464 setBlacklisted(currentUser(), $viewUser, true);
00465 break;
00466 case "neutral":
00467 default:
00468 setFriend(currentUser(), $viewUser, false);
00469 setBlacklisted(currentUser(), $viewUser, false);
00470
00471 }
00472 }
00473 if (isFriend(currentUser(), $viewUser))
00474 {
00475 $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" ) ) );
00476 $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" ) ) );
00477 $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" ) ) );
00478 }
00479 else if (isBlacklisting(currentUser(), $viewUser))
00480 {
00481 $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" ) ) );
00482 $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" ) ) );
00483 $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" ) ) );
00484 }
00485 else
00486 {
00487 $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" ) ) );
00488 $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" ) ) );
00489 $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" ) ) );
00490 }
00491 }
00492 }
00493 else
00494 {
00495 $tabwidget = new TabWidget;
00496 $tabwidget->tabbar->addTab(i18n("View"), globalIDtoURL( "user/$viewUser" ) );
00497 $tabwidget->tabbar->setCurrent(i18n("View"));
00498 if (isAllowed("global_admin"))
00499 $tabwidget->tabbar->addTab(i18n("Add this user"), globalIDtoURL( "setup/users/new/$viewUser" ) );
00500 $tabwidget->contents = "<p>" . i18n("The user was not found on the system") . "</p>";
00501 }
00502 }
00503 $tabwidget->contents = $tabwidget->contents;
00504 $page_content = $tabwidget->renderTabWidget();
00505 }
00506
00507 ?>