source: trunk/change_status.php

Last change on this file was 2, checked in by george, 14 years ago
  • Přidáno: Trunk revize 13719.
File size: 5.8 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
21require_once( 'inc/header.inc.php' );
22require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
23require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
24require_once( BX_DIRECTORY_PATH_INC . 'tags.inc.php' );
25
26if (isset($_REQUEST['action']) && $_REQUEST['action']=='get_prof_status_mess') {
27 check_logged();
28 $iLoggedID = (isMember() || isAdmin()) ? (int)$_COOKIE['memberID'] : 0;
29 if ($iLoggedID) {
30 bx_import( 'BxDolUserStatusView' );
31 echo BxDolUserStatusView::getStatusPageLight($iLoggedID);
32 }
33 exit;
34}
35
36if (isset($_REQUEST['action']) && $_REQUEST['action']=='get_prof_comment_block') {
37 check_logged();
38 global $logged;
39 $iLoggedID = ($logged['member']) ? (int)$_COOKIE['memberID'] : 0;
40 $iProfileID = (int)$_REQUEST['id'];
41 if ($iProfileID) {
42 $sCloseC = _t('_Close');
43 bx_import( 'BxTemplCmtsView' );
44 $oCmtsView = new BxTemplCmtsView ('profile', $iProfileID);
45 if (!$oCmtsView->isEnabled()) exit;
46
47 $sCloseImg = getTemplateImage('close.gif');
48 $sCaptionItem = <<<BLAH
49<div class="dbTopMenu">
50 <img src="{$sCloseImg}" class="login_ajx_close" />
51</div>
52BLAH;
53 $sCommentsBlock = $GLOBALS['oFunctions']->transBox(
54 DesignBoxContent(_t('_Comments'), $oCmtsView->_getPostReplyBox(), 1, $sCaptionItem), false
55 );
56
57 echo <<<EOF
58<style>
59 div.cmt-post-reply {
60 position: relative;
61 }
62</style>
63{$sCommentsBlock}
64EOF;
65 }
66 exit;
67}
68
69// --------------- page variables and login
70
71$_page['name_index'] = 36;
72$_page['css_name'] = 'change_status.css';
73
74$logged['member'] = member_auth(0);
75
76$_page['header'] = _t( "_CHANGE_STATUS_H" );
77$_page['header_text'] = _t( "_CHANGE_STATUS_H1", $site['title'] );
78
79// --------------- page components
80
81$_ni = $_page['name_index'];
82$_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();
83
84// --------------- [END] page components
85$GLOBALS['oTopMenu']->setCustomSubHeader(_t( "_CHANGE_STATUS_H" ));
86PageCode();
87
88// --------------- page components functions
89
90/**
91 * page code function
92 */
93function PageCompPageMainCode()
94{
95 $member['ID'] = (int)$_COOKIE['memberID'];
96
97 ob_start();
98
99 $p_arr = getProfileInfo( $member['ID'] );
100
101 if ( $_POST['CHANGE_STATUS'] )
102 {
103 switch( $_POST['CHANGE_STATUS'] )
104 {
105 case 'SUSPEND':
106 if ( $p_arr['Status'] == 'Active' )
107 {
108 db_res( "UPDATE `Profiles` SET `Status` = 'Suspended' WHERE `ID` = '{$member['ID']}';" );
109 }
110 break;
111
112 case 'ACTIVATE':
113 if ( $p_arr['Status'] == 'Suspended' )
114 {
115 db_res( "UPDATE `Profiles` SET `Status` = 'Active' WHERE `ID` = {$member['ID']}" );
116 }
117 break;
118 }
119
120 createUserDataFile( $p_arr['ID'] );
121 reparseObjTags( 'profile', $member['ID'] );
122
123 $p_arr = getProfileInfo( $member['ID'] );
124 }
125
126 echo "<table width=\"100%\" cellpadding=4 cellspacing=4><td align=center class=text2>";
127
128 echo _t( "_Profile status" );
129
130?>: <b><font class=prof_stat_<? echo $p_arr['Status']; ?>>&nbsp;<? echo _t( "__$p_arr[Status]" ); ?>&nbsp;</font></b><br />
131<?
132 switch ( $p_arr['Status'] )
133 {
134 case 'Active':
135 echo _t( "_PROFILE_CAN_SUSPEND" );
136
137 $aForm = array (
138 'form_attrs' => array (
139 'action' => $_SERVER['PHP_SELF'],
140 'method' => 'post',
141 'name' => 'form_change_status'
142 ),
143
144 'inputs' => array(
145 'tags' => array (
146 'type' => 'hidden',
147 'name' => 'CHANGE_STATUS',
148 'value' => 'SUSPEND',
149 ),
150 'subscribe' => array (
151 'type' => 'submit',
152 'name' => 'subscribe',
153 'value' => _t('_Suspend account'),
154 ),
155 ),
156 );
157
158 $oForm = new BxTemplFormView($aForm);
159?>
160<br /><br />
161<? echo $oForm -> getCode();
162 break;
163
164 case 'Suspended':
165 echo _t( "_PROFILE_CAN_ACTIVATE" );
166
167 $aForm = array (
168 'form_attrs' => array (
169 'action' => $_SERVER['PHP_SELF'],
170 'method' => 'post',
171 'name' => 'form_change_status'
172 ),
173
174 'inputs' => array(
175 'tags' => array (
176 'type' => 'hidden',
177 'name' => 'CHANGE_STATUS',
178 'value' => 'ACTIVATE',
179 ),
180 'subscribe' => array (
181 'type' => 'submit',
182 'name' => 'subscribe',
183 'value' => _t('_Activate account'),
184 ),
185 ),
186 );
187
188 $oForm = new BxTemplFormView($aForm);
189?>
190<br /><br />
191<? echo $oForm -> getCode();
192
193 break;
194 default:
195 echo _t( "_PROFILE_CANT_ACTIVATE/SUSPEND" );
196 break;
197 }
198
199 echo "</td></table>";
200
201 $ret = ob_get_contents();
202 ob_end_clean();
203
204 return $ret;
205}
206
207?>
Note: See TracBrowser for help on using the repository browser.