HomeHelpTrac

source: tags/6.1/change_status.php @ 10242

Revision 10242, 4.0 KB checked in by Alexander Trofimov, 3 years ago (diff)

dolphin 6.1.5, initial commit

Line 
1<?
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 . 'modules.inc.php' );
25require_once( BX_DIRECTORY_PATH_INC . 'tags.inc.php' );
26
27// --------------- page variables and login
28
29$_page['name_index']    = 36;
30$_page['css_name']      = 'change_status.css';
31
32$logged['member'] = member_auth(0);
33
34$_page['header'] = _t( "_CHANGE_STATUS_H" );
35$_page['header_text'] = _t( "_CHANGE_STATUS_H1", $site['title'] );
36
37// --------------- page components
38
39$_ni = $_page['name_index'];
40$_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();
41
42// --------------- [END] page components
43
44PageCode();
45
46// --------------- page components functions
47
48/**
49 * page code function
50 */
51function PageCompPageMainCode()
52{
53    $member['ID'] = (int)$_COOKIE['memberID'];
54
55    ob_start();
56
57    $p_arr = getProfileInfo( $member['ID'] );
58   
59    if ( $_POST['CHANGE_STATUS'] )
60    {
61        switch( $_POST['CHANGE_STATUS'] )
62        {
63            case 'SUSPEND':
64                if ( $p_arr['Status'] == 'Active' )
65                {
66                    db_res( "UPDATE `Profiles` SET `Status` = 'Suspended' WHERE `ID` = '{$member['ID']}';" );
67                   
68                    modules_block($p_arr['ID']);
69                }
70            break;
71
72            case 'ACTIVATE':
73                if ( $p_arr['Status'] == 'Suspended' )
74                {
75                    db_res( "UPDATE `Profiles` SET `Status` = 'Active' WHERE `ID` = {$member['ID']}" );
76                   
77                    // call modules to add user to modules
78                    $check_res = checkAction($member['ID'], ACTION_ID_USE_CHAT);
79                    if ( $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED )
80                        modules_unblock($p_arr['ID'], 'chat');
81                   
82                    $check_res = checkAction($member['ID'], ACTION_ID_USE_FORUM);
83                    if ( $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED )
84                        modules_unblock($p_arr['ID'], 'forum');
85                }
86            break;
87        }
88
89        createUserDataFile( $p_arr['ID'] );
90        reparseObjTags( 'profile', $member['ID'] );
91       
92        $p_arr = getProfileInfo( $member['ID'] );
93    }
94
95    echo "<table width=\"100%\" cellpadding=4 cellspacing=4><td align=center class=text2>";
96
97    echo _t( "_Profile status" );
98
99?>: <b><font class=prof_stat_<? echo $p_arr['Status']; ?>>&nbsp;<? echo _t( "__$p_arr[Status]" ); ?>&nbsp;</font></b><br />
100<?
101    switch ( $p_arr['Status'] )
102    {
103    case 'Active':
104        echo _t( "_PROFILE_CAN_SUSPEND" );
105?>
106<br /><br /><form action="<? echo $_SERVER['PHP_SELF']; ?>" method=post>
107<input type=hidden name=CHANGE_STATUS value=SUSPEND>
108<center><input class=no type=submit value="<? echo _t( "_Suspend account" ); ?>"></center>
109</form>
110<?
111        break;
112
113    case 'Suspended':
114        echo _t( "_PROFILE_CAN_ACTIVATE" );
115?>
116<br /><br /><form action="<? echo $_SERVER['PHP_SELF']; ?>" method=post>
117<input type=hidden name=CHANGE_STATUS value=ACTIVATE>
118<center><input class=no type=submit value="<? echo _t( "_Activate account" ); ?>"></center>
119</form>
120<?
121        break;
122    default:
123        echo _t( "_PROFILE_CANT_ACTIVATE/SUSPEND" );
124        break;
125    }
126
127    echo "</td></table>";
128
129    $ret = ob_get_contents();
130    ob_end_clean();
131
132    return $ret;
133}
134
135?>
Note: See TracBrowser for help on using the repository browser.