1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/*
Question2Answer by Gideon Greenspan and contributors
http://www.question2answer.org/
Description: Controller for user profile page
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
More about this license: http://www.question2answer.org/license.php
*/
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
header('Location: ../../');
exit;
}
// Determine the identify of the user
$handle = qa_request_part(1);
if (!strlen($handle)) {
$handle = qa_get_logged_in_handle();
qa_redirect(!empty($handle) ? 'user/' . $handle : 'users');
}
// Get the HTML to display for the handle, and if we're using external users, determine the userid
if (QA_FINAL_EXTERNAL_USERS) {
$userid = qa_handle_to_userid($handle);
if (!isset($userid))
return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
$usershtml = qa_get_users_html(array($userid), false, qa_path_to_root(), true);
$userhtml = @$usershtml[$userid];
} else
$userhtml = qa_html($handle);
// Display the appropriate page based on the request
switch (qa_request_part(2)) {
case 'wall':
qa_set_template('user-wall');
$qa_content = include QA_INCLUDE_DIR . 'pages/user-wall.php';
break;
case 'activity':
qa_set_template('user-activity');
$qa_content = include QA_INCLUDE_DIR . 'pages/user-activity.php';
break;
case 'questions':
qa_set_template('user-questions');
$qa_content = include QA_INCLUDE_DIR . 'pages/user-questions.php';
break;
case 'answers':
qa_set_template('user-answers');
$qa_content = include QA_INCLUDE_DIR . 'pages/user-answers.php';
break;
case null:
$qa_content = include QA_INCLUDE_DIR . 'pages/user-profile.php';
break;
default:
$qa_content = include QA_INCLUDE_DIR . 'qa-page-not-found.php';
break;
}
return $qa_content;