-
Notifications
You must be signed in to change notification settings - Fork 138
/
profile.php
114 lines (88 loc) · 3.76 KB
/
profile.php
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/**
* Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
* CC-BY License - http://creativecommons.org/licenses/by/3.0/
*/
define('BX_PROFILE_PAGE', 1);
require_once( 'inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
bx_import('BxTemplProfileView');
bx_import('BxTemplProfileGenerator');
bx_import('BxDolInstallerUtils');
$profileID = getID( $_GET['ID'] );
$memberID = getLoggedId();
$sCodeLang = 'lang';
$sCodeTempl = $GLOBALS['oSysTemplate']->getCodeKey();
if(isset($_GET[$sCodeLang]) || isset($_GET[$sCodeTempl])) {
$sCurrentUrl = $_SERVER['PHP_SELF'] . '?' . bx_encode_url_params($_GET, array($sCodeLang, $sCodeTempl));
$aMatch = array();
if(preg_match('/profile.php\?ID=([a-zA-Z0-9_-]+)(.*)/', $sCurrentUrl, $aMatch)) {
header("HTTP/1.1 301 Moved Permanently");
header ('Location:' . getProfileLink($profileID));
send_headers_page_changed();
}
}
// check profile membership, status, privacy and if it is exists
bx_check_profile_visibility($profileID, $memberID);
// make profile view alert and record profile view event
if ($profileID != $memberID) {
require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php');
$oAlert = new BxDolAlerts('profile', 'view', $profileID, $memberID);
$oAlert->alert();
bx_import ('BxDolViews');
new BxDolViews('profiles', $profileID);
}
$oProfile = new BxTemplProfileGenerator( $profileID );
$oProfile->oCmtsView->getExtraCss();
$oProfile->oCmtsView->getExtraJs();
$oProfile->oVotingView->getExtraJs();
$oSysTemplate->addJs('view_edit.js');
$_ni = 5;
$_page['name_index'] = $_ni;
$_page['css_name'] = array('profile_view.css', 'profile_view_tablet.css', 'profile_view_phone.css');
$p_arr = $oProfile -> _aProfile;
$sUserInfo = $oFunctions->getUserInfo($p_arr['ID']);
if(!empty($sUserInfo))
$sUserInfo = ': ' . htmlspecialchars_adv($sUserInfo);
$_page['header'] = process_line_output(getNickName($p_arr['ID'])) . $sUserInfo;
$oPPV = new BxTemplProfileView($oProfile, $site, $dir);
$_page_cont[$_ni]['page_main_code'] = $oPPV->getCode();
$_page_cont[$_ni]['custom_block'] = '';
$_page_cont[$_ni]['page_main_css'] = '';
// add profile customizer
if (BxDolInstallerUtils::isModuleInstalled("profile_customize")) {
$_page_cont[$_ni]['custom_block'] = '<div id="profile_customize_page" style="display: none;">' .
BxDolService::call('profile_customize', 'get_customize_block', array()) . '</div>';
$_page_cont[$_ni]['page_main_css'] = '<style type="text/css">' .
BxDolService::call('profile_customize', 'get_profile_style', array($profileID)) . '</style>';
}
// Submenu actions
$iId = $profileID;
$iMemberId = $memberID;
$sTxtProfileAccountPage = _t('_sys_am_profile_account_page');
$sTxtProfileMessage = _t('_sys_am_profile_message');
$sTxtFriendAdd = _t('_sys_am_profile_friend_add');
$sTxtFriendAccept = _t('_sys_am_profile_friend_accept');
$sTxtFriendCancel = _t('_sys_am_profile_friend_cancel');
$aVars = array(
'ID' => $iId,
'member_id' => $iMemberId,
'BaseUri' => BX_DOL_URL_ROOT,
'cpt_am_profile_account_page' => $sTxtProfileAccountPage
);
if(isFriendRequest($iMemberId, $iId)) {
$aVars['cpt_am_friend_add'] = '';
$aVars['cpt_am_profile_message'] = $sTxtProfileMessage;
} else if(isFriendRequest($iId, $iMemberId)) {
$aVars['cpt_am_friend_add'] = '';
$aVars['cpt_am_friend_accept'] = $sTxtFriendAccept;
$aVars['cpt_am_profile_message'] = '';
} else {
$aVars['cpt_am_friend_add'] = $sTxtFriendAdd;
$aVars['cpt_am_friend_cancel'] = $sTxtFriendCancel;
$aVars['cpt_am_profile_message'] = $sTxtProfileMessage;
}
$GLOBALS['oTopMenu']->setCustomSubActions($aVars, 'ProfileTitle', false);
PageCode();