Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
831 florian 1
<?php
2
 
3
////////////////////////////////////////////////////////////////////////////////
4
//                                                                            //
5
//   Copyright (C) 2006  Phorum Development Team                              //
6
//   http://www.phorum.org                                                    //
7
//                                                                            //
8
//   This program is free software. You can redistribute it and/or modify     //
9
//   it under the terms of either the current Phorum License (viewable at     //
10
//   phorum.org) or the Phorum License that was distributed with this file    //
11
//                                                                            //
12
//   This program is distributed in the hope that it will be useful,          //
13
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
14
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
15
//                                                                            //
16
//   You should have received a copy of the Phorum License                    //
17
//   along with this program.                                                 //
18
////////////////////////////////////////////////////////////////////////////////
19
define('phorum_page','profile');
20
 
21
include_once("./common.php");
22
include_once("./include/email_functions.php");
23
include_once("./include/format_functions.php");
24
 
25
// set all our URL's
26
phorum_build_common_urls();
27
 
28
$template = "profile";
29
$error = "";
30
 
31
// redirect if no profile id passed
32
if(!empty($PHORUM["args"][1])){
33
    $profile_id = (int)$PHORUM["args"][1];
34
}
35
 
36
if(empty($PHORUM["args"][1]) || empty($profile_id)){
37
    phorum_redirect_by_url(phorum_get_url(PHORUM_INDEX_URL));
38
    exit();
39
}
40
 
41
include_once("./include/users.php");
42
 
43
$user = phorum_user_get($profile_id);
44
 
45
if(!is_array($user) || $user["active"]==0) {
46
    $PHORUM["DATA"]["ERROR"]=$PHORUM["DATA"]["LANG"]["UnknownUser"];
47
    $PHORUM['DATA']["URL"]["REDIRECT"]=phorum_get_url(PHORUM_LIST_URL);
48
    $PHORUM['DATA']["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToList"];
49
 
50
    // have to include the header here for the Redirect
51
    include phorum_get_template("header");
52
    phorum_hook("after_header");
53
    include phorum_get_template("message");
54
    phorum_hook("before_footer");
55
    include phorum_get_template("footer");
56
    return;
57
}
58
 
59
// security messures
60
unset($user["password"]);
61
unset($user["permissions"]);
62
 
63
// set any custom profile fields that are not present.
64
if (!empty($PHORUM["PROFILE_FIELDS"])) {
65
    foreach($PHORUM["PROFILE_FIELDS"] as $field) {
66
        if (!isset($user[$field['name']])) $user[$field['name']] = "";
67
    }
68
}
69
 
70
$PHORUM["DATA"]["PROFILE"] = $user;
71
$PHORUM["DATA"]["PROFILE"]["forum_id"] = $PHORUM["forum_id"];
72
 
73
$PHORUM["DATA"]["PROFILE"]["date_added"]=phorum_date( $PHORUM['short_date'], $PHORUM["DATA"]["PROFILE"]["date_added"]);
74
 
75
if( !empty($PHORUM["user"]["admin"]) ||
76
    (phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES) && PHORUM_MOD_EMAIL_VIEW) ||
77
    (phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_USERS) && PHORUM_MOD_EMAIL_VIEW) ||
78
    !$user["hide_email"]){
79
 
80
    $PHORUM["DATA"]["PROFILE"]["email"]=phorum_html_encode($user["email"]);
81
} else {
82
    $PHORUM["DATA"]["PROFILE"]["email"] = $PHORUM["DATA"]["LANG"]["Hidden"];
83
}
84
 
85
if( $PHORUM["track_user_activity"] &&
86
    (!empty($PHORUM["user"]["admin"]) ||
87
     (phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES)) ||
88
     (phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_USERS)) ||
89
     !$user["hide_activity"])){
90
 
91
    $PHORUM["DATA"]["PROFILE"]["date_last_active"]=phorum_date( $PHORUM['short_date'], $PHORUM["DATA"]["PROFILE"]["date_last_active"]);
92
} else {
93
    unset($PHORUM["DATA"]["PROFILE"]["date_last_active"]);
94
}
95
 
96
$PHORUM["DATA"]["PROFILE"]["posts"]=number_format($PHORUM["DATA"]["PROFILE"]["posts"]);
97
 
98
$PHORUM["DATA"]["PROFILE"]["pm_url"] = phorum_get_url(PHORUM_PM_URL, "page=send", "to_id=".urlencode($user["user_id"]));
99
$PHORUM["DATA"]["PROFILE"]["pm_addbuddy_url"] = phorum_get_url(PHORUM_PM_URL, "page=buddies", "action=addbuddy", "addbuddy_id=".urlencode($user["user_id"]));
100
$PHORUM["DATA"]["PROFILE"]["is_buddy"] = phorum_db_pm_is_buddy($user["user_id"]);
101
// unset($PHORUM["DATA"]["PROFILE"]["signature"]);
102
 
103
$PHORUM["DATA"]["PROFILE"]["username"] = htmlspecialchars($PHORUM["DATA"]["PROFILE"]["username"]);
104
 
105
$PHORUM["DATA"]["PROFILE"] = phorum_hook("profile", $PHORUM["DATA"]["PROFILE"]);
106
 
107
// set all our URL's
108
phorum_build_common_urls();
109
 
110
include phorum_get_template("header");
111
phorum_hook("after_header");
112
include phorum_get_template("profile");
113
phorum_hook("before_footer");
114
include phorum_get_template("footer");
115
 
116
?>