source: trunk/profile.php

Last change on this file was 2, checked in by george, 14 years ago
  • Přidáno: Trunk revize 13719.
File size: 4.4 KB
Line 
1<?php
2
3/***************************************************************************
4* Dolphin Smart Community Builder
5* -----------------
6* begin : Mon Mar 23 2006
7* copyright : (C) 2006 BoonEx Group
8* website : http://www.boonex.com/
9* This file is part of Dolphin - Smart Community Builder
10*
11* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
12* http://creativecommons.org/licenses/by/3.0/
13*
14* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16* See the Creative Commons Attribution 3.0 License for more details.
17* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
18* see license.txt file; if not, write to marketing@boonex.com
19***************************************************************************/
20
21define('BX_PROFILE_PAGE', 1);
22
23require_once( 'inc/header.inc.php' );
24require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
25require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
26require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
27
28bx_import('BxTemplProfileView');
29bx_import('BxDolInstallerUtils');
30
31$_page['name_index'] = 5;
32
33$profileID = getID( $_REQUEST['ID'] );
34$memberID = getLoggedId();
35
36if ( !$profileID ) {
37 header("HTTP/1.1 404 Not Found");
38 $_page['header'] = "{$site['title']} ". _t("_Member Profile");
39 $_page['header_text'] = _t("_View profile");
40 $_page['name_index'] = 0;
41 $_page_cont[0]['page_main_code'] = MsgBox( _t("_Profile NA") );
42 PageCode();
43 exit;
44}
45
46// Check if member can view profile
47$check_res = checkAction( $memberID, ACTION_ID_VIEW_PROFILES, true, $profileID );
48
49if ( $check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED
50 && !$logged['admin'] && !$logged['moderator'] && $memberID != $profileID)
51{
52 $_page['header'] = "{$site['title']} "._t("_Member Profile");
53 $_page['header_text'] = "{$site['title']} "._t("_Member Profile");
54 $_page['name_index'] = 0;
55 $_page_cont[0]['page_main_code'] = MsgBox($check_res[CHECK_ACTION_MESSAGE]);
56 PageCode();
57 exit;
58}
59
60$oProfile = new BxBaseProfileGenerator( $profileID );
61
62//Check privacy
63$oPrivacy = new BxDolPrivacy('Profiles', 'ID', 'ID');
64if(!$oPrivacy->check('view', $profileID, $memberID)) {
65 $_page['name_index'] = 0;
66 $_page['header'] = "{$site['title']} " . _t("_Member Profile");
67 $_page['header_text'] = "{$site['title']} " . _t("_Member Profile");
68 $_page_cont[0]['page_main_code'] = MsgBox(_t('_INVALID_ROLE'));
69 PageCode();
70 exit;
71}
72
73$oProfile->oCmtsView->getExtraCss();
74$oProfile->oCmtsView->getExtraJs();
75$oProfile->oVotingView->getExtraJs();
76
77$p_arr = $oProfile -> _aProfile;
78
79if (!($p_arr['ID'] && ($logged['admin'] || $logged['moderator'] || $oProfile->owner || $p_arr['Status'] == 'Active')))
80{
81 header("HTTP/1.1 404 Not Found");
82 $_page['header'] = "{$site['title']} ". _t("_Member Profile");
83 $_page['header_text'] = "{$site['title']} ". _t("_Member Profile");
84 $_page['name_index'] = 0;
85 $_page_cont[0]['page_main_code'] = MsgBox( _t("_Profile NA") );
86 PageCode();
87 exit;
88}
89
90$_page['header'] = process_line_output( $p_arr['NickName'] ) . ": ". htmlspecialchars_adv( $p_arr['Headline'] );
91$_ni = $_page['name_index'];
92
93$oPPV = new BxTemplProfileView($oProfile, $site, $dir);
94if (BxDolInstallerUtils::isModuleInstalled("profile_customize"))
95{
96 $_page_cont[$_ni]['custom_block'] = '<div id="profile_customize_page" style="display: none;">' .
97 BxDolService::call('profile_customize', 'get_customize_block', array()) . '</div>';
98 $_page_cont[$_ni]['page_main_css'] = '<style type="text/css">' .
99 BxDolService::call('profile_customize', 'get_profile_style', array($profileID)) . '</style>';
100}
101else
102{
103 $_page_cont[$_ni]['custom_block'] = '';
104 $_page_cont[$_ni]['page_main_css'] = '';
105}
106$_page['extra_js'] = $oTemplConfig -> sTinyMceEditorMiniJS;
107$_page_cont[$_ni]['page_main_code'] = $oPPV->getCode();
108
109//--- Profile -> View unit for Alerts Engine ---//
110if($profileID != $memberID) {
111 require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php');
112 $oAlert = new BxDolAlerts('profile', 'view', $profileID, $memberID);
113 $oAlert->alert();
114
115 bx_import ('BxDolViews');
116 new BxDolViews('profiles', $profileID);
117}
118//--- Profile -> View unit for Alerts Engine ---//
119
120$oSysTemplate->addJs('view_edit.js');
121PageCode();
122
123?>
Note: See TracBrowser for help on using the repository browser.